babylonjs-gui 5.51.0 → 5.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/babylon.gui.d.ts +23 -1
- package/babylon.gui.js +18 -8
- package/babylon.gui.js.map +1 -1
- package/babylon.gui.min.js +1 -1
- package/babylon.gui.min.js.map +1 -1
- package/babylon.gui.module.d.ts +46 -2
- package/package.json +2 -2
package/babylon.gui.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("babylonjs")):"function"==typeof define&&define.amd?define("babylonjs-gui",["babylonjs"],e):"object"==typeof exports?exports["babylonjs-gui"]=e(require("babylonjs")):(t.BABYLON=t.BABYLON||{},t.BABYLON.GUI=e(t.BABYLON))}("undefined"!=typeof self?self:"undefined"!=typeof global?global:this,(t=>(()=>{"use strict";var e={520:e=>{e.exports=t}},i={};function o(t){var n=i[t];if(void 0!==n)return n.exports;var r=i[t]={exports:{}};return e[t](r,r.exports,o),r.exports}o.d=(t,e)=>{for(var i in e)o.o(e,i)&&!o.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{o.d(n,{default:()=>le});var t={};o.r(t),o.d(t,{AbstractButton3D:()=>ft,AdvancedDynamicTexture:()=>st,AdvancedDynamicTextureInstrumentation:()=>lt,BaseGradient:()=>ot,BaseSlider:()=>Q,Button:()=>C,Button3D:()=>pt,Checkbox:()=>S,CheckboxGroup:()=>H,ColorPicker:()=>M,Container:()=>y,Container3D:()=>gt,Control:()=>v,Control3D:()=>ut,CornerHandle:()=>kt,CylinderPanel:()=>mt,DisplayGrid:()=>tt,Ellipse:()=>E,FluentBackplateMaterial:()=>Bt,FluentButtonMaterial:()=>Ot,FluentMaterial:()=>yt,FluentMaterialDefines:()=>vt,FocusableButton:()=>F,GUI3DManager:()=>ae,GizmoHandle:()=>Dt,Grid:()=>w,HandMenu:()=>Pt,HandleMaterial:()=>Ft,HandleState:()=>Et,HolographicBackplate:()=>Ct,HolographicButton:()=>Tt,HolographicSlate:()=>At,Image:()=>B,ImageBasedSlider:()=>et,ImageScrollBar:()=>K,InputPassword:()=>L,InputText:()=>R,InputTextArea:()=>D,KeyPropertySet:()=>J,Line:()=>k,LinearGradient:()=>nt,MRDLBackplateMaterial:()=>Xt,MRDLSliderBarMaterial:()=>Gt,MRDLSliderThumbMaterial:()=>jt,MathTools:()=>m,Matrix2D:()=>b,Measure:()=>p,MeshButton3D:()=>zt,MultiLine:()=>A,MultiLinePoint:()=>N,NearMenu:()=>Qt,PlanePanel:()=>Vt,RadialGradient:()=>rt,RadioButton:()=>z,RadioGroup:()=>G,Rectangle:()=>P,ScatterPanel:()=>Wt,ScrollBar:()=>X,ScrollViewer:()=>Z,SelectionPanel:()=>j,SelectorGroup:()=>W,SideHandle:()=>Lt,SlateGizmo:()=>Nt,Slider:()=>V,Slider3D:()=>Kt,SliderGroup:()=>U,SpherePanel:()=>Zt,StackPanel:()=>T,StackPanel3D:()=>qt,Style:()=>at,TextBlock:()=>I,TextWrapper:()=>O,TextWrapping:()=>x,ToggleButton:()=>q,TouchButton3D:()=>Rt,TouchHolographicButton:()=>wt,TouchHolographicButtonV3:()=>re,TouchHolographicMenu:()=>xt,TouchMeshButton3D:()=>Jt,ValueAndUnit:()=>h,Vector2WithInfo:()=>g,Vector3WithInfo:()=>ct,VirtualKeyboard:()=>$,VolumeBasedPanel:()=>bt,XmlLoader:()=>ht,name:()=>it});var e={};o.r(e),o.d(e,{AbstractButton3D:()=>ft,AdvancedDynamicTexture:()=>st,AdvancedDynamicTextureInstrumentation:()=>lt,BaseGradient:()=>ot,BaseSlider:()=>Q,Button:()=>C,Button3D:()=>pt,Checkbox:()=>S,CheckboxGroup:()=>H,ColorPicker:()=>M,Container:()=>y,Container3D:()=>gt,Control:()=>v,Control3D:()=>ut,CornerHandle:()=>kt,CylinderPanel:()=>mt,DisplayGrid:()=>tt,Ellipse:()=>E,FluentBackplateMaterial:()=>Bt,FluentButtonMaterial:()=>Ot,FluentMaterial:()=>yt,FluentMaterialDefines:()=>vt,FocusableButton:()=>F,GUI3DManager:()=>ae,GizmoHandle:()=>Dt,Grid:()=>w,HandMenu:()=>Pt,HandleMaterial:()=>Ft,HandleState:()=>Et,HolographicBackplate:()=>Ct,HolographicButton:()=>Tt,HolographicSlate:()=>At,Image:()=>B,ImageBasedSlider:()=>et,ImageScrollBar:()=>K,InputPassword:()=>L,InputText:()=>R,InputTextArea:()=>D,KeyPropertySet:()=>J,Line:()=>k,LinearGradient:()=>nt,MRDLBackplateMaterial:()=>Xt,MRDLSliderBarMaterial:()=>Gt,MRDLSliderThumbMaterial:()=>jt,MathTools:()=>m,Matrix2D:()=>b,Measure:()=>p,MeshButton3D:()=>zt,MultiLine:()=>A,MultiLinePoint:()=>N,NearMenu:()=>Qt,PlanePanel:()=>Vt,RadialGradient:()=>rt,RadioButton:()=>z,RadioGroup:()=>G,Rectangle:()=>P,ScatterPanel:()=>Wt,ScrollBar:()=>X,ScrollViewer:()=>Z,SelectionPanel:()=>j,SelectorGroup:()=>W,SideHandle:()=>Lt,SlateGizmo:()=>Nt,Slider:()=>V,Slider3D:()=>Kt,SliderGroup:()=>U,SpherePanel:()=>Zt,StackPanel:()=>T,StackPanel3D:()=>qt,Style:()=>at,TextBlock:()=>I,TextWrapper:()=>O,TextWrapping:()=>x,ToggleButton:()=>q,TouchButton3D:()=>Rt,TouchHolographicButton:()=>wt,TouchHolographicButtonV3:()=>re,TouchHolographicMenu:()=>xt,TouchMeshButton3D:()=>Jt,ValueAndUnit:()=>h,Vector2WithInfo:()=>g,Vector3WithInfo:()=>ct,VirtualKeyboard:()=>$,VolumeBasedPanel:()=>bt,XmlLoader:()=>ht,name:()=>it});var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},i(t,e)};function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function o(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}function a(t,e,i,o){var n,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,o);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a}function s(t,e,i,o){return new(i||(i=Promise))((function(n,r){function a(t){try{l(o.next(t))}catch(t){r(t)}}function s(t){try{l(o.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,s)}l((o=o.apply(t,e||[])).next())}))}function l(t,e){var i,o,n,r,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;r&&(r=0,s[0]&&(a=0)),a;)try{if(i=1,o&&(n=2&s[0]?o.return:s[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,s[1])).done)return n;switch(o=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((n=(n=a.trys).length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],o=0}finally{i=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}Object.create,Object.create;var _=o(520),h=function(){function t(e,i,o){void 0===i&&(i=t.UNITMODE_PIXEL),void 0===o&&(o=!0),this.negativeValueAllowed=o,this._value=1,this._unit=t.UNITMODE_PIXEL,this.ignoreAdaptiveScaling=!1,this.onChangedObservable=new _.Observable,this._value=e,this._unit=i,this._originalUnit=i}return Object.defineProperty(t.prototype,"isPercentage",{get:function(){return this._unit===t.UNITMODE_PERCENTAGE},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isPixel",{get:function(){return this._unit===t.UNITMODE_PIXEL},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"internalValue",{get:function(){return this._value},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this._value},set:function(t){t!==this._value&&(this._value=t,this.onChangedObservable.notifyObservers())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"unit",{get:function(){return this._unit},set:function(t){t!==this._unit&&(this._unit=t,this.onChangedObservable.notifyObservers())},enumerable:!1,configurable:!0}),t.prototype.getValueInPixel=function(t,e){return this.isPixel?this.getValue(t):this.getValue(t)*e},t.prototype.updateInPlace=function(e,i){return void 0===i&&(i=t.UNITMODE_PIXEL),this.value===e&&this.unit===i||(this._value=e,this._unit=i,this.onChangedObservable.notifyObservers()),this},t.prototype.getValue=function(e){if(e&&!this.ignoreAdaptiveScaling&&this.unit!==t.UNITMODE_PERCENTAGE){var i=0,o=0;if(e.idealWidth&&(i=this._value*e.getSize().width/e.idealWidth),e.idealHeight&&(o=this._value*e.getSize().height/e.idealHeight),e.useSmallestIdeal&&e.idealWidth&&e.idealHeight)return window.innerWidth<window.innerHeight?i:o;if(e.idealWidth)return i;if(e.idealHeight)return o}return this._value},t.prototype.toString=function(e,i){switch(this._unit){case t.UNITMODE_PERCENTAGE:var o=100*this.getValue(e);return(i?o.toFixed(i):o)+"%";case t.UNITMODE_PIXEL:var n=this.getValue(e);return(i?n.toFixed(i):n)+"px"}return this._unit.toString()},t.prototype.fromString=function(e){var i=t._Regex.exec(e.toString());if(!i||0===i.length)return!1;var o=parseFloat(i[1]),n=this._originalUnit;if(this.negativeValueAllowed||o<0&&(o=0),4===i.length)switch(i[3]){case"px":n=t.UNITMODE_PIXEL;break;case"%":n=t.UNITMODE_PERCENTAGE,o/=100}return(o!==this._value||n!==this._unit)&&(this._value=o,this._unit=n,this.onChangedObservable.notifyObservers(),!0)},Object.defineProperty(t,"UNITMODE_PERCENTAGE",{get:function(){return t._UNITMODE_PERCENTAGE},enumerable:!1,configurable:!0}),Object.defineProperty(t,"UNITMODE_PIXEL",{get:function(){return t._UNITMODE_PIXEL},enumerable:!1,configurable:!0}),t._Regex=/(^-?\d*(\.\d+)?)(%|px)?/,t._UNITMODE_PERCENTAGE=0,t._UNITMODE_PIXEL=1,t}(),c=[new _.Vector2(0,0),new _.Vector2(0,0),new _.Vector2(0,0),new _.Vector2(0,0)],u=[new _.Vector2(0,0),new _.Vector2(0,0),new _.Vector2(0,0),new _.Vector2(0,0)],d=new _.Vector2(0,0),f=new _.Vector2(0,0),p=function(){function t(t,e,i,o){this.left=t,this.top=e,this.width=i,this.height=o}return t.prototype.copyFrom=function(t){this.left=t.left,this.top=t.top,this.width=t.width,this.height=t.height},t.prototype.copyFromFloats=function(t,e,i,o){this.left=t,this.top=e,this.width=i,this.height=o},t.CombineToRef=function(t,e,i){var o=Math.min(t.left,e.left),n=Math.min(t.top,e.top),r=Math.max(t.left+t.width,e.left+e.width),a=Math.max(t.top+t.height,e.top+e.height);i.left=o,i.top=n,i.width=r-o,i.height=a-n},t.prototype.addAndTransformToRef=function(t,e,i,o,n,r){var a=this.left+e,s=this.top+i,l=this.width+o,_=this.height+n;c[0].copyFromFloats(a,s),c[1].copyFromFloats(a+l,s),c[2].copyFromFloats(a+l,s+_),c[3].copyFromFloats(a,s+_),d.copyFromFloats(Number.MAX_VALUE,Number.MAX_VALUE),f.copyFromFloats(0,0);for(var h=0;h<4;h++)t.transformCoordinates(c[h].x,c[h].y,u[h]),d.x=Math.floor(Math.min(d.x,u[h].x)),d.y=Math.floor(Math.min(d.y,u[h].y)),f.x=Math.ceil(Math.max(f.x,u[h].x)),f.y=Math.ceil(Math.max(f.y,u[h].y));r.left=d.x,r.top=d.y,r.width=f.x-d.x,r.height=f.y-d.y},t.prototype.transformToRef=function(t,e){this.addAndTransformToRef(t,0,0,0,0,e)},t.prototype.isEqualsTo=function(t){return this.left===t.left&&this.top===t.top&&this.width===t.width&&this.height===t.height},t.Empty=function(){return new t(0,0,0,0)},t}(),g=function(t){function e(e,i){void 0===i&&(i=0);var o=t.call(this,e.x,e.y)||this;return o.buttonIndex=i,o}return r(e,t),e}(_.Vector2),b=function(){function t(t,e,i,o,n,r){this.m=new Float32Array(6),this.fromValues(t,e,i,o,n,r)}return t.prototype.fromValues=function(t,e,i,o,n,r){return this.m[0]=t,this.m[1]=e,this.m[2]=i,this.m[3]=o,this.m[4]=n,this.m[5]=r,this},t.prototype.determinant=function(){return this.m[0]*this.m[3]-this.m[1]*this.m[2]},t.prototype.invertToRef=function(t){var e=this.m[0],i=this.m[1],o=this.m[2],n=this.m[3],r=this.m[4],a=this.m[5],s=this.determinant();if(s<_.Epsilon*_.Epsilon)return t.m[0]=0,t.m[1]=0,t.m[2]=0,t.m[3]=0,t.m[4]=0,t.m[5]=0,this;var l=1/s,h=o*a-n*r,c=i*r-e*a;return t.m[0]=n*l,t.m[1]=-i*l,t.m[2]=-o*l,t.m[3]=e*l,t.m[4]=h*l,t.m[5]=c*l,this},t.prototype.multiplyToRef=function(t,e){var i=this.m[0],o=this.m[1],n=this.m[2],r=this.m[3],a=this.m[4],s=this.m[5],l=t.m[0],_=t.m[1],h=t.m[2],c=t.m[3],u=t.m[4],d=t.m[5];return e.m[0]=i*l+o*h,e.m[1]=i*_+o*c,e.m[2]=n*l+r*h,e.m[3]=n*_+r*c,e.m[4]=a*l+s*h+u,e.m[5]=a*_+s*c+d,this},t.prototype.transformCoordinates=function(t,e,i){return i.x=t*this.m[0]+e*this.m[2]+this.m[4],i.y=t*this.m[1]+e*this.m[3]+this.m[5],this},t.Identity=function(){return new t(1,0,0,1,0,0)},t.IdentityToRef=function(t){t.m[0]=1,t.m[1]=0,t.m[2]=0,t.m[3]=1,t.m[4]=0,t.m[5]=0},t.TranslationToRef=function(t,e,i){i.fromValues(1,0,0,1,t,e)},t.ScalingToRef=function(t,e,i){i.fromValues(t,0,0,e,0,0)},t.RotationToRef=function(t,e){var i=Math.sin(t),o=Math.cos(t);e.fromValues(o,i,-i,o,0,0)},t.ComposeToRef=function(e,i,o,n,r,a,s){t.TranslationToRef(e,i,t._TempPreTranslationMatrix),t.ScalingToRef(n,r,t._TempScalingMatrix),t.RotationToRef(o,t._TempRotationMatrix),t.TranslationToRef(-e,-i,t._TempPostTranslationMatrix),t._TempPreTranslationMatrix.multiplyToRef(t._TempScalingMatrix,t._TempCompose0),t._TempCompose0.multiplyToRef(t._TempRotationMatrix,t._TempCompose1),a?(t._TempCompose1.multiplyToRef(t._TempPostTranslationMatrix,t._TempCompose2),t._TempCompose2.multiplyToRef(a,s)):t._TempCompose1.multiplyToRef(t._TempPostTranslationMatrix,s)},t._TempPreTranslationMatrix=t.Identity(),t._TempPostTranslationMatrix=t.Identity(),t._TempRotationMatrix=t.Identity(),t._TempScalingMatrix=t.Identity(),t._TempCompose0=t.Identity(),t._TempCompose1=t.Identity(),t._TempCompose2=t.Identity(),t}(),m=function(){function t(){}return t.Round=function(e,i){return void 0===i&&(i=t.DefaultRoundingPrecision),Math.round(e*i)/i},t.DefaultRoundingPrecision=100,t}(),v=function(){function t(e){this.name=e,this._alpha=1,this._alphaSet=!1,this._zIndex=0,this._currentMeasure=p.Empty(),this._tempPaddingMeasure=p.Empty(),this._fontFamily="Arial",this._fontStyle="",this._fontWeight="",this._fontSize=new h(18,h.UNITMODE_PIXEL,!1),this._width=new h(1,h.UNITMODE_PERCENTAGE,!1),this._height=new h(1,h.UNITMODE_PERCENTAGE,!1),this._color="",this._style=null,this._horizontalAlignment=t.HORIZONTAL_ALIGNMENT_CENTER,this._verticalAlignment=t.VERTICAL_ALIGNMENT_CENTER,this._isDirty=!0,this._wasDirty=!1,this._tempParentMeasure=p.Empty(),this._prevCurrentMeasureTransformedIntoGlobalSpace=p.Empty(),this._cachedParentMeasure=p.Empty(),this._descendantsOnlyPadding=!1,this._paddingLeft=new h(0),this._paddingRight=new h(0),this._paddingTop=new h(0),this._paddingBottom=new h(0),this._left=new h(0),this._top=new h(0),this._scaleX=1,this._scaleY=1,this._rotation=0,this._transformCenterX=.5,this._transformCenterY=.5,this._transformMatrix=b.Identity(),this._invertTransformMatrix=b.Identity(),this._transformedPosition=_.Vector2.Zero(),this._isMatrixDirty=!0,this._isVisible=!0,this._isHighlighted=!1,this._highlightColor="#4affff",this._highlightLineWidth=2,this._fontSet=!1,this._dummyVector2=_.Vector2.Zero(),this._downCount=0,this._enterCount=-1,this._doNotRender=!1,this._downPointerIds={},this._evaluatedMeasure=new p(0,0,0,0),this._evaluatedParentMeasure=new p(0,0,0,0),this._isEnabled=!0,this._disabledColor="#9a9a9a",this._disabledColorItem="#6a6a6a",this._isReadOnly=!1,this._gradient=null,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 h(0),this._linkOffsetY=new h(0),this._accessibilityTag=null,this.onAccessibilityTagChangedObservable=new _.Observable,this.onWheelObservable=new _.Observable,this.onPointerMoveObservable=new _.Observable,this.onPointerOutObservable=new _.Observable,this.onPointerDownObservable=new _.Observable,this.onPointerUpObservable=new _.Observable,this.onPointerClickObservable=new _.Observable,this.onPointerEnterObservable=new _.Observable,this.onDirtyObservable=new _.Observable,this.onBeforeDrawObservable=new _.Observable,this.onAfterDrawObservable=new _.Observable,this.onDisposeObservable=new _.Observable,this.onIsVisibleChangedObservable=new _.Observable,this.fixedRatio=0,this._fixedRatioMasterIsWidth=!0,this.animations=null,this._tmpMeasureA=new p(0,0,0,0)}return Object.defineProperty(t.prototype,"isReadOnly",{get:function(){return this._isReadOnly},set:function(t){this._isReadOnly=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transformedMeasure",{get:function(){return this._evaluatedMeasure},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowOffsetX",{get:function(){return this._shadowOffsetX},set:function(t){this._shadowOffsetX!==t&&(this._shadowOffsetX=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowOffsetY",{get:function(){return this._shadowOffsetY},set:function(t){this._shadowOffsetY!==t&&(this._shadowOffsetY=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowBlur",{get:function(){return this._shadowBlur},set:function(t){this._shadowBlur!==t&&(this._previousShadowBlur=this._shadowBlur,this._shadowBlur=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowColor",{get:function(){return this._shadowColor},set:function(t){this._shadowColor!==t&&(this._shadowColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"typeName",{get:function(){return this._getTypeName()},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return this._getTypeName()},Object.defineProperty(t.prototype,"accessibilityTag",{get:function(){return this._accessibilityTag},set:function(t){this._accessibilityTag=t,this.onAccessibilityTagChangedObservable.notifyObservers(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"host",{get:function(){return this._host},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontOffset",{get:function(){return this._fontOffset},set:function(t){this._fontOffset=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"alpha",{get:function(){return this._alpha},set:function(t){this._alpha!==t&&(this._alphaSet=!0,this._alpha=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"highlightLineWidth",{get:function(){return this._highlightLineWidth},set:function(t){this._highlightLineWidth!==t&&(this._highlightLineWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isHighlighted",{get:function(){return this._isHighlighted},set:function(t){this._isHighlighted!==t&&(this._isHighlighted=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"highlightColor",{get:function(){return this._highlightColor},set:function(t){this._highlightColor!==t&&(this._highlightColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaleX",{get:function(){return this._scaleX},set:function(t){this._scaleX!==t&&(this._scaleX=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaleY",{get:function(){return this._scaleY},set:function(t){this._scaleY!==t&&(this._scaleY=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation!==t&&(this._rotation=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transformCenterY",{get:function(){return this._transformCenterY},set:function(t){this._transformCenterY!==t&&(this._transformCenterY=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transformCenterX",{get:function(){return this._transformCenterX},set:function(t){this._transformCenterX!==t&&(this._transformCenterX=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"horizontalAlignment",{get:function(){return this._horizontalAlignment},set:function(t){this._horizontalAlignment!==t&&(this._horizontalAlignment=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"verticalAlignment",{get:function(){return this._verticalAlignment},set:function(t){this._verticalAlignment!==t&&(this._verticalAlignment=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this._width.toString(this._host)},set:function(t){this._fixedRatioMasterIsWidth=!0,this._width.toString(this._host)!==t&&this._width.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"widthInPixels",{get:function(){return this._width.getValueInPixel(this._host,this._cachedParentMeasure.width)},set:function(t){isNaN(t)||(this._fixedRatioMasterIsWidth=!0,this.width=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._height.toString(this._host)},set:function(t){this._fixedRatioMasterIsWidth=!1,this._height.toString(this._host)!==t&&this._height.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"heightInPixels",{get:function(){return this._height.getValueInPixel(this._host,this._cachedParentMeasure.height)},set:function(t){isNaN(t)||(this._fixedRatioMasterIsWidth=!1,this.height=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(t){this._fontFamily!==t&&(this._fontFamily=t,this._resetFontCache())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(t){this._fontStyle!==t&&(this._fontStyle=t,this._resetFontCache())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(t){this._fontWeight!==t&&(this._fontWeight=t,this._resetFontCache())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"style",{get:function(){return this._style},set:function(t){var e=this;this._style&&(this._style.onChangedObservable.remove(this._styleObserver),this._styleObserver=null),this._style=t,this._style&&(this._styleObserver=this._style.onChangedObservable.add((function(){e._markAsDirty(),e._resetFontCache()}))),this._markAsDirty(),this._resetFontCache()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_isFontSizeInPercentage",{get:function(){return this._fontSize.isPercentage},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontSizeInPixels",{get:function(){var t=this._style?this._style._fontSize:this._fontSize;return t.isPixel?t.getValue(this._host):t.getValueInPixel(this._host,this._tempParentMeasure.height||this._cachedParentMeasure.height)},set:function(t){isNaN(t)||(this.fontSize=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontSize",{get:function(){return this._fontSize.toString(this._host)},set:function(t){this._fontSize.toString(this._host)!==t&&this._fontSize.fromString(t)&&(this._markAsDirty(),this._resetFontCache())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"color",{get:function(){return this._color},set:function(t){this._color!==t&&(this._color=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"gradient",{get:function(){return this._gradient},set:function(t){this._gradient!==t&&(this._gradient=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"zIndex",{get:function(){return this._zIndex},set:function(t){this.zIndex!==t&&(this._zIndex=t,this.parent&&this.parent._reOrderControl(this))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"notRenderable",{get:function(){return this._doNotRender},set:function(t){this._doNotRender!==t&&(this._doNotRender=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isVisible",{get:function(){return this._isVisible},set:function(t){this._isVisible!==t&&(this._isVisible=t,this._markAsDirty(!0),this.onIsVisibleChangedObservable.notifyObservers(t))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isDirty",{get:function(){return this._isDirty},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linkedMesh",{get:function(){return this._linkedMesh},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"descendantsOnlyPadding",{get:function(){return this._descendantsOnlyPadding},set:function(t){this._descendantsOnlyPadding!==t&&(this._descendantsOnlyPadding=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddingLeft",{get:function(){return this._paddingLeft.toString(this._host)},set:function(t){this._paddingLeft.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddingLeftInPixels",{get:function(){return this._paddingLeft.getValueInPixel(this._host,this._cachedParentMeasure.width)},set:function(t){isNaN(t)||(this.paddingLeft=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_paddingLeftInPixels",{get:function(){return this._descendantsOnlyPadding?0:this.paddingLeftInPixels},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddingRight",{get:function(){return this._paddingRight.toString(this._host)},set:function(t){this._paddingRight.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddingRightInPixels",{get:function(){return this._paddingRight.getValueInPixel(this._host,this._cachedParentMeasure.width)},set:function(t){isNaN(t)||(this.paddingRight=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_paddingRightInPixels",{get:function(){return this._descendantsOnlyPadding?0:this.paddingRightInPixels},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddingTop",{get:function(){return this._paddingTop.toString(this._host)},set:function(t){this._paddingTop.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddingTopInPixels",{get:function(){return this._paddingTop.getValueInPixel(this._host,this._cachedParentMeasure.height)},set:function(t){isNaN(t)||(this.paddingTop=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_paddingTopInPixels",{get:function(){return this._descendantsOnlyPadding?0:this.paddingTopInPixels},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddingBottom",{get:function(){return this._paddingBottom.toString(this._host)},set:function(t){this._paddingBottom.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddingBottomInPixels",{get:function(){return this._paddingBottom.getValueInPixel(this._host,this._cachedParentMeasure.height)},set:function(t){isNaN(t)||(this.paddingBottom=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_paddingBottomInPixels",{get:function(){return this._descendantsOnlyPadding?0:this.paddingBottomInPixels},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"left",{get:function(){return this._left.toString(this._host)},set:function(t){this._left.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"leftInPixels",{get:function(){return this._left.getValueInPixel(this._host,this._cachedParentMeasure.width)},set:function(t){isNaN(t)||(this.left=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this._top.toString(this._host)},set:function(t){this._top.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"topInPixels",{get:function(){return this._top.getValueInPixel(this._host,this._cachedParentMeasure.height)},set:function(t){isNaN(t)||(this.top=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linkOffsetX",{get:function(){return this._linkOffsetX.toString(this._host)},set:function(t){this._linkOffsetX.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linkOffsetXInPixels",{get:function(){return this._linkOffsetX.getValueInPixel(this._host,this._cachedParentMeasure.width)},set:function(t){isNaN(t)||(this.linkOffsetX=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linkOffsetY",{get:function(){return this._linkOffsetY.toString(this._host)},set:function(t){this._linkOffsetY.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linkOffsetYInPixels",{get:function(){return this._linkOffsetY.getValueInPixel(this._host,this._cachedParentMeasure.height)},set:function(t){isNaN(t)||(this.linkOffsetY=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"centerX",{get:function(){return this._currentMeasure.left+this._currentMeasure.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"centerY",{get:function(){return this._currentMeasure.top+this._currentMeasure.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(t){var e=this;if(this._isEnabled!==t){this._isEnabled=t,this._markAsDirty();var i=function(t){if(t.host){for(var o in t.host._lastControlOver)t===e.host._lastControlOver[o]&&(t._onPointerOut(t,null,!0),delete t.host._lastControlOver[o]);void 0!==t.children&&t.children.forEach(i)}};i(this)}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"disabledColor",{get:function(){return this._disabledColor},set:function(t){this._disabledColor!==t&&(this._disabledColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"disabledColorItem",{get:function(){return this._disabledColorItem},set:function(t){this._disabledColorItem!==t&&(this._disabledColorItem=t,this._markAsDirty())},enumerable:!1,configurable:!0}),t.prototype._getTypeName=function(){return"Control"},t.prototype.getAscendantOfClass=function(t){return this.parent?this.parent.getClassName()===t?this.parent:this.parent.getAscendantOfClass(t):null},t.prototype.markAsDirty=function(t){void 0===t&&(t=!1),this._markAsDirty(t)},t.prototype.markAllAsDirty=function(){this._markAllAsDirty()},t.prototype._resetFontCache=function(){this._fontSet=!0,this._markAsDirty()},t.prototype.isAscendant=function(t){return!!this.parent&&(this.parent===t||this.parent.isAscendant(t))},t.prototype.getLocalCoordinates=function(t){var e=_.Vector2.Zero();return this.getLocalCoordinatesToRef(t,e),e},t.prototype.getLocalCoordinatesToRef=function(t,e){return e.x=t.x-this._currentMeasure.left,e.y=t.y-this._currentMeasure.top,this},t.prototype.getParentLocalCoordinates=function(t){var e=_.Vector2.Zero();return e.x=t.x-this._cachedParentMeasure.left,e.y=t.y-this._cachedParentMeasure.top,e},t.prototype.moveToVector3=function(e,i){if(this._host&&this.parent===this._host._rootContainer){this.horizontalAlignment=t.HORIZONTAL_ALIGNMENT_LEFT,this.verticalAlignment=t.VERTICAL_ALIGNMENT_TOP;var o=this._host._getGlobalViewport(),n=_.Vector3.Project(e,_.Matrix.Identity(),i.getTransformMatrix(),o);this._moveToProjectedPosition(n),n.z<0||n.z>1?this.notRenderable=!0:this.notRenderable=!1}else _.Tools.Error("Cannot move a control to a vector3 if the control is not at root level")},t.prototype.getDescendantsToRef=function(t,e,i){void 0===e&&(e=!1)},t.prototype.getDescendants=function(t,e){var i=new Array;return this.getDescendantsToRef(i,t,e),i},t.prototype.linkWithMesh=function(e){if(!this._host||this.parent&&this.parent!==this._host._rootContainer)e&&_.Tools.Error("Cannot link a control to a mesh if the control is not at root level");else{var i=this._host._linkedControls.indexOf(this);if(-1!==i)return this._linkedMesh=e,void(e||this._host._linkedControls.splice(i,1));e&&(this.horizontalAlignment=t.HORIZONTAL_ALIGNMENT_LEFT,this.verticalAlignment=t.VERTICAL_ALIGNMENT_TOP,this._linkedMesh=e,this._host._linkedControls.push(this))}},t.prototype.setPadding=function(t,e,i,o){var n=t,r=null!=e?e:n,a=null!=i?i:n,s=null!=o?o:r;this.paddingTop=n,this.paddingRight=r,this.paddingBottom=a,this.paddingLeft=s},t.prototype.setPaddingInPixels=function(t,e,i,o){var n=t,r=null!=e?e:n,a=null!=i?i:n,s=null!=o?o:r;this.paddingTopInPixels=n,this.paddingRightInPixels=r,this.paddingBottomInPixels=a,this.paddingLeftInPixels=s},t.prototype._moveToProjectedPosition=function(t){var e,i=this._left.getValue(this._host),o=this._top.getValue(this._host),n=null===(e=this.parent)||void 0===e?void 0:e._currentMeasure;n&&this._processMeasures(n,this._host.getContext());var r=t.x+this._linkOffsetX.getValue(this._host)-this._currentMeasure.width/2,a=t.y+this._linkOffsetY.getValue(this._host)-this._currentMeasure.height/2;this._left.ignoreAdaptiveScaling&&this._top.ignoreAdaptiveScaling&&(Math.abs(r-i)<.5&&(r=i),Math.abs(a-o)<.5&&(a=o)),i===r&&o===a||(this.left=r+"px",this.top=a+"px",this._left.ignoreAdaptiveScaling=!0,this._top.ignoreAdaptiveScaling=!0,this._markAsDirty())},t.prototype._offsetLeft=function(t){this._isDirty=!0,this._currentMeasure.left+=t},t.prototype._offsetTop=function(t){this._isDirty=!0,this._currentMeasure.top+=t},t.prototype._markMatrixAsDirty=function(){this._isMatrixDirty=!0,this._flagDescendantsAsMatrixDirty()},t.prototype._flagDescendantsAsMatrixDirty=function(){},t.prototype._intersectsRect=function(t,e){return this._transform(e),!(this._evaluatedMeasure.left>=t.left+t.width||this._evaluatedMeasure.top>=t.top+t.height||this._evaluatedMeasure.left+this._evaluatedMeasure.width<=t.left||this._evaluatedMeasure.top+this._evaluatedMeasure.height<=t.top)},t.prototype._computeAdditionnalOffsetX=function(){return 0},t.prototype._computeAdditionnalOffsetY=function(){return 0},t.prototype.invalidateRect=function(){if(this._transform(),this.host&&this.host.useInvalidateRectOptimization){this._currentMeasure.transformToRef(this._transformMatrix,this._tmpMeasureA),p.CombineToRef(this._tmpMeasureA,this._prevCurrentMeasureTransformedIntoGlobalSpace,this._tmpMeasureA);var t=this.shadowOffsetX,e=this.shadowOffsetY,i=Math.max(this._previousShadowBlur,this.shadowBlur),o=Math.min(Math.min(t,0)-2*i,0),n=Math.max(Math.max(t,0)+2*i,0),r=Math.min(Math.min(e,0)-2*i,0),a=Math.max(Math.max(e,0)+2*i,0),s=this._computeAdditionnalOffsetX(),l=this._computeAdditionnalOffsetY();this.host.invalidateRect(Math.floor(this._tmpMeasureA.left+o-s),Math.floor(this._tmpMeasureA.top+r-l),Math.ceil(this._tmpMeasureA.left+this._tmpMeasureA.width+n+s),Math.ceil(this._tmpMeasureA.top+this._tmpMeasureA.height+a+l))}},t.prototype._markAsDirty=function(t){void 0===t&&(t=!1),(this._isVisible||t)&&(this._isDirty=!0,this._markMatrixAsDirty(),this._host&&this._host.markAsDirty())},t.prototype._markAllAsDirty=function(){this._markAsDirty(),this._font&&this._prepareFont()},t.prototype._link=function(t){this._host=t,this._host&&(this.uniqueId=this._host.getScene().getUniqueId())},t.prototype._transform=function(t){if(this._isMatrixDirty||1!==this._scaleX||1!==this._scaleY||0!==this._rotation){var e=this._currentMeasure.width*this._transformCenterX+this._currentMeasure.left,i=this._currentMeasure.height*this._transformCenterY+this._currentMeasure.top;t&&(t.translate(e,i),t.rotate(this._rotation),t.scale(this._scaleX,this._scaleY),t.translate(-e,-i)),(this._isMatrixDirty||this._cachedOffsetX!==e||this._cachedOffsetY!==i)&&(this._cachedOffsetX=e,this._cachedOffsetY=i,this._isMatrixDirty=!1,this._flagDescendantsAsMatrixDirty(),b.ComposeToRef(-e,-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))}},t.prototype._renderHighlight=function(t){this.isHighlighted&&(t.save(),t.strokeStyle=this._highlightColor,t.lineWidth=this._highlightLineWidth,this._renderHighlightSpecific(t),t.restore())},t.prototype._renderHighlightSpecific=function(t){t.strokeRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)},t.prototype._getColor=function(t){return this.gradient?this.gradient.getCanvasGradient(t):this.color},t.prototype._applyStates=function(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||this.gradient)&&(e.fillStyle=this._getColor(e)),t.AllowAlphaInheritance?e.globalAlpha*=this._alpha:this._alphaSet&&(e.globalAlpha=this.parent&&!this.parent.renderToIntermediateTexture?this.parent.alpha*this._alpha:this._alpha)},t.prototype._layout=function(t,e){if(!this.isDirty&&(!this.isVisible||this.notRenderable))return!1;if(this._isDirty||!this._cachedParentMeasure.isEqualsTo(t)){this.host._numLayoutCalls++,this._currentMeasure.addAndTransformToRef(this._transformMatrix,0|-this._paddingLeftInPixels,0|-this._paddingTopInPixels,0|this._paddingRightInPixels,0|this._paddingBottomInPixels,this._prevCurrentMeasureTransformedIntoGlobalSpace),e.save(),this._applyStates(e);var i=0;do{this._rebuildLayout=!1,this._processMeasures(t,e),i++}while(this._rebuildLayout&&i<3);i>=3&&_.Logger.Error("Layout cycle detected in GUI (Control name=".concat(this.name,", uniqueId=").concat(this.uniqueId,")")),e.restore(),this.invalidateRect(),this._evaluateClippingState(t)}return this._wasDirty=this._isDirty,this._isDirty=!1,!0},t.prototype._processMeasures=function(t,e){this._tempPaddingMeasure.copyFrom(t),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,e),this._measure(),this._computeAlignment(this._tempPaddingMeasure,e),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,e),this._cachedParentMeasure.copyFrom(this._tempPaddingMeasure),this._currentMeasure.transformToRef(this._transformMatrix,this._evaluatedMeasure),this.onDirtyObservable.hasObservers()&&this.onDirtyObservable.notifyObservers(this)},t.prototype._evaluateClippingState=function(t){if(this._currentMeasure.transformToRef(this._transformMatrix,this._evaluatedMeasure),this.parent&&this.parent.clipChildren){if(t.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.width<this._evaluatedParentMeasure.left)return void(this._isClipped=!0);if(this._evaluatedMeasure.top>this._evaluatedParentMeasure.top+this._evaluatedParentMeasure.height)return void(this._isClipped=!0);if(this._evaluatedMeasure.top+this._evaluatedMeasure.height<this._evaluatedParentMeasure.top)return void(this._isClipped=!0)}this._isClipped=!1},t.prototype._measure=function(){this._width.isPixel?this._currentMeasure.width=this._width.getValue(this._host):this._currentMeasure.width*=this._width.getValue(this._host),this._height.isPixel?this._currentMeasure.height=this._height.getValue(this._host):this._currentMeasure.height*=this._height.getValue(this._host),0!==this.fixedRatio&&(this._fixedRatioMasterIsWidth?this._currentMeasure.height=this._currentMeasure.width*this.fixedRatio:this._currentMeasure.width=this._currentMeasure.height*this.fixedRatio)},t.prototype._computeAlignment=function(e,i){var o=this._currentMeasure.width,n=this._currentMeasure.height,r=e.width,a=e.height,s=0,l=0;switch(this.horizontalAlignment){case t.HORIZONTAL_ALIGNMENT_LEFT:s=0;break;case t.HORIZONTAL_ALIGNMENT_RIGHT:s=r-o;break;case t.HORIZONTAL_ALIGNMENT_CENTER:s=(r-o)/2}switch(this.verticalAlignment){case t.VERTICAL_ALIGNMENT_TOP:l=0;break;case t.VERTICAL_ALIGNMENT_BOTTOM:l=a-n;break;case t.VERTICAL_ALIGNMENT_CENTER:l=(a-n)/2}this.descendantsOnlyPadding||(this._paddingLeft.isPixel?(this._currentMeasure.left+=this._paddingLeft.getValue(this._host),this._currentMeasure.width-=this._paddingLeft.getValue(this._host)):(this._currentMeasure.left+=r*this._paddingLeft.getValue(this._host),this._currentMeasure.width-=r*this._paddingLeft.getValue(this._host)),this._paddingRight.isPixel?this._currentMeasure.width-=this._paddingRight.getValue(this._host):this._currentMeasure.width-=r*this._paddingRight.getValue(this._host),this._paddingTop.isPixel?(this._currentMeasure.top+=this._paddingTop.getValue(this._host),this._currentMeasure.height-=this._paddingTop.getValue(this._host)):(this._currentMeasure.top+=a*this._paddingTop.getValue(this._host),this._currentMeasure.height-=a*this._paddingTop.getValue(this._host)),this._paddingBottom.isPixel?this._currentMeasure.height-=this._paddingBottom.getValue(this._host):this._currentMeasure.height-=a*this._paddingBottom.getValue(this._host)),this._left.isPixel?this._currentMeasure.left+=this._left.getValue(this._host):this._currentMeasure.left+=r*this._left.getValue(this._host),this._top.isPixel?this._currentMeasure.top+=this._top.getValue(this._host):this._currentMeasure.top+=a*this._top.getValue(this._host),this._currentMeasure.left+=s,this._currentMeasure.top+=l},t.prototype._preMeasure=function(t,e){},t.prototype._additionalProcessing=function(t,e){},t.prototype._clipForChildren=function(t){},t.prototype._clip=function(e,i){if(e.beginPath(),t._ClipMeasure.copyFrom(this._currentMeasure),i){i.transformToRef(this._invertTransformMatrix,this._tmpMeasureA);var o=new p(0,0,0,0);o.left=Math.max(this._tmpMeasureA.left,this._currentMeasure.left),o.top=Math.max(this._tmpMeasureA.top,this._currentMeasure.top),o.width=Math.min(this._tmpMeasureA.left+this._tmpMeasureA.width,this._currentMeasure.left+this._currentMeasure.width)-o.left,o.height=Math.min(this._tmpMeasureA.top+this._tmpMeasureA.height,this._currentMeasure.top+this._currentMeasure.height)-o.top,t._ClipMeasure.copyFrom(o)}if(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY){var n=this.shadowOffsetX,r=this.shadowOffsetY,a=this.shadowBlur,s=Math.min(Math.min(n,0)-2*a,0),l=Math.max(Math.max(n,0)+2*a,0),_=Math.min(Math.min(r,0)-2*a,0),h=Math.max(Math.max(r,0)+2*a,0);e.rect(t._ClipMeasure.left+s,t._ClipMeasure.top+_,t._ClipMeasure.width+l-s,t._ClipMeasure.height+h-_)}else e.rect(t._ClipMeasure.left,t._ClipMeasure.top,t._ClipMeasure.width,t._ClipMeasure.height);e.clip()},t.prototype._render=function(t,e){return!this.isVisible||this.notRenderable||this._isClipped?(this._isDirty=!1,!1):(this.host._numRenderCalls++,t.save(),this._applyStates(t),this._transform(t),this.clipContent&&this._clip(t,e),this.onBeforeDrawObservable.hasObservers()&&this.onBeforeDrawObservable.notifyObservers(this),this.useBitmapCache&&!this._wasDirty&&this._cacheData?t.putImageData(this._cacheData,this._currentMeasure.left,this._currentMeasure.top):this._draw(t,e),this.useBitmapCache&&this._wasDirty&&(this._cacheData=t.getImageData(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),this._renderHighlight(t),this.onAfterDrawObservable.hasObservers()&&this.onAfterDrawObservable.notifyObservers(this),t.restore(),!0)},t.prototype._draw=function(t,e){},t.prototype.contains=function(t,e){return this._invertTransformMatrix.transformCoordinates(t,e,this._transformedPosition),t=this._transformedPosition.x,e=this._transformedPosition.y,!(t<this._currentMeasure.left||t>this._currentMeasure.left+this._currentMeasure.width||e<this._currentMeasure.top||e>this._currentMeasure.top+this._currentMeasure.height||(this.isPointerBlocker&&(this._host._shouldBlockPointer=!0),0))},t.prototype._processPicking=function(t,e,i,o,n,r,a,s){return!(!this._isEnabled||!this.isHitTestVisible||!this.isVisible||this._doNotRender||!this.contains(t,e)||(this._processObservables(o,t,e,i,n,r,a,s),0))},t.prototype._onPointerMove=function(t,e,i,o){this.onPointerMoveObservable.notifyObservers(e,-1,t,this,o)&&null!=this.parent&&!this.isPointerBlocker&&this.parent._onPointerMove(t,e,i,o)},t.prototype._onPointerEnter=function(t,e){return!(!this._isEnabled||this._enterCount>0||(-1===this._enterCount&&(this._enterCount=0),this._enterCount++,this.onPointerEnterObservable.notifyObservers(this,-1,t,this,e)&&null!=this.parent&&!this.isPointerBlocker&&this.parent._onPointerEnter(t,e),0))},t.prototype._onPointerOut=function(t,e,i){if(void 0===i&&(i=!1),i||this._isEnabled&&t!==this){this._enterCount=0;var o=!0;t.isAscendant(this)||(o=this.onPointerOutObservable.notifyObservers(this,-1,t,this,e)),o&&null!=this.parent&&!this.isPointerBlocker&&this.parent._onPointerOut(t,e,i)}},t.prototype._onPointerDown=function(t,e,i,o,n){return this._onPointerEnter(this,n),0===this._downCount&&(this._downCount++,this._downPointerIds[i]=!0,this.onPointerDownObservable.notifyObservers(new g(e,o),-1,t,this,n)&&null!=this.parent&&!this.isPointerBlocker&&this.parent._onPointerDown(t,e,i,o,n),n&&this.uniqueId!==this._host.rootContainer.uniqueId&&this._host._capturedPointerIds.add(n.event.pointerId),!0)},t.prototype._onPointerUp=function(t,e,i,o,n,r){if(this._isEnabled){this._downCount=0,delete this._downPointerIds[i];var a=n;n&&(this._enterCount>0||-1===this._enterCount)&&(a=this.onPointerClickObservable.notifyObservers(new g(e,o),-1,t,this,r)),this.onPointerUpObservable.notifyObservers(new g(e,o),-1,t,this,r)&&null!=this.parent&&!this.isPointerBlocker&&this.parent._onPointerUp(t,e,i,o,a,r),r&&this.uniqueId!==this._host.rootContainer.uniqueId&&this._host._capturedPointerIds.delete(r.event.pointerId)}},t.prototype._forcePointerUp=function(t){if(void 0===t&&(t=null),null!==t)this._onPointerUp(this,_.Vector2.Zero(),t,0,!0);else for(var e in this._downPointerIds)this._onPointerUp(this,_.Vector2.Zero(),+e,0,!0)},t.prototype._onWheelScroll=function(t,e){this._isEnabled&&this.onWheelObservable.notifyObservers(new _.Vector2(t,e))&&null!=this.parent&&this.parent._onWheelScroll(t,e)},t.prototype._onCanvasBlur=function(){},t.prototype._processObservables=function(t,e,i,o,n,r,a,s){if(!this._isEnabled)return!1;if(this._dummyVector2.copyFromFloats(e,i),t===_.PointerEventTypes.POINTERMOVE){this._onPointerMove(this,this._dummyVector2,n,o);var l=this._host._lastControlOver[n];return l&&l!==this&&l._onPointerOut(this,o),l!==this&&this._onPointerEnter(this,o),this._host._lastControlOver[n]=this,!0}return t===_.PointerEventTypes.POINTERDOWN?(this._onPointerDown(this,this._dummyVector2,n,r,o),this._host._registerLastControlDown(this,n),this._host._lastPickedControl=this,!0):t===_.PointerEventTypes.POINTERUP?(this._host._lastControlDown[n]&&this._host._lastControlDown[n]._onPointerUp(this,this._dummyVector2,n,r,!0,o),delete this._host._lastControlDown[n],!0):!(t!==_.PointerEventTypes.POINTERWHEEL||!this._host._lastControlOver[n]||(this._host._lastControlOver[n]._onWheelScroll(a,s),0))},t.prototype._prepareFont=function(){(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=t._GetFontOffset(this._font),this.getDescendants().forEach((function(t){return t._markAllAsDirty()})))},t.prototype.clone=function(t){var e={};this.serialize(e);var i=new(_.Tools.Instantiate("BABYLON.GUI."+e.className));return i.parse(e,t),i},t.prototype.parse=function(t,e){var i=this;return _.SerializationHelper.Parse((function(){return i}),t,null),this.name=t.name,this._parseFromContent(t,null!=e?e:this._host),this},t.prototype.serialize=function(t){_.SerializationHelper.Serialize(this,t),t.name=this.name,t.className=this.getClassName(),this._font&&(t.fontFamily=this._fontFamily,t.fontSize=this.fontSize,t.fontWeight=this.fontWeight,t.fontStyle=this.fontStyle),this._gradient&&(t.gradient={},this._gradient.serialize(t.gradient)),_.SerializationHelper.AppendSerializedAnimations(this,t)},t.prototype._parseFromContent=function(t,e){var i;if(t.fontFamily&&(this.fontFamily=t.fontFamily),t.fontSize&&(this.fontSize=t.fontSize),t.fontWeight&&(this.fontWeight=t.fontWeight),t.fontStyle&&(this.fontStyle=t.fontStyle),t.gradient){var o=_.Tools.Instantiate("BABYLON.GUI."+t.gradient.className);this._gradient=new o,null===(i=this._gradient)||void 0===i||i.parse(t.gradient)}if(t.animations){this.animations=[];for(var n=0;n<t.animations.length;n++){var r=t.animations[n],a=(0,_.GetClass)("BABYLON.Animation");a&&this.animations.push(a.Parse(r))}t.autoAnimate&&this._host&&this._host.getScene()&&this._host.getScene().beginAnimation(this,t.autoAnimateFrom,t.autoAnimateTo,t.autoAnimateLoop,t.autoAnimateSpeed||1)}},t.prototype.dispose=function(){this.onDirtyObservable.clear(),this.onBeforeDrawObservable.clear(),this.onAfterDrawObservable.clear(),this.onPointerDownObservable.clear(),this.onPointerEnterObservable.clear(),this.onPointerMoveObservable.clear(),this.onPointerOutObservable.clear(),this.onPointerUpObservable.clear(),this.onPointerClickObservable.clear(),this.onWheelObservable.clear(),this._styleObserver&&this._style&&(this._style.onChangedObservable.remove(this._styleObserver),this._styleObserver=null),this.parent&&(this.parent.removeControl(this),this.parent=null),this._host&&this._host._linkedControls.indexOf(this)>-1&&this.linkWithMesh(null),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear()},Object.defineProperty(t,"HORIZONTAL_ALIGNMENT_LEFT",{get:function(){return t._HORIZONTAL_ALIGNMENT_LEFT},enumerable:!1,configurable:!0}),Object.defineProperty(t,"HORIZONTAL_ALIGNMENT_RIGHT",{get:function(){return t._HORIZONTAL_ALIGNMENT_RIGHT},enumerable:!1,configurable:!0}),Object.defineProperty(t,"HORIZONTAL_ALIGNMENT_CENTER",{get:function(){return t._HORIZONTAL_ALIGNMENT_CENTER},enumerable:!1,configurable:!0}),Object.defineProperty(t,"VERTICAL_ALIGNMENT_TOP",{get:function(){return t._VERTICAL_ALIGNMENT_TOP},enumerable:!1,configurable:!0}),Object.defineProperty(t,"VERTICAL_ALIGNMENT_BOTTOM",{get:function(){return t._VERTICAL_ALIGNMENT_BOTTOM},enumerable:!1,configurable:!0}),Object.defineProperty(t,"VERTICAL_ALIGNMENT_CENTER",{get:function(){return t._VERTICAL_ALIGNMENT_CENTER},enumerable:!1,configurable:!0}),t._GetFontOffset=function(e){if(t._FontHeightSizes[e])return t._FontHeightSizes[e];var i=_.EngineStore.LastCreatedEngine;if(!i)throw new Error("Invalid engine. Unable to create a canvas.");var o=i.getFontOffset(e);return t._FontHeightSizes[e]=o,o},t.Parse=function(t,e){var i=_.Tools.Instantiate("BABYLON.GUI."+t.className),o=_.SerializationHelper.Parse((function(){return new i}),t,null);return o.name=t.name,o._parseFromContent(t,e),o},t.drawEllipse=function(t,e,i,o,n){n.translate(t,e),n.scale(i,o),n.beginPath(),n.arc(0,0,1,0,2*Math.PI),n.closePath(),n.scale(1/i,1/o),n.translate(-t,-e)},t.prototype.isReady=function(){return!0},t.AllowAlphaInheritance=!1,t._ClipMeasure=new p(0,0,0,0),t._HORIZONTAL_ALIGNMENT_LEFT=0,t._HORIZONTAL_ALIGNMENT_RIGHT=1,t._HORIZONTAL_ALIGNMENT_CENTER=2,t._VERTICAL_ALIGNMENT_TOP=0,t._VERTICAL_ALIGNMENT_BOTTOM=1,t._VERTICAL_ALIGNMENT_CENTER=2,t._FontHeightSizes={},t.AddHeader=function(){},a([(0,_.serialize)()],t.prototype,"metadata",void 0),a([(0,_.serialize)()],t.prototype,"isHitTestVisible",void 0),a([(0,_.serialize)()],t.prototype,"isPointerBlocker",void 0),a([(0,_.serialize)()],t.prototype,"isFocusInvisible",void 0),a([(0,_.serialize)()],t.prototype,"clipChildren",void 0),a([(0,_.serialize)()],t.prototype,"clipContent",void 0),a([(0,_.serialize)()],t.prototype,"useBitmapCache",void 0),a([(0,_.serialize)()],t.prototype,"shadowOffsetX",null),a([(0,_.serialize)()],t.prototype,"shadowOffsetY",null),a([(0,_.serialize)()],t.prototype,"shadowBlur",null),a([(0,_.serialize)()],t.prototype,"shadowColor",null),a([(0,_.serialize)()],t.prototype,"hoverCursor",void 0),a([(0,_.serialize)()],t.prototype,"fontOffset",null),a([(0,_.serialize)()],t.prototype,"alpha",null),a([(0,_.serialize)()],t.prototype,"scaleX",null),a([(0,_.serialize)()],t.prototype,"scaleY",null),a([(0,_.serialize)()],t.prototype,"rotation",null),a([(0,_.serialize)()],t.prototype,"transformCenterY",null),a([(0,_.serialize)()],t.prototype,"transformCenterX",null),a([(0,_.serialize)()],t.prototype,"horizontalAlignment",null),a([(0,_.serialize)()],t.prototype,"verticalAlignment",null),a([(0,_.serialize)()],t.prototype,"fixedRatio",void 0),a([(0,_.serialize)()],t.prototype,"width",null),a([(0,_.serialize)()],t.prototype,"height",null),a([(0,_.serialize)()],t.prototype,"style",null),a([(0,_.serialize)()],t.prototype,"color",null),a([(0,_.serialize)()],t.prototype,"gradient",null),a([(0,_.serialize)()],t.prototype,"zIndex",null),a([(0,_.serialize)()],t.prototype,"notRenderable",null),a([(0,_.serialize)()],t.prototype,"isVisible",null),a([(0,_.serialize)()],t.prototype,"descendantsOnlyPadding",null),a([(0,_.serialize)()],t.prototype,"paddingLeft",null),a([(0,_.serialize)()],t.prototype,"paddingRight",null),a([(0,_.serialize)()],t.prototype,"paddingTop",null),a([(0,_.serialize)()],t.prototype,"paddingBottom",null),a([(0,_.serialize)()],t.prototype,"left",null),a([(0,_.serialize)()],t.prototype,"top",null),a([(0,_.serialize)()],t.prototype,"linkOffsetX",null),a([(0,_.serialize)()],t.prototype,"linkOffsetY",null),a([(0,_.serialize)()],t.prototype,"isEnabled",null),a([(0,_.serialize)()],t.prototype,"disabledColor",null),a([(0,_.serialize)()],t.prototype,"disabledColorItem",null),a([(0,_.serialize)()],t.prototype,"overlapGroup",void 0),a([(0,_.serialize)()],t.prototype,"overlapDeltaMultiplier",void 0),t}();(0,_.RegisterClass)("BABYLON.GUI.Control",v);var y=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._children=new Array,i._measureForChildren=p.Empty(),i._background="",i._backgroundGradient=null,i._adaptWidthToChildren=!1,i._adaptHeightToChildren=!1,i._renderToIntermediateTexture=!1,i._intermediateTexture=null,i.logLayoutCycleErrors=!1,i.maxLayoutCycle=3,i.onControlAddedObservable=new _.Observable,i.onControlRemovedObservable=new _.Observable,i._inverseTransformMatrix=b.Identity(),i._inverseMeasure=new p(0,0,0,0),i}return r(e,t),Object.defineProperty(e.prototype,"renderToIntermediateTexture",{get:function(){return this._renderToIntermediateTexture},set:function(t){this._renderToIntermediateTexture!==t&&(this._renderToIntermediateTexture=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"adaptHeightToChildren",{get:function(){return this._adaptHeightToChildren},set:function(t){this._adaptHeightToChildren!==t&&(this._adaptHeightToChildren=t,t&&(this.height="100%"),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"adaptWidthToChildren",{get:function(){return this._adaptWidthToChildren},set:function(t){this._adaptWidthToChildren!==t&&(this._adaptWidthToChildren=t,t&&(this.width="100%"),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backgroundGradient",{get:function(){return this._backgroundGradient},set:function(t){this._backgroundGradient!==t&&(this._backgroundGradient=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"children",{get:function(){return this._children},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isReadOnly",{get:function(){return this._isReadOnly},set:function(t){this._isReadOnly=t;for(var e=0,i=this._children;e<i.length;e++)i[e].isReadOnly=t},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"Container"},e.prototype._flagDescendantsAsMatrixDirty=function(){for(var t=0,e=this.children;t<e.length;t++){var i=e[t];i._isClipped=!1,i._markMatrixAsDirty()}},e.prototype.getChildByName=function(t){for(var e=0,i=this.children;e<i.length;e++){var o=i[e];if(o.name===t)return o}return null},e.prototype.getChildByType=function(t,e){for(var i=0,o=this.children;i<o.length;i++){var n=o[i];if(n.typeName===e)return n}return null},e.prototype.containsControl=function(t){return-1!==this.children.indexOf(t)},e.prototype.addControl=function(t){return t?(-1!==this._children.indexOf(t)||(t._link(this._host),t._markAllAsDirty(),this._reOrderControl(t),this._markAsDirty(),this.onControlAddedObservable.notifyObservers(t)),this):this},e.prototype.clearControls=function(){for(var t=0,e=this.children.slice();t<e.length;t++){var i=e[t];this.removeControl(i)}return this},e.prototype.removeControl=function(t){var e=this._children.indexOf(t);return-1!==e&&(this._children.splice(e,1),t.parent=null),t.linkWithMesh(null),this._host&&this._host._cleanControlAfterRemoval(t),this._markAsDirty(),this.onControlRemovedObservable.notifyObservers(t),this},e.prototype._reOrderControl=function(t){var e=t.linkedMesh;this.removeControl(t);for(var i=!1,o=0;o<this._children.length;o++)if(this._children[o].zIndex>t.zIndex){this._children.splice(o,0,t),i=!0;break}i||this._children.push(t),t.parent=this,e&&t.linkWithMesh(e),this._markAsDirty()},e.prototype._offsetLeft=function(e){t.prototype._offsetLeft.call(this,e);for(var i=0,o=this._children;i<o.length;i++)o[i]._offsetLeft(e)},e.prototype._offsetTop=function(e){t.prototype._offsetTop.call(this,e);for(var i=0,o=this._children;i<o.length;i++)o[i]._offsetTop(e)},e.prototype._markAllAsDirty=function(){t.prototype._markAllAsDirty.call(this);for(var e=0;e<this._children.length;e++)this._children[e]._markAllAsDirty()},e.prototype._getBackgroundColor=function(t){return this._backgroundGradient?this._backgroundGradient.getCanvasGradient(t):this._background},e.prototype._localDraw=function(t){(this._background||this._backgroundGradient)&&(t.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),t.fillStyle=this._getBackgroundColor(t),t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height),t.restore())},e.prototype._link=function(e){t.prototype._link.call(this,e);for(var i=0,o=this._children;i<o.length;i++)o[i]._link(e)},e.prototype._beforeLayout=function(){},e.prototype._processMeasures=function(e,i){!this._isDirty&&this._cachedParentMeasure.isEqualsTo(e)||(t.prototype._processMeasures.call(this,e,i),this._evaluateClippingState(e),this._renderToIntermediateTexture&&(this._intermediateTexture&&this._host.getScene()!=this._intermediateTexture.getScene()&&(this._intermediateTexture.dispose(),this._intermediateTexture=null),this._intermediateTexture?this._intermediateTexture.scaleTo(this._currentMeasure.width,this._currentMeasure.height):(this._intermediateTexture=new _.DynamicTexture("",{width:this._currentMeasure.width,height:this._currentMeasure.height},this._host.getScene(),!1,_.Texture.NEAREST_SAMPLINGMODE,_.Constants.TEXTUREFORMAT_RGBA,!1),this._intermediateTexture.hasAlpha=!0)))},e.prototype._layout=function(t,e){var i,o;if(!this.isDirty&&(!this.isVisible||this.notRenderable))return!1;this.host._numLayoutCalls++,this._isDirty&&this._currentMeasure.transformToRef(this._transformMatrix,this._prevCurrentMeasureTransformedIntoGlobalSpace);var n=0;e.save(),this._applyStates(e),this._beforeLayout();do{var r=-1,a=-1;if(this._rebuildLayout=!1,this._processMeasures(t,e),!this._isClipped){for(var s=0,l=this._children;s<l.length;s++){var h=l[s];h._tempParentMeasure.copyFrom(this._measureForChildren),h._layout(this._measureForChildren,e)&&h.isVisible&&!h.notRenderable&&(this.adaptWidthToChildren&&h._width.isPixel&&(r=Math.max(r,h._currentMeasure.width+h._paddingLeftInPixels+h._paddingRightInPixels)),this.adaptHeightToChildren&&h._height.isPixel&&(a=Math.max(a,h._currentMeasure.height+h._paddingTopInPixels+h._paddingBottomInPixels)))}this.adaptWidthToChildren&&r>=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&&a>=0&&(a+=this.paddingTopInPixels+this.paddingBottomInPixels,this.height!==a+"px"&&(null===(o=this.parent)||void 0===o||o._markAsDirty(),this.height=a+"px",this._height.ignoreAdaptiveScaling=!0,this._rebuildLayout=!0)),this._postMeasure()}n++}while(this._rebuildLayout&&n<this.maxLayoutCycle);return n>=3&&this.logLayoutCycleErrors&&_.Logger.Error("Layout cycle detected in GUI (Container name=".concat(this.name,", uniqueId=").concat(this.uniqueId,")")),e.restore(),this._isDirty&&(this.invalidateRect(),this._isDirty=!1),!0},e.prototype._postMeasure=function(){},e.prototype._draw=function(t,e){var i=this._renderToIntermediateTexture&&this._intermediateTexture,o=i?this._intermediateTexture.getContext():t;i&&(o.save(),o.translate(-this._currentMeasure.left,-this._currentMeasure.top),e?(this._transformMatrix.invertToRef(this._inverseTransformMatrix),e.transformToRef(this._inverseTransformMatrix,this._inverseMeasure),o.clearRect(this._inverseMeasure.left,this._inverseMeasure.top,this._inverseMeasure.width,this._inverseMeasure.height)):o.clearRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),this._localDraw(o),t.save(),this.clipChildren&&this._clipForChildren(o);for(var n=0,r=this._children;n<r.length;n++){var a=r[n];e&&!a._intersectsRect(e)||a._render(o,e)}i&&(o.restore(),t.save(),t.globalAlpha=this.alpha,t.drawImage(o.canvas,this._currentMeasure.left,this._currentMeasure.top),t.restore()),t.restore()},e.prototype.getDescendantsToRef=function(t,e,i){if(void 0===e&&(e=!1),this.children)for(var o=0;o<this.children.length;o++){var n=this.children[o];i&&!i(n)||t.push(n),e||n.getDescendantsToRef(t,!1,i)}},e.prototype._processPicking=function(e,i,o,n,r,a,s,l){if(!this._isEnabled||!this.isVisible||this.notRenderable)return!1;var _=t.prototype.contains.call(this,e,i);if(!_&&this.clipChildren)return!1;for(var h=this._children.length-1;h>=0;h--){var c=this._children[h];if(c._processPicking(e,i,o,n,r,a,s,l))return c.hoverCursor&&this._host._changeCursor(c.hoverCursor),!0}return!!_&&!!this.isHitTestVisible&&this._processObservables(n,e,i,o,r,a,s,l)},e.prototype._additionalProcessing=function(e,i){t.prototype._additionalProcessing.call(this,e,i),this._measureForChildren.copyFrom(this._currentMeasure)},e.prototype.serialize=function(e){if(t.prototype.serialize.call(this,e),this.backgroundGradient&&(e.backgroundGradient={},this.backgroundGradient.serialize(e.backgroundGradient)),this.children.length){e.children=[];for(var i=0,o=this.children;i<o.length;i++){var n={};o[i].serialize(n),e.children.push(n)}}},e.prototype.dispose=function(){var e;t.prototype.dispose.call(this);for(var i=this.children.length-1;i>=0;i--)this.children[i].dispose();null===(e=this._intermediateTexture)||void 0===e||e.dispose()},e.prototype._parseFromContent=function(e,i){var o;if(t.prototype._parseFromContent.call(this,e,i),this._link(i),e.backgroundGradient){var n=_.Tools.Instantiate("BABYLON.GUI."+e.backgroundGradient.className);this._backgroundGradient=new n,null===(o=this._backgroundGradient)||void 0===o||o.parse(e.backgroundGradient)}if(e.children)for(var r=0,a=e.children;r<a.length;r++){var s=a[r];this.addControl(v.Parse(s,i))}},e.prototype.isReady=function(){for(var t=0,e=this.children;t<e.length;t++)if(!e[t].isReady())return!1;return!0},a([(0,_.serialize)()],e.prototype,"renderToIntermediateTexture",null),a([(0,_.serialize)()],e.prototype,"maxLayoutCycle",void 0),a([(0,_.serialize)()],e.prototype,"adaptHeightToChildren",null),a([(0,_.serialize)()],e.prototype,"adaptWidthToChildren",null),a([(0,_.serialize)()],e.prototype,"background",null),a([(0,_.serialize)()],e.prototype,"backgroundGradient",null),e}(v);(0,_.RegisterClass)("BABYLON.GUI.Container",y);var x,P=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._thickness=1,i._cornerRadius=0,i}return r(e,t),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness!==t&&(this._thickness=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cornerRadius",{get:function(){return this._cornerRadius},set:function(t){t<0&&(t=0),this._cornerRadius!==t&&(this._cornerRadius=t,this._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"Rectangle"},e.prototype._computeAdditionnalOffsetX=function(){return this._cornerRadius?1:0},e.prototype._computeAdditionnalOffsetY=function(){return this._cornerRadius?1:0},e.prototype._getRectangleFill=function(t){return this._getBackgroundColor(t)},e.prototype._localDraw=function(t){t.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),(this._background||this._backgroundGradient)&&(t.fillStyle=this._getRectangleFill(t),this._cornerRadius?(this._drawRoundedRect(t,this._thickness/2),t.fill()):t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),this._thickness&&((this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),(this.color||this.gradient)&&(t.strokeStyle=this.gradient?this.gradient.getCanvasGradient(t):this.color),t.lineWidth=this._thickness,this._cornerRadius?(this._drawRoundedRect(t,this._thickness/2),t.stroke()):t.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,this._currentMeasure.width-this._thickness,this._currentMeasure.height-this._thickness)),t.restore()},e.prototype._additionalProcessing=function(e,i){t.prototype._additionalProcessing.call(this,e,i),this._measureForChildren.width-=2*this._thickness,this._measureForChildren.height-=2*this._thickness,this._measureForChildren.left+=this._thickness,this._measureForChildren.top+=this._thickness},e.prototype._drawRoundedRect=function(t,e){void 0===e&&(e=0);var i=this._currentMeasure.left+e,o=this._currentMeasure.top+e,n=this._currentMeasure.width-2*e,r=this._currentMeasure.height-2*e,a=Math.min(r/2,Math.min(n/2,this._cornerRadius));a=Math.abs(a),t.beginPath(),t.moveTo(i+a,o),t.lineTo(i+n-a,o),t.arc(i+n-a,o+a,a,3*Math.PI/2,2*Math.PI),t.lineTo(i+n,o+r-a),t.arc(i+n-a,o+r-a,a,0,Math.PI/2),t.lineTo(i+a,o+r),t.arc(i+a,o+r-a,a,Math.PI/2,Math.PI),t.lineTo(i,o+a),t.arc(i+a,o+a,a,Math.PI,3*Math.PI/2),t.closePath()},e.prototype._clipForChildren=function(t){this._cornerRadius&&(this._drawRoundedRect(t,this._thickness),t.clip())},a([(0,_.serialize)()],e.prototype,"thickness",null),a([(0,_.serialize)()],e.prototype,"cornerRadius",null),e}(y);(0,_.RegisterClass)("BABYLON.GUI.Rectangle",P),function(t){t[t.Clip=0]="Clip",t[t.WordWrap=1]="WordWrap",t[t.Ellipsis=2]="Ellipsis",t[t.WordWrapEllipsis=3]="WordWrapEllipsis"}(x||(x={}));var I=function(t){function e(e,i){void 0===i&&(i="");var o=t.call(this,e)||this;return o.name=e,o._text="",o._textWrapping=x.Clip,o._textHorizontalAlignment=v.HORIZONTAL_ALIGNMENT_CENTER,o._textVerticalAlignment=v.VERTICAL_ALIGNMENT_CENTER,o._resizeToFit=!1,o._lineSpacing=new h(0),o._outlineWidth=0,o._outlineColor="white",o._underline=!1,o._lineThrough=!1,o._wordDivider=" ",o._forceResizeWidth=!1,o.onTextChangedObservable=new _.Observable,o.onLinesReadyObservable=new _.Observable,o._linesTemp=[],o.text=i,o}return r(e,t),Object.defineProperty(e.prototype,"lines",{get:function(){return this._lines},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resizeToFit",{get:function(){return this._resizeToFit},set:function(t){this._resizeToFit!==t&&(this._resizeToFit=t,this._resizeToFit&&(this._width.ignoreAdaptiveScaling=!0,this._height.ignoreAdaptiveScaling=!0),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textWrapping",{get:function(){return this._textWrapping},set:function(t){this._textWrapping!==t&&(this._textWrapping=+t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){this._text!==t&&(this._text=t+"",this._markAsDirty(),this.onTextChangedObservable.notifyObservers(this))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textHorizontalAlignment",{get:function(){return this._textHorizontalAlignment},set:function(t){this._textHorizontalAlignment!==t&&(this._textHorizontalAlignment=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textVerticalAlignment",{get:function(){return this._textVerticalAlignment},set:function(t){this._textVerticalAlignment!==t&&(this._textVerticalAlignment=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lineSpacing",{get:function(){return this._lineSpacing.toString(this._host)},set:function(t){this._lineSpacing.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"outlineWidth",{get:function(){return this._outlineWidth},set:function(t){this._outlineWidth!==t&&(this._outlineWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"underline",{get:function(){return this._underline},set:function(t){this._underline!==t&&(this._underline=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lineThrough",{get:function(){return this._lineThrough},set:function(t){this._lineThrough!==t&&(this._lineThrough=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"outlineColor",{get:function(){return this._outlineColor},set:function(t){this._outlineColor!==t&&(this._outlineColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wordDivider",{get:function(){return this._wordDivider},set:function(t){this._wordDivider!==t&&(this._wordDivider=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"forceResizeWidth",{get:function(){return this._forceResizeWidth},set:function(t){this._forceResizeWidth!==t&&(this._forceResizeWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"TextBlock"},e.prototype._processMeasures=function(e,i){this._fontOffset&&!this.isDirty||(this._fontOffset=v._GetFontOffset(i.font)),t.prototype._processMeasures.call(this,e,i),this._lines=this._breakLines(this._currentMeasure.width,this._currentMeasure.height,i),this.onLinesReadyObservable.notifyObservers(this);for(var o=0,n=0;n<this._lines.length;n++){var r=this._lines[n];r.width>o&&(o=r.width)}if(this._resizeToFit){if(this._textWrapping===x.Clip||this._forceResizeWidth){var a=Math.ceil(this._paddingLeftInPixels)+Math.ceil(this._paddingRightInPixels)+Math.ceil(o);a!==this._width.getValueInPixel(this._host,this._tempParentMeasure.width)&&(this._width.updateInPlace(a,h.UNITMODE_PIXEL),this._rebuildLayout=!0)}var s=this._paddingTopInPixels+this._paddingBottomInPixels+this._fontOffset.height*this._lines.length|0;if(this._lines.length>0&&0!==this._lineSpacing.internalValue){var l;l=this._lineSpacing.isPixel?this._lineSpacing.getValue(this._host):this._lineSpacing.getValue(this._host)*this._height.getValueInPixel(this._host,this._cachedParentMeasure.height),s+=(this._lines.length-1)*l}s!==this._height.internalValue&&(this._height.updateInPlace(s,h.UNITMODE_PIXEL),this._rebuildLayout=!0)}},e.prototype._drawText=function(t,e,i,o){var n=this._currentMeasure.width,r=0;switch(this._textHorizontalAlignment){case v.HORIZONTAL_ALIGNMENT_LEFT:r=0;break;case v.HORIZONTAL_ALIGNMENT_RIGHT:r=n-e;break;case v.HORIZONTAL_ALIGNMENT_CENTER:r=(n-e)/2}(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(o.shadowColor=this.shadowColor,o.shadowBlur=this.shadowBlur,o.shadowOffsetX=this.shadowOffsetX,o.shadowOffsetY=this.shadowOffsetY),this.outlineWidth&&o.strokeText(t,this._currentMeasure.left+r,i),o.fillText(t,this._currentMeasure.left+r,i),this._underline&&(o.beginPath(),o.lineWidth=Math.round(.05*this.fontSizeInPixels),o.moveTo(this._currentMeasure.left+r,i+3),o.lineTo(this._currentMeasure.left+r+e,i+3),o.stroke(),o.closePath()),this._lineThrough&&(o.beginPath(),o.lineWidth=Math.round(.05*this.fontSizeInPixels),o.moveTo(this._currentMeasure.left+r,i-this.fontSizeInPixels/3),o.lineTo(this._currentMeasure.left+r+e,i-this.fontSizeInPixels/3),o.stroke(),o.closePath())},e.prototype._draw=function(t){t.save(),this._applyStates(t),this._renderLines(t),t.restore()},e.prototype._applyStates=function(e){t.prototype._applyStates.call(this,e),this.outlineWidth&&(e.lineWidth=this.outlineWidth,e.strokeStyle=this.outlineColor,e.lineJoin="miter",e.miterLimit=2)},e.prototype._breakLines=function(t,e,i){var o,n;this._linesTemp.length=0;var r=this.text.split("\n");if(this._textWrapping===x.Ellipsis)for(var a=0,s=r;a<s.length;a++){var l=s[a];this._linesTemp.push(this._parseLineEllipsis(l,t,i))}else if(this._textWrapping===x.WordWrap)for(var _=0,h=r;_<h.length;_++)l=h[_],(o=this._linesTemp).push.apply(o,this._parseLineWordWrap(l,t,i));else if(this._textWrapping===x.WordWrapEllipsis)for(var c=0,u=r;c<u.length;c++)l=u[c],(n=this._linesTemp).push.apply(n,this._parseLineWordWrapEllipsis(l,t,e,i));else for(var d=0,f=r;d<f.length;d++)l=f[d],this._linesTemp.push(this._parseLine(l,i));return this._linesTemp},e.prototype._parseLine=function(t,e){return void 0===t&&(t=""),{text:t,width:this._getTextMetricsWidth(e.measureText(t))}},e.prototype._getCharsToRemove=function(t,e,i){var o=t>e?t-e:0,n=t/i;return Math.max(Math.floor(o/n),1)},e.prototype._parseLineEllipsis=function(t,e,i){void 0===t&&(t="");var o=this._getTextMetricsWidth(i.measureText(t)),n=this._getCharsToRemove(o,e,t.length),r=Array.from&&Array.from(t);if(r)for(;r.length&&o>e;)r.splice(r.length-n,n),t="".concat(r.join(""),"…"),o=this._getTextMetricsWidth(i.measureText(t)),n=this._getCharsToRemove(o,e,t.length);else{for(;t.length>2&&o>e;)t=t.slice(0,-n),o=this._getTextMetricsWidth(i.measureText(t+"…")),n=this._getCharsToRemove(o,e,t.length);t+="…"}return{text:t,width:o}},e.prototype._getTextMetricsWidth=function(t){return void 0!==t.actualBoundingBoxLeft?Math.abs(t.actualBoundingBoxLeft)+Math.abs(t.actualBoundingBoxRight):t.width},e.prototype._parseLineWordWrap=function(t,e,i){void 0===t&&(t="");for(var o=[],n=this.wordSplittingFunction?this.wordSplittingFunction(t):t.split(this._wordDivider),r=this._getTextMetricsWidth(i.measureText(t)),a=0;a<n.length;a++){var s=a>0?t+this._wordDivider+n[a]:n[0],l=this._getTextMetricsWidth(i.measureText(s));l>e&&a>0?(o.push({text:t,width:r}),t=n[a],r=this._getTextMetricsWidth(i.measureText(t))):(r=l,t=s)}return o.push({text:t,width:r}),o},e.prototype._parseLineWordWrapEllipsis=function(t,e,i,o){void 0===t&&(t="");for(var n=this._parseLineWordWrap(t,e,o),r=1;r<=n.length;r++)if(this._computeHeightForLinesOf(r)>i&&r>1){var a=n[r-2],s=n[r-1];n[r-2]=this._parseLineEllipsis("".concat(a.text+s.text),e,o);for(var l=n.length-r+1,_=0;_<l;_++)n.pop();return n}return n},e.prototype._renderLines=function(t){if(this._fontOffset&&this._lines){var e=this._currentMeasure.height,i=0;switch(this._textVerticalAlignment){case v.VERTICAL_ALIGNMENT_TOP:i=this._fontOffset.ascent;break;case v.VERTICAL_ALIGNMENT_BOTTOM:i=e-this._fontOffset.height*(this._lines.length-1)-this._fontOffset.descent;break;case v.VERTICAL_ALIGNMENT_CENTER:i=this._fontOffset.ascent+(e-this._fontOffset.height*this._lines.length)/2}i+=this._currentMeasure.top;for(var o=0;o<this._lines.length;o++){var n=this._lines[o];0!==o&&0!==this._lineSpacing.internalValue&&(this._lineSpacing.isPixel?i+=this._lineSpacing.getValue(this._host):i+=this._lineSpacing.getValue(this._host)*this._height.getValueInPixel(this._host,this._cachedParentMeasure.height)),this._drawText(n.text,n.width,i,t),i+=this._fontOffset.height}}},e.prototype._computeHeightForLinesOf=function(t){var e=this._paddingTopInPixels+this._paddingBottomInPixels+this._fontOffset.height*t;return t>0&&0!==this._lineSpacing.internalValue&&(e+=(t-1)*(this._lineSpacing.isPixel?this._lineSpacing.getValue(this._host):this._lineSpacing.getValue(this._host)*this._height.getValueInPixel(this._host,this._cachedParentMeasure.height))),e},e.prototype.computeExpectedHeight=function(){var t;if(this.text&&this.widthInPixels){var e=null===(t=_.EngineStore.LastCreatedEngine)||void 0===t?void 0:t.createCanvas(0,0).getContext("2d");if(e){this._applyStates(e),this._fontOffset||(this._fontOffset=v._GetFontOffset(e.font));var i=this._lines?this._lines:this._breakLines(this.widthInPixels-this._paddingLeftInPixels-this._paddingRightInPixels,this.heightInPixels-this._paddingTopInPixels-this._paddingBottomInPixels,e);return this._computeHeightForLinesOf(i.length)}}return 0},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.onTextChangedObservable.clear()},a([(0,_.serialize)()],e.prototype,"resizeToFit",null),a([(0,_.serialize)()],e.prototype,"textWrapping",null),a([(0,_.serialize)()],e.prototype,"text",null),a([(0,_.serialize)()],e.prototype,"textHorizontalAlignment",null),a([(0,_.serialize)()],e.prototype,"textVerticalAlignment",null),a([(0,_.serialize)()],e.prototype,"lineSpacing",null),a([(0,_.serialize)()],e.prototype,"outlineWidth",null),a([(0,_.serialize)()],e.prototype,"underline",null),a([(0,_.serialize)()],e.prototype,"lineThrough",null),a([(0,_.serialize)()],e.prototype,"outlineColor",null),a([(0,_.serialize)()],e.prototype,"wordDivider",null),a([(0,_.serialize)()],e.prototype,"forceResizeWidth",null),e}(v);(0,_.RegisterClass)("BABYLON.GUI.TextBlock",I);var B=function(t){function e(i,o){void 0===o&&(o=null);var n=t.call(this,i)||this;return n.name=i,n._workingCanvas=null,n._loaded=!1,n._stretch=e.STRETCH_FILL,n._autoScale=!1,n._sourceLeft=0,n._sourceTop=0,n._sourceWidth=0,n._sourceHeight=0,n._svgAttributesComputationCompleted=!1,n._isSVG=!1,n._cellWidth=0,n._cellHeight=0,n._cellId=-1,n._populateNinePatchSlicesFromImage=!1,n._imageDataCache={data:null,key:""},n.onImageLoadedObservable=new _.Observable,n.onSVGAttributesComputedObservable=new _.Observable,n.source=o,n}return r(e,t),Object.defineProperty(e.prototype,"isLoaded",{get:function(){return this._loaded},enumerable:!1,configurable:!0}),e.prototype.isReady=function(){return this.isLoaded},Object.defineProperty(e.prototype,"detectPointerOnOpaqueOnly",{get:function(){return this._detectPointerOnOpaqueOnly},set:function(t){this._detectPointerOnOpaqueOnly!==t&&(this._detectPointerOnOpaqueOnly=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sliceLeft",{get:function(){return this._sliceLeft},set:function(t){this._sliceLeft!==t&&(this._sliceLeft=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sliceRight",{get:function(){return this._sliceRight},set:function(t){this._sliceRight!==t&&(this._sliceRight=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sliceTop",{get:function(){return this._sliceTop},set:function(t){this._sliceTop!==t&&(this._sliceTop=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sliceBottom",{get:function(){return this._sliceBottom},set:function(t){this._sliceBottom!==t&&(this._sliceBottom=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sourceLeft",{get:function(){return this._sourceLeft},set:function(t){this._sourceLeft!==t&&(this._sourceLeft=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sourceTop",{get:function(){return this._sourceTop},set:function(t){this._sourceTop!==t&&(this._sourceTop=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sourceWidth",{get:function(){return this._sourceWidth},set:function(t){this._sourceWidth!==t&&(this._sourceWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sourceHeight",{get:function(){return this._sourceHeight},set:function(t){this._sourceHeight!==t&&(this._sourceHeight=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"imageWidth",{get:function(){return this._imageWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"imageHeight",{get:function(){return this._imageHeight},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"populateNinePatchSlicesFromImage",{get:function(){return this._populateNinePatchSlicesFromImage},set:function(t){this._populateNinePatchSlicesFromImage!==t&&(this._populateNinePatchSlicesFromImage=t,this._populateNinePatchSlicesFromImage&&this._loaded&&this._extractNinePatchSliceDataFromImage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isSVG",{get:function(){return this._isSVG},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"svgAttributesComputationCompleted",{get:function(){return this._svgAttributesComputationCompleted},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"autoScale",{get:function(){return this._autoScale},set:function(t){this._autoScale!==t&&(this._autoScale=t,t&&this._loaded&&this.synchronizeSizeWithContent())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stretch",{get:function(){return this._stretch},set:function(t){this._stretch!==t&&(this._stretch=t,this._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype._rotate90=function(t,i){var o,n;void 0===i&&(i=!1);var r=this._domImage.width,a=this._domImage.height,s=(null===(n=null===(o=this._host)||void 0===o?void 0:o.getScene())||void 0===n?void 0:n.getEngine())||_.EngineStore.LastCreatedEngine;if(!s)throw new Error("Invalid engine. Unable to create a canvas.");var l=s.createCanvas(a,r),h=l.getContext("2d");h.translate(l.width/2,l.height/2),h.rotate(t*Math.PI/2),h.drawImage(this._domImage,0,0,r,a,-r/2,-a/2,r,a);var c=l.toDataURL("image/jpg"),u=new e(this.name+"rotated",c);return i&&(u._stretch=this._stretch,u._autoScale=this._autoScale,u._cellId=this._cellId,u._cellWidth=t%1?this._cellHeight:this._cellWidth,u._cellHeight=t%1?this._cellWidth:this._cellHeight),this._handleRotationForSVGImage(this,u,t),this._imageDataCache.data=null,u},e.prototype._handleRotationForSVGImage=function(t,e,i){var o=this;t._isSVG&&(t._svgAttributesComputationCompleted?(this._rotate90SourceProperties(t,e,i),this._markAsDirty()):t.onSVGAttributesComputedObservable.addOnce((function(){o._rotate90SourceProperties(t,e,i),o._markAsDirty()})))},e.prototype._rotate90SourceProperties=function(t,e,i){var o,n,r=t.sourceLeft,a=t.sourceTop,s=t.domImage.width,l=t.domImage.height,_=r,h=a,c=t.sourceWidth,u=t.sourceHeight;if(0!=i){var d=i<0?-1:1;i%=4;for(var f=0;f<Math.abs(i);++f)_=-(a-l/2)*d+l/2,h=(r-s/2)*d+s/2,c=(o=[u,c])[0],u=o[1],i<0?h-=u:_-=c,r=_,a=h,s=(n=[l,s])[0],l=n[1]}e.sourceLeft=_,e.sourceTop=h,e.sourceWidth=c,e.sourceHeight=u},e.prototype._extractNinePatchSliceDataFromImage=function(){var t,e,i=this._domImage.width,o=this._domImage.height;if(!this._workingCanvas){var n=(null===(e=null===(t=this._host)||void 0===t?void 0:t.getScene())||void 0===e?void 0:e.getEngine())||_.EngineStore.LastCreatedEngine;if(!n)throw new Error("Invalid engine. Unable to create a canvas.");this._workingCanvas=n.createCanvas(i,o)}var r=this._workingCanvas.getContext("2d");r.drawImage(this._domImage,0,0,i,o);var a=r.getImageData(0,0,i,o);this._sliceLeft=-1,this._sliceRight=-1;for(var s=0;s<i;s++)if((h=a.data[4*s+3])>127&&-1===this._sliceLeft)this._sliceLeft=s;else if(h<127&&this._sliceLeft>-1){this._sliceRight=s;break}this._sliceTop=-1,this._sliceBottom=-1;for(var l=0;l<o;l++){var h;if((h=a.data[l*i*4+3])>127&&-1===this._sliceTop)this._sliceTop=l;else if(h<127&&this._sliceTop>-1){this._sliceBottom=l;break}}},Object.defineProperty(e.prototype,"domImage",{get:function(){return this._domImage},set:function(t){var e=this;this._domImage=t,this._loaded=!1,this._imageDataCache.data=null,this._domImage.width?this._onImageLoaded():this._domImage.onload=function(){e._onImageLoaded()}},enumerable:!1,configurable:!0}),e.prototype._onImageLoaded=function(){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()},Object.defineProperty(e.prototype,"source",{get:function(){return this._source},set:function(t){var i,o,n=this;if(this._source!==t){this._removeCacheUsage(this._source),this._loaded=!1,this._source=t,this._imageDataCache.data=null,t&&(t=this._svgCheck(t));var r=(null===(o=null===(i=this._host)||void 0===i?void 0:i.getScene())||void 0===o?void 0:o.getEngine())||_.EngineStore.LastCreatedEngine;if(!r)throw new Error("Invalid engine. Unable to create a canvas.");if(t&&e.SourceImgCache.has(t)){var a=e.SourceImgCache.get(t);return this._domImage=a.img,a.timesUsed+=1,void(a.loaded?this._onImageLoaded():a.waitingForLoadCallback.push(this._onImageLoaded.bind(this)))}this._domImage=r.createCanvasImage(),t&&e.SourceImgCache.set(t,{img:this._domImage,timesUsed:1,loaded:!1,waitingForLoadCallback:[this._onImageLoaded.bind(this)]}),this._domImage.onload=function(){if(t){var i=e.SourceImgCache.get(t);if(i){i.loaded=!0;for(var o=0,r=i.waitingForLoadCallback;o<r.length;o++)(0,r[o])();return void(i.waitingForLoadCallback.length=0)}}n._onImageLoaded()},t&&(_.Tools.SetCorsBehavior(t,this._domImage),_.Tools.SetReferrerPolicyBehavior(this.referrerPolicy,this._domImage),this._domImage.src=t)}},enumerable:!1,configurable:!0}),e.ResetImageCache=function(){e.SourceImgCache.clear()},e.prototype._removeCacheUsage=function(t){var i=t&&e.SourceImgCache.get(t);i&&(i.timesUsed-=1,0===i.timesUsed&&e.SourceImgCache.delete(t))},e.prototype._svgCheck=function(t){var e=this;if(window.SVGSVGElement&&-1!==t.search(/.svg#/gi)&&t.indexOf("#")===t.lastIndexOf("#")){this._isSVG=!0;var i=t.split("#")[0],o=t.split("#")[1],n=document.body.querySelector('object[data="'+i+'"]');if(n){var r=n.contentDocument;if(r&&r.documentElement){var a=r.documentElement.getAttribute("viewBox"),s=Number(r.documentElement.getAttribute("width")),l=Number(r.documentElement.getAttribute("height"));if(r.getElementById(o)&&a&&s&&l)return this._getSVGAttribs(n,o),t}n.addEventListener("load",(function(){e._getSVGAttribs(n,o)}))}else{var _=document.createElement("object");_.data=i,_.type="image/svg+xml",_.width="0%",_.height="0%",document.body.appendChild(_),_.onload=function(){var t=document.body.querySelector('object[data="'+i+'"]');t&&e._getSVGAttribs(t,o)}}return i}return t},e.prototype._getSVGAttribs=function(t,e){var i=t.contentDocument;if(i&&i.documentElement){var o=i.documentElement.getAttribute("viewBox"),n=Number(i.documentElement.getAttribute("width")),r=Number(i.documentElement.getAttribute("height")),a=i.getElementById(e);if(o&&n&&r&&a){var s=Number(o.split(" ")[2]),l=Number(o.split(" ")[3]),_=a.getBBox(),h=1,c=1,u=0,d=0,f=a.transform.baseVal.consolidate().matrix;a.transform&&a.transform.baseVal.consolidate()&&(h=f.a,c=f.d,u=f.e,d=f.f),this.sourceLeft=(h*_.x+u)*n/s,this.sourceTop=(c*_.y+d)*r/l,this.sourceWidth=_.width*h*(n/s),this.sourceHeight=_.height*c*(r/l),this._svgAttributesComputationCompleted=!0,this.onSVGAttributesComputedObservable.notifyObservers(this)}}},Object.defineProperty(e.prototype,"cellWidth",{get:function(){return this._cellWidth},set:function(t){this._cellWidth!==t&&(this._cellWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cellHeight",{get:function(){return this._cellHeight},set:function(t){this._cellHeight!==t&&(this._cellHeight=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cellId",{get:function(){return this._cellId},set:function(t){this._cellId!==t&&(this._cellId=t,this._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype.contains=function(e,i){if(!t.prototype.contains.call(this,e,i))return!1;if(!this._detectPointerOnOpaqueOnly||!this._workingCanvas)return!0;var o=0|this._currentMeasure.width,n=0|this._currentMeasure.height,r=o+"_"+n,a=this._imageDataCache.data;if(!a||this._imageDataCache.key!==r){var s=this._workingCanvas.getContext("2d");this._imageDataCache.data=a=s.getImageData(0,0,o,n).data,this._imageDataCache.key=r}return a[4*((e=e-this._currentMeasure.left|0)+(i=i-this._currentMeasure.top|0)*o)+3]>0},e.prototype._getTypeName=function(){return"Image"},e.prototype.synchronizeSizeWithContent=function(){this._loaded&&(this.width=this._domImage.width+"px",this.height=this._domImage.height+"px")},e.prototype._processMeasures=function(i,o){if(this._loaded)switch(this._stretch){case e.STRETCH_NONE:case e.STRETCH_FILL:case e.STRETCH_UNIFORM:case e.STRETCH_NINE_PATCH:break;case e.STRETCH_EXTEND:this._autoScale&&this.synchronizeSizeWithContent(),this.parent&&this.parent.parent&&(this.parent.adaptWidthToChildren=!0,this.parent.adaptHeightToChildren=!0)}t.prototype._processMeasures.call(this,i,o)},e.prototype._prepareWorkingCanvasForOpaqueDetection=function(){var t,e;if(this._detectPointerOnOpaqueOnly){var i=this._currentMeasure.width,o=this._currentMeasure.height;if(!this._workingCanvas){var n=(null===(e=null===(t=this._host)||void 0===t?void 0:t.getScene())||void 0===e?void 0:e.getEngine())||_.EngineStore.LastCreatedEngine;if(!n)throw new Error("Invalid engine. Unable to create a canvas.");this._workingCanvas=n.createCanvas(i,o)}this._workingCanvas.getContext("2d").clearRect(0,0,i,o)}},e.prototype._drawImage=function(t,e,i,o,n,r,a,s,l){t.drawImage(this._domImage,e,i,o,n,r,a,s,l),this._detectPointerOnOpaqueOnly&&(t=this._workingCanvas.getContext("2d")).drawImage(this._domImage,e,i,o,n,r-this._currentMeasure.left,a-this._currentMeasure.top,s,l)},e.prototype._draw=function(t){var i,o,n,r;if(t.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),-1==this.cellId)i=this._sourceLeft,o=this._sourceTop,n=this._sourceWidth?this._sourceWidth:this._imageWidth,r=this._sourceHeight?this._sourceHeight:this._imageHeight;else{var a=this._domImage.naturalWidth/this.cellWidth,s=this.cellId/a>>0,l=this.cellId%a;i=this.cellWidth*l,o=this.cellHeight*s,n=this.cellWidth,r=this.cellHeight}if(this._prepareWorkingCanvasForOpaqueDetection(),this._applyStates(t),this._loaded)switch(this._stretch){case e.STRETCH_NONE:case e.STRETCH_FILL:this._drawImage(t,i,o,n,r,this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height);break;case e.STRETCH_UNIFORM:var _=this._currentMeasure.width/n,h=this._currentMeasure.height/r,c=Math.min(_,h),u=(this._currentMeasure.width-n*c)/2,d=(this._currentMeasure.height-r*c)/2;this._drawImage(t,i,o,n,r,this._currentMeasure.left+u,this._currentMeasure.top+d,n*c,r*c);break;case e.STRETCH_EXTEND:this._drawImage(t,i,o,n,r,this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height);break;case e.STRETCH_NINE_PATCH:this._renderNinePatch(t)}t.restore()},e.prototype._renderNinePatch=function(t){var e=this._sliceLeft,i=this._sliceTop,o=this._imageHeight-this._sliceBottom,n=this._imageWidth-this._sliceRight,r=this._sliceRight-this._sliceLeft,a=this._sliceBottom-this._sliceTop,s=this._currentMeasure.width-n-e+2,l=this._currentMeasure.height-o-i+2,_=this._currentMeasure.left+e-1,h=this._currentMeasure.top+i-1,c=this._currentMeasure.left+this._currentMeasure.width-n,u=this._currentMeasure.top+this._currentMeasure.height-o;this._drawImage(t,0,0,e,i,this._currentMeasure.left,this._currentMeasure.top,e,i),t.clearRect(_,this._currentMeasure.top,s,i),this._drawImage(t,this._sliceLeft,0,r,i,_,this._currentMeasure.top,s,i),t.clearRect(c,this._currentMeasure.top,n,i),this._drawImage(t,this._sliceRight,0,n,i,c,this._currentMeasure.top,n,i),t.clearRect(this._currentMeasure.left,h,e,l),this._drawImage(t,0,this._sliceTop,e,a,this._currentMeasure.left,h,e,l),t.clearRect(_,h,s,l),this._drawImage(t,this._sliceLeft,this._sliceTop,r,a,_,h,s,l),t.clearRect(c,h,n,l),this._drawImage(t,this._sliceRight,this._sliceTop,n,a,c,h,n,l),t.clearRect(this._currentMeasure.left,u,e,o),this._drawImage(t,0,this._sliceBottom,e,o,this._currentMeasure.left,u,e,o),t.clearRect(_,u,s,o),this._drawImage(t,this.sliceLeft,this._sliceBottom,r,o,_,u,s,o),t.clearRect(c,u,n,o),this._drawImage(t,this._sliceRight,this._sliceBottom,n,o,c,u,n,o)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.onImageLoadedObservable.clear(),this.onSVGAttributesComputedObservable.clear(),this._removeCacheUsage(this._source)},e.SourceImgCache=new Map,e.STRETCH_NONE=0,e.STRETCH_FILL=1,e.STRETCH_UNIFORM=2,e.STRETCH_EXTEND=3,e.STRETCH_NINE_PATCH=4,a([(0,_.serialize)()],e.prototype,"detectPointerOnOpaqueOnly",null),a([(0,_.serialize)()],e.prototype,"sliceLeft",null),a([(0,_.serialize)()],e.prototype,"sliceRight",null),a([(0,_.serialize)()],e.prototype,"sliceTop",null),a([(0,_.serialize)()],e.prototype,"sliceBottom",null),a([(0,_.serialize)()],e.prototype,"sourceLeft",null),a([(0,_.serialize)()],e.prototype,"sourceTop",null),a([(0,_.serialize)()],e.prototype,"sourceWidth",null),a([(0,_.serialize)()],e.prototype,"sourceHeight",null),a([(0,_.serialize)()],e.prototype,"populateNinePatchSlicesFromImage",null),a([(0,_.serialize)()],e.prototype,"autoScale",null),a([(0,_.serialize)()],e.prototype,"stretch",null),a([(0,_.serialize)()],e.prototype,"source",null),a([(0,_.serialize)()],e.prototype,"cellWidth",null),a([(0,_.serialize)()],e.prototype,"cellHeight",null),a([(0,_.serialize)()],e.prototype,"cellId",null),e}(v);(0,_.RegisterClass)("BABYLON.GUI.Image",B);var C=function(t){function e(e){var i=t.call(this,e)||this;i.name=e,i.delegatePickingToChildren=!1,i.thickness=1,i.isPointerBlocker=!0;var o=null;return i.pointerEnterAnimation=function(){o=i.alpha,i.alpha-=.1},i.pointerOutAnimation=function(){null!==o&&(i.alpha=o)},i.pointerDownAnimation=function(){i.scaleX-=.05,i.scaleY-=.05},i.pointerUpAnimation=function(){i.scaleX+=.05,i.scaleY+=.05},i}return r(e,t),Object.defineProperty(e.prototype,"image",{get:function(){return this._image},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textBlock",{get:function(){return this._textBlock},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"Button"},e.prototype._processPicking=function(e,i,o,n,r,a,s,l){if(!this._isEnabled||!this.isHitTestVisible||!this.isVisible||this.notRenderable)return!1;if(!t.prototype.contains.call(this,e,i))return!1;if(this.delegatePickingToChildren){for(var _=!1,h=this._children.length-1;h>=0;h--){var c=this._children[h];if(c.isEnabled&&c.isHitTestVisible&&c.isVisible&&!c.notRenderable&&c.contains(e,i)){_=!0;break}}if(!_)return!1}return this._processObservables(n,e,i,o,r,a,s,l),!0},e.prototype._onPointerEnter=function(e,i){return!!t.prototype._onPointerEnter.call(this,e,i)&&(!this.isReadOnly&&this.pointerEnterAnimation&&this.pointerEnterAnimation(),!0)},e.prototype._onPointerOut=function(e,i,o){void 0===o&&(o=!1),!this.isReadOnly&&this.pointerOutAnimation&&this.pointerOutAnimation(),t.prototype._onPointerOut.call(this,e,i,o)},e.prototype._onPointerDown=function(e,i,o,n,r){return!!t.prototype._onPointerDown.call(this,e,i,o,n,r)&&(!this.isReadOnly&&this.pointerDownAnimation&&this.pointerDownAnimation(),!0)},e.prototype._getRectangleFill=function(t){return this.isEnabled?this._getBackgroundColor(t):this._disabledColor},e.prototype._onPointerUp=function(e,i,o,n,r,a){!this.isReadOnly&&this.pointerUpAnimation&&this.pointerUpAnimation(),t.prototype._onPointerUp.call(this,e,i,o,n,r,a)},e.prototype.serialize=function(e){t.prototype.serialize.call(this,e),this._textBlock&&(e.textBlockName=this._textBlock.name),this._image&&(e.imageName=this._image.name)},e.prototype._parseFromContent=function(e,i){t.prototype._parseFromContent.call(this,e,i),e.textBlockName&&(this._textBlock=this.getChildByName(e.textBlockName)),e.imageName&&(this._image=this.getChildByName(e.imageName))},e.CreateImageButton=function(t,e,i){var o=new this(t),n=new I(t+"_button",e);n.textWrapping=!0,n.textHorizontalAlignment=v.HORIZONTAL_ALIGNMENT_CENTER,n.paddingLeft="20%",o.addControl(n);var r=new B(t+"_icon",i);return r.width="20%",r.stretch=B.STRETCH_UNIFORM,r.horizontalAlignment=v.HORIZONTAL_ALIGNMENT_LEFT,o.addControl(r),o._image=r,o._textBlock=n,o},e.CreateImageOnlyButton=function(t,e){var i=new this(t),o=new B(t+"_icon",e);return o.stretch=B.STRETCH_FILL,o.horizontalAlignment=v.HORIZONTAL_ALIGNMENT_LEFT,i.addControl(o),i._image=o,i},e.CreateSimpleButton=function(t,e){var i=new this(t),o=new I(t+"_button",e);return o.textWrapping=!0,o.textHorizontalAlignment=v.HORIZONTAL_ALIGNMENT_CENTER,i.addControl(o),i._textBlock=o,i},e.CreateImageWithCenterTextButton=function(t,e,i){var o=new this(t),n=new B(t+"_icon",i);n.stretch=B.STRETCH_FILL,o.addControl(n);var r=new I(t+"_button",e);return r.textWrapping=!0,r.textHorizontalAlignment=v.HORIZONTAL_ALIGNMENT_CENTER,o.addControl(r),o._image=n,o._textBlock=r,o},e}(P);(0,_.RegisterClass)("BABYLON.GUI.Button",C);var T=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._isVertical=!0,i._manualWidth=!1,i._manualHeight=!1,i._doNotTrackManualChanges=!1,i._spacing=0,i.ignoreLayoutWarnings=!1,i}return r(e,t),Object.defineProperty(e.prototype,"isVertical",{get:function(){return this._isVertical},set:function(t){this._isVertical!==t&&(this._isVertical=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"spacing",{get:function(){return this._spacing},set:function(t){this._spacing!==t&&(this._spacing=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this._width.toString(this._host)},set:function(t){this._doNotTrackManualChanges||(this._manualWidth=!0),this._width.toString(this._host)!==t&&this._width.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height.toString(this._host)},set:function(t){this._doNotTrackManualChanges||(this._manualHeight=!0),this._height.toString(this._host)!==t&&this._height.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"StackPanel"},e.prototype._preMeasure=function(e,i){for(var o=0,n=this._children;o<n.length;o++){var r=n[o];this._isVertical?r.verticalAlignment=v.VERTICAL_ALIGNMENT_TOP:r.horizontalAlignment=v.HORIZONTAL_ALIGNMENT_LEFT}t.prototype._preMeasure.call(this,e,i)},e.prototype._additionalProcessing=function(e,i){t.prototype._additionalProcessing.call(this,e,i),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)},e.prototype._postMeasure=function(){for(var e=0,i=0,o=this._children.length,n=0;n<o;n++){var r=this._children[n];r.isVisible&&!r.notRenderable&&(this._isVertical?(r.top!==i+"px"&&(r.top=i+"px",this._rebuildLayout=!0,r._top.ignoreAdaptiveScaling=!0),r._height.isPercentage&&!r._automaticSize?this.ignoreLayoutWarnings||_.Tools.Warn("Control (Name:".concat(r.name,", UniqueId:").concat(r.uniqueId,") is using height in percentage mode inside a vertical StackPanel")):i+=r._currentMeasure.height+r._paddingTopInPixels+r._paddingBottomInPixels+(n<o-1?this._spacing:0)):(r.left!==e+"px"&&(r.left=e+"px",this._rebuildLayout=!0,r._left.ignoreAdaptiveScaling=!0),!r._width.isPercentage||r._automaticSize||"TextBlock"!==r.getClassName()||r.textWrapping===x.Clip||r.forceResizeWidth?e+=r._currentMeasure.width+r._paddingLeftInPixels+r._paddingRightInPixels+(n<o-1?this._spacing:0):this.ignoreLayoutWarnings||_.Tools.Warn("Control (Name:".concat(r.name,", UniqueId:").concat(r.uniqueId,") is using width in percentage mode inside a horizontal StackPanel"))))}e+=this._paddingLeftInPixels+this._paddingRightInPixels,i+=this._paddingTopInPixels+this._paddingBottomInPixels,this._doNotTrackManualChanges=!0;var a=!1,s=!1;if((!this._manualHeight||this.adaptHeightToChildren)&&this._isVertical){var l=this.height;this.height=i+"px",s=l!==this.height||!this._height.ignoreAdaptiveScaling}if((!this._manualWidth||this.adaptWidthToChildren)&&!this._isVertical){var h=this.width;this.width=e+"px",a=h!==this.width||!this._width.ignoreAdaptiveScaling}s&&(this._height.ignoreAdaptiveScaling=!0),a&&(this._width.ignoreAdaptiveScaling=!0),this._doNotTrackManualChanges=!1,(a||s)&&(this._rebuildLayout=!0),t.prototype._postMeasure.call(this)},e.prototype.serialize=function(e){t.prototype.serialize.call(this,e),e.manualWidth=this._manualWidth,e.manualHeight=this._manualHeight},e.prototype._parseFromContent=function(e,i){this._manualWidth=e.manualWidth,this._manualHeight=e.manualHeight,t.prototype._parseFromContent.call(this,e,i)},a([(0,_.serialize)()],e.prototype,"ignoreLayoutWarnings",void 0),a([(0,_.serialize)()],e.prototype,"isVertical",null),a([(0,_.serialize)()],e.prototype,"spacing",null),a([(0,_.serialize)()],e.prototype,"width",null),a([(0,_.serialize)()],e.prototype,"height",null),e}(y);(0,_.RegisterClass)("BABYLON.GUI.StackPanel",T);var S=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._isChecked=!1,i._background="black",i._checkSizeRatio=.8,i._thickness=1,i.onIsCheckedChangedObservable=new _.Observable,i.isPointerBlocker=!0,i}return r(e,t),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness!==t&&(this._thickness=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"checkSizeRatio",{get:function(){return this._checkSizeRatio},set:function(t){t=Math.max(Math.min(1,t),0),this._checkSizeRatio!==t&&(this._checkSizeRatio=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isChecked",{get:function(){return this._isChecked},set:function(t){this._isChecked!==t&&(this._isChecked=t,this._markAsDirty(),this.onIsCheckedChangedObservable.notifyObservers(t))},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"Checkbox"},e.prototype._draw=function(t){t.save(),this._applyStates(t);var e=this._currentMeasure.width-this._thickness,i=this._currentMeasure.height-this._thickness;if((this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),t.fillStyle=this._isEnabled?this._background:this._disabledColor,t.fillRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,e,i),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),this._isChecked){t.fillStyle=this._isEnabled?this.color:this._disabledColorItem;var o=e*this._checkSizeRatio,n=i*this._checkSizeRatio;t.fillRect(this._currentMeasure.left+this._thickness/2+(e-o)/2,this._currentMeasure.top+this._thickness/2+(i-n)/2,o,n)}t.strokeStyle=this.color,t.lineWidth=this._thickness,t.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,e,i),t.restore()},e.prototype._onPointerDown=function(e,i,o,n,r){return!!t.prototype._onPointerDown.call(this,e,i,o,n,r)&&(this.isReadOnly||(this.isChecked=!this.isChecked),!0)},e.AddCheckBoxWithHeader=function(t,i){var o=new T;o.isVertical=!1,o.height="30px";var n=new e;n.width="20px",n.height="20px",n.isChecked=!0,n.color="green",n.onIsCheckedChangedObservable.add(i),o.addControl(n);var r=new I;return r.text=t,r.width="180px",r.paddingLeft="5px",r.textHorizontalAlignment=v.HORIZONTAL_ALIGNMENT_LEFT,r.color="white",o.addControl(r),o},a([(0,_.serialize)()],e.prototype,"thickness",null),a([(0,_.serialize)()],e.prototype,"checkSizeRatio",null),a([(0,_.serialize)()],e.prototype,"background",null),a([(0,_.serialize)()],e.prototype,"isChecked",null),e}(v);(0,_.RegisterClass)("BABYLON.GUI.Checkbox",S);var O=function(){function t(){}return Object.defineProperty(t.prototype,"text",{get:function(){return this._characters?this._characters.join(""):this._text},set:function(t){this._text=t,this._characters=Array.from&&Array.from(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this._characters?this._characters.length:this._text.length},enumerable:!1,configurable:!0}),t.prototype.removePart=function(t,e,i){var o;if(this._text=this._text.slice(0,t)+(i||"")+this._text.slice(e),this._characters){var n=i?Array.from(i):[];(o=this._characters).splice.apply(o,function(t,e,i){if(i||2===arguments.length)for(var o,n=0,r=e.length;n<r;n++)!o&&n in e||(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return t.concat(o||Array.prototype.slice.call(e))}([t,e-t],n,!1))}},t.prototype.charAt=function(t){return this._characters?this._characters[t]:this._text.charAt(t)},t.prototype.substr=function(t,e){if(this._characters){t=isNaN(t)?0:t>=0?Math.min(t,this._characters.length):this._characters.length+Math.max(t,-this._characters.length),void 0===e?e=this._characters.length-t:(isNaN(e)||e<0)&&(e=0);for(var i=[];--e>=0;)i[e]=this._characters[t+e];return i.join("")}return this._text.substr(t,e)},t.prototype.substring=function(t,e){if(this._characters){isNaN(t)?t=0:t>this._characters.length?t=this._characters.length:t<0&&(t=0),void 0===e?e=this._characters.length:isNaN(e)?e=0:e>this._characters.length?e=this._characters.length:e<0&&(e=0);for(var i=[],o=0;t<e;)i[o++]=this._characters[t++];return i.join("")}return this._text.substring(t,e)},t.prototype.isWord=function(t){var e=/\w/g;return this._characters?-1!==this._characters[t].search(e):-1!==this._text.search(e)},t}(),R=function(t){function e(e,i){void 0===i&&(i="");var o=t.call(this,e)||this;return o.name=e,o._placeholderText="",o._background="#222222",o._focusedBackground="#000000",o._focusedColor="white",o._placeholderColor="gray",o._thickness=1,o._margin=new h(10,h.UNITMODE_PIXEL),o._autoStretchWidth=!0,o._maxWidth=new h(1,h.UNITMODE_PERCENTAGE,!1),o._isFocused=!1,o._blinkIsEven=!1,o._cursorOffset=0,o._deadKey=!1,o._addKey=!0,o._currentKey="",o._isTextHighlightOn=!1,o._textHighlightColor="#d5e0ff",o._highligherOpacity=.4,o._highlightedText="",o._startHighlightIndex=0,o._endHighlightIndex=0,o._cursorIndex=-1,o._onFocusSelectAll=!1,o._isPointerDown=!1,o.promptMessage="Please enter text:",o.disableMobilePrompt=!1,o.onTextChangedObservable=new _.Observable,o.onBeforeKeyAddObservable=new _.Observable,o.onFocusObservable=new _.Observable,o.onBlurObservable=new _.Observable,o.onTextHighlightObservable=new _.Observable,o.onTextCopyObservable=new _.Observable,o.onTextCutObservable=new _.Observable,o.onTextPasteObservable=new _.Observable,o.onKeyboardEventProcessedObservable=new _.Observable,o.text=i,o.isPointerBlocker=!0,o}return r(e,t),Object.defineProperty(e.prototype,"maxWidth",{get:function(){return this._maxWidth.toString(this._host)},set:function(t){this._maxWidth.toString(this._host)!==t&&this._maxWidth.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxWidthInPixels",{get:function(){return this._maxWidth.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"highligherOpacity",{get:function(){return this._highligherOpacity},set:function(t){this._highligherOpacity!==t&&(this._highligherOpacity=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onFocusSelectAll",{get:function(){return this._onFocusSelectAll},set:function(t){this._onFocusSelectAll!==t&&(this._onFocusSelectAll=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textHighlightColor",{get:function(){return this._textHighlightColor},set:function(t){this._textHighlightColor!==t&&(this._textHighlightColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"margin",{get:function(){return this._margin.toString(this._host)},set:function(t){this._margin.toString(this._host)!==t&&this._margin.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"marginInPixels",{get:function(){return this._margin.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"autoStretchWidth",{get:function(){return this._autoStretchWidth},set:function(t){this._autoStretchWidth!==t&&(this._autoStretchWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness!==t&&(this._thickness=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"focusedBackground",{get:function(){return this._focusedBackground},set:function(t){this._focusedBackground!==t&&(this._focusedBackground=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"focusedColor",{get:function(){return this._focusedColor},set:function(t){this._focusedColor!==t&&(this._focusedColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"placeholderColor",{get:function(){return this._placeholderColor},set:function(t){this._placeholderColor!==t&&(this._placeholderColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"placeholderText",{get:function(){return this._placeholderText},set:function(t){this._placeholderText!==t&&(this._placeholderText=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"deadKey",{get:function(){return this._deadKey},set:function(t){this._deadKey=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"highlightedText",{get:function(){return this._highlightedText},set:function(t){this._highlightedText!==t&&(this._highlightedText=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"addKey",{get:function(){return this._addKey},set:function(t){this._addKey=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentKey",{get:function(){return this._currentKey},set:function(t){this._currentKey=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._textWrapper.text},set:function(t){var e=t.toString();this._textWrapper||(this._textWrapper=new O),this._textWrapper.text!==e&&(this._textWrapper.text=e,this._textHasChanged())},enumerable:!1,configurable:!0}),e.prototype._textHasChanged=function(){this._markAsDirty(),this.onTextChangedObservable.notifyObservers(this)},Object.defineProperty(e.prototype,"width",{get:function(){return this._width.toString(this._host)},set:function(t){this._width.toString(this._host)!==t&&(this._width.fromString(t)&&this._markAsDirty(),this.autoStretchWidth=!1)},enumerable:!1,configurable:!0}),e.prototype.onBlur=function(){this._isFocused=!1,this._scrollLeft=null,this._cursorOffset=0,clearTimeout(this._blinkTimeout),this._markAsDirty(),this.onBlurObservable.notifyObservers(this),this._host.unRegisterClipboardEvents(),this._onClipboardObserver&&this._host.onClipboardObservable.remove(this._onClipboardObserver);var t=this._host.getScene();this._onPointerDblTapObserver&&t&&t.onPointerObservable.remove(this._onPointerDblTapObserver)},e.prototype.onFocus=function(){var t=this;if(this._isEnabled){if(this._scrollLeft=null,this._isFocused=!0,this._blinkIsEven=!1,this._cursorOffset=0,this._markAsDirty(),this.onFocusObservable.notifyObservers(this),"touch"===this._focusedBy&&!this.disableMobilePrompt){var e=prompt(this.promptMessage);return null!==e&&(this.text=e),void(this._host.focusedControl=null)}this._host.registerClipboardEvents(),this._onClipboardObserver=this._host.onClipboardObservable.add((function(e){switch(e.type){case _.ClipboardEventTypes.COPY:t._onCopyText(e.event),t.onTextCopyObservable.notifyObservers(t);break;case _.ClipboardEventTypes.CUT:t._onCutText(e.event),t.onTextCutObservable.notifyObservers(t);break;case _.ClipboardEventTypes.PASTE:t._onPasteText(e.event),t.onTextPasteObservable.notifyObservers(t);break;default:return}}));var i=this._host.getScene();i&&(this._onPointerDblTapObserver=i.onPointerObservable.add((function(e){t._isFocused&&e.type===_.PointerEventTypes.POINTERDOUBLETAP&&t._processDblClick(e)}))),this._onFocusSelectAll&&this._selectAllText()}},e.prototype.focus=function(){this._host.moveFocusToControl(this)},e.prototype.blur=function(){this._host.focusedControl=null},e.prototype._getTypeName=function(){return"InputText"},e.prototype.keepsFocusWith=function(){return this._connectedVirtualKeyboard?[this._connectedVirtualKeyboard]:null},e.prototype.processKey=function(t,e,i){var o;if(!this.isReadOnly&&(!i||!i.ctrlKey&&!i.metaKey||67!==t&&86!==t&&88!==t)){if(i&&(i.ctrlKey||i.metaKey)&&65===t)return this._selectAllText(),void i.preventDefault();switch(t){case 32:e=" ";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());0===this._cursorOffset?this.text=this._textWrapper.substr(0,this._textWrapper.length-1):(n=this._textWrapper.length-this._cursorOffset)>0&&(this._textWrapper.removePart(n-1,n),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){var n=this._textWrapper.length-this._cursorOffset;this._textWrapper.removePart(n,n+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._cursorIndex<this._cursorOffset?(this._endHighlightIndex=this._textWrapper.length-this._cursorIndex,this._startHighlightIndex=this._textWrapper.length-this._cursorOffset):this._cursorIndex>this._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._cursorIndex<this._cursorOffset?(this._endHighlightIndex=this._textWrapper.length-this._cursorIndex,this._startHighlightIndex=this._textWrapper.length-this._cursorOffset):this._cursorIndex>this._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===t&&(e=null!==(o=null==i?void 0:i.key)&&void 0!==o?o:" "),this._deadKey="Dead"===e,e&&(-1===t||32===t||34===t||39===t||t>47&&t<64||t>64&&t<91||t>159&&t<193||t>218&&t<223||t>95&&t<112)&&(this._currentKey=e,this.onBeforeKeyAddObservable.notifyObservers(this),e=this._currentKey,this._addKey&&!this._deadKey))if(this.isTextHighlightOn)this._textWrapper.removePart(this._startHighlightIndex,this._endHighlightIndex,e),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:e;else{var r=this._textWrapper.length-this._cursorOffset;this._textWrapper.removePart(r,r,e),this._textHasChanged()}}},e.prototype._updateValueFromCursorIndex=function(t){if(this._blinkIsEven=!1,-1===this._cursorIndex)this._cursorIndex=t;else if(this._cursorIndex<this._cursorOffset)this._endHighlightIndex=this._textWrapper.length-this._cursorIndex,this._startHighlightIndex=this._textWrapper.length-this._cursorOffset;else{if(!(this._cursorIndex>this._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()},e.prototype._processDblClick=function(t){var e,i;this._startHighlightIndex=this._textWrapper.length-this._cursorOffset,this._endHighlightIndex=this._startHighlightIndex;do{i=this._endHighlightIndex<this._textWrapper.length&&this._textWrapper.isWord(this._endHighlightIndex)?++this._endHighlightIndex:0,e=this._startHighlightIndex>0&&this._textWrapper.isWord(this._startHighlightIndex-1)?--this._startHighlightIndex:0}while(e||i);this._cursorOffset=this._textWrapper.length-this._startHighlightIndex,this.isTextHighlightOn=!0,this._clickedCoordinate=null,this._blinkIsEven=!0,this._cursorIndex=-1,this._markAsDirty()},e.prototype._selectAllText=function(){this._blinkIsEven=!0,this.isTextHighlightOn=!0,this._startHighlightIndex=0,this._endHighlightIndex=this._textWrapper.length,this._cursorOffset=this._textWrapper.length,this._cursorIndex=-1,this._markAsDirty()},e.prototype.processKeyboard=function(t){this.processKey(t.keyCode,t.key,t),this.onKeyboardEventProcessedObservable.notifyObservers(t)},e.prototype._onCopyText=function(t){this.isTextHighlightOn=!1;try{t.clipboardData&&t.clipboardData.setData("text/plain",this._highlightedText)}catch(t){}this._host.clipboardData=this._highlightedText},e.prototype._onCutText=function(t){if(this._highlightedText){this._textWrapper.removePart(this._startHighlightIndex,this._endHighlightIndex),this._textHasChanged(),this.isTextHighlightOn=!1,this._cursorOffset=this._textWrapper.length-this._startHighlightIndex;try{t.clipboardData&&t.clipboardData.setData("text/plain",this._highlightedText)}catch(t){}this._host.clipboardData=this._highlightedText,this._highlightedText=""}},e.prototype._onPasteText=function(t){var e;e=t.clipboardData&&-1!==t.clipboardData.types.indexOf("text/plain")?t.clipboardData.getData("text/plain"):this._host.clipboardData;var i=this._textWrapper.length-this._cursorOffset;this._textWrapper.removePart(i,i,e),this._textHasChanged()},e.prototype._draw=function(t){var e=this;t.save(),this._applyStates(t),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),this._isFocused?this._focusedBackground&&(t.fillStyle=this._isEnabled?this._focusedBackground:this._disabledColor,t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)):this._background&&(t.fillStyle=this._isEnabled?this._background:this._disabledColor,t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),this._fontOffset&&!this._wasDirty||(this._fontOffset=v._GetFontOffset(t.font));var i=this._currentMeasure.left+this._margin.getValueInPixel(this._host,this._tempParentMeasure.width);this.color&&(t.fillStyle=this.color);var o=this._beforeRenderText(this._textWrapper);this._isFocused||this._textWrapper.text||!this._placeholderText||((o=new O).text=this._placeholderText,this._placeholderColor&&(t.fillStyle=this._placeholderColor)),this._textWidth=t.measureText(o.text).width;var 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);var r=this._fontOffset.ascent+(this._currentMeasure.height-this._fontOffset.height)/2,a=this._width.getValueInPixel(this._host,this._tempParentMeasure.width)-n;if(t.save(),t.beginPath(),t.rect(i,this._currentMeasure.top+(this._currentMeasure.height-this._fontOffset.height)/2,a+2,this._currentMeasure.height),t.clip(),this._isFocused&&this._textWidth>a){var s=i-this._textWidth+a;this._scrollLeft||(this._scrollLeft=s)}else this._scrollLeft=i;if(t.fillText(o.text,this._scrollLeft,this._currentMeasure.top+r),this._isFocused){if(this._clickedCoordinate){var l=this._scrollLeft+this._textWidth-this._clickedCoordinate,_=0;this._cursorOffset=0;var h=0;do{this._cursorOffset&&(h=Math.abs(l-_)),this._cursorOffset++,_=t.measureText(o.substr(o.length-this._cursorOffset,this._cursorOffset)).width}while(_<l&&o.length>=this._cursorOffset);Math.abs(l-_)>h&&this._cursorOffset--,this._blinkIsEven=!1,this._clickedCoordinate=null}if(!this._blinkIsEven){var c=o.substr(o.length-this._cursorOffset),u=t.measureText(c).width,d=this._scrollLeft+this._textWidth-u;d<i?(this._scrollLeft+=i-d,d=i,this._markAsDirty()):d>i+a&&(this._scrollLeft+=i+a-d,d=i+a,this._markAsDirty()),this.isTextHighlightOn||t.fillRect(d,this._currentMeasure.top+(this._currentMeasure.height-this._fontOffset.height)/2,2,this._fontOffset.height)}if(clearTimeout(this._blinkTimeout),this._blinkTimeout=setTimeout((function(){e._blinkIsEven=!e._blinkIsEven,e._markAsDirty()}),500),this.isTextHighlightOn){clearTimeout(this._blinkTimeout);var f=t.measureText(o.substring(this._startHighlightIndex)).width,p=this._scrollLeft+this._textWidth-f;this._highlightedText=o.substring(this._startHighlightIndex,this._endHighlightIndex);var g=t.measureText(o.substring(this._startHighlightIndex,this._endHighlightIndex)).width;p<i&&((g-=i-p)||(g=t.measureText(o.charAt(o.length-this._cursorOffset)).width),p=i),t.globalAlpha=this._highligherOpacity,t.fillStyle=this._textHighlightColor,t.fillRect(p,this._currentMeasure.top+(this._currentMeasure.height-this._fontOffset.height)/2,g,this._fontOffset.height),t.globalAlpha=1}}t.restore(),this._thickness&&(this._isFocused?this.focusedColor&&(t.strokeStyle=this.focusedColor):this.color&&(t.strokeStyle=this.color),t.lineWidth=this._thickness,t.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,this._currentMeasure.width-this._thickness,this._currentMeasure.height-this._thickness)),t.restore()},e.prototype._onPointerDown=function(e,i,o,n,r){return!(!t.prototype._onPointerDown.call(this,e,i,o,n,r)||!this.isReadOnly&&(this._clickedCoordinate=i.x,this.isTextHighlightOn=!1,this._highlightedText="",this._cursorIndex=-1,this._isPointerDown=!0,this._host._capturingControl[o]=this,this._focusedBy=r.event.pointerType,this._host.focusedControl===this?(clearTimeout(this._blinkTimeout),this._markAsDirty(),0):!this._isEnabled||(this._host.focusedControl=this,0)))},e.prototype._onPointerMove=function(e,i,o,n){this._host.focusedControl===this&&this._isPointerDown&&!this.isReadOnly&&(this._clickedCoordinate=i.x,this._markAsDirty(),this._updateValueFromCursorIndex(this._cursorOffset)),t.prototype._onPointerMove.call(this,e,i,o,n)},e.prototype._onPointerUp=function(e,i,o,n,r){this._isPointerDown=!1,delete this._host._capturingControl[o],t.prototype._onPointerUp.call(this,e,i,o,n,r)},e.prototype._beforeRenderText=function(t){return t},Object.defineProperty(e.prototype,"isTextHighlightOn",{get:function(){return this._isTextHighlightOn},set:function(t){this._isTextHighlightOn!==t&&(t&&this.onTextHighlightObservable.notifyObservers(this),this._isTextHighlightOn=t)},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){t.prototype.dispose.call(this),this.onBlurObservable.clear(),this.onFocusObservable.clear(),this.onTextChangedObservable.clear(),this.onTextCopyObservable.clear(),this.onTextCutObservable.clear(),this.onTextPasteObservable.clear(),this.onTextHighlightObservable.clear(),this.onKeyboardEventProcessedObservable.clear()},a([(0,_.serialize)()],e.prototype,"promptMessage",void 0),a([(0,_.serialize)()],e.prototype,"disableMobilePrompt",void 0),a([(0,_.serialize)()],e.prototype,"maxWidth",null),a([(0,_.serialize)()],e.prototype,"highligherOpacity",null),a([(0,_.serialize)()],e.prototype,"onFocusSelectAll",null),a([(0,_.serialize)()],e.prototype,"textHighlightColor",null),a([(0,_.serialize)()],e.prototype,"margin",null),a([(0,_.serialize)()],e.prototype,"autoStretchWidth",null),a([(0,_.serialize)()],e.prototype,"thickness",null),a([(0,_.serialize)()],e.prototype,"focusedBackground",null),a([(0,_.serialize)()],e.prototype,"focusedColor",null),a([(0,_.serialize)()],e.prototype,"background",null),a([(0,_.serialize)()],e.prototype,"placeholderColor",null),a([(0,_.serialize)()],e.prototype,"placeholderText",null),a([(0,_.serialize)()],e.prototype,"deadKey",null),a([(0,_.serialize)()],e.prototype,"text",null),a([(0,_.serialize)()],e.prototype,"width",null),e}(v);(0,_.RegisterClass)("BABYLON.GUI.InputText",R);var w=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._rowDefinitions=new Array,i._rowDefinitionObservers=[],i._columnDefinitions=new Array,i._columnDefinitionObservers=[],i._cells={},i._childControls=new Array,i}return r(e,t),Object.defineProperty(e.prototype,"columnCount",{get:function(){return this._columnDefinitions.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rowCount",{get:function(){return this._rowDefinitions.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"children",{get:function(){return this._childControls},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cells",{get:function(){return this._cells},enumerable:!1,configurable:!0}),e.prototype.getRowDefinition=function(t){return t<0||t>=this._rowDefinitions.length?null:this._rowDefinitions[t]},e.prototype.getColumnDefinition=function(t){return t<0||t>=this._columnDefinitions.length?null:this._columnDefinitions[t]},e.prototype.addRowDefinition=function(t,e){var i=this;return void 0===e&&(e=!1),this._rowDefinitions.push(new h(t,e?h.UNITMODE_PIXEL:h.UNITMODE_PERCENTAGE)),this._rowDefinitionObservers.push(this._rowDefinitions[this.rowCount-1].onChangedObservable.add((function(){return i._markAsDirty()}))),this._markAsDirty(),this},e.prototype.addColumnDefinition=function(t,e){var i=this;return void 0===e&&(e=!1),this._columnDefinitions.push(new h(t,e?h.UNITMODE_PIXEL:h.UNITMODE_PERCENTAGE)),this._columnDefinitionObservers.push(this._columnDefinitions[this.columnCount-1].onChangedObservable.add((function(){return i._markAsDirty()}))),this._markAsDirty(),this},e.prototype.setRowDefinition=function(t,e,i){var o=this;if(void 0===i&&(i=!1),t<0||t>=this._rowDefinitions.length)return this;var n=this._rowDefinitions[t];return n&&n.isPixel===i&&n.value===e||(this._rowDefinitions[t].onChangedObservable.remove(this._rowDefinitionObservers[t]),this._rowDefinitions[t]=new h(e,i?h.UNITMODE_PIXEL:h.UNITMODE_PERCENTAGE),this._rowDefinitionObservers[t]=this._rowDefinitions[t].onChangedObservable.add((function(){return o._markAsDirty()})),this._markAsDirty()),this},e.prototype.setColumnDefinition=function(t,e,i){var o=this;if(void 0===i&&(i=!1),t<0||t>=this._columnDefinitions.length)return this;var n=this._columnDefinitions[t];return n&&n.isPixel===i&&n.value===e||(this._columnDefinitions[t].onChangedObservable.remove(this._columnDefinitionObservers[t]),this._columnDefinitions[t]=new h(e,i?h.UNITMODE_PIXEL:h.UNITMODE_PERCENTAGE),this._columnDefinitionObservers[t]=this._columnDefinitions[t].onChangedObservable.add((function(){return o._markAsDirty()})),this._markAsDirty()),this},e.prototype.getChildrenAt=function(t,e){var i=this._cells["".concat(t,":").concat(e)];return i?i.children:null},e.prototype.getChildCellInfo=function(t){return t._tag},e.prototype._removeCell=function(e,i){if(e){t.prototype.removeControl.call(this,e);for(var o=0,n=e.children;o<n.length;o++){var r=n[o],a=this._childControls.indexOf(r);-1!==a&&this._childControls.splice(a,1)}delete this._cells[i]}},e.prototype._offsetCell=function(t,e){if(this._cells[e]){this._cells[t]=this._cells[e];for(var i=0,o=this._cells[t].children;i<o.length;i++)o[i]._tag=t;delete this._cells[e]}},e.prototype.removeColumnDefinition=function(t){if(t<0||t>=this._columnDefinitions.length)return this;for(var e=0;e<this._rowDefinitions.length;e++){var i="".concat(e,":").concat(t),o=this._cells[i];this._removeCell(o,i)}for(e=0;e<this._rowDefinitions.length;e++)for(var n=t+1;n<this._columnDefinitions.length;n++){var r="".concat(e,":").concat(n-1);i="".concat(e,":").concat(n),this._offsetCell(r,i)}return this._columnDefinitions[t].onChangedObservable.remove(this._columnDefinitionObservers[t]),this._columnDefinitions.splice(t,1),this._columnDefinitionObservers.splice(t,1),this._markAsDirty(),this},e.prototype.removeRowDefinition=function(t){if(t<0||t>=this._rowDefinitions.length)return this;for(var e=0;e<this._columnDefinitions.length;e++){var i="".concat(t,":").concat(e),o=this._cells[i];this._removeCell(o,i)}for(e=0;e<this._columnDefinitions.length;e++)for(var n=t+1;n<this._rowDefinitions.length;n++){var r="".concat(n-1,":").concat(e);i="".concat(n,":").concat(e),this._offsetCell(r,i)}return this._rowDefinitions[t].onChangedObservable.remove(this._rowDefinitionObservers[t]),this._rowDefinitions.splice(t,1),this._rowDefinitionObservers.splice(t,1),this._markAsDirty(),this},e.prototype.addControl=function(e,i,o){if(void 0===i&&(i=0),void 0===o&&(o=0),0===this._rowDefinitions.length&&this.addRowDefinition(1,!1),0===this._columnDefinitions.length&&this.addColumnDefinition(1,!1),-1!==this._childControls.indexOf(e))return _.Tools.Warn("Control (Name:".concat(e.name,", UniqueId:").concat(e.uniqueId,") is already associated with this grid. You must remove it before reattaching it")),this;var n=Math.min(i,this._rowDefinitions.length-1),r=Math.min(o,this._columnDefinitions.length-1),a="".concat(n,":").concat(r),s=this._cells[a];return s||(s=new y(a),this._cells[a]=s,s.horizontalAlignment=v.HORIZONTAL_ALIGNMENT_LEFT,s.verticalAlignment=v.VERTICAL_ALIGNMENT_TOP,t.prototype.addControl.call(this,s)),s.addControl(e),this._childControls.push(e),e._tag=a,e.parent=this,this._markAsDirty(),this},e.prototype.removeControl=function(t){var e=this._childControls.indexOf(t);-1!==e&&this._childControls.splice(e,1);var i=this._cells[t._tag];return i&&(i.removeControl(t),t._tag=null),this._markAsDirty(),this},e.prototype._getTypeName=function(){return"Grid"},e.prototype._getGridDefinitions=function(t){for(var e=[],i=[],o=[],n=[],r=this._currentMeasure.width,a=0,s=this._currentMeasure.height,l=0,_=0,h=0,c=this._rowDefinitions;h<c.length;h++)(g=c[h]).isPixel?(s-=p=g.getValue(this._host),i[_]=p):l+=g.value,_++;var u=0;_=0;for(var d=0,f=this._rowDefinitions;d<f.length;d++){var p,g=f[d];n.push(u),g.isPixel?u+=g.getValue(this._host):(u+=p=g.value/l*s,i[_]=p),_++}_=0;for(var b=0,m=this._columnDefinitions;b<m.length;b++)(I=m[b]).isPixel?(r-=P=I.getValue(this._host),e[_]=P):a+=I.value,_++;var v=0;_=0;for(var y=0,x=this._columnDefinitions;y<x.length;y++){var P,I=x[y];o.push(v),I.isPixel?v+=I.getValue(this._host):(v+=P=I.value/a*r,e[_]=P),_++}t(o,n,e,i)},e.prototype._additionalProcessing=function(e,i){var o=this;this._getGridDefinitions((function(t,e,i,n){for(var r in o._cells)if(Object.prototype.hasOwnProperty.call(o._cells,r)){var a=r.split(":"),s=parseInt(a[0]),l=parseInt(a[1]),_=o._cells[r];_.left=t[l]+"px",_.top=e[s]+"px",_.width=i[l]+"px",_.height=n[s]+"px",_._left.ignoreAdaptiveScaling=!0,_._top.ignoreAdaptiveScaling=!0,_._width.ignoreAdaptiveScaling=!0,_._height.ignoreAdaptiveScaling=!0}})),t.prototype._additionalProcessing.call(this,e,i)},e.prototype._flagDescendantsAsMatrixDirty=function(){for(var t in this._cells)Object.prototype.hasOwnProperty.call(this._cells,t)&&this._cells[t]._markMatrixAsDirty()},e.prototype._renderHighlightSpecific=function(e){var i=this;t.prototype._renderHighlightSpecific.call(this,e),this._getGridDefinitions((function(t,o,n,r){for(var a=0;a<t.length;a++){var s=i._currentMeasure.left+t[a]+n[a];e.beginPath(),e.moveTo(s,i._currentMeasure.top),e.lineTo(s,i._currentMeasure.top+i._currentMeasure.height),e.stroke()}for(a=0;a<o.length;a++){var l=i._currentMeasure.top+o[a]+r[a];e.beginPath(),e.moveTo(i._currentMeasure.left,l),e.lineTo(i._currentMeasure.left+i._currentMeasure.width,l),e.stroke()}})),e.restore()},e.prototype.dispose=function(){t.prototype.dispose.call(this);for(var e=0,i=this._childControls;e<i.length;e++)i[e].dispose();for(var o=0;o<this._rowDefinitions.length;o++)this._rowDefinitions[o].onChangedObservable.remove(this._rowDefinitionObservers[o]);for(o=0;o<this._columnDefinitions.length;o++)this._columnDefinitions[o].onChangedObservable.remove(this._columnDefinitionObservers[o]);this._rowDefinitionObservers.length=0,this._rowDefinitions.length=0,this._columnDefinitionObservers.length=0,this._columnDefinitions.length=0,this._cells={},this._childControls.length=0},e.prototype.serialize=function(e){t.prototype.serialize.call(this,e),e.columnCount=this.columnCount,e.rowCount=this.rowCount,e.columns=[],e.rows=[],e.tags=[];for(var i=0;i<this.columnCount;++i){var o=this.getColumnDefinition(i),n={value:null==o?void 0:o.getValue(this.host),unit:null==o?void 0:o.unit};e.columns.push(n)}for(i=0;i<this.rowCount;++i){var r=this.getRowDefinition(i);n={value:null==r?void 0:r.getValue(this.host),unit:null==r?void 0:r.unit},e.rows.push(n)}this.children.forEach((function(t){e.tags.push(t._tag)}))},e.prototype._parseFromContent=function(e,i){t.prototype._parseFromContent.call(this,e,i);var o=[];this.children.forEach((function(t){o.push(t)})),this.removeRowDefinition(0),this.removeColumnDefinition(0);for(var n=0;n<e.columnCount;++n){var r=e.columns[n].value,a=e.columns[n].unit;this.addColumnDefinition(r,1===a)}for(n=0;n<e.rowCount;++n){var s=e.rows[n].value;a=e.rows[n].unit,this.addRowDefinition(s,1===a)}for(n=0;n<o.length;++n){var l=e.tags[n],_=parseInt(l.substring(0,l.search(":")));isNaN(_)&&(_=0);var h=parseInt(l.substring(l.search(":")+1));isNaN(h)&&(h=0),this.addControl(o[n],_,h)}},e}(y);(0,_.RegisterClass)("BABYLON.GUI.Grid",w);var M=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._value=_.Color3.Red(),i._tmpColor=new _.Color3,i._pointerStartedOnSquare=!1,i._pointerStartedOnWheel=!1,i._squareLeft=0,i._squareTop=0,i._squareSize=0,i._h=360,i._s=1,i._v=1,i._lastPointerDownId=-1,i.onValueChangedObservable=new _.Observable,i._pointerIsDown=!1,i.value=new _.Color3(.88,.1,.1),i.size="200px",i.isPointerBlocker=!0,i}return r(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(t){this._value.equals(t)||(this._value.copyFrom(t),this._value.toHSVToRef(this._tmpColor),this._h=this._tmpColor.r,this._s=Math.max(this._tmpColor.g,1e-5),this._v=Math.max(this._tmpColor.b,1e-5),this._markAsDirty(),this._value.r<=e._Epsilon&&(this._value.r=0),this._value.g<=e._Epsilon&&(this._value.g=0),this._value.b<=e._Epsilon&&(this._value.b=0),this._value.r>=1-e._Epsilon&&(this._value.r=1),this._value.g>=1-e._Epsilon&&(this._value.g=1),this._value.b>=1-e._Epsilon&&(this._value.b=1),this.onValueChangedObservable.notifyObservers(this._value))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this._width.toString(this._host)},set:function(t){this._width.toString(this._host)!==t&&this._width.fromString(t)&&(0===this._width.getValue(this._host)&&(t="1px",this._width.fromString(t)),this._height.fromString(t),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height.toString(this._host)},set:function(t){this._height.toString(this._host)!==t&&this._height.fromString(t)&&(0===this._height.getValue(this._host)&&(t="1px",this._height.fromString(t)),this._width.fromString(t),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this.width},set:function(t){this.width=t},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"ColorPicker"},e.prototype._preMeasure=function(t){t.width<t.height?this._currentMeasure.height=t.width:this._currentMeasure.width=t.height},e.prototype._updateSquareProps=function(){var t=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),e=2*(t-.2*t)/Math.sqrt(2),i=t-.5*e;this._squareLeft=this._currentMeasure.left+i,this._squareTop=this._currentMeasure.top+i,this._squareSize=e},e.prototype._drawGradientSquare=function(t,e,i,o,n,r){var a=r.createLinearGradient(e,i,o+e,i);a.addColorStop(0,"#fff"),a.addColorStop(1,"hsl("+t+", 100%, 50%)"),r.fillStyle=a,r.fillRect(e,i,o,n);var s=r.createLinearGradient(e,i,e,n+i);s.addColorStop(0,"rgba(0,0,0,0)"),s.addColorStop(1,"#000"),r.fillStyle=s,r.fillRect(e,i,o,n)},e.prototype._drawCircle=function(t,e,i,o){o.beginPath(),o.arc(t,e,i+1,0,2*Math.PI,!1),o.lineWidth=3,o.strokeStyle="#333333",o.stroke(),o.beginPath(),o.arc(t,e,i,0,2*Math.PI,!1),o.lineWidth=3,o.strokeStyle="#ffffff",o.stroke()},e.prototype._createColorWheelCanvas=function(t,e){var i=_.EngineStore.LastCreatedEngine;if(!i)throw new Error("Invalid engine. Unable to create a canvas.");for(var o=i.createCanvas(2*t,2*t),n=o.getContext("2d"),r=n.getImageData(0,0,2*t,2*t),a=r.data,s=this._tmpColor,l=t*t,h=t-e,c=h*h,u=-t;u<t;u++)for(var d=-t;d<t;d++){var f=u*u+d*d;if(!(f>l||f<c)){var p=Math.sqrt(f),g=Math.atan2(d,u);_.Color3.HSVtoRGBToRef(180*g/Math.PI+180,p/t,1,s);var b=4*(u+t+2*(d+t)*t);a[b]=255*s.r,a[b+1]=255*s.g,a[b+2]=255*s.b;var m,v;v=t<50?.2:t>150?.04:-.16*(t-50)/100+.2,m=(p-h)/(t-h),a[b+3]=m<v?m/v*255:m>1-v?255*(1-(m-(1-v))/v):255}}return n.putImageData(r,0,0),o},e.prototype._draw=function(t){t.save(),this._applyStates(t);var e=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),i=.2*e,o=this._currentMeasure.left,n=this._currentMeasure.top;this._colorWheelCanvas&&this._colorWheelCanvas.width==2*e||(this._colorWheelCanvas=this._createColorWheelCanvas(e,i)),this._updateSquareProps(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.fillRect(this._squareLeft,this._squareTop,this._squareSize,this._squareSize)),t.drawImage(this._colorWheelCanvas,o,n),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),this._drawGradientSquare(this._h,this._squareLeft,this._squareTop,this._squareSize,this._squareSize,t);var r=this._squareLeft+this._squareSize*this._s,a=this._squareTop+this._squareSize*(1-this._v);this._drawCircle(r,a,.04*e,t);var s=e-.5*i;r=o+e+Math.cos((this._h-180)*Math.PI/180)*s,a=n+e+Math.sin((this._h-180)*Math.PI/180)*s,this._drawCircle(r,a,.35*i,t),t.restore()},e.prototype._updateValueFromPointer=function(t,i){if(this._pointerStartedOnWheel){var o=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),n=o+this._currentMeasure.left,r=o+this._currentMeasure.top;this._h=180*Math.atan2(i-r,t-n)/Math.PI+180}else this._pointerStartedOnSquare&&(this._updateSquareProps(),this._s=(t-this._squareLeft)/this._squareSize,this._v=1-(i-this._squareTop)/this._squareSize,this._s=Math.min(this._s,1),this._s=Math.max(this._s,e._Epsilon),this._v=Math.min(this._v,1),this._v=Math.max(this._v,e._Epsilon));_.Color3.HSVtoRGBToRef(this._h,this._s,this._v,this._tmpColor),this.value=this._tmpColor},e.prototype._isPointOnSquare=function(t,e){this._updateSquareProps();var i=this._squareLeft,o=this._squareTop,n=this._squareSize;return t>=i&&t<=i+n&&e>=o&&e<=o+n},e.prototype._isPointOnWheel=function(t,e){var i=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),o=i-.2*i,n=t-(i+this._currentMeasure.left),r=e-(i+this._currentMeasure.top),a=n*n+r*r;return a<=i*i&&a>=o*o},e.prototype._onPointerDown=function(e,i,o,n,r){if(!t.prototype._onPointerDown.call(this,e,i,o,n,r))return!1;if(this.isReadOnly)return!0;this._pointerIsDown=!0,this._pointerStartedOnSquare=!1,this._pointerStartedOnWheel=!1,this._invertTransformMatrix.transformCoordinates(i.x,i.y,this._transformedPosition);var a=this._transformedPosition.x,s=this._transformedPosition.y;return this._isPointOnSquare(a,s)?this._pointerStartedOnSquare=!0:this._isPointOnWheel(a,s)&&(this._pointerStartedOnWheel=!0),this._updateValueFromPointer(a,s),this._host._capturingControl[o]=this,this._lastPointerDownId=o,!0},e.prototype._onPointerMove=function(e,i,o,n){if(o==this._lastPointerDownId){if(!this.isReadOnly){this._invertTransformMatrix.transformCoordinates(i.x,i.y,this._transformedPosition);var r=this._transformedPosition.x,a=this._transformedPosition.y;this._pointerIsDown&&this._updateValueFromPointer(r,a)}t.prototype._onPointerMove.call(this,e,i,o,n)}},e.prototype._onPointerUp=function(e,i,o,n,r,a){this._pointerIsDown=!1,delete this._host._capturingControl[o],t.prototype._onPointerUp.call(this,e,i,o,n,r,a)},e.prototype._onCanvasBlur=function(){this._forcePointerUp(),t.prototype._onCanvasBlur.call(this)},e.ShowPickerDialogAsync=function(t,i){return new Promise((function(o){i.pickerWidth=i.pickerWidth||"640px",i.pickerHeight=i.pickerHeight||"400px",i.headerHeight=i.headerHeight||"35px",i.lastColor=i.lastColor||"#000000",i.swatchLimit=i.swatchLimit||20,i.numSwatchesPerLine=i.numSwatchesPerLine||10;var n,r,a,s,l,h,c,u=i.swatchLimit/i.numSwatchesPerLine,d=parseFloat(i.pickerWidth)/i.numSwatchesPerLine,f=Math.floor(.25*d),p=f*(i.numSwatchesPerLine+1),g=Math.floor((parseFloat(i.pickerWidth)-p)/i.numSwatchesPerLine),b=g*u+f*(u+1),m=(parseInt(i.pickerHeight)+b+Math.floor(.25*g)).toString()+"px",y="#c0c0c0",x="#535353",B="#414141",T="515151",S=_.Color3.FromHexString("#dddddd"),O=S.r+S.g+S.b,M=["R","G","B"],E="#454545",F="#f0f0f0",D=!1,L=new w;if(L.name="Dialog Container",L.width=i.pickerWidth,i.savedColors){L.height=m;var k=parseInt(i.pickerHeight)/parseInt(m);L.addRowDefinition(k,!1),L.addRowDefinition(1-k,!1)}else L.height=i.pickerHeight,L.addRowDefinition(1,!1);if(t.addControl(L),i.savedColors){(s=new w).name="Swatch Drawer",s.verticalAlignment=v.VERTICAL_ALIGNMENT_TOP,s.background=x,s.width=i.pickerWidth;var N,A=i.savedColors.length/i.numSwatchesPerLine;N=0==A?0:A+1,s.height=(g*A+N*f).toString()+"px",s.top=Math.floor(.25*g).toString()+"px";for(var z=0;z<2*Math.ceil(i.savedColors.length/i.numSwatchesPerLine)+1;z++)z%2!=0?s.addRowDefinition(g,!0):s.addRowDefinition(f,!0);for(z=0;z<2*i.numSwatchesPerLine+1;z++)z%2!=0?s.addColumnDefinition(g,!0):s.addColumnDefinition(f,!0);L.addControl(s,1,0)}var Q=new w;Q.name="Picker Panel",Q.height=i.pickerHeight;var V=parseInt(i.headerHeight)/parseInt(i.pickerHeight),W=[V,1-V];Q.addRowDefinition(W[0],!1),Q.addRowDefinition(W[1],!1),L.addControl(Q,0,0);var H=new P;H.name="Dialogue Header Bar",H.background="#cccccc",H.thickness=0,Q.addControl(H,0,0);var G=C.CreateSimpleButton("closeButton","a");G.fontFamily="coreglyphs";var U=_.Color3.FromHexString(H.background),j=new _.Color3(1-U.r,1-U.g,1-U.b);G.color=j.toHexString(),G.fontSize=Math.floor(.6*parseInt(i.headerHeight)),G.textBlock.textVerticalAlignment=v.VERTICAL_ALIGNMENT_CENTER,G.horizontalAlignment=v.HORIZONTAL_ALIGNMENT_RIGHT,G.height=G.width=i.headerHeight,G.background=H.background,G.thickness=0,G.pointerDownAnimation=function(){},G.pointerUpAnimation=function(){G.background=H.background},G.pointerEnterAnimation=function(){G.color=H.background,G.background="red"},G.pointerOutAnimation=function(){G.color=j.toHexString(),G.background=H.background},G.onPointerClickObservable.add((function(){Qt(_t.background)})),Q.addControl(G,0,0);var Y=new w;Y.name="Dialogue Body",Y.background=x;var X=[.4375,.5625];Y.addRowDefinition(1,!1),Y.addColumnDefinition(X[0],!1),Y.addColumnDefinition(X[1],!1),Q.addControl(Y,1,0);var K=new w;K.name="Picker Grid",K.addRowDefinition(.85,!1),K.addRowDefinition(.15,!1),Y.addControl(K,0,0);var Z=new e;Z.name="GUI Color Picker",i.pickerHeight<i.pickerWidth?Z.width=.89:Z.height=.89,Z.value=_.Color3.FromHexString(i.lastColor),Z.horizontalAlignment=v.HORIZONTAL_ALIGNMENT_CENTER,Z.verticalAlignment=v.VERTICAL_ALIGNMENT_CENTER,Z.onPointerDownObservable.add((function(){c=Z.name,h="",kt(!1)})),Z.onValueChangedObservable.add((function(t){c==Z.name&&Et(t,Z.name)})),K.addControl(Z,0,0);var q=new w;q.name="Dialogue Right Half",q.horizontalAlignment=v.HORIZONTAL_ALIGNMENT_LEFT;var J=[.514,.486];q.addRowDefinition(J[0],!1),q.addRowDefinition(J[1],!1),Y.addControl(q,1,1);var $=new w;$.name="Swatches and Buttons";var tt=[.417,.583];$.addRowDefinition(1,!1),$.addColumnDefinition(tt[0],!1),$.addColumnDefinition(tt[1],!1),q.addControl($,0,0);var et=new w;et.name="New and Current Swatches";var it=[.04,.16,.64,.16];et.addRowDefinition(it[0],!1),et.addRowDefinition(it[1],!1),et.addRowDefinition(it[2],!1),et.addRowDefinition(it[3],!1),$.addControl(et,0,0);var ot=new w;ot.name="Active Swatches",ot.width=.67,ot.addRowDefinition(.5,!1),ot.addRowDefinition(.5,!1),et.addControl(ot,2,0);var nt,rt=Math.floor(parseInt(i.pickerWidth)*X[1]*tt[0]*.11),at=Math.floor(parseInt(i.pickerHeight)*W[1]*J[0]*it[1]*.5);nt=i.pickerWidth>i.pickerHeight?at:rt;var st=new I;st.text="new",st.name="New Color Label",st.color=y,st.fontSize=nt,et.addControl(st,1,0);var lt=new P;lt.name="New Color Swatch",lt.background=i.lastColor,lt.thickness=0,ot.addControl(lt,0,0);var _t=C.CreateSimpleButton("currentSwatch","");_t.background=i.lastColor,_t.thickness=0,_t.onPointerClickObservable.add((function(){Et(_.Color3.FromHexString(_t.background),_t.name),kt(!1)})),_t.pointerDownAnimation=function(){},_t.pointerUpAnimation=function(){},_t.pointerEnterAnimation=function(){},_t.pointerOutAnimation=function(){},ot.addControl(_t,1,0);var ht=new P;ht.name="Swatch Outline",ht.width=.67,ht.thickness=2,ht.color="#404040",ht.isHitTestVisible=!1,et.addControl(ht,2,0);var ct=new I;ct.name="Current Color Label",ct.text="current",ct.color=y,ct.fontSize=nt,et.addControl(ct,3,0);var ut=new w;ut.name="Button Grid",ut.height=.8;var dt=1/3;ut.addRowDefinition(dt,!1),ut.addRowDefinition(dt,!1),ut.addRowDefinition(dt,!1),$.addControl(ut,0,1);var ft=Math.floor(parseInt(i.pickerWidth)*X[1]*tt[1]*.67).toString()+"px",pt=Math.floor(parseInt(i.pickerHeight)*W[1]*J[0]*(parseFloat(ut.height.toString())/100)*dt*.7).toString()+"px";n=parseFloat(ft)>parseFloat(pt)?Math.floor(.45*parseFloat(pt)):Math.floor(.11*parseFloat(ft));var gt=C.CreateSimpleButton("butOK","OK");gt.width=ft,gt.height=pt,gt.verticalAlignment=v.VERTICAL_ALIGNMENT_CENTER,gt.thickness=2,gt.color=y,gt.fontSize=n,gt.background=x,gt.onPointerEnterObservable.add((function(){gt.background=B})),gt.onPointerOutObservable.add((function(){gt.background=x})),gt.pointerDownAnimation=function(){gt.background=T},gt.pointerUpAnimation=function(){gt.background=B},gt.onPointerClickObservable.add((function(){kt(!1),Qt(lt.background)})),ut.addControl(gt,0,0);var bt=C.CreateSimpleButton("butCancel","Cancel");bt.width=ft,bt.height=pt,bt.verticalAlignment=v.VERTICAL_ALIGNMENT_CENTER,bt.thickness=2,bt.color=y,bt.fontSize=n,bt.background=x,bt.onPointerEnterObservable.add((function(){bt.background=B})),bt.onPointerOutObservable.add((function(){bt.background=x})),bt.pointerDownAnimation=function(){bt.background=T},bt.pointerUpAnimation=function(){bt.background=B},bt.onPointerClickObservable.add((function(){kt(!1),Qt(_t.background)})),ut.addControl(bt,1,0),i.savedColors&&((l=C.CreateSimpleButton("butSave","Save")).width=ft,l.height=pt,l.verticalAlignment=v.VERTICAL_ALIGNMENT_CENTER,l.thickness=2,l.fontSize=n,i.savedColors.length<i.swatchLimit?(l.color=y,l.background=x):zt(l,!0),l.onPointerEnterObservable.add((function(){i.savedColors&&i.savedColors.length<i.swatchLimit&&(l.background=B)})),l.onPointerOutObservable.add((function(){i.savedColors&&i.savedColors.length<i.swatchLimit&&(l.background=x)})),l.pointerDownAnimation=function(){i.savedColors&&i.savedColors.length<i.swatchLimit&&(l.background=T)},l.pointerUpAnimation=function(){i.savedColors&&i.savedColors.length<i.swatchLimit&&(l.background=B)},l.onPointerClickObservable.add((function(){i.savedColors&&(0==i.savedColors.length&&At(!0),i.savedColors.length<i.swatchLimit&&Nt(lt.background,l),kt(!1))})),i.savedColors.length>0&&At(!0),ut.addControl(l,2,0));var mt=new w;mt.name="Dialog Lower Right",mt.addRowDefinition(.02,!1),mt.addRowDefinition(.63,!1),mt.addRowDefinition(.21,!1),mt.addRowDefinition(.14,!1),q.addControl(mt,1,0);var vt=_.Color3.FromHexString(i.lastColor),yt=new w;for(yt.name="RGB Values",yt.width=.82,yt.verticalAlignment=v.VERTICAL_ALIGNMENT_CENTER,yt.addRowDefinition(1/3,!1),yt.addRowDefinition(1/3,!1),yt.addRowDefinition(1/3,!1),yt.addColumnDefinition(.1,!1),yt.addColumnDefinition(.2,!1),yt.addColumnDefinition(.7,!1),mt.addControl(yt,1,0),z=0;z<M.length;z++){var xt=new I;xt.text=M[z],xt.color=y,xt.fontSize=n,yt.addControl(xt,z,0)}var Pt=new R;Pt.width=.83,Pt.height=.72,Pt.name="rIntField",Pt.fontSize=n,Pt.text=(255*vt.r).toString(),Pt.color=F,Pt.background=E,Pt.onFocusObservable.add((function(){c=Pt.name,h=Pt.text,kt(!1)})),Pt.onBlurObservable.add((function(){""==Pt.text&&(Pt.text="0"),Ft(Pt,"r"),c==Pt.name&&(c="")})),Pt.onTextChangedObservable.add((function(){c==Pt.name&&Ft(Pt,"r")})),yt.addControl(Pt,0,1);var It=new R;It.width=.83,It.height=.72,It.name="gIntField",It.fontSize=n,It.text=(255*vt.g).toString(),It.color=F,It.background=E,It.onFocusObservable.add((function(){c=It.name,h=It.text,kt(!1)})),It.onBlurObservable.add((function(){""==It.text&&(It.text="0"),Ft(It,"g"),c==It.name&&(c="")})),It.onTextChangedObservable.add((function(){c==It.name&&Ft(It,"g")})),yt.addControl(It,1,1);var Bt=new R;Bt.width=.83,Bt.height=.72,Bt.name="bIntField",Bt.fontSize=n,Bt.text=(255*vt.b).toString(),Bt.color=F,Bt.background=E,Bt.onFocusObservable.add((function(){c=Bt.name,h=Bt.text,kt(!1)})),Bt.onBlurObservable.add((function(){""==Bt.text&&(Bt.text="0"),Ft(Bt,"b"),c==Bt.name&&(c="")})),Bt.onTextChangedObservable.add((function(){c==Bt.name&&Ft(Bt,"b")})),yt.addControl(Bt,2,1);var Ct=new R;Ct.width=.95,Ct.height=.72,Ct.name="rDecField",Ct.fontSize=n,Ct.text=vt.r.toString(),Ct.color=F,Ct.background=E,Ct.onFocusObservable.add((function(){c=Ct.name,h=Ct.text,kt(!1)})),Ct.onBlurObservable.add((function(){0!=parseFloat(Ct.text)&&""!=Ct.text||(Ct.text="0",Dt(Ct,"r")),c==Ct.name&&(c="")})),Ct.onTextChangedObservable.add((function(){c==Ct.name&&Dt(Ct,"r")})),yt.addControl(Ct,0,2);var Tt=new R;Tt.width=.95,Tt.height=.72,Tt.name="gDecField",Tt.fontSize=n,Tt.text=vt.g.toString(),Tt.color=F,Tt.background=E,Tt.onFocusObservable.add((function(){c=Tt.name,h=Tt.text,kt(!1)})),Tt.onBlurObservable.add((function(){0!=parseFloat(Tt.text)&&""!=Tt.text||(Tt.text="0",Dt(Tt,"g")),c==Tt.name&&(c="")})),Tt.onTextChangedObservable.add((function(){c==Tt.name&&Dt(Tt,"g")})),yt.addControl(Tt,1,2);var St=new R;St.width=.95,St.height=.72,St.name="bDecField",St.fontSize=n,St.text=vt.b.toString(),St.color=F,St.background=E,St.onFocusObservable.add((function(){c=St.name,h=St.text,kt(!1)})),St.onBlurObservable.add((function(){0!=parseFloat(St.text)&&""!=St.text||(St.text="0",Dt(St,"b")),c==St.name&&(c="")})),St.onTextChangedObservable.add((function(){c==St.name&&Dt(St,"b")})),yt.addControl(St,2,2);var Ot=new w;Ot.name="Hex Value",Ot.width=.82,Ot.addRowDefinition(1,!1),Ot.addColumnDefinition(.1,!1),Ot.addColumnDefinition(.9,!1),mt.addControl(Ot,2,0);var Rt=new I;Rt.text="#",Rt.color=y,Rt.fontSize=n,Ot.addControl(Rt,0,0);var wt=new R;wt.width=.96,wt.height=.72,wt.name="hexField",wt.horizontalAlignment=v.HORIZONTAL_ALIGNMENT_CENTER,wt.fontSize=n;var Mt=i.lastColor.split("#");function Et(t,e){c=e;var i=t.toHexString();if(lt.background=i,Pt.name!=c&&(Pt.text=Math.floor(255*t.r).toString()),It.name!=c&&(It.text=Math.floor(255*t.g).toString()),Bt.name!=c&&(Bt.text=Math.floor(255*t.b).toString()),Ct.name!=c&&(Ct.text=t.r.toString()),Tt.name!=c&&(Tt.text=t.g.toString()),St.name!=c&&(St.text=t.b.toString()),wt.name!=c){var o=i.split("#");wt.text=o[1]}Z.name!=c&&(Z.value=t)}function Ft(t,e){var i=t.text;if(/[^0-9]/g.test(i))t.text=h;else if(""!=i&&(Math.floor(parseInt(i))<0?i="0":Math.floor(parseInt(i))>255?i="255":isNaN(parseInt(i))&&(i="0")),c==t.name&&(h=i),""!=i){i=parseInt(i).toString(),t.text=i;var o=_.Color3.FromHexString(lt.background);c==t.name&&Et("r"==e?new _.Color3(parseInt(i)/255,o.g,o.b):"g"==e?new _.Color3(o.r,parseInt(i)/255,o.b):new _.Color3(o.r,o.g,parseInt(i)/255),t.name)}}function Dt(t,e){var i=t.text;if(/[^0-9.]/g.test(i))t.text=h;else{""!=i&&"."!=i&&0!=parseFloat(i)&&(parseFloat(i)<0?i="0.0":parseFloat(i)>1?i="1.0":isNaN(parseFloat(i))&&(i="0.0")),c==t.name&&(h=i),""!=i&&"."!=i&&0!=parseFloat(i)?(i=parseFloat(i).toString(),t.text=i):i="0.0";var o=_.Color3.FromHexString(lt.background);c==t.name&&Et("r"==e?new _.Color3(parseFloat(i),o.g,o.b):"g"==e?new _.Color3(o.r,parseFloat(i),o.b):new _.Color3(o.r,o.g,parseFloat(i)),t.name)}}function Lt(){if(i.savedColors&&i.savedColors[a]){var t;t=D?"b":"";var e=C.CreateSimpleButton("Swatch_"+a,t);e.fontFamily="coreglyphs";var o=_.Color3.FromHexString(i.savedColors[a]),n=o.r+o.g+o.b;e.color=n>O?"#aaaaaa":"#ffffff",e.fontSize=Math.floor(.7*g),e.textBlock.verticalAlignment=v.VERTICAL_ALIGNMENT_CENTER,e.height=e.width=g.toString()+"px",e.background=i.savedColors[a],e.thickness=2;var r=a;return e.pointerDownAnimation=function(){e.thickness=4},e.pointerUpAnimation=function(){e.thickness=3},e.pointerEnterAnimation=function(){e.thickness=3},e.pointerOutAnimation=function(){e.thickness=2},e.onPointerClickObservable.add((function(){var t;D?(t=r,i.savedColors&&i.savedColors.splice(t,1),i.savedColors&&0==i.savedColors.length&&(At(!1),D=!1),Nt("",l)):i.savedColors&&Et(_.Color3.FromHexString(i.savedColors[r]),e.name)})),e}return null}function kt(t){if(void 0!==t&&(D=t),D){for(var e=0;e<s.children.length;e++)s.children[e].textBlock.text="b";void 0!==r&&(r.textBlock.text="Done")}else{for(e=0;e<s.children.length;e++)s.children[e].textBlock.text="";void 0!==r&&(r.textBlock.text="Edit")}}function Nt(t,e){if(i.savedColors){""!=t&&i.savedColors.push(t),a=0,s.clearControls();var o,n=Math.ceil(i.savedColors.length/i.numSwatchesPerLine);if(o=0==n?0:n+1,s.rowCount!=n+o){for(var r=s.rowCount,l=0;l<r;l++)s.removeRowDefinition(0);for(l=0;l<n+o;l++)l%2?s.addRowDefinition(g,!0):s.addRowDefinition(f,!0)}s.height=(g*n+o*f).toString()+"px";for(var _=1,h=1;_<n+o;_+=2,h++){var c;c=i.savedColors.length>h*i.numSwatchesPerLine?i.numSwatchesPerLine:i.savedColors.length-(h-1)*i.numSwatchesPerLine;for(var u=Math.min(Math.max(c,0),i.numSwatchesPerLine),d=0,p=1;d<u;d++)if(!(d>i.numSwatchesPerLine)){var b=Lt();null!=b&&(s.addControl(b,_,p),p+=2,a++)}}i.savedColors.length>=i.swatchLimit?zt(e,!0):zt(e,!1)}}function At(t){t?((r=C.CreateSimpleButton("butEdit","Edit")).width=ft,r.height=pt,r.left=Math.floor(.1*parseInt(ft)).toString()+"px",r.top=(-1*parseFloat(r.left)).toString()+"px",r.verticalAlignment=v.VERTICAL_ALIGNMENT_BOTTOM,r.horizontalAlignment=v.HORIZONTAL_ALIGNMENT_LEFT,r.thickness=2,r.color=y,r.fontSize=n,r.background=x,r.onPointerEnterObservable.add((function(){r.background=B})),r.onPointerOutObservable.add((function(){r.background=x})),r.pointerDownAnimation=function(){r.background=T},r.pointerUpAnimation=function(){r.background=B},r.onPointerClickObservable.add((function(){D=!D,kt()})),K.addControl(r,1,0)):K.removeControl(r)}function zt(t,e){e?(t.color="#555555",t.background="#454545"):(t.color=y,t.background=x)}function Qt(e){i.savedColors&&i.savedColors.length>0?o({savedColors:i.savedColors,pickedColor:e}):o({pickedColor:e}),t.removeControl(L)}wt.text=Mt[1],wt.color=F,wt.background=E,wt.onFocusObservable.add((function(){c=wt.name,h=wt.text,kt(!1)})),wt.onBlurObservable.add((function(){if(3==wt.text.length){var t=wt.text.split("");wt.text=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]}""==wt.text&&(wt.text="000000",Et(_.Color3.FromHexString(wt.text),"b")),c==wt.name&&(c="")})),wt.onTextChangedObservable.add((function(){var t=wt.text,e=/[^0-9A-F]/i.test(t);if((wt.text.length>6||e)&&c==wt.name)wt.text=h;else{if(wt.text.length<6)for(var i=6-wt.text.length,o=0;o<i;o++)t="0"+t;if(3==wt.text.length){var n=wt.text.split("");t=n[0]+n[0]+n[1]+n[1]+n[2]+n[2]}t="#"+t,c==wt.name&&(h=wt.text,Et(_.Color3.FromHexString(t),wt.name))}})),Ot.addControl(wt,0,1),i.savedColors&&i.savedColors.length>0&&Nt("",l)}))},e._Epsilon=1e-6,a([(0,_.serialize)()],e.prototype,"value",null),a([(0,_.serialize)()],e.prototype,"width",null),a([(0,_.serialize)()],e.prototype,"height",null),a([(0,_.serialize)()],e.prototype,"size",null),e}(v);(0,_.RegisterClass)("BABYLON.GUI.ColorPicker",M);var E=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._thickness=1,i}return r(e,t),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness!==t&&(this._thickness=t,this._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"Ellipse"},e.prototype._localDraw=function(t){t.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),v.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,t),(this._backgroundGradient||this._background)&&(t.fillStyle=this._getBackgroundColor(t),t.fill()),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),this._thickness&&(this.color&&(t.strokeStyle=this.color),t.lineWidth=this._thickness,t.stroke()),t.restore()},e.prototype._additionalProcessing=function(e,i){t.prototype._additionalProcessing.call(this,e,i),this._measureForChildren.width-=2*this._thickness,this._measureForChildren.height-=2*this._thickness,this._measureForChildren.left+=this._thickness,this._measureForChildren.top+=this._thickness},e.prototype._clipForChildren=function(t){v.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,this._currentMeasure.width/2,this._currentMeasure.height/2,t),t.clip()},e.prototype._renderHighlightSpecific=function(t){v.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,t),t.stroke()},a([(0,_.serialize)()],e.prototype,"thickness",null),e}(y);(0,_.RegisterClass)("BABYLON.GUI.Ellipse",E);var F=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i.focusedColor=null,i._isFocused=!1,i._unfocusedColor=null,i.onFocusObservable=new _.Observable,i.onBlurObservable=new _.Observable,i.onKeyboardEventProcessedObservable=new _.Observable,i._unfocusedColor=i.color,i}return r(e,t),e.prototype.onBlur=function(){this._isFocused&&(this._isFocused=!1,this.focusedColor&&null!=this._unfocusedColor&&(this.color=this._unfocusedColor),this.onBlurObservable.notifyObservers(this))},e.prototype.onFocus=function(){this._isFocused=!0,this.focusedColor&&(this._unfocusedColor=this.color,this.color=this.focusedColor),this.onFocusObservable.notifyObservers(this)},e.prototype.keepsFocusWith=function(){return null},e.prototype.focus=function(){this._host.moveFocusToControl(this)},e.prototype.blur=function(){this._host.focusedControl=null},e.prototype.processKeyboard=function(t){this.onKeyboardEventProcessedObservable.notifyObservers(t,-1,this)},e.prototype._onPointerDown=function(e,i,o,n,r){return this.isReadOnly||this.focus(),t.prototype._onPointerDown.call(this,e,i,o,n,r)},e.prototype.displose=function(){t.prototype.dispose.call(this),this.onBlurObservable.clear(),this.onFocusObservable.clear(),this.onKeyboardEventProcessedObservable.clear()},e}(C);(0,_.RegisterClass)("BABYLON.GUI.FocusableButton",F);var D=function(t){function e(e,i){void 0===i&&(i="");var o=t.call(this,e)||this;return o.name=e,o._textHorizontalAlignment=v.HORIZONTAL_ALIGNMENT_LEFT,o._textVerticalAlignment=v.VERTICAL_ALIGNMENT_TOP,o._lineSpacing=new h(0),o._outlineWidth=0,o._outlineColor="white",o._maxHeight=new h(1,h.UNITMODE_PERCENTAGE,!1),o.onLinesReadyObservable=new _.Observable,o.text=i,o.isPointerBlocker=!0,o.onLinesReadyObservable.add((function(){return o._updateCursorPosition()})),o._highlightCursorInfo={initialStartIndex:-1,initialRelativeStartIndex:-1,initialLineIndex:-1},o._cursorInfo={globalStartIndex:0,globalEndIndex:0,relativeEndIndex:0,relativeStartIndex:0,currentLineIndex:0},o}return r(e,t),Object.defineProperty(e.prototype,"outlineWidth",{get:function(){return this._outlineWidth},set:function(t){this._outlineWidth!==t&&(this._outlineWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"outlineColor",{get:function(){return this._outlineColor},set:function(t){this._outlineColor!==t&&(this._outlineColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"autoStretchHeight",{get:function(){return this._autoStretchHeight},set:function(t){this._autoStretchHeight!==t&&(this._autoStretchHeight=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{set:function(t){this._fixedRatioMasterIsWidth=!1,this._height.toString(this._host)!==t&&(this._height.fromString(t)&&this._markAsDirty(),this._autoStretchHeight=!1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxHeight",{get:function(){return this._maxHeight.toString(this._host)},set:function(t){this._maxHeight.toString(this._host)!==t&&this._maxHeight.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxHeightInPixels",{get:function(){return this._maxHeight.getValueInPixel(this._host,this._cachedParentMeasure.height)},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"InputTextArea"},e.prototype.processKeyboard=function(t){this.alternativeProcessKey(t.code,t.key,t),this.onKeyboardEventProcessedObservable.notifyObservers(t)},e.prototype.alternativeProcessKey=function(t,e,i){if(!i||!i.ctrlKey&&!i.metaKey||"KeyC"!==t&&"KeyV"!==t&&"KeyX"!==t){switch(t){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.globalEndIndex<this.text.length&&(this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex+1),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"Enter":return this._textWrapper.removePart(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex,"\n"),this._cursorInfo.globalStartIndex++,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._blinkIsEven=!1,this._isTextHighlightOn=!1,void this._textHasChanged();case"End":return this._cursorInfo.globalStartIndex=this.text.length,this._blinkIsEven=!1,this._isTextHighlightOn=!1,void this._markAsDirty();case"Home":return this._cursorInfo.globalStartIndex=0,this._blinkIsEven=!1,this._isTextHighlightOn=!1,void this._markAsDirty();case"ArrowLeft":return this._markAsDirty(),i&&i.shiftKey?((i.ctrlKey||i.metaKey)&&(this._cursorInfo.globalStartIndex-=this._cursorInfo.relativeStartIndex,this._cursorInfo.globalEndIndex=this._highlightCursorInfo.initialStartIndex),this._isTextHighlightOn?this._cursorInfo.globalEndIndex>this._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){var o=this._lines[this._cursorInfo.currentLineIndex].text.length-this._cursorInfo.relativeEndIndex-1;this._cursorInfo.globalEndIndex+=o,this._cursorInfo.globalStartIndex=this._highlightCursorInfo.initialStartIndex}return this._isTextHighlightOn?this._cursorInfo.globalStartIndex<this._highlightCursorInfo.initialStartIndex?this._cursorInfo.globalStartIndex++:this._cursorInfo.globalEndIndex++:(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.globalEndIndex++,this._isTextHighlightOn=!0),this._blinkIsEven=!0,void i.preventDefault()}return this._isTextHighlightOn?this._cursorInfo.globalStartIndex=this._cursorInfo.globalEndIndex:i&&(i.ctrlKey||i.metaKey)?(o=this._lines[this._cursorInfo.currentLineIndex].text.length-this._cursorInfo.relativeEndIndex,this._cursorInfo.globalStartIndex+=o):this._cursorInfo.globalStartIndex<this.text.length&&this._cursorInfo.globalStartIndex++,this._blinkIsEven=!1,void(this._isTextHighlightOn=!1);case"ArrowUp":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()),0===this._cursorInfo.currentLineIndex)this._cursorInfo.globalStartIndex=0;else{var n=this._lines[this._cursorInfo.currentLineIndex],r=this._lines[this._cursorInfo.currentLineIndex-1],a=0,s=0;!this._isTextHighlightOn||this._cursorInfo.currentLineIndex<this._highlightCursorInfo.initialLineIndex?(a=this._cursorInfo.globalStartIndex,s=this._cursorInfo.relativeStartIndex):(a=this._cursorInfo.globalEndIndex,s=this._cursorInfo.relativeEndIndex);var l=n.text.substr(0,s),_=this._contextForBreakLines.measureText(l).width,h=0,c=0;a-=s,a-=r.text.length+r.lineEnding.length;for(var u=0;h<_&&u<r.text.length;)a++,u++,c=Math.abs(_-h),h=this._contextForBreakLines.measureText(r.text.substr(0,u)).width;Math.abs(_-h)>c&&u>0&&a--,this._isTextHighlightOn?this._cursorInfo.currentLineIndex<=this._highlightCursorInfo.initialLineIndex?(this._cursorInfo.globalStartIndex=a,this._cursorInfo.globalEndIndex=this._highlightCursorInfo.initialStartIndex,this._cursorInfo.relativeEndIndex=this._highlightCursorInfo.initialRelativeStartIndex):this._cursorInfo.globalEndIndex=a:this._cursorInfo.globalStartIndex=a}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{n=this._lines[this._cursorInfo.currentLineIndex];var d=this._lines[this._cursorInfo.currentLineIndex+1];a=0,s=0,!this._isTextHighlightOn||this._cursorInfo.currentLineIndex<this._highlightCursorInfo.initialLineIndex?(a=this._cursorInfo.globalStartIndex,s=this._cursorInfo.relativeStartIndex):(a=this._cursorInfo.globalEndIndex,s=this._cursorInfo.relativeEndIndex),l=n.text.substr(0,s),_=this._contextForBreakLines.measureText(l).width;var f=0;c=0,a+=n.text.length-s+n.lineEnding.length;for(var p=0;f<_&&p<d.text.length;)a++,p++,c=Math.abs(_-f),f=this._contextForBreakLines.measureText(d.text.substr(0,p)).width;Math.abs(_-f)>c&&p>0&&a--,this._isTextHighlightOn?this._cursorInfo.currentLineIndex<this._highlightCursorInfo.initialLineIndex?(this._cursorInfo.globalStartIndex=a,this._cursorInfo.globalStartIndex>this._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=a,this._cursorInfo.globalStartIndex=this._highlightCursorInfo.initialStartIndex):this._cursorInfo.globalStartIndex=a}return void this._markAsDirty()}1===(null==e?void 0:e.length)&&(null==i||i.preventDefault(),this._currentKey=e,this.onBeforeKeyAddObservable.notifyObservers(this),e=this._currentKey,this._addKey&&(this._isTextHighlightOn=!1,this._blinkIsEven=!1,this._textWrapper.removePart(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex,e),this._cursorInfo.globalStartIndex+=e.length,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._textHasChanged()))}},e.prototype._parseLineWordWrap=function(t,e,i){void 0===t&&(t="");for(var o=[],n=t.split(" "),r=0,a=function(a){var s=a>0?t+" "+n[a]:n[0],l=i.measureText(s).width;if(l>e){a>0&&(r=i.measureText(t).width,o.push({text:t,width:r,lineEnding:" "})),t=n[a];var _="";t.split("").map((function(t){i.measureText(_+t).width>e&&(o.push({text:_,width:i.measureText(_).width,lineEnding:"\n"}),_=""),_+=t})),t=_,r=i.measureText(t).width}else r=l,t=s},s=0;s<n.length;s++)a(s);return o.push({text:t,width:r,lineEnding:" "}),o},e.prototype._breakLines=function(t,e){var i=[],o=this.text.split("\n");if(this.clipContent)for(var n=0,r=o;n<r.length;n++){var a=r[n];i.push.apply(i,this._parseLineWordWrap(a,t,e))}else for(var s=0,l=o;s<l.length;s++)a=l[s],i.push(this._parseLine(a,e));return i[i.length-1].lineEnding="\n",i},e.prototype._parseLine=function(t,e){return void 0===t&&(t=""),{text:t,width:e.measureText(t).width,lineEnding:" "}},e.prototype._preMeasure=function(t,e){this._fontOffset&&!this._wasDirty||(this._fontOffset=v._GetFontOffset(e.font));var i=this._beforeRenderText(this._textWrapper).text;this._isFocused||this.text||!this._placeholderText||(i=this._placeholderText,this._placeholderColor&&(e.fillStyle=this._placeholderColor)),this._textWidth=e.measureText(i).width;var o=2*this._margin.getValueInPixel(this._host,t.width);if(this._autoStretchWidth){var n=i.split("\n").reduce((function(t,i){return e.measureText(i).width>e.measureText(t).width?i:t}),""),r=e.measureText(n).width;this.width=Math.min(this._maxWidth.getValueInPixel(this._host,t.width),r+o)+"px",this.autoStretchWidth=!0}if(this._availableWidth=this._width.getValueInPixel(this._host,t.width)-o,this._lines=this._breakLines(this._availableWidth,e),this._contextForBreakLines=e,this._autoStretchHeight){var a=this._lines.length*this._fontOffset.height+2*this._margin.getValueInPixel(this._host,t.height);this.height=Math.min(this._maxHeight.getValueInPixel(this._host,t.height),a)+"px",this._autoStretchHeight=!0}if(this._availableHeight=this._height.getValueInPixel(this._host,t.height)-o,this._isFocused){this._cursorInfo.currentLineIndex=0;for(var s=this._lines[this._cursorInfo.currentLineIndex].text.length+this._lines[this._cursorInfo.currentLineIndex].lineEnding.length,l=0;l+s<=this._cursorInfo.globalStartIndex;)l+=s,this._cursorInfo.currentLineIndex<this._lines.length-1&&(this._cursorInfo.currentLineIndex++,s=this._lines[this._cursorInfo.currentLineIndex].text.length+this._lines[this._cursorInfo.currentLineIndex].lineEnding.length)}},e.prototype._computeScroll=function(){if(this._clipTextLeft=this._currentMeasure.left+this._margin.getValueInPixel(this._host,this._cachedParentMeasure.width),this._clipTextTop=this._currentMeasure.top+this._margin.getValueInPixel(this._host,this._cachedParentMeasure.height),this._isFocused&&this._lines[this._cursorInfo.currentLineIndex].width>this._availableWidth){var t=this._clipTextLeft-this._lines[this._cursorInfo.currentLineIndex].width+this._availableWidth;this._scrollLeft||(this._scrollLeft=t)}else this._scrollLeft=this._clipTextLeft;if(this._isFocused&&!this._autoStretchHeight){var e=(this._cursorInfo.currentLineIndex+1)*this._fontOffset.height,i=this._clipTextTop-e;this._scrollTop||(this._scrollTop=i)}else this._scrollTop=this._clipTextTop},e.prototype._additionalProcessing=function(){this.highlightedText="",this.onLinesReadyObservable.notifyObservers(this)},e.prototype._drawText=function(t,e,i,o){var n=this._currentMeasure.width,r=this._scrollLeft;switch(this._textHorizontalAlignment){case v.HORIZONTAL_ALIGNMENT_LEFT:r+=0;break;case v.HORIZONTAL_ALIGNMENT_RIGHT:r+=n-e;break;case v.HORIZONTAL_ALIGNMENT_CENTER:r+=(n-e)/2}(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(o.shadowColor=this.shadowColor,o.shadowBlur=this.shadowBlur,o.shadowOffsetX=this.shadowOffsetX,o.shadowOffsetY=this.shadowOffsetY),this.outlineWidth&&o.strokeText(t,this._currentMeasure.left+r,i),o.fillText(t,r,i)},e.prototype._onCopyText=function(t){this._isTextHighlightOn=!1;try{t.clipboardData&&t.clipboardData.setData("text/plain",this._highlightedText)}catch(t){}this._host.clipboardData=this._highlightedText},e.prototype._onCutText=function(t){if(this._highlightedText){try{t.clipboardData&&t.clipboardData.setData("text/plain",this._highlightedText)}catch(t){}this._host.clipboardData=this._highlightedText,this._textWrapper.removePart(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex),this._textHasChanged()}},e.prototype._onPasteText=function(t){var e;e=t.clipboardData&&-1!==t.clipboardData.types.indexOf("text/plain")?t.clipboardData.getData("text/plain"):this._host.clipboardData,this._isTextHighlightOn=!1,this._textWrapper.removePart(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex,e);var i=e.length-(this._cursorInfo.globalEndIndex-this._cursorInfo.globalStartIndex);this._cursorInfo.globalStartIndex+=i,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._textHasChanged()},e.prototype._draw=function(t){var e,i;this._computeScroll(),this._scrollLeft=null!==(e=this._scrollLeft)&&void 0!==e?e:0,this._scrollTop=null!==(i=this._scrollTop)&&void 0!==i?i:0,t.save(),this._applyStates(t),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),this._isFocused?this._focusedBackground&&(t.fillStyle=this._isEnabled?this._focusedBackground:this._disabledColor,t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)):this._background&&(t.fillStyle=this._isEnabled?this._background:this._disabledColor,t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),this.color&&(t.fillStyle=this.color);var o=this._currentMeasure.height,n=this._currentMeasure.width,r=0;switch(this._textVerticalAlignment){case v.VERTICAL_ALIGNMENT_TOP:r=this._fontOffset.ascent;break;case v.VERTICAL_ALIGNMENT_BOTTOM:r=o-this._fontOffset.height*(this._lines.length-1)-this._fontOffset.descent;break;case v.VERTICAL_ALIGNMENT_CENTER:r=this._fontOffset.ascent+(o-this._fontOffset.height*this._lines.length)/2}t.save(),t.beginPath(),t.fillStyle=this.fontStyle,t.rect(this._clipTextLeft,this._clipTextTop,this._availableWidth+2,this._availableHeight+2),t.clip(),r+=this._scrollTop;for(var a=0;a<this._lines.length;a++){var s=this._lines[a];0!==a&&0!==this._lineSpacing.internalValue&&(this._lineSpacing.isPixel?r+=this._lineSpacing.getValue(this._host):r+=this._lineSpacing.getValue(this._host)*this._height.getValueInPixel(this._host,this._cachedParentMeasure.height)),this._drawText(s.text,s.width,r,t),r+=this._fontOffset.height}if(t.restore(),this._isFocused){if(!this._blinkIsEven||this._isTextHighlightOn){var l=this._scrollLeft+t.measureText(this._lines[this._cursorInfo.currentLineIndex].text.substr(0,this._cursorInfo.relativeStartIndex)).width;l<this._clipTextLeft?(this._scrollLeft+=this._clipTextLeft-l,l=this._clipTextLeft,this._markAsDirty()):l>this._clipTextLeft+this._availableWidth&&(this._scrollLeft+=this._clipTextLeft+this._availableWidth-l,l=this._clipTextLeft+this._availableWidth,this._markAsDirty());var _=this._scrollTop+this._cursorInfo.currentLineIndex*this._fontOffset.height;_<this._clipTextTop?(this._scrollTop+=this._clipTextTop-_,_=this._clipTextTop,this._markAsDirty()):_+this._fontOffset.height>this._clipTextTop+this._availableHeight&&(this._scrollTop+=this._clipTextTop+this._availableHeight-_-this._fontOffset.height,_=this._clipTextTop+this._availableHeight-this._fontOffset.height,this._markAsDirty()),this._isTextHighlightOn||t.fillRect(l,_,2,this._fontOffset.height)}if(this._resetBlinking(),this._isTextHighlightOn){clearTimeout(this._blinkTimeout),this._highlightedText=this.text.substring(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex),t.globalAlpha=this._highligherOpacity,t.fillStyle=this._textHighlightColor;var h=Math.min(this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialLineIndex),c=Math.max(this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialLineIndex),u=this._scrollTop+h*this._fontOffset.height;for(a=h;a<=c;a++){s=this._lines[a];var d=this._scrollLeft;switch(this._textHorizontalAlignment){case v.HORIZONTAL_ALIGNMENT_LEFT:d+=0;break;case v.HORIZONTAL_ALIGNMENT_RIGHT:d+=n-s.width;break;case v.HORIZONTAL_ALIGNMENT_CENTER:d+=(n-s.width)/2}var f=a===h?this._cursorInfo.relativeStartIndex:0,p=a===c?this._cursorInfo.relativeEndIndex:s.text.length,g=t.measureText(s.text.substr(0,f)).width,b=s.text.substring(f,p),m=t.measureText(b).width;t.fillRect(d+g,u,m,this._fontOffset.height),u+=this._fontOffset.height}this._cursorInfo.globalEndIndex===this._cursorInfo.globalStartIndex&&this._resetBlinking()}}t.restore(),this._thickness&&(this._isFocused?this.focusedColor&&(t.strokeStyle=this.focusedColor):this.color&&(t.strokeStyle=this.color),t.lineWidth=this._thickness,t.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,this._currentMeasure.width-this._thickness,this._currentMeasure.height-this._thickness))},e.prototype._resetBlinking=function(){var t=this;clearTimeout(this._blinkTimeout),this._blinkTimeout=setTimeout((function(){t._blinkIsEven=!t._blinkIsEven,t._markAsDirty()}),500)},e.prototype._applyStates=function(e){t.prototype._applyStates.call(this,e),this.outlineWidth&&(e.lineWidth=this.outlineWidth,e.strokeStyle=this.outlineColor)},e.prototype._onPointerDown=function(e,i,o,n,r){return!(!t.prototype._onPointerDown.call(this,e,i,o,n,r)||(this._clickedCoordinateX=i.x,this._clickedCoordinateY=i.y,this._isTextHighlightOn=!1,this._highlightedText="",this._isPointerDown=!0,this._host._capturingControl[o]=this,this._host.focusedControl===this?(clearTimeout(this._blinkTimeout),this._markAsDirty(),0):!this._isEnabled||(this._host.focusedControl=this,0)))},e.prototype._onPointerMove=function(e,i,o,n){0===n.event.movementX&&0===n.event.movementY||(this._host.focusedControl===this&&this._isPointerDown&&(this._clickedCoordinateX=i.x,this._clickedCoordinateY=i.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()),t.prototype._onPointerMove.call(this,e,i,o,n))},e.prototype._updateCursorPosition=function(){var t;if(this._isFocused)if(this._clickedCoordinateX&&this._clickedCoordinateY){this._isTextHighlightOn||(this._cursorInfo={globalStartIndex:0,globalEndIndex:0,relativeStartIndex:0,relativeEndIndex:0,currentLineIndex:0});var e=0,i=0,o=this._clickedCoordinateY-this._scrollTop,n=Math.floor(o/this._fontOffset.height);this._cursorInfo.currentLineIndex=Math.min(Math.max(n,0),this._lines.length-1);for(var r=0,a=this._clickedCoordinateX-(null!==(t=this._scrollLeft)&&void 0!==t?t:0),s=0,l=0;l<this._cursorInfo.currentLineIndex;l++){var _=this._lines[l];e+=_.text.length+_.lineEnding.length}for(;r<a&&this._lines[this._cursorInfo.currentLineIndex].text.length>i;)i++,s=Math.abs(a-r),r=this._contextForBreakLines.measureText(this._lines[this._cursorInfo.currentLineIndex].text.substr(0,i)).width;Math.abs(a-r)>s&&i>0&&i--,e+=i,this._isTextHighlightOn?e<this._highlightCursorInfo.initialStartIndex?(this._cursorInfo.globalStartIndex=e,this._cursorInfo.relativeStartIndex=i,this._cursorInfo.globalEndIndex=this._highlightCursorInfo.initialStartIndex,this._cursorInfo.relativeEndIndex=this._highlightCursorInfo.initialRelativeStartIndex):(this._cursorInfo.globalStartIndex=this._highlightCursorInfo.initialStartIndex,this._cursorInfo.relativeStartIndex=this._highlightCursorInfo.initialRelativeStartIndex,this._cursorInfo.globalEndIndex=e,this._cursorInfo.relativeEndIndex=i):(this._cursorInfo.globalStartIndex=e,this._cursorInfo.relativeStartIndex=i,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._cursorInfo.relativeEndIndex=this._cursorInfo.relativeStartIndex),this._blinkIsEven=this._isTextHighlightOn,this._clickedCoordinateX=null,this._clickedCoordinateY=null}else{this._cursorInfo.relativeStartIndex=0,this._cursorInfo.currentLineIndex=0;for(var h=this._lines[this._cursorInfo.currentLineIndex].text.length+this._lines[this._cursorInfo.currentLineIndex].lineEnding.length,c=0;c+h<=this._cursorInfo.globalStartIndex;)c+=h,this._cursorInfo.currentLineIndex<this._lines.length-1&&(this._cursorInfo.currentLineIndex++,h=this._lines[this._cursorInfo.currentLineIndex].text.length+this._lines[this._cursorInfo.currentLineIndex].lineEnding.length);if(this._cursorInfo.relativeStartIndex=this._cursorInfo.globalStartIndex-c,-1!==this._highlightCursorInfo.initialStartIndex&&this._cursorInfo.globalStartIndex>=this._highlightCursorInfo.initialStartIndex){for(;c+h<=this._cursorInfo.globalEndIndex;)c+=h,this._cursorInfo.currentLineIndex<this._lines.length-1&&(this._cursorInfo.currentLineIndex++,h=this._lines[this._cursorInfo.currentLineIndex].text.length+this._lines[this._cursorInfo.currentLineIndex].lineEnding.length);this._cursorInfo.relativeEndIndex=this._cursorInfo.globalEndIndex-c}else this._isTextHighlightOn||(this._cursorInfo.relativeEndIndex=this._cursorInfo.relativeStartIndex,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex)}},e.prototype._updateValueFromCursorIndex=function(t){},e.prototype._processDblClick=function(t){var e,i;do{e=this._cursorInfo.globalStartIndex>0&&this._textWrapper.isWord(this._cursorInfo.globalStartIndex-1)?--this._cursorInfo.globalStartIndex:0,i=this._cursorInfo.globalEndIndex<this._textWrapper.length&&this._textWrapper.isWord(this._cursorInfo.globalEndIndex)?++this._cursorInfo.globalEndIndex:0}while(e||i);this._highlightCursorInfo.initialLineIndex=this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialStartIndex=this._cursorInfo.globalStartIndex,this.onTextHighlightObservable.notifyObservers(this),this._isTextHighlightOn=!0,this._blinkIsEven=!0,this._markAsDirty()},e.prototype._selectAllText=function(){this._isTextHighlightOn=!0,this._blinkIsEven=!0,this._highlightCursorInfo={initialStartIndex:0,initialRelativeStartIndex:0,initialLineIndex:0},this._cursorInfo={globalStartIndex:0,globalEndIndex:this._textWrapper.length,relativeEndIndex:this._lines[this._lines.length-1].text.length,relativeStartIndex:0,currentLineIndex:this._lines.length-1},this._markAsDirty()},e.prototype.dipose=function(){t.prototype.dispose.call(this),this.onLinesReadyObservable.clear()},a([(0,_.serialize)()],e.prototype,"autoStretchHeight",null),a([(0,_.serialize)()],e.prototype,"maxHeight",null),e}(R);(0,_.RegisterClass)("BABYLON.GUI.InputTextArea",D);var L=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype._getTypeName=function(){return"InputPassword"},e.prototype._beforeRenderText=function(t){for(var e=new O,i="",o=0;o<t.length;o++)i+="•";return e.text=i,e},e}(R);(0,_.RegisterClass)("BABYLON.GUI.InputPassword",L);var k=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._lineWidth=1,i._x1=new h(0),i._y1=new h(0),i._x2=new h(0),i._y2=new h(0),i._dash=new Array,i._automaticSize=!0,i.isHitTestVisible=!1,i._horizontalAlignment=v.HORIZONTAL_ALIGNMENT_LEFT,i._verticalAlignment=v.VERTICAL_ALIGNMENT_TOP,i}return r(e,t),Object.defineProperty(e.prototype,"dash",{get:function(){return this._dash},set:function(t){this._dash!==t&&(this._dash=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"connectedControl",{get:function(){return this._connectedControl},set:function(t){var e=this;this._connectedControl!==t&&(this._connectedControlDirtyObserver&&this._connectedControl&&(this._connectedControl.onDirtyObservable.remove(this._connectedControlDirtyObserver),this._connectedControlDirtyObserver=null),t&&(this._connectedControlDirtyObserver=t.onDirtyObservable.add((function(){return e._markAsDirty()}))),this._connectedControl=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"x1",{get:function(){return this._x1.toString(this._host)},set:function(t){this._x1.toString(this._host)!==t&&this._x1.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y1",{get:function(){return this._y1.toString(this._host)},set:function(t){this._y1.toString(this._host)!==t&&this._y1.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"x2",{get:function(){return this._x2.toString(this._host)},set:function(t){this._x2.toString(this._host)!==t&&this._x2.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y2",{get:function(){return this._y2.toString(this._host)},set:function(t){this._y2.toString(this._host)!==t&&this._y2.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lineWidth",{get:function(){return this._lineWidth},set:function(t){this._lineWidth!==t&&(this._lineWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"horizontalAlignment",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"verticalAlignment",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_effectiveX2",{get:function(){return(this._connectedControl?this._connectedControl.centerX:0)+this._x2.getValue(this._host)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_effectiveY2",{get:function(){return(this._connectedControl?this._connectedControl.centerY:0)+this._y2.getValue(this._host)},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"Line"},e.prototype._draw=function(t){t.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),this._applyStates(t),t.strokeStyle=this._getColor(t),t.lineWidth=this._lineWidth,t.setLineDash(this._dash),t.beginPath(),t.moveTo(this._cachedParentMeasure.left+this._x1.getValue(this._host),this._cachedParentMeasure.top+this._y1.getValue(this._host)),t.lineTo(this._cachedParentMeasure.left+this._effectiveX2,this._cachedParentMeasure.top+this._effectiveY2),t.stroke(),t.restore()},e.prototype._measure=function(){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},e.prototype._computeAlignment=function(t){this._currentMeasure.left=t.left+Math.min(this._x1.getValue(this._host),this._effectiveX2)-this._lineWidth/2,this._currentMeasure.top=t.top+Math.min(this._y1.getValue(this._host),this._effectiveY2)-this._lineWidth/2},e.prototype.moveToVector3=function(t,e,i){if(void 0===i&&(i=!1),this._host&&this.parent===this._host._rootContainer){var o=this._host._getGlobalViewport(),n=_.Vector3.Project(t,_.Matrix.Identity(),e.getTransformMatrix(),o);this._moveToProjectedPosition(n,i),n.z<0||n.z>1?this.notRenderable=!0:this.notRenderable=!1}else _.Tools.Error("Cannot move a control to a vector3 if the control is not at root level")},e.prototype._moveToProjectedPosition=function(t,e){void 0===e&&(e=!1);var i=t.x+this._linkOffsetX.getValue(this._host)+"px",o=t.y+this._linkOffsetY.getValue(this._host)+"px";e?(this.x2=i,this.y2=o,this._x2.ignoreAdaptiveScaling=!0,this._y2.ignoreAdaptiveScaling=!0):(this.x1=i,this.y1=o,this._x1.ignoreAdaptiveScaling=!0,this._y1.ignoreAdaptiveScaling=!0)},a([(0,_.serialize)()],e.prototype,"dash",null),a([(0,_.serialize)()],e.prototype,"x1",null),a([(0,_.serialize)()],e.prototype,"y1",null),a([(0,_.serialize)()],e.prototype,"x2",null),a([(0,_.serialize)()],e.prototype,"y2",null),a([(0,_.serialize)()],e.prototype,"lineWidth",null),e}(v);(0,_.RegisterClass)("BABYLON.GUI.Line",k);var N=function(){function t(t){this._multiLine=t,this._x=new h(0),this._y=new h(0),this._point=new _.Vector3(0,0,0)}return Object.defineProperty(t.prototype,"x",{get:function(){return this._x.toString(this._multiLine._host)},set:function(t){this._x.toString(this._multiLine._host)!==t&&this._x.fromString(t)&&this._multiLine._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this._y.toString(this._multiLine._host)},set:function(t){this._y.toString(this._multiLine._host)!==t&&this._y.fromString(t)&&this._multiLine._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"control",{get:function(){return this._control},set:function(t){this._control!==t&&(this._control&&this._controlObserver&&(this._control.onDirtyObservable.remove(this._controlObserver),this._controlObserver=null),this._control=t,this._control&&(this._controlObserver=this._control.onDirtyObservable.add(this._multiLine.onPointUpdate)),this._multiLine._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mesh",{get:function(){return this._mesh},set:function(t){this._mesh!==t&&(this._mesh&&this._meshObserver&&this._mesh.getScene().onAfterCameraRenderObservable.remove(this._meshObserver),this._mesh=t,this._mesh&&(this._meshObserver=this._mesh.getScene().onAfterCameraRenderObservable.add(this._multiLine.onPointUpdate)),this._multiLine._markAsDirty())},enumerable:!1,configurable:!0}),t.prototype.resetLinks=function(){this.control=null,this.mesh=null},t.prototype.translate=function(){return this._point=this._translatePoint(),this._point},t.prototype._translatePoint=function(){if(null!=this._mesh)return this._multiLine._host.getProjectedPositionWithZ(this._mesh.getBoundingInfo().boundingSphere.center,this._mesh.getWorldMatrix());if(null!=this._control)return new _.Vector3(this._control.centerX,this._control.centerY,1-_.Epsilon);var t=this._multiLine._host,e=this._x.getValueInPixel(t,Number(t._canvas.width)),i=this._y.getValueInPixel(t,Number(t._canvas.height));return new _.Vector3(e,i,1-_.Epsilon)},t.prototype.dispose=function(){this.resetLinks()},t}(),A=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._lineWidth=1,i.onPointUpdate=function(){i._markAsDirty()},i._automaticSize=!0,i.isHitTestVisible=!1,i._horizontalAlignment=v.HORIZONTAL_ALIGNMENT_LEFT,i._verticalAlignment=v.VERTICAL_ALIGNMENT_TOP,i._dash=[],i._points=[],i}return r(e,t),Object.defineProperty(e.prototype,"dash",{get:function(){return this._dash},set:function(t){this._dash!==t&&(this._dash=t,this._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype.getAt=function(t){return this._points[t]||(this._points[t]=new N(this)),this._points[t]},e.prototype.add=function(){for(var t=this,e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return e.map((function(e){return t.push(e)}))},e.prototype.push=function(t){var e=this.getAt(this._points.length);return null==t||(t instanceof _.AbstractMesh?e.mesh=t:t instanceof v?e.control=t:null!=t.x&&null!=t.y&&(e.x=t.x,e.y=t.y)),e},e.prototype.remove=function(t){var e;if(t instanceof N){if(-1===(e=this._points.indexOf(t)))return}else e=t;var i=this._points[e];i&&(i.dispose(),this._points.splice(e,1))},e.prototype.reset=function(){for(;this._points.length>0;)this.remove(this._points.length-1)},e.prototype.resetLinks=function(){this._points.forEach((function(t){null!=t&&t.resetLinks()}))},Object.defineProperty(e.prototype,"lineWidth",{get:function(){return this._lineWidth},set:function(t){this._lineWidth!==t&&(this._lineWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"horizontalAlignment",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"verticalAlignment",{set:function(t){},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"MultiLine"},e.prototype._draw=function(t){t.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),this._applyStates(t),t.strokeStyle=this.color,t.lineWidth=this._lineWidth,t.setLineDash(this._dash),t.beginPath();var e,i=!0;this._points.forEach((function(o){o&&(i?(t.moveTo(o._point.x,o._point.y),i=!1):o._point.z<1&&e.z<1?t.lineTo(o._point.x,o._point.y):t.moveTo(o._point.x,o._point.y),e=o._point)})),t.stroke(),t.restore()},e.prototype._additionalProcessing=function(){var t=this;this._minX=null,this._minY=null,this._maxX=null,this._maxY=null,this._points.forEach((function(e){e&&(e.translate(),(null==t._minX||e._point.x<t._minX)&&(t._minX=e._point.x),(null==t._minY||e._point.y<t._minY)&&(t._minY=e._point.y),(null==t._maxX||e._point.x>t._maxX)&&(t._maxX=e._point.x),(null==t._maxY||e._point.y>t._maxY)&&(t._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)},e.prototype._measure=function(){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)},e.prototype._computeAlignment=function(){null!=this._minX&&null!=this._minY&&(this._currentMeasure.left=this._minX-this._lineWidth/2,this._currentMeasure.top=this._minY-this._lineWidth/2)},e.prototype.dispose=function(){this.reset(),t.prototype.dispose.call(this)},a([(0,_.serialize)()],e.prototype,"dash",null),e}(v);(0,_.RegisterClass)("BABYLON.GUI.MultiLine",A);var z=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._isChecked=!1,i._background="black",i._checkSizeRatio=.8,i._thickness=1,i.group="",i.onIsCheckedChangedObservable=new _.Observable,i.isPointerBlocker=!0,i}return r(e,t),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness!==t&&(this._thickness=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"checkSizeRatio",{get:function(){return this._checkSizeRatio},set:function(t){t=Math.max(Math.min(1,t),0),this._checkSizeRatio!==t&&(this._checkSizeRatio=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isChecked",{get:function(){return this._isChecked},set:function(t){var e=this;this._isChecked!==t&&(this._isChecked=t,this._markAsDirty(),this.onIsCheckedChangedObservable.notifyObservers(t),this._isChecked&&this._host&&this._host.executeOnAllControls((function(t){if(t!==e&&void 0!==t.group){var i=t;i.group===e.group&&(i.isChecked=!1)}})))},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"RadioButton"},e.prototype._draw=function(t){t.save(),this._applyStates(t);var e=this._currentMeasure.width-this._thickness,i=this._currentMeasure.height-this._thickness;if((this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),v.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,t),t.fillStyle=this._isEnabled?this._background:this._disabledColor,t.fill(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),t.strokeStyle=this.color,t.lineWidth=this._thickness,t.stroke(),this._isChecked){t.fillStyle=this._isEnabled?this.color:this._disabledColor;var o=e*this._checkSizeRatio,n=i*this._checkSizeRatio;v.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,o/2-this._thickness/2,n/2-this._thickness/2,t),t.fill()}t.restore()},e.prototype._onPointerDown=function(e,i,o,n,r){return!!t.prototype._onPointerDown.call(this,e,i,o,n,r)&&(this.isReadOnly||this.isChecked||(this.isChecked=!0),!0)},e.AddRadioButtonWithHeader=function(t,i,o,n){var r=new T;r.isVertical=!1,r.height="30px";var a=new e;a.width="20px",a.height="20px",a.isChecked=o,a.color="green",a.group=i,a.onIsCheckedChangedObservable.add((function(t){return n(a,t)})),r.addControl(a);var s=new I;return s.text=t,s.width="180px",s.paddingLeft="5px",s.textHorizontalAlignment=v.HORIZONTAL_ALIGNMENT_LEFT,s.color="white",r.addControl(s),r},a([(0,_.serialize)()],e.prototype,"thickness",null),a([(0,_.serialize)()],e.prototype,"group",void 0),a([(0,_.serialize)()],e.prototype,"checkSizeRatio",null),a([(0,_.serialize)()],e.prototype,"background",null),a([(0,_.serialize)()],e.prototype,"isChecked",null),e}(v);(0,_.RegisterClass)("BABYLON.GUI.RadioButton",z);var Q=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._thumbWidth=new h(20,h.UNITMODE_PIXEL,!1),i._minimum=0,i._maximum=100,i._value=50,i._isVertical=!1,i._barOffset=new h(5,h.UNITMODE_PIXEL,!1),i._isThumbClamped=!1,i._displayThumb=!0,i._step=0,i._lastPointerDownId=-1,i._effectiveBarOffset=0,i.onValueChangedObservable=new _.Observable,i._pointerIsDown=!1,i.isPointerBlocker=!0,i}return r(e,t),Object.defineProperty(e.prototype,"displayThumb",{get:function(){return this._displayThumb},set:function(t){this._displayThumb!==t&&(this._displayThumb=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"step",{get:function(){return this._step},set:function(t){this._step!==t&&(this._step=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"barOffset",{get:function(){return this._barOffset.toString(this._host)},set:function(t){this._barOffset.toString(this._host)!==t&&this._barOffset.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"barOffsetInPixels",{get:function(){return this._barOffset.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thumbWidth",{get:function(){return this._thumbWidth.toString(this._host)},set:function(t){this._thumbWidth.toString(this._host)!==t&&this._thumbWidth.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thumbWidthInPixels",{get:function(){return this._thumbWidth.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"minimum",{get:function(){return this._minimum},set:function(t){this._minimum!==t&&(this._minimum=t,this._markAsDirty(),this.value=Math.max(Math.min(this.value,this._maximum),this._minimum))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maximum",{get:function(){return this._maximum},set:function(t){this._maximum!==t&&(this._maximum=t,this._markAsDirty(),this.value=Math.max(Math.min(this.value,this._maximum),this._minimum))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(t){t=Math.max(Math.min(t,this._maximum),this._minimum),this._value!==t&&(this._value=t,this._markAsDirty(),this.onValueChangedObservable.notifyObservers(this._value))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isVertical",{get:function(){return this._isVertical},set:function(t){this._isVertical!==t&&(this._isVertical=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isThumbClamped",{get:function(){return this._isThumbClamped},set:function(t){this._isThumbClamped!==t&&(this._isThumbClamped=t,this._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"BaseSlider"},e.prototype._getThumbPosition=function(){return this.isVertical?(this.maximum-this.value)/(this.maximum-this.minimum)*this._backgroundBoxLength:(this.value-this.minimum)/(this.maximum-this.minimum)*this._backgroundBoxLength},e.prototype._getThumbThickness=function(t){var e=0;switch(t){case"circle":e=this._thumbWidth.isPixel?Math.max(this._thumbWidth.getValue(this._host),this._backgroundBoxThickness):this._backgroundBoxThickness*this._thumbWidth.getValue(this._host);break;case"rectangle":e=this._thumbWidth.isPixel?Math.min(this._thumbWidth.getValue(this._host),this._backgroundBoxThickness):this._backgroundBoxThickness*this._thumbWidth.getValue(this._host)}return e},e.prototype._prepareRenderingData=function(t){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(t),this.displayThumb&&(this._backgroundBoxLength-=this._effectiveThumbThickness),this.isVertical&&this._currentMeasure.height<this._currentMeasure.width?console.error("Height should be greater than width"):(this._barOffset.isPixel?this._effectiveBarOffset=Math.min(this._barOffset.getValue(this._host),this._backgroundBoxThickness):this._effectiveBarOffset=this._backgroundBoxThickness*this._barOffset.getValue(this._host),this._backgroundBoxThickness-=2*this._effectiveBarOffset,this.isVertical?(this._renderLeft+=this._effectiveBarOffset,!this.isThumbClamped&&this.displayThumb&&(this._renderTop+=this._effectiveThumbThickness/2),this._renderHeight=this._backgroundBoxLength,this._renderWidth=this._backgroundBoxThickness):(this._renderTop+=this._effectiveBarOffset,!this.isThumbClamped&&this.displayThumb&&(this._renderLeft+=this._effectiveThumbThickness/2),this._renderHeight=this._backgroundBoxThickness,this._renderWidth=this._backgroundBoxLength))},e.prototype._updateValueFromPointer=function(t,e){var i;0!=this.rotation&&(this._invertTransformMatrix.transformCoordinates(t,e,this._transformedPosition),t=this._transformedPosition.x,e=this._transformedPosition.y),i=this._isVertical?this._minimum+(1-(e-this._currentMeasure.top)/this._currentMeasure.height)*(this._maximum-this._minimum):this._minimum+(t-this._currentMeasure.left)/this._currentMeasure.width*(this._maximum-this._minimum),this.value=this._step?Math.round(i/this._step)*this._step:i},e.prototype._onPointerDown=function(e,i,o,n,r){return!!t.prototype._onPointerDown.call(this,e,i,o,n,r)&&(this.isReadOnly||(this._pointerIsDown=!0,this._updateValueFromPointer(i.x,i.y),this._host._capturingControl[o]=this,this._lastPointerDownId=o),!0)},e.prototype._onPointerMove=function(e,i,o,n){o==this._lastPointerDownId&&(this._pointerIsDown&&!this.isReadOnly&&this._updateValueFromPointer(i.x,i.y),t.prototype._onPointerMove.call(this,e,i,o,n))},e.prototype._onPointerUp=function(e,i,o,n,r){this._pointerIsDown=!1,delete this._host._capturingControl[o],t.prototype._onPointerUp.call(this,e,i,o,n,r)},e.prototype._onCanvasBlur=function(){this._forcePointerUp(),t.prototype._onCanvasBlur.call(this)},a([(0,_.serialize)()],e.prototype,"displayThumb",null),a([(0,_.serialize)()],e.prototype,"step",null),a([(0,_.serialize)()],e.prototype,"barOffset",null),a([(0,_.serialize)()],e.prototype,"thumbWidth",null),a([(0,_.serialize)()],e.prototype,"minimum",null),a([(0,_.serialize)()],e.prototype,"maximum",null),a([(0,_.serialize)()],e.prototype,"value",null),a([(0,_.serialize)()],e.prototype,"isVertical",null),a([(0,_.serialize)()],e.prototype,"isThumbClamped",null),e}(v),V=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._background="black",i._borderColor="white",i._thumbColor="",i._isThumbCircle=!1,i._displayValueBar=!0,i._backgroundGradient=null,i}return r(e,t),Object.defineProperty(e.prototype,"displayValueBar",{get:function(){return this._displayValueBar},set:function(t){this._displayValueBar!==t&&(this._displayValueBar=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"borderColor",{get:function(){return this._borderColor},set:function(t){this._borderColor!==t&&(this._borderColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backgroundGradient",{get:function(){return this._backgroundGradient},set:function(t){this._backgroundGradient!==t&&(this._backgroundGradient=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thumbColor",{get:function(){return this._thumbColor},set:function(t){this._thumbColor!==t&&(this._thumbColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isThumbCircle",{get:function(){return this._isThumbCircle},set:function(t){this._isThumbCircle!==t&&(this._isThumbCircle=t,this._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"Slider"},e.prototype._getBackgroundColor=function(t){return this._backgroundGradient?this._backgroundGradient.getCanvasGradient(t):this._background},e.prototype._draw=function(t){t.save(),this._applyStates(t),this._prepareRenderingData(this.isThumbCircle?"circle":"rectangle");var e=this._renderLeft,i=this._renderTop,o=this._renderWidth,n=this._renderHeight,r=0;this.isThumbClamped&&this.isThumbCircle?(this.isVertical?i+=this._effectiveThumbThickness/2:e+=this._effectiveThumbThickness/2,r=this._backgroundBoxThickness/2):r=(this._effectiveThumbThickness-this._effectiveBarOffset)/2,(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY);var a=this._getThumbPosition();t.fillStyle=this._getBackgroundColor(t),this.isVertical?this.isThumbClamped?this.isThumbCircle?(t.beginPath(),t.arc(e+this._backgroundBoxThickness/2,i,r,Math.PI,2*Math.PI),t.fill(),t.fillRect(e,i,o,n)):t.fillRect(e,i,o,n+this._effectiveThumbThickness):t.fillRect(e,i,o,n):this.isThumbClamped?this.isThumbCircle?(t.beginPath(),t.arc(e+this._backgroundBoxLength,i+this._backgroundBoxThickness/2,r,0,2*Math.PI),t.fill(),t.fillRect(e,i,o,n)):t.fillRect(e,i,o+this._effectiveThumbThickness,n):t.fillRect(e,i,o,n),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),t.fillStyle=this._getColor(t),this._displayValueBar&&(this.isVertical?this.isThumbClamped?this.isThumbCircle?(t.beginPath(),t.arc(e+this._backgroundBoxThickness/2,i+this._backgroundBoxLength,r,0,2*Math.PI),t.fill(),t.fillRect(e,i+a,o,n-a)):t.fillRect(e,i+a,o,n-a+this._effectiveThumbThickness):t.fillRect(e,i+a,o,n-a):this.isThumbClamped&&this.isThumbCircle?(t.beginPath(),t.arc(e,i+this._backgroundBoxThickness/2,r,0,2*Math.PI),t.fill(),t.fillRect(e,i,a,n)):t.fillRect(e,i,a,n)),t.fillStyle=this._thumbColor||this._getColor(t),this.displayThumb&&((this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),this._isThumbCircle?(t.beginPath(),this.isVertical?t.arc(e+this._backgroundBoxThickness/2,i+a,r,0,2*Math.PI):t.arc(e+a,i+this._backgroundBoxThickness/2,r,0,2*Math.PI),t.fill(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),t.strokeStyle=this._borderColor,t.stroke()):(this.isVertical?t.fillRect(e-this._effectiveBarOffset,this._currentMeasure.top+a,this._currentMeasure.width,this._effectiveThumbThickness):t.fillRect(this._currentMeasure.left+a,this._currentMeasure.top,this._effectiveThumbThickness,this._currentMeasure.height),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),t.strokeStyle=this._borderColor,this.isVertical?t.strokeRect(e-this._effectiveBarOffset,this._currentMeasure.top+a,this._currentMeasure.width,this._effectiveThumbThickness):t.strokeRect(this._currentMeasure.left+a,this._currentMeasure.top,this._effectiveThumbThickness,this._currentMeasure.height))),t.restore()},e.prototype.serialize=function(e){t.prototype.serialize.call(this,e),this.backgroundGradient&&(e.backgroundGradient={},this.backgroundGradient.serialize(e.backgroundGradient))},e.prototype._parseFromContent=function(e,i){if(t.prototype._parseFromContent.call(this,e,i),e.backgroundGradient){var o=_.Tools.Instantiate("BABYLON.GUI."+e.backgroundGradient.className);this.backgroundGradient=new o,this.backgroundGradient.parse(e.backgroundGradient)}},a([(0,_.serialize)()],e.prototype,"displayValueBar",null),a([(0,_.serialize)()],e.prototype,"borderColor",null),a([(0,_.serialize)()],e.prototype,"background",null),a([(0,_.serialize)()],e.prototype,"thumbColor",null),a([(0,_.serialize)()],e.prototype,"isThumbCircle",null),e}(Q);(0,_.RegisterClass)("BABYLON.GUI.Slider",V);var W=function(){function t(t){this.name=t,this._groupPanel=new T,this._selectors=new Array,this._groupPanel.verticalAlignment=v.VERTICAL_ALIGNMENT_TOP,this._groupPanel.horizontalAlignment=v.HORIZONTAL_ALIGNMENT_LEFT,this._groupHeader=this._addGroupHeader(t)}return Object.defineProperty(t.prototype,"groupPanel",{get:function(){return this._groupPanel},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selectors",{get:function(){return this._selectors},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"header",{get:function(){return this._groupHeader.text},set:function(t){"label"!==this._groupHeader.text&&(this._groupHeader.text=t)},enumerable:!1,configurable:!0}),t.prototype._addGroupHeader=function(t){var e=new I("groupHead",t);return e.width=.9,e.height="30px",e.textWrapping=!0,e.color="black",e.horizontalAlignment=v.HORIZONTAL_ALIGNMENT_LEFT,e.textHorizontalAlignment=v.HORIZONTAL_ALIGNMENT_LEFT,e.left="2px",this._groupPanel.addControl(e),e},t.prototype._getSelector=function(t){if(!(t<0||t>=this._selectors.length))return this._selectors[t]},t.prototype.removeSelector=function(t){t<0||t>=this._selectors.length||(this._groupPanel.removeControl(this._selectors[t]),this._selectors.splice(t,1))},t}(),H=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.addCheckbox=function(t,e,i){void 0===e&&(e=function(t){}),void 0===i&&(i=!1),i=i||!1;var o=new S;o.width="20px",o.height="20px",o.color="#364249",o.background="#CCCCCC",o.horizontalAlignment=v.HORIZONTAL_ALIGNMENT_LEFT,o.onIsCheckedChangedObservable.add((function(t){e(t)}));var n=v.AddHeader(o,t,"200px",{isHorizontal:!0,controlFirst:!0});n.height="30px",n.horizontalAlignment=v.HORIZONTAL_ALIGNMENT_LEFT,n.left="4px",this.groupPanel.addControl(n),this.selectors.push(n),o.isChecked=i,this.groupPanel.parent&&this.groupPanel.parent.parent&&(o.color=this.groupPanel.parent.parent.buttonColor,o.background=this.groupPanel.parent.parent.buttonBackground)},e.prototype._setSelectorLabel=function(t,e){this.selectors[t].children[1].text=e},e.prototype._setSelectorLabelColor=function(t,e){this.selectors[t].children[1].color=e},e.prototype._setSelectorButtonColor=function(t,e){this.selectors[t].children[0].color=e},e.prototype._setSelectorButtonBackground=function(t,e){this.selectors[t].children[0].background=e},e}(W),G=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._selectNb=0,e}return r(e,t),e.prototype.addRadio=function(t,e,i){void 0===e&&(e=function(t){}),void 0===i&&(i=!1);var o=this._selectNb++,n=new z;n.name=t,n.width="20px",n.height="20px",n.color="#364249",n.background="#CCCCCC",n.group=this.name,n.horizontalAlignment=v.HORIZONTAL_ALIGNMENT_LEFT,n.onIsCheckedChangedObservable.add((function(t){t&&e(o)}));var r=v.AddHeader(n,t,"200px",{isHorizontal:!0,controlFirst:!0});r.height="30px",r.horizontalAlignment=v.HORIZONTAL_ALIGNMENT_LEFT,r.left="4px",this.groupPanel.addControl(r),this.selectors.push(r),n.isChecked=i,this.groupPanel.parent&&this.groupPanel.parent.parent&&(n.color=this.groupPanel.parent.parent.buttonColor,n.background=this.groupPanel.parent.parent.buttonBackground)},e.prototype._setSelectorLabel=function(t,e){this.selectors[t].children[1].text=e},e.prototype._setSelectorLabelColor=function(t,e){this.selectors[t].children[1].color=e},e.prototype._setSelectorButtonColor=function(t,e){this.selectors[t].children[0].color=e},e.prototype._setSelectorButtonBackground=function(t,e){this.selectors[t].children[0].background=e},e}(W),U=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.addSlider=function(t,e,i,o,n,r,a){void 0===e&&(e=function(t){}),void 0===i&&(i="Units"),void 0===o&&(o=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===a&&(a=function(t){return 0|t});var s=new V;s.name=i,s.value=r,s.minimum=o,s.maximum=n,s.width=.9,s.height="20px",s.color="#364249",s.background="#CCCCCC",s.borderColor="black",s.horizontalAlignment=v.HORIZONTAL_ALIGNMENT_LEFT,s.left="4px",s.paddingBottom="4px",s.onValueChangedObservable.add((function(t){s.parent.children[0].text=s.parent.children[0].name+": "+a(t)+" "+s.name,e(t)}));var l=v.AddHeader(s,t+": "+a(r)+" "+i,"30px",{isHorizontal:!1,controlFirst:!1});l.height="60px",l.horizontalAlignment=v.HORIZONTAL_ALIGNMENT_LEFT,l.left="4px",l.children[0].name=t,this.groupPanel.addControl(l),this.selectors.push(l),this.groupPanel.parent&&this.groupPanel.parent.parent&&(s.color=this.groupPanel.parent.parent.buttonColor,s.background=this.groupPanel.parent.parent.buttonBackground)},e.prototype._setSelectorLabel=function(t,e){this.selectors[t].children[0].name=e,this.selectors[t].children[0].text=e+": "+this.selectors[t].children[1].value+" "+this.selectors[t].children[1].name},e.prototype._setSelectorLabelColor=function(t,e){this.selectors[t].children[0].color=e},e.prototype._setSelectorButtonColor=function(t,e){this.selectors[t].children[1].color=e},e.prototype._setSelectorButtonBackground=function(t,e){this.selectors[t].children[1].background=e},e}(W),j=function(t){function e(e,i){void 0===i&&(i=[]);var o=t.call(this,e)||this;if(o.name=e,o.groups=i,o._buttonColor="#364249",o._buttonBackground="#CCCCCC",o._headerColor="black",o._barColor="white",o._barHeight="2px",o._spacerHeight="20px",o._bars=new Array,o._groups=i,o.thickness=2,o._panel=new T,o._panel.verticalAlignment=v.VERTICAL_ALIGNMENT_TOP,o._panel.horizontalAlignment=v.HORIZONTAL_ALIGNMENT_LEFT,o._panel.top=5,o._panel.left=5,o._panel.width=.95,i.length>0){for(var n=0;n<i.length-1;n++)o._panel.addControl(i[n].groupPanel),o._addSpacer();o._panel.addControl(i[i.length-1].groupPanel)}return o.addControl(o._panel),o}return r(e,t),e.prototype._getTypeName=function(){return"SelectionPanel"},Object.defineProperty(e.prototype,"panel",{get:function(){return this._panel},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"headerColor",{get:function(){return this._headerColor},set:function(t){this._headerColor!==t&&(this._headerColor=t,this._setHeaderColor())},enumerable:!1,configurable:!0}),e.prototype._setHeaderColor=function(){for(var t=0;t<this._groups.length;t++)this._groups[t].groupPanel.children[0].color=this._headerColor},Object.defineProperty(e.prototype,"buttonColor",{get:function(){return this._buttonColor},set:function(t){this._buttonColor!==t&&(this._buttonColor=t,this._setbuttonColor())},enumerable:!1,configurable:!0}),e.prototype._setbuttonColor=function(){for(var t=0;t<this._groups.length;t++)for(var e=0;e<this._groups[t].selectors.length;e++)this._groups[t]._setSelectorButtonColor(e,this._buttonColor)},Object.defineProperty(e.prototype,"labelColor",{get:function(){return this._labelColor},set:function(t){this._labelColor!==t&&(this._labelColor=t,this._setLabelColor())},enumerable:!1,configurable:!0}),e.prototype._setLabelColor=function(){for(var t=0;t<this._groups.length;t++)for(var e=0;e<this._groups[t].selectors.length;e++)this._groups[t]._setSelectorLabelColor(e,this._labelColor)},Object.defineProperty(e.prototype,"buttonBackground",{get:function(){return this._buttonBackground},set:function(t){this._buttonBackground!==t&&(this._buttonBackground=t,this._setButtonBackground())},enumerable:!1,configurable:!0}),e.prototype._setButtonBackground=function(){for(var t=0;t<this._groups.length;t++)for(var e=0;e<this._groups[t].selectors.length;e++)this._groups[t]._setSelectorButtonBackground(e,this._buttonBackground)},Object.defineProperty(e.prototype,"barColor",{get:function(){return this._barColor},set:function(t){this._barColor!==t&&(this._barColor=t,this._setBarColor())},enumerable:!1,configurable:!0}),e.prototype._setBarColor=function(){for(var t=0;t<this._bars.length;t++)this._bars[t].children[0].background=this._barColor},Object.defineProperty(e.prototype,"barHeight",{get:function(){return this._barHeight},set:function(t){this._barHeight!==t&&(this._barHeight=t,this._setBarHeight())},enumerable:!1,configurable:!0}),e.prototype._setBarHeight=function(){for(var t=0;t<this._bars.length;t++)this._bars[t].children[0].height=this._barHeight},Object.defineProperty(e.prototype,"spacerHeight",{get:function(){return this._spacerHeight},set:function(t){this._spacerHeight!==t&&(this._spacerHeight=t,this._setSpacerHeight())},enumerable:!1,configurable:!0}),e.prototype._setSpacerHeight=function(){for(var t=0;t<this._bars.length;t++)this._bars[t].height=this._spacerHeight},e.prototype._addSpacer=function(){var t=new y;t.width=1,t.height=this._spacerHeight,t.horizontalAlignment=v.HORIZONTAL_ALIGNMENT_LEFT;var e=new P;e.width=1,e.height=this._barHeight,e.horizontalAlignment=v.HORIZONTAL_ALIGNMENT_LEFT,e.verticalAlignment=v.VERTICAL_ALIGNMENT_CENTER,e.background=this._barColor,e.color="transparent",t.addControl(e),this._panel.addControl(t),this._bars.push(t)},e.prototype.addGroup=function(t){this._groups.length>0&&this._addSpacer(),this._panel.addControl(t.groupPanel),this._groups.push(t),t.groupPanel.children[0].color=this._headerColor;for(var e=0;e<t.selectors.length;e++)t._setSelectorButtonColor(e,this._buttonColor),t._setSelectorButtonBackground(e,this._buttonBackground)},e.prototype.removeGroup=function(t){if(!(t<0||t>=this._groups.length)){var e=this._groups[t];this._panel.removeControl(e.groupPanel),this._groups.splice(t,1),t<this._bars.length&&(this._panel.removeControl(this._bars[t]),this._bars.splice(t,1))}},e.prototype.setHeaderName=function(t,e){e<0||e>=this._groups.length||(this._groups[e].groupPanel.children[0].text=t)},e.prototype.relabel=function(t,e,i){if(!(e<0||e>=this._groups.length)){var o=this._groups[e];i<0||i>=o.selectors.length||o._setSelectorLabel(i,t)}},e.prototype.removeFromGroupSelector=function(t,e){if(!(t<0||t>=this._groups.length)){var i=this._groups[t];e<0||e>=i.selectors.length||i.removeSelector(e)}},e.prototype.addToGroupCheckbox=function(t,e,i,o){void 0===i&&(i=function(){}),void 0===o&&(o=!1),t<0||t>=this._groups.length||this._groups[t].addCheckbox(e,i,o)},e.prototype.addToGroupRadio=function(t,e,i,o){void 0===i&&(i=function(){}),void 0===o&&(o=!1),t<0||t>=this._groups.length||this._groups[t].addRadio(e,i,o)},e.prototype.addToGroupSlider=function(t,e,i,o,n,r,a,s){void 0===i&&(i=function(){}),void 0===o&&(o="Units"),void 0===n&&(n=0),void 0===r&&(r=0),void 0===a&&(a=0),void 0===s&&(s=function(t){return 0|t}),t<0||t>=this._groups.length||this._groups[t].addSlider(e,i,o,n,r,a,s)},e}(P),Y=function(t){function e(e){var i=t.call(this,e)||this;return i._freezeControls=!1,i._bucketWidth=0,i._bucketHeight=0,i._buckets={},i}return r(e,t),Object.defineProperty(e.prototype,"freezeControls",{get:function(){return this._freezeControls},set:function(t){if(this._freezeControls!==t){t||this._restoreMeasures(),this._freezeControls=!1;var e=this.host.getSize(),i=e.width,o=e.height,n=this.host.getContext(),r=new p(0,0,i,o);this.host._numLayoutCalls=0,this.host._rootContainer._layout(r,n),t&&(this._updateMeasures(),this._useBuckets()&&this._makeBuckets()),this._freezeControls=t,this.host.markAsDirty()}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bucketWidth",{get:function(){return this._bucketWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bucketHeight",{get:function(){return this._bucketHeight},enumerable:!1,configurable:!0}),e.prototype.setBucketSizes=function(t,e){this._bucketWidth=t,this._bucketHeight=e,this._useBuckets()?this._freezeControls&&this._makeBuckets():this._buckets={}},e.prototype._useBuckets=function(){return this._bucketWidth>0&&this._bucketHeight>0},e.prototype._makeBuckets=function(){this._buckets={},this._bucketLen=Math.ceil(this.widthInPixels/this._bucketWidth),this._dispatchInBuckets(this._children),this._oldLeft=null,this._oldTop=null},e.prototype._dispatchInBuckets=function(t){for(var e=0;e<t.length;++e){for(var i=t[e],o=Math.max(0,Math.floor((i._customData._origLeft-this._customData.origLeft)/this._bucketWidth)),n=Math.floor((i._customData._origLeft-this._customData.origLeft+i._currentMeasure.width-1)/this._bucketWidth),r=Math.floor((i._customData._origTop-this._customData.origTop+i._currentMeasure.height-1)/this._bucketHeight),a=Math.max(0,Math.floor((i._customData._origTop-this._customData.origTop)/this._bucketHeight));a<=r;){for(var s=o;s<=n;++s){var l=a*this._bucketLen+s,_=this._buckets[l];_||(_=[],this._buckets[l]=_),_.push(i)}a++}i instanceof y&&i._children.length>0&&this._dispatchInBuckets(i._children)}},e.prototype._updateMeasures=function(){var t=0|this.leftInPixels,e=0|this.topInPixels;this._measureForChildren.left-=t,this._measureForChildren.top-=e,this._currentMeasure.left-=t,this._currentMeasure.top-=e,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,t,e)},e.prototype._updateChildrenMeasures=function(t,e,i){for(var o=0;o<t.length;++o){var n=t[o];n._currentMeasure.left-=e,n._currentMeasure.top-=i,n._customData._origLeft=n._currentMeasure.left,n._customData._origTop=n._currentMeasure.top,n instanceof y&&n._children.length>0&&this._updateChildrenMeasures(n._children,e,i)}},e.prototype._restoreMeasures=function(){var t=0|this.leftInPixels,e=0|this.topInPixels;this._measureForChildren.left=this._customData.origLeftForChildren+t,this._measureForChildren.top=this._customData.origTopForChildren+e,this._currentMeasure.left=this._customData.origLeft+t,this._currentMeasure.top=this._customData.origTop+e},e.prototype._getTypeName=function(){return"ScrollViewerWindow"},e.prototype._additionalProcessing=function(e,i){t.prototype._additionalProcessing.call(this,e,i),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},e.prototype._layout=function(e,i){return this._freezeControls?(this.invalidateRect(),!1):t.prototype._layout.call(this,e,i)},e.prototype._scrollChildren=function(t,e,i){for(var o=0;o<t.length;++o){var n=t[o];n._currentMeasure.left=n._customData._origLeft+e,n._currentMeasure.top=n._customData._origTop+i,n._isClipped=!1,n instanceof y&&n._children.length>0&&this._scrollChildren(n._children,e,i)}},e.prototype._scrollChildrenWithBuckets=function(t,e,i,o){for(var n=Math.max(0,Math.floor(-t/this._bucketWidth)),r=Math.floor((-t+this._parentMeasure.width-1)/this._bucketWidth),a=Math.floor((-e+this._parentMeasure.height-1)/this._bucketHeight),s=Math.max(0,Math.floor(-e/this._bucketHeight));s<=a;){for(var l=n;l<=r;++l){var _=s*this._bucketLen+l,h=this._buckets[_];if(h)for(var c=0;c<h.length;++c){var u=h[c];u._currentMeasure.left=u._customData._origLeft+i,u._currentMeasure.top=u._customData._origTop+o,u._isClipped=!1}}s++}},e.prototype._draw=function(e,i){if(this._freezeControls){this._localDraw(e),this.clipChildren&&this._clipForChildren(e);var o=0|this.leftInPixels,n=0|this.topInPixels;this._useBuckets()&&null!==this._oldLeft&&null!==this._oldTop?(this._scrollChildrenWithBuckets(this._oldLeft,this._oldTop,o,n),this._scrollChildrenWithBuckets(o,n,o,n)):this._scrollChildren(this._children,o,n),this._oldLeft=o,this._oldTop=n;for(var r=0,a=this._children;r<a.length;r++){var s=a[r];s._intersectsRect(this._parentMeasure)&&s._render(e,this._parentMeasure)}}else t.prototype._draw.call(this,e,i)},e.prototype._postMeasure=function(){if(this._freezeControls)t.prototype._postMeasure.call(this);else{for(var e=this.parentClientWidth,i=this.parentClientHeight,o=0,n=this.children;o<n.length;o++){var r=n[o];r.isVisible&&!r.notRenderable&&(r.horizontalAlignment===v.HORIZONTAL_ALIGNMENT_CENTER&&r._offsetLeft(this._currentMeasure.left-r._currentMeasure.left),r.verticalAlignment===v.VERTICAL_ALIGNMENT_CENTER&&r._offsetTop(this._currentMeasure.top-r._currentMeasure.top),e=Math.max(e,r._currentMeasure.left-this._currentMeasure.left+r._currentMeasure.width+r.paddingRightInPixels),i=Math.max(i,r._currentMeasure.top-this._currentMeasure.top+r._currentMeasure.height+r.paddingBottomInPixels))}this._currentMeasure.width!==e&&(this._width.updateInPlace(e,h.UNITMODE_PIXEL),this._currentMeasure.width=e,this._rebuildLayout=!0,this._isDirty=!0),this._currentMeasure.height!==i&&(this._height.updateInPlace(i,h.UNITMODE_PIXEL),this._currentMeasure.height=i,this._rebuildLayout=!0,this._isDirty=!0),t.prototype._postMeasure.call(this)}},e}(y),X=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._background="black",i._borderColor="white",i._tempMeasure=new p(0,0,0,0),i._invertScrollDirection=!1,i._backgroundGradient=null,i}return r(e,t),Object.defineProperty(e.prototype,"borderColor",{get:function(){return this._borderColor},set:function(t){this._borderColor!==t&&(this._borderColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backgroundGradient",{get:function(){return this._backgroundGradient},set:function(t){this._backgroundGradient!==t&&(this._backgroundGradient=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"invertScrollDirection",{get:function(){return this._invertScrollDirection},set:function(t){this._invertScrollDirection=t},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"Scrollbar"},e.prototype._getThumbThickness=function(){return this._thumbWidth.isPixel?this._thumbWidth.getValue(this._host):this._backgroundBoxThickness*this._thumbWidth.getValue(this._host)},e.prototype._getBackgroundColor=function(t){return this._backgroundGradient?this._backgroundGradient.getCanvasGradient(t):this._background},e.prototype._draw=function(t){t.save(),this._applyStates(t),this._prepareRenderingData("rectangle");var e=this._renderLeft,i=this._getThumbPosition();t.fillStyle=this._getBackgroundColor(t),t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height),t.fillStyle=this._getColor(t),this.isVertical?(this._tempMeasure.left=e-this._effectiveBarOffset,this._tempMeasure.top=this._currentMeasure.top+i,this._tempMeasure.width=this._currentMeasure.width,this._tempMeasure.height=this._effectiveThumbThickness):(this._tempMeasure.left=this._currentMeasure.left+i,this._tempMeasure.top=this._currentMeasure.top,this._tempMeasure.width=this._effectiveThumbThickness,this._tempMeasure.height=this._currentMeasure.height),t.fillRect(this._tempMeasure.left,this._tempMeasure.top,this._tempMeasure.width,this._tempMeasure.height),t.restore()},e.prototype._updateValueFromPointer=function(t,e){0!=this.rotation&&(this._invertTransformMatrix.transformCoordinates(t,e,this._transformedPosition),t=this._transformedPosition.x,e=this._transformedPosition.y);var i=this._invertScrollDirection?-1:1;this._first&&(this._first=!1,this._originX=t,this._originY=e,(t<this._tempMeasure.left||t>this._tempMeasure.left+this._tempMeasure.width||e<this._tempMeasure.top||e>this._tempMeasure.top+this._tempMeasure.height)&&(this.isVertical?this.value=this.minimum+(1-(e-this._currentMeasure.top)/this._currentMeasure.height)*(this.maximum-this.minimum):this.value=this.minimum+(t-this._currentMeasure.left)/this._currentMeasure.width*(this.maximum-this.minimum)));var o;o=this.isVertical?-(e-this._originY)/(this._currentMeasure.height-this._effectiveThumbThickness):(t-this._originX)/(this._currentMeasure.width-this._effectiveThumbThickness),this.value+=i*o*(this.maximum-this.minimum),this._originX=t,this._originY=e},e.prototype._onPointerDown=function(e,i,o,n,r){return this._first=!0,t.prototype._onPointerDown.call(this,e,i,o,n,r)},e.prototype.serialize=function(e){t.prototype.serialize.call(this,e),this.backgroundGradient&&(e.backgroundGradient={},this.backgroundGradient.serialize(e.backgroundGradient))},e.prototype._parseFromContent=function(e,i){if(t.prototype._parseFromContent.call(this,e,i),e.backgroundGradient){var o=_.Tools.Instantiate("BABYLON.GUI."+e.backgroundGradient.className);this.backgroundGradient=new o,this.backgroundGradient.parse(e.backgroundGradient)}},a([(0,_.serialize)()],e.prototype,"borderColor",null),a([(0,_.serialize)()],e.prototype,"background",null),a([(0,_.serialize)()],e.prototype,"invertScrollDirection",null),e}(Q);(0,_.RegisterClass)("BABYLON.GUI.Scrollbar",X);var K=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._thumbLength=.5,i._thumbHeight=1,i._barImageHeight=1,i._tempMeasure=new p(0,0,0,0),i._invertScrollDirection=!1,i.num90RotationInVerticalMode=1,i}return r(e,t),Object.defineProperty(e.prototype,"invertScrollDirection",{get:function(){return this._invertScrollDirection},set:function(t){this._invertScrollDirection=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backgroundImage",{get:function(){return this._backgroundBaseImage},set:function(t){var e=this;this._backgroundBaseImage!==t&&(this._backgroundBaseImage=t,this.isVertical&&0!==this.num90RotationInVerticalMode?t.isLoaded?(this._backgroundImage=t._rotate90(this.num90RotationInVerticalMode,!0),this._markAsDirty()):t.onImageLoadedObservable.addOnce((function(){var i=t._rotate90(e.num90RotationInVerticalMode,!0);e._backgroundImage=i,i.isLoaded||i.onImageLoadedObservable.addOnce((function(){e._markAsDirty()})),e._markAsDirty()})):(this._backgroundImage=t,t&&!t.isLoaded&&t.onImageLoadedObservable.addOnce((function(){e._markAsDirty()})),this._markAsDirty()))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thumbImage",{get:function(){return this._thumbBaseImage},set:function(t){var e=this;this._thumbBaseImage!==t&&(this._thumbBaseImage=t,this.isVertical&&0!==this.num90RotationInVerticalMode?t.isLoaded?(this._thumbImage=t._rotate90(-this.num90RotationInVerticalMode,!0),this._markAsDirty()):t.onImageLoadedObservable.addOnce((function(){var i=t._rotate90(-e.num90RotationInVerticalMode,!0);e._thumbImage=i,i.isLoaded||i.onImageLoadedObservable.addOnce((function(){e._markAsDirty()})),e._markAsDirty()})):(this._thumbImage=t,t&&!t.isLoaded&&t.onImageLoadedObservable.addOnce((function(){e._markAsDirty()})),this._markAsDirty()))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thumbLength",{get:function(){return this._thumbLength},set:function(t){this._thumbLength!==t&&(this._thumbLength=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thumbHeight",{get:function(){return this._thumbHeight},set:function(t){this._thumbLength!==t&&(this._thumbHeight=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"barImageHeight",{get:function(){return this._barImageHeight},set:function(t){this._barImageHeight!==t&&(this._barImageHeight=t,this._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"ImageScrollBar"},e.prototype._getThumbThickness=function(){return this._thumbWidth.isPixel?this._thumbWidth.getValue(this._host):this._backgroundBoxThickness*this._thumbWidth.getValue(this._host)},e.prototype._draw=function(t){t.save(),this._applyStates(t),this._prepareRenderingData("rectangle");var e=this._getThumbPosition(),i=this._renderLeft,o=this._renderTop,n=this._renderWidth,r=this._renderHeight;this._backgroundImage&&(this._tempMeasure.copyFromFloats(i,o,n,r),this.isVertical?(this._tempMeasure.copyFromFloats(i+n*(1-this._barImageHeight)*.5,this._currentMeasure.top,n*this._barImageHeight,r),this._tempMeasure.height+=this._effectiveThumbThickness,this._backgroundImage._currentMeasure.copyFrom(this._tempMeasure)):(this._tempMeasure.copyFromFloats(this._currentMeasure.left,o+r*(1-this._barImageHeight)*.5,n,r*this._barImageHeight),this._tempMeasure.width+=this._effectiveThumbThickness,this._backgroundImage._currentMeasure.copyFrom(this._tempMeasure)),this._backgroundImage._draw(t)),this.isVertical?this._tempMeasure.copyFromFloats(i-this._effectiveBarOffset+this._currentMeasure.width*(1-this._thumbHeight)*.5,this._currentMeasure.top+e,this._currentMeasure.width*this._thumbHeight,this._effectiveThumbThickness):this._tempMeasure.copyFromFloats(this._currentMeasure.left+e,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(t)),t.restore()},e.prototype._updateValueFromPointer=function(t,e){0!=this.rotation&&(this._invertTransformMatrix.transformCoordinates(t,e,this._transformedPosition),t=this._transformedPosition.x,e=this._transformedPosition.y);var i=this._invertScrollDirection?-1:1;this._first&&(this._first=!1,this._originX=t,this._originY=e,(t<this._tempMeasure.left||t>this._tempMeasure.left+this._tempMeasure.width||e<this._tempMeasure.top||e>this._tempMeasure.top+this._tempMeasure.height)&&(this.isVertical?this.value=this.minimum+(1-(e-this._currentMeasure.top)/this._currentMeasure.height)*(this.maximum-this.minimum):this.value=this.minimum+(t-this._currentMeasure.left)/this._currentMeasure.width*(this.maximum-this.minimum)));var o;o=this.isVertical?-(e-this._originY)/(this._currentMeasure.height-this._effectiveThumbThickness):(t-this._originX)/(this._currentMeasure.width-this._effectiveThumbThickness),this.value+=i*o*(this.maximum-this.minimum),this._originX=t,this._originY=e},e.prototype._onPointerDown=function(e,i,o,n,r){return this._first=!0,t.prototype._onPointerDown.call(this,e,i,o,n,r)},a([(0,_.serialize)()],e.prototype,"num90RotationInVerticalMode",void 0),a([(0,_.serialize)()],e.prototype,"invertScrollDirection",null),e}(Q),Z=function(t){function e(e,i){var o=t.call(this,e)||this;return o._barSize=20,o._pointerIsOver=!1,o._wheelPrecision=.05,o._thumbLength=.5,o._thumbHeight=1,o._barImageHeight=1,o._horizontalBarImageHeight=1,o._verticalBarImageHeight=1,o._oldWindowContentsWidth=0,o._oldWindowContentsHeight=0,o._forceHorizontalBar=!1,o._forceVerticalBar=!1,o._useImageBar=i||!1,o.onDirtyObservable.add((function(){o._horizontalBarSpace.color=o.color,o._verticalBarSpace.color=o.color,o._dragSpace.color=o.color})),o.onPointerEnterObservable.add((function(){o._pointerIsOver=!0})),o.onPointerOutObservable.add((function(){o._pointerIsOver=!1})),o._grid=new w,o._useImageBar?(o._horizontalBar=new K,o._verticalBar=new K):(o._horizontalBar=new X,o._verticalBar=new X),o._window=new Y("scrollViewer_window"),o._window.horizontalAlignment=v.HORIZONTAL_ALIGNMENT_LEFT,o._window.verticalAlignment=v.VERTICAL_ALIGNMENT_TOP,o._grid.addColumnDefinition(1),o._grid.addColumnDefinition(0,!0),o._grid.addRowDefinition(1),o._grid.addRowDefinition(0,!0),t.prototype.addControl.call(o,o._grid),o._grid.addControl(o._window,0,0),o._verticalBarSpace=new P,o._verticalBarSpace.horizontalAlignment=v.HORIZONTAL_ALIGNMENT_LEFT,o._verticalBarSpace.verticalAlignment=v.VERTICAL_ALIGNMENT_TOP,o._verticalBarSpace.thickness=1,o._grid.addControl(o._verticalBarSpace,0,1),o._addBar(o._verticalBar,o._verticalBarSpace,!0,Math.PI),o._horizontalBarSpace=new P,o._horizontalBarSpace.horizontalAlignment=v.HORIZONTAL_ALIGNMENT_LEFT,o._horizontalBarSpace.verticalAlignment=v.VERTICAL_ALIGNMENT_TOP,o._horizontalBarSpace.thickness=1,o._grid.addControl(o._horizontalBarSpace,1,0),o._addBar(o._horizontalBar,o._horizontalBarSpace,!1,0),o._dragSpace=new P,o._dragSpace.thickness=1,o._grid.addControl(o._dragSpace,1,1),o._useImageBar||(o.barColor="grey",o.barBackground="transparent"),o}return r(e,t),Object.defineProperty(e.prototype,"horizontalBar",{get:function(){return this._horizontalBar},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"verticalBar",{get:function(){return this._verticalBar},enumerable:!1,configurable:!0}),e.prototype.addControl=function(t){return t?(this._window.addControl(t),this):this},e.prototype.removeControl=function(t){return this._window.removeControl(t),this},Object.defineProperty(e.prototype,"children",{get:function(){return this._window.children},enumerable:!1,configurable:!0}),e.prototype._flagDescendantsAsMatrixDirty=function(){for(var t=0,e=this._children;t<e.length;t++)e[t]._markMatrixAsDirty()},Object.defineProperty(e.prototype,"freezeControls",{get:function(){return this._window.freezeControls},set:function(t){this._window.freezeControls=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bucketWidth",{get:function(){return this._window.bucketWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bucketHeight",{get:function(){return this._window.bucketHeight},enumerable:!1,configurable:!0}),e.prototype.setBucketSizes=function(t,e){this._window.setBucketSizes(t,e)},Object.defineProperty(e.prototype,"forceHorizontalBar",{get:function(){return this._forceHorizontalBar},set:function(t){this._grid.setRowDefinition(1,t?this._barSize:0,!0),this._horizontalBar.isVisible=t,this._forceHorizontalBar=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"forceVerticalBar",{get:function(){return this._forceVerticalBar},set:function(t){this._grid.setColumnDefinition(1,t?this._barSize:0,!0),this._verticalBar.isVisible=t,this._forceVerticalBar=t},enumerable:!1,configurable:!0}),e.prototype.resetWindow=function(){this._window.width="100%",this._window.height="100%"},e.prototype._getTypeName=function(){return"ScrollViewer"},e.prototype._buildClientSizes=function(){var t=this.host.idealRatio;this._window.parentClientWidth=this._currentMeasure.width-(this._verticalBar.isVisible||this.forceVerticalBar?this._barSize*t:0)-2*this.thickness,this._window.parentClientHeight=this._currentMeasure.height-(this._horizontalBar.isVisible||this.forceHorizontalBar?this._barSize*t:0)-2*this.thickness,this._clientWidth=this._window.parentClientWidth,this._clientHeight=this._window.parentClientHeight},e.prototype._additionalProcessing=function(e,i){t.prototype._additionalProcessing.call(this,e,i),this._buildClientSizes()},e.prototype._postMeasure=function(){t.prototype._postMeasure.call(this),this._updateScroller(),this._setWindowPosition(!1)},Object.defineProperty(e.prototype,"wheelPrecision",{get:function(){return this._wheelPrecision},set:function(t){this._wheelPrecision!==t&&(t<0&&(t=0),t>1&&(t=1),this._wheelPrecision=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scrollBackground",{get:function(){return this._horizontalBarSpace.background},set:function(t){this._horizontalBarSpace.background!==t&&(this._horizontalBarSpace.background=t,this._verticalBarSpace.background=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"barColor",{get:function(){return this._barColor},set:function(t){this._barColor!==t&&(this._barColor=t,this._horizontalBar.color=t,this._verticalBar.color=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thumbImage",{get:function(){return this._barImage},set:function(t){if(this._barImage!==t){this._barImage=t;var e=this._horizontalBar,i=this._verticalBar;e.thumbImage=t,i.thumbImage=t}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"horizontalThumbImage",{get:function(){return this._horizontalBarImage},set:function(t){this._horizontalBarImage!==t&&(this._horizontalBarImage=t,this._horizontalBar.thumbImage=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"verticalThumbImage",{get:function(){return this._verticalBarImage},set:function(t){this._verticalBarImage!==t&&(this._verticalBarImage=t,this._verticalBar.thumbImage=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"barSize",{get:function(){return this._barSize},set:function(t){this._barSize!==t&&(this._barSize=t,this._markAsDirty(),this._horizontalBar.isVisible&&this._grid.setRowDefinition(1,this._barSize,!0),this._verticalBar.isVisible&&this._grid.setColumnDefinition(1,this._barSize,!0))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thumbLength",{get:function(){return this._thumbLength},set:function(t){if(this._thumbLength!==t){t<=0&&(t=.1),t>1&&(t=1),this._thumbLength=t;var e=this._horizontalBar,i=this._verticalBar;e.thumbLength=t,i.thumbLength=t,this._markAsDirty()}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thumbHeight",{get:function(){return this._thumbHeight},set:function(t){if(this._thumbHeight!==t){t<=0&&(t=.1),t>1&&(t=1),this._thumbHeight=t;var e=this._horizontalBar,i=this._verticalBar;e.thumbHeight=t,i.thumbHeight=t,this._markAsDirty()}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"barImageHeight",{get:function(){return this._barImageHeight},set:function(t){if(this._barImageHeight!==t){t<=0&&(t=.1),t>1&&(t=1),this._barImageHeight=t;var e=this._horizontalBar,i=this._verticalBar;e.barImageHeight=t,i.barImageHeight=t,this._markAsDirty()}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"horizontalBarImageHeight",{get:function(){return this._horizontalBarImageHeight},set:function(t){this._horizontalBarImageHeight!==t&&(t<=0&&(t=.1),t>1&&(t=1),this._horizontalBarImageHeight=t,this._horizontalBar.barImageHeight=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"verticalBarImageHeight",{get:function(){return this._verticalBarImageHeight},set:function(t){this._verticalBarImageHeight!==t&&(t<=0&&(t=.1),t>1&&(t=1),this._verticalBarImageHeight=t,this._verticalBar.barImageHeight=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"barBackground",{get:function(){return this._barBackground},set:function(t){if(this._barBackground!==t){this._barBackground=t;var e=this._horizontalBar,i=this._verticalBar;e.background=t,i.background=t,this._dragSpace.background=t}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"barImage",{get:function(){return this._barBackgroundImage},set:function(t){this._barBackgroundImage=t;var e=this._horizontalBar,i=this._verticalBar;e.backgroundImage=t,i.backgroundImage=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"horizontalBarImage",{get:function(){return this._horizontalBarBackgroundImage},set:function(t){this._horizontalBarBackgroundImage=t,this._horizontalBar.backgroundImage=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"verticalBarImage",{get:function(){return this._verticalBarBackgroundImage},set:function(t){this._verticalBarBackgroundImage=t,this._verticalBar.backgroundImage=t},enumerable:!1,configurable:!0}),e.prototype._setWindowPosition=function(t){void 0===t&&(t=!0);var e=this.host.idealRatio,i=this._window._currentMeasure.width,o=this._window._currentMeasure.height;if(t||this._oldWindowContentsWidth!==i||this._oldWindowContentsHeight!==o){this._oldWindowContentsWidth=i,this._oldWindowContentsHeight=o;var n=this._clientWidth-i,r=this._clientHeight-o,a=this._horizontalBar.value/e*n+"px",s=this._verticalBar.value/e*r+"px";a!==this._window.left&&(this._window.left=a,this.freezeControls||(this._rebuildLayout=!0)),s!==this._window.top&&(this._window.top=s,this.freezeControls||(this._rebuildLayout=!0))}},e.prototype._updateScroller=function(){var t=this._window._currentMeasure.width,e=this._window._currentMeasure.height;this._horizontalBar.isVisible&&t<=this._clientWidth&&!this.forceHorizontalBar?(this._grid.setRowDefinition(1,0,!0),this._horizontalBar.isVisible=!1,this._horizontalBar.value=0,this._rebuildLayout=!0):!this._horizontalBar.isVisible&&(t>this._clientWidth||this.forceHorizontalBar)&&(this._grid.setRowDefinition(1,this._barSize,!0),this._horizontalBar.isVisible=!0,this._rebuildLayout=!0),this._verticalBar.isVisible&&e<=this._clientHeight&&!this.forceVerticalBar?(this._grid.setColumnDefinition(1,0,!0),this._verticalBar.isVisible=!1,this._verticalBar.value=0,this._rebuildLayout=!0):!this._verticalBar.isVisible&&(e>this._clientHeight||this.forceVerticalBar)&&(this._grid.setColumnDefinition(1,this._barSize,!0),this._verticalBar.isVisible=!0,this._rebuildLayout=!0),this._buildClientSizes();var i=this.host.idealRatio;this._horizontalBar.thumbWidth=.9*this._thumbLength*(this._clientWidth/i)+"px",this._verticalBar.thumbWidth=.9*this._thumbLength*(this._clientHeight/i)+"px"},e.prototype._link=function(e){t.prototype._link.call(this,e),this._attachWheel()},e.prototype._addBar=function(t,e,i,o){var n=this;t.paddingLeft=0,t.width="100%",t.height="100%",t.barOffset=0,t.value=0,t.maximum=1,t.horizontalAlignment=v.HORIZONTAL_ALIGNMENT_CENTER,t.verticalAlignment=v.VERTICAL_ALIGNMENT_CENTER,t.isVertical=i,t.rotation=o,t.isVisible=!1,e.addControl(t),t.onValueChangedObservable.add((function(){n._setWindowPosition()}))},e.prototype._attachWheel=function(){var t=this;this._host&&!this._onWheelObserver&&(this._onWheelObserver=this.onWheelObservable.add((function(e){t._pointerIsOver&&!t.isReadOnly&&(1==t._verticalBar.isVisible&&(e.y<0&&t._verticalBar.value>0?t._verticalBar.value-=t._wheelPrecision:e.y>0&&t._verticalBar.value<t._verticalBar.maximum&&(t._verticalBar.value+=t._wheelPrecision)),1==t._horizontalBar.isVisible&&(e.x<0&&t._horizontalBar.value<t._horizontalBar.maximum?t._horizontalBar.value+=t._wheelPrecision:e.x>0&&t._horizontalBar.value>0&&(t._horizontalBar.value-=t._wheelPrecision)))})))},e.prototype._renderHighlightSpecific=function(e){this.isHighlighted&&(t.prototype._renderHighlightSpecific.call(this,e),this._grid._renderHighlightSpecific(e),e.restore())},e.prototype.dispose=function(){this.onWheelObservable.remove(this._onWheelObserver),this._onWheelObserver=null,t.prototype.dispose.call(this)},a([(0,_.serialize)()],e.prototype,"wheelPrecision",null),a([(0,_.serialize)()],e.prototype,"scrollBackground",null),a([(0,_.serialize)()],e.prototype,"barColor",null),a([(0,_.serialize)()],e.prototype,"barSize",null),a([(0,_.serialize)()],e.prototype,"barBackground",null),e}(P);(0,_.RegisterClass)("BABYLON.GUI.ScrollViewer",Z);var q=function(t){function e(e,i){var o=t.call(this,e)||this;o.name=e,o.onIsActiveChangedObservable=new _.Observable,o.delegatePickingToChildren=!1,o._isActive=!1,o.group=null!=i?i:"",o.thickness=0,o.isPointerBlocker=!0;var n=null;return o.toActiveAnimation=function(){o.thickness=1},o.toInactiveAnimation=function(){o.thickness=0},o.pointerEnterActiveAnimation=function(){n=o.alpha,o.alpha-=.1},o.pointerOutActiveAnimation=function(){null!==n&&(o.alpha=n)},o.pointerDownActiveAnimation=function(){o.scaleX-=.05,o.scaleY-=.05},o.pointerUpActiveAnimation=function(){o.scaleX+=.05,o.scaleY+=.05},o.pointerEnterInactiveAnimation=function(){n=o.alpha,o.alpha-=.1},o.pointerOutInactiveAnimation=function(){null!==n&&(o.alpha=n)},o.pointerDownInactiveAnimation=function(){o.scaleX-=.05,o.scaleY-=.05},o.pointerUpInactiveAnimation=function(){o.scaleX+=.05,o.scaleY+=.05},o}return r(e,t),Object.defineProperty(e.prototype,"group",{get:function(){return this._group},set:function(t){this._group!==t&&(this._group=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isActive",{get:function(){return this._isActive},set:function(t){var e,i,o=this;this._isActive!==t&&(this._isActive=t,this._isActive?null===(e=this.toActiveAnimation)||void 0===e||e.call(this):null===(i=this.toInactiveAnimation)||void 0===i||i.call(this),this._markAsDirty(),this.onIsActiveChangedObservable.notifyObservers(t),this._isActive&&this._host&&this._group&&this._host.executeOnAllControls((function(t){if("ToggleButton"===t.typeName){if(t===o)return;var e=t;e.group===o.group&&(e.isActive=!1)}})))},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"ToggleButton"},e.prototype._processPicking=function(e,i,o,n,r,a,s,l){if(!this._isEnabled||!this.isHitTestVisible||!this.isVisible||this.notRenderable)return!1;if(!t.prototype.contains.call(this,e,i))return!1;if(this.delegatePickingToChildren){for(var _=!1,h=this._children.length-1;h>=0;h--){var c=this._children[h];if(c.isEnabled&&c.isHitTestVisible&&c.isVisible&&!c.notRenderable&&c.contains(e,i)){_=!0;break}}if(!_)return!1}return this._processObservables(n,e,i,o,r,a,s,l),!0},e.prototype._onPointerEnter=function(e,i){return!!t.prototype._onPointerEnter.call(this,e,i)&&(this.isReadOnly||(this._isActive?this.pointerEnterActiveAnimation&&this.pointerEnterActiveAnimation():this.pointerEnterInactiveAnimation&&this.pointerEnterInactiveAnimation()),!0)},e.prototype._onPointerOut=function(e,i,o){void 0===o&&(o=!1),this.isReadOnly||(this._isActive?this.pointerOutActiveAnimation&&this.pointerOutActiveAnimation():this.pointerOutInactiveAnimation&&this.pointerOutInactiveAnimation()),t.prototype._onPointerOut.call(this,e,i,o)},e.prototype._onPointerDown=function(e,i,o,n,r){return!!t.prototype._onPointerDown.call(this,e,i,o,n,r)&&(this.isReadOnly||(this._isActive?this.pointerDownActiveAnimation&&this.pointerDownActiveAnimation():this.pointerDownInactiveAnimation&&this.pointerDownInactiveAnimation()),!0)},e.prototype._onPointerUp=function(e,i,o,n,r,a){this.isReadOnly||(this._isActive?this.pointerUpActiveAnimation&&this.pointerUpActiveAnimation():this.pointerUpInactiveAnimation&&this.pointerUpInactiveAnimation()),t.prototype._onPointerUp.call(this,e,i,o,n,r,a)},e}(P);(0,_.RegisterClass)("BABYLON.GUI.ToggleButton",q);var J=function(){},$=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.onKeyPressObservable=new _.Observable,e.defaultButtonWidth="40px",e.defaultButtonHeight="40px",e.defaultButtonPaddingLeft="2px",e.defaultButtonPaddingRight="2px",e.defaultButtonPaddingTop="2px",e.defaultButtonPaddingBottom="2px",e.defaultButtonColor="#DDD",e.defaultButtonBackground="#070707",e.shiftButtonColor="#7799FF",e.selectedShiftThickness=1,e.shiftState=0,e._currentlyConnectedInputText=null,e._connectedInputTexts=[],e._onKeyPressObserver=null,e}return r(e,t),e.prototype._getTypeName=function(){return"VirtualKeyboard"},e.prototype._createKey=function(t,e){var i=this,o=C.CreateSimpleButton(t,t);return o.width=e&&e.width?e.width:this.defaultButtonWidth,o.height=e&&e.height?e.height:this.defaultButtonHeight,o.color=e&&e.color?e.color:this.defaultButtonColor,o.background=e&&e.background?e.background:this.defaultButtonBackground,o.paddingLeft=e&&e.paddingLeft?e.paddingLeft:this.defaultButtonPaddingLeft,o.paddingRight=e&&e.paddingRight?e.paddingRight:this.defaultButtonPaddingRight,o.paddingTop=e&&e.paddingTop?e.paddingTop:this.defaultButtonPaddingTop,o.paddingBottom=e&&e.paddingBottom?e.paddingBottom:this.defaultButtonPaddingBottom,o.thickness=0,o.isFocusInvisible=!0,o.shadowColor=this.shadowColor,o.shadowBlur=this.shadowBlur,o.shadowOffsetX=this.shadowOffsetX,o.shadowOffsetY=this.shadowOffsetY,o.onPointerUpObservable.add((function(){i.onKeyPressObservable.notifyObservers(t)})),o},e.prototype.addKeysRow=function(t,e){var i=new T;i.isVertical=!1,i.isFocusInvisible=!0;for(var o=null,n=0;n<t.length;n++){var r=null;e&&e.length===t.length&&(r=e[n]);var a=this._createKey(t[n],r);(!o||a.heightInPixels>o.heightInPixels)&&(o=a),i.addControl(a)}i.height=o?o.height:this.defaultButtonHeight,this.addControl(i)},e.prototype.applyShiftState=function(t){if(this.children)for(var e=0;e<this.children.length;e++){var i=this.children[e];if(i&&i.children)for(var o=i,n=0;n<o.children.length;n++){var r=o.children[n];if(r&&r.children[0]){var a=r.children[0];"⇧"===a.text&&(r.color=t?this.shiftButtonColor:this.defaultButtonColor,r.thickness=t>1?this.selectedShiftThickness:0),a.text=t>0?a.text.toUpperCase():a.text.toLowerCase()}}}},Object.defineProperty(e.prototype,"connectedInputText",{get:function(){return this._currentlyConnectedInputText},enumerable:!1,configurable:!0}),e.prototype.connect=function(t){var e=this;if(!this._connectedInputTexts.some((function(e){return e.input===t}))){null===this._onKeyPressObserver&&(this._onKeyPressObserver=this.onKeyPressObservable.add((function(t){if(e._currentlyConnectedInputText){switch(e._currentlyConnectedInputText._host.focusedControl=e._currentlyConnectedInputText,t){case"⇧":return e.shiftState++,e.shiftState>2&&(e.shiftState=0),void e.applyShiftState(e.shiftState);case"←":return void(e._currentlyConnectedInputText instanceof D?e._currentlyConnectedInputText.alternativeProcessKey("Backspace"):e._currentlyConnectedInputText.processKey(8));case"↵":return void(e._currentlyConnectedInputText instanceof D?e._currentlyConnectedInputText.alternativeProcessKey("Enter"):e._currentlyConnectedInputText.processKey(13))}e._currentlyConnectedInputText instanceof D?e._currentlyConnectedInputText.alternativeProcessKey("",e.shiftState?t.toUpperCase():t):e._currentlyConnectedInputText.processKey(-1,e.shiftState?t.toUpperCase():t),1===e.shiftState&&(e.shiftState=0,e.applyShiftState(e.shiftState))}}))),this.isVisible=!1,this._currentlyConnectedInputText=t,t._connectedVirtualKeyboard=this;var i=t.onFocusObservable.add((function(){e._currentlyConnectedInputText=t,t._connectedVirtualKeyboard=e,e.isVisible=!0})),o=t.onBlurObservable.add((function(){t._connectedVirtualKeyboard=null,e._currentlyConnectedInputText=null,e.isVisible=!1}));this._connectedInputTexts.push({input:t,onBlurObserver:o,onFocusObserver:i})}},e.prototype.disconnect=function(t){var e=this;if(t){var i=this._connectedInputTexts.filter((function(e){return e.input===t}));1===i.length&&(this._removeConnectedInputObservables(i[0]),this._connectedInputTexts=this._connectedInputTexts.filter((function(e){return e.input!==t})),this._currentlyConnectedInputText===t&&(this._currentlyConnectedInputText=null))}else this._connectedInputTexts.forEach((function(t){e._removeConnectedInputObservables(t)})),this._connectedInputTexts.length=0;0===this._connectedInputTexts.length&&(this._currentlyConnectedInputText=null,this.onKeyPressObservable.remove(this._onKeyPressObserver),this._onKeyPressObserver=null)},e.prototype._removeConnectedInputObservables=function(t){t.input._connectedVirtualKeyboard=null,t.input.onFocusObservable.remove(t.onFocusObserver),t.input.onBlurObservable.remove(t.onBlurObserver)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.disconnect()},e.CreateDefaultLayout=function(t){var i=new e(t);return i.addKeysRow(["1","2","3","4","5","6","7","8","9","0","←"]),i.addKeysRow(["q","w","e","r","t","y","u","i","o","p"]),i.addKeysRow(["a","s","d","f","g","h","j","k","l",";","'","↵"]),i.addKeysRow(["⇧","z","x","c","v","b","n","m",",",".","/"]),i.addKeysRow([" "],[{width:"200px"}]),i},e.prototype._parseFromContent=function(e,i){var o=this;t.prototype._parseFromContent.call(this,e,i);for(var n=0,r=this.children;n<r.length;n++){var a=r[n];if("StackPanel"===a.getClassName())for(var s=function(t){"Button"===t.getClassName()&&t.name&&t.onPointerUpObservable.add((function(){o.onKeyPressObservable.notifyObservers(t.name)}))},l=0,_=a.children;l<_.length;l++)s(_[l])}},e}(T);(0,_.RegisterClass)("BABYLON.GUI.VirtualKeyboard",$);var tt=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._cellWidth=20,i._cellHeight=20,i._minorLineTickness=1,i._minorLineColor="DarkGray",i._majorLineTickness=2,i._majorLineColor="White",i._majorLineFrequency=5,i._background="Black",i._displayMajorLines=!0,i._displayMinorLines=!0,i}return r(e,t),Object.defineProperty(e.prototype,"displayMinorLines",{get:function(){return this._displayMinorLines},set:function(t){this._displayMinorLines!==t&&(this._displayMinorLines=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"displayMajorLines",{get:function(){return this._displayMajorLines},set:function(t){this._displayMajorLines!==t&&(this._displayMajorLines=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cellWidth",{get:function(){return this._cellWidth},set:function(t){this._cellWidth=t,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cellHeight",{get:function(){return this._cellHeight},set:function(t){this._cellHeight=t,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"minorLineTickness",{get:function(){return this._minorLineTickness},set:function(t){this._minorLineTickness=t,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"minorLineColor",{get:function(){return this._minorLineColor},set:function(t){this._minorLineColor=t,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"majorLineTickness",{get:function(){return this._majorLineTickness},set:function(t){this._majorLineTickness=t,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"majorLineColor",{get:function(){return this._majorLineColor},set:function(t){this._majorLineColor=t,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"majorLineFrequency",{get:function(){return this._majorLineFrequency},set:function(t){this._majorLineFrequency=t,this._markAsDirty()},enumerable:!1,configurable:!0}),e.prototype._draw=function(t){if(t.save(),this._applyStates(t),this._isEnabled){this._background&&(t.fillStyle=this._background,t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height));var e=this._currentMeasure.width/this._cellWidth,i=this._currentMeasure.height/this._cellHeight,o=this._currentMeasure.left+this._currentMeasure.width/2,n=this._currentMeasure.top+this._currentMeasure.height/2;if(this._displayMinorLines){t.strokeStyle=this._minorLineColor,t.lineWidth=this._minorLineTickness;for(var r=-e/2+1;r<e/2;r++){var a=o+r*this.cellWidth;t.beginPath(),t.moveTo(a,this._currentMeasure.top),t.lineTo(a,this._currentMeasure.top+this._currentMeasure.height),t.stroke()}for(var s=-i/2+1;s<i/2;s++){var l=n+s*this.cellHeight;t.beginPath(),t.moveTo(this._currentMeasure.left,l),t.lineTo(this._currentMeasure.left+this._currentMeasure.width,l),t.stroke()}}if(this._displayMajorLines){for(t.strokeStyle=this._majorLineColor,t.lineWidth=this._majorLineTickness,r=-e/2+this._majorLineFrequency;r<e/2;r+=this._majorLineFrequency)a=o+r*this.cellWidth,t.beginPath(),t.moveTo(a,this._currentMeasure.top),t.lineTo(a,this._currentMeasure.top+this._currentMeasure.height),t.stroke();for(s=-i/2+this._majorLineFrequency;s<i/2;s+=this._majorLineFrequency)l=n+s*this.cellHeight,t.moveTo(this._currentMeasure.left,l),t.lineTo(this._currentMeasure.left+this._currentMeasure.width,l),t.closePath(),t.stroke()}}t.restore()},e.prototype._getTypeName=function(){return"DisplayGrid"},a([(0,_.serialize)()],e.prototype,"displayMinorLines",null),a([(0,_.serialize)()],e.prototype,"displayMajorLines",null),a([(0,_.serialize)()],e.prototype,"background",null),a([(0,_.serialize)()],e.prototype,"cellWidth",null),a([(0,_.serialize)()],e.prototype,"cellHeight",null),a([(0,_.serialize)()],e.prototype,"minorLineTickness",null),a([(0,_.serialize)()],e.prototype,"minorLineColor",null),a([(0,_.serialize)()],e.prototype,"majorLineTickness",null),a([(0,_.serialize)()],e.prototype,"majorLineColor",null),a([(0,_.serialize)()],e.prototype,"majorLineFrequency",null),e}(v);(0,_.RegisterClass)("BABYLON.GUI.DisplayGrid",tt);var et=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._tempMeasure=new p(0,0,0,0),i}return r(e,t),Object.defineProperty(e.prototype,"displayThumb",{get:function(){return this._displayThumb&&null!=this.thumbImage},set:function(t){this._displayThumb!==t&&(this._displayThumb=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backgroundImage",{get:function(){return this._backgroundImage},set:function(t){var e=this;this._backgroundImage!==t&&(this._backgroundImage=t,t&&!t.isLoaded&&t.onImageLoadedObservable.addOnce((function(){return e._markAsDirty()})),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"valueBarImage",{get:function(){return this._valueBarImage},set:function(t){var e=this;this._valueBarImage!==t&&(this._valueBarImage=t,t&&!t.isLoaded&&t.onImageLoadedObservable.addOnce((function(){return e._markAsDirty()})),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thumbImage",{get:function(){return this._thumbImage},set:function(t){var e=this;this._thumbImage!==t&&(this._thumbImage=t,t&&!t.isLoaded&&t.onImageLoadedObservable.addOnce((function(){return e._markAsDirty()})),this._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"ImageBasedSlider"},e.prototype._draw=function(t){t.save(),this._applyStates(t),this._prepareRenderingData("rectangle");var e=this._getThumbPosition(),i=this._renderLeft,o=this._renderTop,n=this._renderWidth,r=this._renderHeight;this._backgroundImage&&(this._tempMeasure.copyFromFloats(i,o,n,r),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(t)),this._valueBarImage&&(this.isVertical?this.isThumbClamped&&this.displayThumb?this._tempMeasure.copyFromFloats(i,o+e,n,r-e+this._effectiveThumbThickness):this._tempMeasure.copyFromFloats(i,o+e,n,r-e):this.isThumbClamped&&this.displayThumb?this._tempMeasure.copyFromFloats(i,o,e+this._effectiveThumbThickness/2,r):this._tempMeasure.copyFromFloats(i,o,e,r),this._valueBarImage._currentMeasure.copyFrom(this._tempMeasure),this._valueBarImage._draw(t)),this.displayThumb&&(this.isVertical?this._tempMeasure.copyFromFloats(i-this._effectiveBarOffset,this._currentMeasure.top+e,this._currentMeasure.width,this._effectiveThumbThickness):this._tempMeasure.copyFromFloats(this._currentMeasure.left+e,this._currentMeasure.top,this._effectiveThumbThickness,this._currentMeasure.height),this._thumbImage._currentMeasure.copyFrom(this._tempMeasure),this._thumbImage._draw(t)),t.restore()},e.prototype.serialize=function(e){t.prototype.serialize.call(this,e);var i={},o={},n={};this.backgroundImage.serialize(i),this.thumbImage.serialize(o),this.valueBarImage.serialize(n),e.backgroundImage=i,e.thumbImage=o,e.valueBarImage=n},e.prototype._parseFromContent=function(e,i){t.prototype._parseFromContent.call(this,e,i),this.backgroundImage=B.Parse(e.backgroundImage,i),this.thumbImage=B.Parse(e.thumbImage,i),this.valueBarImage=B.Parse(e.valueBarImage,i)},a([(0,_.serialize)()],e.prototype,"displayThumb",null),e}(Q);(0,_.RegisterClass)("BABYLON.GUI.ImageBasedSlider",et);var it="Statics";v.AddHeader=function(t,e,i,o){var n=new T("panel"),r=!o||o.isHorizontal,a=!o||o.controlFirst;n.isVertical=!r;var s=new I("header");return s.text=e,s.textHorizontalAlignment=v.HORIZONTAL_ALIGNMENT_LEFT,r?s.width=i:s.height=i,a?(n.addControl(t),n.addControl(s),s.paddingLeft="5px"):(n.addControl(s),n.addControl(t),s.paddingRight="5px"),s.shadowBlur=t.shadowBlur,s.shadowColor=t.shadowColor,s.shadowOffsetX=t.shadowOffsetX,s.shadowOffsetY=t.shadowOffsetY,n};var ot=function(){function t(){this._colorStops=[],this._gradientDirty=!0}return t.prototype._addColorStopsToCanvasGradient=function(){for(var t=0,e=this._colorStops;t<e.length;t++){var i=e[t];this._canvasGradient.addColorStop(i.offset,i.color)}},t.prototype.getCanvasGradient=function(t){return(this._gradientDirty||this._context!==t)&&(this._context=t,this._canvasGradient=this._createCanvasGradient(t),this._addColorStopsToCanvasGradient(),this._gradientDirty=!1),this._canvasGradient},t.prototype.addColorStop=function(t,e){this._colorStops.push({offset:t,color:e}),this._gradientDirty=!0},t.prototype.removeColorStop=function(t){this._colorStops=this._colorStops.filter((function(e){return e.offset!==t})),this._gradientDirty=!0},t.prototype.clearColorStops=function(){this._colorStops=[],this._gradientDirty=!0},Object.defineProperty(t.prototype,"colorStops",{get:function(){return this._colorStops},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"BaseGradient"},t.prototype.serialize=function(t){t.colorStops=this._colorStops,t.className=this.getClassName()},t.prototype.parse=function(t){this._colorStops=t.colorStops},t}(),nt=function(t){function e(e,i,o,n){var r=t.call(this)||this;return r._x0=null!=e?e:0,r._y0=null!=i?i:0,r._x1=null!=o?o:0,r._y1=null!=n?n:0,r}return r(e,t),e.prototype._createCanvasGradient=function(t){return t.createLinearGradient(this._x0,this._y0,this._x1,this._y1)},Object.defineProperty(e.prototype,"x0",{get:function(){return this._x0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"x1",{get:function(){return this._x1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y0",{get:function(){return this._y0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y1",{get:function(){return this._y1},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return"LinearGradient"},e.prototype.serialize=function(e){t.prototype.serialize.call(this,e),e.x0=this._x0,e.y0=this._y0,e.x1=this._x1,e.y1=this._y1},e.prototype.parse=function(e){t.prototype.parse.call(this,e),this._x0=e.x0,this._y0=e.y0,this._x1=e.x1,this._y1=e.y1},e}(ot);(0,_.RegisterClass)("BABYLON.GUI.LinearGradient",nt);var rt=function(t){function e(e,i,o,n,r,a){var s=t.call(this)||this;return s._x0=null!=e?e:0,s._y0=null!=i?i:0,s._r0=null!=o?o:0,s._x1=null!=n?n:0,s._y1=null!=r?r:0,s._r1=null!=a?a:0,s}return r(e,t),e.prototype._createCanvasGradient=function(t){return t.createRadialGradient(this._x0,this._y0,this._r0,this._x1,this._y1,this._r1)},Object.defineProperty(e.prototype,"x0",{get:function(){return this._x0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"x1",{get:function(){return this._x1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y0",{get:function(){return this._y0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y1",{get:function(){return this._y1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"r0",{get:function(){return this._r0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"r1",{get:function(){return this._r1},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return"RadialGradient"},e.prototype.serialize=function(e){t.prototype.serialize.call(this,e),e.x0=this._x0,e.y0=this._y0,e.r0=this._r0,e.x1=this._x1,e.y1=this._y1,e.r1=this._r1},e.prototype.parse=function(e){t.prototype.parse.call(this,e),this._x0=e.x0,this._y0=e.y0,this._r0=e.r0,this._x1=e.x1,this._y1=e.y1,this._r1=e.r1},e}(ot);(0,_.RegisterClass)("BABYLON.GUI.RadialGradient",rt);var at=function(){function t(t){this._fontFamily="Arial",this._fontStyle="",this._fontWeight="",this._fontSize=new h(18,h.UNITMODE_PIXEL,!1),this.onChangedObservable=new _.Observable,this._host=t}return Object.defineProperty(t.prototype,"fontSize",{get:function(){return this._fontSize.toString(this._host)},set:function(t){this._fontSize.toString(this._host)!==t&&this._fontSize.fromString(t)&&this.onChangedObservable.notifyObservers(this)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(t){this._fontFamily!==t&&(this._fontFamily=t,this.onChangedObservable.notifyObservers(this))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(t){this._fontStyle!==t&&(this._fontStyle=t,this.onChangedObservable.notifyObservers(this))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(t){this._fontWeight!==t&&(this._fontWeight=t,this.onChangedObservable.notifyObservers(this))},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this.onChangedObservable.clear()},t}(),st=function(t){function e(e,i,o,n,r,a,s){void 0===i&&(i=0),void 0===o&&(o=0),void 0===r&&(r=!1),void 0===a&&(a=_.Texture.NEAREST_SAMPLINGMODE),void 0===s&&(s=!0);var l=t.call(this,e,{width:i,height:o},n,r,a,_.Constants.TEXTUREFORMAT_RGBA,s)||this;return l.onGuiReadyObservable=new _.Observable,l._isDirty=!1,l._rootContainer=new y("root"),l._lastControlOver={},l._lastControlDown={},l._capturingControl={},l._linkedControls=new Array,l._isFullscreen=!1,l._fullscreenViewport=new _.Viewport(0,0,1,1),l._idealWidth=0,l._idealHeight=0,l._useSmallestIdeal=!1,l._renderAtIdealSize=!1,l._blockNextFocusCheck=!1,l._renderScale=1,l._cursorChanged=!1,l._defaultMousePointerId=0,l._rootChildrenHaveChanged=!1,l._capturedPointerIds=new Set,l._numLayoutCalls=0,l._numRenderCalls=0,l._clipboardData="",l.onClipboardObservable=new _.Observable,l.onControlPickedObservable=new _.Observable,l.onBeginLayoutObservable=new _.Observable,l.onEndLayoutObservable=new _.Observable,l.onBeginRenderObservable=new _.Observable,l.onEndRenderObservable=new _.Observable,l.premulAlpha=!1,l.applyYInversionOnUpdate=!0,l.checkPointerEveryFrame=!1,l._useInvalidateRectOptimization=!0,l._invalidatedRectangle=null,l._clearMeasure=new p(0,0,0,0),l._onClipboardCopy=function(t){var e=t,i=new _.ClipboardInfo(_.ClipboardEventTypes.COPY,e);l.onClipboardObservable.notifyObservers(i),e.preventDefault()},l._onClipboardCut=function(t){var e=t,i=new _.ClipboardInfo(_.ClipboardEventTypes.CUT,e);l.onClipboardObservable.notifyObservers(i),e.preventDefault()},l._onClipboardPaste=function(t){var e=t,i=new _.ClipboardInfo(_.ClipboardEventTypes.PASTE,e);l.onClipboardObservable.notifyObservers(i),e.preventDefault()},l.parseContent=l.parseSerializedObject,(n=l.getScene())&&l._texture?(l.applyYInversionOnUpdate=s,l._rootElement=n.getEngine().getInputElement(),l._renderObserver=n.onBeforeCameraRenderObservable.add((function(t){return l._checkUpdate(t)})),l._controlAddedObserver=l._rootContainer.onControlAddedObservable.add((function(t){t&&(l._rootChildrenHaveChanged=!0)})),l._controlRemovedObserver=l._rootContainer.onControlRemovedObservable.add((function(t){t&&(l._rootChildrenHaveChanged=!0)})),l._preKeyboardObserver=n.onPreKeyboardObservable.add((function(t){l._focusedControl&&(t.type===_.KeyboardEventTypes.KEYDOWN&&l._focusedControl.processKeyboard(t.event),t.skipOnPointerObservable=!0)})),l._rootContainer._link(l),l.hasAlpha=!0,i&&o||(l._resizeObserver=n.getEngine().onResizeObservable.add((function(){return l._onResize()})),l._onResize()),l._texture.isReady=!0,l):l}return r(e,t),Object.defineProperty(e.prototype,"numLayoutCalls",{get:function(){return this._numLayoutCalls},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"numRenderCalls",{get:function(){return this._numRenderCalls},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderScale",{get:function(){return this._renderScale},set:function(t){t!==this._renderScale&&(this._renderScale=t,this._onResize())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this.markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"idealWidth",{get:function(){return this._idealWidth},set:function(t){this._idealWidth!==t&&(this._idealWidth=t,this.markAsDirty(),this._rootContainer._markAllAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"idealHeight",{get:function(){return this._idealHeight},set:function(t){this._idealHeight!==t&&(this._idealHeight=t,this.markAsDirty(),this._rootContainer._markAllAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useSmallestIdeal",{get:function(){return this._useSmallestIdeal},set:function(t){this._useSmallestIdeal!==t&&(this._useSmallestIdeal=t,this.markAsDirty(),this._rootContainer._markAllAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderAtIdealSize",{get:function(){return this._renderAtIdealSize},set:function(t){this._renderAtIdealSize!==t&&(this._renderAtIdealSize=t,this._onResize())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"idealRatio",{get:function(){var t=0,e=0;return this._idealWidth&&(t=this.getSize().width/this._idealWidth),this._idealHeight&&(e=this.getSize().height/this._idealHeight),this._useSmallestIdeal&&this._idealWidth&&this._idealHeight?window.innerWidth<window.innerHeight?t:e:this._idealWidth?t:this._idealHeight?e:1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"layer",{get:function(){return this._layerToDispose},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rootContainer",{get:function(){return this._rootContainer},enumerable:!1,configurable:!0}),e.prototype.getChildren=function(){return[this._rootContainer]},e.prototype.getDescendants=function(t,e){return this._rootContainer.getDescendants(t,e)},e.prototype.getControlsByType=function(t){return this._rootContainer.getDescendants(!1,(function(e){return e.typeName===t}))},e.prototype.getControlByName=function(t){return this._getControlByKey("name",t)},e.prototype._getControlByKey=function(t,e){return this._rootContainer.getDescendants().find((function(i){return i[t]===e}))||null},Object.defineProperty(e.prototype,"focusedControl",{get:function(){return this._focusedControl},set:function(t){this._focusedControl!=t&&(this._focusedControl&&this._focusedControl.onBlur(),t&&t.onFocus(),this._focusedControl=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isForeground",{get:function(){return!this.layer||!this.layer.isBackground},set:function(t){this.layer&&this.layer.isBackground!==!t&&(this.layer.isBackground=!t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clipboardData",{get:function(){return this._clipboardData},set:function(t){this._clipboardData=t},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return"AdvancedDynamicTexture"},e.prototype.executeOnAllControls=function(t,e){e||(e=this._rootContainer),t(e);for(var i=0,o=e.children;i<o.length;i++){var n=o[i];n.children?this.executeOnAllControls(t,n):t(n)}},Object.defineProperty(e.prototype,"useInvalidateRectOptimization",{get:function(){return this._useInvalidateRectOptimization},set:function(t){this._useInvalidateRectOptimization=t},enumerable:!1,configurable:!0}),e.prototype.invalidateRect=function(t,e,i,o){if(this._useInvalidateRectOptimization)if(this._invalidatedRectangle){var n=Math.ceil(Math.max(this._invalidatedRectangle.left+this._invalidatedRectangle.width-1,i)),r=Math.ceil(Math.max(this._invalidatedRectangle.top+this._invalidatedRectangle.height-1,o));this._invalidatedRectangle.left=Math.floor(Math.min(this._invalidatedRectangle.left,t)),this._invalidatedRectangle.top=Math.floor(Math.min(this._invalidatedRectangle.top,e)),this._invalidatedRectangle.width=n-this._invalidatedRectangle.left+1,this._invalidatedRectangle.height=r-this._invalidatedRectangle.top+1}else this._invalidatedRectangle=new p(t,e,i-t+1,o-e+1)},e.prototype.markAsDirty=function(){this._isDirty=!0},e.prototype.createStyle=function(){return new at(this)},e.prototype.addControl=function(t){return this._rootContainer.addControl(t),this},e.prototype.removeControl=function(t){return this._rootContainer.removeControl(t),this},e.prototype.moveToNonOverlappedPosition=function(t,i,o){var n;if(void 0===i&&(i=1),void 0===o&&(o=1),Array.isArray(t))n=t;else{var r=this.getDescendants(!0);n=void 0===t?r.filter((function(t){return void 0!==t.overlapGroup})):r.filter((function(e){return e.overlapGroup===t}))}n.forEach((function(t){var r,a=_.Vector2.Zero(),s=new _.Vector2(t.centerX,t.centerY);n.forEach((function(i){if(t!==i&&e._Overlaps(t,i)){var n=s.subtract(new _.Vector2(i.centerX,i.centerY)),r=n.length();r>0&&(a=a.add(n.normalize().scale(o/r)))}})),a.length()>0&&(a=a.normalize().scale(i*(null!==(r=t.overlapDeltaMultiplier)&&void 0!==r?r:1)),t.linkOffsetXInPixels+=a.x,t.linkOffsetYInPixels+=a.y)}))},e.prototype.dispose=function(){var 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._controlAddedObserver&&this._rootContainer.onControlAddedObservable.remove(this._controlAddedObserver),this._controlRemovedObserver&&this._rootContainer.onControlRemovedObservable.remove(this._controlRemovedObserver),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(),this.onGuiReadyObservable.clear(),t.prototype.dispose.call(this))},e.prototype._onResize=function(){var t=this.getScene();if(t){var e=t.getEngine(),i=this.getSize(),o=e.getRenderWidth()*this._renderScale,n=e.getRenderHeight()*this._renderScale;this._renderAtIdealSize&&(this._idealWidth?(n=n*this._idealWidth/o,o=this._idealWidth):this._idealHeight&&(o=o*this._idealHeight/n,n=this._idealHeight)),i.width===o&&i.height===n||(this.scaleTo(o,n),this.markAsDirty(),(this._idealWidth||this._idealHeight)&&this._rootContainer._markAllAsDirty()),this.invalidateRect(0,0,i.width-1,i.height-1)}},e.prototype._getGlobalViewport=function(){var t=this.getSize(),e=this._fullscreenViewport.toGlobal(t.width,t.height),i=Math.round(e.width*(1/this.rootContainer.scaleX)),o=Math.round(e.height*(1/this.rootContainer.scaleY));return e.x+=(e.width-i)/2,e.y+=(e.height-o)/2,e.width=i,e.height=o,e},e.prototype.getProjectedPosition=function(t,e){var i=this.getProjectedPositionWithZ(t,e);return new _.Vector2(i.x,i.y)},e.prototype.getProjectedPositionWithZ=function(t,e){var i=this.getScene();if(!i)return _.Vector3.Zero();var o=this._getGlobalViewport(),n=_.Vector3.Project(t,e,i.getTransformMatrix(),o);return new _.Vector3(n.x,n.y,n.z)},e.prototype._checkUpdate=function(t,i){if(!this._layerToDispose||0!=(t.layerMask&this._layerToDispose.layerMask)){if(this._isFullscreen&&this._linkedControls.length){var o=this.getScene();if(!o)return;for(var n=this._getGlobalViewport(),r=function(t){if(!t.isVisible)return"continue";var e=t._linkedMesh;if(!e||e.isDisposed())return _.Tools.SetImmediate((function(){t.linkWithMesh(null)})),"continue";var i=e.getBoundingInfo?e.getBoundingInfo().boundingSphere.center:_.Vector3.ZeroReadOnly,r=_.Vector3.Project(i,e.getWorldMatrix(),o.getTransformMatrix(),n);if(r.z<0||r.z>1)return t.notRenderable=!0,"continue";t.notRenderable=!1,a.useInvalidateRectOptimization&&t.invalidateRect(),t._moveToProjectedPosition(r)},a=this,s=0,l=this._linkedControls;s<l.length;s++)r(l[s])}(this._isDirty||this._rootContainer.isDirty)&&(this._isDirty=!1,this._render(i),i||this.update(this.applyYInversionOnUpdate,this.premulAlpha,e.AllowGPUOptimizations))}},e.prototype._render=function(t){var e,i=this.getSize(),o=i.width,n=i.height,r=this.getContext();if(r.font="18px Arial",r.strokeStyle="white",this.onGuiReadyObservable.hasObservers()&&this._checkGuiIsReady(),this._rootChildrenHaveChanged){var a=null===(e=this.getScene())||void 0===e?void 0:e.activeCamera;a&&(this._rootChildrenHaveChanged=!1,this._checkUpdate(a,!0))}this.onBeginLayoutObservable.notifyObservers(this);var s=new p(0,0,o,n);this._numLayoutCalls=0,this._rootContainer._layout(s,r),this.onEndLayoutObservable.notifyObservers(this),this._isDirty=!1,t||(this._invalidatedRectangle?this._clearMeasure.copyFrom(this._invalidatedRectangle):this._clearMeasure.copyFromFloats(0,0,o,n),r.clearRect(this._clearMeasure.left,this._clearMeasure.top,this._clearMeasure.width,this._clearMeasure.height),this._background&&(r.save(),r.fillStyle=this._background,r.fillRect(this._clearMeasure.left,this._clearMeasure.top,this._clearMeasure.width,this._clearMeasure.height),r.restore()),this.onBeginRenderObservable.notifyObservers(this),this._numRenderCalls=0,this._rootContainer._render(r,this._invalidatedRectangle),this.onEndRenderObservable.notifyObservers(this),this._invalidatedRectangle=null)},e.prototype._changeCursor=function(t){this._rootElement&&(this._rootElement.style.cursor=t,this._cursorChanged=!0)},e.prototype._registerLastControlDown=function(t,e){this._lastControlDown[e]=t,this.onControlPickedObservable.notifyObservers(t)},e.prototype._doPicking=function(t,e,i,o,n,r,a,s){var l=this.getScene();if(l){var h=l.getEngine(),c=this.getSize();if(this._isFullscreen){var u=l.cameraToUseForPointers||l.activeCamera;if(!u)return;var d=u.viewport;t*=c.width/(h.getRenderWidth()*d.width),e*=c.height/(h.getRenderHeight()*d.height)}if(this._capturingControl[n])return this._capturingControl[n].isPointerBlocker&&(this._shouldBlockPointer=!0),void this._capturingControl[n]._processObservables(o,t,e,i,n,r);this._cursorChanged=!1,this._rootContainer._processPicking(t,e,i,o,n,r,a,s)||(l.doNotHandleCursors||this._changeCursor(""),o===_.PointerEventTypes.POINTERMOVE&&this._lastControlOver[n]&&(this._lastControlOver[n]._onPointerOut(this._lastControlOver[n],i),delete this._lastControlOver[n])),this._cursorChanged||l.doNotHandleCursors||this._changeCursor(""),this._manageFocus()}},e.prototype._cleanControlAfterRemovalFromList=function(t,e){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&t[i]===e&&delete t[i]},e.prototype._cleanControlAfterRemoval=function(t){this._cleanControlAfterRemovalFromList(this._lastControlDown,t),this._cleanControlAfterRemovalFromList(this._lastControlOver,t)},e.prototype.pick=function(t,e,i){void 0===i&&(i=null),this._isFullscreen&&this._scene&&this._translateToPicking(this._scene,new _.Viewport(0,0,0,0),i,t,e)},e.prototype._translateToPicking=function(t,e,i,o,n){void 0===o&&(o=t.pointerX),void 0===n&&(n=t.pointerY);var r=t.cameraToUseForPointers||t.activeCamera,a=t.getEngine(),s=t.cameraToUseForPointers;if(r)if(r.rigCameras.length){var l=new _.Viewport(0,0,1,1);r.rigCameras.forEach((function(i){i.viewport.toGlobalToRef(a.getRenderWidth(),a.getRenderHeight(),l);var r=o/a.getHardwareScalingLevel()-l.x,s=n/a.getHardwareScalingLevel()-(a.getRenderHeight()-l.y-l.height);r<0||s<0||o>l.width||n>l.height||(t.cameraToUseForPointers=i,e.x=l.x,e.y=l.y,e.width=l.width,e.height=l.height)}))}else r.viewport.toGlobalToRef(a.getRenderWidth(),a.getRenderHeight(),e);else e.x=0,e.y=0,e.width=a.getRenderWidth(),e.height=a.getRenderHeight();var h=o/a.getHardwareScalingLevel()-e.x,c=n/a.getHardwareScalingLevel()-(a.getRenderHeight()-e.y-e.height);if(this._shouldBlockPointer=!1,i){var u=i.event.pointerId||this._defaultMousePointerId;this._doPicking(h,c,i,i.type,u,i.event.button,i.event.deltaX,i.event.deltaY),(this._shouldBlockPointer||this._capturingControl[u])&&(i.skipOnPointerObservable=!0)}else this._doPicking(h,c,null,_.PointerEventTypes.POINTERMOVE,this._defaultMousePointerId,0);t.cameraToUseForPointers=s},e.prototype.attach=function(){var t=this,e=this.getScene();if(e){var i=new _.Viewport(0,0,0,0);this._prePointerObserver=e.onPrePointerObservable.add((function(o){if((!e.isPointerCaptured(o.event.pointerId)||o.type!==_.PointerEventTypes.POINTERUP||t._capturedPointerIds.has(o.event.pointerId))&&(o.type===_.PointerEventTypes.POINTERMOVE||o.type===_.PointerEventTypes.POINTERUP||o.type===_.PointerEventTypes.POINTERDOWN||o.type===_.PointerEventTypes.POINTERWHEEL)){if(o.type===_.PointerEventTypes.POINTERMOVE){if(e.isPointerCaptured(o.event.pointerId))return;o.event.pointerId&&(t._defaultMousePointerId=o.event.pointerId)}t._translateToPicking(e,i,o)}})),this._attachPickingToSceneRender(e,(function(){return t._translateToPicking(e,i,null)}),!1),this._attachToOnPointerOut(e),this._attachToOnBlur(e)}},e.prototype.registerClipboardEvents=function(){self.addEventListener("copy",this._onClipboardCopy,!1),self.addEventListener("cut",this._onClipboardCut,!1),self.addEventListener("paste",this._onClipboardPaste,!1)},e.prototype.unRegisterClipboardEvents=function(){self.removeEventListener("copy",this._onClipboardCopy),self.removeEventListener("cut",this._onClipboardCut),self.removeEventListener("paste",this._onClipboardPaste)},e.prototype._transformUvs=function(t){var e,i=this.getTextureMatrix();if(i.isIdentityAs3x2())e=t;else{var o=_.TmpVectors.Matrix[0];i.getRowToRef(0,_.TmpVectors.Vector4[0]),i.getRowToRef(1,_.TmpVectors.Vector4[1]),i.getRowToRef(2,_.TmpVectors.Vector4[2]);var n=_.TmpVectors.Vector4[0],r=_.TmpVectors.Vector4[1],a=_.TmpVectors.Vector4[2];o.setRowFromFloats(0,n.x,n.y,0,0),o.setRowFromFloats(1,r.x,r.y,0,0),o.setRowFromFloats(2,0,0,1,0),o.setRowFromFloats(3,a.x,a.y,0,1),e=_.TmpVectors.Vector2[0],_.Vector2.TransformToRef(t,o,e)}if((this.wrapU===_.Texture.WRAP_ADDRESSMODE||this.wrapU===_.Texture.MIRROR_ADDRESSMODE)&&e.x>1){var s=e.x-Math.trunc(e.x);this.wrapU===_.Texture.MIRROR_ADDRESSMODE&&Math.trunc(e.x)%2==1&&(s=1-s),e.x=s}if((this.wrapV===_.Texture.WRAP_ADDRESSMODE||this.wrapV===_.Texture.MIRROR_ADDRESSMODE)&&e.y>1){var l=e.y-Math.trunc(e.y);this.wrapV===_.Texture.MIRROR_ADDRESSMODE&&Math.trunc(e.x)%2==1&&(l=1-l),e.y=l}return e},e.prototype.attachToMesh=function(t,e){var i=this;void 0===e&&(e=!0);var o=this.getScene();o&&(this._pointerObserver&&o.onPointerObservable.remove(this._pointerObserver),this._pointerObserver=o.onPointerObservable.add((function(e){if(e.type===_.PointerEventTypes.POINTERMOVE||e.type===_.PointerEventTypes.POINTERUP||e.type===_.PointerEventTypes.POINTERDOWN||e.type===_.PointerEventTypes.POINTERWHEEL){e.type===_.PointerEventTypes.POINTERMOVE&&e.event.pointerId&&(i._defaultMousePointerId=e.event.pointerId);var o=e.event.pointerId||i._defaultMousePointerId;if(e.pickInfo&&e.pickInfo.hit&&e.pickInfo.pickedMesh===t){var n=e.pickInfo.getTextureCoordinates();if(n){n=i._transformUvs(n);var r=i.getSize();i._doPicking(n.x*r.width,(i.applyYInversionOnUpdate?1-n.y:n.y)*r.height,e,e.type,o,e.event.button,e.event.deltaX,e.event.deltaY)}}else if(e.type===_.PointerEventTypes.POINTERUP){if(i._lastControlDown[o]&&i._lastControlDown[o]._forcePointerUp(o),delete i._lastControlDown[o],i.focusedControl){var a=i.focusedControl.keepsFocusWith(),s=!0;if(a)for(var l=0,h=a;l<h.length;l++){var c=h[l];if(i!==c._host){var u=c._host;if(u._lastControlOver[o]&&u._lastControlOver[o].isAscendant(c)){s=!1;break}}}s&&(i.focusedControl=null)}}else e.type===_.PointerEventTypes.POINTERMOVE&&(i._lastControlOver[o]&&i._lastControlOver[o]._onPointerOut(i._lastControlOver[o],e,!0),delete i._lastControlOver[o])}})),t.enablePointerMoveEvents=e,this._attachPickingToSceneRender(o,(function(){var e=i._defaultMousePointerId,n=null==o?void 0:o.pick(o.pointerX,o.pointerY);if(n&&n.hit&&n.pickedMesh===t){var r=n.getTextureCoordinates();if(r){r=i._transformUvs(r);var a=i.getSize();i._doPicking(r.x*a.width,(i.applyYInversionOnUpdate?1-r.y:r.y)*a.height,null,_.PointerEventTypes.POINTERMOVE,e,0)}}else i._lastControlOver[e]&&i._lastControlOver[e]._onPointerOut(i._lastControlOver[e],null,!0),delete i._lastControlOver[e]}),!0),this._attachToOnPointerOut(o),this._attachToOnBlur(o))},e.prototype.moveFocusToControl=function(t){this.focusedControl=t,this._lastPickedControl=t,this._blockNextFocusCheck=!0},e.prototype._manageFocus=function(){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}},e.prototype._attachPickingToSceneRender=function(t,e,i){var o=this;this._sceneRenderObserver=t.onBeforeRenderObservable.add((function(){o.checkPointerEveryFrame&&(o._linkedControls.length>0||i)&&e()}))},e.prototype._attachToOnPointerOut=function(t){var e=this;this._canvasPointerOutObserver=t.getEngine().onCanvasPointerOutObservable.add((function(t){e._lastControlOver[t.pointerId]&&e._lastControlOver[t.pointerId]._onPointerOut(e._lastControlOver[t.pointerId],null),delete e._lastControlOver[t.pointerId],e._lastControlDown[t.pointerId]&&e._lastControlDown[t.pointerId]!==e._capturingControl[t.pointerId]&&(e._lastControlDown[t.pointerId]._forcePointerUp(t.pointerId),delete e._lastControlDown[t.pointerId])}))},e.prototype._attachToOnBlur=function(t){var e=this;this._canvasBlurObserver=t.getEngine().onCanvasBlurObservable.add((function(){Object.entries(e._lastControlDown).forEach((function(t){t[1]._onCanvasBlur()})),e.focusedControl=null,e._lastControlDown={}}))},e.prototype.serializeContent=function(){var t=this.getSize(),e={root:{},width:t.width,height:t.height};return this._rootContainer.serialize(e.root),e},e.prototype.parseSerializedObject=function(t,e){if(this._rootContainer=v.Parse(t.root,this),e){var i=t.width,o=t.height;"number"==typeof i&&"number"==typeof o&&i>=0&&o>=0?this.scaleTo(i,o):this.scaleTo(1920,1080)}},e.prototype.clone=function(t){var i=this.getScene();if(!i)return this;var o=this.serializeContent(),n=e.CreateFullscreenUI(t||"Clone of "+this.name,this.isForeground,i,this.samplingMode);return n.parseSerializedObject(o),n},e.ParseFromSnippetAsync=function(t,i,o){return s(this,void 0,void 0,(function(){var n,r;return l(this,(function(a){switch(a.label){case 0:return n=null!=o?o:e.CreateFullscreenUI("ADT from snippet"),"_BLANK"===t?[2,n]:[4,e._LoadURLContentAsync(e.SnippetUrl+"/"+t.replace(/#/g,"/"),!0)];case 1:return r=a.sent(),n.parseSerializedObject(r,i),[2,n]}}))}))},e.prototype.parseFromSnippetAsync=function(t,i){return e.ParseFromSnippetAsync(t,i,this)},e.ParseFromFileAsync=function(t,i,o){return s(this,void 0,void 0,(function(){var n,r;return l(this,(function(a){switch(a.label){case 0:return n=null!=o?o:e.CreateFullscreenUI("ADT from URL"),[4,e._LoadURLContentAsync(t)];case 1:return r=a.sent(),n.parseSerializedObject(r,i),[2,n]}}))}))},e.prototype.parseFromURLAsync=function(t,i){return e.ParseFromFileAsync(t,i,this)},e._LoadURLContentAsync=function(t,e){return void 0===e&&(e=!1),""===t?Promise.reject("No URL provided"):new Promise((function(i,o){var n=new _.WebRequest;n.addEventListener("readystatechange",(function(){if(4==n.readyState)if(200==n.status){var t=void 0;if(e){var r=JSON.parse(JSON.parse(n.responseText).jsonPayload);t=r.encodedGui?new TextDecoder("utf-8").decode((0,_.DecodeBase64ToBinary)(r.encodedGui)):r.gui}else t=n.responseText;var a=JSON.parse(t);i(a)}else o("Unable to load")})),n.open("GET",t),n.send()}))},e._Overlaps=function(t,e){return!(t.centerX>e.centerX+e.widthInPixels||t.centerX+t.widthInPixels<e.centerX||t.centerY+t.heightInPixels<e.centerY||t.centerY>e.centerY+e.heightInPixels)},e.CreateForMesh=function(t,i,o,n,r,a,s){void 0===i&&(i=1024),void 0===o&&(o=1024),void 0===n&&(n=!0),void 0===r&&(r=!1),void 0===s&&(s=this._CreateMaterial);var l=(0,_.RandomGUID)(),h=new e("AdvancedDynamicTexture for ".concat(t.name," [").concat(l,"]"),i,o,t.getScene(),!0,_.Texture.TRILINEAR_SAMPLINGMODE,a);return s(t,l,h,r),h.attachToMesh(t,n),h},e._CreateMaterial=function(t,e,i,o){var n=(0,_.GetClass)("BABYLON.StandardMaterial");if(!n)throw"StandardMaterial needs to be imported before as it contains a side-effect required by your code.";var r=new n("AdvancedDynamicTextureMaterial for ".concat(t.name," [").concat(e,"]"),t.getScene());r.backFaceCulling=!1,r.diffuseColor=_.Color3.Black(),r.specularColor=_.Color3.Black(),o?(r.diffuseTexture=i,r.emissiveTexture=i,i.hasAlpha=!0):(r.emissiveTexture=i,r.opacityTexture=i),t.material=r},e.CreateForMeshTexture=function(t,i,o,n,r){void 0===i&&(i=1024),void 0===o&&(o=1024),void 0===n&&(n=!0);var a=new e(t.name+" AdvancedDynamicTexture",i,o,t.getScene(),!0,_.Texture.TRILINEAR_SAMPLINGMODE,r);return a.attachToMesh(t,n),a},e.CreateFullscreenUI=function(t,i,o,n,r){void 0===i&&(i=!0),void 0===o&&(o=null),void 0===n&&(n=_.Texture.BILINEAR_SAMPLINGMODE),void 0===r&&(r=!1);var a=new e(t,0,0,o,!1,n),s=a.getScene(),l=new _.Layer(t+"_layer",null,s,!i);if(l.texture=a,a._layerToDispose=l,a._isFullscreen=!0,r&&s){var h=1/s.getEngine().getHardwareScalingLevel();a._rootContainer.scaleX=h,a._rootContainer.scaleY=h}return a.attach(),a},e.prototype.scale=function(e){t.prototype.scale.call(this,e),this.markAsDirty()},e.prototype.scaleTo=function(e,i){t.prototype.scaleTo.call(this,e,i),this.markAsDirty()},e.prototype._checkGuiIsReady=function(){this.guiIsReady()&&(this.onGuiReadyObservable.notifyObservers(this),this.onGuiReadyObservable.clear())},e.prototype.guiIsReady=function(){return this._rootContainer.isReady()},e.SnippetUrl=_.Constants.SnippetUrl,e.AllowGPUOptimizations=!0,e}(_.DynamicTexture),lt=function(){function t(t){this.texture=t,this._captureRenderTime=!1,this._renderTime=new _.PerfCounter,this._captureLayoutTime=!1,this._layoutTime=new _.PerfCounter,this._onBeginRenderObserver=null,this._onEndRenderObserver=null,this._onBeginLayoutObserver=null,this._onEndLayoutObserver=null}return Object.defineProperty(t.prototype,"renderTimeCounter",{get:function(){return this._renderTime},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layoutTimeCounter",{get:function(){return this._layoutTime},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"captureRenderTime",{get:function(){return this._captureRenderTime},set:function(t){var e=this;t!==this._captureRenderTime&&(this._captureRenderTime=t,t?(this._onBeginRenderObserver=this.texture.onBeginRenderObservable.add((function(){e._renderTime.beginMonitoring()})),this._onEndRenderObserver=this.texture.onEndRenderObservable.add((function(){e._renderTime.endMonitoring(!0)}))):(this.texture.onBeginRenderObservable.remove(this._onBeginRenderObserver),this._onBeginRenderObserver=null,this.texture.onEndRenderObservable.remove(this._onEndRenderObserver),this._onEndRenderObserver=null))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"captureLayoutTime",{get:function(){return this._captureLayoutTime},set:function(t){var e=this;t!==this._captureLayoutTime&&(this._captureLayoutTime=t,t?(this._onBeginLayoutObserver=this.texture.onBeginLayoutObservable.add((function(){e._layoutTime.beginMonitoring()})),this._onEndLayoutObserver=this.texture.onEndLayoutObservable.add((function(){e._layoutTime.endMonitoring(!0)}))):(this.texture.onBeginLayoutObservable.remove(this._onBeginLayoutObserver),this._onBeginLayoutObserver=null,this.texture.onEndLayoutObservable.remove(this._onEndLayoutObserver),this._onEndLayoutObserver=null))},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this.texture.onBeginRenderObservable.remove(this._onBeginRenderObserver),this._onBeginRenderObserver=null,this.texture.onEndRenderObservable.remove(this._onEndRenderObserver),this._onEndRenderObserver=null,this.texture.onBeginLayoutObservable.remove(this._onBeginLayoutObserver),this._onBeginLayoutObserver=null,this.texture.onEndLayoutObservable.remove(this._onEndLayoutObserver),this._onEndLayoutObserver=null,this.texture=null},t}(),_t="XmlLoader Exception : XML file is malformed or corrupted.",ht=function(){function t(t){void 0===t&&(t=null),this._nodes={},this._nodeTypes={element:1,attribute:2,text:3},this._isLoaded=!1,this._objectAttributes={textHorizontalAlignment:1,textVerticalAlignment:2,horizontalAlignment:3,verticalAlignment:4,stretch:5},t&&(this._parentClass=t)}return t.prototype._getChainElement=function(t){var e=window;this._parentClass&&(e=this._parentClass);var i=t;i=i.split(".");for(var o=0;o<i.length;o++)e=e[i[o]];return e},t.prototype._getClassAttribute=function(t){var e=t.split(".");return(0,_.GetClass)("BABYLON.GUI."+e[0])[e[1]]},t.prototype._createGuiElement=function(t,e,i){void 0===i&&(i=!0);try{var o=new((0,_.GetClass)("BABYLON.GUI."+t.nodeName));e&&i&&e.addControl(o);for(var n=0;n<t.attributes.length;n++)if(!t.attributes[n].name.toLowerCase().includes("datasource"))if(t.attributes[n].name.toLowerCase().includes("observable")){var r=this._getChainElement(t.attributes[n].value);o[t.attributes[n].name].add(r)}else"linkWithMesh"==t.attributes[n].name?this._parentClass?o.linkWithMesh(this._parentClass[t.attributes[n].value]):o.linkWithMesh(window[t.attributes[n].value]):t.attributes[n].value.startsWith("{{")&&t.attributes[n].value.endsWith("}}")?(r=this._getChainElement(t.attributes[n].value.substring(2,t.attributes[n].value.length-2)),o[t.attributes[n].name]=r):this._objectAttributes[t.attributes[n].name]?o[t.attributes[n].name]=this._getClassAttribute(t.attributes[n].value):"true"==t.attributes[n].value||"false"==t.attributes[n].value?o[t.attributes[n].name]="true"==t.attributes[n].value:o[t.attributes[n].name]=isNaN(Number(t.attributes[n].value))?t.attributes[n].value:Number(t.attributes[n].value);if(!t.attributes.getNamedItem("id"))return this._nodes[t.nodeName+Object.keys(this._nodes).length+"_gen"]=o,o;var a=t.attributes.getNamedItem("id").value;if(a.startsWith("{{")&&a.endsWith("}}")&&(a=this._getChainElement(a.substring(2,a.length-2))),this._nodes[a])throw"XmlLoader Exception : Duplicate ID, every element should have an unique ID attribute";return this._nodes[a]=o,o}catch(e){throw"XmlLoader Exception : Error parsing Control "+t.nodeName+","+e+"."}},t.prototype._parseGrid=function(t,e,i){for(var o,n,r,a,s,l=t.children,_=!1,h=-1,c=-1,u=0,d=0;d<l.length;d++)if(l[d].nodeType==this._nodeTypes.element){if("Row"!=l[d].nodeName)throw"XmlLoader Exception : Expecting Row node, received "+l[d].nodeName;if(h+=1,r=l[d].children,!l[d].attributes.getNamedItem("height"))throw"XmlLoader Exception : Height must be defined for grid rows";n=Number(l[d].attributes.getNamedItem("height").nodeValue),_=!!l[d].attributes.getNamedItem("isPixel")&&JSON.parse(l[d].attributes.getNamedItem("isPixel").nodeValue),e.addRowDefinition(n,_);for(var f=0;f<r.length;f++)if(r[f].nodeType==this._nodeTypes.element){if("Column"!=r[f].nodeName)throw"XmlLoader Exception : Expecting Column node, received "+r[f].nodeName;if(c+=1,h>0&&c>u)throw"XmlLoader Exception : In the Grid element, the number of columns is defined in the first row, do not add more columns in the subsequent rows.";if(0==h){if(!r[f].attributes.getNamedItem("width"))throw"XmlLoader Exception : Width must be defined for all the grid columns in the first row";o=Number(r[f].attributes.getNamedItem("width").nodeValue),_=!!r[f].attributes.getNamedItem("isPixel")&&JSON.parse(r[f].attributes.getNamedItem("isPixel").nodeValue),e.addColumnDefinition(o,_)}a=r[f].children;for(var p=0;p<a.length;p++)a[p].nodeType==this._nodeTypes.element&&(s=this._createGuiElement(a[p],e,!1),e.addControl(s,h,c),a[p].firstChild&&this._parseXml(a[p].firstChild,s))}0==h&&(u=c),c=-1}t.nextSibling&&this._parseXml(t.nextSibling,i)},t.prototype._parseElement=function(t,e,i){t.firstChild&&this._parseXml(t.firstChild,e),t.nextSibling&&this._parseXml(t.nextSibling,i)},t.prototype._prepareSourceElement=function(t,e,i,o,n){this._parentClass?this._parentClass[i]=o[n]:window[i]=o[n],t.firstChild&&this._parseXml(t.firstChild,e,!0)},t.prototype._parseElementsFromSource=function(t,e,i){var o=t.attributes.getNamedItem("dataSource").value;if(!o.includes(" in "))throw"XmlLoader Exception : Malformed XML, Data Source must include an in";var n=!0,r=o.split(" in ");if(r.length<2)throw"XmlLoader Exception : Malformed XML, Data Source must have an iterator and a source";var a=r[1];if(a.startsWith("{")&&a.endsWith("}")&&(n=!1),(!n||a.startsWith("[")&&a.endsWith("]"))&&(a=a.substring(1,a.length-1)),a=this._parentClass?this._parentClass[a]:window[a],n)for(var s=0;s<a.length;s++)this._prepareSourceElement(t,e,r[0],a,s);else for(var s in a)this._prepareSourceElement(t,e,r[0],a,s);t.nextSibling&&this._parseXml(t.nextSibling,i)},t.prototype._parseXml=function(t,e,i){if(void 0===i&&(i=!1),t.nodeType==this._nodeTypes.element){i&&t.setAttribute("id",e.id+(e._children.length+1));var o=this._createGuiElement(t,e);this._rootNode||(this._rootNode=o),"Grid"==t.nodeName?this._parseGrid(t,o,e):t.attributes.getNamedItem("dataSource")?this._parseElementsFromSource(t,o,e):this._parseElement(t,o,e)}else t.nextSibling&&this._parseXml(t.nextSibling,e,i)},t.prototype.isLoaded=function(){return this._isLoaded},t.prototype.getNodeById=function(t){return this._nodes[t]},t.prototype.getNodes=function(){return this._nodes},t.prototype.dispose=function(){this._rootNode&&(this._rootNode.dispose(),this._rootNode=null,this._nodes={})},t.prototype.loadLayout=function(t,e,i,o){var n=this;void 0===i&&(i=null),void 0===o&&(o=null);var r=new XMLHttpRequest;r.onload=function(){if(4===r.readyState&&200===r.status){if(!r.responseXML){if(o)return void o(_t);throw _t}var t=r.responseXML.documentElement;n._parseXml(t.firstChild,e),n._isLoaded=!0,i&&i()}},r.onerror=function(){o&&o("an error occurred during loading the layout")},r.open("GET",t,!0),r.send()},t.prototype.loadLayoutAsync=function(t,e){return s(this,void 0,void 0,(function(){var i=this;return l(this,(function(o){return[2,new Promise((function(o,n){i.loadLayout(t,e,o,n)}))]}))}))},t}(),ct=function(t){function e(e,i){void 0===i&&(i=0);var o=t.call(this,e.x,e.y,e.z)||this;return o.buttonIndex=i,o}return r(e,t),e}(_.Vector3),ut=function(){function t(t){this.name=t,this._downCount=0,this._enterCount=-1,this._downPointerIds={},this._isVisible=!0,this._isScaledByManager=!1,this.onPointerMoveObservable=new _.Observable,this.onPointerOutObservable=new _.Observable,this.onPointerDownObservable=new _.Observable,this.onPointerUpObservable=new _.Observable,this.onPointerClickObservable=new _.Observable,this.onPointerEnterObservable=new _.Observable,this._behaviors=new Array}return Object.defineProperty(t.prototype,"position",{get:function(){return this._node?this._node.position:_.Vector3.Zero()},set:function(t){this._node&&(this._node.position=t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaling",{get:function(){return this._node?this._node.scaling:new _.Vector3(1,1,1)},set:function(t){this._node&&(this._isScaledByManager=!1,this._node.scaling=t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"behaviors",{get:function(){return this._behaviors},enumerable:!1,configurable:!0}),t.prototype.addBehavior=function(t){var e=this;if(-1!==this._behaviors.indexOf(t))return this;t.init();var i=this._host.scene;return i.isLoading?i.onDataLoadedObservable.addOnce((function(){t.attach(e)})):t.attach(this),this._behaviors.push(t),this},t.prototype.removeBehavior=function(t){var e=this._behaviors.indexOf(t);return-1===e||(this._behaviors[e].detach(),this._behaviors.splice(e,1)),this},t.prototype.getBehaviorByName=function(t){for(var e=0,i=this._behaviors;e<i.length;e++){var o=i[e];if(o.name===t)return o}return null},Object.defineProperty(t.prototype,"isVisible",{get:function(){return this._isVisible},set:function(t){if(this._isVisible!==t){this._isVisible=t;var e=this.mesh;e&&e.setEnabled(t)}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"typeName",{get:function(){return this._getTypeName()},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return this._getTypeName()},t.prototype._getTypeName=function(){return"Control3D"},Object.defineProperty(t.prototype,"node",{get:function(){return this._node},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mesh",{get:function(){return this._node instanceof _.AbstractMesh?this._node:null},enumerable:!1,configurable:!0}),t.prototype.linkToTransformNode=function(t){return this._node&&(this._node.parent=t),this},t.prototype._prepareNode=function(t){if(!this._node){if(this._node=this._createNode(t),!this.node)return;this._injectGUI3DReservedDataStore(this.node).control=this;var e=this.mesh;e&&(e.isPickable=!0,this._affectMaterial(e))}},t.prototype._injectGUI3DReservedDataStore=function(t){var e,i;return t.reservedDataStore=null!==(e=t.reservedDataStore)&&void 0!==e?e:{},t.reservedDataStore.GUI3D=null!==(i=t.reservedDataStore.GUI3D)&&void 0!==i?i:{},t.reservedDataStore.GUI3D},t.prototype._createNode=function(t){return null},t.prototype._affectMaterial=function(t){t.material=null},t.prototype._isTouchButton3D=function(t){return void 0!==t._generatePointerEventType},t.prototype._onPointerMove=function(t,e){this.onPointerMoveObservable.notifyObservers(e,-1,t,this)},t.prototype._onPointerEnter=function(t){return-1===this._enterCount&&(this._enterCount=0),this._enterCount++,!(this._enterCount>1||(this.onPointerEnterObservable.notifyObservers(this,-1,t,this),this.pointerEnterAnimation&&this.pointerEnterAnimation(),0))},t.prototype._onPointerOut=function(t){this._enterCount--,this._enterCount>0||(this._enterCount=0,this.onPointerOutObservable.notifyObservers(this,-1,t,this),this.pointerOutAnimation&&this.pointerOutAnimation())},t.prototype._onPointerDown=function(t,e,i,o){return this._downCount++,this._downPointerIds[i]=this._downPointerIds[i]+1||1,1===this._downCount&&(this.onPointerDownObservable.notifyObservers(new ct(e,o),-1,t,this),this.pointerDownAnimation&&this.pointerDownAnimation(),!0)},t.prototype._onPointerUp=function(t,e,i,o,n){this._downCount--,this._downPointerIds[i]--,this._downPointerIds[i]<=0&&delete this._downPointerIds[i],this._downCount<0?this._downCount=0:0==this._downCount&&(n&&(this._enterCount>0||-1===this._enterCount)&&this.onPointerClickObservable.notifyObservers(new ct(e,o),-1,t,this),this.onPointerUpObservable.notifyObservers(new ct(e,o),-1,t,this),this.pointerUpAnimation&&this.pointerUpAnimation())},t.prototype.forcePointerUp=function(t){if(void 0===t&&(t=null),null!==t)this._onPointerUp(this,_.Vector3.Zero(),t,0,!0);else{for(var e in this._downPointerIds)this._onPointerUp(this,_.Vector3.Zero(),+e,0,!0);this._downCount>0&&(this._downCount=1,this._onPointerUp(this,_.Vector3.Zero(),0,0,!0))}},t.prototype._processObservables=function(t,e,i,o,n){if(this._isTouchButton3D(this)&&i&&(t=this._generatePointerEventType(t,i,this._downCount)),t===_.PointerEventTypes.POINTERMOVE){this._onPointerMove(this,e);var r=this._host._lastControlOver[o];return r&&r!==this&&r._onPointerOut(this),r!==this&&this._onPointerEnter(this),this._host._lastControlOver[o]=this,!0}return t===_.PointerEventTypes.POINTERDOWN?(this._onPointerDown(this,e,o,n),this._host._lastControlDown[o]=this,this._host._lastPickedControl=this,!0):(t===_.PointerEventTypes.POINTERUP||t===_.PointerEventTypes.POINTERDOUBLETAP)&&(this._host._lastControlDown[o]&&this._host._lastControlDown[o]._onPointerUp(this,e,o,n,!0),delete this._host._lastControlDown[o],!0)},t.prototype._disposeNode=function(){this._node&&(this._node.dispose(),this._node=null)},t.prototype.dispose=function(){this.onPointerDownObservable.clear(),this.onPointerEnterObservable.clear(),this.onPointerMoveObservable.clear(),this.onPointerOutObservable.clear(),this.onPointerUpObservable.clear(),this.onPointerClickObservable.clear(),this._disposeNode();for(var t=0,e=this._behaviors;t<e.length;t++)e[t].detach()},t}(),dt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._contentResolution=512,e._contentScaleRatio=2,e}return r(e,t),Object.defineProperty(e.prototype,"content",{get:function(){return this._content},set:function(t){this._content=t,t&&this._host&&this._host.utilityLayer&&(this._facadeTexture?this._facadeTexture.rootContainer.clearControls():(this._facadeTexture=new st("Facade",this._contentResolution,this._contentResolution,this._host.utilityLayer.utilityLayerScene,!0,_.Texture.TRILINEAR_SAMPLINGMODE),this._facadeTexture.rootContainer.scaleX=this._contentScaleRatio,this._facadeTexture.rootContainer.scaleY=this._contentScaleRatio,this._facadeTexture.premulAlpha=!0),this._facadeTexture.addControl(t),this._applyFacade(this._facadeTexture))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"contentResolution",{get:function(){return this._contentResolution},set:function(t){this._contentResolution!==t&&(this._contentResolution=t,this._resetContent())},enumerable:!1,configurable:!0}),e.prototype._disposeFacadeTexture=function(){this._facadeTexture&&(this._facadeTexture.dispose(),this._facadeTexture=null)},e.prototype._resetContent=function(){this._disposeFacadeTexture(),this.content=this._content},e.prototype._applyFacade=function(t){},e}(ut),ft=function(t){function e(e){return t.call(this,e)||this}return r(e,t),e.prototype._getTypeName=function(){return"AbstractButton3D"},e.prototype._createNode=function(t){return new _.TransformNode("button"+this.name,t)},e}(dt),pt=function(t){function e(e){var i=t.call(this,e)||this;return i.pointerEnterAnimation=function(){i.mesh&&(i._currentMaterial.emissiveColor=_.Color3.Red())},i.pointerOutAnimation=function(){i._currentMaterial.emissiveColor=_.Color3.Black()},i.pointerDownAnimation=function(){i.mesh&&i.mesh.scaling.scaleInPlace(.95)},i.pointerUpAnimation=function(){i.mesh&&i.mesh.scaling.scaleInPlace(1/.95)},i}return r(e,t),e.prototype._applyFacade=function(t){this._currentMaterial.emissiveTexture=t},e.prototype._getTypeName=function(){return"Button3D"},e.prototype._createNode=function(t){for(var e=new Array(6),i=0;i<6;i++)e[i]=new _.Vector4(0,0,0,0);return t.useRightHandedSystem?e[0].copyFromFloats(1,0,0,1):e[1].copyFromFloats(0,0,1,1),(0,_.CreateBox)(this.name+"_rootMesh",{width:1,height:1,depth:.08,faceUV:e,wrap:!0},t)},e.prototype._affectMaterial=function(t){var e=new _.StandardMaterial(this.name+"Material",t.getScene());e.specularColor=_.Color3.Black(),t.material=e,this._currentMaterial=e,this._resetContent()},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._disposeFacadeTexture(),this._currentMaterial&&this._currentMaterial.dispose()},e}(ft),gt=function(t){function e(e){var i=t.call(this,e)||this;return i._blockLayout=!1,i._children=new Array,i}return r(e,t),Object.defineProperty(e.prototype,"children",{get:function(){return this._children},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blockLayout",{get:function(){return this._blockLayout},set:function(t){this._blockLayout!==t&&(this._blockLayout=t,this._blockLayout||this._arrangeChildren())},enumerable:!1,configurable:!0}),e.prototype.updateLayout=function(){return this._arrangeChildren(),this},e.prototype.containsControl=function(t){return-1!==this._children.indexOf(t)},e.prototype.addControl=function(t){return-1!==this._children.indexOf(t)||(t.parent=this,t._host=this._host,this._children.push(t),this._host.utilityLayer&&(t._prepareNode(this._host.utilityLayer.utilityLayerScene),t.node&&(t.node.parent=this.node),this.blockLayout||this._arrangeChildren())),this},e.prototype._arrangeChildren=function(){},e.prototype._createNode=function(t){return new _.TransformNode("ContainerNode",t)},e.prototype.removeControl=function(t){var e=this._children.indexOf(t);return-1!==e&&(this._children.splice(e,1),t.parent=null,t._disposeNode()),this},e.prototype._getTypeName=function(){return"Container3D"},e.prototype.dispose=function(){for(var e=0,i=this._children;e<i.length;e++)i[e].dispose();this._children.length=0,t.prototype.dispose.call(this)},e.UNSET_ORIENTATION=0,e.FACEORIGIN_ORIENTATION=1,e.FACEORIGINREVERSED_ORIENTATION=2,e.FACEFORWARD_ORIENTATION=3,e.FACEFORWARDREVERSED_ORIENTATION=4,e}(ut),bt=function(t){function e(e){var i=t.call(this,e)||this;return i._columns=10,i._rows=0,i._rowThenColum=!0,i._orientation=gt.FACEORIGIN_ORIENTATION,i.margin=0,i}return r(e,t),Object.defineProperty(e.prototype,"orientation",{get:function(){return this._orientation},set:function(t){var e=this;this._orientation!==t&&(this._orientation=t,_.Tools.SetImmediate((function(){e._arrangeChildren()})))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"columns",{get:function(){return this._columns},set:function(t){var e=this;this._columns!==t&&(this._columns=t,this._rowThenColum=!0,_.Tools.SetImmediate((function(){e._arrangeChildren()})))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rows",{get:function(){return this._rows},set:function(t){var e=this;this._rows!==t&&(this._rows=t,this._rowThenColum=!1,_.Tools.SetImmediate((function(){e._arrangeChildren()})))},enumerable:!1,configurable:!0}),e.prototype._arrangeChildren=function(){this._cellWidth=0,this._cellHeight=0;for(var t=0,e=0,i=0,o=_.Matrix.Invert(this.node.computeWorldMatrix(!0)),n=0,r=this._children;n<r.length;n++)if((m=r[n]).mesh){i++,m.mesh.computeWorldMatrix(!0);var a=m.mesh.getHierarchyBoundingVectors(),s=_.TmpVectors.Vector3[0],l=_.TmpVectors.Vector3[1];a.max.subtractToRef(a.min,l),l.scaleInPlace(.5),_.Vector3.TransformNormalToRef(l,o,s),this._cellWidth=Math.max(this._cellWidth,2*s.x),this._cellHeight=Math.max(this._cellHeight,2*s.y)}this._cellWidth+=2*this.margin,this._cellHeight+=2*this.margin,this._rowThenColum?(e=this._columns,t=Math.ceil(i/this._columns)):(t=this._rows,e=Math.ceil(i/this._rows));var h=.5*e*this._cellWidth,c=.5*t*this._cellHeight,u=[],d=0;if(this._rowThenColum)for(var f=0;f<t;f++)for(var p=0;p<e&&(u.push(new _.Vector3(p*this._cellWidth-h+this._cellWidth/2,f*this._cellHeight-c+this._cellHeight/2,0)),!(++d>i));p++);else for(p=0;p<e;p++)for(f=0;f<t&&(u.push(new _.Vector3(p*this._cellWidth-h+this._cellWidth/2,f*this._cellHeight-c+this._cellHeight/2,0)),!(++d>i));f++);d=0;for(var g=0,b=this._children;g<b.length;g++){var m;(m=b[g]).mesh&&(this._mapGridNode(m,u[d]),d++)}this._finalProcessing()},e.prototype._finalProcessing=function(){},e}(gt),mt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._radius=5,e}return r(e,t),Object.defineProperty(e.prototype,"radius",{get:function(){return this._radius},set:function(t){var e=this;this._radius!==t&&(this._radius=t,_.Tools.SetImmediate((function(){e._arrangeChildren()})))},enumerable:!1,configurable:!0}),e.prototype._mapGridNode=function(t,e){var i=t.mesh;if(i){var o=this._cylindricalMapping(e);switch(t.position=o,this.orientation){case gt.FACEORIGIN_ORIENTATION:i.lookAt(new _.Vector3(2*o.x,o.y,2*o.z));break;case gt.FACEORIGINREVERSED_ORIENTATION:i.lookAt(new _.Vector3(-o.x,o.y,-o.z));break;case gt.FACEFORWARD_ORIENTATION:break;case gt.FACEFORWARDREVERSED_ORIENTATION:i.rotate(_.Axis.Y,Math.PI,_.Space.LOCAL)}}},e.prototype._cylindricalMapping=function(t){var e=new _.Vector3(0,t.y,this._radius),i=t.x/this._radius;return _.Matrix.RotationYawPitchRollToRef(i,0,0,_.TmpVectors.Matrix[0]),_.Vector3.TransformNormal(e,_.TmpVectors.Matrix[0])},e}(bt);_.ShaderStore.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";_.ShaderStore.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}";var vt=function(t){function e(){var e=t.call(this)||this;return e.INNERGLOW=!1,e.BORDER=!1,e.HOVERLIGHT=!1,e.TEXTURE=!1,e.rebuild(),e}return r(e,t),e}(_.MaterialDefines),yt=function(t){function e(e,i){var o=t.call(this,e,i)||this;return o.innerGlowColorIntensity=.5,o.innerGlowColor=new _.Color3(1,1,1),o.albedoColor=new _.Color3(.3,.35,.4),o.renderBorders=!1,o.borderWidth=.5,o.edgeSmoothingValue=.02,o.borderMinValue=.1,o.renderHoverLight=!1,o.hoverRadius=.01,o.hoverColor=new _.Color4(.3,.3,.3,1),o.hoverPosition=_.Vector3.Zero(),o}return r(e,t),e.prototype.needAlphaBlending=function(){return 1!==this.alpha},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){if(this.isFrozen&&e.effect&&e.effect._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new vt);var i=this.getScene(),o=e.materialDefines;if(!this.checkReadyOnEveryCall&&e.effect&&o._renderId===i.getRenderId())return!0;if(o._areTexturesDirty)if(o.INNERGLOW=this.innerGlowColorIntensity>0,o.BORDER=this.renderBorders,o.HOVERLIGHT=this.renderHoverLight,this._albedoTexture){if(!this._albedoTexture.isReadyOrNotBlocking())return!1;o.TEXTURE=!0}else o.TEXTURE=!1;var n=i.getEngine();if(o.isDirty){o.markAsProcessed(),i.resetCachedMaterial();var r=[_.VertexBuffer.PositionKind];r.push(_.VertexBuffer.NormalKind),r.push(_.VertexBuffer.UVKind);var a=["world","viewProjection","innerGlowColor","albedoColor","borderWidth","edgeSmoothingValue","scaleFactor","borderMinValue","hoverColor","hoverPosition","hoverRadius","textureMatrix"],s=["albedoSampler"],l=new Array;_.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:a,uniformBuffersNames:l,samplers:s,defines:o,maxSimultaneousLights:4});var h=o.toString();e.setEffect(i.getEngine().createEffect("fluent",{attributes:r,uniformsNames:a,uniformBuffersNames:l,samplers:s,defines:h,fallbacks:null,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),o,this._materialContext)}return!(!e.effect||!e.effect.isReady()||(o._renderId=i.getRenderId(),e.effect._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){var o=this.getScene(),n=i.materialDefines;if(n){var r=i.effect;if(r){if(this._activeEffect=r,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",o.getTransformMatrix()),this._mustRebind(o,r)&&(this._activeEffect.setColor4("albedoColor",this.albedoColor,this.alpha),n.INNERGLOW&&this._activeEffect.setColor4("innerGlowColor",this.innerGlowColor,this.innerGlowColorIntensity),n.BORDER&&(this._activeEffect.setFloat("borderWidth",this.borderWidth),this._activeEffect.setFloat("edgeSmoothingValue",this.edgeSmoothingValue),this._activeEffect.setFloat("borderMinValue",this.borderMinValue),e.getBoundingInfo().boundingBox.extendSize.multiplyToRef(e.scaling,_.TmpVectors.Vector3[0]),this._activeEffect.setVector3("scaleFactor",_.TmpVectors.Vector3[0])),n.HOVERLIGHT&&(this._activeEffect.setDirectColor4("hoverColor",this.hoverColor),this._activeEffect.setFloat("hoverRadius",this.hoverRadius),this._activeEffect.setVector3("hoverPosition",this.hoverPosition)),n.TEXTURE&&this._albedoTexture)){this._activeEffect.setTexture("albedoSampler",this._albedoTexture);var a=this._albedoTexture.getTextureMatrix();this._activeEffect.setMatrix("textureMatrix",a)}this._afterBind(e,this._activeEffect)}}},e.prototype.getActiveTextures=function(){return t.prototype.getActiveTextures.call(this)},e.prototype.hasTexture=function(e){return!!t.prototype.hasTexture.call(this,e)},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e)},e.prototype.clone=function(t){var i=this;return _.SerializationHelper.Clone((function(){return new e(t,i.getScene())}),this)},e.prototype.serialize=function(){var e=t.prototype.serialize.call(this);return e.customType="BABYLON.GUI.FluentMaterial",e},e.prototype.getClassName=function(){return"FluentMaterial"},e.Parse=function(t,i,o){return _.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},a([(0,_.serialize)(),(0,_.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"innerGlowColorIntensity",void 0),a([(0,_.serializeAsColor3)()],e.prototype,"innerGlowColor",void 0),a([(0,_.serializeAsColor3)()],e.prototype,"albedoColor",void 0),a([(0,_.serialize)(),(0,_.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"renderBorders",void 0),a([(0,_.serialize)()],e.prototype,"borderWidth",void 0),a([(0,_.serialize)()],e.prototype,"edgeSmoothingValue",void 0),a([(0,_.serialize)()],e.prototype,"borderMinValue",void 0),a([(0,_.serialize)(),(0,_.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"renderHoverLight",void 0),a([(0,_.serialize)()],e.prototype,"hoverRadius",void 0),a([(0,_.serializeAsColor4)()],e.prototype,"hoverColor",void 0),a([(0,_.serializeAsVector3)()],e.prototype,"hoverPosition",void 0),a([(0,_.serializeAsTexture)("albedoTexture")],e.prototype,"_albedoTexture",void 0),a([(0,_.expandToProperty)("_markAllSubMeshesAsTexturesAndMiscDirty")],e.prototype,"albedoTexture",void 0),e}(_.PushMaterial);(0,_.RegisterClass)("BABYLON.GUI.FluentMaterial",yt);var xt=function(t){function e(e){var i=t.call(this,e)||this;return i._backPlateMargin=1.25,i}return r(e,t),Object.defineProperty(e.prototype,"backPlateMargin",{get:function(){return this._backPlateMargin},set:function(t){var e=this;this._backPlateMargin=t,this._children.length>=1&&(this.children.forEach((function(t){e._updateCurrentMinMax(t.position)})),this._updateMargins())},enumerable:!1,configurable:!0}),e.prototype._createNode=function(t){var e=new _.Mesh("menu_".concat(this.name),t);return this._backPlate=(0,_.CreateBox)("backPlate"+this.name,{size:1},t),this._backPlate.parent=e,e},e.prototype._affectMaterial=function(t){var e=this;this._backPlateMaterial=new yt(this.name+"backPlateMaterial",t.getScene()),this._backPlateMaterial.albedoColor=new _.Color3(.08,.15,.55),this._backPlateMaterial.renderBorders=!0,this._backPlateMaterial.renderHoverLight=!0,this._pickedPointObserver=this._host.onPickedPointChangedObservable.add((function(t){t?(e._backPlateMaterial.hoverPosition=t,e._backPlateMaterial.hoverColor.a=1):e._backPlateMaterial.hoverColor.a=0})),this._backPlate.material=this._backPlateMaterial},e.prototype._mapGridNode=function(t,e){t.mesh&&(t.position=e.clone(),this._updateCurrentMinMax(e))},e.prototype._finalProcessing=function(){this._updateMargins()},e.prototype._updateCurrentMinMax=function(t){this._currentMin||(this._currentMin=t.clone(),this._currentMax=t.clone()),this._currentMin.minimizeInPlace(t),this._currentMax.maximizeInPlace(t)},e.prototype._updateMargins=function(){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);var t=this._currentMax.subtract(this._currentMin);this._backPlate.scaling.x=t.x+this._cellWidth*this.backPlateMargin,this._backPlate.scaling.y=t.y+this._cellHeight*this.backPlateMargin,this._backPlate.scaling.z=.001;for(var e=0;e<this._children.length;e++)this._children[e].position.subtractInPlace(this._currentMin).subtractInPlace(t.scale(.5)),this._children[e].position.z-=.01}this._currentMin=null,this._currentMax=null},e.prototype.addButton=function(i){var o=this.blockLayout;return o||(this.blockLayout=!0),t.prototype.addControl.call(this,i),i.isBackplateVisible=!1,i.scaling.scaleInPlace(e.MENU_BUTTON_SCALE),o||(this.blockLayout=!1),this},e.prototype.addControl=function(t){return _.Logger.Warn("TouchHolographicMenu can only contain buttons. Please use the method `addButton` instead."),this},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver)},e.MENU_BUTTON_SCALE=1,e}(bt),Pt=function(t){function e(e,i){var o=t.call(this,i)||this;return o._handConstraintBehavior=new _.HandConstraintBehavior,o._handConstraintBehavior.linkToXRExperience(e),o.backPlateMargin=.15,o.rows=3,o}return r(e,t),Object.defineProperty(e.prototype,"handConstraintBehavior",{get:function(){return this._handConstraintBehavior},enumerable:!1,configurable:!0}),e.prototype._createNode=function(e){var i=t.prototype._createNode.call(this,e);return this._handConstraintBehavior.attach(i),i},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._handConstraintBehavior.detach()},e}(xt);_.ShaderStore.ShadersStore.fluentBackplatePixelShader="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 _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 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 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 float _Angle_;\nuniform float _Fade_Out_;\nuniform bool _Reflected_;\nuniform float _Frequency_;\nuniform float _Vertical_Offset_;\nuniform sampler2D _Iridescent_Map_;\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 Round_Rect_Fragment_B31(\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 Blob_Fragment_B71(\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=k1<k2 ? vec3(k1,Blob_Info1.z,Blob_Info1.w) : vec3(k2,Blob_Info2.z,Blob_Info2.w);\nBlob_Color=closer.z*texture(Blob_Texture,vec2(vec2(sqrt(closer.x),closer.y).x,1.0-vec2(sqrt(closer.x),closer.y).y))*clamp(1.0-closer.x,0.0,1.0);\n}\nvoid Line_Fragment_B48(\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 Scale_RGB_B54(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{\nResult=vec4(Scalar,Scalar,Scalar,1)*Color;\n}\nvoid Conditional_Float_B38(\nbool Which,\nfloat If_True,\nfloat If_False,\nout float Result)\n{\nResult=Which ? If_True : If_False;\n}\nvoid main()\n{\nfloat R_Q72;\nfloat G_Q72;\nfloat B_Q72;\nfloat A_Q72;\nR_Q72=vColor.r; G_Q72=vColor.g; B_Q72=vColor.b; A_Q72=vColor.a;\nvec4 Blob_Color_Q71;\n#if BLOB_ENABLE\nfloat k1=dot(vExtra2.xy,vExtra2.xy);\nfloat k2=dot(vExtra3.xy,vExtra3.xy);\nvec3 closer=k1<k2 ? vec3(k1,vExtra2.z,vExtra2.w) : vec3(k2,vExtra3.z,vExtra3.w);\nBlob_Color_Q71=closer.z*texture(_Blob_Texture_,vec2(vec2(sqrt(closer.x),closer.y).x,1.0-vec2(sqrt(closer.x),closer.y).y))*clamp(1.0-closer.x,0.0,1.0);\n#else\nBlob_Color_Q71=vec4(0,0,0,0);\n#endif\nvec4 Line_Color_Q48;\nLine_Fragment_B48(_Line_Color_,_Highlight_Color_,_Highlight_Width_,vTangent,_Highlight_,Line_Color_Q48);\nfloat X_Q67;\nfloat Y_Q67;\nX_Q67=vUV.x;\nY_Q67=vUV.y;\nvec3 Incident_Q66=normalize(vPosition-cameraPosition);\nvec3 Reflected_Q60=reflect(Incident_Q66,vBinormal);\nfloat Product_Q63=Y_Q67*_Vertical_Offset_;\nfloat Dot_Q68=dot(Incident_Q66, Reflected_Q60);\nfloat Dot_Q57=dot(vNormal, Incident_Q66);\nfloat Result_Q38;\nConditional_Float_B38(_Reflected_,Dot_Q68,Dot_Q57,Result_Q38);\nfloat Product_Q64=Result_Q38*_Frequency_;\nfloat Sum_Q69=Product_Q64+1.0;\nfloat Product_Q70=Sum_Q69*0.5;\nfloat Sum_Q62=Product_Q63+Product_Q70;\nfloat FractF_Q59=fract(Sum_Q62);\nvec2 Vec2_Q65=vec2(FractF_Q59,0.5);\nvec4 Color_Q58;\n#if IRIDESCENT_MAP_ENABLE\nColor_Q58=texture(_Iridescent_Map_,Vec2_Q65);\n#else\nColor_Q58=vec4(0,0,0,0);\n#endif\nvec4 Result_Q54;\nScale_RGB_B54(Color_Q58,_Iridescence_Edge_Intensity_,Result_Q54);\nvec4 Result_Q55;\nScale_RGB_B54(Color_Q58,_Iridescence_Intensity_,Result_Q55);\nvec4 Base_And_Iridescent_Q53;\nBase_And_Iridescent_Q53=Line_Color_Q48+vec4(Result_Q54.rgb,0.0);\nvec4 Base_And_Iridescent_Q56;\nBase_And_Iridescent_Q56=_Base_Color_+vec4(Result_Q55.rgb,0.0);\nvec4 Result_Q52=Base_And_Iridescent_Q53; Result_Q52.a=1.0;\nvec4 Result_Q35=Blob_Color_Q71+(1.0-Blob_Color_Q71.a)*Base_And_Iridescent_Q56;\nvec4 Color_Q31;\nRound_Rect_Fragment_B31(R_Q72,G_Q72,Result_Q52,_Filter_Width_,vUV,1.0,vExtra1,Result_Q35,Color_Q31);\nvec4 Result_Q47=_Fade_Out_*Color_Q31;\nvec4 Out_Color=Result_Q47;\nfloat Clip_Threshold=0.001;\nbool To_sRGB=false;\ngl_FragColor=Out_Color;\n}";_.ShaderStore.ShadersStore.fluentBackplateVertexShader="uniform mat4 world;\nuniform mat4 viewProjection;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\n#ifdef TANGENT\nattribute vec3 tangent;\n#else\nconst vec3 tangent=vec3(0.);\n#endif\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 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 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 float _Angle_;\nuniform float _Fade_Out_;\nuniform bool _Reflected_;\nuniform float _Frequency_;\nuniform float _Vertical_Offset_;\nuniform sampler2D _Iridescent_Map_;\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 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;\nvoid Object_To_World_Pos_B115(\nvec3 Pos_Object,\nout vec3 Pos_World)\n{\nPos_World=(world*vec4(Pos_Object,1.0)).xyz;\n}\nvoid PickDir_B140(\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 Round_Rect_Vertex_B139(\nvec2 UV,\nfloat Radius,\nfloat Margin,\nfloat Anisotropy,\nfloat Gradient1,\nfloat Gradient2,\nout vec2 Rect_UV,\nout vec4 Rect_Parms,\nout vec2 Scale_XY,\nout vec2 Line_UV)\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;\n}\nvoid Line_Vertex_B135(\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 Blob_Vertex_B180(\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,\nfloat Blob_Fade_Length,\nfloat Blob_Pulse,\nfloat Blob_Fade,\nout vec4 Blob_Info)\n{\nvec3 blob=Blob_Position;\nvec3 delta=blob-Position;\nfloat dist=dot(Normal,delta);\nfloat lerpValue=clamp((abs(dist)-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);\nfloat fadeValue=1.0-clamp((abs(dist)-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);\nfloat size=Blob_Near_Size+(Blob_Far_Size-Blob_Near_Size)*lerpValue;\nvec2 blobXY=vec2(dot(delta,Tangent),dot(delta,Bitangent))/(0.0001+size);\nfloat Fade=fadeValue*Intensity*Blob_Fade;\nfloat Distance=(lerpValue*0.5+0.5)*(1.0-Blob_Pulse);\nBlob_Info=vec4(blobXY.x,blobXY.y,Distance,Fade);\n}\nvoid Move_Verts_B129(\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 Object_To_World_Dir_B132(\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_B147(\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 Edge_AA_Vertex_B130(\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=(world* 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 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}";var It=function(t){function e(){var e=t.call(this)||this;return e.BLOB_ENABLE=!0,e.BLOB_ENABLE_2=!0,e.SMOOTH_EDGES=!0,e.IRIDESCENT_MAP_ENABLE=!0,e._needNormals=!0,e.rebuild(),e}return r(e,t),e}(_.MaterialDefines),Bt=function(t){function e(i,o){var n=t.call(this,i,o)||this;return n.radius=.03,n.lineWidth=.01,n.absoluteSizes=!1,n._filterWidth=1,n.baseColor=new _.Color4(.0392157,.0666667,.207843,1),n.lineColor=new _.Color4(.14902,.133333,.384314,1),n.blobIntensity=.98,n.blobFarSize=.04,n.blobNearDistance=0,n.blobFarDistance=.08,n.blobFadeLength=.08,n.blobNearSize=.22,n.blobPulse=0,n.blobFade=0,n.blobNearSize2=.22,n.blobPulse2=0,n.blobFade2=0,n._rate=.135,n.highlightColor=new _.Color4(.98,.98,.98,1),n.highlightWidth=.25,n._highlightTransform=new _.Vector4(1,1,0,0),n._highlight=1,n.iridescenceIntensity=0,n.iridescenceEdgeIntensity=1,n._angle=-45,n.fadeOut=1,n._reflected=!0,n._frequency=1,n._verticalOffset=0,n.globalLeftIndexTipPosition=_.Vector3.Zero(),n._globalLeftIndexTipPosition4=_.Vector4.Zero(),n.globalRightIndexTipPosition=_.Vector3.Zero(),n._globalRightIndexTipPosition4=_.Vector4.Zero(),n.alphaMode=_.Constants.ALPHA_DISABLE,n.backFaceCulling=!1,n._blobTexture=new _.Texture(e.BLOB_TEXTURE_URL,n.getScene(),!0,!1,_.Texture.NEAREST_SAMPLINGMODE),n._iridescentMap=new _.Texture(e.IM_TEXTURE_URL,n.getScene(),!0,!1,_.Texture.NEAREST_SAMPLINGMODE),n}return r(e,t),e.prototype.needAlphaBlending=function(){return!1},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){if(this.isFrozen&&e.effect&&e.effect._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new It);var i=e.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(e))return!0;var n=o.getEngine();if(_.MaterialHelper.PrepareDefinesForAttributes(t,i,!1,!1),i.isDirty){i.markAsProcessed(),o.resetCachedMaterial();var r=new _.EffectFallbacks;i.FOG&&r.addFallback(1,"FOG"),_.MaterialHelper.HandleFallbacksForShadows(i,r),i.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;var a=[_.VertexBuffer.PositionKind];i.NORMAL&&a.push(_.VertexBuffer.NormalKind),i.UV1&&a.push(_.VertexBuffer.UVKind),i.UV2&&a.push(_.VertexBuffer.UV2Kind),i.VERTEXCOLOR&&a.push(_.VertexBuffer.ColorKind),i.TANGENT&&a.push(_.VertexBuffer.TangentKind),_.MaterialHelper.PrepareAttributesForInstances(a,i);var s=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"],h=["_Blob_Texture_","_Iridescent_Map_"],c=new Array;_.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:l,uniformBuffersNames:c,samplers:h,defines:i,maxSimultaneousLights:4}),e.setEffect(o.getEngine().createEffect("fluentBackplate",{attributes:a,uniformsNames:l,uniformBuffersNames:c,samplers:h,defines:s,fallbacks:r,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),i,this._materialContext)}return!(!e.effect||!e.effect.isReady()||(i._renderId=o.getRenderId(),e.effect._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){var o,n;if(i.materialDefines){var r=i.effect;r&&(this._activeEffect=r,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",this.getScene().getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",null!==(n=null===(o=this.getScene().activeCamera)||void 0===o?void 0:o.position)&&void 0!==n?n:_.Vector3.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(e,this._activeEffect))}},e.prototype.getAnimatables=function(){return[]},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e),this._blobTexture.dispose(),this._iridescentMap.dispose()},e.prototype.clone=function(t){var i=this;return _.SerializationHelper.Clone((function(){return new e(t,i.getScene())}),this)},e.prototype.serialize=function(){var e=t.prototype.serialize.call(this);return e.customType="BABYLON.FluentBackplateMaterial",e},e.prototype.getClassName=function(){return"FluentBackplateMaterial"},e.Parse=function(t,i,o){return _.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},e.BLOB_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/mrtk-fluent-backplate-blob.png",e.IM_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/mrtk-fluent-backplate-iridescence.png",a([(0,_.serialize)()],e.prototype,"radius",void 0),a([(0,_.serialize)()],e.prototype,"lineWidth",void 0),a([(0,_.serialize)()],e.prototype,"absoluteSizes",void 0),a([(0,_.serialize)()],e.prototype,"baseColor",void 0),a([(0,_.serialize)()],e.prototype,"lineColor",void 0),a([(0,_.serialize)()],e.prototype,"blobIntensity",void 0),a([(0,_.serialize)()],e.prototype,"blobFarSize",void 0),a([(0,_.serialize)()],e.prototype,"blobNearDistance",void 0),a([(0,_.serialize)()],e.prototype,"blobFarDistance",void 0),a([(0,_.serialize)()],e.prototype,"blobFadeLength",void 0),a([(0,_.serialize)()],e.prototype,"blobNearSize",void 0),a([(0,_.serialize)()],e.prototype,"blobPulse",void 0),a([(0,_.serialize)()],e.prototype,"blobFade",void 0),a([(0,_.serialize)()],e.prototype,"blobNearSize2",void 0),a([(0,_.serialize)()],e.prototype,"blobPulse2",void 0),a([(0,_.serialize)()],e.prototype,"blobFade2",void 0),a([(0,_.serialize)()],e.prototype,"highlightColor",void 0),a([(0,_.serialize)()],e.prototype,"highlightWidth",void 0),a([(0,_.serialize)()],e.prototype,"iridescenceIntensity",void 0),a([(0,_.serialize)()],e.prototype,"iridescenceEdgeIntensity",void 0),a([(0,_.serialize)()],e.prototype,"fadeOut",void 0),a([(0,_.serializeAsVector3)()],e.prototype,"globalLeftIndexTipPosition",void 0),a([(0,_.serializeAsVector3)()],e.prototype,"globalRightIndexTipPosition",void 0),e}(_.PushMaterial);(0,_.RegisterClass)("BABYLON.GUI.FluentBackplateMaterial",Bt);var Ct=function(t){function e(e,i){void 0===i&&(i=!0);var o=t.call(this,e)||this;return o._shareMaterials=i,o}return r(e,t),Object.defineProperty(e.prototype,"renderingGroupId",{get:function(){return this._model.renderingGroupId},set:function(t){this._model.renderingGroupId=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"material",{get:function(){return this._material},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shareMaterials",{get:function(){return this._shareMaterials},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"HolographicBackplate"},e.prototype._createNode=function(t){var i,o=this,n=(0,_.CreateBox)((null!==(i=this.name)&&void 0!==i?i:"HolographicBackplate")+"_CollisionMesh",{width:1,height:1,depth:1},t);return n.isPickable=!0,n.visibility=0,_.SceneLoader.ImportMeshAsync(void 0,e.MODEL_BASE_URL,e.MODEL_FILENAME,t).then((function(t){var e=t.meshes[1];e.name="".concat(o.name,"_frontPlate"),e.isPickable=!1,e.parent=n,o._material&&(e.material=o._material),o._model=e})),n},e.prototype._createMaterial=function(t){this._material=new Bt(this.name+" Material",t.getScene())},e.prototype._affectMaterial=function(t){this._shareMaterials?this._host._touchSharedMaterials.fluentBackplateMaterial?this._material=this._host._touchSharedMaterials.fluentBackplateMaterial:(this._createMaterial(t),this._host._touchSharedMaterials.fluentBackplateMaterial=this._material):this._createMaterial(t)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.shareMaterials||this._material.dispose(),this._model.dispose()},e.MODEL_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",e.MODEL_FILENAME="mrtk-fluent-backplate.glb",e}(ut),Tt=function(t){function e(e,i){void 0===i&&(i=!0);var o=t.call(this,e)||this;return o._shareMaterials=!0,o._shareMaterials=i,o.pointerEnterAnimation=function(){o.mesh&&o._frontPlate.setEnabled(!0)},o.pointerOutAnimation=function(){o.mesh&&o._frontPlate.setEnabled(!1)},o}return r(e,t),e.prototype._disposeTooltip=function(){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)},Object.defineProperty(e.prototype,"renderingGroupId",{get:function(){return this._backPlate.renderingGroupId},set:function(t){this._backPlate.renderingGroupId=t,this._textPlate.renderingGroupId=t,this._frontPlate.renderingGroupId=t,this._tooltipMesh&&(this._tooltipMesh.renderingGroupId=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tooltipText",{get:function(){return this._tooltipTextBlock?this._tooltipTextBlock.text:null},set:function(t){var e=this;if(t){if(!this._tooltipFade){var i=this._backPlate._scene.useRightHandedSystem;this._tooltipMesh=(0,_.CreatePlane)("",{size:1},this._backPlate._scene);var o=(0,_.CreatePlane)("",{size:1,sideOrientation:_.Mesh.DOUBLESIDE},this._backPlate._scene),n=new _.StandardMaterial("",this._backPlate._scene);n.diffuseColor=_.Color3.FromHexString("#212121"),o.material=n,o.isPickable=!1,this._tooltipMesh.addChild(o),o.position=_.Vector3.Forward(i).scale(.05),this._tooltipMesh.scaling.y=1/3,this._tooltipMesh.position=_.Vector3.Up().scale(.7).add(_.Vector3.Forward(i).scale(-.15)),this._tooltipMesh.isPickable=!1,this._tooltipMesh.parent=this._backPlate,this._tooltipTexture=st.CreateForMesh(this._tooltipMesh),this._tooltipTextBlock=new I,this._tooltipTextBlock.scaleY=3,this._tooltipTextBlock.color="white",this._tooltipTextBlock.fontSize=130,this._tooltipTexture.addControl(this._tooltipTextBlock),this._tooltipFade=new _.FadeInOutBehavior,this._tooltipFade.delay=500,this._tooltipMesh.addBehavior(this._tooltipFade),this._tooltipHoverObserver=this.onPointerEnterObservable.add((function(){e._tooltipFade&&e._tooltipFade.fadeIn(!0)})),this._tooltipOutObserver=this.onPointerOutObservable.add((function(){e._tooltipFade&&e._tooltipFade.fadeIn(!1)}))}this._tooltipTextBlock&&(this._tooltipTextBlock.text=t)}else this._disposeTooltip()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){this._text!==t&&(this._text=t,this._rebuildContent())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"imageUrl",{get:function(){return this._imageUrl},set:function(t){this._imageUrl!==t&&(this._imageUrl=t,this._rebuildContent())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backMaterial",{get:function(){return this._backMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"frontMaterial",{get:function(){return this._frontMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"plateMaterial",{get:function(){return this._plateMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shareMaterials",{get:function(){return this._shareMaterials},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"HolographicButton"},e.prototype._rebuildContent=function(){this._disposeFacadeTexture();var t=new T;if(t.isVertical=!0,_.DomManagement.IsDocumentAvailable()&&document.createElement&&this._imageUrl){var e=new B;e.source=this._imageUrl,e.paddingTop="40px",e.height="180px",e.width="100px",e.paddingBottom="40px",t.addControl(e)}if(this._text){var i=new I;i.text=this._text,i.color="white",i.height="30px",i.fontSize=24,t.addControl(i)}this._frontPlate&&(this.content=t)},e.prototype._createNode=function(e){return this._backPlate=(0,_.CreateBox)(this.name+"BackMesh",{width:1,height:1,depth:.08},e),this._frontPlate=(0,_.CreateBox)(this.name+"FrontMesh",{width:1,height:1,depth:.08},e),this._frontPlate.parent=this._backPlate,this._frontPlate.position=_.Vector3.Forward(e.useRightHandedSystem).scale(-.08),this._frontPlate.isPickable=!1,this._frontPlate.setEnabled(!1),this._textPlate=t.prototype._createNode.call(this,e),this._textPlate.parent=this._backPlate,this._textPlate.position=_.Vector3.Forward(e.useRightHandedSystem).scale(-.08),this._textPlate.isPickable=!1,this._backPlate},e.prototype._applyFacade=function(t){this._plateMaterial.emissiveTexture=t,this._plateMaterial.opacityTexture=t},e.prototype._createBackMaterial=function(t){var e=this;this._backMaterial=new yt(this.name+"Back Material",t.getScene()),this._backMaterial.renderHoverLight=!0,this._pickedPointObserver=this._host.onPickedPointChangedObservable.add((function(t){t?(e._backMaterial.hoverPosition=t,e._backMaterial.hoverColor.a=1):e._backMaterial.hoverColor.a=0}))},e.prototype._createFrontMaterial=function(t){this._frontMaterial=new yt(this.name+"Front Material",t.getScene()),this._frontMaterial.innerGlowColorIntensity=0,this._frontMaterial.alpha=.5,this._frontMaterial.renderBorders=!0},e.prototype._createPlateMaterial=function(t){this._plateMaterial=new _.StandardMaterial(this.name+"Plate Material",t.getScene()),this._plateMaterial.specularColor=_.Color3.Black()},e.prototype._affectMaterial=function(t){this._shareMaterials?(this._host._sharedMaterials.backFluentMaterial?this._backMaterial=this._host._sharedMaterials.backFluentMaterial:(this._createBackMaterial(t),this._host._sharedMaterials.backFluentMaterial=this._backMaterial),this._host._sharedMaterials.frontFluentMaterial?this._frontMaterial=this._host._sharedMaterials.frontFluentMaterial:(this._createFrontMaterial(t),this._host._sharedMaterials.frontFluentMaterial=this._frontMaterial)):(this._createBackMaterial(t),this._createFrontMaterial(t)),this._createPlateMaterial(t),this._backPlate.material=this._backMaterial,this._frontPlate.material=this._frontMaterial,this._textPlate.material=this._plateMaterial,this._rebuildContent()},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._disposeTooltip(),this.shareMaterials||(this._backMaterial.dispose(),this._frontMaterial.dispose(),this._plateMaterial.dispose(),this._pickedPointObserver&&(this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver),this._pickedPointObserver=null))},e}(pt);_.ShaderStore.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}";_.ShaderStore.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}";var St=function(t){function e(){var e=t.call(this)||this;return e.RELATIVE_WIDTH=!0,e.ENABLE_FADE=!0,e._needNormals=!0,e._needUVs=!0,e.rebuild(),e}return r(e,t),e}(_.MaterialDefines),Ot=function(t){function e(i,o){var n=t.call(this,i,o)||this;return n.edgeWidth=.04,n.edgeColor=new _.Color4(.592157,.592157,.592157,1),n.proximityMaxIntensity=.45,n.proximityFarDistance=.16,n.proximityNearRadius=1.5,n.proximityAnisotropy=1,n.selectionFuzz=.5,n.selected=0,n.selectionFade=0,n.selectionFadeSize=.3,n.selectedDistance=.08,n.selectedFadeLength=.08,n.blobIntensity=.5,n.blobFarSize=.05,n.blobNearDistance=0,n.blobFarDistance=.08,n.blobFadeLength=.08,n.leftBlobEnable=!0,n.leftBlobNearSize=.025,n.leftBlobPulse=0,n.leftBlobFade=1,n.leftBlobInnerFade=.01,n.rightBlobEnable=!0,n.rightBlobNearSize=.025,n.rightBlobPulse=0,n.rightBlobFade=1,n.rightBlobInnerFade=.01,n.activeFaceDir=new _.Vector3(0,0,-1),n.activeFaceUp=new _.Vector3(0,1,0),n.enableFade=!0,n.fadeWidth=1.5,n.smoothActiveFace=!0,n.showFrame=!1,n.useBlobTexture=!0,n.globalLeftIndexTipPosition=_.Vector3.Zero(),n.globalRightIndexTipPosition=_.Vector3.Zero(),n.alphaMode=_.Constants.ALPHA_ADD,n.disableDepthWrite=!0,n.backFaceCulling=!1,n._blobTexture=new _.Texture(e.BLOB_TEXTURE_URL,n.getScene(),!0,!1,_.Texture.NEAREST_SAMPLINGMODE),n}return r(e,t),e.prototype.needAlphaBlending=function(){return!0},e.prototype.needAlphaTesting=function(){return!0},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){if(this.isFrozen&&e.effect&&e.effect._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new St);var i=e.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(e))return!0;var n=o.getEngine();if(_.MaterialHelper.PrepareDefinesForAttributes(t,i,!0,!1),i.isDirty){i.markAsProcessed(),o.resetCachedMaterial();var r=new _.EffectFallbacks;i.FOG&&r.addFallback(1,"FOG"),_.MaterialHelper.HandleFallbacksForShadows(i,r),i.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;var a=[_.VertexBuffer.PositionKind];i.NORMAL&&a.push(_.VertexBuffer.NormalKind),i.UV1&&a.push(_.VertexBuffer.UVKind),i.UV2&&a.push(_.VertexBuffer.UV2Kind),i.VERTEXCOLOR&&a.push(_.VertexBuffer.ColorKind),i.TANGENT&&a.push(_.VertexBuffer.TangentKind),_.MaterialHelper.PrepareAttributesForInstances(a,i);var s=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"],h=["_Blob_Texture_"],c=new Array;_.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:l,uniformBuffersNames:c,samplers:h,defines:i,maxSimultaneousLights:4}),e.setEffect(o.getEngine().createEffect("fluentButton",{attributes:a,uniformsNames:l,uniformBuffersNames:c,samplers:h,defines:s,fallbacks:r,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),i,this._materialContext)}return!(!e.effect||!e.effect.isReady()||(i._renderId=o.getRenderId(),e.effect._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){var o=this.getScene();if(i.materialDefines){var n=i.effect;n&&(this._activeEffect=n,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",o.getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",o.activeCamera.position),this._activeEffect.setTexture("_Blob_Texture_",this._blobTexture),this._activeEffect.setFloat("_Edge_Width_",this.edgeWidth),this._activeEffect.setColor4("_Edge_Color_",new _.Color3(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 _.Vector4(this.globalLeftIndexTipPosition.x,this.globalLeftIndexTipPosition.y,this.globalLeftIndexTipPosition.z,1)),this._activeEffect.setVector4("Global_Right_Index_Tip_Position",new _.Vector4(this.globalRightIndexTipPosition.x,this.globalRightIndexTipPosition.y,this.globalRightIndexTipPosition.z,1)),this._afterBind(e,this._activeEffect))}},e.prototype.getAnimatables=function(){return[]},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e)},e.prototype.clone=function(t){var i=this;return _.SerializationHelper.Clone((function(){return new e(t,i.getScene())}),this)},e.prototype.serialize=function(){var e=t.prototype.serialize.call(this);return e.customType="BABYLON.FluentButtonMaterial",e},e.prototype.getClassName=function(){return"FluentButtonMaterial"},e.Parse=function(t,i,o){return _.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},e.BLOB_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/mrtk-fluent-button-blob.png",a([(0,_.serialize)()],e.prototype,"edgeWidth",void 0),a([(0,_.serializeAsColor4)()],e.prototype,"edgeColor",void 0),a([(0,_.serialize)()],e.prototype,"proximityMaxIntensity",void 0),a([(0,_.serialize)()],e.prototype,"proximityFarDistance",void 0),a([(0,_.serialize)()],e.prototype,"proximityNearRadius",void 0),a([(0,_.serialize)()],e.prototype,"proximityAnisotropy",void 0),a([(0,_.serialize)()],e.prototype,"selectionFuzz",void 0),a([(0,_.serialize)()],e.prototype,"selected",void 0),a([(0,_.serialize)()],e.prototype,"selectionFade",void 0),a([(0,_.serialize)()],e.prototype,"selectionFadeSize",void 0),a([(0,_.serialize)()],e.prototype,"selectedDistance",void 0),a([(0,_.serialize)()],e.prototype,"selectedFadeLength",void 0),a([(0,_.serialize)()],e.prototype,"blobIntensity",void 0),a([(0,_.serialize)()],e.prototype,"blobFarSize",void 0),a([(0,_.serialize)()],e.prototype,"blobNearDistance",void 0),a([(0,_.serialize)()],e.prototype,"blobFarDistance",void 0),a([(0,_.serialize)()],e.prototype,"blobFadeLength",void 0),a([(0,_.serialize)()],e.prototype,"leftBlobEnable",void 0),a([(0,_.serialize)()],e.prototype,"leftBlobNearSize",void 0),a([(0,_.serialize)()],e.prototype,"leftBlobPulse",void 0),a([(0,_.serialize)()],e.prototype,"leftBlobFade",void 0),a([(0,_.serialize)()],e.prototype,"leftBlobInnerFade",void 0),a([(0,_.serialize)()],e.prototype,"rightBlobEnable",void 0),a([(0,_.serialize)()],e.prototype,"rightBlobNearSize",void 0),a([(0,_.serialize)()],e.prototype,"rightBlobPulse",void 0),a([(0,_.serialize)()],e.prototype,"rightBlobFade",void 0),a([(0,_.serialize)()],e.prototype,"rightBlobInnerFade",void 0),a([(0,_.serializeAsVector3)()],e.prototype,"activeFaceDir",void 0),a([(0,_.serializeAsVector3)()],e.prototype,"activeFaceUp",void 0),a([(0,_.serialize)()],e.prototype,"enableFade",void 0),a([(0,_.serialize)()],e.prototype,"fadeWidth",void 0),a([(0,_.serialize)()],e.prototype,"smoothActiveFace",void 0),a([(0,_.serialize)()],e.prototype,"showFrame",void 0),a([(0,_.serialize)()],e.prototype,"useBlobTexture",void 0),a([(0,_.serializeAsVector3)()],e.prototype,"globalLeftIndexTipPosition",void 0),a([(0,_.serializeAsVector3)()],e.prototype,"globalRightIndexTipPosition",void 0),e}(_.PushMaterial);(0,_.RegisterClass)("BABYLON.GUI.FluentButtonMaterial",Ot);var Rt=function(t){function e(e,i){var o=t.call(this,e)||this;return o._isNearPressed=!1,o._interactionSurfaceHeight=0,o._isToggleButton=!1,o._toggleState=!1,o._toggleButtonCallback=function(){o._onToggle(!o._toggleState)},o.onToggleObservable=new _.Observable,o.collidableFrontDirection=_.Vector3.Zero(),i&&(o.collisionMesh=i),o}return r(e,t),Object.defineProperty(e.prototype,"isActiveNearInteraction",{get:function(){return this._isNearPressed},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"collidableFrontDirection",{get:function(){if(this._collisionMesh){var t=_.TmpVectors.Vector3[0];return _.Vector3.TransformNormalToRef(this._collidableFrontDirection,this._collisionMesh.getWorldMatrix(),t),t.normalize()}return this._collidableFrontDirection},set:function(t){if(this._collidableFrontDirection=t.normalize(),this._collisionMesh){var e=_.TmpVectors.Matrix[0];e.copyFrom(this._collisionMesh.getWorldMatrix()),e.invert(),_.Vector3.TransformNormalToRef(this._collidableFrontDirection,e,this._collidableFrontDirection),this._collidableFrontDirection.normalize()}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"collisionMesh",{set:function(t){var e,i=this;this._collisionMesh&&(this._collisionMesh.isNearPickable=!1,(null===(e=this._collisionMesh.reservedDataStore)||void 0===e?void 0:e.GUI3D)&&(this._collisionMesh.reservedDataStore.GUI3D={}),this._collisionMesh.getChildMeshes().forEach((function(t){var e;t.isNearPickable=!1,(null===(e=t.reservedDataStore)||void 0===e?void 0:e.GUI3D)&&(t.reservedDataStore.GUI3D={})}))),this._collisionMesh=t,this._injectGUI3DReservedDataStore(this._collisionMesh).control=this,this._collisionMesh.isNearPickable=!0,this._collisionMesh.getChildMeshes().forEach((function(t){i._injectGUI3DReservedDataStore(t).control=i,t.isNearPickable=!0})),this.collidableFrontDirection=t.forward},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isToggleButton",{get:function(){return this._isToggleButton},set:function(t){t!==this._isToggleButton&&(this._isToggleButton=t,t?this.onPointerUpObservable.add(this._toggleButtonCallback):(this.onPointerUpObservable.removeCallback(this._toggleButtonCallback),this._toggleState&&this._onToggle(!1)))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isToggled",{get:function(){return this._toggleState},set:function(t){this._isToggleButton&&this._toggleState!==t&&this._onToggle(t)},enumerable:!1,configurable:!0}),e.prototype._onToggle=function(t){this._toggleState=t,this.onToggleObservable.notifyObservers(t)},e.prototype._isInteractionInFrontOfButton=function(t){return this._getInteractionHeight(t,this._collisionMesh.getAbsolutePosition())>0},e.prototype.getPressDepth=function(t){if(!this._isNearPressed)return 0;var e=this._getInteractionHeight(t,this._collisionMesh.getAbsolutePosition());return this._interactionSurfaceHeight-e},e.prototype._getInteractionHeight=function(t,e){var i=this.collidableFrontDirection;if(0===i.length())return _.Vector3.Distance(t,e);var o=_.Vector3.Dot(e,i);return _.Vector3.Dot(t,i)-o},e.prototype._generatePointerEventType=function(t,e,i){if(t===_.PointerEventTypes.POINTERDOWN||t===_.PointerEventTypes.POINTERMOVE){if(!this._isInteractionInFrontOfButton(e))return _.PointerEventTypes.POINTERMOVE;this._isNearPressed=!0,this._interactionSurfaceHeight=this._getInteractionHeight(e,this._collisionMesh.getAbsolutePosition())}if(t===_.PointerEventTypes.POINTERUP){if(0==i)return _.PointerEventTypes.POINTERMOVE;this._isNearPressed=!1}return t},e.prototype._getTypeName=function(){return"TouchButton3D"},e.prototype._createNode=function(e){return t.prototype._createNode.call(this,e)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.onPointerUpObservable.removeCallback(this._toggleButtonCallback),this.onToggleObservable.clear(),this._collisionMesh&&this._collisionMesh.dispose()},e}(pt),wt=function(t){function e(e,i){void 0===i&&(i=!0);var o=t.call(this,e)||this;return o._shareMaterials=!0,o._isBackplateVisible=!0,o._frontPlateDepth=.5,o._backPlateDepth=.04,o._backplateColor=new _.Color3(.08,.15,.55),o._backplateToggledColor=new _.Color3(.25,.4,.95),o._shareMaterials=i,o.pointerEnterAnimation=function(){o._frontMaterial.leftBlobEnable=!0,o._frontMaterial.rightBlobEnable=!0},o.pointerOutAnimation=function(){o._frontMaterial.leftBlobEnable=!1,o._frontMaterial.rightBlobEnable=!1},o.pointerDownAnimation=function(){o._frontPlate&&!o.isActiveNearInteraction&&(o._frontPlate.scaling.z=.2*o._frontPlateDepth,o._frontPlate.position=_.Vector3.Forward(o._frontPlate._scene.useRightHandedSystem).scale((o._frontPlateDepth-.2*o._frontPlateDepth)/2),o._textPlate.position=_.Vector3.Forward(o._textPlate._scene.useRightHandedSystem).scale(-(o._backPlateDepth+.2*o._frontPlateDepth)/2))},o.pointerUpAnimation=function(){o._frontPlate&&(o._frontPlate.scaling.z=o._frontPlateDepth,o._frontPlate.position=_.Vector3.Forward(o._frontPlate._scene.useRightHandedSystem).scale((o._frontPlateDepth-o._frontPlateDepth)/2),o._textPlate.position=_.Vector3.Forward(o._textPlate._scene.useRightHandedSystem).scale(-(o._backPlateDepth+o._frontPlateDepth)/2))},o.onPointerMoveObservable.add((function(t){if(o._frontPlate&&o.isActiveNearInteraction){var e=_.Vector3.Zero();if(o._backPlate.getWorldMatrix().decompose(e,void 0,void 0)){var i=o._getInteractionHeight(t,o._backPlate.getAbsolutePosition())/e.z;i=_.Scalar.Clamp(i-o._backPlateDepth/2,.2*o._frontPlateDepth,o._frontPlateDepth),o._frontPlate.scaling.z=i,o._frontPlate.position=_.Vector3.Forward(o._frontPlate._scene.useRightHandedSystem).scale((o._frontPlateDepth-i)/2),o._textPlate.position=_.Vector3.Forward(o._textPlate._scene.useRightHandedSystem).scale(-(o._backPlateDepth+i)/2)}}})),o._pointerHoverObserver=o.onPointerMoveObservable.add((function(t){o._frontMaterial.globalLeftIndexTipPosition=t})),o}return r(e,t),e.prototype._disposeTooltip=function(){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)},Object.defineProperty(e.prototype,"renderingGroupId",{get:function(){return this._backPlate.renderingGroupId},set:function(t){this._backPlate.renderingGroupId=t,this._textPlate.renderingGroupId=t,this._frontPlate.renderingGroupId=t,this._tooltipMesh&&(this._tooltipMesh.renderingGroupId=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mesh",{get:function(){return this._backPlate},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tooltipText",{get:function(){return this._tooltipTextBlock?this._tooltipTextBlock.text:null},set:function(t){var e=this;if(t){if(!this._tooltipFade){var i=this._backPlate._scene.useRightHandedSystem;this._tooltipMesh=(0,_.CreatePlane)("",{size:1},this._backPlate._scene);var o=(0,_.CreatePlane)("",{size:1,sideOrientation:_.Mesh.DOUBLESIDE},this._backPlate._scene),n=new _.StandardMaterial("",this._backPlate._scene);n.diffuseColor=_.Color3.FromHexString("#212121"),o.material=n,o.isPickable=!1,this._tooltipMesh.addChild(o),o.position=_.Vector3.Forward(i).scale(.05),this._tooltipMesh.scaling.y=1/3,this._tooltipMesh.position=_.Vector3.Up().scale(.7).add(_.Vector3.Forward(i).scale(-.15)),this._tooltipMesh.isPickable=!1,this._tooltipMesh.parent=this._backPlate,this._tooltipTexture=st.CreateForMesh(this._tooltipMesh),this._tooltipTextBlock=new I,this._tooltipTextBlock.scaleY=3,this._tooltipTextBlock.color="white",this._tooltipTextBlock.fontSize=130,this._tooltipTexture.addControl(this._tooltipTextBlock),this._tooltipFade=new _.FadeInOutBehavior,this._tooltipFade.delay=500,this._tooltipMesh.addBehavior(this._tooltipFade),this._tooltipHoverObserver=this.onPointerEnterObservable.add((function(){e._tooltipFade&&e._tooltipFade.fadeIn(!0)})),this._tooltipOutObserver=this.onPointerOutObservable.add((function(){e._tooltipFade&&e._tooltipFade.fadeIn(!1)}))}this._tooltipTextBlock&&(this._tooltipTextBlock.text=t)}else this._disposeTooltip()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){this._text!==t&&(this._text=t,this._rebuildContent())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"imageUrl",{get:function(){return this._imageUrl},set:function(t){this._imageUrl!==t&&(this._imageUrl=t,this._rebuildContent())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backMaterial",{get:function(){return this._backMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"frontMaterial",{get:function(){return this._frontMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"plateMaterial",{get:function(){return this._plateMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shareMaterials",{get:function(){return this._shareMaterials},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isBackplateVisible",{set:function(t){this.mesh&&this._backMaterial&&(t&&!this._isBackplateVisible?this._backPlate.visibility=1:!t&&this._isBackplateVisible&&(this._backPlate.visibility=0)),this._isBackplateVisible=t},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"TouchHolographicButton"},e.prototype._rebuildContent=function(){this._disposeFacadeTexture();var t=new T;if(t.isVertical=!0,_.DomManagement.IsDocumentAvailable()&&document.createElement&&this._imageUrl){var e=new B;e.source=this._imageUrl,e.paddingTop="40px",e.height="180px",e.width="100px",e.paddingBottom="40px",t.addControl(e)}if(this._text){var i=new I;i.text=this._text,i.color="white",i.height="30px",i.fontSize=24,t.addControl(i)}this.content=t},e.prototype._createNode=function(i){var o,n=this;this.name=null!==(o=this.name)&&void 0!==o?o:"TouchHolographicButton";var r=(0,_.CreateBox)("".concat(this.name,"_collisionMesh"),{width:1,height:1,depth:this._frontPlateDepth},i);r.isPickable=!0,r.isNearPickable=!0,r.visibility=0,r.position=_.Vector3.Forward(i.useRightHandedSystem).scale(-this._frontPlateDepth/2),_.SceneLoader.ImportMeshAsync(void 0,e.MODEL_BASE_URL,e.MODEL_FILENAME,i).then((function(t){var e=(0,_.CreateBox)("${this.name}_alphaMesh",{width:1,height:1,depth:1},i);e.isPickable=!1,e.material=new _.StandardMaterial("${this.name}_alphaMesh_material",i),e.material.alpha=.15;var o=t.meshes[1];o.name="".concat(n.name,"_frontPlate"),o.isPickable=!1,o.scaling.z=n._frontPlateDepth,e.parent=o,o.parent=r,n._frontMaterial&&(o.material=n._frontMaterial),n._frontPlate=o})),this._backPlate=(0,_.CreateBox)("".concat(this.name,"_backPlate"),{width:1,height:1,depth:this._backPlateDepth},i),this._backPlate.position=_.Vector3.Forward(i.useRightHandedSystem).scale(this._backPlateDepth/2),this._backPlate.isPickable=!1,this._textPlate=t.prototype._createNode.call(this,i),this._textPlate.name="".concat(this.name,"_textPlate"),this._textPlate.isPickable=!1,this._textPlate.position=_.Vector3.Forward(i.useRightHandedSystem).scale(-this._frontPlateDepth/2),this._backPlate.addChild(r),this._backPlate.addChild(this._textPlate);var a=new _.TransformNode("{this.name}_root",i);return this._backPlate.setParent(a),this.collisionMesh=r,this.collidableFrontDirection=this._backPlate.forward.negate(),a},e.prototype._applyFacade=function(t){this._plateMaterial.emissiveTexture=t,this._plateMaterial.opacityTexture=t,this._plateMaterial.diffuseColor=new _.Color3(.4,.4,.4)},e.prototype._createBackMaterial=function(t){this._backMaterial=new yt(this.name+"backPlateMaterial",t.getScene()),this._backMaterial.albedoColor=this._backplateColor,this._backMaterial.renderBorders=!0,this._backMaterial.renderHoverLight=!1},e.prototype._createFrontMaterial=function(t){this._frontMaterial=new Ot(this.name+"Front Material",t.getScene())},e.prototype._createPlateMaterial=function(t){this._plateMaterial=new _.StandardMaterial(this.name+"Plate Material",t.getScene()),this._plateMaterial.specularColor=_.Color3.Black()},e.prototype._onToggle=function(e){this._backMaterial&&(this._backMaterial.albedoColor=e?this._backplateToggledColor:this._backplateColor),t.prototype._onToggle.call(this,e)},e.prototype._affectMaterial=function(t){this._shareMaterials?(this._host._touchSharedMaterials.backFluentMaterial?this._backMaterial=this._host._touchSharedMaterials.backFluentMaterial:(this._createBackMaterial(t),this._host._touchSharedMaterials.backFluentMaterial=this._backMaterial),this._host._touchSharedMaterials.frontFluentMaterial?this._frontMaterial=this._host._touchSharedMaterials.frontFluentMaterial:(this._createFrontMaterial(t),this._host._touchSharedMaterials.frontFluentMaterial=this._frontMaterial)):(this._createBackMaterial(t),this._createFrontMaterial(t)),this._createPlateMaterial(t),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()},e.prototype.dispose=function(){t.prototype.dispose.call(this),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))},e.MODEL_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",e.MODEL_FILENAME="mrtk-fluent-button.glb",e}(Rt),Mt=function(){function t(){this.followBehaviorEnabled=!1,this.sixDofDragBehaviorEnabled=!0,this.surfaceMagnetismBehaviorEnabled=!0,this._followBehavior=new _.FollowBehavior,this._sixDofDragBehavior=new _.SixDofDragBehavior,this._surfaceMagnetismBehavior=new _.SurfaceMagnetismBehavior}return Object.defineProperty(t.prototype,"name",{get:function(){return"Default"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"followBehavior",{get:function(){return this._followBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sixDofDragBehavior",{get:function(){return this._sixDofDragBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"surfaceMagnetismBehavior",{get:function(){return this._surfaceMagnetismBehavior},enumerable:!1,configurable:!0}),t.prototype.init=function(){},t.prototype.attach=function(t,e,i){this._scene=t.getScene(),this.attachedNode=t,this._addObservables(),this._followBehavior.attach(t),this._sixDofDragBehavior.attach(t),this._sixDofDragBehavior.draggableMeshes=e||null,this._sixDofDragBehavior.faceCameraOnDragStart=!0,this._surfaceMagnetismBehavior.attach(t,this._scene),i&&(this._surfaceMagnetismBehavior.meshes=i),this._surfaceMagnetismBehavior.enabled=!1},t.prototype.detach=function(){this.attachedNode=null,this._removeObservables(),this._followBehavior.detach(),this._sixDofDragBehavior.detach(),this._surfaceMagnetismBehavior.detach()},t.prototype._addObservables=function(){var t=this;this._onBeforeRenderObserver=this._scene.onBeforeRenderObservable.add((function(){t._followBehavior._enabled=!t._sixDofDragBehavior.isMoving&&t.followBehaviorEnabled})),this._onDragObserver=this._sixDofDragBehavior.onDragObservable.add((function(e){t._sixDofDragBehavior.disableMovement=t._surfaceMagnetismBehavior.findAndUpdateTarget(e.pickInfo)}))},t.prototype._removeObservables=function(){this._scene.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),this._sixDofDragBehavior.onDragObservable.remove(this._onDragObserver)},t}();_.ShaderStore.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}";_.ShaderStore.ShadersStore.handlePixelShader="uniform vec3 color;\nvoid main(void) {\ngl_FragColor=vec4(color,1.0);\n}";var Et,Ft=function(t){function e(e,i){var o=t.call(this,e,i,"handle",{attributes:["position"],uniforms:["worldViewProjection","color","scale","positionOffset"],needAlphaBlending:!1,needAlphaTesting:!1})||this;return o._hover=!1,o._drag=!1,o._color=new _.Color3,o._scale=1,o._lastTick=-1,o.animationLength=100,o.hoverColor=new _.Color3(0,.467,.84),o.baseColor=new _.Color3(1,1,1),o.hoverScale=.75,o.baseScale=.35,o.dragScale=.55,o._positionOffset=_.Vector3.Zero(),o._updateInterpolationTarget(),o._lastTick=Date.now(),o._onBeforeRender=o.getScene().onBeforeRenderObservable.add((function(){var t=Date.now(),e=t-o._lastTick,i=o._targetScale-o._scale,n=_.TmpColors.Color3[0].copyFrom(o._targetColor).subtractToRef(o._color,_.TmpColors.Color3[0]);o._scale=o._scale+i*e/o.animationLength,n.scaleToRef(e/o.animationLength,n),o._color.addToRef(n,o._color),o.setColor3("color",o._color),o.setFloat("scale",o._scale),o.setVector3("positionOffset",o._positionOffset),o._lastTick=t})),o}return r(e,t),Object.defineProperty(e.prototype,"hover",{get:function(){return this._hover},set:function(t){this._hover=t,this._updateInterpolationTarget()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"drag",{get:function(){return this._drag},set:function(t){this._drag=t,this._updateInterpolationTarget()},enumerable:!1,configurable:!0}),e.prototype._updateInterpolationTarget=function(){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)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.getScene().onBeforeRenderObservable.remove(this._onBeforeRender)},e}(_.ShaderMaterial);!function(t){t[t.IDLE=0]="IDLE",t[t.HOVER=1]="HOVER",t[t.DRAG=2]="DRAG"}(Et||(Et={}));var Dt=function(){function t(t,e){this._state=Et.IDLE,this._materials=[],this._scene=e,this._gizmo=t,this.node=this.createNode(),this.node.reservedDataStore={handle:this}}return Object.defineProperty(t.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"gizmo",{get:function(){return this._gizmo},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hover",{set:function(t){t?this._state|=Et.HOVER:this._state&=~Et.HOVER,this._updateMaterial()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"drag",{set:function(t){t?this._state|=Et.DRAG:this._state&=~Et.DRAG,this._updateMaterial()},enumerable:!1,configurable:!0}),t.prototype._createMaterial=function(t){var e=new Ft("handle",this._scene);return t&&(e._positionOffset=t),e},t.prototype._updateMaterial=function(){for(var t=this._state,e=0,i=this._materials;e<i.length;e++)(s=i[e]).hover=!1,s.drag=!1;if(t&Et.DRAG)for(var o=0,n=this._materials;o<n.length;o++)(s=n[o]).drag=!0;else if(t&Et.HOVER)for(var r=0,a=this._materials;r<a.length;r++){var s;(s=a[r]).hover=!0}},t.prototype.setDragBehavior=function(t,e,i){var o=new _.BaseSixDofDragBehavior;this._dragBehavior=o,this._dragStartObserver=o.onDragStartObservable.add(t),this._draggingObserver=o.onDragObservable.add(e),this._dragEndObserver=o.onDragEndObservable.add(i),this._dragBehavior.attach(this.node)},t.prototype.dispose=function(){this._dragBehavior.onDragStartObservable.remove(this._dragStartObserver),this._dragBehavior.onDragObservable.remove(this._draggingObserver),this._dragBehavior.onDragEndObservable.remove(this._dragEndObserver),this._dragBehavior.detach();for(var t=0,e=this._materials;t<e.length;t++)e[t].dispose();this.node.dispose()},t}(),Lt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.createNode=function(){var t=(0,_.CreateBox)("sideVert",{width:1,height:10,depth:.1},this._scene),e=new _.TransformNode("side",this._scene);t.parent=e;var i=this._createMaterial();return t.material=i,t.isNearGrabbable=!0,this._materials.push(i),e},e}(Dt),kt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.createNode=function(){var t=(0,_.CreateBox)("angleHor",{width:3,height:1,depth:.1},this._scene),e=(0,_.CreateBox)("angleVert",{width:1,height:3,depth:.1},this._scene),i=new _.TransformNode("angle",this._scene);return t.parent=i,e.parent=i,t.material=this._createMaterial(new _.Vector3(1,0,0)),e.material=this._createMaterial(new _.Vector3(0,1,0)),e.isNearGrabbable=!0,t.isNearGrabbable=!0,this._materials.push(t.material),this._materials.push(e.material),i},e}(Dt),Nt=function(t){function e(e){var i=t.call(this,e)||this;return i._boundingDimensions=new _.Vector3(0,0,0),i._renderObserver=null,i._tmpQuaternion=new _.Quaternion,i._tmpVector=new _.Vector3(0,0,0),i._corners=[],i._sides=[],i._boundingBoxGizmo={min:new _.Vector3,max:new _.Vector3},i._margin=.35,i._handleSize=.075,i._attachedSlate=null,i._existingSlateScale=new _.Vector3,i.fixedScreenSize=!1,i.fixedScreenSizeDistanceFactor=10,i._createNode(),i.updateScale=!1,i._renderObserver=i.gizmoLayer.originalScene.onBeforeRenderObservable.add((function(){i.attachedMesh&&!i._existingSlateScale.equals(i.attachedMesh.scaling)&&i.updateBoundingBox()})),i}return r(e,t),Object.defineProperty(e.prototype,"attachedSlate",{get:function(){return this._attachedSlate},set:function(t){var e=this;t?(this.attachedMesh=t.mesh,this.updateBoundingBox(),this._pickedPointObserver=t._host.onPickingObservable.add((function(t){if(!e._handleHovered||t&&t.parent===e._handleHovered.node||(e._handleHovered.hover=!1,e._handleHovered=null),t&&t.parent&&t.parent.reservedDataStore&&t.parent.reservedDataStore.handle){var i=t.parent.reservedDataStore.handle;i.gizmo===e&&(e._handleHovered=i,e._handleHovered.hover=!0)}}))):this._attachedSlate&&this._attachedSlate._host.onPickingObservable.remove(this._pickedPointObserver),this._attachedSlate=t},enumerable:!1,configurable:!0}),e.prototype._createNode=function(){var t=this;this._handlesParent=new _.TransformNode("handlesParent",this.gizmoLayer.utilityLayerScene),this._handlesParent.rotationQuaternion=_.Quaternion.Identity();for(var e=[{dimensions:new _.Vector3(-1,-1,0),origin:new _.Vector3(1,0,0)},{dimensions:new _.Vector3(1,-1,0),origin:new _.Vector3(0,0,0)},{dimensions:new _.Vector3(1,1,0),origin:new _.Vector3(0,1,0)},{dimensions:new _.Vector3(-1,1,0),origin:new _.Vector3(1,1,0)}],i=0;i<4;i++){var o=new kt(this,this.gizmoLayer.utilityLayerScene);this._corners.push(o),o.node.rotation.z=Math.PI/2*i,o.node.parent=this._handlesParent,this._assignDragBehaviorCorners(o,(function(e,i,o,n){return t._moveHandle(e,i,o,n,!0)}),e[i])}for(i=0;i<4;i++){var n=new Lt(this,this.gizmoLayer.utilityLayerScene);this._sides.push(n),n.node.rotation.z=Math.PI/2*i,n.node.parent=this._handlesParent,this._assignDragBehaviorSides(n,i%2==0?new _.Vector3(0,1,0):new _.Vector3(1,0,0))}this._handlesParent.parent=this._rootMesh},e.prototype._keepAspectRatio=function(t,e,i){void 0===i&&(i=!1);var o=_.TmpVectors.Vector3[0];o.copyFromFloats(e,1,0).normalize(),i&&(o.y*=-1);var n=_.Vector3.Dot(t,o);t.copyFrom(o).scaleInPlace(n)},e.prototype._clampDimensions=function(t,e,i,o){void 0===o&&(o=!1);var n=_.TmpVectors.Vector3[0];n.copyFrom(t).multiplyInPlace(i);var r=_.TmpVectors.Vector3[1];if(r.copyFromFloats(Math.max(this._attachedSlate.minDimensions.x,n.x+e.x),Math.max(this._attachedSlate.minDimensions.y,n.y+e.y),0),o){var a=e.x/e.y;r.x=Math.max(r.x,r.y*a),r.y=Math.max(r.y,r.x/a)}n.copyFrom(r).subtractInPlace(e),t.x=Math.sign(t.x)*Math.abs(n.x),t.y=Math.sign(t.y)*Math.abs(n.y)},e.prototype._moveHandle=function(t,e,i,o,n){if(this._attachedSlate){if(n){var r=e.x/e.y;this._keepAspectRatio(i,r,o.dimensions.x*o.dimensions.y<0)}this._clampDimensions(i,e,o.dimensions,n);var a=_.TmpVectors.Vector3[0],s=_.TmpVectors.Vector3[1];a.copyFrom(i).multiplyInPlace(o.origin),s.copyFrom(i).multiplyInPlace(o.dimensions),this._attachedSlate.origin.copyFrom(t).addInPlace(a),this._attachedSlate.dimensions.set(e.x+s.x,e.y+s.y)}},e.prototype._assignDragBehaviorCorners=function(t,e,i){var o=this,n=new _.Vector3,r=new _.Vector3,a=new _.Vector3,s=new _.Matrix,l=new _.Vector3;t.setDragBehavior((function(t){o.attachedSlate&&o.attachedMesh&&(n.set(o.attachedSlate.dimensions.x,o.attachedSlate.dimensions.y,_.Epsilon),r.copyFrom(o.attachedSlate.origin),a.copyFrom(t.position),s.copyFrom(o.attachedMesh.computeWorldMatrix(!0)),s.invert(),o.attachedSlate._followButton.isToggled=!1,_.Vector3.TransformNormalToRef(_.Vector3.Forward(),o.attachedMesh.getWorldMatrix(),l),l.normalize(),o._handleHovered&&(o._handleDragged=o._handleHovered,o._handleDragged.drag=!0))}),(function(t){o.attachedSlate&&o.attachedMesh&&(function(t,e,i,o){t.subtractToRef(i,_.TmpVectors.Vector3[0]);var n=_.Vector3.Dot(_.TmpVectors.Vector3[0],e);_.TmpVectors.Vector3[1].copyFrom(e).scaleInPlace(n),_.TmpVectors.Vector3[0].subtractInPlace(_.TmpVectors.Vector3[1]),_.TmpVectors.Vector3[0].addToRef(i,o)}(t.position,l,a,o._tmpVector),o._tmpVector.subtractInPlace(a),_.Vector3.TransformNormalToRef(o._tmpVector,s,o._tmpVector),e(r,n,o._tmpVector,i),o.attachedSlate._positionElements(),o.updateBoundingBox())}),(function(){o.attachedSlate&&o.attachedNode&&(o.attachedSlate._updatePivot(),o._handleDragged&&(o._handleDragged.drag=!1,o._handleDragged=null))}))},e.prototype._assignDragBehaviorSides=function(t,e){var i=this,o=new _.Quaternion,n=new _.Vector3,r=new _.Vector3,a=new _.Vector3,s=new _.Vector3;t.setDragBehavior((function(t){i.attachedSlate&&i.attachedMesh&&(o.copyFrom(i.attachedMesh.rotationQuaternion),n.copyFrom(t.position),a.copyFrom(i.attachedMesh.getAbsolutePivotPoint()),r.copyFrom(n).subtractInPlace(a).normalize(),i.attachedSlate._followButton.isToggled=!1,_.Vector3.TransformNormalToRef(e,i.attachedMesh.getWorldMatrix(),s),s.normalize(),i._handleHovered&&(i._handleDragged=i._handleHovered,i._handleDragged.drag=!0))}),(function(t){if(i.attachedSlate&&i.attachedMesh){i._tmpVector.copyFrom(t.position),i._tmpVector.subtractInPlace(a),i._tmpVector.normalize();var n=-_.Vector3.GetAngleBetweenVectorsOnPlane(i._tmpVector,r,s);_.Quaternion.RotationAxisToRef(e,n,i._tmpQuaternion),o.multiplyToRef(i._tmpQuaternion,i.attachedMesh.rotationQuaternion)}}),(function(){i.attachedSlate&&i.attachedNode&&(i.attachedSlate._updatePivot(),i._handleDragged&&(i._handleDragged.drag=!1,i._handleDragged=null))}))},e.prototype._attachedNodeChanged=function(t){t&&this.updateBoundingBox()},e.prototype.updateBoundingBox=function(){if(this.attachedMesh){_.PivotTools._RemoveAndStorePivotPoint(this.attachedMesh);var t=this.attachedMesh.parent;this.attachedMesh.setParent(null),this._update(),this.attachedMesh.rotationQuaternion||(this.attachedMesh.rotationQuaternion=_.Quaternion.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);var e=this.attachedMesh.getHierarchyBoundingVectors();e.max.subtractToRef(e.min,this._boundingDimensions),this._boundingBoxGizmo.min=e.min,this._boundingBoxGizmo.max=e.max,this._updateHandlesPosition(),this._updateHandlesScaling(),this.attachedMesh.rotationQuaternion.copyFrom(this._tmpQuaternion),this.attachedMesh.position.copyFrom(this._tmpVector),_.PivotTools._RestorePivotPoint(this.attachedMesh),this.attachedMesh.setParent(t),this.attachedMesh.computeWorldMatrix(!0),this._existingSlateScale.copyFrom(this.attachedMesh.scaling)}},e.prototype._updateHandlesPosition=function(){var t=this._boundingBoxGizmo.min.clone(),e=this._boundingBoxGizmo.max.clone(),i=this._corners[0].node.scaling.length();t.x-=this._margin*i,t.y-=this._margin*i,e.x+=this._margin*i,e.y+=this._margin*i;var o=t.add(e).scaleInPlace(.5);this._corners[0].node.position.copyFromFloats(t.x,t.y,0),this._corners[1].node.position.copyFromFloats(e.x,t.y,0),this._corners[2].node.position.copyFromFloats(e.x,e.y,0),this._corners[3].node.position.copyFromFloats(t.x,e.y,0),this._sides[0].node.position.copyFromFloats(t.x,o.y,0),this._sides[1].node.position.copyFromFloats(o.x,t.y,0),this._sides[2].node.position.copyFromFloats(e.x,o.y,0),this._sides[3].node.position.copyFromFloats(o.x,e.y,0)},e.prototype._updateHandlesScaling=function(){if(this._attachedSlate&&this._attachedSlate.mesh){for(var t=this._attachedSlate.mesh.scaling.x*this._attachedSlate.dimensions.x,e=this._attachedSlate.mesh.scaling.y*this._attachedSlate.dimensions.y,i=Math.min(t,e)*this._handleSize,o=0;o<this._corners.length;o++)this._corners[o].node.scaling.setAll(i);for(o=0;o<this._sides.length;o++)this._sides[o].node.scaling.setAll(i)}},e.prototype._update=function(){if(t.prototype._update.call(this),this.gizmoLayer.utilityLayerScene.activeCamera&&this._attachedSlate&&this._attachedSlate.mesh){if(this.fixedScreenSize){this._attachedSlate.mesh.absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position,this._tmpVector);for(var e=this._handleSize*this._tmpVector.length()/this.fixedScreenSizeDistanceFactor,i=0;i<this._corners.length;i++)this._corners[i].node.scaling.set(e,e,e);for(i=0;i<this._sides.length;i++)this._sides[i].node.scaling.set(e,e,e)}this._updateHandlesPosition()}},e.prototype.dispose=function(){this.gizmoLayer.originalScene.onBeforeRenderObservable.remove(this._renderObserver),t.prototype.dispose.call(this);for(var e=0,i=this._corners;e<i.length;e++)i[e].dispose();for(var o=0,n=this._sides;o<n.length;o++)n[o].dispose()},e}(_.Gizmo),At=function(t){function e(e){var i=t.call(this,e)||this;return i.titleBarMargin=.005,i.origin=new _.Vector3(0,0,0),i._dimensions=new _.Vector2(21.875,12.5),i._titleBarHeight=.625,i._titleText="",i._contentScaleRatio=1,i.minDimensions=new _.Vector2(15.625,6.25),i.defaultDimensions=i._dimensions.clone(),i._followButton=new wt("followButton"+i.name),i._followButton.isToggleButton=!0,i._closeButton=new wt("closeButton"+i.name),i._contentViewport=new _.Viewport(0,0,1,1),i._contentDragBehavior=new _.PointerDragBehavior({dragPlaneNormal:new _.Vector3(0,0,-1)}),i}return r(e,t),Object.defineProperty(e.prototype,"defaultBehavior",{get:function(){return this._defaultBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dimensions",{get:function(){return this._dimensions},set:function(t){var e=1;if(t.x<this.minDimensions.x||t.y<this.minDimensions.y){var i=t.x/t.y;e=this.minDimensions.x/this.minDimensions.y>i?this.minDimensions.x/t.x:this.minDimensions.y/t.y}this._dimensions.copyFrom(t).scaleInPlace(e),this._updatePivot(),this._positionElements()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"titleBarHeight",{get:function(){return this._titleBarHeight},set:function(t){this._titleBarHeight=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderingGroupId",{get:function(){return this._titleBar.renderingGroupId},set:function(t){this._titleBar.renderingGroupId=t,this._titleBarTitle.renderingGroupId=t,this._contentPlate.renderingGroupId=t,this._backPlate.renderingGroupId=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"title",{get:function(){return this._titleText},set:function(t){this._titleText=t,this._titleTextComponent&&(this._titleTextComponent.text=t)},enumerable:!1,configurable:!0}),e.prototype._applyFacade=function(t){this._contentMaterial.albedoTexture=t,this._resetContentPositionAndZoom(),this._applyContentViewport(),t.attachToMesh(this._contentPlate,!0)},e.prototype._addControl=function(t){t._host=this._host,this._host.utilityLayer&&t._prepareNode(this._host.utilityLayer.utilityLayerScene)},e.prototype._getTypeName=function(){return"HolographicSlate"},e.prototype._positionElements=function(){var t=this._followButton,i=this._closeButton,o=this._titleBar,n=this._titleBarTitle,r=this._contentPlate,a=this._backPlate;if(t&&i&&o){i.scaling.setAll(this.titleBarHeight),t.scaling.setAll(this.titleBarHeight),i.position.copyFromFloats(this.dimensions.x-this.titleBarHeight/2,-this.titleBarHeight/2,0).addInPlace(this.origin),t.position.copyFromFloats(this.dimensions.x-3*this.titleBarHeight/2,-this.titleBarHeight/2,0).addInPlace(this.origin);var s=this.dimensions.y-this.titleBarHeight-this.titleBarMargin,l=r.getScene().useRightHandedSystem;o.scaling.set(this.dimensions.x,this.titleBarHeight,_.Epsilon),n.scaling.set(this.dimensions.x-2*this.titleBarHeight,this.titleBarHeight,_.Epsilon),r.scaling.copyFromFloats(this.dimensions.x,s,_.Epsilon),a.scaling.copyFromFloats(this.dimensions.x,s,_.Epsilon),o.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,l?_.Epsilon:-_.Epsilon).addInPlace(this.origin),r.position.copyFromFloats(this.dimensions.x/2,-(this.titleBarHeight+this.titleBarMargin+s/2),0).addInPlace(this.origin),a.position.copyFromFloats(this.dimensions.x/2,-(this.titleBarHeight+this.titleBarMargin+s/2),l?-_.Epsilon:_.Epsilon).addInPlace(this.origin),this._titleTextComponent.host.scaleTo(e._DEFAULT_TEXT_RESOLUTION_Y*n.scaling.x/n.scaling.y,e._DEFAULT_TEXT_RESOLUTION_Y);var h=this.dimensions.x/s;this._contentViewport.width=this._contentScaleRatio,this._contentViewport.height=this._contentScaleRatio/h,this._applyContentViewport(),this._gizmo&&this._gizmo.updateBoundingBox()}},e.prototype._applyContentViewport=function(){var t;if((null===(t=this._contentPlate)||void 0===t?void 0:t.material)&&this._contentPlate.material.albedoTexture){var 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}},e.prototype._resetContentPositionAndZoom=function(){this._contentViewport.x=0,this._contentViewport.y=1-this._contentViewport.height/this._contentViewport.width,this._contentScaleRatio=1},e.prototype._updatePivot=function(){if(this.mesh){var t=new _.Vector3(.5*this.dimensions.x,.5*-this.dimensions.y,_.Epsilon);t.addInPlace(this.origin),t.z=0;var e=new _.Vector3(0,0,0);_.Vector3.TransformCoordinatesToRef(e,this.mesh.computeWorldMatrix(!0),e),this.mesh.setPivotPoint(t);var i=new _.Vector3(0,0,0);_.Vector3.TransformCoordinatesToRef(i,this.mesh.computeWorldMatrix(!0),i),this.mesh.position.addInPlace(e).subtractInPlace(i)}},e.prototype._createNode=function(t){var i=this,o=new _.Mesh("slate_"+this.name,t);this._titleBar=(0,_.CreateBox)("titleBar_"+this.name,{size:1},t),this._titleBarTitle=(0,_.CreatePlane)("titleText_"+this.name,{size:1},t),this._titleBarTitle.parent=o,this._titleBarTitle.isPickable=!1;var n=st.CreateForMesh(this._titleBarTitle);if(this._titleTextComponent=new I("titleText_"+this.name,this._titleText),this._titleTextComponent.textWrapping=x.Ellipsis,this._titleTextComponent.textHorizontalAlignment=v.HORIZONTAL_ALIGNMENT_LEFT,this._titleTextComponent.color="white",this._titleTextComponent.fontSize=e._DEFAULT_TEXT_RESOLUTION_Y/2,this._titleTextComponent.paddingLeft=e._DEFAULT_TEXT_RESOLUTION_Y/4,n.addControl(this._titleTextComponent),t.useRightHandedSystem){var r=new _.Vector4(0,0,1,1);this._contentPlate=(0,_.CreatePlane)("contentPlate_"+this.name,{size:1,sideOrientation:_.VertexData.BACKSIDE,frontUVs:r},t),this._backPlate=(0,_.CreatePlane)("backPlate_"+this.name,{size:1,sideOrientation:_.VertexData.FRONTSIDE},t)}else r=new _.Vector4(0,0,1,1),this._contentPlate=(0,_.CreatePlane)("contentPlate_"+this.name,{size:1,sideOrientation:_.VertexData.FRONTSIDE,frontUVs:r},t),this._backPlate=(0,_.CreatePlane)("backPlate_"+this.name,{size:1,sideOrientation:_.VertexData.BACKSIDE},t);this._titleBar.parent=o,this._titleBar.isNearGrabbable=!0,this._contentPlate.parent=o,this._backPlate.parent=o,this._attachContentPlateBehavior(),this._addControl(this._followButton),this._addControl(this._closeButton);var a=this._followButton,s=this._closeButton;return a.node.parent=o,s.node.parent=o,this._positionElements(),this._followButton.imageUrl=e.ASSETS_BASE_URL+e.FOLLOW_ICON_FILENAME,this._closeButton.imageUrl=e.ASSETS_BASE_URL+e.CLOSE_ICON_FILENAME,this._followButton.isBackplateVisible=!1,this._closeButton.isBackplateVisible=!1,this._followButton.onToggleObservable.add((function(t){i._defaultBehavior.followBehaviorEnabled=t,i._defaultBehavior.followBehaviorEnabled&&i._defaultBehavior.followBehavior.recenter()})),this._closeButton.onPointerClickObservable.add((function(){i.dispose()})),o.rotationQuaternion=_.Quaternion.Identity(),o.isVisible=!1,o},e.prototype._attachContentPlateBehavior=function(){var t=this;this._contentDragBehavior.attach(this._contentPlate),this._contentDragBehavior.moveAttached=!1,this._contentDragBehavior.useObjectOrientationForDragging=!0,this._contentDragBehavior.updateDragPlane=!1;var e,i,o=new _.Vector3,n=new _.Vector3,r=new _.Vector3,a=new _.Vector3,s=new _.Vector2;this._contentDragBehavior.onDragStartObservable.add((function(s){t.node&&(e=t._contentViewport.clone(),i=t.node.computeWorldMatrix(!0),o.copyFrom(s.dragPlanePoint),n.set(t.dimensions.x,t.dimensions.y,_.Epsilon),n.y-=t.titleBarHeight+t.titleBarMargin,_.Vector3.TransformNormalToRef(n,i,n),r.copyFromFloats(0,1,0),_.Vector3.TransformNormalToRef(r,i,r),a.copyFromFloats(1,0,0),_.Vector3.TransformNormalToRef(a,i,a),r.normalize(),r.scaleInPlace(1/_.Vector3.Dot(r,n)),a.normalize(),a.scaleInPlace(1/_.Vector3.Dot(a,n)))}));var l=new _.Vector3;this._contentDragBehavior.onDragObservable.add((function(i){l.copyFrom(i.dragPlanePoint),l.subtractInPlace(o),s.copyFromFloats(_.Vector3.Dot(l,a),_.Vector3.Dot(l,r)),t._contentViewport.x=_.Scalar.Clamp(e.x-l.x,0,1-t._contentViewport.width*t._contentScaleRatio),t._contentViewport.y=_.Scalar.Clamp(e.y-l.y,0,1-t._contentViewport.height*t._contentScaleRatio),t._applyContentViewport()}))},e.prototype._affectMaterial=function(t){this._titleBarMaterial=new Bt("".concat(this.name," plateMaterial"),t.getScene()),this._contentMaterial=new yt("".concat(this.name," contentMaterial"),t.getScene()),this._contentMaterial.renderBorders=!0,this._backMaterial=new Bt("".concat(this.name," backPlate"),t.getScene()),this._backMaterial.lineWidth=_.Epsilon,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()},e.prototype._prepareNode=function(e){var i=this;t.prototype._prepareNode.call(this,e),this._gizmo=new Nt(this._host.utilityLayer),this._gizmo.attachedSlate=this,this._defaultBehavior=new Mt,this._defaultBehavior.attach(this.node,[this._titleBar]),this._defaultBehavior.sixDofDragBehavior.onDragStartObservable.add((function(){i._followButton.isToggled=!1})),this._positionChangedObserver=this._defaultBehavior.sixDofDragBehavior.onPositionChangedObservable.add((function(){i._gizmo.updateBoundingBox()})),this._updatePivot(),this.resetDefaultAspectAndPose(!1)},e.prototype.resetDefaultAspectAndPose=function(t){if(void 0===t&&(t=!0),this._host&&this._host.utilityLayer&&this.node){var e=this._host.utilityLayer.utilityLayerScene,i=e.activeCamera;if(i){var o=i.getWorldMatrix(),n=_.Vector3.TransformNormal(_.Vector3.Backward(e.useRightHandedSystem),o);this.origin.setAll(0),this._gizmo.updateBoundingBox();var r=this.node.getAbsolutePivotPoint();this.node.position.copyFrom(i.position).subtractInPlace(n).subtractInPlace(r),this.node.rotationQuaternion=_.Quaternion.FromLookDirectionLH(n,new _.Vector3(0,1,0)),t&&(this.dimensions=this.defaultDimensions)}}},e.prototype.dispose=function(){t.prototype.dispose.call(this),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()},e.ASSETS_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",e.CLOSE_ICON_FILENAME="IconClose.png",e.FOLLOW_ICON_FILENAME="IconFollowMe.png",e._DEFAULT_TEXT_RESOLUTION_Y=102.4,e}(dt),zt=function(t){function e(e,i){var o=t.call(this,i)||this;return o._currentMesh=e,o.pointerEnterAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(1.1)},o.pointerOutAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(1/1.1)},o.pointerDownAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(.95)},o.pointerUpAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(1/.95)},o}return r(e,t),e.prototype._getTypeName=function(){return"MeshButton3D"},e.prototype._createNode=function(t){var e=this;return this._currentMesh.getChildMeshes().forEach((function(t){e._injectGUI3DReservedDataStore(t).control=e})),this._currentMesh},e.prototype._affectMaterial=function(t){},e}(pt),Qt=function(t){function e(e){var i=t.call(this,e)||this;return i._isPinned=!1,i._defaultBehavior=new Mt,i._dragObserver=i._defaultBehavior.sixDofDragBehavior.onDragObservable.add((function(){i.isPinned=!0})),i.backPlateMargin=1,i}return r(e,t),Object.defineProperty(e.prototype,"defaultBehavior",{get:function(){return this._defaultBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isPinned",{get:function(){return this._isPinned},set:function(t){this._pinButton.isToggled===t?(this._isPinned=t,this._defaultBehavior.followBehaviorEnabled=!t):this._pinButton.isToggled=t},enumerable:!1,configurable:!0}),e.prototype._createPinButton=function(t){var i=this,o=new wt("pin"+this.name,!1);return o.imageUrl=e._ASSETS_BASE_URL+e._PIN_ICON_FILENAME,o.parent=this,o._host=this._host,o.isToggleButton=!0,o.onToggleObservable.add((function(t){i.isPinned=t})),this._host.utilityLayer&&(o._prepareNode(this._host.utilityLayer.utilityLayerScene),o.scaling.scaleInPlace(xt.MENU_BUTTON_SCALE),o.node&&(o.node.parent=t)),o},e.prototype._createNode=function(e){var i=t.prototype._createNode.call(this,e);return this._pinButton=this._createPinButton(i),this.isPinned=!1,this._defaultBehavior.attach(i,[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,i.isVisible=!1,i},e.prototype._finalProcessing=function(){t.prototype._finalProcessing.call(this),this._pinButton.position.copyFromFloats((this._backPlate.scaling.x+xt.MENU_BUTTON_SCALE)/2,this._backPlate.scaling.y/2,0)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._defaultBehavior.sixDofDragBehavior.onDragObservable.remove(this._dragObserver),this._defaultBehavior.detach()},e._ASSETS_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",e._PIN_ICON_FILENAME="IconPin.png",e}(xt),Vt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype._mapGridNode=function(t,e){var i=t.mesh;if(i){t.position=e.clone();var o=_.TmpVectors.Vector3[0];switch(o.copyFrom(e),this.orientation){case gt.FACEORIGIN_ORIENTATION:case gt.FACEFORWARD_ORIENTATION:o.addInPlace(new _.Vector3(0,0,1)),i.lookAt(o);break;case gt.FACEFORWARDREVERSED_ORIENTATION:case gt.FACEORIGINREVERSED_ORIENTATION:o.addInPlace(new _.Vector3(0,0,-1)),i.lookAt(o)}}},e}(bt),Wt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._iteration=100,e}return r(e,t),Object.defineProperty(e.prototype,"iteration",{get:function(){return this._iteration},set:function(t){var e=this;this._iteration!==t&&(this._iteration=t,_.Tools.SetImmediate((function(){e._arrangeChildren()})))},enumerable:!1,configurable:!0}),e.prototype._mapGridNode=function(t,e){var i=t.mesh,o=this._scatterMapping(e);if(i){switch(this.orientation){case gt.FACEORIGIN_ORIENTATION:case gt.FACEFORWARD_ORIENTATION:i.lookAt(new _.Vector3(0,0,1));break;case gt.FACEFORWARDREVERSED_ORIENTATION:case gt.FACEORIGINREVERSED_ORIENTATION:i.lookAt(new _.Vector3(0,0,-1))}t.position=o}},e.prototype._scatterMapping=function(t){return t.x=(1-2*Math.random())*this._cellWidth,t.y=(1-2*Math.random())*this._cellHeight,t},e.prototype._finalProcessing=function(){for(var t=[],e=0,i=this._children;e<i.length;e++){var o=i[e];o.mesh&&t.push(o.mesh)}for(var n=0;n<this._iteration;n++){t.sort((function(t,e){var i=t.position.lengthSquared(),o=e.position.lengthSquared();return i<o?1:i>o?-1:0}));for(var r=Math.pow(this.margin,2),a=Math.max(this._cellWidth,this._cellHeight),s=_.TmpVectors.Vector2[0],l=_.TmpVectors.Vector3[0],h=0;h<t.length-1;h++)for(var c=h+1;c<t.length;c++)if(h!=c){t[c].position.subtractToRef(t[h].position,l),s.x=l.x,s.y=l.y;var u=a,d=s.lengthSquared()-r;(d-=Math.min(d,r))<Math.pow(u,2)&&(s.normalize(),l.scaleInPlace(.5*(u-Math.sqrt(d))),t[c].position.addInPlace(l),t[h].position.subtractInPlace(l))}}},e}(bt);_.ShaderStore.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=k1<k2 ? vec3(k1,Blob_Info1.z,Blob_Info1.w) : vec3(k2,Blob_Info2.z,Blob_Info2.w);\nBlob_Color=closer.z*texture(Blob_Texture,vec2(vec2(sqrt(closer.x),closer.y).x,1.0-vec2(sqrt(closer.x),closer.y).y))*clamp(1.0-closer.x,0.0,1.0);\n}\nvoid FastLinearTosRGB_B42(\nvec4 Linear,\nout vec4 sRGB)\n{\nsRGB.rgb=sqrt(clamp(Linear.rgb,0.0,1.0));\nsRGB.a=Linear.a;\n}\nvoid Scale_RGB_B59(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{\nResult=vec4(Scalar,Scalar,Scalar,1)*Color;\n}\nvoid Fragment_Main_B121(\nfloat Sun_Intensity,\nfloat Sun_Theta,\nfloat Sun_Phi,\nvec3 Normal,\nvec4 Albedo,\nfloat Fresnel_Reflect,\nfloat Shininess,\nvec3 Incident,\nvec4 Horizon_Color,\nvec4 Sky_Color,\nvec4 Ground_Color,\nfloat Indirect_Diffuse,\nfloat Specular,\nfloat Horizon_Power,\nfloat Reflection,\nvec4 Reflection_Sample,\nvec4 Indirect_Sample,\nfloat Sharpness,\nfloat SSS,\nfloat Subsurface,\nvec4 Translucence,\nvec4 Rim_Light,\nvec4 Iridescence,\nout vec4 Result)\n{\nfloat theta=Sun_Theta*2.0*3.14159;\nfloat phi=Sun_Phi*3.14159;\nvec3 lightDir= vec3(cos(phi)*cos(theta),sin(phi),cos(phi)*sin(theta));\nfloat NdotL=max(dot(lightDir,Normal),0.0);\nvec3 R=reflect(Incident,Normal);\nfloat RdotL=max(0.0,dot(R,lightDir));\nfloat specular=pow(RdotL,Shininess);\nspecular=mix(specular,smoothstep(0.495*Sharpness,1.0-0.495*Sharpness,specular),Sharpness);\nvec4 gi=mix(Ground_Color,Sky_Color,Normal.y*0.5+0.5);\nResult=((Sun_Intensity*NdotL+Indirect_Sample*Indirect_Diffuse+Translucence)*(1.0+SSS*Subsurface))*Albedo*(1.0-Fresnel_Reflect)+(Sun_Intensity*specular*Specular+Fresnel_Reflect*Reflection*Reflection_Sample)+Fresnel_Reflect*Rim_Light+Iridescence;\n}\nvoid Bulge_B79(\nbool Enabled,\nvec3 Normal,\nvec3 Tangent,\nfloat Bulge_Height,\nvec4 UV,\nfloat Bulge_Radius,\nvec3 ButtonN,\nout vec3 New_Normal)\n{\nvec2 xy=clamp(UV.xy*2.0,vec2(-1,-1),vec2(1,1));\nvec3 B=(cross(Normal,Tangent));\nfloat k=-clamp(1.0-length(xy)/Bulge_Radius,0.0,1.0)*Bulge_Height;\nk=sin(k*3.14159*0.5);\nk*=smoothstep(0.9998,0.9999,abs(dot(ButtonN,Normal)));\nNew_Normal=Normal*sqrt(1.0-k*k)+(xy.x*Tangent+xy.y*B)*k;\nNew_Normal=Enabled ? New_Normal : Normal;\n}\nvoid SSS_B77(\nvec3 ButtonN,\nvec3 Normal,\nvec3 Incident,\nout float Result)\n{\nfloat NdotI=abs(dot(Normal,Incident));\nfloat BdotI=abs(dot(ButtonN,Incident));\nResult=(abs(NdotI-BdotI)); \n}\nvoid FingerOcclusion_B67(\nfloat Width,\nfloat DistToCenter,\nfloat Fuzz,\nfloat Min_Fuzz,\nvec3 Position,\nvec3 Forward,\nvec3 Nearest,\nfloat Fade_Out,\nout float NotInShadow)\n{\nfloat d=dot((Nearest-Position),Forward);\nfloat sh=smoothstep(Width*0.5,Width*0.5+Fuzz*max(d,0.0)+Min_Fuzz,DistToCenter);\nNotInShadow=1.0-(1.0-sh)*smoothstep(-Fade_Out,0.0,d);\n}\nvoid FingerOcclusion_B68(\nfloat Width,\nfloat DistToCenter,\nfloat Fuzz,\nfloat Min_Fuzz,\nvec3 Position,\nvec3 Forward,\nvec3 Nearest,\nfloat Fade_Out,\nout float NotInShadow)\n{\nfloat d=dot((Nearest-Position),Forward);\nfloat sh=smoothstep(Width*0.5,Width*0.5+Fuzz*max(d,0.0)+Min_Fuzz,DistToCenter);\nNotInShadow=1.0-(1.0-sh)*smoothstep(-Fade_Out,0.0,d);\n}\nvoid Scale_Color_B91(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{\nResult=Scalar*Color;\n}\nvoid From_HSV_B73(\nfloat Hue,\nfloat Saturation,\nfloat Value,\nfloat Alpha,\nout vec4 Color)\n{\nvec4 K=vec4(1.0,2.0/3.0,1.0/3.0,3.0);\nvec3 p=abs(fract(vec3(Hue,Hue,Hue)+K.xyz)*6.0-K.www);\nColor.rgb=Value*mix(K.xxx,clamp(p-K.xxx,0.0,1.0),Saturation);\nColor.a=Alpha;\n}\nvoid Fast_Fresnel_B122(\nfloat Front_Reflect,\nfloat Edge_Reflect,\nfloat Power,\nvec3 Normal,\nvec3 Incident,\nout float Transmit,\nout float Reflect)\n{\nfloat d=max(-dot(Incident,Normal),0.0);\nReflect=Front_Reflect+(Edge_Reflect-Front_Reflect)*pow(.01-d,Power);\nTransmit=1.0-Reflect;\n}\nvoid Mapped_Environment_B51(\nsampler2D Reflected_Environment,\nsampler2D Indirect_Environment,\nvec3 Dir,\nout vec4 Reflected_Color,\nout vec4 Indirect_Diffuse)\n{\nReflected_Color=texture(Reflected_Environment,vec2(atan(Dir.z,Dir.x)/3.14159*0.5,asin(Dir.y)/3.14159+0.5));\nIndirect_Diffuse=texture(Indirect_Environment,vec2(atan(Dir.z,Dir.x)/3.14159*0.5,asin(Dir.y)/3.14159+0.5));\n}\nvec4 SampleEnv_Bid50(vec3 D,vec4 S,vec4 H,vec4 G,float exponent)\n{\nfloat k=pow(abs(D.y),exponent);\nvec4 C;\nif (D.y>0.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.g<Color.b ? vec4(Color.bg,K.wz) : vec4(Color.gb,K.xy);\nvec4 q=Color.r<p.x ? vec4(p.xyw,Color.r) : vec4(Color.r,p.yzx);\nfloat d=q.x-min(q.w,q.y);\nfloat e=1.0e-10;\nHue=abs(q.z+(q.w-q.y)/(6.0*d+e));\nSaturation=d/(q.x+e);\nValue=q.x;\nAlpha=Color.a;\nHSV=vec3(Hue,Saturation,Value);\n}\nvoid Code_B110(\nfloat X,\nout float Result)\n{\nResult=(acos(X)/3.14159-0.5)*2.0;\n}\nvoid Rim_Light_B132(\nvec3 Front,\nvec3 Normal,\nvec3 Incident,\nfloat Rim_Intensity,\nsampler2D Texture,\nout vec4 Result)\n{\nvec3 R=reflect(Incident,Normal);\nfloat RdotF=dot(R,Front);\nfloat RdotL=sqrt(1.0-RdotF*RdotF);\nvec2 UV=vec2(R.y*0.5+0.5,0.5);\nvec4 Color=texture(Texture,UV);\nResult=Color;\n}\nvoid main()\n{\nvec4 Blob_Color_Q30;\n#if BLOB_ENABLE\nBlob_Fragment_B30(_Blob_Texture_,vExtra2,vExtra3,Blob_Color_Q30);\n#else\nBlob_Color_Q30=vec4(0,0,0,0);\n#endif\nvec3 Incident_Q39=normalize(vPosition-cameraPosition);\nvec3 Normalized_Q38=normalize(vNormal);\nvec3 Normalized_Q71=normalize(vTangent);\nvec4 Color_Q83;\n#if DECAL_ENABLE\nColor_Q83=texture(_Decal_,vUV);\n#else\nColor_Q83=vec4(0,0,0,0);\n#endif\nfloat X_Q90;\nfloat Y_Q90;\nfloat Z_Q90;\nfloat W_Q90;\nX_Q90=vExtra1.x;\nY_Q90=vExtra1.y;\nZ_Q90=vExtra1.z;\nW_Q90=vExtra1.w;\nvec4 Linear_Q43;\nLinear_Q43.rgb=clamp(_Sky_Color_.rgb*_Sky_Color_.rgb,0.0,1.0);\nLinear_Q43.a=_Sky_Color_.a;\nvec4 Linear_Q44;\nLinear_Q44.rgb=clamp(_Horizon_Color_.rgb*_Horizon_Color_.rgb,0.0,1.0);\nLinear_Q44.a=_Horizon_Color_.a;\nvec4 Linear_Q45;\nLinear_Q45.rgb=clamp(_Ground_Color_.rgb*_Ground_Color_.rgb,0.0,1.0);\nLinear_Q45.a=_Ground_Color_.a;\nvec3 Left_Index_Q64;\nvec3 Right_Index_Q64;\nvec3 Left_Index_Middle_Q64;\nvec3 Right_Index_Middle_Q64;\nFinger_Positions_B64(_Left_Index_Pos_,_Right_Index_Pos_,_Left_Index_Middle_Pos_,_Right_Index_Middle_Pos_,Left_Index_Q64,Right_Index_Q64,Left_Index_Middle_Q64,Right_Index_Middle_Q64);\nvec4 Linear_Q46;\nLinear_Q46.rgb=clamp(_Albedo_.rgb*_Albedo_.rgb,0.0,1.0);\nLinear_Q46.a=_Albedo_.a;\nvec3 Normalized_Q107=normalize(vBinormal);\nvec3 Incident_Q70=normalize(vPosition-cameraPosition);\nvec3 New_Normal_Q79;\nBulge_B79(_Bulge_Enabled_,Normalized_Q38,Normalized_Q71,_Bulge_Height_,vColor,_Bulge_Radius_,vBinormal,New_Normal_Q79);\nfloat Result_Q77;\nSSS_B77(vBinormal,New_Normal_Q79,Incident_Q39,Result_Q77);\nvec4 Result_Q91;\nScale_Color_B91(Color_Q83,X_Q90,Result_Q91);\nfloat Transmit_Q122;\nfloat Reflect_Q122;\nFast_Fresnel_B122(_Front_Reflect_,_Edge_Reflect_,_Power_,New_Normal_Q79,Incident_Q39,Transmit_Q122,Reflect_Q122);\nfloat Product_Q125=Y_Q90*Y_Q90;\nvec3 NearP_Q65;\nvec3 NearQ_Q65;\nfloat Distance_Q65;\nMin_Segment_Distance_B65(Left_Index_Q64,Left_Index_Middle_Q64,vPosition,cameraPosition,NearP_Q65,NearQ_Q65,Distance_Q65);\nvec3 NearP_Q63;\nvec3 NearQ_Q63;\nfloat Distance_Q63;\nMin_Segment_Distance_B65(Right_Index_Q64,Right_Index_Middle_Q64,vPosition,cameraPosition,NearP_Q63,NearQ_Q63,Distance_Q63);\nvec3 Reflected_Q47=reflect(Incident_Q39,New_Normal_Q79);\nvec4 Product_Q103=Linear_Q46*vec4(1,1,1,1);\nvec4 Result_Q132;\nRim_Light_B132(Normalized_Q107,Normalized_Q38,Incident_Q70,_Rim_Intensity_,_Rim_Texture_,Result_Q132);\nfloat Dot_Q72=dot(Incident_Q70, Normalized_Q71);\nfloat MaxAB_Q123=max(Reflect_Q122,Product_Q125);\nfloat NotInShadow_Q67;\n#if OCCLUSION_ENABLED\nFingerOcclusion_B67(_Width_,Distance_Q65,_Fuzz_,_Min_Fuzz_,vPosition,vBinormal,NearP_Q65,_Clip_Fade_,NotInShadow_Q67);\n#else\nNotInShadow_Q67=1.0;\n#endif\nfloat NotInShadow_Q68;\n#if OCCLUSION_ENABLED\nFingerOcclusion_B68(_Width_,Distance_Q63,_Fuzz_,_Min_Fuzz_,vPosition,vBinormal,NearP_Q63,_Clip_Fade_,NotInShadow_Q68);\n#else\nNotInShadow_Q68=1.0;\n#endif\nvec4 Reflected_Color_Q51;\nvec4 Indirect_Diffuse_Q51;\n#if ENV_ENABLE\nMapped_Environment_B51(_Reflection_Map_,_Indirect_Environment_,Reflected_Q47,Reflected_Color_Q51,Indirect_Diffuse_Q51);\n#else\nReflected_Color_Q51=vec4(0,0,0,1);\nIndirect_Diffuse_Q51=vec4(0,0,0,1);\n#endif\nvec4 Reflected_Color_Q50;\nvec4 Indirect_Color_Q50;\n#if SKY_ENABLED\nSky_Environment_B50(New_Normal_Q79,Reflected_Q47,Linear_Q43,Linear_Q44,Linear_Q45,_Horizon_Power_,Reflected_Color_Q50,Indirect_Color_Q50);\n#else\nReflected_Color_Q50=vec4(0,0,0,1);\nIndirect_Color_Q50=vec4(0,0,0,1);\n#endif\nfloat Hue_Q75;\nfloat Saturation_Q75;\nfloat Value_Q75;\nfloat Alpha_Q75;\nvec3 HSV_Q75;\nTo_HSV_B75(Product_Q103,Hue_Q75,Saturation_Q75,Value_Q75,Alpha_Q75,HSV_Q75);\nfloat Hue_Q127;\nfloat Saturation_Q127;\nfloat Value_Q127;\nfloat Alpha_Q127;\nvec3 HSV_Q127;\nTo_HSV_B75(Result_Q132,Hue_Q127,Saturation_Q127,Value_Q127,Alpha_Q127,HSV_Q127);\nfloat Result_Q110;\nCode_B110(Dot_Q72,Result_Q110);\nfloat AbsA_Q76=abs(Result_Q110);\nfloat MinAB_Q58=min(NotInShadow_Q67,NotInShadow_Q68);\nvec4 Sum_Q48=Reflected_Color_Q51+Reflected_Color_Q50;\nvec4 Sum_Q49=Indirect_Diffuse_Q51+Indirect_Color_Q50;\nvec3 HSV_Out_Q126;\nVaryHSV_B108(HSV_Q127,_Rim_Hue_Shift_,_Rim_Saturation_Shift_,_Rim_Value_Shift_,HSV_Out_Q126);\nfloat Out_Q114;\nRemap_Range_B114(-1.0,1.0,0.0,1.0,Result_Q110,Out_Q114);\nfloat Product_Q106;\nProduct_Q106=AbsA_Q76*_Hue_Shift_;\nfloat X_Q128;\nfloat Y_Q128;\nfloat Z_Q128;\nTo_XYZ_B74(HSV_Out_Q126,X_Q128,Y_Q128,Z_Q128);\nvec2 Vec2_Q112=vec2(Out_Q114,0.5);\nvec3 HSV_Out_Q108;\nVaryHSV_B108(HSV_Q75,Product_Q106,_Saturation_Shift_,_Value_Shift_,HSV_Out_Q108);\nvec4 Color_Q129;\nFrom_HSV_B73(X_Q128,Y_Q128,Z_Q128,0.0,Color_Q129);\nvec4 Color_Q111;\n#if IRIDESCENCE_ENABLED\nColor_Q111=texture(_Iridescence_Texture_,Vec2_Q112);\n#else\nColor_Q111=vec4(0,0,0,0);\n#endif\nfloat X_Q74;\nfloat Y_Q74;\nfloat Z_Q74;\nTo_XYZ_B74(HSV_Out_Q108,X_Q74,Y_Q74,Z_Q74);\nvec4 Result_Q131=_Rim_Intensity_*Color_Q129;\nvec4 Result_Q113=_Iridescence_Intensity_*Color_Q111;\nvec4 Color_Q73;\nFrom_HSV_B73(X_Q74,Y_Q74,Z_Q74,0.0,Color_Q73);\nvec4 Result_Q84=Result_Q91+(1.0-Result_Q91.a)*Color_Q73;\nvec4 Result_Q121;\nFragment_Main_B121(_Sun_Intensity_,_Sun_Theta_,_Sun_Phi_,New_Normal_Q79,Result_Q84,MaxAB_Q123,_Shininess_,Incident_Q39,_Horizon_Color_,_Sky_Color_,_Ground_Color_,_Indirect_Diffuse_,_Specular_,_Horizon_Power_,_Reflection_,Sum_Q48,Sum_Q49,_Sharpness_,Result_Q77,_Subsurface_,vec4(0,0,0,0),Result_Q131,Result_Q113,Result_Q121);\nvec4 Result_Q59;\nScale_RGB_B59(Result_Q121,MinAB_Q58,Result_Q59);\nvec4 sRGB_Q42;\nFastLinearTosRGB_B42(Result_Q59,sRGB_Q42);\nvec4 Result_Q31=Blob_Color_Q30+(1.0-Blob_Color_Q30.a)*sRGB_Q42;\nvec4 Result_Q40=Result_Q31; Result_Q40.a=1.0;\nvec4 Out_Color=Result_Q40;\nfloat Clip_Threshold=0.001;\nbool To_sRGB=false;\ngl_FragColor=Out_Color;\n}";_.ShaderStore.ShadersStore.mrdlSliderBarVertexShader="uniform mat4 world;\nuniform mat4 viewProjection;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n#ifdef TANGENT\nattribute vec3 tangent;\n#else\nconst vec3 tangent=vec3(0.);\n#endif\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 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;\nvarying vec4 vExtra2;\nvarying vec4 vExtra3;\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 Object_To_World_Normal_B32(\nvec3 Nrm_Object,\nout vec3 Nrm_World)\n{\nNrm_World=(vec4(Nrm_Object,0.0)).xyz;\n}\nvoid Blob_Vertex_B23(\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,\nfloat Blob_Fade_Length,\nfloat Blob_Pulse,\nfloat Blob_Fade,\nout vec4 Blob_Info)\n{\nvec3 blob= (Use_Global_Left_Index ? Global_Left_Index_Tip_Position.xyz : Blob_Position);\nvec3 delta=blob-Position;\nfloat dist=dot(Normal,delta);\nfloat lerpValue=clamp((abs(dist)-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);\nfloat fadeValue=1.0-clamp((abs(dist)-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);\nfloat size=Blob_Near_Size+(Blob_Far_Size-Blob_Near_Size)*lerpValue;\nvec2 blobXY=vec2(dot(delta,Tangent),dot(delta,Bitangent))/(0.0001+size);\nfloat Fade=fadeValue*Intensity*Blob_Fade;\nfloat Distance=(lerpValue*0.5+0.5)*(1.0-Blob_Pulse);\nBlob_Info=vec4(blobXY.x,blobXY.y,Distance,Fade);\n}\nvoid Blob_Vertex_B24(\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,\nfloat Blob_Fade_Length,\nfloat Blob_Pulse,\nfloat Blob_Fade,\nout vec4 Blob_Info)\n{\nvec3 blob= (Use_Global_Right_Index ? Global_Right_Index_Tip_Position.xyz : Blob_Position);\nvec3 delta=blob-Position;\nfloat dist=dot(Normal,delta);\nfloat lerpValue=clamp((abs(dist)-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);\nfloat fadeValue=1.0-clamp((abs(dist)-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);\nfloat size=Blob_Near_Size+(Blob_Far_Size-Blob_Near_Size)*lerpValue;\nvec2 blobXY=vec2(dot(delta,Tangent),dot(delta,Bitangent))/(0.0001+size);\nfloat Fade=fadeValue*Intensity*Blob_Fade;\nfloat Distance=(lerpValue*0.5+0.5)*(1.0-Blob_Pulse);\nBlob_Info=vec4(blobXY.x,blobXY.y,Distance,Fade);\n}\nvoid Move_Verts_B130(\nfloat Anisotropy,\nvec3 P,\nfloat Radius,\nfloat Bevel,\nvec3 Normal_Object,\nfloat ScaleZ,\nfloat Stretch,\nout vec3 New_P,\nout vec2 New_UV,\nout float Radial_Gradient,\nout vec3 Radial_Dir,\nout vec3 New_Normal)\n{\nvec2 UV=P.xy*2.0+0.5;\nvec2 center=clamp(UV,0.0,1.0);\nvec2 delta=UV-center;\nfloat deltad=(length(delta)*2.0);\nfloat f=(Bevel+(Radius-Bevel)*Stretch)/Radius;\nfloat innerd=clamp(deltad*2.0,0.0,1.0);\nfloat outerd=clamp(deltad*2.0-1.0,0.0,1.0);\nfloat bevelAngle=outerd*3.14159*0.5;\nfloat sinb=sin(bevelAngle);\nfloat cosb=cos(bevelAngle);\nfloat beveld=(1.0-f)*innerd+f*sinb;\nfloat br=outerd;\nvec2 r2=2.0*vec2(Radius/Anisotropy,Radius);\nfloat dir=P.z<0.0001 ? 1.0 : -1.0;\nNew_UV=center+r2*((0.5-center)+normalize(delta+vec2(0.0,0.000001))*beveld*0.5);\nNew_P=vec3(New_UV-0.5,P.z+dir*(1.0-cosb)*Bevel*ScaleZ);\nRadial_Gradient=clamp((deltad-0.5)*2.0,0.0,1.0);\nRadial_Dir=vec3(delta*r2,0.0);\nvec3 beveledNormal=cosb*Normal_Object+sinb*vec3(delta.x,delta.y,0.0);\nNew_Normal=Normal_Object.z==0.0 ? Normal_Object : beveledNormal;\n}\nvoid Object_To_World_Dir_B60(\nvec3 Dir_Object,\nout vec3 Normal_World,\nout vec3 Normal_World_N,\nout float Normal_Length)\n{\nNormal_World=(world*vec4(Dir_Object,0.0)).xyz;\nNormal_Length=length(Normal_World);\nNormal_World_N=Normal_World/Normal_Length;\n}\nvoid To_XYZ_B78(\nvec3 Vec3,\nout float X,\nout float Y,\nout float Z)\n{\nX=Vec3.x;\nY=Vec3.y;\nZ=Vec3.z;\n}\nvoid Conditional_Float_B93(\nbool Which,\nfloat If_True,\nfloat If_False,\nout float Result)\n{\nResult=Which ? If_True : If_False;\n}\nvoid Object_To_World_Dir_B28(\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 Pick_Radius_B69(\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 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}";var Ht=function(t){function e(){var e=t.call(this)||this;return e.SKY_ENABLED=!0,e.BLOB_ENABLE_2=!0,e.IRIDESCENCE_ENABLED=!0,e._needNormals=!0,e._needUVs=!0,e.rebuild(),e}return r(e,t),e}(_.MaterialDefines),Gt=function(t){function e(i,o){var n=t.call(this,i,o)||this;return n.radius=.6,n.bevelFront=.6,n.bevelFrontStretch=.077,n.bevelBack=0,n.bevelBackStretch=0,n.radiusTopLeft=1,n.radiusTopRight=1,n.radiusBottomLeft=1,n.radiusBottomRight=1,n.bulgeEnabled=!1,n.bulgeHeight=-.323,n.bulgeRadius=.73,n.sunIntensity=1.102,n.sunTheta=.76,n.sunPhi=.526,n.indirectDiffuse=.658,n.albedo=new _.Color4(.0117647,.505882,.996078,1),n.specular=0,n.shininess=10,n.sharpness=0,n.subsurface=0,n.leftGradientColor=new _.Color4(.0117647,.505882,.996078,1),n.rightGradientColor=new _.Color4(.0117647,.505882,.996078,1),n.reflection=.749,n.frontReflect=0,n.edgeReflect=.09,n.power=8.13,n.skyColor=new _.Color4(.0117647,.964706,.996078,1),n.horizonColor=new _.Color4(.0117647,.333333,.996078,1),n.groundColor=new _.Color4(0,.254902,.996078,1),n.horizonPower=1,n.width=.02,n.fuzz=.5,n.minFuzz=.001,n.clipFade=.01,n.hueShift=0,n.saturationShift=0,n.valueShift=0,n.blobPosition=new _.Vector3(0,0,.1),n.blobIntensity=.5,n.blobNearSize=.01,n.blobFarSize=.03,n.blobNearDistance=0,n.blobFarDistance=.08,n.blobFadeLength=.576,n.blobPulse=0,n.blobFade=1,n.blobPosition2=new _.Vector3(.2,0,.1),n.blobNearSize2=.01,n.blobPulse2=0,n.blobFade2=1,n.blobTexture=new _.Texture("",n.getScene()),n.leftIndexPosition=new _.Vector3(0,0,1),n.rightIndexPosition=new _.Vector3(-1,-1,-1),n.leftIndexMiddlePosition=new _.Vector3(0,0,0),n.rightIndexMiddlePosition=new _.Vector3(0,0,0),n.decalScaleXY=new _.Vector2(1.5,1.5),n.decalFrontOnly=!0,n.rimIntensity=.287,n.rimHueShift=0,n.rimSaturationShift=0,n.rimValueShift=-1,n.iridescenceIntensity=0,n.useGlobalLeftIndex=1,n.useGlobalRightIndex=1,n.globalLeftIndexTipProximity=0,n.globalRightIndexTipProximity=0,n.globalLeftIndexTipPosition=new _.Vector4(.5,0,-.55,1),n.globaRightIndexTipPosition=new _.Vector4(0,0,0,1),n.globalLeftThumbTipPosition=new _.Vector4(.5,0,-.55,1),n.globalRightThumbTipPosition=new _.Vector4(0,0,0,1),n.globalLeftIndexMiddlePosition=new _.Vector4(.5,0,-.55,1),n.globalRightIndexMiddlePosition=new _.Vector4(0,0,0,1),n.alphaMode=_.Constants.ALPHA_DISABLE,n.backFaceCulling=!1,n._blueGradientTexture=new _.Texture(e.BLUE_GRADIENT_TEXTURE_URL,n.getScene(),!0,!1,_.Texture.NEAREST_SAMPLINGMODE),n._decalTexture=new _.Texture("",n.getScene()),n._reflectionMapTexture=new _.Texture("",n.getScene()),n._indirectEnvTexture=new _.Texture("",n.getScene()),n}return r(e,t),e.prototype.needAlphaBlending=function(){return!1},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){if(this.isFrozen&&e.effect&&e.effect._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new Ht);var i=e.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(e))return!0;var n=o.getEngine();if(_.MaterialHelper.PrepareDefinesForAttributes(t,i,!1,!1),i.isDirty){i.markAsProcessed(),o.resetCachedMaterial();var r=new _.EffectFallbacks;i.FOG&&r.addFallback(1,"FOG"),_.MaterialHelper.HandleFallbacksForShadows(i,r),i.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;var a=[_.VertexBuffer.PositionKind];i.NORMAL&&a.push(_.VertexBuffer.NormalKind),i.UV1&&a.push(_.VertexBuffer.UVKind),i.UV2&&a.push(_.VertexBuffer.UV2Kind),i.VERTEXCOLOR&&a.push(_.VertexBuffer.ColorKind),i.TANGENT&&a.push(_.VertexBuffer.TangentKind),_.MaterialHelper.PrepareAttributesForInstances(a,i);var s=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"],h=["_Rim_Texture_","_Iridescence_Texture_"],c=new Array;_.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:l,uniformBuffersNames:c,samplers:h,defines:i,maxSimultaneousLights:4}),e.setEffect(o.getEngine().createEffect("mrdlSliderBar",{attributes:a,uniformsNames:l,uniformBuffersNames:c,samplers:h,defines:s,fallbacks:r,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),i,this._materialContext)}return!(!e.effect||!e.effect.isReady()||(i._renderId=o.getRenderId(),e.effect._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){if(i.materialDefines){var o=i.effect;o&&(this._activeEffect=o,this.bindOnlyWorldMatrix(t),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_",this._reflectionMapTexture),this._activeEffect.setTexture("_Indirect_Environment_",this._indirectEnvTexture),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_",this._decalTexture),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(e,this._activeEffect))}},e.prototype.getAnimatables=function(){return[]},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e),this._reflectionMapTexture.dispose(),this._indirectEnvTexture.dispose(),this._blueGradientTexture.dispose(),this._decalTexture.dispose()},e.prototype.clone=function(t){var i=this;return _.SerializationHelper.Clone((function(){return new e(t,i.getScene())}),this)},e.prototype.serialize=function(){var e=t.prototype.serialize.call(this);return e.customType="BABYLON.MRDLSliderBarMaterial",e},e.prototype.getClassName=function(){return"MRDLSliderBarMaterial"},e.Parse=function(t,i,o){return _.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},e.BLUE_GRADIENT_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/MRDL/mrtk-mrdl-blue-gradient.png",a([(0,_.serialize)()],e.prototype,"radius",void 0),a([(0,_.serialize)()],e.prototype,"bevelFront",void 0),a([(0,_.serialize)()],e.prototype,"bevelFrontStretch",void 0),a([(0,_.serialize)()],e.prototype,"bevelBack",void 0),a([(0,_.serialize)()],e.prototype,"bevelBackStretch",void 0),a([(0,_.serialize)()],e.prototype,"radiusTopLeft",void 0),a([(0,_.serialize)()],e.prototype,"radiusTopRight",void 0),a([(0,_.serialize)()],e.prototype,"radiusBottomLeft",void 0),a([(0,_.serialize)()],e.prototype,"radiusBottomRight",void 0),a([(0,_.serialize)()],e.prototype,"bulgeEnabled",void 0),a([(0,_.serialize)()],e.prototype,"bulgeHeight",void 0),a([(0,_.serialize)()],e.prototype,"bulgeRadius",void 0),a([(0,_.serialize)()],e.prototype,"sunIntensity",void 0),a([(0,_.serialize)()],e.prototype,"sunTheta",void 0),a([(0,_.serialize)()],e.prototype,"sunPhi",void 0),a([(0,_.serialize)()],e.prototype,"indirectDiffuse",void 0),a([(0,_.serialize)()],e.prototype,"albedo",void 0),a([(0,_.serialize)()],e.prototype,"specular",void 0),a([(0,_.serialize)()],e.prototype,"shininess",void 0),a([(0,_.serialize)()],e.prototype,"sharpness",void 0),a([(0,_.serialize)()],e.prototype,"subsurface",void 0),a([(0,_.serialize)()],e.prototype,"leftGradientColor",void 0),a([(0,_.serialize)()],e.prototype,"rightGradientColor",void 0),a([(0,_.serialize)()],e.prototype,"reflection",void 0),a([(0,_.serialize)()],e.prototype,"frontReflect",void 0),a([(0,_.serialize)()],e.prototype,"edgeReflect",void 0),a([(0,_.serialize)()],e.prototype,"power",void 0),a([(0,_.serialize)()],e.prototype,"skyColor",void 0),a([(0,_.serialize)()],e.prototype,"horizonColor",void 0),a([(0,_.serialize)()],e.prototype,"groundColor",void 0),a([(0,_.serialize)()],e.prototype,"horizonPower",void 0),a([(0,_.serialize)()],e.prototype,"width",void 0),a([(0,_.serialize)()],e.prototype,"fuzz",void 0),a([(0,_.serialize)()],e.prototype,"minFuzz",void 0),a([(0,_.serialize)()],e.prototype,"clipFade",void 0),a([(0,_.serialize)()],e.prototype,"hueShift",void 0),a([(0,_.serialize)()],e.prototype,"saturationShift",void 0),a([(0,_.serialize)()],e.prototype,"valueShift",void 0),a([(0,_.serialize)()],e.prototype,"blobPosition",void 0),a([(0,_.serialize)()],e.prototype,"blobIntensity",void 0),a([(0,_.serialize)()],e.prototype,"blobNearSize",void 0),a([(0,_.serialize)()],e.prototype,"blobFarSize",void 0),a([(0,_.serialize)()],e.prototype,"blobNearDistance",void 0),a([(0,_.serialize)()],e.prototype,"blobFarDistance",void 0),a([(0,_.serialize)()],e.prototype,"blobFadeLength",void 0),a([(0,_.serialize)()],e.prototype,"blobPulse",void 0),a([(0,_.serialize)()],e.prototype,"blobFade",void 0),a([(0,_.serialize)()],e.prototype,"blobPosition2",void 0),a([(0,_.serialize)()],e.prototype,"blobNearSize2",void 0),a([(0,_.serialize)()],e.prototype,"blobPulse2",void 0),a([(0,_.serialize)()],e.prototype,"blobFade2",void 0),a([(0,_.serialize)()],e.prototype,"blobTexture",void 0),a([(0,_.serialize)()],e.prototype,"leftIndexPosition",void 0),a([(0,_.serialize)()],e.prototype,"rightIndexPosition",void 0),a([(0,_.serialize)()],e.prototype,"leftIndexMiddlePosition",void 0),a([(0,_.serialize)()],e.prototype,"rightIndexMiddlePosition",void 0),a([(0,_.serialize)()],e.prototype,"decalScaleXY",void 0),a([(0,_.serialize)()],e.prototype,"decalFrontOnly",void 0),a([(0,_.serialize)()],e.prototype,"rimIntensity",void 0),a([(0,_.serialize)()],e.prototype,"rimHueShift",void 0),a([(0,_.serialize)()],e.prototype,"rimSaturationShift",void 0),a([(0,_.serialize)()],e.prototype,"rimValueShift",void 0),a([(0,_.serialize)()],e.prototype,"iridescenceIntensity",void 0),e}(_.PushMaterial);(0,_.RegisterClass)("BABYLON.GUI.MRDLSliderBarMaterial",Gt);_.ShaderStore.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=k1<k2 ? vec3(k1,Blob_Info1.z,Blob_Info1.w) : vec3(k2,Blob_Info2.z,Blob_Info2.w);\nBlob_Color=closer.z*texture(Blob_Texture,vec2(vec2(sqrt(closer.x),closer.y).x,1.0-vec2(sqrt(closer.x),closer.y).y))*clamp(1.0-closer.x,0.0,1.0);\n}\nvoid FastLinearTosRGB_B192(\nvec4 Linear,\nout vec4 sRGB)\n{\nsRGB.rgb=sqrt(clamp(Linear.rgb,0.0,1.0));\nsRGB.a=Linear.a;\n}\nvoid Scale_RGB_B209(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{\nResult=vec4(Scalar,Scalar,Scalar,1)*Color;\n}\nvoid Fragment_Main_B271(\nfloat Sun_Intensity,\nfloat Sun_Theta,\nfloat Sun_Phi,\nvec3 Normal,\nvec4 Albedo,\nfloat Fresnel_Reflect,\nfloat Shininess,\nvec3 Incident,\nvec4 Horizon_Color,\nvec4 Sky_Color,\nvec4 Ground_Color,\nfloat Indirect_Diffuse,\nfloat Specular,\nfloat Horizon_Power,\nfloat Reflection,\nvec4 Reflection_Sample,\nvec4 Indirect_Sample,\nfloat Sharpness,\nfloat SSS,\nfloat Subsurface,\nvec4 Translucence,\nvec4 Rim_Light,\nvec4 Iridescence,\nout vec4 Result)\n{\nfloat theta=Sun_Theta*2.0*3.14159;\nfloat phi=Sun_Phi*3.14159;\nvec3 lightDir= vec3(cos(phi)*cos(theta),sin(phi),cos(phi)*sin(theta));\nfloat NdotL=max(dot(lightDir,Normal),0.0);\nvec3 R=reflect(Incident,Normal);\nfloat RdotL=max(0.0,dot(R,lightDir));\nfloat specular=pow(RdotL,Shininess);\nspecular=mix(specular,smoothstep(0.495*Sharpness,1.0-0.495*Sharpness,specular),Sharpness);\nvec4 gi=mix(Ground_Color,Sky_Color,Normal.y*0.5+0.5);\nResult=((Sun_Intensity*NdotL+Indirect_Sample*Indirect_Diffuse+Translucence)*(1.0+SSS*Subsurface))*Albedo*(1.0-Fresnel_Reflect)+(Sun_Intensity*specular*Specular+Fresnel_Reflect*Reflection*Reflection_Sample)+Fresnel_Reflect*Rim_Light+Iridescence;\n}\nvoid Bulge_B229(\nbool Enabled,\nvec3 Normal,\nvec3 Tangent,\nfloat Bulge_Height,\nvec4 UV,\nfloat Bulge_Radius,\nvec3 ButtonN,\nout vec3 New_Normal)\n{\nvec2 xy=clamp(UV.xy*2.0,vec2(-1,-1),vec2(1,1));\nvec3 B=(cross(Normal,Tangent));\nfloat k=-clamp(1.0-length(xy)/Bulge_Radius,0.0,1.0)*Bulge_Height;\nk=sin(k*3.14159*0.5);\nk*=smoothstep(0.9998,0.9999,abs(dot(ButtonN,Normal)));\nNew_Normal=Normal*sqrt(1.0-k*k)+(xy.x*Tangent+xy.y*B)*k;\nNew_Normal=Enabled ? New_Normal : Normal;\n}\nvoid SSS_B227(\nvec3 ButtonN,\nvec3 Normal,\nvec3 Incident,\nout float Result)\n{\nfloat NdotI=abs(dot(Normal,Incident));\nfloat BdotI=abs(dot(ButtonN,Incident));\nResult=(abs(NdotI-BdotI)); \n}\nvoid FingerOcclusion_B217(\nfloat Width,\nfloat DistToCenter,\nfloat Fuzz,\nfloat Min_Fuzz,\nvec3 Position,\nvec3 Forward,\nvec3 Nearest,\nfloat Fade_Out,\nout float NotInShadow)\n{\nfloat d=dot((Nearest-Position),Forward);\nfloat sh=smoothstep(Width*0.5,Width*0.5+Fuzz*max(d,0.0)+Min_Fuzz,DistToCenter);\nNotInShadow=1.0-(1.0-sh)*smoothstep(-Fade_Out,0.0,d);\n}\nvoid FingerOcclusion_B218(\nfloat Width,\nfloat DistToCenter,\nfloat Fuzz,\nfloat Min_Fuzz,\nvec3 Position,\nvec3 Forward,\nvec3 Nearest,\nfloat Fade_Out,\nout float NotInShadow)\n{\nfloat d=dot((Nearest-Position),Forward);\nfloat sh=smoothstep(Width*0.5,Width*0.5+Fuzz*max(d,0.0)+Min_Fuzz,DistToCenter);\nNotInShadow=1.0-(1.0-sh)*smoothstep(-Fade_Out,0.0,d);\n}\nvoid Scale_Color_B241(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{\nResult=Scalar*Color;\n}\nvoid From_HSV_B223(\nfloat Hue,\nfloat Saturation,\nfloat Value,\nfloat Alpha,\nout vec4 Color)\n{\nvec4 K=vec4(1.0,2.0/3.0,1.0/3.0,3.0);\nvec3 p=abs(fract(vec3(Hue,Hue,Hue)+K.xyz)*6.0-K.www);\nColor.rgb=Value*mix(K.xxx,clamp(p-K.xxx,0.0,1.0),Saturation);\nColor.a=Alpha;\n}\nvoid Fast_Fresnel_B272(\nfloat Front_Reflect,\nfloat Edge_Reflect,\nfloat Power,\nvec3 Normal,\nvec3 Incident,\nout float Transmit,\nout float Reflect)\n{\nfloat d=max(-dot(Incident,Normal),0.0);\nReflect=Front_Reflect+(Edge_Reflect-Front_Reflect)*pow(1.0-d,Power);\nTransmit=1.0-Reflect;\n}\nvoid Mapped_Environment_B201(\nsampler2D Reflected_Environment,\nsampler2D Indirect_Environment,\nvec3 Dir,\nout vec4 Reflected_Color,\nout vec4 Indirect_Diffuse)\n{\nReflected_Color=texture(Reflected_Environment,vec2(atan(Dir.z,Dir.x)/3.14159*0.5,asin(Dir.y)/3.14159+0.5));\nIndirect_Diffuse=texture(Indirect_Environment,vec2(atan(Dir.z,Dir.x)/3.14159*0.5,asin(Dir.y)/3.14159+0.5));\n}\nvec4 SampleEnv_Bid200(vec3 D,vec4 S,vec4 H,vec4 G,float exponent)\n{\nfloat k=pow(abs(D.y),exponent);\nvec4 C;\nif (D.y>0.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.g<Color.b ? vec4(Color.bg,K.wz) : vec4(Color.gb,K.xy);\nvec4 q=Color.r<p.x ? vec4(p.xyw,Color.r) : vec4(Color.r,p.yzx);\nfloat d=q.x-min(q.w,q.y);\nfloat e=1.0e-10;\nHue=abs(q.z+(q.w-q.y)/(6.0*d+e));\nSaturation=d/(q.x+e);\nValue=q.x;\nAlpha=Color.a;\nHSV=vec3(Hue,Saturation,Value);\n}\nvoid Code_B260(\nfloat X,\nout float Result)\n{\nResult=(acos(X)/3.14159-0.5)*2.0;\n}\nvoid Rim_Light_B282(\nvec3 Front,\nvec3 Normal,\nvec3 Incident,\nfloat Rim_Intensity,\nsampler2D Texture,\nout vec4 Result)\n{\nvec3 R=reflect(Incident,Normal);\nfloat RdotF=dot(R,Front);\nfloat RdotL=sqrt(1.0-RdotF*RdotF);\nvec2 UV=vec2(R.y*0.5+0.5,0.5);\nvec4 Color=texture(Texture,UV);\nResult=Color;\n}\nvoid main()\n{\nvec4 Blob_Color_Q180;\n#if BLOB_ENABLE\nBlob_Fragment_B180(_Blob_Texture_,vExtra2,vExtra3,Blob_Color_Q180);\n#else\nBlob_Color_Q180=vec4(0,0,0,0);\n#endif\nvec3 Incident_Q189=normalize(vPosition-cameraPosition);\nvec3 Normalized_Q188=normalize(vNormal);\nvec3 Normalized_Q221=normalize(vTangent);\nvec4 Color_Q233;\n#if DECAL_ENABLE\nColor_Q233=texture(_Decal_,vUV);\n#else\nColor_Q233=vec4(0,0,0,0);\n#endif\nfloat X_Q240;\nfloat Y_Q240;\nfloat Z_Q240;\nfloat W_Q240;\nX_Q240=vExtra1.x;\nY_Q240=vExtra1.y;\nZ_Q240=vExtra1.z;\nW_Q240=vExtra1.w;\nvec4 Linear_Q193;\nLinear_Q193.rgb=clamp(_Sky_Color_.rgb*_Sky_Color_.rgb,0.0,1.0);\nLinear_Q193.a=_Sky_Color_.a;\nvec4 Linear_Q194;\nLinear_Q194.rgb=clamp(_Horizon_Color_.rgb*_Horizon_Color_.rgb,0.0,1.0);\nLinear_Q194.a=_Horizon_Color_.a;\nvec4 Linear_Q195;\nLinear_Q195.rgb=clamp(_Ground_Color_.rgb*_Ground_Color_.rgb,0.0,1.0);\nLinear_Q195.a=_Ground_Color_.a;\nvec3 Left_Index_Q214;\nvec3 Right_Index_Q214;\nvec3 Left_Index_Middle_Q214;\nvec3 Right_Index_Middle_Q214;\nFinger_Positions_B214(_Left_Index_Pos_,_Right_Index_Pos_,_Left_Index_Middle_Pos_,_Right_Index_Middle_Pos_,Left_Index_Q214,Right_Index_Q214,Left_Index_Middle_Q214,Right_Index_Middle_Q214);\nvec4 Linear_Q196;\nLinear_Q196.rgb=clamp(_Albedo_.rgb*_Albedo_.rgb,0.0,1.0);\nLinear_Q196.a=_Albedo_.a;\nvec3 Normalized_Q257=normalize(vBinormal);\nvec3 Incident_Q220=normalize(vPosition-cameraPosition);\nvec3 New_Normal_Q229;\nBulge_B229(_Bulge_Enabled_,Normalized_Q188,Normalized_Q221,_Bulge_Height_,vColor,_Bulge_Radius_,vBinormal,New_Normal_Q229);\nfloat Result_Q227;\nSSS_B227(vBinormal,New_Normal_Q229,Incident_Q189,Result_Q227);\nvec4 Result_Q241;\nScale_Color_B241(Color_Q233,X_Q240,Result_Q241);\nfloat Transmit_Q272;\nfloat Reflect_Q272;\nFast_Fresnel_B272(_Front_Reflect_,_Edge_Reflect_,_Power_,New_Normal_Q229,Incident_Q189,Transmit_Q272,Reflect_Q272);\nfloat Product_Q275=Y_Q240*Y_Q240;\nvec3 NearP_Q215;\nvec3 NearQ_Q215;\nfloat Distance_Q215;\nMin_Segment_Distance_B215(Left_Index_Q214,Left_Index_Middle_Q214,vPosition,cameraPosition,NearP_Q215,NearQ_Q215,Distance_Q215);\nvec3 NearP_Q213;\nvec3 NearQ_Q213;\nfloat Distance_Q213;\nMin_Segment_Distance_B215(Right_Index_Q214,Right_Index_Middle_Q214,vPosition,cameraPosition,NearP_Q213,NearQ_Q213,Distance_Q213);\nvec3 Reflected_Q197=reflect(Incident_Q189,New_Normal_Q229);\nvec4 Product_Q253=Linear_Q196*vec4(1,1,1,1);\nvec4 Result_Q282;\nRim_Light_B282(Normalized_Q257,Normalized_Q188,Incident_Q220,_Rim_Intensity_,_Rim_Texture_,Result_Q282);\nfloat Dot_Q222=dot(Incident_Q220, Normalized_Q221);\nfloat MaxAB_Q273=max(Reflect_Q272,Product_Q275);\nfloat NotInShadow_Q217;\n#if OCCLUSION_ENABLED\nFingerOcclusion_B217(_Width_,Distance_Q215,_Fuzz_,_Min_Fuzz_,vPosition,vBinormal,NearP_Q215,_Clip_Fade_,NotInShadow_Q217);\n#else\nNotInShadow_Q217=1.0;\n#endif\nfloat NotInShadow_Q218;\n#if OCCLUSION_ENABLED\nFingerOcclusion_B218(_Width_,Distance_Q213,_Fuzz_,_Min_Fuzz_,vPosition,vBinormal,NearP_Q213,_Clip_Fade_,NotInShadow_Q218);\n#else\nNotInShadow_Q218=1.0;\n#endif\nvec4 Reflected_Color_Q201;\nvec4 Indirect_Diffuse_Q201;\n#if ENV_ENABLE\nMapped_Environment_B201(_Reflection_Map_,_Indirect_Environment_,Reflected_Q197,Reflected_Color_Q201,Indirect_Diffuse_Q201);\n#else\nReflected_Color_Q201=vec4(0,0,0,1);\nIndirect_Diffuse_Q201=vec4(0,0,0,1);\n#endif\nvec4 Reflected_Color_Q200;\nvec4 Indirect_Color_Q200;\n#if SKY_ENABLED\nSky_Environment_B200(New_Normal_Q229,Reflected_Q197,Linear_Q193,Linear_Q194,Linear_Q195,_Horizon_Power_,Reflected_Color_Q200,Indirect_Color_Q200);\n#else\nReflected_Color_Q200=vec4(0,0,0,1);\nIndirect_Color_Q200=vec4(0,0,0,1);\n#endif\nfloat Hue_Q225;\nfloat Saturation_Q225;\nfloat Value_Q225;\nfloat Alpha_Q225;\nvec3 HSV_Q225;\nTo_HSV_B225(Product_Q253,Hue_Q225,Saturation_Q225,Value_Q225,Alpha_Q225,HSV_Q225);\nfloat Hue_Q277;\nfloat Saturation_Q277;\nfloat Value_Q277;\nfloat Alpha_Q277;\nvec3 HSV_Q277;\nTo_HSV_B225(Result_Q282,Hue_Q277,Saturation_Q277,Value_Q277,Alpha_Q277,HSV_Q277);\nfloat Result_Q260;\nCode_B260(Dot_Q222,Result_Q260);\nfloat AbsA_Q226=abs(Result_Q260);\nfloat MinAB_Q208=min(NotInShadow_Q217,NotInShadow_Q218);\nvec4 Sum_Q198=Reflected_Color_Q201+Reflected_Color_Q200;\nvec4 Sum_Q199=Indirect_Diffuse_Q201+Indirect_Color_Q200;\nvec3 HSV_Out_Q276;\nVaryHSV_B258(HSV_Q277,_Rim_Hue_Shift_,_Rim_Saturation_Shift_,_Rim_Value_Shift_,HSV_Out_Q276);\nfloat Out_Q264;\nRemap_Range_B264(-1.0,1.0,0.0,1.0,Result_Q260,Out_Q264);\nfloat Product_Q256;\nProduct_Q256=AbsA_Q226*_Hue_Shift_;\nfloat X_Q278;\nfloat Y_Q278;\nfloat Z_Q278;\nTo_XYZ_B224(HSV_Out_Q276,X_Q278,Y_Q278,Z_Q278);\nvec2 Vec2_Q262=vec2(Out_Q264,0.5);\nvec3 HSV_Out_Q258;\nVaryHSV_B258(HSV_Q225,Product_Q256,_Saturation_Shift_,_Value_Shift_,HSV_Out_Q258);\nvec4 Color_Q279;\nFrom_HSV_B223(X_Q278,Y_Q278,Z_Q278,0.0,Color_Q279);\nvec4 Color_Q261;\n#if IRIDESCENCE_ENABLED\nColor_Q261=texture(_Iridescence_Texture_,Vec2_Q262);\n#else\nColor_Q261=vec4(0,0,0,0);\n#endif\nfloat X_Q224;\nfloat Y_Q224;\nfloat Z_Q224;\nTo_XYZ_B224(HSV_Out_Q258,X_Q224,Y_Q224,Z_Q224);\nvec4 Result_Q281=_Rim_Intensity_*Color_Q279;\nvec4 Result_Q263=_Iridescence_Intensity_*Color_Q261;\nvec4 Color_Q223;\nFrom_HSV_B223(X_Q224,Y_Q224,Z_Q224,0.0,Color_Q223);\nvec4 Result_Q234=Result_Q241+(1.0-Result_Q241.a)*Color_Q223;\nvec4 Result_Q271;\nFragment_Main_B271(_Sun_Intensity_,_Sun_Theta_,_Sun_Phi_,New_Normal_Q229,Result_Q234,MaxAB_Q273,_Shininess_,Incident_Q189,_Horizon_Color_,_Sky_Color_,_Ground_Color_,_Indirect_Diffuse_,_Specular_,_Horizon_Power_,_Reflection_,Sum_Q198,Sum_Q199,_Sharpness_,Result_Q227,_Subsurface_,vec4(0,0,0,0),Result_Q281,Result_Q263,Result_Q271);\nvec4 Result_Q209;\nScale_RGB_B209(Result_Q271,MinAB_Q208,Result_Q209);\nvec4 sRGB_Q192;\nFastLinearTosRGB_B192(Result_Q209,sRGB_Q192);\nvec4 Result_Q181=Blob_Color_Q180+(1.0-Blob_Color_Q180.a)*sRGB_Q192;\nvec4 Result_Q190=Result_Q181; Result_Q190.a=1.0;\nvec4 Out_Color=Result_Q190;\nfloat Clip_Threshold=0.001;\nbool To_sRGB=false;\ngl_FragColor=Out_Color;\n}";_.ShaderStore.ShadersStore.mrdlSliderThumbVertexShader="uniform mat4 world;\nuniform mat4 viewProjection;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n#ifdef TANGENT\nattribute vec3 tangent;\n#else\nconst vec3 tangent=vec3(0.);\n#endif\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 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;\nvarying vec4 vExtra2;\nvarying vec4 vExtra3;\nvoid Object_To_World_Pos_B162(\nvec3 Pos_Object,\nout vec3 Pos_World)\n{\nPos_World=(world*vec4(Pos_Object,1.0)).xyz;\n}\nvoid Object_To_World_Normal_B182(\nvec3 Nrm_Object,\nout vec3 Nrm_World)\n{\nNrm_World=(vec4(Nrm_Object,0.0)).xyz;\n}\nvoid Blob_Vertex_B173(\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,\nfloat Blob_Fade_Length,\nfloat Blob_Pulse,\nfloat Blob_Fade,\nout vec4 Blob_Info)\n{\nvec3 blob= (Use_Global_Left_Index ? Global_Left_Index_Tip_Position.xyz : Blob_Position);\nvec3 delta=blob-Position;\nfloat dist=dot(Normal,delta);\nfloat lerpValue=clamp((abs(dist)-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);\nfloat fadeValue=1.0-clamp((abs(dist)-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);\nfloat size=Blob_Near_Size+(Blob_Far_Size-Blob_Near_Size)*lerpValue;\nvec2 blobXY=vec2(dot(delta,Tangent),dot(delta,Bitangent))/(0.0001+size);\nfloat Fade=fadeValue*Intensity*Blob_Fade;\nfloat Distance=(lerpValue*0.5+0.5)*(1.0-Blob_Pulse);\nBlob_Info=vec4(blobXY.x,blobXY.y,Distance,Fade);\n}\nvoid Blob_Vertex_B174(\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,\nfloat Blob_Fade_Length,\nfloat Blob_Pulse,\nfloat Blob_Fade,\nout vec4 Blob_Info)\n{\nvec3 blob= (Use_Global_Right_Index ? Global_Right_Index_Tip_Position.xyz : Blob_Position);\nvec3 delta=blob-Position;\nfloat dist=dot(Normal,delta);\nfloat lerpValue=clamp((abs(dist)-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);\nfloat fadeValue=1.0-clamp((abs(dist)-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);\nfloat size=Blob_Near_Size+(Blob_Far_Size-Blob_Near_Size)*lerpValue;\nvec2 blobXY=vec2(dot(delta,Tangent),dot(delta,Bitangent))/(0.0001+size);\nfloat Fade=fadeValue*Intensity*Blob_Fade;\nfloat Distance=(lerpValue*0.5+0.5)*(1.0-Blob_Pulse);\nBlob_Info=vec4(blobXY.x,blobXY.y,Distance,Fade);\n}\nvoid Move_Verts_B280(\nfloat Anisotropy,\nvec3 P,\nfloat Radius,\nfloat Bevel,\nvec3 Normal_Object,\nfloat ScaleZ,\nfloat Stretch,\nout vec3 New_P,\nout vec2 New_UV,\nout float Radial_Gradient,\nout vec3 Radial_Dir,\nout vec3 New_Normal)\n{\nvec2 UV=P.xy*2.0+0.5;\nvec2 center=clamp(UV,0.0,1.0);\nvec2 delta=UV-center;\nfloat deltad=(length(delta)*2.0);\nfloat f=(Bevel+(Radius-Bevel)*Stretch)/Radius;\nfloat innerd=clamp(deltad*2.0,0.0,1.0);\nfloat outerd=clamp(deltad*2.0-1.0,0.0,1.0);\nfloat bevelAngle=outerd*3.14159*0.5;\nfloat sinb=sin(bevelAngle);\nfloat cosb=cos(bevelAngle);\nfloat beveld=(1.0-f)*innerd+f*sinb;\nfloat br=outerd;\nvec2 r2=2.0*vec2(Radius/Anisotropy,Radius);\nfloat dir=P.z<0.0001 ? 1.0 : -1.0;\nNew_UV=center+r2*((0.5-center)+normalize(delta+vec2(0.0,0.000001))*beveld*0.5);\nNew_P=vec3(New_UV-0.5,P.z+dir*(1.0-cosb)*Bevel*ScaleZ);\nRadial_Gradient=clamp((deltad-0.5)*2.0,0.0,1.0);\nRadial_Dir=vec3(delta*r2,0.0);\nvec3 beveledNormal=cosb*Normal_Object+sinb*vec3(delta.x,delta.y,0.0);\nNew_Normal=Normal_Object.z==0.0 ? Normal_Object : beveledNormal;\n}\nvoid Object_To_World_Dir_B210(\nvec3 Dir_Object,\nout vec3 Normal_World,\nout vec3 Normal_World_N,\nout float Normal_Length)\n{\nNormal_World=(world*vec4(Dir_Object,0.0)).xyz;\nNormal_Length=length(Normal_World);\nNormal_World_N=Normal_World/Normal_Length;\n}\nvoid To_XYZ_B228(\nvec3 Vec3,\nout float X,\nout float Y,\nout float Z)\n{\nX=Vec3.x;\nY=Vec3.y;\nZ=Vec3.z;\n}\nvoid Conditional_Float_B243(\nbool Which,\nfloat If_True,\nfloat If_False,\nout float Result)\n{\nResult=Which ? If_True : If_False;\n}\nvoid Object_To_World_Dir_B178(\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 Pick_Radius_B219(\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 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}";var Ut=function(t){function e(){var e=t.call(this)||this;return e.SKY_ENABLED=!0,e.BLOB_ENABLE_2=!0,e.IRIDESCENCE_ENABLED=!0,e._needNormals=!0,e._needUVs=!0,e.rebuild(),e}return r(e,t),e}(_.MaterialDefines),jt=function(t){function e(i,o){var n=t.call(this,i,o)||this;return n.radius=.157,n.bevelFront=.065,n.bevelFrontStretch=.077,n.bevelBack=.031,n.bevelBackStretch=0,n.radiusTopLeft=1,n.radiusTopRight=1,n.radiusBottomLeft=1,n.radiusBottomRight=1,n.bulgeEnabled=!1,n.bulgeHeight=-.323,n.bulgeRadius=.73,n.sunIntensity=2,n.sunTheta=.937,n.sunPhi=.555,n.indirectDiffuse=1,n.albedo=new _.Color4(.0117647,.505882,.996078,1),n.specular=0,n.shininess=10,n.sharpness=0,n.subsurface=.31,n.leftGradientColor=new _.Color4(.0117647,.505882,.996078,1),n.rightGradientColor=new _.Color4(.0117647,.505882,.996078,1),n.reflection=.749,n.frontReflect=0,n.edgeReflect=.09,n.power=8.1,n.skyColor=new _.Color4(.0117647,.960784,.996078,1),n.horizonColor=new _.Color4(.0117647,.333333,.996078,1),n.groundColor=new _.Color4(0,.254902,.996078,1),n.horizonPower=1,n.width=.02,n.fuzz=.5,n.minFuzz=.001,n.clipFade=.01,n.hueShift=0,n.saturationShift=0,n.valueShift=0,n.blobPosition=new _.Vector3(0,0,.1),n.blobIntensity=.5,n.blobNearSize=.01,n.blobFarSize=.03,n.blobNearDistance=0,n.blobFarDistance=.08,n.blobFadeLength=.576,n.blobPulse=0,n.blobFade=1,n.blobPosition2=new _.Vector3(.2,0,.1),n.blobNearSize2=.01,n.blobPulse2=0,n.blobFade2=1,n.blobTexture=new _.Texture("",n.getScene()),n.leftIndexPosition=new _.Vector3(0,0,1),n.rightIndexPosition=new _.Vector3(-1,-1,-1),n.leftIndexMiddlePosition=new _.Vector3(0,0,0),n.rightIndexMiddlePosition=new _.Vector3(0,0,0),n.decalScaleXY=new _.Vector2(1.5,1.5),n.decalFrontOnly=!0,n.rimIntensity=.287,n.rimHueShift=0,n.rimSaturationShift=0,n.rimValueShift=-1,n.iridescenceIntensity=0,n.useGlobalLeftIndex=1,n.useGlobalRightIndex=1,n.globalLeftIndexTipProximity=0,n.globalRightIndexTipProximity=0,n.globalLeftIndexTipPosition=new _.Vector4(.5,0,-.55,1),n.globaRightIndexTipPosition=new _.Vector4(0,0,0,1),n.globalLeftThumbTipPosition=new _.Vector4(.5,0,-.55,1),n.globalRightThumbTipPosition=new _.Vector4(0,0,0,1),n.globalLeftIndexMiddlePosition=new _.Vector4(.5,0,-.55,1),n.globalRightIndexMiddlePosition=new _.Vector4(0,0,0,1),n.alphaMode=_.Constants.ALPHA_DISABLE,n.backFaceCulling=!1,n._blueGradientTexture=new _.Texture(e.BLUE_GRADIENT_TEXTURE_URL,o,!0,!1,_.Texture.NEAREST_SAMPLINGMODE),n._decalTexture=new _.Texture("",n.getScene()),n._reflectionMapTexture=new _.Texture("",n.getScene()),n._indirectEnvTexture=new _.Texture("",n.getScene()),n}return r(e,t),e.prototype.needAlphaBlending=function(){return!1},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){if(this.isFrozen&&e.effect&&e.effect._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new Ut);var i=e.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(e))return!0;var n=o.getEngine();if(_.MaterialHelper.PrepareDefinesForAttributes(t,i,!1,!1),i.isDirty){i.markAsProcessed(),o.resetCachedMaterial();var r=new _.EffectFallbacks;i.FOG&&r.addFallback(1,"FOG"),_.MaterialHelper.HandleFallbacksForShadows(i,r),i.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;var a=[_.VertexBuffer.PositionKind];i.NORMAL&&a.push(_.VertexBuffer.NormalKind),i.UV1&&a.push(_.VertexBuffer.UVKind),i.UV2&&a.push(_.VertexBuffer.UV2Kind),i.VERTEXCOLOR&&a.push(_.VertexBuffer.ColorKind),i.TANGENT&&a.push(_.VertexBuffer.TangentKind),_.MaterialHelper.PrepareAttributesForInstances(a,i);var s=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"],h=["_Rim_Texture_","_Iridescence_Texture_"],c=new Array;_.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:l,uniformBuffersNames:c,samplers:h,defines:i,maxSimultaneousLights:4}),e.setEffect(o.getEngine().createEffect("mrdlSliderThumb",{attributes:a,uniformsNames:l,uniformBuffersNames:c,samplers:h,defines:s,fallbacks:r,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),i)}return!(!e.effect||!e.effect.isReady()||(i._renderId=o.getRenderId(),e.effect._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){if(i.materialDefines){var o=i.effect;o&&(this._activeEffect=o,this.bindOnlyWorldMatrix(t),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_",this._reflectionMapTexture),this._activeEffect.setTexture("_Indirect_Environment_",this._indirectEnvTexture),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_",this._decalTexture),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(e,this._activeEffect))}},e.prototype.getAnimatables=function(){return[]},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e),this._reflectionMapTexture.dispose(),this._indirectEnvTexture.dispose(),this._blueGradientTexture.dispose(),this._decalTexture.dispose()},e.prototype.clone=function(t){var i=this;return _.SerializationHelper.Clone((function(){return new e(t,i.getScene())}),this)},e.prototype.serialize=function(){var e=t.prototype.serialize.call(this);return e.customType="BABYLON.MRDLSliderThumbMaterial",e},e.prototype.getClassName=function(){return"MRDLSliderThumbMaterial"},e.Parse=function(t,i,o){return _.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},e.BLUE_GRADIENT_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/MRDL/mrtk-mrdl-blue-gradient.png",a([(0,_.serialize)()],e.prototype,"radius",void 0),a([(0,_.serialize)()],e.prototype,"bevelFront",void 0),a([(0,_.serialize)()],e.prototype,"bevelFrontStretch",void 0),a([(0,_.serialize)()],e.prototype,"bevelBack",void 0),a([(0,_.serialize)()],e.prototype,"bevelBackStretch",void 0),a([(0,_.serialize)()],e.prototype,"radiusTopLeft",void 0),a([(0,_.serialize)()],e.prototype,"radiusTopRight",void 0),a([(0,_.serialize)()],e.prototype,"radiusBottomLeft",void 0),a([(0,_.serialize)()],e.prototype,"radiusBottomRight",void 0),a([(0,_.serialize)()],e.prototype,"bulgeEnabled",void 0),a([(0,_.serialize)()],e.prototype,"bulgeHeight",void 0),a([(0,_.serialize)()],e.prototype,"bulgeRadius",void 0),a([(0,_.serialize)()],e.prototype,"sunIntensity",void 0),a([(0,_.serialize)()],e.prototype,"sunTheta",void 0),a([(0,_.serialize)()],e.prototype,"sunPhi",void 0),a([(0,_.serialize)()],e.prototype,"indirectDiffuse",void 0),a([(0,_.serialize)()],e.prototype,"albedo",void 0),a([(0,_.serialize)()],e.prototype,"specular",void 0),a([(0,_.serialize)()],e.prototype,"shininess",void 0),a([(0,_.serialize)()],e.prototype,"sharpness",void 0),a([(0,_.serialize)()],e.prototype,"subsurface",void 0),a([(0,_.serialize)()],e.prototype,"leftGradientColor",void 0),a([(0,_.serialize)()],e.prototype,"rightGradientColor",void 0),a([(0,_.serialize)()],e.prototype,"reflection",void 0),a([(0,_.serialize)()],e.prototype,"frontReflect",void 0),a([(0,_.serialize)()],e.prototype,"edgeReflect",void 0),a([(0,_.serialize)()],e.prototype,"power",void 0),a([(0,_.serialize)()],e.prototype,"skyColor",void 0),a([(0,_.serialize)()],e.prototype,"horizonColor",void 0),a([(0,_.serialize)()],e.prototype,"groundColor",void 0),a([(0,_.serialize)()],e.prototype,"horizonPower",void 0),a([(0,_.serialize)()],e.prototype,"width",void 0),a([(0,_.serialize)()],e.prototype,"fuzz",void 0),a([(0,_.serialize)()],e.prototype,"minFuzz",void 0),a([(0,_.serialize)()],e.prototype,"clipFade",void 0),a([(0,_.serialize)()],e.prototype,"hueShift",void 0),a([(0,_.serialize)()],e.prototype,"saturationShift",void 0),a([(0,_.serialize)()],e.prototype,"valueShift",void 0),a([(0,_.serialize)()],e.prototype,"blobPosition",void 0),a([(0,_.serialize)()],e.prototype,"blobIntensity",void 0),a([(0,_.serialize)()],e.prototype,"blobNearSize",void 0),a([(0,_.serialize)()],e.prototype,"blobFarSize",void 0),a([(0,_.serialize)()],e.prototype,"blobNearDistance",void 0),a([(0,_.serialize)()],e.prototype,"blobFarDistance",void 0),a([(0,_.serialize)()],e.prototype,"blobFadeLength",void 0),a([(0,_.serialize)()],e.prototype,"blobPulse",void 0),a([(0,_.serialize)()],e.prototype,"blobFade",void 0),a([(0,_.serialize)()],e.prototype,"blobPosition2",void 0),a([(0,_.serialize)()],e.prototype,"blobNearSize2",void 0),a([(0,_.serialize)()],e.prototype,"blobPulse2",void 0),a([(0,_.serialize)()],e.prototype,"blobFade2",void 0),a([(0,_.serialize)()],e.prototype,"blobTexture",void 0),a([(0,_.serialize)()],e.prototype,"leftIndexPosition",void 0),a([(0,_.serialize)()],e.prototype,"rightIndexPosition",void 0),a([(0,_.serialize)()],e.prototype,"leftIndexMiddlePosition",void 0),a([(0,_.serialize)()],e.prototype,"rightIndexMiddlePosition",void 0),a([(0,_.serialize)()],e.prototype,"decalScaleXY",void 0),a([(0,_.serialize)()],e.prototype,"decalFrontOnly",void 0),a([(0,_.serialize)()],e.prototype,"rimIntensity",void 0),a([(0,_.serialize)()],e.prototype,"rimHueShift",void 0),a([(0,_.serialize)()],e.prototype,"rimSaturationShift",void 0),a([(0,_.serialize)()],e.prototype,"rimValueShift",void 0),a([(0,_.serialize)()],e.prototype,"iridescenceIntensity",void 0),e}(_.PushMaterial);(0,_.RegisterClass)("BABYLON.GUI.MRDLSliderThumbMaterial",jt);_.ShaderStore.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}";_.ShaderStore.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}";var Yt=function(t){function e(){var e=t.call(this)||this;return e.IRIDESCENCE_ENABLE=!0,e.SMOOTH_EDGES=!0,e._needNormals=!0,e.rebuild(),e}return r(e,t),e}(_.MaterialDefines),Xt=function(t){function e(i,o){var n=t.call(this,i,o)||this;return n.radius=.3,n.lineWidth=.003,n.absoluteSizes=!1,n._filterWidth=1,n.baseColor=new _.Color4(0,0,0,1),n.lineColor=new _.Color4(.2,.262745,.4,1),n.radiusTopLeft=1,n.radiusTopRight=1,n.radiusBottomLeft=1,n.radiusBottomRight=1,n._rate=0,n.highlightColor=new _.Color4(.239216,.435294,.827451,1),n.highlightWidth=0,n._highlightTransform=new _.Vector4(1,1,0,0),n._highlight=1,n.iridescenceIntensity=.45,n.iridescenceEdgeIntensity=1,n.iridescenceTint=new _.Color4(1,1,1,1),n._angle=-45,n.fadeOut=1,n._reflected=!0,n._frequency=1,n._verticalOffset=0,n.gradientColor=new _.Color4(.74902,.74902,.74902,1),n.topLeftGradientColor=new _.Color4(.00784314,.294118,.580392,1),n.topRightGradientColor=new _.Color4(.305882,0,1,1),n.bottomLeftGradientColor=new _.Color4(.133333,.258824,.992157,1),n.bottomRightGradientColor=new _.Color4(.176471,.176471,.619608,1),n.edgeWidth=.5,n.edgePower=1,n.edgeLineGradientBlend=.5,n.alphaMode=_.Constants.ALPHA_DISABLE,n.backFaceCulling=!1,n._iridescentMapTexture=new _.Texture(e.IRIDESCENT_MAP_TEXTURE_URL,n.getScene(),!0,!1,_.Texture.NEAREST_SAMPLINGMODE),n}return r(e,t),e.prototype.needAlphaBlending=function(){return!1},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){if(this.isFrozen&&e.effect&&e.effect._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new Yt);var i=e.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(e))return!0;var n=o.getEngine();if(_.MaterialHelper.PrepareDefinesForAttributes(t,i,!1,!1),i.isDirty){i.markAsProcessed(),o.resetCachedMaterial();var r=new _.EffectFallbacks;i.FOG&&r.addFallback(1,"FOG"),_.MaterialHelper.HandleFallbacksForShadows(i,r),i.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;var a=[_.VertexBuffer.PositionKind];i.NORMAL&&a.push(_.VertexBuffer.NormalKind),i.UV1&&a.push(_.VertexBuffer.UVKind),i.UV2&&a.push(_.VertexBuffer.UV2Kind),i.VERTEXCOLOR&&a.push(_.VertexBuffer.ColorKind),i.TANGENT&&a.push(_.VertexBuffer.TangentKind),_.MaterialHelper.PrepareAttributesForInstances(a,i);var s=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_"],h=["_Iridescent_Map_"],c=new Array;_.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:l,uniformBuffersNames:c,samplers:h,defines:i,maxSimultaneousLights:4}),e.setEffect(o.getEngine().createEffect("mrdlBackplate",{attributes:a,uniformsNames:l,uniformBuffersNames:c,samplers:h,defines:s,fallbacks:r,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),i)}return!(!e.effect||!e.effect.isReady()||(i._renderId=o.getRenderId(),e.effect._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){if(i.materialDefines){var o=i.effect;o&&(this._activeEffect=o,this.bindOnlyWorldMatrix(t),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(e,this._activeEffect))}},e.prototype.getAnimatables=function(){return[]},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e)},e.prototype.clone=function(t){var i=this;return _.SerializationHelper.Clone((function(){return new e(t,i.getScene())}),this)},e.prototype.serialize=function(){var e=t.prototype.serialize.call(this);return e.customType="BABYLON.MRDLBackplateMaterial",e},e.prototype.getClassName=function(){return"MRDLBackplateMaterial"},e.Parse=function(t,i,o){return _.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},e.IRIDESCENT_MAP_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/MRDL/mrtk-mrdl-backplate-iridescence.png",a([(0,_.serialize)()],e.prototype,"radius",void 0),a([(0,_.serialize)()],e.prototype,"lineWidth",void 0),a([(0,_.serialize)()],e.prototype,"absoluteSizes",void 0),a([(0,_.serialize)()],e.prototype,"baseColor",void 0),a([(0,_.serialize)()],e.prototype,"lineColor",void 0),a([(0,_.serialize)()],e.prototype,"radiusTopLeft",void 0),a([(0,_.serialize)()],e.prototype,"radiusTopRight",void 0),a([(0,_.serialize)()],e.prototype,"radiusBottomLeft",void 0),a([(0,_.serialize)()],e.prototype,"radiusBottomRight",void 0),a([(0,_.serialize)()],e.prototype,"highlightColor",void 0),a([(0,_.serialize)()],e.prototype,"highlightWidth",void 0),a([(0,_.serialize)()],e.prototype,"iridescenceIntensity",void 0),a([(0,_.serialize)()],e.prototype,"iridescenceEdgeIntensity",void 0),a([(0,_.serialize)()],e.prototype,"iridescenceTint",void 0),a([(0,_.serialize)()],e.prototype,"fadeOut",void 0),a([(0,_.serialize)()],e.prototype,"gradientColor",void 0),a([(0,_.serialize)()],e.prototype,"topLeftGradientColor",void 0),a([(0,_.serialize)()],e.prototype,"topRightGradientColor",void 0),a([(0,_.serialize)()],e.prototype,"bottomLeftGradientColor",void 0),a([(0,_.serialize)()],e.prototype,"bottomRightGradientColor",void 0),a([(0,_.serialize)()],e.prototype,"edgeWidth",void 0),a([(0,_.serialize)()],e.prototype,"edgePower",void 0),a([(0,_.serialize)()],e.prototype,"edgeLineGradientBlend",void 0),e}(_.PushMaterial);(0,_.RegisterClass)("BABYLON.GUI.MRDLBackplateMaterial",Xt);var Kt=function(t){function e(e,i){var o=t.call(this,e)||this;return o.onValueChangedObservable=new _.Observable,o._sliderBackplateVisible=i||!1,o._minimum=0,o._maximum=100,o._step=0,o._value=50,o}return r(e,t),Object.defineProperty(e.prototype,"mesh",{get:function(){return this.node?this._sliderThumb:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"minimum",{get:function(){return this._minimum},set:function(t){this._minimum!==t&&(this._minimum=Math.max(t,0),this._value=Math.max(Math.min(this._value,this._maximum),this._minimum))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maximum",{get:function(){return this._maximum},set:function(t){this._maximum!==t&&(this._maximum=Math.max(t,this._minimum),this._value=Math.max(Math.min(this._value,this._maximum),this._minimum))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"step",{get:function(){return this._step},set:function(t){this._step!==t&&(this._step=Math.max(Math.min(t,this._maximum-this._minimum),0))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(t){this._value!==t&&(this._value=Math.max(Math.min(t,this._maximum),this._minimum),this._sliderThumb&&(this._sliderThumb.position.x=this._convertToPosition(this.value)),this.onValueChangedObservable.notifyObservers(this._value))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"start",{get:function(){return this.node?this._sliderBar.position.x-this._sliderBar.scaling.x/2:-.5},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this.node?this._sliderBar.position.x+this._sliderBar.scaling.x/2:.5},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sliderBarMaterial",{get:function(){return this._sliderBarMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sliderThumbMaterial",{get:function(){return this._sliderThumbMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sliderBackplateMaterial",{get:function(){return this._sliderBackplateMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isVisible",{set:function(t){var e;this._isVisible!==t&&(this._isVisible=t,null===(e=this.node)||void 0===e||e.setEnabled(t))},enumerable:!1,configurable:!0}),e.prototype._createNode=function(t){var i=this,o=(0,_.CreateBox)("".concat(this.name,"_sliderbackplate"),{width:1,height:1,depth:1},t);return o.isPickable=!1,o.visibility=0,o.scaling=new _.Vector3(1,.5,.8),_.SceneLoader.ImportMeshAsync(void 0,e.MODEL_BASE_URL,e.MODEL_FILENAME,t).then((function(t){t.meshes.forEach((function(t){t.isPickable=!1}));var e=t.meshes[1],n=t.meshes[1].clone("".concat(i.name,"_sliderbar"),o),r=t.meshes[1].clone("".concat(i.name,"_sliderthumb"),o);e.visibility=0,i._sliderBackplateVisible&&(e.visibility=1,e.name="".concat(i.name,"_sliderbackplate"),e.scaling.x=1,e.scaling.z=.2,e.parent=o,i._sliderBackplateMaterial&&(e.material=i._sliderBackplateMaterial),i._sliderBackplate=e),n&&(n.parent=o,n.position.z=-.1,n.scaling=new _.Vector3(.8,.04,.3),i._sliderBarMaterial&&(n.material=i._sliderBarMaterial),i._sliderBar=n),r&&(r.parent=o,r.isPickable=!0,r.position.z=-.115,r.scaling=new _.Vector3(.025,.3,.6),r.position.x=i._convertToPosition(i.value),r.addBehavior(i._createBehavior()),i._sliderThumbMaterial&&(r.material=i._sliderThumbMaterial),i._sliderThumb=r),i._injectGUI3DReservedDataStore(o).control=i,o.getChildMeshes().forEach((function(t){i._injectGUI3DReservedDataStore(t).control=i}))})),this._affectMaterial(o),o},e.prototype._affectMaterial=function(t){var e,i,o;this._sliderBackplateMaterial=null!==(e=this._sliderBackplateMaterial)&&void 0!==e?e:new Xt("".concat(this.name,"_sliderbackplate_material"),t.getScene()),this._sliderBarMaterial=null!==(i=this._sliderBarMaterial)&&void 0!==i?i:new Gt("".concat(this.name,"_sliderbar_material"),t.getScene()),this._sliderThumbMaterial=null!==(o=this._sliderThumbMaterial)&&void 0!==o?o:new jt("".concat(this.name,"_sliderthumb_material"),t.getScene())},e.prototype._createBehavior=function(){var t=this,e=new _.PointerDragBehavior({dragAxis:_.Vector3.Right()});return e.moveAttached=!1,e.onDragStartObservable.add((function(){t._draggedPosition=t._sliderThumb.position.x})),e.onDragObservable.add((function(e){t._draggedPosition+=e.dragDistance/t.scaling.x,t.value=t._convertToValue(t._draggedPosition)})),e},e.prototype._convertToPosition=function(t){var e=(t-this.minimum)/(this.maximum-this.minimum)*(this.end-this.start)+this.start;return Math.min(Math.max(e,this.start),this.end)},e.prototype._convertToValue=function(t){var e=(t-this.start)/(this.end-this.start)*(this.maximum-this.minimum);return e=this.step?Math.round(e/this.step)*this.step:e,Math.max(Math.min(this.minimum+e,this._maximum),this._minimum)},e.prototype.dispose=function(){var e,i,o,n,r,a;t.prototype.dispose.call(this),null===(e=this._sliderBar)||void 0===e||e.dispose(),null===(i=this._sliderThumb)||void 0===i||i.dispose(),null===(o=this._sliderBarMaterial)||void 0===o||o.dispose(),null===(n=this._sliderThumbMaterial)||void 0===n||n.dispose(),null===(r=this._sliderBackplate)||void 0===r||r.dispose(),null===(a=this._sliderBackplateMaterial)||void 0===a||a.dispose()},e.MODEL_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",e.MODEL_FILENAME="mrtk-fluent-backplate.glb",e}(ut),Zt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._radius=5,e}return r(e,t),Object.defineProperty(e.prototype,"radius",{get:function(){return this._radius},set:function(t){var e=this;this._radius!==t&&(this._radius=t,_.Tools.SetImmediate((function(){e._arrangeChildren()})))},enumerable:!1,configurable:!0}),e.prototype._mapGridNode=function(t,e){var i=t.mesh;if(i){var o=this._sphericalMapping(e);switch(t.position=o,this.orientation){case gt.FACEORIGIN_ORIENTATION:i.lookAt(new _.Vector3(2*o.x,2*o.y,2*o.z));break;case gt.FACEORIGINREVERSED_ORIENTATION:i.lookAt(new _.Vector3(-o.x,-o.y,-o.z));break;case gt.FACEFORWARD_ORIENTATION:break;case gt.FACEFORWARDREVERSED_ORIENTATION:i.rotate(_.Axis.Y,Math.PI,_.Space.LOCAL)}}},e.prototype._sphericalMapping=function(t){var e=new _.Vector3(0,0,this._radius),i=t.y/this._radius,o=-t.x/this._radius;return _.Matrix.RotationYawPitchRollToRef(o,i,0,_.TmpVectors.Matrix[0]),_.Vector3.TransformNormal(e,_.TmpVectors.Matrix[0])},e}(bt),qt=function(t){function e(e){void 0===e&&(e=!1);var i=t.call(this)||this;return i._isVertical=!1,i.margin=.1,i._isVertical=e,i}return r(e,t),Object.defineProperty(e.prototype,"isVertical",{get:function(){return this._isVertical},set:function(t){var e=this;this._isVertical!==t&&(this._isVertical=t,_.Tools.SetImmediate((function(){e._arrangeChildren()})))},enumerable:!1,configurable:!0}),e.prototype._arrangeChildren=function(){for(var t,e=0,i=0,o=0,n=[],r=_.Matrix.Invert(this.node.computeWorldMatrix(!0)),a=0,s=this._children;a<s.length;a++)if((f=s[a]).mesh){o++,f.mesh.computeWorldMatrix(!0),f.mesh.getWorldMatrix().multiplyToRef(r,_.TmpVectors.Matrix[0]);var l=f.mesh.getBoundingInfo().boundingBox,h=_.Vector3.TransformNormal(l.extendSize,_.TmpVectors.Matrix[0]);n.push(h),this._isVertical?i+=h.y:e+=h.x}this._isVertical?i+=(o-1)*this.margin/2:e+=(o-1)*this.margin/2,t=this._isVertical?-i:-e;for(var c=0,u=0,d=this._children;u<d.length;u++){var f;(f=d[u]).mesh&&(o--,h=n[c++],this._isVertical?(f.position.y=t+h.y,f.position.x=0,t+=2*h.y):(f.position.x=t+h.x,f.position.y=0,t+=2*h.x),t+=o>0?this.margin:0)}},e}(gt),Jt=function(t){function e(e,i){var o=t.call(this,i,e)||this;return o._currentMesh=e,o.pointerEnterAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(1.1)},o.pointerOutAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(1/1.1)},o.pointerDownAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(.95)},o.pointerUpAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(1/.95)},o}return r(e,t),e.prototype._getTypeName=function(){return"TouchMeshButton3D"},e.prototype._createNode=function(){var t=this;return this._currentMesh.getChildMeshes().forEach((function(e){t._injectGUI3DReservedDataStore(e).control=t})),this._currentMesh},e.prototype._affectMaterial=function(t){},e}(Rt);_.ShaderStore.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}";_.ShaderStore.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}";var $t=function(t){function e(){var e=t.call(this)||this;return e._needNormals=!0,e._needUVs=!0,e.rebuild(),e}return r(e,t),e}(_.MaterialDefines),te=function(t){function e(e,i){var o=t.call(this,e,i)||this;return o.bevelRadius=.16,o.lineWidth=.16,o.absoluteSizes=!1,o.tuningMotion=0,o.motion=1,o.maxIntensity=.7,o.intensityFadeInExponent=2,o.outerFuzzStart=.04,o.outerFuzzEnd=.04,o.color=new _.Color4(.682353,.698039,1,1),o.innerColor=new _.Color4(.356863,.392157,.796078,1),o.blendExponent=1.5,o.falloff=2,o.bias=.5,o.alphaMode=_.Constants.ALPHA_ADD,o.disableDepthWrite=!0,o.backFaceCulling=!1,o}return r(e,t),e.prototype.needAlphaBlending=function(){return!0},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){if(this.isFrozen&&e.effect&&e.effect._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new $t);var i=e.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(e))return!0;var n=o.getEngine();if(_.MaterialHelper.PrepareDefinesForAttributes(t,i,!1,!1),i.isDirty){i.markAsProcessed(),o.resetCachedMaterial();var r=new _.EffectFallbacks;i.FOG&&r.addFallback(1,"FOG"),_.MaterialHelper.HandleFallbacksForShadows(i,r),i.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;var a=[_.VertexBuffer.PositionKind];i.NORMAL&&a.push(_.VertexBuffer.NormalKind),i.UV1&&a.push(_.VertexBuffer.UVKind),i.UV2&&a.push(_.VertexBuffer.UV2Kind),i.VERTEXCOLOR&&a.push(_.VertexBuffer.ColorKind),i.TANGENT&&a.push(_.VertexBuffer.TangentKind),_.MaterialHelper.PrepareAttributesForInstances(a,i);var s=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_"],h=[],c=new Array;_.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:l,uniformBuffersNames:c,samplers:h,defines:i,maxSimultaneousLights:4}),e.setEffect(o.getEngine().createEffect("mrdlBackglow",{attributes:a,uniformsNames:l,uniformBuffersNames:c,samplers:h,defines:s,fallbacks:r,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),i)}return!(!e.effect||!e.effect.isReady()||(i._renderId=o.getRenderId(),e.effect._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){var o=this.getScene();if(i.materialDefines){var n=i.effect;n&&(this._activeEffect=n,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",o.getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",o.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(e,this._activeEffect))}},e.prototype.getAnimatables=function(){return[]},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e)},e.prototype.clone=function(t){var i=this;return _.SerializationHelper.Clone((function(){return new e(t,i.getScene())}),this)},e.prototype.serialize=function(){var t=_.SerializationHelper.Serialize(this);return t.customType="BABYLON.MRDLBackglowMaterial",t},e.prototype.getClassName=function(){return"MRDLBackglowMaterial"},e.Parse=function(t,i,o){return _.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},a([(0,_.serialize)()],e.prototype,"bevelRadius",void 0),a([(0,_.serialize)()],e.prototype,"lineWidth",void 0),a([(0,_.serialize)()],e.prototype,"absoluteSizes",void 0),a([(0,_.serialize)()],e.prototype,"tuningMotion",void 0),a([(0,_.serialize)()],e.prototype,"motion",void 0),a([(0,_.serialize)()],e.prototype,"maxIntensity",void 0),a([(0,_.serialize)()],e.prototype,"intensityFadeInExponent",void 0),a([(0,_.serialize)()],e.prototype,"outerFuzzStart",void 0),a([(0,_.serialize)()],e.prototype,"outerFuzzEnd",void 0),a([(0,_.serialize)()],e.prototype,"color",void 0),a([(0,_.serialize)()],e.prototype,"innerColor",void 0),a([(0,_.serialize)()],e.prototype,"blendExponent",void 0),a([(0,_.serialize)()],e.prototype,"falloff",void 0),a([(0,_.serialize)()],e.prototype,"bias",void 0),e}(_.PushMaterial);(0,_.RegisterClass)("BABYLON.GUI.MRDLBackglowMaterial",te);_.ShaderStore.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}";_.ShaderStore.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}";var ee=function(t){function e(){var e=t.call(this)||this;return e.SMOOTH_EDGES=!0,e._needNormals=!0,e._needUVs=!0,e.rebuild(),e}return r(e,t),e}(_.MaterialDefines),ie=function(t){function e(i,o){var n=t.call(this,i,o)||this;return n.radius=.12,n.lineWidth=.01,n.relativeToHeight=!1,n._filterWidth=1,n.edgeColor=new _.Color4(.53,.53,.53,1),n.blobEnable=!0,n.blobPosition=new _.Vector3(100,100,100),n.blobIntensity=.5,n.blobNearSize=.032,n.blobFarSize=.048,n.blobNearDistance=.008,n.blobFarDistance=.064,n.blobFadeLength=.04,n.blobInnerFade=.01,n.blobPulse=0,n.blobFade=1,n.blobPulseMaxSize=.05,n.blobEnable2=!0,n.blobPosition2=new _.Vector3(10,10.1,-.6),n.blobNearSize2=.008,n.blobInnerFade2=.1,n.blobPulse2=0,n.blobFade2=1,n.gazeIntensity=.8,n.gazeFocus=0,n.selectionFuzz=.5,n.selected=1,n.selectionFade=.2,n.selectionFadeSize=0,n.selectedDistance=.08,n.selectedFadeLength=.08,n.proximityMaxIntensity=.45,n.proximityFarDistance=.16,n.proximityNearRadius=.016,n.proximityAnisotropy=1,n.useGlobalLeftIndex=!0,n.useGlobalRightIndex=!0,n.fadeOut=1,n.alphaMode=_.Constants.ALPHA_ADD,n.disableDepthWrite=!0,n.backFaceCulling=!1,n._blobTexture=new _.Texture(e.BLOB_TEXTURE_URL,o,!0,!1,_.Texture.NEAREST_SAMPLINGMODE),n}return r(e,t),e.prototype.needAlphaBlending=function(){return!0},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){if(this.isFrozen&&e.effect&&e.effect._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new ee);var i=e.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(e))return!0;var n=o.getEngine();if(_.MaterialHelper.PrepareDefinesForAttributes(t,i,!1,!1),i.isDirty){i.markAsProcessed(),o.resetCachedMaterial();var r=new _.EffectFallbacks;i.FOG&&r.addFallback(1,"FOG"),_.MaterialHelper.HandleFallbacksForShadows(i,r),i.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;var a=[_.VertexBuffer.PositionKind];i.NORMAL&&a.push(_.VertexBuffer.NormalKind),i.UV1&&a.push(_.VertexBuffer.UVKind),i.UV2&&a.push(_.VertexBuffer.UV2Kind),i.VERTEXCOLOR&&a.push(_.VertexBuffer.ColorKind),i.TANGENT&&a.push(_.VertexBuffer.TangentKind),_.MaterialHelper.PrepareAttributesForInstances(a,i);var s=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_"],h=[],c=new Array;_.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:l,uniformBuffersNames:c,samplers:h,defines:i,maxSimultaneousLights:4}),e.setEffect(o.getEngine().createEffect("mrdlFrontplate",{attributes:a,uniformsNames:l,uniformBuffersNames:c,samplers:h,defines:s,fallbacks:r,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),i)}return!(!e.effect||!e.effect.isReady()||(i._renderId=o.getRenderId(),e.effect._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){var o=this.getScene();if(i.materialDefines){var n=i.effect;n&&(this._activeEffect=n,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",o.getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",o.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(e,this._activeEffect))}},e.prototype.getAnimatables=function(){return[]},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e)},e.prototype.clone=function(t){var i=this;return _.SerializationHelper.Clone((function(){return new e(t,i.getScene())}),this)},e.prototype.serialize=function(){var t=_.SerializationHelper.Serialize(this);return t.customType="BABYLON.MRDLFrontplateMaterial",t},e.prototype.getClassName=function(){return"MRDLFrontplateMaterial"},e.Parse=function(t,i,o){return _.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},e.BLOB_TEXTURE_URL="",a([(0,_.serialize)()],e.prototype,"radius",void 0),a([(0,_.serialize)()],e.prototype,"lineWidth",void 0),a([(0,_.serialize)()],e.prototype,"relativeToHeight",void 0),a([(0,_.serialize)()],e.prototype,"edgeColor",void 0),a([(0,_.serialize)()],e.prototype,"blobEnable",void 0),a([(0,_.serialize)()],e.prototype,"blobPosition",void 0),a([(0,_.serialize)()],e.prototype,"blobIntensity",void 0),a([(0,_.serialize)()],e.prototype,"blobNearSize",void 0),a([(0,_.serialize)()],e.prototype,"blobFarSize",void 0),a([(0,_.serialize)()],e.prototype,"blobNearDistance",void 0),a([(0,_.serialize)()],e.prototype,"blobFarDistance",void 0),a([(0,_.serialize)()],e.prototype,"blobFadeLength",void 0),a([(0,_.serialize)()],e.prototype,"blobInnerFade",void 0),a([(0,_.serialize)()],e.prototype,"blobPulse",void 0),a([(0,_.serialize)()],e.prototype,"blobFade",void 0),a([(0,_.serialize)()],e.prototype,"blobPulseMaxSize",void 0),a([(0,_.serialize)()],e.prototype,"blobEnable2",void 0),a([(0,_.serialize)()],e.prototype,"blobPosition2",void 0),a([(0,_.serialize)()],e.prototype,"blobNearSize2",void 0),a([(0,_.serialize)()],e.prototype,"blobInnerFade2",void 0),a([(0,_.serialize)()],e.prototype,"blobPulse2",void 0),a([(0,_.serialize)()],e.prototype,"blobFade2",void 0),a([(0,_.serialize)()],e.prototype,"gazeIntensity",void 0),a([(0,_.serialize)()],e.prototype,"gazeFocus",void 0),a([(0,_.serialize)()],e.prototype,"selectionFuzz",void 0),a([(0,_.serialize)()],e.prototype,"selected",void 0),a([(0,_.serialize)()],e.prototype,"selectionFade",void 0),a([(0,_.serialize)()],e.prototype,"selectionFadeSize",void 0),a([(0,_.serialize)()],e.prototype,"selectedDistance",void 0),a([(0,_.serialize)()],e.prototype,"selectedFadeLength",void 0),a([(0,_.serialize)()],e.prototype,"proximityMaxIntensity",void 0),a([(0,_.serialize)()],e.prototype,"proximityFarDistance",void 0),a([(0,_.serialize)()],e.prototype,"proximityNearRadius",void 0),a([(0,_.serialize)()],e.prototype,"proximityAnisotropy",void 0),a([(0,_.serialize)()],e.prototype,"useGlobalLeftIndex",void 0),a([(0,_.serialize)()],e.prototype,"useGlobalRightIndex",void 0),e}(_.PushMaterial);(0,_.RegisterClass)("BABYLON.GUI.MRDLFrontplateMaterial",ie);_.ShaderStore.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";_.ShaderStore.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";var oe=function(t){function e(){var e=t.call(this)||this;return e._needNormals=!0,e._needUVs=!0,e.rebuild(),e}return r(e,t),e}(_.MaterialDefines),ne=function(t){function e(e,i){var o=t.call(this,e,i)||this;return o.color=new _.Color4(1,1,1,.05),o.radius=.12,o.fixedRadius=!0,o._filterWidth=1,o.glowFraction=0,o.glowMax=.5,o.glowFalloff=2,o.alphaMode=_.Constants.ALPHA_COMBINE,o.backFaceCulling=!1,o}return r(e,t),e.prototype.needAlphaBlending=function(){return!0},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){if(this.isFrozen&&e.effect&&e.effect._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new oe);var i=e.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(e))return!0;var n=o.getEngine();if(_.MaterialHelper.PrepareDefinesForAttributes(t,i,!0,!1),i.isDirty){i.markAsProcessed(),o.resetCachedMaterial();var r=new _.EffectFallbacks;i.FOG&&r.addFallback(1,"FOG"),_.MaterialHelper.HandleFallbacksForShadows(i,r),i.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;var a=[_.VertexBuffer.PositionKind];i.NORMAL&&a.push(_.VertexBuffer.NormalKind),i.UV1&&a.push(_.VertexBuffer.UVKind),i.UV2&&a.push(_.VertexBuffer.UV2Kind),i.VERTEXCOLOR&&a.push(_.VertexBuffer.ColorKind),i.TANGENT&&a.push(_.VertexBuffer.TangentKind),_.MaterialHelper.PrepareAttributesForInstances(a,i);var s=i.toString(),l=["world","worldView","worldViewProjection","view","projection","viewProjection","cameraPosition","_Color_","_Radius_","_Fixed_Radius_","_Filter_Width_","_Glow_Fraction_","_Glow_Max_","_Glow_Falloff_"],h=[],c=new Array;_.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:l,uniformBuffersNames:c,samplers:h,defines:i,maxSimultaneousLights:4}),e.setEffect(o.getEngine().createEffect("mrdlInnerquad",{attributes:a,uniformsNames:l,uniformBuffersNames:c,samplers:h,defines:s,fallbacks:r,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),i)}return!(!e.effect||!e.effect.isReady()||(i._renderId=o.getRenderId(),e.effect._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){var o=this.getScene();if(i.materialDefines){var n=i.effect;n&&(this._activeEffect=n,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",o.getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",o.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(e,this._activeEffect))}},e.prototype.getAnimatables=function(){return[]},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e)},e.prototype.clone=function(t){var i=this;return _.SerializationHelper.Clone((function(){return new e(t,i.getScene())}),this)},e.prototype.serialize=function(){var t=_.SerializationHelper.Serialize(this);return t.customType="BABYLON.MRDLInnerquadMaterial",t},e.prototype.getClassName=function(){return"MRDLInnerquadMaterial"},e.Parse=function(t,i,o){return _.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},a([(0,_.serialize)()],e.prototype,"color",void 0),a([(0,_.serialize)()],e.prototype,"radius",void 0),a([(0,_.serialize)()],e.prototype,"fixedRadius",void 0),a([(0,_.serialize)()],e.prototype,"glowFraction",void 0),a([(0,_.serialize)()],e.prototype,"glowMax",void 0),a([(0,_.serialize)()],e.prototype,"glowFalloff",void 0),e}(_.PushMaterial);(0,_.RegisterClass)("BABYLON.GUI.MRDLInnerquadMaterial",ne);var re=function(t){function e(e,i){void 0===i&&(i=!0);var o=t.call(this,e)||this;return o.width=1,o.height=1,o.radius=.14,o.textSizeInPixels=18,o.imageSizeInPixels=40,o.plateMaterialColor=new _.Color3(.4,.4,.4),o.frontPlateDepth=.2,o.backPlateDepth=.04,o.backGlowOffset=.1,o.flatPlaneDepth=.001,o.innerQuadRadius=o.radius-.04,o.innerQuadColor=new _.Color4(0,0,0,0),o.innerQuadToggledColor=new _.Color4(.5197843,.6485234,.9607843,.6),o.innerQuadHoverColor=new _.Color4(1,1,1,.05),o.innerQuadToggledHoverColor=new _.Color4(.5197843,.6485234,.9607843,1),o._isBackplateVisible=!0,o._shareMaterials=!0,o._shareMaterials=i,o.pointerEnterAnimation=function(){o._frontPlate&&o._textPlate&&!o.isToggleButton&&o._performEnterExitAnimation(1),o.isToggleButton&&o._innerQuadMaterial&&(o.isToggled?o._innerQuadMaterial.color=o.innerQuadToggledHoverColor:o._innerQuadMaterial.color=o.innerQuadHoverColor)},o.pointerOutAnimation=function(){o._frontPlate&&o._textPlate&&!o.isToggleButton&&o._performEnterExitAnimation(-.8),o.isToggleButton&&o._innerQuadMaterial&&o._onToggle(o.isToggled)},o.pointerDownAnimation=function(){},o.pointerUpAnimation=function(){},o._pointerClickObserver=o.onPointerClickObservable.add((function(){o._frontPlate&&o._backGlow&&!o.isActiveNearInteraction&&o._performClickAnimation(),o.isToggleButton&&o._innerQuadMaterial&&o._onToggle(o.isToggled)})),o._pointerEnterObserver=o.onPointerEnterObservable.add((function(){o.pointerEnterAnimation()})),o._pointerOutObserver=o.onPointerOutObservable.add((function(){o.pointerOutAnimation()})),o._toggleObserver=o.onToggleObservable.add((function(t){o._innerQuadMaterial.color=t?o.innerQuadToggledColor:o.innerQuadColor})),o}return r(e,t),e.prototype._disposeTooltip=function(){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)},Object.defineProperty(e.prototype,"renderingGroupId",{get:function(){return this._backPlate.renderingGroupId},set:function(t){this._backPlate.renderingGroupId=t,this._textPlate.renderingGroupId=t,this._frontPlate.renderingGroupId=t,this._backGlow.renderingGroupId=t,this._innerQuad.renderingGroupId=t,this._tooltipMesh&&(this._tooltipMesh.renderingGroupId=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mesh",{get:function(){return this._backPlate},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tooltipText",{get:function(){var t;return(null===(t=this._tooltipTextBlock)||void 0===t?void 0:t.text)||null},set:function(t){var e=this;if(t){if(!this._tooltipFade){var i=this._backPlate._scene.useRightHandedSystem;this._tooltipMesh=(0,_.CreatePlane)("",{size:1},this._backPlate._scene),this._tooltipMesh.position=_.Vector3.Down().scale(.7).add(_.Vector3.Forward(i).scale(-.15)),this._tooltipMesh.isPickable=!1,this._tooltipMesh.parent=this._frontPlateCollisionMesh,this._tooltipTexture=st.CreateForMesh(this._tooltipMesh);var o=new P;o.height=.25,o.width=.8,o.cornerRadius=25,o.color="#ffffff",o.thickness=20,o.background="#060668",this._tooltipTexture.addControl(o),this._tooltipTextBlock=new I,this._tooltipTextBlock.color="white",this._tooltipTextBlock.fontSize=100,this._tooltipTexture.addControl(this._tooltipTextBlock),this._tooltipFade=new _.FadeInOutBehavior,this._tooltipFade.delay=500,this._tooltipMesh.addBehavior(this._tooltipFade),this._tooltipHoverObserver=this.onPointerEnterObservable.add((function(){e._tooltipFade&&e._tooltipFade.fadeIn(!0)})),this._tooltipOutObserver=this.onPointerOutObservable.add((function(){e._tooltipFade&&e._tooltipFade.fadeIn(!1)}))}this._tooltipTextBlock&&(this._tooltipTextBlock.text=t)}else this._disposeTooltip()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){this._text!==t&&(this._text=t,this._rebuildContent())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subtext",{get:function(){return this._subtext},set:function(t){this._subtext!==t&&(this._subtext=t,this._rebuildContent())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"imageUrl",{get:function(){return this._imageUrl},set:function(t){this._imageUrl!==t&&(this._imageUrl=t,this._rebuildContent())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backMaterial",{get:function(){return this._backMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"frontMaterial",{get:function(){return this._frontMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backGlowMaterial",{get:function(){return this._backGlowMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"innerQuadMaterial",{get:function(){return this._innerQuadMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"plateMaterial",{get:function(){return this._plateMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shareMaterials",{get:function(){return this._shareMaterials},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isBackplateVisible",{set:function(t){this.mesh&&this._backMaterial&&(t&&!this._isBackplateVisible?this._backPlate.visibility=1:!t&&this._isBackplateVisible&&(this._backPlate.visibility=0)),this._isBackplateVisible=t},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"TouchHolographicButton"},e.prototype._rebuildContent=function(){var t;t=this._getAspectRatio()<=1?this._alignContentVertically():this._alignContentHorizontally(),this.content=t},e.prototype._getAspectRatio=function(){return this.width/this.height},e.prototype._alignContentVertically=function(){var t=new T;if(t.isVertical=!0,_.DomManagement.IsDocumentAvailable()&&document.createElement&&this._imageUrl){var e=new B;e.source=this._imageUrl,e.heightInPixels=180,e.widthInPixels=100,e.paddingTopInPixels=40,e.paddingBottomInPixels=40,t.addControl(e)}if(this._text){var i=new I;i.text=this._text,i.color="white",i.heightInPixels=30,i.fontSize=24,t.addControl(i)}return t},e.prototype._alignContentHorizontally=function(){var t=240,e=15,i=new P;i.widthInPixels=t,i.heightInPixels=t,i.color="transparent",i.setPaddingInPixels(e,e,e,e),t-=30;var o=new T;if(o.isVertical=!1,o.scaleY=this._getAspectRatio(),_.DomManagement.IsDocumentAvailable()&&document.createElement&&this._imageUrl){var n=new P("".concat(this.name,"_image"));n.widthInPixels=this.imageSizeInPixels,n.heightInPixels=this.imageSizeInPixels,n.color="transparent",t-=this.imageSizeInPixels;var r=new B;r.source=this._imageUrl,n.addControl(r),o.addControl(n)}if(this._text){var a=new I("".concat(this.name,"_text"));if(a.text=this._text,a.color="white",a.fontSize=this.textSizeInPixels,a.widthInPixels=t,this._imageUrl&&(a.textHorizontalAlignment=v.HORIZONTAL_ALIGNMENT_LEFT,a.paddingLeftInPixels=e),this._subtext){var s=new w;s.addColumnDefinition(1),s.addRowDefinition(.5),s.addRowDefinition(.5),s.widthInPixels=t,s.heightInPixels=45;var l=new I("".concat(this.name,"_subtext"));l.text=this._subtext,l.color="#EEEEEEAB",l.fontSize=.75*this.textSizeInPixels,l.fontWeight="600",this._imageUrl&&(l.textHorizontalAlignment=v.HORIZONTAL_ALIGNMENT_LEFT,l.paddingLeftInPixels=e),s.addControl(a,0),s.addControl(l,1),o.addControl(s)}else o.addControl(a)}return i.addControl(o),i},e.prototype._createNode=function(e){var i;this.name=null!==(i=this.name)&&void 0!==i?i:"TouchHolographicButton";var o=this._createBackPlate(e),n=this._createFrontPlate(e),r=this._createInnerQuad(e),a=this._createBackGlow(e);this._frontPlateCollisionMesh=n,this._textPlate=t.prototype._createNode.call(this,e),this._textPlate.name="".concat(this.name,"_textPlate"),this._textPlate.isPickable=!1,this._textPlate.scaling.x=this.width,this._textPlate.parent=n,this._backPlate=o,this._backPlate.position=_.Vector3.Forward(e.useRightHandedSystem).scale(this.backPlateDepth/2),this._backPlate.isPickable=!1,this._backPlate.addChild(n),this._backPlate.addChild(r),a&&this._backPlate.addChild(a);var s=new _.TransformNode("".concat(this.name,"_root"),e);return this._backPlate.setParent(s),this.collisionMesh=n,this.collidableFrontDirection=this._backPlate.forward.negate(),s},e.prototype._createBackPlate=function(t){var i=this,o=(0,_.CreateBox)("".concat(this.name,"_backPlate"),{},t);return o.isPickable=!1,o.visibility=0,o.scaling.z=.2,_.SceneLoader.ImportMeshAsync(void 0,e.MRTK_ASSET_BASE_URL,e.BACKPLATE_MODEL_FILENAME,t).then((function(t){var e=t.meshes[1];e.visibility=0,i._isBackplateVisible&&(e.visibility=1,e.name="".concat(i.name,"_backPlate"),e.isPickable=!1,e.scaling.x=i.width,e.scaling.y=i.height,e.parent=o),i._backMaterial&&(e.material=i._backMaterial),i._backPlate=e})),o},e.prototype._createFrontPlate=function(t){var i=this,o=(0,_.CreateBox)("".concat(this.name,"_frontPlate"),{width:this.width,height:this.height,depth:this.frontPlateDepth},t);return o.isPickable=!0,o.isNearPickable=!0,o.visibility=0,o.position=_.Vector3.Forward(t.useRightHandedSystem).scale((this.backPlateDepth-this.frontPlateDepth)/2),_.SceneLoader.ImportMeshAsync(void 0,e.MRTK_ASSET_BASE_URL,e.FRONTPLATE_MODEL_FILENAME,t).then((function(e){var n=(0,_.CreateBox)("".concat(i.name,"_collisionPlate"),{width:i.width,height:i.height},t);n.isPickable=!1,n.scaling.z=i.frontPlateDepth,n.visibility=0,n.parent=o,i._collisionPlate=n;var r=e.meshes[1];r.name="".concat(i.name,"_frontPlate"),r.isPickable=!1,r.scaling.x=i.width-i.backGlowOffset,r.scaling.y=i.height-i.backGlowOffset,r.position=_.Vector3.Forward(t.useRightHandedSystem).scale(-.5),r.parent=n,i.isToggleButton&&(r.visibility=0),i._frontMaterial&&(r.material=i._frontMaterial),i._textPlate.scaling.x=1,i._textPlate.parent=r,i._frontPlate=r})),o},e.prototype._createInnerQuad=function(t){var i=this,o=(0,_.CreateBox)("".concat(this.name,"_innerQuad"),{},t);return o.isPickable=!1,o.visibility=0,o.scaling.z=this.flatPlaneDepth,o.position.z+=this.backPlateDepth/2-this.flatPlaneDepth,_.SceneLoader.ImportMeshAsync(void 0,e.MRTK_ASSET_BASE_URL,e.INNERQUAD_MODEL_FILENAME,t).then((function(t){var e=t.meshes[1];e.name="".concat(i.name,"_innerQuad"),e.isPickable=!1,e.scaling.x=i.width-i.backGlowOffset,e.scaling.y=i.height-i.backGlowOffset,e.parent=o,i._innerQuadMaterial&&(e.material=i._innerQuadMaterial),i._innerQuad=e})),o},e.prototype._createBackGlow=function(t){var i=this;if(!this.isToggleButton){var o=(0,_.CreateBox)("".concat(this.name,"_backGlow"),{},t);return o.isPickable=!1,o.visibility=0,o.scaling.z=this.flatPlaneDepth,o.position.z+=this.backPlateDepth/2-2*this.flatPlaneDepth,_.SceneLoader.ImportMeshAsync(void 0,e.MRTK_ASSET_BASE_URL,e.BACKGLOW_MODEL_FILENAME,t).then((function(t){var e=t.meshes[1];e.name="".concat(i.name,"_backGlow"),e.isPickable=!1,e.scaling.x=i.width-i.backGlowOffset,e.scaling.y=i.height-i.backGlowOffset,e.parent=o,i._backGlowMaterial&&(e.material=i._backGlowMaterial),i._backGlow=e})),o}},e.prototype._applyFacade=function(t){this._plateMaterial.emissiveTexture=t,this._plateMaterial.opacityTexture=t,this._plateMaterial.diffuseColor=this.plateMaterialColor},e.prototype._performClickAnimation=function(){for(var t=new _.AnimationGroup("Click Animation Group"),e=0,i=[{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:[_.Vector3.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]}]}];e<i.length;e++){for(var o=i[e],n=new _.Animation(o.name,o.property,60,_.Animation.ANIMATIONTYPE_FLOAT,_.Animation.ANIMATIONLOOPMODE_CYCLE),r=[],a=0,s=o.keys;a<s.length;a++){var l=s[a];r.push({frame:l.frame,value:l.values[0],inTangent:l.values[1],outTangent:l.values[2],interpolation:l.values[3]})}n.setKeys(r),o.mesh&&t.addTargetedAnimation(n,o.mesh)}t.normalize(0,45),t.speedRatio=1,t.play()},e.prototype._performEnterExitAnimation=function(t){for(var e=new _.AnimationGroup("Enter Exit Animation Group"),i=0,o=[{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:[_.Vector3.Forward(this._textPlate._scene.useRightHandedSystem).scale(-.15).z,0,0]}]}];i<o.length;i++){for(var n=o[i],r=new _.Animation(n.name,n.property,60,_.Animation.ANIMATIONTYPE_FLOAT,_.Animation.ANIMATIONLOOPMODE_CYCLE),a=[],s=0,l=n.keys;s<l.length;s++){var h=l[s];a.push({frame:h.frame,value:h.values[0],inTangent:h.values[1],outTangent:h.values[2],interpolation:h.values[3]})}r.setKeys(a),n.mesh&&e.addTargetedAnimation(r,n.mesh)}e.normalize(0,45),e.speedRatio=t,e.play()},e.prototype._createBackMaterial=function(t){var e;this._backMaterial=null!==(e=this._backMaterial)&&void 0!==e?e:new Xt(this.name+"backPlateMaterial",t.getScene()),this._backMaterial.absoluteSizes=!0,this._backMaterial.radius=this.radius,this._backMaterial.lineWidth=.02},e.prototype._createFrontMaterial=function(t){var e;this._frontMaterial=null!==(e=this._frontMaterial)&&void 0!==e?e:new ie(this.name+"Front Material",t.getScene()),this.frontMaterial.radius=this.innerQuadRadius,this.frontMaterial.fadeOut=0},e.prototype._createBackGlowMaterial=function(t){var e,i=this.radius+.04;this._backGlowMaterial=null!==(e=this._backGlowMaterial)&&void 0!==e?e:new te(this.name+"Back Glow Material",t.getScene()),this._backGlowMaterial.bevelRadius=i,this._backGlowMaterial.lineWidth=i,this._backGlowMaterial.motion=0},e.prototype._createInnerQuadMaterial=function(t){var e;this._innerQuadMaterial=null!==(e=this._innerQuadMaterial)&&void 0!==e?e:new ne("inner_quad",t.getScene()),this._innerQuadMaterial.radius=this.innerQuadRadius,this.isToggleButton&&(this._innerQuadMaterial.color=this.innerQuadColor)},e.prototype._createPlateMaterial=function(t){var e;this._plateMaterial=null!==(e=this._plateMaterial)&&void 0!==e?e:new _.StandardMaterial(this.name+"Plate Material",t.getScene()),this._plateMaterial.specularColor=_.Color3.Black()},e.prototype._onToggle=function(e){t.prototype._onToggle.call(this,e)},e.prototype._affectMaterial=function(t){this._shareMaterials?(this._host._touchSharedMaterials.mrdlBackplateMaterial?this._backMaterial=this._host._touchSharedMaterials.mrdlBackplateMaterial:(this._createBackMaterial(t),this._host._touchSharedMaterials.mrdlBackplateMaterial=this._backMaterial),this._host._touchSharedMaterials.mrdlFrontplateMaterial?this._frontMaterial=this._host._touchSharedMaterials.mrdlFrontplateMaterial:(this._createFrontMaterial(t),this._host._touchSharedMaterials.mrdlFrontplateMaterial=this._frontMaterial),this._host._touchSharedMaterials.mrdlBackglowMaterial?this._backGlowMaterial=this._host._touchSharedMaterials.mrdlBackglowMaterial:(this._createBackGlowMaterial(t),this._host._touchSharedMaterials.mrdlBackglowMaterial=this._backGlowMaterial),this._host._touchSharedMaterials.mrdlInnerQuadMaterial?this._innerQuadMaterial=this._host._touchSharedMaterials.mrdlInnerQuadMaterial:(this._createInnerQuadMaterial(t),this._host._touchSharedMaterials.mrdlInnerQuadMaterial=this._innerQuadMaterial)):(this._createBackMaterial(t),this._createFrontMaterial(t),this._createBackGlowMaterial(t),this._createInnerQuadMaterial(t)),this._createPlateMaterial(t),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()},e.prototype.dispose=function(){t.prototype.dispose.call(this),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))},e.MRTK_ASSET_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",e.FRONTPLATE_MODEL_FILENAME="mrtk-fluent-frontplate.glb",e.BACKPLATE_MODEL_FILENAME="mrtk-fluent-backplate.glb",e.BACKGLOW_MODEL_FILENAME="mrtk-fluent-button.glb",e.INNERQUAD_MODEL_FILENAME="SlateProximity.glb",e}(Rt),ae=function(){function t(t){var e=this;this._customControlScaling=1,this._lastControlOver={},this._lastControlDown={},this.onPickedPointChangedObservable=new _.Observable,this.onPickingObservable=new _.Observable,this._sharedMaterials={},this._touchSharedMaterials={},this._scene=t||_.EngineStore.LastCreatedScene,this._sceneDisposeObserver=this._scene.onDisposeObservable.add((function(){e._sceneDisposeObserver=null,e._utilityLayer=null,e.dispose()})),this._utilityLayer=_.UtilityLayerRenderer._CreateDefaultUtilityLayerFromScene(this._scene),this._utilityLayer.onlyCheckPointerDownEvents=!1,this._utilityLayer.pickUtilitySceneFirst=!1,this._utilityLayer.mainSceneTrackerPredicate=function(t){var e,i,o;return t&&(null===(o=null===(i=null===(e=t.reservedDataStore)||void 0===e?void 0:e.GUI3D)||void 0===i?void 0:i.control)||void 0===o?void 0:o._node)},this._rootContainer=new gt("RootContainer"),this._rootContainer._host=this;var i=this._utilityLayer.utilityLayerScene;this._pointerOutObserver=this._utilityLayer.onPointerOutObservable.add((function(t){e._handlePointerOut(t,!0)})),this._pointerObserver=i.onPointerObservable.add((function(t){e._doPicking(t)})),this._utilityLayer.utilityLayerScene.autoClear=!1,this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil=!1,new _.HemisphericLight("hemi",_.Vector3.Up(),this._utilityLayer.utilityLayerScene)}return Object.defineProperty(t.prototype,"scene",{get:function(){return this._scene},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"utilityLayer",{get:function(){return this._utilityLayer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"controlScaling",{get:function(){return this._customControlScaling},set:function(t){if(this._customControlScaling!==t&&t>0){var e=t/this._customControlScaling;this._customControlScaling=t,this._rootContainer.children.forEach((function(i){i.scaling.scaleInPlace(e),1!==t&&(i._isScaledByManager=!0)}))}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useRealisticScaling",{get:function(){return this.controlScaling===t.MRTK_REALISTIC_SCALING},set:function(e){this.controlScaling=e?t.MRTK_REALISTIC_SCALING:1},enumerable:!1,configurable:!0}),t.prototype._handlePointerOut=function(t,e){var i=this._lastControlOver[t];i&&(i._onPointerOut(i),delete this._lastControlOver[t]),e&&this._lastControlDown[t]&&(this._lastControlDown[t].forcePointerUp(),delete this._lastControlDown[t]),this.onPickedPointChangedObservable.notifyObservers(null)},t.prototype._doPicking=function(t){var e,i,o;if(!this._utilityLayer||!this._utilityLayer.shouldRender||!this._utilityLayer.utilityLayerScene.activeCamera)return!1;var n=t.event,r=n.pointerId||0,a=n.button,s=t.pickInfo;if(s&&this.onPickingObservable.notifyObservers(s.pickedMesh),!s||!s.hit)return this._handlePointerOut(r,t.type===_.PointerEventTypes.POINTERUP),!1;s.pickedPoint&&this.onPickedPointChangedObservable.notifyObservers(s.pickedPoint);var l=null===(i=null===(e=s.pickedMesh.reservedDataStore)||void 0===e?void 0:e.GUI3D)||void 0===i?void 0:i.control;return l&&!l._processObservables(t.type,s.pickedPoint,(null===(o=s.originMesh)||void 0===o?void 0:o.position)||null,r,a)&&t.type===_.PointerEventTypes.POINTERMOVE&&(this._lastControlOver[r]&&this._lastControlOver[r]._onPointerOut(this._lastControlOver[r]),delete this._lastControlOver[r]),t.type===_.PointerEventTypes.POINTERUP&&(this._lastControlDown[n.pointerId]&&(this._lastControlDown[n.pointerId].forcePointerUp(),delete this._lastControlDown[n.pointerId]),("touch"===n.pointerType||"xr"===n.pointerType&&this._scene.getEngine().hostInformation.isMobile)&&this._handlePointerOut(r,!1)),!0},Object.defineProperty(t.prototype,"rootContainer",{get:function(){return this._rootContainer},enumerable:!1,configurable:!0}),t.prototype.containsControl=function(t){return this._rootContainer.containsControl(t)},t.prototype.addControl=function(t){return this._rootContainer.addControl(t),1!==this._customControlScaling&&(t.scaling.scaleInPlace(this._customControlScaling),t._isScaledByManager=!0),this},t.prototype.removeControl=function(t){return this._rootContainer.removeControl(t),t._isScaledByManager&&(t.scaling.scaleInPlace(1/this._customControlScaling),t._isScaledByManager=!1),this},t.prototype.dispose=function(){for(var t in this._rootContainer.dispose(),this._sharedMaterials)Object.prototype.hasOwnProperty.call(this._sharedMaterials,t)&&this._sharedMaterials[t].dispose();for(var t in this._sharedMaterials={},this._touchSharedMaterials)Object.prototype.hasOwnProperty.call(this._touchSharedMaterials,t)&&this._touchSharedMaterials[t].dispose();this._touchSharedMaterials={},this._pointerOutObserver&&this._utilityLayer&&(this._utilityLayer.onPointerOutObservable.remove(this._pointerOutObserver),this._pointerOutObserver=null),this.onPickedPointChangedObservable.clear(),this.onPickingObservable.clear();var 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()},t.MRTK_REALISTIC_SCALING=.032,t}(),se=void 0!==o.g?o.g:"undefined"!=typeof window?window:void 0;void 0!==se&&(se.BABYLON=se.BABYLON||{},se.BABYLON.GUI||(se.BABYLON.GUI=t));const le=e})(),n.default})()));
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("babylonjs")):"function"==typeof define&&define.amd?define("babylonjs-gui",["babylonjs"],e):"object"==typeof exports?exports["babylonjs-gui"]=e(require("babylonjs")):(t.BABYLON=t.BABYLON||{},t.BABYLON.GUI=e(t.BABYLON))}("undefined"!=typeof self?self:"undefined"!=typeof global?global:this,(t=>(()=>{"use strict";var e={520:e=>{e.exports=t}},i={};function o(t){var n=i[t];if(void 0!==n)return n.exports;var r=i[t]={exports:{}};return e[t](r,r.exports,o),r.exports}o.d=(t,e)=>{for(var i in e)o.o(e,i)&&!o.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{o.d(n,{default:()=>_e});var t={};o.r(t),o.d(t,{AbstractButton3D:()=>pt,AdvancedDynamicTexture:()=>lt,AdvancedDynamicTextureInstrumentation:()=>_t,BaseGradient:()=>nt,BaseSlider:()=>V,Button:()=>T,Button3D:()=>gt,Checkbox:()=>O,CheckboxGroup:()=>G,ColorPicker:()=>E,Container:()=>x,Container3D:()=>bt,Control:()=>y,Control3D:()=>dt,CornerHandle:()=>Nt,CylinderPanel:()=>vt,DisplayGrid:()=>et,Ellipse:()=>F,FluentBackplateMaterial:()=>Ct,FluentButtonMaterial:()=>Rt,FluentMaterial:()=>xt,FluentMaterialDefines:()=>yt,FocusableButton:()=>D,GUI3DManager:()=>se,GizmoHandle:()=>Lt,Grid:()=>M,HandMenu:()=>It,HandleMaterial:()=>Dt,HandleState:()=>Ft,HolographicBackplate:()=>Tt,HolographicButton:()=>St,HolographicSlate:()=>zt,Image:()=>C,ImageBasedSlider:()=>it,ImageScrollBar:()=>Z,InputPassword:()=>k,InputText:()=>w,InputTextArea:()=>L,KeyPropertySet:()=>$,Line:()=>N,LinearGradient:()=>rt,MRDLBackplateMaterial:()=>Kt,MRDLSliderBarMaterial:()=>Ut,MRDLSliderThumbMaterial:()=>Yt,MathTools:()=>v,Matrix2D:()=>m,Measure:()=>g,MeshButton3D:()=>Qt,MultiLine:()=>z,MultiLinePoint:()=>A,NearMenu:()=>Vt,PlanePanel:()=>Wt,RadialGradient:()=>at,RadioButton:()=>Q,RadioGroup:()=>U,Rectangle:()=>I,ScatterPanel:()=>Ht,ScrollBar:()=>K,ScrollViewer:()=>q,SelectionPanel:()=>Y,SelectorGroup:()=>H,SideHandle:()=>kt,SlateGizmo:()=>At,Slider:()=>W,Slider3D:()=>Zt,SliderGroup:()=>j,SpherePanel:()=>qt,StackPanel:()=>S,StackPanel3D:()=>Jt,Style:()=>st,TextBlock:()=>B,TextWrapper:()=>R,TextWrapping:()=>P,ToggleButton:()=>J,TouchButton3D:()=>wt,TouchHolographicButton:()=>Mt,TouchHolographicButtonV3:()=>ae,TouchHolographicMenu:()=>Pt,TouchMeshButton3D:()=>$t,ValueAndUnit:()=>c,Vector2WithInfo:()=>b,Vector3WithInfo:()=>ut,VirtualKeyboard:()=>tt,VolumeBasedPanel:()=>mt,XmlLoader:()=>ct,name:()=>ot});var e={};o.r(e),o.d(e,{AbstractButton3D:()=>pt,AdvancedDynamicTexture:()=>lt,AdvancedDynamicTextureInstrumentation:()=>_t,BaseGradient:()=>nt,BaseSlider:()=>V,Button:()=>T,Button3D:()=>gt,Checkbox:()=>O,CheckboxGroup:()=>G,ColorPicker:()=>E,Container:()=>x,Container3D:()=>bt,Control:()=>y,Control3D:()=>dt,CornerHandle:()=>Nt,CylinderPanel:()=>vt,DisplayGrid:()=>et,Ellipse:()=>F,FluentBackplateMaterial:()=>Ct,FluentButtonMaterial:()=>Rt,FluentMaterial:()=>xt,FluentMaterialDefines:()=>yt,FocusableButton:()=>D,GUI3DManager:()=>se,GizmoHandle:()=>Lt,Grid:()=>M,HandMenu:()=>It,HandleMaterial:()=>Dt,HandleState:()=>Ft,HolographicBackplate:()=>Tt,HolographicButton:()=>St,HolographicSlate:()=>zt,Image:()=>C,ImageBasedSlider:()=>it,ImageScrollBar:()=>Z,InputPassword:()=>k,InputText:()=>w,InputTextArea:()=>L,KeyPropertySet:()=>$,Line:()=>N,LinearGradient:()=>rt,MRDLBackplateMaterial:()=>Kt,MRDLSliderBarMaterial:()=>Ut,MRDLSliderThumbMaterial:()=>Yt,MathTools:()=>v,Matrix2D:()=>m,Measure:()=>g,MeshButton3D:()=>Qt,MultiLine:()=>z,MultiLinePoint:()=>A,NearMenu:()=>Vt,PlanePanel:()=>Wt,RadialGradient:()=>at,RadioButton:()=>Q,RadioGroup:()=>U,Rectangle:()=>I,ScatterPanel:()=>Ht,ScrollBar:()=>K,ScrollViewer:()=>q,SelectionPanel:()=>Y,SelectorGroup:()=>H,SideHandle:()=>kt,SlateGizmo:()=>At,Slider:()=>W,Slider3D:()=>Zt,SliderGroup:()=>j,SpherePanel:()=>qt,StackPanel:()=>S,StackPanel3D:()=>Jt,Style:()=>st,TextBlock:()=>B,TextWrapper:()=>R,TextWrapping:()=>P,ToggleButton:()=>J,TouchButton3D:()=>wt,TouchHolographicButton:()=>Mt,TouchHolographicButtonV3:()=>ae,TouchHolographicMenu:()=>Pt,TouchMeshButton3D:()=>$t,ValueAndUnit:()=>c,Vector2WithInfo:()=>b,Vector3WithInfo:()=>ut,VirtualKeyboard:()=>tt,VolumeBasedPanel:()=>mt,XmlLoader:()=>ct,name:()=>ot});var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},i(t,e)};function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function o(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}var a=function(){return a=Object.assign||function(t){for(var e,i=1,o=arguments.length;i<o;i++)for(var n in e=arguments[i])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},a.apply(this,arguments)};function s(t,e,i,o){var n,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,o);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a}function l(t,e,i,o){return new(i||(i=Promise))((function(n,r){function a(t){try{l(o.next(t))}catch(t){r(t)}}function s(t){try{l(o.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,s)}l((o=o.apply(t,e||[])).next())}))}function _(t,e){var i,o,n,r,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;r&&(r=0,s[0]&&(a=0)),a;)try{if(i=1,o&&(n=2&s[0]?o.return:s[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,s[1])).done)return n;switch(o=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((n=(n=a.trys).length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],o=0}finally{i=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}Object.create,Object.create;var h=o(520),c=function(){function t(e,i,o){void 0===i&&(i=t.UNITMODE_PIXEL),void 0===o&&(o=!0),this.negativeValueAllowed=o,this._value=1,this._unit=t.UNITMODE_PIXEL,this.ignoreAdaptiveScaling=!1,this.onChangedObservable=new h.Observable,this._value=e,this._unit=i,this._originalUnit=i}return Object.defineProperty(t.prototype,"isPercentage",{get:function(){return this._unit===t.UNITMODE_PERCENTAGE},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isPixel",{get:function(){return this._unit===t.UNITMODE_PIXEL},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"internalValue",{get:function(){return this._value},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this._value},set:function(t){t!==this._value&&(this._value=t,this.onChangedObservable.notifyObservers())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"unit",{get:function(){return this._unit},set:function(t){t!==this._unit&&(this._unit=t,this.onChangedObservable.notifyObservers())},enumerable:!1,configurable:!0}),t.prototype.getValueInPixel=function(t,e){return this.isPixel?this.getValue(t):this.getValue(t)*e},t.prototype.updateInPlace=function(e,i){return void 0===i&&(i=t.UNITMODE_PIXEL),this.value===e&&this.unit===i||(this._value=e,this._unit=i,this.onChangedObservable.notifyObservers()),this},t.prototype.getValue=function(e){if(e&&!this.ignoreAdaptiveScaling&&this.unit!==t.UNITMODE_PERCENTAGE){var i=0,o=0;if(e.idealWidth&&(i=this._value*e.getSize().width/e.idealWidth),e.idealHeight&&(o=this._value*e.getSize().height/e.idealHeight),e.useSmallestIdeal&&e.idealWidth&&e.idealHeight)return window.innerWidth<window.innerHeight?i:o;if(e.idealWidth)return i;if(e.idealHeight)return o}return this._value},t.prototype.toString=function(e,i){switch(this._unit){case t.UNITMODE_PERCENTAGE:var o=100*this.getValue(e);return(i?o.toFixed(i):o)+"%";case t.UNITMODE_PIXEL:var n=this.getValue(e);return(i?n.toFixed(i):n)+"px"}return this._unit.toString()},t.prototype.fromString=function(e){var i=t._Regex.exec(e.toString());if(!i||0===i.length)return!1;var o=parseFloat(i[1]),n=this._originalUnit;if(this.negativeValueAllowed||o<0&&(o=0),4===i.length)switch(i[3]){case"px":n=t.UNITMODE_PIXEL;break;case"%":n=t.UNITMODE_PERCENTAGE,o/=100}return(o!==this._value||n!==this._unit)&&(this._value=o,this._unit=n,this.onChangedObservable.notifyObservers(),!0)},Object.defineProperty(t,"UNITMODE_PERCENTAGE",{get:function(){return t._UNITMODE_PERCENTAGE},enumerable:!1,configurable:!0}),Object.defineProperty(t,"UNITMODE_PIXEL",{get:function(){return t._UNITMODE_PIXEL},enumerable:!1,configurable:!0}),t._Regex=/(^-?\d*(\.\d+)?)(%|px)?/,t._UNITMODE_PERCENTAGE=0,t._UNITMODE_PIXEL=1,t}(),u=[new h.Vector2(0,0),new h.Vector2(0,0),new h.Vector2(0,0),new h.Vector2(0,0)],d=[new h.Vector2(0,0),new h.Vector2(0,0),new h.Vector2(0,0),new h.Vector2(0,0)],f=new h.Vector2(0,0),p=new h.Vector2(0,0),g=function(){function t(t,e,i,o){this.left=t,this.top=e,this.width=i,this.height=o}return t.prototype.copyFrom=function(t){this.left=t.left,this.top=t.top,this.width=t.width,this.height=t.height},t.prototype.copyFromFloats=function(t,e,i,o){this.left=t,this.top=e,this.width=i,this.height=o},t.CombineToRef=function(t,e,i){var o=Math.min(t.left,e.left),n=Math.min(t.top,e.top),r=Math.max(t.left+t.width,e.left+e.width),a=Math.max(t.top+t.height,e.top+e.height);i.left=o,i.top=n,i.width=r-o,i.height=a-n},t.prototype.addAndTransformToRef=function(t,e,i,o,n,r){var a=this.left+e,s=this.top+i,l=this.width+o,_=this.height+n;u[0].copyFromFloats(a,s),u[1].copyFromFloats(a+l,s),u[2].copyFromFloats(a+l,s+_),u[3].copyFromFloats(a,s+_),f.copyFromFloats(Number.MAX_VALUE,Number.MAX_VALUE),p.copyFromFloats(0,0);for(var h=0;h<4;h++)t.transformCoordinates(u[h].x,u[h].y,d[h]),f.x=Math.floor(Math.min(f.x,d[h].x)),f.y=Math.floor(Math.min(f.y,d[h].y)),p.x=Math.ceil(Math.max(p.x,d[h].x)),p.y=Math.ceil(Math.max(p.y,d[h].y));r.left=f.x,r.top=f.y,r.width=p.x-f.x,r.height=p.y-f.y},t.prototype.transformToRef=function(t,e){this.addAndTransformToRef(t,0,0,0,0,e)},t.prototype.isEqualsTo=function(t){return this.left===t.left&&this.top===t.top&&this.width===t.width&&this.height===t.height},t.Empty=function(){return new t(0,0,0,0)},t}(),b=function(t){function e(e,i){void 0===i&&(i=0);var o=t.call(this,e.x,e.y)||this;return o.buttonIndex=i,o}return r(e,t),e}(h.Vector2),m=function(){function t(t,e,i,o,n,r){this.m=new Float32Array(6),this.fromValues(t,e,i,o,n,r)}return t.prototype.fromValues=function(t,e,i,o,n,r){return this.m[0]=t,this.m[1]=e,this.m[2]=i,this.m[3]=o,this.m[4]=n,this.m[5]=r,this},t.prototype.determinant=function(){return this.m[0]*this.m[3]-this.m[1]*this.m[2]},t.prototype.invertToRef=function(t){var e=this.m[0],i=this.m[1],o=this.m[2],n=this.m[3],r=this.m[4],a=this.m[5],s=this.determinant();if(s<h.Epsilon*h.Epsilon)return t.m[0]=0,t.m[1]=0,t.m[2]=0,t.m[3]=0,t.m[4]=0,t.m[5]=0,this;var l=1/s,_=o*a-n*r,c=i*r-e*a;return t.m[0]=n*l,t.m[1]=-i*l,t.m[2]=-o*l,t.m[3]=e*l,t.m[4]=_*l,t.m[5]=c*l,this},t.prototype.multiplyToRef=function(t,e){var i=this.m[0],o=this.m[1],n=this.m[2],r=this.m[3],a=this.m[4],s=this.m[5],l=t.m[0],_=t.m[1],h=t.m[2],c=t.m[3],u=t.m[4],d=t.m[5];return e.m[0]=i*l+o*h,e.m[1]=i*_+o*c,e.m[2]=n*l+r*h,e.m[3]=n*_+r*c,e.m[4]=a*l+s*h+u,e.m[5]=a*_+s*c+d,this},t.prototype.transformCoordinates=function(t,e,i){return i.x=t*this.m[0]+e*this.m[2]+this.m[4],i.y=t*this.m[1]+e*this.m[3]+this.m[5],this},t.Identity=function(){return new t(1,0,0,1,0,0)},t.IdentityToRef=function(t){t.m[0]=1,t.m[1]=0,t.m[2]=0,t.m[3]=1,t.m[4]=0,t.m[5]=0},t.TranslationToRef=function(t,e,i){i.fromValues(1,0,0,1,t,e)},t.ScalingToRef=function(t,e,i){i.fromValues(t,0,0,e,0,0)},t.RotationToRef=function(t,e){var i=Math.sin(t),o=Math.cos(t);e.fromValues(o,i,-i,o,0,0)},t.ComposeToRef=function(e,i,o,n,r,a,s){t.TranslationToRef(e,i,t._TempPreTranslationMatrix),t.ScalingToRef(n,r,t._TempScalingMatrix),t.RotationToRef(o,t._TempRotationMatrix),t.TranslationToRef(-e,-i,t._TempPostTranslationMatrix),t._TempPreTranslationMatrix.multiplyToRef(t._TempScalingMatrix,t._TempCompose0),t._TempCompose0.multiplyToRef(t._TempRotationMatrix,t._TempCompose1),a?(t._TempCompose1.multiplyToRef(t._TempPostTranslationMatrix,t._TempCompose2),t._TempCompose2.multiplyToRef(a,s)):t._TempCompose1.multiplyToRef(t._TempPostTranslationMatrix,s)},t._TempPreTranslationMatrix=t.Identity(),t._TempPostTranslationMatrix=t.Identity(),t._TempRotationMatrix=t.Identity(),t._TempScalingMatrix=t.Identity(),t._TempCompose0=t.Identity(),t._TempCompose1=t.Identity(),t._TempCompose2=t.Identity(),t}(),v=function(){function t(){}return t.Round=function(e,i){return void 0===i&&(i=t.DefaultRoundingPrecision),Math.round(e*i)/i},t.DefaultRoundingPrecision=100,t}(),y=function(){function t(e){this.name=e,this._alpha=1,this._alphaSet=!1,this._zIndex=0,this._currentMeasure=g.Empty(),this._tempPaddingMeasure=g.Empty(),this._fontFamily="Arial",this._fontStyle="",this._fontWeight="",this._fontSize=new c(18,c.UNITMODE_PIXEL,!1),this._width=new c(1,c.UNITMODE_PERCENTAGE,!1),this._height=new c(1,c.UNITMODE_PERCENTAGE,!1),this._color="",this._style=null,this._horizontalAlignment=t.HORIZONTAL_ALIGNMENT_CENTER,this._verticalAlignment=t.VERTICAL_ALIGNMENT_CENTER,this._isDirty=!0,this._wasDirty=!1,this._tempParentMeasure=g.Empty(),this._prevCurrentMeasureTransformedIntoGlobalSpace=g.Empty(),this._cachedParentMeasure=g.Empty(),this._descendantsOnlyPadding=!1,this._paddingLeft=new c(0),this._paddingRight=new c(0),this._paddingTop=new c(0),this._paddingBottom=new c(0),this._left=new c(0),this._top=new c(0),this._scaleX=1,this._scaleY=1,this._rotation=0,this._transformCenterX=.5,this._transformCenterY=.5,this._transformMatrix=m.Identity(),this._invertTransformMatrix=m.Identity(),this._transformedPosition=h.Vector2.Zero(),this._isMatrixDirty=!0,this._isVisible=!0,this._isHighlighted=!1,this._highlightColor="#4affff",this._highlightLineWidth=2,this._fontSet=!1,this._dummyVector2=h.Vector2.Zero(),this._downCount=0,this._enterCount=-1,this._doNotRender=!1,this._downPointerIds={},this._evaluatedMeasure=new g(0,0,0,0),this._evaluatedParentMeasure=new g(0,0,0,0),this._isEnabled=!0,this._disabledColor="#9a9a9a",this._disabledColorItem="#6a6a6a",this._isReadOnly=!1,this._gradient=null,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(0),this._linkOffsetY=new c(0),this._accessibilityTag=null,this.onAccessibilityTagChangedObservable=new h.Observable,this.onWheelObservable=new h.Observable,this.onPointerMoveObservable=new h.Observable,this.onPointerOutObservable=new h.Observable,this.onPointerDownObservable=new h.Observable,this.onPointerUpObservable=new h.Observable,this.onPointerClickObservable=new h.Observable,this.onPointerEnterObservable=new h.Observable,this.onDirtyObservable=new h.Observable,this.onBeforeDrawObservable=new h.Observable,this.onAfterDrawObservable=new h.Observable,this.onDisposeObservable=new h.Observable,this.onIsVisibleChangedObservable=new h.Observable,this.fixedRatio=0,this._fixedRatioMasterIsWidth=!0,this.animations=null,this._tmpMeasureA=new g(0,0,0,0)}return Object.defineProperty(t.prototype,"isReadOnly",{get:function(){return this._isReadOnly},set:function(t){this._isReadOnly=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transformedMeasure",{get:function(){return this._evaluatedMeasure},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowOffsetX",{get:function(){return this._shadowOffsetX},set:function(t){this._shadowOffsetX!==t&&(this._shadowOffsetX=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowOffsetY",{get:function(){return this._shadowOffsetY},set:function(t){this._shadowOffsetY!==t&&(this._shadowOffsetY=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowBlur",{get:function(){return this._shadowBlur},set:function(t){this._shadowBlur!==t&&(this._previousShadowBlur=this._shadowBlur,this._shadowBlur=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowColor",{get:function(){return this._shadowColor},set:function(t){this._shadowColor!==t&&(this._shadowColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"typeName",{get:function(){return this._getTypeName()},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return this._getTypeName()},Object.defineProperty(t.prototype,"accessibilityTag",{get:function(){return this._accessibilityTag},set:function(t){this._accessibilityTag=t,this.onAccessibilityTagChangedObservable.notifyObservers(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"host",{get:function(){return this._host},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontOffset",{get:function(){return this._fontOffset},set:function(t){this._fontOffset=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"alpha",{get:function(){return this._alpha},set:function(t){this._alpha!==t&&(this._alphaSet=!0,this._alpha=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"highlightLineWidth",{get:function(){return this._highlightLineWidth},set:function(t){this._highlightLineWidth!==t&&(this._highlightLineWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isHighlighted",{get:function(){return this._isHighlighted},set:function(t){this._isHighlighted!==t&&(this._isHighlighted=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"highlightColor",{get:function(){return this._highlightColor},set:function(t){this._highlightColor!==t&&(this._highlightColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaleX",{get:function(){return this._scaleX},set:function(t){this._scaleX!==t&&(this._scaleX=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaleY",{get:function(){return this._scaleY},set:function(t){this._scaleY!==t&&(this._scaleY=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation!==t&&(this._rotation=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transformCenterY",{get:function(){return this._transformCenterY},set:function(t){this._transformCenterY!==t&&(this._transformCenterY=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transformCenterX",{get:function(){return this._transformCenterX},set:function(t){this._transformCenterX!==t&&(this._transformCenterX=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"horizontalAlignment",{get:function(){return this._horizontalAlignment},set:function(t){this._horizontalAlignment!==t&&(this._horizontalAlignment=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"verticalAlignment",{get:function(){return this._verticalAlignment},set:function(t){this._verticalAlignment!==t&&(this._verticalAlignment=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this._width.toString(this._host)},set:function(t){this._fixedRatioMasterIsWidth=!0,this._width.toString(this._host)!==t&&this._width.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"widthInPixels",{get:function(){return this._width.getValueInPixel(this._host,this._cachedParentMeasure.width)},set:function(t){isNaN(t)||(this._fixedRatioMasterIsWidth=!0,this.width=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._height.toString(this._host)},set:function(t){this._fixedRatioMasterIsWidth=!1,this._height.toString(this._host)!==t&&this._height.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"heightInPixels",{get:function(){return this._height.getValueInPixel(this._host,this._cachedParentMeasure.height)},set:function(t){isNaN(t)||(this._fixedRatioMasterIsWidth=!1,this.height=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(t){this._fontFamily!==t&&(this._fontFamily=t,this._resetFontCache())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(t){this._fontStyle!==t&&(this._fontStyle=t,this._resetFontCache())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(t){this._fontWeight!==t&&(this._fontWeight=t,this._resetFontCache())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"style",{get:function(){return this._style},set:function(t){var e=this;this._style&&(this._style.onChangedObservable.remove(this._styleObserver),this._styleObserver=null),this._style=t,this._style&&(this._styleObserver=this._style.onChangedObservable.add((function(){e._markAsDirty(),e._resetFontCache()}))),this._markAsDirty(),this._resetFontCache()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_isFontSizeInPercentage",{get:function(){return this._fontSize.isPercentage},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontSizeInPixels",{get:function(){var t=this._style?this._style._fontSize:this._fontSize;return t.isPixel?t.getValue(this._host):t.getValueInPixel(this._host,this._tempParentMeasure.height||this._cachedParentMeasure.height)},set:function(t){isNaN(t)||(this.fontSize=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontSize",{get:function(){return this._fontSize.toString(this._host)},set:function(t){this._fontSize.toString(this._host)!==t&&this._fontSize.fromString(t)&&(this._markAsDirty(),this._resetFontCache())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"color",{get:function(){return this._color},set:function(t){this._color!==t&&(this._color=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"gradient",{get:function(){return this._gradient},set:function(t){this._gradient!==t&&(this._gradient=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"zIndex",{get:function(){return this._zIndex},set:function(t){this.zIndex!==t&&(this._zIndex=t,this.parent&&this.parent._reOrderControl(this))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"notRenderable",{get:function(){return this._doNotRender},set:function(t){this._doNotRender!==t&&(this._doNotRender=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isVisible",{get:function(){return this._isVisible},set:function(t){this._isVisible!==t&&(this._isVisible=t,this._markAsDirty(!0),this.onIsVisibleChangedObservable.notifyObservers(t))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isDirty",{get:function(){return this._isDirty},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linkedMesh",{get:function(){return this._linkedMesh},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"descendantsOnlyPadding",{get:function(){return this._descendantsOnlyPadding},set:function(t){this._descendantsOnlyPadding!==t&&(this._descendantsOnlyPadding=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddingLeft",{get:function(){return this._paddingLeft.toString(this._host)},set:function(t){this._paddingLeft.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddingLeftInPixels",{get:function(){return this._paddingLeft.getValueInPixel(this._host,this._cachedParentMeasure.width)},set:function(t){isNaN(t)||(this.paddingLeft=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_paddingLeftInPixels",{get:function(){return this._descendantsOnlyPadding?0:this.paddingLeftInPixels},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddingRight",{get:function(){return this._paddingRight.toString(this._host)},set:function(t){this._paddingRight.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddingRightInPixels",{get:function(){return this._paddingRight.getValueInPixel(this._host,this._cachedParentMeasure.width)},set:function(t){isNaN(t)||(this.paddingRight=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_paddingRightInPixels",{get:function(){return this._descendantsOnlyPadding?0:this.paddingRightInPixels},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddingTop",{get:function(){return this._paddingTop.toString(this._host)},set:function(t){this._paddingTop.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddingTopInPixels",{get:function(){return this._paddingTop.getValueInPixel(this._host,this._cachedParentMeasure.height)},set:function(t){isNaN(t)||(this.paddingTop=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_paddingTopInPixels",{get:function(){return this._descendantsOnlyPadding?0:this.paddingTopInPixels},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddingBottom",{get:function(){return this._paddingBottom.toString(this._host)},set:function(t){this._paddingBottom.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddingBottomInPixels",{get:function(){return this._paddingBottom.getValueInPixel(this._host,this._cachedParentMeasure.height)},set:function(t){isNaN(t)||(this.paddingBottom=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_paddingBottomInPixels",{get:function(){return this._descendantsOnlyPadding?0:this.paddingBottomInPixels},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"left",{get:function(){return this._left.toString(this._host)},set:function(t){this._left.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"leftInPixels",{get:function(){return this._left.getValueInPixel(this._host,this._cachedParentMeasure.width)},set:function(t){isNaN(t)||(this.left=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this._top.toString(this._host)},set:function(t){this._top.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"topInPixels",{get:function(){return this._top.getValueInPixel(this._host,this._cachedParentMeasure.height)},set:function(t){isNaN(t)||(this.top=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linkOffsetX",{get:function(){return this._linkOffsetX.toString(this._host)},set:function(t){this._linkOffsetX.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linkOffsetXInPixels",{get:function(){return this._linkOffsetX.getValueInPixel(this._host,this._cachedParentMeasure.width)},set:function(t){isNaN(t)||(this.linkOffsetX=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linkOffsetY",{get:function(){return this._linkOffsetY.toString(this._host)},set:function(t){this._linkOffsetY.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linkOffsetYInPixels",{get:function(){return this._linkOffsetY.getValueInPixel(this._host,this._cachedParentMeasure.height)},set:function(t){isNaN(t)||(this.linkOffsetY=t+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"centerX",{get:function(){return this._currentMeasure.left+this._currentMeasure.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"centerY",{get:function(){return this._currentMeasure.top+this._currentMeasure.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(t){var e=this;if(this._isEnabled!==t){this._isEnabled=t,this._markAsDirty();var i=function(t){if(t.host){for(var o in t.host._lastControlOver)t===e.host._lastControlOver[o]&&(t._onPointerOut(t,null,!0),delete t.host._lastControlOver[o]);void 0!==t.children&&t.children.forEach(i)}};i(this)}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"disabledColor",{get:function(){return this._disabledColor},set:function(t){this._disabledColor!==t&&(this._disabledColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"disabledColorItem",{get:function(){return this._disabledColorItem},set:function(t){this._disabledColorItem!==t&&(this._disabledColorItem=t,this._markAsDirty())},enumerable:!1,configurable:!0}),t.prototype._getTypeName=function(){return"Control"},t.prototype.getAscendantOfClass=function(t){return this.parent?this.parent.getClassName()===t?this.parent:this.parent.getAscendantOfClass(t):null},t.prototype.markAsDirty=function(t){void 0===t&&(t=!1),this._markAsDirty(t)},t.prototype.markAllAsDirty=function(){this._markAllAsDirty()},t.prototype._resetFontCache=function(){this._fontSet=!0,this._markAsDirty()},t.prototype.isAscendant=function(t){return!!this.parent&&(this.parent===t||this.parent.isAscendant(t))},t.prototype.getLocalCoordinates=function(t){var e=h.Vector2.Zero();return this.getLocalCoordinatesToRef(t,e),e},t.prototype.getLocalCoordinatesToRef=function(t,e){return e.x=t.x-this._currentMeasure.left,e.y=t.y-this._currentMeasure.top,this},t.prototype.getParentLocalCoordinates=function(t){var e=h.Vector2.Zero();return e.x=t.x-this._cachedParentMeasure.left,e.y=t.y-this._cachedParentMeasure.top,e},t.prototype.moveToVector3=function(e,i){if(this._host&&this.parent===this._host._rootContainer){this.horizontalAlignment=t.HORIZONTAL_ALIGNMENT_LEFT,this.verticalAlignment=t.VERTICAL_ALIGNMENT_TOP;var o=this._host._getGlobalViewport(),n=h.Vector3.Project(e,h.Matrix.Identity(),i.getTransformMatrix(),o);this._moveToProjectedPosition(n),n.z<0||n.z>1?this.notRenderable=!0:this.notRenderable=!1}else h.Tools.Error("Cannot move a control to a vector3 if the control is not at root level")},t.prototype.getDescendantsToRef=function(t,e,i){void 0===e&&(e=!1)},t.prototype.getDescendants=function(t,e){var i=new Array;return this.getDescendantsToRef(i,t,e),i},t.prototype.linkWithMesh=function(e){if(!this._host||this.parent&&this.parent!==this._host._rootContainer)e&&h.Tools.Error("Cannot link a control to a mesh if the control is not at root level");else{var i=this._host._linkedControls.indexOf(this);if(-1!==i)return this._linkedMesh=e,void(e||this._host._linkedControls.splice(i,1));e&&(this.horizontalAlignment=t.HORIZONTAL_ALIGNMENT_LEFT,this.verticalAlignment=t.VERTICAL_ALIGNMENT_TOP,this._linkedMesh=e,this._host._linkedControls.push(this))}},t.prototype.setPadding=function(t,e,i,o){var n=t,r=null!=e?e:n,a=null!=i?i:n,s=null!=o?o:r;this.paddingTop=n,this.paddingRight=r,this.paddingBottom=a,this.paddingLeft=s},t.prototype.setPaddingInPixels=function(t,e,i,o){var n=t,r=null!=e?e:n,a=null!=i?i:n,s=null!=o?o:r;this.paddingTopInPixels=n,this.paddingRightInPixels=r,this.paddingBottomInPixels=a,this.paddingLeftInPixels=s},t.prototype._moveToProjectedPosition=function(t){var e,i=this._left.getValue(this._host),o=this._top.getValue(this._host),n=null===(e=this.parent)||void 0===e?void 0:e._currentMeasure;n&&this._processMeasures(n,this._host.getContext());var r=t.x+this._linkOffsetX.getValue(this._host)-this._currentMeasure.width/2,a=t.y+this._linkOffsetY.getValue(this._host)-this._currentMeasure.height/2,s=this._left.ignoreAdaptiveScaling&&this._top.ignoreAdaptiveScaling;s&&(Math.abs(r-i)<.5&&(r=i),Math.abs(a-o)<.5&&(a=o)),(s||i!==r||o!==a)&&(this.left=r+"px",this.top=a+"px",this._left.ignoreAdaptiveScaling=!0,this._top.ignoreAdaptiveScaling=!0,this._markAsDirty())},t.prototype._offsetLeft=function(t){this._isDirty=!0,this._currentMeasure.left+=t},t.prototype._offsetTop=function(t){this._isDirty=!0,this._currentMeasure.top+=t},t.prototype._markMatrixAsDirty=function(){this._isMatrixDirty=!0,this._flagDescendantsAsMatrixDirty()},t.prototype._flagDescendantsAsMatrixDirty=function(){},t.prototype._intersectsRect=function(t,e){return this._transform(e),!(this._evaluatedMeasure.left>=t.left+t.width||this._evaluatedMeasure.top>=t.top+t.height||this._evaluatedMeasure.left+this._evaluatedMeasure.width<=t.left||this._evaluatedMeasure.top+this._evaluatedMeasure.height<=t.top)},t.prototype._computeAdditionnalOffsetX=function(){return 0},t.prototype._computeAdditionnalOffsetY=function(){return 0},t.prototype.invalidateRect=function(){if(this._transform(),this.host&&this.host.useInvalidateRectOptimization){this._currentMeasure.transformToRef(this._transformMatrix,this._tmpMeasureA),g.CombineToRef(this._tmpMeasureA,this._prevCurrentMeasureTransformedIntoGlobalSpace,this._tmpMeasureA);var t=this.shadowOffsetX,e=this.shadowOffsetY,i=Math.max(this._previousShadowBlur,this.shadowBlur),o=Math.min(Math.min(t,0)-2*i,0),n=Math.max(Math.max(t,0)+2*i,0),r=Math.min(Math.min(e,0)-2*i,0),a=Math.max(Math.max(e,0)+2*i,0),s=this._computeAdditionnalOffsetX(),l=this._computeAdditionnalOffsetY();this.host.invalidateRect(Math.floor(this._tmpMeasureA.left+o-s),Math.floor(this._tmpMeasureA.top+r-l),Math.ceil(this._tmpMeasureA.left+this._tmpMeasureA.width+n+s),Math.ceil(this._tmpMeasureA.top+this._tmpMeasureA.height+a+l))}},t.prototype._markAsDirty=function(t){void 0===t&&(t=!1),(this._isVisible||t)&&(this._isDirty=!0,this._markMatrixAsDirty(),this._host&&this._host.markAsDirty())},t.prototype._markAllAsDirty=function(){this._markAsDirty(),this._font&&this._prepareFont()},t.prototype._link=function(t){this._host=t,this._host&&(this.uniqueId=this._host.getScene().getUniqueId())},t.prototype._transform=function(t){if(this._isMatrixDirty||1!==this._scaleX||1!==this._scaleY||0!==this._rotation){var e=this._currentMeasure.width*this._transformCenterX+this._currentMeasure.left,i=this._currentMeasure.height*this._transformCenterY+this._currentMeasure.top;t&&(t.translate(e,i),t.rotate(this._rotation),t.scale(this._scaleX,this._scaleY),t.translate(-e,-i)),(this._isMatrixDirty||this._cachedOffsetX!==e||this._cachedOffsetY!==i)&&(this._cachedOffsetX=e,this._cachedOffsetY=i,this._isMatrixDirty=!1,this._flagDescendantsAsMatrixDirty(),m.ComposeToRef(-e,-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))}},t.prototype._renderHighlight=function(t){this.isHighlighted&&(t.save(),t.strokeStyle=this._highlightColor,t.lineWidth=this._highlightLineWidth,this._renderHighlightSpecific(t),t.restore())},t.prototype._renderHighlightSpecific=function(t){t.strokeRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)},t.prototype._getColor=function(t){return this.gradient?this.gradient.getCanvasGradient(t):this.color},t.prototype._applyStates=function(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||this.gradient)&&(e.fillStyle=this._getColor(e)),t.AllowAlphaInheritance?e.globalAlpha*=this._alpha:this._alphaSet&&(e.globalAlpha=this.parent&&!this.parent.renderToIntermediateTexture?this.parent.alpha*this._alpha:this._alpha)},t.prototype._layout=function(t,e){if(!this.isDirty&&(!this.isVisible||this.notRenderable))return!1;if(this._isDirty||!this._cachedParentMeasure.isEqualsTo(t)){this.host._numLayoutCalls++,this._currentMeasure.addAndTransformToRef(this._transformMatrix,0|-this._paddingLeftInPixels,0|-this._paddingTopInPixels,0|this._paddingRightInPixels,0|this._paddingBottomInPixels,this._prevCurrentMeasureTransformedIntoGlobalSpace),e.save(),this._applyStates(e);var i=0;do{this._rebuildLayout=!1,this._processMeasures(t,e),i++}while(this._rebuildLayout&&i<3);i>=3&&h.Logger.Error("Layout cycle detected in GUI (Control name=".concat(this.name,", uniqueId=").concat(this.uniqueId,")")),e.restore(),this.invalidateRect(),this._evaluateClippingState(t)}return this._wasDirty=this._isDirty,this._isDirty=!1,!0},t.prototype._processMeasures=function(t,e){this._tempPaddingMeasure.copyFrom(t),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,e),this._measure(),this._computeAlignment(this._tempPaddingMeasure,e),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,e),this._cachedParentMeasure.copyFrom(this._tempPaddingMeasure),this._currentMeasure.transformToRef(this._transformMatrix,this._evaluatedMeasure),this.onDirtyObservable.hasObservers()&&this.onDirtyObservable.notifyObservers(this)},t.prototype._evaluateClippingState=function(t){if(this._currentMeasure.transformToRef(this._transformMatrix,this._evaluatedMeasure),this.parent&&this.parent.clipChildren){if(t.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.width<this._evaluatedParentMeasure.left)return void(this._isClipped=!0);if(this._evaluatedMeasure.top>this._evaluatedParentMeasure.top+this._evaluatedParentMeasure.height)return void(this._isClipped=!0);if(this._evaluatedMeasure.top+this._evaluatedMeasure.height<this._evaluatedParentMeasure.top)return void(this._isClipped=!0)}this._isClipped=!1},t.prototype._measure=function(){this._width.isPixel?this._currentMeasure.width=this._width.getValue(this._host):this._currentMeasure.width*=this._width.getValue(this._host),this._height.isPixel?this._currentMeasure.height=this._height.getValue(this._host):this._currentMeasure.height*=this._height.getValue(this._host),0!==this.fixedRatio&&(this._fixedRatioMasterIsWidth?this._currentMeasure.height=this._currentMeasure.width*this.fixedRatio:this._currentMeasure.width=this._currentMeasure.height*this.fixedRatio)},t.prototype._computeAlignment=function(e,i){var o=this._currentMeasure.width,n=this._currentMeasure.height,r=e.width,a=e.height,s=0,l=0;switch(this.horizontalAlignment){case t.HORIZONTAL_ALIGNMENT_LEFT:s=0;break;case t.HORIZONTAL_ALIGNMENT_RIGHT:s=r-o;break;case t.HORIZONTAL_ALIGNMENT_CENTER:s=(r-o)/2}switch(this.verticalAlignment){case t.VERTICAL_ALIGNMENT_TOP:l=0;break;case t.VERTICAL_ALIGNMENT_BOTTOM:l=a-n;break;case t.VERTICAL_ALIGNMENT_CENTER:l=(a-n)/2}this.descendantsOnlyPadding||(this._paddingLeft.isPixel?(this._currentMeasure.left+=this._paddingLeft.getValue(this._host),this._currentMeasure.width-=this._paddingLeft.getValue(this._host)):(this._currentMeasure.left+=r*this._paddingLeft.getValue(this._host),this._currentMeasure.width-=r*this._paddingLeft.getValue(this._host)),this._paddingRight.isPixel?this._currentMeasure.width-=this._paddingRight.getValue(this._host):this._currentMeasure.width-=r*this._paddingRight.getValue(this._host),this._paddingTop.isPixel?(this._currentMeasure.top+=this._paddingTop.getValue(this._host),this._currentMeasure.height-=this._paddingTop.getValue(this._host)):(this._currentMeasure.top+=a*this._paddingTop.getValue(this._host),this._currentMeasure.height-=a*this._paddingTop.getValue(this._host)),this._paddingBottom.isPixel?this._currentMeasure.height-=this._paddingBottom.getValue(this._host):this._currentMeasure.height-=a*this._paddingBottom.getValue(this._host)),this._left.isPixel?this._currentMeasure.left+=this._left.getValue(this._host):this._currentMeasure.left+=r*this._left.getValue(this._host),this._top.isPixel?this._currentMeasure.top+=this._top.getValue(this._host):this._currentMeasure.top+=a*this._top.getValue(this._host),this._currentMeasure.left+=s,this._currentMeasure.top+=l},t.prototype._preMeasure=function(t,e){},t.prototype._additionalProcessing=function(t,e){},t.prototype._clipForChildren=function(t){},t.prototype._clip=function(e,i){if(e.beginPath(),t._ClipMeasure.copyFrom(this._currentMeasure),i){i.transformToRef(this._invertTransformMatrix,this._tmpMeasureA);var o=new g(0,0,0,0);o.left=Math.max(this._tmpMeasureA.left,this._currentMeasure.left),o.top=Math.max(this._tmpMeasureA.top,this._currentMeasure.top),o.width=Math.min(this._tmpMeasureA.left+this._tmpMeasureA.width,this._currentMeasure.left+this._currentMeasure.width)-o.left,o.height=Math.min(this._tmpMeasureA.top+this._tmpMeasureA.height,this._currentMeasure.top+this._currentMeasure.height)-o.top,t._ClipMeasure.copyFrom(o)}if(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY){var n=this.shadowOffsetX,r=this.shadowOffsetY,a=this.shadowBlur,s=Math.min(Math.min(n,0)-2*a,0),l=Math.max(Math.max(n,0)+2*a,0),_=Math.min(Math.min(r,0)-2*a,0),h=Math.max(Math.max(r,0)+2*a,0);e.rect(t._ClipMeasure.left+s,t._ClipMeasure.top+_,t._ClipMeasure.width+l-s,t._ClipMeasure.height+h-_)}else e.rect(t._ClipMeasure.left,t._ClipMeasure.top,t._ClipMeasure.width,t._ClipMeasure.height);e.clip()},t.prototype._render=function(t,e){return!this.isVisible||this.notRenderable||this._isClipped?(this._isDirty=!1,!1):(this.host._numRenderCalls++,t.save(),this._applyStates(t),this._transform(t),this.clipContent&&this._clip(t,e),this.onBeforeDrawObservable.hasObservers()&&this.onBeforeDrawObservable.notifyObservers(this),this.useBitmapCache&&!this._wasDirty&&this._cacheData?t.putImageData(this._cacheData,this._currentMeasure.left,this._currentMeasure.top):this._draw(t,e),this.useBitmapCache&&this._wasDirty&&(this._cacheData=t.getImageData(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),this._renderHighlight(t),this.onAfterDrawObservable.hasObservers()&&this.onAfterDrawObservable.notifyObservers(this),t.restore(),!0)},t.prototype._draw=function(t,e){},t.prototype.contains=function(t,e){return this._invertTransformMatrix.transformCoordinates(t,e,this._transformedPosition),t=this._transformedPosition.x,e=this._transformedPosition.y,!(t<this._currentMeasure.left||t>this._currentMeasure.left+this._currentMeasure.width||e<this._currentMeasure.top||e>this._currentMeasure.top+this._currentMeasure.height||(this.isPointerBlocker&&(this._host._shouldBlockPointer=!0),0))},t.prototype._processPicking=function(t,e,i,o,n,r,a,s){return!(!this._isEnabled||!this.isHitTestVisible||!this.isVisible||this._doNotRender||!this.contains(t,e)||(this._processObservables(o,t,e,i,n,r,a,s),0))},t.prototype._onPointerMove=function(t,e,i,o){this.onPointerMoveObservable.notifyObservers(e,-1,t,this,o)&&null!=this.parent&&!this.isPointerBlocker&&this.parent._onPointerMove(t,e,i,o)},t.prototype._onPointerEnter=function(t,e){return!(!this._isEnabled||this._enterCount>0||(-1===this._enterCount&&(this._enterCount=0),this._enterCount++,this.onPointerEnterObservable.notifyObservers(this,-1,t,this,e)&&null!=this.parent&&!this.isPointerBlocker&&this.parent._onPointerEnter(t,e),0))},t.prototype._onPointerOut=function(t,e,i){if(void 0===i&&(i=!1),i||this._isEnabled&&t!==this){this._enterCount=0;var o=!0;t.isAscendant(this)||(o=this.onPointerOutObservable.notifyObservers(this,-1,t,this,e)),o&&null!=this.parent&&!this.isPointerBlocker&&this.parent._onPointerOut(t,e,i)}},t.prototype._onPointerDown=function(t,e,i,o,n){return this._onPointerEnter(this,n),0===this._downCount&&(this._downCount++,this._downPointerIds[i]=!0,this.onPointerDownObservable.notifyObservers(new b(e,o),-1,t,this,n)&&null!=this.parent&&!this.isPointerBlocker&&this.parent._onPointerDown(t,e,i,o,n),n&&this.uniqueId!==this._host.rootContainer.uniqueId&&this._host._capturedPointerIds.add(n.event.pointerId),!0)},t.prototype._onPointerUp=function(t,e,i,o,n,r){if(this._isEnabled){this._downCount=0,delete this._downPointerIds[i];var a=n;n&&(this._enterCount>0||-1===this._enterCount)&&(a=this.onPointerClickObservable.notifyObservers(new b(e,o),-1,t,this,r)),this.onPointerUpObservable.notifyObservers(new b(e,o),-1,t,this,r)&&null!=this.parent&&!this.isPointerBlocker&&this.parent._onPointerUp(t,e,i,o,a,r),r&&this.uniqueId!==this._host.rootContainer.uniqueId&&this._host._capturedPointerIds.delete(r.event.pointerId)}},t.prototype._forcePointerUp=function(t){if(void 0===t&&(t=null),null!==t)this._onPointerUp(this,h.Vector2.Zero(),t,0,!0);else for(var e in this._downPointerIds)this._onPointerUp(this,h.Vector2.Zero(),+e,0,!0)},t.prototype._onWheelScroll=function(t,e){this._isEnabled&&this.onWheelObservable.notifyObservers(new h.Vector2(t,e))&&null!=this.parent&&this.parent._onWheelScroll(t,e)},t.prototype._onCanvasBlur=function(){},t.prototype._processObservables=function(t,e,i,o,n,r,a,s){if(!this._isEnabled)return!1;if(this._dummyVector2.copyFromFloats(e,i),t===h.PointerEventTypes.POINTERMOVE){this._onPointerMove(this,this._dummyVector2,n,o);var l=this._host._lastControlOver[n];return l&&l!==this&&l._onPointerOut(this,o),l!==this&&this._onPointerEnter(this,o),this._host._lastControlOver[n]=this,!0}return t===h.PointerEventTypes.POINTERDOWN?(this._onPointerDown(this,this._dummyVector2,n,r,o),this._host._registerLastControlDown(this,n),this._host._lastPickedControl=this,!0):t===h.PointerEventTypes.POINTERUP?(this._host._lastControlDown[n]&&this._host._lastControlDown[n]._onPointerUp(this,this._dummyVector2,n,r,!0,o),delete this._host._lastControlDown[n],!0):!(t!==h.PointerEventTypes.POINTERWHEEL||!this._host._lastControlOver[n]||(this._host._lastControlOver[n]._onWheelScroll(a,s),0))},t.prototype._prepareFont=function(){(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=t._GetFontOffset(this._font),this.getDescendants().forEach((function(t){return t._markAllAsDirty()})))},t.prototype.clone=function(t){var e={};this.serialize(e);var i=new(h.Tools.Instantiate("BABYLON.GUI."+e.className));return i.parse(e,t),i},t.prototype.parse=function(t,e){var i=this;return h.SerializationHelper.Parse((function(){return i}),t,null),this.name=t.name,this._parseFromContent(t,null!=e?e:this._host),this},t.prototype.serialize=function(t){h.SerializationHelper.Serialize(this,t),t.name=this.name,t.className=this.getClassName(),this._font&&(t.fontFamily=this._fontFamily,t.fontSize=this.fontSize,t.fontWeight=this.fontWeight,t.fontStyle=this.fontStyle),this._gradient&&(t.gradient={},this._gradient.serialize(t.gradient)),h.SerializationHelper.AppendSerializedAnimations(this,t)},t.prototype._parseFromContent=function(t,e){var i;if(t.fontFamily&&(this.fontFamily=t.fontFamily),t.fontSize&&(this.fontSize=t.fontSize),t.fontWeight&&(this.fontWeight=t.fontWeight),t.fontStyle&&(this.fontStyle=t.fontStyle),t.gradient){var o=h.Tools.Instantiate("BABYLON.GUI."+t.gradient.className);this._gradient=new o,null===(i=this._gradient)||void 0===i||i.parse(t.gradient)}if(t.animations){this.animations=[];for(var n=0;n<t.animations.length;n++){var r=t.animations[n],a=(0,h.GetClass)("BABYLON.Animation");a&&this.animations.push(a.Parse(r))}t.autoAnimate&&this._host&&this._host.getScene()&&this._host.getScene().beginAnimation(this,t.autoAnimateFrom,t.autoAnimateTo,t.autoAnimateLoop,t.autoAnimateSpeed||1)}},t.prototype.dispose=function(){this.onDirtyObservable.clear(),this.onBeforeDrawObservable.clear(),this.onAfterDrawObservable.clear(),this.onPointerDownObservable.clear(),this.onPointerEnterObservable.clear(),this.onPointerMoveObservable.clear(),this.onPointerOutObservable.clear(),this.onPointerUpObservable.clear(),this.onPointerClickObservable.clear(),this.onWheelObservable.clear(),this._styleObserver&&this._style&&(this._style.onChangedObservable.remove(this._styleObserver),this._styleObserver=null),this.parent&&(this.parent.removeControl(this),this.parent=null),this._host&&this._host._linkedControls.indexOf(this)>-1&&this.linkWithMesh(null),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear()},Object.defineProperty(t,"HORIZONTAL_ALIGNMENT_LEFT",{get:function(){return t._HORIZONTAL_ALIGNMENT_LEFT},enumerable:!1,configurable:!0}),Object.defineProperty(t,"HORIZONTAL_ALIGNMENT_RIGHT",{get:function(){return t._HORIZONTAL_ALIGNMENT_RIGHT},enumerable:!1,configurable:!0}),Object.defineProperty(t,"HORIZONTAL_ALIGNMENT_CENTER",{get:function(){return t._HORIZONTAL_ALIGNMENT_CENTER},enumerable:!1,configurable:!0}),Object.defineProperty(t,"VERTICAL_ALIGNMENT_TOP",{get:function(){return t._VERTICAL_ALIGNMENT_TOP},enumerable:!1,configurable:!0}),Object.defineProperty(t,"VERTICAL_ALIGNMENT_BOTTOM",{get:function(){return t._VERTICAL_ALIGNMENT_BOTTOM},enumerable:!1,configurable:!0}),Object.defineProperty(t,"VERTICAL_ALIGNMENT_CENTER",{get:function(){return t._VERTICAL_ALIGNMENT_CENTER},enumerable:!1,configurable:!0}),t._GetFontOffset=function(e){if(t._FontHeightSizes[e])return t._FontHeightSizes[e];var i=h.EngineStore.LastCreatedEngine;if(!i)throw new Error("Invalid engine. Unable to create a canvas.");var o=i.getFontOffset(e);return t._FontHeightSizes[e]=o,o},t.Parse=function(t,e){var i=h.Tools.Instantiate("BABYLON.GUI."+t.className),o=h.SerializationHelper.Parse((function(){return new i}),t,null);return o.name=t.name,o._parseFromContent(t,e),o},t.drawEllipse=function(t,e,i,o,n){n.translate(t,e),n.scale(i,o),n.beginPath(),n.arc(0,0,1,0,2*Math.PI),n.closePath(),n.scale(1/i,1/o),n.translate(-t,-e)},t.prototype.isReady=function(){return!0},t.AllowAlphaInheritance=!1,t._ClipMeasure=new g(0,0,0,0),t._HORIZONTAL_ALIGNMENT_LEFT=0,t._HORIZONTAL_ALIGNMENT_RIGHT=1,t._HORIZONTAL_ALIGNMENT_CENTER=2,t._VERTICAL_ALIGNMENT_TOP=0,t._VERTICAL_ALIGNMENT_BOTTOM=1,t._VERTICAL_ALIGNMENT_CENTER=2,t._FontHeightSizes={},t.AddHeader=function(){},s([(0,h.serialize)()],t.prototype,"metadata",void 0),s([(0,h.serialize)()],t.prototype,"isHitTestVisible",void 0),s([(0,h.serialize)()],t.prototype,"isPointerBlocker",void 0),s([(0,h.serialize)()],t.prototype,"isFocusInvisible",void 0),s([(0,h.serialize)()],t.prototype,"clipChildren",void 0),s([(0,h.serialize)()],t.prototype,"clipContent",void 0),s([(0,h.serialize)()],t.prototype,"useBitmapCache",void 0),s([(0,h.serialize)()],t.prototype,"shadowOffsetX",null),s([(0,h.serialize)()],t.prototype,"shadowOffsetY",null),s([(0,h.serialize)()],t.prototype,"shadowBlur",null),s([(0,h.serialize)()],t.prototype,"shadowColor",null),s([(0,h.serialize)()],t.prototype,"hoverCursor",void 0),s([(0,h.serialize)()],t.prototype,"fontOffset",null),s([(0,h.serialize)()],t.prototype,"alpha",null),s([(0,h.serialize)()],t.prototype,"scaleX",null),s([(0,h.serialize)()],t.prototype,"scaleY",null),s([(0,h.serialize)()],t.prototype,"rotation",null),s([(0,h.serialize)()],t.prototype,"transformCenterY",null),s([(0,h.serialize)()],t.prototype,"transformCenterX",null),s([(0,h.serialize)()],t.prototype,"horizontalAlignment",null),s([(0,h.serialize)()],t.prototype,"verticalAlignment",null),s([(0,h.serialize)()],t.prototype,"fixedRatio",void 0),s([(0,h.serialize)()],t.prototype,"width",null),s([(0,h.serialize)()],t.prototype,"height",null),s([(0,h.serialize)()],t.prototype,"style",null),s([(0,h.serialize)()],t.prototype,"color",null),s([(0,h.serialize)()],t.prototype,"gradient",null),s([(0,h.serialize)()],t.prototype,"zIndex",null),s([(0,h.serialize)()],t.prototype,"notRenderable",null),s([(0,h.serialize)()],t.prototype,"isVisible",null),s([(0,h.serialize)()],t.prototype,"descendantsOnlyPadding",null),s([(0,h.serialize)()],t.prototype,"paddingLeft",null),s([(0,h.serialize)()],t.prototype,"paddingRight",null),s([(0,h.serialize)()],t.prototype,"paddingTop",null),s([(0,h.serialize)()],t.prototype,"paddingBottom",null),s([(0,h.serialize)()],t.prototype,"left",null),s([(0,h.serialize)()],t.prototype,"top",null),s([(0,h.serialize)()],t.prototype,"linkOffsetX",null),s([(0,h.serialize)()],t.prototype,"linkOffsetY",null),s([(0,h.serialize)()],t.prototype,"isEnabled",null),s([(0,h.serialize)()],t.prototype,"disabledColor",null),s([(0,h.serialize)()],t.prototype,"disabledColorItem",null),s([(0,h.serialize)()],t.prototype,"overlapGroup",void 0),s([(0,h.serialize)()],t.prototype,"overlapDeltaMultiplier",void 0),t}();(0,h.RegisterClass)("BABYLON.GUI.Control",y);var x=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._children=new Array,i._measureForChildren=g.Empty(),i._background="",i._backgroundGradient=null,i._adaptWidthToChildren=!1,i._adaptHeightToChildren=!1,i._renderToIntermediateTexture=!1,i._intermediateTexture=null,i.logLayoutCycleErrors=!1,i.maxLayoutCycle=3,i.onControlAddedObservable=new h.Observable,i.onControlRemovedObservable=new h.Observable,i._inverseTransformMatrix=m.Identity(),i._inverseMeasure=new g(0,0,0,0),i}return r(e,t),Object.defineProperty(e.prototype,"renderToIntermediateTexture",{get:function(){return this._renderToIntermediateTexture},set:function(t){this._renderToIntermediateTexture!==t&&(this._renderToIntermediateTexture=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"adaptHeightToChildren",{get:function(){return this._adaptHeightToChildren},set:function(t){this._adaptHeightToChildren!==t&&(this._adaptHeightToChildren=t,t&&(this.height="100%"),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"adaptWidthToChildren",{get:function(){return this._adaptWidthToChildren},set:function(t){this._adaptWidthToChildren!==t&&(this._adaptWidthToChildren=t,t&&(this.width="100%"),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backgroundGradient",{get:function(){return this._backgroundGradient},set:function(t){this._backgroundGradient!==t&&(this._backgroundGradient=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"children",{get:function(){return this._children},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isReadOnly",{get:function(){return this._isReadOnly},set:function(t){this._isReadOnly=t;for(var e=0,i=this._children;e<i.length;e++)i[e].isReadOnly=t},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"Container"},e.prototype._flagDescendantsAsMatrixDirty=function(){for(var t=0,e=this.children;t<e.length;t++){var i=e[t];i._isClipped=!1,i._markMatrixAsDirty()}},e.prototype.getChildByName=function(t){for(var e=0,i=this.children;e<i.length;e++){var o=i[e];if(o.name===t)return o}return null},e.prototype.getChildByType=function(t,e){for(var i=0,o=this.children;i<o.length;i++){var n=o[i];if(n.typeName===e)return n}return null},e.prototype.containsControl=function(t){return-1!==this.children.indexOf(t)},e.prototype.addControl=function(t){return t?(-1!==this._children.indexOf(t)||(t._link(this._host),t._markAllAsDirty(),this._reOrderControl(t),this._markAsDirty(),this.onControlAddedObservable.notifyObservers(t)),this):this},e.prototype.clearControls=function(){for(var t=0,e=this.children.slice();t<e.length;t++){var i=e[t];this.removeControl(i)}return this},e.prototype.removeControl=function(t){var e=this._children.indexOf(t);return-1!==e&&(this._children.splice(e,1),t.parent=null),t.linkWithMesh(null),this._host&&this._host._cleanControlAfterRemoval(t),this._markAsDirty(),this.onControlRemovedObservable.notifyObservers(t),this},e.prototype._reOrderControl=function(t){var e=t.linkedMesh;this.removeControl(t);for(var i=!1,o=0;o<this._children.length;o++)if(this._children[o].zIndex>t.zIndex){this._children.splice(o,0,t),i=!0;break}i||this._children.push(t),t.parent=this,e&&t.linkWithMesh(e),this._markAsDirty()},e.prototype._offsetLeft=function(e){t.prototype._offsetLeft.call(this,e);for(var i=0,o=this._children;i<o.length;i++)o[i]._offsetLeft(e)},e.prototype._offsetTop=function(e){t.prototype._offsetTop.call(this,e);for(var i=0,o=this._children;i<o.length;i++)o[i]._offsetTop(e)},e.prototype._markAllAsDirty=function(){t.prototype._markAllAsDirty.call(this);for(var e=0;e<this._children.length;e++)this._children[e]._markAllAsDirty()},e.prototype._getBackgroundColor=function(t){return this._backgroundGradient?this._backgroundGradient.getCanvasGradient(t):this._background},e.prototype._localDraw=function(t){(this._background||this._backgroundGradient)&&(t.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),t.fillStyle=this._getBackgroundColor(t),t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height),t.restore())},e.prototype._link=function(e){t.prototype._link.call(this,e);for(var i=0,o=this._children;i<o.length;i++)o[i]._link(e)},e.prototype._beforeLayout=function(){},e.prototype._processMeasures=function(e,i){!this._isDirty&&this._cachedParentMeasure.isEqualsTo(e)||(t.prototype._processMeasures.call(this,e,i),this._evaluateClippingState(e),this._renderToIntermediateTexture&&(this._intermediateTexture&&this._host.getScene()!=this._intermediateTexture.getScene()&&(this._intermediateTexture.dispose(),this._intermediateTexture=null),this._intermediateTexture?this._intermediateTexture.scaleTo(this._currentMeasure.width,this._currentMeasure.height):(this._intermediateTexture=new h.DynamicTexture("",{width:this._currentMeasure.width,height:this._currentMeasure.height},this._host.getScene(),!1,h.Texture.NEAREST_SAMPLINGMODE,h.Constants.TEXTUREFORMAT_RGBA,!1),this._intermediateTexture.hasAlpha=!0)))},e.prototype._layout=function(t,e){var i,o;if(!this.isDirty&&(!this.isVisible||this.notRenderable))return!1;this.host._numLayoutCalls++,this._isDirty&&this._currentMeasure.transformToRef(this._transformMatrix,this._prevCurrentMeasureTransformedIntoGlobalSpace);var n=0;e.save(),this._applyStates(e),this._beforeLayout();do{var r=-1,a=-1;if(this._rebuildLayout=!1,this._processMeasures(t,e),!this._isClipped){for(var s=0,l=this._children;s<l.length;s++){var _=l[s];_._tempParentMeasure.copyFrom(this._measureForChildren),_._layout(this._measureForChildren,e)&&_.isVisible&&!_.notRenderable&&(this.adaptWidthToChildren&&_._width.isPixel&&(r=Math.max(r,_._currentMeasure.width+_._paddingLeftInPixels+_._paddingRightInPixels)),this.adaptHeightToChildren&&_._height.isPixel&&(a=Math.max(a,_._currentMeasure.height+_._paddingTopInPixels+_._paddingBottomInPixels)))}this.adaptWidthToChildren&&r>=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&&a>=0&&(a+=this.paddingTopInPixels+this.paddingBottomInPixels,this.height!==a+"px"&&(null===(o=this.parent)||void 0===o||o._markAsDirty(),this.height=a+"px",this._height.ignoreAdaptiveScaling=!0,this._rebuildLayout=!0)),this._postMeasure()}n++}while(this._rebuildLayout&&n<this.maxLayoutCycle);return n>=3&&this.logLayoutCycleErrors&&h.Logger.Error("Layout cycle detected in GUI (Container name=".concat(this.name,", uniqueId=").concat(this.uniqueId,")")),e.restore(),this._isDirty&&(this.invalidateRect(),this._isDirty=!1),!0},e.prototype._postMeasure=function(){},e.prototype._draw=function(t,e){var i=this._renderToIntermediateTexture&&this._intermediateTexture,o=i?this._intermediateTexture.getContext():t;i&&(o.save(),o.translate(-this._currentMeasure.left,-this._currentMeasure.top),e?(this._transformMatrix.invertToRef(this._inverseTransformMatrix),e.transformToRef(this._inverseTransformMatrix,this._inverseMeasure),o.clearRect(this._inverseMeasure.left,this._inverseMeasure.top,this._inverseMeasure.width,this._inverseMeasure.height)):o.clearRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),this._localDraw(o),t.save(),this.clipChildren&&this._clipForChildren(o);for(var n=0,r=this._children;n<r.length;n++){var a=r[n];e&&!a._intersectsRect(e)||a._render(o,e)}i&&(o.restore(),t.save(),t.globalAlpha=this.alpha,t.drawImage(o.canvas,this._currentMeasure.left,this._currentMeasure.top),t.restore()),t.restore()},e.prototype.getDescendantsToRef=function(t,e,i){if(void 0===e&&(e=!1),this.children)for(var o=0;o<this.children.length;o++){var n=this.children[o];i&&!i(n)||t.push(n),e||n.getDescendantsToRef(t,!1,i)}},e.prototype._processPicking=function(e,i,o,n,r,a,s,l){if(!this._isEnabled||!this.isVisible||this.notRenderable)return!1;var _=t.prototype.contains.call(this,e,i);if(!_&&this.clipChildren)return!1;for(var h=this._children.length-1;h>=0;h--){var c=this._children[h];if(c._processPicking(e,i,o,n,r,a,s,l))return c.hoverCursor&&this._host._changeCursor(c.hoverCursor),!0}return!!_&&!!this.isHitTestVisible&&this._processObservables(n,e,i,o,r,a,s,l)},e.prototype._additionalProcessing=function(e,i){t.prototype._additionalProcessing.call(this,e,i),this._measureForChildren.copyFrom(this._currentMeasure)},e.prototype.serialize=function(e){if(t.prototype.serialize.call(this,e),this.backgroundGradient&&(e.backgroundGradient={},this.backgroundGradient.serialize(e.backgroundGradient)),this.children.length){e.children=[];for(var i=0,o=this.children;i<o.length;i++){var n={};o[i].serialize(n),e.children.push(n)}}},e.prototype.dispose=function(){var e;t.prototype.dispose.call(this);for(var i=this.children.length-1;i>=0;i--)this.children[i].dispose();null===(e=this._intermediateTexture)||void 0===e||e.dispose()},e.prototype._parseFromContent=function(e,i){var o;if(t.prototype._parseFromContent.call(this,e,i),this._link(i),e.backgroundGradient){var n=h.Tools.Instantiate("BABYLON.GUI."+e.backgroundGradient.className);this._backgroundGradient=new n,null===(o=this._backgroundGradient)||void 0===o||o.parse(e.backgroundGradient)}if(e.children)for(var r=0,a=e.children;r<a.length;r++){var s=a[r];this.addControl(y.Parse(s,i))}},e.prototype.isReady=function(){for(var t=0,e=this.children;t<e.length;t++)if(!e[t].isReady())return!1;return!0},s([(0,h.serialize)()],e.prototype,"renderToIntermediateTexture",null),s([(0,h.serialize)()],e.prototype,"maxLayoutCycle",void 0),s([(0,h.serialize)()],e.prototype,"adaptHeightToChildren",null),s([(0,h.serialize)()],e.prototype,"adaptWidthToChildren",null),s([(0,h.serialize)()],e.prototype,"background",null),s([(0,h.serialize)()],e.prototype,"backgroundGradient",null),e}(y);(0,h.RegisterClass)("BABYLON.GUI.Container",x);var P,I=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._thickness=1,i._cornerRadius=0,i}return r(e,t),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness!==t&&(this._thickness=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cornerRadius",{get:function(){return this._cornerRadius},set:function(t){t<0&&(t=0),this._cornerRadius!==t&&(this._cornerRadius=t,this._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"Rectangle"},e.prototype._computeAdditionnalOffsetX=function(){return this._cornerRadius?1:0},e.prototype._computeAdditionnalOffsetY=function(){return this._cornerRadius?1:0},e.prototype._getRectangleFill=function(t){return this._getBackgroundColor(t)},e.prototype._localDraw=function(t){t.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),(this._background||this._backgroundGradient)&&(t.fillStyle=this._getRectangleFill(t),this._cornerRadius?(this._drawRoundedRect(t,this._thickness/2),t.fill()):t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),this._thickness&&((this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),(this.color||this.gradient)&&(t.strokeStyle=this.gradient?this.gradient.getCanvasGradient(t):this.color),t.lineWidth=this._thickness,this._cornerRadius?(this._drawRoundedRect(t,this._thickness/2),t.stroke()):t.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,this._currentMeasure.width-this._thickness,this._currentMeasure.height-this._thickness)),t.restore()},e.prototype._additionalProcessing=function(e,i){t.prototype._additionalProcessing.call(this,e,i),this._measureForChildren.width-=2*this._thickness,this._measureForChildren.height-=2*this._thickness,this._measureForChildren.left+=this._thickness,this._measureForChildren.top+=this._thickness},e.prototype._drawRoundedRect=function(t,e){void 0===e&&(e=0);var i=this._currentMeasure.left+e,o=this._currentMeasure.top+e,n=this._currentMeasure.width-2*e,r=this._currentMeasure.height-2*e,a=Math.min(r/2,Math.min(n/2,this._cornerRadius));a=Math.abs(a),t.beginPath(),t.moveTo(i+a,o),t.lineTo(i+n-a,o),t.arc(i+n-a,o+a,a,3*Math.PI/2,2*Math.PI),t.lineTo(i+n,o+r-a),t.arc(i+n-a,o+r-a,a,0,Math.PI/2),t.lineTo(i+a,o+r),t.arc(i+a,o+r-a,a,Math.PI/2,Math.PI),t.lineTo(i,o+a),t.arc(i+a,o+a,a,Math.PI,3*Math.PI/2),t.closePath()},e.prototype._clipForChildren=function(t){this._cornerRadius&&(this._drawRoundedRect(t,this._thickness),t.clip())},s([(0,h.serialize)()],e.prototype,"thickness",null),s([(0,h.serialize)()],e.prototype,"cornerRadius",null),e}(x);(0,h.RegisterClass)("BABYLON.GUI.Rectangle",I),function(t){t[t.Clip=0]="Clip",t[t.WordWrap=1]="WordWrap",t[t.Ellipsis=2]="Ellipsis",t[t.WordWrapEllipsis=3]="WordWrapEllipsis"}(P||(P={}));var B=function(t){function e(e,i){void 0===i&&(i="");var o=t.call(this,e)||this;return o.name=e,o._text="",o._textWrapping=P.Clip,o._textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_CENTER,o._textVerticalAlignment=y.VERTICAL_ALIGNMENT_CENTER,o._resizeToFit=!1,o._lineSpacing=new c(0),o._outlineWidth=0,o._outlineColor="white",o._underline=!1,o._lineThrough=!1,o._wordDivider=" ",o._forceResizeWidth=!1,o.onTextChangedObservable=new h.Observable,o.onLinesReadyObservable=new h.Observable,o._linesTemp=[],o.text=i,o}return r(e,t),Object.defineProperty(e.prototype,"lines",{get:function(){return this._lines},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resizeToFit",{get:function(){return this._resizeToFit},set:function(t){this._resizeToFit!==t&&(this._resizeToFit=t,this._resizeToFit&&(this._width.ignoreAdaptiveScaling=!0,this._height.ignoreAdaptiveScaling=!0),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textWrapping",{get:function(){return this._textWrapping},set:function(t){this._textWrapping!==t&&(this._textWrapping=+t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){this._text!==t&&(this._text=t+"",this._markAsDirty(),this.onTextChangedObservable.notifyObservers(this))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textHorizontalAlignment",{get:function(){return this._textHorizontalAlignment},set:function(t){this._textHorizontalAlignment!==t&&(this._textHorizontalAlignment=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textVerticalAlignment",{get:function(){return this._textVerticalAlignment},set:function(t){this._textVerticalAlignment!==t&&(this._textVerticalAlignment=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lineSpacing",{get:function(){return this._lineSpacing.toString(this._host)},set:function(t){this._lineSpacing.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"outlineWidth",{get:function(){return this._outlineWidth},set:function(t){this._outlineWidth!==t&&(this._outlineWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"underline",{get:function(){return this._underline},set:function(t){this._underline!==t&&(this._underline=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lineThrough",{get:function(){return this._lineThrough},set:function(t){this._lineThrough!==t&&(this._lineThrough=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"outlineColor",{get:function(){return this._outlineColor},set:function(t){this._outlineColor!==t&&(this._outlineColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wordDivider",{get:function(){return this._wordDivider},set:function(t){this._wordDivider!==t&&(this._wordDivider=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"forceResizeWidth",{get:function(){return this._forceResizeWidth},set:function(t){this._forceResizeWidth!==t&&(this._forceResizeWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"TextBlock"},e.prototype._processMeasures=function(e,i){this._fontOffset&&!this.isDirty||(this._fontOffset=y._GetFontOffset(i.font)),t.prototype._processMeasures.call(this,e,i),this._lines=this._breakLines(this._currentMeasure.width,this._currentMeasure.height,i),this.onLinesReadyObservable.notifyObservers(this);for(var o=0,n=0;n<this._lines.length;n++){var r=this._lines[n];r.width>o&&(o=r.width)}if(this._resizeToFit){if(this._textWrapping===P.Clip||this._forceResizeWidth){var a=Math.ceil(this._paddingLeftInPixels)+Math.ceil(this._paddingRightInPixels)+Math.ceil(o);a!==this._width.getValueInPixel(this._host,this._tempParentMeasure.width)&&(this._width.updateInPlace(a,c.UNITMODE_PIXEL),this._rebuildLayout=!0)}var s=this._paddingTopInPixels+this._paddingBottomInPixels+this._fontOffset.height*this._lines.length|0;if(this._lines.length>0&&0!==this._lineSpacing.internalValue){var l;l=this._lineSpacing.isPixel?this._lineSpacing.getValue(this._host):this._lineSpacing.getValue(this._host)*this._height.getValueInPixel(this._host,this._cachedParentMeasure.height),s+=(this._lines.length-1)*l}s!==this._height.internalValue&&(this._height.updateInPlace(s,c.UNITMODE_PIXEL),this._rebuildLayout=!0)}},e.prototype._drawText=function(t,e,i,o){var n=this._currentMeasure.width,r=0;switch(this._textHorizontalAlignment){case y.HORIZONTAL_ALIGNMENT_LEFT:r=0;break;case y.HORIZONTAL_ALIGNMENT_RIGHT:r=n-e;break;case y.HORIZONTAL_ALIGNMENT_CENTER:r=(n-e)/2}(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(o.shadowColor=this.shadowColor,o.shadowBlur=this.shadowBlur,o.shadowOffsetX=this.shadowOffsetX,o.shadowOffsetY=this.shadowOffsetY),this.outlineWidth&&o.strokeText(t,this._currentMeasure.left+r,i),o.fillText(t,this._currentMeasure.left+r,i),this._underline&&(o.beginPath(),o.lineWidth=Math.round(.05*this.fontSizeInPixels),o.moveTo(this._currentMeasure.left+r,i+3),o.lineTo(this._currentMeasure.left+r+e,i+3),o.stroke(),o.closePath()),this._lineThrough&&(o.beginPath(),o.lineWidth=Math.round(.05*this.fontSizeInPixels),o.moveTo(this._currentMeasure.left+r,i-this.fontSizeInPixels/3),o.lineTo(this._currentMeasure.left+r+e,i-this.fontSizeInPixels/3),o.stroke(),o.closePath())},e.prototype._draw=function(t){t.save(),this._applyStates(t),this._renderLines(t),t.restore()},e.prototype._applyStates=function(e){t.prototype._applyStates.call(this,e),this.outlineWidth&&(e.lineWidth=this.outlineWidth,e.strokeStyle=this.outlineColor,e.lineJoin="miter",e.miterLimit=2)},e.prototype._breakLines=function(t,e,i){var o,n;this._linesTemp.length=0;var r=this.text.split("\n");if(this._textWrapping===P.Ellipsis)for(var a=0,s=r;a<s.length;a++){var l=s[a];this._linesTemp.push(this._parseLineEllipsis(l,t,i))}else if(this._textWrapping===P.WordWrap)for(var _=0,h=r;_<h.length;_++)l=h[_],(o=this._linesTemp).push.apply(o,this._parseLineWordWrap(l,t,i));else if(this._textWrapping===P.WordWrapEllipsis)for(var c=0,u=r;c<u.length;c++)l=u[c],(n=this._linesTemp).push.apply(n,this._parseLineWordWrapEllipsis(l,t,e,i));else for(var d=0,f=r;d<f.length;d++)l=f[d],this._linesTemp.push(this._parseLine(l,i));return this._linesTemp},e.prototype._parseLine=function(t,e){return void 0===t&&(t=""),{text:t,width:this._getTextMetricsWidth(e.measureText(t))}},e.prototype._getCharsToRemove=function(t,e,i){var o=t>e?t-e:0,n=t/i;return Math.max(Math.floor(o/n),1)},e.prototype._parseLineEllipsis=function(t,e,i){void 0===t&&(t="");var o=this._getTextMetricsWidth(i.measureText(t)),n=this._getCharsToRemove(o,e,t.length),r=Array.from&&Array.from(t);if(r)for(;r.length&&o>e;)r.splice(r.length-n,n),t="".concat(r.join(""),"…"),o=this._getTextMetricsWidth(i.measureText(t)),n=this._getCharsToRemove(o,e,t.length);else{for(;t.length>2&&o>e;)t=t.slice(0,-n),o=this._getTextMetricsWidth(i.measureText(t+"…")),n=this._getCharsToRemove(o,e,t.length);t+="…"}return{text:t,width:o}},e.prototype._getTextMetricsWidth=function(t){return void 0!==t.actualBoundingBoxLeft?Math.abs(t.actualBoundingBoxLeft)+Math.abs(t.actualBoundingBoxRight):t.width},e.prototype._parseLineWordWrap=function(t,e,i){void 0===t&&(t="");for(var o=[],n=this.wordSplittingFunction?this.wordSplittingFunction(t):t.split(this._wordDivider),r=this._getTextMetricsWidth(i.measureText(t)),a=0;a<n.length;a++){var s=a>0?t+this._wordDivider+n[a]:n[0],l=this._getTextMetricsWidth(i.measureText(s));l>e&&a>0?(o.push({text:t,width:r}),t=n[a],r=this._getTextMetricsWidth(i.measureText(t))):(r=l,t=s)}return o.push({text:t,width:r}),o},e.prototype._parseLineWordWrapEllipsis=function(t,e,i,o){void 0===t&&(t="");for(var n=this._parseLineWordWrap(t,e,o),r=1;r<=n.length;r++)if(this._computeHeightForLinesOf(r)>i&&r>1){var a=n[r-2],s=n[r-1];n[r-2]=this._parseLineEllipsis("".concat(a.text+s.text),e,o);for(var l=n.length-r+1,_=0;_<l;_++)n.pop();return n}return n},e.prototype._renderLines=function(t){if(this._fontOffset&&this._lines){var e=this._currentMeasure.height,i=0;switch(this._textVerticalAlignment){case y.VERTICAL_ALIGNMENT_TOP:i=this._fontOffset.ascent;break;case y.VERTICAL_ALIGNMENT_BOTTOM:i=e-this._fontOffset.height*(this._lines.length-1)-this._fontOffset.descent;break;case y.VERTICAL_ALIGNMENT_CENTER:i=this._fontOffset.ascent+(e-this._fontOffset.height*this._lines.length)/2}i+=this._currentMeasure.top;for(var o=0;o<this._lines.length;o++){var n=this._lines[o];0!==o&&0!==this._lineSpacing.internalValue&&(this._lineSpacing.isPixel?i+=this._lineSpacing.getValue(this._host):i+=this._lineSpacing.getValue(this._host)*this._height.getValueInPixel(this._host,this._cachedParentMeasure.height)),this._drawText(n.text,n.width,i,t),i+=this._fontOffset.height}}},e.prototype._computeHeightForLinesOf=function(t){var e=this._paddingTopInPixels+this._paddingBottomInPixels+this._fontOffset.height*t;return t>0&&0!==this._lineSpacing.internalValue&&(e+=(t-1)*(this._lineSpacing.isPixel?this._lineSpacing.getValue(this._host):this._lineSpacing.getValue(this._host)*this._height.getValueInPixel(this._host,this._cachedParentMeasure.height))),e},e.prototype.computeExpectedHeight=function(){var t;if(this.text&&this.widthInPixels){var e=null===(t=h.EngineStore.LastCreatedEngine)||void 0===t?void 0:t.createCanvas(0,0).getContext("2d");if(e){this._applyStates(e),this._fontOffset||(this._fontOffset=y._GetFontOffset(e.font));var i=this._lines?this._lines:this._breakLines(this.widthInPixels-this._paddingLeftInPixels-this._paddingRightInPixels,this.heightInPixels-this._paddingTopInPixels-this._paddingBottomInPixels,e);return this._computeHeightForLinesOf(i.length)}}return 0},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.onTextChangedObservable.clear()},s([(0,h.serialize)()],e.prototype,"resizeToFit",null),s([(0,h.serialize)()],e.prototype,"textWrapping",null),s([(0,h.serialize)()],e.prototype,"text",null),s([(0,h.serialize)()],e.prototype,"textHorizontalAlignment",null),s([(0,h.serialize)()],e.prototype,"textVerticalAlignment",null),s([(0,h.serialize)()],e.prototype,"lineSpacing",null),s([(0,h.serialize)()],e.prototype,"outlineWidth",null),s([(0,h.serialize)()],e.prototype,"underline",null),s([(0,h.serialize)()],e.prototype,"lineThrough",null),s([(0,h.serialize)()],e.prototype,"outlineColor",null),s([(0,h.serialize)()],e.prototype,"wordDivider",null),s([(0,h.serialize)()],e.prototype,"forceResizeWidth",null),e}(y);(0,h.RegisterClass)("BABYLON.GUI.TextBlock",B);var C=function(t){function e(i,o){void 0===o&&(o=null);var n=t.call(this,i)||this;return n.name=i,n._workingCanvas=null,n._loaded=!1,n._stretch=e.STRETCH_FILL,n._autoScale=!1,n._sourceLeft=0,n._sourceTop=0,n._sourceWidth=0,n._sourceHeight=0,n._svgAttributesComputationCompleted=!1,n._isSVG=!1,n._cellWidth=0,n._cellHeight=0,n._cellId=-1,n._populateNinePatchSlicesFromImage=!1,n._imageDataCache={data:null,key:""},n.onImageLoadedObservable=new h.Observable,n.onSVGAttributesComputedObservable=new h.Observable,n.source=o,n}return r(e,t),Object.defineProperty(e.prototype,"isLoaded",{get:function(){return this._loaded},enumerable:!1,configurable:!0}),e.prototype.isReady=function(){return this.isLoaded},Object.defineProperty(e.prototype,"detectPointerOnOpaqueOnly",{get:function(){return this._detectPointerOnOpaqueOnly},set:function(t){this._detectPointerOnOpaqueOnly!==t&&(this._detectPointerOnOpaqueOnly=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sliceLeft",{get:function(){return this._sliceLeft},set:function(t){this._sliceLeft!==t&&(this._sliceLeft=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sliceRight",{get:function(){return this._sliceRight},set:function(t){this._sliceRight!==t&&(this._sliceRight=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sliceTop",{get:function(){return this._sliceTop},set:function(t){this._sliceTop!==t&&(this._sliceTop=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sliceBottom",{get:function(){return this._sliceBottom},set:function(t){this._sliceBottom!==t&&(this._sliceBottom=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sourceLeft",{get:function(){return this._sourceLeft},set:function(t){this._sourceLeft!==t&&(this._sourceLeft=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sourceTop",{get:function(){return this._sourceTop},set:function(t){this._sourceTop!==t&&(this._sourceTop=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sourceWidth",{get:function(){return this._sourceWidth},set:function(t){this._sourceWidth!==t&&(this._sourceWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sourceHeight",{get:function(){return this._sourceHeight},set:function(t){this._sourceHeight!==t&&(this._sourceHeight=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"imageWidth",{get:function(){return this._imageWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"imageHeight",{get:function(){return this._imageHeight},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"populateNinePatchSlicesFromImage",{get:function(){return this._populateNinePatchSlicesFromImage},set:function(t){this._populateNinePatchSlicesFromImage!==t&&(this._populateNinePatchSlicesFromImage=t,this._populateNinePatchSlicesFromImage&&this._loaded&&this._extractNinePatchSliceDataFromImage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isSVG",{get:function(){return this._isSVG},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"svgAttributesComputationCompleted",{get:function(){return this._svgAttributesComputationCompleted},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"autoScale",{get:function(){return this._autoScale},set:function(t){this._autoScale!==t&&(this._autoScale=t,t&&this._loaded&&this.synchronizeSizeWithContent())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stretch",{get:function(){return this._stretch},set:function(t){this._stretch!==t&&(this._stretch=t,this._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype._rotate90=function(t,i){var o,n;void 0===i&&(i=!1);var r=this._domImage.width,a=this._domImage.height,s=(null===(n=null===(o=this._host)||void 0===o?void 0:o.getScene())||void 0===n?void 0:n.getEngine())||h.EngineStore.LastCreatedEngine;if(!s)throw new Error("Invalid engine. Unable to create a canvas.");var l=s.createCanvas(a,r),_=l.getContext("2d");_.translate(l.width/2,l.height/2),_.rotate(t*Math.PI/2),_.drawImage(this._domImage,0,0,r,a,-r/2,-a/2,r,a);var c=l.toDataURL("image/jpg"),u=new e(this.name+"rotated",c);return i&&(u._stretch=this._stretch,u._autoScale=this._autoScale,u._cellId=this._cellId,u._cellWidth=t%1?this._cellHeight:this._cellWidth,u._cellHeight=t%1?this._cellWidth:this._cellHeight),this._handleRotationForSVGImage(this,u,t),this._imageDataCache.data=null,u},e.prototype._handleRotationForSVGImage=function(t,e,i){var o=this;t._isSVG&&(t._svgAttributesComputationCompleted?(this._rotate90SourceProperties(t,e,i),this._markAsDirty()):t.onSVGAttributesComputedObservable.addOnce((function(){o._rotate90SourceProperties(t,e,i),o._markAsDirty()})))},e.prototype._rotate90SourceProperties=function(t,e,i){var o,n,r=t.sourceLeft,a=t.sourceTop,s=t.domImage.width,l=t.domImage.height,_=r,h=a,c=t.sourceWidth,u=t.sourceHeight;if(0!=i){var d=i<0?-1:1;i%=4;for(var f=0;f<Math.abs(i);++f)_=-(a-l/2)*d+l/2,h=(r-s/2)*d+s/2,c=(o=[u,c])[0],u=o[1],i<0?h-=u:_-=c,r=_,a=h,s=(n=[l,s])[0],l=n[1]}e.sourceLeft=_,e.sourceTop=h,e.sourceWidth=c,e.sourceHeight=u},e.prototype._extractNinePatchSliceDataFromImage=function(){var t,e,i=this._domImage.width,o=this._domImage.height;if(!this._workingCanvas){var n=(null===(e=null===(t=this._host)||void 0===t?void 0:t.getScene())||void 0===e?void 0:e.getEngine())||h.EngineStore.LastCreatedEngine;if(!n)throw new Error("Invalid engine. Unable to create a canvas.");this._workingCanvas=n.createCanvas(i,o)}var r=this._workingCanvas.getContext("2d");r.drawImage(this._domImage,0,0,i,o);var a=r.getImageData(0,0,i,o);this._sliceLeft=-1,this._sliceRight=-1;for(var s=0;s<i;s++)if((_=a.data[4*s+3])>127&&-1===this._sliceLeft)this._sliceLeft=s;else if(_<127&&this._sliceLeft>-1){this._sliceRight=s;break}this._sliceTop=-1,this._sliceBottom=-1;for(var l=0;l<o;l++){var _;if((_=a.data[l*i*4+3])>127&&-1===this._sliceTop)this._sliceTop=l;else if(_<127&&this._sliceTop>-1){this._sliceBottom=l;break}}},Object.defineProperty(e.prototype,"domImage",{get:function(){return this._domImage},set:function(t){var e=this;this._domImage=t,this._loaded=!1,this._imageDataCache.data=null,this._domImage.width?this._onImageLoaded():this._domImage.onload=function(){e._onImageLoaded()}},enumerable:!1,configurable:!0}),e.prototype._onImageLoaded=function(){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()},Object.defineProperty(e.prototype,"source",{get:function(){return this._source},set:function(t){var i,o,n=this;if(this._source!==t){this._removeCacheUsage(this._source),this._loaded=!1,this._source=t,this._imageDataCache.data=null,t&&(t=this._svgCheck(t));var r=(null===(o=null===(i=this._host)||void 0===i?void 0:i.getScene())||void 0===o?void 0:o.getEngine())||h.EngineStore.LastCreatedEngine;if(!r)throw new Error("Invalid engine. Unable to create a canvas.");if(t&&e.SourceImgCache.has(t)){var a=e.SourceImgCache.get(t);return this._domImage=a.img,a.timesUsed+=1,void(a.loaded?this._onImageLoaded():a.waitingForLoadCallback.push(this._onImageLoaded.bind(this)))}this._domImage=r.createCanvasImage(),t&&e.SourceImgCache.set(t,{img:this._domImage,timesUsed:1,loaded:!1,waitingForLoadCallback:[this._onImageLoaded.bind(this)]}),this._domImage.onload=function(){if(t){var i=e.SourceImgCache.get(t);if(i){i.loaded=!0;for(var o=0,r=i.waitingForLoadCallback;o<r.length;o++)(0,r[o])();return void(i.waitingForLoadCallback.length=0)}}n._onImageLoaded()},t&&(h.Tools.SetCorsBehavior(t,this._domImage),h.Tools.SetReferrerPolicyBehavior(this.referrerPolicy,this._domImage),this._domImage.src=t)}},enumerable:!1,configurable:!0}),e.ResetImageCache=function(){e.SourceImgCache.clear()},e.prototype._removeCacheUsage=function(t){var i=t&&e.SourceImgCache.get(t);i&&(i.timesUsed-=1,0===i.timesUsed&&e.SourceImgCache.delete(t))},e.prototype._svgCheck=function(t){var e=this;if(window.SVGSVGElement&&-1!==t.search(/.svg#/gi)&&t.indexOf("#")===t.lastIndexOf("#")){this._isSVG=!0;var i=t.split("#")[0],o=t.split("#")[1],n=document.body.querySelector('object[data="'+i+'"]');if(n){var r=n.contentDocument;if(r&&r.documentElement){var a=r.documentElement.getAttribute("viewBox"),s=Number(r.documentElement.getAttribute("width")),l=Number(r.documentElement.getAttribute("height"));if(r.getElementById(o)&&a&&s&&l)return this._getSVGAttribs(n,o),t}n.addEventListener("load",(function(){e._getSVGAttribs(n,o)}))}else{var _=document.createElement("object");_.data=i,_.type="image/svg+xml",_.width="0%",_.height="0%",document.body.appendChild(_),_.onload=function(){var t=document.body.querySelector('object[data="'+i+'"]');t&&e._getSVGAttribs(t,o)}}return i}return t},e.prototype._getSVGAttribs=function(t,e){var i=t.contentDocument;if(i&&i.documentElement){var o=i.documentElement.getAttribute("viewBox"),n=Number(i.documentElement.getAttribute("width")),r=Number(i.documentElement.getAttribute("height")),a=i.getElementById(e);if(o&&n&&r&&a){var s=Number(o.split(" ")[2]),l=Number(o.split(" ")[3]),_=a.getBBox(),h=1,c=1,u=0,d=0,f=a.transform.baseVal.consolidate().matrix;a.transform&&a.transform.baseVal.consolidate()&&(h=f.a,c=f.d,u=f.e,d=f.f),this.sourceLeft=(h*_.x+u)*n/s,this.sourceTop=(c*_.y+d)*r/l,this.sourceWidth=_.width*h*(n/s),this.sourceHeight=_.height*c*(r/l),this._svgAttributesComputationCompleted=!0,this.onSVGAttributesComputedObservable.notifyObservers(this)}}},Object.defineProperty(e.prototype,"cellWidth",{get:function(){return this._cellWidth},set:function(t){this._cellWidth!==t&&(this._cellWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cellHeight",{get:function(){return this._cellHeight},set:function(t){this._cellHeight!==t&&(this._cellHeight=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cellId",{get:function(){return this._cellId},set:function(t){this._cellId!==t&&(this._cellId=t,this._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype.contains=function(e,i){if(!t.prototype.contains.call(this,e,i))return!1;if(!this._detectPointerOnOpaqueOnly||!this._workingCanvas)return!0;var o=0|this._currentMeasure.width,n=0|this._currentMeasure.height,r=o+"_"+n,a=this._imageDataCache.data;if(!a||this._imageDataCache.key!==r){var s=this._workingCanvas.getContext("2d");this._imageDataCache.data=a=s.getImageData(0,0,o,n).data,this._imageDataCache.key=r}return a[4*((e=e-this._currentMeasure.left|0)+(i=i-this._currentMeasure.top|0)*o)+3]>0},e.prototype._getTypeName=function(){return"Image"},e.prototype.synchronizeSizeWithContent=function(){this._loaded&&(this.width=this._domImage.width+"px",this.height=this._domImage.height+"px")},e.prototype._processMeasures=function(i,o){if(this._loaded)switch(this._stretch){case e.STRETCH_NONE:case e.STRETCH_FILL:case e.STRETCH_UNIFORM:case e.STRETCH_NINE_PATCH:break;case e.STRETCH_EXTEND:this._autoScale&&this.synchronizeSizeWithContent(),this.parent&&this.parent.parent&&(this.parent.adaptWidthToChildren=!0,this.parent.adaptHeightToChildren=!0)}t.prototype._processMeasures.call(this,i,o)},e.prototype._prepareWorkingCanvasForOpaqueDetection=function(){var t,e;if(this._detectPointerOnOpaqueOnly){var i=this._currentMeasure.width,o=this._currentMeasure.height;if(!this._workingCanvas){var n=(null===(e=null===(t=this._host)||void 0===t?void 0:t.getScene())||void 0===e?void 0:e.getEngine())||h.EngineStore.LastCreatedEngine;if(!n)throw new Error("Invalid engine. Unable to create a canvas.");this._workingCanvas=n.createCanvas(i,o)}this._workingCanvas.getContext("2d").clearRect(0,0,i,o)}},e.prototype._drawImage=function(t,e,i,o,n,r,a,s,l){t.drawImage(this._domImage,e,i,o,n,r,a,s,l),this._detectPointerOnOpaqueOnly&&(t=this._workingCanvas.getContext("2d")).drawImage(this._domImage,e,i,o,n,r-this._currentMeasure.left,a-this._currentMeasure.top,s,l)},e.prototype._draw=function(t){var i,o,n,r;if(t.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),-1==this.cellId)i=this._sourceLeft,o=this._sourceTop,n=this._sourceWidth?this._sourceWidth:this._imageWidth,r=this._sourceHeight?this._sourceHeight:this._imageHeight;else{var a=this._domImage.naturalWidth/this.cellWidth,s=this.cellId/a>>0,l=this.cellId%a;i=this.cellWidth*l,o=this.cellHeight*s,n=this.cellWidth,r=this.cellHeight}if(this._prepareWorkingCanvasForOpaqueDetection(),this._applyStates(t),this._loaded)switch(this._stretch){case e.STRETCH_NONE:case e.STRETCH_FILL:this._drawImage(t,i,o,n,r,this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height);break;case e.STRETCH_UNIFORM:var _=this._currentMeasure.width/n,h=this._currentMeasure.height/r,c=Math.min(_,h),u=(this._currentMeasure.width-n*c)/2,d=(this._currentMeasure.height-r*c)/2;this._drawImage(t,i,o,n,r,this._currentMeasure.left+u,this._currentMeasure.top+d,n*c,r*c);break;case e.STRETCH_EXTEND:this._drawImage(t,i,o,n,r,this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height);break;case e.STRETCH_NINE_PATCH:this._renderNinePatch(t)}t.restore()},e.prototype._renderNinePatch=function(t){var e=this._sliceLeft,i=this._sliceTop,o=this._imageHeight-this._sliceBottom,n=this._imageWidth-this._sliceRight,r=this._sliceRight-this._sliceLeft,a=this._sliceBottom-this._sliceTop,s=this._currentMeasure.width-n-e+2,l=this._currentMeasure.height-o-i+2,_=this._currentMeasure.left+e-1,h=this._currentMeasure.top+i-1,c=this._currentMeasure.left+this._currentMeasure.width-n,u=this._currentMeasure.top+this._currentMeasure.height-o;this._drawImage(t,0,0,e,i,this._currentMeasure.left,this._currentMeasure.top,e,i),t.clearRect(_,this._currentMeasure.top,s,i),this._drawImage(t,this._sliceLeft,0,r,i,_,this._currentMeasure.top,s,i),t.clearRect(c,this._currentMeasure.top,n,i),this._drawImage(t,this._sliceRight,0,n,i,c,this._currentMeasure.top,n,i),t.clearRect(this._currentMeasure.left,h,e,l),this._drawImage(t,0,this._sliceTop,e,a,this._currentMeasure.left,h,e,l),t.clearRect(_,h,s,l),this._drawImage(t,this._sliceLeft,this._sliceTop,r,a,_,h,s,l),t.clearRect(c,h,n,l),this._drawImage(t,this._sliceRight,this._sliceTop,n,a,c,h,n,l),t.clearRect(this._currentMeasure.left,u,e,o),this._drawImage(t,0,this._sliceBottom,e,o,this._currentMeasure.left,u,e,o),t.clearRect(_,u,s,o),this._drawImage(t,this.sliceLeft,this._sliceBottom,r,o,_,u,s,o),t.clearRect(c,u,n,o),this._drawImage(t,this._sliceRight,this._sliceBottom,n,o,c,u,n,o)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.onImageLoadedObservable.clear(),this.onSVGAttributesComputedObservable.clear(),this._removeCacheUsage(this._source)},e.SourceImgCache=new Map,e.STRETCH_NONE=0,e.STRETCH_FILL=1,e.STRETCH_UNIFORM=2,e.STRETCH_EXTEND=3,e.STRETCH_NINE_PATCH=4,s([(0,h.serialize)()],e.prototype,"detectPointerOnOpaqueOnly",null),s([(0,h.serialize)()],e.prototype,"sliceLeft",null),s([(0,h.serialize)()],e.prototype,"sliceRight",null),s([(0,h.serialize)()],e.prototype,"sliceTop",null),s([(0,h.serialize)()],e.prototype,"sliceBottom",null),s([(0,h.serialize)()],e.prototype,"sourceLeft",null),s([(0,h.serialize)()],e.prototype,"sourceTop",null),s([(0,h.serialize)()],e.prototype,"sourceWidth",null),s([(0,h.serialize)()],e.prototype,"sourceHeight",null),s([(0,h.serialize)()],e.prototype,"populateNinePatchSlicesFromImage",null),s([(0,h.serialize)()],e.prototype,"autoScale",null),s([(0,h.serialize)()],e.prototype,"stretch",null),s([(0,h.serialize)()],e.prototype,"source",null),s([(0,h.serialize)()],e.prototype,"cellWidth",null),s([(0,h.serialize)()],e.prototype,"cellHeight",null),s([(0,h.serialize)()],e.prototype,"cellId",null),e}(y);(0,h.RegisterClass)("BABYLON.GUI.Image",C);var T=function(t){function e(e){var i=t.call(this,e)||this;i.name=e,i.delegatePickingToChildren=!1,i.thickness=1,i.isPointerBlocker=!0;var o=null;return i.pointerEnterAnimation=function(){o=i.alpha,i.alpha-=.1},i.pointerOutAnimation=function(){null!==o&&(i.alpha=o)},i.pointerDownAnimation=function(){i.scaleX-=.05,i.scaleY-=.05},i.pointerUpAnimation=function(){i.scaleX+=.05,i.scaleY+=.05},i}return r(e,t),Object.defineProperty(e.prototype,"image",{get:function(){return this._image},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textBlock",{get:function(){return this._textBlock},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"Button"},e.prototype._processPicking=function(e,i,o,n,r,a,s,l){if(!this._isEnabled||!this.isHitTestVisible||!this.isVisible||this.notRenderable)return!1;if(!t.prototype.contains.call(this,e,i))return!1;if(this.delegatePickingToChildren){for(var _=!1,h=this._children.length-1;h>=0;h--){var c=this._children[h];if(c.isEnabled&&c.isHitTestVisible&&c.isVisible&&!c.notRenderable&&c.contains(e,i)){_=!0;break}}if(!_)return!1}return this._processObservables(n,e,i,o,r,a,s,l),!0},e.prototype._onPointerEnter=function(e,i){return!!t.prototype._onPointerEnter.call(this,e,i)&&(!this.isReadOnly&&this.pointerEnterAnimation&&this.pointerEnterAnimation(),!0)},e.prototype._onPointerOut=function(e,i,o){void 0===o&&(o=!1),!this.isReadOnly&&this.pointerOutAnimation&&this.pointerOutAnimation(),t.prototype._onPointerOut.call(this,e,i,o)},e.prototype._onPointerDown=function(e,i,o,n,r){return!!t.prototype._onPointerDown.call(this,e,i,o,n,r)&&(!this.isReadOnly&&this.pointerDownAnimation&&this.pointerDownAnimation(),!0)},e.prototype._getRectangleFill=function(t){return this.isEnabled?this._getBackgroundColor(t):this._disabledColor},e.prototype._onPointerUp=function(e,i,o,n,r,a){!this.isReadOnly&&this.pointerUpAnimation&&this.pointerUpAnimation(),t.prototype._onPointerUp.call(this,e,i,o,n,r,a)},e.prototype.serialize=function(e){t.prototype.serialize.call(this,e),this._textBlock&&(e.textBlockName=this._textBlock.name),this._image&&(e.imageName=this._image.name)},e.prototype._parseFromContent=function(e,i){t.prototype._parseFromContent.call(this,e,i),e.textBlockName&&(this._textBlock=this.getChildByName(e.textBlockName)),e.imageName&&(this._image=this.getChildByName(e.imageName))},e.CreateImageButton=function(t,e,i){var o=new this(t),n=new B(t+"_button",e);n.textWrapping=!0,n.textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_CENTER,n.paddingLeft="20%",o.addControl(n);var r=new C(t+"_icon",i);return r.width="20%",r.stretch=C.STRETCH_UNIFORM,r.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,o.addControl(r),o._image=r,o._textBlock=n,o},e.CreateImageOnlyButton=function(t,e){var i=new this(t),o=new C(t+"_icon",e);return o.stretch=C.STRETCH_FILL,o.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,i.addControl(o),i._image=o,i},e.CreateSimpleButton=function(t,e){var i=new this(t),o=new B(t+"_button",e);return o.textWrapping=!0,o.textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_CENTER,i.addControl(o),i._textBlock=o,i},e.CreateImageWithCenterTextButton=function(t,e,i){var o=new this(t),n=new C(t+"_icon",i);n.stretch=C.STRETCH_FILL,o.addControl(n);var r=new B(t+"_button",e);return r.textWrapping=!0,r.textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_CENTER,o.addControl(r),o._image=n,o._textBlock=r,o},e}(I);(0,h.RegisterClass)("BABYLON.GUI.Button",T);var S=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._isVertical=!0,i._manualWidth=!1,i._manualHeight=!1,i._doNotTrackManualChanges=!1,i._spacing=0,i.ignoreLayoutWarnings=!1,i}return r(e,t),Object.defineProperty(e.prototype,"isVertical",{get:function(){return this._isVertical},set:function(t){this._isVertical!==t&&(this._isVertical=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"spacing",{get:function(){return this._spacing},set:function(t){this._spacing!==t&&(this._spacing=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this._width.toString(this._host)},set:function(t){this._doNotTrackManualChanges||(this._manualWidth=!0),this._width.toString(this._host)!==t&&this._width.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height.toString(this._host)},set:function(t){this._doNotTrackManualChanges||(this._manualHeight=!0),this._height.toString(this._host)!==t&&this._height.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"StackPanel"},e.prototype._preMeasure=function(e,i){for(var o=0,n=this._children;o<n.length;o++){var r=n[o];this._isVertical?r.verticalAlignment=y.VERTICAL_ALIGNMENT_TOP:r.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT}t.prototype._preMeasure.call(this,e,i)},e.prototype._additionalProcessing=function(e,i){t.prototype._additionalProcessing.call(this,e,i),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)},e.prototype._postMeasure=function(){for(var e=0,i=0,o=this._children.length,n=0;n<o;n++){var r=this._children[n];r.isVisible&&!r.notRenderable&&(this._isVertical?(r.top!==i+"px"&&(r.top=i+"px",this._rebuildLayout=!0,r._top.ignoreAdaptiveScaling=!0),r._height.isPercentage&&!r._automaticSize?this.ignoreLayoutWarnings||h.Tools.Warn("Control (Name:".concat(r.name,", UniqueId:").concat(r.uniqueId,") is using height in percentage mode inside a vertical StackPanel")):i+=r._currentMeasure.height+r._paddingTopInPixels+r._paddingBottomInPixels+(n<o-1?this._spacing:0)):(r.left!==e+"px"&&(r.left=e+"px",this._rebuildLayout=!0,r._left.ignoreAdaptiveScaling=!0),!r._width.isPercentage||r._automaticSize||"TextBlock"!==r.getClassName()||r.textWrapping===P.Clip||r.forceResizeWidth?e+=r._currentMeasure.width+r._paddingLeftInPixels+r._paddingRightInPixels+(n<o-1?this._spacing:0):this.ignoreLayoutWarnings||h.Tools.Warn("Control (Name:".concat(r.name,", UniqueId:").concat(r.uniqueId,") is using width in percentage mode inside a horizontal StackPanel"))))}e+=this._paddingLeftInPixels+this._paddingRightInPixels,i+=this._paddingTopInPixels+this._paddingBottomInPixels,this._doNotTrackManualChanges=!0;var a=!1,s=!1;if((!this._manualHeight||this.adaptHeightToChildren)&&this._isVertical){var l=this.height;this.height=i+"px",s=l!==this.height||!this._height.ignoreAdaptiveScaling}if((!this._manualWidth||this.adaptWidthToChildren)&&!this._isVertical){var _=this.width;this.width=e+"px",a=_!==this.width||!this._width.ignoreAdaptiveScaling}s&&(this._height.ignoreAdaptiveScaling=!0),a&&(this._width.ignoreAdaptiveScaling=!0),this._doNotTrackManualChanges=!1,(a||s)&&(this._rebuildLayout=!0),t.prototype._postMeasure.call(this)},e.prototype.serialize=function(e){t.prototype.serialize.call(this,e),e.manualWidth=this._manualWidth,e.manualHeight=this._manualHeight},e.prototype._parseFromContent=function(e,i){this._manualWidth=e.manualWidth,this._manualHeight=e.manualHeight,t.prototype._parseFromContent.call(this,e,i)},s([(0,h.serialize)()],e.prototype,"ignoreLayoutWarnings",void 0),s([(0,h.serialize)()],e.prototype,"isVertical",null),s([(0,h.serialize)()],e.prototype,"spacing",null),s([(0,h.serialize)()],e.prototype,"width",null),s([(0,h.serialize)()],e.prototype,"height",null),e}(x);(0,h.RegisterClass)("BABYLON.GUI.StackPanel",S);var O=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._isChecked=!1,i._background="black",i._checkSizeRatio=.8,i._thickness=1,i.onIsCheckedChangedObservable=new h.Observable,i.isPointerBlocker=!0,i}return r(e,t),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness!==t&&(this._thickness=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"checkSizeRatio",{get:function(){return this._checkSizeRatio},set:function(t){t=Math.max(Math.min(1,t),0),this._checkSizeRatio!==t&&(this._checkSizeRatio=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isChecked",{get:function(){return this._isChecked},set:function(t){this._isChecked!==t&&(this._isChecked=t,this._markAsDirty(),this.onIsCheckedChangedObservable.notifyObservers(t))},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"Checkbox"},e.prototype._draw=function(t){t.save(),this._applyStates(t);var e=this._currentMeasure.width-this._thickness,i=this._currentMeasure.height-this._thickness;if((this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),t.fillStyle=this._isEnabled?this._background:this._disabledColor,t.fillRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,e,i),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),this._isChecked){t.fillStyle=this._isEnabled?this.color:this._disabledColorItem;var o=e*this._checkSizeRatio,n=i*this._checkSizeRatio;t.fillRect(this._currentMeasure.left+this._thickness/2+(e-o)/2,this._currentMeasure.top+this._thickness/2+(i-n)/2,o,n)}t.strokeStyle=this.color,t.lineWidth=this._thickness,t.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,e,i),t.restore()},e.prototype._onPointerDown=function(e,i,o,n,r){return!!t.prototype._onPointerDown.call(this,e,i,o,n,r)&&(this.isReadOnly||(this.isChecked=!this.isChecked),!0)},e.AddCheckBoxWithHeader=function(t,i){var o=new S;o.isVertical=!1,o.height="30px";var n=new e;n.width="20px",n.height="20px",n.isChecked=!0,n.color="green",n.onIsCheckedChangedObservable.add(i),o.addControl(n);var r=new B;return r.text=t,r.width="180px",r.paddingLeft="5px",r.textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,r.color="white",o.addControl(r),o},s([(0,h.serialize)()],e.prototype,"thickness",null),s([(0,h.serialize)()],e.prototype,"checkSizeRatio",null),s([(0,h.serialize)()],e.prototype,"background",null),s([(0,h.serialize)()],e.prototype,"isChecked",null),e}(y);(0,h.RegisterClass)("BABYLON.GUI.Checkbox",O);var R=function(){function t(){}return Object.defineProperty(t.prototype,"text",{get:function(){return this._characters?this._characters.join(""):this._text},set:function(t){this._text=t,this._characters=Array.from&&Array.from(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this._characters?this._characters.length:this._text.length},enumerable:!1,configurable:!0}),t.prototype.removePart=function(t,e,i){var o;if(this._text=this._text.slice(0,t)+(i||"")+this._text.slice(e),this._characters){var n=i?Array.from(i):[];(o=this._characters).splice.apply(o,function(t,e,i){if(i||2===arguments.length)for(var o,n=0,r=e.length;n<r;n++)!o&&n in e||(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return t.concat(o||Array.prototype.slice.call(e))}([t,e-t],n,!1))}},t.prototype.charAt=function(t){return this._characters?this._characters[t]:this._text.charAt(t)},t.prototype.substr=function(t,e){if(this._characters){t=isNaN(t)?0:t>=0?Math.min(t,this._characters.length):this._characters.length+Math.max(t,-this._characters.length),void 0===e?e=this._characters.length-t:(isNaN(e)||e<0)&&(e=0);for(var i=[];--e>=0;)i[e]=this._characters[t+e];return i.join("")}return this._text.substr(t,e)},t.prototype.substring=function(t,e){if(this._characters){isNaN(t)?t=0:t>this._characters.length?t=this._characters.length:t<0&&(t=0),void 0===e?e=this._characters.length:isNaN(e)?e=0:e>this._characters.length?e=this._characters.length:e<0&&(e=0);for(var i=[],o=0;t<e;)i[o++]=this._characters[t++];return i.join("")}return this._text.substring(t,e)},t.prototype.isWord=function(t){var e=/\w/g;return this._characters?-1!==this._characters[t].search(e):-1!==this._text.search(e)},t}(),w=function(t){function e(e,i){void 0===i&&(i="");var o=t.call(this,e)||this;return o.name=e,o._placeholderText="",o._background="#222222",o._focusedBackground="#000000",o._focusedColor="white",o._placeholderColor="gray",o._thickness=1,o._margin=new c(10,c.UNITMODE_PIXEL),o._autoStretchWidth=!0,o._maxWidth=new c(1,c.UNITMODE_PERCENTAGE,!1),o._isFocused=!1,o._blinkIsEven=!1,o._cursorOffset=0,o._deadKey=!1,o._addKey=!0,o._currentKey="",o._isTextHighlightOn=!1,o._textHighlightColor="#d5e0ff",o._highligherOpacity=.4,o._highlightedText="",o._startHighlightIndex=0,o._endHighlightIndex=0,o._cursorIndex=-1,o._onFocusSelectAll=!1,o._isPointerDown=!1,o.promptMessage="Please enter text:",o.disableMobilePrompt=!1,o.onTextChangedObservable=new h.Observable,o.onBeforeKeyAddObservable=new h.Observable,o.onFocusObservable=new h.Observable,o.onBlurObservable=new h.Observable,o.onTextHighlightObservable=new h.Observable,o.onTextCopyObservable=new h.Observable,o.onTextCutObservable=new h.Observable,o.onTextPasteObservable=new h.Observable,o.onKeyboardEventProcessedObservable=new h.Observable,o.text=i,o.isPointerBlocker=!0,o}return r(e,t),Object.defineProperty(e.prototype,"maxWidth",{get:function(){return this._maxWidth.toString(this._host)},set:function(t){this._maxWidth.toString(this._host)!==t&&this._maxWidth.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxWidthInPixels",{get:function(){return this._maxWidth.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"highligherOpacity",{get:function(){return this._highligherOpacity},set:function(t){this._highligherOpacity!==t&&(this._highligherOpacity=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onFocusSelectAll",{get:function(){return this._onFocusSelectAll},set:function(t){this._onFocusSelectAll!==t&&(this._onFocusSelectAll=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textHighlightColor",{get:function(){return this._textHighlightColor},set:function(t){this._textHighlightColor!==t&&(this._textHighlightColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"margin",{get:function(){return this._margin.toString(this._host)},set:function(t){this._margin.toString(this._host)!==t&&this._margin.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"marginInPixels",{get:function(){return this._margin.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"autoStretchWidth",{get:function(){return this._autoStretchWidth},set:function(t){this._autoStretchWidth!==t&&(this._autoStretchWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness!==t&&(this._thickness=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"focusedBackground",{get:function(){return this._focusedBackground},set:function(t){this._focusedBackground!==t&&(this._focusedBackground=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"focusedColor",{get:function(){return this._focusedColor},set:function(t){this._focusedColor!==t&&(this._focusedColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"placeholderColor",{get:function(){return this._placeholderColor},set:function(t){this._placeholderColor!==t&&(this._placeholderColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"placeholderText",{get:function(){return this._placeholderText},set:function(t){this._placeholderText!==t&&(this._placeholderText=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"deadKey",{get:function(){return this._deadKey},set:function(t){this._deadKey=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"highlightedText",{get:function(){return this._highlightedText},set:function(t){this._highlightedText!==t&&(this._highlightedText=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"addKey",{get:function(){return this._addKey},set:function(t){this._addKey=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentKey",{get:function(){return this._currentKey},set:function(t){this._currentKey=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._textWrapper.text},set:function(t){var e=t.toString();this._textWrapper||(this._textWrapper=new R),this._textWrapper.text!==e&&(this._textWrapper.text=e,this._textHasChanged())},enumerable:!1,configurable:!0}),e.prototype._textHasChanged=function(){this._markAsDirty(),this.onTextChangedObservable.notifyObservers(this)},Object.defineProperty(e.prototype,"width",{get:function(){return this._width.toString(this._host)},set:function(t){this._width.toString(this._host)!==t&&(this._width.fromString(t)&&this._markAsDirty(),this.autoStretchWidth=!1)},enumerable:!1,configurable:!0}),e.prototype.onBlur=function(){this._isFocused=!1,this._scrollLeft=null,this._cursorOffset=0,clearTimeout(this._blinkTimeout),this._markAsDirty(),this.onBlurObservable.notifyObservers(this),this._host.unRegisterClipboardEvents(),this._onClipboardObserver&&this._host.onClipboardObservable.remove(this._onClipboardObserver);var t=this._host.getScene();this._onPointerDblTapObserver&&t&&t.onPointerObservable.remove(this._onPointerDblTapObserver)},e.prototype.onFocus=function(){var t=this;if(this._isEnabled){if(this._scrollLeft=null,this._isFocused=!0,this._blinkIsEven=!1,this._cursorOffset=0,this._markAsDirty(),this.onFocusObservable.notifyObservers(this),"touch"===this._focusedBy&&!this.disableMobilePrompt){var e=prompt(this.promptMessage);return null!==e&&(this.text=e),void(this._host.focusedControl=null)}this._host.registerClipboardEvents(),this._onClipboardObserver=this._host.onClipboardObservable.add((function(e){switch(e.type){case h.ClipboardEventTypes.COPY:t._onCopyText(e.event),t.onTextCopyObservable.notifyObservers(t);break;case h.ClipboardEventTypes.CUT:t._onCutText(e.event),t.onTextCutObservable.notifyObservers(t);break;case h.ClipboardEventTypes.PASTE:t._onPasteText(e.event),t.onTextPasteObservable.notifyObservers(t);break;default:return}}));var i=this._host.getScene();i&&(this._onPointerDblTapObserver=i.onPointerObservable.add((function(e){t._isFocused&&e.type===h.PointerEventTypes.POINTERDOUBLETAP&&t._processDblClick(e)}))),this._onFocusSelectAll&&this._selectAllText()}},e.prototype.focus=function(){this._host.moveFocusToControl(this)},e.prototype.blur=function(){this._host.focusedControl=null},e.prototype._getTypeName=function(){return"InputText"},e.prototype.keepsFocusWith=function(){return this._connectedVirtualKeyboard?[this._connectedVirtualKeyboard]:null},e.prototype.processKey=function(t,e,i){var o;if(!this.isReadOnly&&(!i||!i.ctrlKey&&!i.metaKey||67!==t&&86!==t&&88!==t)){if(i&&(i.ctrlKey||i.metaKey)&&65===t)return this._selectAllText(),void i.preventDefault();switch(t){case 32:e=" ";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());0===this._cursorOffset?this.text=this._textWrapper.substr(0,this._textWrapper.length-1):(n=this._textWrapper.length-this._cursorOffset)>0&&(this._textWrapper.removePart(n-1,n),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){var n=this._textWrapper.length-this._cursorOffset;this._textWrapper.removePart(n,n+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._cursorIndex<this._cursorOffset?(this._endHighlightIndex=this._textWrapper.length-this._cursorIndex,this._startHighlightIndex=this._textWrapper.length-this._cursorOffset):this._cursorIndex>this._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._cursorIndex<this._cursorOffset?(this._endHighlightIndex=this._textWrapper.length-this._cursorIndex,this._startHighlightIndex=this._textWrapper.length-this._cursorOffset):this._cursorIndex>this._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===t&&(e=null!==(o=null==i?void 0:i.key)&&void 0!==o?o:" "),this._deadKey="Dead"===e,e&&(-1===t||32===t||34===t||39===t||t>47&&t<64||t>64&&t<91||t>159&&t<193||t>218&&t<223||t>95&&t<112)&&(this._currentKey=e,this.onBeforeKeyAddObservable.notifyObservers(this),e=this._currentKey,this._addKey&&!this._deadKey))if(this.isTextHighlightOn)this._textWrapper.removePart(this._startHighlightIndex,this._endHighlightIndex,e),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:e;else{var r=this._textWrapper.length-this._cursorOffset;this._textWrapper.removePart(r,r,e),this._textHasChanged()}}},e.prototype._updateValueFromCursorIndex=function(t){if(this._blinkIsEven=!1,-1===this._cursorIndex)this._cursorIndex=t;else if(this._cursorIndex<this._cursorOffset)this._endHighlightIndex=this._textWrapper.length-this._cursorIndex,this._startHighlightIndex=this._textWrapper.length-this._cursorOffset;else{if(!(this._cursorIndex>this._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()},e.prototype._processDblClick=function(t){var e,i;this._startHighlightIndex=this._textWrapper.length-this._cursorOffset,this._endHighlightIndex=this._startHighlightIndex;do{i=this._endHighlightIndex<this._textWrapper.length&&this._textWrapper.isWord(this._endHighlightIndex)?++this._endHighlightIndex:0,e=this._startHighlightIndex>0&&this._textWrapper.isWord(this._startHighlightIndex-1)?--this._startHighlightIndex:0}while(e||i);this._cursorOffset=this._textWrapper.length-this._startHighlightIndex,this.isTextHighlightOn=!0,this._clickedCoordinate=null,this._blinkIsEven=!0,this._cursorIndex=-1,this._markAsDirty()},e.prototype._selectAllText=function(){this._blinkIsEven=!0,this.isTextHighlightOn=!0,this._startHighlightIndex=0,this._endHighlightIndex=this._textWrapper.length,this._cursorOffset=this._textWrapper.length,this._cursorIndex=-1,this._markAsDirty()},e.prototype.processKeyboard=function(t){this.processKey(t.keyCode,t.key,t),this.onKeyboardEventProcessedObservable.notifyObservers(t)},e.prototype._onCopyText=function(t){this.isTextHighlightOn=!1;try{t.clipboardData&&t.clipboardData.setData("text/plain",this._highlightedText)}catch(t){}this._host.clipboardData=this._highlightedText},e.prototype._onCutText=function(t){if(this._highlightedText){this._textWrapper.removePart(this._startHighlightIndex,this._endHighlightIndex),this._textHasChanged(),this.isTextHighlightOn=!1,this._cursorOffset=this._textWrapper.length-this._startHighlightIndex;try{t.clipboardData&&t.clipboardData.setData("text/plain",this._highlightedText)}catch(t){}this._host.clipboardData=this._highlightedText,this._highlightedText=""}},e.prototype._onPasteText=function(t){var e;e=t.clipboardData&&-1!==t.clipboardData.types.indexOf("text/plain")?t.clipboardData.getData("text/plain"):this._host.clipboardData;var i=this._textWrapper.length-this._cursorOffset;this._textWrapper.removePart(i,i,e),this._textHasChanged()},e.prototype._draw=function(t){var e=this;t.save(),this._applyStates(t),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),this._isFocused?this._focusedBackground&&(t.fillStyle=this._isEnabled?this._focusedBackground:this._disabledColor,t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)):this._background&&(t.fillStyle=this._isEnabled?this._background:this._disabledColor,t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),this._fontOffset&&!this._wasDirty||(this._fontOffset=y._GetFontOffset(t.font));var i=this._currentMeasure.left+this._margin.getValueInPixel(this._host,this._tempParentMeasure.width);this.color&&(t.fillStyle=this.color);var o=this._beforeRenderText(this._textWrapper);this._isFocused||this._textWrapper.text||!this._placeholderText||((o=new R).text=this._placeholderText,this._placeholderColor&&(t.fillStyle=this._placeholderColor)),this._textWidth=t.measureText(o.text).width;var 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);var r=this._fontOffset.ascent+(this._currentMeasure.height-this._fontOffset.height)/2,a=this._width.getValueInPixel(this._host,this._tempParentMeasure.width)-n;if(t.save(),t.beginPath(),t.rect(i,this._currentMeasure.top+(this._currentMeasure.height-this._fontOffset.height)/2,a+2,this._currentMeasure.height),t.clip(),this._isFocused&&this._textWidth>a){var s=i-this._textWidth+a;this._scrollLeft||(this._scrollLeft=s)}else this._scrollLeft=i;if(t.fillText(o.text,this._scrollLeft,this._currentMeasure.top+r),this._isFocused){if(this._clickedCoordinate){var l=this._scrollLeft+this._textWidth-this._clickedCoordinate,_=0;this._cursorOffset=0;var h=0;do{this._cursorOffset&&(h=Math.abs(l-_)),this._cursorOffset++,_=t.measureText(o.substr(o.length-this._cursorOffset,this._cursorOffset)).width}while(_<l&&o.length>=this._cursorOffset);Math.abs(l-_)>h&&this._cursorOffset--,this._blinkIsEven=!1,this._clickedCoordinate=null}if(!this._blinkIsEven){var c=o.substr(o.length-this._cursorOffset),u=t.measureText(c).width,d=this._scrollLeft+this._textWidth-u;d<i?(this._scrollLeft+=i-d,d=i,this._markAsDirty()):d>i+a&&(this._scrollLeft+=i+a-d,d=i+a,this._markAsDirty()),this.isTextHighlightOn||t.fillRect(d,this._currentMeasure.top+(this._currentMeasure.height-this._fontOffset.height)/2,2,this._fontOffset.height)}if(clearTimeout(this._blinkTimeout),this._blinkTimeout=setTimeout((function(){e._blinkIsEven=!e._blinkIsEven,e._markAsDirty()}),500),this.isTextHighlightOn){clearTimeout(this._blinkTimeout);var f=t.measureText(o.substring(this._startHighlightIndex)).width,p=this._scrollLeft+this._textWidth-f;this._highlightedText=o.substring(this._startHighlightIndex,this._endHighlightIndex);var g=t.measureText(o.substring(this._startHighlightIndex,this._endHighlightIndex)).width;p<i&&((g-=i-p)||(g=t.measureText(o.charAt(o.length-this._cursorOffset)).width),p=i),t.globalAlpha=this._highligherOpacity,t.fillStyle=this._textHighlightColor,t.fillRect(p,this._currentMeasure.top+(this._currentMeasure.height-this._fontOffset.height)/2,g,this._fontOffset.height),t.globalAlpha=1}}t.restore(),this._thickness&&(this._isFocused?this.focusedColor&&(t.strokeStyle=this.focusedColor):this.color&&(t.strokeStyle=this.color),t.lineWidth=this._thickness,t.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,this._currentMeasure.width-this._thickness,this._currentMeasure.height-this._thickness)),t.restore()},e.prototype._onPointerDown=function(e,i,o,n,r){return!(!t.prototype._onPointerDown.call(this,e,i,o,n,r)||!this.isReadOnly&&(this._clickedCoordinate=i.x,this.isTextHighlightOn=!1,this._highlightedText="",this._cursorIndex=-1,this._isPointerDown=!0,this._host._capturingControl[o]=this,this._focusedBy=r.event.pointerType,this._host.focusedControl===this?(clearTimeout(this._blinkTimeout),this._markAsDirty(),0):!this._isEnabled||(this._host.focusedControl=this,0)))},e.prototype._onPointerMove=function(e,i,o,n){this._host.focusedControl===this&&this._isPointerDown&&!this.isReadOnly&&(this._clickedCoordinate=i.x,this._markAsDirty(),this._updateValueFromCursorIndex(this._cursorOffset)),t.prototype._onPointerMove.call(this,e,i,o,n)},e.prototype._onPointerUp=function(e,i,o,n,r){this._isPointerDown=!1,delete this._host._capturingControl[o],t.prototype._onPointerUp.call(this,e,i,o,n,r)},e.prototype._beforeRenderText=function(t){return t},Object.defineProperty(e.prototype,"isTextHighlightOn",{get:function(){return this._isTextHighlightOn},set:function(t){this._isTextHighlightOn!==t&&(t&&this.onTextHighlightObservable.notifyObservers(this),this._isTextHighlightOn=t)},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){t.prototype.dispose.call(this),this.onBlurObservable.clear(),this.onFocusObservable.clear(),this.onTextChangedObservable.clear(),this.onTextCopyObservable.clear(),this.onTextCutObservable.clear(),this.onTextPasteObservable.clear(),this.onTextHighlightObservable.clear(),this.onKeyboardEventProcessedObservable.clear()},s([(0,h.serialize)()],e.prototype,"promptMessage",void 0),s([(0,h.serialize)()],e.prototype,"disableMobilePrompt",void 0),s([(0,h.serialize)()],e.prototype,"maxWidth",null),s([(0,h.serialize)()],e.prototype,"highligherOpacity",null),s([(0,h.serialize)()],e.prototype,"onFocusSelectAll",null),s([(0,h.serialize)()],e.prototype,"textHighlightColor",null),s([(0,h.serialize)()],e.prototype,"margin",null),s([(0,h.serialize)()],e.prototype,"autoStretchWidth",null),s([(0,h.serialize)()],e.prototype,"thickness",null),s([(0,h.serialize)()],e.prototype,"focusedBackground",null),s([(0,h.serialize)()],e.prototype,"focusedColor",null),s([(0,h.serialize)()],e.prototype,"background",null),s([(0,h.serialize)()],e.prototype,"placeholderColor",null),s([(0,h.serialize)()],e.prototype,"placeholderText",null),s([(0,h.serialize)()],e.prototype,"deadKey",null),s([(0,h.serialize)()],e.prototype,"text",null),s([(0,h.serialize)()],e.prototype,"width",null),e}(y);(0,h.RegisterClass)("BABYLON.GUI.InputText",w);var M=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._rowDefinitions=new Array,i._rowDefinitionObservers=[],i._columnDefinitions=new Array,i._columnDefinitionObservers=[],i._cells={},i._childControls=new Array,i}return r(e,t),Object.defineProperty(e.prototype,"columnCount",{get:function(){return this._columnDefinitions.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rowCount",{get:function(){return this._rowDefinitions.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"children",{get:function(){return this._childControls},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cells",{get:function(){return this._cells},enumerable:!1,configurable:!0}),e.prototype.getRowDefinition=function(t){return t<0||t>=this._rowDefinitions.length?null:this._rowDefinitions[t]},e.prototype.getColumnDefinition=function(t){return t<0||t>=this._columnDefinitions.length?null:this._columnDefinitions[t]},e.prototype.addRowDefinition=function(t,e){var i=this;return void 0===e&&(e=!1),this._rowDefinitions.push(new c(t,e?c.UNITMODE_PIXEL:c.UNITMODE_PERCENTAGE)),this._rowDefinitionObservers.push(this._rowDefinitions[this.rowCount-1].onChangedObservable.add((function(){return i._markAsDirty()}))),this._markAsDirty(),this},e.prototype.addColumnDefinition=function(t,e){var i=this;return void 0===e&&(e=!1),this._columnDefinitions.push(new c(t,e?c.UNITMODE_PIXEL:c.UNITMODE_PERCENTAGE)),this._columnDefinitionObservers.push(this._columnDefinitions[this.columnCount-1].onChangedObservable.add((function(){return i._markAsDirty()}))),this._markAsDirty(),this},e.prototype.setRowDefinition=function(t,e,i){var o=this;if(void 0===i&&(i=!1),t<0||t>=this._rowDefinitions.length)return this;var n=this._rowDefinitions[t];return n&&n.isPixel===i&&n.value===e||(this._rowDefinitions[t].onChangedObservable.remove(this._rowDefinitionObservers[t]),this._rowDefinitions[t]=new c(e,i?c.UNITMODE_PIXEL:c.UNITMODE_PERCENTAGE),this._rowDefinitionObservers[t]=this._rowDefinitions[t].onChangedObservable.add((function(){return o._markAsDirty()})),this._markAsDirty()),this},e.prototype.setColumnDefinition=function(t,e,i){var o=this;if(void 0===i&&(i=!1),t<0||t>=this._columnDefinitions.length)return this;var n=this._columnDefinitions[t];return n&&n.isPixel===i&&n.value===e||(this._columnDefinitions[t].onChangedObservable.remove(this._columnDefinitionObservers[t]),this._columnDefinitions[t]=new c(e,i?c.UNITMODE_PIXEL:c.UNITMODE_PERCENTAGE),this._columnDefinitionObservers[t]=this._columnDefinitions[t].onChangedObservable.add((function(){return o._markAsDirty()})),this._markAsDirty()),this},e.prototype.getChildrenAt=function(t,e){var i=this._cells["".concat(t,":").concat(e)];return i?i.children:null},e.prototype.getChildCellInfo=function(t){return t._tag},e.prototype._removeCell=function(e,i){if(e){t.prototype.removeControl.call(this,e);for(var o=0,n=e.children;o<n.length;o++){var r=n[o],a=this._childControls.indexOf(r);-1!==a&&this._childControls.splice(a,1)}delete this._cells[i]}},e.prototype._offsetCell=function(t,e){if(this._cells[e]){this._cells[t]=this._cells[e];for(var i=0,o=this._cells[t].children;i<o.length;i++)o[i]._tag=t;delete this._cells[e]}},e.prototype.removeColumnDefinition=function(t){if(t<0||t>=this._columnDefinitions.length)return this;for(var e=0;e<this._rowDefinitions.length;e++){var i="".concat(e,":").concat(t),o=this._cells[i];this._removeCell(o,i)}for(e=0;e<this._rowDefinitions.length;e++)for(var n=t+1;n<this._columnDefinitions.length;n++){var r="".concat(e,":").concat(n-1);i="".concat(e,":").concat(n),this._offsetCell(r,i)}return this._columnDefinitions[t].onChangedObservable.remove(this._columnDefinitionObservers[t]),this._columnDefinitions.splice(t,1),this._columnDefinitionObservers.splice(t,1),this._markAsDirty(),this},e.prototype.removeRowDefinition=function(t){if(t<0||t>=this._rowDefinitions.length)return this;for(var e=0;e<this._columnDefinitions.length;e++){var i="".concat(t,":").concat(e),o=this._cells[i];this._removeCell(o,i)}for(e=0;e<this._columnDefinitions.length;e++)for(var n=t+1;n<this._rowDefinitions.length;n++){var r="".concat(n-1,":").concat(e);i="".concat(n,":").concat(e),this._offsetCell(r,i)}return this._rowDefinitions[t].onChangedObservable.remove(this._rowDefinitionObservers[t]),this._rowDefinitions.splice(t,1),this._rowDefinitionObservers.splice(t,1),this._markAsDirty(),this},e.prototype.addControl=function(e,i,o){if(void 0===i&&(i=0),void 0===o&&(o=0),0===this._rowDefinitions.length&&this.addRowDefinition(1,!1),0===this._columnDefinitions.length&&this.addColumnDefinition(1,!1),-1!==this._childControls.indexOf(e))return h.Tools.Warn("Control (Name:".concat(e.name,", UniqueId:").concat(e.uniqueId,") is already associated with this grid. You must remove it before reattaching it")),this;var n=Math.min(i,this._rowDefinitions.length-1),r=Math.min(o,this._columnDefinitions.length-1),a="".concat(n,":").concat(r),s=this._cells[a];return s||(s=new x(a),this._cells[a]=s,s.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,s.verticalAlignment=y.VERTICAL_ALIGNMENT_TOP,t.prototype.addControl.call(this,s)),s.addControl(e),this._childControls.push(e),e._tag=a,e.parent=this,this._markAsDirty(),this},e.prototype.removeControl=function(t){var e=this._childControls.indexOf(t);-1!==e&&this._childControls.splice(e,1);var i=this._cells[t._tag];return i&&(i.removeControl(t),t._tag=null),this._markAsDirty(),this},e.prototype._getTypeName=function(){return"Grid"},e.prototype._getGridDefinitions=function(t){for(var e=[],i=[],o=[],n=[],r=this._currentMeasure.width,a=0,s=this._currentMeasure.height,l=0,_=0,h=0,c=this._rowDefinitions;h<c.length;h++)(g=c[h]).isPixel?(s-=p=g.getValue(this._host),i[_]=p):l+=g.value,_++;var u=0;_=0;for(var d=0,f=this._rowDefinitions;d<f.length;d++){var p,g=f[d];n.push(u),g.isPixel?u+=g.getValue(this._host):(u+=p=g.value/l*s,i[_]=p),_++}_=0;for(var b=0,m=this._columnDefinitions;b<m.length;b++)(I=m[b]).isPixel?(r-=P=I.getValue(this._host),e[_]=P):a+=I.value,_++;var v=0;_=0;for(var y=0,x=this._columnDefinitions;y<x.length;y++){var P,I=x[y];o.push(v),I.isPixel?v+=I.getValue(this._host):(v+=P=I.value/a*r,e[_]=P),_++}t(o,n,e,i)},e.prototype._additionalProcessing=function(e,i){var o=this;this._getGridDefinitions((function(t,e,i,n){for(var r in o._cells)if(Object.prototype.hasOwnProperty.call(o._cells,r)){var a=r.split(":"),s=parseInt(a[0]),l=parseInt(a[1]),_=o._cells[r];_.left=t[l]+"px",_.top=e[s]+"px",_.width=i[l]+"px",_.height=n[s]+"px",_._left.ignoreAdaptiveScaling=!0,_._top.ignoreAdaptiveScaling=!0,_._width.ignoreAdaptiveScaling=!0,_._height.ignoreAdaptiveScaling=!0}})),t.prototype._additionalProcessing.call(this,e,i)},e.prototype._flagDescendantsAsMatrixDirty=function(){for(var t in this._cells)Object.prototype.hasOwnProperty.call(this._cells,t)&&this._cells[t]._markMatrixAsDirty()},e.prototype._renderHighlightSpecific=function(e){var i=this;t.prototype._renderHighlightSpecific.call(this,e),this._getGridDefinitions((function(t,o,n,r){for(var a=0;a<t.length;a++){var s=i._currentMeasure.left+t[a]+n[a];e.beginPath(),e.moveTo(s,i._currentMeasure.top),e.lineTo(s,i._currentMeasure.top+i._currentMeasure.height),e.stroke()}for(a=0;a<o.length;a++){var l=i._currentMeasure.top+o[a]+r[a];e.beginPath(),e.moveTo(i._currentMeasure.left,l),e.lineTo(i._currentMeasure.left+i._currentMeasure.width,l),e.stroke()}})),e.restore()},e.prototype.dispose=function(){t.prototype.dispose.call(this);for(var e=0,i=this._childControls;e<i.length;e++)i[e].dispose();for(var o=0;o<this._rowDefinitions.length;o++)this._rowDefinitions[o].onChangedObservable.remove(this._rowDefinitionObservers[o]);for(o=0;o<this._columnDefinitions.length;o++)this._columnDefinitions[o].onChangedObservable.remove(this._columnDefinitionObservers[o]);this._rowDefinitionObservers.length=0,this._rowDefinitions.length=0,this._columnDefinitionObservers.length=0,this._columnDefinitions.length=0,this._cells={},this._childControls.length=0},e.prototype.serialize=function(e){t.prototype.serialize.call(this,e),e.columnCount=this.columnCount,e.rowCount=this.rowCount,e.columns=[],e.rows=[],e.tags=[];for(var i=0;i<this.columnCount;++i){var o=this.getColumnDefinition(i),n={value:null==o?void 0:o.getValue(this.host),unit:null==o?void 0:o.unit};e.columns.push(n)}for(i=0;i<this.rowCount;++i){var r=this.getRowDefinition(i);n={value:null==r?void 0:r.getValue(this.host),unit:null==r?void 0:r.unit},e.rows.push(n)}this.children.forEach((function(t){e.tags.push(t._tag)}))},e.prototype._parseFromContent=function(e,i){t.prototype._parseFromContent.call(this,e,i);var o=[];this.children.forEach((function(t){o.push(t)})),this.removeRowDefinition(0),this.removeColumnDefinition(0);for(var n=0;n<e.columnCount;++n){var r=e.columns[n].value,a=e.columns[n].unit;this.addColumnDefinition(r,1===a)}for(n=0;n<e.rowCount;++n){var s=e.rows[n].value;a=e.rows[n].unit,this.addRowDefinition(s,1===a)}for(n=0;n<o.length;++n){var l=e.tags[n],_=parseInt(l.substring(0,l.search(":")));isNaN(_)&&(_=0);var h=parseInt(l.substring(l.search(":")+1));isNaN(h)&&(h=0),this.addControl(o[n],_,h)}},e}(x);(0,h.RegisterClass)("BABYLON.GUI.Grid",M);var E=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._value=h.Color3.Red(),i._tmpColor=new h.Color3,i._pointerStartedOnSquare=!1,i._pointerStartedOnWheel=!1,i._squareLeft=0,i._squareTop=0,i._squareSize=0,i._h=360,i._s=1,i._v=1,i._lastPointerDownId=-1,i.onValueChangedObservable=new h.Observable,i._pointerIsDown=!1,i.value=new h.Color3(.88,.1,.1),i.size="200px",i.isPointerBlocker=!0,i}return r(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(t){this._value.equals(t)||(this._value.copyFrom(t),this._value.toHSVToRef(this._tmpColor),this._h=this._tmpColor.r,this._s=Math.max(this._tmpColor.g,1e-5),this._v=Math.max(this._tmpColor.b,1e-5),this._markAsDirty(),this._value.r<=e._Epsilon&&(this._value.r=0),this._value.g<=e._Epsilon&&(this._value.g=0),this._value.b<=e._Epsilon&&(this._value.b=0),this._value.r>=1-e._Epsilon&&(this._value.r=1),this._value.g>=1-e._Epsilon&&(this._value.g=1),this._value.b>=1-e._Epsilon&&(this._value.b=1),this.onValueChangedObservable.notifyObservers(this._value))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this._width.toString(this._host)},set:function(t){this._width.toString(this._host)!==t&&this._width.fromString(t)&&(0===this._width.getValue(this._host)&&(t="1px",this._width.fromString(t)),this._height.fromString(t),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height.toString(this._host)},set:function(t){this._height.toString(this._host)!==t&&this._height.fromString(t)&&(0===this._height.getValue(this._host)&&(t="1px",this._height.fromString(t)),this._width.fromString(t),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this.width},set:function(t){this.width=t},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"ColorPicker"},e.prototype._preMeasure=function(t){t.width<t.height?this._currentMeasure.height=t.width:this._currentMeasure.width=t.height},e.prototype._updateSquareProps=function(){var t=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),e=2*(t-.2*t)/Math.sqrt(2),i=t-.5*e;this._squareLeft=this._currentMeasure.left+i,this._squareTop=this._currentMeasure.top+i,this._squareSize=e},e.prototype._drawGradientSquare=function(t,e,i,o,n,r){var a=r.createLinearGradient(e,i,o+e,i);a.addColorStop(0,"#fff"),a.addColorStop(1,"hsl("+t+", 100%, 50%)"),r.fillStyle=a,r.fillRect(e,i,o,n);var s=r.createLinearGradient(e,i,e,n+i);s.addColorStop(0,"rgba(0,0,0,0)"),s.addColorStop(1,"#000"),r.fillStyle=s,r.fillRect(e,i,o,n)},e.prototype._drawCircle=function(t,e,i,o){o.beginPath(),o.arc(t,e,i+1,0,2*Math.PI,!1),o.lineWidth=3,o.strokeStyle="#333333",o.stroke(),o.beginPath(),o.arc(t,e,i,0,2*Math.PI,!1),o.lineWidth=3,o.strokeStyle="#ffffff",o.stroke()},e.prototype._createColorWheelCanvas=function(t,e){var i=h.EngineStore.LastCreatedEngine;if(!i)throw new Error("Invalid engine. Unable to create a canvas.");for(var o=i.createCanvas(2*t,2*t),n=o.getContext("2d"),r=n.getImageData(0,0,2*t,2*t),a=r.data,s=this._tmpColor,l=t*t,_=t-e,c=_*_,u=-t;u<t;u++)for(var d=-t;d<t;d++){var f=u*u+d*d;if(!(f>l||f<c)){var p=Math.sqrt(f),g=Math.atan2(d,u);h.Color3.HSVtoRGBToRef(180*g/Math.PI+180,p/t,1,s);var b=4*(u+t+2*(d+t)*t);a[b]=255*s.r,a[b+1]=255*s.g,a[b+2]=255*s.b;var m,v;v=t<50?.2:t>150?.04:-.16*(t-50)/100+.2,m=(p-_)/(t-_),a[b+3]=m<v?m/v*255:m>1-v?255*(1-(m-(1-v))/v):255}}return n.putImageData(r,0,0),o},e.prototype._draw=function(t){t.save(),this._applyStates(t);var e=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),i=.2*e,o=this._currentMeasure.left,n=this._currentMeasure.top;this._colorWheelCanvas&&this._colorWheelCanvas.width==2*e||(this._colorWheelCanvas=this._createColorWheelCanvas(e,i)),this._updateSquareProps(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.fillRect(this._squareLeft,this._squareTop,this._squareSize,this._squareSize)),t.drawImage(this._colorWheelCanvas,o,n),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),this._drawGradientSquare(this._h,this._squareLeft,this._squareTop,this._squareSize,this._squareSize,t);var r=this._squareLeft+this._squareSize*this._s,a=this._squareTop+this._squareSize*(1-this._v);this._drawCircle(r,a,.04*e,t);var s=e-.5*i;r=o+e+Math.cos((this._h-180)*Math.PI/180)*s,a=n+e+Math.sin((this._h-180)*Math.PI/180)*s,this._drawCircle(r,a,.35*i,t),t.restore()},e.prototype._updateValueFromPointer=function(t,i){if(this._pointerStartedOnWheel){var o=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),n=o+this._currentMeasure.left,r=o+this._currentMeasure.top;this._h=180*Math.atan2(i-r,t-n)/Math.PI+180}else this._pointerStartedOnSquare&&(this._updateSquareProps(),this._s=(t-this._squareLeft)/this._squareSize,this._v=1-(i-this._squareTop)/this._squareSize,this._s=Math.min(this._s,1),this._s=Math.max(this._s,e._Epsilon),this._v=Math.min(this._v,1),this._v=Math.max(this._v,e._Epsilon));h.Color3.HSVtoRGBToRef(this._h,this._s,this._v,this._tmpColor),this.value=this._tmpColor},e.prototype._isPointOnSquare=function(t,e){this._updateSquareProps();var i=this._squareLeft,o=this._squareTop,n=this._squareSize;return t>=i&&t<=i+n&&e>=o&&e<=o+n},e.prototype._isPointOnWheel=function(t,e){var i=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),o=i-.2*i,n=t-(i+this._currentMeasure.left),r=e-(i+this._currentMeasure.top),a=n*n+r*r;return a<=i*i&&a>=o*o},e.prototype._onPointerDown=function(e,i,o,n,r){if(!t.prototype._onPointerDown.call(this,e,i,o,n,r))return!1;if(this.isReadOnly)return!0;this._pointerIsDown=!0,this._pointerStartedOnSquare=!1,this._pointerStartedOnWheel=!1,this._invertTransformMatrix.transformCoordinates(i.x,i.y,this._transformedPosition);var a=this._transformedPosition.x,s=this._transformedPosition.y;return this._isPointOnSquare(a,s)?this._pointerStartedOnSquare=!0:this._isPointOnWheel(a,s)&&(this._pointerStartedOnWheel=!0),this._updateValueFromPointer(a,s),this._host._capturingControl[o]=this,this._lastPointerDownId=o,!0},e.prototype._onPointerMove=function(e,i,o,n){if(o==this._lastPointerDownId){if(!this.isReadOnly){this._invertTransformMatrix.transformCoordinates(i.x,i.y,this._transformedPosition);var r=this._transformedPosition.x,a=this._transformedPosition.y;this._pointerIsDown&&this._updateValueFromPointer(r,a)}t.prototype._onPointerMove.call(this,e,i,o,n)}},e.prototype._onPointerUp=function(e,i,o,n,r,a){this._pointerIsDown=!1,delete this._host._capturingControl[o],t.prototype._onPointerUp.call(this,e,i,o,n,r,a)},e.prototype._onCanvasBlur=function(){this._forcePointerUp(),t.prototype._onCanvasBlur.call(this)},e.ShowPickerDialogAsync=function(t,i){return new Promise((function(o){i.pickerWidth=i.pickerWidth||"640px",i.pickerHeight=i.pickerHeight||"400px",i.headerHeight=i.headerHeight||"35px",i.lastColor=i.lastColor||"#000000",i.swatchLimit=i.swatchLimit||20,i.numSwatchesPerLine=i.numSwatchesPerLine||10;var n,r,a,s,l,_,c,u=i.swatchLimit/i.numSwatchesPerLine,d=parseFloat(i.pickerWidth)/i.numSwatchesPerLine,f=Math.floor(.25*d),p=f*(i.numSwatchesPerLine+1),g=Math.floor((parseFloat(i.pickerWidth)-p)/i.numSwatchesPerLine),b=g*u+f*(u+1),m=(parseInt(i.pickerHeight)+b+Math.floor(.25*g)).toString()+"px",v="#c0c0c0",x="#535353",P="#414141",C="515151",S=h.Color3.FromHexString("#dddddd"),O=S.r+S.g+S.b,R=["R","G","B"],E="#454545",F="#f0f0f0",D=!1,L=new M;if(L.name="Dialog Container",L.width=i.pickerWidth,i.savedColors){L.height=m;var k=parseInt(i.pickerHeight)/parseInt(m);L.addRowDefinition(k,!1),L.addRowDefinition(1-k,!1)}else L.height=i.pickerHeight,L.addRowDefinition(1,!1);if(t.addControl(L),i.savedColors){(s=new M).name="Swatch Drawer",s.verticalAlignment=y.VERTICAL_ALIGNMENT_TOP,s.background=x,s.width=i.pickerWidth;var N,A=i.savedColors.length/i.numSwatchesPerLine;N=0==A?0:A+1,s.height=(g*A+N*f).toString()+"px",s.top=Math.floor(.25*g).toString()+"px";for(var z=0;z<2*Math.ceil(i.savedColors.length/i.numSwatchesPerLine)+1;z++)z%2!=0?s.addRowDefinition(g,!0):s.addRowDefinition(f,!0);for(z=0;z<2*i.numSwatchesPerLine+1;z++)z%2!=0?s.addColumnDefinition(g,!0):s.addColumnDefinition(f,!0);L.addControl(s,1,0)}var Q=new M;Q.name="Picker Panel",Q.height=i.pickerHeight;var V=parseInt(i.headerHeight)/parseInt(i.pickerHeight),W=[V,1-V];Q.addRowDefinition(W[0],!1),Q.addRowDefinition(W[1],!1),L.addControl(Q,0,0);var H=new I;H.name="Dialogue Header Bar",H.background="#cccccc",H.thickness=0,Q.addControl(H,0,0);var G=T.CreateSimpleButton("closeButton","a");G.fontFamily="coreglyphs";var U=h.Color3.FromHexString(H.background),j=new h.Color3(1-U.r,1-U.g,1-U.b);G.color=j.toHexString(),G.fontSize=Math.floor(.6*parseInt(i.headerHeight)),G.textBlock.textVerticalAlignment=y.VERTICAL_ALIGNMENT_CENTER,G.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_RIGHT,G.height=G.width=i.headerHeight,G.background=H.background,G.thickness=0,G.pointerDownAnimation=function(){},G.pointerUpAnimation=function(){G.background=H.background},G.pointerEnterAnimation=function(){G.color=H.background,G.background="red"},G.pointerOutAnimation=function(){G.color=j.toHexString(),G.background=H.background},G.onPointerClickObservable.add((function(){Qt(_t.background)})),Q.addControl(G,0,0);var Y=new M;Y.name="Dialogue Body",Y.background=x;var X=[.4375,.5625];Y.addRowDefinition(1,!1),Y.addColumnDefinition(X[0],!1),Y.addColumnDefinition(X[1],!1),Q.addControl(Y,1,0);var K=new M;K.name="Picker Grid",K.addRowDefinition(.85,!1),K.addRowDefinition(.15,!1),Y.addControl(K,0,0);var Z=new e;Z.name="GUI Color Picker",i.pickerHeight<i.pickerWidth?Z.width=.89:Z.height=.89,Z.value=h.Color3.FromHexString(i.lastColor),Z.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_CENTER,Z.verticalAlignment=y.VERTICAL_ALIGNMENT_CENTER,Z.onPointerDownObservable.add((function(){c=Z.name,_="",kt(!1)})),Z.onValueChangedObservable.add((function(t){c==Z.name&&Et(t,Z.name)})),K.addControl(Z,0,0);var q=new M;q.name="Dialogue Right Half",q.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT;var J=[.514,.486];q.addRowDefinition(J[0],!1),q.addRowDefinition(J[1],!1),Y.addControl(q,1,1);var $=new M;$.name="Swatches and Buttons";var tt=[.417,.583];$.addRowDefinition(1,!1),$.addColumnDefinition(tt[0],!1),$.addColumnDefinition(tt[1],!1),q.addControl($,0,0);var et=new M;et.name="New and Current Swatches";var it=[.04,.16,.64,.16];et.addRowDefinition(it[0],!1),et.addRowDefinition(it[1],!1),et.addRowDefinition(it[2],!1),et.addRowDefinition(it[3],!1),$.addControl(et,0,0);var ot=new M;ot.name="Active Swatches",ot.width=.67,ot.addRowDefinition(.5,!1),ot.addRowDefinition(.5,!1),et.addControl(ot,2,0);var nt,rt=Math.floor(parseInt(i.pickerWidth)*X[1]*tt[0]*.11),at=Math.floor(parseInt(i.pickerHeight)*W[1]*J[0]*it[1]*.5);nt=i.pickerWidth>i.pickerHeight?at:rt;var st=new B;st.text="new",st.name="New Color Label",st.color=v,st.fontSize=nt,et.addControl(st,1,0);var lt=new I;lt.name="New Color Swatch",lt.background=i.lastColor,lt.thickness=0,ot.addControl(lt,0,0);var _t=T.CreateSimpleButton("currentSwatch","");_t.background=i.lastColor,_t.thickness=0,_t.onPointerClickObservable.add((function(){Et(h.Color3.FromHexString(_t.background),_t.name),kt(!1)})),_t.pointerDownAnimation=function(){},_t.pointerUpAnimation=function(){},_t.pointerEnterAnimation=function(){},_t.pointerOutAnimation=function(){},ot.addControl(_t,1,0);var ht=new I;ht.name="Swatch Outline",ht.width=.67,ht.thickness=2,ht.color="#404040",ht.isHitTestVisible=!1,et.addControl(ht,2,0);var ct=new B;ct.name="Current Color Label",ct.text="current",ct.color=v,ct.fontSize=nt,et.addControl(ct,3,0);var ut=new M;ut.name="Button Grid",ut.height=.8;var dt=1/3;ut.addRowDefinition(dt,!1),ut.addRowDefinition(dt,!1),ut.addRowDefinition(dt,!1),$.addControl(ut,0,1);var ft=Math.floor(parseInt(i.pickerWidth)*X[1]*tt[1]*.67).toString()+"px",pt=Math.floor(parseInt(i.pickerHeight)*W[1]*J[0]*(parseFloat(ut.height.toString())/100)*dt*.7).toString()+"px";n=parseFloat(ft)>parseFloat(pt)?Math.floor(.45*parseFloat(pt)):Math.floor(.11*parseFloat(ft));var gt=T.CreateSimpleButton("butOK","OK");gt.width=ft,gt.height=pt,gt.verticalAlignment=y.VERTICAL_ALIGNMENT_CENTER,gt.thickness=2,gt.color=v,gt.fontSize=n,gt.background=x,gt.onPointerEnterObservable.add((function(){gt.background=P})),gt.onPointerOutObservable.add((function(){gt.background=x})),gt.pointerDownAnimation=function(){gt.background=C},gt.pointerUpAnimation=function(){gt.background=P},gt.onPointerClickObservable.add((function(){kt(!1),Qt(lt.background)})),ut.addControl(gt,0,0);var bt=T.CreateSimpleButton("butCancel","Cancel");bt.width=ft,bt.height=pt,bt.verticalAlignment=y.VERTICAL_ALIGNMENT_CENTER,bt.thickness=2,bt.color=v,bt.fontSize=n,bt.background=x,bt.onPointerEnterObservable.add((function(){bt.background=P})),bt.onPointerOutObservable.add((function(){bt.background=x})),bt.pointerDownAnimation=function(){bt.background=C},bt.pointerUpAnimation=function(){bt.background=P},bt.onPointerClickObservable.add((function(){kt(!1),Qt(_t.background)})),ut.addControl(bt,1,0),i.savedColors&&((l=T.CreateSimpleButton("butSave","Save")).width=ft,l.height=pt,l.verticalAlignment=y.VERTICAL_ALIGNMENT_CENTER,l.thickness=2,l.fontSize=n,i.savedColors.length<i.swatchLimit?(l.color=v,l.background=x):zt(l,!0),l.onPointerEnterObservable.add((function(){i.savedColors&&i.savedColors.length<i.swatchLimit&&(l.background=P)})),l.onPointerOutObservable.add((function(){i.savedColors&&i.savedColors.length<i.swatchLimit&&(l.background=x)})),l.pointerDownAnimation=function(){i.savedColors&&i.savedColors.length<i.swatchLimit&&(l.background=C)},l.pointerUpAnimation=function(){i.savedColors&&i.savedColors.length<i.swatchLimit&&(l.background=P)},l.onPointerClickObservable.add((function(){i.savedColors&&(0==i.savedColors.length&&At(!0),i.savedColors.length<i.swatchLimit&&Nt(lt.background,l),kt(!1))})),i.savedColors.length>0&&At(!0),ut.addControl(l,2,0));var mt=new M;mt.name="Dialog Lower Right",mt.addRowDefinition(.02,!1),mt.addRowDefinition(.63,!1),mt.addRowDefinition(.21,!1),mt.addRowDefinition(.14,!1),q.addControl(mt,1,0);var vt=h.Color3.FromHexString(i.lastColor),yt=new M;for(yt.name="RGB Values",yt.width=.82,yt.verticalAlignment=y.VERTICAL_ALIGNMENT_CENTER,yt.addRowDefinition(1/3,!1),yt.addRowDefinition(1/3,!1),yt.addRowDefinition(1/3,!1),yt.addColumnDefinition(.1,!1),yt.addColumnDefinition(.2,!1),yt.addColumnDefinition(.7,!1),mt.addControl(yt,1,0),z=0;z<R.length;z++){var xt=new B;xt.text=R[z],xt.color=v,xt.fontSize=n,yt.addControl(xt,z,0)}var Pt=new w;Pt.width=.83,Pt.height=.72,Pt.name="rIntField",Pt.fontSize=n,Pt.text=(255*vt.r).toString(),Pt.color=F,Pt.background=E,Pt.onFocusObservable.add((function(){c=Pt.name,_=Pt.text,kt(!1)})),Pt.onBlurObservable.add((function(){""==Pt.text&&(Pt.text="0"),Ft(Pt,"r"),c==Pt.name&&(c="")})),Pt.onTextChangedObservable.add((function(){c==Pt.name&&Ft(Pt,"r")})),yt.addControl(Pt,0,1);var It=new w;It.width=.83,It.height=.72,It.name="gIntField",It.fontSize=n,It.text=(255*vt.g).toString(),It.color=F,It.background=E,It.onFocusObservable.add((function(){c=It.name,_=It.text,kt(!1)})),It.onBlurObservable.add((function(){""==It.text&&(It.text="0"),Ft(It,"g"),c==It.name&&(c="")})),It.onTextChangedObservable.add((function(){c==It.name&&Ft(It,"g")})),yt.addControl(It,1,1);var Bt=new w;Bt.width=.83,Bt.height=.72,Bt.name="bIntField",Bt.fontSize=n,Bt.text=(255*vt.b).toString(),Bt.color=F,Bt.background=E,Bt.onFocusObservable.add((function(){c=Bt.name,_=Bt.text,kt(!1)})),Bt.onBlurObservable.add((function(){""==Bt.text&&(Bt.text="0"),Ft(Bt,"b"),c==Bt.name&&(c="")})),Bt.onTextChangedObservable.add((function(){c==Bt.name&&Ft(Bt,"b")})),yt.addControl(Bt,2,1);var Ct=new w;Ct.width=.95,Ct.height=.72,Ct.name="rDecField",Ct.fontSize=n,Ct.text=vt.r.toString(),Ct.color=F,Ct.background=E,Ct.onFocusObservable.add((function(){c=Ct.name,_=Ct.text,kt(!1)})),Ct.onBlurObservable.add((function(){0!=parseFloat(Ct.text)&&""!=Ct.text||(Ct.text="0",Dt(Ct,"r")),c==Ct.name&&(c="")})),Ct.onTextChangedObservable.add((function(){c==Ct.name&&Dt(Ct,"r")})),yt.addControl(Ct,0,2);var Tt=new w;Tt.width=.95,Tt.height=.72,Tt.name="gDecField",Tt.fontSize=n,Tt.text=vt.g.toString(),Tt.color=F,Tt.background=E,Tt.onFocusObservable.add((function(){c=Tt.name,_=Tt.text,kt(!1)})),Tt.onBlurObservable.add((function(){0!=parseFloat(Tt.text)&&""!=Tt.text||(Tt.text="0",Dt(Tt,"g")),c==Tt.name&&(c="")})),Tt.onTextChangedObservable.add((function(){c==Tt.name&&Dt(Tt,"g")})),yt.addControl(Tt,1,2);var St=new w;St.width=.95,St.height=.72,St.name="bDecField",St.fontSize=n,St.text=vt.b.toString(),St.color=F,St.background=E,St.onFocusObservable.add((function(){c=St.name,_=St.text,kt(!1)})),St.onBlurObservable.add((function(){0!=parseFloat(St.text)&&""!=St.text||(St.text="0",Dt(St,"b")),c==St.name&&(c="")})),St.onTextChangedObservable.add((function(){c==St.name&&Dt(St,"b")})),yt.addControl(St,2,2);var Ot=new M;Ot.name="Hex Value",Ot.width=.82,Ot.addRowDefinition(1,!1),Ot.addColumnDefinition(.1,!1),Ot.addColumnDefinition(.9,!1),mt.addControl(Ot,2,0);var Rt=new B;Rt.text="#",Rt.color=v,Rt.fontSize=n,Ot.addControl(Rt,0,0);var wt=new w;wt.width=.96,wt.height=.72,wt.name="hexField",wt.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_CENTER,wt.fontSize=n;var Mt=i.lastColor.split("#");function Et(t,e){c=e;var i=t.toHexString();if(lt.background=i,Pt.name!=c&&(Pt.text=Math.floor(255*t.r).toString()),It.name!=c&&(It.text=Math.floor(255*t.g).toString()),Bt.name!=c&&(Bt.text=Math.floor(255*t.b).toString()),Ct.name!=c&&(Ct.text=t.r.toString()),Tt.name!=c&&(Tt.text=t.g.toString()),St.name!=c&&(St.text=t.b.toString()),wt.name!=c){var o=i.split("#");wt.text=o[1]}Z.name!=c&&(Z.value=t)}function Ft(t,e){var i=t.text;if(/[^0-9]/g.test(i))t.text=_;else if(""!=i&&(Math.floor(parseInt(i))<0?i="0":Math.floor(parseInt(i))>255?i="255":isNaN(parseInt(i))&&(i="0")),c==t.name&&(_=i),""!=i){i=parseInt(i).toString(),t.text=i;var o=h.Color3.FromHexString(lt.background);c==t.name&&Et("r"==e?new h.Color3(parseInt(i)/255,o.g,o.b):"g"==e?new h.Color3(o.r,parseInt(i)/255,o.b):new h.Color3(o.r,o.g,parseInt(i)/255),t.name)}}function Dt(t,e){var i=t.text;if(/[^0-9.]/g.test(i))t.text=_;else{""!=i&&"."!=i&&0!=parseFloat(i)&&(parseFloat(i)<0?i="0.0":parseFloat(i)>1?i="1.0":isNaN(parseFloat(i))&&(i="0.0")),c==t.name&&(_=i),""!=i&&"."!=i&&0!=parseFloat(i)?(i=parseFloat(i).toString(),t.text=i):i="0.0";var o=h.Color3.FromHexString(lt.background);c==t.name&&Et("r"==e?new h.Color3(parseFloat(i),o.g,o.b):"g"==e?new h.Color3(o.r,parseFloat(i),o.b):new h.Color3(o.r,o.g,parseFloat(i)),t.name)}}function Lt(){if(i.savedColors&&i.savedColors[a]){var t;t=D?"b":"";var e=T.CreateSimpleButton("Swatch_"+a,t);e.fontFamily="coreglyphs";var o=h.Color3.FromHexString(i.savedColors[a]),n=o.r+o.g+o.b;e.color=n>O?"#aaaaaa":"#ffffff",e.fontSize=Math.floor(.7*g),e.textBlock.verticalAlignment=y.VERTICAL_ALIGNMENT_CENTER,e.height=e.width=g.toString()+"px",e.background=i.savedColors[a],e.thickness=2;var r=a;return e.pointerDownAnimation=function(){e.thickness=4},e.pointerUpAnimation=function(){e.thickness=3},e.pointerEnterAnimation=function(){e.thickness=3},e.pointerOutAnimation=function(){e.thickness=2},e.onPointerClickObservable.add((function(){var t;D?(t=r,i.savedColors&&i.savedColors.splice(t,1),i.savedColors&&0==i.savedColors.length&&(At(!1),D=!1),Nt("",l)):i.savedColors&&Et(h.Color3.FromHexString(i.savedColors[r]),e.name)})),e}return null}function kt(t){if(void 0!==t&&(D=t),D){for(var e=0;e<s.children.length;e++)s.children[e].textBlock.text="b";void 0!==r&&(r.textBlock.text="Done")}else{for(e=0;e<s.children.length;e++)s.children[e].textBlock.text="";void 0!==r&&(r.textBlock.text="Edit")}}function Nt(t,e){if(i.savedColors){""!=t&&i.savedColors.push(t),a=0,s.clearControls();var o,n=Math.ceil(i.savedColors.length/i.numSwatchesPerLine);if(o=0==n?0:n+1,s.rowCount!=n+o){for(var r=s.rowCount,l=0;l<r;l++)s.removeRowDefinition(0);for(l=0;l<n+o;l++)l%2?s.addRowDefinition(g,!0):s.addRowDefinition(f,!0)}s.height=(g*n+o*f).toString()+"px";for(var _=1,h=1;_<n+o;_+=2,h++){var c;c=i.savedColors.length>h*i.numSwatchesPerLine?i.numSwatchesPerLine:i.savedColors.length-(h-1)*i.numSwatchesPerLine;for(var u=Math.min(Math.max(c,0),i.numSwatchesPerLine),d=0,p=1;d<u;d++)if(!(d>i.numSwatchesPerLine)){var b=Lt();null!=b&&(s.addControl(b,_,p),p+=2,a++)}}i.savedColors.length>=i.swatchLimit?zt(e,!0):zt(e,!1)}}function At(t){t?((r=T.CreateSimpleButton("butEdit","Edit")).width=ft,r.height=pt,r.left=Math.floor(.1*parseInt(ft)).toString()+"px",r.top=(-1*parseFloat(r.left)).toString()+"px",r.verticalAlignment=y.VERTICAL_ALIGNMENT_BOTTOM,r.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,r.thickness=2,r.color=v,r.fontSize=n,r.background=x,r.onPointerEnterObservable.add((function(){r.background=P})),r.onPointerOutObservable.add((function(){r.background=x})),r.pointerDownAnimation=function(){r.background=C},r.pointerUpAnimation=function(){r.background=P},r.onPointerClickObservable.add((function(){D=!D,kt()})),K.addControl(r,1,0)):K.removeControl(r)}function zt(t,e){e?(t.color="#555555",t.background="#454545"):(t.color=v,t.background=x)}function Qt(e){i.savedColors&&i.savedColors.length>0?o({savedColors:i.savedColors,pickedColor:e}):o({pickedColor:e}),t.removeControl(L)}wt.text=Mt[1],wt.color=F,wt.background=E,wt.onFocusObservable.add((function(){c=wt.name,_=wt.text,kt(!1)})),wt.onBlurObservable.add((function(){if(3==wt.text.length){var t=wt.text.split("");wt.text=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]}""==wt.text&&(wt.text="000000",Et(h.Color3.FromHexString(wt.text),"b")),c==wt.name&&(c="")})),wt.onTextChangedObservable.add((function(){var t=wt.text,e=/[^0-9A-F]/i.test(t);if((wt.text.length>6||e)&&c==wt.name)wt.text=_;else{if(wt.text.length<6)for(var i=6-wt.text.length,o=0;o<i;o++)t="0"+t;if(3==wt.text.length){var n=wt.text.split("");t=n[0]+n[0]+n[1]+n[1]+n[2]+n[2]}t="#"+t,c==wt.name&&(_=wt.text,Et(h.Color3.FromHexString(t),wt.name))}})),Ot.addControl(wt,0,1),i.savedColors&&i.savedColors.length>0&&Nt("",l)}))},e._Epsilon=1e-6,s([(0,h.serialize)()],e.prototype,"value",null),s([(0,h.serialize)()],e.prototype,"width",null),s([(0,h.serialize)()],e.prototype,"height",null),s([(0,h.serialize)()],e.prototype,"size",null),e}(y);(0,h.RegisterClass)("BABYLON.GUI.ColorPicker",E);var F=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._thickness=1,i}return r(e,t),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness!==t&&(this._thickness=t,this._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"Ellipse"},e.prototype._localDraw=function(t){t.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),y.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,t),(this._backgroundGradient||this._background)&&(t.fillStyle=this._getBackgroundColor(t),t.fill()),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),this._thickness&&(this.color&&(t.strokeStyle=this.color),t.lineWidth=this._thickness,t.stroke()),t.restore()},e.prototype._additionalProcessing=function(e,i){t.prototype._additionalProcessing.call(this,e,i),this._measureForChildren.width-=2*this._thickness,this._measureForChildren.height-=2*this._thickness,this._measureForChildren.left+=this._thickness,this._measureForChildren.top+=this._thickness},e.prototype._clipForChildren=function(t){y.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,this._currentMeasure.width/2,this._currentMeasure.height/2,t),t.clip()},e.prototype._renderHighlightSpecific=function(t){y.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,t),t.stroke()},s([(0,h.serialize)()],e.prototype,"thickness",null),e}(x);(0,h.RegisterClass)("BABYLON.GUI.Ellipse",F);var D=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i.focusedColor=null,i._isFocused=!1,i._unfocusedColor=null,i.onFocusObservable=new h.Observable,i.onBlurObservable=new h.Observable,i.onKeyboardEventProcessedObservable=new h.Observable,i._unfocusedColor=i.color,i}return r(e,t),e.prototype.onBlur=function(){this._isFocused&&(this._isFocused=!1,this.focusedColor&&null!=this._unfocusedColor&&(this.color=this._unfocusedColor),this.onBlurObservable.notifyObservers(this))},e.prototype.onFocus=function(){this._isFocused=!0,this.focusedColor&&(this._unfocusedColor=this.color,this.color=this.focusedColor),this.onFocusObservable.notifyObservers(this)},e.prototype.keepsFocusWith=function(){return null},e.prototype.focus=function(){this._host.moveFocusToControl(this)},e.prototype.blur=function(){this._host.focusedControl=null},e.prototype.processKeyboard=function(t){this.onKeyboardEventProcessedObservable.notifyObservers(t,-1,this)},e.prototype._onPointerDown=function(e,i,o,n,r){return this.isReadOnly||this.focus(),t.prototype._onPointerDown.call(this,e,i,o,n,r)},e.prototype.displose=function(){t.prototype.dispose.call(this),this.onBlurObservable.clear(),this.onFocusObservable.clear(),this.onKeyboardEventProcessedObservable.clear()},e}(T);(0,h.RegisterClass)("BABYLON.GUI.FocusableButton",D);var L=function(t){function e(e,i){void 0===i&&(i="");var o=t.call(this,e)||this;return o.name=e,o._textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,o._textVerticalAlignment=y.VERTICAL_ALIGNMENT_TOP,o._lineSpacing=new c(0),o._outlineWidth=0,o._outlineColor="white",o._maxHeight=new c(1,c.UNITMODE_PERCENTAGE,!1),o.onLinesReadyObservable=new h.Observable,o.text=i,o.isPointerBlocker=!0,o.onLinesReadyObservable.add((function(){return o._updateCursorPosition()})),o._highlightCursorInfo={initialStartIndex:-1,initialRelativeStartIndex:-1,initialLineIndex:-1},o._cursorInfo={globalStartIndex:0,globalEndIndex:0,relativeEndIndex:0,relativeStartIndex:0,currentLineIndex:0},o}return r(e,t),Object.defineProperty(e.prototype,"outlineWidth",{get:function(){return this._outlineWidth},set:function(t){this._outlineWidth!==t&&(this._outlineWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"outlineColor",{get:function(){return this._outlineColor},set:function(t){this._outlineColor!==t&&(this._outlineColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"autoStretchHeight",{get:function(){return this._autoStretchHeight},set:function(t){this._autoStretchHeight!==t&&(this._autoStretchHeight=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{set:function(t){this._fixedRatioMasterIsWidth=!1,this._height.toString(this._host)!==t&&(this._height.fromString(t)&&this._markAsDirty(),this._autoStretchHeight=!1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxHeight",{get:function(){return this._maxHeight.toString(this._host)},set:function(t){this._maxHeight.toString(this._host)!==t&&this._maxHeight.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxHeightInPixels",{get:function(){return this._maxHeight.getValueInPixel(this._host,this._cachedParentMeasure.height)},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"InputTextArea"},e.prototype.processKeyboard=function(t){this.alternativeProcessKey(t.code,t.key,t),this.onKeyboardEventProcessedObservable.notifyObservers(t)},e.prototype.alternativeProcessKey=function(t,e,i){if(!i||!i.ctrlKey&&!i.metaKey||"KeyC"!==t&&"KeyV"!==t&&"KeyX"!==t){switch(t){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.globalEndIndex<this.text.length&&(this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex+1),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"Enter":return this._textWrapper.removePart(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex,"\n"),this._cursorInfo.globalStartIndex++,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._blinkIsEven=!1,this._isTextHighlightOn=!1,void this._textHasChanged();case"End":return this._cursorInfo.globalStartIndex=this.text.length,this._blinkIsEven=!1,this._isTextHighlightOn=!1,void this._markAsDirty();case"Home":return this._cursorInfo.globalStartIndex=0,this._blinkIsEven=!1,this._isTextHighlightOn=!1,void this._markAsDirty();case"ArrowLeft":return this._markAsDirty(),i&&i.shiftKey?((i.ctrlKey||i.metaKey)&&(this._cursorInfo.globalStartIndex-=this._cursorInfo.relativeStartIndex,this._cursorInfo.globalEndIndex=this._highlightCursorInfo.initialStartIndex),this._isTextHighlightOn?this._cursorInfo.globalEndIndex>this._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){var o=this._lines[this._cursorInfo.currentLineIndex].text.length-this._cursorInfo.relativeEndIndex-1;this._cursorInfo.globalEndIndex+=o,this._cursorInfo.globalStartIndex=this._highlightCursorInfo.initialStartIndex}return this._isTextHighlightOn?this._cursorInfo.globalStartIndex<this._highlightCursorInfo.initialStartIndex?this._cursorInfo.globalStartIndex++:this._cursorInfo.globalEndIndex++:(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.globalEndIndex++,this._isTextHighlightOn=!0),this._blinkIsEven=!0,void i.preventDefault()}return this._isTextHighlightOn?this._cursorInfo.globalStartIndex=this._cursorInfo.globalEndIndex:i&&(i.ctrlKey||i.metaKey)?(o=this._lines[this._cursorInfo.currentLineIndex].text.length-this._cursorInfo.relativeEndIndex,this._cursorInfo.globalStartIndex+=o):this._cursorInfo.globalStartIndex<this.text.length&&this._cursorInfo.globalStartIndex++,this._blinkIsEven=!1,void(this._isTextHighlightOn=!1);case"ArrowUp":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()),0===this._cursorInfo.currentLineIndex)this._cursorInfo.globalStartIndex=0;else{var n=this._lines[this._cursorInfo.currentLineIndex],r=this._lines[this._cursorInfo.currentLineIndex-1],a=0,s=0;!this._isTextHighlightOn||this._cursorInfo.currentLineIndex<this._highlightCursorInfo.initialLineIndex?(a=this._cursorInfo.globalStartIndex,s=this._cursorInfo.relativeStartIndex):(a=this._cursorInfo.globalEndIndex,s=this._cursorInfo.relativeEndIndex);var l=n.text.substr(0,s),_=this._contextForBreakLines.measureText(l).width,h=0,c=0;a-=s,a-=r.text.length+r.lineEnding.length;for(var u=0;h<_&&u<r.text.length;)a++,u++,c=Math.abs(_-h),h=this._contextForBreakLines.measureText(r.text.substr(0,u)).width;Math.abs(_-h)>c&&u>0&&a--,this._isTextHighlightOn?this._cursorInfo.currentLineIndex<=this._highlightCursorInfo.initialLineIndex?(this._cursorInfo.globalStartIndex=a,this._cursorInfo.globalEndIndex=this._highlightCursorInfo.initialStartIndex,this._cursorInfo.relativeEndIndex=this._highlightCursorInfo.initialRelativeStartIndex):this._cursorInfo.globalEndIndex=a:this._cursorInfo.globalStartIndex=a}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{n=this._lines[this._cursorInfo.currentLineIndex];var d=this._lines[this._cursorInfo.currentLineIndex+1];a=0,s=0,!this._isTextHighlightOn||this._cursorInfo.currentLineIndex<this._highlightCursorInfo.initialLineIndex?(a=this._cursorInfo.globalStartIndex,s=this._cursorInfo.relativeStartIndex):(a=this._cursorInfo.globalEndIndex,s=this._cursorInfo.relativeEndIndex),l=n.text.substr(0,s),_=this._contextForBreakLines.measureText(l).width;var f=0;c=0,a+=n.text.length-s+n.lineEnding.length;for(var p=0;f<_&&p<d.text.length;)a++,p++,c=Math.abs(_-f),f=this._contextForBreakLines.measureText(d.text.substr(0,p)).width;Math.abs(_-f)>c&&p>0&&a--,this._isTextHighlightOn?this._cursorInfo.currentLineIndex<this._highlightCursorInfo.initialLineIndex?(this._cursorInfo.globalStartIndex=a,this._cursorInfo.globalStartIndex>this._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=a,this._cursorInfo.globalStartIndex=this._highlightCursorInfo.initialStartIndex):this._cursorInfo.globalStartIndex=a}return void this._markAsDirty()}1===(null==e?void 0:e.length)&&(null==i||i.preventDefault(),this._currentKey=e,this.onBeforeKeyAddObservable.notifyObservers(this),e=this._currentKey,this._addKey&&(this._isTextHighlightOn=!1,this._blinkIsEven=!1,this._textWrapper.removePart(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex,e),this._cursorInfo.globalStartIndex+=e.length,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._textHasChanged()))}},e.prototype._parseLineWordWrap=function(t,e,i){void 0===t&&(t="");for(var o=[],n=t.split(" "),r=0,a=function(a){var s=a>0?t+" "+n[a]:n[0],l=i.measureText(s).width;if(l>e){a>0&&(r=i.measureText(t).width,o.push({text:t,width:r,lineEnding:" "})),t=n[a];var _="";t.split("").map((function(t){i.measureText(_+t).width>e&&(o.push({text:_,width:i.measureText(_).width,lineEnding:"\n"}),_=""),_+=t})),t=_,r=i.measureText(t).width}else r=l,t=s},s=0;s<n.length;s++)a(s);return o.push({text:t,width:r,lineEnding:" "}),o},e.prototype._breakLines=function(t,e){var i=[],o=this.text.split("\n");if(this.clipContent)for(var n=0,r=o;n<r.length;n++){var a=r[n];i.push.apply(i,this._parseLineWordWrap(a,t,e))}else for(var s=0,l=o;s<l.length;s++)a=l[s],i.push(this._parseLine(a,e));return i[i.length-1].lineEnding="\n",i},e.prototype._parseLine=function(t,e){return void 0===t&&(t=""),{text:t,width:e.measureText(t).width,lineEnding:" "}},e.prototype._preMeasure=function(t,e){this._fontOffset&&!this._wasDirty||(this._fontOffset=y._GetFontOffset(e.font));var i=this._beforeRenderText(this._textWrapper).text;this._isFocused||this.text||!this._placeholderText||(i=this._placeholderText,this._placeholderColor&&(e.fillStyle=this._placeholderColor)),this._textWidth=e.measureText(i).width;var o=2*this._margin.getValueInPixel(this._host,t.width);if(this._autoStretchWidth){var n=i.split("\n").reduce((function(t,i){return e.measureText(i).width>e.measureText(t).width?i:t}),""),r=e.measureText(n).width;this.width=Math.min(this._maxWidth.getValueInPixel(this._host,t.width),r+o)+"px",this.autoStretchWidth=!0}if(this._availableWidth=this._width.getValueInPixel(this._host,t.width)-o,this._lines=this._breakLines(this._availableWidth,e),this._contextForBreakLines=e,this._autoStretchHeight){var a=this._lines.length*this._fontOffset.height+2*this._margin.getValueInPixel(this._host,t.height);this.height=Math.min(this._maxHeight.getValueInPixel(this._host,t.height),a)+"px",this._autoStretchHeight=!0}if(this._availableHeight=this._height.getValueInPixel(this._host,t.height)-o,this._isFocused){this._cursorInfo.currentLineIndex=0;for(var s=this._lines[this._cursorInfo.currentLineIndex].text.length+this._lines[this._cursorInfo.currentLineIndex].lineEnding.length,l=0;l+s<=this._cursorInfo.globalStartIndex;)l+=s,this._cursorInfo.currentLineIndex<this._lines.length-1&&(this._cursorInfo.currentLineIndex++,s=this._lines[this._cursorInfo.currentLineIndex].text.length+this._lines[this._cursorInfo.currentLineIndex].lineEnding.length)}},e.prototype._computeScroll=function(){if(this._clipTextLeft=this._currentMeasure.left+this._margin.getValueInPixel(this._host,this._cachedParentMeasure.width),this._clipTextTop=this._currentMeasure.top+this._margin.getValueInPixel(this._host,this._cachedParentMeasure.height),this._isFocused&&this._lines[this._cursorInfo.currentLineIndex].width>this._availableWidth){var t=this._clipTextLeft-this._lines[this._cursorInfo.currentLineIndex].width+this._availableWidth;this._scrollLeft||(this._scrollLeft=t)}else this._scrollLeft=this._clipTextLeft;if(this._isFocused&&!this._autoStretchHeight){var e=(this._cursorInfo.currentLineIndex+1)*this._fontOffset.height,i=this._clipTextTop-e;this._scrollTop||(this._scrollTop=i)}else this._scrollTop=this._clipTextTop},e.prototype._additionalProcessing=function(){this.highlightedText="",this.onLinesReadyObservable.notifyObservers(this)},e.prototype._drawText=function(t,e,i,o){var n=this._currentMeasure.width,r=this._scrollLeft;switch(this._textHorizontalAlignment){case y.HORIZONTAL_ALIGNMENT_LEFT:r+=0;break;case y.HORIZONTAL_ALIGNMENT_RIGHT:r+=n-e;break;case y.HORIZONTAL_ALIGNMENT_CENTER:r+=(n-e)/2}(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(o.shadowColor=this.shadowColor,o.shadowBlur=this.shadowBlur,o.shadowOffsetX=this.shadowOffsetX,o.shadowOffsetY=this.shadowOffsetY),this.outlineWidth&&o.strokeText(t,this._currentMeasure.left+r,i),o.fillText(t,r,i)},e.prototype._onCopyText=function(t){this._isTextHighlightOn=!1;try{t.clipboardData&&t.clipboardData.setData("text/plain",this._highlightedText)}catch(t){}this._host.clipboardData=this._highlightedText},e.prototype._onCutText=function(t){if(this._highlightedText){try{t.clipboardData&&t.clipboardData.setData("text/plain",this._highlightedText)}catch(t){}this._host.clipboardData=this._highlightedText,this._textWrapper.removePart(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex),this._textHasChanged()}},e.prototype._onPasteText=function(t){var e;e=t.clipboardData&&-1!==t.clipboardData.types.indexOf("text/plain")?t.clipboardData.getData("text/plain"):this._host.clipboardData,this._isTextHighlightOn=!1,this._textWrapper.removePart(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex,e);var i=e.length-(this._cursorInfo.globalEndIndex-this._cursorInfo.globalStartIndex);this._cursorInfo.globalStartIndex+=i,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._textHasChanged()},e.prototype._draw=function(t){var e,i;this._computeScroll(),this._scrollLeft=null!==(e=this._scrollLeft)&&void 0!==e?e:0,this._scrollTop=null!==(i=this._scrollTop)&&void 0!==i?i:0,t.save(),this._applyStates(t),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),this._isFocused?this._focusedBackground&&(t.fillStyle=this._isEnabled?this._focusedBackground:this._disabledColor,t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)):this._background&&(t.fillStyle=this._isEnabled?this._background:this._disabledColor,t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),this.color&&(t.fillStyle=this.color);var o=this._currentMeasure.height,n=this._currentMeasure.width,r=0;switch(this._textVerticalAlignment){case y.VERTICAL_ALIGNMENT_TOP:r=this._fontOffset.ascent;break;case y.VERTICAL_ALIGNMENT_BOTTOM:r=o-this._fontOffset.height*(this._lines.length-1)-this._fontOffset.descent;break;case y.VERTICAL_ALIGNMENT_CENTER:r=this._fontOffset.ascent+(o-this._fontOffset.height*this._lines.length)/2}t.save(),t.beginPath(),t.fillStyle=this.fontStyle,t.rect(this._clipTextLeft,this._clipTextTop,this._availableWidth+2,this._availableHeight+2),t.clip(),r+=this._scrollTop;for(var a=0;a<this._lines.length;a++){var s=this._lines[a];0!==a&&0!==this._lineSpacing.internalValue&&(this._lineSpacing.isPixel?r+=this._lineSpacing.getValue(this._host):r+=this._lineSpacing.getValue(this._host)*this._height.getValueInPixel(this._host,this._cachedParentMeasure.height)),this._drawText(s.text,s.width,r,t),r+=this._fontOffset.height}if(t.restore(),this._isFocused){if(!this._blinkIsEven||this._isTextHighlightOn){var l=this._scrollLeft+t.measureText(this._lines[this._cursorInfo.currentLineIndex].text.substr(0,this._cursorInfo.relativeStartIndex)).width;l<this._clipTextLeft?(this._scrollLeft+=this._clipTextLeft-l,l=this._clipTextLeft,this._markAsDirty()):l>this._clipTextLeft+this._availableWidth&&(this._scrollLeft+=this._clipTextLeft+this._availableWidth-l,l=this._clipTextLeft+this._availableWidth,this._markAsDirty());var _=this._scrollTop+this._cursorInfo.currentLineIndex*this._fontOffset.height;_<this._clipTextTop?(this._scrollTop+=this._clipTextTop-_,_=this._clipTextTop,this._markAsDirty()):_+this._fontOffset.height>this._clipTextTop+this._availableHeight&&(this._scrollTop+=this._clipTextTop+this._availableHeight-_-this._fontOffset.height,_=this._clipTextTop+this._availableHeight-this._fontOffset.height,this._markAsDirty()),this._isTextHighlightOn||t.fillRect(l,_,2,this._fontOffset.height)}if(this._resetBlinking(),this._isTextHighlightOn){clearTimeout(this._blinkTimeout),this._highlightedText=this.text.substring(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex),t.globalAlpha=this._highligherOpacity,t.fillStyle=this._textHighlightColor;var h=Math.min(this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialLineIndex),c=Math.max(this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialLineIndex),u=this._scrollTop+h*this._fontOffset.height;for(a=h;a<=c;a++){s=this._lines[a];var d=this._scrollLeft;switch(this._textHorizontalAlignment){case y.HORIZONTAL_ALIGNMENT_LEFT:d+=0;break;case y.HORIZONTAL_ALIGNMENT_RIGHT:d+=n-s.width;break;case y.HORIZONTAL_ALIGNMENT_CENTER:d+=(n-s.width)/2}var f=a===h?this._cursorInfo.relativeStartIndex:0,p=a===c?this._cursorInfo.relativeEndIndex:s.text.length,g=t.measureText(s.text.substr(0,f)).width,b=s.text.substring(f,p),m=t.measureText(b).width;t.fillRect(d+g,u,m,this._fontOffset.height),u+=this._fontOffset.height}this._cursorInfo.globalEndIndex===this._cursorInfo.globalStartIndex&&this._resetBlinking()}}t.restore(),this._thickness&&(this._isFocused?this.focusedColor&&(t.strokeStyle=this.focusedColor):this.color&&(t.strokeStyle=this.color),t.lineWidth=this._thickness,t.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,this._currentMeasure.width-this._thickness,this._currentMeasure.height-this._thickness))},e.prototype._resetBlinking=function(){var t=this;clearTimeout(this._blinkTimeout),this._blinkTimeout=setTimeout((function(){t._blinkIsEven=!t._blinkIsEven,t._markAsDirty()}),500)},e.prototype._applyStates=function(e){t.prototype._applyStates.call(this,e),this.outlineWidth&&(e.lineWidth=this.outlineWidth,e.strokeStyle=this.outlineColor)},e.prototype._onPointerDown=function(e,i,o,n,r){return!(!t.prototype._onPointerDown.call(this,e,i,o,n,r)||(this._clickedCoordinateX=i.x,this._clickedCoordinateY=i.y,this._isTextHighlightOn=!1,this._highlightedText="",this._isPointerDown=!0,this._host._capturingControl[o]=this,this._host.focusedControl===this?(clearTimeout(this._blinkTimeout),this._markAsDirty(),0):!this._isEnabled||(this._host.focusedControl=this,0)))},e.prototype._onPointerMove=function(e,i,o,n){0===n.event.movementX&&0===n.event.movementY||(this._host.focusedControl===this&&this._isPointerDown&&(this._clickedCoordinateX=i.x,this._clickedCoordinateY=i.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()),t.prototype._onPointerMove.call(this,e,i,o,n))},e.prototype._updateCursorPosition=function(){var t;if(this._isFocused)if(this._clickedCoordinateX&&this._clickedCoordinateY){this._isTextHighlightOn||(this._cursorInfo={globalStartIndex:0,globalEndIndex:0,relativeStartIndex:0,relativeEndIndex:0,currentLineIndex:0});var e=0,i=0,o=this._clickedCoordinateY-this._scrollTop,n=Math.floor(o/this._fontOffset.height);this._cursorInfo.currentLineIndex=Math.min(Math.max(n,0),this._lines.length-1);for(var r=0,a=this._clickedCoordinateX-(null!==(t=this._scrollLeft)&&void 0!==t?t:0),s=0,l=0;l<this._cursorInfo.currentLineIndex;l++){var _=this._lines[l];e+=_.text.length+_.lineEnding.length}for(;r<a&&this._lines[this._cursorInfo.currentLineIndex].text.length>i;)i++,s=Math.abs(a-r),r=this._contextForBreakLines.measureText(this._lines[this._cursorInfo.currentLineIndex].text.substr(0,i)).width;Math.abs(a-r)>s&&i>0&&i--,e+=i,this._isTextHighlightOn?e<this._highlightCursorInfo.initialStartIndex?(this._cursorInfo.globalStartIndex=e,this._cursorInfo.relativeStartIndex=i,this._cursorInfo.globalEndIndex=this._highlightCursorInfo.initialStartIndex,this._cursorInfo.relativeEndIndex=this._highlightCursorInfo.initialRelativeStartIndex):(this._cursorInfo.globalStartIndex=this._highlightCursorInfo.initialStartIndex,this._cursorInfo.relativeStartIndex=this._highlightCursorInfo.initialRelativeStartIndex,this._cursorInfo.globalEndIndex=e,this._cursorInfo.relativeEndIndex=i):(this._cursorInfo.globalStartIndex=e,this._cursorInfo.relativeStartIndex=i,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._cursorInfo.relativeEndIndex=this._cursorInfo.relativeStartIndex),this._blinkIsEven=this._isTextHighlightOn,this._clickedCoordinateX=null,this._clickedCoordinateY=null}else{this._cursorInfo.relativeStartIndex=0,this._cursorInfo.currentLineIndex=0;for(var h=this._lines[this._cursorInfo.currentLineIndex].text.length+this._lines[this._cursorInfo.currentLineIndex].lineEnding.length,c=0;c+h<=this._cursorInfo.globalStartIndex;)c+=h,this._cursorInfo.currentLineIndex<this._lines.length-1&&(this._cursorInfo.currentLineIndex++,h=this._lines[this._cursorInfo.currentLineIndex].text.length+this._lines[this._cursorInfo.currentLineIndex].lineEnding.length);if(this._cursorInfo.relativeStartIndex=this._cursorInfo.globalStartIndex-c,-1!==this._highlightCursorInfo.initialStartIndex&&this._cursorInfo.globalStartIndex>=this._highlightCursorInfo.initialStartIndex){for(;c+h<=this._cursorInfo.globalEndIndex;)c+=h,this._cursorInfo.currentLineIndex<this._lines.length-1&&(this._cursorInfo.currentLineIndex++,h=this._lines[this._cursorInfo.currentLineIndex].text.length+this._lines[this._cursorInfo.currentLineIndex].lineEnding.length);this._cursorInfo.relativeEndIndex=this._cursorInfo.globalEndIndex-c}else this._isTextHighlightOn||(this._cursorInfo.relativeEndIndex=this._cursorInfo.relativeStartIndex,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex)}},e.prototype._updateValueFromCursorIndex=function(t){},e.prototype._processDblClick=function(t){var e,i;do{e=this._cursorInfo.globalStartIndex>0&&this._textWrapper.isWord(this._cursorInfo.globalStartIndex-1)?--this._cursorInfo.globalStartIndex:0,i=this._cursorInfo.globalEndIndex<this._textWrapper.length&&this._textWrapper.isWord(this._cursorInfo.globalEndIndex)?++this._cursorInfo.globalEndIndex:0}while(e||i);this._highlightCursorInfo.initialLineIndex=this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialStartIndex=this._cursorInfo.globalStartIndex,this.onTextHighlightObservable.notifyObservers(this),this._isTextHighlightOn=!0,this._blinkIsEven=!0,this._markAsDirty()},e.prototype._selectAllText=function(){this._isTextHighlightOn=!0,this._blinkIsEven=!0,this._highlightCursorInfo={initialStartIndex:0,initialRelativeStartIndex:0,initialLineIndex:0},this._cursorInfo={globalStartIndex:0,globalEndIndex:this._textWrapper.length,relativeEndIndex:this._lines[this._lines.length-1].text.length,relativeStartIndex:0,currentLineIndex:this._lines.length-1},this._markAsDirty()},e.prototype.dipose=function(){t.prototype.dispose.call(this),this.onLinesReadyObservable.clear()},s([(0,h.serialize)()],e.prototype,"autoStretchHeight",null),s([(0,h.serialize)()],e.prototype,"maxHeight",null),e}(w);(0,h.RegisterClass)("BABYLON.GUI.InputTextArea",L);var k=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype._getTypeName=function(){return"InputPassword"},e.prototype._beforeRenderText=function(t){for(var e=new R,i="",o=0;o<t.length;o++)i+="•";return e.text=i,e},e}(w);(0,h.RegisterClass)("BABYLON.GUI.InputPassword",k);var N=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._lineWidth=1,i._x1=new c(0),i._y1=new c(0),i._x2=new c(0),i._y2=new c(0),i._dash=new Array,i._automaticSize=!0,i.isHitTestVisible=!1,i._horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,i._verticalAlignment=y.VERTICAL_ALIGNMENT_TOP,i}return r(e,t),Object.defineProperty(e.prototype,"dash",{get:function(){return this._dash},set:function(t){this._dash!==t&&(this._dash=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"connectedControl",{get:function(){return this._connectedControl},set:function(t){var e=this;this._connectedControl!==t&&(this._connectedControlDirtyObserver&&this._connectedControl&&(this._connectedControl.onDirtyObservable.remove(this._connectedControlDirtyObserver),this._connectedControlDirtyObserver=null),t&&(this._connectedControlDirtyObserver=t.onDirtyObservable.add((function(){return e._markAsDirty()}))),this._connectedControl=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"x1",{get:function(){return this._x1.toString(this._host)},set:function(t){this._x1.toString(this._host)!==t&&this._x1.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y1",{get:function(){return this._y1.toString(this._host)},set:function(t){this._y1.toString(this._host)!==t&&this._y1.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"x2",{get:function(){return this._x2.toString(this._host)},set:function(t){this._x2.toString(this._host)!==t&&this._x2.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y2",{get:function(){return this._y2.toString(this._host)},set:function(t){this._y2.toString(this._host)!==t&&this._y2.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lineWidth",{get:function(){return this._lineWidth},set:function(t){this._lineWidth!==t&&(this._lineWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"horizontalAlignment",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"verticalAlignment",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_effectiveX2",{get:function(){return(this._connectedControl?this._connectedControl.centerX:0)+this._x2.getValue(this._host)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_effectiveY2",{get:function(){return(this._connectedControl?this._connectedControl.centerY:0)+this._y2.getValue(this._host)},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"Line"},e.prototype._draw=function(t){t.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),this._applyStates(t),t.strokeStyle=this._getColor(t),t.lineWidth=this._lineWidth,t.setLineDash(this._dash),t.beginPath(),t.moveTo(this._cachedParentMeasure.left+this._x1.getValue(this._host),this._cachedParentMeasure.top+this._y1.getValue(this._host)),t.lineTo(this._cachedParentMeasure.left+this._effectiveX2,this._cachedParentMeasure.top+this._effectiveY2),t.stroke(),t.restore()},e.prototype._measure=function(){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},e.prototype._computeAlignment=function(t){this._currentMeasure.left=t.left+Math.min(this._x1.getValue(this._host),this._effectiveX2)-this._lineWidth/2,this._currentMeasure.top=t.top+Math.min(this._y1.getValue(this._host),this._effectiveY2)-this._lineWidth/2},e.prototype.moveToVector3=function(t,e,i){if(void 0===i&&(i=!1),this._host&&this.parent===this._host._rootContainer){var o=this._host._getGlobalViewport(),n=h.Vector3.Project(t,h.Matrix.Identity(),e.getTransformMatrix(),o);this._moveToProjectedPosition(n,i),n.z<0||n.z>1?this.notRenderable=!0:this.notRenderable=!1}else h.Tools.Error("Cannot move a control to a vector3 if the control is not at root level")},e.prototype._moveToProjectedPosition=function(t,e){void 0===e&&(e=!1);var i=t.x+this._linkOffsetX.getValue(this._host)+"px",o=t.y+this._linkOffsetY.getValue(this._host)+"px";e?(this.x2=i,this.y2=o,this._x2.ignoreAdaptiveScaling=!0,this._y2.ignoreAdaptiveScaling=!0):(this.x1=i,this.y1=o,this._x1.ignoreAdaptiveScaling=!0,this._y1.ignoreAdaptiveScaling=!0)},s([(0,h.serialize)()],e.prototype,"dash",null),s([(0,h.serialize)()],e.prototype,"x1",null),s([(0,h.serialize)()],e.prototype,"y1",null),s([(0,h.serialize)()],e.prototype,"x2",null),s([(0,h.serialize)()],e.prototype,"y2",null),s([(0,h.serialize)()],e.prototype,"lineWidth",null),e}(y);(0,h.RegisterClass)("BABYLON.GUI.Line",N);var A=function(){function t(t){this._multiLine=t,this._x=new c(0),this._y=new c(0),this._point=new h.Vector3(0,0,0)}return Object.defineProperty(t.prototype,"x",{get:function(){return this._x.toString(this._multiLine._host)},set:function(t){this._x.toString(this._multiLine._host)!==t&&this._x.fromString(t)&&this._multiLine._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this._y.toString(this._multiLine._host)},set:function(t){this._y.toString(this._multiLine._host)!==t&&this._y.fromString(t)&&this._multiLine._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"control",{get:function(){return this._control},set:function(t){this._control!==t&&(this._control&&this._controlObserver&&(this._control.onDirtyObservable.remove(this._controlObserver),this._controlObserver=null),this._control=t,this._control&&(this._controlObserver=this._control.onDirtyObservable.add(this._multiLine.onPointUpdate)),this._multiLine._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mesh",{get:function(){return this._mesh},set:function(t){this._mesh!==t&&(this._mesh&&this._meshObserver&&this._mesh.getScene().onAfterCameraRenderObservable.remove(this._meshObserver),this._mesh=t,this._mesh&&(this._meshObserver=this._mesh.getScene().onAfterCameraRenderObservable.add(this._multiLine.onPointUpdate)),this._multiLine._markAsDirty())},enumerable:!1,configurable:!0}),t.prototype.resetLinks=function(){this.control=null,this.mesh=null},t.prototype.translate=function(){return this._point=this._translatePoint(),this._point},t.prototype._translatePoint=function(){if(null!=this._mesh)return this._multiLine._host.getProjectedPositionWithZ(this._mesh.getBoundingInfo().boundingSphere.center,this._mesh.getWorldMatrix());if(null!=this._control)return new h.Vector3(this._control.centerX,this._control.centerY,1-h.Epsilon);var t=this._multiLine._host,e=this._x.getValueInPixel(t,Number(t._canvas.width)),i=this._y.getValueInPixel(t,Number(t._canvas.height));return new h.Vector3(e,i,1-h.Epsilon)},t.prototype.dispose=function(){this.resetLinks()},t}(),z=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._lineWidth=1,i.onPointUpdate=function(){i._markAsDirty()},i._automaticSize=!0,i.isHitTestVisible=!1,i._horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,i._verticalAlignment=y.VERTICAL_ALIGNMENT_TOP,i._dash=[],i._points=[],i}return r(e,t),Object.defineProperty(e.prototype,"dash",{get:function(){return this._dash},set:function(t){this._dash!==t&&(this._dash=t,this._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype.getAt=function(t){return this._points[t]||(this._points[t]=new A(this)),this._points[t]},e.prototype.add=function(){for(var t=this,e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return e.map((function(e){return t.push(e)}))},e.prototype.push=function(t){var e=this.getAt(this._points.length);return null==t||(t instanceof h.AbstractMesh?e.mesh=t:t instanceof y?e.control=t:null!=t.x&&null!=t.y&&(e.x=t.x,e.y=t.y)),e},e.prototype.remove=function(t){var e;if(t instanceof A){if(-1===(e=this._points.indexOf(t)))return}else e=t;var i=this._points[e];i&&(i.dispose(),this._points.splice(e,1))},e.prototype.reset=function(){for(;this._points.length>0;)this.remove(this._points.length-1)},e.prototype.resetLinks=function(){this._points.forEach((function(t){null!=t&&t.resetLinks()}))},Object.defineProperty(e.prototype,"lineWidth",{get:function(){return this._lineWidth},set:function(t){this._lineWidth!==t&&(this._lineWidth=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"horizontalAlignment",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"verticalAlignment",{set:function(t){},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"MultiLine"},e.prototype._draw=function(t){t.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),this._applyStates(t),t.strokeStyle=this.color,t.lineWidth=this._lineWidth,t.setLineDash(this._dash),t.beginPath();var e,i=!0;this._points.forEach((function(o){o&&(i?(t.moveTo(o._point.x,o._point.y),i=!1):o._point.z<1&&e.z<1?t.lineTo(o._point.x,o._point.y):t.moveTo(o._point.x,o._point.y),e=o._point)})),t.stroke(),t.restore()},e.prototype._additionalProcessing=function(){var t=this;this._minX=null,this._minY=null,this._maxX=null,this._maxY=null,this._points.forEach((function(e){e&&(e.translate(),(null==t._minX||e._point.x<t._minX)&&(t._minX=e._point.x),(null==t._minY||e._point.y<t._minY)&&(t._minY=e._point.y),(null==t._maxX||e._point.x>t._maxX)&&(t._maxX=e._point.x),(null==t._maxY||e._point.y>t._maxY)&&(t._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)},e.prototype._measure=function(){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)},e.prototype._computeAlignment=function(){null!=this._minX&&null!=this._minY&&(this._currentMeasure.left=this._minX-this._lineWidth/2,this._currentMeasure.top=this._minY-this._lineWidth/2)},e.prototype.dispose=function(){this.reset(),t.prototype.dispose.call(this)},s([(0,h.serialize)()],e.prototype,"dash",null),e}(y);(0,h.RegisterClass)("BABYLON.GUI.MultiLine",z);var Q=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._isChecked=!1,i._background="black",i._checkSizeRatio=.8,i._thickness=1,i.group="",i.onIsCheckedChangedObservable=new h.Observable,i.isPointerBlocker=!0,i}return r(e,t),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness!==t&&(this._thickness=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"checkSizeRatio",{get:function(){return this._checkSizeRatio},set:function(t){t=Math.max(Math.min(1,t),0),this._checkSizeRatio!==t&&(this._checkSizeRatio=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isChecked",{get:function(){return this._isChecked},set:function(t){var e=this;this._isChecked!==t&&(this._isChecked=t,this._markAsDirty(),this.onIsCheckedChangedObservable.notifyObservers(t),this._isChecked&&this._host&&this._host.executeOnAllControls((function(t){if(t!==e&&void 0!==t.group){var i=t;i.group===e.group&&(i.isChecked=!1)}})))},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"RadioButton"},e.prototype._draw=function(t){t.save(),this._applyStates(t);var e=this._currentMeasure.width-this._thickness,i=this._currentMeasure.height-this._thickness;if((this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),y.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,t),t.fillStyle=this._isEnabled?this._background:this._disabledColor,t.fill(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),t.strokeStyle=this.color,t.lineWidth=this._thickness,t.stroke(),this._isChecked){t.fillStyle=this._isEnabled?this.color:this._disabledColor;var o=e*this._checkSizeRatio,n=i*this._checkSizeRatio;y.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,o/2-this._thickness/2,n/2-this._thickness/2,t),t.fill()}t.restore()},e.prototype._onPointerDown=function(e,i,o,n,r){return!!t.prototype._onPointerDown.call(this,e,i,o,n,r)&&(this.isReadOnly||this.isChecked||(this.isChecked=!0),!0)},e.AddRadioButtonWithHeader=function(t,i,o,n){var r=new S;r.isVertical=!1,r.height="30px";var a=new e;a.width="20px",a.height="20px",a.isChecked=o,a.color="green",a.group=i,a.onIsCheckedChangedObservable.add((function(t){return n(a,t)})),r.addControl(a);var s=new B;return s.text=t,s.width="180px",s.paddingLeft="5px",s.textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,s.color="white",r.addControl(s),r},s([(0,h.serialize)()],e.prototype,"thickness",null),s([(0,h.serialize)()],e.prototype,"group",void 0),s([(0,h.serialize)()],e.prototype,"checkSizeRatio",null),s([(0,h.serialize)()],e.prototype,"background",null),s([(0,h.serialize)()],e.prototype,"isChecked",null),e}(y);(0,h.RegisterClass)("BABYLON.GUI.RadioButton",Q);var V=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._thumbWidth=new c(20,c.UNITMODE_PIXEL,!1),i._minimum=0,i._maximum=100,i._value=50,i._isVertical=!1,i._barOffset=new c(5,c.UNITMODE_PIXEL,!1),i._isThumbClamped=!1,i._displayThumb=!0,i._step=0,i._lastPointerDownId=-1,i._effectiveBarOffset=0,i.onValueChangedObservable=new h.Observable,i._pointerIsDown=!1,i.isPointerBlocker=!0,i}return r(e,t),Object.defineProperty(e.prototype,"displayThumb",{get:function(){return this._displayThumb},set:function(t){this._displayThumb!==t&&(this._displayThumb=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"step",{get:function(){return this._step},set:function(t){this._step!==t&&(this._step=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"barOffset",{get:function(){return this._barOffset.toString(this._host)},set:function(t){this._barOffset.toString(this._host)!==t&&this._barOffset.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"barOffsetInPixels",{get:function(){return this._barOffset.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thumbWidth",{get:function(){return this._thumbWidth.toString(this._host)},set:function(t){this._thumbWidth.toString(this._host)!==t&&this._thumbWidth.fromString(t)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thumbWidthInPixels",{get:function(){return this._thumbWidth.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"minimum",{get:function(){return this._minimum},set:function(t){this._minimum!==t&&(this._minimum=t,this._markAsDirty(),this.value=Math.max(Math.min(this.value,this._maximum),this._minimum))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maximum",{get:function(){return this._maximum},set:function(t){this._maximum!==t&&(this._maximum=t,this._markAsDirty(),this.value=Math.max(Math.min(this.value,this._maximum),this._minimum))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(t){t=Math.max(Math.min(t,this._maximum),this._minimum),this._value!==t&&(this._value=t,this._markAsDirty(),this.onValueChangedObservable.notifyObservers(this._value))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isVertical",{get:function(){return this._isVertical},set:function(t){this._isVertical!==t&&(this._isVertical=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isThumbClamped",{get:function(){return this._isThumbClamped},set:function(t){this._isThumbClamped!==t&&(this._isThumbClamped=t,this._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"BaseSlider"},e.prototype._getThumbPosition=function(){return this.isVertical?(this.maximum-this.value)/(this.maximum-this.minimum)*this._backgroundBoxLength:(this.value-this.minimum)/(this.maximum-this.minimum)*this._backgroundBoxLength},e.prototype._getThumbThickness=function(t){var e=0;switch(t){case"circle":e=this._thumbWidth.isPixel?Math.max(this._thumbWidth.getValue(this._host),this._backgroundBoxThickness):this._backgroundBoxThickness*this._thumbWidth.getValue(this._host);break;case"rectangle":e=this._thumbWidth.isPixel?Math.min(this._thumbWidth.getValue(this._host),this._backgroundBoxThickness):this._backgroundBoxThickness*this._thumbWidth.getValue(this._host)}return e},e.prototype._prepareRenderingData=function(t){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(t),this.displayThumb&&(this._backgroundBoxLength-=this._effectiveThumbThickness),this.isVertical&&this._currentMeasure.height<this._currentMeasure.width?console.error("Height should be greater than width"):(this._barOffset.isPixel?this._effectiveBarOffset=Math.min(this._barOffset.getValue(this._host),this._backgroundBoxThickness):this._effectiveBarOffset=this._backgroundBoxThickness*this._barOffset.getValue(this._host),this._backgroundBoxThickness-=2*this._effectiveBarOffset,this.isVertical?(this._renderLeft+=this._effectiveBarOffset,!this.isThumbClamped&&this.displayThumb&&(this._renderTop+=this._effectiveThumbThickness/2),this._renderHeight=this._backgroundBoxLength,this._renderWidth=this._backgroundBoxThickness):(this._renderTop+=this._effectiveBarOffset,!this.isThumbClamped&&this.displayThumb&&(this._renderLeft+=this._effectiveThumbThickness/2),this._renderHeight=this._backgroundBoxThickness,this._renderWidth=this._backgroundBoxLength))},e.prototype._updateValueFromPointer=function(t,e){var i;0!=this.rotation&&(this._invertTransformMatrix.transformCoordinates(t,e,this._transformedPosition),t=this._transformedPosition.x,e=this._transformedPosition.y),i=this._isVertical?this._minimum+(1-(e-this._currentMeasure.top)/this._currentMeasure.height)*(this._maximum-this._minimum):this._minimum+(t-this._currentMeasure.left)/this._currentMeasure.width*(this._maximum-this._minimum),this.value=this._step?Math.round(i/this._step)*this._step:i},e.prototype._onPointerDown=function(e,i,o,n,r){return!!t.prototype._onPointerDown.call(this,e,i,o,n,r)&&(this.isReadOnly||(this._pointerIsDown=!0,this._updateValueFromPointer(i.x,i.y),this._host._capturingControl[o]=this,this._lastPointerDownId=o),!0)},e.prototype._onPointerMove=function(e,i,o,n){o==this._lastPointerDownId&&(this._pointerIsDown&&!this.isReadOnly&&this._updateValueFromPointer(i.x,i.y),t.prototype._onPointerMove.call(this,e,i,o,n))},e.prototype._onPointerUp=function(e,i,o,n,r){this._pointerIsDown=!1,delete this._host._capturingControl[o],t.prototype._onPointerUp.call(this,e,i,o,n,r)},e.prototype._onCanvasBlur=function(){this._forcePointerUp(),t.prototype._onCanvasBlur.call(this)},s([(0,h.serialize)()],e.prototype,"displayThumb",null),s([(0,h.serialize)()],e.prototype,"step",null),s([(0,h.serialize)()],e.prototype,"barOffset",null),s([(0,h.serialize)()],e.prototype,"thumbWidth",null),s([(0,h.serialize)()],e.prototype,"minimum",null),s([(0,h.serialize)()],e.prototype,"maximum",null),s([(0,h.serialize)()],e.prototype,"value",null),s([(0,h.serialize)()],e.prototype,"isVertical",null),s([(0,h.serialize)()],e.prototype,"isThumbClamped",null),e}(y),W=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._background="black",i._borderColor="white",i._thumbColor="",i._isThumbCircle=!1,i._displayValueBar=!0,i._backgroundGradient=null,i}return r(e,t),Object.defineProperty(e.prototype,"displayValueBar",{get:function(){return this._displayValueBar},set:function(t){this._displayValueBar!==t&&(this._displayValueBar=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"borderColor",{get:function(){return this._borderColor},set:function(t){this._borderColor!==t&&(this._borderColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backgroundGradient",{get:function(){return this._backgroundGradient},set:function(t){this._backgroundGradient!==t&&(this._backgroundGradient=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thumbColor",{get:function(){return this._thumbColor},set:function(t){this._thumbColor!==t&&(this._thumbColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isThumbCircle",{get:function(){return this._isThumbCircle},set:function(t){this._isThumbCircle!==t&&(this._isThumbCircle=t,this._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"Slider"},e.prototype._getBackgroundColor=function(t){return this._backgroundGradient?this._backgroundGradient.getCanvasGradient(t):this._background},e.prototype._draw=function(t){t.save(),this._applyStates(t),this._prepareRenderingData(this.isThumbCircle?"circle":"rectangle");var e=this._renderLeft,i=this._renderTop,o=this._renderWidth,n=this._renderHeight,r=0;this.isThumbClamped&&this.isThumbCircle?(this.isVertical?i+=this._effectiveThumbThickness/2:e+=this._effectiveThumbThickness/2,r=this._backgroundBoxThickness/2):r=(this._effectiveThumbThickness-this._effectiveBarOffset)/2,(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY);var a=this._getThumbPosition();t.fillStyle=this._getBackgroundColor(t),this.isVertical?this.isThumbClamped?this.isThumbCircle?(t.beginPath(),t.arc(e+this._backgroundBoxThickness/2,i,r,Math.PI,2*Math.PI),t.fill(),t.fillRect(e,i,o,n)):t.fillRect(e,i,o,n+this._effectiveThumbThickness):t.fillRect(e,i,o,n):this.isThumbClamped?this.isThumbCircle?(t.beginPath(),t.arc(e+this._backgroundBoxLength,i+this._backgroundBoxThickness/2,r,0,2*Math.PI),t.fill(),t.fillRect(e,i,o,n)):t.fillRect(e,i,o+this._effectiveThumbThickness,n):t.fillRect(e,i,o,n),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),t.fillStyle=this._getColor(t),this._displayValueBar&&(this.isVertical?this.isThumbClamped?this.isThumbCircle?(t.beginPath(),t.arc(e+this._backgroundBoxThickness/2,i+this._backgroundBoxLength,r,0,2*Math.PI),t.fill(),t.fillRect(e,i+a,o,n-a)):t.fillRect(e,i+a,o,n-a+this._effectiveThumbThickness):t.fillRect(e,i+a,o,n-a):this.isThumbClamped&&this.isThumbCircle?(t.beginPath(),t.arc(e,i+this._backgroundBoxThickness/2,r,0,2*Math.PI),t.fill(),t.fillRect(e,i,a,n)):t.fillRect(e,i,a,n)),t.fillStyle=this._thumbColor||this._getColor(t),this.displayThumb&&((this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),this._isThumbCircle?(t.beginPath(),this.isVertical?t.arc(e+this._backgroundBoxThickness/2,i+a,r,0,2*Math.PI):t.arc(e+a,i+this._backgroundBoxThickness/2,r,0,2*Math.PI),t.fill(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),t.strokeStyle=this._borderColor,t.stroke()):(this.isVertical?t.fillRect(e-this._effectiveBarOffset,this._currentMeasure.top+a,this._currentMeasure.width,this._effectiveThumbThickness):t.fillRect(this._currentMeasure.left+a,this._currentMeasure.top,this._effectiveThumbThickness,this._currentMeasure.height),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),t.strokeStyle=this._borderColor,this.isVertical?t.strokeRect(e-this._effectiveBarOffset,this._currentMeasure.top+a,this._currentMeasure.width,this._effectiveThumbThickness):t.strokeRect(this._currentMeasure.left+a,this._currentMeasure.top,this._effectiveThumbThickness,this._currentMeasure.height))),t.restore()},e.prototype.serialize=function(e){t.prototype.serialize.call(this,e),this.backgroundGradient&&(e.backgroundGradient={},this.backgroundGradient.serialize(e.backgroundGradient))},e.prototype._parseFromContent=function(e,i){if(t.prototype._parseFromContent.call(this,e,i),e.backgroundGradient){var o=h.Tools.Instantiate("BABYLON.GUI."+e.backgroundGradient.className);this.backgroundGradient=new o,this.backgroundGradient.parse(e.backgroundGradient)}},s([(0,h.serialize)()],e.prototype,"displayValueBar",null),s([(0,h.serialize)()],e.prototype,"borderColor",null),s([(0,h.serialize)()],e.prototype,"background",null),s([(0,h.serialize)()],e.prototype,"thumbColor",null),s([(0,h.serialize)()],e.prototype,"isThumbCircle",null),e}(V);(0,h.RegisterClass)("BABYLON.GUI.Slider",W);var H=function(){function t(t){this.name=t,this._groupPanel=new S,this._selectors=new Array,this._groupPanel.verticalAlignment=y.VERTICAL_ALIGNMENT_TOP,this._groupPanel.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,this._groupHeader=this._addGroupHeader(t)}return Object.defineProperty(t.prototype,"groupPanel",{get:function(){return this._groupPanel},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selectors",{get:function(){return this._selectors},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"header",{get:function(){return this._groupHeader.text},set:function(t){"label"!==this._groupHeader.text&&(this._groupHeader.text=t)},enumerable:!1,configurable:!0}),t.prototype._addGroupHeader=function(t){var e=new B("groupHead",t);return e.width=.9,e.height="30px",e.textWrapping=!0,e.color="black",e.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,e.textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,e.left="2px",this._groupPanel.addControl(e),e},t.prototype._getSelector=function(t){if(!(t<0||t>=this._selectors.length))return this._selectors[t]},t.prototype.removeSelector=function(t){t<0||t>=this._selectors.length||(this._groupPanel.removeControl(this._selectors[t]),this._selectors.splice(t,1))},t}(),G=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.addCheckbox=function(t,e,i){void 0===e&&(e=function(t){}),void 0===i&&(i=!1),i=i||!1;var o=new O;o.width="20px",o.height="20px",o.color="#364249",o.background="#CCCCCC",o.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,o.onIsCheckedChangedObservable.add((function(t){e(t)}));var n=y.AddHeader(o,t,"200px",{isHorizontal:!0,controlFirst:!0});n.height="30px",n.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,n.left="4px",this.groupPanel.addControl(n),this.selectors.push(n),o.isChecked=i,this.groupPanel.parent&&this.groupPanel.parent.parent&&(o.color=this.groupPanel.parent.parent.buttonColor,o.background=this.groupPanel.parent.parent.buttonBackground)},e.prototype._setSelectorLabel=function(t,e){this.selectors[t].children[1].text=e},e.prototype._setSelectorLabelColor=function(t,e){this.selectors[t].children[1].color=e},e.prototype._setSelectorButtonColor=function(t,e){this.selectors[t].children[0].color=e},e.prototype._setSelectorButtonBackground=function(t,e){this.selectors[t].children[0].background=e},e}(H),U=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._selectNb=0,e}return r(e,t),e.prototype.addRadio=function(t,e,i){void 0===e&&(e=function(t){}),void 0===i&&(i=!1);var o=this._selectNb++,n=new Q;n.name=t,n.width="20px",n.height="20px",n.color="#364249",n.background="#CCCCCC",n.group=this.name,n.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,n.onIsCheckedChangedObservable.add((function(t){t&&e(o)}));var r=y.AddHeader(n,t,"200px",{isHorizontal:!0,controlFirst:!0});r.height="30px",r.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,r.left="4px",this.groupPanel.addControl(r),this.selectors.push(r),n.isChecked=i,this.groupPanel.parent&&this.groupPanel.parent.parent&&(n.color=this.groupPanel.parent.parent.buttonColor,n.background=this.groupPanel.parent.parent.buttonBackground)},e.prototype._setSelectorLabel=function(t,e){this.selectors[t].children[1].text=e},e.prototype._setSelectorLabelColor=function(t,e){this.selectors[t].children[1].color=e},e.prototype._setSelectorButtonColor=function(t,e){this.selectors[t].children[0].color=e},e.prototype._setSelectorButtonBackground=function(t,e){this.selectors[t].children[0].background=e},e}(H),j=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.addSlider=function(t,e,i,o,n,r,a){void 0===e&&(e=function(t){}),void 0===i&&(i="Units"),void 0===o&&(o=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===a&&(a=function(t){return 0|t});var s=new W;s.name=i,s.value=r,s.minimum=o,s.maximum=n,s.width=.9,s.height="20px",s.color="#364249",s.background="#CCCCCC",s.borderColor="black",s.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,s.left="4px",s.paddingBottom="4px",s.onValueChangedObservable.add((function(t){s.parent.children[0].text=s.parent.children[0].name+": "+a(t)+" "+s.name,e(t)}));var l=y.AddHeader(s,t+": "+a(r)+" "+i,"30px",{isHorizontal:!1,controlFirst:!1});l.height="60px",l.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,l.left="4px",l.children[0].name=t,this.groupPanel.addControl(l),this.selectors.push(l),this.groupPanel.parent&&this.groupPanel.parent.parent&&(s.color=this.groupPanel.parent.parent.buttonColor,s.background=this.groupPanel.parent.parent.buttonBackground)},e.prototype._setSelectorLabel=function(t,e){this.selectors[t].children[0].name=e,this.selectors[t].children[0].text=e+": "+this.selectors[t].children[1].value+" "+this.selectors[t].children[1].name},e.prototype._setSelectorLabelColor=function(t,e){this.selectors[t].children[0].color=e},e.prototype._setSelectorButtonColor=function(t,e){this.selectors[t].children[1].color=e},e.prototype._setSelectorButtonBackground=function(t,e){this.selectors[t].children[1].background=e},e}(H),Y=function(t){function e(e,i){void 0===i&&(i=[]);var o=t.call(this,e)||this;if(o.name=e,o.groups=i,o._buttonColor="#364249",o._buttonBackground="#CCCCCC",o._headerColor="black",o._barColor="white",o._barHeight="2px",o._spacerHeight="20px",o._bars=new Array,o._groups=i,o.thickness=2,o._panel=new S,o._panel.verticalAlignment=y.VERTICAL_ALIGNMENT_TOP,o._panel.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,o._panel.top=5,o._panel.left=5,o._panel.width=.95,i.length>0){for(var n=0;n<i.length-1;n++)o._panel.addControl(i[n].groupPanel),o._addSpacer();o._panel.addControl(i[i.length-1].groupPanel)}return o.addControl(o._panel),o}return r(e,t),e.prototype._getTypeName=function(){return"SelectionPanel"},Object.defineProperty(e.prototype,"panel",{get:function(){return this._panel},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"headerColor",{get:function(){return this._headerColor},set:function(t){this._headerColor!==t&&(this._headerColor=t,this._setHeaderColor())},enumerable:!1,configurable:!0}),e.prototype._setHeaderColor=function(){for(var t=0;t<this._groups.length;t++)this._groups[t].groupPanel.children[0].color=this._headerColor},Object.defineProperty(e.prototype,"buttonColor",{get:function(){return this._buttonColor},set:function(t){this._buttonColor!==t&&(this._buttonColor=t,this._setbuttonColor())},enumerable:!1,configurable:!0}),e.prototype._setbuttonColor=function(){for(var t=0;t<this._groups.length;t++)for(var e=0;e<this._groups[t].selectors.length;e++)this._groups[t]._setSelectorButtonColor(e,this._buttonColor)},Object.defineProperty(e.prototype,"labelColor",{get:function(){return this._labelColor},set:function(t){this._labelColor!==t&&(this._labelColor=t,this._setLabelColor())},enumerable:!1,configurable:!0}),e.prototype._setLabelColor=function(){for(var t=0;t<this._groups.length;t++)for(var e=0;e<this._groups[t].selectors.length;e++)this._groups[t]._setSelectorLabelColor(e,this._labelColor)},Object.defineProperty(e.prototype,"buttonBackground",{get:function(){return this._buttonBackground},set:function(t){this._buttonBackground!==t&&(this._buttonBackground=t,this._setButtonBackground())},enumerable:!1,configurable:!0}),e.prototype._setButtonBackground=function(){for(var t=0;t<this._groups.length;t++)for(var e=0;e<this._groups[t].selectors.length;e++)this._groups[t]._setSelectorButtonBackground(e,this._buttonBackground)},Object.defineProperty(e.prototype,"barColor",{get:function(){return this._barColor},set:function(t){this._barColor!==t&&(this._barColor=t,this._setBarColor())},enumerable:!1,configurable:!0}),e.prototype._setBarColor=function(){for(var t=0;t<this._bars.length;t++)this._bars[t].children[0].background=this._barColor},Object.defineProperty(e.prototype,"barHeight",{get:function(){return this._barHeight},set:function(t){this._barHeight!==t&&(this._barHeight=t,this._setBarHeight())},enumerable:!1,configurable:!0}),e.prototype._setBarHeight=function(){for(var t=0;t<this._bars.length;t++)this._bars[t].children[0].height=this._barHeight},Object.defineProperty(e.prototype,"spacerHeight",{get:function(){return this._spacerHeight},set:function(t){this._spacerHeight!==t&&(this._spacerHeight=t,this._setSpacerHeight())},enumerable:!1,configurable:!0}),e.prototype._setSpacerHeight=function(){for(var t=0;t<this._bars.length;t++)this._bars[t].height=this._spacerHeight},e.prototype._addSpacer=function(){var t=new x;t.width=1,t.height=this._spacerHeight,t.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT;var e=new I;e.width=1,e.height=this._barHeight,e.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,e.verticalAlignment=y.VERTICAL_ALIGNMENT_CENTER,e.background=this._barColor,e.color="transparent",t.addControl(e),this._panel.addControl(t),this._bars.push(t)},e.prototype.addGroup=function(t){this._groups.length>0&&this._addSpacer(),this._panel.addControl(t.groupPanel),this._groups.push(t),t.groupPanel.children[0].color=this._headerColor;for(var e=0;e<t.selectors.length;e++)t._setSelectorButtonColor(e,this._buttonColor),t._setSelectorButtonBackground(e,this._buttonBackground)},e.prototype.removeGroup=function(t){if(!(t<0||t>=this._groups.length)){var e=this._groups[t];this._panel.removeControl(e.groupPanel),this._groups.splice(t,1),t<this._bars.length&&(this._panel.removeControl(this._bars[t]),this._bars.splice(t,1))}},e.prototype.setHeaderName=function(t,e){e<0||e>=this._groups.length||(this._groups[e].groupPanel.children[0].text=t)},e.prototype.relabel=function(t,e,i){if(!(e<0||e>=this._groups.length)){var o=this._groups[e];i<0||i>=o.selectors.length||o._setSelectorLabel(i,t)}},e.prototype.removeFromGroupSelector=function(t,e){if(!(t<0||t>=this._groups.length)){var i=this._groups[t];e<0||e>=i.selectors.length||i.removeSelector(e)}},e.prototype.addToGroupCheckbox=function(t,e,i,o){void 0===i&&(i=function(){}),void 0===o&&(o=!1),t<0||t>=this._groups.length||this._groups[t].addCheckbox(e,i,o)},e.prototype.addToGroupRadio=function(t,e,i,o){void 0===i&&(i=function(){}),void 0===o&&(o=!1),t<0||t>=this._groups.length||this._groups[t].addRadio(e,i,o)},e.prototype.addToGroupSlider=function(t,e,i,o,n,r,a,s){void 0===i&&(i=function(){}),void 0===o&&(o="Units"),void 0===n&&(n=0),void 0===r&&(r=0),void 0===a&&(a=0),void 0===s&&(s=function(t){return 0|t}),t<0||t>=this._groups.length||this._groups[t].addSlider(e,i,o,n,r,a,s)},e}(I),X=function(t){function e(e){var i=t.call(this,e)||this;return i._freezeControls=!1,i._bucketWidth=0,i._bucketHeight=0,i._buckets={},i}return r(e,t),Object.defineProperty(e.prototype,"freezeControls",{get:function(){return this._freezeControls},set:function(t){if(this._freezeControls!==t){t||this._restoreMeasures(),this._freezeControls=!1;var e=this.host.getSize(),i=e.width,o=e.height,n=this.host.getContext(),r=new g(0,0,i,o);this.host._numLayoutCalls=0,this.host._rootContainer._layout(r,n),t&&(this._updateMeasures(),this._useBuckets()&&this._makeBuckets()),this._freezeControls=t,this.host.markAsDirty()}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bucketWidth",{get:function(){return this._bucketWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bucketHeight",{get:function(){return this._bucketHeight},enumerable:!1,configurable:!0}),e.prototype.setBucketSizes=function(t,e){this._bucketWidth=t,this._bucketHeight=e,this._useBuckets()?this._freezeControls&&this._makeBuckets():this._buckets={}},e.prototype._useBuckets=function(){return this._bucketWidth>0&&this._bucketHeight>0},e.prototype._makeBuckets=function(){this._buckets={},this._bucketLen=Math.ceil(this.widthInPixels/this._bucketWidth),this._dispatchInBuckets(this._children),this._oldLeft=null,this._oldTop=null},e.prototype._dispatchInBuckets=function(t){for(var e=0;e<t.length;++e){for(var i=t[e],o=Math.max(0,Math.floor((i._customData._origLeft-this._customData.origLeft)/this._bucketWidth)),n=Math.floor((i._customData._origLeft-this._customData.origLeft+i._currentMeasure.width-1)/this._bucketWidth),r=Math.floor((i._customData._origTop-this._customData.origTop+i._currentMeasure.height-1)/this._bucketHeight),a=Math.max(0,Math.floor((i._customData._origTop-this._customData.origTop)/this._bucketHeight));a<=r;){for(var s=o;s<=n;++s){var l=a*this._bucketLen+s,_=this._buckets[l];_||(_=[],this._buckets[l]=_),_.push(i)}a++}i instanceof x&&i._children.length>0&&this._dispatchInBuckets(i._children)}},e.prototype._updateMeasures=function(){var t=0|this.leftInPixels,e=0|this.topInPixels;this._measureForChildren.left-=t,this._measureForChildren.top-=e,this._currentMeasure.left-=t,this._currentMeasure.top-=e,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,t,e)},e.prototype._updateChildrenMeasures=function(t,e,i){for(var o=0;o<t.length;++o){var n=t[o];n._currentMeasure.left-=e,n._currentMeasure.top-=i,n._customData._origLeft=n._currentMeasure.left,n._customData._origTop=n._currentMeasure.top,n instanceof x&&n._children.length>0&&this._updateChildrenMeasures(n._children,e,i)}},e.prototype._restoreMeasures=function(){var t=0|this.leftInPixels,e=0|this.topInPixels;this._measureForChildren.left=this._customData.origLeftForChildren+t,this._measureForChildren.top=this._customData.origTopForChildren+e,this._currentMeasure.left=this._customData.origLeft+t,this._currentMeasure.top=this._customData.origTop+e},e.prototype._getTypeName=function(){return"ScrollViewerWindow"},e.prototype._additionalProcessing=function(e,i){t.prototype._additionalProcessing.call(this,e,i),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},e.prototype._layout=function(e,i){return this._freezeControls?(this.invalidateRect(),!1):t.prototype._layout.call(this,e,i)},e.prototype._scrollChildren=function(t,e,i){for(var o=0;o<t.length;++o){var n=t[o];n._currentMeasure.left=n._customData._origLeft+e,n._currentMeasure.top=n._customData._origTop+i,n._isClipped=!1,n instanceof x&&n._children.length>0&&this._scrollChildren(n._children,e,i)}},e.prototype._scrollChildrenWithBuckets=function(t,e,i,o){for(var n=Math.max(0,Math.floor(-t/this._bucketWidth)),r=Math.floor((-t+this._parentMeasure.width-1)/this._bucketWidth),a=Math.floor((-e+this._parentMeasure.height-1)/this._bucketHeight),s=Math.max(0,Math.floor(-e/this._bucketHeight));s<=a;){for(var l=n;l<=r;++l){var _=s*this._bucketLen+l,h=this._buckets[_];if(h)for(var c=0;c<h.length;++c){var u=h[c];u._currentMeasure.left=u._customData._origLeft+i,u._currentMeasure.top=u._customData._origTop+o,u._isClipped=!1}}s++}},e.prototype._draw=function(e,i){if(this._freezeControls){this._localDraw(e),this.clipChildren&&this._clipForChildren(e);var o=0|this.leftInPixels,n=0|this.topInPixels;this._useBuckets()&&null!==this._oldLeft&&null!==this._oldTop?(this._scrollChildrenWithBuckets(this._oldLeft,this._oldTop,o,n),this._scrollChildrenWithBuckets(o,n,o,n)):this._scrollChildren(this._children,o,n),this._oldLeft=o,this._oldTop=n;for(var r=0,a=this._children;r<a.length;r++){var s=a[r];s._intersectsRect(this._parentMeasure)&&s._render(e,this._parentMeasure)}}else t.prototype._draw.call(this,e,i)},e.prototype._postMeasure=function(){if(this._freezeControls)t.prototype._postMeasure.call(this);else{for(var e=this.parentClientWidth,i=this.parentClientHeight,o=0,n=this.children;o<n.length;o++){var r=n[o];r.isVisible&&!r.notRenderable&&(r.horizontalAlignment===y.HORIZONTAL_ALIGNMENT_CENTER&&r._offsetLeft(this._currentMeasure.left-r._currentMeasure.left),r.verticalAlignment===y.VERTICAL_ALIGNMENT_CENTER&&r._offsetTop(this._currentMeasure.top-r._currentMeasure.top),e=Math.max(e,r._currentMeasure.left-this._currentMeasure.left+r._currentMeasure.width+r.paddingRightInPixels),i=Math.max(i,r._currentMeasure.top-this._currentMeasure.top+r._currentMeasure.height+r.paddingBottomInPixels))}this._currentMeasure.width!==e&&(this._width.updateInPlace(e,c.UNITMODE_PIXEL),this._currentMeasure.width=e,this._rebuildLayout=!0,this._isDirty=!0),this._currentMeasure.height!==i&&(this._height.updateInPlace(i,c.UNITMODE_PIXEL),this._currentMeasure.height=i,this._rebuildLayout=!0,this._isDirty=!0),t.prototype._postMeasure.call(this)}},e}(x),K=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._background="black",i._borderColor="white",i._tempMeasure=new g(0,0,0,0),i._invertScrollDirection=!1,i._backgroundGradient=null,i}return r(e,t),Object.defineProperty(e.prototype,"borderColor",{get:function(){return this._borderColor},set:function(t){this._borderColor!==t&&(this._borderColor=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backgroundGradient",{get:function(){return this._backgroundGradient},set:function(t){this._backgroundGradient!==t&&(this._backgroundGradient=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"invertScrollDirection",{get:function(){return this._invertScrollDirection},set:function(t){this._invertScrollDirection=t},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"Scrollbar"},e.prototype._getThumbThickness=function(){return this._thumbWidth.isPixel?this._thumbWidth.getValue(this._host):this._backgroundBoxThickness*this._thumbWidth.getValue(this._host)},e.prototype._getBackgroundColor=function(t){return this._backgroundGradient?this._backgroundGradient.getCanvasGradient(t):this._background},e.prototype._draw=function(t){t.save(),this._applyStates(t),this._prepareRenderingData("rectangle");var e=this._renderLeft,i=this._getThumbPosition();t.fillStyle=this._getBackgroundColor(t),t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height),t.fillStyle=this._getColor(t),this.isVertical?(this._tempMeasure.left=e-this._effectiveBarOffset,this._tempMeasure.top=this._currentMeasure.top+i,this._tempMeasure.width=this._currentMeasure.width,this._tempMeasure.height=this._effectiveThumbThickness):(this._tempMeasure.left=this._currentMeasure.left+i,this._tempMeasure.top=this._currentMeasure.top,this._tempMeasure.width=this._effectiveThumbThickness,this._tempMeasure.height=this._currentMeasure.height),t.fillRect(this._tempMeasure.left,this._tempMeasure.top,this._tempMeasure.width,this._tempMeasure.height),t.restore()},e.prototype._updateValueFromPointer=function(t,e){0!=this.rotation&&(this._invertTransformMatrix.transformCoordinates(t,e,this._transformedPosition),t=this._transformedPosition.x,e=this._transformedPosition.y);var i=this._invertScrollDirection?-1:1;this._first&&(this._first=!1,this._originX=t,this._originY=e,(t<this._tempMeasure.left||t>this._tempMeasure.left+this._tempMeasure.width||e<this._tempMeasure.top||e>this._tempMeasure.top+this._tempMeasure.height)&&(this.isVertical?this.value=this.minimum+(1-(e-this._currentMeasure.top)/this._currentMeasure.height)*(this.maximum-this.minimum):this.value=this.minimum+(t-this._currentMeasure.left)/this._currentMeasure.width*(this.maximum-this.minimum)));var o;o=this.isVertical?-(e-this._originY)/(this._currentMeasure.height-this._effectiveThumbThickness):(t-this._originX)/(this._currentMeasure.width-this._effectiveThumbThickness),this.value+=i*o*(this.maximum-this.minimum),this._originX=t,this._originY=e},e.prototype._onPointerDown=function(e,i,o,n,r){return this._first=!0,t.prototype._onPointerDown.call(this,e,i,o,n,r)},e.prototype.serialize=function(e){t.prototype.serialize.call(this,e),this.backgroundGradient&&(e.backgroundGradient={},this.backgroundGradient.serialize(e.backgroundGradient))},e.prototype._parseFromContent=function(e,i){if(t.prototype._parseFromContent.call(this,e,i),e.backgroundGradient){var o=h.Tools.Instantiate("BABYLON.GUI."+e.backgroundGradient.className);this.backgroundGradient=new o,this.backgroundGradient.parse(e.backgroundGradient)}},s([(0,h.serialize)()],e.prototype,"borderColor",null),s([(0,h.serialize)()],e.prototype,"background",null),s([(0,h.serialize)()],e.prototype,"invertScrollDirection",null),e}(V);(0,h.RegisterClass)("BABYLON.GUI.Scrollbar",K);var Z=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._thumbLength=.5,i._thumbHeight=1,i._barImageHeight=1,i._tempMeasure=new g(0,0,0,0),i._invertScrollDirection=!1,i.num90RotationInVerticalMode=1,i}return r(e,t),Object.defineProperty(e.prototype,"invertScrollDirection",{get:function(){return this._invertScrollDirection},set:function(t){this._invertScrollDirection=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backgroundImage",{get:function(){return this._backgroundBaseImage},set:function(t){var e=this;this._backgroundBaseImage!==t&&(this._backgroundBaseImage=t,this.isVertical&&0!==this.num90RotationInVerticalMode?t.isLoaded?(this._backgroundImage=t._rotate90(this.num90RotationInVerticalMode,!0),this._markAsDirty()):t.onImageLoadedObservable.addOnce((function(){var i=t._rotate90(e.num90RotationInVerticalMode,!0);e._backgroundImage=i,i.isLoaded||i.onImageLoadedObservable.addOnce((function(){e._markAsDirty()})),e._markAsDirty()})):(this._backgroundImage=t,t&&!t.isLoaded&&t.onImageLoadedObservable.addOnce((function(){e._markAsDirty()})),this._markAsDirty()))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thumbImage",{get:function(){return this._thumbBaseImage},set:function(t){var e=this;this._thumbBaseImage!==t&&(this._thumbBaseImage=t,this.isVertical&&0!==this.num90RotationInVerticalMode?t.isLoaded?(this._thumbImage=t._rotate90(-this.num90RotationInVerticalMode,!0),this._markAsDirty()):t.onImageLoadedObservable.addOnce((function(){var i=t._rotate90(-e.num90RotationInVerticalMode,!0);e._thumbImage=i,i.isLoaded||i.onImageLoadedObservable.addOnce((function(){e._markAsDirty()})),e._markAsDirty()})):(this._thumbImage=t,t&&!t.isLoaded&&t.onImageLoadedObservable.addOnce((function(){e._markAsDirty()})),this._markAsDirty()))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thumbLength",{get:function(){return this._thumbLength},set:function(t){this._thumbLength!==t&&(this._thumbLength=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thumbHeight",{get:function(){return this._thumbHeight},set:function(t){this._thumbLength!==t&&(this._thumbHeight=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"barImageHeight",{get:function(){return this._barImageHeight},set:function(t){this._barImageHeight!==t&&(this._barImageHeight=t,this._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"ImageScrollBar"},e.prototype._getThumbThickness=function(){return this._thumbWidth.isPixel?this._thumbWidth.getValue(this._host):this._backgroundBoxThickness*this._thumbWidth.getValue(this._host)},e.prototype._draw=function(t){t.save(),this._applyStates(t),this._prepareRenderingData("rectangle");var e=this._getThumbPosition(),i=this._renderLeft,o=this._renderTop,n=this._renderWidth,r=this._renderHeight;this._backgroundImage&&(this._tempMeasure.copyFromFloats(i,o,n,r),this.isVertical?(this._tempMeasure.copyFromFloats(i+n*(1-this._barImageHeight)*.5,this._currentMeasure.top,n*this._barImageHeight,r),this._tempMeasure.height+=this._effectiveThumbThickness,this._backgroundImage._currentMeasure.copyFrom(this._tempMeasure)):(this._tempMeasure.copyFromFloats(this._currentMeasure.left,o+r*(1-this._barImageHeight)*.5,n,r*this._barImageHeight),this._tempMeasure.width+=this._effectiveThumbThickness,this._backgroundImage._currentMeasure.copyFrom(this._tempMeasure)),this._backgroundImage._draw(t)),this.isVertical?this._tempMeasure.copyFromFloats(i-this._effectiveBarOffset+this._currentMeasure.width*(1-this._thumbHeight)*.5,this._currentMeasure.top+e,this._currentMeasure.width*this._thumbHeight,this._effectiveThumbThickness):this._tempMeasure.copyFromFloats(this._currentMeasure.left+e,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(t)),t.restore()},e.prototype._updateValueFromPointer=function(t,e){0!=this.rotation&&(this._invertTransformMatrix.transformCoordinates(t,e,this._transformedPosition),t=this._transformedPosition.x,e=this._transformedPosition.y);var i=this._invertScrollDirection?-1:1;this._first&&(this._first=!1,this._originX=t,this._originY=e,(t<this._tempMeasure.left||t>this._tempMeasure.left+this._tempMeasure.width||e<this._tempMeasure.top||e>this._tempMeasure.top+this._tempMeasure.height)&&(this.isVertical?this.value=this.minimum+(1-(e-this._currentMeasure.top)/this._currentMeasure.height)*(this.maximum-this.minimum):this.value=this.minimum+(t-this._currentMeasure.left)/this._currentMeasure.width*(this.maximum-this.minimum)));var o;o=this.isVertical?-(e-this._originY)/(this._currentMeasure.height-this._effectiveThumbThickness):(t-this._originX)/(this._currentMeasure.width-this._effectiveThumbThickness),this.value+=i*o*(this.maximum-this.minimum),this._originX=t,this._originY=e},e.prototype._onPointerDown=function(e,i,o,n,r){return this._first=!0,t.prototype._onPointerDown.call(this,e,i,o,n,r)},s([(0,h.serialize)()],e.prototype,"num90RotationInVerticalMode",void 0),s([(0,h.serialize)()],e.prototype,"invertScrollDirection",null),e}(V),q=function(t){function e(e,i){var o=t.call(this,e)||this;return o._barSize=20,o._pointerIsOver=!1,o._wheelPrecision=.05,o._thumbLength=.5,o._thumbHeight=1,o._barImageHeight=1,o._horizontalBarImageHeight=1,o._verticalBarImageHeight=1,o._oldWindowContentsWidth=0,o._oldWindowContentsHeight=0,o._forceHorizontalBar=!1,o._forceVerticalBar=!1,o._useImageBar=i||!1,o.onDirtyObservable.add((function(){o._horizontalBarSpace.color=o.color,o._verticalBarSpace.color=o.color,o._dragSpace.color=o.color})),o.onPointerEnterObservable.add((function(){o._pointerIsOver=!0})),o.onPointerOutObservable.add((function(){o._pointerIsOver=!1})),o._grid=new M,o._useImageBar?(o._horizontalBar=new Z,o._verticalBar=new Z):(o._horizontalBar=new K,o._verticalBar=new K),o._window=new X("scrollViewer_window"),o._window.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,o._window.verticalAlignment=y.VERTICAL_ALIGNMENT_TOP,o._grid.addColumnDefinition(1),o._grid.addColumnDefinition(0,!0),o._grid.addRowDefinition(1),o._grid.addRowDefinition(0,!0),t.prototype.addControl.call(o,o._grid),o._grid.addControl(o._window,0,0),o._verticalBarSpace=new I,o._verticalBarSpace.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,o._verticalBarSpace.verticalAlignment=y.VERTICAL_ALIGNMENT_TOP,o._verticalBarSpace.thickness=1,o._grid.addControl(o._verticalBarSpace,0,1),o._addBar(o._verticalBar,o._verticalBarSpace,!0,Math.PI),o._horizontalBarSpace=new I,o._horizontalBarSpace.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,o._horizontalBarSpace.verticalAlignment=y.VERTICAL_ALIGNMENT_TOP,o._horizontalBarSpace.thickness=1,o._grid.addControl(o._horizontalBarSpace,1,0),o._addBar(o._horizontalBar,o._horizontalBarSpace,!1,0),o._dragSpace=new I,o._dragSpace.thickness=1,o._grid.addControl(o._dragSpace,1,1),o._useImageBar||(o.barColor="grey",o.barBackground="transparent"),o}return r(e,t),Object.defineProperty(e.prototype,"horizontalBar",{get:function(){return this._horizontalBar},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"verticalBar",{get:function(){return this._verticalBar},enumerable:!1,configurable:!0}),e.prototype.addControl=function(t){return t?(this._window.addControl(t),this):this},e.prototype.removeControl=function(t){return this._window.removeControl(t),this},Object.defineProperty(e.prototype,"children",{get:function(){return this._window.children},enumerable:!1,configurable:!0}),e.prototype._flagDescendantsAsMatrixDirty=function(){for(var t=0,e=this._children;t<e.length;t++)e[t]._markMatrixAsDirty()},Object.defineProperty(e.prototype,"freezeControls",{get:function(){return this._window.freezeControls},set:function(t){this._window.freezeControls=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bucketWidth",{get:function(){return this._window.bucketWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bucketHeight",{get:function(){return this._window.bucketHeight},enumerable:!1,configurable:!0}),e.prototype.setBucketSizes=function(t,e){this._window.setBucketSizes(t,e)},Object.defineProperty(e.prototype,"forceHorizontalBar",{get:function(){return this._forceHorizontalBar},set:function(t){this._grid.setRowDefinition(1,t?this._barSize:0,!0),this._horizontalBar.isVisible=t,this._forceHorizontalBar=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"forceVerticalBar",{get:function(){return this._forceVerticalBar},set:function(t){this._grid.setColumnDefinition(1,t?this._barSize:0,!0),this._verticalBar.isVisible=t,this._forceVerticalBar=t},enumerable:!1,configurable:!0}),e.prototype.resetWindow=function(){this._window.width="100%",this._window.height="100%"},e.prototype._getTypeName=function(){return"ScrollViewer"},e.prototype._buildClientSizes=function(){var t=this.host.idealRatio;this._window.parentClientWidth=this._currentMeasure.width-(this._verticalBar.isVisible||this.forceVerticalBar?this._barSize*t:0)-2*this.thickness,this._window.parentClientHeight=this._currentMeasure.height-(this._horizontalBar.isVisible||this.forceHorizontalBar?this._barSize*t:0)-2*this.thickness,this._clientWidth=this._window.parentClientWidth,this._clientHeight=this._window.parentClientHeight},e.prototype._additionalProcessing=function(e,i){t.prototype._additionalProcessing.call(this,e,i),this._buildClientSizes()},e.prototype._postMeasure=function(){t.prototype._postMeasure.call(this),this._updateScroller(),this._setWindowPosition(!1)},Object.defineProperty(e.prototype,"wheelPrecision",{get:function(){return this._wheelPrecision},set:function(t){this._wheelPrecision!==t&&(t<0&&(t=0),t>1&&(t=1),this._wheelPrecision=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scrollBackground",{get:function(){return this._horizontalBarSpace.background},set:function(t){this._horizontalBarSpace.background!==t&&(this._horizontalBarSpace.background=t,this._verticalBarSpace.background=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"barColor",{get:function(){return this._barColor},set:function(t){this._barColor!==t&&(this._barColor=t,this._horizontalBar.color=t,this._verticalBar.color=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thumbImage",{get:function(){return this._barImage},set:function(t){if(this._barImage!==t){this._barImage=t;var e=this._horizontalBar,i=this._verticalBar;e.thumbImage=t,i.thumbImage=t}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"horizontalThumbImage",{get:function(){return this._horizontalBarImage},set:function(t){this._horizontalBarImage!==t&&(this._horizontalBarImage=t,this._horizontalBar.thumbImage=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"verticalThumbImage",{get:function(){return this._verticalBarImage},set:function(t){this._verticalBarImage!==t&&(this._verticalBarImage=t,this._verticalBar.thumbImage=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"barSize",{get:function(){return this._barSize},set:function(t){this._barSize!==t&&(this._barSize=t,this._markAsDirty(),this._horizontalBar.isVisible&&this._grid.setRowDefinition(1,this._barSize,!0),this._verticalBar.isVisible&&this._grid.setColumnDefinition(1,this._barSize,!0))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thumbLength",{get:function(){return this._thumbLength},set:function(t){if(this._thumbLength!==t){t<=0&&(t=.1),t>1&&(t=1),this._thumbLength=t;var e=this._horizontalBar,i=this._verticalBar;e.thumbLength=t,i.thumbLength=t,this._markAsDirty()}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thumbHeight",{get:function(){return this._thumbHeight},set:function(t){if(this._thumbHeight!==t){t<=0&&(t=.1),t>1&&(t=1),this._thumbHeight=t;var e=this._horizontalBar,i=this._verticalBar;e.thumbHeight=t,i.thumbHeight=t,this._markAsDirty()}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"barImageHeight",{get:function(){return this._barImageHeight},set:function(t){if(this._barImageHeight!==t){t<=0&&(t=.1),t>1&&(t=1),this._barImageHeight=t;var e=this._horizontalBar,i=this._verticalBar;e.barImageHeight=t,i.barImageHeight=t,this._markAsDirty()}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"horizontalBarImageHeight",{get:function(){return this._horizontalBarImageHeight},set:function(t){this._horizontalBarImageHeight!==t&&(t<=0&&(t=.1),t>1&&(t=1),this._horizontalBarImageHeight=t,this._horizontalBar.barImageHeight=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"verticalBarImageHeight",{get:function(){return this._verticalBarImageHeight},set:function(t){this._verticalBarImageHeight!==t&&(t<=0&&(t=.1),t>1&&(t=1),this._verticalBarImageHeight=t,this._verticalBar.barImageHeight=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"barBackground",{get:function(){return this._barBackground},set:function(t){if(this._barBackground!==t){this._barBackground=t;var e=this._horizontalBar,i=this._verticalBar;e.background=t,i.background=t,this._dragSpace.background=t}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"barImage",{get:function(){return this._barBackgroundImage},set:function(t){this._barBackgroundImage=t;var e=this._horizontalBar,i=this._verticalBar;e.backgroundImage=t,i.backgroundImage=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"horizontalBarImage",{get:function(){return this._horizontalBarBackgroundImage},set:function(t){this._horizontalBarBackgroundImage=t,this._horizontalBar.backgroundImage=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"verticalBarImage",{get:function(){return this._verticalBarBackgroundImage},set:function(t){this._verticalBarBackgroundImage=t,this._verticalBar.backgroundImage=t},enumerable:!1,configurable:!0}),e.prototype._setWindowPosition=function(t){void 0===t&&(t=!0);var e=this.host.idealRatio,i=this._window._currentMeasure.width,o=this._window._currentMeasure.height;if(t||this._oldWindowContentsWidth!==i||this._oldWindowContentsHeight!==o){this._oldWindowContentsWidth=i,this._oldWindowContentsHeight=o;var n=this._clientWidth-i,r=this._clientHeight-o,a=this._horizontalBar.value/e*n+"px",s=this._verticalBar.value/e*r+"px";a!==this._window.left&&(this._window.left=a,this.freezeControls||(this._rebuildLayout=!0)),s!==this._window.top&&(this._window.top=s,this.freezeControls||(this._rebuildLayout=!0))}},e.prototype._updateScroller=function(){var t=this._window._currentMeasure.width,e=this._window._currentMeasure.height;this._horizontalBar.isVisible&&t<=this._clientWidth&&!this.forceHorizontalBar?(this._grid.setRowDefinition(1,0,!0),this._horizontalBar.isVisible=!1,this._horizontalBar.value=0,this._rebuildLayout=!0):!this._horizontalBar.isVisible&&(t>this._clientWidth||this.forceHorizontalBar)&&(this._grid.setRowDefinition(1,this._barSize,!0),this._horizontalBar.isVisible=!0,this._rebuildLayout=!0),this._verticalBar.isVisible&&e<=this._clientHeight&&!this.forceVerticalBar?(this._grid.setColumnDefinition(1,0,!0),this._verticalBar.isVisible=!1,this._verticalBar.value=0,this._rebuildLayout=!0):!this._verticalBar.isVisible&&(e>this._clientHeight||this.forceVerticalBar)&&(this._grid.setColumnDefinition(1,this._barSize,!0),this._verticalBar.isVisible=!0,this._rebuildLayout=!0),this._buildClientSizes();var i=this.host.idealRatio;this._horizontalBar.thumbWidth=.9*this._thumbLength*(this._clientWidth/i)+"px",this._verticalBar.thumbWidth=.9*this._thumbLength*(this._clientHeight/i)+"px"},e.prototype._link=function(e){t.prototype._link.call(this,e),this._attachWheel()},e.prototype._addBar=function(t,e,i,o){var n=this;t.paddingLeft=0,t.width="100%",t.height="100%",t.barOffset=0,t.value=0,t.maximum=1,t.horizontalAlignment=y.HORIZONTAL_ALIGNMENT_CENTER,t.verticalAlignment=y.VERTICAL_ALIGNMENT_CENTER,t.isVertical=i,t.rotation=o,t.isVisible=!1,e.addControl(t),t.onValueChangedObservable.add((function(){n._setWindowPosition()}))},e.prototype._attachWheel=function(){var t=this;this._host&&!this._onWheelObserver&&(this._onWheelObserver=this.onWheelObservable.add((function(e){t._pointerIsOver&&!t.isReadOnly&&(1==t._verticalBar.isVisible&&(e.y<0&&t._verticalBar.value>0?t._verticalBar.value-=t._wheelPrecision:e.y>0&&t._verticalBar.value<t._verticalBar.maximum&&(t._verticalBar.value+=t._wheelPrecision)),1==t._horizontalBar.isVisible&&(e.x<0&&t._horizontalBar.value<t._horizontalBar.maximum?t._horizontalBar.value+=t._wheelPrecision:e.x>0&&t._horizontalBar.value>0&&(t._horizontalBar.value-=t._wheelPrecision)))})))},e.prototype._renderHighlightSpecific=function(e){this.isHighlighted&&(t.prototype._renderHighlightSpecific.call(this,e),this._grid._renderHighlightSpecific(e),e.restore())},e.prototype.dispose=function(){this.onWheelObservable.remove(this._onWheelObserver),this._onWheelObserver=null,t.prototype.dispose.call(this)},s([(0,h.serialize)()],e.prototype,"wheelPrecision",null),s([(0,h.serialize)()],e.prototype,"scrollBackground",null),s([(0,h.serialize)()],e.prototype,"barColor",null),s([(0,h.serialize)()],e.prototype,"barSize",null),s([(0,h.serialize)()],e.prototype,"barBackground",null),e}(I);(0,h.RegisterClass)("BABYLON.GUI.ScrollViewer",q);var J=function(t){function e(e,i){var o=t.call(this,e)||this;o.name=e,o.onIsActiveChangedObservable=new h.Observable,o.delegatePickingToChildren=!1,o._isActive=!1,o.group=null!=i?i:"",o.thickness=0,o.isPointerBlocker=!0;var n=null;return o.toActiveAnimation=function(){o.thickness=1},o.toInactiveAnimation=function(){o.thickness=0},o.pointerEnterActiveAnimation=function(){n=o.alpha,o.alpha-=.1},o.pointerOutActiveAnimation=function(){null!==n&&(o.alpha=n)},o.pointerDownActiveAnimation=function(){o.scaleX-=.05,o.scaleY-=.05},o.pointerUpActiveAnimation=function(){o.scaleX+=.05,o.scaleY+=.05},o.pointerEnterInactiveAnimation=function(){n=o.alpha,o.alpha-=.1},o.pointerOutInactiveAnimation=function(){null!==n&&(o.alpha=n)},o.pointerDownInactiveAnimation=function(){o.scaleX-=.05,o.scaleY-=.05},o.pointerUpInactiveAnimation=function(){o.scaleX+=.05,o.scaleY+=.05},o}return r(e,t),Object.defineProperty(e.prototype,"group",{get:function(){return this._group},set:function(t){this._group!==t&&(this._group=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isActive",{get:function(){return this._isActive},set:function(t){var e,i,o=this;this._isActive!==t&&(this._isActive=t,this._isActive?null===(e=this.toActiveAnimation)||void 0===e||e.call(this):null===(i=this.toInactiveAnimation)||void 0===i||i.call(this),this._markAsDirty(),this.onIsActiveChangedObservable.notifyObservers(t),this._isActive&&this._host&&this._group&&this._host.executeOnAllControls((function(t){if("ToggleButton"===t.typeName){if(t===o)return;var e=t;e.group===o.group&&(e.isActive=!1)}})))},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"ToggleButton"},e.prototype._processPicking=function(e,i,o,n,r,a,s,l){if(!this._isEnabled||!this.isHitTestVisible||!this.isVisible||this.notRenderable)return!1;if(!t.prototype.contains.call(this,e,i))return!1;if(this.delegatePickingToChildren){for(var _=!1,h=this._children.length-1;h>=0;h--){var c=this._children[h];if(c.isEnabled&&c.isHitTestVisible&&c.isVisible&&!c.notRenderable&&c.contains(e,i)){_=!0;break}}if(!_)return!1}return this._processObservables(n,e,i,o,r,a,s,l),!0},e.prototype._onPointerEnter=function(e,i){return!!t.prototype._onPointerEnter.call(this,e,i)&&(this.isReadOnly||(this._isActive?this.pointerEnterActiveAnimation&&this.pointerEnterActiveAnimation():this.pointerEnterInactiveAnimation&&this.pointerEnterInactiveAnimation()),!0)},e.prototype._onPointerOut=function(e,i,o){void 0===o&&(o=!1),this.isReadOnly||(this._isActive?this.pointerOutActiveAnimation&&this.pointerOutActiveAnimation():this.pointerOutInactiveAnimation&&this.pointerOutInactiveAnimation()),t.prototype._onPointerOut.call(this,e,i,o)},e.prototype._onPointerDown=function(e,i,o,n,r){return!!t.prototype._onPointerDown.call(this,e,i,o,n,r)&&(this.isReadOnly||(this._isActive?this.pointerDownActiveAnimation&&this.pointerDownActiveAnimation():this.pointerDownInactiveAnimation&&this.pointerDownInactiveAnimation()),!0)},e.prototype._onPointerUp=function(e,i,o,n,r,a){this.isReadOnly||(this._isActive?this.pointerUpActiveAnimation&&this.pointerUpActiveAnimation():this.pointerUpInactiveAnimation&&this.pointerUpInactiveAnimation()),t.prototype._onPointerUp.call(this,e,i,o,n,r,a)},e}(I);(0,h.RegisterClass)("BABYLON.GUI.ToggleButton",J);var $=function(){},tt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.onKeyPressObservable=new h.Observable,e.defaultButtonWidth="40px",e.defaultButtonHeight="40px",e.defaultButtonPaddingLeft="2px",e.defaultButtonPaddingRight="2px",e.defaultButtonPaddingTop="2px",e.defaultButtonPaddingBottom="2px",e.defaultButtonColor="#DDD",e.defaultButtonBackground="#070707",e.shiftButtonColor="#7799FF",e.selectedShiftThickness=1,e.shiftState=0,e._currentlyConnectedInputText=null,e._connectedInputTexts=[],e._onKeyPressObserver=null,e}return r(e,t),e.prototype._getTypeName=function(){return"VirtualKeyboard"},e.prototype._createKey=function(t,e){var i=this,o=T.CreateSimpleButton(t,t);return o.width=e&&e.width?e.width:this.defaultButtonWidth,o.height=e&&e.height?e.height:this.defaultButtonHeight,o.color=e&&e.color?e.color:this.defaultButtonColor,o.background=e&&e.background?e.background:this.defaultButtonBackground,o.paddingLeft=e&&e.paddingLeft?e.paddingLeft:this.defaultButtonPaddingLeft,o.paddingRight=e&&e.paddingRight?e.paddingRight:this.defaultButtonPaddingRight,o.paddingTop=e&&e.paddingTop?e.paddingTop:this.defaultButtonPaddingTop,o.paddingBottom=e&&e.paddingBottom?e.paddingBottom:this.defaultButtonPaddingBottom,o.thickness=0,o.isFocusInvisible=!0,o.shadowColor=this.shadowColor,o.shadowBlur=this.shadowBlur,o.shadowOffsetX=this.shadowOffsetX,o.shadowOffsetY=this.shadowOffsetY,o.onPointerUpObservable.add((function(){i.onKeyPressObservable.notifyObservers(t)})),o},e.prototype.addKeysRow=function(t,e){var i=new S;i.isVertical=!1,i.isFocusInvisible=!0;for(var o=null,n=0;n<t.length;n++){var r=null;e&&e.length===t.length&&(r=e[n]);var a=this._createKey(t[n],r);(!o||a.heightInPixels>o.heightInPixels)&&(o=a),i.addControl(a)}i.height=o?o.height:this.defaultButtonHeight,this.addControl(i)},e.prototype.applyShiftState=function(t){if(this.children)for(var e=0;e<this.children.length;e++){var i=this.children[e];if(i&&i.children)for(var o=i,n=0;n<o.children.length;n++){var r=o.children[n];if(r&&r.children[0]){var a=r.children[0];"⇧"===a.text&&(r.color=t?this.shiftButtonColor:this.defaultButtonColor,r.thickness=t>1?this.selectedShiftThickness:0),a.text=t>0?a.text.toUpperCase():a.text.toLowerCase()}}}},Object.defineProperty(e.prototype,"connectedInputText",{get:function(){return this._currentlyConnectedInputText},enumerable:!1,configurable:!0}),e.prototype.connect=function(t){var e=this;if(!this._connectedInputTexts.some((function(e){return e.input===t}))){null===this._onKeyPressObserver&&(this._onKeyPressObserver=this.onKeyPressObservable.add((function(t){if(e._currentlyConnectedInputText){switch(e._currentlyConnectedInputText._host.focusedControl=e._currentlyConnectedInputText,t){case"⇧":return e.shiftState++,e.shiftState>2&&(e.shiftState=0),void e.applyShiftState(e.shiftState);case"←":return void(e._currentlyConnectedInputText instanceof L?e._currentlyConnectedInputText.alternativeProcessKey("Backspace"):e._currentlyConnectedInputText.processKey(8));case"↵":return void(e._currentlyConnectedInputText instanceof L?e._currentlyConnectedInputText.alternativeProcessKey("Enter"):e._currentlyConnectedInputText.processKey(13))}e._currentlyConnectedInputText instanceof L?e._currentlyConnectedInputText.alternativeProcessKey("",e.shiftState?t.toUpperCase():t):e._currentlyConnectedInputText.processKey(-1,e.shiftState?t.toUpperCase():t),1===e.shiftState&&(e.shiftState=0,e.applyShiftState(e.shiftState))}}))),this.isVisible=!1,this._currentlyConnectedInputText=t,t._connectedVirtualKeyboard=this;var i=t.onFocusObservable.add((function(){e._currentlyConnectedInputText=t,t._connectedVirtualKeyboard=e,e.isVisible=!0})),o=t.onBlurObservable.add((function(){t._connectedVirtualKeyboard=null,e._currentlyConnectedInputText=null,e.isVisible=!1}));this._connectedInputTexts.push({input:t,onBlurObserver:o,onFocusObserver:i})}},e.prototype.disconnect=function(t){var e=this;if(t){var i=this._connectedInputTexts.filter((function(e){return e.input===t}));1===i.length&&(this._removeConnectedInputObservables(i[0]),this._connectedInputTexts=this._connectedInputTexts.filter((function(e){return e.input!==t})),this._currentlyConnectedInputText===t&&(this._currentlyConnectedInputText=null))}else this._connectedInputTexts.forEach((function(t){e._removeConnectedInputObservables(t)})),this._connectedInputTexts.length=0;0===this._connectedInputTexts.length&&(this._currentlyConnectedInputText=null,this.onKeyPressObservable.remove(this._onKeyPressObserver),this._onKeyPressObserver=null)},e.prototype._removeConnectedInputObservables=function(t){t.input._connectedVirtualKeyboard=null,t.input.onFocusObservable.remove(t.onFocusObserver),t.input.onBlurObservable.remove(t.onBlurObserver)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.disconnect()},e.CreateDefaultLayout=function(t){var i=new e(t);return i.addKeysRow(["1","2","3","4","5","6","7","8","9","0","←"]),i.addKeysRow(["q","w","e","r","t","y","u","i","o","p"]),i.addKeysRow(["a","s","d","f","g","h","j","k","l",";","'","↵"]),i.addKeysRow(["⇧","z","x","c","v","b","n","m",",",".","/"]),i.addKeysRow([" "],[{width:"200px"}]),i},e.prototype._parseFromContent=function(e,i){var o=this;t.prototype._parseFromContent.call(this,e,i);for(var n=0,r=this.children;n<r.length;n++){var a=r[n];if("StackPanel"===a.getClassName())for(var s=function(t){"Button"===t.getClassName()&&t.name&&t.onPointerUpObservable.add((function(){o.onKeyPressObservable.notifyObservers(t.name)}))},l=0,_=a.children;l<_.length;l++)s(_[l])}},e}(S);(0,h.RegisterClass)("BABYLON.GUI.VirtualKeyboard",tt);var et=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._cellWidth=20,i._cellHeight=20,i._minorLineTickness=1,i._minorLineColor="DarkGray",i._majorLineTickness=2,i._majorLineColor="White",i._majorLineFrequency=5,i._background="Black",i._displayMajorLines=!0,i._displayMinorLines=!0,i}return r(e,t),Object.defineProperty(e.prototype,"displayMinorLines",{get:function(){return this._displayMinorLines},set:function(t){this._displayMinorLines!==t&&(this._displayMinorLines=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"displayMajorLines",{get:function(){return this._displayMajorLines},set:function(t){this._displayMajorLines!==t&&(this._displayMajorLines=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cellWidth",{get:function(){return this._cellWidth},set:function(t){this._cellWidth=t,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cellHeight",{get:function(){return this._cellHeight},set:function(t){this._cellHeight=t,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"minorLineTickness",{get:function(){return this._minorLineTickness},set:function(t){this._minorLineTickness=t,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"minorLineColor",{get:function(){return this._minorLineColor},set:function(t){this._minorLineColor=t,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"majorLineTickness",{get:function(){return this._majorLineTickness},set:function(t){this._majorLineTickness=t,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"majorLineColor",{get:function(){return this._majorLineColor},set:function(t){this._majorLineColor=t,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"majorLineFrequency",{get:function(){return this._majorLineFrequency},set:function(t){this._majorLineFrequency=t,this._markAsDirty()},enumerable:!1,configurable:!0}),e.prototype._draw=function(t){if(t.save(),this._applyStates(t),this._isEnabled){this._background&&(t.fillStyle=this._background,t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height));var e=this._currentMeasure.width/this._cellWidth,i=this._currentMeasure.height/this._cellHeight,o=this._currentMeasure.left+this._currentMeasure.width/2,n=this._currentMeasure.top+this._currentMeasure.height/2;if(this._displayMinorLines){t.strokeStyle=this._minorLineColor,t.lineWidth=this._minorLineTickness;for(var r=-e/2+1;r<e/2;r++){var a=o+r*this.cellWidth;t.beginPath(),t.moveTo(a,this._currentMeasure.top),t.lineTo(a,this._currentMeasure.top+this._currentMeasure.height),t.stroke()}for(var s=-i/2+1;s<i/2;s++){var l=n+s*this.cellHeight;t.beginPath(),t.moveTo(this._currentMeasure.left,l),t.lineTo(this._currentMeasure.left+this._currentMeasure.width,l),t.stroke()}}if(this._displayMajorLines){for(t.strokeStyle=this._majorLineColor,t.lineWidth=this._majorLineTickness,r=-e/2+this._majorLineFrequency;r<e/2;r+=this._majorLineFrequency)a=o+r*this.cellWidth,t.beginPath(),t.moveTo(a,this._currentMeasure.top),t.lineTo(a,this._currentMeasure.top+this._currentMeasure.height),t.stroke();for(s=-i/2+this._majorLineFrequency;s<i/2;s+=this._majorLineFrequency)l=n+s*this.cellHeight,t.moveTo(this._currentMeasure.left,l),t.lineTo(this._currentMeasure.left+this._currentMeasure.width,l),t.closePath(),t.stroke()}}t.restore()},e.prototype._getTypeName=function(){return"DisplayGrid"},s([(0,h.serialize)()],e.prototype,"displayMinorLines",null),s([(0,h.serialize)()],e.prototype,"displayMajorLines",null),s([(0,h.serialize)()],e.prototype,"background",null),s([(0,h.serialize)()],e.prototype,"cellWidth",null),s([(0,h.serialize)()],e.prototype,"cellHeight",null),s([(0,h.serialize)()],e.prototype,"minorLineTickness",null),s([(0,h.serialize)()],e.prototype,"minorLineColor",null),s([(0,h.serialize)()],e.prototype,"majorLineTickness",null),s([(0,h.serialize)()],e.prototype,"majorLineColor",null),s([(0,h.serialize)()],e.prototype,"majorLineFrequency",null),e}(y);(0,h.RegisterClass)("BABYLON.GUI.DisplayGrid",et);var it=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._tempMeasure=new g(0,0,0,0),i}return r(e,t),Object.defineProperty(e.prototype,"displayThumb",{get:function(){return this._displayThumb&&null!=this.thumbImage},set:function(t){this._displayThumb!==t&&(this._displayThumb=t,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backgroundImage",{get:function(){return this._backgroundImage},set:function(t){var e=this;this._backgroundImage!==t&&(this._backgroundImage=t,t&&!t.isLoaded&&t.onImageLoadedObservable.addOnce((function(){return e._markAsDirty()})),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"valueBarImage",{get:function(){return this._valueBarImage},set:function(t){var e=this;this._valueBarImage!==t&&(this._valueBarImage=t,t&&!t.isLoaded&&t.onImageLoadedObservable.addOnce((function(){return e._markAsDirty()})),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thumbImage",{get:function(){return this._thumbImage},set:function(t){var e=this;this._thumbImage!==t&&(this._thumbImage=t,t&&!t.isLoaded&&t.onImageLoadedObservable.addOnce((function(){return e._markAsDirty()})),this._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"ImageBasedSlider"},e.prototype._draw=function(t){t.save(),this._applyStates(t),this._prepareRenderingData("rectangle");var e=this._getThumbPosition(),i=this._renderLeft,o=this._renderTop,n=this._renderWidth,r=this._renderHeight;this._backgroundImage&&(this._tempMeasure.copyFromFloats(i,o,n,r),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(t)),this._valueBarImage&&(this.isVertical?this.isThumbClamped&&this.displayThumb?this._tempMeasure.copyFromFloats(i,o+e,n,r-e+this._effectiveThumbThickness):this._tempMeasure.copyFromFloats(i,o+e,n,r-e):this.isThumbClamped&&this.displayThumb?this._tempMeasure.copyFromFloats(i,o,e+this._effectiveThumbThickness/2,r):this._tempMeasure.copyFromFloats(i,o,e,r),this._valueBarImage._currentMeasure.copyFrom(this._tempMeasure),this._valueBarImage._draw(t)),this.displayThumb&&(this.isVertical?this._tempMeasure.copyFromFloats(i-this._effectiveBarOffset,this._currentMeasure.top+e,this._currentMeasure.width,this._effectiveThumbThickness):this._tempMeasure.copyFromFloats(this._currentMeasure.left+e,this._currentMeasure.top,this._effectiveThumbThickness,this._currentMeasure.height),this._thumbImage._currentMeasure.copyFrom(this._tempMeasure),this._thumbImage._draw(t)),t.restore()},e.prototype.serialize=function(e){t.prototype.serialize.call(this,e);var i={},o={},n={};this.backgroundImage.serialize(i),this.thumbImage.serialize(o),this.valueBarImage.serialize(n),e.backgroundImage=i,e.thumbImage=o,e.valueBarImage=n},e.prototype._parseFromContent=function(e,i){t.prototype._parseFromContent.call(this,e,i),this.backgroundImage=C.Parse(e.backgroundImage,i),this.thumbImage=C.Parse(e.thumbImage,i),this.valueBarImage=C.Parse(e.valueBarImage,i)},s([(0,h.serialize)()],e.prototype,"displayThumb",null),e}(V);(0,h.RegisterClass)("BABYLON.GUI.ImageBasedSlider",it);var ot="Statics";y.AddHeader=function(t,e,i,o){var n=new S("panel"),r=!o||o.isHorizontal,a=!o||o.controlFirst;n.isVertical=!r;var s=new B("header");return s.text=e,s.textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,r?s.width=i:s.height=i,a?(n.addControl(t),n.addControl(s),s.paddingLeft="5px"):(n.addControl(s),n.addControl(t),s.paddingRight="5px"),s.shadowBlur=t.shadowBlur,s.shadowColor=t.shadowColor,s.shadowOffsetX=t.shadowOffsetX,s.shadowOffsetY=t.shadowOffsetY,n};var nt=function(){function t(){this._colorStops=[],this._gradientDirty=!0}return t.prototype._addColorStopsToCanvasGradient=function(){for(var t=0,e=this._colorStops;t<e.length;t++){var i=e[t];this._canvasGradient.addColorStop(i.offset,i.color)}},t.prototype.getCanvasGradient=function(t){return(this._gradientDirty||this._context!==t)&&(this._context=t,this._canvasGradient=this._createCanvasGradient(t),this._addColorStopsToCanvasGradient(),this._gradientDirty=!1),this._canvasGradient},t.prototype.addColorStop=function(t,e){this._colorStops.push({offset:t,color:e}),this._gradientDirty=!0},t.prototype.removeColorStop=function(t){this._colorStops=this._colorStops.filter((function(e){return e.offset!==t})),this._gradientDirty=!0},t.prototype.clearColorStops=function(){this._colorStops=[],this._gradientDirty=!0},Object.defineProperty(t.prototype,"colorStops",{get:function(){return this._colorStops},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"BaseGradient"},t.prototype.serialize=function(t){t.colorStops=this._colorStops,t.className=this.getClassName()},t.prototype.parse=function(t){this._colorStops=t.colorStops},t}(),rt=function(t){function e(e,i,o,n){var r=t.call(this)||this;return r._x0=null!=e?e:0,r._y0=null!=i?i:0,r._x1=null!=o?o:0,r._y1=null!=n?n:0,r}return r(e,t),e.prototype._createCanvasGradient=function(t){return t.createLinearGradient(this._x0,this._y0,this._x1,this._y1)},Object.defineProperty(e.prototype,"x0",{get:function(){return this._x0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"x1",{get:function(){return this._x1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y0",{get:function(){return this._y0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y1",{get:function(){return this._y1},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return"LinearGradient"},e.prototype.serialize=function(e){t.prototype.serialize.call(this,e),e.x0=this._x0,e.y0=this._y0,e.x1=this._x1,e.y1=this._y1},e.prototype.parse=function(e){t.prototype.parse.call(this,e),this._x0=e.x0,this._y0=e.y0,this._x1=e.x1,this._y1=e.y1},e}(nt);(0,h.RegisterClass)("BABYLON.GUI.LinearGradient",rt);var at=function(t){function e(e,i,o,n,r,a){var s=t.call(this)||this;return s._x0=null!=e?e:0,s._y0=null!=i?i:0,s._r0=null!=o?o:0,s._x1=null!=n?n:0,s._y1=null!=r?r:0,s._r1=null!=a?a:0,s}return r(e,t),e.prototype._createCanvasGradient=function(t){return t.createRadialGradient(this._x0,this._y0,this._r0,this._x1,this._y1,this._r1)},Object.defineProperty(e.prototype,"x0",{get:function(){return this._x0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"x1",{get:function(){return this._x1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y0",{get:function(){return this._y0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y1",{get:function(){return this._y1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"r0",{get:function(){return this._r0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"r1",{get:function(){return this._r1},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return"RadialGradient"},e.prototype.serialize=function(e){t.prototype.serialize.call(this,e),e.x0=this._x0,e.y0=this._y0,e.r0=this._r0,e.x1=this._x1,e.y1=this._y1,e.r1=this._r1},e.prototype.parse=function(e){t.prototype.parse.call(this,e),this._x0=e.x0,this._y0=e.y0,this._r0=e.r0,this._x1=e.x1,this._y1=e.y1,this._r1=e.r1},e}(nt);(0,h.RegisterClass)("BABYLON.GUI.RadialGradient",at);var st=function(){function t(t){this._fontFamily="Arial",this._fontStyle="",this._fontWeight="",this._fontSize=new c(18,c.UNITMODE_PIXEL,!1),this.onChangedObservable=new h.Observable,this._host=t}return Object.defineProperty(t.prototype,"fontSize",{get:function(){return this._fontSize.toString(this._host)},set:function(t){this._fontSize.toString(this._host)!==t&&this._fontSize.fromString(t)&&this.onChangedObservable.notifyObservers(this)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(t){this._fontFamily!==t&&(this._fontFamily=t,this.onChangedObservable.notifyObservers(this))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(t){this._fontStyle!==t&&(this._fontStyle=t,this.onChangedObservable.notifyObservers(this))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(t){this._fontWeight!==t&&(this._fontWeight=t,this.onChangedObservable.notifyObservers(this))},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this.onChangedObservable.clear()},t}(),lt=function(t){function e(e,i,o,n,r,a,s){void 0===i&&(i=0),void 0===o&&(o=0),void 0===r&&(r=!1),void 0===a&&(a=h.Texture.NEAREST_SAMPLINGMODE),void 0===s&&(s=!0);var l=t.call(this,e,{width:i,height:o},n,r,a,h.Constants.TEXTUREFORMAT_RGBA,s)||this;return l.onGuiReadyObservable=new h.Observable,l._isDirty=!1,l._rootContainer=new x("root"),l._lastControlOver={},l._lastControlDown={},l._capturingControl={},l._linkedControls=new Array,l._isFullscreen=!1,l._fullscreenViewport=new h.Viewport(0,0,1,1),l._idealWidth=0,l._idealHeight=0,l._useSmallestIdeal=!1,l._renderAtIdealSize=!1,l._blockNextFocusCheck=!1,l._renderScale=1,l._cursorChanged=!1,l._defaultMousePointerId=0,l._rootChildrenHaveChanged=!1,l._capturedPointerIds=new Set,l._numLayoutCalls=0,l._numRenderCalls=0,l._clipboardData="",l.onClipboardObservable=new h.Observable,l.onControlPickedObservable=new h.Observable,l.onBeginLayoutObservable=new h.Observable,l.onEndLayoutObservable=new h.Observable,l.onBeginRenderObservable=new h.Observable,l.onEndRenderObservable=new h.Observable,l.premulAlpha=!1,l.applyYInversionOnUpdate=!0,l.checkPointerEveryFrame=!1,l._useInvalidateRectOptimization=!0,l._invalidatedRectangle=null,l._clearMeasure=new g(0,0,0,0),l._onClipboardCopy=function(t){var e=t,i=new h.ClipboardInfo(h.ClipboardEventTypes.COPY,e);l.onClipboardObservable.notifyObservers(i),e.preventDefault()},l._onClipboardCut=function(t){var e=t,i=new h.ClipboardInfo(h.ClipboardEventTypes.CUT,e);l.onClipboardObservable.notifyObservers(i),e.preventDefault()},l._onClipboardPaste=function(t){var e=t,i=new h.ClipboardInfo(h.ClipboardEventTypes.PASTE,e);l.onClipboardObservable.notifyObservers(i),e.preventDefault()},l.parseContent=l.parseSerializedObject,(n=l.getScene())&&l._texture?(l.applyYInversionOnUpdate=s,l._rootElement=n.getEngine().getInputElement(),l._renderObserver=n.onBeforeCameraRenderObservable.add((function(t){return l._checkUpdate(t)})),l._controlAddedObserver=l._rootContainer.onControlAddedObservable.add((function(t){t&&(l._rootChildrenHaveChanged=!0)})),l._controlRemovedObserver=l._rootContainer.onControlRemovedObservable.add((function(t){t&&(l._rootChildrenHaveChanged=!0)})),l._preKeyboardObserver=n.onPreKeyboardObservable.add((function(t){l._focusedControl&&(t.type===h.KeyboardEventTypes.KEYDOWN&&l._focusedControl.processKeyboard(t.event),t.skipOnPointerObservable=!0)})),l._rootContainer._link(l),l.hasAlpha=!0,i&&o||(l._resizeObserver=n.getEngine().onResizeObservable.add((function(){return l._onResize()})),l._onResize()),l._texture.isReady=!0,l):l}return r(e,t),Object.defineProperty(e.prototype,"numLayoutCalls",{get:function(){return this._numLayoutCalls},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"numRenderCalls",{get:function(){return this._numRenderCalls},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderScale",{get:function(){return this._renderScale},set:function(t){t!==this._renderScale&&(this._renderScale=t,this._onResize())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this.markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"idealWidth",{get:function(){return this._idealWidth},set:function(t){this._idealWidth!==t&&(this._idealWidth=t,this.markAsDirty(),this._rootContainer._markAllAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"idealHeight",{get:function(){return this._idealHeight},set:function(t){this._idealHeight!==t&&(this._idealHeight=t,this.markAsDirty(),this._rootContainer._markAllAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useSmallestIdeal",{get:function(){return this._useSmallestIdeal},set:function(t){this._useSmallestIdeal!==t&&(this._useSmallestIdeal=t,this.markAsDirty(),this._rootContainer._markAllAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderAtIdealSize",{get:function(){return this._renderAtIdealSize},set:function(t){this._renderAtIdealSize!==t&&(this._renderAtIdealSize=t,this._onResize())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"idealRatio",{get:function(){var t=0,e=0;return this._idealWidth&&(t=this.getSize().width/this._idealWidth),this._idealHeight&&(e=this.getSize().height/this._idealHeight),this._useSmallestIdeal&&this._idealWidth&&this._idealHeight?window.innerWidth<window.innerHeight?t:e:this._idealWidth?t:this._idealHeight?e:1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"layer",{get:function(){return this._layerToDispose},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rootContainer",{get:function(){return this._rootContainer},enumerable:!1,configurable:!0}),e.prototype.getChildren=function(){return[this._rootContainer]},e.prototype.getDescendants=function(t,e){return this._rootContainer.getDescendants(t,e)},e.prototype.getControlsByType=function(t){return this._rootContainer.getDescendants(!1,(function(e){return e.typeName===t}))},e.prototype.getControlByName=function(t){return this._getControlByKey("name",t)},e.prototype._getControlByKey=function(t,e){return this._rootContainer.getDescendants().find((function(i){return i[t]===e}))||null},Object.defineProperty(e.prototype,"focusedControl",{get:function(){return this._focusedControl},set:function(t){this._focusedControl!=t&&(this._focusedControl&&this._focusedControl.onBlur(),t&&t.onFocus(),this._focusedControl=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isForeground",{get:function(){return!this.layer||!this.layer.isBackground},set:function(t){this.layer&&this.layer.isBackground!==!t&&(this.layer.isBackground=!t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clipboardData",{get:function(){return this._clipboardData},set:function(t){this._clipboardData=t},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return"AdvancedDynamicTexture"},e.prototype.executeOnAllControls=function(t,e){e||(e=this._rootContainer),t(e);for(var i=0,o=e.children;i<o.length;i++){var n=o[i];n.children?this.executeOnAllControls(t,n):t(n)}},Object.defineProperty(e.prototype,"useInvalidateRectOptimization",{get:function(){return this._useInvalidateRectOptimization},set:function(t){this._useInvalidateRectOptimization=t},enumerable:!1,configurable:!0}),e.prototype.invalidateRect=function(t,e,i,o){if(this._useInvalidateRectOptimization)if(this._invalidatedRectangle){var n=Math.ceil(Math.max(this._invalidatedRectangle.left+this._invalidatedRectangle.width-1,i)),r=Math.ceil(Math.max(this._invalidatedRectangle.top+this._invalidatedRectangle.height-1,o));this._invalidatedRectangle.left=Math.floor(Math.min(this._invalidatedRectangle.left,t)),this._invalidatedRectangle.top=Math.floor(Math.min(this._invalidatedRectangle.top,e)),this._invalidatedRectangle.width=n-this._invalidatedRectangle.left+1,this._invalidatedRectangle.height=r-this._invalidatedRectangle.top+1}else this._invalidatedRectangle=new g(t,e,i-t+1,o-e+1)},e.prototype.markAsDirty=function(){this._isDirty=!0},e.prototype.createStyle=function(){return new st(this)},e.prototype.addControl=function(t){return this._rootContainer.addControl(t),this},e.prototype.removeControl=function(t){return this._rootContainer.removeControl(t),this},e.prototype.moveToNonOverlappedPosition=function(t,i,o){var n;if(void 0===i&&(i=1),void 0===o&&(o=1),Array.isArray(t))n=t;else{var r=this.getDescendants(!0);n=void 0===t?r.filter((function(t){return void 0!==t.overlapGroup})):r.filter((function(e){return e.overlapGroup===t}))}n.forEach((function(t){var r,a=h.Vector2.Zero(),s=new h.Vector2(t.centerX,t.centerY);n.forEach((function(i){if(t!==i&&e._Overlaps(t,i)){var n=s.subtract(new h.Vector2(i.centerX,i.centerY)),r=n.length();r>0&&(a=a.add(n.normalize().scale(o/r)))}})),a.length()>0&&(a=a.normalize().scale(i*(null!==(r=t.overlapDeltaMultiplier)&&void 0!==r?r:1)),t.linkOffsetXInPixels+=a.x,t.linkOffsetYInPixels+=a.y)}))},e.prototype.dispose=function(){var 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._controlAddedObserver&&this._rootContainer.onControlAddedObservable.remove(this._controlAddedObserver),this._controlRemovedObserver&&this._rootContainer.onControlRemovedObservable.remove(this._controlRemovedObserver),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(),this.onGuiReadyObservable.clear(),t.prototype.dispose.call(this))},e.prototype._onResize=function(){var t=this.getScene();if(t){var e=t.getEngine(),i=this.getSize(),o=e.getRenderWidth()*this._renderScale,n=e.getRenderHeight()*this._renderScale;this._renderAtIdealSize&&(this._idealWidth?(n=n*this._idealWidth/o,o=this._idealWidth):this._idealHeight&&(o=o*this._idealHeight/n,n=this._idealHeight)),i.width===o&&i.height===n||(this.scaleTo(o,n),this.markAsDirty(),(this._idealWidth||this._idealHeight)&&this._rootContainer._markAllAsDirty()),this.invalidateRect(0,0,i.width-1,i.height-1)}},e.prototype._getGlobalViewport=function(){var t=this.getSize(),e=this._fullscreenViewport.toGlobal(t.width,t.height),i=Math.round(e.width*(1/this.rootContainer.scaleX)),o=Math.round(e.height*(1/this.rootContainer.scaleY));return e.x+=(e.width-i)/2,e.y+=(e.height-o)/2,e.width=i,e.height=o,e},e.prototype.getProjectedPosition=function(t,e){var i=this.getProjectedPositionWithZ(t,e);return new h.Vector2(i.x,i.y)},e.prototype.getProjectedPositionWithZ=function(t,e){var i=this.getScene();if(!i)return h.Vector3.Zero();var o=this._getGlobalViewport(),n=h.Vector3.Project(t,e,i.getTransformMatrix(),o);return new h.Vector3(n.x,n.y,n.z)},e.prototype._checkUpdate=function(t,i){if(!this._layerToDispose||0!=(t.layerMask&this._layerToDispose.layerMask)){if(this._isFullscreen&&this._linkedControls.length){var o=this.getScene();if(!o)return;for(var n=this._getGlobalViewport(),r=function(t){if(!t.isVisible)return"continue";var e=t._linkedMesh;if(!e||e.isDisposed())return h.Tools.SetImmediate((function(){t.linkWithMesh(null)})),"continue";var i=e.getBoundingInfo?e.getBoundingInfo().boundingSphere.center:h.Vector3.ZeroReadOnly,r=h.Vector3.Project(i,e.getWorldMatrix(),o.getTransformMatrix(),n);if(r.z<0||r.z>1)return t.notRenderable=!0,"continue";t.notRenderable=!1,a.useInvalidateRectOptimization&&t.invalidateRect(),t._moveToProjectedPosition(r)},a=this,s=0,l=this._linkedControls;s<l.length;s++)r(l[s])}(this._isDirty||this._rootContainer.isDirty)&&(this._isDirty=!1,this._render(i),i||this.update(this.applyYInversionOnUpdate,this.premulAlpha,e.AllowGPUOptimizations))}},e.prototype._render=function(t){var e,i=this.getSize(),o=i.width,n=i.height,r=this.getContext();if(r.font="18px Arial",r.strokeStyle="white",this.onGuiReadyObservable.hasObservers()&&this._checkGuiIsReady(),this._rootChildrenHaveChanged){var a=null===(e=this.getScene())||void 0===e?void 0:e.activeCamera;a&&(this._rootChildrenHaveChanged=!1,this._checkUpdate(a,!0))}this.onBeginLayoutObservable.notifyObservers(this);var s=new g(0,0,o,n);this._numLayoutCalls=0,this._rootContainer._layout(s,r),this.onEndLayoutObservable.notifyObservers(this),this._isDirty=!1,t||(this._invalidatedRectangle?this._clearMeasure.copyFrom(this._invalidatedRectangle):this._clearMeasure.copyFromFloats(0,0,o,n),r.clearRect(this._clearMeasure.left,this._clearMeasure.top,this._clearMeasure.width,this._clearMeasure.height),this._background&&(r.save(),r.fillStyle=this._background,r.fillRect(this._clearMeasure.left,this._clearMeasure.top,this._clearMeasure.width,this._clearMeasure.height),r.restore()),this.onBeginRenderObservable.notifyObservers(this),this._numRenderCalls=0,this._rootContainer._render(r,this._invalidatedRectangle),this.onEndRenderObservable.notifyObservers(this),this._invalidatedRectangle=null)},e.prototype._changeCursor=function(t){this._rootElement&&(this._rootElement.style.cursor=t,this._cursorChanged=!0)},e.prototype._registerLastControlDown=function(t,e){this._lastControlDown[e]=t,this.onControlPickedObservable.notifyObservers(t)},e.prototype._doPicking=function(t,e,i,o,n,r,a,s){var l=this.getScene();if(l){var _=l.getEngine(),c=this.getSize();if(this._isFullscreen){var u=l.cameraToUseForPointers||l.activeCamera;if(!u)return;var d=u.viewport;t*=c.width/(_.getRenderWidth()*d.width),e*=c.height/(_.getRenderHeight()*d.height)}if(this._capturingControl[n])return this._capturingControl[n].isPointerBlocker&&(this._shouldBlockPointer=!0),void this._capturingControl[n]._processObservables(o,t,e,i,n,r);this._cursorChanged=!1,this._rootContainer._processPicking(t,e,i,o,n,r,a,s)||(l.doNotHandleCursors||this._changeCursor(""),o===h.PointerEventTypes.POINTERMOVE&&this._lastControlOver[n]&&(this._lastControlOver[n]._onPointerOut(this._lastControlOver[n],i),delete this._lastControlOver[n])),this._cursorChanged||l.doNotHandleCursors||this._changeCursor(""),this._manageFocus()}},e.prototype._cleanControlAfterRemovalFromList=function(t,e){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&t[i]===e&&delete t[i]},e.prototype._cleanControlAfterRemoval=function(t){this._cleanControlAfterRemovalFromList(this._lastControlDown,t),this._cleanControlAfterRemovalFromList(this._lastControlOver,t)},e.prototype.pick=function(t,e,i){void 0===i&&(i=null),this._isFullscreen&&this._scene&&this._translateToPicking(this._scene,new h.Viewport(0,0,0,0),i,t,e)},e.prototype._translateToPicking=function(t,e,i,o,n){void 0===o&&(o=t.pointerX),void 0===n&&(n=t.pointerY);var r=t.cameraToUseForPointers||t.activeCamera,a=t.getEngine(),s=t.cameraToUseForPointers;if(r)if(r.rigCameras.length){var l=new h.Viewport(0,0,1,1);r.rigCameras.forEach((function(i){i.viewport.toGlobalToRef(a.getRenderWidth(),a.getRenderHeight(),l);var r=o/a.getHardwareScalingLevel()-l.x,s=n/a.getHardwareScalingLevel()-(a.getRenderHeight()-l.y-l.height);r<0||s<0||o>l.width||n>l.height||(t.cameraToUseForPointers=i,e.x=l.x,e.y=l.y,e.width=l.width,e.height=l.height)}))}else r.viewport.toGlobalToRef(a.getRenderWidth(),a.getRenderHeight(),e);else e.x=0,e.y=0,e.width=a.getRenderWidth(),e.height=a.getRenderHeight();var _=o/a.getHardwareScalingLevel()-e.x,c=n/a.getHardwareScalingLevel()-(a.getRenderHeight()-e.y-e.height);if(this._shouldBlockPointer=!1,i){var u=i.event.pointerId||this._defaultMousePointerId;this._doPicking(_,c,i,i.type,u,i.event.button,i.event.deltaX,i.event.deltaY),(this._shouldBlockPointer||this._capturingControl[u])&&(i.skipOnPointerObservable=!0)}else this._doPicking(_,c,null,h.PointerEventTypes.POINTERMOVE,this._defaultMousePointerId,0);t.cameraToUseForPointers=s},e.prototype.attach=function(){var t=this,e=this.getScene();if(e){var i=new h.Viewport(0,0,0,0);this._prePointerObserver=e.onPrePointerObservable.add((function(o){if((!e.isPointerCaptured(o.event.pointerId)||o.type!==h.PointerEventTypes.POINTERUP||t._capturedPointerIds.has(o.event.pointerId))&&(o.type===h.PointerEventTypes.POINTERMOVE||o.type===h.PointerEventTypes.POINTERUP||o.type===h.PointerEventTypes.POINTERDOWN||o.type===h.PointerEventTypes.POINTERWHEEL)){if(o.type===h.PointerEventTypes.POINTERMOVE){if(e.isPointerCaptured(o.event.pointerId))return;o.event.pointerId&&(t._defaultMousePointerId=o.event.pointerId)}t._translateToPicking(e,i,o)}})),this._attachPickingToSceneRender(e,(function(){return t._translateToPicking(e,i,null)}),!1),this._attachToOnPointerOut(e),this._attachToOnBlur(e)}},e.prototype.registerClipboardEvents=function(){self.addEventListener("copy",this._onClipboardCopy,!1),self.addEventListener("cut",this._onClipboardCut,!1),self.addEventListener("paste",this._onClipboardPaste,!1)},e.prototype.unRegisterClipboardEvents=function(){self.removeEventListener("copy",this._onClipboardCopy),self.removeEventListener("cut",this._onClipboardCut),self.removeEventListener("paste",this._onClipboardPaste)},e.prototype._transformUvs=function(t){var e,i=this.getTextureMatrix();if(i.isIdentityAs3x2())e=t;else{var o=h.TmpVectors.Matrix[0];i.getRowToRef(0,h.TmpVectors.Vector4[0]),i.getRowToRef(1,h.TmpVectors.Vector4[1]),i.getRowToRef(2,h.TmpVectors.Vector4[2]);var n=h.TmpVectors.Vector4[0],r=h.TmpVectors.Vector4[1],a=h.TmpVectors.Vector4[2];o.setRowFromFloats(0,n.x,n.y,0,0),o.setRowFromFloats(1,r.x,r.y,0,0),o.setRowFromFloats(2,0,0,1,0),o.setRowFromFloats(3,a.x,a.y,0,1),e=h.TmpVectors.Vector2[0],h.Vector2.TransformToRef(t,o,e)}if((this.wrapU===h.Texture.WRAP_ADDRESSMODE||this.wrapU===h.Texture.MIRROR_ADDRESSMODE)&&e.x>1){var s=e.x-Math.trunc(e.x);this.wrapU===h.Texture.MIRROR_ADDRESSMODE&&Math.trunc(e.x)%2==1&&(s=1-s),e.x=s}if((this.wrapV===h.Texture.WRAP_ADDRESSMODE||this.wrapV===h.Texture.MIRROR_ADDRESSMODE)&&e.y>1){var l=e.y-Math.trunc(e.y);this.wrapV===h.Texture.MIRROR_ADDRESSMODE&&Math.trunc(e.x)%2==1&&(l=1-l),e.y=l}return e},e.prototype.attachToMesh=function(t,e){var i=this;void 0===e&&(e=!0);var o=this.getScene();o&&(this._pointerObserver&&o.onPointerObservable.remove(this._pointerObserver),this._pointerObserver=o.onPointerObservable.add((function(e){if(e.type===h.PointerEventTypes.POINTERMOVE||e.type===h.PointerEventTypes.POINTERUP||e.type===h.PointerEventTypes.POINTERDOWN||e.type===h.PointerEventTypes.POINTERWHEEL){e.type===h.PointerEventTypes.POINTERMOVE&&e.event.pointerId&&(i._defaultMousePointerId=e.event.pointerId);var o=e.event.pointerId||i._defaultMousePointerId;if(e.pickInfo&&e.pickInfo.hit&&e.pickInfo.pickedMesh===t){var n=e.pickInfo.getTextureCoordinates();if(n){n=i._transformUvs(n);var r=i.getSize();i._doPicking(n.x*r.width,(i.applyYInversionOnUpdate?1-n.y:n.y)*r.height,e,e.type,o,e.event.button,e.event.deltaX,e.event.deltaY)}}else if(e.type===h.PointerEventTypes.POINTERUP){if(i._lastControlDown[o]&&i._lastControlDown[o]._forcePointerUp(o),delete i._lastControlDown[o],i.focusedControl){var a=i.focusedControl.keepsFocusWith(),s=!0;if(a)for(var l=0,_=a;l<_.length;l++){var c=_[l];if(i!==c._host){var u=c._host;if(u._lastControlOver[o]&&u._lastControlOver[o].isAscendant(c)){s=!1;break}}}s&&(i.focusedControl=null)}}else e.type===h.PointerEventTypes.POINTERMOVE&&(i._lastControlOver[o]&&i._lastControlOver[o]._onPointerOut(i._lastControlOver[o],e,!0),delete i._lastControlOver[o])}})),t.enablePointerMoveEvents=e,this._attachPickingToSceneRender(o,(function(){var e=i._defaultMousePointerId,n=null==o?void 0:o.pick(o.pointerX,o.pointerY);if(n&&n.hit&&n.pickedMesh===t){var r=n.getTextureCoordinates();if(r){r=i._transformUvs(r);var a=i.getSize();i._doPicking(r.x*a.width,(i.applyYInversionOnUpdate?1-r.y:r.y)*a.height,null,h.PointerEventTypes.POINTERMOVE,e,0)}}else i._lastControlOver[e]&&i._lastControlOver[e]._onPointerOut(i._lastControlOver[e],null,!0),delete i._lastControlOver[e]}),!0),this._attachToOnPointerOut(o),this._attachToOnBlur(o))},e.prototype.moveFocusToControl=function(t){this.focusedControl=t,this._lastPickedControl=t,this._blockNextFocusCheck=!0},e.prototype._manageFocus=function(){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}},e.prototype._attachPickingToSceneRender=function(t,e,i){var o=this;this._sceneRenderObserver=t.onBeforeRenderObservable.add((function(){o.checkPointerEveryFrame&&(o._linkedControls.length>0||i)&&e()}))},e.prototype._attachToOnPointerOut=function(t){var e=this;this._canvasPointerOutObserver=t.getEngine().onCanvasPointerOutObservable.add((function(t){e._lastControlOver[t.pointerId]&&e._lastControlOver[t.pointerId]._onPointerOut(e._lastControlOver[t.pointerId],null),delete e._lastControlOver[t.pointerId],e._lastControlDown[t.pointerId]&&e._lastControlDown[t.pointerId]!==e._capturingControl[t.pointerId]&&(e._lastControlDown[t.pointerId]._forcePointerUp(t.pointerId),delete e._lastControlDown[t.pointerId])}))},e.prototype._attachToOnBlur=function(t){var e=this;this._canvasBlurObserver=t.getEngine().onCanvasBlurObservable.add((function(){Object.entries(e._lastControlDown).forEach((function(t){t[1]._onCanvasBlur()})),e.focusedControl=null,e._lastControlDown={}}))},e.prototype.serializeContent=function(){var t=this.getSize(),e={root:{},width:t.width,height:t.height};return this._rootContainer.serialize(e.root),e},e.prototype.parseSerializedObject=function(t,e){if(this._rootContainer=y.Parse(t.root,this),e){var i=t.width,o=t.height;"number"==typeof i&&"number"==typeof o&&i>=0&&o>=0?this.scaleTo(i,o):this.scaleTo(1920,1080)}},e.prototype.clone=function(t){var i=this.getScene();if(!i)return this;var o=this.serializeContent(),n=e.CreateFullscreenUI(t||"Clone of "+this.name,this.isForeground,i,this.samplingMode);return n.parseSerializedObject(o),n},e.ParseFromSnippetAsync=function(t,i,o){return l(this,void 0,void 0,(function(){var n,r;return _(this,(function(a){switch(a.label){case 0:return n=null!=o?o:e.CreateFullscreenUI("ADT from snippet"),"_BLANK"===t?[2,n]:[4,e._LoadURLContentAsync(e.SnippetUrl+"/"+t.replace(/#/g,"/"),!0)];case 1:return r=a.sent(),n.parseSerializedObject(r,i),[2,n]}}))}))},e.prototype.parseFromSnippetAsync=function(t,i){return e.ParseFromSnippetAsync(t,i,this)},e.ParseFromFileAsync=function(t,i,o){return l(this,void 0,void 0,(function(){var n,r;return _(this,(function(a){switch(a.label){case 0:return n=null!=o?o:e.CreateFullscreenUI("ADT from URL"),[4,e._LoadURLContentAsync(t)];case 1:return r=a.sent(),n.parseSerializedObject(r,i),[2,n]}}))}))},e.prototype.parseFromURLAsync=function(t,i){return e.ParseFromFileAsync(t,i,this)},e._LoadURLContentAsync=function(t,e){return void 0===e&&(e=!1),""===t?Promise.reject("No URL provided"):new Promise((function(i,o){var n=new h.WebRequest;n.addEventListener("readystatechange",(function(){if(4==n.readyState)if(200==n.status){var t=void 0;if(e){var r=JSON.parse(JSON.parse(n.responseText).jsonPayload);t=r.encodedGui?new TextDecoder("utf-8").decode((0,h.DecodeBase64ToBinary)(r.encodedGui)):r.gui}else t=n.responseText;var a=JSON.parse(t);i(a)}else o("Unable to load")})),n.open("GET",t),n.send()}))},e._Overlaps=function(t,e){return!(t.centerX>e.centerX+e.widthInPixels||t.centerX+t.widthInPixels<e.centerX||t.centerY+t.heightInPixels<e.centerY||t.centerY>e.centerY+e.heightInPixels)},e.CreateForMesh=function(t,i,o,n,r,a,s){void 0===i&&(i=1024),void 0===o&&(o=1024),void 0===n&&(n=!0),void 0===r&&(r=!1),void 0===s&&(s=this._CreateMaterial);var l=(0,h.RandomGUID)(),_=new e("AdvancedDynamicTexture for ".concat(t.name," [").concat(l,"]"),i,o,t.getScene(),!0,h.Texture.TRILINEAR_SAMPLINGMODE,a);return s(t,l,_,r),_.attachToMesh(t,n),_},e._CreateMaterial=function(t,e,i,o){var n=(0,h.GetClass)("BABYLON.StandardMaterial");if(!n)throw"StandardMaterial needs to be imported before as it contains a side-effect required by your code.";var r=new n("AdvancedDynamicTextureMaterial for ".concat(t.name," [").concat(e,"]"),t.getScene());r.backFaceCulling=!1,r.diffuseColor=h.Color3.Black(),r.specularColor=h.Color3.Black(),o?(r.diffuseTexture=i,r.emissiveTexture=i,i.hasAlpha=!0):(r.emissiveTexture=i,r.opacityTexture=i),t.material=r},e.CreateForMeshTexture=function(t,i,o,n,r){void 0===i&&(i=1024),void 0===o&&(o=1024),void 0===n&&(n=!0);var a=new e(t.name+" AdvancedDynamicTexture",i,o,t.getScene(),!0,h.Texture.TRILINEAR_SAMPLINGMODE,r);return a.attachToMesh(t,n),a},e.CreateFullscreenUI=function(t,i,o,n,r){void 0===i&&(i=!0),void 0===o&&(o=null),void 0===n&&(n=h.Texture.BILINEAR_SAMPLINGMODE),void 0===r&&(r=!1);var a=new e(t,0,0,o,!1,n),s=a.getScene(),l=new h.Layer(t+"_layer",null,s,!i);if(l.texture=a,a._layerToDispose=l,a._isFullscreen=!0,r&&s){var _=1/s.getEngine().getHardwareScalingLevel();a._rootContainer.scaleX=_,a._rootContainer.scaleY=_}return a.attach(),a},e.prototype.scale=function(e){t.prototype.scale.call(this,e),this.markAsDirty()},e.prototype.scaleTo=function(e,i){t.prototype.scaleTo.call(this,e,i),this.markAsDirty()},e.prototype._checkGuiIsReady=function(){this.guiIsReady()&&(this.onGuiReadyObservable.notifyObservers(this),this.onGuiReadyObservable.clear())},e.prototype.guiIsReady=function(){return this._rootContainer.isReady()},e.SnippetUrl=h.Constants.SnippetUrl,e.AllowGPUOptimizations=!0,e}(h.DynamicTexture),_t=function(){function t(t){this.texture=t,this._captureRenderTime=!1,this._renderTime=new h.PerfCounter,this._captureLayoutTime=!1,this._layoutTime=new h.PerfCounter,this._onBeginRenderObserver=null,this._onEndRenderObserver=null,this._onBeginLayoutObserver=null,this._onEndLayoutObserver=null}return Object.defineProperty(t.prototype,"renderTimeCounter",{get:function(){return this._renderTime},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layoutTimeCounter",{get:function(){return this._layoutTime},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"captureRenderTime",{get:function(){return this._captureRenderTime},set:function(t){var e=this;t!==this._captureRenderTime&&(this._captureRenderTime=t,t?(this._onBeginRenderObserver=this.texture.onBeginRenderObservable.add((function(){e._renderTime.beginMonitoring()})),this._onEndRenderObserver=this.texture.onEndRenderObservable.add((function(){e._renderTime.endMonitoring(!0)}))):(this.texture.onBeginRenderObservable.remove(this._onBeginRenderObserver),this._onBeginRenderObserver=null,this.texture.onEndRenderObservable.remove(this._onEndRenderObserver),this._onEndRenderObserver=null))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"captureLayoutTime",{get:function(){return this._captureLayoutTime},set:function(t){var e=this;t!==this._captureLayoutTime&&(this._captureLayoutTime=t,t?(this._onBeginLayoutObserver=this.texture.onBeginLayoutObservable.add((function(){e._layoutTime.beginMonitoring()})),this._onEndLayoutObserver=this.texture.onEndLayoutObservable.add((function(){e._layoutTime.endMonitoring(!0)}))):(this.texture.onBeginLayoutObservable.remove(this._onBeginLayoutObserver),this._onBeginLayoutObserver=null,this.texture.onEndLayoutObservable.remove(this._onEndLayoutObserver),this._onEndLayoutObserver=null))},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this.texture.onBeginRenderObservable.remove(this._onBeginRenderObserver),this._onBeginRenderObserver=null,this.texture.onEndRenderObservable.remove(this._onEndRenderObserver),this._onEndRenderObserver=null,this.texture.onBeginLayoutObservable.remove(this._onBeginLayoutObserver),this._onBeginLayoutObserver=null,this.texture.onEndLayoutObservable.remove(this._onEndLayoutObserver),this._onEndLayoutObserver=null,this.texture=null},t}(),ht="XmlLoader Exception : XML file is malformed or corrupted.",ct=function(){function t(t){void 0===t&&(t=null),this._nodes={},this._nodeTypes={element:1,attribute:2,text:3},this._isLoaded=!1,this._objectAttributes={textHorizontalAlignment:1,textVerticalAlignment:2,horizontalAlignment:3,verticalAlignment:4,stretch:5},t&&(this._parentClass=t)}return t.prototype._getChainElement=function(t){var e=window;this._parentClass&&(e=this._parentClass);var i=t;i=i.split(".");for(var o=0;o<i.length;o++)e=e[i[o]];return e},t.prototype._getClassAttribute=function(t){var e=t.split(".");return(0,h.GetClass)("BABYLON.GUI."+e[0])[e[1]]},t.prototype._createGuiElement=function(t,e,i){void 0===i&&(i=!0);try{var o=new((0,h.GetClass)("BABYLON.GUI."+t.nodeName));e&&i&&e.addControl(o);for(var n=0;n<t.attributes.length;n++)if(!t.attributes[n].name.toLowerCase().includes("datasource"))if(t.attributes[n].name.toLowerCase().includes("observable")){var r=this._getChainElement(t.attributes[n].value);o[t.attributes[n].name].add(r)}else"linkWithMesh"==t.attributes[n].name?this._parentClass?o.linkWithMesh(this._parentClass[t.attributes[n].value]):o.linkWithMesh(window[t.attributes[n].value]):t.attributes[n].value.startsWith("{{")&&t.attributes[n].value.endsWith("}}")?(r=this._getChainElement(t.attributes[n].value.substring(2,t.attributes[n].value.length-2)),o[t.attributes[n].name]=r):this._objectAttributes[t.attributes[n].name]?o[t.attributes[n].name]=this._getClassAttribute(t.attributes[n].value):"true"==t.attributes[n].value||"false"==t.attributes[n].value?o[t.attributes[n].name]="true"==t.attributes[n].value:o[t.attributes[n].name]=isNaN(Number(t.attributes[n].value))?t.attributes[n].value:Number(t.attributes[n].value);if(!t.attributes.getNamedItem("id"))return this._nodes[t.nodeName+Object.keys(this._nodes).length+"_gen"]=o,o;var a=t.attributes.getNamedItem("id").value;if(a.startsWith("{{")&&a.endsWith("}}")&&(a=this._getChainElement(a.substring(2,a.length-2))),this._nodes[a])throw"XmlLoader Exception : Duplicate ID, every element should have an unique ID attribute";return this._nodes[a]=o,o}catch(e){throw"XmlLoader Exception : Error parsing Control "+t.nodeName+","+e+"."}},t.prototype._parseGrid=function(t,e,i){for(var o,n,r,a,s,l=t.children,_=!1,h=-1,c=-1,u=0,d=0;d<l.length;d++)if(l[d].nodeType==this._nodeTypes.element){if("Row"!=l[d].nodeName)throw"XmlLoader Exception : Expecting Row node, received "+l[d].nodeName;if(h+=1,r=l[d].children,!l[d].attributes.getNamedItem("height"))throw"XmlLoader Exception : Height must be defined for grid rows";n=Number(l[d].attributes.getNamedItem("height").nodeValue),_=!!l[d].attributes.getNamedItem("isPixel")&&JSON.parse(l[d].attributes.getNamedItem("isPixel").nodeValue),e.addRowDefinition(n,_);for(var f=0;f<r.length;f++)if(r[f].nodeType==this._nodeTypes.element){if("Column"!=r[f].nodeName)throw"XmlLoader Exception : Expecting Column node, received "+r[f].nodeName;if(c+=1,h>0&&c>u)throw"XmlLoader Exception : In the Grid element, the number of columns is defined in the first row, do not add more columns in the subsequent rows.";if(0==h){if(!r[f].attributes.getNamedItem("width"))throw"XmlLoader Exception : Width must be defined for all the grid columns in the first row";o=Number(r[f].attributes.getNamedItem("width").nodeValue),_=!!r[f].attributes.getNamedItem("isPixel")&&JSON.parse(r[f].attributes.getNamedItem("isPixel").nodeValue),e.addColumnDefinition(o,_)}a=r[f].children;for(var p=0;p<a.length;p++)a[p].nodeType==this._nodeTypes.element&&(s=this._createGuiElement(a[p],e,!1),e.addControl(s,h,c),a[p].firstChild&&this._parseXml(a[p].firstChild,s))}0==h&&(u=c),c=-1}t.nextSibling&&this._parseXml(t.nextSibling,i)},t.prototype._parseElement=function(t,e,i){t.firstChild&&this._parseXml(t.firstChild,e),t.nextSibling&&this._parseXml(t.nextSibling,i)},t.prototype._prepareSourceElement=function(t,e,i,o,n){this._parentClass?this._parentClass[i]=o[n]:window[i]=o[n],t.firstChild&&this._parseXml(t.firstChild,e,!0)},t.prototype._parseElementsFromSource=function(t,e,i){var o=t.attributes.getNamedItem("dataSource").value;if(!o.includes(" in "))throw"XmlLoader Exception : Malformed XML, Data Source must include an in";var n=!0,r=o.split(" in ");if(r.length<2)throw"XmlLoader Exception : Malformed XML, Data Source must have an iterator and a source";var a=r[1];if(a.startsWith("{")&&a.endsWith("}")&&(n=!1),(!n||a.startsWith("[")&&a.endsWith("]"))&&(a=a.substring(1,a.length-1)),a=this._parentClass?this._parentClass[a]:window[a],n)for(var s=0;s<a.length;s++)this._prepareSourceElement(t,e,r[0],a,s);else for(var s in a)this._prepareSourceElement(t,e,r[0],a,s);t.nextSibling&&this._parseXml(t.nextSibling,i)},t.prototype._parseXml=function(t,e,i){if(void 0===i&&(i=!1),t.nodeType==this._nodeTypes.element){i&&t.setAttribute("id",e.id+(e._children.length+1));var o=this._createGuiElement(t,e);this._rootNode||(this._rootNode=o),"Grid"==t.nodeName?this._parseGrid(t,o,e):t.attributes.getNamedItem("dataSource")?this._parseElementsFromSource(t,o,e):this._parseElement(t,o,e)}else t.nextSibling&&this._parseXml(t.nextSibling,e,i)},t.prototype.isLoaded=function(){return this._isLoaded},t.prototype.getNodeById=function(t){return this._nodes[t]},t.prototype.getNodes=function(){return this._nodes},t.prototype.dispose=function(){this._rootNode&&(this._rootNode.dispose(),this._rootNode=null,this._nodes={})},t.prototype.loadLayout=function(t,e,i,o){var n=this;void 0===i&&(i=null),void 0===o&&(o=null);var r=new XMLHttpRequest;r.onload=function(){if(4===r.readyState&&200===r.status){if(!r.responseXML){if(o)return void o(ht);throw ht}var t=r.responseXML.documentElement;n._parseXml(t.firstChild,e),n._isLoaded=!0,i&&i()}},r.onerror=function(){o&&o("an error occurred during loading the layout")},r.open("GET",t,!0),r.send()},t.prototype.loadLayoutAsync=function(t,e){return l(this,void 0,void 0,(function(){var i=this;return _(this,(function(o){return[2,new Promise((function(o,n){i.loadLayout(t,e,o,n)}))]}))}))},t}(),ut=function(t){function e(e,i){void 0===i&&(i=0);var o=t.call(this,e.x,e.y,e.z)||this;return o.buttonIndex=i,o}return r(e,t),e}(h.Vector3),dt=function(){function t(t){this.name=t,this._downCount=0,this._enterCount=-1,this._downPointerIds={},this._isVisible=!0,this._isScaledByManager=!1,this.onPointerMoveObservable=new h.Observable,this.onPointerOutObservable=new h.Observable,this.onPointerDownObservable=new h.Observable,this.onPointerUpObservable=new h.Observable,this.onPointerClickObservable=new h.Observable,this.onPointerEnterObservable=new h.Observable,this._behaviors=new Array}return Object.defineProperty(t.prototype,"position",{get:function(){return this._node?this._node.position:h.Vector3.Zero()},set:function(t){this._node&&(this._node.position=t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaling",{get:function(){return this._node?this._node.scaling:new h.Vector3(1,1,1)},set:function(t){this._node&&(this._isScaledByManager=!1,this._node.scaling=t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"behaviors",{get:function(){return this._behaviors},enumerable:!1,configurable:!0}),t.prototype.addBehavior=function(t){var e=this;if(-1!==this._behaviors.indexOf(t))return this;t.init();var i=this._host.scene;return i.isLoading?i.onDataLoadedObservable.addOnce((function(){t.attach(e)})):t.attach(this),this._behaviors.push(t),this},t.prototype.removeBehavior=function(t){var e=this._behaviors.indexOf(t);return-1===e||(this._behaviors[e].detach(),this._behaviors.splice(e,1)),this},t.prototype.getBehaviorByName=function(t){for(var e=0,i=this._behaviors;e<i.length;e++){var o=i[e];if(o.name===t)return o}return null},Object.defineProperty(t.prototype,"isVisible",{get:function(){return this._isVisible},set:function(t){if(this._isVisible!==t){this._isVisible=t;var e=this.mesh;e&&e.setEnabled(t)}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"typeName",{get:function(){return this._getTypeName()},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return this._getTypeName()},t.prototype._getTypeName=function(){return"Control3D"},Object.defineProperty(t.prototype,"node",{get:function(){return this._node},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mesh",{get:function(){return this._node instanceof h.AbstractMesh?this._node:null},enumerable:!1,configurable:!0}),t.prototype.linkToTransformNode=function(t){return this._node&&(this._node.parent=t),this},t.prototype._prepareNode=function(t){if(!this._node){if(this._node=this._createNode(t),!this.node)return;this._injectGUI3DReservedDataStore(this.node).control=this;var e=this.mesh;e&&(e.isPickable=!0,this._affectMaterial(e))}},t.prototype._injectGUI3DReservedDataStore=function(t){var e,i;return t.reservedDataStore=null!==(e=t.reservedDataStore)&&void 0!==e?e:{},t.reservedDataStore.GUI3D=null!==(i=t.reservedDataStore.GUI3D)&&void 0!==i?i:{},t.reservedDataStore.GUI3D},t.prototype._createNode=function(t){return null},t.prototype._affectMaterial=function(t){t.material=null},t.prototype._isTouchButton3D=function(t){return void 0!==t._generatePointerEventType},t.prototype._onPointerMove=function(t,e){this.onPointerMoveObservable.notifyObservers(e,-1,t,this)},t.prototype._onPointerEnter=function(t){return-1===this._enterCount&&(this._enterCount=0),this._enterCount++,!(this._enterCount>1||(this.onPointerEnterObservable.notifyObservers(this,-1,t,this),this.pointerEnterAnimation&&this.pointerEnterAnimation(),0))},t.prototype._onPointerOut=function(t){this._enterCount--,this._enterCount>0||(this._enterCount=0,this.onPointerOutObservable.notifyObservers(this,-1,t,this),this.pointerOutAnimation&&this.pointerOutAnimation())},t.prototype._onPointerDown=function(t,e,i,o){return this._downCount++,this._downPointerIds[i]=this._downPointerIds[i]+1||1,1===this._downCount&&(this.onPointerDownObservable.notifyObservers(new ut(e,o),-1,t,this),this.pointerDownAnimation&&this.pointerDownAnimation(),!0)},t.prototype._onPointerUp=function(t,e,i,o,n){this._downCount--,this._downPointerIds[i]--,this._downPointerIds[i]<=0&&delete this._downPointerIds[i],this._downCount<0?this._downCount=0:0==this._downCount&&(n&&(this._enterCount>0||-1===this._enterCount)&&this.onPointerClickObservable.notifyObservers(new ut(e,o),-1,t,this),this.onPointerUpObservable.notifyObservers(new ut(e,o),-1,t,this),this.pointerUpAnimation&&this.pointerUpAnimation())},t.prototype.forcePointerUp=function(t){if(void 0===t&&(t=null),null!==t)this._onPointerUp(this,h.Vector3.Zero(),t,0,!0);else{for(var e in this._downPointerIds)this._onPointerUp(this,h.Vector3.Zero(),+e,0,!0);this._downCount>0&&(this._downCount=1,this._onPointerUp(this,h.Vector3.Zero(),0,0,!0))}},t.prototype._processObservables=function(t,e,i,o,n){if(this._isTouchButton3D(this)&&i&&(t=this._generatePointerEventType(t,i,this._downCount)),t===h.PointerEventTypes.POINTERMOVE){this._onPointerMove(this,e);var r=this._host._lastControlOver[o];return r&&r!==this&&r._onPointerOut(this),r!==this&&this._onPointerEnter(this),this._host._lastControlOver[o]=this,!0}return t===h.PointerEventTypes.POINTERDOWN?(this._onPointerDown(this,e,o,n),this._host._lastControlDown[o]=this,this._host._lastPickedControl=this,!0):(t===h.PointerEventTypes.POINTERUP||t===h.PointerEventTypes.POINTERDOUBLETAP)&&(this._host._lastControlDown[o]&&this._host._lastControlDown[o]._onPointerUp(this,e,o,n,!0),delete this._host._lastControlDown[o],!0)},t.prototype._disposeNode=function(){this._node&&(this._node.dispose(),this._node=null)},t.prototype.dispose=function(){this.onPointerDownObservable.clear(),this.onPointerEnterObservable.clear(),this.onPointerMoveObservable.clear(),this.onPointerOutObservable.clear(),this.onPointerUpObservable.clear(),this.onPointerClickObservable.clear(),this._disposeNode();for(var t=0,e=this._behaviors;t<e.length;t++)e[t].detach()},t}(),ft=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._contentResolution=512,e._contentScaleRatio=2,e}return r(e,t),Object.defineProperty(e.prototype,"content",{get:function(){return this._content},set:function(t){this._content=t,t&&this._host&&this._host.utilityLayer&&(this._facadeTexture?this._facadeTexture.rootContainer.clearControls():(this._facadeTexture=new lt("Facade",this._contentResolution,this._contentResolution,this._host.utilityLayer.utilityLayerScene,!0,h.Texture.TRILINEAR_SAMPLINGMODE),this._setFacadeTextureScaling(),this._facadeTexture.premulAlpha=!0),this._facadeTexture.addControl(t),this._applyFacade(this._facadeTexture))},enumerable:!1,configurable:!0}),e.prototype._setFacadeTextureScaling=function(){var t;this._facadeTexture&&(this._facadeTexture.rootContainer.scaleX=this._contentScaleRatio,this._facadeTexture.rootContainer.scaleY=null!==(t=this._contentScaleRatioY)&&void 0!==t?t:this._contentScaleRatio)},Object.defineProperty(e.prototype,"contentResolution",{get:function(){return this._contentResolution},set:function(t){this._contentResolution!==t&&(this._contentResolution=t,this._resetContent())},enumerable:!1,configurable:!0}),e.prototype._disposeFacadeTexture=function(){this._facadeTexture&&(this._facadeTexture.dispose(),this._facadeTexture=null)},e.prototype._resetContent=function(){this._disposeFacadeTexture(),this.content=this._content},e.prototype._applyFacade=function(t){},e}(dt),pt=function(t){function e(e){return t.call(this,e)||this}return r(e,t),e.prototype._getTypeName=function(){return"AbstractButton3D"},e.prototype._createNode=function(t){return new h.TransformNode("button"+this.name,t)},e}(ft),gt=function(t){function e(e,i){var o=t.call(this,e)||this;return o._options=a({width:1,height:1,depth:.08},i),o.pointerEnterAnimation=function(){o.mesh&&(o._currentMaterial.emissiveColor=h.Color3.Red())},o.pointerOutAnimation=function(){o._currentMaterial.emissiveColor=h.Color3.Black()},o.pointerDownAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(.95)},o.pointerUpAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(1/.95)},o}return r(e,t),e.prototype._applyFacade=function(t){this._currentMaterial.emissiveTexture=t},e.prototype._getTypeName=function(){return"Button3D"},e.prototype._createNode=function(t){for(var e=new Array(6),i=0;i<6;i++)e[i]=new h.Vector4(0,0,0,0);t.useRightHandedSystem?e[0].copyFromFloats(1,0,0,1):e[1].copyFromFloats(0,0,1,1);var o=(0,h.CreateBox)(this.name+"_rootMesh",{width:this._options.width,height:this._options.height,depth:this._options.depth,faceUV:e,wrap:!0},t);return this._contentScaleRatioY=this._contentScaleRatio*this._options.width/this._options.height,this._setFacadeTextureScaling(),o},e.prototype._affectMaterial=function(t){var e=new h.StandardMaterial(this.name+"Material",t.getScene());e.specularColor=h.Color3.Black(),t.material=e,this._currentMaterial=e,this._resetContent()},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._disposeFacadeTexture(),this._currentMaterial&&this._currentMaterial.dispose()},e}(pt),bt=function(t){function e(e){var i=t.call(this,e)||this;return i._blockLayout=!1,i._children=new Array,i}return r(e,t),Object.defineProperty(e.prototype,"children",{get:function(){return this._children},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blockLayout",{get:function(){return this._blockLayout},set:function(t){this._blockLayout!==t&&(this._blockLayout=t,this._blockLayout||this._arrangeChildren())},enumerable:!1,configurable:!0}),e.prototype.updateLayout=function(){return this._arrangeChildren(),this},e.prototype.containsControl=function(t){return-1!==this._children.indexOf(t)},e.prototype.addControl=function(t){return-1!==this._children.indexOf(t)||(t.parent=this,t._host=this._host,this._children.push(t),this._host.utilityLayer&&(t._prepareNode(this._host.utilityLayer.utilityLayerScene),t.node&&(t.node.parent=this.node),this.blockLayout||this._arrangeChildren())),this},e.prototype._arrangeChildren=function(){},e.prototype._createNode=function(t){return new h.TransformNode("ContainerNode",t)},e.prototype.removeControl=function(t){var e=this._children.indexOf(t);return-1!==e&&(this._children.splice(e,1),t.parent=null,t._disposeNode()),this},e.prototype._getTypeName=function(){return"Container3D"},e.prototype.dispose=function(){for(var e=0,i=this._children;e<i.length;e++)i[e].dispose();this._children.length=0,t.prototype.dispose.call(this)},e.UNSET_ORIENTATION=0,e.FACEORIGIN_ORIENTATION=1,e.FACEORIGINREVERSED_ORIENTATION=2,e.FACEFORWARD_ORIENTATION=3,e.FACEFORWARDREVERSED_ORIENTATION=4,e}(dt),mt=function(t){function e(e){var i=t.call(this,e)||this;return i._columns=10,i._rows=0,i._rowThenColum=!0,i._orientation=bt.FACEORIGIN_ORIENTATION,i.margin=0,i}return r(e,t),Object.defineProperty(e.prototype,"orientation",{get:function(){return this._orientation},set:function(t){var e=this;this._orientation!==t&&(this._orientation=t,h.Tools.SetImmediate((function(){e._arrangeChildren()})))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"columns",{get:function(){return this._columns},set:function(t){var e=this;this._columns!==t&&(this._columns=t,this._rowThenColum=!0,h.Tools.SetImmediate((function(){e._arrangeChildren()})))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rows",{get:function(){return this._rows},set:function(t){var e=this;this._rows!==t&&(this._rows=t,this._rowThenColum=!1,h.Tools.SetImmediate((function(){e._arrangeChildren()})))},enumerable:!1,configurable:!0}),e.prototype._arrangeChildren=function(){this._cellWidth=0,this._cellHeight=0;for(var t=0,e=0,i=0,o=h.Matrix.Invert(this.node.computeWorldMatrix(!0)),n=0,r=this._children;n<r.length;n++)if((m=r[n]).mesh){i++,m.mesh.computeWorldMatrix(!0);var a=m.mesh.getHierarchyBoundingVectors(),s=h.TmpVectors.Vector3[0],l=h.TmpVectors.Vector3[1];a.max.subtractToRef(a.min,l),l.scaleInPlace(.5),h.Vector3.TransformNormalToRef(l,o,s),this._cellWidth=Math.max(this._cellWidth,2*s.x),this._cellHeight=Math.max(this._cellHeight,2*s.y)}this._cellWidth+=2*this.margin,this._cellHeight+=2*this.margin,this._rowThenColum?(e=this._columns,t=Math.ceil(i/this._columns)):(t=this._rows,e=Math.ceil(i/this._rows));var _=.5*e*this._cellWidth,c=.5*t*this._cellHeight,u=[],d=0;if(this._rowThenColum)for(var f=0;f<t;f++)for(var p=0;p<e&&(u.push(new h.Vector3(p*this._cellWidth-_+this._cellWidth/2,f*this._cellHeight-c+this._cellHeight/2,0)),!(++d>i));p++);else for(p=0;p<e;p++)for(f=0;f<t&&(u.push(new h.Vector3(p*this._cellWidth-_+this._cellWidth/2,f*this._cellHeight-c+this._cellHeight/2,0)),!(++d>i));f++);d=0;for(var g=0,b=this._children;g<b.length;g++){var m;(m=b[g]).mesh&&(this._mapGridNode(m,u[d]),d++)}this._finalProcessing()},e.prototype._finalProcessing=function(){},e}(bt),vt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._radius=5,e}return r(e,t),Object.defineProperty(e.prototype,"radius",{get:function(){return this._radius},set:function(t){var e=this;this._radius!==t&&(this._radius=t,h.Tools.SetImmediate((function(){e._arrangeChildren()})))},enumerable:!1,configurable:!0}),e.prototype._mapGridNode=function(t,e){var i=t.mesh;if(i){var o=this._cylindricalMapping(e);switch(t.position=o,this.orientation){case bt.FACEORIGIN_ORIENTATION:i.lookAt(new h.Vector3(2*o.x,o.y,2*o.z));break;case bt.FACEORIGINREVERSED_ORIENTATION:i.lookAt(new h.Vector3(-o.x,o.y,-o.z));break;case bt.FACEFORWARD_ORIENTATION:break;case bt.FACEFORWARDREVERSED_ORIENTATION:i.rotate(h.Axis.Y,Math.PI,h.Space.LOCAL)}}},e.prototype._cylindricalMapping=function(t){var e=new h.Vector3(0,t.y,this._radius),i=t.x/this._radius;return h.Matrix.RotationYawPitchRollToRef(i,0,0,h.TmpVectors.Matrix[0]),h.Vector3.TransformNormal(e,h.TmpVectors.Matrix[0])},e}(mt);h.ShaderStore.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";h.ShaderStore.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}";var yt=function(t){function e(){var e=t.call(this)||this;return e.INNERGLOW=!1,e.BORDER=!1,e.HOVERLIGHT=!1,e.TEXTURE=!1,e.rebuild(),e}return r(e,t),e}(h.MaterialDefines),xt=function(t){function e(e,i){var o=t.call(this,e,i)||this;return o.innerGlowColorIntensity=.5,o.innerGlowColor=new h.Color3(1,1,1),o.albedoColor=new h.Color3(.3,.35,.4),o.renderBorders=!1,o.borderWidth=.5,o.edgeSmoothingValue=.02,o.borderMinValue=.1,o.renderHoverLight=!1,o.hoverRadius=.01,o.hoverColor=new h.Color4(.3,.3,.3,1),o.hoverPosition=h.Vector3.Zero(),o}return r(e,t),e.prototype.needAlphaBlending=function(){return 1!==this.alpha},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){if(this.isFrozen&&e.effect&&e.effect._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new yt);var i=this.getScene(),o=e.materialDefines;if(!this.checkReadyOnEveryCall&&e.effect&&o._renderId===i.getRenderId())return!0;if(o._areTexturesDirty)if(o.INNERGLOW=this.innerGlowColorIntensity>0,o.BORDER=this.renderBorders,o.HOVERLIGHT=this.renderHoverLight,this._albedoTexture){if(!this._albedoTexture.isReadyOrNotBlocking())return!1;o.TEXTURE=!0}else o.TEXTURE=!1;var n=i.getEngine();if(o.isDirty){o.markAsProcessed(),i.resetCachedMaterial();var r=[h.VertexBuffer.PositionKind];r.push(h.VertexBuffer.NormalKind),r.push(h.VertexBuffer.UVKind);var a=["world","viewProjection","innerGlowColor","albedoColor","borderWidth","edgeSmoothingValue","scaleFactor","borderMinValue","hoverColor","hoverPosition","hoverRadius","textureMatrix"],s=["albedoSampler"],l=new Array;h.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:a,uniformBuffersNames:l,samplers:s,defines:o,maxSimultaneousLights:4});var _=o.toString();e.setEffect(i.getEngine().createEffect("fluent",{attributes:r,uniformsNames:a,uniformBuffersNames:l,samplers:s,defines:_,fallbacks:null,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),o,this._materialContext)}return!(!e.effect||!e.effect.isReady()||(o._renderId=i.getRenderId(),e.effect._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){var o=this.getScene(),n=i.materialDefines;if(n){var r=i.effect;if(r){if(this._activeEffect=r,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",o.getTransformMatrix()),this._mustRebind(o,r)&&(this._activeEffect.setColor4("albedoColor",this.albedoColor,this.alpha),n.INNERGLOW&&this._activeEffect.setColor4("innerGlowColor",this.innerGlowColor,this.innerGlowColorIntensity),n.BORDER&&(this._activeEffect.setFloat("borderWidth",this.borderWidth),this._activeEffect.setFloat("edgeSmoothingValue",this.edgeSmoothingValue),this._activeEffect.setFloat("borderMinValue",this.borderMinValue),e.getBoundingInfo().boundingBox.extendSize.multiplyToRef(e.scaling,h.TmpVectors.Vector3[0]),this._activeEffect.setVector3("scaleFactor",h.TmpVectors.Vector3[0])),n.HOVERLIGHT&&(this._activeEffect.setDirectColor4("hoverColor",this.hoverColor),this._activeEffect.setFloat("hoverRadius",this.hoverRadius),this._activeEffect.setVector3("hoverPosition",this.hoverPosition)),n.TEXTURE&&this._albedoTexture)){this._activeEffect.setTexture("albedoSampler",this._albedoTexture);var a=this._albedoTexture.getTextureMatrix();this._activeEffect.setMatrix("textureMatrix",a)}this._afterBind(e,this._activeEffect)}}},e.prototype.getActiveTextures=function(){return t.prototype.getActiveTextures.call(this)},e.prototype.hasTexture=function(e){return!!t.prototype.hasTexture.call(this,e)},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e)},e.prototype.clone=function(t){var i=this;return h.SerializationHelper.Clone((function(){return new e(t,i.getScene())}),this)},e.prototype.serialize=function(){var e=t.prototype.serialize.call(this);return e.customType="BABYLON.GUI.FluentMaterial",e},e.prototype.getClassName=function(){return"FluentMaterial"},e.Parse=function(t,i,o){return h.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},s([(0,h.serialize)(),(0,h.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"innerGlowColorIntensity",void 0),s([(0,h.serializeAsColor3)()],e.prototype,"innerGlowColor",void 0),s([(0,h.serializeAsColor3)()],e.prototype,"albedoColor",void 0),s([(0,h.serialize)(),(0,h.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"renderBorders",void 0),s([(0,h.serialize)()],e.prototype,"borderWidth",void 0),s([(0,h.serialize)()],e.prototype,"edgeSmoothingValue",void 0),s([(0,h.serialize)()],e.prototype,"borderMinValue",void 0),s([(0,h.serialize)(),(0,h.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"renderHoverLight",void 0),s([(0,h.serialize)()],e.prototype,"hoverRadius",void 0),s([(0,h.serializeAsColor4)()],e.prototype,"hoverColor",void 0),s([(0,h.serializeAsVector3)()],e.prototype,"hoverPosition",void 0),s([(0,h.serializeAsTexture)("albedoTexture")],e.prototype,"_albedoTexture",void 0),s([(0,h.expandToProperty)("_markAllSubMeshesAsTexturesAndMiscDirty")],e.prototype,"albedoTexture",void 0),e}(h.PushMaterial);(0,h.RegisterClass)("BABYLON.GUI.FluentMaterial",xt);var Pt=function(t){function e(e){var i=t.call(this,e)||this;return i._backPlateMargin=1.25,i}return r(e,t),Object.defineProperty(e.prototype,"backPlateMargin",{get:function(){return this._backPlateMargin},set:function(t){var e=this;this._backPlateMargin=t,this._children.length>=1&&(this.children.forEach((function(t){e._updateCurrentMinMax(t.position)})),this._updateMargins())},enumerable:!1,configurable:!0}),e.prototype._createNode=function(t){var e=new h.Mesh("menu_".concat(this.name),t);return this._backPlate=(0,h.CreateBox)("backPlate"+this.name,{size:1},t),this._backPlate.parent=e,e},e.prototype._affectMaterial=function(t){var e=this;this._backPlateMaterial=new xt(this.name+"backPlateMaterial",t.getScene()),this._backPlateMaterial.albedoColor=new h.Color3(.08,.15,.55),this._backPlateMaterial.renderBorders=!0,this._backPlateMaterial.renderHoverLight=!0,this._pickedPointObserver=this._host.onPickedPointChangedObservable.add((function(t){t?(e._backPlateMaterial.hoverPosition=t,e._backPlateMaterial.hoverColor.a=1):e._backPlateMaterial.hoverColor.a=0})),this._backPlate.material=this._backPlateMaterial},e.prototype._mapGridNode=function(t,e){t.mesh&&(t.position=e.clone(),this._updateCurrentMinMax(e))},e.prototype._finalProcessing=function(){this._updateMargins()},e.prototype._updateCurrentMinMax=function(t){this._currentMin||(this._currentMin=t.clone(),this._currentMax=t.clone()),this._currentMin.minimizeInPlace(t),this._currentMax.maximizeInPlace(t)},e.prototype._updateMargins=function(){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);var t=this._currentMax.subtract(this._currentMin);this._backPlate.scaling.x=t.x+this._cellWidth*this.backPlateMargin,this._backPlate.scaling.y=t.y+this._cellHeight*this.backPlateMargin,this._backPlate.scaling.z=.001;for(var e=0;e<this._children.length;e++)this._children[e].position.subtractInPlace(this._currentMin).subtractInPlace(t.scale(.5)),this._children[e].position.z-=.01}this._currentMin=null,this._currentMax=null},e.prototype.addButton=function(i){var o=this.blockLayout;return o||(this.blockLayout=!0),t.prototype.addControl.call(this,i),i.isBackplateVisible=!1,i.scaling.scaleInPlace(e.MENU_BUTTON_SCALE),o||(this.blockLayout=!1),this},e.prototype.addControl=function(t){return h.Logger.Warn("TouchHolographicMenu can only contain buttons. Please use the method `addButton` instead."),this},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver)},e.MENU_BUTTON_SCALE=1,e}(mt),It=function(t){function e(e,i){var o=t.call(this,i)||this;return o._handConstraintBehavior=new h.HandConstraintBehavior,o._handConstraintBehavior.linkToXRExperience(e),o.backPlateMargin=.15,o.rows=3,o}return r(e,t),Object.defineProperty(e.prototype,"handConstraintBehavior",{get:function(){return this._handConstraintBehavior},enumerable:!1,configurable:!0}),e.prototype._createNode=function(e){var i=t.prototype._createNode.call(this,e);return this._handConstraintBehavior.attach(i),i},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._handConstraintBehavior.detach()},e}(Pt);h.ShaderStore.ShadersStore.fluentBackplatePixelShader="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 _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 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 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 float _Angle_;\nuniform float _Fade_Out_;\nuniform bool _Reflected_;\nuniform float _Frequency_;\nuniform float _Vertical_Offset_;\nuniform sampler2D _Iridescent_Map_;\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 Round_Rect_Fragment_B31(\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 Blob_Fragment_B71(\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=k1<k2 ? vec3(k1,Blob_Info1.z,Blob_Info1.w) : vec3(k2,Blob_Info2.z,Blob_Info2.w);\nBlob_Color=closer.z*texture(Blob_Texture,vec2(vec2(sqrt(closer.x),closer.y).x,1.0-vec2(sqrt(closer.x),closer.y).y))*clamp(1.0-closer.x,0.0,1.0);\n}\nvoid Line_Fragment_B48(\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 Scale_RGB_B54(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{\nResult=vec4(Scalar,Scalar,Scalar,1)*Color;\n}\nvoid Conditional_Float_B38(\nbool Which,\nfloat If_True,\nfloat If_False,\nout float Result)\n{\nResult=Which ? If_True : If_False;\n}\nvoid main()\n{\nfloat R_Q72;\nfloat G_Q72;\nfloat B_Q72;\nfloat A_Q72;\nR_Q72=vColor.r; G_Q72=vColor.g; B_Q72=vColor.b; A_Q72=vColor.a;\nvec4 Blob_Color_Q71;\n#if BLOB_ENABLE\nfloat k1=dot(vExtra2.xy,vExtra2.xy);\nfloat k2=dot(vExtra3.xy,vExtra3.xy);\nvec3 closer=k1<k2 ? vec3(k1,vExtra2.z,vExtra2.w) : vec3(k2,vExtra3.z,vExtra3.w);\nBlob_Color_Q71=closer.z*texture(_Blob_Texture_,vec2(vec2(sqrt(closer.x),closer.y).x,1.0-vec2(sqrt(closer.x),closer.y).y))*clamp(1.0-closer.x,0.0,1.0);\n#else\nBlob_Color_Q71=vec4(0,0,0,0);\n#endif\nvec4 Line_Color_Q48;\nLine_Fragment_B48(_Line_Color_,_Highlight_Color_,_Highlight_Width_,vTangent,_Highlight_,Line_Color_Q48);\nfloat X_Q67;\nfloat Y_Q67;\nX_Q67=vUV.x;\nY_Q67=vUV.y;\nvec3 Incident_Q66=normalize(vPosition-cameraPosition);\nvec3 Reflected_Q60=reflect(Incident_Q66,vBinormal);\nfloat Product_Q63=Y_Q67*_Vertical_Offset_;\nfloat Dot_Q68=dot(Incident_Q66, Reflected_Q60);\nfloat Dot_Q57=dot(vNormal, Incident_Q66);\nfloat Result_Q38;\nConditional_Float_B38(_Reflected_,Dot_Q68,Dot_Q57,Result_Q38);\nfloat Product_Q64=Result_Q38*_Frequency_;\nfloat Sum_Q69=Product_Q64+1.0;\nfloat Product_Q70=Sum_Q69*0.5;\nfloat Sum_Q62=Product_Q63+Product_Q70;\nfloat FractF_Q59=fract(Sum_Q62);\nvec2 Vec2_Q65=vec2(FractF_Q59,0.5);\nvec4 Color_Q58;\n#if IRIDESCENT_MAP_ENABLE\nColor_Q58=texture(_Iridescent_Map_,Vec2_Q65);\n#else\nColor_Q58=vec4(0,0,0,0);\n#endif\nvec4 Result_Q54;\nScale_RGB_B54(Color_Q58,_Iridescence_Edge_Intensity_,Result_Q54);\nvec4 Result_Q55;\nScale_RGB_B54(Color_Q58,_Iridescence_Intensity_,Result_Q55);\nvec4 Base_And_Iridescent_Q53;\nBase_And_Iridescent_Q53=Line_Color_Q48+vec4(Result_Q54.rgb,0.0);\nvec4 Base_And_Iridescent_Q56;\nBase_And_Iridescent_Q56=_Base_Color_+vec4(Result_Q55.rgb,0.0);\nvec4 Result_Q52=Base_And_Iridescent_Q53; Result_Q52.a=1.0;\nvec4 Result_Q35=Blob_Color_Q71+(1.0-Blob_Color_Q71.a)*Base_And_Iridescent_Q56;\nvec4 Color_Q31;\nRound_Rect_Fragment_B31(R_Q72,G_Q72,Result_Q52,_Filter_Width_,vUV,1.0,vExtra1,Result_Q35,Color_Q31);\nvec4 Result_Q47=_Fade_Out_*Color_Q31;\nvec4 Out_Color=Result_Q47;\nfloat Clip_Threshold=0.001;\nbool To_sRGB=false;\ngl_FragColor=Out_Color;\n}";h.ShaderStore.ShadersStore.fluentBackplateVertexShader="uniform mat4 world;\nuniform mat4 viewProjection;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\n#ifdef TANGENT\nattribute vec3 tangent;\n#else\nconst vec3 tangent=vec3(0.);\n#endif\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 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 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 float _Angle_;\nuniform float _Fade_Out_;\nuniform bool _Reflected_;\nuniform float _Frequency_;\nuniform float _Vertical_Offset_;\nuniform sampler2D _Iridescent_Map_;\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 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;\nvoid Object_To_World_Pos_B115(\nvec3 Pos_Object,\nout vec3 Pos_World)\n{\nPos_World=(world*vec4(Pos_Object,1.0)).xyz;\n}\nvoid PickDir_B140(\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 Round_Rect_Vertex_B139(\nvec2 UV,\nfloat Radius,\nfloat Margin,\nfloat Anisotropy,\nfloat Gradient1,\nfloat Gradient2,\nout vec2 Rect_UV,\nout vec4 Rect_Parms,\nout vec2 Scale_XY,\nout vec2 Line_UV)\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;\n}\nvoid Line_Vertex_B135(\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 Blob_Vertex_B180(\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,\nfloat Blob_Fade_Length,\nfloat Blob_Pulse,\nfloat Blob_Fade,\nout vec4 Blob_Info)\n{\nvec3 blob=Blob_Position;\nvec3 delta=blob-Position;\nfloat dist=dot(Normal,delta);\nfloat lerpValue=clamp((abs(dist)-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);\nfloat fadeValue=1.0-clamp((abs(dist)-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);\nfloat size=Blob_Near_Size+(Blob_Far_Size-Blob_Near_Size)*lerpValue;\nvec2 blobXY=vec2(dot(delta,Tangent),dot(delta,Bitangent))/(0.0001+size);\nfloat Fade=fadeValue*Intensity*Blob_Fade;\nfloat Distance=(lerpValue*0.5+0.5)*(1.0-Blob_Pulse);\nBlob_Info=vec4(blobXY.x,blobXY.y,Distance,Fade);\n}\nvoid Move_Verts_B129(\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 Object_To_World_Dir_B132(\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_B147(\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 Edge_AA_Vertex_B130(\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=(world* 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 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}";var Bt=function(t){function e(){var e=t.call(this)||this;return e.BLOB_ENABLE=!0,e.BLOB_ENABLE_2=!0,e.SMOOTH_EDGES=!0,e.IRIDESCENT_MAP_ENABLE=!0,e._needNormals=!0,e.rebuild(),e}return r(e,t),e}(h.MaterialDefines),Ct=function(t){function e(i,o){var n=t.call(this,i,o)||this;return n.radius=.03,n.lineWidth=.01,n.absoluteSizes=!1,n._filterWidth=1,n.baseColor=new h.Color4(.0392157,.0666667,.207843,1),n.lineColor=new h.Color4(.14902,.133333,.384314,1),n.blobIntensity=.98,n.blobFarSize=.04,n.blobNearDistance=0,n.blobFarDistance=.08,n.blobFadeLength=.08,n.blobNearSize=.22,n.blobPulse=0,n.blobFade=0,n.blobNearSize2=.22,n.blobPulse2=0,n.blobFade2=0,n._rate=.135,n.highlightColor=new h.Color4(.98,.98,.98,1),n.highlightWidth=.25,n._highlightTransform=new h.Vector4(1,1,0,0),n._highlight=1,n.iridescenceIntensity=0,n.iridescenceEdgeIntensity=1,n._angle=-45,n.fadeOut=1,n._reflected=!0,n._frequency=1,n._verticalOffset=0,n.globalLeftIndexTipPosition=h.Vector3.Zero(),n._globalLeftIndexTipPosition4=h.Vector4.Zero(),n.globalRightIndexTipPosition=h.Vector3.Zero(),n._globalRightIndexTipPosition4=h.Vector4.Zero(),n.alphaMode=h.Constants.ALPHA_DISABLE,n.backFaceCulling=!1,n._blobTexture=new h.Texture(e.BLOB_TEXTURE_URL,n.getScene(),!0,!1,h.Texture.NEAREST_SAMPLINGMODE),n._iridescentMap=new h.Texture(e.IM_TEXTURE_URL,n.getScene(),!0,!1,h.Texture.NEAREST_SAMPLINGMODE),n}return r(e,t),e.prototype.needAlphaBlending=function(){return!1},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){if(this.isFrozen&&e.effect&&e.effect._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new Bt);var i=e.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(e))return!0;var n=o.getEngine();if(h.MaterialHelper.PrepareDefinesForAttributes(t,i,!1,!1),i.isDirty){i.markAsProcessed(),o.resetCachedMaterial();var r=new h.EffectFallbacks;i.FOG&&r.addFallback(1,"FOG"),h.MaterialHelper.HandleFallbacksForShadows(i,r),i.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;var a=[h.VertexBuffer.PositionKind];i.NORMAL&&a.push(h.VertexBuffer.NormalKind),i.UV1&&a.push(h.VertexBuffer.UVKind),i.UV2&&a.push(h.VertexBuffer.UV2Kind),i.VERTEXCOLOR&&a.push(h.VertexBuffer.ColorKind),i.TANGENT&&a.push(h.VertexBuffer.TangentKind),h.MaterialHelper.PrepareAttributesForInstances(a,i);var s=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"],_=["_Blob_Texture_","_Iridescent_Map_"],c=new Array;h.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:l,uniformBuffersNames:c,samplers:_,defines:i,maxSimultaneousLights:4}),e.setEffect(o.getEngine().createEffect("fluentBackplate",{attributes:a,uniformsNames:l,uniformBuffersNames:c,samplers:_,defines:s,fallbacks:r,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),i,this._materialContext)}return!(!e.effect||!e.effect.isReady()||(i._renderId=o.getRenderId(),e.effect._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){var o,n;if(i.materialDefines){var r=i.effect;r&&(this._activeEffect=r,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",this.getScene().getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",null!==(n=null===(o=this.getScene().activeCamera)||void 0===o?void 0:o.position)&&void 0!==n?n:h.Vector3.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(e,this._activeEffect))}},e.prototype.getAnimatables=function(){return[]},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e),this._blobTexture.dispose(),this._iridescentMap.dispose()},e.prototype.clone=function(t){var i=this;return h.SerializationHelper.Clone((function(){return new e(t,i.getScene())}),this)},e.prototype.serialize=function(){var e=t.prototype.serialize.call(this);return e.customType="BABYLON.FluentBackplateMaterial",e},e.prototype.getClassName=function(){return"FluentBackplateMaterial"},e.Parse=function(t,i,o){return h.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},e.BLOB_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/mrtk-fluent-backplate-blob.png",e.IM_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/mrtk-fluent-backplate-iridescence.png",s([(0,h.serialize)()],e.prototype,"radius",void 0),s([(0,h.serialize)()],e.prototype,"lineWidth",void 0),s([(0,h.serialize)()],e.prototype,"absoluteSizes",void 0),s([(0,h.serialize)()],e.prototype,"baseColor",void 0),s([(0,h.serialize)()],e.prototype,"lineColor",void 0),s([(0,h.serialize)()],e.prototype,"blobIntensity",void 0),s([(0,h.serialize)()],e.prototype,"blobFarSize",void 0),s([(0,h.serialize)()],e.prototype,"blobNearDistance",void 0),s([(0,h.serialize)()],e.prototype,"blobFarDistance",void 0),s([(0,h.serialize)()],e.prototype,"blobFadeLength",void 0),s([(0,h.serialize)()],e.prototype,"blobNearSize",void 0),s([(0,h.serialize)()],e.prototype,"blobPulse",void 0),s([(0,h.serialize)()],e.prototype,"blobFade",void 0),s([(0,h.serialize)()],e.prototype,"blobNearSize2",void 0),s([(0,h.serialize)()],e.prototype,"blobPulse2",void 0),s([(0,h.serialize)()],e.prototype,"blobFade2",void 0),s([(0,h.serialize)()],e.prototype,"highlightColor",void 0),s([(0,h.serialize)()],e.prototype,"highlightWidth",void 0),s([(0,h.serialize)()],e.prototype,"iridescenceIntensity",void 0),s([(0,h.serialize)()],e.prototype,"iridescenceEdgeIntensity",void 0),s([(0,h.serialize)()],e.prototype,"fadeOut",void 0),s([(0,h.serializeAsVector3)()],e.prototype,"globalLeftIndexTipPosition",void 0),s([(0,h.serializeAsVector3)()],e.prototype,"globalRightIndexTipPosition",void 0),e}(h.PushMaterial);(0,h.RegisterClass)("BABYLON.GUI.FluentBackplateMaterial",Ct);var Tt=function(t){function e(e,i){void 0===i&&(i=!0);var o=t.call(this,e)||this;return o._shareMaterials=i,o}return r(e,t),Object.defineProperty(e.prototype,"renderingGroupId",{get:function(){return this._model.renderingGroupId},set:function(t){this._model.renderingGroupId=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"material",{get:function(){return this._material},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shareMaterials",{get:function(){return this._shareMaterials},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"HolographicBackplate"},e.prototype._createNode=function(t){var i,o=this,n=(0,h.CreateBox)((null!==(i=this.name)&&void 0!==i?i:"HolographicBackplate")+"_CollisionMesh",{width:1,height:1,depth:1},t);return n.isPickable=!0,n.visibility=0,h.SceneLoader.ImportMeshAsync(void 0,e.MODEL_BASE_URL,e.MODEL_FILENAME,t).then((function(t){var e=t.meshes[1];e.name="".concat(o.name,"_frontPlate"),e.isPickable=!1,e.parent=n,o._material&&(e.material=o._material),o._model=e})),n},e.prototype._createMaterial=function(t){this._material=new Ct(this.name+" Material",t.getScene())},e.prototype._affectMaterial=function(t){this._shareMaterials?this._host._touchSharedMaterials.fluentBackplateMaterial?this._material=this._host._touchSharedMaterials.fluentBackplateMaterial:(this._createMaterial(t),this._host._touchSharedMaterials.fluentBackplateMaterial=this._material):this._createMaterial(t)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.shareMaterials||this._material.dispose(),this._model.dispose()},e.MODEL_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",e.MODEL_FILENAME="mrtk-fluent-backplate.glb",e}(dt),St=function(t){function e(e,i){void 0===i&&(i=!0);var o=t.call(this,e)||this;return o._shareMaterials=!0,o._shareMaterials=i,o.pointerEnterAnimation=function(){o.mesh&&o._frontPlate.setEnabled(!0)},o.pointerOutAnimation=function(){o.mesh&&o._frontPlate.setEnabled(!1)},o}return r(e,t),e.prototype._disposeTooltip=function(){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)},Object.defineProperty(e.prototype,"renderingGroupId",{get:function(){return this._backPlate.renderingGroupId},set:function(t){this._backPlate.renderingGroupId=t,this._textPlate.renderingGroupId=t,this._frontPlate.renderingGroupId=t,this._tooltipMesh&&(this._tooltipMesh.renderingGroupId=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tooltipText",{get:function(){return this._tooltipTextBlock?this._tooltipTextBlock.text:null},set:function(t){var e=this;if(t){if(!this._tooltipFade){var i=this._backPlate._scene.useRightHandedSystem;this._tooltipMesh=(0,h.CreatePlane)("",{size:1},this._backPlate._scene);var o=(0,h.CreatePlane)("",{size:1,sideOrientation:h.Mesh.DOUBLESIDE},this._backPlate._scene),n=new h.StandardMaterial("",this._backPlate._scene);n.diffuseColor=h.Color3.FromHexString("#212121"),o.material=n,o.isPickable=!1,this._tooltipMesh.addChild(o),o.position=h.Vector3.Forward(i).scale(.05),this._tooltipMesh.scaling.y=1/3,this._tooltipMesh.position=h.Vector3.Up().scale(.7).add(h.Vector3.Forward(i).scale(-.15)),this._tooltipMesh.isPickable=!1,this._tooltipMesh.parent=this._backPlate,this._tooltipTexture=lt.CreateForMesh(this._tooltipMesh),this._tooltipTextBlock=new B,this._tooltipTextBlock.scaleY=3,this._tooltipTextBlock.color="white",this._tooltipTextBlock.fontSize=130,this._tooltipTexture.addControl(this._tooltipTextBlock),this._tooltipFade=new h.FadeInOutBehavior,this._tooltipFade.delay=500,this._tooltipMesh.addBehavior(this._tooltipFade),this._tooltipHoverObserver=this.onPointerEnterObservable.add((function(){e._tooltipFade&&e._tooltipFade.fadeIn(!0)})),this._tooltipOutObserver=this.onPointerOutObservable.add((function(){e._tooltipFade&&e._tooltipFade.fadeIn(!1)}))}this._tooltipTextBlock&&(this._tooltipTextBlock.text=t)}else this._disposeTooltip()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){this._text!==t&&(this._text=t,this._rebuildContent())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"imageUrl",{get:function(){return this._imageUrl},set:function(t){this._imageUrl!==t&&(this._imageUrl=t,this._rebuildContent())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backMaterial",{get:function(){return this._backMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"frontMaterial",{get:function(){return this._frontMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"plateMaterial",{get:function(){return this._plateMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shareMaterials",{get:function(){return this._shareMaterials},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"HolographicButton"},e.prototype._rebuildContent=function(){this._disposeFacadeTexture();var t=new S;if(t.isVertical=!0,h.DomManagement.IsDocumentAvailable()&&document.createElement&&this._imageUrl){var e=new C;e.source=this._imageUrl,e.paddingTop="40px",e.height="180px",e.width="100px",e.paddingBottom="40px",t.addControl(e)}if(this._text){var i=new B;i.text=this._text,i.color="white",i.height="30px",i.fontSize=24,t.addControl(i)}this._frontPlate&&(this.content=t)},e.prototype._createNode=function(e){return this._backPlate=(0,h.CreateBox)(this.name+"BackMesh",{width:1,height:1,depth:.08},e),this._frontPlate=(0,h.CreateBox)(this.name+"FrontMesh",{width:1,height:1,depth:.08},e),this._frontPlate.parent=this._backPlate,this._frontPlate.position=h.Vector3.Forward(e.useRightHandedSystem).scale(-.08),this._frontPlate.isPickable=!1,this._frontPlate.setEnabled(!1),this._textPlate=t.prototype._createNode.call(this,e),this._textPlate.parent=this._backPlate,this._textPlate.position=h.Vector3.Forward(e.useRightHandedSystem).scale(-.08),this._textPlate.isPickable=!1,this._backPlate},e.prototype._applyFacade=function(t){this._plateMaterial.emissiveTexture=t,this._plateMaterial.opacityTexture=t},e.prototype._createBackMaterial=function(t){var e=this;this._backMaterial=new xt(this.name+"Back Material",t.getScene()),this._backMaterial.renderHoverLight=!0,this._pickedPointObserver=this._host.onPickedPointChangedObservable.add((function(t){t?(e._backMaterial.hoverPosition=t,e._backMaterial.hoverColor.a=1):e._backMaterial.hoverColor.a=0}))},e.prototype._createFrontMaterial=function(t){this._frontMaterial=new xt(this.name+"Front Material",t.getScene()),this._frontMaterial.innerGlowColorIntensity=0,this._frontMaterial.alpha=.5,this._frontMaterial.renderBorders=!0},e.prototype._createPlateMaterial=function(t){this._plateMaterial=new h.StandardMaterial(this.name+"Plate Material",t.getScene()),this._plateMaterial.specularColor=h.Color3.Black()},e.prototype._affectMaterial=function(t){this._shareMaterials?(this._host._sharedMaterials.backFluentMaterial?this._backMaterial=this._host._sharedMaterials.backFluentMaterial:(this._createBackMaterial(t),this._host._sharedMaterials.backFluentMaterial=this._backMaterial),this._host._sharedMaterials.frontFluentMaterial?this._frontMaterial=this._host._sharedMaterials.frontFluentMaterial:(this._createFrontMaterial(t),this._host._sharedMaterials.frontFluentMaterial=this._frontMaterial)):(this._createBackMaterial(t),this._createFrontMaterial(t)),this._createPlateMaterial(t),this._backPlate.material=this._backMaterial,this._frontPlate.material=this._frontMaterial,this._textPlate.material=this._plateMaterial,this._rebuildContent()},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._disposeTooltip(),this.shareMaterials||(this._backMaterial.dispose(),this._frontMaterial.dispose(),this._plateMaterial.dispose(),this._pickedPointObserver&&(this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver),this._pickedPointObserver=null))},e}(gt);h.ShaderStore.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}";h.ShaderStore.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}";var Ot=function(t){function e(){var e=t.call(this)||this;return e.RELATIVE_WIDTH=!0,e.ENABLE_FADE=!0,e._needNormals=!0,e._needUVs=!0,e.rebuild(),e}return r(e,t),e}(h.MaterialDefines),Rt=function(t){function e(i,o){var n=t.call(this,i,o)||this;return n.edgeWidth=.04,n.edgeColor=new h.Color4(.592157,.592157,.592157,1),n.proximityMaxIntensity=.45,n.proximityFarDistance=.16,n.proximityNearRadius=1.5,n.proximityAnisotropy=1,n.selectionFuzz=.5,n.selected=0,n.selectionFade=0,n.selectionFadeSize=.3,n.selectedDistance=.08,n.selectedFadeLength=.08,n.blobIntensity=.5,n.blobFarSize=.05,n.blobNearDistance=0,n.blobFarDistance=.08,n.blobFadeLength=.08,n.leftBlobEnable=!0,n.leftBlobNearSize=.025,n.leftBlobPulse=0,n.leftBlobFade=1,n.leftBlobInnerFade=.01,n.rightBlobEnable=!0,n.rightBlobNearSize=.025,n.rightBlobPulse=0,n.rightBlobFade=1,n.rightBlobInnerFade=.01,n.activeFaceDir=new h.Vector3(0,0,-1),n.activeFaceUp=new h.Vector3(0,1,0),n.enableFade=!0,n.fadeWidth=1.5,n.smoothActiveFace=!0,n.showFrame=!1,n.useBlobTexture=!0,n.globalLeftIndexTipPosition=h.Vector3.Zero(),n.globalRightIndexTipPosition=h.Vector3.Zero(),n.alphaMode=h.Constants.ALPHA_ADD,n.disableDepthWrite=!0,n.backFaceCulling=!1,n._blobTexture=new h.Texture(e.BLOB_TEXTURE_URL,n.getScene(),!0,!1,h.Texture.NEAREST_SAMPLINGMODE),n}return r(e,t),e.prototype.needAlphaBlending=function(){return!0},e.prototype.needAlphaTesting=function(){return!0},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){if(this.isFrozen&&e.effect&&e.effect._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new Ot);var i=e.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(e))return!0;var n=o.getEngine();if(h.MaterialHelper.PrepareDefinesForAttributes(t,i,!0,!1),i.isDirty){i.markAsProcessed(),o.resetCachedMaterial();var r=new h.EffectFallbacks;i.FOG&&r.addFallback(1,"FOG"),h.MaterialHelper.HandleFallbacksForShadows(i,r),i.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;var a=[h.VertexBuffer.PositionKind];i.NORMAL&&a.push(h.VertexBuffer.NormalKind),i.UV1&&a.push(h.VertexBuffer.UVKind),i.UV2&&a.push(h.VertexBuffer.UV2Kind),i.VERTEXCOLOR&&a.push(h.VertexBuffer.ColorKind),i.TANGENT&&a.push(h.VertexBuffer.TangentKind),h.MaterialHelper.PrepareAttributesForInstances(a,i);var s=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"],_=["_Blob_Texture_"],c=new Array;h.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:l,uniformBuffersNames:c,samplers:_,defines:i,maxSimultaneousLights:4}),e.setEffect(o.getEngine().createEffect("fluentButton",{attributes:a,uniformsNames:l,uniformBuffersNames:c,samplers:_,defines:s,fallbacks:r,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),i,this._materialContext)}return!(!e.effect||!e.effect.isReady()||(i._renderId=o.getRenderId(),e.effect._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){var o=this.getScene();if(i.materialDefines){var n=i.effect;n&&(this._activeEffect=n,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",o.getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",o.activeCamera.position),this._activeEffect.setTexture("_Blob_Texture_",this._blobTexture),this._activeEffect.setFloat("_Edge_Width_",this.edgeWidth),this._activeEffect.setColor4("_Edge_Color_",new h.Color3(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 h.Vector4(this.globalLeftIndexTipPosition.x,this.globalLeftIndexTipPosition.y,this.globalLeftIndexTipPosition.z,1)),this._activeEffect.setVector4("Global_Right_Index_Tip_Position",new h.Vector4(this.globalRightIndexTipPosition.x,this.globalRightIndexTipPosition.y,this.globalRightIndexTipPosition.z,1)),this._afterBind(e,this._activeEffect))}},e.prototype.getAnimatables=function(){return[]},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e)},e.prototype.clone=function(t){var i=this;return h.SerializationHelper.Clone((function(){return new e(t,i.getScene())}),this)},e.prototype.serialize=function(){var e=t.prototype.serialize.call(this);return e.customType="BABYLON.FluentButtonMaterial",e},e.prototype.getClassName=function(){return"FluentButtonMaterial"},e.Parse=function(t,i,o){return h.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},e.BLOB_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/mrtk-fluent-button-blob.png",s([(0,h.serialize)()],e.prototype,"edgeWidth",void 0),s([(0,h.serializeAsColor4)()],e.prototype,"edgeColor",void 0),s([(0,h.serialize)()],e.prototype,"proximityMaxIntensity",void 0),s([(0,h.serialize)()],e.prototype,"proximityFarDistance",void 0),s([(0,h.serialize)()],e.prototype,"proximityNearRadius",void 0),s([(0,h.serialize)()],e.prototype,"proximityAnisotropy",void 0),s([(0,h.serialize)()],e.prototype,"selectionFuzz",void 0),s([(0,h.serialize)()],e.prototype,"selected",void 0),s([(0,h.serialize)()],e.prototype,"selectionFade",void 0),s([(0,h.serialize)()],e.prototype,"selectionFadeSize",void 0),s([(0,h.serialize)()],e.prototype,"selectedDistance",void 0),s([(0,h.serialize)()],e.prototype,"selectedFadeLength",void 0),s([(0,h.serialize)()],e.prototype,"blobIntensity",void 0),s([(0,h.serialize)()],e.prototype,"blobFarSize",void 0),s([(0,h.serialize)()],e.prototype,"blobNearDistance",void 0),s([(0,h.serialize)()],e.prototype,"blobFarDistance",void 0),s([(0,h.serialize)()],e.prototype,"blobFadeLength",void 0),s([(0,h.serialize)()],e.prototype,"leftBlobEnable",void 0),s([(0,h.serialize)()],e.prototype,"leftBlobNearSize",void 0),s([(0,h.serialize)()],e.prototype,"leftBlobPulse",void 0),s([(0,h.serialize)()],e.prototype,"leftBlobFade",void 0),s([(0,h.serialize)()],e.prototype,"leftBlobInnerFade",void 0),s([(0,h.serialize)()],e.prototype,"rightBlobEnable",void 0),s([(0,h.serialize)()],e.prototype,"rightBlobNearSize",void 0),s([(0,h.serialize)()],e.prototype,"rightBlobPulse",void 0),s([(0,h.serialize)()],e.prototype,"rightBlobFade",void 0),s([(0,h.serialize)()],e.prototype,"rightBlobInnerFade",void 0),s([(0,h.serializeAsVector3)()],e.prototype,"activeFaceDir",void 0),s([(0,h.serializeAsVector3)()],e.prototype,"activeFaceUp",void 0),s([(0,h.serialize)()],e.prototype,"enableFade",void 0),s([(0,h.serialize)()],e.prototype,"fadeWidth",void 0),s([(0,h.serialize)()],e.prototype,"smoothActiveFace",void 0),s([(0,h.serialize)()],e.prototype,"showFrame",void 0),s([(0,h.serialize)()],e.prototype,"useBlobTexture",void 0),s([(0,h.serializeAsVector3)()],e.prototype,"globalLeftIndexTipPosition",void 0),s([(0,h.serializeAsVector3)()],e.prototype,"globalRightIndexTipPosition",void 0),e}(h.PushMaterial);(0,h.RegisterClass)("BABYLON.GUI.FluentButtonMaterial",Rt);var wt=function(t){function e(e,i){var o=t.call(this,e)||this;return o._isNearPressed=!1,o._interactionSurfaceHeight=0,o._isToggleButton=!1,o._toggleState=!1,o._toggleButtonCallback=function(){o._onToggle(!o._toggleState)},o.onToggleObservable=new h.Observable,o.collidableFrontDirection=h.Vector3.Zero(),i&&(o.collisionMesh=i),o}return r(e,t),Object.defineProperty(e.prototype,"isActiveNearInteraction",{get:function(){return this._isNearPressed},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"collidableFrontDirection",{get:function(){if(this._collisionMesh){var t=h.TmpVectors.Vector3[0];return h.Vector3.TransformNormalToRef(this._collidableFrontDirection,this._collisionMesh.getWorldMatrix(),t),t.normalize()}return this._collidableFrontDirection},set:function(t){if(this._collidableFrontDirection=t.normalize(),this._collisionMesh){var e=h.TmpVectors.Matrix[0];e.copyFrom(this._collisionMesh.getWorldMatrix()),e.invert(),h.Vector3.TransformNormalToRef(this._collidableFrontDirection,e,this._collidableFrontDirection),this._collidableFrontDirection.normalize()}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"collisionMesh",{set:function(t){var e,i=this;this._collisionMesh&&(this._collisionMesh.isNearPickable=!1,(null===(e=this._collisionMesh.reservedDataStore)||void 0===e?void 0:e.GUI3D)&&(this._collisionMesh.reservedDataStore.GUI3D={}),this._collisionMesh.getChildMeshes().forEach((function(t){var e;t.isNearPickable=!1,(null===(e=t.reservedDataStore)||void 0===e?void 0:e.GUI3D)&&(t.reservedDataStore.GUI3D={})}))),this._collisionMesh=t,this._injectGUI3DReservedDataStore(this._collisionMesh).control=this,this._collisionMesh.isNearPickable=!0,this._collisionMesh.getChildMeshes().forEach((function(t){i._injectGUI3DReservedDataStore(t).control=i,t.isNearPickable=!0})),this.collidableFrontDirection=t.forward},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isToggleButton",{get:function(){return this._isToggleButton},set:function(t){t!==this._isToggleButton&&(this._isToggleButton=t,t?this.onPointerUpObservable.add(this._toggleButtonCallback):(this.onPointerUpObservable.removeCallback(this._toggleButtonCallback),this._toggleState&&this._onToggle(!1)))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isToggled",{get:function(){return this._toggleState},set:function(t){this._isToggleButton&&this._toggleState!==t&&this._onToggle(t)},enumerable:!1,configurable:!0}),e.prototype._onToggle=function(t){this._toggleState=t,this.onToggleObservable.notifyObservers(t)},e.prototype._isInteractionInFrontOfButton=function(t){return this._getInteractionHeight(t,this._collisionMesh.getAbsolutePosition())>0},e.prototype.getPressDepth=function(t){if(!this._isNearPressed)return 0;var e=this._getInteractionHeight(t,this._collisionMesh.getAbsolutePosition());return this._interactionSurfaceHeight-e},e.prototype._getInteractionHeight=function(t,e){var i=this.collidableFrontDirection;if(0===i.length())return h.Vector3.Distance(t,e);var o=h.Vector3.Dot(e,i);return h.Vector3.Dot(t,i)-o},e.prototype._generatePointerEventType=function(t,e,i){if(t===h.PointerEventTypes.POINTERDOWN||t===h.PointerEventTypes.POINTERMOVE){if(!this._isInteractionInFrontOfButton(e))return h.PointerEventTypes.POINTERMOVE;this._isNearPressed=!0,this._interactionSurfaceHeight=this._getInteractionHeight(e,this._collisionMesh.getAbsolutePosition())}if(t===h.PointerEventTypes.POINTERUP){if(0==i)return h.PointerEventTypes.POINTERMOVE;this._isNearPressed=!1}return t},e.prototype._getTypeName=function(){return"TouchButton3D"},e.prototype._createNode=function(e){return t.prototype._createNode.call(this,e)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.onPointerUpObservable.removeCallback(this._toggleButtonCallback),this.onToggleObservable.clear(),this._collisionMesh&&this._collisionMesh.dispose()},e}(gt),Mt=function(t){function e(e,i){void 0===i&&(i=!0);var o=t.call(this,e)||this;return o._shareMaterials=!0,o._isBackplateVisible=!0,o._frontPlateDepth=.5,o._backPlateDepth=.04,o._backplateColor=new h.Color3(.08,.15,.55),o._backplateToggledColor=new h.Color3(.25,.4,.95),o._shareMaterials=i,o.pointerEnterAnimation=function(){o._frontMaterial.leftBlobEnable=!0,o._frontMaterial.rightBlobEnable=!0},o.pointerOutAnimation=function(){o._frontMaterial.leftBlobEnable=!1,o._frontMaterial.rightBlobEnable=!1},o.pointerDownAnimation=function(){o._frontPlate&&!o.isActiveNearInteraction&&(o._frontPlate.scaling.z=.2*o._frontPlateDepth,o._frontPlate.position=h.Vector3.Forward(o._frontPlate._scene.useRightHandedSystem).scale((o._frontPlateDepth-.2*o._frontPlateDepth)/2),o._textPlate.position=h.Vector3.Forward(o._textPlate._scene.useRightHandedSystem).scale(-(o._backPlateDepth+.2*o._frontPlateDepth)/2))},o.pointerUpAnimation=function(){o._frontPlate&&(o._frontPlate.scaling.z=o._frontPlateDepth,o._frontPlate.position=h.Vector3.Forward(o._frontPlate._scene.useRightHandedSystem).scale((o._frontPlateDepth-o._frontPlateDepth)/2),o._textPlate.position=h.Vector3.Forward(o._textPlate._scene.useRightHandedSystem).scale(-(o._backPlateDepth+o._frontPlateDepth)/2))},o.onPointerMoveObservable.add((function(t){if(o._frontPlate&&o.isActiveNearInteraction){var e=h.Vector3.Zero();if(o._backPlate.getWorldMatrix().decompose(e,void 0,void 0)){var i=o._getInteractionHeight(t,o._backPlate.getAbsolutePosition())/e.z;i=h.Scalar.Clamp(i-o._backPlateDepth/2,.2*o._frontPlateDepth,o._frontPlateDepth),o._frontPlate.scaling.z=i,o._frontPlate.position=h.Vector3.Forward(o._frontPlate._scene.useRightHandedSystem).scale((o._frontPlateDepth-i)/2),o._textPlate.position=h.Vector3.Forward(o._textPlate._scene.useRightHandedSystem).scale(-(o._backPlateDepth+i)/2)}}})),o._pointerHoverObserver=o.onPointerMoveObservable.add((function(t){o._frontMaterial.globalLeftIndexTipPosition=t})),o}return r(e,t),e.prototype._disposeTooltip=function(){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)},Object.defineProperty(e.prototype,"renderingGroupId",{get:function(){return this._backPlate.renderingGroupId},set:function(t){this._backPlate.renderingGroupId=t,this._textPlate.renderingGroupId=t,this._frontPlate.renderingGroupId=t,this._tooltipMesh&&(this._tooltipMesh.renderingGroupId=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mesh",{get:function(){return this._backPlate},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tooltipText",{get:function(){return this._tooltipTextBlock?this._tooltipTextBlock.text:null},set:function(t){var e=this;if(t){if(!this._tooltipFade){var i=this._backPlate._scene.useRightHandedSystem;this._tooltipMesh=(0,h.CreatePlane)("",{size:1},this._backPlate._scene);var o=(0,h.CreatePlane)("",{size:1,sideOrientation:h.Mesh.DOUBLESIDE},this._backPlate._scene),n=new h.StandardMaterial("",this._backPlate._scene);n.diffuseColor=h.Color3.FromHexString("#212121"),o.material=n,o.isPickable=!1,this._tooltipMesh.addChild(o),o.position=h.Vector3.Forward(i).scale(.05),this._tooltipMesh.scaling.y=1/3,this._tooltipMesh.position=h.Vector3.Up().scale(.7).add(h.Vector3.Forward(i).scale(-.15)),this._tooltipMesh.isPickable=!1,this._tooltipMesh.parent=this._backPlate,this._tooltipTexture=lt.CreateForMesh(this._tooltipMesh),this._tooltipTextBlock=new B,this._tooltipTextBlock.scaleY=3,this._tooltipTextBlock.color="white",this._tooltipTextBlock.fontSize=130,this._tooltipTexture.addControl(this._tooltipTextBlock),this._tooltipFade=new h.FadeInOutBehavior,this._tooltipFade.delay=500,this._tooltipMesh.addBehavior(this._tooltipFade),this._tooltipHoverObserver=this.onPointerEnterObservable.add((function(){e._tooltipFade&&e._tooltipFade.fadeIn(!0)})),this._tooltipOutObserver=this.onPointerOutObservable.add((function(){e._tooltipFade&&e._tooltipFade.fadeIn(!1)}))}this._tooltipTextBlock&&(this._tooltipTextBlock.text=t)}else this._disposeTooltip()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){this._text!==t&&(this._text=t,this._rebuildContent())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"imageUrl",{get:function(){return this._imageUrl},set:function(t){this._imageUrl!==t&&(this._imageUrl=t,this._rebuildContent())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backMaterial",{get:function(){return this._backMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"frontMaterial",{get:function(){return this._frontMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"plateMaterial",{get:function(){return this._plateMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shareMaterials",{get:function(){return this._shareMaterials},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isBackplateVisible",{set:function(t){this.mesh&&this._backMaterial&&(t&&!this._isBackplateVisible?this._backPlate.visibility=1:!t&&this._isBackplateVisible&&(this._backPlate.visibility=0)),this._isBackplateVisible=t},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"TouchHolographicButton"},e.prototype._rebuildContent=function(){this._disposeFacadeTexture();var t=new S;if(t.isVertical=!0,h.DomManagement.IsDocumentAvailable()&&document.createElement&&this._imageUrl){var e=new C;e.source=this._imageUrl,e.paddingTop="40px",e.height="180px",e.width="100px",e.paddingBottom="40px",t.addControl(e)}if(this._text){var i=new B;i.text=this._text,i.color="white",i.height="30px",i.fontSize=24,t.addControl(i)}this.content=t},e.prototype._createNode=function(i){var o,n=this;this.name=null!==(o=this.name)&&void 0!==o?o:"TouchHolographicButton";var r=(0,h.CreateBox)("".concat(this.name,"_collisionMesh"),{width:1,height:1,depth:this._frontPlateDepth},i);r.isPickable=!0,r.isNearPickable=!0,r.visibility=0,r.position=h.Vector3.Forward(i.useRightHandedSystem).scale(-this._frontPlateDepth/2),h.SceneLoader.ImportMeshAsync(void 0,e.MODEL_BASE_URL,e.MODEL_FILENAME,i).then((function(t){var e=(0,h.CreateBox)("${this.name}_alphaMesh",{width:1,height:1,depth:1},i);e.isPickable=!1,e.material=new h.StandardMaterial("${this.name}_alphaMesh_material",i),e.material.alpha=.15;var o=t.meshes[1];o.name="".concat(n.name,"_frontPlate"),o.isPickable=!1,o.scaling.z=n._frontPlateDepth,e.parent=o,o.parent=r,n._frontMaterial&&(o.material=n._frontMaterial),n._frontPlate=o})),this._backPlate=(0,h.CreateBox)("".concat(this.name,"_backPlate"),{width:1,height:1,depth:this._backPlateDepth},i),this._backPlate.position=h.Vector3.Forward(i.useRightHandedSystem).scale(this._backPlateDepth/2),this._backPlate.isPickable=!1,this._textPlate=t.prototype._createNode.call(this,i),this._textPlate.name="".concat(this.name,"_textPlate"),this._textPlate.isPickable=!1,this._textPlate.position=h.Vector3.Forward(i.useRightHandedSystem).scale(-this._frontPlateDepth/2),this._backPlate.addChild(r),this._backPlate.addChild(this._textPlate);var a=new h.TransformNode("{this.name}_root",i);return this._backPlate.setParent(a),this.collisionMesh=r,this.collidableFrontDirection=this._backPlate.forward.negate(),a},e.prototype._applyFacade=function(t){this._plateMaterial.emissiveTexture=t,this._plateMaterial.opacityTexture=t,this._plateMaterial.diffuseColor=new h.Color3(.4,.4,.4)},e.prototype._createBackMaterial=function(t){this._backMaterial=new xt(this.name+"backPlateMaterial",t.getScene()),this._backMaterial.albedoColor=this._backplateColor,this._backMaterial.renderBorders=!0,this._backMaterial.renderHoverLight=!1},e.prototype._createFrontMaterial=function(t){this._frontMaterial=new Rt(this.name+"Front Material",t.getScene())},e.prototype._createPlateMaterial=function(t){this._plateMaterial=new h.StandardMaterial(this.name+"Plate Material",t.getScene()),this._plateMaterial.specularColor=h.Color3.Black()},e.prototype._onToggle=function(e){this._backMaterial&&(this._backMaterial.albedoColor=e?this._backplateToggledColor:this._backplateColor),t.prototype._onToggle.call(this,e)},e.prototype._affectMaterial=function(t){this._shareMaterials?(this._host._touchSharedMaterials.backFluentMaterial?this._backMaterial=this._host._touchSharedMaterials.backFluentMaterial:(this._createBackMaterial(t),this._host._touchSharedMaterials.backFluentMaterial=this._backMaterial),this._host._touchSharedMaterials.frontFluentMaterial?this._frontMaterial=this._host._touchSharedMaterials.frontFluentMaterial:(this._createFrontMaterial(t),this._host._touchSharedMaterials.frontFluentMaterial=this._frontMaterial)):(this._createBackMaterial(t),this._createFrontMaterial(t)),this._createPlateMaterial(t),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()},e.prototype.dispose=function(){t.prototype.dispose.call(this),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))},e.MODEL_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",e.MODEL_FILENAME="mrtk-fluent-button.glb",e}(wt),Et=function(){function t(){this.followBehaviorEnabled=!1,this.sixDofDragBehaviorEnabled=!0,this.surfaceMagnetismBehaviorEnabled=!0,this._followBehavior=new h.FollowBehavior,this._sixDofDragBehavior=new h.SixDofDragBehavior,this._surfaceMagnetismBehavior=new h.SurfaceMagnetismBehavior}return Object.defineProperty(t.prototype,"name",{get:function(){return"Default"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"followBehavior",{get:function(){return this._followBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sixDofDragBehavior",{get:function(){return this._sixDofDragBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"surfaceMagnetismBehavior",{get:function(){return this._surfaceMagnetismBehavior},enumerable:!1,configurable:!0}),t.prototype.init=function(){},t.prototype.attach=function(t,e,i){this._scene=t.getScene(),this.attachedNode=t,this._addObservables(),this._followBehavior.attach(t),this._sixDofDragBehavior.attach(t),this._sixDofDragBehavior.draggableMeshes=e||null,this._sixDofDragBehavior.faceCameraOnDragStart=!0,this._surfaceMagnetismBehavior.attach(t,this._scene),i&&(this._surfaceMagnetismBehavior.meshes=i),this._surfaceMagnetismBehavior.enabled=!1},t.prototype.detach=function(){this.attachedNode=null,this._removeObservables(),this._followBehavior.detach(),this._sixDofDragBehavior.detach(),this._surfaceMagnetismBehavior.detach()},t.prototype._addObservables=function(){var t=this;this._onBeforeRenderObserver=this._scene.onBeforeRenderObservable.add((function(){t._followBehavior._enabled=!t._sixDofDragBehavior.isMoving&&t.followBehaviorEnabled})),this._onDragObserver=this._sixDofDragBehavior.onDragObservable.add((function(e){t._sixDofDragBehavior.disableMovement=t._surfaceMagnetismBehavior.findAndUpdateTarget(e.pickInfo)}))},t.prototype._removeObservables=function(){this._scene.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),this._sixDofDragBehavior.onDragObservable.remove(this._onDragObserver)},t}();h.ShaderStore.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}";h.ShaderStore.ShadersStore.handlePixelShader="uniform vec3 color;\nvoid main(void) {\ngl_FragColor=vec4(color,1.0);\n}";var Ft,Dt=function(t){function e(e,i){var o=t.call(this,e,i,"handle",{attributes:["position"],uniforms:["worldViewProjection","color","scale","positionOffset"],needAlphaBlending:!1,needAlphaTesting:!1})||this;return o._hover=!1,o._drag=!1,o._color=new h.Color3,o._scale=1,o._lastTick=-1,o.animationLength=100,o.hoverColor=new h.Color3(0,.467,.84),o.baseColor=new h.Color3(1,1,1),o.hoverScale=.75,o.baseScale=.35,o.dragScale=.55,o._positionOffset=h.Vector3.Zero(),o._updateInterpolationTarget(),o._lastTick=Date.now(),o._onBeforeRender=o.getScene().onBeforeRenderObservable.add((function(){var t=Date.now(),e=t-o._lastTick,i=o._targetScale-o._scale,n=h.TmpColors.Color3[0].copyFrom(o._targetColor).subtractToRef(o._color,h.TmpColors.Color3[0]);o._scale=o._scale+i*e/o.animationLength,n.scaleToRef(e/o.animationLength,n),o._color.addToRef(n,o._color),o.setColor3("color",o._color),o.setFloat("scale",o._scale),o.setVector3("positionOffset",o._positionOffset),o._lastTick=t})),o}return r(e,t),Object.defineProperty(e.prototype,"hover",{get:function(){return this._hover},set:function(t){this._hover=t,this._updateInterpolationTarget()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"drag",{get:function(){return this._drag},set:function(t){this._drag=t,this._updateInterpolationTarget()},enumerable:!1,configurable:!0}),e.prototype._updateInterpolationTarget=function(){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)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.getScene().onBeforeRenderObservable.remove(this._onBeforeRender)},e}(h.ShaderMaterial);!function(t){t[t.IDLE=0]="IDLE",t[t.HOVER=1]="HOVER",t[t.DRAG=2]="DRAG"}(Ft||(Ft={}));var Lt=function(){function t(t,e){this._state=Ft.IDLE,this._materials=[],this._scene=e,this._gizmo=t,this.node=this.createNode(),this.node.reservedDataStore={handle:this}}return Object.defineProperty(t.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"gizmo",{get:function(){return this._gizmo},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hover",{set:function(t){t?this._state|=Ft.HOVER:this._state&=~Ft.HOVER,this._updateMaterial()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"drag",{set:function(t){t?this._state|=Ft.DRAG:this._state&=~Ft.DRAG,this._updateMaterial()},enumerable:!1,configurable:!0}),t.prototype._createMaterial=function(t){var e=new Dt("handle",this._scene);return t&&(e._positionOffset=t),e},t.prototype._updateMaterial=function(){for(var t=this._state,e=0,i=this._materials;e<i.length;e++)(s=i[e]).hover=!1,s.drag=!1;if(t&Ft.DRAG)for(var o=0,n=this._materials;o<n.length;o++)(s=n[o]).drag=!0;else if(t&Ft.HOVER)for(var r=0,a=this._materials;r<a.length;r++){var s;(s=a[r]).hover=!0}},t.prototype.setDragBehavior=function(t,e,i){var o=new h.BaseSixDofDragBehavior;this._dragBehavior=o,this._dragStartObserver=o.onDragStartObservable.add(t),this._draggingObserver=o.onDragObservable.add(e),this._dragEndObserver=o.onDragEndObservable.add(i),this._dragBehavior.attach(this.node)},t.prototype.dispose=function(){this._dragBehavior.onDragStartObservable.remove(this._dragStartObserver),this._dragBehavior.onDragObservable.remove(this._draggingObserver),this._dragBehavior.onDragEndObservable.remove(this._dragEndObserver),this._dragBehavior.detach();for(var t=0,e=this._materials;t<e.length;t++)e[t].dispose();this.node.dispose()},t}(),kt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.createNode=function(){var t=(0,h.CreateBox)("sideVert",{width:1,height:10,depth:.1},this._scene),e=new h.TransformNode("side",this._scene);t.parent=e;var i=this._createMaterial();return t.material=i,t.isNearGrabbable=!0,this._materials.push(i),e},e}(Lt),Nt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.createNode=function(){var t=(0,h.CreateBox)("angleHor",{width:3,height:1,depth:.1},this._scene),e=(0,h.CreateBox)("angleVert",{width:1,height:3,depth:.1},this._scene),i=new h.TransformNode("angle",this._scene);return t.parent=i,e.parent=i,t.material=this._createMaterial(new h.Vector3(1,0,0)),e.material=this._createMaterial(new h.Vector3(0,1,0)),e.isNearGrabbable=!0,t.isNearGrabbable=!0,this._materials.push(t.material),this._materials.push(e.material),i},e}(Lt),At=function(t){function e(e){var i=t.call(this,e)||this;return i._boundingDimensions=new h.Vector3(0,0,0),i._renderObserver=null,i._tmpQuaternion=new h.Quaternion,i._tmpVector=new h.Vector3(0,0,0),i._corners=[],i._sides=[],i._boundingBoxGizmo={min:new h.Vector3,max:new h.Vector3},i._margin=.35,i._handleSize=.075,i._attachedSlate=null,i._existingSlateScale=new h.Vector3,i.fixedScreenSize=!1,i.fixedScreenSizeDistanceFactor=10,i._createNode(),i.updateScale=!1,i._renderObserver=i.gizmoLayer.originalScene.onBeforeRenderObservable.add((function(){i.attachedMesh&&!i._existingSlateScale.equals(i.attachedMesh.scaling)&&i.updateBoundingBox()})),i}return r(e,t),Object.defineProperty(e.prototype,"attachedSlate",{get:function(){return this._attachedSlate},set:function(t){var e=this;t?(this.attachedMesh=t.mesh,this.updateBoundingBox(),this._pickedPointObserver=t._host.onPickingObservable.add((function(t){if(!e._handleHovered||t&&t.parent===e._handleHovered.node||(e._handleHovered.hover=!1,e._handleHovered=null),t&&t.parent&&t.parent.reservedDataStore&&t.parent.reservedDataStore.handle){var i=t.parent.reservedDataStore.handle;i.gizmo===e&&(e._handleHovered=i,e._handleHovered.hover=!0)}}))):this._attachedSlate&&this._attachedSlate._host.onPickingObservable.remove(this._pickedPointObserver),this._attachedSlate=t},enumerable:!1,configurable:!0}),e.prototype._createNode=function(){var t=this;this._handlesParent=new h.TransformNode("handlesParent",this.gizmoLayer.utilityLayerScene),this._handlesParent.rotationQuaternion=h.Quaternion.Identity();for(var e=[{dimensions:new h.Vector3(-1,-1,0),origin:new h.Vector3(1,0,0)},{dimensions:new h.Vector3(1,-1,0),origin:new h.Vector3(0,0,0)},{dimensions:new h.Vector3(1,1,0),origin:new h.Vector3(0,1,0)},{dimensions:new h.Vector3(-1,1,0),origin:new h.Vector3(1,1,0)}],i=0;i<4;i++){var o=new Nt(this,this.gizmoLayer.utilityLayerScene);this._corners.push(o),o.node.rotation.z=Math.PI/2*i,o.node.parent=this._handlesParent,this._assignDragBehaviorCorners(o,(function(e,i,o,n){return t._moveHandle(e,i,o,n,!0)}),e[i])}for(i=0;i<4;i++){var n=new kt(this,this.gizmoLayer.utilityLayerScene);this._sides.push(n),n.node.rotation.z=Math.PI/2*i,n.node.parent=this._handlesParent,this._assignDragBehaviorSides(n,i%2==0?new h.Vector3(0,1,0):new h.Vector3(1,0,0))}this._handlesParent.parent=this._rootMesh},e.prototype._keepAspectRatio=function(t,e,i){void 0===i&&(i=!1);var o=h.TmpVectors.Vector3[0];o.copyFromFloats(e,1,0).normalize(),i&&(o.y*=-1);var n=h.Vector3.Dot(t,o);t.copyFrom(o).scaleInPlace(n)},e.prototype._clampDimensions=function(t,e,i,o){void 0===o&&(o=!1);var n=h.TmpVectors.Vector3[0];n.copyFrom(t).multiplyInPlace(i);var r=h.TmpVectors.Vector3[1];if(r.copyFromFloats(Math.max(this._attachedSlate.minDimensions.x,n.x+e.x),Math.max(this._attachedSlate.minDimensions.y,n.y+e.y),0),o){var a=e.x/e.y;r.x=Math.max(r.x,r.y*a),r.y=Math.max(r.y,r.x/a)}n.copyFrom(r).subtractInPlace(e),t.x=Math.sign(t.x)*Math.abs(n.x),t.y=Math.sign(t.y)*Math.abs(n.y)},e.prototype._moveHandle=function(t,e,i,o,n){if(this._attachedSlate){if(n){var r=e.x/e.y;this._keepAspectRatio(i,r,o.dimensions.x*o.dimensions.y<0)}this._clampDimensions(i,e,o.dimensions,n);var a=h.TmpVectors.Vector3[0],s=h.TmpVectors.Vector3[1];a.copyFrom(i).multiplyInPlace(o.origin),s.copyFrom(i).multiplyInPlace(o.dimensions),this._attachedSlate.origin.copyFrom(t).addInPlace(a),this._attachedSlate.dimensions.set(e.x+s.x,e.y+s.y)}},e.prototype._assignDragBehaviorCorners=function(t,e,i){var o=this,n=new h.Vector3,r=new h.Vector3,a=new h.Vector3,s=new h.Matrix,l=new h.Vector3;t.setDragBehavior((function(t){o.attachedSlate&&o.attachedMesh&&(n.set(o.attachedSlate.dimensions.x,o.attachedSlate.dimensions.y,h.Epsilon),r.copyFrom(o.attachedSlate.origin),a.copyFrom(t.position),s.copyFrom(o.attachedMesh.computeWorldMatrix(!0)),s.invert(),o.attachedSlate._followButton.isToggled=!1,h.Vector3.TransformNormalToRef(h.Vector3.Forward(),o.attachedMesh.getWorldMatrix(),l),l.normalize(),o._handleHovered&&(o._handleDragged=o._handleHovered,o._handleDragged.drag=!0))}),(function(t){o.attachedSlate&&o.attachedMesh&&(function(t,e,i,o){t.subtractToRef(i,h.TmpVectors.Vector3[0]);var n=h.Vector3.Dot(h.TmpVectors.Vector3[0],e);h.TmpVectors.Vector3[1].copyFrom(e).scaleInPlace(n),h.TmpVectors.Vector3[0].subtractInPlace(h.TmpVectors.Vector3[1]),h.TmpVectors.Vector3[0].addToRef(i,o)}(t.position,l,a,o._tmpVector),o._tmpVector.subtractInPlace(a),h.Vector3.TransformNormalToRef(o._tmpVector,s,o._tmpVector),e(r,n,o._tmpVector,i),o.attachedSlate._positionElements(),o.updateBoundingBox())}),(function(){o.attachedSlate&&o.attachedNode&&(o.attachedSlate._updatePivot(),o._handleDragged&&(o._handleDragged.drag=!1,o._handleDragged=null))}))},e.prototype._assignDragBehaviorSides=function(t,e){var i=this,o=new h.Quaternion,n=new h.Vector3,r=new h.Vector3,a=new h.Vector3,s=new h.Vector3;t.setDragBehavior((function(t){i.attachedSlate&&i.attachedMesh&&(o.copyFrom(i.attachedMesh.rotationQuaternion),n.copyFrom(t.position),a.copyFrom(i.attachedMesh.getAbsolutePivotPoint()),r.copyFrom(n).subtractInPlace(a).normalize(),i.attachedSlate._followButton.isToggled=!1,h.Vector3.TransformNormalToRef(e,i.attachedMesh.getWorldMatrix(),s),s.normalize(),i._handleHovered&&(i._handleDragged=i._handleHovered,i._handleDragged.drag=!0))}),(function(t){if(i.attachedSlate&&i.attachedMesh){i._tmpVector.copyFrom(t.position),i._tmpVector.subtractInPlace(a),i._tmpVector.normalize();var n=-h.Vector3.GetAngleBetweenVectorsOnPlane(i._tmpVector,r,s);h.Quaternion.RotationAxisToRef(e,n,i._tmpQuaternion),o.multiplyToRef(i._tmpQuaternion,i.attachedMesh.rotationQuaternion)}}),(function(){i.attachedSlate&&i.attachedNode&&(i.attachedSlate._updatePivot(),i._handleDragged&&(i._handleDragged.drag=!1,i._handleDragged=null))}))},e.prototype._attachedNodeChanged=function(t){t&&this.updateBoundingBox()},e.prototype.updateBoundingBox=function(){if(this.attachedMesh){h.PivotTools._RemoveAndStorePivotPoint(this.attachedMesh);var t=this.attachedMesh.parent;this.attachedMesh.setParent(null),this._update(),this.attachedMesh.rotationQuaternion||(this.attachedMesh.rotationQuaternion=h.Quaternion.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);var e=this.attachedMesh.getHierarchyBoundingVectors();e.max.subtractToRef(e.min,this._boundingDimensions),this._boundingBoxGizmo.min=e.min,this._boundingBoxGizmo.max=e.max,this._updateHandlesPosition(),this._updateHandlesScaling(),this.attachedMesh.rotationQuaternion.copyFrom(this._tmpQuaternion),this.attachedMesh.position.copyFrom(this._tmpVector),h.PivotTools._RestorePivotPoint(this.attachedMesh),this.attachedMesh.setParent(t),this.attachedMesh.computeWorldMatrix(!0),this._existingSlateScale.copyFrom(this.attachedMesh.scaling)}},e.prototype._updateHandlesPosition=function(){var t=this._boundingBoxGizmo.min.clone(),e=this._boundingBoxGizmo.max.clone(),i=this._corners[0].node.scaling.length();t.x-=this._margin*i,t.y-=this._margin*i,e.x+=this._margin*i,e.y+=this._margin*i;var o=t.add(e).scaleInPlace(.5);this._corners[0].node.position.copyFromFloats(t.x,t.y,0),this._corners[1].node.position.copyFromFloats(e.x,t.y,0),this._corners[2].node.position.copyFromFloats(e.x,e.y,0),this._corners[3].node.position.copyFromFloats(t.x,e.y,0),this._sides[0].node.position.copyFromFloats(t.x,o.y,0),this._sides[1].node.position.copyFromFloats(o.x,t.y,0),this._sides[2].node.position.copyFromFloats(e.x,o.y,0),this._sides[3].node.position.copyFromFloats(o.x,e.y,0)},e.prototype._updateHandlesScaling=function(){if(this._attachedSlate&&this._attachedSlate.mesh){for(var t=this._attachedSlate.mesh.scaling.x*this._attachedSlate.dimensions.x,e=this._attachedSlate.mesh.scaling.y*this._attachedSlate.dimensions.y,i=Math.min(t,e)*this._handleSize,o=0;o<this._corners.length;o++)this._corners[o].node.scaling.setAll(i);for(o=0;o<this._sides.length;o++)this._sides[o].node.scaling.setAll(i)}},e.prototype._update=function(){if(t.prototype._update.call(this),this.gizmoLayer.utilityLayerScene.activeCamera&&this._attachedSlate&&this._attachedSlate.mesh){if(this.fixedScreenSize){this._attachedSlate.mesh.absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position,this._tmpVector);for(var e=this._handleSize*this._tmpVector.length()/this.fixedScreenSizeDistanceFactor,i=0;i<this._corners.length;i++)this._corners[i].node.scaling.set(e,e,e);for(i=0;i<this._sides.length;i++)this._sides[i].node.scaling.set(e,e,e)}this._updateHandlesPosition()}},e.prototype.dispose=function(){this.gizmoLayer.originalScene.onBeforeRenderObservable.remove(this._renderObserver),t.prototype.dispose.call(this);for(var e=0,i=this._corners;e<i.length;e++)i[e].dispose();for(var o=0,n=this._sides;o<n.length;o++)n[o].dispose()},e}(h.Gizmo),zt=function(t){function e(e){var i=t.call(this,e)||this;return i.titleBarMargin=.005,i.origin=new h.Vector3(0,0,0),i._dimensions=new h.Vector2(21.875,12.5),i._titleBarHeight=.625,i._titleText="",i._contentScaleRatio=1,i.minDimensions=new h.Vector2(15.625,6.25),i.defaultDimensions=i._dimensions.clone(),i._followButton=new Mt("followButton"+i.name),i._followButton.isToggleButton=!0,i._closeButton=new Mt("closeButton"+i.name),i._contentViewport=new h.Viewport(0,0,1,1),i._contentDragBehavior=new h.PointerDragBehavior({dragPlaneNormal:new h.Vector3(0,0,-1)}),i}return r(e,t),Object.defineProperty(e.prototype,"defaultBehavior",{get:function(){return this._defaultBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dimensions",{get:function(){return this._dimensions},set:function(t){var e=1;if(t.x<this.minDimensions.x||t.y<this.minDimensions.y){var i=t.x/t.y;e=this.minDimensions.x/this.minDimensions.y>i?this.minDimensions.x/t.x:this.minDimensions.y/t.y}this._dimensions.copyFrom(t).scaleInPlace(e),this._updatePivot(),this._positionElements()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"titleBarHeight",{get:function(){return this._titleBarHeight},set:function(t){this._titleBarHeight=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderingGroupId",{get:function(){return this._titleBar.renderingGroupId},set:function(t){this._titleBar.renderingGroupId=t,this._titleBarTitle.renderingGroupId=t,this._contentPlate.renderingGroupId=t,this._backPlate.renderingGroupId=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"title",{get:function(){return this._titleText},set:function(t){this._titleText=t,this._titleTextComponent&&(this._titleTextComponent.text=t)},enumerable:!1,configurable:!0}),e.prototype._applyFacade=function(t){this._contentMaterial.albedoTexture=t,this._resetContentPositionAndZoom(),this._applyContentViewport(),t.attachToMesh(this._contentPlate,!0)},e.prototype._addControl=function(t){t._host=this._host,this._host.utilityLayer&&t._prepareNode(this._host.utilityLayer.utilityLayerScene)},e.prototype._getTypeName=function(){return"HolographicSlate"},e.prototype._positionElements=function(){var t=this._followButton,i=this._closeButton,o=this._titleBar,n=this._titleBarTitle,r=this._contentPlate,a=this._backPlate;if(t&&i&&o){i.scaling.setAll(this.titleBarHeight),t.scaling.setAll(this.titleBarHeight),i.position.copyFromFloats(this.dimensions.x-this.titleBarHeight/2,-this.titleBarHeight/2,0).addInPlace(this.origin),t.position.copyFromFloats(this.dimensions.x-3*this.titleBarHeight/2,-this.titleBarHeight/2,0).addInPlace(this.origin);var s=this.dimensions.y-this.titleBarHeight-this.titleBarMargin,l=r.getScene().useRightHandedSystem;o.scaling.set(this.dimensions.x,this.titleBarHeight,h.Epsilon),n.scaling.set(this.dimensions.x-2*this.titleBarHeight,this.titleBarHeight,h.Epsilon),r.scaling.copyFromFloats(this.dimensions.x,s,h.Epsilon),a.scaling.copyFromFloats(this.dimensions.x,s,h.Epsilon),o.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,l?h.Epsilon:-h.Epsilon).addInPlace(this.origin),r.position.copyFromFloats(this.dimensions.x/2,-(this.titleBarHeight+this.titleBarMargin+s/2),0).addInPlace(this.origin),a.position.copyFromFloats(this.dimensions.x/2,-(this.titleBarHeight+this.titleBarMargin+s/2),l?-h.Epsilon:h.Epsilon).addInPlace(this.origin),this._titleTextComponent.host.scaleTo(e._DEFAULT_TEXT_RESOLUTION_Y*n.scaling.x/n.scaling.y,e._DEFAULT_TEXT_RESOLUTION_Y);var _=this.dimensions.x/s;this._contentViewport.width=this._contentScaleRatio,this._contentViewport.height=this._contentScaleRatio/_,this._applyContentViewport(),this._gizmo&&this._gizmo.updateBoundingBox()}},e.prototype._applyContentViewport=function(){var t;if((null===(t=this._contentPlate)||void 0===t?void 0:t.material)&&this._contentPlate.material.albedoTexture){var 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}},e.prototype._resetContentPositionAndZoom=function(){this._contentViewport.x=0,this._contentViewport.y=1-this._contentViewport.height/this._contentViewport.width,this._contentScaleRatio=1},e.prototype._updatePivot=function(){if(this.mesh){var t=new h.Vector3(.5*this.dimensions.x,.5*-this.dimensions.y,h.Epsilon);t.addInPlace(this.origin),t.z=0;var e=new h.Vector3(0,0,0);h.Vector3.TransformCoordinatesToRef(e,this.mesh.computeWorldMatrix(!0),e),this.mesh.setPivotPoint(t);var i=new h.Vector3(0,0,0);h.Vector3.TransformCoordinatesToRef(i,this.mesh.computeWorldMatrix(!0),i),this.mesh.position.addInPlace(e).subtractInPlace(i)}},e.prototype._createNode=function(t){var i=this,o=new h.Mesh("slate_"+this.name,t);this._titleBar=(0,h.CreateBox)("titleBar_"+this.name,{size:1},t),this._titleBarTitle=(0,h.CreatePlane)("titleText_"+this.name,{size:1},t),this._titleBarTitle.parent=o,this._titleBarTitle.isPickable=!1;var n=lt.CreateForMesh(this._titleBarTitle);if(this._titleTextComponent=new B("titleText_"+this.name,this._titleText),this._titleTextComponent.textWrapping=P.Ellipsis,this._titleTextComponent.textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,this._titleTextComponent.color="white",this._titleTextComponent.fontSize=e._DEFAULT_TEXT_RESOLUTION_Y/2,this._titleTextComponent.paddingLeft=e._DEFAULT_TEXT_RESOLUTION_Y/4,n.addControl(this._titleTextComponent),t.useRightHandedSystem){var r=new h.Vector4(0,0,1,1);this._contentPlate=(0,h.CreatePlane)("contentPlate_"+this.name,{size:1,sideOrientation:h.VertexData.BACKSIDE,frontUVs:r},t),this._backPlate=(0,h.CreatePlane)("backPlate_"+this.name,{size:1,sideOrientation:h.VertexData.FRONTSIDE},t)}else r=new h.Vector4(0,0,1,1),this._contentPlate=(0,h.CreatePlane)("contentPlate_"+this.name,{size:1,sideOrientation:h.VertexData.FRONTSIDE,frontUVs:r},t),this._backPlate=(0,h.CreatePlane)("backPlate_"+this.name,{size:1,sideOrientation:h.VertexData.BACKSIDE},t);this._titleBar.parent=o,this._titleBar.isNearGrabbable=!0,this._contentPlate.parent=o,this._backPlate.parent=o,this._attachContentPlateBehavior(),this._addControl(this._followButton),this._addControl(this._closeButton);var a=this._followButton,s=this._closeButton;return a.node.parent=o,s.node.parent=o,this._positionElements(),this._followButton.imageUrl=e.ASSETS_BASE_URL+e.FOLLOW_ICON_FILENAME,this._closeButton.imageUrl=e.ASSETS_BASE_URL+e.CLOSE_ICON_FILENAME,this._followButton.isBackplateVisible=!1,this._closeButton.isBackplateVisible=!1,this._followButton.onToggleObservable.add((function(t){i._defaultBehavior.followBehaviorEnabled=t,i._defaultBehavior.followBehaviorEnabled&&i._defaultBehavior.followBehavior.recenter()})),this._closeButton.onPointerClickObservable.add((function(){i.dispose()})),o.rotationQuaternion=h.Quaternion.Identity(),o.isVisible=!1,o},e.prototype._attachContentPlateBehavior=function(){var t=this;this._contentDragBehavior.attach(this._contentPlate),this._contentDragBehavior.moveAttached=!1,this._contentDragBehavior.useObjectOrientationForDragging=!0,this._contentDragBehavior.updateDragPlane=!1;var e,i,o=new h.Vector3,n=new h.Vector3,r=new h.Vector3,a=new h.Vector3,s=new h.Vector2;this._contentDragBehavior.onDragStartObservable.add((function(s){t.node&&(e=t._contentViewport.clone(),i=t.node.computeWorldMatrix(!0),o.copyFrom(s.dragPlanePoint),n.set(t.dimensions.x,t.dimensions.y,h.Epsilon),n.y-=t.titleBarHeight+t.titleBarMargin,h.Vector3.TransformNormalToRef(n,i,n),r.copyFromFloats(0,1,0),h.Vector3.TransformNormalToRef(r,i,r),a.copyFromFloats(1,0,0),h.Vector3.TransformNormalToRef(a,i,a),r.normalize(),r.scaleInPlace(1/h.Vector3.Dot(r,n)),a.normalize(),a.scaleInPlace(1/h.Vector3.Dot(a,n)))}));var l=new h.Vector3;this._contentDragBehavior.onDragObservable.add((function(i){l.copyFrom(i.dragPlanePoint),l.subtractInPlace(o),s.copyFromFloats(h.Vector3.Dot(l,a),h.Vector3.Dot(l,r)),t._contentViewport.x=h.Scalar.Clamp(e.x-l.x,0,1-t._contentViewport.width*t._contentScaleRatio),t._contentViewport.y=h.Scalar.Clamp(e.y-l.y,0,1-t._contentViewport.height*t._contentScaleRatio),t._applyContentViewport()}))},e.prototype._affectMaterial=function(t){this._titleBarMaterial=new Ct("".concat(this.name," plateMaterial"),t.getScene()),this._contentMaterial=new xt("".concat(this.name," contentMaterial"),t.getScene()),this._contentMaterial.renderBorders=!0,this._backMaterial=new Ct("".concat(this.name," backPlate"),t.getScene()),this._backMaterial.lineWidth=h.Epsilon,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()},e.prototype._prepareNode=function(e){var i=this;t.prototype._prepareNode.call(this,e),this._gizmo=new At(this._host.utilityLayer),this._gizmo.attachedSlate=this,this._defaultBehavior=new Et,this._defaultBehavior.attach(this.node,[this._titleBar]),this._defaultBehavior.sixDofDragBehavior.onDragStartObservable.add((function(){i._followButton.isToggled=!1})),this._positionChangedObserver=this._defaultBehavior.sixDofDragBehavior.onPositionChangedObservable.add((function(){i._gizmo.updateBoundingBox()})),this._updatePivot(),this.resetDefaultAspectAndPose(!1)},e.prototype.resetDefaultAspectAndPose=function(t){if(void 0===t&&(t=!0),this._host&&this._host.utilityLayer&&this.node){var e=this._host.utilityLayer.utilityLayerScene,i=e.activeCamera;if(i){var o=i.getWorldMatrix(),n=h.Vector3.TransformNormal(h.Vector3.Backward(e.useRightHandedSystem),o);this.origin.setAll(0),this._gizmo.updateBoundingBox();var r=this.node.getAbsolutePivotPoint();this.node.position.copyFrom(i.position).subtractInPlace(n).subtractInPlace(r),this.node.rotationQuaternion=h.Quaternion.FromLookDirectionLH(n,new h.Vector3(0,1,0)),t&&(this.dimensions=this.defaultDimensions)}}},e.prototype.dispose=function(){t.prototype.dispose.call(this),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()},e.ASSETS_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",e.CLOSE_ICON_FILENAME="IconClose.png",e.FOLLOW_ICON_FILENAME="IconFollowMe.png",e._DEFAULT_TEXT_RESOLUTION_Y=102.4,e}(ft),Qt=function(t){function e(e,i){var o=t.call(this,i)||this;return o._currentMesh=e,o.pointerEnterAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(1.1)},o.pointerOutAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(1/1.1)},o.pointerDownAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(.95)},o.pointerUpAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(1/.95)},o}return r(e,t),e.prototype._getTypeName=function(){return"MeshButton3D"},e.prototype._createNode=function(t){var e=this;return this._currentMesh.getChildMeshes().forEach((function(t){e._injectGUI3DReservedDataStore(t).control=e})),this._currentMesh},e.prototype._affectMaterial=function(t){},e}(gt),Vt=function(t){function e(e){var i=t.call(this,e)||this;return i._isPinned=!1,i._defaultBehavior=new Et,i._dragObserver=i._defaultBehavior.sixDofDragBehavior.onDragObservable.add((function(){i.isPinned=!0})),i.backPlateMargin=1,i}return r(e,t),Object.defineProperty(e.prototype,"defaultBehavior",{get:function(){return this._defaultBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isPinned",{get:function(){return this._isPinned},set:function(t){this._pinButton.isToggled===t?(this._isPinned=t,this._defaultBehavior.followBehaviorEnabled=!t):this._pinButton.isToggled=t},enumerable:!1,configurable:!0}),e.prototype._createPinButton=function(t){var i=this,o=new Mt("pin"+this.name,!1);return o.imageUrl=e._ASSETS_BASE_URL+e._PIN_ICON_FILENAME,o.parent=this,o._host=this._host,o.isToggleButton=!0,o.onToggleObservable.add((function(t){i.isPinned=t})),this._host.utilityLayer&&(o._prepareNode(this._host.utilityLayer.utilityLayerScene),o.scaling.scaleInPlace(Pt.MENU_BUTTON_SCALE),o.node&&(o.node.parent=t)),o},e.prototype._createNode=function(e){var i=t.prototype._createNode.call(this,e);return this._pinButton=this._createPinButton(i),this.isPinned=!1,this._defaultBehavior.attach(i,[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,i.isVisible=!1,i},e.prototype._finalProcessing=function(){t.prototype._finalProcessing.call(this),this._pinButton.position.copyFromFloats((this._backPlate.scaling.x+Pt.MENU_BUTTON_SCALE)/2,this._backPlate.scaling.y/2,0)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._defaultBehavior.sixDofDragBehavior.onDragObservable.remove(this._dragObserver),this._defaultBehavior.detach()},e._ASSETS_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",e._PIN_ICON_FILENAME="IconPin.png",e}(Pt),Wt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype._mapGridNode=function(t,e){var i=t.mesh;if(i){t.position=e.clone();var o=h.TmpVectors.Vector3[0];switch(o.copyFrom(e),this.orientation){case bt.FACEORIGIN_ORIENTATION:case bt.FACEFORWARD_ORIENTATION:o.addInPlace(new h.Vector3(0,0,1)),i.lookAt(o);break;case bt.FACEFORWARDREVERSED_ORIENTATION:case bt.FACEORIGINREVERSED_ORIENTATION:o.addInPlace(new h.Vector3(0,0,-1)),i.lookAt(o)}}},e}(mt),Ht=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._iteration=100,e}return r(e,t),Object.defineProperty(e.prototype,"iteration",{get:function(){return this._iteration},set:function(t){var e=this;this._iteration!==t&&(this._iteration=t,h.Tools.SetImmediate((function(){e._arrangeChildren()})))},enumerable:!1,configurable:!0}),e.prototype._mapGridNode=function(t,e){var i=t.mesh,o=this._scatterMapping(e);if(i){switch(this.orientation){case bt.FACEORIGIN_ORIENTATION:case bt.FACEFORWARD_ORIENTATION:i.lookAt(new h.Vector3(0,0,1));break;case bt.FACEFORWARDREVERSED_ORIENTATION:case bt.FACEORIGINREVERSED_ORIENTATION:i.lookAt(new h.Vector3(0,0,-1))}t.position=o}},e.prototype._scatterMapping=function(t){return t.x=(1-2*Math.random())*this._cellWidth,t.y=(1-2*Math.random())*this._cellHeight,t},e.prototype._finalProcessing=function(){for(var t=[],e=0,i=this._children;e<i.length;e++){var o=i[e];o.mesh&&t.push(o.mesh)}for(var n=0;n<this._iteration;n++){t.sort((function(t,e){var i=t.position.lengthSquared(),o=e.position.lengthSquared();return i<o?1:i>o?-1:0}));for(var r=Math.pow(this.margin,2),a=Math.max(this._cellWidth,this._cellHeight),s=h.TmpVectors.Vector2[0],l=h.TmpVectors.Vector3[0],_=0;_<t.length-1;_++)for(var c=_+1;c<t.length;c++)if(_!=c){t[c].position.subtractToRef(t[_].position,l),s.x=l.x,s.y=l.y;var u=a,d=s.lengthSquared()-r;(d-=Math.min(d,r))<Math.pow(u,2)&&(s.normalize(),l.scaleInPlace(.5*(u-Math.sqrt(d))),t[c].position.addInPlace(l),t[_].position.subtractInPlace(l))}}},e}(mt);h.ShaderStore.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=k1<k2 ? vec3(k1,Blob_Info1.z,Blob_Info1.w) : vec3(k2,Blob_Info2.z,Blob_Info2.w);\nBlob_Color=closer.z*texture(Blob_Texture,vec2(vec2(sqrt(closer.x),closer.y).x,1.0-vec2(sqrt(closer.x),closer.y).y))*clamp(1.0-closer.x,0.0,1.0);\n}\nvoid FastLinearTosRGB_B42(\nvec4 Linear,\nout vec4 sRGB)\n{\nsRGB.rgb=sqrt(clamp(Linear.rgb,0.0,1.0));\nsRGB.a=Linear.a;\n}\nvoid Scale_RGB_B59(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{\nResult=vec4(Scalar,Scalar,Scalar,1)*Color;\n}\nvoid Fragment_Main_B121(\nfloat Sun_Intensity,\nfloat Sun_Theta,\nfloat Sun_Phi,\nvec3 Normal,\nvec4 Albedo,\nfloat Fresnel_Reflect,\nfloat Shininess,\nvec3 Incident,\nvec4 Horizon_Color,\nvec4 Sky_Color,\nvec4 Ground_Color,\nfloat Indirect_Diffuse,\nfloat Specular,\nfloat Horizon_Power,\nfloat Reflection,\nvec4 Reflection_Sample,\nvec4 Indirect_Sample,\nfloat Sharpness,\nfloat SSS,\nfloat Subsurface,\nvec4 Translucence,\nvec4 Rim_Light,\nvec4 Iridescence,\nout vec4 Result)\n{\nfloat theta=Sun_Theta*2.0*3.14159;\nfloat phi=Sun_Phi*3.14159;\nvec3 lightDir= vec3(cos(phi)*cos(theta),sin(phi),cos(phi)*sin(theta));\nfloat NdotL=max(dot(lightDir,Normal),0.0);\nvec3 R=reflect(Incident,Normal);\nfloat RdotL=max(0.0,dot(R,lightDir));\nfloat specular=pow(RdotL,Shininess);\nspecular=mix(specular,smoothstep(0.495*Sharpness,1.0-0.495*Sharpness,specular),Sharpness);\nvec4 gi=mix(Ground_Color,Sky_Color,Normal.y*0.5+0.5);\nResult=((Sun_Intensity*NdotL+Indirect_Sample*Indirect_Diffuse+Translucence)*(1.0+SSS*Subsurface))*Albedo*(1.0-Fresnel_Reflect)+(Sun_Intensity*specular*Specular+Fresnel_Reflect*Reflection*Reflection_Sample)+Fresnel_Reflect*Rim_Light+Iridescence;\n}\nvoid Bulge_B79(\nbool Enabled,\nvec3 Normal,\nvec3 Tangent,\nfloat Bulge_Height,\nvec4 UV,\nfloat Bulge_Radius,\nvec3 ButtonN,\nout vec3 New_Normal)\n{\nvec2 xy=clamp(UV.xy*2.0,vec2(-1,-1),vec2(1,1));\nvec3 B=(cross(Normal,Tangent));\nfloat k=-clamp(1.0-length(xy)/Bulge_Radius,0.0,1.0)*Bulge_Height;\nk=sin(k*3.14159*0.5);\nk*=smoothstep(0.9998,0.9999,abs(dot(ButtonN,Normal)));\nNew_Normal=Normal*sqrt(1.0-k*k)+(xy.x*Tangent+xy.y*B)*k;\nNew_Normal=Enabled ? New_Normal : Normal;\n}\nvoid SSS_B77(\nvec3 ButtonN,\nvec3 Normal,\nvec3 Incident,\nout float Result)\n{\nfloat NdotI=abs(dot(Normal,Incident));\nfloat BdotI=abs(dot(ButtonN,Incident));\nResult=(abs(NdotI-BdotI)); \n}\nvoid FingerOcclusion_B67(\nfloat Width,\nfloat DistToCenter,\nfloat Fuzz,\nfloat Min_Fuzz,\nvec3 Position,\nvec3 Forward,\nvec3 Nearest,\nfloat Fade_Out,\nout float NotInShadow)\n{\nfloat d=dot((Nearest-Position),Forward);\nfloat sh=smoothstep(Width*0.5,Width*0.5+Fuzz*max(d,0.0)+Min_Fuzz,DistToCenter);\nNotInShadow=1.0-(1.0-sh)*smoothstep(-Fade_Out,0.0,d);\n}\nvoid FingerOcclusion_B68(\nfloat Width,\nfloat DistToCenter,\nfloat Fuzz,\nfloat Min_Fuzz,\nvec3 Position,\nvec3 Forward,\nvec3 Nearest,\nfloat Fade_Out,\nout float NotInShadow)\n{\nfloat d=dot((Nearest-Position),Forward);\nfloat sh=smoothstep(Width*0.5,Width*0.5+Fuzz*max(d,0.0)+Min_Fuzz,DistToCenter);\nNotInShadow=1.0-(1.0-sh)*smoothstep(-Fade_Out,0.0,d);\n}\nvoid Scale_Color_B91(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{\nResult=Scalar*Color;\n}\nvoid From_HSV_B73(\nfloat Hue,\nfloat Saturation,\nfloat Value,\nfloat Alpha,\nout vec4 Color)\n{\nvec4 K=vec4(1.0,2.0/3.0,1.0/3.0,3.0);\nvec3 p=abs(fract(vec3(Hue,Hue,Hue)+K.xyz)*6.0-K.www);\nColor.rgb=Value*mix(K.xxx,clamp(p-K.xxx,0.0,1.0),Saturation);\nColor.a=Alpha;\n}\nvoid Fast_Fresnel_B122(\nfloat Front_Reflect,\nfloat Edge_Reflect,\nfloat Power,\nvec3 Normal,\nvec3 Incident,\nout float Transmit,\nout float Reflect)\n{\nfloat d=max(-dot(Incident,Normal),0.0);\nReflect=Front_Reflect+(Edge_Reflect-Front_Reflect)*pow(.01-d,Power);\nTransmit=1.0-Reflect;\n}\nvoid Mapped_Environment_B51(\nsampler2D Reflected_Environment,\nsampler2D Indirect_Environment,\nvec3 Dir,\nout vec4 Reflected_Color,\nout vec4 Indirect_Diffuse)\n{\nReflected_Color=texture(Reflected_Environment,vec2(atan(Dir.z,Dir.x)/3.14159*0.5,asin(Dir.y)/3.14159+0.5));\nIndirect_Diffuse=texture(Indirect_Environment,vec2(atan(Dir.z,Dir.x)/3.14159*0.5,asin(Dir.y)/3.14159+0.5));\n}\nvec4 SampleEnv_Bid50(vec3 D,vec4 S,vec4 H,vec4 G,float exponent)\n{\nfloat k=pow(abs(D.y),exponent);\nvec4 C;\nif (D.y>0.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.g<Color.b ? vec4(Color.bg,K.wz) : vec4(Color.gb,K.xy);\nvec4 q=Color.r<p.x ? vec4(p.xyw,Color.r) : vec4(Color.r,p.yzx);\nfloat d=q.x-min(q.w,q.y);\nfloat e=1.0e-10;\nHue=abs(q.z+(q.w-q.y)/(6.0*d+e));\nSaturation=d/(q.x+e);\nValue=q.x;\nAlpha=Color.a;\nHSV=vec3(Hue,Saturation,Value);\n}\nvoid Code_B110(\nfloat X,\nout float Result)\n{\nResult=(acos(X)/3.14159-0.5)*2.0;\n}\nvoid Rim_Light_B132(\nvec3 Front,\nvec3 Normal,\nvec3 Incident,\nfloat Rim_Intensity,\nsampler2D Texture,\nout vec4 Result)\n{\nvec3 R=reflect(Incident,Normal);\nfloat RdotF=dot(R,Front);\nfloat RdotL=sqrt(1.0-RdotF*RdotF);\nvec2 UV=vec2(R.y*0.5+0.5,0.5);\nvec4 Color=texture(Texture,UV);\nResult=Color;\n}\nvoid main()\n{\nvec4 Blob_Color_Q30;\n#if BLOB_ENABLE\nBlob_Fragment_B30(_Blob_Texture_,vExtra2,vExtra3,Blob_Color_Q30);\n#else\nBlob_Color_Q30=vec4(0,0,0,0);\n#endif\nvec3 Incident_Q39=normalize(vPosition-cameraPosition);\nvec3 Normalized_Q38=normalize(vNormal);\nvec3 Normalized_Q71=normalize(vTangent);\nvec4 Color_Q83;\n#if DECAL_ENABLE\nColor_Q83=texture(_Decal_,vUV);\n#else\nColor_Q83=vec4(0,0,0,0);\n#endif\nfloat X_Q90;\nfloat Y_Q90;\nfloat Z_Q90;\nfloat W_Q90;\nX_Q90=vExtra1.x;\nY_Q90=vExtra1.y;\nZ_Q90=vExtra1.z;\nW_Q90=vExtra1.w;\nvec4 Linear_Q43;\nLinear_Q43.rgb=clamp(_Sky_Color_.rgb*_Sky_Color_.rgb,0.0,1.0);\nLinear_Q43.a=_Sky_Color_.a;\nvec4 Linear_Q44;\nLinear_Q44.rgb=clamp(_Horizon_Color_.rgb*_Horizon_Color_.rgb,0.0,1.0);\nLinear_Q44.a=_Horizon_Color_.a;\nvec4 Linear_Q45;\nLinear_Q45.rgb=clamp(_Ground_Color_.rgb*_Ground_Color_.rgb,0.0,1.0);\nLinear_Q45.a=_Ground_Color_.a;\nvec3 Left_Index_Q64;\nvec3 Right_Index_Q64;\nvec3 Left_Index_Middle_Q64;\nvec3 Right_Index_Middle_Q64;\nFinger_Positions_B64(_Left_Index_Pos_,_Right_Index_Pos_,_Left_Index_Middle_Pos_,_Right_Index_Middle_Pos_,Left_Index_Q64,Right_Index_Q64,Left_Index_Middle_Q64,Right_Index_Middle_Q64);\nvec4 Linear_Q46;\nLinear_Q46.rgb=clamp(_Albedo_.rgb*_Albedo_.rgb,0.0,1.0);\nLinear_Q46.a=_Albedo_.a;\nvec3 Normalized_Q107=normalize(vBinormal);\nvec3 Incident_Q70=normalize(vPosition-cameraPosition);\nvec3 New_Normal_Q79;\nBulge_B79(_Bulge_Enabled_,Normalized_Q38,Normalized_Q71,_Bulge_Height_,vColor,_Bulge_Radius_,vBinormal,New_Normal_Q79);\nfloat Result_Q77;\nSSS_B77(vBinormal,New_Normal_Q79,Incident_Q39,Result_Q77);\nvec4 Result_Q91;\nScale_Color_B91(Color_Q83,X_Q90,Result_Q91);\nfloat Transmit_Q122;\nfloat Reflect_Q122;\nFast_Fresnel_B122(_Front_Reflect_,_Edge_Reflect_,_Power_,New_Normal_Q79,Incident_Q39,Transmit_Q122,Reflect_Q122);\nfloat Product_Q125=Y_Q90*Y_Q90;\nvec3 NearP_Q65;\nvec3 NearQ_Q65;\nfloat Distance_Q65;\nMin_Segment_Distance_B65(Left_Index_Q64,Left_Index_Middle_Q64,vPosition,cameraPosition,NearP_Q65,NearQ_Q65,Distance_Q65);\nvec3 NearP_Q63;\nvec3 NearQ_Q63;\nfloat Distance_Q63;\nMin_Segment_Distance_B65(Right_Index_Q64,Right_Index_Middle_Q64,vPosition,cameraPosition,NearP_Q63,NearQ_Q63,Distance_Q63);\nvec3 Reflected_Q47=reflect(Incident_Q39,New_Normal_Q79);\nvec4 Product_Q103=Linear_Q46*vec4(1,1,1,1);\nvec4 Result_Q132;\nRim_Light_B132(Normalized_Q107,Normalized_Q38,Incident_Q70,_Rim_Intensity_,_Rim_Texture_,Result_Q132);\nfloat Dot_Q72=dot(Incident_Q70, Normalized_Q71);\nfloat MaxAB_Q123=max(Reflect_Q122,Product_Q125);\nfloat NotInShadow_Q67;\n#if OCCLUSION_ENABLED\nFingerOcclusion_B67(_Width_,Distance_Q65,_Fuzz_,_Min_Fuzz_,vPosition,vBinormal,NearP_Q65,_Clip_Fade_,NotInShadow_Q67);\n#else\nNotInShadow_Q67=1.0;\n#endif\nfloat NotInShadow_Q68;\n#if OCCLUSION_ENABLED\nFingerOcclusion_B68(_Width_,Distance_Q63,_Fuzz_,_Min_Fuzz_,vPosition,vBinormal,NearP_Q63,_Clip_Fade_,NotInShadow_Q68);\n#else\nNotInShadow_Q68=1.0;\n#endif\nvec4 Reflected_Color_Q51;\nvec4 Indirect_Diffuse_Q51;\n#if ENV_ENABLE\nMapped_Environment_B51(_Reflection_Map_,_Indirect_Environment_,Reflected_Q47,Reflected_Color_Q51,Indirect_Diffuse_Q51);\n#else\nReflected_Color_Q51=vec4(0,0,0,1);\nIndirect_Diffuse_Q51=vec4(0,0,0,1);\n#endif\nvec4 Reflected_Color_Q50;\nvec4 Indirect_Color_Q50;\n#if SKY_ENABLED\nSky_Environment_B50(New_Normal_Q79,Reflected_Q47,Linear_Q43,Linear_Q44,Linear_Q45,_Horizon_Power_,Reflected_Color_Q50,Indirect_Color_Q50);\n#else\nReflected_Color_Q50=vec4(0,0,0,1);\nIndirect_Color_Q50=vec4(0,0,0,1);\n#endif\nfloat Hue_Q75;\nfloat Saturation_Q75;\nfloat Value_Q75;\nfloat Alpha_Q75;\nvec3 HSV_Q75;\nTo_HSV_B75(Product_Q103,Hue_Q75,Saturation_Q75,Value_Q75,Alpha_Q75,HSV_Q75);\nfloat Hue_Q127;\nfloat Saturation_Q127;\nfloat Value_Q127;\nfloat Alpha_Q127;\nvec3 HSV_Q127;\nTo_HSV_B75(Result_Q132,Hue_Q127,Saturation_Q127,Value_Q127,Alpha_Q127,HSV_Q127);\nfloat Result_Q110;\nCode_B110(Dot_Q72,Result_Q110);\nfloat AbsA_Q76=abs(Result_Q110);\nfloat MinAB_Q58=min(NotInShadow_Q67,NotInShadow_Q68);\nvec4 Sum_Q48=Reflected_Color_Q51+Reflected_Color_Q50;\nvec4 Sum_Q49=Indirect_Diffuse_Q51+Indirect_Color_Q50;\nvec3 HSV_Out_Q126;\nVaryHSV_B108(HSV_Q127,_Rim_Hue_Shift_,_Rim_Saturation_Shift_,_Rim_Value_Shift_,HSV_Out_Q126);\nfloat Out_Q114;\nRemap_Range_B114(-1.0,1.0,0.0,1.0,Result_Q110,Out_Q114);\nfloat Product_Q106;\nProduct_Q106=AbsA_Q76*_Hue_Shift_;\nfloat X_Q128;\nfloat Y_Q128;\nfloat Z_Q128;\nTo_XYZ_B74(HSV_Out_Q126,X_Q128,Y_Q128,Z_Q128);\nvec2 Vec2_Q112=vec2(Out_Q114,0.5);\nvec3 HSV_Out_Q108;\nVaryHSV_B108(HSV_Q75,Product_Q106,_Saturation_Shift_,_Value_Shift_,HSV_Out_Q108);\nvec4 Color_Q129;\nFrom_HSV_B73(X_Q128,Y_Q128,Z_Q128,0.0,Color_Q129);\nvec4 Color_Q111;\n#if IRIDESCENCE_ENABLED\nColor_Q111=texture(_Iridescence_Texture_,Vec2_Q112);\n#else\nColor_Q111=vec4(0,0,0,0);\n#endif\nfloat X_Q74;\nfloat Y_Q74;\nfloat Z_Q74;\nTo_XYZ_B74(HSV_Out_Q108,X_Q74,Y_Q74,Z_Q74);\nvec4 Result_Q131=_Rim_Intensity_*Color_Q129;\nvec4 Result_Q113=_Iridescence_Intensity_*Color_Q111;\nvec4 Color_Q73;\nFrom_HSV_B73(X_Q74,Y_Q74,Z_Q74,0.0,Color_Q73);\nvec4 Result_Q84=Result_Q91+(1.0-Result_Q91.a)*Color_Q73;\nvec4 Result_Q121;\nFragment_Main_B121(_Sun_Intensity_,_Sun_Theta_,_Sun_Phi_,New_Normal_Q79,Result_Q84,MaxAB_Q123,_Shininess_,Incident_Q39,_Horizon_Color_,_Sky_Color_,_Ground_Color_,_Indirect_Diffuse_,_Specular_,_Horizon_Power_,_Reflection_,Sum_Q48,Sum_Q49,_Sharpness_,Result_Q77,_Subsurface_,vec4(0,0,0,0),Result_Q131,Result_Q113,Result_Q121);\nvec4 Result_Q59;\nScale_RGB_B59(Result_Q121,MinAB_Q58,Result_Q59);\nvec4 sRGB_Q42;\nFastLinearTosRGB_B42(Result_Q59,sRGB_Q42);\nvec4 Result_Q31=Blob_Color_Q30+(1.0-Blob_Color_Q30.a)*sRGB_Q42;\nvec4 Result_Q40=Result_Q31; Result_Q40.a=1.0;\nvec4 Out_Color=Result_Q40;\nfloat Clip_Threshold=0.001;\nbool To_sRGB=false;\ngl_FragColor=Out_Color;\n}";h.ShaderStore.ShadersStore.mrdlSliderBarVertexShader="uniform mat4 world;\nuniform mat4 viewProjection;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n#ifdef TANGENT\nattribute vec3 tangent;\n#else\nconst vec3 tangent=vec3(0.);\n#endif\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 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;\nvarying vec4 vExtra2;\nvarying vec4 vExtra3;\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 Object_To_World_Normal_B32(\nvec3 Nrm_Object,\nout vec3 Nrm_World)\n{\nNrm_World=(vec4(Nrm_Object,0.0)).xyz;\n}\nvoid Blob_Vertex_B23(\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,\nfloat Blob_Fade_Length,\nfloat Blob_Pulse,\nfloat Blob_Fade,\nout vec4 Blob_Info)\n{\nvec3 blob= (Use_Global_Left_Index ? Global_Left_Index_Tip_Position.xyz : Blob_Position);\nvec3 delta=blob-Position;\nfloat dist=dot(Normal,delta);\nfloat lerpValue=clamp((abs(dist)-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);\nfloat fadeValue=1.0-clamp((abs(dist)-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);\nfloat size=Blob_Near_Size+(Blob_Far_Size-Blob_Near_Size)*lerpValue;\nvec2 blobXY=vec2(dot(delta,Tangent),dot(delta,Bitangent))/(0.0001+size);\nfloat Fade=fadeValue*Intensity*Blob_Fade;\nfloat Distance=(lerpValue*0.5+0.5)*(1.0-Blob_Pulse);\nBlob_Info=vec4(blobXY.x,blobXY.y,Distance,Fade);\n}\nvoid Blob_Vertex_B24(\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,\nfloat Blob_Fade_Length,\nfloat Blob_Pulse,\nfloat Blob_Fade,\nout vec4 Blob_Info)\n{\nvec3 blob= (Use_Global_Right_Index ? Global_Right_Index_Tip_Position.xyz : Blob_Position);\nvec3 delta=blob-Position;\nfloat dist=dot(Normal,delta);\nfloat lerpValue=clamp((abs(dist)-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);\nfloat fadeValue=1.0-clamp((abs(dist)-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);\nfloat size=Blob_Near_Size+(Blob_Far_Size-Blob_Near_Size)*lerpValue;\nvec2 blobXY=vec2(dot(delta,Tangent),dot(delta,Bitangent))/(0.0001+size);\nfloat Fade=fadeValue*Intensity*Blob_Fade;\nfloat Distance=(lerpValue*0.5+0.5)*(1.0-Blob_Pulse);\nBlob_Info=vec4(blobXY.x,blobXY.y,Distance,Fade);\n}\nvoid Move_Verts_B130(\nfloat Anisotropy,\nvec3 P,\nfloat Radius,\nfloat Bevel,\nvec3 Normal_Object,\nfloat ScaleZ,\nfloat Stretch,\nout vec3 New_P,\nout vec2 New_UV,\nout float Radial_Gradient,\nout vec3 Radial_Dir,\nout vec3 New_Normal)\n{\nvec2 UV=P.xy*2.0+0.5;\nvec2 center=clamp(UV,0.0,1.0);\nvec2 delta=UV-center;\nfloat deltad=(length(delta)*2.0);\nfloat f=(Bevel+(Radius-Bevel)*Stretch)/Radius;\nfloat innerd=clamp(deltad*2.0,0.0,1.0);\nfloat outerd=clamp(deltad*2.0-1.0,0.0,1.0);\nfloat bevelAngle=outerd*3.14159*0.5;\nfloat sinb=sin(bevelAngle);\nfloat cosb=cos(bevelAngle);\nfloat beveld=(1.0-f)*innerd+f*sinb;\nfloat br=outerd;\nvec2 r2=2.0*vec2(Radius/Anisotropy,Radius);\nfloat dir=P.z<0.0001 ? 1.0 : -1.0;\nNew_UV=center+r2*((0.5-center)+normalize(delta+vec2(0.0,0.000001))*beveld*0.5);\nNew_P=vec3(New_UV-0.5,P.z+dir*(1.0-cosb)*Bevel*ScaleZ);\nRadial_Gradient=clamp((deltad-0.5)*2.0,0.0,1.0);\nRadial_Dir=vec3(delta*r2,0.0);\nvec3 beveledNormal=cosb*Normal_Object+sinb*vec3(delta.x,delta.y,0.0);\nNew_Normal=Normal_Object.z==0.0 ? Normal_Object : beveledNormal;\n}\nvoid Object_To_World_Dir_B60(\nvec3 Dir_Object,\nout vec3 Normal_World,\nout vec3 Normal_World_N,\nout float Normal_Length)\n{\nNormal_World=(world*vec4(Dir_Object,0.0)).xyz;\nNormal_Length=length(Normal_World);\nNormal_World_N=Normal_World/Normal_Length;\n}\nvoid To_XYZ_B78(\nvec3 Vec3,\nout float X,\nout float Y,\nout float Z)\n{\nX=Vec3.x;\nY=Vec3.y;\nZ=Vec3.z;\n}\nvoid Conditional_Float_B93(\nbool Which,\nfloat If_True,\nfloat If_False,\nout float Result)\n{\nResult=Which ? If_True : If_False;\n}\nvoid Object_To_World_Dir_B28(\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 Pick_Radius_B69(\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 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}";var Gt=function(t){function e(){var e=t.call(this)||this;return e.SKY_ENABLED=!0,e.BLOB_ENABLE_2=!0,e.IRIDESCENCE_ENABLED=!0,e._needNormals=!0,e._needUVs=!0,e.rebuild(),e}return r(e,t),e}(h.MaterialDefines),Ut=function(t){function e(i,o){var n=t.call(this,i,o)||this;return n.radius=.6,n.bevelFront=.6,n.bevelFrontStretch=.077,n.bevelBack=0,n.bevelBackStretch=0,n.radiusTopLeft=1,n.radiusTopRight=1,n.radiusBottomLeft=1,n.radiusBottomRight=1,n.bulgeEnabled=!1,n.bulgeHeight=-.323,n.bulgeRadius=.73,n.sunIntensity=1.102,n.sunTheta=.76,n.sunPhi=.526,n.indirectDiffuse=.658,n.albedo=new h.Color4(.0117647,.505882,.996078,1),n.specular=0,n.shininess=10,n.sharpness=0,n.subsurface=0,n.leftGradientColor=new h.Color4(.0117647,.505882,.996078,1),n.rightGradientColor=new h.Color4(.0117647,.505882,.996078,1),n.reflection=.749,n.frontReflect=0,n.edgeReflect=.09,n.power=8.13,n.skyColor=new h.Color4(.0117647,.964706,.996078,1),n.horizonColor=new h.Color4(.0117647,.333333,.996078,1),n.groundColor=new h.Color4(0,.254902,.996078,1),n.horizonPower=1,n.width=.02,n.fuzz=.5,n.minFuzz=.001,n.clipFade=.01,n.hueShift=0,n.saturationShift=0,n.valueShift=0,n.blobPosition=new h.Vector3(0,0,.1),n.blobIntensity=.5,n.blobNearSize=.01,n.blobFarSize=.03,n.blobNearDistance=0,n.blobFarDistance=.08,n.blobFadeLength=.576,n.blobPulse=0,n.blobFade=1,n.blobPosition2=new h.Vector3(.2,0,.1),n.blobNearSize2=.01,n.blobPulse2=0,n.blobFade2=1,n.blobTexture=new h.Texture("",n.getScene()),n.leftIndexPosition=new h.Vector3(0,0,1),n.rightIndexPosition=new h.Vector3(-1,-1,-1),n.leftIndexMiddlePosition=new h.Vector3(0,0,0),n.rightIndexMiddlePosition=new h.Vector3(0,0,0),n.decalScaleXY=new h.Vector2(1.5,1.5),n.decalFrontOnly=!0,n.rimIntensity=.287,n.rimHueShift=0,n.rimSaturationShift=0,n.rimValueShift=-1,n.iridescenceIntensity=0,n.useGlobalLeftIndex=1,n.useGlobalRightIndex=1,n.globalLeftIndexTipProximity=0,n.globalRightIndexTipProximity=0,n.globalLeftIndexTipPosition=new h.Vector4(.5,0,-.55,1),n.globaRightIndexTipPosition=new h.Vector4(0,0,0,1),n.globalLeftThumbTipPosition=new h.Vector4(.5,0,-.55,1),n.globalRightThumbTipPosition=new h.Vector4(0,0,0,1),n.globalLeftIndexMiddlePosition=new h.Vector4(.5,0,-.55,1),n.globalRightIndexMiddlePosition=new h.Vector4(0,0,0,1),n.alphaMode=h.Constants.ALPHA_DISABLE,n.backFaceCulling=!1,n._blueGradientTexture=new h.Texture(e.BLUE_GRADIENT_TEXTURE_URL,n.getScene(),!0,!1,h.Texture.NEAREST_SAMPLINGMODE),n._decalTexture=new h.Texture("",n.getScene()),n._reflectionMapTexture=new h.Texture("",n.getScene()),n._indirectEnvTexture=new h.Texture("",n.getScene()),n}return r(e,t),e.prototype.needAlphaBlending=function(){return!1},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){if(this.isFrozen&&e.effect&&e.effect._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new Gt);var i=e.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(e))return!0;var n=o.getEngine();if(h.MaterialHelper.PrepareDefinesForAttributes(t,i,!1,!1),i.isDirty){i.markAsProcessed(),o.resetCachedMaterial();var r=new h.EffectFallbacks;i.FOG&&r.addFallback(1,"FOG"),h.MaterialHelper.HandleFallbacksForShadows(i,r),i.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;var a=[h.VertexBuffer.PositionKind];i.NORMAL&&a.push(h.VertexBuffer.NormalKind),i.UV1&&a.push(h.VertexBuffer.UVKind),i.UV2&&a.push(h.VertexBuffer.UV2Kind),i.VERTEXCOLOR&&a.push(h.VertexBuffer.ColorKind),i.TANGENT&&a.push(h.VertexBuffer.TangentKind),h.MaterialHelper.PrepareAttributesForInstances(a,i);var s=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"],_=["_Rim_Texture_","_Iridescence_Texture_"],c=new Array;h.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:l,uniformBuffersNames:c,samplers:_,defines:i,maxSimultaneousLights:4}),e.setEffect(o.getEngine().createEffect("mrdlSliderBar",{attributes:a,uniformsNames:l,uniformBuffersNames:c,samplers:_,defines:s,fallbacks:r,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),i,this._materialContext)}return!(!e.effect||!e.effect.isReady()||(i._renderId=o.getRenderId(),e.effect._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){if(i.materialDefines){var o=i.effect;o&&(this._activeEffect=o,this.bindOnlyWorldMatrix(t),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_",this._reflectionMapTexture),this._activeEffect.setTexture("_Indirect_Environment_",this._indirectEnvTexture),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_",this._decalTexture),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(e,this._activeEffect))}},e.prototype.getAnimatables=function(){return[]},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e),this._reflectionMapTexture.dispose(),this._indirectEnvTexture.dispose(),this._blueGradientTexture.dispose(),this._decalTexture.dispose()},e.prototype.clone=function(t){var i=this;return h.SerializationHelper.Clone((function(){return new e(t,i.getScene())}),this)},e.prototype.serialize=function(){var e=t.prototype.serialize.call(this);return e.customType="BABYLON.MRDLSliderBarMaterial",e},e.prototype.getClassName=function(){return"MRDLSliderBarMaterial"},e.Parse=function(t,i,o){return h.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},e.BLUE_GRADIENT_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/MRDL/mrtk-mrdl-blue-gradient.png",s([(0,h.serialize)()],e.prototype,"radius",void 0),s([(0,h.serialize)()],e.prototype,"bevelFront",void 0),s([(0,h.serialize)()],e.prototype,"bevelFrontStretch",void 0),s([(0,h.serialize)()],e.prototype,"bevelBack",void 0),s([(0,h.serialize)()],e.prototype,"bevelBackStretch",void 0),s([(0,h.serialize)()],e.prototype,"radiusTopLeft",void 0),s([(0,h.serialize)()],e.prototype,"radiusTopRight",void 0),s([(0,h.serialize)()],e.prototype,"radiusBottomLeft",void 0),s([(0,h.serialize)()],e.prototype,"radiusBottomRight",void 0),s([(0,h.serialize)()],e.prototype,"bulgeEnabled",void 0),s([(0,h.serialize)()],e.prototype,"bulgeHeight",void 0),s([(0,h.serialize)()],e.prototype,"bulgeRadius",void 0),s([(0,h.serialize)()],e.prototype,"sunIntensity",void 0),s([(0,h.serialize)()],e.prototype,"sunTheta",void 0),s([(0,h.serialize)()],e.prototype,"sunPhi",void 0),s([(0,h.serialize)()],e.prototype,"indirectDiffuse",void 0),s([(0,h.serialize)()],e.prototype,"albedo",void 0),s([(0,h.serialize)()],e.prototype,"specular",void 0),s([(0,h.serialize)()],e.prototype,"shininess",void 0),s([(0,h.serialize)()],e.prototype,"sharpness",void 0),s([(0,h.serialize)()],e.prototype,"subsurface",void 0),s([(0,h.serialize)()],e.prototype,"leftGradientColor",void 0),s([(0,h.serialize)()],e.prototype,"rightGradientColor",void 0),s([(0,h.serialize)()],e.prototype,"reflection",void 0),s([(0,h.serialize)()],e.prototype,"frontReflect",void 0),s([(0,h.serialize)()],e.prototype,"edgeReflect",void 0),s([(0,h.serialize)()],e.prototype,"power",void 0),s([(0,h.serialize)()],e.prototype,"skyColor",void 0),s([(0,h.serialize)()],e.prototype,"horizonColor",void 0),s([(0,h.serialize)()],e.prototype,"groundColor",void 0),s([(0,h.serialize)()],e.prototype,"horizonPower",void 0),s([(0,h.serialize)()],e.prototype,"width",void 0),s([(0,h.serialize)()],e.prototype,"fuzz",void 0),s([(0,h.serialize)()],e.prototype,"minFuzz",void 0),s([(0,h.serialize)()],e.prototype,"clipFade",void 0),s([(0,h.serialize)()],e.prototype,"hueShift",void 0),s([(0,h.serialize)()],e.prototype,"saturationShift",void 0),s([(0,h.serialize)()],e.prototype,"valueShift",void 0),s([(0,h.serialize)()],e.prototype,"blobPosition",void 0),s([(0,h.serialize)()],e.prototype,"blobIntensity",void 0),s([(0,h.serialize)()],e.prototype,"blobNearSize",void 0),s([(0,h.serialize)()],e.prototype,"blobFarSize",void 0),s([(0,h.serialize)()],e.prototype,"blobNearDistance",void 0),s([(0,h.serialize)()],e.prototype,"blobFarDistance",void 0),s([(0,h.serialize)()],e.prototype,"blobFadeLength",void 0),s([(0,h.serialize)()],e.prototype,"blobPulse",void 0),s([(0,h.serialize)()],e.prototype,"blobFade",void 0),s([(0,h.serialize)()],e.prototype,"blobPosition2",void 0),s([(0,h.serialize)()],e.prototype,"blobNearSize2",void 0),s([(0,h.serialize)()],e.prototype,"blobPulse2",void 0),s([(0,h.serialize)()],e.prototype,"blobFade2",void 0),s([(0,h.serialize)()],e.prototype,"blobTexture",void 0),s([(0,h.serialize)()],e.prototype,"leftIndexPosition",void 0),s([(0,h.serialize)()],e.prototype,"rightIndexPosition",void 0),s([(0,h.serialize)()],e.prototype,"leftIndexMiddlePosition",void 0),s([(0,h.serialize)()],e.prototype,"rightIndexMiddlePosition",void 0),s([(0,h.serialize)()],e.prototype,"decalScaleXY",void 0),s([(0,h.serialize)()],e.prototype,"decalFrontOnly",void 0),s([(0,h.serialize)()],e.prototype,"rimIntensity",void 0),s([(0,h.serialize)()],e.prototype,"rimHueShift",void 0),s([(0,h.serialize)()],e.prototype,"rimSaturationShift",void 0),s([(0,h.serialize)()],e.prototype,"rimValueShift",void 0),s([(0,h.serialize)()],e.prototype,"iridescenceIntensity",void 0),e}(h.PushMaterial);(0,h.RegisterClass)("BABYLON.GUI.MRDLSliderBarMaterial",Ut);h.ShaderStore.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=k1<k2 ? vec3(k1,Blob_Info1.z,Blob_Info1.w) : vec3(k2,Blob_Info2.z,Blob_Info2.w);\nBlob_Color=closer.z*texture(Blob_Texture,vec2(vec2(sqrt(closer.x),closer.y).x,1.0-vec2(sqrt(closer.x),closer.y).y))*clamp(1.0-closer.x,0.0,1.0);\n}\nvoid FastLinearTosRGB_B192(\nvec4 Linear,\nout vec4 sRGB)\n{\nsRGB.rgb=sqrt(clamp(Linear.rgb,0.0,1.0));\nsRGB.a=Linear.a;\n}\nvoid Scale_RGB_B209(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{\nResult=vec4(Scalar,Scalar,Scalar,1)*Color;\n}\nvoid Fragment_Main_B271(\nfloat Sun_Intensity,\nfloat Sun_Theta,\nfloat Sun_Phi,\nvec3 Normal,\nvec4 Albedo,\nfloat Fresnel_Reflect,\nfloat Shininess,\nvec3 Incident,\nvec4 Horizon_Color,\nvec4 Sky_Color,\nvec4 Ground_Color,\nfloat Indirect_Diffuse,\nfloat Specular,\nfloat Horizon_Power,\nfloat Reflection,\nvec4 Reflection_Sample,\nvec4 Indirect_Sample,\nfloat Sharpness,\nfloat SSS,\nfloat Subsurface,\nvec4 Translucence,\nvec4 Rim_Light,\nvec4 Iridescence,\nout vec4 Result)\n{\nfloat theta=Sun_Theta*2.0*3.14159;\nfloat phi=Sun_Phi*3.14159;\nvec3 lightDir= vec3(cos(phi)*cos(theta),sin(phi),cos(phi)*sin(theta));\nfloat NdotL=max(dot(lightDir,Normal),0.0);\nvec3 R=reflect(Incident,Normal);\nfloat RdotL=max(0.0,dot(R,lightDir));\nfloat specular=pow(RdotL,Shininess);\nspecular=mix(specular,smoothstep(0.495*Sharpness,1.0-0.495*Sharpness,specular),Sharpness);\nvec4 gi=mix(Ground_Color,Sky_Color,Normal.y*0.5+0.5);\nResult=((Sun_Intensity*NdotL+Indirect_Sample*Indirect_Diffuse+Translucence)*(1.0+SSS*Subsurface))*Albedo*(1.0-Fresnel_Reflect)+(Sun_Intensity*specular*Specular+Fresnel_Reflect*Reflection*Reflection_Sample)+Fresnel_Reflect*Rim_Light+Iridescence;\n}\nvoid Bulge_B229(\nbool Enabled,\nvec3 Normal,\nvec3 Tangent,\nfloat Bulge_Height,\nvec4 UV,\nfloat Bulge_Radius,\nvec3 ButtonN,\nout vec3 New_Normal)\n{\nvec2 xy=clamp(UV.xy*2.0,vec2(-1,-1),vec2(1,1));\nvec3 B=(cross(Normal,Tangent));\nfloat k=-clamp(1.0-length(xy)/Bulge_Radius,0.0,1.0)*Bulge_Height;\nk=sin(k*3.14159*0.5);\nk*=smoothstep(0.9998,0.9999,abs(dot(ButtonN,Normal)));\nNew_Normal=Normal*sqrt(1.0-k*k)+(xy.x*Tangent+xy.y*B)*k;\nNew_Normal=Enabled ? New_Normal : Normal;\n}\nvoid SSS_B227(\nvec3 ButtonN,\nvec3 Normal,\nvec3 Incident,\nout float Result)\n{\nfloat NdotI=abs(dot(Normal,Incident));\nfloat BdotI=abs(dot(ButtonN,Incident));\nResult=(abs(NdotI-BdotI)); \n}\nvoid FingerOcclusion_B217(\nfloat Width,\nfloat DistToCenter,\nfloat Fuzz,\nfloat Min_Fuzz,\nvec3 Position,\nvec3 Forward,\nvec3 Nearest,\nfloat Fade_Out,\nout float NotInShadow)\n{\nfloat d=dot((Nearest-Position),Forward);\nfloat sh=smoothstep(Width*0.5,Width*0.5+Fuzz*max(d,0.0)+Min_Fuzz,DistToCenter);\nNotInShadow=1.0-(1.0-sh)*smoothstep(-Fade_Out,0.0,d);\n}\nvoid FingerOcclusion_B218(\nfloat Width,\nfloat DistToCenter,\nfloat Fuzz,\nfloat Min_Fuzz,\nvec3 Position,\nvec3 Forward,\nvec3 Nearest,\nfloat Fade_Out,\nout float NotInShadow)\n{\nfloat d=dot((Nearest-Position),Forward);\nfloat sh=smoothstep(Width*0.5,Width*0.5+Fuzz*max(d,0.0)+Min_Fuzz,DistToCenter);\nNotInShadow=1.0-(1.0-sh)*smoothstep(-Fade_Out,0.0,d);\n}\nvoid Scale_Color_B241(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{\nResult=Scalar*Color;\n}\nvoid From_HSV_B223(\nfloat Hue,\nfloat Saturation,\nfloat Value,\nfloat Alpha,\nout vec4 Color)\n{\nvec4 K=vec4(1.0,2.0/3.0,1.0/3.0,3.0);\nvec3 p=abs(fract(vec3(Hue,Hue,Hue)+K.xyz)*6.0-K.www);\nColor.rgb=Value*mix(K.xxx,clamp(p-K.xxx,0.0,1.0),Saturation);\nColor.a=Alpha;\n}\nvoid Fast_Fresnel_B272(\nfloat Front_Reflect,\nfloat Edge_Reflect,\nfloat Power,\nvec3 Normal,\nvec3 Incident,\nout float Transmit,\nout float Reflect)\n{\nfloat d=max(-dot(Incident,Normal),0.0);\nReflect=Front_Reflect+(Edge_Reflect-Front_Reflect)*pow(1.0-d,Power);\nTransmit=1.0-Reflect;\n}\nvoid Mapped_Environment_B201(\nsampler2D Reflected_Environment,\nsampler2D Indirect_Environment,\nvec3 Dir,\nout vec4 Reflected_Color,\nout vec4 Indirect_Diffuse)\n{\nReflected_Color=texture(Reflected_Environment,vec2(atan(Dir.z,Dir.x)/3.14159*0.5,asin(Dir.y)/3.14159+0.5));\nIndirect_Diffuse=texture(Indirect_Environment,vec2(atan(Dir.z,Dir.x)/3.14159*0.5,asin(Dir.y)/3.14159+0.5));\n}\nvec4 SampleEnv_Bid200(vec3 D,vec4 S,vec4 H,vec4 G,float exponent)\n{\nfloat k=pow(abs(D.y),exponent);\nvec4 C;\nif (D.y>0.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.g<Color.b ? vec4(Color.bg,K.wz) : vec4(Color.gb,K.xy);\nvec4 q=Color.r<p.x ? vec4(p.xyw,Color.r) : vec4(Color.r,p.yzx);\nfloat d=q.x-min(q.w,q.y);\nfloat e=1.0e-10;\nHue=abs(q.z+(q.w-q.y)/(6.0*d+e));\nSaturation=d/(q.x+e);\nValue=q.x;\nAlpha=Color.a;\nHSV=vec3(Hue,Saturation,Value);\n}\nvoid Code_B260(\nfloat X,\nout float Result)\n{\nResult=(acos(X)/3.14159-0.5)*2.0;\n}\nvoid Rim_Light_B282(\nvec3 Front,\nvec3 Normal,\nvec3 Incident,\nfloat Rim_Intensity,\nsampler2D Texture,\nout vec4 Result)\n{\nvec3 R=reflect(Incident,Normal);\nfloat RdotF=dot(R,Front);\nfloat RdotL=sqrt(1.0-RdotF*RdotF);\nvec2 UV=vec2(R.y*0.5+0.5,0.5);\nvec4 Color=texture(Texture,UV);\nResult=Color;\n}\nvoid main()\n{\nvec4 Blob_Color_Q180;\n#if BLOB_ENABLE\nBlob_Fragment_B180(_Blob_Texture_,vExtra2,vExtra3,Blob_Color_Q180);\n#else\nBlob_Color_Q180=vec4(0,0,0,0);\n#endif\nvec3 Incident_Q189=normalize(vPosition-cameraPosition);\nvec3 Normalized_Q188=normalize(vNormal);\nvec3 Normalized_Q221=normalize(vTangent);\nvec4 Color_Q233;\n#if DECAL_ENABLE\nColor_Q233=texture(_Decal_,vUV);\n#else\nColor_Q233=vec4(0,0,0,0);\n#endif\nfloat X_Q240;\nfloat Y_Q240;\nfloat Z_Q240;\nfloat W_Q240;\nX_Q240=vExtra1.x;\nY_Q240=vExtra1.y;\nZ_Q240=vExtra1.z;\nW_Q240=vExtra1.w;\nvec4 Linear_Q193;\nLinear_Q193.rgb=clamp(_Sky_Color_.rgb*_Sky_Color_.rgb,0.0,1.0);\nLinear_Q193.a=_Sky_Color_.a;\nvec4 Linear_Q194;\nLinear_Q194.rgb=clamp(_Horizon_Color_.rgb*_Horizon_Color_.rgb,0.0,1.0);\nLinear_Q194.a=_Horizon_Color_.a;\nvec4 Linear_Q195;\nLinear_Q195.rgb=clamp(_Ground_Color_.rgb*_Ground_Color_.rgb,0.0,1.0);\nLinear_Q195.a=_Ground_Color_.a;\nvec3 Left_Index_Q214;\nvec3 Right_Index_Q214;\nvec3 Left_Index_Middle_Q214;\nvec3 Right_Index_Middle_Q214;\nFinger_Positions_B214(_Left_Index_Pos_,_Right_Index_Pos_,_Left_Index_Middle_Pos_,_Right_Index_Middle_Pos_,Left_Index_Q214,Right_Index_Q214,Left_Index_Middle_Q214,Right_Index_Middle_Q214);\nvec4 Linear_Q196;\nLinear_Q196.rgb=clamp(_Albedo_.rgb*_Albedo_.rgb,0.0,1.0);\nLinear_Q196.a=_Albedo_.a;\nvec3 Normalized_Q257=normalize(vBinormal);\nvec3 Incident_Q220=normalize(vPosition-cameraPosition);\nvec3 New_Normal_Q229;\nBulge_B229(_Bulge_Enabled_,Normalized_Q188,Normalized_Q221,_Bulge_Height_,vColor,_Bulge_Radius_,vBinormal,New_Normal_Q229);\nfloat Result_Q227;\nSSS_B227(vBinormal,New_Normal_Q229,Incident_Q189,Result_Q227);\nvec4 Result_Q241;\nScale_Color_B241(Color_Q233,X_Q240,Result_Q241);\nfloat Transmit_Q272;\nfloat Reflect_Q272;\nFast_Fresnel_B272(_Front_Reflect_,_Edge_Reflect_,_Power_,New_Normal_Q229,Incident_Q189,Transmit_Q272,Reflect_Q272);\nfloat Product_Q275=Y_Q240*Y_Q240;\nvec3 NearP_Q215;\nvec3 NearQ_Q215;\nfloat Distance_Q215;\nMin_Segment_Distance_B215(Left_Index_Q214,Left_Index_Middle_Q214,vPosition,cameraPosition,NearP_Q215,NearQ_Q215,Distance_Q215);\nvec3 NearP_Q213;\nvec3 NearQ_Q213;\nfloat Distance_Q213;\nMin_Segment_Distance_B215(Right_Index_Q214,Right_Index_Middle_Q214,vPosition,cameraPosition,NearP_Q213,NearQ_Q213,Distance_Q213);\nvec3 Reflected_Q197=reflect(Incident_Q189,New_Normal_Q229);\nvec4 Product_Q253=Linear_Q196*vec4(1,1,1,1);\nvec4 Result_Q282;\nRim_Light_B282(Normalized_Q257,Normalized_Q188,Incident_Q220,_Rim_Intensity_,_Rim_Texture_,Result_Q282);\nfloat Dot_Q222=dot(Incident_Q220, Normalized_Q221);\nfloat MaxAB_Q273=max(Reflect_Q272,Product_Q275);\nfloat NotInShadow_Q217;\n#if OCCLUSION_ENABLED\nFingerOcclusion_B217(_Width_,Distance_Q215,_Fuzz_,_Min_Fuzz_,vPosition,vBinormal,NearP_Q215,_Clip_Fade_,NotInShadow_Q217);\n#else\nNotInShadow_Q217=1.0;\n#endif\nfloat NotInShadow_Q218;\n#if OCCLUSION_ENABLED\nFingerOcclusion_B218(_Width_,Distance_Q213,_Fuzz_,_Min_Fuzz_,vPosition,vBinormal,NearP_Q213,_Clip_Fade_,NotInShadow_Q218);\n#else\nNotInShadow_Q218=1.0;\n#endif\nvec4 Reflected_Color_Q201;\nvec4 Indirect_Diffuse_Q201;\n#if ENV_ENABLE\nMapped_Environment_B201(_Reflection_Map_,_Indirect_Environment_,Reflected_Q197,Reflected_Color_Q201,Indirect_Diffuse_Q201);\n#else\nReflected_Color_Q201=vec4(0,0,0,1);\nIndirect_Diffuse_Q201=vec4(0,0,0,1);\n#endif\nvec4 Reflected_Color_Q200;\nvec4 Indirect_Color_Q200;\n#if SKY_ENABLED\nSky_Environment_B200(New_Normal_Q229,Reflected_Q197,Linear_Q193,Linear_Q194,Linear_Q195,_Horizon_Power_,Reflected_Color_Q200,Indirect_Color_Q200);\n#else\nReflected_Color_Q200=vec4(0,0,0,1);\nIndirect_Color_Q200=vec4(0,0,0,1);\n#endif\nfloat Hue_Q225;\nfloat Saturation_Q225;\nfloat Value_Q225;\nfloat Alpha_Q225;\nvec3 HSV_Q225;\nTo_HSV_B225(Product_Q253,Hue_Q225,Saturation_Q225,Value_Q225,Alpha_Q225,HSV_Q225);\nfloat Hue_Q277;\nfloat Saturation_Q277;\nfloat Value_Q277;\nfloat Alpha_Q277;\nvec3 HSV_Q277;\nTo_HSV_B225(Result_Q282,Hue_Q277,Saturation_Q277,Value_Q277,Alpha_Q277,HSV_Q277);\nfloat Result_Q260;\nCode_B260(Dot_Q222,Result_Q260);\nfloat AbsA_Q226=abs(Result_Q260);\nfloat MinAB_Q208=min(NotInShadow_Q217,NotInShadow_Q218);\nvec4 Sum_Q198=Reflected_Color_Q201+Reflected_Color_Q200;\nvec4 Sum_Q199=Indirect_Diffuse_Q201+Indirect_Color_Q200;\nvec3 HSV_Out_Q276;\nVaryHSV_B258(HSV_Q277,_Rim_Hue_Shift_,_Rim_Saturation_Shift_,_Rim_Value_Shift_,HSV_Out_Q276);\nfloat Out_Q264;\nRemap_Range_B264(-1.0,1.0,0.0,1.0,Result_Q260,Out_Q264);\nfloat Product_Q256;\nProduct_Q256=AbsA_Q226*_Hue_Shift_;\nfloat X_Q278;\nfloat Y_Q278;\nfloat Z_Q278;\nTo_XYZ_B224(HSV_Out_Q276,X_Q278,Y_Q278,Z_Q278);\nvec2 Vec2_Q262=vec2(Out_Q264,0.5);\nvec3 HSV_Out_Q258;\nVaryHSV_B258(HSV_Q225,Product_Q256,_Saturation_Shift_,_Value_Shift_,HSV_Out_Q258);\nvec4 Color_Q279;\nFrom_HSV_B223(X_Q278,Y_Q278,Z_Q278,0.0,Color_Q279);\nvec4 Color_Q261;\n#if IRIDESCENCE_ENABLED\nColor_Q261=texture(_Iridescence_Texture_,Vec2_Q262);\n#else\nColor_Q261=vec4(0,0,0,0);\n#endif\nfloat X_Q224;\nfloat Y_Q224;\nfloat Z_Q224;\nTo_XYZ_B224(HSV_Out_Q258,X_Q224,Y_Q224,Z_Q224);\nvec4 Result_Q281=_Rim_Intensity_*Color_Q279;\nvec4 Result_Q263=_Iridescence_Intensity_*Color_Q261;\nvec4 Color_Q223;\nFrom_HSV_B223(X_Q224,Y_Q224,Z_Q224,0.0,Color_Q223);\nvec4 Result_Q234=Result_Q241+(1.0-Result_Q241.a)*Color_Q223;\nvec4 Result_Q271;\nFragment_Main_B271(_Sun_Intensity_,_Sun_Theta_,_Sun_Phi_,New_Normal_Q229,Result_Q234,MaxAB_Q273,_Shininess_,Incident_Q189,_Horizon_Color_,_Sky_Color_,_Ground_Color_,_Indirect_Diffuse_,_Specular_,_Horizon_Power_,_Reflection_,Sum_Q198,Sum_Q199,_Sharpness_,Result_Q227,_Subsurface_,vec4(0,0,0,0),Result_Q281,Result_Q263,Result_Q271);\nvec4 Result_Q209;\nScale_RGB_B209(Result_Q271,MinAB_Q208,Result_Q209);\nvec4 sRGB_Q192;\nFastLinearTosRGB_B192(Result_Q209,sRGB_Q192);\nvec4 Result_Q181=Blob_Color_Q180+(1.0-Blob_Color_Q180.a)*sRGB_Q192;\nvec4 Result_Q190=Result_Q181; Result_Q190.a=1.0;\nvec4 Out_Color=Result_Q190;\nfloat Clip_Threshold=0.001;\nbool To_sRGB=false;\ngl_FragColor=Out_Color;\n}";h.ShaderStore.ShadersStore.mrdlSliderThumbVertexShader="uniform mat4 world;\nuniform mat4 viewProjection;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n#ifdef TANGENT\nattribute vec3 tangent;\n#else\nconst vec3 tangent=vec3(0.);\n#endif\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 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;\nvarying vec4 vExtra2;\nvarying vec4 vExtra3;\nvoid Object_To_World_Pos_B162(\nvec3 Pos_Object,\nout vec3 Pos_World)\n{\nPos_World=(world*vec4(Pos_Object,1.0)).xyz;\n}\nvoid Object_To_World_Normal_B182(\nvec3 Nrm_Object,\nout vec3 Nrm_World)\n{\nNrm_World=(vec4(Nrm_Object,0.0)).xyz;\n}\nvoid Blob_Vertex_B173(\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,\nfloat Blob_Fade_Length,\nfloat Blob_Pulse,\nfloat Blob_Fade,\nout vec4 Blob_Info)\n{\nvec3 blob= (Use_Global_Left_Index ? Global_Left_Index_Tip_Position.xyz : Blob_Position);\nvec3 delta=blob-Position;\nfloat dist=dot(Normal,delta);\nfloat lerpValue=clamp((abs(dist)-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);\nfloat fadeValue=1.0-clamp((abs(dist)-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);\nfloat size=Blob_Near_Size+(Blob_Far_Size-Blob_Near_Size)*lerpValue;\nvec2 blobXY=vec2(dot(delta,Tangent),dot(delta,Bitangent))/(0.0001+size);\nfloat Fade=fadeValue*Intensity*Blob_Fade;\nfloat Distance=(lerpValue*0.5+0.5)*(1.0-Blob_Pulse);\nBlob_Info=vec4(blobXY.x,blobXY.y,Distance,Fade);\n}\nvoid Blob_Vertex_B174(\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,\nfloat Blob_Fade_Length,\nfloat Blob_Pulse,\nfloat Blob_Fade,\nout vec4 Blob_Info)\n{\nvec3 blob= (Use_Global_Right_Index ? Global_Right_Index_Tip_Position.xyz : Blob_Position);\nvec3 delta=blob-Position;\nfloat dist=dot(Normal,delta);\nfloat lerpValue=clamp((abs(dist)-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);\nfloat fadeValue=1.0-clamp((abs(dist)-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);\nfloat size=Blob_Near_Size+(Blob_Far_Size-Blob_Near_Size)*lerpValue;\nvec2 blobXY=vec2(dot(delta,Tangent),dot(delta,Bitangent))/(0.0001+size);\nfloat Fade=fadeValue*Intensity*Blob_Fade;\nfloat Distance=(lerpValue*0.5+0.5)*(1.0-Blob_Pulse);\nBlob_Info=vec4(blobXY.x,blobXY.y,Distance,Fade);\n}\nvoid Move_Verts_B280(\nfloat Anisotropy,\nvec3 P,\nfloat Radius,\nfloat Bevel,\nvec3 Normal_Object,\nfloat ScaleZ,\nfloat Stretch,\nout vec3 New_P,\nout vec2 New_UV,\nout float Radial_Gradient,\nout vec3 Radial_Dir,\nout vec3 New_Normal)\n{\nvec2 UV=P.xy*2.0+0.5;\nvec2 center=clamp(UV,0.0,1.0);\nvec2 delta=UV-center;\nfloat deltad=(length(delta)*2.0);\nfloat f=(Bevel+(Radius-Bevel)*Stretch)/Radius;\nfloat innerd=clamp(deltad*2.0,0.0,1.0);\nfloat outerd=clamp(deltad*2.0-1.0,0.0,1.0);\nfloat bevelAngle=outerd*3.14159*0.5;\nfloat sinb=sin(bevelAngle);\nfloat cosb=cos(bevelAngle);\nfloat beveld=(1.0-f)*innerd+f*sinb;\nfloat br=outerd;\nvec2 r2=2.0*vec2(Radius/Anisotropy,Radius);\nfloat dir=P.z<0.0001 ? 1.0 : -1.0;\nNew_UV=center+r2*((0.5-center)+normalize(delta+vec2(0.0,0.000001))*beveld*0.5);\nNew_P=vec3(New_UV-0.5,P.z+dir*(1.0-cosb)*Bevel*ScaleZ);\nRadial_Gradient=clamp((deltad-0.5)*2.0,0.0,1.0);\nRadial_Dir=vec3(delta*r2,0.0);\nvec3 beveledNormal=cosb*Normal_Object+sinb*vec3(delta.x,delta.y,0.0);\nNew_Normal=Normal_Object.z==0.0 ? Normal_Object : beveledNormal;\n}\nvoid Object_To_World_Dir_B210(\nvec3 Dir_Object,\nout vec3 Normal_World,\nout vec3 Normal_World_N,\nout float Normal_Length)\n{\nNormal_World=(world*vec4(Dir_Object,0.0)).xyz;\nNormal_Length=length(Normal_World);\nNormal_World_N=Normal_World/Normal_Length;\n}\nvoid To_XYZ_B228(\nvec3 Vec3,\nout float X,\nout float Y,\nout float Z)\n{\nX=Vec3.x;\nY=Vec3.y;\nZ=Vec3.z;\n}\nvoid Conditional_Float_B243(\nbool Which,\nfloat If_True,\nfloat If_False,\nout float Result)\n{\nResult=Which ? If_True : If_False;\n}\nvoid Object_To_World_Dir_B178(\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 Pick_Radius_B219(\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 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}";var jt=function(t){function e(){var e=t.call(this)||this;return e.SKY_ENABLED=!0,e.BLOB_ENABLE_2=!0,e.IRIDESCENCE_ENABLED=!0,e._needNormals=!0,e._needUVs=!0,e.rebuild(),e}return r(e,t),e}(h.MaterialDefines),Yt=function(t){function e(i,o){var n=t.call(this,i,o)||this;return n.radius=.157,n.bevelFront=.065,n.bevelFrontStretch=.077,n.bevelBack=.031,n.bevelBackStretch=0,n.radiusTopLeft=1,n.radiusTopRight=1,n.radiusBottomLeft=1,n.radiusBottomRight=1,n.bulgeEnabled=!1,n.bulgeHeight=-.323,n.bulgeRadius=.73,n.sunIntensity=2,n.sunTheta=.937,n.sunPhi=.555,n.indirectDiffuse=1,n.albedo=new h.Color4(.0117647,.505882,.996078,1),n.specular=0,n.shininess=10,n.sharpness=0,n.subsurface=.31,n.leftGradientColor=new h.Color4(.0117647,.505882,.996078,1),n.rightGradientColor=new h.Color4(.0117647,.505882,.996078,1),n.reflection=.749,n.frontReflect=0,n.edgeReflect=.09,n.power=8.1,n.skyColor=new h.Color4(.0117647,.960784,.996078,1),n.horizonColor=new h.Color4(.0117647,.333333,.996078,1),n.groundColor=new h.Color4(0,.254902,.996078,1),n.horizonPower=1,n.width=.02,n.fuzz=.5,n.minFuzz=.001,n.clipFade=.01,n.hueShift=0,n.saturationShift=0,n.valueShift=0,n.blobPosition=new h.Vector3(0,0,.1),n.blobIntensity=.5,n.blobNearSize=.01,n.blobFarSize=.03,n.blobNearDistance=0,n.blobFarDistance=.08,n.blobFadeLength=.576,n.blobPulse=0,n.blobFade=1,n.blobPosition2=new h.Vector3(.2,0,.1),n.blobNearSize2=.01,n.blobPulse2=0,n.blobFade2=1,n.blobTexture=new h.Texture("",n.getScene()),n.leftIndexPosition=new h.Vector3(0,0,1),n.rightIndexPosition=new h.Vector3(-1,-1,-1),n.leftIndexMiddlePosition=new h.Vector3(0,0,0),n.rightIndexMiddlePosition=new h.Vector3(0,0,0),n.decalScaleXY=new h.Vector2(1.5,1.5),n.decalFrontOnly=!0,n.rimIntensity=.287,n.rimHueShift=0,n.rimSaturationShift=0,n.rimValueShift=-1,n.iridescenceIntensity=0,n.useGlobalLeftIndex=1,n.useGlobalRightIndex=1,n.globalLeftIndexTipProximity=0,n.globalRightIndexTipProximity=0,n.globalLeftIndexTipPosition=new h.Vector4(.5,0,-.55,1),n.globaRightIndexTipPosition=new h.Vector4(0,0,0,1),n.globalLeftThumbTipPosition=new h.Vector4(.5,0,-.55,1),n.globalRightThumbTipPosition=new h.Vector4(0,0,0,1),n.globalLeftIndexMiddlePosition=new h.Vector4(.5,0,-.55,1),n.globalRightIndexMiddlePosition=new h.Vector4(0,0,0,1),n.alphaMode=h.Constants.ALPHA_DISABLE,n.backFaceCulling=!1,n._blueGradientTexture=new h.Texture(e.BLUE_GRADIENT_TEXTURE_URL,o,!0,!1,h.Texture.NEAREST_SAMPLINGMODE),n._decalTexture=new h.Texture("",n.getScene()),n._reflectionMapTexture=new h.Texture("",n.getScene()),n._indirectEnvTexture=new h.Texture("",n.getScene()),n}return r(e,t),e.prototype.needAlphaBlending=function(){return!1},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){if(this.isFrozen&&e.effect&&e.effect._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new jt);var i=e.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(e))return!0;var n=o.getEngine();if(h.MaterialHelper.PrepareDefinesForAttributes(t,i,!1,!1),i.isDirty){i.markAsProcessed(),o.resetCachedMaterial();var r=new h.EffectFallbacks;i.FOG&&r.addFallback(1,"FOG"),h.MaterialHelper.HandleFallbacksForShadows(i,r),i.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;var a=[h.VertexBuffer.PositionKind];i.NORMAL&&a.push(h.VertexBuffer.NormalKind),i.UV1&&a.push(h.VertexBuffer.UVKind),i.UV2&&a.push(h.VertexBuffer.UV2Kind),i.VERTEXCOLOR&&a.push(h.VertexBuffer.ColorKind),i.TANGENT&&a.push(h.VertexBuffer.TangentKind),h.MaterialHelper.PrepareAttributesForInstances(a,i);var s=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"],_=["_Rim_Texture_","_Iridescence_Texture_"],c=new Array;h.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:l,uniformBuffersNames:c,samplers:_,defines:i,maxSimultaneousLights:4}),e.setEffect(o.getEngine().createEffect("mrdlSliderThumb",{attributes:a,uniformsNames:l,uniformBuffersNames:c,samplers:_,defines:s,fallbacks:r,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),i)}return!(!e.effect||!e.effect.isReady()||(i._renderId=o.getRenderId(),e.effect._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){if(i.materialDefines){var o=i.effect;o&&(this._activeEffect=o,this.bindOnlyWorldMatrix(t),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_",this._reflectionMapTexture),this._activeEffect.setTexture("_Indirect_Environment_",this._indirectEnvTexture),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_",this._decalTexture),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(e,this._activeEffect))}},e.prototype.getAnimatables=function(){return[]},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e),this._reflectionMapTexture.dispose(),this._indirectEnvTexture.dispose(),this._blueGradientTexture.dispose(),this._decalTexture.dispose()},e.prototype.clone=function(t){var i=this;return h.SerializationHelper.Clone((function(){return new e(t,i.getScene())}),this)},e.prototype.serialize=function(){var e=t.prototype.serialize.call(this);return e.customType="BABYLON.MRDLSliderThumbMaterial",e},e.prototype.getClassName=function(){return"MRDLSliderThumbMaterial"},e.Parse=function(t,i,o){return h.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},e.BLUE_GRADIENT_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/MRDL/mrtk-mrdl-blue-gradient.png",s([(0,h.serialize)()],e.prototype,"radius",void 0),s([(0,h.serialize)()],e.prototype,"bevelFront",void 0),s([(0,h.serialize)()],e.prototype,"bevelFrontStretch",void 0),s([(0,h.serialize)()],e.prototype,"bevelBack",void 0),s([(0,h.serialize)()],e.prototype,"bevelBackStretch",void 0),s([(0,h.serialize)()],e.prototype,"radiusTopLeft",void 0),s([(0,h.serialize)()],e.prototype,"radiusTopRight",void 0),s([(0,h.serialize)()],e.prototype,"radiusBottomLeft",void 0),s([(0,h.serialize)()],e.prototype,"radiusBottomRight",void 0),s([(0,h.serialize)()],e.prototype,"bulgeEnabled",void 0),s([(0,h.serialize)()],e.prototype,"bulgeHeight",void 0),s([(0,h.serialize)()],e.prototype,"bulgeRadius",void 0),s([(0,h.serialize)()],e.prototype,"sunIntensity",void 0),s([(0,h.serialize)()],e.prototype,"sunTheta",void 0),s([(0,h.serialize)()],e.prototype,"sunPhi",void 0),s([(0,h.serialize)()],e.prototype,"indirectDiffuse",void 0),s([(0,h.serialize)()],e.prototype,"albedo",void 0),s([(0,h.serialize)()],e.prototype,"specular",void 0),s([(0,h.serialize)()],e.prototype,"shininess",void 0),s([(0,h.serialize)()],e.prototype,"sharpness",void 0),s([(0,h.serialize)()],e.prototype,"subsurface",void 0),s([(0,h.serialize)()],e.prototype,"leftGradientColor",void 0),s([(0,h.serialize)()],e.prototype,"rightGradientColor",void 0),s([(0,h.serialize)()],e.prototype,"reflection",void 0),s([(0,h.serialize)()],e.prototype,"frontReflect",void 0),s([(0,h.serialize)()],e.prototype,"edgeReflect",void 0),s([(0,h.serialize)()],e.prototype,"power",void 0),s([(0,h.serialize)()],e.prototype,"skyColor",void 0),s([(0,h.serialize)()],e.prototype,"horizonColor",void 0),s([(0,h.serialize)()],e.prototype,"groundColor",void 0),s([(0,h.serialize)()],e.prototype,"horizonPower",void 0),s([(0,h.serialize)()],e.prototype,"width",void 0),s([(0,h.serialize)()],e.prototype,"fuzz",void 0),s([(0,h.serialize)()],e.prototype,"minFuzz",void 0),s([(0,h.serialize)()],e.prototype,"clipFade",void 0),s([(0,h.serialize)()],e.prototype,"hueShift",void 0),s([(0,h.serialize)()],e.prototype,"saturationShift",void 0),s([(0,h.serialize)()],e.prototype,"valueShift",void 0),s([(0,h.serialize)()],e.prototype,"blobPosition",void 0),s([(0,h.serialize)()],e.prototype,"blobIntensity",void 0),s([(0,h.serialize)()],e.prototype,"blobNearSize",void 0),s([(0,h.serialize)()],e.prototype,"blobFarSize",void 0),s([(0,h.serialize)()],e.prototype,"blobNearDistance",void 0),s([(0,h.serialize)()],e.prototype,"blobFarDistance",void 0),s([(0,h.serialize)()],e.prototype,"blobFadeLength",void 0),s([(0,h.serialize)()],e.prototype,"blobPulse",void 0),s([(0,h.serialize)()],e.prototype,"blobFade",void 0),s([(0,h.serialize)()],e.prototype,"blobPosition2",void 0),s([(0,h.serialize)()],e.prototype,"blobNearSize2",void 0),s([(0,h.serialize)()],e.prototype,"blobPulse2",void 0),s([(0,h.serialize)()],e.prototype,"blobFade2",void 0),s([(0,h.serialize)()],e.prototype,"blobTexture",void 0),s([(0,h.serialize)()],e.prototype,"leftIndexPosition",void 0),s([(0,h.serialize)()],e.prototype,"rightIndexPosition",void 0),s([(0,h.serialize)()],e.prototype,"leftIndexMiddlePosition",void 0),s([(0,h.serialize)()],e.prototype,"rightIndexMiddlePosition",void 0),s([(0,h.serialize)()],e.prototype,"decalScaleXY",void 0),s([(0,h.serialize)()],e.prototype,"decalFrontOnly",void 0),s([(0,h.serialize)()],e.prototype,"rimIntensity",void 0),s([(0,h.serialize)()],e.prototype,"rimHueShift",void 0),s([(0,h.serialize)()],e.prototype,"rimSaturationShift",void 0),s([(0,h.serialize)()],e.prototype,"rimValueShift",void 0),s([(0,h.serialize)()],e.prototype,"iridescenceIntensity",void 0),e}(h.PushMaterial);(0,h.RegisterClass)("BABYLON.GUI.MRDLSliderThumbMaterial",Yt);h.ShaderStore.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}";h.ShaderStore.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}";var Xt=function(t){function e(){var e=t.call(this)||this;return e.IRIDESCENCE_ENABLE=!0,e.SMOOTH_EDGES=!0,e._needNormals=!0,e.rebuild(),e}return r(e,t),e}(h.MaterialDefines),Kt=function(t){function e(i,o){var n=t.call(this,i,o)||this;return n.radius=.3,n.lineWidth=.003,n.absoluteSizes=!1,n._filterWidth=1,n.baseColor=new h.Color4(0,0,0,1),n.lineColor=new h.Color4(.2,.262745,.4,1),n.radiusTopLeft=1,n.radiusTopRight=1,n.radiusBottomLeft=1,n.radiusBottomRight=1,n._rate=0,n.highlightColor=new h.Color4(.239216,.435294,.827451,1),n.highlightWidth=0,n._highlightTransform=new h.Vector4(1,1,0,0),n._highlight=1,n.iridescenceIntensity=.45,n.iridescenceEdgeIntensity=1,n.iridescenceTint=new h.Color4(1,1,1,1),n._angle=-45,n.fadeOut=1,n._reflected=!0,n._frequency=1,n._verticalOffset=0,n.gradientColor=new h.Color4(.74902,.74902,.74902,1),n.topLeftGradientColor=new h.Color4(.00784314,.294118,.580392,1),n.topRightGradientColor=new h.Color4(.305882,0,1,1),n.bottomLeftGradientColor=new h.Color4(.133333,.258824,.992157,1),n.bottomRightGradientColor=new h.Color4(.176471,.176471,.619608,1),n.edgeWidth=.5,n.edgePower=1,n.edgeLineGradientBlend=.5,n.alphaMode=h.Constants.ALPHA_DISABLE,n.backFaceCulling=!1,n._iridescentMapTexture=new h.Texture(e.IRIDESCENT_MAP_TEXTURE_URL,n.getScene(),!0,!1,h.Texture.NEAREST_SAMPLINGMODE),n}return r(e,t),e.prototype.needAlphaBlending=function(){return!1},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){if(this.isFrozen&&e.effect&&e.effect._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new Xt);var i=e.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(e))return!0;var n=o.getEngine();if(h.MaterialHelper.PrepareDefinesForAttributes(t,i,!1,!1),i.isDirty){i.markAsProcessed(),o.resetCachedMaterial();var r=new h.EffectFallbacks;i.FOG&&r.addFallback(1,"FOG"),h.MaterialHelper.HandleFallbacksForShadows(i,r),i.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;var a=[h.VertexBuffer.PositionKind];i.NORMAL&&a.push(h.VertexBuffer.NormalKind),i.UV1&&a.push(h.VertexBuffer.UVKind),i.UV2&&a.push(h.VertexBuffer.UV2Kind),i.VERTEXCOLOR&&a.push(h.VertexBuffer.ColorKind),i.TANGENT&&a.push(h.VertexBuffer.TangentKind),h.MaterialHelper.PrepareAttributesForInstances(a,i);var s=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_"],_=["_Iridescent_Map_"],c=new Array;h.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:l,uniformBuffersNames:c,samplers:_,defines:i,maxSimultaneousLights:4}),e.setEffect(o.getEngine().createEffect("mrdlBackplate",{attributes:a,uniformsNames:l,uniformBuffersNames:c,samplers:_,defines:s,fallbacks:r,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),i)}return!(!e.effect||!e.effect.isReady()||(i._renderId=o.getRenderId(),e.effect._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){if(i.materialDefines){var o=i.effect;o&&(this._activeEffect=o,this.bindOnlyWorldMatrix(t),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(e,this._activeEffect))}},e.prototype.getAnimatables=function(){return[]},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e)},e.prototype.clone=function(t){var i=this;return h.SerializationHelper.Clone((function(){return new e(t,i.getScene())}),this)},e.prototype.serialize=function(){var e=t.prototype.serialize.call(this);return e.customType="BABYLON.MRDLBackplateMaterial",e},e.prototype.getClassName=function(){return"MRDLBackplateMaterial"},e.Parse=function(t,i,o){return h.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},e.IRIDESCENT_MAP_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/MRDL/mrtk-mrdl-backplate-iridescence.png",s([(0,h.serialize)()],e.prototype,"radius",void 0),s([(0,h.serialize)()],e.prototype,"lineWidth",void 0),s([(0,h.serialize)()],e.prototype,"absoluteSizes",void 0),s([(0,h.serialize)()],e.prototype,"baseColor",void 0),s([(0,h.serialize)()],e.prototype,"lineColor",void 0),s([(0,h.serialize)()],e.prototype,"radiusTopLeft",void 0),s([(0,h.serialize)()],e.prototype,"radiusTopRight",void 0),s([(0,h.serialize)()],e.prototype,"radiusBottomLeft",void 0),s([(0,h.serialize)()],e.prototype,"radiusBottomRight",void 0),s([(0,h.serialize)()],e.prototype,"highlightColor",void 0),s([(0,h.serialize)()],e.prototype,"highlightWidth",void 0),s([(0,h.serialize)()],e.prototype,"iridescenceIntensity",void 0),s([(0,h.serialize)()],e.prototype,"iridescenceEdgeIntensity",void 0),s([(0,h.serialize)()],e.prototype,"iridescenceTint",void 0),s([(0,h.serialize)()],e.prototype,"fadeOut",void 0),s([(0,h.serialize)()],e.prototype,"gradientColor",void 0),s([(0,h.serialize)()],e.prototype,"topLeftGradientColor",void 0),s([(0,h.serialize)()],e.prototype,"topRightGradientColor",void 0),s([(0,h.serialize)()],e.prototype,"bottomLeftGradientColor",void 0),s([(0,h.serialize)()],e.prototype,"bottomRightGradientColor",void 0),s([(0,h.serialize)()],e.prototype,"edgeWidth",void 0),s([(0,h.serialize)()],e.prototype,"edgePower",void 0),s([(0,h.serialize)()],e.prototype,"edgeLineGradientBlend",void 0),e}(h.PushMaterial);(0,h.RegisterClass)("BABYLON.GUI.MRDLBackplateMaterial",Kt);var Zt=function(t){function e(e,i){var o=t.call(this,e)||this;return o.onValueChangedObservable=new h.Observable,o._sliderBackplateVisible=i||!1,o._minimum=0,o._maximum=100,o._step=0,o._value=50,o}return r(e,t),Object.defineProperty(e.prototype,"mesh",{get:function(){return this.node?this._sliderThumb:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"minimum",{get:function(){return this._minimum},set:function(t){this._minimum!==t&&(this._minimum=Math.max(t,0),this._value=Math.max(Math.min(this._value,this._maximum),this._minimum))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maximum",{get:function(){return this._maximum},set:function(t){this._maximum!==t&&(this._maximum=Math.max(t,this._minimum),this._value=Math.max(Math.min(this._value,this._maximum),this._minimum))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"step",{get:function(){return this._step},set:function(t){this._step!==t&&(this._step=Math.max(Math.min(t,this._maximum-this._minimum),0))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(t){this._value!==t&&(this._value=Math.max(Math.min(t,this._maximum),this._minimum),this._sliderThumb&&(this._sliderThumb.position.x=this._convertToPosition(this.value)),this.onValueChangedObservable.notifyObservers(this._value))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"start",{get:function(){return this.node?this._sliderBar.position.x-this._sliderBar.scaling.x/2:-.5},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this.node?this._sliderBar.position.x+this._sliderBar.scaling.x/2:.5},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sliderBarMaterial",{get:function(){return this._sliderBarMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sliderThumbMaterial",{get:function(){return this._sliderThumbMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sliderBackplateMaterial",{get:function(){return this._sliderBackplateMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isVisible",{set:function(t){var e;this._isVisible!==t&&(this._isVisible=t,null===(e=this.node)||void 0===e||e.setEnabled(t))},enumerable:!1,configurable:!0}),e.prototype._createNode=function(t){var i=this,o=(0,h.CreateBox)("".concat(this.name,"_sliderbackplate"),{width:1,height:1,depth:1},t);return o.isPickable=!1,o.visibility=0,o.scaling=new h.Vector3(1,.5,.8),h.SceneLoader.ImportMeshAsync(void 0,e.MODEL_BASE_URL,e.MODEL_FILENAME,t).then((function(t){t.meshes.forEach((function(t){t.isPickable=!1}));var e=t.meshes[1],n=t.meshes[1].clone("".concat(i.name,"_sliderbar"),o),r=t.meshes[1].clone("".concat(i.name,"_sliderthumb"),o);e.visibility=0,i._sliderBackplateVisible&&(e.visibility=1,e.name="".concat(i.name,"_sliderbackplate"),e.scaling.x=1,e.scaling.z=.2,e.parent=o,i._sliderBackplateMaterial&&(e.material=i._sliderBackplateMaterial),i._sliderBackplate=e),n&&(n.parent=o,n.position.z=-.1,n.scaling=new h.Vector3(.8,.04,.3),i._sliderBarMaterial&&(n.material=i._sliderBarMaterial),i._sliderBar=n),r&&(r.parent=o,r.isPickable=!0,r.position.z=-.115,r.scaling=new h.Vector3(.025,.3,.6),r.position.x=i._convertToPosition(i.value),r.addBehavior(i._createBehavior()),i._sliderThumbMaterial&&(r.material=i._sliderThumbMaterial),i._sliderThumb=r),i._injectGUI3DReservedDataStore(o).control=i,o.getChildMeshes().forEach((function(t){i._injectGUI3DReservedDataStore(t).control=i}))})),this._affectMaterial(o),o},e.prototype._affectMaterial=function(t){var e,i,o;this._sliderBackplateMaterial=null!==(e=this._sliderBackplateMaterial)&&void 0!==e?e:new Kt("".concat(this.name,"_sliderbackplate_material"),t.getScene()),this._sliderBarMaterial=null!==(i=this._sliderBarMaterial)&&void 0!==i?i:new Ut("".concat(this.name,"_sliderbar_material"),t.getScene()),this._sliderThumbMaterial=null!==(o=this._sliderThumbMaterial)&&void 0!==o?o:new Yt("".concat(this.name,"_sliderthumb_material"),t.getScene())},e.prototype._createBehavior=function(){var t=this,e=new h.PointerDragBehavior({dragAxis:h.Vector3.Right()});return e.moveAttached=!1,e.onDragStartObservable.add((function(){t._draggedPosition=t._sliderThumb.position.x})),e.onDragObservable.add((function(e){t._draggedPosition+=e.dragDistance/t.scaling.x,t.value=t._convertToValue(t._draggedPosition)})),e},e.prototype._convertToPosition=function(t){var e=(t-this.minimum)/(this.maximum-this.minimum)*(this.end-this.start)+this.start;return Math.min(Math.max(e,this.start),this.end)},e.prototype._convertToValue=function(t){var e=(t-this.start)/(this.end-this.start)*(this.maximum-this.minimum);return e=this.step?Math.round(e/this.step)*this.step:e,Math.max(Math.min(this.minimum+e,this._maximum),this._minimum)},e.prototype.dispose=function(){var e,i,o,n,r,a;t.prototype.dispose.call(this),null===(e=this._sliderBar)||void 0===e||e.dispose(),null===(i=this._sliderThumb)||void 0===i||i.dispose(),null===(o=this._sliderBarMaterial)||void 0===o||o.dispose(),null===(n=this._sliderThumbMaterial)||void 0===n||n.dispose(),null===(r=this._sliderBackplate)||void 0===r||r.dispose(),null===(a=this._sliderBackplateMaterial)||void 0===a||a.dispose()},e.MODEL_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",e.MODEL_FILENAME="mrtk-fluent-backplate.glb",e}(dt),qt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._radius=5,e}return r(e,t),Object.defineProperty(e.prototype,"radius",{get:function(){return this._radius},set:function(t){var e=this;this._radius!==t&&(this._radius=t,h.Tools.SetImmediate((function(){e._arrangeChildren()})))},enumerable:!1,configurable:!0}),e.prototype._mapGridNode=function(t,e){var i=t.mesh;if(i){var o=this._sphericalMapping(e);switch(t.position=o,this.orientation){case bt.FACEORIGIN_ORIENTATION:i.lookAt(new h.Vector3(2*o.x,2*o.y,2*o.z));break;case bt.FACEORIGINREVERSED_ORIENTATION:i.lookAt(new h.Vector3(-o.x,-o.y,-o.z));break;case bt.FACEFORWARD_ORIENTATION:break;case bt.FACEFORWARDREVERSED_ORIENTATION:i.rotate(h.Axis.Y,Math.PI,h.Space.LOCAL)}}},e.prototype._sphericalMapping=function(t){var e=new h.Vector3(0,0,this._radius),i=t.y/this._radius,o=-t.x/this._radius;return h.Matrix.RotationYawPitchRollToRef(o,i,0,h.TmpVectors.Matrix[0]),h.Vector3.TransformNormal(e,h.TmpVectors.Matrix[0])},e}(mt),Jt=function(t){function e(e){void 0===e&&(e=!1);var i=t.call(this)||this;return i._isVertical=!1,i.margin=.1,i._isVertical=e,i}return r(e,t),Object.defineProperty(e.prototype,"isVertical",{get:function(){return this._isVertical},set:function(t){var e=this;this._isVertical!==t&&(this._isVertical=t,h.Tools.SetImmediate((function(){e._arrangeChildren()})))},enumerable:!1,configurable:!0}),e.prototype._arrangeChildren=function(){for(var t,e=0,i=0,o=0,n=[],r=h.Matrix.Invert(this.node.computeWorldMatrix(!0)),a=0,s=this._children;a<s.length;a++)if((f=s[a]).mesh){o++,f.mesh.computeWorldMatrix(!0),f.mesh.getWorldMatrix().multiplyToRef(r,h.TmpVectors.Matrix[0]);var l=f.mesh.getBoundingInfo().boundingBox,_=h.Vector3.TransformNormal(l.extendSize,h.TmpVectors.Matrix[0]);n.push(_),this._isVertical?i+=_.y:e+=_.x}this._isVertical?i+=(o-1)*this.margin/2:e+=(o-1)*this.margin/2,t=this._isVertical?-i:-e;for(var c=0,u=0,d=this._children;u<d.length;u++){var f;(f=d[u]).mesh&&(o--,_=n[c++],this._isVertical?(f.position.y=t+_.y,f.position.x=0,t+=2*_.y):(f.position.x=t+_.x,f.position.y=0,t+=2*_.x),t+=o>0?this.margin:0)}},e}(bt),$t=function(t){function e(e,i){var o=t.call(this,i,e)||this;return o._currentMesh=e,o.pointerEnterAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(1.1)},o.pointerOutAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(1/1.1)},o.pointerDownAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(.95)},o.pointerUpAnimation=function(){o.mesh&&o.mesh.scaling.scaleInPlace(1/.95)},o}return r(e,t),e.prototype._getTypeName=function(){return"TouchMeshButton3D"},e.prototype._createNode=function(){var t=this;return this._currentMesh.getChildMeshes().forEach((function(e){t._injectGUI3DReservedDataStore(e).control=t})),this._currentMesh},e.prototype._affectMaterial=function(t){},e}(wt);h.ShaderStore.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}";h.ShaderStore.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}";var te=function(t){function e(){var e=t.call(this)||this;return e._needNormals=!0,e._needUVs=!0,e.rebuild(),e}return r(e,t),e}(h.MaterialDefines),ee=function(t){function e(e,i){var o=t.call(this,e,i)||this;return o.bevelRadius=.16,o.lineWidth=.16,o.absoluteSizes=!1,o.tuningMotion=0,o.motion=1,o.maxIntensity=.7,o.intensityFadeInExponent=2,o.outerFuzzStart=.04,o.outerFuzzEnd=.04,o.color=new h.Color4(.682353,.698039,1,1),o.innerColor=new h.Color4(.356863,.392157,.796078,1),o.blendExponent=1.5,o.falloff=2,o.bias=.5,o.alphaMode=h.Constants.ALPHA_ADD,o.disableDepthWrite=!0,o.backFaceCulling=!1,o}return r(e,t),e.prototype.needAlphaBlending=function(){return!0},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){if(this.isFrozen&&e.effect&&e.effect._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new te);var i=e.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(e))return!0;var n=o.getEngine();if(h.MaterialHelper.PrepareDefinesForAttributes(t,i,!1,!1),i.isDirty){i.markAsProcessed(),o.resetCachedMaterial();var r=new h.EffectFallbacks;i.FOG&&r.addFallback(1,"FOG"),h.MaterialHelper.HandleFallbacksForShadows(i,r),i.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;var a=[h.VertexBuffer.PositionKind];i.NORMAL&&a.push(h.VertexBuffer.NormalKind),i.UV1&&a.push(h.VertexBuffer.UVKind),i.UV2&&a.push(h.VertexBuffer.UV2Kind),i.VERTEXCOLOR&&a.push(h.VertexBuffer.ColorKind),i.TANGENT&&a.push(h.VertexBuffer.TangentKind),h.MaterialHelper.PrepareAttributesForInstances(a,i);var s=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=new Array;h.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:l,uniformBuffersNames:c,samplers:_,defines:i,maxSimultaneousLights:4}),e.setEffect(o.getEngine().createEffect("mrdlBackglow",{attributes:a,uniformsNames:l,uniformBuffersNames:c,samplers:_,defines:s,fallbacks:r,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),i)}return!(!e.effect||!e.effect.isReady()||(i._renderId=o.getRenderId(),e.effect._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){var o=this.getScene();if(i.materialDefines){var n=i.effect;n&&(this._activeEffect=n,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",o.getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",o.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(e,this._activeEffect))}},e.prototype.getAnimatables=function(){return[]},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e)},e.prototype.clone=function(t){var i=this;return h.SerializationHelper.Clone((function(){return new e(t,i.getScene())}),this)},e.prototype.serialize=function(){var t=h.SerializationHelper.Serialize(this);return t.customType="BABYLON.MRDLBackglowMaterial",t},e.prototype.getClassName=function(){return"MRDLBackglowMaterial"},e.Parse=function(t,i,o){return h.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},s([(0,h.serialize)()],e.prototype,"bevelRadius",void 0),s([(0,h.serialize)()],e.prototype,"lineWidth",void 0),s([(0,h.serialize)()],e.prototype,"absoluteSizes",void 0),s([(0,h.serialize)()],e.prototype,"tuningMotion",void 0),s([(0,h.serialize)()],e.prototype,"motion",void 0),s([(0,h.serialize)()],e.prototype,"maxIntensity",void 0),s([(0,h.serialize)()],e.prototype,"intensityFadeInExponent",void 0),s([(0,h.serialize)()],e.prototype,"outerFuzzStart",void 0),s([(0,h.serialize)()],e.prototype,"outerFuzzEnd",void 0),s([(0,h.serialize)()],e.prototype,"color",void 0),s([(0,h.serialize)()],e.prototype,"innerColor",void 0),s([(0,h.serialize)()],e.prototype,"blendExponent",void 0),s([(0,h.serialize)()],e.prototype,"falloff",void 0),s([(0,h.serialize)()],e.prototype,"bias",void 0),e}(h.PushMaterial);(0,h.RegisterClass)("BABYLON.GUI.MRDLBackglowMaterial",ee);h.ShaderStore.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}";h.ShaderStore.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}";var ie=function(t){function e(){var e=t.call(this)||this;return e.SMOOTH_EDGES=!0,e._needNormals=!0,e._needUVs=!0,e.rebuild(),e}return r(e,t),e}(h.MaterialDefines),oe=function(t){function e(i,o){var n=t.call(this,i,o)||this;return n.radius=.12,n.lineWidth=.01,n.relativeToHeight=!1,n._filterWidth=1,n.edgeColor=new h.Color4(.53,.53,.53,1),n.blobEnable=!0,n.blobPosition=new h.Vector3(100,100,100),n.blobIntensity=.5,n.blobNearSize=.032,n.blobFarSize=.048,n.blobNearDistance=.008,n.blobFarDistance=.064,n.blobFadeLength=.04,n.blobInnerFade=.01,n.blobPulse=0,n.blobFade=1,n.blobPulseMaxSize=.05,n.blobEnable2=!0,n.blobPosition2=new h.Vector3(10,10.1,-.6),n.blobNearSize2=.008,n.blobInnerFade2=.1,n.blobPulse2=0,n.blobFade2=1,n.gazeIntensity=.8,n.gazeFocus=0,n.selectionFuzz=.5,n.selected=1,n.selectionFade=.2,n.selectionFadeSize=0,n.selectedDistance=.08,n.selectedFadeLength=.08,n.proximityMaxIntensity=.45,n.proximityFarDistance=.16,n.proximityNearRadius=.016,n.proximityAnisotropy=1,n.useGlobalLeftIndex=!0,n.useGlobalRightIndex=!0,n.fadeOut=1,n.alphaMode=h.Constants.ALPHA_ADD,n.disableDepthWrite=!0,n.backFaceCulling=!1,n._blobTexture=new h.Texture(e.BLOB_TEXTURE_URL,o,!0,!1,h.Texture.NEAREST_SAMPLINGMODE),n}return r(e,t),e.prototype.needAlphaBlending=function(){return!0},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){if(this.isFrozen&&e.effect&&e.effect._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new ie);var i=e.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(e))return!0;var n=o.getEngine();if(h.MaterialHelper.PrepareDefinesForAttributes(t,i,!1,!1),i.isDirty){i.markAsProcessed(),o.resetCachedMaterial();var r=new h.EffectFallbacks;i.FOG&&r.addFallback(1,"FOG"),h.MaterialHelper.HandleFallbacksForShadows(i,r),i.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;var a=[h.VertexBuffer.PositionKind];i.NORMAL&&a.push(h.VertexBuffer.NormalKind),i.UV1&&a.push(h.VertexBuffer.UVKind),i.UV2&&a.push(h.VertexBuffer.UV2Kind),i.VERTEXCOLOR&&a.push(h.VertexBuffer.ColorKind),i.TANGENT&&a.push(h.VertexBuffer.TangentKind),h.MaterialHelper.PrepareAttributesForInstances(a,i);var s=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=new Array;h.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:l,uniformBuffersNames:c,samplers:_,defines:i,maxSimultaneousLights:4}),e.setEffect(o.getEngine().createEffect("mrdlFrontplate",{attributes:a,uniformsNames:l,uniformBuffersNames:c,samplers:_,defines:s,fallbacks:r,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),i)}return!(!e.effect||!e.effect.isReady()||(i._renderId=o.getRenderId(),e.effect._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){var o=this.getScene();if(i.materialDefines){var n=i.effect;n&&(this._activeEffect=n,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",o.getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",o.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(e,this._activeEffect))}},e.prototype.getAnimatables=function(){return[]},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e)},e.prototype.clone=function(t){var i=this;return h.SerializationHelper.Clone((function(){return new e(t,i.getScene())}),this)},e.prototype.serialize=function(){var t=h.SerializationHelper.Serialize(this);return t.customType="BABYLON.MRDLFrontplateMaterial",t},e.prototype.getClassName=function(){return"MRDLFrontplateMaterial"},e.Parse=function(t,i,o){return h.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},e.BLOB_TEXTURE_URL="",s([(0,h.serialize)()],e.prototype,"radius",void 0),s([(0,h.serialize)()],e.prototype,"lineWidth",void 0),s([(0,h.serialize)()],e.prototype,"relativeToHeight",void 0),s([(0,h.serialize)()],e.prototype,"edgeColor",void 0),s([(0,h.serialize)()],e.prototype,"blobEnable",void 0),s([(0,h.serialize)()],e.prototype,"blobPosition",void 0),s([(0,h.serialize)()],e.prototype,"blobIntensity",void 0),s([(0,h.serialize)()],e.prototype,"blobNearSize",void 0),s([(0,h.serialize)()],e.prototype,"blobFarSize",void 0),s([(0,h.serialize)()],e.prototype,"blobNearDistance",void 0),s([(0,h.serialize)()],e.prototype,"blobFarDistance",void 0),s([(0,h.serialize)()],e.prototype,"blobFadeLength",void 0),s([(0,h.serialize)()],e.prototype,"blobInnerFade",void 0),s([(0,h.serialize)()],e.prototype,"blobPulse",void 0),s([(0,h.serialize)()],e.prototype,"blobFade",void 0),s([(0,h.serialize)()],e.prototype,"blobPulseMaxSize",void 0),s([(0,h.serialize)()],e.prototype,"blobEnable2",void 0),s([(0,h.serialize)()],e.prototype,"blobPosition2",void 0),s([(0,h.serialize)()],e.prototype,"blobNearSize2",void 0),s([(0,h.serialize)()],e.prototype,"blobInnerFade2",void 0),s([(0,h.serialize)()],e.prototype,"blobPulse2",void 0),s([(0,h.serialize)()],e.prototype,"blobFade2",void 0),s([(0,h.serialize)()],e.prototype,"gazeIntensity",void 0),s([(0,h.serialize)()],e.prototype,"gazeFocus",void 0),s([(0,h.serialize)()],e.prototype,"selectionFuzz",void 0),s([(0,h.serialize)()],e.prototype,"selected",void 0),s([(0,h.serialize)()],e.prototype,"selectionFade",void 0),s([(0,h.serialize)()],e.prototype,"selectionFadeSize",void 0),s([(0,h.serialize)()],e.prototype,"selectedDistance",void 0),s([(0,h.serialize)()],e.prototype,"selectedFadeLength",void 0),s([(0,h.serialize)()],e.prototype,"proximityMaxIntensity",void 0),s([(0,h.serialize)()],e.prototype,"proximityFarDistance",void 0),s([(0,h.serialize)()],e.prototype,"proximityNearRadius",void 0),s([(0,h.serialize)()],e.prototype,"proximityAnisotropy",void 0),s([(0,h.serialize)()],e.prototype,"useGlobalLeftIndex",void 0),s([(0,h.serialize)()],e.prototype,"useGlobalRightIndex",void 0),e}(h.PushMaterial);(0,h.RegisterClass)("BABYLON.GUI.MRDLFrontplateMaterial",oe);h.ShaderStore.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";h.ShaderStore.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";var ne=function(t){function e(){var e=t.call(this)||this;return e._needNormals=!0,e._needUVs=!0,e.rebuild(),e}return r(e,t),e}(h.MaterialDefines),re=function(t){function e(e,i){var o=t.call(this,e,i)||this;return o.color=new h.Color4(1,1,1,.05),o.radius=.12,o.fixedRadius=!0,o._filterWidth=1,o.glowFraction=0,o.glowMax=.5,o.glowFalloff=2,o.alphaMode=h.Constants.ALPHA_COMBINE,o.backFaceCulling=!1,o}return r(e,t),e.prototype.needAlphaBlending=function(){return!0},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e){if(this.isFrozen&&e.effect&&e.effect._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new ne);var i=e.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(e))return!0;var n=o.getEngine();if(h.MaterialHelper.PrepareDefinesForAttributes(t,i,!0,!1),i.isDirty){i.markAsProcessed(),o.resetCachedMaterial();var r=new h.EffectFallbacks;i.FOG&&r.addFallback(1,"FOG"),h.MaterialHelper.HandleFallbacksForShadows(i,r),i.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;var a=[h.VertexBuffer.PositionKind];i.NORMAL&&a.push(h.VertexBuffer.NormalKind),i.UV1&&a.push(h.VertexBuffer.UVKind),i.UV2&&a.push(h.VertexBuffer.UV2Kind),i.VERTEXCOLOR&&a.push(h.VertexBuffer.ColorKind),i.TANGENT&&a.push(h.VertexBuffer.TangentKind),h.MaterialHelper.PrepareAttributesForInstances(a,i);var s=i.toString(),l=["world","worldView","worldViewProjection","view","projection","viewProjection","cameraPosition","_Color_","_Radius_","_Fixed_Radius_","_Filter_Width_","_Glow_Fraction_","_Glow_Max_","_Glow_Falloff_"],_=[],c=new Array;h.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:l,uniformBuffersNames:c,samplers:_,defines:i,maxSimultaneousLights:4}),e.setEffect(o.getEngine().createEffect("mrdlInnerquad",{attributes:a,uniformsNames:l,uniformBuffersNames:c,samplers:_,defines:s,fallbacks:r,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},n),i)}return!(!e.effect||!e.effect.isReady()||(i._renderId=o.getRenderId(),e.effect._wasPreviouslyReady=!0,0))},e.prototype.bindForSubMesh=function(t,e,i){var o=this.getScene();if(i.materialDefines){var n=i.effect;n&&(this._activeEffect=n,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",o.getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",o.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(e,this._activeEffect))}},e.prototype.getAnimatables=function(){return[]},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e)},e.prototype.clone=function(t){var i=this;return h.SerializationHelper.Clone((function(){return new e(t,i.getScene())}),this)},e.prototype.serialize=function(){var t=h.SerializationHelper.Serialize(this);return t.customType="BABYLON.MRDLInnerquadMaterial",t},e.prototype.getClassName=function(){return"MRDLInnerquadMaterial"},e.Parse=function(t,i,o){return h.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,o)},s([(0,h.serialize)()],e.prototype,"color",void 0),s([(0,h.serialize)()],e.prototype,"radius",void 0),s([(0,h.serialize)()],e.prototype,"fixedRadius",void 0),s([(0,h.serialize)()],e.prototype,"glowFraction",void 0),s([(0,h.serialize)()],e.prototype,"glowMax",void 0),s([(0,h.serialize)()],e.prototype,"glowFalloff",void 0),e}(h.PushMaterial);(0,h.RegisterClass)("BABYLON.GUI.MRDLInnerquadMaterial",re);var ae=function(t){function e(e,i){void 0===i&&(i=!0);var o=t.call(this,e)||this;return o.width=1,o.height=1,o.radius=.14,o.textSizeInPixels=18,o.imageSizeInPixels=40,o.plateMaterialColor=new h.Color3(.4,.4,.4),o.frontPlateDepth=.2,o.backPlateDepth=.04,o.backGlowOffset=.1,o.flatPlaneDepth=.001,o.innerQuadRadius=o.radius-.04,o.innerQuadColor=new h.Color4(0,0,0,0),o.innerQuadToggledColor=new h.Color4(.5197843,.6485234,.9607843,.6),o.innerQuadHoverColor=new h.Color4(1,1,1,.05),o.innerQuadToggledHoverColor=new h.Color4(.5197843,.6485234,.9607843,1),o._isBackplateVisible=!0,o._shareMaterials=!0,o._shareMaterials=i,o.pointerEnterAnimation=function(){o._frontPlate&&o._textPlate&&!o.isToggleButton&&o._performEnterExitAnimation(1),o.isToggleButton&&o._innerQuadMaterial&&(o.isToggled?o._innerQuadMaterial.color=o.innerQuadToggledHoverColor:o._innerQuadMaterial.color=o.innerQuadHoverColor)},o.pointerOutAnimation=function(){o._frontPlate&&o._textPlate&&!o.isToggleButton&&o._performEnterExitAnimation(-.8),o.isToggleButton&&o._innerQuadMaterial&&o._onToggle(o.isToggled)},o.pointerDownAnimation=function(){},o.pointerUpAnimation=function(){},o._pointerClickObserver=o.onPointerClickObservable.add((function(){o._frontPlate&&o._backGlow&&!o.isActiveNearInteraction&&o._performClickAnimation(),o.isToggleButton&&o._innerQuadMaterial&&o._onToggle(o.isToggled)})),o._pointerEnterObserver=o.onPointerEnterObservable.add((function(){o.pointerEnterAnimation()})),o._pointerOutObserver=o.onPointerOutObservable.add((function(){o.pointerOutAnimation()})),o._toggleObserver=o.onToggleObservable.add((function(t){o._innerQuadMaterial.color=t?o.innerQuadToggledColor:o.innerQuadColor})),o}return r(e,t),e.prototype._disposeTooltip=function(){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)},Object.defineProperty(e.prototype,"renderingGroupId",{get:function(){return this._backPlate.renderingGroupId},set:function(t){this._backPlate.renderingGroupId=t,this._textPlate.renderingGroupId=t,this._frontPlate.renderingGroupId=t,this._backGlow.renderingGroupId=t,this._innerQuad.renderingGroupId=t,this._tooltipMesh&&(this._tooltipMesh.renderingGroupId=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mesh",{get:function(){return this._backPlate},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tooltipText",{get:function(){var t;return(null===(t=this._tooltipTextBlock)||void 0===t?void 0:t.text)||null},set:function(t){var e=this;if(t){if(!this._tooltipFade){var i=this._backPlate._scene.useRightHandedSystem;this._tooltipMesh=(0,h.CreatePlane)("",{size:1},this._backPlate._scene),this._tooltipMesh.position=h.Vector3.Down().scale(.7).add(h.Vector3.Forward(i).scale(-.15)),this._tooltipMesh.isPickable=!1,this._tooltipMesh.parent=this._frontPlateCollisionMesh,this._tooltipTexture=lt.CreateForMesh(this._tooltipMesh);var o=new I;o.height=.25,o.width=.8,o.cornerRadius=25,o.color="#ffffff",o.thickness=20,o.background="#060668",this._tooltipTexture.addControl(o),this._tooltipTextBlock=new B,this._tooltipTextBlock.color="white",this._tooltipTextBlock.fontSize=100,this._tooltipTexture.addControl(this._tooltipTextBlock),this._tooltipFade=new h.FadeInOutBehavior,this._tooltipFade.delay=500,this._tooltipMesh.addBehavior(this._tooltipFade),this._tooltipHoverObserver=this.onPointerEnterObservable.add((function(){e._tooltipFade&&e._tooltipFade.fadeIn(!0)})),this._tooltipOutObserver=this.onPointerOutObservable.add((function(){e._tooltipFade&&e._tooltipFade.fadeIn(!1)}))}this._tooltipTextBlock&&(this._tooltipTextBlock.text=t)}else this._disposeTooltip()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){this._text!==t&&(this._text=t,this._rebuildContent())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subtext",{get:function(){return this._subtext},set:function(t){this._subtext!==t&&(this._subtext=t,this._rebuildContent())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"imageUrl",{get:function(){return this._imageUrl},set:function(t){this._imageUrl!==t&&(this._imageUrl=t,this._rebuildContent())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backMaterial",{get:function(){return this._backMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"frontMaterial",{get:function(){return this._frontMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backGlowMaterial",{get:function(){return this._backGlowMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"innerQuadMaterial",{get:function(){return this._innerQuadMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"plateMaterial",{get:function(){return this._plateMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shareMaterials",{get:function(){return this._shareMaterials},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isBackplateVisible",{set:function(t){this.mesh&&this._backMaterial&&(t&&!this._isBackplateVisible?this._backPlate.visibility=1:!t&&this._isBackplateVisible&&(this._backPlate.visibility=0)),this._isBackplateVisible=t},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"TouchHolographicButton"},e.prototype._rebuildContent=function(){var t;t=this._getAspectRatio()<=1?this._alignContentVertically():this._alignContentHorizontally(),this.content=t},e.prototype._getAspectRatio=function(){return this.width/this.height},e.prototype._alignContentVertically=function(){var t=new S;if(t.isVertical=!0,h.DomManagement.IsDocumentAvailable()&&document.createElement&&this._imageUrl){var e=new C;e.source=this._imageUrl,e.heightInPixels=180,e.widthInPixels=100,e.paddingTopInPixels=40,e.paddingBottomInPixels=40,t.addControl(e)}if(this._text){var i=new B;i.text=this._text,i.color="white",i.heightInPixels=30,i.fontSize=24,t.addControl(i)}return t},e.prototype._alignContentHorizontally=function(){var t=240,e=15,i=new I;i.widthInPixels=t,i.heightInPixels=t,i.color="transparent",i.setPaddingInPixels(e,e,e,e),t-=30;var o=new S;if(o.isVertical=!1,o.scaleY=this._getAspectRatio(),h.DomManagement.IsDocumentAvailable()&&document.createElement&&this._imageUrl){var n=new I("".concat(this.name,"_image"));n.widthInPixels=this.imageSizeInPixels,n.heightInPixels=this.imageSizeInPixels,n.color="transparent",t-=this.imageSizeInPixels;var r=new C;r.source=this._imageUrl,n.addControl(r),o.addControl(n)}if(this._text){var a=new B("".concat(this.name,"_text"));if(a.text=this._text,a.color="white",a.fontSize=this.textSizeInPixels,a.widthInPixels=t,this._imageUrl&&(a.textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,a.paddingLeftInPixels=e),this._subtext){var s=new M;s.addColumnDefinition(1),s.addRowDefinition(.5),s.addRowDefinition(.5),s.widthInPixels=t,s.heightInPixels=45;var l=new B("".concat(this.name,"_subtext"));l.text=this._subtext,l.color="#EEEEEEAB",l.fontSize=.75*this.textSizeInPixels,l.fontWeight="600",this._imageUrl&&(l.textHorizontalAlignment=y.HORIZONTAL_ALIGNMENT_LEFT,l.paddingLeftInPixels=e),s.addControl(a,0),s.addControl(l,1),o.addControl(s)}else o.addControl(a)}return i.addControl(o),i},e.prototype._createNode=function(e){var i;this.name=null!==(i=this.name)&&void 0!==i?i:"TouchHolographicButton";var o=this._createBackPlate(e),n=this._createFrontPlate(e),r=this._createInnerQuad(e),a=this._createBackGlow(e);this._frontPlateCollisionMesh=n,this._textPlate=t.prototype._createNode.call(this,e),this._textPlate.name="".concat(this.name,"_textPlate"),this._textPlate.isPickable=!1,this._textPlate.scaling.x=this.width,this._textPlate.parent=n,this._backPlate=o,this._backPlate.position=h.Vector3.Forward(e.useRightHandedSystem).scale(this.backPlateDepth/2),this._backPlate.isPickable=!1,this._backPlate.addChild(n),this._backPlate.addChild(r),a&&this._backPlate.addChild(a);var s=new h.TransformNode("".concat(this.name,"_root"),e);return this._backPlate.setParent(s),this.collisionMesh=n,this.collidableFrontDirection=this._backPlate.forward.negate(),s},e.prototype._createBackPlate=function(t){var i=this,o=(0,h.CreateBox)("".concat(this.name,"_backPlate"),{},t);return o.isPickable=!1,o.visibility=0,o.scaling.z=.2,h.SceneLoader.ImportMeshAsync(void 0,e.MRTK_ASSET_BASE_URL,e.BACKPLATE_MODEL_FILENAME,t).then((function(t){var e=t.meshes[1];e.visibility=0,i._isBackplateVisible&&(e.visibility=1,e.name="".concat(i.name,"_backPlate"),e.isPickable=!1,e.scaling.x=i.width,e.scaling.y=i.height,e.parent=o),i._backMaterial&&(e.material=i._backMaterial),i._backPlate=e})),o},e.prototype._createFrontPlate=function(t){var i=this,o=(0,h.CreateBox)("".concat(this.name,"_frontPlate"),{width:this.width,height:this.height,depth:this.frontPlateDepth},t);return o.isPickable=!0,o.isNearPickable=!0,o.visibility=0,o.position=h.Vector3.Forward(t.useRightHandedSystem).scale((this.backPlateDepth-this.frontPlateDepth)/2),h.SceneLoader.ImportMeshAsync(void 0,e.MRTK_ASSET_BASE_URL,e.FRONTPLATE_MODEL_FILENAME,t).then((function(e){var n=(0,h.CreateBox)("".concat(i.name,"_collisionPlate"),{width:i.width,height:i.height},t);n.isPickable=!1,n.scaling.z=i.frontPlateDepth,n.visibility=0,n.parent=o,i._collisionPlate=n;var r=e.meshes[1];r.name="".concat(i.name,"_frontPlate"),r.isPickable=!1,r.scaling.x=i.width-i.backGlowOffset,r.scaling.y=i.height-i.backGlowOffset,r.position=h.Vector3.Forward(t.useRightHandedSystem).scale(-.5),r.parent=n,i.isToggleButton&&(r.visibility=0),i._frontMaterial&&(r.material=i._frontMaterial),i._textPlate.scaling.x=1,i._textPlate.parent=r,i._frontPlate=r})),o},e.prototype._createInnerQuad=function(t){var i=this,o=(0,h.CreateBox)("".concat(this.name,"_innerQuad"),{},t);return o.isPickable=!1,o.visibility=0,o.scaling.z=this.flatPlaneDepth,o.position.z+=this.backPlateDepth/2-this.flatPlaneDepth,h.SceneLoader.ImportMeshAsync(void 0,e.MRTK_ASSET_BASE_URL,e.INNERQUAD_MODEL_FILENAME,t).then((function(t){var e=t.meshes[1];e.name="".concat(i.name,"_innerQuad"),e.isPickable=!1,e.scaling.x=i.width-i.backGlowOffset,e.scaling.y=i.height-i.backGlowOffset,e.parent=o,i._innerQuadMaterial&&(e.material=i._innerQuadMaterial),i._innerQuad=e})),o},e.prototype._createBackGlow=function(t){var i=this;if(!this.isToggleButton){var o=(0,h.CreateBox)("".concat(this.name,"_backGlow"),{},t);return o.isPickable=!1,o.visibility=0,o.scaling.z=this.flatPlaneDepth,o.position.z+=this.backPlateDepth/2-2*this.flatPlaneDepth,h.SceneLoader.ImportMeshAsync(void 0,e.MRTK_ASSET_BASE_URL,e.BACKGLOW_MODEL_FILENAME,t).then((function(t){var e=t.meshes[1];e.name="".concat(i.name,"_backGlow"),e.isPickable=!1,e.scaling.x=i.width-i.backGlowOffset,e.scaling.y=i.height-i.backGlowOffset,e.parent=o,i._backGlowMaterial&&(e.material=i._backGlowMaterial),i._backGlow=e})),o}},e.prototype._applyFacade=function(t){this._plateMaterial.emissiveTexture=t,this._plateMaterial.opacityTexture=t,this._plateMaterial.diffuseColor=this.plateMaterialColor},e.prototype._performClickAnimation=function(){for(var t=new h.AnimationGroup("Click Animation Group"),e=0,i=[{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:[h.Vector3.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]}]}];e<i.length;e++){for(var o=i[e],n=new h.Animation(o.name,o.property,60,h.Animation.ANIMATIONTYPE_FLOAT,h.Animation.ANIMATIONLOOPMODE_CYCLE),r=[],a=0,s=o.keys;a<s.length;a++){var l=s[a];r.push({frame:l.frame,value:l.values[0],inTangent:l.values[1],outTangent:l.values[2],interpolation:l.values[3]})}n.setKeys(r),o.mesh&&t.addTargetedAnimation(n,o.mesh)}t.normalize(0,45),t.speedRatio=1,t.play()},e.prototype._performEnterExitAnimation=function(t){for(var e=new h.AnimationGroup("Enter Exit Animation Group"),i=0,o=[{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:[h.Vector3.Forward(this._textPlate._scene.useRightHandedSystem).scale(-.15).z,0,0]}]}];i<o.length;i++){for(var n=o[i],r=new h.Animation(n.name,n.property,60,h.Animation.ANIMATIONTYPE_FLOAT,h.Animation.ANIMATIONLOOPMODE_CYCLE),a=[],s=0,l=n.keys;s<l.length;s++){var _=l[s];a.push({frame:_.frame,value:_.values[0],inTangent:_.values[1],outTangent:_.values[2],interpolation:_.values[3]})}r.setKeys(a),n.mesh&&e.addTargetedAnimation(r,n.mesh)}e.normalize(0,45),e.speedRatio=t,e.play()},e.prototype._createBackMaterial=function(t){var e;this._backMaterial=null!==(e=this._backMaterial)&&void 0!==e?e:new Kt(this.name+"backPlateMaterial",t.getScene()),this._backMaterial.absoluteSizes=!0,this._backMaterial.radius=this.radius,this._backMaterial.lineWidth=.02},e.prototype._createFrontMaterial=function(t){var e;this._frontMaterial=null!==(e=this._frontMaterial)&&void 0!==e?e:new oe(this.name+"Front Material",t.getScene()),this.frontMaterial.radius=this.innerQuadRadius,this.frontMaterial.fadeOut=0},e.prototype._createBackGlowMaterial=function(t){var e,i=this.radius+.04;this._backGlowMaterial=null!==(e=this._backGlowMaterial)&&void 0!==e?e:new ee(this.name+"Back Glow Material",t.getScene()),this._backGlowMaterial.bevelRadius=i,this._backGlowMaterial.lineWidth=i,this._backGlowMaterial.motion=0},e.prototype._createInnerQuadMaterial=function(t){var e;this._innerQuadMaterial=null!==(e=this._innerQuadMaterial)&&void 0!==e?e:new re("inner_quad",t.getScene()),this._innerQuadMaterial.radius=this.innerQuadRadius,this.isToggleButton&&(this._innerQuadMaterial.color=this.innerQuadColor)},e.prototype._createPlateMaterial=function(t){var e;this._plateMaterial=null!==(e=this._plateMaterial)&&void 0!==e?e:new h.StandardMaterial(this.name+"Plate Material",t.getScene()),this._plateMaterial.specularColor=h.Color3.Black()},e.prototype._onToggle=function(e){t.prototype._onToggle.call(this,e)},e.prototype._affectMaterial=function(t){this._shareMaterials?(this._host._touchSharedMaterials.mrdlBackplateMaterial?this._backMaterial=this._host._touchSharedMaterials.mrdlBackplateMaterial:(this._createBackMaterial(t),this._host._touchSharedMaterials.mrdlBackplateMaterial=this._backMaterial),this._host._touchSharedMaterials.mrdlFrontplateMaterial?this._frontMaterial=this._host._touchSharedMaterials.mrdlFrontplateMaterial:(this._createFrontMaterial(t),this._host._touchSharedMaterials.mrdlFrontplateMaterial=this._frontMaterial),this._host._touchSharedMaterials.mrdlBackglowMaterial?this._backGlowMaterial=this._host._touchSharedMaterials.mrdlBackglowMaterial:(this._createBackGlowMaterial(t),this._host._touchSharedMaterials.mrdlBackglowMaterial=this._backGlowMaterial),this._host._touchSharedMaterials.mrdlInnerQuadMaterial?this._innerQuadMaterial=this._host._touchSharedMaterials.mrdlInnerQuadMaterial:(this._createInnerQuadMaterial(t),this._host._touchSharedMaterials.mrdlInnerQuadMaterial=this._innerQuadMaterial)):(this._createBackMaterial(t),this._createFrontMaterial(t),this._createBackGlowMaterial(t),this._createInnerQuadMaterial(t)),this._createPlateMaterial(t),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()},e.prototype.dispose=function(){t.prototype.dispose.call(this),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))},e.MRTK_ASSET_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",e.FRONTPLATE_MODEL_FILENAME="mrtk-fluent-frontplate.glb",e.BACKPLATE_MODEL_FILENAME="mrtk-fluent-backplate.glb",e.BACKGLOW_MODEL_FILENAME="mrtk-fluent-button.glb",e.INNERQUAD_MODEL_FILENAME="SlateProximity.glb",e}(wt),se=function(){function t(t){var e=this;this._customControlScaling=1,this._lastControlOver={},this._lastControlDown={},this.onPickedPointChangedObservable=new h.Observable,this.onPickingObservable=new h.Observable,this._sharedMaterials={},this._touchSharedMaterials={},this._scene=t||h.EngineStore.LastCreatedScene,this._sceneDisposeObserver=this._scene.onDisposeObservable.add((function(){e._sceneDisposeObserver=null,e._utilityLayer=null,e.dispose()})),this._utilityLayer=h.UtilityLayerRenderer._CreateDefaultUtilityLayerFromScene(this._scene),this._utilityLayer.onlyCheckPointerDownEvents=!1,this._utilityLayer.pickUtilitySceneFirst=!1,this._utilityLayer.mainSceneTrackerPredicate=function(t){var e,i,o;return t&&(null===(o=null===(i=null===(e=t.reservedDataStore)||void 0===e?void 0:e.GUI3D)||void 0===i?void 0:i.control)||void 0===o?void 0:o._node)},this._rootContainer=new bt("RootContainer"),this._rootContainer._host=this;var i=this._utilityLayer.utilityLayerScene;this._pointerOutObserver=this._utilityLayer.onPointerOutObservable.add((function(t){e._handlePointerOut(t,!0)})),this._pointerObserver=i.onPointerObservable.add((function(t){e._doPicking(t)})),this._utilityLayer.utilityLayerScene.autoClear=!1,this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil=!1,new h.HemisphericLight("hemi",h.Vector3.Up(),this._utilityLayer.utilityLayerScene)}return Object.defineProperty(t.prototype,"scene",{get:function(){return this._scene},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"utilityLayer",{get:function(){return this._utilityLayer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"controlScaling",{get:function(){return this._customControlScaling},set:function(t){if(this._customControlScaling!==t&&t>0){var e=t/this._customControlScaling;this._customControlScaling=t,this._rootContainer.children.forEach((function(i){i.scaling.scaleInPlace(e),1!==t&&(i._isScaledByManager=!0)}))}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useRealisticScaling",{get:function(){return this.controlScaling===t.MRTK_REALISTIC_SCALING},set:function(e){this.controlScaling=e?t.MRTK_REALISTIC_SCALING:1},enumerable:!1,configurable:!0}),t.prototype._handlePointerOut=function(t,e){var i=this._lastControlOver[t];i&&(i._onPointerOut(i),delete this._lastControlOver[t]),e&&this._lastControlDown[t]&&(this._lastControlDown[t].forcePointerUp(),delete this._lastControlDown[t]),this.onPickedPointChangedObservable.notifyObservers(null)},t.prototype._doPicking=function(t){var e,i,o;if(!this._utilityLayer||!this._utilityLayer.shouldRender||!this._utilityLayer.utilityLayerScene.activeCamera)return!1;var n=t.event,r=n.pointerId||0,a=n.button,s=t.pickInfo;if(s&&this.onPickingObservable.notifyObservers(s.pickedMesh),!s||!s.hit)return this._handlePointerOut(r,t.type===h.PointerEventTypes.POINTERUP),!1;s.pickedPoint&&this.onPickedPointChangedObservable.notifyObservers(s.pickedPoint);var l=null===(i=null===(e=s.pickedMesh.reservedDataStore)||void 0===e?void 0:e.GUI3D)||void 0===i?void 0:i.control;return l&&!l._processObservables(t.type,s.pickedPoint,(null===(o=s.originMesh)||void 0===o?void 0:o.position)||null,r,a)&&t.type===h.PointerEventTypes.POINTERMOVE&&(this._lastControlOver[r]&&this._lastControlOver[r]._onPointerOut(this._lastControlOver[r]),delete this._lastControlOver[r]),t.type===h.PointerEventTypes.POINTERUP&&(this._lastControlDown[n.pointerId]&&(this._lastControlDown[n.pointerId].forcePointerUp(),delete this._lastControlDown[n.pointerId]),("touch"===n.pointerType||"xr"===n.pointerType&&this._scene.getEngine().hostInformation.isMobile)&&this._handlePointerOut(r,!1)),!0},Object.defineProperty(t.prototype,"rootContainer",{get:function(){return this._rootContainer},enumerable:!1,configurable:!0}),t.prototype.containsControl=function(t){return this._rootContainer.containsControl(t)},t.prototype.addControl=function(t){return this._rootContainer.addControl(t),1!==this._customControlScaling&&(t.scaling.scaleInPlace(this._customControlScaling),t._isScaledByManager=!0),this},t.prototype.removeControl=function(t){return this._rootContainer.removeControl(t),t._isScaledByManager&&(t.scaling.scaleInPlace(1/this._customControlScaling),t._isScaledByManager=!1),this},t.prototype.dispose=function(){for(var t in this._rootContainer.dispose(),this._sharedMaterials)Object.prototype.hasOwnProperty.call(this._sharedMaterials,t)&&this._sharedMaterials[t].dispose();for(var t in this._sharedMaterials={},this._touchSharedMaterials)Object.prototype.hasOwnProperty.call(this._touchSharedMaterials,t)&&this._touchSharedMaterials[t].dispose();this._touchSharedMaterials={},this._pointerOutObserver&&this._utilityLayer&&(this._utilityLayer.onPointerOutObservable.remove(this._pointerOutObserver),this._pointerOutObserver=null),this.onPickedPointChangedObservable.clear(),this.onPickingObservable.clear();var 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()},t.MRTK_REALISTIC_SCALING=.032,t}(),le=void 0!==o.g?o.g:"undefined"!=typeof window?window:void 0;void 0!==le&&(le.BABYLON=le.BABYLON||{},le.BABYLON.GUI||(le.BABYLON.GUI=t));const _e=e})(),n.default})()));
|
2
2
|
//# sourceMappingURL=babylon.gui.min.js.map
|