Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

troika-3d-ui

Package Overview
Dependencies
Maintainers
1
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

troika-3d-ui - npm Package Compare versions

Comparing version 0.42.0 to 0.43.0

9

CHANGELOG.md

@@ -6,2 +6,11 @@ # Change Log

# [0.43.0](https://github.com/protectwise/troika/compare/v0.42.0...v0.43.0) (2021-09-20)
**Note:** Version bump only for package troika-3d-ui
# [0.42.0](https://github.com/protectwise/troika/compare/v0.41.2...v0.42.0) (2021-05-17)

@@ -8,0 +17,0 @@

117

dist/troika-3d-ui.umd.min.js
'use strict';(function(n,z){"object"===typeof exports&&"undefined"!==typeof module?z(exports,require("troika-flex-layout"),require("troika-core"),require("three"),require("troika-3d"),require("troika-3d-text"),require("troika-three-utils"),require("object-path")):"function"===typeof define&&define.amd?define("exports troika-flex-layout troika-core three troika-3d troika-3d-text troika-three-utils object-path".split(" "),z):(n="undefined"!==typeof globalThis?globalThis:n||self,z(n.troika_3d_ui={},
n.troika_flex_layout,n.troika_core,n.THREE,n.troika_3d,n.troika_3d_text,n.troika_three_utils,n.objectPath))})(this,function(n,z,D,e,r,E,L,w){function A(b,a,d){for(var c;b&&"inherit"===(c=b[a]);)b=b.parentFlexNode,c=void 0;void 0===c&&(c=d);return c}function G(b,a){for(var d;b&&"string"===typeof(d=b.fontSize);)if("inherit"===d)b=b.parentFlexNode,d=void 0;else{if(/%$/.test(d)){var c=parseFloat(d)/100;d=G(b.parentFlexNode,a);void 0!==d&&(d*=c)}else console.warn("Unknown fontSize: "+d),d=void 0;break}void 0===
d&&(d=a);return d}function da(b){b=r.createDerivedMaterial(b,{defines:{TROIKA_UI_BLOCK:""},extensions:{derivatives:!0},uniforms:{uTroikaBlockSize:{value:new e.Vector2},uTroikaClipRect:{value:new e.Vector4(0,0,0,0)},uTroikaCornerRadii:{value:new e.Vector4(0,0,0,0)},uTroikaBorderWidth:{value:new e.Vector4(0,0,0,0)}},vertexDefs:"\nuniform vec2 uTroikaBlockSize;\nuniform vec4 uTroikaClipRect;\nvarying vec2 vTroikaPosInBlock;\n",vertexTransform:"\nvec2 xy = position.xy * uTroikaBlockSize;\nxy.y *= -1.0;\nxy = clamp(xy, uTroikaClipRect.xy, uTroikaClipRect.zw);\nvTroikaPosInBlock = xy;\nxy.y *= -1.0;\nposition.xy = xy;\n",
n.troika_flex_layout,n.troika_core,n.THREE,n.troika_3d,n.troika_3d_text,n.troika_three_utils,n.objectPath))})(this,function(n,z,E,e,t,J,K,v){function w(a,b,c){let d;for(;a&&"inherit"===(d=a[b]);)a=a.parentFlexNode,d=void 0;void 0===d&&(d=c);return d}function F(a,b){let c;for(;a&&"string"===typeof(c=a.fontSize);)if("inherit"===c)a=a.parentFlexNode,c=void 0;else{if(/%$/.test(c)){let d=parseFloat(c)/100;c=F(a.parentFlexNode,b);void 0!==c&&(c*=d)}else console.warn(`Unknown fontSize: ${c}`),c=void 0;break}void 0===
c&&(c=b);return c}function ea(a){a=t.createDerivedMaterial(a,{defines:{TROIKA_UI_BLOCK:""},extensions:{derivatives:!0},uniforms:{uTroikaBlockSize:{value:new e.Vector2},uTroikaClipRect:{value:new e.Vector4(0,0,0,0)},uTroikaCornerRadii:{value:new e.Vector4(0,0,0,0)},uTroikaBorderWidth:{value:new e.Vector4(0,0,0,0)}},vertexDefs:"\nuniform vec2 uTroikaBlockSize;\nuniform vec4 uTroikaClipRect;\nvarying vec2 vTroikaPosInBlock;\n",vertexTransform:"\nvec2 xy = position.xy * uTroikaBlockSize;\nxy.y *= -1.0;\nxy = clamp(xy, uTroikaClipRect.xy, uTroikaClipRect.zw);\nvTroikaPosInBlock = xy;\nxy.y *= -1.0;\nposition.xy = xy;\n",
fragmentDefs:"\nuniform vec2 uTroikaBlockSize;\nuniform vec4 uTroikaCornerRadii;\nuniform vec4 uTroikaBorderWidth;\nvarying vec2 vTroikaPosInBlock;\nconst vec4 NO_BORDER = vec4(0.,0.,0.,0.);\n\nfloat troikaEllipseRadiusAtAngle(in float angle, in float rx, in float ry) {\n if (rx == ry) {return rx;}\n float _cos = cos(angle);\n float _sin = sin(angle);\n return 1.0 / sqrt((_cos*_cos)/(rx*rx) + (_sin*_sin)/(ry*ry));\n}\n\nvoid troikaGetCurveDists(\n in vec2 pos, in vec2 radCenter, in float outerR, in float xBorder, in float yBorder, \n out float dOuter, out float dInner\n) {\n vec2 adjPos = pos - radCenter;\n float angle = atan(adjPos.y, adjPos.x);\n dOuter = troikaEllipseRadiusAtAngle(angle, outerR, outerR) - length(adjPos);\n dInner = uTroikaBorderWidth == NO_BORDER ? dInner : \n troikaEllipseRadiusAtAngle(angle, max(0.0, outerR - xBorder), max(0.0, outerR - yBorder)) - length(adjPos);\n}\n\nfloat troikaGetAlphaMultiplier() {\n // Short aliases\n vec2 dim = uTroikaBlockSize;\n vec4 rad = uTroikaCornerRadii;\n vec4 bdr = uTroikaBorderWidth;\n vec2 pos = vTroikaPosInBlock;\n\n float dOuter;\n float dInner;\n bool isOnCurve = true;\n bool isBorder = uTroikaBorderWidth != NO_BORDER;\n\n // Top left\n if (pos.x < rad[0] && pos.y < rad[0]) {\n troikaGetCurveDists(pos, vec2(rad[0], rad[0]), rad[0], bdr[3], bdr[0], dOuter, dInner);\n }\n // Top Right\n else if (pos.x > dim.x - rad[1] && pos.y < rad[1]) {\n troikaGetCurveDists(pos, vec2(dim.x - rad[1], rad[1]), rad[1], bdr[1], bdr[0], dOuter, dInner);\n }\n // Bottom Right\n else if (pos.x > dim.x - rad[2] && pos.y > dim.y - rad[2]) {\n troikaGetCurveDists(pos, vec2(dim.x - rad[2], dim.y - rad[2]), rad[2], bdr[1], bdr[2], dOuter, dInner);\n }\n // Bottom Left\n else if (pos.x < rad[3] && pos.y > dim.y - rad[3]) {\n troikaGetCurveDists(pos, vec2(rad[3], dim.y - rad[3]), rad[3], bdr[3], bdr[2], dOuter, dInner);\n }\n // Not on a curve, use closest side\n else {\n isOnCurve = false;\n dOuter = min(min(pos.x, pos.y), min(dim.x - pos.x, dim.y - pos.y));\n dInner = isBorder ? min(min(pos.x - bdr[3], pos.y - bdr[0]), min(dim.x - pos.x - bdr[1], dim.y - pos.y - bdr[2])) : dInner;\n }\n\n float alpha;\n #if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300\n float aa = length(fwidth(pos)) * 0.5;\n alpha = isOnCurve ? smoothstep(-aa, aa, dOuter) : 1.0;\n alpha = isBorder ? min(alpha, (dOuter == dInner) ? 0.0 : smoothstep(aa, -aa, dInner)) : alpha;\n return alpha;\n #else\n alpha = step(0.0, dOuter);\n alpha = isBorder ? min(alpha, step(0.0, -dInner)) : alpha;\n #endif\n return alpha;\n}\n",
fragmentColorTransform:"\nfloat troikaAlphaMult = troikaGetAlphaMultiplier();\nif (troikaAlphaMult == 0.0) {\n discard;\n} else {\n gl_FragColor.a *= troikaAlphaMult;\n}\n"});Object.defineProperty(b,"shadowSide",{get:function(){return this.side},set:function(){}});b.transparent=!0;return b}function ea(b){if(!b._didScroll){var a=b.currentTarget,d=b.nativeEvent,c=d.deltaX,g=d.deltaY;d=1===d.deltaMode?G(a,16)*A(a,"lineHeight",1.2):G(a,16)/12;c*=d;g*=d;d=Math.max(0,Math.min(a.scrollWidth-a.clientWidth,
a.scrollLeft+c));var h=Math.max(0,Math.min(a.scrollHeight-a.clientHeight,a.scrollTop+g)),f=Math.abs;if(d!==a.scrollLeft&&f(c)>f(g)||h!==a.scrollTop&&f(g)>f(c))a.scrollLeft=d,a.scrollTop=h,a.afterUpdate(),a.requestRender(),b._didScroll=!0;b.preventDefault()}}function O(b){if(!b._didScroll&&!b.defaultPrevented){var a=b.currentTarget,d=b.ray.clone().applyMatrix4(L.invertMatrix4(a.threeObject.matrixWorld,P)).intersectPlane(fa.setComponents(0,0,1,0),new e.Vector3),c=a._prevDragPos;if(d&&c&&"drag"===b.type){var g=
d.x-c.x;c=d.y-c.y;if(g||c)if(g=Math.max(0,Math.min(a.scrollWidth-a.clientWidth,a.scrollLeft+g)),c=Math.max(0,Math.min(a.scrollHeight-a.clientHeight,a.scrollTop+c)),g!==a.scrollLeft||c!==a.scrollTop)a.scrollLeft=g,a.scrollTop=c,a.afterUpdate(),a.requestRender(),b._didScroll=!0}a._prevDragPos=d}}function M(b){return"string"===typeof b||"number"===typeof b}function ha(b){b.updateMatrices&&b.updateMatrices()}function ia(b,a,d,c,g,h){c=6*b%1;h=[d,-d*c*a+d,g=-d*a+d,g,d*c*a+g,d];return[h[c=6*b|0],h[(4+c)%
6],h[(2+c)%6]]}var Q=w&&"object"===typeof w&&"default"in w?w:{"default":w},ja=D.utils.assign;w=D.utils.createClassExtender;w=w("flexNode",function(b){var a=function(d){function c(c){d.call(this,c);this.needsFlexLayout=this.isFlexNode=!0;for(this._flexStyles={id:this.$facadeId};c&&!c.isFlexNode;)c=c.parent;c?(this.parentFlexNode=c,this.flexNodeDepth=c.flexNodeDepth+1):this.flexNodeDepth=0}d&&(c.__proto__=d);c.prototype=Object.create(d&&d.prototype);c.prototype.constructor=c;c.prototype.afterUpdate=
function(){null!=this.offsetWidth&&(this._checkOverscroll(),this._updateClipRect());d.prototype.afterUpdate.call(this);this.needsFlexLayout&&(this.parentFlexNode?(this.notifyWorld("needsFlexLayout"),this.needsFlexLayout=!1):this._performRootLayout())};c.prototype.destructor=function(){this.parentFlexNode&&this.notifyWorld("needsFlexLayout");d.prototype.destructor.call(this)};c.prototype.onNotifyWorld=function(c,a,b){"needsFlexLayout"!==a||this.parentFlexNode?d.prototype.onNotifyWorld.call(this,c,
a,b):(this.needsFlexLayout=!0,this._rootLayoutReq||(this._rootLayoutReq=setTimeout(this._performRootLayout.bind(this),0)))};c.prototype._performRootLayout=function(){var c=this;this._hasActiveFlexRequest||(this._hasActiveFlexRequest=!0,this.needsFlexLayout=!1,clearTimeout(this._rootLayoutReq),delete this._rootLayoutReq,this.traverse(function(c){if(c.isFlexNode){var d=c.parentFlexNode;d&&(d._flexStyles.children||(d._flexStyles.children=[])).push(c._flexStyles);c._flexStyles.children=null}}),z.requestFlexLayout(this._flexStyles,
function(d){c.isDestroying||(c._applyRootLayoutResults(d),c._hasActiveFlexRequest=!1,c.afterUpdate(),c.requestRender())}))};c.prototype._applyRootLayoutResults=function(c){this.traverse(function(d){if(d.isFlexNode){var a=c[d.$facadeId];if(a){var b=a.left,g=a.top,h=a.width;a=a.height;var m=d.borderWidth,e=d.padding;d.offsetLeft=b;d.offsetTop=g;d.offsetWidth=h;d.offsetHeight=a;d.clientLeft=m[3]+e[3];d.clientTop=m[0]+e[0];d.clientWidth=h-m[1]-m[3]-e[1]-e[3];d.clientHeight=a-m[0]-m[2]-e[0]-e[2];d.scrollHeight=
d.scrollWidth=0;if(m=d.parentFlexNode)b=b+h-m.clientLeft,g=g+a-m.clientTop,b>m.scrollWidth&&(Math.abs(b-m.clientWidth)<b/1E4&&(b=m.clientWidth),m.scrollWidth=b),g>m.scrollHeight&&(Math.abs(g-m.clientHeight)<g/1E4&&(g=m.clientHeight),m.scrollHeight=g);if(d.onAfterFlexLayoutApplied)d.onAfterFlexLayoutApplied()}}})};c.prototype._checkOverscroll=function(){var c=this.scrollLeft,d=this.scrollTop;if(c||d){var a=Math.max(0,this.scrollWidth-this.clientWidth),b=Math.max(0,this.scrollHeight-this.clientHeight);
a<c&&(this.scrollLeft=a);b<d&&(this.scrollTop=b)}};c.prototype._updateClipRect=function(){var c=this.offsetWidth,d=this.offsetHeight,a=this.parentFlexNode;if(a&&"absolute"!==this.position){var b=this.offsetLeft-a.scrollLeft;var k=this.offsetTop-a.scrollTop,l="visible"!==a.overflow;var m=Math.max(l?a.clientLeft:-Infinity,a.clipLeft)-b;var e=Math.max(l?a.clientTop:-Infinity,a.clipTop)-k;b=Math.min(l?a.clientLeft+a.clientWidth:Infinity,a.clipRight)-b;a=Math.min(l?a.clientTop+a.clientHeight:Infinity,
a.clipBottom)-k}else m=e=-Infinity,b=a=Infinity;this.clipLeft=m;this.clipTop=e;this.clipRight=b;this.clipBottom=a;this.isFullyClipped=m>=c||e>=d||0>=b||0>=a||m===b||e===a};return c}(b);ja(a.prototype,{offsetLeft:null,offsetTop:null,offsetWidth:null,offsetHeight:null,clientLeft:null,clientTop:null,clientWidth:null,clientHeight:null,scrollLeft:0,scrollTop:0,scrollWidth:null,scrollHeight:null,clipLeft:null,clipTop:null,clipRight:null,clipBottom:null,isFullyClipped:!1,overflow:"visible"});"width height minWidth minHeight maxWidth maxHeight aspectRatio flexDirection flex flexWrap flexBasis flexGrow flexShrink alignContent alignItems alignSelf justifyContent position left right top bottom".split(" ").forEach(function(d){Object.defineProperty(a.prototype,
d,{get:function(){return this._flexStyles[d]},set:function(c){c!==this._flexStyles[d]&&(this._flexStyles[d]=c,this.needsFlexLayout=!0)},configurable:!0})});["margin","padding","borderWidth"].forEach(function(d){var c="_priv_"+d,b="borderWidth"===d?"border":d,h=b+"Top",f=b+"Right",p=b+"Bottom",k=b+"Left";Object.defineProperty(a.prototype,d,{get:function(){return this[c]||(this[c]=Object.freeze([0,0,0,0]))},set:function(a){if(Array.isArray(a)){var b=a.length;var g=a[0]||0;var e=(1<b?a[1]:a[0])||0;var l=
(2<b?a[2]:a[0])||0;a=(3<b?a[3]:1<b?a[1]:a[0])||0}else g=e=l=a;b=this[d];if(g!==b[0]||e!==b[1]||l!==b[2]||a!==b[3])this[c]=Object.freeze([g,e,l,a]),b=this._flexStyles,b[h]=g,b[f]=e,b[p]=l,b[k]=a,this.needsFlexLayout=!0}})});return a});var y="font fontSize textAlign textIndent lineHeight letterSpacing whiteSpace overflowWrap color".split(" "),R="text textIndent font fontSize lineHeight letterSpacing whiteSpace overflowWrap".split(" "),ka=function(){},F=function(b){function a(a){b.call(this,a);a=this.threeObject;
a._actuallySync=a.sync;a.sync=ka}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;a.prototype.afterUpdate=function(){var a=this.offsetLeft,c=this.offsetTop;if(null!==this.offsetWidth){var g=this.parentFlexNode;this.x=a-g.scrollLeft;this.y=-(c-g.scrollTop);a=this.clipRect||(this.clipRect=[0,0,0,0]);a[0]=this.clipLeft;a[1]=-this.clipBottom;a[2]=this.clipRight;a[3]=-this.clipTop;this.threeObject.visible=!this.isFullyClipped}a=this._flexStyles;c=0;for(g=R.length;c<
g;c++){var h=R[c];("text"===h?this.text:A(this,h))!==a[h]&&(a[h]=this[h],this.needsFlexLayout=!0)}b.prototype.afterUpdate.call(this)};a.prototype.onAfterFlexLayoutApplied=function(){this.threeObject.maxWidth=this.offsetWidth;this.threeObject._actuallySync(this._afterSync)};a.prototype.getBoundingSphere=function(){return null};return a}(E.Text3DFacade);F=w(F);y.forEach(function(b){F.prototype[b]="inherit"});Object.defineProperty(F.prototype,"maxWidth",{value:Infinity,enumerable:!0,writable:!0});var la=
F,ma=(new e.PlaneBufferGeometry(1,1)).translate(.5,-.5,0),S=new e.MeshBasicMaterial({color:0}),na=Object.freeze(new e.Vector2),T=Object.freeze(new e.Vector4(0,0,0,0)),oa={customDepthMaterial:{get:function(){return this.material.getDepthMaterial()}},customDistanceMaterial:{get:function(){return this.material.getDistanceMaterial()}}},U=new Map,V=function(b){function a(a){b.call(this,a);this._colorObj=new e.Color;this.size=na;this.borderWidth=this.borderRadius=T;this.color=0;this.isBorder=!1;this.material=
S}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;a.prototype.afterUpdate=function(){var a=this.material,c=this.depthOffset,g=this.castShadow,h=this.receiveShadow,f=this.color,p=this.renderOrder;a||(a=S);c=a.id+"|"+p+"|"+c+"|"+g+"|"+h;if(c!==this._prevMeshKey){var k=U.get(c);if(!k){var l=da(a);l.polygonOffset=!!this.depthOffset;l.polygonOffsetFactor=l.polygonOffsetUnits=this.depthOffset||0;a.addEventListener("dispose",function x(){a.removeEventListener("dispose",
x);l.dispose()});k=new e.Mesh(ma,l);k._instanceKey=c;k.castShadow=g;k.receiveShadow=h;k.renderOrder=p;Object.defineProperties(k,oa);U.set(c,k)}this.instancedThreeObject=k;this._prevMeshKey=c}this.setInstanceUniform("uTroikaBlockSize",this.size);this.setInstanceUniform("uTroikaCornerRadii",this.borderRadius);this.setInstanceUniform("uTroikaClipRect",this.clipRect);this.setInstanceUniform("uTroikaBorderWidth",this.isBorder?this.borderWidth:T);f!==this._lastColor&&(this._lastColor=f,this.setInstanceUniform("diffuse",
new e.Color(f)));b.prototype.afterUpdate.call(this)};a.prototype.getBoundingSphere=function(){return null};return a}(r.Instanceable3DFacade),W,X=function(b){function a(a){var c=new e.Mesh(W||(W=(new e.CylinderBufferGeometry(.5,.5,1,8)).translate(0,-.5,0)),new e.MeshBasicMaterial({color:16777215,transparent:!0,opacity:0}));b.call(this,a,c);this.length=this.girth=0}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;a.prototype.afterUpdate=function(){this.scaleX=this.scaleZ=
this.girth;this.scaleY=this.length;this.rotateZ=this.horizontal?Math.PI/2:0;this.threeObject.material.opacity=this.opacity;b.prototype.afterUpdate.call(this)};return a}(r.Object3DFacade),N=new WeakMap,Y={opacity:{duration:300}},pa=function(b){function a(a){var c=this;b.call(this,a);this._onOver=function(a){c.hovering=!0;c.afterUpdate()};this._onOut=function(a){c.hovering=!1;c.afterUpdate()}}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;var d={target:{configurable:!0}};
d.target.set=function(a){var c=N.get(this);a!==c&&(c&&(c.removeEventListener("mouseover",this._onOver),c.removeEventListener("mouseout",this._onOut)),a&&(a.addEventListener("mouseover",this._onOver),a.addEventListener("mouseout",this._onOut)),N.set(this,a))};d.target.get=function(){return N.get(this)};a.prototype.describeChildren=function(){var a=this.target,b=this._childArr||(this._childArr=[]);b.length=0;if(a){var d=a.offsetWidth,f=a.offsetHeight,p=a.scrollHeight,e=a.scrollWidth,l=a.clientWidth,
m=a.clientHeight,x=a.getComputedFontSize();if(e>l){var t=this._hDef||(this._hDef={key:"h",facade:X,horizontal:!0,transition:Y});t.girth=Math.min(x/4,f/10);t.length=Math.max(l*l/e,x);t.x=a.clientLeft+a.scrollLeft/(e-l)*(l-t.length);t.y=-f;t.opacity=this.hovering?.5:0;t.renderOrder=this.renderOrder;b.push(t)}p>m&&(f=this._vDef||(this._vDef={key:"v",facade:X,transition:Y}),f.girth=Math.min(x/4,d/10),f.length=Math.max(m*m/p,x),f.x=d,f.y=-(a.clientTop+a.scrollTop/(p-m)*(m-f.length)),f.opacity=this.hovering?
.5:0,f.renderOrder=this.renderOrder,b.push(f))}return b};a.prototype.destructor=function(){this.target=null;b.prototype.destructor.call(this)};Object.defineProperties(a.prototype,d);return a}(r.ParentFacade),Z=new e.Mesh((new e.PlaneBufferGeometry(1,1)).translate(.5,-.5,0)),P=new e.Matrix4,C=new e.Vector4(0,0,0,0),qa=Object.freeze(new e.Vector4(0,0,0,0)),fa=new e.Plane,ra={get:function(){return!this._priv_hidden&&!this.$facade.isFullyClipped},set:function(b){this._priv_hidden=!b}},H=function(b){function a(a){b.call(this,
a);Object.defineProperty(this.threeObject,"visible",ra);this.layers=new b(this);this.layers.children=[null,null,null];this._sizeVec2=Object.freeze(new e.Vector2);this._borderRadiiVec4=this._borderWidthVec4=this._clipRectVec4=qa;(this._geomBoundingSphere=new e.Sphere).version=0;this._wasFullyClipped=!0}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;a.prototype.updateChildren=function(a){this.isFullyClipped&&this._wasFullyClipped||b.prototype.updateChildren.call(this,
a)};a.prototype.updateMatrices=function(){b.prototype.updateMatrices.call(this);this.layers.traverse(ha)};a.prototype.afterUpdate=function(){var a=this.layers,c=this.backgroundColor,g=this.backgroundMaterial,h=this.borderWidth,f=this.borderColor,p=this.borderMaterial,k=this.text,l=this.offsetLeft,m=this.offsetTop,x=this.offsetWidth,t=this.offsetHeight,n=this.parentFlexNode,u=this.flexNodeDepth,q=this.isFullyClipped,w=this._wasFullyClipped,v=this._borderWidthVec4,r=this._clipRectVec4,y=this._sizeVec2,
z=null!==x,B=!(!x||!t),D=B&&!q&&(null!=c||null!=g),E=B&&!q&&(null!=f||null!=p)&&0<Math.max.apply(Math,h);B=B&&("scroll"===this.overflow||"auto"===this.overflow)&&(this.scrollHeight>this.clientHeight||this.scrollWidth>this.clientWidth);z&&(n&&(z="absolute"===this.position,this.x=l-(z?0:n.scrollLeft),this.y=-(m-(z?0:n.scrollTop))),x!==y.x||t!==y.y)&&(y=this._sizeVec2=Object.freeze(new e.Vector2(x,t)),l=this._geomBoundingSphere,l.radius=Math.sqrt(x*x/4+t*t/4),l.center.set(x/2,-t/2,0),l.version++);if(!q||
!w)if(l=D||E?this._normalizeBorderRadius():null,C.fromArray(h),C.equals(v)||(v=this._borderWidthVec4=Object.freeze(C.clone())),C.set(Math.max(this.clipLeft,0),Math.max(this.clipTop,0),Math.min(this.clipRight,x),Math.min(this.clipBottom,t)),C.equals(r)||(r=this._clipRectVec4=Object.freeze(C.clone())),h=null,D&&(h=this._bgLayerDef||(this._bgLayerDef={key:"bg",facade:V}),h.size=y,h.color=c,h.borderRadius=l,h.material=g,h.clipRect=r,h.depthOffset=-u,h.renderOrder=u,h.castShadow=this.castShadow,h.receiveShadow=
this.receiveShadow),a.children[0]=h,c=null,E&&(c=this._borderLayerDef||(this._borderLayerDef={key:"border",facade:V,isBorder:!0}),c.size=y,c.color=f,c.borderWidth=v,c.borderRadius=l,c.material=p,c.clipRect=r,c.depthOffset=-u-1,c.renderOrder=u+1,c.castShadow=this.castShadow,c.receiveShadow=this.receiveShadow),a.children[1]=c,f=null,B&&(f=this._scrollbarsDef||(this._scrollbarsDef={key:"sb",facade:pa,target:this}),f.renderOrder=u+2),a.children[2]=f,!k&&M(this.children)&&(k=""+this.children),k)f=this._textChildDef||
(this._textChildDef={key:"text",facade:la}),f.text=k,f.font=A(this,"font"),f.fontSize=this.getComputedFontSize(),f.textAlign=A(this,"textAlign"),f.textIndent=A(this,"textIndent"),f.lineHeight=A(this,"lineHeight","normal"),f.letterSpacing=A(this,"letterSpacing",0),f.whiteSpace=A(this,"whiteSpace"),f.overflowWrap=A(this,"overflowWrap"),f.color=A(this,"color"),f.colorRanges=this.colorRanges,f.outlineWidth=this.textOutlineWidth||0,f.outlineColor=this.textOutlineColor,f.outlineOpacity=this.textOutlineOpacity,
f.outlineBlur=this.textOutlineBlur||0,f.outlineOffsetX=this.textOutlineOffsetX||0,f.outlineOffsetY=this.textOutlineOffsetY||0,f.strokeWidth=this.textStrokeWidth||0,f.strokeColor=this.textStrokeColor,f.strokeOpacity=this.textStrokeOpacity,f.fillOpacity=this.textFillOpacity,f.material=this.textMaterial,f.depthOffset=-u-1,f.renderOrder=u+1,f.castShadow=this.castShadow,f.receiveShadow=this.receiveShadow,this._actualChildren=f;else{k=this.children;if(Array.isArray(k))for(u=0,f=k.length;u<f;u++)if(M(k[u])){for(k=
k.slice();u<f;u++)M(k[u])&&(k[u]={facade:sa,text:""+k[u],textMaterial:this.textMaterial});break}this._actualChildren=k}B!==this._couldScroll&&(this._couldScroll=B,this[(B?"add":"remove")+"EventListener"]("wheel",ea),this[(B?"add":"remove")+"EventListener"]("dragstart",O),this[(B?"add":"remove")+"EventListener"]("drag",O));b.prototype.afterUpdate.call(this);q&&w||a.afterUpdate();this._wasFullyClipped=q};a.prototype.describeChildren=function(){return this._actualChildren};a.prototype.getComputedFontSize=
function(){return G(this,16)};a.prototype._normalizeBorderRadius=function(){var a=this.borderRadius,b=this.offsetWidth;void 0===b&&(b=0);var g=this.offsetHeight;void 0===g&&(g=0);var h=this._borderRadiiVec4;if(Array.isArray(a)){var f=a.length;var e=a[0]||0;var k=(1<f?a[1]:a[0])||0;var l=(2<f?a[2]:a[0])||0;a=(3<f?a[3]:1<f?a[1]:a[0])||0}else e=k=l=a=a||0;if(0!==e||0!==k||0!==l||0!==a)f=Math.min(b,g),"string"===typeof e&&/%$/.test(e)&&(e=parseInt(e,10)/100*f),"string"===typeof k&&/%$/.test(k)&&(k=parseInt(k,
10)/100*f),"string"===typeof a&&/%$/.test(a)&&(a=parseInt(a,10)/100*f),"string"===typeof l&&/%$/.test(l)&&(l=parseInt(l,10)/100*f),b=Math.min(b/(e+k),g/(k+l),b/(l+a),g/(a+e)),1>b&&(e*=b,k*=b,a*=b,l*=b);C.set(e,k,l,a);C.equals(h)||(h=this._borderRadiiVec4=Object.freeze(C.clone()));return h};a.prototype._getGeometryBoundingSphere=function(){return this._geomBoundingSphere.radius&&!this.isFullyClipped?this._geomBoundingSphere:null};a.prototype.raycast=function(a){var b=this,d=this.offsetWidth,h=this.offsetHeight,
f=this.clipTop,e=this.clipRight,k=this.clipBottom,l=this.clipLeft,m=null;d&&h&&(Z.matrixWorld.multiplyMatrices(this.threeObject.matrixWorld,P.makeScale(d,h,1)),m=this._raycastObject(Z,a))&&(m=m.filter(function(a){var b=a.uv.x*d;a=(1-a.uv.y)*h;return b>l&&b<e&&a>f&&a<k}),m.forEach(function(a){a.distance=parseFloat(a.distance.toFixed(12));a.distanceBias=-b.flexNodeDepth}));return m&&m.length?m:null};a.prototype.destructor=function(){this.layers.destructor();b.prototype.destructor.call(this)};return a}(r.Group3DFacade),
sa=H=w(H);y.forEach(function(b){H.prototype[b]="inherit"});var v=H,ta=(new e.PlaneBufferGeometry(1,1)).translate(.5,-.5,0),ua=new e.MeshBasicMaterial,va=new e.TextureLoader;E=function(b){function a(a,c){c=new e.Mesh(ta,ua.clone());c.visible=!1;b.call(this,a,c)}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;a.prototype.afterUpdate=function(){var a=this,c=this.offsetLeft,g=this.offsetTop,h=this.offsetWidth,f=this.offsetHeight,e=this.src,k=this.threeObject,l=k.material,
m=!(!h||!f);m&&(this.x=c,this.y=-g,this.scaleX=h,this.scaleY=f,c=this.flexNodeDepth,l.polygonOffset=!!c,l.polygonOffsetFactor=l.polygonOffsetUnits=-c||0,k.renderOrder=c);e!==this._lastSrc&&(va.load(e,function(b){l.map&&l.map.dispose();l.map=b;a.aspectRatio=b.image.width/b.image.height;a.afterUpdate();a.requestRender()}),this._lastSrc=e);k.visible=!!(m&&l.map&&l.map.image.complete);b.prototype.afterUpdate.call(this)};a.prototype.destructor=function(){var a=this.threeObject.material.map;a&&a.dispose();
b.prototype.destructor.call(this)};return a}(r.Object3DFacade);E=w(E);var aa=function(b){function a(a){b.call(this,a);this.font="https://fonts.gstatic.com/s/materialicons/v36/flUhRq6tzZclQEJ-Vdg-IuiaDsNa.woff"}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;var d={icon:{configurable:!0},size:{configurable:!0}};d.icon.set=function(a){this.text=a};d.size.set=function(a){this.fontSize=a};Object.defineProperties(a.prototype,d);return a}(v);y=function(b){function a(a){var c=
this;b.call(this,a);this.justifyContent="center";this.fontSize="150%";this.onClick=function(a){c.onUpdate(!c.value)}}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;a.prototype.afterUpdate=function(){this.icon=this.value?"check_box":"check_box_outline_blank";b.prototype.afterUpdate.call(this)};return a}(aa);var wa=function(b){function a(a){b.call(this,a);this.children={facade:b,borderRadius:"10%",backgroundColor:3355545,height:"100%",padding:[0,.02],alignItems:"center",
justifyContent:"center",pointerStates:{hover:{backgroundColor:6710988}}}}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;a.prototype.afterUpdate=function(){this.children.text=this.label||"Missing label";b.prototype.afterUpdate.call(this)};return a}(v),q=new e.Color,I=new e.Plane,ba=(new e.CylinderBufferGeometry(.5,.5,1,45)).translate(0,.5,0).rotateX(Math.PI/2).rotateZ(Math.PI/2),ca=L.createDerivedMaterial(new e.MeshBasicMaterial({side:2}),{uniforms:{maxValue:{value:1}},
vertexDefs:"\nvarying vec3 vPos;\n",vertexMainIntro:"\nvPos = position;\n",fragmentDefs:"\nuniform float maxValue;\nvarying vec3 vPos;\n\n// From https://github.com/hughsk/glsl-hsv2rgb\nvec3 hsv2rgb(vec3 c) {\n vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n}\n\n",fragmentColorTransform:"\nfloat angle = atan(vPos.y, vPos.x) / PI2;\nfloat radius = length(vPos.xy) * 2.0;\nfloat value = vPos.z * maxValue;\nvec3 hsv = vec3(angle, radius, value);\nvec3 rgb = hsv2rgb(hsv);\ngl_FragColor.xyz = rgb;\n"}),
xa=function(b){function a(a){b.call(this,a,new e.Mesh(ba,ca.clone()));this.maxValue=1}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;a.prototype.afterUpdate=function(){this.threeObject.material.uniforms.maxValue.value=this.maxValue;b.prototype.afterUpdate.call(this)};return a}(r.Object3DFacade),ya=function(b){function a(a){var c=ca.clone();c.transparent=!0;c.opacity=.5;c.side=e.BackSide;b.call(this,a,new e.Mesh(ba,c))}b&&(a.__proto__=b);a.prototype=Object.create(b&&
b.prototype);return a.prototype.constructor=a}(r.Object3DFacade),za=function(b){function a(a){var c=(new e.SphereBufferGeometry(.05,16,12)).translate(0,0,.5),d=(new e.CylinderBufferGeometry(.005,.005,.5,6)).translate(0,.25,0).rotateX(Math.PI/2),h=new e.MeshBasicMaterial;c=new e.Mesh(c,h);c.add(new e.Mesh(d,new e.MeshBasicMaterial({color:13421772})));b.call(this,a,c)}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;a.prototype.afterUpdate=function(){this.threeObject.material.color.set(this.color);
b.prototype.afterUpdate.call(this)};return a}(r.Object3DFacade),Aa=function(b){function a(a){var c=L.createDerivedMaterial(new e.MeshBasicMaterial({transparent:!0,color:16777215,polygonOffset:!0,polygonOffsetFactor:1}),{vertexDefs:"varying vec2 vUV;",vertexMainIntro:"vUV = uv;",fragmentDefs:"varying vec2 vUV;",fragmentColorTransform:"\n float dist = min(min(vUV.x, 1.0 - vUV.x), min(vUV.y, 1.0 - vUV.y));\n gl_FragColor.w *= 1.0 - 0.5 * smoothstep(0.0, 0.1, dist);\n "});b.call(this,
a,new e.Mesh(new e.PlaneBufferGeometry,c))}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;a.prototype.afterUpdate=function(){this.threeObject.material.opacity=this.opacity;b.prototype.afterUpdate.call(this)};return a}(r.Object3DFacade),Ba=function(b){function a(a){var c=this;b.call(this,a);this.cylinderHeight=.5;this.cylinderDiameter=.75;this.rotateX=-Math.PI/4;a=function(a){var b=a.currentTarget.threeObject,d=a.ray;I.normal.set(0,0,-1);I.constant=1;I.applyMatrix4(b.matrixWorld);
var g=d.intersectPlane(I,new e.Vector3);if(g){b.worldToLocal(g);d=2*g.x;g=2*g.y;for(b=Math.atan2(g,d)/Math.PI/2;0>b;)b+=1;d=Math.min(1,Math.sqrt(d*d+g*g));g=c._getHSV();g[0]=b;g[1]=d;c._updateHSV(g,a.shiftKey)}};this.onWheel=function(a){var b=c._getHSV();b[2]=Math.max(0,Math.min(1,b[2]+a.nativeEvent.deltaY/100));c._updateHSV(b,!1)};this.children=[this.cylinderDef={key:"disc",facade:xa,onMouseDown:a,onDragStart:a,onDrag:a},this.cylinderBgDef={facade:ya,renderOrder:9},this.planeDef={facade:Aa,renderOrder:10,
opacity:.3,pointerStates:{hover:{opacity:.4}},transition:{opacity:!0},onDragStart:function(a){c._dragData={plane:(new e.Plane).setFromNormalAndCoplanarPoint((new e.Vector3(0,1,0)).transformDirection(c.threeObject.matrixWorld),a.intersection.point)}},onDrag:function(a){var b=a.ray.intersectPlane(c._dragData.plane,new e.Vector3);c.threeObject.worldToLocal(b);var d=c._getHSV();d[2]=Math.max(0,Math.min(1,b.z/c.cylinderHeight));c._updateHSV(d,a.shiftKey)},onDragEnd:function(a){c._dragData=null}},this.stickDef=
{facade:za}]}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;a.prototype._getHSV=function(){var a=[0,0,0];if(null!=this.value){q.set(this.value);a=q.r;var b=q.g,g=q.b,h,f=Math.max(a,b,g);var e=f-Math.min(a,b,g);if(0===e)var k=h=0;else{k=e/f;var l=(f-a)/6/e+.5;var m=(f-b)/6/e+.5;e=(f-g)/6/e+.5;a===f?h=e-m:b===f?h=1/3+l-e:g===f&&(h=2/3+m-l);0>h?h+=1:1<h&&--h}a=[h,k,f]}return a};a.prototype._updateHSV=function(a,b){a=ia.apply(void 0,a);q.setRGB.apply(q,a);b&&(q.r=
Math.round(5*q.r)/5,q.g=Math.round(5*q.g)/5,q.b=Math.round(5*q.b)/5);this.onChange(q.getHex())};a.prototype.afterUpdate=function(){var a=this.stickDef,c=this.cylinderDef,g=this.cylinderBgDef,e=this.planeDef,f=this.cylinderHeight,p=this.cylinderDiameter,k=this._getHSV(),l=k[0]*Math.PI*2,m=k[1]/2*p,n=Math.sin(l)*m;a.x=Math.cos(l)*m;a.y=n;a.z=k[2]*f;a.color=this.value;c.maxValue=k[2];c.scale=p;c.scaleZ=k[2]*f+1E-5;g.scale=p;g.scaleZ=f;e.z=k[2]*f;b.prototype.afterUpdate.call(this)};return a}(r.Group3DFacade),
Ca=["mousedown","wheel"],J=function(b){function a(a){var c=this;b.call(this,a);this.popupContent=null;this._popupCt={key:"popup",facade:D.ParentFacade};this._onCloserEvent=function(a){a:{for(a=a.target;a;){if(a===c){a=!0;break a}a=a.parent}a=!1}a||c.closePopup()};this.openPopup=function(){c.isPopupOpen||(c.isPopupOpen=!0,c.afterUpdate())};this.closePopup=function(){c.isPopupOpen&&(c.isPopupOpen=!1,c.afterUpdate())}}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=
a;var d={children:{configurable:!0}};a.prototype.getPopupContent=function(){return this.popupContent};d.children.set=function(a){this._children=[this._popupCt].concat(a)};d.children.get=function(){return this._children};a.prototype._toggleCloseListeners=function(a){var b=this,c=this.getSceneFacade();c&&Ca.forEach(function(d){c[(a?"add":"remove")+"EventListener"](d,b._onCloserEvent)})};a.prototype.afterUpdate=function(){var a=this.isPopupOpen;a!==this._wasPopupOpen&&(this._wasPopupOpen=a,this._toggleCloseListeners(a));
this._popupCt.children=a?this.getPopupContent():null;b.prototype.afterUpdate.call(this)};a.prototype.destructor=function(){this._toggleCloseListeners(!1);b.prototype.destructor.call(this)};Object.defineProperties(a.prototype,d);return a}(v),K=new e.Color,Da=function(b){function a(a){b.call(this,a);this.flexDirection="row";this.alignItems="center";this.children=[this.swatchDef={facade:v,borderRadius:"10%",backgroundColor:null,height:"100%",width:"25%",onClick:this.openPopup},this.labelDef={facade:v,
padding:.01}];this.popupContent=this.pickerDef={key:"picker",facade:Ba,visible:!1,onChange:this._onColorChange.bind(this),animation:{from:{scale:1E-10},to:{scale:1},duration:500,easing:"easeOutExpo"}}}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;a.prototype._onColorChange=function(a){this.onUpdate(a)};a.prototype.afterUpdate=function(){var a=this.swatchDef,c=this.labelDef,g=this.pickerDef,e=this.value,f=this.offsetWidth,p=this.offsetHeight,k=null!=e;k&&K.set(e);
a.backgroundColor=k?K.getHex():null;c.text=k?"#"+K.getHexString().toUpperCase():"(choose color)";f&&p&&(g.visible=!0,g.value=K.getHex(),a=7*p,g.scale=g.animation.to.scale=a,g.x=f+.75*a,g.y=-a/2-p);b.prototype.afterUpdate.call(this)};return a}(J),Ea=function(b){function a(a){var c=this;b.call(this,a);this.flexDirection="row";this.minHeight=.01;this.backgroundColor=6710886;this.children=this._valChild={key:"slider",facade:b,backgroundColor:16777215,width:"0%"};this.onMouseDown=this.onDragStart=this.onDrag=
function(a){var b=c.min||0,d=c.max||0;d!==b&&a.intersection&&a.intersection.facade===c&&(b+=a.intersection.uv.x*(d-b),d=c.step||.001,b=Math.round(b/d)*d,b=+b.toFixed((d+"").replace(/^-?\d+\.?/,"").length),c.onChange(b),a.stopPropagation())}}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;a.prototype.afterUpdate=function(){var a=this.value||0,c=Math.min(this.min||0,a),e=Math.max(this.max||0,a);this._valChild.width=c===e?0:(a-c)/(e-c)*100+"%";b.prototype.afterUpdate.call(this)};
return a}(v),Fa=function(b){function a(a){b.call(this,a);this.min=this.value=0;this.max=1;this.step=.1;this.flexDirection="row";this.alignItems="center";this.children=[this._sliderChild={key:"slider",facade:Ea,flex:1,minWidth:.2,height:"100%",margin:[0,.01,0,0]},this._textChild={key:"text",facade:b,width:.05,text:"0"}]}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;a.prototype.afterUpdate=function(){this._textChild.text=this.value+"";var a=this._sliderChild;
a.value=this.value||0;a.min=this.min||0;a.max=this.max||0;a.step=this.step;a.onChange=this.onUpdate;b.prototype.afterUpdate.call(this)};return a}(v);J=function(b){function a(a){var c=this;b.call(this,a);this.position="relative";this.dropdownConfig=null;this._onItemClick=function(a){c.onUpdate(a.target.value);c.closePopup()};this.children=[this._btnChild={key:"btn",facade:v,flexDirection:"row",alignItems:"center",justifyContent:"space-between",borderRadius:"10%",backgroundColor:3355545,height:"100%",
padding:[0,.02],overflow:"hidden",pointerStates:{hover:{backgroundColor:6710988}},onClick:this.openPopup,children:["",{facade:aa,icon:"keyboard_arrow_down"}]}];this.popupContent={key:"menu",facade:v,position:"absolute",top:"100%",left:0,width:"100%",backgroundColor:3355443,z:.01,maxHeight:.5,overflow:"scroll",flexDirection:"column",children:this._menuListDef={facade:D.ListFacade,data:null,template:{key:function(a,b){return b},facade:v,width:"100%",overflow:"hidden",whiteSpace:"nowrap",padding:.01,
text:function(a){return a.label},value:function(a){return a.value},onClick:function(a){return c._onItemClick},backgroundColor:function(a){return a.selected?6710886:null},pointerStates:{hover:{backgroundColor:4473924}}}},animation:{from:{scale:.01},to:{scale:1},duration:300,easing:"easeOutExpo"}}}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;a.prototype.afterUpdate=function(){var a=this,c=null,e=this.options.reduce(function(b,d){if(d){var e={};d&&"object"===
typeof d?(e.value=d.value,e.label="string"===typeof d.label?d.label:""+d.value):(e.value=d,e.label=d+"");e.value===a.value&&(e.selected=!0,c=e);b.push(e)}return b},[]);this._btnChild.children[0]=c?c.label:"[Select...]";Object.assign(this.popupContent,this.dropdownConfig);this._menuListDef.data=e;b.prototype.afterUpdate.call(this)};return a}(J);var Ga={boolean:y,button:wa,color:Da,number:Fa,select:J};y=function(b){function a(a){b.call(this,a);this.flexDirection="row";this.fontSize=.02;this.itemHeight=
.04;this.padding=[0,.02];this.backgroundColor=4473924;this.borderRadius=.01;this.alignItems="flex-start";this.data={}}b&&(a.__proto__=b);a.prototype=Object.create(b&&b.prototype);a.prototype.constructor=a;a.prototype._onItemUpdate=function(a,b){Q["default"].set(this.data,a.path,b);this.onUpdate(this.data)};a.prototype.describeChildren=function(){var a=this;return[{facade:b,flexDirection:"column",margin:[0,.03,0,0],children:(this.items||[]).map(function(c,d){return c?{facade:b,text:"button"===c.type?
null:c.label||c.path,height:c.height||a.itemHeight,margin:[d?0:.02,0,.02],flexDirection:"row",alignItems:"center"}:null})},{facade:b,flexDirection:"column",minWidth:.2,children:(this.items||[]).map(function(c,d){if(!c)return null;var e=c&&Ga[c.type];return e?D.utils.assign({key:c.path||d,facade:e,height:c.height||a.itemHeight,margin:[d?0:.02,0,.02],value:Q["default"].get(a.data,c.path)},c,{onUpdate:function(b){c.onUpdate&&c.onUpdate.call(c,b);a._onItemUpdate(c,b)}}):{facade:b,text:"Unknown Type: "+
c.type}})}]};return a}(v);n.DatGuiFacade=y;n.UIBlock3DFacade=v;n.UIImage3DFacade=E;n.extendAsFlexNode=w;Object.defineProperty(n,"__esModule",{value:!0})})
fragmentColorTransform:"\nfloat troikaAlphaMult = troikaGetAlphaMultiplier();\nif (troikaAlphaMult == 0.0) {\n discard;\n} else {\n gl_FragColor.a *= troikaAlphaMult;\n}\n"});Object.defineProperty(a,"shadowSide",{get(){return this.side},set(){}});a.transparent=!0;return a}function fa(a){if(!a._didScroll){let c=a.currentTarget,{deltaX:d,deltaY:f,deltaMode:r}=a.nativeEvent;var b=1===r?F(c,16)*w(c,"lineHeight",1.2):F(c,16)/12;d*=b;f*=b;b=Math.max(0,Math.min(c.scrollWidth-c.clientWidth,c.scrollLeft+
d));let g=Math.max(0,Math.min(c.scrollHeight-c.clientHeight,c.scrollTop+f)),h=Math.abs;if(b!==c.scrollLeft&&h(d)>h(f)||g!==c.scrollTop&&h(f)>h(d))c.scrollLeft=b,c.scrollTop=g,c.afterUpdate(),c.requestRender(),a._didScroll=!0;a.preventDefault()}}function N(a){if(!a._didScroll&&!a.defaultPrevented){let d=a.currentTarget,f=a.ray.clone().applyMatrix4(K.invertMatrix4(d.threeObject.matrixWorld,O)).intersectPlane(ha.setComponents(0,0,1,0),new e.Vector3);var b=d._prevDragPos;if(f&&b&&"drag"===a.type){var c=
f.x-b.x;b=f.y-b.y;if(c||b)if(c=Math.max(0,Math.min(d.scrollWidth-d.clientWidth,d.scrollLeft+c)),b=Math.max(0,Math.min(d.scrollHeight-d.clientHeight,d.scrollTop+b)),c!==d.scrollLeft||b!==d.scrollTop)d.scrollLeft=c,d.scrollTop=b,d.afterUpdate(),d.requestRender(),a._didScroll=!0}d._prevDragPos=f}}function L(a){return"string"===typeof a||"number"===typeof a}function ia(a){a.updateMatrices&&a.updateMatrices()}function ja(a,b,c,d,f,r){d=6*a%1;r=[c,-c*d*b+c,f=-c*b+c,f,c*d*b+f,c];return[r[d=6*a|0],r[(4+d)%
6],r[(2+d)%6]]}var P=v&&"object"===typeof v&&"default"in v?v:{"default":v};let {assign:ka,createClassExtender:la}=E.utils;v=la("flexNode",a=>{class b extends a{constructor(a){super(a);this.needsFlexLayout=this.isFlexNode=!0;for(this._flexStyles={id:this.$facadeId};a&&!a.isFlexNode;)a=a.parent;a?(this.parentFlexNode=a,this.flexNodeDepth=a.flexNodeDepth+1):this.flexNodeDepth=0}afterUpdate(){null!=this.offsetWidth&&(this._checkOverscroll(),this._updateClipRect());super.afterUpdate();this.needsFlexLayout&&
(this.parentFlexNode?(this.notifyWorld("needsFlexLayout"),this.needsFlexLayout=!1):this._performRootLayout())}destructor(){this.parentFlexNode&&this.notifyWorld("needsFlexLayout");super.destructor()}onNotifyWorld(a,d,b){if("needsFlexLayout"!==d||this.parentFlexNode)super.onNotifyWorld(a,d,b);else this.needsFlexLayout=!0,this._rootLayoutReq||(this._rootLayoutReq=setTimeout(this._performRootLayout.bind(this),0))}_performRootLayout(){this._hasActiveFlexRequest||(this._hasActiveFlexRequest=!0,this.needsFlexLayout=
!1,clearTimeout(this._rootLayoutReq),delete this._rootLayoutReq,this.traverse(a=>{if(a.isFlexNode){const c=a.parentFlexNode;c&&(c._flexStyles.children||(c._flexStyles.children=[])).push(a._flexStyles);a._flexStyles.children=null}}),z.requestFlexLayout(this._flexStyles,a=>{this.isDestroying||(this._applyRootLayoutResults(a),this._hasActiveFlexRequest=!1,this.afterUpdate(),this.requestRender())}))}_applyRootLayoutResults(a){this.traverse(c=>{if(c.isFlexNode){var b=a[c.$facadeId];if(b){const {left:a,
top:d,width:f,height:k}=b,{borderWidth:e,padding:C}=c;c.offsetLeft=a;c.offsetTop=d;c.offsetWidth=f;c.offsetHeight=k;c.clientLeft=e[3]+C[3];c.clientTop=e[0]+C[0];c.clientWidth=f-e[1]-e[3]-C[1]-C[3];c.clientHeight=k-e[0]-e[2]-C[0]-C[2];c.scrollHeight=c.scrollWidth=0;if(b=c.parentFlexNode){let c=a+f-b.clientLeft,g=d+k-b.clientTop;c>b.scrollWidth&&(Math.abs(c-b.clientWidth)<c/1E4&&(c=b.clientWidth),b.scrollWidth=c);g>b.scrollHeight&&(Math.abs(g-b.clientHeight)<g/1E4&&(g=b.clientHeight),b.scrollHeight=
g)}if(c.onAfterFlexLayoutApplied)c.onAfterFlexLayoutApplied()}}})}_checkOverscroll(){const {scrollLeft:a,scrollTop:b}=this;if(a||b){const c=Math.max(0,this.scrollWidth-this.clientWidth),d=Math.max(0,this.scrollHeight-this.clientHeight);c<a&&(this.scrollLeft=c);d<b&&(this.scrollTop=d)}}_updateClipRect(){const {offsetWidth:a,offsetHeight:b,parentFlexNode:f}=this;let e,g;if(f&&"absolute"!==this.position){var h=this.offsetLeft-f.scrollLeft;var k=this.offsetTop-f.scrollTop;const a="visible"!==f.overflow;
e=Math.max(a?f.clientLeft:-Infinity,f.clipLeft)-h;g=Math.max(a?f.clientTop:-Infinity,f.clipTop)-k;h=Math.min(a?f.clientLeft+f.clientWidth:Infinity,f.clipRight)-h;k=Math.min(a?f.clientTop+f.clientHeight:Infinity,f.clipBottom)-k}else e=g=-Infinity,h=k=Infinity;this.clipLeft=e;this.clipTop=g;this.clipRight=h;this.clipBottom=k;this.isFullyClipped=e>=a||g>=b||0>=h||0>=k||e===h||g===k}}ka(b.prototype,{offsetLeft:null,offsetTop:null,offsetWidth:null,offsetHeight:null,clientLeft:null,clientTop:null,clientWidth:null,
clientHeight:null,scrollLeft:0,scrollTop:0,scrollWidth:null,scrollHeight:null,clipLeft:null,clipTop:null,clipRight:null,clipBottom:null,isFullyClipped:!1,overflow:"visible"});"width height minWidth minHeight maxWidth maxHeight aspectRatio flexDirection flex flexWrap flexBasis flexGrow flexShrink alignContent alignItems alignSelf justifyContent position left right top bottom".split(" ").forEach(a=>{Object.defineProperty(b.prototype,a,{get(){return this._flexStyles[a]},set(c){c!==this._flexStyles[a]&&
(this._flexStyles[a]=c,this.needsFlexLayout=!0)},configurable:!0})});["margin","padding","borderWidth"].forEach(a=>{const c=`_priv_${a}`,f="borderWidth"===a?"border":a,e=f+"Top",g=f+"Right",h=f+"Bottom",k=f+"Left";Object.defineProperty(b.prototype,a,{get(){return this[c]||(this[c]=Object.freeze([0,0,0,0]))},set(b){let d,f,r;if(Array.isArray(b)){var p=b.length;d=b[0]||0;f=(1<p?b[1]:b[0])||0;r=(2<p?b[2]:b[0])||0;b=(3<p?b[3]:1<p?b[1]:b[0])||0}else d=f=r=b;p=this[a];if(d!==p[0]||f!==p[1]||r!==p[2]||b!==
p[3])this[c]=Object.freeze([d,f,r,b]),p=this._flexStyles,p[e]=d,p[g]=f,p[h]=r,p[k]=b,this.needsFlexLayout=!0}})});return b});let Q="font fontSize textAlign textIndent lineHeight letterSpacing whiteSpace overflowWrap color".split(" "),R="text textIndent font fontSize lineHeight letterSpacing whiteSpace overflowWrap".split(" "),ma=()=>{};class x extends J.Text3DFacade{constructor(a){super(a);a=this.threeObject;a._actuallySync=a.sync;a.sync=ma}afterUpdate(){let {offsetLeft:a,offsetTop:b,offsetWidth:c}=
this;if(null!==c){var d=this.parentFlexNode;this.x=a-d.scrollLeft;this.y=-(b-d.scrollTop);d=this.clipRect||(this.clipRect=[0,0,0,0]);d[0]=this.clipLeft;d[1]=-this.clipBottom;d[2]=this.clipRight;d[3]=-this.clipTop;this.threeObject.visible=!this.isFullyClipped}d=this._flexStyles;for(let a=0,b=R.length;a<b;a++){let b=R[a];("text"===b?this.text:w(this,b))!==d[b]&&(d[b]=this[b],this.needsFlexLayout=!0)}super.afterUpdate()}onAfterFlexLayoutApplied(){this.threeObject.maxWidth=this.offsetWidth;this.threeObject._actuallySync(this._afterSync)}getBoundingSphere(){return null}}
x=v(x);Q.forEach(a=>{x.prototype[a]="inherit"});Object.defineProperty(x.prototype,"maxWidth",{value:Infinity,enumerable:!0,writable:!0});var na=x;let oa=(new e.PlaneBufferGeometry(1,1)).translate(.5,-.5,0),S=new e.MeshBasicMaterial({color:0}),pa=Object.freeze(new e.Vector2),T=Object.freeze(new e.Vector4(0,0,0,0)),qa={customDepthMaterial:{get(){return this.material.getDepthMaterial()}},customDistanceMaterial:{get(){return this.material.getDistanceMaterial()}}},U=new Map;class V extends t.Instanceable3DFacade{constructor(a){super(a);
this._colorObj=new e.Color;this.size=pa;this.borderWidth=this.borderRadius=T;this.color=0;this.isBorder=!1;this.material=S}afterUpdate(){let {material:a,depthOffset:b,castShadow:c,receiveShadow:d,color:f,renderOrder:r}=this;a||(a=S);let g=`${a.id}|${r}|${b}|${c}|${d}`;if(g!==this._prevMeshKey){let b=U.get(g);if(!b){let f=ea(a);f.polygonOffset=!!this.depthOffset;f.polygonOffsetFactor=f.polygonOffsetUnits=this.depthOffset||0;a.addEventListener("dispose",function C(){a.removeEventListener("dispose",
C);f.dispose()});b=new e.Mesh(oa,f);b._instanceKey=g;b.castShadow=c;b.receiveShadow=d;b.renderOrder=r;Object.defineProperties(b,qa);U.set(g,b)}this.instancedThreeObject=b;this._prevMeshKey=g}this.setInstanceUniform("uTroikaBlockSize",this.size);this.setInstanceUniform("uTroikaCornerRadii",this.borderRadius);this.setInstanceUniform("uTroikaClipRect",this.clipRect);this.setInstanceUniform("uTroikaBorderWidth",this.isBorder?this.borderWidth:T);f!==this._lastColor&&(this._lastColor=f,this.setInstanceUniform("diffuse",
new e.Color(f)));super.afterUpdate()}getBoundingSphere(){return null}}let W;class X extends t.Object3DFacade{constructor(a){let b=new e.Mesh(W||(W=(new e.CylinderBufferGeometry(.5,.5,1,8)).translate(0,-.5,0)),new e.MeshBasicMaterial({color:16777215,transparent:!0,opacity:0}));super(a,b);this.length=this.girth=0}afterUpdate(){this.scaleX=this.scaleZ=this.girth;this.scaleY=this.length;this.rotateZ=this.horizontal?Math.PI/2:0;this.threeObject.material.opacity=this.opacity;super.afterUpdate()}}let M=
new WeakMap,Y={opacity:{duration:300}};class ra extends t.ParentFacade{constructor(a){super(a);this._onOver=a=>{this.hovering=!0;this.afterUpdate()};this._onOut=a=>{this.hovering=!1;this.afterUpdate()}}set target(a){let b=M.get(this);a!==b&&(b&&(b.removeEventListener("mouseover",this._onOver),b.removeEventListener("mouseout",this._onOut)),a&&(a.addEventListener("mouseover",this._onOver),a.addEventListener("mouseout",this._onOut)),M.set(this,a))}get target(){return M.get(this)}describeChildren(){let {target:a}=
this,b=this._childArr||(this._childArr=[]);b.length=0;if(a){let {offsetWidth:d,offsetHeight:f,scrollHeight:e,scrollWidth:g,clientWidth:h,clientHeight:k}=a,m=a.getComputedFontSize();if(g>h){var c=this._hDef||(this._hDef={key:"h",facade:X,horizontal:!0,transition:Y});c.girth=Math.min(m/4,f/10);c.length=Math.max(h*h/g,m);c.x=a.clientLeft+a.scrollLeft/(g-h)*(h-c.length);c.y=-f;c.opacity=this.hovering?.5:0;c.renderOrder=this.renderOrder;b.push(c)}e>k&&(c=this._vDef||(this._vDef={key:"v",facade:X,transition:Y}),
c.girth=Math.min(m/4,d/10),c.length=Math.max(k*k/e,m),c.x=d,c.y=-(a.clientTop+a.scrollTop/(e-k)*(k-c.length)),c.opacity=this.hovering?.5:0,c.renderOrder=this.renderOrder,b.push(c))}return b}destructor(){this.target=null;super.destructor()}}let Z=new e.Mesh((new e.PlaneBufferGeometry(1,1)).translate(.5,-.5,0)),O=new e.Matrix4,A=new e.Vector4(0,0,0,0),sa=Object.freeze(new e.Vector4(0,0,0,0)),ha=new e.Plane,ta={get(){return!this._priv_hidden&&!this.$facade.isFullyClipped},set(a){this._priv_hidden=!a}};
class G extends t.Group3DFacade{constructor(a){super(a);Object.defineProperty(this.threeObject,"visible",ta);this.layers=new t.Group3DFacade(this);this.layers.children=[null,null,null];this._sizeVec2=Object.freeze(new e.Vector2);this._borderRadiiVec4=this._borderWidthVec4=this._clipRectVec4=sa;(this._geomBoundingSphere=new e.Sphere).version=0;this._wasFullyClipped=!0}updateChildren(a){this.isFullyClipped&&this._wasFullyClipped||super.updateChildren(a)}updateMatrices(){super.updateMatrices();this.layers.traverse(ia)}afterUpdate(){let {layers:a,
backgroundColor:b,backgroundMaterial:c,borderWidth:d,borderColor:f,borderMaterial:r,text:g,offsetLeft:h,offsetTop:k,offsetWidth:m,offsetHeight:n,parentFlexNode:t,flexNodeDepth:q,isFullyClipped:p,_wasFullyClipped:v,_borderWidthVec4:z,_clipRectVec4:x,_sizeVec2:D}=this;var y=!(!m||!n),u=y&&!p&&(null!=b||null!=c),l=y&&!p&&(null!=f||null!=r)&&0<Math.max(...d);y=y&&("scroll"===this.overflow||"auto"===this.overflow)&&(this.scrollHeight>this.clientHeight||this.scrollWidth>this.clientWidth);if(null!==m){if(t){var B=
"absolute"===this.position;this.x=h-(B?0:t.scrollLeft);this.y=-(k-(B?0:t.scrollTop))}if(m!==D.x||n!==D.y)D=this._sizeVec2=Object.freeze(new e.Vector2(m,n)),B=this._geomBoundingSphere,B.radius=Math.sqrt(m*m/4+n*n/4),B.center.set(m/2,-n/2,0),B.version++}if(!p||!v){B=u||l?this._normalizeBorderRadius():null;A.fromArray(d);A.equals(z)||(z=this._borderWidthVec4=Object.freeze(A.clone()));A.set(Math.max(this.clipLeft,0),Math.max(this.clipTop,0),Math.min(this.clipRight,m),Math.min(this.clipBottom,n));A.equals(x)||
(x=this._clipRectVec4=Object.freeze(A.clone()));let e=null;u&&(e=this._bgLayerDef||(this._bgLayerDef={key:"bg",facade:V}),e.size=D,e.color=b,e.borderRadius=B,e.material=c,e.clipRect=x,e.depthOffset=-q,e.renderOrder=q,e.castShadow=this.castShadow,e.receiveShadow=this.receiveShadow);a.children[0]=e;u=null;l&&(u=this._borderLayerDef||(this._borderLayerDef={key:"border",facade:V,isBorder:!0}),u.size=D,u.color=f,u.borderWidth=z,u.borderRadius=B,u.material=r,u.clipRect=x,u.depthOffset=-q-1,u.renderOrder=
q+1,u.castShadow=this.castShadow,u.receiveShadow=this.receiveShadow);a.children[1]=u;l=null;y&&(l=this._scrollbarsDef||(this._scrollbarsDef={key:"sb",facade:ra,target:this}),l.renderOrder=q+2);a.children[2]=l;!g&&L(this.children)&&(g=""+this.children);if(g)l=this._textChildDef||(this._textChildDef={key:"text",facade:na}),l.text=g,l.font=w(this,"font"),l.fontSize=this.getComputedFontSize(),l.textAlign=w(this,"textAlign"),l.textIndent=w(this,"textIndent"),l.lineHeight=w(this,"lineHeight","normal"),
l.letterSpacing=w(this,"letterSpacing",0),l.whiteSpace=w(this,"whiteSpace"),l.overflowWrap=w(this,"overflowWrap"),l.color=w(this,"color"),l.colorRanges=this.colorRanges,l.outlineWidth=this.textOutlineWidth||0,l.outlineColor=this.textOutlineColor,l.outlineOpacity=this.textOutlineOpacity,l.outlineBlur=this.textOutlineBlur||0,l.outlineOffsetX=this.textOutlineOffsetX||0,l.outlineOffsetY=this.textOutlineOffsetY||0,l.strokeWidth=this.textStrokeWidth||0,l.strokeColor=this.textStrokeColor,l.strokeOpacity=
this.textStrokeOpacity,l.fillOpacity=this.textFillOpacity,l.material=this.textMaterial,l.depthOffset=-q-1,l.renderOrder=q+1,l.castShadow=this.castShadow,l.receiveShadow=this.receiveShadow,this._actualChildren=l;else{l=this.children;if(Array.isArray(l))for(let a=0,b=l.length;a<b;a++)if(L(l[a])){for(l=l.slice();a<b;a++)L(l[a])&&(l[a]={facade:ua,text:""+l[a],textMaterial:this.textMaterial});break}this._actualChildren=l}}y!==this._couldScroll&&(this._couldScroll=y,this[`${y?"add":"remove"}EventListener`]("wheel",
fa),this[`${y?"add":"remove"}EventListener`]("dragstart",N),this[`${y?"add":"remove"}EventListener`]("drag",N));super.afterUpdate();p&&v||a.afterUpdate();this._wasFullyClipped=p}describeChildren(){return this._actualChildren}getComputedFontSize(){return F(this,16)}_normalizeBorderRadius(){let {borderRadius:a,offsetWidth:b=0,offsetHeight:c=0,_borderRadiiVec4:d}=this,f,e,g;if(Array.isArray(a)){var h=a.length;f=a[0]||0;e=(1<h?a[1]:a[0])||0;g=(2<h?a[2]:a[0])||0;h=(3<h?a[3]:1<h?a[1]:a[0])||0}else f=e=
g=h=a||0;if(0!==f||0!==e||0!==g||0!==h){var k=Math.min(b,c);"string"===typeof f&&/%$/.test(f)&&(f=parseInt(f,10)/100*k);"string"===typeof e&&/%$/.test(e)&&(e=parseInt(e,10)/100*k);"string"===typeof h&&/%$/.test(h)&&(h=parseInt(h,10)/100*k);"string"===typeof g&&/%$/.test(g)&&(g=parseInt(g,10)/100*k);k=Math.min(b/(f+e),c/(e+g),b/(g+h),c/(h+f));1>k&&(f*=k,e*=k,h*=k,g*=k)}A.set(f,e,g,h);A.equals(d)||(d=this._borderRadiiVec4=Object.freeze(A.clone()));return d}_getGeometryBoundingSphere(){return this._geomBoundingSphere.radius&&
!this.isFullyClipped?this._geomBoundingSphere:null}raycast(a){let {offsetWidth:b,offsetHeight:c,clipTop:d,clipRight:f,clipBottom:e,clipLeft:g}=this,h=null;b&&c&&(Z.matrixWorld.multiplyMatrices(this.threeObject.matrixWorld,O.makeScale(b,c,1)),h=this._raycastObject(Z,a))&&(h=h.filter(a=>{let k=a.uv.x*b;a=(1-a.uv.y)*c;return k>g&&k<f&&a>d&&a<e}),h.forEach(a=>{a.distance=parseFloat(a.distance.toFixed(12));a.distanceBias=-this.flexNodeDepth}));return h&&h.length?h:null}destructor(){this.layers.destructor();
super.destructor()}}let ua=G=v(G);Q.forEach(a=>{G.prototype[a]="inherit"});var m=G;let va=(new e.PlaneBufferGeometry(1,1)).translate(.5,-.5,0),wa=new e.MeshBasicMaterial,xa=new e.TextureLoader;class ya extends t.Object3DFacade{constructor(a,b){b=new e.Mesh(va,wa.clone());b.visible=!1;super(a,b)}afterUpdate(){let {offsetLeft:a,offsetTop:b,offsetWidth:c,offsetHeight:d,src:f,threeObject:e}=this,g=e.material,h=!(!c||!d);if(h){this.x=a;this.y=-b;this.scaleX=c;this.scaleY=d;let f=this.flexNodeDepth;g.polygonOffset=
!!f;g.polygonOffsetFactor=g.polygonOffsetUnits=-f||0;e.renderOrder=f}f!==this._lastSrc&&(xa.load(f,a=>{g.map&&g.map.dispose();g.map=a;this.aspectRatio=a.image.width/a.image.height;this.afterUpdate();this.requestRender()}),this._lastSrc=f);e.visible=!!(h&&g.map&&g.map.image.complete);super.afterUpdate()}destructor(){let a=this.threeObject.material.map;a&&a.dispose();super.destructor()}}J=v(ya);class aa extends m{constructor(a){super(a);this.font="https://fonts.gstatic.com/s/materialicons/v36/flUhRq6tzZclQEJ-Vdg-IuiaDsNa.woff"}set icon(a){this.text=
a}set size(a){this.fontSize=a}}class za extends aa{constructor(a){super(a);this.justifyContent="center";this.fontSize="150%";this.onClick=a=>{this.onUpdate(!this.value)}}afterUpdate(){this.icon=this.value?"check_box":"check_box_outline_blank";super.afterUpdate()}}class Aa extends m{constructor(a){super(a);this.children={facade:m,borderRadius:"10%",backgroundColor:3355545,height:"100%",padding:[0,.02],alignItems:"center",justifyContent:"center",pointerStates:{hover:{backgroundColor:6710988}}}}afterUpdate(){this.children.text=
this.label||"Missing label";super.afterUpdate()}}let q=new e.Color,H=new e.Plane,ba=(new e.CylinderBufferGeometry(.5,.5,1,45)).translate(0,.5,0).rotateX(Math.PI/2).rotateZ(Math.PI/2),ca=K.createDerivedMaterial(new e.MeshBasicMaterial({side:2}),{uniforms:{maxValue:{value:1}},vertexDefs:"\nvarying vec3 vPos;\n",vertexMainIntro:"\nvPos = position;\n",fragmentDefs:"\nuniform float maxValue;\nvarying vec3 vPos;\n\n// From https://github.com/hughsk/glsl-hsv2rgb\nvec3 hsv2rgb(vec3 c) {\n vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n}\n\n",
fragmentColorTransform:"\nfloat angle = atan(vPos.y, vPos.x) / PI2;\nfloat radius = length(vPos.xy) * 2.0;\nfloat value = vPos.z * maxValue;\nvec3 hsv = vec3(angle, radius, value);\nvec3 rgb = hsv2rgb(hsv);\ngl_FragColor.xyz = rgb;\n"});class Ba extends t.Object3DFacade{constructor(a){super(a,new e.Mesh(ba,ca.clone()));this.maxValue=1}afterUpdate(){this.threeObject.material.uniforms.maxValue.value=this.maxValue;super.afterUpdate()}}class Ca extends t.Object3DFacade{constructor(a){let b=ca.clone();
b.transparent=!0;b.opacity=.5;b.side=e.BackSide;super(a,new e.Mesh(ba,b))}}class Da extends t.Object3DFacade{constructor(a){var b=(new e.SphereBufferGeometry(.05,16,12)).translate(0,0,.5);let c=(new e.CylinderBufferGeometry(.005,.005,.5,6)).translate(0,.25,0).rotateX(Math.PI/2),d=new e.MeshBasicMaterial;b=new e.Mesh(b,d);b.add(new e.Mesh(c,new e.MeshBasicMaterial({color:13421772})));super(a,b)}afterUpdate(){this.threeObject.material.color.set(this.color);super.afterUpdate()}}class Ea extends t.Object3DFacade{constructor(a){let b=
K.createDerivedMaterial(new e.MeshBasicMaterial({transparent:!0,color:16777215,polygonOffset:!0,polygonOffsetFactor:1}),{vertexDefs:"varying vec2 vUV;",vertexMainIntro:"vUV = uv;",fragmentDefs:"varying vec2 vUV;",fragmentColorTransform:"\n float dist = min(min(vUV.x, 1.0 - vUV.x), min(vUV.y, 1.0 - vUV.y));\n gl_FragColor.w *= 1.0 - 0.5 * smoothstep(0.0, 0.1, dist);\n "});super(a,new e.Mesh(new e.PlaneBufferGeometry,b))}afterUpdate(){this.threeObject.material.opacity=this.opacity;
super.afterUpdate()}}class Fa extends t.Group3DFacade{constructor(a){super(a);this.cylinderHeight=.5;this.cylinderDiameter=.75;this.rotateX=-Math.PI/4;a=a=>{var b=a.currentTarget.threeObject,d=a.ray;H.normal.set(0,0,-1);H.constant=1;H.applyMatrix4(b.matrixWorld);var f=d.intersectPlane(H,new e.Vector3);if(f){b.worldToLocal(f);d=2*f.x;f=2*f.y;for(b=Math.atan2(f,d)/Math.PI/2;0>b;)b+=1;d=Math.min(1,Math.sqrt(d*d+f*f));f=this._getHSV();f[0]=b;f[1]=d;this._updateHSV(f,a.shiftKey)}};this.onWheel=a=>{let b=
this._getHSV();b[2]=Math.max(0,Math.min(1,b[2]+a.nativeEvent.deltaY/100));this._updateHSV(b,!1)};this.children=[this.cylinderDef={key:"disc",facade:Ba,onMouseDown:a,onDragStart:a,onDrag:a},this.cylinderBgDef={facade:Ca,renderOrder:9},this.planeDef={facade:Ea,renderOrder:10,opacity:.3,pointerStates:{hover:{opacity:.4}},transition:{opacity:!0},onDragStart:a=>{this._dragData={plane:(new e.Plane).setFromNormalAndCoplanarPoint((new e.Vector3(0,1,0)).transformDirection(this.threeObject.matrixWorld),a.intersection.point)}},
onDrag:a=>{var {plane:b}=this._dragData;b=a.ray.intersectPlane(b,new e.Vector3);this.threeObject.worldToLocal(b);let d=this._getHSV();d[2]=Math.max(0,Math.min(1,b.z/this.cylinderHeight));this._updateHSV(d,a.shiftKey)},onDragEnd:a=>{this._dragData=null}},this.stickDef={facade:Da}]}_getHSV(){var a=[0,0,0];if(null!=this.value){q.set(this.value);{a=q.r;var b=q.g,c=q.b;let f,e;let g,h,k=Math.max(a,b,c);var d=k-Math.min(a,b,c);0===d?h=g=0:(h=d/k,f=(k-a)/6/d+.5,e=(k-b)/6/d+.5,d=(k-c)/6/d+.5,a===k?g=d-e:
b===k?g=1/3+f-d:c===k&&(g=2/3+e-f),0>g?g+=1:1<g&&--g);a=[g,h,k]}}return a}_updateHSV(a,b){a=ja(...a);q.setRGB(...a);b&&(q.r=Math.round(5*q.r)/5,q.g=Math.round(5*q.g)/5,q.b=Math.round(5*q.b)/5);this.onChange(q.getHex())}afterUpdate(){let {stickDef:a,cylinderDef:b,cylinderBgDef:c,planeDef:d,cylinderHeight:f,cylinderDiameter:e}=this,g=this._getHSV(),h=g[0]*Math.PI*2,k=g[1]/2*e,m=Math.sin(h)*k;a.x=Math.cos(h)*k;a.y=m;a.z=g[2]*f;a.color=this.value;b.maxValue=g[2];b.scale=e;b.scaleZ=g[2]*f+1E-5;c.scale=
e;c.scaleZ=f;d.z=g[2]*f;super.afterUpdate()}}let Ga=["mousedown","wheel"];class da extends m{constructor(a){super(a);this.popupContent=null;this._popupCt={key:"popup",facade:E.ParentFacade};this._onCloserEvent=a=>{a:{for(a=a.target;a;){if(a===this){a=!0;break a}a=a.parent}a=!1}a||this.closePopup()};this.openPopup=()=>{this.isPopupOpen||(this.isPopupOpen=!0,this.afterUpdate())};this.closePopup=()=>{this.isPopupOpen&&(this.isPopupOpen=!1,this.afterUpdate())}}getPopupContent(){return this.popupContent}set children(a){this._children=
[this._popupCt].concat(a)}get children(){return this._children}_toggleCloseListeners(a){let b=this.getSceneFacade();b&&Ga.forEach(c=>{b[(a?"add":"remove")+"EventListener"](c,this._onCloserEvent)})}afterUpdate(){let {isPopupOpen:a}=this;a!==this._wasPopupOpen&&(this._wasPopupOpen=a,this._toggleCloseListeners(a));this._popupCt.children=a?this.getPopupContent():null;super.afterUpdate()}destructor(){this._toggleCloseListeners(!1);super.destructor()}}let I=new e.Color;class Ha extends da{constructor(a){super(a);
this.flexDirection="row";this.alignItems="center";this.children=[this.swatchDef={facade:m,borderRadius:"10%",backgroundColor:null,height:"100%",width:"25%",onClick:this.openPopup},this.labelDef={facade:m,padding:.01}];this.popupContent=this.pickerDef={key:"picker",facade:Fa,visible:!1,onChange:this._onColorChange.bind(this),animation:{from:{scale:1E-10},to:{scale:1},duration:500,easing:"easeOutExpo"}}}_onColorChange(a){this.onUpdate(a)}afterUpdate(){let {swatchDef:a,labelDef:b,pickerDef:c,value:d,
offsetWidth:f,offsetHeight:e}=this;var g=null!=d;g&&I.set(d);a.backgroundColor=g?I.getHex():null;b.text=g?"#"+I.getHexString().toUpperCase():"(choose color)";f&&e&&(c.visible=!0,c.value=I.getHex(),g=7*e,c.scale=c.animation.to.scale=g,c.x=f+.75*g,c.y=-g/2-e);super.afterUpdate()}}class Ia extends m{constructor(a){super(a);this.flexDirection="row";this.minHeight=.01;this.backgroundColor=6710886;this.children=this._valChild={key:"slider",facade:m,backgroundColor:16777215,width:"0%"};this.onMouseDown=
this.onDragStart=this.onDrag=a=>{var b=this.min||0,d=this.max||0;d!==b&&a.intersection&&a.intersection.facade===this&&(b+=a.intersection.uv.x*(d-b),d=this.step||.001,b=Math.round(b/d)*d,b=+b.toFixed((d+"").replace(/^-?\d+\.?/,"").length),this.onChange(b),a.stopPropagation())}}afterUpdate(){let a=this.value||0,b=Math.min(this.min||0,a),c=Math.max(this.max||0,a);this._valChild.width=b===c?0:`${(a-b)/(c-b)*100}%`;super.afterUpdate()}}class Ja extends m{constructor(a){super(a);this.min=this.value=0;this.max=
1;this.step=.1;this.flexDirection="row";this.alignItems="center";this.children=[this._sliderChild={key:"slider",facade:Ia,flex:1,minWidth:.2,height:"100%",margin:[0,.01,0,0]},this._textChild={key:"text",facade:m,width:.05,text:"0"}]}afterUpdate(){this._textChild.text=this.value+"";let a=this._sliderChild;a.value=this.value||0;a.min=this.min||0;a.max=this.max||0;a.step=this.step;a.onChange=this.onUpdate;super.afterUpdate()}}class Ka extends da{constructor(a){super(a);this.position="relative";this.dropdownConfig=
null;this._onItemClick=a=>{this.onUpdate(a.target.value);this.closePopup()};this.children=[this._btnChild={key:"btn",facade:m,flexDirection:"row",alignItems:"center",justifyContent:"space-between",borderRadius:"10%",backgroundColor:3355545,height:"100%",padding:[0,.02],overflow:"hidden",pointerStates:{hover:{backgroundColor:6710988}},onClick:this.openPopup,children:["",{facade:aa,icon:"keyboard_arrow_down"}]}];this.popupContent={key:"menu",facade:m,position:"absolute",top:"100%",left:0,width:"100%",
backgroundColor:3355443,z:.01,maxHeight:.5,overflow:"scroll",flexDirection:"column",children:this._menuListDef={facade:E.ListFacade,data:null,template:{key:(a,c)=>c,facade:m,width:"100%",overflow:"hidden",whiteSpace:"nowrap",padding:.01,text:a=>a.label,value:a=>a.value,onClick:a=>this._onItemClick,backgroundColor:a=>a.selected?6710886:null,pointerStates:{hover:{backgroundColor:4473924}}}},animation:{from:{scale:.01},to:{scale:1},duration:300,easing:"easeOutExpo"}}}afterUpdate(){let a=null,b=this.options.reduce((b,
d)=>{if(d){const c={};d&&"object"===typeof d?(c.value=d.value,c.label="string"===typeof d.label?d.label:`${d.value}`):(c.value=d,c.label=d+"");c.value===this.value&&(c.selected=!0,a=c);b.push(c)}return b},[]);this._btnChild.children[0]=a?a.label:"[Select...]";Object.assign(this.popupContent,this.dropdownConfig);this._menuListDef.data=b;super.afterUpdate()}}let La={boolean:za,button:Aa,color:Ha,number:Ja,select:Ka};class Ma extends m{constructor(a){super(a);this.flexDirection="row";this.fontSize=.02;
this.itemHeight=.04;this.padding=[0,.02];this.backgroundColor=4473924;this.borderRadius=.01;this.alignItems="flex-start";this.data={}}_onItemUpdate(a,b){P["default"].set(this.data,a.path,b);this.onUpdate(this.data)}describeChildren(){return[{facade:m,flexDirection:"column",margin:[0,.03,0,0],children:(this.items||[]).map((a,b)=>a?{facade:m,text:"button"===a.type?null:a.label||a.path,height:a.height||this.itemHeight,margin:[b?0:.02,0,.02],flexDirection:"row",alignItems:"center"}:null)},{facade:m,flexDirection:"column",
minWidth:.2,children:(this.items||[]).map((a,b)=>{if(!a)return null;let c=a&&La[a.type];return c?E.utils.assign({key:a.path||b,facade:c,height:a.height||this.itemHeight,margin:[b?0:.02,0,.02],value:P["default"].get(this.data,a.path)},a,{onUpdate:b=>{a.onUpdate&&a.onUpdate.call(a,b);this._onItemUpdate(a,b)}}):{facade:m,text:`Unknown Type: ${a.type}`}})}]}}n.DatGuiFacade=Ma;n.UIBlock3DFacade=m;n.UIImage3DFacade=J;n.extendAsFlexNode=v;Object.defineProperty(n,"__esModule",{value:!0})})
{
"name": "troika-3d-ui",
"version": "0.42.0",
"version": "0.43.0",
"description": "Troika 3D User Interface Toolkit",

@@ -18,7 +18,7 @@ "author": "Jason Johnston <jason.johnston@protectwise.com>",

"object-path": "^0.11.4",
"troika-3d": "^0.42.0",
"troika-3d-text": "^0.42.0",
"troika-core": "^0.42.0",
"troika-flex-layout": "^0.42.0",
"troika-three-utils": "^0.42.0"
"troika-3d": "^0.43.0",
"troika-3d-text": "^0.43.0",
"troika-core": "^0.43.0",
"troika-flex-layout": "^0.43.0",
"troika-three-utils": "^0.43.0"
},

