@fnndsc/argus 0.7.2 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/Settings-aPI1L0Hv.js +4204 -0
- package/dist/assets/Texture-B5_yVp0g.js +204 -0
- package/dist/assets/{addVolumesToViewports-kPbPUzG1.js → addVolumesToViewports-DihvLMPa.js} +1 -1
- package/dist/assets/cornerstoneEngine-A1IbMa9k.js +2 -0
- package/dist/assets/{index-BEqlmVJ8.js → index-AzIZ0aym.js} +1 -1
- package/dist/assets/{index-WxcTPiRU.js → index-B4dN9H5V.js} +2 -2
- package/dist/assets/index-C0cxM8sU.css +1 -0
- package/dist/assets/index-CNN-ajYW.js +4149 -0
- package/dist/assets/index-CU4ov6t9.js +1 -0
- package/dist/assets/index-CsgpuZsj.js +1 -0
- package/dist/assets/{index-BivV2-EJ.js → index-Cw0WY3CI.js} +2 -2
- package/dist/assets/{index-DRvbvdZm.js → index-DPYz8EHh.js} +5 -5
- package/dist/assets/niivueEngine-BOeCGTwL.js +2 -0
- package/dist/assets/slabScene-BvqXoSPu.js +559 -0
- package/dist/index.html +161 -37
- package/package.json +4 -3
- package/dist/assets/Settings-B_WPNkCE.js +0 -4407
- package/dist/assets/cornerstoneEngine-COmMRWtq.js +0 -2
- package/dist/assets/index-B1IRr1ii.js +0 -4145
- package/dist/assets/index-BbgujRGq.css +0 -1
- package/dist/assets/index-Ddoc1eo6.js +0 -1
- package/dist/assets/index-oaz5IMVa.js +0 -1
- package/dist/assets/niivueEngine-B2PDgoH7.js +0 -2
- /package/dist/{assets/arrive-ClURnB_N.wav → sounds/arrive.wav} +0 -0
- /package/dist/{assets/press-Cr6-1MeH.wav → sounds/press.wav} +0 -0
- /package/dist/{assets/refuse-DQOeTs-N.wav → sounds/refuse.wav} +0 -0
- /package/dist/{assets/retreat-CxfXQVOC.wav → sounds/retreat.wav} +0 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import{aw as St,ax as Ir,a5 as ri,ad as rr,q as ai,u as cn,aj as si,p as At,a0 as ii,m as C,Y as $n,k as b,y as ye,ak as m,E as oe,j as P,au as bt,ay as oi,J as pt,i as at,$ as fi,x as Re,av as de,t as ce,o as It,F as Ln,s as ar,az as ci,aA as ui,_ as zt,D as ne,aB as tt,aC as mt,aD as mr,aE as gi,aF as dt,aG as nt,aH as Mn,B as Y,aI as Wn,P as Je,aJ as Qe,aK as un,aL as hi,aM as sr,as as On,z as pi,A as Ti,C as vi,G as ir,L as it,aN as yi,N as Ct,W as Hn,X as Pr,K as ot,aO as ea,aP as _t,ao as Ie,a9 as li,R as zn,T as I,ag as ta,V as ee,aa as xi,aQ as Ei,aR as or,aS as fr,aT as na,f as fe,d as Q,aU as Si,h as he,al as rn,aV as ra,aW as Ri,c as Ci,n as _e,aX as Lt,aY as cr,aZ as gn,a_ as wi,a$ as di,I as _i,ai as ur,b0 as Li,b1 as hn}from"./cornerstoneEngine-A1IbMa9k.js";import{g as Mi}from"./_commonjsHelpers-CE1G-McA.js";function Oi(){var t=new St(4);return St!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function Di(t,e,n,r){var s=new St(4);return s[0]=t,s[1]=e,s[2]=n,s[3]=r,s}function Lp(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t}function Fi(t,e){var n=e[0],r=e[1],s=e[2],a=e[3],i=n*n+r*r+s*s+a*a;return i>0&&(i=1/Math.sqrt(i)),t[0]=n*i,t[1]=r*i,t[2]=s*i,t[3]=a*i,t}function Ke(t,e,n){var r=e[0],s=e[1],a=e[2],i=e[3];return t[0]=n[0]*r+n[4]*s+n[8]*a+n[12]*i,t[1]=n[1]*r+n[5]*s+n[9]*a+n[13]*i,t[2]=n[2]*r+n[6]*s+n[10]*a+n[14]*i,t[3]=n[3]*r+n[7]*s+n[11]*a+n[15]*i,t}(function(){var t=Oi();return function(e,n,r,s,a,i){var o,c;for(n||(n=4),r||(r=0),s?c=Math.min(s*n+r,e.length):c=e.length,o=r;o<c;o+=n)t[0]=e[o],t[1]=e[o+1],t[2]=e[o+2],t[3]=e[o+3],a(t,t,i),e[o]=t[0],e[o+1]=t[1],e[o+2]=t[2],e[o+3]=t[3];return e}})();function qe(){var t=new St(4);return St!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function jn(t,e,n){n=n*.5;var r=Math.sin(n);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(n),t}function Bi(t,e){var n=Math.acos(e[3])*2,r=Math.sin(n/2);return r>Ir?(t[0]=e[0]/r,t[1]=e[1]/r,t[2]=e[2]/r):(t[0]=1,t[1]=0,t[2]=0),n}function gr(t,e,n){var r=e[0],s=e[1],a=e[2],i=e[3],o=n[0],c=n[1],g=n[2],T=n[3];return t[0]=r*T+i*o+s*g-a*c,t[1]=s*T+i*c+a*o-r*g,t[2]=a*T+i*g+r*c-s*o,t[3]=i*T-r*o-s*c-a*g,t}function jt(t,e,n,r){var s=e[0],a=e[1],i=e[2],o=e[3],c=n[0],g=n[1],T=n[2],f=n[3],y,w,R,l,x;return w=s*c+a*g+i*T+o*f,w<0&&(w=-w,c=-c,g=-g,T=-T,f=-f),1-w>Ir?(y=Math.acos(w),R=Math.sin(y),l=Math.sin((1-r)*y)/R,x=Math.sin(r*y)/R):(l=1-r,x=r),t[0]=l*s+x*c,t[1]=l*a+x*g,t[2]=l*i+x*T,t[3]=l*o+x*f,t}function Ni(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t}function Gi(t,e){var n=e[0]+e[4]+e[8],r;if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{var s=0;e[4]>e[0]&&(s=1),e[8]>e[s*3+s]&&(s=2);var a=(s+1)%3,i=(s+2)%3;r=Math.sqrt(e[s*3+s]-e[a*3+a]-e[i*3+i]+1),t[s]=.5*r,r=.5/r,t[3]=(e[a*3+i]-e[i*3+a])*r,t[a]=(e[a*3+s]+e[s*3+a])*r,t[i]=(e[i*3+s]+e[s*3+i])*r}return t}var hr=Di,aa=Fi;(function(){var t=ri(),e=rr(1,0,0),n=rr(0,1,0);return function(r,s,a){var i=ai(s,a);return i<-.999999?(cn(t,e,s),si(t)<1e-6&&cn(t,n,s),At(t,t),jn(r,t,Math.PI),r):i>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(cn(t,s,a),r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=1+i,aa(r,r))}})();(function(){var t=qe(),e=qe();return function(n,r,s,a,i,o){return jt(t,r,i,o),jt(e,s,a,o),jt(n,t,e,2*o*(1-o)),n}})();(function(){var t=ii();return function(e,n,r,s){return t[0]=r[0],t[3]=r[1],t[6]=r[2],t[1]=s[0],t[4]=s[1],t[7]=s[2],t[2]=-n[0],t[5]=-n[1],t[8]=-n[2],aa(e,Gi(e,t))}})();var Ui={COMPOSITE_BLEND:0,MAXIMUM_INTENSITY_BLEND:1,MINIMUM_INTENSITY_BLEND:2,AVERAGE_INTENSITY_BLEND:3,ADDITIVE_INTENSITY_BLEND:4,RADON_TRANSFORM_BLEND:5,LABELMAP_EDGE_PROJECTION_BLEND:6},Vi={BlendMode:Ui},{vtkDebugMacro:Mt}=C;function ki(t,e){e.classHierarchy.push("vtkCamera");const n=new Float64Array(3),r=new Float64Array([0,0,-1]),s=new Float64Array([0,1,0]),a=b(new Float64Array(16)),i=b(new Float64Array(16)),o=new Float64Array(3),c=new Float64Array(3),g=new Float64Array(3),T=b(new Float64Array(16)),f=b(new Float64Array(16)),y=new Float64Array(3),w=new Float64Array(3);function R(){e.viewPlaneNormal[0]=-e.directionOfProjection[0],e.viewPlaneNormal[1]=-e.directionOfProjection[1],e.viewPlaneNormal[2]=-e.directionOfProjection[2]}t.orthogonalizeViewUp=()=>{t.getViewMatrix(a),e.viewUp[0]=a[4],e.viewUp[1]=a[5],e.viewUp[2]=a[6],t.modified()},t.setPosition=(l,x,u)=>{l===e.position[0]&&x===e.position[1]&&u===e.position[2]||(e.position[0]=l,e.position[1]=x,e.position[2]=u,t.computeDistance(),t.modified())},t.setFocalPoint=(l,x,u)=>{l===e.focalPoint[0]&&x===e.focalPoint[1]&&u===e.focalPoint[2]||(e.focalPoint[0]=l,e.focalPoint[1]=x,e.focalPoint[2]=u,t.computeDistance(),t.modified())},t.setDistance=l=>{if(e.distance===l)return;e.distance=l,e.distance<1e-20&&(e.distance=1e-20,Mt("Distance is set to minimum."));const x=e.directionOfProjection;e.focalPoint[0]=e.position[0]+x[0]*e.distance,e.focalPoint[1]=e.position[1]+x[1]*e.distance,e.focalPoint[2]=e.position[2]+x[2]*e.distance,t.modified()},t.computeDistance=()=>{const l=e.focalPoint[0]-e.position[0],x=e.focalPoint[1]-e.position[1],u=e.focalPoint[2]-e.position[2];if(e.distance=Math.sqrt(l*l+x*x+u*u),e.distance<1e-20){e.distance=1e-20,Mt("Distance is set to minimum.");const p=e.directionOfProjection;e.focalPoint[0]=e.position[0]+p[0]*e.distance,e.focalPoint[1]=e.position[1]+p[1]*e.distance,e.focalPoint[2]=e.position[2]+p[2]*e.distance}e.directionOfProjection[0]=l/e.distance,e.directionOfProjection[1]=x/e.distance,e.directionOfProjection[2]=u/e.distance,R()},t.dolly=l=>{if(l<=0)return;const x=e.distance/l;t.setPosition(e.focalPoint[0]-x*e.directionOfProjection[0],e.focalPoint[1]-x*e.directionOfProjection[1],e.focalPoint[2]-x*e.directionOfProjection[2])},t.roll=l=>{const x=e.position,u=e.focalPoint,p=e.viewUp,h=new Float64Array([p[0],p[1],p[2],0]);b(T);const v=new Float64Array([u[0]-x[0],u[1]-x[1],u[2]-x[2]]);ye(T,T,m(l),v),Ke(h,h,T),e.viewUp[0]=h[0],e.viewUp[1]=h[1],e.viewUp[2]=h[2],t.modified()},t.azimuth=l=>{const x=e.focalPoint;b(f),oe(f,f,x),ye(f,f,m(l),e.viewUp),oe(f,f,[-x[0],-x[1],-x[2]]),P(y,e.position,f),t.setPosition(y[0],y[1],y[2])},t.yaw=l=>{const x=e.position;b(f),oe(f,f,x),ye(f,f,m(l),e.viewUp),oe(f,f,[-x[0],-x[1],-x[2]]),P(w,e.focalPoint,f),t.setFocalPoint(w[0],w[1],w[2])},t.elevation=l=>{const x=e.focalPoint;t.getViewMatrix(a);const u=[-a[0],-a[1],-a[2]];b(f),oe(f,f,x),ye(f,f,m(l),u),oe(f,f,[-x[0],-x[1],-x[2]]),P(y,e.position,f),t.setPosition(y[0],y[1],y[2])},t.pitch=l=>{const x=e.position;t.getViewMatrix(a);const u=[a[0],a[1],a[2]];b(f),oe(f,f,x),ye(f,f,m(l),u),oe(f,f,[-x[0],-x[1],-x[2]]),P(w,e.focalPoint,f),t.setFocalPoint(...w)},t.zoom=l=>{l<=0||(e.parallelProjection?e.parallelScale/=l:e.viewAngle/=l,t.modified())},t.translate=(l,x,u)=>{const p=[l,x,u];bt(e.position,p,e.position),bt(e.focalPoint,p,e.focalPoint),t.computeDistance(),t.modified()},t.applyTransform=l=>{const x=[...e.viewUp,1],u=[],p=[],h=[];x[0]+=e.position[0],x[1]+=e.position[1],x[2]+=e.position[2],Ke(u,[...e.position,1],l),Ke(p,[...e.focalPoint,1],l),Ke(h,x,l),h[0]-=u[0],h[1]-=u[1],h[2]-=u[2],t.setPosition(...u.slice(0,3)),t.setFocalPoint(...p.slice(0,3)),t.setViewUp(...h.slice(0,3))},t.getThickness=()=>e.clippingRange[1]-e.clippingRange[0],t.setThickness=l=>{let x=l;x<1e-20&&(x=1e-20,Mt("Thickness is set to minimum.")),t.setClippingRange(e.clippingRange[0],e.clippingRange[0]+x)},t.setThicknessFromFocalPoint=l=>{let x=l;x<1e-20&&(x=1e-20,Mt("Thickness is set to minimum.")),t.setClippingRange(e.distance-x/2,e.distance+x/2)},t.setRoll=l=>{},t.getRoll=()=>{},t.setObliqueAngles=(l,x)=>{},t.getOrientation=()=>{},t.getOrientationWXYZ=()=>{},t.getFrustumPlanes=(l=1,x=new Float64Array(24))=>{const u=[[1,0,0,1],[-1,0,0,1],[0,1,0,1],[0,-1,0,1],[0,0,1,1],[0,0,-1,1]],p=t.getCompositeProjectionMatrix(l,-1,1);for(let h=0;h<6;h++)Ke(u[h],u[h],p),oi(u[h]),x[4*h+0]=u[h][0],x[4*h+1]=u[h][1],x[4*h+2]=u[h][2],x[4*h+3]=u[h][3];return x},t.getCameraLightTransformMatrix=l=>(pt(l,e.cameraLightTransform),l),t.computeCameraLightTransform=()=>{t.getViewMatrix(a),at(a,a),fi(i,[e.distance,e.distance,e.distance]),Re(a,a,i),b(e.cameraLightTransform),oe(e.cameraLightTransform,a,[0,0,-1])},t.deepCopy=l=>{},t.physicalOrientationToWorldDirection=l=>{const x=hr(l[0],l[1],l[2],l[3]),u=qe(),p=hr(0,0,1,0);return Ni(u,x),gr(p,x,p),gr(p,p,u),[p[0],p[1],p[2]]},t.getPhysicalToWorldMatrix=l=>{t.getWorldToPhysicalMatrix(l),at(l,l)},t.getWorldToPhysicalMatrix=l=>{b(l);const x=[3];de(e.physicalViewNorth,e.physicalViewUp,x),l[0]=x[0],l[1]=x[1],l[2]=x[2],l[4]=e.physicalViewUp[0],l[5]=e.physicalViewUp[1],l[6]=e.physicalViewUp[2],l[8]=-e.physicalViewNorth[0],l[9]=-e.physicalViewNorth[1],l[10]=-e.physicalViewNorth[2],ce(l,l),It(o,1/e.physicalScale,1/e.physicalScale,1/e.physicalScale),Ln(l,l,o),oe(l,l,e.physicalTranslation)},t.computeViewParametersFromViewMatrix=l=>{at(a,l),P(o,n,a),t.computeDistance();const x=e.distance;t.setPosition(o[0],o[1],o[2]),P(c,r,a),ar(c,c,o),At(c,c),t.setDirectionOfProjection(c[0],c[1],c[2]),P(g,s,a),ar(g,g,o),At(g,g),t.setViewUp(g[0],g[1],g[2]),t.setDistance(x)},t.computeViewParametersFromPhysicalMatrix=l=>{t.getWorldToPhysicalMatrix(a),Re(a,l,a),t.computeViewParametersFromViewMatrix(a)},t.setViewMatrix=l=>{e.viewMatrix=l,e.viewMatrix&&(t.computeViewParametersFromViewMatrix(e.viewMatrix),ce(e.viewMatrix,e.viewMatrix))},t.getViewMatrix=(l=new Float64Array(16))=>e.viewMatrix?(e.modelTransformMatrix?Re(l,e.modelTransformMatrix,e.viewMatrix):pt(l,e.viewMatrix),l):(ci(l,e.position,e.focalPoint,e.viewUp),ce(l,l),e.modelTransformMatrix&&Re(l,e.modelTransformMatrix,l),l),t.setProjectionMatrix=l=>{e.projectionMatrix=l},t.getProjectionMatrix=(l,x,u)=>{const p=new Float64Array(16);if(b(p),e.projectionMatrix){const E=1/e.physicalScale;return It(o,E,E,E),pt(p,e.projectionMatrix),Ln(p,p,o),ce(p,p),p}b(a);const h=e.clippingRange[1]-e.clippingRange[0],v=[e.clippingRange[0]+(x+1)*h/2,e.clippingRange[0]+(u+1)*h/2];if(e.parallelProjection){const E=e.parallelScale*l,S=e.parallelScale,_=(e.windowCenter[0]-1)*E,d=(e.windowCenter[0]+1)*E,L=(e.windowCenter[1]-1)*S,M=(e.windowCenter[1]+1)*S;ui(a,_,d,L,M,v[0],v[1]),ce(a,a)}else{if(e.useOffAxisProjection)throw new Error("Off-Axis projection is not supported at this time");{const E=Math.tan(m(e.viewAngle)/2);let S,_;e.useHorizontalViewAngle===!0?(S=e.clippingRange[0]*E,_=e.clippingRange[0]*E/l):(S=e.clippingRange[0]*E*l,_=e.clippingRange[0]*E);const d=(e.windowCenter[0]-1)*S,L=(e.windowCenter[0]+1)*S,M=(e.windowCenter[1]-1)*_,D=(e.windowCenter[1]+1)*_,F=v[0],N=v[1];a[0]=2*F/(L-d),a[5]=2*F/(D-M),a[2]=(d+L)/(L-d),a[6]=(M+D)/(D-M),a[10]=-(F+N)/(N-F),a[14]=-1,a[11]=-2*F*N/(N-F),a[15]=0}}return pt(p,a),p},t.getCompositeProjectionMatrix=(l,x,u)=>{const p=t.getViewMatrix(),h=t.getProjectionMatrix(l,x,u);return Re(h,p,h),h},t.setDirectionOfProjection=(l,x,u)=>{if(e.directionOfProjection[0]===l&&e.directionOfProjection[1]===x&&e.directionOfProjection[2]===u)return;e.directionOfProjection[0]=l,e.directionOfProjection[1]=x,e.directionOfProjection[2]=u;const p=e.directionOfProjection;e.focalPoint[0]=e.position[0]+p[0]*e.distance,e.focalPoint[1]=e.position[1]+p[1]*e.distance,e.focalPoint[2]=e.position[2]+p[2]*e.distance,R()},t.setDeviceAngles=(l,x,u,p)=>{const h=[3];de(e.physicalViewNorth,e.physicalViewUp,h);const v=b(new Float64Array(16));ye(v,v,m(l),e.physicalViewUp),ye(v,v,m(x),h),ye(v,v,m(u),e.physicalViewNorth),ye(v,v,m(-p),e.physicalViewUp);const E=new Float64Array([-e.physicalViewUp[0],-e.physicalViewUp[1],-e.physicalViewUp[2]]),S=new Float64Array(e.physicalViewNorth);P(E,E,v),P(S,S,v),t.setDirectionOfProjection(E[0],E[1],E[2]),t.setViewUp(S[0],S[1],S[2]),t.modified()},t.setOrientationWXYZ=(l,x,u,p)=>{const h=b(new Float64Array(16));if(l!==0&&(x!==0||u!==0||p!==0)){const S=m(l),_=qe();jn(_,[x,u,p],S),zt(h,_)}const v=new Float64Array(3);P(v,[0,0,-1],h);const E=new Float64Array(3);P(E,[0,1,0],h),t.setDirectionOfProjection(...v),t.setViewUp(...E),t.modified()},t.computeClippingRange=l=>{let x=null,u=null;x=e.viewPlaneNormal,u=e.position;const p=-x[0],h=-x[1],v=-x[2],E=-(p*u[0]+h*u[1]+v*u[2]),S=[p*l[0]+h*l[2]+v*l[4]+E,1e-18];for(let _=0;_<2;_++)for(let d=0;d<2;d++)for(let L=0;L<2;L++){const M=p*l[L]+h*l[2+d]+v*l[4+_]+E;S[0]=M<S[0]?M:S[0],S[1]=M>S[1]?M:S[1]}return S}}var $i={position:[0,0,1],focalPoint:[0,0,0],viewUp:[0,1,0],directionOfProjection:[0,0,-1],parallelProjection:!1,useHorizontalViewAngle:!1,viewAngle:30,parallelScale:1,clippingRange:[.01,1000.01],windowCenter:[0,0],viewPlaneNormal:[0,0,1],useOffAxisProjection:!1,screenBottomLeft:[-.5,-.5,-.5],screenBottomRight:[.5,-.5,-.5],screenTopRight:[.5,.5,-.5],freezeFocalPoint:!1,projectionMatrix:null,viewMatrix:null,modelTransformMatrix:null,cameraLightTransform:$n(),physicalTranslation:[0,0,0],physicalScale:1,physicalViewUp:[0,1,0],physicalViewNorth:[0,0,-1]};function sa(t,e,n={}){Object.assign(e,$i,n),C.obj(t,e),C.get(t,e,["distance"]),C.setGet(t,e,["parallelProjection","useHorizontalViewAngle","viewAngle","parallelScale","useOffAxisProjection","freezeFocalPoint","physicalScale","modelTransformMatrix"]),C.getArray(t,e,["directionOfProjection","viewPlaneNormal","position","focalPoint"]),C.setGetArray(t,e,["clippingRange","windowCenter"],2),C.setGetArray(t,e,["viewUp","screenBottomLeft","screenBottomRight","screenTopRight","physicalTranslation","physicalViewUp","physicalViewNorth"],3),ki(t,e)}var Wi=C.newInstance(sa,"vtkCamera"),Hi={newInstance:Wi,extend:sa},zi={MAGNITUDE:0,COMPONENT:1,RGBCOLORS:2},Dn={LUMINANCE:1,LUMINANCE_ALPHA:2,RGB:3,RGBA:4},ji={LINEAR:0,LOG10:1},Xn={VectorMode:zi,ScalarMappingTarget:Dn,Scale:ji},Xi={DEFAULT:0,MAP_SCALARS:1,DIRECT_SCALARS:2},Ki={DEFAULT:0,USE_POINT_DATA:1,USE_CELL_DATA:2,USE_POINT_FIELD_DATA:3,USE_CELL_FIELD_DATA:4,USE_FIELD_DATA:5},Yi={BY_ID:0,BY_NAME:1},Kn={ColorMode:Xi,GetArray:Yi,ScalarMode:Ki},{ScalarMappingTarget:pr,Scale:Zi,VectorMode:ve}=Xn,{VtkDataTypes:De}=ne,{ColorMode:Ot}=Kn,{vtkErrorMacro:Tr}=C;function Qi(t){return t}function vr(t){return Math.floor(t*255+.5)}function Ji(t,e){e.classHierarchy.push("vtkScalarsToColors"),t.setVectorModeToMagnitude=()=>t.setVectorMode(ve.MAGNITUDE),t.setVectorModeToComponent=()=>t.setVectorMode(ve.COMPONENT),t.setVectorModeToRGBColors=()=>t.setVectorMode(ve.RGBCOLORS),t.build=()=>{},t.isOpaque=()=>!0,t.setAnnotations=(n,r)=>{if(!(n&&!r||!n&&r)){if(n&&r&&n.length!==r.length){Tr("Values and annotations do not have the same number of tuples so ignoring");return}if(e.annotationArray=[],r&&n){const s=r.length;for(let a=0;a<s;a++)e.annotationArray.push({value:n[a],annotation:String(r[a])})}t.updateAnnotatedValueMap(),t.modified()}},t.setAnnotation=(n,r)=>{let s=t.checkForAnnotatedValue(n),a=!1;return s>=0?e.annotationArray[s].annotation!==r&&(e.annotationArray[s].annotation=r,a=!0):(e.annotationArray.push({value:n,annotation:r}),s=e.annotationArray.length-1,a=!0),a&&(t.updateAnnotatedValueMap(),t.modified()),s},t.getNumberOfAnnotatedValues=()=>e.annotationArray.length,t.getAnnotatedValue=n=>n<0||n>=e.annotationArray.length?null:e.annotationArray[n].value,t.getAnnotation=n=>e.annotationArray[n]===void 0?null:e.annotationArray[n].annotation,t.getAnnotatedValueIndex=n=>e.annotationArray.length?t.checkForAnnotatedValue(n):-1,t.removeAnnotation=n=>{const r=t.checkForAnnotatedValue(n),s=r>=0;return s&&(e.annotationArray.splice(r,1),t.updateAnnotatedValueMap(),t.modified()),s},t.resetAnnotations=()=>{e.annotationArray=[],e.annotatedValueMap=[],t.modified()},t.getAnnotationColor=(n,r)=>{if(e.indexedLookup){const s=t.getAnnotatedValueIndex(n);t.getIndexedColor(s,r)}else t.getColor(parseFloat(n),r),r[3]=1},t.checkForAnnotatedValue=n=>t.getAnnotatedValueIndexInternal(n),t.getAnnotatedValueIndexInternal=n=>{if(e.annotatedValueMap[n]!==void 0){const r=e.annotationArray.length;return e.annotatedValueMap[n]%r}return-1},t.getIndexedColor=(n,r)=>{r[0]=0,r[1]=0,r[2]=0,r[3]=0},t.updateAnnotatedValueMap=()=>{e.annotatedValueMap=[];const n=e.annotationArray.length;for(let r=0;r<n;r++)e.annotatedValueMap[e.annotationArray[r].value]=r},t.mapScalars=(n,r,s)=>{const a=n.getNumberOfComponents();let i=null;if(r===Ot.DEFAULT&&(n.getDataType()===De.UNSIGNED_CHAR||n.getDataType()===De.UNSIGNED_CHAR_CLAMPED)||r===Ot.DIRECT_SCALARS&&n)i=t.convertToRGBA(n,a,n.getNumberOfTuples());else{const o={type:"vtkDataArray",name:"temp",numberOfComponents:4,dataType:De.UNSIGNED_CHAR},c=C.newTypedArray(o.dataType,4*n.getNumberOfTuples());o.values=c,o.size=c.length,i=ne.newInstance(o);let g=s;g<0&&a>1?t.mapVectorsThroughTable(n,i,pr.RGBA,-1,-1):(g<0&&(g=0),g>=a&&(g=a-1),t.mapScalarsThroughTable(n,i,pr.RGBA,g))}return i},t.mapVectorsToMagnitude=(n,r,s)=>{const a=n.getNumberOfTuples(),i=n.getNumberOfComponents(),o=r.getData(),c=n.getData();for(let g=0;g<a;g++){let T=0;for(let f=0;f<s;f++)T+=c[g*i+f]*c[g*i+f];o[g]=Math.sqrt(T)}},t.mapVectorsThroughTable=(n,r,s,a,i)=>{let o=t.getVectorMode(),c=i,g=a;const T=n.getNumberOfComponents();o===ve.COMPONENT?(g===-1&&(g=t.getVectorComponent()),g<0&&(g=0),g>=T&&(g=T-1)):(c===-1&&(c=t.getVectorSize()),c<=0?(g=0,c=T):(g<0&&(g=0),g>=T&&(g=T-1),g+c>T&&(c=T-g)),o===ve.MAGNITUDE&&(T===1||c===1)&&(o=ve.COMPONENT));let f=0;switch(g>0&&(f=g),o){case ve.COMPONENT:t.mapScalarsThroughTable(n,r,s,f);break;case ve.RGBCOLORS:break;case ve.MAGNITUDE:default:{const y=ne.newInstance({numberOfComponents:1,values:new Float32Array(n.getNumberOfTuples())});t.mapVectorsToMagnitude(n,y,c),t.mapScalarsThroughTable(y,r,s,0);break}}},t.luminanceToRGBA=(n,r,s,a)=>{const i=a(s),o=r.getData(),c=n.getData(),g=o.length,T=0,f=1;let y=0;for(let w=T;w<g;w+=f){const R=a(o[w]);c[y*4]=R,c[y*4+1]=R,c[y*4+2]=R,c[y*4+3]=i,y++}},t.luminanceAlphaToRGBA=(n,r,s,a)=>{const i=r.getData(),o=n.getData(),c=i.length,g=0,T=2;let f=0;for(let y=g;y<c;y+=T){const w=a(i[y]);o[f]=w,o[f+1]=w,o[f+2]=w,o[f+3]=a(i[y+1])*s,f+=4}},t.rGBToRGBA=(n,r,s,a)=>{const i=vr(s),o=r.getData(),c=n.getData(),g=o.length,T=0,f=3;let y=0;for(let w=T;w<g;w+=f)c[y*4]=a(o[w]),c[y*4+1]=a(o[w+1]),c[y*4+2]=a(o[w+2]),c[y*4+3]=i,y++},t.rGBAToRGBA=(n,r,s,a)=>{const i=r.getData(),o=n.getData(),c=i.length,g=0,T=4;let f=0;for(let y=g;y<c;y+=T)o[f*4]=a(i[y]),o[f*4+1]=a(i[y+1]),o[f*4+2]=a(i[y+2]),o[f*4+3]=a(i[y+3])*s,f++},t.convertToRGBA=(n,r,s)=>{let{alpha:a}=e;if(r===4&&a>=1&&n.getDataType()===De.UNSIGNED_CHAR)return n;const i=ne.newInstance({numberOfComponents:4,empty:!0,size:4*s,dataType:De.UNSIGNED_CHAR});if(s<=0)return i;a=a>0?a:0,a=a<1?a:1;let o=Qi;switch((n.getDataType()===De.FLOAT||n.getDataType()===De.DOUBLE)&&(o=vr),r){case 1:t.luminanceToRGBA(i,n,a,o);break;case 2:t.luminanceAlphaToRGBA(i,n,o);break;case 3:t.rGBToRGBA(i,n,a,o);break;case 4:t.rGBAToRGBA(i,n,a,o);break;default:return Tr("Cannot convert colors"),null}return i},t.usingLogScale=()=>!1,t.getNumberOfAvailableColors=()=>256*256*256,t.setRange=(n,r)=>t.setMappingRange(n,r),t.getRange=()=>t.getMappingRange(),t.areScalarsOpaque=(n,r,s)=>{if(!n)return t.isOpaque();const a=n.getNumberOfComponents();return r===Ot.DEFAULT&&n.getDataType()===De.UNSIGNED_CHAR||r===Ot.DIRECT_SCALARS?a===3||a===1?e.alpha>=1:n.getRange(a-1)[0]===255:!0}}var qi={alpha:1,vectorComponent:0,vectorSize:-1,vectorMode:ve.COMPONENT,mappingRange:null,annotationArray:null,annotatedValueMap:null,indexedLookup:!1,scale:Zi.LINEAR};function ia(t,e,n={}){Object.assign(e,qi,n),C.obj(t,e),e.mappingRange=[0,255],e.annotationArray=[],e.annotatedValueMap=[],C.setGet(t,e,["vectorSize","vectorComponent","vectorMode","alpha","indexedLookup"]),C.setArray(t,e,["mappingRange"],2),C.getArray(t,e,["mappingRange"]),Ji(t,e)}var Ai=C.newInstance(ia,"vtkScalarsToColors"),Yn={newInstance:Ai,extend:ia,...Xn},bi={RGB:0,HSV:1,LAB:2,DIVERGING:3},Ii={LINEAR:0,LOG10:1},oa={ColorSpace:bi,Scale:Ii},{ColorSpace:ge,Scale:Zn}=oa,{ScalarMappingTarget:Dt}=Yn,{vtkDebugMacro:mi,vtkErrorMacro:le,vtkWarningMacro:Pi}=C;function yr(t,e){const n=t[0],r=t[1],s=t[2],a=Math.sqrt(n*n+r*r+s*s),i=a>.001?Math.acos(n/a):0,o=i>.001?Math.atan2(s,r):0;e[0]=a,e[1]=i,e[2]=o}function eo(t,e){const n=t[0],r=t[1],s=t[2];e[0]=n*Math.cos(r),e[1]=n*Math.sin(r)*Math.cos(s),e[2]=n*Math.sin(r)*Math.sin(s)}function lr(t,e){if(t[0]>=e-.1)return t[2];const n=t[1]*Math.sqrt(e*e-t[0]*t[0])/(t[0]*Math.sin(t[1]));return t[2]>-.3*Math.PI?t[2]+n:t[2]-n}function to(t,e){let n=t-e;for(n<0&&(n=-n);n>=2*Math.PI;)n-=2*Math.PI;return n>Math.PI&&(n=2*Math.PI-n),n}function xr(t,e,n,r){const s=[],a=[];nt(e,s),nt(n,a);const i=[],o=[];yr(s,i),yr(a,o);let c=t;if(i[1]>.05&&o[1]>.05&&to(i[2],o[2])>.33*Math.PI){let f=Math.max(i[0],o[0]);f=Math.max(88,f),t<.5?(o[0]=f,o[1]=0,o[2]=0,c*=2):(i[0]=f,i[1]=0,i[2]=0,c=2*c-1)}i[1]<.05&&o[1]>.05?i[2]=lr(o,i[0]):o[1]<.05&&i[1]>.05&&(o[2]=lr(i,o[0]));const g=[];g[0]=(1-c)*i[0]+c*o[0],g[1]=(1-c)*i[1]+c*o[1],g[2]=(1-c)*i[2]+c*o[2];const T=[];eo(g,T),Mn(T,r)}function no(t,e){e.classHierarchy.push("vtkColorTransferFunction"),t.getSize=()=>e.nodes.length,t.addRGBPoint=(n,r,s,a)=>t.addRGBPointLong(n,r,s,a,.5,0),t.addRGBPointLong=(n,r,s,a,i=.5,o=0)=>{if(i<0||i>1)return le("Midpoint outside range [0.0, 1.0]"),-1;if(o<0||o>1)return le("Sharpness outside range [0.0, 1.0]"),-1;e.allowDuplicateScalars||t.removePoint(n);const c={x:n,r,g:s,b:a,midpoint:i,sharpness:o};e.nodes.push(c),t.sortAndUpdateRange();let g=0;for(;g<e.nodes.length&&e.nodes[g].x!==n;g++);return g<e.nodes.length?g:-1},t.addHSVPoint=(n,r,s,a)=>t.addHSVPointLong(n,r,s,a,.5,0),t.addHSVPointLong=(n,r,s,a,i=.5,o=0)=>{const c=[];return tt([r,s,a],c),t.addRGBPoint(n,c[0],c[1],c[2],i,o)},t.setNodes=n=>{if(e.nodes!==n){const r=JSON.stringify(e.nodes);e.nodes=n;const s=JSON.stringify(e.nodes);if(t.sortAndUpdateRange()||r!==s)return t.modified(),!0}return!1},t.sortAndUpdateRange=()=>{const n=JSON.stringify(e.nodes);e.nodes.sort((a,i)=>a.x-i.x);const r=JSON.stringify(e.nodes),s=t.updateRange();return!s&&n!==r?(t.modified(),!0):s},t.updateRange=()=>{const n=[2];n[0]=e.mappingRange[0],n[1]=e.mappingRange[1];const r=e.nodes.length;return r?(e.mappingRange[0]=e.nodes[0].x,e.mappingRange[1]=e.nodes[r-1].x):(e.mappingRange[0]=0,e.mappingRange[1]=0),n[0]===e.mappingRange[0]&&n[1]===e.mappingRange[1]?!1:(t.modified(),!0)},t.removePoint=n=>{let r=0;for(;r<e.nodes.length&&e.nodes[r].x!==n;r++);const s=r;if(r>=e.nodes.length)return-1;let a=!1;return e.nodes.splice(r,1),(r===0||r===e.nodes.length)&&(a=t.updateRange()),a||t.modified(),s},t.movePoint=(n,r)=>{if(n!==r){t.removePoint(r);for(let s=0;s<e.nodes.length;s++)if(e.nodes[s].x===n){e.nodes[s].x=r,t.sortAndUpdateRange();break}}},t.removeAllPoints=()=>{e.nodes=[],t.sortAndUpdateRange()},t.addRGBSegment=(n,r,s,a,i,o,c,g)=>{t.sortAndUpdateRange();for(let T=0;T<e.nodes.length;)e.nodes[T].x>=n&&e.nodes[T].x<=i?e.nodes.splice(T,1):T++;t.addRGBPointLong(n,r,s,a,.5,0),t.addRGBPointLong(i,o,c,g,.5,0),t.modified()},t.addHSVSegment=(n,r,s,a,i,o,c,g)=>{const T=[r,s,a],f=[o,c,g],y=[],w=[];tt(T,y),tt(f,w),t.addRGBSegment(n,y[0],y[1],y[2],i,w[0],w[1],w[2])},t.mapValue=n=>{const r=[];return t.getColor(n,r),[Math.floor(255*r[0]+.5),Math.floor(255*r[1]+.5),Math.floor(255*r[2]+.5),255]},t.getColor=(n,r)=>{if(e.indexedLookup){const s=t.getSize(),a=t.getAnnotatedValueIndexInternal(n);if(a<0||s===0){const i=t.getNanColorByReference();r[0]=i[0],r[1]=i[1],r[2]=i[2]}else{const i=[];t.getNodeValue(a%s,i),r[0]=i[1],r[1]=i[2],r[2]=i[3]}return}t.getTable(n,n,1,r)},t.getRedValue=n=>{const r=[];return t.getColor(n,r),r[0]},t.getGreenValue=n=>{const r=[];return t.getColor(n,r),r[1]},t.getBlueValue=n=>{const r=[];return t.getColor(n,r),r[2]},t.logScaleEnabled=()=>e.scale===Zn.LOG10,t.usingLogScale=()=>t.logScaleEnabled()&&e.mappingRange[0]>0,t.getTable=(n,r,s,a)=>{const i=t.usingLogScale(),o=i?Math.log10(Number(n)):Number(n),c=i?Math.log10(Number(r)):Number(r);if(mt(o)||mt(c)){for(let _=0;_<s;_++)a[_*3+0]=e.nanColor[0],a[_*3+1]=e.nanColor[1],a[_*3+2]=e.nanColor[2];return}let g=0;const T=e.nodes.length;let f=0,y=0,w=0;T!==0&&(f=e.nodes[T-1].r,y=e.nodes[T-1].g,w=e.nodes[T-1].b);let R=0,l=0,x=0;const u=[0,0,0],p=[0,0,0];let h=0,v=0;const E=[];let S=e.mappingRange;i&&(S=[Math.log10(e.mappingRange[0]),Math.log10(e.mappingRange[1])]);for(let _=0;_<s;_++){const d=3*_;if(s>1?R=o+_/(s-1)*(c-o):R=.5*(o+c),e.discretize){const L=S;if(R>=L[0]&&R<=L[1]){const M=e.numberOfValues,D=L[1]-L[0];if(M<=1)R=L[0]+D/2;else{const F=mr(M*((R-L[0])/D));R=L[0]+F/(M-1)*D}}}for(;g<T&&R>e.nodes[g].x;)g++,g<T&&(l=e.nodes[g-1].x,x=e.nodes[g].x,u[0]=e.nodes[g-1].r,p[0]=e.nodes[g].r,u[1]=e.nodes[g-1].g,p[1]=e.nodes[g].g,u[2]=e.nodes[g-1].b,p[2]=e.nodes[g].b,h=e.nodes[g-1].midpoint,v=e.nodes[g-1].sharpness,h<1e-5&&(h=1e-5),h>.99999&&(h=.99999));if(R>S[1])a[d]=0,a[d+1]=0,a[d+2]=0,e.clamping&&(t.getUseAboveRangeColor()?(a[d]=e.aboveRangeColor[0],a[d+1]=e.aboveRangeColor[1],a[d+2]=e.aboveRangeColor[2]):(a[d]=f,a[d+1]=y,a[d+2]=w));else if(R<S[0]||gi(R)&&R<0)a[d]=0,a[d+1]=0,a[d+2]=0,e.clamping&&(t.getUseBelowRangeColor()?(a[d]=e.belowRangeColor[0],a[d+1]=e.belowRangeColor[1],a[d+2]=e.belowRangeColor[2]):T>0&&(a[d]=e.nodes[0].r,a[d+1]=e.nodes[0].g,a[d+2]=e.nodes[0].b));else if(g===0&&(Math.abs(R-o)<1e-6||e.discretize))T>0?(a[d]=e.nodes[0].r,a[d+1]=e.nodes[0].g,a[d+2]=e.nodes[0].b):(a[d]=0,a[d+1]=0,a[d+2]=0);else{let L=0;if(L=(R-l)/(x-l),L<h?L=.5*L/h:L=.5+.5*(L-h)/(1-h),v>.99)if(L<.5){a[d]=u[0],a[d+1]=u[1],a[d+2]=u[2];continue}else{a[d]=p[0],a[d+1]=p[1],a[d+2]=p[2];continue}if(v<.01){if(e.colorSpace===ge.RGB)a[d]=(1-L)*u[0]+L*p[0],a[d+1]=(1-L)*u[1]+L*p[1],a[d+2]=(1-L)*u[2]+L*p[2];else if(e.colorSpace===ge.HSV){const G=[],O=[];dt(u,G),dt(p,O),e.hSVWrap&&(G[0]-O[0]>.5||O[0]-G[0]>.5)&&(G[0]>O[0]?G[0]-=1:O[0]-=1);const B=[];B[0]=(1-L)*G[0]+L*O[0],B[0]<0&&(B[0]+=1),B[1]=(1-L)*G[1]+L*O[1],B[2]=(1-L)*G[2]+L*O[2],tt(B,E),a[d]=E[0],a[d+1]=E[1],a[d+2]=E[2]}else if(e.colorSpace===ge.LAB){const G=[],O=[];nt(u,G),nt(p,O);const B=[];B[0]=(1-L)*G[0]+L*O[0],B[1]=(1-L)*G[1]+L*O[1],B[2]=(1-L)*G[2]+L*O[2],Mn(B,E),a[d]=E[0],a[d+1]=E[1],a[d+2]=E[2]}else e.colorSpace===ge.DIVERGING?(xr(L,u,p,E),a[d]=E[0],a[d+1]=E[1],a[d+2]=E[2]):le("ColorSpace set to invalid value.",e.colorSpace);continue}L<.5?L=.5*(L*2)**(1+10*v):L>.5&&(L=1-.5*((1-L)*2)**(1+10*v));const M=L*L,D=M*L,F=2*D-3*M+1,N=-2*D+3*M,U=D-2*M+L,W=D-M;let V,z;if(e.colorSpace===ge.RGB)for(let G=0;G<3;G++)V=p[G]-u[G],z=(1-v)*V,a[d+G]=F*u[G]+N*p[G]+U*z+W*z;else if(e.colorSpace===ge.HSV){const G=[],O=[];dt(u,G),dt(p,O),e.hSVWrap&&(G[0]-O[0]>.5||O[0]-G[0]>.5)&&(G[0]>O[0]?G[0]-=1:O[0]-=1);const B=[];for(let k=0;k<3;k++)V=O[k]-G[k],z=(1-v)*V,B[k]=F*G[k]+N*O[k]+U*z+W*z,k===0&&B[k]<0&&(B[k]+=1);tt(B,E),a[d]=E[0],a[d+1]=E[1],a[d+2]=E[2]}else if(e.colorSpace===ge.LAB){const G=[],O=[];nt(u,G),nt(p,O);const B=[];for(let k=0;k<3;k++)V=O[k]-G[k],z=(1-v)*V,B[k]=F*G[k]+N*O[k]+U*z+W*z;Mn(B,E),a[d]=E[0],a[d+1]=E[1],a[d+2]=E[2]}else e.colorSpace===ge.DIVERGING?(xr(L,u,p,E),a[d]=E[0],a[d+1]=E[1],a[d+2]=E[2]):le("ColorSpace set to invalid value.");for(let G=0;G<3;G++)a[d+G]=a[d+G]<0?0:a[d+G],a[d+G]=a[d+G]>1?1:a[d+G]}}},t.getUint8Table=(n,r,s,a=!1)=>{if(t.getMTime()<=e.buildTime&&e.tableSize===s&&e.tableWithAlpha!==a)return e.table;if(e.nodes.length===0)return le("Attempting to lookup a value with no points in the function"),e.table;const i=a?4:3;(e.tableSize!==s||e.tableWithAlpha!==a)&&(e.table=new Uint8Array(s*i),e.tableSize=s,e.tableWithAlpha=a);const o=[];t.getTable(n,r,s,o);for(let c=0;c<s;c++)e.table[c*i+0]=Math.floor(o[c*3+0]*255+.5),e.table[c*i+1]=Math.floor(o[c*3+1]*255+.5),e.table[c*i+2]=Math.floor(o[c*3+2]*255+.5),a&&(e.table[c*i+3]=255);return e.buildTime.modified(),e.table},t.buildFunctionFromArray=n=>{t.removeAllPoints();const r=n.getNumberOfComponents();for(let s=0;s<n.getNumberOfTuples();s++)switch(r){case 3:e.nodes.push({x:s,r:n.getComponent(s,0),g:n.getComponent(s,1),b:n.getComponent(s,2),midpoint:.5,sharpness:0});break;case 4:e.nodes.push({x:n.getComponent(s,0),r:n.getComponent(s,1),g:n.getComponent(s,2),b:n.getComponent(s,3),midpoint:.5,sharpness:0});break;case 5:e.nodes.push({x:s,r:n.getComponent(s,0),g:n.getComponent(s,1),b:n.getComponent(s,2),midpoint:n.getComponent(s,4),sharpness:n.getComponent(s,5)});break;case 6:e.nodes.push({x:n.getComponent(s,0),r:n.getComponent(s,1),g:n.getComponent(s,2),b:n.getComponent(s,3),midpoint:n.getComponent(s,4),sharpness:n.getComponent(s,5)});break}t.sortAndUpdateRange()},t.buildFunctionFromTable=(n,r,s,a)=>{let i=0;t.removeAllPoints(),s>1&&(i=(r-n)/(s-1));for(let o=0;o<s;o++){const c={x:n+i*o,r:a[o*3],g:a[o*3+1],b:a[o*3+2],sharpness:0,midpoint:.5};e.nodes.push(c)}t.sortAndUpdateRange()},t.getNodeValue=(n,r)=>n<0||n>=e.nodes.length?(le("Index out of range!"),-1):(r[0]=e.nodes[n].x,r[1]=e.nodes[n].r,r[2]=e.nodes[n].g,r[3]=e.nodes[n].b,r[4]=e.nodes[n].midpoint,r[5]=e.nodes[n].sharpness,1),t.setNodeValue=(n,r)=>{if(n<0||n>=e.nodes.length)return le("Index out of range!"),-1;const s=e.nodes[n].x;return e.nodes[n].x=r[0],e.nodes[n].r=r[1],e.nodes[n].g=r[2],e.nodes[n].b=r[3],e.nodes[n].midpoint=r[4],e.nodes[n].sharpness=r[5],s!==r[0]?t.sortAndUpdateRange():t.modified(),1},t.getNumberOfAvailableColors=()=>{if(e.indexedLookup&&t.getSize())return t.getSize();if(e.tableSize)return e.tableSize;const n=e.nodes?.length??0;return Math.max(4094,n)},t.getIndexedColor=(n,r)=>{const s=t.getSize();if(s>0&&n>=0){const i=[];t.getNodeValue(n%s,i);for(let o=0;o<3;++o)r[o]=i[o+1];r[3]=1;return}const a=t.getNanColorByReference();r[0]=a[0],r[1]=a[1],r[2]=a[2],r[3]=1},t.fillFromDataPointer=(n,r)=>{if(!(n<=0||!r)){t.removeAllPoints();for(let s=0;s<n;s++)t.addRGBPoint(r[s*4],r[s*4+1],r[s*4+2],r[s*4+3])}},t.setMappingRange=(n,r)=>{const s=[n,r],a=[n,r],i=t.getRange(),o=t.logScaleEnabled();if(i[1]===s[1]&&i[0]===s[0])return;if(s[1]===s[0]){le("attempt to set zero width color range");return}o&&(s[0]<=0?console.warn("attempt to set log scale color range with non-positive minimum"):(a[0]=Math.log10(s[0]),a[1]=Math.log10(s[1])));const c=(a[1]-a[0])/(i[1]-i[0]),g=a[0]-i[0]*c;for(let T=0;T<e.nodes.length;++T)e.nodes[T].x=e.nodes[T].x*c+g;e.mappingRange[0]=s[0],e.mappingRange[1]=s[1],t.modified()},t.adjustRange=n=>{const r=t.getRange(),s=[];r[0]<n[0]?(t.getColor(n[0],s),t.addRGBPoint(n[0],s[0],s[1],s[2])):(t.getColor(r[0],s),t.addRGBPoint(n[0],s[0],s[1],s[2])),r[1]>n[1]?(t.getColor(n[1],s),t.addRGBPoint(n[1],s[0],s[1],s[2])):(t.getColor(r[1],s),t.addRGBPoint(n[1],s[0],s[1],s[2])),t.sortAndUpdateRange();for(let a=0;a<e.nodes.length;)e.nodes[a].x>=n[0]&&e.nodes[a].x<=n[1]?e.nodes.splice(a,1):++a;return 1},t.estimateMinNumberOfSamples=(n,r)=>{const s=t.findMinimumXDistance();return Math.ceil((r-n)/s)},t.findMinimumXDistance=()=>{if(e.nodes.length<2)return-1;let n=Number.MAX_VALUE;for(let r=0;r<e.nodes.length-1;r++){const s=e.nodes[r+1].x-e.nodes[r].x;s<n&&(n=s)}return n},t.mapScalarsThroughTable=(n,r,s,a)=>{if(t.getSize()===0){mi("Transfer Function Has No Points!");return}e.indexedLookup?t.mapDataIndexed(n,r,s,a):t.mapData(n,r,s,a)},t.mapData=(n,r,s,a)=>{if(t.getSize()===0){Pi("Transfer Function Has No Points!");return}const i=Math.floor(t.getAlpha()*255+.5),o=n.getNumberOfTuples(),c=n.getNumberOfComponents(),g=r.getData(),T=n.getData(),f=[];if(s===Dt.RGBA)for(let y=0;y<o;y++){const w=T[y*c+a];t.getColor(w,f),g[y*4]=Math.floor(f[0]*255+.5),g[y*4+1]=Math.floor(f[1]*255+.5),g[y*4+2]=Math.floor(f[2]*255+.5),g[y*4+3]=i}if(s===Dt.RGB)for(let y=0;y<o;y++){const w=T[y*c+a];t.getColor(w,f),g[y*3]=Math.floor(f[0]*255+.5),g[y*3+1]=Math.floor(f[1]*255+.5),g[y*3+2]=Math.floor(f[2]*255+.5)}if(s===Dt.LUMINANCE)for(let y=0;y<o;y++){const w=T[y*c+a];t.getColor(w,f),g[y]=Math.floor(f[0]*76.5+f[1]*150.45+f[2]*28.05+.5)}if(s===Dt.LUMINANCE_ALPHA)for(let y=0;y<o;y++){const w=T[y*c+a];t.getColor(w,f),g[y*2]=Math.floor(f[0]*76.5+f[1]*150.45+f[2]*28.05+.5),g[y*2+1]=i}},t.applyColorMap=n=>{const r=JSON.stringify(e.colorSpace);n.ColorSpace&&(e.colorSpace=ge[n.ColorSpace.toUpperCase()],e.colorSpace===void 0&&(le(`ColorSpace ${n.ColorSpace} not supported, using RGB instead`),e.colorSpace=ge.RGB));let s=r!==JSON.stringify(e.colorSpace);const a=s||JSON.stringify(e.nanColor);if(n.NanColor)for(e.nanColor=[].concat(n.NanColor);e.nanColor.length<4;)e.nanColor.push(1);s=s||a!==JSON.stringify(e.nanColor);const i=s||JSON.stringify(e.nodes);if(n.RGBPoints){const g=n.RGBPoints.length;e.nodes=[];const T=.5,f=0;for(let y=0;y<g;y+=4)e.nodes.push({x:n.RGBPoints[y],r:n.RGBPoints[y+1],g:n.RGBPoints[y+2],b:n.RGBPoints[y+3],midpoint:T,sharpness:f})}const o=t.sortAndUpdateRange(),c=!o&&(s||i!==JSON.stringify(e.nodes));return c&&t.modified(),o||c}}var ro={clamping:!0,colorSpace:ge.RGB,hSVWrap:!0,scale:Zn.LINEAR,nanColor:null,belowRangeColor:null,aboveRangeColor:null,useAboveRangeColor:!1,useBelowRangeColor:!1,allowDuplicateScalars:!1,table:null,tableSize:0,buildTime:null,nodes:null,discretize:!1,numberOfValues:256};function fa(t,e,n={}){Object.assign(e,ro,n),Yn.extend(t,e,n),e.table=[],e.nodes=[],e.nanColor=[.5,0,0,1],e.belowRangeColor=[0,0,0,1],e.aboveRangeColor=[1,1,1,1],e.buildTime={},C.obj(e.buildTime),C.get(t,e,["buildTime","mappingRange"]),C.setGet(t,e,["useAboveRangeColor","useBelowRangeColor","discretize","numberOfValues",{type:"enum",name:"colorSpace",enum:ge},{type:"enum",name:"scale",enum:Zn}]),C.setArray(t,e,["nanColor","belowRangeColor","aboveRangeColor"],4),C.getArray(t,e,["nanColor","belowRangeColor","aboveRangeColor"]),no(t,e)}var ao=C.newInstance(fa,"vtkColorTransferFunction"),so={newInstance:ao,extend:fa,...oa},be={Off:0,PolygonOffset:1},Fn=be.PolygonOffset,Pt=be.Off,io=["VTK_RESOLVE_OFF","VTK_RESOLVE_POLYGON_OFFSET"];function oo(){return Fn}function fo(t){const e=Fn===t;return Fn=t,e}function co(){return Pt}function an(t=0){const e=Pt===t;return Pt=t,e}function uo(){return an(be.Off)}function go(){return an(be.Off)}function ho(){return an(be.PolygonOffset)}function po(){return io[Pt]}var Bn={Resolve:be,getResolveCoincidentTopologyAsString:po,getResolveCoincidentTopologyPolygonOffsetFaces:oo,getResolveCoincidentTopology:co,setResolveCoincidentTopology:an,setResolveCoincidentTopologyPolygonOffsetFaces:fo,setResolveCoincidentTopologyToDefault:uo,setResolveCoincidentTopologyToOff:go,setResolveCoincidentTopologyToPolygonOffset:ho};function ca(t,e,n){n.forEach(r=>{t[`get${r.method}`]=()=>e[r.key],t[`set${r.method}`]=C.objectSetterMap.object(t,e,{name:r.key,params:["factor","offset"]})})}var Qn=["Polygon","Line","Point"],To={Polygon:{factor:2,offset:0},Line:{factor:1,offset:-1},Point:{factor:0,offset:-2}},vo=()=>{},Ye={modified:vo};ca(Ye,To,Qn.map(t=>({key:t,method:`ResolveCoincidentTopology${t}OffsetParameters`})));function yo(t,e){e.resolveCoincidentTopology===void 0&&(e.resolveCoincidentTopology=!1),C.setGet(t,e,["resolveCoincidentTopology"]),e.topologyOffset={Polygon:{factor:0,offset:0},Line:{factor:0,offset:0},Point:{factor:0,offset:0}},Object.keys(Bn).forEach(n=>{t[n]=Bn[n]}),Object.keys(Ye).filter(n=>n!=="modified").forEach(n=>{t[n]=Ye[n]}),ca(t,e.topologyOffset,Qn.map(n=>({key:n,method:`RelativeCoincidentTopology${n}OffsetParameters`}))),t.getCoincidentTopologyPolygonOffsetParameters=()=>{const n=Ye.getResolveCoincidentTopologyPolygonOffsetParameters(),r=t.getRelativeCoincidentTopologyPolygonOffsetParameters();return{factor:n.factor+r.factor,offset:n.offset+r.offset}},t.getCoincidentTopologyLineOffsetParameters=()=>{const n=Ye.getResolveCoincidentTopologyLineOffsetParameters(),r=t.getRelativeCoincidentTopologyLineOffsetParameters();return{factor:n.factor+r.factor,offset:n.offset+r.offset}},t.getCoincidentTopologyPointOffsetParameter=()=>{const n=Ye.getResolveCoincidentTopologyPointOffsetParameters(),r=t.getRelativeCoincidentTopologyPointOffsetParameters();return{factor:n.factor+r.factor,offset:n.offset+r.offset}}}var sn={implementCoincidentTopologyMethods:yo,staticOffsetAPI:Ye,otherStaticMethods:Bn,CATEGORIES:Qn,Resolve:be},lo={NONE:-1,I:0,J:1,K:2,X:3,Y:4,Z:5},ua={SlicingMode:lo},{vtkErrorMacro:Er}=C,Ft=new Float64Array(16),Bt=new Float64Array(4);function Sr(t,e){const n=t.getNormalByReference(),r=t.getOriginByReference();return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=-(n[0]*r[0]+n[1]*r[1]+n[2]*r[2]),e}function xo(t,e){e.classHierarchy.push("vtkAbstractMapper"),t.update=()=>{t.getInputData()},t.addClippingPlane=n=>n.isA("vtkPlane")?e.clippingPlanes.includes(n)?!1:(e.clippingPlanes.push(n),t.modified(),!0):!1,t.getNumberOfClippingPlanes=()=>e.clippingPlanes.length,t.removeAllClippingPlanes=()=>e.clippingPlanes.length===0?!1:(e.clippingPlanes.length=0,t.modified(),!0),t.removeClippingPlane=n=>{const r=e.clippingPlanes.indexOf(n);return r===-1?!1:(e.clippingPlanes.splice(r,1),t.modified(),!0)},t.getClippingPlanes=()=>e.clippingPlanes,t.getClippingPlanesMTime=()=>{let n=0;for(let r=0;r<e.clippingPlanes.length;r++)n=Math.max(n,e.clippingPlanes[r].getMTime());return n},t.setClippingPlanes=n=>{if(n)if(!Array.isArray(n))t.addClippingPlane(n);else{const r=n.length;for(let s=0;s<r&&s<6;s++)t.addClippingPlane(n[s])}},t.getClippingPlaneInCoords=(n,r,s)=>{if(r<0||r>=e.clippingPlanes?.length){Er(`Clipping plane index ${r} is out of range.`);return}const a=s||new Float64Array(4);return Sr(e.clippingPlanes[r],Bt),at(Ft,n),ce(Ft,Ft),Ke(a,Bt,Ft),a},t.getClippingPlaneInDataCoords=(n,r,s)=>{const a=e.clippingPlanes;if(a){const i=a.length;if(r>=0&&r<i){Sr(a[r],Bt),Ke(s,Bt,n);return}}Er(`Clipping plane index ${r} is out of range.`)}}var Eo={clippingPlanes:[]};function So(t,e,n={}){Object.assign(e,Eo,n),C.obj(t,e),C.algo(t,e,1,0),e.clippingPlanes||(e.clippingPlanes=[]),xo(t,e)}var Ro={extend:So};function Co(t,e){t.computeBounds=()=>{C.vtkErrorMacro("vtkAbstractMapper3D.computeBounds - NOT IMPLEMENTED")};const n=t.getBounds;t.getBounds=()=>(t.computeBounds(),n());const r=t.getBoundsByReference;t.getBoundsByReference=()=>(t.computeBounds(),r()),t.getCenter=()=>{const s=t.getBoundsByReference();return e.center=Y.isValid(s)?Y.getCenter(s):null,e.center?.slice()},t.getLength=()=>{const s=t.getBoundsByReference();return Y.getDiagonalLength(s)}}var wo=t=>({bounds:[...Y.INIT_BOUNDS],center:[0,0,0],viewSpecificProperties:{},...t});function _o(t,e,n={}){Object.assign(e,wo(n)),Ro.extend(t,e,n),C.setGet(t,e,["viewSpecificProperties"]),C.getArray(t,e,["bounds"],6),Co(t,e)}var Jn={extend:_o};function Lo(t,e){e.classHierarchy.push("vtkAbstractImageMapper"),t.getIsOpaque=()=>!0,t.getCurrentImage=()=>null,t.getBoundsForSlice=()=>(C.vtkErrorMacro("vtkAbstractImageMapper.getBoundsForSlice - NOT IMPLEMENTED"),Wn())}var Mo={slice:0,customDisplayExtent:[0,0,0,0,0,0],useCustomExtents:!1,backgroundColor:[0,0,0,1],colorTextureWidth:1024,opacityTextureWidth:1024,labelOutlineTextureWidth:1024};function Oo(t,e,n={}){Object.assign(e,Mo,n),Jn.extend(t,e,n),C.setGet(t,e,["slice","useCustomExtents","colorTextureWidth","opacityTextureWidth","labelOutlineTextureWidth"]),C.setGetArray(t,e,["customDisplayExtent"],6),C.setGetArray(t,e,["backgroundColor"],4),Lo(t,e)}var Do={extend:Oo};function ga(t,e,n){const r=n.getCurrentImage(),s=r.getExtent(),a=[s[0],s[2],s[4]],{ijkMode:i}=n.getClosestIJKAxis();let o=n.isA("vtkImageArrayMapper")?n.getSubSlice():n.getSlice();i!==n.getSlicingMode()&&(o=n.getSliceAtPosition(o)),a[i]+=o;const c=[0,0,0];r.indexToWorld(a,c),a[i]+=1;const g=[0,0,0];r.indexToWorld(a,g),g[0]-=c[0],g[1]-=c[1],g[2]-=c[2],At(g,g);const T=Je.intersectWithLine(t,e,c,g);if(T.intersection){const f=T.x,y=[0,0,0];return r.worldToIndex(f,y),{t:T.t,absoluteIJK:y}}return null}function Fo(t,e,n){const r=ga(t,e,n);if(r){const s=n.getCurrentImage().getExtent(),a=[Math.round(r.absoluteIJK[0]),Math.round(r.absoluteIJK[1]),Math.round(r.absoluteIJK[2])];return a[0]<s[0]||a[0]>s[1]||a[1]<s[2]||a[1]>s[3]||a[2]<s[4]||a[2]>s[5]?null:{t:r.t,ijk:a}}return null}function Bo(t,e,n){const r=ga(t,e,n);if(r){const s=n.getCurrentImage().getExtent(),a=r.absoluteIJK,i=[Math.floor(a[0]),Math.floor(a[1]),Math.floor(a[2])];if(i[0]<s[0]||i[0]>s[1]-1||i[1]<s[2]||i[1]>s[3]-1||i[2]<s[4]||i[2]>(s[5]?s[5]-1:s[5]))return null;const o=[a[0]-i[0],a[1]-i[1],a[2]-i[2]];return{t:r.t,ijk:i,pCoords:o}}return null}var{staticOffsetAPI:No,otherStaticMethods:Go}=sn,{SlicingMode:K}=ua;function Uo(t,e){e.classHierarchy.push("vtkImageMapper"),t.getSliceAtPosition=r=>{const s=t.getCurrentImage();let a;if(r.length===3)a=r;else if(Number.isFinite(r)){const T=s.getBounds();switch(e.slicingMode){case K.X:a=[r,(T[3]+T[2])/2,(T[5]+T[4])/2];break;case K.Y:a=[(T[1]+T[0])/2,r,(T[5]+T[4])/2];break;case K.Z:a=[(T[1]+T[0])/2,(T[3]+T[2])/2,r];break}}const i=[0,0,0];s.worldToIndex(a,i);const o=s.getExtent(),{ijkMode:c}=t.getClosestIJKAxis();let g=0;switch(c){case K.I:g=Qe(i[0],o[0],o[1]);break;case K.J:g=Qe(i[1],o[2],o[3]);break;case K.K:g=Qe(i[2],o[4],o[5]);break;default:return 0}return g},t.setSliceFromCamera=r=>{const s=r.getFocalPoint();switch(e.slicingMode){case K.I:case K.J:case K.K:{const a=t.getSliceAtPosition(s);t.setSlice(a)}break;case K.X:t.setSlice(s[0]);break;case K.Y:t.setSlice(s[1]);break;case K.Z:t.setSlice(s[2]);break}},t.setXSlice=r=>{t.setSlicingMode(K.X),t.setSlice(r)},t.setYSlice=r=>{t.setSlicingMode(K.Y),t.setSlice(r)},t.setZSlice=r=>{t.setSlicingMode(K.Z),t.setSlice(r)},t.setISlice=r=>{t.setSlicingMode(K.I),t.setSlice(r)},t.setJSlice=r=>{t.setSlicingMode(K.J),t.setSlice(r)},t.setKSlice=r=>{t.setSlicingMode(K.K),t.setSlice(r)},t.getSlicingModeNormal=()=>{const r=[0,0,0],s=t.getCurrentImage().getDirection();switch(e.slicingMode){case K.X:r[0]=1;break;case K.Y:r[1]=1;break;case K.Z:r[2]=1;break;case K.I:un(s,[1,0,0],r);break;case K.J:un(s,[0,1,0],r);break;case K.K:un(s,[0,0,1],r);break}return r};function n(){let r;switch(e.slicingMode){case K.X:r=0;break;case K.Y:r=1;break;case K.Z:r=2;break;default:e.closestIJKAxis={ijkMode:e.slicingMode,flip:!1};return}const s=hi(t.getCurrentImage().getDirection());let a=0;for(;a<3&&s[r+3*a]===0;++a);const i=s[r+3*a]<0;e.closestIJKAxis={ijkMode:a,flip:i}}t.setSlicingMode=r=>{e.slicingMode!==r&&(e.slicingMode=r,t.getCurrentImage()&&n(),t.modified())},t.getClosestIJKAxis=()=>((e.closestIJKAxis===void 0||e.closestIJKAxis.ijkMode===K.NONE)&&t.getCurrentImage()&&n(),e.closestIJKAxis),t.computeBounds=()=>{const r=t.getCurrentImage();if(!r){Y.reset(e.bounds);return}if(!e.useCustomExtents){Y.setBounds(e.bounds,r.getBounds());return}const s=e.customDisplayExtent.slice(),{ijkMode:a}=t.getClosestIJKAxis();let i=e.slice;switch(a!==e.slicingMode&&(i=t.getSliceAtPosition(e.slice)),a){case K.I:s[0]=i,s[1]=i;break;case K.J:s[2]=i,s[3]=i;break;case K.K:s[4]=i,s[5]=i;break}Y.setBounds(e.bounds,r.extentToBounds(s))},t.getBoundsForSlice=(r=e.slice,s=0)=>{const a=t.getCurrentImage();if(!a)return Wn();const i=a.getSpatialExtent(),{ijkMode:o}=t.getClosestIJKAxis();let c=r;switch(o!==e.slicingMode&&(c=t.getSliceAtPosition(r)),o){case K.I:i[0]=c-s,i[1]=c+s;break;case K.J:i[2]=c-s,i[3]=c+s;break;case K.K:i[4]=c-s,i[5]=c+s;break}return a.extentToBounds(i)},t.intersectWithLineForPointPicking=(r,s)=>Fo(r,s,t),t.intersectWithLineForCellPicking=(r,s)=>Bo(r,s,t),t.getCurrentImage=()=>t.getInputData()}var Vo={slicingMode:K.NONE,closestIJKAxis:{ijkMode:K.NONE,flip:!1},renderToRectangle:!1,sliceAtFocalPoint:!1,preferSizeOverAccuracy:!1};function ha(t,e,n={}){Object.assign(e,Vo,n),Do.extend(t,e,n),C.get(t,e,["slicingMode"]),C.setGet(t,e,["closestIJKAxis","renderToRectangle","sliceAtFocalPoint","preferSizeOverAccuracy"]),sn.implementCoincidentTopologyMethods(t,e),Uo(t,e)}var ko=C.newInstance(ha,"vtkImageMapper"),Mp={newInstance:ko,extend:ha,...No,...Go,...ua},$o={DISPLAY:0,WORLD:1},pa={CoordinateSystem:$o},{CoordinateSystem:Nn}=pa;function Rr(t){return()=>C.vtkErrorMacro(`vtkProp::${t} - NOT IMPLEMENTED`)}function Wo(t,e){e.classHierarchy.push("vtkProp"),t.getMTime=()=>{let n=e.mtime;for(let r=0;r<e.textures.length;++r){const s=e.textures[r].getMTime();s>n&&(n=s)}return n},t.processSelectorPixelBuffers=(n,r)=>{},t.getNestedProps=()=>null,t.getActors=()=>[],t.getActors2D=()=>[],t.getVolumes=()=>[],t.pick=Rr("pick"),t.hasKey=Rr("hasKey"),t.getNestedVisibility=()=>e.visibility&&(!e._parentProp||e._parentProp.getNestedVisibility()),t.getNestedPickable=()=>e.pickable&&(!e._parentProp||e._parentProp.getNestedPickable()),t.getNestedDragable=()=>e.dragable&&(!e._parentProp||e._parentProp.getNestedDragable()),t.getRedrawMTime=()=>e.mtime,t.setEstimatedRenderTime=n=>{e.estimatedRenderTime=n,e.savedEstimatedRenderTime=n},t.restoreEstimatedRenderTime=()=>{e.estimatedRenderTime=e.savedEstimatedRenderTime},t.addEstimatedRenderTime=n=>{e.estimatedRenderTime+=n},t.setAllocatedRenderTime=n=>{e.allocatedRenderTime=n,e.savedEstimatedRenderTime=e.estimatedRenderTime,e.estimatedRenderTime=0},t.getSupportsSelection=()=>!1,t.getTextures=()=>e.textures,t.hasTexture=n=>e.textures.indexOf(n)!==-1,t.addTexture=n=>{n&&!t.hasTexture(n)&&(e.textures=e.textures.concat(n),t.modified())},t.removeTexture=n=>{const r=e.textures.filter(s=>s!==n);e.textures.length!==r.length&&(e.textures=r,t.modified())},t.removeAllTextures=()=>{e.textures=[],t.modified()},t.setCoordinateSystemToWorld=()=>t.setCoordinateSystem(Nn.WORLD),t.setCoordinateSystemToDisplay=()=>t.setCoordinateSystem(Nn.DISPLAY)}var Ho={allocatedRenderTime:10,coordinateSystem:Nn.WORLD,dragable:!0,estimatedRenderTime:0,paths:null,pickable:!0,renderTimeMultiplier:1,savedEstimatedRenderTime:0,textures:[],useBounds:!0,visibility:!0};function Ta(t,e,n={}){Object.assign(e,Ho,n),C.obj(t,e),C.get(t,e,["estimatedRenderTime","allocatedRenderTime"]),C.setGet(t,e,["_parentProp","coordinateSystem","dragable","pickable","renderTimeMultiplier","useBounds","visibility"]),C.moveToProtected(t,e,["parentProp"]),Wo(t,e)}var zo=C.newInstance(Ta,"vtkProp"),jo={newInstance:zo,extend:Ta,...pa},Xo=1e-6;function Ko(t,e){e.classHierarchy.push("vtkProp3D"),t.addPosition=a=>{e.position=e.position.map((i,o)=>i+a[o]),t.modified()},t.getOrientationWXYZ=()=>{const a=qe();sr(a,e.rotation);const i=new Float64Array(3);return[On(Bi(i,a)),i[0],i[1],i[2]]},t.getOrientationQuaternion=(a=[])=>sr(a,e.rotation),t.rotateX=a=>{a!==0&&(pi(e.rotation,e.rotation,m(a)),t.modified())},t.rotateY=a=>{a!==0&&(Ti(e.rotation,e.rotation,m(a)),t.modified())},t.rotateZ=a=>{a!==0&&(vi(e.rotation,e.rotation,m(a)),t.modified())},t.rotateWXYZ=(a,i,o,c)=>{if(a===0||i===0&&o===0&&c===0)return;const g=m(a),T=qe();jn(T,[i,o,c],g);const f=new Float64Array(16);zt(f,T),Re(e.rotation,e.rotation,f),t.modified()},t.rotateQuaternion=a=>{if(Math.abs(a[3])>=1-Xo)return;const i=zt(new Float64Array(16),a);Re(e.rotation,e.rotation,i),t.modified()},t.setOrientation=(a,i,o)=>a===e.orientation[0]&&i===e.orientation[1]&&o===e.orientation[2]?!1:(e.orientation=[a,i,o],b(e.rotation),t.rotateZ(o),t.rotateX(a),t.rotateY(i),t.modified(),!0),t.setOrientationFromQuaternion=a=>{const i=$n();return zt(i,a),ir(i,e.rotation)?!1:(e.rotation=i,t.modified(),!0)},t.setUserMatrix=a=>ir(e.userMatrix,a)?!1:(pt(e.userMatrix,a),t.modified(),!0),t.getMatrix=()=>(t.computeMatrix(),e.matrix),t.computeMatrix=()=>{if(t.getMTime()>e.matrixMTime.getMTime()){b(e.matrix),e.userMatrix&&Re(e.matrix,e.matrix,e.userMatrix),oe(e.matrix,e.matrix,e.origin),oe(e.matrix,e.matrix,e.position),Re(e.matrix,e.matrix,e.rotation),Ln(e.matrix,e.matrix,e.scale),oe(e.matrix,e.matrix,[-e.origin[0],-e.origin[1],-e.origin[2]]),ce(e.matrix,e.matrix),e.isIdentity=!0;for(let a=0;a<4;++a)for(let i=0;i<4;++i)(a===i?1:0)!==e.matrix[a+i*4]&&(e.isIdentity=!1);e.matrixMTime.modified()}},t.computeBounds=()=>{if(e.mapper===null){Y.reset(e.bounds);return}const a=e.mapper.getBounds();if(!a||a.length!==6||!Y.isValid(a)){e.mapperBounds=a,Y.reset(e.bounds),e.boundsMTime.modified();return}if(!e.mapperBounds||!a.every((i,o)=>a[o]===e.mapperBounds[o])||t.getMTime()>e.boundsMTime.getMTime()){C.vtkDebugMacro("Recomputing bounds..."),e.mapperBounds=a,t.computeMatrix();const i=new Float64Array(16);ce(i,e.matrix),Y.transformBounds(a,i,e.bounds),e.boundsMTime.modified()}};const n=t.getBounds;t.getBounds=()=>(t.computeBounds(),n());const r=t.getBoundsByReference;t.getBoundsByReference=()=>(t.computeBounds(),r()),t.getCenter=()=>Y.getCenter(t.getBoundsByReference()),t.getLength=()=>Y.getLength(t.getBoundsByReference()),t.getXRange=()=>Y.getXRange(t.getBoundsByReference()),t.getYRange=()=>Y.getYRange(t.getBoundsByReference()),t.getZRange=()=>Y.getZRange(t.getBoundsByReference()),t.getUserMatrix=()=>e.userMatrix;function s(){t.computeMatrix()}t.onModified(s),t.getProperty=(a=0)=>(e.properties[a]==null&&(e.properties[a]=t.makeProperty?.()),e.properties[a]),t.getProperties=()=>(e.properties.length===0&&(e.properties[0]=t.makeProperty?.()),e.properties),t.setProperty=(a,i)=>{const[o,c]=Number.isInteger(a)?[a,i]:[0,a];return e.properties[o]===c?!1:(e.properties[o]=c,!0)},t.getMTime=()=>{let a=e.mtime;return e.properties.forEach(i=>{if(i!==null){const o=i.getMTime();a=o>a?o:a}}),a}}var Yo={bounds:[...Y.INIT_BOUNDS],origin:[0,0,0],position:[0,0,0],orientation:[0,0,0],rotation:null,scale:[1,1,1],properties:[],userMatrix:null,userMatrixMTime:null,cachedProp3D:null,isIdentity:!0,matrixMTime:null};function va(t,e,n={}){Object.assign(e,Yo,n),jo.extend(t,e,n),e.matrixMTime={},C.obj(e.matrixMTime),C.get(t,e,["isIdentity"]),C.getArray(t,e,["orientation"]),C.setGetArray(t,e,["origin","position","scale"],3),C.setGet(t,e,["properties"]),C.getArray(t,e,["bounds"],6),e.matrix=b(new Float64Array(16)),e.rotation=b(new Float64Array(16)),e.userMatrix=b(new Float64Array(16)),e.transform=null,Ko(t,e)}var Zo=C.newInstance(va,"vtkProp3D"),qn={newInstance:Zo,extend:va},Qo={NEAREST:0,LINEAR:1},Jo={InterpolationType:Qo},{InterpolationType:Xt}=Jo,{vtkErrorMacro:Cr}=C,Kt=4;function qo(t,e){e.classHierarchy.push("vtkImageProperty"),t.getMTime=()=>{let n=e.mtime,r;for(let s=0;s<Kt;s++)e.componentData[s].rGBTransferFunction&&(r=e.componentData[s].rGBTransferFunction.getMTime(),n=n>r?n:r),e.componentData[s].piecewiseFunction&&(r=e.componentData[s].piecewiseFunction.getMTime(),n=n>r?n:r);return n},t.setRGBTransferFunction=(n=0,r=null)=>{let s=n,a=r;return Number.isInteger(n)||(a=n,s=0),e.componentData[s].rGBTransferFunction!==a?(e.componentData[s].rGBTransferFunction=a,t.modified(),!0):!1},t.getRGBTransferFunction=(n=0)=>e.componentData[n].rGBTransferFunction,t.setPiecewiseFunction=(n=0,r=null)=>{let s=n,a=r;return Number.isInteger(n)||(a=n,s=0),e.componentData[s].piecewiseFunction!==a?(e.componentData[s].piecewiseFunction=a,t.modified(),!0):!1},t.getPiecewiseFunction=(n=0)=>e.componentData[n].piecewiseFunction,t.setScalarOpacity=(n=0,r=null)=>{let s=n,a=r;return Number.isInteger(n)||(a=n,s=0),t.setPiecewiseFunction(s,a)},t.getScalarOpacity=(n=0)=>t.getPiecewiseFunction(n),t.setComponentWeight=(n=0,r=1)=>{if(n<0||n>=Kt)return Cr("Invalid index"),!1;const s=Math.min(1,Math.max(0,r));return e.componentData[n].componentWeight!==s?(e.componentData[n].componentWeight=s,t.modified(),!0):!1},t.getComponentWeight=(n=0)=>n<0||n>=Kt?(Cr("Invalid index"),0):e.componentData[n].componentWeight,t.setInterpolationTypeToNearest=()=>t.setInterpolationType(Xt.NEAREST),t.setInterpolationTypeToLinear=()=>t.setInterpolationType(Xt.LINEAR),t.getInterpolationTypeAsString=()=>C.enumToString(Xt,e.interpolationType)}var Ao=t=>({independentComponents:!1,interpolationType:Xt.LINEAR,colorWindow:255,colorLevel:127.5,ambient:1,diffuse:0,opacity:1,useLookupTableScalarRange:!1,useLabelOutline:!1,labelOutlineThickness:[1],labelOutlineOpacity:1,updatedExtents:[],...t});function bo(t,e,n={}){if(Object.assign(e,Ao(n)),C.obj(t,e),!e.componentData){e.componentData=[];for(let r=0;r<Kt;r++)e.componentData.push({rGBTransferFunction:null,piecewiseFunction:null,componentWeight:1})}C.setGet(t,e,["independentComponents","interpolationType","colorWindow","colorLevel","ambient","diffuse","opacity","useLookupTableScalarRange","useLabelOutline","labelOutlineOpacity","updatedExtents"]),C.setGetArray(t,e,["labelOutlineThickness"]),qo(t,e)}var Io=C.newInstance(bo,"vtkImageProperty"),mo={newInstance:Io};function Po(t,e){e.classHierarchy.push("vtkImageSlice"),t.getActors=()=>t,t.getImages=()=>t,t.getIsOpaque=()=>{if(e.forceOpaque)return!0;if(e.forceTranslucent)return!1;e.properties[0]||t.getProperty();let n=e.properties[0].getOpacity()>=1;return n=n&&(!e.mapper||e.mapper.getIsOpaque()),n},t.hasTranslucentPolygonalGeometry=()=>!1,t.makeProperty=mo.newInstance,t.getBoundsForSlice=(n,r)=>{const s=e.mapper.getBoundsForSlice(n,r);if(!Y.isValid(s))return s;t.computeMatrix();const a=new Float64Array(16);return ce(a,e.matrix),Y.transformBounds(s,a)},t.getMinXBound=()=>t.getBoundsByReference()[0],t.getMaxXBound=()=>t.getBoundsByReference()[1],t.getMinYBound=()=>t.getBoundsByReference()[2],t.getMaxYBound=()=>t.getBoundsByReference()[3],t.getMinZBound=()=>t.getBoundsByReference()[4],t.getMaxZBound=()=>t.getBoundsByReference()[5],t.getRedrawMTime=()=>{let n=e.mtime;if(e.mapper!==null){let r=e.mapper.getMTime();n=r>n?r:n,e.mapper.getInput()!==null&&(e.mapper.getInputAlgorithm().update(),r=e.mapper.getInput().getMTime(),n=r>n?r:n)}return e.properties.forEach(r=>{n=Math.max(n,r.getMTime());const s=r.getRGBTransferFunction();s!==null&&(n=Math.max(n,s.getMTime()))}),n},t.getSupportsSelection=()=>e.mapper?e.mapper.getSupportsSelection():!1}var ef={mapper:null,forceOpaque:!1,forceTranslucent:!1};function ya(t,e,n={}){Object.assign(e,ef,n),qn.extend(t,e,n),e.boundsMTime={},C.obj(e.boundsMTime),C.setGet(t,e,["mapper","forceOpaque","forceTranslucent"]),Po(t,e)}var tf=C.newInstance(ya,"vtkImageSlice"),Op={newInstance:tf,extend:ya},{vtkErrorMacro:Nt}=C;function nf(t,e){e.classHierarchy.push("vtkPiecewiseFunction"),t.getSize=()=>e.nodes.length,t.getType=()=>{let n,r=0,s=0;e.nodes.length>0&&(r=e.nodes[0].y);for(let a=1;a<e.nodes.length;a++){if(n=e.nodes[a].y,n!==r)if(n>r)switch(s){case 0:case 1:s=1;break;default:s=3;break}else switch(s){case 0:case 2:s=2;break;default:s=3;break}if(r=n,s===3)break}switch(s){case 0:return"Constant";case 1:return"NonDecreasing";case 2:return"NonIncreasing";default:return"Varied"}},t.getDataPointer=()=>{const n=e.nodes.length;if(e.function=null,n>0){e.function=[];for(let r=0;r<n;r++)e.function[2*r]=e.nodes[r].x,e.function[2*r+1]=e.nodes[r].y}return e.function},t.getFirstNonZeroValue=()=>{if(e.nodes.length===0)return 0;let n=1,r=0,s=0;for(;s<e.nodes.length;s++)if(e.nodes[s].y!==0){n=0;break}return n?r=Number.MAX_VALUE:s>0?r=e.nodes[s-1].x:e.clamping?r=-Number.MAX_VALUE:r=e.nodes[0].x,r},t.getNodeValue=(n,r)=>{const s=e.nodes.length;return n<0||n>=s?(Nt("Index out of range!"),-1):(r[0]=e.nodes[n].x,r[1]=e.nodes[n].y,r[2]=e.nodes[n].midpoint,r[3]=e.nodes[n].sharpness,1)},t.setNodeValue=(n,r)=>{const s=e.nodes.length;if(n<0||n>=s)return Nt("Index out of range!"),-1;const a=e.nodes[n].x;return e.nodes[n].x=r[0],e.nodes[n].y=r[1],e.nodes[n].midpoint=r[2],e.nodes[n].sharpness=r[3],a!==r[0]?t.sortAndUpdateRange():t.modified(),1},t.addPoint=(n,r)=>t.addPointLong(n,r,.5,0),t.addPointLong=(n,r,s,a)=>{if(s<0||s>1)return Nt("Midpoint outside range [0.0, 1.0]"),-1;if(a<0||a>1)return Nt("Sharpness outside range [0.0, 1.0]"),-1;e.allowDuplicateScalars||t.removePoint(n);const i={x:n,y:r,midpoint:s,sharpness:a};e.nodes.push(i),t.sortAndUpdateRange();let o;for(o=0;o<e.nodes.length&&e.nodes[o].x!==n;o++);return o<e.nodes.length?o:-1},t.setNodes=n=>{e.nodes!==n&&(e.nodes=n,t.sortAndUpdateRange())},t.sortAndUpdateRange=()=>{e.nodes.sort((n,r)=>n.x-r.x),t.updateRange()||t.modified()},t.updateRange=()=>{const n=e.range.slice(),r=e.nodes.length;return r?(e.range[0]=e.nodes[0].x,e.range[1]=e.nodes[r-1].x):(e.range[0]=0,e.range[1]=0),n[0]===e.range[0]&&n[1]===e.range[1]?!1:(t.modified(),!0)},t.removePoint=n=>{let r;for(r=0;r<e.nodes.length&&e.nodes[r].x!==n;r++);if(r>=e.nodes.length)return-1;const s=r;let a=!1;return e.nodes.splice(r,1),(r===0||r===e.nodes.length)&&(a=t.updateRange()),a||t.modified(),s},t.removeAllPoints=()=>{e.nodes=[],t.sortAndUpdateRange()},t.addSegment=(n,r,s,a)=>{t.sortAndUpdateRange();for(let i=0;i<e.nodes.length;)e.nodes[i].x>=n&&e.nodes[i].x<=s?e.nodes.splice(i,1):i++;t.addPoint(n,r,.5,0),t.addPoint(s,a,.5,0)},t.getValue=n=>{const r=[];return t.getTable(n,n,1,r),r[0]},t.adjustRange=n=>{if(n.length<2)return 0;const r=t.getRange();r[0]<n[0]?t.addPoint(n[0],t.getValue(n[0])):t.addPoint(n[0],t.getValue(r[0])),r[1]>n[1]?t.addPoint(n[1],t.getValue(n[1])):t.addPoint(n[1],t.getValue(r[1])),t.sortAndUpdateRange();for(let s=0;s<e.nodes.length;)e.nodes[s].x>=n[0]&&e.nodes[s].x<=n[1]?e.nodes.splice(s,1):++s;return t.sortAndUpdateRange(),1},t.estimateMinNumberOfSamples=(n,r)=>{const s=t.findMinimumXDistance();return Math.ceil((r-n)/s)},t.findMinimumXDistance=()=>{const n=e.nodes.length;if(n<2)return-1;let r=e.nodes[1].x-e.nodes[0].x;for(let s=0;s<n-1;s++){const a=e.nodes[s+1].x-e.nodes[s].x;a<r&&(r=a)}return r},t.getTable=(n,r,s,a,i=1)=>{let o,c=0;const g=e.nodes.length;let T=0;g!==0&&(T=e.nodes[g-1].y);let f=0,y=0,w=0,R=0,l=0,x=0,u=0;for(o=0;o<s;o++){const p=i*o;for(s>1?f=n+o/(s-1)*(r-n):f=.5*(n+r);c<g&&f>e.nodes[c].x;)c++,c<g&&(y=e.nodes[c-1].x,w=e.nodes[c].x,R=e.nodes[c-1].y,l=e.nodes[c].y,x=e.nodes[c-1].midpoint,u=e.nodes[c-1].sharpness,x<1e-5&&(x=1e-5),x>.99999&&(x=.99999));if(c>=g)a[p]=e.clamping?T:0;else if(c===0)a[p]=e.clamping?e.nodes[0].y:0;else{let h=(f-y)/(w-y);if(h<x?h=.5*h/x:h=.5+.5*(h-x)/(1-x),u>.99)if(h<.5){a[p]=R;continue}else{a[p]=l;continue}if(u<.01){a[p]=(1-h)*R+h*l;continue}h<.5?h=.5*(h*2)**(1+10*u):h>.5&&(h=1-.5*((1-h)*2)**(1+10*u));const v=h*h,E=v*h,S=2*E-3*v+1,_=-2*E+3*v,d=E-2*v+h,L=E-v,M=l-R,D=(1-u)*M;a[p]=S*R+_*l+d*D+L*D;const F=R<l?R:l,N=R>l?R:l;a[p]=a[p]<F?F:a[p],a[p]=a[p]>N?N:a[p]}}}}var rf={range:[0,0],clamping:!0,allowDuplicateScalars:!1};function la(t,e,n={}){Object.assign(e,rf,n),C.obj(t,e),e.nodes=[],C.setGet(t,e,["allowDuplicateScalars","clamping"]),C.setArray(t,e,["range"],2),C.getArray(t,e,["range"]),nf(t,e)}var af=C.newInstance(la,"vtkPiecewiseFunction"),Gn={newInstance:af,extend:la},xa={FLAT:0,GOURAUD:1,PHONG:2},st={POINTS:0,WIREFRAME:1,SURFACE:2},sf=xa,Ea={Shading:xa,Representation:st,Interpolation:sf},of={CLAMP_TO_EDGE:0,REPEAT:1,MIRRORED_REPEAT:2},Un={NEAREST:0,LINEAR:1,NEAREST_MIPMAP_NEAREST:2,NEAREST_MIPMAP_LINEAR:3,LINEAR_MIPMAP_NEAREST:4,LINEAR_MIPMAP_LINEAR:5},Sa={Wrap:of,Filter:Un},Ra=new Float32Array(1),ff=new Int32Array(Ra.buffer);function cf(t){Ra[0]=t;const e=ff[0];let n=e>>16&32768,r=e>>12&2047;const s=e>>23&255;return s<103?n:s>142?(n|=31744,n|=(s===255?0:1)&&e&8388607,n):s<113?(r|=2048,n|=(r>>114-s)+(r>>113-s&1),n):(n|=s-112<<10|r>>1,n+=r&1,n)}function uf(t){const e=(t&32768)>>15,n=(t&31744)>>10,r=t&1023;return n===0?(e?-1:1)*2**-14*(r/2**10):n===31?r?NaN:(e?-1:1)*(1/0):(e?-1:1)*2**(n-15)*(1+r/2**10)}var Ze={fromHalf:uf,toHalf:cf},{vtkErrorMacro:gf}=C,hf=["Build","Render"];function pf(t,e){e.classHierarchy.push("vtkViewNode");function n(s,a){for(let i=0;i<e.children.length;++i){const o=(a+1+i)%e.children.length;if(e.children[o]===s)return e.children[o]=e.children[a],e.children[a]=s,!0}return!1}t.build=s=>{},t.render=s=>{},t.traverse=s=>{const a=t[s.getTraverseOperation()];if(a){a(s);return}t.apply(s,!0);for(let i=0;i<e.children.length;i++)e.children[i].traverse(s);t.apply(s,!1)},t.apply=(s,a)=>{const i=t[s.getOperation()];i&&i(a,s)},t.getViewNodeFor=(s,a=null)=>{if(a&&a.renderable===s)return a;if(e.renderable===s)return t;for(let i=0;i<e.children.length;++i){const o=e.children[i].getViewNodeFor(s);if(o)return o}},t.getFirstAncestorOfType=s=>e._parent?e._parent.isA(s)?e._parent:e._parent.getFirstAncestorOfType(s):null,t.getLastAncestorOfType=s=>{if(!e._parent)return null;const a=e._parent.getLastAncestorOfType(s);return a||(e._parent.isA(s)?e._parent:null)},t.addMissingNode=s=>{if(!s)return;const a=e._renderableChildMap.get(s);if(a!==void 0)return a.setVisited(!0),a;const i=t.createViewNode(s);if(i)return i.setParent(t),i.setVisited(!0),e._renderableChildMap.set(s,i),e.children.push(i),i},t.addMissingNodes=(s,a=!1)=>{if(!s||!s.length)return;let i;for(let o=0;o<s.length;++o){const c=s[o],g=t.addMissingNode(c);a&&g!==void 0&&(i===void 0?i=e.children.lastIndexOf(g):e.children[i]!==g&&n(e.children,g),i++)}},t.addMissingChildren=s=>{if(!(!s||!s.length))for(let a=0;a<s.length;++a){const i=s[a];if(e.children.indexOf(i)===-1){i.setParent(t),e.children.push(i);const o=i.getRenderable();o&&e._renderableChildMap.set(o,i)}i.setVisited(!0)}},t.removeNode=s=>{const a=e.children.findIndex(o=>o===s);if(a<0)return!1;const i=s.getRenderable();return i&&e._renderableChildMap.delete(i),s.delete(),e.children.splice(a,1),!0},t.prepareNodes=()=>{for(let s=0;s<e.children.length;++s)e.children[s].setVisited(!1)},t.setVisited=s=>{e.visited=s},t.removeUnusedNodes=()=>{let s=0;for(let a=0;a<e.children.length;++a){const i=e.children[a];if(i.getVisited())e.children[s++]=i,i.setVisited(!1);else{const o=i.getRenderable();o&&e._renderableChildMap.delete(o),i.delete()}}e.children.length=s},t.createViewNode=s=>{if(!e.myFactory)return gf("Cannot create view nodes without my own factory"),null;const a=e.myFactory.createNode(s);return a&&a.setRenderable(s),a};const r=t.delete;t.delete=()=>{for(let s=0;s<e.children.length;s++)e.children[s].delete();r()}}var Tf={renderable:null,myFactory:null,children:[],visited:!1};function wr(t,e,n={}){Object.assign(e,Tf,n),C.obj(t,e),C.event(t,e,"event"),e._renderableChildMap=new Map,C.get(t,e,["visited"]),C.setGet(t,e,["_parent","renderable","myFactory"]),C.getArray(t,e,["children"]),C.moveToProtected(t,e,["parent"]),pf(t,e)}var An={newInstance:C.newInstance(wr,"vtkViewNode"),extend:wr,PASS_TYPES:hf},{vtkWarningMacro:vf}=C;function yf(t){const e=[];let n=0,r=t.getClassName(n++);for(;r;)e.push(r),r=t.getClassName(n++);return e}function lf(t,e){const n=e.join(" → ");return[`No ${t} implementation found for ${e[0]}.`,`Class hierarchy: ${n}.`,`A rendering Profile is likely missing for ${e[0]}.`,"Try importing '@kitware/vtk.js/Rendering/Profiles/All' or 'vtk.js/Sources/Rendering/Profiles/All',","or import the specific rendering profile needed by this renderable if known.","See https://kitware.github.io/vtk-js/docs/concepts_profile.html for details."].join(`
|
|
2
|
+
`)}function xf(t){return t.includes("vtkAbstractWidget")||t.includes("vtkWidgetRepresentation")}function Ef(t,e){e.overrides||(e.overrides={}),e.classHierarchy.push("vtkViewNodeFactory"),t.createNode=n=>{if(n.isDeleted())return null;const r=yf(n);let s=0,a=r[s++],i=!1;const o=Object.keys(e.overrides);for(;a&&!i;)o.indexOf(a)!==-1?i=!0:a=n.getClassName(s++);if(!i)return xf(r)||vf(lf(t.getClassName(),r)),null;const c=e.overrides[a]();return c.setMyFactory(t),c}}var Sf={};function Ca(t,e,n={}){Object.assign(e,Sf,n),C.obj(t,e),Ef(t,e)}var Rf=C.newInstance(Ca,"vtkViewNodeFactory"),wa={newInstance:Rf,extend:Ca},da=Object.create(null);function _a(t,e){da[t]=e}function Cf(t,e){e.classHierarchy.push("vtkOpenGLViewNodeFactory")}var wf={};function La(t,e,n={}){Object.assign(e,wf,n),e.overrides=da,wa.extend(t,e,n),Cf(t,e)}var df=C.newInstance(La,"vtkOpenGLViewNodeFactory"),_f={newInstance:df,extend:La};function Lf(){try{const r=new Int16Array([0,32767]),s=[1,1],a=document.createElement("canvas");a.width=4,a.height=4;const i=a.getContext("webgl2");if(!i)return!1;const o=i.getExtension("EXT_texture_norm16");if(!o)return!1;const c=`#version 300 es
|
|
3
|
+
void main() {
|
|
4
|
+
gl_PointSize = ${4 .toFixed(1)};
|
|
5
|
+
gl_Position = vec4(0, 0, 0, 1);
|
|
6
|
+
}
|
|
7
|
+
`,g=`#version 300 es
|
|
8
|
+
precision highp float;
|
|
9
|
+
precision highp int;
|
|
10
|
+
precision highp sampler2D;
|
|
11
|
+
|
|
12
|
+
uniform sampler2D u_image;
|
|
13
|
+
|
|
14
|
+
out vec4 color;
|
|
15
|
+
|
|
16
|
+
void main() {
|
|
17
|
+
vec4 intColor = texture(u_image, gl_PointCoord.xy);
|
|
18
|
+
color = vec4(vec3(intColor.rrr), 1);
|
|
19
|
+
}
|
|
20
|
+
`,T=i.createShader(i.VERTEX_SHADER);if(i.shaderSource(T,c),i.compileShader(T),!i.getShaderParameter(T,i.COMPILE_STATUS))return!1;const f=i.createShader(i.FRAGMENT_SHADER);if(i.shaderSource(f,g),i.compileShader(f),!i.getShaderParameter(f,i.COMPILE_STATUS))return!1;const y=i.createProgram();if(i.attachShader(y,T),i.attachShader(y,f),i.linkProgram(y),!i.getProgramParameter(y,i.LINK_STATUS))return!1;const w=i.createTexture();i.bindTexture(i.TEXTURE_2D,w),i.texImage2D(i.TEXTURE_2D,0,o.R16_SNORM_EXT,2,1,0,i.RED,i.SHORT,r),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.useProgram(y),i.drawArrays(i.POINTS,0,1);const R=new Uint8Array(4);i.readPixels(s[0],s[1],1,1,i.RGBA,i.UNSIGNED_BYTE,R);const[l,x,u]=R,p=i.getExtension("WEBGL_lose_context");return p&&p.loseContext(),l===x&&x===u&&l!==0}catch{return!1}}var pn;function Mf(){return pn===void 0&&(pn=Lf()),pn}var{Wrap:Se,Filter:A}=Sa,{VtkDataTypes:H}=ne,{vtkDebugMacro:Tn,vtkErrorMacro:$e,vtkWarningMacro:dr,requiredParam:j}=zn,{toHalf:Of}=Ze;function Df(t,e){e.classHierarchy.push("vtkOpenGLTexture");function n(){return{internalFormat:e.internalFormat,format:e.format,openGLDataType:e.openGLDataType,width:e.width,height:e.height}}t.render=(R=null)=>{if(R?e._openGLRenderWindow=R:(e._openGLRenderer=t.getFirstAncestorOfType("vtkOpenGLRenderer"),e._openGLRenderWindow=e._openGLRenderer.getLastAncestorOfType("vtkOpenGLRenderWindow")),e.context=e._openGLRenderWindow.getContext(),e.renderable.getInterpolate()?(e.generateMipmap?t.setMinificationFilter(A.LINEAR_MIPMAP_LINEAR):t.setMinificationFilter(A.LINEAR),t.setMagnificationFilter(A.LINEAR)):(t.setMinificationFilter(A.NEAREST),t.setMagnificationFilter(A.NEAREST)),e.renderable.getRepeat()&&(t.setWrapR(Se.REPEAT),t.setWrapS(Se.REPEAT),t.setWrapT(Se.REPEAT)),e.renderable.getInputData()&&e.renderable.setImage(null),!e.handle||e.renderable.getMTime()>e.textureBuildTime.getMTime()){if(e.renderable.getImageBitmap()!==null&&(e.renderable.getInterpolate()&&(e.generateMipmap=!0,t.setMinificationFilter(A.LINEAR_MIPMAP_LINEAR)),e.renderable.getImageBitmap()&&e.renderable.getImageLoaded()&&(t.create2DFromImageBitmap(e.renderable.getImageBitmap()),t.activate(),t.sendParameters(),e.textureBuildTime.modified())),e.renderable.getImage()!==null&&(e.renderable.getInterpolate()&&(e.generateMipmap=!0,t.setMinificationFilter(A.LINEAR_MIPMAP_LINEAR)),e.renderable.getImage()&&e.renderable.getImageLoaded()&&(t.create2DFromImage(e.renderable.getImage()),t.activate(),t.sendParameters(),e.textureBuildTime.modified())),e.renderable.getCanvas()!==null){e.renderable.getInterpolate()&&(e.generateMipmap=!0,t.setMinificationFilter(A.LINEAR_MIPMAP_LINEAR));const x=e.renderable.getCanvas();t.create2DFromRaw({width:x.width,height:x.height,numComps:4,dataType:H.UNSIGNED_CHAR,data:x,flip:!0}),t.activate(),t.sendParameters(),e.textureBuildTime.modified()}if(e.renderable.getJsImageData()!==null){const x=e.renderable.getJsImageData();e.renderable.getInterpolate()&&(e.generateMipmap=!0,t.setMinificationFilter(A.LINEAR_MIPMAP_LINEAR)),t.create2DFromRaw({width:x.width,height:x.height,numComps:4,dataType:H.UNSIGNED_CHAR,data:x.data,flip:!0}),t.activate(),t.sendParameters(),e.textureBuildTime.modified()}const l=e.renderable.getInputData(0);if(l&&l.getPointData().getScalars()){const x=l.getExtent(),u=l.getPointData().getScalars(),p=[];for(let h=0;h<e.renderable.getNumberOfInputPorts();++h){const v=e.renderable.getInputData(h),E=v?v.getPointData().getScalars().getData():null;E&&p.push(E)}e.renderable.getInterpolate()&&u.getNumberOfComponents()===4&&(e.generateMipmap=!0,t.setMinificationFilter(A.LINEAR_MIPMAP_LINEAR)),p.length%6===0?t.createCubeFromRaw({width:x[1]-x[0]+1,height:x[3]-x[2]+1,numComps:u.getNumberOfComponents(),dataType:u.getDataType(),data:p}):t.create2DFromRaw({width:x[1]-x[0]+1,height:x[3]-x[2]+1,numComps:u.getNumberOfComponents(),dataType:u.getDataType(),data:u.getData()}),t.activate(),t.sendParameters(),e.textureBuildTime.modified()}}e.handle&&t.activate()};const r=()=>{if(!((e.minificationFilter===A.LINEAR||e.magnificationFilter===A.LINEAR)&&!Mf()))return e.oglNorm16Ext};t.destroyTexture=()=>{t.deactivate(),e.context&&e.handle&&e.context.deleteTexture(e.handle),e._prevTexParams=null,e.handle=0,e.numberOfDimensions=0,e.target=0,e.components=0,e.width=0,e.height=0,e.depth=0,t.resetFormatAndType()},t.createTexture=()=>{e.handle||(e.handle=e.context.createTexture(),e.target&&(e.context.bindTexture(e.target,e.handle),e.context.texParameteri(e.target,e.context.TEXTURE_MIN_FILTER,t.getOpenGLFilterMode(e.minificationFilter)),e.context.texParameteri(e.target,e.context.TEXTURE_MAG_FILTER,t.getOpenGLFilterMode(e.magnificationFilter)),e.context.texParameteri(e.target,e.context.TEXTURE_WRAP_S,t.getOpenGLWrapMode(e.wrapS)),e.context.texParameteri(e.target,e.context.TEXTURE_WRAP_T,t.getOpenGLWrapMode(e.wrapT)),e._openGLRenderWindow.getWebgl2()&&e.context.texParameteri(e.target,e.context.TEXTURE_WRAP_R,t.getOpenGLWrapMode(e.wrapR)),e.context.bindTexture(e.target,null)))},t.getTextureUnit=()=>e._openGLRenderWindow?e._openGLRenderWindow.getTextureUnitForTexture(t):-1,t.activate=()=>{e._openGLRenderWindow.activateTexture(t),t.bind()},t.deactivate=()=>{e._openGLRenderWindow&&e._openGLRenderWindow.deactivateTexture(t)},t.releaseGraphicsResources=R=>{R&&e.handle&&(R.activateTexture(t),R.deactivateTexture(t),e.context.deleteTexture(e.handle),e._prevTexParams=null,e.handle=0,e.numberOfDimensions=0,e.target=0,e.internalFormat=0,e.format=0,e.openGLDataType=0,e.components=0,e.width=0,e.height=0,e.depth=0,e.allocatedGPUMemoryInBytes=0),e.shaderProgram&&(e.shaderProgram.releaseGraphicsResources(R),e.shaderProgram=null)},t.bind=()=>{e.context.bindTexture(e.target,e.handle),e.autoParameters&&t.getMTime()>e.sendParametersTime.getMTime()&&t.sendParameters()},t.isBound=()=>{let R=!1;if(e.context&&e.handle){let l=0;e.target===e.context.TEXTURE_2D?l=e.context.TEXTURE_BINDING_2D:dr("impossible case"),R=e.context.getIntegerv(l)===e.handle}return R},t.sendParameters=()=>{e.context.texParameteri(e.target,e.context.TEXTURE_WRAP_S,t.getOpenGLWrapMode(e.wrapS)),e.context.texParameteri(e.target,e.context.TEXTURE_WRAP_T,t.getOpenGLWrapMode(e.wrapT)),e._openGLRenderWindow.getWebgl2()&&e.context.texParameteri(e.target,e.context.TEXTURE_WRAP_R,t.getOpenGLWrapMode(e.wrapR)),e.context.texParameteri(e.target,e.context.TEXTURE_MIN_FILTER,t.getOpenGLFilterMode(e.minificationFilter)),e.context.texParameteri(e.target,e.context.TEXTURE_MAG_FILTER,t.getOpenGLFilterMode(e.magnificationFilter)),e._openGLRenderWindow.getWebgl2()&&(e.context.texParameteri(e.target,e.context.TEXTURE_BASE_LEVEL,e.baseLevel),e.context.texParameteri(e.target,e.context.TEXTURE_MAX_LEVEL,e.maxLevel)),e.sendParametersTime.modified()},t.getInternalFormat=(R,l)=>(e._forceInternalFormat||(e.internalFormat=t.getDefaultInternalFormat(R,l)),e.internalFormat||Tn(`Unable to find suitable internal format for T=${R} NC= ${l}`),[e.context.R32F,e.context.RG32F,e.context.RGB32F,e.context.RGBA32F].includes(e.internalFormat)&&!e.context.getExtension("OES_texture_float_linear")&&dr("Failed to load OES_texture_float_linear. Texture filtering is not available for *32F internal formats."),e.internalFormat),t.getDefaultInternalFormat=(R,l)=>{let x=0;return x=e._openGLRenderWindow.getDefaultTextureInternalFormat(R,l,r(),t.useHalfFloat()),x||(x||(Tn("Unsupported internal texture type!"),Tn(`Unable to find suitable internal format for T=${R} NC= ${l}`)),x)},t.useHalfFloat=()=>e.enableUseHalfFloat&&e.canUseHalfFloat,t.setInternalFormat=R=>{e._forceInternalFormat=!0,R!==e.internalFormat&&(e.internalFormat=R,t.modified())},t.getFormat=(R,l)=>(e.format=t.getDefaultFormat(R,l),e.format),t.getDefaultFormat=(R,l)=>{if(e._openGLRenderWindow.getWebgl2())switch(l){case 1:return e.context.RED;case 2:return e.context.RG;case 3:return e.context.RGB;case 4:return e.context.RGBA;default:return e.context.RGB}else switch(l){case 1:return e.context.LUMINANCE;case 2:return e.context.LUMINANCE_ALPHA;case 3:return e.context.RGB;case 4:return e.context.RGBA;default:return e.context.RGB}},t.resetFormatAndType=()=>{e._prevTexParams=null,e.format=0,e.internalFormat=0,e._forceInternalFormat=!1,e.openGLDataType=0},t.getDefaultDataType=R=>{const l=t.useHalfFloat();if(e._openGLRenderWindow.getWebgl2())switch(R){case H.UNSIGNED_CHAR:return e.context.UNSIGNED_BYTE;case(r()&&!l&&H.SHORT):return e.context.SHORT;case(r()&&!l&&H.UNSIGNED_SHORT):return e.context.UNSIGNED_SHORT;case(l&&H.SHORT):return e.context.HALF_FLOAT;case(l&&H.UNSIGNED_SHORT):return e.context.HALF_FLOAT;case H.FLOAT:case H.VOID:default:return e.context.FLOAT}switch(R){case H.UNSIGNED_CHAR:return e.context.UNSIGNED_BYTE;case H.FLOAT:case H.VOID:default:if(e.context.getExtension("OES_texture_float")&&e.context.getExtension("OES_texture_float_linear"))return e.context.FLOAT;{const x=e.context.getExtension("OES_texture_half_float");if(x&&e.context.getExtension("OES_texture_half_float_linear"))return x.HALF_FLOAT_OES}return e.context.UNSIGNED_BYTE}},t.getOpenGLDataType=(R,l=!1)=>((!e.openGLDataType||l)&&(e.openGLDataType=t.getDefaultDataType(R)),e.openGLDataType),t.getShiftAndScale=()=>{let R=0,l=1;switch(e.openGLDataType){case e.context.BYTE:l=127.5,R=l-128;break;case e.context.UNSIGNED_BYTE:l=255,R=0;break;case e.context.SHORT:l=32767.5,R=l-32768;break;case e.context.UNSIGNED_SHORT:l=65536,R=0;break;case e.context.INT:l=21474836475e-1,R=l-2147483648;break;case e.context.UNSIGNED_INT:l=4294967295,R=0;break;case e.context.FLOAT:}return{shift:R,scale:l}},t.getOpenGLFilterMode=R=>{switch(R){case A.NEAREST:return e.context.NEAREST;case A.LINEAR:return e.context.LINEAR;case A.NEAREST_MIPMAP_NEAREST:return e.context.NEAREST_MIPMAP_NEAREST;case A.NEAREST_MIPMAP_LINEAR:return e.context.NEAREST_MIPMAP_LINEAR;case A.LINEAR_MIPMAP_NEAREST:return e.context.LINEAR_MIPMAP_NEAREST;case A.LINEAR_MIPMAP_LINEAR:return e.context.LINEAR_MIPMAP_LINEAR;default:return e.context.NEAREST}},t.getOpenGLWrapMode=R=>{switch(R){case Se.CLAMP_TO_EDGE:return e.context.CLAMP_TO_EDGE;case Se.REPEAT:return e.context.REPEAT;case Se.MIRRORED_REPEAT:return e.context.MIRRORED_REPEAT;default:return e.context.CLAMP_TO_EDGE}};function s(R){const[l,x,u,p,h,v]=R;return[x-l+1,p-u+1,v-h+1]}function a(R){const[l,x,u]=s(R);return l*x*u}function i(R,l,x,u,p){const[h,v,E,S,_,d]=x,[L,M]=l,D=L*M;let F=p;for(let N=_;N<=d;N++){const U=N*D;for(let W=E;W<=S;W++){const V=U+W*L;for(let z=V+h,G=V+v;z<=G;z++,F++)u[F]=R[z]}}}function o(R,l,x=null){const u=new(x||R.constructor)(l.reduce((v,E)=>v+a(E),0)),p=[e.width,e.height,e.depth];let h=0;return l.forEach(v=>{i(R,p,v,u,h),h+=a(v)}),u}t.updateArrayDataTypeForGL=(R,l,x=!1,u=[])=>{const p=[];let h=e.width*e.height*e.components;x&&(h*=e.depth);const v=!!u.length;if(R!==H.FLOAT&&e.openGLDataType===e.context.FLOAT)for(let S=0;S<l.length;S++)if(l[S])if(v)p.push(o(l[S],u,Float32Array));else{const _=l[S].length>h?l[S].subarray(0,h):l[S];p.push(new Float32Array(_))}else p.push(null);if(R!==H.UNSIGNED_CHAR&&e.openGLDataType===e.context.UNSIGNED_BYTE)for(let S=0;S<l.length;S++)if(l[S])if(v)p.push(o(l[S],u,Uint8Array));else{const _=l[S].length>h?l[S].subarray(0,h):l[S];p.push(new Uint8Array(_))}else p.push(null);let E=!1;if(e._openGLRenderWindow.getWebgl2())E=e.openGLDataType===e.context.HALF_FLOAT;else{const S=e.context.getExtension("OES_texture_half_float");E=S&&e.openGLDataType===S.HALF_FLOAT_OES}if(E)for(let S=0;S<l.length;S++)if(l[S]){const _=v?o(l[S],u):l[S],d=new Uint16Array(v?_.length:h),L=d.length;for(let M=0;M<L;M++)d[M]=Of(_[M]);p.push(d)}else p.push(null);if(p.length===0)for(let S=0;S<l.length;S++)p.push(v&&l[S]?o(l[S],u):l[S]);return p};function c(R){if(e._openGLRenderWindow.getWebgl2())return R;const l=[],x=e.width,u=e.height,p=e.components;if(R&&(!_t(x)||!_t(u))){const h=e.context.getExtension("OES_texture_half_float"),v=Ie(x),E=Ie(u),S=v*E*e.components;for(let _=0;_<R.length;_++)if(R[_]!==null){let d=null;const L=u/E,M=x/v;let D=!1;e.openGLDataType===e.context.FLOAT?d=new Float32Array(S):h&&e.openGLDataType===h.HALF_FLOAT_OES?(d=new Uint16Array(S),D=!0):d=new Uint8Array(S);for(let F=0;F<E;F++){const N=F*v*p,U=F*L;let W=Math.floor(U),V=Math.ceil(U);V>=u&&(V=u-1);const z=U-W,G=1-z;W=W*x*p,V=V*x*p;for(let O=0;O<v;O++){const B=O*p,k=O*M;let X=Math.floor(k),$=Math.ceil(k);$>=x&&($=x-1);const pe=k-X;X*=p,$*=p;for(let ie=0;ie<p;ie++)D?d[N+B+ie]=Ze.toHalf(Ze.fromHalf(R[_][W+X+ie])*G*(1-pe)+Ze.fromHalf(R[_][W+$+ie])*G*pe+Ze.fromHalf(R[_][V+X+ie])*z*(1-pe)+Ze.fromHalf(R[_][V+$+ie])*z*pe):d[N+B+ie]=R[_][W+X+ie]*G*(1-pe)+R[_][W+$+ie]*G*pe+R[_][V+X+ie]*z*(1-pe)+R[_][V+$+ie]*z*pe}}l.push(d),e.width=v,e.height=E}else l.push(null)}if(l.length===0)for(let h=0;h<R.length;h++)l.push(R[h]);return l}function g(R){return e._openGLRenderWindow?e.resizable||e.renderable?.getResizable()?!1:e._openGLRenderWindow.getWebgl2()?!(e._openGLRenderWindow.getGLInformations().RENDERER.value.match(/WebKit/gi)&&navigator.platform.match(/Mac/gi)&&r()&&(R===H.UNSIGNED_SHORT||R===H.SHORT)):!1:!1}t.create2DFromRaw=({width:R=j("width"),height:l=j("height"),numComps:x=j("numComps"),dataType:u=j("dataType"),data:p=j("data"),flip:h=!1}={})=>{if(t.getOpenGLDataType(u,!0),t.getInternalFormat(u,x),t.getFormat(u,x),!e.internalFormat||!e.format||!e.openGLDataType)return $e("Failed to determine texture parameters."),!1;e.target=e.context.TEXTURE_2D,e.components=x,e.width=R,e.height=l,e.depth=1,e.numberOfDimensions=2,e._openGLRenderWindow.activateTexture(t),t.createTexture(),t.bind();const v=[p],E=c(t.updateArrayDataTypeForGL(u,v));return e.context.pixelStorei(e.context.UNPACK_FLIP_Y_WEBGL,h),e.context.pixelStorei(e.context.UNPACK_ALIGNMENT,1),g(u)?(e.context.texStorage2D(e.target,1,e.internalFormat,e.width,e.height),E[0]!=null&&e.context.texSubImage2D(e.target,0,0,0,e.width,e.height,e.format,e.openGLDataType,E[0])):e.context.texImage2D(e.target,0,e.internalFormat,e.width,e.height,0,e.format,e.openGLDataType,E[0]),e.generateMipmap&&e.context.generateMipmap(e.target),h&&e.context.pixelStorei(e.context.UNPACK_FLIP_Y_WEBGL,!1),e.allocatedGPUMemoryInBytes=e.width*e.height*e.depth*x*e._openGLRenderWindow.getDefaultTextureByteSize(u,r(),t.useHalfFloat()),t.deactivate(),!0},t.createCubeFromRaw=({width:R=j("width"),height:l=j("height"),numComps:x=j("numComps"),dataType:u=j("dataType"),data:p=j("data")}={})=>{if(t.getOpenGLDataType(u),t.getInternalFormat(u,x),t.getFormat(u,x),!e.internalFormat||!e.format||!e.openGLDataType)return $e("Failed to determine texture parameters."),!1;e.target=e.context.TEXTURE_CUBE_MAP,e.components=x,e.width=R,e.height=l,e.depth=1,e.numberOfDimensions=2,e._openGLRenderWindow.activateTexture(t),e.maxLevel=p.length/6-1,t.createTexture(),t.bind();const h=c(t.updateArrayDataTypeForGL(u,p)),v=[];let E=e.width,S=e.height;for(let _=0;_<h.length;_++){_%6===0&&_!==0&&(E/=2,S/=2),v[_]=ea(u,S*E*e.components);for(let d=0;d<S;++d){const L=d*E*e.components,M=(S-d-1)*E*e.components;v[_].set(h[_].slice(M,M+E*e.components),L)}}e.context.pixelStorei(e.context.UNPACK_ALIGNMENT,1),g(u)&&e.context.texStorage2D(e.target,6,e.internalFormat,e.width,e.height);for(let _=0;_<6;_++){let d=0,L=e.width,M=e.height;for(;L>=1&&M>=1;){let D=null;d<=e.maxLevel&&(D=v[6*d+_]),g(u)?D!=null&&e.context.texSubImage2D(e.context.TEXTURE_CUBE_MAP_POSITIVE_X+_,d,0,0,L,M,e.format,e.openGLDataType,D):e.context.texImage2D(e.context.TEXTURE_CUBE_MAP_POSITIVE_X+_,d,e.internalFormat,L,M,0,e.format,e.openGLDataType,D),d++,L/=2,M/=2}}return e.allocatedGPUMemoryInBytes=e.width*e.height*e.depth*x*e._openGLRenderWindow.getDefaultTextureByteSize(u,r(),t.useHalfFloat()),t.deactivate(),!0},t.createDepthFromRaw=({width:R=j("width"),height:l=j("height"),dataType:x=j("dataType"),data:u=j("data")}={})=>(t.getOpenGLDataType(x),e.format=e.context.DEPTH_COMPONENT,e._openGLRenderWindow.getWebgl2()?x===H.FLOAT?e.internalFormat=e.context.DEPTH_COMPONENT32F:e.internalFormat=e.context.DEPTH_COMPONENT16:e.internalFormat=e.context.DEPTH_COMPONENT,!e.internalFormat||!e.format||!e.openGLDataType?($e("Failed to determine texture parameters."),!1):(e.target=e.context.TEXTURE_2D,e.components=1,e.width=R,e.height=l,e.depth=1,e.numberOfDimensions=2,e._openGLRenderWindow.activateTexture(t),t.createTexture(),t.bind(),e.context.pixelStorei(e.context.UNPACK_ALIGNMENT,1),g(x)?(e.context.texStorage2D(e.target,1,e.internalFormat,e.width,e.height),u!=null&&e.context.texSubImage2D(e.target,0,0,0,e.width,e.height,e.format,e.openGLDataType,u)):e.context.texImage2D(e.target,0,e.internalFormat,e.width,e.height,0,e.format,e.openGLDataType,u),e.generateMipmap&&e.context.generateMipmap(e.target),e.allocatedGPUMemoryInBytes=e.width*e.height*e.depth*e.components*e._openGLRenderWindow.getDefaultTextureByteSize(x,r(),t.useHalfFloat()),t.deactivate(),!0)),t.create2DFromImage=R=>{if(t.getOpenGLDataType(H.UNSIGNED_CHAR),t.getInternalFormat(H.UNSIGNED_CHAR,4),t.getFormat(H.UNSIGNED_CHAR,4),!e.internalFormat||!e.format||!e.openGLDataType)return $e("Failed to determine texture parameters."),!1;e.target=e.context.TEXTURE_2D,e.components=4,e.depth=1,e.numberOfDimensions=2,e._openGLRenderWindow.activateTexture(t),t.createTexture(),t.bind();const l=!e._openGLRenderWindow.getWebgl2()&&(!_t(R.width)||!_t(R.height));let x=R,u=R.width,p=R.height,h=!0;const v=window.chrome;if(l||v){const E=new OffscreenCanvas(Ie(R.width),Ie(R.height));u=E.width,p=E.height;const S=E.getContext("2d");S.translate(0,E.height),S.scale(1,-1),S.drawImage(R,0,0,R.width,R.height,0,0,E.width,E.height),x=E,h=!1}return e.width=u,e.height=p,e.context.pixelStorei(e.context.UNPACK_FLIP_Y_WEBGL,h),e.context.pixelStorei(e.context.UNPACK_ALIGNMENT,1),g(H.UNSIGNED_CHAR)?(e.context.texStorage2D(e.target,1,e.internalFormat,e.width,e.height),e.context.texSubImage2D(e.target,0,0,0,e.width,e.height,e.format,e.openGLDataType,x)):e.context.texImage2D(e.target,0,e.internalFormat,e.width,e.height,0,e.format,e.openGLDataType,x),e.generateMipmap&&e.context.generateMipmap(e.target),e.allocatedGPUMemoryInBytes=e.width*e.height*e.depth*e.components*e._openGLRenderWindow.getDefaultTextureByteSize(H.UNSIGNED_CHAR,r(),t.useHalfFloat()),t.deactivate(),!0},t.create2DFromImageBitmap=R=>(t.getOpenGLDataType(H.UNSIGNED_CHAR),t.getInternalFormat(H.UNSIGNED_CHAR,4),t.getFormat(H.UNSIGNED_CHAR,4),!e.internalFormat||!e.format||!e.openGLDataType?($e("Failed to determine texture parameters."),!1):(e.target=e.context.TEXTURE_2D,e.components=4,e.depth=1,e.numberOfDimensions=2,e._openGLRenderWindow.activateTexture(t),t.createTexture(),t.bind(),e.context.pixelStorei(e.context.UNPACK_ALIGNMENT,1),e.width=R.width,e.height=R.height,g(H.UNSIGNED_CHAR)?(e.context.texStorage2D(e.target,1,e.internalFormat,e.width,e.height),e.context.texSubImage2D(e.target,0,0,0,e.width,e.height,e.format,e.openGLDataType,R)):e.context.texImage2D(e.target,0,e.internalFormat,e.width,e.height,0,e.format,e.openGLDataType,R),e.generateMipmap&&e.context.generateMipmap(e.target),e.allocatedGPUMemoryInBytes=e.width*e.height*e.depth*e.components*e._openGLRenderWindow.getDefaultTextureByteSize(H.UNSIGNED_CHAR,r(),t.useHalfFloat()),t.deactivate(),!0));function T(R,l,x){const u=new Array(x),p=new Array(x);for(let h=0;h<x;++h)u[h]=R[h],p[h]=l[h]-R[h]||1;return{scale:p,offset:u}}function f(R,l){for(let x=0;x<R.length;x++){const u=R[x],p=l[x]+u;if(u<-2048||u>2048||p<-2048||p>2048)return!1}return!0}function y(R,l,x,u){t.getOpenGLDataType(R);const p=f(l,x)||u;let h=!1;if(e._openGLRenderWindow.getWebgl2())h=e.openGLDataType===e.context.FLOAT&&e.context.getExtension("OES_texture_float_linear")===null&&p||e.openGLDataType===e.context.HALF_FLOAT;else{const v=e.context.getExtension("OES_texture_half_float");h=v&&e.openGLDataType===v.HALF_FLOAT_OES}e.canUseHalfFloat=h&&p}function w(R,l){const x=R.getNumberOfComponents(),u=R.getDataType(),p=R.getData(),h=new Array(x),v=new Array(x);for(let S=0;S<x;++S){const[_,d]=R.getRange(S);h[S]=_,v[S]=d}const E=T(h,v,x);return y(u,E.offset,E.scale,l),t.useHalfFloat()||t.getOpenGLDataType(u,!0),{numComps:x,dataType:u,data:p,scaleOffsets:E}}t.create2DFilterableFromRaw=({width:R=j("width"),height:l=j("height"),numComps:x=j("numComps"),dataType:u=j("dataType"),data:p=j("data"),preferSizeOverAccuracy:h=!1,ranges:v=void 0}={})=>t.create2DFilterableFromDataArray({width:R,height:l,dataArray:ne.newInstance({numberOfComponents:x,dataType:u,values:p,ranges:v}),preferSizeOverAccuracy:h}),t.create2DFilterableFromDataArray=({width:R=j("width"),height:l=j("height"),dataArray:x=j("dataArray"),preferSizeOverAccuracy:u=!1}={})=>{const{numComps:p,dataType:h,data:v}=w(x,u);t.create2DFromRaw({width:R,height:l,numComps:p,dataType:h,data:v})},t.updateVolumeInfoForGL=(R,l)=>{let x=!1;const u=t.useHalfFloat();(!e.volumeInfo?.scale||!e.volumeInfo?.offset)&&(e.volumeInfo={scale:new Array(l),offset:new Array(l)});for(let p=0;p<l;++p)e.volumeInfo.scale[p]=1,e.volumeInfo.offset[p]=0;if(r()&&!u&&R===H.SHORT){for(let p=0;p<l;++p)e.volumeInfo.scale[p]=32767;x=!0}if(r()&&!u&&R===H.UNSIGNED_SHORT){for(let p=0;p<l;++p)e.volumeInfo.scale[p]=65535;x=!0}if(R===H.UNSIGNED_CHAR){for(let p=0;p<l;++p)e.volumeInfo.scale[p]=255;x=!0}return(R===H.FLOAT||u&&(R===H.SHORT||R===H.UNSIGNED_SHORT))&&(x=!0),x},t.create3DFromRaw=({width:R=j("width"),height:l=j("height"),depth:x=j("depth"),numComps:u=j("numComps"),dataType:p=j("dataType"),data:h=j("data"),updatedExtents:v=[]}={})=>{let E=p,S=h;if(!t.updateVolumeInfoForGL(E,u)&&S){const D=R*l*x,F=structuredClone(e.volumeInfo),N=new Float32Array(D*u);e.volumeInfo.offset=F.offset,e.volumeInfo.scale=F.scale;let U=0;const W=F.scale.map(V=>1/V);for(let V=0;V<D;V++)for(let z=0;z<u;z++)N[U]=(S[U]-F.offset[z])*W[z],U++;E=H.FLOAT,S=N}if(t.getOpenGLDataType(E),t.getInternalFormat(E,u),t.getFormat(E,u),!e.internalFormat||!e.format||!e.openGLDataType)return $e("Failed to determine texture parameters."),!1;e.target=e.context.TEXTURE_3D,e.components=u,e.width=R,e.height=l,e.depth=x,e.numberOfDimensions=3,e._openGLRenderWindow.activateTexture(t),t.createTexture(),t.bind();const _=v.length>0,d=!_||!li(e._prevTexParams,n()),L=[S],M=c(t.updateArrayDataTypeForGL(E,L,!0,d?[]:v));if(e.context.pixelStorei(e.context.UNPACK_ALIGNMENT,1),d)g(E)?(e.context.texStorage3D(e.target,1,e.internalFormat,e.width,e.height,e.depth),M[0]!=null&&e.context.texSubImage3D(e.target,0,0,0,0,e.width,e.height,e.depth,e.format,e.openGLDataType,M[0])):e.context.texImage3D(e.target,0,e.internalFormat,e.width,e.height,e.depth,0,e.format,e.openGLDataType,M[0]),e._prevTexParams=n();else if(_){const D=M[0];let F=0;for(let N=0;N<v.length;N++){const U=v[N],W=s(U),V=a(U),z=new D.constructor(D.buffer,F,V);F+=z.byteLength,e.context.texSubImage3D(e.target,0,U[0],U[2],U[4],W[0],W[1],W[2],e.format,e.openGLDataType,z)}}return e.generateMipmap&&e.context.generateMipmap(e.target),e.allocatedGPUMemoryInBytes=e.width*e.height*e.depth*e.components*e._openGLRenderWindow.getDefaultTextureByteSize(E,r(),t.useHalfFloat()),t.deactivate(),!0},t.create3DFilterableFromRaw=({width:R=j("width"),height:l=j("height"),depth:x=j("depth"),numComps:u=j("numComps"),dataType:p=j("dataType"),data:h=j("data"),preferSizeOverAccuracy:v=!1,ranges:E=void 0,updatedExtents:S=[]}={})=>t.create3DFilterableFromDataArray({width:R,height:l,depth:x,dataArray:ne.newInstance({numberOfComponents:u,dataType:p,values:h,ranges:E}),preferSizeOverAccuracy:v,updatedExtents:S}),t.create3DFilterableFromDataArray=({width:R=j("width"),height:l=j("height"),depth:x=j("depth"),dataArray:u=j("dataArray"),preferSizeOverAccuracy:p=!1,updatedExtents:h=[]}={})=>{const{numComps:v,dataType:E,data:S,scaleOffsets:_}=w(u,p),d=[],L=[];for(let q=0;q<v;++q)d[q]=0,L[q]=1;if(e.volumeInfo={scale:L,offset:d,dataComputedScale:_.scale,dataComputedOffset:_.offset,width:R,height:l,depth:x},e._openGLRenderWindow.getWebgl2())return t.create3DFromRaw({width:R,height:l,depth:x,numComps:v,dataType:E,data:S,updatedExtents:h});const M=R*l*x,D=structuredClone(_);let F=(q,Le,ke,Me,Oe)=>{q[Le]=ke},N=H.UNSIGNED_CHAR;if(E===H.UNSIGNED_CHAR)for(let q=0;q<v;++q)D.offset[q]=0,D.scale[q]=255;else e.context.getExtension("OES_texture_float")&&e.context.getExtension("OES_texture_float_linear")?(N=H.FLOAT,F=(q,Le,ke,Me,Oe)=>{q[Le]=(ke-Me)/Oe}):(N=H.UNSIGNED_CHAR,F=(q,Le,ke,Me,Oe)=>{q[Le]=255*(ke-Me)/Oe});if(t.getOpenGLDataType(N),t.getInternalFormat(N,v),t.getFormat(N,v),!e.internalFormat||!e.format||!e.openGLDataType)return $e("Failed to determine texture parameters."),!1;e.target=e.context.TEXTURE_2D,e.components=v,e.depth=1,e.numberOfDimensions=2;let U=e.context.getParameter(e.context.MAX_TEXTURE_SIZE);U>4096&&(N===H.FLOAT||v>=3)&&(U=4096);let W=1,V=1;M>U*U&&(W=Math.ceil(Math.sqrt(M/(U*U))),V=W);let z=Math.sqrt(M)/W;z=Ie(z);const G=Math.floor(z*W/R),O=Math.ceil(x/G),B=Ie(l*O/V);e.width=z,e.height=B,e._openGLRenderWindow.activateTexture(t),t.createTexture(),t.bind(),e.volumeInfo.xreps=G,e.volumeInfo.yreps=O,e.volumeInfo.xstride=W,e.volumeInfo.ystride=V,e.volumeInfo.offset=D.offset,e.volumeInfo.scale=D.scale;let k;const X=z*B*v;N===H.FLOAT?k=new Float32Array(X):k=new Uint8Array(X);let $=0;const pe=Math.floor(R/W),ie=Math.floor(l/V);for(let q=0;q<O;q++){const Le=Math.min(G,x-q*G),ke=v*(e.width-Le*Math.floor(R/W));for(let Me=0;Me<ie;Me++){for(let Oe=0;Oe<Le;Oe++){const ni=v*((q*G+Oe)*R*l+V*Me*R);for(let fn=0;fn<pe;fn++)for(let ft=0;ft<v;ft++)F(k,$,S[ni+W*fn*v+ft],D.offset[ft],D.scale[ft]),$++}$+=ke}}return e.context.pixelStorei(e.context.UNPACK_ALIGNMENT,1),g(N)?(e.context.texStorage2D(e.target,1,e.internalFormat,e.width,e.height),k!=null&&e.context.texSubImage2D(e.target,0,0,0,e.width,e.height,e.format,e.openGLDataType,k)):e.context.texImage2D(e.target,0,e.internalFormat,e.width,e.height,0,e.format,e.openGLDataType,k),t.deactivate(),!0},t.setOpenGLRenderWindow=R=>{e._openGLRenderWindow!==R&&(t.releaseGraphicsResources(),e._openGLRenderWindow=R,e.context=null,R&&(e.context=e._openGLRenderWindow.getContext()))},t.getMaximumTextureSize=R=>R&&R.isCurrent()?R.getIntegerv(R.MAX_TEXTURE_SIZE):-1,t.enableUseHalfFloat=R=>{e.enableUseHalfFloat=R}}var Ff={_openGLRenderWindow:null,_forceInternalFormat:!1,_prevTexParams:null,context:null,handle:0,sendParametersTime:null,textureBuildTime:null,numberOfDimensions:0,target:0,format:0,openGLDataType:0,components:0,width:0,height:0,depth:0,autoParameters:!0,wrapS:Se.CLAMP_TO_EDGE,wrapT:Se.CLAMP_TO_EDGE,wrapR:Se.CLAMP_TO_EDGE,minificationFilter:A.NEAREST,magnificationFilter:A.NEAREST,minLOD:-1e3,maxLOD:1e3,baseLevel:0,maxLevel:1e3,generateMipmap:!1,oglNorm16Ext:null,allocatedGPUMemoryInBytes:0,enableUseHalfFloat:!0,canUseHalfFloat:!1};function Ma(t,e,n={}){Object.assign(e,Ff,n),An.extend(t,e,n),e.sendParametersTime={},it(e.sendParametersTime,{mtime:0}),e.textureBuildTime={},it(e.textureBuildTime,{mtime:0}),yi(t,e,["format","openGLDataType"]),Ct(t,e,["keyMatrixTime","minificationFilter","magnificationFilter","wrapS","wrapT","wrapR","generateMipmap","oglNorm16Ext"]),Hn(t,e,["width","height","volumeInfo","components","handle","target","allocatedGPUMemoryInBytes"]),Pr(t,e,["openGLRenderWindow"]),Df(t,e)}var Oa=ot(Ma,"vtkOpenGLTexture"),Yt={newInstance:Oa,extend:Ma,...Sa};_a("vtkTexture",Oa);function Bf(t,e){e.classHierarchy.push("vtkFramebuffer"),t.getBothMode=()=>e.context.FRAMEBUFFER,t.saveCurrentBindingsAndBuffers=n=>{const r=typeof n<"u"?n:t.getBothMode();t.saveCurrentBindings(r),t.saveCurrentBuffers(r)},t.saveCurrentBindings=n=>{if(!e.context){I("you must set the OpenGLRenderWindow before calling saveCurrentBindings");return}e.previousDrawBinding=e.context.getParameter(e.context.FRAMEBUFFER_BINDING),e.previousActiveFramebuffer=e._openGLRenderWindow.getActiveFramebuffer()},t.saveCurrentBuffers=n=>{},t.restorePreviousBindingsAndBuffers=n=>{const r=typeof n<"u"?n:t.getBothMode();t.restorePreviousBindings(r),t.restorePreviousBuffers(r)},t.restorePreviousBindings=n=>{if(!e.context){I("you must set the OpenGLRenderWindow before calling restorePreviousBindings");return}const r=e.context;r.bindFramebuffer(r.FRAMEBUFFER,e.previousDrawBinding),e._openGLRenderWindow.setActiveFramebuffer(e.previousActiveFramebuffer)},t.restorePreviousBuffers=n=>{},t.bind=(n=null)=>{let r=n;r===null&&(r=e.context.FRAMEBUFFER),e.context.bindFramebuffer(r,e.glFramebuffer);for(let s=0;s<e.colorBuffers.length;s++)e.colorBuffers[s].bind();e._openGLRenderWindow.setActiveFramebuffer(t)},t.create=(n,r)=>{if(!e.context){I("you must set the OpenGLRenderWindow before calling create");return}e.glFramebuffer=e.context.createFramebuffer(),e.glFramebuffer.width=n,e.glFramebuffer.height=r},t.setColorBuffer=(n,r=0)=>{const s=e.context;if(!s){I("you must set the OpenGLRenderWindow before calling setColorBuffer");return}let a=s.COLOR_ATTACHMENT0;if(r>0)if(e._openGLRenderWindow.getWebgl2())a+=r;else{I("Using multiple framebuffer attachments requires WebGL 2");return}e.colorBuffers[r]=n,s.framebufferTexture2D(s.FRAMEBUFFER,a,s.TEXTURE_2D,n.getHandle(),0)},t.removeColorBuffer=(n=0)=>{const r=e.context;if(!r){I("you must set the OpenGLRenderWindow before calling removeColorBuffer");return}let s=r.COLOR_ATTACHMENT0;if(n>0)if(e._openGLRenderWindow.getWebgl2())s+=n;else{I("Using multiple framebuffer attachments requires WebGL 2");return}r.framebufferTexture2D(r.FRAMEBUFFER,s,r.TEXTURE_2D,null,0),e.colorBuffers=e.colorBuffers.splice(n,1)},t.setDepthBuffer=n=>{if(!e.context){I("you must set the OpenGLRenderWindow before calling setDepthBuffer");return}if(e._openGLRenderWindow.getWebgl2()){const r=e.context;r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,n.getHandle(),0)}else I("Attaching depth buffer textures to fbo requires WebGL 2")},t.removeDepthBuffer=()=>{if(!e.context){I("you must set the OpenGLRenderWindow before calling removeDepthBuffer");return}if(e._openGLRenderWindow.getWebgl2()){const n=e.context;n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,null,0)}else I("Attaching depth buffer textures to framebuffers requires WebGL 2")},t.getGLFramebuffer=()=>e.glFramebuffer,t.setOpenGLRenderWindow=n=>{e._openGLRenderWindow!==n&&(t.releaseGraphicsResources(),e._openGLRenderWindow=n,e.context=null,n&&(e.context=e._openGLRenderWindow.getContext()))},t.releaseGraphicsResources=()=>{e.glFramebuffer&&e.context.deleteFramebuffer(e.glFramebuffer)},t.getSize=()=>e.glFramebuffer==null?null:[e.glFramebuffer.width,e.glFramebuffer.height],t.populateFramebuffer=()=>{if(!e.context){I("you must set the OpenGLRenderWindow before calling populateFrameBuffer");return}t.bind();const n=e.context,r=Yt.newInstance();r.setOpenGLRenderWindow(e._openGLRenderWindow),r.setMinificationFilter(Un.LINEAR),r.setMagnificationFilter(Un.LINEAR),r.create2DFromRaw({width:e.glFramebuffer.width,height:e.glFramebuffer.height,numComps:4,dataType:ee.UNSIGNED_CHAR,data:null}),t.setColorBuffer(r),e.depthTexture=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,e.depthTexture),n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,e.glFramebuffer.width,e.glFramebuffer.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,e.depthTexture)},t.getColorTexture=()=>e.colorBuffers[0]}var Nf={glFramebuffer:null,colorBuffers:null,depthTexture:null,previousDrawBinding:0,previousReadBinding:0,previousDrawBuffer:0,previousReadBuffer:0,previousActiveFramebuffer:null};function Da(t,e,n={}){Object.assign(e,Nf,n),it(t,e),e.colorBuffers&&I("you cannot initialize colorBuffers through the constructor. You should call setColorBuffer() instead."),e.colorBuffers=[],ta(t,e,["colorBuffers"]),Bf(t,e)}var Gf=ot(Da,"vtkFramebuffer"),bn={newInstance:Gf,extend:Da};function Uf(t,e){e.classHierarchy.push("vtkRenderPass"),t.getOperation=()=>e.currentOperation,t.setCurrentOperation=n=>{e.currentOperation=n,e.currentTraverseOperation=`traverse${C.capitalize(e.currentOperation)}`},t.getTraverseOperation=()=>e.currentTraverseOperation,t.traverse=(n,r=null)=>{e.deleted||(e._currentParent=r,e.preDelegateOperations.forEach(s=>{t.setCurrentOperation(s),n.traverse(t)}),e.delegates.forEach(s=>{s.traverse(n,t)}),e.postDelegateOperations.forEach(s=>{t.setCurrentOperation(s),n.traverse(t)}))}}var Vf={delegates:[],currentOperation:null,preDelegateOperations:[],postDelegateOperations:[],currentParent:null};function Fa(t,e,n={}){Object.assign(e,Vf,n),C.obj(t,e),C.get(t,e,["currentOperation"]),C.setGet(t,e,["delegates","_currentParent","preDelegateOperations","postDelegateOperations"]),C.moveToProtected(t,e,["currentParent"]),Uf(t,e)}var kf=C.newInstance(Fa,"vtkRenderPass"),In={newInstance:kf,extend:Fa},xt={ARRAY_BUFFER:0,ELEMENT_ARRAY_BUFFER:1,TEXTURE_BUFFER:2},Ba={ObjectType:xt};function $f(t,e){e.classHierarchy.push("vtkOpenGLVertexArrayObject"),t.exposedMethod=()=>{},t.initialize=()=>{e.instancingExtension=null,e._openGLRenderWindow.getWebgl2()||(e.instancingExtension=e.context.getExtension("ANGLE_instanced_arrays")),!e.forceEmulation&&e._openGLRenderWindow&&e._openGLRenderWindow.getWebgl2()?(e.extension=null,e.supported=!0,e.handleVAO=e.context.createVertexArray()):(e.extension=e.context.getExtension("OES_vertex_array_object"),!e.forceEmulation&&e.extension?(e.supported=!0,e.handleVAO=e.extension.createVertexArrayOES()):e.supported=!1)},t.isReady=()=>e.handleVAO!==0||e.supported===!1,t.bind=()=>{if(t.isReady()||t.initialize(),t.isReady()&&e.supported)e.extension?e.extension.bindVertexArrayOES(e.handleVAO):e.context.bindVertexArray(e.handleVAO);else if(t.isReady()){const n=e.context;for(let r=0;r<e.buffers.length;++r){const s=e.buffers[r];e.context.bindBuffer(n.ARRAY_BUFFER,s.buffer);for(let a=0;a<s.attributes.length;++a){const i=s.attributes[a],o=i.isMatrix?i.size:1;for(let c=0;c<o;++c)n.enableVertexAttribArray(i.index+c),n.vertexAttribPointer(i.index+c,i.size,i.type,i.normalize,i.stride,i.offset+i.stride*c/i.size),i.divisor>0&&(e.instancingExtension?e.instancingExtension.vertexAttribDivisorANGLE(i.index+c,1):n.vertexAttribDivisor(i.index+c,1))}}}},t.release=()=>{if(t.isReady()&&e.supported)e.extension?e.extension.bindVertexArrayOES(null):e.context.bindVertexArray(null);else if(t.isReady()){const n=e.context;for(let r=0;r<e.buffers.length;++r){const s=e.buffers[r];e.context.bindBuffer(n.ARRAY_BUFFER,s.buffer);for(let a=0;a<s.attributes.length;++a){const i=s.attributes[a],o=i.isMatrix?i.size:1;for(let c=0;c<o;++c)n.enableVertexAttribArray(i.index+c),n.vertexAttribPointer(i.index+c,i.size,i.type,i.normalize,i.stride,i.offset+i.stride*c/i.size),i.divisor>0&&(e.instancingExtension?e.instancingExtension.vertexAttribDivisorANGLE(i.index+c,0):n.vertexAttribDivisor(i.index+c,0)),n.disableVertexAttribArray(i.index+c)}}}},t.shaderProgramChanged=()=>{t.release(),e.handleVAO&&(e.extension?e.extension.deleteVertexArrayOES(e.handleVAO):e.context.deleteVertexArray(e.handleVAO)),e.handleVAO=0,e.handleProgram=0},t.releaseGraphicsResources=()=>{t.shaderProgramChanged(),e.handleVAO&&(e.extension?e.extension.deleteVertexArrayOES(e.handleVAO):e.context.deleteVertexArray(e.handleVAO)),e.handleVAO=0,e.supported=!0,e.handleProgram=0},t.addAttributeArray=(n,r,s,a,i,o,c,g)=>t.addAttributeArrayWithDivisor(n,r,s,a,i,o,c,g,0,!1),t.addAttributeArrayWithDivisor=(n,r,s,a,i,o,c,g,T,f)=>{if(!n||!n.isBound()||r.getHandle()===0||r.getType()!==xt.ARRAY_BUFFER||(e.handleProgram===0&&(e.handleProgram=n.getHandle()),t.isReady()||t.initialize(),!t.isReady()||e.handleProgram!==n.getHandle()))return!1;const y=e.context,w={};if(w.name=s,w.index=y.getAttribLocation(e.handleProgram,s),w.offset=a,w.stride=i,w.type=o,w.size=c,w.normalize=g,w.isMatrix=f,w.divisor=T,w.Index===-1)return!1;if(r.bind(),y.enableVertexAttribArray(w.index),y.vertexAttribPointer(w.index,w.size,w.type,w.normalize,w.stride,w.offset),T>0&&(e.instancingExtension?e.instancingExtension.vertexAttribDivisorANGLE(w.index,1):y.vertexAttribDivisor(w.index,1)),w.buffer=r.getHandle(),!e.supported){let R=!1;for(let l=0;l<e.buffers.length;++l){const x=e.buffers[l];if(x.buffer===w.buffer){R=!0;let u=!1;for(let p=0;p<x.attributes.length;++p)x.attributes[p].name===s&&(u=!0,x.attributes[p]=w);u||x.attributes.push(w)}}R||e.buffers.push({buffer:w.buffer,attributes:[w]})}return!0},t.addAttributeMatrixWithDivisor=(n,r,s,a,i,o,c,g,T)=>{const f=t.addAttributeArrayWithDivisor(n,r,s,a,i,o,c,g,T,!0);if(!f)return f;const y=e.context,w=y.getAttribLocation(e.handleProgram,s);for(let R=1;R<c;R++)y.enableVertexAttribArray(w+R),y.vertexAttribPointer(w+R,c,o,g,i,a+i*R/c),T>0&&(e.instancingExtension?e.instancingExtension.vertexAttribDivisorANGLE(w+R,1):y.vertexAttribDivisor(w+R,1));return!0},t.removeAttributeArray=n=>{if(!t.isReady()||e.handleProgram===0)return!1;if(!e.supported)for(let r=0;r<e.buffers.length;++r){const s=e.buffers[r];for(let a=0;a<s.attributes.length;++a)if(s.attributes[a].name===n)return s.attributes.splice(a,1),s.attributes.length||e.buffers.splice(r,1),!0}return!0},t.setOpenGLRenderWindow=n=>{e._openGLRenderWindow!==n&&(t.releaseGraphicsResources(),e._openGLRenderWindow=n,e.context=null,n&&(e.context=e._openGLRenderWindow.getContext()))}}var Wf={forceEmulation:!1,handleVAO:0,handleProgram:0,supported:!0,buffers:null,context:null};function Na(t,e,n={}){Object.assign(e,Wf,n),e.buffers=[],C.obj(t,e),C.get(t,e,["supported"]),C.setGet(t,e,["forceEmulation"]),$f(t,e)}var Hf=C.newInstance(Na,"vtkOpenGLVertexArrayObject"),Ga={newInstance:Hf,extend:Na},{ObjectType:Zt}=Ba,zf={};function jf(t,e){e.classHierarchy.push("vtkOpenGLBufferObject");function n(o){switch(o){case Zt.ELEMENT_ARRAY_BUFFER:return e.context.ELEMENT_ARRAY_BUFFER;case Zt.TEXTURE_BUFFER:if("TEXTURE_BUFFER"in e.context)return e.context.TEXTURE_BUFFER;case Zt.ARRAY_BUFFER:default:return e.context.ARRAY_BUFFER}}let r=null,s=null,a=!0,i="";t.getType=()=>r,t.setType=o=>{r=o},t.getHandle=()=>s,t.isReady=()=>a===!1,t.generateBuffer=o=>{const c=n(o);return s===null&&(s=e.context.createBuffer(),r=o),n(r)===c},t.upload=(o,c)=>t.generateBuffer(c)?(e.context.bindBuffer(n(r),s),e.context.bufferData(n(r),o,e.context.STATIC_DRAW),e.allocatedGPUMemoryInBytes=o.length*o.BYTES_PER_ELEMENT,a=!1,!0):(i="Trying to upload array buffer to incompatible buffer.",!1),t.bind=()=>s?(e.context.bindBuffer(n(r),s),!0):!1,t.release=()=>s?(e.context.bindBuffer(n(r),null),!0):!1,t.releaseGraphicsResources=()=>{s!==null&&(e.context.bindBuffer(n(r),null),e.context.deleteBuffer(s),s=null,e.allocatedGPUMemoryInBytes=0)},t.setOpenGLRenderWindow=o=>{e._openGLRenderWindow!==o&&(t.releaseGraphicsResources(),e._openGLRenderWindow=o,e.context=null,o&&(e.context=e._openGLRenderWindow.getContext()))},t.getError=()=>i}var Xf={objectType:Zt.ARRAY_BUFFER,context:null,allocatedGPUMemoryInBytes:0};function Ua(t,e,n={}){Object.assign(e,Xf,n),C.obj(t,e),C.get(t,e,["_openGLRenderWindow","allocatedGPUMemoryInBytes"]),C.moveToProtected(t,e,["openGLRenderWindow"]),jf(t,e)}var Kf=C.newInstance(Ua),Va={newInstance:Kf,extend:Ua,...zf,...Ba};function Yf(t){let e=0,n=0;for(let s=0;s<3;++s){const a=t.getRange(s),i=a[1]-a[0];e+=i*i;const o=.5*(a[1]+a[0]);n+=o*o}const r=e>0&&(Math.abs(n)/e>1e6||Math.abs(Math.log10(e))>3||e===0&&n>1e6);if(r){const s=new Float64Array(3),a=new Float64Array(3);for(let i=0;i<3;++i){const o=t.getRange(i),c=o[1]-o[0];s[i]=.5*(o[1]+o[0]),a[i]=c>0?1/c:1}return{useShiftAndScale:r,coordShift:s,coordScale:a}}return{useShiftAndScale:r,coordShift:new Float32Array([0,0,0]),coordScale:new Float32Array([1,1,1])}}function Zf(t,e){const n=new Float64Array(3);xi(n,e);const r=new Float64Array(16);return Ei(r,qe(),t,n),r}var{vtkErrorMacro:_r}=C;function Qf(t,e){return t===null||e===null?!1:!(fr(t,[0,0,0])&&fr(e,[1,1,1]))}function Jf(t,e){e.classHierarchy.push("vtkOpenGLCellArrayBufferObject"),t.setType(xt.ARRAY_BUFFER),t.createVBO=(n,r,s,a,i=null)=>{if(!n.getData()||!n.getData().length)return e.elementCount=0,0;e.blockSize=3,e.vertexOffset=0,e.normalOffset=0,e.tCoordOffset=0,e.tCoordComponents=0,e.colorComponents=0,e.colorOffset=0,e.customData=[];const o=a.points.getData();let c=null,g=null,T=null;const f=a.colors?a.colors.getNumberOfComponents():0,y=a.tcoords?a.tcoords.getNumberOfComponents():0;a.normals&&(e.normalOffset=4*e.blockSize,e.blockSize+=3,c=a.normals.getData()),a.customAttributes&&a.customAttributes.forEach(O=>{O&&(e.customData.push({data:O.getData(),offset:4*e.blockSize,components:O.getNumberOfComponents(),name:O.getName()}),e.blockSize+=O.getNumberOfComponents())}),a.tcoords&&(e.tCoordOffset=4*e.blockSize,e.tCoordComponents=y,e.blockSize+=y,g=a.tcoords.getData()),a.colors?(e.colorComponents=a.colors.getNumberOfComponents(),e.colorOffset=0,T=a.colors.getData(),e.colorBO||(e.colorBO=Va.newInstance()),e.colorBO.setOpenGLRenderWindow(e._openGLRenderWindow)):e.colorBO=null,e.stride=4*e.blockSize;let w=0,R=0,l=0,x=0,u=0,p=0,h;const v={anythingToPoints(O,B,k,X){for(let $=0;$<O;++$)h(B[k+$],X)},linesToWireframe(O,B,k,X){for(let $=0;$<O-1;++$)h(B[k+$],X),h(B[k+$+1],X)},polysToWireframe(O,B,k,X){if(O>2)for(let $=0;$<O;++$)h(B[k+$],X),h(B[k+($+1)%O],X)},stripsToWireframe(O,B,k,X){if(O>2){for(let $=0;$<O-1;++$)h(B[k+$],X),h(B[k+$+1],X);for(let $=0;$<O-2;$++)h(B[k+$],X),h(B[k+$+2],X)}},polysToSurface(O,B,k,X){for(let $=0;$<O-2;$++)h(B[k+0],X),h(B[k+$+1],X),h(B[k+$+2],X)},stripsToSurface(O,B,k,X){for(let $=0;$<O-2;$++)h(B[k+$],X),h(B[k+$+1+$%2],X),h(B[k+$+1+($+1)%2],X)}},E={anythingToPoints(O,B){return O},linesToWireframe(O,B){return O>1?(O-1)*2:0},polysToWireframe(O,B){return O>2?O*2:0},stripsToWireframe(O,B){return O>2?O*4-6:0},polysToSurface(O,B){return O>2?(O-2)*3:0},stripsToSurface(O,B,k){return O>2?(O-2)*3:0}};let S=null,_=null;s===st.POINTS||r==="verts"?(S=v.anythingToPoints,_=E.anythingToPoints):s===st.WIREFRAME||r==="lines"?(S=v[`${r}ToWireframe`],_=E[`${r}ToWireframe`]):(S=v[`${r}ToSurface`],_=E[`${r}ToSurface`]);const d=n.getData(),L=d.length;let M=0;for(let O=0;O<L;)M+=_(d[O],d),O+=d[O]+1;let D=null;const F=new Float32Array(M*e.blockSize);T&&(D=new Uint8Array(M*4));let N=0,U=0;const{useShiftAndScale:W,coordShift:V,coordScale:z}=Yf(a.points);if(W?t.setCoordShiftAndScale(V,z):e.coordShiftAndScaleEnabled===!0&&t.setCoordShiftAndScale(null,null),i)if(!i.points&&!i.cells)i.points=new Int32Array(M),i.cells=new Int32Array(M);else{const O=new Int32Array(M+i.points.length);O.set(i.points),i.points=O;const B=new Int32Array(M+i.cells.length);B.set(i.cells),i.cells=B}let G=a.vertexOffset;h=function(B,k){if(i&&(i.points[G]=B,i.cells[G]=p+a.cellOffset),++G,w=B*3,e.coordShiftAndScaleEnabled?(F[N++]=(o[w++]-e.coordShift[0])*e.coordScale[0],F[N++]=(o[w++]-e.coordShift[1])*e.coordScale[1],F[N++]=(o[w++]-e.coordShift[2])*e.coordScale[2]):(F[N++]=o[w++],F[N++]=o[w++],F[N++]=o[w++]),c!==null&&(a.haveCellNormals?R=(p+a.cellOffset)*3:R=B*3,F[N++]=c[R++],F[N++]=c[R++],F[N++]=c[R++]),e.customData.forEach(X=>{u=B*X.components;for(let $=0;$<X.components;++$)F[N++]=X.data[u++]}),g!==null){a.useTCoordsPerCell?l=k*y:l=B*y;for(let X=0;X<y;++X)F[N++]=g[l++]}T!==null&&(a.haveCellScalars?x=(p+a.cellOffset)*f:x=B*f,D[U++]=T[x++],D[U++]=T[x++],D[U++]=T[x++],D[U++]=f===4?T[x++]:255)};for(let O=0;O<L;O+=d[O]+1,p++)S(d[O],d,O+1,p+a.cellOffset);return e.elementCount=M,t.upload(F,xt.ARRAY_BUFFER),e.colorBO&&(e.colorBOStride=4,e.colorBO.upload(D,xt.ARRAY_BUFFER)),p},t.setCoordShiftAndScale=(n,r)=>{if(n!==null&&(n.constructor!==Float64Array||n.length!==3)){_r("Wrong type for coordShift, expected vec3 or null");return}if(r!==null&&(r.constructor!==Float64Array||r.length!==3)){_r("Wrong type for coordScale, expected vec3 or null");return}(e.coordShift===null||n===null||!or(n,e.coordShift))&&(e.coordShift=n),(e.coordScale===null||r===null||!or(r,e.coordScale))&&(e.coordScale=r),e.coordShiftAndScaleEnabled=Qf(e.coordShift,e.coordScale),e.coordShiftAndScaleEnabled?e.inverseShiftAndScaleMatrix=Zf(e.coordShift,e.coordScale):e.inverseShiftAndScaleMatrix=null}}var qf={elementCount:0,stride:0,colorBOStride:0,vertexOffset:0,normalOffset:0,tCoordOffset:0,tCoordComponents:0,colorOffset:0,colorComponents:0,tcoordBO:null,customData:[],coordShift:null,coordScale:null,coordShiftAndScaleEnabled:!1,inverseShiftAndScaleMatrix:null};function ka(t,e,n={}){Object.assign(e,qf,n),Va.extend(t,e,n),C.setGet(t,e,["colorBO","elementCount","stride","colorBOStride","vertexOffset","normalOffset","tCoordOffset","tCoordComponents","colorOffset","colorComponents","customData"]),C.get(t,e,["coordShift","coordScale","coordShiftAndScaleEnabled","inverseShiftAndScaleMatrix"]),Jf(t,e)}var Af=C.newInstance(ka),bf={newInstance:Af,extend:ka},{vtkErrorMacro:If}=C;function mf(t,e){e.classHierarchy.push("vtkShader"),t.compile=()=>{let n=e.context.VERTEX_SHADER;if(!e.source||!e.source.length||e.shaderType==="Unknown")return!1;if(e.handle!==0&&(e.context.deleteShader(e.handle),e.handle=0),e.shaderType==="Fragment"?n=e.context.FRAGMENT_SHADER:n=e.context.VERTEX_SHADER,e.handle=e.context.createShader(n),e.context.shaderSource(e.handle,e.source),e.context.compileShader(e.handle),!e.context.getShaderParameter(e.handle,e.context.COMPILE_STATUS)){const r=e.context.getShaderInfoLog(e.handle);return If(`Error compiling shader '${e.source}': ${r}`),e.context.deleteShader(e.handle),e.handle=0,!1}return!0},t.cleanup=()=>{e.shaderType==="Unknown"||e.handle===0||(e.context.deleteShader(e.handle),e.handle=0,e.dirty=!0)}}var Pf={shaderType:"Unknown",source:"",error:"",handle:0,dirty:!1,context:null};function $a(t,e,n={}){Object.assign(e,Pf,n),C.obj(t,e),C.setGet(t,e,["shaderType","source","error","handle","context"]),mf(t,e)}var ec=C.newInstance($a,"vtkShader"),vn={newInstance:ec,extend:$a},{vtkErrorMacro:Te}=C;function tc(t,e,n,r){const s=typeof n=="string"?n:n.join(`
|
|
21
|
+
`),a=r===!1?e:new RegExp(e,"g"),i=t.replace(a,s);return{replace:i!==s,result:i}}function nc(t,e){e.classHierarchy.push("vtkShaderProgram"),t.compileShader=()=>e.vertexShader.compile()?e.fragmentShader.compile()?!t.attachShader(e.vertexShader)||!t.attachShader(e.fragmentShader)?(Te(e.error),0):t.link()?(t.setCompiled(!0),1):(Te(`Links failed: ${e.error}`),0):(Te(e.fragmentShader.getSource().split(`
|
|
22
|
+
`).map((n,r)=>`${r}: ${n}`).join(`
|
|
23
|
+
`)),Te(e.fragmentShader.getError()),0):(Te(e.vertexShader.getSource().split(`
|
|
24
|
+
`).map((n,r)=>`${r}: ${n}`).join(`
|
|
25
|
+
`)),Te(e.vertexShader.getError()),0),t.cleanup=()=>{e.shaderType==="Unknown"||e.handle===0||(t.release(),e.vertexShaderHandle!==0&&(e.context.detachShader(e.handle,e.vertexShaderHandle),e.vertexShaderHandle=0),e.fragmentShaderHandle!==0&&(e.context.detachShader(e.handle,e.fragmentShaderHandle),e.fragmentShaderHandle=0),e.context.deleteProgram(e.handle),e.handle=0,t.setCompiled(!1))},t.bind=()=>!e.linked&&!t.link()?!1:(e.context.useProgram(e.handle),t.setBound(!0),!0),t.isBound=()=>!!e.bound,t.release=()=>{e.context.useProgram(null),t.setBound(!1)},t.setContext=n=>{e.vertexShader.setContext(n),e.fragmentShader.setContext(n),e.geometryShader.setContext(n)},t.link=()=>e.linked?!0:e.handle===0?(e.error="Program has not been initialized, and/or does not have shaders.",!1):(e.uniformLocs={},e.context.linkProgram(e.handle),e.context.getProgramParameter(e.handle,e.context.LINK_STATUS)?(t.setLinked(!0),e.attributeLocs={},!0):(Te(`Error linking shader ${e.context.getProgramInfoLog(e.handle)}`),e.handle=0,!1)),t.setUniformMatrix=(n,r)=>{const s=t.findUniform(n);if(s===-1)return e.error=`Could not set uniform ${n} . No such uniform.`,!1;const a=new Float32Array(r);return e.context.uniformMatrix4fv(s,!1,a),!0},t.setUniformMatrix3x3=(n,r)=>{const s=t.findUniform(n);if(s===-1)return e.error=`Could not set uniform ${n} . No such uniform.`,!1;const a=new Float32Array(r);return e.context.uniformMatrix3fv(s,!1,a),!0},t.setUniformf=(n,r)=>{const s=t.findUniform(n);return s===-1?(e.error=`Could not set uniform ${n} . No such uniform.`,!1):(e.context.uniform1f(s,r),!0)},t.setUniformfv=(n,r)=>{const s=t.findUniform(n);return s===-1?(e.error=`Could not set uniform ${n} . No such uniform.`,!1):(e.context.uniform1fv(s,r),!0)},t.setUniformi=(n,r)=>{const s=t.findUniform(n);return s===-1?(e.error=`Could not set uniform ${n} . No such uniform.`,!1):(e.context.uniform1i(s,r),!0)},t.setUniformiv=(n,r)=>{const s=t.findUniform(n);return s===-1?(e.error=`Could not set uniform ${n} . No such uniform.`,!1):(e.context.uniform1iv(s,r),!0)},t.setUniform2f=(n,r,s)=>{const a=t.findUniform(n);if(a===-1)return e.error=`Could not set uniform ${n} . No such uniform.`,!1;if(s===void 0)throw new RangeError("Invalid number of values for array");return e.context.uniform2f(a,r,s),!0},t.setUniform2fv=(n,r)=>{const s=t.findUniform(n);return s===-1?(e.error=`Could not set uniform ${n} . No such uniform.`,!1):(e.context.uniform2fv(s,r),!0)},t.setUniform2i=(n,r,s)=>{const a=t.findUniform(n);if(a===-1)return e.error=`Could not set uniform ${n} . No such uniform.`,!1;if(s===void 0)throw new RangeError("Invalid number of values for array");return e.context.uniform2i(a,r,s),!0},t.setUniform2iv=(n,r)=>{const s=t.findUniform(n);return s===-1?(e.error=`Could not set uniform ${n} . No such uniform.`,!1):(e.context.uniform2iv(s,r),!0)},t.setUniform3f=(n,r,s,a)=>{const i=t.findUniform(n);if(i===-1)return e.error=`Could not set uniform ${n} . No such uniform.`,!1;if(a===void 0)throw new RangeError("Invalid number of values for array");return e.context.uniform3f(i,r,s,a),!0},t.setUniform3fArray=(n,r)=>{const s=t.findUniform(n);if(s===-1)return e.error=`Could not set uniform ${n} . No such uniform.`,!1;if(!Array.isArray(r)||r.length!==3)throw new RangeError("Invalid number of values for array");return e.context.uniform3f(s,r[0],r[1],r[2]),!0},t.setUniform3fv=(n,r)=>{const s=t.findUniform(n);return s===-1?(e.error=`Could not set uniform ${n} . No such uniform.`,!1):(e.context.uniform3fv(s,r),!0)},t.setUniform3i=(n,...r)=>{const s=t.findUniform(n);if(s===-1)return e.error=`Could not set uniform ${n} . No such uniform.`,!1;let a=r;if(a.length===1&&Array.isArray(a[0])&&(a=a[0]),a.length!==3)throw new RangeError("Invalid number of values for array");return e.context.uniform3i(s,a[0],a[1],a[2]),!0},t.setUniform3iv=(n,r)=>{const s=t.findUniform(n);return s===-1?(e.error=`Could not set uniform ${n} . No such uniform.`,!1):(e.context.uniform3iv(s,r),!0)},t.setUniform4f=(n,...r)=>{const s=t.findUniform(n);if(s===-1)return e.error=`Could not set uniform ${n} . No such uniform.`,!1;let a=r;if(a.length===1&&Array.isArray(a[0])&&(a=a[0]),a.length!==4)throw new RangeError("Invalid number of values for array");return e.context.uniform4f(s,a[0],a[1],a[2],a[3]),!0},t.setUniform4fv=(n,r)=>{const s=t.findUniform(n);return s===-1?(e.error=`Could not set uniform ${n} . No such uniform.`,!1):(e.context.uniform4fv(s,r),!0)},t.setUniform4i=(n,...r)=>{const s=t.findUniform(n);if(s===-1)return e.error=`Could not set uniform ${n} . No such uniform.`,!1;let a=r;if(a.length===1&&Array.isArray(a[0])&&(a=a[0]),a.length!==4)throw new RangeError("Invalid number of values for array");return e.context.uniform4i(s,a[0],a[1],a[2],a[3]),!0},t.setUniform4iv=(n,r)=>{const s=t.findUniform(n);return s===-1?(e.error=`Could not set uniform ${n} . No such uniform.`,!1):(e.context.uniform4iv(s,r),!0)},t.findUniform=n=>{if(!n||!e.linked)return-1;let r=e.uniformLocs[n];return r!==void 0?r:(r=e.context.getUniformLocation(e.handle,n),r===null?(e.error=`Uniform ${n} not found in current shader program.`,e.uniformLocs[n]=-1,-1):(e.uniformLocs[n]=r,r))},t.isUniformUsed=n=>{if(!n)return!1;let r=e.uniformLocs[n];return r!==void 0?r!==null:e.linked?(r=e.context.getUniformLocation(e.handle,n),e.uniformLocs[n]=r,r!==null):(Te("attempt to find uniform when the shader program is not linked"),!1)},t.isAttributeUsed=n=>{if(!n)return!1;if(n in e.attributeLocs)return!0;if(!e.linked)return Te("attempt to find uniform when the shader program is not linked"),!1;const r=e.context.getAttribLocation(e.handle,n);return r===-1?!1:(e.attributeLocs[n]=r,!0)},t.attachShader=n=>{if(n.getHandle()===0)return e.error="Shader object was not initialized, cannot attach it.",!1;if(n.getShaderType()==="Unknown")return e.error="Shader object is of type Unknown and cannot be used.",!1;if(e.handle===0){const r=e.context.createProgram();if(r===0)return e.error="Could not create shader program.",!1;e.handle=r,e.linked=!1}return n.getShaderType()==="Vertex"&&(e.vertexShaderHandle!==0&&e.context.detachShader(e.handle,e.vertexShaderHandle),e.vertexShaderHandle=n.getHandle()),n.getShaderType()==="Fragment"&&(e.fragmentShaderHandle!==0&&e.context.detachShader(e.handle,e.fragmentShaderHandle),e.fragmentShaderHandle=n.getHandle()),e.context.attachShader(e.handle,n.getHandle()),t.setLinked(!1),!0},t.detachShader=n=>{if(n.getHandle()===0)return e.error="shader object was not initialized, cannot attach it.",!1;if(n.getShaderType()==="Unknown")return e.error="Shader object is of type Unknown and cannot be used.",!1;switch(e.handle===0&&(e.error="This shader program has not been initialized yet."),n.getShaderType()){case"Vertex":return e.vertexShaderHandle!==n.getHandle()?(e.error="The supplied shader was not attached to this program.",!1):(e.context.detachShader(e.handle,n.getHandle()),e.vertexShaderHandle=0,e.linked=!1,!0);case"Fragment":return e.fragmentShaderHandle!==n.getHandle()?(e.error="The supplied shader was not attached to this program.",!1):(e.context.detachShader(e.handle,n.getHandle()),e.fragmentShaderHandle=0,e.linked=!1,!0);default:return!1}},t.setContext=n=>{e.context=n,e.vertexShader.setContext(n),e.fragmentShader.setContext(n),e.geometryShader.setContext(n)},t.setLastCameraMTime=n=>{e.lastCameraMTime=n}}var rc={vertexShaderHandle:0,fragmentShaderHandle:0,geometryShaderHandle:0,vertexShader:null,fragmentShader:null,geometryShader:null,linked:!1,bound:!1,compiled:!1,error:"",handle:0,numberOfOutputs:0,attributesLocs:null,uniformLocs:null,md5Hash:0,context:null,lastCameraMTime:null};function Lr(t,e,n={}){Object.assign(e,rc,n),e.attributesLocs={},e.uniformLocs={},e.vertexShader=vn.newInstance(),e.vertexShader.setShaderType("Vertex"),e.fragmentShader=vn.newInstance(),e.fragmentShader.setShaderType("Fragment"),e.geometryShader=vn.newInstance(),e.geometryShader.setShaderType("Geometry"),C.obj(t,e),C.get(t,e,["lastCameraMTime"]),C.setGet(t,e,["error","handle","compiled","bound","md5Hash","vertexShader","fragmentShader","geometryShader","linked"]),nc(t,e)}var ae={newInstance:C.newInstance(Lr,"vtkShaderProgram"),extend:Lr,substitute:tc},Be={Start:0,Points:0,Lines:1,Tris:2,TriStrips:3,TrisEdges:4,TriStripsEdges:5,End:6};function ac(t,e){e.classHierarchy.push("vtkOpenGLHelper"),t.setOpenGLRenderWindow=n=>{e.context=n.getContext(),e.program.setContext(e.context),e.VAO.setOpenGLRenderWindow(n),e.CABO.setOpenGLRenderWindow(n)},t.releaseGraphicsResources=n=>{e.VAO.releaseGraphicsResources(),e.CABO.releaseGraphicsResources(),e.CABO.setElementCount(0)},t.drawArrays=(n,r,s,a)=>{if(e.CABO.getElementCount()){const i=t.getOpenGLMode(s),o=t.haveWideLines(n,r),c=e.context,g=c.getParameter(c.DEPTH_WRITEMASK);e.pointPicking&&c.depthMask(!1),i===c.LINES&&o?(t.updateShaders(n,r,a),c.drawArraysInstanced(i,0,e.CABO.getElementCount(),2*Math.ceil(r.getProperty().getLineWidth()))):(c.lineWidth(r.getProperty().getLineWidth()),t.updateShaders(n,r,a),c.drawArrays(i,0,e.CABO.getElementCount()),c.lineWidth(1));const T=(i===c.POINTS?1:0)||(i===c.LINES?2:3);return e.pointPicking&&c.depthMask(g),e.CABO.getElementCount()/T}return 0},t.getOpenGLMode=n=>{if(e.pointPicking)return e.context.POINTS;const r=e.primitiveType;return n===st.POINTS||r===Be.Points?e.context.POINTS:n===st.WIREFRAME||r===Be.Lines||r===Be.TrisEdges||r===Be.TriStripsEdges?e.context.LINES:e.context.TRIANGLES},t.haveWideLines=(n,r)=>r.getProperty().getLineWidth()>1?!(e.CABO.getOpenGLRenderWindow()&&e.CABO.getOpenGLRenderWindow().getHardwareMaximumLineWidth()>=r.getProperty().getLineWidth()):!1,t.getNeedToRebuildShaders=(n,r,s)=>!!(s.getNeedToRebuildShaders(t,n,r)||t.getProgram()===0||t.getShaderSourceTime().getMTime()<s.getMTime()||t.getShaderSourceTime().getMTime()<r.getMTime()),t.updateShaders=(n,r,s)=>{if(t.getNeedToRebuildShaders(n,r,s)){const a={Vertex:null,Fragment:null,Geometry:null};s.buildShaders(a,n,r);const i=e.CABO.getOpenGLRenderWindow().getShaderCache().readyShaderProgramArray(a.Vertex,a.Fragment,a.Geometry);i!==t.getProgram()&&(t.setProgram(i),t.getVAO().releaseGraphicsResources()),t.getShaderSourceTime().modified()}else e.CABO.getOpenGLRenderWindow().getShaderCache().readyShaderProgram(t.getProgram());t.getVAO().bind(),s.setMapperShaderParameters(t,n,r),s.setPropertyShaderParameters(t,n,r),s.setCameraShaderParameters(t,n,r),s.setLightingShaderParameters(t,n,r),s.invokeShaderCallbacks(t,n,r)},t.setMapperShaderParameters=(n,r,s)=>{if(t.haveWideLines(n,r)){t.getProgram().setUniform2f("viewportSize",s.usize,s.vsize);const a=parseFloat(r.getProperty().getLineWidth()),i=a/2;t.getProgram().setUniformf("lineWidthStepSize",a/Math.ceil(a)),t.getProgram().setUniformf("halfLineWidth",i)}e.primitiveType===Be.Points||r.getProperty().getRepresentation()===st.POINTS?t.getProgram().setUniformf("pointSize",r.getProperty().getPointSize()):e.pointPicking&&t.getProgram().setUniformf("pointSize",t.getPointPickingPrimitiveSize())},t.replaceShaderPositionVC=(n,r,s)=>{let a=n.Vertex;a=ae.substitute(a,"//VTK::PositionVC::Dec",["//VTK::PositionVC::Dec","uniform float pointSize;"]).result,a=ae.substitute(a,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl"," gl_PointSize = pointSize;"],!1).result,t.getOpenGLMode(s.getProperty().getRepresentation())===e.context.LINES&&t.haveWideLines(r,s)&&(a=ae.substitute(a,"//VTK::PositionVC::Dec",["//VTK::PositionVC::Dec","uniform vec2 viewportSize;","uniform float lineWidthStepSize;","uniform float halfLineWidth;"]).result,a=ae.substitute(a,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl"," if (halfLineWidth > 0.0)"," {"," float offset = float(gl_InstanceID / 2) * lineWidthStepSize - halfLineWidth;"," vec4 tmpPos = gl_Position;"," vec3 tmpPos2 = tmpPos.xyz / tmpPos.w;"," tmpPos2.x = tmpPos2.x + 2.0 * mod(float(gl_InstanceID), 2.0) * offset / viewportSize[0];"," tmpPos2.y = tmpPos2.y + 2.0 * mod(float(gl_InstanceID + 1), 2.0) * offset / viewportSize[1];"," gl_Position = vec4(tmpPos2.xyz * tmpPos.w, tmpPos.w);"," }"]).result),n.Vertex=a},t.getPointPickingPrimitiveSize=()=>e.primitiveType===Be.Points?2:e.primitiveType===Be.Lines?4:6,t.getAllocatedGPUMemoryInBytes=()=>t.getCABO().getAllocatedGPUMemoryInBytes()}var sc={context:null,program:null,shaderSourceTime:null,VAO:null,attributeUpdateTime:null,CABO:null,primitiveType:0,pointPicking:!1};function Wa(t,e,n={}){Object.assign(e,sc,n),C.obj(t,e),e.shaderSourceTime={},C.obj(e.shaderSourceTime),e.attributeUpdateTime={},C.obj(e.attributeUpdateTime),C.setGet(t,e,["program","shaderSourceTime","VAO","attributeUpdateTime","CABO","primitiveType","pointPicking"]),e.program=ae.newInstance(),e.VAO=Ga.newInstance(),e.CABO=bf.newInstance(),ac(t,e)}var ic=C.newInstance(Wa),oc={newInstance:ic,extend:Wa,primTypes:Be},{Representation:Tt,Interpolation:vt}=Ea;function Mr(t){return()=>C.vtkErrorMacro(`vtkProperty::${t} - NOT IMPLEMENTED`)}function fc(t,e){e.classHierarchy.push("vtkProperty"),t.setColor=(n,r,s)=>{Array.isArray(n)?(e.color[0]!==n[0]||e.color[1]!==n[1]||e.color[2]!==n[2])&&(e.color[0]=n[0],e.color[1]=n[1],e.color[2]=n[2],t.modified()):(e.color[0]!==n||e.color[1]!==r||e.color[2]!==s)&&(e.color[0]=n,e.color[1]=r,e.color[2]=s,t.modified()),t.setDiffuseColor(e.color),t.setAmbientColor(e.color),t.setSpecularColor(e.color)},t.computeCompositeColor=Mr("ComputeCompositeColor"),t.getColor=()=>{let n=0;e.ambient+e.diffuse+e.specular>0&&(n=1/(e.ambient+e.diffuse+e.specular));for(let r=0;r<3;r++)e.color[r]=n*(e.ambient*e.ambientColor[r]+e.diffuse*e.diffuseColor[r]+e.specular*e.specularColor[r]);return[].concat(e.color)},t.addShaderVariable=Mr("AddShaderVariable"),t.setInterpolationToFlat=()=>t.setInterpolation(vt.FLAT),t.setInterpolationToGouraud=()=>t.setInterpolation(vt.GOURAUD),t.setInterpolationToPhong=()=>t.setInterpolation(vt.PHONG),t.getInterpolationAsString=()=>C.enumToString(vt,e.interpolation),t.setRepresentationToWireframe=()=>t.setRepresentation(Tt.WIREFRAME),t.setRepresentationToSurface=()=>t.setRepresentation(Tt.SURFACE),t.setRepresentationToPoints=()=>t.setRepresentation(Tt.POINTS),t.getRepresentationAsString=()=>C.enumToString(Tt,e.representation)}var cc={color:[1,1,1],ambientColor:[1,1,1],diffuseColor:[1,1,1],specularColor:[1,1,1],edgeColor:[0,0,0],ambient:0,diffuse:1,metallic:0,roughness:.6,normalStrength:1,emission:1,baseIOR:1.45,specular:0,specularPower:1,opacity:1,edgeOpacity:1,interpolation:vt.GOURAUD,representation:Tt.SURFACE,edgeVisibility:!1,backfaceCulling:!1,frontfaceCulling:!1,pointSize:1,lineWidth:1,lighting:!0,shading:!1,materialName:null,ORMTexture:null,RMTexture:null};function Ha(t,e,n={}){Object.assign(e,cc,n),C.obj(t,e),C.setGet(t,e,["lighting","interpolation","ambient","diffuse","metallic","roughness","normalStrength","emission","baseIOR","specular","specularPower","opacity","edgeOpacity","edgeVisibility","lineWidth","pointSize","backfaceCulling","frontfaceCulling","representation","diffuseTexture","metallicTexture","roughnessTexture","normalTexture","ambientOcclusionTexture","emissionTexture","ORMTexture","RMTexture"]),C.setGetArray(t,e,["ambientColor","specularColor","diffuseColor","edgeColor"],3),fc(t,e)}var uc=C.newInstance(Ha,"vtkProperty"),mn={newInstance:uc,extend:Ha,...Ea},{Representation:gc}=mn,{vtkErrorMacro:Or}=C;function hc(t){t.Fragment=ae.substitute(t.Fragment,"//VTK::RenderPassFragmentShader::Impl",`
|
|
26
|
+
float weight = gl_FragData[0].a * pow(max(1.1 - gl_FragCoord.z, 0.0), 2.0);
|
|
27
|
+
gl_FragData[0] = vec4(gl_FragData[0].rgb*weight, gl_FragData[0].a);
|
|
28
|
+
gl_FragData[1].r = weight;
|
|
29
|
+
`,!1).result}var pc=`//VTK::System::Dec
|
|
30
|
+
|
|
31
|
+
in vec2 tcoord;
|
|
32
|
+
|
|
33
|
+
uniform sampler2D translucentRTexture;
|
|
34
|
+
uniform sampler2D translucentRGBATexture;
|
|
35
|
+
|
|
36
|
+
// the output of this shader
|
|
37
|
+
//VTK::Output::Dec
|
|
38
|
+
|
|
39
|
+
void main()
|
|
40
|
+
{
|
|
41
|
+
vec4 t1Color = texture(translucentRGBATexture, tcoord);
|
|
42
|
+
float t2Color = texture(translucentRTexture, tcoord).r;
|
|
43
|
+
gl_FragData[0] = vec4(t1Color.rgb/max(t2Color,0.01), 1.0 - t1Color.a);
|
|
44
|
+
}
|
|
45
|
+
`;function Tc(t,e){e.classHierarchy.push("vtkOpenGLOrderIndependentTranslucentPass"),t.createVertexBuffer=()=>{const n=new Float32Array([-1,-1,-1,1,-1,-1,-1,1,-1,1,1,-1]),r=new Float32Array([0,0,1,0,0,1,1,1]),s=new Uint16Array([4,0,1,3,2]),a=ne.newInstance({numberOfComponents:3,values:n});a.setName("points");const i=ne.newInstance({numberOfComponents:2,values:r});i.setName("tcoords");const o=ne.newInstance({numberOfComponents:1,values:s});e.tris.getCABO().createVBO(o,"polys",gc.SURFACE,{points:a,tcoords:i,cellOffset:0}),e.VBOBuildTime.modified()},t.createFramebuffer=n=>{const r=n.getSize(),s=n.getContext();e.framebuffer=bn.newInstance(),e.framebuffer.setOpenGLRenderWindow(n),e.framebuffer.create(...r),e.framebuffer.saveCurrentBindingsAndBuffers(),e.framebuffer.bind(),e.translucentRGBATexture=Yt.newInstance(),e.translucentRGBATexture.setInternalFormat(s.RGBA16F),e.translucentRGBATexture.setFormat(s.RGBA),e.translucentRGBATexture.setOpenGLDataType(s.HALF_FLOAT),e.translucentRGBATexture.setOpenGLRenderWindow(n),e.translucentRGBATexture.create2DFromRaw({width:r[0],height:r[1],numComps:4,dataType:"Float32Array",data:null}),e.translucentRTexture=Yt.newInstance(),e.translucentRTexture.setInternalFormat(s.R16F),e.translucentRTexture.setFormat(s.RED),e.translucentRTexture.setOpenGLDataType(s.HALF_FLOAT),e.translucentRTexture.setOpenGLRenderWindow(n),e.translucentRTexture.create2DFromRaw({width:r[0],height:r[1],numComps:1,dataType:"Float32Array",data:null}),e.translucentZTexture=Yt.newInstance(),e.translucentZTexture.setOpenGLRenderWindow(n),e.translucentZTexture.createDepthFromRaw({width:r[0],height:r[1],dataType:"Float32Array",data:null}),e.framebuffer.setColorBuffer(e.translucentRGBATexture,0),e.framebuffer.setColorBuffer(e.translucentRTexture,1),e.framebuffer.setDepthBuffer(e.translucentZTexture)},t.createCopyShader=n=>{e.copyShader=n.getShaderCache().readyShaderProgramArray(["//VTK::System::Dec","attribute vec4 vertexDC;","attribute vec2 tcoordTC;","varying vec2 tcoord;","void main() { tcoord = tcoordTC; gl_Position = vertexDC; }"].join(`
|
|
46
|
+
`),pc,"")},t.createVBO=n=>{const r=n.getContext();e.tris.setOpenGLRenderWindow(n),t.createVertexBuffer();const s=e.copyShader;e.tris.getCABO().bind(),e.copyVAO.addAttributeArray(s,e.tris.getCABO(),"vertexDC",e.tris.getCABO().getVertexOffset(),e.tris.getCABO().getStride(),r.FLOAT,3,r.FALSE)||Or("Error setting vertexDC in copy shader VAO."),e.copyVAO.addAttributeArray(s,e.tris.getCABO(),"tcoordTC",e.tris.getCABO().getTCoordOffset(),e.tris.getCABO().getStride(),r.FLOAT,2,r.FALSE)||Or("Error setting vertexDC in copy shader VAO.")},t.traverse=(n,r,s)=>{if(e.deleted)return;const a=n.getSize(),i=n.getContext();if(e._supported=!1,r.getSelector()||!i||!n.getWebgl2()||!i.getExtension("EXT_color_buffer_half_float")&&!i.getExtension("EXT_color_buffer_float")){t.setCurrentOperation("translucentPass"),r.traverse(t);return}if(e._supported=!0,e.framebuffer===null)t.createFramebuffer(n);else{const T=e.framebuffer.getSize();T===null||T[0]!==a[0]||T[1]!==a[1]?(e.framebuffer.releaseGraphicsResources(),e.translucentRGBATexture.releaseGraphicsResources(n),e.translucentRTexture.releaseGraphicsResources(n),e.translucentZTexture.releaseGraphicsResources(n),t.createFramebuffer(n)):(e.framebuffer.saveCurrentBindingsAndBuffers(),e.framebuffer.bind())}i.drawBuffers([i.COLOR_ATTACHMENT0]),i.clearBufferfv(i.COLOR,0,[0,0,0,0]),i.clearBufferfv(i.DEPTH,0,[1]),i.colorMask(!1,!1,!1,!1),s.getOpaqueActorCount()>0&&(s.setCurrentOperation("opaqueZBufferPass"),r.traverse(s)),i.colorMask(!0,!0,!0,!0),i.drawBuffers([i.COLOR_ATTACHMENT0,i.COLOR_ATTACHMENT1]),i.viewport(0,0,a[0],a[1]),i.scissor(0,0,a[0],a[1]),i.clearBufferfv(i.COLOR,0,[0,0,0,1]),i.clearBufferfv(i.COLOR,1,[0,0,0,0]),i.enable(i.DEPTH_TEST),i.enable(i.BLEND),i.blendFuncSeparate(i.ONE,i.ONE,i.ZERO,i.ONE_MINUS_SRC_ALPHA),t.setCurrentOperation("translucentPass"),r.traverse(t),i.drawBuffers([i.NONE]),e.framebuffer.restorePreviousBindingsAndBuffers(),e.copyShader===null?t.createCopyShader(n):n.getShaderCache().readyShaderProgram(e.copyShader),e.copyVAO||(e.copyVAO=Ga.newInstance(),e.copyVAO.setOpenGLRenderWindow(n)),e.copyVAO.bind(),e.VBOBuildTime.getMTime()<t.getMTime()&&t.createVBO(n);const o=i.isEnabled(i.CULL_FACE),c=o?i.getParameter(i.CULL_FACE_MODE):null;n.disableCullFace(),i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA),i.depthMask(!1),i.depthFunc(i.ALWAYS),i.viewport(0,0,a[0],a[1]),i.scissor(0,0,a[0],a[1]),e.translucentRGBATexture.activate(),e.copyShader.setUniformi("translucentRGBATexture",e.translucentRGBATexture.getTextureUnit()),e.translucentRTexture.activate(),e.copyShader.setUniformi("translucentRTexture",e.translucentRTexture.getTextureUnit()),i.drawArrays(i.TRIANGLES,0,e.tris.getCABO().getElementCount()),i.depthMask(!0),i.depthFunc(i.LEQUAL),o&&(n.enableCullFace(),n.setCullFaceMode(c)),e.translucentRGBATexture.deactivate(),e.translucentRTexture.deactivate();const g=r.getTiledSizeAndOrigin();i.scissor(g.lowerLeftU,g.lowerLeftV,g.usize,g.vsize),i.viewport(g.lowerLeftU,g.lowerLeftV,g.usize,g.vsize)},t.getShaderReplacement=()=>e._supported?hc:null,t.releaseGraphicsResources=n=>{e.framebuffer&&(e.framebuffer.releaseGraphicsResources(n),e.framebuffer=null),e.translucentRGBATexture&&(e.translucentRGBATexture.releaseGraphicsResources(n),e.translucentRGBATexture=null),e.translucentRTexture&&(e.translucentRTexture.releaseGraphicsResources(n),e.translucentRTexture=null),e.translucentZTexture&&(e.translucentZTexture.releaseGraphicsResources(n),e.translucentZTexture=null),e.copyVAO&&(e.copyVAO.releaseGraphicsResources(n),e.copyVAO=null),e.copyShader&&(e.copyShader.releaseGraphicsResources(n),e.copyShader=null),e.tris&&(e.tris.releaseGraphicsResources(n),e.tris=null),t.modified()}}var vc={framebuffer:null,copyShader:null,tris:null};function za(t,e,n={}){Object.assign(e,vc,n),In.extend(t,e,n),e.VBOBuildTime={},C.obj(e.VBOBuildTime,{mtime:0}),e.tris=oc.newInstance(),C.get(t,e,["framebuffer"]),Tc(t,e)}var yc=C.newInstance(za,"vtkOpenGLOrderIndependentTranslucentPass"),lc={newInstance:yc,extend:za};function xc(t,e){e.classHierarchy.push("vtkForwardPass"),t.traverse=(n,r=null)=>{if(e.deleted)return;e._currentParent=r,t.setCurrentOperation("buildPass"),n.traverse(t);const s=n.getRenderable().getNumberOfLayers(),a=n.getRenderable().getRenderersByReference();for(let i=0;i<s;i++)for(let o=0;o<a.length;o++){const c=a[o],g=n.getViewNodeFor(c);if(c.getDraw()&&c.getLayer()===i){if(e.opaqueActorCount=0,e.translucentActorCount=0,e.volumeCount=0,e.overlayActorCount=0,t.setCurrentOperation("queryPass"),g.traverse(t),(e.opaqueActorCount>0||e.translucentActorCount>0)&&e.volumeCount>0||e.depthRequested){const T=n.getFramebufferSize();e.framebuffer===null&&(e.framebuffer=bn.newInstance()),e.framebuffer.setOpenGLRenderWindow(n),e.framebuffer.saveCurrentBindingsAndBuffers();const f=e.framebuffer.getSize();(f===null||f[0]!==T[0]||f[1]!==T[1])&&(e.framebuffer.create(T[0],T[1]),e.framebuffer.populateFramebuffer()),e.framebuffer.bind(),t.setCurrentOperation("zBufferPass"),g.traverse(t),e.framebuffer.restorePreviousBindingsAndBuffers(),e.depthRequested=!1}t.setCurrentOperation("cameraPass"),g.traverse(t),e.opaqueActorCount>0&&(t.setCurrentOperation("opaquePass"),g.traverse(t)),e.translucentActorCount>0&&(e.translucentPass||(e.translucentPass=lc.newInstance()),e.translucentPass.traverse(n,g,t)),e.volumeCount>0&&(t.setCurrentOperation("volumePass"),g.traverse(t)),e.overlayActorCount>0&&(t.setCurrentOperation("overlayPass"),g.traverse(t))}}},t.getZBufferTexture=()=>e.framebuffer?e.framebuffer.getColorTexture():null,t.requestDepth=()=>{e.depthRequested=!0},t.incrementOpaqueActorCount=()=>e.opaqueActorCount++,t.incrementTranslucentActorCount=()=>e.translucentActorCount++,t.incrementVolumeCount=()=>e.volumeCount++,t.incrementOverlayActorCount=()=>e.overlayActorCount++}var Ec={opaqueActorCount:0,translucentActorCount:0,volumeCount:0,overlayActorCount:0,framebuffer:null,depthRequested:!1};function ja(t,e,n={}){Object.assign(e,Ec,n),In.extend(t,e,n),C.get(t,e,["framebuffer","opaqueActorCount","translucentActorCount","volumeCount"]),xc(t,e)}var Sc=C.newInstance(ja,"vtkForwardPass"),Rc={newInstance:Sc,extend:ja},{isVtkObject:Cc}=C;function Xa(t){const e=[];for(let n=0;n<t.length;n+=t[n]+1)e.push(t[n]);return e}function Ka(t){let e=0;for(let n=0;n<t.length;)n+=t[n]+1,e++;return e}var wc={extractCellSizes:Xa,getNumberOfCells:Ka};function dc(t,e){e.classHierarchy.push("vtkCellArray");const n={...t};t.getNumberOfCells=r=>(e.numberOfCells!==void 0&&!r||(e.cellSizes?e.numberOfCells=e.cellSizes.length:e.numberOfCells=Ka(t.getData())),e.numberOfCells),t.getCellSizes=r=>(e.cellSizes!==void 0&&!r||(e.cellSizes=Xa(t.getData())),e.cellSizes),t.resize=r=>{const s=t.getNumberOfTuples();n.resize(r);const a=t.getNumberOfTuples();a<s&&(a===0?(e.numberOfCells=0,e.cellSizes=[]):(e.numberOfCells=void 0,e.cellSizes=void 0))},t.setData=r=>{n.setData(r,1),e.numberOfCells=void 0,e.cellSizes=void 0},t.getCell=r=>{let s=r;const a=e.values[s++];return e.values.subarray(s,s+a)},t.insertNextCell=r=>{let s;Cc(r)?s=r.getPointsIds():s=r;const a=t.getNumberOfCells();return t.insertNextTuples([s.length,...s]),++e.numberOfCells,e.cellSizes!=null&&e.cellSizes.push(s.length),a},t.getMaxCellSize=()=>t.getCellSizes().reduce((r,s)=>Math.max(r,s),0)}function _c(t){return{empty:!0,numberOfComponents:1,dataType:ee.UNSIGNED_INT,...t}}function Ya(t,e,n={}){ne.extend(t,e,_c(n)),dc(t,e)}var Lc=C.newInstance(Ya,"vtkCellArray"),Dr={newInstance:Lc,extend:Ya,...wc},{vtkErrorMacro:Mc}=C;function Oc(t,e){let n=0;e.classHierarchy.push("vtkPoints"),t.getNumberOfPoints=t.getNumberOfTuples,t.setNumberOfPoints=(a,i=3)=>{t.getNumberOfPoints()!==a&&(e.size=a*i,e.values=C.newTypedArray(e.dataType,e.size),t.setNumberOfComponents(i),t.modified())},t.setPoint=(a,...i)=>{t.setTuple(a,i)},t.getPoint=t.getTuple,t.findPoint=t.findTuple,t.insertNextPoint=(a,i,o)=>t.insertNextTuple([a,i,o]),t.insertPoint=(a,i)=>t.insertTuple(a,i);const r=t.getBounds;t.getBounds=()=>(n<e.mtime&&t.computeBounds(),r());const s=t.getBoundsByReference;t.getBoundsByReference=()=>(n<e.mtime&&t.computeBounds(),s()),t.computeBounds=()=>{if(t.getNumberOfComponents()===3){const a=t.getRange(0);e.bounds[0]=a[0],e.bounds[1]=a[1];const i=t.getRange(1);e.bounds[2]=i[0],e.bounds[3]=i[1];const o=t.getRange(2);e.bounds[4]=o[0],e.bounds[5]=o[1]}else if(t.getNumberOfComponents()===2){const a=t.getRange(0);e.bounds[0]=a[0],e.bounds[1]=a[1];const i=t.getRange(1);e.bounds[2]=i[0],e.bounds[3]=i[1],e.bounds[4]=0,e.bounds[5]=0}else Mc(`getBounds called on an array with components of ${t.getNumberOfComponents()}`),na(e.bounds);n=C.getCurrentGlobalMTime()},t.setNumberOfComponents(e.numberOfComponents<2?3:e.numberOfComponents)}var Dc={empty:!0,numberOfComponents:3,dataType:ee.FLOAT,bounds:[1,-1,1,-1,1,-1]};function Za(t,e,n={}){Object.assign(e,Dc,n),ne.extend(t,e,n),C.getArray(t,e,["bounds"],6),Oc(t,e)}var Fc=C.newInstance(Za,"vtkPoints"),en={newInstance:Fc,extend:Za};function Bc(t,e){e.classHierarchy.push("vtkCell"),t.initialize=(n,r=null)=>{if(r){e.pointsIds=r;let s=e.points.getData();s.length!==3*e.pointsIds.length&&(s=C.newTypedArray(n.getDataType(),3*e.pointsIds.length));const a=n.getData();e.pointsIds.forEach((i,o)=>{let c=3*i,g=3*o;s[g]=a[c],s[++g]=a[++c],s[++g]=a[++c]}),e.points.setData(s)}else{e.points=n,e.pointsIds=new Array(n.getNumberOfPoints());for(let s=n.getNumberOfPoints()-1;s>=0;--s)e.pointsIds[s]=s}},t.getBounds=()=>e.points.getBounds(),t.getLength2=()=>{const n=Y.getLengths(t.getBounds());return n[0]*n[0]+n[1]*n[1]+n[2]*n[2]},t.getParametricDistance=n=>{let r,s=0;for(let a=0;a<3;a++)n[a]<0?r=-n[a]:n[a]>1?r=n[a]-1:r=0,r>s&&(s=r);return s},t.getNumberOfPoints=()=>e.points.getNumberOfPoints(),t.deepCopy=n=>{n.initialize(e.points,e.pointsIds)},t.getCellDimension=()=>{},t.intersectWithLine=(n,r,s,a,i,o,c)=>{},t.evaluatePosition=(n,r,s,a,i,o)=>{C.vtkErrorMacro("vtkCell.evaluatePosition is not implemented.")}}var Nc={bounds:[-1,-1,-1,-1,-1,-1],pointsIds:[]};function Qa(t,e,n={}){Object.assign(e,Nc,n),C.obj(t,e),e.points||(e.points=en.newInstance()),C.get(t,e,["points","pointsIds"]),Bc(t,e)}var Gc=C.newInstance(Qa,"vtkCell"),Ae={newInstance:Gc,extend:Qa};function Uc(t,e){let n=e;for(e>=t.array.length&&(n+=t.array.length);n>t.array.length;)t.array.push({ncells:0,cells:null});t.array.length=n}function Vc(t,e){e.classHierarchy.push("vtkCellLinks"),t.buildLinks=n=>{const r=n.getPoints().getNumberOfPoints(),s=n.getNumberOfCells(),a=new Uint32Array(r);if(n.isA("vtkPolyData")){for(let i=0;i<s;++i){const{cellPointIds:o}=n.getCellPoints(i);o.forEach(c=>{t.incrementLinkCount(c)})}t.allocateLinks(r),e.maxId=r-1;for(let i=0;i<s;++i){const{cellPointIds:o}=n.getCellPoints(i);o.forEach(c=>{t.insertCellReference(c,a[c]++,i)})}}else{for(let i=0;i<s;i++)Ae.newInstance().getPointsIds().forEach(o=>{t.incrementLinkCount(o)});t.allocateLinks(r),e.maxId=r-1;for(let i=0;i<s;++i)Ae.newInstance().getPointsIds().forEach(o=>{t.insertCellReference(o,a[o]++,i)})}},t.allocate=(n,r=1e3)=>{e.array=Array(n).fill().map(()=>({ncells:0,cells:null})),e.extend=r,e.maxId=-1},t.initialize=()=>{e.array=null},t.getLink=n=>e.array[n],t.getNcells=n=>e.array[n].ncells,t.getCells=n=>e.array[n].cells,t.insertNextPoint=n=>{e.array.push({ncells:n,cells:Array(n)}),++e.maxId},t.insertNextCellReference=(n,r)=>{e.array[n].cells[e.array[n].ncells++]=r},t.deletePoint=n=>{e.array[n].ncells=0,e.array[n].cells=null},t.removeCellReference=(n,r)=>{e.array[r].cells=e.array[r].cells.filter(s=>s!==n),e.array[r].ncells=e.array[r].cells.length},t.addCellReference=(n,r)=>{e.array[r].cells[e.array[r].ncells++]=n},t.resizeCellList=(n,r)=>{e.array[n].cells.length=r},t.squeeze=()=>{Uc(e,e.maxId+1)},t.reset=()=>{e.maxId=-1},t.deepCopy=n=>{e.array=[...n.array],e.extend=n.extend,e.maxId=n.maxId},t.incrementLinkCount=n=>{++e.array[n].ncells},t.allocateLinks=n=>{for(let r=0;r<n;++r)e.array[r].cells=new Array(e.array[r].ncells)},t.insertCellReference=(n,r,s)=>{e.array[n].cells[r]=s}}var kc={array:null,maxId:0,extend:0};function Ja(t,e,n={}){Object.assign(e,kc,n),C.obj(t,e),Vc(t,e)}var $c=C.newInstance(Ja,"vtkCellLinks"),Wc={newInstance:$c,extend:Ja},Z={VTK_EMPTY_CELL:0,VTK_VERTEX:1,VTK_POLY_VERTEX:2,VTK_LINE:3,VTK_POLY_LINE:4,VTK_TRIANGLE:5,VTK_TRIANGLE_STRIP:6,VTK_POLYGON:7,VTK_QUAD:9,VTK_QUADRATIC_EDGE:21,VTK_CONVEX_POINT_SET:41,VTK_POLYHEDRON:42},Vn=["vtkEmptyCell","vtkVertex","vtkPolyVertex","vtkLine","vtkPolyLine","vtkTriangle","vtkTriangleStrip","vtkPolygon","vtkPixel","vtkQuad","vtkTetra","vtkVoxel","vtkHexahedron","vtkWedge","vtkPyramid","vtkPentagonalPrism","vtkHexagonalPrism","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkQuadraticEdge","vtkQuadraticTriangle","vtkQuadraticQuad","vtkQuadraticTetra","vtkQuadraticHexahedron","vtkQuadraticWedge","vtkQuadraticPyramid","vtkBiQuadraticQuad","vtkTriQuadraticHexahedron","vtkQuadraticLinearQuad","vtkQuadraticLinearWedge","vtkBiQuadraticQuadraticWedge","vtkBiQuadraticQuadraticHexahedron","vtkBiQuadraticTriangle","vtkCubicLine","vtkQuadraticPolygon","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkConvexPointSet","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","UnknownClass","vtkParametricCurve","vtkParametricSurface","vtkParametricTriSurface","vtkParametricQuadSurface","vtkParametricTetraRegion","vtkParametricHexRegion","UnknownClass","UnknownClass","UnknownClass","vtkHigherOrderEdge","vtkHigherOrderTriangle","vtkHigherOrderQuad","vtkHigherOrderPolygon","vtkHigherOrderTetrahedron","vtkHigherOrderWedge","vtkHigherOrderPyramid","vtkHigherOrderHexahedron"];function Hc(t){return t<Vn.length?Vn[t]:"UnknownClass"}function zc(t){return Vn.findIndex(t)}function jc(t){return t<Z.VTK_QUADRATIC_EDGE||t===Z.VTK_CONVEX_POINT_SET||t===Z.VTK_POLYHEDRON}function Xc(t){return t===Z.VTK_TRIANGLE_STRIP||t===Z.VTK_POLY_LINE||t===Z.VTK_POLY_VERTEX}var Kc={getClassNameFromTypeId:Hc,getTypeIdFromClassName:zc,isLinear:jc,hasSubCells:Xc};function Yc(t,e){e.classHierarchy.push("vtkCellTypes"),t.allocate=(n=512,r=1e3)=>{e.size=n>0?n:1,e.extend=r>0?r:1,e.maxId=-1,e.typeArray=new Uint8Array(n),e.locationArray=new Uint32Array(n)},t.insertCell=(n,r,s)=>{e.typeArray[n]=r,e.locationArray[n]=s,n>e.maxId&&(e.maxId=n)},t.insertNextCell=(n,r)=>(t.insertCell(++e.maxId,n,r),e.maxId),t.setCellTypes=(n,r,s)=>{e.size=n,e.typeArray=r,e.locationArray=s,e.maxId=n-1},t.getCellLocation=n=>e.locationArray[n],t.deleteCell=n=>{e.typeArray[n]=Z.VTK_EMPTY_CELL},t.getNumberOfTypes=()=>e.maxId+1,t.isType=n=>{const r=t.getNumberOfTypes();for(let s=0;s<r;++s)if(n===t.getCellType(s))return!0;return!1},t.insertNextType=n=>t.insertNextCell(n,-1),t.getCellType=n=>e.typeArray[n],t.reset=()=>{e.maxId=-1},t.deepCopy=n=>{t.allocate(n.getSize(),n.getExtend()),e.typeArray.set(n.getTypeArray()),e.locationArray.set(n.getLocationArray()),e.maxId=n.getMaxId()}}var Zc={size:0,maxId:-1,extend:1e3};function qa(t,e,n={}){Object.assign(e,Zc,n),C.obj(t,e),C.get(t,e,["size","maxId","extend"]),C.getArray(t,e,["typeArray","locationArray"]),Yc(t,e)}var Qc=C.newInstance(qa,"vtkCellTypes"),Jc={newInstance:Qc,extend:qa,...Kc},Aa={NO_INTERSECTION:0,YES_INTERSECTION:1,ON_LINE:2},ba={IntersectionState:Aa},{IntersectionState:Qt}=ba;function rt(t,e,n,r=null){const s={t:Number.MIN_VALUE,distance:0},a=[];let i;a[0]=n[0]-e[0],a[1]=n[1]-e[1],a[2]=n[2]-e[2];const o=a[0]*(t[0]-e[0])+a[1]*(t[1]-e[1])+a[2]*(t[2]-e[2]),c=Q(a,a);let g=1e-5*o;return c!==0&&(s.t=o/c),g<0&&(g=-g),-g<c&&c<g||c<=0||s.t<0?i=e:s.t>1?i=n:(i=a,a[0]=e[0]+s.t*a[0],a[1]=e[1]+s.t*a[1],a[2]=e[2]+s.t*a[2]),r&&(r[0]=i[0],r[1]=i[1],r[2]=i[2]),s.distance=he(i,t),s}function Ia(t,e,n,r,s,a){const i=[],o=[],c=[];s[0]=0,a[0]=0,fe(e,t,i),fe(r,n,o),fe(n,t,c);const g=[Q(i,i),-Q(i,o),-Q(i,o),Q(o,o)],T=[];if(T[0]=Q(i,c),T[1]=-Q(o,c),Si(g,T,2)===0){let f=Number.MAX_VALUE;const y=[t,e,n,r],w=[n,n,t,t],R=[r,r,e,e];a[0],a[0],s[0],s[0],s[0],s[0],a[0],a[0];let l;for(let x=0;x<4;x++)l=rt(y[x],w[x],R[x]),l.distance<f&&(f=l.distance,l.t);return Qt.ON_LINE}return s[0]=T[0],a[0]=T[1],s[0]>=0&&s[0]<=1&&a[0]>=0&&a[0]<=1?Qt.YES_INTERSECTION:Qt.NO_INTERSECTION}var qc={distanceToLine:rt,intersection:Ia};function Ac(t,e){e.classHierarchy.push("vtkLine");function n(r){return r>=0&&r<=1}t.getCellDimension=()=>1,t.intersectWithLine=(r,s,a,i,o)=>{const c={intersect:0,t:Number.MAX_VALUE,subId:0,betweenPoints:null};o[1]=0,o[2]=0;const g=[],T=[],f=[];e.points.getPoint(0,T),e.points.getPoint(1,f);const y=[],w=[],R=Ia(r,s,T,f,y,w);if(c.t=y[0],c.betweenPoints=n(c.t),o[0]=w[0],R===Qt.YES_INTERSECTION){for(let l=0;l<3;l++)i[l]=T[l]+o[0]*(f[l]-T[l]),g[l]=r[l]+c.t*(s[l]-r[l]);if(he(i,g)<=a*a)return c.intersect=1,c}else{let l;if(c.t<0)return l=rt(r,T,f,i),l.distance<=a*a&&(c.t=0,c.intersect=1,c.betweenPoints=!0),c;if(c.t>1)return l=rt(s,T,f,i),l.distance<=a*a&&(c.t=1,c.intersect=1,c.betweenPoints=!0),c;if(o[0]<0)return o[0]=0,l=rt(T,r,s,i),c.t=l.t,l.distance<=a*a&&(c.intersect=1),c;if(o[0]>1)return o[0]=1,l=rt(f,r,s,i),c.t=l.t,l.distance<=a*a&&(c.intersect=1),c}return c},t.evaluateLocation=(r,s,a)=>{const i=[],o=[];e.points.getPoint(0,i),e.points.getPoint(1,o);for(let c=0;c<3;c++)s[c]=i[c]+r[0]*(o[c]-i[c]);a[0]=1-r[0],a[1]=r[0]},t.evaluateOrientation=(r,s,a)=>e.orientations?(jt(s,e.orientations[0],e.orientations[1],r[0]),a[0]=1-r[0],a[1]=r[0],!0):!1}var bc={orientations:null};function ma(t,e,n={}){Object.assign(e,bc,n),Ae.extend(t,e,n),C.setGet(t,e,["orientations"]),Ac(t,e)}var Ic=C.newInstance(ma,"vtkLine"),te={newInstance:Ic,extend:ma,...qc,...ba};function mc(t,e){e.classHierarchy.push("vtkPointSet"),e.points?e.points=ra(e.points):e.points=en.newInstance(),t.getNumberOfPoints=()=>e.points.getNumberOfPoints(),t.getBounds=()=>e.points?.getBounds(),t.computeBounds=()=>{e.points?.computeBounds()};const n=t.shallowCopy;t.shallowCopy=(a,i=!1)=>{n(a,i),e.points=en.newInstance(),e.points.shallowCopy(a.getPoints())};const r=t.getMTime;t.getMTime=()=>{const a=r();return Math.max(a,e.points?.getMTime()??a)};const s=t.initialize;t.initialize=()=>(e.points?.initialize(),s())}var Pc={};function Pa(t,e,n={}){Object.assign(e,Pc,n),rn.extend(t,e,n),C.setGet(t,e,["points"]),mc(t,e)}var eu=C.newInstance(Pa,"vtkPointSet"),tu={newInstance:eu,extend:Pa};function nu(t,e){e.classHierarchy.push("vtkPolyLine");const n=te.newInstance();n.getPoints().setNumberOfPoints(2),t.getCellDimension=()=>1,t.intersectWithLine=(r,s,a,i,o,c,g)=>{const T={intersect:0,t:Number.MAX_VALUE,subId:0,betweenPoints:null},f=t.getNumberOfPoints()-1;let y=Number.MAX_VALUE;for(let w=0;w<f;w++){const R=[0,0,0];n.getPoints().getData().set(e.points.getData().subarray(3*w,3*(w+2)));const l=n.intersectWithLine(a,i,o,c,g);if(l.intersect===1&&l.t<=T.t+o&&l.t>=r&&l.t<=s){T.intersect=1;const x=n.getParametricDistance(R);if(x<y||x===y&&l.t<T.t){T.subId=w,T.t=l.t,y=x;for(let u=0;u<3;u++)c[u],R[u]}}}return T},t.evaluateLocation=(r,s,a,i)=>(n.getPoints().getData().set(e.points.getData().subarray(3*r,3*(r+2))),n.evaluateLocation(s,a,i)),t.evaluateOrientation=(r,s,a,i)=>(e.orientations?n.setOrientations([e.orientations[r],e.orientations[r+1]]):n.setOrientations(null),n.evaluateOrientation(s,a,i)),t.getDistancesToFirstPoint=()=>{const r=e.distancesTime.getMTime();if(r<e.points.getMTime()||r<t.getMTime()){const s=t.getNumberOfPoints();if(e.distances?e.distances.length=s:e.distances=new Array(s),s>0){const a=new Array(3),i=new Array(3);let o=0;e.distances[0]=o,e.points.getPoint(0,a);for(let c=1;c<s;++c)e.points.getPoint(c,i),o+=e.distanceFunction(a,i),e.distances[c]=o,Ci(a,i)}e.distancesTime.modified()}return e.distances},t.findPointIdAtDistanceFromFirstPoint=r=>{const s=t.getDistancesToFirstPoint();if(s.length<2)return-1;let a=0,i=s.length-1;if(r<s[a]||r>s[i]||s[i]===0)return-1;for(;i-a>1;){const o=Math.floor((a+i)/2);s[o]<=r?a=o:i=o}return a}}var ru={orientations:null,distanceFunction:Ri};function es(t,e,n={}){Object.assign(e,ru,n),Ae.extend(t,e,n),C.setGet(t,e,["orientations","distanceFunction"]),e.distancesTime={},C.obj(e.distancesTime,{mtime:0}),nu(t,e)}var au=C.newInstance(es,"vtkPolyLine"),su={newInstance:au,extend:es};function iu(t,e){e.classHierarchy.push("vtkPriorityQueue"),t.push=(n,r)=>{const s=e.elements.findIndex(a=>a.priority>n);e.elements.splice(s,0,{priority:n,element:r})},t.pop=()=>e.elements.length>0?e.elements.shift().element:null,t.deleteById=n=>{e.elements=e.elements.filter(({element:r})=>r.id!==n)},t.length=()=>e.elements.length}var ou={elements:[]};function ts(t,e,n={}){Object.assign(e,ou,n),C.obj(t,e),iu(t,e)}var fu=C.newInstance(ts,"vtkPriorityQueue"),cu={newInstance:fu,extend:ts},uu=11920929e-14,gu=1e-8,ze={FAILURE:-1,OUTSIDE:0,INSIDE:1,INTERSECTION:2,ON_LINE:3};function Fr(t,e,n,r,s){return(r[t]-n[t])*(s[e]-n[e])-(s[t]-n[t])*(r[e]-n[e])}function hu(t,e,n,r){if(t[0]<n[0]||t[0]>n[1]||t[1]<n[2]||t[1]>n[3]||t[2]<n[4]||t[2]>n[5])return ze.OUTSIDE;if(_e(r)<=11920929e-14)return ze.FAILURE;let s=gu*((n[1]-n[0])*(n[1]-n[0])+(n[3]-n[2])*(n[3]-n[2])+(n[5]-n[4])*(n[5]-n[4]));s*=s,s=s===0?uu:s;const a=[],i=[];for(let T=0;T<e.length;){if(a[0]=e[T++],a[1]=e[T++],a[2]=e[T++],he(t,a)<=s)return ze.INSIDE;const{distance:f,t:y}=te.distanceToLine(t,a,i);if(f<=s&&y>0&&y<1)return ze.INSIDE}let o,c;Math.abs(r[0])>Math.abs(r[1])?Math.abs(r[0])>Math.abs(r[2])?(o=1,c=2):(o=0,c=1):Math.abs(r[1])>Math.abs(r[2])?(o=0,c=2):(o=0,c=1);let g=0;for(let T=0;T<e.length;)a[0]=e[T++],a[1]=e[T++],a[2]=e[T++],T<e.length?(i[0]=e[T],i[1]=e[T+1],i[2]=e[T+2]):(i[0]=e[0],i[1]=e[1],i[2]=e[2]),a[c]<=t[c]?i[c]>t[c]&&Fr(o,c,a,i,t)>0&&++g:i[c]<=t[c]&&Fr(o,c,a,i,t)<0&&--g;return g===0?ze.OUTSIDE:ze.INSIDE}function pu(t,e,n){const r=t.length,s=[];e.getPoint(t[0],s),n[0]=s[0],n[1]=s[0],n[2]=s[1],n[3]=s[1],n[4]=s[2],n[5]=s[2];for(let i=1;i<r;i++)e.getPoint(t[i],s),Y.addPoint(n,...s);const a=Y.getLengths(n);return Q(a,a)}function Tu(t,e,n){n.length=3,n[0]=0,n[1]=0,n[2]=0;const r=[];let s=[],a=[];const i=[],o=[];e.getPoint(t[0],r),e.getPoint(t[1],s);for(let c=2;c<t.length;c++){e.getPoint(t[c],a),fe(a,s,i),fe(r,s,o);const g=[0,0,0];de(i,o,g),bt(n,g,n),[s,a]=[a,s]}return _e(n)}function vu(t,e,n=[0,0,0]){n[0]=0,n[1]=0,n[2]=0;const r=t.length,s=[];for(let a=0;a<r;a++)e.getPoint(t[a],s),n[0]+=s[0],n[1]+=s[1],n[2]+=s[2];return n[0]/=r,n[1]/=r,n[2]/=r,n}var yu={PolygonWithPointIntersectionState:ze,pointInPolygon:hu,getBounds:pu,getNormal:Tu,computeCentroid:vu};function lu(t,e){e.classHierarchy.push("vtkPolygon");function n(){const o=[0,0,0],c=[0,0,0];e.normal=[0,0,0];const g=[...e.firstPoint.point];let T=e.firstPoint;for(let f=0;f<e.pointCount;f++){fe(T.point,g,o),fe(T.next.point,g,c);const y=[0,0,0];de(o,c,y),bt(e.normal,y,e.normal),T=T.next}return _e(e.normal)}function r(o){const c=[0,0,0],g=[0,0,0],T=[0,0,0],f=[0,0,0];fe(o.point,o.previous.point,c),fe(o.next.point,o.point,g),fe(o.previous.point,o.next.point,T),de(c,g,f);const y=Q(f,e.normal);if(y<=0)return-1;const w=Lt(c)+Lt(g)+Lt(T);return w*w/y}function s(o){if(e.pointCount<=3)return!0;const c=o.previous,g=o.next,T=[0,0,0];fe(g.point,c.point,T);const f=[0,0,0];if(de(T,e.normal,f),_e(f),Lt(f)===0)return!1;let y=Je.evaluate(f,c.point,g.next.point),w=y>1e-6?1:y<-1e-6?-1:0,R=w<0?1:0;for(let l=g.next.next;l.id!==c.id;l=l.next){const x=l.previous;y=Je.evaluate(f,c.point,l.point);const u=y>1e-6?1:y<-1e-6?-1:0;if(u!==w){if(R||(R=u<=0?1:0),te.intersection(c.point,g.point,l.point,x.point,[0],[0])===Aa.YES_INTERSECTION)return!1;w=u}}return R===1}function a(o,c){e.pointCount-=1;const g=o.previous,T=o.next;e.tris=e.tris.concat(o.point),e.tris=e.tris.concat(T.point),e.tris=e.tris.concat(g.point),g.next=T,T.previous=g,c.deleteById(g.id),c.deleteById(T.id);const f=r(g);f>0&&c.push(f,g);const y=r(T);y>0&&c.push(y,T),o.id===e.firstPoint.id&&(e.firstPoint=T)}function i(){n();const o=cu.newInstance();let c=e.firstPoint;for(let g=0;g<e.pointCount;g++){const T=r(c);T>0&&o.push(T,c),c=c.next}for(;e.pointCount>2&&o.length()>0;)if(e.pointCount===o.length())a(o.pop(),o);else{const g=o.pop();s(g)&&a(g,o)}return e.pointCount<=2}t.triangulate=()=>e.firstPoint?i():null,t.setPoints=o=>{e.pointCount=o.length,e.firstPoint={id:0,point:o[0],next:null,previous:null};let c=e.firstPoint;for(let g=1;g<e.pointCount;g++)c.next={id:g,point:o[g],next:null,previous:c},c=c.next;e.firstPoint.previous=c,c.next=e.firstPoint},t.getPointArray=()=>e.tris}var xu={firstPoint:null,pointCount:0,tris:[]};function ns(t,e,n={}){Object.assign(e,xu,n),C.obj(t,e),lu(t,e)}var Eu=C.newInstance(ns,"vtkPolygon"),Su={newInstance:Eu,extend:ns,...yu};function Pn(t,e,n,r){const s=n[0]-e[0],a=n[1]-e[1],i=n[2]-e[2],o=t[0]-e[0],c=t[1]-e[1],g=t[2]-e[2];r[0]=a*g-i*c,r[1]=i*o-s*g,r[2]=s*c-a*o}function Rt(t,e,n,r){Pn(t,e,n,r);const s=Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);s!==0&&(r[0]/=s,r[1]/=s,r[2]/=s)}function rs(t){t[0]=-1,t[1]=1,t[2]=0,t[3]=-1,t[4]=0,t[5]=1}function Ru(t,e,n,r,s,a,i=1e-6){let o=!1;const c=[],g=[],T=[],f=[],y=[];Rt(t,e,n,f),Rt(r,s,a,y);const w=-Q(f,t),R=-Q(y,r),l=[Q(y,t)+R,Q(y,e)+R,Q(y,n)+R];if(l[0]*l[1]>i&&l[0]*l[2]>i)return{intersect:!1,coplanar:o,pt1:c,pt2:g,surfaceId:T};const x=[Q(f,r)+w,Q(f,s)+w,Q(f,a)+w];if(x[0]*x[1]>i&&x[0]*x[2]>i)return{intersect:!1,coplanar:o,pt1:c,pt2:g,surfaceId:T};if(Math.abs(f[0]-y[0])<1e-9&&Math.abs(f[1]-y[1])<1e-9&&Math.abs(f[2]-y[2])<1e-9&&Math.abs(w-R)<1e-9)return o=!0,{intersect:!1,coplanar:o,pt1:c,pt2:g,surfaceId:T};const u=[t,e,n],p=[r,s,a],h=Q(f,y),v=(w-R*h)/(h*h-1),E=(R-w*h)/(h*h-1),S=[v*f[0]+E*y[0],v*f[1]+E*y[1],v*f[2]+E*y[2]],_=de(f,y,[]);_e(_);let d=0,L=0;const M=[],D=[];let F=50,N=50;for(let V=0;V<3;V++){const z=V,G=(V+1)%3,O=Je.intersectWithLine(u[z],u[G],r,y);O.intersection&&O.t>0-i&&O.t<1+i&&(O.t<1+i&&O.t>1-i&&(F=d),M[d++]=Q(O.x,_)-Q(S,_));const B=Je.intersectWithLine(p[z],p[G],t,f);B.intersection&&B.t>0-i&&B.t<1+i&&(B.t<1+i&&B.t>1-i&&(N=L),D[L++]=Q(B.x,_)-Q(S,_))}if(d>2){d--;const V=M[2];M[2]=M[F],M[F]=V}if(L>2){L--;const V=D[2];D[2]=D[N],D[N]=V}if(d!==2||L!==2)return{intersect:!1,coplanar:o,pt1:c,pt2:g,surfaceId:T};if(Number.isNaN(M[0])||Number.isNaN(M[1])||Number.isNaN(D[0])||Number.isNaN(D[1]))return{intersect:!1,coplanar:o,pt1:c,pt2:g,surfaceId:T};if(M[0]>M[1]){const V=M[1];M[1]=M[0],M[0]=V}if(D[0]>D[1]){const V=D[1];D[1]=D[0],D[0]=V}let U,W;return M[1]<D[0]||D[1]<M[0]?{intersect:!1,coplanar:o,pt1:c,pt2:g,surfaceId:T}:(M[0]<D[0]?M[1]<D[1]?(T[0]=2,T[1]=1,U=D[0],W=M[1]):(T[0]=2,T[1]=2,U=D[0],W=D[1]):M[1]<D[1]?(T[0]=1,T[1]=1,U=M[0],W=M[1]):(T[0]=1,T[1]=2,U=M[0],W=D[1]),cr(S,_,U,c),cr(S,_,W,g),{intersect:!0,coplanar:o,pt1:c,pt2:g,surfaceId:T})}var Cu=[[0,1],[1,2],[2,0]],wu=[1,2,4],du=[[-1,-1,-1,-1,-1,-1,-1],[0,2,100,-1,-1,-1,-1],[1,0,101,-1,-1,-1,-1],[1,2,100,1,100,101,-1],[2,1,102,-1,-1,-1,-1],[0,1,102,102,100,0,-1],[0,101,2,2,101,102,-1],[100,101,102,-1,-1,-1,-1]],_u={computeNormalDirection:Pn,computeNormal:Rt,interpolationDerivs:rs,intersectWithTriangle:Ru};function Lu(t,e){e.classHierarchy.push("vtkTriangle"),t.getCellDimension=()=>2,t.intersectWithLine=(n,r,s,a,i)=>{const o={subId:0,t:Number.MAX_VALUE,intersect:0,betweenPoints:!1};i[2]=0;const c=[],g=s*s,T=[],f=[],y=[];e.points.getPoint(0,T),e.points.getPoint(1,f),e.points.getPoint(2,y);const w=[],R=[];if(Rt(T,f,y,w),w[0]!==0||w[1]!==0||w[2]!==0){const h=Je.intersectWithLine(n,r,T,w);if(o.betweenPoints=h.betweenPoints,o.t=h.t,a[0]=h.x[0],a[1]=h.x[1],a[2]=h.x[2],!h.intersection)return i[0]=0,i[1]=0,o.intersect=0,o;const v=t.evaluatePosition(a,c,i,R);if(v.evaluation>=0)return v.dist2<=g?(o.intersect=1,o):(o.intersect=v.evaluation,o)}const l=he(T,f),x=he(f,y),u=he(y,T);e.line||(e.line=te.newInstance()),l>x&&l>u?(e.line.getPoints().setPoint(0,T),e.line.getPoints().setPoint(1,f)):x>u&&x>l?(e.line.getPoints().setPoint(0,f),e.line.getPoints().setPoint(1,y)):(e.line.getPoints().setPoint(0,y),e.line.getPoints().setPoint(1,T));const p=e.line.intersectWithLine(n,r,s,a,i);if(o.betweenPoints=p.betweenPoints,o.t=p.t,p.intersect){const h=[],v=[],E=[];for(let S=0;S<3;S++)h[S]=T[S]-y[S],v[S]=f[S]-y[S],E[S]=a[S]-y[S];return i[0]=Q(E,h)/u,i[1]=Q(E,v)/x,o.intersect=1,o}return i[0]=0,i[1]=0,o.intersect=0,o},t.evaluatePosition=(n,r,s,a)=>{const i={subId:0,dist2:0,evaluation:-1};let o,c;const g=[],T=[],f=[],y=[];let w;const R=[],l=[],x=[];let u=0,p=0;const h=[];let v,E,S,_=[];const d=[],L=[],M=[];i.subId=0,s[2]=0,e.points.getPoint(1,g),e.points.getPoint(2,T),e.points.getPoint(0,f),Pn(g,T,f,y),Je.generalizedProjectPoint(n,g,y,M);let D=0;for(o=0;o<3;o++)y[o]<0?w=-y[o]:w=y[o],w>D&&(D=w,p=o);for(c=0,o=0;o<3;o++)o!==p&&(h[c++]=o);for(o=0;o<2;o++)R[o]=M[h[o]]-f[h[o]],l[o]=g[h[o]]-f[h[o]],x[o]=T[h[o]]-f[h[o]];if(u=gn(l,x),u===0)return s[0]=0,s[1]=0,i.evaluation=-1,i;if(s[0]=gn(R,x)/u,s[1]=gn(l,R)/u,a[0]=1-(s[0]+s[1]),a[1]=s[0],a[2]=s[1],a[0]>=0&&a[0]<=1&&a[1]>=0&&a[1]<=1&&a[2]>=0&&a[2]<=1)r&&(i.dist2=he(M,n),r[0]=M[0],r[1]=M[1],r[2]=M[2]),i.evaluation=1;else{let F;if(r)if(a[1]<0&&a[2]<0)for(v=he(n,f),E=te.distanceToLine(n,g,f,F,d),S=te.distanceToLine(n,f,T,F,L),v<E?(i.dist2=v,_=f):(i.dist2=E,_=d),S<i.dist2&&(i.dist2=S,_=L),o=0;o<3;o++)r[o]=_[o];else if(a[2]<0&&a[0]<0)for(v=he(n,g),E=te.distanceToLine(n,g,f,F,d),S=te.distanceToLine(n,g,T,F,L),v<E?(i.dist2=v,_=g):(i.dist2=E,_=d),S<i.dist2&&(i.dist2=S,_=L),o=0;o<3;o++)r[o]=_[o];else if(a[1]<0&&a[0]<0)for(v=he(n,T),E=te.distanceToLine(n,T,f,F,d),S=te.distanceToLine(n,g,T,F,L),v<E?(i.dist2=v,_=T):(i.dist2=E,_=d),S<i.dist2&&(i.dist2=S,_=L),o=0;o<3;o++)r[o]=_[o];else a[0]<0?i.dist2=te.distanceToLine(n,g,T,r).distance:a[1]<0?i.dist2=te.distanceToLine(n,T,f,r).distance:a[2]<0&&(i.dist2=te.distanceToLine(n,g,f,r).distance);i.evaluation=0}return i},t.evaluateLocation=(n,r,s)=>{const a=[],i=[],o=[];e.points.getPoint(0,a),e.points.getPoint(1,i),e.points.getPoint(2,o);const c=1-n[0]-n[1];for(let g=0;g<3;g++)r[g]=a[g]*c+i[g]*n[0]+o[g]*n[1];s[0]=c,s[1]=n[0],s[2]=n[1]},t.getParametricDistance=n=>{let r,s=0;const a=[];a[0]=n[0],a[1]=n[1],a[2]=1-n[0]-n[1];for(let i=0;i<3;i++)a[i]<0?r=-a[i]:a[i]>1?r=a[i]-1:r=0,r>s&&(s=r);return s},t.derivatives=(n,r,s,a,i)=>{const o=e.points.getPoint(0),c=e.points.getPoint(1),g=e.points.getPoint(2),T=[],f=[],y=[],w=[];Rt(o,c,g,T),fe(c,o,f),fe(g,o,w),de(T,f,y);const R=_e(f);if(R<=0||_e(y)<=0){for(let E=0;E<a;E++)for(let S=0;S<3;S++)i[E*a+S]=0;return}const l=[0,0],x=[R,0],u=[Q(w,f),Q(w,y)],p=new Array(6);rs(p);const h=[x[0]-l[0],x[1]-l[1],u[0]-l[0],u[1]-l[1]],v=C.newTypedArray(wi.Float64Array,4);di(h,v,2);for(let E=0;E<a;E++){let S=0,_=0;for(let M=0;M<3;M++)S+=p[M]*s[a*M+E],_+=p[3+M]*s[a*M+E];const d=S*v[0]+_*v[1],L=S*v[2]+_*v[3];i[3*E]=d*f[0]+L*y[0],i[3*E+1]=d*f[1]+L*y[1],i[3*E+2]=d*f[2]+L*y[2]}},t.cellBoundary=(n,r,s)=>{const a=r[0]-r[1],i=.5*(1-r[0])-r[1],o=2*r[0]+r[1]-1;return a>=0&&i>=0?(s[0]=e.pointsIds[0],s[1]=e.pointsIds[1]):i<0&&o>=0?(s[0]=e.pointsIds[1],s[1]=e.pointsIds[2]):(s[0]=e.pointsIds[2],s[1]=e.pointsIds[0]),!(r[0]<0||r[1]<0||r[0]>1||r[1]>1||1-r[0]-r[1]<0)},t.clip=(n,r,s,a,i,o,c,g,T,f)=>{let y=0;for(let p=0;p<3;p++){const h=r.getComponent(p,0);(f&&h<=n||!f&&h>n)&&(y+=wu[p])}const w=du[y],R=[0,0,0],l=[0,0,0],x=[0,0,0],u=[0,0,0];for(let p=0;w[p]>-1;p+=3){u[0]=0,u[1]=0,u[2]=0;for(let h=0;h<3;h++){const v=w[p+h];if(v>=100){const E=v-100;e.points.getPoint(E,R);const{inserted:S,id:_}=s.insertUniquePoint(R);u[h]=_,S&&o.passData(i,e.pointsIds[E],_)}else{const E=Cu[v];let S=E[0],_=E[1],d=r.getComponent(E[1],0)-r.getComponent(E[0],0);d<=0&&(S=E[1],_=E[0],d=-d);const L=d===0?0:(n-r.getComponent(S,0))/d;e.points.getPoint(S,l),e.points.getPoint(_,x);for(let F=0;F<3;F++)R[F]=l[F]+L*(x[F]-l[F]);const{inserted:M,id:D}=s.insertUniquePoint(R);u[h]=D,M&&o.interpolateData(i,e.pointsIds[S],e.pointsIds[_],D,L)}}if(!(u[0]===u[1]||u[0]===u[2]||u[1]===u[2])){const h=a.insertNextCell(u);T.passData(c,g,h)}}}}var Mu={};function as(t,e,n={}){Object.assign(e,Mu,n),Ae.extend(t,e,n),Lu(t,e)}var Ou=C.newInstance(as,"vtkTriangle"),er={newInstance:Ou,extend:as,..._u};function Br(){return{intersected:!1,subId:-1,x:[0,0,0],pCoords:[0,0,0],t:-1}}function Du(t,e){e.classHierarchy.push("vtkQuad"),t.getCellDimension=()=>2,t.getCellType=()=>Z.VTK_QUAD,t.getNumberOfEdges=()=>4,t.getNumberOfFaces=()=>0,t.intersectWithLine=(n,r,s,a,i)=>{let o={subId:0,t:Number.MAX_VALUE,intersect:0,betweenPoints:!1},c;const g=e.points.getPoint(0,[]),T=e.points.getPoint(1,[]),f=e.points.getPoint(2,[]),y=e.points.getPoint(3,[]),w=he(g,f),R=he(T,y);if(w===R){let S,_=0,d=0;for(let L=0;L<4;L++)S=e.pointsIds[L],S>_&&(_=S,d=L);d===0||d===2?c=0:c=1}else w<R?c=0:c=1;let l=null;e.triangle?l=e.triangle.getPoints():(e.triangle=er.newInstance(),l=en.newInstance(),l.setNumberOfPoints(3),e.triangle.initialize(l));let x;const u=Br();let p;const h=Br();let v,E;switch(c){case 0:l.setPoint(0,...g),l.setPoint(1,...T),l.setPoint(2,...f),x=e.triangle.intersectWithLine(n,r,s,u.x,u.pCoords),l.setPoint(0,...f),l.setPoint(1,...y),l.setPoint(2,...g),p=e.triangle.intersectWithLine(n,r,s,h.x,h.pCoords),v=x.intersect&&p.intersect?x.t<=p.t:x.intersect,E=x.intersect&&p.intersect?p.t<x.t:p.intersect,v?(o=x,a[0]=u.x[0],a[1]=u.x[1],a[2]=u.x[2],i[0]=u.pCoords[0]+u.pCoords[1],i[1]=u.pCoords[1],i[2]=u.pCoords[2]):E&&(o=p,a[0]=h.x[0],a[1]=h.x[1],a[2]=h.x[2],i[0]=1-(h.pCoords[0]+h.pCoords[1]),i[1]=1-h.pCoords[1],i[2]=h.pCoords[2]);break;case 1:l.setPoint(0,...g),l.setPoint(1,...T),l.setPoint(2,...y),x=e.triangle.intersectWithLine(n,r,s,u.x,u.pCoords),l.setPoint(0,...f),l.setPoint(1,...y),l.setPoint(2,...T),p=e.triangle.intersectWithLine(n,r,s,h.x,h.pCoords),v=x.intersect&&p.intersect?x.t<=p.t:x.intersect,E=x.intersect&&p.intersect?p.t<x.t:p.intersect,v?(o=x,a[0]=u.x[0],a[1]=u.x[1],a[2]=u.x[2],i[0]=u.pCoords[0],i[1]=u.pCoords[1],i[2]=u.pCoords[2]):E&&(o=p,a[0]=h.x[0],a[1]=h.x[1],a[2]=h.x[2],i[0]=1-h.pCoords[0],i[1]=1-h.pCoords[1],i[2]=h.pCoords[2]);break}return o},t.interpolationFunctions=(n,r)=>{const s=1-n[0],a=1-n[1];r[0]=s*a,r[1]=n[0]*a,r[2]=n[0]*n[1],r[3]=s*n[1]},t.evaluateLocation=(n,r,s)=>{const a=[];t.interpolationFunctions(n,s),r[0]=0,r[1]=0,r[2]=0;for(let i=0;i<4;i++){e.points.getPoint(i,a);for(let o=0;o<3;o++)r[o]+=a[o]*s[i]}}}var Fu={};function ss(t,e,n={}){Object.assign(e,Fu,n),Ae.extend(t,e,n),Du(t,e)}var Bu=C.newInstance(ss,"vtkQuad"),Nu={newInstance:Bu,extend:ss},{vtkErrorMacro:is}=C;function Gu(t){return()=>is(`vtkTriangleStrip.${t} - NOT IMPLEMENTED`)}function Uu(t,e){if(!Array.isArray(t)||t.length<3){is("decomposeStrip - Invalid points array");return}let n=t[0],r=t[1];for(let s=0;s<t.length-2;s++){const a=t[s+2];s%2?e.insertNextCell([r,n,a]):e.insertNextCell([n,r,a]),n=r,r=a}}var Vu={decomposeStrip:Uu};function ku(t,e){e.classHierarchy.push("vtkTriangleStrip");const n=t.initialize;t.initialize=(r,s)=>{e.triangle.initialize(r,s),n(r,s)},t.getCellType=()=>Z.VTK_TRIANGLE_STRIP,t.getCellDimension=()=>2,t.getNumberOfEdges=()=>e.pointsIds.length,t.getNumberOfFaces=()=>0,t.evaluatePosition=(r,s,a,i,o)=>{const c=[0,0,0];let g=Number.MAX_VALUE,T=0;const f=[],y=[],w=[];a[2]=0,y[0]=0,y[1]=0,y[2]=0;const R=e.triangle.getPoints();R.setNumberOfPoints(3);const l=e.triangle.getPointsIds().length;for(let x=0;x<l;x++)o[x]=0;for(let x=0;x<l-2;x++){const u=[];R.getPoint(x,u);const p=[];R.getPoint(x+1,p);const h=[];R.getPoint(x+2,h),R.setData(Float32Array.from([...u,...p,...h]),3);const v=e.triangle.evaluatePosition(r,w,c,f),E=v.dist2;v.evaluation>=0&&(E<g||E===g&&T===0)&&(T=v,s&&(s[0]=w[0],s[1]=w[1],s[2]=w[2]),a[0]=c[0],a[1]=c[1],g=E,y[0]=f[0],y[1]=f[1],y[2]=f[2])}return i[0]=g,o[0]=y[0],o[1]=y[1],o[2]=y[2],T},t.evaluateLocation=(r,s,a,i)=>{const o=[[0,1,2],[1,0,2]],c=r%2,g=e.pointsIds.length;for(let w=0;w<g;w++)i[w]=0;i[r]=1-s[0]-s[1],i[r+1]=s[0],i[r+2]=s[1];const T=[];e.points.getPoint(r+o[c][0],T);const f=[];e.points.getPoint(r+o[c][1],f);const y=[];e.points.getPoint(r+o[c][2],y);for(let w=0;w<3;w++)a[w]=T[w]*i[r]+f[w]*i[r+1]+y[w]*i[r+2]},t.cellBoundary=(r,s,a)=>{const i=[[0,1,2],[1,0,2]],o=r%2,c=e.triangle.getPointsIds();return c[0]=e.pointsIds[i[o][0]],c[1]=e.pointsIds[i[o][1]],c[2]=e.pointsIds[i[o][2]],e.triangle.cellBoundary(0,s,a)},t.getEdge=r=>{let s,a;const i=e.pointsIds.length;return r===0?(s=0,a=1):r===i-1?(s=r-1,a=r):(s=r-1,a=r+1),e.line.getPointsIds()[0]=e.pointsIds[s],e.line.getPointsIds()[1]=e.pointsIds[a],e.line.getPoints().setPoint(0,e.points.getPoint(s)),e.line.getPoints().setPoint(1,e.points.getPoint(a)),e.line},t.intersectWithLine=(r,s,a,i,o)=>{const c=e.pointsIds.length-2,g=e.triangle.getPoints();g.setNumberOfPoints(3);for(let T=0;T<c;T++){const f=[];e.points.getPoint(e.pointsIds[T],f);const y=[];e.points.getPoint(e.pointsIds[T+1],y);const w=[];e.points.getPoint(e.pointsIds[T+2],w),g.setData(Float32Array.from([...f,...y,...w]),3);const R=e.triangle.intersectWithLine(r,s,a,i,o);if(R.intersect)return R}return!1},t.triangulate=()=>{const r=e.points.getNumberOfPoints()-2;e.tris=new Array(3*r);const s=[[0,1,2],[1,0,2]];for(let a=0;a<r;a++){const i=a%2;for(let o=0;o<3;o++)e.tris[a*3+o]=a+s[i][o]}return!0},t.getPointArray=()=>e.tris,t.derivatives=(r,s,a,i,o)=>{const c=[];e.points.getPoint(r,c);const g=[];e.points.getPoint(r+1,g);const T=[];e.points.getPoint(r+2,T);const f=e.triangle.getPoints();f.setPoint(0,...c),f.setPoint(1,...g),f.setPoint(2,...T),e.triangle.derivatives(0,s,a,i,o)},t.getParametricCenter=r=>(r[0]=.333333,r[1]=.333333,r[2]=0,Math.floor((e.pointsIds.length-2)/2)),t.contour=(r,s,a,i,o,c,g,T,f,y,w)=>Gu("contour")(),t.clip=(r,s,a,i,o,c,g,T,f,y)=>{const w=e.points.getNumberOfPoints()-2,R=new Float32Array(3),l=s.newClone();l.setNumberOfComponents(s.getNumberOfComponents()),l.setData(R,s.getNumberOfComponents());const x=e.triangle.getPoints();x.setNumberOfPoints(3);const u=e.triangle.getPointsIds(),p=[0,0,0];for(let h=0;h<w;h++){let v=h,E=h+1,S=h+2;h%2&&(v=h+2,E=h+1,S=h),x.setPoint(0,...e.points.getPoint(v,p)),x.setPoint(1,...e.points.getPoint(E,p)),x.setPoint(2,...e.points.getPoint(S,p)),u[0]=e.pointsIds[v],u[1]=e.pointsIds[E],u[2]=e.pointsIds[S],R[0]=s.getComponent(v,0),R[1]=s.getComponent(E,0),R[2]=s.getComponent(S,0),e.triangle.clip(r,l,a,i,o,c,g,T,f,y)}}}var $u={line:null,triangle:null,tris:null};function os(t,e,n={}){Object.assign(e,$u,n),Ae.extend(t,e,n),e.line||(e.line=te.newInstance()),e.triangle||(e.triangle=er.newInstance()),ku(t,e)}var Wu=C.newInstance(os,"vtkTriangleStrip"),Hu={newInstance:Wu,extend:os,...Vu},me=["verts","lines","polys","strips"],{vtkWarningMacro:Nr}=C,zu={[Z.VTK_LINE]:te,[Z.VTK_QUAD]:Nu,[Z.VTK_POLY_LINE]:te,[Z.VTK_TRIANGLE]:er,[Z.VTK_TRIANGLE_STRIP]:Hu,[Z.VTK_POLY_LINE]:su,[Z.VTK_POLYGON]:Su};function ju(t,e){e.classHierarchy.push("vtkPolyData");function n(o){return o.replace(/(?:^\w|[A-Z]|\b\w)/g,c=>c.toUpperCase()).replace(/\s+/g,"")}function r(){e.cells=void 0,e.links=void 0}me.forEach(o=>{t[`getNumberOf${n(o)}`]=()=>e[o].getNumberOfCells(),e[o]?e[o]=ra(e[o]):e[o]=Dr.newInstance(),e[`_on${n(o)}Changed`]=r}),t.getNumberOfCells=()=>me.reduce((o,c)=>o+e[c].getNumberOfCells(),0);const s=t.shallowCopy;t.shallowCopy=(o,c=!1)=>{s(o,c),me.forEach(g=>{e[g]=Dr.newInstance(),e[g].shallowCopy(o.getReferenceByName(g))})};const a=t.getMTime;t.getMTime=()=>me.reduce((o,c)=>Math.max(o,e[c]?.getMTime()??o),a());const i=t.initialize;t.initialize=()=>(me.forEach(o=>e[o]?.initialize()),r(),i()),t.buildCells=()=>{const o=t.getNumberOfVerts(),c=t.getNumberOfLines(),g=t.getNumberOfPolys(),T=t.getNumberOfStrips(),f=o+c+g+T,y=new Uint8Array(f);let w=y;const R=new Uint32Array(f);let l=R;if(o){let x=0;e.verts.getCellSizes().forEach((u,p)=>{l[p]=x,w[p]=u>1?Z.VTK_POLY_VERTEX:Z.VTK_VERTEX,x+=u+1}),l=l.subarray(o),w=w.subarray(o)}if(c){let x=0;e.lines.getCellSizes().forEach((u,p)=>{l[p]=x,w[p]=u>2?Z.VTK_POLY_LINE:Z.VTK_LINE,u===1&&Nr("Building VTK_LINE ",p," with only one point, but VTK_LINE needs at least two points. Check the input."),x+=u+1}),l=l.subarray(c),w=w.subarray(c)}if(g){let x=0;e.polys.getCellSizes().forEach((u,p)=>{switch(l[p]=x,u){case 3:w[p]=Z.VTK_TRIANGLE;break;case 4:w[p]=Z.VTK_QUAD;break;default:w[p]=Z.VTK_POLYGON;break}u<3&&Nr("Building VTK_TRIANGLE ",p," with less than three points, but VTK_TRIANGLE needs at least three points. Check the input."),x+=u+1}),l+=l.subarray(g),w+=w.subarray(g)}if(T){let x=0;w.fill(Z.VTK_TRIANGLE_STRIP,0,T),e.strips.getCellSizes().forEach((u,p)=>{l[p]=x,x+=u+1})}e.cells=Jc.newInstance(),e.cells.setCellTypes(f,y,R)},t.buildLinks=(o=0)=>{e.cells==null&&t.buildCells(),e.links=Wc.newInstance(),o>0?e.links.allocate(o):e.links.allocate(t.getPoints().getNumberOfPoints()),e.links.buildLinks(t)},t.getCellType=o=>e.cells.getCellType(o),t.getCellPoints=o=>{const c=t.getCellType(o);let g=null;switch(c){case Z.VTK_VERTEX:case Z.VTK_POLY_VERTEX:g=e.verts;break;case Z.VTK_LINE:case Z.VTK_POLY_LINE:g=e.lines;break;case Z.VTK_TRIANGLE:case Z.VTK_QUAD:case Z.VTK_POLYGON:g=e.polys;break;case Z.VTK_TRIANGLE_STRIP:g=e.strips;break;default:return g=null,{type:0,cellPointIds:null}}const T=e.cells.getCellLocation(o);return{cellType:c,cellPointIds:g.getCell(T)}},t.getPointCells=o=>e.links.getCells(o),t.getCellEdgeNeighbors=(o,c,g)=>{const T=e.links.getLink(c),f=e.links.getLink(g);return T.cells.filter(y=>y!==o&&f.cells.indexOf(y)!==-1)},t.getCell=(o,c=null)=>{const g=t.getCellPoints(o),T=c||zu[g.cellType].newInstance();return T.initialize(t.getPoints(),g.cellPointIds),T},t.getMaxCellSize=()=>me.reduce((o,c)=>Math.max(o,e[c]?.getMaxCellSize?.()??0),0)}var Xu={};function fs(t,e,n={}){Object.assign(e,Xu,n),tu.extend(t,e,n),C.get(t,e,["cells","links"]),C.setGet(t,e,["verts","lines","polys","strips"]),ju(t,e)}var Ku=C.newInstance(fs,"vtkPolyData"),Dp={newInstance:Ku,extend:fs},Yu={NEAREST:0,LINEAR:1,FAST_LINEAR:2},Zu={FRACTIONAL:0,PROPORTIONAL:1},Qu={DEFAULT:0,ADDITIVE:1,COLORIZE:2,CUSTOM:3},Ju={OFF:0,NORMALIZED:1,RAW:2},cs={InterpolationType:Yu,OpacityMode:Zu,ColorMixPreset:Qu,FilterMode:Ju},us=Object.create(null);function Fp(t,e){us[t]=e}function qu(t,e){e.classHierarchy.push("vtkWebGPUViewNodeFactory")}var Au={};function gs(t,e,n={}){Object.assign(e,Au,n),e.overrides=us,wa.extend(t,e,n),qu(t,e)}var bu=C.newInstance(gs,"vtkWebGPUViewNodeFactory"),Bp={newInstance:bu,extend:gs};function Iu(t,e){e.classHierarchy.push("vtkWebGPUShaderModule"),t.initialize=(n,r)=>{e.device=n,e.handle=e.device.getHandle().createShaderModule({code:r.getCode()})}}var mu={device:null,handle:null};function Gr(t,e,n={}){Object.assign(e,mu,n),C.obj(t,e),C.get(t,e,["lastCameraMTime"]),C.setGet(t,e,["device","handle"]),Iu(t,e)}var Pu={newInstance:C.newInstance(Gr,"vtkWebGPUShaderModule"),extend:Gr};function eg(t,e,n,r=!0){const s=Array.isArray(n)?n.join(`
|
|
47
|
+
`):n;let a=!1;t.search(e)!==-1&&(a=!0);let i="";r&&(i="g");const o=new RegExp(e,i),c=t.replace(o,s);return{replace:a,result:c}}function tg(t,e){e.classHierarchy.push("vtkWebGPUShaderCache"),t.getShaderModule=n=>{const r=n.getType(),s=n.getHash(),a=e._shaderModules.keys();for(let o=0;o<a.length;o++){const c=a[o];if(c.getHash()===s&&c.getType()===r)return e._shaderModules.get(c)}const i=Pu.newInstance();return i.initialize(e.device,n),e._shaderModules.set(n,i),i}}var ng={shaderModules:null,device:null,window:null};function hs(t,e,n={}){Object.assign(e,ng,n),e._shaderModules=new Map,C.obj(t,e),C.setGet(t,e,["device","window"]),tg(t,e)}var rg=C.newInstance(hs,"vtkWebGPUShaderCache"),Ce={newInstance:rg,extend:hs,substitute:eg},{vtkErrorMacro:ag}=C;function sg(t,e){e.classHierarchy.push("vtkWebGPUBindGroup"),t.setBindables=n=>{if(e.bindables.length===n.length){let r=!0;for(let s=0;s<e.bindables.length;s++)e.bindables[s]!==n[s]&&(r=!1);if(r)return}e.bindables=n,t.modified()},t.getBindGroupLayout=n=>{const r=[];for(let s=0;s<e.bindables.length;s++){e.bindables[s].setDevice?.(n);const a=e.bindables[s].getBindGroupLayoutEntry();a.binding=s,r.push(a)}return n.getBindGroupLayout({entries:r})},t.getBindGroup=n=>{const r=e.bindGroupDevice!==n;for(let i=0;i<e.bindables.length;i++)e.bindables[i].setDevice?.(n);let s=t.getMTime();for(let i=0;i<e.bindables.length;i++){const o=e.bindables[i].getBindGroupTime().getMTime();s=o>s?o:s}if(!r&&s<e.bindGroupTime.getMTime())return e.bindGroup;const a=[];for(let i=0;i<e.bindables.length;i++){const o=e.bindables[i].getBindGroupEntry();o.binding=i,a.push(o)}return e.bindGroup=n.getHandle().createBindGroup({layout:t.getBindGroupLayout(n),entries:a,label:e.label}),e.bindGroupDevice=n,e.bindGroupTime.modified(),e.bindGroup},t.getShaderCode=n=>{const r=[],s=n.getBindGroupLayoutIndex(e.label);if(s<0)return ag(`vtkWebGPUBindGroup: bind group layout ${e.label} was not found in pipeline`),"";for(let a=0;a<e.bindables.length;a++)r.push(e.bindables[a].getShaderCode(a,s));return r.join(`
|
|
48
|
+
`)},t.releaseGraphicsResources=()=>{e.bindGroup=null,e.bindGroupDevice=null,e.bindGroupTime.modified(),t.modified()}}var ig={device:null,handle:null,bindGroupDevice:null,label:null};function ps(t,e,n={}){Object.assign(e,ig,n),C.obj(t,e),e.bindables=[],e.bindGroupTime={},C.obj(e.bindGroupTime,{mtime:0}),C.get(t,e,["bindGroupTime","handle","sizeInBytes","usage"]),C.setGet(t,e,["label","device","arrayInformation"]),sg(t,e)}var og=C.newInstance(ps),fg={newInstance:og,extend:ps};function cg(t,e){e.classHierarchy.push("vtkWebGPUPipeline"),t.getShaderDescriptions=()=>e.shaderDescriptions,t.applyPipelineSettings=(n,r)=>r?{...n,...r,primitive:{...n.primitive,...r.primitive},depthStencil:{...n.depthStencil,...r.depthStencil},fragment:{...n.fragment,...r.fragment}}:n,t.initialize=(n,r)=>{e.pipelineDescription=t.applyPipelineSettings(e.renderEncoder.getPipelineSettings(),e.extraPipelineSettings),e.pipelineDescription.primitive.topology=e.topology,e.pipelineDescription.vertex=e.vertexState,e.pipelineDescription.label=r;const s=[];for(let a=0;a<e.layouts.length;a++)s.push(e.layouts[a].layout);e.pipelineLayout=n.getHandle().createPipelineLayout({bindGroupLayouts:s}),e.pipelineDescription.layout=e.pipelineLayout;for(let a=0;a<e.shaderDescriptions.length;a++){const i=e.shaderDescriptions[a],o=n.getShaderModule(i);i.getType()==="vertex"&&(e.pipelineDescription.vertex.module=o.getHandle(),e.pipelineDescription.vertex.entryPoint="main"),i.getType()==="fragment"&&(e.pipelineDescription.fragment.module=o.getHandle(),e.pipelineDescription.fragment.entryPoint="main")}e.handle=n.getHandle().createRenderPipeline(e.pipelineDescription)},t.getShaderDescription=n=>{for(let r=0;r<e.shaderDescriptions.length;r++)if(e.shaderDescriptions[r].getType()===n)return e.shaderDescriptions[r];return null},t.addBindGroupLayout=n=>{n&&e.layouts.push({layout:n.getBindGroupLayout(e.device),label:n.getLabel()})},t.getBindGroupLayout=n=>e.layouts[n].layout,t.getBindGroupLayoutIndex=n=>{for(let r=0;r<e.layouts.length;r++)if(e.layouts[r].label===n)return r;return-1},t.bindVertexInput=(n,r)=>{r.bindBuffers(n)}}var ug={extraPipelineSettings:null,handle:null,layouts:null,renderEncoder:null,shaderDescriptions:null,vertexState:null,topology:null,pipelineDescription:null};function Ts(t,e,n={}){Object.assign(e,ug,n),it(t,e),e.layouts=[],e.shaderDescriptions=[],Hn(t,e,["handle","pipelineDescription"]),Ct(t,e,["device","extraPipelineSettings","renderEncoder","topology","vertexState"]),cg(t,e)}var gg=ot(Ts,"vtkWebGPUPipeline"),hg={newInstance:gg,extend:Ts};function pg(t,e){e.classHierarchy.push("vtkWebGPUShaderDescription"),t.hasOutput=n=>e.outputNames.includes(n),t.addOutput=(n,r,s=void 0)=>{e.outputTypes.push(n),e.outputNames.push(r),e.outputInterpolations.push(s)},t.addBuiltinOutput=(n,r)=>{e.builtinOutputTypes.push(n),e.builtinOutputNames.push(r)},t.addBuiltinInput=(n,r)=>{e.builtinInputTypes.push(n),e.builtinInputNames.push(r)},t.replaceShaderCode=(n,r)=>{const s=[];let a=[];if(r&&s.push(r.getShaderCode()),n||e.builtinInputNames.length){const i=[];if(i.push(`struct ${e.type}Input
|
|
49
|
+
{`),n){const o=n.getOutputNamesByReference(),c=n.getOutputTypesByReference(),g=n.getOutputInterpolationsByReference();for(let T=0;T<o.length;T++)g[T]!==void 0?i.push(` @location(${T}) @interpolate(${g[T]}) ${o[T]} : ${c[T]},`):i.push(` @location(${T}) ${o[T]} : ${c[T]},`)}for(let o=0;o<e.builtinInputNames.length;o++)i.push(` ${e.builtinInputNames[o]} : ${e.builtinInputTypes[o]},`);i.length>1&&(i.push("};"),a=i,s[s.length-1]+=",",s.push(`input: ${e.type}Input`))}if(s.length&&(e.code=Ce.substitute(e.code,"//VTK::IOStructs::Input",s).result),e.outputNames.length+e.builtinOutputNames.length||e.code.includes("//VTK::IOStructs::Output")){const i=[`struct ${e.type}Output
|
|
50
|
+
{`];for(let o=0;o<e.outputNames.length;o++)e.outputInterpolations[o]!==void 0?i.push(` @location(${o}) @interpolate(${e.outputInterpolations[o]}) ${e.outputNames[o]} : ${e.outputTypes[o]},`):i.push(` @location(${o}) ${e.outputNames[o]} : ${e.outputTypes[o]},`);for(let o=0;o<e.builtinOutputNames.length;o++)i.push(` ${e.builtinOutputNames[o]} : ${e.builtinOutputTypes[o]},`);i.push("};"),a=a.concat(i),e.code=Ce.substitute(e.code,"//VTK::IOStructs::Output",[`-> ${e.type}Output`]).result}e.code=Ce.substitute(e.code,"//VTK::IOStructs::Dec",a).result}}var Tg={type:null,hash:null,code:null,outputNames:null,outputTypes:null};function vs(t,e,n={}){Object.assign(e,Tg,n),e.outputNames=[],e.outputTypes=[],e.outputInterpolations=[],e.builtinOutputNames=[],e.builtinOutputTypes=[],e.builtinInputNames=[],e.builtinInputTypes=[],C.obj(t,e),C.setGet(t,e,["type","hash","code"]),C.getArray(t,e,["outputTypes","outputNames","outputInterpolations"]),pg(t,e)}var vg=C.newInstance(vs,"vtkWebGPUShaderDescription"),Ur={newInstance:vg,extend:vs},Vr={r8unorm:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"float"},r8snorm:{numComponents:1,nativeType:Int8Array,stride:1,elementSize:1,sampleType:"float"},r8uint:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"uint"},r8sint:{numComponents:1,nativeType:Int8Array,stride:1,elementSize:1,sampleType:"sint"},r16uint:{numComponents:1,nativeType:Uint16Array,stride:2,elementSize:2,sampleType:"uint"},r16sint:{numComponents:1,nativeType:Int16Array,stride:2,elementSize:2,sampleType:"sint"},r16float:{numComponents:1,nativeType:Float32Array,stride:2,elementSize:2,sampleType:"float"},rg8unorm:{numComponents:2,nativeType:Uint8Array,stride:2,elementSize:1,sampleType:"float"},rg8snorm:{numComponents:2,nativeType:Int8Array,stride:2,elementSize:1,sampleType:"float"},rg8uint:{numComponents:2,nativeType:Uint8Array,stride:2,elementSize:1,sampleType:"uint"},rg8sint:{numComponents:2,nativeType:Int8Array,stride:2,elementSize:1,sampleType:"sint"},r32uint:{numComponents:1,nativeType:Uint32Array,stride:4,elementSize:4,sampleType:"uint"},r32sint:{numComponents:1,nativeType:Int32Array,stride:4,elementSize:4,sampleType:"sint"},r32float:{numComponents:1,nativeType:Float32Array,stride:4,elementSize:4,sampleType:"unfilterable-float"},rg16uint:{numComponents:2,nativeType:Uint16Array,stride:4,elementSize:2,sampleType:"uint"},rg16sint:{numComponents:2,nativeType:Int16Array,stride:4,elementSize:2,sampleType:"sint"},rg16float:{numComponents:2,nativeType:Float32Array,stride:4,elementSize:2,sampleType:"float"},rgba8unorm:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},"rgba8unorm-srgb":{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},rgba8snorm:{numComponents:4,nativeType:Int8Array,stride:4,elementSize:1,sampleType:"float"},rgba8uint:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"uint"},rgba8sint:{numComponents:4,nativeType:Int8Array,stride:4,elementSize:1,sampleType:"sint"},bgra8unorm:{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},"bgra8unorm-srgb":{numComponents:4,nativeType:Uint8Array,stride:4,elementSize:1,sampleType:"float"},rgb9e5ufloat:{numComponents:4,nativeType:Uint32Array,stride:4,sampleType:"float"},rgb10a2unorm:{numComponents:4,nativeType:Uint32Array,stride:4,sampleType:"float"},rg11b10ufloat:{numComponents:4,nativeType:Float32Array,stride:4,sampleType:"float"},rg32uint:{numComponents:2,nativeType:Uint32Array,stride:8,elementSize:4,sampleType:"uint"},rg32sint:{numComponents:2,nativeType:Int32Array,stride:8,elementSize:4,sampleType:"sint"},rg32float:{numComponents:2,nativeType:Float32Array,stride:8,elementSize:4,sampleType:"unfilterable-float"},rgba16uint:{numComponents:4,nativeType:Uint16Array,stride:8,elementSize:2,sampleType:"uint"},rgba16sint:{numComponents:4,nativeType:Int16Array,stride:8,elementSize:2,sampleType:"sint"},rgba16float:{numComponents:4,nativeType:Float32Array,stride:8,elementSize:2,sampleType:"float"},rgba32uint:{numComponents:4,nativeType:Uint32Array,stride:16,elementSize:4,sampleType:"uint"},rgba32sint:{numComponents:4,nativeType:Int32Array,stride:16,elementSize:4,sampleType:"sint"},rgba32float:{numComponents:4,nativeType:Float32Array,stride:16,elementSize:4,sampleType:"unfilterable-float"},stencil8:{numComponents:1,nativeType:Uint8Array,stride:1,elementSize:1,sampleType:"uint"},depth16unorm:{numComponents:1,nativeType:Uint16Array,stride:2,elementSize:2,sampleType:"depth"},depth24plus:{numComponents:1,nativeType:Uint32Array,stride:4,elementSize:3,sampleType:"depth"},"depth24plus-stencil8":{numComponents:2,nativeType:Uint32Array,stride:4,sampleType:"mixed"},depth32float:{numComponents:1,nativeType:Float32Array,stride:4,elementSize:4,sampleType:"depth"}};function yg(t){return!t||t.length<6?0:t in Vr?Vr[t]:(I(`unknown format ${t}`),null)}function lg(t){if(!t||t.length<5)return 0;let e=1;t[t.length-2]==="x"&&(e=Number(t[t.length-1]));const n=e===1?t.length-1:t.length-3,r=Number(t[n]);if(Number.isNaN(r))return I(`unknown format ${t}`),0;const s=5-r/2;return e*s}function xg(t){if(!t||t.length<5)return 0;let e=1;return t[t.length-2]==="x"&&(e=Number(t[t.length-1])),e}function Eg(t){if(!t||t.length<5)return 0;let e;if(t[0]==="f")e="Float";else if(t[0]==="s")e="Int";else if(t[0]==="u")e="Uint";else{I(`unknown format ${t}`);return}const n=t.split("x")[0],r=Number(n[n.length-1]);if(Number.isNaN(r)){I(`unknown format ${t}`);return}return e+=8*(5-r/2),e+="Array",e}function Sg(t){let e;if(t[0]==="f"||t[1]==="n")e="f32";else if(t[0]==="s"&&t[1]==="i")e="i32";else if(t[0]==="u"&&t[1]==="i")e="u32";else{I(`unknown format ${t}`);return}let n=1;return t[t.length-2]==="x"&&(n=Number(t[t.length-1])),n===4?`vec4<${e}>`:n===3?`vec3<${e}>`:n===2?`vec2<${e}>`:e}function Rg(t){if(!t)return 0;let e=1;return t.substring(0,3)==="vec"?e=Number(t[3]):t.substring(0,3)==="mat"&&(e=t[3]*t[5]),e*4}function Cg(t){if(t){if(t.includes("f32"))return"Float32Array";if(t.includes("i32"))return"Int32Array";if(t.includes("u32"))return"Uint32Array";I(`unknown format ${t}`)}}var se={getDetailsFromTextureFormat:yg,getByteStrideFromBufferFormat:lg,getNumberOfComponentsFromBufferFormat:xg,getNativeTypeFromBufferFormat:Eg,getShaderTypeFromBufferFormat:Sg,getByteStrideFromShaderFormat:Rg,getNativeTypeFromShaderFormat:Cg};function wg(t,e){if(t===e)return!0;if(t==null||e==null||t.length!==e.length)return!1;const n=new Set(e);for(let r=0;r<t.length;++r)if(!n.has(t[r]))return!1;return!0}function dg(t,e){e.classHierarchy.push("vtkWebGPUVertexInput"),t.addBuffer=(n,r,s="vertex")=>{let a=r;Array.isArray(a)||(a=[a]);for(let i=0;i<e.inputs.length;i++)if(wg(e.inputs[i].names,a)){if(e.inputs[i].buffer===n)return;e.inputs[i].buffer=n;return}e.inputs.push({buffer:n,stepMode:s,names:a}),e.inputs=e.inputs.sort((i,o)=>i.names[0]<o.names[0]?-1:i.names[0]>o.names[0]?1:0)},t.removeBufferIfPresent=n=>{for(let r=0;r<e.inputs.length;r++)e.inputs[r].names.includes(n)&&e.inputs.splice(r,1)},t.getBuffer=n=>{for(let r=0;r<e.inputs.length;r++)if(e.inputs[r].names.includes(n))return e.inputs[r].buffer;return null},t.hasAttribute=n=>{for(let r=0;r<e.inputs.length;r++)if(e.inputs[r].names.includes(n))return!0;return!1},t.getAttributeTime=n=>{for(let r=0;r<e.inputs.length;r++)if(e.inputs[r].names.includes(n))return e.inputs[r].buffer.getSourceTime();return 0},t.getShaderCode=()=>{let n="",r=0;for(let s=0;s<e.inputs.length;s++)for(let a=0;a<e.inputs[s].names.length;a++){const i=e.inputs[s].buffer.getArrayInformation()[a],o=se.getShaderTypeFromBufferFormat(i.format);r>0&&(n+=`,
|
|
51
|
+
`),n=`${n} @location(${r}) ${e.inputs[s].names[a]} : ${o}`,r++}return n},t.getVertexInputInformation=()=>{const n={};if(e.inputs.length){const r=[];let s=0;for(let a=0;a<e.inputs.length;a++){const i=e.inputs[a].buffer,o={arrayStride:i.getStrideInBytes(),stepMode:e.inputs[a].stepMode,attributes:[]},c=i.getArrayInformation();for(let g=0;g<e.inputs[a].names.length;g++)o.attributes.push({shaderLocation:s,offset:c[g].offset,format:c[g].format}),s++;r.push(o)}n.buffers=r}return n},t.bindBuffers=n=>{for(let r=0;r<e.inputs.length;r++)n.setVertexBuffer(r,e.inputs[r].buffer.getHandle());e.indexBuffer&&n.setIndexBuffer(e.indexBuffer.getHandle(),e.indexBuffer.getArrayInformation()[0].format)},t.getReady=()=>{},t.releaseGraphicsResources=()=>{e.created&&(e.inputs=[],e.bindingDescriptions=[],e.attributeDescriptions=[])}}var _g={inputs:null,bindingDescriptions:!1,attributeDescriptions:null,indexBuffer:null};function ys(t,e,n={}){Object.assign(e,_g,n),it(t,e),e.bindingDescriptions=[],e.attributeDescriptions=[],e.inputs=[],Ct(t,e,["created","device","handle","indexBuffer"]),dg(t,e)}var Lg=ot(ys,"vtkWebGPUVertexInput"),Mg={newInstance:Lg,extend:ys},Og=`
|
|
52
|
+
//VTK::Renderer::Dec
|
|
53
|
+
|
|
54
|
+
//VTK::Color::Dec
|
|
55
|
+
|
|
56
|
+
//VTK::Normal::Dec
|
|
57
|
+
|
|
58
|
+
//VTK::TCoord::Dec
|
|
59
|
+
|
|
60
|
+
//VTK::Select::Dec
|
|
61
|
+
|
|
62
|
+
//VTK::Mapper::Dec
|
|
63
|
+
|
|
64
|
+
//VTK::IOStructs::Dec
|
|
65
|
+
|
|
66
|
+
@vertex
|
|
67
|
+
fn main(
|
|
68
|
+
//VTK::IOStructs::Input
|
|
69
|
+
)
|
|
70
|
+
//VTK::IOStructs::Output
|
|
71
|
+
{
|
|
72
|
+
var output : vertexOutput;
|
|
73
|
+
|
|
74
|
+
// var vertex: vec4<f32> = vertexBC;
|
|
75
|
+
|
|
76
|
+
//VTK::Color::Impl
|
|
77
|
+
|
|
78
|
+
//VTK::Normal::Impl
|
|
79
|
+
|
|
80
|
+
//VTK::TCoord::Impl
|
|
81
|
+
|
|
82
|
+
//VTK::Select::Impl
|
|
83
|
+
|
|
84
|
+
//VTK::Position::Impl
|
|
85
|
+
|
|
86
|
+
return output;
|
|
87
|
+
}
|
|
88
|
+
`,Dg=`
|
|
89
|
+
//VTK::Renderer::Dec
|
|
90
|
+
|
|
91
|
+
//VTK::Color::Dec
|
|
92
|
+
|
|
93
|
+
//VTK::Normal::Dec
|
|
94
|
+
|
|
95
|
+
//VTK::TCoord::Dec
|
|
96
|
+
|
|
97
|
+
//VTK::Select::Dec
|
|
98
|
+
|
|
99
|
+
//VTK::RenderEncoder::Dec
|
|
100
|
+
|
|
101
|
+
//VTK::Mapper::Dec
|
|
102
|
+
|
|
103
|
+
//VTK::IOStructs::Dec
|
|
104
|
+
|
|
105
|
+
@fragment
|
|
106
|
+
fn main(
|
|
107
|
+
//VTK::IOStructs::Input
|
|
108
|
+
)
|
|
109
|
+
//VTK::IOStructs::Output
|
|
110
|
+
{
|
|
111
|
+
var output : fragmentOutput;
|
|
112
|
+
|
|
113
|
+
//VTK::Color::Impl
|
|
114
|
+
|
|
115
|
+
//VTK::Normal::Impl
|
|
116
|
+
|
|
117
|
+
//VTK::Light::Impl
|
|
118
|
+
|
|
119
|
+
//VTK::TCoord::Impl
|
|
120
|
+
|
|
121
|
+
//VTK::Select::Impl
|
|
122
|
+
|
|
123
|
+
// var computedColor:vec4<f32> = vec4<f32>(1.0,0.5,0.5,1.0);
|
|
124
|
+
|
|
125
|
+
//VTK::RenderEncoder::Impl
|
|
126
|
+
return output;
|
|
127
|
+
}
|
|
128
|
+
`;function Fg(t,e){e.classHierarchy.push("vtkWebGPUSimpleMapper"),t.generateShaderDescriptions=(n,r,s)=>{const a=Ur.newInstance({type:"vertex",hash:n,code:e.vertexShaderTemplate}),i=Ur.newInstance({type:"fragment",hash:n,code:e.fragmentShaderTemplate}),o=r.getShaderDescriptions();o.push(a),o.push(i);const c=e.vertexShaderTemplate+e.fragmentShaderTemplate,g=new RegExp("//VTK::[^:]*::","g"),T=c.match(g).filter((f,y,w)=>w.indexOf(f)===y).map(f=>`replaceShader${f.substring(7,f.length-2)}`);for(let f=0;f<T.length;f++){const y=T[f];y!=="replaceShaderIOStructs"&&e.shaderReplacements.has(y)&&e.shaderReplacements.get(y)(n,r,s)}t.replaceShaderIOStructs(n,r,s)},t.replaceShaderIOStructs=(n,r,s)=>{const a=r.getShaderDescription("vertex");a.replaceShaderCode(null,s),r.getShaderDescription("fragment").replaceShaderCode(a)},t.replaceShaderRenderEncoder=(n,r,s)=>{e.renderEncoder.replaceShaderCode(r)},e.shaderReplacements.set("replaceShaderRenderEncoder",t.replaceShaderRenderEncoder),t.replaceShaderRenderer=(n,r,s)=>{if(!e.WebGPURenderer)return;const a=e.WebGPURenderer.getBindGroup().getShaderCode(r),i=r.getShaderDescription("vertex");let o=i.getCode();o=Ce.substitute(o,"//VTK::Renderer::Dec",[a]).result,i.setCode(o);const c=r.getShaderDescription("fragment");o=c.getCode(),o=Ce.substitute(o,"//VTK::Renderer::Dec",[a]).result,c.setCode(o)},e.shaderReplacements.set("replaceShaderRenderer",t.replaceShaderRenderer),t.replaceShaderMapper=(n,r,s)=>{const a=e.bindGroup.getShaderCode(r),i=r.getShaderDescription("vertex");let o=i.getCode();o=Ce.substitute(o,"//VTK::Mapper::Dec",[a]).result,i.setCode(o);const c=r.getShaderDescription("fragment");c.addBuiltinInput("bool","@builtin(front_facing) frontFacing"),o=c.getCode(),o=Ce.substitute(o,"//VTK::Mapper::Dec",[a]).result,c.setCode(o)},e.shaderReplacements.set("replaceShaderMapper",t.replaceShaderMapper),t.replaceShaderPosition=(n,r,s)=>{const a=r.getShaderDescription("vertex");a.addBuiltinOutput("vec4<f32>","@builtin(position) Position");let i=a.getCode();i=Ce.substitute(i,"//VTK::Position::Impl",[" output.Position = rendererUBO.SCPCMatrix*vertexBC;"]).result,a.setCode(i)},e.shaderReplacements.set("replaceShaderPosition",t.replaceShaderPosition),t.replaceShaderTCoord=(n,r,s)=>{r.getShaderDescription("vertex").addOutput("vec2<f32>","tcoordVS")},e.shaderReplacements.set("replaceShaderTCoord",t.replaceShaderTCoord),t.addTextureView=n=>{e.textureViews.includes(n)||e.textureViews.push(n)},t.prepareToDraw=n=>{e.renderEncoder=n,t.updateInput(),t.updateBuffers(),t.updateBindings(),t.updatePipeline()},t.updateInput=()=>{},t.updateBuffers=()=>{},t.updateBindings=()=>{e.bindGroup.setBindables(t.getBindables())},t.computePipelineHash=()=>{},t.getPipelineSettings=()=>null,t.registerDrawCallback=n=>{n.registerDrawCallback(e.pipeline,t.draw)},t.prepareAndDraw=n=>{t.prepareToDraw(n),n.setPipeline(e.pipeline),t.draw(n)},t.draw=n=>{if(e.numberOfVertices===0||e.numberOfInstances===0)return;const r=n.getBoundPipeline();n.activateBindGroup(e.bindGroup),e.WebGPURenderer&&e.WebGPURenderer.bindUBO(n),r.bindVertexInput(n,e.vertexInput);const s=e.vertexInput.getIndexBuffer();s?n.drawIndexed(s.getIndexCount(),e.numberOfInstances,0,0,0):n.draw(e.numberOfVertices,e.numberOfInstances,0,0)},t.getBindables=()=>{const n=[...e.additionalBindables];e.UBO&&n.push(e.UBO),e.SSBO&&n.push(e.SSBO);for(let r=0;r<e.textureViews.length;r++){n.push(e.textureViews[r]);const s=e.textureViews[r].getSampler();s&&n.push(s)}return n},t.updatePipeline=()=>{t.computePipelineHash(),e.pipeline=e.device.getPipeline(e.pipelineHash),e.pipeline||(e.pipeline=hg.newInstance(),e.pipeline.setDevice(e.device),e.WebGPURenderer&&e.pipeline.addBindGroupLayout(e.WebGPURenderer.getBindGroup()),e.pipeline.addBindGroupLayout(e.bindGroup),t.generateShaderDescriptions(e.pipelineHash,e.pipeline,e.vertexInput),e.pipeline.setExtraPipelineSettings(t.getPipelineSettings()),e.pipeline.setTopology(e.topology),e.pipeline.setRenderEncoder(e.renderEncoder),e.pipeline.setVertexState(e.vertexInput.getVertexInputInformation()),e.device.createPipeline(e.pipelineHash,e.pipeline))},t.releaseGraphicsResources=()=>{e.vertexInput?.releaseGraphicsResources?.(),e.bindGroup?.releaseGraphicsResources?.(),e.UBO?.releaseGraphicsResources?.(),e.SSBO?.releaseGraphicsResources?.(),e.pipeline=null,e.renderEncoder=null,e.textureViews.length=0}}var Bg={additionalBindables:void 0,bindGroup:null,device:null,fragmentShaderTemplate:null,numberOfInstances:1,numberOfVertices:0,pipelineHash:null,shaderReplacements:null,SSBO:null,textureViews:null,topology:"triangle-list",UBO:null,vertexShaderTemplate:null,WebGPURenderer:null};function ls(t,e,n={}){Object.assign(e,Bg,n),An.extend(t,e,n),e.textureViews=[],e.vertexInput=Mg.newInstance(),e.bindGroup=fg.newInstance({label:"mapperBG"}),e.additionalBindables=[],e.fragmentShaderTemplate=e.fragmentShaderTemplate||Dg,e.vertexShaderTemplate=e.vertexShaderTemplate||Og,e.shaderReplacements=new Map,C.get(t,e,["pipeline","vertexInput"]),C.setGet(t,e,["additionalBindables","device","fragmentShaderTemplate","interpolate","numberOfInstances","numberOfVertices","pipelineHash","shaderReplacements","SSBO","textureViews","topology","UBO","vertexShaderTemplate","WebGPURenderer"]),Fg(t,e)}var Ng=C.newInstance(ls,"vtkWebGPUSimpleMapper"),Gg={newInstance:Ng,extend:ls};function Ug(t,e){e.classHierarchy.push("vtkWebGPUFullScreenQuad"),t.replaceShaderPosition=(n,r,s)=>{const a=r.getShaderDescription("vertex");a.addBuiltinOutput("vec4<f32>","@builtin(position) Position"),a.addOutput("vec4<f32>","vertexVC");let i=a.getCode();i=Ce.substitute(i,"//VTK::Position::Impl",["output.tcoordVS = vec2<f32>(vertexBC.x * 0.5 + 0.5, 1.0 - vertexBC.y * 0.5 - 0.5);","output.Position = vec4<f32>(vertexBC, 1.0);","output.vertexVC = vec4<f32>(vertexBC, 1);"]).result,a.setCode(i)},e.shaderReplacements.set("replaceShaderPosition",t.replaceShaderPosition),t.updateBuffers=()=>{const n=e.device.getBufferManager().getFullScreenQuadBuffer();e.vertexInput.addBuffer(n,["vertexBC"]),e.numberOfVertices=6}}var Vg={};function xs(t,e,n={}){Object.assign(e,Vg,n),Gg.extend(t,e,n),Ug(t,e)}var kg=C.newInstance(xs,"vtkWebGPUFullScreenQuad"),Np={newInstance:kg,extend:xs},$g={Verts:0,Lines:1,Triangles:2,Strips:3,LinesFromStrips:4,LinesFromTriangles:5,Points:6,UniformArray:7,PointArray:8,NormalsFromPoints:9,Texture:10,RawVertex:11,Storage:12,Index:13},Wg={Start:0,Points:0,Lines:1,Triangles:2,TriangleStrips:3,TriangleEdges:4,TriangleStripEdges:5,End:6},wt={BufferUsage:$g,PrimitiveTypes:Wg},yn=["getMappedRange","mapAsync","unmap"];function Hg(t,e,n,r){const s=r.byteLength,a=t.createBuffer({size:s,usage:GPUBufferUsage.COPY_SRC,mappedAtCreation:!0}),i=a.getMappedRange(0,s);new Uint8Array(i).set(new Uint8Array(r)),a.unmap();const o=t.createCommandEncoder();o.copyBufferToBuffer(a,0,e,n,s);const c=o.finish();t.queue.submit([c]),a.destroy()}function zg(t,e){e.classHierarchy.push("vtkWebGPUBuffer"),t.create=(n,r)=>{e.handle=e.device.getHandle().createBuffer({size:n,usage:r,label:e.label}),e.sizeInBytes=n,e.usage=r},t.write=n=>{Hg(e.device.getHandle(),e.handle,0,n.buffer)},t.createAndWrite=(n,r)=>{const s=Math.ceil(n.byteLength/4)*4;e.handle=e.device.getHandle().createBuffer({size:s,usage:r,mappedAtCreation:!0,label:e.label}),e.sizeInBytes=s,e.usage=r,new Uint8Array(e.handle.getMappedRange()).set(new Uint8Array(n.buffer)),e.handle.unmap()};for(let n=0;n<yn.length;n++)t[yn[n]]=(...r)=>e.handle[yn[n]](...r)}var jg={device:null,handle:null,sizeInBytes:0,strideInBytes:0,arrayInformation:null,usage:null,label:null,sourceTime:null};function Es(t,e,n={}){Object.assign(e,jg,n),C.obj(t,e),C.get(t,e,["handle","sizeInBytes","usage"]),C.setGet(t,e,["strideInBytes","device","arrayInformation","label","sourceTime"]),zg(t,e)}var Xg=C.newInstance(Es),kn={newInstance:Xg,extend:Es,...wt},{Representation:kr}=mn,{PrimitiveTypes:Ue}=wt,Kg=class{constructor(){this.keys=new Uint32Array(10),this.values=new Uint32Array(10),this.count=0}clear(){this.count=0}has(t){for(let e=0;e<this.count;e++)if(this.keys[e]===t)return!0;return!1}get(t){for(let e=0;e<this.count;e++)if(this.keys[e]===t)return this.values[e]}set(t,e){this.count<9&&(this.keys[this.count]=t,this.values[this.count++]=e)}};function Yg(t){switch(t){case Ue.Points:return"points";case Ue.Lines:return"lines";case Ue.Triangles:case Ue.TriangleEdges:return"polys";case Ue.TriangleStripEdges:case Ue.TriangleStrips:return"strips";default:return""}}function Gt(t,e,n){let r=t.pointIdToFlatId[e];return r<0&&(r=t.flatId,t.pointIdToFlatId[e]=r,t.flatIdToPointId[t.flatId]=e,t.flatIdToCellId[t.flatId]=n,t.flatId++),r}function Zg(t,e,n){const r=t.length;for(let i=0;i<r;i++){let o=t[i];if(n.cellProvokedMap.has(o)){n.ibo[n.iboId++]=n.cellProvokedMap.get(o);for(let c=i+1;c<i+r;c++){o=t[c%r];const g=Gt(n,o,e);n.ibo[n.iboId++]=g}return}}for(let i=0;i<r;i++){let o=t[i];if(!n.provokedPointIds[o]){let c=Gt(n,o,e);n.provokedPointIds[o]=1,n.cellProvokedMap.set(o,c),n.flatIdToCellId[c]=e,n.ibo[n.iboId++]=c;for(let g=i+1;g<i+r;g++)o=t[g%r],c=Gt(n,o,e),n.ibo[n.iboId++]=c;return}}let s=t[0],a=n.flatId;n.cellProvokedMap.set(s,a),n.flatIdToPointId[n.flatId]=s,n.flatIdToCellId[n.flatId]=e,n.flatId++,n.ibo[n.iboId++]=a;for(let i=1;i<r;i++)s=t[i],a=Gt(n,s,e),n.ibo[n.iboId++]=a}function Qg(t,e,n){const r=t.length;n.iboSize+=r;for(let s=0;s<r;s++){const a=t[s];if(n.cellProvokedMap.has(a))return}for(let s=0;s<r;s++){const a=t[s];if(!n.provokedPointIds[a]){n.provokedPointIds[a]=1,n.cellProvokedMap.set(a,1);return}}n.cellProvokedMap.set(t[0],1),n.extraPoints++}var Ee,$r=new Uint32Array(1),ue=new Uint32Array(2),Fe=new Uint32Array(3),ln={anythingToPoints(t,e,n,r,s){for(let a=0;a<t;++a)$r[0]=e[n+a],Ee($r,r,s)},linesToWireframe(t,e,n,r,s){for(let a=0;a<t-1;++a)ue[0]=e[n+a],ue[1]=e[n+a+1],Ee(ue,r,s)},polysToWireframe(t,e,n,r,s){if(t>2)for(let a=0;a<t;++a)ue[0]=e[n+a],ue[1]=e[n+(a+1)%t],Ee(ue,r,s)},stripsToWireframe(t,e,n,r,s){if(t>2){for(let a=0;a<t-1;++a)ue[0]=e[n+a],ue[1]=e[n+a+1],Ee(ue,r,s);for(let a=0;a<t-2;a++)ue[0]=e[n+a],ue[1]=e[n+a+2],Ee(ue,r,s)}},polysToSurface(t,e,n,r,s){for(let a=0;a<t-2;a++)Fe[0]=e[n],Fe[1]=e[n+a+1],Fe[2]=e[n+a+2],Ee(Fe,r,s)},stripsToSurface(t,e,n,r,s){for(let a=0;a<t-2;a++)Fe[0]=e[n+a],Fe[1]=e[n+a+1+a%2],Fe[2]=e[n+a+1+(a+1)%2],Ee(Fe,r,s)}};function Jg(t,e){e.classHierarchy.push("vtkWebGPUIndexBuffer"),t.buildIndexBuffer=n=>{const r=n.cells,s=n.primitiveType,a=n.representation,i=n.cellOffset,o=r.getData(),c=o.length,g=Yg(s),T=n.numberOfPoints,f={provokedPointIds:new Uint8Array(T),extraPoints:0,iboSize:0,flatId:0,iboId:0,cellProvokedMap:new Kg};let y=null;a===kr.POINTS||s===Ue.Points?y=ln.anythingToPoints:a===kr.WIREFRAME||s===Ue.Lines?y=ln[`${g}ToWireframe`]:y=ln[`${g}ToSurface`],Ee=Qg;let w=i||0;for(let R=0;R<c;)f.cellProvokedMap.clear(),y(o[R],o,R+1,w,f),R+=o[R]+1,w++;T<=65535?f.flatIdToPointId=new Uint16Array(T+f.extraPoints):f.flatIdToPointId=new Uint32Array(T+f.extraPoints),T+f.extraPoints<=32767?f.pointIdToFlatId=new Int16Array(T):f.pointIdToFlatId=new Int32Array(T),T+f.extraPoints<=65535?(f.ibo=new Uint16Array(f.iboSize),n.format="uint16"):(f.ibo=new Uint32Array(f.iboSize),n.format="uint32"),w<=65535?f.flatIdToCellId=new Uint16Array(T+f.extraPoints):f.flatIdToCellId=new Uint32Array(T+f.extraPoints),f.pointIdToFlatId.fill(-1),f.provokedPointIds.fill(0),Ee=Zg,w=i||0;for(let R=0;R<c;)f.cellProvokedMap.clear(),y(o[R],o,R+1,w,f),R+=o[R]+1,w++;delete f.provokedPointIds,delete f.pointIdToFlatId,n.nativeArray=f.ibo,e.flatIdToPointId=f.flatIdToPointId,e.flatIdToCellId=f.flatIdToCellId,e.flatSize=f.flatId,e.indexCount=f.iboId}}var qg={flatIdToPointId:null,flatIdToCellId:null,flatSize:0,indexCount:0};function Ss(t,e,n={}){Object.assign(e,qg,n),kn.extend(t,e,n),C.setGet(t,e,["flatIdToPointId","flatIdToCellId","flatSize","indexCount"]),Jg(t,e)}var Ag=C.newInstance(Ss),bg={newInstance:Ag,extend:Ss,...wt},{BufferUsage:xe}=wt,{vtkErrorMacro:Ig}=zn,{VtkDataTypes:We}=ne,mg={};function Wr(t){let e;switch(t.getDataType()){case We.UNSIGNED_CHAR:e="uint8";break;case We.FLOAT:e="float32";break;case We.UNSIGNED_INT:e="uint32";break;case We.INT:e="sint32";break;case We.DOUBLE:e="float32";break;case We.UNSIGNED_SHORT:e="uint16";break;case We.SHORT:e="sin16";break;default:e="float32";break}switch(t.getNumberOfComponents()){case 2:e+="x2";break;case 3:e.includes("32")||Ig(`unsupported x3 type for ${e}`),e+="x3";break;case 4:e+="x4";break}return e}function Hr(t,e,n,r,s){const a={},i=t.getFlatSize();if(!i)return a;let o=[0,0,0,0];s.shift&&(s.shift.length?o=s.shift:o.fill(s.shift));let c=[1,1,1,1];s.scale&&(s.scale.length?c=s.scale:c.fill(s.scale));const g=Object.prototype.hasOwnProperty.call(s,"packExtra")?s.packExtra:!1;let T,f=0;const y=ea(r,i*(n+(g?1:0)));let w=t.getFlatIdToPointId(),R=0;s.cellData&&(w=t.getFlatIdToCellId(),R=s.cellOffset||0),n===1?T=function(x){y[f++]=c[0]*e[x]+o[0]}:n===2?T=function(x){y[f++]=c[0]*e[x]+o[0],y[f++]=c[1]*e[x+1]+o[1]}:n===3&&!g?T=function(x){y[f++]=c[0]*e[x]+o[0],y[f++]=c[1]*e[x+1]+o[1],y[f++]=c[2]*e[x+2]+o[2]}:n===3&&g?T=function(x){y[f++]=c[0]*e[x]+o[0],y[f++]=c[1]*e[x+1]+o[1],y[f++]=c[2]*e[x+2]+o[2],y[f++]=c[3]*1+o[3]}:n===4&&(T=function(x){y[f++]=c[0]*e[x]+o[0],y[f++]=c[1]*e[x+1]+o[1],y[f++]=c[2]*e[x+2]+o[2],y[f++]=c[3]*e[x+3]+o[3]});for(let l=0;l<i;l++){const x=n*(w[l]-R);T(x)}return a.nativeArray=y,a}function Pg(t,e,n,r){const s=[t[r*3]-t[n*3],t[r*3+1]-t[n*3+1],t[r*3+2]-t[n*3+2]],a=[t[e*3]-t[n*3],t[e*3+1]-t[n*3+1],t[e*3+2]-t[n*3+2]],i=[];return de(s,a,i),_e(i),i}function e0(t,e){const n=e.getData(),r=t.getData();if(!r||!n)return null;const s=new Int8Array(t.getNumberOfCells()*4),a=r.length;let i=0;for(let o=0;o<a;){const c=Pg(n,r[o+1],r[o+2],r[o+3]);s[i++]=127*c[0],s[i++]=127*c[1],s[i++]=127*c[2],s[i++]=127,o+=r[o]+1}return s}function t0(t,e){e.classHierarchy.push("vtkWebGPUBufferManager");function n(r){r.dataArray&&!r.nativeArray&&(r.nativeArray=r.dataArray.getData());let s,a;if(r.usage===xe.Index&&(s=bg.newInstance({label:r.label}),s.setDevice(e.device),a=GPUBufferUsage.INDEX|GPUBufferUsage.COPY_DST,s.buildIndexBuffer(r),s.createAndWrite(r.nativeArray,a),s.setArrayInformation([{format:r.format}])),s||(s=kn.newInstance({label:r.label}),s.setDevice(e.device)),r.usage===xe.UniformArray&&(a=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,s.createAndWrite(r.nativeArray,a)),r.usage===xe.Storage&&(a=GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST,s.createAndWrite(r.nativeArray,a)),r.usage===xe.Texture&&(a=GPUBufferUsage.COPY_SRC,s.createAndWrite(r.nativeArray,a)),r.usage===xe.PointArray){a=GPUBufferUsage.VERTEX;const i=se.getNativeTypeFromBufferFormat(r.format),o=Hr(r.indexBuffer,r.dataArray.getData(),r.dataArray.getNumberOfComponents(),i,{packExtra:r.packExtra,shift:r.shift,scale:r.scale,cellData:r.cellData,cellOffset:r.cellOffset});s.createAndWrite(o.nativeArray,a),s.setStrideInBytes(se.getByteStrideFromBufferFormat(r.format)),s.setArrayInformation([{offset:0,format:r.format,interpolation:r.cellData?"flat":"perspective"}])}if(r.usage===xe.NormalsFromPoints){a=GPUBufferUsage.VERTEX;const i=se.getNativeTypeFromBufferFormat(r.format),o=e0(r.cells,r.dataArray),c=Hr(r.indexBuffer,o,4,i,{cellData:!0,cellOffset:r.cellOffset});s.createAndWrite(c.nativeArray,a),s.setStrideInBytes(se.getByteStrideFromBufferFormat(r.format)),s.setArrayInformation([{offset:0,format:r.format,interpolation:"flat"}])}return r.usage===xe.RawVertex&&(a=GPUBufferUsage.VERTEX,s.createAndWrite(r.nativeArray,a),s.setStrideInBytes(se.getByteStrideFromBufferFormat(r.format)),s.setArrayInformation([{offset:0,format:r.format,interpolation:r.interpolation}])),s.setSourceTime(r.time),s}t.hasBuffer=r=>e.device.hasCachedObject(r),t.getBuffer=r=>r.hash?e.device.getCachedObject(r.hash,n,r):n(r),t.getBufferForPointArray=(r,s)=>{const a=Wr(r),i={hash:`${r.getMTime()}I${s.getMTime()}${a}`,usage:xe.PointArray,format:a,dataArray:r,indexBuffer:s};return t.getBuffer(i)},t.getBufferForCellArray=(r,s,a=0)=>{const i=Wr(r),o={hash:`cell${r.getMTime()}I${s.getMTime()}O${a}${i}`,usage:xe.PointArray,format:i,dataArray:r,indexBuffer:s,cellData:!0,cellOffset:a};return t.getBuffer(o)},t.getFullScreenQuadBuffer=()=>{if(e.fullScreenQuadBuffer)return e.fullScreenQuadBuffer;e.fullScreenQuadBuffer=kn.newInstance(),e.fullScreenQuadBuffer.setDevice(e.device);const r=new Float32Array([-1,-1,0,1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,1,0]);return e.fullScreenQuadBuffer.createAndWrite(r,GPUBufferUsage.VERTEX),e.fullScreenQuadBuffer.setStrideInBytes(12),e.fullScreenQuadBuffer.setArrayInformation([{offset:0,format:"float32x3"}]),e.fullScreenQuadBuffer}}var n0={device:null,fullScreenQuadBuffer:null};function Rs(t,e,n={}){Object.assign(e,n0,n),it(t,e),Ct(t,e,["device"]),t0(t,e)}var r0=ot(Rs),Cs={newInstance:r0,extend:Rs,...mg,...wt},{BufferUsage:a0}=Cs,{vtkErrorMacro:xn}=C;function s0(t,e){e.classHierarchy.push("vtkWebGPUUniformBuffer");function n(r){if(e.UBO)return;t.sortBufferEntries(),t.createView("Float32Array");const s={nativeArray:e.Float32Array,usage:a0.UniformArray,label:e.label};e.UBO=r.getBufferManager().getBuffer(s),e.bindGroupTime.modified(),e.sendDirty=!1}t.addEntry=(r,s)=>{if(e._bufferEntryNames.has(r)){xn(`entry named ${r} already exists`);return}e.sortDirty=!0,e._bufferEntryNames.set(r,e.bufferEntries.length),e.bufferEntries.push({name:r,type:s,sizeInBytes:se.getByteStrideFromShaderFormat(s),offset:-1,nativeType:se.getNativeTypeFromShaderFormat(s),packed:!1})},t.sortBufferEntries=()=>{if(!e.sortDirty)return;let r=0;const s=[];let a=4;for(let i=0;i<e.bufferEntries.length;i++){const o=e.bufferEntries[i];o.sizeInBytes%16===0&&(a=Math.max(16,a)),o.sizeInBytes%8===0&&(a=Math.max(8,a))}for(let i=0;i<e.bufferEntries.length;i++){const o=e.bufferEntries[i];o.packed===!1&&o.sizeInBytes%16===0&&(o.packed=!0,o.offset=r,s.push(o),r+=o.sizeInBytes)}for(let i=0;i<e.bufferEntries.length;i++){const o=e.bufferEntries[i];if(o.packed===!1&&o.sizeInBytes===12)for(let c=0;c<e.bufferEntries.length;c++){const g=e.bufferEntries[c];if(g.packed===!1&&g.sizeInBytes===4){o.packed=!0,o.offset=r,s.push(o),r+=o.sizeInBytes,g.packed=!0,g.offset=r,s.push(g),r+=g.sizeInBytes;break}}}for(let i=0;i<e.bufferEntries.length;i++){const o=e.bufferEntries[i];if(!o.packed&&o.sizeInBytes%8===0)for(let c=i+1;c<e.bufferEntries.length;c++){const g=e.bufferEntries[c];if(!g.packed&&g.sizeInBytes%8===0){o.packed=!0,o.offset=r,s.push(o),r+=o.sizeInBytes,g.packed=!0,g.offset=r,s.push(g),r+=g.sizeInBytes;break}}}for(let i=0;i<e.bufferEntries.length;i++){const o=e.bufferEntries[i];if(!o.packed&&o.sizeInBytes%8===0){let c=!1;for(let g=0;!c&&g<e.bufferEntries.length;g++){const T=e.bufferEntries[g];if(!T.packed&&T.sizeInBytes===4)for(let f=g+1;f<e.bufferEntries.length;f++){const y=e.bufferEntries[f];if(!y.packed&&y.sizeInBytes===4){o.packed=!0,o.offset=r,s.push(o),r+=o.sizeInBytes,T.packed=!0,T.offset=r,s.push(T),r+=T.sizeInBytes,y.packed=!0,y.offset=r,s.push(y),r+=y.sizeInBytes,c=!0;break}}}}}for(let i=0;i<e.bufferEntries.length;i++){const o=e.bufferEntries[i];!o.packed&&o.sizeInBytes>4&&(o.packed=!0,o.offset=r,s.push(o),r+=o.sizeInBytes)}for(let i=0;i<e.bufferEntries.length;i++){const o=e.bufferEntries[i];o.packed||(o.packed=!0,o.offset=r,s.push(o),r+=o.sizeInBytes)}e.bufferEntries=s,e._bufferEntryNames.clear();for(let i=0;i<e.bufferEntries.length;i++)e._bufferEntryNames.set(e.bufferEntries[i].name,i);e.sizeInBytes=r,e.sizeInBytes=a*Math.ceil(e.sizeInBytes/a),e.sortDirty=!1},t.sendIfNeeded=r=>{e.device=r,n(r),e.sendDirty&&(r.getHandle().queue.writeBuffer(e.UBO.getHandle(),0,e.arrayBuffer,0,e.sizeInBytes),e.sendDirty=!1),e.sendTime.modified()},t.createView=r=>{r in e||(e.arrayBuffer||(e.arrayBuffer=new ArrayBuffer(e.sizeInBytes)),e[r]=C.newTypedArray(r,e.arrayBuffer))},t.setValue=(r,s)=>{t.sortBufferEntries();const a=e._bufferEntryNames.get(r);if(a===void 0){xn(`entry named ${r} not found in UBO`);return}const i=e.bufferEntries[a];t.createView(i.nativeType);const o=e[i.nativeType];i.lastValue!==s&&(o[i.offset/o.BYTES_PER_ELEMENT]=s,e.sendDirty=!0),i.lastValue=s},t.setArray=(r,s)=>{t.sortBufferEntries();const a=e._bufferEntryNames.get(r);if(a===void 0){xn(`entry named ${r} not found in UBO`);return}const i=e.bufferEntries[a];t.createView(i.nativeType);const o=e[i.nativeType];let c=!1;for(let g=0;g<s.length;g++)(!i.lastValue||i.lastValue[g]!==s[g])&&(o[i.offset/o.BYTES_PER_ELEMENT+g]=s[g],c=!0);c&&(e.sendDirty=!0,i.lastValue=[...s])},t.getBindGroupEntry=()=>(!e.UBO&&e.device&&n(e.device),{resource:{buffer:e.UBO.getHandle()}}),t.getSendTime=()=>e.sendTime.getMTime(),t.getShaderCode=(r,s)=>{t.sortBufferEntries();const a=[`struct ${e.label}Struct
|
|
129
|
+
{`];for(let i=0;i<e.bufferEntries.length;i++){const o=e.bufferEntries[i];a.push(` ${o.name}: ${o.type},`)}return a.push(`};
|
|
130
|
+
@binding(${r}) @group(${s}) var<uniform> ${e.label}: ${e.label}Struct;`),a.join(`
|
|
131
|
+
`)},t.releaseGraphicsResources=()=>{e.UBO=null,e.bindGroupTime.modified(),e.sendDirty=!0}}var i0={bufferEntries:null,bufferEntryNames:null,sizeInBytes:0,label:null,bindGroupLayoutEntry:null,bindGroupEntry:null};function ws(t,e,n={}){Object.assign(e,i0,n),C.obj(t,e),e._bufferEntryNames=new Map,e.bufferEntries=[],e.bindGroupLayoutEntry=e.bindGroupLayoutEntry||{buffer:{type:"uniform"}},e.sendTime={},C.obj(e.sendTime,{mtime:0}),e.bindGroupTime={},C.obj(e.bindGroupTime,{mtime:0}),e.sendDirty=!0,e.sortDirty=!0,C.get(t,e,["binding","bindGroupTime"]),C.setGet(t,e,["bindGroupLayoutEntry","device","label","sizeInBytes"]),s0(t,e)}var o0=C.newInstance(ws,"vtkWebGPUUniformBuffer"),Gp={newInstance:o0,extend:ws};function Up(t,e){for(let n=0;n<6;n++)t.addEntry(`${e}${n}`,"vec4<f32>")}function Vp({countName:t,planePrefix:e,positionName:n,returnValue:r="discard"}){const s=[];for(let a=0;a<6;a++)s.push(` if (${t} > ${a}u && dot(${e}${a}, ${n}) < 0.0) { ${r}; }`);return s}function kp(t,e,n){const r=t.getClippingPlanes().length;for(let s=0;s<r;s++)t.getClippingPlaneInCoords(e,s,n[s]);return r}var{BufferUsage:f0}=Cs,{vtkErrorMacro:Pe}=C;function c0(t,e){e.classHierarchy.push("vtkWebGPUStorageBuffer");function n(r){if(e._buffer)return;t.createView("Float32Array");const s={nativeArray:e.Float32Array,usage:f0.Storage,label:e.label};e._buffer=r.getBufferManager().getBuffer(s),e.bindGroupTime.modified()}t.addEntry=(r,s)=>{if(e._bufferEntryNames.has(r)){Pe(`entry named ${r} already exists`);return}e._bufferEntryNames.set(r,e.bufferEntries.length);const a=se.getByteStrideFromShaderFormat(s);e.bufferEntries.push({name:r,type:s,sizeInBytes:a,offset:e.sizeInBytes,nativeType:se.getNativeTypeFromShaderFormat(s)}),e.sizeInBytes+=a},t.send=r=>{if(e.device=r,!e._buffer){n(r),e._sendTime.modified();return}r.getHandle().queue.writeBuffer(e._buffer.getHandle(),0,e.arrayBuffer,0,e.sizeInBytes*e.numberOfInstances),e._sendTime.modified()},t.createView=r=>{r in e||(e.arrayBuffer||(e.arrayBuffer=new ArrayBuffer(e.sizeInBytes*e.numberOfInstances)),e[r]=C.newTypedArray(r,e.arrayBuffer))},t.setValue=(r,s,a)=>{const i=e._bufferEntryNames.get(r);if(i===void 0){Pe(`entry named ${r} not found in UBO`);return}const o=e.bufferEntries[i];t.createView(o.nativeType);const c=e[o.nativeType];c[(o.offset+s*e.sizeInBytes)/c.BYTES_PER_ELEMENT]=a},t.setArray=(r,s,a)=>{const i=e._bufferEntryNames.get(r);if(i===void 0){Pe(`entry named ${r} not found in UBO`);return}const o=e.bufferEntries[i];t.createView(o.nativeType);const c=e[o.nativeType],g=(o.offset+s*e.sizeInBytes)/c.BYTES_PER_ELEMENT;for(let T=0;T<a.length;T++)c[g+T]=a[T]},t.setAllInstancesFromArray=(r,s)=>{const a=e._bufferEntryNames.get(r);if(a===void 0){Pe(`entry named ${r} not found in UBO`);return}const i=e.bufferEntries[a];t.createView(i.nativeType);const o=e[i.nativeType],c=s.length/e.numberOfInstances;for(let g=0;g<e.numberOfInstances;g++){const T=(i.offset+g*e.sizeInBytes)/o.BYTES_PER_ELEMENT;for(let f=0;f<c;f++)o[T+f]=s[g*c+f]}},t.setAllInstancesFromArrayColorToFloat=(r,s)=>{const a=e._bufferEntryNames.get(r);if(a===void 0){Pe(`entry named ${r} not found in UBO`);return}const i=e.bufferEntries[a];t.createView(i.nativeType);const o=e[i.nativeType],c=s.length/e.numberOfInstances;for(let g=0;g<e.numberOfInstances;g++){const T=(i.offset+g*e.sizeInBytes)/o.BYTES_PER_ELEMENT;for(let f=0;f<c;f++)o[T+f]=s[g*c+f]/255}},t.setAllInstancesFromArray3x3To4x4=(r,s)=>{const a=e._bufferEntryNames.get(r);if(a===void 0){Pe(`entry named ${r} not found in UBO`);return}const i=e.bufferEntries[a];t.createView(i.nativeType);const o=e[i.nativeType],c=9;for(let g=0;g<e.numberOfInstances;g++){const T=(i.offset+g*e.sizeInBytes)/o.BYTES_PER_ELEMENT;for(let f=0;f<3;f++)for(let y=0;y<3;y++)o[T+f*4+y]=s[g*c+f*3+y]}},t.getSendTime=()=>e._sendTime.getMTime(),t.getShaderCode=(r,s)=>{const a=[`struct ${e.label}StructEntry
|
|
132
|
+
{`];for(let i=0;i<e.bufferEntries.length;i++){const o=e.bufferEntries[i];a.push(` ${o.name}: ${o.type},`)}return a.push(`
|
|
133
|
+
};
|
|
134
|
+
struct ${e.label}Struct
|
|
135
|
+
{
|
|
136
|
+
values: array<${e.label}StructEntry>,
|
|
137
|
+
};
|
|
138
|
+
@binding(${r}) @group(${s}) var<storage, read> ${e.label}: ${e.label}Struct;
|
|
139
|
+
`),a.join(`
|
|
140
|
+
`)},t.getBindGroupEntry=()=>(!e._buffer&&e.device&&n(e.device),{resource:{buffer:e._buffer.getHandle()}}),t.clearData=()=>{e.numberOfInstances=0,e.sizeInBytes=0,e.bufferEntries=[],e._bufferEntryNames=new Map,e._buffer=null,delete e.arrayBuffer,delete e.Float32Array},t.releaseGraphicsResources=()=>{e._buffer=null,e.bindGroupTime.modified()}}var u0={bufferEntries:null,bufferEntryNames:null,sizeInBytes:0,label:null,numberOfInstances:1};function ds(t,e,n={}){Object.assign(e,u0,n),C.obj(t,e),e._bufferEntryNames=new Map,e.bufferEntries=[],e._sendTime={},C.obj(e._sendTime,{mtime:0}),e.bindGroupTime={},C.obj(e.bindGroupTime,{mtime:0}),e.bindGroupLayoutEntry=e.bindGroupLayoutEntry||{buffer:{type:"read-only-storage"}},C.get(t,e,["bindGroupTime"]),C.setGet(t,e,["device","bindGroupLayoutEntry","label","numberOfInstances","sizeInBytes"]),c0(t,e)}var g0=C.newInstance(ds,"vtkWebGPUStorageBuffer"),$p={newInstance:g0,extend:ds};function h0(t,e){e.classHierarchy.push("vtkWebGPUSampler"),t.create=(n,r={})=>{e.device=n,e.options.addressModeU=r.addressModeU?r.addressModeU:"clamp-to-edge",e.options.addressModeV=r.addressModeV?r.addressModeV:"clamp-to-edge",e.options.addressModeW=r.addressModeW?r.addressModeW:"clamp-to-edge",e.options.magFilter=r.magFilter?r.magFilter:"nearest",e.options.minFilter=r.minFilter?r.minFilter:"nearest",e.options.mipmapFilter=r.mipmapFilter?r.mipmapFilter:"nearest",e.options.label=e.label,e.handle=e.device.getHandle().createSampler(e.options),e.bindGroupTime.modified()},t.getShaderCode=(n,r)=>`@binding(${n}) @group(${r}) var ${e.label}: sampler;`,t.getBindGroupEntry=()=>({resource:e.handle})}var p0={device:null,handle:null,label:null,options:null};function _s(t,e,n={}){Object.assign(e,p0,n),C.obj(t,e),e.options={},e.bindGroupLayoutEntry={visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,sampler:{}},e.bindGroupTime={},C.obj(e.bindGroupTime,{mtime:0}),C.get(t,e,["bindGroupTime","handle","options"]),C.setGet(t,e,["bindGroupLayoutEntry","device","label"]),h0(t,e)}var T0=C.newInstance(_s),v0={newInstance:T0,extend:_s},y0="WebGL",tn=Object.create(null);function Ls(t,e){tn[t]=e}function l0(){return Object.keys(tn)}function Ms(t,e={}){return tn[t]&&tn[t](e)}function x0(t,e){e.classHierarchy.push("vtkRenderWindow"),t.addRenderer=n=>{t.hasRenderer(n)||(n.setRenderWindow(t),e.renderers.push(n),t.modified())},t.removeRenderer=n=>{e.renderers=e.renderers.filter(r=>r!==n),t.modified()},t.hasRenderer=n=>e.renderers.indexOf(n)!==-1,t.newAPISpecificView=(n,r={})=>Ms(n||e.defaultViewAPI,r),t.addView=n=>{t.hasView(n)||(n.setRenderable(t),e._views.push(n),t.modified())},t.removeView=n=>{e._views=e._views.filter(r=>r!==n),t.modified()},t.hasView=n=>e._views.indexOf(n)!==-1,t.preRender=()=>{e.renderers.forEach(n=>{n.isActiveCameraCreated()||n.resetCamera()})},t.render=()=>{t.preRender(),e.interactor?e.interactor.render():e._views.forEach(n=>n.traverseAllPasses())},t.getStatistics=()=>{const n={propCount:0,invisiblePropCount:0,gpuMemoryMB:0};return e._views.forEach(r=>{r.getGraphicsMemoryInfo&&(n.gpuMemoryMB+=r.getGraphicsMemoryInfo()/1e6)}),e.renderers.forEach(r=>{const s=r.getViewProps(),a=e._views[0].getViewNodeFor(r);s.forEach(i=>{if(i.getVisibility()){n.propCount+=1;const o=i.getMapper&&i.getMapper();if(o&&o.getPrimitiveCount){const c=a.getViewNodeFor(o);if(c){c.getAllocatedGPUMemoryInBytes&&(n.gpuMemoryMB+=c.getAllocatedGPUMemoryInBytes()/1e6);const g=o.getPrimitiveCount();Object.keys(g).forEach(T=>{n[T]||(n[T]=0),n[T]+=g[T]})}}}else n.invisiblePropCount+=1})}),n.str=Object.keys(n).map(r=>`${r}: ${n[r]}`).join(`
|
|
141
|
+
`),n},t.captureImages=(n="image/png",r={})=>(C.setImmediate(t.render),e._views.map(s=>s.captureNextImage?s.captureNextImage(n,r):void 0).filter(s=>!!s)),t.addRenderWindow=n=>e.childRenderWindows.includes(n)?!1:(e.childRenderWindows.push(n),t.modified(),!0),t.removeRenderWindow=n=>{const r=e.childRenderWindows.findIndex(s=>s===n);return r<0?!1:(e.childRenderWindows.splice(r,1),t.modified(),!0)}}var E0={defaultViewAPI:y0,renderers:[],views:[],interactor:null,neverRendered:!0,numberOfLayers:1,childRenderWindows:[]};function Os(t,e,n={}){Object.assign(e,E0,n),C.obj(t,e),C.setGet(t,e,["interactor","numberOfLayers","_views","defaultViewAPI"]),C.get(t,e,["neverRendered"]),C.getArray(t,e,["renderers","childRenderWindows"]),C.moveToProtected(t,e,["views"]),C.event(t,e,"completion"),x0(t,e)}var S0=C.newInstance(Os,"vtkRenderWindow"),Wp={newInstance:S0,extend:Os,registerViewConstructor:Ls,listViewAPIs:l0,newAPISpecificView:Ms},R0={GLOBALIDS:0,PEDIGREEIDS:1,VALUES:2,INDICES:3,FRUSTUM:4,LOCATIONS:5,THRESHOLDS:6,BLOCKS:7,QUERY:8},C0={CELL:0,POINT:1,FIELD:2,VERTEX:3,EDGE:4,ROW:5},w0={SelectionContent:R0,SelectionField:C0};function d0(t,e){e.classHierarchy.push("vtkSelectionNode"),t.getBounds=()=>e.points.getBounds()}var _0={contentType:-1,fieldType:-1,properties:null,selectionList:[]};function Ds(t,e,n={}){Object.assign(e,_0,n),C.obj(t,e),e.properties={},C.setGet(t,e,["contentType","fieldType","properties","selectionList"]),d0(t,e)}var L0=C.newInstance(Ds,"vtkSelectionNode"),Fs={newInstance:L0,extend:Ds,...w0},je={MIN_KNOWN_PASS:0,ACTOR_PASS:0,COMPOSITE_INDEX_PASS:1,ID_LOW24:2,ID_HIGH24:3,MAX_KNOWN_PASS:3},Bs={PassTypes:je},{FieldAssociations:M0}=rn;function O0(t,e){e.classHierarchy.push("vtkHardwareSelector"),t.getSourceDataAsync=async(n,r,s,a,i)=>{},t.selectAsync=async(n,r,s,a,i)=>{const o=await t.getSourceDataAsync(n,r,s,a,i);return o?o.generateSelection(r,s,a,i):[]}}var D0={fieldAssociation:M0.FIELD_ASSOCIATION_CELLS,captureZValues:!1};function Ns(t,e,n={}){Object.assign(e,D0,n),C.obj(t,e),C.setGet(t,e,["fieldAssociation","captureZValues"]),O0(t,e)}var F0=C.newInstance(Ns,"vtkHardwareSelector"),B0={newInstance:F0,extend:Ns},{PassTypes:J}=Bs,{SelectionContent:N0,SelectionField:zr}=Fs,{FieldAssociations:Et}=rn,{vtkErrorMacro:Gs,vtkDebugMacro:ct}=C,Ve=1;function Us(t){return`${t.propID} ${t.compositeID}`}function Vs(t,e,n,r){return n?n[(e*(r[2]-r[0]+1)+t)*4+3]:0}function we(t,e,n,r,s=null){if(!n)return 0;const a=(e*(r[2]-r[0]+1)+t)*4,i=n[a],o=n[a+1];return(n[a+2]*256+o)*256+i}function ks(t,e){let n=e;return n<<=24,n|=t,n}function G0(t,e,n,r){{if(r[0]=e[0],r[1]=e[1],e[0]<t.area[0]||e[0]>t.area[2]||e[1]<t.area[1]||e[1]>t.area[3])return null;const s=[e[0]-t.area[0],e[1]-t.area[1]],a=we(s[0],s[1],t.pixBuffer[J.ACTOR_PASS],t.area,"getPixelInformationWithData1");if(a<=0||a-Ve>=t.props.length)return null;const i={};i.valid=!0,i.propID=a-Ve,i.prop=t.props[i.propID];let o=we(s[0],s[1],t.pixBuffer[J.COMPOSITE_INDEX_PASS],t.area,"getPixelInformationWithData2");if((o<0||o>16777215)&&(o=0),i.compositeID=o-Ve,t.captureZValues){const c=(s[1]*(t.area[2]-t.area[0]+1)+s[0])*4;i.zValue=(256*t.zBuffer[c]+t.zBuffer[c+1])/65535,i.displayPosition=e}return t.pixBuffer[J.ID_LOW24]&&Vs(s[0],s[1],t.pixBuffer[J.ID_LOW24],t.area)===0||(i.attributeID=ks(we(s[0],s[1],t.pixBuffer[J.ID_LOW24],t.area,"getPixelInformationWithData3"),we(s[0],s[1],t.pixBuffer[J.ID_HIGH24],t.area,"getPixelInformationWithData4"))),i}}function $s(t,e,n,r,s){const a=[];let i=0;return e.forEach((o,c)=>{const g=Fs.newInstance();switch(g.setContentType(N0.INDICES),t){case Et.FIELD_ASSOCIATION_CELLS:g.setFieldType(zr.CELL);break;case Et.FIELD_ASSOCIATION_POINTS:g.setFieldType(zr.POINT);break;default:Gs("Unknown field association")}g.getProperties().propID=o.info.propID,g.getProperties().prop=o.info.prop,g.getProperties().compositeID=o.info.compositeID,g.getProperties().attributeID=o.info.attributeID,g.getProperties().pixelCount=o.pixelCount,n&&(g.getProperties().displayPosition=[o.info.displayPosition[0],o.info.displayPosition[1],o.info.zValue],g.getProperties().worldPosition=s.displayToWorld(o.info.displayPosition[0],o.info.displayPosition[1],o.info.zValue,r)),g.setSelectionList(o.attributeIDs),a[i]=g,i++}),a}function U0(t,e,n,r,s){const a=Math.floor(e),i=Math.floor(n),o=Math.floor(r),c=Math.floor(s),g=new Map,T=[0,0];for(let f=i;f<=c;f++)for(let y=a;y<=o;y++){const w=G0(t,[y,f],0,T);if(w&&w.valid){const R=Us(w);if(!g.has(R))g.set(R,{info:w,pixelCount:1,attributeIDs:[w.attributeID]});else{const l=g.get(R);l.pixelCount++,t.captureZValues&&w.zValue<l.info.zValue&&(l.info=w),l.attributeIDs.indexOf(w.attributeID)===-1&&l.attributeIDs.push(w.attributeID)}}}return $s(t.fieldAssociation,g,t.captureZValues,t.renderer,t.openGLRenderWindow)}function V0(t,e){e.classHierarchy.push("vtkOpenGLHardwareSelector"),t.releasePixBuffers=()=>{e.rawPixBuffer=[],e.pixBuffer=[],e.zBuffer=null},t.beginSelection=()=>{e._openGLRenderer=e._openGLRenderWindow.getViewNodeFor(e._renderer,e._openGLRenderer),e.maxAttributeId=0;const r=e._openGLRenderWindow.getSize();if(!e.framebuffer)e.framebuffer=bn.newInstance(),e.framebuffer.setOpenGLRenderWindow(e._openGLRenderWindow),e.framebuffer.saveCurrentBindingsAndBuffers(),e.framebuffer.create(r[0],r[1]),e.framebuffer.populateFramebuffer();else{e.framebuffer.setOpenGLRenderWindow(e._openGLRenderWindow),e.framebuffer.saveCurrentBindingsAndBuffers();const s=e.framebuffer.getSize();!s||s[0]!==r[0]||s[1]!==r[1]?(e.framebuffer.create(r[0],r[1]),e.framebuffer.populateFramebuffer()):e.framebuffer.bind()}if(e._openGLRenderer.clear(),e._openGLRenderer.setSelector(t),e.hitProps={},e.propPixels={},e.props=[],t.releasePixBuffers(),e.fieldAssociation===Et.FIELD_ASSOCIATION_POINTS){const s=e._openGLRenderWindow.getContext(),a=s.isEnabled(s.BLEND);s.disable(s.BLEND),e._openGLRenderWindow.traverseAllPasses(),a&&s.enable(s.BLEND)}},t.endSelection=()=>{e.hitProps={},e._openGLRenderer.setSelector(null),e.framebuffer.restorePreviousBindingsAndBuffers()},t.preCapturePass=()=>{const r=e._openGLRenderWindow.getContext();e.originalBlending=r.isEnabled(r.BLEND),r.disable(r.BLEND)},t.postCapturePass=()=>{const r=e._openGLRenderWindow.getContext();e.originalBlending&&r.enable(r.BLEND)},t.select=()=>{let r=null;return t.captureBuffers()&&(r=t.generateSelection(e.area[0],e.area[1],e.area[2],e.area[3]),t.releasePixBuffers()),r},t.getSourceDataAsync=async(r,s,a,i,o)=>{if(e._renderer=r,s===void 0){const g=e._openGLRenderWindow.getSize();t.setArea(0,0,g[0]-1,g[1]-1)}else t.setArea(s,a,i,o);if(!t.captureBuffers())return!1;const c={area:[...e.area],pixBuffer:[...e.pixBuffer],captureZValues:e.captureZValues,zBuffer:e.zBuffer,props:[...e.props],fieldAssociation:e.fieldAssociation,renderer:r,openGLRenderWindow:e._openGLRenderWindow};return c.generateSelection=(...g)=>U0(c,...g),c},t.captureBuffers=()=>{if(!e._renderer||!e._openGLRenderWindow)return Gs("Renderer and view must be set before calling Select."),!1;e._openGLRenderer=e._openGLRenderWindow.getViewNodeFor(e._renderer,e._openGLRenderer),e._openGLRenderWindow.getRenderable().preRender(),t.invokeEvent({type:"StartEvent"}),e.originalBackground=e._renderer.getBackgroundByReference(),e._renderer.setBackground(0,0,0,0);const r=e._openGLRenderWindow.getRenderPasses();t.beginSelection();const s=[];for(e.currentPass=J.MIN_KNOWN_PASS;e.currentPass<=J.MAX_KNOWN_PASS;e.currentPass++)t.passRequired(e.currentPass)&&(t.preCapturePass(e.currentPass),e.captureZValues&&e.currentPass===J.ACTOR_PASS&&typeof r[0].requestDepth=="function"&&typeof r[0].getFramebuffer=="function"&&r[0].requestDepth(),e._openGLRenderWindow.traverseAllPasses(),t.postCapturePass(e.currentPass),t.savePixelBuffer(e.currentPass),s.push(e.currentPass));return s.forEach(a=>{e.currentPass=a,t.processPixelBuffers()}),e.currentPass=J.MAX_KNOWN_PASS,t.endSelection(),e._renderer.setBackground(e.originalBackground),t.invokeEvent({type:"EndEvent"}),!0},t.processPixelBuffers=()=>{e.props.forEach((r,s)=>{t.isPropHit(s)&&r.processSelectorPixelBuffers(t,e.propPixels[s])})},t.passRequired=r=>{if(r===J.ID_HIGH24){if(e.fieldAssociation===Et.FIELD_ASSOCIATION_POINTS)return e.maximumPointId>16777215;if(e.fieldAssociation===Et.FIELD_ASSOCIATION_CELLS)return e.maximumCellId>16777215}return!0},t.savePixelBuffer=r=>{if(e.pixBuffer[r]=e._openGLRenderWindow.getPixelData(e.area[0],e.area[1],e.area[2],e.area[3]),!e.rawPixBuffer[r]){const s=(e.area[2]-e.area[0]+1)*(e.area[3]-e.area[1]+1)*4;e.rawPixBuffer[r]=new Uint8Array(s),e.rawPixBuffer[r].set(e.pixBuffer[r])}if(r===J.ACTOR_PASS){if(e.captureZValues){const s=e._openGLRenderWindow.getRenderPasses();if(typeof s[0].requestDepth=="function"&&typeof s[0].getFramebuffer=="function"){const a=s[0].getFramebuffer();a.saveCurrentBindingsAndBuffers(),a.bind(),e.zBuffer=e._openGLRenderWindow.getPixelData(e.area[0],e.area[1],e.area[2],e.area[3]),a.restorePreviousBindingsAndBuffers()}}t.buildPropHitList(e.rawPixBuffer[r])}},t.buildPropHitList=r=>{let s=0;for(let a=0;a<=e.area[3]-e.area[1];a++)for(let i=0;i<=e.area[2]-e.area[0];i++){let o=we(i,a,r,e.area,"buildPropHitList");o>0&&(o--,o in e.hitProps||(e.hitProps[o]=!0,e.propPixels[o]=[]),e.propPixels[o].push(s*4)),++s}},t.renderProp=r=>{e.currentPass===J.ACTOR_PASS&&(t.setPropColorValueFromInt(e.props.length+Ve),e.props.push(r))},t.renderCompositeIndex=r=>{e.currentPass===J.COMPOSITE_INDEX_PASS&&t.setPropColorValueFromInt(r+Ve)},t.renderAttributeId=r=>{r<0||(e.maxAttributeId=r>e.maxAttributeId?r:e.maxAttributeId)},t.passTypeToString=r=>C.enumToString(J,r),t.isPropHit=r=>!!e.hitProps[r],t.setPropColorValueFromInt=r=>{e.propColorValue[0]=r%256/255,e.propColorValue[1]=Math.floor(r/256)%256/255,e.propColorValue[2]=Math.floor(r/65536)%256/255},t.getPixelInformation=(r,s,a)=>{const i=s<0?0:s;if(ct("getPixelInformation called",i),i===0){if(a[0]=r[0],a[1]=r[1],r[0]<e.area[0]||r[0]>e.area[2]||r[1]<e.area[1]||r[1]>e.area[3])return null;ct(r),ct(e.area);const T=[r[0]-e.area[0],r[1]-e.area[1]];ct("adjusted displayPosition",T);const f=we(T[0],T[1],e.pixBuffer[J.ACTOR_PASS],e.area,"getPixelInformation");if(ct("actorid",f),f<=0||f-Ve>=e.props.length)return null;const y={};y.valid=!0,y.propID=f-Ve,y.prop=e.props[y.propID];let w=we(T[0],T[1],e.pixBuffer[J.COMPOSITE_INDEX_PASS],e.area,"getPixelInformation2");if((w<0||w>16777215)&&(w=0),y.compositeID=w-Ve,e.captureZValues){const R=(T[1]*(e.area[2]-e.area[0]+1)+T[0])*4;y.zValue=(256*e.zBuffer[R]+e.zBuffer[R+1])/65535,y.displayPosition=r}return e.pixBuffer[J.ID_LOW24]&&Vs(T[0],T[1],e.pixBuffer[J.ID_LOW24],e.area)===0||(y.attributeID=ks(we(T[0],T[1],e.pixBuffer[J.ID_LOW24],e.area,"getPixelInformation3"),we(T[0],T[1],e.pixBuffer[J.ID_HIGH24],e.area,"getPixelInformation4"))),y}const o=[r[0],r[1]],c=[0,0];let g=t.getPixelInformation(r,0,a);if(g&&g.valid)return g;for(let T=1;T<i;++T){for(let f=o[1]>T?o[1]-T:0;f<=o[1]+T;++f)if(c[1]=f,o[0]>=T&&(c[0]=o[0]-T,g=t.getPixelInformation(c,0,a),g&&g.valid)||(c[0]=o[0]+T,g=t.getPixelInformation(c,0,a),g&&g.valid))return g;for(let f=o[0]>=T?o[0]-(T-1):0;f<=o[0]+(T-1);++f)if(c[0]=f,o[1]>=T&&(c[1]=o[1]-T,g=t.getPixelInformation(c,0,a),g&&g.valid)||(c[1]=o[1]+T,g=t.getPixelInformation(c,0,a),g&&g.valid))return g}return a[0]=r[0],a[1]=r[1],null},t.generateSelection=(r,s,a,i)=>{const o=Math.floor(r),c=Math.floor(s),g=Math.floor(a),T=Math.floor(i),f=new Map,y=[0,0];for(let w=c;w<=T;w++)for(let R=o;R<=g;R++){const l=[R,w],x=t.getPixelInformation(l,0,y);if(x&&x.valid){const u=Us(x);if(!f.has(u))f.set(u,{info:x,pixelCount:1,attributeIDs:[x.attributeID]});else{const p=f.get(u);p.pixelCount++,e.captureZValues&&x.zValue<p.info.zValue&&(p.info=x),p.attributeIDs.indexOf(x.attributeID)===-1&&p.attributeIDs.push(x.attributeID)}}}return $s(e.fieldAssociation,f,e.captureZValues,e._renderer,e._openGLRenderWindow)},t.getRawPixelBuffer=r=>e.rawPixBuffer[r],t.getPixelBuffer=r=>e.pixBuffer[r],t.attach=(r,s)=>{e._openGLRenderWindow=r,e._renderer=s};const n=t.setArea;t.setArea=(...r)=>n(...r)?(e.area[0]=Math.floor(e.area[0]),e.area[1]=Math.floor(e.area[1]),e.area[2]=Math.floor(e.area[2]),e.area[3]=Math.floor(e.area[3]),!0):!1}var k0={area:void 0,currentPass:-1,propColorValue:null,props:null,maximumPointId:0,maximumCellId:0,idOffset:1};function Ws(t,e,n={}){Object.assign(e,k0,n),B0.extend(t,e,n),e.propColorValue=[0,0,0],e.props=[],e.area||(e.area=[0,0,0,0]),C.setGetArray(t,e,["area"],4),C.setGet(t,e,["_renderer","currentPass","_openGLRenderWindow","maximumPointId","maximumCellId"]),C.setGetArray(t,e,["propColorValue"],3),C.moveToProtected(t,e,["renderer","openGLRenderWindow"]),C.event(t,e,"event"),V0(t,e)}var $0=C.newInstance(Ws,"vtkOpenGLHardwareSelector"),Hs={newInstance:$0,extend:Ws,...Bs},En={exports:{}},jr;function W0(){return jr||(jr=1,(function(t,e){(function(n){t.exports=n()})(function(n){var r=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function s(u,p){var h=u[0],v=u[1],E=u[2],S=u[3];h+=(v&E|~v&S)+p[0]-680876936|0,h=(h<<7|h>>>25)+v|0,S+=(h&v|~h&E)+p[1]-389564586|0,S=(S<<12|S>>>20)+h|0,E+=(S&h|~S&v)+p[2]+606105819|0,E=(E<<17|E>>>15)+S|0,v+=(E&S|~E&h)+p[3]-1044525330|0,v=(v<<22|v>>>10)+E|0,h+=(v&E|~v&S)+p[4]-176418897|0,h=(h<<7|h>>>25)+v|0,S+=(h&v|~h&E)+p[5]+1200080426|0,S=(S<<12|S>>>20)+h|0,E+=(S&h|~S&v)+p[6]-1473231341|0,E=(E<<17|E>>>15)+S|0,v+=(E&S|~E&h)+p[7]-45705983|0,v=(v<<22|v>>>10)+E|0,h+=(v&E|~v&S)+p[8]+1770035416|0,h=(h<<7|h>>>25)+v|0,S+=(h&v|~h&E)+p[9]-1958414417|0,S=(S<<12|S>>>20)+h|0,E+=(S&h|~S&v)+p[10]-42063|0,E=(E<<17|E>>>15)+S|0,v+=(E&S|~E&h)+p[11]-1990404162|0,v=(v<<22|v>>>10)+E|0,h+=(v&E|~v&S)+p[12]+1804603682|0,h=(h<<7|h>>>25)+v|0,S+=(h&v|~h&E)+p[13]-40341101|0,S=(S<<12|S>>>20)+h|0,E+=(S&h|~S&v)+p[14]-1502002290|0,E=(E<<17|E>>>15)+S|0,v+=(E&S|~E&h)+p[15]+1236535329|0,v=(v<<22|v>>>10)+E|0,h+=(v&S|E&~S)+p[1]-165796510|0,h=(h<<5|h>>>27)+v|0,S+=(h&E|v&~E)+p[6]-1069501632|0,S=(S<<9|S>>>23)+h|0,E+=(S&v|h&~v)+p[11]+643717713|0,E=(E<<14|E>>>18)+S|0,v+=(E&h|S&~h)+p[0]-373897302|0,v=(v<<20|v>>>12)+E|0,h+=(v&S|E&~S)+p[5]-701558691|0,h=(h<<5|h>>>27)+v|0,S+=(h&E|v&~E)+p[10]+38016083|0,S=(S<<9|S>>>23)+h|0,E+=(S&v|h&~v)+p[15]-660478335|0,E=(E<<14|E>>>18)+S|0,v+=(E&h|S&~h)+p[4]-405537848|0,v=(v<<20|v>>>12)+E|0,h+=(v&S|E&~S)+p[9]+568446438|0,h=(h<<5|h>>>27)+v|0,S+=(h&E|v&~E)+p[14]-1019803690|0,S=(S<<9|S>>>23)+h|0,E+=(S&v|h&~v)+p[3]-187363961|0,E=(E<<14|E>>>18)+S|0,v+=(E&h|S&~h)+p[8]+1163531501|0,v=(v<<20|v>>>12)+E|0,h+=(v&S|E&~S)+p[13]-1444681467|0,h=(h<<5|h>>>27)+v|0,S+=(h&E|v&~E)+p[2]-51403784|0,S=(S<<9|S>>>23)+h|0,E+=(S&v|h&~v)+p[7]+1735328473|0,E=(E<<14|E>>>18)+S|0,v+=(E&h|S&~h)+p[12]-1926607734|0,v=(v<<20|v>>>12)+E|0,h+=(v^E^S)+p[5]-378558|0,h=(h<<4|h>>>28)+v|0,S+=(h^v^E)+p[8]-2022574463|0,S=(S<<11|S>>>21)+h|0,E+=(S^h^v)+p[11]+1839030562|0,E=(E<<16|E>>>16)+S|0,v+=(E^S^h)+p[14]-35309556|0,v=(v<<23|v>>>9)+E|0,h+=(v^E^S)+p[1]-1530992060|0,h=(h<<4|h>>>28)+v|0,S+=(h^v^E)+p[4]+1272893353|0,S=(S<<11|S>>>21)+h|0,E+=(S^h^v)+p[7]-155497632|0,E=(E<<16|E>>>16)+S|0,v+=(E^S^h)+p[10]-1094730640|0,v=(v<<23|v>>>9)+E|0,h+=(v^E^S)+p[13]+681279174|0,h=(h<<4|h>>>28)+v|0,S+=(h^v^E)+p[0]-358537222|0,S=(S<<11|S>>>21)+h|0,E+=(S^h^v)+p[3]-722521979|0,E=(E<<16|E>>>16)+S|0,v+=(E^S^h)+p[6]+76029189|0,v=(v<<23|v>>>9)+E|0,h+=(v^E^S)+p[9]-640364487|0,h=(h<<4|h>>>28)+v|0,S+=(h^v^E)+p[12]-421815835|0,S=(S<<11|S>>>21)+h|0,E+=(S^h^v)+p[15]+530742520|0,E=(E<<16|E>>>16)+S|0,v+=(E^S^h)+p[2]-995338651|0,v=(v<<23|v>>>9)+E|0,h+=(E^(v|~S))+p[0]-198630844|0,h=(h<<6|h>>>26)+v|0,S+=(v^(h|~E))+p[7]+1126891415|0,S=(S<<10|S>>>22)+h|0,E+=(h^(S|~v))+p[14]-1416354905|0,E=(E<<15|E>>>17)+S|0,v+=(S^(E|~h))+p[5]-57434055|0,v=(v<<21|v>>>11)+E|0,h+=(E^(v|~S))+p[12]+1700485571|0,h=(h<<6|h>>>26)+v|0,S+=(v^(h|~E))+p[3]-1894986606|0,S=(S<<10|S>>>22)+h|0,E+=(h^(S|~v))+p[10]-1051523|0,E=(E<<15|E>>>17)+S|0,v+=(S^(E|~h))+p[1]-2054922799|0,v=(v<<21|v>>>11)+E|0,h+=(E^(v|~S))+p[8]+1873313359|0,h=(h<<6|h>>>26)+v|0,S+=(v^(h|~E))+p[15]-30611744|0,S=(S<<10|S>>>22)+h|0,E+=(h^(S|~v))+p[6]-1560198380|0,E=(E<<15|E>>>17)+S|0,v+=(S^(E|~h))+p[13]+1309151649|0,v=(v<<21|v>>>11)+E|0,h+=(E^(v|~S))+p[4]-145523070|0,h=(h<<6|h>>>26)+v|0,S+=(v^(h|~E))+p[11]-1120210379|0,S=(S<<10|S>>>22)+h|0,E+=(h^(S|~v))+p[2]+718787259|0,E=(E<<15|E>>>17)+S|0,v+=(S^(E|~h))+p[9]-343485551|0,v=(v<<21|v>>>11)+E|0,u[0]=h+u[0]|0,u[1]=v+u[1]|0,u[2]=E+u[2]|0,u[3]=S+u[3]|0}function a(u){var p=[],h;for(h=0;h<64;h+=4)p[h>>2]=u.charCodeAt(h)+(u.charCodeAt(h+1)<<8)+(u.charCodeAt(h+2)<<16)+(u.charCodeAt(h+3)<<24);return p}function i(u){var p=[],h;for(h=0;h<64;h+=4)p[h>>2]=u[h]+(u[h+1]<<8)+(u[h+2]<<16)+(u[h+3]<<24);return p}function o(u){var p=u.length,h=[1732584193,-271733879,-1732584194,271733878],v,E,S,_,d,L;for(v=64;v<=p;v+=64)s(h,a(u.substring(v-64,v)));for(u=u.substring(v-64),E=u.length,S=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],v=0;v<E;v+=1)S[v>>2]|=u.charCodeAt(v)<<(v%4<<3);if(S[v>>2]|=128<<(v%4<<3),v>55)for(s(h,S),v=0;v<16;v+=1)S[v]=0;return _=p*8,_=_.toString(16).match(/(.*?)(.{0,8})$/),d=parseInt(_[2],16),L=parseInt(_[1],16)||0,S[14]=d,S[15]=L,s(h,S),h}function c(u){var p=u.length,h=[1732584193,-271733879,-1732584194,271733878],v,E,S,_,d,L;for(v=64;v<=p;v+=64)s(h,i(u.subarray(v-64,v)));for(u=v-64<p?u.subarray(v-64):new Uint8Array(0),E=u.length,S=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],v=0;v<E;v+=1)S[v>>2]|=u[v]<<(v%4<<3);if(S[v>>2]|=128<<(v%4<<3),v>55)for(s(h,S),v=0;v<16;v+=1)S[v]=0;return _=p*8,_=_.toString(16).match(/(.*?)(.{0,8})$/),d=parseInt(_[2],16),L=parseInt(_[1],16)||0,S[14]=d,S[15]=L,s(h,S),h}function g(u){var p="",h;for(h=0;h<4;h+=1)p+=r[u>>h*8+4&15]+r[u>>h*8&15];return p}function T(u){var p;for(p=0;p<u.length;p+=1)u[p]=g(u[p]);return u.join("")}T(o("hello")),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&(function(){function u(p,h){return p=p|0||0,p<0?Math.max(p+h,0):Math.min(p,h)}ArrayBuffer.prototype.slice=function(p,h){var v=this.byteLength,E=u(p,v),S=v,_,d,L,M;return h!==n&&(S=u(h,v)),E>S?new ArrayBuffer(0):(_=S-E,d=new ArrayBuffer(_),L=new Uint8Array(d),M=new Uint8Array(this,E,_),L.set(M),d)}})();function f(u){return/[\u0080-\uFFFF]/.test(u)&&(u=unescape(encodeURIComponent(u))),u}function y(u,p){var h=u.length,v=new ArrayBuffer(h),E=new Uint8Array(v),S;for(S=0;S<h;S+=1)E[S]=u.charCodeAt(S);return p?E:v}function w(u){return String.fromCharCode.apply(null,new Uint8Array(u))}function R(u,p,h){var v=new Uint8Array(u.byteLength+p.byteLength);return v.set(new Uint8Array(u)),v.set(new Uint8Array(p),u.byteLength),v}function l(u){var p=[],h=u.length,v;for(v=0;v<h-1;v+=2)p.push(parseInt(u.substr(v,2),16));return String.fromCharCode.apply(String,p)}function x(){this.reset()}return x.prototype.append=function(u){return this.appendBinary(f(u)),this},x.prototype.appendBinary=function(u){this._buff+=u,this._length+=u.length;var p=this._buff.length,h;for(h=64;h<=p;h+=64)s(this._hash,a(this._buff.substring(h-64,h)));return this._buff=this._buff.substring(h-64),this},x.prototype.end=function(u){var p=this._buff,h=p.length,v,E=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],S;for(v=0;v<h;v+=1)E[v>>2]|=p.charCodeAt(v)<<(v%4<<3);return this._finish(E,h),S=T(this._hash),u&&(S=l(S)),this.reset(),S},x.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},x.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},x.prototype.setState=function(u){return this._buff=u.buff,this._length=u.length,this._hash=u.hash,this},x.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},x.prototype._finish=function(u,p){var h=p,v,E,S;if(u[h>>2]|=128<<(h%4<<3),h>55)for(s(this._hash,u),h=0;h<16;h+=1)u[h]=0;v=this._length*8,v=v.toString(16).match(/(.*?)(.{0,8})$/),E=parseInt(v[2],16),S=parseInt(v[1],16)||0,u[14]=E,u[15]=S,s(this._hash,u)},x.hash=function(u,p){return x.hashBinary(f(u),p)},x.hashBinary=function(u,p){var h=o(u),v=T(h);return p?l(v):v},x.ArrayBuffer=function(){this.reset()},x.ArrayBuffer.prototype.append=function(u){var p=R(this._buff.buffer,u),h=p.length,v;for(this._length+=u.byteLength,v=64;v<=h;v+=64)s(this._hash,i(p.subarray(v-64,v)));return this._buff=v-64<h?new Uint8Array(p.buffer.slice(v-64)):new Uint8Array(0),this},x.ArrayBuffer.prototype.end=function(u){var p=this._buff,h=p.length,v=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],E,S;for(E=0;E<h;E+=1)v[E>>2]|=p[E]<<(E%4<<3);return this._finish(v,h),S=T(this._hash),u&&(S=l(S)),this.reset(),S},x.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},x.ArrayBuffer.prototype.getState=function(){var u=x.prototype.getState.call(this);return u.buff=w(u.buff),u},x.ArrayBuffer.prototype.setState=function(u){return u.buff=y(u.buff,!0),x.prototype.setState.call(this,u)},x.ArrayBuffer.prototype.destroy=x.prototype.destroy,x.ArrayBuffer.prototype._finish=x.prototype._finish,x.ArrayBuffer.hash=function(u,p){var h=c(new Uint8Array(u)),v=T(h);return p?l(v):v},x})})(En)),En.exports}var H0=W0();const z0=Mi(H0);var j0=["lastShaderProgramBound","context","_openGLRenderWindow"];function X0(t,e){e.classHierarchy.push("vtkShaderCache"),t.replaceShaderValues=(n,r,s)=>{let a=r;s.length>0&&(a=ae.substitute(a,"VSOut","GSOut").result);const i=e._openGLRenderWindow.getWebgl2();let o=`
|
|
142
|
+
`,c=`#version 100
|
|
143
|
+
`;i?c=`#version 300 es
|
|
144
|
+
#define attribute in
|
|
145
|
+
#define textureCube texture
|
|
146
|
+
#define texture2D texture
|
|
147
|
+
#define textureCubeLod textureLod
|
|
148
|
+
#define texture2DLod textureLod
|
|
149
|
+
`:(e.context.getExtension("OES_standard_derivatives"),e.context.getExtension("EXT_frag_depth")&&(o=`#extension GL_EXT_frag_depth : enable
|
|
150
|
+
`),e.context.getExtension("EXT_shader_texture_lod")&&(o+=`#extension GL_EXT_shader_texture_lod : enable
|
|
151
|
+
#define textureCubeLod textureCubeLodEXT
|
|
152
|
+
#define texture2DLod texture2DLodEXT`)),a=ae.substitute(a,"//VTK::System::Dec",[`${c}
|
|
153
|
+
`,i?"":`#extension GL_OES_standard_derivatives : enable
|
|
154
|
+
`,o,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;let g=ae.substitute(n,"//VTK::System::Dec",[`${c}
|
|
155
|
+
`,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;if(i){g=ae.substitute(g,"varying","out").result,a=ae.substitute(a,"varying","in").result;let f="",y=0;for(;a.includes(`gl_FragData[${y}]`);)a=ae.substitute(a,`gl_FragData\\[${y}\\]`,`fragOutput${y}`).result,f+=`layout(location = ${y}) out vec4 fragOutput${y};
|
|
156
|
+
`,y++;a=ae.substitute(a,"//VTK::Output::Dec",f).result}const T=ae.substitute(s,"//VTK::System::Dec",c).result;return{VSSource:g,FSSource:a,GSSource:T}},t.readyShaderProgramArray=(n,r,s)=>{const a=t.replaceShaderValues(n,r,s),i=t.getShaderProgram(a.VSSource,a.FSSource,a.GSSource);return t.readyShaderProgram(i)},t.readyShaderProgram=n=>!n||!n.getCompiled()&&!n.compileShader()||!t.bindShaderProgram(n)?null:n,t.getShaderProgram=(n,r,s)=>{const a=`${n}${r}${s}`,i=z0.hash(a);if(!(i in e.shaderPrograms)){const o=ae.newInstance();return o.setContext(e.context),o.getVertexShader().setSource(n),o.getFragmentShader().setSource(r),s&&o.getGeometryShader().setSource(s),o.setMd5Hash(i),e.shaderPrograms[i]=o,o}return e.shaderPrograms[i]},t.releaseGraphicsResources=n=>{t.releaseCurrentShaderProgram(),Object.keys(e.shaderPrograms).map(r=>e.shaderPrograms[r]).forEach(r=>r.cleanup()),e.shaderPrograms={}},t.releaseCurrentShaderProgram=()=>{e.lastShaderProgramBound&&(e.lastShaderProgramBound.cleanup(),e.lastShaderProgramBound=null)},t.bindShaderProgram=n=>(e.lastShaderProgramBound===n||(e.lastShaderProgramBound&&e.lastShaderProgramBound.release(),n.bind(),e.lastShaderProgramBound=n),1)}var K0={lastShaderProgramBound:null,shaderPrograms:null,context:null};function zs(t,e,n={}){Object.assign(e,K0,n),e.shaderPrograms={},C.obj(t,e),C.setGet(t,e,j0),C.moveToProtected(t,e,["openGLRenderWindow"]),X0(t,e)}var Y0=C.newInstance(zs,"vtkShaderCache"),Z0={newInstance:Y0,extend:zs},{vtkErrorMacro:Q0}=C;function J0(t,e){e.classHierarchy.push("vtkOpenGLTextureUnitManager"),t.deleteTable=()=>{for(let n=0;n<e.numberOfTextureUnits;++n)e.textureUnits[n]===!0&&Q0("some texture units were not properly released");e.textureUnits=[],e.numberOfTextureUnits=0},t.setContext=n=>{if(e.context!==n){if(e.context!==0&&t.deleteTable(),e.context=n,e.context){e.numberOfTextureUnits=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS);for(let r=0;r<e.numberOfTextureUnits;++r)e.textureUnits[r]=!1}t.modified()}},t.allocate=()=>{for(let n=0;n<e.numberOfTextureUnits;n++)if(!t.isAllocated(n))return e.textureUnits[n]=!0,n;return-1},t.allocateUnit=n=>t.isAllocated(n)?-1:(e.textureUnits[n]=!0,n),t.isAllocated=n=>e.textureUnits[n],t.free=n=>{e.textureUnits[n]=!1},t.freeAll=()=>{for(let n=0;n<e.numberOfTextureUnits;++n)e.textureUnits[n]=!1}}var q0={context:null,numberOfTextureUnits:0,textureUnits:0};function js(t,e,n={}){Object.assign(e,q0,n),C.obj(t,e),e.textureUnits=[],C.get(t,e,["numberOfTextureUnits"]),C.setGet(t,e,["context"]),J0(t,e)}var A0=C.newInstance(js,"vtkOpenGLTextureUnitManager"),b0={newInstance:A0,extend:js};function I0(t,e){e.classHierarchy.push("vtkRenderWindowViewNode"),t.getViewNodeFactory=()=>null,t.getAspectRatio=()=>e.size[0]/e.size[1],t.getAspectRatioForRenderer=n=>{const r=n.getViewportByReference();return e.size[0]*(r[2]-r[0])/((r[3]-r[1])*e.size[1])},t.isInViewport=(n,r,s)=>{const a=s.getViewportByReference(),i=t.getFramebufferSize();return a[0]*i[0]<=n&&a[2]*i[0]>=n&&a[1]*i[1]<=r&&a[3]*i[1]>=r},t.getViewportSize=n=>{const r=n.getViewportByReference(),s=t.getFramebufferSize();return[(r[2]-r[0])*s[0],(r[3]-r[1])*s[1]]},t.getViewportCenter=n=>{const r=t.getViewportSize(n);return[r[0]*.5,r[1]*.5]},t.displayToNormalizedDisplay=(n,r,s)=>{const a=t.getFramebufferSize();return[n/a[0],r/a[1],s]},t.normalizedDisplayToDisplay=(n,r,s)=>{const a=t.getFramebufferSize();return[n*a[0],r*a[1],s]},t.worldToView=(n,r,s,a)=>a.worldToView(n,r,s),t.viewToWorld=(n,r,s,a)=>a.viewToWorld(n,r,s),t.worldToDisplay=(n,r,s,a)=>{const i=a.worldToView(n,r,s),o=t.getViewportSize(a),c=a.viewToProjection(i[0],i[1],i[2],o[0]/o[1]),g=a.projectionToNormalizedDisplay(c[0],c[1],c[2]);return t.normalizedDisplayToDisplay(g[0],g[1],g[2])},t.displayToWorld=(n,r,s,a)=>{const i=t.displayToNormalizedDisplay(n,r,s),o=a.normalizedDisplayToProjection(i[0],i[1],i[2]),c=t.getViewportSize(a),g=a.projectionToView(o[0],o[1],o[2],c[0]/c[1]);return a.viewToWorld(g[0],g[1],g[2])},t.normalizedDisplayToViewport=(n,r,s,a)=>{let i=a.getViewportByReference();i=t.normalizedDisplayToDisplay(i[0],i[1],0);const o=t.normalizedDisplayToDisplay(n,r,s);return[o[0]-i[0]-.5,o[1]-i[1]-.5,s]},t.viewportToNormalizedViewport=(n,r,s,a)=>{const i=t.getViewportSize(a);return i&&i[0]!==0&&i[1]!==0?[n/(i[0]-1),r/(i[1]-1),s]:[n,r,s]},t.normalizedViewportToViewport=(n,r,s,a)=>{const i=t.getViewportSize(a);return[n*(i[0]-1),r*(i[1]-1),s]},t.displayToLocalDisplay=(n,r,s)=>[n,t.getFramebufferSize()[1]-r-1,s],t.viewportToNormalizedDisplay=(n,r,s,a)=>{let i=a.getViewportByReference();i=t.normalizedDisplayToDisplay(i[0],i[1],0);const o=n+i[0]+.5,c=r+i[1]+.5;return t.displayToNormalizedDisplay(o,c,s)},t.getComputedDevicePixelRatio=()=>e.size[0]/t.getContainerSize()[0],t.getContainerSize=()=>{C.vtkErrorMacro("not implemented")},t.getPixelData=(n,r,s,a)=>{C.vtkErrorMacro("not implemented")},t.createSelector=()=>{C.vtkErrorMacro("not implemented")}}var m0={size:void 0,selector:void 0};function Xs(t,e,n={}){Object.assign(e,m0,n),e.size||(e.size=[300,300]),C.getArray(t,e,["size"],2),C.get(t,e,["selector"]),An.extend(t,e,n),I0(t,e)}var P0=C.newInstance(Xs,"vtkRenderWindowViewNode"),eh={newInstance:P0,extend:Xs};function th(){const t=new Map,e={apply(s,a,i){return t.has(i[0])?t.get(i[0]):s.apply(a,i)}};function n(s){return{apply(a,i,o){return t.set(s,o[0]),a.apply(i,o)}}}const r=Object.create(null);return r.getParameter=(s,a,i,o)=>new Proxy(o.bind(s),e),r.depthMask=(s,a,i,o)=>new Proxy(o.bind(s),n(s.DEPTH_WRITEMASK)),{get(s,a,i){if(a==="__getUnderlyingContext")return()=>s;let o=Reflect.get(s,a,s);o instanceof Function&&(o=o.bind(s));const c=r[a];return c?c(s,a,i,o):o}}}var{vtkDebugMacro:Xr,vtkErrorMacro:Sn}=C,nh={position:"absolute",top:0,left:0,width:"100%",height:"100%"},rh=["activateTexture","deactivateTexture","disableCullFace","enableCullFace","setCullFaceMode","get3DContext","getActiveFramebuffer","getContext","getDefaultTextureByteSize","getDefaultTextureInternalFormat","getDefaultToWebgl2","getGLInformations","getGraphicsMemoryInfo","getGraphicsResourceForObject","getHardwareMaximumLineWidth","getPixelData","getShaderCache","getTextureUnitForTexture","getTextureUnitManager","getWebgl2","makeCurrent","releaseGraphicsResources","registerGraphicsResourceUser","unregisterGraphicsResourceUser","restoreContext","setActiveFramebuffer","setContext","setDefaultToWebgl2","setGraphicsResourceForObject"];function re(t,e,n){const r=t.createFramebuffer(),s=t.createTexture();t.bindTexture(t.TEXTURE_2D,s),t.texImage2D(t.TEXTURE_2D,0,e,2,2,0,e,n,null),t.bindFramebuffer(t.FRAMEBUFFER,r),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,s,0);const a=t.checkFramebufferStatus(t.FRAMEBUFFER);return t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindTexture(t.TEXTURE_2D,null),a===t.FRAMEBUFFER_COMPLETE}var nn=0,on=[];function ah(){nn++,on.forEach(t=>t(nn))}function sh(){nn--,on.forEach(t=>t(nn))}function ih(t){on.push(t)}function oh(t){return on.pop()}function Kr(t){t.preventDefault()}function fh(t,e){e.classHierarchy.push("vtkOpenGLRenderWindow");let n;function r(){return n||(n=th()),n}t.getViewNodeFactory=()=>e.myFactory,e.canvas.addEventListener("webglcontextlost",Kr,!1),e.canvas.addEventListener("webglcontextrestored",t.restoreContext,!1);const s=[0,0];function a(){e.renderable&&(e.size[0]!==s[0]||e.size[1]!==s[1])&&(s[0]=e.size[0],s[1]=e.size[1],e.canvas.setAttribute("width",e.size[0]),e.canvas.setAttribute("height",e.size[1])),e.viewStream&&e.viewStream.setSize(e.size[0],e.size[1]),e.canvas.style.display=e.useOffScreen?"none":"block",e.el&&(e.el.style.cursor=e.cursorVisibility?e.cursor:"none"),e.containerSize=null}t.onModified(a),t.buildPass=f=>{if(f){if(!e.renderable)return;t.prepareNodes(),t.addMissingNodes(e.renderable.getRenderersByReference()),t.addMissingNodes(e.renderable.getChildRenderWindowsByReference()),t.removeUnusedNodes(),t.initialize(),e.children.forEach(y=>{y.setOpenGLRenderWindow?.(t)})}},t.initialize=()=>{if(!e.initialized){if(e.rootOpenGLRenderWindow=t.getLastAncestorOfType("vtkOpenGLRenderWindow"),e.rootOpenGLRenderWindow)e.context2D=t.get2DContext();else{e.context=t.get3DContext(),t.resizeFromChildRenderWindows(),e.context&&ah(),e.textureUnitManager=b0.newInstance(),e.textureUnitManager.setContext(e.context),e.shaderCache.setContext(e.context);const f=e.context;f.blendFuncSeparate(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA,f.ONE,f.ONE_MINUS_SRC_ALPHA),f.depthFunc(f.LEQUAL),f.enable(f.BLEND)}e.initialized=!0}},t.makeCurrent=()=>{e.context.makeCurrent()},t.setContainer=f=>{e.el&&e.el!==f&&(e.canvas.parentNode!==e.el&&Sn("Error: canvas parent node does not match container"),e.el.removeChild(e.canvas),e.el.contains(e.bgImage)&&e.el.removeChild(e.bgImage)),e.el!==f&&(e.el=f,e.el&&(e.el.appendChild(e.canvas),e.useBackgroundImage&&e.el.appendChild(e.bgImage)),t.modified())},t.getContainer=()=>e.el,t.getContainerSize=()=>{if(!e.containerSize&&e.el){const{width:f,height:y}=e.el.getBoundingClientRect();e.containerSize=[f,y]}return e.containerSize||e.size},t.getFramebufferSize=()=>e.activeFramebuffer?.getSize()||e.size,t.getPixelData=(f,y,w,R)=>{const l=new Uint8Array((w-f+1)*(R-y+1)*4);return e.context.readPixels(f,y,w-f+1,R-y+1,e.context.RGBA,e.context.UNSIGNED_BYTE,l),l},t.get3DContext=(f={preserveDrawingBuffer:!1,depth:!0,alpha:!0,powerPreference:"high-performance"})=>{let y=null;const w=typeof WebGL2RenderingContext<"u";return e.webgl2=!1,e.defaultToWebgl2&&w&&(y=e.canvas.getContext("webgl2",f),y&&(e.webgl2=!0,Xr("using webgl2"))),y||(Xr("using webgl1"),y=e.canvas.getContext("webgl",f)||e.canvas.getContext("experimental-webgl",f)),y||Sn("no webgl context"),new Proxy(y,r())},t.get2DContext=(f={})=>e.canvas.getContext("2d",f),t.restoreContext=()=>{const f=In.newInstance();f.setCurrentOperation("Release"),f.traverse(t,null)},t.activateTexture=f=>{const y=e._textureResourceIds.get(f);if(y!==void 0){e.context.activeTexture(e.context.TEXTURE0+y);return}const w=t.getTextureUnitManager().allocate();if(w<0){Sn("Hardware does not support the number of textures defined.");return}e._textureResourceIds.set(f,w),e.context.activeTexture(e.context.TEXTURE0+w)},t.deactivateTexture=f=>{const y=e._textureResourceIds.get(f);y!==void 0&&(t.getTextureUnitManager().free(y),e._textureResourceIds.delete(f))},t.getTextureUnitForTexture=f=>{const y=e._textureResourceIds.get(f);return y!==void 0?y:-1},t.getDefaultTextureByteSize=(f,y=null,w=!1)=>{if(e.webgl2)switch(f){case ee.CHAR:case ee.SIGNED_CHAR:case ee.UNSIGNED_CHAR:return 1;case y:case w:case ee.UNSIGNED_SHORT:case ee.SHORT:case ee.VOID:return 2;default:return 4}return 1},t.getDefaultTextureInternalFormat=(f,y,w=null,R=!1)=>{if(e.webgl2)switch(f){case ee.UNSIGNED_CHAR:switch(y){case 1:return e.context.R8;case 2:return e.context.RG8;case 3:return e.context.RGB8;default:return e.context.RGBA8}case(w&&!R&&ee.UNSIGNED_SHORT):switch(y){case 1:return w.R16_EXT;case 2:return w.RG16_EXT;case 3:return w.RGB16_EXT;default:return w.RGBA16_EXT}case(w&&!R&&ee.SHORT):switch(y){case 1:return w.R16_SNORM_EXT;case 2:return w.RG16_SNORM_EXT;case 3:return w.RGB16_SNORM_EXT;default:return w.RGBA16_SNORM_EXT}case ee.UNSIGNED_SHORT:case ee.SHORT:case ee.FLOAT:default:switch(y){case 1:return R?e.context.R16F:e.context.R32F;case 2:return R?e.context.RG16F:e.context.RG32F;case 3:return R?e.context.RGB16F:e.context.RGB32F;default:return R?e.context.RGBA16F:e.context.RGBA32F}}switch(y){case 1:return e.context.LUMINANCE;case 2:return e.context.LUMINANCE_ALPHA;case 3:return e.context.RGB;default:return e.context.RGBA}},t.setBackgroundImage=f=>{e.bgImage.src=f.src},t.setUseBackgroundImage=f=>{e.useBackgroundImage=f,e.useBackgroundImage&&!e.el.contains(e.bgImage)?e.el.appendChild(e.bgImage):!e.useBackgroundImage&&e.el.contains(e.bgImage)&&e.el.removeChild(e.bgImage)};function i(f=e.imageFormat){const y=document.createElement("canvas"),w=y.getContext("2d");y.width=e.canvas.width,y.height=e.canvas.height,w.drawImage(e.canvas,0,0);const R=e.canvas.getBoundingClientRect();e.renderable.getRenderers().forEach(x=>{x.getViewProps().forEach(u=>{if(u.getContainer){const p=u.getContainer().getElementsByTagName("canvas");for(let h=0;h<p.length;h++){const v=p[h],E=v.getBoundingClientRect(),S=E.x-R.x,_=E.y-R.y;w.drawImage(v,S,_)}}})});const l=y.toDataURL(f);y.remove(),t.invokeImageReady(l)}t.captureNextImage=(f="image/png",{resetCamera:y=!1,size:w=null,scale:R=1}={})=>{if(e.deleted)return null;e.imageFormat=f;const l=e.notifyStartCaptureImage;return e.notifyStartCaptureImage=!0,e._screenshot={size:w||R!==1?w||e.size.map(x=>x*R):null},new Promise((x,u)=>{const p=t.onImageReady(h=>{if(e._screenshot.size===null)e.notifyStartCaptureImage=l,p.unsubscribe(),e._screenshot.placeHolder&&(e.size=e._screenshot.originalSize,t.modified(),e._screenshot.cameras&&e._screenshot.cameras.forEach(({restoreParamsFn:v,arg:E})=>v(E)),t.traverseAllPasses(),e.el.removeChild(e._screenshot.placeHolder),e._screenshot.placeHolder.remove(),e._screenshot=null),x(h);else{const v=document.createElement("img");if(v.style=nh,v.src=h,e._screenshot.placeHolder=e.el.appendChild(v),e.canvas.style.display="none",e._screenshot.originalSize=e.size,e.size=e._screenshot.size,e.rootOpenGLRenderWindow?.resizeFromChildRenderWindows(),e._screenshot.size=null,t.modified(),y){const E=y!==!0;e._screenshot.cameras=e.renderable.getRenderers().map(S=>{const _=S.getActiveCamera(),d=_.get("focalPoint","position","parallelScale");return{resetCameraArgs:E?{renderer:S}:void 0,resetCameraFn:E?y:S.resetCamera,restoreParamsFn:_.set,arg:JSON.parse(JSON.stringify(d))}}),e._screenshot.cameras.forEach(({resetCameraFn:S,resetCameraArgs:_})=>S(_))}t.traverseAllPasses()}})})};let o;t.getHardwareMaximumLineWidth=()=>{if(o!=null)return o;const f=t.get3DContext(),y=f.getParameter(f.ALIASED_LINE_WIDTH_RANGE);return o=y[1],y[1]},t.getGLInformations=()=>{if(e._glInformation)return e._glInformation;const f=t.get3DContext(),y=f.getExtension("OES_texture_float"),w=f.getExtension("OES_texture_half_float"),R=f.getExtension("WEBGL_debug_renderer_info"),l=f.getExtension("WEBGL_draw_buffers"),x=f.getExtension("EXT_texture_filter_anisotropic")||f.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),u=[["Max Vertex Attributes","MAX_VERTEX_ATTRIBS",f.getParameter(f.MAX_VERTEX_ATTRIBS)],["Max Varying Vectors","MAX_VARYING_VECTORS",f.getParameter(f.MAX_VARYING_VECTORS)],["Max Vertex Uniform Vectors","MAX_VERTEX_UNIFORM_VECTORS",f.getParameter(f.MAX_VERTEX_UNIFORM_VECTORS)],["Max Fragment Uniform Vectors","MAX_FRAGMENT_UNIFORM_VECTORS",f.getParameter(f.MAX_FRAGMENT_UNIFORM_VECTORS)],["Max Fragment Texture Image Units","MAX_TEXTURE_IMAGE_UNITS",f.getParameter(f.MAX_TEXTURE_IMAGE_UNITS)],["Max Vertex Texture Image Units","MAX_VERTEX_TEXTURE_IMAGE_UNITS",f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)],["Max Combined Texture Image Units","MAX_COMBINED_TEXTURE_IMAGE_UNITS",f.getParameter(f.MAX_COMBINED_TEXTURE_IMAGE_UNITS)],["Max 2D Texture Size","MAX_TEXTURE_SIZE",f.getParameter(f.MAX_TEXTURE_SIZE)],["Max Cube Texture Size","MAX_CUBE_MAP_TEXTURE_SIZE",f.getParameter(f.MAX_CUBE_MAP_TEXTURE_SIZE)],["Max Texture Anisotropy","MAX_TEXTURE_MAX_ANISOTROPY_EXT",x&&f.getParameter(x.MAX_TEXTURE_MAX_ANISOTROPY_EXT)],["Point Size Range","ALIASED_POINT_SIZE_RANGE",f.getParameter(f.ALIASED_POINT_SIZE_RANGE).join(" - ")],["Line Width Range","ALIASED_LINE_WIDTH_RANGE",f.getParameter(f.ALIASED_LINE_WIDTH_RANGE).join(" - ")],["Max Viewport Dimensions","MAX_VIEWPORT_DIMS",f.getParameter(f.MAX_VIEWPORT_DIMS).join(" - ")],["Max Renderbuffer Size","MAX_RENDERBUFFER_SIZE",f.getParameter(f.MAX_RENDERBUFFER_SIZE)],["Framebuffer Red Bits","RED_BITS",f.getParameter(f.RED_BITS)],["Framebuffer Green Bits","GREEN_BITS",f.getParameter(f.GREEN_BITS)],["Framebuffer Blue Bits","BLUE_BITS",f.getParameter(f.BLUE_BITS)],["Framebuffer Alpha Bits","ALPHA_BITS",f.getParameter(f.ALPHA_BITS)],["Framebuffer Depth Bits","DEPTH_BITS",f.getParameter(f.DEPTH_BITS)],["Framebuffer Stencil Bits","STENCIL_BITS",f.getParameter(f.STENCIL_BITS)],["Framebuffer Subpixel Bits","SUBPIXEL_BITS",f.getParameter(f.SUBPIXEL_BITS)],["MSAA Samples","SAMPLES",f.getParameter(f.SAMPLES)],["MSAA Sample Buffers","SAMPLE_BUFFERS",f.getParameter(f.SAMPLE_BUFFERS)],["Supported Formats for UByte Render Targets ","UNSIGNED_BYTE RENDER TARGET FORMATS",[y&&re(f,f.RGBA,f.UNSIGNED_BYTE)?"RGBA":"",y&&re(f,f.RGB,f.UNSIGNED_BYTE)?"RGB":"",y&&re(f,f.LUMINANCE,f.UNSIGNED_BYTE)?"LUMINANCE":"",y&&re(f,f.ALPHA,f.UNSIGNED_BYTE)?"ALPHA":"",y&&re(f,f.LUMINANCE_ALPHA,f.UNSIGNED_BYTE)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Half Float Render Targets","HALF FLOAT RENDER TARGET FORMATS",[w&&re(f,f.RGBA,w.HALF_FLOAT_OES)?"RGBA":"",w&&re(f,f.RGB,w.HALF_FLOAT_OES)?"RGB":"",w&&re(f,f.LUMINANCE,w.HALF_FLOAT_OES)?"LUMINANCE":"",w&&re(f,f.ALPHA,w.HALF_FLOAT_OES)?"ALPHA":"",w&&re(f,f.LUMINANCE_ALPHA,w.HALF_FLOAT_OES)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Full Float Render Targets","FLOAT RENDER TARGET FORMATS",[y&&re(f,f.RGBA,f.FLOAT)?"RGBA":"",y&&re(f,f.RGB,f.FLOAT)?"RGB":"",y&&re(f,f.LUMINANCE,f.FLOAT)?"LUMINANCE":"",y&&re(f,f.ALPHA,f.FLOAT)?"ALPHA":"",y&&re(f,f.LUMINANCE_ALPHA,f.FLOAT)?"LUMINANCE_ALPHA":""].join(" ")],["Max Multiple Render Targets Buffers","MAX_DRAW_BUFFERS_WEBGL",l?f.getParameter(l.MAX_DRAW_BUFFERS_WEBGL):0],["High Float Precision in Vertex Shader","HIGH_FLOAT VERTEX_SHADER",[f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.HIGH_FLOAT).precision," (-2<sup>",f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.HIGH_FLOAT).rangeMin,"</sup> - 2<sup>",f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.HIGH_FLOAT).rangeMax,"</sup>)"].join("")],["Medium Float Precision in Vertex Shader","MEDIUM_FLOAT VERTEX_SHADER",[f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.MEDIUM_FLOAT).precision," (-2<sup>",f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.MEDIUM_FLOAT).rangeMin,"</sup> - 2<sup>",f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.MEDIUM_FLOAT).rangeMax,"</sup>)"].join("")],["Low Float Precision in Vertex Shader","LOW_FLOAT VERTEX_SHADER",[f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.LOW_FLOAT).precision," (-2<sup>",f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.LOW_FLOAT).rangeMin,"</sup> - 2<sup>",f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.LOW_FLOAT).rangeMax,"</sup>)"].join("")],["High Float Precision in Fragment Shader","HIGH_FLOAT FRAGMENT_SHADER",[f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.HIGH_FLOAT).precision," (-2<sup>",f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.HIGH_FLOAT).rangeMin,"</sup> - 2<sup>",f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.HIGH_FLOAT).rangeMax,"</sup>)"].join("")],["Medium Float Precision in Fragment Shader","MEDIUM_FLOAT FRAGMENT_SHADER",[f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.MEDIUM_FLOAT).precision," (-2<sup>",f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.MEDIUM_FLOAT).rangeMin,"</sup> - 2<sup>",f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.MEDIUM_FLOAT).rangeMax,"</sup>)"].join("")],["Low Float Precision in Fragment Shader","LOW_FLOAT FRAGMENT_SHADER",[f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.LOW_FLOAT).precision," (-2<sup>",f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.LOW_FLOAT).rangeMin,"</sup> - 2<sup>",f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.LOW_FLOAT).rangeMax,"</sup>)"].join("")],["High Int Precision in Vertex Shader","HIGH_INT VERTEX_SHADER",[f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.HIGH_INT).precision," (-2<sup>",f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.HIGH_INT).rangeMin,"</sup> - 2<sup>",f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.HIGH_INT).rangeMax,"</sup>)"].join("")],["Medium Int Precision in Vertex Shader","MEDIUM_INT VERTEX_SHADER",[f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.MEDIUM_INT).precision," (-2<sup>",f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.MEDIUM_INT).rangeMin,"</sup> - 2<sup>",f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.MEDIUM_INT).rangeMax,"</sup>)"].join("")],["Low Int Precision in Vertex Shader","LOW_INT VERTEX_SHADER",[f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.LOW_INT).precision," (-2<sup>",f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.LOW_INT).rangeMin,"</sup> - 2<sup>",f.getShaderPrecisionFormat(f.VERTEX_SHADER,f.LOW_INT).rangeMax,"</sup>)"].join("")],["High Int Precision in Fragment Shader","HIGH_INT FRAGMENT_SHADER",[f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.HIGH_INT).precision," (-2<sup>",f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.HIGH_INT).rangeMin,"</sup> - 2<sup>",f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.HIGH_INT).rangeMax,"</sup>)"].join("")],["Medium Int Precision in Fragment Shader","MEDIUM_INT FRAGMENT_SHADER",[f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.MEDIUM_INT).precision," (-2<sup>",f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.MEDIUM_INT).rangeMin,"</sup> - 2<sup>",f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.MEDIUM_INT).rangeMax,"</sup>)"].join("")],["Low Int Precision in Fragment Shader","LOW_INT FRAGMENT_SHADER",[f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.LOW_INT).precision," (-2<sup>",f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.LOW_INT).rangeMin,"</sup> - 2<sup>",f.getShaderPrecisionFormat(f.FRAGMENT_SHADER,f.LOW_INT).rangeMax,"</sup>)"].join("")],["Supported Extensions","EXTENSIONS",f.getSupportedExtensions().join("<br/> ")],["WebGL Renderer","RENDERER",f.getParameter(f.RENDERER)],["WebGL Vendor","VENDOR",f.getParameter(f.VENDOR)],["WebGL Version","VERSION",f.getParameter(f.VERSION)],["Shading Language Version","SHADING_LANGUAGE_VERSION",f.getParameter(f.SHADING_LANGUAGE_VERSION)],["Unmasked Renderer","UNMASKED_RENDERER",R&&f.getParameter(R.UNMASKED_RENDERER_WEBGL)],["Unmasked Vendor","UNMASKED_VENDOR",R&&f.getParameter(R.UNMASKED_VENDOR_WEBGL)],["WebGL Version","WEBGL_VERSION",e.webgl2?2:1]],p={};for(;u.length;){const[h,v,E]=u.pop();v&&(p[v]={label:h,value:E})}return e._glInformation=p,p},t.traverseAllPasses=()=>{if(e.renderPasses)for(let y=0;y<e.renderPasses.length;++y)e.renderPasses[y].traverse(t,null);t.copyParentContent(),e.notifyStartCaptureImage&&i();const f=e.renderable.getChildRenderWindowsByReference();for(let y=0;y<f.length;++y)t.getViewNodeFor(f[y])?.traverseAllPasses()},t.copyParentContent=()=>{const f=e.rootOpenGLRenderWindow;if(!f||!e.context2D||e.children.some(R=>!!R.getSelector?.()))return;const y=f.getCanvas(),w=e.canvas;e.context2D.drawImage(y,0,y.height-w.height,w.width,w.height,0,0,w.width,w.height)},t.resizeFromChildRenderWindows=()=>{const f=e.renderable.getChildRenderWindowsByReference();if(f.length>0){const y=[0,0];for(let w=0;w<f.length;++w){const R=t.getViewNodeFor(f[w])?.getSize();R&&(y[0]=R[0]>y[0]?R[0]:y[0],y[1]=R[1]>y[1]?R[1]:y[1])}t.setSize(...y)}},t.disableCullFace=()=>{e.cullFaceEnabled&&(e.context.disable(e.context.CULL_FACE),e.cullFaceEnabled=!1)},t.enableCullFace=()=>{e.cullFaceEnabled||(e.context.enable(e.context.CULL_FACE),e.cullFaceEnabled=!0)},t.setCullFaceMode=f=>{e.cullFaceMode!==f&&(e.context.cullFace(f),e.cullFaceMode=f)},t.setViewStream=f=>{if(e.viewStream===f)return!1;if(e.subscription&&(e.subscription.unsubscribe(),e.subscription=null),e.viewStream=f,e.viewStream){const y=e.renderable.getRenderers()[0];y.getBackgroundByReference()[3]=0,t.setUseBackgroundImage(!0),e.subscription=e.viewStream.onImageReady(w=>t.setBackgroundImage(w.image)),e.viewStream.setSize(e.size[0],e.size[1]),e.viewStream.invalidateCache(),e.viewStream.render(),t.modified()}return!0},t.createSelector=()=>{const f=Hs.newInstance();return f.setOpenGLRenderWindow(t),f};function c(){e.canvas.removeEventListener("webglcontextlost",Kr),e.canvas.removeEventListener("webglcontextrestored",t.restoreContext)}t.delete=C.chain(()=>{e.context&&sh(),t.setContainer(),t.setViewStream()},c,t.delete),t.setActiveFramebuffer=f=>{e.activeFramebuffer=f};const g=t.setSize;t.setSize=(f,y)=>{const w=g(f,y);return w&&t.invokeWindowResizeEvent({width:f,height:y}),w},t.registerGraphicsResourceUser=(f,y)=>{e._graphicsResources.has(f)||t.setGraphicsResourceForObject(f,null,null),e._graphicsResources.get(f)?.users.add(y)},t.unregisterGraphicsResourceUser=(f,y)=>{const w=e._graphicsResources.get(f);w&&(w.users.delete(y),w.users.size||(w.oglObject?.releaseGraphicsResources(t),e._graphicsResources.delete(f)))},t.getGraphicsResourceForObject=f=>e._graphicsResources.get(f),t.setGraphicsResourceForObject=(f,y,w)=>{if(!f)return;const R=e._graphicsResources.get(f);R?.oglObject?.releaseGraphicsResources(t),e._graphicsResources.set(f,{coreObject:f,oglObject:y,hash:w,users:R?.users??new Set})},t.getGraphicsMemoryInfo=()=>{let f=0;return e._graphicsResources.forEach(({oglObject:y})=>{f+=y.getAllocatedGPUMemoryInBytes()}),f},t.releaseGraphicsResources=()=>{e.shaderCache!==null&&e.shaderCache.releaseGraphicsResources(t),e._graphicsResources.forEach(({oglObject:f})=>{f.releaseGraphicsResources(t)}),e._graphicsResources.clear(),e.textureUnitManager!==null&&e.textureUnitManager.freeAll(),e.renderable.getRenderersByReference().forEach(f=>{t.getViewNodeFor(f)?.releaseGraphicsResources()})};const T={...t};rh.forEach(f=>{t[f]=(...y)=>e.rootOpenGLRenderWindow?e.rootOpenGLRenderWindow[f](...y):T[f](...y)})}var ch={cullFaceEnabled:!1,cullFaceMode:null,shaderCache:null,initialized:!1,context:null,context2D:null,canvas:null,cursorVisibility:!0,cursor:"pointer",textureUnitManager:null,textureResourceIds:null,containerSize:null,renderPasses:[],notifyStartCaptureImage:!1,webgl2:!1,defaultToWebgl2:!0,activeFramebuffer:null,imageFormat:"image/png",useOffScreen:!1,useBackgroundImage:!1};function Ks(t,e,n={}){Object.assign(e,ch,n),eh.extend(t,e,n),e.canvas||(e.canvas=document.createElement("canvas"),e.canvas.style.width="100%"),e.selector||(e.selector=Hs.newInstance(),e.selector.setOpenGLRenderWindow(t)),e.bgImage=new Image,e.bgImage.style.position="absolute",e.bgImage.style.left="0",e.bgImage.style.top="0",e.bgImage.style.width="100%",e.bgImage.style.height="100%",e.bgImage.style.zIndex="-1",e._textureResourceIds=new Map,e._graphicsResources=new Map,e._glInformation=null,e.myFactory=_f.newInstance(),e.shaderCache=Z0.newInstance(),e.shaderCache.setOpenGLRenderWindow(t),e.renderPasses[0]=Rc.newInstance(),C.get(t,e,["shaderCache","textureUnitManager","webgl2","useBackgroundImage","activeFramebuffer","rootOpenGLRenderWindow"]),C.setGet(t,e,["initialized","context","context2D","canvas","renderPasses","notifyStartCaptureImage","defaultToWebgl2","cursor","useOffScreen"]),C.setGetArray(t,e,["size"],2),C.event(t,e,"imageReady"),C.event(t,e,"windowResizeEvent"),fh(t,e)}var tr=C.newInstance(Ks,"vtkOpenGLRenderWindow");Ls("WebGL",tr);var Hp={newInstance:tr,extend:Ks,pushMonitorGLContextCount:ih,popMonitorGLContextCount:oh};_a("vtkRenderWindow",tr);var{vtkErrorMacro:Yr}=C,Zr=0,Qr=1,Rn=2;function uh(t,e){e.classHierarchy.push("vtkLookupTable"),t.isOpaque=()=>{if(e.opaqueFlagBuildTime.getMTime()<t.getMTime()){let n=!0;e.nanColor[3]<1&&(n=0),e.useBelowRangeColor&&e.belowRangeColor[3]<1&&(n=0),e.useAboveRangeColor&&e.aboveRangeColor[3]<1&&(n=0);for(let r=3;r<e.table.length&&n;r+=4)e.table[r]<255&&(n=!1);e.opaqueFlag=n,e.opaqueFlagBuildTime.modified()}return e.opaqueFlag},t.usingLogScale=()=>!1,t.getNumberOfAvailableColors=()=>e.table.length/4-3,t.linearIndexLookup=(n,r)=>{let s=0;const a=Number(n);return a<r.range[0]?s=r.maxIndex+Zr+1.5:a>r.range[1]?s=r.maxIndex+Qr+1.5:(s=(a+r.shift)*r.scale,s=s<r.maxIndex?s:r.maxIndex),Math.floor(s)},t.linearLookup=(n,r,s)=>{let a=0;mt(n)?a=Math.floor(s.maxIndex+1.5+Rn):a=t.linearIndexLookup(n,s);const i=4*a;return r.slice(i,i+4)},t.indexedLookupFunction=(n,r,s)=>{let a=t.getAnnotatedValueIndexInternal(n);a===-1&&(a=e.numberOfColors+Rn);const i=4*a;return[r[i],r[i+1],r[i+2],r[i+3]]},t.lookupShiftAndScale=(n,r)=>{r.shift=-n[0],r.scale=Number.MAX_VALUE,n[1]>n[0]&&(r.scale=(r.maxIndex+1)/(n[1]-n[0]))},t.mapScalarsThroughTable=(n,r,s,a)=>{let i=t.linearLookup;e.indexedLookup&&(i=t.indexedLookupFunction);const o=t.getMappingRange(),c={maxIndex:t.getNumberOfColors()-1,range:o,shift:0,scale:0};t.lookupShiftAndScale(o,c);const g=t.getAlpha(),T=n.getNumberOfTuples(),f=n.getNumberOfComponents(),y=r.getData(),w=n.getData();if(g>=1){if(s===Dn.RGBA)for(let R=0;R<T;R++){const l=i(w[R*f+a],e.table,c);y[R*4]=l[0],y[R*4+1]=l[1],y[R*4+2]=l[2],y[R*4+3]=l[3]}}else if(s===Dn.RGBA)for(let R=0;R<T;R++){const l=i(w[R*f+a],e.table,c);y[R*4]=l[0],y[R*4+1]=l[1],y[R*4+2]=l[2],y[R*4+3]=Math.floor(l[3]*g+.5)}},t.forceBuild=()=>{let n=0,r=0,s=0,a=0;const i=e.numberOfColors-1;i&&(n=(e.hueRange[1]-e.hueRange[0])/i,r=(e.saturationRange[1]-e.saturationRange[0])/i,s=(e.valueRange[1]-e.valueRange[0])/i,a=(e.alphaRange[1]-e.alphaRange[0])/i),e.table.length=4*i+16;const o=[],c=[];for(let g=0;g<=i;g++)o[0]=e.hueRange[0]+g*n,o[1]=e.saturationRange[0]+g*r,o[2]=e.valueRange[0]+g*s,tt(o,c),c[3]=e.alphaRange[0]+g*a,e.table[g*4]=c[0]*255+.5,e.table[g*4+1]=c[1]*255+.5,e.table[g*4+2]=c[2]*255+.5,e.table[g*4+3]=c[3]*255+.5;t.buildSpecialColors(),e.buildTime.modified()},t.setTable=n=>{if(Array.isArray(n)){const s=n[0].length;e.numberOfColors=n.length;const a=4-s;let i=0;for(let o=0;o<e.numberOfColors;o++)e.table[o*4]=255,e.table[o*4+1]=255,e.table[o*4+2]=255,e.table[o*4+3]=255;for(let o=0;o<n.length;o++){const c=n[o];for(let g=0;g<s;g++)e.table[i++]=c[g];i+=a}return t.buildSpecialColors(),e.insertTime.modified(),t.modified(),!0}if(n.getNumberOfComponents()!==4)return Yr("Expected 4 components for RGBA colors"),!1;if(n.getDataType()!==ee.UNSIGNED_CHAR)return Yr("Expected unsigned char values for RGBA colors"),!1;e.numberOfColors=n.getNumberOfTuples();const r=n.getData();e.table.length=r.length;for(let s=0;s<r.length;s++)e.table[s]=r[s];return t.buildSpecialColors(),e.insertTime.modified(),t.modified(),!0},t.buildSpecialColors=()=>{const{numberOfColors:n}=e,r=e.table;let s=(n+Zr)*4;e.useBelowRangeColor||n===0?(r[s]=e.belowRangeColor[0]*255+.5,r[s+1]=e.belowRangeColor[1]*255+.5,r[s+2]=e.belowRangeColor[2]*255+.5,r[s+3]=e.belowRangeColor[3]*255+.5):(r[s]=r[0],r[s+1]=r[1],r[s+2]=r[2],r[s+3]=r[3]),s=(n+Qr)*4,e.useAboveRangeColor||n===0?(r[s]=e.aboveRangeColor[0]*255+.5,r[s+1]=e.aboveRangeColor[1]*255+.5,r[s+2]=e.aboveRangeColor[2]*255+.5,r[s+3]=e.aboveRangeColor[3]*255+.5):(r[s]=r[4*(n-1)+0],r[s+1]=r[4*(n-1)+1],r[s+2]=r[4*(n-1)+2],r[s+3]=r[4*(n-1)+3]),s=(n+Rn)*4,r[s]=e.nanColor[0]*255+.5,r[s+1]=e.nanColor[1]*255+.5,r[s+2]=e.nanColor[2]*255+.5,r[s+3]=e.nanColor[3]*255+.5},t.build=()=>{(e.table.length<1||t.getMTime()>e.buildTime.getMTime()&&e.insertTime.getMTime()<=e.buildTime.getMTime())&&t.forceBuild()},e.table.length>0&&(t.buildSpecialColors(),e.insertTime.modified())}var gh={numberOfColors:256,hueRange:[0,.66667],saturationRange:[1,1],valueRange:[1,1],alphaRange:[1,1],nanColor:[.5,0,0,1],belowRangeColor:[0,0,0,1],aboveRangeColor:[1,1,1,1],useAboveRangeColor:!1,useBelowRangeColor:!1,alpha:1};function Ys(t,e,n={}){Object.assign(e,gh,n),Yn.extend(t,e,n),e.table||(e.table=[]),e.buildTime={},C.obj(e.buildTime),e.opaqueFlagBuildTime={},C.obj(e.opaqueFlagBuildTime,{mtime:0}),e.insertTime={},C.obj(e.insertTime,{mtime:0}),C.get(t,e,["buildTime"]),C.setGet(t,e,["numberOfColors","useAboveRangeColor","useBelowRangeColor"]),C.setArray(t,e,["alphaRange","hueRange","saturationRange","valueRange"],2),C.setArray(t,e,["nanColor","belowRangeColor","aboveRangeColor"],4),C.getArray(t,e,["hueRange","saturationRange","valueRange","alphaRange","nanColor","belowRangeColor","aboveRangeColor"]),uh(t,e)}var hh=C.newInstance(Ys,"vtkLookupTable"),ph={newInstance:hh,extend:Ys},{FieldAssociations:Jr}=rn,{staticOffsetAPI:Th,otherStaticMethods:vh}=sn,{ColorMode:Ut,ScalarMode:He,GetArray:Cn}=Kn,{VectorMode:yh}=Xn,{VtkDataTypes:lh}=ne;function ut(t){return()=>C.vtkErrorMacro(`vtkMapper::${t} - NOT IMPLEMENTED`)}function xh(t,e){const n=t[1]%2===0?1:-1;if(t[0]+=n,t[0]>=e[0]||t[0]<0){const r=t[2]%2===0?1:-1;t[0]-=n,t[1]+=r,(t[1]>=e[1]||t[1]<0)&&(t[1]-=r,t[2]++)}}function Eh(t,e){return t[0]+e[0]*(t[1]+e[1]*t[2])}function qr(t,e,n){const r=Math.floor(e),s=r%(2*n[0]);let a,i;s<n[0]?(t[0]=s,a=1,i=t[0]===n[0]-1):(t[0]=2*n[0]-1-s,a=-1,i=t[0]===0);const o=Math.floor(r/n[0]),c=o%(2*n[1]);let g,T;c<n[1]?(t[1]=c,g=1,T=t[1]===n[1]-1):(t[1]=2*n[1]-1-c,g=-1,T=t[1]===0),t[2]=Math.floor(o/n[1]);const f=e-r;i?T?t[2]+=f:t[1]+=g*f:t[0]+=a*f,t[0]=(t[0]+.5)/n[0],t[1]=(t[1]+.5)/n[1],t[2]=(t[2]+.5)/n[2]}var Ar=new WeakMap;function Sh(t,e,n,r,s,a,i){const o=new Array(arguments.length);for(let F=0;F<arguments.length;++F){const N=arguments[F];o[F]=N.getMTime?.()??N}const c=o.join("/"),g=Ar.get(t);if(g&&g.stringHash===c)return g.textureCoordinates;const T=(n[1]-n[0])/(s-1),[f,y]=[n[0]-T,n[1]+T],w=f-.5*T,R=1/(y-f+T),l=f,x=(s+1)/(y-f),u=t.getData(),p=t.getNumberOfTuples(),h=t.getNumberOfComponents(),v=e<0||e>=h,E=a[2]<=1?2:3,S=ne.newInstance({numberOfComponents:E,values:new Float32Array(p*E)}),_=S.getData(),d=[0,0,0];qr(d,s+2,a);let L=0,M=0;const D=[.5,.5,.5];for(let F=0;F<p;++F){let N;if(v){let U=0;for(let W=0;W<h;++W){const V=Number(u[L+W]);U+=V*V}N=Math.sqrt(U)}else N=Number(u[L+e]);if(r&&(N=Math.log10(N)),L+=h,mt(N))D[0]=d[0],D[1]=d[1],D[2]=d[2];else if(i){let U=(N-l)*x;U<1?U=0:U>s&&(U=s+1),qr(D,U,a)}else{D[1]=.49;const U=(N-w)*R;U>1e3?D[0]=1e3:U<-1e3?D[0]=-1e3:D[0]=U}for(let U=0;U<E;++U)_[M++]=D[U]}return Ar.set(t,{stringHash:c,textureCoordinates:S}),S}function Rh(t,e){e.classHierarchy.push("vtkMapper"),t.computeBounds=()=>{const n=t.getInputData();n?(e.static||t.update(),Y.setBounds(e.bounds,n.getBounds())):Y.reset(e.bounds)},t.setForceCompileOnly=n=>{e.forceCompileOnly=n},t.setSelectionWebGLIdsToVTKIds=n=>{e.selectionWebGLIdsToVTKIds=n},t.createDefaultLookupTable=()=>{e.lookupTable=ph.newInstance()},t.getColorModeAsString=()=>C.enumToString(Ut,e.colorMode),t.setColorModeToDefault=()=>t.setColorMode(0),t.setColorModeToMapScalars=()=>t.setColorMode(1),t.setColorModeToDirectScalars=()=>t.setColorMode(2),t.getScalarModeAsString=()=>C.enumToString(He,e.scalarMode),t.setScalarModeToDefault=()=>t.setScalarMode(0),t.setScalarModeToUsePointData=()=>t.setScalarMode(1),t.setScalarModeToUseCellData=()=>t.setScalarMode(2),t.setScalarModeToUsePointFieldData=()=>t.setScalarMode(3),t.setScalarModeToUseCellFieldData=()=>t.setScalarMode(4),t.setScalarModeToUseFieldData=()=>t.setScalarMode(5),t.getAbstractScalars=(n,r,s,a,i)=>{if(!n||!e.scalarVisibility)return{scalars:null,cellFlag:!1};let o=null,c=!1;if(r===He.DEFAULT)o=n.getPointData().getScalars(),o||(o=n.getCellData().getScalars(),c=!0);else if(r===He.USE_POINT_DATA)o=n.getPointData().getScalars();else if(r===He.USE_CELL_DATA)o=n.getCellData().getScalars(),c=!0;else if(r===He.USE_POINT_FIELD_DATA){const g=n.getPointData();s===Cn.BY_ID?o=g.getArrayByIndex(a):o=g.getArrayByName(i)}else if(r===He.USE_CELL_FIELD_DATA){const g=n.getCellData();c=!0,s===Cn.BY_ID?o=g.getArrayByIndex(a):o=g.getArrayByName(i)}else if(r===He.USE_FIELD_DATA){const g=n.getFieldData();s===Cn.BY_ID?o=g.getArrayByIndex(a):o=g.getArrayByName(i)}return{scalars:o,cellFlag:c}},t.mapScalars=(n,r)=>{const{scalars:s,cellFlag:a}=t.getAbstractScalars(n,e.scalarMode,e.arrayAccessMode,e.arrayId,e.colorByArrayName);if(e.areScalarsMappedFromCells=a,!s){e.colorCoordinates=null,e.colorTextureMap=null,e.colorMapColors=null;return}const i=`${t.getMTime()}${s.getMTime()}${r}`;if(e.colorBuildString!==i){if(e.useLookupTableScalarRange||t.getLookupTable().setRange(e.scalarRange[0],e.scalarRange[1]),t.canUseTextureMapForColoring(s,a))e.mapScalarsToTexture(s,a,r);else{e.colorCoordinates=null,e.colorTextureMap=null;const o=t.getLookupTable();o&&(o.build(),e.colorMapColors=o.mapScalars(s,e.colorMode,e.fieldDataTupleId))}e.colorBuildString=`${t.getMTime()}${s.getMTime()}${r}`}},e.mapScalarsToTexture=(n,r,s)=>{const a=e.lookupTable.getRange(),i=e.lookupTable.usingLogScale(),o=e.lookupTable.getAlpha(),c=i?[Math.log10(a[0]),Math.log10(a[1])]:a;if(e.colorMapColors=null,e.colorTextureMap==null||t.getMTime()>e.colorTextureMap.getMTime()||e.lookupTable.getMTime()>e.colorTextureMap.getMTime()||e.lookupTable.getAlpha()!==s){e.lookupTable.setAlpha(s),e.colorTextureMap=null,e.lookupTable.build();const g=e.lookupTable.getNumberOfAvailableColors(),T=2048,f=T**3-3;e.numberOfColorsInRange=Math.min(Math.max(g,2),r?f:4094);const y=e.numberOfColorsInRange+3,w=e.numberOfColorsInRange+2,R=r?[Math.min(Math.ceil(y/T**0),T),Math.min(Math.ceil(y/T**1),T),Math.min(Math.ceil(y/T**2),T)]:[w,2,1],l=R[0]*R[1]*R[2],x=new Float64Array(l);x.fill(NaN);const u=e.numberOfColorsInRange,p=u+2,h=[0,0,0],v=c[0],E=c[1]-c[0];for(let d=0;d<p;++d){const L=Eh(h,R),M=v+E*(d-1)/(u-1);x[L]=i?10**M:M,xh(h,R)}const S=ne.newInstance({numberOfComponents:1,values:x}),_=e.lookupTable.mapScalars(S,e.colorMode,0);e.colorTextureMap=_i.newInstance(),e.colorTextureMap.setDimensions(R),e.colorTextureMap.getPointData().setScalars(_),e.lookupTable.setAlpha(o)}e.colorCoordinates=Sh(n,e.lookupTable.getVectorMode()===yh.MAGNITUDE&&n.getNumberOfComponents()>1?-1:e.lookupTable.getVectorComponent(),c,i,e.numberOfColorsInRange,e.colorTextureMap.getDimensions(),r)},t.getIsOpaque=()=>{const n=t.getInputData(),r=t.getAbstractScalars(n,e.scalarMode,e.arrayAccessMode,e.arrayId,e.colorByArrayName).scalars;if(!e.scalarVisibility||r==null)return!0;const s=t.getLookupTable();return s?(s.build(),s.areScalarsOpaque(r,e.colorMode,-1)):!0},t.canUseTextureMapForColoring=(n,r)=>r&&e.colorMode!==Ut.DIRECT_SCALARS?!0:!(!e.interpolateScalarsBeforeMapping||e.lookupTable&&e.lookupTable.getIndexedLookup()||!n||e.colorMode===Ut.DEFAULT&&n.getDataType()===lh.UNSIGNED_CHAR||e.colorMode===Ut.DIRECT_SCALARS),t.clearColorArrays=()=>{e.colorMapColors=null,e.colorCoordinates=null,e.colorTextureMap=null},t.getLookupTable=()=>(e.lookupTable||t.createDefaultLookupTable(),e.lookupTable),t.getMTime=()=>{let n=e.mtime;if(e.lookupTable!==null){const r=e.lookupTable.getMTime();n=r>n?r:n}return n},t.getPrimitiveCount=()=>{const n=t.getInputData();return{points:n.getPoints().getNumberOfValues()/3,verts:n.getVerts().getNumberOfValues()-n.getVerts().getNumberOfCells(),lines:n.getLines().getNumberOfValues()-2*n.getLines().getNumberOfCells(),triangles:n.getPolys().getNumberOfValues()-3*n.getPolys().getNumberOfCells()}},t.acquireInvertibleLookupTable=ut("AcquireInvertibleLookupTable"),t.valueToColor=ut("ValueToColor"),t.colorToValue=ut("ColorToValue"),t.useInvertibleColorFor=ut("UseInvertibleColorFor"),t.clearInvertibleColor=ut("ClearInvertibleColor"),t.processSelectorPixelBuffers=(n,r)=>{if(!n||!e.selectionWebGLIdsToVTKIds||!e.populateSelectionSettings)return;const s=n.getRawPixelBuffer(je.ID_LOW24),a=n.getRawPixelBuffer(je.ID_HIGH24),i=n.getCurrentPass(),o=n.getFieldAssociation();let c=null;o===Jr.FIELD_ASSOCIATION_POINTS?c=e.selectionWebGLIdsToVTKIds.points:o===Jr.FIELD_ASSOCIATION_CELLS&&(c=e.selectionWebGLIdsToVTKIds.cells),c&&r.forEach(g=>{if(i===je.ID_LOW24){let T=0;a&&(T+=a[g],T*=256),T+=s[g+2],T*=256,T+=s[g+1],T*=256,T+=s[g];const f=c[T],y=n.getPixelBuffer(je.ID_LOW24);y[g]=f&255,y[g+1]=(f&65280)>>8,y[g+2]=(f&16711680)>>16}else if(i===je.ID_HIGH24&&a){let T=0;T+=a[g],T*=256,T+=s[g+2],T*=256,T+=s[g+1],T*=256,T+=s[g];const f=c[T],y=n.getPixelBuffer(je.ID_HIGH24);y[g]=(f&4278190080)>>24}})}}var Ch={colorMapColors:null,areScalarsMappedFromCells:!1,static:!1,lookupTable:null,scalarVisibility:!0,scalarRange:[0,1],useLookupTableScalarRange:!1,colorMode:0,scalarMode:0,arrayAccessMode:1,renderTime:0,colorByArrayName:null,fieldDataTupleId:-1,populateSelectionSettings:!0,selectionWebGLIdsToVTKIds:null,interpolateScalarsBeforeMapping:!1,colorCoordinates:null,colorTextureMap:null,numberOfColorsInRange:0,forceCompileOnly:0,useInvertibleColors:!1,invertibleScalars:null,customShaderAttributes:[]};function Zs(t,e,n={}){Object.assign(e,Ch,n),Jn.extend(t,e,n),C.get(t,e,["areScalarsMappedFromCells","colorCoordinates","colorMapColors","colorTextureMap","numberOfColorsInRange","selectionWebGLIdsToVTKIds"]),C.setGet(t,e,["colorByArrayName","arrayAccessMode","colorMode","fieldDataTupleId","interpolateScalarsBeforeMapping","lookupTable","populateSelectionSettings","renderTime","scalarMode","scalarVisibility","static","useLookupTableScalarRange","customShaderAttributes"]),C.setGetArray(t,e,["scalarRange"],2),sn.implementCoincidentTopologyMethods(t,e),Rh(t,e)}var wh=C.newInstance(Zs,"vtkMapper"),zp={newInstance:wh,extend:Zs,...Th,...vh,...Kn};function dh(t,e){e.classHierarchy.push("vtkLight");const n=new Float64Array(3);t.getTransformedPosition=()=>(e.transformMatrix?P(n,e.position,e.transformMatrix):It(n,e.position[0],e.position[1],e.position[2]),n),t.getTransformedFocalPoint=()=>(e.transformMatrix?P(n,e.focalPoint,e.transformMatrix):It(n,e.focalPoint[0],e.focalPoint[1],e.focalPoint[2]),n),t.getDirection=()=>(e.directionMTime<e.mtime&&(ur(e.direction,e.focalPoint,e.position),_e(e.direction),e.directionMTime=e.mtime),e.direction),t.setDirection=r=>{const s=new Float64Array(3);ur(s,e.position,r),e.focalPoint=s},t.setDirectionAngle=(r,s)=>{const a=m(r),i=m(s);t.setPosition(Math.cos(a)*Math.sin(i),Math.sin(a),Math.cos(a)*Math.cos(i)),t.setFocalPoint(0,0,0),t.setPositional(0)},t.setLightTypeToHeadLight=()=>{t.setLightType("HeadLight")},t.setLightTypeToCameraLight=()=>{t.setLightType("CameraLight")},t.setLightTypeToSceneLight=()=>{t.setTransformMatrix(null),t.setLightType("SceneLight")},t.lightTypeIsHeadLight=()=>e.lightType==="HeadLight",t.lightTypeIsSceneLight=()=>e.lightType==="SceneLight",t.lightTypeIsCameraLight=()=>e.lightType==="CameraLight"}var _h={switch:!0,intensity:1,color:[1,1,1],position:[0,0,1],focalPoint:[0,0,0],positional:!1,exponent:1,coneAngle:30,coneFalloff:5,attenuationValues:[1,0,0],transformMatrix:null,lightType:"SceneLight",shadowAttenuation:1,direction:[0,0,0],directionMTime:0};function Lh(t,e,n={}){Object.assign(e,_h,n),C.obj(t,e),C.setGet(t,e,["intensity","switch","positional","exponent","coneAngle","coneFalloff","transformMatrix","lightType","shadowAttenuation","attenuationValues"]),C.setGetArray(t,e,["color","position","focalPoint","attenuationValues"],3),dh(t,e)}var Mh=C.newInstance(Lh,"vtkLight"),Oh={newInstance:Mh},{vtkErrorMacro:Jt}=C;function Dh(t){return()=>Jt(`vtkViewport::${t} - NOT IMPLEMENTED`)}function Fh(t,e){e.classHierarchy.push("vtkViewport"),t.getViewProps=()=>e.props,t.hasViewProp=r=>e.props.includes(r),t.addViewProp=r=>{r&&!t.hasViewProp(r)&&e.props.push(r)},t.removeViewProp=r=>{const s=e.props.filter(a=>a!==r);e.props.length!==s.length&&(e.props=s)},t.removeAllViewProps=()=>{e.props=[]};function n(r,s=[]){s.push(r);const a=r.getNestedProps();if(a&&a.length)for(let i=0;i<a.length;i++)n(a[i],s);return s}t.getViewPropsWithNestedProps=()=>{let r=[];e.actors2D=[];for(let s=0;s<e.props.length;s++){const a=e.props[s].getActors2D();a&&(!Array.isArray(a)||a.length>0)?e.actors2D=e.actors2D.concat(a):n(e.props[s],r)}return e.actors2D.sort((s,a)=>s.getLayerNumber()-a.getLayerNumber()),r=r.concat(e.actors2D),r},t.addActor2D=t.addViewProp,t.removeActor2D=r=>{t.removeViewProp(r)},t.getActors2D=()=>(e.actors2D=[],e.props.forEach(r=>{e.actors2D=e.actors2D.concat(r.getActors2D())}),e.actors2D),t.displayToView=()=>Jt("call displayToView on your view instead"),t.viewToDisplay=()=>Jt("callviewtodisplay on your view instead"),t.getSize=()=>Jt("call getSize on your View instead"),t.normalizedDisplayToProjection=(r,s,a)=>{const i=t.normalizedDisplayToNormalizedViewport(r,s,a);return t.normalizedViewportToProjection(i[0],i[1],i[2])},t.normalizedDisplayToNormalizedViewport=(r,s,a)=>{const i=[e.viewport[2]-e.viewport[0],e.viewport[3]-e.viewport[1]];return[(r-e.viewport[0])/i[0],(s-e.viewport[1])/i[1],a]},t.normalizedViewportToProjection=(r,s,a)=>[r*2-1,s*2-1,a*2-1],t.projectionToNormalizedDisplay=(r,s,a)=>{const i=t.projectionToNormalizedViewport(r,s,a);return t.normalizedViewportToNormalizedDisplay(i[0],i[1],i[2])},t.normalizedViewportToNormalizedDisplay=(r,s,a)=>{const i=[e.viewport[2]-e.viewport[0],e.viewport[3]-e.viewport[1]];return[r*i[0]+e.viewport[0],s*i[1]+e.viewport[1],a]},t.projectionToNormalizedViewport=(r,s,a)=>[(r+1)*.5,(s+1)*.5,(a+1)*.5],t.PickPropFrom=Dh("PickPropFrom")}var Bh={background:[0,0,0],background2:[.2,.2,.2],gradientBackground:!1,viewport:[0,0,1,1],aspect:[1,1],pixelAspect:[1,1],props:[],actors2D:[]};function Qs(t,e,n={}){Object.assign(e,Bh,n),C.obj(t,e),C.event(t,e,"event"),C.setGet(t,e,["gradientBackground"]),C.setGetArray(t,e,["viewport"],4),C.setGetArray(t,e,["background","background2"],3),Fh(t,e)}var Nh=C.newInstance(Qs,"vtkViewport"),Gh={newInstance:Nh,extend:Qs},{vtkDebugMacro:gt,vtkErrorMacro:Ne,vtkWarningMacro:Uh}=zn;function br(t){return()=>Ne(`vtkRenderer::${t} - NOT IMPLEMENTED`)}function Vh(t,e){e.classHierarchy.push("vtkRenderer");const n={type:"ComputeVisiblePropBoundsEvent",renderer:t},r={type:"ResetCameraClippingRangeEvent",renderer:t},s={type:"ResetCameraEvent",renderer:t};t.updateCamera=()=>(e.activeCamera||(gt("No cameras are on, creating one."),t.getActiveCameraAndResetIfCreated()),e.activeCamera.render(t),!0),t.updateLightsGeometryToFollowCamera=()=>{const a=t.getActiveCameraAndResetIfCreated();e.lights.forEach(i=>{i.lightTypeIsSceneLight()||(i.lightTypeIsHeadLight()?(i.setPositionFrom(a.getPositionByReference()),i.setFocalPointFrom(a.getFocalPointByReference()),i.modified(a.getMTime())):i.lightTypeIsCameraLight()?i.setTransformMatrix(a.getCameraLightTransformMatrix($n())):Ne("light has unknown light type",i.get()))})},t.updateLightGeometry=()=>e.lightFollowCamera?t.updateLightsGeometryToFollowCamera():!0,t.allocateTime=br("allocateTime"),t.updateGeometry=br("updateGeometry"),t.getVTKWindow=()=>e._renderWindow,t.setLayer=a=>{gt(t.getClassName(),t,"setting Layer to ",a),e.layer!==a&&(e.layer=a,t.modified()),t.setPreserveColorBuffer(!!a)},t.setActiveCamera=a=>e.activeCamera===a?!1:(e.activeCamera=a,t.modified(),t.invokeEvent({type:"ActiveCameraEvent",camera:a}),!0),t.makeCamera=()=>{const a=Hi.newInstance();return t.invokeEvent({type:"CreateCameraEvent",camera:a}),a},t.getActiveCamera=()=>(e.activeCamera||(e.activeCamera=t.makeCamera()),e.activeCamera),t.getActiveCameraAndResetIfCreated=()=>(e.activeCamera||(t.getActiveCamera(),t.resetCamera()),e.activeCamera),t.getActors=()=>(e.actors=[],e.props.forEach(a=>{e.actors=e.actors.concat(a.getActors())}),e.actors),t.addActor=t.addViewProp,t.removeActor=a=>{e.actors=e.actors.filter(i=>i!==a),t.removeViewProp(a),t.modified()},t.removeAllActors=()=>{t.getActors().forEach(a=>{t.removeViewProp(a)}),e.actors=[],t.modified()},t.getVolumes=()=>(e.volumes=[],e.props.forEach(a=>{e.volumes=e.volumes.concat(a.getVolumes())}),e.volumes),t.addVolume=t.addViewProp,t.removeVolume=a=>{e.volumes=e.volumes.filter(i=>i!==a),t.removeViewProp(a),t.modified()},t.removeAllVolumes=()=>{t.getVolumes().forEach(a=>{t.removeViewProp(a)}),e.volumes=[],t.modified()},t.hasLight=a=>e.lights.includes(a),t.addLight=a=>{a&&!t.hasLight(a)&&(e.lights.push(a),t.modified())},t.removeLight=a=>{e.lights=e.lights.filter(i=>i!==a),t.modified()},t.removeAllLights=()=>{e.lights=[],t.modified()},t.setLightCollection=a=>{e.lights=a,t.modified()},t.makeLight=Oh.newInstance,t.createLight=()=>{e.automaticLightCreation&&(e._createdLight&&(t.removeLight(e._createdLight),e._createdLight.delete(),e._createdLight=null),e._createdLight=t.makeLight(),t.addLight(e._createdLight),e._createdLight.setLightTypeToHeadLight(),e._createdLight.setPosition(t.getActiveCamera().getPosition()),e._createdLight.setFocalPoint(t.getActiveCamera().getFocalPoint()))},t.normalizedDisplayToWorld=(a,i,o,c)=>{let g=t.normalizedDisplayToProjection(a,i,o);return g=t.projectionToView(g[0],g[1],g[2],c),t.viewToWorld(g[0],g[1],g[2])},t.worldToNormalizedDisplay=(a,i,o,c)=>{let g=t.worldToView(a,i,o);return g=t.viewToProjection(g[0],g[1],g[2],c),t.projectionToNormalizedDisplay(g[0],g[1],g[2])},t.viewToWorld=(a,i,o)=>{if(e.activeCamera===null)return Ne("ViewToWorld: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];const c=e.activeCamera.getViewMatrix();at(c,c),ce(c,c);const g=new Float64Array([a,i,o]);return P(g,g,c),g},t.projectionToView=(a,i,o,c)=>{if(e.activeCamera===null)return Ne("ProjectionToView: no active camera, cannot compute projection to view, returning 0,0,0"),[0,0,0];const g=e.activeCamera.getProjectionMatrix(c,-1,1);at(g,g),ce(g,g);const T=new Float64Array([a,i,o]);return P(T,T,g),T},t.worldToView=(a,i,o)=>{if(e.activeCamera===null)return Ne("WorldToView: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];const c=e.activeCamera.getViewMatrix();ce(c,c);const g=new Float64Array([a,i,o]);return P(g,g,c),g},t.viewToProjection=(a,i,o,c)=>{if(e.activeCamera===null)return Ne("ViewToProjection: no active camera, cannot compute view to projection, returning 0,0,0"),[0,0,0];const g=e.activeCamera.getProjectionMatrix(c,-1,1);ce(g,g);const T=new Float64Array([a,i,o]);return P(T,T,g),T},t.computeVisiblePropBounds=()=>{e.allBounds[0]=Y.INIT_BOUNDS[0],e.allBounds[1]=Y.INIT_BOUNDS[1],e.allBounds[2]=Y.INIT_BOUNDS[2],e.allBounds[3]=Y.INIT_BOUNDS[3],e.allBounds[4]=Y.INIT_BOUNDS[4],e.allBounds[5]=Y.INIT_BOUNDS[5];let a=!0;t.invokeEvent(n);for(let i=0;i<e.props.length;++i){const o=e.props[i];if(o.getVisibility()&&o.getUseBounds()){const c=o.getBounds();c&&hn(c)&&(a=!1,c[0]<e.allBounds[0]&&(e.allBounds[0]=c[0]),c[1]>e.allBounds[1]&&(e.allBounds[1]=c[1]),c[2]<e.allBounds[2]&&(e.allBounds[2]=c[2]),c[3]>e.allBounds[3]&&(e.allBounds[3]=c[3]),c[4]<e.allBounds[4]&&(e.allBounds[4]=c[4]),c[5]>e.allBounds[5]&&(e.allBounds[5]=c[5]))}}return a&&(na(e.allBounds),gt("Can't compute bounds, no 3D props are visible")),e.allBounds},t.resetCamera=(a=null)=>{const i=a||t.computeVisiblePropBounds(),o=[0,0,0];if(!hn(i))return gt("Cannot reset camera!"),!1;let c=null;if(t.getActiveCamera())c=e.activeCamera.getViewPlaneNormal();else return Ne("Trying to reset non-existent camera"),!1;e.activeCamera.setViewAngle(30),o[0]=(i[0]+i[1])/2,o[1]=(i[2]+i[3])/2,o[2]=(i[4]+i[5])/2;let g=i[1]-i[0],T=i[3]-i[2],f=i[5]-i[4];g*=g,T*=T,f*=f;let y=g+T+f;y=y===0?1:y,y=Math.sqrt(y)*.5;const w=m(e.activeCamera.getViewAngle()),R=y,l=y/Math.sin(w*.5),x=e.activeCamera.getViewUp();return Math.abs(Q(x,c))>.999&&(Uh("Resetting view-up since view plane normal is parallel"),e.activeCamera.setViewUp(-x[2],x[0],x[1])),e.activeCamera.setFocalPoint(o[0],o[1],o[2]),e.activeCamera.setPosition(o[0]+l*c[0],o[1]+l*c[1],o[2]+l*c[2]),t.resetCameraClippingRange(i),e.activeCamera.setParallelScale(R),e.activeCamera.setPhysicalScale(y),e.activeCamera.setPhysicalTranslation(-o[0],-o[1],-o[2]),t.invokeEvent(s),!0},t.resetCameraClippingRange=(a=null)=>{const i=a||t.computeVisiblePropBounds();if(!hn(i))return gt("Cannot reset camera clipping range!"),!1;if(t.getActiveCameraAndResetIfCreated(),!e.activeCamera)return Ne("Trying to reset clipping range of non-existent camera"),!1;const o=e.activeCamera.computeClippingRange(i);let c=0;if(e.activeCamera.getParallelProjection())c=.2*e.activeCamera.getParallelScale();else{const g=m(e.activeCamera.getViewAngle());c=.2*Math.tan(g/2)*o[1]}return o[1]-o[0]<c&&(c=c-o[1]+o[0],o[1]+=c/2,o[0]-=c/2),o[0]<0&&(o[0]=0),o[0]=.99*o[0]-(o[1]-o[0])*e.clippingRangeExpansion,o[1]=1.01*o[1]+(o[1]-o[0])*e.clippingRangeExpansion,o[0]=o[0]>=o[1]?.01*o[1]:o[0],e.nearClippingPlaneTolerance||(e.nearClippingPlaneTolerance=.01),o[0]<e.nearClippingPlaneTolerance*o[1]&&(o[0]=e.nearClippingPlaneTolerance*o[1]),e.activeCamera.setClippingRange(o[0],o[1]),t.invokeEvent(r),!1},t.setRenderWindow=a=>{a!==e._renderWindow&&(e._vtkWindow=a,e._renderWindow=a)},t.visibleActorCount=()=>e.props.filter(a=>a.getVisibility()).length,t.visibleVolumeCount=t.visibleActorCount,t.getMTime=()=>{let a=e.mtime;const i=e.activeCamera?e.activeCamera.getMTime():0;i>a&&(a=i);const o=e._createdLight?e._createdLight.getMTime():0;return o>a&&(a=o),a},t.getTransparent=()=>!!e.preserveColorBuffer,t.isActiveCameraCreated=()=>!!e.activeCamera}var kh={pickedProp:null,activeCamera:null,allBounds:[],ambient:[1,1,1],allocatedRenderTime:100,timeFactor:1,automaticLightCreation:!0,twoSidedLighting:!0,lastRenderTimeInSeconds:-1,renderWindow:null,lights:[],actors:[],volumes:[],lightFollowCamera:!0,numberOfPropsRendered:0,propArray:null,pathArray:null,layer:0,preserveColorBuffer:!1,preserveDepthBuffer:!1,computeVisiblePropBounds:Wn(),interactive:!0,nearClippingPlaneTolerance:0,clippingRangeExpansion:.05,erase:!0,draw:!0,useShadows:!1,useDepthPeeling:!1,occlusionRatio:0,maximumNumberOfPeels:4,selector:null,delegate:null,texturedBackground:!1,backgroundTexture:null,environmentTexture:null,environmentTextureDiffuseStrength:1,environmentTextureSpecularStrength:1,useEnvironmentTextureAsBackground:!1,pass:0};function Js(t,e,n={}){for(Object.assign(e,kh,n),Gh.extend(t,e,n),e.background||(e.background=[0,0,0,1]);e.background.length<3;)e.background.push(0);e.background.length===3&&e.background.push(1),Hn(t,e,["_renderWindow","allocatedRenderTime","timeFactor","lastRenderTimeInSeconds","numberOfPropsRendered","lastRenderingUsedDepthPeeling","selector"]),Ct(t,e,["twoSidedLighting","lightFollowCamera","automaticLightCreation","erase","draw","nearClippingPlaneTolerance","clippingRangeExpansion","backingStore","interactive","layer","preserveColorBuffer","preserveDepthBuffer","useDepthPeeling","occlusionRatio","maximumNumberOfPeels","delegate","backgroundTexture","texturedBackground","environmentTexture","environmentTextureDiffuseStrength","environmentTextureSpecularStrength","useEnvironmentTextureAsBackground","useShadows","pass"]),ta(t,e,["actors","volumes","lights"]),Li(t,e,["background"],4,1),Pr(t,e,["renderWindow"]),Vh(t,e)}var $h=ot(Js,"vtkRenderer"),jp={newInstance:$h,extend:Js},Wh={Unknown:0,LeftController:1,RightController:2},Hh={Unknown:0,Trigger:1,TrackPad:2,Grip:3,Thumbstick:4,A:5,B:6,ApplicationMenu:7},zh={Unknown:0,TouchpadX:1,TouchpadY:2,ThumbstickX:3,ThumbstickY:4},jh={LeftButton:1,MiddleButton:2,RightButton:3},qs={Device:Wh,Input:Hh,Axis:zh,MouseButton:jh},{Device:Vt,Input:Xe}=qs,{vtkWarningMacro:kt,vtkErrorMacro:$t,normalizeWheel:Xh,vtkOnceErrorMacro:Kh}=C,et={ctrlKey:!1,altKey:!1,shiftKey:!1},wn={"xr-standard":[Xe.Trigger,Xe.Grip,Xe.TrackPad,Xe.Thumbstick,Xe.A,Xe.B]},nr=["StartAnimation","Animation","EndAnimation","PointerEnter","PointerLeave","MouseEnter","MouseLeave","StartMouseMove","MouseMove","EndMouseMove","LeftButtonPress","LeftButtonRelease","MiddleButtonPress","MiddleButtonRelease","RightButtonPress","RightButtonRelease","KeyPress","KeyDown","KeyUp","StartMouseWheel","MouseWheel","EndMouseWheel","StartPinch","Pinch","EndPinch","StartPan","Pan","EndPan","StartRotate","Rotate","EndRotate","Button3D","Move3D","StartPointerLock","EndPointerLock","StartInteraction","Interaction","EndInteraction","AnimationFrameRateUpdate"];function ht(t){t.cancelable&&t.preventDefault()}function Wt(t){const e=Object.create(null);return t.forEach(({pointerId:n,position:r})=>{e[n]=r}),e}function Yh(t,e){e.classHierarchy.push("vtkRenderWindowInteractor");const n={...t},r=new Set,s=new Map;let a=1,i=0;t.start=()=>{!e.initialized&&(t.initialize(),!e.initialized)||t.startEventLoop()},t.setRenderWindow=u=>{$t("you want to call setView(view) instead of setRenderWindow on a vtk.js interactor")},t.setInteractorStyle=u=>{e.interactorStyle!==u&&(e.interactorStyle!=null&&e.interactorStyle.setInteractor(null),e.interactorStyle=u,e.interactorStyle!=null&&e.interactorStyle.getInteractor()!==t&&e.interactorStyle.setInteractor(t))},t.initialize=()=>{e.initialized=!0,t.enable(),t.render()},t.enable=()=>t.setEnabled(!0),t.disable=()=>t.setEnabled(!1),t.startEventLoop=()=>kt("empty event loop");function o(u,p){e._forcedRenderer||(e.currentRenderer=t.findPokedRenderer(u,p))}t.getCurrentRenderer=()=>(e.currentRenderer||o(0,0),e.currentRenderer);function c(u){const p=e._view.getCanvas(),h=p.getBoundingClientRect(),v=p.width/h.width,E=p.height/h.height,S={x:v*(u.clientX-h.left),y:E*(h.height-u.clientY+h.top),z:0,movementX:v*u.movementX,movementY:E*u.movementY};return(s.size<=1||!e.currentRenderer)&&o(S.x,S.y),S}const g=e._getScreenEventPositionFor||c;function T(u){return{controlKey:u.ctrlKey,altKey:u.altKey,shiftKey:u.shiftKey}}function f(u){const p=T(u);return{key:u.key,keyCode:u.charCode,...p}}function y(u){return u.pointerType||""}const w=()=>{if(e.container===null)return;const{container:u}=e;u.addEventListener("contextmenu",ht),u.addEventListener("wheel",t.handleWheel),u.addEventListener("DOMMouseScroll",t.handleWheel),u.addEventListener("pointerenter",t.handlePointerEnter),u.addEventListener("pointerleave",t.handlePointerLeave),u.addEventListener("pointermove",t.handlePointerMove,{passive:!1}),u.addEventListener("pointerdown",t.handlePointerDown,{passive:!1}),u.addEventListener("pointerup",t.handlePointerUp),u.addEventListener("pointercancel",t.handlePointerCancel),u.addEventListener("keypress",t.handleKeyPress),u.addEventListener("keydown",t.handleKeyDown),document.addEventListener("keyup",t.handleKeyUp),document.addEventListener("pointerlockchange",t.handlePointerLockChange),u.tabIndex=0,u.style.touchAction="none",u.style.userSelect="none",u.style.webkitTapHighlightColor="rgba(0,0,0,0)"};t.bindEvents=u=>{u!==null&&n.setContainer(u)&&w()};const R=()=>{clearTimeout(e.moveTimeoutID),clearTimeout(e.wheelTimeoutID),e.moveTimeoutID=0,e.wheelTimeoutID=0,a=1;const{container:u}=e;u&&(u.removeEventListener("contextmenu",ht),u.removeEventListener("wheel",t.handleWheel),u.removeEventListener("DOMMouseScroll",t.handleWheel),u.removeEventListener("pointerenter",t.handlePointerEnter),u.removeEventListener("pointerleave",t.handlePointerLeave),u.removeEventListener("pointermove",t.handlePointerMove,{passive:!1}),u.removeEventListener("pointerdown",t.handlePointerDown,{passive:!1}),u.removeEventListener("pointerup",t.handlePointerUp),u.removeEventListener("pointercancel",t.handlePointerCancel),u.removeEventListener("keypress",t.handleKeyPress),u.removeEventListener("keydown",t.handleKeyDown)),document.removeEventListener("keyup",t.handleKeyUp),document.removeEventListener("pointerlockchange",t.handlePointerLockChange),s.clear(),i=0};t.unbindEvents=()=>{R(),n.setContainer(null)},t.handleKeyPress=u=>{const p=f(u);t.keyPressEvent(p)},t.handleKeyDown=u=>{const p=f(u);t.keyDownEvent(p)},t.handleKeyUp=u=>{const p=f(u);t.keyUpEvent(p)},t.handlePointerEnter=u=>{const p={...T(u),position:g(u),deviceType:y(u)};t.pointerEnterEvent(p),p.deviceType==="mouse"&&t.mouseEnterEvent(p)},t.handlePointerLeave=u=>{const p={...T(u),position:g(u),deviceType:y(u)};t.pointerLeaveEvent(p),p.deviceType==="mouse"&&t.mouseLeaveEvent(p)},t.handlePointerDown=u=>{if(!(u.button>2||t.isPointerLocked()))switch(e.preventDefaultOnPointerDown&&ht(u),u.target.hasPointerCapture(u.pointerId)&&u.target.releasePointerCapture(u.pointerId),e.container.setPointerCapture(u.pointerId),s.has(u.pointerId)&&kt("[RenderWindowInteractor] duplicate pointerId detected"),s.set(u.pointerId,{pointerId:u.pointerId,position:g(u)}),u.pointerType){case"pen":case"touch":t.handleTouchStart(u);break;default:t.handleMouseDown(u),i=u.buttons;break}};function l(u,p,h){(p&~h&1)!==0&&t.leftButtonReleaseEvent(u),(p&~h&4)!==0&&t.middleButtonReleaseEvent(u),(p&~h&2)!==0&&t.rightButtonReleaseEvent(u),(~p&h&1)!==0&&t.leftButtonPressEvent(u),(~p&h&4)!==0&&t.middleButtonPressEvent(u),(~p&h&2)!==0&&t.rightButtonPressEvent(u)}t.handlePointerUp=u=>{if(s.has(u.pointerId))switch(e.preventDefaultOnPointerUp&&ht(u),s.delete(u.pointerId),e.container.releasePointerCapture(u.pointerId),u.pointerType){case"pen":case"touch":t.handleTouchEnd(u);break;default:{const p=[1,4,2][u.button]??0;l({...T(u),position:g(u),deviceType:y(u)},i&~p,u.buttons&~p),t.handleMouseUp(u),i=u.buttons;break}}},t.handlePointerCancel=u=>{if(s.has(u.pointerId))switch(s.delete(u.pointerId),u.pointerType){case"pen":case"touch":t.handleTouchEnd(u);break;default:l({...T(u),position:g(u),deviceType:y(u)},i,0),i=0;break}},t.handlePointerMove=u=>{if(s.has(u.pointerId)){const p=s.get(u.pointerId);p.position=g(u)}switch(u.pointerType){case"pen":case"touch":t.handleTouchMove(u);break;default:{const p=u.buttons;p!==i&&(l({...T(u),position:g(u),deviceType:y(u)},i,p),i=p),t.handleMouseMove(u);break}}},t.handleMouseDown=u=>{const p={...T(u),position:g(u),deviceType:y(u)};switch(u.button){case 0:t.leftButtonPressEvent(p);break;case 1:t.middleButtonPressEvent(p);break;case 2:t.rightButtonPressEvent(p);break;default:$t(`Unknown mouse button pressed: ${u.button}`);break}},t.requestPointerLock=()=>{if(e.container)return e.container.requestPointerLock()},t.exitPointerLock=()=>document.exitPointerLock?.(),t.isPointerLocked=()=>!!e.container&&document.pointerLockElement===e.container,t.handlePointerLockChange=()=>{t.isPointerLocked()?t.startPointerLockEvent():t.endPointerLockEvent()};function x(){e._view&&e.enabled&&e.enableRender&&(e.inRender=!0,e._view.traverseAllPasses(),e.inRender=!1),t.invokeRenderEvent()}t.requestAnimation=u=>{if(u===void 0){$t("undefined requester, can not start animating");return}if(r.has(u)){kt("requester is already registered for animating");return}r.add(u),!e.animationRequest&&r.size===1&&!e.xrAnimation&&(e._animationStartTime=Date.now(),e._animationFrameCount=0,e.animationRequest=requestAnimationFrame(t.handleAnimation),t.startAnimationEvent())},t.extendAnimation=u=>{const p=Date.now()+u;e._animationExtendedEnd=Math.max(e._animationExtendedEnd,p),!e.animationRequest&&r.size===0&&!e.xrAnimation&&(e._animationStartTime=Date.now(),e._animationFrameCount=0,e.animationRequest=requestAnimationFrame(t.handleAnimation),t.startAnimationEvent())},t.isAnimating=()=>e.xrAnimation||e.animationRequest!==null,t.cancelAnimation=(u,p=!1)=>{if(!r.has(u)){p||kt(`${u&&u.getClassName?u.getClassName():u} did not request an animation`);return}r.delete(u),e.animationRequest&&r.size===0&&Date.now()>e._animationExtendedEnd&&(cancelAnimationFrame(e.animationRequest),e.animationRequest=null,t.endAnimationEvent(),t.render())},t.switchToXRAnimation=()=>{e.animationRequest&&(cancelAnimationFrame(e.animationRequest),e.animationRequest=null),e.xrAnimation=!0},t.returnFromXRAnimation=()=>{e.xrAnimation=!1,r.size!==0&&(e.recentAnimationFrameRate=10,e.animationRequest=requestAnimationFrame(t.handleAnimation))},t.updateXRGamepads=(u,p,h)=>{u.inputSources.forEach(v=>{const E=v.gripSpace==null?null:p.getPose(v.gripSpace,h),S=v.gripSpace==null?null:p.getPose(v.targetRaySpace,h),_=v.gamepad,d=v.handedness;if(_){_.index in e.lastGamepadValues||(e.lastGamepadValues[_.index]={left:{buttons:{}},right:{buttons:{}},none:{buttons:{}}});for(let L=0;L<_.buttons.length;++L)L in e.lastGamepadValues[_.index][d].buttons||(e.lastGamepadValues[_.index][d].buttons[L]=!1),e.lastGamepadValues[_.index][d].buttons[L]!==_.buttons[L].pressed&&E!=null&&(t.button3DEvent({gamepad:_,position:E.transform.position,orientation:E.transform.orientation,targetPosition:S.transform.position,targetOrientation:S.transform.orientation,pressed:_.buttons[L].pressed,device:v.handedness==="left"?Vt.LeftController:Vt.RightController,input:wn[_.mapping]&&wn[_.mapping][L]?wn[_.mapping][L]:Xe.Trigger}),e.lastGamepadValues[_.index][d].buttons[L]=_.buttons[L].pressed),e.lastGamepadValues[_.index][d].buttons[L]&&E!=null&&t.move3DEvent({gamepad:_,position:E.transform.position,orientation:E.transform.orientation,targetPosition:S.transform.position,targetOrientation:S.transform.orientation,device:v.handedness==="left"?Vt.LeftController:Vt.RightController})}})},t.handleMouseMove=u=>{const p={...T(u),position:g(u),deviceType:y(u)};e.moveTimeoutID===0?t.startMouseMoveEvent(p):(t.mouseMoveEvent(p),clearTimeout(e.moveTimeoutID)),e.moveTimeoutID=setTimeout(()=>{t.endMouseMoveEvent(),e.moveTimeoutID=0},200)},t.handleAnimation=()=>{const u=Date.now();e._animationFrameCount++,u-e._animationStartTime>1e3&&e._animationFrameCount>1&&(e.recentAnimationFrameRate=1e3*(e._animationFrameCount-1)/(u-e._animationStartTime),e.lastFrameTime=1/e.recentAnimationFrameRate,t.animationFrameRateUpdateEvent(),e._animationStartTime=u,e._animationFrameCount=1),t.animationEvent(),x(),r.size>0||Date.now()<e._animationExtendedEnd?e.animationRequest=requestAnimationFrame(t.handleAnimation):(cancelAnimationFrame(e.animationRequest),e.animationRequest=null,t.endAnimationEvent(),t.render())},t.handleWheel=u=>{ht(u);const p={...Xh(u),...T(u),position:g(u),deviceType:y(u)};e.wheelTimeoutID===0&&(Math.abs(p.spinY)>=.3?a=Math.abs(p.spinY):a=1),p.spinY/=a,e.wheelTimeoutID===0?(t.startMouseWheelEvent(p),t.mouseWheelEvent(p)):(t.mouseWheelEvent(p),clearTimeout(e.wheelTimeoutID)),e.mouseScrollDebounceByPass?(t.extendAnimation(600),t.endMouseWheelEvent(),e.wheelTimeoutID=0):e.wheelTimeoutID=setTimeout(()=>{t.extendAnimation(600),t.endMouseWheelEvent(),e.wheelTimeoutID=0},200)},t.handleMouseUp=u=>{const p={...T(u),position:g(u),deviceType:y(u)};switch(u.button){case 0:t.leftButtonReleaseEvent(p);break;case 1:t.middleButtonReleaseEvent(p);break;case 2:t.rightButtonReleaseEvent(p);break;default:$t(`Unknown mouse button released: ${u.button}`);break}},t.handleTouchStart=u=>{const p=[...s.values()];if(e.recognizeGestures&&p.length>1){const h=Wt(s);if(p.length===2){const v={...T(et),position:p[0].position,deviceType:y(u)};t.leftButtonReleaseEvent(v)}t.recognizeGesture("TouchStart",h)}else if(p.length===1){const h={...T(et),position:g(u),deviceType:y(u)};t.leftButtonPressEvent(h)}},t.handleTouchMove=u=>{const p=[...s.values()];if(e.recognizeGestures&&p.length>1){const h=Wt(s);t.recognizeGesture("TouchMove",h)}else if(p.length===1){const h={...T(et),position:p[0].position,deviceType:y(u)};t.mouseMoveEvent(h)}},t.handleTouchEnd=u=>{const p=[...s.values()];if(e.recognizeGestures)if(p.length===0){const h={...T(et),position:g(u),deviceType:y(u)};t.leftButtonReleaseEvent(h)}else if(p.length===1){const h=Wt(s);t.recognizeGesture("TouchEnd",h);const v={...T(et),position:p[0].position,deviceType:y(u)};t.leftButtonPressEvent(v)}else{const h=Wt(s);t.recognizeGesture("TouchMove",h)}else if(p.length===1){const h={...T(et),position:p[0].position,deviceType:y(u)};t.leftButtonReleaseEvent(h)}},t.setView=u=>{e._view!==u&&(e._view=u,e._view.getRenderable().setInteractor(t),t.modified())},t.getFirstRenderer=()=>e._view?.getRenderable()?.getRenderersByReference()?.[0],t.findPokedRenderer=(u=0,p=0)=>{if(!e._view)return null;const h=e._view?.getRenderable()?.getRenderers();if(!h||h.length===0)return null;h.sort((d,L)=>d.getLayer()-L.getLayer());let v=null,E=null,S=null,_=h.length;for(;_--;){const d=h[_];if(e._view.isInViewport(u,p,d)&&d.getInteractive()){S=d;break}v===null&&d.getInteractive()&&(v=d),E===null&&e._view.isInViewport(u,p,d)&&(E=d)}return S===null&&(S=v),S===null&&(S=E),S==null&&(S=h[0]),S},t.render=()=>{!t.isAnimating()&&!e.inRender&&x()},nr.forEach(u=>{const p=u.charAt(0).toLowerCase()+u.slice(1);t[`${p}Event`]=h=>{if(!e.enabled)return;if(!t.getCurrentRenderer()){Kh(`
|
|
157
|
+
Can not forward events without a current renderer on the interactor.
|
|
158
|
+
`);return}const v={type:u,pokedRenderer:e.currentRenderer,firstRenderer:t.getFirstRenderer(),...h};t[`invoke${u}`](v)}}),t.recognizeGesture=(u,p)=>{if(Object.keys(p).length>2)return;if(e.startingEventPositions||(e.startingEventPositions={}),u==="TouchStart"){Object.keys(p).forEach(F=>{e.startingEventPositions[F]=p[F]}),e.currentGesture="Start";return}if(u==="TouchEnd"){e.currentGesture==="Pinch"&&(t.render(),t.endPinchEvent()),e.currentGesture==="Rotate"&&(t.render(),t.endRotateEvent()),e.currentGesture==="Pan"&&(t.render(),t.endPanEvent()),e.currentGesture="Start",e.startingEventPositions={};return}let h=0;const v=[],E=[];Object.keys(p).forEach(F=>{v[h]=p[F],E[h]=e.startingEventPositions[F],h++});const S=Math.sqrt((E[0].x-E[1].x)*(E[0].x-E[1].x)+(E[0].y-E[1].y)*(E[0].y-E[1].y)),_=Math.sqrt((v[0].x-v[1].x)*(v[0].x-v[1].x)+(v[0].y-v[1].y)*(v[0].y-v[1].y));let d=On(Math.atan2(E[1].y-E[0].y,E[1].x-E[0].x)),L=On(Math.atan2(v[1].y-v[0].y,v[1].x-v[0].x)),M=L-d;L=L+180>=360?L-180:L+180,d=d+180>=360?d-180:d+180,Math.abs(L-d)<Math.abs(M)&&(M=L-d);const D=[];if(D[0]=(v[0].x-E[0].x+v[1].x-E[1].x)/2,D[1]=(v[0].y-E[0].y+v[1].y-E[1].y)/2,u==="TouchMove")if(e.currentGesture==="Start"){let F=.01*Math.sqrt(e.container.clientWidth*e.container.clientWidth+e.container.clientHeight*e.container.clientHeight);F<15&&(F=15);const N=Math.abs(_-S),U=_*3.1415926*Math.abs(M)/360,W=Math.sqrt(D[0]*D[0]+D[1]*D[1]);if(N>F&&N>U&&N>W){e.currentGesture="Pinch";const V={scale:1,touches:p};t.startPinchEvent(V)}else if(U>F&&U>W){e.currentGesture="Rotate";const V={rotation:0,touches:p};t.startRotateEvent(V)}else if(W>F){e.currentGesture="Pan";const V={translation:[0,0],touches:p};t.startPanEvent(V)}}else{if(e.currentGesture==="Rotate"){const F={rotation:M,touches:p};t.rotateEvent(F)}if(e.currentGesture==="Pinch"){const F={scale:_/S,touches:p};t.pinchEvent(F)}if(e.currentGesture==="Pan"){const F={translation:D,touches:p};t.panEvent(F)}}},t.handleVisibilityChange=()=>{e._animationStartTime=Date.now(),e._animationFrameCount=0},t.setCurrentRenderer=u=>{e._forcedRenderer=!!u,e.currentRenderer=u},t.setContainer=u=>{R();const p=n.setContainer(u??null);return p&&w(),p},t.delete=()=>{for(;r.size;)t.cancelAnimation(r.values().next().value);typeof document.hidden<"u"&&document.removeEventListener("visibilitychange",t.handleVisibilityChange),e.container&&t.setContainer(null),n.delete()},typeof document.hidden<"u"&&document.addEventListener("visibilitychange",t.handleVisibilityChange,!1)}var Zh={renderWindow:null,interactorStyle:null,picker:null,pickingManager:null,initialized:!1,enabled:!1,enableRender:!0,currentRenderer:null,lightFollowCamera:!0,desiredUpdateRate:30,stillUpdateRate:2,container:null,recognizeGestures:!0,currentGesture:"Start",animationRequest:null,lastFrameTime:.1,recentAnimationFrameRate:10,wheelTimeoutID:0,moveTimeoutID:0,lastGamepadValues:{},preventDefaultOnPointerDown:!1,preventDefaultOnPointerUp:!1,mouseScrollDebounceByPass:!1};function As(t,e,n={}){Object.assign(e,Zh,n),C.obj(t,e),e._animationExtendedEnd=0,C.event(t,e,"RenderEvent"),nr.forEach(r=>C.event(t,e,r)),C.get(t,e,["initialized","interactorStyle","lastFrameTime","recentAnimationFrameRate","_view"]),C.setGet(t,e,["container","lightFollowCamera","enabled","enableRender","recognizeGestures","desiredUpdateRate","stillUpdateRate","picker","preventDefaultOnPointerDown","preventDefaultOnPointerUp","mouseScrollDebounceByPass"]),C.moveToProtected(t,e,["view"]),Yh(t,e)}var Qh=C.newInstance(As,"vtkRenderWindowInteractor"),Xp={newInstance:Qh,extend:As,handledEvents:nr,...qs};function Jh(t,e){e.classHierarchy.push("vtkActor");const n={...t};t.getActors=()=>[t],t.getIsOpaque=()=>{if(e.forceOpaque)return!0;if(e.forceTranslucent)return!1;e.properties[0]||t.getProperty();let r=e.properties[0].getOpacity()>=1;return r=r&&(!e.texture||!e.texture.isTranslucent()),r=r&&(!e.mapper||e.mapper.getIsOpaque()),r},t.hasTranslucentPolygonalGeometry=()=>e.mapper===null?!1:(e.properties[0]||t.getProperty(),!t.getIsOpaque()),t.makeProperty=mn.newInstance,t.getMTime=()=>{let r=n.getMTime();if(e.backfaceProperty!==null){const s=e.backfaceProperty.getMTime();r=s>r?s:r}return r},t.getRedrawMTime=()=>{let r=e.mtime;if(e.mapper!==null){let s=e.mapper.getMTime();r=s>r?s:r,e.mapper.getInput()!==null&&(e.mapper.getInputAlgorithm().update(),s=e.mapper.getInput().getMTime(),r=s>r?s:r)}return r},t.getSupportsSelection=()=>e.mapper?e.mapper.getSupportsSelection():!1,t.processSelectorPixelBuffers=(r,s)=>{e.mapper&&e.mapper.processSelectorPixelBuffers&&e.mapper.processSelectorPixelBuffers(r,s)}}var qh={mapper:null,backfaceProperty:null,forceOpaque:!1,forceTranslucent:!1};function bs(t,e,n={}){Object.assign(e,qh,n),qn.extend(t,e,n),e.boundsMTime={},C.obj(e.boundsMTime),C.setGet(t,e,["backfaceProperty","forceOpaque","forceTranslucent","mapper"]),Jh(t,e)}var Ah=C.newInstance(bs,"vtkActor"),Kp={newInstance:Ah,extend:bs},{BlendMode:Ge}=Vi;function bh(t,e,n,r,s){let a=null;return s?(a=s,a.removeAllPoints()):a=Gn.newInstance(),a.addPointLong(-1024,0,1,1),a.addPoint(t,e),a.addPoint(n,r),a}var Ih=["getAnisotropy","getComputeNormalFromOpacity","getFilterMode","getFilterModeAsString","getGlobalIlluminationReach","getIpScalarRange","getIpScalarRangeByReference","getLAOKernelRadius","getLAOKernelSize","getLocalAmbientOcclusion","getPreferSizeOverAccuracy","getVolumetricScatteringBlending","setAnisotropy","setAverageIPScalarRange","setComputeNormalFromOpacity","setFilterMode","setFilterModeToNormalized","setFilterModeToOff","setFilterModeToRaw","setGlobalIlluminationReach","setIpScalarRange","setIpScalarRangeFrom","setLAOKernelRadius","setLAOKernelSize","setLocalAmbientOcclusion","setPreferSizeOverAccuracy","setVolumetricScatteringBlending"],mh={createRadonTransferFunction:bh};function Ph(t,e){e.classHierarchy.push("vtkVolumeMapper");const n={...t};t.computeBounds=()=>{const r=t.getInputData();if(!r){Y.reset(e.bounds);return}e.static||t.update(),Y.setBounds(e.bounds,r.getBounds())},t.setBlendModeToComposite=()=>{t.setBlendMode(Ge.COMPOSITE_BLEND)},t.setBlendModeToMaximumIntensity=()=>{t.setBlendMode(Ge.MAXIMUM_INTENSITY_BLEND)},t.setBlendModeToMinimumIntensity=()=>{t.setBlendMode(Ge.MINIMUM_INTENSITY_BLEND)},t.setBlendModeToAverageIntensity=()=>{t.setBlendMode(Ge.AVERAGE_INTENSITY_BLEND)},t.setBlendModeToAdditiveIntensity=()=>{t.setBlendMode(Ge.ADDITIVE_INTENSITY_BLEND)},t.setBlendModeToRadonTransform=()=>{t.setBlendMode(Ge.RADON_TRANSFORM_BLEND)},t.getBlendModeAsString=()=>C.enumToString(Ge,e.blendMode),t.setVolumeShadowSamplingDistFactor=r=>n.setVolumeShadowSamplingDistFactor(r>=1?r:1),Ih.forEach(r=>{const s=()=>{throw new Error(`The method "volumeMapper.${r}()" doesn't exist anymore. It is a rendering property that has been moved to the volume property. Replace your code with:
|
|
159
|
+
volumeActor.getProperty().${r}()
|
|
160
|
+
`)};t[r]=s})}var ep=t=>({bounds:[...Y.INIT_BOUNDS],sampleDistance:1,imageSampleDistance:1,maximumSamplesPerRay:1e3,autoAdjustSampleDistances:!0,initialInteractionScale:1,interactionSampleDistanceFactor:1,blendMode:Ge.COMPOSITE_BLEND,volumeShadowSamplingDistFactor:5,colorTextureWidth:1024,opacityTextureWidth:1024,labelOutlineTextureWidth:1024,...t});function Is(t,e,n={}){Object.assign(e,ep(n)),Jn.extend(t,e,n),C.setGet(t,e,["sampleDistance","imageSampleDistance","maximumSamplesPerRay","autoAdjustSampleDistances","initialInteractionScale","interactionSampleDistanceFactor","blendMode","volumeShadowSamplingDistFactor","colorTextureWidth","opacityTextureWidth","labelOutlineTextureWidth"]),C.event(t,e,"lightingActivated"),Ph(t,e)}var tp=C.newInstance(Is,"vtkVolumeMapper"),Yp={newInstance:tp,extend:Is,...mh},{InterpolationType:yt,OpacityMode:np,FilterMode:lt,ColorMixPreset:rp}=cs,{vtkErrorMacro:dn}=C,qt=4;function ap(t,e){e.classHierarchy.push("vtkVolumeProperty");const n={...t};t.getMTime=()=>{let r=e.mtime,s;for(let a=0;a<qt;a++)e.componentData[a].colorChannels===1?e.componentData[a].grayTransferFunction&&(s=e.componentData[a].grayTransferFunction.getMTime(),r=r>s?r:s):e.componentData[a].colorChannels===3&&e.componentData[a].rGBTransferFunction&&(s=e.componentData[a].rGBTransferFunction.getMTime(),r=r>s?r:s),e.componentData[a].scalarOpacity&&(s=e.componentData[a].scalarOpacity.getMTime(),r=r>s?r:s),e.componentData[a].gradientOpacity&&(e.componentData[a].disableGradientOpacity||(s=e.componentData[a].gradientOpacity.getMTime(),r=r>s?r:s));return r},t.getColorChannels=r=>r<0||r>3?(dn("Bad index - must be between 0 and 3"),0):e.componentData[r].colorChannels,t.setGrayTransferFunction=(r=0,s=null)=>{let a=!1;return e.componentData[r].grayTransferFunction!==s&&(e.componentData[r].grayTransferFunction=s,a=!0),e.componentData[r].colorChannels!==1&&(e.componentData[r].colorChannels=1,a=!0),a&&t.modified(),a},t.getGrayTransferFunction=(r=0)=>(e.componentData[r].grayTransferFunction===null&&(e.componentData[r].grayTransferFunction=Gn.newInstance(),e.componentData[r].grayTransferFunction.addPoint(0,0),e.componentData[r].grayTransferFunction.addPoint(1024,1),e.componentData[r].colorChannels!==1&&(e.componentData[r].colorChannels=1),t.modified()),e.componentData[r].grayTransferFunction),t.setRGBTransferFunction=(r=0,s=null)=>{let a=!1;return e.componentData[r].rGBTransferFunction!==s&&(e.componentData[r].rGBTransferFunction=s,a=!0),e.componentData[r].colorChannels!==3&&(e.componentData[r].colorChannels=3,a=!0),a&&t.modified(),a},t.getRGBTransferFunction=(r=0)=>(e.componentData[r].rGBTransferFunction===null&&(e.componentData[r].rGBTransferFunction=so.newInstance(),e.componentData[r].rGBTransferFunction.addRGBPoint(0,0,0,0),e.componentData[r].rGBTransferFunction.addRGBPoint(1024,1,1,1),e.componentData[r].colorChannels!==3&&(e.componentData[r].colorChannels=3),t.modified()),e.componentData[r].rGBTransferFunction),t.setScalarOpacity=(r=0,s=null)=>e.componentData[r].scalarOpacity!==s?(e.componentData[r].scalarOpacity=s,t.modified(),!0):!1,t.getScalarOpacity=(r=0)=>(e.componentData[r].scalarOpacity===null&&(e.componentData[r].scalarOpacity=Gn.newInstance(),e.componentData[r].scalarOpacity.addPoint(0,1),e.componentData[r].scalarOpacity.addPoint(1024,1),t.modified()),e.componentData[r].scalarOpacity),t.setComponentWeight=(r=0,s=1)=>{if(r<0||r>=qt)return dn("Invalid index"),!1;const a=Math.min(1,Math.max(0,s));return e.componentData[r].componentWeight!==a?(e.componentData[r].componentWeight=a,t.modified(),!0):!1},t.getComponentWeight=(r=0)=>r<0||r>=qt?(dn("Invalid index"),0):e.componentData[r].componentWeight,t.setInterpolationTypeToNearest=()=>t.setInterpolationType(yt.NEAREST),t.setInterpolationTypeToLinear=()=>t.setInterpolationType(yt.LINEAR),t.setInterpolationTypeToFastLinear=()=>t.setInterpolationType(yt.FAST_LINEAR),t.getInterpolationTypeAsString=()=>C.enumToString(yt,e.interpolationType),["useGradientOpacity","scalarOpacityUnitDistance","gradientOpacityMinimumValue","gradientOpacityMinimumOpacity","gradientOpacityMaximumValue","gradientOpacityMaximumOpacity","opacityMode","forceNearestInterpolation"].forEach(r=>{const s=C.capitalize(r);t[`set${s}`]=(a,i)=>e.componentData[a][`${r}`]!==i?(e.componentData[a][`${r}`]=i,t.modified(),!0):!1}),["useGradientOpacity","scalarOpacityUnitDistance","gradientOpacityMinimumValue","gradientOpacityMinimumOpacity","gradientOpacityMaximumValue","gradientOpacityMaximumOpacity","opacityMode","forceNearestInterpolation"].forEach(r=>{const s=C.capitalize(r);t[`get${s}`]=a=>e.componentData[a][`${r}`]}),t.setAverageIPScalarRange=(r,s)=>{console.warn("setAverageIPScalarRange is deprecated use setIpScalarRange"),t.setIpScalarRange(r,s)},t.getFilterModeAsString=()=>C.enumToString(lt,e.filterMode),t.setFilterModeToOff=()=>{t.setFilterMode(lt.OFF)},t.setFilterModeToNormalized=()=>{t.setFilterMode(lt.NORMALIZED)},t.setFilterModeToRaw=()=>{t.setFilterMode(lt.RAW)},t.setGlobalIlluminationReach=r=>n.setGlobalIlluminationReach(Qe(r,0,1)),t.setVolumetricScatteringBlending=r=>n.setVolumetricScatteringBlending(Qe(r,0,1)),t.setAnisotropy=r=>n.setAnisotropy(Qe(r,-.99,.99)),t.setLAOKernelSize=r=>n.setLAOKernelSize(mr(Qe(r,1,32))),t.setLAOKernelRadius=r=>n.setLAOKernelRadius(r>=1?r:1)}var sp=t=>({colorMixPreset:rp.DEFAULT,independentComponents:!0,interpolationType:yt.FAST_LINEAR,shade:!1,ambient:.1,diffuse:.7,specular:.2,specularPower:10,useLabelOutline:!1,labelOutlineThickness:[1],labelOutlineOpacity:1,ipScalarRange:[-1e6,1e6],filterMode:lt.OFF,preferSizeOverAccuracy:!1,computeNormalFromOpacity:!1,volumetricScatteringBlending:0,globalIlluminationReach:0,anisotropy:0,localAmbientOcclusion:!1,LAOKernelSize:15,LAOKernelRadius:7,updatedExtents:[],...t});function ip(t,e,n={}){if(Object.assign(e,sp(n)),C.obj(t,e),!e.componentData){e.componentData=[];for(let r=0;r<qt;++r)e.componentData.push({colorChannels:1,grayTransferFunction:null,rGBTransferFunction:null,scalarOpacity:null,scalarOpacityUnitDistance:1,opacityMode:np.FRACTIONAL,gradientOpacityMinimumValue:0,gradientOpacityMinimumOpacity:0,gradientOpacityMaximumValue:1,gradientOpacityMaximumOpacity:1,useGradientOpacity:!1,componentWeight:1,forceNearestInterpolation:!1})}C.setGet(t,e,["colorMixPreset","independentComponents","interpolationType","shade","ambient","diffuse","specular","specularPower","useLabelOutline","labelOutlineOpacity","filterMode","preferSizeOverAccuracy","computeNormalFromOpacity","volumetricScatteringBlending","globalIlluminationReach","anisotropy","localAmbientOcclusion","LAOKernelSize","LAOKernelRadius","updatedExtents"]),C.setGetArray(t,e,["ipScalarRange"],2),C.setGetArray(t,e,["labelOutlineThickness"]),ap(t,e)}var op=C.newInstance(ip,"vtkVolumeProperty"),fp={newInstance:op,...cs};function cp(t,e){e.classHierarchy.push("vtkVolume"),t.getVolumes=()=>[t],t.makeProperty=fp.newInstance,t.getRedrawMTime=()=>{let n=e.mtime;if(e.mapper!==null){let r=e.mapper.getMTime();n=r>n?r:n,e.mapper.getInput()!==null&&(e.mapper.getInputAlgorithm().update(),r=e.mapper.getInput().getMTime(),n=r>n?r:n)}return n}}var up={mapper:null};function ms(t,e,n={}){Object.assign(e,up,n),qn.extend(t,e,n),e.boundsMTime={},C.obj(e.boundsMTime),C.setGet(t,e,["mapper"]),cp(t,e)}var gp=C.newInstance(ms,"vtkVolume"),Zp={newInstance:gp,extend:ms};function hp(t,e){e.classHierarchy.push("vtkTexture"),t.imageLoaded=()=>{e.image.removeEventListener("load",t.imageLoaded),e.imageLoaded=!0,t.modified()},t.setJsImageData=n=>{e.jsImageData!==n&&(n!==null&&(t.setInputData(null),t.setInputConnection(null),e.image=null,e.canvas=null,e.imageBitmap=null),e.jsImageData=n,e.imageLoaded=!0,t.modified())},t.setImageBitmap=n=>{e.imageBitmap!==n&&(n!==null&&(t.setInputData(null),t.setInputConnection(null),e.image=null,e.canvas=null,e.jsImageData=null),e.imageBitmap=n,e.imageLoaded=!0,t.modified())},t.setCanvas=n=>{e.canvas!==n&&(n!==null&&(t.setInputData(null),t.setInputConnection(null),e.image=null,e.imageBitmap=null,e.jsImageData=null),e.canvas=n,t.modified())},t.setImage=n=>{e.image!==n&&(n!==null&&(t.setInputData(null),t.setInputConnection(null),e.canvas=null,e.jsImageData=null,e.imageBitmap=null),e.image=n,e.imageLoaded=!1,n.complete?t.imageLoaded():n.addEventListener("load",t.imageLoaded),t.modified())},t.getDimensionality=()=>{let n=0,r=0,s=1;if(t.getInputData()){const a=t.getInputData();n=a.getDimensions()[0],r=a.getDimensions()[1],s=a.getDimensions()[2]}return e.jsImageData&&(n=e.jsImageData.width,r=e.jsImageData.height),e.canvas&&(n=e.canvas.width,r=e.canvas.height),e.image&&(n=e.image.width,r=e.image.height),e.imageBitmap&&(n=e.imageBitmap.width,r=e.imageBitmap.height),(n>1)+(r>1)+(s>1)},t.getInputAsJsImageData=()=>{if(!e.imageLoaded||t.getInputData())return null;if(e.jsImageData)return e.jsImageData;if(e.imageBitmap)return e.imageBitmap;if(e.canvas)return e.canvas.getContext("2d").getImageData(0,0,e.canvas.width,e.canvas.height);if(e.image){const n=e.image.width,r=e.image.height,s=new OffscreenCanvas(n,r).getContext("2d");return s.translate(0,r),s.scale(1,-1),s.drawImage(e.image,0,0,n,r),s.getImageData(0,0,n,r)}return null}}var pp=(t,e,n)=>{const r=t.createShaderModule({code:`
|
|
161
|
+
@group(0) @binding(0) var inputTexture: texture_2d<f32>;
|
|
162
|
+
@group(0) @binding(1) var outputTexture: texture_storage_2d<rgba8unorm, write>;
|
|
163
|
+
|
|
164
|
+
@compute @workgroup_size(8, 8)
|
|
165
|
+
fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
|
|
166
|
+
let texelCoord = vec2<i32>(global_id.xy);
|
|
167
|
+
let outputSize = textureDimensions(outputTexture);
|
|
168
|
+
|
|
169
|
+
if (texelCoord.x >= i32(outputSize.x) || texelCoord.y >= i32(outputSize.y)) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
let inputSize = textureDimensions(inputTexture);
|
|
174
|
+
let scale = vec2<f32>(inputSize) / vec2<f32>(outputSize);
|
|
175
|
+
|
|
176
|
+
// Compute the floating-point source coordinate
|
|
177
|
+
let srcCoord = (vec2<f32>(texelCoord) + 0.5) * scale - 0.5;
|
|
178
|
+
|
|
179
|
+
// Get integer coordinates for the four surrounding texels
|
|
180
|
+
let x0 = i32(floor(srcCoord.x));
|
|
181
|
+
let x1 = min(x0 + 1, i32(inputSize.x) - 1);
|
|
182
|
+
let y0 = i32(floor(srcCoord.y));
|
|
183
|
+
let y1 = min(y0 + 1, i32(inputSize.y) - 1);
|
|
184
|
+
|
|
185
|
+
// Compute the weights
|
|
186
|
+
let wx = srcCoord.x - f32(x0);
|
|
187
|
+
let wy = srcCoord.y - f32(y0);
|
|
188
|
+
|
|
189
|
+
// Fetch the four texels
|
|
190
|
+
let c00 = textureLoad(inputTexture, vec2<i32>(x0, y0), 0);
|
|
191
|
+
let c10 = textureLoad(inputTexture, vec2<i32>(x1, y0), 0);
|
|
192
|
+
let c01 = textureLoad(inputTexture, vec2<i32>(x0, y1), 0);
|
|
193
|
+
let c11 = textureLoad(inputTexture, vec2<i32>(x1, y1), 0);
|
|
194
|
+
|
|
195
|
+
// Bilinear interpolation
|
|
196
|
+
let color = mix(
|
|
197
|
+
mix(c00, c10, wx),
|
|
198
|
+
mix(c01, c11, wx),
|
|
199
|
+
wy
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
textureStore(outputTexture, texelCoord, color);
|
|
203
|
+
}
|
|
204
|
+
`}),s=t.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.COMPUTE,texture:{sampleType:"float"}},{binding:1,visibility:GPUShaderStage.COMPUTE,storageTexture:{format:"rgba8unorm",access:"write-only"}},{binding:2,visibility:GPUShaderStage.COMPUTE,sampler:{type:"filtering"}}]}),a=t.createPipelineLayout({bindGroupLayouts:[s]}),i=t.createComputePipeline({label:"ComputeMipmapPipeline",layout:a,compute:{module:r,entryPoint:"main"}}),o=t.createSampler({magFilter:"linear",minFilter:"linear"});for(let c=1;c<n;c++){const g=e.createView({baseMipLevel:c-1,mipLevelCount:1}),T=e.createView({baseMipLevel:c,mipLevelCount:1}),f=t.createBindGroup({layout:i.getBindGroupLayout(0),entries:[{binding:0,resource:g},{binding:1,resource:T},{binding:2,resource:o}]}),y=t.createCommandEncoder({label:"MipmapGenerateCommandEncoder"}),w=y.beginComputePass();w.setPipeline(i),w.setBindGroup(0,f);const R=Math.max(1,e.width>>c),l=Math.max(1,e.height>>c),x=Math.ceil(R/8),u=Math.ceil(l/8);w.dispatchWorkgroups(x,u),w.end(),t.queue.submit([y.finish()])}},Tp={image:null,canvas:null,jsImageData:null,imageBitmap:null,imageLoaded:!1,repeat:!1,interpolate:!1,edgeClamp:!1,mipLevel:0,resizable:!1};function Ps(t,e,n={}){Object.assign(e,Tp,n),C.obj(t,e),C.algo(t,e,6,0),C.get(t,e,["canvas","image","jsImageData","imageBitmap","imageLoaded","resizable"]),C.setGet(t,e,["repeat","edgeClamp","interpolate","mipLevel"]),hp(t,e)}var vp=C.newInstance(Ps,"vtkTexture"),yp={generateMipmaps:pp},_n={newInstance:vp,extend:Ps,...yp};function lp(t,e){e.classHierarchy.push("vtkWebGPUTextureView"),t.create=(n,r)=>{e.texture=n,e.options=r,e.options.dimension=e.options.dimension||"2d",e.options.label=e.label,e.textureHandle=n.getHandle(),e.handle=e.textureHandle.createView(e.options),e.bindGroupLayoutEntry.texture.viewDimension=e.options.dimension;const s=se.getDetailsFromTextureFormat(e.texture.getFormat());e.bindGroupLayoutEntry.texture.sampleType=s.sampleType},t.createFromTextureHandle=(n,r)=>{e.texture=null,e.options=r,e.options.dimension=e.options.dimension||"2d",e.options.label=e.label,e.textureHandle=n,e.handle=e.textureHandle.createView(e.options),e.bindGroupLayoutEntry.texture.viewDimension=e.options.dimension;const s=se.getDetailsFromTextureFormat(r.format);e.bindGroupLayoutEntry.texture.sampleType=s.sampleType,e.bindGroupTime.modified()},t.getBindGroupEntry=()=>({resource:t.getHandle()}),t.getShaderCode=(n,r)=>{let s="f32";e.bindGroupLayoutEntry.texture.sampleType==="sint"?s="i32":e.bindGroupLayoutEntry.texture.sampleType==="uint"&&(s="u32");let a=`@binding(${n}) @group(${r}) var ${e.label}: texture_${e.options.dimension}<${s}>;`;return e.bindGroupLayoutEntry.texture.sampleType==="depth"&&(a=`@binding(${n}) @group(${r}) var ${e.label}: texture_depth_${e.options.dimension};`),a},t.addSampler=(n,r)=>{const s=v0.newInstance({label:`${e.label}Sampler`});s.create(n,r),t.setSampler(s)},t.getBindGroupTime=()=>(e.texture&&e.texture.getHandle()!==e.textureHandle&&(e.textureHandle=e.texture.getHandle(),e.handle=e.textureHandle.createView(e.options),e.bindGroupTime.modified()),e.bindGroupTime),t.getHandle=()=>(e.texture&&e.texture.getHandle()!==e.textureHandle&&(e.textureHandle=e.texture.getHandle(),e.handle=e.textureHandle.createView(e.options),e.bindGroupTime.modified()),e.handle)}var xp={texture:null,handle:null,sampler:null,label:null};function ei(t,e,n={}){Object.assign(e,xp,n),C.obj(t,e),e.bindGroupLayoutEntry={visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d"}},e.bindGroupTime={},C.obj(e.bindGroupTime,{mtime:0}),C.get(t,e,["bindGroupTime","texture"]),C.setGet(t,e,["bindGroupLayoutEntry","label","sampler"]),lp(t,e)}var Ep=C.newInstance(ei),Sp={newInstance:Ep,extend:ei},{vtkErrorMacro:Ht}=C;function Rp(t,e){e.classHierarchy.push("vtkWebGPUTexture");const n=(a,i)=>{if(a.elementSize===2&&a.sampleType==="float")return"Uint16Array";if(a.sampleType==="sint"){if(a.elementSize===1)return"Int8Array";if(a.elementSize===2)return"Int16Array";if(a.elementSize===4)return"Int32Array"}else if(a.sampleType==="unfilterable-float"){if(a.elementSize===4)return"Float32Array"}else{if(a.elementSize===1)return"Uint8Array";if(a.elementSize===2)return"Uint16Array";if(a.elementSize===4)return"Uint32Array"}return i},r=(a,i,o,c)=>{const g=se.getDetailsFromTextureFormat(e.format),T=i*g.numComponents,f=T*o*c,y=g.elementSize===2&&g.sampleType==="float";if(!a?.length&&f>0)return Ht("Texture upload failed: missing nativeArray data."),null;if(a.length<f)return Ht(`Texture upload failed: expected ${f} values but received ${a.length}.`),null;const w=a.length>f?a.subarray(0,f):a,R=w.BYTES_PER_ELEMENT||g.elementSize,l=i*g.stride,x=256*Math.floor((l+255)/256),u=n(g,w.constructor.name),p=x/(y?2:C.newTypedArray(u,0).BYTES_PER_ELEMENT),h=T*R;if(!(y||w.constructor.name!==u||h!==x))return{data:w,bytesPerRow:x};const v=o*c,E=C.newTypedArray(u,p*v);if(y)for(let S=0;S<v;S++){const _=S*T,d=S*p;for(let L=0;L<T;L++)E[d+L]=Ze.toHalf(w[_+L])}else if(p===T)E.set(w);else for(let S=0;S<v;S++)E.set(w.subarray(S*T,(S+1)*T),S*p);return{data:E,bytesPerRow:x}},s=(a,i,o,c,g,T)=>a<0||i<0||o<0||c<=0||g<=0||T<=0?(Ht(`Texture upload failed: invalid write region origin=(${a}, ${i}, ${o}) size=(${c}, ${g}, ${T}).`),!1):a+c>e.width||i+g>e.height||o+T>e.depth?(Ht(`Texture upload failed: write region origin=(${a}, ${i}, ${o}) size=(${c}, ${g}, ${T}) exceeds texture extent=(${e.width}, ${e.height}, ${e.depth}).`),!1):!0;t.create=(a,i)=>{e.device=a,e.width=i.width,e.height=i.height,e.depth=i.depth?i.depth:1,i.dimension?e.dimension=i.dimension:e.dimension=e.depth===1?"2d":"3d",e.format=i.format?i.format:"rgba8unorm",e.mipLevel=i.mipLevel?i.mipLevel:0,e.usage=i.usage?i.usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,e.handle=e.device.getHandle().createTexture({size:[e.width,e.height,e.depth],format:e.format,usage:e.usage,label:e.label,dimension:e.dimension,mipLevelCount:e.mipLevel+1})},t.assignFromHandle=(a,i,o)=>{e.device=a,e.handle=i,e.width=o.width,e.height=o.height,e.depth=o.depth?o.depth:1,o.dimension?e.dimension=o.dimension:e.dimension=e.depth===1?"2d":"3d",e.format=o.format?o.format:"rgba8unorm",e.usage=o.usage?o.usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST},t.writeImageData=a=>{let i=[];const o=w=>{const R=a.originZ??0,l=a.depth??1;e.device.getHandle().queue.copyExternalImageToTexture({source:w,flipY:a.flip},{texture:e.handle,premultipliedAlpha:!0,mipLevel:0,origin:{x:0,y:0,z:R}},[w.width,w.height,l]),e.dimension==="2d"&&l===1&&e.mipLevel>0&&_n.generateMipmaps(e.device.getHandle(),e.handle,e.mipLevel+1),e.ready=!0};if(a.canvas){o(a.canvas);return}if(a.imageBitmap){a.width=a.imageBitmap.width,a.height=a.imageBitmap.height,a.depth=1,a.format="rgba8unorm",a.flip=!0,o(a.imageBitmap);return}if(a.jsImageData){a.width=a.jsImageData.width,a.height=a.jsImageData.height,a.depth=1,a.format="rgba8unorm",a.flip=!0,o(a.jsImageData);return}if(a.image){a.width=a.image.width,a.height=a.image.height,a.depth=1,a.format="rgba8unorm",a.flip=!0,o(a.image);return}a.nativeArray&&(i=a.nativeArray);const c=a.width??e.width,g=a.height??e.height,T=a.depth??1,f=r(i,c,g,T);if(!f)return;const y=f.data;e.device.getHandle().queue.writeTexture({texture:e.handle,mipLevel:0,origin:{x:0,y:0,z:a.originZ??0}},y,{offset:0,bytesPerRow:f.bytesPerRow,rowsPerImage:g},{width:c,height:g,depthOrArrayLayers:T}),e.dimension==="2d"&&T===1&&e.mipLevel>0&&_n.generateMipmaps(e.device.getHandle(),e.handle,e.mipLevel+1),e.ready=!0},t.writeSubImageData=a=>{const i=a.x??0,o=a.y??0,c=a.z??0,g=a.width??e.width-i,T=a.height??e.height-o,f=a.depth??e.depth-c,y=a.nativeArray||[];if(!s(i,o,c,g,T,f))return;const w=r(y,g,T,f);w&&(e.device.getHandle().queue.writeTexture({texture:e.handle,mipLevel:0,origin:{x:i,y:o,z:c}},w.data,{offset:0,bytesPerRow:w.bytesPerRow,rowsPerImage:T},{width:g,height:T,depthOrArrayLayers:f}),t.getDimensionality()!==3&&e.mipLevel>0&&_n.generateMipmaps(e.device.getHandle(),e.handle,e.mipLevel+1),e.ready=!0)},t.getScale=()=>{const a=se.getDetailsFromTextureFormat(e.format);return a.elementSize===2&&a.sampleType==="float"?1:255},t.getNumberOfComponents=()=>se.getDetailsFromTextureFormat(e.format).numComponents,t.getDimensionality=()=>{let a=0;return e.width>1&&a++,e.height>1&&a++,e.depth>1&&a++,a},t.resizeToMatch=a=>{(a.getWidth()!==e.width||a.getHeight()!==e.height||a.getDepth()!==e.depth)&&(e.width=a.getWidth(),e.height=a.getHeight(),e.depth=a.getDepth(),e.handle=e.device.getHandle().createTexture({size:[e.width,e.height,e.depth],dimension:e.dimension,format:e.format,usage:e.usage,label:e.label}))},t.resize=(a,i,o=1)=>{(a!==e.width||i!==e.height||o!==e.depth)&&(e.width=a,e.height=i,e.depth=o,e.handle=e.device.getHandle().createTexture({size:[e.width,e.height,e.depth],dimension:e.dimension,format:e.format,usage:e.usage,label:e.label}))},t.createView=(a,i={})=>{i.dimension||(e.dimension==="3d"?i.dimension="3d":e.depth===1?i.dimension="2d":i.dimension="2d-array");const o=Sp.newInstance({label:a});return o.create(t,i),o}}var Cp={device:null,dimension:"2d",handle:null,buffer:null,ready:!1,label:null};function ti(t,e,n={}){Object.assign(e,Cp,n),C.obj(t,e),C.get(t,e,["dimension","handle","ready","width","height","depth","format","usage"]),C.setGet(t,e,["device","label"]),Rp(t,e)}var wp=C.newInstance(ti),Qp={newInstance:wp,extend:ti};export{v0 as $,Kp as A,Ui as B,so as C,Np as D,Up as E,bn as F,Lp as G,oc as H,Mp as I,kp as J,Ce as K,te as L,zp as M,Vp as N,Zu as O,Gn as P,Nu as Q,jp as R,ae as S,_n as T,Gp as U,Ga as V,of as W,$p as X,fg as Y,Gg as Z,Cs as _,Op as a,Wg as a0,$g as a1,mn as a2,je as a3,jo as a4,Va as a5,Hs as a6,Yf as a7,Zf as a8,Be as a9,xt as aa,wa as ab,Hp as ac,Wp as ad,Xp as ae,sn as af,Do as ag,Yp as ah,Zp as ai,Yn as aj,se as ak,Qp as al,Wh as am,Hh as an,Sp as ao,Fs as ap,B0 as aq,kn as ar,Ls as as,eh as at,Bp as au,Ze as av,jh as aw,Dp as b,Dr as c,en as d,Z as e,Jc as f,er as g,su as h,Vi as i,Hi as j,In as k,st as l,Rc as m,An as n,be as o,ua as p,Yt as q,_a as r,Qo as s,Ke as t,Un as u,qe as v,jn as w,Qu as x,Yu as y,Fp as z};
|