text: !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,(function(t){return function(t){var e={};function i(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)i.d(n,o,function(e){return t[e]}.bind(null,o));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=2)}([function(e,i){e.exports=t},function(t,e,i){"use strict";i.r(e),i.d(e,"Button",(function(){return O})),i.d(e,"Checkbox",(function(){return C})),i.d(e,"ColorPicker",(function(){return S})),i.d(e,"Container",(function(){return m})),i.d(e,"Control",(function(){return g})),i.d(e,"Ellipse",(function(){return w})),i.d(e,"FocusableButton",(function(){return M})),i.d(e,"Grid",(function(){return R})),i.d(e,"Image",(function(){return P})),i.d(e,"InputText",(function(){return I})),i.d(e,"InputPassword",(function(){return E})),i.d(e,"Line",(function(){return D})),i.d(e,"MultiLine",(function(){return F})),i.d(e,"RadioButton",(function(){return N})),i.d(e,"StackPanel",(function(){return B})),i.d(e,"SelectorGroup",(function(){return z})),i.d(e,"CheckboxGroup",(function(){return Q})),i.d(e,"RadioGroup",(function(){return V})),i.d(e,"SliderGroup",(function(){return j})),i.d(e,"SelectionPanel",(function(){return W})),i.d(e,"ScrollViewer",(function(){return X})),i.d(e,"TextWrapping",(function(){return v})),i.d(e,"TextBlock",(function(){return x})),i.d(e,"TextWrapper",(function(){return T})),i.d(e,"ToggleButton",(function(){return Y})),i.d(e,"KeyPropertySet",(function(){return Z})),i.d(e,"VirtualKeyboard",(function(){return K})),i.d(e,"Rectangle",(function(){return y})),i.d(e,"DisplayGrid",(function(){return q})),i.d(e,"BaseSlider",(function(){return k})),i.d(e,"Slider",(function(){return A})),i.d(e,"ImageBasedSlider",(function(){return J})),i.d(e,"ScrollBar",(function(){return G})),i.d(e,"ImageScrollBar",(function(){return U})),i.d(e,"name",(function(){return $})),i.d(e,"AdvancedDynamicTexture",(function(){return et})),i.d(e,"AdvancedDynamicTextureInstrumentation",(function(){return it})),i.d(e,"Vector2WithInfo",(function(){return p})),i.d(e,"Matrix2D",(function(){return b})),i.d(e,"Measure",(function(){return f})),i.d(e,"MultiLinePoint",(function(){return L})),i.d(e,"Style",(function(){return tt})),i.d(e,"ValueAndUnit",(function(){return _})),i.d(e,"XmlLoader",(function(){return nt})),i.d(e,"AbstractButton3D",(function(){return st})),i.d(e,"Button3D",(function(){return lt})),i.d(e,"Container3D",(function(){return _t})),i.d(e,"Control3D",(function(){return rt})),i.d(e,"CylinderPanel",(function(){return ct})),i.d(e,"HolographicButton",(function(){return bt})),i.d(e,"HolographicSlate",(function(){return Nt})),i.d(e,"HandMenu",(function(){return At})),i.d(e,"MeshButton3D",(function(){return zt})),i.d(e,"NearMenu",(function(){return Qt})),i.d(e,"PlanePanel",(function(){return Vt})),i.d(e,"ScatterPanel",(function(){return jt})),i.d(e,"Slider3D",(function(){return ee})),i.d(e,"SpherePanel",(function(){return ie})),i.d(e,"StackPanel3D",(function(){return ne})),i.d(e,"TouchButton3D",(function(){return xt})),i.d(e,"TouchMeshButton3D",(function(){return oe})),i.d(e,"TouchHolographicButton",(function(){return Pt})),i.d(e,"TouchHolographicMenu",(function(){return kt})),i.d(e,"TouchToggleButton3D",(function(){return re})),i.d(e,"VolumeBasedPanel",(function(){return ht})),i.d(e,"HolographicBackplate",(function(){return ae})),i.d(e,"FluentMaterialDefines",(function(){return ft})),i.d(e,"FluentMaterial",(function(){return pt})),i.d(e,"FluentButtonMaterial",(function(){return yt})),i.d(e,"FluentBackplateMaterial",(function(){return Ft})),i.d(e,"HandleMaterial",(function(){return Tt})),i.d(e,"MRDLSliderBarMaterial",(function(){return Ut})),i.d(e,"MRDLSliderThumbMaterial",(function(){return Kt})),i.d(e,"MRDLBackplateMaterial",(function(){return te})),i.d(e,"SlateGizmo",(function(){return wt})),i.d(e,"HandleState",(function(){return Ct})),i.d(e,"GizmoHandle",(function(){return It})),i.d(e,"SideHandle",(function(){return Rt})),i.d(e,"CornerHandle",(function(){return St})),i.d(e,"GUI3DManager",(function(){return se})),i.d(e,"Vector3WithInfo",(function(){return ot}));
  /*! *****************************************************************************
  Copyright (c) Microsoft Corporation.
  
  Permission to use, copy, modify, and/or distribute this software for any
  purpose with or without fee is hereby granted.
  
  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  PERFORMANCE OF THIS SOFTWARE.
  ***************************************************************************** */
  var n=function(t,e){return(n=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])})(t,e)};function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function r(t,e,i,n){var o,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(r<3?o(a):r>3?o(e,i,a):o(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a}function a(t,e,i,n){return new(i||(i=Promise))((function(o,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function s(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,s)}l((n=n.apply(t,e||[])).next())}))}function s(t,e){var i,n,o,r,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[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(r){return function(s){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,n&&(o=2&r[0]?n.return:r[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,r[1])).done)return o;switch(n=0,o&&(r=[2&r[0],o.value]),r[0]){case 0:case 1:o=r;break;case 4:return a.label++,{value:r[1],done:!1};case 5:a.label++,n=r[1],r=[0];continue;case 7:r=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]<o[3])){a.label=r[1];break}if(6===r[0]&&a.label<o[1]){a.label=o[1],o=r;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(r);break}o[2]&&a.ops.pop(),a.trys.pop();continue}r=e.call(t,a)}catch(t){r=[6,t],n=0}finally{i=o=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,s])}}}Object.create;Object.create;var l=i(0),_=function(){function t(e,i,n){void 0===i&&(i=t.UNITMODE_PIXEL),void 0===n&&(n=!0),this.unit=i,this.negativeValueAllowed=n,this._value=1,this.ignoreAdaptiveScaling=!1,this._value=e,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}),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},t.prototype.getValue=function(e){if(e&&!this.ignoreAdaptiveScaling&&this.unit!==t.UNITMODE_PERCENTAGE){var i=0,n=0;if(e.idealWidth&&(i=this._value*e.getSize().width/e.idealWidth),e.idealHeight&&(n=this._value*e.getSize().height/e.idealHeight),e.useSmallestIdeal&&e.idealWidth&&e.idealHeight)return window.innerWidth<window.innerHeight?i:n;if(e.idealWidth)return i;if(e.idealHeight)return n}return this._value},t.prototype.toString=function(e,i){switch(this.unit){case t.UNITMODE_PERCENTAGE:var n=100*this.getValue(e);return(i?n.toFixed(i):n)+"%";case t.UNITMODE_PIXEL:var o=this.getValue(e);return(i?o.toFixed(i):o)+"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 n=parseFloat(i[1]),o=this._originalUnit;if(this.negativeValueAllowed||n<0&&(n=0),4===i.length)switch(i[3]){case"px":o=t.UNITMODE_PIXEL;break;case"%":o=t.UNITMODE_PERCENTAGE,n/=100}return(n!==this._value||o!==this.unit)&&(this._value=n,this.unit=o,!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}(),h=[new l.Vector2(0,0),new l.Vector2(0,0),new l.Vector2(0,0),new l.Vector2(0,0)],c=[new l.Vector2(0,0),new l.Vector2(0,0),new l.Vector2(0,0),new l.Vector2(0,0)],u=new l.Vector2(0,0),d=new l.Vector2(0,0),f=function(){function t(t,e,i,n){this.left=t,this.top=e,this.width=i,this.height=n}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,n){this.left=t,this.top=e,this.width=i,this.height=n},t.CombineToRef=function(t,e,i){var n=Math.min(t.left,e.left),o=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=n,i.top=o,i.width=r-n,i.height=a-o},t.prototype.addAndTransformToRef=function(t,e,i,n,o,r){var a=this.left+e,s=this.top+i,l=this.width+n,_=this.height+o;h[0].copyFromFloats(a,s),h[1].copyFromFloats(a+l,s),h[2].copyFromFloats(a+l,s+_),h[3].copyFromFloats(a,s+_),u.copyFromFloats(Number.MAX_VALUE,Number.MAX_VALUE),d.copyFromFloats(0,0);for(var f=0;f<4;f++)t.transformCoordinates(h[f].x,h[f].y,c[f]),u.x=Math.floor(Math.min(u.x,c[f].x)),u.y=Math.floor(Math.min(u.y,c[f].y)),d.x=Math.ceil(Math.max(d.x,c[f].x)),d.y=Math.ceil(Math.max(d.y,c[f].y));r.left=u.x,r.top=u.y,r.width=d.x-u.x,r.height=d.y-u.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}(),p=function(t){function e(e,i){void 0===i&&(i=0);var n=t.call(this,e.x,e.y)||this;return n.buttonIndex=i,n}return o(e,t),e}(l.Vector2),b=function(){function t(t,e,i,n,o,r){this.m=new Float32Array(6),this.fromValues(t,e,i,n,o,r)}return t.prototype.fromValues=function(t,e,i,n,o,r){return this.m[0]=t,this.m[1]=e,this.m[2]=i,this.m[3]=n,this.m[4]=o,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],n=this.m[2],o=this.m[3],r=this.m[4],a=this.m[5],s=this.determinant();if(s<l.Epsilon*l.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 _=1/s,h=n*a-o*r,c=i*r-e*a;return t.m[0]=o*_,t.m[1]=-i*_,t.m[2]=-n*_,t.m[3]=e*_,t.m[4]=h*_,t.m[5]=c*_,this},t.prototype.multiplyToRef=function(t,e){var i=this.m[0],n=this.m[1],o=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+n*h,e.m[1]=i*_+n*c,e.m[2]=o*l+r*h,e.m[3]=o*_+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.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),n=Math.cos(t);e.fromValues(n,i,-i,n,0,0)},t.ComposeToRef=function(e,i,n,o,r,a,s){t.TranslationToRef(e,i,t._TempPreTranslationMatrix),t.ScalingToRef(o,r,t._TempScalingMatrix),t.RotationToRef(n,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}(),g=function(){function t(e){this.name=e,this._alpha=1,this._alphaSet=!1,this._zIndex=0,this._currentMeasure=f.Empty(),this._fontFamily="Arial",this._fontStyle="",this._fontWeight="",this._fontSize=new _(18,_.UNITMODE_PIXEL,!1),this._width=new _(1,_.UNITMODE_PERCENTAGE,!1),this._height=new _(1,_.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=f.Empty(),this._prevCurrentMeasureTransformedIntoGlobalSpace=f.Empty(),this._cachedParentMeasure=f.Empty(),this._paddingLeft=new _(0),this._paddingRight=new _(0),this._paddingTop=new _(0),this._paddingBottom=new _(0),this._left=new _(0),this._top=new _(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=l.Vector2.Zero(),this._isMatrixDirty=!0,this._isVisible=!0,this._isHighlighted=!1,this._highlightColor="#4affff",this._highlightLineWidth=2,this._fontSet=!1,this._dummyVector2=l.Vector2.Zero(),this._downCount=0,this._enterCount=-1,this._doNotRender=!1,this._downPointerIds={},this._evaluatedMeasure=new f(0,0,0,0),this._evaluatedParentMeasure=new f(0,0,0,0),this._isEnabled=!0,this._disabledColor="#9a9a9a",this._disabledColorItem="#6a6a6a",this._isReadOnly=!1,this._rebuildLayout=!1,this._customData={},this._isClipped=!1,this._automaticSize=!1,this.metadata=null,this.isHitTestVisible=!0,this.isPointerBlocker=!1,this.isFocusInvisible=!1,this.clipChildren=!0,this.clipContent=!0,this.useBitmapCache=!1,this._shadowOffsetX=0,this._shadowOffsetY=0,this._shadowBlur=0,this._previousShadowBlur=0,this._shadowColor="black",this.hoverCursor="",this._linkOffsetX=new _(0),this._linkOffsetY=new _(0),this.onWheelObservable=new l.Observable,this.onPointerMoveObservable=new l.Observable,this.onPointerOutObservable=new l.Observable,this.onPointerDownObservable=new l.Observable,this.onPointerUpObservable=new l.Observable,this.onPointerClickObservable=new l.Observable,this.onPointerEnterObservable=new l.Observable,this.onDirtyObservable=new l.Observable,this.onBeforeDrawObservable=new l.Observable,this.onAfterDrawObservable=new l.Observable,this.onDisposeObservable=new l.Observable,this.fixedRatio=0,this._fixedRatioMasterIsWidth=!0,this._tmpMeasureA=new f(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,"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,"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,"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))},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,"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,"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,"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,"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,"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){this._isEnabled!==t&&(this._isEnabled=t,this._markAsDirty())},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._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=l.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=l.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 n=this._host._getGlobalViewport(),o=l.Vector3.Project(e,l.Matrix.Identity(),i.getTransformMatrix(),n);this._moveToProjectedPosition(o),o.z<0||o.z>1?this.notRenderable=!0:this.notRenderable=!1}else l.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&&l.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,n){var o=t,r=null!=e?e:o,a=null!=i?i:o,s=null!=n?n:r;this.paddingTop=o,this.paddingRight=r,this.paddingBottom=a,this.paddingLeft=s},t.prototype.setPaddingInPixels=function(t,e,i,n){var o=t,r=null!=e?e:o,a=null!=i?i:o,s=null!=n?n:r;this.paddingTopInPixels=o,this.paddingRightInPixels=r,this.paddingBottomInPixels=a,this.paddingLeftInPixels=s},t.prototype._moveToProjectedPosition=function(t){var e,i=this._left.getValue(this._host),n=this._top.getValue(this._host);if(0===this._currentMeasure.width&&0===this._currentMeasure.height){var o=null===(e=this.parent)||void 0===e?void 0:e._currentMeasure;o&&this._processMeasures(o,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-n)<.5&&(a=n)),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){return this._currentMeasure.transformToRef(this._transformMatrix,this._tmpMeasureA),!(this._tmpMeasureA.left>=t.left+t.width)&&(!(this._tmpMeasureA.top>=t.top+t.height)&&(!(this._tmpMeasureA.left+this._tmpMeasureA.width<=t.left)&&!(this._tmpMeasureA.top+this._tmpMeasureA.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),f.CombineToRef(this._tmpMeasureA,this._prevCurrentMeasureTransformedIntoGlobalSpace,this._tmpMeasureA);var t=this.shadowOffsetX,e=this.shadowOffsetY,i=Math.max(this._previousShadowBlur,this.shadowBlur),n=Math.min(Math.min(t,0)-2*i,0),o=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+n-s),Math.floor(this._tmpMeasureA.top+r-l),Math.ceil(this._tmpMeasureA.left+this._tmpMeasureA.width+o+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._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))}},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._applyStates=function(e){this._isFontSizeInPercentage&&(this._fontSet=!0),this._fontSet&&(this._prepareFont(),this._fontSet=!1),this._font&&(e.font=this._font),this._color&&(e.fillStyle=this._color),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&&l.Logger.Error("Layout cycle detected in GUI (Control name="+this.name+", uniqueId="+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._currentMeasure.copyFrom(t),this._preMeasure(t,e),this._measure(),this._computeAlignment(t,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(t,e),this._cachedParentMeasure.copyFrom(t),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 n=this._currentMeasure.width,o=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-n;break;case t.HORIZONTAL_ALIGNMENT_CENTER:s=(r-n)/2}switch(this.verticalAlignment){case t.VERTICAL_ALIGNMENT_TOP:l=0;break;case t.VERTICAL_ALIGNMENT_BOTTOM:l=a-o;break;case t.VERTICAL_ALIGNMENT_CENTER:l=(a-o)/2}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 n=new f(0,0,0,0);n.left=Math.max(this._tmpMeasureA.left,this._currentMeasure.left),n.top=Math.max(this._tmpMeasureA.top,this._currentMeasure.top),n.width=Math.min(this._tmpMeasureA.left+this._tmpMeasureA.width,this._currentMeasure.left+this._currentMeasure.width)-n.left,n.height=Math.min(this._tmpMeasureA.top+this._tmpMeasureA.height,this._currentMeasure.top+this._currentMeasure.height)-n.top,t._ClipMeasure.copyFrom(n)}if(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY){var o=this.shadowOffsetX,r=this.shadowOffsetY,a=this.shadowBlur,s=Math.min(Math.min(o,0)-2*a,0),l=Math.max(Math.max(o,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,n,o,r,a,s){return!!this._isEnabled&&(!(!this.isHitTestVisible||!this.isVisible||this._doNotRender)&&(!!this.contains(t,e)&&(this._processObservables(n,t,e,i,o,r,a,s),!0)))},t.prototype._onPointerMove=function(t,e,i,n){this.onPointerMoveObservable.notifyObservers(e,-1,t,this,n)&&null!=this.parent&&this.parent._onPointerMove(t,e,i,n)},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.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 n=!0;t.isAscendant(this)||(n=this.onPointerOutObservable.notifyObservers(this,-1,t,this,e)),n&&null!=this.parent&&this.parent._onPointerOut(t,e,i)}},t.prototype._onPointerDown=function(t,e,i,n,o){return this._onPointerEnter(this,o),0===this._downCount&&(this._downCount++,this._downPointerIds[i]=!0,this.onPointerDownObservable.notifyObservers(new p(e,n),-1,t,this,o)&&null!=this.parent&&this.parent._onPointerDown(t,e,i,n,o),!0)},t.prototype._onPointerUp=function(t,e,i,n,o,r){if(this._isEnabled){this._downCount=0,delete this._downPointerIds[i];var a=o;o&&(this._enterCount>0||-1===this._enterCount)&&(a=this.onPointerClickObservable.notifyObservers(new p(e,n),-1,t,this,r)),this.onPointerUpObservable.notifyObservers(new p(e,n),-1,t,this,r)&&null!=this.parent&&this.parent._onPointerUp(t,e,i,n,a,r)}},t.prototype._forcePointerUp=function(t){if(void 0===t&&(t=null),null!==t)this._onPointerUp(this,l.Vector2.Zero(),t,0,!0);else for(var e in this._downPointerIds)this._onPointerUp(this,l.Vector2.Zero(),+e,0,!0)},t.prototype._onWheelScroll=function(t,e){this._isEnabled&&(this.onWheelObservable.notifyObservers(new l.Vector2(t,e))&&null!=this.parent&&this.parent._onWheelScroll(t,e))},t.prototype._onCanvasBlur=function(){},t.prototype._processObservables=function(t,e,i,n,o,r,a,s){if(!this._isEnabled)return!1;if(this._dummyVector2.copyFromFloats(e,i),t===l.PointerEventTypes.POINTERMOVE){this._onPointerMove(this,this._dummyVector2,o,n);var _=this._host._lastControlOver[o];return _&&_!==this&&_._onPointerOut(this,n),_!==this&&this._onPointerEnter(this,n),this._host._lastControlOver[o]=this,!0}return t===l.PointerEventTypes.POINTERDOWN?(this._onPointerDown(this,this._dummyVector2,o,r,n),this._host._registerLastControlDown(this,o),this._host._lastPickedControl=this,!0):t===l.PointerEventTypes.POINTERUP?(this._host._lastControlDown[o]&&this._host._lastControlDown[o]._onPointerUp(this,this._dummyVector2,o,r,!0,n),delete this._host._lastControlDown[o],!0):!(t!==l.PointerEventTypes.POINTERWHEEL||!this._host._lastControlOver[o])&&(this._host._lastControlOver[o]._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.serialize=function(t){l.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)},t.prototype._parseFromContent=function(t,e){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.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=l.Engine.LastCreatedEngine;if(!i)throw new Error("Invalid engine. Unable to create a canvas.");var n=i.getFontOffset(e);return t._FontHeightSizes[e]=n,n},t.Parse=function(t,e){var i=l.Tools.Instantiate("BABYLON.GUI."+t.className),n=l.SerializationHelper.Parse((function(){return new i}),t,null);return n.name=t.name,n._parseFromContent(t,e),n},t.drawEllipse=function(t,e,i,n,o){o.translate(t,e),o.scale(i,n),o.beginPath(),o.arc(0,0,1,0,2*Math.PI),o.closePath(),o.scale(1/i,1/n),o.translate(-t,-e)},t.AllowAlphaInheritance=!1,t._ClipMeasure=new f(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(){},r([Object(l.serialize)()],t.prototype,"metadata",void 0),r([Object(l.serialize)()],t.prototype,"isHitTestVisible",void 0),r([Object(l.serialize)()],t.prototype,"isPointerBlocker",void 0),r([Object(l.serialize)()],t.prototype,"isFocusInvisible",void 0),r([Object(l.serialize)()],t.prototype,"clipChildren",void 0),r([Object(l.serialize)()],t.prototype,"clipContent",void 0),r([Object(l.serialize)()],t.prototype,"useBitmapCache",void 0),r([Object(l.serialize)()],t.prototype,"shadowOffsetX",null),r([Object(l.serialize)()],t.prototype,"shadowOffsetY",null),r([Object(l.serialize)()],t.prototype,"shadowBlur",null),r([Object(l.serialize)()],t.prototype,"shadowColor",null),r([Object(l.serialize)()],t.prototype,"hoverCursor",void 0),r([Object(l.serialize)()],t.prototype,"fontOffset",null),r([Object(l.serialize)()],t.prototype,"alpha",null),r([Object(l.serialize)()],t.prototype,"scaleX",null),r([Object(l.serialize)()],t.prototype,"scaleY",null),r([Object(l.serialize)()],t.prototype,"rotation",null),r([Object(l.serialize)()],t.prototype,"transformCenterY",null),r([Object(l.serialize)()],t.prototype,"transformCenterX",null),r([Object(l.serialize)()],t.prototype,"horizontalAlignment",null),r([Object(l.serialize)()],t.prototype,"verticalAlignment",null),r([Object(l.serialize)()],t.prototype,"fixedRatio",void 0),r([Object(l.serialize)()],t.prototype,"width",null),r([Object(l.serialize)()],t.prototype,"height",null),r([Object(l.serialize)()],t.prototype,"style",null),r([Object(l.serialize)()],t.prototype,"color",null),r([Object(l.serialize)()],t.prototype,"zIndex",null),r([Object(l.serialize)()],t.prototype,"notRenderable",null),r([Object(l.serialize)()],t.prototype,"isVisible",null),r([Object(l.serialize)()],t.prototype,"paddingLeft",null),r([Object(l.serialize)()],t.prototype,"paddingRight",null),r([Object(l.serialize)()],t.prototype,"paddingTop",null),r([Object(l.serialize)()],t.prototype,"paddingBottom",null),r([Object(l.serialize)()],t.prototype,"left",null),r([Object(l.serialize)()],t.prototype,"top",null),r([Object(l.serialize)()],t.prototype,"linkOffsetX",null),r([Object(l.serialize)()],t.prototype,"linkOffsetY",null),r([Object(l.serialize)()],t.prototype,"isEnabled",null),r([Object(l.serialize)()],t.prototype,"disabledColor",null),r([Object(l.serialize)()],t.prototype,"disabledColorItem",null),r([Object(l.serialize)()],t.prototype,"overlapGroup",void 0),r([Object(l.serialize)()],t.prototype,"overlapDeltaMultiplier",void 0),t}();Object(l.RegisterClass)("BABYLON.GUI.Control",g);var m=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._children=new Array,i._measureForChildren=f.Empty(),i._background="",i._adaptWidthToChildren=!1,i._adaptHeightToChildren=!1,i._renderToIntermediateTexture=!1,i._intermediateTexture=null,i.logLayoutCycleErrors=!1,i.maxLayoutCycle=3,i}return o(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,"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++){e[t]._markMatrixAsDirty()}},e.prototype.getChildByName=function(t){for(var e=0,i=this.children;e<i.length;e++){var n=i[e];if(n.name===t)return n}return null},e.prototype.getChildByType=function(t,e){for(var i=0,n=this.children;i<n.length;i++){var o=n[i];if(o.typeName===e)return o}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):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},e.prototype._reOrderControl=function(t){this.removeControl(t);for(var e=!1,i=0;i<this._children.length;i++)if(this._children[i].zIndex>t.zIndex){this._children.splice(i,0,t),e=!0;break}e||this._children.push(t),t.parent=this,this._markAsDirty()},e.prototype._offsetLeft=function(e){t.prototype._offsetLeft.call(this,e);for(var i=0,n=this._children;i<n.length;i++){n[i]._offsetLeft(e)}},e.prototype._offsetTop=function(e){t.prototype._offsetTop.call(this,e);for(var i=0,n=this._children;i<n.length;i++){n[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._localDraw=function(t){this._background&&(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._background,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,n=this._children;i<n.length;i++){n[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 l.DynamicTexture("",{width:this._currentMeasure.width,height:this._currentMeasure.height},this._host.getScene(),!1,l.Texture.NEAREST_SAMPLINGMODE,l.Constants.TEXTUREFORMAT_RGBA,!1),this._intermediateTexture.hasAlpha=!0)))},e.prototype._layout=function(t,e){var i,n;if(!this.isDirty&&(!this.isVisible||this.notRenderable))return!1;this.host._numLayoutCalls++,this._isDirty&&this._currentMeasure.transformToRef(this._transformMatrix,this._prevCurrentMeasureTransformedIntoGlobalSpace);var o=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,_=this._children;s<_.length;s++){var h=_[s];h._tempParentMeasure.copyFrom(this._measureForChildren),h._layout(this._measureForChildren,e)&&(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._rebuildLayout=!0)),this.adaptHeightToChildren&&a>=0&&(a+=this.paddingTopInPixels+this.paddingBottomInPixels,this.height!==a+"px"&&(null===(n=this.parent)||void 0===n||n._markAsDirty(),this.height=a+"px",this._rebuildLayout=!0)),this._postMeasure()}o++}while(this._rebuildLayout&&o<this.maxLayoutCycle);return o>=3&&this.logLayoutCycleErrors&&l.Logger.Error("Layout cycle detected in GUI (Container name="+this.name+", uniqueId="+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,n=i?this._intermediateTexture.getContext():t;i&&(n.save(),n.translate(-this._currentMeasure.left,-this._currentMeasure.top),e?n.clearRect(e.left,e.top,e.width,e.height):n.clearRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),this._localDraw(n),t.save(),this.clipChildren&&this._clipForChildren(n);for(var o=0,r=this._children;o<r.length;o++){var a=r[o];e&&!a._intersectsRect(e)||a._render(n,e)}i&&(n.restore(),t.save(),t.globalAlpha=this.alpha,t.drawImage(n.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 n=0;n<this.children.length;n++){var o=this.children[n];i&&!i(o)||t.push(o),e||o.getDescendantsToRef(t,!1,i)}},e.prototype._processPicking=function(e,i,n,o,r,a,s,l){if(!this._isEnabled||!this.isVisible||this.notRenderable)return!1;if(!t.prototype.contains.call(this,e,i))return!1;for(var _=this._children.length-1;_>=0;_--){var h=this._children[_];if(h._processPicking(e,i,n,o,r,a,s,l))return h.hoverCursor&&this._host._changeCursor(h.hoverCursor),!0}return!!this.isHitTestVisible&&this._processObservables(o,e,i,n,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.children.length){e.children=[];for(var i=0,n=this.children;i<n.length;i++){var o={};n[i].serialize(o),e.children.push(o)}}},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){if(t.prototype._parseFromContent.call(this,e,i),this._link(i),e.children)for(var n=0,o=e.children;n<o.length;n++){var r=o[n];this.addControl(g.Parse(r,i))}},r([Object(l.serialize)()],e.prototype,"renderToIntermediateTexture",null),r([Object(l.serialize)()],e.prototype,"maxLayoutCycle",void 0),r([Object(l.serialize)()],e.prototype,"adaptHeightToChildren",null),r([Object(l.serialize)()],e.prototype,"adaptWidthToChildren",null),r([Object(l.serialize)()],e.prototype,"background",null),e}(g);Object(l.RegisterClass)("BABYLON.GUI.Container",m);var v,y=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._thickness=1,i._cornerRadius=0,i}return o(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._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&&(t.fillStyle="Button"===this.typeName?this.isEnabled?this._background:this.disabledColor:this._background,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&&(t.strokeStyle=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,n=this._currentMeasure.top+e,o=this._currentMeasure.width-2*e,r=this._currentMeasure.height-2*e,a=Math.min(r/2-2,Math.min(o/2-2,this._cornerRadius));t.beginPath(),t.moveTo(i+a,n),t.lineTo(i+o-a,n),t.quadraticCurveTo(i+o,n,i+o,n+a),t.lineTo(i+o,n+r-a),t.quadraticCurveTo(i+o,n+r,i+o-a,n+r),t.lineTo(i+a,n+r),t.quadraticCurveTo(i,n+r,i,n+r-a),t.lineTo(i,n+a),t.quadraticCurveTo(i,n,i+a,n),t.closePath()},e.prototype._clipForChildren=function(t){this._cornerRadius&&(this._drawRoundedRect(t,this._thickness),t.clip())},r([Object(l.serialize)()],e.prototype,"thickness",null),r([Object(l.serialize)()],e.prototype,"cornerRadius",null),e}(m);Object(l.RegisterClass)("BABYLON.GUI.Rectangle",y),function(t){t[t.Clip=0]="Clip",t[t.WordWrap=1]="WordWrap",t[t.Ellipsis=2]="Ellipsis"}(v||(v={}));var x=function(t){function e(e,i){void 0===i&&(i="");var n=t.call(this,e)||this;return n.name=e,n._text="",n._textWrapping=v.Clip,n._textHorizontalAlignment=g.HORIZONTAL_ALIGNMENT_CENTER,n._textVerticalAlignment=g.VERTICAL_ALIGNMENT_CENTER,n._resizeToFit=!1,n._lineSpacing=new _(0),n._outlineWidth=0,n._outlineColor="white",n._underline=!1,n._lineThrough=!1,n.onTextChangedObservable=new l.Observable,n.onLinesReadyObservable=new l.Observable,n.text=i,n}return o(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}),e.prototype._getTypeName=function(){return"TextBlock"},e.prototype._processMeasures=function(e,i){this._fontOffset&&!this.isDirty||(this._fontOffset=g._GetFontOffset(i.font)),t.prototype._processMeasures.call(this,e,i),this._lines=this._breakLines(this._currentMeasure.width,i),this.onLinesReadyObservable.notifyObservers(this);for(var n=0,o=0;o<this._lines.length;o++){var r=this._lines[o];r.width>n&&(n=r.width)}if(this._resizeToFit){if(this._textWrapping===v.Clip){var a=this.paddingLeftInPixels+this.paddingRightInPixels+n|0;a!==this._width.internalValue&&(this._width.updateInPlace(a,_.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=0;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,_.UNITMODE_PIXEL),this._rebuildLayout=!0)}},e.prototype._drawText=function(t,e,i,n){var o=this._currentMeasure.width,r=0;switch(this._textHorizontalAlignment){case g.HORIZONTAL_ALIGNMENT_LEFT:r=0;break;case g.HORIZONTAL_ALIGNMENT_RIGHT:r=o-e;break;case g.HORIZONTAL_ALIGNMENT_CENTER:r=(o-e)/2}(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(n.shadowColor=this.shadowColor,n.shadowBlur=this.shadowBlur,n.shadowOffsetX=this.shadowOffsetX,n.shadowOffsetY=this.shadowOffsetY),this.outlineWidth&&n.strokeText(t,this._currentMeasure.left+r,i),n.fillText(t,this._currentMeasure.left+r,i),this._underline&&(n.beginPath(),n.lineWidth=Math.round(.05*this.fontSizeInPixels),n.moveTo(this._currentMeasure.left+r,i+3),n.lineTo(this._currentMeasure.left+r+e,i+3),n.stroke(),n.closePath()),this._lineThrough&&(n.beginPath(),n.lineWidth=Math.round(.05*this.fontSizeInPixels),n.moveTo(this._currentMeasure.left+r,i-this.fontSizeInPixels/3),n.lineTo(this._currentMeasure.left+r+e,i-this.fontSizeInPixels/3),n.stroke(),n.closePath())},e.prototype._draw=function(t,e){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){var i=[],n=this.text.split("\n");if(this._textWrapping===v.Ellipsis)for(var o=0,r=n;o<r.length;o++){var a=r[o];i.push(this._parseLineEllipsis(a,t,e))}else if(this._textWrapping===v.WordWrap)for(var s=0,l=n;s<l.length;s++){a=l[s];i.push.apply(i,this._parseLineWordWrap(a,t,e))}else for(var _=0,h=n;_<h.length;_++){a=h[_];i.push(this._parseLine(a,e))}return i},e.prototype._parseLine=function(t,e){void 0===t&&(t="");var i=e.measureText(t);return{text:t,width:Math.abs(i.actualBoundingBoxLeft)+Math.abs(i.actualBoundingBoxRight)}},e.prototype._parseLineEllipsis=function(t,e,i){void 0===t&&(t="");var n=i.measureText(t),o=Math.abs(n.actualBoundingBoxLeft)+Math.abs(n.actualBoundingBoxRight);o>e&&(t+="…");var r=Array.from&&Array.from(t);if(r)for(;r.length&&o>e;)r.pop(),t=r.join("")+"...",n=i.measureText(t),o=Math.abs(n.actualBoundingBoxLeft)+Math.abs(n.actualBoundingBoxRight);else for(;t.length>2&&o>e;)t=t.slice(0,-2)+"…",n=i.measureText(t),o=Math.abs(n.actualBoundingBoxLeft)+Math.abs(n.actualBoundingBoxRight);return{text:t,width:o}},e.prototype._parseLineWordWrap=function(t,e,i){void 0===t&&(t="");for(var n=[],o=this.wordSplittingFunction?this.wordSplittingFunction(t):t.split(" "),r=i.measureText(t),a=Math.abs(r.actualBoundingBoxLeft)+Math.abs(r.actualBoundingBoxRight),s=0;s<o.length;s++){var l=s>0?t+" "+o[s]:o[0],_=i.measureText(l),h=Math.abs(_.actualBoundingBoxLeft)+Math.abs(_.actualBoundingBoxRight);h>e&&s>0?(n.push({text:t,width:a}),t=o[s],r=i.measureText(t),a=Math.abs(r.actualBoundingBoxLeft)+Math.abs(r.actualBoundingBoxRight)):(a=h,t=l)}return n.push({text:t,width:a}),n},e.prototype._renderLines=function(t){var e=this._currentMeasure.height,i=0;switch(this._textVerticalAlignment){case g.VERTICAL_ALIGNMENT_TOP:i=this._fontOffset.ascent;break;case g.VERTICAL_ALIGNMENT_BOTTOM:i=e-this._fontOffset.height*(this._lines.length-1)-this._fontOffset.descent;break;case g.VERTICAL_ALIGNMENT_CENTER:i=this._fontOffset.ascent+(e-this._fontOffset.height*this._lines.length)/2}i+=this._currentMeasure.top;for(var n=0;n<this._lines.length;n++){var o=this._lines[n];0!==n&&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(o.text,o.width,i,t),i+=this._fontOffset.height}},e.prototype.computeExpectedHeight=function(){var t;if(this.text&&this.widthInPixels){var e=null===(t=l.Engine.LastCreatedEngine)||void 0===t?void 0:t.createCanvas(0,0).getContext("2d");if(e){this._applyStates(e),this._fontOffset||(this._fontOffset=g._GetFontOffset(e.font));var i=this._lines?this._lines:this._breakLines(this.widthInPixels-this.paddingLeftInPixels-this.paddingRightInPixels,e),n=this.paddingTopInPixels+this.paddingBottomInPixels+this._fontOffset.height*i.length;if(i.length>0&&0!==this._lineSpacing.internalValue){var o=0;o=this._lineSpacing.isPixel?this._lineSpacing.getValue(this._host):this._lineSpacing.getValue(this._host)*this._height.getValueInPixel(this._host,this._cachedParentMeasure.height),n+=(i.length-1)*o}return n}}return 0},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.onTextChangedObservable.clear()},r([Object(l.serialize)()],e.prototype,"resizeToFit",null),r([Object(l.serialize)()],e.prototype,"textWrapping",null),r([Object(l.serialize)()],e.prototype,"text",null),r([Object(l.serialize)()],e.prototype,"textHorizontalAlignment",null),r([Object(l.serialize)()],e.prototype,"textVerticalAlignment",null),r([Object(l.serialize)()],e.prototype,"lineSpacing",null),r([Object(l.serialize)()],e.prototype,"outlineWidth",null),r([Object(l.serialize)()],e.prototype,"underline",null),r([Object(l.serialize)()],e.prototype,"lineThrough",null),r([Object(l.serialize)()],e.prototype,"outlineColor",null),e}(g);Object(l.RegisterClass)("BABYLON.GUI.TextBlock",x);var P=function(t){function e(i,n){void 0===n&&(n=null);var o=t.call(this,i)||this;return o.name=i,o._workingCanvas=null,o._loaded=!1,o._stretch=e.STRETCH_FILL,o._autoScale=!1,o._sourceLeft=0,o._sourceTop=0,o._sourceWidth=0,o._sourceHeight=0,o._svgAttributesComputationCompleted=!1,o._isSVG=!1,o._cellWidth=0,o._cellHeight=0,o._cellId=-1,o._populateNinePatchSlicesFromImage=!1,o._imageDataCache={data:null,key:""},o.onImageLoadedObservable=new l.Observable,o.onSVGAttributesComputedObservable=new l.Observable,o.source=n,o}return o(e,t),Object.defineProperty(e.prototype,"isLoaded",{get:function(){return this._loaded},enumerable:!1,configurable:!0}),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 n,o;void 0===i&&(i=!1);var r=this._domImage.width,a=this._domImage.height,s=(null===(o=null===(n=this._host)||void 0===n?void 0:n.getScene())||void 0===o?void 0:o.getEngine())||l.Engine.LastCreatedEngine;if(!s)throw new Error("Invalid engine. Unable to create a canvas.");var _=s.createCanvas(a,r),h=_.getContext("2d");h.translate(_.width/2,_.height/2),h.rotate(t*Math.PI/2),h.drawImage(this._domImage,0,0,r,a,-r/2,-a/2,r,a);var c=_.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 n=this;t._isSVG&&(t._svgAttributesComputationCompleted?(this._rotate90SourceProperties(t,e,i),this._markAsDirty()):t.onSVGAttributesComputedObservable.addOnce((function(){n._rotate90SourceProperties(t,e,i),n._markAsDirty()})))},e.prototype._rotate90SourceProperties=function(t,e,i){var n,o,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=(n=[u,c])[0],u=n[1],i<0?h-=u:_-=c,r=_,a=h,s=(o=[l,s])[0],l=o[1]}e.sourceLeft=_,e.sourceTop=h,e.sourceWidth=c,e.sourceHeight=u},e.prototype._extractNinePatchSliceDataFromImage=function(){var t,e,i=this._domImage.width,n=this._domImage.height;if(!this._workingCanvas){var o=(null===(e=null===(t=this._host)||void 0===t?void 0:t.getScene())||void 0===e?void 0:e.getEngine())||l.Engine.LastCreatedEngine;if(!o)throw new Error("Invalid engine. Unable to create a canvas.");this._workingCanvas=o.createCanvas(i,n)}var r=this._workingCanvas.getContext("2d");r.drawImage(this._domImage,0,0,i,n);var a=r.getImageData(0,0,i,n);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 _=0;_<n;_++){var h;if((h=a.data[_*i*4+3])>127&&-1===this._sliceTop)this._sliceTop=_;else if(h<127&&this._sliceTop>-1){this._sliceBottom=_;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 e,i,n=this;if(this._source!==t){this._loaded=!1,this._source=t,this._imageDataCache.data=null,t&&(t=this._svgCheck(t));var o=(null===(i=null===(e=this._host)||void 0===e?void 0:e.getScene())||void 0===i?void 0:i.getEngine())||l.Engine.LastCreatedEngine;if(!o)throw new Error("Invalid engine. Unable to create a canvas.");this._domImage=o.createCanvasImage(),this._domImage.onload=function(){n._onImageLoaded()},t&&(l.Tools.SetCorsBehavior(t,this._domImage),this._domImage.src=t)}},enumerable:!1,configurable:!0}),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],n=t.split("#")[1],o=document.body.querySelector('object[data="'+i+'"]');if(o){var r=o.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(n)&&a&&s&&l)return this._getSVGAttribs(o,n),t}o.addEventListener("load",(function(){e._getSVGAttribs(o,n)}))}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,n)}}return i}return t},e.prototype._getSVGAttribs=function(t,e){var i=t.contentDocument;if(i&&i.documentElement){var n=i.documentElement.getAttribute("viewBox"),o=Number(i.documentElement.getAttribute("width")),r=Number(i.documentElement.getAttribute("height")),a=i.getElementById(e);if(n&&o&&r&&a){var s=Number(n.split(" ")[2]),l=Number(n.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)*o/s,this.sourceTop=(c*_.y+d)*r/l,this.sourceWidth=_.width*h*(o/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 n=0|this._currentMeasure.width,o=0|this._currentMeasure.height,r=n+"_"+o,a=this._imageDataCache.data;if(!a||this._imageDataCache.key!==r){var s=this._workingCanvas.getContext("2d");this._imageDataCache.data=a=s.getImageData(0,0,n,o).data,this._imageDataCache.key=r}return a[4*((e=e-this._currentMeasure.left|0)+(i=i-this._currentMeasure.top|0)*n)+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,n){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,n)},e.prototype._prepareWorkingCanvasForOpaqueDetection=function(){var t,e;if(this._detectPointerOnOpaqueOnly){var i=this._currentMeasure.width,n=this._currentMeasure.height;if(!this._workingCanvas){var o=(null===(e=null===(t=this._host)||void 0===t?void 0:t.getScene())||void 0===e?void 0:e.getEngine())||l.Engine.LastCreatedEngine;if(!o)throw new Error("Invalid engine. Unable to create a canvas.");this._workingCanvas=o.createCanvas(i,n)}this._workingCanvas.getContext("2d").clearRect(0,0,i,n)}},e.prototype._drawImage=function(t,e,i,n,o,r,a,s,l){(t.drawImage(this._domImage,e,i,n,o,r,a,s,l),this._detectPointerOnOpaqueOnly)&&(t=this._workingCanvas.getContext("2d")).drawImage(this._domImage,e,i,n,o,r-this._currentMeasure.left,a-this._currentMeasure.top,s,l)},e.prototype._draw=function(t){var i,n,o,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,n=this._sourceTop,o=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,n=this.cellHeight*s,o=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,n,o,r,this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height);break;case e.STRETCH_UNIFORM:var _=this._currentMeasure.width/o,h=this._currentMeasure.height/r,c=Math.min(_,h),u=(this._currentMeasure.width-o*c)/2,d=(this._currentMeasure.height-r*c)/2;this._drawImage(t,i,n,o,r,this._currentMeasure.left+u,this._currentMeasure.top+d,o*c,r*c);break;case e.STRETCH_EXTEND:this._drawImage(t,i,n,o,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,n=this._imageHeight-this._sliceBottom,o=this._imageWidth-this._sliceRight,r=this._sliceRight-this._sliceLeft,a=this._sliceBottom-this._sliceTop,s=this._currentMeasure.width-o-e+2,l=this._currentMeasure.height-n-i+2,_=this._currentMeasure.left+e-1,h=this._currentMeasure.top+i-1,c=this._currentMeasure.left+this._currentMeasure.width-o,u=this._currentMeasure.top+this._currentMeasure.height-n;this._drawImage(t,0,0,e,i,this._currentMeasure.left,this._currentMeasure.top,e,i),this._drawImage(t,this._sliceLeft,0,r,i,_,this._currentMeasure.top,s,i),this._drawImage(t,this.sliceRight,0,o,i,c,this._currentMeasure.top,o,i),this._drawImage(t,0,this._sliceTop,e,a,this._currentMeasure.left,h,e,l),this._drawImage(t,this._sliceLeft,this._sliceTop,r,a,_,h,s,l),this._drawImage(t,this._sliceRight,this._sliceTop,o,a,c,h,o,l),this._drawImage(t,0,this._sliceBottom,e,n,this._currentMeasure.left,u,e,n),this._drawImage(t,this.sliceLeft,this._sliceBottom,r,n,_,u,s,n),this._drawImage(t,this._sliceRight,this._sliceBottom,o,n,c,u,o,n)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.onImageLoadedObservable.clear(),this.onSVGAttributesComputedObservable.clear()},e.STRETCH_NONE=0,e.STRETCH_FILL=1,e.STRETCH_UNIFORM=2,e.STRETCH_EXTEND=3,e.STRETCH_NINE_PATCH=4,r([Object(l.serialize)()],e.prototype,"detectPointerOnOpaqueOnly",null),r([Object(l.serialize)()],e.prototype,"sliceLeft",null),r([Object(l.serialize)()],e.prototype,"sliceRight",null),r([Object(l.serialize)()],e.prototype,"sliceTop",null),r([Object(l.serialize)()],e.prototype,"sliceBottom",null),r([Object(l.serialize)()],e.prototype,"sourceLeft",null),r([Object(l.serialize)()],e.prototype,"sourceTop",null),r([Object(l.serialize)()],e.prototype,"sourceWidth",null),r([Object(l.serialize)()],e.prototype,"sourceHeight",null),r([Object(l.serialize)()],e.prototype,"populateNinePatchSlicesFromImage",null),r([Object(l.serialize)()],e.prototype,"autoScale",null),r([Object(l.serialize)()],e.prototype,"stretch",null),r([Object(l.serialize)()],e.prototype,"source",null),r([Object(l.serialize)()],e.prototype,"cellWidth",null),r([Object(l.serialize)()],e.prototype,"cellHeight",null),r([Object(l.serialize)()],e.prototype,"cellId",null),e}(g);Object(l.RegisterClass)("BABYLON.GUI.Image",P);var O=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 n=null;return i.pointerEnterAnimation=function(){n=i.alpha,i.alpha-=.1},i.pointerOutAnimation=function(){null!==n&&(i.alpha=n)},i.pointerDownAnimation=function(){i.scaleX-=.05,i.scaleY-=.05},i.pointerUpAnimation=function(){i.scaleX+=.05,i.scaleY+=.05},i}return o(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,n,o,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(o,e,i,n,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,n){void 0===n&&(n=!1),!this.isReadOnly&&this.pointerOutAnimation&&this.pointerOutAnimation(),t.prototype._onPointerOut.call(this,e,i,n)},e.prototype._onPointerDown=function(e,i,n,o,r){return!!t.prototype._onPointerDown.call(this,e,i,n,o,r)&&(!this.isReadOnly&&this.pointerDownAnimation&&this.pointerDownAnimation(),!0)},e.prototype._onPointerUp=function(e,i,n,o,r,a){!this.isReadOnly&&this.pointerUpAnimation&&this.pointerUpAnimation(),t.prototype._onPointerUp.call(this,e,i,n,o,r,a)},e.CreateImageButton=function(t,e,i){var n=new this(t),o=new x(t+"_button",e);o.textWrapping=!0,o.textHorizontalAlignment=g.HORIZONTAL_ALIGNMENT_CENTER,o.paddingLeft="20%",n.addControl(o);var r=new P(t+"_icon",i);return r.width="20%",r.stretch=P.STRETCH_UNIFORM,r.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,n.addControl(r),n._image=r,n._textBlock=o,n},e.CreateImageOnlyButton=function(t,e){var i=new this(t),n=new P(t+"_icon",e);return n.stretch=P.STRETCH_FILL,n.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,i.addControl(n),i._image=n,i},e.CreateSimpleButton=function(t,e){var i=new this(t),n=new x(t+"_button",e);return n.textWrapping=!0,n.textHorizontalAlignment=g.HORIZONTAL_ALIGNMENT_CENTER,i.addControl(n),i._textBlock=n,i},e.CreateImageWithCenterTextButton=function(t,e,i){var n=new this(t),o=new P(t+"_icon",i);o.stretch=P.STRETCH_FILL,n.addControl(o);var r=new x(t+"_button",e);return r.textWrapping=!0,r.textHorizontalAlignment=g.HORIZONTAL_ALIGNMENT_CENTER,n.addControl(r),n._image=o,n._textBlock=r,n},e}(y);Object(l.RegisterClass)("BABYLON.GUI.Button",O);var B=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.ignoreLayoutWarnings=!1,i}return o(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,"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 n=0,o=this._children;n<o.length;n++){var r=o[n];this._isVertical?r.verticalAlignment=g.VERTICAL_ALIGNMENT_TOP:r.horizontalAlignment=g.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,n=0,o=this._children;n<o.length;n++){var r=o[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||l.Tools.Warn("Control (Name:"+r.name+", UniqueId:"+r.uniqueId+") is using height in percentage mode inside a vertical StackPanel"):i+=r._currentMeasure.height+r.paddingTopInPixels+r.paddingBottomInPixels):(r.left!==e+"px"&&(r.left=e+"px",this._rebuildLayout=!0,r._left.ignoreAdaptiveScaling=!0),r._width.isPercentage&&!r._automaticSize?this.ignoreLayoutWarnings||l.Tools.Warn("Control (Name:"+r.name+", UniqueId:"+r.uniqueId+") is using width in percentage mode inside a horizontal StackPanel"):e+=r._currentMeasure.width+r.paddingLeftInPixels+r.paddingRightInPixels))}e+=this.paddingLeftInPixels+this.paddingRightInPixels,i+=this.paddingTopInPixels+this.paddingBottomInPixels,this._doNotTrackManualChanges=!0;var a=!1,s=!1;if(!this._manualHeight&&this._isVertical){var _=this.height;this.height=i+"px",s=_!==this.height||!this._height.ignoreAdaptiveScaling}if(!this._manualWidth&&!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)},r([Object(l.serialize)()],e.prototype,"ignoreLayoutWarnings",void 0),r([Object(l.serialize)()],e.prototype,"isVertical",null),r([Object(l.serialize)()],e.prototype,"width",null),r([Object(l.serialize)()],e.prototype,"height",null),e}(m);Object(l.RegisterClass)("BABYLON.GUI.StackPanel",B);var C=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 l.Observable,i.isPointerBlocker=!0,i}return o(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,e){t.save(),this._applyStates(t);var i=this._currentMeasure.width-this._thickness,n=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,i,n),(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=i*this._checkSizeRatio,r=n*this._checkSizeRatio;t.fillRect(this._currentMeasure.left+this._thickness/2+(i-o)/2,this._currentMeasure.top+this._thickness/2+(n-r)/2,o,r)}t.strokeStyle=this.color,t.lineWidth=this._thickness,t.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,i,n),t.restore()},e.prototype._onPointerDown=function(e,i,n,o,r){return!!t.prototype._onPointerDown.call(this,e,i,n,o,r)&&(this.isReadOnly||(this.isChecked=!this.isChecked),!0)},e.AddCheckBoxWithHeader=function(t,i){var n=new B;n.isVertical=!1,n.height="30px";var o=new e;o.width="20px",o.height="20px",o.isChecked=!0,o.color="green",o.onIsCheckedChangedObservable.add(i),n.addControl(o);var r=new x;return r.text=t,r.width="180px",r.paddingLeft="5px",r.textHorizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,r.color="white",n.addControl(r),n},r([Object(l.serialize)()],e.prototype,"thickness",null),r([Object(l.serialize)()],e.prototype,"checkSizeRatio",null),r([Object(l.serialize)()],e.prototype,"background",null),r([Object(l.serialize)()],e.prototype,"isChecked",null),e}(g);Object(l.RegisterClass)("BABYLON.GUI.Checkbox",C);var T=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 n;if(this._text=this._text.slice(0,t)+(i||"")+this._text.slice(e),this._characters){var o=i?Array.from(i):[];(n=this._characters).splice.apply(n,function(t,e,i){if(i||2===arguments.length)for(var n,o=0,r=e.length;o<r;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))}([t,e-t],o,!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=[],n=0;t<e;)i[n++]=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}(),I=function(t){function e(e,i){void 0===i&&(i="");var n=t.call(this,e)||this;return n.name=e,n._placeholderText="",n._background="#222222",n._focusedBackground="#000000",n._focusedColor="white",n._placeholderColor="gray",n._thickness=1,n._margin=new _(10,_.UNITMODE_PIXEL),n._autoStretchWidth=!0,n._maxWidth=new _(1,_.UNITMODE_PERCENTAGE,!1),n._isFocused=!1,n._blinkIsEven=!1,n._cursorOffset=0,n._deadKey=!1,n._addKey=!0,n._currentKey="",n._isTextHighlightOn=!1,n._textHighlightColor="#d5e0ff",n._highligherOpacity=.4,n._highlightedText="",n._startHighlightIndex=0,n._endHighlightIndex=0,n._cursorIndex=-1,n._onFocusSelectAll=!1,n._isPointerDown=!1,n.promptMessage="Please enter text:",n.disableMobilePrompt=!1,n.onTextChangedObservable=new l.Observable,n.onBeforeKeyAddObservable=new l.Observable,n.onFocusObservable=new l.Observable,n.onBlurObservable=new l.Observable,n.onTextHighlightObservable=new l.Observable,n.onTextCopyObservable=new l.Observable,n.onTextCutObservable=new l.Observable,n.onTextPasteObservable=new l.Observable,n.onKeyboardEventProcessedObservable=new l.Observable,n.text=i,n.isPointerBlocker=!0,n}return o(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 T),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),-1!==navigator.userAgent.indexOf("Mobile")&&!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 l.ClipboardEventTypes.COPY:t._onCopyText(e.event),t.onTextCopyObservable.notifyObservers(t);break;case l.ClipboardEventTypes.CUT:t._onCutText(e.event),t.onTextCutObservable.notifyObservers(t);break;case l.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===l.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){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());if(0===this._cursorOffset)this.text=this._textWrapper.substr(0,this._textWrapper.length-1);else(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();case 222:i?"Quote"==i.code?i.shiftKey?(t=34,e='"'):(t=39,e="'"):(i.preventDefault(),this._cursorIndex=-1,this.deadKey=!0):(this._cursorIndex=-1,this.deadKey=!0)}if(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))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+=e;else{var o=this._textWrapper.length-this._cursorOffset;this._textWrapper.removePart(o,o,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.onTextHighlightObservable.notifyObservers(this),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,e){var i=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=g._GetFontOffset(t.font));var n=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 T).text=this._placeholderText,this._placeholderColor&&(t.fillStyle=this._placeholderColor)),this._textWidth=t.measureText(o.text).width;var r=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+r)+"px",this._autoStretchWidth=!0);var a=this._fontOffset.ascent+(this._currentMeasure.height-this._fontOffset.height)/2,s=this._width.getValueInPixel(this._host,this._tempParentMeasure.width)-r;if(t.save(),t.beginPath(),t.rect(n,this._currentMeasure.top+(this._currentMeasure.height-this._fontOffset.height)/2,s+2,this._currentMeasure.height),t.clip(),this._isFocused&&this._textWidth>s){var l=n-this._textWidth+s;this._scrollLeft||(this._scrollLeft=l)}else this._scrollLeft=n;if(t.fillText(o.text,this._scrollLeft,this._currentMeasure.top+a),this._isFocused){if(this._clickedCoordinate){var _=this._scrollLeft+this._textWidth-this._clickedCoordinate,h=0;this._cursorOffset=0;var c=0;do{this._cursorOffset&&(c=Math.abs(_-h)),this._cursorOffset++,h=t.measureText(o.substr(o.length-this._cursorOffset,this._cursorOffset)).width}while(h<_&&o.length>=this._cursorOffset);Math.abs(_-h)>c&&this._cursorOffset--,this._blinkIsEven=!1,this._clickedCoordinate=null}if(!this._blinkIsEven){var u=o.substr(o.length-this._cursorOffset),d=t.measureText(u).width,f=this._scrollLeft+this._textWidth-d;f<n?(this._scrollLeft+=n-f,f=n,this._markAsDirty()):f>n+s&&(this._scrollLeft+=n+s-f,f=n+s,this._markAsDirty()),this._isTextHighlightOn||t.fillRect(f,this._currentMeasure.top+(this._currentMeasure.height-this._fontOffset.height)/2,2,this._fontOffset.height)}if(clearTimeout(this._blinkTimeout),this._blinkTimeout=setTimeout((function(){i._blinkIsEven=!i._blinkIsEven,i._markAsDirty()}),500),this._isTextHighlightOn){clearTimeout(this._blinkTimeout);var p=t.measureText(o.substring(this._startHighlightIndex)).width,b=this._scrollLeft+this._textWidth-p;this._highlightedText=o.substring(this._startHighlightIndex,this._endHighlightIndex);var m=t.measureText(o.substring(this._startHighlightIndex,this._endHighlightIndex)).width;b<n&&((m-=n-b)||(m=t.measureText(o.charAt(o.length-this._cursorOffset)).width),b=n),t.globalAlpha=this._highligherOpacity,t.fillStyle=this._textHighlightColor,t.fillRect(b,this._currentMeasure.top+(this._currentMeasure.height-this._fontOffset.height)/2,m,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,n,o,r){return!!t.prototype._onPointerDown.call(this,e,i,n,o,r)&&(!!this.isReadOnly||(this._clickedCoordinate=i.x,this._isTextHighlightOn=!1,this._highlightedText="",this._cursorIndex=-1,this._isPointerDown=!0,this._host._capturingControl[n]=this,this._host.focusedControl===this?(clearTimeout(this._blinkTimeout),this._markAsDirty(),!0):!!this._isEnabled&&(this._host.focusedControl=this,!0)))},e.prototype._onPointerMove=function(e,i,n,o){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,n,o)},e.prototype._onPointerUp=function(e,i,n,o,r){this._isPointerDown=!1,delete this._host._capturingControl[n],t.prototype._onPointerUp.call(this,e,i,n,o,r)},e.prototype._beforeRenderText=function(t){return t},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()},r([Object(l.serialize)()],e.prototype,"promptMessage",void 0),r([Object(l.serialize)()],e.prototype,"disableMobilePrompt",void 0),r([Object(l.serialize)()],e.prototype,"maxWidth",null),r([Object(l.serialize)()],e.prototype,"highligherOpacity",null),r([Object(l.serialize)()],e.prototype,"onFocusSelectAll",null),r([Object(l.serialize)()],e.prototype,"textHighlightColor",null),r([Object(l.serialize)()],e.prototype,"margin",null),r([Object(l.serialize)()],e.prototype,"autoStretchWidth",null),r([Object(l.serialize)()],e.prototype,"thickness",null),r([Object(l.serialize)()],e.prototype,"focusedBackground",null),r([Object(l.serialize)()],e.prototype,"focusedColor",null),r([Object(l.serialize)()],e.prototype,"background",null),r([Object(l.serialize)()],e.prototype,"placeholderColor",null),r([Object(l.serialize)()],e.prototype,"placeholderText",null),r([Object(l.serialize)()],e.prototype,"deadKey",null),r([Object(l.serialize)()],e.prototype,"text",null),r([Object(l.serialize)()],e.prototype,"width",null),e}(g);Object(l.RegisterClass)("BABYLON.GUI.InputText",I);var R=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._rowDefinitions=new Array,i._columnDefinitions=new Array,i._cells={},i._childControls=new Array,i}return o(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){return void 0===e&&(e=!1),this._rowDefinitions.push(new _(t,e?_.UNITMODE_PIXEL:_.UNITMODE_PERCENTAGE)),this._markAsDirty(),this},e.prototype.addColumnDefinition=function(t,e){return void 0===e&&(e=!1),this._columnDefinitions.push(new _(t,e?_.UNITMODE_PIXEL:_.UNITMODE_PERCENTAGE)),this._markAsDirty(),this},e.prototype.setRowDefinition=function(t,e,i){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.internalValue===e||(this._rowDefinitions[t]=new _(e,i?_.UNITMODE_PIXEL:_.UNITMODE_PERCENTAGE),this._markAsDirty()),this},e.prototype.setColumnDefinition=function(t,e,i){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.internalValue===e||(this._columnDefinitions[t]=new _(e,i?_.UNITMODE_PIXEL:_.UNITMODE_PERCENTAGE),this._markAsDirty()),this},e.prototype.getChildrenAt=function(t,e){var i=this._cells[t+":"+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 n=0,o=e.children;n<o.length;n++){var r=o[n],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,n=this._cells[t].children;i<n.length;i++){n[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=e+":"+t,n=this._cells[i];this._removeCell(n,i)}for(e=0;e<this._rowDefinitions.length;e++)for(var o=t+1;o<this._columnDefinitions.length;o++){var r=e+":"+(o-1);i=e+":"+o;this._offsetCell(r,i)}return this._columnDefinitions.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=t+":"+e,n=this._cells[i];this._removeCell(n,i)}for(e=0;e<this._columnDefinitions.length;e++)for(var o=t+1;o<this._rowDefinitions.length;o++){var r=o-1+":"+e;i=o+":"+e;this._offsetCell(r,i)}return this._rowDefinitions.splice(t,1),this._markAsDirty(),this},e.prototype.addControl=function(e,i,n){if(void 0===i&&(i=0),void 0===n&&(n=0),0===this._rowDefinitions.length&&this.addRowDefinition(1,!1),0===this._columnDefinitions.length&&this.addColumnDefinition(1,!1),-1!==this._childControls.indexOf(e))return l.Tools.Warn("Control (Name:"+e.name+", UniqueId:"+e.uniqueId+") is already associated with this grid. You must remove it before reattaching it"),this;var o=Math.min(i,this._rowDefinitions.length-1)+":"+Math.min(n,this._columnDefinitions.length-1),r=this._cells[o];return r||(r=new m(o),this._cells[o]=r,r.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,r.verticalAlignment=g.VERTICAL_ALIGNMENT_TOP,t.prototype.addControl.call(this,r)),r.addControl(e),this._childControls.push(e),e._tag=o,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=[],n=[],o=[],r=this._currentMeasure.width,a=0,s=this._currentMeasure.height,l=0,_=0,h=0,c=this._rowDefinitions;h<c.length;h++){if((b=c[h]).isPixel)s-=p=b.getValue(this._host),i[_]=p;else l+=b.internalValue;_++}var u=0;_=0;for(var d=0,f=this._rowDefinitions;d<f.length;d++){var p,b=f[d];if(o.push(u),b.isPixel)u+=b.getValue(this._host);else u+=p=b.internalValue/l*s,i[_]=p;_++}_=0;for(var g=0,m=this._columnDefinitions;g<m.length;g++){if((b=m[g]).isPixel)r-=P=b.getValue(this._host),e[_]=P;else a+=b.internalValue;_++}var v=0;_=0;for(var y=0,x=this._columnDefinitions;y<x.length;y++){var P;b=x[y];if(n.push(v),b.isPixel)v+=b.getValue(this._host);else v+=P=b.internalValue/a*r,e[_]=P;_++}t(n,o,e,i)},e.prototype._additionalProcessing=function(e,i){var n=this;this._getGridDefinitions((function(t,e,i,o){for(var r in n._cells)if(n._cells.hasOwnProperty(r)){var a=r.split(":"),s=parseInt(a[0]),l=parseInt(a[1]),_=n._cells[r];_.left=t[l]+"px",_.top=e[s]+"px",_.width=i[l]+"px",_.height=o[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){if(this._cells.hasOwnProperty(t))this._cells[t]._markMatrixAsDirty()}},e.prototype._renderHighlightSpecific=function(e){var i=this;t.prototype._renderHighlightSpecific.call(this,e),this._getGridDefinitions((function(t,n,o,r){for(var a=0;a<t.length;a++){var s=i._currentMeasure.left+t[a]+o[a];e.beginPath(),e.moveTo(s,i._currentMeasure.top),e.lineTo(s,i._currentMeasure.top+i._currentMeasure.height),e.stroke()}for(a=0;a<n.length;a++){var l=i._currentMeasure.top+n[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()}this._childControls=[]},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 n=this.getColumnDefinition(i),o={value:null==n?void 0:n.getValue(this.host),unit:null==n?void 0:n.unit};e.columns.push(o)}for(i=0;i<this.rowCount;++i){var r=this.getRowDefinition(i);o={value:null==r?void 0:r.getValue(this.host),unit:null==r?void 0:r.unit};e.rows.push(o)}this.children.forEach((function(t){e.tags.push(t._tag)}))},e.prototype._parseFromContent=function(e,i){t.prototype._parseFromContent.call(this,e,i);var n=[];this.children.forEach((function(t){n.push(t)})),this.removeRowDefinition(0),this.removeColumnDefinition(0);for(var o=0;o<e.columnCount;++o){var r=e.columns[o].value,a=e.columns[o].unit;this.addColumnDefinition(r,1===a)}for(o=0;o<e.rowCount;++o){var s=e.rows[o].value;a=e.rows[o].unit;this.addRowDefinition(s,1===a)}for(o=0;o<n.length;++o){var l=e.tags[o],_=parseInt(l.substring(0,l.search(":")));isNaN(_)&&(_=0);var h=parseInt(l.substring(l.search(":")+1));isNaN(h)&&(h=0),this.addControl(n[o],_,h)}},e}(m);Object(l.RegisterClass)("BABYLON.GUI.Grid",R);var S=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._value=l.Color3.Red(),i._tmpColor=new l.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 l.Observable,i._pointerIsDown=!1,i.value=new l.Color3(.88,.1,.1),i.size="200px",i.isPointerBlocker=!0,i}return o(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,e){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,n,o,r){var a=r.createLinearGradient(e,i,n+e,i);a.addColorStop(0,"#fff"),a.addColorStop(1,"hsl("+t+", 100%, 50%)"),r.fillStyle=a,r.fillRect(e,i,n,o);var s=r.createLinearGradient(e,i,e,o+i);s.addColorStop(0,"rgba(0,0,0,0)"),s.addColorStop(1,"#000"),r.fillStyle=s,r.fillRect(e,i,n,o)},e.prototype._drawCircle=function(t,e,i,n){n.beginPath(),n.arc(t,e,i+1,0,2*Math.PI,!1),n.lineWidth=3,n.strokeStyle="#333333",n.stroke(),n.beginPath(),n.arc(t,e,i,0,2*Math.PI,!1),n.lineWidth=3,n.strokeStyle="#ffffff",n.stroke()},e.prototype._createColorWheelCanvas=function(t,e){var i=l.Engine.LastCreatedEngine;if(!i)throw new Error("Invalid engine. Unable to create a canvas.");for(var n=i.createCanvas(2*t,2*t),o=n.getContext("2d"),r=o.getImageData(0,0,2*t,2*t),a=r.data,s=this._tmpColor,_=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>_||f<c)){var p=Math.sqrt(f),b=Math.atan2(d,u);l.Color3.HSVtoRGBToRef(180*b/Math.PI+180,p/t,1,s);var g=4*(u+t+2*(d+t)*t);a[g]=255*s.r,a[g+1]=255*s.g,a[g+2]=255*s.b;var m=.2;m=t<50?.2:t>150?.04:-.16*(t-50)/100+.2;var v=(p-h)/(t-h);a[g+3]=v<m?v/m*255:v>1-m?255*(1-(v-(1-m))/m):255}}return o.putImageData(r,0,0),n},e.prototype._draw=function(t){t.save(),this._applyStates(t);var e=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),i=.2*e,n=this._currentMeasure.left,o=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,n,o),(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=n+e+Math.cos((this._h-180)*Math.PI/180)*s,a=o+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 n=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),o=n+this._currentMeasure.left,r=n+this._currentMeasure.top;this._h=180*Math.atan2(i-r,t-o)/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));l.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,n=this._squareTop,o=this._squareSize;return t>=i&&t<=i+o&&e>=n&&e<=n+o},e.prototype._isPointOnWheel=function(t,e){var i=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),n=i-.2*i,o=t-(i+this._currentMeasure.left),r=e-(i+this._currentMeasure.top),a=o*o+r*r;return a<=i*i&&a>=n*n},e.prototype._onPointerDown=function(e,i,n,o,r){if(!t.prototype._onPointerDown.call(this,e,i,n,o,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[n]=this,this._lastPointerDownId=n,!0},e.prototype._onPointerMove=function(e,i,n,o){if(n==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,n,o)}},e.prototype._onPointerUp=function(e,i,n,o,r,a){this._pointerIsDown=!1,delete this._host._capturingControl[n],t.prototype._onPointerUp.call(this,e,i,n,o,r,a)},e.prototype._onCanvasBlur=function(){this._forcePointerUp(),t.prototype._onCanvasBlur.call(this)},e.ShowPickerDialogAsync=function(t,i){return new Promise((function(n,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 r,a,s,_,h,c,u,d,f,p,b,m,v,P,B,C,T,S,w,M=i.swatchLimit/i.numSwatchesPerLine,E=parseFloat(i.pickerWidth)/i.numSwatchesPerLine,D=Math.floor(.25*E),L=D*(i.numSwatchesPerLine+1),F=Math.floor((parseFloat(i.pickerWidth)-L)/i.numSwatchesPerLine),N=F*M+D*(M+1),k=(parseInt(i.pickerHeight)+N+Math.floor(.25*F)).toString()+"px",A=l.Color3.FromHexString("#dddddd"),z=A.r+A.g+A.b,Q=["R","G","B"],V=!1;function j(t,e){w=e;var i=t.toHexString();if(T.background=i,p.name!=w&&(p.text=Math.floor(255*t.r).toString()),b.name!=w&&(b.text=Math.floor(255*t.g).toString()),m.name!=w&&(m.text=Math.floor(255*t.b).toString()),v.name!=w&&(v.text=t.r.toString()),P.name!=w&&(P.text=t.g.toString()),B.name!=w&&(B.text=t.b.toString()),C.name!=w){var n=i.split("#");C.text=n[1]}f.name!=w&&(f.value=t)}function W(t,e){var i=t.text;if(/[^0-9]/g.test(i))t.text=S;else if(""!=i&&(Math.floor(parseInt(i))<0?i="0":Math.floor(parseInt(i))>255?i="255":isNaN(parseInt(i))&&(i="0")),w==t.name&&(S=i),""!=i){i=parseInt(i).toString(),t.text=i;var n=l.Color3.FromHexString(T.background);w==t.name&&j("r"==e?new l.Color3(parseInt(i)/255,n.g,n.b):"g"==e?new l.Color3(n.r,parseInt(i)/255,n.b):new l.Color3(n.r,n.g,parseInt(i)/255),t.name)}}function H(t,e){var i=t.text;if(/[^0-9\.]/g.test(i))t.text=S;else{""!=i&&"."!=i&&0!=parseFloat(i)&&(parseFloat(i)<0?i="0.0":parseFloat(i)>1?i="1.0":isNaN(parseFloat(i))&&(i="0.0")),w==t.name&&(S=i),""!=i&&"."!=i&&0!=parseFloat(i)?(i=parseFloat(i).toString(),t.text=i):i="0.0";var n=l.Color3.FromHexString(T.background);w==t.name&&j("r"==e?new l.Color3(parseFloat(i),n.g,n.b):"g"==e?new l.Color3(n.r,parseFloat(i),n.b):new l.Color3(n.r,n.g,parseFloat(i)),t.name)}}function G(){if(i.savedColors&&i.savedColors[u]){if(V)var t="b";else t="";var e=O.CreateSimpleButton("Swatch_"+u,t);e.fontFamily="BabylonJSglyphs";var n=l.Color3.FromHexString(i.savedColors[u]),o=n.r+n.g+n.b;e.color=o>z?"#aaaaaa":"#ffffff",e.fontSize=Math.floor(.7*F),e.textBlock.verticalAlignment=g.VERTICAL_ALIGNMENT_CENTER,e.height=e.width=F.toString()+"px",e.background=i.savedColors[u],e.thickness=2;var r=u;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;V?(t=r,i.savedColors&&i.savedColors.splice(t,1),i.savedColors&&0==i.savedColors.length&&(Y(!1),V=!1),X("",Rt)):i.savedColors&&j(l.Color3.FromHexString(i.savedColors[r]),e.name)})),e}return null}function U(t){if(void 0!==t&&(V=t),V){for(var e=0;e<d.children.length;e++){d.children[e].textBlock.text="b"}void 0!==s&&(s.textBlock.text="Done")}else{for(e=0;e<d.children.length;e++){d.children[e].textBlock.text=""}void 0!==s&&(s.textBlock.text="Edit")}}function X(t,e){if(i.savedColors){""!=t&&i.savedColors.push(t),u=0,d.clearControls();var n=Math.ceil(i.savedColors.length/i.numSwatchesPerLine);if(0==n)var o=0;else o=n+1;if(d.rowCount!=n+o){for(var r=d.rowCount,a=0;a<r;a++)d.removeRowDefinition(0);for(a=0;a<n+o;a++)a%2?d.addRowDefinition(F,!0):d.addRowDefinition(D,!0)}d.height=(F*n+o*D).toString()+"px";for(var s=1,l=1;s<n+o;s+=2,l++){if(i.savedColors.length>l*i.numSwatchesPerLine)var _=i.numSwatchesPerLine;else _=i.savedColors.length-(l-1)*i.numSwatchesPerLine;for(var h=Math.min(Math.max(_,0),i.numSwatchesPerLine),c=0,f=1;c<h;c++)if(!(c>i.numSwatchesPerLine)){var p=G();null!=p&&(d.addControl(p,s,f),f+=2,u++)}}i.savedColors.length>=i.swatchLimit?Z(e,!0):Z(e,!1)}}function Y(t){t?((s=O.CreateSimpleButton("butEdit","Edit")).width=_,s.height=h,s.left=Math.floor(.1*parseInt(_)).toString()+"px",s.top=(-1*parseFloat(s.left)).toString()+"px",s.verticalAlignment=g.VERTICAL_ALIGNMENT_BOTTOM,s.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,s.thickness=2,s.color="#c0c0c0",s.fontSize=a,s.background="#535353",s.onPointerEnterObservable.add((function(){s.background="#414141"})),s.onPointerOutObservable.add((function(){s.background="#535353"})),s.pointerDownAnimation=function(){s.background="515151"},s.pointerUpAnimation=function(){s.background="#414141"},s.onPointerClickObservable.add((function(){V=!V,U()})),ht.addControl(s,1,0)):ht.removeControl(s)}function Z(t,e){e?(t.color="#555555",t.background="#454545"):(t.color="#c0c0c0",t.background="#535353")}function K(e){i.savedColors&&i.savedColors.length>0?n({savedColors:i.savedColors,pickedColor:e}):n({pickedColor:e}),t.removeControl(q)}var q=new R;if(q.name="Dialog Container",q.width=i.pickerWidth,i.savedColors){q.height=k;var J=parseInt(i.pickerHeight)/parseInt(k);q.addRowDefinition(J,!1),q.addRowDefinition(1-J,!1)}else q.height=i.pickerHeight,q.addRowDefinition(1,!1);if(t.addControl(q),i.savedColors){(d=new R).name="Swatch Drawer",d.verticalAlignment=g.VERTICAL_ALIGNMENT_TOP,d.background="#535353",d.width=i.pickerWidth;var $=i.savedColors.length/i.numSwatchesPerLine;if(0==$)var tt=0;else tt=$+1;d.height=(F*$+tt*D).toString()+"px",d.top=Math.floor(.25*F).toString()+"px";for(var et=0;et<2*Math.ceil(i.savedColors.length/i.numSwatchesPerLine)+1;et++)et%2!=0?d.addRowDefinition(F,!0):d.addRowDefinition(D,!0);for(et=0;et<2*i.numSwatchesPerLine+1;et++)et%2!=0?d.addColumnDefinition(F,!0):d.addColumnDefinition(D,!0);q.addControl(d,1,0)}var it=new R;it.name="Picker Panel",it.height=i.pickerHeight;var nt=parseInt(i.headerHeight)/parseInt(i.pickerHeight),ot=[nt,1-nt];it.addRowDefinition(ot[0],!1),it.addRowDefinition(ot[1],!1),q.addControl(it,0,0);var rt=new y;rt.name="Dialogue Header Bar",rt.background="#cccccc",rt.thickness=0,it.addControl(rt,0,0);var at=O.CreateSimpleButton("closeButton","a");at.fontFamily="BabylonJSglyphs";var st=l.Color3.FromHexString(rt.background);r=new l.Color3(1-st.r,1-st.g,1-st.b),at.color=r.toHexString(),at.fontSize=Math.floor(.6*parseInt(i.headerHeight)),at.textBlock.textVerticalAlignment=g.VERTICAL_ALIGNMENT_CENTER,at.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_RIGHT,at.height=at.width=i.headerHeight,at.background=rt.background,at.thickness=0,at.pointerDownAnimation=function(){},at.pointerUpAnimation=function(){at.background=rt.background},at.pointerEnterAnimation=function(){at.color=rt.background,at.background="red"},at.pointerOutAnimation=function(){at.color=r.toHexString(),at.background=rt.background},at.onPointerClickObservable.add((function(){K(Pt.background)})),it.addControl(at,0,0);var lt=new R;lt.name="Dialogue Body",lt.background="#535353";var _t=[.4375,.5625];lt.addRowDefinition(1,!1),lt.addColumnDefinition(_t[0],!1),lt.addColumnDefinition(_t[1],!1),it.addControl(lt,1,0);var ht=new R;ht.name="Picker Grid",ht.addRowDefinition(.85,!1),ht.addRowDefinition(.15,!1),lt.addControl(ht,0,0),(f=new e).name="GUI Color Picker",i.pickerHeight<i.pickerWidth?f.width=.89:f.height=.89,f.value=l.Color3.FromHexString(i.lastColor),f.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_CENTER,f.verticalAlignment=g.VERTICAL_ALIGNMENT_CENTER,f.onPointerDownObservable.add((function(){w=f.name,S="",U(!1)})),f.onValueChangedObservable.add((function(t){w==f.name&&j(t,f.name)})),ht.addControl(f,0,0);var ct=new R;ct.name="Dialogue Right Half",ct.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT;var ut=[.514,.486];ct.addRowDefinition(ut[0],!1),ct.addRowDefinition(ut[1],!1),lt.addControl(ct,1,1);var dt=new R;dt.name="Swatches and Buttons";var ft=[.417,.583];dt.addRowDefinition(1,!1),dt.addColumnDefinition(ft[0],!1),dt.addColumnDefinition(ft[1],!1),ct.addControl(dt,0,0);var pt=new R;pt.name="New and Current Swatches";var bt=[.04,.16,.64,.16];pt.addRowDefinition(bt[0],!1),pt.addRowDefinition(bt[1],!1),pt.addRowDefinition(bt[2],!1),pt.addRowDefinition(bt[3],!1),dt.addControl(pt,0,0);var gt=new R;gt.name="Active Swatches",gt.width=.67,gt.addRowDefinition(.5,!1),gt.addRowDefinition(.5,!1),pt.addControl(gt,2,0);var mt=Math.floor(parseInt(i.pickerWidth)*_t[1]*ft[0]*.11),vt=Math.floor(parseInt(i.pickerHeight)*ot[1]*ut[0]*bt[1]*.5);if(i.pickerWidth>i.pickerHeight)var yt=vt;else yt=mt;var xt=new x;xt.text="new",xt.name="New Color Label",xt.color="#c0c0c0",xt.fontSize=yt,pt.addControl(xt,1,0),(T=new y).name="New Color Swatch",T.background=i.lastColor,T.thickness=0,gt.addControl(T,0,0);var Pt=O.CreateSimpleButton("currentSwatch","");Pt.background=i.lastColor,Pt.thickness=0,Pt.onPointerClickObservable.add((function(){j(l.Color3.FromHexString(Pt.background),Pt.name),U(!1)})),Pt.pointerDownAnimation=function(){},Pt.pointerUpAnimation=function(){},Pt.pointerEnterAnimation=function(){},Pt.pointerOutAnimation=function(){},gt.addControl(Pt,1,0);var Ot=new y;Ot.name="Swatch Outline",Ot.width=.67,Ot.thickness=2,Ot.color="#404040",Ot.isHitTestVisible=!1,pt.addControl(Ot,2,0);var Bt=new x;Bt.name="Current Color Label",Bt.text="current",Bt.color="#c0c0c0",Bt.fontSize=yt,pt.addControl(Bt,3,0);var Ct=new R;Ct.name="Button Grid",Ct.height=.8;Ct.addRowDefinition(1/3,!1),Ct.addRowDefinition(1/3,!1),Ct.addRowDefinition(1/3,!1),dt.addControl(Ct,0,1),_=Math.floor(parseInt(i.pickerWidth)*_t[1]*ft[1]*.67).toString()+"px",h=Math.floor(parseInt(i.pickerHeight)*ot[1]*ut[0]*(parseFloat(Ct.height.toString())/100)*(1/3)*.7).toString()+"px",a=parseFloat(_)>parseFloat(h)?Math.floor(.45*parseFloat(h)):Math.floor(.11*parseFloat(_));var Tt=O.CreateSimpleButton("butOK","OK");Tt.width=_,Tt.height=h,Tt.verticalAlignment=g.VERTICAL_ALIGNMENT_CENTER,Tt.thickness=2,Tt.color="#c0c0c0",Tt.fontSize=a,Tt.background="#535353",Tt.onPointerEnterObservable.add((function(){Tt.background="#414141"})),Tt.onPointerOutObservable.add((function(){Tt.background="#535353"})),Tt.pointerDownAnimation=function(){Tt.background="515151"},Tt.pointerUpAnimation=function(){Tt.background="#414141"},Tt.onPointerClickObservable.add((function(){U(!1),K(T.background)})),Ct.addControl(Tt,0,0);var It=O.CreateSimpleButton("butCancel","Cancel");if(It.width=_,It.height=h,It.verticalAlignment=g.VERTICAL_ALIGNMENT_CENTER,It.thickness=2,It.color="#c0c0c0",It.fontSize=a,It.background="#535353",It.onPointerEnterObservable.add((function(){It.background="#414141"})),It.onPointerOutObservable.add((function(){It.background="#535353"})),It.pointerDownAnimation=function(){It.background="515151"},It.pointerUpAnimation=function(){It.background="#414141"},It.onPointerClickObservable.add((function(){U(!1),K(Pt.background)})),Ct.addControl(It,1,0),i.savedColors){var Rt=O.CreateSimpleButton("butSave","Save");Rt.width=_,Rt.height=h,Rt.verticalAlignment=g.VERTICAL_ALIGNMENT_CENTER,Rt.thickness=2,Rt.fontSize=a,i.savedColors.length<i.swatchLimit?(Rt.color="#c0c0c0",Rt.background="#535353"):Z(Rt,!0),Rt.onPointerEnterObservable.add((function(){i.savedColors&&i.savedColors.length<i.swatchLimit&&(Rt.background="#414141")})),Rt.onPointerOutObservable.add((function(){i.savedColors&&i.savedColors.length<i.swatchLimit&&(Rt.background="#535353")})),Rt.pointerDownAnimation=function(){i.savedColors&&i.savedColors.length<i.swatchLimit&&(Rt.background="515151")},Rt.pointerUpAnimation=function(){i.savedColors&&i.savedColors.length<i.swatchLimit&&(Rt.background="#414141")},Rt.onPointerClickObservable.add((function(){i.savedColors&&(0==i.savedColors.length&&Y(!0),i.savedColors.length<i.swatchLimit&&X(T.background,Rt),U(!1))})),i.savedColors.length>0&&Y(!0),Ct.addControl(Rt,2,0)}var St=new R;St.name="Dialog Lower Right",St.addRowDefinition(.02,!1),St.addRowDefinition(.63,!1),St.addRowDefinition(.21,!1),St.addRowDefinition(.14,!1),ct.addControl(St,1,0),c=l.Color3.FromHexString(i.lastColor);var wt=new R;wt.name="RGB Values",wt.width=.82,wt.verticalAlignment=g.VERTICAL_ALIGNMENT_CENTER,wt.addRowDefinition(1/3,!1),wt.addRowDefinition(1/3,!1),wt.addRowDefinition(1/3,!1),wt.addColumnDefinition(.1,!1),wt.addColumnDefinition(.2,!1),wt.addColumnDefinition(.7,!1),St.addControl(wt,1,0);for(et=0;et<Q.length;et++){(Mt=new x).text=Q[et],Mt.color="#c0c0c0",Mt.fontSize=a,wt.addControl(Mt,et,0)}(p=new I).width=.83,p.height=.72,p.name="rIntField",p.fontSize=a,p.text=(255*c.r).toString(),p.color="#f0f0f0",p.background="#454545",p.onFocusObservable.add((function(){w=p.name,S=p.text,U(!1)})),p.onBlurObservable.add((function(){""==p.text&&(p.text="0"),W(p,"r"),w==p.name&&(w="")})),p.onTextChangedObservable.add((function(){w==p.name&&W(p,"r")})),wt.addControl(p,0,1),(b=new I).width=.83,b.height=.72,b.name="gIntField",b.fontSize=a,b.text=(255*c.g).toString(),b.color="#f0f0f0",b.background="#454545",b.onFocusObservable.add((function(){w=b.name,S=b.text,U(!1)})),b.onBlurObservable.add((function(){""==b.text&&(b.text="0"),W(b,"g"),w==b.name&&(w="")})),b.onTextChangedObservable.add((function(){w==b.name&&W(b,"g")})),wt.addControl(b,1,1),(m=new I).width=.83,m.height=.72,m.name="bIntField",m.fontSize=a,m.text=(255*c.b).toString(),m.color="#f0f0f0",m.background="#454545",m.onFocusObservable.add((function(){w=m.name,S=m.text,U(!1)})),m.onBlurObservable.add((function(){""==m.text&&(m.text="0"),W(m,"b"),w==m.name&&(w="")})),m.onTextChangedObservable.add((function(){w==m.name&&W(m,"b")})),wt.addControl(m,2,1),(v=new I).width=.95,v.height=.72,v.name="rDecField",v.fontSize=a,v.text=c.r.toString(),v.color="#f0f0f0",v.background="#454545",v.onFocusObservable.add((function(){w=v.name,S=v.text,U(!1)})),v.onBlurObservable.add((function(){0!=parseFloat(v.text)&&""!=v.text||(v.text="0",H(v,"r")),w==v.name&&(w="")})),v.onTextChangedObservable.add((function(){w==v.name&&H(v,"r")})),wt.addControl(v,0,2),(P=new I).width=.95,P.height=.72,P.name="gDecField",P.fontSize=a,P.text=c.g.toString(),P.color="#f0f0f0",P.background="#454545",P.onFocusObservable.add((function(){w=P.name,S=P.text,U(!1)})),P.onBlurObservable.add((function(){0!=parseFloat(P.text)&&""!=P.text||(P.text="0",H(P,"g")),w==P.name&&(w="")})),P.onTextChangedObservable.add((function(){w==P.name&&H(P,"g")})),wt.addControl(P,1,2),(B=new I).width=.95,B.height=.72,B.name="bDecField",B.fontSize=a,B.text=c.b.toString(),B.color="#f0f0f0",B.background="#454545",B.onFocusObservable.add((function(){w=B.name,S=B.text,U(!1)})),B.onBlurObservable.add((function(){0!=parseFloat(B.text)&&""!=B.text||(B.text="0",H(B,"b")),w==B.name&&(w="")})),B.onTextChangedObservable.add((function(){w==B.name&&H(B,"b")})),wt.addControl(B,2,2);var Mt,Et=new R;Et.name="Hex Value",Et.width=.82,Et.addRowDefinition(1,!1),Et.addColumnDefinition(.1,!1),Et.addColumnDefinition(.9,!1),St.addControl(Et,2,0),(Mt=new x).text="#",Mt.color="#c0c0c0",Mt.fontSize=a,Et.addControl(Mt,0,0),(C=new I).width=.96,C.height=.72,C.name="hexField",C.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_CENTER,C.fontSize=a;var Dt=i.lastColor.split("#");C.text=Dt[1],C.color="#f0f0f0",C.background="#454545",C.onFocusObservable.add((function(){w=C.name,S=C.text,U(!1)})),C.onBlurObservable.add((function(){if(3==C.text.length){var t=C.text.split("");C.text=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]}""==C.text&&(C.text="000000",j(l.Color3.FromHexString(C.text),"b")),w==C.name&&(w="")})),C.onTextChangedObservable.add((function(){var t=C.text,e=/[^0-9A-F]/i.test(t);if((C.text.length>6||e)&&w==C.name)C.text=S;else{if(C.text.length<6)for(var i=6-C.text.length,n=0;n<i;n++)t="0"+t;if(3==C.text.length){var o=C.text.split("");t=o[0]+o[0]+o[1]+o[1]+o[2]+o[2]}t="#"+t,w==C.name&&(S=C.text,j(l.Color3.FromHexString(t),C.name))}})),Et.addControl(C,0,1),i.savedColors&&i.savedColors.length>0&&X("",Rt)}))},e._Epsilon=1e-6,r([Object(l.serialize)()],e.prototype,"value",null),r([Object(l.serialize)()],e.prototype,"width",null),r([Object(l.serialize)()],e.prototype,"height",null),r([Object(l.serialize)()],e.prototype,"size",null),e}(g);Object(l.RegisterClass)("BABYLON.GUI.ColorPicker",S);var w=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._thickness=1,i}return o(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),g.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._background&&(t.fillStyle=this._background,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){g.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){g.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()},r([Object(l.serialize)()],e.prototype,"thickness",null),e}(m);Object(l.RegisterClass)("BABYLON.GUI.Ellipse",w);var M=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 l.Observable,i.onBlurObservable=new l.Observable,i.onKeyboardEventProcessedObservable=new l.Observable,i._unfocusedColor=i.color,i}return o(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,n,o,r){return this.isReadOnly||this.focus(),t.prototype._onPointerDown.call(this,e,i,n,o,r)},e.prototype.displose=function(){t.prototype.dispose.call(this),this.onBlurObservable.clear(),this.onFocusObservable.clear(),this.onKeyboardEventProcessedObservable.clear()},e}(O);Object(l.RegisterClass)("BABYLON.GUI.FocusableButton",M);var E=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype._beforeRenderText=function(t){for(var e=new T,i="",n=0;n<t.length;n++)i+="•";return e.text=i,e},e}(I);Object(l.RegisterClass)("BABYLON.GUI.InputPassword",E);var D=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._lineWidth=1,i._x1=new _(0),i._y1=new _(0),i._x2=new _(0),i._y2=new _(0),i._dash=new Array,i._automaticSize=!0,i.isHitTestVisible=!1,i._horizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,i._verticalAlignment=g.VERTICAL_ALIGNMENT_TOP,i}return o(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.color,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,e){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 n=this._host._getGlobalViewport(),o=l.Vector3.Project(t,l.Matrix.Identity(),e.getTransformMatrix(),n);this._moveToProjectedPosition(o,i),o.z<0||o.z>1?this.notRenderable=!0:this.notRenderable=!1}else l.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",n=t.y+this._linkOffsetY.getValue(this._host)+"px";e?(this.x2=i,this.y2=n,this._x2.ignoreAdaptiveScaling=!0,this._y2.ignoreAdaptiveScaling=!0):(this.x1=i,this.y1=n,this._x1.ignoreAdaptiveScaling=!0,this._y1.ignoreAdaptiveScaling=!0)},r([Object(l.serialize)()],e.prototype,"dash",null),r([Object(l.serialize)()],e.prototype,"x1",null),r([Object(l.serialize)()],e.prototype,"y1",null),r([Object(l.serialize)()],e.prototype,"x2",null),r([Object(l.serialize)()],e.prototype,"y2",null),r([Object(l.serialize)()],e.prototype,"lineWidth",null),e}(g);Object(l.RegisterClass)("BABYLON.GUI.Line",D);var L=function(){function t(t){this._multiLine=t,this._x=new _(0),this._y=new _(0),this._point=new l.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 l.Vector3(this._control.centerX,this._control.centerY,1-l.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 l.Vector3(e,i,1-l.Epsilon)},t.prototype.dispose=function(){this.resetLinks()},t}(),F=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=g.HORIZONTAL_ALIGNMENT_LEFT,i._verticalAlignment=g.VERTICAL_ALIGNMENT_TOP,i._dash=[],i._points=[],i}return o(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 L(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 l.AbstractMesh?e.mesh=t:t instanceof g?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 L){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,e){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 i,n=!0;this._points.forEach((function(e){e&&(n?(t.moveTo(e._point.x,e._point.y),n=!1):e._point.z<1&&i.z<1?t.lineTo(e._point.x,e._point.y):t.moveTo(e._point.x,e._point.y),i=e._point)})),t.stroke(),t.restore()},e.prototype._additionalProcessing=function(t,e){var i=this;this._minX=null,this._minY=null,this._maxX=null,this._maxY=null,this._points.forEach((function(t,e){t&&(t.translate(),(null==i._minX||t._point.x<i._minX)&&(i._minX=t._point.x),(null==i._minY||t._point.y<i._minY)&&(i._minY=t._point.y),(null==i._maxX||t._point.x>i._maxX)&&(i._maxX=t._point.x),(null==i._maxY||t._point.y>i._maxY)&&(i._maxY=t._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(t,e){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)},r([Object(l.serialize)()],e.prototype,"dash",null),e}(g);Object(l.RegisterClass)("BABYLON.GUI.MultiLine",F);var N=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 l.Observable,i.isPointerBlocker=!0,i}return o(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),g.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 n=e*this._checkSizeRatio,o=i*this._checkSizeRatio;g.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,n/2-this._thickness/2,o/2-this._thickness/2,t),t.fill()}t.restore()},e.prototype._onPointerDown=function(e,i,n,o,r){return!!t.prototype._onPointerDown.call(this,e,i,n,o,r)&&(this.isReadOnly||this.isChecked||(this.isChecked=!0),!0)},e.AddRadioButtonWithHeader=function(t,i,n,o){var r=new B;r.isVertical=!1,r.height="30px";var a=new e;a.width="20px",a.height="20px",a.isChecked=n,a.color="green",a.group=i,a.onIsCheckedChangedObservable.add((function(t){return o(a,t)})),r.addControl(a);var s=new x;return s.text=t,s.width="180px",s.paddingLeft="5px",s.textHorizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,s.color="white",r.addControl(s),r},r([Object(l.serialize)()],e.prototype,"thickness",null),r([Object(l.serialize)()],e.prototype,"group",void 0),r([Object(l.serialize)()],e.prototype,"checkSizeRatio",null),r([Object(l.serialize)()],e.prototype,"background",null),r([Object(l.serialize)()],e.prototype,"isChecked",null),e}(g);Object(l.RegisterClass)("BABYLON.GUI.RadioButton",N);var k=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._thumbWidth=new _(20,_.UNITMODE_PIXEL,!1),i._minimum=0,i._maximum=100,i._value=50,i._isVertical=!1,i._barOffset=new _(5,_.UNITMODE_PIXEL,!1),i._isThumbClamped=!1,i._displayThumb=!0,i._step=0,i._lastPointerDownId=-1,i._effectiveBarOffset=0,i.onValueChangedObservable=new l.Observable,i._pointerIsDown=!1,i.isPointerBlocker=!0,i}return o(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?(i/this._step|0)*this._step:i},e.prototype._onPointerDown=function(e,i,n,o,r){return!!t.prototype._onPointerDown.call(this,e,i,n,o,r)&&(this.isReadOnly||(this._pointerIsDown=!0,this._updateValueFromPointer(i.x,i.y),this._host._capturingControl[n]=this,this._lastPointerDownId=n),!0)},e.prototype._onPointerMove=function(e,i,n,o){n==this._lastPointerDownId&&(this._pointerIsDown&&!this.isReadOnly&&this._updateValueFromPointer(i.x,i.y),t.prototype._onPointerMove.call(this,e,i,n,o))},e.prototype._onPointerUp=function(e,i,n,o,r){this._pointerIsDown=!1,delete this._host._capturingControl[n],t.prototype._onPointerUp.call(this,e,i,n,o,r)},e.prototype._onCanvasBlur=function(){this._forcePointerUp(),t.prototype._onCanvasBlur.call(this)},r([Object(l.serialize)()],e.prototype,"displayThumb",null),r([Object(l.serialize)()],e.prototype,"step",null),r([Object(l.serialize)()],e.prototype,"barOffset",null),r([Object(l.serialize)()],e.prototype,"thumbWidth",null),r([Object(l.serialize)()],e.prototype,"minimum",null),r([Object(l.serialize)()],e.prototype,"maximum",null),r([Object(l.serialize)()],e.prototype,"value",null),r([Object(l.serialize)()],e.prototype,"isVertical",null),r([Object(l.serialize)()],e.prototype,"isThumbClamped",null),e}(g),A=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}return o(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,"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._draw=function(t,e){t.save(),this._applyStates(t),this._prepareRenderingData(this.isThumbCircle?"circle":"rectangle");var i=this._renderLeft,n=this._renderTop,o=this._renderWidth,r=this._renderHeight,a=0;this.isThumbClamped&&this.isThumbCircle?(this.isVertical?n+=this._effectiveThumbThickness/2:i+=this._effectiveThumbThickness/2,a=this._backgroundBoxThickness/2):a=(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 s=this._getThumbPosition();t.fillStyle=this._background,this.isVertical?this.isThumbClamped?this.isThumbCircle?(t.beginPath(),t.arc(i+this._backgroundBoxThickness/2,n,a,Math.PI,2*Math.PI),t.fill(),t.fillRect(i,n,o,r)):t.fillRect(i,n,o,r+this._effectiveThumbThickness):t.fillRect(i,n,o,r):this.isThumbClamped?this.isThumbCircle?(t.beginPath(),t.arc(i+this._backgroundBoxLength,n+this._backgroundBoxThickness/2,a,0,2*Math.PI),t.fill(),t.fillRect(i,n,o,r)):t.fillRect(i,n,o+this._effectiveThumbThickness,r):t.fillRect(i,n,o,r),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),t.fillStyle=this.color,this._displayValueBar&&(this.isVertical?this.isThumbClamped?this.isThumbCircle?(t.beginPath(),t.arc(i+this._backgroundBoxThickness/2,n+this._backgroundBoxLength,a,0,2*Math.PI),t.fill(),t.fillRect(i,n+s,o,r-s)):t.fillRect(i,n+s,o,r-s+this._effectiveThumbThickness):t.fillRect(i,n+s,o,r-s):this.isThumbClamped&&this.isThumbCircle?(t.beginPath(),t.arc(i,n+this._backgroundBoxThickness/2,a,0,2*Math.PI),t.fill(),t.fillRect(i,n,s,r)):t.fillRect(i,n,s,r)),t.fillStyle=this._thumbColor||this.color,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(i+this._backgroundBoxThickness/2,n+s,a,0,2*Math.PI):t.arc(i+s,n+this._backgroundBoxThickness/2,a,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(i-this._effectiveBarOffset,this._currentMeasure.top+s,this._currentMeasure.width,this._effectiveThumbThickness):t.fillRect(this._currentMeasure.left+s,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(i-this._effectiveBarOffset,this._currentMeasure.top+s,this._currentMeasure.width,this._effectiveThumbThickness):t.strokeRect(this._currentMeasure.left+s,this._currentMeasure.top,this._effectiveThumbThickness,this._currentMeasure.height))),t.restore()},r([Object(l.serialize)()],e.prototype,"displayValueBar",null),r([Object(l.serialize)()],e.prototype,"borderColor",null),r([Object(l.serialize)()],e.prototype,"background",null),r([Object(l.serialize)()],e.prototype,"thumbColor",null),r([Object(l.serialize)()],e.prototype,"isThumbCircle",null),e}(k);Object(l.RegisterClass)("BABYLON.GUI.Slider",A);var z=function(){function t(t){this.name=t,this._groupPanel=new B,this._selectors=new Array,this._groupPanel.verticalAlignment=g.VERTICAL_ALIGNMENT_TOP,this._groupPanel.horizontalAlignment=g.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 x("groupHead",t);return e.width=.9,e.height="30px",e.textWrapping=!0,e.color="black",e.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,e.textHorizontalAlignment=g.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}(),Q=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.addCheckbox=function(t,e,i){void 0===e&&(e=function(t){}),void 0===i&&(i=!1);i=i||!1;var n=new C;n.width="20px",n.height="20px",n.color="#364249",n.background="#CCCCCC",n.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,n.onIsCheckedChangedObservable.add((function(t){e(t)}));var o=g.AddHeader(n,t,"200px",{isHorizontal:!0,controlFirst:!0});o.height="30px",o.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,o.left="4px",this.groupPanel.addControl(o),this.selectors.push(o),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}(z),V=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._selectNb=0,e}return o(e,t),e.prototype.addRadio=function(t,e,i){void 0===e&&(e=function(t){}),void 0===i&&(i=!1);var n=this._selectNb++,o=new N;o.name=t,o.width="20px",o.height="20px",o.color="#364249",o.background="#CCCCCC",o.group=this.name,o.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,o.onIsCheckedChangedObservable.add((function(t){t&&e(n)}));var r=g.AddHeader(o,t,"200px",{isHorizontal:!0,controlFirst:!0});r.height="30px",r.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,r.left="4px",this.groupPanel.addControl(r),this.selectors.push(r),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}(z),j=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.addSlider=function(t,e,i,n,o,r,a){void 0===e&&(e=function(t){}),void 0===i&&(i="Units"),void 0===n&&(n=0),void 0===o&&(o=0),void 0===r&&(r=0),void 0===a&&(a=function(t){return 0|t});var s=new A;s.name=i,s.value=r,s.minimum=n,s.maximum=o,s.width=.9,s.height="20px",s.color="#364249",s.background="#CCCCCC",s.borderColor="black",s.horizontalAlignment=g.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=g.AddHeader(s,t+": "+a(r)+" "+i,"30px",{isHorizontal:!1,controlFirst:!1});l.height="60px",l.horizontalAlignment=g.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}(z),W=function(t){function e(e,i){void 0===i&&(i=[]);var n=t.call(this,e)||this;if(n.name=e,n.groups=i,n._buttonColor="#364249",n._buttonBackground="#CCCCCC",n._headerColor="black",n._barColor="white",n._barHeight="2px",n._spacerHeight="20px",n._bars=new Array,n._groups=i,n.thickness=2,n._panel=new B,n._panel.verticalAlignment=g.VERTICAL_ALIGNMENT_TOP,n._panel.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,n._panel.top=5,n._panel.left=5,n._panel.width=.95,i.length>0){for(var o=0;o<i.length-1;o++)n._panel.addControl(i[o].groupPanel),n._addSpacer();n._panel.addControl(i[i.length-1].groupPanel)}return n.addControl(n._panel),n}return o(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 m;t.width=1,t.height=this._spacerHeight,t.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT;var e=new y;e.width=1,e.height=this._barHeight,e.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,e.verticalAlignment=g.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 n=this._groups[e];i<0||i>=n.selectors.length||n._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,n){(void 0===i&&(i=function(){}),void 0===n&&(n=!1),t<0||t>=this._groups.length)||this._groups[t].addCheckbox(e,i,n)},e.prototype.addToGroupRadio=function(t,e,i,n){(void 0===i&&(i=function(){}),void 0===n&&(n=!1),t<0||t>=this._groups.length)||this._groups[t].addRadio(e,i,n)},e.prototype.addToGroupSlider=function(t,e,i,n,o,r,a,s){(void 0===i&&(i=function(){}),void 0===n&&(n="Units"),void 0===o&&(o=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,n,o,r,a,s)},e}(y),H=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 o(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,n=e.height,o=this.host.getContext(),r=new f(0,0,i,n);this.host._numLayoutCalls=0,this.host._rootContainer._layout(r,o),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],n=Math.max(0,Math.floor((i._customData._origLeft-this._customData.origLeft)/this._bucketWidth)),o=Math.floor((i._customData._origLeft-this._customData.origLeft+i._currentMeasure.width-1)/this._bucketWidth),r=Math.max(0,Math.floor((i._customData._origTop-this._customData.origTop)/this._bucketHeight)),a=Math.floor((i._customData._origTop-this._customData.origTop+i._currentMeasure.height-1)/this._bucketHeight);r<=a;){for(var s=n;s<=o;++s){var l=r*this._bucketLen+s,_=this._buckets[l];_||(_=[],this._buckets[l]=_),_.push(i)}r++}i instanceof m&&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 n=0;n<t.length;++n){var o=t[n];o._currentMeasure.left-=e,o._currentMeasure.top-=i,o._customData._origLeft=o._currentMeasure.left,o._customData._origTop=o._currentMeasure.top,o instanceof m&&o._children.length>0&&this._updateChildrenMeasures(o._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 n=0;n<t.length;++n){var o=t[n];o._currentMeasure.left=o._customData._origLeft+e,o._currentMeasure.top=o._customData._origTop+i,o._isClipped=!1,o instanceof m&&o._children.length>0&&this._scrollChildren(o._children,e,i)}},e.prototype._scrollChildrenWithBuckets=function(t,e,i,n){for(var o=Math.max(0,Math.floor(-t/this._bucketWidth)),r=Math.floor((-t+this._parentMeasure.width-1)/this._bucketWidth),a=Math.max(0,Math.floor(-e/this._bucketHeight)),s=Math.floor((-e+this._parentMeasure.height-1)/this._bucketHeight);a<=s;){for(var l=o;l<=r;++l){var _=a*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+n,u._isClipped=!1}}a++}},e.prototype._draw=function(e,i){if(this._freezeControls){this._localDraw(e),this.clipChildren&&this._clipForChildren(e);var n=0|this.leftInPixels,o=0|this.topInPixels;this._useBuckets()&&null!==this._oldLeft&&null!==this._oldTop?(this._scrollChildrenWithBuckets(this._oldLeft,this._oldTop,n,o),this._scrollChildrenWithBuckets(n,o,n,o)):this._scrollChildren(this._children,n,o),this._oldLeft=n,this._oldTop=o;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,n=0,o=this.children;n<o.length;n++){var r=o[n];r.isVisible&&!r.notRenderable&&(r.horizontalAlignment===g.HORIZONTAL_ALIGNMENT_CENTER&&r._offsetLeft(this._currentMeasure.left-r._currentMeasure.left),r.verticalAlignment===g.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,_.UNITMODE_PIXEL),this._currentMeasure.width=e,this._rebuildLayout=!0,this._isDirty=!0),this._currentMeasure.height!==i&&(this._height.updateInPlace(i,_.UNITMODE_PIXEL),this._currentMeasure.height=i,this._rebuildLayout=!0,this._isDirty=!0),t.prototype._postMeasure.call(this)}},e}(m),G=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 f(0,0,0,0),i}return o(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}),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._draw=function(t){t.save(),this._applyStates(t),this._prepareRenderingData("rectangle");var e=this._renderLeft,i=this._getThumbPosition();t.fillStyle=this._background,t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height),t.fillStyle=this.color,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),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 i=0;i=this.isVertical?-(e-this._originY)/(this._currentMeasure.height-this._effectiveThumbThickness):(t-this._originX)/(this._currentMeasure.width-this._effectiveThumbThickness),this.value+=i*(this.maximum-this.minimum),this._originX=t,this._originY=e},e.prototype._onPointerDown=function(e,i,n,o,r){return this._first=!0,t.prototype._onPointerDown.call(this,e,i,n,o,r)},r([Object(l.serialize)()],e.prototype,"borderColor",null),r([Object(l.serialize)()],e.prototype,"background",null),e}(k),U=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 f(0,0,0,0),i.num90RotationInVerticalMode=1,i}return o(e,t),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,n=this._renderTop,o=this._renderWidth,r=this._renderHeight;this._backgroundImage&&(this._tempMeasure.copyFromFloats(i,n,o,r),this.isVertical?(this._tempMeasure.copyFromFloats(i+o*(1-this._barImageHeight)*.5,this._currentMeasure.top,o*this._barImageHeight,r),this._tempMeasure.height+=this._effectiveThumbThickness,this._backgroundImage._currentMeasure.copyFrom(this._tempMeasure)):(this._tempMeasure.copyFromFloats(this._currentMeasure.left,n+r*(1-this._barImageHeight)*.5,o,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),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 i=0;i=this.isVertical?-(e-this._originY)/(this._currentMeasure.height-this._effectiveThumbThickness):(t-this._originX)/(this._currentMeasure.width-this._effectiveThumbThickness),this.value+=i*(this.maximum-this.minimum),this._originX=t,this._originY=e},e.prototype._onPointerDown=function(e,i,n,o,r){return this._first=!0,t.prototype._onPointerDown.call(this,e,i,n,o,r)},r([Object(l.serialize)()],e.prototype,"num90RotationInVerticalMode",void 0),e}(k),X=function(t){function e(e,i){var n=t.call(this,e)||this;return n._barSize=20,n._pointerIsOver=!1,n._wheelPrecision=.05,n._thumbLength=.5,n._thumbHeight=1,n._barImageHeight=1,n._horizontalBarImageHeight=1,n._verticalBarImageHeight=1,n._oldWindowContentsWidth=0,n._oldWindowContentsHeight=0,n._forceHorizontalBar=!1,n._forceVerticalBar=!1,n._useImageBar=i||!1,n.onDirtyObservable.add((function(){n._horizontalBarSpace.color=n.color,n._verticalBarSpace.color=n.color,n._dragSpace.color=n.color})),n.onPointerEnterObservable.add((function(){n._pointerIsOver=!0})),n.onPointerOutObservable.add((function(){n._pointerIsOver=!1})),n._grid=new R,n._useImageBar?(n._horizontalBar=new U,n._verticalBar=new U):(n._horizontalBar=new G,n._verticalBar=new G),n._window=new H("scrollViewer_window"),n._window.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,n._window.verticalAlignment=g.VERTICAL_ALIGNMENT_TOP,n._grid.addColumnDefinition(1),n._grid.addColumnDefinition(0,!0),n._grid.addRowDefinition(1),n._grid.addRowDefinition(0,!0),t.prototype.addControl.call(n,n._grid),n._grid.addControl(n._window,0,0),n._verticalBarSpace=new y,n._verticalBarSpace.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,n._verticalBarSpace.verticalAlignment=g.VERTICAL_ALIGNMENT_TOP,n._verticalBarSpace.thickness=1,n._grid.addControl(n._verticalBarSpace,0,1),n._addBar(n._verticalBar,n._verticalBarSpace,!0,Math.PI),n._horizontalBarSpace=new y,n._horizontalBarSpace.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,n._horizontalBarSpace.verticalAlignment=g.VERTICAL_ALIGNMENT_TOP,n._horizontalBarSpace.thickness=1,n._grid.addControl(n._horizontalBarSpace,1,0),n._addBar(n._horizontalBar,n._horizontalBarSpace,!1,0),n._dragSpace=new y,n._dragSpace.thickness=1,n._grid.addControl(n._dragSpace,1,1),n._useImageBar||(n.barColor="grey",n.barBackground="transparent"),n}return o(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,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,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,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,n=this._window._currentMeasure.height;if(t||this._oldWindowContentsWidth!==i||this._oldWindowContentsHeight!==n){this._oldWindowContentsWidth=i,this._oldWindowContentsHeight=n;var o=this._clientWidth-i,r=this._clientHeight-n,a=this._horizontalBar.value/e*o+"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,n){var o=this;t.paddingLeft=0,t.width="100%",t.height="100%",t.barOffset=0,t.value=0,t.maximum=1,t.horizontalAlignment=g.HORIZONTAL_ALIGNMENT_CENTER,t.verticalAlignment=g.VERTICAL_ALIGNMENT_CENTER,t.isVertical=i,t.rotation=n,t.isVisible=!1,e.addControl(t),t.onValueChangedObservable.add((function(t){o._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)},e}(y);Object(l.RegisterClass)("BABYLON.GUI.ScrollViewer",X);var Y=function(t){function e(e,i){var n=t.call(this,e)||this;n.name=e,n.onIsActiveChangedObservable=new l.Observable,n.delegatePickingToChildren=!1,n._isActive=!1,n.group=null!=i?i:"",n.thickness=0,n.isPointerBlocker=!0;var o=null;return n.toActiveAnimation=function(){n.thickness=1},n.toInactiveAnimation=function(){n.thickness=0},n.pointerEnterActiveAnimation=function(){o=n.alpha,n.alpha-=.1},n.pointerOutActiveAnimation=function(){null!==o&&(n.alpha=o)},n.pointerDownActiveAnimation=function(){n.scaleX-=.05,n.scaleY-=.05},n.pointerUpActiveAnimation=function(){n.scaleX+=.05,n.scaleY+=.05},n.pointerEnterInactiveAnimation=function(){o=n.alpha,n.alpha-=.1},n.pointerOutInactiveAnimation=function(){null!==o&&(n.alpha=o)},n.pointerDownInactiveAnimation=function(){n.scaleX-=.05,n.scaleY-=.05},n.pointerUpInactiveAnimation=function(){n.scaleX+=.05,n.scaleY+=.05},n}return o(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,n=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===n)return;var e=t;e.group===n.group&&(e.isActive=!1)}})))},enumerable:!1,configurable:!0}),e.prototype._getTypeName=function(){return"ToggleButton"},e.prototype._processPicking=function(e,i,n,o,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(o,e,i,n,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,n){void 0===n&&(n=!1),this.isReadOnly||(this._isActive?this.pointerOutActiveAnimation&&this.pointerOutActiveAnimation():this.pointerOutInactiveAnimation&&this.pointerOutInactiveAnimation()),t.prototype._onPointerOut.call(this,e,i,n)},e.prototype._onPointerDown=function(e,i,n,o,r){return!!t.prototype._onPointerDown.call(this,e,i,n,o,r)&&(this.isReadOnly||(this._isActive?this.pointerDownActiveAnimation&&this.pointerDownActiveAnimation():this.pointerDownInactiveAnimation&&this.pointerDownInactiveAnimation()),!0)},e.prototype._onPointerUp=function(e,i,n,o,r,a){this.isReadOnly||(this._isActive?this.pointerUpActiveAnimation&&this.pointerUpActiveAnimation():this.pointerUpInactiveAnimation&&this.pointerUpInactiveAnimation()),t.prototype._onPointerUp.call(this,e,i,n,o,r,a)},e}(y);Object(l.RegisterClass)("BABYLON.GUI.ToggleButton",Y);var Z=function(){},K=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.onKeyPressObservable=new l.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 o(e,t),e.prototype._getTypeName=function(){return"VirtualKeyboard"},e.prototype._createKey=function(t,e){var i=this,n=O.CreateSimpleButton(t,t);return n.width=e&&e.width?e.width:this.defaultButtonWidth,n.height=e&&e.height?e.height:this.defaultButtonHeight,n.color=e&&e.color?e.color:this.defaultButtonColor,n.background=e&&e.background?e.background:this.defaultButtonBackground,n.paddingLeft=e&&e.paddingLeft?e.paddingLeft:this.defaultButtonPaddingLeft,n.paddingRight=e&&e.paddingRight?e.paddingRight:this.defaultButtonPaddingRight,n.paddingTop=e&&e.paddingTop?e.paddingTop:this.defaultButtonPaddingTop,n.paddingBottom=e&&e.paddingBottom?e.paddingBottom:this.defaultButtonPaddingBottom,n.thickness=0,n.isFocusInvisible=!0,n.shadowColor=this.shadowColor,n.shadowBlur=this.shadowBlur,n.shadowOffsetX=this.shadowOffsetX,n.shadowOffsetY=this.shadowOffsetY,n.onPointerUpObservable.add((function(){i.onKeyPressObservable.notifyObservers(t)})),n},e.prototype.addKeysRow=function(t,e){var i=new B;i.isVertical=!1,i.isFocusInvisible=!0;for(var n=null,o=0;o<t.length;o++){var r=null;e&&e.length===t.length&&(r=e[o]);var a=this._createKey(t[o],r);(!n||a.heightInPixels>n.heightInPixels)&&(n=a),i.addControl(a)}i.height=n?n.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 n=i,o=0;o<n.children.length;o++){var r=n.children[o];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.processKey(8);case"↵":return void e._currentlyConnectedInputText.processKey(13)}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})),n=t.onBlurObservable.add((function(){t._connectedVirtualKeyboard=null,e._currentlyConnectedInputText=null,e.isVisible=!1}));this._connectedInputTexts.push({input:t,onBlurObserver:n,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=[];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}(B);Object(l.RegisterClass)("BABYLON.GUI.VirtualKeyboard",K);var q=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 o(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,e){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 i=this._currentMeasure.width/this._cellWidth,n=this._currentMeasure.height/this._cellHeight,o=this._currentMeasure.left+this._currentMeasure.width/2,r=this._currentMeasure.top+this._currentMeasure.height/2;if(this._displayMinorLines){t.strokeStyle=this._minorLineColor,t.lineWidth=this._minorLineTickness;for(var a=-i/2+1;a<i/2;a++){var s=o+a*this.cellWidth;t.beginPath(),t.moveTo(s,this._currentMeasure.top),t.lineTo(s,this._currentMeasure.top+this._currentMeasure.height),t.stroke()}for(var l=-n/2+1;l<n/2;l++){var _=r+l*this.cellHeight;t.beginPath(),t.moveTo(this._currentMeasure.left,_),t.lineTo(this._currentMeasure.left+this._currentMeasure.width,_),t.stroke()}}if(this._displayMajorLines){t.strokeStyle=this._majorLineColor,t.lineWidth=this._majorLineTickness;for(a=-i/2+this._majorLineFrequency;a<i/2;a+=this._majorLineFrequency){s=o+a*this.cellWidth;t.beginPath(),t.moveTo(s,this._currentMeasure.top),t.lineTo(s,this._currentMeasure.top+this._currentMeasure.height),t.stroke()}for(l=-n/2+this._majorLineFrequency;l<n/2;l+=this._majorLineFrequency){_=r+l*this.cellHeight;t.moveTo(this._currentMeasure.left,_),t.lineTo(this._currentMeasure.left+this._currentMeasure.width,_),t.closePath(),t.stroke()}}}t.restore()},e.prototype._getTypeName=function(){return"DisplayGrid"},r([Object(l.serialize)()],e.prototype,"displayMinorLines",null),r([Object(l.serialize)()],e.prototype,"displayMajorLines",null),r([Object(l.serialize)()],e.prototype,"background",null),r([Object(l.serialize)()],e.prototype,"cellWidth",null),r([Object(l.serialize)()],e.prototype,"cellHeight",null),r([Object(l.serialize)()],e.prototype,"minorLineTickness",null),r([Object(l.serialize)()],e.prototype,"minorLineColor",null),r([Object(l.serialize)()],e.prototype,"majorLineTickness",null),r([Object(l.serialize)()],e.prototype,"majorLineColor",null),r([Object(l.serialize)()],e.prototype,"majorLineFrequency",null),e}(g);Object(l.RegisterClass)("BABYLON.GUI.DisplayGrid",q);var J=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._tempMeasure=new f(0,0,0,0),i}return o(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,e){t.save(),this._applyStates(t),this._prepareRenderingData("rectangle");var i=this._getThumbPosition(),n=this._renderLeft,o=this._renderTop,r=this._renderWidth,a=this._renderHeight;this._backgroundImage&&(this._tempMeasure.copyFromFloats(n,o,r,a),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(n,o+i,r,a-i+this._effectiveThumbThickness):this._tempMeasure.copyFromFloats(n,o+i,r,a-i):this.isThumbClamped&&this.displayThumb?this._tempMeasure.copyFromFloats(n,o,i+this._effectiveThumbThickness/2,a):this._tempMeasure.copyFromFloats(n,o,i,a),this._valueBarImage._currentMeasure.copyFrom(this._tempMeasure),this._valueBarImage._draw(t)),this.displayThumb&&(this.isVertical?this._tempMeasure.copyFromFloats(n-this._effectiveBarOffset,this._currentMeasure.top+i,this._currentMeasure.width,this._effectiveThumbThickness):this._tempMeasure.copyFromFloats(this._currentMeasure.left+i,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={},n={},o={};this.backgroundImage.serialize(i),this.thumbImage.serialize(n),this.valueBarImage.serialize(o),e.backgroundImage=i,e.thumbImage=n,e.valueBarImage=o},e.prototype._parseFromContent=function(e,i){t.prototype._parseFromContent.call(this,e,i),this.backgroundImage=P.Parse(e.backgroundImage,i),this.thumbImage=P.Parse(e.thumbImage,i),this.valueBarImage=P.Parse(e.valueBarImage,i)},r([Object(l.serialize)()],e.prototype,"displayThumb",null),e}(k);Object(l.RegisterClass)("BABYLON.GUI.ImageBasedSlider",J);var $="Statics";g.AddHeader=function(t,e,i,n){var o=new B("panel"),r=!n||n.isHorizontal,a=!n||n.controlFirst;o.isVertical=!r;var s=new x("header");return s.text=e,s.textHorizontalAlignment=g.HORIZONTAL_ALIGNMENT_LEFT,r?s.width=i:s.height=i,a?(o.addControl(t),o.addControl(s),s.paddingLeft="5px"):(o.addControl(s),o.addControl(t),s.paddingRight="5px"),s.shadowBlur=t.shadowBlur,s.shadowColor=t.shadowColor,s.shadowOffsetX=t.shadowOffsetX,s.shadowOffsetY=t.shadowOffsetY,o};var tt=function(){function t(t){this._fontFamily="Arial",this._fontStyle="",this._fontWeight="",this._fontSize=new _(18,_.UNITMODE_PIXEL,!1),this.onChangedObservable=new l.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}(),et=function(t){function e(e,i,n,o,r,a,s){void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=!1),void 0===a&&(a=l.Texture.NEAREST_SAMPLINGMODE),void 0===s&&(s=!0);var _=t.call(this,e,{width:i,height:n},o,r,a,l.Constants.TEXTUREFORMAT_RGBA,s)||this;return _._isDirty=!1,_._rootContainer=new m("root"),_._lastControlOver={},_._lastControlDown={},_._capturingControl={},_._linkedControls=new Array,_._isFullscreen=!1,_._fullscreenViewport=new l.Viewport(0,0,1,1),_._idealWidth=0,_._idealHeight=0,_._useSmallestIdeal=!1,_._renderAtIdealSize=!1,_._blockNextFocusCheck=!1,_._renderScale=1,_._cursorChanged=!1,_._defaultMousePointerId=0,_._numLayoutCalls=0,_._numRenderCalls=0,_._clipboardData="",_.onClipboardObservable=new l.Observable,_.onControlPickedObservable=new l.Observable,_.onBeginLayoutObservable=new l.Observable,_.onEndLayoutObservable=new l.Observable,_.onBeginRenderObservable=new l.Observable,_.onEndRenderObservable=new l.Observable,_.premulAlpha=!1,_.applyYInversionOnUpdate=!0,_._useInvalidateRectOptimization=!0,_._invalidatedRectangle=null,_._clearMeasure=new f(0,0,0,0),_.onClipboardCopy=function(t){var e=t,i=new l.ClipboardInfo(l.ClipboardEventTypes.COPY,e);_.onClipboardObservable.notifyObservers(i),e.preventDefault()},_.onClipboardCut=function(t){var e=t,i=new l.ClipboardInfo(l.ClipboardEventTypes.CUT,e);_.onClipboardObservable.notifyObservers(i),e.preventDefault()},_.onClipboardPaste=function(t){var e=t,i=new l.ClipboardInfo(l.ClipboardEventTypes.PASTE,e);_.onClipboardObservable.notifyObservers(i),e.preventDefault()},(o=_.getScene())&&_._texture?(_.applyYInversionOnUpdate=s,_._rootElement=o.getEngine().getInputElement(),_._renderObserver=o.onBeforeCameraRenderObservable.add((function(t){return _._checkUpdate(t)})),_._preKeyboardObserver=o.onPreKeyboardObservable.add((function(t){_._focusedControl&&(t.type===l.KeyboardEventTypes.KEYDOWN&&_._focusedControl.processKeyboard(t.event),t.skipOnPointerObservable=!0)})),_._rootContainer._link(_),_.hasAlpha=!0,i&&n||(_._resizeObserver=o.getEngine().onResizeObservable.add((function(){return _._onResize()})),_._onResize()),_._texture.isReady=!0,_):_}return o(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,n=e.children;i<n.length;i++){var o=n[i];o.children?this.executeOnAllControls(t,o):t(o)}},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,n){if(this._useInvalidateRectOptimization)if(this._invalidatedRectangle){var o=Math.ceil(Math.max(this._invalidatedRectangle.left+this._invalidatedRectangle.width-1,i)),r=Math.ceil(Math.max(this._invalidatedRectangle.top+this._invalidatedRectangle.height-1,n));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=o-this._invalidatedRectangle.left+1,this._invalidatedRectangle.height=r-this._invalidatedRectangle.top+1}else this._invalidatedRectangle=new f(t,e,i-t+1,n-e+1)},e.prototype.markAsDirty=function(){this._isDirty=!0},e.prototype.createStyle=function(){return new tt(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,n){var o;if(void 0===i&&(i=1),void 0===n&&(n=1),Array.isArray(t))o=t;else{var r=this.getDescendants(!0);o=void 0===t?r.filter((function(t){return void 0!==t.overlapGroup})):r.filter((function(e){return e.overlapGroup===t}))}o.forEach((function(t){var r,a=l.Vector2.Zero(),s=new l.Vector2(t.centerX,t.centerY);o.forEach((function(i){if(t!==i&&e._Overlaps(t,i)){var o=s.subtract(new l.Vector2(i.centerX,i.centerY)),r=o.length();r>0&&(a=a.add(o.normalize().scale(n/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._pointerMoveObserver&&e.onPrePointerObservable.remove(this._pointerMoveObserver),this._pointerObserver&&e.onPointerObservable.remove(this._pointerObserver),this._preKeyboardObserver&&e.onPreKeyboardObservable.remove(this._preKeyboardObserver),this._canvasPointerOutObserver&&e.getEngine().onCanvasPointerOutObservable.remove(this._canvasPointerOutObserver),this._canvasBlurObserver&&e.getEngine().onCanvasBlurObservable.remove(this._canvasBlurObserver),this._layerToDispose&&(this._layerToDispose.texture=null,this._layerToDispose.dispose(),this._layerToDispose=null),this._rootContainer.dispose(),this.onClipboardObservable.clear(),this.onControlPickedObservable.clear(),this.onBeginRenderObservable.clear(),this.onEndRenderObservable.clear(),this.onBeginLayoutObservable.clear(),this.onEndLayoutObservable.clear(),t.prototype.dispose.call(this))},e.prototype._onResize=function(){var t=this.getScene();if(t){var e=t.getEngine(),i=this.getSize(),n=e.getRenderWidth()*this._renderScale,o=e.getRenderHeight()*this._renderScale;this._renderAtIdealSize&&(this._idealWidth?(o=o*this._idealWidth/n,n=this._idealWidth):this._idealHeight&&(n=n*this._idealHeight/o,o=this._idealHeight)),i.width===n&&i.height===o||(this.scaleTo(n,o),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();return this._fullscreenViewport.toGlobal(t.width,t.height)},e.prototype.getProjectedPosition=function(t,e){var i=this.getProjectedPositionWithZ(t,e);return new l.Vector2(i.x,i.y)},e.prototype.getProjectedPositionWithZ=function(t,e){var i=this.getScene();if(!i)return l.Vector3.Zero();var n=this._getGlobalViewport(),o=l.Vector3.Project(t,e,i.getTransformMatrix(),n);return new l.Vector3(o.x,o.y,o.z)},e.prototype._checkUpdate=function(t){if(!this._layerToDispose||0!=(t.layerMask&this._layerToDispose.layerMask)){if(this._isFullscreen&&this._linkedControls.length){var i=this.getScene();if(!i)return;for(var n=this._getGlobalViewport(),o=function(t){if(!t.isVisible)return"continue";var e=t._linkedMesh;if(!e||e.isDisposed())return l.Tools.SetImmediate((function(){t.linkWithMesh(null)})),"continue";var o=e.getBoundingInfo?e.getBoundingInfo().boundingSphere.center:l.Vector3.ZeroReadOnly,r=l.Vector3.Project(o,e.getWorldMatrix(),i.getTransformMatrix(),n);if(r.z<0||r.z>1)return t.notRenderable=!0,"continue";t.notRenderable=!1,t._moveToProjectedPosition(r)},r=0,a=this._linkedControls;r<a.length;r++){o(a[r])}}(this._isDirty||this._rootContainer.isDirty)&&(this._isDirty=!1,this._render(),this.update(this.applyYInversionOnUpdate,this.premulAlpha,e.AllowGPUOptimizations))}},e.prototype._render=function(){var t=this.getSize(),e=t.width,i=t.height,n=this.getContext();n.font="18px Arial",n.strokeStyle="white",this.onBeginLayoutObservable.notifyObservers(this);var o=new f(0,0,e,i);this._numLayoutCalls=0,this._rootContainer._layout(o,n),this.onEndLayoutObservable.notifyObservers(this),this._isDirty=!1,this._invalidatedRectangle?this._clearMeasure.copyFrom(this._invalidatedRectangle):this._clearMeasure.copyFromFloats(0,0,e,i),n.clearRect(this._clearMeasure.left,this._clearMeasure.top,this._clearMeasure.width,this._clearMeasure.height),this._background&&(n.save(),n.fillStyle=this._background,n.fillRect(this._clearMeasure.left,this._clearMeasure.top,this._clearMeasure.width,this._clearMeasure.height),n.restore()),this.onBeginRenderObservable.notifyObservers(this),this._numRenderCalls=0,this._rootContainer._render(n,this._invalidatedRectangle),this.onEndRenderObservable.notifyObservers(this),this._invalidatedRectangle=null},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,n,o,r,a,s){var _=this.getScene();if(_){var h=_.getEngine(),c=this.getSize();if(this._isFullscreen){var u=_.cameraToUseForPointers||_.activeCamera;if(!u)return;var d=u.viewport;t*=c.width/(h.getRenderWidth()*d.width),e*=c.height/(h.getRenderHeight()*d.height)}this._capturingControl[o]?this._capturingControl[o]._processObservables(n,t,e,i,o,r):(this._cursorChanged=!1,this._rootContainer._processPicking(t,e,i,n,o,r,a,s)||(_.doNotHandleCursors||this._changeCursor(""),n===l.PointerEventTypes.POINTERMOVE&&this._lastControlOver[o]&&(this._lastControlOver[o]._onPointerOut(this._lastControlOver[o],i),delete this._lastControlOver[o])),this._cursorChanged||_.doNotHandleCursors||this._changeCursor(""),this._manageFocus())}},e.prototype._cleanControlAfterRemovalFromList=function(t,e){for(var i in t){if(t.hasOwnProperty(i))t[i]===e&&delete t[i]}},e.prototype._cleanControlAfterRemoval=function(t){this._cleanControlAfterRemovalFromList(this._lastControlDown,t),this._cleanControlAfterRemovalFromList(this._lastControlOver,t)},e.prototype.attach=function(){var t=this,e=this.getScene();if(e){var i=new l.Viewport(0,0,0,0);this._pointerMoveObserver=e.onPrePointerObservable.add((function(n,o){if(!e.isPointerCaptured(n.event.pointerId)&&(n.type===l.PointerEventTypes.POINTERMOVE||n.type===l.PointerEventTypes.POINTERUP||n.type===l.PointerEventTypes.POINTERDOWN||n.type===l.PointerEventTypes.POINTERWHEEL)){n.type===l.PointerEventTypes.POINTERMOVE&&n.event.pointerId&&(t._defaultMousePointerId=n.event.pointerId);var r=e.cameraToUseForPointers||e.activeCamera,a=e.getEngine();r?r.viewport.toGlobalToRef(a.getRenderWidth(),a.getRenderHeight(),i):(i.x=0,i.y=0,i.width=a.getRenderWidth(),i.height=a.getRenderHeight());var s=e.pointerX/a.getHardwareScalingLevel()-i.x,_=e.pointerY/a.getHardwareScalingLevel()-(a.getRenderHeight()-i.y-i.height);t._shouldBlockPointer=!1;var h=n.event.pointerId||t._defaultMousePointerId;t._doPicking(s,_,n,n.type,h,n.event.button,n.event.deltaX,n.event.deltaY),t._shouldBlockPointer&&(n.skipOnPointerObservable=t._shouldBlockPointer)}})),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.attachToMesh=function(t,e){var i=this;void 0===e&&(e=!0);var n=this.getScene();n&&(this._pointerObserver=n.onPointerObservable.add((function(e,n){if(e.type===l.PointerEventTypes.POINTERMOVE||e.type===l.PointerEventTypes.POINTERUP||e.type===l.PointerEventTypes.POINTERDOWN||e.type===l.PointerEventTypes.POINTERWHEEL){e.type===l.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 r=e.pickInfo.getTextureCoordinates();if(r){var a=i.getSize();i._doPicking(r.x*a.width,(i.applyYInversionOnUpdate?1-r.y:r.y)*a.height,e,e.type,o,e.event.button,e.event.deltaX,e.event.deltaY)}}else if(e.type===l.PointerEventTypes.POINTERUP){if(i._lastControlDown[o]&&i._lastControlDown[o]._forcePointerUp(o),delete i._lastControlDown[o],i.focusedControl){var s=i.focusedControl.keepsFocusWith(),_=!0;if(s)for(var h=0,c=s;h<c.length;h++){var u=c[h];if(i!==u._host){var d=u._host;if(d._lastControlOver[o]&&d._lastControlOver[o].isAscendant(u)){_=!1;break}}}_&&(i.focusedControl=null)}}else e.type===l.PointerEventTypes.POINTERMOVE&&(i._lastControlOver[o]&&i._lastControlOver[o]._onPointerOut(i._lastControlOver[o],e,!0),delete i._lastControlOver[o])}})),t.enablePointerMoveEvents=e,this._attachToOnPointerOut(n),this._attachToOnBlur(n))},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._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(),delete e._lastControlDown[t.pointerId])}))},e.prototype._attachToOnBlur=function(t){var e=this;this._canvasBlurObserver=t.getEngine().onCanvasBlurObservable.add((function(t){Object.entries(e._lastControlDown).forEach((function(t){t[0];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.parseContent=function(t,e){if(this._rootContainer=g.Parse(t.root,this),e){var i=t.width,n=t.height;"number"==typeof i&&"number"==typeof n&&i>=0&&n>=0&&this.scaleTo(i,n)}},e.prototype.parseFromSnippetAsync=function(t,i){var n=this;return"_BLANK"===t?Promise.resolve():new Promise((function(o,r){var a=new l.WebRequest;a.addEventListener("readystatechange",(function(){if(4==a.readyState)if(200==a.status){var e=JSON.parse(JSON.parse(a.responseText).jsonPayload),s=JSON.parse(e.gui);n.parseContent(s,i),n.snippetId=t,o()}else r("Unable to load the snippet "+t)})),a.open("GET",e.SnippetUrl+"/"+t.replace(/#/g,"/")),a.send()}))},e.prototype.parseFromURLAsync=function(t,e){var i=this;return""===t?Promise.resolve():new Promise((function(n,o){var r=new l.WebRequest;r.addEventListener("readystatechange",(function(){if(4==r.readyState)if(200==r.status){var t=r.responseText,a=JSON.parse(t);i.parseContent(a,e),n()}else o("Unable to load")})),r.open("GET",t),r.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,n,o,r,a){void 0===i&&(i=1024),void 0===n&&(n=1024),void 0===o&&(o=!0),void 0===r&&(r=!1);var s=new e(t.name+" AdvancedDynamicTexture",i,n,t.getScene(),!0,l.Texture.TRILINEAR_SAMPLINGMODE,a),_=new l.StandardMaterial("AdvancedDynamicTextureMaterial",t.getScene());return _.backFaceCulling=!1,_.diffuseColor=l.Color3.Black(),_.specularColor=l.Color3.Black(),r?(_.diffuseTexture=s,_.emissiveTexture=s,s.hasAlpha=!0):(_.emissiveTexture=s,_.opacityTexture=s),t.material=_,s.attachToMesh(t,o),s},e.CreateForMeshTexture=function(t,i,n,o,r){void 0===i&&(i=1024),void 0===n&&(n=1024),void 0===o&&(o=!0);var a=new e(t.name+" AdvancedDynamicTexture",i,n,t.getScene(),!0,l.Texture.TRILINEAR_SAMPLINGMODE,r);return a.attachToMesh(t,o),a},e.CreateFullscreenUI=function(t,i,n,o){void 0===i&&(i=!0),void 0===n&&(n=null),void 0===o&&(o=l.Texture.BILINEAR_SAMPLINGMODE);var r=new e(t,0,0,n,!1,o),a=new l.Layer(t+"_layer",null,n,!i);return a.texture=r,r._layerToDispose=a,r._isFullscreen=!0,r.attach(),r},e.SnippetUrl="https://snippet.babylonjs.com",e.AllowGPUOptimizations=!0,e}(l.DynamicTexture),it=function(){function t(t){this.texture=t,this._captureRenderTime=!1,this._renderTime=new l.PerfCounter,this._captureLayoutTime=!1,this._layoutTime=new l.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}(),nt=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 n=0;n<i.length;n++)e=e[i[n]];return e},t.prototype._getClassAttribute=function(t){var e=t.split(".");return Object(l.GetClass)("BABYLON.GUI."+e[0])[e[1]]},t.prototype._createGuiElement=function(t,e,i){void 0===i&&(i=!0);try{var n=new(Object(l.GetClass)("BABYLON.GUI."+t.nodeName));e&&i&&e.addControl(n);for(var o=0;o<t.attributes.length;o++)if(!t.attributes[o].name.toLowerCase().includes("datasource"))if(t.attributes[o].name.toLowerCase().includes("observable")){var r=this._getChainElement(t.attributes[o].value);n[t.attributes[o].name].add(r)}else if("linkWithMesh"==t.attributes[o].name)this._parentClass?n.linkWithMesh(this._parentClass[t.attributes[o].value]):n.linkWithMesh(window[t.attributes[o].value]);else if(t.attributes[o].value.startsWith("{{")&&t.attributes[o].value.endsWith("}}")){r=this._getChainElement(t.attributes[o].value.substring(2,t.attributes[o].value.length-2));n[t.attributes[o].name]=r}else this._objectAttributes[t.attributes[o].name]?n[t.attributes[o].name]=this._getClassAttribute(t.attributes[o].value):"true"==t.attributes[o].value||"false"==t.attributes[o].value?n[t.attributes[o].name]="true"==t.attributes[o].value:n[t.attributes[o].name]=isNaN(Number(t.attributes[o].value))?t.attributes[o].value:Number(t.attributes[o].value);if(!t.attributes.getNamedItem("id"))return this._nodes[t.nodeName+Object.keys(this._nodes).length+"_gen"]=n,n;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]=n,n}catch(e){throw"XmlLoader Exception : Error parsing Control "+t.nodeName+","+e+"."}},t.prototype._parseGrid=function(t,e,i){for(var n,o,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";o=Number(l[d].attributes.getNamedItem("height").nodeValue),_=!!l[d].attributes.getNamedItem("isPixel")&&JSON.parse(l[d].attributes.getNamedItem("isPixel").nodeValue),e.addRowDefinition(o,_);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";n=Number(r[f].attributes.getNamedItem("width").nodeValue),_=!!r[f].attributes.getNamedItem("isPixel")&&JSON.parse(r[f].attributes.getNamedItem("isPixel").nodeValue),e.addColumnDefinition(n,_)}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,n,o){this._parentClass?this._parentClass[i]=n[o]:window[i]=n[o],t.firstChild&&this._parseXml(t.firstChild,e,!0)},t.prototype._parseElementsFromSource=function(t,e,i){var n=t.attributes.getNamedItem("dataSource").value;if(!n.includes(" in "))throw"XmlLoader Exception : Malformed XML, Data Source must include an in";var o=!0,r=n.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("}")&&(o=!1),(!o||a.startsWith("[")&&a.endsWith("]"))&&(a=a.substring(1,a.length-1)),a=this._parentClass?this._parentClass[a]:window[a],o)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 n=this._createGuiElement(t,e);this._rootNode||(this._rootNode=n),"Grid"==t.nodeName?this._parseGrid(t,n,e):t.attributes.getNamedItem("dataSource")?this._parseElementsFromSource(t,n,e):this._parseElement(t,n,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,n){var o=this;void 0===i&&(i=null),void 0===n&&(n=null);var r=new XMLHttpRequest;r.onload=function(){if(4===r.readyState&&200===r.status){if(!r.responseXML)throw"XmlLoader Exception : XML file is malformed or corrupted.";var t=r.responseXML.documentElement;o._parseXml(t.firstChild,e),o._isLoaded=!0,i&&i()}},r.onerror=function(){n&&n("an error occurred during loading the layout")},r.open("GET",t,!0),r.send()},t.prototype.loadLayoutAsync=function(t,e){return a(this,void 0,void 0,(function(){var i=this;return s(this,(function(n){return[2,new Promise((function(n,o){i.loadLayout(t,e,n,o)}))]}))}))},t}(),ot=function(t){function e(e,i){void 0===i&&(i=0);var n=t.call(this,e.x,e.y,e.z)||this;return n.buttonIndex=i,n}return o(e,t),e}(l.Vector3),rt=function(){function t(t){this.name=t,this._downCount=0,this._enterCount=-1,this._downPointerIds={},this._isVisible=!0,this.onPointerMoveObservable=new l.Observable,this.onPointerOutObservable=new l.Observable,this.onPointerDownObservable=new l.Observable,this.onPointerUpObservable=new l.Observable,this.onPointerClickObservable=new l.Observable,this.onPointerEnterObservable=new l.Observable,this._behaviors=new Array}return Object.defineProperty(t.prototype,"position",{get:function(){return this._node?this._node.position:l.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 l.Vector3(1,1,1)},set:function(t){this._node&&(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 n=i[e];if(n.name===t)return n}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 l.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,n){return this._downCount++,this._downPointerIds[i]=this._downPointerIds[i]+1||1,1===this._downCount&&(this.onPointerDownObservable.notifyObservers(new ot(e,n),-1,t,this),this.pointerDownAnimation&&this.pointerDownAnimation(),!0)},t.prototype._onPointerUp=function(t,e,i,n,o){this._downCount--,this._downPointerIds[i]--,this._downPointerIds[i]<=0&&delete this._downPointerIds[i],this._downCount<0?this._downCount=0:0==this._downCount&&(o&&(this._enterCount>0||-1===this._enterCount)&&this.onPointerClickObservable.notifyObservers(new ot(e,n),-1,t,this),this.onPointerUpObservable.notifyObservers(new ot(e,n),-1,t,this),this.pointerUpAnimation&&this.pointerUpAnimation())},t.prototype.forcePointerUp=function(t){if(void 0===t&&(t=null),null!==t)this._onPointerUp(this,l.Vector3.Zero(),t,0,!0);else{for(var e in this._downPointerIds)this._onPointerUp(this,l.Vector3.Zero(),+e,0,!0);this._downCount>0&&(this._downCount=1,this._onPointerUp(this,l.Vector3.Zero(),0,0,!0))}},t.prototype._processObservables=function(t,e,i,n,o){if(this._IsTouchButton3D(this)&&i&&(t=this._generatePointerEventType(t,i,this._downCount)),t===l.PointerEventTypes.POINTERMOVE){this._onPointerMove(this,e);var r=this._host._lastControlOver[n];return r&&r!==this&&r._onPointerOut(this),r!==this&&this._onPointerEnter(this),this._host._lastControlOver[n]=this,!0}return t===l.PointerEventTypes.POINTERDOWN?(this._onPointerDown(this,e,n,o),this._host._lastControlDown[n]=this,this._host._lastPickedControl=this,!0):(t===l.PointerEventTypes.POINTERUP||t===l.PointerEventTypes.POINTERDOUBLETAP)&&(this._host._lastControlDown[n]&&this._host._lastControlDown[n]._onPointerUp(this,e,n,o,!0),delete this._host._lastControlDown[n],!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}(),at=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._contentResolution=512,e._contentScaleRatio=2,e}return o(e,t),Object.defineProperty(e.prototype,"content",{get:function(){return this._content},set:function(t){this._content=t,this._host&&this._host.utilityLayer&&(this._facadeTexture?this._facadeTexture.rootContainer.clearControls():(this._facadeTexture=new et("Facade",this._contentResolution,this._contentResolution,this._host.utilityLayer.utilityLayerScene,!0,l.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}(rt),st=function(t){function e(e){return t.call(this,e)||this}return o(e,t),e.prototype._getTypeName=function(){return"AbstractButton3D"},e.prototype._createNode=function(t){return new l.TransformNode("button"+this.name)},e}(at),lt=function(t){function e(e){var i=t.call(this,e)||this;return i.pointerEnterAnimation=function(){i.mesh&&(i._currentMaterial.emissiveColor=l.Color3.Red())},i.pointerOutAnimation=function(){i._currentMaterial.emissiveColor=l.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 o(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 l.Vector4(0,0,0,0);return e[1]=new l.Vector4(0,0,1,1),Object(l.CreateBox)(this.name+"_rootMesh",{width:1,height:1,depth:.08,faceUV:e},t)},e.prototype._affectMaterial=function(t){var e=new l.StandardMaterial(this.name+"Material",t.getScene());e.specularColor=l.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}(st),_t=function(t){function e(e){var i=t.call(this,e)||this;return i._blockLayout=!1,i._children=new Array,i}return o(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 l.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=[],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}(rt),ht=function(t){function e(e){var i=t.call(this,e)||this;return i._columns=10,i._rows=0,i._rowThenColum=!0,i._orientation=_t.FACEORIGIN_ORIENTATION,i.margin=0,i}return o(e,t),Object.defineProperty(e.prototype,"orientation",{get:function(){return this._orientation},set:function(t){var e=this;this._orientation!==t&&(this._orientation=t,l.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,l.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,l.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,n=l.Matrix.Invert(this.node.computeWorldMatrix(!0)),o=0,r=this._children;o<r.length;o++){if((m=r[o]).mesh){i++,m.mesh.computeWorldMatrix(!0);var a=m.mesh.getHierarchyBoundingVectors(),s=l.TmpVectors.Vector3[0],_=l.TmpVectors.Vector3[1];a.max.subtractToRef(a.min,_),_.scaleInPlace(.5),l.Vector3.TransformNormalToRef(_,n,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 l.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 l.Vector3(p*this._cellWidth-h+this._cellWidth/2,f*this._cellHeight-c+this._cellHeight/2,0)),!(++d>i));f++);d=0;for(var b=0,g=this._children;b<g.length;b++){var m;(m=g[b]).mesh&&(this._mapGridNode(m,u[d]),d++)}this._finalProcessing()},e.prototype._finalProcessing=function(){},e}(_t),ct=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._radius=5,e}return o(e,t),Object.defineProperty(e.prototype,"radius",{get:function(){return this._radius},set:function(t){var e=this;this._radius!==t&&(this._radius=t,l.Tools.SetImmediate((function(){e._arrangeChildren()})))},enumerable:!1,configurable:!0}),e.prototype._mapGridNode=function(t,e){var i=t.mesh;if(i){var n=this._cylindricalMapping(e);switch(t.position=n,this.orientation){case _t.FACEORIGIN_ORIENTATION:i.lookAt(new l.Vector3(2*n.x,n.y,2*n.z));break;case _t.FACEORIGINREVERSED_ORIENTATION:i.lookAt(new l.Vector3(-n.x,n.y,-n.z));break;case _t.FACEFORWARD_ORIENTATION:break;case _t.FACEFORWARDREVERSED_ORIENTATION:i.rotate(l.Axis.Y,Math.PI,l.Space.LOCAL)}}},e.prototype._cylindricalMapping=function(t){var e=new l.Vector3(0,t.y,this._radius),i=t.x/this._radius;return l.Matrix.RotationYawPitchRollToRef(i,0,0,l.TmpVectors.Matrix[0]),l.Vector3.TransformNormal(e,l.TmpVectors.Matrix[0])},e}(ht),ut="precision highp float;\n\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n\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";l.ShaderStore.ShadersStore.fluentVertexShader=ut;var dt="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\n\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}";l.ShaderStore.ShadersStore.fluentPixelShader=dt;var ft=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 o(e,t),e}(l.MaterialDefines),pt=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n.innerGlowColorIntensity=.5,n.innerGlowColor=new l.Color3(1,1,1),n.albedoColor=new l.Color3(.3,.35,.4),n.renderBorders=!1,n.borderWidth=.5,n.edgeSmoothingValue=.02,n.borderMinValue=.1,n.renderHoverLight=!1,n.hoverRadius=1,n.hoverColor=new l.Color4(.3,.3,.3,1),n.hoverPosition=l.Vector3.Zero(),n}return o(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,i){if(this.isFrozen&&e.effect&&e.effect._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new ft);var n=this.getScene(),o=e.materialDefines;if(!this.checkReadyOnEveryCall&&e.effect&&o._renderId===n.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 r=n.getEngine();if(o.isDirty){o.markAsProcessed(),n.resetCachedMaterial();var a=[l.VertexBuffer.PositionKind];a.push(l.VertexBuffer.NormalKind),a.push(l.VertexBuffer.UVKind);var s=["world","viewProjection","innerGlowColor","albedoColor","borderWidth","edgeSmoothingValue","scaleFactor","borderMinValue","hoverColor","hoverPosition","hoverRadius","textureMatrix"],_=["albedoSampler"],h=new Array;l.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:s,uniformBuffersNames:h,samplers:_,defines:o,maxSimultaneousLights:4});var c=o.toString();e.setEffect(n.getEngine().createEffect("fluent",{attributes:a,uniformsNames:s,uniformBuffersNames:h,samplers:_,defines:c,fallbacks:null,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},r),o,this._materialContext)}return!(!e.effect||!e.effect.isReady())&&(o._renderId=n.getRenderId(),e.effect._wasPreviouslyReady=!0,!0)},e.prototype.bindForSubMesh=function(t,e,i){var n=this.getScene(),o=i.materialDefines;if(o){var r=i.effect;if(r){if(this._activeEffect=r,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),this._mustRebind(n,r)&&(this._activeEffect.setColor4("albedoColor",this.albedoColor,this.alpha),o.INNERGLOW&&this._activeEffect.setColor4("innerGlowColor",this.innerGlowColor,this.innerGlowColorIntensity),o.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,l.TmpVectors.Vector3[0]),this._activeEffect.setVector3("scaleFactor",l.TmpVectors.Vector3[0])),o.HOVERLIGHT&&(this._activeEffect.setDirectColor4("hoverColor",this.hoverColor),this._activeEffect.setFloat("hoverRadius",this.hoverRadius),this._activeEffect.setVector3("hoverPosition",this.hoverPosition)),o.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 l.SerializationHelper.Clone((function(){return new e(t,i.getScene())}),this)},e.prototype.serialize=function(){var t=l.SerializationHelper.Serialize(this);return t.customType="BABYLON.GUI.FluentMaterial",t},e.prototype.getClassName=function(){return"FluentMaterial"},e.Parse=function(t,i,n){return l.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,n)},r([Object(l.serialize)(),Object(l.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"innerGlowColorIntensity",void 0),r([Object(l.serializeAsColor3)()],e.prototype,"innerGlowColor",void 0),r([Object(l.serializeAsColor3)()],e.prototype,"albedoColor",void 0),r([Object(l.serialize)(),Object(l.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"renderBorders",void 0),r([Object(l.serialize)()],e.prototype,"borderWidth",void 0),r([Object(l.serialize)()],e.prototype,"edgeSmoothingValue",void 0),r([Object(l.serialize)()],e.prototype,"borderMinValue",void 0),r([Object(l.serialize)(),Object(l.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"renderHoverLight",void 0),r([Object(l.serialize)()],e.prototype,"hoverRadius",void 0),r([Object(l.serializeAsColor4)()],e.prototype,"hoverColor",void 0),r([Object(l.serializeAsVector3)()],e.prototype,"hoverPosition",void 0),r([Object(l.serializeAsTexture)("albedoTexture")],e.prototype,"_albedoTexture",void 0),r([Object(l.expandToProperty)("_markAllSubMeshesAsTexturesAndMiscDirty")],e.prototype,"albedoTexture",void 0),e}(l.PushMaterial);Object(l.RegisterClass)("BABYLON.GUI.FluentMaterial",pt);var bt=function(t){function e(e,i){void 0===i&&(i=!0);var n=t.call(this,e)||this;return n._shareMaterials=!0,n._shareMaterials=i,n.pointerEnterAnimation=function(){n.mesh&&n._frontPlate.setEnabled(!0)},n.pointerOutAnimation=function(){n.mesh&&n._frontPlate.setEnabled(!1)},n}return o(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){this._tooltipMesh=Object(l.CreatePlane)("",{size:1},this._backPlate._scene);var i=Object(l.CreatePlane)("",{size:1,sideOrientation:l.Mesh.DOUBLESIDE},this._backPlate._scene),n=new l.StandardMaterial("",this._backPlate._scene);n.diffuseColor=l.Color3.FromHexString("#212121"),i.material=n,i.isPickable=!1,this._tooltipMesh.addChild(i),i.position.z=.05,this._tooltipMesh.scaling.y=1/3,this._tooltipMesh.position.y=.7,this._tooltipMesh.position.z=-.15,this._tooltipMesh.isPickable=!1,this._tooltipMesh.parent=this._backPlate,this._tooltipTexture=et.CreateForMesh(this._tooltipMesh),this._tooltipTextBlock=new x,this._tooltipTextBlock.scaleY=3,this._tooltipTextBlock.color="white",this._tooltipTextBlock.fontSize=130,this._tooltipTexture.addControl(this._tooltipTextBlock),this._tooltipFade=new l.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 B;if(t.isVertical=!0,l.DomManagement.IsDocumentAvailable()&&document.createElement&&this._imageUrl){var e=new P;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 x;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=Object(l.CreateBox)(this.name+"BackMesh",{width:1,height:1,depth:.08},e),this._frontPlate=Object(l.CreateBox)(this.name+"FrontMesh",{width:1,height:1,depth:.08},e),this._frontPlate.parent=this._backPlate,this._frontPlate.position.z=-.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.z=-.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 pt(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 pt(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 l.StandardMaterial(this.name+"Plate Material",t.getScene()),this._plateMaterial.specularColor=l.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}(lt),gt="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;\n\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}\n\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}\n\n\nvec2 FilterStep(vec2 Edge,vec2 X)\n{\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}\n\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);\n\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}\n\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}\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\n\n\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));\n\nfloat Is_Quad_Q24;\nIs_Quad_Q24=vNormal.z;\n\nvec3 Blob_Position_Q41=mix(_Blob_Position_,Global_Left_Index_Tip_Position.xyz,float(Use_Global_Left_Index));\n\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);\n\nvec4 Wire_Or_Blob_Q23=mix(Wireframe_Q59,Blob_Color_Q39,Is_Quad_Q24);\n\nvec4 Result_Q22;\nResult_Q22=mix(Wire_Or_Blob_Q23,vec4(0.3,0.3,0.3,0.3),float(_Show_Frame_));\n\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}";l.ShaderStore.ShadersStore.fluentButtonPixelShader=gt;var mt="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;\n\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);\n\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);\n\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;\n\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;\n\nOut_Position=mix(Position,blobCorner,Vx_Color.rrr);\nOut_UV=mix(In_UV,blobUV,Vx_Color.rr);\n}\n\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));\n\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}\n\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}\n\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}\n\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}\n\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}\n\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}\n\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{\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;\n\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));\n\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}\n\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}\n\nvoid main()\n{\n\nvec3 Active_Face_Center_Q49;\nActive_Face_Center_Q49=(world*vec4(_Active_Face_Dir_*0.5,1.0)).xyz;\n\nvec3 Blob_Position_Q41=mix(_Blob_Position_,Global_Left_Index_Tip_Position.xyz,float(Use_Global_Left_Index));\n\nvec3 Blob_Position_Q42=mix(_Blob_Position_2_,Global_Right_Index_Tip_Position.xyz,float(Use_Global_Right_Index));\n\nvec3 Active_Face_Dir_Q64=normalize((world*vec4(_Active_Face_Dir_,0.0)).xyz);\n\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\n\nvec3 Tangent_World_Q30;\nTangent_World_Q30=(world*vec4(tangent,0.0)).xyz;\n\nvec3 Binormal_World_Q31;\nBinormal_World_Q31=(world*vec4((cross(normal,tangent)),0.0)).xyz;\n\nvec3 Normal_World_Q60;\nNormal_World_Q60=(world*vec4(normal,0.0)).xyz;\n\nvec3 Result_Q18=0.5*normal;\nvec3 Dir_World_Q67;\nObject_To_World_Dir_B67(_Active_Face_Up_,Dir_World_Q67);\n\nfloat Product_Q56=_Edge_Width_*Relative_Scale_Q57;\n\nvec3 Normal_World_N_Q29=normalize(Normal_World_Q60);\n\nvec3 Tangent_World_N_Q28=normalize(Tangent_World_Q30);\n\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);\n\nvec3 Face_Center_Q33;\nFace_Center_Q33=(world*vec4(Result_Q18,1.0)).xyz;\n\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);\n\nvec3 Normalized_Q72=normalize(Dir_World_Q67);\n\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);\n\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);\n\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);\n\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}";l.ShaderStore.ShadersStore.fluentButtonVertexShader=mt;var vt=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 o(e,t),e}(l.MaterialDefines),yt=function(t){function e(i,n){var o=t.call(this,i,n)||this;return o.edgeWidth=.04,o.edgeColor=new l.Color4(.592157,.592157,.592157,1),o.proximityMaxIntensity=.45,o.proximityFarDistance=.16,o.proximityNearRadius=1.5,o.proximityAnisotropy=1,o.selectionFuzz=.5,o.selected=0,o.selectionFade=0,o.selectionFadeSize=.3,o.selectedDistance=.08,o.selectedFadeLength=.08,o.blobIntensity=.5,o.blobFarSize=.05,o.blobNearDistance=0,o.blobFarDistance=.08,o.blobFadeLength=.08,o.leftBlobEnable=!0,o.leftBlobNearSize=.025,o.leftBlobPulse=0,o.leftBlobFade=1,o.leftBlobInnerFade=.01,o.rightBlobEnable=!0,o.rightBlobNearSize=.025,o.rightBlobPulse=0,o.rightBlobFade=1,o.rightBlobInnerFade=.01,o.activeFaceDir=new l.Vector3(0,0,-1),o.activeFaceUp=new l.Vector3(0,1,0),o.enableFade=!0,o.fadeWidth=1.5,o.smoothActiveFace=!0,o.showFrame=!1,o.useBlobTexture=!0,o.globalLeftIndexTipPosition=l.Vector3.Zero(),o.globalRightIndexTipPosition=l.Vector3.Zero(),o.alphaMode=l.Constants.ALPHA_ADD,o.disableDepthWrite=!0,o.backFaceCulling=!1,o._blobTexture=new l.Texture(e.BLOB_TEXTURE_URL,n,!0,!1,l.Texture.NEAREST_SAMPLINGMODE),o}return o(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,i){if(this.isFrozen&&e.effect&&e.effect._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new vt);var n=e.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(e))return!0;var r=o.getEngine();if(l.MaterialHelper.PrepareDefinesForAttributes(t,n,!0,!1),n.isDirty){n.markAsProcessed(),o.resetCachedMaterial();var a=new l.EffectFallbacks;n.FOG&&a.addFallback(1,"FOG"),l.MaterialHelper.HandleFallbacksForShadows(n,a),n.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;var s=[l.VertexBuffer.PositionKind];n.NORMAL&&s.push(l.VertexBuffer.NormalKind),n.UV1&&s.push(l.VertexBuffer.UVKind),n.UV2&&s.push(l.VertexBuffer.UV2Kind),n.VERTEXCOLOR&&s.push(l.VertexBuffer.ColorKind),n.TANGENT&&s.push(l.VertexBuffer.TangentKind),l.MaterialHelper.PrepareAttributesForInstances(s,n);var _=n.toString(),h=["world","viewProjection","cameraPosition","_Edge_Width_","_Edge_Color_","_Relative_Width_","_Proximity_Max_Intensity_","_Proximity_Far_Distance_","_Proximity_Near_Radius_","_Proximity_Anisotropy_","_Selection_Fuzz_","_Selected_","_Selection_Fade_","_Selection_Fade_Size_","_Selected_Distance_","_Selected_Fade_Length_","_Blob_Enable_","_Blob_Position_","_Blob_Intensity_","_Blob_Near_Size_","_Blob_Far_Size_","_Blob_Near_Distance_","_Blob_Far_Distance_","_Blob_Fade_Length_","_Blob_Inner_Fade_","_Blob_Pulse_","_Blob_Fade_","_Blob_Texture_","_Blob_Enable_2_","_Blob_Position_2_","_Blob_Near_Size_2_","_Blob_Inner_Fade_2_","_Blob_Pulse_2_","_Blob_Fade_2_","_Active_Face_Dir_","_Active_Face_Up_","_Enable_Fade_","_Fade_Width_","_Smooth_Active_Face_","_Show_Frame_","_Use_Blob_Texture_","Use_Global_Left_Index","Use_Global_Right_Index","Global_Left_Index_Tip_Position","Global_Right_Index_Tip_Position","Global_Left_Thumb_Tip_Position","Global_Right_Thumb_Tip_Position","Global_Left_Index_Tip_Proximity","Global_Right_Index_Tip_Proximity"],c=["_Blob_Texture_"],u=new Array;l.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:h,uniformBuffersNames:u,samplers:c,defines:n,maxSimultaneousLights:4}),e.setEffect(o.getEngine().createEffect("fluentButton",{attributes:s,uniformsNames:h,uniformBuffersNames:u,samplers:c,defines:_,fallbacks:a,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},r),n,this._materialContext)}return!(!e.effect||!e.effect.isReady())&&(n._renderId=o.getRenderId(),e.effect._wasPreviouslyReady=!0,!0)},e.prototype.bindForSubMesh=function(t,e,i){var n=this.getScene();if(i.materialDefines){var o=i.effect;o&&(this._activeEffect=o,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",n.activeCamera.position),this._activeEffect.setTexture("_Blob_Texture_",this._blobTexture),this._activeEffect.setFloat("_Edge_Width_",this.edgeWidth),this._activeEffect.setColor4("_Edge_Color_",new l.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 l.Vector4(this.globalLeftIndexTipPosition.x,this.globalLeftIndexTipPosition.y,this.globalLeftIndexTipPosition.z,1)),this._activeEffect.setVector4("Global_Right_Index_Tip_Position",new l.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 l.SerializationHelper.Clone((function(){return new e(t,i.getScene())}),this)},e.prototype.serialize=function(){var t=l.SerializationHelper.Serialize(this);return t.customType="BABYLON.FluentButtonMaterial",t},e.prototype.getClassName=function(){return"FluentButtonMaterial"},e.Parse=function(t,i,n){return l.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,n)},e.BLOB_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/mrtk-fluent-button-blob.png",r([Object(l.serialize)()],e.prototype,"edgeWidth",void 0),r([Object(l.serializeAsColor4)()],e.prototype,"edgeColor",void 0),r([Object(l.serialize)()],e.prototype,"proximityMaxIntensity",void 0),r([Object(l.serialize)()],e.prototype,"proximityFarDistance",void 0),r([Object(l.serialize)()],e.prototype,"proximityNearRadius",void 0),r([Object(l.serialize)()],e.prototype,"proximityAnisotropy",void 0),r([Object(l.serialize)()],e.prototype,"selectionFuzz",void 0),r([Object(l.serialize)()],e.prototype,"selected",void 0),r([Object(l.serialize)()],e.prototype,"selectionFade",void 0),r([Object(l.serialize)()],e.prototype,"selectionFadeSize",void 0),r([Object(l.serialize)()],e.prototype,"selectedDistance",void 0),r([Object(l.serialize)()],e.prototype,"selectedFadeLength",void 0),r([Object(l.serialize)()],e.prototype,"blobIntensity",void 0),r([Object(l.serialize)()],e.prototype,"blobFarSize",void 0),r([Object(l.serialize)()],e.prototype,"blobNearDistance",void 0),r([Object(l.serialize)()],e.prototype,"blobFarDistance",void 0),r([Object(l.serialize)()],e.prototype,"blobFadeLength",void 0),r([Object(l.serialize)()],e.prototype,"leftBlobEnable",void 0),r([Object(l.serialize)()],e.prototype,"leftBlobNearSize",void 0),r([Object(l.serialize)()],e.prototype,"leftBlobPulse",void 0),r([Object(l.serialize)()],e.prototype,"leftBlobFade",void 0),r([Object(l.serialize)()],e.prototype,"leftBlobInnerFade",void 0),r([Object(l.serialize)()],e.prototype,"rightBlobEnable",void 0),r([Object(l.serialize)()],e.prototype,"rightBlobNearSize",void 0),r([Object(l.serialize)()],e.prototype,"rightBlobPulse",void 0),r([Object(l.serialize)()],e.prototype,"rightBlobFade",void 0),r([Object(l.serialize)()],e.prototype,"rightBlobInnerFade",void 0),r([Object(l.serializeAsVector3)()],e.prototype,"activeFaceDir",void 0),r([Object(l.serializeAsVector3)()],e.prototype,"activeFaceUp",void 0),r([Object(l.serialize)()],e.prototype,"enableFade",void 0),r([Object(l.serialize)()],e.prototype,"fadeWidth",void 0),r([Object(l.serialize)()],e.prototype,"smoothActiveFace",void 0),r([Object(l.serialize)()],e.prototype,"showFrame",void 0),r([Object(l.serialize)()],e.prototype,"useBlobTexture",void 0),r([Object(l.serializeAsVector3)()],e.prototype,"globalLeftIndexTipPosition",void 0),r([Object(l.serializeAsVector3)()],e.prototype,"globalRightIndexTipPosition",void 0),e}(l.PushMaterial);Object(l.RegisterClass)("BABYLON.GUI.FluentButtonMaterial",yt);var xt=function(t){function e(e,i){var n=t.call(this,e)||this;return n._isNearPressed=!1,n.collidableFrontDirection=l.Vector3.Zero(),i&&(n.collisionMesh=i),n}return o(e,t),Object.defineProperty(e.prototype,"collidableFrontDirection",{get:function(){if(this._collisionMesh){var t=l.TmpVectors.Vector3[0];return l.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=l.TmpVectors.Matrix[0];e.copyFrom(this._collisionMesh.getWorldMatrix()),e.invert(),l.Vector3.TransformNormalToRef(this._collidableFrontDirection,e,this._collidableFrontDirection),this._collidableFrontDirection.normalize()}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"collisionMesh",{set:function(t){this._collisionMesh&&this._collisionMesh.dispose(),!t.parent&&this.mesh&&t.setParent(this.mesh),this._collisionMesh=t,this._injectGUI3DReservedDataStore(this._collisionMesh).control=this,this._collisionMesh.isNearPickable=!0,this.collidableFrontDirection=t.forward},enumerable:!1,configurable:!0}),e.prototype._isInteractionInFrontOfButton=function(t){return this._getInteractionHeight(t,this._collisionMesh.getAbsolutePosition())>0},e.prototype._getInteractionHeight=function(t,e){var i=this.collidableFrontDirection;if(0===i.length())return l.Vector3.Distance(t,e);var n=l.Vector3.Dot(e,i);return l.Vector3.Dot(t,i)-n},e.prototype._generatePointerEventType=function(t,e,i){if(t===l.PointerEventTypes.POINTERDOWN){if(!this._isInteractionInFrontOfButton(e))return l.PointerEventTypes.POINTERMOVE;this._isNearPressed=!0}if(t===l.PointerEventTypes.POINTERUP){if(0==i)return l.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._collisionMesh&&this._collisionMesh.dispose()},e}(lt),Pt=function(t){function e(e,i){void 0===i&&(i=!0);var n=t.call(this,e)||this;return n._shareMaterials=!0,n._isBackplateVisible=!0,n._frontPlateDepth=.5,n._backPlateDepth=.04,n._shareMaterials=i,n.pointerEnterAnimation=function(){n._frontMaterial.leftBlobEnable=!0,n._frontMaterial.rightBlobEnable=!0},n.pointerOutAnimation=function(){n._frontMaterial.leftBlobEnable=!1,n._frontMaterial.rightBlobEnable=!1},n.pointerDownAnimation=function(){n._frontPlate&&!n._isNearPressed&&(n._frontPlate.scaling.z=.2*n._frontPlateDepth,n._frontPlate.position.z=(n._frontPlateDepth-.2*n._frontPlateDepth)/2,n._textPlate.position.z=-(n._backPlateDepth+.2*n._frontPlateDepth)/2)},n.pointerUpAnimation=function(){n._frontPlate&&(n._frontPlate.scaling.z=n._frontPlateDepth,n._frontPlate.position.z=(n._frontPlateDepth-n._frontPlateDepth)/2,n._textPlate.position.z=-(n._backPlateDepth+n._frontPlateDepth)/2)},n.onPointerMoveObservable.add((function(t){if(n._frontPlate&&n._isNearPressed){var e=l.Vector3.Zero();if(n._backPlate.getWorldMatrix().decompose(e,void 0,void 0)){var i=n._getInteractionHeight(t,n._backPlate.position)/e.z;i=l.Scalar.Clamp(i-n._backPlateDepth/2,.2*n._frontPlateDepth,n._frontPlateDepth),n._frontPlate.scaling.z=i,n._frontPlate.position.z=(n._frontPlateDepth-i)/2,n._textPlate.position.z=-(n._backPlateDepth+i)/2}}})),n._pointerHoverObserver=n.onPointerMoveObservable.add((function(t){n._frontMaterial.globalLeftIndexTipPosition=t})),n}return o(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){this._tooltipMesh=Object(l.CreatePlane)("",{size:1},this._backPlate._scene);var i=Object(l.CreatePlane)("",{size:1,sideOrientation:l.Mesh.DOUBLESIDE},this._backPlate._scene),n=new l.StandardMaterial("",this._backPlate._scene);n.diffuseColor=l.Color3.FromHexString("#212121"),i.material=n,i.isPickable=!1,this._tooltipMesh.addChild(i),i.position.z=.05,this._tooltipMesh.scaling.y=1/3,this._tooltipMesh.position.y=.7,this._tooltipMesh.position.z=-.15,this._tooltipMesh.isPickable=!1,this._tooltipMesh.parent=this._backPlate,this._tooltipTexture=et.CreateForMesh(this._tooltipMesh),this._tooltipTextBlock=new x,this._tooltipTextBlock.scaleY=3,this._tooltipTextBlock.color="white",this._tooltipTextBlock.fontSize=130,this._tooltipTexture.addControl(this._tooltipTextBlock),this._tooltipFade=new l.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 B;if(t.isVertical=!0,l.DomManagement.IsDocumentAvailable()&&document.createElement&&this._imageUrl){var e=new P;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 x;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 n,o=this;this.name=null!==(n=this.name)&&void 0!==n?n:"TouchHolographicButton";var r=Object(l.CreateBox)(this.name+"_collisionMesh",{width:1,height:1,depth:this._frontPlateDepth},i);return r.isPickable=!0,r.isNearPickable=!0,r.visibility=0,r.position.z=-this._frontPlateDepth/2,l.SceneLoader.ImportMeshAsync(void 0,e.MODEL_BASE_URL,e.MODEL_FILENAME,i).then((function(t){var e=t.meshes[1];e.name=o.name+"_frontPlate",e.isPickable=!1,e.scaling.z=o._frontPlateDepth,e.parent=r,o._frontMaterial&&(e.material=o._frontMaterial),o._frontPlate=e})),this._backPlate=Object(l.CreateBox)(this.name+"_backPlate",{width:1,height:1,depth:this._backPlateDepth},i),this._backPlate.position.z=this._backPlateDepth/2,this._backPlate.isPickable=!1,this._textPlate=t.prototype._createNode.call(this,i),this._textPlate.name=this.name+"_textPlate",this._textPlate.isPickable=!1,this._textPlate.position.z=-this._frontPlateDepth/2,this._backPlate.addChild(r),this._backPlate.addChild(this._textPlate),this.collisionMesh=r,this.collidableFrontDirection=this._backPlate.forward.negate(),this._backPlate},e.prototype._applyFacade=function(t){this._plateMaterial.emissiveTexture=t,this._plateMaterial.opacityTexture=t,this._plateMaterial.diffuseColor=new l.Color3(.4,.4,.4)},e.prototype._createBackMaterial=function(t){this._backMaterial=new l.StandardMaterial(this.name+"Back Material",t.getScene()),this._backMaterial.diffuseColor=new l.Color3(.5,.5,.5)},e.prototype._createFrontMaterial=function(t){this._frontMaterial=new yt(this.name+"Front Material",t.getScene())},e.prototype._createPlateMaterial=function(t){this._plateMaterial=new l.StandardMaterial(this.name+"Plate Material",t.getScene()),this._plateMaterial.specularColor=l.Color3.Black()},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}(xt),Ot="precision highp float;\n\nattribute vec3 position;\n\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}";l.ShaderStore.ShadersStore.handleVertexShader=Ot;var Bt="uniform vec3 color;\nvoid main(void) {\ngl_FragColor=vec4(color,1.0);\n}";l.ShaderStore.ShadersStore.handlePixelShader=Bt;var Ct,Tt=function(t){function e(e,i){var n=t.call(this,e,i,"handle",{attributes:["position"],uniforms:["worldViewProjection","color","scale","positionOffset"],needAlphaBlending:!1,needAlphaTesting:!1})||this;return n._hover=!1,n._drag=!1,n._color=new l.Color3,n._scale=1,n._lastTick=-1,n.animationLength=100,n.hoverColor=new l.Color3(0,.467,.84),n.baseColor=new l.Color3(1,1,1),n.hoverScale=.75,n.baseScale=.35,n.dragScale=.55,n._positionOffset=l.Vector3.Zero(),n._updateInterpolationTarget(),n._lastTick=Date.now(),n._onBeforeRender=n.getScene().onBeforeRenderObservable.add((function(){var t=Date.now(),e=t-n._lastTick,i=n._targetScale-n._scale,o=l.TmpColors.Color3[0].copyFrom(n._targetColor).subtractToRef(n._color,l.TmpColors.Color3[0]);n._scale=n._scale+i*e/n.animationLength,o.scaleToRef(e/n.animationLength,o),n._color.addToRef(o,n._color),n.setColor3("color",n._color),n.setFloat("scale",n._scale),n.setVector3("positionOffset",n._positionOffset),n._lastTick=t})),n}return o(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}(l.ShaderMaterial);!function(t){t[t.IDLE=0]="IDLE",t[t.HOVER=1]="HOVER",t[t.DRAG=2]="DRAG"}(Ct||(Ct={}));var It=function(){function t(t,e){this._state=Ct.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|=Ct.HOVER:this._state&=~Ct.HOVER,this._updateMaterial()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"drag",{set:function(t){t?this._state|=Ct.DRAG:this._state&=~Ct.DRAG,this._updateMaterial()},enumerable:!1,configurable:!0}),t.prototype._createMaterial=function(t){var e=new Tt("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&Ct.DRAG)for(var n=0,o=this._materials;n<o.length;n++){(s=o[n]).drag=!0}else if(t&Ct.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 n=new l.BaseSixDofDragBehavior;this._dragBehavior=n,this._dragStartObserver=n.onDragStartObservable.add(t),this._draggingObserver=n.onDragObservable.add(e),this._dragEndObserver=n.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}(),Rt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.createNode=function(){var t=Object(l.CreateBox)("sideVert",{width:1,height:10,depth:.1},this._scene),e=new l.TransformNode("side",this._scene);t.parent=e;var i=this._createMaterial();return t.material=i,t.isNearGrabbable=!0,this._materials.push(i),e},e}(It),St=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.createNode=function(){var t=Object(l.CreateBox)("angleHor",{width:3,height:1,depth:.1},this._scene),e=Object(l.CreateBox)("angleVert",{width:1,height:3,depth:.1},this._scene),i=new l.TransformNode("angle",this._scene);return t.parent=i,e.parent=i,t.material=this._createMaterial(new l.Vector3(1,0,0)),e.material=this._createMaterial(new l.Vector3(0,1,0)),e.isNearGrabbable=!0,t.isNearGrabbable=!0,this._materials.push(t.material),this._materials.push(e.material),i},e}(It),wt=function(t){function e(e){var i=t.call(this,e)||this;return i._boundingDimensions=new l.Vector3(0,0,0),i._renderObserver=null,i._tmpQuaternion=new l.Quaternion,i._tmpVector=new l.Vector3(0,0,0),i._corners=[],i._sides=[],i._boundingBoxGizmo={min:new l.Vector3,max:new l.Vector3},i._margin=.35,i._attachedSlate=null,i._existingSlateScale=new l.Vector3,i.fixedScreenSize=!1,i.fixedScreenSizeDistanceFactor=10,i.handleSize=.01,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 o(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 l.TransformNode("handlesParent",this.gizmoLayer.utilityLayerScene),this._handlesParent.rotationQuaternion=l.Quaternion.Identity();for(var e=[{dimensions:new l.Vector3(-1,-1,0),origin:new l.Vector3(1,0,0)},{dimensions:new l.Vector3(1,-1,0),origin:new l.Vector3(0,0,0)},{dimensions:new l.Vector3(1,1,0),origin:new l.Vector3(0,1,0)},{dimensions:new l.Vector3(-1,1,0),origin:new l.Vector3(1,1,0)}],i=0;i<4;i++){var n=new St(this,this.gizmoLayer.utilityLayerScene);this._corners.push(n),n.node.rotation.z=Math.PI/2*i,n.node.scaling.setAll(this.handleSize),n.node.parent=this._handlesParent,this._assignDragBehaviorCorners(n,(function(e,i,n,o){return t._moveHandle(e,i,n,o,!0)}),e[i])}for(i=0;i<4;i++){var o=new Rt(this,this.gizmoLayer.utilityLayerScene);this._sides.push(o),o.node.rotation.z=Math.PI/2*i,o.node.scaling.copyFromFloats(this.handleSize,this.handleSize,this.handleSize),o.node.parent=this._handlesParent,this._assignDragBehaviorSides(o,i%2==0?new l.Vector3(0,1,0):new l.Vector3(1,0,0))}this._handlesParent.parent=this._rootMesh},e.prototype._keepAspectRatio=function(t,e,i){void 0===i&&(i=!1);var n=l.TmpVectors.Vector3[0];n.copyFromFloats(e,1,0).normalize(),i&&(n.y*=-1);var o=l.Vector3.Dot(t,n);t.copyFrom(n).scaleInPlace(o)},e.prototype._clampDimensions=function(t,e,i,n){void 0===n&&(n=!1);var o=l.TmpVectors.Vector3[0];o.copyFrom(t).multiplyInPlace(i);var r=l.TmpVectors.Vector3[1];if(r.copyFromFloats(Math.max(this._attachedSlate.minDimensions.x,o.x+e.x),Math.max(this._attachedSlate.minDimensions.y,o.y+e.y),0),n){var a=e.x/e.y;r.x=Math.max(r.x,r.y*a),r.y=Math.max(r.y,r.x/a)}o.copyFrom(r).subtractInPlace(e),t.x=Math.sign(t.x)*Math.abs(o.x),t.y=Math.sign(t.y)*Math.abs(o.y)},e.prototype._moveHandle=function(t,e,i,n,o){if(this._attachedSlate){if(o){var r=e.x/e.y;this._keepAspectRatio(i,r,n.dimensions.x*n.dimensions.y<0)}this._clampDimensions(i,e,n.dimensions,o);var a=l.TmpVectors.Vector3[0],s=l.TmpVectors.Vector3[1];a.copyFrom(i).multiplyInPlace(n.origin),s.copyFrom(i).multiplyInPlace(n.dimensions),this._attachedSlate.origin.copyFrom(t).addInPlace(a),this._attachedSlate.dimensions.copyFrom(e).addInPlace(s),this._attachedSlate.backplateDimensions.x=this._attachedSlate.dimensions.x}},e.prototype._assignDragBehaviorCorners=function(t,e,i){var n=this,o=new l.Vector3,r=new l.Vector3,a=new l.Vector3,s=new l.Matrix,_=new l.Vector3,h=!1;t.setDragBehavior((function(t){n.attachedSlate&&n.attachedMesh&&(o.copyFrom(n.attachedSlate.dimensions),r.copyFrom(n.attachedSlate.origin),a.copyFrom(t.position),s.copyFrom(n.attachedMesh.computeWorldMatrix(!0)),s.invert(),h=n.attachedSlate.defaultBehavior.followBehaviorEnabled,n.attachedSlate.defaultBehavior.followBehaviorEnabled=!1,l.Vector3.TransformNormalToRef(l.Vector3.Forward(),n.attachedMesh.getWorldMatrix(),_),_.normalize(),n._handleHovered&&(n._handleDragged=n._handleHovered,n._handleDragged.drag=!0))}),(function(t){n.attachedSlate&&n.attachedMesh&&(!function(t,e,i,n){t.subtractToRef(i,l.TmpVectors.Vector3[0]);var o=l.Vector3.Dot(l.TmpVectors.Vector3[0],e);l.TmpVectors.Vector3[1].copyFrom(e).scaleInPlace(o),l.TmpVectors.Vector3[0].subtractInPlace(l.TmpVectors.Vector3[1]),l.TmpVectors.Vector3[0].addToRef(i,n)}(t.position,_,a,n._tmpVector),n._tmpVector.subtractInPlace(a),l.Vector3.TransformNormalToRef(n._tmpVector,s,n._tmpVector),e(r,o,n._tmpVector,i),n.attachedSlate._positionElements(),n.updateBoundingBox())}),(function(){n.attachedSlate&&n.attachedNode&&(n.attachedSlate._updatePivot(),n.attachedSlate.defaultBehavior.followBehaviorEnabled=h,n._handleDragged&&(n._handleDragged.drag=!1,n._handleDragged=null))}))},e.prototype._assignDragBehaviorSides=function(t,e){var i,n=this,o=new l.Quaternion,r=new l.Vector3,a=new l.Vector3,s=new l.Vector3,_=new l.Vector3;t.setDragBehavior((function(t){n.attachedSlate&&n.attachedMesh&&(o.copyFrom(n.attachedMesh.rotationQuaternion),r.copyFrom(t.position),i=n.attachedSlate.defaultBehavior.followBehaviorEnabled,n.attachedSlate.defaultBehavior.followBehaviorEnabled=!1,s.copyFrom(n.attachedMesh.getAbsolutePivotPoint()),a.copyFrom(r).subtractInPlace(s).normalize(),l.Vector3.TransformNormalToRef(e,n.attachedMesh.getWorldMatrix(),_),_.normalize(),n._handleHovered&&(n._handleDragged=n._handleHovered,n._handleDragged.drag=!0))}),(function(t){if(n.attachedSlate&&n.attachedMesh){n._tmpVector.copyFrom(t.position),n._tmpVector.subtractInPlace(s),n._tmpVector.normalize();var i=-l.Vector3.GetAngleBetweenVectorsOnPlane(n._tmpVector,a,_);l.Quaternion.RotationAxisToRef(e,i,n._tmpQuaternion),o.multiplyToRef(n._tmpQuaternion,n.attachedMesh.rotationQuaternion)}}),(function(){n.attachedSlate&&n.attachedNode&&(n.attachedSlate._updatePivot(),n.attachedSlate.defaultBehavior.followBehaviorEnabled=i,n._handleDragged&&(n._handleDragged.drag=!1,n._handleDragged=null))}))},e.prototype._attachedNodeChanged=function(t){t&&this.updateBoundingBox()},e.prototype.updateBoundingBox=function(){if(this.attachedMesh){l.PivotTools._RemoveAndStorePivotPoint(this.attachedMesh);var t=this.attachedMesh.parent;this.attachedMesh.setParent(null),this._update(),this.attachedMesh.rotationQuaternion||(this.attachedMesh.rotationQuaternion=l.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.attachedMesh.rotationQuaternion.copyFrom(this._tmpQuaternion),this.attachedMesh.position.copyFrom(this._tmpVector),l.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 n=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,n.y,0),this._sides[1].node.position.copyFromFloats(n.x,t.y,0),this._sides[2].node.position.copyFromFloats(e.x,n.y,0),this._sides[3].node.position.copyFromFloats(n.x,e.y,0)},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)}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 n=0,o=this._sides;n<o.length;n++){o[n].dispose()}},e}(l.Gizmo),Mt=function(){function t(){this.followBehaviorEnabled=!1,this.sixDofDragBehaviorEnabled=!0,this.surfaceMagnetismBehaviorEnabled=!0,this._followBehavior=new l.FollowBehavior,this._sixDofDragBehavior=new l.SixDofDragBehavior,this._surfaceMagnetismBehavior=new l.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}(),Et="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_;\n\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_;\n\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_;\n\nuniform bool _Reflected_;\nuniform float _Frequency_;\nuniform float _Vertical_Offset_;\n\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;\n\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);\n\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);\n\n\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\n\n\n}\n\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}\n\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}\n\n\nvoid Scale_RGB_B54(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{\nResult=vec4(Scalar,Scalar,Scalar,1)*Color;\n}\n\n\nvoid Conditional_Float_B38(\nbool Which,\nfloat If_True,\nfloat If_False,\nout float Result)\n{\nResult=Which ? If_True : If_False;\n}\n\nvoid main()\n{\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\n\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);\n\nfloat X_Q67;\nfloat Y_Q67;\nX_Q67=vUV.x;\nY_Q67=vUV.y;\n\nvec3 Incident_Q66=normalize(vPosition-cameraPosition);\n\nvec3 Reflected_Q60=reflect(Incident_Q66,vBinormal);\n\nfloat Product_Q63=Y_Q67*_Vertical_Offset_;\n\nfloat Dot_Q68=dot(Incident_Q66,Reflected_Q60);\n\nfloat Dot_Q57=dot(vNormal,Incident_Q66);\nfloat Result_Q38;\nConditional_Float_B38(_Reflected_,Dot_Q68,Dot_Q57,Result_Q38);\n\nfloat Product_Q64=Result_Q38*_Frequency_;\n\nfloat Sum_Q69=Product_Q64+1.0;\n\nfloat Product_Q70=Sum_Q69*0.5;\n\nfloat Sum_Q62=Product_Q63+Product_Q70;\n\nfloat FractF_Q59=fract(Sum_Q62);\n\nvec2 Vec2_Q65=vec2(FractF_Q59,0.5);\n\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);\n\nvec4 Base_And_Iridescent_Q53;\nBase_And_Iridescent_Q53=Line_Color_Q48+vec4(Result_Q54.rgb,0.0);\n\nvec4 Base_And_Iridescent_Q56;\nBase_And_Iridescent_Q56=_Base_Color_+vec4(Result_Q55.rgb,0.0);\n\nvec4 Result_Q52=Base_And_Iridescent_Q53; Result_Q52.a=1.0;\n\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);\n\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}";l.ShaderStore.ShadersStore.fluentBackplatePixelShader=Et;var Dt="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_;\n\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_;\n\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_;\n\nuniform bool _Reflected_;\nuniform float _Frequency_;\nuniform float _Vertical_Offset_;\n\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;\n\nvoid Object_To_World_Pos_B115(\nvec3 Pos_Object,\nout vec3 Pos_World)\n{\nPos_World=(world*vec4(Pos_Object,1.0)).xyz;\n}\n\n\nvoid PickDir_B140(\nfloat Degrees,\nvec3 DirX,\nvec3 DirY,\nout vec3 Dir)\n{\n\nfloat a=Degrees*3.14159/180.0;\nDir=cos(a)*DirX+sin(a)*DirY;\n}\n\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}\n\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}\n\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}\n\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}\n\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}\n\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}\n\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{\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) {\n\nGradient1=Position_Object.z>0.0 ? g : 1.0;\nGradient2=Position_Object.z>0.0 ? 1.0 : g;\n} else {\n\n\n\n\nGradient1=g+(1.0-g)*(Radial_Gradient);\nGradient2=1.0;\n}\n}\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}\n\nvoid main()\n{\n\nvec3 Nrm_World_Q128;\nNrm_World_Q128=normalize((world*vec4(normal,0.0)).xyz);\n\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);\n\nfloat Anisotropy_Q133=Tangent_Length_Q131/Binormal_Length_Q132;\n\nvec3 Result_Q177;\nResult_Q177=mix(_Blob_Position_,Global_Left_Index_Tip_Position.xyz,float(_Use_Global_Left_Index_));\n\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);\n\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}";l.ShaderStore.ShadersStore.fluentBackplateVertexShader=Dt;var Lt=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 o(e,t),e}(l.MaterialDefines),Ft=function(t){function e(i,n){var o=t.call(this,i,n)||this;return o.radius=.03,o.lineWidth=.01,o.absoluteSizes=!1,o._filterWidth=1,o.baseColor=new l.Color4(.0392157,.0666667,.207843,1),o.lineColor=new l.Color4(.14902,.133333,.384314,1),o.blobIntensity=.98,o.blobFarSize=.04,o.blobNearDistance=0,o.blobFarDistance=.08,o.blobFadeLength=.08,o.blobNearSize=.22,o.blobPulse=0,o.blobFade=0,o.blobNearSize2=.22,o.blobPulse2=0,o.blobFade2=0,o._rate=.135,o.highlightColor=new l.Color4(.98,.98,.98,1),o.highlightWidth=.25,o._highlightTransform=new l.Vector4(1,1,0,0),o._highlight=1,o.iridescenceIntensity=0,o.iridescenceEdgeIntensity=1,o._angle=-45,o.fadeOut=1,o._reflected=!0,o._frequency=1,o._verticalOffset=0,o.globalLeftIndexTipPosition=l.Vector3.Zero(),o._globalLeftIndexTipPosition4=l.Vector4.Zero(),o.globalRightIndexTipPosition=l.Vector3.Zero(),o._globalRightIndexTipPosition4=l.Vector4.Zero(),o.alphaMode=l.Constants.ALPHA_DISABLE,o.backFaceCulling=!1,o._blobTexture=new l.Texture(e.BLOB_TEXTURE_URL,n,!0,!1,l.Texture.NEAREST_SAMPLINGMODE),o._iridescentMap=new l.Texture(e.IM_TEXTURE_URL,n,!0,!1,l.Texture.NEAREST_SAMPLINGMODE),o}return o(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,i){if(this.isFrozen&&e.effect&&e.effect._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new Lt);var n=e.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(e))return!0;var r=o.getEngine();if(l.MaterialHelper.PrepareDefinesForAttributes(t,n,!1,!1),n.isDirty){n.markAsProcessed(),o.resetCachedMaterial();var a=new l.EffectFallbacks;n.FOG&&a.addFallback(1,"FOG"),l.MaterialHelper.HandleFallbacksForShadows(n,a),n.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;var s=[l.VertexBuffer.PositionKind];n.NORMAL&&s.push(l.VertexBuffer.NormalKind),n.UV1&&s.push(l.VertexBuffer.UVKind),n.UV2&&s.push(l.VertexBuffer.UV2Kind),n.VERTEXCOLOR&&s.push(l.VertexBuffer.ColorKind),n.TANGENT&&s.push(l.VertexBuffer.TangentKind),l.MaterialHelper.PrepareAttributesForInstances(s,n);var _=n.toString(),h=["world","viewProjection","cameraPosition","_Radius_","_Line_Width_","_Absolute_Sizes_","_Filter_Width_","_Base_Color_","_Line_Color_","_Radius_Top_Left_","_Radius_Top_Right_","_Radius_Bottom_Left_","_Radius_Bottom_Right_","_Blob_Position_","_Blob_Intensity_","_Blob_Near_Size_","_Blob_Far_Size_","_Blob_Near_Distance_","_Blob_Far_Distance_","_Blob_Fade_Length_","_Blob_Pulse_","_Blob_Fade_","_Blob_Texture_","_Blob_Position_2_","_Blob_Near_Size_2_","_Blob_Pulse_2_","_Blob_Fade_2_","_Rate_","_Highlight_Color_","_Highlight_Width_","_Highlight_Transform_","_Highlight_","_Iridescence_Intensity_","_Iridescence_Edge_Intensity_","_Angle_","_Fade_Out_","_Reflected_","_Frequency_","_Vertical_Offset_","_Iridescent_Map_","_Use_Global_Left_Index_","_Use_Global_Right_Index_","Global_Left_Index_Tip_Position","Global_Right_Index_Tip_Position"],c=["_Blob_Texture_","_Iridescent_Map_"],u=new Array;l.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:h,uniformBuffersNames:u,samplers:c,defines:n,maxSimultaneousLights:4}),e.setEffect(o.getEngine().createEffect("fluentBackplate",{attributes:s,uniformsNames:h,uniformBuffersNames:u,samplers:c,defines:_,fallbacks:a,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},r),n,this._materialContext)}return!(!e.effect||!e.effect.isReady())&&(n._renderId=o.getRenderId(),e.effect._wasPreviouslyReady=!0,!0)},e.prototype.bindForSubMesh=function(t,e,i){var n,o;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!==(o=null===(n=this.getScene().activeCamera)||void 0===n?void 0:n.position)&&void 0!==o?o:l.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 l.SerializationHelper.Clone((function(){return new e(t,i.getScene())}),this)},e.prototype.serialize=function(){var t=l.SerializationHelper.Serialize(this);return t.customType="BABYLON.FluentBackplateMaterial",t},e.prototype.getClassName=function(){return"FluentBackplateMaterial"},e.Parse=function(t,i,n){return l.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,n)},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",r([Object(l.serialize)()],e.prototype,"radius",void 0),r([Object(l.serialize)()],e.prototype,"lineWidth",void 0),r([Object(l.serialize)()],e.prototype,"absoluteSizes",void 0),r([Object(l.serialize)()],e.prototype,"baseColor",void 0),r([Object(l.serialize)()],e.prototype,"lineColor",void 0),r([Object(l.serialize)()],e.prototype,"blobIntensity",void 0),r([Object(l.serialize)()],e.prototype,"blobFarSize",void 0),r([Object(l.serialize)()],e.prototype,"blobNearDistance",void 0),r([Object(l.serialize)()],e.prototype,"blobFarDistance",void 0),r([Object(l.serialize)()],e.prototype,"blobFadeLength",void 0),r([Object(l.serialize)()],e.prototype,"blobNearSize",void 0),r([Object(l.serialize)()],e.prototype,"blobPulse",void 0),r([Object(l.serialize)()],e.prototype,"blobFade",void 0),r([Object(l.serialize)()],e.prototype,"blobNearSize2",void 0),r([Object(l.serialize)()],e.prototype,"blobPulse2",void 0),r([Object(l.serialize)()],e.prototype,"blobFade2",void 0),r([Object(l.serialize)()],e.prototype,"highlightColor",void 0),r([Object(l.serialize)()],e.prototype,"highlightWidth",void 0),r([Object(l.serialize)()],e.prototype,"iridescenceIntensity",void 0),r([Object(l.serialize)()],e.prototype,"iridescenceEdgeIntensity",void 0),r([Object(l.serialize)()],e.prototype,"fadeOut",void 0),r([Object(l.serializeAsVector3)()],e.prototype,"globalLeftIndexTipPosition",void 0),r([Object(l.serializeAsVector3)()],e.prototype,"globalRightIndexTipPosition",void 0),e}(l.PushMaterial);Object(l.RegisterClass)("BABYLON.GUI.FluentBackplateMaterial",Ft);var Nt=function(t){function e(e){var i=t.call(this,e)||this;return i.dimensions=new l.Vector3(.7,.4,.001),i.minDimensions=new l.Vector3(.5,.2,.001),i.defaultDimensions=i.dimensions.clone(),i.backplateDimensions=new l.Vector3(.7,.02,.001),i.backPlateMargin=.005,i.origin=new l.Vector3(0,0,0),i._contentScaleRatio=1,i._followButton=new Pt("followButton"+i.name),i._closeButton=new Pt("closeButton"+i.name),i._contentViewport=new l.Viewport(0,0,1,1),i._contentDragBehavior=new l.PointerDragBehavior({dragPlaneNormal:new l.Vector3(0,0,-1)}),i}return o(e,t),Object.defineProperty(e.prototype,"defaultBehavior",{get:function(){return this._defaultBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderingGroupId",{get:function(){return this._backPlate.renderingGroupId},set:function(t){this._backPlate.renderingGroupId=t,this._contentPlate.renderingGroupId=t},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(),this._resetContentPositionAndZoom(),this._applyContentViewport())},enumerable:!1,configurable:!0}),e.prototype._applyFacade=function(t){this._contentMaterial.albedoTexture=t},e.prototype._rebuildContent=function(){if(this._disposeFacadeTexture(),l.DomManagement.IsDocumentAvailable()&&document.createElement&&this._imageUrl){var t=new P;t.source=this._imageUrl,this._contentPlate&&(this.content=t)}},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.mesh,e=this._closeButton.mesh,i=this._backPlate,n=this._contentPlate;if(t&&e&&i){var o=this.backplateDimensions.y/1;e.scaling.setAll(o),t.scaling.setAll(o),e.position.copyFromFloats(this.backplateDimensions.x-o/2,-this.backplateDimensions.y/2,-this.backplateDimensions.z/2*(this._host.scene.useRightHandedSystem?-1:1)).addInPlace(this.origin),t.position.copyFromFloats(this.backplateDimensions.x-3*o/2,-this.backplateDimensions.y/2,-this.backplateDimensions.z/2*(this._host.scene.useRightHandedSystem?-1:1)).addInPlace(this.origin);var r=this.dimensions.y-this.backplateDimensions.y-this.backPlateMargin;i.scaling.copyFrom(this.backplateDimensions),n.scaling.copyFromFloats(this.dimensions.x,r,this.dimensions.z),i.position.copyFromFloats(this.backplateDimensions.x/2,-this.backplateDimensions.y/2,0).addInPlace(this.origin),n.position.copyFromFloats(this.dimensions.x/2,-(this.backplateDimensions.y+this.backPlateMargin+r/2),0).addInPlace(this.origin);var a=this.dimensions.x/r;this._contentViewport.width=this._contentScaleRatio,this._contentViewport.height=this._contentScaleRatio/a,this._applyContentViewport()}},e.prototype._applyContentViewport=function(){if(this._contentPlate.material&&this._contentPlate.material.albedoTexture){var t=this._contentPlate.material.albedoTexture;t.uScale=this._contentScaleRatio,t.vScale=this._contentScaleRatio/this._contentViewport.width*this._contentViewport.height,t.uOffset=this._contentViewport.x,t.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=this.dimensions.scale(.5);t.y*=-1,t.addInPlace(this.origin),t.z=0;var e=new l.Vector3(0,0,0);l.Vector3.TransformCoordinatesToRef(e,this.mesh.computeWorldMatrix(!0),e),this.mesh.setPivotPoint(t);var i=new l.Vector3(0,0,0);l.Vector3.TransformCoordinatesToRef(i,this.mesh.computeWorldMatrix(!0),i),this.mesh.position.addInPlace(e).subtractInPlace(i)}},e.prototype._createNode=function(t){var i=this,n=new l.Mesh("slate"+this.name,t);this._backPlate=Object(l.CreateBox)("backPlate"+this.name,{size:1},t),this._contentPlate=Object(l.CreateBox)("contentPlate"+this.name,{size:1},t),this._backPlate.parent=n,this._backPlate.isNearGrabbable=!0,this._contentPlate.parent=n,this._attachContentPlateBehavior(),this._addControl(this._followButton),this._addControl(this._closeButton);var o=this._followButton.mesh,r=this._closeButton.mesh;return o.parent=n,r.parent=n,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.backMaterial.alpha=0,this._closeButton.backMaterial.alpha=0,this._followButton.onPointerClickObservable.add((function(){i._defaultBehavior.followBehaviorEnabled=!i._defaultBehavior.followBehaviorEnabled,i._defaultBehavior.followBehaviorEnabled&&i._defaultBehavior.followBehavior.recenter()})),this._closeButton.onPointerClickObservable.add((function(){i.dispose()})),n.rotationQuaternion=l.Quaternion.Identity(),n.isVisible=!1,n},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,n=new l.Vector3,o=new l.Vector3,r=new l.Vector3,a=new l.Vector3,s=new l.Vector2;this._contentDragBehavior.onDragStartObservable.add((function(s){t.node&&(e=t._contentViewport.clone(),i=t.node.computeWorldMatrix(!0),n.copyFrom(s.dragPlanePoint),o.copyFrom(t.dimensions),o.y-=t.backplateDimensions.y+t.backPlateMargin,l.Vector3.TransformNormalToRef(o,i,o),r.copyFromFloats(0,1,0),l.Vector3.TransformNormalToRef(r,i,r),a.copyFromFloats(1,0,0),l.Vector3.TransformNormalToRef(a,i,a),r.normalize(),r.scaleInPlace(1/l.Vector3.Dot(r,o)),a.normalize(),a.scaleInPlace(1/l.Vector3.Dot(a,o)))}));var _=new l.Vector3;this._contentDragBehavior.onDragObservable.add((function(i){_.copyFrom(i.dragPlanePoint),_.subtractInPlace(n),s.copyFromFloats(l.Vector3.Dot(_,a),l.Vector3.Dot(_,r)),t._contentViewport.x=l.Scalar.Clamp(e.x-_.x,0,1-t._contentViewport.width*t._contentScaleRatio),t._contentViewport.y=l.Scalar.Clamp(e.y-_.y,0,1-t._contentViewport.height*t._contentScaleRatio),t._applyContentViewport()}))},e.prototype._affectMaterial=function(t){this._backPlateMaterial=new Ft(this.name+" plateMaterial",t.getScene()),this._pickedPointObserver=this._host.onPickedPointChangedObservable.add((function(t){})),this._contentMaterial=new pt(this.name+"contentMaterial",t.getScene()),this._contentMaterial.renderBorders=!0,this._backPlate.material=this._backPlateMaterial,this._contentPlate.material=this._contentMaterial,this._rebuildContent(),this._applyContentViewport()},e.prototype._prepareNode=function(e){var i=this;t.prototype._prepareNode.call(this,e),this._gizmo=new wt(this._host.utilityLayer),this._gizmo.attachedSlate=this,this._defaultBehavior=new Mt,this._defaultBehavior.attach(this.node,[this._backPlate]),this._positionChangedObserver=this._defaultBehavior.sixDofDragBehavior.onPositionChangedObservable.add((function(){i._gizmo.updateBoundingBox()})),this._updatePivot(),this.resetDefaultAspectAndPose()},e.prototype.resetDefaultAspectAndPose=function(){if(this._host&&this._host.utilityLayer&&this.node){var t=this._host.utilityLayer.utilityLayerScene,e=t.activeCamera;if(e){var i=e.getWorldMatrix(),n=l.Vector3.TransformNormal(l.Vector3.Backward(t.useRightHandedSystem),i);this.dimensions.copyFrom(this.defaultDimensions),this.origin.setAll(0),this._gizmo.updateBoundingBox();var o=this.node.getAbsolutePivotPoint();this.node.position.copyFrom(e.position).subtractInPlace(n).subtractInPlace(o),this.node.rotationQuaternion=l.Quaternion.FromLookDirectionLH(n,new l.Vector3(0,1,0))}}},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._backPlateMaterial.dispose(),this._contentMaterial.dispose(),this._backPlate.dispose(),this._contentPlate.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}(at),kt=function(t){function e(e){var i=t.call(this,e)||this;return i._backPlateMargin=1.25,i}return o(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 l.Mesh("menu_"+this.name,t);return this._backPlate=Object(l.CreateBox)("backPlate"+this.name,{size:1},t),this._backPlate.parent=e,e},e.prototype._affectMaterial=function(t){var e=this;this._backPlateMaterial=new pt(this.name+"backPlateMaterial",t.getScene()),this._backPlateMaterial.albedoColor=new l.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(){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 n=this.blockLayout;return n||(this.blockLayout=!0),t.prototype.addControl.call(this,i),i.isBackplateVisible=!1,i.scaling.scaleInPlace(e.MENU_BUTTON_SCALE),n||(this.blockLayout=!1),this},e.prototype.addControl=function(t){return l.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=.32,e}(ht),At=function(t){function e(e,i){var n=t.call(this,i)||this;return n._handConstraintBehavior=new l.HandConstraintBehavior,n._handConstraintBehavior.linkToXRExperience(e),n.backPlateMargin=.15,n.rows=3,n}return o(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}(kt),zt=function(t){function e(e,i){var n=t.call(this,i)||this;return n._currentMesh=e,n.pointerEnterAnimation=function(){n.mesh&&n.mesh.scaling.scaleInPlace(1.1)},n.pointerOutAnimation=function(){n.mesh&&n.mesh.scaling.scaleInPlace(1/1.1)},n.pointerDownAnimation=function(){n.mesh&&n.mesh.scaling.scaleInPlace(.95)},n.pointerUpAnimation=function(){n.mesh&&n.mesh.scaling.scaleInPlace(1/.95)},n}return o(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}(lt),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 o(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._isPinned=t,this._isPinned?(this._pinMaterial.emissiveColor.copyFromFloats(.25,.4,.95),this._defaultBehavior.followBehaviorEnabled=!1):(this._pinMaterial.emissiveColor.copyFromFloats(.08,.15,.55),this._defaultBehavior.followBehaviorEnabled=!0)},enumerable:!1,configurable:!0}),e.prototype._createPinButton=function(t){var i=this,n=new Pt("pin"+this.name,!1);return n.imageUrl=e.ASSETS_BASE_URL+e.PIN_ICON_FILENAME,n.parent=this,n._host=this._host,n.onPointerClickObservable.add((function(){return i.isPinned=!i.isPinned})),this._host.utilityLayer&&(n._prepareNode(this._host.utilityLayer.utilityLayerScene),n.scaling.scaleInPlace(kt.MENU_BUTTON_SCALE),this._pinMaterial=n.backMaterial,this._pinMaterial.diffuseColor.copyFromFloats(0,0,0),n.node&&(n.node.parent=t)),n},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/2+.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}(kt),Vt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype._mapGridNode=function(t,e){var i=t.mesh;if(i){t.position=e.clone();var n=l.TmpVectors.Vector3[0];switch(n.copyFrom(e),this.orientation){case _t.FACEORIGIN_ORIENTATION:case _t.FACEFORWARD_ORIENTATION:n.addInPlace(new l.Vector3(0,0,1)),i.lookAt(n);break;case _t.FACEFORWARDREVERSED_ORIENTATION:case _t.FACEORIGINREVERSED_ORIENTATION:n.addInPlace(new l.Vector3(0,0,-1)),i.lookAt(n)}}},e}(ht),jt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._iteration=100,e}return o(e,t),Object.defineProperty(e.prototype,"iteration",{get:function(){return this._iteration},set:function(t){var e=this;this._iteration!==t&&(this._iteration=t,l.Tools.SetImmediate((function(){e._arrangeChildren()})))},enumerable:!1,configurable:!0}),e.prototype._mapGridNode=function(t,e){var i=t.mesh,n=this._scatterMapping(e);if(i){switch(this.orientation){case _t.FACEORIGIN_ORIENTATION:case _t.FACEFORWARD_ORIENTATION:i.lookAt(new l.Vector3(0,0,1));break;case _t.FACEFORWARDREVERSED_ORIENTATION:case _t.FACEORIGINREVERSED_ORIENTATION:i.lookAt(new l.Vector3(0,0,-1))}t.position=n}},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 n=i[e];n.mesh&&t.push(n.mesh)}for(var o=0;o<this._iteration;o++){t.sort((function(t,e){var i=t.position.lengthSquared(),n=e.position.lengthSquared();return i<n?1:i>n?-1:0}));for(var r=Math.pow(this.margin,2),a=Math.max(this._cellWidth,this._cellHeight),s=l.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,_),s.x=_.x,s.y=_.y;var u=a,d=s.lengthSquared()-r;(d-=Math.min(d,r))<Math.pow(u,2)&&(s.normalize(),_.scaleInPlace(.5*(u-Math.sqrt(d))),t[c].position.addInPlace(_),t[h].position.subtractInPlace(_))}}},e}(ht),Wt="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_;\n\nuniform vec4 _Sky_Color_;\nuniform vec4 _Horizon_Color_;\nuniform vec4 _Ground_Color_;\nuniform float _Horizon_Power_;\n\nuniform sampler2D _Reflection_Map_;\nuniform sampler2D _Indirect_Environment_;\n\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_;\n\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_;\n\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_;\n\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_;\n\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;\n\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}\n\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}\n\n\nvoid Scale_RGB_B59(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{\nResult=vec4(Scalar,Scalar,Scalar,1)*Color;\n}\n\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);\n\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);\n\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}\n\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));\n\n\n\n\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}\n\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\n}\n\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}\n\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}\n\n\nvoid Scale_Color_B91(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{\nResult=Scalar*Color;\n}\n\n\nvoid From_HSV_B73(\nfloat Hue,\nfloat Saturation,\nfloat Value,\nfloat Alpha,\nout vec4 Color)\n{\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}\n\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}\n\n\nvoid Mapped_Environment_B51(\nsampler2D Reflected_Environment,\nsampler2D Indirect_Environment,\nvec3 Dir,\nout vec4 Reflected_Color,\nout vec4 Indirect_Diffuse)\n{\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}\n\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{\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}\n\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}\n\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}\n\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}\n\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}\n\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}\n\n\nvoid To_HSV_B75(\nvec4 Color,\nout float Hue,\nout float Saturation,\nout float Value,\nout float Alpha,\nout vec3 HSV)\n{\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}\n\n\nvoid Code_B110(\nfloat X,\nout float Result)\n{\nResult=(acos(X)/3.14159-0.5)*2.0;\n}\n\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}\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\n\nvec3 Incident_Q39=normalize(vPosition-cameraPosition);\n\nvec3 Normalized_Q38=normalize(vNormal);\n\nvec3 Normalized_Q71=normalize(vTangent);\n\nvec4 Color_Q83;\n#if DECAL_ENABLE\nColor_Q83=texture(_Decal_,vUV);\n#else\nColor_Q83=vec4(0,0,0,0);\n#endif\n\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;\n\nvec4 Linear_Q43;\nLinear_Q43.rgb=clamp(_Sky_Color_.rgb*_Sky_Color_.rgb,0.0,1.0);\nLinear_Q43.a=_Sky_Color_.a;\n\nvec4 Linear_Q44;\nLinear_Q44.rgb=clamp(_Horizon_Color_.rgb*_Horizon_Color_.rgb,0.0,1.0);\nLinear_Q44.a=_Horizon_Color_.a;\n\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);\n\nvec4 Linear_Q46;\nLinear_Q46.rgb=clamp(_Albedo_.rgb*_Albedo_.rgb,0.0,1.0);\nLinear_Q46.a=_Albedo_.a;\n\nvec3 Normalized_Q107=normalize(vBinormal);\n\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);\n\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);\n\nvec3 Reflected_Q47=reflect(Incident_Q39,New_Normal_Q79);\n\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);\n\nfloat Dot_Q72=dot(Incident_Q70,Normalized_Q71);\n\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);\n\nfloat AbsA_Q76=abs(Result_Q110);\n\nfloat MinAB_Q58=min(NotInShadow_Q67,NotInShadow_Q68);\n\nvec4 Sum_Q48=Reflected_Color_Q51+Reflected_Color_Q50;\n\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);\n\nfloat Product_Q106;\nProduct_Q106=AbsA_Q76*_Hue_Shift_;\n\nfloat X_Q128;\nfloat Y_Q128;\nfloat Z_Q128;\nTo_XYZ_B74(HSV_Out_Q126,X_Q128,Y_Q128,Z_Q128);\n\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);\n\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);\n\nvec4 Result_Q131=_Rim_Intensity_*Color_Q129;\n\nvec4 Result_Q113=_Iridescence_Intensity_*Color_Q111;\nvec4 Color_Q73;\nFrom_HSV_B73(X_Q74,Y_Q74,Z_Q74,0.0,Color_Q73);\n\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);\n\nvec4 Result_Q31=Blob_Color_Q30+(1.0-Blob_Color_Q30.a)*sRGB_Q42;\n\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}";l.ShaderStore.ShadersStore.mrdlSliderBarPixelShader=Wt;var Ht="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_;\n\nuniform vec4 _Sky_Color_;\nuniform vec4 _Horizon_Color_;\nuniform vec4 _Ground_Color_;\nuniform float _Horizon_Power_;\n\nuniform sampler2D _Reflection_Map_;\nuniform sampler2D _Indirect_Environment_;\n\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_;\n\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_;\n\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_;\n\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_;\n\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;\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}\n\n\nvoid Object_To_World_Normal_B32(\nvec3 Nrm_Object,\nout vec3 Nrm_World)\n{\nNrm_World=(vec4(Nrm_Object,0.0)).xyz;\n}\n\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}\n\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}\n\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;\n\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;\n\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}\n\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}\n\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}\n\n\nvoid Conditional_Float_B93(\nbool Which,\nfloat If_True,\nfloat If_False,\nout float Result)\n{\nResult=Which ? If_True : If_False;\n}\n\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}\n\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}\n\n\nvoid Conditional_Float_B36(\nbool Which,\nfloat If_True,\nfloat If_False,\nout float Result)\n{\nResult=Which ? If_True : If_False;\n}\n\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}\n\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}\n\nvoid main()\n{\n\nvec2 XY_Q85;\nXY_Q85=(uv-vec2(0.5,0.5))*_Decal_Scale_XY_+vec2(0.5,0.5);\n\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);\n\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);\n\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);\n\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);\n\nvec4 Linear_Q101;\nLinear_Q101.rgb=clamp(_Left_Color_.rgb*_Left_Color_.rgb,0.0,1.0);\nLinear_Q101.a=_Left_Color_.a;\n\nvec4 Linear_Q102;\nLinear_Q102.rgb=clamp(_Right_Color_.rgb*_Right_Color_.rgb,0.0,1.0);\nLinear_Q102.a=_Right_Color_.a;\n\nvec3 Difference_Q61=vec3(0,0,0)-Normal_World_N_Q60;\n\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);\n\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);\n\nvec4 Color_At_T_Q97=mix(Linear_Q101,Linear_Q102,Out_Q105);\n\nfloat Minus_F_Q87=-Z_Q86;\n\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;\n\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);\n\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}";l.ShaderStore.ShadersStore.mrdlSliderBarVertexShader=Ht;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 o(e,t),e}(l.MaterialDefines),Ut=function(t){function e(i,n){var o=t.call(this,i,n)||this;return o.radius=.6,o.bevelFront=.6,o.bevelFrontStretch=.077,o.bevelBack=0,o.bevelBackStretch=0,o.radiusTopLeft=1,o.radiusTopRight=1,o.radiusBottomLeft=1,o.radiusBottomRight=1,o.bulgeEnabled=!1,o.bulgeHeight=-.323,o.bulgeRadius=.73,o.sunIntensity=1.102,o.sunTheta=.76,o.sunPhi=.526,o.indirectDiffuse=.658,o.albedo=new l.Color4(.0117647,.505882,.996078,1),o.specular=0,o.shininess=10,o.sharpness=0,o.subsurface=0,o.leftGradientColor=new l.Color4(.0117647,.505882,.996078,1),o.rightGradientColor=new l.Color4(.0117647,.505882,.996078,1),o.reflection=.749,o.frontReflect=0,o.edgeReflect=.09,o.power=8.13,o.skyColor=new l.Color4(.0117647,.964706,.996078,1),o.horizonColor=new l.Color4(.0117647,.333333,.996078,1),o.groundColor=new l.Color4(0,.254902,.996078,1),o.horizonPower=1,o.width=.02,o.fuzz=.5,o.minFuzz=.001,o.clipFade=.01,o.hueShift=0,o.saturationShift=0,o.valueShift=0,o.blobPosition=new l.Vector3(0,0,.1),o.blobIntensity=.5,o.blobNearSize=.01,o.blobFarSize=.03,o.blobNearDistance=0,o.blobFarDistance=.08,o.blobFadeLength=.576,o.blobPulse=0,o.blobFade=1,o.blobPosition2=new l.Vector3(.2,0,.1),o.blobNearSize2=.01,o.blobPulse2=0,o.blobFade2=1,o.blobTexture=new l.Texture("",o.getScene()),o.leftIndexPosition=new l.Vector3(0,0,1),o.rightIndexPosition=new l.Vector3(-1,-1,-1),o.leftIndexMiddlePosition=new l.Vector3(0,0,0),o.rightIndexMiddlePosition=new l.Vector3(0,0,0),o.decalScaleXY=new l.Vector2(1.5,1.5),o.decalFrontOnly=!0,o.rimIntensity=.287,o.rimHueShift=0,o.rimSaturationShift=0,o.rimValueShift=-1,o.iridescenceIntensity=0,o.useGlobalLeftIndex=1,o.useGlobalRightIndex=1,o.globalLeftIndexTipProximity=0,o.globalRightIndexTipProximity=0,o.globalLeftIndexTipPosition=new l.Vector4(.5,0,-.55,1),o.globaRightIndexTipPosition=new l.Vector4(0,0,0,1),o.globalLeftThumbTipPosition=new l.Vector4(.5,0,-.55,1),o.globalRightThumbTipPosition=new l.Vector4(0,0,0,1),o.globalLeftIndexMiddlePosition=new l.Vector4(.5,0,-.55,1),o.globalRightIndexMiddlePosition=new l.Vector4(0,0,0,1),o.alphaMode=l.Constants.ALPHA_DISABLE,o.backFaceCulling=!1,o._blueGradientTexture=new l.Texture(e.BLUE_GRADIENT_TEXTURE_URL,n,!0,!1,l.Texture.NEAREST_SAMPLINGMODE),o}return o(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,i){if(this.isFrozen&&e.effect&&e.effect._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new Gt);var n=e.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(e))return!0;var r=o.getEngine();if(l.MaterialHelper.PrepareDefinesForAttributes(t,n,!1,!1),n.isDirty){n.markAsProcessed(),o.resetCachedMaterial();var a=new l.EffectFallbacks;n.FOG&&a.addFallback(1,"FOG"),l.MaterialHelper.HandleFallbacksForShadows(n,a),n.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;var s=[l.VertexBuffer.PositionKind];n.NORMAL&&s.push(l.VertexBuffer.NormalKind),n.UV1&&s.push(l.VertexBuffer.UVKind),n.UV2&&s.push(l.VertexBuffer.UV2Kind),n.VERTEXCOLOR&&s.push(l.VertexBuffer.ColorKind),n.TANGENT&&s.push(l.VertexBuffer.TangentKind),l.MaterialHelper.PrepareAttributesForInstances(s,n);var _=n.toString(),h=["world","viewProjection","cameraPosition","_Radius_","_Bevel_Front_","_Bevel_Front_Stretch_","_Bevel_Back_","_Bevel_Back_Stretch_","_Radius_Top_Left_","_Radius_Top_Right_","_Radius_Bottom_Left_","_Radius_Bottom_Right_","_Bulge_Enabled_","_Bulge_Height_","_Bulge_Radius_","_Sun_Intensity_","_Sun_Theta_","_Sun_Phi_","_Indirect_Diffuse_","_Albedo_","_Specular_","_Shininess_","_Sharpness_","_Subsurface_","_Left_Color_","_Right_Color_","_Reflection_","_Front_Reflect_","_Edge_Reflect_","_Power_","_Sky_Color_","_Horizon_Color_","_Ground_Color_","_Horizon_Power_","_Reflection_Map_","_Indirect_Environment_","_Width_","_Fuzz_","_Min_Fuzz_","_Clip_Fade_","_Hue_Shift_","_Saturation_Shift_","_Value_Shift_","_Blob_Position_","_Blob_Intensity_","_Blob_Near_Size_","_Blob_Far_Size_","_Blob_Near_Distance_","_Blob_Far_Distance_","_Blob_Fade_Length_","_Blob_Pulse_","_Blob_Fade_","_Blob_Texture_","_Blob_Position_2_","_Blob_Near_Size_2_","_Blob_Pulse_2_","_Blob_Fade_2_","_Left_Index_Pos_","_Right_Index_Pos_","_Left_Index_Middle_Pos_","_Right_Index_Middle_Pos_","_Decal_","_Decal_Scale_XY_","_Decal_Front_Only_","_Rim_Intensity_","_Rim_Texture_","_Rim_Hue_Shift_","_Rim_Saturation_Shift_","_Rim_Value_Shift_","_Iridescence_Intensity_","_Iridescence_Texture_","Use_Global_Left_Index","Use_Global_Right_Index","Global_Left_Index_Tip_Position","Global_Right_Index_Tip_Position","Global_Left_Thumb_Tip_Position","Global_Right_Thumb_Tip_Position","Global_Left_Index_Middle_Position;","Global_Right_Index_Middle_Position","Global_Left_Index_Tip_Proximity","Global_Right_Index_Tip_Proximity"],c=["_Rim_Texture_","_Iridescence_Texture_"],u=new Array;l.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:h,uniformBuffersNames:u,samplers:c,defines:n,maxSimultaneousLights:4}),e.setEffect(o.getEngine().createEffect("mrdlSliderBar",{attributes:s,uniformsNames:h,uniformBuffersNames:u,samplers:c,defines:_,fallbacks:a,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},r),n,this._materialContext)}return!(!e.effect||!e.effect.isReady())&&(n._renderId=o.getRenderId(),e.effect._wasPreviouslyReady=!0,!0)},e.prototype.bindForSubMesh=function(t,e,i){if(i.materialDefines){var n=i.effect;n&&(this._activeEffect=n,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_",new l.Texture("",this.getScene())),this._activeEffect.setTexture("_Indirect_Environment_",new l.Texture("",this.getScene())),this._activeEffect.setFloat("_Width_",this.width),this._activeEffect.setFloat("_Fuzz_",this.fuzz),this._activeEffect.setFloat("_Min_Fuzz_",this.minFuzz),this._activeEffect.setFloat("_Clip_Fade_",this.clipFade),this._activeEffect.setFloat("_Hue_Shift_",this.hueShift),this._activeEffect.setFloat("_Saturation_Shift_",this.saturationShift),this._activeEffect.setFloat("_Value_Shift_",this.valueShift),this._activeEffect.setVector3("_Blob_Position_",this.blobPosition),this._activeEffect.setFloat("_Blob_Intensity_",this.blobIntensity),this._activeEffect.setFloat("_Blob_Near_Size_",this.blobNearSize),this._activeEffect.setFloat("_Blob_Far_Size_",this.blobFarSize),this._activeEffect.setFloat("_Blob_Near_Distance_",this.blobNearDistance),this._activeEffect.setFloat("_Blob_Far_Distance_",this.blobFarDistance),this._activeEffect.setFloat("_Blob_Fade_Length_",this.blobFadeLength),this._activeEffect.setFloat("_Blob_Pulse_",this.blobPulse),this._activeEffect.setFloat("_Blob_Fade_",this.blobFade),this._activeEffect.setTexture("_Blob_Texture_",this.blobTexture),this._activeEffect.setVector3("_Blob_Position_2_",this.blobPosition2),this._activeEffect.setFloat("_Blob_Near_Size_2_",this.blobNearSize2),this._activeEffect.setFloat("_Blob_Pulse_2_",this.blobPulse2),this._activeEffect.setFloat("_Blob_Fade_2_",this.blobFade2),this._activeEffect.setVector3("_Left_Index_Pos_",this.leftIndexPosition),this._activeEffect.setVector3("_Right_Index_Pos_",this.rightIndexPosition),this._activeEffect.setVector3("_Left_Index_Middle_Pos_",this.leftIndexMiddlePosition),this._activeEffect.setVector3("_Right_Index_Middle_Pos_",this.rightIndexMiddlePosition),this._activeEffect.setTexture("_Decal_",new l.Texture("",this.getScene())),this._activeEffect.setVector2("_Decal_Scale_XY_",this.decalScaleXY),this._activeEffect.setFloat("_Decal_Front_Only_",this.decalFrontOnly?1:0),this._activeEffect.setFloat("_Rim_Intensity_",this.rimIntensity),this._activeEffect.setTexture("_Rim_Texture_",this._blueGradientTexture),this._activeEffect.setFloat("_Rim_Hue_Shift_",this.rimHueShift),this._activeEffect.setFloat("_Rim_Saturation_Shift_",this.rimSaturationShift),this._activeEffect.setFloat("_Rim_Value_Shift_",this.rimValueShift),this._activeEffect.setFloat("_Iridescence_Intensity_",this.iridescenceIntensity),this._activeEffect.setTexture("_Iridescence_Texture_",this._blueGradientTexture),this._activeEffect.setFloat("Use_Global_Left_Index",this.useGlobalLeftIndex),this._activeEffect.setFloat("Use_Global_Right_Index",this.useGlobalRightIndex),this._activeEffect.setVector4("Global_Left_Index_Tip_Position",this.globalLeftIndexTipPosition),this._activeEffect.setVector4("Global_Right_Index_Tip_Position",this.globaRightIndexTipPosition),this._activeEffect.setVector4("Global_Left_Thumb_Tip_Position",this.globalLeftThumbTipPosition),this._activeEffect.setVector4("Global_Right_Thumb_Tip_Position",this.globalRightThumbTipPosition),this._activeEffect.setVector4("Global_Left_Index_Middle_Position",this.globalLeftIndexMiddlePosition),this._activeEffect.setVector4("Global_Right_Index_Middle_Position",this.globalRightIndexMiddlePosition),this._activeEffect.setFloat("Global_Left_Index_Tip_Proximity",this.globalLeftIndexTipProximity),this._activeEffect.setFloat("Global_Right_Index_Tip_Proximity",this.globalRightIndexTipProximity),this._afterBind(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 l.SerializationHelper.Clone((function(){return new e(t,i.getScene())}),this)},e.prototype.serialize=function(){var t=l.SerializationHelper.Serialize(this);return t.customType="BABYLON.MRDLSliderBarMaterial",t},e.prototype.getClassName=function(){return"MRDLSliderBarMaterial"},e.Parse=function(t,i,n){return l.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,n)},e.BLUE_GRADIENT_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/MRDL/mrtk-mrdl-blue-gradient.png",r([Object(l.serialize)()],e.prototype,"radius",void 0),r([Object(l.serialize)()],e.prototype,"bevelFront",void 0),r([Object(l.serialize)()],e.prototype,"bevelFrontStretch",void 0),r([Object(l.serialize)()],e.prototype,"bevelBack",void 0),r([Object(l.serialize)()],e.prototype,"bevelBackStretch",void 0),r([Object(l.serialize)()],e.prototype,"radiusTopLeft",void 0),r([Object(l.serialize)()],e.prototype,"radiusTopRight",void 0),r([Object(l.serialize)()],e.prototype,"radiusBottomLeft",void 0),r([Object(l.serialize)()],e.prototype,"radiusBottomRight",void 0),r([Object(l.serialize)()],e.prototype,"bulgeEnabled",void 0),r([Object(l.serialize)()],e.prototype,"bulgeHeight",void 0),r([Object(l.serialize)()],e.prototype,"bulgeRadius",void 0),r([Object(l.serialize)()],e.prototype,"sunIntensity",void 0),r([Object(l.serialize)()],e.prototype,"sunTheta",void 0),r([Object(l.serialize)()],e.prototype,"sunPhi",void 0),r([Object(l.serialize)()],e.prototype,"indirectDiffuse",void 0),r([Object(l.serialize)()],e.prototype,"albedo",void 0),r([Object(l.serialize)()],e.prototype,"specular",void 0),r([Object(l.serialize)()],e.prototype,"shininess",void 0),r([Object(l.serialize)()],e.prototype,"sharpness",void 0),r([Object(l.serialize)()],e.prototype,"subsurface",void 0),r([Object(l.serialize)()],e.prototype,"leftGradientColor",void 0),r([Object(l.serialize)()],e.prototype,"rightGradientColor",void 0),r([Object(l.serialize)()],e.prototype,"reflection",void 0),r([Object(l.serialize)()],e.prototype,"frontReflect",void 0),r([Object(l.serialize)()],e.prototype,"edgeReflect",void 0),r([Object(l.serialize)()],e.prototype,"power",void 0),r([Object(l.serialize)()],e.prototype,"skyColor",void 0),r([Object(l.serialize)()],e.prototype,"horizonColor",void 0),r([Object(l.serialize)()],e.prototype,"groundColor",void 0),r([Object(l.serialize)()],e.prototype,"horizonPower",void 0),r([Object(l.serialize)()],e.prototype,"width",void 0),r([Object(l.serialize)()],e.prototype,"fuzz",void 0),r([Object(l.serialize)()],e.prototype,"minFuzz",void 0),r([Object(l.serialize)()],e.prototype,"clipFade",void 0),r([Object(l.serialize)()],e.prototype,"hueShift",void 0),r([Object(l.serialize)()],e.prototype,"saturationShift",void 0),r([Object(l.serialize)()],e.prototype,"valueShift",void 0),r([Object(l.serialize)()],e.prototype,"blobPosition",void 0),r([Object(l.serialize)()],e.prototype,"blobIntensity",void 0),r([Object(l.serialize)()],e.prototype,"blobNearSize",void 0),r([Object(l.serialize)()],e.prototype,"blobFarSize",void 0),r([Object(l.serialize)()],e.prototype,"blobNearDistance",void 0),r([Object(l.serialize)()],e.prototype,"blobFarDistance",void 0),r([Object(l.serialize)()],e.prototype,"blobFadeLength",void 0),r([Object(l.serialize)()],e.prototype,"blobPulse",void 0),r([Object(l.serialize)()],e.prototype,"blobFade",void 0),r([Object(l.serialize)()],e.prototype,"blobPosition2",void 0),r([Object(l.serialize)()],e.prototype,"blobNearSize2",void 0),r([Object(l.serialize)()],e.prototype,"blobPulse2",void 0),r([Object(l.serialize)()],e.prototype,"blobFade2",void 0),r([Object(l.serialize)()],e.prototype,"blobTexture",void 0),r([Object(l.serialize)()],e.prototype,"leftIndexPosition",void 0),r([Object(l.serialize)()],e.prototype,"rightIndexPosition",void 0),r([Object(l.serialize)()],e.prototype,"leftIndexMiddlePosition",void 0),r([Object(l.serialize)()],e.prototype,"rightIndexMiddlePosition",void 0),r([Object(l.serialize)()],e.prototype,"decalScaleXY",void 0),r([Object(l.serialize)()],e.prototype,"decalFrontOnly",void 0),r([Object(l.serialize)()],e.prototype,"rimIntensity",void 0),r([Object(l.serialize)()],e.prototype,"rimHueShift",void 0),r([Object(l.serialize)()],e.prototype,"rimSaturationShift",void 0),r([Object(l.serialize)()],e.prototype,"rimValueShift",void 0),r([Object(l.serialize)()],e.prototype,"iridescenceIntensity",void 0),e}(l.PushMaterial);Object(l.RegisterClass)("BABYLON.GUI.MRDLSliderBarMaterial",Ut);var Xt="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_;\n\nuniform vec4 _Sky_Color_;\nuniform vec4 _Horizon_Color_;\nuniform vec4 _Ground_Color_;\nuniform float _Horizon_Power_;\n\nuniform sampler2D _Reflection_Map_;\nuniform sampler2D _Indirect_Environment_;\n\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_;\n\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_;\n\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_;\n\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_;\n\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;\n\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}\n\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}\n\n\nvoid Scale_RGB_B209(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{\nResult=vec4(Scalar,Scalar,Scalar,1)*Color;\n}\n\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);\n\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);\n\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}\n\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));\n\n\n\n\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}\n\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\n}\n\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}\n\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}\n\n\nvoid Scale_Color_B241(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{\nResult=Scalar*Color;\n}\n\n\nvoid From_HSV_B223(\nfloat Hue,\nfloat Saturation,\nfloat Value,\nfloat Alpha,\nout vec4 Color)\n{\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}\n\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}\n\n\nvoid Mapped_Environment_B201(\nsampler2D Reflected_Environment,\nsampler2D Indirect_Environment,\nvec3 Dir,\nout vec4 Reflected_Color,\nout vec4 Indirect_Diffuse)\n{\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}\n\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{\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}\n\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}\n\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}\n\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}\n\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}\n\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}\n\n\nvoid To_HSV_B225(\nvec4 Color,\nout float Hue,\nout float Saturation,\nout float Value,\nout float Alpha,\nout vec3 HSV)\n{\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}\n\n\nvoid Code_B260(\nfloat X,\nout float Result)\n{\nResult=(acos(X)/3.14159-0.5)*2.0;\n}\n\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}\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\n\nvec3 Incident_Q189=normalize(vPosition-cameraPosition);\n\nvec3 Normalized_Q188=normalize(vNormal);\n\nvec3 Normalized_Q221=normalize(vTangent);\n\nvec4 Color_Q233;\n#if DECAL_ENABLE\nColor_Q233=texture(_Decal_,vUV);\n#else\nColor_Q233=vec4(0,0,0,0);\n#endif\n\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;\n\nvec4 Linear_Q193;\nLinear_Q193.rgb=clamp(_Sky_Color_.rgb*_Sky_Color_.rgb,0.0,1.0);\nLinear_Q193.a=_Sky_Color_.a;\n\nvec4 Linear_Q194;\nLinear_Q194.rgb=clamp(_Horizon_Color_.rgb*_Horizon_Color_.rgb,0.0,1.0);\nLinear_Q194.a=_Horizon_Color_.a;\n\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);\n\nvec4 Linear_Q196;\nLinear_Q196.rgb=clamp(_Albedo_.rgb*_Albedo_.rgb,0.0,1.0);\nLinear_Q196.a=_Albedo_.a;\n\nvec3 Normalized_Q257=normalize(vBinormal);\n\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);\n\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);\n\nvec3 Reflected_Q197=reflect(Incident_Q189,New_Normal_Q229);\n\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);\n\nfloat Dot_Q222=dot(Incident_Q220,Normalized_Q221);\n\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);\n\nfloat AbsA_Q226=abs(Result_Q260);\n\nfloat MinAB_Q208=min(NotInShadow_Q217,NotInShadow_Q218);\n\nvec4 Sum_Q198=Reflected_Color_Q201+Reflected_Color_Q200;\n\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);\n\nfloat Product_Q256;\nProduct_Q256=AbsA_Q226*_Hue_Shift_;\n\nfloat X_Q278;\nfloat Y_Q278;\nfloat Z_Q278;\nTo_XYZ_B224(HSV_Out_Q276,X_Q278,Y_Q278,Z_Q278);\n\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);\n\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);\n\nvec4 Result_Q281=_Rim_Intensity_*Color_Q279;\n\nvec4 Result_Q263=_Iridescence_Intensity_*Color_Q261;\nvec4 Color_Q223;\nFrom_HSV_B223(X_Q224,Y_Q224,Z_Q224,0.0,Color_Q223);\n\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);\n\nvec4 Result_Q181=Blob_Color_Q180+(1.0-Blob_Color_Q180.a)*sRGB_Q192;\n\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}";l.ShaderStore.ShadersStore.mrdlSliderThumbPixelShader=Xt;var Yt="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_;\n\nuniform vec4 _Sky_Color_;\nuniform vec4 _Horizon_Color_;\nuniform vec4 _Ground_Color_;\nuniform float _Horizon_Power_;\n\nuniform sampler2D _Reflection_Map_;\nuniform sampler2D _Indirect_Environment_;\n\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_;\n\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_;\n\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_;\n\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_;\n\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;\n\nvoid Object_To_World_Pos_B162(\nvec3 Pos_Object,\nout vec3 Pos_World)\n{\nPos_World=(world*vec4(Pos_Object,1.0)).xyz;\n}\n\n\nvoid Object_To_World_Normal_B182(\nvec3 Nrm_Object,\nout vec3 Nrm_World)\n{\nNrm_World=(vec4(Nrm_Object,0.0)).xyz;\n}\n\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}\n\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}\n\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;\n\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;\n\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}\n\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}\n\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}\n\n\nvoid Conditional_Float_B243(\nbool Which,\nfloat If_True,\nfloat If_False,\nout float Result)\n{\nResult=Which ? If_True : If_False;\n}\n\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}\n\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}\n\n\nvoid Conditional_Float_B186(\nbool Which,\nfloat If_True,\nfloat If_False,\nout float Result)\n{\nResult=Which ? If_True : If_False;\n}\n\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}\n\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}\n\nvoid main()\n{\n\nvec2 XY_Q235;\nXY_Q235=(uv-vec2(0.5,0.5))*_Decal_Scale_XY_+vec2(0.5,0.5);\n\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);\n\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);\n\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);\n\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);\n\nvec4 Linear_Q251;\nLinear_Q251.rgb=clamp(_Left_Color_.rgb*_Left_Color_.rgb,0.0,1.0);\nLinear_Q251.a=_Left_Color_.a;\n\nvec4 Linear_Q252;\nLinear_Q252.rgb=clamp(_Right_Color_.rgb*_Right_Color_.rgb,0.0,1.0);\nLinear_Q252.a=_Right_Color_.a;\n\nvec3 Difference_Q211=vec3(0,0,0)-Normal_World_N_Q210;\n\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);\n\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);\n\nvec4 Color_At_T_Q247=mix(Linear_Q251,Linear_Q252,Out_Q255);\n\nfloat Minus_F_Q237=-Z_Q236;\n\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;\n\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);\n\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}";l.ShaderStore.ShadersStore.mrdlSliderThumbVertexShader=Yt;var Zt=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 o(e,t),e}(l.MaterialDefines),Kt=function(t){function e(i,n){var o=t.call(this,i,n)||this;return o.radius=.157,o.bevelFront=.065,o.bevelFrontStretch=.077,o.bevelBack=.031,o.bevelBackStretch=0,o.radiusTopLeft=1,o.radiusTopRight=1,o.radiusBottomLeft=1,o.radiusBottomRight=1,o.bulgeEnabled=!1,o.bulgeHeight=-.323,o.bulgeRadius=.73,o.sunIntensity=2,o.sunTheta=.937,o.sunPhi=.555,o.indirectDiffuse=1,o.albedo=new l.Color4(.0117647,.505882,.996078,1),o.specular=0,o.shininess=10,o.sharpness=0,o.subsurface=.31,o.leftGradientColor=new l.Color4(.0117647,.505882,.996078,1),o.rightGradientColor=new l.Color4(.0117647,.505882,.996078,1),o.reflection=.749,o.frontReflect=0,o.edgeReflect=.09,o.power=8.1,o.skyColor=new l.Color4(.0117647,.960784,.996078,1),o.horizonColor=new l.Color4(.0117647,.333333,.996078,1),o.groundColor=new l.Color4(0,.254902,.996078,1),o.horizonPower=1,o.width=.02,o.fuzz=.5,o.minFuzz=.001,o.clipFade=.01,o.hueShift=0,o.saturationShift=0,o.valueShift=0,o.blobPosition=new l.Vector3(0,0,.1),o.blobIntensity=.5,o.blobNearSize=.01,o.blobFarSize=.03,o.blobNearDistance=0,o.blobFarDistance=.08,o.blobFadeLength=.576,o.blobPulse=0,o.blobFade=1,o.blobPosition2=new l.Vector3(.2,0,.1),o.blobNearSize2=.01,o.blobPulse2=0,o.blobFade2=1,o.blobTexture=new l.Texture("",o.getScene()),o.leftIndexPosition=new l.Vector3(0,0,1),o.rightIndexPosition=new l.Vector3(-1,-1,-1),o.leftIndexMiddlePosition=new l.Vector3(0,0,0),o.rightIndexMiddlePosition=new l.Vector3(0,0,0),o.decalScaleXY=new l.Vector2(1.5,1.5),o.decalFrontOnly=!0,o.rimIntensity=.287,o.rimHueShift=0,o.rimSaturationShift=0,o.rimValueShift=-1,o.iridescenceIntensity=0,o.useGlobalLeftIndex=1,o.useGlobalRightIndex=1,o.globalLeftIndexTipProximity=0,o.globalRightIndexTipProximity=0,o.globalLeftIndexTipPosition=new l.Vector4(.5,0,-.55,1),o.globaRightIndexTipPosition=new l.Vector4(0,0,0,1),o.globalLeftThumbTipPosition=new l.Vector4(.5,0,-.55,1),o.globalRightThumbTipPosition=new l.Vector4(0,0,0,1),o.globalLeftIndexMiddlePosition=new l.Vector4(.5,0,-.55,1),o.globalRightIndexMiddlePosition=new l.Vector4(0,0,0,1),o.alphaMode=l.Constants.ALPHA_DISABLE,o.backFaceCulling=!1,o._blueGradientTexture=new l.Texture(e.BLUE_GRADIENT_TEXTURE_URL,n,!0,!1,l.Texture.NEAREST_SAMPLINGMODE),o}return o(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,i){if(this.isFrozen&&e.effect&&e.effect._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new Zt);var n=e.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(e))return!0;var r=o.getEngine();if(l.MaterialHelper.PrepareDefinesForAttributes(t,n,!1,!1),n.isDirty){n.markAsProcessed(),o.resetCachedMaterial();var a=new l.EffectFallbacks;n.FOG&&a.addFallback(1,"FOG"),l.MaterialHelper.HandleFallbacksForShadows(n,a),n.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;var s=[l.VertexBuffer.PositionKind];n.NORMAL&&s.push(l.VertexBuffer.NormalKind),n.UV1&&s.push(l.VertexBuffer.UVKind),n.UV2&&s.push(l.VertexBuffer.UV2Kind),n.VERTEXCOLOR&&s.push(l.VertexBuffer.ColorKind),n.TANGENT&&s.push(l.VertexBuffer.TangentKind),l.MaterialHelper.PrepareAttributesForInstances(s,n);var _=n.toString(),h=["world","viewProjection","cameraPosition","_Radius_","_Bevel_Front_","_Bevel_Front_Stretch_","_Bevel_Back_","_Bevel_Back_Stretch_","_Radius_Top_Left_","_Radius_Top_Right_","_Radius_Bottom_Left_","_Radius_Bottom_Right_","_Bulge_Enabled_","_Bulge_Height_","_Bulge_Radius_","_Sun_Intensity_","_Sun_Theta_","_Sun_Phi_","_Indirect_Diffuse_","_Albedo_","_Specular_","_Shininess_","_Sharpness_","_Subsurface_","_Left_Color_","_Right_Color_","_Reflection_","_Front_Reflect_","_Edge_Reflect_","_Power_","_Sky_Color_","_Horizon_Color_","_Ground_Color_","_Horizon_Power_","_Reflection_Map_","_Indirect_Environment_","_Width_","_Fuzz_","_Min_Fuzz_","_Clip_Fade_","_Hue_Shift_","_Saturation_Shift_","_Value_Shift_","_Blob_Position_","_Blob_Intensity_","_Blob_Near_Size_","_Blob_Far_Size_","_Blob_Near_Distance_","_Blob_Far_Distance_","_Blob_Fade_Length_","_Blob_Pulse_","_Blob_Fade_","_Blob_Texture_","_Blob_Position_2_","_Blob_Near_Size_2_","_Blob_Pulse_2_","_Blob_Fade_2_","_Left_Index_Pos_","_Right_Index_Pos_","_Left_Index_Middle_Pos_","_Right_Index_Middle_Pos_","_Decal_","_Decal_Scale_XY_","_Decal_Front_Only_","_Rim_Intensity_","_Rim_Texture_","_Rim_Hue_Shift_","_Rim_Saturation_Shift_","_Rim_Value_Shift_","_Iridescence_Intensity_","_Iridescence_Texture_","Use_Global_Left_Index","Use_Global_Right_Index","Global_Left_Index_Tip_Position","Global_Right_Index_Tip_Position","Global_Left_Thumb_Tip_Position","Global_Right_Thumb_Tip_Position","Global_Left_Index_Middle_Position;","Global_Right_Index_Middle_Position","Global_Left_Index_Tip_Proximity","Global_Right_Index_Tip_Proximity"],c=["_Rim_Texture_","_Iridescence_Texture_"],u=new Array;l.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:h,uniformBuffersNames:u,samplers:c,defines:n,maxSimultaneousLights:4}),e.setEffect(o.getEngine().createEffect("mrdlSliderThumb",{attributes:s,uniformsNames:h,uniformBuffersNames:u,samplers:c,defines:_,fallbacks:a,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},r),n)}return!(!e.effect||!e.effect.isReady())&&(n._renderId=o.getRenderId(),e.effect._wasPreviouslyReady=!0,!0)},e.prototype.bindForSubMesh=function(t,e,i){if(i.materialDefines){var n=i.effect;n&&(this._activeEffect=n,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_",new l.Texture("",this.getScene())),this._activeEffect.setTexture("_Indirect_Environment_",new l.Texture("",this.getScene())),this._activeEffect.setFloat("_Width_",this.width),this._activeEffect.setFloat("_Fuzz_",this.fuzz),this._activeEffect.setFloat("_Min_Fuzz_",this.minFuzz),this._activeEffect.setFloat("_Clip_Fade_",this.clipFade),this._activeEffect.setFloat("_Hue_Shift_",this.hueShift),this._activeEffect.setFloat("_Saturation_Shift_",this.saturationShift),this._activeEffect.setFloat("_Value_Shift_",this.valueShift),this._activeEffect.setVector3("_Blob_Position_",this.blobPosition),this._activeEffect.setFloat("_Blob_Intensity_",this.blobIntensity),this._activeEffect.setFloat("_Blob_Near_Size_",this.blobNearSize),this._activeEffect.setFloat("_Blob_Far_Size_",this.blobFarSize),this._activeEffect.setFloat("_Blob_Near_Distance_",this.blobNearDistance),this._activeEffect.setFloat("_Blob_Far_Distance_",this.blobFarDistance),this._activeEffect.setFloat("_Blob_Fade_Length_",this.blobFadeLength),this._activeEffect.setFloat("_Blob_Pulse_",this.blobPulse),this._activeEffect.setFloat("_Blob_Fade_",this.blobFade),this._activeEffect.setTexture("_Blob_Texture_",this.blobTexture),this._activeEffect.setVector3("_Blob_Position_2_",this.blobPosition2),this._activeEffect.setFloat("_Blob_Near_Size_2_",this.blobNearSize2),this._activeEffect.setFloat("_Blob_Pulse_2_",this.blobPulse2),this._activeEffect.setFloat("_Blob_Fade_2_",this.blobFade2),this._activeEffect.setVector3("_Left_Index_Pos_",this.leftIndexPosition),this._activeEffect.setVector3("_Right_Index_Pos_",this.rightIndexPosition),this._activeEffect.setVector3("_Left_Index_Middle_Pos_",this.leftIndexMiddlePosition),this._activeEffect.setVector3("_Right_Index_Middle_Pos_",this.rightIndexMiddlePosition),this._activeEffect.setTexture("_Decal_",new l.Texture("",this.getScene())),this._activeEffect.setVector2("_Decal_Scale_XY_",this.decalScaleXY),this._activeEffect.setFloat("_Decal_Front_Only_",this.decalFrontOnly?1:0),this._activeEffect.setFloat("_Rim_Intensity_",this.rimIntensity),this._activeEffect.setTexture("_Rim_Texture_",this._blueGradientTexture),this._activeEffect.setFloat("_Rim_Hue_Shift_",this.rimHueShift),this._activeEffect.setFloat("_Rim_Saturation_Shift_",this.rimSaturationShift),this._activeEffect.setFloat("_Rim_Value_Shift_",this.rimValueShift),this._activeEffect.setFloat("_Iridescence_Intensity_",this.iridescenceIntensity),this._activeEffect.setTexture("_Iridescence_Texture_",this._blueGradientTexture),this._activeEffect.setFloat("Use_Global_Left_Index",this.useGlobalLeftIndex),this._activeEffect.setFloat("Use_Global_Right_Index",this.useGlobalRightIndex),this._activeEffect.setVector4("Global_Left_Index_Tip_Position",this.globalLeftIndexTipPosition),this._activeEffect.setVector4("Global_Right_Index_Tip_Position",this.globaRightIndexTipPosition),this._activeEffect.setVector4("Global_Left_Thumb_Tip_Position",this.globalLeftThumbTipPosition),this._activeEffect.setVector4("Global_Right_Thumb_Tip_Position",this.globalRightThumbTipPosition),this._activeEffect.setVector4("Global_Left_Index_Middle_Position",this.globalLeftIndexMiddlePosition),this._activeEffect.setVector4("Global_Right_Index_Middle_Position",this.globalRightIndexMiddlePosition),this._activeEffect.setFloat("Global_Left_Index_Tip_Proximity",this.globalLeftIndexTipProximity),this._activeEffect.setFloat("Global_Right_Index_Tip_Proximity",this.globalRightIndexTipProximity),this._afterBind(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 l.SerializationHelper.Clone((function(){return new e(t,i.getScene())}),this)},e.prototype.serialize=function(){var t=l.SerializationHelper.Serialize(this);return t.customType="BABYLON.MRDLSliderThumbMaterial",t},e.prototype.getClassName=function(){return"MRDLSliderThumbMaterial"},e.Parse=function(t,i,n){return l.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,n)},e.BLUE_GRADIENT_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/MRDL/mrtk-mrdl-blue-gradient.png",r([Object(l.serialize)()],e.prototype,"radius",void 0),r([Object(l.serialize)()],e.prototype,"bevelFront",void 0),r([Object(l.serialize)()],e.prototype,"bevelFrontStretch",void 0),r([Object(l.serialize)()],e.prototype,"bevelBack",void 0),r([Object(l.serialize)()],e.prototype,"bevelBackStretch",void 0),r([Object(l.serialize)()],e.prototype,"radiusTopLeft",void 0),r([Object(l.serialize)()],e.prototype,"radiusTopRight",void 0),r([Object(l.serialize)()],e.prototype,"radiusBottomLeft",void 0),r([Object(l.serialize)()],e.prototype,"radiusBottomRight",void 0),r([Object(l.serialize)()],e.prototype,"bulgeEnabled",void 0),r([Object(l.serialize)()],e.prototype,"bulgeHeight",void 0),r([Object(l.serialize)()],e.prototype,"bulgeRadius",void 0),r([Object(l.serialize)()],e.prototype,"sunIntensity",void 0),r([Object(l.serialize)()],e.prototype,"sunTheta",void 0),r([Object(l.serialize)()],e.prototype,"sunPhi",void 0),r([Object(l.serialize)()],e.prototype,"indirectDiffuse",void 0),r([Object(l.serialize)()],e.prototype,"albedo",void 0),r([Object(l.serialize)()],e.prototype,"specular",void 0),r([Object(l.serialize)()],e.prototype,"shininess",void 0),r([Object(l.serialize)()],e.prototype,"sharpness",void 0),r([Object(l.serialize)()],e.prototype,"subsurface",void 0),r([Object(l.serialize)()],e.prototype,"leftGradientColor",void 0),r([Object(l.serialize)()],e.prototype,"rightGradientColor",void 0),r([Object(l.serialize)()],e.prototype,"reflection",void 0),r([Object(l.serialize)()],e.prototype,"frontReflect",void 0),r([Object(l.serialize)()],e.prototype,"edgeReflect",void 0),r([Object(l.serialize)()],e.prototype,"power",void 0),r([Object(l.serialize)()],e.prototype,"skyColor",void 0),r([Object(l.serialize)()],e.prototype,"horizonColor",void 0),r([Object(l.serialize)()],e.prototype,"groundColor",void 0),r([Object(l.serialize)()],e.prototype,"horizonPower",void 0),r([Object(l.serialize)()],e.prototype,"width",void 0),r([Object(l.serialize)()],e.prototype,"fuzz",void 0),r([Object(l.serialize)()],e.prototype,"minFuzz",void 0),r([Object(l.serialize)()],e.prototype,"clipFade",void 0),r([Object(l.serialize)()],e.prototype,"hueShift",void 0),r([Object(l.serialize)()],e.prototype,"saturationShift",void 0),r([Object(l.serialize)()],e.prototype,"valueShift",void 0),r([Object(l.serialize)()],e.prototype,"blobPosition",void 0),r([Object(l.serialize)()],e.prototype,"blobIntensity",void 0),r([Object(l.serialize)()],e.prototype,"blobNearSize",void 0),r([Object(l.serialize)()],e.prototype,"blobFarSize",void 0),r([Object(l.serialize)()],e.prototype,"blobNearDistance",void 0),r([Object(l.serialize)()],e.prototype,"blobFarDistance",void 0),r([Object(l.serialize)()],e.prototype,"blobFadeLength",void 0),r([Object(l.serialize)()],e.prototype,"blobPulse",void 0),r([Object(l.serialize)()],e.prototype,"blobFade",void 0),r([Object(l.serialize)()],e.prototype,"blobPosition2",void 0),r([Object(l.serialize)()],e.prototype,"blobNearSize2",void 0),r([Object(l.serialize)()],e.prototype,"blobPulse2",void 0),r([Object(l.serialize)()],e.prototype,"blobFade2",void 0),r([Object(l.serialize)()],e.prototype,"blobTexture",void 0),r([Object(l.serialize)()],e.prototype,"leftIndexPosition",void 0),r([Object(l.serialize)()],e.prototype,"rightIndexPosition",void 0),r([Object(l.serialize)()],e.prototype,"leftIndexMiddlePosition",void 0),r([Object(l.serialize)()],e.prototype,"rightIndexMiddlePosition",void 0),r([Object(l.serialize)()],e.prototype,"decalScaleXY",void 0),r([Object(l.serialize)()],e.prototype,"decalFrontOnly",void 0),r([Object(l.serialize)()],e.prototype,"rimIntensity",void 0),r([Object(l.serialize)()],e.prototype,"rimHueShift",void 0),r([Object(l.serialize)()],e.prototype,"rimSaturationShift",void 0),r([Object(l.serialize)()],e.prototype,"rimValueShift",void 0),r([Object(l.serialize)()],e.prototype,"iridescenceIntensity",void 0),e}(l.PushMaterial);Object(l.RegisterClass)("BABYLON.GUI.MRDLSliderThumbMaterial",Kt);var qt="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_;\n\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_;\n\nuniform float _Edge_Width_;\nuniform float _Edge_Power_;\nuniform float _Line_Gradient_Blend_;\nuniform float _Fade_Out_;\n\n\nvoid FastLinearTosRGB_B353(\nvec4 Linear,\nout vec4 sRGB)\n{\nsRGB.rgb=sqrt(clamp(Linear.rgb,0.0,1.0));\nsRGB.a=Linear.a;\n}\n\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);\n\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);\n\n\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\n\n\n}\n\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}\n\n\nvoid Scale_RGB_B346(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{\nResult=vec4(Scalar,Scalar,Scalar,1)*Color;\n}\n\n\nvoid Scale_RGB_B344(\nfloat Scalar,\nvec4 Color,\nout vec4 Result)\n{\nResult=vec4(Scalar,Scalar,Scalar,1)*Color;\n}\n\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}\n\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}\n\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}\n\nvoid main()\n{\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\n\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);\n\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);\n\nvec4 Sum_Q345=Result_Q346+Result_Q344;\n\nvec4 Color_At_T_Q347=mix(Line_Color_Q362,Result_Q346,_Line_Gradient_Blend_);\n\nvec4 Base_And_Iridescent_Q350;\nBase_And_Iridescent_Q350=_Base_Color_+vec4(Sum_Q345.rgb,0.0);\n\nvec4 Sum_Q349=Color_At_T_Q347+_Iridescence_Edge_Intensity_*Color_Q343;\n\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);\n\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}";l.ShaderStore.ShadersStore.mrdlBackplatePixelShader=qt;var Jt="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_;\n\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_;\n\nuniform float _Edge_Width_;\nuniform float _Edge_Power_;\nuniform float _Line_Gradient_Blend_;\nuniform float _Fade_Out_;\n\nvarying vec3 vPosition;\nvarying vec3 vNormal;\nvarying vec2 vUV;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec4 vExtra1;\nvarying vec4 vExtra2;\n\nvoid Object_To_World_Pos_B314(\nvec3 Pos_Object,\nout vec3 Pos_World)\n{\nPos_World=(world*vec4(Pos_Object,1.0)).xyz;\n}\n\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}\n\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}\n\n\nvoid PickDir_B334(\nfloat Degrees,\nvec3 DirX,\nvec3 DirY,\nout vec3 Dir)\n{\n\nfloat a=Degrees*3.14159/180.0;\nDir=cos(a)*DirX+sin(a)*DirY;\n}\n\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}\n\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}\n\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{\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) {\n\nGradient1=Position_Object.z>0.0 ? g : 1.0;\nGradient2=Position_Object.z>0.0 ? 1.0 : g;\n} else {\n\n\n\n\nGradient1=g+(1.0-g)*(Radial_Gradient);\nGradient2=1.0;\n}\n}\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}\n\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}\n\nvoid main()\n{\n\nvec3 Nrm_World_Q326;\nNrm_World_Q326=normalize((world*vec4(normal,0.0)).xyz);\n\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);\n\nfloat Anisotropy_Q331=Tangent_Length_Q329/Binormal_Length_Q330;\n\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);\n\nfloat X_Q359;\nfloat Y_Q359;\nX_Q359=Color_UV_Info_Q357.x;\nY_Q359=Color_UV_Info_Q357.y;\n\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}";l.ShaderStore.ShadersStore.mrdlBackplateVertexShader=Jt;var $t=function(t){function e(){var e=t.call(this)||this;return e.IRIDESCENCE_ENABLED=!0,e.SMOOTH_EDGES=!0,e._needNormals=!0,e.rebuild(),e}return o(e,t),e}(l.MaterialDefines),te=function(t){function e(i,n){var o=t.call(this,i,n)||this;return o.radius=.3,o.lineWidth=.003,o.absoluteSizes=!1,o._filterWidth=1,o.baseColor=new l.Color4(0,0,0,1),o.lineColor=new l.Color4(.2,.262745,.4,1),o.radiusTopLeft=1,o.radiusTopRight=1,o.radiusBottomLeft=1,o.radiusBottomRight=1,o._rate=0,o.highlightColor=new l.Color4(.239216,.435294,.827451,1),o.highlightWidth=0,o._highlightTransform=new l.Vector4(1,1,0,0),o._highlight=1,o.iridescenceIntensity=.45,o.iridescenceEdgeIntensity=1,o.iridescenceTint=new l.Color4(1,1,1,1),o._angle=-45,o.fadeOut=1,o._reflected=!0,o._frequency=1,o._verticalOffset=0,o.gradientColor=new l.Color4(.74902,.74902,.74902,1),o.topLeftGradientColor=new l.Color4(.00784314,.294118,.580392,1),o.topRightGradientColor=new l.Color4(.305882,0,1,1),o.bottomLeftGradientColor=new l.Color4(.133333,.258824,.992157,1),o.bottomRightGradientColor=new l.Color4(.176471,.176471,.619608,1),o.edgeWidth=.5,o.edgePower=1,o.edgeLineGradientBlend=.5,o.alphaMode=l.Constants.ALPHA_DISABLE,o.backFaceCulling=!1,o._iridescentMapTexture=new l.Texture(e.IRIDESCENT_MAP_TEXTURE_URL,n,!0,!1,l.Texture.NEAREST_SAMPLINGMODE),o}return o(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,i){if(this.isFrozen&&e.effect&&e.effect._wasPreviouslyReady)return!0;e.materialDefines||(e.materialDefines=new $t);var n=e.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(e))return!0;var r=o.getEngine();if(l.MaterialHelper.PrepareDefinesForAttributes(t,n,!1,!1),n.isDirty){n.markAsProcessed(),o.resetCachedMaterial();var a=new l.EffectFallbacks;n.FOG&&a.addFallback(1,"FOG"),l.MaterialHelper.HandleFallbacksForShadows(n,a),n.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;var s=[l.VertexBuffer.PositionKind];n.NORMAL&&s.push(l.VertexBuffer.NormalKind),n.UV1&&s.push(l.VertexBuffer.UVKind),n.UV2&&s.push(l.VertexBuffer.UV2Kind),n.VERTEXCOLOR&&s.push(l.VertexBuffer.ColorKind),n.TANGENT&&s.push(l.VertexBuffer.TangentKind),l.MaterialHelper.PrepareAttributesForInstances(s,n);var _=n.toString(),h=["world","viewProjection","cameraPosition","_Radius_","_Line_Width_","_Absolute_Sizes_","_Filter_Width_","_Base_Color_","_Line_Color_","_Radius_Top_Left_","_Radius_Top_Right_","_Radius_Bottom_Left_","_Radius_Bottom_Right_","_Rate_","_Highlight_Color_","_Highlight_Width_","_Highlight_Transform_","_Highlight_","_Iridescence_Intensity_","_Iridescence_Edge_Intensity_","_Iridescence_Tint_","_Iridescent_Map_","_Angle_","_Reflected_","_Frequency_","_Vertical_Offset_","_Gradient_Color_","_Top_Left_","_Top_Right_","_Bottom_Left_","_Bottom_Right_","_Edge_Width_","_Edge_Power_","_Line_Gradient_Blend_","_Fade_Out_"],c=[],u=new Array;l.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:h,uniformBuffersNames:u,samplers:c,defines:n,maxSimultaneousLights:4}),e.setEffect(o.getEngine().createEffect("mrdlBackplate",{attributes:s,uniformsNames:h,uniformBuffersNames:u,samplers:c,defines:_,fallbacks:a,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},r),n)}return!(!e.effect||!e.effect.isReady())&&(n._renderId=o.getRenderId(),e.effect._wasPreviouslyReady=!0,!0)},e.prototype.bindForSubMesh=function(t,e,i){if(i.materialDefines){var n=i.effect;n&&(this._activeEffect=n,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 l.SerializationHelper.Clone((function(){return new e(t,i.getScene())}),this)},e.prototype.serialize=function(){var t=l.SerializationHelper.Serialize(this);return t.customType="BABYLON.MRDLBackplateMaterial",t},e.prototype.getClassName=function(){return"MRDLBackplateMaterial"},e.Parse=function(t,i,n){return l.SerializationHelper.Parse((function(){return new e(t.name,i)}),t,i,n)},e.IRIDESCENT_MAP_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/MRDL/mrtk-mrdl-backplate-iridescence.png",r([Object(l.serialize)()],e.prototype,"radius",void 0),r([Object(l.serialize)()],e.prototype,"lineWidth",void 0),r([Object(l.serialize)()],e.prototype,"absoluteSizes",void 0),r([Object(l.serialize)()],e.prototype,"baseColor",void 0),r([Object(l.serialize)()],e.prototype,"lineColor",void 0),r([Object(l.serialize)()],e.prototype,"radiusTopLeft",void 0),r([Object(l.serialize)()],e.prototype,"radiusTopRight",void 0),r([Object(l.serialize)()],e.prototype,"radiusBottomLeft",void 0),r([Object(l.serialize)()],e.prototype,"radiusBottomRight",void 0),r([Object(l.serialize)()],e.prototype,"highlightColor",void 0),r([Object(l.serialize)()],e.prototype,"highlightWidth",void 0),r([Object(l.serialize)()],e.prototype,"iridescenceIntensity",void 0),r([Object(l.serialize)()],e.prototype,"iridescenceEdgeIntensity",void 0),r([Object(l.serialize)()],e.prototype,"iridescenceTint",void 0),r([Object(l.serialize)()],e.prototype,"fadeOut",void 0),r([Object(l.serialize)()],e.prototype,"gradientColor",void 0),r([Object(l.serialize)()],e.prototype,"topLeftGradientColor",void 0),r([Object(l.serialize)()],e.prototype,"topRightGradientColor",void 0),r([Object(l.serialize)()],e.prototype,"bottomLeftGradientColor",void 0),r([Object(l.serialize)()],e.prototype,"bottomRightGradientColor",void 0),r([Object(l.serialize)()],e.prototype,"edgeWidth",void 0),r([Object(l.serialize)()],e.prototype,"edgePower",void 0),r([Object(l.serialize)()],e.prototype,"edgeLineGradientBlend",void 0),e}(l.PushMaterial);Object(l.RegisterClass)("BABYLON.GUI.MRDLBackplateMaterial",te);var ee=function(t){function e(e,i){var n=t.call(this,e)||this;return n.onValueChangedObservable=new l.Observable,n._sliderBackplateVisible=i||!1,n._minimum=0,n._maximum=100,n._step=0,n._value=50,n}return o(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.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}),e.prototype._createNode=function(t){var i=this,n=Object(l.CreateBox)(this.name+"_sliderbackplate",{width:1,height:1,depth:1},t);return n.isPickable=!1,n.visibility=0,n.scaling=new l.Vector3(1,.5,.8),l.SceneLoader.ImportMeshAsync(void 0,e.MODEL_BASE_URL,e.MODEL_FILENAME,t).then((function(t){var e=t.meshes[1],o=t.meshes[1].clone(i.name+"_sliderbar",n),r=t.meshes[1].clone(i.name+"_sliderthumb",n);e.visibility=0,i._sliderBackplateVisible&&(e.visibility=1,e.name=i.name+"_sliderbackplate",e.isPickable=!1,e.scaling.x=1,e.scaling.z=.2,e.parent=n,i._sliderBackplateMaterial&&(e.material=i._sliderBackplateMaterial),i._sliderBackplate=e),o&&(o.parent=n,o.position.z=-.1,o.scaling=new l.Vector3(.8,.04,.3),o.isPickable=!1,i._sliderBarMaterial&&(o.material=i._sliderBarMaterial),i._sliderBar=o),r&&(r.parent=n,r.isPickable=!0,r.position.z=-.115,r.scaling=new l.Vector3(.025,.3,.6),r.position.x=i._convertToPosition(i.value),r.addBehavior(i._createBehavior()),i._sliderThumbMaterial&&(r.material=i._sliderThumbMaterial),i._sliderThumb=r)})),this._affectMaterial(n),n},e.prototype._affectMaterial=function(t){var e,i,n;this._sliderBackplateMaterial=null!==(e=this._sliderBackplateMaterial)&&void 0!==e?e:new te(this.name+"_sliderbackplate_material",t.getScene()),this._sliderBarMaterial=null!==(i=this._sliderBarMaterial)&&void 0!==i?i:new Ut(this.name+"_sliderbar_material",t.getScene()),this._sliderThumbMaterial=null!==(n=this._sliderThumbMaterial)&&void 0!==n?n:new Kt(this.name+"_sliderthumb_material",t.getScene())},e.prototype._createBehavior=function(){var t=this,e=new l.PointerDragBehavior({dragAxis:l.Vector3.Right()});return e.moveAttached=!1,e.onDragObservable.add((function(e){var i=t._sliderThumb.position.x+e.dragDistance/t.scaling.x;t._sliderThumb.position.x=Math.max(Math.min(i,t.end),t.start),t.value=t._convertToValue(t._sliderThumb.position.x)})),e.onDragEndObservable.add((function(e){t._sliderThumb.position.x=t._convertToPosition(t.value)})),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,n,o,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===(n=this._sliderBarMaterial)||void 0===n||n.dispose(),null===(o=this._sliderThumbMaterial)||void 0===o||o.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}(rt),ie=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._radius=5,e}return o(e,t),Object.defineProperty(e.prototype,"radius",{get:function(){return this._radius},set:function(t){var e=this;this._radius!==t&&(this._radius=t,l.Tools.SetImmediate((function(){e._arrangeChildren()})))},enumerable:!1,configurable:!0}),e.prototype._mapGridNode=function(t,e){var i=t.mesh;if(i){var n=this._sphericalMapping(e);switch(t.position=n,this.orientation){case _t.FACEORIGIN_ORIENTATION:i.lookAt(new l.Vector3(2*n.x,2*n.y,2*n.z));break;case _t.FACEORIGINREVERSED_ORIENTATION:i.lookAt(new l.Vector3(-n.x,-n.y,-n.z));break;case _t.FACEFORWARD_ORIENTATION:break;case _t.FACEFORWARDREVERSED_ORIENTATION:i.rotate(l.Axis.Y,Math.PI,l.Space.LOCAL)}}},e.prototype._sphericalMapping=function(t){var e=new l.Vector3(0,0,this._radius),i=t.y/this._radius,n=-t.x/this._radius;return l.Matrix.RotationYawPitchRollToRef(n,i,0,l.TmpVectors.Matrix[0]),l.Vector3.TransformNormal(e,l.TmpVectors.Matrix[0])},e}(ht),ne=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 o(e,t),Object.defineProperty(e.prototype,"isVertical",{get:function(){return this._isVertical},set:function(t){var e=this;this._isVertical!==t&&(this._isVertical=t,l.Tools.SetImmediate((function(){e._arrangeChildren()})))},enumerable:!1,configurable:!0}),e.prototype._arrangeChildren=function(){for(var t,e=0,i=0,n=0,o=[],r=l.Matrix.Invert(this.node.computeWorldMatrix(!0)),a=0,s=this._children;a<s.length;a++){if((f=s[a]).mesh){n++,f.mesh.computeWorldMatrix(!0),f.mesh.getWorldMatrix().multiplyToRef(r,l.TmpVectors.Matrix[0]);var _=f.mesh.getBoundingInfo().boundingBox,h=l.Vector3.TransformNormal(_.extendSize,l.TmpVectors.Matrix[0]);o.push(h),this._isVertical?i+=h.y:e+=h.x}}this._isVertical?i+=(n-1)*this.margin/2:e+=(n-1)*this.margin/2,t=this._isVertical?-i:-e;for(var c=0,u=0,d=this._children;u<d.length;u++){var f;if((f=d[u]).mesh){n--;h=o[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+=n>0?this.margin:0}}},e}(_t),oe=function(t){function e(e,i){var n=t.call(this,i,e)||this;return n._currentMesh=e,n.pointerEnterAnimation=function(){n.mesh&&n.mesh.scaling.scaleInPlace(1.1)},n.pointerOutAnimation=function(){n.mesh&&n.mesh.scaling.scaleInPlace(1/1.1)},n.pointerDownAnimation=function(){n.mesh&&n.mesh.scaling.scaleInPlace(.95)},n.pointerUpAnimation=function(){n.mesh&&n.mesh.scaling.scaleInPlace(1/.95)},n}return o(e,t),e.prototype._getTypeName=function(){return"TouchMeshButton3D"},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}(xt),re=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n._isPressed=!1,n.onToggleOnObservable=new l.Observable,n.onToggleOffObservable=new l.Observable,n.onPointerUpObservable.add((function(t){n._onToggle(t)})),n}return o(e,t),e.prototype._onToggle=function(t){this._isPressed=!this._isPressed,this._isPressed?this.onToggleOnObservable.notifyObservers(t):this.onToggleOffObservable.notifyObservers(t)},e.prototype._getTypeName=function(){return"TouchToggleButton3D"},e.prototype._createNode=function(e){return t.prototype._createNode.call(this,e)},e.prototype._affectMaterial=function(e){t.prototype._affectMaterial.call(this,e)},e.prototype.dispose=function(){this.onToggleOnObservable.clear(),this.onToggleOffObservable.clear(),t.prototype.dispose.call(this)},e}(xt),ae=function(t){function e(e,i){void 0===i&&(i=!0);var n=t.call(this,e)||this;return n._shareMaterials=i,n}return o(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,n=this,o=Object(l.CreateBox)((null!==(i=this.name)&&void 0!==i?i:"HolographicBackplate")+"_CollisionMesh",{width:1,height:1,depth:1},t);return o.isPickable=!0,o.visibility=0,l.SceneLoader.ImportMeshAsync(void 0,e.MODEL_BASE_URL,e.MODEL_FILENAME,t).then((function(t){var e=t.meshes[1];e.name=n.name+"_frontPlate",e.isPickable=!1,e.parent=o,n._material&&(e.material=n._material),n._model=e})),o},e.prototype._createMaterial=function(t){this._material=new Ft(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}(rt),se=function(){function t(t){var e=this;this._lastControlOver={},this._lastControlDown={},this.onPickedPointChangedObservable=new l.Observable,this.onPickingObservable=new l.Observable,this._sharedMaterials={},this._touchSharedMaterials={},this._scene=t||l.EngineStore.LastCreatedScene,this._sceneDisposeObserver=this._scene.onDisposeObservable.add((function(){e._sceneDisposeObserver=null,e._utilityLayer=null,e.dispose()})),this._utilityLayer=l.UtilityLayerRenderer._CreateDefaultUtilityLayerFromScene(this._scene),this._utilityLayer.onlyCheckPointerDownEvents=!1,this._utilityLayer.pickUtilitySceneFirst=!1,this._utilityLayer.mainSceneTrackerPredicate=function(t){var e,i,n;return t&&(null===(n=null===(i=null===(e=t.reservedDataStore)||void 0===e?void 0:e.GUI3D)||void 0===i?void 0:i.control)||void 0===n?void 0:n._node)},this._rootContainer=new _t("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,i){e._doPicking(t)})),this._utilityLayer.utilityLayerScene.autoClear=!1,this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil=!1,new l.HemisphericLight("hemi",l.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}),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,n;if(!this._utilityLayer||!this._utilityLayer.shouldRender||!this._utilityLayer.utilityLayerScene.activeCamera)return!1;var o=t.event,r=o.pointerId||0,a=o.button,s=t.pickInfo;if(s&&this.onPickingObservable.notifyObservers(s.pickedMesh),!s||!s.hit)return this._handlePointerOut(r,t.type===l.PointerEventTypes.POINTERUP),!1;s.pickedPoint&&this.onPickedPointChangedObservable.notifyObservers(s.pickedPoint);var _=null===(i=null===(e=s.pickedMesh.reservedDataStore)||void 0===e?void 0:e.GUI3D)||void 0===i?void 0:i.control;return _&&!_._processObservables(t.type,s.pickedPoint,(null===(n=s.originMesh)||void 0===n?void 0:n.position)||null,r,a)&&t.type===l.PointerEventTypes.POINTERMOVE&&(this._lastControlOver[r]&&this._lastControlOver[r]._onPointerOut(this._lastControlOver[r]),delete this._lastControlOver[r]),t.type===l.PointerEventTypes.POINTERUP&&(this._lastControlDown[o.pointerId]&&(this._lastControlDown[o.pointerId].forcePointerUp(),delete this._lastControlDown[o.pointerId]),"touch"===o.pointerType&&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),this},t.prototype.removeControl=function(t){return this._rootContainer.removeControl(t),this},t.prototype.dispose=function(){for(var t in this._rootContainer.dispose(),this._sharedMaterials)this._sharedMaterials.hasOwnProperty(t)&&this._sharedMaterials[t].dispose();for(var t in this._sharedMaterials={},this._touchSharedMaterials)this._touchSharedMaterials.hasOwnProperty(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}()},function(t,e,i){"use strict";i.r(e),function(t){var n=i(1);i.d(e,"Button",(function(){return n.Button})),i.d(e,"Checkbox",(function(){return n.Checkbox})),i.d(e,"ColorPicker",(function(){return n.ColorPicker})),i.d(e,"Container",(function(){return n.Container})),i.d(e,"Control",(function(){return n.Control})),i.d(e,"Ellipse",(function(){return n.Ellipse})),i.d(e,"FocusableButton",(function(){return n.FocusableButton})),i.d(e,"Grid",(function(){return n.Grid})),i.d(e,"Image",(function(){return n.Image})),i.d(e,"InputText",(function(){return n.InputText})),i.d(e,"InputPassword",(function(){return n.InputPassword})),i.d(e,"Line",(function(){return n.Line})),i.d(e,"MultiLine",(function(){return n.MultiLine})),i.d(e,"RadioButton",(function(){return n.RadioButton})),i.d(e,"StackPanel",(function(){return n.StackPanel})),i.d(e,"SelectorGroup",(function(){return n.SelectorGroup})),i.d(e,"CheckboxGroup",(function(){return n.CheckboxGroup})),i.d(e,"RadioGroup",(function(){return n.RadioGroup})),i.d(e,"SliderGroup",(function(){return n.SliderGroup})),i.d(e,"SelectionPanel",(function(){return n.SelectionPanel})),i.d(e,"ScrollViewer",(function(){return n.ScrollViewer})),i.d(e,"TextWrapping",(function(){return n.TextWrapping})),i.d(e,"TextBlock",(function(){return n.TextBlock})),i.d(e,"TextWrapper",(function(){return n.TextWrapper})),i.d(e,"ToggleButton",(function(){return n.ToggleButton})),i.d(e,"KeyPropertySet",(function(){return n.KeyPropertySet})),i.d(e,"VirtualKeyboard",(function(){return n.VirtualKeyboard})),i.d(e,"Rectangle",(function(){return n.Rectangle})),i.d(e,"DisplayGrid",(function(){return n.DisplayGrid})),i.d(e,"BaseSlider",(function(){return n.BaseSlider})),i.d(e,"Slider",(function(){return n.Slider})),i.d(e,"ImageBasedSlider",(function(){return n.ImageBasedSlider})),i.d(e,"ScrollBar",(function(){return n.ScrollBar})),i.d(e,"ImageScrollBar",(function(){return n.ImageScrollBar})),i.d(e,"name",(function(){return n.name})),i.d(e,"AdvancedDynamicTexture",(function(){return n.AdvancedDynamicTexture})),i.d(e,"AdvancedDynamicTextureInstrumentation",(function(){return n.AdvancedDynamicTextureInstrumentation})),i.d(e,"Vector2WithInfo",(function(){return n.Vector2WithInfo})),i.d(e,"Matrix2D",(function(){return n.Matrix2D})),i.d(e,"Measure",(function(){return n.Measure})),i.d(e,"MultiLinePoint",(function(){return n.MultiLinePoint})),i.d(e,"Style",(function(){return n.Style})),i.d(e,"ValueAndUnit",(function(){return n.ValueAndUnit})),i.d(e,"XmlLoader",(function(){return n.XmlLoader})),i.d(e,"AbstractButton3D",(function(){return n.AbstractButton3D})),i.d(e,"Button3D",(function(){return n.Button3D})),i.d(e,"Container3D",(function(){return n.Container3D})),i.d(e,"Control3D",(function(){return n.Control3D})),i.d(e,"CylinderPanel",(function(){return n.CylinderPanel})),i.d(e,"HolographicButton",(function(){return n.HolographicButton})),i.d(e,"HolographicSlate",(function(){return n.HolographicSlate})),i.d(e,"HandMenu",(function(){return n.HandMenu})),i.d(e,"MeshButton3D",(function(){return n.MeshButton3D})),i.d(e,"NearMenu",(function(){return n.NearMenu})),i.d(e,"PlanePanel",(function(){return n.PlanePanel})),i.d(e,"ScatterPanel",(function(){return n.ScatterPanel})),i.d(e,"Slider3D",(function(){return n.Slider3D})),i.d(e,"SpherePanel",(function(){return n.SpherePanel})),i.d(e,"StackPanel3D",(function(){return n.StackPanel3D})),i.d(e,"TouchButton3D",(function(){return n.TouchButton3D})),i.d(e,"TouchMeshButton3D",(function(){return n.TouchMeshButton3D})),i.d(e,"TouchHolographicButton",(function(){return n.TouchHolographicButton})),i.d(e,"TouchHolographicMenu",(function(){return n.TouchHolographicMenu})),i.d(e,"TouchToggleButton3D",(function(){return n.TouchToggleButton3D})),i.d(e,"VolumeBasedPanel",(function(){return n.VolumeBasedPanel})),i.d(e,"HolographicBackplate",(function(){return n.HolographicBackplate})),i.d(e,"FluentMaterialDefines",(function(){return n.FluentMaterialDefines})),i.d(e,"FluentMaterial",(function(){return n.FluentMaterial})),i.d(e,"FluentButtonMaterial",(function(){return n.FluentButtonMaterial})),i.d(e,"FluentBackplateMaterial",(function(){return n.FluentBackplateMaterial})),i.d(e,"HandleMaterial",(function(){return n.HandleMaterial})),i.d(e,"MRDLSliderBarMaterial",(function(){return n.MRDLSliderBarMaterial})),i.d(e,"MRDLSliderThumbMaterial",(function(){return n.MRDLSliderThumbMaterial})),i.d(e,"MRDLBackplateMaterial",(function(){return n.MRDLBackplateMaterial})),i.d(e,"SlateGizmo",(function(){return n.SlateGizmo})),i.d(e,"HandleState",(function(){return n.HandleState})),i.d(e,"GizmoHandle",(function(){return n.GizmoHandle})),i.d(e,"SideHandle",(function(){return n.SideHandle})),i.d(e,"CornerHandle",(function(){return n.CornerHandle})),i.d(e,"GUI3DManager",(function(){return n.GUI3DManager})),i.d(e,"Vector3WithInfo",(function(){return n.Vector3WithInfo}));var o=void 0!==t?t:"undefined"!=typeof window?window:void 0;void 0!==o&&(o.BABYLON=o.BABYLON||{},o.BABYLON.GUI=n)}.call(this,i(3))},function(t,e){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(t){"object"==typeof window&&(i=window)}t.exports=i}])}));