@@ -28,3 +28,3 @@ "peerDependencies": {

},
"gitHead": "0f7129cd43fc58f5c6a5f6f20f2d0941f9f36510"
"gitHead": "497fa534d015bc8f746c7d00ec7bfde1df92f491"
}

@@ -0,0 +0,0 @@ # `troika-3d-ui`

@@ -0,0 +0,0 @@ import Icon from '../widgets/MaterialIconFacade.js'

@@ -0,0 +0,0 @@ import UIBlock3DFacade from '../UIBlock3DFacade.js'

@@ -0,0 +0,0 @@ import UIBlock3DFacade from '../UIBlock3DFacade.js'

@@ -0,0 +0,0 @@ import { utils } from 'troika-core'

@@ -0,0 +0,0 @@ import UIBlock3DFacade from '../UIBlock3DFacade.js'

@@ -0,0 +0,0 @@ import { ListFacade } from 'troika-core'

@@ -0,0 +0,0 @@ import { ParentFacade } from 'troika-core'

@@ -0,0 +0,0 @@ import { Object3DFacade, ParentFacade } from 'troika-3d'

@@ -0,0 +0,0 @@ import { Mesh, Vector2, Vector3, Vector4, PlaneBufferGeometry, Sphere, Matrix4, Plane } from 'three'

@@ -0,0 +0,0 @@ import { Instanceable3DFacade } from 'troika-3d'

@@ -0,0 +0,0 @@ import { createDerivedMaterial } from 'troika-3d'

@@ -0,0 +0,0 @@ import { extendAsFlexNode } from '../flex-layout/FlexNode.js'

@@ -0,0 +0,0 @@ import { extendAsFlexNode } from '../flex-layout/FlexNode.js'

@@ -0,0 +0,0 @@ import { Group3DFacade, Object3DFacade } from 'troika-3d'

@@ -0,0 +0,0 @@ import UIBlock3DFacade from '../UIBlock3DFacade.js'

@@ -0,0 +0,0 @@ import UIBlock3DFacade from '../UIBlock3DFacade.js'

@@ -0,0 +0,0 @@ import { requestFlexLayout } from 'troika-flex-layout'

@@ -0,0 +0,0 @@ // 3D UI exports

@@ -0,0 +0,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc