=h||C){y={cp:x,segment:S};break}}if(y)break}var w=y.cp,E=y.segment,M=(h-g)/E.length,L=E.t1-E.t0,D=v?E.t0+L*M:E.t1-L*M;D=hn(0,D,1),e=Pr(w.p0,w.p1,w.p2,D),d=tm(w.p0,w.p1,w.p2,D);break}case"straight":case"segments":case"haystack":{for(var P=0,k,A,B,_,N=n.allpts.length,I=0;I+3=h));I+=2);var R=h-A,z=R/k;z=hn(0,z,1),e=yp(B,_,z),d=Hu(B,_);break}}o("labelX",c,e.x),o("labelY",c,e.y),o("labelAutoAngle",c,d)}};s("source"),s("target"),this.applyLabelDimensions(t)}};Mt.applyLabelDimensions=function(t){this.applyPrefixedLabelDimensions(t),t.isEdge()&&(this.applyPrefixedLabelDimensions(t,"source"),this.applyPrefixedLabelDimensions(t,"target"))};Mt.applyPrefixedLabelDimensions=function(t,e){var r=t._private,n=this.getLabelText(t,e),a=this.calculateLabelDimensions(t,n),i=t.pstyle("line-height").pfValue,o=t.pstyle("text-wrap").strValue,l=Et(r.rscratch,"labelWrapCachedLines",e)||[],u=o!=="wrap"?1:Math.max(l.length,1),s=a.height/u,f=s*i,c=a.width,d=a.height+(u-1)*(i-1)*s;Gt(r.rstyle,"labelWidth",e,c),Gt(r.rscratch,"labelWidth",e,c),Gt(r.rstyle,"labelHeight",e,d),Gt(r.rscratch,"labelHeight",e,d),Gt(r.rscratch,"labelLineHeight",e,f)};Mt.getLabelText=function(t,e){var r=t._private,n=e?e+"-":"",a=t.pstyle(n+"label").strValue,i=t.pstyle("text-transform").value,o=function(R,z){return z?(Gt(r.rscratch,R,e,z),z):Et(r.rscratch,R,e)};if(!a)return"";i=="none"||(i=="uppercase"?a=a.toUpperCase():i=="lowercase"&&(a=a.toLowerCase()));var l=t.pstyle("text-wrap").value;if(l==="wrap"){var u=o("labelKey");if(u!=null&&o("labelWrapKey")===u)return o("labelWrapCachedText");for(var s="",f=a.split(` -`),c=t.pstyle("text-max-width").pfValue,d=t.pstyle("text-overflow-wrap").value,v=d==="anywhere",h=[],p=/[\s\u200b]+/,y=v?"":" ",g=0;g c){for(var S=b.split(p),C="",w=0;w P)break;k+=a[_],_===a.length-1&&(B=!0)}return B||(k+=A),k}return a};Mt.getLabelJustification=function(t){var e=t.pstyle("text-justification").strValue,r=t.pstyle("text-halign").strValue;if(e==="auto")if(t.isNode())switch(r){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return e};Mt.calculateLabelDimensions=function(t,e){var r=this,n=sr(e,t._private.labelDimsKey),a=r.labelDimCache||(r.labelDimCache=[]),i=a[n];if(i!=null)return i;var o=0,l=t.pstyle("font-style").strValue,u=t.pstyle("font-size").pfValue,s=t.pstyle("font-family").strValue,f=t.pstyle("font-weight").strValue,c=this.labelCalcCanvas,d=this.labelCalcCanvasContext;if(!c){c=this.labelCalcCanvas=document.createElement("canvas"),d=this.labelCalcCanvasContext=c.getContext("2d");var v=c.style;v.position="absolute",v.left="-9999px",v.top="-9999px",v.zIndex="-1",v.visibility="hidden",v.pointerEvents="none"}d.font="".concat(l," ").concat(f," ").concat(u,"px ").concat(s);for(var h=0,p=0,y=e.split(` -`),g=0;g 1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(o),l)for(var u=0;u =t.desktopTapThreshold2}var At=n(O);Ye&&(t.hoverData.tapholdCancelled=!0);var $t=function(){var St=t.hoverData.dragDelta=t.hoverData.dragDelta||[];St.length===0?(St.push(xe[0]),St.push(xe[1])):(St[0]+=xe[0],St[1]+=xe[1])};ee=!0,r(be,["mousemove","vmousemove","tapdrag"],O,{x:re[0],y:re[1]});var pr=function(){t.data.bgActivePosistion=void 0,t.hoverData.selecting||Z.emit({originalEvent:O,type:"boxstart",position:{x:re[0],y:re[1]}}),Le[4]=1,t.hoverData.selecting=!0,t.redrawHint("select",!0),t.redraw()};if(t.hoverData.which===3){if(Ye){var er={originalEvent:O,type:"cxtdrag",position:{x:re[0],y:re[1]}};ye?ye.emit(er):Z.emit(er),t.hoverData.cxtDragged=!0,(!t.hoverData.cxtOver||be!==t.hoverData.cxtOver)&&(t.hoverData.cxtOver&&t.hoverData.cxtOver.emit({originalEvent:O,type:"cxtdragout",position:{x:re[0],y:re[1]}}),t.hoverData.cxtOver=be,be&&be.emit({originalEvent:O,type:"cxtdragover",position:{x:re[0],y:re[1]}}))}}else if(t.hoverData.dragging){if(ee=!0,Z.panningEnabled()&&Z.userPanningEnabled()){var gr;if(t.hoverData.justStartedPan){var Nn=t.hoverData.mdownPos;gr={x:(re[0]-Nn[0])*Q,y:(re[1]-Nn[1])*Q},t.hoverData.justStartedPan=!1}else gr={x:xe[0]*Q,y:xe[1]*Q};Z.panBy(gr),Z.emit("dragpan"),t.hoverData.dragged=!0}re=t.projectIntoViewport(O.clientX,O.clientY)}else if(Le[4]==1&&(ye==null||ye.pannable())){if(Ye){if(!t.hoverData.dragging&&Z.boxSelectionEnabled()&&(At||!Z.panningEnabled()||!Z.userPanningEnabled()))pr();else if(!t.hoverData.selecting&&Z.panningEnabled()&&Z.userPanningEnabled()){var tr=a(ye,t.hoverData.downs);tr&&(t.hoverData.dragging=!0,t.hoverData.justStartedPan=!0,Le[4]=0,t.data.bgActivePosistion=Tr(ce),t.redrawHint("select",!0),t.redraw())}ye&&ye.pannable()&&ye.active()&&ye.unactivate()}}else{if(ye&&ye.pannable()&&ye.active()&&ye.unactivate(),(!ye||!ye.grabbed())&&be!=Te&&(Te&&r(Te,["mouseout","tapdragout"],O,{x:re[0],y:re[1]}),be&&r(be,["mouseover","tapdragover"],O,{x:re[0],y:re[1]}),t.hoverData.last=be),ye)if(Ye){if(Z.boxSelectionEnabled()&&At)ye&&ye.grabbed()&&(p(Re),ye.emit("freeon"),Re.emit("free"),t.dragData.didDrag&&(ye.emit("dragfreeon"),Re.emit("dragfree"))),pr();else if(ye&&ye.grabbed()&&t.nodeIsDraggable(ye)){var st=!t.dragData.didDrag;st&&t.redrawHint("eles",!0),t.dragData.didDrag=!0,t.hoverData.draggingEles||v(Re,{inDragLayer:!0});var je={x:0,y:0};if(se(xe[0])&&se(xe[1])&&(je.x+=xe[0],je.y+=xe[1],st)){var ut=t.hoverData.dragDelta;ut&&se(ut[0])&&se(ut[1])&&(je.x+=ut[0],je.y+=ut[1])}t.hoverData.draggingEles=!0,Re.silentShift(je).emit("position drag"),t.redrawHint("drag",!0),t.redraw()}}else $t();ee=!0}if(Le[2]=re[0],Le[3]=re[1],ee)return O.stopPropagation&&O.stopPropagation(),O.preventDefault&&O.preventDefault(),!1}},!1);var E,M,L;t.registerBinding(window,"mouseup",function(O){var Y=t.hoverData.capture;if(Y){t.hoverData.capture=!1;var ee=t.cy,Z=t.projectIntoViewport(O.clientX,O.clientY),Q=t.selection,ge=t.findNearestElement(Z[0],Z[1],!0,!1),re=t.dragData.possibleDragElements,ce=t.hoverData.down,we=n(O);if(t.data.bgActivePosistion&&(t.redrawHint("select",!0),t.redraw()),t.hoverData.tapholdCancelled=!0,t.data.bgActivePosistion=void 0,ce&&ce.unactivate(),t.hoverData.which===3){var Le={originalEvent:O,type:"cxttapend",position:{x:Z[0],y:Z[1]}};if(ce?ce.emit(Le):ee.emit(Le),!t.hoverData.cxtDragged){var be={originalEvent:O,type:"cxttap",position:{x:Z[0],y:Z[1]}};ce?ce.emit(be):ee.emit(be)}t.hoverData.cxtDragged=!1,t.hoverData.which=null}else if(t.hoverData.which===1){if(r(ge,["mouseup","tapend","vmouseup"],O,{x:Z[0],y:Z[1]}),!t.dragData.didDrag&&!t.hoverData.dragged&&!t.hoverData.selecting&&!t.hoverData.isOverThresholdDrag&&(r(ce,["click","tap","vclick"],O,{x:Z[0],y:Z[1]}),M=!1,O.timeStamp-L<=ee.multiClickDebounceTime()?(E&&clearTimeout(E),M=!0,L=null,r(ce,["dblclick","dbltap","vdblclick"],O,{x:Z[0],y:Z[1]})):(E=setTimeout(function(){M||r(ce,["oneclick","onetap","voneclick"],O,{x:Z[0],y:Z[1]})},ee.multiClickDebounceTime()),L=O.timeStamp)),ce==null&&!t.dragData.didDrag&&!t.hoverData.selecting&&!t.hoverData.dragged&&!n(O)&&(ee.$(e).unselect(["tapunselect"]),re.length>0&&t.redrawHint("eles",!0),t.dragData.possibleDragElements=re=ee.collection()),ge==ce&&!t.dragData.didDrag&&!t.hoverData.selecting&&ge!=null&&ge._private.selectable&&(t.hoverData.dragging||(ee.selectionType()==="additive"||we?ge.selected()?ge.unselect(["tapunselect"]):ge.select(["tapselect"]):we||(ee.$(e).unmerge(ge).unselect(["tapunselect"]),ge.select(["tapselect"]))),t.redrawHint("eles",!0)),t.hoverData.selecting){var Te=ee.collection(t.getAllInBox(Q[0],Q[1],Q[2],Q[3]));t.redrawHint("select",!0),Te.length>0&&t.redrawHint("eles",!0),ee.emit({type:"boxend",originalEvent:O,position:{x:Z[0],y:Z[1]}});var ye=function(Ye){return Ye.selectable()&&!Ye.selected()};ee.selectionType()==="additive"||we||ee.$(e).unmerge(Te).unselect(),Te.emit("box").stdFilter(ye).select().emit("boxselect"),t.redraw()}if(t.hoverData.dragging&&(t.hoverData.dragging=!1,t.redrawHint("select",!0),t.redrawHint("eles",!0),t.redraw()),!Q[4]){t.redrawHint("drag",!0),t.redrawHint("eles",!0);var xe=ce&&ce.grabbed();p(re),xe&&(ce.emit("freeon"),re.emit("free"),t.dragData.didDrag&&(ce.emit("dragfreeon"),re.emit("dragfree")))}}Q[4]=0,t.hoverData.down=null,t.hoverData.cxtStarted=!1,t.hoverData.draggingEles=!1,t.hoverData.selecting=!1,t.hoverData.isOverThresholdDrag=!1,t.dragData.didDrag=!1,t.hoverData.dragged=!1,t.hoverData.dragDelta=[],t.hoverData.mdownPos=null,t.hoverData.mdownGPos=null}},!1);var D=function(O){if(!t.scrollingPage){var Y=t.cy,ee=Y.zoom(),Z=Y.pan(),Q=t.projectIntoViewport(O.clientX,O.clientY),ge=[Q[0]*ee+Z.x,Q[1]*ee+Z.y];if(t.hoverData.draggingEles||t.hoverData.dragging||t.hoverData.cxtStarted||C()){O.preventDefault();return}if(Y.panningEnabled()&&Y.userPanningEnabled()&&Y.zoomingEnabled()&&Y.userZoomingEnabled()){O.preventDefault(),t.data.wheelZooming=!0,clearTimeout(t.data.wheelTimeout),t.data.wheelTimeout=setTimeout(function(){t.data.wheelZooming=!1,t.redrawHint("eles",!0),t.redraw()},150);var re;O.deltaY!=null?re=O.deltaY/-250:O.wheelDeltaY!=null?re=O.wheelDeltaY/1e3:re=O.wheelDelta/1e3,re=re*t.wheelSensitivity;var ce=O.deltaMode===1;ce&&(re*=33);var we=Y.zoom()*Math.pow(10,re);O.type==="gesturechange"&&(we=t.gestureStartZoom*O.scale),Y.zoom({level:we,renderedPosition:{x:ge[0],y:ge[1]}}),Y.emit(O.type==="gesturechange"?"pinchzoom":"scrollzoom")}}};t.registerBinding(t.container,"wheel",D,!0),t.registerBinding(window,"scroll",function(O){t.scrollingPage=!0,clearTimeout(t.scrollingPageTimeout),t.scrollingPageTimeout=setTimeout(function(){t.scrollingPage=!1},250)},!0),t.registerBinding(t.container,"gesturestart",function(O){t.gestureStartZoom=t.cy.zoom(),t.hasTouchStarted||O.preventDefault()},!0),t.registerBinding(t.container,"gesturechange",function(te){t.hasTouchStarted||D(te)},!0),t.registerBinding(t.container,"mouseout",function(O){var Y=t.projectIntoViewport(O.clientX,O.clientY);t.cy.emit({originalEvent:O,type:"mouseout",position:{x:Y[0],y:Y[1]}})},!1),t.registerBinding(t.container,"mouseover",function(O){var Y=t.projectIntoViewport(O.clientX,O.clientY);t.cy.emit({originalEvent:O,type:"mouseover",position:{x:Y[0],y:Y[1]}})},!1);var P,k,A,B,_,N,I,R,z,$,H,G,V,q=function(O,Y,ee,Z){return Math.sqrt((ee-O)*(ee-O)+(Z-Y)*(Z-Y))},F=function(O,Y,ee,Z){return(ee-O)*(ee-O)+(Z-Y)*(Z-Y)},X;t.registerBinding(t.container,"touchstart",X=function(O){if(t.hasTouchStarted=!0,!!w(O)){g(),t.touchData.capture=!0,t.data.bgActivePosistion=void 0;var Y=t.cy,ee=t.touchData.now,Z=t.touchData.earlier;if(O.touches[0]){var Q=t.projectIntoViewport(O.touches[0].clientX,O.touches[0].clientY);ee[0]=Q[0],ee[1]=Q[1]}if(O.touches[1]){var Q=t.projectIntoViewport(O.touches[1].clientX,O.touches[1].clientY);ee[2]=Q[0],ee[3]=Q[1]}if(O.touches[2]){var Q=t.projectIntoViewport(O.touches[2].clientX,O.touches[2].clientY);ee[4]=Q[0],ee[5]=Q[1]}if(O.touches[1]){t.touchData.singleTouchMoved=!0,p(t.dragData.touchDragEles);var ge=t.findContainerClientCoords();z=ge[0],$=ge[1],H=ge[2],G=ge[3],P=O.touches[0].clientX-z,k=O.touches[0].clientY-$,A=O.touches[1].clientX-z,B=O.touches[1].clientY-$,V=0<=P&&P<=H&&0<=A&&A<=H&&0<=k&&k<=G&&0<=B&&B<=G;var re=Y.pan(),ce=Y.zoom();_=q(P,k,A,B),N=F(P,k,A,B),I=[(P+A)/2,(k+B)/2],R=[(I[0]-re.x)/ce,(I[1]-re.y)/ce];var we=200,Le=we*we;if(N =1){for(var mt=t.touchData.startPosition=[],Ke=0;Ke =t.touchTapThreshold2}if(Y&&t.touchData.cxt){O.preventDefault();var mt=O.touches[0].clientX-z,Ke=O.touches[0].clientY-$,ht=O.touches[1].clientX-z,at=O.touches[1].clientY-$,At=F(mt,Ke,ht,at),$t=At/N,pr=150,er=pr*pr,gr=1.5,Nn=gr*gr;if($t>=Nn||At>=er){t.touchData.cxt=!1,t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var tr={originalEvent:O,type:"cxttapend",position:{x:Q[0],y:Q[1]}};t.touchData.start?(t.touchData.start.unactivate().emit(tr),t.touchData.start=null):Z.emit(tr)}}if(Y&&t.touchData.cxt){var tr={originalEvent:O,type:"cxtdrag",position:{x:Q[0],y:Q[1]}};t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.touchData.start?t.touchData.start.emit(tr):Z.emit(tr),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxtDragged=!0;var st=t.findNearestElement(Q[0],Q[1],!0,!0);(!t.touchData.cxtOver||st!==t.touchData.cxtOver)&&(t.touchData.cxtOver&&t.touchData.cxtOver.emit({originalEvent:O,type:"cxtdragout",position:{x:Q[0],y:Q[1]}}),t.touchData.cxtOver=st,st&&st.emit({originalEvent:O,type:"cxtdragover",position:{x:Q[0],y:Q[1]}}))}else if(Y&&O.touches[2]&&Z.boxSelectionEnabled())O.preventDefault(),t.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,t.touchData.selecting||Z.emit({originalEvent:O,type:"boxstart",position:{x:Q[0],y:Q[1]}}),t.touchData.selecting=!0,t.touchData.didSelect=!0,ee[4]=1,!ee||ee.length===0||ee[0]===void 0?(ee[0]=(Q[0]+Q[2]+Q[4])/3,ee[1]=(Q[1]+Q[3]+Q[5])/3,ee[2]=(Q[0]+Q[2]+Q[4])/3+1,ee[3]=(Q[1]+Q[3]+Q[5])/3+1):(ee[2]=(Q[0]+Q[2]+Q[4])/3,ee[3]=(Q[1]+Q[3]+Q[5])/3),t.redrawHint("select",!0),t.redraw();else if(Y&&O.touches[1]&&!t.touchData.didSelect&&Z.zoomingEnabled()&&Z.panningEnabled()&&Z.userZoomingEnabled()&&Z.userPanningEnabled()){O.preventDefault(),t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var je=t.dragData.touchDragEles;if(je){t.redrawHint("drag",!0);for(var ut=0;ut 0&&!t.hoverData.draggingEles&&!t.swipePanning&&t.data.bgActivePosistion!=null&&(t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.redraw())}},!1);var U;t.registerBinding(window,"touchcancel",U=function(O){var Y=t.touchData.start;t.touchData.capture=!1,Y&&Y.unactivate()});var K,ne,ae,J;if(t.registerBinding(window,"touchend",K=function(O){var Y=t.touchData.start,ee=t.touchData.capture;if(ee)O.touches.length===0&&(t.touchData.capture=!1),O.preventDefault();else return;var Z=t.selection;t.swipePanning=!1,t.hoverData.draggingEles=!1;var Q=t.cy,ge=Q.zoom(),re=t.touchData.now,ce=t.touchData.earlier;if(O.touches[0]){var we=t.projectIntoViewport(O.touches[0].clientX,O.touches[0].clientY);re[0]=we[0],re[1]=we[1]}if(O.touches[1]){var we=t.projectIntoViewport(O.touches[1].clientX,O.touches[1].clientY);re[2]=we[0],re[3]=we[1]}if(O.touches[2]){var we=t.projectIntoViewport(O.touches[2].clientX,O.touches[2].clientY);re[4]=we[0],re[5]=we[1]}Y&&Y.unactivate();var Le;if(t.touchData.cxt){if(Le={originalEvent:O,type:"cxttapend",position:{x:re[0],y:re[1]}},Y?Y.emit(Le):Q.emit(Le),!t.touchData.cxtDragged){var be={originalEvent:O,type:"cxttap",position:{x:re[0],y:re[1]}};Y?Y.emit(be):Q.emit(be)}t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!1,t.touchData.start=null,t.redraw();return}if(!O.touches[2]&&Q.boxSelectionEnabled()&&t.touchData.selecting){t.touchData.selecting=!1;var Te=Q.collection(t.getAllInBox(Z[0],Z[1],Z[2],Z[3]));Z[0]=void 0,Z[1]=void 0,Z[2]=void 0,Z[3]=void 0,Z[4]=0,t.redrawHint("select",!0),Q.emit({type:"boxend",originalEvent:O,position:{x:re[0],y:re[1]}});var ye=function(er){return er.selectable()&&!er.selected()};Te.emit("box").stdFilter(ye).select().emit("boxselect"),Te.nonempty()&&t.redrawHint("eles",!0),t.redraw()}if(Y?.unactivate(),O.touches[2])t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);else if(!O.touches[1]){if(!O.touches[0]){if(!O.touches[0]){t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var xe=t.dragData.touchDragEles;if(Y!=null){var Re=Y._private.grabbed;p(xe),t.redrawHint("drag",!0),t.redrawHint("eles",!0),Re&&(Y.emit("freeon"),xe.emit("free"),t.dragData.didDrag&&(Y.emit("dragfreeon"),xe.emit("dragfree"))),r(Y,["touchend","tapend","vmouseup","tapdragout"],O,{x:re[0],y:re[1]}),Y.unactivate(),t.touchData.start=null}else{var Ye=t.findNearestElement(re[0],re[1],!0,!0);r(Ye,["touchend","tapend","vmouseup","tapdragout"],O,{x:re[0],y:re[1]})}var yt=t.touchData.startPosition[0]-re[0],mt=yt*yt,Ke=t.touchData.startPosition[1]-re[1],ht=Ke*Ke,at=mt+ht,At=at*ge*ge;t.touchData.singleTouchMoved||(Y||Q.$(":selected").unselect(["tapunselect"]),r(Y,["tap","vclick"],O,{x:re[0],y:re[1]}),ne=!1,O.timeStamp-J<=Q.multiClickDebounceTime()?(ae&&clearTimeout(ae),ne=!0,J=null,r(Y,["dbltap","vdblclick"],O,{x:re[0],y:re[1]})):(ae=setTimeout(function(){ne||r(Y,["onetap","voneclick"],O,{x:re[0],y:re[1]})},Q.multiClickDebounceTime()),J=O.timeStamp)),Y!=null&&!t.dragData.didDrag&&Y._private.selectable&&At "u"){var j=[],ue=function(O){return{clientX:O.clientX,clientY:O.clientY,force:1,identifier:O.pointerId,pageX:O.pageX,pageY:O.pageY,radiusX:O.width/2,radiusY:O.height/2,screenX:O.screenX,screenY:O.screenY,target:O.target}},oe=function(O){return{event:O,touch:ue(O)}},ie=function(O){j.push(oe(O))},le=function(O){for(var Y=0;Y 0)return z[0]}return null},v=Object.keys(c),h=0;h 0?d:ru(i,o,e,r,n,a,l)},checkPoint:function(e,r,n,a,i,o,l){var u=Tn(a,i),s=2*u;if(It(e,r,this.points,o,l,a,i-s,[0,-1],n)||It(e,r,this.points,o,l,a-s,i,[0,-1],n))return!0;var f=a/2+2*n,c=i/2+2*n,d=[o-f,l-c,o-f,l,o+f,l,o+f,l-c];return!!(ft(e,r,d)||or(e,r,s,s,o+a/2-u,l+i/2-u,n)||or(e,r,s,s,o-a/2+u,l+i/2-u,n))}}};zt.registerNodeShapes=function(){var t=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",it(3,0)),this.generateRoundPolygon("round-triangle",it(3,0)),this.generatePolygon("rectangle",it(4,0)),t.square=t.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var r=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",r),this.generateRoundPolygon("round-diamond",r)}this.generatePolygon("pentagon",it(5,0)),this.generateRoundPolygon("round-pentagon",it(5,0)),this.generatePolygon("hexagon",it(6,0)),this.generateRoundPolygon("round-hexagon",it(6,0)),this.generatePolygon("heptagon",it(7,0)),this.generateRoundPolygon("round-heptagon",it(7,0)),this.generatePolygon("octagon",it(8,0)),this.generateRoundPolygon("round-octagon",it(8,0));var n=new Array(20);{var a=ti(5,0),i=ti(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var l=0;l =e.deqFastCost*x)break}else if(s){if(b>=e.deqCost*v||b>=e.deqAvgCost*d)break}else if(m>=e.deqNoDrawCost*Ua)break;var T=e.deq(n,y,p);if(T.length>0)for(var S=0;S 0&&(e.onDeqd(n,h),!s&&e.shouldRedraw(n,h,y,p)&&i())},l=e.priority||Si;a.beforeRender(o,l(n))}}}},nm=function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:la;bi(this,t),this.idsByKey=new Dt,this.keyForId=new Dt,this.cachesByLvl=new Dt,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=r}return xi(t,[{key:"getIdsFor",value:function(r){r==null&&Fe("Can not get id list for null key");var n=this.idsByKey,a=this.idsByKey.get(r);return a||(a=new zr,n.set(r,a)),a}},{key:"addIdForKey",value:function(r,n){r!=null&&this.getIdsFor(r).add(n)}},{key:"deleteIdForKey",value:function(r,n){r!=null&&this.getIdsFor(r).delete(n)}},{key:"getNumberOfIdsForKey",value:function(r){return r==null?0:this.getIdsFor(r).size}},{key:"updateKeyMappingFor",value:function(r){var n=r.id(),a=this.keyForId.get(n),i=this.getKey(r);this.deleteIdForKey(a,n),this.addIdForKey(i,n),this.keyForId.set(n,i)}},{key:"deleteKeyMappingFor",value:function(r){var n=r.id(),a=this.keyForId.get(n);this.deleteIdForKey(a,n),this.keyForId.delete(n)}},{key:"keyHasChangedFor",value:function(r){var n=r.id(),a=this.keyForId.get(n),i=this.getKey(r);return a!==i}},{key:"isInvalid",value:function(r){return this.keyHasChangedFor(r)||this.doesEleInvalidateKey(r)}},{key:"getCachesAt",value:function(r){var n=this.cachesByLvl,a=this.lvls,i=n.get(r);return i||(i=new Dt,n.set(r,i),a.push(r)),i}},{key:"getCache",value:function(r,n){return this.getCachesAt(n).get(r)}},{key:"get",value:function(r,n){var a=this.getKey(r),i=this.getCache(a,n);return i!=null&&this.updateKeyMappingFor(r),i}},{key:"getForCachedKey",value:function(r,n){var a=this.keyForId.get(r.id()),i=this.getCache(a,n);return i}},{key:"hasCache",value:function(r,n){return this.getCachesAt(n).has(r)}},{key:"has",value:function(r,n){var a=this.getKey(r);return this.hasCache(a,n)}},{key:"setCache",value:function(r,n,a){a.key=r,this.getCachesAt(n).set(r,a)}},{key:"set",value:function(r,n,a){var i=this.getKey(r);this.setCache(i,n,a),this.updateKeyMappingFor(r)}},{key:"deleteCache",value:function(r,n){this.getCachesAt(n).delete(r)}},{key:"delete",value:function(r,n){var a=this.getKey(r);this.deleteCache(a,n)}},{key:"invalidateKey",value:function(r){var n=this;this.lvls.forEach(function(a){return n.deleteCache(r,a)})}},{key:"invalidate",value:function(r){var n=r.id(),a=this.keyForId.get(n);this.deleteKeyMappingFor(r);var i=this.doesEleInvalidateKey(r);return i&&this.invalidateKey(a),i||this.getNumberOfIdsForKey(a)===0}}]),t}(),ts=25,Xn=50,ia=-4,li=3,am=7.99,im=8,om=1024,sm=1024,um=1024,lm=.2,fm=.8,cm=10,dm=.15,vm=.1,hm=.9,pm=.9,gm=100,ym=1,Dr={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},mm=Qe({getKey:null,doesEleInvalidateKey:la,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:Us,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),sn=function(e,r){var n=this;n.renderer=e,n.onDequeues=[];var a=mm(r);he(n,a),n.lookup=new nm(a.getKey,a.doesEleInvalidateKey),n.setupDequeueing()},Ge=sn.prototype;Ge.reasons=Dr;Ge.getTextureQueue=function(t){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[t]=e.eleImgCaches[t]||[]};Ge.getRetiredTextureQueue=function(t){var e=this,r=e.eleImgCaches.retired=e.eleImgCaches.retired||{},n=r[t]=r[t]||[];return n};Ge.getElementQueue=function(){var t=this,e=t.eleCacheQueue=t.eleCacheQueue||new Cn.default(function(r,n){return n.reqs-r.reqs});return e};Ge.getElementKeyToQueue=function(){var t=this,e=t.eleKeyToCacheQueue=t.eleKeyToCacheQueue||{};return e};Ge.getElement=function(t,e,r,n,a){var i=this,o=this.renderer,l=o.cy.zoom(),u=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!t.visible()||t.removed()||!i.allowEdgeTxrCaching&&t.isEdge()||!i.allowParentTxrCaching&&t.isParent())return null;if(n==null&&(n=Math.ceil(Ti(l*r))),n =am||n>li)return null;var s=Math.pow(2,n),f=e.h*s,c=e.w*s,d=o.eleTextBiggerThanMin(t,s);if(!this.isVisible(t,d))return null;var v=u.get(t,n);if(v&&v.invalidated&&(v.invalidated=!1,v.texture.invalidatedWidth-=v.width),v)return v;var h;if(f<=ts?h=ts:f<=Xn?h=Xn:h=Math.ceil(f/Xn)*Xn,f>um||c>sm)return null;var p=i.getTextureQueue(h),y=p[p.length-2],g=function(){return i.recycleTexture(h,c)||i.addTexture(h,c)};y||(y=p[p.length-1]),y||(y=g()),y.width-y.usedWidth n;L--)E=i.getElement(t,e,r,L,Dr.downscale);M()}else return i.queueElement(t,S.level-1),S;else{var D;if(!m&&!x&&!T)for(var P=n-1;P>=ia;P--){var k=u.get(t,P);if(k){D=k;break}}if(b(D))return i.queueElement(t,n),D;y.context.translate(y.usedWidth,0),y.context.scale(s,s),this.drawElement(y.context,t,e,d,!1),y.context.scale(1/s,1/s),y.context.translate(-y.usedWidth,0)}return v={x:y.usedWidth,texture:y,level:n,scale:s,width:c,height:f,scaledLabelShown:d},y.usedWidth+=Math.ceil(c+im),y.eleCaches.push(v),u.set(t,n,v),i.checkTextureFullness(y),v};Ge.invalidateElements=function(t){for(var e=0;e =lm*t.width&&this.retireTexture(t)};Ge.checkTextureFullness=function(t){var e=this,r=e.getTextureQueue(t.height);t.usedWidth/t.width>fm&&t.fullnessChecks>=cm?Xt(r,t):t.fullnessChecks++};Ge.retireTexture=function(t){var e=this,r=t.height,n=e.getTextureQueue(r),a=this.lookup;Xt(n,t),t.retired=!0;for(var i=t.eleCaches,o=0;o =e)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,ki(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),Xt(a,o),n.push(o),o}};Ge.queueElement=function(t,e){var r=this,n=r.getElementQueue(),a=r.getElementKeyToQueue(),i=this.getKey(t),o=a[i];if(o)o.level=Math.max(o.level,e),o.eles.merge(t),o.reqs++,n.updateItem(o);else{var l={eles:t.spawn().merge(t),level:e,reqs:1,key:i};n.push(l),a[i]=l}};Ge.dequeue=function(t){for(var e=this,r=e.getElementQueue(),n=e.getElementKeyToQueue(),a=[],i=e.lookup,o=0;o 0;o++){var l=r.pop(),u=l.key,s=l.eles[0],f=i.hasCache(s,l.level);if(n[u]=null,f)continue;a.push(l);var c=e.getBoundingBox(s);e.getElement(s,c,t,l.level,Dr.dequeue)}return a};Ge.removeFromQueue=function(t){var e=this,r=e.getElementQueue(),n=e.getElementKeyToQueue(),a=this.getKey(t),i=n[a];i!=null&&(i.eles.length===1?(i.reqs=Ci,r.updateItem(i),r.pop(),n[a]=null):i.eles.unmerge(t))};Ge.onDequeue=function(t){this.onDequeues.push(t)};Ge.offDequeue=function(t){Xt(this.onDequeues,t)};Ge.setupDequeueing=Uu.setupDequeueing({deqRedrawThreshold:gm,deqCost:dm,deqAvgCost:vm,deqNoDrawCost:hm,deqFastCost:pm,deq:function(e,r,n){return e.dequeue(r,n)},onDeqd:function(e,r){for(var n=0;n =xm||r>pa)return null}n.validateLayersElesOrdering(r,t);var u=n.layersByLevel,s=Math.pow(2,r),f=u[r]=u[r]||[],c,d=n.levelIsComplete(r,t),v,h=function(){var M=function(A){if(n.validateLayersElesOrdering(A,t),n.levelIsComplete(A,t))return v=u[A],!0},L=function(A){if(!v)for(var B=r+A;ln<=B&&B<=pa&&!M(B);B+=A);};L(1),L(-1);for(var D=f.length-1;D>=0;D--){var P=f[D];P.invalid&&Xt(f,P)}};if(!d)h();else return f;var p=function(){if(!c){c=ct();for(var M=0;M Pm)return null;var P=n.makeLayer(c,r);if(L!=null){var k=f.indexOf(L)+1;f.splice(k,0,P)}else(M.insert===void 0||M.insert)&&f.unshift(P);return P};if(n.skipping&&!l)return null;for(var g=null,b=t.length/bm,m=!l,x=0;x =b||!tu(g.bb,T.boundingBox()))&&(g=y({insert:!0,after:g}),!g))return null;v||m?n.queueLayer(g,T):n.drawEleInLayer(g,T,r,e),g.eles.push(T),C[r]=g}return v||(m?null:f)};Je.getEleLevelForLayerLevel=function(t,e){return t};Je.drawEleInLayer=function(t,e,r,n){var a=this,i=this.renderer,o=t.context,l=e.boundingBox();l.w===0||l.h===0||!e.visible()||(r=a.getEleLevelForLayerLevel(r,n),i.setImgSmoothing(o,!1),i.drawCachedElement(o,e,null,null,r,Lm),i.setImgSmoothing(o,!0))};Je.levelIsComplete=function(t,e){var r=this,n=r.layersByLevel[t];if(!n||n.length===0)return!1;for(var a=0,i=0;i 0||o.invalid)return!1;a+=o.eles.length}return a===e.length};Je.validateLayersElesOrdering=function(t,e){var r=this.layersByLevel[t];if(r)for(var n=0;n 0){e=!0;break}}return e};Je.invalidateElements=function(t){var e=this;t.length!==0&&(e.lastInvalidationTime=Nt(),!(t.length===0||!e.haveLayers())&&e.updateElementsInLayers(t,function(n,a,i){e.invalidateLayer(n)}))};Je.invalidateLayer=function(t){if(this.lastInvalidationTime=Nt(),!t.invalid){var e=t.level,r=t.eles,n=this.layersByLevel[e];Xt(n,t),t.elesQueue=[],t.invalid=!0,t.replacement&&(t.replacement.invalid=!0);for(var a=0;a 3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,l=e._private.rscratch;if(!(i&&!e.visible())&&!(l.badLine||l.allpts==null||isNaN(l.allpts[0]))){var u;r&&(u=r,t.translate(-u.x1,-u.y1));var s=i?e.pstyle("opacity").value:1,f=i?e.pstyle("line-opacity").value:1,c=e.pstyle("curve-style").value,d=e.pstyle("line-style").value,v=e.pstyle("width").pfValue,h=e.pstyle("line-cap").value,p=s*f,y=s*f,g=function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p;c==="straight-triangle"?(o.eleStrokeStyle(t,e,D),o.drawEdgeTrianglePath(e,t,l.allpts)):(t.lineWidth=v,t.lineCap=h,o.eleStrokeStyle(t,e,D),o.drawEdgePath(e,t,l.allpts,d),t.lineCap="butt")},b=function(){a&&o.drawEdgeOverlay(t,e)},m=function(){a&&o.drawEdgeUnderlay(t,e)},x=function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;o.drawArrowheads(t,e,D)},T=function(){o.drawElementText(t,e,null,n)};t.lineJoin="round";var S=e.pstyle("ghost").value==="yes";if(S){var C=e.pstyle("ghost-offset-x").pfValue,w=e.pstyle("ghost-offset-y").pfValue,E=e.pstyle("ghost-opacity").value,M=p*E;t.translate(C,w),g(M),x(M),t.translate(-C,-w)}m(),g(),x(),b(),T(),r&&t.translate(u.x1,u.y1)}};var Ju=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,n){if(n.visible()){var a=n.pstyle("".concat(e,"-opacity")).value;if(a!==0){var i=this,o=i.usePaths(),l=n._private.rscratch,u=n.pstyle("".concat(e,"-padding")).pfValue,s=2*u,f=n.pstyle("".concat(e,"-color")).value;r.lineWidth=s,l.edgeType==="self"&&!o?r.lineCap="butt":r.lineCap="round",i.colorStrokeStyle(r,f[0],f[1],f[2],a),i.drawEdgePath(n,r,l.allpts,"solid")}}}};Ft.drawEdgeOverlay=Ju("overlay");Ft.drawEdgeUnderlay=Ju("underlay");Ft.drawEdgePath=function(t,e,r,n){var a=t._private.rscratch,i=e,o,l=!1,u=this.usePaths(),s=t.pstyle("line-dash-pattern").pfValue,f=t.pstyle("line-dash-offset").pfValue;if(u){var c=r.join("$"),d=a.pathCacheKey&&a.pathCacheKey===c;d?(o=e=a.pathCache,l=!0):(o=e=new Path2D,a.pathCacheKey=c,a.pathCache=o)}if(i.setLineDash)switch(n){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(s),i.lineDashOffset=f;break;case"solid":i.setLineDash([]);break}if(!l&&!a.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(r[0],r[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var v=2;v+3 5&&arguments[5]!==void 0?arguments[5]:!0,o=this;if(n==null){if(i&&!o.eleTextBiggerThanMin(e))return}else if(n===!1)return;if(e.isNode()){var l=e.pstyle("label");if(!l||!l.value)return;var u=o.getLabelJustification(e);t.textAlign=u,t.textBaseline="bottom"}else{var s=e.element()._private.rscratch.badLine,f=e.pstyle("label"),c=e.pstyle("source-label"),d=e.pstyle("target-label");if(s||(!f||!f.value)&&(!c||!c.value)&&(!d||!d.value))return;t.textAlign="center",t.textBaseline="bottom"}var v=!r,h;r&&(h=r,t.translate(-h.x1,-h.y1)),a==null?(o.drawText(t,e,null,v,i),e.isEdge()&&(o.drawText(t,e,"source",v,i),o.drawText(t,e,"target",v,i))):o.drawText(t,e,a,v,i),r&&t.translate(h.x1,h.y1)};hr.getFontCache=function(t){var e;this.fontCaches=this.fontCaches||[];for(var r=0;r 2&&arguments[2]!==void 0?arguments[2]:!0,n=e.pstyle("font-style").strValue,a=e.pstyle("font-size").pfValue+"px",i=e.pstyle("font-family").strValue,o=e.pstyle("font-weight").strValue,l=r?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,u=e.pstyle("text-outline-opacity").value*l,s=e.pstyle("color").value,f=e.pstyle("text-outline-color").value;t.font=n+" "+o+" "+a+" "+i,t.lineJoin="round",this.colorFillStyle(t,s[0],s[1],s[2],l),this.colorStrokeStyle(t,f[0],f[1],f[2],u)};function $m(t,e,r,n,a){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5;t.beginPath(),t.moveTo(e+i,r),t.lineTo(e+n-i,r),t.quadraticCurveTo(e+n,r,e+n,r+i),t.lineTo(e+n,r+a-i),t.quadraticCurveTo(e+n,r+a,e+n-i,r+a),t.lineTo(e+i,r+a),t.quadraticCurveTo(e,r+a,e,r+a-i),t.lineTo(e,r+i),t.quadraticCurveTo(e,r,e+i,r),t.closePath(),t.fill()}hr.getTextAngle=function(t,e){var r,n=t._private,a=n.rscratch,i=e?e+"-":"",o=t.pstyle(i+"text-rotation"),l=Et(a,"labelAngle",e);return o.strValue==="autorotate"?r=t.isEdge()?l:0:o.strValue==="none"?r=0:r=o.pfValue,r};hr.drawText=function(t,e,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=e._private,o=i.rscratch,l=a?e.effectiveOpacity():1;if(!(a&&(l===0||e.pstyle("text-opacity").value===0))){r==="main"&&(r=null);var u=Et(o,"labelX",r),s=Et(o,"labelY",r),f,c,d=this.getLabelText(e,r);if(d!=null&&d!==""&&!isNaN(u)&&!isNaN(s)){this.setupTextStyle(t,e,a);var v=r?r+"-":"",h=Et(o,"labelWidth",r),p=Et(o,"labelHeight",r),y=e.pstyle(v+"text-margin-x").pfValue,g=e.pstyle(v+"text-margin-y").pfValue,b=e.isEdge(),m=e.pstyle("text-halign").value,x=e.pstyle("text-valign").value;b&&(m="center",x="center"),u+=y,s+=g;var T;switch(n?T=this.getTextAngle(e,r):T=0,T!==0&&(f=u,c=s,t.translate(f,c),t.rotate(T),u=0,s=0),x){case"top":break;case"center":s+=p/2;break;case"bottom":s+=p;break}var S=e.pstyle("text-background-opacity").value,C=e.pstyle("text-border-opacity").value,w=e.pstyle("text-border-width").pfValue,E=e.pstyle("text-background-padding").pfValue;if(S>0||w>0&&C>0){var M=u-E;switch(m){case"left":M-=h;break;case"center":M-=h/2;break}var L=s-p-E,D=h+2*E,P=p+2*E;if(S>0){var k=t.fillStyle,A=e.pstyle("text-background-color").value;t.fillStyle="rgba("+A[0]+","+A[1]+","+A[2]+","+S*l+")";var B=e.pstyle("text-background-shape").strValue;B.indexOf("round")===0?$m(t,M,L,D,P,2):t.fillRect(M,L,D,P),t.fillStyle=k}if(w>0&&C>0){var _=t.strokeStyle,N=t.lineWidth,I=e.pstyle("text-border-color").value,R=e.pstyle("text-border-style").value;if(t.strokeStyle="rgba("+I[0]+","+I[1]+","+I[2]+","+C*l+")",t.lineWidth=w,t.setLineDash)switch(R){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"double":t.lineWidth=w/4,t.setLineDash([]);break;case"solid":t.setLineDash([]);break}if(t.strokeRect(M,L,D,P),R==="double"){var z=w/2;t.strokeRect(M+z,L+z,D-z*2,P-z*2)}t.setLineDash&&t.setLineDash([]),t.lineWidth=N,t.strokeStyle=_}}var $=2*e.pstyle("text-outline-width").pfValue;if($>0&&(t.lineWidth=$),e.pstyle("text-wrap").value==="wrap"){var H=Et(o,"labelWrapCachedLines",r),G=Et(o,"labelLineHeight",r),V=h/2,q=this.getLabelJustification(e);switch(q==="auto"||(m==="left"?q==="left"?u+=-h:q==="center"&&(u+=-V):m==="center"?q==="left"?u+=-V:q==="right"&&(u+=V):m==="right"&&(q==="center"?u+=V:q==="right"&&(u+=h))),x){case"top":s-=(H.length-1)*G;break;case"center":case"bottom":s-=(H.length-1)*G;break}for(var F=0;F 0&&t.strokeText(H[F],u,s),t.fillText(H[F],u,s),s+=G}else $>0&&t.strokeText(d,u,s),t.fillText(d,u,s);T!==0&&(t.rotate(-T),t.translate(-f,-c))}}};var Hr={};Hr.drawNode=function(t,e,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,l,u,s=e._private,f=s.rscratch,c=e.position();if(!(!se(c.x)||!se(c.y))&&!(i&&!e.visible())){var d=i?e.effectiveOpacity():1,v=o.usePaths(),h,p=!1,y=e.padding();l=e.width()+2*y,u=e.height()+2*y;var g;r&&(g=r,t.translate(-g.x1,-g.y1));for(var b=e.pstyle("background-image"),m=b.value,x=new Array(m.length),T=new Array(m.length),S=0,C=0;C 0&&arguments[0]!==void 0?arguments[0]:P;o.eleFillStyle(t,e,ie)},N=function(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:B;o.colorStrokeStyle(t,k[0],k[1],k[2],ie)},I=e.pstyle("shape").strValue,R=e.pstyle("shape-polygon-points").pfValue;if(v){t.translate(c.x,c.y);var z=o.nodePathCache=o.nodePathCache||[],$=Xs(I==="polygon"?I+","+R.join(","):I,""+u,""+l),H=z[$];H!=null?(h=H,p=!0,f.pathCache=h):(h=new Path2D,z[$]=f.pathCache=h)}var G=function(){if(!p){var ie=c;v&&(ie={x:0,y:0}),o.nodeShapes[o.getNodeShape(e)].draw(h||t,ie.x,ie.y,l,u)}v?t.fill(h):t.fill()},V=function(){for(var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:d,le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,me=s.backgrounding,pe=0,ve=0;ve 0&&arguments[0]!==void 0?arguments[0]:!1,le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:d;o.hasPie(e)&&(o.drawPie(t,e,le),ie&&(v||o.nodeShapes[o.getNodeShape(e)].draw(t,c.x,c.y,l,u)))},F=function(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:d,le=(L>0?L:-L)*ie,me=L>0?0:255;L!==0&&(o.colorFillStyle(t,me,me,me,le),v?t.fill(h):t.fill())},X=function(){if(D>0){if(t.lineWidth=D,t.lineCap="butt",t.setLineDash)switch(A){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"solid":case"double":t.setLineDash([]);break}if(v?t.stroke(h):t.stroke(),A==="double"){t.lineWidth=D/3;var ie=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",v?t.stroke(h):t.stroke(),t.globalCompositeOperation=ie}t.setLineDash&&t.setLineDash([])}},W=function(){a&&o.drawNodeOverlay(t,e,c,l,u)},U=function(){a&&o.drawNodeUnderlay(t,e,c,l,u)},K=function(){o.drawElementText(t,e,null,n)},ne=e.pstyle("ghost").value==="yes";if(ne){var ae=e.pstyle("ghost-offset-x").pfValue,J=e.pstyle("ghost-offset-y").pfValue,j=e.pstyle("ghost-opacity").value,ue=j*d;t.translate(ae,J),_(j*P),G(),V(ue,!0),N(j*B),X(),q(L!==0||D!==0),V(ue,!1),F(ue),t.translate(-ae,-J)}v&&t.translate(-c.x,-c.y),U(),v&&t.translate(c.x,c.y),_(),G(),V(d,!0),N(),X(),q(L!==0||D!==0),V(d,!1),F(),v&&t.translate(-c.x,-c.y),K(),W(),r&&t.translate(g.x1,g.y1)}};var ju=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,n,a,i,o){var l=this;if(n.visible()){var u=n.pstyle("".concat(e,"-padding")).pfValue,s=n.pstyle("".concat(e,"-opacity")).value,f=n.pstyle("".concat(e,"-color")).value,c=n.pstyle("".concat(e,"-shape")).value;if(s>0){if(a=a||n.position(),i==null||o==null){var d=n.padding();i=n.width()+2*d,o=n.height()+2*d}l.colorFillStyle(r,f[0],f[1],f[2],s),l.nodeShapes[c].draw(r,a.x,a.y,i+u*2,o+u*2),r.fill()}}}};Hr.drawNodeOverlay=ju("overlay");Hr.drawNodeUnderlay=ju("underlay");Hr.hasPie=function(t){return t=t[0],t._private.hasPie};Hr.drawPie=function(t,e,r,n){e=e[0],n=n||e.position();var a=e.cy().style(),i=e.pstyle("pie-size"),o=n.x,l=n.y,u=e.width(),s=e.height(),f=Math.min(u,s)/2,c=0,d=this.usePaths();d&&(o=0,l=0),i.units==="%"?f=f*i.pfValue:i.pfValue!==void 0&&(f=i.pfValue/2);for(var v=1;v<=a.pieBackgroundN;v++){var h=e.pstyle("pie-"+v+"-background-size").value,p=e.pstyle("pie-"+v+"-background-color").value,y=e.pstyle("pie-"+v+"-background-opacity").value*r,g=h/100;g+c>1&&(g=1-c);var b=1.5*Math.PI+2*Math.PI*c,m=2*Math.PI*g,x=b+m;h===0||c>=1||c+g>1||(t.beginPath(),t.moveTo(o,l),t.arc(o,l,f,b,x),t.closePath(),this.colorFillStyle(t,p[0],p[1],p[2],y),t.fill(),c+=g)}};var vt={},Vm=100;vt.getPixelRatio=function(){var t=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=t.backingStorePixelRatio||t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/e};vt.paintCache=function(t){for(var e=this.paintCaches=this.paintCaches||[],r=!0,n,a=0;a o.minMbLowQualFrames&&(o.motionBlurPxRatio=o.mbPxRBlurry)),o.clearingMotionBlur&&(o.motionBlurPxRatio=1),o.textureDrawLastFrame&&!c&&(f[o.NODE]=!0,f[o.SELECT_BOX]=!0);var b=u.style(),m=u.zoom(),x=a!==void 0?a:m,T=u.pan(),S={x:T.x,y:T.y},C={zoom:m,pan:{x:T.x,y:T.y}},w=o.prevViewport,E=w===void 0||C.zoom!==w.zoom||C.pan.x!==w.pan.x||C.pan.y!==w.pan.y;!E&&!(p&&!h)&&(o.motionBlurPxRatio=1),i&&(S=i),x*=l,S.x*=l,S.y*=l;var M=o.getCachedZSortedEles();function L(J,j,ue,oe,ie){var le=J.globalCompositeOperation;J.globalCompositeOperation="destination-out",o.colorFillStyle(J,255,255,255,o.motionBlurTransparency),J.fillRect(j,ue,oe,ie),J.globalCompositeOperation=le}function D(J,j){var ue,oe,ie,le;!o.clearingMotionBlur&&(J===s.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]||J===s.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG])?(ue={x:T.x*v,y:T.y*v},oe=m*v,ie=o.canvasWidth*v,le=o.canvasHeight*v):(ue=S,oe=x,ie=o.canvasWidth,le=o.canvasHeight),J.setTransform(1,0,0,1,0,0),j==="motionBlur"?L(J,0,0,ie,le):!e&&(j===void 0||j)&&J.clearRect(0,0,ie,le),r||(J.translate(ue.x,ue.y),J.scale(oe,oe)),i&&J.translate(i.x,i.y),a&&J.scale(a,a)}if(c||(o.textureDrawLastFrame=!1),c){if(o.textureDrawLastFrame=!0,!o.textureCache){o.textureCache={},o.textureCache.bb=u.mutableElements().boundingBox(),o.textureCache.texture=o.data.bufferCanvases[o.TEXTURE_BUFFER];var P=o.data.bufferContexts[o.TEXTURE_BUFFER];P.setTransform(1,0,0,1,0,0),P.clearRect(0,0,o.canvasWidth*o.textureMult,o.canvasHeight*o.textureMult),o.render({forcedContext:P,drawOnlyNodeLayer:!0,forcedPxRatio:l*o.textureMult});var C=o.textureCache.viewport={zoom:u.zoom(),pan:u.pan(),width:o.canvasWidth,height:o.canvasHeight};C.mpan={x:(0-C.pan.x)/C.zoom,y:(0-C.pan.y)/C.zoom}}f[o.DRAG]=!1,f[o.NODE]=!1;var k=s.contexts[o.NODE],A=o.textureCache.texture,C=o.textureCache.viewport;k.setTransform(1,0,0,1,0,0),d?L(k,0,0,C.width,C.height):k.clearRect(0,0,C.width,C.height);var B=b.core("outside-texture-bg-color").value,_=b.core("outside-texture-bg-opacity").value;o.colorFillStyle(k,B[0],B[1],B[2],_),k.fillRect(0,0,C.width,C.height);var m=u.zoom();D(k,!1),k.clearRect(C.mpan.x,C.mpan.y,C.width/C.zoom/l,C.height/C.zoom/l),k.drawImage(A,C.mpan.x,C.mpan.y,C.width/C.zoom/l,C.height/C.zoom/l)}else o.textureOnViewport&&!e&&(o.textureCache=null);var N=u.extent(),I=o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming||o.hoverData.draggingEles||o.cy.animated(),R=o.hideEdgesOnViewport&&I,z=[];if(z[o.NODE]=!f[o.NODE]&&d&&!o.clearedForMotionBlur[o.NODE]||o.clearingMotionBlur,z[o.NODE]&&(o.clearedForMotionBlur[o.NODE]=!0),z[o.DRAG]=!f[o.DRAG]&&d&&!o.clearedForMotionBlur[o.DRAG]||o.clearingMotionBlur,z[o.DRAG]&&(o.clearedForMotionBlur[o.DRAG]=!0),f[o.NODE]||r||n||z[o.NODE]){var $=d&&!z[o.NODE]&&v!==1,k=e||($?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]:s.contexts[o.NODE]),H=d&&!$?"motionBlur":void 0;D(k,H),R?o.drawCachedNodes(k,M.nondrag,l,N):o.drawLayeredElements(k,M.nondrag,l,N),o.debug&&o.drawDebugPoints(k,M.nondrag),!r&&!d&&(f[o.NODE]=!1)}if(!n&&(f[o.DRAG]||r||z[o.DRAG])){var $=d&&!z[o.DRAG]&&v!==1,k=e||($?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]:s.contexts[o.DRAG]);D(k,d&&!$?"motionBlur":void 0),R?o.drawCachedNodes(k,M.drag,l,N):o.drawCachedElements(k,M.drag,l,N),o.debug&&o.drawDebugPoints(k,M.drag),!r&&!d&&(f[o.DRAG]=!1)}if(o.showFps||!n&&f[o.SELECT_BOX]&&!r){var k=e||s.contexts[o.SELECT_BOX];if(D(k),o.selection[4]==1&&(o.hoverData.selecting||o.touchData.selecting)){var m=o.cy.zoom(),G=b.core("selection-box-border-width").value/m;k.lineWidth=G,k.fillStyle="rgba("+b.core("selection-box-color").value[0]+","+b.core("selection-box-color").value[1]+","+b.core("selection-box-color").value[2]+","+b.core("selection-box-opacity").value+")",k.fillRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]),G>0&&(k.strokeStyle="rgba("+b.core("selection-box-border-color").value[0]+","+b.core("selection-box-border-color").value[1]+","+b.core("selection-box-border-color").value[2]+","+b.core("selection-box-opacity").value+")",k.strokeRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]))}if(s.bgActivePosistion&&!o.hoverData.selecting){var m=o.cy.zoom(),V=s.bgActivePosistion;k.fillStyle="rgba("+b.core("active-bg-color").value[0]+","+b.core("active-bg-color").value[1]+","+b.core("active-bg-color").value[2]+","+b.core("active-bg-opacity").value+")",k.beginPath(),k.arc(V.x,V.y,b.core("active-bg-size").pfValue/m,0,2*Math.PI),k.fill()}var q=o.lastRedrawTime;if(o.showFps&&q){q=Math.round(q);var F=Math.round(1e3/q);k.setTransform(1,0,0,1,0,0),k.fillStyle="rgba(255, 0, 0, 0.75)",k.strokeStyle="rgba(255, 0, 0, 0.75)",k.lineWidth=1,k.fillText("1 frame = "+q+" ms = "+F+" fps",0,20);var X=60;k.strokeRect(0,30,250,20),k.fillRect(0,30,250*Math.min(F/X,1),20)}r||(f[o.SELECT_BOX]=!1)}if(d&&v!==1){var W=s.contexts[o.NODE],U=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_NODE],K=s.contexts[o.DRAG],ne=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_DRAG],ae=function(j,ue,oe){j.setTransform(1,0,0,1,0,0),oe||!g?j.clearRect(0,0,o.canvasWidth,o.canvasHeight):L(j,0,0,o.canvasWidth,o.canvasHeight);var ie=v;j.drawImage(ue,0,0,o.canvasWidth*ie,o.canvasHeight*ie,0,0,o.canvasWidth,o.canvasHeight)};(f[o.NODE]||z[o.NODE])&&(ae(W,U,z[o.NODE]),f[o.NODE]=!1),(f[o.DRAG]||z[o.DRAG])&&(ae(K,ne,z[o.DRAG]),f[o.DRAG]=!1)}o.prevViewport=C,o.clearingMotionBlur&&(o.clearingMotionBlur=!1,o.motionBlurCleared=!0,o.motionBlur=!0),d&&(o.motionBlurTimeout=setTimeout(function(){o.motionBlurTimeout=null,o.clearedForMotionBlur[o.NODE]=!1,o.clearedForMotionBlur[o.DRAG]=!1,o.motionBlur=!1,o.clearingMotionBlur=!c,o.mbFrames=0,f[o.NODE]=!0,f[o.DRAG]=!0,o.redraw()},Vm)),e||u.emit("render")};var jt={};jt.drawPolygonPath=function(t,e,r,n,a,i){var o=n/2,l=a/2;t.beginPath&&t.beginPath(),t.moveTo(e+o*i[0],r+l*i[1]);for(var u=1;u 0&&o>0){v.clearRect(0,0,i,o),v.globalCompositeOperation="source-over";var h=this.getCachedZSortedEles();if(t.full)v.translate(-n.x1*s,-n.y1*s),v.scale(s,s),this.drawElements(v,h),v.scale(1/s,1/s),v.translate(n.x1*s,n.y1*s);else{var p=e.pan(),y={x:p.x*s,y:p.y*s};s*=e.zoom(),v.translate(y.x,y.y),v.scale(s,s),this.drawElements(v,h),v.scale(1/s,1/s),v.translate(-y.x,-y.y)}t.bg&&(v.globalCompositeOperation="destination-over",v.fillStyle=t.bg,v.rect(0,0,i,o),v.fill())}return d};function qm(t,e){for(var r=atob(t),n=new ArrayBuffer(r.length),a=new Uint8Array(n),i=0;i "u"?"undefined":qe(OffscreenCanvas))!=="undefined"?r=new OffscreenCanvas(t,e):(r=document.createElement("canvas"),r.width=t,r.height=e),r};[Qu,Bt,Ft,zi,hr,Hr,vt,jt,Bn,rl].forEach(function(t){he(Se,t)});var Wm=[{name:"null",impl:Vu},{name:"base",impl:Xu},{name:"canvas",impl:Gm}],Ym=[{type:"layout",extensions:jy},{type:"renderer",extensions:Wm}],al={},il={};function ol(t,e,r){var n=r,a=function(w){Pe("Can not register `"+e+"` for `"+t+"` since `"+w+"` already exists in the prototype and can not be overridden")};if(t==="core"){if(bn.prototype[e])return a(e);bn.prototype[e]=r}else if(t==="collection"){if(Ze.prototype[e])return a(e);Ze.prototype[e]=r}else if(t==="layout"){for(var i=function(w){this.options=w,r.call(this,w),Ce(this._private)||(this._private={}),this._private.cy=w.cy,this._private.listeners=[],this.createEmitter()},o=i.prototype=Object.create(r.prototype),l=[],u=0;u =this.R))return this.merge(c.a,c.b,s),!0}},u.prototype.nEdges=function(s,f){var c=s.incoming.intersection(f.incoming),d=s.outgoing.intersection(f.outgoing);return this.R-c.count()-d.count()},u.prototype.getGroupHierarchy=function(s){var f=this,c=[],d={};r(this.roots[0],d,c);var v=this.allEdges();return v.forEach(function(h){var p=f.modules[h.source],y=f.modules[h.target];s.push(new t(typeof p.gid>"u"?h.source:c[p.gid],typeof y.gid>"u"?h.target:c[y.gid],h.type))}),c},u.prototype.allEdges=function(){var s=[];return u.getEdges(this.roots[0],s),s},u.getEdges=function(s,f){s.forAll(function(c){c.getEdges(f),u.getEdges(c.children,f)})},u}();_t.Configuration=e;function r(u,s,f){u.forAll(function(c){if(c.isLeaf())s.leaves||(s.leaves=[]),s.leaves.push(c.id);else{var d=s;if(c.gid=f.length,!c.isIsland()||c.isPredefined()){if(d={id:c.gid},c.isPredefined())for(var v in c.definition)d[v]=c.definition[v];s.groups||(s.groups=[]),s.groups.push(c.gid),f.push(d)}r(c.children,d,f)}})}var n=function(){function u(s,f,c,d,v){f===void 0&&(f=new o),c===void 0&&(c=new o),d===void 0&&(d=new i),this.id=s,this.outgoing=f,this.incoming=c,this.children=d,this.definition=v}return u.prototype.getEdges=function(s){var f=this;this.outgoing.forAll(function(c,d){c.forAll(function(v){s.push(new t(f.id,v.id,d))})})},u.prototype.isLeaf=function(){return this.children.count()===0},u.prototype.isIsland=function(){return this.outgoing.count()===0&&this.incoming.count()===0},u.prototype.isPredefined=function(){return typeof this.definition<"u"},u}();_t.Module=n;function a(u,s){var f={};for(var c in u)c in s&&(f[c]=u[c]);return f}var i=function(){function u(){this.table={}}return u.prototype.count=function(){return Object.keys(this.table).length},u.prototype.intersection=function(s){var f=new u;return f.table=a(this.table,s.table),f},u.prototype.intersectionCount=function(s){return this.intersection(s).count()},u.prototype.contains=function(s){return s in this.table},u.prototype.add=function(s){this.table[s.id]=s},u.prototype.remove=function(s){delete this.table[s.id]},u.prototype.forAll=function(s){for(var f in this.table)s(this.table[f])},u.prototype.modules=function(){var s=[];return this.forAll(function(f){f.isPredefined()||s.push(f)}),s},u}();_t.ModuleSet=i;var o=function(){function u(){this.sets={},this.n=0}return u.prototype.count=function(){return this.n},u.prototype.contains=function(s){var f=!1;return this.forAllModules(function(c){!f&&c.id==s&&(f=!0)}),f},u.prototype.add=function(s,f){var c=s in this.sets?this.sets[s]:this.sets[s]=new i;c.add(f),++this.n},u.prototype.remove=function(s,f){var c=this.sets[s];c.remove(f),c.count()===0&&delete this.sets[s],--this.n},u.prototype.forAll=function(s){for(var f in this.sets)s(this.sets[f],Number(f))},u.prototype.forAllModules=function(s){this.forAll(function(f,c){return f.forAll(s)})},u.prototype.intersection=function(s){var f=new u;return this.forAll(function(c,d){if(d in s.sets){var v=c.intersection(s.sets[d]),h=v.count();h>0&&(f.sets[d]=v,f.n+=h)}}),f},u}();_t.LinkSets=o;function l(u,s,f,c){for(var d=u.length,v=new e(d,s,f,c);v.greedyMerge(););var h=[],p=v.getGroupHierarchy(h);return h.forEach(function(y){var g=function(b){var m=y[b];typeof m=="number"&&(y[b]=u[m])};g("source"),g("target")}),{groups:p,powerEdges:h}}return _t.getGroups=l,_t}var rr={},fs;function Fi(){if(fs)return rr;fs=1,Object.defineProperty(rr,"__esModule",{value:!0});function t(u,s){var f={};for(var c in u)f[c]={};for(var c in s)f[c]={};return Object.keys(f).length}function e(u,s){var f=0;for(var c in u)typeof s[c]<"u"&&++f;return f}function r(u,s){var f={},c=function(d,v){typeof f[d]>"u"&&(f[d]={}),f[d][v]={}};return u.forEach(function(d){var v=s.getSourceIndex(d),h=s.getTargetIndex(d);c(v,h),c(h,v)}),f}function n(u,s,f,c){var d=r(u,c);u.forEach(function(v){var h=d[c.getSourceIndex(v)],p=d[c.getTargetIndex(v)];c.setLength(v,1+s*f(h,p))})}function a(u,s,f){f===void 0&&(f=1),n(u,f,function(c,d){return Math.sqrt(t(c,d)-e(c,d))},s)}rr.symmetricDiffLinkLengths=a;function i(u,s,f){f===void 0&&(f=1),n(u,f,function(c,d){return Math.min(Object.keys(c).length,Object.keys(d).length)<1.1?0:e(c,d)/t(c,d)},s)}rr.jaccardLinkLengths=i;function o(u,s,f,c){var d=l(u,s,c),v={};d.forEach(function(p,y){return p.forEach(function(g){return v[g]=y})});var h=[];return s.forEach(function(p){var y=c.getSourceIndex(p),g=c.getTargetIndex(p),b=v[y],m=v[g];b!==m&&h.push({axis:f,left:y,right:g,gap:c.getMinSeparation(p)})}),h}rr.generateDirectedEdgeConstraints=o;function l(u,s,f){var c=[],d=0,v=[],h=[];function p(E){E.index=E.lowlink=d++,v.push(E),E.onStack=!0;for(var M=0,L=E.out;M "u"?(p(D),E.lowlink=Math.min(E.lowlink,D.lowlink)):D.onStack&&(E.lowlink=Math.min(E.lowlink,D.index))}if(E.lowlink===E.index){for(var P=[];v.length&&(D=v.pop(),D.onStack=!1,P.push(D),D!==E););h.push(P.map(function(k){return k.id}))}}for(var y=0;y"u"&&p(w)}return h}return rr.stronglyConnectedComponents=l,rr}var Er={},cs;function $i(){if(cs)return Er;cs=1,Object.defineProperty(Er,"__esModule",{value:!0});var t=function(){function n(){this.locks={}}return n.prototype.add=function(a,i){this.locks[a]=i},n.prototype.clear=function(){this.locks={}},n.prototype.isEmpty=function(){for(var a in this.locks)return!1;return!0},n.prototype.apply=function(a){for(var i in this.locks)a(Number(i),this.locks[i])},n}();Er.Locks=t;var e=function(){function n(a,i,o){o===void 0&&(o=null),this.D=i,this.G=o,this.threshold=1e-4,this.numGridSnapNodes=0,this.snapGridSize=100,this.snapStrength=1e3,this.scaleSnapByMaxH=!1,this.random=new r,this.project=null,this.x=a,this.k=a.length;var l=this.n=a[0].length;this.H=new Array(this.k),this.g=new Array(this.k),this.Hd=new Array(this.k),this.a=new Array(this.k),this.b=new Array(this.k),this.c=new Array(this.k),this.d=new Array(this.k),this.e=new Array(this.k),this.ia=new Array(this.k),this.ib=new Array(this.k),this.xtmp=new Array(this.k),this.locks=new t,this.minD=Number.MAX_VALUE;for(var u=l,s;u--;)for(s=l;--s>u;){var f=i[u][s];f>0&&f 1e-9)break;var g=this.offsetDir();for(l=0;l 1&&b>m||!isFinite(m)){for(l=0;l 1&&(x=1);var T=m*m,S=2*x*(b-m)/(T*b),C=b*b*b,w=2*-x/(T*C);for(isFinite(S)||console.log(S),l=0;l 0?k-(_+1)*M:k-(_-1)*M;-E 0;)for(var u=i;u-- >0;)o(l,u)},n.prototype.matrixApply=function(a){n.mApply(this.k,this.n,a)},n.prototype.computeNextPosition=function(a,i){var o=this;this.computeDerivatives(a);var l=this.computeStepSize(this.g);if(this.stepAndProject(a,i,this.g,l),this.project){this.matrixApply(function(s,f){return o.e[s][f]=a[s][f]-i[s][f]});var u=this.computeStepSize(this.e);u=Math.max(.2,Math.min(u,1)),this.stepAndProject(a,i,this.e,u)}},n.prototype.run=function(a){for(var i=Number.MAX_VALUE,o=!1;!o&&a-- >0;){var l=this.rungeKutta();o=Math.abs(i/l-1) >16)/this.range},n.prototype.getNextBetween=function(a,i){return a+this.getNext()*(i-a)},n}();return Er.PseudoRandom=r,Er}var lt={},kt={},ds;function Vi(){if(ds)return kt;ds=1,Object.defineProperty(kt,"__esModule",{value:!0});var t=function(){function l(u){this.scale=u,this.AB=0,this.AD=0,this.A2=0}return l.prototype.addVariable=function(u){var s=this.scale/u.scale,f=u.offset/u.scale,c=u.weight;this.AB+=c*s*f,this.AD+=c*s*u.desiredPosition,this.A2+=c*s*s},l.prototype.getPosn=function(){return(this.AD-this.AB)/this.A2},l}();kt.PositionStats=t;var e=function(){function l(u,s,f,c){c===void 0&&(c=!1),this.left=u,this.right=s,this.gap=f,this.equality=c,this.active=!1,this.unsatisfiable=!1,this.left=u,this.right=s,this.gap=f,this.equality=c}return l.prototype.slack=function(){return this.unsatisfiable?Number.MAX_VALUE:this.right.scale*this.right.position()-this.gap-this.left.scale*this.left.position()},l}();kt.Constraint=e;var r=function(){function l(u,s,f){s===void 0&&(s=1),f===void 0&&(f=1),this.desiredPosition=u,this.weight=s,this.scale=f,this.offset=0}return l.prototype.dfdv=function(){return 2*this.weight*(this.position()-this.desiredPosition)},l.prototype.position=function(){return(this.block.ps.scale*this.block.posn+this.offset)/this.scale},l.prototype.visitNeighbours=function(u,s){var f=function(c,d){return c.active&&u!==d&&s(c,d)};this.cOut.forEach(function(c){return f(c,c.right)}),this.cIn.forEach(function(c){return f(c,c.left)})},l}();kt.Variable=r;var n=function(){function l(u){this.vars=[],u.offset=0,this.ps=new t(u.scale),this.addVariable(u)}return l.prototype.addVariable=function(u){u.block=this,this.vars.push(u),this.ps.addVariable(u),this.posn=this.ps.getPosn()},l.prototype.updateWeightedPosition=function(){this.ps.AB=this.ps.AD=this.ps.A2=0;for(var u=0,s=this.vars.length;u =0?this.inactive.push(u):this.bs.merge(u)}}},l.prototype.solve=function(){this.satisfy();for(var u=Number.MAX_VALUE,s=this.bs.cost();Math.abs(u-s)>1e-4;)this.satisfy(),u=s,s=this.bs.cost();return s},l.LAGRANGIAN_TOLERANCE=-1e-4,l.ZERO_UPPERBOUND=-1e-10,l}();kt.Solver=i;function o(l,u,s){for(var f=l.map(function(C){return new r(C.desiredCenter)}),c=[],d=l.length,v=0;v0)}return null}}return i.prototype.clear=function(){this._root=null,this.size=0},i.prototype.find=function(o){for(var l=this._root;l!==null;){var u=this._comparator(o,l.data);if(u===0)return l.data;l=l.get_child(u>0)}return null},i.prototype.lowerBound=function(o){return this._bound(o,this._comparator)},i.prototype.upperBound=function(o){var l=this._comparator;function u(s,f){return l(f,s)}return this._bound(o,u)},i.prototype.min=function(){var o=this._root;if(o===null)return null;for(;o.left!==null;)o=o.left;return o.data},i.prototype.max=function(){var o=this._root;if(o===null)return null;for(;o.right!==null;)o=o.right;return o.data},i.prototype.iterator=function(){return new r(this)},i.prototype.each=function(o){for(var l=this.iterator(),u;(u=l.next())!==null;)o(u)},i.prototype.reach=function(o){for(var l=this.iterator(),u;(u=l.prev())!==null;)o(u)},i.prototype._bound=function(o,l){for(var u=this._root,s=this.iterator();u!==null;){var f=this._comparator(o,u.data);if(f===0)return s._cursor=u,s;s._ancestors.push(u),u=u.get_child(f>0)}for(var c=s._ancestors.length-1;c>=0;--c)if(u=s._ancestors[c],l(o,u.data)>0)return s._cursor=u,s._ancestors.length=c,s;return s._ancestors.length=0,s},i}();Cr.TreeBase=e;var r=function(){function i(o){this._tree=o,this._ancestors=[],this._cursor=null}return i.prototype.data=function(){return this._cursor!==null?this._cursor.data:null},i.prototype.next=function(){if(this._cursor===null){var o=this._tree._root;o!==null&&this._minNode(o)}else if(this._cursor.right===null){var l;do if(l=this._cursor,this._ancestors.length)this._cursor=this._ancestors.pop();else{this._cursor=null;break}while(this._cursor.right===l)}else this._ancestors.push(this._cursor),this._minNode(this._cursor.right);return this._cursor!==null?this._cursor.data:null},i.prototype.prev=function(){if(this._cursor===null){var o=this._tree._root;o!==null&&this._maxNode(o)}else if(this._cursor.left===null){var l;do if(l=this._cursor,this._ancestors.length)this._cursor=this._ancestors.pop();else{this._cursor=null;break}while(this._cursor.left===l)}else this._ancestors.push(this._cursor),this._maxNode(this._cursor.left);return this._cursor!==null?this._cursor.data:null},i.prototype._minNode=function(o){for(;o.left!==null;)this._ancestors.push(o),o=o.left;this._cursor=o},i.prototype._maxNode=function(o){for(;o.right!==null;)this._ancestors.push(o),o=o.right;this._cursor=o},i}();Cr.Iterator=r;var n=function(){function i(o){this.data=o,this.left=null,this.right=null,this.red=!0}return i.prototype.get_child=function(o){return o?this.right:this.left},i.prototype.set_child=function(o,l){o?this.right=l:this.left=l},i}(),a=function(i){t(o,i);function o(l){var u=i.call(this)||this;return u._root=null,u._comparator=l,u.size=0,u}return o.prototype.insert=function(l){var u=!1;if(this._root===null)this._root=new n(l),u=!0,this.size++;else{var s=new n(void 0),f=!1,c=!1,d=null,v=s,h=null,p=this._root;for(v.right=this._root;;){if(p===null?(p=new n(l),h.set_child(f,p),u=!0,this.size++):o.is_red(p.left)&&o.is_red(p.right)&&(p.red=!0,p.left.red=!1,p.right.red=!1),o.is_red(p)&&o.is_red(h)){var y=v.right===d;p===h.get_child(c)?v.set_child(y,o.single_rotate(d,!c)):v.set_child(y,o.double_rotate(d,!c))}var g=this._comparator(p.data,l);if(g===0)break;c=f,f=g<0,d!==null&&(v=d),d=h,h=p,p=p.get_child(f)}this._root=s.right}return this._root.red=!1,u},o.prototype.remove=function(l){if(this._root===null)return!1;var u=new n(void 0),s=u;s.right=this._root;for(var f=null,c=null,d=null,v=!0;s.get_child(v)!==null;){var h=v;c=f,f=s,s=s.get_child(v);var p=this._comparator(l,s.data);if(v=p>0,p===0&&(d=s),!o.is_red(s)&&!o.is_red(s.get_child(v))){if(o.is_red(s.get_child(!v))){var y=o.single_rotate(s,v);f.set_child(h,y),f=y}else if(!o.is_red(s.get_child(!v))){var g=f.get_child(!h);if(g!==null)if(!o.is_red(g.get_child(!h))&&!o.is_red(g.get_child(h)))f.red=!1,g.red=!0,s.red=!0;else{var b=c.right===f;o.is_red(g.get_child(h))?c.set_child(b,o.double_rotate(f,h)):o.is_red(g.get_child(!h))&&c.set_child(b,o.single_rotate(f,h));var m=c.get_child(b);m.red=!0,s.red=!0,m.left.red=!1,m.right.red=!1}}}}return d!==null&&(d.data=s.data,f.set_child(f.right===s,s.get_child(s.left===null)),this.size--),this._root=u.right,this._root!==null&&(this._root.red=!1),d!==null},o.is_red=function(l){return l!==null&&l.red},o.single_rotate=function(l,u){var s=l.get_child(!u);return l.set_child(!u,s.get_child(u)),s.set_child(u,l),l.red=!0,s.red=!1,s},o.double_rotate=function(l,u){return l.set_child(!u,o.single_rotate(l.get_child(!u),!u)),o.single_rotate(l,u)},o}(e);return Cr.RBTree=a,Cr}var hs;function _n(){if(hs)return lt;hs=1;var t=We&&We.__extends||function(){var w=function(E,M){return w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(L,D){L.__proto__=D}||function(L,D){for(var P in D)D.hasOwnProperty(P)&&(L[P]=D[P])},w(E,M)};return function(E,M){w(E,M);function L(){this.constructor=E}E.prototype=M===null?Object.create(M):(L.prototype=M.prototype,new L)}}();Object.defineProperty(lt,"__esModule",{value:!0});var e=Vi(),r=fl();function n(w){return w.bounds=typeof w.leaves<"u"?w.leaves.reduce(function(E,M){return M.bounds.union(E)},a.empty()):a.empty(),typeof w.groups<"u"&&(w.bounds=w.groups.reduce(function(E,M){return n(M).union(E)},w.bounds)),w.bounds=w.bounds.inflate(w.padding),w.bounds}lt.computeGroupBounds=n;var a=function(){function w(E,M,L,D){this.x=E,this.X=M,this.y=L,this.Y=D}return w.empty=function(){return new w(Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY)},w.prototype.cx=function(){return(this.x+this.X)/2},w.prototype.cy=function(){return(this.y+this.Y)/2},w.prototype.overlapX=function(E){var M=this.cx(),L=E.cx();return M<=L&&E.x 0?L[0]:null},w.prototype.vertices=function(){return[{x:this.x,y:this.y},{x:this.X,y:this.y},{x:this.X,y:this.Y},{x:this.x,y:this.Y}]},w.lineIntersection=function(E,M,L,D,P,k,A,B){var _=L-E,N=A-P,I=D-M,R=B-k,z=R*_-N*I;if(z==0)return null;var $=E-P,H=M-k,G=N*H-R*$,V=G/z,q=_*H-I*$,F=q/z;return V>=0&&V<=1&&F>=0&&F<=1?{x:E+V*_,y:M+V*I}:null},w.prototype.inflate=function(E){return new w(this.x-E,this.X+E,this.y-E,this.Y+E)},w}();lt.Rectangle=a;function i(w,E,M){var L=w.rayIntersection(E.cx(),E.cy())||{x:w.cx(),y:w.cy()},D=E.rayIntersection(w.cx(),w.cy())||{x:E.cx(),y:E.cy()},P=D.x-L.x,k=D.y-L.y,A=Math.sqrt(P*P+k*k),B=A-M;return{sourceIntersection:L,targetIntersection:D,arrowStart:{x:L.x+B*P/A,y:L.y+B*k/A}}}lt.makeEdgeBetween=i;function o(w,E,M){var L=E.rayIntersection(w.x,w.y);L||(L={x:E.cx(),y:E.cy()});var D=L.x-w.x,P=L.y-w.y,k=Math.sqrt(D*D+P*P);return{x:L.x-M*D/k,y:L.y-M*P/k}}lt.makeEdgeTo=o;var l=function(){function w(E,M,L){this.v=E,this.r=M,this.pos=L,this.prev=f(),this.next=f()}return w}(),u=function(){function w(E,M,L){this.isOpen=E,this.v=M,this.pos=L}return w}();function s(w,E){return w.pos>E.pos?1:w.pos =P);var A=new Array(k);for(D=0;D 0&&(w[L].insert(P),P[D].insert(w))};M("next","prev"),M("prev","next")}function g(w,E){return h(w,E,c,1e-6)}lt.generateXConstraints=g;function b(w,E){return h(w,E,d,1e-6)}lt.generateYConstraints=b;function m(w){return v(w,c,1e-6)}lt.generateXGroupConstraints=m;function x(w){return v(w,d,1e-6)}lt.generateYGroupConstraints=x;function T(w){var E=w.map(function(D){return new e.Variable(D.cx())}),M=g(w,E),L=new e.Solver(E,M);L.solve(),E.forEach(function(D,P){return w[P].setXCentre(D.position())}),E=w.map(function(D){return new e.Variable(D.cy())}),M=b(w,E),L=new e.Solver(E,M),L.solve(),E.forEach(function(D,P){return w[P].setYCentre(D.position())})}lt.removeOverlaps=T;var S=function(w){t(E,w);function E(M,L){var D=w.call(this,0,L)||this;return D.index=M,D}return E}(e.Variable);lt.IndexedVariable=S;var C=function(){function w(E,M,L,D,P){var k=this;if(L===void 0&&(L=null),D===void 0&&(D=null),P===void 0&&(P=!1),this.nodes=E,this.groups=M,this.rootGroup=L,this.avoidOverlaps=P,this.variables=E.map(function(B,_){return B.variable=new S(_,1)}),D&&this.createConstraints(D),P&&L&&typeof L.groups<"u"){E.forEach(function(B){if(!B.width||!B.height){B.bounds=new a(B.x,B.x,B.y,B.y);return}var _=B.width/2,N=B.height/2;B.bounds=new a(B.x-_,B.x+_,B.y-N,B.y+N)}),n(L);var A=E.length;M.forEach(function(B){k.variables[A]=B.minVar=new S(A++,typeof B.stiffness<"u"?B.stiffness:.01),k.variables[A]=B.maxVar=new S(A++,typeof B.stiffness<"u"?B.stiffness:.01)})}}return w.prototype.createSeparation=function(E){return new e.Constraint(this.nodes[E.left].variable,this.nodes[E.right].variable,E.gap,typeof E.equality<"u"?E.equality:!1)},w.prototype.makeFeasible=function(E){var M=this;if(this.avoidOverlaps){var L="x",D="width";E.axis==="x"&&(L="y",D="height");var P=E.offsets.map(function(A){return M.nodes[A.node]}).sort(function(A,B){return A[L]-B[L]}),k=null;P.forEach(function(A){if(k){var B=k[L]+k[D];B>A[L]&&(A[L]=B)}k=A})}},w.prototype.createAlignment=function(E){var M=this,L=this.nodes[E.offsets[0].node].variable;this.makeFeasible(E);var D=E.axis==="x"?this.xConstraints:this.yConstraints;E.offsets.slice(1).forEach(function(P){var k=M.nodes[P.node].variable;D.push(new e.Constraint(L,k,P.offset,!0))})},w.prototype.createConstraints=function(E){var M=this,L=function(D){return typeof D.type>"u"||D.type==="separation"};this.xConstraints=E.filter(function(D){return D.axis==="x"&&L(D)}).map(function(D){return M.createSeparation(D)}),this.yConstraints=E.filter(function(D){return D.axis==="y"&&L(D)}).map(function(D){return M.createSeparation(D)}),E.filter(function(D){return D.type==="alignment"}).forEach(function(D){return M.createAlignment(D)})},w.prototype.setupVariablesAndBounds=function(E,M,L,D){this.nodes.forEach(function(P,k){P.fixed?(P.variable.weight=P.fixedWeight?P.fixedWeight:1e3,L[k]=D(P)):P.variable.weight=1;var A=(P.width||0)/2,B=(P.height||0)/2,_=E[k],N=M[k];P.bounds=new a(_-A,_+A,N-B,N+B)})},w.prototype.xProject=function(E,M,L){!this.rootGroup&&!(this.avoidOverlaps||this.xConstraints)||this.project(E,M,E,L,function(D){return D.px},this.xConstraints,m,function(D){return D.bounds.setXCentre(L[D.variable.index]=D.variable.position())},function(D){var P=L[D.minVar.index]=D.minVar.position(),k=L[D.maxVar.index]=D.maxVar.position(),A=D.padding/2;D.bounds.x=P-A,D.bounds.X=k+A})},w.prototype.yProject=function(E,M,L){!this.rootGroup&&!this.yConstraints||this.project(E,M,M,L,function(D){return D.py},this.yConstraints,x,function(D){return D.bounds.setYCentre(L[D.variable.index]=D.variable.position())},function(D){var P=L[D.minVar.index]=D.minVar.position(),k=L[D.maxVar.index]=D.maxVar.position(),A=D.padding/2;D.bounds.y=P-A,D.bounds.Y=k+A})},w.prototype.projectFunctions=function(){var E=this;return[function(M,L,D){return E.xProject(M,L,D)},function(M,L,D){return E.yProject(M,L,D)}]},w.prototype.project=function(E,M,L,D,P,k,A,B,_){this.setupVariablesAndBounds(E,M,D,P),this.rootGroup&&this.avoidOverlaps&&(n(this.rootGroup),k=k.concat(A(this.rootGroup))),this.solve(this.variables,k,L,D),this.nodes.forEach(B),this.rootGroup&&this.avoidOverlaps&&(this.groups.forEach(_),n(this.rootGroup))},w.prototype.solve=function(E,M,L,D){var P=new e.Solver(E,M);P.setStartingPositions(L),P.setDesiredPositions(D),P.solve()},w}();return lt.Projection=C,lt}var Un={},jr={},ps;function cl(){if(ps)return jr;ps=1,Object.defineProperty(jr,"__esModule",{value:!0});var t=function(){function r(n){this.elem=n,this.subheaps=[]}return r.prototype.toString=function(n){for(var a="",i=!1,o=0;o
y&&(h.d=y,h.prev=d,u.reduceKey(h.q,h,function(b,m){return b.q=m}))}}return f},i}();return Un.Calculator=a,Un}var ze={},ys;function dl(){if(ys)return ze;ys=1;var t=We&&We.__extends||function(){var P=function(k,A){return P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(B,_){B.__proto__=_}||function(B,_){for(var N in _)_.hasOwnProperty(N)&&(B[N]=_[N])},P(k,A)};return function(k,A){P(k,A);function B(){this.constructor=k}k.prototype=A===null?Object.create(A):(B.prototype=A.prototype,new B)}}();Object.defineProperty(ze,"__esModule",{value:!0});var e=_n(),r=function(){function P(){}return P}();ze.Point=r;var n=function(){function P(k,A,B,_){this.x1=k,this.y1=A,this.x2=B,this.y2=_}return P}();ze.LineSegment=n;var a=function(P){t(k,P);function k(){return P!==null&&P.apply(this,arguments)||this}return k}(r);ze.PolyPoint=a;function i(P,k,A){return(k.x-P.x)*(A.y-P.y)-(A.x-P.x)*(k.y-P.y)}ze.isLeft=i;function o(P,k,A){return i(P,k,A)>0}function l(P,k,A){return i(P,k,A)<0}function u(P){var k=P.slice(0).sort(function(V,q){return V.x!==q.x?q.x-V.x:q.y-V.y}),A=P.length,B,_=0,N=k[0].x;for(B=1;B=0&&k[B].x===H;B--);for(z=B+1,B=I;++B<=z;)if(!(i(k[_],k[z],k[B])>=0&&B 1&&!(i(R[R.length-2],R[R.length-1],k[B])>0);)R.length-=1;B!=_&&R.push(k[B])}$!=z&&R.push(k[$]);var G=R.length;for(B=z;--B>=I;)if(!(i(k[$],k[I],k[B])>=0&&B>I)){for(;R.length>G&&!(i(R[R.length-2],R[R.length-1],k[B])>0);)R.length-=1;B!=_&&R.push(k[B])}}return R}ze.ConvexHull=u;function s(P,k,A){k.slice(0).sort(function(B,_){return Math.atan2(B.y-P.y,B.x-P.x)-Math.atan2(_.y-P.y,_.x-P.x)}).forEach(A)}ze.clockwiseRadialSweep=s;function f(P,k){var A=k.slice(0);return A.push(k[0]),{rtan:c(P,A),ltan:d(P,A)}}function c(P,k){var A=k.length-1,B,_,N,I,R;if(l(P,k[1],k[0])&&!o(P,k[A-1],k[0]))return 0;for(B=0,_=A;;){if(_-B===1)return o(P,k[B],k[_])?B:_;if(N=Math.floor((B+_)/2),R=l(P,k[N+1],k[N]),R&&!o(P,k[N-1],k[N]))return N;I=o(P,k[B+1],k[B]),I?R||o(P,k[B],k[N])?_=N:B=N:R&&l(P,k[B],k[N])?_=N:B=N}}function d(P,k){var A=k.length-1,B,_,N,I,R;if(o(P,k[A-1],k[0])&&!l(P,k[1],k[0]))return 0;for(B=0,_=A;;){if(_-B===1)return l(P,k[B],k[_])?B:_;if(N=Math.floor((B+_)/2),R=l(P,k[N+1],k[N]),o(P,k[N-1],k[N])&&!R)return N;I=l(P,k[B+1],k[B]),I?R?l(P,k[B],k[N])?_=N:B=N:_=N:R?B=N:o(P,k[B],k[N])?_=N:B=N}}function v(P,k,A,B,_,N){var I,R;I=A(k[0],P),R=B(P[I],k);for(var z=!1;!z;){for(z=!0;I===P.length-1&&(I=0),!_(k[R],P[I],P[I+1]);)++I;for(;R===0&&(R=k.length-1),!N(P[I],k[R],k[R-1]);)--R,z=!1}return{t1:I,t2:R}}ze.tangent_PolyPolyC=v;function h(P,k){var A=p(k,P);return{t1:A.t2,t2:A.t1}}ze.LRtangent_PolyPolyC=h;function p(P,k){return v(P,k,c,d,o,l)}ze.RLtangent_PolyPolyC=p;function y(P,k){return v(P,k,d,d,l,l)}ze.LLtangent_PolyPolyC=y;function g(P,k){return v(P,k,c,c,o,o)}ze.RRtangent_PolyPolyC=g;var b=function(){function P(k,A){this.t1=k,this.t2=A}return P}();ze.BiTangent=b;var m=function(){function P(){}return P}();ze.BiTangents=m;var x=function(P){t(k,P);function k(){return P!==null&&P.apply(this,arguments)||this}return k}(r);ze.TVGPoint=x;var T=function(){function P(k,A,B,_){this.id=k,this.polyid=A,this.polyvertid=B,this.p=_,_.vv=this}return P}();ze.VisibilityVertex=T;var S=function(){function P(k,A){this.source=k,this.target=A}return P.prototype.length=function(){var k=this.source.p.x-this.target.p.x,A=this.source.p.y-this.target.p.y;return Math.sqrt(k*k+A*A)},P}();ze.VisibilityEdge=S;var C=function(){function P(k,A){if(this.P=k,this.V=[],this.E=[],A)this.V=A.V.slice(0),this.E=A.E.slice(0);else{for(var B=k.length,_=0;_0&&this.E.push(new S(N[I-1].vv,z))}N.length>1&&this.E.push(new S(N[0].vv,N[N.length-1].vv))}for(var _=0;_ 0)return!0;return!1},P}();ze.TangentVisibilityGraph=C;function w(P,k){for(var A=[],B=1,_=k.length;B<_;++B){var N=e.Rectangle.lineIntersection(P.x1,P.y1,P.x2,P.y2,k[B-1].x,k[B-1].y,k[B].x,k[B].y);N&&A.push(N)}return A}function E(P,k){for(var A=P.length-1,B=k.length-1,_=new m,N=0;N=0&&F>=0&&X<0&&W>=0&&U>=0&&K<0?_.ll=new b(N,I):q<=0&&F<=0&&X>0&&W<=0&&U<=0&&K>0?_.rr=new b(N,I):q<=0&&F>0&&X<=0&&W>=0&&U<0&&K>=0?_.rl=new b(N,I):q>=0&&F<0&&X>=0&&W<=0&&U>0&&K<=0&&(_.lr=new b(N,I))}return _}ze.tangents=E;function M(P,k){for(var A=1,B=k.length;A0)return!0}return!1}return ze.polysOverlap=D,ze}var en={},ms;function vl(){if(ms)return en;ms=1,Object.defineProperty(en,"__esModule",{value:!0});var t={PADDING:10,GOLDEN_SECTION:(1+Math.sqrt(5))/2,FLOAT_EPSILON:1e-4,MAX_INERATIONS:100};function e(n,a,i,h,v,u){v===void 0&&(v=1),u===void 0&&(u=!0);var s=0,f=0,c=a,d=i,v=typeof v<"u"?v:1,h=typeof h<"u"?h:0,p=0,y=0,g=0,b=0,m=[];if(n.length==0)return;x(n),S(n),u&&T(n);function x(L){L.forEach(function(P){D(P)});function D(P){var k=Number.MAX_VALUE,A=Number.MAX_VALUE,B=0,_=0;P.array.forEach(function(N){var I=typeof N.width<"u"?N.width:h,R=typeof N.height<"u"?N.height:h;I/=2,R/=2,B=Math.max(N.x+I,B),k=Math.min(N.x-I,k),_=Math.max(N.y+R,_),A=Math.min(N.y-R,A)}),P.width=B-k,P.height=_-A}}function T(L){L.forEach(function(D){var P={x:0,y:0};D.array.forEach(function(B){P.x+=B.x,P.y+=B.y}),P.x/=D.array.length,P.y/=D.array.length;var k={x:P.x-D.width/2,y:P.y-D.height/2},A={x:D.x-k.x+c/2-p/2,y:D.y-k.y+d/2-y/2};D.array.forEach(function(B){B.x+=A.x,B.y+=A.y})})}function S(L,D){var P=Number.POSITIVE_INFINITY,k=0;L.sort(function(V,q){return q.height-V.height}),g=L.reduce(function(V,q){return V.width g||$>t.FLOAT_EPSILON;){if(R!=1)var H=B-(B-A)/t.GOLDEN_SECTION,N=C(L,H);if(R!=0)var G=A+(B-A)/t.GOLDEN_SECTION,I=C(L,G);if(z=Math.abs(H-G),$=Math.abs(N-I),N I?(A=H,H=G,N=I,R=1):(B=G,G=H,I=N,R=0),_++>100)break}C(L,k)}function C(L,D){m=[],p=0,y=0,b=f;for(var P=0;P
=L.height&&m[k].x+m[k].width+L.width+t.PADDING-D<=t.FLOAT_EPSILON){P=m[k];break}m.push(L),P!==void 0?(L.x=P.x+P.width+t.PADDING,L.y=P.bottom,L.space_left=L.height,L.bottom=L.y,P.space_left-=L.height+t.PADDING,P.bottom+=L.height+t.PADDING):(L.y=b,b+=L.height+t.PADDING,L.x=s,L.bottom=L.y,L.space_left=L.height),L.y+L.height-y>-t.FLOAT_EPSILON&&(y=L.y+L.height-f),L.x+L.width-p>-t.FLOAT_EPSILON&&(p=L.x+L.width-s)}function E(L){var D=0;return L.forEach(function(P){return D+=P.width+t.PADDING}),D}function M(){return p/y}}en.applyPacking=e;function r(n,a){for(var i={},o={},l=[],u=0,s=0;s "u"||typeof v.py>"u")&&(v.px=v.x,v.py=v.y);var p=[v.px,v.py];this._descent.locks.add(h,p)}var y=this._descent.rungeKutta();return y===0?this._alpha=0:typeof this._lastStress<"u"&&(this._alpha=y),this._lastStress=y,this.updateNodePositions(),this.trigger({type:u.tick,alpha:this._alpha,stress:this._lastStress}),!1},c.prototype.updateNodePositions=function(){for(var d=this._descent.x[0],v=this._descent.x[1],h,p=this._nodes.length;p--;)h=this._nodes[p],h.x=d[p],h.y=v[p]},c.prototype.nodes=function(d){if(!d){if(this._nodes.length===0&&this._links.length>0){var v=0;this._links.forEach(function(p){v=Math.max(v,p.source,p.target)}),this._nodes=new Array(++v);for(var h=0;h "u"&&(h.padding=1),typeof h.leaves<"u"&&h.leaves.forEach(function(p,y){typeof p=="number"&&((h.leaves[y]=v._nodes[p]).parent=h)}),typeof h.groups<"u"&&h.groups.forEach(function(p,y){typeof p=="number"&&((h.groups[y]=v._groups[p]).parent=h)})}),this._rootGroup.leaves=this._nodes.filter(function(h){return typeof h.parent>"u"}),this._rootGroup.groups=this._groups.filter(function(h){return typeof h.parent>"u"}),this):this._groups},c.prototype.powerGraphGroups=function(d){var v=e.getGroups(this._nodes,this._links,this.linkAccessor,this._rootGroup);return this.groups(v.groups),d(v),this},c.prototype.avoidOverlaps=function(d){return arguments.length?(this._avoidOverlaps=d,this):this._avoidOverlaps},c.prototype.handleDisconnected=function(d){return arguments.length?(this._handleDisconnected=d,this):this._handleDisconnected},c.prototype.flowLayout=function(d,v){return arguments.length||(d="y"),this._directedLinkConstraints={axis:d,getMinSeparation:typeof v=="number"?function(){return v}:v},this},c.prototype.links=function(d){return arguments.length?(this._links=d,this):this._links},c.prototype.constraints=function(d){return arguments.length?(this._constraints=d,this):this._constraints},c.prototype.distanceMatrix=function(d){return arguments.length?(this._distanceMatrix=d,this):this._distanceMatrix},c.prototype.size=function(d){return d?(this._canvasSize=d,this):this._canvasSize},c.prototype.defaultNodeSize=function(d){return d?(this._defaultNodeSize=d,this):this._defaultNodeSize},c.prototype.groupCompactness=function(d){return d?(this._groupCompactness=d,this):this._groupCompactness},c.prototype.linkDistance=function(d){return d?(this._linkDistance=typeof d=="function"?d:+d,this._linkLengthCalculator=null,this):this._linkDistance},c.prototype.linkType=function(d){return this._linkType=d,this},c.prototype.convergenceThreshold=function(d){return d?(this._threshold=typeof d=="function"?d:+d,this):this._threshold},c.prototype.alpha=function(d){return arguments.length?(d=+d,this._alpha?d>0?this._alpha=d:this._alpha=0:d>0&&(this._running||(this._running=!0,this.trigger({type:u.start,alpha:this._alpha=d}),this.kick())),this):this._alpha},c.prototype.getLinkLength=function(d){return typeof this._linkDistance=="function"?+this._linkDistance(d):this._linkDistance},c.setLinkLength=function(d,v){d.length=v},c.prototype.getLinkType=function(d){return typeof this._linkType=="function"?this._linkType(d):0},c.prototype.symmetricDiffLinkLengths=function(d,v){var h=this;return v===void 0&&(v=1),this.linkDistance(function(p){return d*p.length}),this._linkLengthCalculator=function(){return r.symmetricDiffLinkLengths(h._links,h.linkAccessor,v)},this},c.prototype.jaccardLinkLengths=function(d,v){var h=this;return v===void 0&&(v=1),this.linkDistance(function(p){return d*p.length}),this._linkLengthCalculator=function(){return r.jaccardLinkLengths(h._links,h.linkAccessor,v)},this},c.prototype.start=function(d,v,h,p,y,g){var b=this;d===void 0&&(d=0),v===void 0&&(v=0),h===void 0&&(h=0),p===void 0&&(p=0),y===void 0&&(y=!0),g===void 0&&(g=!0);var m,x=this.nodes().length,T=x+2*this._groups.length;this._links.length;var S=this._canvasSize[0],C=this._canvasSize[1],w=new Array(T),E=new Array(T),M=null,L=this._avoidOverlaps;this._nodes.forEach(function(I,R){I.index=R,typeof I.x>"u"&&(I.x=S/2,I.y=C/2),w[R]=I.x,E[R]=I.y}),this._linkLengthCalculator&&this._linkLengthCalculator();var D;this._distanceMatrix?D=this._distanceMatrix:(D=new i.Calculator(T,this._links,c.getSourceIndex,c.getTargetIndex,function(I){return b.getLinkLength(I)}).DistanceMatrix(),M=n.Descent.createSquareMatrix(T,function(){return 2}),this._links.forEach(function(I){typeof I.source=="number"&&(I.source=b._nodes[I.source]),typeof I.target=="number"&&(I.target=b._nodes[I.target])}),this._links.forEach(function(I){var R=c.getSourceIndex(I),z=c.getTargetIndex(I);M[R][z]=M[z][R]=I.weight||1}));var P=n.Descent.createSquareMatrix(T,function(I,R){return D[I][R]});if(this._rootGroup&&typeof this._rootGroup.groups<"u"){var m=x,k=function(R,z,$,H){M[R][z]=M[z][R]=$,P[R][z]=P[z][R]=H};this._groups.forEach(function(R){k(m,m+1,b._groupCompactness,.1),w[m]=0,E[m++]=0,w[m]=0,E[m++]=0})}else this._rootGroup={leaves:this._nodes,groups:[]};var A=this._constraints||[];this._directedLinkConstraints&&(this.linkAccessor.getMinSeparation=this._directedLinkConstraints.getMinSeparation,A=A.concat(r.generateDirectedEdgeConstraints(x,this._links,this._directedLinkConstraints.axis,this.linkAccessor))),this.avoidOverlaps(!1),this._descent=new n.Descent([w,E],P),this._descent.locks.clear();for(var m=0;m 0&&(this._descent.project=new a.Projection(this._nodes,this._groups,this._rootGroup,A).projectFunctions()),this._descent.run(v),this.separateOverlappingComponents(S,C,g),this.avoidOverlaps(L),L&&(this._nodes.forEach(function(I,R){I.x=w[R],I.y=E[R]}),this._descent.project=new a.Projection(this._nodes,this._groups,this._rootGroup,A,!0).projectFunctions(),this._nodes.forEach(function(I,R){w[R]=I.x,E[R]=I.y})),this._descent.G=M,this._descent.run(h),p){this._descent.snapStrength=1e3,this._descent.snapGridSize=this._nodes[0].width,this._descent.numGridSnapNodes=x,this._descent.scaleSnapByMaxH=x!=T;var N=n.Descent.createSquareMatrix(T,function(I,R){return I>=x||R>=x?M[I][R]:0});this._descent.G=N,this._descent.run(p)}return this.updateNodePositions(),this.separateOverlappingComponents(S,C,g),y?this.resume():this},c.prototype.initialLayout=function(d,v,h){if(this._groups.length>0&&d>0){var p=this._nodes.length,y=this._links.map(function(b){return{source:b.source.index,target:b.target.index}}),g=this._nodes.map(function(b){return{index:b.index}});this._groups.forEach(function(b,m){g.push({index:b.index=p+m})}),this._groups.forEach(function(b,m){typeof b.leaves<"u"&&b.leaves.forEach(function(x){return y.push({source:b.index,target:x.index})}),typeof b.groups<"u"&&b.groups.forEach(function(x){return y.push({source:b.index,target:x.index})})}),new c().size(this.size()).nodes(g).links(y).avoidOverlaps(!1).linkDistance(this.linkDistance()).symmetricDiffLinkLengths(5).convergenceThreshold(1e-4).start(d,0,0,0,!1),this._nodes.forEach(function(b){v[b.index]=g[b.index].x,h[b.index]=g[b.index].y})}else this._descent.run(d)},c.prototype.separateOverlappingComponents=function(d,v,h){var p=this;if(h===void 0&&(h=!0),!this._distanceMatrix&&this._handleDisconnected){var y=this._descent.x[0],g=this._descent.x[1];this._nodes.forEach(function(m,x){m.x=y[x],m.y=g[x]});var b=l.separateGraphs(this._nodes,this._links);l.applyPacking(b,d,v,this._defaultNodeSize,1,h),this._nodes.forEach(function(m,x){p._descent.x[0][x]=m.x,p._descent.x[1][x]=m.y,m.bounds&&(m.bounds.setXCentre(m.x),m.bounds.setYCentre(m.y))})}},c.prototype.resume=function(){return this.alpha(.1)},c.prototype.stop=function(){return this.alpha(0)},c.prototype.prepareEdgeRouting=function(d){d===void 0&&(d=0),this._visibilityGraph=new o.TangentVisibilityGraph(this._nodes.map(function(v){return v.bounds.inflate(-d).vertices()}))},c.prototype.routeEdge=function(d,v,h){v===void 0&&(v=5);var p=[],y=new o.TangentVisibilityGraph(this._visibilityGraph.P,{V:this._visibilityGraph.V,E:this._visibilityGraph.E}),g={x:d.source.x,y:d.source.y},b={x:d.target.x,y:d.target.y},m=y.addPoint(g,d.source.index),x=y.addPoint(b,d.target.index);y.addEdgeIfVisible(g,b,d.source.index,d.target.index),typeof h<"u"&&h(y);var T=function(A){return A.source.id},S=function(A){return A.target.id},C=function(A){return A.length()},w=new i.Calculator(y.V.length,y.E,T,S,C),E=w.PathFromNodeToNode(m.id,x.id);if(E.length===1||E.length===y.V.length){var M=a.makeEdgeBetween(d.source.innerBounds,d.target.innerBounds,v);p=[M.sourceIntersection,M.arrowStart]}else{for(var L=E.length-2,D=y.V[E[L]].p,P=y.V[E[0]].p,p=[d.source.innerBounds.rayIntersection(D.x,D.y)],k=L;k>=0;--k)p.push(y.V[E[k]].p);p.push(a.makeEdgeTo(P,d.target.innerBounds,v))}return p},c.getSourceIndex=function(d){return typeof d.source=="number"?d.source:d.source.index},c.getTargetIndex=function(d){return typeof d.target=="number"?d.target:d.target.index},c.linkId=function(d){return c.getSourceIndex(d)+"-"+c.getTargetIndex(d)},c.dragStart=function(d){s(d)?c.storeOffset(d,c.dragOrigin(d)):(c.stopNode(d),d.fixed|=2)},c.stopNode=function(d){d.px=d.x,d.py=d.y},c.storeOffset=function(d,v){typeof d.leaves<"u"&&d.leaves.forEach(function(h){h.fixed|=2,c.stopNode(h),h._dragGroupOffsetX=h.x-v.x,h._dragGroupOffsetY=h.y-v.y}),typeof d.groups<"u"&&d.groups.forEach(function(h){return c.storeOffset(h,v)})},c.dragOrigin=function(d){return s(d)?{x:d.bounds.cx(),y:d.bounds.cy()}:d},c.drag=function(d,v){s(d)?(typeof d.leaves<"u"&&d.leaves.forEach(function(h){d.bounds.setXCentre(v.x),d.bounds.setYCentre(v.y),h.px=h._dragGroupOffsetX+v.x,h.py=h._dragGroupOffsetY+v.y}),typeof d.groups<"u"&&d.groups.forEach(function(h){return c.drag(h,v)})):(d.px=v.x,d.py=v.y)},c.dragEnd=function(d){s(d)?(typeof d.leaves<"u"&&d.leaves.forEach(function(v){c.dragEnd(v),delete v._dragGroupOffsetX,delete v._dragGroupOffsetY}),typeof d.groups<"u"&&d.groups.forEach(c.dragEnd)):d.fixed&=-7},c.mouseOver=function(d){d.fixed|=4,d.px=d.x,d.py=d.y},c.mouseOut=function(d){d.fixed&=-5},c}();t.Layout=f}(Ja)),Ja}var xs;function Qm(){if(xs)return Jr;xs=1;var t=We&&We.__extends||function(){var a=function(i,o){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,u){l.__proto__=u}||function(l,u){for(var s in u)u.hasOwnProperty(s)&&(l[s]=u[s])},a(i,o)};return function(i,o){a(i,o);function l(){this.constructor=i}i.prototype=o===null?Object.create(o):(l.prototype=o.prototype,new l)}}();Object.defineProperty(Jr,"__esModule",{value:!0});var e=On(),r=function(a){t(i,a);function i(o){var l=a.call(this)||this,u=o;return u.trigger&&(l.trigger=u.trigger),u.kick&&(l.kick=u.kick),u.drag&&(l.drag=u.drag),u.on&&(l.on=u.on),l.dragstart=l.dragStart=e.Layout.dragStart,l.dragend=l.dragEnd=e.Layout.dragEnd,l}return i.prototype.trigger=function(o){},i.prototype.kick=function(){},i.prototype.drag=function(){},i.prototype.on=function(o,l){return this},i}(e.Layout);Jr.LayoutAdaptor=r;function n(a){return new r(a)}return Jr.adaptor=n,Jr}var Zn={},tn={},ws;function Jm(){if(ws)return tn;ws=1;var t=We&&We.__extends||function(){var a=function(i,o){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,u){l.__proto__=u}||function(l,u){for(var s in u)u.hasOwnProperty(s)&&(l[s]=u[s])},a(i,o)};return function(i,o){a(i,o);function l(){this.constructor=i}i.prototype=o===null?Object.create(o):(l.prototype=o.prototype,new l)}}();Object.defineProperty(tn,"__esModule",{value:!0});var e=On(),r=function(a){t(i,a);function i(){var o=a.call(this)||this;o.event=d3.dispatch(e.EventType[e.EventType.start],e.EventType[e.EventType.tick],e.EventType[e.EventType.end]);var l=o;return o.drag=function(){if(!u)var u=d3.behavior.drag().origin(e.Layout.dragOrigin).on("dragstart.d3adaptor",e.Layout.dragStart).on("drag.d3adaptor",function(s){e.Layout.drag(s,d3.event),l.resume()}).on("dragend.d3adaptor",e.Layout.dragEnd);if(!arguments.length)return u;this.call(u)},o}return i.prototype.trigger=function(o){var l={type:e.EventType[o.type],alpha:o.alpha,stress:o.stress};this.event[l.type](l)},i.prototype.kick=function(){var o=this;d3.timer(function(){return a.prototype.tick.call(o)})},i.prototype.on=function(o,l){return typeof o=="string"?this.event.on(o,l):this.event.on(e.EventType[o],l),this},i}(e.Layout);tn.D3StyleLayoutAdaptor=r;function n(){return new r}return tn.d3adaptor=n,tn}var Qn={},Es;function jm(){if(Es)return Qn;Es=1;var t=We&&We.__extends||function(){var n=function(a,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,l){o.__proto__=l}||function(o,l){for(var u in l)l.hasOwnProperty(u)&&(o[u]=l[u])},n(a,i)};return function(a,i){n(a,i);function o(){this.constructor=a}a.prototype=i===null?Object.create(i):(o.prototype=i.prototype,new o)}}();Object.defineProperty(Qn,"__esModule",{value:!0});var e=On(),r=function(n){t(a,n);function a(i){var o=n.call(this)||this;o.d3Context=i,o.event=i.dispatch(e.EventType[e.EventType.start],e.EventType[e.EventType.tick],e.EventType[e.EventType.end]);var l=o;return o.drag=function(){if(!u)var u=i.drag().subject(e.Layout.dragOrigin).on("start.d3adaptor",e.Layout.dragStart).on("drag.d3adaptor",function(s){e.Layout.drag(s,i.event),l.resume()}).on("end.d3adaptor",e.Layout.dragEnd);if(!arguments.length)return u;arguments[0].call(u)},o}return a.prototype.trigger=function(i){var o={type:e.EventType[i.type],alpha:i.alpha,stress:i.stress};this.event.call(o.type,o)},a.prototype.kick=function(){var i=this,o=this.d3Context.timer(function(){return n.prototype.tick.call(i)&&o.stop()})},a.prototype.on=function(i,o){return typeof i=="string"?this.event.on(i,o):this.event.on(e.EventType[i],o),this},a}(e.Layout);return Qn.D3StyleLayoutAdaptor=r,Qn}var Cs;function e0(){if(Cs)return Zn;Cs=1,Object.defineProperty(Zn,"__esModule",{value:!0});var t=Jm(),e=jm();function r(a){return!a||n(a)?new t.D3StyleLayoutAdaptor:new e.D3StyleLayoutAdaptor(a)}Zn.d3adaptor=r;function n(a){var i=/^3\./;return a.version&&a.version.match(i)!==null}return Zn}var nr={},Ss;function hl(){if(Ss)return nr;Ss=1,Object.defineProperty(nr,"__esModule",{value:!0});var t=_n(),e=Vi(),r=Na(),n=function(){function l(u,s,f){this.id=u,this.rect=s,this.children=f,this.leaf=typeof f>"u"||f.length===0}return l}();nr.NodeWrapper=n;var a=function(){function l(u,s,f,c,d){c===void 0&&(c=null),d===void 0&&(d=null),this.id=u,this.x=s,this.y=f,this.node=c,this.line=d}return l}();nr.Vert=a;var i=function(){function l(u,s){this.s=u,this.t=s;var f=l.findMatch(u,s),c=s.slice(0).reverse(),d=l.findMatch(u,c);f.length>=d.length?(this.length=f.length,this.si=f.si,this.ti=f.ti,this.reversed=!1):(this.length=d.length,this.si=d.si,this.ti=s.length-d.ti-d.length,this.reversed=!0)}return l.findMatch=function(u,s){for(var f=u.length,c=s.length,d={length:0,si:-1,ti:-1},v=new Array(f),h=0;h d.length&&(d.length=y,d.si=h-y+1,d.ti=p-y+1)}else v[h][p]=0}return d},l.prototype.getSequence=function(){return this.length>=0?this.s.slice(this.si,this.si+this.length):[]},l}();nr.LongestCommonSubsequence=i;var o=function(){function l(u,s,f){var c=this;f===void 0&&(f=12),this.originalnodes=u,this.groupPadding=f,this.leaves=null,this.nodes=u.map(function(S,C){return new n(C,s.getBounds(S),s.getChildren(S))}),this.leaves=this.nodes.filter(function(S){return S.leaf}),this.groups=this.nodes.filter(function(S){return!S.leaf}),this.cols=this.getGridLines("x"),this.rows=this.getGridLines("y"),this.groups.forEach(function(S){return S.children.forEach(function(C){return c.nodes[C].parent=S})}),this.root={children:[]},this.nodes.forEach(function(S){typeof S.parent>"u"&&(S.parent=c.root,c.root.children.push(S.id)),S.ports=[]}),this.backToFront=this.nodes.slice(0),this.backToFront.sort(function(S,C){return c.getDepth(S)-c.getDepth(C)});var d=this.backToFront.slice(0).reverse().filter(function(S){return!S.leaf});d.forEach(function(S){var C=t.Rectangle.empty();S.children.forEach(function(w){return C=C.union(c.nodes[w].rect)}),S.rect=C.inflate(c.groupPadding)});var v=this.midPoints(this.cols.map(function(S){return S.pos})),h=this.midPoints(this.rows.map(function(S){return S.pos})),p=v[0],y=v[v.length-1],g=h[0],b=h[h.length-1],m=this.rows.map(function(S){return{x1:p,x2:y,y1:S.pos,y2:S.pos}}).concat(h.map(function(S){return{x1:p,x2:y,y1:S,y2:S}})),x=this.cols.map(function(S){return{x1:S.pos,x2:S.pos,y1:g,y2:b}}).concat(v.map(function(S){return{x1:S,x2:S,y1:g,y2:b}})),T=m.concat(x);T.forEach(function(S){return S.verts=[]}),this.verts=[],this.edges=[],m.forEach(function(S){return x.forEach(function(C){var w=new a(c.verts.length,C.x1,S.y1);S.verts.push(w),C.verts.push(w),c.verts.push(w);for(var E=c.backToFront.length;E-- >0;){var M=c.backToFront[E],L=M.rect,D=Math.abs(w.x-L.cx()),P=Math.abs(w.y-L.cy());if(D 0;){var c=f.filter(function(v){return v.rect["overlap"+u.toUpperCase()](f[0].rect)}),d={nodes:c,pos:this.avg(c.map(function(v){return v.rect["c"+u]()}))};s.push(d),d.nodes.forEach(function(v){return f.splice(f.indexOf(v),1)})}return s.sort(function(v,h){return v.pos-h.pos}),s},l.prototype.getDepth=function(u){for(var s=0;u.parent!==this.root;)s++,u=u.parent;return s},l.prototype.midPoints=function(u){for(var s=u[1]-u[0],f=[u[0]-s/2],c=1;c .1)&&(b={pos:p[0][s],segments:[]},g.push(b)),b.segments.push(p)}return g},l.nudgeSegs=function(u,s,f,c,d,v){var h=c.length;if(!(h<=1)){for(var p=c.map(function(M){return new e.Variable(M[0][u])}),y=[],g=0;g =0&&y.push(new e.Constraint(p[C],p[w],v))}var E=new e.Solver(p,y);E.solve(),p.forEach(function(M,L){var D=c[L],P=M.position();D[0][u]=D[1][u]=P;var k=f[D.edgeid];D.i>0&&(k[D.i-1][1][u]=P),D.i Math.PI||d<-Math.PI)&&(d=c-f),d},l.isLeft=function(u,s,f){return(s.x-u.x)*(f.y-u.y)-(s.y-u.y)*(f.x-u.x)<=0},l.getOrder=function(u){for(var s={},f=0;f "u"&&(s[c.l]={}),s[c.l][c.r]=!0}return function(d,v){return typeof s[d]<"u"&&s[d][v]}},l.orderEdges=function(u){for(var s=[],f=0;f =d.length||h.ti+h.length>=v.length)){s.push({l:f,r:c});continue}h.si+h.length>=d.length||h.ti+h.length>=v.length?(p=d[h.si+1],g=d[h.si-1],y=v[h.ti-1]):(p=d[h.si+h.length-2],y=d[h.si+h.length],g=v[h.ti+h.length]),l.isLeft(p,y,g)?s.push({l:c,r:f}):s.push({l:f,r:c})}}return l.getOrder(s)},l.makeSegments=function(u){function s(y){return{x:y.x,y:y.y}}for(var f=function(y,g,b){return Math.abs((g.x-y.x)*(b.y-y.y)-(g.y-y.y)*(b.x-y.x))<.001},c=[],d=s(u[0]),v=1;v 1&&A>1?1e3:0},S=x.PathFromNodeToNodeWithPrevCost(c.ports[0].id,d.ports[0].id,T),C=S.reverse().map(function(w){return f.verts[w]});return C.push(this.nodes[d.id].ports[0]),C.filter(function(w,E){return!(E 0&&w.node===d&&C[E-1].node===d)})},l.getRoutePath=function(u,s,f,c){var d={routepath:"M "+u[0][0].x+" "+u[0][0].y+" ",arrowpath:""};if(u.length>1)for(var v=0;v 0?p-=g/Math.abs(g)*s:y-=b/Math.abs(b)*s,d.routepath+="L "+p+" "+y+" ";var m=u[v+1],x=m[0].x,T=m[0].y,S=m[1].x,C=m[1].y;g=S-x,b=C-T;var w=l.angleBetween2Lines(h,m)<0?1:0,E,M;Math.abs(g)>0?(E=x+g/Math.abs(g)*s,M=T):(E=x,M=T+b/Math.abs(b)*s);var L=Math.abs(E-p),D=Math.abs(M-y);d.routepath+="A "+L+" "+D+" 0 0 "+w+" "+E+" "+M+" "}else{var P=[p,y],k,A;Math.abs(g)>0?(p-=g/Math.abs(g)*c,k=[p,y+f],A=[p,y-f]):(y-=b/Math.abs(b)*c,k=[p+f,y],A=[p-f,y]),d.routepath+="L "+p+" "+y+" ",c>0&&(d.arrowpath="M "+P[0]+" "+P[1]+" L "+k[0]+" "+k[1]+" L "+A[0]+" "+A[1])}}else{var h=u[0],p=h[1].x,y=h[1].y,g=p-h[0].x,b=y-h[0].y,P=[p,y],k,A;Math.abs(g)>0?(p-=g/Math.abs(g)*c,k=[p,y+f],A=[p,y-f]):(y-=b/Math.abs(b)*c,k=[p+f,y],A=[p-f,y]),d.routepath+="L "+p+" "+y+" ",c>0&&(d.arrowpath="M "+P[0]+" "+P[1]+" L "+k[0]+" "+k[1]+" L "+A[0]+" "+A[1])}return d},l}();return nr.GridRouter=o,nr}var Sr={},ks;function t0(){if(ks)return Sr;ks=1,Object.defineProperty(Sr,"__esModule",{value:!0});var t=Na(),e=$i(),r=_n(),n=Fi(),a=function(){function u(s,f){this.source=s,this.target=f}return u.prototype.actualLength=function(s){var f=this;return Math.sqrt(s.reduce(function(c,d){var v=d[f.target]-d[f.source];return c+v*v},0))},u}();Sr.Link3D=a;var i=function(){function u(s,f,c){s===void 0&&(s=0),f===void 0&&(f=0),c===void 0&&(c=0),this.x=s,this.y=f,this.z=c}return u}();Sr.Node3D=i;var o=function(){function u(s,f,c){var d=this;c===void 0&&(c=1),this.nodes=s,this.links=f,this.idealLinkLength=c,this.constraints=null,this.useJaccardLinkLengths=!0,this.result=new Array(u.k);for(var v=0;v "u"&&(h[b]=Math.random())}d.result[0][p]=h.x,d.result[1][p]=h.y,d.result[2][p]=h.z})}return u.prototype.linkLength=function(s){return s.actualLength(this.result)},u.prototype.start=function(s){var f=this;s===void 0&&(s=100);var c=this.nodes.length,d=new l;this.useJaccardLinkLengths&&n.jaccardLinkLengths(this.links,d,1.5),this.links.forEach(function(b){return b.length*=f.idealLinkLength});var v=new t.Calculator(c,this.links,function(b){return b.source},function(b){return b.target},function(b){return b.length}).DistanceMatrix(),h=e.Descent.createSquareMatrix(c,function(b,m){return v[b][m]}),p=e.Descent.createSquareMatrix(c,function(){return 2});this.links.forEach(function(b){var m=b.source,x=b.target;return p[m][x]=p[x][m]=1}),this.descent=new e.Descent(this.result,h),this.descent.threshold=.001,this.descent.G=p,this.constraints&&(this.descent.project=new r.Projection(this.nodes,null,null,this.constraints).projectFunctions());for(var y=0;y "u"?"undefined":o(m))===o("")},d=function(m){return(typeof m>"u"?"undefined":o(m))===o(0)},v=function(m){return m!=null&&(typeof m>"u"?"undefined":o(m))===o({})},h=function(m){return m!=null&&(typeof m>"u"?"undefined":o(m))===o(function(){})},p=function(){},y=function(m,x){if(h(m)){var T=m;return T.apply(x,[x])}else return m};function g(b){this.options=l({},u,b)}g.prototype.run=function(){var b=this,m=this.options;b.manuallyStopped=!1;var x=m.cy,T=m.eles,S=T.nodes(),C=T.edges(),w=!1,E=function(ne){return ne.isParent()},M=S.filter(E),L=S.subtract(M),D=m.boundingBox||{x1:0,y1:0,w:x.width(),h:x.height()};D.x2===void 0&&(D.x2=D.x1+D.w),D.w===void 0&&(D.w=D.x2-D.x1),D.y2===void 0&&(D.y2=D.y1+D.h),D.h===void 0&&(D.h=D.y2-D.y1);var P=function(){for(var ne=0;ne 0&&_.constraints($),_.groups(M.map(function(K,ne){var ae=y(m.nodeSpacing,K),J=function(me){return parseFloat(K.style("padding-"+me))},j=J("left")+ae,ue=J("right")+ae,oe=J("top")+ae,ie=J("bottom")+ae;return K.scratch().cola={index:ne,padding:Math.max(j,ue,oe,ie),leaves:K.children().intersection(L).map(function(le){return le[0].scratch().cola.index}),fixed:K.locked()},K}).map(function(K){return K.scratch().cola.groups=K.children().intersection(M).map(function(ne){return ne.scratch().cola.index}),K.scratch().cola}));var V=void 0,q=void 0;m.edgeLength!=null?(V=m.edgeLength,q="linkDistance"):m.edgeSymDiffLength!=null?(V=m.edgeSymDiffLength,q="symmetricDiffLinkLengths"):m.edgeJaccardLength!=null?(V=m.edgeJaccardLength,q="jaccardLinkLengths"):(V=100,q="linkDistance");var F=function(ne){return ne.calcLength};if(_.links(C.stdFilter(function(K){return L.contains(K.source())&&L.contains(K.target())}).map(function(K){var ne=K.scratch().cola={source:K.source()[0].scratch().cola.index,target:K.target()[0].scratch().cola.index};return V!=null&&(ne.calcLength=y(V,K)),ne})),_.size([D.w,D.h]),V!=null&&_[q](F),m.flow){var X=void 0,W="y",U=50;c(m.flow)?X={axis:m.flow,minSeparation:U}:d(m.flow)?X={axis:W,minSeparation:m.flow}:v(m.flow)?(X=m.flow,X.axis=X.axis||W,X.minSeparation=X.minSeparation!=null?X.minSeparation:U):X={axis:W,minSeparation:U},_.flowLayout(X.axis,X.minSeparation)}return b.trigger({type:"layoutstart",layout:b}),_.avoidOverlaps(m.avoidOverlap).handleDisconnected(m.handleDisconnected).start(m.unconstrIter,m.userConstIter,m.allConstIter,void 0,void 0,m.centerGraph),m.infinite||setTimeout(function(){b.manuallyStopped||_.stop()},m.maxSimulationTime),this},g.prototype.stop=function(){return this.adaptor&&(this.manuallyStopped=!0,this.adaptor.stop()),this},n.exports=g},function(n,a,i){n.exports=Object.assign!=null?Object.assign.bind(Object):function(o){for(var l=arguments.length,u=Array(l>1?l-1:0),s=1;s "u"?"undefined":o(window))!=="undefined"?l=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(u){return setTimeout(u,16)}:l=function(s){s()},n.exports=l},function(n,a){n.exports=r}])})})(Zm);const a0=Dl(vi);class i0{constructor(e,r={}){this._cy=e,this._params=r,this._node_dom={};let n=e.container();if(r.dom_container)this._nodes_dom_container=r.dom_container;else{let a=document.createElement("div");a.style.position="absolute",a.style.zIndex=10,n.querySelector("canvas").parentNode.appendChild(a),this._nodes_dom_container=a}this._resize_observer=new ResizeObserver(a=>{for(let i of a){let o=i.target,l=o.__cy_id;e.getElementById(l).style({width:o.offsetWidth,height:o.offsetHeight,shape:"rectangle"})}}),e.on("add","node",a=>{this._add_node(a.target)});for(let a of e.nodes())this._add_node(a);e.on("pan zoom",a=>{let i=e.pan(),o=e.zoom(),l="translate("+i.x+"px,"+i.y+"px) scale("+o+")";this._nodes_dom_container.style.msTransform=l,this._nodes_dom_container.style.transform=l}),e.on("position bounds","node",a=>{let i=a.target,o=i.id();if(!this._node_dom[o])return;let l=this._node_dom[o],u=`translate(-50%, -50%) translate(${i.position("x").toFixed(2)}px, ${i.position("y").toFixed(2)}px)`;l.style.webkitTransform=u,l.style.msTransform=u,l.style.transform=u,l.style.display="inline",l.style.position="absolute",l.style["z-index"]=10})}_add_node(e){let r=e.data();r.dom&&(this._nodes_dom_container.appendChild(r.dom),r.dom.__cy_id=e.id(),this._node_dom[e.id()]=r.dom,this._resize_observer.observe(r.dom))}node_dom(e){return this._node_dom[e]}}function pl(t){t&&t("core","domNode",function(e,r){return new i0(this,e,r)})}typeof cytoscape<"u"&&pl(cytoscape);var o0=pl;function Jn(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var hi={},s0={get exports(){return hi},set exports(t){hi=t}};(function(t,e){(function(r){t.exports=r()})(function(){return function r(n,a,i){function o(s,f){if(!a[s]){if(!n[s]){var c=typeof Jn=="function"&&Jn;if(!f&&c)return c(s,!0);if(l)return l(s,!0);var d=new Error("Cannot find module '"+s+"'");throw d.code="MODULE_NOT_FOUND",d}var v=a[s]={exports:{}};n[s][0].call(v.exports,function(h){var p=n[s][1][h];return o(p||h)},v,v.exports,r,n,a,i)}return a[s].exports}for(var l=typeof Jn=="function"&&Jn,u=0;u 0;if(!(!N&&!_)){var I=A.hasClass("cy-expand-collapse-collapsed-node"),R=w().expandCollapseCueSize,z=w().expandCollapseCueLineSize,$;if(w().expandCollapseCuePosition==="top-left"){var H=1,G=u.zoom()<1?R/(2*u.zoom()):R/2,V=parseFloat(A.css("border-width")),q=A.position("x")-A.width()/2-parseFloat(A.css("padding-left"))+V+G+H,F=A.position("y")-A.height()/2-parseFloat(A.css("padding-top"))+V+G+H;$={x:q,y:F}}else{var X=w().expandCollapseCuePosition;$=typeof X=="function"?X.call(this,A):X}var W=f.convertToRenderedPosition($);R=Math.max(R,R*u.zoom()),z=Math.max(z,z*u.zoom());var U=(R-z)/2,K=W.x,ne=W.y,ae=K-R/2,J=ne-R/2,j=R;if(I&&w().expandCueImage)L(w().expandCueImage,ae,J,R,R);else if(!I&&w().collapseCueImage)L(w().collapseCueImage,ae,J,R,R);else{var ue=m.fillStyle,oe=m.lineWidth,ie=m.strokeStyle;m.fillStyle="black",m.strokeStyle="black",m.ellipse(K,ne,R/2,R/2,0,0,2*Math.PI),m.fill(),m.beginPath(),m.strokeStyle="white",m.lineWidth=Math.max(2.6,2.6*u.zoom()),m.moveTo(ae+U,J+R/2),m.lineTo(ae+z+U,J+R/2),I&&(m.moveTo(ae+R/2,J+U),m.lineTo(ae+R/2,J+z+U)),m.closePath(),m.stroke(),m.strokeStyle=ie,m.fillStyle=ue,m.lineWidth=oe}A._private.data.expandcollapseRenderedStartX=ae,A._private.data.expandcollapseRenderedStartY=J,A._private.data.expandcollapseRenderedCueSize=j,v=A}}function L(A,B,_,N,I){var R=new Image(N,I);R.src=A,R.onload=()=>{m.drawImage(R,B,_,N,I)}}u.on("resize",C.eCyResize=function(){S()}),u.on("expandcollapse.clearvisualcue",function(){v&&E()});var D=null,P=null;u.on("mousedown",C.eMouseDown=function(A){D=A.renderedPosition||A.cyRenderedPosition}),u.on("mouseup",C.eMouseUp=function(A){P=A.renderedPosition||A.cyRenderedPosition}),u.on("remove","node",C.eRemove=function(A){A.target==v&&E()});var k;u.on("select unselect",C.eSelect=function(){v&&E();var A=u.nodes(":selected");if(A.length===1){var B=A[0];(B.isParent()||B.hasClass("cy-expand-collapse-collapsed-node"))&&M(B)}}),u.on("tap",C.eTap=function(A){var B=v;if(B){var _=B.data("expandcollapseRenderedStartX"),N=B.data("expandcollapseRenderedStartY"),I=B.data("expandcollapseRenderedCueSize"),R=_+I,z=N+I,$=A.renderedPosition||A.cyRenderedPosition,H=$.x,G=$.y,V=w(),q=(V.expandCollapseCueSensitivity-1)/2;Math.abs(D.x-P.x)<5&&Math.abs(D.y-P.y)<5&&H>=_-I*q&&H<=R+I*q&&G>=N-I*q&&G<=z+I*q&&(V.undoable&&!k&&(k=u.undoRedo({defaultActions:!1})),s.isCollapsible(B)?(E(),V.undoable?k.do("collapse",{nodes:B,options:V}):s.collapse(B,V)):s.isExpandable(B)&&(E(),V.undoable?k.do("expand",{nodes:B,options:V}):s.expand(B,V)),B.selectable()&&(B.unselectify(),u.scratch("_cyExpandCollapse").selectableChanged=!0))}}),u.on("afterUndo afterRedo",C.eUndoRedo=C.eSelect),u.on("position","node",C.ePosition=o(C.eSelect,d,E)),u.on("pan zoom",C.ePosition),C.hasEventFields=!0,p(C)},unbind:function(){var g=h();if(!g.hasEventFields){console.log("events to unbind does not exist");return}u.trigger("expandcollapse.clearvisualcue"),u.off("mousedown","node",g.eMouseDown).off("mouseup","node",g.eMouseUp).off("remove","node",g.eRemove).off("tap","node",g.eTap).off("add","node",g.eAdd).off("position","node",g.ePosition).off("pan zoom",g.ePosition).off("select unselect",g.eSelect).off("free","node",g.eFree).off("resize",g.eCyResize).off("afterUndo afterRedo",g.eUndoRedo)},rebind:function(){var g=h();if(!g.hasEventFields){console.log("events to rebind does not exist");return}u.on("mousedown","node",g.eMouseDown).on("mouseup","node",g.eMouseUp).on("remove","node",g.eRemove).on("tap","node",g.eTap).on("add","node",g.eAdd).on("position","node",g.ePosition).on("pan zoom",g.ePosition).on("select unselect",g.eSelect).on("free","node",g.eFree).on("resize",g.eCyResize).on("afterUndo afterRedo",g.eUndoRedo)}};if(y[c])return y[c].apply(u.container(),Array.prototype.slice.call(arguments,1));if(typeof c=="object"||!c)return y.init.apply(u.container(),arguments);throw new Error("No such function `"+c+"` for cytoscape.js-expand-collapse")}},{"./debounce":3,"./debounce2":4,"./elementUtilities":5}],3:[function(r,n,a){var i=function(){var o="Expected a function",l=Math.max,u=Date.now,s=u||function(){return new Date().getTime()};function f(d,v,h){var p,y,g,b,m,x,T,S=0,C=!1,w=!0;if(typeof d!="function")throw new TypeError(o);if(v=v<0?0:+v||0,h===!0){var E=!0;w=!1}else c(h)&&(E=!!h.leading,C="maxWait"in h&&l(+h.maxWait||0,v),w="trailing"in h?!!h.trailing:w);function M(){x&&clearTimeout(x),y&&clearTimeout(y),S=0,y=x=T=void 0}function L(A,B){B&&clearTimeout(B),y=x=T=void 0,A&&(S=s(),g=d.apply(m,p),!x&&!y&&(p=m=void 0))}function D(){var A=v-(s()-b);A<=0||A>v?L(T,y):x=setTimeout(D,A)}function P(){L(w,x)}function k(){if(p=arguments,b=s(),m=this,T=w&&(x||!E),C===!1)var A=E&&!x;else{!y&&!E&&(S=b);var B=C-(b-S),_=B<=0||B>C;_?(y&&(y=clearTimeout(y)),S=b,g=d.apply(m,p)):y||(y=setTimeout(P,B))}return _&&x?x=clearTimeout(x):!x&&v!==C&&(x=setTimeout(D,v)),A&&(_=!0,g=d.apply(m,p)),_&&!x&&!y&&(p=m=void 0),g}return k.cancel=M,k}function c(d){var v=typeof d;return!!d&&(v=="object"||v=="function")}return f}();n.exports=i},{}],4:[function(r,n,a){var i=function(){function o(l,u,s){let f,c=!0;return function(){const d=this,v=arguments,h=function(){f=null,l.apply(d,v),c=!0};clearTimeout(f),f=setTimeout(h,u),c&&(s.apply(d,v),c=!1)}}return o}();n.exports=i},{}],5:[function(r,n,a){function i(o){return{moveNodes:function(l,u,s){var f=s?u:this.getTopMostNodes(u),c=f.not(":parent");c.positions(function(p,y){return{x:c[y].position("x")+l.x,y:c[y].position("y")+l.y}});for(var d=0;d 0&&(this.collapseNode(s),s.removeData("collapse"))},expandTopDown:function(s,f){s.data("expand")&&s._private.data.collapsedChildren!=null&&(this.expandNode(s,f),s.removeData("expand"));for(var c=s.children(),d=0;d y?(b=b+S,m=m-S):(b=b-S,m=m+S),s._private.data["y-before-fisheye"]>g?(x=x+C,T=T-C):(x=x-C,T=T+C);for(var w=[],E=[],M=0;M D?A=b:A=m,g>P?B=x:B=T,isFinite(k)&&(_=Math.min(A,B/Math.abs(k))),k!==0&&(N=Math.min(B,A*Math.abs(k))),y>D&&(_=-1*_),g>P&&(N=-1*N),this.fishEyeViewMoveNode(L,_,N,c,f,d,v,h)}return p.length==0&&s.same(c)&&this.expandNodeBaseFunction(c,f,v),s.parent()[0]!=null&&this.fishEyeViewExpandGivenNode(s.parent()[0],f,c,d,v,h),s},getSiblings:function(s){var f;if(s.parent()[0]==null){var c=l.nodes(":visible").orphans();f=c.difference(s)}else f=s.siblings(":visible");return f},fishEyeViewMoveNode:function(s,f,c,d,v,h,p,y){var g=l.collection();s.isParent()&&(g=s.children(":visible"));var b=this;if(g.length==0){var m={x:s._private.position.x+f,y:s._private.position.y+c};!v||!h?s.position(m):(this.animatedlyMovingNodeCount++,s.animate({position:m,complete:function(){b.animatedlyMovingNodeCount--,!(b.animatedlyMovingNodeCount>0||!d.hasClass("cy-expand-collapse-collapsed-node"))&&b.expandNodeBaseFunction(d,v,p)}},{duration:y||1e3}))}else for(var x=0;x 0?c=c.add(h):c=c.add(v)}return c},expandEdge:function(s){s.unselect();var f={edges:l.collection(),oldEdges:l.collection()},c=s.data("collapsedEdges");return c!==void 0&&c.length>0&&(s.trigger("expandcollapse.beforeexpandedge"),f.oldEdges=f.oldEdges.add(s),l.remove(s),f.edges=l.add(c),s.trigger("expandcollapse.afterexpandedge")),f},isValidEdgesForCollapse:function(s){var f=this.getEdgesDistinctEndPoints(s);return f.length!=2?!1:f},getEdgesDistinctEndPoints:function(s){var f=[];return s.forEach(function(c){this.containsElement(f,c.source())||f.push(c.source()),this.containsElement(f,c.target())||f.push(c.target())}.bind(this)),f},containsElement:function(s,f){for(var c=!1,d=0;d [L,L]));var M={edges:p.collection(),oldEdges:p.collection()};return E.forEach(function(L){const D=L[1].id();var P=L[0].connectedEdges('[source = "'+D+'"],[target = "'+D+'"]');if(L[0].id()===D&&(P=L[0].connectedEdges('[source = "'+D+'"][target = "'+D+'"]')),P.length>=2){var k=y.collapseGivenEdges(P,C);M.oldEdges=M.oldEdges.add(k.oldEdges),M.edges=M.edges.add(k.edges)}}.bind(this)),M},g.expandEdgesBetweenNodes=function(x){var T=p.collection();function S(w){var E=[];return w.slice(0,w.length-1).forEach(function(M,L){var D=w.slice(L+1,w.length);D.forEach(function(P){E.push([M,P])})}),E}var C=S(x);return C.push(...x.map(w=>[w,w])),C.forEach(function(w){const E=w[1].id();var M=w[0].connectedEdges('.cy-expand-collapse-collapsed-edge[source = "'+E+'"],[target = "'+E+'"]');w[0].id()===E&&(M=w[0].connectedEdges('[source = "'+E+'"][target = "'+E+'"]')),T=T.union(M)}.bind(this)),this.expandEdges(T)},g.collapseAllEdges=function(x){return this.collapseEdgesBetweenNodes(p.edges().connectedNodes(),x)},g.expandAllEdges=function(){var x=p.edges(".cy-expand-collapse-collapsed-edge"),T={edges:p.collection(),oldEdges:p.collection()},S=this.expandEdges(x);return T.oldEdges=T.oldEdges.add(S.oldEdges),T.edges=T.edges.add(S.edges),T},g.loadJson=function(x){s.loadJson(x)},g.saveJson=function(x,T){s.saveJson(x,T)},g}function v(p,y){p.scratch("_cyExpandCollapse")===void 0&&p.scratch("_cyExpandCollapse",{});var g=p.scratch("_cyExpandCollapse"),b=y===void 0?g:g[y];return b}function h(p,y,g){v(p)[y]=g}o("core","expandCollapse",function(p){var y=this,g=v(y,"options")||{layoutBy:null,fisheye:!0,animate:!0,animationDuration:1e3,ready:function(){},undoable:!0,cueEnabled:!0,expandCollapseCuePosition:"top-left",expandCollapseCueSize:12,expandCollapseCueLineSize:8,expandCueImage:void 0,collapseCueImage:void 0,expandCollapseCueSensitivity:1,edgeTypeInfo:"edgeType",groupEdgesOfSameTypeOnCollapse:!1,allowNestedEdgeCollapse:!0,zIndex:999};if(p!=="get"){g=f(g,p);var b=r("./expandCollapseUtilities")(y),m=d(y,b);s=r("./saveLoadUtilities")(y,m),h(y,"api",m),l(y,m),u(g,y,m),g.cueEnabled||u("unbind",y,m),g.ready&&g.ready(),h(y,"options",g);var x={};h(y,"parentData",x)}return v(y,"api")})};typeof n<"u"&&n.exports&&(n.exports=i),typeof cytoscape<"u"&&i(cytoscape)})()},{"./cueUtilities":2,"./expandCollapseUtilities":6,"./saveLoadUtilities":8,"./undoRedoUtilities":9}],8:[function(r,n,a){function i(o,l){function u(v,h,p,y){v.sort(b=>b.group==="edges"?1:-1);let g=o.collection();for(let b=0;b 0?o[T](S.options):o[T](w,S.options)):(C.oldData=s(),C.nodes=T.indexOf("All")>0?o[T](c):o[T](i.collection(w),c),f(S.oldData)),C}}for(var v=["collapse","collapseRecursively","collapseAll","expand","expandRecursively","expandAll"],h=0;h 0&&T.oldEdges.length>0&&(i.remove(T.edges),i.add(T.oldEdges));return w}function y(T){var S=T.options,C={};if(C.options=S,T.firstTime){var w=o.collapseEdgesBetweenNodes(T.nodes,S);C.edges=w.edges,C.oldEdges=w.oldEdges,C.firstTime=!1}else C.edges=T.oldEdges,C.oldEdges=T.edges,T.edges.length>0&&T.oldEdges.length>0&&(i.remove(T.edges),i.add(T.oldEdges));return C}function g(T){var S=T.options,C={};if(C.options=S,T.firstTime){var w=o.collapseAllEdges(S);C.edges=w.edges,C.oldEdges=w.oldEdges,C.firstTime=!1}else C.edges=T.oldEdges,C.oldEdges=T.edges,T.edges.length>0&&T.oldEdges.length>0&&(i.remove(T.edges),i.add(T.oldEdges));return C}function b(T){var S=T.options,C={};if(C.options=S,T.firstTime){var w=o.expandEdges(T.edges);C.edges=w.edges,C.oldEdges=w.oldEdges,C.firstTime=!1}else C.oldEdges=T.edges,C.edges=T.oldEdges,T.edges.length>0&&T.oldEdges.length>0&&(i.remove(T.edges),i.add(T.oldEdges));return C}function m(T){var S=T.options,C={};if(C.options=S,T.firstTime){var w=o.expandEdgesBetweenNodes(T.nodes,S);C.edges=w.edges,C.oldEdges=w.oldEdges,C.firstTime=!1}else C.edges=T.oldEdges,C.oldEdges=T.edges,T.edges.length>0&&T.oldEdges.length>0&&(i.remove(T.edges),i.add(T.oldEdges));return C}function x(T){var S=T.options,C={};if(C.options=S,T.firstTime){var w=o.expandAllEdges(S);C.edges=w.edges,C.oldEdges=w.oldEdges,C.firstTime=!1}else C.edges=T.oldEdges,C.oldEdges=T.edges,T.edges.length>0&&T.oldEdges.length>0&&(i.remove(T.edges),i.add(T.oldEdges));return C}l.action("collapseEdges",p,b),l.action("expandEdges",b,p),l.action("collapseEdgesBetweenNodes",y,m),l.action("expandEdgesBetweenNodes",m,y),l.action("collapseAllEdges",g,x),l.action("expandAllEdges",x,g)}},{}]},{},[7])(7)})})(s0);const u0=hi;window.onerror=t=>{const e=document.createElement("pre");e.className="error",e.innerHTML=JSON.stringify(t,void 0,4),document.body.prepend(e)};const l0=[{id:"backend",label:"Graphics Backend"},{id:"frontend",label:"Graphics Frontend"},{id:"gpu",img:"gpu.png",label:"Video Card"},{parent:"backend",id:"decoder",label:"Decoder"},{parent:"backend",id:"texturecache",label:"Texture Cache",html:"texturecache"},{parent:"backend",id:"renderer",label:"Renderer",img:"webgl.png"},{parent:"backend",id:"backendscene",html:"linearscene",label:"Scene"},{source:"decoder",target:"backendscene",label:"Builds"},{source:"decoder",target:"texturecache"},{source:"frontend",target:"decoder"},{source:"renderer",target:"gpu"},{source:"renderer",target:"backendscene",label:"Renders"}],f0={container:document.getElementById("cy"),wheelSensitivity:.1,style:[{selector:"node",style:{width:"200",height:"200"}},{selector:"[label]",style:{label:"data(label)","text-valign":"top","text-halign":"right","font-family":"Chewy","text-rotation":"30deg","text-wrap":"wrap","text-max-width":120,"font-size":"66%"}},{selector:"$[label] > node",style:{"background-opacity":0,"border-opacity":0,label:""}},{selector:"[img]",style:{"background-opacity":1,padding:"50px","border-radius":"50px"}},{selector:"edge",style:{width:12,"source-arrow-shape":"none","target-arrow-shape":"triangle","curve-style":"bezier","arrow-scale":3}},{selector:"edge[label]",style:{"text-background-padding":"5px","text-background-color":"#eee","text-background-opacity":1,"text-border-color":"black","text-border-opacity":1,"text-border-width":3}}]};function c0(t){const e=[],r=[],n=[];return n.push({axis:"y",left:t.$id("backend"),right:t.$id("gpu"),gap:500,equality:!0},{axis:"y",left:t.$id("frontend"),right:t.$id("backend"),gap:1500,equality:!0}),t.$id("backendscene").length&&(e.push([{node:t.$id("renderer"),offset:0},{node:t.$id("backendscene"),offset:0}]),r.push([{node:t.$id("renderer"),offset:0},{node:t.$id("gpu"),offset:0}])),r.push([{node:t.$id("backend"),offset:0},{node:t.$id("gpu"),offset:0}]),{name:"cola",animate:!0,randomize:!0,fit:!0,infinite:!1,nodeSpacing(){return 300},alignment:{horizontal:e,vertical:r},gapInequalities:n}}let oa=null;function gl({cy:t}){oa&&oa.stop(),oa=t.layout(c0(t))}gl.prototype.run=()=>oa.run();function d0(t){t("layout","dynamic",gl)}An.use(a0);An.use(o0);An.use(u0);An.use(d0);const Pt=An(f0);window.cy=Pt;Pt.domNode();Pt.expandCollapse({fisheye:!0,undoable:!1,layoutBy:{name:"dynamic"}});const v0=window.collapse=Pt.expandCollapse("get");l0.map(t=>({data:t})).map(function(e){if("img"in e.data){const r=document.createElement("img");r.src=`/icons/${e.data.img}`,Object.assign(e.data,{dom:r})}else if("html"in e.data){const n=document.getElementById(e.data.html).content.firstElementChild.cloneNode(!0);Object.assign(e.data,{dom:n})}return e}).forEach(t=>{Pt.add(t)});Pt.on("expandcollapse.beforecollapse",t=>{const e=t.target;e.descendants("[html]").forEach(r=>r.data("dom").remove()),e.descendants("[img]").data("dom").remove()});v0.collapseAll();function yl(){const t=window.innerWidth,e=window.innerHeight;Pt.container().style.width=`${t}px`,Pt.container().style.height=`${e}px`,Pt.resize(),Pt.center()}window.addEventListener("resize",yl);yl(); diff --git a/app/editor/icons/asset.png b/app/editor/icons/asset.png deleted file mode 100644 index 412d0c36..00000000 Binary files a/app/editor/icons/asset.png and /dev/null differ diff --git a/app/editor/icons/component.body.png b/app/editor/icons/component.body.png deleted file mode 100644 index c17006d4..00000000 Binary files a/app/editor/icons/component.body.png and /dev/null differ diff --git a/app/editor/icons/component.mesh.png b/app/editor/icons/component.mesh.png deleted file mode 100644 index 403b559d..00000000 Binary files a/app/editor/icons/component.mesh.png and /dev/null differ diff --git a/app/editor/icons/ctxmenu.png b/app/editor/icons/ctxmenu.png deleted file mode 100644 index d944188b..00000000 Binary files a/app/editor/icons/ctxmenu.png and /dev/null differ diff --git a/app/editor/icons/entity.png b/app/editor/icons/entity.png deleted file mode 100644 index dcdcb441..00000000 Binary files a/app/editor/icons/entity.png and /dev/null differ diff --git a/app/editor/icons/gpu.png b/app/editor/icons/gpu.png deleted file mode 100644 index 8f7a5e77..00000000 Binary files a/app/editor/icons/gpu.png and /dev/null differ diff --git a/app/editor/icons/script.png b/app/editor/icons/script.png deleted file mode 100644 index fc2ae098..00000000 Binary files a/app/editor/icons/script.png and /dev/null differ diff --git a/app/editor/icons/threejs.png b/app/editor/icons/threejs.png deleted file mode 100644 index 54a5b4bd..00000000 Binary files a/app/editor/icons/threejs.png and /dev/null differ diff --git a/app/editor/icons/webgl.png b/app/editor/icons/webgl.png deleted file mode 100644 index 09bfd74f..00000000 Binary files a/app/editor/icons/webgl.png and /dev/null differ diff --git a/app/editor/index.html b/app/editor/index.html deleted file mode 100644 index 62c03f99..00000000 --- a/app/editor/index.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - - Graph Theory - - - - - - - -- - - - -- - -- - - - -- - - - - - \ No newline at end of file diff --git a/game/assets/_frog.14521c56.js b/game/assets/_frog.14521c56.js new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/game/assets/_frog.14521c56.js @@ -0,0 +1 @@ + diff --git a/game/assets/barbarian.0e5d7d73.js b/game/assets/barbarian.0e5d7d73.js new file mode 100644 index 00000000..9a08340a --- /dev/null +++ b/game/assets/barbarian.0e5d7d73.js @@ -0,0 +1 @@ +import{w as a,M as i,g as r,p as m,a as b,P as w}from"./game.2c5cd34a.js";import{G as u}from"./script.3b5942bc.js";import o,{Death as f}from"./health.350d3aae.js";class n{}class v extends u{initialize(){window.webApi&&window.webApi.onmessage("barbarian",()=>{this.spawnBarbarian()}),this.spawnBarbarian()}every_frame(){a.do_with([i,n,f],([s],e)=>{r.removeObjectFromScene(s),a.deleteEntity(e)})}async spawnBarbarian(){const c=a.createEntity(),h=m.createCapsule({mass:10,isGhost:!1,shouldRotate:!1},{pos:[0,50,30],scale:[1,1,1],quat:[0,0,0,1]},{radius:.7,height:1.7}),t=await b.loadModel({uri:"./models/villager-male/villager-male.glb"});r.addObjectToScene(t);const p=new o(1,1),d={};a.put(c,[i,w,o,n],[t,h,p,d])}}export{n as BarbarianData,v as default}; diff --git a/game/assets/damage.system.bf097bc4.js b/game/assets/damage.system.bf097bc4.js new file mode 100644 index 00000000..2f51c63f --- /dev/null +++ b/game/assets/damage.system.bf097bc4.js @@ -0,0 +1 @@ +import l from"./health.350d3aae.js";import"./game.2c5cd34a.js";const o=new Map;function m(a,h){o.has(a)||o.set(a,[]),o.get(a).push(h)}const r=a=>h=>s=>{var c;if(a.has(s,l)){const[t]=a.get(s,[l]);t.hp-=h;for(const e of(c=o.get(s))!=null?c:[])e()}};export{m as addDamageCallback,r as dealDamage}; diff --git a/game/assets/ecs.5fc7adf1.js b/game/assets/ecs.5fc7adf1.js new file mode 100644 index 00000000..27381527 --- /dev/null +++ b/game/assets/ecs.5fc7adf1.js @@ -0,0 +1 @@ +import{w as e}from"./game.2c5cd34a.js";function r(){return e.createEntity()}function u(t){e.deleteEntity(t)}function c(t){return e.entityExists(t)}function f(t,n,o){e.put(t,n,o)}function p(t,n){e.deleteComponent(t,n)}function m(t,n){return e.get(t,n)}export{r as createEntity,p as deleteComponent,u as deleteEntity,c as entityExists,m as getComponent,f as setComponent}; diff --git a/game/assets/game.2c5cd34a.js b/game/assets/game.2c5cd34a.js new file mode 100644 index 00000000..8bf8e74d --- /dev/null +++ b/game/assets/game.2c5cd34a.js @@ -0,0 +1,3162 @@ +var Op2=Object.defineProperty;var Gp2=(B,h,v)=>h in B?Op2(B,h,{enumerable:!0,configurable:!0,writable:!0,value:v}):B[h]=v;var oi=(B,h,v)=>(Gp2(B,typeof h!="symbol"?h+"":h,v),v),fH=(B,h,v)=>{if(!h.has(B))throw TypeError("Cannot "+v)};var zt=(B,h,v)=>(fH(B,h,"read from private field"),v?v.call(B):h.get(B)),_0=(B,h,v)=>{if(h.has(B))throw TypeError("Cannot add the same private member more than once");h instanceof WeakSet?h.add(B):h.set(B,v)},bs=(B,h,v,S)=>(fH(B,h,"write to private field"),S?S.call(B,v):h.set(B,v),v);const PU={};const Np2=function(){const h=document.createElement("link").relList;if(h&&h.supports&&h.supports("modulepreload"))return;for(const b of document.querySelectorAll('link[rel="modulepreload"]'))S(b);new MutationObserver(b=>{for(const D of b)if(D.type==="childList")for(const F of D.addedNodes)F.tagName==="LINK"&&F.rel==="modulepreload"&&S(F)}).observe(document,{childList:!0,subtree:!0});function v(b){const D={};return b.integrity&&(D.integrity=b.integrity),b.referrerpolicy&&(D.referrerPolicy=b.referrerpolicy),b.crossorigin==="use-credentials"?D.credentials="include":b.crossorigin==="anonymous"?D.credentials="omit":D.credentials="same-origin",D}function S(b){if(b.ep)return;b.ep=!0;const D=v(b);fetch(b.href,D)}};Np2();const Wp2="modulepreload",pH={},Hp2="/",Rn=function(h,v){return!v||v.length===0?h():Promise.all(v.map(S=>{if(S=`${Hp2}${S}`,S in pH)return;pH[S]=!0;const b=S.endsWith(".css"),D=b?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${S}"]${D}`))return;const F=document.createElement("link");if(F.rel=b?"stylesheet":Wp2,b||(F.as="script",F.crossOrigin=""),F.href=S,document.head.appendChild(F),b)return new Promise((G,a)=>{F.addEventListener("load",G),F.addEventListener("error",()=>a(new Error(`Unable to preload CSS for ${S}`)))})})).then(()=>h())};var Vp2=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function nd2(B){return B&&B.__esModule&&Object.prototype.hasOwnProperty.call(B,"default")?B.default:B}var $h={exports:{}},zu=typeof Reflect=="object"?Reflect:null,cH=zu&&typeof zu.apply=="function"?zu.apply:function(h,v,S){return Function.prototype.apply.call(h,v,S)},z8;zu&&typeof zu.ownKeys=="function"?z8=zu.ownKeys:Object.getOwnPropertySymbols?z8=function(h){return Object.getOwnPropertyNames(h).concat(Object.getOwnPropertySymbols(h))}:z8=function(h){return Object.getOwnPropertyNames(h)};function zp2(B){console&&console.warn&&console.warn(B)}var sz=Number.isNaN||function(h){return h!==h};function Ln(){Ln.init.call(this)}$h.exports=Ln;$h.exports.once=qp2;Ln.EventEmitter=Ln;Ln.prototype._events=void 0;Ln.prototype._eventsCount=0;Ln.prototype._maxListeners=void 0;var _H=10;function nc(B){if(typeof B!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof B)}Object.defineProperty(Ln,"defaultMaxListeners",{enumerable:!0,get:function(){return _H},set:function(B){if(typeof B!="number"||B<0||sz(B))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+B+".");_H=B}});Ln.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};Ln.prototype.setMaxListeners=function(h){if(typeof h!="number"||h<0||sz(h))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+h+".");return this._maxListeners=h,this};function uz(B){return B._maxListeners===void 0?Ln.defaultMaxListeners:B._maxListeners}Ln.prototype.getMaxListeners=function(){return uz(this)};Ln.prototype.emit=function(h){for(var v=[],S=1;S0&&(F=v[0]),F instanceof Error)throw F;var G=new Error("Unhandled error."+(F?" ("+F.message+")":""));throw G.context=F,G}var a=D[h];if(a===void 0)return!1;if(typeof a=="function")cH(a,this,v);else for(var z=a.length,X=_z(a,z),S=0;S 0&&F.length>b&&!F.warned){F.warned=!0;var G=new Error("Possible EventEmitter memory leak detected. "+F.length+" "+String(h)+" listeners added. Use emitter.setMaxListeners() to increase limit");G.name="MaxListenersExceededWarning",G.emitter=B,G.type=h,G.count=F.length,zp2(G)}return B}Ln.prototype.addListener=function(h,v){return lz(this,h,v,!1)};Ln.prototype.on=Ln.prototype.addListener;Ln.prototype.prependListener=function(h,v){return lz(this,h,v,!0)};function Up2(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function fz(B,h,v){var S={fired:!1,wrapFn:void 0,target:B,type:h,listener:v},b=Up2.bind(S);return b.listener=v,S.wrapFn=b,b}Ln.prototype.once=function(h,v){return nc(v),this.on(h,fz(this,h,v)),this};Ln.prototype.prependOnceListener=function(h,v){return nc(v),this.prependListener(h,fz(this,h,v)),this};Ln.prototype.removeListener=function(h,v){var S,b,D,F,G;if(nc(v),b=this._events,b===void 0)return this;if(S=b[h],S===void 0)return this;if(S===v||S.listener===v)--this._eventsCount===0?this._events=Object.create(null):(delete b[h],b.removeListener&&this.emit("removeListener",h,S.listener||v));else if(typeof S!="function"){for(D=-1,F=S.length-1;F>=0;F--)if(S[F]===v||S[F].listener===v){G=S[F].listener,D=F;break}if(D<0)return this;D===0?S.shift():Qp2(S,D),S.length===1&&(b[h]=S[0]),b.removeListener!==void 0&&this.emit("removeListener",h,G||v)}return this};Ln.prototype.off=Ln.prototype.removeListener;Ln.prototype.removeAllListeners=function(h){var v,S,b;if(S=this._events,S===void 0)return this;if(S.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):S[h]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete S[h]),this;if(arguments.length===0){var D=Object.keys(S),F;for(b=0;b =0;b--)this.removeListener(h,v[b]);return this};function pz(B,h,v){var S=B._events;if(S===void 0)return[];var b=S[h];return b===void 0?[]:typeof b=="function"?v?[b.listener||b]:[b]:v?Yp2(b):_z(b,b.length)}Ln.prototype.listeners=function(h){return pz(this,h,!0)};Ln.prototype.rawListeners=function(h){return pz(this,h,!1)};Ln.listenerCount=function(B,h){return typeof B.listenerCount=="function"?B.listenerCount(h):cz.call(B,h)};Ln.prototype.listenerCount=cz;function cz(B){var h=this._events;if(h!==void 0){var v=h[B];if(typeof v=="function")return 1;if(v!==void 0)return v.length}return 0}Ln.prototype.eventNames=function(){return this._eventsCount>0?z8(this._events):[]};function _z(B,h){for(var v=new Array(h),S=0;S =0;S--)v=[h[S].apply(this,v)];return v[0]}},each:function(h,v,S){if(!!h){if(hH&&h.forEach&&h.forEach===hH)h.forEach(v,S);else if(h.length===h.length+0){var b=void 0,D=void 0;for(b=0,D=h.length;b 1?at.toArray(arguments):arguments[0];return at.each(Jp2,function(v){if(v.litmus(h))return at.each(v.conversions,function(S,b){if(yf=S.read(h),l8===!1&&yf!==!1)return l8=yf,yf.conversionName=b,yf.conversion=S,at.BREAK}),at.BREAK}),l8},aH=void 0,q8={hsv_to_rgb:function(h,v,S){var b=Math.floor(h/60)%6,D=h/60-Math.floor(h/60),F=S*(1-v),G=S*(1-D*v),a=S*(1-(1-D)*v),z=[[S,a,F],[G,S,F],[F,S,a],[F,G,S],[a,F,S],[S,F,G]][b];return{r:z[0]*255,g:z[1]*255,b:z[2]*255}},rgb_to_hsv:function(h,v,S){var b=Math.min(h,v,S),D=Math.max(h,v,S),F=D-b,G=void 0,a=void 0;if(D!==0)a=F/D;else return{h:NaN,s:0,v:0};return h===D?G=(v-S)/F:v===D?G=2+(S-h)/F:G=4+(h-v)/F,G/=6,G<0&&(G+=1),{h:G*360,s:a,v:D/255}},rgb_to_hex:function(h,v,S){var b=this.hex_with_component(0,2,h);return b=this.hex_with_component(b,1,v),b=this.hex_with_component(b,0,S),b},component_from_hex:function(h,v){return h>>v*8&255},hex_with_component:function(h,v,S){return S<<(aH=v*8)|h&~(255< -1?h.length-h.indexOf(".")-1:0}var dz=function(B){n1(h,B);function h(v,S,b){Ur(this,h);var D=i1(this,(h.__proto__||Object.getPrototypeOf(h)).call(this,v,S)),F=b||{};return D.__min=F.min,D.__max=F.max,D.__step=F.step,at.isUndefined(D.__step)?D.initialValue===0?D.__impliedStep=1:D.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(D.initialValue))/Math.LN10))/10:D.__impliedStep=D.__step,D.__precision=mH(D.__impliedStep),D}return Qr(h,[{key:"setValue",value:function(S){var b=S;return this.__min!==void 0&&b this.__max&&(b=this.__max),this.__step!==void 0&&b%this.__step!==0&&(b=Math.round(b/this.__step)*this.__step),Ks(h.prototype.__proto__||Object.getPrototypeOf(h.prototype),"setValue",this).call(this,b)}},{key:"min",value:function(S){return this.__min=S,this}},{key:"max",value:function(S){return this.__max=S,this}},{key:"step",value:function(S){return this.__step=S,this.__impliedStep=S,this.__precision=mH(S),this}}]),h}(O1);function r42(B,h){var v=Math.pow(10,h);return Math.round(B*v)/v}var Z8=function(B){n1(h,B);function h(v,S,b){Ur(this,h);var D=i1(this,(h.__proto__||Object.getPrototypeOf(h)).call(this,v,S,b));D.__truncationSuspended=!1;var F=D,G=void 0;function a(){var f2=parseFloat(F.__input.value);at.isNaN(f2)||F.setValue(f2)}function z(){F.__onFinishChange&&F.__onFinishChange.call(F,F.getValue())}function X(){z()}function J(f2){var c2=G-f2.clientY;F.setValue(F.getValue()+c2*F.__impliedStep),G=f2.clientY}function t2(){q2.unbind(window,"mousemove",J),q2.unbind(window,"mouseup",t2),z()}function i2(f2){q2.bind(window,"mousemove",J),q2.bind(window,"mouseup",t2),G=f2.clientY}return D.__input=document.createElement("input"),D.__input.setAttribute("type","text"),q2.bind(D.__input,"change",a),q2.bind(D.__input,"blur",X),q2.bind(D.__input,"mousedown",i2),q2.bind(D.__input,"keydown",function(f2){f2.keyCode===13&&(F.__truncationSuspended=!0,this.blur(),F.__truncationSuspended=!1,z())}),D.updateDisplay(),D.domElement.appendChild(D.__input),D}return Qr(h,[{key:"updateDisplay",value:function(){return this.__input.value=this.__truncationSuspended?this.getValue():r42(this.getValue(),this.__precision),Ks(h.prototype.__proto__||Object.getPrototypeOf(h.prototype),"updateDisplay",this).call(this)}}]),h}(dz);function dH(B,h,v,S,b){return S+(b-S)*((B-h)/(v-h))}var dh=function(B){n1(h,B);function h(v,S,b,D,F){Ur(this,h);var G=i1(this,(h.__proto__||Object.getPrototypeOf(h)).call(this,v,S,{min:b,max:D,step:F})),a=G;G.__background=document.createElement("div"),G.__foreground=document.createElement("div"),q2.bind(G.__background,"mousedown",z),q2.bind(G.__background,"touchstart",t2),q2.addClass(G.__background,"slider"),q2.addClass(G.__foreground,"slider-fg");function z(c2){document.activeElement.blur(),q2.bind(window,"mousemove",X),q2.bind(window,"mouseup",J),X(c2)}function X(c2){c2.preventDefault();var A2=a.__background.getBoundingClientRect();return a.setValue(dH(c2.clientX,A2.left,A2.right,a.__min,a.__max)),!1}function J(){q2.unbind(window,"mousemove",X),q2.unbind(window,"mouseup",J),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function t2(c2){c2.touches.length===1&&(q2.bind(window,"touchmove",i2),q2.bind(window,"touchend",f2),i2(c2))}function i2(c2){var A2=c2.touches[0].clientX,o2=a.__background.getBoundingClientRect();a.setValue(dH(A2,o2.left,o2.right,a.__min,a.__max))}function f2(){q2.unbind(window,"touchmove",i2),q2.unbind(window,"touchend",f2),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return G.updateDisplay(),G.__background.appendChild(G.__foreground),G.domElement.appendChild(G.__background),G}return Qr(h,[{key:"updateDisplay",value:function(){var S=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=S*100+"%",Ks(h.prototype.__proto__||Object.getPrototypeOf(h.prototype),"updateDisplay",this).call(this)}}]),h}(dz),Az=function(B){n1(h,B);function h(v,S,b){Ur(this,h);var D=i1(this,(h.__proto__||Object.getPrototypeOf(h)).call(this,v,S)),F=D;return D.__button=document.createElement("div"),D.__button.innerHTML=b===void 0?"Fire":b,q2.bind(D.__button,"click",function(G){return G.preventDefault(),F.fire(),!1}),q2.addClass(D.__button,"button"),D.domElement.appendChild(D.__button),D}return Qr(h,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),h}(O1),Ah=function(B){n1(h,B);function h(v,S){Ur(this,h);var b=i1(this,(h.__proto__||Object.getPrototypeOf(h)).call(this,v,S));b.__color=new G0(b.getValue()),b.__temp=new G0(0);var D=b;b.domElement=document.createElement("div"),q2.makeSelectable(b.domElement,!1),b.__selector=document.createElement("div"),b.__selector.className="selector",b.__saturation_field=document.createElement("div"),b.__saturation_field.className="saturation-field",b.__field_knob=document.createElement("div"),b.__field_knob.className="field-knob",b.__field_knob_border="2px solid ",b.__hue_knob=document.createElement("div"),b.__hue_knob.className="hue-knob",b.__hue_field=document.createElement("div"),b.__hue_field.className="hue-field",b.__input=document.createElement("input"),b.__input.type="text",b.__input_textShadow="0 1px 1px ",q2.bind(b.__input,"keydown",function(c2){c2.keyCode===13&&J.call(this)}),q2.bind(b.__input,"blur",J),q2.bind(b.__selector,"mousedown",function(){q2.addClass(this,"drag").bind(window,"mouseup",function(){q2.removeClass(D.__selector,"drag")})}),q2.bind(b.__selector,"touchstart",function(){q2.addClass(this,"drag").bind(window,"touchend",function(){q2.removeClass(D.__selector,"drag")})});var F=document.createElement("div");at.extend(b.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),at.extend(b.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:b.__field_knob_border+(b.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),at.extend(b.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),at.extend(b.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),at.extend(F.style,{width:"100%",height:"100%",background:"none"}),AH(F,"top","rgba(0,0,0,0)","#000"),at.extend(b.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),s42(b.__hue_field),at.extend(b.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:b.__input_textShadow+"rgba(0,0,0,0.7)"}),q2.bind(b.__saturation_field,"mousedown",G),q2.bind(b.__saturation_field,"touchstart",G),q2.bind(b.__field_knob,"mousedown",G),q2.bind(b.__field_knob,"touchstart",G),q2.bind(b.__hue_field,"mousedown",a),q2.bind(b.__hue_field,"touchstart",a);function G(c2){i2(c2),q2.bind(window,"mousemove",i2),q2.bind(window,"touchmove",i2),q2.bind(window,"mouseup",z),q2.bind(window,"touchend",z)}function a(c2){f2(c2),q2.bind(window,"mousemove",f2),q2.bind(window,"touchmove",f2),q2.bind(window,"mouseup",X),q2.bind(window,"touchend",X)}function z(){q2.unbind(window,"mousemove",i2),q2.unbind(window,"touchmove",i2),q2.unbind(window,"mouseup",z),q2.unbind(window,"touchend",z),t2()}function X(){q2.unbind(window,"mousemove",f2),q2.unbind(window,"touchmove",f2),q2.unbind(window,"mouseup",X),q2.unbind(window,"touchend",X),t2()}function J(){var c2=mh(this.value);c2!==!1?(D.__color.__state=c2,D.setValue(D.__color.toOriginal())):this.value=D.__color.toString()}function t2(){D.__onFinishChange&&D.__onFinishChange.call(D,D.__color.toOriginal())}b.__saturation_field.appendChild(F),b.__selector.appendChild(b.__field_knob),b.__selector.appendChild(b.__saturation_field),b.__selector.appendChild(b.__hue_field),b.__hue_field.appendChild(b.__hue_knob),b.domElement.appendChild(b.__input),b.domElement.appendChild(b.__selector),b.updateDisplay();function i2(c2){c2.type.indexOf("touch")===-1&&c2.preventDefault();var A2=D.__saturation_field.getBoundingClientRect(),o2=c2.touches&&c2.touches[0]||c2,u2=o2.clientX,x2=o2.clientY,k2=(u2-A2.left)/(A2.right-A2.left),E2=1-(x2-A2.top)/(A2.bottom-A2.top);return E2>1?E2=1:E2<0&&(E2=0),k2>1?k2=1:k2<0&&(k2=0),D.__color.v=E2,D.__color.s=k2,D.setValue(D.__color.toOriginal()),!1}function f2(c2){c2.type.indexOf("touch")===-1&&c2.preventDefault();var A2=D.__hue_field.getBoundingClientRect(),o2=c2.touches&&c2.touches[0]||c2,u2=o2.clientY,x2=1-(u2-A2.top)/(A2.bottom-A2.top);return x2>1?x2=1:x2<0&&(x2=0),D.__color.h=x2*360,D.setValue(D.__color.toOriginal()),!1}return b}return Qr(h,[{key:"updateDisplay",value:function(){var S=mh(this.getValue());if(S!==!1){var b=!1;at.each(G0.COMPONENTS,function(G){if(!at.isUndefined(S[G])&&!at.isUndefined(this.__color.__state[G])&&S[G]!==this.__color.__state[G])return b=!0,{}},this),b&&at.extend(this.__color.__state,S)}at.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var D=this.__color.v<.5||this.__color.s>.5?255:0,F=255-D;at.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+D+","+D+","+D+")"}),this.__hue_knob.style.marginTop=(1-this.__color.h/360)*100+"px",this.__temp.s=1,this.__temp.v=1,AH(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),at.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+D+","+D+","+D+")",textShadow:this.__input_textShadow+"rgba("+F+","+F+","+F+",.7)"})}}]),h}(O1),o42=["-moz-","-o-","-webkit-","-ms-",""];function AH(B,h,v,S){B.style.background="",at.each(o42,function(b){B.style.cssText+="background: "+b+"linear-gradient("+h+", "+v+" 0%, "+S+" 100%); "})}function s42(B){B.style.background="",B.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",B.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",B.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",B.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",B.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var u42={load:function(h,v){var S=v||document,b=S.createElement("link");b.type="text/css",b.rel="stylesheet",b.href=h,S.getElementsByTagName("head")[0].appendChild(b)},inject:function(h,v){var S=v||document,b=document.createElement("style");b.type="text/css",b.innerHTML=h;var D=S.getElementsByTagName("head")[0];try{D.appendChild(b)}catch{}}},l42=` + + Here's the new load parameter for your`,f42=function(h,v){var S=h[v];return at.isArray(arguments[2])||at.isObject(arguments[2])?new n42(h,v,arguments[2]):at.isNumber(S)?at.isNumber(arguments[2])&&at.isNumber(arguments[3])?at.isNumber(arguments[4])?new dh(h,v,arguments[2],arguments[3],arguments[4]):new dh(h,v,arguments[2],arguments[3]):at.isNumber(arguments[4])?new Z8(h,v,{min:arguments[2],max:arguments[3],step:arguments[4]}):new Z8(h,v,{min:arguments[2],max:arguments[3]}):at.isString(S)?new i42(h,v):at.isFunction(S)?new Az(h,v,""):at.isBoolean(S)?new mz(h,v):null};function p42(B){setTimeout(B,1e3/60)}var c42=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||p42,_42=function(){function B(){Ur(this,B),this.backgroundElement=document.createElement("div"),at.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),q2.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),at.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var h=this;q2.bind(this.backgroundElement,"click",function(){h.hide()})}return Qr(B,[{key:"show",value:function(){var v=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),at.defer(function(){v.backgroundElement.style.opacity=1,v.domElement.style.opacity=1,v.domElement.style.webkitTransform="scale(1)"})}},{key:"hide",value:function(){var v=this,S=function b(){v.domElement.style.display="none",v.backgroundElement.style.display="none",q2.unbind(v.domElement,"webkitTransitionEnd",b),q2.unbind(v.domElement,"transitionend",b),q2.unbind(v.domElement,"oTransitionEnd",b)};q2.bind(this.domElement,"webkitTransitionEnd",S),q2.bind(this.domElement,"transitionend",S),q2.bind(this.domElement,"oTransitionEnd",S),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-q2.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-q2.getHeight(this.domElement)/2+"px"}}]),B}(),h42=Xp2(`.dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .cr.function .property-name{width:100%}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda} +`);u42.inject(h42);var gH="dg",yH=72,vH=20,Vf="Default",Df=function(){try{return!!window.localStorage}catch{return!1}}(),Pf=void 0,kH=!0,$u=void 0,E6=!1,gz=[],Nn=function B(h){var v=this,S=h||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),q2.addClass(this.domElement,gH),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],S=at.defaults(S,{closeOnTop:!1,autoPlace:!0,width:B.DEFAULT_WIDTH}),S=at.defaults(S,{resizable:S.autoPlace,hideable:S.autoPlace}),at.isUndefined(S.load)?S.load={preset:Vf}:S.preset&&(S.load.preset=S.preset),at.isUndefined(S.parent)&&S.hideable&&gz.push(this),S.resizable=at.isUndefined(S.parent)&&S.resizable,S.autoPlace&&at.isUndefined(S.scrollable)&&(S.scrollable=!0);var b=Df&&localStorage.getItem(Ou(this,"isLocal"))==="true",D=void 0,F=void 0;if(Object.defineProperties(this,{parent:{get:function(){return S.parent}},scrollable:{get:function(){return S.scrollable}},autoPlace:{get:function(){return S.autoPlace}},closeOnTop:{get:function(){return S.closeOnTop}},preset:{get:function(){return v.parent?v.getRoot().preset:S.load.preset},set:function(t2){v.parent?v.getRoot().preset=t2:S.load.preset=t2,A42(this),v.revert()}},width:{get:function(){return S.width},set:function(t2){S.width=t2,vh(v,t2)}},name:{get:function(){return S.name},set:function(t2){S.name=t2,F&&(F.innerHTML=S.name)}},closed:{get:function(){return S.closed},set:function(t2){S.closed=t2,S.closed?q2.addClass(v.__ul,B.CLASS_CLOSED):q2.removeClass(v.__ul,B.CLASS_CLOSED),this.onResize(),v.__closeButton&&(v.__closeButton.innerHTML=t2?B.TEXT_OPEN:B.TEXT_CLOSED)}},load:{get:function(){return S.load}},useLocalStorage:{get:function(){return b},set:function(t2){Df&&(b=t2,t2?q2.bind(window,"unload",D):q2.unbind(window,"unload",D),localStorage.setItem(Ou(v,"isLocal"),t2))}}}),at.isUndefined(S.parent)){if(this.closed=S.closed||!1,q2.addClass(this.domElement,B.CLASS_MAIN),q2.makeSelectable(this.domElement,!1),Df&&b){v.useLocalStorage=!0;var G=localStorage.getItem(Ou(this,"gui"));G&&(S.load=JSON.parse(G))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=B.TEXT_CLOSED,q2.addClass(this.__closeButton,B.CLASS_CLOSE_BUTTON),S.closeOnTop?(q2.addClass(this.__closeButton,B.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(q2.addClass(this.__closeButton,B.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),q2.bind(this.__closeButton,"click",function(){v.closed=!v.closed})}else{S.closed===void 0&&(S.closed=!0);var a=document.createTextNode(S.name);q2.addClass(a,"controller-name"),F=Wh(v,a);var z=function(t2){return t2.preventDefault(),v.closed=!v.closed,!1};q2.addClass(this.__ul,B.CLASS_CLOSED),q2.addClass(F,"title"),q2.bind(F,"click",z),S.closed||(this.closed=!1)}S.autoPlace&&(at.isUndefined(S.parent)&&(kH&&($u=document.createElement("div"),q2.addClass($u,gH),q2.addClass($u,B.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild($u),kH=!1),$u.appendChild(this.domElement),q2.addClass(this.domElement,B.CLASS_AUTO_PLACE)),this.parent||vh(v,S.width)),this.__resizeHandler=function(){v.onResizeDebounced()},q2.bind(window,"resize",this.__resizeHandler),q2.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),q2.bind(this.__ul,"transitionend",this.__resizeHandler),q2.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),S.resizable&&d42(this),D=function(){Df&&localStorage.getItem(Ou(v,"isLocal"))==="true"&&localStorage.setItem(Ou(v,"gui"),JSON.stringify(v.getSaveObject()))},this.saveToLocalStorageIfPossible=D;function X(){var J=v.getRoot();J.width+=1,at.defer(function(){J.width-=1})}S.parent||X()};Nn.toggleHide=function(){E6=!E6,at.each(gz,function(B){B.domElement.style.display=E6?"none":""})};Nn.CLASS_AUTO_PLACE="a";Nn.CLASS_AUTO_PLACE_CONTAINER="ac";Nn.CLASS_MAIN="main";Nn.CLASS_CONTROLLER_ROW="cr";Nn.CLASS_TOO_TALL="taller-than-window";Nn.CLASS_CLOSED="closed";Nn.CLASS_CLOSE_BUTTON="close-button";Nn.CLASS_CLOSE_TOP="close-top";Nn.CLASS_CLOSE_BOTTOM="close-bottom";Nn.CLASS_DRAG="drag";Nn.DEFAULT_WIDTH=245;Nn.TEXT_CLOSED="Close Controls";Nn.TEXT_OPEN="Open Controls";Nn._keydownHandler=function(B){document.activeElement.type!=="text"&&(B.which===yH||B.keyCode===yH)&&Nn.toggleHide()};q2.bind(window,"keydown",Nn._keydownHandler,!1);at.extend(Nn.prototype,{add:function(h,v){return Ff(this,h,v,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(h,v){return Ff(this,h,v,{color:!0})},remove:function(h){this.__ul.removeChild(h.__li),this.__controllers.splice(this.__controllers.indexOf(h),1);var v=this;at.defer(function(){v.onResize()})},destroy:function(){if(this.parent)throw new Error("Only the root GUI should be removed with .destroy(). For subfolders, use gui.removeFolder(folder) instead.");this.autoPlace&&$u.removeChild(this.domElement);var h=this;at.each(this.__folders,function(v){h.removeFolder(v)}),q2.unbind(window,"keydown",Nn._keydownHandler,!1),wH(this)},addFolder:function(h){if(this.__folders[h]!==void 0)throw new Error('You already have a folder in this GUI by the name "'+h+'"');var v={name:h,parent:this};v.autoPlace=this.autoPlace,this.load&&this.load.folders&&this.load.folders[h]&&(v.closed=this.load.folders[h].closed,v.load=this.load.folders[h]);var S=new Nn(v);this.__folders[h]=S;var b=Wh(this,S.domElement);return q2.addClass(b,"folder"),S},removeFolder:function(h){this.__ul.removeChild(h.domElement.parentElement),delete this.__folders[h.name],this.load&&this.load.folders&&this.load.folders[h.name]&&delete this.load.folders[h.name],wH(h);var v=this;at.each(h.__folders,function(S){h.removeFolder(S)}),at.defer(function(){v.onResize()})},open:function(){this.closed=!1},close:function(){this.closed=!0},hide:function(){this.domElement.style.display="none"},show:function(){this.domElement.style.display=""},onResize:function(){var h=this.getRoot();if(h.scrollable){var v=q2.getOffset(h.__ul).top,S=0;at.each(h.__ul.childNodes,function(b){h.autoPlace&&b===h.__save_row||(S+=q2.getHeight(b))}),window.innerHeight-v-vHGUI
's constructor: + + + ++ + Automatically save + values to+ +localStorage
on exit. + +The values saved to+ +localStorage
will + override those passed todat.GUI
's constructor. This makes it + easier to work incrementally, butlocalStorage
is fragile, + and your friends may not see the same values you do. + +0&&(h.preset=this.preset,h.remembered||(h.remembered={}),h.remembered[this.preset]=f8(this)),h.folders={},at.each(this.__folders,function(v,S){h.folders[S]=v.getSaveObject()}),h},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=f8(this),gh(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(h){this.load.remembered||(this.load.remembered={},this.load.remembered[Vf]=f8(this,!0)),this.load.remembered[h]=f8(this),this.preset=h,yh(this,h,!0),this.saveToLocalStorageIfPossible()},revert:function(h){at.each(this.__controllers,function(v){this.getRoot().load.remembered?yz(h||this.getRoot(),v):v.setValue(v.initialValue),v.__onFinishChange&&v.__onFinishChange.call(v,v.getValue())},this),at.each(this.__folders,function(v){v.revert(v)}),h||gh(this.getRoot(),!1)},listen:function(h){var v=this.__listening.length===0;this.__listening.push(h),v&&vz(this.__listening)},updateDisplay:function(){at.each(this.__controllers,function(h){h.updateDisplay()}),at.each(this.__folders,function(h){h.updateDisplay()})}});function Wh(B,h,v){var S=document.createElement("li");return h&&S.appendChild(h),v?B.__ul.insertBefore(S,v):B.__ul.appendChild(S),B.onResize(),S}function wH(B){q2.unbind(window,"resize",B.__resizeHandler),B.saveToLocalStorageIfPossible&&q2.unbind(window,"unload",B.saveToLocalStorageIfPossible)}function gh(B,h){var v=B.__preset_select[B.__preset_select.selectedIndex];h?v.innerHTML=v.value+"*":v.innerHTML=v.value}function a42(B,h,v){if(v.__li=h,v.__gui=B,at.extend(v,{options:function(F){if(arguments.length>1){var G=v.__li.nextElementSibling;return v.remove(),Ff(B,v.object,v.property,{before:G,factoryArgs:[at.toArray(arguments)]})}if(at.isArray(F)||at.isObject(F)){var a=v.__li.nextElementSibling;return v.remove(),Ff(B,v.object,v.property,{before:a,factoryArgs:[F]})}},name:function(F){return v.__li.firstElementChild.firstElementChild.innerHTML=F,v},listen:function(){return v.__gui.listen(v),v},remove:function(){return v.__gui.remove(v),v}}),v instanceof dh){var S=new Z8(v.object,v.property,{min:v.__min,max:v.__max,step:v.__step});at.each(["updateDisplay","onChange","onFinishChange","step","min","max"],function(D){var F=v[D],G=S[D];v[D]=S[D]=function(){var a=Array.prototype.slice.call(arguments);return G.apply(S,a),F.apply(v,a)}}),q2.addClass(h,"has-slider"),v.domElement.insertBefore(S.domElement,v.domElement.firstElementChild)}else if(v instanceof Z8){var b=function(F){if(at.isNumber(v.__min)&&at.isNumber(v.__max)){var G=v.__li.firstElementChild.firstElementChild.innerHTML,a=v.__gui.__listening.indexOf(v)>-1;v.remove();var z=Ff(B,v.object,v.property,{before:v.__li.nextElementSibling,factoryArgs:[v.__min,v.__max,v.__step]});return z.name(G),a&&z.listen(),z}return F};v.min=at.compose(b,v.min),v.max=at.compose(b,v.max)}else v instanceof mz?(q2.bind(h,"click",function(){q2.fakeEvent(v.__checkbox,"click")}),q2.bind(v.__checkbox,"click",function(D){D.stopPropagation()})):v instanceof Az?(q2.bind(h,"click",function(){q2.fakeEvent(v.__button,"click")}),q2.bind(h,"mouseover",function(){q2.addClass(v.__button,"hover")}),q2.bind(h,"mouseout",function(){q2.removeClass(v.__button,"hover")})):v instanceof Ah&&(q2.addClass(h,"color"),v.updateDisplay=at.compose(function(D){return h.style.borderLeftColor=v.__color.toString(),D},v.updateDisplay),v.updateDisplay());v.setValue=at.compose(function(D){return B.getRoot().__preset_select&&v.isModified()&&gh(B.getRoot(),!0),D},v.setValue)}function yz(B,h){var v=B.getRoot(),S=v.__rememberedObjects.indexOf(h.object);if(S!==-1){var b=v.__rememberedObjectIndecesToControllers[S];if(b===void 0&&(b={},v.__rememberedObjectIndecesToControllers[S]=b),b[h.property]=h,v.load&&v.load.remembered){var D=v.load.remembered,F=void 0;if(D[B.preset])F=D[B.preset];else if(D[Vf])F=D[Vf];else return;if(F[S]&&F[S][h.property]!==void 0){var G=F[S][h.property];h.initialValue=G,h.setValue(G)}}}}function Ff(B,h,v,S){if(h[v]===void 0)throw new Error('Object "'+h+'" has no property "'+v+'"');var b=void 0;if(S.color)b=new Ah(h,v);else{var D=[h,v].concat(S.factoryArgs);b=f42.apply(B,D)}S.before instanceof O1&&(S.before=S.before.__li),yz(B,b),q2.addClass(b.domElement,"c");var F=document.createElement("span");q2.addClass(F,"property-name"),F.innerHTML=b.property;var G=document.createElement("div");G.appendChild(F),G.appendChild(b.domElement);var a=Wh(B,G,S.before);return q2.addClass(a,Nn.CLASS_CONTROLLER_ROW),b instanceof Ah?q2.addClass(a,"color"):q2.addClass(a,Kp2(b.getValue())),a42(B,a,b),B.__controllers.push(b),b}function Ou(B,h){return document.location.href+"."+h}function yh(B,h,v){var S=document.createElement("option");S.innerHTML=h,S.value=h,B.__preset_select.appendChild(S),v&&(B.__preset_select.selectedIndex=B.__preset_select.length-1)}function xH(B,h){h.style.display=B.useLocalStorage?"block":"none"}function m42(B){var h=B.__save_row=document.createElement("li");q2.addClass(B.domElement,"has-save"),B.__ul.insertBefore(h,B.__ul.firstChild),q2.addClass(h,"save-row");var v=document.createElement("span");v.innerHTML=" ",q2.addClass(v,"button gears");var S=document.createElement("span");S.innerHTML="Save",q2.addClass(S,"button"),q2.addClass(S,"save");var b=document.createElement("span");b.innerHTML="New",q2.addClass(b,"button"),q2.addClass(b,"save-as");var D=document.createElement("span");D.innerHTML="Revert",q2.addClass(D,"button"),q2.addClass(D,"revert");var F=B.__preset_select=document.createElement("select");if(B.load&&B.load.remembered?at.each(B.load.remembered,function(J,t2){yh(B,t2,t2===B.preset)}):yh(B,Vf,!1),q2.bind(F,"change",function(){for(var J=0;Ja+1e3&&(X.update(1e3*z/(i2-a),100),a=i2,z=0,t2)){var f2=performance.memory;t2.update(f2.usedJSHeapSize/1048576,f2.jsHeapSizeLimit/1048576)}return i2},update:function(){G=this.end()},domElement:F,setMode:b}};return v.Panel=function(S,b,D){var F=1/0,G=0,a=Math.round,z=a(window.devicePixelRatio||1),X=80*z,J=48*z,t2=3*z,i2=2*z,f2=3*z,c2=15*z,A2=74*z,o2=30*z,u2=document.createElement("canvas");u2.width=X,u2.height=J,u2.style.cssText="width:80px;height:48px";var x2=u2.getContext("2d");return x2.font="bold "+9*z+"px Helvetica,Arial,sans-serif",x2.textBaseline="top",x2.fillStyle=D,x2.fillRect(0,0,X,J),x2.fillStyle=b,x2.fillText(S,t2,i2),x2.fillRect(f2,c2,A2,o2),x2.fillStyle=D,x2.globalAlpha=.9,x2.fillRect(f2,c2,A2,o2),{dom:u2,update:function(k2,E2){F=Math.min(F,k2),G=Math.max(G,k2),x2.fillStyle=D,x2.globalAlpha=1,x2.fillRect(0,0,X,c2),x2.fillStyle=b,x2.fillText(a(k2)+" "+S+" ("+a(F)+"-"+a(G)+")",t2,i2),x2.drawImage(u2,f2+z,c2,A2-z,o2,f2,c2,A2-z,o2),x2.fillRect(f2+A2-z,c2,z,o2),x2.fillStyle=D,x2.globalAlpha=.9,x2.fillRect(f2+A2-z,c2,z,a((1-k2/E2)*o2))}}},v})})(kz);var p8=kz.exports;const y42=B=>{const h=new Set;do for(const v of Reflect.ownKeys(B))h.add([B,v]);while((B=Reflect.getPrototypeOf(B))&&B!==Object.prototype);return h};function wz(B,{include:h,exclude:v}={}){const S=b=>{const D=F=>typeof F=="string"?b===F:F.test(b);return h?h.some(D):v?!v.some(D):!0};for(const[b,D]of y42(B.constructor.prototype)){if(D==="constructor"||!S(D))continue;const F=Reflect.getOwnPropertyDescriptor(b,D);F&&typeof F.value=="function"&&(B[D]=B[D].bind(B))}return B}/** + * @license + * Copyright 2010-2021 Three.js Authors + * SPDX-License-Identifier: MIT + */const Hh="135",v42=0,SH=1,k42=2,xz=1,w42=2,If=3,Ku=0,I0=1,D1=2,Sz=1,Qs=0,jf=1,CH=2,MH=3,bH=4,x42=5,Gu=100,S42=101,C42=102,TH=103,EH=104,M42=200,b42=201,T42=202,E42=203,Cz=204,Mz=205,R42=206,B42=207,D42=208,I42=209,L42=210,P42=0,F42=1,j42=2,kh=3,$42=4,O42=5,G42=6,N42=7,ic=0,W42=1,H42=2,R1=0,V42=1,z42=2,U42=3,Q42=4,Y42=5,bz=300,rp=301,op=302,wh=303,xh=304,rc=306,Vh=307,tl=1e3,Wi=1001,X8=1002,L0=1003,Sh=1004,Ch=1005,Hi=1006,Tz=1007,ol=1008,t1=1009,q42=1010,Z42=1011,zf=1012,X42=1013,U8=1014,es=1015,Uu=1016,J42=1017,K42=1018,t82=1019,Qu=1020,e82=1021,Ys=1022,li=1023,n82=1024,i82=1025,r82=li,B1=1026,el=1027,o82=1028,s82=1029,u82=1030,l82=1031,f82=1032,p82=1033,RH=33776,BH=33777,DH=33778,IH=33779,LH=35840,PH=35841,FH=35842,jH=35843,c82=36196,$H=37492,OH=37496,_82=37808,h82=37809,a82=37810,m82=37811,d82=37812,A82=37813,g82=37814,y82=37815,v82=37816,k82=37817,w82=37818,x82=37819,S82=37820,C82=37821,M82=36492,b82=37840,T82=37841,E82=37842,R82=37843,B82=37844,D82=37845,I82=37846,L82=37847,P82=37848,F82=37849,j82=37850,$82=37851,O82=37852,G82=37853,N82=2200,W82=2201,H82=2202,Uf=2300,nl=2301,R6=2302,Wu=2400,Hu=2401,J8=2402,zh=2500,Ez=2501,V82=0,z82=1,Rz=2,Vi=3e3,I1=3001,Uh=3007,Qh=3002,Bz=3004,Dz=3005,Iz=3006,U82=3200,Q82=3201,G1=0,Y82=1,B6=7680,q82=519,Qf=35044,K8=35048,GH="300 es";class N1{addEventListener(h,v){this._listeners===void 0&&(this._listeners={});const S=this._listeners;S[h]===void 0&&(S[h]=[]),S[h].indexOf(v)===-1&&S[h].push(v)}hasEventListener(h,v){if(this._listeners===void 0)return!1;const S=this._listeners;return S[h]!==void 0&&S[h].indexOf(v)!==-1}removeEventListener(h,v){if(this._listeners===void 0)return;const b=this._listeners[h];if(b!==void 0){const D=b.indexOf(v);D!==-1&&b.splice(D,1)}}dispatchEvent(h){if(this._listeners===void 0)return;const S=this._listeners[h.type];if(S!==void 0){h.target=this;const b=S.slice(0);for(let D=0,F=b.length;D >8&255]+U0[B>>16&255]+U0[B>>24&255]+"-"+U0[h&255]+U0[h>>8&255]+"-"+U0[h>>16&15|64]+U0[h>>24&255]+"-"+U0[v&63|128]+U0[v>>8&255]+"-"+U0[v>>16&255]+U0[v>>24&255]+U0[S&255]+U0[S>>8&255]+U0[S>>16&255]+U0[S>>24&255]).toUpperCase()}function Ni(B,h,v){return Math.max(h,Math.min(v,B))}function Yh(B,h){return(B%h+h)%h}function Z82(B,h,v,S,b){return S+(B-h)*(b-S)/(v-h)}function X82(B,h,v){return B!==h?(v-B)/(h-B):0}function Of(B,h,v){return(1-v)*B+v*h}function J82(B,h,v,S){return Of(B,h,1-Math.exp(-v*S))}function K82(B,h=1){return h-Math.abs(Yh(B,h*2)-h)}function tc2(B,h,v){return B<=h?0:B>=v?1:(B=(B-h)/(v-h),B*B*(3-2*B))}function ec2(B,h,v){return B<=h?0:B>=v?1:(B=(B-h)/(v-h),B*B*B*(B*(B*6-15)+10))}function nc2(B,h){return B+Math.floor(Math.random()*(h-B+1))}function ic2(B,h){return B+Math.random()*(h-B)}function rc2(B){return B*(.5-Math.random())}function oc2(B){return B!==void 0&&(c8=B%2147483647),c8=c8*16807%2147483647,(c8-1)/2147483646}function sc2(B){return B*$f}function uc2(B){return B*Yf}function Mh(B){return(B&B-1)===0&&B!==0}function Lz(B){return Math.pow(2,Math.ceil(Math.log(B)/Math.LN2))}function Pz(B){return Math.pow(2,Math.floor(Math.log(B)/Math.LN2))}function lc2(B,h,v,S,b){const D=Math.cos,F=Math.sin,G=D(v/2),a=F(v/2),z=D((h+S)/2),X=F((h+S)/2),J=D((h-S)/2),t2=F((h-S)/2),i2=D((S-h)/2),f2=F((S-h)/2);switch(b){case"XYX":B.set(G*X,a*J,a*t2,G*z);break;case"YZY":B.set(a*t2,G*X,a*J,G*z);break;case"ZXZ":B.set(a*J,a*t2,G*X,G*z);break;case"XZX":B.set(G*X,a*f2,a*i2,G*z);break;case"YXY":B.set(a*i2,G*X,a*f2,G*z);break;case"ZYZ":B.set(a*f2,a*i2,G*X,G*z);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+b)}}var fc2=Object.freeze({__proto__:null,DEG2RAD:$f,RAD2DEG:Yf,generateUUID:Cr,clamp:Ni,euclideanModulo:Yh,mapLinear:Z82,inverseLerp:X82,lerp:Of,damp:J82,pingpong:K82,smoothstep:tc2,smootherstep:ec2,randInt:nc2,randFloat:ic2,randFloatSpread:rc2,seededRandom:oc2,degToRad:sc2,radToDeg:uc2,isPowerOfTwo:Mh,ceilPowerOfTwo:Lz,floorPowerOfTwo:Pz,setQuaternionFromProperEuler:lc2});class Et{constructor(h=0,v=0){this.x=h,this.y=v}get width(){return this.x}set width(h){this.x=h}get height(){return this.y}set height(h){this.y=h}set(h,v){return this.x=h,this.y=v,this}setScalar(h){return this.x=h,this.y=h,this}setX(h){return this.x=h,this}setY(h){return this.y=h,this}setComponent(h,v){switch(h){case 0:this.x=v;break;case 1:this.y=v;break;default:throw new Error("index is out of range: "+h)}return this}getComponent(h){switch(h){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+h)}}clone(){return new this.constructor(this.x,this.y)}copy(h){return this.x=h.x,this.y=h.y,this}add(h,v){return v!==void 0?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(h,v)):(this.x+=h.x,this.y+=h.y,this)}addScalar(h){return this.x+=h,this.y+=h,this}addVectors(h,v){return this.x=h.x+v.x,this.y=h.y+v.y,this}addScaledVector(h,v){return this.x+=h.x*v,this.y+=h.y*v,this}sub(h,v){return v!==void 0?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(h,v)):(this.x-=h.x,this.y-=h.y,this)}subScalar(h){return this.x-=h,this.y-=h,this}subVectors(h,v){return this.x=h.x-v.x,this.y=h.y-v.y,this}multiply(h){return this.x*=h.x,this.y*=h.y,this}multiplyScalar(h){return this.x*=h,this.y*=h,this}divide(h){return this.x/=h.x,this.y/=h.y,this}divideScalar(h){return this.multiplyScalar(1/h)}applyMatrix3(h){const v=this.x,S=this.y,b=h.elements;return this.x=b[0]*v+b[3]*S+b[6],this.y=b[1]*v+b[4]*S+b[7],this}min(h){return this.x=Math.min(this.x,h.x),this.y=Math.min(this.y,h.y),this}max(h){return this.x=Math.max(this.x,h.x),this.y=Math.max(this.y,h.y),this}clamp(h,v){return this.x=Math.max(h.x,Math.min(v.x,this.x)),this.y=Math.max(h.y,Math.min(v.y,this.y)),this}clampScalar(h,v){return this.x=Math.max(h,Math.min(v,this.x)),this.y=Math.max(h,Math.min(v,this.y)),this}clampLength(h,v){const S=this.length();return this.divideScalar(S||1).multiplyScalar(Math.max(h,Math.min(v,S)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(h){return this.x*h.x+this.y*h.y}cross(h){return this.x*h.y-this.y*h.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(h){return Math.sqrt(this.distanceToSquared(h))}distanceToSquared(h){const v=this.x-h.x,S=this.y-h.y;return v*v+S*S}manhattanDistanceTo(h){return Math.abs(this.x-h.x)+Math.abs(this.y-h.y)}setLength(h){return this.normalize().multiplyScalar(h)}lerp(h,v){return this.x+=(h.x-this.x)*v,this.y+=(h.y-this.y)*v,this}lerpVectors(h,v,S){return this.x=h.x+(v.x-h.x)*S,this.y=h.y+(v.y-h.y)*S,this}equals(h){return h.x===this.x&&h.y===this.y}fromArray(h,v=0){return this.x=h[v],this.y=h[v+1],this}toArray(h=[],v=0){return h[v]=this.x,h[v+1]=this.y,h}fromBufferAttribute(h,v,S){return S!==void 0&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=h.getX(v),this.y=h.getY(v),this}rotateAround(h,v){const S=Math.cos(v),b=Math.sin(v),D=this.x-h.x,F=this.y-h.y;return this.x=D*S-F*b+h.x,this.y=D*b+F*S+h.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}Et.prototype.isVector2=!0;class Q0{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(h,v,S,b,D,F,G,a,z){const X=this.elements;return X[0]=h,X[1]=b,X[2]=G,X[3]=v,X[4]=D,X[5]=a,X[6]=S,X[7]=F,X[8]=z,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(h){const v=this.elements,S=h.elements;return v[0]=S[0],v[1]=S[1],v[2]=S[2],v[3]=S[3],v[4]=S[4],v[5]=S[5],v[6]=S[6],v[7]=S[7],v[8]=S[8],this}extractBasis(h,v,S){return h.setFromMatrix3Column(this,0),v.setFromMatrix3Column(this,1),S.setFromMatrix3Column(this,2),this}setFromMatrix4(h){const v=h.elements;return this.set(v[0],v[4],v[8],v[1],v[5],v[9],v[2],v[6],v[10]),this}multiply(h){return this.multiplyMatrices(this,h)}premultiply(h){return this.multiplyMatrices(h,this)}multiplyMatrices(h,v){const S=h.elements,b=v.elements,D=this.elements,F=S[0],G=S[3],a=S[6],z=S[1],X=S[4],J=S[7],t2=S[2],i2=S[5],f2=S[8],c2=b[0],A2=b[3],o2=b[6],u2=b[1],x2=b[4],k2=b[7],E2=b[2],F2=b[5],g2=b[8];return D[0]=F*c2+G*u2+a*E2,D[3]=F*A2+G*x2+a*F2,D[6]=F*o2+G*k2+a*g2,D[1]=z*c2+X*u2+J*E2,D[4]=z*A2+X*x2+J*F2,D[7]=z*o2+X*k2+J*g2,D[2]=t2*c2+i2*u2+f2*E2,D[5]=t2*A2+i2*x2+f2*F2,D[8]=t2*o2+i2*k2+f2*g2,this}multiplyScalar(h){const v=this.elements;return v[0]*=h,v[3]*=h,v[6]*=h,v[1]*=h,v[4]*=h,v[7]*=h,v[2]*=h,v[5]*=h,v[8]*=h,this}determinant(){const h=this.elements,v=h[0],S=h[1],b=h[2],D=h[3],F=h[4],G=h[5],a=h[6],z=h[7],X=h[8];return v*F*X-v*G*z-S*D*X+S*G*a+b*D*z-b*F*a}invert(){const h=this.elements,v=h[0],S=h[1],b=h[2],D=h[3],F=h[4],G=h[5],a=h[6],z=h[7],X=h[8],J=X*F-G*z,t2=G*a-X*D,i2=z*D-F*a,f2=v*J+S*t2+b*i2;if(f2===0)return this.set(0,0,0,0,0,0,0,0,0);const c2=1/f2;return h[0]=J*c2,h[1]=(b*z-X*S)*c2,h[2]=(G*S-b*F)*c2,h[3]=t2*c2,h[4]=(X*v-b*a)*c2,h[5]=(b*D-G*v)*c2,h[6]=i2*c2,h[7]=(S*a-z*v)*c2,h[8]=(F*v-S*D)*c2,this}transpose(){let h;const v=this.elements;return h=v[1],v[1]=v[3],v[3]=h,h=v[2],v[2]=v[6],v[6]=h,h=v[5],v[5]=v[7],v[7]=h,this}getNormalMatrix(h){return this.setFromMatrix4(h).invert().transpose()}transposeIntoArray(h){const v=this.elements;return h[0]=v[0],h[1]=v[3],h[2]=v[6],h[3]=v[1],h[4]=v[4],h[5]=v[7],h[6]=v[2],h[7]=v[5],h[8]=v[8],this}setUvTransform(h,v,S,b,D,F,G){const a=Math.cos(D),z=Math.sin(D);return this.set(S*a,S*z,-S*(a*F+z*G)+F+h,-b*z,b*a,-b*(-z*F+a*G)+G+v,0,0,1),this}scale(h,v){const S=this.elements;return S[0]*=h,S[3]*=h,S[6]*=h,S[1]*=v,S[4]*=v,S[7]*=v,this}rotate(h){const v=Math.cos(h),S=Math.sin(h),b=this.elements,D=b[0],F=b[3],G=b[6],a=b[1],z=b[4],X=b[7];return b[0]=v*D+S*a,b[3]=v*F+S*z,b[6]=v*G+S*X,b[1]=-S*D+v*a,b[4]=-S*F+v*z,b[7]=-S*G+v*X,this}translate(h,v){const S=this.elements;return S[0]+=h*S[2],S[3]+=h*S[5],S[6]+=h*S[8],S[1]+=v*S[2],S[4]+=v*S[5],S[7]+=v*S[8],this}equals(h){const v=this.elements,S=h.elements;for(let b=0;b<9;b++)if(v[b]!==S[b])return!1;return!0}fromArray(h,v=0){for(let S=0;S<9;S++)this.elements[S]=h[S+v];return this}toArray(h=[],v=0){const S=this.elements;return h[v]=S[0],h[v+1]=S[1],h[v+2]=S[2],h[v+3]=S[3],h[v+4]=S[4],h[v+5]=S[5],h[v+6]=S[6],h[v+7]=S[7],h[v+8]=S[8],h}clone(){return new this.constructor().fromArray(this.elements)}}Q0.prototype.isMatrix3=!0;function Fz(B){if(B.length===0)return-1/0;let h=B[0];for(let v=1,S=B.length;v h&&(h=B[v]);return h}function oc(B){return document.createElementNS("http://www.w3.org/1999/xhtml",B)}function NH(B,h=0){let v=3735928559^h,S=1103547991^h;for(let b=0,D;b>>16,2246822507)^Math.imul(S^S>>>13,3266489909),S=Math.imul(S^S>>>16,2246822507)^Math.imul(v^v>>>13,3266489909),4294967296*(2097151&S)+(v>>>0)}let gu;class sl{static getDataURL(h){if(/^data:/i.test(h.src)||typeof HTMLCanvasElement=="undefined")return h.src;let v;if(h instanceof HTMLCanvasElement)v=h;else{gu===void 0&&(gu=oc("canvas")),gu.width=h.width,gu.height=h.height;const S=gu.getContext("2d");h instanceof ImageData?S.putImageData(h,0,0):S.drawImage(h,0,0,h.width,h.height),v=gu}return v.width>2048||v.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",h),v.toDataURL("image/jpeg",.6)):v.toDataURL("image/png")}}let pc2=0;class F0 extends N1{constructor(h=F0.DEFAULT_IMAGE,v=F0.DEFAULT_MAPPING,S=Wi,b=Wi,D=Hi,F=ol,G=li,a=t1,z=1,X=Vi){super(),Object.defineProperty(this,"id",{value:pc2++}),this.uuid=Cr(),this.name="",this.image=h,this.mipmaps=[],this.mapping=v,this.wrapS=S,this.wrapT=b,this.magFilter=D,this.minFilter=F,this.anisotropy=z,this.format=G,this.internalFormat=null,this.type=a,this.offset=new Et(0,0),this.repeat=new Et(1,1),this.center=new Et(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Q0,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=X,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(h){return this.name=h.name,this.image=h.image,this.mipmaps=h.mipmaps.slice(0),this.mapping=h.mapping,this.wrapS=h.wrapS,this.wrapT=h.wrapT,this.magFilter=h.magFilter,this.minFilter=h.minFilter,this.anisotropy=h.anisotropy,this.format=h.format,this.internalFormat=h.internalFormat,this.type=h.type,this.offset.copy(h.offset),this.repeat.copy(h.repeat),this.center.copy(h.center),this.rotation=h.rotation,this.matrixAutoUpdate=h.matrixAutoUpdate,this.matrix.copy(h.matrix),this.generateMipmaps=h.generateMipmaps,this.premultiplyAlpha=h.premultiplyAlpha,this.flipY=h.flipY,this.unpackAlignment=h.unpackAlignment,this.encoding=h.encoding,this.userData=JSON.parse(JSON.stringify(h.userData)),this}toJSON(h){const v=h===void 0||typeof h=="string";if(!v&&h.textures[this.uuid]!==void 0)return h.textures[this.uuid];const S={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(this.image!==void 0){const b=this.image;if(b.uuid===void 0&&(b.uuid=Cr()),!v&&h.images[b.uuid]===void 0){let D;if(Array.isArray(b)){D=[];for(let F=0,G=b.length;F 1)switch(this.wrapS){case tl:h.x=h.x-Math.floor(h.x);break;case Wi:h.x=h.x<0?0:1;break;case X8:Math.abs(Math.floor(h.x)%2)===1?h.x=Math.ceil(h.x)-h.x:h.x=h.x-Math.floor(h.x);break}if(h.y<0||h.y>1)switch(this.wrapT){case tl:h.y=h.y-Math.floor(h.y);break;case Wi:h.y=h.y<0?0:1;break;case X8:Math.abs(Math.floor(h.y)%2)===1?h.y=Math.ceil(h.y)-h.y:h.y=h.y-Math.floor(h.y);break}return this.flipY&&(h.y=1-h.y),h}set needsUpdate(h){h===!0&&this.version++}}F0.DEFAULT_IMAGE=void 0;F0.DEFAULT_MAPPING=bz;F0.prototype.isTexture=!0;function D6(B){return typeof HTMLImageElement!="undefined"&&B instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&B instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&B instanceof ImageBitmap?sl.getDataURL(B):B.data?{data:Array.prototype.slice.call(B.data),width:B.width,height:B.height,type:B.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}class jn{constructor(h=0,v=0,S=0,b=1){this.x=h,this.y=v,this.z=S,this.w=b}get width(){return this.z}set width(h){this.z=h}get height(){return this.w}set height(h){this.w=h}set(h,v,S,b){return this.x=h,this.y=v,this.z=S,this.w=b,this}setScalar(h){return this.x=h,this.y=h,this.z=h,this.w=h,this}setX(h){return this.x=h,this}setY(h){return this.y=h,this}setZ(h){return this.z=h,this}setW(h){return this.w=h,this}setComponent(h,v){switch(h){case 0:this.x=v;break;case 1:this.y=v;break;case 2:this.z=v;break;case 3:this.w=v;break;default:throw new Error("index is out of range: "+h)}return this}getComponent(h){switch(h){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+h)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(h){return this.x=h.x,this.y=h.y,this.z=h.z,this.w=h.w!==void 0?h.w:1,this}add(h,v){return v!==void 0?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(h,v)):(this.x+=h.x,this.y+=h.y,this.z+=h.z,this.w+=h.w,this)}addScalar(h){return this.x+=h,this.y+=h,this.z+=h,this.w+=h,this}addVectors(h,v){return this.x=h.x+v.x,this.y=h.y+v.y,this.z=h.z+v.z,this.w=h.w+v.w,this}addScaledVector(h,v){return this.x+=h.x*v,this.y+=h.y*v,this.z+=h.z*v,this.w+=h.w*v,this}sub(h,v){return v!==void 0?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(h,v)):(this.x-=h.x,this.y-=h.y,this.z-=h.z,this.w-=h.w,this)}subScalar(h){return this.x-=h,this.y-=h,this.z-=h,this.w-=h,this}subVectors(h,v){return this.x=h.x-v.x,this.y=h.y-v.y,this.z=h.z-v.z,this.w=h.w-v.w,this}multiply(h){return this.x*=h.x,this.y*=h.y,this.z*=h.z,this.w*=h.w,this}multiplyScalar(h){return this.x*=h,this.y*=h,this.z*=h,this.w*=h,this}applyMatrix4(h){const v=this.x,S=this.y,b=this.z,D=this.w,F=h.elements;return this.x=F[0]*v+F[4]*S+F[8]*b+F[12]*D,this.y=F[1]*v+F[5]*S+F[9]*b+F[13]*D,this.z=F[2]*v+F[6]*S+F[10]*b+F[14]*D,this.w=F[3]*v+F[7]*S+F[11]*b+F[15]*D,this}divideScalar(h){return this.multiplyScalar(1/h)}setAxisAngleFromQuaternion(h){this.w=2*Math.acos(h.w);const v=Math.sqrt(1-h.w*h.w);return v<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=h.x/v,this.y=h.y/v,this.z=h.z/v),this}setAxisAngleFromRotationMatrix(h){let v,S,b,D;const a=h.elements,z=a[0],X=a[4],J=a[8],t2=a[1],i2=a[5],f2=a[9],c2=a[2],A2=a[6],o2=a[10];if(Math.abs(X-t2)<.01&&Math.abs(J-c2)<.01&&Math.abs(f2-A2)<.01){if(Math.abs(X+t2)<.1&&Math.abs(J+c2)<.1&&Math.abs(f2+A2)<.1&&Math.abs(z+i2+o2-3)<.1)return this.set(1,0,0,0),this;v=Math.PI;const x2=(z+1)/2,k2=(i2+1)/2,E2=(o2+1)/2,F2=(X+t2)/4,g2=(J+c2)/4,X2=(f2+A2)/4;return x2>k2&&x2>E2?x2<.01?(S=0,b=.707106781,D=.707106781):(S=Math.sqrt(x2),b=F2/S,D=g2/S):k2>E2?k2<.01?(S=.707106781,b=0,D=.707106781):(b=Math.sqrt(k2),S=F2/b,D=X2/b):E2<.01?(S=.707106781,b=.707106781,D=0):(D=Math.sqrt(E2),S=g2/D,b=X2/D),this.set(S,b,D,v),this}let u2=Math.sqrt((A2-f2)*(A2-f2)+(J-c2)*(J-c2)+(t2-X)*(t2-X));return Math.abs(u2)<.001&&(u2=1),this.x=(A2-f2)/u2,this.y=(J-c2)/u2,this.z=(t2-X)/u2,this.w=Math.acos((z+i2+o2-1)/2),this}min(h){return this.x=Math.min(this.x,h.x),this.y=Math.min(this.y,h.y),this.z=Math.min(this.z,h.z),this.w=Math.min(this.w,h.w),this}max(h){return this.x=Math.max(this.x,h.x),this.y=Math.max(this.y,h.y),this.z=Math.max(this.z,h.z),this.w=Math.max(this.w,h.w),this}clamp(h,v){return this.x=Math.max(h.x,Math.min(v.x,this.x)),this.y=Math.max(h.y,Math.min(v.y,this.y)),this.z=Math.max(h.z,Math.min(v.z,this.z)),this.w=Math.max(h.w,Math.min(v.w,this.w)),this}clampScalar(h,v){return this.x=Math.max(h,Math.min(v,this.x)),this.y=Math.max(h,Math.min(v,this.y)),this.z=Math.max(h,Math.min(v,this.z)),this.w=Math.max(h,Math.min(v,this.w)),this}clampLength(h,v){const S=this.length();return this.divideScalar(S||1).multiplyScalar(Math.max(h,Math.min(v,S)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(h){return this.x*h.x+this.y*h.y+this.z*h.z+this.w*h.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(h){return this.normalize().multiplyScalar(h)}lerp(h,v){return this.x+=(h.x-this.x)*v,this.y+=(h.y-this.y)*v,this.z+=(h.z-this.z)*v,this.w+=(h.w-this.w)*v,this}lerpVectors(h,v,S){return this.x=h.x+(v.x-h.x)*S,this.y=h.y+(v.y-h.y)*S,this.z=h.z+(v.z-h.z)*S,this.w=h.w+(v.w-h.w)*S,this}equals(h){return h.x===this.x&&h.y===this.y&&h.z===this.z&&h.w===this.w}fromArray(h,v=0){return this.x=h[v],this.y=h[v+1],this.z=h[v+2],this.w=h[v+3],this}toArray(h=[],v=0){return h[v]=this.x,h[v+1]=this.y,h[v+2]=this.z,h[v+3]=this.w,h}fromBufferAttribute(h,v,S){return S!==void 0&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=h.getX(v),this.y=h.getY(v),this.z=h.getZ(v),this.w=h.getW(v),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}jn.prototype.isVector4=!0;class Mr extends N1{constructor(h,v,S={}){super(),this.width=h,this.height=v,this.depth=1,this.scissor=new jn(0,0,h,v),this.scissorTest=!1,this.viewport=new jn(0,0,h,v),this.texture=new F0(void 0,S.mapping,S.wrapS,S.wrapT,S.magFilter,S.minFilter,S.format,S.type,S.anisotropy,S.encoding),this.texture.isRenderTargetTexture=!0,this.texture.image={width:h,height:v,depth:1},this.texture.generateMipmaps=S.generateMipmaps!==void 0?S.generateMipmaps:!1,this.texture.internalFormat=S.internalFormat!==void 0?S.internalFormat:null,this.texture.minFilter=S.minFilter!==void 0?S.minFilter:Hi,this.depthBuffer=S.depthBuffer!==void 0?S.depthBuffer:!0,this.stencilBuffer=S.stencilBuffer!==void 0?S.stencilBuffer:!1,this.depthTexture=S.depthTexture!==void 0?S.depthTexture:null}setTexture(h){h.image={width:this.width,height:this.height,depth:this.depth},this.texture=h}setSize(h,v,S=1){(this.width!==h||this.height!==v||this.depth!==S)&&(this.width=h,this.height=v,this.depth=S,this.texture.image.width=h,this.texture.image.height=v,this.texture.image.depth=S,this.dispose()),this.viewport.set(0,0,h,v),this.scissor.set(0,0,h,v)}clone(){return new this.constructor().copy(this)}copy(h){return this.width=h.width,this.height=h.height,this.depth=h.depth,this.viewport.copy(h.viewport),this.texture=h.texture.clone(),this.texture.image={...this.texture.image},this.depthBuffer=h.depthBuffer,this.stencilBuffer=h.stencilBuffer,this.depthTexture=h.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}Mr.prototype.isWebGLRenderTarget=!0;class cc2 extends Mr{constructor(h,v,S){super(h,v);const b=this.texture;this.texture=[];for(let D=0;D =0?1:-1,x2=1-o2*o2;if(x2>Number.EPSILON){const E2=Math.sqrt(x2),F2=Math.atan2(E2,o2*u2);A2=Math.sin(A2*F2)/E2,G=Math.sin(G*F2)/E2}const k2=G*u2;if(a=a*A2+t2*k2,z=z*A2+i2*k2,X=X*A2+f2*k2,J=J*A2+c2*k2,A2===1-G){const E2=1/Math.sqrt(a*a+z*z+X*X+J*J);a*=E2,z*=E2,X*=E2,J*=E2}}h[v]=a,h[v+1]=z,h[v+2]=X,h[v+3]=J}static multiplyQuaternionsFlat(h,v,S,b,D,F){const G=S[b],a=S[b+1],z=S[b+2],X=S[b+3],J=D[F],t2=D[F+1],i2=D[F+2],f2=D[F+3];return h[v]=G*f2+X*J+a*i2-z*t2,h[v+1]=a*f2+X*t2+z*J-G*i2,h[v+2]=z*f2+X*i2+G*t2-a*J,h[v+3]=X*f2-G*J-a*t2-z*i2,h}get x(){return this._x}set x(h){this._x=h,this._onChangeCallback()}get y(){return this._y}set y(h){this._y=h,this._onChangeCallback()}get z(){return this._z}set z(h){this._z=h,this._onChangeCallback()}get w(){return this._w}set w(h){this._w=h,this._onChangeCallback()}set(h,v,S,b){return this._x=h,this._y=v,this._z=S,this._w=b,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(h){return this._x=h.x,this._y=h.y,this._z=h.z,this._w=h.w,this._onChangeCallback(),this}setFromEuler(h,v){if(!(h&&h.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const S=h._x,b=h._y,D=h._z,F=h._order,G=Math.cos,a=Math.sin,z=G(S/2),X=G(b/2),J=G(D/2),t2=a(S/2),i2=a(b/2),f2=a(D/2);switch(F){case"XYZ":this._x=t2*X*J+z*i2*f2,this._y=z*i2*J-t2*X*f2,this._z=z*X*f2+t2*i2*J,this._w=z*X*J-t2*i2*f2;break;case"YXZ":this._x=t2*X*J+z*i2*f2,this._y=z*i2*J-t2*X*f2,this._z=z*X*f2-t2*i2*J,this._w=z*X*J+t2*i2*f2;break;case"ZXY":this._x=t2*X*J-z*i2*f2,this._y=z*i2*J+t2*X*f2,this._z=z*X*f2+t2*i2*J,this._w=z*X*J-t2*i2*f2;break;case"ZYX":this._x=t2*X*J-z*i2*f2,this._y=z*i2*J+t2*X*f2,this._z=z*X*f2-t2*i2*J,this._w=z*X*J+t2*i2*f2;break;case"YZX":this._x=t2*X*J+z*i2*f2,this._y=z*i2*J+t2*X*f2,this._z=z*X*f2-t2*i2*J,this._w=z*X*J-t2*i2*f2;break;case"XZY":this._x=t2*X*J-z*i2*f2,this._y=z*i2*J-t2*X*f2,this._z=z*X*f2+t2*i2*J,this._w=z*X*J+t2*i2*f2;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+F)}return v!==!1&&this._onChangeCallback(),this}setFromAxisAngle(h,v){const S=v/2,b=Math.sin(S);return this._x=h.x*b,this._y=h.y*b,this._z=h.z*b,this._w=Math.cos(S),this._onChangeCallback(),this}setFromRotationMatrix(h){const v=h.elements,S=v[0],b=v[4],D=v[8],F=v[1],G=v[5],a=v[9],z=v[2],X=v[6],J=v[10],t2=S+G+J;if(t2>0){const i2=.5/Math.sqrt(t2+1);this._w=.25/i2,this._x=(X-a)*i2,this._y=(D-z)*i2,this._z=(F-b)*i2}else if(S>G&&S>J){const i2=2*Math.sqrt(1+S-G-J);this._w=(X-a)/i2,this._x=.25*i2,this._y=(b+F)/i2,this._z=(D+z)/i2}else if(G>J){const i2=2*Math.sqrt(1+G-S-J);this._w=(D-z)/i2,this._x=(b+F)/i2,this._y=.25*i2,this._z=(a+X)/i2}else{const i2=2*Math.sqrt(1+J-S-G);this._w=(F-b)/i2,this._x=(D+z)/i2,this._y=(a+X)/i2,this._z=.25*i2}return this._onChangeCallback(),this}setFromUnitVectors(h,v){let S=h.dot(v)+1;return SMath.abs(h.z)?(this._x=-h.y,this._y=h.x,this._z=0,this._w=S):(this._x=0,this._y=-h.z,this._z=h.y,this._w=S)):(this._x=h.y*v.z-h.z*v.y,this._y=h.z*v.x-h.x*v.z,this._z=h.x*v.y-h.y*v.x,this._w=S),this.normalize()}angleTo(h){return 2*Math.acos(Math.abs(Ni(this.dot(h),-1,1)))}rotateTowards(h,v){const S=this.angleTo(h);if(S===0)return this;const b=Math.min(1,v/S);return this.slerp(h,b),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(h){return this._x*h._x+this._y*h._y+this._z*h._z+this._w*h._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let h=this.length();return h===0?(this._x=0,this._y=0,this._z=0,this._w=1):(h=1/h,this._x=this._x*h,this._y=this._y*h,this._z=this._z*h,this._w=this._w*h),this._onChangeCallback(),this}multiply(h,v){return v!==void 0?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(h,v)):this.multiplyQuaternions(this,h)}premultiply(h){return this.multiplyQuaternions(h,this)}multiplyQuaternions(h,v){const S=h._x,b=h._y,D=h._z,F=h._w,G=v._x,a=v._y,z=v._z,X=v._w;return this._x=S*X+F*G+b*z-D*a,this._y=b*X+F*a+D*G-S*z,this._z=D*X+F*z+S*a-b*G,this._w=F*X-S*G-b*a-D*z,this._onChangeCallback(),this}slerp(h,v){if(v===0)return this;if(v===1)return this.copy(h);const S=this._x,b=this._y,D=this._z,F=this._w;let G=F*h._w+S*h._x+b*h._y+D*h._z;if(G<0?(this._w=-h._w,this._x=-h._x,this._y=-h._y,this._z=-h._z,G=-G):this.copy(h),G>=1)return this._w=F,this._x=S,this._y=b,this._z=D,this;const a=1-G*G;if(a<=Number.EPSILON){const i2=1-v;return this._w=i2*F+v*this._w,this._x=i2*S+v*this._x,this._y=i2*b+v*this._y,this._z=i2*D+v*this._z,this.normalize(),this._onChangeCallback(),this}const z=Math.sqrt(a),X=Math.atan2(z,G),J=Math.sin((1-v)*X)/z,t2=Math.sin(v*X)/z;return this._w=F*J+this._w*t2,this._x=S*J+this._x*t2,this._y=b*J+this._y*t2,this._z=D*J+this._z*t2,this._onChangeCallback(),this}slerpQuaternions(h,v,S){this.copy(h).slerp(v,S)}random(){const h=Math.random(),v=Math.sqrt(1-h),S=Math.sqrt(h),b=2*Math.PI*Math.random(),D=2*Math.PI*Math.random();return this.set(v*Math.cos(b),S*Math.sin(D),S*Math.cos(D),v*Math.sin(b))}equals(h){return h._x===this._x&&h._y===this._y&&h._z===this._z&&h._w===this._w}fromArray(h,v=0){return this._x=h[v],this._y=h[v+1],this._z=h[v+2],this._w=h[v+3],this._onChangeCallback(),this}toArray(h=[],v=0){return h[v]=this._x,h[v+1]=this._y,h[v+2]=this._z,h[v+3]=this._w,h}fromBufferAttribute(h,v){return this._x=h.getX(v),this._y=h.getY(v),this._z=h.getZ(v),this._w=h.getW(v),this}_onChange(h){return this._onChangeCallback=h,this}_onChangeCallback(){}}gi.prototype.isQuaternion=!0;class D2{constructor(h=0,v=0,S=0){this.x=h,this.y=v,this.z=S}set(h,v,S){return S===void 0&&(S=this.z),this.x=h,this.y=v,this.z=S,this}setScalar(h){return this.x=h,this.y=h,this.z=h,this}setX(h){return this.x=h,this}setY(h){return this.y=h,this}setZ(h){return this.z=h,this}setComponent(h,v){switch(h){case 0:this.x=v;break;case 1:this.y=v;break;case 2:this.z=v;break;default:throw new Error("index is out of range: "+h)}return this}getComponent(h){switch(h){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+h)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(h){return this.x=h.x,this.y=h.y,this.z=h.z,this}add(h,v){return v!==void 0?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(h,v)):(this.x+=h.x,this.y+=h.y,this.z+=h.z,this)}addScalar(h){return this.x+=h,this.y+=h,this.z+=h,this}addVectors(h,v){return this.x=h.x+v.x,this.y=h.y+v.y,this.z=h.z+v.z,this}addScaledVector(h,v){return this.x+=h.x*v,this.y+=h.y*v,this.z+=h.z*v,this}sub(h,v){return v!==void 0?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(h,v)):(this.x-=h.x,this.y-=h.y,this.z-=h.z,this)}subScalar(h){return this.x-=h,this.y-=h,this.z-=h,this}subVectors(h,v){return this.x=h.x-v.x,this.y=h.y-v.y,this.z=h.z-v.z,this}multiply(h,v){return v!==void 0?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(h,v)):(this.x*=h.x,this.y*=h.y,this.z*=h.z,this)}multiplyScalar(h){return this.x*=h,this.y*=h,this.z*=h,this}multiplyVectors(h,v){return this.x=h.x*v.x,this.y=h.y*v.y,this.z=h.z*v.z,this}applyEuler(h){return h&&h.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(WH.setFromEuler(h))}applyAxisAngle(h,v){return this.applyQuaternion(WH.setFromAxisAngle(h,v))}applyMatrix3(h){const v=this.x,S=this.y,b=this.z,D=h.elements;return this.x=D[0]*v+D[3]*S+D[6]*b,this.y=D[1]*v+D[4]*S+D[7]*b,this.z=D[2]*v+D[5]*S+D[8]*b,this}applyNormalMatrix(h){return this.applyMatrix3(h).normalize()}applyMatrix4(h){const v=this.x,S=this.y,b=this.z,D=h.elements,F=1/(D[3]*v+D[7]*S+D[11]*b+D[15]);return this.x=(D[0]*v+D[4]*S+D[8]*b+D[12])*F,this.y=(D[1]*v+D[5]*S+D[9]*b+D[13])*F,this.z=(D[2]*v+D[6]*S+D[10]*b+D[14])*F,this}applyQuaternion(h){const v=this.x,S=this.y,b=this.z,D=h.x,F=h.y,G=h.z,a=h.w,z=a*v+F*b-G*S,X=a*S+G*v-D*b,J=a*b+D*S-F*v,t2=-D*v-F*S-G*b;return this.x=z*a+t2*-D+X*-G-J*-F,this.y=X*a+t2*-F+J*-D-z*-G,this.z=J*a+t2*-G+z*-F-X*-D,this}project(h){return this.applyMatrix4(h.matrixWorldInverse).applyMatrix4(h.projectionMatrix)}unproject(h){return this.applyMatrix4(h.projectionMatrixInverse).applyMatrix4(h.matrixWorld)}transformDirection(h){const v=this.x,S=this.y,b=this.z,D=h.elements;return this.x=D[0]*v+D[4]*S+D[8]*b,this.y=D[1]*v+D[5]*S+D[9]*b,this.z=D[2]*v+D[6]*S+D[10]*b,this.normalize()}divide(h){return this.x/=h.x,this.y/=h.y,this.z/=h.z,this}divideScalar(h){return this.multiplyScalar(1/h)}min(h){return this.x=Math.min(this.x,h.x),this.y=Math.min(this.y,h.y),this.z=Math.min(this.z,h.z),this}max(h){return this.x=Math.max(this.x,h.x),this.y=Math.max(this.y,h.y),this.z=Math.max(this.z,h.z),this}clamp(h,v){return this.x=Math.max(h.x,Math.min(v.x,this.x)),this.y=Math.max(h.y,Math.min(v.y,this.y)),this.z=Math.max(h.z,Math.min(v.z,this.z)),this}clampScalar(h,v){return this.x=Math.max(h,Math.min(v,this.x)),this.y=Math.max(h,Math.min(v,this.y)),this.z=Math.max(h,Math.min(v,this.z)),this}clampLength(h,v){const S=this.length();return this.divideScalar(S||1).multiplyScalar(Math.max(h,Math.min(v,S)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(h){return this.x*h.x+this.y*h.y+this.z*h.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(h){return this.normalize().multiplyScalar(h)}lerp(h,v){return this.x+=(h.x-this.x)*v,this.y+=(h.y-this.y)*v,this.z+=(h.z-this.z)*v,this}lerpVectors(h,v,S){return this.x=h.x+(v.x-h.x)*S,this.y=h.y+(v.y-h.y)*S,this.z=h.z+(v.z-h.z)*S,this}cross(h,v){return v!==void 0?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(h,v)):this.crossVectors(this,h)}crossVectors(h,v){const S=h.x,b=h.y,D=h.z,F=v.x,G=v.y,a=v.z;return this.x=b*a-D*G,this.y=D*F-S*a,this.z=S*G-b*F,this}projectOnVector(h){const v=h.lengthSq();if(v===0)return this.set(0,0,0);const S=h.dot(this)/v;return this.copy(h).multiplyScalar(S)}projectOnPlane(h){return I6.copy(this).projectOnVector(h),this.sub(I6)}reflect(h){return this.sub(I6.copy(h).multiplyScalar(2*this.dot(h)))}angleTo(h){const v=Math.sqrt(this.lengthSq()*h.lengthSq());if(v===0)return Math.PI/2;const S=this.dot(h)/v;return Math.acos(Ni(S,-1,1))}distanceTo(h){return Math.sqrt(this.distanceToSquared(h))}distanceToSquared(h){const v=this.x-h.x,S=this.y-h.y,b=this.z-h.z;return v*v+S*S+b*b}manhattanDistanceTo(h){return Math.abs(this.x-h.x)+Math.abs(this.y-h.y)+Math.abs(this.z-h.z)}setFromSpherical(h){return this.setFromSphericalCoords(h.radius,h.phi,h.theta)}setFromSphericalCoords(h,v,S){const b=Math.sin(v)*h;return this.x=b*Math.sin(S),this.y=Math.cos(v)*h,this.z=b*Math.cos(S),this}setFromCylindrical(h){return this.setFromCylindricalCoords(h.radius,h.theta,h.y)}setFromCylindricalCoords(h,v,S){return this.x=h*Math.sin(v),this.y=S,this.z=h*Math.cos(v),this}setFromMatrixPosition(h){const v=h.elements;return this.x=v[12],this.y=v[13],this.z=v[14],this}setFromMatrixScale(h){const v=this.setFromMatrixColumn(h,0).length(),S=this.setFromMatrixColumn(h,1).length(),b=this.setFromMatrixColumn(h,2).length();return this.x=v,this.y=S,this.z=b,this}setFromMatrixColumn(h,v){return this.fromArray(h.elements,v*4)}setFromMatrix3Column(h,v){return this.fromArray(h.elements,v*3)}equals(h){return h.x===this.x&&h.y===this.y&&h.z===this.z}fromArray(h,v=0){return this.x=h[v],this.y=h[v+1],this.z=h[v+2],this}toArray(h=[],v=0){return h[v]=this.x,h[v+1]=this.y,h[v+2]=this.z,h}fromBufferAttribute(h,v,S){return S!==void 0&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=h.getX(v),this.y=h.getY(v),this.z=h.getZ(v),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const h=(Math.random()-.5)*2,v=Math.random()*Math.PI*2,S=Math.sqrt(1-h**2);return this.x=S*Math.cos(v),this.y=S*Math.sin(v),this.z=h,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}D2.prototype.isVector3=!0;const I6=new D2,WH=new gi;class Tr{constructor(h=new D2(1/0,1/0,1/0),v=new D2(-1/0,-1/0,-1/0)){this.min=h,this.max=v}set(h,v){return this.min.copy(h),this.max.copy(v),this}setFromArray(h){let v=1/0,S=1/0,b=1/0,D=-1/0,F=-1/0,G=-1/0;for(let a=0,z=h.length;a D&&(D=X),J>F&&(F=J),t2>G&&(G=t2)}return this.min.set(v,S,b),this.max.set(D,F,G),this}setFromBufferAttribute(h){let v=1/0,S=1/0,b=1/0,D=-1/0,F=-1/0,G=-1/0;for(let a=0,z=h.count;a D&&(D=X),J>F&&(F=J),t2>G&&(G=t2)}return this.min.set(v,S,b),this.max.set(D,F,G),this}setFromPoints(h){this.makeEmpty();for(let v=0,S=h.length;v this.max.x||h.ythis.max.y||h.z this.max.z)}containsBox(h){return this.min.x<=h.min.x&&h.max.x<=this.max.x&&this.min.y<=h.min.y&&h.max.y<=this.max.y&&this.min.z<=h.min.z&&h.max.z<=this.max.z}getParameter(h,v){return v.set((h.x-this.min.x)/(this.max.x-this.min.x),(h.y-this.min.y)/(this.max.y-this.min.y),(h.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(h){return!(h.max.x this.max.x||h.max.y this.max.y||h.max.z this.max.z)}intersectsSphere(h){return this.clampPoint(h.center,vf),vf.distanceToSquared(h.center)<=h.radius*h.radius}intersectsPlane(h){let v,S;return h.normal.x>0?(v=h.normal.x*this.min.x,S=h.normal.x*this.max.x):(v=h.normal.x*this.max.x,S=h.normal.x*this.min.x),h.normal.y>0?(v+=h.normal.y*this.min.y,S+=h.normal.y*this.max.y):(v+=h.normal.y*this.max.y,S+=h.normal.y*this.min.y),h.normal.z>0?(v+=h.normal.z*this.min.z,S+=h.normal.z*this.max.z):(v+=h.normal.z*this.max.z,S+=h.normal.z*this.min.z),v<=-h.constant&&S>=-h.constant}intersectsTriangle(h){if(this.isEmpty())return!1;this.getCenter(kf),_8.subVectors(this.max,kf),yu.subVectors(h.a,kf),vu.subVectors(h.b,kf),ku.subVectors(h.c,kf),Ts.subVectors(vu,yu),Es.subVectors(ku,vu),w1.subVectors(yu,ku);let v=[0,-Ts.z,Ts.y,0,-Es.z,Es.y,0,-w1.z,w1.y,Ts.z,0,-Ts.x,Es.z,0,-Es.x,w1.z,0,-w1.x,-Ts.y,Ts.x,0,-Es.y,Es.x,0,-w1.y,w1.x,0];return!P6(v,yu,vu,ku,_8)||(v=[1,0,0,0,1,0,0,0,1],!P6(v,yu,vu,ku,_8))?!1:(h8.crossVectors(Ts,Es),v=[h8.x,h8.y,h8.z],P6(v,yu,vu,ku,_8))}clampPoint(h,v){return v.copy(h).clamp(this.min,this.max)}distanceToPoint(h){return vf.copy(h).clamp(this.min,this.max).sub(h).length()}getBoundingSphere(h){return this.getCenter(h.center),h.radius=this.getSize(vf).length()*.5,h}intersect(h){return this.min.max(h.min),this.max.min(h.max),this.isEmpty()&&this.makeEmpty(),this}union(h){return this.min.min(h.min),this.max.max(h.max),this}applyMatrix4(h){return this.isEmpty()?this:(zo[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(h),zo[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(h),zo[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(h),zo[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(h),zo[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(h),zo[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(h),zo[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(h),zo[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(h),this.setFromPoints(zo),this)}translate(h){return this.min.add(h),this.max.add(h),this}equals(h){return h.min.equals(this.min)&&h.max.equals(this.max)}}Tr.prototype.isBox3=!0;const zo=[new D2,new D2,new D2,new D2,new D2,new D2,new D2,new D2],vf=new D2,L6=new Tr,yu=new D2,vu=new D2,ku=new D2,Ts=new D2,Es=new D2,w1=new D2,kf=new D2,_8=new D2,h8=new D2,x1=new D2;function P6(B,h,v,S,b){for(let D=0,F=B.length-3;D<=F;D+=3){x1.fromArray(B,D);const G=b.x*Math.abs(x1.x)+b.y*Math.abs(x1.y)+b.z*Math.abs(x1.z),a=h.dot(x1),z=v.dot(x1),X=S.dot(x1);if(Math.max(-Math.max(a,z,X),Math.min(a,z,X))>G)return!1}return!0}const _c2=new Tr,HH=new D2,F6=new D2,j6=new D2;class W1{constructor(h=new D2,v=-1){this.center=h,this.radius=v}set(h,v){return this.center.copy(h),this.radius=v,this}setFromPoints(h,v){const S=this.center;v!==void 0?S.copy(v):_c2.setFromPoints(h).getCenter(S);let b=0;for(let D=0,F=h.length;D this.radius*this.radius&&(v.sub(this.center).normalize(),v.multiplyScalar(this.radius).add(this.center)),v}getBoundingBox(h){return this.isEmpty()?(h.makeEmpty(),h):(h.set(this.center,this.center),h.expandByScalar(this.radius),h)}applyMatrix4(h){return this.center.applyMatrix4(h),this.radius=this.radius*h.getMaxScaleOnAxis(),this}translate(h){return this.center.add(h),this}expandByPoint(h){j6.subVectors(h,this.center);const v=j6.lengthSq();if(v>this.radius*this.radius){const S=Math.sqrt(v),b=(S-this.radius)*.5;this.center.add(j6.multiplyScalar(b/S)),this.radius+=b}return this}union(h){return F6.subVectors(h.center,this.center).normalize().multiplyScalar(h.radius),this.expandByPoint(HH.copy(h.center).add(F6)),this.expandByPoint(HH.copy(h.center).sub(F6)),this}equals(h){return h.center.equals(this.center)&&h.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Uo=new D2,$6=new D2,a8=new D2,Rs=new D2,O6=new D2,m8=new D2,G6=new D2;class ul{constructor(h=new D2,v=new D2(0,0,-1)){this.origin=h,this.direction=v}set(h,v){return this.origin.copy(h),this.direction.copy(v),this}copy(h){return this.origin.copy(h.origin),this.direction.copy(h.direction),this}at(h,v){return v.copy(this.direction).multiplyScalar(h).add(this.origin)}lookAt(h){return this.direction.copy(h).sub(this.origin).normalize(),this}recast(h){return this.origin.copy(this.at(h,Uo)),this}closestPointToPoint(h,v){v.subVectors(h,this.origin);const S=v.dot(this.direction);return S<0?v.copy(this.origin):v.copy(this.direction).multiplyScalar(S).add(this.origin)}distanceToPoint(h){return Math.sqrt(this.distanceSqToPoint(h))}distanceSqToPoint(h){const v=Uo.subVectors(h,this.origin).dot(this.direction);return v<0?this.origin.distanceToSquared(h):(Uo.copy(this.direction).multiplyScalar(v).add(this.origin),Uo.distanceToSquared(h))}distanceSqToSegment(h,v,S,b){$6.copy(h).add(v).multiplyScalar(.5),a8.copy(v).sub(h).normalize(),Rs.copy(this.origin).sub($6);const D=h.distanceTo(v)*.5,F=-this.direction.dot(a8),G=Rs.dot(this.direction),a=-Rs.dot(a8),z=Rs.lengthSq(),X=Math.abs(1-F*F);let J,t2,i2,f2;if(X>0)if(J=F*a-G,t2=F*G-a,f2=D*X,J>=0)if(t2>=-f2)if(t2<=f2){const c2=1/X;J*=c2,t2*=c2,i2=J*(J+F*t2+2*G)+t2*(F*J+t2+2*a)+z}else t2=D,J=Math.max(0,-(F*t2+G)),i2=-J*J+t2*(t2+2*a)+z;else t2=-D,J=Math.max(0,-(F*t2+G)),i2=-J*J+t2*(t2+2*a)+z;else t2<=-f2?(J=Math.max(0,-(-F*D+G)),t2=J>0?-D:Math.min(Math.max(-D,-a),D),i2=-J*J+t2*(t2+2*a)+z):t2<=f2?(J=0,t2=Math.min(Math.max(-D,-a),D),i2=t2*(t2+2*a)+z):(J=Math.max(0,-(F*D+G)),t2=J>0?D:Math.min(Math.max(-D,-a),D),i2=-J*J+t2*(t2+2*a)+z);else t2=F>0?-D:D,J=Math.max(0,-(F*t2+G)),i2=-J*J+t2*(t2+2*a)+z;return S&&S.copy(this.direction).multiplyScalar(J).add(this.origin),b&&b.copy(a8).multiplyScalar(t2).add($6),i2}intersectSphere(h,v){Uo.subVectors(h.center,this.origin);const S=Uo.dot(this.direction),b=Uo.dot(Uo)-S*S,D=h.radius*h.radius;if(b>D)return null;const F=Math.sqrt(D-b),G=S-F,a=S+F;return G<0&&a<0?null:G<0?this.at(a,v):this.at(G,v)}intersectsSphere(h){return this.distanceSqToPoint(h.center)<=h.radius*h.radius}distanceToPlane(h){const v=h.normal.dot(this.direction);if(v===0)return h.distanceToPoint(this.origin)===0?0:null;const S=-(this.origin.dot(h.normal)+h.constant)/v;return S>=0?S:null}intersectPlane(h,v){const S=this.distanceToPlane(h);return S===null?null:this.at(S,v)}intersectsPlane(h){const v=h.distanceToPoint(this.origin);return v===0||h.normal.dot(this.direction)*v<0}intersectBox(h,v){let S,b,D,F,G,a;const z=1/this.direction.x,X=1/this.direction.y,J=1/this.direction.z,t2=this.origin;return z>=0?(S=(h.min.x-t2.x)*z,b=(h.max.x-t2.x)*z):(S=(h.max.x-t2.x)*z,b=(h.min.x-t2.x)*z),X>=0?(D=(h.min.y-t2.y)*X,F=(h.max.y-t2.y)*X):(D=(h.max.y-t2.y)*X,F=(h.min.y-t2.y)*X),S>F||D>b||((D>S||S!==S)&&(S=D),(F=0?(G=(h.min.z-t2.z)*J,a=(h.max.z-t2.z)*J):(G=(h.max.z-t2.z)*J,a=(h.min.z-t2.z)*J),S>a||G>b)||((G>S||S!==S)&&(S=G),(a=0?S:b,v)}intersectsBox(h){return this.intersectBox(h,Uo)!==null}intersectTriangle(h,v,S,b,D){O6.subVectors(v,h),m8.subVectors(S,h),G6.crossVectors(O6,m8);let F=this.direction.dot(G6),G;if(F>0){if(b)return null;G=1}else if(F<0)G=-1,F=-F;else return null;Rs.subVectors(this.origin,h);const a=G*this.direction.dot(m8.crossVectors(Rs,m8));if(a<0)return null;const z=G*this.direction.dot(O6.cross(Rs));if(z<0||a+z>F)return null;const X=-G*Rs.dot(G6);return X<0?null:this.at(X/F,D)}applyMatrix4(h){return this.origin.applyMatrix4(h),this.direction.transformDirection(h),this}equals(h){return h.origin.equals(this.origin)&&h.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class ve{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(h,v,S,b,D,F,G,a,z,X,J,t2,i2,f2,c2,A2){const o2=this.elements;return o2[0]=h,o2[4]=v,o2[8]=S,o2[12]=b,o2[1]=D,o2[5]=F,o2[9]=G,o2[13]=a,o2[2]=z,o2[6]=X,o2[10]=J,o2[14]=t2,o2[3]=i2,o2[7]=f2,o2[11]=c2,o2[15]=A2,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new ve().fromArray(this.elements)}copy(h){const v=this.elements,S=h.elements;return v[0]=S[0],v[1]=S[1],v[2]=S[2],v[3]=S[3],v[4]=S[4],v[5]=S[5],v[6]=S[6],v[7]=S[7],v[8]=S[8],v[9]=S[9],v[10]=S[10],v[11]=S[11],v[12]=S[12],v[13]=S[13],v[14]=S[14],v[15]=S[15],this}copyPosition(h){const v=this.elements,S=h.elements;return v[12]=S[12],v[13]=S[13],v[14]=S[14],this}setFromMatrix3(h){const v=h.elements;return this.set(v[0],v[3],v[6],0,v[1],v[4],v[7],0,v[2],v[5],v[8],0,0,0,0,1),this}extractBasis(h,v,S){return h.setFromMatrixColumn(this,0),v.setFromMatrixColumn(this,1),S.setFromMatrixColumn(this,2),this}makeBasis(h,v,S){return this.set(h.x,v.x,S.x,0,h.y,v.y,S.y,0,h.z,v.z,S.z,0,0,0,0,1),this}extractRotation(h){const v=this.elements,S=h.elements,b=1/wu.setFromMatrixColumn(h,0).length(),D=1/wu.setFromMatrixColumn(h,1).length(),F=1/wu.setFromMatrixColumn(h,2).length();return v[0]=S[0]*b,v[1]=S[1]*b,v[2]=S[2]*b,v[3]=0,v[4]=S[4]*D,v[5]=S[5]*D,v[6]=S[6]*D,v[7]=0,v[8]=S[8]*F,v[9]=S[9]*F,v[10]=S[10]*F,v[11]=0,v[12]=0,v[13]=0,v[14]=0,v[15]=1,this}makeRotationFromEuler(h){h&&h.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const v=this.elements,S=h.x,b=h.y,D=h.z,F=Math.cos(S),G=Math.sin(S),a=Math.cos(b),z=Math.sin(b),X=Math.cos(D),J=Math.sin(D);if(h.order==="XYZ"){const t2=F*X,i2=F*J,f2=G*X,c2=G*J;v[0]=a*X,v[4]=-a*J,v[8]=z,v[1]=i2+f2*z,v[5]=t2-c2*z,v[9]=-G*a,v[2]=c2-t2*z,v[6]=f2+i2*z,v[10]=F*a}else if(h.order==="YXZ"){const t2=a*X,i2=a*J,f2=z*X,c2=z*J;v[0]=t2+c2*G,v[4]=f2*G-i2,v[8]=F*z,v[1]=F*J,v[5]=F*X,v[9]=-G,v[2]=i2*G-f2,v[6]=c2+t2*G,v[10]=F*a}else if(h.order==="ZXY"){const t2=a*X,i2=a*J,f2=z*X,c2=z*J;v[0]=t2-c2*G,v[4]=-F*J,v[8]=f2+i2*G,v[1]=i2+f2*G,v[5]=F*X,v[9]=c2-t2*G,v[2]=-F*z,v[6]=G,v[10]=F*a}else if(h.order==="ZYX"){const t2=F*X,i2=F*J,f2=G*X,c2=G*J;v[0]=a*X,v[4]=f2*z-i2,v[8]=t2*z+c2,v[1]=a*J,v[5]=c2*z+t2,v[9]=i2*z-f2,v[2]=-z,v[6]=G*a,v[10]=F*a}else if(h.order==="YZX"){const t2=F*a,i2=F*z,f2=G*a,c2=G*z;v[0]=a*X,v[4]=c2-t2*J,v[8]=f2*J+i2,v[1]=J,v[5]=F*X,v[9]=-G*X,v[2]=-z*X,v[6]=i2*J+f2,v[10]=t2-c2*J}else if(h.order==="XZY"){const t2=F*a,i2=F*z,f2=G*a,c2=G*z;v[0]=a*X,v[4]=-J,v[8]=z*X,v[1]=t2*J+c2,v[5]=F*X,v[9]=i2*J-f2,v[2]=f2*J-i2,v[6]=G*X,v[10]=c2*J+t2}return v[3]=0,v[7]=0,v[11]=0,v[12]=0,v[13]=0,v[14]=0,v[15]=1,this}makeRotationFromQuaternion(h){return this.compose(hc2,h,ac2)}lookAt(h,v,S){const b=this.elements;return Xi.subVectors(h,v),Xi.lengthSq()===0&&(Xi.z=1),Xi.normalize(),Bs.crossVectors(S,Xi),Bs.lengthSq()===0&&(Math.abs(S.z)===1?Xi.x+=1e-4:Xi.z+=1e-4,Xi.normalize(),Bs.crossVectors(S,Xi)),Bs.normalize(),d8.crossVectors(Xi,Bs),b[0]=Bs.x,b[4]=d8.x,b[8]=Xi.x,b[1]=Bs.y,b[5]=d8.y,b[9]=Xi.y,b[2]=Bs.z,b[6]=d8.z,b[10]=Xi.z,this}multiply(h,v){return v!==void 0?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(h,v)):this.multiplyMatrices(this,h)}premultiply(h){return this.multiplyMatrices(h,this)}multiplyMatrices(h,v){const S=h.elements,b=v.elements,D=this.elements,F=S[0],G=S[4],a=S[8],z=S[12],X=S[1],J=S[5],t2=S[9],i2=S[13],f2=S[2],c2=S[6],A2=S[10],o2=S[14],u2=S[3],x2=S[7],k2=S[11],E2=S[15],F2=b[0],g2=b[4],X2=b[8],kt=b[12],_t=b[1],L2=b[5],ft=b[9],W2=b[13],H2=b[2],N2=b[6],z2=b[10],U2=b[14],ct=b[3],Dt=b[7],nt=b[11],tt=b[15];return D[0]=F*F2+G*_t+a*H2+z*ct,D[4]=F*g2+G*L2+a*N2+z*Dt,D[8]=F*X2+G*ft+a*z2+z*nt,D[12]=F*kt+G*W2+a*U2+z*tt,D[1]=X*F2+J*_t+t2*H2+i2*ct,D[5]=X*g2+J*L2+t2*N2+i2*Dt,D[9]=X*X2+J*ft+t2*z2+i2*nt,D[13]=X*kt+J*W2+t2*U2+i2*tt,D[2]=f2*F2+c2*_t+A2*H2+o2*ct,D[6]=f2*g2+c2*L2+A2*N2+o2*Dt,D[10]=f2*X2+c2*ft+A2*z2+o2*nt,D[14]=f2*kt+c2*W2+A2*U2+o2*tt,D[3]=u2*F2+x2*_t+k2*H2+E2*ct,D[7]=u2*g2+x2*L2+k2*N2+E2*Dt,D[11]=u2*X2+x2*ft+k2*z2+E2*nt,D[15]=u2*kt+x2*W2+k2*U2+E2*tt,this}multiplyScalar(h){const v=this.elements;return v[0]*=h,v[4]*=h,v[8]*=h,v[12]*=h,v[1]*=h,v[5]*=h,v[9]*=h,v[13]*=h,v[2]*=h,v[6]*=h,v[10]*=h,v[14]*=h,v[3]*=h,v[7]*=h,v[11]*=h,v[15]*=h,this}determinant(){const h=this.elements,v=h[0],S=h[4],b=h[8],D=h[12],F=h[1],G=h[5],a=h[9],z=h[13],X=h[2],J=h[6],t2=h[10],i2=h[14],f2=h[3],c2=h[7],A2=h[11],o2=h[15];return f2*(+D*a*J-b*z*J-D*G*t2+S*z*t2+b*G*i2-S*a*i2)+c2*(+v*a*i2-v*z*t2+D*F*t2-b*F*i2+b*z*X-D*a*X)+A2*(+v*z*J-v*G*i2-D*F*J+S*F*i2+D*G*X-S*z*X)+o2*(-b*G*X-v*a*J+v*G*t2+b*F*J-S*F*t2+S*a*X)}transpose(){const h=this.elements;let v;return v=h[1],h[1]=h[4],h[4]=v,v=h[2],h[2]=h[8],h[8]=v,v=h[6],h[6]=h[9],h[9]=v,v=h[3],h[3]=h[12],h[12]=v,v=h[7],h[7]=h[13],h[13]=v,v=h[11],h[11]=h[14],h[14]=v,this}setPosition(h,v,S){const b=this.elements;return h.isVector3?(b[12]=h.x,b[13]=h.y,b[14]=h.z):(b[12]=h,b[13]=v,b[14]=S),this}invert(){const h=this.elements,v=h[0],S=h[1],b=h[2],D=h[3],F=h[4],G=h[5],a=h[6],z=h[7],X=h[8],J=h[9],t2=h[10],i2=h[11],f2=h[12],c2=h[13],A2=h[14],o2=h[15],u2=J*A2*z-c2*t2*z+c2*a*i2-G*A2*i2-J*a*o2+G*t2*o2,x2=f2*t2*z-X*A2*z-f2*a*i2+F*A2*i2+X*a*o2-F*t2*o2,k2=X*c2*z-f2*J*z+f2*G*i2-F*c2*i2-X*G*o2+F*J*o2,E2=f2*J*a-X*c2*a-f2*G*t2+F*c2*t2+X*G*A2-F*J*A2,F2=v*u2+S*x2+b*k2+D*E2;if(F2===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const g2=1/F2;return h[0]=u2*g2,h[1]=(c2*t2*D-J*A2*D-c2*b*i2+S*A2*i2+J*b*o2-S*t2*o2)*g2,h[2]=(G*A2*D-c2*a*D+c2*b*z-S*A2*z-G*b*o2+S*a*o2)*g2,h[3]=(J*a*D-G*t2*D-J*b*z+S*t2*z+G*b*i2-S*a*i2)*g2,h[4]=x2*g2,h[5]=(X*A2*D-f2*t2*D+f2*b*i2-v*A2*i2-X*b*o2+v*t2*o2)*g2,h[6]=(f2*a*D-F*A2*D-f2*b*z+v*A2*z+F*b*o2-v*a*o2)*g2,h[7]=(F*t2*D-X*a*D+X*b*z-v*t2*z-F*b*i2+v*a*i2)*g2,h[8]=k2*g2,h[9]=(f2*J*D-X*c2*D-f2*S*i2+v*c2*i2+X*S*o2-v*J*o2)*g2,h[10]=(F*c2*D-f2*G*D+f2*S*z-v*c2*z-F*S*o2+v*G*o2)*g2,h[11]=(X*G*D-F*J*D-X*S*z+v*J*z+F*S*i2-v*G*i2)*g2,h[12]=E2*g2,h[13]=(X*c2*b-f2*J*b+f2*S*t2-v*c2*t2-X*S*A2+v*J*A2)*g2,h[14]=(f2*G*b-F*c2*b-f2*S*a+v*c2*a+F*S*A2-v*G*A2)*g2,h[15]=(F*J*b-X*G*b+X*S*a-v*J*a-F*S*t2+v*G*t2)*g2,this}scale(h){const v=this.elements,S=h.x,b=h.y,D=h.z;return v[0]*=S,v[4]*=b,v[8]*=D,v[1]*=S,v[5]*=b,v[9]*=D,v[2]*=S,v[6]*=b,v[10]*=D,v[3]*=S,v[7]*=b,v[11]*=D,this}getMaxScaleOnAxis(){const h=this.elements,v=h[0]*h[0]+h[1]*h[1]+h[2]*h[2],S=h[4]*h[4]+h[5]*h[5]+h[6]*h[6],b=h[8]*h[8]+h[9]*h[9]+h[10]*h[10];return Math.sqrt(Math.max(v,S,b))}makeTranslation(h,v,S){return this.set(1,0,0,h,0,1,0,v,0,0,1,S,0,0,0,1),this}makeRotationX(h){const v=Math.cos(h),S=Math.sin(h);return this.set(1,0,0,0,0,v,-S,0,0,S,v,0,0,0,0,1),this}makeRotationY(h){const v=Math.cos(h),S=Math.sin(h);return this.set(v,0,S,0,0,1,0,0,-S,0,v,0,0,0,0,1),this}makeRotationZ(h){const v=Math.cos(h),S=Math.sin(h);return this.set(v,-S,0,0,S,v,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(h,v){const S=Math.cos(v),b=Math.sin(v),D=1-S,F=h.x,G=h.y,a=h.z,z=D*F,X=D*G;return this.set(z*F+S,z*G-b*a,z*a+b*G,0,z*G+b*a,X*G+S,X*a-b*F,0,z*a-b*G,X*a+b*F,D*a*a+S,0,0,0,0,1),this}makeScale(h,v,S){return this.set(h,0,0,0,0,v,0,0,0,0,S,0,0,0,0,1),this}makeShear(h,v,S,b,D,F){return this.set(1,S,D,0,h,1,F,0,v,b,1,0,0,0,0,1),this}compose(h,v,S){const b=this.elements,D=v._x,F=v._y,G=v._z,a=v._w,z=D+D,X=F+F,J=G+G,t2=D*z,i2=D*X,f2=D*J,c2=F*X,A2=F*J,o2=G*J,u2=a*z,x2=a*X,k2=a*J,E2=S.x,F2=S.y,g2=S.z;return b[0]=(1-(c2+o2))*E2,b[1]=(i2+k2)*E2,b[2]=(f2-x2)*E2,b[3]=0,b[4]=(i2-k2)*F2,b[5]=(1-(t2+o2))*F2,b[6]=(A2+u2)*F2,b[7]=0,b[8]=(f2+x2)*g2,b[9]=(A2-u2)*g2,b[10]=(1-(t2+c2))*g2,b[11]=0,b[12]=h.x,b[13]=h.y,b[14]=h.z,b[15]=1,this}decompose(h,v,S){const b=this.elements;let D=wu.set(b[0],b[1],b[2]).length();const F=wu.set(b[4],b[5],b[6]).length(),G=wu.set(b[8],b[9],b[10]).length();this.determinant()<0&&(D=-D),h.x=b[12],h.y=b[13],h.z=b[14],Hr.copy(this);const z=1/D,X=1/F,J=1/G;return Hr.elements[0]*=z,Hr.elements[1]*=z,Hr.elements[2]*=z,Hr.elements[4]*=X,Hr.elements[5]*=X,Hr.elements[6]*=X,Hr.elements[8]*=J,Hr.elements[9]*=J,Hr.elements[10]*=J,v.setFromRotationMatrix(Hr),S.x=D,S.y=F,S.z=G,this}makePerspective(h,v,S,b,D,F){F===void 0&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const G=this.elements,a=2*D/(v-h),z=2*D/(S-b),X=(v+h)/(v-h),J=(S+b)/(S-b),t2=-(F+D)/(F-D),i2=-2*F*D/(F-D);return G[0]=a,G[4]=0,G[8]=X,G[12]=0,G[1]=0,G[5]=z,G[9]=J,G[13]=0,G[2]=0,G[6]=0,G[10]=t2,G[14]=i2,G[3]=0,G[7]=0,G[11]=-1,G[15]=0,this}makeOrthographic(h,v,S,b,D,F){const G=this.elements,a=1/(v-h),z=1/(S-b),X=1/(F-D),J=(v+h)*a,t2=(S+b)*z,i2=(F+D)*X;return G[0]=2*a,G[4]=0,G[8]=0,G[12]=-J,G[1]=0,G[5]=2*z,G[9]=0,G[13]=-t2,G[2]=0,G[6]=0,G[10]=-2*X,G[14]=-i2,G[3]=0,G[7]=0,G[11]=0,G[15]=1,this}equals(h){const v=this.elements,S=h.elements;for(let b=0;b<16;b++)if(v[b]!==S[b])return!1;return!0}fromArray(h,v=0){for(let S=0;S<16;S++)this.elements[S]=h[S+v];return this}toArray(h=[],v=0){const S=this.elements;return h[v]=S[0],h[v+1]=S[1],h[v+2]=S[2],h[v+3]=S[3],h[v+4]=S[4],h[v+5]=S[5],h[v+6]=S[6],h[v+7]=S[7],h[v+8]=S[8],h[v+9]=S[9],h[v+10]=S[10],h[v+11]=S[11],h[v+12]=S[12],h[v+13]=S[13],h[v+14]=S[14],h[v+15]=S[15],h}}ve.prototype.isMatrix4=!0;const wu=new D2,Hr=new ve,hc2=new D2(0,0,0),ac2=new D2(1,1,1),Bs=new D2,d8=new D2,Xi=new D2,VH=new ve,zH=new gi;class ll{constructor(h=0,v=0,S=0,b=ll.DefaultOrder){this._x=h,this._y=v,this._z=S,this._order=b}get x(){return this._x}set x(h){this._x=h,this._onChangeCallback()}get y(){return this._y}set y(h){this._y=h,this._onChangeCallback()}get z(){return this._z}set z(h){this._z=h,this._onChangeCallback()}get order(){return this._order}set order(h){this._order=h,this._onChangeCallback()}set(h,v,S,b=this._order){return this._x=h,this._y=v,this._z=S,this._order=b,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(h){return this._x=h._x,this._y=h._y,this._z=h._z,this._order=h._order,this._onChangeCallback(),this}setFromRotationMatrix(h,v=this._order,S=!0){const b=h.elements,D=b[0],F=b[4],G=b[8],a=b[1],z=b[5],X=b[9],J=b[2],t2=b[6],i2=b[10];switch(v){case"XYZ":this._y=Math.asin(Ni(G,-1,1)),Math.abs(G)<.9999999?(this._x=Math.atan2(-X,i2),this._z=Math.atan2(-F,D)):(this._x=Math.atan2(t2,z),this._z=0);break;case"YXZ":this._x=Math.asin(-Ni(X,-1,1)),Math.abs(X)<.9999999?(this._y=Math.atan2(G,i2),this._z=Math.atan2(a,z)):(this._y=Math.atan2(-J,D),this._z=0);break;case"ZXY":this._x=Math.asin(Ni(t2,-1,1)),Math.abs(t2)<.9999999?(this._y=Math.atan2(-J,i2),this._z=Math.atan2(-F,z)):(this._y=0,this._z=Math.atan2(a,D));break;case"ZYX":this._y=Math.asin(-Ni(J,-1,1)),Math.abs(J)<.9999999?(this._x=Math.atan2(t2,i2),this._z=Math.atan2(a,D)):(this._x=0,this._z=Math.atan2(-F,z));break;case"YZX":this._z=Math.asin(Ni(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-X,z),this._y=Math.atan2(-J,D)):(this._x=0,this._y=Math.atan2(G,i2));break;case"XZY":this._z=Math.asin(-Ni(F,-1,1)),Math.abs(F)<.9999999?(this._x=Math.atan2(t2,z),this._y=Math.atan2(G,D)):(this._x=Math.atan2(-X,i2),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+v)}return this._order=v,S===!0&&this._onChangeCallback(),this}setFromQuaternion(h,v,S){return VH.makeRotationFromQuaternion(h),this.setFromRotationMatrix(VH,v,S)}setFromVector3(h,v=this._order){return this.set(h.x,h.y,h.z,v)}reorder(h){return zH.setFromEuler(this),this.setFromQuaternion(zH,h)}equals(h){return h._x===this._x&&h._y===this._y&&h._z===this._z&&h._order===this._order}fromArray(h){return this._x=h[0],this._y=h[1],this._z=h[2],h[3]!==void 0&&(this._order=h[3]),this._onChangeCallback(),this}toArray(h=[],v=0){return h[v]=this._x,h[v+1]=this._y,h[v+2]=this._z,h[v+3]=this._order,h}toVector3(h){return h?h.set(this._x,this._y,this._z):new D2(this._x,this._y,this._z)}_onChange(h){return this._onChangeCallback=h,this}_onChangeCallback(){}}ll.prototype.isEuler=!0;ll.DefaultOrder="XYZ";ll.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class mc2{constructor(){this.mask=1}set(h){this.mask=(1< >>0}enable(h){this.mask|=1< 1){for(let v=0;v 1){for(let S=0;S 0){b.children=[];for(let G=0;G 0){b.animations=[];for(let G=0;G 0&&(S.geometries=G),a.length>0&&(S.materials=a),z.length>0&&(S.textures=z),X.length>0&&(S.images=X),J.length>0&&(S.shapes=J),t2.length>0&&(S.skeletons=t2),i2.length>0&&(S.animations=i2)}return S.object=b,S;function F(G){const a=[];for(const z in G){const X=G[z];delete X.metadata,a.push(X)}return a}}clone(h){return new this.constructor().copy(this,h)}copy(h,v=!0){if(this.name=h.name,this.up.copy(h.up),this.position.copy(h.position),this.rotation.order=h.rotation.order,this.quaternion.copy(h.quaternion),this.scale.copy(h.scale),this.matrix.copy(h.matrix),this.matrixWorld.copy(h.matrixWorld),this.matrixAutoUpdate=h.matrixAutoUpdate,this.matrixWorldNeedsUpdate=h.matrixWorldNeedsUpdate,this.layers.mask=h.layers.mask,this.visible=h.visible,this.castShadow=h.castShadow,this.receiveShadow=h.receiveShadow,this.frustumCulled=h.frustumCulled,this.renderOrder=h.renderOrder,this.userData=JSON.parse(JSON.stringify(h.userData)),v===!0)for(let S=0;S 0?b.multiplyScalar(1/Math.sqrt(D)):b.set(0,0,0)}static getBarycoord(h,v,S,b,D){Vr.subVectors(b,v),Yo.subVectors(S,v),N6.subVectors(h,v);const F=Vr.dot(Vr),G=Vr.dot(Yo),a=Vr.dot(N6),z=Yo.dot(Yo),X=Yo.dot(N6),J=F*z-G*G;if(J===0)return D.set(-2,-1,-1);const t2=1/J,i2=(z*a-G*X)*t2,f2=(F*X-G*a)*t2;return D.set(1-i2-f2,f2,i2)}static containsPoint(h,v,S,b){return this.getBarycoord(h,v,S,b,qo),qo.x>=0&&qo.y>=0&&qo.x+qo.y<=1}static getUV(h,v,S,b,D,F,G,a){return this.getBarycoord(h,v,S,b,qo),a.set(0,0),a.addScaledVector(D,qo.x),a.addScaledVector(F,qo.y),a.addScaledVector(G,qo.z),a}static isFrontFacing(h,v,S,b){return Vr.subVectors(S,v),Yo.subVectors(h,v),Vr.cross(Yo).dot(b)<0}set(h,v,S){return this.a.copy(h),this.b.copy(v),this.c.copy(S),this}setFromPointsAndIndices(h,v,S,b){return this.a.copy(h[v]),this.b.copy(h[S]),this.c.copy(h[b]),this}setFromAttributeAndIndices(h,v,S,b){return this.a.fromBufferAttribute(h,v),this.b.fromBufferAttribute(h,S),this.c.fromBufferAttribute(h,b),this}clone(){return new this.constructor().copy(this)}copy(h){return this.a.copy(h.a),this.b.copy(h.b),this.c.copy(h.c),this}getArea(){return Vr.subVectors(this.c,this.b),Yo.subVectors(this.a,this.b),Vr.cross(Yo).length()*.5}getMidpoint(h){return h.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(h){return M0.getNormal(this.a,this.b,this.c,h)}getPlane(h){return h.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(h,v){return M0.getBarycoord(h,this.a,this.b,this.c,v)}getUV(h,v,S,b,D){return M0.getUV(h,this.a,this.b,this.c,v,S,b,D)}containsPoint(h){return M0.containsPoint(h,this.a,this.b,this.c)}isFrontFacing(h){return M0.isFrontFacing(this.a,this.b,this.c,h)}intersectsBox(h){return h.intersectsTriangle(this)}closestPointToPoint(h,v){const S=this.a,b=this.b,D=this.c;let F,G;Su.subVectors(b,S),Cu.subVectors(D,S),W6.subVectors(h,S);const a=Su.dot(W6),z=Cu.dot(W6);if(a<=0&&z<=0)return v.copy(S);H6.subVectors(h,b);const X=Su.dot(H6),J=Cu.dot(H6);if(X>=0&&J<=X)return v.copy(b);const t2=a*J-X*z;if(t2<=0&&a>=0&&X<=0)return F=a/(a-X),v.copy(S).addScaledVector(Su,F);V6.subVectors(h,D);const i2=Su.dot(V6),f2=Cu.dot(V6);if(f2>=0&&i2<=f2)return v.copy(D);const c2=i2*z-a*f2;if(c2<=0&&z>=0&&f2<=0)return G=z/(z-f2),v.copy(S).addScaledVector(Cu,G);const A2=X*f2-i2*J;if(A2<=0&&J-X>=0&&i2-f2>=0)return XH.subVectors(D,b),G=(J-X)/(J-X+(i2-f2)),v.copy(b).addScaledVector(XH,G);const o2=1/(A2+c2+t2);return F=c2*o2,G=t2*o2,v.copy(S).addScaledVector(Su,F).addScaledVector(Cu,G)}equals(h){return h.a.equals(this.a)&&h.b.equals(this.b)&&h.c.equals(this.c)}}let vc2=0;class P0 extends N1{constructor(){super(),Object.defineProperty(this,"id",{value:vc2++}),this.uuid=Cr(),this.name="",this.type="Material",this.fog=!0,this.blending=jf,this.side=Ku,this.vertexColors=!1,this.opacity=1,this.format=li,this.transparent=!1,this.blendSrc=Cz,this.blendDst=Mz,this.blendEquation=Gu,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=kh,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=q82,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=B6,this.stencilZFail=B6,this.stencilZPass=B6,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(h){this._alphaTest>0!=h>0&&this.version++,this._alphaTest=h}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(h){if(h!==void 0)for(const v in h){const S=h[v];if(S===void 0){console.warn("THREE.Material: '"+v+"' parameter is undefined.");continue}if(v==="shading"){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=S===Sz;continue}const b=this[v];if(b===void 0){console.warn("THREE."+this.type+": '"+v+"' is not a property of this material.");continue}b&&b.isColor?b.set(S):b&&b.isVector3&&S&&S.isVector3?b.copy(S):this[v]=S}}toJSON(h){const v=h===void 0||typeof h=="string";v&&(h={textures:{},images:{}});const S={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};S.uuid=this.uuid,S.type=this.type,this.name!==""&&(S.name=this.name),this.color&&this.color.isColor&&(S.color=this.color.getHex()),this.roughness!==void 0&&(S.roughness=this.roughness),this.metalness!==void 0&&(S.metalness=this.metalness),this.sheen!==void 0&&(S.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(S.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(S.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(S.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(S.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(S.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(S.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(S.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(S.shininess=this.shininess),this.clearcoat!==void 0&&(S.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(S.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(S.clearcoatMap=this.clearcoatMap.toJSON(h).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(S.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(h).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(S.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(h).uuid,S.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(S.map=this.map.toJSON(h).uuid),this.matcap&&this.matcap.isTexture&&(S.matcap=this.matcap.toJSON(h).uuid),this.alphaMap&&this.alphaMap.isTexture&&(S.alphaMap=this.alphaMap.toJSON(h).uuid),this.lightMap&&this.lightMap.isTexture&&(S.lightMap=this.lightMap.toJSON(h).uuid,S.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(S.aoMap=this.aoMap.toJSON(h).uuid,S.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(S.bumpMap=this.bumpMap.toJSON(h).uuid,S.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(S.normalMap=this.normalMap.toJSON(h).uuid,S.normalMapType=this.normalMapType,S.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(S.displacementMap=this.displacementMap.toJSON(h).uuid,S.displacementScale=this.displacementScale,S.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(S.roughnessMap=this.roughnessMap.toJSON(h).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(S.metalnessMap=this.metalnessMap.toJSON(h).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(S.emissiveMap=this.emissiveMap.toJSON(h).uuid),this.specularMap&&this.specularMap.isTexture&&(S.specularMap=this.specularMap.toJSON(h).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(S.specularIntensityMap=this.specularIntensityMap.toJSON(h).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(S.specularColorMap=this.specularColorMap.toJSON(h).uuid),this.envMap&&this.envMap.isTexture&&(S.envMap=this.envMap.toJSON(h).uuid,this.combine!==void 0&&(S.combine=this.combine)),this.envMapIntensity!==void 0&&(S.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(S.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(S.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(S.gradientMap=this.gradientMap.toJSON(h).uuid),this.transmission!==void 0&&(S.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(S.transmissionMap=this.transmissionMap.toJSON(h).uuid),this.thickness!==void 0&&(S.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(S.thicknessMap=this.thicknessMap.toJSON(h).uuid),this.attenuationDistance!==void 0&&(S.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(S.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(S.size=this.size),this.shadowSide!==null&&(S.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(S.sizeAttenuation=this.sizeAttenuation),this.blending!==jf&&(S.blending=this.blending),this.side!==Ku&&(S.side=this.side),this.vertexColors&&(S.vertexColors=!0),this.opacity<1&&(S.opacity=this.opacity),this.format!==li&&(S.format=this.format),this.transparent===!0&&(S.transparent=this.transparent),S.depthFunc=this.depthFunc,S.depthTest=this.depthTest,S.depthWrite=this.depthWrite,S.colorWrite=this.colorWrite,S.stencilWrite=this.stencilWrite,S.stencilWriteMask=this.stencilWriteMask,S.stencilFunc=this.stencilFunc,S.stencilRef=this.stencilRef,S.stencilFuncMask=this.stencilFuncMask,S.stencilFail=this.stencilFail,S.stencilZFail=this.stencilZFail,S.stencilZPass=this.stencilZPass,this.rotation&&this.rotation!==0&&(S.rotation=this.rotation),this.polygonOffset===!0&&(S.polygonOffset=!0),this.polygonOffsetFactor!==0&&(S.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(S.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&this.linewidth!==1&&(S.linewidth=this.linewidth),this.dashSize!==void 0&&(S.dashSize=this.dashSize),this.gapSize!==void 0&&(S.gapSize=this.gapSize),this.scale!==void 0&&(S.scale=this.scale),this.dithering===!0&&(S.dithering=!0),this.alphaTest>0&&(S.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(S.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(S.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(S.wireframe=this.wireframe),this.wireframeLinewidth>1&&(S.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(S.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(S.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(S.flatShading=this.flatShading),this.visible===!1&&(S.visible=!1),this.toneMapped===!1&&(S.toneMapped=!1),JSON.stringify(this.userData)!=="{}"&&(S.userData=this.userData);function b(D){const F=[];for(const G in D){const a=D[G];delete a.metadata,F.push(a)}return F}if(v){const D=b(h.textures),F=b(h.images);D.length>0&&(S.textures=D),F.length>0&&(S.images=F)}return S}clone(){return new this.constructor().copy(this)}copy(h){this.name=h.name,this.fog=h.fog,this.blending=h.blending,this.side=h.side,this.vertexColors=h.vertexColors,this.opacity=h.opacity,this.format=h.format,this.transparent=h.transparent,this.blendSrc=h.blendSrc,this.blendDst=h.blendDst,this.blendEquation=h.blendEquation,this.blendSrcAlpha=h.blendSrcAlpha,this.blendDstAlpha=h.blendDstAlpha,this.blendEquationAlpha=h.blendEquationAlpha,this.depthFunc=h.depthFunc,this.depthTest=h.depthTest,this.depthWrite=h.depthWrite,this.stencilWriteMask=h.stencilWriteMask,this.stencilFunc=h.stencilFunc,this.stencilRef=h.stencilRef,this.stencilFuncMask=h.stencilFuncMask,this.stencilFail=h.stencilFail,this.stencilZFail=h.stencilZFail,this.stencilZPass=h.stencilZPass,this.stencilWrite=h.stencilWrite;const v=h.clippingPlanes;let S=null;if(v!==null){const b=v.length;S=new Array(b);for(let D=0;D!==b;++D)S[D]=v[D].clone()}return this.clippingPlanes=S,this.clipIntersection=h.clipIntersection,this.clipShadows=h.clipShadows,this.shadowSide=h.shadowSide,this.colorWrite=h.colorWrite,this.precision=h.precision,this.polygonOffset=h.polygonOffset,this.polygonOffsetFactor=h.polygonOffsetFactor,this.polygonOffsetUnits=h.polygonOffsetUnits,this.dithering=h.dithering,this.alphaTest=h.alphaTest,this.alphaToCoverage=h.alphaToCoverage,this.premultipliedAlpha=h.premultipliedAlpha,this.visible=h.visible,this.toneMapped=h.toneMapped,this.userData=JSON.parse(JSON.stringify(h.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(h){h===!0&&this.version++}}P0.prototype.isMaterial=!0;const jz={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},zr={h:0,s:0,l:0},g8={h:0,s:0,l:0};function z6(B,h,v){return v<0&&(v+=1),v>1&&(v-=1),v<1/6?B+(h-B)*6*v:v<1/2?h:v<2/3?B+(h-B)*6*(2/3-v):B}function U6(B){return B<.04045?B*.0773993808:Math.pow(B*.9478672986+.0521327014,2.4)}function Q6(B){return B<.0031308?B*12.92:1.055*Math.pow(B,.41666)-.055}class ue{constructor(h,v,S){return v===void 0&&S===void 0?this.set(h):this.setRGB(h,v,S)}set(h){return h&&h.isColor?this.copy(h):typeof h=="number"?this.setHex(h):typeof h=="string"&&this.setStyle(h),this}setScalar(h){return this.r=h,this.g=h,this.b=h,this}setHex(h){return h=Math.floor(h),this.r=(h>>16&255)/255,this.g=(h>>8&255)/255,this.b=(h&255)/255,this}setRGB(h,v,S){return this.r=h,this.g=v,this.b=S,this}setHSL(h,v,S){if(h=Yh(h,1),v=Ni(v,0,1),S=Ni(S,0,1),v===0)this.r=this.g=this.b=S;else{const b=S<=.5?S*(1+v):S+v-S*v,D=2*S-b;this.r=z6(D,b,h+1/3),this.g=z6(D,b,h),this.b=z6(D,b,h-1/3)}return this}setStyle(h){function v(b){b!==void 0&&parseFloat(b)<1&&console.warn("THREE.Color: Alpha component of "+h+" will be ignored.")}let S;if(S=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(h)){let b;const D=S[1],F=S[2];switch(D){case"rgb":case"rgba":if(b=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(F))return this.r=Math.min(255,parseInt(b[1],10))/255,this.g=Math.min(255,parseInt(b[2],10))/255,this.b=Math.min(255,parseInt(b[3],10))/255,v(b[4]),this;if(b=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(F))return this.r=Math.min(100,parseInt(b[1],10))/100,this.g=Math.min(100,parseInt(b[2],10))/100,this.b=Math.min(100,parseInt(b[3],10))/100,v(b[4]),this;break;case"hsl":case"hsla":if(b=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(F)){const G=parseFloat(b[1])/360,a=parseInt(b[2],10)/100,z=parseInt(b[3],10)/100;return v(b[4]),this.setHSL(G,a,z)}break}}else if(S=/^\#([A-Fa-f\d]+)$/.exec(h)){const b=S[1],D=b.length;if(D===3)return this.r=parseInt(b.charAt(0)+b.charAt(0),16)/255,this.g=parseInt(b.charAt(1)+b.charAt(1),16)/255,this.b=parseInt(b.charAt(2)+b.charAt(2),16)/255,this;if(D===6)return this.r=parseInt(b.charAt(0)+b.charAt(1),16)/255,this.g=parseInt(b.charAt(2)+b.charAt(3),16)/255,this.b=parseInt(b.charAt(4)+b.charAt(5),16)/255,this}return h&&h.length>0?this.setColorName(h):this}setColorName(h){const v=jz[h.toLowerCase()];return v!==void 0?this.setHex(v):console.warn("THREE.Color: Unknown color "+h),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(h){return this.r=h.r,this.g=h.g,this.b=h.b,this}copyGammaToLinear(h,v=2){return this.r=Math.pow(h.r,v),this.g=Math.pow(h.g,v),this.b=Math.pow(h.b,v),this}copyLinearToGamma(h,v=2){const S=v>0?1/v:1;return this.r=Math.pow(h.r,S),this.g=Math.pow(h.g,S),this.b=Math.pow(h.b,S),this}convertGammaToLinear(h){return this.copyGammaToLinear(this,h),this}convertLinearToGamma(h){return this.copyLinearToGamma(this,h),this}copySRGBToLinear(h){return this.r=U6(h.r),this.g=U6(h.g),this.b=U6(h.b),this}copyLinearToSRGB(h){return this.r=Q6(h.r),this.g=Q6(h.g),this.b=Q6(h.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return this.r*255<<16^this.g*255<<8^this.b*255<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(h){const v=this.r,S=this.g,b=this.b,D=Math.max(v,S,b),F=Math.min(v,S,b);let G,a;const z=(F+D)/2;if(F===D)G=0,a=0;else{const X=D-F;switch(a=z<=.5?X/(D+F):X/(2-D-F),D){case v:G=(S-b)/X+(S65535?Oz:$z)(h,1):this.index=h,this}getAttribute(h){return this.attributes[h]}setAttribute(h,v){return this.attributes[h]=v,this}deleteAttribute(h){return delete this.attributes[h],this}hasAttribute(h){return this.attributes[h]!==void 0}addGroup(h,v,S=0){this.groups.push({start:h,count:v,materialIndex:S})}clearGroups(){this.groups=[]}setDrawRange(h,v){this.drawRange.start=h,this.drawRange.count=v}applyMatrix4(h){const v=this.attributes.position;v!==void 0&&(v.applyMatrix4(h),v.needsUpdate=!0);const S=this.attributes.normal;if(S!==void 0){const D=new Q0().getNormalMatrix(h);S.applyNormalMatrix(D),S.needsUpdate=!0}const b=this.attributes.tangent;return b!==void 0&&(b.transformDirection(h),b.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(h){return Sr.makeRotationFromQuaternion(h),this.applyMatrix4(Sr),this}rotateX(h){return Sr.makeRotationX(h),this.applyMatrix4(Sr),this}rotateY(h){return Sr.makeRotationY(h),this.applyMatrix4(Sr),this}rotateZ(h){return Sr.makeRotationZ(h),this.applyMatrix4(Sr),this}translate(h,v,S){return Sr.makeTranslation(h,v,S),this.applyMatrix4(Sr),this}scale(h,v,S){return Sr.makeScale(h,v,S),this.applyMatrix4(Sr),this}lookAt(h){return Y6.lookAt(h),Y6.updateMatrix(),this.applyMatrix4(Y6.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Mu).negate(),this.translate(Mu.x,Mu.y,Mu.z),this}setFromPoints(h){const v=[];for(let S=0,b=h.length;S0&&(h.userData=this.userData),this.parameters!==void 0){const a=this.parameters;for(const z in a)a[z]!==void 0&&(h[z]=a[z]);return h}h.data={attributes:{}};const v=this.index;v!==null&&(h.data.index={type:v.array.constructor.name,array:Array.prototype.slice.call(v.array)});const S=this.attributes;for(const a in S){const z=S[a];h.data.attributes[a]=z.toJSON(h.data)}const b={};let D=!1;for(const a in this.morphAttributes){const z=this.morphAttributes[a],X=[];for(let J=0,t2=z.length;J 0&&(b[a]=X,D=!0)}D&&(h.data.morphAttributes=b,h.data.morphTargetsRelative=this.morphTargetsRelative);const F=this.groups;F.length>0&&(h.data.groups=JSON.parse(JSON.stringify(F)));const G=this.boundingSphere;return G!==null&&(h.data.boundingSphere={center:G.center.toArray(),radius:G.radius}),h}clone(){return new this.constructor().copy(this)}copy(h){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const v={};this.name=h.name;const S=h.index;S!==null&&this.setIndex(S.clone(v));const b=h.attributes;for(const z in b){const X=b[z];this.setAttribute(z,X.clone(v))}const D=h.morphAttributes;for(const z in D){const X=[],J=D[z];for(let t2=0,i2=J.length;t2 0){const b=v[S[0]];if(b!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let D=0,F=b.length;D 0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(h,v){const S=this.geometry,b=this.material,D=this.matrixWorld;if(b===void 0||(S.boundingSphere===null&&S.computeBoundingSphere(),q6.copy(S.boundingSphere),q6.applyMatrix4(D),h.ray.intersectsSphere(q6)===!1)||(JH.copy(D).invert(),bu.copy(h.ray).applyMatrix4(JH),S.boundingBox!==null&&bu.intersectsBox(S.boundingBox)===!1))return;let F;if(S.isBufferGeometry){const G=S.index,a=S.attributes.position,z=S.morphAttributes.position,X=S.morphTargetsRelative,J=S.attributes.uv,t2=S.attributes.uv2,i2=S.groups,f2=S.drawRange;if(G!==null)if(Array.isArray(b))for(let c2=0,A2=i2.length;c2 v.far?null:{distance:z,point:M8.clone(),object:B}}function b8(B,h,v,S,b,D,F,G,a,z,X,J){Ds.fromBufferAttribute(b,z),Is.fromBufferAttribute(b,X),Ls.fromBufferAttribute(b,J);const t2=B.morphTargetInfluences;if(D&&t2){v8.set(0,0,0),k8.set(0,0,0),w8.set(0,0,0);for(let f2=0,c2=D.length;f2 0?1:-1,X.push(Dt.x,Dt.y,Dt.z),J.push(Yt/g2),J.push(1-nt/X2),U2+=1}}for(let nt=0;nt 0&&(v.defines=this.defines),v.vertexShader=this.vertexShader,v.fragmentShader=this.fragmentShader;const S={};for(const b in this.extensions)this.extensions[b]===!0&&(S[b]=!0);return Object.keys(S).length>0&&(v.extensions=S),v}}L1.prototype.isShaderMaterial=!0;class sc extends Cn{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new ve,this.projectionMatrix=new ve,this.projectionMatrixInverse=new ve}copy(h,v){return super.copy(h,v),this.matrixWorldInverse.copy(h.matrixWorldInverse),this.projectionMatrix.copy(h.projectionMatrix),this.projectionMatrixInverse.copy(h.projectionMatrixInverse),this}getWorldDirection(h){this.updateWorldMatrix(!0,!1);const v=this.matrixWorld.elements;return h.set(-v[8],-v[9],-v[10]).normalize()}updateMatrixWorld(h){super.updateMatrixWorld(h),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(h,v){super.updateWorldMatrix(h,v),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}sc.prototype.isCamera=!0;class ui extends sc{constructor(h=50,v=1,S=.1,b=2e3){super(),this.type="PerspectiveCamera",this.fov=h,this.zoom=1,this.near=S,this.far=b,this.focus=10,this.aspect=v,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(h,v){return super.copy(h,v),this.fov=h.fov,this.zoom=h.zoom,this.near=h.near,this.far=h.far,this.focus=h.focus,this.aspect=h.aspect,this.view=h.view===null?null:Object.assign({},h.view),this.filmGauge=h.filmGauge,this.filmOffset=h.filmOffset,this}setFocalLength(h){const v=.5*this.getFilmHeight()/h;this.fov=Yf*2*Math.atan(v),this.updateProjectionMatrix()}getFocalLength(){const h=Math.tan($f*.5*this.fov);return .5*this.getFilmHeight()/h}getEffectiveFOV(){return Yf*2*Math.atan(Math.tan($f*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(h,v,S,b,D,F){this.aspect=h/v,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=h,this.view.fullHeight=v,this.view.offsetX=S,this.view.offsetY=b,this.view.width=D,this.view.height=F,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const h=this.near;let v=h*Math.tan($f*.5*this.fov)/this.zoom,S=2*v,b=this.aspect*S,D=-.5*b;const F=this.view;if(this.view!==null&&this.view.enabled){const a=F.fullWidth,z=F.fullHeight;D+=F.offsetX*b/a,v-=F.offsetY*S/z,b*=F.width/a,S*=F.height/z}const G=this.filmOffset;G!==0&&(D+=h*G/this.getFilmWidth()),this.projectionMatrix.makePerspective(D,D+b,v,v-S,h,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(h){const v=super.toJSON(h);return v.object.fov=this.fov,v.object.zoom=this.zoom,v.object.near=this.near,v.object.far=this.far,v.object.focus=this.focus,v.object.aspect=this.aspect,this.view!==null&&(v.object.view=Object.assign({},this.view)),v.object.filmGauge=this.filmGauge,v.object.filmOffset=this.filmOffset,v}}ui.prototype.isPerspectiveCamera=!0;const Tu=90,Eu=1;class Zh extends Cn{constructor(h,v,S){if(super(),this.type="CubeCamera",S.isWebGLCubeRenderTarget!==!0){console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");return}this.renderTarget=S;const b=new ui(Tu,Eu,h,v);b.layers=this.layers,b.up.set(0,-1,0),b.lookAt(new D2(1,0,0)),this.add(b);const D=new ui(Tu,Eu,h,v);D.layers=this.layers,D.up.set(0,-1,0),D.lookAt(new D2(-1,0,0)),this.add(D);const F=new ui(Tu,Eu,h,v);F.layers=this.layers,F.up.set(0,0,1),F.lookAt(new D2(0,1,0)),this.add(F);const G=new ui(Tu,Eu,h,v);G.layers=this.layers,G.up.set(0,0,-1),G.lookAt(new D2(0,-1,0)),this.add(G);const a=new ui(Tu,Eu,h,v);a.layers=this.layers,a.up.set(0,-1,0),a.lookAt(new D2(0,0,1)),this.add(a);const z=new ui(Tu,Eu,h,v);z.layers=this.layers,z.up.set(0,-1,0),z.lookAt(new D2(0,0,-1)),this.add(z)}update(h,v){this.parent===null&&this.updateMatrixWorld();const S=this.renderTarget,[b,D,F,G,a,z]=this.children,X=h.xr.enabled,J=h.getRenderTarget();h.xr.enabled=!1;const t2=S.texture.generateMipmaps;S.texture.generateMipmaps=!1,h.setRenderTarget(S,0),h.render(v,b),h.setRenderTarget(S,1),h.render(v,D),h.setRenderTarget(S,2),h.render(v,F),h.setRenderTarget(S,3),h.render(v,G),h.setRenderTarget(S,4),h.render(v,a),S.texture.generateMipmaps=t2,h.setRenderTarget(S,5),h.render(v,z),h.setRenderTarget(J),h.xr.enabled=X}}class uc extends F0{constructor(h,v,S,b,D,F,G,a,z,X){h=h!==void 0?h:[],v=v!==void 0?v:rp,super(h,v,S,b,D,F,G,a,z,X),this.flipY=!1}get images(){return this.image}set images(h){this.image=h}}uc.prototype.isCubeTexture=!0;class Gz extends Mr{constructor(h,v,S){Number.isInteger(v)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),v=S),super(h,h,v),v=v||{},this.texture=new uc(void 0,v.mapping,v.wrapS,v.wrapT,v.magFilter,v.minFilter,v.format,v.type,v.anisotropy,v.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=v.generateMipmaps!==void 0?v.generateMipmaps:!1,this.texture.minFilter=v.minFilter!==void 0?v.minFilter:Hi,this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(h,v){this.texture.type=v.type,this.texture.format=li,this.texture.encoding=v.encoding,this.texture.generateMipmaps=v.generateMipmaps,this.texture.minFilter=v.minFilter,this.texture.magFilter=v.magFilter;const S={uniforms:{tEquirect:{value:null}},vertexShader:` + + varying vec3 vWorldDirection; + + vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + + } + + void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include