celldega 0.13.0-alpha.1 → 0.13.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/celldega/static/widget.js +10 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var wm=Object.create;var Xs=Object.defineProperty;var cm=Object.getOwnPropertyDescriptor;var em=Object.getOwnPropertyNames;var Nm=Object.getPrototypeOf,km=Object.prototype.hasOwnProperty;var hm=(g,A,I)=>A in g?Xs(g,A,{enumerable:!0,configurable:!0,writable:!0,value:I}):g[A]=I;var kM=(g,A)=>()=>(A||g((A={exports:{}}).exports,A),A.exports),rg=(g,A)=>{for(var I in A)Xs(g,I,{get:A[I],enumerable:!0})},Fm=(g,A,I,B)=>{if(A&&typeof A=="object"||typeof A=="function")for(let Q of em(A))!km.call(g,Q)&&Q!==I&&Xs(g,Q,{get:()=>A[Q],enumerable:!(B=cm(A,Q))||B.enumerable});return g};var hM=(g,A,I)=>(I=g!=null?wm(Nm(g)):{},Fm(A||!g||!g.__esModule?Xs(I,"default",{value:g,enumerable:!0}):I,g));var k=(g,A,I)=>(hm(g,typeof A!="symbol"?A+"":A,I),I);var DU=kM((weA,Oc)=>{(function(g,A,I,B){"use strict";var Q=["","webkit","Moz","MS","ms","o"],C=A.createElement("div"),E="function",i=Math.round,o=Math.abs,D=Date.now;function a(F,n,Y){return setTimeout(R(F,Y),n)}function t(F,n,Y){return Array.isArray(F)?(G(F,Y[n],Y),!0):!1}function G(F,n,Y){var f;if(F)if(F.forEach)F.forEach(n,Y);else if(F.length!==B)for(f=0;f<F.length;)n.call(Y,F[f],f,F),f++;else for(f in F)F.hasOwnProperty(f)&&n.call(Y,F[f],f,F)}function s(F,n,Y){var f="DEPRECATED METHOD: "+n+`
|
|
2
2
|
`+Y+` AT
|
|
3
|
-
`;return function(){var Z=new Error("get-stack-trace"),P=Z&&Z.stack?Z.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",rA=g.console&&(g.console.warn||g.console.log);return rA&&rA.call(g.console,f,P),F.apply(this,arguments)}}var w;typeof Object.assign!="function"?w=function(n){if(n===B||n===null)throw new TypeError("Cannot convert undefined or null to object");for(var Y=Object(n),f=1;f<arguments.length;f++){var Z=arguments[f];if(Z!==B&&Z!==null)for(var P in Z)Z.hasOwnProperty(P)&&(Y[P]=Z[P])}return Y}:w=Object.assign;var e=s(function(n,Y,f){for(var Z=Object.keys(Y),P=0;P<Z.length;)(!f||f&&n[Z[P]]===B)&&(n[Z[P]]=Y[Z[P]]),P++;return n},"extend","Use `assign`."),c=s(function(n,Y){return e(n,Y,!0)},"merge","Use `assign`.");function h(F,n,Y){var f=n.prototype,Z;Z=F.prototype=Object.create(f),Z.constructor=F,Z._super=f,Y&&w(Z,Y)}function R(F,n){return function(){return F.apply(n,arguments)}}function N(F,n){return typeof F==E?F.apply(n&&n[0]||B,n):F}function y(F,n){return F===B?n:F}function r(F,n,Y){G(d(n),function(f){F.addEventListener(f,Y,!1)})}function J(F,n,Y){G(d(n),function(f){F.removeEventListener(f,Y,!1)})}function q(F,n){for(;F;){if(F==n)return!0;F=F.parentNode}return!1}function H(F,n){return F.indexOf(n)>-1}function d(F){return F.trim().split(/\s+/g)}function K(F,n,Y){if(F.indexOf&&!Y)return F.indexOf(n);for(var f=0;f<F.length;){if(Y&&F[f][Y]==n||!Y&&F[f]===n)return f;f++}return-1}function x(F){return Array.prototype.slice.call(F,0)}function W(F,n,Y){for(var f=[],Z=[],P=0;P<F.length;){var rA=n?F[P][n]:F[P];K(Z,rA)<0&&f.push(F[P]),Z[P]=rA,P++}return Y&&(n?f=f.sort(function(Hg,vg){return Hg[n]>vg[n]}):f=f.sort()),f}function u(F,n){for(var Y,f,Z=n[0].toUpperCase()+n.slice(1),P=0;P<Q.length;){if(Y=Q[P],f=Y?Y+Z:n,f in F)return f;P++}return B}var m=1;function _(){return m++}function MA(F){var n=F.ownerDocument||F;return n.defaultView||n.parentWindow||g}var qA=/mobile|tablet|ip(ad|hone|od)|android/i,tA="ontouchstart"in g,cA=u(g,"PointerEvent")!==B,ZA=tA&&qA.test(navigator.userAgent),yg="touch",Mh="pen",Jh="mouse",x3="kinect",u3=25,zg=1,UE=2,sg=4,DI=8,xs=1,bD=2,ZD=4,TD=8,PD=16,VB=bD|ZD,HE=TD|PD,$R=VB|HE,AM=["x","y"],us=["clientX","clientY"];function bI(F,n){var Y=this;this.manager=F,this.callback=n,this.element=F.element,this.target=F.options.inputTarget,this.domHandler=function(f){N(F.options.enable,[F])&&Y.handler(f)},this.init()}bI.prototype={handler:function(){},init:function(){this.evEl&&r(this.element,this.evEl,this.domHandler),this.evTarget&&r(this.target,this.evTarget,this.domHandler),this.evWin&&r(MA(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&J(this.element,this.evEl,this.domHandler),this.evTarget&&J(this.target,this.evTarget,this.domHandler),this.evWin&&J(MA(this.element),this.evWin,this.domHandler)}};function W3(F){var n,Y=F.options.inputClass;return Y?n=Y:cA?n=Kh:ZA?n=Zs:tA?n=qh:n=bs,new n(F,b3)}function b3(F,n,Y){var f=Y.pointers.length,Z=Y.changedPointers.length,P=n&zg&&f-Z===0,rA=n&(sg|DI)&&f-Z===0;Y.isFirst=!!P,Y.isFinal=!!rA,P&&(F.session={}),Y.eventType=n,Z3(F,Y),F.emit("hammer.input",Y),F.recognize(Y),F.session.prevInput=Y}function Z3(F,n){var Y=F.session,f=n.pointers,Z=f.length;Y.firstInput||(Y.firstInput=gM(n)),Z>1&&!Y.firstMultiple?Y.firstMultiple=gM(n):Z===1&&(Y.firstMultiple=!1);var P=Y.firstInput,rA=Y.firstMultiple,Jg=rA?rA.center:P.center,Hg=n.center=IM(f);n.timeStamp=D(),n.deltaTime=n.timeStamp-P.timeStamp,n.angle=Yh(Jg,Hg),n.distance=Ws(Jg,Hg),T3(Y,n),n.offsetDirection=QM(n.deltaX,n.deltaY);var vg=BM(n.deltaTime,n.deltaX,n.deltaY);n.overallVelocityX=vg.x,n.overallVelocityY=vg.y,n.overallVelocity=o(vg.x)>o(vg.y)?vg.x:vg.y,n.scale=rA?O3(rA.pointers,f):1,n.rotation=rA?V3(rA.pointers,f):0,n.maxPointers=Y.prevInput?n.pointers.length>Y.prevInput.maxPointers?n.pointers.length:Y.prevInput.maxPointers:n.pointers.length,P3(Y,n);var jB=F.element;q(n.srcEvent.target,jB)&&(jB=n.srcEvent.target),n.target=jB}function T3(F,n){var Y=n.center,f=F.offsetDelta||{},Z=F.prevDelta||{},P=F.prevInput||{};(n.eventType===zg||P.eventType===sg)&&(Z=F.prevDelta={x:P.deltaX||0,y:P.deltaY||0},f=F.offsetDelta={x:Y.x,y:Y.y}),n.deltaX=Z.x+(Y.x-f.x),n.deltaY=Z.y+(Y.y-f.y)}function P3(F,n){var Y=F.lastInterval||n,f=n.timeStamp-Y.timeStamp,Z,P,rA,Jg;if(n.eventType!=DI&&(f>u3||Y.velocity===B)){var Hg=n.deltaX-Y.deltaX,vg=n.deltaY-Y.deltaY,jB=BM(f,Hg,vg);P=jB.x,rA=jB.y,Z=o(jB.x)>o(jB.y)?jB.x:jB.y,Jg=QM(Hg,vg),F.lastInterval=n}else Z=Y.velocity,P=Y.velocityX,rA=Y.velocityY,Jg=Y.direction;n.velocity=Z,n.velocityX=P,n.velocityY=rA,n.direction=Jg}function gM(F){for(var n=[],Y=0;Y<F.pointers.length;)n[Y]={clientX:i(F.pointers[Y].clientX),clientY:i(F.pointers[Y].clientY)},Y++;return{timeStamp:D(),pointers:n,center:IM(n),deltaX:F.deltaX,deltaY:F.deltaY}}function IM(F){var n=F.length;if(n===1)return{x:i(F[0].clientX),y:i(F[0].clientY)};for(var Y=0,f=0,Z=0;Z<n;)Y+=F[Z].clientX,f+=F[Z].clientY,Z++;return{x:i(Y/n),y:i(f/n)}}function BM(F,n,Y){return{x:n/F||0,y:Y/F||0}}function QM(F,n){return F===n?xs:o(F)>=o(n)?F<0?bD:ZD:n<0?TD:PD}function Ws(F,n,Y){Y||(Y=AM);var f=n[Y[0]]-F[Y[0]],Z=n[Y[1]]-F[Y[1]];return Math.sqrt(f*f+Z*Z)}function Yh(F,n,Y){Y||(Y=AM);var f=n[Y[0]]-F[Y[0]],Z=n[Y[1]]-F[Y[1]];return Math.atan2(Z,f)*180/Math.PI}function V3(F,n){return Yh(n[1],n[0],us)+Yh(F[1],F[0],us)}function O3(F,n){return Ws(n[0],n[1],us)/Ws(F[0],F[1],us)}var j3={mousedown:zg,mousemove:UE,mouseup:sg},X3="mousedown",z3="mousemove mouseup";function bs(){this.evEl=X3,this.evWin=z3,this.pressed=!1,bI.apply(this,arguments)}h(bs,bI,{handler:function(n){var Y=j3[n.type];Y&zg&&n.button===0&&(this.pressed=!0),Y&UE&&n.which!==1&&(Y=sg),this.pressed&&(Y&sg&&(this.pressed=!1),this.callback(this.manager,Y,{pointers:[n],changedPointers:[n],pointerType:Jh,srcEvent:n}))}});var v3={pointerdown:zg,pointermove:UE,pointerup:sg,pointercancel:DI,pointerout:DI},_3={2:yg,3:Mh,4:Jh,5:x3},CM="pointerdown",EM="pointermove pointerup pointercancel";g.MSPointerEvent&&!g.PointerEvent&&(CM="MSPointerDown",EM="MSPointerMove MSPointerUp MSPointerCancel");function Kh(){this.evEl=CM,this.evWin=EM,bI.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}h(Kh,bI,{handler:function(n){var Y=this.store,f=!1,Z=n.type.toLowerCase().replace("ms",""),P=v3[Z],rA=_3[n.pointerType]||n.pointerType,Jg=rA==yg,Hg=K(Y,n.pointerId,"pointerId");P&zg&&(n.button===0||Jg)?Hg<0&&(Y.push(n),Hg=Y.length-1):P&(sg|DI)&&(f=!0),!(Hg<0)&&(Y[Hg]=n,this.callback(this.manager,P,{pointers:Y,changedPointers:[n],pointerType:rA,srcEvent:n}),f&&Y.splice(Hg,1))}});var $3={touchstart:zg,touchmove:UE,touchend:sg,touchcancel:DI},Am="touchstart",gm="touchstart touchmove touchend touchcancel";function iM(){this.evTarget=Am,this.evWin=gm,this.started=!1,bI.apply(this,arguments)}h(iM,bI,{handler:function(n){var Y=$3[n.type];if(Y===zg&&(this.started=!0),!!this.started){var f=Im.call(this,n,Y);Y&(sg|DI)&&f[0].length-f[1].length===0&&(this.started=!1),this.callback(this.manager,Y,{pointers:f[0],changedPointers:f[1],pointerType:yg,srcEvent:n})}}});function Im(F,n){var Y=x(F.touches),f=x(F.changedTouches);return n&(sg|DI)&&(Y=W(Y.concat(f),"identifier",!0)),[Y,f]}var Bm={touchstart:zg,touchmove:UE,touchend:sg,touchcancel:DI},Qm="touchstart touchmove touchend touchcancel";function Zs(){this.evTarget=Qm,this.targetIds={},bI.apply(this,arguments)}h(Zs,bI,{handler:function(n){var Y=Bm[n.type],f=Cm.call(this,n,Y);f&&this.callback(this.manager,Y,{pointers:f[0],changedPointers:f[1],pointerType:yg,srcEvent:n})}});function Cm(F,n){var Y=x(F.touches),f=this.targetIds;if(n&(zg|UE)&&Y.length===1)return f[Y[0].identifier]=!0,[Y,Y];var Z,P,rA=x(F.changedTouches),Jg=[],Hg=this.target;if(P=Y.filter(function(vg){return q(vg.target,Hg)}),n===zg)for(Z=0;Z<P.length;)f[P[Z].identifier]=!0,Z++;for(Z=0;Z<rA.length;)f[rA[Z].identifier]&&Jg.push(rA[Z]),n&(sg|DI)&&delete f[rA[Z].identifier],Z++;if(Jg.length)return[W(P.concat(Jg),"identifier",!0),Jg]}var Em=2500,oM=25;function qh(){bI.apply(this,arguments);var F=R(this.handler,this);this.touch=new Zs(this.manager,F),this.mouse=new bs(this.manager,F),this.primaryTouch=null,this.lastTouches=[]}h(qh,bI,{handler:function(n,Y,f){var Z=f.pointerType==yg,P=f.pointerType==Jh;if(!(P&&f.sourceCapabilities&&f.sourceCapabilities.firesTouchEvents)){if(Z)im.call(this,Y,f);else if(P&&om.call(this,f))return;this.callback(n,Y,f)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function im(F,n){F&zg?(this.primaryTouch=n.changedPointers[0].identifier,DM.call(this,n)):F&(sg|DI)&&DM.call(this,n)}function DM(F){var n=F.changedPointers[0];if(n.identifier===this.primaryTouch){var Y={x:n.clientX,y:n.clientY};this.lastTouches.push(Y);var f=this.lastTouches,Z=function(){var P=f.indexOf(Y);P>-1&&f.splice(P,1)};setTimeout(Z,Em)}}function om(F){for(var n=F.srcEvent.clientX,Y=F.srcEvent.clientY,f=0;f<this.lastTouches.length;f++){var Z=this.lastTouches[f],P=Math.abs(n-Z.x),rA=Math.abs(Y-Z.y);if(P<=oM&&rA<=oM)return!0}return!1}var aM=u(C.style,"touchAction"),tM=aM!==B,GM="compute",sM="auto",Uh="manipulation",SE="none",VD="pan-x",OD="pan-y",Ts=am();function Hh(F,n){this.manager=F,this.set(n)}Hh.prototype={set:function(F){F==GM&&(F=this.compute()),tM&&this.manager.element.style&&Ts[F]&&(this.manager.element.style[aM]=F),this.actions=F.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var F=[];return G(this.manager.recognizers,function(n){N(n.options.enable,[n])&&(F=F.concat(n.getTouchAction()))}),Dm(F.join(" "))},preventDefaults:function(F){var n=F.srcEvent,Y=F.offsetDirection;if(this.manager.session.prevented){n.preventDefault();return}var f=this.actions,Z=H(f,SE)&&!Ts[SE],P=H(f,OD)&&!Ts[OD],rA=H(f,VD)&&!Ts[VD];if(Z){var Jg=F.pointers.length===1,Hg=F.distance<2,vg=F.deltaTime<250;if(Jg&&Hg&&vg)return}if(!(rA&&P)&&(Z||P&&Y&VB||rA&&Y&HE))return this.preventSrc(n)},preventSrc:function(F){this.manager.session.prevented=!0,F.preventDefault()}};function Dm(F){if(H(F,SE))return SE;var n=H(F,VD),Y=H(F,OD);return n&&Y?SE:n||Y?n?VD:OD:H(F,Uh)?Uh:sM}function am(){if(!tM)return!1;var F={},n=g.CSS&&g.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(Y){F[Y]=n?g.CSS.supports("touch-action",Y):!0}),F}var Ps=1,ZI=2,Ti=4,LC=8,SQ=LC,jD=16,OB=32;function LQ(F){this.options=w({},this.defaults,F||{}),this.id=_(),this.manager=null,this.options.enable=y(this.options.enable,!0),this.state=Ps,this.simultaneous={},this.requireFail=[]}LQ.prototype={defaults:{},set:function(F){return w(this.options,F),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(F){if(t(F,"recognizeWith",this))return this;var n=this.simultaneous;return F=Vs(F,this),n[F.id]||(n[F.id]=F,F.recognizeWith(this)),this},dropRecognizeWith:function(F){return t(F,"dropRecognizeWith",this)?this:(F=Vs(F,this),delete this.simultaneous[F.id],this)},requireFailure:function(F){if(t(F,"requireFailure",this))return this;var n=this.requireFail;return F=Vs(F,this),K(n,F)===-1&&(n.push(F),F.requireFailure(this)),this},dropRequireFailure:function(F){if(t(F,"dropRequireFailure",this))return this;F=Vs(F,this);var n=K(this.requireFail,F);return n>-1&&this.requireFail.splice(n,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(F){return!!this.simultaneous[F.id]},emit:function(F){var n=this,Y=this.state;function f(Z){n.manager.emit(Z,F)}Y<LC&&f(n.options.event+wM(Y)),f(n.options.event),F.additionalEvent&&f(F.additionalEvent),Y>=LC&&f(n.options.event+wM(Y))},tryEmit:function(F){if(this.canEmit())return this.emit(F);this.state=OB},canEmit:function(){for(var F=0;F<this.requireFail.length;){if(!(this.requireFail[F].state&(OB|Ps)))return!1;F++}return!0},recognize:function(F){var n=w({},F);if(!N(this.options.enable,[this,n])){this.reset(),this.state=OB;return}this.state&(SQ|jD|OB)&&(this.state=Ps),this.state=this.process(n),this.state&(ZI|Ti|LC|jD)&&this.tryEmit(n)},process:function(F){},getTouchAction:function(){},reset:function(){}};function wM(F){return F&jD?"cancel":F&LC?"end":F&Ti?"move":F&ZI?"start":""}function cM(F){return F==PD?"down":F==TD?"up":F==bD?"left":F==ZD?"right":""}function Vs(F,n){var Y=n.manager;return Y?Y.get(F):F}function tB(){LQ.apply(this,arguments)}h(tB,LQ,{defaults:{pointers:1},attrTest:function(F){var n=this.options.pointers;return n===0||F.pointers.length===n},process:function(F){var n=this.state,Y=F.eventType,f=n&(ZI|Ti),Z=this.attrTest(F);return f&&(Y&DI||!Z)?n|jD:f||Z?Y&sg?n|LC:n&ZI?n|Ti:ZI:OB}});function Os(){tB.apply(this,arguments),this.pX=null,this.pY=null}h(Os,tB,{defaults:{event:"pan",threshold:10,pointers:1,direction:$R},getTouchAction:function(){var F=this.options.direction,n=[];return F&VB&&n.push(OD),F&HE&&n.push(VD),n},directionTest:function(F){var n=this.options,Y=!0,f=F.distance,Z=F.direction,P=F.deltaX,rA=F.deltaY;return Z&n.direction||(n.direction&VB?(Z=P===0?xs:P<0?bD:ZD,Y=P!=this.pX,f=Math.abs(F.deltaX)):(Z=rA===0?xs:rA<0?TD:PD,Y=rA!=this.pY,f=Math.abs(F.deltaY))),F.direction=Z,Y&&f>n.threshold&&Z&n.direction},attrTest:function(F){return tB.prototype.attrTest.call(this,F)&&(this.state&ZI||!(this.state&ZI)&&this.directionTest(F))},emit:function(F){this.pX=F.deltaX,this.pY=F.deltaY;var n=cM(F.direction);n&&(F.additionalEvent=this.options.event+n),this._super.emit.call(this,F)}});function Sh(){tB.apply(this,arguments)}h(Sh,tB,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[SE]},attrTest:function(F){return this._super.attrTest.call(this,F)&&(Math.abs(F.scale-1)>this.options.threshold||this.state&ZI)},emit:function(F){if(F.scale!==1){var n=F.scale<1?"in":"out";F.additionalEvent=this.options.event+n}this._super.emit.call(this,F)}});function Lh(){LQ.apply(this,arguments),this._timer=null,this._input=null}h(Lh,LQ,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[sM]},process:function(F){var n=this.options,Y=F.pointers.length===n.pointers,f=F.distance<n.threshold,Z=F.deltaTime>n.time;if(this._input=F,!f||!Y||F.eventType&(sg|DI)&&!Z)this.reset();else if(F.eventType&zg)this.reset(),this._timer=a(function(){this.state=SQ,this.tryEmit()},n.time,this);else if(F.eventType&sg)return SQ;return OB},reset:function(){clearTimeout(this._timer)},emit:function(F){this.state===SQ&&(F&&F.eventType&sg?this.manager.emit(this.options.event+"up",F):(this._input.timeStamp=D(),this.manager.emit(this.options.event,this._input)))}});function dh(){tB.apply(this,arguments)}h(dh,tB,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[SE]},attrTest:function(F){return this._super.attrTest.call(this,F)&&(Math.abs(F.rotation)>this.options.threshold||this.state&ZI)}});function ph(){tB.apply(this,arguments)}h(ph,tB,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:VB|HE,pointers:1},getTouchAction:function(){return Os.prototype.getTouchAction.call(this)},attrTest:function(F){var n=this.options.direction,Y;return n&(VB|HE)?Y=F.overallVelocity:n&VB?Y=F.overallVelocityX:n&HE&&(Y=F.overallVelocityY),this._super.attrTest.call(this,F)&&n&F.offsetDirection&&F.distance>this.options.threshold&&F.maxPointers==this.options.pointers&&o(Y)>this.options.velocity&&F.eventType&sg},emit:function(F){var n=cM(F.offsetDirection);n&&this.manager.emit(this.options.event+n,F),this.manager.emit(this.options.event,F)}});function js(){LQ.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}h(js,LQ,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Uh]},process:function(F){var n=this.options,Y=F.pointers.length===n.pointers,f=F.distance<n.threshold,Z=F.deltaTime<n.time;if(this.reset(),F.eventType&zg&&this.count===0)return this.failTimeout();if(f&&Z&&Y){if(F.eventType!=sg)return this.failTimeout();var P=this.pTime?F.timeStamp-this.pTime<n.interval:!0,rA=!this.pCenter||Ws(this.pCenter,F.center)<n.posThreshold;this.pTime=F.timeStamp,this.pCenter=F.center,!rA||!P?this.count=1:this.count+=1,this._input=F;var Jg=this.count%n.taps;if(Jg===0)return this.hasRequireFailures()?(this._timer=a(function(){this.state=SQ,this.tryEmit()},n.interval,this),ZI):SQ}return OB},failTimeout:function(){return this._timer=a(function(){this.state=OB},this.options.interval,this),OB},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==SQ&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function dC(F,n){return n=n||{},n.recognizers=y(n.recognizers,dC.defaults.preset),new lh(F,n)}dC.VERSION="2.0.7",dC.defaults={domEvents:!1,touchAction:GM,enable:!0,inputTarget:null,inputClass:null,preset:[[dh,{enable:!1}],[Sh,{enable:!1},["rotate"]],[ph,{direction:VB}],[Os,{direction:VB},["swipe"]],[js],[js,{event:"doubletap",taps:2},["tap"]],[Lh]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var tm=1,eM=2;function lh(F,n){this.options=w({},dC.defaults,n||{}),this.options.inputTarget=this.options.inputTarget||F,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=F,this.input=W3(this),this.touchAction=new Hh(this,this.options.touchAction),NM(this,!0),G(this.options.recognizers,function(Y){var f=this.add(new Y[0](Y[1]));Y[2]&&f.recognizeWith(Y[2]),Y[3]&&f.requireFailure(Y[3])},this)}lh.prototype={set:function(F){return w(this.options,F),F.touchAction&&this.touchAction.update(),F.inputTarget&&(this.input.destroy(),this.input.target=F.inputTarget,this.input.init()),this},stop:function(F){this.session.stopped=F?eM:tm},recognize:function(F){var n=this.session;if(!n.stopped){this.touchAction.preventDefaults(F);var Y,f=this.recognizers,Z=n.curRecognizer;(!Z||Z&&Z.state&SQ)&&(Z=n.curRecognizer=null);for(var P=0;P<f.length;)Y=f[P],n.stopped!==eM&&(!Z||Y==Z||Y.canRecognizeWith(Z))?Y.recognize(F):Y.reset(),!Z&&Y.state&(ZI|Ti|LC)&&(Z=n.curRecognizer=Y),P++}},get:function(F){if(F instanceof LQ)return F;for(var n=this.recognizers,Y=0;Y<n.length;Y++)if(n[Y].options.event==F)return n[Y];return null},add:function(F){if(t(F,"add",this))return this;var n=this.get(F.options.event);return n&&this.remove(n),this.recognizers.push(F),F.manager=this,this.touchAction.update(),F},remove:function(F){if(t(F,"remove",this))return this;if(F=this.get(F),F){var n=this.recognizers,Y=K(n,F);Y!==-1&&(n.splice(Y,1),this.touchAction.update())}return this},on:function(F,n){if(F!==B&&n!==B){var Y=this.handlers;return G(d(F),function(f){Y[f]=Y[f]||[],Y[f].push(n)}),this}},off:function(F,n){if(F!==B){var Y=this.handlers;return G(d(F),function(f){n?Y[f]&&Y[f].splice(K(Y[f],n),1):delete Y[f]}),this}},emit:function(F,n){this.options.domEvents&&Gm(F,n);var Y=this.handlers[F]&&this.handlers[F].slice();if(!(!Y||!Y.length)){n.type=F,n.preventDefault=function(){n.srcEvent.preventDefault()};for(var f=0;f<Y.length;)Y[f](n),f++}},destroy:function(){this.element&&NM(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function NM(F,n){var Y=F.element;if(Y.style){var f;G(F.options.cssProps,function(Z,P){f=u(Y.style,P),n?(F.oldCssProps[f]=Y.style[f],Y.style[f]=Z):Y.style[f]=F.oldCssProps[f]||""}),n||(F.oldCssProps={})}}function Gm(F,n){var Y=A.createEvent("Event");Y.initEvent(F,!0,!0),Y.gesture=n,n.target.dispatchEvent(Y)}w(dC,{INPUT_START:zg,INPUT_MOVE:UE,INPUT_END:sg,INPUT_CANCEL:DI,STATE_POSSIBLE:Ps,STATE_BEGAN:ZI,STATE_CHANGED:Ti,STATE_ENDED:LC,STATE_RECOGNIZED:SQ,STATE_CANCELLED:jD,STATE_FAILED:OB,DIRECTION_NONE:xs,DIRECTION_LEFT:bD,DIRECTION_RIGHT:ZD,DIRECTION_UP:TD,DIRECTION_DOWN:PD,DIRECTION_HORIZONTAL:VB,DIRECTION_VERTICAL:HE,DIRECTION_ALL:$R,Manager:lh,Input:bI,TouchAction:Hh,TouchInput:Zs,MouseInput:bs,PointerEventInput:Kh,TouchMouseInput:qh,SingleTouchInput:iM,Recognizer:LQ,AttrRecognizer:tB,Tap:js,Pan:Os,Swipe:ph,Pinch:Sh,Rotate:dh,Press:Lh,on:r,off:J,each:G,merge:c,extend:e,assign:w,inherit:h,bindFn:R,prefixed:u});var sm=typeof g<"u"?g:typeof self<"u"?self:{};sm.Hammer=dC,typeof Oc<"u"&&Oc.exports?Oc.exports=dC:g[I]=dC})(window,document,"Hammer")});var HH=kM((sFA,cr)=>{"use strict";cr.exports=ee;cr.exports.default=ee;function ee(g,A,I){I=I||2;var B=A&&A.length,Q=B?A[0]*I:g.length,C=KH(g,0,Q,I,!0),E=[];if(!C||C.next===C.prev)return E;var i,o,D,a,t,G,s;if(B&&(C=kX(g,A,C,I)),g.length>80*I){i=D=g[0],o=a=g[1];for(var w=I;w<Q;w+=I)t=g[w],G=g[w+1],t<i&&(i=t),G<o&&(o=G),t>D&&(D=t),G>a&&(a=G);s=Math.max(D-i,a-o),s=s!==0?32767/s:0}return bt(C,E,I,i,o,s,0),E}function KH(g,A,I,B,Q){var C,E;if(Q===wr(g,A,I,B)>0)for(C=A;C<I;C+=B)E=YH(C,g[C],g[C+1],E);else for(C=I-B;C>=A;C-=B)E=YH(C,g[C],g[C+1],E);return E&&Ne(E,E.next)&&(Tt(E),E=E.next),E}function Di(g,A){if(!g)return g;A||(A=g);var I=g,B;do if(B=!1,!I.steiner&&(Ne(I,I.next)||Ag(I.prev,I,I.next)===0)){if(Tt(I),I=A=I.prev,I===I.next)break;B=!0}else I=I.next;while(B||I!==A);return A}function bt(g,A,I,B,Q,C,E){if(g){!E&&C&&nX(g,B,Q,C);for(var i=g,o,D;g.prev!==g.next;){if(o=g.prev,D=g.next,C?cX(g,B,Q,C):wX(g)){A.push(o.i/I|0),A.push(g.i/I|0),A.push(D.i/I|0),Tt(g),g=D.next,i=D.next;continue}if(g=D,g===i){E?E===1?(g=eX(Di(g),A,I),bt(g,A,I,B,Q,C,2)):E===2&&NX(g,A,I,B,Q,C):bt(Di(g),A,I,B,Q,C,1);break}}}}function wX(g){var A=g.prev,I=g,B=g.next;if(Ag(A,I,B)>=0)return!1;for(var Q=A.x,C=I.x,E=B.x,i=A.y,o=I.y,D=B.y,a=Q<C?Q<E?Q:E:C<E?C:E,t=i<o?i<D?i:D:o<D?o:D,G=Q>C?Q>E?Q:E:C>E?C:E,s=i>o?i>D?i:D:o>D?o:D,w=B.next;w!==A;){if(w.x>=a&&w.x<=G&&w.y>=t&&w.y<=s&&fo(Q,i,C,o,E,D,w.x,w.y)&&Ag(w.prev,w,w.next)>=0)return!1;w=w.next}return!0}function cX(g,A,I,B){var Q=g.prev,C=g,E=g.next;if(Ag(Q,C,E)>=0)return!1;for(var i=Q.x,o=C.x,D=E.x,a=Q.y,t=C.y,G=E.y,s=i<o?i<D?i:D:o<D?o:D,w=a<t?a<G?a:G:t<G?t:G,e=i>o?i>D?i:D:o>D?o:D,c=a>t?a>G?a:G:t>G?t:G,h=Gr(s,w,A,I,B),R=Gr(e,c,A,I,B),N=g.prevZ,y=g.nextZ;N&&N.z>=h&&y&&y.z<=R;){if(N.x>=s&&N.x<=e&&N.y>=w&&N.y<=c&&N!==Q&&N!==E&&fo(i,a,o,t,D,G,N.x,N.y)&&Ag(N.prev,N,N.next)>=0||(N=N.prevZ,y.x>=s&&y.x<=e&&y.y>=w&&y.y<=c&&y!==Q&&y!==E&&fo(i,a,o,t,D,G,y.x,y.y)&&Ag(y.prev,y,y.next)>=0))return!1;y=y.nextZ}for(;N&&N.z>=h;){if(N.x>=s&&N.x<=e&&N.y>=w&&N.y<=c&&N!==Q&&N!==E&&fo(i,a,o,t,D,G,N.x,N.y)&&Ag(N.prev,N,N.next)>=0)return!1;N=N.prevZ}for(;y&&y.z<=R;){if(y.x>=s&&y.x<=e&&y.y>=w&&y.y<=c&&y!==Q&&y!==E&&fo(i,a,o,t,D,G,y.x,y.y)&&Ag(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function eX(g,A,I){var B=g;do{var Q=B.prev,C=B.next.next;!Ne(Q,C)&&qH(Q,B,B.next,C)&&Zt(Q,C)&&Zt(C,Q)&&(A.push(Q.i/I|0),A.push(B.i/I|0),A.push(C.i/I|0),Tt(B),Tt(B.next),B=g=C),B=B.next}while(B!==g);return Di(B)}function NX(g,A,I,B,Q,C){var E=g;do{for(var i=E.next.next;i!==E.prev;){if(E.i!==i.i&&JX(E,i)){var o=UH(E,i);E=Di(E,E.next),o=Di(o,o.next),bt(E,A,I,B,Q,C,0),bt(o,A,I,B,Q,C,0);return}i=i.next}E=E.next}while(E!==g)}function kX(g,A,I,B){var Q=[],C,E,i,o,D;for(C=0,E=A.length;C<E;C++)i=A[C]*B,o=C<E-1?A[C+1]*B:g.length,D=KH(g,i,o,B,!1),D===D.next&&(D.steiner=!0),Q.push(MX(D));for(Q.sort(hX),C=0;C<Q.length;C++)I=FX(Q[C],I);return I}function hX(g,A){return g.x-A.x}function FX(g,A){var I=yX(g,A);if(!I)return A;var B=UH(I,g);return Di(B,B.next),Di(I,I.next)}function yX(g,A){var I=A,B=g.x,Q=g.y,C=-1/0,E;do{if(Q<=I.y&&Q>=I.next.y&&I.next.y!==I.y){var i=I.x+(Q-I.y)*(I.next.x-I.x)/(I.next.y-I.y);if(i<=B&&i>C&&(C=i,E=I.x<I.next.x?I:I.next,i===B))return E}I=I.next}while(I!==A);if(!E)return null;var o=E,D=E.x,a=E.y,t=1/0,G;I=E;do B>=I.x&&I.x>=D&&B!==I.x&&fo(Q<a?B:C,Q,D,a,Q<a?C:B,Q,I.x,I.y)&&(G=Math.abs(Q-I.y)/(B-I.x),Zt(I,g)&&(G<t||G===t&&(I.x>E.x||I.x===E.x&&rX(E,I)))&&(E=I,t=G)),I=I.next;while(I!==o);return E}function rX(g,A){return Ag(g.prev,g,A.prev)<0&&Ag(A.next,g,g.next)<0}function nX(g,A,I,B){var Q=g;do Q.z===0&&(Q.z=Gr(Q.x,Q.y,A,I,B)),Q.prevZ=Q.prev,Q.nextZ=Q.next,Q=Q.next;while(Q!==g);Q.prevZ.nextZ=null,Q.prevZ=null,RX(Q)}function RX(g){var A,I,B,Q,C,E,i,o,D=1;do{for(I=g,g=null,C=null,E=0;I;){for(E++,B=I,i=0,A=0;A<D&&(i++,B=B.nextZ,!!B);A++);for(o=D;i>0||o>0&&B;)i!==0&&(o===0||!B||I.z<=B.z)?(Q=I,I=I.nextZ,i--):(Q=B,B=B.nextZ,o--),C?C.nextZ=Q:g=Q,Q.prevZ=C,C=Q;I=B}C.nextZ=null,D*=2}while(E>1);return g}function Gr(g,A,I,B,Q){return g=(g-I)*Q|0,A=(A-B)*Q|0,g=(g|g<<8)&16711935,g=(g|g<<4)&252645135,g=(g|g<<2)&858993459,g=(g|g<<1)&1431655765,A=(A|A<<8)&16711935,A=(A|A<<4)&252645135,A=(A|A<<2)&858993459,A=(A|A<<1)&1431655765,g|A<<1}function MX(g){var A=g,I=g;do(A.x<I.x||A.x===I.x&&A.y<I.y)&&(I=A),A=A.next;while(A!==g);return I}function fo(g,A,I,B,Q,C,E,i){return(Q-E)*(A-i)>=(g-E)*(C-i)&&(g-E)*(B-i)>=(I-E)*(A-i)&&(I-E)*(C-i)>=(Q-E)*(B-i)}function JX(g,A){return g.next.i!==A.i&&g.prev.i!==A.i&&!YX(g,A)&&(Zt(g,A)&&Zt(A,g)&&KX(g,A)&&(Ag(g.prev,g,A.prev)||Ag(g,A.prev,A))||Ne(g,A)&&Ag(g.prev,g,g.next)>0&&Ag(A.prev,A,A.next)>0)}function Ag(g,A,I){return(A.y-g.y)*(I.x-A.x)-(A.x-g.x)*(I.y-A.y)}function Ne(g,A){return g.x===A.x&&g.y===A.y}function qH(g,A,I,B){var Q=ce(Ag(g,A,I)),C=ce(Ag(g,A,B)),E=ce(Ag(I,B,g)),i=ce(Ag(I,B,A));return!!(Q!==C&&E!==i||Q===0&&we(g,I,A)||C===0&&we(g,B,A)||E===0&&we(I,g,B)||i===0&&we(I,A,B))}function we(g,A,I){return A.x<=Math.max(g.x,I.x)&&A.x>=Math.min(g.x,I.x)&&A.y<=Math.max(g.y,I.y)&&A.y>=Math.min(g.y,I.y)}function ce(g){return g>0?1:g<0?-1:0}function YX(g,A){var I=g;do{if(I.i!==g.i&&I.next.i!==g.i&&I.i!==A.i&&I.next.i!==A.i&&qH(I,I.next,g,A))return!0;I=I.next}while(I!==g);return!1}function Zt(g,A){return Ag(g.prev,g,g.next)<0?Ag(g,A,g.next)>=0&&Ag(g,g.prev,A)>=0:Ag(g,A,g.prev)<0||Ag(g,g.next,A)<0}function KX(g,A){var I=g,B=!1,Q=(g.x+A.x)/2,C=(g.y+A.y)/2;do I.y>C!=I.next.y>C&&I.next.y!==I.y&&Q<(I.next.x-I.x)*(C-I.y)/(I.next.y-I.y)+I.x&&(B=!B),I=I.next;while(I!==g);return B}function UH(g,A){var I=new sr(g.i,g.x,g.y),B=new sr(A.i,A.x,A.y),Q=g.next,C=A.prev;return g.next=A,A.prev=g,I.next=Q,Q.prev=I,B.next=I,I.prev=B,C.next=B,B.prev=C,B}function YH(g,A,I,B){var Q=new sr(g,A,I);return B?(Q.next=B.next,Q.prev=B,B.next.prev=Q,B.next=Q):(Q.prev=Q,Q.next=Q),Q}function Tt(g){g.next.prev=g.prev,g.prev.next=g.next,g.prevZ&&(g.prevZ.nextZ=g.nextZ),g.nextZ&&(g.nextZ.prevZ=g.prevZ)}function sr(g,A,I){this.i=g,this.x=A,this.y=I,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}ee.deviation=function(g,A,I,B){var Q=A&&A.length,C=Q?A[0]*I:g.length,E=Math.abs(wr(g,0,C,I));if(Q)for(var i=0,o=A.length;i<o;i++){var D=A[i]*I,a=i<o-1?A[i+1]*I:g.length;E-=Math.abs(wr(g,D,a,I))}var t=0;for(i=0;i<B.length;i+=3){var G=B[i]*I,s=B[i+1]*I,w=B[i+2]*I;t+=Math.abs((g[G]-g[w])*(g[s+1]-g[G+1])-(g[G]-g[s])*(g[w+1]-g[G+1]))}return E===0&&t===0?0:Math.abs((t-E)/E)};function wr(g,A,I,B){for(var Q=0,C=A,E=I-B;C<I;C+=B)Q+=(g[E]-g[C])*(g[C+1]+g[E+1]),E=C;return Q}ee.flatten=function(g){for(var A=g[0][0].length,I={vertices:[],holes:[],dimensions:A},B=0,Q=0;Q<g.length;Q++){for(var C=0;C<g[Q].length;C++)for(var E=0;E<A;E++)I.vertices.push(g[Q][C][E]);Q>0&&(B+=g[Q-1].length,I.holes.push(B))}return I}});var Sg=(g,A={})=>{let{coordinates:I,url:B,messages:Q={},throwOnAuth:C=!0,logUnexpected:E=!0}=A,o={...{network:"Network error occurred",notFound:"Resource not found",unauthorized:"Unauthorized access",forbidden:"Access forbidden",unexpected:"Unexpected error occurred"},...Q};if(g.name==="NetworkError"||g.code==="NETWORK_ERROR")return{error:"network",message:o.network,retryable:!0};if(g.status===404)return{error:"not_found",message:o.notFound,retryable:!1};if(g.status===401){let D=I?`${o.unauthorized} for resource at ${I}`:o.unauthorized;if(C)throw new Error(D);return{error:"unauthorized",message:D,retryable:!1}}if(g.status===403){let D=I?`${o.forbidden} for resource at ${I}`:o.forbidden;if(C)throw new Error(D);return{error:"forbidden",message:D,retryable:!1}}if(E){let D={...I&&{coordinates:I},...B&&{url:B},error:g.message,stack:g.stack};console.error(o.unexpected,D)}return{error:"unexpected",message:o.unexpected,retryable:!1}},fh=(g,A={})=>{let{logLevel:I="warn",shouldLog:B=!0}=A;B&&A.forceLog&&console[I](g,A.data||"")};var xh=new TextEncoder,ym={appstream2:"appstream",cloudhsmv2:"cloudhsm",email:"ses",marketplace:"aws-marketplace",mobile:"AWSMobileHubService",pinpoint:"mobiletargeting",queue:"sqs","git-codecommit":"codecommit","mturk-requester-sandbox":"mturk-requester","personalize-runtime":"personalize"},rm=new Set(["authorization","content-type","content-length","user-agent","presigned-expires","expect","x-amzn-trace-id","range","connection"]),Pi=class{constructor({accessKeyId:A,secretAccessKey:I,sessionToken:B,service:Q,region:C,cache:E,retries:i,initRetryMs:o}){if(A==null)throw new TypeError("accessKeyId is a required option");if(I==null)throw new TypeError("secretAccessKey is a required option");this.accessKeyId=A,this.secretAccessKey=I,this.sessionToken=B,this.service=Q,this.region=C,this.cache=E||new Map,this.retries=i??10,this.initRetryMs=o||50}async sign(A,I){if(A instanceof Request){let{method:C,url:E,headers:i,body:o}=A;I=Object.assign({method:C,url:E,headers:i},I),I.body==null&&i.has("Content-Type")&&(I.body=o!=null&&i.has("X-Amz-Content-Sha256")?o:await A.clone().arrayBuffer()),A=E}let B=new uh(Object.assign({url:A.toString()},I,this,I&&I.aws)),Q=Object.assign({},I,await B.sign());delete Q.aws;try{return new Request(Q.url.toString(),Q)}catch(C){if(C instanceof TypeError)return new Request(Q.url.toString(),Object.assign({duplex:"half"},Q));throw C}}async fetch(A,I){for(let B=0;B<=this.retries;B++){let Q=fetch(await this.sign(A,I));if(B===this.retries)return Q;let C=await Q;if(C.status<500&&C.status!==429)return C;await new Promise(E=>setTimeout(E,Math.random()*this.initRetryMs*Math.pow(2,B)))}throw new Error("An unknown error occurred, ensure retries is not negative")}},uh=class{constructor({method:A,url:I,headers:B,body:Q,accessKeyId:C,secretAccessKey:E,sessionToken:i,service:o,region:D,cache:a,datetime:t,signQuery:G,appendSessionToken:s,allHeaders:w,singleEncode:e}){if(I==null)throw new TypeError("url is a required option");if(C==null)throw new TypeError("accessKeyId is a required option");if(E==null)throw new TypeError("secretAccessKey is a required option");this.method=A||(Q?"POST":"GET"),this.url=new URL(I),this.headers=new Headers(B||{}),this.body=Q,this.accessKeyId=C,this.secretAccessKey=E,this.sessionToken=i;let c,h;(!o||!D)&&([c,h]=nm(this.url,this.headers)),this.service=o||c||"",this.region=D||h||"us-east-1",this.cache=a||new Map,this.datetime=t||new Date().toISOString().replace(/[:-]|\.\d{3}/g,""),this.signQuery=G,this.appendSessionToken=s||this.service==="iotdevicegateway",this.headers.delete("Host"),this.service==="s3"&&!this.signQuery&&!this.headers.has("X-Amz-Content-Sha256")&&this.headers.set("X-Amz-Content-Sha256","UNSIGNED-PAYLOAD");let R=this.signQuery?this.url.searchParams:this.headers;if(R.set("X-Amz-Date",this.datetime),this.sessionToken&&!this.appendSessionToken&&R.set("X-Amz-Security-Token",this.sessionToken),this.signableHeaders=["host",...this.headers.keys()].filter(y=>w||!rm.has(y)).sort(),this.signedHeaders=this.signableHeaders.join(";"),this.canonicalHeaders=this.signableHeaders.map(y=>y+":"+(y==="host"?this.url.host:(this.headers.get(y)||"").replace(/\s+/g," "))).join(`
|
|
3
|
+
`;return function(){var Z=new Error("get-stack-trace"),P=Z&&Z.stack?Z.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",rA=g.console&&(g.console.warn||g.console.log);return rA&&rA.call(g.console,f,P),F.apply(this,arguments)}}var w;typeof Object.assign!="function"?w=function(n){if(n===B||n===null)throw new TypeError("Cannot convert undefined or null to object");for(var Y=Object(n),f=1;f<arguments.length;f++){var Z=arguments[f];if(Z!==B&&Z!==null)for(var P in Z)Z.hasOwnProperty(P)&&(Y[P]=Z[P])}return Y}:w=Object.assign;var e=s(function(n,Y,f){for(var Z=Object.keys(Y),P=0;P<Z.length;)(!f||f&&n[Z[P]]===B)&&(n[Z[P]]=Y[Z[P]]),P++;return n},"extend","Use `assign`."),c=s(function(n,Y){return e(n,Y,!0)},"merge","Use `assign`.");function h(F,n,Y){var f=n.prototype,Z;Z=F.prototype=Object.create(f),Z.constructor=F,Z._super=f,Y&&w(Z,Y)}function R(F,n){return function(){return F.apply(n,arguments)}}function N(F,n){return typeof F==E?F.apply(n&&n[0]||B,n):F}function y(F,n){return F===B?n:F}function r(F,n,Y){G(d(n),function(f){F.addEventListener(f,Y,!1)})}function J(F,n,Y){G(d(n),function(f){F.removeEventListener(f,Y,!1)})}function q(F,n){for(;F;){if(F==n)return!0;F=F.parentNode}return!1}function H(F,n){return F.indexOf(n)>-1}function d(F){return F.trim().split(/\s+/g)}function K(F,n,Y){if(F.indexOf&&!Y)return F.indexOf(n);for(var f=0;f<F.length;){if(Y&&F[f][Y]==n||!Y&&F[f]===n)return f;f++}return-1}function x(F){return Array.prototype.slice.call(F,0)}function W(F,n,Y){for(var f=[],Z=[],P=0;P<F.length;){var rA=n?F[P][n]:F[P];K(Z,rA)<0&&f.push(F[P]),Z[P]=rA,P++}return Y&&(n?f=f.sort(function(Hg,vg){return Hg[n]>vg[n]}):f=f.sort()),f}function u(F,n){for(var Y,f,Z=n[0].toUpperCase()+n.slice(1),P=0;P<Q.length;){if(Y=Q[P],f=Y?Y+Z:n,f in F)return f;P++}return B}var m=1;function _(){return m++}function MA(F){var n=F.ownerDocument||F;return n.defaultView||n.parentWindow||g}var qA=/mobile|tablet|ip(ad|hone|od)|android/i,tA="ontouchstart"in g,cA=u(g,"PointerEvent")!==B,ZA=tA&&qA.test(navigator.userAgent),yg="touch",Mh="pen",Jh="mouse",x3="kinect",u3=25,zg=1,UE=2,sg=4,DI=8,xs=1,bD=2,ZD=4,TD=8,PD=16,VB=bD|ZD,HE=TD|PD,$R=VB|HE,AM=["x","y"],us=["clientX","clientY"];function bI(F,n){var Y=this;this.manager=F,this.callback=n,this.element=F.element,this.target=F.options.inputTarget,this.domHandler=function(f){N(F.options.enable,[F])&&Y.handler(f)},this.init()}bI.prototype={handler:function(){},init:function(){this.evEl&&r(this.element,this.evEl,this.domHandler),this.evTarget&&r(this.target,this.evTarget,this.domHandler),this.evWin&&r(MA(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&J(this.element,this.evEl,this.domHandler),this.evTarget&&J(this.target,this.evTarget,this.domHandler),this.evWin&&J(MA(this.element),this.evWin,this.domHandler)}};function W3(F){var n,Y=F.options.inputClass;return Y?n=Y:cA?n=Kh:ZA?n=Zs:tA?n=qh:n=bs,new n(F,b3)}function b3(F,n,Y){var f=Y.pointers.length,Z=Y.changedPointers.length,P=n&zg&&f-Z===0,rA=n&(sg|DI)&&f-Z===0;Y.isFirst=!!P,Y.isFinal=!!rA,P&&(F.session={}),Y.eventType=n,Z3(F,Y),F.emit("hammer.input",Y),F.recognize(Y),F.session.prevInput=Y}function Z3(F,n){var Y=F.session,f=n.pointers,Z=f.length;Y.firstInput||(Y.firstInput=gM(n)),Z>1&&!Y.firstMultiple?Y.firstMultiple=gM(n):Z===1&&(Y.firstMultiple=!1);var P=Y.firstInput,rA=Y.firstMultiple,Jg=rA?rA.center:P.center,Hg=n.center=IM(f);n.timeStamp=D(),n.deltaTime=n.timeStamp-P.timeStamp,n.angle=Yh(Jg,Hg),n.distance=Ws(Jg,Hg),T3(Y,n),n.offsetDirection=QM(n.deltaX,n.deltaY);var vg=BM(n.deltaTime,n.deltaX,n.deltaY);n.overallVelocityX=vg.x,n.overallVelocityY=vg.y,n.overallVelocity=o(vg.x)>o(vg.y)?vg.x:vg.y,n.scale=rA?O3(rA.pointers,f):1,n.rotation=rA?V3(rA.pointers,f):0,n.maxPointers=Y.prevInput?n.pointers.length>Y.prevInput.maxPointers?n.pointers.length:Y.prevInput.maxPointers:n.pointers.length,P3(Y,n);var jB=F.element;q(n.srcEvent.target,jB)&&(jB=n.srcEvent.target),n.target=jB}function T3(F,n){var Y=n.center,f=F.offsetDelta||{},Z=F.prevDelta||{},P=F.prevInput||{};(n.eventType===zg||P.eventType===sg)&&(Z=F.prevDelta={x:P.deltaX||0,y:P.deltaY||0},f=F.offsetDelta={x:Y.x,y:Y.y}),n.deltaX=Z.x+(Y.x-f.x),n.deltaY=Z.y+(Y.y-f.y)}function P3(F,n){var Y=F.lastInterval||n,f=n.timeStamp-Y.timeStamp,Z,P,rA,Jg;if(n.eventType!=DI&&(f>u3||Y.velocity===B)){var Hg=n.deltaX-Y.deltaX,vg=n.deltaY-Y.deltaY,jB=BM(f,Hg,vg);P=jB.x,rA=jB.y,Z=o(jB.x)>o(jB.y)?jB.x:jB.y,Jg=QM(Hg,vg),F.lastInterval=n}else Z=Y.velocity,P=Y.velocityX,rA=Y.velocityY,Jg=Y.direction;n.velocity=Z,n.velocityX=P,n.velocityY=rA,n.direction=Jg}function gM(F){for(var n=[],Y=0;Y<F.pointers.length;)n[Y]={clientX:i(F.pointers[Y].clientX),clientY:i(F.pointers[Y].clientY)},Y++;return{timeStamp:D(),pointers:n,center:IM(n),deltaX:F.deltaX,deltaY:F.deltaY}}function IM(F){var n=F.length;if(n===1)return{x:i(F[0].clientX),y:i(F[0].clientY)};for(var Y=0,f=0,Z=0;Z<n;)Y+=F[Z].clientX,f+=F[Z].clientY,Z++;return{x:i(Y/n),y:i(f/n)}}function BM(F,n,Y){return{x:n/F||0,y:Y/F||0}}function QM(F,n){return F===n?xs:o(F)>=o(n)?F<0?bD:ZD:n<0?TD:PD}function Ws(F,n,Y){Y||(Y=AM);var f=n[Y[0]]-F[Y[0]],Z=n[Y[1]]-F[Y[1]];return Math.sqrt(f*f+Z*Z)}function Yh(F,n,Y){Y||(Y=AM);var f=n[Y[0]]-F[Y[0]],Z=n[Y[1]]-F[Y[1]];return Math.atan2(Z,f)*180/Math.PI}function V3(F,n){return Yh(n[1],n[0],us)+Yh(F[1],F[0],us)}function O3(F,n){return Ws(n[0],n[1],us)/Ws(F[0],F[1],us)}var j3={mousedown:zg,mousemove:UE,mouseup:sg},X3="mousedown",z3="mousemove mouseup";function bs(){this.evEl=X3,this.evWin=z3,this.pressed=!1,bI.apply(this,arguments)}h(bs,bI,{handler:function(n){var Y=j3[n.type];Y&zg&&n.button===0&&(this.pressed=!0),Y&UE&&n.which!==1&&(Y=sg),this.pressed&&(Y&sg&&(this.pressed=!1),this.callback(this.manager,Y,{pointers:[n],changedPointers:[n],pointerType:Jh,srcEvent:n}))}});var v3={pointerdown:zg,pointermove:UE,pointerup:sg,pointercancel:DI,pointerout:DI},_3={2:yg,3:Mh,4:Jh,5:x3},CM="pointerdown",EM="pointermove pointerup pointercancel";g.MSPointerEvent&&!g.PointerEvent&&(CM="MSPointerDown",EM="MSPointerMove MSPointerUp MSPointerCancel");function Kh(){this.evEl=CM,this.evWin=EM,bI.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}h(Kh,bI,{handler:function(n){var Y=this.store,f=!1,Z=n.type.toLowerCase().replace("ms",""),P=v3[Z],rA=_3[n.pointerType]||n.pointerType,Jg=rA==yg,Hg=K(Y,n.pointerId,"pointerId");P&zg&&(n.button===0||Jg)?Hg<0&&(Y.push(n),Hg=Y.length-1):P&(sg|DI)&&(f=!0),!(Hg<0)&&(Y[Hg]=n,this.callback(this.manager,P,{pointers:Y,changedPointers:[n],pointerType:rA,srcEvent:n}),f&&Y.splice(Hg,1))}});var $3={touchstart:zg,touchmove:UE,touchend:sg,touchcancel:DI},Am="touchstart",gm="touchstart touchmove touchend touchcancel";function iM(){this.evTarget=Am,this.evWin=gm,this.started=!1,bI.apply(this,arguments)}h(iM,bI,{handler:function(n){var Y=$3[n.type];if(Y===zg&&(this.started=!0),!!this.started){var f=Im.call(this,n,Y);Y&(sg|DI)&&f[0].length-f[1].length===0&&(this.started=!1),this.callback(this.manager,Y,{pointers:f[0],changedPointers:f[1],pointerType:yg,srcEvent:n})}}});function Im(F,n){var Y=x(F.touches),f=x(F.changedTouches);return n&(sg|DI)&&(Y=W(Y.concat(f),"identifier",!0)),[Y,f]}var Bm={touchstart:zg,touchmove:UE,touchend:sg,touchcancel:DI},Qm="touchstart touchmove touchend touchcancel";function Zs(){this.evTarget=Qm,this.targetIds={},bI.apply(this,arguments)}h(Zs,bI,{handler:function(n){var Y=Bm[n.type],f=Cm.call(this,n,Y);f&&this.callback(this.manager,Y,{pointers:f[0],changedPointers:f[1],pointerType:yg,srcEvent:n})}});function Cm(F,n){var Y=x(F.touches),f=this.targetIds;if(n&(zg|UE)&&Y.length===1)return f[Y[0].identifier]=!0,[Y,Y];var Z,P,rA=x(F.changedTouches),Jg=[],Hg=this.target;if(P=Y.filter(function(vg){return q(vg.target,Hg)}),n===zg)for(Z=0;Z<P.length;)f[P[Z].identifier]=!0,Z++;for(Z=0;Z<rA.length;)f[rA[Z].identifier]&&Jg.push(rA[Z]),n&(sg|DI)&&delete f[rA[Z].identifier],Z++;if(Jg.length)return[W(P.concat(Jg),"identifier",!0),Jg]}var Em=2500,oM=25;function qh(){bI.apply(this,arguments);var F=R(this.handler,this);this.touch=new Zs(this.manager,F),this.mouse=new bs(this.manager,F),this.primaryTouch=null,this.lastTouches=[]}h(qh,bI,{handler:function(n,Y,f){var Z=f.pointerType==yg,P=f.pointerType==Jh;if(!(P&&f.sourceCapabilities&&f.sourceCapabilities.firesTouchEvents)){if(Z)im.call(this,Y,f);else if(P&&om.call(this,f))return;this.callback(n,Y,f)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function im(F,n){F&zg?(this.primaryTouch=n.changedPointers[0].identifier,DM.call(this,n)):F&(sg|DI)&&DM.call(this,n)}function DM(F){var n=F.changedPointers[0];if(n.identifier===this.primaryTouch){var Y={x:n.clientX,y:n.clientY};this.lastTouches.push(Y);var f=this.lastTouches,Z=function(){var P=f.indexOf(Y);P>-1&&f.splice(P,1)};setTimeout(Z,Em)}}function om(F){for(var n=F.srcEvent.clientX,Y=F.srcEvent.clientY,f=0;f<this.lastTouches.length;f++){var Z=this.lastTouches[f],P=Math.abs(n-Z.x),rA=Math.abs(Y-Z.y);if(P<=oM&&rA<=oM)return!0}return!1}var aM=u(C.style,"touchAction"),tM=aM!==B,GM="compute",sM="auto",Uh="manipulation",SE="none",VD="pan-x",OD="pan-y",Ts=am();function Hh(F,n){this.manager=F,this.set(n)}Hh.prototype={set:function(F){F==GM&&(F=this.compute()),tM&&this.manager.element.style&&Ts[F]&&(this.manager.element.style[aM]=F),this.actions=F.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var F=[];return G(this.manager.recognizers,function(n){N(n.options.enable,[n])&&(F=F.concat(n.getTouchAction()))}),Dm(F.join(" "))},preventDefaults:function(F){var n=F.srcEvent,Y=F.offsetDirection;if(this.manager.session.prevented){n.preventDefault();return}var f=this.actions,Z=H(f,SE)&&!Ts[SE],P=H(f,OD)&&!Ts[OD],rA=H(f,VD)&&!Ts[VD];if(Z){var Jg=F.pointers.length===1,Hg=F.distance<2,vg=F.deltaTime<250;if(Jg&&Hg&&vg)return}if(!(rA&&P)&&(Z||P&&Y&VB||rA&&Y&HE))return this.preventSrc(n)},preventSrc:function(F){this.manager.session.prevented=!0,F.preventDefault()}};function Dm(F){if(H(F,SE))return SE;var n=H(F,VD),Y=H(F,OD);return n&&Y?SE:n||Y?n?VD:OD:H(F,Uh)?Uh:sM}function am(){if(!tM)return!1;var F={},n=g.CSS&&g.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(Y){F[Y]=n?g.CSS.supports("touch-action",Y):!0}),F}var Ps=1,ZI=2,Ti=4,LC=8,SQ=LC,jD=16,OB=32;function LQ(F){this.options=w({},this.defaults,F||{}),this.id=_(),this.manager=null,this.options.enable=y(this.options.enable,!0),this.state=Ps,this.simultaneous={},this.requireFail=[]}LQ.prototype={defaults:{},set:function(F){return w(this.options,F),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(F){if(t(F,"recognizeWith",this))return this;var n=this.simultaneous;return F=Vs(F,this),n[F.id]||(n[F.id]=F,F.recognizeWith(this)),this},dropRecognizeWith:function(F){return t(F,"dropRecognizeWith",this)?this:(F=Vs(F,this),delete this.simultaneous[F.id],this)},requireFailure:function(F){if(t(F,"requireFailure",this))return this;var n=this.requireFail;return F=Vs(F,this),K(n,F)===-1&&(n.push(F),F.requireFailure(this)),this},dropRequireFailure:function(F){if(t(F,"dropRequireFailure",this))return this;F=Vs(F,this);var n=K(this.requireFail,F);return n>-1&&this.requireFail.splice(n,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(F){return!!this.simultaneous[F.id]},emit:function(F){var n=this,Y=this.state;function f(Z){n.manager.emit(Z,F)}Y<LC&&f(n.options.event+wM(Y)),f(n.options.event),F.additionalEvent&&f(F.additionalEvent),Y>=LC&&f(n.options.event+wM(Y))},tryEmit:function(F){if(this.canEmit())return this.emit(F);this.state=OB},canEmit:function(){for(var F=0;F<this.requireFail.length;){if(!(this.requireFail[F].state&(OB|Ps)))return!1;F++}return!0},recognize:function(F){var n=w({},F);if(!N(this.options.enable,[this,n])){this.reset(),this.state=OB;return}this.state&(SQ|jD|OB)&&(this.state=Ps),this.state=this.process(n),this.state&(ZI|Ti|LC|jD)&&this.tryEmit(n)},process:function(F){},getTouchAction:function(){},reset:function(){}};function wM(F){return F&jD?"cancel":F&LC?"end":F&Ti?"move":F&ZI?"start":""}function cM(F){return F==PD?"down":F==TD?"up":F==bD?"left":F==ZD?"right":""}function Vs(F,n){var Y=n.manager;return Y?Y.get(F):F}function tB(){LQ.apply(this,arguments)}h(tB,LQ,{defaults:{pointers:1},attrTest:function(F){var n=this.options.pointers;return n===0||F.pointers.length===n},process:function(F){var n=this.state,Y=F.eventType,f=n&(ZI|Ti),Z=this.attrTest(F);return f&&(Y&DI||!Z)?n|jD:f||Z?Y&sg?n|LC:n&ZI?n|Ti:ZI:OB}});function Os(){tB.apply(this,arguments),this.pX=null,this.pY=null}h(Os,tB,{defaults:{event:"pan",threshold:10,pointers:1,direction:$R},getTouchAction:function(){var F=this.options.direction,n=[];return F&VB&&n.push(OD),F&HE&&n.push(VD),n},directionTest:function(F){var n=this.options,Y=!0,f=F.distance,Z=F.direction,P=F.deltaX,rA=F.deltaY;return Z&n.direction||(n.direction&VB?(Z=P===0?xs:P<0?bD:ZD,Y=P!=this.pX,f=Math.abs(F.deltaX)):(Z=rA===0?xs:rA<0?TD:PD,Y=rA!=this.pY,f=Math.abs(F.deltaY))),F.direction=Z,Y&&f>n.threshold&&Z&n.direction},attrTest:function(F){return tB.prototype.attrTest.call(this,F)&&(this.state&ZI||!(this.state&ZI)&&this.directionTest(F))},emit:function(F){this.pX=F.deltaX,this.pY=F.deltaY;var n=cM(F.direction);n&&(F.additionalEvent=this.options.event+n),this._super.emit.call(this,F)}});function Sh(){tB.apply(this,arguments)}h(Sh,tB,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[SE]},attrTest:function(F){return this._super.attrTest.call(this,F)&&(Math.abs(F.scale-1)>this.options.threshold||this.state&ZI)},emit:function(F){if(F.scale!==1){var n=F.scale<1?"in":"out";F.additionalEvent=this.options.event+n}this._super.emit.call(this,F)}});function Lh(){LQ.apply(this,arguments),this._timer=null,this._input=null}h(Lh,LQ,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[sM]},process:function(F){var n=this.options,Y=F.pointers.length===n.pointers,f=F.distance<n.threshold,Z=F.deltaTime>n.time;if(this._input=F,!f||!Y||F.eventType&(sg|DI)&&!Z)this.reset();else if(F.eventType&zg)this.reset(),this._timer=a(function(){this.state=SQ,this.tryEmit()},n.time,this);else if(F.eventType&sg)return SQ;return OB},reset:function(){clearTimeout(this._timer)},emit:function(F){this.state===SQ&&(F&&F.eventType&sg?this.manager.emit(this.options.event+"up",F):(this._input.timeStamp=D(),this.manager.emit(this.options.event,this._input)))}});function dh(){tB.apply(this,arguments)}h(dh,tB,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[SE]},attrTest:function(F){return this._super.attrTest.call(this,F)&&(Math.abs(F.rotation)>this.options.threshold||this.state&ZI)}});function ph(){tB.apply(this,arguments)}h(ph,tB,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:VB|HE,pointers:1},getTouchAction:function(){return Os.prototype.getTouchAction.call(this)},attrTest:function(F){var n=this.options.direction,Y;return n&(VB|HE)?Y=F.overallVelocity:n&VB?Y=F.overallVelocityX:n&HE&&(Y=F.overallVelocityY),this._super.attrTest.call(this,F)&&n&F.offsetDirection&&F.distance>this.options.threshold&&F.maxPointers==this.options.pointers&&o(Y)>this.options.velocity&&F.eventType&sg},emit:function(F){var n=cM(F.offsetDirection);n&&this.manager.emit(this.options.event+n,F),this.manager.emit(this.options.event,F)}});function js(){LQ.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}h(js,LQ,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Uh]},process:function(F){var n=this.options,Y=F.pointers.length===n.pointers,f=F.distance<n.threshold,Z=F.deltaTime<n.time;if(this.reset(),F.eventType&zg&&this.count===0)return this.failTimeout();if(f&&Z&&Y){if(F.eventType!=sg)return this.failTimeout();var P=this.pTime?F.timeStamp-this.pTime<n.interval:!0,rA=!this.pCenter||Ws(this.pCenter,F.center)<n.posThreshold;this.pTime=F.timeStamp,this.pCenter=F.center,!rA||!P?this.count=1:this.count+=1,this._input=F;var Jg=this.count%n.taps;if(Jg===0)return this.hasRequireFailures()?(this._timer=a(function(){this.state=SQ,this.tryEmit()},n.interval,this),ZI):SQ}return OB},failTimeout:function(){return this._timer=a(function(){this.state=OB},this.options.interval,this),OB},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==SQ&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function dC(F,n){return n=n||{},n.recognizers=y(n.recognizers,dC.defaults.preset),new lh(F,n)}dC.VERSION="2.0.7",dC.defaults={domEvents:!1,touchAction:GM,enable:!0,inputTarget:null,inputClass:null,preset:[[dh,{enable:!1}],[Sh,{enable:!1},["rotate"]],[ph,{direction:VB}],[Os,{direction:VB},["swipe"]],[js],[js,{event:"doubletap",taps:2},["tap"]],[Lh]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var tm=1,eM=2;function lh(F,n){this.options=w({},dC.defaults,n||{}),this.options.inputTarget=this.options.inputTarget||F,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=F,this.input=W3(this),this.touchAction=new Hh(this,this.options.touchAction),NM(this,!0),G(this.options.recognizers,function(Y){var f=this.add(new Y[0](Y[1]));Y[2]&&f.recognizeWith(Y[2]),Y[3]&&f.requireFailure(Y[3])},this)}lh.prototype={set:function(F){return w(this.options,F),F.touchAction&&this.touchAction.update(),F.inputTarget&&(this.input.destroy(),this.input.target=F.inputTarget,this.input.init()),this},stop:function(F){this.session.stopped=F?eM:tm},recognize:function(F){var n=this.session;if(!n.stopped){this.touchAction.preventDefaults(F);var Y,f=this.recognizers,Z=n.curRecognizer;(!Z||Z&&Z.state&SQ)&&(Z=n.curRecognizer=null);for(var P=0;P<f.length;)Y=f[P],n.stopped!==eM&&(!Z||Y==Z||Y.canRecognizeWith(Z))?Y.recognize(F):Y.reset(),!Z&&Y.state&(ZI|Ti|LC)&&(Z=n.curRecognizer=Y),P++}},get:function(F){if(F instanceof LQ)return F;for(var n=this.recognizers,Y=0;Y<n.length;Y++)if(n[Y].options.event==F)return n[Y];return null},add:function(F){if(t(F,"add",this))return this;var n=this.get(F.options.event);return n&&this.remove(n),this.recognizers.push(F),F.manager=this,this.touchAction.update(),F},remove:function(F){if(t(F,"remove",this))return this;if(F=this.get(F),F){var n=this.recognizers,Y=K(n,F);Y!==-1&&(n.splice(Y,1),this.touchAction.update())}return this},on:function(F,n){if(F!==B&&n!==B){var Y=this.handlers;return G(d(F),function(f){Y[f]=Y[f]||[],Y[f].push(n)}),this}},off:function(F,n){if(F!==B){var Y=this.handlers;return G(d(F),function(f){n?Y[f]&&Y[f].splice(K(Y[f],n),1):delete Y[f]}),this}},emit:function(F,n){this.options.domEvents&&Gm(F,n);var Y=this.handlers[F]&&this.handlers[F].slice();if(!(!Y||!Y.length)){n.type=F,n.preventDefault=function(){n.srcEvent.preventDefault()};for(var f=0;f<Y.length;)Y[f](n),f++}},destroy:function(){this.element&&NM(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function NM(F,n){var Y=F.element;if(Y.style){var f;G(F.options.cssProps,function(Z,P){f=u(Y.style,P),n?(F.oldCssProps[f]=Y.style[f],Y.style[f]=Z):Y.style[f]=F.oldCssProps[f]||""}),n||(F.oldCssProps={})}}function Gm(F,n){var Y=A.createEvent("Event");Y.initEvent(F,!0,!0),Y.gesture=n,n.target.dispatchEvent(Y)}w(dC,{INPUT_START:zg,INPUT_MOVE:UE,INPUT_END:sg,INPUT_CANCEL:DI,STATE_POSSIBLE:Ps,STATE_BEGAN:ZI,STATE_CHANGED:Ti,STATE_ENDED:LC,STATE_RECOGNIZED:SQ,STATE_CANCELLED:jD,STATE_FAILED:OB,DIRECTION_NONE:xs,DIRECTION_LEFT:bD,DIRECTION_RIGHT:ZD,DIRECTION_UP:TD,DIRECTION_DOWN:PD,DIRECTION_HORIZONTAL:VB,DIRECTION_VERTICAL:HE,DIRECTION_ALL:$R,Manager:lh,Input:bI,TouchAction:Hh,TouchInput:Zs,MouseInput:bs,PointerEventInput:Kh,TouchMouseInput:qh,SingleTouchInput:iM,Recognizer:LQ,AttrRecognizer:tB,Tap:js,Pan:Os,Swipe:ph,Pinch:Sh,Rotate:dh,Press:Lh,on:r,off:J,each:G,merge:c,extend:e,assign:w,inherit:h,bindFn:R,prefixed:u});var sm=typeof g<"u"?g:typeof self<"u"?self:{};sm.Hammer=dC,typeof Oc<"u"&&Oc.exports?Oc.exports=dC:g[I]=dC})(window,document,"Hammer")});var HH=kM((sFA,cr)=>{"use strict";cr.exports=ee;cr.exports.default=ee;function ee(g,A,I){I=I||2;var B=A&&A.length,Q=B?A[0]*I:g.length,C=KH(g,0,Q,I,!0),E=[];if(!C||C.next===C.prev)return E;var i,o,D,a,t,G,s;if(B&&(C=k9(g,A,C,I)),g.length>80*I){i=D=g[0],o=a=g[1];for(var w=I;w<Q;w+=I)t=g[w],G=g[w+1],t<i&&(i=t),G<o&&(o=G),t>D&&(D=t),G>a&&(a=G);s=Math.max(D-i,a-o),s=s!==0?32767/s:0}return bt(C,E,I,i,o,s,0),E}function KH(g,A,I,B,Q){var C,E;if(Q===wr(g,A,I,B)>0)for(C=A;C<I;C+=B)E=YH(C,g[C],g[C+1],E);else for(C=I-B;C>=A;C-=B)E=YH(C,g[C],g[C+1],E);return E&&Ne(E,E.next)&&(Tt(E),E=E.next),E}function Di(g,A){if(!g)return g;A||(A=g);var I=g,B;do if(B=!1,!I.steiner&&(Ne(I,I.next)||Ag(I.prev,I,I.next)===0)){if(Tt(I),I=A=I.prev,I===I.next)break;B=!0}else I=I.next;while(B||I!==A);return A}function bt(g,A,I,B,Q,C,E){if(g){!E&&C&&n9(g,B,Q,C);for(var i=g,o,D;g.prev!==g.next;){if(o=g.prev,D=g.next,C?c9(g,B,Q,C):w9(g)){A.push(o.i/I|0),A.push(g.i/I|0),A.push(D.i/I|0),Tt(g),g=D.next,i=D.next;continue}if(g=D,g===i){E?E===1?(g=e9(Di(g),A,I),bt(g,A,I,B,Q,C,2)):E===2&&N9(g,A,I,B,Q,C):bt(Di(g),A,I,B,Q,C,1);break}}}}function w9(g){var A=g.prev,I=g,B=g.next;if(Ag(A,I,B)>=0)return!1;for(var Q=A.x,C=I.x,E=B.x,i=A.y,o=I.y,D=B.y,a=Q<C?Q<E?Q:E:C<E?C:E,t=i<o?i<D?i:D:o<D?o:D,G=Q>C?Q>E?Q:E:C>E?C:E,s=i>o?i>D?i:D:o>D?o:D,w=B.next;w!==A;){if(w.x>=a&&w.x<=G&&w.y>=t&&w.y<=s&&fo(Q,i,C,o,E,D,w.x,w.y)&&Ag(w.prev,w,w.next)>=0)return!1;w=w.next}return!0}function c9(g,A,I,B){var Q=g.prev,C=g,E=g.next;if(Ag(Q,C,E)>=0)return!1;for(var i=Q.x,o=C.x,D=E.x,a=Q.y,t=C.y,G=E.y,s=i<o?i<D?i:D:o<D?o:D,w=a<t?a<G?a:G:t<G?t:G,e=i>o?i>D?i:D:o>D?o:D,c=a>t?a>G?a:G:t>G?t:G,h=Gr(s,w,A,I,B),R=Gr(e,c,A,I,B),N=g.prevZ,y=g.nextZ;N&&N.z>=h&&y&&y.z<=R;){if(N.x>=s&&N.x<=e&&N.y>=w&&N.y<=c&&N!==Q&&N!==E&&fo(i,a,o,t,D,G,N.x,N.y)&&Ag(N.prev,N,N.next)>=0||(N=N.prevZ,y.x>=s&&y.x<=e&&y.y>=w&&y.y<=c&&y!==Q&&y!==E&&fo(i,a,o,t,D,G,y.x,y.y)&&Ag(y.prev,y,y.next)>=0))return!1;y=y.nextZ}for(;N&&N.z>=h;){if(N.x>=s&&N.x<=e&&N.y>=w&&N.y<=c&&N!==Q&&N!==E&&fo(i,a,o,t,D,G,N.x,N.y)&&Ag(N.prev,N,N.next)>=0)return!1;N=N.prevZ}for(;y&&y.z<=R;){if(y.x>=s&&y.x<=e&&y.y>=w&&y.y<=c&&y!==Q&&y!==E&&fo(i,a,o,t,D,G,y.x,y.y)&&Ag(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function e9(g,A,I){var B=g;do{var Q=B.prev,C=B.next.next;!Ne(Q,C)&&qH(Q,B,B.next,C)&&Zt(Q,C)&&Zt(C,Q)&&(A.push(Q.i/I|0),A.push(B.i/I|0),A.push(C.i/I|0),Tt(B),Tt(B.next),B=g=C),B=B.next}while(B!==g);return Di(B)}function N9(g,A,I,B,Q,C){var E=g;do{for(var i=E.next.next;i!==E.prev;){if(E.i!==i.i&&J9(E,i)){var o=UH(E,i);E=Di(E,E.next),o=Di(o,o.next),bt(E,A,I,B,Q,C,0),bt(o,A,I,B,Q,C,0);return}i=i.next}E=E.next}while(E!==g)}function k9(g,A,I,B){var Q=[],C,E,i,o,D;for(C=0,E=A.length;C<E;C++)i=A[C]*B,o=C<E-1?A[C+1]*B:g.length,D=KH(g,i,o,B,!1),D===D.next&&(D.steiner=!0),Q.push(M9(D));for(Q.sort(h9),C=0;C<Q.length;C++)I=F9(Q[C],I);return I}function h9(g,A){return g.x-A.x}function F9(g,A){var I=y9(g,A);if(!I)return A;var B=UH(I,g);return Di(B,B.next),Di(I,I.next)}function y9(g,A){var I=A,B=g.x,Q=g.y,C=-1/0,E;do{if(Q<=I.y&&Q>=I.next.y&&I.next.y!==I.y){var i=I.x+(Q-I.y)*(I.next.x-I.x)/(I.next.y-I.y);if(i<=B&&i>C&&(C=i,E=I.x<I.next.x?I:I.next,i===B))return E}I=I.next}while(I!==A);if(!E)return null;var o=E,D=E.x,a=E.y,t=1/0,G;I=E;do B>=I.x&&I.x>=D&&B!==I.x&&fo(Q<a?B:C,Q,D,a,Q<a?C:B,Q,I.x,I.y)&&(G=Math.abs(Q-I.y)/(B-I.x),Zt(I,g)&&(G<t||G===t&&(I.x>E.x||I.x===E.x&&r9(E,I)))&&(E=I,t=G)),I=I.next;while(I!==o);return E}function r9(g,A){return Ag(g.prev,g,A.prev)<0&&Ag(A.next,g,g.next)<0}function n9(g,A,I,B){var Q=g;do Q.z===0&&(Q.z=Gr(Q.x,Q.y,A,I,B)),Q.prevZ=Q.prev,Q.nextZ=Q.next,Q=Q.next;while(Q!==g);Q.prevZ.nextZ=null,Q.prevZ=null,R9(Q)}function R9(g){var A,I,B,Q,C,E,i,o,D=1;do{for(I=g,g=null,C=null,E=0;I;){for(E++,B=I,i=0,A=0;A<D&&(i++,B=B.nextZ,!!B);A++);for(o=D;i>0||o>0&&B;)i!==0&&(o===0||!B||I.z<=B.z)?(Q=I,I=I.nextZ,i--):(Q=B,B=B.nextZ,o--),C?C.nextZ=Q:g=Q,Q.prevZ=C,C=Q;I=B}C.nextZ=null,D*=2}while(E>1);return g}function Gr(g,A,I,B,Q){return g=(g-I)*Q|0,A=(A-B)*Q|0,g=(g|g<<8)&16711935,g=(g|g<<4)&252645135,g=(g|g<<2)&858993459,g=(g|g<<1)&1431655765,A=(A|A<<8)&16711935,A=(A|A<<4)&252645135,A=(A|A<<2)&858993459,A=(A|A<<1)&1431655765,g|A<<1}function M9(g){var A=g,I=g;do(A.x<I.x||A.x===I.x&&A.y<I.y)&&(I=A),A=A.next;while(A!==g);return I}function fo(g,A,I,B,Q,C,E,i){return(Q-E)*(A-i)>=(g-E)*(C-i)&&(g-E)*(B-i)>=(I-E)*(A-i)&&(I-E)*(C-i)>=(Q-E)*(B-i)}function J9(g,A){return g.next.i!==A.i&&g.prev.i!==A.i&&!Y9(g,A)&&(Zt(g,A)&&Zt(A,g)&&K9(g,A)&&(Ag(g.prev,g,A.prev)||Ag(g,A.prev,A))||Ne(g,A)&&Ag(g.prev,g,g.next)>0&&Ag(A.prev,A,A.next)>0)}function Ag(g,A,I){return(A.y-g.y)*(I.x-A.x)-(A.x-g.x)*(I.y-A.y)}function Ne(g,A){return g.x===A.x&&g.y===A.y}function qH(g,A,I,B){var Q=ce(Ag(g,A,I)),C=ce(Ag(g,A,B)),E=ce(Ag(I,B,g)),i=ce(Ag(I,B,A));return!!(Q!==C&&E!==i||Q===0&&we(g,I,A)||C===0&&we(g,B,A)||E===0&&we(I,g,B)||i===0&&we(I,A,B))}function we(g,A,I){return A.x<=Math.max(g.x,I.x)&&A.x>=Math.min(g.x,I.x)&&A.y<=Math.max(g.y,I.y)&&A.y>=Math.min(g.y,I.y)}function ce(g){return g>0?1:g<0?-1:0}function Y9(g,A){var I=g;do{if(I.i!==g.i&&I.next.i!==g.i&&I.i!==A.i&&I.next.i!==A.i&&qH(I,I.next,g,A))return!0;I=I.next}while(I!==g);return!1}function Zt(g,A){return Ag(g.prev,g,g.next)<0?Ag(g,A,g.next)>=0&&Ag(g,g.prev,A)>=0:Ag(g,A,g.prev)<0||Ag(g,g.next,A)<0}function K9(g,A){var I=g,B=!1,Q=(g.x+A.x)/2,C=(g.y+A.y)/2;do I.y>C!=I.next.y>C&&I.next.y!==I.y&&Q<(I.next.x-I.x)*(C-I.y)/(I.next.y-I.y)+I.x&&(B=!B),I=I.next;while(I!==g);return B}function UH(g,A){var I=new sr(g.i,g.x,g.y),B=new sr(A.i,A.x,A.y),Q=g.next,C=A.prev;return g.next=A,A.prev=g,I.next=Q,Q.prev=I,B.next=I,I.prev=B,C.next=B,B.prev=C,B}function YH(g,A,I,B){var Q=new sr(g,A,I);return B?(Q.next=B.next,Q.prev=B,B.next.prev=Q,B.next=Q):(Q.prev=Q,Q.next=Q),Q}function Tt(g){g.next.prev=g.prev,g.prev.next=g.next,g.prevZ&&(g.prevZ.nextZ=g.nextZ),g.nextZ&&(g.nextZ.prevZ=g.prevZ)}function sr(g,A,I){this.i=g,this.x=A,this.y=I,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}ee.deviation=function(g,A,I,B){var Q=A&&A.length,C=Q?A[0]*I:g.length,E=Math.abs(wr(g,0,C,I));if(Q)for(var i=0,o=A.length;i<o;i++){var D=A[i]*I,a=i<o-1?A[i+1]*I:g.length;E-=Math.abs(wr(g,D,a,I))}var t=0;for(i=0;i<B.length;i+=3){var G=B[i]*I,s=B[i+1]*I,w=B[i+2]*I;t+=Math.abs((g[G]-g[w])*(g[s+1]-g[G+1])-(g[G]-g[s])*(g[w+1]-g[G+1]))}return E===0&&t===0?0:Math.abs((t-E)/E)};function wr(g,A,I,B){for(var Q=0,C=A,E=I-B;C<I;C+=B)Q+=(g[E]-g[C])*(g[C+1]+g[E+1]),E=C;return Q}ee.flatten=function(g){for(var A=g[0][0].length,I={vertices:[],holes:[],dimensions:A},B=0,Q=0;Q<g.length;Q++){for(var C=0;C<g[Q].length;C++)for(var E=0;E<A;E++)I.vertices.push(g[Q][C][E]);Q>0&&(B+=g[Q-1].length,I.holes.push(B))}return I}});var Sg=(g,A={})=>{let{coordinates:I,url:B,messages:Q={},throwOnAuth:C=!0,logUnexpected:E=!0}=A,o={...{network:"Network error occurred",notFound:"Resource not found",unauthorized:"Unauthorized access",forbidden:"Access forbidden",unexpected:"Unexpected error occurred"},...Q};if(g.name==="NetworkError"||g.code==="NETWORK_ERROR")return{error:"network",message:o.network,retryable:!0};if(g.status===404)return{error:"not_found",message:o.notFound,retryable:!1};if(g.status===401){let D=I?`${o.unauthorized} for resource at ${I}`:o.unauthorized;if(C)throw new Error(D);return{error:"unauthorized",message:D,retryable:!1}}if(g.status===403){let D=I?`${o.forbidden} for resource at ${I}`:o.forbidden;if(C)throw new Error(D);return{error:"forbidden",message:D,retryable:!1}}if(E){let D={...I&&{coordinates:I},...B&&{url:B},error:g.message,stack:g.stack};console.error(o.unexpected,D)}return{error:"unexpected",message:o.unexpected,retryable:!1}},fh=(g,A={})=>{let{logLevel:I="warn",shouldLog:B=!0}=A;B&&A.forceLog&&console[I](g,A.data||"")};var xh=new TextEncoder,ym={appstream2:"appstream",cloudhsmv2:"cloudhsm",email:"ses",marketplace:"aws-marketplace",mobile:"AWSMobileHubService",pinpoint:"mobiletargeting",queue:"sqs","git-codecommit":"codecommit","mturk-requester-sandbox":"mturk-requester","personalize-runtime":"personalize"},rm=new Set(["authorization","content-type","content-length","user-agent","presigned-expires","expect","x-amzn-trace-id","range","connection"]),Pi=class{constructor({accessKeyId:A,secretAccessKey:I,sessionToken:B,service:Q,region:C,cache:E,retries:i,initRetryMs:o}){if(A==null)throw new TypeError("accessKeyId is a required option");if(I==null)throw new TypeError("secretAccessKey is a required option");this.accessKeyId=A,this.secretAccessKey=I,this.sessionToken=B,this.service=Q,this.region=C,this.cache=E||new Map,this.retries=i??10,this.initRetryMs=o||50}async sign(A,I){if(A instanceof Request){let{method:C,url:E,headers:i,body:o}=A;I=Object.assign({method:C,url:E,headers:i},I),I.body==null&&i.has("Content-Type")&&(I.body=o!=null&&i.has("X-Amz-Content-Sha256")?o:await A.clone().arrayBuffer()),A=E}let B=new uh(Object.assign({url:A.toString()},I,this,I&&I.aws)),Q=Object.assign({},I,await B.sign());delete Q.aws;try{return new Request(Q.url.toString(),Q)}catch(C){if(C instanceof TypeError)return new Request(Q.url.toString(),Object.assign({duplex:"half"},Q));throw C}}async fetch(A,I){for(let B=0;B<=this.retries;B++){let Q=fetch(await this.sign(A,I));if(B===this.retries)return Q;let C=await Q;if(C.status<500&&C.status!==429)return C;await new Promise(E=>setTimeout(E,Math.random()*this.initRetryMs*Math.pow(2,B)))}throw new Error("An unknown error occurred, ensure retries is not negative")}},uh=class{constructor({method:A,url:I,headers:B,body:Q,accessKeyId:C,secretAccessKey:E,sessionToken:i,service:o,region:D,cache:a,datetime:t,signQuery:G,appendSessionToken:s,allHeaders:w,singleEncode:e}){if(I==null)throw new TypeError("url is a required option");if(C==null)throw new TypeError("accessKeyId is a required option");if(E==null)throw new TypeError("secretAccessKey is a required option");this.method=A||(Q?"POST":"GET"),this.url=new URL(I),this.headers=new Headers(B||{}),this.body=Q,this.accessKeyId=C,this.secretAccessKey=E,this.sessionToken=i;let c,h;(!o||!D)&&([c,h]=nm(this.url,this.headers)),this.service=o||c||"",this.region=D||h||"us-east-1",this.cache=a||new Map,this.datetime=t||new Date().toISOString().replace(/[:-]|\.\d{3}/g,""),this.signQuery=G,this.appendSessionToken=s||this.service==="iotdevicegateway",this.headers.delete("Host"),this.service==="s3"&&!this.signQuery&&!this.headers.has("X-Amz-Content-Sha256")&&this.headers.set("X-Amz-Content-Sha256","UNSIGNED-PAYLOAD");let R=this.signQuery?this.url.searchParams:this.headers;if(R.set("X-Amz-Date",this.datetime),this.sessionToken&&!this.appendSessionToken&&R.set("X-Amz-Security-Token",this.sessionToken),this.signableHeaders=["host",...this.headers.keys()].filter(y=>w||!rm.has(y)).sort(),this.signedHeaders=this.signableHeaders.join(";"),this.canonicalHeaders=this.signableHeaders.map(y=>y+":"+(y==="host"?this.url.host:(this.headers.get(y)||"").replace(/\s+/g," "))).join(`
|
|
4
4
|
`),this.credentialString=[this.datetime.slice(0,8),this.region,this.service,"aws4_request"].join("/"),this.signQuery&&(this.service==="s3"&&!R.has("X-Amz-Expires")&&R.set("X-Amz-Expires","86400"),R.set("X-Amz-Algorithm","AWS4-HMAC-SHA256"),R.set("X-Amz-Credential",this.accessKeyId+"/"+this.credentialString),R.set("X-Amz-SignedHeaders",this.signedHeaders)),this.service==="s3")try{this.encodedPath=decodeURIComponent(this.url.pathname.replace(/\+/g," "))}catch{this.encodedPath=this.url.pathname}else this.encodedPath=this.url.pathname.replace(/\/+/g,"/");e||(this.encodedPath=encodeURIComponent(this.encodedPath).replace(/%2F/g,"/")),this.encodedPath=rM(this.encodedPath);let N=new Set;this.encodedSearch=[...this.url.searchParams].filter(([y])=>{if(!y)return!1;if(this.service==="s3"){if(N.has(y))return!1;N.add(y)}return!0}).map(y=>y.map(r=>rM(encodeURIComponent(r)))).sort(([y,r],[J,q])=>y<J?-1:y>J?1:r<q?-1:r>q?1:0).map(y=>y.join("=")).join("&")}async sign(){return this.signQuery?(this.url.searchParams.set("X-Amz-Signature",await this.signature()),this.sessionToken&&this.appendSessionToken&&this.url.searchParams.set("X-Amz-Security-Token",this.sessionToken)):this.headers.set("Authorization",await this.authHeader()),{method:this.method,url:this.url,headers:this.headers,body:this.body}}async authHeader(){return["AWS4-HMAC-SHA256 Credential="+this.accessKeyId+"/"+this.credentialString,"SignedHeaders="+this.signedHeaders,"Signature="+await this.signature()].join(", ")}async signature(){let A=this.datetime.slice(0,8),I=[this.secretAccessKey,A,this.region,this.service].join(),B=this.cache.get(I);if(!B){let Q=await XD("AWS4"+this.secretAccessKey,A),C=await XD(Q,this.region),E=await XD(C,this.service);B=await XD(E,"aws4_request"),this.cache.set(I,B)}return mh(await XD(B,await this.stringToSign()))}async stringToSign(){return["AWS4-HMAC-SHA256",this.datetime,this.credentialString,mh(await FM(await this.canonicalString()))].join(`
|
|
5
5
|
`)}async canonicalString(){return[this.method.toUpperCase(),this.encodedPath,this.encodedSearch,this.canonicalHeaders+`
|
|
6
6
|
`,this.signedHeaders,await this.hexBodyHash()].join(`
|
|
@@ -1164,7 +1164,7 @@ discard;
|
|
|
1164
1164
|
fragColor = vec4(color, a);
|
|
1165
1165
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
1166
1166
|
}
|
|
1167
|
-
`;var Vj=1024,Oj=4,DH=()=>{},aH={minFilter:"linear",mipmapFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"},jj={x:0,y:0,width:0,height:0};function Xj(g){return Math.pow(2,Math.ceil(Math.log2(g)))}function zj(g,A,I,B){let Q=Math.min(I/A.width,B/A.height),C=Math.floor(A.width*Q),E=Math.floor(A.height*Q);return Q===1?{data:A,width:C,height:E}:(g.canvas.height=E,g.canvas.width=C,g.clearRect(0,0,C,E),g.drawImage(A,0,0,A.width,A.height,0,0,C,E),{data:g.canvas,width:C,height:E})}function Ut(g){return g&&(g.id||g.url)}function vj(g,A,I,B){let{width:Q,height:C,device:E}=g,i=E.createTexture({format:"rgba8unorm",width:A,height:I,sampler:B}),o=E.createCommandEncoder();return o.copyTextureToTexture({source:g,destination:i,width:Q,height:C}),o.finish(),g.destroy(),i}function tH(g,A,I){for(let B=0;B<A.length;B++){let{icon:Q,xOffset:C}=A[B],E=Ut(Q);g[E]={...Q,x:C,y:I}}}function _j({icons:g,buffer:A,mapping:I={},xOffset:B=0,yOffset:Q=0,rowHeight:C=0,canvasWidth:E}){let i=[];for(let o=0;o<g.length;o++){let D=g[o],a=Ut(D);if(!I[a]){let{height:t,width:G}=D;B+G+A>E&&(tH(I,i,Q),B=0,Q=C+Q+A,C=0,i=[]),i.push({icon:D,xOffset:B}),B=B+G+A,C=Math.max(C,t)}}return i.length>0&&tH(I,i,Q),{mapping:I,rowHeight:C,xOffset:B,yOffset:Q,canvasWidth:E,canvasHeight:Xj(C+Q+A)}}function $j(g,A,I){if(!g||!A)return null;I=I||{};let B={},{iterable:Q,objectInfo:C}=gB(g);for(let E of Q){C.index++;let i=A(E,C),o=Ut(i);if(!i)throw new Error("Icon is missing.");if(!i.url)throw new Error("Icon url is missing.");!B[o]&&(!I[o]||i.url!==I[o].url)&&(B[o]={...i,source:E,sourceIndex:C.index})}return B}var Ht=class{constructor(A,{onUpdate:I=DH,onError:B=DH}){this._loadOptions=null,this._texture=null,this._externalTexture=null,this._mapping={},this._textureParameters=null,this._pendingCount=0,this._autoPacking=!1,this._xOffset=0,this._yOffset=0,this._rowHeight=0,this._buffer=Oj,this._canvasWidth=Vj,this._canvasHeight=0,this._canvas=null,this.device=A,this.onUpdate=I,this.onError=B}finalize(){this._texture?.delete()}getTexture(){return this._texture||this._externalTexture}getIconMapping(A){let I=this._autoPacking?Ut(A):A;return this._mapping[I]||jj}setProps({loadOptions:A,autoPacking:I,iconAtlas:B,iconMapping:Q,textureParameters:C}){A&&(this._loadOptions=A),I!==void 0&&(this._autoPacking=I),Q&&(this._mapping=Q),B&&(this._texture?.delete(),this._texture=null,this._externalTexture=B),C&&(this._textureParameters=C)}get isLoaded(){return this._pendingCount===0}packIcons(A,I){if(!this._autoPacking||typeof document>"u")return;let B=Object.values($j(A,I,this._mapping)||{});if(B.length>0){let{mapping:Q,xOffset:C,yOffset:E,rowHeight:i,canvasHeight:o}=_j({icons:B,buffer:this._buffer,canvasWidth:this._canvasWidth,mapping:this._mapping,rowHeight:this._rowHeight,xOffset:this._xOffset,yOffset:this._yOffset});this._rowHeight=i,this._mapping=Q,this._xOffset=C,this._yOffset=E,this._canvasHeight=o,this._texture||(this._texture=this.device.createTexture({format:"rgba8unorm",width:this._canvasWidth,height:this._canvasHeight,sampler:this._textureParameters||aH})),this._texture.height!==this._canvasHeight&&(this._texture=vj(this._texture,this._canvasWidth,this._canvasHeight,this._textureParameters||aH)),this.onUpdate(),this._canvas=this._canvas||document.createElement("canvas"),this._loadIcons(B)}}_loadIcons(A){let I=this._canvas.getContext("2d",{willReadFrequently:!0});for(let B of A)this._pendingCount++,vB(B.url,this._loadOptions).then(Q=>{let C=Ut(B),E=this._mapping[C],{x:i,y:o,width:D,height:a}=E,{data:t,width:G,height:s}=zj(I,Q,D,a);this._texture.setSubImageData({data:t,x:i+(D-G)/2,y:o+(a-s)/2,width:G,height:s}),E.width=G,E.height=s,this._texture.generateMipmap(),this.onUpdate()}).catch(Q=>{this.onError({url:B.url,source:B.source,sourceIndex:B.sourceIndex,loadOptions:this._loadOptions,error:Q})}).finally(()=>{this._pendingCount--})}};var GH=[0,0,0,255],
|
|
1167
|
+
`;var Vj=1024,Oj=4,DH=()=>{},aH={minFilter:"linear",mipmapFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"},jj={x:0,y:0,width:0,height:0};function Xj(g){return Math.pow(2,Math.ceil(Math.log2(g)))}function zj(g,A,I,B){let Q=Math.min(I/A.width,B/A.height),C=Math.floor(A.width*Q),E=Math.floor(A.height*Q);return Q===1?{data:A,width:C,height:E}:(g.canvas.height=E,g.canvas.width=C,g.clearRect(0,0,C,E),g.drawImage(A,0,0,A.width,A.height,0,0,C,E),{data:g.canvas,width:C,height:E})}function Ut(g){return g&&(g.id||g.url)}function vj(g,A,I,B){let{width:Q,height:C,device:E}=g,i=E.createTexture({format:"rgba8unorm",width:A,height:I,sampler:B}),o=E.createCommandEncoder();return o.copyTextureToTexture({source:g,destination:i,width:Q,height:C}),o.finish(),g.destroy(),i}function tH(g,A,I){for(let B=0;B<A.length;B++){let{icon:Q,xOffset:C}=A[B],E=Ut(Q);g[E]={...Q,x:C,y:I}}}function _j({icons:g,buffer:A,mapping:I={},xOffset:B=0,yOffset:Q=0,rowHeight:C=0,canvasWidth:E}){let i=[];for(let o=0;o<g.length;o++){let D=g[o],a=Ut(D);if(!I[a]){let{height:t,width:G}=D;B+G+A>E&&(tH(I,i,Q),B=0,Q=C+Q+A,C=0,i=[]),i.push({icon:D,xOffset:B}),B=B+G+A,C=Math.max(C,t)}}return i.length>0&&tH(I,i,Q),{mapping:I,rowHeight:C,xOffset:B,yOffset:Q,canvasWidth:E,canvasHeight:Xj(C+Q+A)}}function $j(g,A,I){if(!g||!A)return null;I=I||{};let B={},{iterable:Q,objectInfo:C}=gB(g);for(let E of Q){C.index++;let i=A(E,C),o=Ut(i);if(!i)throw new Error("Icon is missing.");if(!i.url)throw new Error("Icon url is missing.");!B[o]&&(!I[o]||i.url!==I[o].url)&&(B[o]={...i,source:E,sourceIndex:C.index})}return B}var Ht=class{constructor(A,{onUpdate:I=DH,onError:B=DH}){this._loadOptions=null,this._texture=null,this._externalTexture=null,this._mapping={},this._textureParameters=null,this._pendingCount=0,this._autoPacking=!1,this._xOffset=0,this._yOffset=0,this._rowHeight=0,this._buffer=Oj,this._canvasWidth=Vj,this._canvasHeight=0,this._canvas=null,this.device=A,this.onUpdate=I,this.onError=B}finalize(){this._texture?.delete()}getTexture(){return this._texture||this._externalTexture}getIconMapping(A){let I=this._autoPacking?Ut(A):A;return this._mapping[I]||jj}setProps({loadOptions:A,autoPacking:I,iconAtlas:B,iconMapping:Q,textureParameters:C}){A&&(this._loadOptions=A),I!==void 0&&(this._autoPacking=I),Q&&(this._mapping=Q),B&&(this._texture?.delete(),this._texture=null,this._externalTexture=B),C&&(this._textureParameters=C)}get isLoaded(){return this._pendingCount===0}packIcons(A,I){if(!this._autoPacking||typeof document>"u")return;let B=Object.values($j(A,I,this._mapping)||{});if(B.length>0){let{mapping:Q,xOffset:C,yOffset:E,rowHeight:i,canvasHeight:o}=_j({icons:B,buffer:this._buffer,canvasWidth:this._canvasWidth,mapping:this._mapping,rowHeight:this._rowHeight,xOffset:this._xOffset,yOffset:this._yOffset});this._rowHeight=i,this._mapping=Q,this._xOffset=C,this._yOffset=E,this._canvasHeight=o,this._texture||(this._texture=this.device.createTexture({format:"rgba8unorm",width:this._canvasWidth,height:this._canvasHeight,sampler:this._textureParameters||aH})),this._texture.height!==this._canvasHeight&&(this._texture=vj(this._texture,this._canvasWidth,this._canvasHeight,this._textureParameters||aH)),this.onUpdate(),this._canvas=this._canvas||document.createElement("canvas"),this._loadIcons(B)}}_loadIcons(A){let I=this._canvas.getContext("2d",{willReadFrequently:!0});for(let B of A)this._pendingCount++,vB(B.url,this._loadOptions).then(Q=>{let C=Ut(B),E=this._mapping[C],{x:i,y:o,width:D,height:a}=E,{data:t,width:G,height:s}=zj(I,Q,D,a);this._texture.setSubImageData({data:t,x:i+(D-G)/2,y:o+(a-s)/2,width:G,height:s}),E.width=G,E.height=s,this._texture.generateMipmap(),this.onUpdate()}).catch(Q=>{this.onError({url:B.url,source:B.source,sourceIndex:B.sourceIndex,loadOptions:this._loadOptions,error:Q})}).finally(()=>{this._pendingCount--})}};var GH=[0,0,0,255],A9={iconAtlas:{type:"image",value:null,async:!0},iconMapping:{type:"object",value:{},async:!0},sizeScale:{type:"number",value:1,min:0},billboard:!0,sizeUnits:"pixels",sizeMinPixels:{type:"number",min:0,value:0},sizeMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},alphaCutoff:{type:"number",value:.05,min:0,max:1},getPosition:{type:"accessor",value:g=>g.position},getIcon:{type:"accessor",value:g=>g.icon},getColor:{type:"accessor",value:GH},getSize:{type:"accessor",value:1},getAngle:{type:"accessor",value:0},getPixelOffset:{type:"accessor",value:[0,0]},onIconError:{type:"function",value:null,optional:!0},textureParameters:{type:"object",ignore:!0,value:null}},St=class extends Og{getShaders(){return super.getShaders({vs:iH,fs:oH,modules:[AI,II]})}initializeState(){this.state={iconManager:new Ht(this.context.device,{onUpdate:this._onUpdate.bind(this),onError:this._onError.bind(this)})},this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceSizes:{size:1,transition:!0,accessor:"getSize",defaultValue:1},instanceOffsets:{size:2,accessor:"getIcon",transform:this.getInstanceOffset},instanceIconFrames:{size:4,accessor:"getIcon",transform:this.getInstanceIconFrame},instanceColorModes:{size:1,type:"uint8",accessor:"getIcon",transform:this.getInstanceColorMode},instanceColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getColor",defaultValue:GH},instanceAngles:{size:1,transition:!0,accessor:"getAngle"},instancePixelOffset:{size:2,transition:!0,accessor:"getPixelOffset"}})}updateState(A){super.updateState(A);let{props:I,oldProps:B,changeFlags:Q}=A,C=this.getAttributeManager(),{iconAtlas:E,iconMapping:i,data:o,getIcon:D,textureParameters:a}=I,{iconManager:t}=this.state;if(typeof E=="string")return;let G=E||this.internalState.isAsyncPropLoading("iconAtlas");t.setProps({loadOptions:I.loadOptions,autoPacking:!G,iconAtlas:E,iconMapping:G?i:null,textureParameters:a}),G?B.iconMapping!==I.iconMapping&&C.invalidate("getIcon"):(Q.dataChanged||Q.updateTriggersChanged&&(Q.updateTriggersChanged.all||Q.updateTriggersChanged.getIcon))&&t.packIcons(o,D),Q.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),C.invalidateAll())}get isLoaded(){return super.isLoaded&&this.state.iconManager.isLoaded}finalizeState(A){super.finalizeState(A),this.state.iconManager.finalize()}draw({uniforms:A}){let{sizeScale:I,sizeMinPixels:B,sizeMaxPixels:Q,sizeUnits:C,billboard:E,alphaCutoff:i}=this.props,{iconManager:o}=this.state,D=o.getTexture();if(D){let a=this.state.model;a.setBindings({iconsTexture:D}),a.setUniforms(A),a.setUniforms({iconsTextureDim:[D.width,D.height],sizeUnits:GI[C],sizeScale:I,sizeMinPixels:B,sizeMaxPixels:Q,billboard:E,alphaCutoff:i}),a.draw(this.context.renderPass)}}_getModel(){let A=[-1,-1,1,-1,-1,1,1,1];return new cg(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new sI({topology:"triangle-strip",attributes:{positions:{size:2,value:new Float32Array(A)}}}),isInstanced:!0})}_onUpdate(){this.setNeedsRedraw()}_onError(A){let I=this.getCurrentLayer()?.props.onIconError;I?I(A):X.error(A.error.message)()}getInstanceOffset(A){let{width:I,height:B,anchorX:Q=I/2,anchorY:C=B/2}=this.state.iconManager.getIconMapping(A);return[I/2-Q,B/2-C]}getInstanceColorMode(A){return this.state.iconManager.getIconMapping(A).mask?1:0}getInstanceIconFrame(A){let{x:I,y:B,width:Q,height:C}=this.state.iconManager.getIconMapping(A);return[I,B,Q,C]}};St.defaultProps=A9;St.layerName="IconLayer";var Lt=St;var sH=`#version 300 es
|
|
1168
1168
|
#define SHADER_NAME scatterplot-layer-vertex-shader
|
|
1169
1169
|
in vec3 positions;
|
|
1170
1170
|
in vec3 instancePositions;
|
|
@@ -1266,7 +1266,7 @@ fragColor = vFillColor;
|
|
|
1266
1266
|
fragColor.a *= inCircle;
|
|
1267
1267
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
1268
1268
|
}
|
|
1269
|
-
`;var cH=[0,0,0,255],
|
|
1269
|
+
`;var cH=[0,0,0,255],g9={radiusUnits:"meters",radiusScale:{type:"number",min:0,value:1},radiusMinPixels:{type:"number",min:0,value:0},radiusMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},lineWidthUnits:"meters",lineWidthScale:{type:"number",min:0,value:1},lineWidthMinPixels:{type:"number",min:0,value:0},lineWidthMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},stroked:!1,filled:!0,billboard:!1,antialiasing:!0,getPosition:{type:"accessor",value:g=>g.position},getRadius:{type:"accessor",value:1},getFillColor:{type:"accessor",value:cH},getLineColor:{type:"accessor",value:cH},getLineWidth:{type:"accessor",value:1},strokeWidth:{deprecatedFor:"getLineWidth"},outline:{deprecatedFor:"stroked"},getColor:{deprecatedFor:["getFillColor","getLineColor"]}},dt=class extends Og{getShaders(){return super.getShaders({vs:sH,fs:wH,modules:[AI,II]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceRadius:{size:1,transition:!0,accessor:"getRadius",defaultValue:1},instanceFillColors:{size:this.props.colorFormat.length,transition:!0,type:"unorm8",accessor:"getFillColor",defaultValue:[0,0,0,255]},instanceLineColors:{size:this.props.colorFormat.length,transition:!0,type:"unorm8",accessor:"getLineColor",defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:!0,accessor:"getLineWidth",defaultValue:1}})}updateState(A){super.updateState(A),A.changeFlags.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw({uniforms:A}){let{radiusUnits:I,radiusScale:B,radiusMinPixels:Q,radiusMaxPixels:C,stroked:E,filled:i,billboard:o,antialiasing:D,lineWidthUnits:a,lineWidthScale:t,lineWidthMinPixels:G,lineWidthMaxPixels:s}=this.props,w=this.state.model;w.setUniforms(A),w.setUniforms({stroked:E?1:0,filled:i,billboard:o,antialiasing:D,radiusUnits:GI[I],radiusScale:B,radiusMinPixels:Q,radiusMaxPixels:C,lineWidthUnits:GI[a],lineWidthScale:t,lineWidthMinPixels:G,lineWidthMaxPixels:s}),w.draw(this.context.renderPass)}_getModel(){let A=[-1,-1,0,1,-1,0,-1,1,0,1,1,0];return new cg(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new sI({topology:"triangle-strip",attributes:{positions:{size:3,value:new Float32Array(A)}}}),isInstanced:!0})}};dt.defaultProps=g9;dt.layerName="ScatterplotLayer";var BB=dt;var ae={CLOCKWISE:1,COUNTER_CLOCKWISE:-1};function pt(g,A,I={}){return eH(g,I)!==A?(I9(g,I),!0):!1}function eH(g,A={}){return Math.sign(te(g,A))}var ir={x:0,y:1,z:2};function te(g,A={}){let{start:I=0,end:B=g.length,plane:Q="xy"}=A,C=A.size||2,E=0,i=ir[Q[0]],o=ir[Q[1]];for(let D=I,a=B-C;D<B;D+=C)E+=(g[D+i]-g[a+i])*(g[D+o]+g[a+o]),a=D;return E/2}function I9(g,A){let{start:I=0,end:B=g.length,size:Q=2}=A,C=(B-I)/Q,E=Math.floor(C/2);for(let i=0;i<E;++i){let o=I+i*Q,D=I+(C-1-i)*Q;for(let a=0;a<Q;++a){let t=g[o+a];g[o+a]=g[D+a],g[D+a]=t}}}function eI(g,A){let I=A.length,B=g.length;if(B>0){let Q=!0;for(let C=0;C<I;C++)if(g[B-I+C]!==A[C]){Q=!1;break}if(Q)return!1}for(let Q=0;Q<I;Q++)g[B+Q]=A[Q];return!0}function lt(g,A){let I=A.length;for(let B=0;B<I;B++)g[B]=A[B]}function BE(g,A,I,B,Q=[]){let C=B+A*I;for(let E=0;E<I;E++)Q[E]=g[C+E];return Q}function Ge(g,A,I,B,Q=[]){let C,E;if(I&8)C=(B[3]-g[1])/(A[1]-g[1]),E=3;else if(I&4)C=(B[1]-g[1])/(A[1]-g[1]),E=1;else if(I&2)C=(B[2]-g[0])/(A[0]-g[0]),E=2;else if(I&1)C=(B[0]-g[0])/(A[0]-g[0]),E=0;else return null;for(let i=0;i<g.length;i++)Q[i]=(E&1)===i?B[E]:C*(A[i]-g[i])+g[i];return Q}function ft(g,A){let I=0;return g[0]<A[0]?I|=1:g[0]>A[2]&&(I|=2),g[1]<A[1]?I|=4:g[1]>A[3]&&(I|=8),I}function mt(g,A){let{size:I=2,broken:B=!1,gridResolution:Q=10,gridOffset:C=[0,0],startIndex:E=0,endIndex:i=g.length}=A||{},o=(i-E)/I,D=[],a=[D],t=BE(g,0,I,E),G,s,w=hH(t,Q,C,[]),e=[];eI(D,t);for(let c=1;c<o;c++){for(G=BE(g,c,I,E,G),s=ft(G,w);s;){Ge(t,G,s,w,e);let h=ft(e,w);h&&(Ge(t,e,h,w,e),s=h),eI(D,e),lt(t,e),C9(w,Q,s),B&&D.length>I&&(D=[],a.push(D),eI(D,t)),s=ft(G,w)}eI(D,G),lt(t,G)}return B?a:a[0]}var NH=0,Q9=1;function xt(g,A=null,I){if(!g.length)return[];let{size:B=2,gridResolution:Q=10,gridOffset:C=[0,0],edgeTypes:E=!1}=I||{},i=[],o=[{pos:g,types:E?new Array(g.length/B).fill(Q9):null,holes:A||[]}],D=[[],[]],a=[];for(;o.length;){let{pos:t,types:G,holes:s}=o.shift();E9(t,B,s[0]||t.length,D),a=hH(D[0],Q,C,a);let w=ft(D[1],a);if(w){let e=kH(t,G,B,0,s[0]||t.length,a,w),c={pos:e[0].pos,types:e[0].types,holes:[]},h={pos:e[1].pos,types:e[1].types,holes:[]};o.push(c,h);for(let R=0;R<s.length;R++)e=kH(t,G,B,s[R],s[R+1]||t.length,a,w),e[0]&&(c.holes.push(c.pos.length),c.pos=se(c.pos,e[0].pos),E&&(c.types=se(c.types,e[0].types))),e[1]&&(h.holes.push(h.pos.length),h.pos=se(h.pos,e[1].pos),E&&(h.types=se(h.types,e[1].types)))}else{let e={positions:t};E&&(e.edgeTypes=G),s.length&&(e.holeIndices=s),i.push(e)}}return i}function kH(g,A,I,B,Q,C,E){let i=(Q-B)/I,o=[],D=[],a=[],t=[],G=[],s,w,e,c=BE(g,i-1,I,B),h=Math.sign(E&8?c[1]-C[3]:c[0]-C[2]),R=A&&A[i-1],N=0,y=0;for(let r=0;r<i;r++)s=BE(g,r,I,B,s),w=Math.sign(E&8?s[1]-C[3]:s[0]-C[2]),e=A&&A[B/I+r],w&&h&&h!==w&&(Ge(c,s,E,C,G),eI(o,G)&&a.push(R),eI(D,G)&&t.push(R)),w<=0?(eI(o,s)&&a.push(e),N-=w):a.length&&(a[a.length-1]=NH),w>=0?(eI(D,s)&&t.push(e),y+=w):t.length&&(t[t.length-1]=NH),lt(c,s),h=w,R=e;return[N?{pos:o,types:A&&a}:null,y?{pos:D,types:A&&t}:null]}function hH(g,A,I,B){let Q=Math.floor((g[0]-I[0])/A)*A+I[0],C=Math.floor((g[1]-I[1])/A)*A+I[1];return B[0]=Q,B[1]=C,B[2]=Q+A,B[3]=C+A,B}function C9(g,A,I){I&8?(g[1]+=A,g[3]+=A):I&4?(g[1]-=A,g[3]-=A):I&2?(g[0]+=A,g[2]+=A):I&1&&(g[0]-=A,g[2]-=A)}function E9(g,A,I,B){let Q=1/0,C=-1/0,E=1/0,i=-1/0;for(let o=0;o<I;o+=A){let D=g[o],a=g[o+1];Q=D<Q?D:Q,C=D>C?D:C,E=a<E?a:E,i=a>i?a:i}return B[0][0]=Q,B[0][1]=E,B[1][0]=C,B[1][1]=i,B}function se(g,A){for(let I=0;I<A.length;I++)g.push(A[I]);return g}var i9=85.051129;function or(g,A){let{size:I=2,startIndex:B=0,endIndex:Q=g.length,normalize:C=!0}=A||{},E=g.slice(B,Q);FH(E,I,0,Q-B);let i=mt(E,{size:I,broken:!0,gridResolution:360,gridOffset:[-180,-180]});if(C)for(let o of i)yH(o,I);return i}function Dr(g,A=null,I){let{size:B=2,normalize:Q=!0,edgeTypes:C=!1}=I||{};A=A||[];let E=[],i=[],o=0,D=0;for(let t=0;t<=A.length;t++){let G=A[t]||g.length,s=D,w=o9(g,B,o,G);for(let e=w;e<G;e++)E[D++]=g[e];for(let e=o;e<w;e++)E[D++]=g[e];FH(E,B,s,D),D9(E,B,s,D,I?.maxLatitude),o=G,i[t]=D}i.pop();let a=xt(E,i,{size:B,gridResolution:360,gridOffset:[-180,-180],edgeTypes:C});if(Q)for(let t of a)yH(t.positions,B);return a}function o9(g,A,I,B){let Q=-1,C=-1;for(let E=I+1;E<B;E+=A){let i=Math.abs(g[E]);i>Q&&(Q=i,C=E-1)}return C}function D9(g,A,I,B,Q=i9){let C=g[I],E=g[B-A];if(Math.abs(C-E)>180){let i=BE(g,0,A,I);i[0]+=Math.round((E-C)/360)*360,eI(g,i),i[1]=Math.sign(i[1])*Q,eI(g,i),i[0]=C,eI(g,i)}}function FH(g,A,I,B){let Q=g[0],C;for(let E=I;E<B;E+=A){C=g[E];let i=C-Q;(i>180||i<-180)&&(C-=Math.round(i/360)*360),g[E]=Q=C}}function yH(g,A){let I,B=g.length/A;for(let C=0;C<B&&(I=g[C*A],(I+180)%360===0);C++);let Q=-Math.round(I/360)*360;if(Q!==0)for(let C=0;C<B;C++)g[C*A]+=Q}function rH(g,A,I,B){let Q;if(Array.isArray(g[0])){let C=g.length*A;Q=new Array(C);for(let E=0;E<g.length;E++)for(let i=0;i<A;i++)Q[E*A+i]=g[E][i]||0}else Q=g;return I?mt(Q,{size:A,gridResolution:I}):B?or(Q,{size:A}):Q}var t9=1,G9=2,ar=4,ut=class extends XQ{constructor(A){super({...A,attributes:{positions:{size:3,padding:18,initialize:!0,type:A.fp64?Float64Array:Float32Array},segmentTypes:{size:1,type:Uint8ClampedArray}}})}get(A){return this.attributes[A]}getGeometryFromBuffer(A){return this.normalize?super.getGeometryFromBuffer(A):null}normalizeGeometry(A){return this.normalize?rH(A,this.positionSize,this.opts.resolution,this.opts.wrapLongitude):A}getGeometrySize(A){if(nH(A)){let B=0;for(let Q of A)B+=this.getGeometrySize(Q);return B}let I=this.getPathLength(A);return I<2?0:this.isClosed(A)?I<3?0:I+2:I}updateGeometryAttributes(A,I){if(I.geometrySize!==0)if(A&&nH(A))for(let B of A){let Q=this.getGeometrySize(B);I.geometrySize=Q,this.updateGeometryAttributes(B,I),I.vertexStart+=Q}else this._updateSegmentTypes(A,I),this._updatePositions(A,I)}_updateSegmentTypes(A,I){let B=this.attributes.segmentTypes,Q=A?this.isClosed(A):!1,{vertexStart:C,geometrySize:E}=I;B.fill(0,C,C+E),Q?(B[C]=ar,B[C+E-2]=ar):(B[C]+=t9,B[C+E-2]+=G9),B[C+E-1]=ar}_updatePositions(A,I){let{positions:B}=this.attributes;if(!B||!A)return;let{vertexStart:Q,geometrySize:C}=I,E=new Array(3);for(let i=Q,o=0;o<C;i++,o++)this.getPointOnPath(A,o,E),B[i*3]=E[0],B[i*3+1]=E[1],B[i*3+2]=E[2]}getPathLength(A){return A.length/this.positionSize}getPointOnPath(A,I,B=[]){let{positionSize:Q}=this;I*Q>=A.length&&(I+=1-A.length/Q);let C=I*Q;return B[0]=A[C],B[1]=A[C+1],B[2]=Q===3&&A[C+2]||0,B}isClosed(A){if(!this.normalize)return!!this.opts.loop;let{positionSize:I}=this,B=A.length-I;return A[0]===A[B]&&A[1]===A[B+1]&&(I===2||A[2]===A[B+2])}};function nH(g){return Array.isArray(g[0])}var RH=`#version 300 es
|
|
1270
1270
|
#define SHADER_NAME path-layer-vertex-shader
|
|
1271
1271
|
in vec2 positions;
|
|
1272
1272
|
in float instanceTypes;
|
|
@@ -1443,7 +1443,7 @@ discard;
|
|
|
1443
1443
|
fragColor = vColor;
|
|
1444
1444
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
1445
1445
|
}
|
|
1446
|
-
`;var JH=[0,0,0,255],
|
|
1446
|
+
`;var JH=[0,0,0,255],s9={widthUnits:"meters",widthScale:{type:"number",min:0,value:1},widthMinPixels:{type:"number",min:0,value:0},widthMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},jointRounded:!1,capRounded:!1,miterLimit:{type:"number",min:0,value:4},billboard:!1,_pathType:null,getPath:{type:"accessor",value:g=>g.path},getColor:{type:"accessor",value:JH},getWidth:{type:"accessor",value:1},rounded:{deprecatedFor:["jointRounded","capRounded"]}},tr={enter:(g,A)=>A.length?A.subarray(A.length-g.length):g},Wt=class extends Og{getShaders(){return super.getShaders({vs:RH,fs:MH,modules:[AI,II]})}get wrapLongitude(){return!1}getBounds(){return this.getAttributeManager()?.getBounds(["vertexPositions"])}initializeState(){this.getAttributeManager().addInstanced({vertexPositions:{size:3,vertexOffset:1,type:"float64",fp64:this.use64bitPositions(),transition:tr,accessor:"getPath",update:this.calculatePositions,noAlloc:!0,shaderAttributes:{instanceLeftPositions:{vertexOffset:0},instanceStartPositions:{vertexOffset:1},instanceEndPositions:{vertexOffset:2},instanceRightPositions:{vertexOffset:3}}},instanceTypes:{size:1,type:"uint8",update:this.calculateSegmentTypes,noAlloc:!0},instanceStrokeWidths:{size:1,accessor:"getWidth",transition:tr,defaultValue:1},instanceColors:{size:this.props.colorFormat.length,type:"unorm8",accessor:"getColor",transition:tr,defaultValue:JH},instancePickingColors:{size:4,type:"uint8",accessor:(B,{index:Q,target:C})=>this.encodePickingColor(B&&B.__source?B.__source.index:Q,C)}}),this.setState({pathTesselator:new ut({fp64:this.use64bitPositions()})})}updateState(A){super.updateState(A);let{props:I,changeFlags:B}=A,Q=this.getAttributeManager();if(B.dataChanged||B.updateTriggersChanged&&(B.updateTriggersChanged.all||B.updateTriggersChanged.getPath)){let{pathTesselator:E}=this.state,i=I.data.attributes||{};E.updateGeometry({data:I.data,geometryBuffer:i.getPath,buffers:i,normalize:!I._pathType,loop:I._pathType==="loop",getGeometry:I.getPath,positionFormat:I.positionFormat,wrapLongitude:I.wrapLongitude,resolution:this.context.viewport.resolution,dataChanged:B.dataChanged}),this.setState({numInstances:E.instanceCount,startIndices:E.vertexStarts}),B.dataChanged||Q.invalidateAll()}B.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),Q.invalidateAll())}getPickingInfo(A){let I=super.getPickingInfo(A),{index:B}=I,Q=this.props.data;return Q[0]&&Q[0].__source&&(I.object=Q.find(C=>C.__source.index===B)),I}disablePickingIndex(A){let I=this.props.data;if(I[0]&&I[0].__source)for(let B=0;B<I.length;B++)I[B].__source.index===A&&this._disablePickingIndex(B);else super.disablePickingIndex(A)}draw({uniforms:A}){let{jointRounded:I,capRounded:B,billboard:Q,miterLimit:C,widthUnits:E,widthScale:i,widthMinPixels:o,widthMaxPixels:D}=this.props,a=this.state.model;a.setUniforms(A),a.setUniforms({jointType:Number(I),capType:Number(B),billboard:Q,widthUnits:GI[E],widthScale:i,miterLimit:C,widthMinPixels:o,widthMaxPixels:D}),a.draw(this.context.renderPass)}_getModel(){let A=[0,1,2,1,4,2,1,3,4,3,5,4],I=[0,0,0,-1,0,1,1,-1,1,1,1,0];return new cg(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new sI({topology:"triangle-list",attributes:{indices:new Uint16Array(A),positions:{value:new Float32Array(I),size:2}}}),isInstanced:!0})}calculatePositions(A){let{pathTesselator:I}=this.state;A.startIndices=I.vertexStarts,A.value=I.get("positions")}calculateSegmentTypes(A){let{pathTesselator:I}=this.state;A.startIndices=I.vertexStarts,A.value=I.get("segmentTypes")}};Wt.defaultProps=s9;Wt.layerName="PathLayer";var QE=Wt;var lH=hM(HH(),1);var ke=ae.CLOCKWISE,SH=ae.COUNTER_CLOCKWISE,CE={isClosed:!0};function q9(g){if(g=g&&g.positions||g,!Array.isArray(g)&&!ArrayBuffer.isView(g))throw new Error("invalid polygon")}function mo(g){return"positions"in g?g.positions:g}function Pt(g){return"holeIndices"in g?g.holeIndices:null}function U9(g){return Array.isArray(g[0])}function H9(g){return g.length>=1&&g[0].length>=2&&Number.isFinite(g[0][0])}function S9(g){let A=g[0],I=g[g.length-1];return A[0]===I[0]&&A[1]===I[1]&&A[2]===I[2]}function L9(g,A,I,B){for(let Q=0;Q<A;Q++)if(g[I+Q]!==g[B-A+Q])return!1;return!0}function LH(g,A,I,B,Q){let C=A,E=I.length;for(let i=0;i<E;i++)for(let o=0;o<B;o++)g[C++]=I[i][o]||0;if(!S9(I))for(let i=0;i<B;i++)g[C++]=I[0][i]||0;return CE.start=A,CE.end=C,CE.size=B,pt(g,Q,CE),C}function dH(g,A,I,B,Q=0,C,E){C=C||I.length;let i=C-Q;if(i<=0)return A;let o=A;for(let D=0;D<i;D++)g[o++]=I[Q+D];if(!L9(I,B,Q,C))for(let D=0;D<B;D++)g[o++]=I[Q+D];return CE.start=A,CE.end=o,CE.size=B,pt(g,E,CE),o}function he(g,A){q9(g);let I=[],B=[];if("positions"in g){let{positions:Q,holeIndices:C}=g;if(C){let E=0;for(let i=0;i<=C.length;i++)E=dH(I,E,Q,A,C[i-1],C[i],i===0?ke:SH),B.push(E);return B.pop(),{positions:I,holeIndices:B}}g=Q}if(!U9(g))return dH(I,0,g,A,0,I.length,ke),I;if(!H9(g)){let Q=0;for(let[C,E]of g.entries())Q=LH(I,Q,E,A,C===0?ke:SH),B.push(Q);return B.pop(),{positions:I,holeIndices:B}}return LH(I,0,g,A,ke),I}function er(g,A,I){let B=g.length/3,Q=0;for(let C=0;C<B;C++){let E=(C+1)%B;Q+=g[C*3+A]*g[E*3+I],Q-=g[E*3+A]*g[C*3+I]}return Math.abs(Q/2)}function pH(g,A,I,B){let Q=g.length/3;for(let C=0;C<Q;C++){let E=C*3,i=g[E+0],o=g[E+1],D=g[E+2];g[E+A]=i,g[E+I]=o,g[E+B]=D}}function fH(g,A,I,B){let Q=Pt(g);Q&&(Q=Q.map(i=>i/A));let C=mo(g),E=B&&A===3;if(I){let i=C.length;C=C.slice();let o=[];for(let D=0;D<i;D+=A){o[0]=C[D],o[1]=C[D+1],E&&(o[2]=C[D+2]);let a=I(o);C[D]=a[0],C[D+1]=a[1],E&&(C[D+2]=a[2])}}if(E){let i=er(C,0,1),o=er(C,0,2),D=er(C,1,2);if(!i&&!o&&!D)return[];i>o&&i>D||(o>D?(I||(C=C.slice()),pH(C,0,2,1)):(I||(C=C.slice()),pH(C,2,0,1)))}return(0,lH.default)(C,Q,A)}var Vt=class extends XQ{constructor(A){let{fp64:I,IndexType:B=Uint32Array}=A;super({...A,attributes:{positions:{size:3,type:I?Float64Array:Float32Array},vertexValid:{type:Uint16Array,size:1},indices:{type:B,size:1}}})}get(A){let{attributes:I}=this;return A==="indices"?I.indices&&I.indices.subarray(0,this.vertexCount):I[A]}updateGeometry(A){super.updateGeometry(A);let I=this.buffers.indices;if(I)this.vertexCount=(I.value||I).length;else if(this.data&&!this.getGeometry)throw new Error("missing indices buffer")}normalizeGeometry(A){if(this.normalize){let I=he(A,this.positionSize);return this.opts.resolution?xt(mo(I),Pt(I),{size:this.positionSize,gridResolution:this.opts.resolution,edgeTypes:!0}):this.opts.wrapLongitude?Dr(mo(I),Pt(I),{size:this.positionSize,maxLatitude:86,edgeTypes:!0}):I}return A}getGeometrySize(A){if(xH(A)){let I=0;for(let B of A)I+=this.getGeometrySize(B);return I}return mo(A).length/this.positionSize}getGeometryFromBuffer(A){return this.normalize||!this.buffers.indices?super.getGeometryFromBuffer(A):null}updateGeometryAttributes(A,I){if(A&&xH(A))for(let B of A){let Q=this.getGeometrySize(B);I.geometrySize=Q,this.updateGeometryAttributes(B,I),I.vertexStart+=Q,I.indexStart=this.indexStarts[I.geometryIndex+1]}else{let B=A;this._updateIndices(B,I),this._updatePositions(B,I),this._updateVertexValid(B,I)}}_updateIndices(A,{geometryIndex:I,vertexStart:B,indexStart:Q}){let{attributes:C,indexStarts:E,typedArrayManager:i}=this,o=C.indices;if(!o||!A)return;let D=Q,a=fH(A,this.positionSize,this.opts.preproject,this.opts.full3d);o=i.allocate(o,Q+a.length,{copy:!0});for(let t=0;t<a.length;t++)o[D++]=a[t]+B;E[I+1]=Q+a.length,C.indices=o}_updatePositions(A,{vertexStart:I,geometrySize:B}){let{attributes:{positions:Q},positionSize:C}=this;if(!Q||!A)return;let E=mo(A);for(let i=I,o=0;o<B;i++,o++){let D=E[o*C],a=E[o*C+1],t=C>2?E[o*C+2]:0;Q[i*3]=D,Q[i*3+1]=a,Q[i*3+2]=t}}_updateVertexValid(A,{vertexStart:I,geometrySize:B}){let{positionSize:Q}=this,C=this.attributes.vertexValid,E=A&&Pt(A);if(A&&A.edgeTypes?C.set(A.edgeTypes,I):C.fill(1,I,I+B),E)for(let i=0;i<E.length;i++)C[I+E[i]/Q-1]=0;C[I+B-1]=0}};function xH(g){return Array.isArray(g)&&g.length>0&&!Number.isFinite(g[0])}var Fe=`uniform bool extruded;
|
|
1447
1447
|
uniform bool isWireframe;
|
|
1448
1448
|
uniform float elevationScale;
|
|
1449
1449
|
uniform float opacity;
|
|
@@ -1555,7 +1555,7 @@ fragColor = vColor;
|
|
|
1555
1555
|
geometry.uv = vec2(0.);
|
|
1556
1556
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
1557
1557
|
}
|
|
1558
|
-
`;var re=[0,0,0,255],
|
|
1558
|
+
`;var re=[0,0,0,255],d9={filled:!0,extruded:!1,wireframe:!1,_normalize:!0,_windingOrder:"CW",_full3d:!1,elevationScale:{type:"number",min:0,value:1},getPolygon:{type:"accessor",value:g=>g.polygon},getElevation:{type:"accessor",value:1e3},getFillColor:{type:"accessor",value:re},getLineColor:{type:"accessor",value:re},material:!0},ye={enter:(g,A)=>A.length?A.subarray(A.length-g.length):g},Ot=class extends Og{getShaders(A){return super.getShaders({vs:A==="top"?uH:WH,fs:bH,defines:{RING_WINDING_ORDER_CW:!this.props._normalize&&this.props._windingOrder==="CCW"?0:1},modules:[AI,oo,II]})}get wrapLongitude(){return!1}getBounds(){return this.getAttributeManager()?.getBounds(["vertexPositions"])}initializeState(){let{viewport:A}=this.context,{coordinateSystem:I}=this.props,{_full3d:B}=this.props;A.isGeospatial&&I===wA.DEFAULT&&(I=wA.LNGLAT);let Q;I===wA.LNGLAT&&(B?Q=A.projectPosition.bind(A):Q=A.projectFlat.bind(A)),this.setState({numInstances:0,polygonTesselator:new Vt({preproject:Q,fp64:this.use64bitPositions(),IndexType:Uint32Array})});let C=this.getAttributeManager(),E=!0;C.remove(["instancePickingColors"]),C.add({indices:{size:1,isIndexed:!0,update:this.calculateIndices,noAlloc:E},vertexPositions:{size:3,type:"float64",stepMode:"dynamic",fp64:this.use64bitPositions(),transition:ye,accessor:"getPolygon",update:this.calculatePositions,noAlloc:E,shaderAttributes:{nextVertexPositions:{vertexOffset:1}}},instanceVertexValid:{size:1,type:"uint16",stepMode:"instance",update:this.calculateVertexValid,noAlloc:E},elevations:{size:1,stepMode:"dynamic",transition:ye,accessor:"getElevation"},fillColors:{size:this.props.colorFormat.length,type:"unorm8",stepMode:"dynamic",transition:ye,accessor:"getFillColor",defaultValue:re},lineColors:{size:this.props.colorFormat.length,type:"unorm8",stepMode:"dynamic",transition:ye,accessor:"getLineColor",defaultValue:re},pickingColors:{size:4,type:"uint8",stepMode:"dynamic",accessor:(i,{index:o,target:D})=>this.encodePickingColor(i&&i.__source?i.__source.index:o,D)}})}getPickingInfo(A){let I=super.getPickingInfo(A),{index:B}=I,Q=this.props.data;return Q[0]&&Q[0].__source&&(I.object=Q.find(C=>C.__source.index===B)),I}disablePickingIndex(A){let I=this.props.data;if(I[0]&&I[0].__source)for(let B=0;B<I.length;B++)I[B].__source.index===A&&this._disablePickingIndex(B);else super.disablePickingIndex(A)}draw({uniforms:A}){let{extruded:I,filled:B,wireframe:Q,elevationScale:C}=this.props,{topModel:E,sideModel:i,wireframeModel:o,polygonTesselator:D}=this.state,a={...A,extruded:!!I,elevationScale:C};o&&Q&&(o.setInstanceCount(D.instanceCount-1),o.setUniforms(a),o.draw(this.context.renderPass)),i&&B&&(i.setInstanceCount(D.instanceCount-1),i.setUniforms(a),i.draw(this.context.renderPass)),E&&B&&(E.setVertexCount(D.vertexCount),E.setUniforms(a),E.draw(this.context.renderPass))}updateState(A){super.updateState(A),this.updateGeometry(A);let{props:I,oldProps:B,changeFlags:Q}=A,C=this.getAttributeManager();(Q.extensionsChanged||I.filled!==B.filled||I.extruded!==B.extruded)&&(this.state.models?.forEach(i=>i.destroy()),this.setState(this._getModels()),C.invalidateAll())}updateGeometry({props:A,oldProps:I,changeFlags:B}){if(B.dataChanged||B.updateTriggersChanged&&(B.updateTriggersChanged.all||B.updateTriggersChanged.getPolygon)){let{polygonTesselator:C}=this.state,E=A.data.attributes||{};C.updateGeometry({data:A.data,normalize:A._normalize,geometryBuffer:E.getPolygon,buffers:E,getGeometry:A.getPolygon,positionFormat:A.positionFormat,wrapLongitude:A.wrapLongitude,resolution:this.context.viewport.resolution,fp64:this.use64bitPositions(),dataChanged:B.dataChanged,full3d:A._full3d}),this.setState({numInstances:C.instanceCount,startIndices:C.vertexStarts}),B.dataChanged||this.getAttributeManager().invalidateAll()}}_getModels(){let{id:A,filled:I,extruded:B}=this.props,Q,C,E;if(I){let i=this.getShaders("top");i.defines.NON_INSTANCED_MODEL=1;let o=this.getAttributeManager().getBufferLayouts({isInstanced:!1});Q=new cg(this.context.device,{...i,id:`${A}-top`,topology:"triangle-list",uniforms:{isWireframe:!1},bufferLayout:o,isIndexed:!0,userData:{excludeAttributes:{instanceVertexValid:!0}}})}if(B){let i=this.getAttributeManager().getBufferLayouts({isInstanced:!0});C=new cg(this.context.device,{...this.getShaders("side"),id:`${A}-side`,bufferLayout:i,uniforms:{isWireframe:!1},geometry:new sI({topology:"triangle-strip",attributes:{positions:{size:2,value:new Float32Array([1,0,0,0,1,1,0,1])}}}),isInstanced:!0,userData:{excludeAttributes:{indices:!0}}}),E=new cg(this.context.device,{...this.getShaders("side"),id:`${A}-wireframe`,bufferLayout:i,uniforms:{isWireframe:!0},geometry:new sI({topology:"line-strip",attributes:{positions:{size:2,value:new Float32Array([1,0,0,0,0,1,1,1])}}}),isInstanced:!0,userData:{excludeAttributes:{indices:!0}}})}return{models:[C,E,Q].filter(Boolean),topModel:Q,sideModel:C,wireframeModel:E}}calculateIndices(A){let{polygonTesselator:I}=this.state;A.startIndices=I.indexStarts,A.value=I.get("indices")}calculatePositions(A){let{polygonTesselator:I}=this.state;A.startIndices=I.vertexStarts,A.value=I.get("positions")}calculateVertexValid(A){A.value=this.state.polygonTesselator.get("vertexValid")}};Ot.defaultProps=d9;Ot.layerName="SolidPolygonLayer";var EE=Ot;function ne({data:g,getIndex:A,dataRange:I,replace:B}){let{startRow:Q=0,endRow:C=1/0}=I,E=g.length,i=E,o=E;for(let G=0;G<E;G++){let s=A(g[G]);if(i>G&&s>=Q&&(i=G),s>=C){o=G;break}}let D=i,t=o-i!==B.length?g.slice(o):void 0;for(let G=0;G<B.length;G++)g[D++]=B[G];if(t){for(let G=0;G<t.length;G++)g[D++]=t[G];g.length=D}return{startRow:i,endRow:i+B.length}}var ZH=[0,0,0,255],p9=[0,0,0,255],l9={stroked:!0,filled:!0,extruded:!1,elevationScale:1,wireframe:!1,_normalize:!0,_windingOrder:"CW",lineWidthUnits:"meters",lineWidthScale:1,lineWidthMinPixels:0,lineWidthMaxPixels:Number.MAX_SAFE_INTEGER,lineJointRounded:!1,lineMiterLimit:4,getPolygon:{type:"accessor",value:g=>g.polygon},getFillColor:{type:"accessor",value:p9},getLineColor:{type:"accessor",value:ZH},getLineWidth:{type:"accessor",value:1},getElevation:{type:"accessor",value:1e3},material:!0},jt=class extends wQ{initializeState(){this.state={paths:[],pathsDiff:null},this.props.getLineDashArray&&X.removed("getLineDashArray","PathStyleExtension")()}updateState({changeFlags:A}){let I=A.dataChanged||A.updateTriggersChanged&&(A.updateTriggersChanged.all||A.updateTriggersChanged.getPolygon);if(I&&Array.isArray(A.dataChanged)){let B=this.state.paths.slice(),Q=A.dataChanged.map(C=>ne({data:B,getIndex:E=>E.__source.index,dataRange:C,replace:this._getPaths(C)}));this.setState({paths:B,pathsDiff:Q})}else I&&this.setState({paths:this._getPaths(),pathsDiff:null})}_getPaths(A={}){let{data:I,getPolygon:B,positionFormat:Q,_normalize:C}=this.props,E=[],i=Q==="XY"?2:3,{startRow:o,endRow:D}=A,{iterable:a,objectInfo:t}=gB(I,o,D);for(let G of a){t.index++;let s=B(G,t);C&&(s=he(s,i));let{holeIndices:w}=s,e=s.positions||s;if(w)for(let c=0;c<=w.length;c++){let h=e.slice(w[c-1]||0,w[c]||e.length);E.push(this.getSubLayerRow({path:h},G,t.index))}else E.push(this.getSubLayerRow({path:e},G,t.index))}return E}renderLayers(){let{data:A,_dataDiff:I,stroked:B,filled:Q,extruded:C,wireframe:E,_normalize:i,_windingOrder:o,elevationScale:D,transitions:a,positionFormat:t}=this.props,{lineWidthUnits:G,lineWidthScale:s,lineWidthMinPixels:w,lineWidthMaxPixels:e,lineJointRounded:c,lineMiterLimit:h,lineDashJustified:R}=this.props,{getFillColor:N,getLineColor:y,getLineWidth:r,getLineDashArray:J,getElevation:q,getPolygon:H,updateTriggers:d,material:K}=this.props,{paths:x,pathsDiff:W}=this.state,u=this.getSubLayerClass("fill",EE),m=this.getSubLayerClass("stroke",QE),_=this.shouldRenderSubLayer("fill",x)&&new u({_dataDiff:I,extruded:C,elevationScale:D,filled:Q,wireframe:E,_normalize:i,_windingOrder:o,getElevation:q,getFillColor:N,getLineColor:C&&E?y:ZH,material:K,transitions:a},this.getSubLayerProps({id:"fill",updateTriggers:d&&{getPolygon:d.getPolygon,getElevation:d.getElevation,getFillColor:d.getFillColor,lineColors:C&&E,getLineColor:d.getLineColor}}),{data:A,positionFormat:t,getPolygon:H}),MA=!C&&B&&this.shouldRenderSubLayer("stroke",x)&&new m({_dataDiff:W&&(()=>W),widthUnits:G,widthScale:s,widthMinPixels:w,widthMaxPixels:e,jointRounded:c,miterLimit:h,dashJustified:R,_pathType:"loop",transitions:a&&{getWidth:a.getLineWidth,getColor:a.getLineColor,getPath:a.getPolygon},getColor:this.getSubLayerAccessor(y),getWidth:this.getSubLayerAccessor(r),getDashArray:this.getSubLayerAccessor(J)},this.getSubLayerProps({id:"stroke",updateTriggers:d&&{getWidth:d.getLineWidth,getColor:d.getLineColor,getDashArray:d.getLineDashArray}}),{data:x,positionFormat:t,getPath:qA=>qA.path});return[!C&&_,MA,C&&_]}};jt.layerName="PolygonLayer";jt.defaultProps=l9;var Re=jt;function TH(g,A){if(!g)return null;let I="startIndices"in g?g.startIndices[A]:A,B=g.featureIds.value[I];return I!==-1?f9(g,B,I):null}function f9(g,A,I){let B={properties:{...g.properties[A]}};for(let Q in g.numericProps)B.properties[Q]=g.numericProps[Q].value[I];return B}function PH(g,A){let I={points:null,lines:null,polygons:null};for(let B in I){let Q=g[B].globalFeatureIds.value;I[B]=new Uint8ClampedArray(Q.length*3);let C=[];for(let E=0;E<Q.length;E++)A(Q[E],C),I[B][E*3+0]=C[0],I[B][E*3+1]=C[1],I[B][E*3+2]=C[2]}return I}var VH=`#version 300 es
|
|
1559
1559
|
#define SHADER_NAME multi-icon-layer-fragment-shader
|
|
1560
1560
|
precision highp float;
|
|
1561
1561
|
uniform float opacity;
|
|
@@ -1593,9 +1593,9 @@ fragColor = vec4(color.rgb, a * opacity);
|
|
|
1593
1593
|
}
|
|
1594
1594
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
1595
1595
|
}
|
|
1596
|
-
`;var Nr=192/256,OH=[],
|
|
1597
|
-
`||c===E)&&(e=c),e>w){let R=a?
|
|
1598
|
-
`&&(i[w]=0,o[w]=0,D[w]=0,w++)}return t[1]=s,{x:i,y:o,rowWidth:D,size:t}}function gS({value:g,length:A,stride:I,offset:B,startIndices:Q,characterSet:C}){let E=g.BYTES_PER_ELEMENT,i=I?I/E:1,o=B?B/E:0,D=Q[A]||Math.ceil((g.length-o)/i),a=C&&new Set,t=new Array(A),G=g;if(i>1||o>0){let s=g.constructor;G=new s(D);for(let w=0;w<D;w++)G[w]=g[w*i+o]}for(let s=0;s<A;s++){let w=Q[s],e=Q[s+1]||D,c=G.subarray(w,e);t[s]=String.fromCodePoint.apply(null,c),a&&c.forEach(a.add,a)}if(a)for(let s of a)C.add(String.fromCodePoint(s));return{texts:t,characterCount:D}}var xo=class{constructor(A=5){this._cache={},this._order=[],this.limit=A}get(A){let I=this._cache[A];return I&&(this._deleteOrder(A),this._appendOrder(A)),I}set(A,I){this._cache[A]?(this.delete(A),this._cache[A]=I,this._appendOrder(A)):(Object.keys(this._cache).length===this.limit&&this.delete(this._order[0]),this._cache[A]=I,this._appendOrder(A))}delete(A){this._cache[A]&&(delete this._cache[A],this._deleteOrder(A))}_deleteOrder(A){let I=this._order.indexOf(A);I>=0&&this._order.splice(I,1)}_appendOrder(A){this._order.push(A)}};function
|
|
1596
|
+
`;var Nr=192/256,OH=[],m9={getIconOffsets:{type:"accessor",value:g=>g.offsets},alphaCutoff:.001,smoothing:.1,outlineWidth:0,outlineColor:{type:"color",value:[0,0,0,255]}},Xt=class extends Lt{getShaders(){return{...super.getShaders(),fs:VH}}initializeState(){super.initializeState(),this.getAttributeManager().addInstanced({instanceOffsets:{size:2,accessor:"getIconOffsets"},instancePickingColors:{type:"uint8",size:3,accessor:(I,{index:B,target:Q})=>this.encodePickingColor(B,Q)}})}updateState(A){super.updateState(A);let{props:I,oldProps:B}=A,{outlineColor:Q}=I;Q!==B.outlineColor&&(Q=Q.map(C=>C/255),Q[3]=Number.isFinite(Q[3])?Q[3]:1,this.setState({outlineColor:Q})),!I.sdf&&I.outlineWidth&&X.warn(`${this.id}: fontSettings.sdf is required to render outline`)()}draw(A){let{sdf:I,smoothing:B,outlineWidth:Q}=this.props,{outlineColor:C}=this.state,E=Q?Math.max(B,Nr*(1-Q)):-1;if(A.uniforms={...A.uniforms,sdfBuffer:Nr,outlineBuffer:E,gamma:B,sdf:!!I,outlineColor:C},super.draw(A),I&&Q){let{iconManager:i}=this.state,o=i.getTexture(),D=this.state.model;o&&(D.setUniforms({outlineBuffer:Nr}),D.draw(this.context.renderPass))}}getInstanceOffset(A){return A?Array.from(A).flatMap(I=>super.getInstanceOffset(I)):OH}getInstanceColorMode(A){return 1}getInstanceIconFrame(A){return A?Array.from(A).flatMap(I=>super.getInstanceIconFrame(I)):OH}};Xt.defaultProps=m9;Xt.layerName="MultiIconLayer";var jH=Xt;var zt=class{constructor({fontSize:A=24,buffer:I=3,radius:B=8,cutoff:Q=.25,fontFamily:C="sans-serif",fontWeight:E="normal",fontStyle:i="normal"}={}){this.buffer=I,this.cutoff=Q,this.radius=B;let o=this.size=A+I*4,D=this._createCanvas(o),a=this.ctx=D.getContext("2d",{willReadFrequently:!0});a.font=`${i} ${E} ${A}px ${C}`,a.textBaseline="alphabetic",a.textAlign="left",a.fillStyle="black",this.gridOuter=new Float64Array(o*o),this.gridInner=new Float64Array(o*o),this.f=new Float64Array(o),this.z=new Float64Array(o+1),this.v=new Uint16Array(o)}_createCanvas(A){let I=document.createElement("canvas");return I.width=I.height=A,I}draw(A){let{width:I,actualBoundingBoxAscent:B,actualBoundingBoxDescent:Q,actualBoundingBoxLeft:C,actualBoundingBoxRight:E}=this.ctx.measureText(A),i=Math.ceil(B),o=0,D=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(E-C))),a=Math.min(this.size-this.buffer,i+Math.ceil(Q)),t=D+2*this.buffer,G=a+2*this.buffer,s=Math.max(t*G,0),w=new Uint8ClampedArray(s),e={data:w,width:t,height:G,glyphWidth:D,glyphHeight:a,glyphTop:i,glyphLeft:o,glyphAdvance:I};if(D===0||a===0)return e;let{ctx:c,buffer:h,gridInner:R,gridOuter:N}=this;c.clearRect(h,h,D,a),c.fillText(A,h,h+i);let y=c.getImageData(h,h,D,a);N.fill(1e20,0,s),R.fill(0,0,s);for(let r=0;r<a;r++)for(let J=0;J<D;J++){let q=y.data[4*(r*D+J)+3]/255;if(q===0)continue;let H=(r+h)*t+J+h;if(q===1)N[H]=0,R[H]=1e20;else{let d=.5-q;N[H]=d>0?d*d:0,R[H]=d<0?d*d:0}}XH(N,0,0,t,G,t,this.f,this.v,this.z),XH(R,h,h,D,a,t,this.f,this.v,this.z);for(let r=0;r<s;r++){let J=Math.sqrt(N[r])-Math.sqrt(R[r]);w[r]=Math.round(255-255*(J/this.radius+this.cutoff))}return e}};function XH(g,A,I,B,Q,C,E,i,o){for(let D=A;D<A+B;D++)zH(g,I*C+D,C,Q,E,i,o);for(let D=I;D<I+Q;D++)zH(g,D*C+A,1,B,E,i,o)}function zH(g,A,I,B,Q,C,E){C[0]=0,E[0]=-1e20,E[1]=1e20,Q[0]=g[A];for(let i=1,o=0,D=0;i<B;i++){Q[i]=g[A+i*I];let a=i*i;do{let t=C[o];D=(Q[i]-Q[t]+a-t*t)/(i-t)/2}while(D<=E[o]&&--o>-1);o++,C[o]=i,E[o]=D,E[o+1]=1e20}for(let i=0,o=0;i<B;i++){for(;E[o+1]<i;)o++;let D=C[o],a=i-D;g[A+i*I]=Q[D]+a*a}}var x9=32,u9=[];function W9(g){return Math.pow(2,Math.ceil(Math.log2(g)))}function vH({characterSet:g,getFontWidth:A,fontHeight:I,buffer:B,maxCanvasWidth:Q,mapping:C={},xOffset:E=0,yOffset:i=0}){let o=0,D=E,a=I+B*2;for(let t of g)if(!C[t]){let G=A(t);D+G+B*2>Q&&(D=0,o++),C[t]={x:D+B,y:i+o*a+B,width:G,height:a,layoutWidth:G,layoutHeight:I},D+=G+B*2}return{mapping:C,xOffset:D,yOffset:i+o*a,canvasHeight:W9(i+(o+1)*a)}}function _H(g,A,I,B){let Q=0;for(let C=A;C<I;C++){let E=g[C];Q+=B[E]?.layoutWidth||0}return Q}function $H(g,A,I,B,Q,C){let E=A,i=0;for(let o=A;o<I;o++){let D=_H(g,o,o+1,Q);i+D>B&&(E<o&&C.push(o),E=o,i=0),i+=D}return i}function b9(g,A,I,B,Q,C){let E=A,i=A,o=A,D=0;for(let a=A;a<I;a++)if((g[a]===" "||g[a+1]===" "||a+1===I)&&(o=a+1),o>i){let t=_H(g,i,o,Q);D+t>B&&(E<i&&(C.push(i),E=i,D=0),t>B&&(t=$H(g,i,o,B,Q,C),E=C[C.length-1])),i=o,D+=t}return D}function Z9(g,A,I,B,Q=0,C){C===void 0&&(C=g.length);let E=[];return A==="break-all"?$H(g,Q,C,I,B,E):b9(g,Q,C,I,B,E),E}function T9(g,A,I,B,Q,C){let E=0,i=0;for(let o=A;o<I;o++){let D=g[o],a=B[D];a?(i||(i=a.layoutHeight),Q[o]=E+a.layoutWidth/2,E+=a.layoutWidth):(X.warn(`Missing character: ${D} (${D.codePointAt(0)})`)(),Q[o]=E,E+=x9)}C[0]=E,C[1]=i}function AS(g,A,I,B,Q){let C=Array.from(g),E=C.length,i=new Array(E),o=new Array(E),D=new Array(E),a=(I==="break-word"||I==="break-all")&&isFinite(B)&&B>0,t=[0,0],G=[0,0],s=0,w=0,e=0;for(let c=0;c<=E;c++){let h=C[c];if((h===`
|
|
1597
|
+
`||c===E)&&(e=c),e>w){let R=a?Z9(C,I,B,Q,w,e):u9;for(let N=0;N<=R.length;N++){let y=N===0?w:R[N-1],r=N<R.length?R[N]:e;T9(C,y,r,Q,i,G);for(let J=y;J<r;J++){let q=C[J],H=Q[q]?.layoutOffsetY||0;o[J]=s+G[1]/2+H,D[J]=G[0]}s=s+G[1]*A,t[0]=Math.max(t[0],G[0])}w=e}h===`
|
|
1598
|
+
`&&(i[w]=0,o[w]=0,D[w]=0,w++)}return t[1]=s,{x:i,y:o,rowWidth:D,size:t}}function gS({value:g,length:A,stride:I,offset:B,startIndices:Q,characterSet:C}){let E=g.BYTES_PER_ELEMENT,i=I?I/E:1,o=B?B/E:0,D=Q[A]||Math.ceil((g.length-o)/i),a=C&&new Set,t=new Array(A),G=g;if(i>1||o>0){let s=g.constructor;G=new s(D);for(let w=0;w<D;w++)G[w]=g[w*i+o]}for(let s=0;s<A;s++){let w=Q[s],e=Q[s+1]||D,c=G.subarray(w,e);t[s]=String.fromCodePoint.apply(null,c),a&&c.forEach(a.add,a)}if(a)for(let s of a)C.add(String.fromCodePoint(s));return{texts:t,characterCount:D}}var xo=class{constructor(A=5){this._cache={},this._order=[],this.limit=A}get(A){let I=this._cache[A];return I&&(this._deleteOrder(A),this._appendOrder(A)),I}set(A,I){this._cache[A]?(this.delete(A),this._cache[A]=I,this._appendOrder(A)):(Object.keys(this._cache).length===this.limit&&this.delete(this._order[0]),this._cache[A]=I,this._appendOrder(A))}delete(A){this._cache[A]&&(delete this._cache[A],this._deleteOrder(A))}_deleteOrder(A){let I=this._order.indexOf(A);I>=0&&this._order.splice(I,1)}_appendOrder(A){this._order.push(A)}};function P9(){let g=[];for(let A=32;A<128;A++)g.push(String.fromCharCode(A));return g}var ai={fontFamily:"Monaco, monospace",fontWeight:"normal",characterSet:P9(),fontSize:64,buffer:4,sdf:!1,cutoff:.25,radius:12,smoothing:.1},IS=1024,BS=.9,QS=1.2,ES=3,Me=new xo(ES);function V9(g,A){let I;typeof A=="string"?I=new Set(Array.from(A)):I=new Set(A);let B=Me.get(g);if(!B)return I;for(let Q in B.mapping)I.has(Q)&&I.delete(Q);return I}function O9(g,A){for(let I=0;I<g.length;I++)A.data[4*I+3]=g[I]}function CS(g,A,I,B){g.font=`${B} ${I}px ${A}`,g.fillStyle="#000",g.textBaseline="alphabetic",g.textAlign="left"}function iS(g){X.assert(Number.isFinite(g)&&g>=ES,"Invalid cache limit"),Me=new xo(g)}var vt=class{constructor(){this.props={...ai}}get atlas(){return this._atlas}get mapping(){return this._atlas&&this._atlas.mapping}get scale(){let{fontSize:A,buffer:I}=this.props;return(A*QS+I*2)/A}setProps(A={}){Object.assign(this.props,A),this._key=this._getKey();let I=V9(this._key,this.props.characterSet),B=Me.get(this._key);if(B&&I.size===0){this._atlas!==B&&(this._atlas=B);return}let Q=this._generateFontAtlas(I,B);this._atlas=Q,Me.set(this._key,Q)}_generateFontAtlas(A,I){let{fontFamily:B,fontWeight:Q,fontSize:C,buffer:E,sdf:i,radius:o,cutoff:D}=this.props,a=I&&I.data;a||(a=document.createElement("canvas"),a.width=IS);let t=a.getContext("2d",{willReadFrequently:!0});CS(t,B,C,Q);let{mapping:G,canvasHeight:s,xOffset:w,yOffset:e}=vH({getFontWidth:c=>t.measureText(c).width,fontHeight:C*QS,buffer:E,characterSet:A,maxCanvasWidth:IS,...I&&{mapping:I.mapping,xOffset:I.xOffset,yOffset:I.yOffset}});if(a.height!==s){let c=t.getImageData(0,0,a.width,a.height);a.height=s,t.putImageData(c,0,0)}if(CS(t,B,C,Q),i){let c=new zt({fontSize:C,buffer:E,radius:o,cutoff:D,fontFamily:B,fontWeight:`${Q}`});for(let h of A){let{data:R,width:N,height:y,glyphTop:r}=c.draw(h);G[h].width=N,G[h].layoutOffsetY=C*BS-r;let J=t.createImageData(N,y);O9(R,J),t.putImageData(J,G[h].x,G[h].y)}}else for(let c of A)t.fillText(c,G[c].x,G[c].y+E+C*BS);return{xOffset:w,yOffset:e,mapping:G,data:a,width:a.width,height:a.height}}_getKey(){let{fontFamily:A,fontWeight:I,fontSize:B,buffer:Q,sdf:C,radius:E,cutoff:i}=this.props;return C?`${A} ${I} ${B} ${Q} ${E} ${i}`:`${A} ${I} ${B} ${Q}`}};var oS=`#version 300 es
|
|
1599
1599
|
#define SHADER_NAME text-background-layer-vertex-shader
|
|
1600
1600
|
in vec2 positions;
|
|
1601
1601
|
in vec3 instancePositions;
|
|
@@ -1684,7 +1684,7 @@ fragColor = vFillColor;
|
|
|
1684
1684
|
}
|
|
1685
1685
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
1686
1686
|
}
|
|
1687
|
-
`;var jX={billboard:!0,sizeScale:1,sizeUnits:"pixels",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,padding:{type:"array",value:[0,0,0,0]},getPosition:{type:"accessor",value:g=>g.position},getSize:{type:"accessor",value:1},getAngle:{type:"accessor",value:0},getPixelOffset:{type:"accessor",value:[0,0]},getBoundingRect:{type:"accessor",value:[0,0,0,0]},getFillColor:{type:"accessor",value:[0,0,0,255]},getLineColor:{type:"accessor",value:[0,0,0,255]},getLineWidth:{type:"accessor",value:1}},_t=class extends Og{getShaders(){return super.getShaders({vs:oS,fs:DS,modules:[AI,II]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceSizes:{size:1,transition:!0,accessor:"getSize",defaultValue:1},instanceAngles:{size:1,transition:!0,accessor:"getAngle"},instanceRects:{size:4,accessor:"getBoundingRect"},instancePixelOffsets:{size:2,transition:!0,accessor:"getPixelOffset"},instanceFillColors:{size:4,transition:!0,type:"unorm8",accessor:"getFillColor",defaultValue:[0,0,0,255]},instanceLineColors:{size:4,transition:!0,type:"unorm8",accessor:"getLineColor",defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:!0,accessor:"getLineWidth",defaultValue:1}})}updateState(A){super.updateState(A);let{changeFlags:I}=A;I.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw({uniforms:A}){let{billboard:I,sizeScale:B,sizeUnits:Q,sizeMinPixels:C,sizeMaxPixels:E,getLineWidth:i}=this.props,{padding:o}=this.props;o.length<4&&(o=[o[0],o[1],o[0],o[1]]);let D=this.state.model;D.setUniforms(A),D.setUniforms({billboard:I,stroked:!!i,padding:o,sizeUnits:GI[Q],sizeScale:B,sizeMinPixels:C,sizeMaxPixels:E}),D.draw(this.context.renderPass)}_getModel(){let A=[0,0,1,0,1,1,0,1];return new cg(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new sI({topology:"triangle-fan-webgl",vertexCount:4,attributes:{positions:{size:2,value:new Float32Array(A)}}}),isInstanced:!0})}};_t.defaultProps=jX;_t.layerName="TextBackgroundLayer";var aS=_t;var tS={start:1,middle:0,end:-1},GS={top:1,center:0,bottom:-1},kr=[0,0,0,255],XX=1,zX={billboard:!0,sizeScale:1,sizeUnits:"pixels",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,background:!1,getBackgroundColor:{type:"accessor",value:[255,255,255,255]},getBorderColor:{type:"accessor",value:kr},getBorderWidth:{type:"accessor",value:0},backgroundPadding:{type:"array",value:[0,0,0,0]},characterSet:{type:"object",value:ai.characterSet},fontFamily:ai.fontFamily,fontWeight:ai.fontWeight,lineHeight:XX,outlineWidth:{type:"number",value:0,min:0},outlineColor:{type:"color",value:kr},fontSettings:{type:"object",value:{},compare:1},wordBreak:"break-word",maxWidth:{type:"number",value:-1},getText:{type:"accessor",value:g=>g.text},getPosition:{type:"accessor",value:g=>g.position},getColor:{type:"accessor",value:kr},getSize:{type:"accessor",value:32},getAngle:{type:"accessor",value:0},getTextAnchor:{type:"accessor",value:"middle"},getAlignmentBaseline:{type:"accessor",value:"center"},getPixelOffset:{type:"accessor",value:[0,0]},backgroundColor:{deprecatedFor:["background","getBackgroundColor"]}},$t=class extends wQ{constructor(){super(...arguments),this.getBoundingRect=(A,I)=>{let{size:[B,Q]}=this.transformParagraph(A,I),{fontSize:C}=this.state.fontAtlasManager.props;B/=C,Q/=C;let{getTextAnchor:E,getAlignmentBaseline:i}=this.props,o=tS[typeof E=="function"?E(A,I):E],D=GS[typeof i=="function"?i(A,I):i];return[(o-1)*B/2,(D-1)*Q/2,B,Q]},this.getIconOffsets=(A,I)=>{let{getTextAnchor:B,getAlignmentBaseline:Q}=this.props,{x:C,y:E,rowWidth:i,size:[o,D]}=this.transformParagraph(A,I),a=tS[typeof B=="function"?B(A,I):B],t=GS[typeof Q=="function"?Q(A,I):Q],G=C.length,s=new Array(G*2),w=0;for(let e=0;e<G;e++){let c=(1-a)*(o-i[e])/2;s[w++]=(a-1)*o/2+c+C[e],s[w++]=(t-1)*D/2+E[e]}return s}}initializeState(){this.state={styleVersion:0,fontAtlasManager:new vt},this.props.maxWidth>0&&X.warn("v8.9 breaking change: TextLayer maxWidth is now relative to text size")()}updateState(A){let{props:I,oldProps:B,changeFlags:Q}=A;(Q.dataChanged||Q.updateTriggersChanged&&(Q.updateTriggersChanged.all||Q.updateTriggersChanged.getText))&&this._updateText(),(this._updateFontAtlas()||I.lineHeight!==B.lineHeight||I.wordBreak!==B.wordBreak||I.maxWidth!==B.maxWidth)&&this.setState({styleVersion:this.state.styleVersion+1})}getPickingInfo({info:A}){return A.object=A.index>=0?this.props.data[A.index]:null,A}_updateFontAtlas(){let{fontSettings:A,fontFamily:I,fontWeight:B}=this.props,{fontAtlasManager:Q,characterSet:C}=this.state,E={...A,characterSet:C,fontFamily:I,fontWeight:B};if(!Q.mapping)return Q.setProps(E),!0;for(let i in E)if(E[i]!==Q.props[i])return Q.setProps(E),!0;return!1}_updateText(){let{data:A,characterSet:I}=this.props,B=A.attributes?.getText,{getText:Q}=this.props,C=A.startIndices,E,i=I==="auto"&&new Set;if(B&&C){let{texts:o,characterCount:D}=gS({...ArrayBuffer.isView(B)?{value:B}:B,length:A.length,startIndices:C,characterSet:i});E=D,Q=(a,{index:t})=>o[t]}else{let{iterable:o,objectInfo:D}=gB(A);C=[0],E=0;for(let a of o){D.index++;let t=Array.from(Q(a,D)||"");i&&t.forEach(i.add,i),E+=t.length,C.push(E)}}this.setState({getText:Q,startIndices:C,numInstances:E,characterSet:i||I})}transformParagraph(A,I){let{fontAtlasManager:B}=this.state,Q=B.mapping,C=this.state.getText,{wordBreak:E,lineHeight:i,maxWidth:o}=this.props,D=C(A,I)||"";return AS(D,i,E,o*B.props.fontSize,Q)}renderLayers(){let{startIndices:A,numInstances:I,getText:B,fontAtlasManager:{scale:Q,atlas:C,mapping:E},styleVersion:i}=this.state,{data:o,_dataDiff:D,getPosition:a,getColor:t,getSize:G,getAngle:s,getPixelOffset:w,getBackgroundColor:e,getBorderColor:c,getBorderWidth:h,backgroundPadding:R,background:N,billboard:y,fontSettings:r,outlineWidth:J,outlineColor:q,sizeScale:H,sizeUnits:d,sizeMinPixels:K,sizeMaxPixels:x,transitions:W,updateTriggers:u}=this.props,m=this.getSubLayerClass("characters",jH),_=this.getSubLayerClass("background",aS);return[N&&new _({getFillColor:e,getLineColor:c,getLineWidth:h,padding:R,getPosition:a,getSize:G,getAngle:s,getPixelOffset:w,billboard:y,sizeScale:H,sizeUnits:d,sizeMinPixels:K,sizeMaxPixels:x,transitions:W&&{getPosition:W.getPosition,getAngle:W.getAngle,getSize:W.getSize,getFillColor:W.getBackgroundColor,getLineColor:W.getBorderColor,getLineWidth:W.getBorderWidth,getPixelOffset:W.getPixelOffset}},this.getSubLayerProps({id:"background",updateTriggers:{getPosition:u.getPosition,getAngle:u.getAngle,getSize:u.getSize,getFillColor:u.getBackgroundColor,getLineColor:u.getBorderColor,getLineWidth:u.getBorderWidth,getPixelOffset:u.getPixelOffset,getBoundingRect:{getText:u.getText,getTextAnchor:u.getTextAnchor,getAlignmentBaseline:u.getAlignmentBaseline,styleVersion:i}}}),{data:o.attributes&&o.attributes.background?{length:o.length,attributes:o.attributes.background}:o,_dataDiff:D,autoHighlight:!1,getBoundingRect:this.getBoundingRect}),new m({sdf:r.sdf,smoothing:Number.isFinite(r.smoothing)?r.smoothing:ai.smoothing,outlineWidth:J/(r.radius||ai.radius),outlineColor:q,iconAtlas:C,iconMapping:E,getPosition:a,getColor:t,getSize:G,getAngle:s,getPixelOffset:w,billboard:y,sizeScale:H*Q,sizeUnits:d,sizeMinPixels:K*Q,sizeMaxPixels:x*Q,transitions:W&&{getPosition:W.getPosition,getAngle:W.getAngle,getColor:W.getColor,getSize:W.getSize,getPixelOffset:W.getPixelOffset}},this.getSubLayerProps({id:"characters",updateTriggers:{all:u.getText,getPosition:u.getPosition,getAngle:u.getAngle,getColor:u.getColor,getSize:u.getSize,getPixelOffset:u.getPixelOffset,getIconOffsets:{getTextAnchor:u.getTextAnchor,getAlignmentBaseline:u.getAlignmentBaseline,styleVersion:i}}}),{data:o,_dataDiff:D,startIndices:A,numInstances:I,getIconOffsets:this.getIconOffsets,getIcon:B})]}static set fontAtlasCacheLimit(A){iS(A)}};$t.defaultProps=zX;$t.layerName="TextLayer";var ti=$t;var AG={circle:{type:BB,props:{filled:"filled",stroked:"stroked",lineWidthMaxPixels:"lineWidthMaxPixels",lineWidthMinPixels:"lineWidthMinPixels",lineWidthScale:"lineWidthScale",lineWidthUnits:"lineWidthUnits",pointRadiusMaxPixels:"radiusMaxPixels",pointRadiusMinPixels:"radiusMinPixels",pointRadiusScale:"radiusScale",pointRadiusUnits:"radiusUnits",pointAntialiasing:"antialiasing",pointBillboard:"billboard",getFillColor:"getFillColor",getLineColor:"getLineColor",getLineWidth:"getLineWidth",getPointRadius:"getRadius"}},icon:{type:Lt,props:{iconAtlas:"iconAtlas",iconMapping:"iconMapping",iconSizeMaxPixels:"sizeMaxPixels",iconSizeMinPixels:"sizeMinPixels",iconSizeScale:"sizeScale",iconSizeUnits:"sizeUnits",iconAlphaCutoff:"alphaCutoff",iconBillboard:"billboard",getIcon:"getIcon",getIconAngle:"getAngle",getIconColor:"getColor",getIconPixelOffset:"getPixelOffset",getIconSize:"getSize"}},text:{type:ti,props:{textSizeMaxPixels:"sizeMaxPixels",textSizeMinPixels:"sizeMinPixels",textSizeScale:"sizeScale",textSizeUnits:"sizeUnits",textBackground:"background",textBackgroundPadding:"backgroundPadding",textFontFamily:"fontFamily",textFontWeight:"fontWeight",textLineHeight:"lineHeight",textMaxWidth:"maxWidth",textOutlineColor:"outlineColor",textOutlineWidth:"outlineWidth",textWordBreak:"wordBreak",textCharacterSet:"characterSet",textBillboard:"billboard",textFontSettings:"fontSettings",getText:"getText",getTextAngle:"getAngle",getTextColor:"getColor",getTextPixelOffset:"getPixelOffset",getTextSize:"getSize",getTextAnchor:"getTextAnchor",getTextAlignmentBaseline:"getAlignmentBaseline",getTextBackgroundColor:"getBackgroundColor",getTextBorderColor:"getBorderColor",getTextBorderWidth:"getBorderWidth"}}},gG={type:QE,props:{lineWidthUnits:"widthUnits",lineWidthScale:"widthScale",lineWidthMinPixels:"widthMinPixels",lineWidthMaxPixels:"widthMaxPixels",lineJointRounded:"jointRounded",lineCapRounded:"capRounded",lineMiterLimit:"miterLimit",lineBillboard:"billboard",getLineColor:"getColor",getLineWidth:"getWidth"}},Je={type:EE,props:{extruded:"extruded",filled:"filled",wireframe:"wireframe",elevationScale:"elevationScale",material:"material",_full3d:"_full3d",getElevation:"getElevation",getFillColor:"getFillColor",getLineColor:"getLineColor"}};function uo({type:g,props:A}){let I={};for(let B in A)I[B]=g.defaultProps[A[B]];return I}function Ye(g,A){let{transitions:I,updateTriggers:B}=g.props,Q={updateTriggers:{},transitions:I&&{getPosition:I.geometry}};for(let C in A){let E=A[C],i=g.props[C];C.startsWith("get")&&(i=g.getSubLayerAccessor(i),Q.updateTriggers[E]=B[C],I&&(Q.transitions[E]=I[C])),Q[E]=i}return Q}function wS(g){if(Array.isArray(g))return g;switch(X.assert(g.type,"GeoJSON does not have type"),g.type){case"Feature":return[g];case"FeatureCollection":return X.assert(Array.isArray(g.features),"GeoJSON does not have features array"),g.features;default:return[{geometry:g}]}}function hr(g,A,I={}){let B={pointFeatures:[],lineFeatures:[],polygonFeatures:[],polygonOutlineFeatures:[]},{startRow:Q=0,endRow:C=g.length}=I;for(let E=Q;E<C;E++){let i=g[E],{geometry:o}=i;if(o)if(o.type==="GeometryCollection"){X.assert(Array.isArray(o.geometries),"GeoJSON does not have geometries array");let{geometries:D}=o;for(let a=0;a<D.length;a++){let t=D[a];sS(t,B,A,i,E)}}else sS(o,B,A,i,E)}return B}function sS(g,A,I,B,Q){let{type:C,coordinates:E}=g,{pointFeatures:i,lineFeatures:o,polygonFeatures:D,polygonOutlineFeatures:a}=A;if(!_X(C,E)){X.warn(`${C} coordinates are malformed`)();return}switch(C){case"Point":i.push(I({geometry:g},B,Q));break;case"MultiPoint":E.forEach(t=>{i.push(I({geometry:{type:"Point",coordinates:t}},B,Q))});break;case"LineString":o.push(I({geometry:g},B,Q));break;case"MultiLineString":E.forEach(t=>{o.push(I({geometry:{type:"LineString",coordinates:t}},B,Q))});break;case"Polygon":D.push(I({geometry:g},B,Q)),E.forEach(t=>{a.push(I({geometry:{type:"LineString",coordinates:t}},B,Q))});break;case"MultiPolygon":E.forEach(t=>{D.push(I({geometry:{type:"Polygon",coordinates:t}},B,Q)),t.forEach(G=>{a.push(I({geometry:{type:"LineString",coordinates:G}},B,Q))})});break;default:}}var vX={Point:1,MultiPoint:2,LineString:2,MultiLineString:3,Polygon:3,MultiPolygon:4};function _X(g,A){let I=vX[g];for(X.assert(I,`Unknown GeoJSON type ${g}`);A&&--I>0;)A=A[0];return A&&Number.isFinite(A[0])}function cS(){return{points:{},lines:{},polygons:{},polygonsOutline:{}}}function Ke(g){return g.geometry.coordinates}function eS(g,A){let I=cS(),{pointFeatures:B,lineFeatures:Q,polygonFeatures:C,polygonOutlineFeatures:E}=g;return I.points.data=B,I.points._dataDiff=A.pointFeatures&&(()=>A.pointFeatures),I.points.getPosition=Ke,I.lines.data=Q,I.lines._dataDiff=A.lineFeatures&&(()=>A.lineFeatures),I.lines.getPath=Ke,I.polygons.data=C,I.polygons._dataDiff=A.polygonFeatures&&(()=>A.polygonFeatures),I.polygons.getPolygon=Ke,I.polygonsOutline.data=E,I.polygonsOutline._dataDiff=A.polygonOutlineFeatures&&(()=>A.polygonOutlineFeatures),I.polygonsOutline.getPath=Ke,I}function NS(g,A){let I=cS(),{points:B,lines:Q,polygons:C}=g,E=PH(g,A);return I.points.data={length:B.positions.value.length/B.positions.size,attributes:{...B.attributes,getPosition:B.positions,instancePickingColors:{size:3,value:E.points}},properties:B.properties,numericProps:B.numericProps,featureIds:B.featureIds},I.lines.data={length:Q.pathIndices.value.length-1,startIndices:Q.pathIndices.value,attributes:{...Q.attributes,getPath:Q.positions,instancePickingColors:{size:3,value:E.lines}},properties:Q.properties,numericProps:Q.numericProps,featureIds:Q.featureIds},I.lines._pathType="open",I.polygons.data={length:C.polygonIndices.value.length-1,startIndices:C.polygonIndices.value,attributes:{...C.attributes,getPolygon:C.positions,pickingColors:{size:3,value:E.polygons}},properties:C.properties,numericProps:C.numericProps,featureIds:C.featureIds},I.polygons._normalize=!1,C.triangles&&(I.polygons.data.attributes.indices=C.triangles.value),I.polygonsOutline.data={length:C.primitivePolygonIndices.value.length-1,startIndices:C.primitivePolygonIndices.value,attributes:{...C.attributes,getPath:C.positions,instancePickingColors:{size:3,value:E.polygons}},properties:C.properties,numericProps:C.numericProps,featureIds:C.featureIds},I.polygonsOutline._pathType="open",I}var $X=["points","linestrings","polygons"],A9={...uo(AG.circle),...uo(AG.icon),...uo(AG.text),...uo(gG),...uo(Je),stroked:!0,filled:!0,extruded:!1,wireframe:!1,_full3d:!1,iconAtlas:{type:"object",value:null},iconMapping:{type:"object",value:{}},getIcon:{type:"accessor",value:g=>g.properties.icon},getText:{type:"accessor",value:g=>g.properties.text},pointType:"circle",getRadius:{deprecatedFor:"getPointRadius"}},IG=class extends wQ{initializeState(){this.state={layerProps:{},features:{},featuresDiff:{}}}updateState({props:A,changeFlags:I}){if(!I.dataChanged)return;let{data:B}=this.props,Q=B&&"points"in B&&"polygons"in B&&"lines"in B;this.setState({binary:Q}),Q?this._updateStateBinary({props:A,changeFlags:I}):this._updateStateJSON({props:A,changeFlags:I})}_updateStateBinary({props:A,changeFlags:I}){let B=NS(A.data,this.encodePickingColor);this.setState({layerProps:B})}_updateStateJSON({props:A,changeFlags:I}){let B=wS(A.data),Q=this.getSubLayerRow.bind(this),C={},E={};if(Array.isArray(I.dataChanged)){let o=this.state.features;for(let D in o)C[D]=o[D].slice(),E[D]=[];for(let D of I.dataChanged){let a=hr(B,Q,D);for(let t in o)E[t].push(ne({data:C[t],getIndex:G=>G.__source.index,dataRange:D,replace:a[t]}))}}else C=hr(B,Q);let i=eS(C,E);this.setState({features:C,featuresDiff:E,layerProps:i})}getPickingInfo(A){let I=super.getPickingInfo(A),{index:B,sourceLayer:Q}=I;return I.featureType=$X.find(C=>Q.id.startsWith(`${this.id}-${C}-`)),B>=0&&Q.id.startsWith(`${this.id}-points-text`)&&this.state.binary&&(I.index=this.props.data.points.globalFeatureIds.value[B]),I}_updateAutoHighlight(A){let I=`${this.id}-points-`,B=A.featureType==="points";for(let Q of this.getSubLayers())Q.id.startsWith(I)===B&&Q.updateAutoHighlight(A)}_renderPolygonLayer(){let{extruded:A,wireframe:I}=this.props,{layerProps:B}=this.state,Q="polygons-fill",C=this.shouldRenderSubLayer(Q,B.polygons?.data)&&this.getSubLayerClass(Q,Je.type);if(C){let E=Ye(this,Je.props),i=A&&I;return i||delete E.getLineColor,E.updateTriggers.lineColors=i,new C(E,this.getSubLayerProps({id:Q,updateTriggers:E.updateTriggers}),B.polygons)}return null}_renderLineLayers(){let{extruded:A,stroked:I}=this.props,{layerProps:B}=this.state,Q="polygons-stroke",C="linestrings",E=!A&&I&&this.shouldRenderSubLayer(Q,B.polygonsOutline?.data)&&this.getSubLayerClass(Q,gG.type),i=this.shouldRenderSubLayer(C,B.lines?.data)&&this.getSubLayerClass(C,gG.type);if(E||i){let o=Ye(this,gG.props);return[E&&new E(o,this.getSubLayerProps({id:Q,updateTriggers:o.updateTriggers}),B.polygonsOutline),i&&new i(o,this.getSubLayerProps({id:C,updateTriggers:o.updateTriggers}),B.lines)]}return null}_renderPointLayers(){let{pointType:A}=this.props,{layerProps:I,binary:B}=this.state,{highlightedObjectIndex:Q}=this.props;!B&&Number.isFinite(Q)&&(Q=I.points.data.findIndex(i=>i.__source.index===Q));let C=new Set(A.split("+")),E=[];for(let i of C){let o=`points-${i}`,D=AG[i],a=D&&this.shouldRenderSubLayer(o,I.points?.data)&&this.getSubLayerClass(o,D.type);if(a){let t=Ye(this,D.props),G=I.points;if(i==="text"&&B){let{instancePickingColors:s,...w}=G.data.attributes;G={...G,data:{...G.data,attributes:w}}}E.push(new a(t,this.getSubLayerProps({id:o,updateTriggers:t.updateTriggers,highlightedObjectIndex:Q}),G))}}return E}renderLayers(){let{extruded:A}=this.props,I=this._renderPolygonLayer(),B=this._renderLineLayers(),Q=this._renderPointLayers();return[!A&&I,B,Q,A&&I]}getSubLayerAccessor(A){let{binary:I}=this.state;return!I||typeof A!="function"?super.getSubLayerAccessor(A):(B,Q)=>{let{data:C,index:E}=Q,i=TH(C,E);return A(i,Q)}}};IG.layerName="GeoJsonLayer";IG.defaultProps=A9;var qe=IG;var Ue=class{constructor(A){this.index=A,this.isVisible=!1,this.isSelected=!1,this.parent=null,this.children=[],this.content=null,this._loader=void 0,this._abortController=null,this._loaderId=0,this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1}get bbox(){return this._bbox}set bbox(A){this._bbox||(this._bbox=A,"west"in A?this.boundingBox=[[A.west,A.south],[A.east,A.north]]:this.boundingBox=[[A.left,A.top],[A.right,A.bottom]])}get data(){return this.isLoading&&this._loader?this._loader.then(()=>this.data):this.content}get isLoaded(){return this._isLoaded&&!this._needsReload}get isLoading(){return!!this._loader&&!this._isCancelled}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){let A=this.content?this.content.byteLength:0;return Number.isFinite(A)||console.error("byteLength not defined in tile data"),A}async _loadData({getData:A,requestScheduler:I,onLoad:B,onError:Q}){let{index:C,id:E,bbox:i,userData:o,zoom:D}=this,a=this._loaderId;this._abortController=new AbortController;let{signal:t}=this._abortController,G=await I.scheduleRequest(this,e=>e.isSelected?1:-1);if(!G){this._isCancelled=!0;return}if(this._isCancelled){G.done();return}let s=null,w;try{s=await A({index:C,id:E,bbox:i,userData:o,zoom:D,signal:t})}catch(e){w=e||!0}finally{G.done()}if(a===this._loaderId){if(this._loader=void 0,this.content=s,this._isCancelled&&!s){this._isLoaded=!1;return}this._isLoaded=!0,this._isCancelled=!1,w?Q(w,this):B(this)}}loadData(A){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(A),this._loader}setNeedsReload(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}abort(){this.isLoaded||(this._isCancelled=!0,this._abortController?.abort())}};var ag={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var xyA=1/Math.PI*180,uyA=1/180*Math.PI,g9={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...g9}};var tg=globalThis.mathgl.config;function Fr(g,{precision:A=tg.precision}={}){return g=I9(g),`${parseFloat(g.toPrecision(A))}`}function zQ(g){return Array.isArray(g)||ArrayBuffer.isView(g)&&!(g instanceof DataView)}function iE(g,A,I){let B=tg.EPSILON;I&&(tg.EPSILON=I);try{if(g===A)return!0;if(zQ(g)&&zQ(A)){if(g.length!==A.length)return!1;for(let Q=0;Q<g.length;++Q)if(!iE(g[Q],A[Q]))return!1;return!0}return g&&g.equals?g.equals(A):A&&A.equals?A.equals(g):typeof g=="number"&&typeof A=="number"?Math.abs(g-A)<=tg.EPSILON*Math.max(1,Math.abs(g),Math.abs(A)):!1}finally{tg.EPSILON=B}}function I9(g){return Math.round(g/tg.EPSILON)*tg.EPSILON}var oE=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(A,I=0){for(let B=0;B<this.ELEMENTS;++B)this[B]=A[B+I];return this.check()}toArray(A=[],I=0){for(let B=0;B<this.ELEMENTS;++B)A[I+B]=this[B];return A}toObject(A){return A}from(A){return Array.isArray(A)?this.copy(A):this.fromObject(A)}to(A){return A===this?this:zQ(A)?this.toArray(A):this.toObject(A)}toTarget(A){return A?this.to(A):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(tg)}formatString(A){let I="";for(let B=0;B<this.ELEMENTS;++B)I+=(B>0?", ":"")+Fr(this[B],A);return`${A.printTypes?this.constructor.name:""}[${I}]`}equals(A){if(!A||this.length!==A.length)return!1;for(let I=0;I<this.ELEMENTS;++I)if(!iE(this[I],A[I]))return!1;return!0}exactEquals(A){if(!A||this.length!==A.length)return!1;for(let I=0;I<this.ELEMENTS;++I)if(this[I]!==A[I])return!1;return!0}negate(){for(let A=0;A<this.ELEMENTS;++A)this[A]=-this[A];return this.check()}lerp(A,I,B){if(B===void 0)return this.lerp(this,A,I);for(let Q=0;Q<this.ELEMENTS;++Q){let C=A[Q],E=typeof I=="number"?I:I[Q];this[Q]=C+B*(E-C)}return this.check()}min(A){for(let I=0;I<this.ELEMENTS;++I)this[I]=Math.min(A[I],this[I]);return this.check()}max(A){for(let I=0;I<this.ELEMENTS;++I)this[I]=Math.max(A[I],this[I]);return this.check()}clamp(A,I){for(let B=0;B<this.ELEMENTS;++B)this[B]=Math.min(Math.max(this[B],A[B]),I[B]);return this.check()}add(...A){for(let I of A)for(let B=0;B<this.ELEMENTS;++B)this[B]+=I[B];return this.check()}subtract(...A){for(let I of A)for(let B=0;B<this.ELEMENTS;++B)this[B]-=I[B];return this.check()}scale(A){if(typeof A=="number")for(let I=0;I<this.ELEMENTS;++I)this[I]*=A;else for(let I=0;I<this.ELEMENTS&&I<A.length;++I)this[I]*=A[I];return this.check()}multiplyByScalar(A){for(let I=0;I<this.ELEMENTS;++I)this[I]*=A;return this.check()}check(){if(tg.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let A=this.length===this.ELEMENTS;for(let I=0;I<this.ELEMENTS;++I)A=A&&Number.isFinite(this[I]);return A}sub(A){return this.subtract(A)}setScalar(A){for(let I=0;I<this.ELEMENTS;++I)this[I]=A;return this.check()}addScalar(A){for(let I=0;I<this.ELEMENTS;++I)this[I]+=A;return this.check()}subScalar(A){return this.addScalar(-A)}multiplyScalar(A){for(let I=0;I<this.ELEMENTS;++I)this[I]*=A;return this.check()}divideScalar(A){return this.multiplyByScalar(1/A)}clampScalar(A,I){for(let B=0;B<this.ELEMENTS;++B)this[B]=Math.min(Math.max(this[B],A),I);return this.check()}get elements(){return this}};function B9(g,A){if(g.length!==A)return!1;for(let I=0;I<g.length;++I)if(!Number.isFinite(g[I]))return!1;return!0}function UA(g){if(!Number.isFinite(g))throw new Error(`Invalid number ${JSON.stringify(g)}`);return g}function He(g,A,I=""){if(tg.debug&&!B9(g,A))throw new Error(`math.gl: ${I} some fields set to invalid numbers'`);return g}function cQ(g,A){if(!g)throw new Error(`math.gl assertion ${A}`)}var Wo=class extends oE{get x(){return this[0]}set x(A){this[0]=UA(A)}get y(){return this[1]}set y(A){this[1]=UA(A)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let A=0;for(let I=0;I<this.ELEMENTS;++I)A+=this[I]*this[I];return A}magnitudeSquared(){return this.lengthSquared()}distance(A){return Math.sqrt(this.distanceSquared(A))}distanceSquared(A){let I=0;for(let B=0;B<this.ELEMENTS;++B){let Q=this[B]-A[B];I+=Q*Q}return UA(I)}dot(A){let I=0;for(let B=0;B<this.ELEMENTS;++B)I+=this[B]*A[B];return UA(I)}normalize(){let A=this.magnitude();if(A!==0)for(let I=0;I<this.ELEMENTS;++I)this[I]/=A;return this.check()}multiply(...A){for(let I of A)for(let B=0;B<this.ELEMENTS;++B)this[B]*=I[B];return this.check()}divide(...A){for(let I of A)for(let B=0;B<this.ELEMENTS;++B)this[B]/=I[B];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(A){return this.distance(A)}distanceToSquared(A){return this.distanceSquared(A)}getComponent(A){return cQ(A>=0&&A<this.ELEMENTS,"index is out of range"),UA(this[A])}setComponent(A,I){return cQ(A>=0&&A<this.ELEMENTS,"index is out of range"),this[A]=I,this.check()}addVectors(A,I){return this.copy(A).add(I)}subVectors(A,I){return this.copy(A).subtract(I)}multiplyVectors(A,I){return this.copy(A).multiply(I)}addScaledVector(A,I){return this.add(new this.constructor(A).multiplyScalar(I))}};var gg=typeof Float32Array<"u"?Float32Array:Array;var vyA=Math.PI/180;function Q9(){let g=new gg(2);return gg!=Float32Array&&(g[0]=0,g[1]=0),g}function FS(g,A,I){let B=A[0],Q=A[1];return g[0]=I[0]*B+I[3]*Q+I[6],g[1]=I[1]*B+I[4]*Q+I[7],g}var _yA=function(){let g=Q9();return function(A,I,B,Q,C,E){let i,o;for(I||(I=2),B||(B=0),Q?o=Math.min(Q*I+B,A.length):o=A.length,i=B;i<o;i+=I)g[0]=A[i],g[1]=A[i+1],C(g,g,E),A[i]=g[0],A[i+1]=g[1];return A}}();function yS(g,A,I){let B=A[0],Q=A[1],C=A[2],E=I[3]*B+I[7]*Q+I[11]*C||1;return g[0]=(I[0]*B+I[4]*Q+I[8]*C)/E,g[1]=(I[1]*B+I[5]*Q+I[9]*C)/E,g[2]=(I[2]*B+I[6]*Q+I[10]*C)/E,g}function rS(g,A,I){let B=A[0],Q=A[1];return g[0]=I[0]*B+I[2]*Q,g[1]=I[1]*B+I[3]*Q,g[2]=A[2],g}function nS(g,A,I){let B=A[0],Q=A[1];return g[0]=I[0]*B+I[2]*Q,g[1]=I[1]*B+I[3]*Q,g[2]=A[2],g[3]=A[3],g}function Se(g,A,I){let B=A[0],Q=A[1],C=A[2];return g[0]=I[0]*B+I[3]*Q+I[6]*C,g[1]=I[1]*B+I[4]*Q+I[7]*C,g[2]=I[2]*B+I[5]*Q+I[8]*C,g[3]=A[3],g}function yr(){let g=new gg(3);return gg!=Float32Array&&(g[0]=0,g[1]=0,g[2]=0),g}function E9(g){let A=g[0],I=g[1],B=g[2];return Math.sqrt(A*A+I*I+B*B)}function rr(g,A,I){let B=new gg(3);return B[0]=g,B[1]=A,B[2]=I,B}function RS(g,A){let I=A[0],B=A[1],Q=A[2],C=I*I+B*B+Q*Q;return C>0&&(C=1/Math.sqrt(C)),g[0]=A[0]*C,g[1]=A[1]*C,g[2]=A[2]*C,g}function nr(g,A){return g[0]*A[0]+g[1]*A[1]+g[2]*A[2]}function Zo(g,A,I){let B=A[0],Q=A[1],C=A[2],E=I[0],i=I[1],o=I[2];return g[0]=Q*o-C*i,g[1]=C*E-B*o,g[2]=B*i-Q*E,g}function Le(g,A,I){let B=A[0],Q=A[1],C=A[2],E=I[3]*B+I[7]*Q+I[11]*C+I[15];return E=E||1,g[0]=(I[0]*B+I[4]*Q+I[8]*C+I[12])/E,g[1]=(I[1]*B+I[5]*Q+I[9]*C+I[13])/E,g[2]=(I[2]*B+I[6]*Q+I[10]*C+I[14])/E,g}function de(g,A,I){let B=A[0],Q=A[1],C=A[2];return g[0]=B*I[0]+Q*I[3]+C*I[6],g[1]=B*I[1]+Q*I[4]+C*I[7],g[2]=B*I[2]+Q*I[5]+C*I[8],g}function pe(g,A,I){let B=I[0],Q=I[1],C=I[2],E=I[3],i=A[0],o=A[1],D=A[2],a=Q*D-C*o,t=C*i-B*D,G=B*o-Q*i,s=Q*G-C*t,w=C*a-B*G,e=B*t-Q*a,c=E*2;return a*=c,t*=c,G*=c,s*=2,w*=2,e*=2,g[0]=i+a+s,g[1]=o+t+w,g[2]=D+G+e,g}function MS(g,A,I,B){let Q=[],C=[];return Q[0]=A[0]-I[0],Q[1]=A[1]-I[1],Q[2]=A[2]-I[2],C[0]=Q[0],C[1]=Q[1]*Math.cos(B)-Q[2]*Math.sin(B),C[2]=Q[1]*Math.sin(B)+Q[2]*Math.cos(B),g[0]=C[0]+I[0],g[1]=C[1]+I[1],g[2]=C[2]+I[2],g}function JS(g,A,I,B){let Q=[],C=[];return Q[0]=A[0]-I[0],Q[1]=A[1]-I[1],Q[2]=A[2]-I[2],C[0]=Q[2]*Math.sin(B)+Q[0]*Math.cos(B),C[1]=Q[1],C[2]=Q[2]*Math.cos(B)-Q[0]*Math.sin(B),g[0]=C[0]+I[0],g[1]=C[1]+I[1],g[2]=C[2]+I[2],g}function YS(g,A,I,B){let Q=[],C=[];return Q[0]=A[0]-I[0],Q[1]=A[1]-I[1],Q[2]=A[2]-I[2],C[0]=Q[0]*Math.cos(B)-Q[1]*Math.sin(B),C[1]=Q[0]*Math.sin(B)+Q[1]*Math.cos(B),C[2]=Q[2],g[0]=C[0]+I[0],g[1]=C[1]+I[1],g[2]=C[2]+I[2],g}function KS(g,A){let I=g[0],B=g[1],Q=g[2],C=A[0],E=A[1],i=A[2],o=Math.sqrt((I*I+B*B+Q*Q)*(C*C+E*E+i*i)),D=o&&nr(g,A)/o;return Math.acos(Math.min(Math.max(D,-1),1))}var qS=E9;var ArA=function(){let g=yr();return function(A,I,B,Q,C,E){let i,o;for(I||(I=3),B||(B=0),Q?o=Math.min(Q*I+B,A.length):o=A.length,i=B;i<o;i+=I)g[0]=A[i],g[1]=A[i+1],g[2]=A[i+2],C(g,g,E),A[i]=g[0],A[i+1]=g[1],A[i+2]=g[2];return A}}();var Rr=[0,0,0],le,V=class g extends Wo{static get ZERO(){return le||(le=new g(0,0,0),Object.freeze(le)),le}constructor(A=0,I=0,B=0){super(-0,-0,-0),arguments.length===1&&zQ(A)?this.copy(A):(tg.debug&&(UA(A),UA(I),UA(B)),this[0]=A,this[1]=I,this[2]=B)}set(A,I,B){return this[0]=A,this[1]=I,this[2]=B,this.check()}copy(A){return this[0]=A[0],this[1]=A[1],this[2]=A[2],this.check()}fromObject(A){return tg.debug&&(UA(A.x),UA(A.y),UA(A.z)),this[0]=A.x,this[1]=A.y,this[2]=A.z,this.check()}toObject(A){return A.x=this[0],A.y=this[1],A.z=this[2],A}get ELEMENTS(){return 3}get z(){return this[2]}set z(A){this[2]=UA(A)}angle(A){return KS(this,A)}cross(A){return Zo(this,this,A),this.check()}rotateX({radians:A,origin:I=Rr}){return MS(this,this,I,A),this.check()}rotateY({radians:A,origin:I=Rr}){return JS(this,this,I,A),this.check()}rotateZ({radians:A,origin:I=Rr}){return YS(this,this,I,A),this.check()}transform(A){return this.transformAsPoint(A)}transformAsPoint(A){return Le(this,this,A),this.check()}transformAsVector(A){return yS(this,this,A),this.check()}transformByMatrix3(A){return de(this,this,A),this.check()}transformByMatrix2(A){return rS(this,this,A),this.check()}transformByQuaternion(A){return pe(this,this,A),this.check()}};var fe,me=class g extends Wo{static get ZERO(){return fe||(fe=new g(0,0,0,0),Object.freeze(fe)),fe}constructor(A=0,I=0,B=0,Q=0){super(-0,-0,-0,-0),zQ(A)&&arguments.length===1?this.copy(A):(tg.debug&&(UA(A),UA(I),UA(B),UA(Q)),this[0]=A,this[1]=I,this[2]=B,this[3]=Q)}set(A,I,B,Q){return this[0]=A,this[1]=I,this[2]=B,this[3]=Q,this.check()}copy(A){return this[0]=A[0],this[1]=A[1],this[2]=A[2],this[3]=A[3],this.check()}fromObject(A){return tg.debug&&(UA(A.x),UA(A.y),UA(A.z),UA(A.w)),this[0]=A.x,this[1]=A.y,this[2]=A.z,this[3]=A.w,this}toObject(A){return A.x=this[0],A.y=this[1],A.z=this[2],A.w=this[3],A}get ELEMENTS(){return 4}get z(){return this[2]}set z(A){this[2]=UA(A)}get w(){return this[3]}set w(A){this[3]=UA(A)}transform(A){return Le(this,this,A),this.check()}transformByMatrix3(A){return Se(this,this,A),this.check()}transformByMatrix2(A){return nS(this,this,A),this.check()}transformByQuaternion(A){return pe(this,this,A),this.check()}applyMatrix4(A){return A.transform(this,this),this}};var xe=class extends oE{toString(){let A="[";if(tg.printRowMajor){A+="row-major:";for(let I=0;I<this.RANK;++I)for(let B=0;B<this.RANK;++B)A+=` ${this[B*this.RANK+I]}`}else{A+="column-major:";for(let I=0;I<this.ELEMENTS;++I)A+=` ${this[I]}`}return A+="]",A}getElementIndex(A,I){return I*this.RANK+A}getElement(A,I){return this[I*this.RANK+A]}setElement(A,I,B){return this[I*this.RANK+A]=UA(B),this}getColumn(A,I=new Array(this.RANK).fill(-0)){let B=A*this.RANK;for(let Q=0;Q<this.RANK;++Q)I[Q]=this[B+Q];return I}setColumn(A,I){let B=A*this.RANK;for(let Q=0;Q<this.RANK;++Q)this[B+Q]=I[Q];return this}};function HS(){let g=new gg(9);return gg!=Float32Array&&(g[1]=0,g[2]=0,g[3]=0,g[5]=0,g[6]=0,g[7]=0),g[0]=1,g[4]=1,g[8]=1,g}function SS(g,A){if(g===A){let I=A[1],B=A[2],Q=A[5];g[1]=A[3],g[2]=A[6],g[3]=I,g[5]=A[7],g[6]=B,g[7]=Q}else g[0]=A[0],g[1]=A[3],g[2]=A[6],g[3]=A[1],g[4]=A[4],g[5]=A[7],g[6]=A[2],g[7]=A[5],g[8]=A[8];return g}function LS(g,A){let I=A[0],B=A[1],Q=A[2],C=A[3],E=A[4],i=A[5],o=A[6],D=A[7],a=A[8],t=a*E-i*D,G=-a*C+i*o,s=D*C-E*o,w=I*t+B*G+Q*s;return w?(w=1/w,g[0]=t*w,g[1]=(-a*B+Q*D)*w,g[2]=(i*B-Q*E)*w,g[3]=G*w,g[4]=(a*I-Q*o)*w,g[5]=(-i*I+Q*C)*w,g[6]=s*w,g[7]=(-D*I+B*o)*w,g[8]=(E*I-B*C)*w,g):null}function dS(g){let A=g[0],I=g[1],B=g[2],Q=g[3],C=g[4],E=g[5],i=g[6],o=g[7],D=g[8];return A*(D*C-E*o)+I*(-D*Q+E*i)+B*(o*Q-C*i)}function Mr(g,A,I){let B=A[0],Q=A[1],C=A[2],E=A[3],i=A[4],o=A[5],D=A[6],a=A[7],t=A[8],G=I[0],s=I[1],w=I[2],e=I[3],c=I[4],h=I[5],R=I[6],N=I[7],y=I[8];return g[0]=G*B+s*E+w*D,g[1]=G*Q+s*i+w*a,g[2]=G*C+s*o+w*t,g[3]=e*B+c*E+h*D,g[4]=e*Q+c*i+h*a,g[5]=e*C+c*o+h*t,g[6]=R*B+N*E+y*D,g[7]=R*Q+N*i+y*a,g[8]=R*C+N*o+y*t,g}function pS(g,A,I){let B=A[0],Q=A[1],C=A[2],E=A[3],i=A[4],o=A[5],D=A[6],a=A[7],t=A[8],G=I[0],s=I[1];return g[0]=B,g[1]=Q,g[2]=C,g[3]=E,g[4]=i,g[5]=o,g[6]=G*B+s*E+D,g[7]=G*Q+s*i+a,g[8]=G*C+s*o+t,g}function lS(g,A,I){let B=A[0],Q=A[1],C=A[2],E=A[3],i=A[4],o=A[5],D=A[6],a=A[7],t=A[8],G=Math.sin(I),s=Math.cos(I);return g[0]=s*B+G*E,g[1]=s*Q+G*i,g[2]=s*C+G*o,g[3]=s*E-G*B,g[4]=s*i-G*Q,g[5]=s*o-G*C,g[6]=D,g[7]=a,g[8]=t,g}function Jr(g,A,I){let B=I[0],Q=I[1];return g[0]=B*A[0],g[1]=B*A[1],g[2]=B*A[2],g[3]=Q*A[3],g[4]=Q*A[4],g[5]=Q*A[5],g[6]=A[6],g[7]=A[7],g[8]=A[8],g}function fS(g,A){let I=A[0],B=A[1],Q=A[2],C=A[3],E=I+I,i=B+B,o=Q+Q,D=I*E,a=B*E,t=B*i,G=Q*E,s=Q*i,w=Q*o,e=C*E,c=C*i,h=C*o;return g[0]=1-t-w,g[3]=a-h,g[6]=G+c,g[1]=a+h,g[4]=1-D-w,g[7]=s-e,g[2]=G-c,g[5]=s+e,g[8]=1-D-t,g}var Yr;(function(g){g[g.COL0ROW0=0]="COL0ROW0",g[g.COL0ROW1=1]="COL0ROW1",g[g.COL0ROW2=2]="COL0ROW2",g[g.COL1ROW0=3]="COL1ROW0",g[g.COL1ROW1=4]="COL1ROW1",g[g.COL1ROW2=5]="COL1ROW2",g[g.COL2ROW0=6]="COL2ROW0",g[g.COL2ROW1=7]="COL2ROW1",g[g.COL2ROW2=8]="COL2ROW2"})(Yr||(Yr={}));var i9=Object.freeze([1,0,0,0,1,0,0,0,1]),Ig=class extends xe{static get IDENTITY(){return D9()}static get ZERO(){return o9()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Yr}constructor(A,...I){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(A)?this.copy(A):I.length>0?this.copy([A,...I]):this.identity()}copy(A){return this[0]=A[0],this[1]=A[1],this[2]=A[2],this[3]=A[3],this[4]=A[4],this[5]=A[5],this[6]=A[6],this[7]=A[7],this[8]=A[8],this.check()}identity(){return this.copy(i9)}fromObject(A){return this.check()}fromQuaternion(A){return fS(this,A),this.check()}set(A,I,B,Q,C,E,i,o,D){return this[0]=A,this[1]=I,this[2]=B,this[3]=Q,this[4]=C,this[5]=E,this[6]=i,this[7]=o,this[8]=D,this.check()}setRowMajor(A,I,B,Q,C,E,i,o,D){return this[0]=A,this[1]=Q,this[2]=i,this[3]=I,this[4]=C,this[5]=o,this[6]=B,this[7]=E,this[8]=D,this.check()}determinant(){return dS(this)}transpose(){return SS(this,this),this.check()}invert(){return LS(this,this),this.check()}multiplyLeft(A){return Mr(this,A,this),this.check()}multiplyRight(A){return Mr(this,this,A),this.check()}rotate(A){return lS(this,this,A),this.check()}scale(A){return Array.isArray(A)?Jr(this,this,A):Jr(this,this,[A,A]),this.check()}translate(A){return pS(this,this,A),this.check()}transform(A,I){let B;switch(A.length){case 2:B=FS(I||[-0,-0],A,this);break;case 3:B=de(I||[-0,-0,-0],A,this);break;case 4:B=Se(I||[-0,-0,-0,-0],A,this);break;default:throw new Error("Illegal vector")}return He(B,A.length),B}transformVector(A,I){return this.transform(A,I)}transformVector2(A,I){return this.transform(A,I)}transformVector3(A,I){return this.transform(A,I)}},ue,We=null;function o9(){return ue||(ue=new Ig([0,0,0,0,0,0,0,0,0]),Object.freeze(ue)),ue}function D9(){return We||(We=new Ig,Object.freeze(We)),We}var be={};rg(be,{add:()=>j9,adjoint:()=>N9,clone:()=>t9,copy:()=>G9,create:()=>a9,decompose:()=>d9,determinant:()=>k9,equals:()=>_9,exactEquals:()=>v9,frob:()=>O9,fromQuat:()=>f9,fromQuat2:()=>H9,fromRotation:()=>Y9,fromRotationTranslation:()=>WS,fromRotationTranslationScale:()=>p9,fromRotationTranslationScaleOrigin:()=>l9,fromScaling:()=>J9,fromTranslation:()=>M9,fromValues:()=>s9,fromXRotation:()=>K9,fromYRotation:()=>q9,fromZRotation:()=>U9,frustum:()=>m9,getRotation:()=>L9,getScaling:()=>bS,getTranslation:()=>S9,identity:()=>xS,invert:()=>e9,lookAt:()=>T9,mul:()=>$9,multiply:()=>uS,multiplyScalar:()=>X9,multiplyScalarAndAdd:()=>z9,ortho:()=>b9,orthoNO:()=>TS,orthoZO:()=>Z9,perspective:()=>x9,perspectiveFromFieldOfView:()=>W9,perspectiveNO:()=>ZS,perspectiveZO:()=>u9,rotate:()=>y9,rotateX:()=>r9,rotateY:()=>n9,rotateZ:()=>R9,scale:()=>F9,set:()=>w9,str:()=>V9,sub:()=>A1,subtract:()=>PS,targetTo:()=>P9,translate:()=>h9,transpose:()=>c9});function a9(){let g=new gg(16);return gg!=Float32Array&&(g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[11]=0,g[12]=0,g[13]=0,g[14]=0),g[0]=1,g[5]=1,g[10]=1,g[15]=1,g}function t9(g){let A=new gg(16);return A[0]=g[0],A[1]=g[1],A[2]=g[2],A[3]=g[3],A[4]=g[4],A[5]=g[5],A[6]=g[6],A[7]=g[7],A[8]=g[8],A[9]=g[9],A[10]=g[10],A[11]=g[11],A[12]=g[12],A[13]=g[13],A[14]=g[14],A[15]=g[15],A}function G9(g,A){return g[0]=A[0],g[1]=A[1],g[2]=A[2],g[3]=A[3],g[4]=A[4],g[5]=A[5],g[6]=A[6],g[7]=A[7],g[8]=A[8],g[9]=A[9],g[10]=A[10],g[11]=A[11],g[12]=A[12],g[13]=A[13],g[14]=A[14],g[15]=A[15],g}function s9(g,A,I,B,Q,C,E,i,o,D,a,t,G,s,w,e){let c=new gg(16);return c[0]=g,c[1]=A,c[2]=I,c[3]=B,c[4]=Q,c[5]=C,c[6]=E,c[7]=i,c[8]=o,c[9]=D,c[10]=a,c[11]=t,c[12]=G,c[13]=s,c[14]=w,c[15]=e,c}function w9(g,A,I,B,Q,C,E,i,o,D,a,t,G,s,w,e,c){return g[0]=A,g[1]=I,g[2]=B,g[3]=Q,g[4]=C,g[5]=E,g[6]=i,g[7]=o,g[8]=D,g[9]=a,g[10]=t,g[11]=G,g[12]=s,g[13]=w,g[14]=e,g[15]=c,g}function xS(g){return g[0]=1,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=1,g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[10]=1,g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,g}function c9(g,A){if(g===A){let I=A[1],B=A[2],Q=A[3],C=A[6],E=A[7],i=A[11];g[1]=A[4],g[2]=A[8],g[3]=A[12],g[4]=I,g[6]=A[9],g[7]=A[13],g[8]=B,g[9]=C,g[11]=A[14],g[12]=Q,g[13]=E,g[14]=i}else g[0]=A[0],g[1]=A[4],g[2]=A[8],g[3]=A[12],g[4]=A[1],g[5]=A[5],g[6]=A[9],g[7]=A[13],g[8]=A[2],g[9]=A[6],g[10]=A[10],g[11]=A[14],g[12]=A[3],g[13]=A[7],g[14]=A[11],g[15]=A[15];return g}function e9(g,A){let I=A[0],B=A[1],Q=A[2],C=A[3],E=A[4],i=A[5],o=A[6],D=A[7],a=A[8],t=A[9],G=A[10],s=A[11],w=A[12],e=A[13],c=A[14],h=A[15],R=I*i-B*E,N=I*o-Q*E,y=I*D-C*E,r=B*o-Q*i,J=B*D-C*i,q=Q*D-C*o,H=a*e-t*w,d=a*c-G*w,K=a*h-s*w,x=t*c-G*e,W=t*h-s*e,u=G*h-s*c,m=R*u-N*W+y*x+r*K-J*d+q*H;return m?(m=1/m,g[0]=(i*u-o*W+D*x)*m,g[1]=(Q*W-B*u-C*x)*m,g[2]=(e*q-c*J+h*r)*m,g[3]=(G*J-t*q-s*r)*m,g[4]=(o*K-E*u-D*d)*m,g[5]=(I*u-Q*K+C*d)*m,g[6]=(c*y-w*q-h*N)*m,g[7]=(a*q-G*y+s*N)*m,g[8]=(E*W-i*K+D*H)*m,g[9]=(B*K-I*W-C*H)*m,g[10]=(w*J-e*y+h*R)*m,g[11]=(t*y-a*J-s*R)*m,g[12]=(i*d-E*x-o*H)*m,g[13]=(I*x-B*d+Q*H)*m,g[14]=(e*N-w*r-c*R)*m,g[15]=(a*r-t*N+G*R)*m,g):null}function N9(g,A){let I=A[0],B=A[1],Q=A[2],C=A[3],E=A[4],i=A[5],o=A[6],D=A[7],a=A[8],t=A[9],G=A[10],s=A[11],w=A[12],e=A[13],c=A[14],h=A[15],R=I*i-B*E,N=I*o-Q*E,y=I*D-C*E,r=B*o-Q*i,J=B*D-C*i,q=Q*D-C*o,H=a*e-t*w,d=a*c-G*w,K=a*h-s*w,x=t*c-G*e,W=t*h-s*e,u=G*h-s*c;return g[0]=i*u-o*W+D*x,g[1]=Q*W-B*u-C*x,g[2]=e*q-c*J+h*r,g[3]=G*J-t*q-s*r,g[4]=o*K-E*u-D*d,g[5]=I*u-Q*K+C*d,g[6]=c*y-w*q-h*N,g[7]=a*q-G*y+s*N,g[8]=E*W-i*K+D*H,g[9]=B*K-I*W-C*H,g[10]=w*J-e*y+h*R,g[11]=t*y-a*J-s*R,g[12]=i*d-E*x-o*H,g[13]=I*x-B*d+Q*H,g[14]=e*N-w*r-c*R,g[15]=a*r-t*N+G*R,g}function k9(g){let A=g[0],I=g[1],B=g[2],Q=g[3],C=g[4],E=g[5],i=g[6],o=g[7],D=g[8],a=g[9],t=g[10],G=g[11],s=g[12],w=g[13],e=g[14],c=g[15],h=A*E-I*C,R=A*i-B*C,N=I*i-B*E,y=D*w-a*s,r=D*e-t*s,J=a*e-t*w,q=A*J-I*r+B*y,H=C*J-E*r+i*y,d=D*N-a*R+t*h,K=s*N-w*R+e*h;return o*q-Q*H+c*d-G*K}function uS(g,A,I){let B=A[0],Q=A[1],C=A[2],E=A[3],i=A[4],o=A[5],D=A[6],a=A[7],t=A[8],G=A[9],s=A[10],w=A[11],e=A[12],c=A[13],h=A[14],R=A[15],N=I[0],y=I[1],r=I[2],J=I[3];return g[0]=N*B+y*i+r*t+J*e,g[1]=N*Q+y*o+r*G+J*c,g[2]=N*C+y*D+r*s+J*h,g[3]=N*E+y*a+r*w+J*R,N=I[4],y=I[5],r=I[6],J=I[7],g[4]=N*B+y*i+r*t+J*e,g[5]=N*Q+y*o+r*G+J*c,g[6]=N*C+y*D+r*s+J*h,g[7]=N*E+y*a+r*w+J*R,N=I[8],y=I[9],r=I[10],J=I[11],g[8]=N*B+y*i+r*t+J*e,g[9]=N*Q+y*o+r*G+J*c,g[10]=N*C+y*D+r*s+J*h,g[11]=N*E+y*a+r*w+J*R,N=I[12],y=I[13],r=I[14],J=I[15],g[12]=N*B+y*i+r*t+J*e,g[13]=N*Q+y*o+r*G+J*c,g[14]=N*C+y*D+r*s+J*h,g[15]=N*E+y*a+r*w+J*R,g}function h9(g,A,I){let B=I[0],Q=I[1],C=I[2],E,i,o,D,a,t,G,s,w,e,c,h;return A===g?(g[12]=A[0]*B+A[4]*Q+A[8]*C+A[12],g[13]=A[1]*B+A[5]*Q+A[9]*C+A[13],g[14]=A[2]*B+A[6]*Q+A[10]*C+A[14],g[15]=A[3]*B+A[7]*Q+A[11]*C+A[15]):(E=A[0],i=A[1],o=A[2],D=A[3],a=A[4],t=A[5],G=A[6],s=A[7],w=A[8],e=A[9],c=A[10],h=A[11],g[0]=E,g[1]=i,g[2]=o,g[3]=D,g[4]=a,g[5]=t,g[6]=G,g[7]=s,g[8]=w,g[9]=e,g[10]=c,g[11]=h,g[12]=E*B+a*Q+w*C+A[12],g[13]=i*B+t*Q+e*C+A[13],g[14]=o*B+G*Q+c*C+A[14],g[15]=D*B+s*Q+h*C+A[15]),g}function F9(g,A,I){let B=I[0],Q=I[1],C=I[2];return g[0]=A[0]*B,g[1]=A[1]*B,g[2]=A[2]*B,g[3]=A[3]*B,g[4]=A[4]*Q,g[5]=A[5]*Q,g[6]=A[6]*Q,g[7]=A[7]*Q,g[8]=A[8]*C,g[9]=A[9]*C,g[10]=A[10]*C,g[11]=A[11]*C,g[12]=A[12],g[13]=A[13],g[14]=A[14],g[15]=A[15],g}function y9(g,A,I,B){let Q=B[0],C=B[1],E=B[2],i=Math.sqrt(Q*Q+C*C+E*E),o,D,a,t,G,s,w,e,c,h,R,N,y,r,J,q,H,d,K,x,W,u,m,_;return i<1e-6?null:(i=1/i,Q*=i,C*=i,E*=i,D=Math.sin(I),o=Math.cos(I),a=1-o,t=A[0],G=A[1],s=A[2],w=A[3],e=A[4],c=A[5],h=A[6],R=A[7],N=A[8],y=A[9],r=A[10],J=A[11],q=Q*Q*a+o,H=C*Q*a+E*D,d=E*Q*a-C*D,K=Q*C*a-E*D,x=C*C*a+o,W=E*C*a+Q*D,u=Q*E*a+C*D,m=C*E*a-Q*D,_=E*E*a+o,g[0]=t*q+e*H+N*d,g[1]=G*q+c*H+y*d,g[2]=s*q+h*H+r*d,g[3]=w*q+R*H+J*d,g[4]=t*K+e*x+N*W,g[5]=G*K+c*x+y*W,g[6]=s*K+h*x+r*W,g[7]=w*K+R*x+J*W,g[8]=t*u+e*m+N*_,g[9]=G*u+c*m+y*_,g[10]=s*u+h*m+r*_,g[11]=w*u+R*m+J*_,A!==g&&(g[12]=A[12],g[13]=A[13],g[14]=A[14],g[15]=A[15]),g)}function r9(g,A,I){let B=Math.sin(I),Q=Math.cos(I),C=A[4],E=A[5],i=A[6],o=A[7],D=A[8],a=A[9],t=A[10],G=A[11];return A!==g&&(g[0]=A[0],g[1]=A[1],g[2]=A[2],g[3]=A[3],g[12]=A[12],g[13]=A[13],g[14]=A[14],g[15]=A[15]),g[4]=C*Q+D*B,g[5]=E*Q+a*B,g[6]=i*Q+t*B,g[7]=o*Q+G*B,g[8]=D*Q-C*B,g[9]=a*Q-E*B,g[10]=t*Q-i*B,g[11]=G*Q-o*B,g}function n9(g,A,I){let B=Math.sin(I),Q=Math.cos(I),C=A[0],E=A[1],i=A[2],o=A[3],D=A[8],a=A[9],t=A[10],G=A[11];return A!==g&&(g[4]=A[4],g[5]=A[5],g[6]=A[6],g[7]=A[7],g[12]=A[12],g[13]=A[13],g[14]=A[14],g[15]=A[15]),g[0]=C*Q-D*B,g[1]=E*Q-a*B,g[2]=i*Q-t*B,g[3]=o*Q-G*B,g[8]=C*B+D*Q,g[9]=E*B+a*Q,g[10]=i*B+t*Q,g[11]=o*B+G*Q,g}function R9(g,A,I){let B=Math.sin(I),Q=Math.cos(I),C=A[0],E=A[1],i=A[2],o=A[3],D=A[4],a=A[5],t=A[6],G=A[7];return A!==g&&(g[8]=A[8],g[9]=A[9],g[10]=A[10],g[11]=A[11],g[12]=A[12],g[13]=A[13],g[14]=A[14],g[15]=A[15]),g[0]=C*Q+D*B,g[1]=E*Q+a*B,g[2]=i*Q+t*B,g[3]=o*Q+G*B,g[4]=D*Q-C*B,g[5]=a*Q-E*B,g[6]=t*Q-i*B,g[7]=G*Q-o*B,g}function M9(g,A){return g[0]=1,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=1,g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[10]=1,g[11]=0,g[12]=A[0],g[13]=A[1],g[14]=A[2],g[15]=1,g}function J9(g,A){return g[0]=A[0],g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=A[1],g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[10]=A[2],g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,g}function Y9(g,A,I){let B=I[0],Q=I[1],C=I[2],E=Math.sqrt(B*B+Q*Q+C*C),i,o,D;return E<1e-6?null:(E=1/E,B*=E,Q*=E,C*=E,o=Math.sin(A),i=Math.cos(A),D=1-i,g[0]=B*B*D+i,g[1]=Q*B*D+C*o,g[2]=C*B*D-Q*o,g[3]=0,g[4]=B*Q*D-C*o,g[5]=Q*Q*D+i,g[6]=C*Q*D+B*o,g[7]=0,g[8]=B*C*D+Q*o,g[9]=Q*C*D-B*o,g[10]=C*C*D+i,g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,g)}function K9(g,A){let I=Math.sin(A),B=Math.cos(A);return g[0]=1,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=B,g[6]=I,g[7]=0,g[8]=0,g[9]=-I,g[10]=B,g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,g}function q9(g,A){let I=Math.sin(A),B=Math.cos(A);return g[0]=B,g[1]=0,g[2]=-I,g[3]=0,g[4]=0,g[5]=1,g[6]=0,g[7]=0,g[8]=I,g[9]=0,g[10]=B,g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,g}function U9(g,A){let I=Math.sin(A),B=Math.cos(A);return g[0]=B,g[1]=I,g[2]=0,g[3]=0,g[4]=-I,g[5]=B,g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[10]=1,g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,g}function WS(g,A,I){let B=A[0],Q=A[1],C=A[2],E=A[3],i=B+B,o=Q+Q,D=C+C,a=B*i,t=B*o,G=B*D,s=Q*o,w=Q*D,e=C*D,c=E*i,h=E*o,R=E*D;return g[0]=1-(s+e),g[1]=t+R,g[2]=G-h,g[3]=0,g[4]=t-R,g[5]=1-(a+e),g[6]=w+c,g[7]=0,g[8]=G+h,g[9]=w-c,g[10]=1-(a+s),g[11]=0,g[12]=I[0],g[13]=I[1],g[14]=I[2],g[15]=1,g}function H9(g,A){let I=new gg(3),B=-A[0],Q=-A[1],C=-A[2],E=A[3],i=A[4],o=A[5],D=A[6],a=A[7],t=B*B+Q*Q+C*C+E*E;return t>0?(I[0]=(i*E+a*B+o*C-D*Q)*2/t,I[1]=(o*E+a*Q+D*B-i*C)*2/t,I[2]=(D*E+a*C+i*Q-o*B)*2/t):(I[0]=(i*E+a*B+o*C-D*Q)*2,I[1]=(o*E+a*Q+D*B-i*C)*2,I[2]=(D*E+a*C+i*Q-o*B)*2),WS(g,A,I),g}function S9(g,A){return g[0]=A[12],g[1]=A[13],g[2]=A[14],g}function bS(g,A){let I=A[0],B=A[1],Q=A[2],C=A[4],E=A[5],i=A[6],o=A[8],D=A[9],a=A[10];return g[0]=Math.sqrt(I*I+B*B+Q*Q),g[1]=Math.sqrt(C*C+E*E+i*i),g[2]=Math.sqrt(o*o+D*D+a*a),g}function L9(g,A){let I=new gg(3);bS(I,A);let B=1/I[0],Q=1/I[1],C=1/I[2],E=A[0]*B,i=A[1]*Q,o=A[2]*C,D=A[4]*B,a=A[5]*Q,t=A[6]*C,G=A[8]*B,s=A[9]*Q,w=A[10]*C,e=E+a+w,c=0;return e>0?(c=Math.sqrt(e+1)*2,g[3]=.25*c,g[0]=(t-s)/c,g[1]=(G-o)/c,g[2]=(i-D)/c):E>a&&E>w?(c=Math.sqrt(1+E-a-w)*2,g[3]=(t-s)/c,g[0]=.25*c,g[1]=(i+D)/c,g[2]=(G+o)/c):a>w?(c=Math.sqrt(1+a-E-w)*2,g[3]=(G-o)/c,g[0]=(i+D)/c,g[1]=.25*c,g[2]=(t+s)/c):(c=Math.sqrt(1+w-E-a)*2,g[3]=(i-D)/c,g[0]=(G+o)/c,g[1]=(t+s)/c,g[2]=.25*c),g}function d9(g,A,I,B){A[0]=B[12],A[1]=B[13],A[2]=B[14];let Q=B[0],C=B[1],E=B[2],i=B[4],o=B[5],D=B[6],a=B[8],t=B[9],G=B[10];I[0]=Math.sqrt(Q*Q+C*C+E*E),I[1]=Math.sqrt(i*i+o*o+D*D),I[2]=Math.sqrt(a*a+t*t+G*G);let s=1/I[0],w=1/I[1],e=1/I[2],c=Q*s,h=C*w,R=E*e,N=i*s,y=o*w,r=D*e,J=a*s,q=t*w,H=G*e,d=c+y+H,K=0;return d>0?(K=Math.sqrt(d+1)*2,g[3]=.25*K,g[0]=(r-q)/K,g[1]=(J-R)/K,g[2]=(h-N)/K):c>y&&c>H?(K=Math.sqrt(1+c-y-H)*2,g[3]=(r-q)/K,g[0]=.25*K,g[1]=(h+N)/K,g[2]=(J+R)/K):y>H?(K=Math.sqrt(1+y-c-H)*2,g[3]=(J-R)/K,g[0]=(h+N)/K,g[1]=.25*K,g[2]=(r+q)/K):(K=Math.sqrt(1+H-c-y)*2,g[3]=(h-N)/K,g[0]=(J+R)/K,g[1]=(r+q)/K,g[2]=.25*K),g}function p9(g,A,I,B){let Q=A[0],C=A[1],E=A[2],i=A[3],o=Q+Q,D=C+C,a=E+E,t=Q*o,G=Q*D,s=Q*a,w=C*D,e=C*a,c=E*a,h=i*o,R=i*D,N=i*a,y=B[0],r=B[1],J=B[2];return g[0]=(1-(w+c))*y,g[1]=(G+N)*y,g[2]=(s-R)*y,g[3]=0,g[4]=(G-N)*r,g[5]=(1-(t+c))*r,g[6]=(e+h)*r,g[7]=0,g[8]=(s+R)*J,g[9]=(e-h)*J,g[10]=(1-(t+w))*J,g[11]=0,g[12]=I[0],g[13]=I[1],g[14]=I[2],g[15]=1,g}function l9(g,A,I,B,Q){let C=A[0],E=A[1],i=A[2],o=A[3],D=C+C,a=E+E,t=i+i,G=C*D,s=C*a,w=C*t,e=E*a,c=E*t,h=i*t,R=o*D,N=o*a,y=o*t,r=B[0],J=B[1],q=B[2],H=Q[0],d=Q[1],K=Q[2],x=(1-(e+h))*r,W=(s+y)*r,u=(w-N)*r,m=(s-y)*J,_=(1-(G+h))*J,MA=(c+R)*J,qA=(w+N)*q,tA=(c-R)*q,cA=(1-(G+e))*q;return g[0]=x,g[1]=W,g[2]=u,g[3]=0,g[4]=m,g[5]=_,g[6]=MA,g[7]=0,g[8]=qA,g[9]=tA,g[10]=cA,g[11]=0,g[12]=I[0]+H-(x*H+m*d+qA*K),g[13]=I[1]+d-(W*H+_*d+tA*K),g[14]=I[2]+K-(u*H+MA*d+cA*K),g[15]=1,g}function f9(g,A){let I=A[0],B=A[1],Q=A[2],C=A[3],E=I+I,i=B+B,o=Q+Q,D=I*E,a=B*E,t=B*i,G=Q*E,s=Q*i,w=Q*o,e=C*E,c=C*i,h=C*o;return g[0]=1-t-w,g[1]=a+h,g[2]=G-c,g[3]=0,g[4]=a-h,g[5]=1-D-w,g[6]=s+e,g[7]=0,g[8]=G+c,g[9]=s-e,g[10]=1-D-t,g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,g}function m9(g,A,I,B,Q,C,E){let i=1/(I-A),o=1/(Q-B),D=1/(C-E);return g[0]=C*2*i,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=C*2*o,g[6]=0,g[7]=0,g[8]=(I+A)*i,g[9]=(Q+B)*o,g[10]=(E+C)*D,g[11]=-1,g[12]=0,g[13]=0,g[14]=E*C*2*D,g[15]=0,g}function ZS(g,A,I,B,Q){let C=1/Math.tan(A/2);if(g[0]=C/I,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=C,g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[11]=-1,g[12]=0,g[13]=0,g[15]=0,Q!=null&&Q!==1/0){let E=1/(B-Q);g[10]=(Q+B)*E,g[14]=2*Q*B*E}else g[10]=-1,g[14]=-2*B;return g}var x9=ZS;function u9(g,A,I,B,Q){let C=1/Math.tan(A/2);if(g[0]=C/I,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=C,g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[11]=-1,g[12]=0,g[13]=0,g[15]=0,Q!=null&&Q!==1/0){let E=1/(B-Q);g[10]=Q*E,g[14]=Q*B*E}else g[10]=-1,g[14]=-B;return g}function W9(g,A,I,B){let Q=Math.tan(A.upDegrees*Math.PI/180),C=Math.tan(A.downDegrees*Math.PI/180),E=Math.tan(A.leftDegrees*Math.PI/180),i=Math.tan(A.rightDegrees*Math.PI/180),o=2/(E+i),D=2/(Q+C);return g[0]=o,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=D,g[6]=0,g[7]=0,g[8]=-((E-i)*o*.5),g[9]=(Q-C)*D*.5,g[10]=B/(I-B),g[11]=-1,g[12]=0,g[13]=0,g[14]=B*I/(I-B),g[15]=0,g}function TS(g,A,I,B,Q,C,E){let i=1/(A-I),o=1/(B-Q),D=1/(C-E);return g[0]=-2*i,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=-2*o,g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[10]=2*D,g[11]=0,g[12]=(A+I)*i,g[13]=(Q+B)*o,g[14]=(E+C)*D,g[15]=1,g}var b9=TS;function Z9(g,A,I,B,Q,C,E){let i=1/(A-I),o=1/(B-Q),D=1/(C-E);return g[0]=-2*i,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=-2*o,g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[10]=D,g[11]=0,g[12]=(A+I)*i,g[13]=(Q+B)*o,g[14]=C*D,g[15]=1,g}function T9(g,A,I,B){let Q,C,E,i,o,D,a,t,G,s,w=A[0],e=A[1],c=A[2],h=B[0],R=B[1],N=B[2],y=I[0],r=I[1],J=I[2];return Math.abs(w-y)<1e-6&&Math.abs(e-r)<1e-6&&Math.abs(c-J)<1e-6?xS(g):(t=w-y,G=e-r,s=c-J,Q=1/Math.sqrt(t*t+G*G+s*s),t*=Q,G*=Q,s*=Q,C=R*s-N*G,E=N*t-h*s,i=h*G-R*t,Q=Math.sqrt(C*C+E*E+i*i),Q?(Q=1/Q,C*=Q,E*=Q,i*=Q):(C=0,E=0,i=0),o=G*i-s*E,D=s*C-t*i,a=t*E-G*C,Q=Math.sqrt(o*o+D*D+a*a),Q?(Q=1/Q,o*=Q,D*=Q,a*=Q):(o=0,D=0,a=0),g[0]=C,g[1]=o,g[2]=t,g[3]=0,g[4]=E,g[5]=D,g[6]=G,g[7]=0,g[8]=i,g[9]=a,g[10]=s,g[11]=0,g[12]=-(C*w+E*e+i*c),g[13]=-(o*w+D*e+a*c),g[14]=-(t*w+G*e+s*c),g[15]=1,g)}function P9(g,A,I,B){let Q=A[0],C=A[1],E=A[2],i=B[0],o=B[1],D=B[2],a=Q-I[0],t=C-I[1],G=E-I[2],s=a*a+t*t+G*G;s>0&&(s=1/Math.sqrt(s),a*=s,t*=s,G*=s);let w=o*G-D*t,e=D*a-i*G,c=i*t-o*a;return s=w*w+e*e+c*c,s>0&&(s=1/Math.sqrt(s),w*=s,e*=s,c*=s),g[0]=w,g[1]=e,g[2]=c,g[3]=0,g[4]=t*c-G*e,g[5]=G*w-a*c,g[6]=a*e-t*w,g[7]=0,g[8]=a,g[9]=t,g[10]=G,g[11]=0,g[12]=Q,g[13]=C,g[14]=E,g[15]=1,g}function V9(g){return`mat4(${g[0]}, ${g[1]}, ${g[2]}, ${g[3]}, ${g[4]}, ${g[5]}, ${g[6]}, ${g[7]}, ${g[8]}, ${g[9]}, ${g[10]}, ${g[11]}, ${g[12]}, ${g[13]}, ${g[14]}, ${g[15]})`}function O9(g){return Math.sqrt(g[0]*g[0]+g[1]*g[1]+g[2]*g[2]+g[3]*g[3]+g[4]*g[4]+g[5]*g[5]+g[6]*g[6]+g[7]*g[7]+g[8]*g[8]+g[9]*g[9]+g[10]*g[10]+g[11]*g[11]+g[12]*g[12]+g[13]*g[13]+g[14]*g[14]+g[15]*g[15])}function j9(g,A,I){return g[0]=A[0]+I[0],g[1]=A[1]+I[1],g[2]=A[2]+I[2],g[3]=A[3]+I[3],g[4]=A[4]+I[4],g[5]=A[5]+I[5],g[6]=A[6]+I[6],g[7]=A[7]+I[7],g[8]=A[8]+I[8],g[9]=A[9]+I[9],g[10]=A[10]+I[10],g[11]=A[11]+I[11],g[12]=A[12]+I[12],g[13]=A[13]+I[13],g[14]=A[14]+I[14],g[15]=A[15]+I[15],g}function PS(g,A,I){return g[0]=A[0]-I[0],g[1]=A[1]-I[1],g[2]=A[2]-I[2],g[3]=A[3]-I[3],g[4]=A[4]-I[4],g[5]=A[5]-I[5],g[6]=A[6]-I[6],g[7]=A[7]-I[7],g[8]=A[8]-I[8],g[9]=A[9]-I[9],g[10]=A[10]-I[10],g[11]=A[11]-I[11],g[12]=A[12]-I[12],g[13]=A[13]-I[13],g[14]=A[14]-I[14],g[15]=A[15]-I[15],g}function X9(g,A,I){return g[0]=A[0]*I,g[1]=A[1]*I,g[2]=A[2]*I,g[3]=A[3]*I,g[4]=A[4]*I,g[5]=A[5]*I,g[6]=A[6]*I,g[7]=A[7]*I,g[8]=A[8]*I,g[9]=A[9]*I,g[10]=A[10]*I,g[11]=A[11]*I,g[12]=A[12]*I,g[13]=A[13]*I,g[14]=A[14]*I,g[15]=A[15]*I,g}function z9(g,A,I,B){return g[0]=A[0]+I[0]*B,g[1]=A[1]+I[1]*B,g[2]=A[2]+I[2]*B,g[3]=A[3]+I[3]*B,g[4]=A[4]+I[4]*B,g[5]=A[5]+I[5]*B,g[6]=A[6]+I[6]*B,g[7]=A[7]+I[7]*B,g[8]=A[8]+I[8]*B,g[9]=A[9]+I[9]*B,g[10]=A[10]+I[10]*B,g[11]=A[11]+I[11]*B,g[12]=A[12]+I[12]*B,g[13]=A[13]+I[13]*B,g[14]=A[14]+I[14]*B,g[15]=A[15]+I[15]*B,g}function v9(g,A){return g[0]===A[0]&&g[1]===A[1]&&g[2]===A[2]&&g[3]===A[3]&&g[4]===A[4]&&g[5]===A[5]&&g[6]===A[6]&&g[7]===A[7]&&g[8]===A[8]&&g[9]===A[9]&&g[10]===A[10]&&g[11]===A[11]&&g[12]===A[12]&&g[13]===A[13]&&g[14]===A[14]&&g[15]===A[15]}function _9(g,A){let I=g[0],B=g[1],Q=g[2],C=g[3],E=g[4],i=g[5],o=g[6],D=g[7],a=g[8],t=g[9],G=g[10],s=g[11],w=g[12],e=g[13],c=g[14],h=g[15],R=A[0],N=A[1],y=A[2],r=A[3],J=A[4],q=A[5],H=A[6],d=A[7],K=A[8],x=A[9],W=A[10],u=A[11],m=A[12],_=A[13],MA=A[14],qA=A[15];return Math.abs(I-R)<=1e-6*Math.max(1,Math.abs(I),Math.abs(R))&&Math.abs(B-N)<=1e-6*Math.max(1,Math.abs(B),Math.abs(N))&&Math.abs(Q-y)<=1e-6*Math.max(1,Math.abs(Q),Math.abs(y))&&Math.abs(C-r)<=1e-6*Math.max(1,Math.abs(C),Math.abs(r))&&Math.abs(E-J)<=1e-6*Math.max(1,Math.abs(E),Math.abs(J))&&Math.abs(i-q)<=1e-6*Math.max(1,Math.abs(i),Math.abs(q))&&Math.abs(o-H)<=1e-6*Math.max(1,Math.abs(o),Math.abs(H))&&Math.abs(D-d)<=1e-6*Math.max(1,Math.abs(D),Math.abs(d))&&Math.abs(a-K)<=1e-6*Math.max(1,Math.abs(a),Math.abs(K))&&Math.abs(t-x)<=1e-6*Math.max(1,Math.abs(t),Math.abs(x))&&Math.abs(G-W)<=1e-6*Math.max(1,Math.abs(G),Math.abs(W))&&Math.abs(s-u)<=1e-6*Math.max(1,Math.abs(s),Math.abs(u))&&Math.abs(w-m)<=1e-6*Math.max(1,Math.abs(w),Math.abs(m))&&Math.abs(e-_)<=1e-6*Math.max(1,Math.abs(e),Math.abs(_))&&Math.abs(c-MA)<=1e-6*Math.max(1,Math.abs(c),Math.abs(MA))&&Math.abs(h-qA)<=1e-6*Math.max(1,Math.abs(h),Math.abs(qA))}var $9=uS,A1=PS;function g1(){let g=new gg(4);return gg!=Float32Array&&(g[0]=0,g[1]=0,g[2]=0,g[3]=0),g}function VS(g,A,I){return g[0]=A[0]+I[0],g[1]=A[1]+I[1],g[2]=A[2]+I[2],g[3]=A[3]+I[3],g}function OS(g,A,I){return g[0]=A[0]*I,g[1]=A[1]*I,g[2]=A[2]*I,g[3]=A[3]*I,g}function jS(g){let A=g[0],I=g[1],B=g[2],Q=g[3];return Math.sqrt(A*A+I*I+B*B+Q*Q)}function XS(g){let A=g[0],I=g[1],B=g[2],Q=g[3];return A*A+I*I+B*B+Q*Q}function zS(g,A){let I=A[0],B=A[1],Q=A[2],C=A[3],E=I*I+B*B+Q*Q+C*C;return E>0&&(E=1/Math.sqrt(E)),g[0]=I*E,g[1]=B*E,g[2]=Q*E,g[3]=C*E,g}function vS(g,A){return g[0]*A[0]+g[1]*A[1]+g[2]*A[2]+g[3]*A[3]}function _S(g,A,I,B){let Q=A[0],C=A[1],E=A[2],i=A[3];return g[0]=Q+B*(I[0]-Q),g[1]=C+B*(I[1]-C),g[2]=E+B*(I[2]-E),g[3]=i+B*(I[3]-i),g}function $S(g,A,I){let B=A[0],Q=A[1],C=A[2],E=I[0],i=I[1],o=I[2],D=I[3],a=D*B+i*C-o*Q,t=D*Q+o*B-E*C,G=D*C+E*Q-i*B,s=-E*B-i*Q-o*C;return g[0]=a*D+s*-E+t*-o-G*-i,g[1]=t*D+s*-i+G*-E-a*-o,g[2]=G*D+s*-o+a*-i-t*-E,g[3]=A[3],g}var RrA=function(){let g=g1();return function(A,I,B,Q,C,E){let i,o;for(I||(I=4),B||(B=0),Q?o=Math.min(Q*I+B,A.length):o=A.length,i=B;i<o;i+=I)g[0]=A[i],g[1]=A[i+1],g[2]=A[i+2],g[3]=A[i+3],C(g,g,E),A[i]=g[0],A[i+1]=g[1],A[i+2]=g[2],A[i+3]=g[3];return A}}();function gL(){let g=new gg(4);return gg!=Float32Array&&(g[0]=0,g[1]=0,g[2]=0),g[3]=1,g}function IL(g){return g[0]=0,g[1]=0,g[2]=0,g[3]=1,g}function Kr(g,A,I){I=I*.5;let B=Math.sin(I);return g[0]=B*A[0],g[1]=B*A[1],g[2]=B*A[2],g[3]=Math.cos(I),g}function qr(g,A,I){let B=A[0],Q=A[1],C=A[2],E=A[3],i=I[0],o=I[1],D=I[2],a=I[3];return g[0]=B*a+E*i+Q*D-C*o,g[1]=Q*a+E*o+C*i-B*D,g[2]=C*a+E*D+B*o-Q*i,g[3]=E*a-B*i-Q*o-C*D,g}function BL(g,A,I){I*=.5;let B=A[0],Q=A[1],C=A[2],E=A[3],i=Math.sin(I),o=Math.cos(I);return g[0]=B*o+E*i,g[1]=Q*o+C*i,g[2]=C*o-Q*i,g[3]=E*o-B*i,g}function QL(g,A,I){I*=.5;let B=A[0],Q=A[1],C=A[2],E=A[3],i=Math.sin(I),o=Math.cos(I);return g[0]=B*o-C*i,g[1]=Q*o+E*i,g[2]=C*o+B*i,g[3]=E*o-Q*i,g}function CL(g,A,I){I*=.5;let B=A[0],Q=A[1],C=A[2],E=A[3],i=Math.sin(I),o=Math.cos(I);return g[0]=B*o+Q*i,g[1]=Q*o-B*i,g[2]=C*o+E*i,g[3]=E*o-C*i,g}function EL(g,A){let I=A[0],B=A[1],Q=A[2];return g[0]=I,g[1]=B,g[2]=Q,g[3]=Math.sqrt(Math.abs(1-I*I-B*B-Q*Q)),g}function BG(g,A,I,B){let Q=A[0],C=A[1],E=A[2],i=A[3],o=I[0],D=I[1],a=I[2],t=I[3],G,s,w,e,c;return G=Q*o+C*D+E*a+i*t,G<0&&(G=-G,o=-o,D=-D,a=-a,t=-t),1-G>1e-6?(s=Math.acos(G),c=Math.sin(s),w=Math.sin((1-B)*s)/c,e=Math.sin(B*s)/c):(w=1-B,e=B),g[0]=w*Q+e*o,g[1]=w*C+e*D,g[2]=w*E+e*a,g[3]=w*i+e*t,g}function iL(g,A){let I=A[0],B=A[1],Q=A[2],C=A[3],E=I*I+B*B+Q*Q+C*C,i=E?1/E:0;return g[0]=-I*i,g[1]=-B*i,g[2]=-Q*i,g[3]=C*i,g}function oL(g,A){return g[0]=-A[0],g[1]=-A[1],g[2]=-A[2],g[3]=A[3],g}function Ur(g,A){let I=A[0]+A[4]+A[8],B;if(I>0)B=Math.sqrt(I+1),g[3]=.5*B,B=.5/B,g[0]=(A[5]-A[7])*B,g[1]=(A[6]-A[2])*B,g[2]=(A[1]-A[3])*B;else{let Q=0;A[4]>A[0]&&(Q=1),A[8]>A[Q*3+Q]&&(Q=2);let C=(Q+1)%3,E=(Q+2)%3;B=Math.sqrt(A[Q*3+Q]-A[C*3+C]-A[E*3+E]+1),g[Q]=.5*B,B=.5/B,g[3]=(A[C*3+E]-A[E*3+C])*B,g[C]=(A[C*3+Q]+A[Q*3+C])*B,g[E]=(A[E*3+Q]+A[Q*3+E])*B}return g}var DL=VS;var aL=OS,tL=vS,GL=_S,sL=jS;var wL=XS;var cL=zS;var eL=function(){let g=yr(),A=rr(1,0,0),I=rr(0,1,0);return function(B,Q,C){let E=nr(Q,C);return E<-.999999?(Zo(g,A,Q),qS(g)<1e-6&&Zo(g,I,Q),RS(g,g),Kr(B,g,Math.PI),B):E>.999999?(B[0]=0,B[1]=0,B[2]=0,B[3]=1,B):(Zo(g,Q,C),B[0]=g[0],B[1]=g[1],B[2]=g[2],B[3]=1+E,cL(B,B))}}(),UrA=function(){let g=gL(),A=gL();return function(I,B,Q,C,E,i){return BG(g,B,E,i),BG(A,Q,C,i),BG(I,g,A,2*i*(1-i)),I}}(),HrA=function(){let g=HS();return function(A,I,B,Q){return g[0]=B[0],g[3]=B[1],g[6]=B[2],g[1]=Q[0],g[4]=Q[1],g[7]=Q[2],g[2]=-I[0],g[5]=-I[1],g[8]=-I[2],cL(A,Ur(A,g))}}();var B1=[0,0,0,1],To=class extends oE{constructor(A=0,I=0,B=0,Q=1){super(-0,-0,-0,-0),Array.isArray(A)&&arguments.length===1?this.copy(A):this.set(A,I,B,Q)}copy(A){return this[0]=A[0],this[1]=A[1],this[2]=A[2],this[3]=A[3],this.check()}set(A,I,B,Q){return this[0]=A,this[1]=I,this[2]=B,this[3]=Q,this.check()}fromObject(A){return this[0]=A.x,this[1]=A.y,this[2]=A.z,this[3]=A.w,this.check()}fromMatrix3(A){return Ur(this,A),this.check()}fromAxisRotation(A,I){return Kr(this,A,I),this.check()}identity(){return IL(this),this.check()}setAxisAngle(A,I){return this.fromAxisRotation(A,I)}get ELEMENTS(){return 4}get x(){return this[0]}set x(A){this[0]=UA(A)}get y(){return this[1]}set y(A){this[1]=UA(A)}get z(){return this[2]}set z(A){this[2]=UA(A)}get w(){return this[3]}set w(A){this[3]=UA(A)}len(){return sL(this)}lengthSquared(){return wL(this)}dot(A){return tL(this,A)}rotationTo(A,I){return eL(this,A,I),this.check()}add(A){return DL(this,this,A),this.check()}calculateW(){return EL(this,this),this.check()}conjugate(){return oL(this,this),this.check()}invert(){return iL(this,this),this.check()}lerp(A,I,B){return B===void 0?this.lerp(this,A,I):(GL(this,A,I,B),this.check())}multiplyRight(A){return qr(this,this,A),this.check()}multiplyLeft(A){return qr(this,A,this),this.check()}normalize(){let A=this.len(),I=A>0?1/A:0;return this[0]=this[0]*I,this[1]=this[1]*I,this[2]=this[2]*I,this[3]=this[3]*I,A===0&&(this[3]=1),this.check()}rotateX(A){return BL(this,this,A),this.check()}rotateY(A){return QL(this,this,A),this.check()}rotateZ(A){return CL(this,this,A),this.check()}scale(A){return aL(this,this,A),this.check()}slerp(A,I,B){let Q,C,E;switch(arguments.length){case 1:({start:Q=B1,target:C,ratio:E}=A);break;case 2:Q=this,C=A,E=I;break;default:Q=A,C=I,E=B}return BG(this,Q,C,E),this.check()}transformVector4(A,I=new me){return $S(I,A,this),He(I,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(A,I){return this.setAxisAngle(A,I)}premultiply(A){return this.multiplyLeft(A)}multiply(A){return this.multiplyRight(A)}};var QG={};rg(QG,{EPSILON1:()=>Q1,EPSILON10:()=>s1,EPSILON11:()=>w1,EPSILON12:()=>c1,EPSILON13:()=>e1,EPSILON14:()=>N1,EPSILON15:()=>k1,EPSILON16:()=>h1,EPSILON17:()=>F1,EPSILON18:()=>y1,EPSILON19:()=>r1,EPSILON2:()=>C1,EPSILON20:()=>n1,EPSILON3:()=>E1,EPSILON4:()=>i1,EPSILON5:()=>o1,EPSILON6:()=>D1,EPSILON7:()=>a1,EPSILON8:()=>t1,EPSILON9:()=>G1,PI_OVER_FOUR:()=>M1,PI_OVER_SIX:()=>J1,PI_OVER_TWO:()=>R1,TWO_PI:()=>Y1});var Q1=.1,C1=.01,E1=.001,i1=1e-4,o1=1e-5,D1=1e-6,a1=1e-7,t1=1e-8,G1=1e-9,s1=1e-10,w1=1e-11,c1=1e-12,e1=1e-13,N1=1e-14,k1=1e-15,h1=1e-16,F1=1e-17,y1=1e-18,r1=1e-19,n1=1e-20,R1=Math.PI/2,M1=Math.PI/4,J1=Math.PI/6,Y1=Math.PI*2;var NL=new V,K1=new V,Po=class g{constructor(A=[0,0,0],I=[0,0,0],B){B=B||NL.copy(A).add(I).scale(.5),this.center=new V(B),this.halfDiagonal=new V(I).subtract(this.center),this.minimum=new V(A),this.maximum=new V(I)}clone(){return new g(this.minimum,this.maximum,this.center)}equals(A){return this===A||!!A&&this.minimum.equals(A.minimum)&&this.maximum.equals(A.maximum)}transform(A){return this.center.transformAsPoint(A),this.halfDiagonal.transform(A),this.minimum.transform(A),this.maximum.transform(A),this}intersectPlane(A){let{halfDiagonal:I}=this,B=K1.from(A.normal),Q=I.x*Math.abs(B.x)+I.y*Math.abs(B.y)+I.z*Math.abs(B.z),C=this.center.dot(B)+A.distance;return C-Q>0?ag.INSIDE:C+Q<0?ag.OUTSIDE:ag.INTERSECTING}distanceTo(A){return Math.sqrt(this.distanceSquaredTo(A))}distanceSquaredTo(A){let I=NL.from(A).subtract(this.center),{halfDiagonal:B}=this,Q=0,C;return C=Math.abs(I.x)-B.x,C>0&&(Q+=C*C),C=Math.abs(I.y)-B.y,C>0&&(Q+=C*C),C=Math.abs(I.z)-B.z,C>0&&(Q+=C*C),Q}};var CG=new V,kL=new V,Vo=class g{constructor(A=[0,0,0],I=0){this.radius=-0,this.center=new V,this.fromCenterRadius(A,I)}fromCenterRadius(A,I){return this.center.from(A),this.radius=I,this}fromCornerPoints(A,I){return I=CG.from(I),this.center=new V().from(A).add(I).scale(.5),this.radius=this.center.distance(I),this}equals(A){return this===A||!!A&&this.center.equals(A.center)&&this.radius===A.radius}clone(){return new g(this.center,this.radius)}union(A){let I=this.center,B=this.radius,Q=A.center,C=A.radius,E=CG.copy(Q).subtract(I),i=E.magnitude();if(B>=i+C)return this.clone();if(C>=i+B)return A.clone();let o=(B+i+C)*.5;return kL.copy(E).scale((-B+o)/i).add(I),this.center.copy(kL),this.radius=o,this}expand(A){let B=CG.from(A).subtract(this.center).magnitude();return B>this.radius&&(this.radius=B),this}transform(A){this.center.transform(A);let I=be.getScaling(CG,A);return this.radius=Math.max(I[0],Math.max(I[1],I[2]))*this.radius,this}distanceSquaredTo(A){let I=this.distanceTo(A);return I*I}distanceTo(A){let B=CG.from(A).subtract(this.center);return Math.max(0,B.len()-this.radius)}intersectPlane(A){let I=this.center,B=this.radius,C=A.normal.dot(I)+A.distance;return C<-B?ag.OUTSIDE:C<B?ag.INTERSECTING:ag.INSIDE}};var q1=new V,U1=new V,Ze=new V,Te=new V,Pe=new V,H1=new V,S1=new V,vQ={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},EG=class g{constructor(A=[0,0,0],I=[0,0,0,0,0,0,0,0,0]){this.center=new V().from(A),this.halfAxes=new Ig(I)}get halfSize(){let A=this.halfAxes.getColumn(0),I=this.halfAxes.getColumn(1),B=this.halfAxes.getColumn(2);return[new V(A).len(),new V(I).len(),new V(B).len()]}get quaternion(){let A=this.halfAxes.getColumn(0),I=this.halfAxes.getColumn(1),B=this.halfAxes.getColumn(2),Q=new V(A).normalize(),C=new V(I).normalize(),E=new V(B).normalize();return new To().fromMatrix3(new Ig([...Q,...C,...E]))}fromCenterHalfSizeQuaternion(A,I,B){let Q=new To(B),C=new Ig().fromQuaternion(Q);return C[0]=C[0]*I[0],C[1]=C[1]*I[0],C[2]=C[2]*I[0],C[3]=C[3]*I[1],C[4]=C[4]*I[1],C[5]=C[5]*I[1],C[6]=C[6]*I[2],C[7]=C[7]*I[2],C[8]=C[8]*I[2],this.center=new V().from(A),this.halfAxes=C,this}clone(){return new g(this.center,this.halfAxes)}equals(A){return this===A||!!A&&this.center.equals(A.center)&&this.halfAxes.equals(A.halfAxes)}getBoundingSphere(A=new Vo){let I=this.halfAxes,B=I.getColumn(0,Ze),Q=I.getColumn(1,Te),C=I.getColumn(2,Pe),E=q1.copy(B).add(Q).add(C);return A.center.copy(this.center),A.radius=E.magnitude(),A}intersectPlane(A){let I=this.center,B=A.normal,Q=this.halfAxes,C=B.x,E=B.y,i=B.z,o=Math.abs(C*Q[vQ.COLUMN0ROW0]+E*Q[vQ.COLUMN0ROW1]+i*Q[vQ.COLUMN0ROW2])+Math.abs(C*Q[vQ.COLUMN1ROW0]+E*Q[vQ.COLUMN1ROW1]+i*Q[vQ.COLUMN1ROW2])+Math.abs(C*Q[vQ.COLUMN2ROW0]+E*Q[vQ.COLUMN2ROW1]+i*Q[vQ.COLUMN2ROW2]),D=B.dot(I)+A.distance;return D<=-o?ag.OUTSIDE:D>=o?ag.INSIDE:ag.INTERSECTING}distanceTo(A){return Math.sqrt(this.distanceSquaredTo(A))}distanceSquaredTo(A){let I=U1.from(A).subtract(this.center),B=this.halfAxes,Q=B.getColumn(0,Ze),C=B.getColumn(1,Te),E=B.getColumn(2,Pe),i=Q.magnitude(),o=C.magnitude(),D=E.magnitude();Q.normalize(),C.normalize(),E.normalize();let a=0,t;return t=Math.abs(I.dot(Q))-i,t>0&&(a+=t*t),t=Math.abs(I.dot(C))-o,t>0&&(a+=t*t),t=Math.abs(I.dot(E))-D,t>0&&(a+=t*t),a}computePlaneDistances(A,I,B=[-0,-0]){let Q=Number.POSITIVE_INFINITY,C=Number.NEGATIVE_INFINITY,E=this.center,i=this.halfAxes,o=i.getColumn(0,Ze),D=i.getColumn(1,Te),a=i.getColumn(2,Pe),t=H1.copy(o).add(D).add(a).add(E),G=S1.copy(t).subtract(A),s=I.dot(G);return Q=Math.min(s,Q),C=Math.max(s,C),t.copy(E).add(o).add(D).subtract(a),G.copy(t).subtract(A),s=I.dot(G),Q=Math.min(s,Q),C=Math.max(s,C),t.copy(E).add(o).subtract(D).add(a),G.copy(t).subtract(A),s=I.dot(G),Q=Math.min(s,Q),C=Math.max(s,C),t.copy(E).add(o).subtract(D).subtract(a),G.copy(t).subtract(A),s=I.dot(G),Q=Math.min(s,Q),C=Math.max(s,C),E.copy(t).subtract(o).add(D).add(a),G.copy(t).subtract(A),s=I.dot(G),Q=Math.min(s,Q),C=Math.max(s,C),E.copy(t).subtract(o).add(D).subtract(a),G.copy(t).subtract(A),s=I.dot(G),Q=Math.min(s,Q),C=Math.max(s,C),E.copy(t).subtract(o).subtract(D).add(a),G.copy(t).subtract(A),s=I.dot(G),Q=Math.min(s,Q),C=Math.max(s,C),E.copy(t).subtract(o).subtract(D).subtract(a),G.copy(t).subtract(A),s=I.dot(G),Q=Math.min(s,Q),C=Math.max(s,C),B[0]=Q,B[1]=C,B}transform(A){this.center.transformAsPoint(A);let I=this.halfAxes.getColumn(0,Ze);I.transformAsPoint(A);let B=this.halfAxes.getColumn(1,Te);B.transformAsPoint(A);let Q=this.halfAxes.getColumn(2,Pe);return Q.transformAsPoint(A),this.halfAxes=new Ig([...I,...B,...Q]),this}getTransform(){throw new Error("not implemented")}};var hL=new V,FL=new V,_Q=class g{constructor(A=[0,0,1],I=0){this.normal=new V,this.distance=-0,this.fromNormalDistance(A,I)}fromNormalDistance(A,I){return cQ(Number.isFinite(I)),this.normal.from(A).normalize(),this.distance=I,this}fromPointNormal(A,I){A=hL.from(A),this.normal.from(I).normalize();let B=-this.normal.dot(A);return this.distance=B,this}fromCoefficients(A,I,B,Q){return this.normal.set(A,I,B),cQ(iE(this.normal.len(),1)),this.distance=Q,this}clone(){return new g(this.normal,this.distance)}equals(A){return iE(this.distance,A.distance)&&iE(this.normal,A.normal)}getPointDistance(A){return this.normal.dot(A)+this.distance}transform(A){let I=FL.copy(this.normal).transformAsVector(A).normalize(),B=this.normal.scale(-this.distance).transform(A);return this.fromPointNormal(B,I)}projectPointOntoPlane(A,I=[0,0,0]){let B=hL.from(A),Q=this.getPointDistance(B),C=FL.copy(this.normal).scale(Q);return B.subtract(C).to(I)}};var yL=[new V([1,0,0]),new V([0,1,0]),new V([0,0,1])],rL=new V,L1=new V,$Q=class g{constructor(A=[]){this.planes=A}fromBoundingSphere(A){this.planes.length=2*yL.length;let I=A.center,B=A.radius,Q=0;for(let C of yL){let E=this.planes[Q],i=this.planes[Q+1];E||(E=this.planes[Q]=new _Q),i||(i=this.planes[Q+1]=new _Q);let o=rL.copy(C).scale(-B).add(I);E.fromPointNormal(o,C);let D=rL.copy(C).scale(B).add(I),a=L1.copy(C).negate();i.fromPointNormal(D,a),Q+=2}return this}computeVisibility(A){let I=ag.INSIDE;for(let B of this.planes)switch(A.intersectPlane(B)){case ag.OUTSIDE:return ag.OUTSIDE;case ag.INTERSECTING:I=ag.INTERSECTING;break;default:}return I}computeVisibilityWithPlaneMask(A,I){if(cQ(Number.isFinite(I),"parentPlaneMask is required."),I===g.MASK_OUTSIDE||I===g.MASK_INSIDE)return I;let B=g.MASK_INSIDE,Q=this.planes;for(let C=0;C<this.planes.length;++C){let E=C<31?1<<C:0;if(C<31&&!(I&E))continue;let i=Q[C],o=A.intersectPlane(i);if(o===ag.OUTSIDE)return g.MASK_OUTSIDE;o===ag.INTERSECTING&&(B|=E)}return B}};$Q.MASK_OUTSIDE=4294967295;$Q.MASK_INSIDE=0;$Q.MASK_INDETERMINATE=2147483647;var JnA=new V,YnA=new V,KnA=new V,qnA=new V,UnA=new V;var lnA=new V,fnA=new V,mnA=new V,xnA=new V,unA=new V,WnA=new V,bnA=new V,ZnA=new V,TnA=new V,PnA=new V,VnA=new V,OnA=new V;var eQ=new Ig,p1=new Ig,l1=new Ig,Ve=new Ig,nL=new Ig;function Lr(g,A={}){let I=QG.EPSILON20,B=10,Q=0,C=0,E=p1,i=l1;E.identity(),i.copy(g);let o=I*f1(i);for(;C<B&&m1(i)>o;)x1(i,Ve),nL.copy(Ve).transpose(),i.multiplyRight(Ve),i.multiplyLeft(nL),E.multiplyRight(Ve),++Q>2&&(++C,Q=0);return A.unitary=E.toTarget(A.unitary),A.diagonal=i.toTarget(A.diagonal),A}function f1(g){let A=0;for(let I=0;I<9;++I){let B=g[I];A+=B*B}return Math.sqrt(A)}var Hr=[1,0,0],Sr=[2,2,1];function m1(g){let A=0;for(let I=0;I<3;++I){let B=g[eQ.getElementIndex(Sr[I],Hr[I])];A+=2*B*B}return Math.sqrt(A)}function x1(g,A){let I=QG.EPSILON15,B=0,Q=1;for(let D=0;D<3;++D){let a=Math.abs(g[eQ.getElementIndex(Sr[D],Hr[D])]);a>B&&(Q=D,B=a)}let C=Hr[Q],E=Sr[Q],i=1,o=0;if(Math.abs(g[eQ.getElementIndex(E,C)])>I){let D=g[eQ.getElementIndex(E,E)],a=g[eQ.getElementIndex(C,C)],t=g[eQ.getElementIndex(E,C)],G=(D-a)/2/t,s;G<0?s=-1/(-G+Math.sqrt(1+G*G)):s=1/(G+Math.sqrt(1+G*G)),i=1/Math.sqrt(1+s*s),o=s*i}return Ig.IDENTITY.to(A),A[eQ.getElementIndex(C,C)]=A[eQ.getElementIndex(E,E)]=i,A[eQ.getElementIndex(E,C)]=o,A[eQ.getElementIndex(C,E)]=-o,A}var DE=new V,u1=new V,W1=new V,b1=new V,Z1=new V,T1=new Ig,P1={diagonal:new Ig,unitary:new Ig};function dr(g,A=new EG){if(!g||g.length===0)return A.halfAxes=new Ig([0,0,0,0,0,0,0,0,0]),A.center=new V,A;let I=g.length,B=new V(0,0,0);for(let d of g)B.add(d);let Q=1/I;B.multiplyByScalar(Q);let C=0,E=0,i=0,o=0,D=0,a=0;for(let d of g){let K=DE.copy(d).subtract(B);C+=K.x*K.x,E+=K.x*K.y,i+=K.x*K.z,o+=K.y*K.y,D+=K.y*K.z,a+=K.z*K.z}C*=Q,E*=Q,i*=Q,o*=Q,D*=Q,a*=Q;let t=T1;t[0]=C,t[1]=E,t[2]=i,t[3]=E,t[4]=o,t[5]=D,t[6]=i,t[7]=D,t[8]=a;let{unitary:G}=Lr(t,P1),s=A.halfAxes.copy(G),w=s.getColumn(0,W1),e=s.getColumn(1,b1),c=s.getColumn(2,Z1),h=-Number.MAX_VALUE,R=-Number.MAX_VALUE,N=-Number.MAX_VALUE,y=Number.MAX_VALUE,r=Number.MAX_VALUE,J=Number.MAX_VALUE;for(let d of g)DE.copy(d),h=Math.max(DE.dot(w),h),R=Math.max(DE.dot(e),R),N=Math.max(DE.dot(c),N),y=Math.min(DE.dot(w),y),r=Math.min(DE.dot(e),r),J=Math.min(DE.dot(c),J);w=w.multiplyByScalar(.5*(y+h)),e=e.multiplyByScalar(.5*(r+R)),c=c.multiplyByScalar(.5*(J+N)),A.center.copy(w).add(e).add(c);let q=u1.set(h-y,R-r,N-J).multiplyByScalar(.5),H=new Ig([q[0],0,0,0,q[1],0,0,0,q[2]]);return A.halfAxes.multiplyRight(H),A}var Oo=512,RL=3,ML=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],JL=ML.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),V1=JL.concat([[.25,.5],[.75,.5]]),pr=class g{constructor(A,I,B){this.x=A,this.y=I,this.z=B}get children(){if(!this._children){let A=this.x*2,I=this.y*2,B=this.z+1;this._children=[new g(A,I,B),new g(A,I+1,B),new g(A+1,I,B),new g(A+1,I+1,B)]}return this._children}update(A){let{viewport:I,cullingVolume:B,elevationBounds:Q,minZ:C,maxZ:E,bounds:i,offset:o,project:D}=A,a=this.getBoundingVolume(Q,o,D);if(i&&!this.insideBounds(i)||B.computeVisibility(a)<0)return!1;if(!this.childVisible){let{z:G}=this;if(G<E&&G>=C){let s=a.distanceTo(I.cameraPosition)*I.scale/I.height;G+=Math.floor(Math.log2(s))}if(G>=E)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(let G of this.children)G.update(A);return!0}getSelected(A=[]){if(this.selected&&A.push(this),this._children)for(let I of this._children)I.getSelected(A);return A}insideBounds([A,I,B,Q]){let C=Math.pow(2,this.z),E=Oo/C;return this.x*E<B&&this.y*E<Q&&(this.x+1)*E>A&&(this.y+1)*E>I}getBoundingVolume(A,I,B){if(B){let o=this.z<1?V1:this.z<2?JL:ML,D=[];for(let a of o){let t=Oe(this.x+a[0],this.y+a[1],this.z);t[2]=A[0],D.push(B(t)),A[0]!==A[1]&&(t[2]=A[1],D.push(B(t)))}return dr(D)}let Q=Math.pow(2,this.z),C=Oo/Q,E=this.x*C+I*Oo,i=Oo-(this.y+1)*C;return new Po([E,i,A[0]],[E+C,i+C,A[1]])}};function YL(g,A,I,B){let Q=g instanceof oi&&g.resolution?g.projectPosition:null,C=Object.values(g.getFrustumPlanes()).map(({normal:s,distance:w})=>new _Q(s.clone().negate(),w)),E=new $Q(C),i=g.distanceScales.unitsPerMeter[2],o=I&&I[0]*i||0,D=I&&I[1]*i||0,a=g instanceof ZQ&&g.pitch<=60?A:0;if(B){let[s,w,e,c]=B,h=gI([s,c]),R=gI([e,w]);B=[h[0],Oo-h[1],R[0],Oo-R[1]]}let t=new pr(0,0,0),G={viewport:g,project:Q,cullingVolume:E,elevationBounds:[o,D],minZ:a,maxZ:A,bounds:B,offset:0};if(t.update(G),g instanceof ZQ&&g.subViewports&&g.subViewports.length>1){for(G.offset=-1;t.update(G)&&!(--G.offset<-RL););for(G.offset=1;t.update(G)&&!(++G.offset>RL););}return t.getSelected()}var AC=512,O1=[-1/0,-1/0,1/0,1/0],fr={type:"object",value:null,validate:(g,A)=>A.optional&&g===null||typeof g=="string"||Array.isArray(g)&&g.every(I=>typeof I=="string"),equal:(g,A)=>{if(g===A)return!0;if(!Array.isArray(g)||!Array.isArray(A))return!1;let I=g.length;if(I!==A.length)return!1;for(let B=0;B<I;B++)if(g[B]!==A[B])return!1;return!0}};function qL(g,A){let I=[A.transformAsPoint([g[0],g[1]]),A.transformAsPoint([g[2],g[1]]),A.transformAsPoint([g[0],g[3]]),A.transformAsPoint([g[2],g[3]])];return[Math.min(...I.map(Q=>Q[0])),Math.min(...I.map(Q=>Q[1])),Math.max(...I.map(Q=>Q[0])),Math.max(...I.map(Q=>Q[1]))]}function j1(g){return Math.abs(g.split("").reduce((A,I)=>(A<<5)-A+I.charCodeAt(0)|0,0))}function mr(g,A){if(!g||!g.length)return null;let{index:I,id:B}=A;if(Array.isArray(g)){let C=j1(B)%g.length;g=g[C]}let Q=g;for(let C of Object.keys(I)){let E=new RegExp(`{${C}}`,"g");Q=Q.replace(E,String(I[C]))}return Number.isInteger(I.y)&&Number.isInteger(I.z)&&(Q=Q.replace(/\{-y\}/g,String(Math.pow(2,I.z)-I.y-1))),Q}function X1(g,A,I){let B;if(A&&A.length===2){let[Q,C]=A,E=g.getBounds({z:Q}),i=g.getBounds({z:C});B=[Math.min(E[0],i[0]),Math.min(E[1],i[1]),Math.max(E[2],i[2]),Math.max(E[3],i[3])]}else B=g.getBounds();return g.isGeospatial?[Math.max(B[0],I[0]),Math.max(B[1],I[1]),Math.min(B[2],I[2]),Math.min(B[3],I[3])]:[Math.max(Math.min(B[0],I[2]),I[0]),Math.max(Math.min(B[1],I[3]),I[1]),Math.min(Math.max(B[2],I[0]),I[2]),Math.min(Math.max(B[3],I[1]),I[3])]}function UL({viewport:g,z:A,cullRect:I}){return(g.subViewports||[g]).map(Q=>lr(Q,A||0,I))}function lr(g,A,I){if(!Array.isArray(A)){let C=I.x-g.x,E=I.y-g.y,{width:i,height:o}=I,D={targetZ:A},a=g.unproject([C,E],D),t=g.unproject([C+i,E],D),G=g.unproject([C,E+o],D),s=g.unproject([C+i,E+o],D);return[Math.min(a[0],t[0],G[0],s[0]),Math.min(a[1],t[1],G[1],s[1]),Math.max(a[0],t[0],G[0],s[0]),Math.max(a[1],t[1],G[1],s[1])]}let B=lr(g,A[0],I),Q=lr(g,A[1],I);return[Math.min(B[0],Q[0]),Math.min(B[1],Q[1]),Math.max(B[2],Q[2]),Math.max(B[3],Q[3])]}function z1(g,A,I){return I?qL(g,I).map(Q=>Q*A/AC):g.map(B=>B*A/AC)}function xr(g,A){return Math.pow(2,g)*AC/A}function Oe(g,A,I){let B=xr(I,AC),Q=g/B*360-180,C=Math.PI-2*Math.PI*A/B,E=180/Math.PI*Math.atan(.5*(Math.exp(C)-Math.exp(-C)));return[Q,E]}function KL(g,A,I,B){let Q=xr(I,B);return[g/Q*AC,A/Q*AC]}function ur(g,A,I,B,Q=AC){if(g.isGeospatial){let[D,a]=Oe(A,I,B),[t,G]=Oe(A+1,I+1,B);return{west:D,north:a,east:t,south:G}}let[C,E]=KL(A,I,B,Q),[i,o]=KL(A+1,I+1,B,Q);return{left:C,top:E,right:i,bottom:o}}function v1(g,A,I,B,Q){let C=X1(g,null,B),E=xr(A,I),[i,o,D,a]=z1(C,E,Q),t=[];for(let G=Math.floor(i);G<D;G++)for(let s=Math.floor(o);s<a;s++)t.push({x:G,y:s,z:A});return t}function Wr({viewport:g,maxZoom:A,minZoom:I,zRange:B,extent:Q,tileSize:C=AC,modelMatrix:E,modelMatrixInverse:i,zoomOffset:o=0}){let D=g.isGeospatial?Math.round(g.zoom+Math.log2(AC/C))+o:Math.ceil(g.zoom)+o;if(typeof I=="number"&&Number.isFinite(I)&&D<I){if(!Q)return[];D=I}typeof A=="number"&&Number.isFinite(A)&&D>A&&(D=A);let a=Q;return E&&i&&Q&&!g.isGeospatial&&(a=qL(Q,E)),g.isGeospatial?YL(g,D,B,Q):v1(g,D,C,a||O1,i)}function HL(g){let A={},I;return B=>{for(let Q in B)if(!_1(B[Q],A[Q])){I=g(B),A=B;break}return I}}function _1(g,A){if(g===A)return!0;if(Array.isArray(g)){let I=g.length;if(!A||A.length!==I)return!1;for(let B=0;B<I;B++)if(g[B]!==A[B])return!1;return!0}return!1}var SL=1,je=2,$1="never",Az="no-overlap",iG="best-available",gz=5,Iz={[iG]:Qz,[Az]:Cz,[$1]:()=>{}},Bz={extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:"best-available",zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{}},jo=class{constructor(A){this._getCullBounds=HL(UL),this.opts={...Bz,...A},this.setOptions(this.opts),this.onTileLoad=I=>{this.opts.onTileLoad?.(I),this.opts.maxCacheByteSize!=null&&(this._cacheByteSize+=I.byteLength,this._resizeCache())},this._requestScheduler=new zi({throttleRequests:this.opts.maxRequests>0||this.opts.debounceTime>0,maxRequests:this.opts.maxRequests,debounceTime:this.opts.debounceTime}),this._cache=new Map,this._tiles=[],this._dirty=!1,this._cacheByteSize=0,this._viewport=null,this._zRange=null,this._selectedTiles=null,this._frameNumber=0,this._modelMatrix=new uA,this._modelMatrixInverse=new uA}get tiles(){return this._tiles}get selectedTiles(){return this._selectedTiles}get isLoaded(){return this._selectedTiles!==null&&this._selectedTiles.every(A=>A.isLoaded)}get needsReload(){return this._selectedTiles!==null&&this._selectedTiles.some(A=>A.needsReload)}setOptions(A){Object.assign(this.opts,A),Number.isFinite(A.maxZoom)&&(this._maxZoom=Math.floor(A.maxZoom)),Number.isFinite(A.minZoom)&&(this._minZoom=Math.ceil(A.minZoom))}finalize(){for(let A of this._cache.values())A.isLoading&&A.abort();this._cache.clear(),this._tiles=[],this._selectedTiles=null}reloadAll(){for(let A of this._cache.keys()){let I=this._cache.get(A);!this._selectedTiles||!this._selectedTiles.includes(I)?this._cache.delete(A):I.setNeedsReload()}}update(A,{zRange:I,modelMatrix:B}={zRange:null,modelMatrix:null}){let Q=B?new uA(B):new uA,C=!Q.equals(this._modelMatrix);if(!this._viewport||!A.equals(this._viewport)||!wB(this._zRange,I)||C){C&&(this._modelMatrixInverse=Q.clone().invert(),this._modelMatrix=Q),this._viewport=A,this._zRange=I;let i=this.getTileIndices({viewport:A,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:I,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=i.map(o=>this._getTile(o,!0)),this._dirty&&this._rebuildTree()}else this.needsReload&&(this._selectedTiles=this._selectedTiles.map(i=>this._getTile(i.index,!0)));let E=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),E&&this._frameNumber++,this._frameNumber}isTileVisible(A,I){if(!A.isVisible)return!1;if(I&&this._viewport){let B=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:I}),{bbox:Q}=A;for(let[C,E,i,o]of B){let D;if("west"in Q)D=Q.west<i&&Q.east>C&&Q.south<o&&Q.north>E;else{let a=Math.min(Q.top,Q.bottom),t=Math.max(Q.top,Q.bottom);D=Q.left<i&&Q.right>C&&a<o&&t>E}if(D)return!0}return!1}return!0}getTileIndices({viewport:A,maxZoom:I,minZoom:B,zRange:Q,modelMatrix:C,modelMatrixInverse:E}){let{tileSize:i,extent:o,zoomOffset:D}=this.opts;return Wr({viewport:A,maxZoom:I,minZoom:B,zRange:Q,tileSize:i,extent:o,modelMatrix:C,modelMatrixInverse:E,zoomOffset:D})}getTileId(A){return`${A.x}-${A.y}-${A.z}`}getTileZoom(A){return A.z}getTileMetadata(A){let{tileSize:I}=this.opts;return{bbox:ur(this._viewport,A.x,A.y,A.z,I)}}getParentIndex(A){let I=Math.floor(A.x/2),B=Math.floor(A.y/2),Q=A.z-1;return{x:I,y:B,z:Q}}updateTileStates(){let A=this.opts.refinementStrategy||iG,I=new Array(this._cache.size),B=0;for(let Q of this._cache.values())I[B++]=Q.isVisible,Q.isSelected=!1,Q.isVisible=!1;for(let Q of this._selectedTiles)Q.isSelected=!0,Q.isVisible=!0;(typeof A=="function"?A:Iz[A])(Array.from(this._cache.values())),B=0;for(let Q of this._cache.values())if(I[B++]!==Q.isVisible)return!0;return!1}_pruneRequests(){let{maxRequests:A=0}=this.opts,I=[],B=0;for(let Q of this._cache.values())Q.isLoading&&(B++,!Q.isSelected&&!Q.isVisible&&I.push(Q));for(;A>0&&B>A&&I.length>0;)I.shift().abort(),B--}_rebuildTree(){let{_cache:A}=this;for(let I of A.values())I.parent=null,I.children&&(I.children.length=0);for(let I of A.values()){let B=this._getNearestAncestor(I);I.parent=B,B?.children&&B.children.push(I)}}_resizeCache(){let{_cache:A,opts:I}=this,B=I.maxCacheSize??(I.maxCacheByteSize!=null?1/0:gz*this.selectedTiles.length),Q=I.maxCacheByteSize??1/0;if(A.size>B||this._cacheByteSize>Q){for(let[E,i]of A)if(!i.isVisible&&!i.isSelected&&(this._cacheByteSize-=I.maxCacheByteSize!=null?i.byteLength:0,A.delete(E),this.opts.onTileUnload?.(i)),A.size<=B&&this._cacheByteSize<=Q)break;this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((E,i)=>E.zoom-i.zoom),this._dirty=!1)}_getTile(A,I){let B=this.getTileId(A),Q=this._cache.get(B),C=!1;return!Q&&I?(Q=new Ue(A),Object.assign(Q,this.getTileMetadata(Q.index)),Object.assign(Q,{id:B,zoom:this.getTileZoom(Q.index)}),C=!0,this._cache.set(B,Q),this._dirty=!0):Q&&Q.needsReload&&(C=!0),Q&&C&&Q.loadData({getData:this.opts.getTileData,requestScheduler:this._requestScheduler,onLoad:this.onTileLoad,onError:this.opts.onTileError}),Q}_getNearestAncestor(A){let{_minZoom:I=0}=this,B=A.index;for(;this.getTileZoom(B)>I;){B=this.getParentIndex(B);let Q=this._getTile(B);if(Q)return Q}return null}};function Qz(g){for(let A of g)A.state=0;for(let A of g)A.isSelected&&!LL(A)&&br(A);for(let A of g)A.isVisible=!!(A.state&je)}function Cz(g){for(let I of g)I.state=0;for(let I of g)I.isSelected&&LL(I);let A=Array.from(g).sort((I,B)=>I.zoom-B.zoom);for(let I of A)if(I.isVisible=!!(I.state&je),I.children&&(I.isVisible||I.state&SL))for(let B of I.children)B.state=SL;else I.isSelected&&br(I)}function LL(g){let A=g;for(;A;){if(A.isLoaded||A.content)return A.state|=je,!0;A=A.parent}return!1}function br(g){for(let A of g.children)A.isLoaded||A.content?A.state|=je:br(A)}var Ez={TilesetClass:jo,data:{type:"data",value:[]},dataComparator:fr.equal,renderSubLayers:{type:"function",value:g=>new qe(g)},getTileData:{type:"function",optional:!0,value:null},onViewportLoad:{type:"function",optional:!0,value:null},onTileLoad:{type:"function",value:g=>{}},onTileUnload:{type:"function",value:g=>{}},onTileError:{type:"function",value:g=>console.error(g)},extent:{type:"array",optional:!0,value:null,compare:!0},tileSize:512,maxZoom:null,minZoom:0,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:iG,zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0},oG=class extends wQ{initializeState(){this.state={tileset:null,isLoaded:!1}}finalizeState(){this.state?.tileset?.finalize()}get isLoaded(){return!!this.state?.tileset?.selectedTiles?.every(A=>A.isLoaded&&A.layers&&A.layers.every(I=>I.isLoaded))}shouldUpdateState({changeFlags:A}){return A.somethingChanged}updateState({changeFlags:A}){let{tileset:I}=this.state,B=A.propsOrDataChanged||A.updateTriggersChanged,Q=A.dataChanged||A.updateTriggersChanged&&(A.updateTriggersChanged.all||A.updateTriggersChanged.getTileData);I?B&&(I.setOptions(this._getTilesetOptions()),Q?I.reloadAll():I.tiles.forEach(C=>{C.layers=null})):(I=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:I})),this._updateTileset()}_getTilesetOptions(){let{tileSize:A,maxCacheSize:I,maxCacheByteSize:B,refinementStrategy:Q,extent:C,maxZoom:E,minZoom:i,maxRequests:o,debounceTime:D,zoomOffset:a}=this.props;return{maxCacheSize:I,maxCacheByteSize:B,maxZoom:E,minZoom:i,tileSize:A,refinementStrategy:Q,extent:C,maxRequests:o,debounceTime:D,zoomOffset:a,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}_updateTileset(){let A=this.state.tileset,{zRange:I,modelMatrix:B}=this.props,Q=A.update(this.context.viewport,{zRange:I,modelMatrix:B}),{isLoaded:C}=A,E=this.state.isLoaded!==C,i=this.state.frameNumber!==Q;C&&(E||i)&&this._onViewportLoad(),i&&this.setState({frameNumber:Q}),this.state.isLoaded=C}_onViewportLoad(){let{tileset:A}=this.state,{onViewportLoad:I}=this.props;I&&I(A.selectedTiles)}_onTileLoad(A){this.props.onTileLoad(A),A.layers=null,this.setNeedsUpdate()}_onTileError(A,I){this.props.onTileError(A),I.layers=null,this.setNeedsUpdate()}_onTileUnload(A){this.props.onTileUnload(A)}getTileData(A){let{data:I,getTileData:B,fetch:Q}=this.props,{signal:C}=A;return A.url=typeof I=="string"||Array.isArray(I)?mr(I,A):null,B?B(A):Q&&A.url?Q(A.url,{propName:"data",layer:this,signal:C}):null}renderSubLayers(A){return this.props.renderSubLayers(A)}getSubLayerPropsByTile(A){return null}getPickingInfo(A){let I=A.sourceLayer,B=I.props.tile,Q=A.info;return Q.picked&&(Q.tile=B),Q.sourceTile=B,Q.sourceTileSubLayer=I,Q}_updateAutoHighlight(A){A.sourceTileSubLayer.updateAutoHighlight(A)}renderLayers(){return this.state.tileset.tiles.map(A=>{let I=this.getSubLayerPropsByTile(A);if(!(!A.isLoaded&&!A.content))if(A.layers)I&&A.layers[0]&&Object.keys(I).some(B=>A.layers[0].props[B]!==I[B])&&(A.layers=A.layers.map(B=>B.clone(I)));else{let B=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:A.id,updateTriggers:this.props.updateTriggers}),data:A.content,_offset:0,tile:A});A.layers=PQ(B,Boolean).map(Q=>Q.clone({tile:A,...I}))}return A.layers})}filterSubLayer({layer:A,cullRect:I}){let{tile:B}=A.props;return this.state.tileset.isTileVisible(B,I)}};oG.defaultProps=Ez;oG.layerName="TileLayer";var Xo=oG;var Xe=(g,A,I)=>new AE({parent:g,controller:{doubleClickZoom:!1},width:A,height:I});var zo=()=>[new IB({id:"ortho"})];var SA={},vo=g=>{SA={fetch:{headers:{}}},g&&(SA.fetch.headers.Authorization=`Bearer ${g}`)};var Gi={};Gi.EPSILON=1e-12;Gi.debug=!0;Gi.precision=4;Gi.printTypes=!1;Gi.printDegrees=!1;Gi.printRowMajor=!0;function dL(g){return Array.isArray(g)||ArrayBuffer.isView(g)&&g.length!==void 0}function pL(g){return g.clone?g.clone():new Array(g)}function iz(g,A){if(dL(g)){for(var I=pL(g),B=0;B<I.length;++B)I[B]=A(I[B],B,I);return I}return A(g)}function NQ(g,A,I){return iz(g,function(B){return Math.max(A,Math.min(I,B))})}var ze=class extends lo{getShaders(){let A=super.getShaders();return A.inject={"fs:#decl":"uniform vec3 uColor; uniform float uOpacityScale;","fs:DECKGL_FILTER_COLOR":`
|
|
1687
|
+
`;var j9={billboard:!0,sizeScale:1,sizeUnits:"pixels",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,padding:{type:"array",value:[0,0,0,0]},getPosition:{type:"accessor",value:g=>g.position},getSize:{type:"accessor",value:1},getAngle:{type:"accessor",value:0},getPixelOffset:{type:"accessor",value:[0,0]},getBoundingRect:{type:"accessor",value:[0,0,0,0]},getFillColor:{type:"accessor",value:[0,0,0,255]},getLineColor:{type:"accessor",value:[0,0,0,255]},getLineWidth:{type:"accessor",value:1}},_t=class extends Og{getShaders(){return super.getShaders({vs:oS,fs:DS,modules:[AI,II]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceSizes:{size:1,transition:!0,accessor:"getSize",defaultValue:1},instanceAngles:{size:1,transition:!0,accessor:"getAngle"},instanceRects:{size:4,accessor:"getBoundingRect"},instancePixelOffsets:{size:2,transition:!0,accessor:"getPixelOffset"},instanceFillColors:{size:4,transition:!0,type:"unorm8",accessor:"getFillColor",defaultValue:[0,0,0,255]},instanceLineColors:{size:4,transition:!0,type:"unorm8",accessor:"getLineColor",defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:!0,accessor:"getLineWidth",defaultValue:1}})}updateState(A){super.updateState(A);let{changeFlags:I}=A;I.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw({uniforms:A}){let{billboard:I,sizeScale:B,sizeUnits:Q,sizeMinPixels:C,sizeMaxPixels:E,getLineWidth:i}=this.props,{padding:o}=this.props;o.length<4&&(o=[o[0],o[1],o[0],o[1]]);let D=this.state.model;D.setUniforms(A),D.setUniforms({billboard:I,stroked:!!i,padding:o,sizeUnits:GI[Q],sizeScale:B,sizeMinPixels:C,sizeMaxPixels:E}),D.draw(this.context.renderPass)}_getModel(){let A=[0,0,1,0,1,1,0,1];return new cg(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new sI({topology:"triangle-fan-webgl",vertexCount:4,attributes:{positions:{size:2,value:new Float32Array(A)}}}),isInstanced:!0})}};_t.defaultProps=j9;_t.layerName="TextBackgroundLayer";var aS=_t;var tS={start:1,middle:0,end:-1},GS={top:1,center:0,bottom:-1},kr=[0,0,0,255],X9=1,z9={billboard:!0,sizeScale:1,sizeUnits:"pixels",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,background:!1,getBackgroundColor:{type:"accessor",value:[255,255,255,255]},getBorderColor:{type:"accessor",value:kr},getBorderWidth:{type:"accessor",value:0},backgroundPadding:{type:"array",value:[0,0,0,0]},characterSet:{type:"object",value:ai.characterSet},fontFamily:ai.fontFamily,fontWeight:ai.fontWeight,lineHeight:X9,outlineWidth:{type:"number",value:0,min:0},outlineColor:{type:"color",value:kr},fontSettings:{type:"object",value:{},compare:1},wordBreak:"break-word",maxWidth:{type:"number",value:-1},getText:{type:"accessor",value:g=>g.text},getPosition:{type:"accessor",value:g=>g.position},getColor:{type:"accessor",value:kr},getSize:{type:"accessor",value:32},getAngle:{type:"accessor",value:0},getTextAnchor:{type:"accessor",value:"middle"},getAlignmentBaseline:{type:"accessor",value:"center"},getPixelOffset:{type:"accessor",value:[0,0]},backgroundColor:{deprecatedFor:["background","getBackgroundColor"]}},$t=class extends wQ{constructor(){super(...arguments),this.getBoundingRect=(A,I)=>{let{size:[B,Q]}=this.transformParagraph(A,I),{fontSize:C}=this.state.fontAtlasManager.props;B/=C,Q/=C;let{getTextAnchor:E,getAlignmentBaseline:i}=this.props,o=tS[typeof E=="function"?E(A,I):E],D=GS[typeof i=="function"?i(A,I):i];return[(o-1)*B/2,(D-1)*Q/2,B,Q]},this.getIconOffsets=(A,I)=>{let{getTextAnchor:B,getAlignmentBaseline:Q}=this.props,{x:C,y:E,rowWidth:i,size:[o,D]}=this.transformParagraph(A,I),a=tS[typeof B=="function"?B(A,I):B],t=GS[typeof Q=="function"?Q(A,I):Q],G=C.length,s=new Array(G*2),w=0;for(let e=0;e<G;e++){let c=(1-a)*(o-i[e])/2;s[w++]=(a-1)*o/2+c+C[e],s[w++]=(t-1)*D/2+E[e]}return s}}initializeState(){this.state={styleVersion:0,fontAtlasManager:new vt},this.props.maxWidth>0&&X.warn("v8.9 breaking change: TextLayer maxWidth is now relative to text size")()}updateState(A){let{props:I,oldProps:B,changeFlags:Q}=A;(Q.dataChanged||Q.updateTriggersChanged&&(Q.updateTriggersChanged.all||Q.updateTriggersChanged.getText))&&this._updateText(),(this._updateFontAtlas()||I.lineHeight!==B.lineHeight||I.wordBreak!==B.wordBreak||I.maxWidth!==B.maxWidth)&&this.setState({styleVersion:this.state.styleVersion+1})}getPickingInfo({info:A}){return A.object=A.index>=0?this.props.data[A.index]:null,A}_updateFontAtlas(){let{fontSettings:A,fontFamily:I,fontWeight:B}=this.props,{fontAtlasManager:Q,characterSet:C}=this.state,E={...A,characterSet:C,fontFamily:I,fontWeight:B};if(!Q.mapping)return Q.setProps(E),!0;for(let i in E)if(E[i]!==Q.props[i])return Q.setProps(E),!0;return!1}_updateText(){let{data:A,characterSet:I}=this.props,B=A.attributes?.getText,{getText:Q}=this.props,C=A.startIndices,E,i=I==="auto"&&new Set;if(B&&C){let{texts:o,characterCount:D}=gS({...ArrayBuffer.isView(B)?{value:B}:B,length:A.length,startIndices:C,characterSet:i});E=D,Q=(a,{index:t})=>o[t]}else{let{iterable:o,objectInfo:D}=gB(A);C=[0],E=0;for(let a of o){D.index++;let t=Array.from(Q(a,D)||"");i&&t.forEach(i.add,i),E+=t.length,C.push(E)}}this.setState({getText:Q,startIndices:C,numInstances:E,characterSet:i||I})}transformParagraph(A,I){let{fontAtlasManager:B}=this.state,Q=B.mapping,C=this.state.getText,{wordBreak:E,lineHeight:i,maxWidth:o}=this.props,D=C(A,I)||"";return AS(D,i,E,o*B.props.fontSize,Q)}renderLayers(){let{startIndices:A,numInstances:I,getText:B,fontAtlasManager:{scale:Q,atlas:C,mapping:E},styleVersion:i}=this.state,{data:o,_dataDiff:D,getPosition:a,getColor:t,getSize:G,getAngle:s,getPixelOffset:w,getBackgroundColor:e,getBorderColor:c,getBorderWidth:h,backgroundPadding:R,background:N,billboard:y,fontSettings:r,outlineWidth:J,outlineColor:q,sizeScale:H,sizeUnits:d,sizeMinPixels:K,sizeMaxPixels:x,transitions:W,updateTriggers:u}=this.props,m=this.getSubLayerClass("characters",jH),_=this.getSubLayerClass("background",aS);return[N&&new _({getFillColor:e,getLineColor:c,getLineWidth:h,padding:R,getPosition:a,getSize:G,getAngle:s,getPixelOffset:w,billboard:y,sizeScale:H,sizeUnits:d,sizeMinPixels:K,sizeMaxPixels:x,transitions:W&&{getPosition:W.getPosition,getAngle:W.getAngle,getSize:W.getSize,getFillColor:W.getBackgroundColor,getLineColor:W.getBorderColor,getLineWidth:W.getBorderWidth,getPixelOffset:W.getPixelOffset}},this.getSubLayerProps({id:"background",updateTriggers:{getPosition:u.getPosition,getAngle:u.getAngle,getSize:u.getSize,getFillColor:u.getBackgroundColor,getLineColor:u.getBorderColor,getLineWidth:u.getBorderWidth,getPixelOffset:u.getPixelOffset,getBoundingRect:{getText:u.getText,getTextAnchor:u.getTextAnchor,getAlignmentBaseline:u.getAlignmentBaseline,styleVersion:i}}}),{data:o.attributes&&o.attributes.background?{length:o.length,attributes:o.attributes.background}:o,_dataDiff:D,autoHighlight:!1,getBoundingRect:this.getBoundingRect}),new m({sdf:r.sdf,smoothing:Number.isFinite(r.smoothing)?r.smoothing:ai.smoothing,outlineWidth:J/(r.radius||ai.radius),outlineColor:q,iconAtlas:C,iconMapping:E,getPosition:a,getColor:t,getSize:G,getAngle:s,getPixelOffset:w,billboard:y,sizeScale:H*Q,sizeUnits:d,sizeMinPixels:K*Q,sizeMaxPixels:x*Q,transitions:W&&{getPosition:W.getPosition,getAngle:W.getAngle,getColor:W.getColor,getSize:W.getSize,getPixelOffset:W.getPixelOffset}},this.getSubLayerProps({id:"characters",updateTriggers:{all:u.getText,getPosition:u.getPosition,getAngle:u.getAngle,getColor:u.getColor,getSize:u.getSize,getPixelOffset:u.getPixelOffset,getIconOffsets:{getTextAnchor:u.getTextAnchor,getAlignmentBaseline:u.getAlignmentBaseline,styleVersion:i}}}),{data:o,_dataDiff:D,startIndices:A,numInstances:I,getIconOffsets:this.getIconOffsets,getIcon:B})]}static set fontAtlasCacheLimit(A){iS(A)}};$t.defaultProps=z9;$t.layerName="TextLayer";var ti=$t;var AG={circle:{type:BB,props:{filled:"filled",stroked:"stroked",lineWidthMaxPixels:"lineWidthMaxPixels",lineWidthMinPixels:"lineWidthMinPixels",lineWidthScale:"lineWidthScale",lineWidthUnits:"lineWidthUnits",pointRadiusMaxPixels:"radiusMaxPixels",pointRadiusMinPixels:"radiusMinPixels",pointRadiusScale:"radiusScale",pointRadiusUnits:"radiusUnits",pointAntialiasing:"antialiasing",pointBillboard:"billboard",getFillColor:"getFillColor",getLineColor:"getLineColor",getLineWidth:"getLineWidth",getPointRadius:"getRadius"}},icon:{type:Lt,props:{iconAtlas:"iconAtlas",iconMapping:"iconMapping",iconSizeMaxPixels:"sizeMaxPixels",iconSizeMinPixels:"sizeMinPixels",iconSizeScale:"sizeScale",iconSizeUnits:"sizeUnits",iconAlphaCutoff:"alphaCutoff",iconBillboard:"billboard",getIcon:"getIcon",getIconAngle:"getAngle",getIconColor:"getColor",getIconPixelOffset:"getPixelOffset",getIconSize:"getSize"}},text:{type:ti,props:{textSizeMaxPixels:"sizeMaxPixels",textSizeMinPixels:"sizeMinPixels",textSizeScale:"sizeScale",textSizeUnits:"sizeUnits",textBackground:"background",textBackgroundPadding:"backgroundPadding",textFontFamily:"fontFamily",textFontWeight:"fontWeight",textLineHeight:"lineHeight",textMaxWidth:"maxWidth",textOutlineColor:"outlineColor",textOutlineWidth:"outlineWidth",textWordBreak:"wordBreak",textCharacterSet:"characterSet",textBillboard:"billboard",textFontSettings:"fontSettings",getText:"getText",getTextAngle:"getAngle",getTextColor:"getColor",getTextPixelOffset:"getPixelOffset",getTextSize:"getSize",getTextAnchor:"getTextAnchor",getTextAlignmentBaseline:"getAlignmentBaseline",getTextBackgroundColor:"getBackgroundColor",getTextBorderColor:"getBorderColor",getTextBorderWidth:"getBorderWidth"}}},gG={type:QE,props:{lineWidthUnits:"widthUnits",lineWidthScale:"widthScale",lineWidthMinPixels:"widthMinPixels",lineWidthMaxPixels:"widthMaxPixels",lineJointRounded:"jointRounded",lineCapRounded:"capRounded",lineMiterLimit:"miterLimit",lineBillboard:"billboard",getLineColor:"getColor",getLineWidth:"getWidth"}},Je={type:EE,props:{extruded:"extruded",filled:"filled",wireframe:"wireframe",elevationScale:"elevationScale",material:"material",_full3d:"_full3d",getElevation:"getElevation",getFillColor:"getFillColor",getLineColor:"getLineColor"}};function uo({type:g,props:A}){let I={};for(let B in A)I[B]=g.defaultProps[A[B]];return I}function Ye(g,A){let{transitions:I,updateTriggers:B}=g.props,Q={updateTriggers:{},transitions:I&&{getPosition:I.geometry}};for(let C in A){let E=A[C],i=g.props[C];C.startsWith("get")&&(i=g.getSubLayerAccessor(i),Q.updateTriggers[E]=B[C],I&&(Q.transitions[E]=I[C])),Q[E]=i}return Q}function wS(g){if(Array.isArray(g))return g;switch(X.assert(g.type,"GeoJSON does not have type"),g.type){case"Feature":return[g];case"FeatureCollection":return X.assert(Array.isArray(g.features),"GeoJSON does not have features array"),g.features;default:return[{geometry:g}]}}function hr(g,A,I={}){let B={pointFeatures:[],lineFeatures:[],polygonFeatures:[],polygonOutlineFeatures:[]},{startRow:Q=0,endRow:C=g.length}=I;for(let E=Q;E<C;E++){let i=g[E],{geometry:o}=i;if(o)if(o.type==="GeometryCollection"){X.assert(Array.isArray(o.geometries),"GeoJSON does not have geometries array");let{geometries:D}=o;for(let a=0;a<D.length;a++){let t=D[a];sS(t,B,A,i,E)}}else sS(o,B,A,i,E)}return B}function sS(g,A,I,B,Q){let{type:C,coordinates:E}=g,{pointFeatures:i,lineFeatures:o,polygonFeatures:D,polygonOutlineFeatures:a}=A;if(!_9(C,E)){X.warn(`${C} coordinates are malformed`)();return}switch(C){case"Point":i.push(I({geometry:g},B,Q));break;case"MultiPoint":E.forEach(t=>{i.push(I({geometry:{type:"Point",coordinates:t}},B,Q))});break;case"LineString":o.push(I({geometry:g},B,Q));break;case"MultiLineString":E.forEach(t=>{o.push(I({geometry:{type:"LineString",coordinates:t}},B,Q))});break;case"Polygon":D.push(I({geometry:g},B,Q)),E.forEach(t=>{a.push(I({geometry:{type:"LineString",coordinates:t}},B,Q))});break;case"MultiPolygon":E.forEach(t=>{D.push(I({geometry:{type:"Polygon",coordinates:t}},B,Q)),t.forEach(G=>{a.push(I({geometry:{type:"LineString",coordinates:G}},B,Q))})});break;default:}}var v9={Point:1,MultiPoint:2,LineString:2,MultiLineString:3,Polygon:3,MultiPolygon:4};function _9(g,A){let I=v9[g];for(X.assert(I,`Unknown GeoJSON type ${g}`);A&&--I>0;)A=A[0];return A&&Number.isFinite(A[0])}function cS(){return{points:{},lines:{},polygons:{},polygonsOutline:{}}}function Ke(g){return g.geometry.coordinates}function eS(g,A){let I=cS(),{pointFeatures:B,lineFeatures:Q,polygonFeatures:C,polygonOutlineFeatures:E}=g;return I.points.data=B,I.points._dataDiff=A.pointFeatures&&(()=>A.pointFeatures),I.points.getPosition=Ke,I.lines.data=Q,I.lines._dataDiff=A.lineFeatures&&(()=>A.lineFeatures),I.lines.getPath=Ke,I.polygons.data=C,I.polygons._dataDiff=A.polygonFeatures&&(()=>A.polygonFeatures),I.polygons.getPolygon=Ke,I.polygonsOutline.data=E,I.polygonsOutline._dataDiff=A.polygonOutlineFeatures&&(()=>A.polygonOutlineFeatures),I.polygonsOutline.getPath=Ke,I}function NS(g,A){let I=cS(),{points:B,lines:Q,polygons:C}=g,E=PH(g,A);return I.points.data={length:B.positions.value.length/B.positions.size,attributes:{...B.attributes,getPosition:B.positions,instancePickingColors:{size:3,value:E.points}},properties:B.properties,numericProps:B.numericProps,featureIds:B.featureIds},I.lines.data={length:Q.pathIndices.value.length-1,startIndices:Q.pathIndices.value,attributes:{...Q.attributes,getPath:Q.positions,instancePickingColors:{size:3,value:E.lines}},properties:Q.properties,numericProps:Q.numericProps,featureIds:Q.featureIds},I.lines._pathType="open",I.polygons.data={length:C.polygonIndices.value.length-1,startIndices:C.polygonIndices.value,attributes:{...C.attributes,getPolygon:C.positions,pickingColors:{size:3,value:E.polygons}},properties:C.properties,numericProps:C.numericProps,featureIds:C.featureIds},I.polygons._normalize=!1,C.triangles&&(I.polygons.data.attributes.indices=C.triangles.value),I.polygonsOutline.data={length:C.primitivePolygonIndices.value.length-1,startIndices:C.primitivePolygonIndices.value,attributes:{...C.attributes,getPath:C.positions,instancePickingColors:{size:3,value:E.polygons}},properties:C.properties,numericProps:C.numericProps,featureIds:C.featureIds},I.polygonsOutline._pathType="open",I}var $9=["points","linestrings","polygons"],AX={...uo(AG.circle),...uo(AG.icon),...uo(AG.text),...uo(gG),...uo(Je),stroked:!0,filled:!0,extruded:!1,wireframe:!1,_full3d:!1,iconAtlas:{type:"object",value:null},iconMapping:{type:"object",value:{}},getIcon:{type:"accessor",value:g=>g.properties.icon},getText:{type:"accessor",value:g=>g.properties.text},pointType:"circle",getRadius:{deprecatedFor:"getPointRadius"}},IG=class extends wQ{initializeState(){this.state={layerProps:{},features:{},featuresDiff:{}}}updateState({props:A,changeFlags:I}){if(!I.dataChanged)return;let{data:B}=this.props,Q=B&&"points"in B&&"polygons"in B&&"lines"in B;this.setState({binary:Q}),Q?this._updateStateBinary({props:A,changeFlags:I}):this._updateStateJSON({props:A,changeFlags:I})}_updateStateBinary({props:A,changeFlags:I}){let B=NS(A.data,this.encodePickingColor);this.setState({layerProps:B})}_updateStateJSON({props:A,changeFlags:I}){let B=wS(A.data),Q=this.getSubLayerRow.bind(this),C={},E={};if(Array.isArray(I.dataChanged)){let o=this.state.features;for(let D in o)C[D]=o[D].slice(),E[D]=[];for(let D of I.dataChanged){let a=hr(B,Q,D);for(let t in o)E[t].push(ne({data:C[t],getIndex:G=>G.__source.index,dataRange:D,replace:a[t]}))}}else C=hr(B,Q);let i=eS(C,E);this.setState({features:C,featuresDiff:E,layerProps:i})}getPickingInfo(A){let I=super.getPickingInfo(A),{index:B,sourceLayer:Q}=I;return I.featureType=$9.find(C=>Q.id.startsWith(`${this.id}-${C}-`)),B>=0&&Q.id.startsWith(`${this.id}-points-text`)&&this.state.binary&&(I.index=this.props.data.points.globalFeatureIds.value[B]),I}_updateAutoHighlight(A){let I=`${this.id}-points-`,B=A.featureType==="points";for(let Q of this.getSubLayers())Q.id.startsWith(I)===B&&Q.updateAutoHighlight(A)}_renderPolygonLayer(){let{extruded:A,wireframe:I}=this.props,{layerProps:B}=this.state,Q="polygons-fill",C=this.shouldRenderSubLayer(Q,B.polygons?.data)&&this.getSubLayerClass(Q,Je.type);if(C){let E=Ye(this,Je.props),i=A&&I;return i||delete E.getLineColor,E.updateTriggers.lineColors=i,new C(E,this.getSubLayerProps({id:Q,updateTriggers:E.updateTriggers}),B.polygons)}return null}_renderLineLayers(){let{extruded:A,stroked:I}=this.props,{layerProps:B}=this.state,Q="polygons-stroke",C="linestrings",E=!A&&I&&this.shouldRenderSubLayer(Q,B.polygonsOutline?.data)&&this.getSubLayerClass(Q,gG.type),i=this.shouldRenderSubLayer(C,B.lines?.data)&&this.getSubLayerClass(C,gG.type);if(E||i){let o=Ye(this,gG.props);return[E&&new E(o,this.getSubLayerProps({id:Q,updateTriggers:o.updateTriggers}),B.polygonsOutline),i&&new i(o,this.getSubLayerProps({id:C,updateTriggers:o.updateTriggers}),B.lines)]}return null}_renderPointLayers(){let{pointType:A}=this.props,{layerProps:I,binary:B}=this.state,{highlightedObjectIndex:Q}=this.props;!B&&Number.isFinite(Q)&&(Q=I.points.data.findIndex(i=>i.__source.index===Q));let C=new Set(A.split("+")),E=[];for(let i of C){let o=`points-${i}`,D=AG[i],a=D&&this.shouldRenderSubLayer(o,I.points?.data)&&this.getSubLayerClass(o,D.type);if(a){let t=Ye(this,D.props),G=I.points;if(i==="text"&&B){let{instancePickingColors:s,...w}=G.data.attributes;G={...G,data:{...G.data,attributes:w}}}E.push(new a(t,this.getSubLayerProps({id:o,updateTriggers:t.updateTriggers,highlightedObjectIndex:Q}),G))}}return E}renderLayers(){let{extruded:A}=this.props,I=this._renderPolygonLayer(),B=this._renderLineLayers(),Q=this._renderPointLayers();return[!A&&I,B,Q,A&&I]}getSubLayerAccessor(A){let{binary:I}=this.state;return!I||typeof A!="function"?super.getSubLayerAccessor(A):(B,Q)=>{let{data:C,index:E}=Q,i=TH(C,E);return A(i,Q)}}};IG.layerName="GeoJsonLayer";IG.defaultProps=AX;var qe=IG;var Ue=class{constructor(A){this.index=A,this.isVisible=!1,this.isSelected=!1,this.parent=null,this.children=[],this.content=null,this._loader=void 0,this._abortController=null,this._loaderId=0,this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1}get bbox(){return this._bbox}set bbox(A){this._bbox||(this._bbox=A,"west"in A?this.boundingBox=[[A.west,A.south],[A.east,A.north]]:this.boundingBox=[[A.left,A.top],[A.right,A.bottom]])}get data(){return this.isLoading&&this._loader?this._loader.then(()=>this.data):this.content}get isLoaded(){return this._isLoaded&&!this._needsReload}get isLoading(){return!!this._loader&&!this._isCancelled}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){let A=this.content?this.content.byteLength:0;return Number.isFinite(A)||console.error("byteLength not defined in tile data"),A}async _loadData({getData:A,requestScheduler:I,onLoad:B,onError:Q}){let{index:C,id:E,bbox:i,userData:o,zoom:D}=this,a=this._loaderId;this._abortController=new AbortController;let{signal:t}=this._abortController,G=await I.scheduleRequest(this,e=>e.isSelected?1:-1);if(!G){this._isCancelled=!0;return}if(this._isCancelled){G.done();return}let s=null,w;try{s=await A({index:C,id:E,bbox:i,userData:o,zoom:D,signal:t})}catch(e){w=e||!0}finally{G.done()}if(a===this._loaderId){if(this._loader=void 0,this.content=s,this._isCancelled&&!s){this._isLoaded=!1;return}this._isLoaded=!0,this._isCancelled=!1,w?Q(w,this):B(this)}}loadData(A){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(A),this._loader}setNeedsReload(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}abort(){this.isLoaded||(this._isCancelled=!0,this._abortController?.abort())}};var ag={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var xyA=1/Math.PI*180,uyA=1/180*Math.PI,gX={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...gX}};var tg=globalThis.mathgl.config;function Fr(g,{precision:A=tg.precision}={}){return g=IX(g),`${parseFloat(g.toPrecision(A))}`}function zQ(g){return Array.isArray(g)||ArrayBuffer.isView(g)&&!(g instanceof DataView)}function iE(g,A,I){let B=tg.EPSILON;I&&(tg.EPSILON=I);try{if(g===A)return!0;if(zQ(g)&&zQ(A)){if(g.length!==A.length)return!1;for(let Q=0;Q<g.length;++Q)if(!iE(g[Q],A[Q]))return!1;return!0}return g&&g.equals?g.equals(A):A&&A.equals?A.equals(g):typeof g=="number"&&typeof A=="number"?Math.abs(g-A)<=tg.EPSILON*Math.max(1,Math.abs(g),Math.abs(A)):!1}finally{tg.EPSILON=B}}function IX(g){return Math.round(g/tg.EPSILON)*tg.EPSILON}var oE=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(A,I=0){for(let B=0;B<this.ELEMENTS;++B)this[B]=A[B+I];return this.check()}toArray(A=[],I=0){for(let B=0;B<this.ELEMENTS;++B)A[I+B]=this[B];return A}toObject(A){return A}from(A){return Array.isArray(A)?this.copy(A):this.fromObject(A)}to(A){return A===this?this:zQ(A)?this.toArray(A):this.toObject(A)}toTarget(A){return A?this.to(A):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(tg)}formatString(A){let I="";for(let B=0;B<this.ELEMENTS;++B)I+=(B>0?", ":"")+Fr(this[B],A);return`${A.printTypes?this.constructor.name:""}[${I}]`}equals(A){if(!A||this.length!==A.length)return!1;for(let I=0;I<this.ELEMENTS;++I)if(!iE(this[I],A[I]))return!1;return!0}exactEquals(A){if(!A||this.length!==A.length)return!1;for(let I=0;I<this.ELEMENTS;++I)if(this[I]!==A[I])return!1;return!0}negate(){for(let A=0;A<this.ELEMENTS;++A)this[A]=-this[A];return this.check()}lerp(A,I,B){if(B===void 0)return this.lerp(this,A,I);for(let Q=0;Q<this.ELEMENTS;++Q){let C=A[Q],E=typeof I=="number"?I:I[Q];this[Q]=C+B*(E-C)}return this.check()}min(A){for(let I=0;I<this.ELEMENTS;++I)this[I]=Math.min(A[I],this[I]);return this.check()}max(A){for(let I=0;I<this.ELEMENTS;++I)this[I]=Math.max(A[I],this[I]);return this.check()}clamp(A,I){for(let B=0;B<this.ELEMENTS;++B)this[B]=Math.min(Math.max(this[B],A[B]),I[B]);return this.check()}add(...A){for(let I of A)for(let B=0;B<this.ELEMENTS;++B)this[B]+=I[B];return this.check()}subtract(...A){for(let I of A)for(let B=0;B<this.ELEMENTS;++B)this[B]-=I[B];return this.check()}scale(A){if(typeof A=="number")for(let I=0;I<this.ELEMENTS;++I)this[I]*=A;else for(let I=0;I<this.ELEMENTS&&I<A.length;++I)this[I]*=A[I];return this.check()}multiplyByScalar(A){for(let I=0;I<this.ELEMENTS;++I)this[I]*=A;return this.check()}check(){if(tg.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let A=this.length===this.ELEMENTS;for(let I=0;I<this.ELEMENTS;++I)A=A&&Number.isFinite(this[I]);return A}sub(A){return this.subtract(A)}setScalar(A){for(let I=0;I<this.ELEMENTS;++I)this[I]=A;return this.check()}addScalar(A){for(let I=0;I<this.ELEMENTS;++I)this[I]+=A;return this.check()}subScalar(A){return this.addScalar(-A)}multiplyScalar(A){for(let I=0;I<this.ELEMENTS;++I)this[I]*=A;return this.check()}divideScalar(A){return this.multiplyByScalar(1/A)}clampScalar(A,I){for(let B=0;B<this.ELEMENTS;++B)this[B]=Math.min(Math.max(this[B],A),I);return this.check()}get elements(){return this}};function BX(g,A){if(g.length!==A)return!1;for(let I=0;I<g.length;++I)if(!Number.isFinite(g[I]))return!1;return!0}function UA(g){if(!Number.isFinite(g))throw new Error(`Invalid number ${JSON.stringify(g)}`);return g}function He(g,A,I=""){if(tg.debug&&!BX(g,A))throw new Error(`math.gl: ${I} some fields set to invalid numbers'`);return g}function cQ(g,A){if(!g)throw new Error(`math.gl assertion ${A}`)}var Wo=class extends oE{get x(){return this[0]}set x(A){this[0]=UA(A)}get y(){return this[1]}set y(A){this[1]=UA(A)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let A=0;for(let I=0;I<this.ELEMENTS;++I)A+=this[I]*this[I];return A}magnitudeSquared(){return this.lengthSquared()}distance(A){return Math.sqrt(this.distanceSquared(A))}distanceSquared(A){let I=0;for(let B=0;B<this.ELEMENTS;++B){let Q=this[B]-A[B];I+=Q*Q}return UA(I)}dot(A){let I=0;for(let B=0;B<this.ELEMENTS;++B)I+=this[B]*A[B];return UA(I)}normalize(){let A=this.magnitude();if(A!==0)for(let I=0;I<this.ELEMENTS;++I)this[I]/=A;return this.check()}multiply(...A){for(let I of A)for(let B=0;B<this.ELEMENTS;++B)this[B]*=I[B];return this.check()}divide(...A){for(let I of A)for(let B=0;B<this.ELEMENTS;++B)this[B]/=I[B];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(A){return this.distance(A)}distanceToSquared(A){return this.distanceSquared(A)}getComponent(A){return cQ(A>=0&&A<this.ELEMENTS,"index is out of range"),UA(this[A])}setComponent(A,I){return cQ(A>=0&&A<this.ELEMENTS,"index is out of range"),this[A]=I,this.check()}addVectors(A,I){return this.copy(A).add(I)}subVectors(A,I){return this.copy(A).subtract(I)}multiplyVectors(A,I){return this.copy(A).multiply(I)}addScaledVector(A,I){return this.add(new this.constructor(A).multiplyScalar(I))}};var gg=typeof Float32Array<"u"?Float32Array:Array;var vyA=Math.PI/180;function QX(){let g=new gg(2);return gg!=Float32Array&&(g[0]=0,g[1]=0),g}function FS(g,A,I){let B=A[0],Q=A[1];return g[0]=I[0]*B+I[3]*Q+I[6],g[1]=I[1]*B+I[4]*Q+I[7],g}var _yA=function(){let g=QX();return function(A,I,B,Q,C,E){let i,o;for(I||(I=2),B||(B=0),Q?o=Math.min(Q*I+B,A.length):o=A.length,i=B;i<o;i+=I)g[0]=A[i],g[1]=A[i+1],C(g,g,E),A[i]=g[0],A[i+1]=g[1];return A}}();function yS(g,A,I){let B=A[0],Q=A[1],C=A[2],E=I[3]*B+I[7]*Q+I[11]*C||1;return g[0]=(I[0]*B+I[4]*Q+I[8]*C)/E,g[1]=(I[1]*B+I[5]*Q+I[9]*C)/E,g[2]=(I[2]*B+I[6]*Q+I[10]*C)/E,g}function rS(g,A,I){let B=A[0],Q=A[1];return g[0]=I[0]*B+I[2]*Q,g[1]=I[1]*B+I[3]*Q,g[2]=A[2],g}function nS(g,A,I){let B=A[0],Q=A[1];return g[0]=I[0]*B+I[2]*Q,g[1]=I[1]*B+I[3]*Q,g[2]=A[2],g[3]=A[3],g}function Se(g,A,I){let B=A[0],Q=A[1],C=A[2];return g[0]=I[0]*B+I[3]*Q+I[6]*C,g[1]=I[1]*B+I[4]*Q+I[7]*C,g[2]=I[2]*B+I[5]*Q+I[8]*C,g[3]=A[3],g}function yr(){let g=new gg(3);return gg!=Float32Array&&(g[0]=0,g[1]=0,g[2]=0),g}function EX(g){let A=g[0],I=g[1],B=g[2];return Math.sqrt(A*A+I*I+B*B)}function rr(g,A,I){let B=new gg(3);return B[0]=g,B[1]=A,B[2]=I,B}function RS(g,A){let I=A[0],B=A[1],Q=A[2],C=I*I+B*B+Q*Q;return C>0&&(C=1/Math.sqrt(C)),g[0]=A[0]*C,g[1]=A[1]*C,g[2]=A[2]*C,g}function nr(g,A){return g[0]*A[0]+g[1]*A[1]+g[2]*A[2]}function Zo(g,A,I){let B=A[0],Q=A[1],C=A[2],E=I[0],i=I[1],o=I[2];return g[0]=Q*o-C*i,g[1]=C*E-B*o,g[2]=B*i-Q*E,g}function Le(g,A,I){let B=A[0],Q=A[1],C=A[2],E=I[3]*B+I[7]*Q+I[11]*C+I[15];return E=E||1,g[0]=(I[0]*B+I[4]*Q+I[8]*C+I[12])/E,g[1]=(I[1]*B+I[5]*Q+I[9]*C+I[13])/E,g[2]=(I[2]*B+I[6]*Q+I[10]*C+I[14])/E,g}function de(g,A,I){let B=A[0],Q=A[1],C=A[2];return g[0]=B*I[0]+Q*I[3]+C*I[6],g[1]=B*I[1]+Q*I[4]+C*I[7],g[2]=B*I[2]+Q*I[5]+C*I[8],g}function pe(g,A,I){let B=I[0],Q=I[1],C=I[2],E=I[3],i=A[0],o=A[1],D=A[2],a=Q*D-C*o,t=C*i-B*D,G=B*o-Q*i,s=Q*G-C*t,w=C*a-B*G,e=B*t-Q*a,c=E*2;return a*=c,t*=c,G*=c,s*=2,w*=2,e*=2,g[0]=i+a+s,g[1]=o+t+w,g[2]=D+G+e,g}function MS(g,A,I,B){let Q=[],C=[];return Q[0]=A[0]-I[0],Q[1]=A[1]-I[1],Q[2]=A[2]-I[2],C[0]=Q[0],C[1]=Q[1]*Math.cos(B)-Q[2]*Math.sin(B),C[2]=Q[1]*Math.sin(B)+Q[2]*Math.cos(B),g[0]=C[0]+I[0],g[1]=C[1]+I[1],g[2]=C[2]+I[2],g}function JS(g,A,I,B){let Q=[],C=[];return Q[0]=A[0]-I[0],Q[1]=A[1]-I[1],Q[2]=A[2]-I[2],C[0]=Q[2]*Math.sin(B)+Q[0]*Math.cos(B),C[1]=Q[1],C[2]=Q[2]*Math.cos(B)-Q[0]*Math.sin(B),g[0]=C[0]+I[0],g[1]=C[1]+I[1],g[2]=C[2]+I[2],g}function YS(g,A,I,B){let Q=[],C=[];return Q[0]=A[0]-I[0],Q[1]=A[1]-I[1],Q[2]=A[2]-I[2],C[0]=Q[0]*Math.cos(B)-Q[1]*Math.sin(B),C[1]=Q[0]*Math.sin(B)+Q[1]*Math.cos(B),C[2]=Q[2],g[0]=C[0]+I[0],g[1]=C[1]+I[1],g[2]=C[2]+I[2],g}function KS(g,A){let I=g[0],B=g[1],Q=g[2],C=A[0],E=A[1],i=A[2],o=Math.sqrt((I*I+B*B+Q*Q)*(C*C+E*E+i*i)),D=o&&nr(g,A)/o;return Math.acos(Math.min(Math.max(D,-1),1))}var qS=EX;var ArA=function(){let g=yr();return function(A,I,B,Q,C,E){let i,o;for(I||(I=3),B||(B=0),Q?o=Math.min(Q*I+B,A.length):o=A.length,i=B;i<o;i+=I)g[0]=A[i],g[1]=A[i+1],g[2]=A[i+2],C(g,g,E),A[i]=g[0],A[i+1]=g[1],A[i+2]=g[2];return A}}();var Rr=[0,0,0],le,V=class g extends Wo{static get ZERO(){return le||(le=new g(0,0,0),Object.freeze(le)),le}constructor(A=0,I=0,B=0){super(-0,-0,-0),arguments.length===1&&zQ(A)?this.copy(A):(tg.debug&&(UA(A),UA(I),UA(B)),this[0]=A,this[1]=I,this[2]=B)}set(A,I,B){return this[0]=A,this[1]=I,this[2]=B,this.check()}copy(A){return this[0]=A[0],this[1]=A[1],this[2]=A[2],this.check()}fromObject(A){return tg.debug&&(UA(A.x),UA(A.y),UA(A.z)),this[0]=A.x,this[1]=A.y,this[2]=A.z,this.check()}toObject(A){return A.x=this[0],A.y=this[1],A.z=this[2],A}get ELEMENTS(){return 3}get z(){return this[2]}set z(A){this[2]=UA(A)}angle(A){return KS(this,A)}cross(A){return Zo(this,this,A),this.check()}rotateX({radians:A,origin:I=Rr}){return MS(this,this,I,A),this.check()}rotateY({radians:A,origin:I=Rr}){return JS(this,this,I,A),this.check()}rotateZ({radians:A,origin:I=Rr}){return YS(this,this,I,A),this.check()}transform(A){return this.transformAsPoint(A)}transformAsPoint(A){return Le(this,this,A),this.check()}transformAsVector(A){return yS(this,this,A),this.check()}transformByMatrix3(A){return de(this,this,A),this.check()}transformByMatrix2(A){return rS(this,this,A),this.check()}transformByQuaternion(A){return pe(this,this,A),this.check()}};var fe,me=class g extends Wo{static get ZERO(){return fe||(fe=new g(0,0,0,0),Object.freeze(fe)),fe}constructor(A=0,I=0,B=0,Q=0){super(-0,-0,-0,-0),zQ(A)&&arguments.length===1?this.copy(A):(tg.debug&&(UA(A),UA(I),UA(B),UA(Q)),this[0]=A,this[1]=I,this[2]=B,this[3]=Q)}set(A,I,B,Q){return this[0]=A,this[1]=I,this[2]=B,this[3]=Q,this.check()}copy(A){return this[0]=A[0],this[1]=A[1],this[2]=A[2],this[3]=A[3],this.check()}fromObject(A){return tg.debug&&(UA(A.x),UA(A.y),UA(A.z),UA(A.w)),this[0]=A.x,this[1]=A.y,this[2]=A.z,this[3]=A.w,this}toObject(A){return A.x=this[0],A.y=this[1],A.z=this[2],A.w=this[3],A}get ELEMENTS(){return 4}get z(){return this[2]}set z(A){this[2]=UA(A)}get w(){return this[3]}set w(A){this[3]=UA(A)}transform(A){return Le(this,this,A),this.check()}transformByMatrix3(A){return Se(this,this,A),this.check()}transformByMatrix2(A){return nS(this,this,A),this.check()}transformByQuaternion(A){return pe(this,this,A),this.check()}applyMatrix4(A){return A.transform(this,this),this}};var xe=class extends oE{toString(){let A="[";if(tg.printRowMajor){A+="row-major:";for(let I=0;I<this.RANK;++I)for(let B=0;B<this.RANK;++B)A+=` ${this[B*this.RANK+I]}`}else{A+="column-major:";for(let I=0;I<this.ELEMENTS;++I)A+=` ${this[I]}`}return A+="]",A}getElementIndex(A,I){return I*this.RANK+A}getElement(A,I){return this[I*this.RANK+A]}setElement(A,I,B){return this[I*this.RANK+A]=UA(B),this}getColumn(A,I=new Array(this.RANK).fill(-0)){let B=A*this.RANK;for(let Q=0;Q<this.RANK;++Q)I[Q]=this[B+Q];return I}setColumn(A,I){let B=A*this.RANK;for(let Q=0;Q<this.RANK;++Q)this[B+Q]=I[Q];return this}};function HS(){let g=new gg(9);return gg!=Float32Array&&(g[1]=0,g[2]=0,g[3]=0,g[5]=0,g[6]=0,g[7]=0),g[0]=1,g[4]=1,g[8]=1,g}function SS(g,A){if(g===A){let I=A[1],B=A[2],Q=A[5];g[1]=A[3],g[2]=A[6],g[3]=I,g[5]=A[7],g[6]=B,g[7]=Q}else g[0]=A[0],g[1]=A[3],g[2]=A[6],g[3]=A[1],g[4]=A[4],g[5]=A[7],g[6]=A[2],g[7]=A[5],g[8]=A[8];return g}function LS(g,A){let I=A[0],B=A[1],Q=A[2],C=A[3],E=A[4],i=A[5],o=A[6],D=A[7],a=A[8],t=a*E-i*D,G=-a*C+i*o,s=D*C-E*o,w=I*t+B*G+Q*s;return w?(w=1/w,g[0]=t*w,g[1]=(-a*B+Q*D)*w,g[2]=(i*B-Q*E)*w,g[3]=G*w,g[4]=(a*I-Q*o)*w,g[5]=(-i*I+Q*C)*w,g[6]=s*w,g[7]=(-D*I+B*o)*w,g[8]=(E*I-B*C)*w,g):null}function dS(g){let A=g[0],I=g[1],B=g[2],Q=g[3],C=g[4],E=g[5],i=g[6],o=g[7],D=g[8];return A*(D*C-E*o)+I*(-D*Q+E*i)+B*(o*Q-C*i)}function Mr(g,A,I){let B=A[0],Q=A[1],C=A[2],E=A[3],i=A[4],o=A[5],D=A[6],a=A[7],t=A[8],G=I[0],s=I[1],w=I[2],e=I[3],c=I[4],h=I[5],R=I[6],N=I[7],y=I[8];return g[0]=G*B+s*E+w*D,g[1]=G*Q+s*i+w*a,g[2]=G*C+s*o+w*t,g[3]=e*B+c*E+h*D,g[4]=e*Q+c*i+h*a,g[5]=e*C+c*o+h*t,g[6]=R*B+N*E+y*D,g[7]=R*Q+N*i+y*a,g[8]=R*C+N*o+y*t,g}function pS(g,A,I){let B=A[0],Q=A[1],C=A[2],E=A[3],i=A[4],o=A[5],D=A[6],a=A[7],t=A[8],G=I[0],s=I[1];return g[0]=B,g[1]=Q,g[2]=C,g[3]=E,g[4]=i,g[5]=o,g[6]=G*B+s*E+D,g[7]=G*Q+s*i+a,g[8]=G*C+s*o+t,g}function lS(g,A,I){let B=A[0],Q=A[1],C=A[2],E=A[3],i=A[4],o=A[5],D=A[6],a=A[7],t=A[8],G=Math.sin(I),s=Math.cos(I);return g[0]=s*B+G*E,g[1]=s*Q+G*i,g[2]=s*C+G*o,g[3]=s*E-G*B,g[4]=s*i-G*Q,g[5]=s*o-G*C,g[6]=D,g[7]=a,g[8]=t,g}function Jr(g,A,I){let B=I[0],Q=I[1];return g[0]=B*A[0],g[1]=B*A[1],g[2]=B*A[2],g[3]=Q*A[3],g[4]=Q*A[4],g[5]=Q*A[5],g[6]=A[6],g[7]=A[7],g[8]=A[8],g}function fS(g,A){let I=A[0],B=A[1],Q=A[2],C=A[3],E=I+I,i=B+B,o=Q+Q,D=I*E,a=B*E,t=B*i,G=Q*E,s=Q*i,w=Q*o,e=C*E,c=C*i,h=C*o;return g[0]=1-t-w,g[3]=a-h,g[6]=G+c,g[1]=a+h,g[4]=1-D-w,g[7]=s-e,g[2]=G-c,g[5]=s+e,g[8]=1-D-t,g}var Yr;(function(g){g[g.COL0ROW0=0]="COL0ROW0",g[g.COL0ROW1=1]="COL0ROW1",g[g.COL0ROW2=2]="COL0ROW2",g[g.COL1ROW0=3]="COL1ROW0",g[g.COL1ROW1=4]="COL1ROW1",g[g.COL1ROW2=5]="COL1ROW2",g[g.COL2ROW0=6]="COL2ROW0",g[g.COL2ROW1=7]="COL2ROW1",g[g.COL2ROW2=8]="COL2ROW2"})(Yr||(Yr={}));var iX=Object.freeze([1,0,0,0,1,0,0,0,1]),Ig=class extends xe{static get IDENTITY(){return DX()}static get ZERO(){return oX()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Yr}constructor(A,...I){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(A)?this.copy(A):I.length>0?this.copy([A,...I]):this.identity()}copy(A){return this[0]=A[0],this[1]=A[1],this[2]=A[2],this[3]=A[3],this[4]=A[4],this[5]=A[5],this[6]=A[6],this[7]=A[7],this[8]=A[8],this.check()}identity(){return this.copy(iX)}fromObject(A){return this.check()}fromQuaternion(A){return fS(this,A),this.check()}set(A,I,B,Q,C,E,i,o,D){return this[0]=A,this[1]=I,this[2]=B,this[3]=Q,this[4]=C,this[5]=E,this[6]=i,this[7]=o,this[8]=D,this.check()}setRowMajor(A,I,B,Q,C,E,i,o,D){return this[0]=A,this[1]=Q,this[2]=i,this[3]=I,this[4]=C,this[5]=o,this[6]=B,this[7]=E,this[8]=D,this.check()}determinant(){return dS(this)}transpose(){return SS(this,this),this.check()}invert(){return LS(this,this),this.check()}multiplyLeft(A){return Mr(this,A,this),this.check()}multiplyRight(A){return Mr(this,this,A),this.check()}rotate(A){return lS(this,this,A),this.check()}scale(A){return Array.isArray(A)?Jr(this,this,A):Jr(this,this,[A,A]),this.check()}translate(A){return pS(this,this,A),this.check()}transform(A,I){let B;switch(A.length){case 2:B=FS(I||[-0,-0],A,this);break;case 3:B=de(I||[-0,-0,-0],A,this);break;case 4:B=Se(I||[-0,-0,-0,-0],A,this);break;default:throw new Error("Illegal vector")}return He(B,A.length),B}transformVector(A,I){return this.transform(A,I)}transformVector2(A,I){return this.transform(A,I)}transformVector3(A,I){return this.transform(A,I)}},ue,We=null;function oX(){return ue||(ue=new Ig([0,0,0,0,0,0,0,0,0]),Object.freeze(ue)),ue}function DX(){return We||(We=new Ig,Object.freeze(We)),We}var be={};rg(be,{add:()=>jX,adjoint:()=>NX,clone:()=>tX,copy:()=>GX,create:()=>aX,decompose:()=>dX,determinant:()=>kX,equals:()=>_X,exactEquals:()=>vX,frob:()=>OX,fromQuat:()=>fX,fromQuat2:()=>HX,fromRotation:()=>YX,fromRotationTranslation:()=>WS,fromRotationTranslationScale:()=>pX,fromRotationTranslationScaleOrigin:()=>lX,fromScaling:()=>JX,fromTranslation:()=>MX,fromValues:()=>sX,fromXRotation:()=>KX,fromYRotation:()=>qX,fromZRotation:()=>UX,frustum:()=>mX,getRotation:()=>LX,getScaling:()=>bS,getTranslation:()=>SX,identity:()=>xS,invert:()=>eX,lookAt:()=>TX,mul:()=>$X,multiply:()=>uS,multiplyScalar:()=>XX,multiplyScalarAndAdd:()=>zX,ortho:()=>bX,orthoNO:()=>TS,orthoZO:()=>ZX,perspective:()=>xX,perspectiveFromFieldOfView:()=>WX,perspectiveNO:()=>ZS,perspectiveZO:()=>uX,rotate:()=>yX,rotateX:()=>rX,rotateY:()=>nX,rotateZ:()=>RX,scale:()=>FX,set:()=>wX,str:()=>VX,sub:()=>A1,subtract:()=>PS,targetTo:()=>PX,translate:()=>hX,transpose:()=>cX});function aX(){let g=new gg(16);return gg!=Float32Array&&(g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[11]=0,g[12]=0,g[13]=0,g[14]=0),g[0]=1,g[5]=1,g[10]=1,g[15]=1,g}function tX(g){let A=new gg(16);return A[0]=g[0],A[1]=g[1],A[2]=g[2],A[3]=g[3],A[4]=g[4],A[5]=g[5],A[6]=g[6],A[7]=g[7],A[8]=g[8],A[9]=g[9],A[10]=g[10],A[11]=g[11],A[12]=g[12],A[13]=g[13],A[14]=g[14],A[15]=g[15],A}function GX(g,A){return g[0]=A[0],g[1]=A[1],g[2]=A[2],g[3]=A[3],g[4]=A[4],g[5]=A[5],g[6]=A[6],g[7]=A[7],g[8]=A[8],g[9]=A[9],g[10]=A[10],g[11]=A[11],g[12]=A[12],g[13]=A[13],g[14]=A[14],g[15]=A[15],g}function sX(g,A,I,B,Q,C,E,i,o,D,a,t,G,s,w,e){let c=new gg(16);return c[0]=g,c[1]=A,c[2]=I,c[3]=B,c[4]=Q,c[5]=C,c[6]=E,c[7]=i,c[8]=o,c[9]=D,c[10]=a,c[11]=t,c[12]=G,c[13]=s,c[14]=w,c[15]=e,c}function wX(g,A,I,B,Q,C,E,i,o,D,a,t,G,s,w,e,c){return g[0]=A,g[1]=I,g[2]=B,g[3]=Q,g[4]=C,g[5]=E,g[6]=i,g[7]=o,g[8]=D,g[9]=a,g[10]=t,g[11]=G,g[12]=s,g[13]=w,g[14]=e,g[15]=c,g}function xS(g){return g[0]=1,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=1,g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[10]=1,g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,g}function cX(g,A){if(g===A){let I=A[1],B=A[2],Q=A[3],C=A[6],E=A[7],i=A[11];g[1]=A[4],g[2]=A[8],g[3]=A[12],g[4]=I,g[6]=A[9],g[7]=A[13],g[8]=B,g[9]=C,g[11]=A[14],g[12]=Q,g[13]=E,g[14]=i}else g[0]=A[0],g[1]=A[4],g[2]=A[8],g[3]=A[12],g[4]=A[1],g[5]=A[5],g[6]=A[9],g[7]=A[13],g[8]=A[2],g[9]=A[6],g[10]=A[10],g[11]=A[14],g[12]=A[3],g[13]=A[7],g[14]=A[11],g[15]=A[15];return g}function eX(g,A){let I=A[0],B=A[1],Q=A[2],C=A[3],E=A[4],i=A[5],o=A[6],D=A[7],a=A[8],t=A[9],G=A[10],s=A[11],w=A[12],e=A[13],c=A[14],h=A[15],R=I*i-B*E,N=I*o-Q*E,y=I*D-C*E,r=B*o-Q*i,J=B*D-C*i,q=Q*D-C*o,H=a*e-t*w,d=a*c-G*w,K=a*h-s*w,x=t*c-G*e,W=t*h-s*e,u=G*h-s*c,m=R*u-N*W+y*x+r*K-J*d+q*H;return m?(m=1/m,g[0]=(i*u-o*W+D*x)*m,g[1]=(Q*W-B*u-C*x)*m,g[2]=(e*q-c*J+h*r)*m,g[3]=(G*J-t*q-s*r)*m,g[4]=(o*K-E*u-D*d)*m,g[5]=(I*u-Q*K+C*d)*m,g[6]=(c*y-w*q-h*N)*m,g[7]=(a*q-G*y+s*N)*m,g[8]=(E*W-i*K+D*H)*m,g[9]=(B*K-I*W-C*H)*m,g[10]=(w*J-e*y+h*R)*m,g[11]=(t*y-a*J-s*R)*m,g[12]=(i*d-E*x-o*H)*m,g[13]=(I*x-B*d+Q*H)*m,g[14]=(e*N-w*r-c*R)*m,g[15]=(a*r-t*N+G*R)*m,g):null}function NX(g,A){let I=A[0],B=A[1],Q=A[2],C=A[3],E=A[4],i=A[5],o=A[6],D=A[7],a=A[8],t=A[9],G=A[10],s=A[11],w=A[12],e=A[13],c=A[14],h=A[15],R=I*i-B*E,N=I*o-Q*E,y=I*D-C*E,r=B*o-Q*i,J=B*D-C*i,q=Q*D-C*o,H=a*e-t*w,d=a*c-G*w,K=a*h-s*w,x=t*c-G*e,W=t*h-s*e,u=G*h-s*c;return g[0]=i*u-o*W+D*x,g[1]=Q*W-B*u-C*x,g[2]=e*q-c*J+h*r,g[3]=G*J-t*q-s*r,g[4]=o*K-E*u-D*d,g[5]=I*u-Q*K+C*d,g[6]=c*y-w*q-h*N,g[7]=a*q-G*y+s*N,g[8]=E*W-i*K+D*H,g[9]=B*K-I*W-C*H,g[10]=w*J-e*y+h*R,g[11]=t*y-a*J-s*R,g[12]=i*d-E*x-o*H,g[13]=I*x-B*d+Q*H,g[14]=e*N-w*r-c*R,g[15]=a*r-t*N+G*R,g}function kX(g){let A=g[0],I=g[1],B=g[2],Q=g[3],C=g[4],E=g[5],i=g[6],o=g[7],D=g[8],a=g[9],t=g[10],G=g[11],s=g[12],w=g[13],e=g[14],c=g[15],h=A*E-I*C,R=A*i-B*C,N=I*i-B*E,y=D*w-a*s,r=D*e-t*s,J=a*e-t*w,q=A*J-I*r+B*y,H=C*J-E*r+i*y,d=D*N-a*R+t*h,K=s*N-w*R+e*h;return o*q-Q*H+c*d-G*K}function uS(g,A,I){let B=A[0],Q=A[1],C=A[2],E=A[3],i=A[4],o=A[5],D=A[6],a=A[7],t=A[8],G=A[9],s=A[10],w=A[11],e=A[12],c=A[13],h=A[14],R=A[15],N=I[0],y=I[1],r=I[2],J=I[3];return g[0]=N*B+y*i+r*t+J*e,g[1]=N*Q+y*o+r*G+J*c,g[2]=N*C+y*D+r*s+J*h,g[3]=N*E+y*a+r*w+J*R,N=I[4],y=I[5],r=I[6],J=I[7],g[4]=N*B+y*i+r*t+J*e,g[5]=N*Q+y*o+r*G+J*c,g[6]=N*C+y*D+r*s+J*h,g[7]=N*E+y*a+r*w+J*R,N=I[8],y=I[9],r=I[10],J=I[11],g[8]=N*B+y*i+r*t+J*e,g[9]=N*Q+y*o+r*G+J*c,g[10]=N*C+y*D+r*s+J*h,g[11]=N*E+y*a+r*w+J*R,N=I[12],y=I[13],r=I[14],J=I[15],g[12]=N*B+y*i+r*t+J*e,g[13]=N*Q+y*o+r*G+J*c,g[14]=N*C+y*D+r*s+J*h,g[15]=N*E+y*a+r*w+J*R,g}function hX(g,A,I){let B=I[0],Q=I[1],C=I[2],E,i,o,D,a,t,G,s,w,e,c,h;return A===g?(g[12]=A[0]*B+A[4]*Q+A[8]*C+A[12],g[13]=A[1]*B+A[5]*Q+A[9]*C+A[13],g[14]=A[2]*B+A[6]*Q+A[10]*C+A[14],g[15]=A[3]*B+A[7]*Q+A[11]*C+A[15]):(E=A[0],i=A[1],o=A[2],D=A[3],a=A[4],t=A[5],G=A[6],s=A[7],w=A[8],e=A[9],c=A[10],h=A[11],g[0]=E,g[1]=i,g[2]=o,g[3]=D,g[4]=a,g[5]=t,g[6]=G,g[7]=s,g[8]=w,g[9]=e,g[10]=c,g[11]=h,g[12]=E*B+a*Q+w*C+A[12],g[13]=i*B+t*Q+e*C+A[13],g[14]=o*B+G*Q+c*C+A[14],g[15]=D*B+s*Q+h*C+A[15]),g}function FX(g,A,I){let B=I[0],Q=I[1],C=I[2];return g[0]=A[0]*B,g[1]=A[1]*B,g[2]=A[2]*B,g[3]=A[3]*B,g[4]=A[4]*Q,g[5]=A[5]*Q,g[6]=A[6]*Q,g[7]=A[7]*Q,g[8]=A[8]*C,g[9]=A[9]*C,g[10]=A[10]*C,g[11]=A[11]*C,g[12]=A[12],g[13]=A[13],g[14]=A[14],g[15]=A[15],g}function yX(g,A,I,B){let Q=B[0],C=B[1],E=B[2],i=Math.sqrt(Q*Q+C*C+E*E),o,D,a,t,G,s,w,e,c,h,R,N,y,r,J,q,H,d,K,x,W,u,m,_;return i<1e-6?null:(i=1/i,Q*=i,C*=i,E*=i,D=Math.sin(I),o=Math.cos(I),a=1-o,t=A[0],G=A[1],s=A[2],w=A[3],e=A[4],c=A[5],h=A[6],R=A[7],N=A[8],y=A[9],r=A[10],J=A[11],q=Q*Q*a+o,H=C*Q*a+E*D,d=E*Q*a-C*D,K=Q*C*a-E*D,x=C*C*a+o,W=E*C*a+Q*D,u=Q*E*a+C*D,m=C*E*a-Q*D,_=E*E*a+o,g[0]=t*q+e*H+N*d,g[1]=G*q+c*H+y*d,g[2]=s*q+h*H+r*d,g[3]=w*q+R*H+J*d,g[4]=t*K+e*x+N*W,g[5]=G*K+c*x+y*W,g[6]=s*K+h*x+r*W,g[7]=w*K+R*x+J*W,g[8]=t*u+e*m+N*_,g[9]=G*u+c*m+y*_,g[10]=s*u+h*m+r*_,g[11]=w*u+R*m+J*_,A!==g&&(g[12]=A[12],g[13]=A[13],g[14]=A[14],g[15]=A[15]),g)}function rX(g,A,I){let B=Math.sin(I),Q=Math.cos(I),C=A[4],E=A[5],i=A[6],o=A[7],D=A[8],a=A[9],t=A[10],G=A[11];return A!==g&&(g[0]=A[0],g[1]=A[1],g[2]=A[2],g[3]=A[3],g[12]=A[12],g[13]=A[13],g[14]=A[14],g[15]=A[15]),g[4]=C*Q+D*B,g[5]=E*Q+a*B,g[6]=i*Q+t*B,g[7]=o*Q+G*B,g[8]=D*Q-C*B,g[9]=a*Q-E*B,g[10]=t*Q-i*B,g[11]=G*Q-o*B,g}function nX(g,A,I){let B=Math.sin(I),Q=Math.cos(I),C=A[0],E=A[1],i=A[2],o=A[3],D=A[8],a=A[9],t=A[10],G=A[11];return A!==g&&(g[4]=A[4],g[5]=A[5],g[6]=A[6],g[7]=A[7],g[12]=A[12],g[13]=A[13],g[14]=A[14],g[15]=A[15]),g[0]=C*Q-D*B,g[1]=E*Q-a*B,g[2]=i*Q-t*B,g[3]=o*Q-G*B,g[8]=C*B+D*Q,g[9]=E*B+a*Q,g[10]=i*B+t*Q,g[11]=o*B+G*Q,g}function RX(g,A,I){let B=Math.sin(I),Q=Math.cos(I),C=A[0],E=A[1],i=A[2],o=A[3],D=A[4],a=A[5],t=A[6],G=A[7];return A!==g&&(g[8]=A[8],g[9]=A[9],g[10]=A[10],g[11]=A[11],g[12]=A[12],g[13]=A[13],g[14]=A[14],g[15]=A[15]),g[0]=C*Q+D*B,g[1]=E*Q+a*B,g[2]=i*Q+t*B,g[3]=o*Q+G*B,g[4]=D*Q-C*B,g[5]=a*Q-E*B,g[6]=t*Q-i*B,g[7]=G*Q-o*B,g}function MX(g,A){return g[0]=1,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=1,g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[10]=1,g[11]=0,g[12]=A[0],g[13]=A[1],g[14]=A[2],g[15]=1,g}function JX(g,A){return g[0]=A[0],g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=A[1],g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[10]=A[2],g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,g}function YX(g,A,I){let B=I[0],Q=I[1],C=I[2],E=Math.sqrt(B*B+Q*Q+C*C),i,o,D;return E<1e-6?null:(E=1/E,B*=E,Q*=E,C*=E,o=Math.sin(A),i=Math.cos(A),D=1-i,g[0]=B*B*D+i,g[1]=Q*B*D+C*o,g[2]=C*B*D-Q*o,g[3]=0,g[4]=B*Q*D-C*o,g[5]=Q*Q*D+i,g[6]=C*Q*D+B*o,g[7]=0,g[8]=B*C*D+Q*o,g[9]=Q*C*D-B*o,g[10]=C*C*D+i,g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,g)}function KX(g,A){let I=Math.sin(A),B=Math.cos(A);return g[0]=1,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=B,g[6]=I,g[7]=0,g[8]=0,g[9]=-I,g[10]=B,g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,g}function qX(g,A){let I=Math.sin(A),B=Math.cos(A);return g[0]=B,g[1]=0,g[2]=-I,g[3]=0,g[4]=0,g[5]=1,g[6]=0,g[7]=0,g[8]=I,g[9]=0,g[10]=B,g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,g}function UX(g,A){let I=Math.sin(A),B=Math.cos(A);return g[0]=B,g[1]=I,g[2]=0,g[3]=0,g[4]=-I,g[5]=B,g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[10]=1,g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,g}function WS(g,A,I){let B=A[0],Q=A[1],C=A[2],E=A[3],i=B+B,o=Q+Q,D=C+C,a=B*i,t=B*o,G=B*D,s=Q*o,w=Q*D,e=C*D,c=E*i,h=E*o,R=E*D;return g[0]=1-(s+e),g[1]=t+R,g[2]=G-h,g[3]=0,g[4]=t-R,g[5]=1-(a+e),g[6]=w+c,g[7]=0,g[8]=G+h,g[9]=w-c,g[10]=1-(a+s),g[11]=0,g[12]=I[0],g[13]=I[1],g[14]=I[2],g[15]=1,g}function HX(g,A){let I=new gg(3),B=-A[0],Q=-A[1],C=-A[2],E=A[3],i=A[4],o=A[5],D=A[6],a=A[7],t=B*B+Q*Q+C*C+E*E;return t>0?(I[0]=(i*E+a*B+o*C-D*Q)*2/t,I[1]=(o*E+a*Q+D*B-i*C)*2/t,I[2]=(D*E+a*C+i*Q-o*B)*2/t):(I[0]=(i*E+a*B+o*C-D*Q)*2,I[1]=(o*E+a*Q+D*B-i*C)*2,I[2]=(D*E+a*C+i*Q-o*B)*2),WS(g,A,I),g}function SX(g,A){return g[0]=A[12],g[1]=A[13],g[2]=A[14],g}function bS(g,A){let I=A[0],B=A[1],Q=A[2],C=A[4],E=A[5],i=A[6],o=A[8],D=A[9],a=A[10];return g[0]=Math.sqrt(I*I+B*B+Q*Q),g[1]=Math.sqrt(C*C+E*E+i*i),g[2]=Math.sqrt(o*o+D*D+a*a),g}function LX(g,A){let I=new gg(3);bS(I,A);let B=1/I[0],Q=1/I[1],C=1/I[2],E=A[0]*B,i=A[1]*Q,o=A[2]*C,D=A[4]*B,a=A[5]*Q,t=A[6]*C,G=A[8]*B,s=A[9]*Q,w=A[10]*C,e=E+a+w,c=0;return e>0?(c=Math.sqrt(e+1)*2,g[3]=.25*c,g[0]=(t-s)/c,g[1]=(G-o)/c,g[2]=(i-D)/c):E>a&&E>w?(c=Math.sqrt(1+E-a-w)*2,g[3]=(t-s)/c,g[0]=.25*c,g[1]=(i+D)/c,g[2]=(G+o)/c):a>w?(c=Math.sqrt(1+a-E-w)*2,g[3]=(G-o)/c,g[0]=(i+D)/c,g[1]=.25*c,g[2]=(t+s)/c):(c=Math.sqrt(1+w-E-a)*2,g[3]=(i-D)/c,g[0]=(G+o)/c,g[1]=(t+s)/c,g[2]=.25*c),g}function dX(g,A,I,B){A[0]=B[12],A[1]=B[13],A[2]=B[14];let Q=B[0],C=B[1],E=B[2],i=B[4],o=B[5],D=B[6],a=B[8],t=B[9],G=B[10];I[0]=Math.sqrt(Q*Q+C*C+E*E),I[1]=Math.sqrt(i*i+o*o+D*D),I[2]=Math.sqrt(a*a+t*t+G*G);let s=1/I[0],w=1/I[1],e=1/I[2],c=Q*s,h=C*w,R=E*e,N=i*s,y=o*w,r=D*e,J=a*s,q=t*w,H=G*e,d=c+y+H,K=0;return d>0?(K=Math.sqrt(d+1)*2,g[3]=.25*K,g[0]=(r-q)/K,g[1]=(J-R)/K,g[2]=(h-N)/K):c>y&&c>H?(K=Math.sqrt(1+c-y-H)*2,g[3]=(r-q)/K,g[0]=.25*K,g[1]=(h+N)/K,g[2]=(J+R)/K):y>H?(K=Math.sqrt(1+y-c-H)*2,g[3]=(J-R)/K,g[0]=(h+N)/K,g[1]=.25*K,g[2]=(r+q)/K):(K=Math.sqrt(1+H-c-y)*2,g[3]=(h-N)/K,g[0]=(J+R)/K,g[1]=(r+q)/K,g[2]=.25*K),g}function pX(g,A,I,B){let Q=A[0],C=A[1],E=A[2],i=A[3],o=Q+Q,D=C+C,a=E+E,t=Q*o,G=Q*D,s=Q*a,w=C*D,e=C*a,c=E*a,h=i*o,R=i*D,N=i*a,y=B[0],r=B[1],J=B[2];return g[0]=(1-(w+c))*y,g[1]=(G+N)*y,g[2]=(s-R)*y,g[3]=0,g[4]=(G-N)*r,g[5]=(1-(t+c))*r,g[6]=(e+h)*r,g[7]=0,g[8]=(s+R)*J,g[9]=(e-h)*J,g[10]=(1-(t+w))*J,g[11]=0,g[12]=I[0],g[13]=I[1],g[14]=I[2],g[15]=1,g}function lX(g,A,I,B,Q){let C=A[0],E=A[1],i=A[2],o=A[3],D=C+C,a=E+E,t=i+i,G=C*D,s=C*a,w=C*t,e=E*a,c=E*t,h=i*t,R=o*D,N=o*a,y=o*t,r=B[0],J=B[1],q=B[2],H=Q[0],d=Q[1],K=Q[2],x=(1-(e+h))*r,W=(s+y)*r,u=(w-N)*r,m=(s-y)*J,_=(1-(G+h))*J,MA=(c+R)*J,qA=(w+N)*q,tA=(c-R)*q,cA=(1-(G+e))*q;return g[0]=x,g[1]=W,g[2]=u,g[3]=0,g[4]=m,g[5]=_,g[6]=MA,g[7]=0,g[8]=qA,g[9]=tA,g[10]=cA,g[11]=0,g[12]=I[0]+H-(x*H+m*d+qA*K),g[13]=I[1]+d-(W*H+_*d+tA*K),g[14]=I[2]+K-(u*H+MA*d+cA*K),g[15]=1,g}function fX(g,A){let I=A[0],B=A[1],Q=A[2],C=A[3],E=I+I,i=B+B,o=Q+Q,D=I*E,a=B*E,t=B*i,G=Q*E,s=Q*i,w=Q*o,e=C*E,c=C*i,h=C*o;return g[0]=1-t-w,g[1]=a+h,g[2]=G-c,g[3]=0,g[4]=a-h,g[5]=1-D-w,g[6]=s+e,g[7]=0,g[8]=G+c,g[9]=s-e,g[10]=1-D-t,g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,g}function mX(g,A,I,B,Q,C,E){let i=1/(I-A),o=1/(Q-B),D=1/(C-E);return g[0]=C*2*i,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=C*2*o,g[6]=0,g[7]=0,g[8]=(I+A)*i,g[9]=(Q+B)*o,g[10]=(E+C)*D,g[11]=-1,g[12]=0,g[13]=0,g[14]=E*C*2*D,g[15]=0,g}function ZS(g,A,I,B,Q){let C=1/Math.tan(A/2);if(g[0]=C/I,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=C,g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[11]=-1,g[12]=0,g[13]=0,g[15]=0,Q!=null&&Q!==1/0){let E=1/(B-Q);g[10]=(Q+B)*E,g[14]=2*Q*B*E}else g[10]=-1,g[14]=-2*B;return g}var xX=ZS;function uX(g,A,I,B,Q){let C=1/Math.tan(A/2);if(g[0]=C/I,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=C,g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[11]=-1,g[12]=0,g[13]=0,g[15]=0,Q!=null&&Q!==1/0){let E=1/(B-Q);g[10]=Q*E,g[14]=Q*B*E}else g[10]=-1,g[14]=-B;return g}function WX(g,A,I,B){let Q=Math.tan(A.upDegrees*Math.PI/180),C=Math.tan(A.downDegrees*Math.PI/180),E=Math.tan(A.leftDegrees*Math.PI/180),i=Math.tan(A.rightDegrees*Math.PI/180),o=2/(E+i),D=2/(Q+C);return g[0]=o,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=D,g[6]=0,g[7]=0,g[8]=-((E-i)*o*.5),g[9]=(Q-C)*D*.5,g[10]=B/(I-B),g[11]=-1,g[12]=0,g[13]=0,g[14]=B*I/(I-B),g[15]=0,g}function TS(g,A,I,B,Q,C,E){let i=1/(A-I),o=1/(B-Q),D=1/(C-E);return g[0]=-2*i,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=-2*o,g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[10]=2*D,g[11]=0,g[12]=(A+I)*i,g[13]=(Q+B)*o,g[14]=(E+C)*D,g[15]=1,g}var bX=TS;function ZX(g,A,I,B,Q,C,E){let i=1/(A-I),o=1/(B-Q),D=1/(C-E);return g[0]=-2*i,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=-2*o,g[6]=0,g[7]=0,g[8]=0,g[9]=0,g[10]=D,g[11]=0,g[12]=(A+I)*i,g[13]=(Q+B)*o,g[14]=C*D,g[15]=1,g}function TX(g,A,I,B){let Q,C,E,i,o,D,a,t,G,s,w=A[0],e=A[1],c=A[2],h=B[0],R=B[1],N=B[2],y=I[0],r=I[1],J=I[2];return Math.abs(w-y)<1e-6&&Math.abs(e-r)<1e-6&&Math.abs(c-J)<1e-6?xS(g):(t=w-y,G=e-r,s=c-J,Q=1/Math.sqrt(t*t+G*G+s*s),t*=Q,G*=Q,s*=Q,C=R*s-N*G,E=N*t-h*s,i=h*G-R*t,Q=Math.sqrt(C*C+E*E+i*i),Q?(Q=1/Q,C*=Q,E*=Q,i*=Q):(C=0,E=0,i=0),o=G*i-s*E,D=s*C-t*i,a=t*E-G*C,Q=Math.sqrt(o*o+D*D+a*a),Q?(Q=1/Q,o*=Q,D*=Q,a*=Q):(o=0,D=0,a=0),g[0]=C,g[1]=o,g[2]=t,g[3]=0,g[4]=E,g[5]=D,g[6]=G,g[7]=0,g[8]=i,g[9]=a,g[10]=s,g[11]=0,g[12]=-(C*w+E*e+i*c),g[13]=-(o*w+D*e+a*c),g[14]=-(t*w+G*e+s*c),g[15]=1,g)}function PX(g,A,I,B){let Q=A[0],C=A[1],E=A[2],i=B[0],o=B[1],D=B[2],a=Q-I[0],t=C-I[1],G=E-I[2],s=a*a+t*t+G*G;s>0&&(s=1/Math.sqrt(s),a*=s,t*=s,G*=s);let w=o*G-D*t,e=D*a-i*G,c=i*t-o*a;return s=w*w+e*e+c*c,s>0&&(s=1/Math.sqrt(s),w*=s,e*=s,c*=s),g[0]=w,g[1]=e,g[2]=c,g[3]=0,g[4]=t*c-G*e,g[5]=G*w-a*c,g[6]=a*e-t*w,g[7]=0,g[8]=a,g[9]=t,g[10]=G,g[11]=0,g[12]=Q,g[13]=C,g[14]=E,g[15]=1,g}function VX(g){return`mat4(${g[0]}, ${g[1]}, ${g[2]}, ${g[3]}, ${g[4]}, ${g[5]}, ${g[6]}, ${g[7]}, ${g[8]}, ${g[9]}, ${g[10]}, ${g[11]}, ${g[12]}, ${g[13]}, ${g[14]}, ${g[15]})`}function OX(g){return Math.sqrt(g[0]*g[0]+g[1]*g[1]+g[2]*g[2]+g[3]*g[3]+g[4]*g[4]+g[5]*g[5]+g[6]*g[6]+g[7]*g[7]+g[8]*g[8]+g[9]*g[9]+g[10]*g[10]+g[11]*g[11]+g[12]*g[12]+g[13]*g[13]+g[14]*g[14]+g[15]*g[15])}function jX(g,A,I){return g[0]=A[0]+I[0],g[1]=A[1]+I[1],g[2]=A[2]+I[2],g[3]=A[3]+I[3],g[4]=A[4]+I[4],g[5]=A[5]+I[5],g[6]=A[6]+I[6],g[7]=A[7]+I[7],g[8]=A[8]+I[8],g[9]=A[9]+I[9],g[10]=A[10]+I[10],g[11]=A[11]+I[11],g[12]=A[12]+I[12],g[13]=A[13]+I[13],g[14]=A[14]+I[14],g[15]=A[15]+I[15],g}function PS(g,A,I){return g[0]=A[0]-I[0],g[1]=A[1]-I[1],g[2]=A[2]-I[2],g[3]=A[3]-I[3],g[4]=A[4]-I[4],g[5]=A[5]-I[5],g[6]=A[6]-I[6],g[7]=A[7]-I[7],g[8]=A[8]-I[8],g[9]=A[9]-I[9],g[10]=A[10]-I[10],g[11]=A[11]-I[11],g[12]=A[12]-I[12],g[13]=A[13]-I[13],g[14]=A[14]-I[14],g[15]=A[15]-I[15],g}function XX(g,A,I){return g[0]=A[0]*I,g[1]=A[1]*I,g[2]=A[2]*I,g[3]=A[3]*I,g[4]=A[4]*I,g[5]=A[5]*I,g[6]=A[6]*I,g[7]=A[7]*I,g[8]=A[8]*I,g[9]=A[9]*I,g[10]=A[10]*I,g[11]=A[11]*I,g[12]=A[12]*I,g[13]=A[13]*I,g[14]=A[14]*I,g[15]=A[15]*I,g}function zX(g,A,I,B){return g[0]=A[0]+I[0]*B,g[1]=A[1]+I[1]*B,g[2]=A[2]+I[2]*B,g[3]=A[3]+I[3]*B,g[4]=A[4]+I[4]*B,g[5]=A[5]+I[5]*B,g[6]=A[6]+I[6]*B,g[7]=A[7]+I[7]*B,g[8]=A[8]+I[8]*B,g[9]=A[9]+I[9]*B,g[10]=A[10]+I[10]*B,g[11]=A[11]+I[11]*B,g[12]=A[12]+I[12]*B,g[13]=A[13]+I[13]*B,g[14]=A[14]+I[14]*B,g[15]=A[15]+I[15]*B,g}function vX(g,A){return g[0]===A[0]&&g[1]===A[1]&&g[2]===A[2]&&g[3]===A[3]&&g[4]===A[4]&&g[5]===A[5]&&g[6]===A[6]&&g[7]===A[7]&&g[8]===A[8]&&g[9]===A[9]&&g[10]===A[10]&&g[11]===A[11]&&g[12]===A[12]&&g[13]===A[13]&&g[14]===A[14]&&g[15]===A[15]}function _X(g,A){let I=g[0],B=g[1],Q=g[2],C=g[3],E=g[4],i=g[5],o=g[6],D=g[7],a=g[8],t=g[9],G=g[10],s=g[11],w=g[12],e=g[13],c=g[14],h=g[15],R=A[0],N=A[1],y=A[2],r=A[3],J=A[4],q=A[5],H=A[6],d=A[7],K=A[8],x=A[9],W=A[10],u=A[11],m=A[12],_=A[13],MA=A[14],qA=A[15];return Math.abs(I-R)<=1e-6*Math.max(1,Math.abs(I),Math.abs(R))&&Math.abs(B-N)<=1e-6*Math.max(1,Math.abs(B),Math.abs(N))&&Math.abs(Q-y)<=1e-6*Math.max(1,Math.abs(Q),Math.abs(y))&&Math.abs(C-r)<=1e-6*Math.max(1,Math.abs(C),Math.abs(r))&&Math.abs(E-J)<=1e-6*Math.max(1,Math.abs(E),Math.abs(J))&&Math.abs(i-q)<=1e-6*Math.max(1,Math.abs(i),Math.abs(q))&&Math.abs(o-H)<=1e-6*Math.max(1,Math.abs(o),Math.abs(H))&&Math.abs(D-d)<=1e-6*Math.max(1,Math.abs(D),Math.abs(d))&&Math.abs(a-K)<=1e-6*Math.max(1,Math.abs(a),Math.abs(K))&&Math.abs(t-x)<=1e-6*Math.max(1,Math.abs(t),Math.abs(x))&&Math.abs(G-W)<=1e-6*Math.max(1,Math.abs(G),Math.abs(W))&&Math.abs(s-u)<=1e-6*Math.max(1,Math.abs(s),Math.abs(u))&&Math.abs(w-m)<=1e-6*Math.max(1,Math.abs(w),Math.abs(m))&&Math.abs(e-_)<=1e-6*Math.max(1,Math.abs(e),Math.abs(_))&&Math.abs(c-MA)<=1e-6*Math.max(1,Math.abs(c),Math.abs(MA))&&Math.abs(h-qA)<=1e-6*Math.max(1,Math.abs(h),Math.abs(qA))}var $X=uS,A1=PS;function g1(){let g=new gg(4);return gg!=Float32Array&&(g[0]=0,g[1]=0,g[2]=0,g[3]=0),g}function VS(g,A,I){return g[0]=A[0]+I[0],g[1]=A[1]+I[1],g[2]=A[2]+I[2],g[3]=A[3]+I[3],g}function OS(g,A,I){return g[0]=A[0]*I,g[1]=A[1]*I,g[2]=A[2]*I,g[3]=A[3]*I,g}function jS(g){let A=g[0],I=g[1],B=g[2],Q=g[3];return Math.sqrt(A*A+I*I+B*B+Q*Q)}function XS(g){let A=g[0],I=g[1],B=g[2],Q=g[3];return A*A+I*I+B*B+Q*Q}function zS(g,A){let I=A[0],B=A[1],Q=A[2],C=A[3],E=I*I+B*B+Q*Q+C*C;return E>0&&(E=1/Math.sqrt(E)),g[0]=I*E,g[1]=B*E,g[2]=Q*E,g[3]=C*E,g}function vS(g,A){return g[0]*A[0]+g[1]*A[1]+g[2]*A[2]+g[3]*A[3]}function _S(g,A,I,B){let Q=A[0],C=A[1],E=A[2],i=A[3];return g[0]=Q+B*(I[0]-Q),g[1]=C+B*(I[1]-C),g[2]=E+B*(I[2]-E),g[3]=i+B*(I[3]-i),g}function $S(g,A,I){let B=A[0],Q=A[1],C=A[2],E=I[0],i=I[1],o=I[2],D=I[3],a=D*B+i*C-o*Q,t=D*Q+o*B-E*C,G=D*C+E*Q-i*B,s=-E*B-i*Q-o*C;return g[0]=a*D+s*-E+t*-o-G*-i,g[1]=t*D+s*-i+G*-E-a*-o,g[2]=G*D+s*-o+a*-i-t*-E,g[3]=A[3],g}var RrA=function(){let g=g1();return function(A,I,B,Q,C,E){let i,o;for(I||(I=4),B||(B=0),Q?o=Math.min(Q*I+B,A.length):o=A.length,i=B;i<o;i+=I)g[0]=A[i],g[1]=A[i+1],g[2]=A[i+2],g[3]=A[i+3],C(g,g,E),A[i]=g[0],A[i+1]=g[1],A[i+2]=g[2],A[i+3]=g[3];return A}}();function gL(){let g=new gg(4);return gg!=Float32Array&&(g[0]=0,g[1]=0,g[2]=0),g[3]=1,g}function IL(g){return g[0]=0,g[1]=0,g[2]=0,g[3]=1,g}function Kr(g,A,I){I=I*.5;let B=Math.sin(I);return g[0]=B*A[0],g[1]=B*A[1],g[2]=B*A[2],g[3]=Math.cos(I),g}function qr(g,A,I){let B=A[0],Q=A[1],C=A[2],E=A[3],i=I[0],o=I[1],D=I[2],a=I[3];return g[0]=B*a+E*i+Q*D-C*o,g[1]=Q*a+E*o+C*i-B*D,g[2]=C*a+E*D+B*o-Q*i,g[3]=E*a-B*i-Q*o-C*D,g}function BL(g,A,I){I*=.5;let B=A[0],Q=A[1],C=A[2],E=A[3],i=Math.sin(I),o=Math.cos(I);return g[0]=B*o+E*i,g[1]=Q*o+C*i,g[2]=C*o-Q*i,g[3]=E*o-B*i,g}function QL(g,A,I){I*=.5;let B=A[0],Q=A[1],C=A[2],E=A[3],i=Math.sin(I),o=Math.cos(I);return g[0]=B*o-C*i,g[1]=Q*o+E*i,g[2]=C*o+B*i,g[3]=E*o-Q*i,g}function CL(g,A,I){I*=.5;let B=A[0],Q=A[1],C=A[2],E=A[3],i=Math.sin(I),o=Math.cos(I);return g[0]=B*o+Q*i,g[1]=Q*o-B*i,g[2]=C*o+E*i,g[3]=E*o-C*i,g}function EL(g,A){let I=A[0],B=A[1],Q=A[2];return g[0]=I,g[1]=B,g[2]=Q,g[3]=Math.sqrt(Math.abs(1-I*I-B*B-Q*Q)),g}function BG(g,A,I,B){let Q=A[0],C=A[1],E=A[2],i=A[3],o=I[0],D=I[1],a=I[2],t=I[3],G,s,w,e,c;return G=Q*o+C*D+E*a+i*t,G<0&&(G=-G,o=-o,D=-D,a=-a,t=-t),1-G>1e-6?(s=Math.acos(G),c=Math.sin(s),w=Math.sin((1-B)*s)/c,e=Math.sin(B*s)/c):(w=1-B,e=B),g[0]=w*Q+e*o,g[1]=w*C+e*D,g[2]=w*E+e*a,g[3]=w*i+e*t,g}function iL(g,A){let I=A[0],B=A[1],Q=A[2],C=A[3],E=I*I+B*B+Q*Q+C*C,i=E?1/E:0;return g[0]=-I*i,g[1]=-B*i,g[2]=-Q*i,g[3]=C*i,g}function oL(g,A){return g[0]=-A[0],g[1]=-A[1],g[2]=-A[2],g[3]=A[3],g}function Ur(g,A){let I=A[0]+A[4]+A[8],B;if(I>0)B=Math.sqrt(I+1),g[3]=.5*B,B=.5/B,g[0]=(A[5]-A[7])*B,g[1]=(A[6]-A[2])*B,g[2]=(A[1]-A[3])*B;else{let Q=0;A[4]>A[0]&&(Q=1),A[8]>A[Q*3+Q]&&(Q=2);let C=(Q+1)%3,E=(Q+2)%3;B=Math.sqrt(A[Q*3+Q]-A[C*3+C]-A[E*3+E]+1),g[Q]=.5*B,B=.5/B,g[3]=(A[C*3+E]-A[E*3+C])*B,g[C]=(A[C*3+Q]+A[Q*3+C])*B,g[E]=(A[E*3+Q]+A[Q*3+E])*B}return g}var DL=VS;var aL=OS,tL=vS,GL=_S,sL=jS;var wL=XS;var cL=zS;var eL=function(){let g=yr(),A=rr(1,0,0),I=rr(0,1,0);return function(B,Q,C){let E=nr(Q,C);return E<-.999999?(Zo(g,A,Q),qS(g)<1e-6&&Zo(g,I,Q),RS(g,g),Kr(B,g,Math.PI),B):E>.999999?(B[0]=0,B[1]=0,B[2]=0,B[3]=1,B):(Zo(g,Q,C),B[0]=g[0],B[1]=g[1],B[2]=g[2],B[3]=1+E,cL(B,B))}}(),UrA=function(){let g=gL(),A=gL();return function(I,B,Q,C,E,i){return BG(g,B,E,i),BG(A,Q,C,i),BG(I,g,A,2*i*(1-i)),I}}(),HrA=function(){let g=HS();return function(A,I,B,Q){return g[0]=B[0],g[3]=B[1],g[6]=B[2],g[1]=Q[0],g[4]=Q[1],g[7]=Q[2],g[2]=-I[0],g[5]=-I[1],g[8]=-I[2],cL(A,Ur(A,g))}}();var B1=[0,0,0,1],To=class extends oE{constructor(A=0,I=0,B=0,Q=1){super(-0,-0,-0,-0),Array.isArray(A)&&arguments.length===1?this.copy(A):this.set(A,I,B,Q)}copy(A){return this[0]=A[0],this[1]=A[1],this[2]=A[2],this[3]=A[3],this.check()}set(A,I,B,Q){return this[0]=A,this[1]=I,this[2]=B,this[3]=Q,this.check()}fromObject(A){return this[0]=A.x,this[1]=A.y,this[2]=A.z,this[3]=A.w,this.check()}fromMatrix3(A){return Ur(this,A),this.check()}fromAxisRotation(A,I){return Kr(this,A,I),this.check()}identity(){return IL(this),this.check()}setAxisAngle(A,I){return this.fromAxisRotation(A,I)}get ELEMENTS(){return 4}get x(){return this[0]}set x(A){this[0]=UA(A)}get y(){return this[1]}set y(A){this[1]=UA(A)}get z(){return this[2]}set z(A){this[2]=UA(A)}get w(){return this[3]}set w(A){this[3]=UA(A)}len(){return sL(this)}lengthSquared(){return wL(this)}dot(A){return tL(this,A)}rotationTo(A,I){return eL(this,A,I),this.check()}add(A){return DL(this,this,A),this.check()}calculateW(){return EL(this,this),this.check()}conjugate(){return oL(this,this),this.check()}invert(){return iL(this,this),this.check()}lerp(A,I,B){return B===void 0?this.lerp(this,A,I):(GL(this,A,I,B),this.check())}multiplyRight(A){return qr(this,this,A),this.check()}multiplyLeft(A){return qr(this,A,this),this.check()}normalize(){let A=this.len(),I=A>0?1/A:0;return this[0]=this[0]*I,this[1]=this[1]*I,this[2]=this[2]*I,this[3]=this[3]*I,A===0&&(this[3]=1),this.check()}rotateX(A){return BL(this,this,A),this.check()}rotateY(A){return QL(this,this,A),this.check()}rotateZ(A){return CL(this,this,A),this.check()}scale(A){return aL(this,this,A),this.check()}slerp(A,I,B){let Q,C,E;switch(arguments.length){case 1:({start:Q=B1,target:C,ratio:E}=A);break;case 2:Q=this,C=A,E=I;break;default:Q=A,C=I,E=B}return BG(this,Q,C,E),this.check()}transformVector4(A,I=new me){return $S(I,A,this),He(I,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(A,I){return this.setAxisAngle(A,I)}premultiply(A){return this.multiplyLeft(A)}multiply(A){return this.multiplyRight(A)}};var QG={};rg(QG,{EPSILON1:()=>Q1,EPSILON10:()=>s1,EPSILON11:()=>w1,EPSILON12:()=>c1,EPSILON13:()=>e1,EPSILON14:()=>N1,EPSILON15:()=>k1,EPSILON16:()=>h1,EPSILON17:()=>F1,EPSILON18:()=>y1,EPSILON19:()=>r1,EPSILON2:()=>C1,EPSILON20:()=>n1,EPSILON3:()=>E1,EPSILON4:()=>i1,EPSILON5:()=>o1,EPSILON6:()=>D1,EPSILON7:()=>a1,EPSILON8:()=>t1,EPSILON9:()=>G1,PI_OVER_FOUR:()=>M1,PI_OVER_SIX:()=>J1,PI_OVER_TWO:()=>R1,TWO_PI:()=>Y1});var Q1=.1,C1=.01,E1=.001,i1=1e-4,o1=1e-5,D1=1e-6,a1=1e-7,t1=1e-8,G1=1e-9,s1=1e-10,w1=1e-11,c1=1e-12,e1=1e-13,N1=1e-14,k1=1e-15,h1=1e-16,F1=1e-17,y1=1e-18,r1=1e-19,n1=1e-20,R1=Math.PI/2,M1=Math.PI/4,J1=Math.PI/6,Y1=Math.PI*2;var NL=new V,K1=new V,Po=class g{constructor(A=[0,0,0],I=[0,0,0],B){B=B||NL.copy(A).add(I).scale(.5),this.center=new V(B),this.halfDiagonal=new V(I).subtract(this.center),this.minimum=new V(A),this.maximum=new V(I)}clone(){return new g(this.minimum,this.maximum,this.center)}equals(A){return this===A||!!A&&this.minimum.equals(A.minimum)&&this.maximum.equals(A.maximum)}transform(A){return this.center.transformAsPoint(A),this.halfDiagonal.transform(A),this.minimum.transform(A),this.maximum.transform(A),this}intersectPlane(A){let{halfDiagonal:I}=this,B=K1.from(A.normal),Q=I.x*Math.abs(B.x)+I.y*Math.abs(B.y)+I.z*Math.abs(B.z),C=this.center.dot(B)+A.distance;return C-Q>0?ag.INSIDE:C+Q<0?ag.OUTSIDE:ag.INTERSECTING}distanceTo(A){return Math.sqrt(this.distanceSquaredTo(A))}distanceSquaredTo(A){let I=NL.from(A).subtract(this.center),{halfDiagonal:B}=this,Q=0,C;return C=Math.abs(I.x)-B.x,C>0&&(Q+=C*C),C=Math.abs(I.y)-B.y,C>0&&(Q+=C*C),C=Math.abs(I.z)-B.z,C>0&&(Q+=C*C),Q}};var CG=new V,kL=new V,Vo=class g{constructor(A=[0,0,0],I=0){this.radius=-0,this.center=new V,this.fromCenterRadius(A,I)}fromCenterRadius(A,I){return this.center.from(A),this.radius=I,this}fromCornerPoints(A,I){return I=CG.from(I),this.center=new V().from(A).add(I).scale(.5),this.radius=this.center.distance(I),this}equals(A){return this===A||!!A&&this.center.equals(A.center)&&this.radius===A.radius}clone(){return new g(this.center,this.radius)}union(A){let I=this.center,B=this.radius,Q=A.center,C=A.radius,E=CG.copy(Q).subtract(I),i=E.magnitude();if(B>=i+C)return this.clone();if(C>=i+B)return A.clone();let o=(B+i+C)*.5;return kL.copy(E).scale((-B+o)/i).add(I),this.center.copy(kL),this.radius=o,this}expand(A){let B=CG.from(A).subtract(this.center).magnitude();return B>this.radius&&(this.radius=B),this}transform(A){this.center.transform(A);let I=be.getScaling(CG,A);return this.radius=Math.max(I[0],Math.max(I[1],I[2]))*this.radius,this}distanceSquaredTo(A){let I=this.distanceTo(A);return I*I}distanceTo(A){let B=CG.from(A).subtract(this.center);return Math.max(0,B.len()-this.radius)}intersectPlane(A){let I=this.center,B=this.radius,C=A.normal.dot(I)+A.distance;return C<-B?ag.OUTSIDE:C<B?ag.INTERSECTING:ag.INSIDE}};var q1=new V,U1=new V,Ze=new V,Te=new V,Pe=new V,H1=new V,S1=new V,vQ={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},EG=class g{constructor(A=[0,0,0],I=[0,0,0,0,0,0,0,0,0]){this.center=new V().from(A),this.halfAxes=new Ig(I)}get halfSize(){let A=this.halfAxes.getColumn(0),I=this.halfAxes.getColumn(1),B=this.halfAxes.getColumn(2);return[new V(A).len(),new V(I).len(),new V(B).len()]}get quaternion(){let A=this.halfAxes.getColumn(0),I=this.halfAxes.getColumn(1),B=this.halfAxes.getColumn(2),Q=new V(A).normalize(),C=new V(I).normalize(),E=new V(B).normalize();return new To().fromMatrix3(new Ig([...Q,...C,...E]))}fromCenterHalfSizeQuaternion(A,I,B){let Q=new To(B),C=new Ig().fromQuaternion(Q);return C[0]=C[0]*I[0],C[1]=C[1]*I[0],C[2]=C[2]*I[0],C[3]=C[3]*I[1],C[4]=C[4]*I[1],C[5]=C[5]*I[1],C[6]=C[6]*I[2],C[7]=C[7]*I[2],C[8]=C[8]*I[2],this.center=new V().from(A),this.halfAxes=C,this}clone(){return new g(this.center,this.halfAxes)}equals(A){return this===A||!!A&&this.center.equals(A.center)&&this.halfAxes.equals(A.halfAxes)}getBoundingSphere(A=new Vo){let I=this.halfAxes,B=I.getColumn(0,Ze),Q=I.getColumn(1,Te),C=I.getColumn(2,Pe),E=q1.copy(B).add(Q).add(C);return A.center.copy(this.center),A.radius=E.magnitude(),A}intersectPlane(A){let I=this.center,B=A.normal,Q=this.halfAxes,C=B.x,E=B.y,i=B.z,o=Math.abs(C*Q[vQ.COLUMN0ROW0]+E*Q[vQ.COLUMN0ROW1]+i*Q[vQ.COLUMN0ROW2])+Math.abs(C*Q[vQ.COLUMN1ROW0]+E*Q[vQ.COLUMN1ROW1]+i*Q[vQ.COLUMN1ROW2])+Math.abs(C*Q[vQ.COLUMN2ROW0]+E*Q[vQ.COLUMN2ROW1]+i*Q[vQ.COLUMN2ROW2]),D=B.dot(I)+A.distance;return D<=-o?ag.OUTSIDE:D>=o?ag.INSIDE:ag.INTERSECTING}distanceTo(A){return Math.sqrt(this.distanceSquaredTo(A))}distanceSquaredTo(A){let I=U1.from(A).subtract(this.center),B=this.halfAxes,Q=B.getColumn(0,Ze),C=B.getColumn(1,Te),E=B.getColumn(2,Pe),i=Q.magnitude(),o=C.magnitude(),D=E.magnitude();Q.normalize(),C.normalize(),E.normalize();let a=0,t;return t=Math.abs(I.dot(Q))-i,t>0&&(a+=t*t),t=Math.abs(I.dot(C))-o,t>0&&(a+=t*t),t=Math.abs(I.dot(E))-D,t>0&&(a+=t*t),a}computePlaneDistances(A,I,B=[-0,-0]){let Q=Number.POSITIVE_INFINITY,C=Number.NEGATIVE_INFINITY,E=this.center,i=this.halfAxes,o=i.getColumn(0,Ze),D=i.getColumn(1,Te),a=i.getColumn(2,Pe),t=H1.copy(o).add(D).add(a).add(E),G=S1.copy(t).subtract(A),s=I.dot(G);return Q=Math.min(s,Q),C=Math.max(s,C),t.copy(E).add(o).add(D).subtract(a),G.copy(t).subtract(A),s=I.dot(G),Q=Math.min(s,Q),C=Math.max(s,C),t.copy(E).add(o).subtract(D).add(a),G.copy(t).subtract(A),s=I.dot(G),Q=Math.min(s,Q),C=Math.max(s,C),t.copy(E).add(o).subtract(D).subtract(a),G.copy(t).subtract(A),s=I.dot(G),Q=Math.min(s,Q),C=Math.max(s,C),E.copy(t).subtract(o).add(D).add(a),G.copy(t).subtract(A),s=I.dot(G),Q=Math.min(s,Q),C=Math.max(s,C),E.copy(t).subtract(o).add(D).subtract(a),G.copy(t).subtract(A),s=I.dot(G),Q=Math.min(s,Q),C=Math.max(s,C),E.copy(t).subtract(o).subtract(D).add(a),G.copy(t).subtract(A),s=I.dot(G),Q=Math.min(s,Q),C=Math.max(s,C),E.copy(t).subtract(o).subtract(D).subtract(a),G.copy(t).subtract(A),s=I.dot(G),Q=Math.min(s,Q),C=Math.max(s,C),B[0]=Q,B[1]=C,B}transform(A){this.center.transformAsPoint(A);let I=this.halfAxes.getColumn(0,Ze);I.transformAsPoint(A);let B=this.halfAxes.getColumn(1,Te);B.transformAsPoint(A);let Q=this.halfAxes.getColumn(2,Pe);return Q.transformAsPoint(A),this.halfAxes=new Ig([...I,...B,...Q]),this}getTransform(){throw new Error("not implemented")}};var hL=new V,FL=new V,_Q=class g{constructor(A=[0,0,1],I=0){this.normal=new V,this.distance=-0,this.fromNormalDistance(A,I)}fromNormalDistance(A,I){return cQ(Number.isFinite(I)),this.normal.from(A).normalize(),this.distance=I,this}fromPointNormal(A,I){A=hL.from(A),this.normal.from(I).normalize();let B=-this.normal.dot(A);return this.distance=B,this}fromCoefficients(A,I,B,Q){return this.normal.set(A,I,B),cQ(iE(this.normal.len(),1)),this.distance=Q,this}clone(){return new g(this.normal,this.distance)}equals(A){return iE(this.distance,A.distance)&&iE(this.normal,A.normal)}getPointDistance(A){return this.normal.dot(A)+this.distance}transform(A){let I=FL.copy(this.normal).transformAsVector(A).normalize(),B=this.normal.scale(-this.distance).transform(A);return this.fromPointNormal(B,I)}projectPointOntoPlane(A,I=[0,0,0]){let B=hL.from(A),Q=this.getPointDistance(B),C=FL.copy(this.normal).scale(Q);return B.subtract(C).to(I)}};var yL=[new V([1,0,0]),new V([0,1,0]),new V([0,0,1])],rL=new V,L1=new V,$Q=class g{constructor(A=[]){this.planes=A}fromBoundingSphere(A){this.planes.length=2*yL.length;let I=A.center,B=A.radius,Q=0;for(let C of yL){let E=this.planes[Q],i=this.planes[Q+1];E||(E=this.planes[Q]=new _Q),i||(i=this.planes[Q+1]=new _Q);let o=rL.copy(C).scale(-B).add(I);E.fromPointNormal(o,C);let D=rL.copy(C).scale(B).add(I),a=L1.copy(C).negate();i.fromPointNormal(D,a),Q+=2}return this}computeVisibility(A){let I=ag.INSIDE;for(let B of this.planes)switch(A.intersectPlane(B)){case ag.OUTSIDE:return ag.OUTSIDE;case ag.INTERSECTING:I=ag.INTERSECTING;break;default:}return I}computeVisibilityWithPlaneMask(A,I){if(cQ(Number.isFinite(I),"parentPlaneMask is required."),I===g.MASK_OUTSIDE||I===g.MASK_INSIDE)return I;let B=g.MASK_INSIDE,Q=this.planes;for(let C=0;C<this.planes.length;++C){let E=C<31?1<<C:0;if(C<31&&!(I&E))continue;let i=Q[C],o=A.intersectPlane(i);if(o===ag.OUTSIDE)return g.MASK_OUTSIDE;o===ag.INTERSECTING&&(B|=E)}return B}};$Q.MASK_OUTSIDE=4294967295;$Q.MASK_INSIDE=0;$Q.MASK_INDETERMINATE=2147483647;var JnA=new V,YnA=new V,KnA=new V,qnA=new V,UnA=new V;var lnA=new V,fnA=new V,mnA=new V,xnA=new V,unA=new V,WnA=new V,bnA=new V,ZnA=new V,TnA=new V,PnA=new V,VnA=new V,OnA=new V;var eQ=new Ig,p1=new Ig,l1=new Ig,Ve=new Ig,nL=new Ig;function Lr(g,A={}){let I=QG.EPSILON20,B=10,Q=0,C=0,E=p1,i=l1;E.identity(),i.copy(g);let o=I*f1(i);for(;C<B&&m1(i)>o;)x1(i,Ve),nL.copy(Ve).transpose(),i.multiplyRight(Ve),i.multiplyLeft(nL),E.multiplyRight(Ve),++Q>2&&(++C,Q=0);return A.unitary=E.toTarget(A.unitary),A.diagonal=i.toTarget(A.diagonal),A}function f1(g){let A=0;for(let I=0;I<9;++I){let B=g[I];A+=B*B}return Math.sqrt(A)}var Hr=[1,0,0],Sr=[2,2,1];function m1(g){let A=0;for(let I=0;I<3;++I){let B=g[eQ.getElementIndex(Sr[I],Hr[I])];A+=2*B*B}return Math.sqrt(A)}function x1(g,A){let I=QG.EPSILON15,B=0,Q=1;for(let D=0;D<3;++D){let a=Math.abs(g[eQ.getElementIndex(Sr[D],Hr[D])]);a>B&&(Q=D,B=a)}let C=Hr[Q],E=Sr[Q],i=1,o=0;if(Math.abs(g[eQ.getElementIndex(E,C)])>I){let D=g[eQ.getElementIndex(E,E)],a=g[eQ.getElementIndex(C,C)],t=g[eQ.getElementIndex(E,C)],G=(D-a)/2/t,s;G<0?s=-1/(-G+Math.sqrt(1+G*G)):s=1/(G+Math.sqrt(1+G*G)),i=1/Math.sqrt(1+s*s),o=s*i}return Ig.IDENTITY.to(A),A[eQ.getElementIndex(C,C)]=A[eQ.getElementIndex(E,E)]=i,A[eQ.getElementIndex(E,C)]=o,A[eQ.getElementIndex(C,E)]=-o,A}var DE=new V,u1=new V,W1=new V,b1=new V,Z1=new V,T1=new Ig,P1={diagonal:new Ig,unitary:new Ig};function dr(g,A=new EG){if(!g||g.length===0)return A.halfAxes=new Ig([0,0,0,0,0,0,0,0,0]),A.center=new V,A;let I=g.length,B=new V(0,0,0);for(let d of g)B.add(d);let Q=1/I;B.multiplyByScalar(Q);let C=0,E=0,i=0,o=0,D=0,a=0;for(let d of g){let K=DE.copy(d).subtract(B);C+=K.x*K.x,E+=K.x*K.y,i+=K.x*K.z,o+=K.y*K.y,D+=K.y*K.z,a+=K.z*K.z}C*=Q,E*=Q,i*=Q,o*=Q,D*=Q,a*=Q;let t=T1;t[0]=C,t[1]=E,t[2]=i,t[3]=E,t[4]=o,t[5]=D,t[6]=i,t[7]=D,t[8]=a;let{unitary:G}=Lr(t,P1),s=A.halfAxes.copy(G),w=s.getColumn(0,W1),e=s.getColumn(1,b1),c=s.getColumn(2,Z1),h=-Number.MAX_VALUE,R=-Number.MAX_VALUE,N=-Number.MAX_VALUE,y=Number.MAX_VALUE,r=Number.MAX_VALUE,J=Number.MAX_VALUE;for(let d of g)DE.copy(d),h=Math.max(DE.dot(w),h),R=Math.max(DE.dot(e),R),N=Math.max(DE.dot(c),N),y=Math.min(DE.dot(w),y),r=Math.min(DE.dot(e),r),J=Math.min(DE.dot(c),J);w=w.multiplyByScalar(.5*(y+h)),e=e.multiplyByScalar(.5*(r+R)),c=c.multiplyByScalar(.5*(J+N)),A.center.copy(w).add(e).add(c);let q=u1.set(h-y,R-r,N-J).multiplyByScalar(.5),H=new Ig([q[0],0,0,0,q[1],0,0,0,q[2]]);return A.halfAxes.multiplyRight(H),A}var Oo=512,RL=3,ML=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],JL=ML.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),V1=JL.concat([[.25,.5],[.75,.5]]),pr=class g{constructor(A,I,B){this.x=A,this.y=I,this.z=B}get children(){if(!this._children){let A=this.x*2,I=this.y*2,B=this.z+1;this._children=[new g(A,I,B),new g(A,I+1,B),new g(A+1,I,B),new g(A+1,I+1,B)]}return this._children}update(A){let{viewport:I,cullingVolume:B,elevationBounds:Q,minZ:C,maxZ:E,bounds:i,offset:o,project:D}=A,a=this.getBoundingVolume(Q,o,D);if(i&&!this.insideBounds(i)||B.computeVisibility(a)<0)return!1;if(!this.childVisible){let{z:G}=this;if(G<E&&G>=C){let s=a.distanceTo(I.cameraPosition)*I.scale/I.height;G+=Math.floor(Math.log2(s))}if(G>=E)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(let G of this.children)G.update(A);return!0}getSelected(A=[]){if(this.selected&&A.push(this),this._children)for(let I of this._children)I.getSelected(A);return A}insideBounds([A,I,B,Q]){let C=Math.pow(2,this.z),E=Oo/C;return this.x*E<B&&this.y*E<Q&&(this.x+1)*E>A&&(this.y+1)*E>I}getBoundingVolume(A,I,B){if(B){let o=this.z<1?V1:this.z<2?JL:ML,D=[];for(let a of o){let t=Oe(this.x+a[0],this.y+a[1],this.z);t[2]=A[0],D.push(B(t)),A[0]!==A[1]&&(t[2]=A[1],D.push(B(t)))}return dr(D)}let Q=Math.pow(2,this.z),C=Oo/Q,E=this.x*C+I*Oo,i=Oo-(this.y+1)*C;return new Po([E,i,A[0]],[E+C,i+C,A[1]])}};function YL(g,A,I,B){let Q=g instanceof oi&&g.resolution?g.projectPosition:null,C=Object.values(g.getFrustumPlanes()).map(({normal:s,distance:w})=>new _Q(s.clone().negate(),w)),E=new $Q(C),i=g.distanceScales.unitsPerMeter[2],o=I&&I[0]*i||0,D=I&&I[1]*i||0,a=g instanceof ZQ&&g.pitch<=60?A:0;if(B){let[s,w,e,c]=B,h=gI([s,c]),R=gI([e,w]);B=[h[0],Oo-h[1],R[0],Oo-R[1]]}let t=new pr(0,0,0),G={viewport:g,project:Q,cullingVolume:E,elevationBounds:[o,D],minZ:a,maxZ:A,bounds:B,offset:0};if(t.update(G),g instanceof ZQ&&g.subViewports&&g.subViewports.length>1){for(G.offset=-1;t.update(G)&&!(--G.offset<-RL););for(G.offset=1;t.update(G)&&!(++G.offset>RL););}return t.getSelected()}var AC=512,O1=[-1/0,-1/0,1/0,1/0],fr={type:"object",value:null,validate:(g,A)=>A.optional&&g===null||typeof g=="string"||Array.isArray(g)&&g.every(I=>typeof I=="string"),equal:(g,A)=>{if(g===A)return!0;if(!Array.isArray(g)||!Array.isArray(A))return!1;let I=g.length;if(I!==A.length)return!1;for(let B=0;B<I;B++)if(g[B]!==A[B])return!1;return!0}};function qL(g,A){let I=[A.transformAsPoint([g[0],g[1]]),A.transformAsPoint([g[2],g[1]]),A.transformAsPoint([g[0],g[3]]),A.transformAsPoint([g[2],g[3]])];return[Math.min(...I.map(Q=>Q[0])),Math.min(...I.map(Q=>Q[1])),Math.max(...I.map(Q=>Q[0])),Math.max(...I.map(Q=>Q[1]))]}function j1(g){return Math.abs(g.split("").reduce((A,I)=>(A<<5)-A+I.charCodeAt(0)|0,0))}function mr(g,A){if(!g||!g.length)return null;let{index:I,id:B}=A;if(Array.isArray(g)){let C=j1(B)%g.length;g=g[C]}let Q=g;for(let C of Object.keys(I)){let E=new RegExp(`{${C}}`,"g");Q=Q.replace(E,String(I[C]))}return Number.isInteger(I.y)&&Number.isInteger(I.z)&&(Q=Q.replace(/\{-y\}/g,String(Math.pow(2,I.z)-I.y-1))),Q}function X1(g,A,I){let B;if(A&&A.length===2){let[Q,C]=A,E=g.getBounds({z:Q}),i=g.getBounds({z:C});B=[Math.min(E[0],i[0]),Math.min(E[1],i[1]),Math.max(E[2],i[2]),Math.max(E[3],i[3])]}else B=g.getBounds();return g.isGeospatial?[Math.max(B[0],I[0]),Math.max(B[1],I[1]),Math.min(B[2],I[2]),Math.min(B[3],I[3])]:[Math.max(Math.min(B[0],I[2]),I[0]),Math.max(Math.min(B[1],I[3]),I[1]),Math.min(Math.max(B[2],I[0]),I[2]),Math.min(Math.max(B[3],I[1]),I[3])]}function UL({viewport:g,z:A,cullRect:I}){return(g.subViewports||[g]).map(Q=>lr(Q,A||0,I))}function lr(g,A,I){if(!Array.isArray(A)){let C=I.x-g.x,E=I.y-g.y,{width:i,height:o}=I,D={targetZ:A},a=g.unproject([C,E],D),t=g.unproject([C+i,E],D),G=g.unproject([C,E+o],D),s=g.unproject([C+i,E+o],D);return[Math.min(a[0],t[0],G[0],s[0]),Math.min(a[1],t[1],G[1],s[1]),Math.max(a[0],t[0],G[0],s[0]),Math.max(a[1],t[1],G[1],s[1])]}let B=lr(g,A[0],I),Q=lr(g,A[1],I);return[Math.min(B[0],Q[0]),Math.min(B[1],Q[1]),Math.max(B[2],Q[2]),Math.max(B[3],Q[3])]}function z1(g,A,I){return I?qL(g,I).map(Q=>Q*A/AC):g.map(B=>B*A/AC)}function xr(g,A){return Math.pow(2,g)*AC/A}function Oe(g,A,I){let B=xr(I,AC),Q=g/B*360-180,C=Math.PI-2*Math.PI*A/B,E=180/Math.PI*Math.atan(.5*(Math.exp(C)-Math.exp(-C)));return[Q,E]}function KL(g,A,I,B){let Q=xr(I,B);return[g/Q*AC,A/Q*AC]}function ur(g,A,I,B,Q=AC){if(g.isGeospatial){let[D,a]=Oe(A,I,B),[t,G]=Oe(A+1,I+1,B);return{west:D,north:a,east:t,south:G}}let[C,E]=KL(A,I,B,Q),[i,o]=KL(A+1,I+1,B,Q);return{left:C,top:E,right:i,bottom:o}}function v1(g,A,I,B,Q){let C=X1(g,null,B),E=xr(A,I),[i,o,D,a]=z1(C,E,Q),t=[];for(let G=Math.floor(i);G<D;G++)for(let s=Math.floor(o);s<a;s++)t.push({x:G,y:s,z:A});return t}function Wr({viewport:g,maxZoom:A,minZoom:I,zRange:B,extent:Q,tileSize:C=AC,modelMatrix:E,modelMatrixInverse:i,zoomOffset:o=0}){let D=g.isGeospatial?Math.round(g.zoom+Math.log2(AC/C))+o:Math.ceil(g.zoom)+o;if(typeof I=="number"&&Number.isFinite(I)&&D<I){if(!Q)return[];D=I}typeof A=="number"&&Number.isFinite(A)&&D>A&&(D=A);let a=Q;return E&&i&&Q&&!g.isGeospatial&&(a=qL(Q,E)),g.isGeospatial?YL(g,D,B,Q):v1(g,D,C,a||O1,i)}function HL(g){let A={},I;return B=>{for(let Q in B)if(!_1(B[Q],A[Q])){I=g(B),A=B;break}return I}}function _1(g,A){if(g===A)return!0;if(Array.isArray(g)){let I=g.length;if(!A||A.length!==I)return!1;for(let B=0;B<I;B++)if(g[B]!==A[B])return!1;return!0}return!1}var SL=1,je=2,$1="never",Az="no-overlap",iG="best-available",gz=5,Iz={[iG]:Qz,[Az]:Cz,[$1]:()=>{}},Bz={extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:"best-available",zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{}},jo=class{constructor(A){this._getCullBounds=HL(UL),this.opts={...Bz,...A},this.setOptions(this.opts),this.onTileLoad=I=>{this.opts.onTileLoad?.(I),this.opts.maxCacheByteSize!=null&&(this._cacheByteSize+=I.byteLength,this._resizeCache())},this._requestScheduler=new zi({throttleRequests:this.opts.maxRequests>0||this.opts.debounceTime>0,maxRequests:this.opts.maxRequests,debounceTime:this.opts.debounceTime}),this._cache=new Map,this._tiles=[],this._dirty=!1,this._cacheByteSize=0,this._viewport=null,this._zRange=null,this._selectedTiles=null,this._frameNumber=0,this._modelMatrix=new uA,this._modelMatrixInverse=new uA}get tiles(){return this._tiles}get selectedTiles(){return this._selectedTiles}get isLoaded(){return this._selectedTiles!==null&&this._selectedTiles.every(A=>A.isLoaded)}get needsReload(){return this._selectedTiles!==null&&this._selectedTiles.some(A=>A.needsReload)}setOptions(A){Object.assign(this.opts,A),Number.isFinite(A.maxZoom)&&(this._maxZoom=Math.floor(A.maxZoom)),Number.isFinite(A.minZoom)&&(this._minZoom=Math.ceil(A.minZoom))}finalize(){for(let A of this._cache.values())A.isLoading&&A.abort();this._cache.clear(),this._tiles=[],this._selectedTiles=null}reloadAll(){for(let A of this._cache.keys()){let I=this._cache.get(A);!this._selectedTiles||!this._selectedTiles.includes(I)?this._cache.delete(A):I.setNeedsReload()}}update(A,{zRange:I,modelMatrix:B}={zRange:null,modelMatrix:null}){let Q=B?new uA(B):new uA,C=!Q.equals(this._modelMatrix);if(!this._viewport||!A.equals(this._viewport)||!wB(this._zRange,I)||C){C&&(this._modelMatrixInverse=Q.clone().invert(),this._modelMatrix=Q),this._viewport=A,this._zRange=I;let i=this.getTileIndices({viewport:A,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:I,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=i.map(o=>this._getTile(o,!0)),this._dirty&&this._rebuildTree()}else this.needsReload&&(this._selectedTiles=this._selectedTiles.map(i=>this._getTile(i.index,!0)));let E=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),E&&this._frameNumber++,this._frameNumber}isTileVisible(A,I){if(!A.isVisible)return!1;if(I&&this._viewport){let B=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:I}),{bbox:Q}=A;for(let[C,E,i,o]of B){let D;if("west"in Q)D=Q.west<i&&Q.east>C&&Q.south<o&&Q.north>E;else{let a=Math.min(Q.top,Q.bottom),t=Math.max(Q.top,Q.bottom);D=Q.left<i&&Q.right>C&&a<o&&t>E}if(D)return!0}return!1}return!0}getTileIndices({viewport:A,maxZoom:I,minZoom:B,zRange:Q,modelMatrix:C,modelMatrixInverse:E}){let{tileSize:i,extent:o,zoomOffset:D}=this.opts;return Wr({viewport:A,maxZoom:I,minZoom:B,zRange:Q,tileSize:i,extent:o,modelMatrix:C,modelMatrixInverse:E,zoomOffset:D})}getTileId(A){return`${A.x}-${A.y}-${A.z}`}getTileZoom(A){return A.z}getTileMetadata(A){let{tileSize:I}=this.opts;return{bbox:ur(this._viewport,A.x,A.y,A.z,I)}}getParentIndex(A){let I=Math.floor(A.x/2),B=Math.floor(A.y/2),Q=A.z-1;return{x:I,y:B,z:Q}}updateTileStates(){let A=this.opts.refinementStrategy||iG,I=new Array(this._cache.size),B=0;for(let Q of this._cache.values())I[B++]=Q.isVisible,Q.isSelected=!1,Q.isVisible=!1;for(let Q of this._selectedTiles)Q.isSelected=!0,Q.isVisible=!0;(typeof A=="function"?A:Iz[A])(Array.from(this._cache.values())),B=0;for(let Q of this._cache.values())if(I[B++]!==Q.isVisible)return!0;return!1}_pruneRequests(){let{maxRequests:A=0}=this.opts,I=[],B=0;for(let Q of this._cache.values())Q.isLoading&&(B++,!Q.isSelected&&!Q.isVisible&&I.push(Q));for(;A>0&&B>A&&I.length>0;)I.shift().abort(),B--}_rebuildTree(){let{_cache:A}=this;for(let I of A.values())I.parent=null,I.children&&(I.children.length=0);for(let I of A.values()){let B=this._getNearestAncestor(I);I.parent=B,B?.children&&B.children.push(I)}}_resizeCache(){let{_cache:A,opts:I}=this,B=I.maxCacheSize??(I.maxCacheByteSize!=null?1/0:gz*this.selectedTiles.length),Q=I.maxCacheByteSize??1/0;if(A.size>B||this._cacheByteSize>Q){for(let[E,i]of A)if(!i.isVisible&&!i.isSelected&&(this._cacheByteSize-=I.maxCacheByteSize!=null?i.byteLength:0,A.delete(E),this.opts.onTileUnload?.(i)),A.size<=B&&this._cacheByteSize<=Q)break;this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((E,i)=>E.zoom-i.zoom),this._dirty=!1)}_getTile(A,I){let B=this.getTileId(A),Q=this._cache.get(B),C=!1;return!Q&&I?(Q=new Ue(A),Object.assign(Q,this.getTileMetadata(Q.index)),Object.assign(Q,{id:B,zoom:this.getTileZoom(Q.index)}),C=!0,this._cache.set(B,Q),this._dirty=!0):Q&&Q.needsReload&&(C=!0),Q&&C&&Q.loadData({getData:this.opts.getTileData,requestScheduler:this._requestScheduler,onLoad:this.onTileLoad,onError:this.opts.onTileError}),Q}_getNearestAncestor(A){let{_minZoom:I=0}=this,B=A.index;for(;this.getTileZoom(B)>I;){B=this.getParentIndex(B);let Q=this._getTile(B);if(Q)return Q}return null}};function Qz(g){for(let A of g)A.state=0;for(let A of g)A.isSelected&&!LL(A)&&br(A);for(let A of g)A.isVisible=!!(A.state&je)}function Cz(g){for(let I of g)I.state=0;for(let I of g)I.isSelected&&LL(I);let A=Array.from(g).sort((I,B)=>I.zoom-B.zoom);for(let I of A)if(I.isVisible=!!(I.state&je),I.children&&(I.isVisible||I.state&SL))for(let B of I.children)B.state=SL;else I.isSelected&&br(I)}function LL(g){let A=g;for(;A;){if(A.isLoaded||A.content)return A.state|=je,!0;A=A.parent}return!1}function br(g){for(let A of g.children)A.isLoaded||A.content?A.state|=je:br(A)}var Ez={TilesetClass:jo,data:{type:"data",value:[]},dataComparator:fr.equal,renderSubLayers:{type:"function",value:g=>new qe(g)},getTileData:{type:"function",optional:!0,value:null},onViewportLoad:{type:"function",optional:!0,value:null},onTileLoad:{type:"function",value:g=>{}},onTileUnload:{type:"function",value:g=>{}},onTileError:{type:"function",value:g=>console.error(g)},extent:{type:"array",optional:!0,value:null,compare:!0},tileSize:512,maxZoom:null,minZoom:0,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:iG,zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0},oG=class extends wQ{initializeState(){this.state={tileset:null,isLoaded:!1}}finalizeState(){this.state?.tileset?.finalize()}get isLoaded(){return!!this.state?.tileset?.selectedTiles?.every(A=>A.isLoaded&&A.layers&&A.layers.every(I=>I.isLoaded))}shouldUpdateState({changeFlags:A}){return A.somethingChanged}updateState({changeFlags:A}){let{tileset:I}=this.state,B=A.propsOrDataChanged||A.updateTriggersChanged,Q=A.dataChanged||A.updateTriggersChanged&&(A.updateTriggersChanged.all||A.updateTriggersChanged.getTileData);I?B&&(I.setOptions(this._getTilesetOptions()),Q?I.reloadAll():I.tiles.forEach(C=>{C.layers=null})):(I=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:I})),this._updateTileset()}_getTilesetOptions(){let{tileSize:A,maxCacheSize:I,maxCacheByteSize:B,refinementStrategy:Q,extent:C,maxZoom:E,minZoom:i,maxRequests:o,debounceTime:D,zoomOffset:a}=this.props;return{maxCacheSize:I,maxCacheByteSize:B,maxZoom:E,minZoom:i,tileSize:A,refinementStrategy:Q,extent:C,maxRequests:o,debounceTime:D,zoomOffset:a,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}_updateTileset(){let A=this.state.tileset,{zRange:I,modelMatrix:B}=this.props,Q=A.update(this.context.viewport,{zRange:I,modelMatrix:B}),{isLoaded:C}=A,E=this.state.isLoaded!==C,i=this.state.frameNumber!==Q;C&&(E||i)&&this._onViewportLoad(),i&&this.setState({frameNumber:Q}),this.state.isLoaded=C}_onViewportLoad(){let{tileset:A}=this.state,{onViewportLoad:I}=this.props;I&&I(A.selectedTiles)}_onTileLoad(A){this.props.onTileLoad(A),A.layers=null,this.setNeedsUpdate()}_onTileError(A,I){this.props.onTileError(A),I.layers=null,this.setNeedsUpdate()}_onTileUnload(A){this.props.onTileUnload(A)}getTileData(A){let{data:I,getTileData:B,fetch:Q}=this.props,{signal:C}=A;return A.url=typeof I=="string"||Array.isArray(I)?mr(I,A):null,B?B(A):Q&&A.url?Q(A.url,{propName:"data",layer:this,signal:C}):null}renderSubLayers(A){return this.props.renderSubLayers(A)}getSubLayerPropsByTile(A){return null}getPickingInfo(A){let I=A.sourceLayer,B=I.props.tile,Q=A.info;return Q.picked&&(Q.tile=B),Q.sourceTile=B,Q.sourceTileSubLayer=I,Q}_updateAutoHighlight(A){A.sourceTileSubLayer.updateAutoHighlight(A)}renderLayers(){return this.state.tileset.tiles.map(A=>{let I=this.getSubLayerPropsByTile(A);if(!(!A.isLoaded&&!A.content))if(A.layers)I&&A.layers[0]&&Object.keys(I).some(B=>A.layers[0].props[B]!==I[B])&&(A.layers=A.layers.map(B=>B.clone(I)));else{let B=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:A.id,updateTriggers:this.props.updateTriggers}),data:A.content,_offset:0,tile:A});A.layers=PQ(B,Boolean).map(Q=>Q.clone({tile:A,...I}))}return A.layers})}filterSubLayer({layer:A,cullRect:I}){let{tile:B}=A.props;return this.state.tileset.isTileVisible(B,I)}};oG.defaultProps=Ez;oG.layerName="TileLayer";var Xo=oG;var Xe=(g,A,I)=>new AE({parent:g,controller:{doubleClickZoom:!1},width:A,height:I});var zo=()=>[new IB({id:"ortho"})];var SA={},vo=g=>{SA={fetch:{headers:{}}},g&&(SA.fetch.headers.Authorization=`Bearer ${g}`)};var Gi={};Gi.EPSILON=1e-12;Gi.debug=!0;Gi.precision=4;Gi.printTypes=!1;Gi.printDegrees=!1;Gi.printRowMajor=!0;function dL(g){return Array.isArray(g)||ArrayBuffer.isView(g)&&g.length!==void 0}function pL(g){return g.clone?g.clone():new Array(g)}function iz(g,A){if(dL(g)){for(var I=pL(g),B=0;B<I.length;++B)I[B]=A(I[B],B,I);return I}return A(g)}function NQ(g,A,I){return iz(g,function(B){return Math.max(A,Math.min(I,B))})}var ze=class extends lo{getShaders(){let A=super.getShaders();return A.inject={"fs:#decl":"uniform vec3 uColor; uniform float uOpacityScale;","fs:DECKGL_FILTER_COLOR":`
|
|
1688
1688
|
// Convert color to grayscale and apply opacity scale
|
|
1689
1689
|
float grayscale = ((color.r + color.g + color.b) / 3.0) * uOpacityScale;
|
|
1690
1690
|
// Clamp grayscale to valid range
|
|
@@ -1761,7 +1761,7 @@ void main(void) {
|
|
|
1761
1761
|
geometry.uv = unitPosition;
|
|
1762
1762
|
fragColor = vFillColor;
|
|
1763
1763
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
1764
|
-
}`;var Zi=class extends BB{getShaders(){let A=super.getShaders();return A.vs=C3,A.fs=E3,A}draw({uniforms:A}){super.draw({uniforms:{...A,tile_height:this.props.tile_height,tile_width:this.props.tile_width}})}};var i3=g=>{let A={getPosition:{duration:g.animate.duration,easing:kI}};return new Zi({id:"row-layer",data:g.cats.row_cat_data,getPosition:B=>{let Q=g.mat.orders.row[g.order.current.row],C=g.mat.num_rows-Q[B.original_index];return[B.position[0]+g.viz.cat_shift_row,g.viz.row_offset*(C+1.5)]},getFillColor:B=>B.color,pickable:!0,transitions:A,opacity:.8,tile_width:g.viz.row_cat_width/2*.9,tile_height:g.viz.mat_height/g.mat.num_rows*.5})},o3=g=>{let A={getPosition:{duration:g.animate.duration,easing:kI}};return new Zi({id:"col-layer",data:g.cats.col_cat_data,getPosition:B=>{let Q=g.mat.orders.col[g.order.current.col],C=g.mat.num_cols-Q[B.original_index];return[g.viz.col_offset*(C+.5),B.position[1]+g.viz.cat_shift_col]},getFillColor:B=>B.color,pickable:!0,transitions:A,opacity:.8,tile_width:g.viz.mat_height/g.mat.num_cols*.5,tile_height:g.viz.col_cat_height/2})};var j_=({isDragging:g})=>g?"grabbing":"pointer",D3=(g,A,I)=>(typeof A=="number"&&(A=A+100,I=I+100),new AE({parent:g,getCursor:j_,width:A,height:I}));var X_=(g,A,I)=>{let B=A.index,Q=I.order.current.row,C=50,E=I.mat.num_rows-I.mat.orders.row[Q][B],i=C,o=I.viz.row_offset*(E+1.5);return[i,o]},z_=(g,A,I)=>{let B=A.index,Q=I.order.current.col,C=50,E=I.mat.num_cols-I.mat.orders.col[Q][B];return[I.viz.col_offset*(E+.5),C]},a3=g=>{let A={getPosition:{duration:g.animate.duration,easing:kI}};return new ti({id:"row-label-layer",data:g.labels.row_label_data,getPosition:(B,Q)=>X_(B,Q,g),getText:B=>B.name,getSize:g.viz.font_size.rows,getColor:[0,0,0],getAngle:0,getTextAnchor:"end",getAlignmentBaseline:"center",fontFamily:"Arial",sizeUnits:"pixels",sizeScale:2,pickable:!0,transitions:A})},t3=g=>{function A(Q,C){let E=Math.pow(2,Q);return[0,75/C*E]}let I={getPosition:{duration:g.animate.duration,easing:kI}};return new ti({id:"col-label-layer",data:g.labels.col_label_data,getPosition:(Q,C)=>z_(Q,C,g),getText:Q=>Q.name,getSize:g.viz.font_size.cols,getColor:[0,0,0],getAngle:45,getTextAnchor:"start",getAlignmentBaseline:"bottom",fontFamily:"Arial",sizeUnits:"pixels",sizeScale:2,pickable:!0,transitions:I,getPixelOffset:()=>A(g.zoom.zoom_data.matrix.zoom_x,g.mat.num_cols)})},G3=250,s3=(g,A,I,B,Q,C)=>{let E=[],i=B==="col"?"row":"col";pg(I.el).selectAll(`.button-${i}`).classed("active",!1).style("border-color",I.buttons.gray),B==="col"?E=I.mat.net_mat.map(t=>t[C]):E=I.mat.net_mat[C];let o=Array.from(E.keys()).sort((t,G)=>E[G]-E[t]),D=o.length,a=Array(D);o.forEach((t,G)=>{a[t]=D-G}),I.mat.orders[i].custom=a,I.order.current[i]="custom",A.mat_layer=A.mat_layer.clone({updateTriggers:{getPosition:[I.order.current.row,I.order.current.col,Q]}}),i==="col"?(A.col_label_layer=A.col_label_layer.clone({updateTriggers:{getPosition:[I.order.current.col,Q]}}),A.col_cat_layer=A.col_cat_layer.clone({updateTriggers:{getPosition:I.order.current.col}}),fs(A,I,"col")):i==="row"&&(A.row_label_layer=A.row_label_layer.clone({updateTriggers:{getPosition:[I.order.current.row,Q]}}),A.row_cat_layer=A.row_cat_layer.clone({updateTriggers:{getPosition:I.order.current.row}}),fs(A,I,"row")),g.setProps({layers:HQ(A)})},v_=(g,A,I,B)=>{B.labels.clicks.row+=1,B.labels.clicks.row===1?(B.click.type="row_label",B.click.value={name:g.object.name},setTimeout(()=>{B.labels.clicks.row=0},G3),Object.keys(B.model).length>0&&(B.model.set("click_info",null),B.model.set("click_info",B.click),B.model.save_changes()),typeof B.custom_callbacks.row=="function"&&B.custom_callbacks.row(g.object.name)):B.labels.clicks.row===2&&(B.labels.clicks.row=0,s3(A,I,B,"row",g.object.name,g.object.index))},__=(g,A,I,B)=>{B.labels.clicks.col+=1,B.labels.clicks.col===1?(B.click.type="col_label",B.click.value={name:g.object.name},setTimeout(()=>{B.labels.clicks.col=0},G3),Object.keys(B.model).length>0&&(B.model.set("click_info",null),B.model.set("click_info",B.click),B.model.save_changes()),typeof B.custom_callbacks.col=="function"&&B.custom_callbacks.col(g.object.name)):B.labels.clicks.col===2&&(B.labels.clicks.col=0,s3(A,I,B,"col",g.object.name,g.object.index))},w3=(g,A,I)=>{A.row_label_layer=A.row_label_layer.clone({onClick:B=>v_(B,g,A,I)})},c3=(g,A,I)=>{A.col_label_layer=A.col_label_layer.clone({onClick:B=>__(B,g,A,I)})};var $_=(g,A)=>{let I=A.order.current.row,B=A.order.current.col,Q=A.mat.num_cols-A.mat.orders.col[B][g.col],C=A.mat.num_rows-A.mat.orders.row[I][g.row],E=A.viz.col_width*(Q+.5),i=A.viz.row_offset*(C+1.5);return[E,i]},e3=g=>{let A={getPosition:{duration:g.animate.duration,easing:kI}};return new Zi({id:"mat-layer",data:g.mat.mat_data,getPosition:B=>$_(B,g),getFillColor:B=>B.color,pickable:!0,antialiasing:!1,tile_height:g.viz.mat_height/g.mat.num_rows*.5,tile_width:g.viz.mat_height/g.mat.num_cols*.5,transitions:A})},A$=(g,A,I,B)=>{let Q=B.labels.row_label_data[g.object.row].name,C=B.labels.col_label_data[g.object.col].name;B.click.type="mat",B.click.value={name:`${Q}_${C}`,row:Q,col:C},Object.keys(B.model).length>0&&(B.model.set("click_info",null),B.model.set("click_info",B.click),B.model.save_changes())},N3=(g,A,I)=>{A.mat_layer=A.mat_layer.clone({onClick:B=>A$(B,g,A,I)})};var k3=(g,A)=>{let{object:I,layer:B}=A,Q=g.root.querySelector(".deck-tooltip");Q.style.marginTop="50px";let C=Q.parentElement.parentElement;if(C.style.position="unset",I){if(B.id==="row-label-layer")return{html:`Row Label: ${I.name}`,style:{color:"white"}};if(B.id==="col-label-layer")return{html:`Col Label: ${I.name}`,style:{color:"white"}};if(B.id==="row-layer")return{html:`Row Label: ${I.name}`,style:{color:"white"}};if(B.id==="col-layer")return{html:`Col Label: ${I.name}`,style:{color:"white"}};if(B.id==="row-dendro-layer")return{html:`row-dendro-${I.properties.name}<br>${I.properties.all_names}`,style:{color:"white"}};if(B.id==="col-dendro-layer")return{html:`row-dendro-${I.properties.name}<br>${I.properties.all_names}`,style:{color:"white"}};if(B.id==="mat-layer"){let E=g.labels.row_label_data[I.row].name,i=g.labels.col_label_data[I.col].name;return{html:`Row: ${E} <br> Column: ${i} <br> Value: ${I.value.toFixed(2)}`,style:{color:"white"}}}}};var h3=(g,A,I)=>{let{ini_pan_y:B}=I.zoom,Q,C=Math.pow(2,A);I.zoom.min_pan_y=(B-I.viz.row_offset)/C+I.viz.row_offset;let E=B-I.zoom.min_pan_y;return I.zoom.max_pan_y=B+E,g<=I.zoom.min_pan_y?Q=I.zoom.min_pan_y:g>I.zoom.max_pan_y?Q=I.zoom.max_pan_y:Q=g,Q},F3=(g,A,I)=>{let{ini_pan_x:B}=I.zoom,Q,C=Math.pow(2,A);I.zoom.min_pan_x=B/C;let E=B-I.zoom.min_pan_x;return I.zoom.max_pan_x=B+E,g<=I.zoom.min_pan_x?Q=I.zoom.min_pan_x:g>I.zoom.max_pan_x?Q=I.zoom.max_pan_x:Q=g,Q};var y3=(g,A,I,B)=>{let Q;return A==="matrix"?Q={matrix:{zoom:[I[0],I[1]],target:[B[0],B[1]]},rows:{zoom:[g.zoom.ini_zoom_x,I[1]],target:[g.viz.label_row_x,B[1]]},cols:{zoom:[I[0],g.zoom.ini_zoom_y],target:[B[0],g.viz.label_col_y]},dendro_rows:{zoom:[g.zoom.ini_zoom_x,I[1]],target:[g.viz.label_row_x,B[1]]},dendro_cols:{zoom:[I[0],g.zoom.ini_zoom_y],target:[B[0],g.viz.label_col_y]}}:A==="cols"||A==="dendro_cols"?Q={matrix:{zoom:[I[0],I[1]],target:[B[0],g.zoom.min_pan_y]},rows:{zoom:[g.zoom.ini_zoom_x,I[1]],target:[g.viz.label_row_x,g.zoom.min_pan_y]},cols:{zoom:[I[0],g.zoom.ini_zoom_y],target:[B[0],g.viz.label_col_y]},dendro_rows:{zoom:[g.zoom.ini_zoom_x,I[1]],target:[g.viz.label_row_x,g.zoom.min_pan_y]},dendro_cols:{zoom:[I[0],g.zoom.ini_zoom_y],target:[B[0],g.viz.label_col_y]}}:(A==="rows"||A==="dendro_rows")&&(Q={matrix:{zoom:[I[0],I[1]],target:[g.zoom.min_pan_x,B[1]]},rows:{zoom:[g.zoom.ini_zoom_x,I[1]],target:[g.viz.label_row_x,B[1]]},cols:{zoom:[I[0],g.zoom.ini_zoom_y],target:[B[0],g.viz.label_col_y]},dendro_rows:{zoom:[g.zoom.ini_zoom_x,I[1]],target:[g.viz.label_row_x,B[1]]},dendro_cols:{zoom:[I[0],g.zoom.ini_zoom_y],target:[B[0],g.viz.label_col_y]}}),Q};var r3=(g,A,I,B)=>{let{zoom_data:Q}=g.zoom;Q.matrix.pan_x=B[0],Q.matrix.pan_y=B[1],Q.matrix.zoom_x=I[0],Q.matrix.zoom_y=I[1],Q.rows.pan_x=g.zoom.ini_pan_x,Q.rows.pan_y=B[1],Q.rows.zoom_x=I[0],Q.rows.zoom_y=I[1],Q.cols.pan_x=B[0],Q.cols.pan_y=g.zoom.ini_pan_y,Q.cols.zoom_x=I[0],Q.cols.zoom_y=I[1],Q.dendro_rows.pan_x=g.zoom.ini_pan_x,Q.dendro_rows.pan_y=B[1],Q.dendro_rows.zoom_x=I[0],Q.dendro_rows.zoom_y=I[1],Q.dendro_cols.pan_x=B[0],Q.dendro_cols.pan_y=g.zoom.ini_pan_y,Q.dendro_cols.zoom_x=I[0],Q.dendro_cols.zoom_y=I[1]},n3=g=>{g.zoom.zoom_data={},g.zoom.zoom_data.total_zoom={},g.zoom.zoom_data.total_zoom.x=0,g.zoom.zoom_data.total_zoom.y=0,g.zoom.zoom_data.matrix={pan_x:g.zoom.ini_pan_x,pan_y:g.zoom.ini_pan_y,zoom_x:g.zoom.ini_zoom_x,zoom_y:g.zoom.ini_zoom_y},g.zoom.zoom_data.rows={pan_x:g.zoom.ini_pan_x,pan_y:g.zoom.ini_pan_y,zoom_x:g.zoom.ini_zoom_x,zoom_y:g.zoom.ini_zoom_y},g.zoom.zoom_data.cols={pan_x:g.zoom.ini_pan_x,pan_y:g.zoom.ini_pan_y,zoom_x:g.zoom.ini_zoom_x,zoom_y:g.zoom.ini_zoom_y},g.zoom.zoom_data.dendro_rows={pan_x:g.zoom.ini_pan_x,pan_y:g.zoom.ini_pan_y,zoom_x:g.zoom.ini_zoom_x,zoom_y:g.zoom.ini_zoom_y},g.zoom.zoom_data.dendro_cols={pan_x:g.zoom.ini_pan_x,pan_y:g.zoom.ini_pan_y,zoom_x:g.zoom.ini_zoom_x,zoom_y:g.zoom.ini_zoom_y}};var R3=(g,A,I,B)=>{let{viewState:Q}=g,{viewId:C}=g,{zoom:E,target:i}=Q,o,D;C==="cols"?B.zoom.minor_zoom_axis==="X"?(o=E[0],D=E[1]):B.zoom.minor_zoom_axis==="Y"?(o=E[0]-B.zoom.zoom_data[C].zoom_x,D=E[1]-B.zoom.zoom_data[C].zoom_y):B.zoom.minor_zoom_axis==="none"&&(o=E[0]-B.zoom.zoom_data[C].zoom_x,D=E[1]):(C==="rows"||C==="dendro_rows")&&(B.zoom.minor_zoom_axis==="Y"?(o=E[0],D=E[1]):B.zoom.minor_zoom_axis==="X"?(o=E[0]-B.zoom.zoom_data[C].zoom_x,D=E[1]-B.zoom.zoom_data[C].zoom_y):B.zoom.minor_zoom_axis==="none"&&(o=E[0],D=E[1]-B.zoom.zoom_data[C].zoom_y)),C==="dendro_cols"?B.zoom.minor_zoom_axis==="X"?(o=E[0],D=E[1]):B.zoom.minor_zoom_axis==="Y"?(o=E[0]-B.zoom.zoom_data[C].zoom_x,D=E[1]-B.zoom.zoom_data[C].zoom_y):B.zoom.minor_zoom_axis==="none"&&(o=E[0]-B.zoom.zoom_data[C].zoom_x,D=E[1]):C==="matrix"&&(o=E[0]-B.zoom.zoom_data[C].zoom_x,D=E[1]-B.zoom.zoom_data[C].zoom_y),B.zoom.zoom_data.total_zoom.x+=o,B.zoom.zoom_data.total_zoom.y+=D,B.zoom.zoom_data.total_zoom.x=Math.max(0,B.zoom.zoom_data.total_zoom.x),B.zoom.zoom_data.total_zoom.y=Math.max(0,B.zoom.zoom_data.total_zoom.y);let a=[B.zoom.zoom_data.total_zoom.x,B.zoom.zoom_data.total_zoom.y],t=Math.max(0,a[0]),G=Math.max(0,a[1]);B.zoom.major_zoom_axis==="X"?G=t-B.zoom.zoom_delay:B.zoom.major_zoom_axis==="Y"&&(t=G-B.zoom.zoom_delay),t=Math.max(0,t),G=Math.max(0,G);let s=F3(i[0],t,B),w=h3(i[1],G,B),e=[t,G],c=[s,w],h=y3(B,C,e,c);r3(B,C,e,c);let R;B.zoom.major_zoom_axis==="X"?R=Math.pow(2,B.zoom.zoom_data.matrix.zoom_x):B.zoom.major_zoom_axis==="Y"?R=Math.pow(2,B.zoom.zoom_data.matrix.zoom_y):B.zoom.major_zoom_axis==="all"&&(R=Math.pow(2,B.zoom.zoom_data.matrix.zoom_x)),I.row_label_layer=I.row_label_layer.clone({getSize:B.viz.font_size.rows*Math.pow(2,B.zoom.zoom_data.matrix.zoom_y)}),I.col_label_layer=I.col_label_layer.clone({getSize:B.viz.font_size.cols*Math.pow(2,B.zoom.zoom_data.matrix.zoom_x),updateTriggers:{getPixelOffset:B.zoom.zoom_data.matrix.zoom_x}});let N;B.zoom.major_zoom_axis!=="all"?N=R<B.zoom.switch_ratio?B.zoom.major_zoom_axis:"all":N="all",B.views.views_list=B.views.views_list.map(y=>new IB({...y.props,controller:{...y.props.controller,doubleClickZoom:!1,scrollZoom:!0,inertia:!0,zoomAxis:N}})),A.setProps({viewState:h,layers:HQ(I),views:B.views.views_list})};var M3=g=>{let A;g.mat.num_rows>g.mat.num_cols?(g.zoom.major_zoom_axis="Y",g.zoom.minor_zoom_axis="X",A=g.mat.num_rows/g.mat.num_cols):g.mat.num_rows<g.mat.num_cols?(g.zoom.major_zoom_axis="X",g.zoom.minor_zoom_axis="Y",A=g.mat.num_cols/g.mat.num_rows):g.mat.num_rows===g.mat.num_cols&&(g.zoom.major_zoom_axis="all",g.zoom.minor_zoom_axis="none",A=1),g.zoom.switch_ratio=A,g.zoom.zoom_delay=Math.log2(A);let I=[new IB({id:"matrix",x:`${g.viz.row_region+g.viz.label_buffer}px`,y:`${g.viz.col_region+g.viz.label_buffer}px`,width:`${g.viz.mat_width}px`,height:`${g.viz.mat_height}px`,controller:{scrollZoom:!0,inertia:!0,zoomAxis:g.zoom.major_zoom_axis,doubleClickZoom:!1}}),new IB({id:"rows",x:"0px",y:`${g.viz.col_region+g.viz.label_buffer}px`,width:`${g.viz.row_region}px`,height:`${g.viz.mat_height}px`,controller:{scrollZoom:!0,inertia:!1,zoomAxis:g.zoom.major_zoom_axis,doubleClickZoom:!1}}),new IB({id:"cols",x:`${g.viz.row_region+g.viz.label_buffer}px`,y:"0px",width:`${g.viz.mat_width}px`,height:`${g.viz.col_region}px`,controller:{scrollZoom:!0,inertia:!1,zoomAxis:g.zoom.major_zoom_axis,doubleClickZoom:!1}}),new IB({id:"dendro_cols",x:`${g.viz.row_region+g.viz.label_buffer}px`,y:`${g.viz.col_region+g.viz.label_buffer+g.viz.mat_height}px`,width:`${g.viz.mat_width}px`,height:`${g.viz.dendrogram_width}px`,controller:{scrollZoom:!0,inertia:!1,zoomAxis:g.zoom.major_zoom_axis,doubleClickZoom:!1}}),new IB({id:"dendro_rows",x:`${g.viz.row_region+g.viz.label_buffer+g.viz.mat_width}px`,y:`${g.viz.col_region+g.viz.label_buffer}px`,width:`${g.viz.dendrogram_width}px`,height:`${g.viz.mat_height}px`,controller:{scrollZoom:!0,inertia:!1,zoomAxis:g.zoom.major_zoom_axis,doubleClickZoom:!1}})];g.views={},g.views.views_list=I},J3=g=>({matrix:{target:[g.zoom.ini_pan_x,g.zoom.ini_pan_y],zoom:[g.zoom.ini_zoom_x,g.zoom.ini_zoom_y]},rows:{target:[g.viz.label_row_x,g.zoom.ini_pan_y],zoom:[g.zoom.ini_zoom_x,g.zoom.ini_zoom_y]},cols:{target:[g.zoom.ini_pan_x,g.viz.label_col_y],zoom:[g.zoom.ini_zoom_x,g.zoom.ini_zoom_y]},dendro_rows:{target:[g.viz.label_row_x,g.zoom.ini_pan_y],zoom:[g.zoom.ini_zoom_x,g.zoom.ini_zoom_y]},dendro_cols:{target:[g.zoom.ini_pan_x,g.viz.label_col_y],zoom:[g.zoom.ini_zoom_x,g.zoom.ini_zoom_y]}});var g$=(g,A=255)=>{let I=UI(g);return I?[I.r,I.g,I.b,A]:[0,0,0,A]},Y3=(g,A,I)=>{let B=I==="row",Q=B?g.row_nodes:g.col_nodes,C=B?A.cats.num_cats.row:A.cats.num_cats.col,E=B?A.viz.row_cat_offset:A.viz.col_cat_offset,i=B?A.viz.row_offset:A.viz.col_offset;return Q.flatMap((D,a)=>Array.from({length:C}).map((t,G)=>{let s=`cat-${G}`,w=D[s];if(!w||!w.includes(": "))return null;let e=w.split(": ")[1],c=g.global_cat_colors[e],h=g$(c,255);return{position:B?[E*(G+.5)+20,i*(a+.5)]:[i*(a+.5),E*(G+1.5)-30],color:h,name:e,level:G,original_index:a}})).filter(Boolean)},K3=(g,A)=>Y3(g,A,"row"),q3=(g,A)=>Y3(g,A,"col");var U3=(g,A)=>{let I=[];g.col_nodes.forEach((B,Q)=>{let C={name:B.name,ini:B.ini,clust:B.clust,rank:B.rank,rankvar:B.rankvar,index:Q};I.push(C)}),A.labels.col_label_data=I,A.labels.clicks.col=0,A.mat.orders.col={},A.mat.orders.col.ini=I.map(B=>B.ini),A.mat.orders.col.clust=I.map(B=>B.clust+1),A.mat.orders.col.rank=I.map(B=>B.rank+1),A.mat.orders.col.rankvar=I.map(B=>B.rankvar+1)},H3=(g,A)=>{let I=[];g.row_nodes.forEach((B,Q)=>{let C={name:B.name,ini:B.ini,clust:B.clust,rank:B.rank,rankvar:B.rankvar,index:Q};I.push(C)}),A.labels.row_label_data=I,A.labels.clicks.row=0,A.mat.orders.row={},A.mat.orders.row.ini=I.map(B=>B.ini),A.mat.orders.row.clust=I.map(B=>B.clust+1),A.mat.orders.row.rank=I.map(B=>B.rank+1),A.mat.orders.row.rankvar=I.map(B=>B.rankvar+1)};var S3=(g,A)=>{let I;g.mat.forEach((B,Q)=>{B.forEach((C,E)=>{C>=0?I=[255,0,0]:I=[0,0,255];let i={position:[A.viz.col_offset*(E+.5),A.viz.row_offset*(Q+1.5)],color:[I[0],I[1],I[2],255*Math.abs(C)/A.mat.max_abs_value],value:C,row:Q,col:E};A.mat.mat_data.push(i)})})};var L3=(g,A,I,B,Q,C,E,i)=>{let o={};return o.root=I,o.model=g,o.custom_callbacks={},o.custom_callbacks.row=C,o.custom_callbacks.col=E,o.custom_callbacks.col_dendro=i,o.viz={},o.viz.height_margin=100,o.cats={},o.cats.num_cats={},o.cats.num_cats.row=Object.keys(A.cat_colors.row).length,o.cats.num_cats.col=Object.keys(A.cat_colors.col).length,o.root.style.height=`${Q+o.viz.height_margin}px`,o.viz.mat_width=B,o.viz.mat_height=Q,o.mat={},o.mat.num_rows=A.mat.length,o.mat.num_cols=A.mat[0].length,o.row_nodes=A.row_nodes,o.col_nodes=A.col_nodes,o.mat.net_mat=A.mat,o.linkage=A.linkage,o.viz.base_font_size=125,o.viz.col_label=75,o.viz.row_label=75,o.viz.extra_space={},o.viz.extra_space.row=5,o.viz.extra_space.col=5,o.zoom={},o.zoom.ini_zoom_x=0,o.zoom.ini_zoom_y=0,o.viz.row_cat_width=8,o.viz.col_cat_height=8,o.viz.row_cat_offset=10,o.viz.col_cat_offset=10,o.viz.label_row_x=15,o.viz.label_col_y=25,o.viz.cat_shift_row=30,o.viz.label_buffer=1,o.animate={},o.animate.duration=2500,o.viz.dendrogram_width=15,o.viz.font_size={},o.viz.font_size.rows=o.viz.base_font_size/o.mat.num_rows,o.viz.font_size.cols=o.viz.base_font_size/o.mat.num_cols,o.viz.col_region=(o.viz.col_cat_height+o.viz.extra_space.col)*o.cats.num_cats.col+o.viz.col_label,o.viz.row_region=(o.viz.row_cat_width+o.viz.extra_space.row)*o.cats.num_cats.row+o.viz.row_label,o.viz.col_width=o.viz.mat_width/o.mat.num_cols,o.viz.row_offset=o.viz.mat_height/o.mat.num_rows,o.viz.col_offset=o.viz.mat_width/o.mat.num_cols,o.viz.cat_shift_col=o.viz.col_label,o.zoom.ini_pan_x=o.viz.mat_width/2,o.zoom.ini_pan_y=o.viz.mat_height/2+o.viz.row_offset,o.mat.mat_data=[],o.mat.num_rows=A.mat.length,o.mat.num_cols=A.mat[0].length,o.mat.max_abs_value=A.mat.flat().reduce((D,a)=>Math.max(D,Math.abs(a)),-1/0),o.order={},o.order.current={},o.order.current.row="clust",o.order.current.col="clust",o.order.new="ini",o.buttons={},o.buttons.blue="#8797ff",o.buttons.gray="#EEEEEE",o.click={},o.click.type=null,o.click.value=null,o};var _R=async(g,A,I,B="800",Q="800",C=null,E=null,i=null)=>{let o=document.createElement("div");o.style.border="1px solid #d3d3d3";let D=D3(o,B,Q),a=L3(g,I,o,B,Q,C,E,i);A.style.position="relative",a.el=A,S3(I,a),a.labels={},a.labels.clicks={},n3(a),a.mat.orders={},H3(I,a),U3(I,a),a.cats.row_cat_data=K3(I,a),a.cats.col_cat_data=q3(I,a),Zf(a),ms(a,"row"),ms(a,"col");let t={};t.mat_layer=e3(a),t.row_label_layer=a3(a),t.col_label_layer=t3(a),t.row_cat_layer=i3(a),t.col_cat_layer=o3(a),t.row_dendro_layer=xR(t,a,"row"),t.col_dendro_layer=xR(t,a,"col"),M3(a);let G=J3(a);N3(D,t,a),w3(D,t,a),c3(D,t,a),uR(D,t,a,"row"),uR(D,t,a,"col"),D.setProps({onViewStateChange:w=>R3(w,D,t,a),views:a.views.views_list,initialViewState:G,getTooltip:w=>k3(a,w),layerFilter:Wf,layers:HQ(t)});let s=Xf(D,t,a);A.appendChild(s),A.appendChild(a.root)};var d3=async({model:g,el:A})=>{let I=g.get("token"),B=g.get("creds"),Q=g.get("ini_x"),C=g.get("ini_y"),E=g.get("ini_z"),i=g.get("ini_zoom"),o=g.get("base_url"),D=g.get("dataset_name"),a=g.get("width"),t=g.get("height"),G=g.get("meta_cell"),s=g.get("meta_cluster"),w=g.get("umap"),e=g.get("landscape_state"),c=g.get("segmentation");return zR(A,g,I,Q,C,E,i,o,D,.25,a,t,G,s,w,e,c,B)},p3=async({model:g,el:A})=>{let I=g.get("token"),B=g.get("ini_x"),Q=g.get("ini_y"),C=g.get("ini_z"),E=g.get("ini_zoom"),i=g.get("base_url"),o=g.get("dataset_name"),D=g.get("square_tile_size"),a=g.get("width"),t=g.get("height");vR(g,A,i,I,B,Q,C,E,D,o,a,t)},l3=async({model:g,el:A})=>{let I=g.get("token"),B=g.get("ini_x"),Q=g.get("ini_y"),C=g.get("ini_z"),E=g.get("ini_zoom"),i=g.get("base_url"),o=g.get("dataset_name"),D=g.get("width"),a=g.get("height"),t=g.get("creds");Tr(g,A,i,I,B,Q,C,E,o,D,a,t)},f3=async({model:g,el:A})=>{let I=g.get("technology");if(["MERSCOPE","Xenium"].includes(I))return d3({model:g,el:A});if(["Visium-HD"].includes(I))return p3({model:g,el:A});if(["h&e"].includes(I))return l3({model:g,el:A})},m3=async({model:g,el:A})=>{let I=g.get("network"),B=g.get("width"),Q=g.get("height");_R(g,A,I,B,Q)};function I$({model:g,el:A}){try{let I=g.get("component");if(!I){fh("Component type is not defined",{data:{model:g?.id||"unknown",el:A?.id||"unknown"}});return}switch(I){case"Landscape":return f3({model:g,el:A});case"Matrix":return m3({model:g,el:A});default:fh(`Unknown component type: ${I}`,{data:{componentType:I,model:g?.id||"unknown"}});return}}catch(I){let B=Sg(I,{context:"render function",logUnexpected:!0,messages:{unexpected:"Error in render function"}});A.innerHTML=`<div style="color: red; padding: 10px;">Error: ${B.message}</div>`}}var zTA={landscape_ist:zR,landscape_sst:vR,landscape_h_e:Tr,matrix_viz:_R,render:I$,render_landscape_ist:d3,render_landscape_sst:p3,render_landscape_h_e:l3,render_landscape:f3,render_matrix_new:m3};export{zTA as default};
|
|
1764
|
+
}`;var Zi=class extends BB{getShaders(){let A=super.getShaders();return A.vs=C3,A.fs=E3,A}draw({uniforms:A}){super.draw({uniforms:{...A,tile_height:this.props.tile_height,tile_width:this.props.tile_width}})}};var i3=g=>{let A={getPosition:{duration:g.animate.duration,easing:kI}};return new Zi({id:"row-layer",data:g.cats.row_cat_data,getPosition:B=>{let Q=g.mat.orders.row[g.order.current.row],C=g.mat.num_rows-Q[B.original_index];return[B.position[0]+g.viz.cat_shift_row,g.viz.row_offset*(C+1.5)]},getFillColor:B=>B.color,pickable:!0,transitions:A,opacity:.8,tile_width:g.viz.row_cat_width/2*.9,tile_height:g.viz.mat_height/g.mat.num_rows*.5})},o3=g=>{let A={getPosition:{duration:g.animate.duration,easing:kI}};return new Zi({id:"col-layer",data:g.cats.col_cat_data,getPosition:B=>{let Q=g.mat.orders.col[g.order.current.col],C=g.mat.num_cols-Q[B.original_index];return[g.viz.col_offset*(C+.5),B.position[1]+g.viz.cat_shift_col]},getFillColor:B=>B.color,pickable:!0,transitions:A,opacity:.8,tile_width:g.viz.mat_width/g.mat.num_cols*.5,tile_height:g.viz.col_cat_height/2})};var j_=({isDragging:g})=>g?"grabbing":"pointer",D3=(g,A,I)=>(typeof A=="number"&&(A=A+100,I=I+100),new AE({parent:g,getCursor:j_,width:A,height:I}));var X_=(g,A,I)=>{let B=A.index,Q=I.order.current.row,C=50,E=I.mat.num_rows-I.mat.orders.row[Q][B],i=C,o=I.viz.row_offset*(E+1.5);return[i,o]},z_=(g,A,I)=>{let B=A.index,Q=I.order.current.col,C=50,E=I.mat.num_cols-I.mat.orders.col[Q][B];return[I.viz.col_offset*(E+.5),C]},a3=g=>{let A={getPosition:{duration:g.animate.duration,easing:kI}};return new ti({id:"row-label-layer",data:g.labels.row_label_data,getPosition:(B,Q)=>X_(B,Q,g),getText:B=>B.name,getSize:g.viz.font_size.rows,getColor:[0,0,0],getAngle:0,getTextAnchor:"end",getAlignmentBaseline:"center",fontFamily:"Arial",sizeUnits:"pixels",sizeScale:2,pickable:!0,transitions:A})},t3=g=>{function A(Q,C){let E=Math.pow(2,Q);return[0,75/C*E]}let I={getPosition:{duration:g.animate.duration,easing:kI}};return new ti({id:"col-label-layer",data:g.labels.col_label_data,getPosition:(Q,C)=>z_(Q,C,g),getText:Q=>Q.name,getSize:g.viz.font_size.cols,getColor:[0,0,0],getAngle:45,getTextAnchor:"start",getAlignmentBaseline:"bottom",fontFamily:"Arial",sizeUnits:"pixels",sizeScale:2,pickable:!0,transitions:I,getPixelOffset:()=>A(g.zoom.zoom_data.matrix.zoom_x,g.mat.num_cols)})},G3=250,s3=(g,A,I,B,Q,C)=>{let E=[],i=B==="col"?"row":"col";pg(I.el).selectAll(`.button-${i}`).classed("active",!1).style("border-color",I.buttons.gray),B==="col"?E=I.mat.net_mat.map(t=>t[C]):E=I.mat.net_mat[C];let o=Array.from(E.keys()).sort((t,G)=>E[G]-E[t]),D=o.length,a=Array(D);o.forEach((t,G)=>{a[t]=D-G}),I.mat.orders[i].custom=a,I.order.current[i]="custom",A.mat_layer=A.mat_layer.clone({updateTriggers:{getPosition:[I.order.current.row,I.order.current.col,Q]}}),i==="col"?(A.col_label_layer=A.col_label_layer.clone({updateTriggers:{getPosition:[I.order.current.col,Q]}}),A.col_cat_layer=A.col_cat_layer.clone({updateTriggers:{getPosition:I.order.current.col}}),fs(A,I,"col")):i==="row"&&(A.row_label_layer=A.row_label_layer.clone({updateTriggers:{getPosition:[I.order.current.row,Q]}}),A.row_cat_layer=A.row_cat_layer.clone({updateTriggers:{getPosition:I.order.current.row}}),fs(A,I,"row")),g.setProps({layers:HQ(A)})},v_=(g,A,I,B)=>{B.labels.clicks.row+=1,B.labels.clicks.row===1?(B.click.type="row_label",B.click.value={name:g.object.name},setTimeout(()=>{B.labels.clicks.row=0},G3),Object.keys(B.model).length>0&&(B.model.set("click_info",null),B.model.set("click_info",B.click),B.model.save_changes()),typeof B.custom_callbacks.row=="function"&&B.custom_callbacks.row(g.object.name)):B.labels.clicks.row===2&&(B.labels.clicks.row=0,s3(A,I,B,"row",g.object.name,g.object.index))},__=(g,A,I,B)=>{B.labels.clicks.col+=1,B.labels.clicks.col===1?(B.click.type="col_label",B.click.value={name:g.object.name},setTimeout(()=>{B.labels.clicks.col=0},G3),Object.keys(B.model).length>0&&(B.model.set("click_info",null),B.model.set("click_info",B.click),B.model.save_changes()),typeof B.custom_callbacks.col=="function"&&B.custom_callbacks.col(g.object.name)):B.labels.clicks.col===2&&(B.labels.clicks.col=0,s3(A,I,B,"col",g.object.name,g.object.index))},w3=(g,A,I)=>{A.row_label_layer=A.row_label_layer.clone({onClick:B=>v_(B,g,A,I)})},c3=(g,A,I)=>{A.col_label_layer=A.col_label_layer.clone({onClick:B=>__(B,g,A,I)})};var $_=(g,A)=>{let I=A.order.current.row,B=A.order.current.col,Q=A.mat.num_cols-A.mat.orders.col[B][g.col],C=A.mat.num_rows-A.mat.orders.row[I][g.row],E=A.viz.col_width*(Q+.5),i=A.viz.row_offset*(C+1.5);return[E,i]},e3=g=>{let A={getPosition:{duration:g.animate.duration,easing:kI}};return new Zi({id:"mat-layer",data:g.mat.mat_data,getPosition:B=>$_(B,g),getFillColor:B=>B.color,pickable:!0,antialiasing:!1,tile_height:g.viz.mat_height/g.mat.num_rows*.5,tile_width:g.viz.mat_width/g.mat.num_cols*.5,transitions:A})},A$=(g,A,I,B)=>{let Q=B.labels.row_label_data[g.object.row].name,C=B.labels.col_label_data[g.object.col].name;B.click.type="mat",B.click.value={name:`${Q}_${C}`,row:Q,col:C},Object.keys(B.model).length>0&&(B.model.set("click_info",null),B.model.set("click_info",B.click),B.model.save_changes())},N3=(g,A,I)=>{A.mat_layer=A.mat_layer.clone({onClick:B=>A$(B,g,A,I)})};var k3=(g,A)=>{let{object:I,layer:B}=A,Q=g.root.querySelector(".deck-tooltip");Q.style.marginTop="50px";let C=Q.parentElement.parentElement;if(C.style.position="unset",I){if(B.id==="row-label-layer")return{html:`Row Label: ${I.name}`,style:{color:"white"}};if(B.id==="col-label-layer")return{html:`Col Label: ${I.name}`,style:{color:"white"}};if(B.id==="row-layer")return{html:`Row Label: ${I.name}`,style:{color:"white"}};if(B.id==="col-layer")return{html:`Col Label: ${I.name}`,style:{color:"white"}};if(B.id==="row-dendro-layer")return{html:`row-dendro-${I.properties.name}<br>${I.properties.all_names}`,style:{color:"white"}};if(B.id==="col-dendro-layer")return{html:`row-dendro-${I.properties.name}<br>${I.properties.all_names}`,style:{color:"white"}};if(B.id==="mat-layer"){let E=g.labels.row_label_data[I.row].name,i=g.labels.col_label_data[I.col].name;return{html:`Row: ${E} <br> Column: ${i} <br> Value: ${I.value.toFixed(2)}`,style:{color:"white"}}}}};var h3=(g,A,I)=>{let{ini_pan_y:B}=I.zoom,Q,C=Math.pow(2,A);I.zoom.min_pan_y=(B-I.viz.row_offset)/C+I.viz.row_offset;let E=B-I.zoom.min_pan_y;return I.zoom.max_pan_y=B+E,g<=I.zoom.min_pan_y?Q=I.zoom.min_pan_y:g>I.zoom.max_pan_y?Q=I.zoom.max_pan_y:Q=g,Q},F3=(g,A,I)=>{let{ini_pan_x:B}=I.zoom,Q,C=Math.pow(2,A);I.zoom.min_pan_x=B/C;let E=B-I.zoom.min_pan_x;return I.zoom.max_pan_x=B+E,g<=I.zoom.min_pan_x?Q=I.zoom.min_pan_x:g>I.zoom.max_pan_x?Q=I.zoom.max_pan_x:Q=g,Q};var y3=(g,A,I,B)=>{let Q;return A==="matrix"?Q={matrix:{zoom:[I[0],I[1]],target:[B[0],B[1]]},rows:{zoom:[g.zoom.ini_zoom_x,I[1]],target:[g.viz.label_row_x,B[1]]},cols:{zoom:[I[0],g.zoom.ini_zoom_y],target:[B[0],g.viz.label_col_y]},dendro_rows:{zoom:[g.zoom.ini_zoom_x,I[1]],target:[g.viz.label_row_x,B[1]]},dendro_cols:{zoom:[I[0],g.zoom.ini_zoom_y],target:[B[0],g.viz.label_col_y]}}:A==="cols"||A==="dendro_cols"?Q={matrix:{zoom:[I[0],I[1]],target:[B[0],g.zoom.min_pan_y]},rows:{zoom:[g.zoom.ini_zoom_x,I[1]],target:[g.viz.label_row_x,g.zoom.min_pan_y]},cols:{zoom:[I[0],g.zoom.ini_zoom_y],target:[B[0],g.viz.label_col_y]},dendro_rows:{zoom:[g.zoom.ini_zoom_x,I[1]],target:[g.viz.label_row_x,g.zoom.min_pan_y]},dendro_cols:{zoom:[I[0],g.zoom.ini_zoom_y],target:[B[0],g.viz.label_col_y]}}:(A==="rows"||A==="dendro_rows")&&(Q={matrix:{zoom:[I[0],I[1]],target:[g.zoom.min_pan_x,B[1]]},rows:{zoom:[g.zoom.ini_zoom_x,I[1]],target:[g.viz.label_row_x,B[1]]},cols:{zoom:[I[0],g.zoom.ini_zoom_y],target:[B[0],g.viz.label_col_y]},dendro_rows:{zoom:[g.zoom.ini_zoom_x,I[1]],target:[g.viz.label_row_x,B[1]]},dendro_cols:{zoom:[I[0],g.zoom.ini_zoom_y],target:[B[0],g.viz.label_col_y]}}),Q};var r3=(g,A,I,B)=>{let{zoom_data:Q}=g.zoom;Q.matrix.pan_x=B[0],Q.matrix.pan_y=B[1],Q.matrix.zoom_x=I[0],Q.matrix.zoom_y=I[1],Q.rows.pan_x=g.zoom.ini_pan_x,Q.rows.pan_y=B[1],Q.rows.zoom_x=I[0],Q.rows.zoom_y=I[1],Q.cols.pan_x=B[0],Q.cols.pan_y=g.zoom.ini_pan_y,Q.cols.zoom_x=I[0],Q.cols.zoom_y=I[1],Q.dendro_rows.pan_x=g.zoom.ini_pan_x,Q.dendro_rows.pan_y=B[1],Q.dendro_rows.zoom_x=I[0],Q.dendro_rows.zoom_y=I[1],Q.dendro_cols.pan_x=B[0],Q.dendro_cols.pan_y=g.zoom.ini_pan_y,Q.dendro_cols.zoom_x=I[0],Q.dendro_cols.zoom_y=I[1]},n3=g=>{g.zoom.zoom_data={},g.zoom.zoom_data.total_zoom={},g.zoom.zoom_data.total_zoom.x=0,g.zoom.zoom_data.total_zoom.y=0,g.zoom.zoom_data.matrix={pan_x:g.zoom.ini_pan_x,pan_y:g.zoom.ini_pan_y,zoom_x:g.zoom.ini_zoom_x,zoom_y:g.zoom.ini_zoom_y},g.zoom.zoom_data.rows={pan_x:g.zoom.ini_pan_x,pan_y:g.zoom.ini_pan_y,zoom_x:g.zoom.ini_zoom_x,zoom_y:g.zoom.ini_zoom_y},g.zoom.zoom_data.cols={pan_x:g.zoom.ini_pan_x,pan_y:g.zoom.ini_pan_y,zoom_x:g.zoom.ini_zoom_x,zoom_y:g.zoom.ini_zoom_y},g.zoom.zoom_data.dendro_rows={pan_x:g.zoom.ini_pan_x,pan_y:g.zoom.ini_pan_y,zoom_x:g.zoom.ini_zoom_x,zoom_y:g.zoom.ini_zoom_y},g.zoom.zoom_data.dendro_cols={pan_x:g.zoom.ini_pan_x,pan_y:g.zoom.ini_pan_y,zoom_x:g.zoom.ini_zoom_x,zoom_y:g.zoom.ini_zoom_y}};var R3=(g,A,I,B)=>{let{viewState:Q}=g,{viewId:C}=g,{zoom:E,target:i}=Q,o,D;C==="cols"?B.zoom.minor_zoom_axis==="X"?(o=E[0],D=E[1]):B.zoom.minor_zoom_axis==="Y"?(o=E[0]-B.zoom.zoom_data[C].zoom_x,D=E[1]-B.zoom.zoom_data[C].zoom_y):B.zoom.minor_zoom_axis==="none"&&(o=E[0]-B.zoom.zoom_data[C].zoom_x,D=E[1]):(C==="rows"||C==="dendro_rows")&&(B.zoom.minor_zoom_axis==="Y"?(o=E[0],D=E[1]):B.zoom.minor_zoom_axis==="X"?(o=E[0]-B.zoom.zoom_data[C].zoom_x,D=E[1]-B.zoom.zoom_data[C].zoom_y):B.zoom.minor_zoom_axis==="none"&&(o=E[0],D=E[1]-B.zoom.zoom_data[C].zoom_y)),C==="dendro_cols"?B.zoom.minor_zoom_axis==="X"?(o=E[0],D=E[1]):B.zoom.minor_zoom_axis==="Y"?(o=E[0]-B.zoom.zoom_data[C].zoom_x,D=E[1]-B.zoom.zoom_data[C].zoom_y):B.zoom.minor_zoom_axis==="none"&&(o=E[0]-B.zoom.zoom_data[C].zoom_x,D=E[1]):C==="matrix"&&(o=E[0]-B.zoom.zoom_data[C].zoom_x,D=E[1]-B.zoom.zoom_data[C].zoom_y),B.zoom.zoom_data.total_zoom.x+=o,B.zoom.zoom_data.total_zoom.y+=D,B.zoom.zoom_data.total_zoom.x=Math.max(0,B.zoom.zoom_data.total_zoom.x),B.zoom.zoom_data.total_zoom.y=Math.max(0,B.zoom.zoom_data.total_zoom.y);let a=[B.zoom.zoom_data.total_zoom.x,B.zoom.zoom_data.total_zoom.y],t=Math.max(0,a[0]),G=Math.max(0,a[1]);B.zoom.major_zoom_axis==="X"?G=t-B.zoom.zoom_delay:B.zoom.major_zoom_axis==="Y"&&(t=G-B.zoom.zoom_delay),t=Math.max(0,t),G=Math.max(0,G);let s=F3(i[0],t,B),w=h3(i[1],G,B),e=[t,G],c=[s,w],h=y3(B,C,e,c);r3(B,C,e,c);let R;B.zoom.major_zoom_axis==="X"?R=Math.pow(2,B.zoom.zoom_data.matrix.zoom_x):B.zoom.major_zoom_axis==="Y"?R=Math.pow(2,B.zoom.zoom_data.matrix.zoom_y):B.zoom.major_zoom_axis==="all"&&(R=Math.pow(2,B.zoom.zoom_data.matrix.zoom_x)),I.row_label_layer=I.row_label_layer.clone({getSize:B.viz.font_size.rows*Math.pow(2,B.zoom.zoom_data.matrix.zoom_y)}),I.col_label_layer=I.col_label_layer.clone({getSize:B.viz.font_size.cols*Math.pow(2,B.zoom.zoom_data.matrix.zoom_x),updateTriggers:{getPixelOffset:B.zoom.zoom_data.matrix.zoom_x}});let N;B.zoom.major_zoom_axis!=="all"?N=R<B.zoom.switch_ratio?B.zoom.major_zoom_axis:"all":N="all",B.views.views_list=B.views.views_list.map(y=>new IB({...y.props,controller:{...y.props.controller,doubleClickZoom:!1,scrollZoom:!0,inertia:!0,zoomAxis:N}})),A.setProps({viewState:h,layers:HQ(I),views:B.views.views_list})};var M3=g=>{let A;g.mat.num_rows>g.mat.num_cols?(g.zoom.major_zoom_axis="Y",g.zoom.minor_zoom_axis="X",A=g.mat.num_rows/g.mat.num_cols):g.mat.num_rows<g.mat.num_cols?(g.zoom.major_zoom_axis="X",g.zoom.minor_zoom_axis="Y",A=g.mat.num_cols/g.mat.num_rows):g.mat.num_rows===g.mat.num_cols&&(g.zoom.major_zoom_axis="all",g.zoom.minor_zoom_axis="none",A=1),g.zoom.switch_ratio=A,g.zoom.zoom_delay=Math.log2(A);let I=[new IB({id:"matrix",x:`${g.viz.row_region+g.viz.label_buffer}px`,y:`${g.viz.col_region+g.viz.label_buffer}px`,width:`${g.viz.mat_width}px`,height:`${g.viz.mat_height}px`,controller:{scrollZoom:!0,inertia:!0,zoomAxis:g.zoom.major_zoom_axis,doubleClickZoom:!1}}),new IB({id:"rows",x:"0px",y:`${g.viz.col_region+g.viz.label_buffer}px`,width:`${g.viz.row_region}px`,height:`${g.viz.mat_height}px`,controller:{scrollZoom:!0,inertia:!1,zoomAxis:g.zoom.major_zoom_axis,doubleClickZoom:!1}}),new IB({id:"cols",x:`${g.viz.row_region+g.viz.label_buffer}px`,y:"0px",width:`${g.viz.mat_width}px`,height:`${g.viz.col_region}px`,controller:{scrollZoom:!0,inertia:!1,zoomAxis:g.zoom.major_zoom_axis,doubleClickZoom:!1}}),new IB({id:"dendro_cols",x:`${g.viz.row_region+g.viz.label_buffer}px`,y:`${g.viz.col_region+g.viz.label_buffer+g.viz.mat_height}px`,width:`${g.viz.mat_width}px`,height:`${g.viz.dendrogram_width}px`,controller:{scrollZoom:!0,inertia:!1,zoomAxis:g.zoom.major_zoom_axis,doubleClickZoom:!1}}),new IB({id:"dendro_rows",x:`${g.viz.row_region+g.viz.label_buffer+g.viz.mat_width}px`,y:`${g.viz.col_region+g.viz.label_buffer}px`,width:`${g.viz.dendrogram_width}px`,height:`${g.viz.mat_height}px`,controller:{scrollZoom:!0,inertia:!1,zoomAxis:g.zoom.major_zoom_axis,doubleClickZoom:!1}})];g.views={},g.views.views_list=I},J3=g=>({matrix:{target:[g.zoom.ini_pan_x,g.zoom.ini_pan_y],zoom:[g.zoom.ini_zoom_x,g.zoom.ini_zoom_y]},rows:{target:[g.viz.label_row_x,g.zoom.ini_pan_y],zoom:[g.zoom.ini_zoom_x,g.zoom.ini_zoom_y]},cols:{target:[g.zoom.ini_pan_x,g.viz.label_col_y],zoom:[g.zoom.ini_zoom_x,g.zoom.ini_zoom_y]},dendro_rows:{target:[g.viz.label_row_x,g.zoom.ini_pan_y],zoom:[g.zoom.ini_zoom_x,g.zoom.ini_zoom_y]},dendro_cols:{target:[g.zoom.ini_pan_x,g.viz.label_col_y],zoom:[g.zoom.ini_zoom_x,g.zoom.ini_zoom_y]}});var g$=(g,A=255)=>{let I=UI(g);return I?[I.r,I.g,I.b,A]:[0,0,0,A]},Y3=(g,A,I)=>{let B=I==="row",Q=B?g.row_nodes:g.col_nodes,C=B?A.cats.num_cats.row:A.cats.num_cats.col,E=B?A.viz.row_cat_offset:A.viz.col_cat_offset,i=B?A.viz.row_offset:A.viz.col_offset;return Q.flatMap((D,a)=>Array.from({length:C}).map((t,G)=>{let s=`cat-${G}`,w=D[s];if(!w)return null;let e=g.global_cat_colors[w],c=g$(e,255);return{position:B?[E*(G+.5)+20,i*(a+.5)]:[i*(a+.5),E*(G+1.5)-30],color:c,name:w,level:G,original_index:a}})).filter(Boolean)},K3=(g,A)=>Y3(g,A,"row"),q3=(g,A)=>Y3(g,A,"col");var U3=(g,A)=>{let I=[];g.col_nodes.forEach((B,Q)=>{let C={name:B.name,ini:B.ini,clust:B.clust,rank:B.rank,rankvar:B.rankvar,index:Q};I.push(C)}),A.labels.col_label_data=I,A.labels.clicks.col=0,A.mat.orders.col={},A.mat.orders.col.ini=I.map(B=>B.ini),A.mat.orders.col.clust=I.map(B=>B.clust+1),A.mat.orders.col.rank=I.map(B=>B.rank+1),A.mat.orders.col.rankvar=I.map(B=>B.rankvar+1)},H3=(g,A)=>{let I=[];g.row_nodes.forEach((B,Q)=>{let C={name:B.name,ini:B.ini,clust:B.clust,rank:B.rank,rankvar:B.rankvar,index:Q};I.push(C)}),A.labels.row_label_data=I,A.labels.clicks.row=0,A.mat.orders.row={},A.mat.orders.row.ini=I.map(B=>B.ini),A.mat.orders.row.clust=I.map(B=>B.clust+1),A.mat.orders.row.rank=I.map(B=>B.rank+1),A.mat.orders.row.rankvar=I.map(B=>B.rankvar+1)};var S3=(g,A)=>{let I;g.mat.forEach((B,Q)=>{B.forEach((C,E)=>{C>=0?I=[255,0,0]:I=[0,0,255];let i={position:[A.viz.col_offset*(E+.5),A.viz.row_offset*(Q+1.5)],color:[I[0],I[1],I[2],255*Math.abs(C)/A.mat.max_abs_value],value:C,row:Q,col:E};A.mat.mat_data.push(i)})})};var L3=(g,A,I,B,Q,C,E,i)=>{let o={};return o.root=I,o.model=g,o.custom_callbacks={},o.custom_callbacks.row=C,o.custom_callbacks.col=E,o.custom_callbacks.col_dendro=i,o.viz={},o.viz.height_margin=100,o.cats={},o.cats.num_cats={},o.cats.num_cats.row=Object.keys(A.row_cats).length,o.cats.num_cats.col=Object.keys(A.col_cats).length,o.root.style.height=`${Q+o.viz.height_margin}px`,o.viz.row_cat_offset=9,o.viz.col_cat_offset=9,o.viz.mat_width=B-o.viz.row_cat_offset*o.cats.num_cats.row,o.viz.mat_height=Q-o.viz.col_cat_offset*o.cats.num_cats.col,o.mat={},o.mat.num_rows=A.mat.length,o.mat.num_cols=A.mat[0].length,o.row_nodes=A.row_nodes,o.col_nodes=A.col_nodes,o.mat.net_mat=A.mat,o.linkage=A.linkage,o.viz.base_font_size=125,o.viz.col_label=75,o.viz.row_label=75,o.viz.extra_space={},o.viz.extra_space.row=5,o.viz.extra_space.col=5,o.zoom={},o.zoom.ini_zoom_x=0,o.zoom.ini_zoom_y=0,o.viz.row_cat_width=8,o.viz.col_cat_height=8,o.viz.label_row_x=15,o.viz.label_col_y=25,o.viz.cat_shift_row=30,o.viz.label_buffer=1,o.animate={},o.animate.duration=2500,o.viz.dendrogram_width=15,o.viz.font_size={},o.viz.font_size.rows=o.viz.base_font_size/o.mat.num_rows,o.viz.font_size.cols=o.viz.base_font_size/o.mat.num_cols,o.viz.col_region=(o.viz.col_cat_height+o.viz.extra_space.col)*o.cats.num_cats.col+o.viz.col_label,o.viz.row_region=(o.viz.row_cat_width+o.viz.extra_space.row)*o.cats.num_cats.row+o.viz.row_label,o.viz.col_width=o.viz.mat_width/o.mat.num_cols,o.viz.row_offset=o.viz.mat_height/o.mat.num_rows,o.viz.col_offset=o.viz.mat_width/o.mat.num_cols,o.viz.cat_shift_col=o.viz.col_label,o.zoom.ini_pan_x=o.viz.mat_width/2,o.zoom.ini_pan_y=o.viz.mat_height/2+o.viz.row_offset,o.mat.mat_data=[],o.mat.num_rows=A.mat.length,o.mat.num_cols=A.mat[0].length,o.mat.max_abs_value=A.mat.flat().reduce((D,a)=>Math.max(D,Math.abs(a)),-1/0),o.order={},o.order.current={},o.order.current.row="clust",o.order.current.col="clust",o.order.new="ini",o.buttons={},o.buttons.blue="#8797ff",o.buttons.gray="#EEEEEE",o.click={},o.click.type=null,o.click.value=null,o};var _R=async(g,A,I,B="800",Q="800",C=null,E=null,i=null)=>{let o=document.createElement("div");o.style.border="1px solid #d3d3d3";let D=D3(o,B,Q),a=L3(g,I,o,B,Q,C,E,i);A.style.position="relative",a.el=A,S3(I,a),a.labels={},a.labels.clicks={},n3(a),a.mat.orders={},H3(I,a),U3(I,a),a.cats.row_cat_data=K3(I,a),a.cats.col_cat_data=q3(I,a),Zf(a),ms(a,"row"),ms(a,"col");let t={};t.mat_layer=e3(a),t.row_label_layer=a3(a),t.col_label_layer=t3(a),t.row_cat_layer=i3(a),t.col_cat_layer=o3(a),t.row_dendro_layer=xR(t,a,"row"),t.col_dendro_layer=xR(t,a,"col"),M3(a);let G=J3(a);N3(D,t,a),w3(D,t,a),c3(D,t,a),uR(D,t,a,"row"),uR(D,t,a,"col"),D.setProps({onViewStateChange:w=>R3(w,D,t,a),views:a.views.views_list,initialViewState:G,getTooltip:w=>k3(a,w),layerFilter:Wf,layers:HQ(t)});let s=Xf(D,t,a);A.appendChild(s),A.appendChild(a.root)};var d3=async({model:g,el:A})=>{let I=g.get("token"),B=g.get("creds"),Q=g.get("ini_x"),C=g.get("ini_y"),E=g.get("ini_z"),i=g.get("ini_zoom"),o=g.get("base_url"),D=g.get("dataset_name"),a=g.get("width"),t=g.get("height"),G=g.get("meta_cell"),s=g.get("meta_cluster"),w=g.get("umap"),e=g.get("landscape_state"),c=g.get("segmentation");return zR(A,g,I,Q,C,E,i,o,D,.25,a,t,G,s,w,e,c,B)},p3=async({model:g,el:A})=>{let I=g.get("token"),B=g.get("ini_x"),Q=g.get("ini_y"),C=g.get("ini_z"),E=g.get("ini_zoom"),i=g.get("base_url"),o=g.get("dataset_name"),D=g.get("square_tile_size"),a=g.get("width"),t=g.get("height");vR(g,A,i,I,B,Q,C,E,D,o,a,t)},l3=async({model:g,el:A})=>{let I=g.get("token"),B=g.get("ini_x"),Q=g.get("ini_y"),C=g.get("ini_z"),E=g.get("ini_zoom"),i=g.get("base_url"),o=g.get("dataset_name"),D=g.get("width"),a=g.get("height"),t=g.get("creds");Tr(g,A,i,I,B,Q,C,E,o,D,a,t)},f3=async({model:g,el:A})=>{let I=g.get("technology");if(["MERSCOPE","Xenium"].includes(I))return d3({model:g,el:A});if(["Visium-HD"].includes(I))return p3({model:g,el:A});if(["h&e"].includes(I))return l3({model:g,el:A})},m3=async({model:g,el:A})=>{let I=g.get("network"),B=g.get("width"),Q=g.get("height");_R(g,A,I,B,Q)};function I$({model:g,el:A}){try{let I=g.get("component");if(!I){fh("Component type is not defined",{data:{model:g?.id||"unknown",el:A?.id||"unknown"}});return}switch(I){case"Landscape":return f3({model:g,el:A});case"Matrix":return m3({model:g,el:A});default:fh(`Unknown component type: ${I}`,{data:{componentType:I,model:g?.id||"unknown"}});return}}catch(I){let B=Sg(I,{context:"render function",logUnexpected:!0,messages:{unexpected:"Error in render function"}});A.innerHTML=`<div style="color: red; padding: 10px;">Error: ${B.message}</div>`}}var zTA={landscape_ist:zR,landscape_sst:vR,landscape_h_e:Tr,matrix_viz:_R,render:I$,render_landscape_ist:d3,render_landscape_sst:p3,render_landscape_h_e:l3,render_landscape:f3,render_matrix_new:m3};export{zTA as default};
|
|
1765
1765
|
/*! Bundled license information:
|
|
1766
1766
|
|
|
1767
1767
|
hammerjs/hammer.js:
|