@arcgis/core 4.22.0-next.20211207 → 4.22.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.
Files changed (36) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{44ccee36f8c74f4f134e.js → 025df54bafc05c183182.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{23af0b02208e20d5c07e.js → 22c0032451a4e1d43167.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{fd874267d81bc0b2be50.js → 5915752b754997630665.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{f3da8b797c8e1fcb1c21.js → 63161320a58a0b1702a2.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{96a62dc1e07f3ef20a30.js → 67482a0c298e41ea47f5.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{52aa3b44bddb10caa343.js → 753846665158c1c321ee.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{8bc4ea821be16a752226.js → 764126387018aa548f58.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{bc0b85bc1e5116836ba4.js → 79ddc2e92f0f057f6be3.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{b1e7e0ee0fc8d3ba7c3c.js → 8150ec4b80adcf5fca86.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{6210b23872c362f51b12.js → 89d1c5f6ed167515ad24.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{4417dfcb2ba50ac9f199.js → 8ac288ac3ff8e61b98c4.js} +1 -1
  13. package/assets/esri/core/workers/chunks/95b085ff097005995ced.js +1 -0
  14. package/assets/esri/core/workers/chunks/{6e736a6717e09bf6c1fc.js → ab635e54fda321961683.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{9d66ca0feda89e902494.js → c32a849111ae061ae194.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{6a1ce00bcb689ea95bcb.js → dab0bfa26073cf325e08.js} +1 -1
  17. package/chunks/Clouds.glsl.js +4 -4
  18. package/config.js +1 -1
  19. package/interfaces.d.ts +133 -6
  20. package/package.json +1 -1
  21. package/renderers/VectorFieldRenderer.js +1 -1
  22. package/renderers/support/RasterSymbolizer.js +1 -1
  23. package/renderers/support/rasterRendererHelper.js +1 -1
  24. package/support/revision.js +1 -1
  25. package/views/2d/MapViewConstraints.js +1 -1
  26. package/views/2d/constraints/ZoomConstraint.js +1 -1
  27. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  28. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  29. package/views/3d/environment/Clouds.glsl.js +1 -1
  30. package/views/3d/environment/CloudsGenerator.js +1 -1
  31. package/views/3d/environment/NoiseTextureAtlas.js +1 -1
  32. package/views/MapView.js +1 -1
  33. package/views/webgl/Program.js +1 -1
  34. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  35. package/widgets/UtilityNetworkTrace.js +1 -1
  36. package/assets/esri/core/workers/chunks/26a4a4762a635109383f.js +0 -1
@@ -156,7 +156,7 @@
156
156
  gl_FragColor = highlightSlice(vec4(shadedColor, opacity_), vpos);
157
157
  ${e.OITEnabled?"gl_FragColor = premultiplyAlpha(gl_FragColor);":""}
158
158
  }
159
- `)),t.include(m.s,e),t}const P=Object.freeze({__proto__:null,build:A})},21787:(e,t,r)=>{r.d(t,{a:()=>s,f:()=>o,i:()=>c,t:()=>n});var i=r(46851);function o(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}function n(e,t){if(e===t){const r=t[1],i=t[2],o=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=i,e[7]=o}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function a(e,t,r){const i=t[0],o=t[1],n=t[2],a=t[3],s=t[4],l=t[5],c=t[6],d=t[7],u=t[8],h=r[0],f=r[1],m=r[2],p=r[3],g=r[4],v=r[5],x=r[6],_=r[7],b=r[8];return e[0]=h*i+f*a+m*c,e[1]=h*o+f*s+m*d,e[2]=h*n+f*l+m*u,e[3]=p*i+g*a+v*c,e[4]=p*o+g*s+v*d,e[5]=p*n+g*l+v*u,e[6]=x*i+_*a+b*c,e[7]=x*o+_*s+b*d,e[8]=x*n+_*l+b*u,e}function s(e,t){const r=t[0],i=t[1],o=t[2],n=t[3],a=t[4],s=t[5],l=t[6],c=t[7],d=t[8],u=t[9],h=t[10],f=t[11],m=t[12],p=t[13],g=t[14],v=t[15],x=r*s-i*a,_=r*l-o*a,b=r*c-n*a,T=i*l-o*s,y=i*c-n*s,M=o*c-n*l,w=d*p-u*m,S=d*g-h*m,C=d*v-f*m,A=u*g-h*p,P=u*v-f*p,F=h*v-f*g;let E=x*F-_*P+b*A+T*C-y*S+M*w;return E?(E=1/E,e[0]=(s*F-l*P+c*A)*E,e[1]=(l*C-a*F-c*S)*E,e[2]=(a*P-s*C+c*w)*E,e[3]=(o*P-i*F-n*A)*E,e[4]=(r*F-o*C+n*S)*E,e[5]=(i*C-r*P-n*w)*E,e[6]=(p*M-g*y+v*T)*E,e[7]=(g*b-m*M-v*_)*E,e[8]=(m*y-p*b+v*x)*E,e):null}function l(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e}function c(e){const t=i.E,r=e[0],o=e[1],n=e[2],a=e[3],s=e[4],l=e[5],c=e[6],d=e[7],u=e[8];return Math.abs(1-(r*r+a*a+c*c))<=t&&Math.abs(1-(o*o+s*s+d*d))<=t&&Math.abs(1-(n*n+l*l+u*u))<=t}const d=a,u=l;Object.freeze({__proto__:null,fromMat4:o,copy:function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},set:function(e,t,r,i,o,n,a,s,l,c){return e[0]=t,e[1]=r,e[2]=i,e[3]=o,e[4]=n,e[5]=a,e[6]=s,e[7]=l,e[8]=c,e},identity:function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},transpose:n,invert:function(e,t){const r=t[0],i=t[1],o=t[2],n=t[3],a=t[4],s=t[5],l=t[6],c=t[7],d=t[8],u=d*a-s*c,h=-d*n+s*l,f=c*n-a*l;let m=r*u+i*h+o*f;return m?(m=1/m,e[0]=u*m,e[1]=(-d*i+o*c)*m,e[2]=(s*i-o*a)*m,e[3]=h*m,e[4]=(d*r-o*l)*m,e[5]=(-s*r+o*n)*m,e[6]=f*m,e[7]=(-c*r+i*l)*m,e[8]=(a*r-i*n)*m,e):null},adjoint:function(e,t){const r=t[0],i=t[1],o=t[2],n=t[3],a=t[4],s=t[5],l=t[6],c=t[7],d=t[8];return e[0]=a*d-s*c,e[1]=o*c-i*d,e[2]=i*s-o*a,e[3]=s*l-n*d,e[4]=r*d-o*l,e[5]=o*n-r*s,e[6]=n*c-a*l,e[7]=i*l-r*c,e[8]=r*a-i*n,e},determinant:function(e){const t=e[0],r=e[1],i=e[2],o=e[3],n=e[4],a=e[5],s=e[6],l=e[7],c=e[8];return t*(c*n-a*l)+r*(-c*o+a*s)+i*(l*o-n*s)},multiply:a,translate:function(e,t,r){const i=t[0],o=t[1],n=t[2],a=t[3],s=t[4],l=t[5],c=t[6],d=t[7],u=t[8],h=r[0],f=r[1];return e[0]=i,e[1]=o,e[2]=n,e[3]=a,e[4]=s,e[5]=l,e[6]=h*i+f*a+c,e[7]=h*o+f*s+d,e[8]=h*n+f*l+u,e},rotate:function(e,t,r){const i=t[0],o=t[1],n=t[2],a=t[3],s=t[4],l=t[5],c=t[6],d=t[7],u=t[8],h=Math.sin(r),f=Math.cos(r);return e[0]=f*i+h*a,e[1]=f*o+h*s,e[2]=f*n+h*l,e[3]=f*a-h*i,e[4]=f*s-h*o,e[5]=f*l-h*n,e[6]=c,e[7]=d,e[8]=u,e},scale:function(e,t,r){const i=r[0],o=r[1],n=r[2];return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=o*t[3],e[4]=o*t[4],e[5]=o*t[5],e[6]=n*t[6],e[7]=n*t[7],e[8]=n*t[8],e},scaleByVec2:function(e,t,r){const i=r[0],o=r[1];return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=o*t[3],e[4]=o*t[4],e[5]=o*t[5],e},fromTranslation:function(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e},fromRotation:function(e,t){const r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=r,e[2]=0,e[3]=-r,e[4]=i,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},fromScaling:function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},fromMat2d:function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e},fromQuat:function(e,t){const r=t[0],i=t[1],o=t[2],n=t[3],a=r+r,s=i+i,l=o+o,c=r*a,d=i*a,u=i*s,h=o*a,f=o*s,m=o*l,p=n*a,g=n*s,v=n*l;return e[0]=1-u-m,e[3]=d-v,e[6]=h+g,e[1]=d+v,e[4]=1-c-m,e[7]=f-p,e[2]=h-g,e[5]=f+p,e[8]=1-c-u,e},normalFromMat4Legacy:function(e,t){const r=t[0],i=t[1],o=t[2],n=t[4],a=t[5],s=t[6],l=t[8],c=t[9],d=t[10],u=d*a-s*c,h=-d*n+s*l,f=c*n-a*l,m=r*u+i*h+o*f;if(!m)return null;const p=1/m;return e[0]=u*p,e[1]=(-d*i+o*c)*p,e[2]=(s*i-o*a)*p,e[3]=h*p,e[4]=(d*r-o*l)*p,e[5]=(-s*r+o*n)*p,e[6]=f*p,e[7]=(-c*r+i*l)*p,e[8]=(a*r-i*n)*p,e},normalFromMat4:s,projection:function(e,t,r){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/r,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e},str:function(e){return"mat3("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+")"},frob:function(e){return Math.sqrt(e[0]**2+e[1]**2+e[2]**2+e[3]**2+e[4]**2+e[5]**2+e[6]**2+e[7]**2+e[8]**2)},add:function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e},subtract:l,multiplyScalar:function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e},multiplyScalarAndAdd:function(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e[3]=t[3]+r[3]*i,e[4]=t[4]+r[4]*i,e[5]=t[5]+r[5]*i,e[6]=t[6]+r[6]*i,e[7]=t[7]+r[7]*i,e[8]=t[8]+r[8]*i,e},exactEquals:function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},equals:function(e,t){const r=e[0],o=e[1],n=e[2],a=e[3],s=e[4],l=e[5],c=e[6],d=e[7],u=e[8],h=t[0],f=t[1],m=t[2],p=t[3],g=t[4],v=t[5],x=t[6],_=t[7],b=t[8];return Math.abs(r-h)<=i.E*Math.max(1,Math.abs(r),Math.abs(h))&&Math.abs(o-f)<=i.E*Math.max(1,Math.abs(o),Math.abs(f))&&Math.abs(n-m)<=i.E*Math.max(1,Math.abs(n),Math.abs(m))&&Math.abs(a-p)<=i.E*Math.max(1,Math.abs(a),Math.abs(p))&&Math.abs(s-g)<=i.E*Math.max(1,Math.abs(s),Math.abs(g))&&Math.abs(l-v)<=i.E*Math.max(1,Math.abs(l),Math.abs(v))&&Math.abs(c-x)<=i.E*Math.max(1,Math.abs(c),Math.abs(x))&&Math.abs(d-_)<=i.E*Math.max(1,Math.abs(d),Math.abs(_))&&Math.abs(u-b)<=i.E*Math.max(1,Math.abs(u),Math.abs(b))},isOrthoNormal:c,mul:d,sub:u})},46521:(e,t,r)=>{function i(){return[1,0,0,0,1,0,0,0,1]}function o(e,t){return new Float64Array(e,t,9)}r.d(t,{a:()=>o,c:()=>i}),Object.freeze({__proto__:null,create:i,clone:function(e){return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},fromValues:function(e,t,r,i,o,n,a,s,l){return[e,t,r,i,o,n,a,s,l]},createView:o})},13598:(e,t,r)=>{function i(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function o(e){return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]}function n(e,t){return new Float64Array(e,t,16)}r.d(t,{I:()=>a,a:()=>n,b:()=>o,c:()=>i});const a=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];Object.freeze({__proto__:null,create:i,clone:o,fromValues:function(e,t,r,i,o,n,a,s,l,c,d,u,h,f,m,p){return[e,t,r,i,o,n,a,s,l,c,d,u,h,f,m,p]},createView:n,IDENTITY:a})},51305:(e,t,r)=>{r.d(t,{c:()=>f,g:()=>d,j:()=>P,k:()=>p,m:()=>u,s:()=>c});var i=r(46521),o=r(94961),n=r(65617),a=r(46851),s=r(17896),l=r(98766);function c(e,t,r){r*=.5;const i=Math.sin(r);return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=Math.cos(r),e}function d(e,t){const r=2*Math.acos(t[3]),i=Math.sin(r/2);return i>a.E?(e[0]=t[0]/i,e[1]=t[1]/i,e[2]=t[2]/i):(e[0]=1,e[1]=0,e[2]=0),r}function u(e,t,r){const i=t[0],o=t[1],n=t[2],a=t[3],s=r[0],l=r[1],c=r[2],d=r[3];return e[0]=i*d+a*s+o*c-n*l,e[1]=o*d+a*l+n*s-i*c,e[2]=n*d+a*c+i*l-o*s,e[3]=a*d-i*s-o*l-n*c,e}function h(e,t,r,i){const o=t[0],n=t[1],s=t[2],l=t[3];let c,d,u,h,f,m=r[0],p=r[1],g=r[2],v=r[3];return d=o*m+n*p+s*g+l*v,d<0&&(d=-d,m=-m,p=-p,g=-g,v=-v),1-d>a.E?(c=Math.acos(d),u=Math.sin(c),h=Math.sin((1-i)*c)/u,f=Math.sin(i*c)/u):(h=1-i,f=i),e[0]=h*o+f*m,e[1]=h*n+f*p,e[2]=h*s+f*g,e[3]=h*l+f*v,e}function f(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function m(e,t){const r=t[0]+t[4]+t[8];let i;if(r>0)i=Math.sqrt(r+1),e[3]=.5*i,i=.5/i,e[0]=(t[5]-t[7])*i,e[1]=(t[6]-t[2])*i,e[2]=(t[1]-t[3])*i;else{let r=0;t[4]>t[0]&&(r=1),t[8]>t[3*r+r]&&(r=2);const o=(r+1)%3,n=(r+2)%3;i=Math.sqrt(t[3*r+r]-t[3*o+o]-t[3*n+n]+1),e[r]=.5*i,i=.5/i,e[3]=(t[3*o+n]-t[3*n+o])*i,e[o]=(t[3*o+r]+t[3*r+o])*i,e[n]=(t[3*n+r]+t[3*r+n])*i}return e}function p(e,t,r,i){const o=.5*Math.PI/180;t*=o,r*=o,i*=o;const n=Math.sin(t),a=Math.cos(t),s=Math.sin(r),l=Math.cos(r),c=Math.sin(i),d=Math.cos(i);return e[0]=n*l*d-a*s*c,e[1]=a*s*d+n*l*c,e[2]=a*l*c-n*s*d,e[3]=a*l*d+n*s*c,e}const g=l.c,v=l.s,x=l.a,_=u,b=l.b,T=l.d,y=l.l,M=l.e,w=M,S=l.f,C=S,A=l.n,P=l.g,F=l.h,E=(0,n.c)(),D=(0,n.f)(1,0,0),O=(0,n.f)(0,1,0),R=(0,o.a)(),L=(0,o.a)(),z=(0,i.c)();Object.freeze({__proto__:null,identity:function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e},setAxisAngle:c,getAxisAngle:d,multiply:u,rotateX:function(e,t,r){r*=.5;const i=t[0],o=t[1],n=t[2],a=t[3],s=Math.sin(r),l=Math.cos(r);return e[0]=i*l+a*s,e[1]=o*l+n*s,e[2]=n*l-o*s,e[3]=a*l-i*s,e},rotateY:function(e,t,r){r*=.5;const i=t[0],o=t[1],n=t[2],a=t[3],s=Math.sin(r),l=Math.cos(r);return e[0]=i*l-n*s,e[1]=o*l+a*s,e[2]=n*l+i*s,e[3]=a*l-o*s,e},rotateZ:function(e,t,r){r*=.5;const i=t[0],o=t[1],n=t[2],a=t[3],s=Math.sin(r),l=Math.cos(r);return e[0]=i*l+o*s,e[1]=o*l-i*s,e[2]=n*l+a*s,e[3]=a*l-n*s,e},calculateW:function(e,t){const r=t[0],i=t[1],o=t[2];return e[0]=r,e[1]=i,e[2]=o,e[3]=Math.sqrt(Math.abs(1-r*r-i*i-o*o)),e},slerp:h,random:function(e){const t=(0,a.R)(),r=(0,a.R)(),i=(0,a.R)(),o=Math.sqrt(1-t),n=Math.sqrt(t);return e[0]=o*Math.sin(2*Math.PI*r),e[1]=o*Math.cos(2*Math.PI*r),e[2]=n*Math.sin(2*Math.PI*i),e[3]=n*Math.cos(2*Math.PI*i),e},invert:function(e,t){const r=t[0],i=t[1],o=t[2],n=t[3],a=r*r+i*i+o*o+n*n,s=a?1/a:0;return e[0]=-r*s,e[1]=-i*s,e[2]=-o*s,e[3]=n*s,e},conjugate:f,fromMat3:m,fromEuler:p,str:function(e){return"quat("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},copy:g,set:v,add:x,mul:_,scale:b,dot:T,lerp:y,length:M,len:w,squaredLength:S,sqrLen:C,normalize:A,exactEquals:P,equals:F,rotationTo:function(e,t,r){const i=(0,s.d)(t,r);return i<-.999999?((0,s.c)(E,D,t),(0,s.u)(E)<1e-6&&(0,s.c)(E,O,t),(0,s.n)(E,E),c(e,E,Math.PI),e):i>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):((0,s.c)(E,t,r),e[0]=E[0],e[1]=E[1],e[2]=E[2],e[3]=1+i,A(e,e))},sqlerp:function(e,t,r,i,o,n){return h(R,t,o,n),h(L,r,i,n),h(e,R,L,2*n*(1-n)),e},setAxes:function(e,t,r,i){const o=z;return o[0]=r[0],o[3]=r[1],o[6]=r[2],o[1]=i[0],o[4]=i[1],o[7]=i[2],o[2]=-t[0],o[5]=-t[1],o[8]=-t[2],A(e,m(e,o))}})},94961:(e,t,r)=>{function i(){return[0,0,0,1]}function o(e){return[e[0],e[1],e[2],e[3]]}function n(e,t){return new Float64Array(e,t,4)}r.d(t,{I:()=>a,a:()=>i,b:()=>o,c:()=>n});const a=[0,0,0,1];Object.freeze({__proto__:null,create:i,clone:o,fromValues:function(e,t,r,i){return[e,t,r,i]},createView:n,IDENTITY:a})},20773:(e,t,r)=>{r.d(t,{a:()=>n,b:()=>l,n:()=>s,s:()=>a,t:()=>o});var i=r(72220);function o(e,t,r){if(e.count!==t.count)return void i.k.error("source and destination buffers need to have the same number of elements");const o=e.count,n=r[0],a=r[1],s=r[2],l=r[4],c=r[5],d=r[6],u=r[8],h=r[9],f=r[10],m=r[12],p=r[13],g=r[14],v=e.typedBuffer,x=e.typedBufferStride,_=t.typedBuffer,b=t.typedBufferStride;for(let e=0;e<o;e++){const t=e*x,r=e*b,i=_[r],o=_[r+1],T=_[r+2];v[t]=n*i+l*o+u*T+m,v[t+1]=a*i+c*o+h*T+p,v[t+2]=s*i+d*o+f*T+g}}function n(e,t,r){if(e.count!==t.count)return void i.k.error("source and destination buffers need to have the same number of elements");const o=e.count,n=r[0],a=r[1],s=r[2],l=r[3],c=r[4],d=r[5],u=r[6],h=r[7],f=r[8],m=e.typedBuffer,p=e.typedBufferStride,g=t.typedBuffer,v=t.typedBufferStride;for(let e=0;e<o;e++){const t=e*p,r=e*v,i=g[r],o=g[r+1],x=g[r+2];m[t]=n*i+l*o+u*x,m[t+1]=a*i+c*o+h*x,m[t+2]=s*i+d*o+f*x}}function a(e,t,r){const i=Math.min(e.count,t.count),o=e.typedBuffer,n=e.typedBufferStride,a=t.typedBuffer,s=t.typedBufferStride;for(let e=0;e<i;e++){const t=e*n,i=e*s;o[t]=r*a[i],o[t+1]=r*a[i+1],o[t+2]=r*a[i+2]}}function s(e,t){const r=Math.min(e.count,t.count),i=e.typedBuffer,o=e.typedBufferStride,n=t.typedBuffer,a=t.typedBufferStride;for(let e=0;e<r;e++){const t=e*o,r=e*a,s=n[r],l=n[r+1],c=n[r+2],d=Math.sqrt(s*s+l*l+c*c);if(d>0){const e=1/d;i[t]=e*s,i[t+1]=e*l,i[t+2]=e*c}}}function l(e,t,r){const i=Math.min(e.count,t.count),o=e.typedBuffer,n=e.typedBufferStride,a=t.typedBuffer,s=t.typedBufferStride;for(let e=0;e<i;e++){const t=e*n,i=e*s;o[t]=a[i]>>r,o[t+1]=a[i+1]>>r,o[t+2]=a[i+2]>>r}}Object.freeze({__proto__:null,transformMat4:o,transformMat3:n,scale:a,normalize:s,shiftRight:l})},56067:(e,t,r)=>{function i(e,t,r){const i=e.typedBuffer,o=e.typedBufferStride,n=t.typedBuffer,a=t.typedBufferStride,s=r?r.count:t.count;let l=(r&&r.dstIndex?r.dstIndex:0)*o,c=(r&&r.srcIndex?r.srcIndex:0)*a;for(let e=0;e<s;++e)i[l]=n[c],i[l+1]=n[c+1],i[l+2]=n[c+2],l+=o,c+=a}function o(e,t,r,i,o){var n,a;const s=e.typedBuffer,l=e.typedBufferStride,c=null!=(n=null==o?void 0:o.count)?n:e.count;let d=(null!=(a=null==o?void 0:o.dstIndex)?a:0)*l;for(let e=0;e<c;++e)s[d]=t,s[d+1]=r,s[d+2]=i,d+=l}r.d(t,{c:()=>i,f:()=>o}),Object.freeze({__proto__:null,copy:i,fill:o})},72119:(e,t,r)=>{function i(){return new Float32Array(3)}function o(e,t,r){const i=new Float32Array(3);return i[0]=e,i[1]=t,i[2]=r,i}function n(){return i()}function a(){return o(1,1,1)}function s(){return o(1,0,0)}function l(){return o(0,1,0)}function c(){return o(0,0,1)}r.d(t,{c:()=>i,f:()=>o});const d=n(),u=a(),h=s(),f=l(),m=c();Object.freeze({__proto__:null,create:i,clone:function(e){const t=new Float32Array(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},fromValues:o,createView:function(e,t){return new Float32Array(e,t,3)},zeros:n,ones:a,unitX:s,unitY:l,unitZ:c,ZEROS:d,ONES:u,UNIT_X:h,UNIT_Y:f,UNIT_Z:m})},32243:(e,t,r)=>{function i(e){return e=e||globalThis.location.hostname,c.some((t=>{var r;return null!=(null==(r=e)?void 0:r.match(t))}))}function o(e,t){return e&&(t=t||globalThis.location.hostname)?null!=t.match(n)||null!=t.match(s)?e.replace("static.arcgis.com","staticdev.arcgis.com"):null!=t.match(a)||null!=t.match(l)?e.replace("static.arcgis.com","staticqa.arcgis.com"):e:e}r.d(t,{pJ:()=>o,XO:()=>i});const n=/^devext.arcgis.com$/,a=/^qaext.arcgis.com$/,s=/^[\w-]*\.mapsdevext.arcgis.com$/,l=/^[\w-]*\.mapsqa.arcgis.com$/,c=[/^([\w-]*\.)?[\w-]*\.zrh-dev-local.esri.com$/,n,a,/^jsapps.esri.com$/,s,l]},72220:(e,t,r)=>{r.d(t,{k:()=>i});const i=r(92604).Z.getLogger("esri.views.3d.support.buffer.math")},52360:(e,t,r)=>{r.r(t),r.d(t,{fetch:()=>ni,gltfToEngineResources:()=>si,parseUrl:()=>ai});var i=r(32243),o=r(70586),n=r(21787),a=r(46521),s=r(52138),l=r(13598),c=r(17896),d=r(65617),u=r(60437),h=r(56481),f=r(20773),m=r(11077),p=r(8323),g=r(40270),v=r(24952),x=r(91911),_=r(3172),b=r(66643),T=r(20102),y=r(92604),M=r(95330),w=r(23670);async function S(e,t){const{data:r}=await(0,_.default)(e,{responseType:"image",...t});return r}var C=r(44553),A=r(11726);class P{constructor(e,t,r,i){this.primitiveIndices=e,this._numIndexPerPrimitive=t,this.indices=r,this.position=i,this.center=(0,d.c)(),(0,A.hu)(e.length>=1),(0,A.hu)(r.length%this._numIndexPerPrimitive==0),(0,A.hu)(r.length>=e.length*this._numIndexPerPrimitive),(0,A.hu)(3===i.size||4===i.size);const{data:o,size:n}=i,a=e.length;let s=n*r[this._numIndexPerPrimitive*e[0]];F.clear(),F.push(s),this.bbMin=(0,d.f)(o[s],o[s+1],o[s+2]),this.bbMax=(0,d.a)(this.bbMin);for(let t=0;t<a;++t){const i=this._numIndexPerPrimitive*e[t];for(let e=0;e<this._numIndexPerPrimitive;++e){s=n*r[i+e],F.push(s);let t=o[s];this.bbMin[0]=Math.min(t,this.bbMin[0]),this.bbMax[0]=Math.max(t,this.bbMax[0]),t=o[s+1],this.bbMin[1]=Math.min(t,this.bbMin[1]),this.bbMax[1]=Math.max(t,this.bbMax[1]),t=o[s+2],this.bbMin[2]=Math.min(t,this.bbMin[2]),this.bbMax[2]=Math.max(t,this.bbMax[2])}}(0,c.e)(this.center,this.bbMin,this.bbMax,.5),this.radius=.5*Math.max(Math.max(this.bbMax[0]-this.bbMin[0],this.bbMax[1]-this.bbMin[1]),this.bbMax[2]-this.bbMin[2]);let l=this.radius*this.radius;for(let e=0;e<F.length;++e){s=F.getItemAt(e);const t=o[s]-this.center[0],r=o[s+1]-this.center[1],i=o[s+2]-this.center[2],n=t*t+r*r+i*i;if(n<=l)continue;const a=Math.sqrt(n),c=.5*(a-this.radius);this.radius=this.radius+c,l=this.radius*this.radius;const d=c/a;this.center[0]+=t*d,this.center[1]+=r*d,this.center[2]+=i*d}F.clear()}getCenter(){return this.center}getBSRadius(){return this.radius}getBBMin(){return this.bbMin}getBBMax(){return this.bbMax}getChildren(){if(this._children)return this._children;if((0,c.h)(this.bbMin,this.bbMax)>1){const e=(0,c.e)((0,d.c)(),this.bbMin,this.bbMax,.5),t=this.primitiveIndices.length,r=new Uint8Array(t),i=new Array(8);for(let e=0;e<8;++e)i[e]=0;const{data:o,size:n}=this.position;for(let a=0;a<t;++a){let t=0;const s=this._numIndexPerPrimitive*this.primitiveIndices[a];let l=n*this.indices[s],c=o[l],d=o[l+1],u=o[l+2];for(let e=1;e<this._numIndexPerPrimitive;++e){l=n*this.indices[s+e];const t=o[l],r=o[l+1],i=o[l+2];t<c&&(c=t),r<d&&(d=r),i<u&&(u=i)}c<e[0]&&(t|=1),d<e[1]&&(t|=2),u<e[2]&&(t|=4),r[a]=t,++i[t]}let a=0;for(let e=0;e<8;++e)i[e]>0&&++a;if(a<2)return;const s=new Array(8);for(let e=0;e<8;++e)s[e]=i[e]>0?new Uint32Array(i[e]):void 0;for(let e=0;e<8;++e)i[e]=0;for(let e=0;e<t;++e){const t=r[e];s[t][i[t]++]=this.primitiveIndices[e]}this._children=new Array(8);for(let e=0;e<8;++e)void 0!==s[e]&&(this._children[e]=new P(s[e],this._numIndexPerPrimitive,this.indices,this.position))}return this._children}static prune(){F.prune()}}const F=new C.Z({deallocator:null});var E=r(99001);class D{constructor(){this.id=(0,E.D)()}unload(){}}var O=r(64291);class R extends D{constructor(e,t=[],r=0,i=-1){super(),this._primitiveType=r,this.edgeIndicesLength=i,this.type=2,this._vertexAttributes=new Map,this._indices=new Map,this._boundingInfo=null;for(const[t,r]of e)r&&this._vertexAttributes.set(t,{...r});if(null==t||0===t.length){const e=function(e){const t=e.values().next().value;return null==t?0:t.data.length/t.size}(this._vertexAttributes),t=(0,O.p)(e);this.edgeIndicesLength=this.edgeIndicesLength<0?e:this.edgeIndicesLength;for(const e of this._vertexAttributes.keys())this._indices.set(e,t)}else for(const[e,r]of t)r&&(this._indices.set(e,L(r)),"position"===e&&(this.edgeIndicesLength=this.edgeIndicesLength<0?this._indices.get(e).length:this.edgeIndicesLength))}get vertexAttributes(){return this._vertexAttributes}getMutableAttribute(e){const t=this._vertexAttributes.get(e);return t&&!t.exclusive&&(t.data=Array.from(t.data),t.exclusive=!0),t}get indices(){return this._indices}get indexCount(){const e=this._indices.values().next().value;return e?e.length:0}get primitiveType(){return this._primitiveType}get faceCount(){return this.indexCount/3}get boundingInfo(){return(0,o.Wi)(this._boundingInfo)&&(this._boundingInfo=this._calculateBoundingInfo()),this._boundingInfo}computeAttachmentOrigin(e){return 0===this.primitiveType?this.computeAttachmentOriginTriangles(e):this.computeAttachmentOriginPoints(e)}computeAttachmentOriginTriangles(e){const t=this.indices.get("position"),r=this.vertexAttributes.get("position");return(0,O.cM)(r,t,e)}computeAttachmentOriginPoints(e){const t=this.indices.get("position"),r=this.vertexAttributes.get("position");return(0,O.NO)(r,t,e)}invalidateBoundingInfo(){this._boundingInfo=null}_calculateBoundingInfo(){const e=this.indices.get("position");if(0===e.length)return null;const t=0===this.primitiveType?3:1;(0,A.hu)(e.length%t==0,"Indexing error: "+e.length+" not divisible by "+t);const r=(0,O.p)(e.length/t),i=this.vertexAttributes.get("position");return new P(r,t,e,i)}}function L(e){if(e.BYTES_PER_ELEMENT===Uint16Array.BYTES_PER_ELEMENT)return e;for(const t of e)if(t>=65536)return e;return new Uint16Array(e)}var z=r(74085),H=r(32448),I=r(22021),N=r(1533),B=r(17452),U=r(85958),V=r(99880);let k;var G=r(75656);function W(e,t,r,i,o){const n=e.gl,a=e.capabilities.instancing;e.bindBuffer(r);for(const e of i){const r=t.get(e.name);void 0===r&&console.error(`There is no location for vertex attribute '${e.name}' defined.`),e.baseInstance&&!e.divisor&&console.error(`Vertex attribute '${e.name}' uses baseInstanceOffset without divisor.`);const i=(o||(0+e.baseInstance?e.baseInstance:0))*e.stride;if(e.count<=4)n.vertexAttribPointer(r,e.count,e.type,e.normalized,e.stride,e.offset+i),n.enableVertexAttribArray(r),e.divisor>0&&a&&a.vertexAttribDivisor(r,e.divisor);else if(9===e.count)for(let t=0;t<3;t++)n.vertexAttribPointer(r+t,3,e.type,e.normalized,e.stride,e.offset+12*t+i),n.enableVertexAttribArray(r+t),e.divisor>0&&a&&a.vertexAttribDivisor(r+t,e.divisor);else if(16===e.count)for(let t=0;t<4;t++)n.vertexAttribPointer(r+t,4,e.type,e.normalized,e.stride,e.offset+16*t+i),n.enableVertexAttribArray(r+t),e.divisor>0&&a&&a.vertexAttribDivisor(r+t,e.divisor);else console.error("Unsupported vertex attribute element count: "+e.count)}}function q(e,t,r,i){const o=e.gl,n=e.capabilities.instancing;e.bindBuffer(r);for(const e of i){const r=t.get(e.name);if(e.count<=4)o.disableVertexAttribArray(r),e.divisor&&e.divisor>0&&n&&n.vertexAttribDivisor(r,0);else if(9===e.count)for(let t=0;t<3;t++)o.disableVertexAttribArray(r+t),e.divisor&&e.divisor>0&&n&&n.vertexAttribDivisor(r+t,0);else if(16===e.count)for(let t=0;t<4;t++)o.disableVertexAttribArray(r+t),e.divisor&&e.divisor>0&&n&&n.vertexAttribDivisor(r+t,0);else console.error("Unsupported vertex attribute element count: "+e.count)}e.unbindBuffer(34962)}function $(e){switch(e){case 6406:case 6409:case 36168:case 33778:case 33779:case 37490:case 37491:case 37496:case 37497:return 1;case 6410:case 32854:case 33325:case 32854:case 33189:return 2;case 6407:case 6402:return 3;case 6408:case 34041:case 33326:case 35898:case 33327:case 34041:return 4;case 33328:case 34842:return 8;case 34837:return 12;case 34836:return 16;case 33776:case 33777:case 37488:case 37489:case 37492:case 37493:case 37494:case 37495:return.5}return 0}function j(e){if((0,o.Wi)(e))return 0;if("descriptor"in e)return e.glName?j(e.descriptor):0;const t=e.internalFormat||"pixelFormat"in e&&e.pixelFormat;if(!t)return 0;const r="hasMipmap"in e&&e.hasMipmap?1.3:1,i=e.width*e.height;return $(t)*i*r}r(80442);let X=null,Z=null;async function K(){return(0,o.Wi)(Z)&&(Z=function(){if((0,o.Wi)(k)){const e=e=>(0,V.V)(`esri/libs/basisu/${e}`);k=r.e(1421).then(r.bind(r,21421)).then((e=>e.b)).then((({default:t})=>t({locateFile:e}).then((e=>(e.initializeBasis(),delete e.then,e)))))}return k}(),X=await Z),Z}function Y(e,t,r,i,o){const n=$(t?37496:37492),a=o&&e>1?(4**e-1)/(3*4**(e-1)):1;return Math.ceil(r*i*n*a)}function Q(e){return e.getNumImages()>=1&&!e.isUASTC()}function J(e){return e.getFaces()>=1&&e.isETC1S()}function ee(e,t,r,i,o,n,a,s){const{compressedTextureETC:l,compressedTextureS3TC:c}=e.capabilities,[d,u]=l?i?[1,37496]:[0,37492]:c?i?[3,33779]:[2,33776]:[13,6408],h=t.hasMipmap?r:Math.min(1,r),f=[];for(let e=0;e<h;e++)f.push(new Uint8Array(a(e,d))),s(e,d,f[e]);const m=f.length>1,p=m?9987:9729,g={...t,samplingMode:p,hasMipmap:m,internalFormat:u,width:o,height:n};return new G.Z(e,g,{type:"compressed",levels:f})}const te=y.Z.getLogger("esri.views.3d.webgl-engine.lib.DDSUtil");function re(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}const ie=re("DXT1"),oe=re("DXT3"),ne=re("DXT5");const ae=new Map([["position",0],["normal",1],["uv0",2],["color",3],["size",4],["tangent",4],["auxpos1",5],["symbolColor",5],["auxpos2",6],["featureAttribute",6],["instanceFeatureAttribute",6],["instanceColor",7],["model",8],["modelNormal",12],["modelOriginHi",11],["modelOriginLo",15]]),se=[{name:"position",count:2,type:5126,offset:0,stride:8,normalized:!1}],le=[{name:"position",count:2,type:5126,offset:0,stride:16,normalized:!1},{name:"uv0",count:2,type:5126,offset:8,stride:16,normalized:!1}];var ce=r(49300),de=r(35371);const ue=y.Z.getLogger("esri.views.webgl.BufferObject");class he{constructor(e,t,r,i,o){this._context=e,this.bufferType=t,this.usage=r,this._glName=null,this._size=-1,this._indexType=void 0,e.instanceCounter.increment(de._g.Buffer,this),this._glName=this._context.gl.createBuffer(),(0,ce.zu)(this._context.gl),i&&this.setData(i,o)}static createIndex(e,t,r,i){return new he(e,34963,t,r,i)}static createVertex(e,t,r){return new he(e,34962,t,r)}get glName(){return this._glName}get size(){return this._size}get indexType(){return this._indexType}get byteSize(){return 34962===this.bufferType?this._size:5125===this._indexType?4*this._size:2*this._size}dispose(){var e;null!=(e=this._context)&&e.gl?(this._glName&&(this._context.gl.deleteBuffer(this._glName),this._glName=null),this._context.instanceCounter.decrement(de._g.Buffer,this),this._context=null):this._glName&&ue.warn("Leaked WebGL buffer object")}setData(e,t){if(!e)return;if("number"==typeof e){if(e<0&&ue.error("Buffer size cannot be negative!"),this._size=e,34963===this.bufferType&&t)switch(this._indexType=t,this._size=e,t){case 5123:e*=2;break;case 5125:e*=4}}else{let t=e.byteLength;(0,N.Uc)(e)&&(t/=2,this._indexType=5123),(0,N.ZY)(e)&&(t/=4,this._indexType=5125),this._size=t}const r=this._context.getBoundVAO();this._context.bindVAO(null),this._context.bindBuffer(this);const i=this._context.gl;i.bufferData(this.bufferType,e,this.usage),(0,ce.zu)(i),this._context.bindVAO(r)}setSubData(e,t=0,r=0,i=e.byteLength){if(!e)return;(t<0||t>=this._size)&&ue.error("offset is out of range!");let o=t,n=r,a=i,s=e.byteLength;(0,N.Uc)(e)?(s/=2,o*=2,n*=2,a*=2):(0,N.ZY)(e)&&(s/=4,o*=4,n*=4,a*=4),void 0===i&&(i=s-1),r>=i&&ue.error("end must be bigger than start!"),t+r-i>this._size&&ue.error("An attempt to write beyond the end of the buffer!");const l=this._context.getBoundVAO();this._context.bindVAO(null),this._context.bindBuffer(this);const c=this._context.gl,d=ArrayBuffer.isView(e)?e.buffer:e,u=0===n&&a===e.byteLength?d:d.slice(n,a);c.bufferSubData(this.bufferType,o,u),(0,ce.zu)(c),this._context.bindVAO(l)}setSubDataFromView(e,t,r,i){if(!e)return;(t<0||t>=this._size)&&ue.error("offset is out of range!"),r>=i&&ue.error("end must be bigger than start!"),t+r-i>this._size&&ue.error("An attempt to write beyond the end of the buffer!");const o=this._context.getBoundVAO();this._context.bindVAO(null),this._context.bindBuffer(this);const n=this._context.gl,a=0===r&&i===e.length?e:e.subarray(r,i);n.bufferSubData(this.bufferType,t*e.BYTES_PER_ELEMENT,a),(0,ce.zu)(n),this._context.bindVAO(o)}}const fe=y.Z.getLogger("esri.views.webgl.VertexArrayObject");class me{constructor(e,t,r,i,o=null){this._context=e,this._locations=t,this._layout=r,this._buffers=i,this._indexBuffer=o,this._glName=null,this._initialized=!1,e.instanceCounter.increment(de._g.VAO,this)}get glName(){return this._glName}get vertexBuffers(){return this._buffers}get indexBuffer(){return this._indexBuffer}get size(){return Object.keys(this._buffers).reduce(((e,t)=>e+this._buffers[t].size),(0,o.pC)(this._indexBuffer)?this._indexBuffer.size:0)}get layout(){return this._layout}get locations(){return this._locations}dispose(e=!0){if(this._context){if(this._glName){var t,r;const e=null==(t=this._context)||null==(r=t.capabilities)?void 0:r.vao;e?(e.deleteVertexArray(this._glName),this._glName=null):fe.warn("Leaked WebGL VAO")}if(this._context.getBoundVAO()===this&&this._context.bindVAO(null),e){for(const e in this._buffers)this._buffers[e].dispose(),delete this._buffers[e];this._indexBuffer=(0,o.O3)(this._indexBuffer)}this._context.instanceCounter.decrement(de._g.VAO,this),this._context=null}else(this._glName||e&&Object.getOwnPropertyNames(this._buffers).length>0)&&fe.warn("Leaked WebGL VAO")}initialize(){if(this._initialized)return;const e=this._context.capabilities.vao;if(e){const t=e.createVertexArray();e.bindVertexArray(t),this._bindLayout(),e.bindVertexArray(null),this._glName=t}this._initialized=!0}bind(){this.initialize();const e=this._context.capabilities.vao;e?e.bindVertexArray(this.glName):(this._context.bindVAO(null),this._bindLayout())}_bindLayout(){const{_buffers:e,_layout:t,_indexBuffer:r}=this;e||fe.error("Vertex buffer dictionary is empty!");const i=this._context.gl;for(const r in e){const i=e[r];i||fe.error("Vertex buffer is uninitialized!");const o=t[r];o||fe.error("Vertex element descriptor is empty!"),W(this._context,this._locations,i,o)}(0,o.pC)(r)&&(this._context.capabilities.vao?i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,r.glName):this._context.bindBuffer(r))}unbind(){this.initialize();const e=this._context.capabilities.vao;e?e.bindVertexArray(null):this._unbindLayout()}_unbindLayout(){const{_buffers:e,_layout:t}=this;e||fe.error("Vertex buffer dictionary is empty!");for(const r in e){const i=e[r];i||fe.error("Vertex buffer is uninitialized!");const o=t[r];q(this._context,this._locations,i,o)}(0,o.pC)(this._indexBuffer)&&this._context.unbindBuffer(this._indexBuffer.bufferType)}}class pe{constructor(e,t){this._context=e,this._desc=t,this._context.instanceCounter.increment(de._g.Renderbuffer,this);const r=this._context.gl;this.glName=r.createRenderbuffer(),this._context.bindRenderbuffer(this),r.renderbufferStorage(r.RENDERBUFFER,t.internalFormat,t.width,t.height)}get descriptor(){return this._desc}resize(e,t){const r=this._desc;if(r.width===e&&r.height===t)return;r.width=e,r.height=t;const i=this._context.gl;this._context.bindRenderbuffer(this),i.renderbufferStorage(i.RENDERBUFFER,r.internalFormat,r.width,r.height)}dispose(){this._context&&(this._context.gl.deleteRenderbuffer(this.glName),this._context.instanceCounter.decrement(de._g.Renderbuffer,this),this._context=null)}}const ge=y.Z.getLogger("esri.views.webgl.FrameBufferObject");class ve{constructor(e,t,r=null,i=null){if(this._context=e,this._glName=null,this._depthAttachment=null,this._stencilAttachment=null,this._colorAttachments=new Map,this._initialized=!1,this._desc={...t},e.instanceCounter.increment(de._g.Framebuffer,this),(0,o.pC)(r)){Array.isArray(r)||(r=[r]);for(let t=0;t<r.length;++t){var n,a;const i=r[t];let o;xe(i)?(o=i.descriptor,this._colorAttachments.set(36064+t,i)):(o=i,this._colorAttachments.set(36064+t,new G.Z(e,i))),0!==(null==(n=this._desc)?void 0:n.colorTarget)&&2!==(null==(a=this._desc)?void 0:a.colorTarget)&&console.error("Framebuffer is initialized with a texture however the descriptor indicates using a renderbuffer color attachment!"),this._validateColorAttachmentPoint(36064+t),this._validateTextureDimensions(o,this._desc)}}if(i instanceof pe){var s;const e=null!=(s=this._desc.depthStencilTarget)?s:3;2===e?this._stencilAttachment=i:1===e||3===e?this._depthAttachment=i:console.error('If a Renderbuffer is provided, "depthStencilTarget" must be one of STENCIL_RENDER_BUFFER, DEPTH_RENDER_BUFFER or DEPTH_STENCIL_RENDER_BUFFER'),_e(i.descriptor,this._desc)}else if((0,o.pC)(i)){let e;this._context.capabilities.depthTexture||console.error("Extension WEBGL_depth_texture isn't supported therefore it is no possible to set the depth/stencil texture as an attachment!"),xe(i)?(this._depthStencilTexture=i,e=i.descriptor):this._depthStencilTexture=new G.Z(this._context,i),this._validateTextureDimensions(e,this._desc)}}dispose(){if(!this._desc)return;const e=this._context.getBoundFramebufferObject();this._disposeColorAttachments(),this._disposeDepthStencilAttachments(),this._glName&&(this._context.gl.deleteFramebuffer(this._glName),this._glName=null),this._context.bindFramebuffer(e),this._context.instanceCounter.decrement(de._g.Framebuffer,this),this._desc=null}get glName(){return this._glName}get descriptor(){return this._desc}get colorTexture(){const e=this._colorAttachments.get(36064);return e&&xe(e)?e:null}get colorAttachment(){return this._colorAttachments.get(36064)}get depthStencilAttachment(){return this._depthStencilTexture||this._depthAttachment||this._stencilAttachment}get depthStencilTexture(){return this._depthStencilTexture}get width(){return this._desc.width}get height(){return this._desc.height}get gpuMemoryUsage(){return j(this.colorAttachment)+j(this.depthStencilAttachment)}getColorTexture(e){const t=this._colorAttachments.get(e);return t&&xe(t)?t:null}framebufferTexture2D(e,t,r=36064,i=3553,o=0){t.framebufferTexture2D(t.FRAMEBUFFER,r,i,e,o)}attachColorTexture(e,t=36064){if(!e)return;this._validateColorAttachmentPoint(t);const r=e.descriptor;this._validateTextureDimensions(r,this._desc),this._disposeColorAttachments(),this._initialized&&(this._context.bindFramebuffer(this),this.framebufferTexture2D(e.glName,this._context.gl,t)),this._colorAttachments.set(t,e)}detachColorTexture(e=36064){const t=this._colorAttachments.get(e);if(xe(t)){const r=t;return this._initialized&&(this._context.bindFramebuffer(this),this.framebufferTexture2D(null,this._context.gl,e)),this._colorAttachments.delete(e),r}}attachDepthStencilTexture(e){if((0,o.Wi)(e))return;const t=e.descriptor;34041!==t.pixelFormat&&console.error("Depth/Stencil texture must have a pixel type of DEPTH_STENCIL!"),34042!==t.dataType&&console.error("Depth/Stencil texture must have data type of UNSIGNED_INT_24_8!"),this._context.capabilities.depthTexture||console.error("Extension WEBGL_depth_texture isn't supported therefore it is no possible to set the depth/stencil texture!"),this._validateTextureDimensions(t,this._desc),this._desc.depthStencilTarget&&4!==this._desc.depthStencilTarget&&(this._desc.depthStencilTarget=4),this._disposeDepthStencilAttachments(),this._initialized&&(this._context.bindFramebuffer(this),this.framebufferTexture2D(e.glName,this._context.gl,de.Lu)),this._depthStencilTexture=e}detachDepthStencilTexture(){const e=this._depthStencilTexture;return e&&this._initialized&&(this._context.bindFramebuffer(this),this.framebufferTexture2D(null,this._context.gl,de.Lu)),this._depthStencilTexture=null,e}attachDepthStencilBuffer(e){if((0,o.Wi)(e))return;const t=e.descriptor;if(34041!==t.internalFormat&&33189!==t.internalFormat&&console.error("Depth/Stencil buffer must have correct internalFormat"),_e(t,this._desc),this._disposeDepthStencilAttachments(),this._desc.depthStencilTarget=34041===t.internalFormat?3:1,this._initialized){this._context.bindFramebuffer(this);const t=this._context.gl,r=1===this._desc.depthStencilTarget?t.DEPTH_ATTACHMENT:t.DEPTH_STENCIL_ATTACHMENT;t.framebufferRenderbuffer(t.FRAMEBUFFER,r,t.RENDERBUFFER,e.glName)}this._depthAttachment=e}detachDepthStencilBuffer(){const e=this._context.gl,t=this._depthAttachment;if(t&&this._initialized){this._context.bindFramebuffer(this);const t=1===this._desc.depthStencilTarget?e.DEPTH_ATTACHMENT:e.DEPTH_STENCIL_ATTACHMENT;e.framebufferRenderbuffer(e.FRAMEBUFFER,t,e.RENDERBUFFER,null)}return this._depthAttachment=null,t}detachAll(){this.detachColorTexture(),this.detachDepthStencilBuffer(),this.detachDepthStencilTexture()}copyToTexture(e,t,r,i,o,n,a){(e<0||t<0||o<0||n<0)&&console.error("Offsets cannot be negative!"),(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!");const s=this._desc,l=a.descriptor;3553!==a.descriptor.target&&console.error("Texture target must be TEXTURE_2D!"),(e+r>s.width||t+i>s.height||o+r>l.width||n+i>l.height)&&console.error("Bad dimensions, the current input values will attempt to read or copy out of bounds!");const c=this._context,d=c.bindTexture(a,G.Z.TEXTURE_UNIT_FOR_UPDATES);c.bindFramebuffer(this),c.gl.copyTexSubImage2D(3553,0,o,n,e,t,r,i),c.bindTexture(d,G.Z.TEXTURE_UNIT_FOR_UPDATES)}readPixels(e,t,r,i,o,n,a){(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!"),a||console.error("Target memory is not initialized!"),this._context.bindFramebuffer(this),this._context.gl.readPixels(e,t,r,i,o,n,a)}resize(e,t){const r=this._desc;if(r.width!==e||r.height!==t){if(!this._initialized)return r.width=e,r.height=t,this._colorAttachments.forEach((r=>{r&&r.resize(e,t)})),void(this._depthStencilTexture&&this._depthStencilTexture.resize(e,t));r.width=e,r.height=t,this._colorAttachments.forEach((r=>{r&&r.resize(e,t)})),null!=this._depthStencilTexture?this._depthStencilTexture.resize(e,t):(this._depthAttachment||this._stencilAttachment)&&(this._depthAttachment&&this._depthAttachment.resize(e,t),this._stencilAttachment&&this._stencilAttachment.resize(e,t)),this._context.getBoundFramebufferObject()===this&&this._context.bindFramebuffer(null),this._initialized=!1}}initializeAndBind(e=3553){var t,r,i,o;const n=this._context.gl;if(this._initialized)return void n.bindFramebuffer(n.FRAMEBUFFER,this.glName);this._glName&&n.deleteFramebuffer(this._glName);const a=this._context,s=n.createFramebuffer(),l=this._desc,c=null!=(t=l.colorTarget)?t:1,d=null!=(r=l.width)?r:1,u=null!=(i=l.height)?i:1;if(n.bindFramebuffer(n.FRAMEBUFFER,s),0===this._colorAttachments.size)if(0===c)this._colorAttachments.set(36064,function(e,t,r){return new G.Z(e,{target:r,pixelFormat:6408,dataType:5121,samplingMode:9728,wrapMode:33071,width:t.width,height:t.height})}(a,l,2===this.descriptor.colorTarget?34067:3553));else{const e=new pe(a,{internalFormat:32854,width:d,height:u});this._colorAttachments.set(36064,e)}this._colorAttachments.forEach(((t,r)=>{t&&(xe(t)?this.framebufferTexture2D(t.glName,n,r,e):n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,t.glName))}));const h=null!=(o=l.depthStencilTarget)?o:0;switch(h){case 1:case 3:{this._depthAttachment||(this._depthAttachment=new pe(a,{internalFormat:1===l.depthStencilTarget?33189:34041,width:d,height:u}));const e=1===h?n.DEPTH_ATTACHMENT:n.DEPTH_STENCIL_ATTACHMENT;n.framebufferRenderbuffer(n.FRAMEBUFFER,e,n.RENDERBUFFER,this._depthAttachment.glName);break}case 2:this._stencilAttachment||(this._stencilAttachment=new pe(a,{internalFormat:36168,width:d,height:u})),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.STENCIL_ATTACHMENT,n.RENDERBUFFER,this._stencilAttachment.glName);break;case 4:if(!this._depthStencilTexture){a.capabilities.depthTexture||console.error("Extension WEBGL_depth_texture isn't supported therefore it is no possible to set the depth/stencil texture as an attachment!");const e={target:3553,pixelFormat:34041,dataType:34042,samplingMode:9728,wrapMode:33071,width:d,height:u};this._depthStencilTexture=new G.Z(a,e)}this.framebufferTexture2D(this._depthStencilTexture.glName,n,n.DEPTH_STENCIL_ATTACHMENT,e)}(0,ce.CG)()&&n.checkFramebufferStatus(n.FRAMEBUFFER)!==n.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!"),this._glName=s,this._initialized=!0}_disposeColorAttachments(){this._colorAttachments.forEach(((e,t)=>{if(xe(e))this._initialized&&(this._context.bindFramebuffer(this),this.framebufferTexture2D(null,this._context.gl,t)),e.dispose();else if(e instanceof WebGLRenderbuffer){const r=this._context.gl;this._initialized&&(this._context.bindFramebuffer(this),r.framebufferRenderbuffer(r.FRAMEBUFFER,t,r.RENDERBUFFER,null)),this._context.gl.deleteRenderbuffer(e)}})),this._colorAttachments.clear()}_disposeDepthStencilAttachments(){const e=this._context.gl;if(this._depthAttachment){if(this._initialized){this._context.bindFramebuffer(this);const t=1===this._desc.depthStencilTarget?e.DEPTH_ATTACHMENT:e.DEPTH_STENCIL_ATTACHMENT;e.framebufferRenderbuffer(e.FRAMEBUFFER,t,e.RENDERBUFFER,null)}this._depthAttachment.dispose(),this._depthAttachment=null}this._stencilAttachment&&(this._initialized&&(this._context.bindFramebuffer(this),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.STENCIL_ATTACHMENT,e.RENDERBUFFER,null)),this._stencilAttachment.dispose(),this._stencilAttachment=null),this._depthStencilTexture&&(this._initialized&&(this._context.bindFramebuffer(this),this.framebufferTexture2D(null,e,e.DEPTH_STENCIL_ATTACHMENT)),this._depthStencilTexture.dispose(),this._depthStencilTexture=null)}_validateTextureDimensions(e,t){3553!==e.target&&34067!==e.target&&console.error("Texture type must be TEXTURE_2D or TEXTURE_CUBE_MAP!"),void 0!==t.width&&t.width>=0&&void 0!==t.height&&t.height>=0?t.width===e.width&&t.height===e.height||console.error("Color attachment texture must match the framebuffer's!"):(t.width=e.width,t.height=e.height)}_validateColorAttachmentPoint(e){if(-1===ve._MAX_COLOR_ATTACHMENTS){const e=this._context.capabilities.drawBuffers;if(e){const t=this._context.gl;ve._MAX_COLOR_ATTACHMENTS=t.getParameter(e.MAX_COLOR_ATTACHMENTS)}else ve._MAX_COLOR_ATTACHMENTS=1}const t=e-36064;t+1>ve._MAX_COLOR_ATTACHMENTS&&ge.error("esri.FrameBufferObject",`illegal attachment point for color attachment: ${t+1}. Implementation supports up to ${ve._MAX_COLOR_ATTACHMENTS} color attachments`)}}function xe(e){return"type"in e&&"texture"===e.type}function _e(e,t){void 0!==t.width&&t.width>=0&&void 0!==t.height&&t.height>=0?t.width===e.width&&t.height===e.height||console.error("Renderbuffer dimensions must match the framebuffer's!"):(t.width=e.width,t.height=e.height)}ve._MAX_COLOR_ATTACHMENTS=-1;var be=r(46314);class Te extends D{constructor(e,t){super(),this.data=e,this.type=4,this._glTexture=null,this._powerOfTwoStretchInfo=null,this._loadingPromise=null,this._loadingController=null,this.events=new H.Z,this.params=t||{},this.params.mipmap=!1!==this.params.mipmap,this.params.noUnpackFlip=this.params.noUnpackFlip||!1,this.params.preMultiplyAlpha=this.params.preMultiplyAlpha||!1,this.params.wrap=this.params.wrap||{s:10497,t:10497},this.params.powerOfTwoResizeMode=this.params.powerOfTwoResizeMode||1,this.estimatedTexMemRequired=Te.estimateTexMemRequired(this.data,this.params),this.startPreload()}startPreload(){const e=this.data;(0,o.Wi)(e)||(e instanceof HTMLVideoElement?this.startPreloadVideoElement(e):e instanceof HTMLImageElement&&this.startPreloadImageElement(e))}startPreloadVideoElement(e){(0,B.jc)(e.src)||"auto"===e.preload&&e.crossOrigin||(e.preload="auto",e.crossOrigin="anonymous",e.src=e.src)}startPreloadImageElement(e){(0,B.HK)(e.src)||(0,B.jc)(e.src)||e.crossOrigin||(e.crossOrigin="anonymous",e.src=e.src)}static getDataDimensions(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e}static estimateTexMemRequired(e,t){if((0,o.Wi)(e))return 0;if((0,N.eP)(e)||(0,N.lq)(e))return t.encoding===Te.KTX2_ENCODING?function(e,t){if((0,o.Wi)(X))return e.byteLength;const r=new X.KTX2File(new Uint8Array(e)),i=J(r)?Y(r.getLevels(),r.getHasAlpha(),r.getWidth(),r.getHeight(),t):0;return r.close(),r.delete(),i}(e,t.mipmap):t.encoding===Te.BASIS_ENCODING?function(e,t){if((0,o.Wi)(X))return e.byteLength;const r=new X.BasisFile(new Uint8Array(e)),i=Q(r)?Y(r.getNumLevels(0),r.getHasAlpha(),r.getImageWidth(0,0),r.getImageHeight(0,0),t):0;return r.close(),r.delete(),i}(e,t.mipmap):e.byteLength;const{width:r,height:i}=e instanceof Image||e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement?Te.getDataDimensions(e):t;return(t.mipmap?4/3:1)*r*i*(t.components||4)||0}dispose(){this.data=void 0}get width(){return this.params.width}get height(){return this.params.height}createDescriptor(e){var t;return{target:3553,pixelFormat:6408,dataType:5121,wrapMode:this.params.wrap,flipped:!this.params.noUnpackFlip,samplingMode:this.params.mipmap?9987:9729,hasMipmap:this.params.mipmap,preMultiplyAlpha:this.params.preMultiplyAlpha,maxAnisotropy:null!=(t=this.params.maxAnisotropy)?t:this.params.mipmap?e.parameters.maxMaxAnisotropy:1}}get glTexture(){return this._glTexture}load(e,t){if((0,o.pC)(this._glTexture))return this._glTexture;if((0,o.pC)(this._loadingPromise))return this._loadingPromise;const r=this.data;return(0,o.Wi)(r)?(this._glTexture=new G.Z(e,this.createDescriptor(e),null),this._glTexture):"string"==typeof r?this.loadFromURL(e,t,r):r instanceof Image?this.loadFromImageElement(e,t,r):r instanceof HTMLVideoElement?this.loadFromVideoElement(e,t,r):r instanceof ImageData||r instanceof HTMLCanvasElement?this.loadFromImage(e,r,t):((0,N.eP)(r)||(0,N.lq)(r))&&this.params.encoding===Te.DDS_ENCODING?this.loadFromDDSData(e,r):((0,N.eP)(r)||(0,N.lq)(r))&&this.params.encoding===Te.KTX2_ENCODING?this.loadFromKTX2(e,r):((0,N.eP)(r)||(0,N.lq)(r))&&this.params.encoding===Te.BASIS_ENCODING?this.loadFromBasis(e,r):(0,N.lq)(r)?this.loadFromPixelData(e,r):(0,N.eP)(r)?this.loadFromPixelData(e,new Uint8Array(r)):null}get requiresFrameUpdates(){return this.data instanceof HTMLVideoElement}frameUpdate(e,t,r){if(!(this.data instanceof HTMLVideoElement)||(0,o.Wi)(this._glTexture))return r;if(this.data.readyState<2||r===this.data.currentTime)return r;if((0,o.pC)(this._powerOfTwoStretchInfo)){const{framebuffer:r,vao:i,sourceTexture:o}=this._powerOfTwoStretchInfo;o.setData(this.data),this.drawStretchedTexture(e,t,r,i,o,this._glTexture)}else{const{width:e,height:t}=this.data,{width:r,height:i}=this._glTexture.descriptor;e!==r||t!==i?this._glTexture.updateData(0,0,0,Math.min(e,r),Math.min(t,i),this.data):this._glTexture.setData(this.data)}return this._glTexture.descriptor.hasMipmap&&this._glTexture.generateMipmap(),this.data.currentTime}loadFromDDSData(e,t){return this._glTexture=function(e,t,r){const{textureData:i,internalFormat:o,width:n,height:a}=function(e,t){const r=new Int32Array(e,0,31);if(542327876!==r[0])return te.error("Invalid magic number in DDS header"),null;if(!(4&r[20]))return te.error("Unsupported format, must contain a FourCC code"),null;const i=r[21];let o,n;switch(i){case ie:o=8,n=33776;break;case oe:o=16,n=33778;break;case ne:o=16,n=33779;break;default:return te.error("Unsupported FourCC code:",function(e){return String.fromCharCode(255&e,e>>8&255,e>>16&255,e>>24&255)}(i)),null}let a=1,s=r[4],l=r[3];0==(3&s)&&0==(3&l)||(te.warn("Rounding up compressed texture size to nearest multiple of 4."),s=s+3&-4,l=l+3&-4);const c=s,d=l;let u,h;131072&r[2]&&!1!==t&&(a=Math.max(1,r[7])),1===a||(0,I.wt)(s)&&(0,I.wt)(l)||(te.warn("Ignoring mipmaps of non power of two sized compressed texture."),a=1);let f=r[1]+4;const m=[];for(let t=0;t<a;++t)h=(s+3>>2)*(l+3>>2)*o,u=new Uint8Array(e,f,h),m.push(u),f+=h,s=Math.max(1,s>>1),l=Math.max(1,l>>1);return{textureData:{type:"compressed",levels:m},internalFormat:n,width:c,height:d}}(r,t.hasMipmap);return t.samplingMode=i.levels.length>1?9987:9729,t.hasMipmap=i.levels.length>1,t.internalFormat=o,t.width=n,t.height=a,new G.Z(e,t,i)}(e,this.createDescriptor(e),t),this._glTexture}loadFromKTX2(e,t){return this.loadAsync((()=>async function(e,t,r){(0,o.Wi)(X)&&(X=await K());const i=new X.KTX2File(new Uint8Array(r));if(!J(i))return null;i.startTranscoding();const n=ee(e,t,i.getLevels(),i.getHasAlpha(),i.getWidth(),i.getHeight(),((e,t)=>i.getImageTranscodedSizeInBytes(e,0,0,t)),((e,t,r)=>i.transcodeImage(r,e,0,0,t,0,-1,-1)));return i.close(),i.delete(),n}(e,this.createDescriptor(e),t).then((e=>(this._glTexture=e,e)))))}loadFromBasis(e,t){return this.loadAsync((()=>async function(e,t,r){(0,o.Wi)(X)&&(X=await K());const i=new X.BasisFile(new Uint8Array(r));if(!Q(i))return null;i.startTranscoding();const n=ee(e,t,i.getNumLevels(0),i.getHasAlpha(),i.getImageWidth(0,0),i.getImageHeight(0,0),((e,t)=>i.getImageTranscodedSizeInBytes(0,e,t)),((e,t,r)=>i.transcodeImage(r,0,e,t,0,0)));return i.close(),i.delete(),n}(e,this.createDescriptor(e),t).then((e=>(this._glTexture=e,e)))))}loadFromPixelData(e,t){(0,A.hu)(this.params.width>0&&this.params.height>0);const r=this.createDescriptor(e);return r.pixelFormat=1===this.params.components?6409:3===this.params.components?6407:6408,r.width=this.params.width,r.height=this.params.height,this._glTexture=new G.Z(e,r,t),this._glTexture}loadFromURL(e,t,r){return this.loadAsync((async i=>{const o=await S(r,{signal:i});return this.loadFromImage(e,o,t)}))}loadFromImageElement(e,t,r){return r.complete?this.loadFromImage(e,r,t):this.loadAsync((async i=>{const o=await(0,U.f)(r,r.src,!1,i);return this.loadFromImage(e,o,t)}))}loadFromVideoElement(e,t,r){return r.readyState>=2?this.loadFromImage(e,r,t):this.loadFromVideoElementAsync(e,t,r)}loadFromVideoElementAsync(e,t,r){return this.loadAsync((i=>new Promise(((n,a)=>{const s=()=>{r.removeEventListener("loadeddata",l),r.removeEventListener("error",c),(0,o.hw)(d)},l=()=>{r.readyState>=2&&(s(),n(this.loadFromImage(e,r,t)))},c=e=>{s(),a(e||new T.Z("Failed to load video"))};r.addEventListener("loadeddata",l),r.addEventListener("error",c);const d=(0,M.fu)(i,(()=>c((0,M.zE)())))}))))}loadFromImage(e,t,r){const i=Te.getDataDimensions(t);this.params.width=i.width,this.params.height=i.height;const o=this.createDescriptor(e);return o.pixelFormat=3===this.params.components?6407:6408,!this.requiresPowerOfTwo(e,o)||(0,I.wt)(i.width)&&(0,I.wt)(i.height)?(o.width=i.width,o.height=i.height,this._glTexture=new G.Z(e,o,t),this._glTexture):(this._glTexture=this.makePowerOfTwoTexture(e,t,i,o,r),this._glTexture)}loadAsync(e){const t=new AbortController;this._loadingController=t;const r=e(t.signal);this._loadingPromise=r;const i=()=>{this._loadingController===t&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null)};return r.then(i,i),r}requiresPowerOfTwo(e,t){const r=33071,i="number"==typeof t.wrapMode?t.wrapMode===r:t.wrapMode.s===r&&t.wrapMode.t===r;return!(0,be.Z)(e.gl)&&(t.hasMipmap||!i)}makePowerOfTwoTexture(e,t,r,i,o){const{width:n,height:a}=r,s=(0,I.Sf)(n),l=(0,I.Sf)(a);let c;switch(i.width=s,i.height=l,this.params.powerOfTwoResizeMode){case 2:i.textureCoordinateScaleFactor=[n/s,a/l],c=new G.Z(e,i),c.updateData(0,0,0,n,a,t);break;case 1:case null:case void 0:c=this.stretchToPowerOfTwo(e,t,i,o());break;default:(0,z.Bg)(this.params.powerOfTwoResizeMode)}return i.hasMipmap&&c.generateMipmap(),c}stretchToPowerOfTwo(e,t,r,i){const o=new G.Z(e,r),n=new ve(e,{colorTarget:0,depthStencilTarget:0},o),a=new G.Z(e,{target:3553,pixelFormat:r.pixelFormat,dataType:5121,wrapMode:33071,samplingMode:9729,flipped:!!r.flipped,maxAnisotropy:8,preMultiplyAlpha:r.preMultiplyAlpha},t),s=function(e,t=se,r=ae,i=-1,o=1){let n=null;return n=t===le?new Float32Array([i,i,0,0,o,i,1,0,i,o,0,1,o,o,1,1]):new Float32Array([i,i,o,i,i,o,o,o]),new me(e,r,{geometry:t},{geometry:he.createVertex(e,35044,n)})}(e),l=e.getBoundFramebufferObject();return this.drawStretchedTexture(e,i,n,s,a,o),this.requiresFrameUpdates?this._powerOfTwoStretchInfo={vao:s,sourceTexture:a,framebuffer:n}:(s.dispose(!0),a.dispose(),n.detachColorTexture(),n.dispose()),e.bindFramebuffer(l),o}drawStretchedTexture(e,t,r,i,o,n){e.bindFramebuffer(r);const a=e.getViewport();e.setViewport(0,0,n.descriptor.width,n.descriptor.height);const s=t.program;e.useProgram(s),s.setUniform4f("color",1,1,1,1),s.bindTexture(o,"tex"),e.bindVAO(i),t.bindPipelineState(e),e.drawArrays(5,0,function(e,t){return e.vertexBuffers[t].size/function(e){return e[0].stride}(e.layout[t])}(i,"geometry")),e.bindFramebuffer(null),e.setViewport(a.x,a.y,a.width,a.height)}unload(){if((0,o.pC)(this._powerOfTwoStretchInfo)){const{framebuffer:e,vao:t,sourceTexture:r}=this._powerOfTwoStretchInfo;t.dispose(!0),r.dispose(),e.dispose(),this._glTexture=null,this._powerOfTwoStretchInfo=null}if((0,o.pC)(this._glTexture)&&(this._glTexture.dispose(),this._glTexture=null),(0,o.pC)(this._loadingController)){const e=this._loadingController;this._loadingController=null,this._loadingPromise=null,e.abort()}this.events.emit("unloaded")}}Te.DDS_ENCODING="image/vnd-ms.dds",Te.KTX2_ENCODING="image/ktx2",Te.BASIS_ENCODING="image/x.basis";var ye=r(65576),Me=r(94124),we=r(37782);class Se extends D{constructor(e,t){super(),this.type=3,this.supportsEdges=!1,this._visible=!0,this._renderPriority=0,this._insertOrder=0,this._vertexAttributeLocations=ae,this._parameters=(0,we.Uf)(e,t),this.validateParameters(this._parameters)}dispose(){}get parameters(){return this._parameters}update(e){return!1}setParameters(e){(0,we.LO)(this._parameters,e)&&(this.validateParameters(this._parameters),this.parametersChanged())}validateParameters(e){}get visible(){return this._visible}set visible(e){e!==this._visible&&(this._visible=e,this.parametersChanged())}shouldRender(e){return this.isVisible()&&this.isVisibleInPass(e.pass)&&0!=(this.renderOccluded&e.renderOccludedMask)}isVisibleInPass(e){return!0}get renderOccluded(){return this.parameters.renderOccluded}get renderPriority(){return this._renderPriority}set renderPriority(e){e!==this._renderPriority&&(this._renderPriority=e,this.parametersChanged())}get insertOrder(){return this._insertOrder}set insertOrder(e){e!==this._insertOrder&&(this._insertOrder=e,this.parametersChanged())}get vertexAttributeLocations(){return this._vertexAttributeLocations}isVisible(){return this._visible}parametersChanged(){(0,o.pC)(this.repository)&&this.repository.materialChanged(this)}}function Ce(e,t,r=32774,i=[0,0,0,0]){return{srcRgb:e,srcAlpha:e,dstRgb:t,dstAlpha:t,opRgb:r,opAlpha:r,color:{r:i[0],g:i[1],b:i[2],a:i[3]}}}const Ae={face:1029,mode:2305},Pe={face:1028,mode:2305},Fe=e=>2===e?Ae:1===e?Pe:null,Ee={zNear:0,zFar:1},De={r:!0,g:!0,b:!0,a:!0};function Oe(e){return ke.intern(e)}function Re(e){return We.intern(e)}function Le(e){return $e.intern(e)}function ze(e){return Xe.intern(e)}function He(e){return Ke.intern(e)}function Ie(e){return Qe.intern(e)}function Ne(e){return et.intern(e)}function Be(e){return rt.intern(e)}class Ue{constructor(e,t){this.makeKey=e,this.makeRef=t,this.interns=new Map}intern(e){if(!e)return null;const t=this.makeKey(e),r=this.interns;return r.has(t)||r.set(t,this.makeRef(e)),r.get(t)}}function Ve(e){return"["+e.join(",")+"]"}const ke=new Ue(Ge,(e=>({__tag:"Blending",...e})));function Ge(e){return e?Ve([e.srcRgb,e.srcAlpha,e.dstRgb,e.dstAlpha,e.opRgb,e.opAlpha,e.color.r,e.color.g,e.color.b,e.color.a]):null}const We=new Ue(qe,(e=>({__tag:"Culling",...e})));function qe(e){return e?Ve([e.face,e.mode]):null}const $e=new Ue(je,(e=>({__tag:"PolygonOffset",...e})));function je(e){return e?Ve([e.factor,e.units]):null}const Xe=new Ue(Ze,(e=>({__tag:"DepthTest",...e})));function Ze(e){return e?Ve([e.func]):null}const Ke=new Ue(Ye,(e=>({__tag:"StencilTest",...e})));function Ye(e){return e?Ve([e.function.func,e.function.ref,e.function.mask,e.operation.fail,e.operation.zFail,e.operation.zPass]):null}const Qe=new Ue(Je,(e=>({__tag:"DepthWrite",...e})));function Je(e){return e?Ve([e.zNear,e.zFar]):null}const et=new Ue(tt,(e=>({__tag:"ColorWrite",...e})));function tt(e){return e?Ve([e.r,e.g,e.b,e.a]):null}const rt=new Ue(it,(e=>({__tag:"StencilWrite",...e})));function it(e){return e?Ve([e.mask]):null}const ot=new Ue((function(e){return e?Ve([Ge(e.blending),qe(e.culling),je(e.polygonOffset),Ze(e.depthTest),Ye(e.stencilTest),Je(e.depthWrite),tt(e.colorWrite),it(e.stencilWrite)]):null}),(e=>({blending:Oe(e.blending),culling:Re(e.culling),polygonOffset:Le(e.polygonOffset),depthTest:ze(e.depthTest),stencilTest:He(e.stencilTest),depthWrite:Ie(e.depthWrite),colorWrite:Ne(e.colorWrite),stencilWrite:Be(e.stencilWrite)}))),nt=function(e,t,r,i,o=32774,n=32774,a=[0,0,0,0]){return{srcRgb:770,srcAlpha:1,dstRgb:771,dstAlpha:771,opRgb:o,opAlpha:n,color:{r:a[0],g:a[1],b:a[2],a:a[3]}}}(),at=Ce(1,1),st=Ce(0,771);const lt={factor:-1,units:-2};function ct(e){return e?lt:null}function dt(e){return 3===e||2===e?513:515}var ut=r(51305),ht=r(94961),ft=r(72119),mt=r(88669),pt=r(98766),gt=(r(67676),r(22807)),vt=r(12981);new gt.x((function(){return{origin:null,direction:null}})),(0,d.c)(),(0,d.c)();const xt=y.Z.getLogger("esri.geometry.support.sphere");function _t(){return(0,mt.c)()}function bt(e,t=_t()){return(0,pt.c)(t,e)}function Tt(e){return Array.isArray(e)?e[3]:e}function yt(e){return Array.isArray(e)?e:Dt}function Mt(e,t,r){if((0,o.Wi)(t))return!1;const{origin:i,direction:n}=t,a=wt;a[0]=i[0]-e[0],a[1]=i[1]-e[1],a[2]=i[2]-e[2];const s=n[0]*n[0]+n[1]*n[1]+n[2]*n[2],l=2*(n[0]*a[0]+n[1]*a[1]+n[2]*a[2]),c=l*l-4*s*(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]-e[3]*e[3]);if(c<0)return!1;const d=Math.sqrt(c);let u=(-l-d)/(2*s);const h=(-l+d)/(2*s);return(u<0||h<u&&h>0)&&(u=h),!(u<0||(r&&(r[0]=i[0]+n[0]*u,r[1]=i[1]+n[1]*u,r[2]=i[2]+n[2]*u),0))}const wt=(0,d.c)();function St(e,t,r){const i=vt.WM.get(),o=vt.MP.get();(0,c.c)(i,t.origin,t.direction);const n=Tt(e);(0,c.c)(r,i,t.origin),(0,c.a)(r,r,1/(0,c.l)(r)*n);const a=At(e,t.origin),l=function(e,t){const r=(0,c.d)(e,t)/((0,c.l)(e)*(0,c.l)(t));return-(0,I.ZF)(r)}(t.origin,r);return(0,s.i)(o),(0,s.e)(o,o,l+a,i),(0,c.m)(r,r,o),r}function Ct(e,t,r){const i=(0,c.f)(vt.WM.get(),t,yt(e)),o=(0,c.a)(vt.WM.get(),i,e[3]/(0,c.l)(i));return(0,c.b)(r,o,yt(e))}function At(e,t){const r=(0,c.f)(vt.WM.get(),t,yt(e)),i=(0,c.l)(r),o=Tt(e),n=o+Math.abs(o-i);return(0,I.ZF)(o/n)}const Pt=(0,d.c)();function Ft(e,t,r,i){const o=(0,c.f)(Pt,t,yt(e));switch(r){case 0:{const e=(0,I.jE)(o,Pt)[2];return(0,c.s)(i,-Math.sin(e),Math.cos(e),0)}case 1:{const e=(0,I.jE)(o,Pt),t=e[1],r=e[2],n=Math.sin(t);return(0,c.s)(i,-n*Math.cos(r),-n*Math.sin(r),Math.cos(t))}case 2:return(0,c.n)(i,o);default:return}}function Et(e,t){const r=(0,c.f)(Ot,t,yt(e));return(0,c.l)(r)-e[3]}const Dt=(0,d.c)(),Ot=(0,d.c)();Object.freeze({__proto__:null,create:_t,copy:bt,fromCenterAndRadius:function(e,t){return(0,mt.f)(e[0],e[1],e[2],t)},wrap:function(e){return e},clear:function(e){e[0]=e[1]=e[2]=e[3]=0},fromRadius:function(e){return e},getRadius:Tt,getCenter:yt,fromValues:function(e,t,r,i){return(0,mt.f)(e,t,r,i)},elevate:function(e,t,r){return e!==r&&(0,c.g)(r,e),r[3]=e[3]+t,r},setExtent:function(e,t,r){return xt.error("sphere.setExtent is not yet supported"),e===r?r:bt(e,r)},intersectRay:Mt,intersectsRay:function(e,t){return Mt(e,t,null)},intersectRayClosestSilhouette:function(e,t,r){if(Mt(e,t,r))return r;const i=St(e,t,vt.WM.get());return(0,c.b)(r,t.origin,(0,c.a)(vt.WM.get(),t.direction,(0,c.i)(t.origin,i)/(0,c.l)(t.direction))),r},closestPointOnSilhouette:St,closestPoint:function(e,t,r){return Mt(e,t,r)?r:(function(e,t,r){const i=(0,c.d)(e.direction,(0,c.f)(r,t,e.origin));(0,c.b)(r,e.origin,(0,c.a)(r,e.direction,i))}(t,yt(e),r),Ct(e,r,r))},projectPoint:Ct,distanceToSilhouette:function(e,t){const r=(0,c.f)(vt.WM.get(),t,yt(e)),i=(0,c.p)(r),o=e[3]*e[3];return Math.sqrt(Math.abs(i-o))},angleToSilhouette:At,axisAt:Ft,altitudeAt:Et,setAltitudeAt:function(e,t,r,i){const o=Et(e,t),n=Ft(e,t,2,Ot),a=(0,c.a)(Ot,n,r-o);return(0,c.b)(i,t,a)}});const Rt=new class{constructor(e=0){this.offset=e,this.sphere=_t(),this.tmpVertex=(0,d.c)()}applyToVertex(e,t,r){const i=this.objectTransform.transform;let o=i[0]*e+i[4]*t+i[8]*r+i[12],n=i[1]*e+i[5]*t+i[9]*r+i[13],a=i[2]*e+i[6]*t+i[10]*r+i[14];const s=this.offset/Math.sqrt(o*o+n*n+a*a);o+=o*s,n+=n*s,a+=a*s;const l=this.objectTransform.inverse;return this.tmpVertex[0]=l[0]*o+l[4]*n+l[8]*a+l[12],this.tmpVertex[1]=l[1]*o+l[5]*n+l[9]*a+l[13],this.tmpVertex[2]=l[2]*o+l[6]*n+l[10]*a+l[14],this.tmpVertex}applyToMinMax(e,t){const r=this.offset/Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]+=e[0]*r,e[1]+=e[1]*r,e[2]+=e[2]*r;const i=this.offset/Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]+=t[0]*i,t[1]+=t[1]*i,t[2]+=t[2]*i}applyToAabb(e){const t=this.offset/Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]+=e[0]*t,e[1]+=e[1]*t,e[2]+=e[2]*t;const r=this.offset/Math.sqrt(e[3]*e[3]+e[4]*e[4]+e[5]*e[5]);return e[3]+=e[3]*r,e[4]+=e[4]*r,e[5]+=e[5]*r,e}applyToBoundingSphere(e){const t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]),r=this.offset/t;return this.sphere[0]=e[0]+e[0]*r,this.sphere[1]=e[1]+e[1]*r,this.sphere[2]=e[2]+e[2]*r,this.sphere[3]=e[3]+e[3]*this.offset/t,this.sphere}};new class{constructor(e=0){this.offset=e,this.componentLocalOriginLength=0,this.tmpVertex=(0,d.c)(),this.mbs=(0,mt.c)(),this.obb={center:(0,d.c)(),halfSize:(0,ft.c)(),quaternion:null}}set localOrigin(e){this.componentLocalOriginLength=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2])}applyToVertex(e,t,r){const i=e,o=t,n=r+this.componentLocalOriginLength,a=this.offset/Math.sqrt(i*i+o*o+n*n);return this.tmpVertex[0]=e+i*a,this.tmpVertex[1]=t+o*a,this.tmpVertex[2]=r+n*a,this.tmpVertex}applyToAabb(e){const t=e[0],r=e[1],i=e[2]+this.componentLocalOriginLength,o=e[3],n=e[4],a=e[5]+this.componentLocalOriginLength,s=this.offset/Math.sqrt(t*t+r*r+i*i);e[0]+=t*s,e[1]+=r*s,e[2]+=i*s;const l=this.offset/Math.sqrt(o*o+n*n+a*a);return e[3]+=o*l,e[4]+=n*l,e[5]+=a*l,e}applyToMbs(e){const t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]),r=this.offset/t;return this.mbs[0]=e[0]+e[0]*r,this.mbs[1]=e[1]+e[1]*r,this.mbs[2]=e[2]+e[2]*r,this.mbs[3]=e[3]+e[3]*this.offset/t,this.mbs}applyToObb(e){const t=e.center,r=this.offset/Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.obb.center[0]=t[0]+t[0]*r,this.obb.center[1]=t[1]+t[1]*r,this.obb.center[2]=t[2]+t[2]*r,(0,c.q)(this.obb.halfSize,e.halfSize,e.quaternion),(0,c.b)(this.obb.halfSize,this.obb.halfSize,e.center);const i=this.offset/Math.sqrt(this.obb.halfSize[0]*this.obb.halfSize[0]+this.obb.halfSize[1]*this.obb.halfSize[1]+this.obb.halfSize[2]*this.obb.halfSize[2]);return this.obb.halfSize[0]+=this.obb.halfSize[0]*i,this.obb.halfSize[1]+=this.obb.halfSize[1]*i,this.obb.halfSize[2]+=this.obb.halfSize[2]*i,(0,c.f)(this.obb.halfSize,this.obb.halfSize,e.center),(0,ut.c)(Lt,e.quaternion),(0,c.q)(this.obb.halfSize,this.obb.halfSize,Lt),this.obb.halfSize[0]*=this.obb.halfSize[0]<0?-1:1,this.obb.halfSize[1]*=this.obb.halfSize[1]<0?-1:1,this.obb.halfSize[2]*=this.obb.halfSize[2]<0?-1:1,this.obb.quaternion=e.quaternion,this.obb}},new class{constructor(e=0){this.offset=e,this.tmpVertex=(0,d.c)()}applyToVertex(e,t,r){const i=e+this.localOrigin[0],o=t+this.localOrigin[1],n=r+this.localOrigin[2],a=this.offset/Math.sqrt(i*i+o*o+n*n);return this.tmpVertex[0]=e+i*a,this.tmpVertex[1]=t+o*a,this.tmpVertex[2]=r+n*a,this.tmpVertex}applyToAabb(e){const t=e[0]+this.localOrigin[0],r=e[1]+this.localOrigin[1],i=e[2]+this.localOrigin[2],o=e[3]+this.localOrigin[0],n=e[4]+this.localOrigin[1],a=e[5]+this.localOrigin[2],s=this.offset/Math.sqrt(t*t+r*r+i*i);e[0]+=t*s,e[1]+=r*s,e[2]+=i*s;const l=this.offset/Math.sqrt(o*o+n*n+a*a);return e[3]+=o*l,e[4]+=n*l,e[5]+=a*l,e}};const Lt=(0,ht.a)();function zt(e,t,r,i){const o=r.typedBuffer,n=r.typedBufferStride,a=e.length;i*=n;for(let r=0;r<a;++r){const a=2*e[r];o[i]=t[a],o[i+1]=t[a+1],i+=n}}function Ht(e,t,r,i,o){const n=r.typedBuffer,a=r.typedBufferStride,s=e.length;if(i*=a,null==o||1===o)for(let r=0;r<s;++r){const o=3*e[r];n[i]=t[o],n[i+1]=t[o+1],n[i+2]=t[o+2],i+=a}else for(let r=0;r<s;++r){const s=3*e[r];for(let e=0;e<o;++e)n[i]=t[s],n[i+1]=t[s+1],n[i+2]=t[s+2],i+=a}}function It(e,t,r,i,o,n=1){if(!r)return void Ht(e,t,i,o,n);const a=i.typedBuffer,s=i.typedBufferStride,l=e.length,c=r[0],d=r[1],u=r[2],h=r[4],f=r[5],m=r[6],p=r[8],g=r[9],v=r[10],x=r[12],_=r[13],b=r[14];if(o*=s,1===n)for(let r=0;r<l;++r){const i=3*e[r],n=t[i],l=t[i+1],T=t[i+2];a[o]=c*n+h*l+p*T+x,a[o+1]=d*n+f*l+g*T+_,a[o+2]=u*n+m*l+v*T+b,o+=s}else for(let r=0;r<l;++r){const i=3*e[r],l=t[i],T=t[i+1],y=t[i+2],M=c*l+h*T+p*y+x,w=d*l+f*T+g*y+_,S=u*l+m*T+v*y+b;for(let e=0;e<n;++e)a[o]=M,a[o+1]=w,a[o+2]=S,o+=s}}function Nt(e,t,r,i,o,n=1){if(!r)return void Ht(e,t,i,o,n);const a=r,l=i.typedBuffer,c=i.typedBufferStride,d=e.length,u=a[0],h=a[1],f=a[2],m=a[4],p=a[5],g=a[6],v=a[8],x=a[9],_=a[10],b=!(0,s.k)(a),T=1e-6,y=1-T;if(o*=c,1===n)for(let r=0;r<d;++r){const i=3*e[r],n=t[i],a=t[i+1],s=t[i+2];let d=u*n+m*a+v*s,M=h*n+p*a+x*s,w=f*n+g*a+_*s;if(b){const e=d*d+M*M+w*w;if(e<y&&e>T){const t=1/Math.sqrt(e);d*=t,M*=t,w*=t}}l[o+0]=d,l[o+1]=M,l[o+2]=w,o+=c}else for(let r=0;r<d;++r){const i=3*e[r],a=t[i],s=t[i+1],d=t[i+2];let M=u*a+m*s+v*d,w=h*a+p*s+x*d,S=f*a+g*s+_*d;if(b){const e=M*M+w*w+S*S;if(e<y&&e>T){const t=1/Math.sqrt(e);M*=t,w*=t,S*=t}}for(let e=0;e<n;++e)l[o+0]=M,l[o+1]=w,l[o+2]=S,o+=c}}function Bt(e,t,r,i,o,n=1){if(!r)return void function(e,t,r,i,o=1){const n=r.typedBuffer,a=r.typedBufferStride,s=e.length;if(i*=a,1===o)for(let r=0;r<s;++r){const o=4*e[r];n[i]=t[o],n[i+1]=t[o+1],n[i+2]=t[o+2],n[i+3]=t[o+3],i+=a}else for(let r=0;r<s;++r){const s=4*e[r];for(let e=0;e<o;++e)n[i]=t[s],n[i+1]=t[s+1],n[i+2]=t[s+2],n[i+3]=t[s+3],i+=a}}(e,t,i,o,n);const a=r,l=i.typedBuffer,c=i.typedBufferStride,d=e.length,u=a[0],h=a[1],f=a[2],m=a[4],p=a[5],g=a[6],v=a[8],x=a[9],_=a[10],b=!(0,s.k)(a),T=1e-6,y=1-T;if(o*=c,1===n)for(let r=0;r<d;++r){const i=4*e[r],n=t[i],a=t[i+1],s=t[i+2],d=t[i+3];let M=u*n+m*a+v*s,w=h*n+p*a+x*s,S=f*n+g*a+_*s;if(b){const e=M*M+w*w+S*S;if(e<y&&e>T){const t=1/Math.sqrt(e);M*=t,w*=t,S*=t}}l[o+0]=M,l[o+1]=w,l[o+2]=S,l[o+3]=d,o+=c}else for(let r=0;r<d;++r){const i=4*e[r],a=t[i],s=t[i+1],d=t[i+2],M=t[i+3];let w=u*a+m*s+v*d,S=h*a+p*s+x*d,C=f*a+g*s+_*d;if(b){const e=w*w+S*S+C*C;if(e<y&&e>T){const t=1/Math.sqrt(e);w*=t,S*=t,C*=t}}for(let e=0;e<n;++e)l[o+0]=w,l[o+1]=S,l[o+2]=C,l[o+3]=M,o+=c}}function Ut(e,t,r,i,o,n=1){const a=i.typedBuffer,s=i.typedBufferStride,l=e.length;if(o*=s,1===n){if(4===r)for(let r=0;r<l;++r){const i=4*e[r];a[o]=t[i],a[o+1]=t[i+1],a[o+2]=t[i+2],a[o+3]=t[i+3],o+=s}else if(3===r)for(let r=0;r<l;++r){const i=3*e[r];a[o]=t[i],a[o+1]=t[i+1],a[o+2]=t[i+2],a[o+3]=255,o+=s}}else if(4===r)for(let r=0;r<l;++r){const i=4*e[r];for(let e=0;e<n;++e)a[o]=t[i],a[o+1]=t[i+1],a[o+2]=t[i+2],a[o+3]=t[i+3],o+=s}else if(3===r)for(let r=0;r<l;++r){const i=3*e[r];for(let e=0;e<n;++e)a[o]=t[i],a[o+1]=t[i+1],a[o+2]=t[i+2],a[o+3]=255,o+=s}}var Vt=r(43697),kt=r(51546),Gt=r(47624),Wt=r(92555),qt=r(68853),$t=r(42001),jt=r(85504),Xt=r(72303),Zt=r(98401),Kt=r(89243);const Yt=(0,r(10937).c)();class Qt{constructor(e,t){this._module=e,this._loadModule=t}get(){return this._module}async reload(){return this._module=await this._loadModule(),this._module}}function Jt(e={}){return(t,r)=>{var i,o;t._parameterNames=null!=(i=t._parameterNames)?i:[],t._parameterNames.push(r);const n=t._parameterNames.length-1,a=e.count||2,s=Math.ceil(Math.log2(a)),l=null!=(o=t._parameterBits)?o:[0];let c=0;for(;l[c]+s>16;)c++,c>=l.length&&l.push(0);t._parameterBits=l;const d=l[c],u=(1<<s)-1<<d;l[c]+=s,Object.defineProperty(t,r,{get(){return this[n]},set(e){if(this[n]!==e&&(this[n]=e,this._keyDirty=!0,this._parameterBits[c]=this._parameterBits[c]&~u|+e<<d&u,"number"!=typeof e&&"boolean"!=typeof e))throw"Configuration value for "+r+" must be boolean or number, got "+typeof e}})}}const er=["layout","centroid","smooth","case","mat2x2","mat2x3","mat2x4","mat3x2","mat3x3","mat3x4","mat4x2","mat4x3","mat4x4","uint","uvec2","uvec3","uvec4","samplerCubeShadow","sampler2DArray","sampler2DArrayShadow","isampler2D","isampler3D","isamplerCube","isampler2DArray","usampler2D","usampler3D","usamplerCube","usampler2DArray","coherent","restrict","readonly","writeonly","resource","atomic_uint","noperspective","patch","sample","subroutine","common","partition","active","filter","image1D","image2D","image3D","imageCube","iimage1D","iimage2D","iimage3D","iimageCube","uimage1D","uimage2D","uimage3D","uimageCube","image1DArray","image2DArray","iimage1DArray","iimage2DArray","uimage1DArray","uimage2DArray","image1DShadow","image2DShadow","image1DArrayShadow","image2DArrayShadow","imageBuffer","iimageBuffer","uimageBuffer","sampler1DArray","sampler1DArrayShadow","isampler1D","isampler1DArray","usampler1D","usampler1DArray","isampler2DRect","usampler2DRect","samplerBuffer","isamplerBuffer","usamplerBuffer","sampler2DMS","isampler2DMS","usampler2DMS","sampler2DMSArray","isampler2DMSArray","usampler2DMSArray","trunc","round","roundEven","isnan","isinf","floatBitsToInt","floatBitsToUint","intBitsToFloat","uintBitsToFloat","packSnorm2x16","unpackSnorm2x16","packUnorm2x16","unpackUnorm2x16","packHalf2x16","unpackHalf2x16","outerProduct","transpose","determinant","inverse","texture","textureSize","textureProj","textureLod","textureOffset","texelFetch","texelFetchOffset","textureProjOffset","textureLodOffset","textureProjLod","textureProjLodOffset","textureGrad","textureGradOffset","textureProjGrad","textureProjGradOffset"];var tr,rr={exports:{}};void 0!==(tr=["precision","highp","mediump","lowp","attribute","const","uniform","varying","break","continue","do","for","while","if","else","in","out","inout","float","int","void","bool","true","false","discard","return","mat2","mat3","mat4","vec2","vec3","vec4","ivec2","ivec3","ivec4","bvec2","bvec3","bvec4","sampler1D","sampler2D","sampler3D","samplerCube","sampler1DShadow","sampler2DShadow","struct","asm","class","union","enum","typedef","template","this","packed","goto","switch","default","inline","noinline","volatile","public","static","extern","external","interface","long","short","double","half","fixed","unsigned","input","output","hvec2","hvec3","hvec4","dvec2","dvec3","dvec4","fvec2","fvec3","fvec4","sampler2DRect","sampler3DRect","sampler2DRectShadow","sizeof","cast","namespace","using"])&&(rr.exports=tr);const ir=rr.exports;var or,nr={exports:{}};void 0!==(or=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"])&&(nr.exports=or);const ar=nr.exports;var sr,lr,cr={exports:{}};sr=cr,void 0!==(lr=["abs","acos","all","any","asin","atan","ceil","clamp","cos","cross","dFdx","dFdy","degrees","distance","dot","equal","exp","exp2","faceforward","floor","fract","gl_BackColor","gl_BackLightModelProduct","gl_BackLightProduct","gl_BackMaterial","gl_BackSecondaryColor","gl_ClipPlane","gl_ClipVertex","gl_Color","gl_DepthRange","gl_DepthRangeParameters","gl_EyePlaneQ","gl_EyePlaneR","gl_EyePlaneS","gl_EyePlaneT","gl_Fog","gl_FogCoord","gl_FogFragCoord","gl_FogParameters","gl_FragColor","gl_FragCoord","gl_FragData","gl_FragDepth","gl_FragDepthEXT","gl_FrontColor","gl_FrontFacing","gl_FrontLightModelProduct","gl_FrontLightProduct","gl_FrontMaterial","gl_FrontSecondaryColor","gl_LightModel","gl_LightModelParameters","gl_LightModelProducts","gl_LightProducts","gl_LightSource","gl_LightSourceParameters","gl_MaterialParameters","gl_MaxClipPlanes","gl_MaxCombinedTextureImageUnits","gl_MaxDrawBuffers","gl_MaxFragmentUniformComponents","gl_MaxLights","gl_MaxTextureCoords","gl_MaxTextureImageUnits","gl_MaxTextureUnits","gl_MaxVaryingFloats","gl_MaxVertexAttribs","gl_MaxVertexTextureImageUnits","gl_MaxVertexUniformComponents","gl_ModelViewMatrix","gl_ModelViewMatrixInverse","gl_ModelViewMatrixInverseTranspose","gl_ModelViewMatrixTranspose","gl_ModelViewProjectionMatrix","gl_ModelViewProjectionMatrixInverse","gl_ModelViewProjectionMatrixInverseTranspose","gl_ModelViewProjectionMatrixTranspose","gl_MultiTexCoord0","gl_MultiTexCoord1","gl_MultiTexCoord2","gl_MultiTexCoord3","gl_MultiTexCoord4","gl_MultiTexCoord5","gl_MultiTexCoord6","gl_MultiTexCoord7","gl_Normal","gl_NormalMatrix","gl_NormalScale","gl_ObjectPlaneQ","gl_ObjectPlaneR","gl_ObjectPlaneS","gl_ObjectPlaneT","gl_Point","gl_PointCoord","gl_PointParameters","gl_PointSize","gl_Position","gl_ProjectionMatrix","gl_ProjectionMatrixInverse","gl_ProjectionMatrixInverseTranspose","gl_ProjectionMatrixTranspose","gl_SecondaryColor","gl_TexCoord","gl_TextureEnvColor","gl_TextureMatrix","gl_TextureMatrixInverse","gl_TextureMatrixInverseTranspose","gl_TextureMatrixTranspose","gl_Vertex","greaterThan","greaterThanEqual","inversesqrt","length","lessThan","lessThanEqual","log","log2","matrixCompMult","max","min","mix","mod","normalize","not","notEqual","pow","radians","reflect","refract","sign","sin","smoothstep","sqrt","step","tan","texture2D","texture2DLod","texture2DProj","texture2DProjLod","textureCube","textureCubeLod","texture2DLodEXT","texture2DProjLodEXT","textureCubeLodEXT","texture2DGradEXT","texture2DProjGradEXT","textureCubeGradEXT"])&&(sr.exports=lr);const dr=cr.exports;var ur=999,hr=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"];function fr(e){return function(e){var t=function(){var e,t,r,i=0,o=0,n=ur,a=[],s=[],l=1,c=0,d=0,u=!1,h=!1,f="";return function(e){return s=[],null!==e?p(e.replace?e.replace(/\r\n/g,"\n"):e):(a.length&&m(a.join("")),n=10,m("(eof)"),s)};function m(e){e.length&&s.push({type:hr[n],data:e,position:d,line:l,column:c})}function p(t){var a;for(i=0,r=(f+=t).length;e=f[i],i<r;){switch(a=i,n){case 0:i=_();break;case 1:case 2:i=x();break;case 3:i=b();break;case 4:i=M();break;case 11:i=y();break;case 5:i=w();break;case 9999:i=S();break;case 9:i=v();break;case ur:i=g()}a!==i&&("\n"===f[a]?(c=0,++l):++c)}return o+=i,f=f.slice(i),s}function g(){return a=a.length?[]:a,"/"===t&&"*"===e?(d=o+i-1,n=0,t=e,i+1):"/"===t&&"/"===e?(d=o+i-1,n=1,t=e,i+1):"#"===e?(n=2,d=o+i,i):/\s/.test(e)?(n=9,d=o+i,i):(u=/\d/.test(e),h=/[^\w_]/.test(e),d=o+i,n=u?4:h?3:9999,i)}function v(){return/[^\s]/g.test(e)?(m(a.join("")),n=ur,i):(a.push(e),t=e,i+1)}function x(){return"\r"!==e&&"\n"!==e||"\\"===t?(a.push(e),t=e,i+1):(m(a.join("")),n=ur,i)}function _(){return"/"===e&&"*"===t?(a.push(e),m(a.join("")),n=ur,i+1):(a.push(e),t=e,i+1)}function b(){if("."===t&&/\d/.test(e))return n=5,i;if("/"===t&&"*"===e)return n=0,i;if("/"===t&&"/"===e)return n=1,i;if("."===e&&a.length){for(;T(a););return n=5,i}if(";"===e||")"===e||"("===e){if(a.length)for(;T(a););return m(e),n=ur,i+1}var r=2===a.length&&"="!==e;if(/[\w_\d\s]/.test(e)||r){for(;T(a););return n=ur,i}return a.push(e),t=e,i+1}function T(e){for(var t,r,i=0;;){if(t=ar.indexOf(e.slice(0,e.length+i).join("")),r=ar[t],-1===t){if(i--+e.length>0)continue;r=e.slice(0,1).join("")}return m(r),d+=r.length,(a=a.slice(r.length)).length}}function y(){return/[^a-fA-F0-9]/.test(e)?(m(a.join("")),n=ur,i):(a.push(e),t=e,i+1)}function M(){return"."===e||/[eE]/.test(e)?(a.push(e),n=5,t=e,i+1):"x"===e&&1===a.length&&"0"===a[0]?(n=11,a.push(e),t=e,i+1):/[^\d]/.test(e)?(m(a.join("")),n=ur,i):(a.push(e),t=e,i+1)}function w(){return"f"===e&&(a.push(e),t=e,i+=1),/[eE]/.test(e)||"-"===e&&/[eE]/.test(t)?(a.push(e),t=e,i+1):/[^\d]/.test(e)?(m(a.join("")),n=ur,i):(a.push(e),t=e,i+1)}function S(){if(/[^\d\w_]/.test(e)){var r=a.join("");return n=ir.indexOf(r)>-1?8:dr.indexOf(r)>-1?7:6,m(a.join("")),n=ur,i}return a.push(e),t=e,i+1}}(),r=[];return(r=r.concat(t(e))).concat(t(null))}(e)}const mr=["GL_OES_standard_derivatives","GL_EXT_frag_depth","GL_EXT_draw_buffers","GL_EXT_shader_texture_lod"];function pr(e,t){for(let r=t-1;r>=0;r--){const t=e[r];if("whitespace"!==t.type&&"block-comment"!==t.type){if("keyword"!==t.type)break;if("attribute"===t.data||"in"===t.data)return!0}}return!1}function gr(e,t,r,i){i=i||r;for(const o of e)if("ident"===o.type&&o.data===r)return i in t?t[i]++:t[i]=0,gr(e,t,i+"_"+t[i],i);return r}function vr(e,t,r="afterVersion"){function i(e,t){for(let r=t;r<e.length;r++){const t=e[r];if("operator"===t.type&&";"===t.data)return r}return null}const o={data:"\n",type:"whitespace"},n=t=>t<e.length&&/[^\r\n]$/.test(e[t].data);let a=function(e){let t=-1,o=0,n=-1;for(let a=0;a<e.length;a++){const s=e[a];if("preprocessor"===s.type&&(s.data.match(/\#(if|ifdef|ifndef)\s+.+/)?++o:s.data.match(/\#endif\s*.*/)&&--o),"afterVersion"!==r&&"afterPrecision"!==r||"preprocessor"===s.type&&/^#version/.test(s.data)&&(n=Math.max(n,a)),"afterPrecision"===r&&"keyword"===s.type&&"precision"===s.data){const t=i(e,a);if(null===t)throw new Error("precision statement not followed by any semicolons!");n=Math.max(n,t)}t<n&&0===o&&(t=a)}return t+1}(e);n(a-1)&&e.splice(a++,0,o);for(const r of t)e.splice(a++,0,r);n(a-1)&&n(a)&&e.splice(a,0,o)}function xr(e,t,r,i="lowp"){vr(e,[{type:"keyword",data:"out"},{type:"whitespace",data:" "},{type:"keyword",data:i},{type:"whitespace",data:" "},{type:"keyword",data:r},{type:"whitespace",data:" "},{type:"ident",data:t},{type:"operator",data:";"}],"afterPrecision")}function _r(e,t,r,i,o="lowp"){vr(e,[{type:"keyword",data:"layout"},{type:"operator",data:"("},{type:"keyword",data:"location"},{type:"whitespace",data:" "},{type:"operator",data:"="},{type:"whitespace",data:" "},{type:"integer",data:i.toString()},{type:"operator",data:")"},{type:"whitespace",data:" "},{type:"keyword",data:"out"},{type:"whitespace",data:" "},{type:"keyword",data:o},{type:"whitespace",data:" "},{type:"keyword",data:r},{type:"whitespace",data:" "},{type:"ident",data:t},{type:"operator",data:";"}],"afterPrecision")}function br(e,t){let r,i,o=-1;for(let n=t;n<e.length;n++){const t=e[n];if("operator"===t.type&&("["===t.data&&(r=n),"]"===t.data)){i=n;break}"integer"===t.type&&(o=parseInt(t.data,10))}return r&&i&&e.splice(r,i-r+1),o}const Tr=!1,yr=new Map;function Mr(e,t){if((0,o.Wi)(e)||e.length!==t.length)return!0;for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!0;return!1}function wr(e,t,r){const i="webgl2"===e.webglVersion?function(e,t){const r=function(e){return Tr?yr.get(e):null}(e);if((0,o.pC)(r))return r;const i=fr(e);if("300 es"===function(e,t="100",r="300 es"){const i=/^\s*\#version\s+([0-9]+(\s+[a-zA-Z]+)?)\s*/;for(const o of e)if("preprocessor"===o.type){const e=i.exec(o.data);if(e){const i=e[1].replace(/\s\s+/g," ");if(i===r)return i;if(i===t)return o.data="#version "+r,t;throw new Error("unknown glsl version: "+i)}}return e.splice(0,0,{type:"preprocessor",data:"#version "+r},{type:"whitespace",data:"\n"}),null}(i,"100","300 es"))throw new Error("shader is already glsl 300 es");let n=null,a=null;const s={},l={};for(let e=0;e<i.length;++e){const r=i[e];switch(r.type){case"keyword":35633===t&&"attribute"===r.data?r.data="in":"varying"===r.data&&(r.data=35633===t?"out":"in");break;case"builtin":if(/^texture(2D|Cube)(Proj)?(Lod|Grad)?(EXT)?$/.test(r.data.trim())&&(r.data=r.data.replace(/(2D|Cube|EXT)/g,"")),35632===t&&"gl_FragColor"===r.data&&(n||(n=gr(i,s,"fragColor"),xr(i,n,"vec4")),r.data=n),35632===t&&"gl_FragData"===r.data){const t=br(i,e+1),o=gr(i,s,"fragData");_r(i,o,"vec4",t,"mediump"),r.data=o}else 35632===t&&"gl_FragDepthEXT"===r.data&&(a||(a=gr(i,s,"gl_FragDepth")),r.data=a);break;case"ident":if(er.indexOf(r.data)>=0){if(35633===t&&pr(i,e))throw new Error("attribute in vertex shader uses a name that is a reserved word in glsl 300 es");r.data in l||(l[r.data]=gr(i,s,r.data)),r.data=l[r.data]}}}for(let e=i.length-1;e>=0;--e){const t=i[e];if("preprocessor"===t.type){const r=t.data.match(/\#extension\s+(.*)\:/);if(r&&r[1]&&mr.indexOf(r[1].trim())>=0){const t=i[e+1];i.splice(e,t&&"whitespace"===t.type?2:1)}const o=t.data.match(/\#ifdef\s+(.*)/);o&&o[1]&&mr.indexOf(o[1].trim())>=0&&(t.data="#if 1");const n=t.data.match(/\#ifndef\s+(.*)/);n&&n[1]&&mr.indexOf(n[1].trim())>=0&&(t.data="#if 0")}}return function(e,t){return Tr&&yr.set(e,t),t}(e,function(e){return e.map((e=>"eof"!==e.type?e.data:"")).join("")}(i))}(r,t):r,n=e.gl,a=n.createShader(t);return n.shaderSource(a,i),n.compileShader(a),(0,ce.CG)()&&!n.getShaderParameter(a,n.COMPILE_STATUS)&&(console.error("Compile error in ".concat(35633===t?"vertex":"fragment"," shader")),console.error(n.getShaderInfoLog(a)),console.error(function(e){let t=2;return e.replace(/\n/g,(()=>"\n"+function(e){return e>=1e3?e.toString():(" "+e).slice(-3)}(t++)+":"))}(i)),"webgl2"===e.webglVersion&&(console.log("Shader source before transpilation:"),console.log(r))),a}function Sr(e,t){for(let r=0;r<e.length;++r)t[r]=e[r]}class Cr extends class{constructor(e,t,r,i){this._context=e,this._locations=i,this._nameToUniformLocation={},this._nameToUniform1={},this._nameToUniform1v={},this._nameToUniform2={},this._nameToUniform3={},this._nameToUniform4={},this._nameToUniformMatrix3={},this._nameToUniformMatrix4={},e||console.error("RenderingContext isn't initialized!"),0===t.length&&console.error("Shaders source should not be empty!"),this._vShader=wr(this._context,35633,t),this._fShader=wr(this._context,35632,r),this._vShader&&this._fShader||console.error("Error loading shaders!"),this._context.instanceCounter.increment(de._g.VertexShader,this),this._context.instanceCounter.increment(de._g.FragmentShader,this)}get glName(){if((0,o.pC)(this._glName))return this._glName;if((0,o.Wi)(this._vShader))return null;const e=this._context.gl,t=e.createProgram();return e.attachShader(t,this._vShader),e.attachShader(t,this._fShader),this._locations.forEach(((r,i)=>e.bindAttribLocation(t,r,i))),e.linkProgram(t),(0,ce.CG)()&&!e.getProgramParameter(t,e.LINK_STATUS)&&console.error("Could not initialize shader\nVALIDATE_STATUS: "+e.getProgramParameter(t,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]infoLog: "+e.getProgramInfoLog(t)),this._glName=t,this._context.instanceCounter.increment(de._g.Program,this),t}dispose(){const e=this._context.gl;this._vShader&&(e.deleteShader(this._vShader),this._vShader=null,this._context.instanceCounter.decrement(de._g.VertexShader,this)),this._fShader&&(e.deleteShader(this._fShader),this._fShader=null,this._context.instanceCounter.decrement(de._g.FragmentShader,this)),this._glName&&(e.deleteProgram(this._glName),this._glName=null,this._context.instanceCounter.decrement(de._g.Program,this))}_getUniformLocation(e){return void 0===this._nameToUniformLocation[e]&&(this._nameToUniformLocation[e]=this._context.gl.getUniformLocation(this.glName,e)),this._nameToUniformLocation[e]}hasUniform(e){return null!==this._getUniformLocation(e)}setUniform1i(e,t){const r=this._nameToUniform1[e];void 0!==r&&t===r||(this._context.useProgram(this),this._context.gl.uniform1i(this._getUniformLocation(e),t),this._nameToUniform1[e]=t)}setUniform1iv(e,t){const r=this._nameToUniform1v[e];Mr(r,t)&&(this._context.useProgram(this),this._context.gl.uniform1iv(this._getUniformLocation(e),t),void 0===r?this._nameToUniform1v[e]=Array.from(t):Sr(t,r))}setUniform2iv(e,t){const r=this._nameToUniform2[e];Mr(r,t)&&(this._context.useProgram(this),this._context.gl.uniform2iv(this._getUniformLocation(e),t),void 0===r?this._nameToUniform2[e]=Array.from(t):Sr(t,r))}setUniform3iv(e,t){const r=this._nameToUniform3[e];Mr(r,t)&&(this._context.useProgram(this),this._context.gl.uniform3iv(this._getUniformLocation(e),t),void 0===r?this._nameToUniform3[e]=Array.from(t):Sr(t,r))}setUniform4iv(e,t){const r=this._nameToUniform4[e];Mr(r,t)&&(this._context.useProgram(this),this._context.gl.uniform4iv(this._getUniformLocation(e),t),void 0===r?this._nameToUniform4[e]=Array.from(t):Sr(t,r))}setUniform1f(e,t){const r=this._nameToUniform1[e];void 0!==r&&t===r||(this._context.useProgram(this),this._context.gl.uniform1f(this._getUniformLocation(e),t),this._nameToUniform1[e]=t)}setUniform1fv(e,t){const r=this._nameToUniform1v[e];Mr(r,t)&&(this._context.useProgram(this),this._context.gl.uniform1fv(this._getUniformLocation(e),t),void 0===r?this._nameToUniform1v[e]=Array.from(t):Sr(t,r))}setUniform2f(e,t,r){const i=this._nameToUniform2[e];void 0!==i&&t===i[0]&&r===i[1]||(this._context.useProgram(this),this._context.gl.uniform2f(this._getUniformLocation(e),t,r),void 0===i?this._nameToUniform2[e]=[t,r]:(i[0]=t,i[1]=r))}setUniform2fv(e,t){const r=this._nameToUniform2[e];Mr(r,t)&&(this._context.useProgram(this),this._context.gl.uniform2fv(this._getUniformLocation(e),t),void 0===r?this._nameToUniform2[e]=Array.from(t):Sr(t,r))}setUniform3f(e,t,r,i){const o=this._nameToUniform3[e];void 0!==o&&t===o[0]&&r===o[1]&&i===o[2]||(this._context.useProgram(this),this._context.gl.uniform3f(this._getUniformLocation(e),t,r,i),void 0===o?this._nameToUniform3[e]=[t,r,i]:(o[0]=t,o[1]=r,o[2]=i))}setUniform3fv(e,t){const r=this._nameToUniform3[e];Mr(r,t)&&(this._context.useProgram(this),this._context.gl.uniform3fv(this._getUniformLocation(e),t),void 0===r?this._nameToUniform3[e]=Array.from(t):Sr(t,r))}setUniform4f(e,t,r,i,o){const n=this._nameToUniform4[e];void 0!==n&&t===n[0]&&r===n[1]&&i===n[2]&&o===n[3]||(this._context.useProgram(this),this._context.gl.uniform4f(this._getUniformLocation(e),t,r,i,o),void 0===n?this._nameToUniform4[e]=[t,r,i,o]:(n[0]=t,n[1]=r,n[2]=i,n[3]=o))}setUniform4fv(e,t){const r=this._nameToUniform4[e];Mr(r,t)&&(this._context.useProgram(this),this._context.gl.uniform4fv(this._getUniformLocation(e),t),void 0===r?this._nameToUniform4[e]=Array.from(t):Sr(t,r))}setUniformMatrix3fv(e,t,r=!1,i=!1){const n=this._nameToUniformMatrix3[e];(i?n!==t:function(e,t){return!!(0,o.Wi)(e)||(9!==e.length?Mr(e,t):9!==e.length||e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||e[4]!==t[4]||e[5]!==t[5]||e[6]!==t[6]||e[7]!==t[7]||e[8]!==t[8])}(n,t))&&(this._context.useProgram(this),this._context.gl.uniformMatrix3fv(this._getUniformLocation(e),r,t),void 0===n?this._nameToUniformMatrix3[e]=Array.from(t):Sr(t,n))}setUniformMatrix4fv(e,t,r=!1){const i=this._nameToUniformMatrix4[e];(function(e,t){return!!(0,o.Wi)(e)||(16!==e.length?Mr(e,t):16!==e.length||e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||e[4]!==t[4]||e[5]!==t[5]||e[6]!==t[6]||e[7]!==t[7]||e[8]!==t[8]||e[9]!==t[9]||e[10]!==t[10]||e[11]!==t[11]||e[12]!==t[12]||e[13]!==t[13]||e[14]!==t[14]||e[15]!==t[15])})(i,t)&&(this._context.useProgram(this),this._context.gl.uniformMatrix4fv(this._getUniformLocation(e),r,t),void 0===i?this._nameToUniformMatrix4[e]=Array.from(t):Sr(t,i))}assertCompatibleVertexAttributeLocations(e){e.locations!==this._locations&&console.error("VertexAttributeLocations are incompatible")}stop(){}}{constructor(e,t,r){super(e,t.generateSource("vertex"),t.generateSource("fragment"),r),this._textures=new Map,this._freeTextureUnits=new C.Z({deallocator:null}),this._fragmentUniforms=(0,ce.hZ)()?t.fragmentUniforms.entries:null}stop(){this._textures.clear(),this._freeTextureUnits.clear()}bindTexture(e,t){if((0,o.Wi)(e)||null==e.glName){const e=this._textures.get(t);return e&&(this._context.bindTexture(null,e.unit),this._freeTextureUnit(e),this._textures.delete(t)),null}let r=this._textures.get(t);return null==r?(r=this._allocTextureUnit(e),this._textures.set(t,r)):r.texture=e,this._context.useProgram(this),this.setUniform1i(t,r.unit),this._context.bindTexture(e,r.unit),r.unit}rebindTextures(){this._context.useProgram(this),this._textures.forEach(((e,t)=>{this._context.bindTexture(e.texture,e.unit),this.setUniform1i(t,e.unit)})),(0,o.pC)(this._fragmentUniforms)&&this._fragmentUniforms.forEach((e=>{if(("sampler2D"===e.type||"samplerCube"===e.type)&&!this._textures.has(e.name))throw new Error(`Texture sampler ${e.name} has no bound texture`)}))}_allocTextureUnit(e){return{texture:e,unit:0===this._freeTextureUnits.length?this._textures.size:this._freeTextureUnits.pop()}}_freeTextureUnit(e){this._freeTextureUnits.push(e.unit)}}const Ar={mask:255},Pr={function:{func:519,ref:2,mask:2},operation:{fail:7680,zFail:7680,zPass:0}},Fr={function:{func:519,ref:2,mask:2},operation:{fail:7680,zFail:7680,zPass:7681}};var Er=r(32078);class Dr extends class{constructor(e,t,r=(()=>this.dispose())){this.release=r,t&&(this._config=t.snapshot()),this._program=this.initializeProgram(e),this._pipeline=this.initializePipeline(e)}dispose(){this._program=(0,o.O3)(this._program),this._pipeline=this._config=null}reload(e){(0,o.O3)(this._program),this._program=this.initializeProgram(e)}get program(){return this._program}get key(){return this._config.key}get configuration(){return this._config}bindPass(e,t){}bindMaterial(e,t){}bindDraw(e){}bindPipelineState(e,t=null,r){e.setPipelineState(this.getPipelineState(t,r))}ensureAttributeLocations(e){this.program.assertCompatibleVertexAttributeLocations(e)}get primitiveType(){return 4}getPipelineState(e,t){return this._pipeline}}{initializeProgram(e){const t=Dr.shader.get(),r=this.configuration,i=t.build({OITEnabled:0===r.transparencyPassType,output:r.output,viewingMode:e.viewingMode,receiveShadows:r.receiveShadows,slicePlaneEnabled:r.slicePlaneEnabled,sliceHighlightDisabled:r.sliceHighlightDisabled,sliceEnabledForVertexPrograms:!1,symbolColor:r.symbolColors,vvSize:r.vvSize,vvColor:r.vvColor,vvInstancingEnabled:!0,instanced:r.instanced,instancedColor:r.instancedColor,instancedDoublePrecision:r.instancedDoublePrecision,pbrMode:r.usePBR?r.isSchematic?2:1:0,hasMetalnessAndRoughnessTexture:r.hasMetalnessAndRoughnessTexture,hasEmissionTexture:r.hasEmissionTexture,hasOcclusionTexture:r.hasOcclusionTexture,hasNormalTexture:r.hasNormalTexture,hasColorTexture:r.hasColorTexture,receiveAmbientOcclusion:r.receiveAmbientOcclusion,useCustomDTRExponentForWater:!1,normalType:r.normalsTypeDerivate?3:0,doubleSidedMode:r.doubleSidedMode,vertexTangents:r.vertexTangents,attributeTextureCoordinates:r.hasMetalnessAndRoughnessTexture||r.hasEmissionTexture||r.hasOcclusionTexture||r.hasNormalTexture||r.hasColorTexture?1:0,textureAlphaPremultiplied:r.textureAlphaPremultiplied,attributeColor:r.vertexColors,screenSizePerspectiveEnabled:r.screenSizePerspective,verticalOffsetEnabled:r.verticalOffset,offsetBackfaces:r.offsetBackfaces,doublePrecisionRequiresObfuscation:(0,Kt.I)(e.rctx),alphaDiscardMode:r.alphaDiscardMode,supportsTextureAtlas:!1,multipassTerrainEnabled:r.multipassTerrainEnabled,cullAboveGround:r.cullAboveGround});return new Cr(e.rctx,i,ae)}bindPass(e,t){var r,i;!function(e,t){e.setUniformMatrix4fv("proj",t)}(this.program,t.camera.projectionMatrix);const o=this.configuration.output;(1===this.configuration.output||t.multipassTerrainEnabled||3===o)&&this.program.setUniform2fv("cameraNearFar",t.camera.nearFar),t.multipassTerrainEnabled&&(this.program.setUniform2fv("inverseViewport",t.inverseViewport),(0,$t.p)(this.program,t)),7===o&&(this.program.setUniform1f("opacity",e.opacity),this.program.setUniform1f("layerOpacity",e.layerOpacity),this.program.setUniform4fv("externalColor",e.externalColor),this.program.setUniform1i("colorMixMode",we.FZ[e.colorMixMode])),0===o?(t.lighting.setUniforms(this.program,!1),this.program.setUniform3fv("ambient",e.ambient),this.program.setUniform3fv("diffuse",e.diffuse),this.program.setUniform4fv("externalColor",e.externalColor),this.program.setUniform1i("colorMixMode",we.FZ[e.colorMixMode]),this.program.setUniform1f("opacity",e.opacity),this.program.setUniform1f("layerOpacity",e.layerOpacity),this.configuration.usePBR&&(0,jt.nW)(this.program,e,this.configuration.isSchematic)):4===o&&(0,qt.wW)(this.program,t),(0,Zt.uj)(this.program,e),(0,Wt.Mo)(this.program,e,t),(0,we.bj)(e.screenSizePerspective,this.program,"screenSizePerspectiveAlignment"),2!==e.textureAlphaMode&&3!==e.textureAlphaMode||this.program.setUniform1f("textureAlphaCutoff",e.textureAlphaCutoff),null==(r=t.shadowMap)||r.bind(this.program),null==(i=t.ssaoHelper)||i.bind(this.program,t.camera)}bindDraw(e){const t=this.configuration.instancedDoublePrecision?(0,d.f)(e.camera.viewInverseTransposeMatrix[3],e.camera.viewInverseTransposeMatrix[7],e.camera.viewInverseTransposeMatrix[11]):e.origin;(function(e,t,r){(0,s.a)(Yt,r,t),e.setUniform3fv("localOrigin",t),e.setUniformMatrix4fv("view",Yt)})(this.program,t,e.camera.viewMatrix),this.program.rebindTextures(),(0===this.configuration.output||7===this.configuration.output||1===this.configuration.output&&this.configuration.screenSizePerspective||2===this.configuration.output&&this.configuration.screenSizePerspective||4===this.configuration.output&&this.configuration.screenSizePerspective)&&function(e,t,r){e.setUniform3f("camPos",r[3]-t[0],r[7]-t[1],r[11]-t[2])}(this.program,t,e.camera.viewInverseTransposeMatrix),2===this.configuration.output&&this.program.setUniformMatrix4fv("viewNormal",e.camera.viewInverseTransposeMatrix),this.configuration.instancedDoublePrecision&&Gt.f.bindCustomOrigin(this.program,t),(0,kt.Vv)(this.program,this.configuration,e.slicePlane,t),0===this.configuration.output&&(0,Xt.vL)(this.program,e,t)}setPipeline(e,t){const r=this.configuration,i=3===e,o=2===e;return function(e){return ot.intern(e)}({blending:0!==r.output&&7!==r.output||!r.transparent?null:i?nt:(n=e,2===n?null:1===n?st:at),culling:Or(r)&&Fe(r.cullFace),depthTest:{func:dt(e)},depthWrite:i||o?r.writeDepth&&Ee:null,colorWrite:De,stencilWrite:r.sceneHasOcludees?Ar:null,stencilTest:r.sceneHasOcludees?t?Fr:Pr:null,polygonOffset:i||o?null:ct(r.enableOffset)});var n}initializePipeline(){return this._occludeePipelineState=this.setPipeline(this.configuration.transparencyPassType,!0),this.setPipeline(this.configuration.transparencyPassType,!1)}getPipelineState(e,t){return t?this._occludeePipelineState:super.getPipelineState(e,t)}}function Or(e){return e.cullFace?0!==e.cullFace:!e.slicePlaneEnabled&&!e.transparent&&!e.doubleSidedMode}Dr.shader=new Qt(Er.D,(()=>r.e(9291).then(r.bind(r,79291))));class Rr extends class{constructor(){this._key="",this._keyDirty=!1,this._parameterBits=this._parameterBits?this._parameterBits.map((()=>0)):[],this._parameterNames||(this._parameterNames=[])}get key(){return this._keyDirty&&(this._keyDirty=!1,this._key=String.fromCharCode.apply(String,this._parameterBits)),this._key}snapshot(){const e=this._parameterNames,t={key:this.key};for(const r of e)t[r]=this[r];return t}}{constructor(){super(...arguments),this.output=0,this.alphaDiscardMode=1,this.doubleSidedMode=0,this.isSchematic=!1,this.vertexColors=!1,this.offsetBackfaces=!1,this.symbolColors=!1,this.vvSize=!1,this.vvColor=!1,this.verticalOffset=!1,this.receiveShadows=!1,this.slicePlaneEnabled=!1,this.sliceHighlightDisabled=!1,this.receiveAmbientOcclusion=!1,this.screenSizePerspective=!1,this.textureAlphaPremultiplied=!1,this.hasColorTexture=!1,this.usePBR=!1,this.hasMetalnessAndRoughnessTexture=!1,this.hasEmissionTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.instanced=!1,this.instancedColor=!1,this.instancedDoublePrecision=!1,this.vertexTangents=!1,this.normalsTypeDerivate=!1,this.writeDepth=!0,this.sceneHasOcludees=!1,this.transparent=!1,this.enableOffset=!0,this.cullFace=0,this.transparencyPassType=3,this.multipassTerrainEnabled=!1,this.cullAboveGround=!1}}(0,Vt._)([Jt({count:8})],Rr.prototype,"output",void 0),(0,Vt._)([Jt({count:4})],Rr.prototype,"alphaDiscardMode",void 0),(0,Vt._)([Jt({count:3})],Rr.prototype,"doubleSidedMode",void 0),(0,Vt._)([Jt()],Rr.prototype,"isSchematic",void 0),(0,Vt._)([Jt()],Rr.prototype,"vertexColors",void 0),(0,Vt._)([Jt()],Rr.prototype,"offsetBackfaces",void 0),(0,Vt._)([Jt()],Rr.prototype,"symbolColors",void 0),(0,Vt._)([Jt()],Rr.prototype,"vvSize",void 0),(0,Vt._)([Jt()],Rr.prototype,"vvColor",void 0),(0,Vt._)([Jt()],Rr.prototype,"verticalOffset",void 0),(0,Vt._)([Jt()],Rr.prototype,"receiveShadows",void 0),(0,Vt._)([Jt()],Rr.prototype,"slicePlaneEnabled",void 0),(0,Vt._)([Jt()],Rr.prototype,"sliceHighlightDisabled",void 0),(0,Vt._)([Jt()],Rr.prototype,"receiveAmbientOcclusion",void 0),(0,Vt._)([Jt()],Rr.prototype,"screenSizePerspective",void 0),(0,Vt._)([Jt()],Rr.prototype,"textureAlphaPremultiplied",void 0),(0,Vt._)([Jt()],Rr.prototype,"hasColorTexture",void 0),(0,Vt._)([Jt()],Rr.prototype,"usePBR",void 0),(0,Vt._)([Jt()],Rr.prototype,"hasMetalnessAndRoughnessTexture",void 0),(0,Vt._)([Jt()],Rr.prototype,"hasEmissionTexture",void 0),(0,Vt._)([Jt()],Rr.prototype,"hasOcclusionTexture",void 0),(0,Vt._)([Jt()],Rr.prototype,"hasNormalTexture",void 0),(0,Vt._)([Jt()],Rr.prototype,"instanced",void 0),(0,Vt._)([Jt()],Rr.prototype,"instancedColor",void 0),(0,Vt._)([Jt()],Rr.prototype,"instancedDoublePrecision",void 0),(0,Vt._)([Jt()],Rr.prototype,"vertexTangents",void 0),(0,Vt._)([Jt()],Rr.prototype,"normalsTypeDerivate",void 0),(0,Vt._)([Jt()],Rr.prototype,"writeDepth",void 0),(0,Vt._)([Jt()],Rr.prototype,"sceneHasOcludees",void 0),(0,Vt._)([Jt()],Rr.prototype,"transparent",void 0),(0,Vt._)([Jt()],Rr.prototype,"enableOffset",void 0),(0,Vt._)([Jt({count:3})],Rr.prototype,"cullFace",void 0),(0,Vt._)([Jt({count:4})],Rr.prototype,"transparencyPassType",void 0),(0,Vt._)([Jt()],Rr.prototype,"multipassTerrainEnabled",void 0),(0,Vt._)([Jt()],Rr.prototype,"cullAboveGround",void 0);var Lr=r(41846);class zr extends Dr{initializeProgram(e){const t=zr.shader.get(),r=this.configuration,i=t.build({OITEnabled:0===r.transparencyPassType,output:r.output,viewingMode:e.viewingMode,receiveShadows:r.receiveShadows,slicePlaneEnabled:r.slicePlaneEnabled,sliceHighlightDisabled:r.sliceHighlightDisabled,sliceEnabledForVertexPrograms:!1,symbolColor:r.symbolColors,vvSize:r.vvSize,vvColor:r.vvColor,vvInstancingEnabled:!0,instanced:r.instanced,instancedColor:r.instancedColor,instancedDoublePrecision:r.instancedDoublePrecision,pbrMode:r.usePBR?1:0,hasMetalnessAndRoughnessTexture:!1,hasEmissionTexture:!1,hasOcclusionTexture:!1,hasNormalTexture:!1,hasColorTexture:r.hasColorTexture,receiveAmbientOcclusion:r.receiveAmbientOcclusion,useCustomDTRExponentForWater:!1,normalType:0,doubleSidedMode:2,vertexTangents:!1,attributeTextureCoordinates:r.hasColorTexture?1:0,textureAlphaPremultiplied:r.textureAlphaPremultiplied,attributeColor:r.vertexColors,screenSizePerspectiveEnabled:r.screenSizePerspective,verticalOffsetEnabled:r.verticalOffset,offsetBackfaces:r.offsetBackfaces,doublePrecisionRequiresObfuscation:(0,Kt.I)(e.rctx),alphaDiscardMode:r.alphaDiscardMode,supportsTextureAtlas:!1,multipassTerrainEnabled:r.multipassTerrainEnabled,cullAboveGround:r.cullAboveGround});return new Cr(e.rctx,i,ae)}}zr.shader=new Qt(Lr.R,(()=>r.e(8625).then(r.bind(r,28625))));class Hr extends Se{constructor(e){super(e,Nr),this.supportsEdges=!0,this.techniqueConfig=new Rr,this.vertexBufferLayout=function(e){const t=e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId,r=(0,ye.U$)().vec3f("position").vec3f("normal");return e.vertexTangents&&r.vec4f("tangent"),t&&r.vec2f("uv0"),e.vertexColors&&r.vec4u8("color"),e.symbolColors&&r.vec4u8("symbolColor"),r}(this.parameters),this.instanceBufferLayout=e.instanced?function(e){let t=(0,ye.U$)();return t=e.instancedDoublePrecision?t.vec3f("modelOriginHi").vec3f("modelOriginLo").mat3f("model").mat3f("modelNormal"):t.mat4f("model").mat4f("modelNormal"),e.instanced&&e.instanced.indexOf("color")>-1&&(t=t.vec4f("instanceColor")),e.instanced&&e.instanced.indexOf("featureAttribute")>-1&&(t=t.vec4f("instanceFeatureAttribute")),t}(this.parameters):null}isVisibleInPass(e){return 4!==e&&6!==e&&7!==e||this.parameters.castShadows}isVisible(){const e=this.parameters;if(!super.isVisible()||0===e.layerOpacity)return!1;const t=e.instanced,r=e.vertexColors,i=e.symbolColors,o=!!t&&t.indexOf("color")>-1,n=e.vvColorEnabled,a="replace"===e.colorMixMode,s=e.opacity>0,l=e.externalColor&&e.externalColor[3]>0;return r&&(o||n||i)?!!a||s:r?a?l:s:o||n||i?!!a||s:a?l:s}getTechniqueConfig(e,t){return this.techniqueConfig.output=e,this.techniqueConfig.hasNormalTexture=!!this.parameters.normalTextureId,this.techniqueConfig.hasColorTexture=!!this.parameters.textureId,this.techniqueConfig.vertexTangents=this.parameters.vertexTangents,this.techniqueConfig.instanced=!!this.parameters.instanced,this.techniqueConfig.instancedDoublePrecision=this.parameters.instancedDoublePrecision,this.techniqueConfig.vvSize=this.parameters.vvSizeEnabled,this.techniqueConfig.verticalOffset=null!==this.parameters.verticalOffset,this.techniqueConfig.screenSizePerspective=null!==this.parameters.screenSizePerspective,this.techniqueConfig.slicePlaneEnabled=this.parameters.slicePlaneEnabled,this.techniqueConfig.sliceHighlightDisabled=this.parameters.sliceHighlightDisabled,this.techniqueConfig.alphaDiscardMode=this.parameters.textureAlphaMode,this.techniqueConfig.normalsTypeDerivate="screenDerivative"===this.parameters.normals,this.techniqueConfig.transparent=this.parameters.transparent,this.techniqueConfig.writeDepth=this.parameters.writeDepth,this.techniqueConfig.sceneHasOcludees=this.parameters.sceneHasOcludees,this.techniqueConfig.cullFace=this.parameters.slicePlaneEnabled?0:this.parameters.cullFace,this.techniqueConfig.multipassTerrainEnabled=t.multipassTerrainEnabled,this.techniqueConfig.cullAboveGround=t.cullAboveGround,0!==e&&7!==e||(this.techniqueConfig.vertexColors=this.parameters.vertexColors,this.techniqueConfig.symbolColors=this.parameters.symbolColors,this.parameters.treeRendering?this.techniqueConfig.doubleSidedMode=2:this.techniqueConfig.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?1:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?2:0,this.techniqueConfig.instancedColor=!!this.parameters.instanced&&this.parameters.instanced.indexOf("color")>-1,this.techniqueConfig.receiveShadows=this.parameters.receiveShadows&&this.parameters.shadowMappingEnabled,this.techniqueConfig.receiveAmbientOcclusion=!!t.ssaoEnabled&&this.parameters.receiveSSAO,this.techniqueConfig.vvColor=this.parameters.vvColorEnabled,this.techniqueConfig.textureAlphaPremultiplied=!!this.parameters.textureAlphaPremultiplied,this.techniqueConfig.usePBR=this.parameters.usePBR,this.techniqueConfig.hasMetalnessAndRoughnessTexture=!!this.parameters.metallicRoughnessTextureId,this.techniqueConfig.hasEmissionTexture=!!this.parameters.emissiveTextureId,this.techniqueConfig.hasOcclusionTexture=!!this.parameters.occlusionTextureId,this.techniqueConfig.offsetBackfaces=!(!this.parameters.transparent||!this.parameters.offsetTransparentBackfaces),this.techniqueConfig.isSchematic=this.parameters.usePBR&&this.parameters.isSchematic,this.techniqueConfig.transparencyPassType=t.transparencyPassType,this.techniqueConfig.enableOffset=t.camera.relativeElevation<5e5),this.techniqueConfig}intersect(e,t,r,i,n,a,s){if(null!==this.parameters.verticalOffset){const e=i.camera;(0,c.s)(qr,r[12],r[13],r[14]);let t=null;switch(i.viewingMode){case 1:t=(0,c.n)(Gr,qr);break;case 2:t=(0,c.g)(Gr,kr)}let o=0;if(null!==this.parameters.verticalOffset){const r=(0,c.f)($r,qr,e.eye),i=(0,c.l)(r),n=(0,c.a)(r,r,1/i);let a=null;this.parameters.screenSizePerspective&&(a=(0,c.d)(t,n)),o+=(0,we.Hx)(e,i,this.parameters.verticalOffset,a,this.parameters.screenSizePerspective)}(0,c.a)(t,t,o),(0,c.t)(Wr,t,i.transform.inverseRotation),n=(0,c.f)(Ur,n,Wr),a=(0,c.f)(Vr,a,Wr)}var l;(0,we.Bw)(e,t,i,n,a,(l=i.verticalOffset,(0,o.pC)(l)?(Rt.offset=l,Rt):null),s)}requiresSlot(e){return e===(this.parameters.transparent?this.parameters.writeDepth?4:7:2)||20===e}createGLMaterial(e){return 0===e.output||7===e.output||1===e.output||2===e.output||3===e.output||4===e.output?new Ir(e):null}createBufferWriter(){return new Br(this.vertexBufferLayout,this.instanceBufferLayout)}}class Ir extends class extends class{constructor(e){this._material=e.material,this._techniqueRep=e.techniqueRep,this._output=e.output}dispose(){this._techniqueRep.release(this._technique)}get technique(){return this._technique}ensureTechnique(e,t,r=this._output){return this._technique=this._techniqueRep.releaseAndAcquire(e,this._material.getTechniqueConfig(r,t),this._technique),this._technique}ensureResources(e){return 2}}{constructor(e){super(e),this._numLoading=0,this._disposed=!1,this._textureRepository=e.textureRep,this._textureId=e.textureId,this._acquire(e.textureId).then((e=>this._texture=e)),this._acquire(e.normalTextureId).then((e=>this._textureNormal=e)),this._acquire(e.emissiveTextureId).then((e=>this._textureEmissive=e)),this._acquire(e.occlusionTextureId).then((e=>this._textureOcclusion=e)),this._acquire(e.metallicRoughnessTextureId).then((e=>this._textureMetallicRoughness=e))}dispose(){this._texture=(0,o.RY)(this._texture),this._textureNormal=(0,o.RY)(this._textureNormal),this._textureEmissive=(0,o.RY)(this._textureEmissive),this._textureOcclusion=(0,o.RY)(this._textureOcclusion),this._textureMetallicRoughness=(0,o.RY)(this._textureMetallicRoughness),this._disposed=!0}ensureResources(e){return 0===this._numLoading?2:1}updateTexture(e){((0,o.Wi)(this._texture)||e!==this._texture.id)&&(this._texture=(0,o.RY)(this._texture),this._textureId=e,this._acquire(this._textureId).then((e=>this._texture=e)))}bindTextures(e){(0,o.pC)(this._texture)&&e.bindTexture(this._texture.glTexture,"tex"),(0,o.pC)(this._textureNormal)&&e.bindTexture(this._textureNormal.glTexture,"normalTexture"),(0,o.pC)(this._textureEmissive)&&e.bindTexture(this._textureEmissive.glTexture,"texEmission"),(0,o.pC)(this._textureOcclusion)&&e.bindTexture(this._textureOcclusion.glTexture,"texOcclusion"),(0,o.pC)(this._textureMetallicRoughness)&&e.bindTexture(this._textureMetallicRoughness.glTexture,"texMetallicRoughness")}bindTextureScale(e){const t=(0,o.pC)(this._texture)?this._texture.glTexture:null;(0,o.pC)(t)&&t.descriptor.textureCoordinateScaleFactor?e.setUniform2fv("textureCoordinateScaleFactor",t.descriptor.textureCoordinateScaleFactor):e.setUniform2f("textureCoordinateScaleFactor",1,1)}_acquire(e){return(0,o.Wi)(e)?Promise.resolve(null):(++this._numLoading,this._textureRepository.acquire(e).then((e=>this._disposed?((0,o.RY)(e),null):e)).finally((()=>--this._numLoading)))}}{constructor(e){super({...e,...e.material.parameters})}updateParameters(e){const t=this._material.parameters;return this.updateTexture(t.textureId),this.ensureTechnique(t.treeRendering?zr:Dr,e)}_updateShadowState(e){e.shadowMappingEnabled!==this._material.parameters.shadowMappingEnabled&&this._material.setParameters({shadowMappingEnabled:e.shadowMappingEnabled})}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.sceneHasOcludees&&this._material.setParameters({sceneHasOcludees:e.hasOccludees})}beginSlot(e){return 0!==this._output&&7!==this._output||(this._updateShadowState(e),this._updateOccludeeState(e)),this.updateParameters(e)}bind(e,t){t.bindPass(this._material.parameters,e),this.bindTextures(t.program)}}const Nr={textureId:void 0,initTextureTransparent:!1,isSchematic:!1,usePBR:!1,normalTextureId:void 0,vertexTangents:!1,occlusionTextureId:void 0,emissiveTextureId:void 0,metallicRoughnessTextureId:void 0,emissiveFactor:[0,0,0],mrrFactors:[0,1,.5],ambient:[.2,.2,.2],diffuse:[.8,.8,.8],externalColor:[1,1,1,1],colorMixMode:"multiply",opacity:1,layerOpacity:1,vertexColors:!1,symbolColors:!1,doubleSided:!1,doubleSidedType:"normal",cullFace:2,instanced:void 0,instancedDoublePrecision:!1,normals:"default",receiveSSAO:!0,receiveShadows:!0,castShadows:!0,shadowMappingEnabled:!1,verticalOffset:null,screenSizePerspective:null,slicePlaneEnabled:!1,sliceHighlightDisabled:!1,offsetTransparentBackfaces:!1,vvSizeEnabled:!1,vvSizeMinSize:[1,1,1],vvSizeMaxSize:[100,100,100],vvSizeOffset:[0,0,0],vvSizeFactor:[1,1,1],vvSizeValue:[1,1,1],vvColorEnabled:!1,vvColorValues:[0,0,0,0,0,0,0,0],vvColorColors:[1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0],vvSymbolAnchor:[0,0,0],vvSymbolRotationMatrix:(0,a.c)(),transparent:!1,writeDepth:!0,textureAlphaMode:0,textureAlphaCutoff:Me.F,textureAlphaPremultiplied:!1,sceneHasOcludees:!1,renderOccluded:1};class Br{constructor(e,t){this.vertexBufferLayout=e,this.instanceBufferLayout=t}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return e.indices.get("position").length}write(e,t,r,i){!function(e,t,r,i,o,n){for(const a of t.fieldNames){const t=e.vertexAttributes.get(a),s=e.indices.get(a);if(t&&s)switch(a){case"position":{(0,A.hu)(3===t.size);const e=o.getField(a,h.ct);e&&It(s,t.data,r,e,n);break}case"normal":{(0,A.hu)(3===t.size);const e=o.getField(a,h.ct);e&&Nt(s,t.data,i,e,n);break}case"uv0":{(0,A.hu)(2===t.size);const e=o.getField(a,h.Eu);e&&zt(s,t.data,e,n);break}case"color":{(0,A.hu)(3===t.size||4===t.size);const e=o.getField(a,h.mc);e&&Ut(s,t.data,t.size,e,n);break}case"symbolColor":{(0,A.hu)(3===t.size||4===t.size);const e=o.getField(a,h.mc);e&&Ut(s,t.data,t.size,e,n);break}case"tangent":{(0,A.hu)(4===t.size);const e=o.getField(a,h.ek);e&&Bt(s,t.data,i,e,n);break}}}}(t,this.vertexBufferLayout,e.transformation,e.invTranspTransformation,r,i)}}const Ur=(0,d.c)(),Vr=(0,d.c)(),kr=(0,d.f)(0,0,1),Gr=(0,d.c)(),Wr=(0,d.c)(),qr=(0,d.c)(),$r=(0,d.c)(),jr=y.Z.getLogger("esri.views.3d.layers.graphics.objectResourceUtils");function Xr(e){throw new T.Z("",`Request for object resource failed: ${e}`)}function Zr(e){const t=e.params,r=t.topology;let i=!0;switch(t.vertexAttributes||(jr.warn("Geometry must specify vertex attributes"),i=!1),t.topology){case"PerAttributeArray":break;case"Indexed":case null:case void 0:{const e=t.faces;if(e){if(t.vertexAttributes)for(const r in t.vertexAttributes){const t=e[r];t&&t.values?(null!=t.valueType&&"UInt32"!==t.valueType&&(jr.warn(`Unsupported indexed geometry indices type '${t.valueType}', only UInt32 is currently supported`),i=!1),null!=t.valuesPerElement&&1!==t.valuesPerElement&&(jr.warn(`Unsupported indexed geometry values per element '${t.valuesPerElement}', only 1 is currently supported`),i=!1)):(jr.warn(`Indexed geometry does not specify face indices for '${r}' attribute`),i=!1)}}else jr.warn("Indexed geometries must specify faces"),i=!1;break}default:jr.warn(`Unsupported topology '${r}'`),i=!1}e.params.material||(jr.warn("Geometry requires material"),i=!1);const o=e.params.vertexAttributes;for(const e in o)o[e].values||(jr.warn("Geometries with externally defined attributes are not yet supported"),i=!1);return i}function Kr(e){const t=(0,u.cS)();return e.forEach((e=>{const r=e.boundingInfo;(0,o.pC)(r)&&((0,u.pp)(t,r.getBBMin()),(0,u.pp)(t,r.getBBMax()))})),t}async function Yr(e,t){const r=[];for(const i in e){const n=e[i],a=n.images[0].data;if(!a){jr.warn("Externally referenced texture data is not yet supported");continue}const s=n.encoding+";base64,"+a,l="/textureDefinitions/"+i,c="rgba"===n.channels?n.alphaChannelUsage||"transparency":"none",d={noUnpackFlip:!0,wrap:{s:10497,t:10497},preMultiplyAlpha:1!==Qr(c)},u=(0,o.pC)(t)&&t.disableTextures?Promise.resolve(null):S(s,t);r.push(u.then((e=>({refId:l,image:e,params:d,alphaChannelUsage:c}))))}const i=await Promise.all(r),n={};for(const e of i)n[e.refId]=e;return n}function Qr(e){switch(e){case"mask":return 2;case"maskAndTransparency":return 3;case"none":return 1;default:return 0}}function Jr(e){const t=e.params;return{id:1,material:t.material,texture:t.texture,region:t.texture}}const ei=new w.G(1,2,"wosr");var ti=r(57758),ri=r(10816),ii=r(75488),oi=r(56067);async function ni(e,t){const r=ai((0,i.pJ)(e));if("wosr"===r.fileType){const e=await(t.cache?t.cache.loadWOSR(r.url,t):async function(e,t){const r=await async function(e,t){const r=(0,o.pC)(t)&&t.streamDataRequester;if(r)return async function(e,t,r){const i=await(0,b.q6)(t.request(e,"json",r));if(!0===i.ok)return i.value;(0,M.r9)(i.error),Xr(i.error.details.url)}(e,r,t);const i=await(0,b.q6)((0,_.default)(e,(0,o.Wg)(t)));if(!0===i.ok)return i.value.data;(0,M.r9)(i.error),Xr(i.error)}(e,t);return{resource:r,textures:await Yr(r.textureDefinitions,t)}}(r.url,t)),i=function(e,t){const r=[],i=[],n=[],a=[],s=e.resource,l=w.G.parse(s.version||"1.0","wosr");ei.validate(l);const c=s.model.name,u=s.model.geometries,h=s.materialDefinitions,f=e.textures;let m=0;const p=new Map;for(let e=0;e<u.length;e++){const s=u[e];if(!Zr(s))continue;const l=Jr(s),c=s.params.vertexAttributes,g=[];for(const e in c){const t=c[e],r=t.values;g.push([e,{data:r,size:t.valuesPerElement,exclusive:!0}])}const v=[];if("PerAttributeArray"!==s.params.topology){const e=s.params.faces;for(const t in e)v.push([t,new Uint32Array(e[t].values)])}const x=f&&f[l.texture];if(x&&!p.has(l.texture)){const{image:e,params:t}=x,r=new Te(e,t);a.push(r),p.set(l.texture,r)}const _=p.get(l.texture),b=_?_.id:void 0;let T=n[l.material]?n[l.material][l.texture]:null;if(!T){const e=h[l.material.substring(l.material.lastIndexOf("/")+1)].params;1===e.transparency&&(e.transparency=0);const r=x&&x.alphaChannelUsage,i=e.transparency>0||"transparency"===r||"maskAndTransparency"===r,a=x?Qr(x.alphaChannelUsage):void 0,s={ambient:(0,d.d)(e.diffuse),diffuse:(0,d.d)(e.diffuse),opacity:1-(e.transparency||0),transparent:i,textureAlphaMode:a,textureAlphaCutoff:.33,textureId:b,initTextureTransparent:!0,doubleSided:!0,cullFace:0,colorMixMode:e.externalColorMixMode||"tint",textureAlphaPremultiplied:!!x&&!!x.params.preMultiplyAlpha};(0,o.pC)(t)&&t.materialParamsMixin&&Object.assign(s,t.materialParamsMixin),T=new Hr(s),n[l.material]||(n[l.material]={}),n[l.material][l.texture]=T}i.push(T);const y=new R(g,v);m+=v.position?v.position.length:0,r.push(y)}return{name:c,stageResources:{textures:a,materials:i,geometries:r},pivotOffset:s.model.pivotOffset,boundingBox:Kr(r),numberOfVertices:m,lodThreshold:null}}(e,t);return{lods:[i],referenceBoundingBox:i.boundingBox,isEsriSymbolResource:!1,isWosr:!0,remove:e.remove}}const n=await(t.cache?t.cache.loadGLTF(r.url,t,t.usePBR):(0,v.z)(new g.C(t.streamDataRequester),r.url,t,t.usePBR)),a=(0,o.U2)(n.model.meta,"ESRI_proxyEllipsoid");n.meta.isEsriSymbolResource&&(0,o.pC)(a)&&-1!==n.meta.uri.indexOf("/RealisticTrees/")&&function(e,t){for(let r=0;r<e.model.lods.length;++r){const i=e.model.lods[r];e.customMeta.esriTreeRendering=!0;for(const n of i.parts){const i=n.attributes.normal;if((0,o.Wi)(i))return;const a=n.attributes.position,u=a.count,f=(0,d.c)(),m=(0,d.c)(),g=(0,d.c)(),v=(0,p.gS)(h.mc,u),x=(0,p.gS)(h.ct,u),_=(0,s.b)((0,l.c)(),n.transform);for(let o=0;o<u;o++){a.getVec(o,m),i.getVec(o,f),(0,c.m)(m,m,n.transform),(0,c.f)(g,m,t.center),(0,c.E)(g,g,t.radius);const s=g[2],l=(0,c.l)(g),d=Math.min(.45+.55*l*l,1);(0,c.E)(g,g,t.radius),(0,c.m)(g,g,_),(0,c.n)(g,g),r+1!==e.model.lods.length&&e.model.lods.length>1&&(0,c.e)(g,g,f,s>-1?.2:Math.min(-4*s-3.8,1)),x.setVec(o,g),v.set(o,0,255*d),v.set(o,1,255*d),v.set(o,2,255*d),v.set(o,3,255)}n.attributes.normal=x,n.attributes.color=v}}}(n,a);const u=n.meta.isEsriSymbolResource?{usePBR:t.usePBR,isSchematic:!1,treeRendering:n.customMeta.esriTreeRendering,mrrFactors:[0,1,.2]}:{usePBR:t.usePBR,isSchematic:!1,mrrFactors:[0,1,.5]},f={...t.materialParamsMixin,treeRendering:n.customMeta.esriTreeRendering};if(null!=r.specifiedLodIndex){const e=si(n,u,f,r.specifiedLodIndex);let t=e[0].boundingBox;return 0!==r.specifiedLodIndex&&(t=si(n,u,f,0)[0].boundingBox),{lods:e,referenceBoundingBox:t,isEsriSymbolResource:n.meta.isEsriSymbolResource,isWosr:!1,remove:n.remove}}const m=si(n,u,f);return{lods:m,referenceBoundingBox:m[0].boundingBox,isEsriSymbolResource:n.meta.isEsriSymbolResource,isWosr:!1,remove:n.remove}}function ai(e){const t=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);return t?{fileType:"gltf",url:t[1],specifiedLodIndex:null!=t[4]?Number(t[4]):null}:e.match(/(.*\.(json|json\.gz))$/)?{fileType:"wosr",url:e,specifiedLodIndex:null}:{fileType:"unknown",url:e,specifiedLodIndex:null}}function si(e,t,r,i){const s=e.model,l=(0,a.c)(),c=new Array,d=new Map,g=new Map;return s.lods.forEach(((e,a)=>{if(void 0!==i&&a!==i)return;const v={name:e.name,stageResources:{textures:new Array,materials:new Array,geometries:new Array},lodThreshold:(0,o.pC)(e.lodThreshold)?e.lodThreshold:null,pivotOffset:[0,0,0],numberOfVertices:0,boundingBox:(0,u.cS)()};c.push(v),e.parts.forEach((e=>{const i=e.material+(e.attributes.normal?"_normal":"")+(e.attributes.color?"_color":"")+(e.attributes.texCoord0?"_texCoord0":"")+(e.attributes.tangent?"_tangent":""),a=s.materials.get(e.material),c=(0,o.pC)(e.attributes.texCoord0),_=(0,o.pC)(e.attributes.normal),b=function(e){switch(e){case"BLEND":return 0;case"MASK":return 2;case"OPAQUE":case null:case void 0:return 1}}(a.alphaMode);if(!d.has(i)){if(c){if((0,o.pC)(a.textureColor)&&!g.has(a.textureColor)){const e=s.textures.get(a.textureColor),t={...e.parameters,preMultiplyAlpha:1!==b};g.set(a.textureColor,new Te(e.data,t))}if((0,o.pC)(a.textureNormal)&&!g.has(a.textureNormal)){const e=s.textures.get(a.textureNormal);g.set(a.textureNormal,new Te(e.data,e.parameters))}if((0,o.pC)(a.textureOcclusion)&&!g.has(a.textureOcclusion)){const e=s.textures.get(a.textureOcclusion);g.set(a.textureOcclusion,new Te(e.data,e.parameters))}if((0,o.pC)(a.textureEmissive)&&!g.has(a.textureEmissive)){const e=s.textures.get(a.textureEmissive);g.set(a.textureEmissive,new Te(e.data,e.parameters))}if((0,o.pC)(a.textureMetallicRoughness)&&!g.has(a.textureMetallicRoughness)){const e=s.textures.get(a.textureMetallicRoughness);g.set(a.textureMetallicRoughness,new Te(e.data,e.parameters))}}const n=a.color[0]**(1/ti.K),l=a.color[1]**(1/ti.K),u=a.color[2]**(1/ti.K),h=a.emissiveFactor[0]**(1/ti.K),f=a.emissiveFactor[1]**(1/ti.K),m=a.emissiveFactor[2]**(1/ti.K),p=(0,o.pC)(a.textureColor)&&c?g.get(a.textureColor):null;d.set(i,new Hr({...t,transparent:0===b,textureAlphaMode:b,textureAlphaCutoff:a.alphaCutoff,diffuse:[n,l,u],ambient:[n,l,u],opacity:a.opacity,doubleSided:a.doubleSided,doubleSidedType:"winding-order",cullFace:a.doubleSided?0:2,vertexColors:!!e.attributes.color,vertexTangents:!!e.attributes.tangent,normals:_?"default":"screenDerivative",castShadows:!0,receiveSSAO:!0,textureId:(0,o.pC)(p)?p.id:void 0,colorMixMode:a.colorMixMode,normalTextureId:(0,o.pC)(a.textureNormal)&&c?g.get(a.textureNormal).id:void 0,textureAlphaPremultiplied:(0,o.pC)(p)&&!!p.params.preMultiplyAlpha,occlusionTextureId:(0,o.pC)(a.textureOcclusion)&&c?g.get(a.textureOcclusion).id:void 0,emissiveTextureId:(0,o.pC)(a.textureEmissive)&&c?g.get(a.textureEmissive).id:void 0,metallicRoughnessTextureId:(0,o.pC)(a.textureMetallicRoughness)&&c?g.get(a.textureMetallicRoughness).id:void 0,emissiveFactor:[h,f,m],mrrFactors:[a.metallicFactor,a.roughnessFactor,t.mrrFactors[2]],isSchematic:!1,...r}))}const T=function(e,t){switch(t){case 4:return(0,x.nh)(e);case 5:return(0,x.DA)(e);case 6:return(0,x.jX)(e)}}(e.indices||e.attributes.position.count,e.primitiveType),y=e.attributes.position.count,M=(0,p.gS)(h.ct,y);(0,f.t)(M,e.attributes.position,e.transform);const w=[["position",{data:M.typedBuffer,size:M.elementCount,exclusive:!0}]],S=[["position",T]];if((0,o.pC)(e.attributes.normal)){const t=(0,p.gS)(h.ct,y);(0,n.a)(l,e.transform),(0,f.a)(t,e.attributes.normal,l),w.push(["normal",{data:t.typedBuffer,size:t.elementCount,exclusive:!0}]),S.push(["normal",T])}if((0,o.pC)(e.attributes.tangent)){const t=(0,p.gS)(h.ek,y);(0,n.a)(l,e.transform),(0,m.t)(t,e.attributes.tangent,l),w.push(["tangent",{data:t.typedBuffer,size:t.elementCount,exclusive:!0}]),S.push(["tangent",T])}if((0,o.pC)(e.attributes.texCoord0)){const t=(0,p.gS)(h.Eu,y);(0,ri.n)(t,e.attributes.texCoord0),w.push(["uv0",{data:t.typedBuffer,size:t.elementCount,exclusive:!0}]),S.push(["uv0",T])}if((0,o.pC)(e.attributes.color)){const t=(0,p.gS)(h.mc,y);if(4===e.attributes.color.elementCount)e.attributes.color instanceof h.ek?(0,m.s)(t,e.attributes.color,255):e.attributes.color instanceof h.mc?(0,ii.c)(t,e.attributes.color):e.attributes.color instanceof h.v6&&(0,m.s)(t,e.attributes.color,1/256);else{(0,ii.f)(t,255,255,255,255);const r=new h.ne(t.buffer,0,4);e.attributes.color instanceof h.ct?(0,f.s)(r,e.attributes.color,255):e.attributes.color instanceof h.ne?(0,oi.c)(r,e.attributes.color):e.attributes.color instanceof h.mw&&(0,f.s)(r,e.attributes.color,1/256)}w.push(["color",{data:t.typedBuffer,size:t.elementCount,exclusive:!0}]),S.push(["color",T])}const C=new R(w,S);v.stageResources.geometries.push(C),v.stageResources.materials.push(d.get(i)),c&&((0,o.pC)(a.textureColor)&&v.stageResources.textures.push(g.get(a.textureColor)),(0,o.pC)(a.textureNormal)&&v.stageResources.textures.push(g.get(a.textureNormal)),(0,o.pC)(a.textureOcclusion)&&v.stageResources.textures.push(g.get(a.textureOcclusion)),(0,o.pC)(a.textureEmissive)&&v.stageResources.textures.push(g.get(a.textureEmissive)),(0,o.pC)(a.textureMetallicRoughness)&&v.stageResources.textures.push(g.get(a.textureMetallicRoughness))),v.numberOfVertices+=y;const A=C.boundingInfo;(0,o.pC)(A)&&((0,u.pp)(v.boundingBox,A.getBBMin()),(0,u.pp)(v.boundingBox,A.getBBMax()))}))})),c}},65576:(e,t,r)=>{r.d(t,{U$:()=>s});var i=r(56481),o=r(79583);class n{constructor(e,t){this.layout=e,this.buffer="number"==typeof t?new ArrayBuffer(t*e.stride):t;for(const t of e.fieldNames){const r=e.fields.get(t);this[t]=new r.constructor(this.buffer,r.offset,this.stride)}}get stride(){return this.layout.stride}get count(){return this.buffer.byteLength/this.stride}get byteLength(){return this.buffer.byteLength}getField(e,t){const r=this[e];return r&&r.elementCount===t.ElementCount&&r.elementType===t.ElementType?r:null}slice(e,t){return new n(this.layout,this.buffer.slice(e*this.stride,t*this.stride))}copyFrom(e,t,r,i){const o=this.stride;if(o%4==0){const n=new Uint32Array(e.buffer,t*o,i*o/4);new Uint32Array(this.buffer,r*o,i*o/4).set(n)}else{const n=new Uint8Array(e.buffer,t*o,i*o);new Uint8Array(this.buffer,r*o,i*o).set(n)}}}class a{constructor(){this.stride=0,this.fields=new Map,this.fieldNames=[]}vec2f(e,t){return this.appendField(e,i.Eu,t),this}vec2f64(e,t){return this.appendField(e,i.q6,t),this}vec3f(e,t){return this.appendField(e,i.ct,t),this}vec3f64(e,t){return this.appendField(e,i.fP,t),this}vec4f(e,t){return this.appendField(e,i.ek,t),this}vec4f64(e,t){return this.appendField(e,i.Cd,t),this}mat3f(e,t){return this.appendField(e,i.gK,t),this}mat3f64(e,t){return this.appendField(e,i.ey,t),this}mat4f(e,t){return this.appendField(e,i.bj,t),this}mat4f64(e,t){return this.appendField(e,i.O1,t),this}vec4u8(e,t){return this.appendField(e,i.mc,t),this}f32(e,t){return this.appendField(e,i.ly,t),this}f64(e,t){return this.appendField(e,i.oS,t),this}u8(e,t){return this.appendField(e,i.D_,t),this}u16(e,t){return this.appendField(e,i.av,t),this}i8(e,t){return this.appendField(e,i.Hz,t),this}vec2i8(e,t){return this.appendField(e,i.Vs,t),this}vec2i16(e,t){return this.appendField(e,i.or,t),this}vec2u8(e,t){return this.appendField(e,i.xA,t),this}vec4u16(e,t){return this.appendField(e,i.v6,t),this}u32(e,t){return this.appendField(e,i.Nu,t),this}appendField(e,t,r){const i=t.ElementCount*(0,o.n1)(t.ElementType),n=this.stride;this.fields.set(e,{size:i,constructor:t,offset:n,optional:r}),this.stride+=i,this.fieldNames.push(e)}alignTo(e){return this.stride=Math.floor((this.stride+e-1)/e)*e,this}hasField(e){return this.fieldNames.indexOf(e)>=0}createBuffer(e){return new n(this,e)}createView(e){return new n(this,e)}clone(){const e=new a;return e.stride=this.stride,e.fields=new Map,this.fields.forEach(((t,r)=>e.fields.set(r,t))),e.fieldNames=this.fieldNames.slice(),e.BufferType=this.BufferType,e}}function s(){return new a}},1391:(e,t,r)=>{r.d(t,{q:()=>o});var i=r(74709);function o(e,t){0===t.output&&t.receiveShadows?(e.varyings.add("linearDepth","float"),e.vertex.code.add(i.H`void forwardLinearDepth() { linearDepth = gl_Position.w; }`)):1===t.output||3===t.output?(e.varyings.add("linearDepth","float"),e.vertex.uniforms.add("cameraNearFar","vec2"),e.vertex.code.add(i.H`void forwardLinearDepth() {
159
+ `)),t.include(m.s,e),t}const P=Object.freeze({__proto__:null,build:A})},21787:(e,t,r)=>{r.d(t,{a:()=>s,f:()=>o,i:()=>c,t:()=>n});var i=r(46851);function o(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}function n(e,t){if(e===t){const r=t[1],i=t[2],o=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=i,e[7]=o}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function a(e,t,r){const i=t[0],o=t[1],n=t[2],a=t[3],s=t[4],l=t[5],c=t[6],d=t[7],u=t[8],h=r[0],f=r[1],m=r[2],p=r[3],g=r[4],v=r[5],x=r[6],_=r[7],b=r[8];return e[0]=h*i+f*a+m*c,e[1]=h*o+f*s+m*d,e[2]=h*n+f*l+m*u,e[3]=p*i+g*a+v*c,e[4]=p*o+g*s+v*d,e[5]=p*n+g*l+v*u,e[6]=x*i+_*a+b*c,e[7]=x*o+_*s+b*d,e[8]=x*n+_*l+b*u,e}function s(e,t){const r=t[0],i=t[1],o=t[2],n=t[3],a=t[4],s=t[5],l=t[6],c=t[7],d=t[8],u=t[9],h=t[10],f=t[11],m=t[12],p=t[13],g=t[14],v=t[15],x=r*s-i*a,_=r*l-o*a,b=r*c-n*a,T=i*l-o*s,y=i*c-n*s,M=o*c-n*l,w=d*p-u*m,S=d*g-h*m,C=d*v-f*m,A=u*g-h*p,P=u*v-f*p,F=h*v-f*g;let E=x*F-_*P+b*A+T*C-y*S+M*w;return E?(E=1/E,e[0]=(s*F-l*P+c*A)*E,e[1]=(l*C-a*F-c*S)*E,e[2]=(a*P-s*C+c*w)*E,e[3]=(o*P-i*F-n*A)*E,e[4]=(r*F-o*C+n*S)*E,e[5]=(i*C-r*P-n*w)*E,e[6]=(p*M-g*y+v*T)*E,e[7]=(g*b-m*M-v*_)*E,e[8]=(m*y-p*b+v*x)*E,e):null}function l(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e}function c(e){const t=i.E,r=e[0],o=e[1],n=e[2],a=e[3],s=e[4],l=e[5],c=e[6],d=e[7],u=e[8];return Math.abs(1-(r*r+a*a+c*c))<=t&&Math.abs(1-(o*o+s*s+d*d))<=t&&Math.abs(1-(n*n+l*l+u*u))<=t}const d=a,u=l;Object.freeze({__proto__:null,fromMat4:o,copy:function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},set:function(e,t,r,i,o,n,a,s,l,c){return e[0]=t,e[1]=r,e[2]=i,e[3]=o,e[4]=n,e[5]=a,e[6]=s,e[7]=l,e[8]=c,e},identity:function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},transpose:n,invert:function(e,t){const r=t[0],i=t[1],o=t[2],n=t[3],a=t[4],s=t[5],l=t[6],c=t[7],d=t[8],u=d*a-s*c,h=-d*n+s*l,f=c*n-a*l;let m=r*u+i*h+o*f;return m?(m=1/m,e[0]=u*m,e[1]=(-d*i+o*c)*m,e[2]=(s*i-o*a)*m,e[3]=h*m,e[4]=(d*r-o*l)*m,e[5]=(-s*r+o*n)*m,e[6]=f*m,e[7]=(-c*r+i*l)*m,e[8]=(a*r-i*n)*m,e):null},adjoint:function(e,t){const r=t[0],i=t[1],o=t[2],n=t[3],a=t[4],s=t[5],l=t[6],c=t[7],d=t[8];return e[0]=a*d-s*c,e[1]=o*c-i*d,e[2]=i*s-o*a,e[3]=s*l-n*d,e[4]=r*d-o*l,e[5]=o*n-r*s,e[6]=n*c-a*l,e[7]=i*l-r*c,e[8]=r*a-i*n,e},determinant:function(e){const t=e[0],r=e[1],i=e[2],o=e[3],n=e[4],a=e[5],s=e[6],l=e[7],c=e[8];return t*(c*n-a*l)+r*(-c*o+a*s)+i*(l*o-n*s)},multiply:a,translate:function(e,t,r){const i=t[0],o=t[1],n=t[2],a=t[3],s=t[4],l=t[5],c=t[6],d=t[7],u=t[8],h=r[0],f=r[1];return e[0]=i,e[1]=o,e[2]=n,e[3]=a,e[4]=s,e[5]=l,e[6]=h*i+f*a+c,e[7]=h*o+f*s+d,e[8]=h*n+f*l+u,e},rotate:function(e,t,r){const i=t[0],o=t[1],n=t[2],a=t[3],s=t[4],l=t[5],c=t[6],d=t[7],u=t[8],h=Math.sin(r),f=Math.cos(r);return e[0]=f*i+h*a,e[1]=f*o+h*s,e[2]=f*n+h*l,e[3]=f*a-h*i,e[4]=f*s-h*o,e[5]=f*l-h*n,e[6]=c,e[7]=d,e[8]=u,e},scale:function(e,t,r){const i=r[0],o=r[1],n=r[2];return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=o*t[3],e[4]=o*t[4],e[5]=o*t[5],e[6]=n*t[6],e[7]=n*t[7],e[8]=n*t[8],e},scaleByVec2:function(e,t,r){const i=r[0],o=r[1];return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=o*t[3],e[4]=o*t[4],e[5]=o*t[5],e},fromTranslation:function(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e},fromRotation:function(e,t){const r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=r,e[2]=0,e[3]=-r,e[4]=i,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},fromScaling:function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},fromMat2d:function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e},fromQuat:function(e,t){const r=t[0],i=t[1],o=t[2],n=t[3],a=r+r,s=i+i,l=o+o,c=r*a,d=i*a,u=i*s,h=o*a,f=o*s,m=o*l,p=n*a,g=n*s,v=n*l;return e[0]=1-u-m,e[3]=d-v,e[6]=h+g,e[1]=d+v,e[4]=1-c-m,e[7]=f-p,e[2]=h-g,e[5]=f+p,e[8]=1-c-u,e},normalFromMat4Legacy:function(e,t){const r=t[0],i=t[1],o=t[2],n=t[4],a=t[5],s=t[6],l=t[8],c=t[9],d=t[10],u=d*a-s*c,h=-d*n+s*l,f=c*n-a*l,m=r*u+i*h+o*f;if(!m)return null;const p=1/m;return e[0]=u*p,e[1]=(-d*i+o*c)*p,e[2]=(s*i-o*a)*p,e[3]=h*p,e[4]=(d*r-o*l)*p,e[5]=(-s*r+o*n)*p,e[6]=f*p,e[7]=(-c*r+i*l)*p,e[8]=(a*r-i*n)*p,e},normalFromMat4:s,projection:function(e,t,r){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/r,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e},str:function(e){return"mat3("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+")"},frob:function(e){return Math.sqrt(e[0]**2+e[1]**2+e[2]**2+e[3]**2+e[4]**2+e[5]**2+e[6]**2+e[7]**2+e[8]**2)},add:function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e},subtract:l,multiplyScalar:function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e},multiplyScalarAndAdd:function(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e[3]=t[3]+r[3]*i,e[4]=t[4]+r[4]*i,e[5]=t[5]+r[5]*i,e[6]=t[6]+r[6]*i,e[7]=t[7]+r[7]*i,e[8]=t[8]+r[8]*i,e},exactEquals:function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},equals:function(e,t){const r=e[0],o=e[1],n=e[2],a=e[3],s=e[4],l=e[5],c=e[6],d=e[7],u=e[8],h=t[0],f=t[1],m=t[2],p=t[3],g=t[4],v=t[5],x=t[6],_=t[7],b=t[8];return Math.abs(r-h)<=i.E*Math.max(1,Math.abs(r),Math.abs(h))&&Math.abs(o-f)<=i.E*Math.max(1,Math.abs(o),Math.abs(f))&&Math.abs(n-m)<=i.E*Math.max(1,Math.abs(n),Math.abs(m))&&Math.abs(a-p)<=i.E*Math.max(1,Math.abs(a),Math.abs(p))&&Math.abs(s-g)<=i.E*Math.max(1,Math.abs(s),Math.abs(g))&&Math.abs(l-v)<=i.E*Math.max(1,Math.abs(l),Math.abs(v))&&Math.abs(c-x)<=i.E*Math.max(1,Math.abs(c),Math.abs(x))&&Math.abs(d-_)<=i.E*Math.max(1,Math.abs(d),Math.abs(_))&&Math.abs(u-b)<=i.E*Math.max(1,Math.abs(u),Math.abs(b))},isOrthoNormal:c,mul:d,sub:u})},46521:(e,t,r)=>{function i(){return[1,0,0,0,1,0,0,0,1]}function o(e,t){return new Float64Array(e,t,9)}r.d(t,{a:()=>o,c:()=>i}),Object.freeze({__proto__:null,create:i,clone:function(e){return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},fromValues:function(e,t,r,i,o,n,a,s,l){return[e,t,r,i,o,n,a,s,l]},createView:o})},13598:(e,t,r)=>{function i(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function o(e){return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]}function n(e,t){return new Float64Array(e,t,16)}r.d(t,{I:()=>a,a:()=>n,b:()=>o,c:()=>i});const a=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];Object.freeze({__proto__:null,create:i,clone:o,fromValues:function(e,t,r,i,o,n,a,s,l,c,d,u,h,f,m,p){return[e,t,r,i,o,n,a,s,l,c,d,u,h,f,m,p]},createView:n,IDENTITY:a})},51305:(e,t,r)=>{r.d(t,{c:()=>f,g:()=>d,j:()=>P,k:()=>p,m:()=>u,s:()=>c});var i=r(46521),o=r(94961),n=r(65617),a=r(46851),s=r(17896),l=r(98766);function c(e,t,r){r*=.5;const i=Math.sin(r);return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=Math.cos(r),e}function d(e,t){const r=2*Math.acos(t[3]),i=Math.sin(r/2);return i>a.E?(e[0]=t[0]/i,e[1]=t[1]/i,e[2]=t[2]/i):(e[0]=1,e[1]=0,e[2]=0),r}function u(e,t,r){const i=t[0],o=t[1],n=t[2],a=t[3],s=r[0],l=r[1],c=r[2],d=r[3];return e[0]=i*d+a*s+o*c-n*l,e[1]=o*d+a*l+n*s-i*c,e[2]=n*d+a*c+i*l-o*s,e[3]=a*d-i*s-o*l-n*c,e}function h(e,t,r,i){const o=t[0],n=t[1],s=t[2],l=t[3];let c,d,u,h,f,m=r[0],p=r[1],g=r[2],v=r[3];return d=o*m+n*p+s*g+l*v,d<0&&(d=-d,m=-m,p=-p,g=-g,v=-v),1-d>a.E?(c=Math.acos(d),u=Math.sin(c),h=Math.sin((1-i)*c)/u,f=Math.sin(i*c)/u):(h=1-i,f=i),e[0]=h*o+f*m,e[1]=h*n+f*p,e[2]=h*s+f*g,e[3]=h*l+f*v,e}function f(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function m(e,t){const r=t[0]+t[4]+t[8];let i;if(r>0)i=Math.sqrt(r+1),e[3]=.5*i,i=.5/i,e[0]=(t[5]-t[7])*i,e[1]=(t[6]-t[2])*i,e[2]=(t[1]-t[3])*i;else{let r=0;t[4]>t[0]&&(r=1),t[8]>t[3*r+r]&&(r=2);const o=(r+1)%3,n=(r+2)%3;i=Math.sqrt(t[3*r+r]-t[3*o+o]-t[3*n+n]+1),e[r]=.5*i,i=.5/i,e[3]=(t[3*o+n]-t[3*n+o])*i,e[o]=(t[3*o+r]+t[3*r+o])*i,e[n]=(t[3*n+r]+t[3*r+n])*i}return e}function p(e,t,r,i){const o=.5*Math.PI/180;t*=o,r*=o,i*=o;const n=Math.sin(t),a=Math.cos(t),s=Math.sin(r),l=Math.cos(r),c=Math.sin(i),d=Math.cos(i);return e[0]=n*l*d-a*s*c,e[1]=a*s*d+n*l*c,e[2]=a*l*c-n*s*d,e[3]=a*l*d+n*s*c,e}const g=l.c,v=l.s,x=l.a,_=u,b=l.b,T=l.d,y=l.l,M=l.e,w=M,S=l.f,C=S,A=l.n,P=l.g,F=l.h,E=(0,n.c)(),D=(0,n.f)(1,0,0),O=(0,n.f)(0,1,0),R=(0,o.a)(),L=(0,o.a)(),z=(0,i.c)();Object.freeze({__proto__:null,identity:function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e},setAxisAngle:c,getAxisAngle:d,multiply:u,rotateX:function(e,t,r){r*=.5;const i=t[0],o=t[1],n=t[2],a=t[3],s=Math.sin(r),l=Math.cos(r);return e[0]=i*l+a*s,e[1]=o*l+n*s,e[2]=n*l-o*s,e[3]=a*l-i*s,e},rotateY:function(e,t,r){r*=.5;const i=t[0],o=t[1],n=t[2],a=t[3],s=Math.sin(r),l=Math.cos(r);return e[0]=i*l-n*s,e[1]=o*l+a*s,e[2]=n*l+i*s,e[3]=a*l-o*s,e},rotateZ:function(e,t,r){r*=.5;const i=t[0],o=t[1],n=t[2],a=t[3],s=Math.sin(r),l=Math.cos(r);return e[0]=i*l+o*s,e[1]=o*l-i*s,e[2]=n*l+a*s,e[3]=a*l-n*s,e},calculateW:function(e,t){const r=t[0],i=t[1],o=t[2];return e[0]=r,e[1]=i,e[2]=o,e[3]=Math.sqrt(Math.abs(1-r*r-i*i-o*o)),e},slerp:h,random:function(e){const t=(0,a.R)(),r=(0,a.R)(),i=(0,a.R)(),o=Math.sqrt(1-t),n=Math.sqrt(t);return e[0]=o*Math.sin(2*Math.PI*r),e[1]=o*Math.cos(2*Math.PI*r),e[2]=n*Math.sin(2*Math.PI*i),e[3]=n*Math.cos(2*Math.PI*i),e},invert:function(e,t){const r=t[0],i=t[1],o=t[2],n=t[3],a=r*r+i*i+o*o+n*n,s=a?1/a:0;return e[0]=-r*s,e[1]=-i*s,e[2]=-o*s,e[3]=n*s,e},conjugate:f,fromMat3:m,fromEuler:p,str:function(e){return"quat("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},copy:g,set:v,add:x,mul:_,scale:b,dot:T,lerp:y,length:M,len:w,squaredLength:S,sqrLen:C,normalize:A,exactEquals:P,equals:F,rotationTo:function(e,t,r){const i=(0,s.d)(t,r);return i<-.999999?((0,s.c)(E,D,t),(0,s.u)(E)<1e-6&&(0,s.c)(E,O,t),(0,s.n)(E,E),c(e,E,Math.PI),e):i>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):((0,s.c)(E,t,r),e[0]=E[0],e[1]=E[1],e[2]=E[2],e[3]=1+i,A(e,e))},sqlerp:function(e,t,r,i,o,n){return h(R,t,o,n),h(L,r,i,n),h(e,R,L,2*n*(1-n)),e},setAxes:function(e,t,r,i){const o=z;return o[0]=r[0],o[3]=r[1],o[6]=r[2],o[1]=i[0],o[4]=i[1],o[7]=i[2],o[2]=-t[0],o[5]=-t[1],o[8]=-t[2],A(e,m(e,o))}})},94961:(e,t,r)=>{function i(){return[0,0,0,1]}function o(e){return[e[0],e[1],e[2],e[3]]}function n(e,t){return new Float64Array(e,t,4)}r.d(t,{I:()=>a,a:()=>i,b:()=>o,c:()=>n});const a=[0,0,0,1];Object.freeze({__proto__:null,create:i,clone:o,fromValues:function(e,t,r,i){return[e,t,r,i]},createView:n,IDENTITY:a})},20773:(e,t,r)=>{r.d(t,{a:()=>n,b:()=>l,n:()=>s,s:()=>a,t:()=>o});var i=r(72220);function o(e,t,r){if(e.count!==t.count)return void i.k.error("source and destination buffers need to have the same number of elements");const o=e.count,n=r[0],a=r[1],s=r[2],l=r[4],c=r[5],d=r[6],u=r[8],h=r[9],f=r[10],m=r[12],p=r[13],g=r[14],v=e.typedBuffer,x=e.typedBufferStride,_=t.typedBuffer,b=t.typedBufferStride;for(let e=0;e<o;e++){const t=e*x,r=e*b,i=_[r],o=_[r+1],T=_[r+2];v[t]=n*i+l*o+u*T+m,v[t+1]=a*i+c*o+h*T+p,v[t+2]=s*i+d*o+f*T+g}}function n(e,t,r){if(e.count!==t.count)return void i.k.error("source and destination buffers need to have the same number of elements");const o=e.count,n=r[0],a=r[1],s=r[2],l=r[3],c=r[4],d=r[5],u=r[6],h=r[7],f=r[8],m=e.typedBuffer,p=e.typedBufferStride,g=t.typedBuffer,v=t.typedBufferStride;for(let e=0;e<o;e++){const t=e*p,r=e*v,i=g[r],o=g[r+1],x=g[r+2];m[t]=n*i+l*o+u*x,m[t+1]=a*i+c*o+h*x,m[t+2]=s*i+d*o+f*x}}function a(e,t,r){const i=Math.min(e.count,t.count),o=e.typedBuffer,n=e.typedBufferStride,a=t.typedBuffer,s=t.typedBufferStride;for(let e=0;e<i;e++){const t=e*n,i=e*s;o[t]=r*a[i],o[t+1]=r*a[i+1],o[t+2]=r*a[i+2]}}function s(e,t){const r=Math.min(e.count,t.count),i=e.typedBuffer,o=e.typedBufferStride,n=t.typedBuffer,a=t.typedBufferStride;for(let e=0;e<r;e++){const t=e*o,r=e*a,s=n[r],l=n[r+1],c=n[r+2],d=Math.sqrt(s*s+l*l+c*c);if(d>0){const e=1/d;i[t]=e*s,i[t+1]=e*l,i[t+2]=e*c}}}function l(e,t,r){const i=Math.min(e.count,t.count),o=e.typedBuffer,n=e.typedBufferStride,a=t.typedBuffer,s=t.typedBufferStride;for(let e=0;e<i;e++){const t=e*n,i=e*s;o[t]=a[i]>>r,o[t+1]=a[i+1]>>r,o[t+2]=a[i+2]>>r}}Object.freeze({__proto__:null,transformMat4:o,transformMat3:n,scale:a,normalize:s,shiftRight:l})},56067:(e,t,r)=>{function i(e,t,r){const i=e.typedBuffer,o=e.typedBufferStride,n=t.typedBuffer,a=t.typedBufferStride,s=r?r.count:t.count;let l=(r&&r.dstIndex?r.dstIndex:0)*o,c=(r&&r.srcIndex?r.srcIndex:0)*a;for(let e=0;e<s;++e)i[l]=n[c],i[l+1]=n[c+1],i[l+2]=n[c+2],l+=o,c+=a}function o(e,t,r,i,o){var n,a;const s=e.typedBuffer,l=e.typedBufferStride,c=null!=(n=null==o?void 0:o.count)?n:e.count;let d=(null!=(a=null==o?void 0:o.dstIndex)?a:0)*l;for(let e=0;e<c;++e)s[d]=t,s[d+1]=r,s[d+2]=i,d+=l}r.d(t,{c:()=>i,f:()=>o}),Object.freeze({__proto__:null,copy:i,fill:o})},72119:(e,t,r)=>{function i(){return new Float32Array(3)}function o(e,t,r){const i=new Float32Array(3);return i[0]=e,i[1]=t,i[2]=r,i}function n(){return i()}function a(){return o(1,1,1)}function s(){return o(1,0,0)}function l(){return o(0,1,0)}function c(){return o(0,0,1)}r.d(t,{c:()=>i,f:()=>o});const d=n(),u=a(),h=s(),f=l(),m=c();Object.freeze({__proto__:null,create:i,clone:function(e){const t=new Float32Array(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},fromValues:o,createView:function(e,t){return new Float32Array(e,t,3)},zeros:n,ones:a,unitX:s,unitY:l,unitZ:c,ZEROS:d,ONES:u,UNIT_X:h,UNIT_Y:f,UNIT_Z:m})},32243:(e,t,r)=>{function i(e){return e=e||globalThis.location.hostname,c.some((t=>{var r;return null!=(null==(r=e)?void 0:r.match(t))}))}function o(e,t){return e&&(t=t||globalThis.location.hostname)?null!=t.match(n)||null!=t.match(s)?e.replace("static.arcgis.com","staticdev.arcgis.com"):null!=t.match(a)||null!=t.match(l)?e.replace("static.arcgis.com","staticqa.arcgis.com"):e:e}r.d(t,{pJ:()=>o,XO:()=>i});const n=/^devext.arcgis.com$/,a=/^qaext.arcgis.com$/,s=/^[\w-]*\.mapsdevext.arcgis.com$/,l=/^[\w-]*\.mapsqa.arcgis.com$/,c=[/^([\w-]*\.)?[\w-]*\.zrh-dev-local.esri.com$/,n,a,/^jsapps.esri.com$/,s,l]},72220:(e,t,r)=>{r.d(t,{k:()=>i});const i=r(92604).Z.getLogger("esri.views.3d.support.buffer.math")},52360:(e,t,r)=>{r.r(t),r.d(t,{fetch:()=>ni,gltfToEngineResources:()=>si,parseUrl:()=>ai});var i=r(32243),o=r(70586),n=r(21787),a=r(46521),s=r(52138),l=r(13598),c=r(17896),d=r(65617),u=r(60437),h=r(56481),f=r(20773),m=r(11077),p=r(8323),g=r(40270),v=r(24952),x=r(91911),_=r(3172),b=r(66643),T=r(20102),y=r(92604),M=r(95330),w=r(23670);async function S(e,t){const{data:r}=await(0,_.default)(e,{responseType:"image",...t});return r}var C=r(44553),A=r(11726);class P{constructor(e,t,r,i){this.primitiveIndices=e,this._numIndexPerPrimitive=t,this.indices=r,this.position=i,this.center=(0,d.c)(),(0,A.hu)(e.length>=1),(0,A.hu)(r.length%this._numIndexPerPrimitive==0),(0,A.hu)(r.length>=e.length*this._numIndexPerPrimitive),(0,A.hu)(3===i.size||4===i.size);const{data:o,size:n}=i,a=e.length;let s=n*r[this._numIndexPerPrimitive*e[0]];F.clear(),F.push(s),this.bbMin=(0,d.f)(o[s],o[s+1],o[s+2]),this.bbMax=(0,d.a)(this.bbMin);for(let t=0;t<a;++t){const i=this._numIndexPerPrimitive*e[t];for(let e=0;e<this._numIndexPerPrimitive;++e){s=n*r[i+e],F.push(s);let t=o[s];this.bbMin[0]=Math.min(t,this.bbMin[0]),this.bbMax[0]=Math.max(t,this.bbMax[0]),t=o[s+1],this.bbMin[1]=Math.min(t,this.bbMin[1]),this.bbMax[1]=Math.max(t,this.bbMax[1]),t=o[s+2],this.bbMin[2]=Math.min(t,this.bbMin[2]),this.bbMax[2]=Math.max(t,this.bbMax[2])}}(0,c.e)(this.center,this.bbMin,this.bbMax,.5),this.radius=.5*Math.max(Math.max(this.bbMax[0]-this.bbMin[0],this.bbMax[1]-this.bbMin[1]),this.bbMax[2]-this.bbMin[2]);let l=this.radius*this.radius;for(let e=0;e<F.length;++e){s=F.getItemAt(e);const t=o[s]-this.center[0],r=o[s+1]-this.center[1],i=o[s+2]-this.center[2],n=t*t+r*r+i*i;if(n<=l)continue;const a=Math.sqrt(n),c=.5*(a-this.radius);this.radius=this.radius+c,l=this.radius*this.radius;const d=c/a;this.center[0]+=t*d,this.center[1]+=r*d,this.center[2]+=i*d}F.clear()}getCenter(){return this.center}getBSRadius(){return this.radius}getBBMin(){return this.bbMin}getBBMax(){return this.bbMax}getChildren(){if(this._children)return this._children;if((0,c.h)(this.bbMin,this.bbMax)>1){const e=(0,c.e)((0,d.c)(),this.bbMin,this.bbMax,.5),t=this.primitiveIndices.length,r=new Uint8Array(t),i=new Array(8);for(let e=0;e<8;++e)i[e]=0;const{data:o,size:n}=this.position;for(let a=0;a<t;++a){let t=0;const s=this._numIndexPerPrimitive*this.primitiveIndices[a];let l=n*this.indices[s],c=o[l],d=o[l+1],u=o[l+2];for(let e=1;e<this._numIndexPerPrimitive;++e){l=n*this.indices[s+e];const t=o[l],r=o[l+1],i=o[l+2];t<c&&(c=t),r<d&&(d=r),i<u&&(u=i)}c<e[0]&&(t|=1),d<e[1]&&(t|=2),u<e[2]&&(t|=4),r[a]=t,++i[t]}let a=0;for(let e=0;e<8;++e)i[e]>0&&++a;if(a<2)return;const s=new Array(8);for(let e=0;e<8;++e)s[e]=i[e]>0?new Uint32Array(i[e]):void 0;for(let e=0;e<8;++e)i[e]=0;for(let e=0;e<t;++e){const t=r[e];s[t][i[t]++]=this.primitiveIndices[e]}this._children=new Array(8);for(let e=0;e<8;++e)void 0!==s[e]&&(this._children[e]=new P(s[e],this._numIndexPerPrimitive,this.indices,this.position))}return this._children}static prune(){F.prune()}}const F=new C.Z({deallocator:null});var E=r(99001);class D{constructor(){this.id=(0,E.D)()}unload(){}}var O=r(64291);class R extends D{constructor(e,t=[],r=0,i=-1){super(),this._primitiveType=r,this.edgeIndicesLength=i,this.type=2,this._vertexAttributes=new Map,this._indices=new Map,this._boundingInfo=null;for(const[t,r]of e)r&&this._vertexAttributes.set(t,{...r});if(null==t||0===t.length){const e=function(e){const t=e.values().next().value;return null==t?0:t.data.length/t.size}(this._vertexAttributes),t=(0,O.p)(e);this.edgeIndicesLength=this.edgeIndicesLength<0?e:this.edgeIndicesLength;for(const e of this._vertexAttributes.keys())this._indices.set(e,t)}else for(const[e,r]of t)r&&(this._indices.set(e,L(r)),"position"===e&&(this.edgeIndicesLength=this.edgeIndicesLength<0?this._indices.get(e).length:this.edgeIndicesLength))}get vertexAttributes(){return this._vertexAttributes}getMutableAttribute(e){const t=this._vertexAttributes.get(e);return t&&!t.exclusive&&(t.data=Array.from(t.data),t.exclusive=!0),t}get indices(){return this._indices}get indexCount(){const e=this._indices.values().next().value;return e?e.length:0}get primitiveType(){return this._primitiveType}get faceCount(){return this.indexCount/3}get boundingInfo(){return(0,o.Wi)(this._boundingInfo)&&(this._boundingInfo=this._calculateBoundingInfo()),this._boundingInfo}computeAttachmentOrigin(e){return 0===this.primitiveType?this.computeAttachmentOriginTriangles(e):this.computeAttachmentOriginPoints(e)}computeAttachmentOriginTriangles(e){const t=this.indices.get("position"),r=this.vertexAttributes.get("position");return(0,O.cM)(r,t,e)}computeAttachmentOriginPoints(e){const t=this.indices.get("position"),r=this.vertexAttributes.get("position");return(0,O.NO)(r,t,e)}invalidateBoundingInfo(){this._boundingInfo=null}_calculateBoundingInfo(){const e=this.indices.get("position");if(0===e.length)return null;const t=0===this.primitiveType?3:1;(0,A.hu)(e.length%t==0,"Indexing error: "+e.length+" not divisible by "+t);const r=(0,O.p)(e.length/t),i=this.vertexAttributes.get("position");return new P(r,t,e,i)}}function L(e){if(e.BYTES_PER_ELEMENT===Uint16Array.BYTES_PER_ELEMENT)return e;for(const t of e)if(t>=65536)return e;return new Uint16Array(e)}var z=r(74085),H=r(32448),I=r(22021),N=r(1533),B=r(17452),U=r(85958),V=r(99880);let k;var G=r(75656);function W(e,t,r,i,o){const n=e.gl,a=e.capabilities.instancing;e.bindBuffer(r);for(const e of i){const r=t.get(e.name);void 0===r&&console.error(`There is no location for vertex attribute '${e.name}' defined.`),e.baseInstance&&!e.divisor&&console.error(`Vertex attribute '${e.name}' uses baseInstanceOffset without divisor.`);const i=(o||(0+e.baseInstance?e.baseInstance:0))*e.stride;if(e.count<=4)n.vertexAttribPointer(r,e.count,e.type,e.normalized,e.stride,e.offset+i),n.enableVertexAttribArray(r),e.divisor>0&&a&&a.vertexAttribDivisor(r,e.divisor);else if(9===e.count)for(let t=0;t<3;t++)n.vertexAttribPointer(r+t,3,e.type,e.normalized,e.stride,e.offset+12*t+i),n.enableVertexAttribArray(r+t),e.divisor>0&&a&&a.vertexAttribDivisor(r+t,e.divisor);else if(16===e.count)for(let t=0;t<4;t++)n.vertexAttribPointer(r+t,4,e.type,e.normalized,e.stride,e.offset+16*t+i),n.enableVertexAttribArray(r+t),e.divisor>0&&a&&a.vertexAttribDivisor(r+t,e.divisor);else console.error("Unsupported vertex attribute element count: "+e.count)}}function q(e,t,r,i){const o=e.gl,n=e.capabilities.instancing;e.bindBuffer(r);for(const e of i){const r=t.get(e.name);if(e.count<=4)o.disableVertexAttribArray(r),e.divisor&&e.divisor>0&&n&&n.vertexAttribDivisor(r,0);else if(9===e.count)for(let t=0;t<3;t++)o.disableVertexAttribArray(r+t),e.divisor&&e.divisor>0&&n&&n.vertexAttribDivisor(r+t,0);else if(16===e.count)for(let t=0;t<4;t++)o.disableVertexAttribArray(r+t),e.divisor&&e.divisor>0&&n&&n.vertexAttribDivisor(r+t,0);else console.error("Unsupported vertex attribute element count: "+e.count)}e.unbindBuffer(34962)}function $(e){switch(e){case 6406:case 6409:case 36168:case 33778:case 33779:case 37490:case 37491:case 37496:case 37497:return 1;case 6410:case 32854:case 33325:case 32854:case 33189:return 2;case 6407:case 6402:return 3;case 6408:case 34041:case 33326:case 35898:case 33327:case 34041:return 4;case 33328:case 34842:return 8;case 34837:return 12;case 34836:return 16;case 33776:case 33777:case 37488:case 37489:case 37492:case 37493:case 37494:case 37495:return.5}return 0}function j(e){if((0,o.Wi)(e))return 0;if("descriptor"in e)return e.glName?j(e.descriptor):0;const t=e.internalFormat||"pixelFormat"in e&&e.pixelFormat;if(!t)return 0;const r="hasMipmap"in e&&e.hasMipmap?1.3:1,i=e.width*e.height;return $(t)*i*r}r(80442);let X=null,Z=null;async function K(){return(0,o.Wi)(Z)&&(Z=function(){if((0,o.Wi)(k)){const e=e=>(0,V.V)(`esri/libs/basisu/${e}`);k=r.e(1421).then(r.bind(r,21421)).then((e=>e.b)).then((({default:t})=>t({locateFile:e}).then((e=>(e.initializeBasis(),delete e.then,e)))))}return k}(),X=await Z),Z}function Y(e,t,r,i,o){const n=$(t?37496:37492),a=o&&e>1?(4**e-1)/(3*4**(e-1)):1;return Math.ceil(r*i*n*a)}function Q(e){return e.getNumImages()>=1&&!e.isUASTC()}function J(e){return e.getFaces()>=1&&e.isETC1S()}function ee(e,t,r,i,o,n,a,s){const{compressedTextureETC:l,compressedTextureS3TC:c}=e.capabilities,[d,u]=l?i?[1,37496]:[0,37492]:c?i?[3,33779]:[2,33776]:[13,6408],h=t.hasMipmap?r:Math.min(1,r),f=[];for(let e=0;e<h;e++)f.push(new Uint8Array(a(e,d))),s(e,d,f[e]);const m=f.length>1,p=m?9987:9729,g={...t,samplingMode:p,hasMipmap:m,internalFormat:u,width:o,height:n};return new G.Z(e,g,{type:"compressed",levels:f})}const te=y.Z.getLogger("esri.views.3d.webgl-engine.lib.DDSUtil");function re(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}const ie=re("DXT1"),oe=re("DXT3"),ne=re("DXT5");const ae=new Map([["position",0],["normal",1],["uv0",2],["color",3],["size",4],["tangent",4],["auxpos1",5],["symbolColor",5],["auxpos2",6],["featureAttribute",6],["instanceFeatureAttribute",6],["instanceColor",7],["model",8],["modelNormal",12],["modelOriginHi",11],["modelOriginLo",15]]),se=[{name:"position",count:2,type:5126,offset:0,stride:8,normalized:!1}],le=[{name:"position",count:2,type:5126,offset:0,stride:16,normalized:!1},{name:"uv0",count:2,type:5126,offset:8,stride:16,normalized:!1}];var ce=r(49300),de=r(35371);const ue=y.Z.getLogger("esri.views.webgl.BufferObject");class he{constructor(e,t,r,i,o){this._context=e,this.bufferType=t,this.usage=r,this._glName=null,this._size=-1,this._indexType=void 0,e.instanceCounter.increment(de._g.Buffer,this),this._glName=this._context.gl.createBuffer(),(0,ce.zu)(this._context.gl),i&&this.setData(i,o)}static createIndex(e,t,r,i){return new he(e,34963,t,r,i)}static createVertex(e,t,r){return new he(e,34962,t,r)}get glName(){return this._glName}get size(){return this._size}get indexType(){return this._indexType}get byteSize(){return 34962===this.bufferType?this._size:5125===this._indexType?4*this._size:2*this._size}dispose(){var e;null!=(e=this._context)&&e.gl?(this._glName&&(this._context.gl.deleteBuffer(this._glName),this._glName=null),this._context.instanceCounter.decrement(de._g.Buffer,this),this._context=null):this._glName&&ue.warn("Leaked WebGL buffer object")}setData(e,t){if(!e)return;if("number"==typeof e){if(e<0&&ue.error("Buffer size cannot be negative!"),this._size=e,34963===this.bufferType&&t)switch(this._indexType=t,this._size=e,t){case 5123:e*=2;break;case 5125:e*=4}}else{let t=e.byteLength;(0,N.Uc)(e)&&(t/=2,this._indexType=5123),(0,N.ZY)(e)&&(t/=4,this._indexType=5125),this._size=t}const r=this._context.getBoundVAO();this._context.bindVAO(null),this._context.bindBuffer(this);const i=this._context.gl;i.bufferData(this.bufferType,e,this.usage),(0,ce.zu)(i),this._context.bindVAO(r)}setSubData(e,t=0,r=0,i=e.byteLength){if(!e)return;(t<0||t>=this._size)&&ue.error("offset is out of range!");let o=t,n=r,a=i,s=e.byteLength;(0,N.Uc)(e)?(s/=2,o*=2,n*=2,a*=2):(0,N.ZY)(e)&&(s/=4,o*=4,n*=4,a*=4),void 0===i&&(i=s-1),r>=i&&ue.error("end must be bigger than start!"),t+r-i>this._size&&ue.error("An attempt to write beyond the end of the buffer!");const l=this._context.getBoundVAO();this._context.bindVAO(null),this._context.bindBuffer(this);const c=this._context.gl,d=ArrayBuffer.isView(e)?e.buffer:e,u=0===n&&a===e.byteLength?d:d.slice(n,a);c.bufferSubData(this.bufferType,o,u),(0,ce.zu)(c),this._context.bindVAO(l)}setSubDataFromView(e,t,r,i){if(!e)return;(t<0||t>=this._size)&&ue.error("offset is out of range!"),r>=i&&ue.error("end must be bigger than start!"),t+r-i>this._size&&ue.error("An attempt to write beyond the end of the buffer!");const o=this._context.getBoundVAO();this._context.bindVAO(null),this._context.bindBuffer(this);const n=this._context.gl,a=0===r&&i===e.length?e:e.subarray(r,i);n.bufferSubData(this.bufferType,t*e.BYTES_PER_ELEMENT,a),(0,ce.zu)(n),this._context.bindVAO(o)}}const fe=y.Z.getLogger("esri.views.webgl.VertexArrayObject");class me{constructor(e,t,r,i,o=null){this._context=e,this._locations=t,this._layout=r,this._buffers=i,this._indexBuffer=o,this._glName=null,this._initialized=!1,e.instanceCounter.increment(de._g.VAO,this)}get glName(){return this._glName}get vertexBuffers(){return this._buffers}get indexBuffer(){return this._indexBuffer}get size(){return Object.keys(this._buffers).reduce(((e,t)=>e+this._buffers[t].size),(0,o.pC)(this._indexBuffer)?this._indexBuffer.size:0)}get layout(){return this._layout}get locations(){return this._locations}dispose(e=!0){if(this._context){if(this._glName){var t,r;const e=null==(t=this._context)||null==(r=t.capabilities)?void 0:r.vao;e?(e.deleteVertexArray(this._glName),this._glName=null):fe.warn("Leaked WebGL VAO")}if(this._context.getBoundVAO()===this&&this._context.bindVAO(null),e){for(const e in this._buffers)this._buffers[e].dispose(),delete this._buffers[e];this._indexBuffer=(0,o.O3)(this._indexBuffer)}this._context.instanceCounter.decrement(de._g.VAO,this),this._context=null}else(this._glName||e&&Object.getOwnPropertyNames(this._buffers).length>0)&&fe.warn("Leaked WebGL VAO")}initialize(){if(this._initialized)return;const e=this._context.capabilities.vao;if(e){const t=e.createVertexArray();e.bindVertexArray(t),this._bindLayout(),e.bindVertexArray(null),this._glName=t}this._initialized=!0}bind(){this.initialize();const e=this._context.capabilities.vao;e?e.bindVertexArray(this.glName):(this._context.bindVAO(null),this._bindLayout())}_bindLayout(){const{_buffers:e,_layout:t,_indexBuffer:r}=this;e||fe.error("Vertex buffer dictionary is empty!");const i=this._context.gl;for(const r in e){const i=e[r];i||fe.error("Vertex buffer is uninitialized!");const o=t[r];o||fe.error("Vertex element descriptor is empty!"),W(this._context,this._locations,i,o)}(0,o.pC)(r)&&(this._context.capabilities.vao?i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,r.glName):this._context.bindBuffer(r))}unbind(){this.initialize();const e=this._context.capabilities.vao;e?e.bindVertexArray(null):this._unbindLayout()}_unbindLayout(){const{_buffers:e,_layout:t}=this;e||fe.error("Vertex buffer dictionary is empty!");for(const r in e){const i=e[r];i||fe.error("Vertex buffer is uninitialized!");const o=t[r];q(this._context,this._locations,i,o)}(0,o.pC)(this._indexBuffer)&&this._context.unbindBuffer(this._indexBuffer.bufferType)}}class pe{constructor(e,t){this._context=e,this._desc=t,this._context.instanceCounter.increment(de._g.Renderbuffer,this);const r=this._context.gl;this.glName=r.createRenderbuffer(),this._context.bindRenderbuffer(this),r.renderbufferStorage(r.RENDERBUFFER,t.internalFormat,t.width,t.height)}get descriptor(){return this._desc}resize(e,t){const r=this._desc;if(r.width===e&&r.height===t)return;r.width=e,r.height=t;const i=this._context.gl;this._context.bindRenderbuffer(this),i.renderbufferStorage(i.RENDERBUFFER,r.internalFormat,r.width,r.height)}dispose(){this._context&&(this._context.gl.deleteRenderbuffer(this.glName),this._context.instanceCounter.decrement(de._g.Renderbuffer,this),this._context=null)}}const ge=y.Z.getLogger("esri.views.webgl.FrameBufferObject");class ve{constructor(e,t,r=null,i=null){if(this._context=e,this._glName=null,this._depthAttachment=null,this._stencilAttachment=null,this._colorAttachments=new Map,this._initialized=!1,this._desc={...t},e.instanceCounter.increment(de._g.Framebuffer,this),(0,o.pC)(r)){Array.isArray(r)||(r=[r]);for(let t=0;t<r.length;++t){var n,a;const i=r[t];let o;xe(i)?(o=i.descriptor,this._colorAttachments.set(36064+t,i)):(o=i,this._colorAttachments.set(36064+t,new G.Z(e,i))),0!==(null==(n=this._desc)?void 0:n.colorTarget)&&2!==(null==(a=this._desc)?void 0:a.colorTarget)&&console.error("Framebuffer is initialized with a texture however the descriptor indicates using a renderbuffer color attachment!"),this._validateColorAttachmentPoint(36064+t),this._validateTextureDimensions(o,this._desc)}}if(i instanceof pe){var s;const e=null!=(s=this._desc.depthStencilTarget)?s:3;2===e?this._stencilAttachment=i:1===e||3===e?this._depthAttachment=i:console.error('If a Renderbuffer is provided, "depthStencilTarget" must be one of STENCIL_RENDER_BUFFER, DEPTH_RENDER_BUFFER or DEPTH_STENCIL_RENDER_BUFFER'),_e(i.descriptor,this._desc)}else if((0,o.pC)(i)){let e;this._context.capabilities.depthTexture||console.error("Extension WEBGL_depth_texture isn't supported therefore it is no possible to set the depth/stencil texture as an attachment!"),xe(i)?(this._depthStencilTexture=i,e=i.descriptor):this._depthStencilTexture=new G.Z(this._context,i),this._validateTextureDimensions(e,this._desc)}}dispose(){if(!this._desc)return;const e=this._context.getBoundFramebufferObject();this._disposeColorAttachments(),this._disposeDepthStencilAttachments(),this._glName&&(this._context.gl.deleteFramebuffer(this._glName),this._glName=null),this._context.bindFramebuffer(e),this._context.instanceCounter.decrement(de._g.Framebuffer,this),this._desc=null}get glName(){return this._glName}get descriptor(){return this._desc}get colorTexture(){const e=this._colorAttachments.get(36064);return e&&xe(e)?e:null}get colorAttachment(){return this._colorAttachments.get(36064)}get depthStencilAttachment(){return this._depthStencilTexture||this._depthAttachment||this._stencilAttachment}get depthStencilTexture(){return this._depthStencilTexture}get width(){return this._desc.width}get height(){return this._desc.height}get gpuMemoryUsage(){return j(this.colorAttachment)+j(this.depthStencilAttachment)}getColorTexture(e){const t=this._colorAttachments.get(e);return t&&xe(t)?t:null}framebufferTexture2D(e,t,r=36064,i=3553,o=0){t.framebufferTexture2D(t.FRAMEBUFFER,r,i,e,o)}attachColorTexture(e,t=36064){if(!e)return;this._validateColorAttachmentPoint(t);const r=e.descriptor;this._validateTextureDimensions(r,this._desc),this._disposeColorAttachments(),this._initialized&&(this._context.bindFramebuffer(this),this.framebufferTexture2D(e.glName,this._context.gl,t)),this._colorAttachments.set(t,e)}detachColorTexture(e=36064){const t=this._colorAttachments.get(e);if(xe(t)){const r=t;return this._initialized&&(this._context.bindFramebuffer(this),this.framebufferTexture2D(null,this._context.gl,e)),this._colorAttachments.delete(e),r}}attachDepthStencilTexture(e){if((0,o.Wi)(e))return;const t=e.descriptor;34041!==t.pixelFormat&&console.error("Depth/Stencil texture must have a pixel type of DEPTH_STENCIL!"),34042!==t.dataType&&console.error("Depth/Stencil texture must have data type of UNSIGNED_INT_24_8!"),this._context.capabilities.depthTexture||console.error("Extension WEBGL_depth_texture isn't supported therefore it is no possible to set the depth/stencil texture!"),this._validateTextureDimensions(t,this._desc),this._desc.depthStencilTarget&&4!==this._desc.depthStencilTarget&&(this._desc.depthStencilTarget=4),this._disposeDepthStencilAttachments(),this._initialized&&(this._context.bindFramebuffer(this),this.framebufferTexture2D(e.glName,this._context.gl,de.Lu)),this._depthStencilTexture=e}detachDepthStencilTexture(){const e=this._depthStencilTexture;return e&&this._initialized&&(this._context.bindFramebuffer(this),this.framebufferTexture2D(null,this._context.gl,de.Lu)),this._depthStencilTexture=null,e}attachDepthStencilBuffer(e){if((0,o.Wi)(e))return;const t=e.descriptor;if(34041!==t.internalFormat&&33189!==t.internalFormat&&console.error("Depth/Stencil buffer must have correct internalFormat"),_e(t,this._desc),this._disposeDepthStencilAttachments(),this._desc.depthStencilTarget=34041===t.internalFormat?3:1,this._initialized){this._context.bindFramebuffer(this);const t=this._context.gl,r=1===this._desc.depthStencilTarget?t.DEPTH_ATTACHMENT:t.DEPTH_STENCIL_ATTACHMENT;t.framebufferRenderbuffer(t.FRAMEBUFFER,r,t.RENDERBUFFER,e.glName)}this._depthAttachment=e}detachDepthStencilBuffer(){const e=this._context.gl,t=this._depthAttachment;if(t&&this._initialized){this._context.bindFramebuffer(this);const t=1===this._desc.depthStencilTarget?e.DEPTH_ATTACHMENT:e.DEPTH_STENCIL_ATTACHMENT;e.framebufferRenderbuffer(e.FRAMEBUFFER,t,e.RENDERBUFFER,null)}return this._depthAttachment=null,t}detachAll(){this.detachColorTexture(),this.detachDepthStencilBuffer(),this.detachDepthStencilTexture()}copyToTexture(e,t,r,i,o,n,a){(e<0||t<0||o<0||n<0)&&console.error("Offsets cannot be negative!"),(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!");const s=this._desc,l=a.descriptor;3553!==a.descriptor.target&&console.error("Texture target must be TEXTURE_2D!"),(e+r>s.width||t+i>s.height||o+r>l.width||n+i>l.height)&&console.error("Bad dimensions, the current input values will attempt to read or copy out of bounds!");const c=this._context,d=c.bindTexture(a,G.Z.TEXTURE_UNIT_FOR_UPDATES);c.bindFramebuffer(this),c.gl.copyTexSubImage2D(3553,0,o,n,e,t,r,i),c.bindTexture(d,G.Z.TEXTURE_UNIT_FOR_UPDATES)}readPixels(e,t,r,i,o,n,a){(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!"),a||console.error("Target memory is not initialized!"),this._context.bindFramebuffer(this),this._context.gl.readPixels(e,t,r,i,o,n,a)}resize(e,t){const r=this._desc;if(r.width!==e||r.height!==t){if(!this._initialized)return r.width=e,r.height=t,this._colorAttachments.forEach((r=>{r&&r.resize(e,t)})),void(this._depthStencilTexture&&this._depthStencilTexture.resize(e,t));r.width=e,r.height=t,this._colorAttachments.forEach((r=>{r&&r.resize(e,t)})),null!=this._depthStencilTexture?this._depthStencilTexture.resize(e,t):(this._depthAttachment||this._stencilAttachment)&&(this._depthAttachment&&this._depthAttachment.resize(e,t),this._stencilAttachment&&this._stencilAttachment.resize(e,t)),this._context.getBoundFramebufferObject()===this&&this._context.bindFramebuffer(null),this._initialized=!1}}initializeAndBind(e=3553){var t,r,i,o;const n=this._context.gl;if(this._initialized)return void n.bindFramebuffer(n.FRAMEBUFFER,this.glName);this._glName&&n.deleteFramebuffer(this._glName);const a=this._context,s=n.createFramebuffer(),l=this._desc,c=null!=(t=l.colorTarget)?t:1,d=null!=(r=l.width)?r:1,u=null!=(i=l.height)?i:1;if(n.bindFramebuffer(n.FRAMEBUFFER,s),0===this._colorAttachments.size)if(0===c)this._colorAttachments.set(36064,function(e,t,r){return new G.Z(e,{target:r,pixelFormat:6408,dataType:5121,samplingMode:9728,wrapMode:33071,width:t.width,height:t.height})}(a,l,2===this.descriptor.colorTarget?34067:3553));else{const e=new pe(a,{internalFormat:32854,width:d,height:u});this._colorAttachments.set(36064,e)}this._colorAttachments.forEach(((t,r)=>{t&&(xe(t)?this.framebufferTexture2D(t.glName,n,r,e):n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,t.glName))}));const h=null!=(o=l.depthStencilTarget)?o:0;switch(h){case 1:case 3:{this._depthAttachment||(this._depthAttachment=new pe(a,{internalFormat:1===l.depthStencilTarget?33189:34041,width:d,height:u}));const e=1===h?n.DEPTH_ATTACHMENT:n.DEPTH_STENCIL_ATTACHMENT;n.framebufferRenderbuffer(n.FRAMEBUFFER,e,n.RENDERBUFFER,this._depthAttachment.glName);break}case 2:this._stencilAttachment||(this._stencilAttachment=new pe(a,{internalFormat:36168,width:d,height:u})),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.STENCIL_ATTACHMENT,n.RENDERBUFFER,this._stencilAttachment.glName);break;case 4:if(!this._depthStencilTexture){a.capabilities.depthTexture||console.error("Extension WEBGL_depth_texture isn't supported therefore it is no possible to set the depth/stencil texture as an attachment!");const e={target:3553,pixelFormat:34041,dataType:34042,samplingMode:9728,wrapMode:33071,width:d,height:u};this._depthStencilTexture=new G.Z(a,e)}this.framebufferTexture2D(this._depthStencilTexture.glName,n,n.DEPTH_STENCIL_ATTACHMENT,e)}(0,ce.CG)()&&n.checkFramebufferStatus(n.FRAMEBUFFER)!==n.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!"),this._glName=s,this._initialized=!0}_disposeColorAttachments(){this._colorAttachments.forEach(((e,t)=>{if(xe(e))this._initialized&&(this._context.bindFramebuffer(this),this.framebufferTexture2D(null,this._context.gl,t)),e.dispose();else if(e instanceof WebGLRenderbuffer){const r=this._context.gl;this._initialized&&(this._context.bindFramebuffer(this),r.framebufferRenderbuffer(r.FRAMEBUFFER,t,r.RENDERBUFFER,null)),this._context.gl.deleteRenderbuffer(e)}})),this._colorAttachments.clear()}_disposeDepthStencilAttachments(){const e=this._context.gl;if(this._depthAttachment){if(this._initialized){this._context.bindFramebuffer(this);const t=1===this._desc.depthStencilTarget?e.DEPTH_ATTACHMENT:e.DEPTH_STENCIL_ATTACHMENT;e.framebufferRenderbuffer(e.FRAMEBUFFER,t,e.RENDERBUFFER,null)}this._depthAttachment.dispose(),this._depthAttachment=null}this._stencilAttachment&&(this._initialized&&(this._context.bindFramebuffer(this),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.STENCIL_ATTACHMENT,e.RENDERBUFFER,null)),this._stencilAttachment.dispose(),this._stencilAttachment=null),this._depthStencilTexture&&(this._initialized&&(this._context.bindFramebuffer(this),this.framebufferTexture2D(null,e,e.DEPTH_STENCIL_ATTACHMENT)),this._depthStencilTexture.dispose(),this._depthStencilTexture=null)}_validateTextureDimensions(e,t){3553!==e.target&&34067!==e.target&&console.error("Texture type must be TEXTURE_2D or TEXTURE_CUBE_MAP!"),void 0!==t.width&&t.width>=0&&void 0!==t.height&&t.height>=0?t.width===e.width&&t.height===e.height||console.error("Color attachment texture must match the framebuffer's!"):(t.width=e.width,t.height=e.height)}_validateColorAttachmentPoint(e){if(-1===ve._MAX_COLOR_ATTACHMENTS){const e=this._context.capabilities.drawBuffers;if(e){const t=this._context.gl;ve._MAX_COLOR_ATTACHMENTS=t.getParameter(e.MAX_COLOR_ATTACHMENTS)}else ve._MAX_COLOR_ATTACHMENTS=1}const t=e-36064;t+1>ve._MAX_COLOR_ATTACHMENTS&&ge.error("esri.FrameBufferObject",`illegal attachment point for color attachment: ${t+1}. Implementation supports up to ${ve._MAX_COLOR_ATTACHMENTS} color attachments`)}}function xe(e){return"type"in e&&"texture"===e.type}function _e(e,t){void 0!==t.width&&t.width>=0&&void 0!==t.height&&t.height>=0?t.width===e.width&&t.height===e.height||console.error("Renderbuffer dimensions must match the framebuffer's!"):(t.width=e.width,t.height=e.height)}ve._MAX_COLOR_ATTACHMENTS=-1;var be=r(46314);class Te extends D{constructor(e,t){super(),this.data=e,this.type=4,this._glTexture=null,this._powerOfTwoStretchInfo=null,this._loadingPromise=null,this._loadingController=null,this.events=new H.Z,this.params=t||{},this.params.mipmap=!1!==this.params.mipmap,this.params.noUnpackFlip=this.params.noUnpackFlip||!1,this.params.preMultiplyAlpha=this.params.preMultiplyAlpha||!1,this.params.wrap=this.params.wrap||{s:10497,t:10497},this.params.powerOfTwoResizeMode=this.params.powerOfTwoResizeMode||1,this.estimatedTexMemRequired=Te.estimateTexMemRequired(this.data,this.params),this.startPreload()}startPreload(){const e=this.data;(0,o.Wi)(e)||(e instanceof HTMLVideoElement?this.startPreloadVideoElement(e):e instanceof HTMLImageElement&&this.startPreloadImageElement(e))}startPreloadVideoElement(e){(0,B.jc)(e.src)||"auto"===e.preload&&e.crossOrigin||(e.preload="auto",e.crossOrigin="anonymous",e.src=e.src)}startPreloadImageElement(e){(0,B.HK)(e.src)||(0,B.jc)(e.src)||e.crossOrigin||(e.crossOrigin="anonymous",e.src=e.src)}static getDataDimensions(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e}static estimateTexMemRequired(e,t){if((0,o.Wi)(e))return 0;if((0,N.eP)(e)||(0,N.lq)(e))return t.encoding===Te.KTX2_ENCODING?function(e,t){if((0,o.Wi)(X))return e.byteLength;const r=new X.KTX2File(new Uint8Array(e)),i=J(r)?Y(r.getLevels(),r.getHasAlpha(),r.getWidth(),r.getHeight(),t):0;return r.close(),r.delete(),i}(e,t.mipmap):t.encoding===Te.BASIS_ENCODING?function(e,t){if((0,o.Wi)(X))return e.byteLength;const r=new X.BasisFile(new Uint8Array(e)),i=Q(r)?Y(r.getNumLevels(0),r.getHasAlpha(),r.getImageWidth(0,0),r.getImageHeight(0,0),t):0;return r.close(),r.delete(),i}(e,t.mipmap):e.byteLength;const{width:r,height:i}=e instanceof Image||e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement?Te.getDataDimensions(e):t;return(t.mipmap?4/3:1)*r*i*(t.components||4)||0}dispose(){this.data=void 0}get width(){return this.params.width}get height(){return this.params.height}createDescriptor(e){var t;return{target:3553,pixelFormat:6408,dataType:5121,wrapMode:this.params.wrap,flipped:!this.params.noUnpackFlip,samplingMode:this.params.mipmap?9987:9729,hasMipmap:this.params.mipmap,preMultiplyAlpha:this.params.preMultiplyAlpha,maxAnisotropy:null!=(t=this.params.maxAnisotropy)?t:this.params.mipmap?e.parameters.maxMaxAnisotropy:1}}get glTexture(){return this._glTexture}load(e,t){if((0,o.pC)(this._glTexture))return this._glTexture;if((0,o.pC)(this._loadingPromise))return this._loadingPromise;const r=this.data;return(0,o.Wi)(r)?(this._glTexture=new G.Z(e,this.createDescriptor(e),null),this._glTexture):"string"==typeof r?this.loadFromURL(e,t,r):r instanceof Image?this.loadFromImageElement(e,t,r):r instanceof HTMLVideoElement?this.loadFromVideoElement(e,t,r):r instanceof ImageData||r instanceof HTMLCanvasElement?this.loadFromImage(e,r,t):((0,N.eP)(r)||(0,N.lq)(r))&&this.params.encoding===Te.DDS_ENCODING?this.loadFromDDSData(e,r):((0,N.eP)(r)||(0,N.lq)(r))&&this.params.encoding===Te.KTX2_ENCODING?this.loadFromKTX2(e,r):((0,N.eP)(r)||(0,N.lq)(r))&&this.params.encoding===Te.BASIS_ENCODING?this.loadFromBasis(e,r):(0,N.lq)(r)?this.loadFromPixelData(e,r):(0,N.eP)(r)?this.loadFromPixelData(e,new Uint8Array(r)):null}get requiresFrameUpdates(){return this.data instanceof HTMLVideoElement}frameUpdate(e,t,r){if(!(this.data instanceof HTMLVideoElement)||(0,o.Wi)(this._glTexture))return r;if(this.data.readyState<2||r===this.data.currentTime)return r;if((0,o.pC)(this._powerOfTwoStretchInfo)){const{framebuffer:r,vao:i,sourceTexture:o}=this._powerOfTwoStretchInfo;o.setData(this.data),this.drawStretchedTexture(e,t,r,i,o,this._glTexture)}else{const{width:e,height:t}=this.data,{width:r,height:i}=this._glTexture.descriptor;e!==r||t!==i?this._glTexture.updateData(0,0,0,Math.min(e,r),Math.min(t,i),this.data):this._glTexture.setData(this.data)}return this._glTexture.descriptor.hasMipmap&&this._glTexture.generateMipmap(),this.data.currentTime}loadFromDDSData(e,t){return this._glTexture=function(e,t,r){const{textureData:i,internalFormat:o,width:n,height:a}=function(e,t){const r=new Int32Array(e,0,31);if(542327876!==r[0])return te.error("Invalid magic number in DDS header"),null;if(!(4&r[20]))return te.error("Unsupported format, must contain a FourCC code"),null;const i=r[21];let o,n;switch(i){case ie:o=8,n=33776;break;case oe:o=16,n=33778;break;case ne:o=16,n=33779;break;default:return te.error("Unsupported FourCC code:",function(e){return String.fromCharCode(255&e,e>>8&255,e>>16&255,e>>24&255)}(i)),null}let a=1,s=r[4],l=r[3];0==(3&s)&&0==(3&l)||(te.warn("Rounding up compressed texture size to nearest multiple of 4."),s=s+3&-4,l=l+3&-4);const c=s,d=l;let u,h;131072&r[2]&&!1!==t&&(a=Math.max(1,r[7])),1===a||(0,I.wt)(s)&&(0,I.wt)(l)||(te.warn("Ignoring mipmaps of non power of two sized compressed texture."),a=1);let f=r[1]+4;const m=[];for(let t=0;t<a;++t)h=(s+3>>2)*(l+3>>2)*o,u=new Uint8Array(e,f,h),m.push(u),f+=h,s=Math.max(1,s>>1),l=Math.max(1,l>>1);return{textureData:{type:"compressed",levels:m},internalFormat:n,width:c,height:d}}(r,t.hasMipmap);return t.samplingMode=i.levels.length>1?9987:9729,t.hasMipmap=i.levels.length>1,t.internalFormat=o,t.width=n,t.height=a,new G.Z(e,t,i)}(e,this.createDescriptor(e),t),this._glTexture}loadFromKTX2(e,t){return this.loadAsync((()=>async function(e,t,r){(0,o.Wi)(X)&&(X=await K());const i=new X.KTX2File(new Uint8Array(r));if(!J(i))return null;i.startTranscoding();const n=ee(e,t,i.getLevels(),i.getHasAlpha(),i.getWidth(),i.getHeight(),((e,t)=>i.getImageTranscodedSizeInBytes(e,0,0,t)),((e,t,r)=>i.transcodeImage(r,e,0,0,t,0,-1,-1)));return i.close(),i.delete(),n}(e,this.createDescriptor(e),t).then((e=>(this._glTexture=e,e)))))}loadFromBasis(e,t){return this.loadAsync((()=>async function(e,t,r){(0,o.Wi)(X)&&(X=await K());const i=new X.BasisFile(new Uint8Array(r));if(!Q(i))return null;i.startTranscoding();const n=ee(e,t,i.getNumLevels(0),i.getHasAlpha(),i.getImageWidth(0,0),i.getImageHeight(0,0),((e,t)=>i.getImageTranscodedSizeInBytes(0,e,t)),((e,t,r)=>i.transcodeImage(r,0,e,t,0,0)));return i.close(),i.delete(),n}(e,this.createDescriptor(e),t).then((e=>(this._glTexture=e,e)))))}loadFromPixelData(e,t){(0,A.hu)(this.params.width>0&&this.params.height>0);const r=this.createDescriptor(e);return r.pixelFormat=1===this.params.components?6409:3===this.params.components?6407:6408,r.width=this.params.width,r.height=this.params.height,this._glTexture=new G.Z(e,r,t),this._glTexture}loadFromURL(e,t,r){return this.loadAsync((async i=>{const o=await S(r,{signal:i});return this.loadFromImage(e,o,t)}))}loadFromImageElement(e,t,r){return r.complete?this.loadFromImage(e,r,t):this.loadAsync((async i=>{const o=await(0,U.f)(r,r.src,!1,i);return this.loadFromImage(e,o,t)}))}loadFromVideoElement(e,t,r){return r.readyState>=2?this.loadFromImage(e,r,t):this.loadFromVideoElementAsync(e,t,r)}loadFromVideoElementAsync(e,t,r){return this.loadAsync((i=>new Promise(((n,a)=>{const s=()=>{r.removeEventListener("loadeddata",l),r.removeEventListener("error",c),(0,o.hw)(d)},l=()=>{r.readyState>=2&&(s(),n(this.loadFromImage(e,r,t)))},c=e=>{s(),a(e||new T.Z("Failed to load video"))};r.addEventListener("loadeddata",l),r.addEventListener("error",c);const d=(0,M.fu)(i,(()=>c((0,M.zE)())))}))))}loadFromImage(e,t,r){const i=Te.getDataDimensions(t);this.params.width=i.width,this.params.height=i.height;const o=this.createDescriptor(e);return o.pixelFormat=3===this.params.components?6407:6408,!this.requiresPowerOfTwo(e,o)||(0,I.wt)(i.width)&&(0,I.wt)(i.height)?(o.width=i.width,o.height=i.height,this._glTexture=new G.Z(e,o,t),this._glTexture):(this._glTexture=this.makePowerOfTwoTexture(e,t,i,o,r),this._glTexture)}loadAsync(e){const t=new AbortController;this._loadingController=t;const r=e(t.signal);this._loadingPromise=r;const i=()=>{this._loadingController===t&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null)};return r.then(i,i),r}requiresPowerOfTwo(e,t){const r=33071,i="number"==typeof t.wrapMode?t.wrapMode===r:t.wrapMode.s===r&&t.wrapMode.t===r;return!(0,be.Z)(e.gl)&&(t.hasMipmap||!i)}makePowerOfTwoTexture(e,t,r,i,o){const{width:n,height:a}=r,s=(0,I.Sf)(n),l=(0,I.Sf)(a);let c;switch(i.width=s,i.height=l,this.params.powerOfTwoResizeMode){case 2:i.textureCoordinateScaleFactor=[n/s,a/l],c=new G.Z(e,i),c.updateData(0,0,0,n,a,t);break;case 1:case null:case void 0:c=this.stretchToPowerOfTwo(e,t,i,o());break;default:(0,z.Bg)(this.params.powerOfTwoResizeMode)}return i.hasMipmap&&c.generateMipmap(),c}stretchToPowerOfTwo(e,t,r,i){const o=new G.Z(e,r),n=new ve(e,{colorTarget:0,depthStencilTarget:0},o),a=new G.Z(e,{target:3553,pixelFormat:r.pixelFormat,dataType:5121,wrapMode:33071,samplingMode:9729,flipped:!!r.flipped,maxAnisotropy:8,preMultiplyAlpha:r.preMultiplyAlpha},t),s=function(e,t=se,r=ae,i=-1,o=1){let n=null;return n=t===le?new Float32Array([i,i,0,0,o,i,1,0,i,o,0,1,o,o,1,1]):new Float32Array([i,i,o,i,i,o,o,o]),new me(e,r,{geometry:t},{geometry:he.createVertex(e,35044,n)})}(e),l=e.getBoundFramebufferObject();return this.drawStretchedTexture(e,i,n,s,a,o),this.requiresFrameUpdates?this._powerOfTwoStretchInfo={vao:s,sourceTexture:a,framebuffer:n}:(s.dispose(!0),a.dispose(),n.detachColorTexture(),n.dispose()),e.bindFramebuffer(l),o}drawStretchedTexture(e,t,r,i,o,n){e.bindFramebuffer(r);const a=e.getViewport();e.setViewport(0,0,n.descriptor.width,n.descriptor.height);const s=t.program;e.useProgram(s),s.setUniform4f("color",1,1,1,1),s.bindTexture(o,"tex"),e.bindVAO(i),t.bindPipelineState(e),e.drawArrays(5,0,function(e,t){return e.vertexBuffers[t].size/function(e){return e[0].stride}(e.layout[t])}(i,"geometry")),e.bindFramebuffer(null),e.setViewport(a.x,a.y,a.width,a.height)}unload(){if((0,o.pC)(this._powerOfTwoStretchInfo)){const{framebuffer:e,vao:t,sourceTexture:r}=this._powerOfTwoStretchInfo;t.dispose(!0),r.dispose(),e.dispose(),this._glTexture=null,this._powerOfTwoStretchInfo=null}if((0,o.pC)(this._glTexture)&&(this._glTexture.dispose(),this._glTexture=null),(0,o.pC)(this._loadingController)){const e=this._loadingController;this._loadingController=null,this._loadingPromise=null,e.abort()}this.events.emit("unloaded")}}Te.DDS_ENCODING="image/vnd-ms.dds",Te.KTX2_ENCODING="image/ktx2",Te.BASIS_ENCODING="image/x.basis";var ye=r(65576),Me=r(94124),we=r(37782);class Se extends D{constructor(e,t){super(),this.type=3,this.supportsEdges=!1,this._visible=!0,this._renderPriority=0,this._insertOrder=0,this._vertexAttributeLocations=ae,this._parameters=(0,we.Uf)(e,t),this.validateParameters(this._parameters)}dispose(){}get parameters(){return this._parameters}update(e){return!1}setParameters(e){(0,we.LO)(this._parameters,e)&&(this.validateParameters(this._parameters),this.parametersChanged())}validateParameters(e){}get visible(){return this._visible}set visible(e){e!==this._visible&&(this._visible=e,this.parametersChanged())}shouldRender(e){return this.isVisible()&&this.isVisibleInPass(e.pass)&&0!=(this.renderOccluded&e.renderOccludedMask)}isVisibleInPass(e){return!0}get renderOccluded(){return this.parameters.renderOccluded}get renderPriority(){return this._renderPriority}set renderPriority(e){e!==this._renderPriority&&(this._renderPriority=e,this.parametersChanged())}get insertOrder(){return this._insertOrder}set insertOrder(e){e!==this._insertOrder&&(this._insertOrder=e,this.parametersChanged())}get vertexAttributeLocations(){return this._vertexAttributeLocations}isVisible(){return this._visible}parametersChanged(){(0,o.pC)(this.repository)&&this.repository.materialChanged(this)}}function Ce(e,t,r=32774,i=[0,0,0,0]){return{srcRgb:e,srcAlpha:e,dstRgb:t,dstAlpha:t,opRgb:r,opAlpha:r,color:{r:i[0],g:i[1],b:i[2],a:i[3]}}}const Ae={face:1029,mode:2305},Pe={face:1028,mode:2305},Fe=e=>2===e?Ae:1===e?Pe:null,Ee={zNear:0,zFar:1},De={r:!0,g:!0,b:!0,a:!0};function Oe(e){return ke.intern(e)}function Re(e){return We.intern(e)}function Le(e){return $e.intern(e)}function ze(e){return Xe.intern(e)}function He(e){return Ke.intern(e)}function Ie(e){return Qe.intern(e)}function Ne(e){return et.intern(e)}function Be(e){return rt.intern(e)}class Ue{constructor(e,t){this.makeKey=e,this.makeRef=t,this.interns=new Map}intern(e){if(!e)return null;const t=this.makeKey(e),r=this.interns;return r.has(t)||r.set(t,this.makeRef(e)),r.get(t)}}function Ve(e){return"["+e.join(",")+"]"}const ke=new Ue(Ge,(e=>({__tag:"Blending",...e})));function Ge(e){return e?Ve([e.srcRgb,e.srcAlpha,e.dstRgb,e.dstAlpha,e.opRgb,e.opAlpha,e.color.r,e.color.g,e.color.b,e.color.a]):null}const We=new Ue(qe,(e=>({__tag:"Culling",...e})));function qe(e){return e?Ve([e.face,e.mode]):null}const $e=new Ue(je,(e=>({__tag:"PolygonOffset",...e})));function je(e){return e?Ve([e.factor,e.units]):null}const Xe=new Ue(Ze,(e=>({__tag:"DepthTest",...e})));function Ze(e){return e?Ve([e.func]):null}const Ke=new Ue(Ye,(e=>({__tag:"StencilTest",...e})));function Ye(e){return e?Ve([e.function.func,e.function.ref,e.function.mask,e.operation.fail,e.operation.zFail,e.operation.zPass]):null}const Qe=new Ue(Je,(e=>({__tag:"DepthWrite",...e})));function Je(e){return e?Ve([e.zNear,e.zFar]):null}const et=new Ue(tt,(e=>({__tag:"ColorWrite",...e})));function tt(e){return e?Ve([e.r,e.g,e.b,e.a]):null}const rt=new Ue(it,(e=>({__tag:"StencilWrite",...e})));function it(e){return e?Ve([e.mask]):null}const ot=new Ue((function(e){return e?Ve([Ge(e.blending),qe(e.culling),je(e.polygonOffset),Ze(e.depthTest),Ye(e.stencilTest),Je(e.depthWrite),tt(e.colorWrite),it(e.stencilWrite)]):null}),(e=>({blending:Oe(e.blending),culling:Re(e.culling),polygonOffset:Le(e.polygonOffset),depthTest:ze(e.depthTest),stencilTest:He(e.stencilTest),depthWrite:Ie(e.depthWrite),colorWrite:Ne(e.colorWrite),stencilWrite:Be(e.stencilWrite)}))),nt=function(e,t,r,i,o=32774,n=32774,a=[0,0,0,0]){return{srcRgb:770,srcAlpha:1,dstRgb:771,dstAlpha:771,opRgb:o,opAlpha:n,color:{r:a[0],g:a[1],b:a[2],a:a[3]}}}(),at=Ce(1,1),st=Ce(0,771);const lt={factor:-1,units:-2};function ct(e){return e?lt:null}function dt(e){return 3===e||2===e?513:515}var ut=r(51305),ht=r(94961),ft=r(72119),mt=r(88669),pt=r(98766),gt=(r(67676),r(22807)),vt=r(12981);new gt.x((function(){return{origin:null,direction:null}})),(0,d.c)(),(0,d.c)();const xt=y.Z.getLogger("esri.geometry.support.sphere");function _t(){return(0,mt.c)()}function bt(e,t=_t()){return(0,pt.c)(t,e)}function Tt(e){return Array.isArray(e)?e[3]:e}function yt(e){return Array.isArray(e)?e:Dt}function Mt(e,t,r){if((0,o.Wi)(t))return!1;const{origin:i,direction:n}=t,a=wt;a[0]=i[0]-e[0],a[1]=i[1]-e[1],a[2]=i[2]-e[2];const s=n[0]*n[0]+n[1]*n[1]+n[2]*n[2],l=2*(n[0]*a[0]+n[1]*a[1]+n[2]*a[2]),c=l*l-4*s*(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]-e[3]*e[3]);if(c<0)return!1;const d=Math.sqrt(c);let u=(-l-d)/(2*s);const h=(-l+d)/(2*s);return(u<0||h<u&&h>0)&&(u=h),!(u<0||(r&&(r[0]=i[0]+n[0]*u,r[1]=i[1]+n[1]*u,r[2]=i[2]+n[2]*u),0))}const wt=(0,d.c)();function St(e,t,r){const i=vt.WM.get(),o=vt.MP.get();(0,c.c)(i,t.origin,t.direction);const n=Tt(e);(0,c.c)(r,i,t.origin),(0,c.a)(r,r,1/(0,c.l)(r)*n);const a=At(e,t.origin),l=function(e,t){const r=(0,c.d)(e,t)/((0,c.l)(e)*(0,c.l)(t));return-(0,I.ZF)(r)}(t.origin,r);return(0,s.i)(o),(0,s.e)(o,o,l+a,i),(0,c.m)(r,r,o),r}function Ct(e,t,r){const i=(0,c.f)(vt.WM.get(),t,yt(e)),o=(0,c.a)(vt.WM.get(),i,e[3]/(0,c.l)(i));return(0,c.b)(r,o,yt(e))}function At(e,t){const r=(0,c.f)(vt.WM.get(),t,yt(e)),i=(0,c.l)(r),o=Tt(e),n=o+Math.abs(o-i);return(0,I.ZF)(o/n)}const Pt=(0,d.c)();function Ft(e,t,r,i){const o=(0,c.f)(Pt,t,yt(e));switch(r){case 0:{const e=(0,I.jE)(o,Pt)[2];return(0,c.s)(i,-Math.sin(e),Math.cos(e),0)}case 1:{const e=(0,I.jE)(o,Pt),t=e[1],r=e[2],n=Math.sin(t);return(0,c.s)(i,-n*Math.cos(r),-n*Math.sin(r),Math.cos(t))}case 2:return(0,c.n)(i,o);default:return}}function Et(e,t){const r=(0,c.f)(Ot,t,yt(e));return(0,c.l)(r)-e[3]}const Dt=(0,d.c)(),Ot=(0,d.c)();Object.freeze({__proto__:null,create:_t,copy:bt,fromCenterAndRadius:function(e,t){return(0,mt.f)(e[0],e[1],e[2],t)},wrap:function(e){return e},clear:function(e){e[0]=e[1]=e[2]=e[3]=0},fromRadius:function(e){return e},getRadius:Tt,getCenter:yt,fromValues:function(e,t,r,i){return(0,mt.f)(e,t,r,i)},elevate:function(e,t,r){return e!==r&&(0,c.g)(r,e),r[3]=e[3]+t,r},setExtent:function(e,t,r){return xt.error("sphere.setExtent is not yet supported"),e===r?r:bt(e,r)},intersectRay:Mt,intersectsRay:function(e,t){return Mt(e,t,null)},intersectRayClosestSilhouette:function(e,t,r){if(Mt(e,t,r))return r;const i=St(e,t,vt.WM.get());return(0,c.b)(r,t.origin,(0,c.a)(vt.WM.get(),t.direction,(0,c.i)(t.origin,i)/(0,c.l)(t.direction))),r},closestPointOnSilhouette:St,closestPoint:function(e,t,r){return Mt(e,t,r)?r:(function(e,t,r){const i=(0,c.d)(e.direction,(0,c.f)(r,t,e.origin));(0,c.b)(r,e.origin,(0,c.a)(r,e.direction,i))}(t,yt(e),r),Ct(e,r,r))},projectPoint:Ct,distanceToSilhouette:function(e,t){const r=(0,c.f)(vt.WM.get(),t,yt(e)),i=(0,c.p)(r),o=e[3]*e[3];return Math.sqrt(Math.abs(i-o))},angleToSilhouette:At,axisAt:Ft,altitudeAt:Et,setAltitudeAt:function(e,t,r,i){const o=Et(e,t),n=Ft(e,t,2,Ot),a=(0,c.a)(Ot,n,r-o);return(0,c.b)(i,t,a)}});const Rt=new class{constructor(e=0){this.offset=e,this.sphere=_t(),this.tmpVertex=(0,d.c)()}applyToVertex(e,t,r){const i=this.objectTransform.transform;let o=i[0]*e+i[4]*t+i[8]*r+i[12],n=i[1]*e+i[5]*t+i[9]*r+i[13],a=i[2]*e+i[6]*t+i[10]*r+i[14];const s=this.offset/Math.sqrt(o*o+n*n+a*a);o+=o*s,n+=n*s,a+=a*s;const l=this.objectTransform.inverse;return this.tmpVertex[0]=l[0]*o+l[4]*n+l[8]*a+l[12],this.tmpVertex[1]=l[1]*o+l[5]*n+l[9]*a+l[13],this.tmpVertex[2]=l[2]*o+l[6]*n+l[10]*a+l[14],this.tmpVertex}applyToMinMax(e,t){const r=this.offset/Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]+=e[0]*r,e[1]+=e[1]*r,e[2]+=e[2]*r;const i=this.offset/Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]+=t[0]*i,t[1]+=t[1]*i,t[2]+=t[2]*i}applyToAabb(e){const t=this.offset/Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]+=e[0]*t,e[1]+=e[1]*t,e[2]+=e[2]*t;const r=this.offset/Math.sqrt(e[3]*e[3]+e[4]*e[4]+e[5]*e[5]);return e[3]+=e[3]*r,e[4]+=e[4]*r,e[5]+=e[5]*r,e}applyToBoundingSphere(e){const t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]),r=this.offset/t;return this.sphere[0]=e[0]+e[0]*r,this.sphere[1]=e[1]+e[1]*r,this.sphere[2]=e[2]+e[2]*r,this.sphere[3]=e[3]+e[3]*this.offset/t,this.sphere}};new class{constructor(e=0){this.offset=e,this.componentLocalOriginLength=0,this.tmpVertex=(0,d.c)(),this.mbs=(0,mt.c)(),this.obb={center:(0,d.c)(),halfSize:(0,ft.c)(),quaternion:null}}set localOrigin(e){this.componentLocalOriginLength=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2])}applyToVertex(e,t,r){const i=e,o=t,n=r+this.componentLocalOriginLength,a=this.offset/Math.sqrt(i*i+o*o+n*n);return this.tmpVertex[0]=e+i*a,this.tmpVertex[1]=t+o*a,this.tmpVertex[2]=r+n*a,this.tmpVertex}applyToAabb(e){const t=e[0],r=e[1],i=e[2]+this.componentLocalOriginLength,o=e[3],n=e[4],a=e[5]+this.componentLocalOriginLength,s=this.offset/Math.sqrt(t*t+r*r+i*i);e[0]+=t*s,e[1]+=r*s,e[2]+=i*s;const l=this.offset/Math.sqrt(o*o+n*n+a*a);return e[3]+=o*l,e[4]+=n*l,e[5]+=a*l,e}applyToMbs(e){const t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]),r=this.offset/t;return this.mbs[0]=e[0]+e[0]*r,this.mbs[1]=e[1]+e[1]*r,this.mbs[2]=e[2]+e[2]*r,this.mbs[3]=e[3]+e[3]*this.offset/t,this.mbs}applyToObb(e){const t=e.center,r=this.offset/Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.obb.center[0]=t[0]+t[0]*r,this.obb.center[1]=t[1]+t[1]*r,this.obb.center[2]=t[2]+t[2]*r,(0,c.q)(this.obb.halfSize,e.halfSize,e.quaternion),(0,c.b)(this.obb.halfSize,this.obb.halfSize,e.center);const i=this.offset/Math.sqrt(this.obb.halfSize[0]*this.obb.halfSize[0]+this.obb.halfSize[1]*this.obb.halfSize[1]+this.obb.halfSize[2]*this.obb.halfSize[2]);return this.obb.halfSize[0]+=this.obb.halfSize[0]*i,this.obb.halfSize[1]+=this.obb.halfSize[1]*i,this.obb.halfSize[2]+=this.obb.halfSize[2]*i,(0,c.f)(this.obb.halfSize,this.obb.halfSize,e.center),(0,ut.c)(Lt,e.quaternion),(0,c.q)(this.obb.halfSize,this.obb.halfSize,Lt),this.obb.halfSize[0]*=this.obb.halfSize[0]<0?-1:1,this.obb.halfSize[1]*=this.obb.halfSize[1]<0?-1:1,this.obb.halfSize[2]*=this.obb.halfSize[2]<0?-1:1,this.obb.quaternion=e.quaternion,this.obb}},new class{constructor(e=0){this.offset=e,this.tmpVertex=(0,d.c)()}applyToVertex(e,t,r){const i=e+this.localOrigin[0],o=t+this.localOrigin[1],n=r+this.localOrigin[2],a=this.offset/Math.sqrt(i*i+o*o+n*n);return this.tmpVertex[0]=e+i*a,this.tmpVertex[1]=t+o*a,this.tmpVertex[2]=r+n*a,this.tmpVertex}applyToAabb(e){const t=e[0]+this.localOrigin[0],r=e[1]+this.localOrigin[1],i=e[2]+this.localOrigin[2],o=e[3]+this.localOrigin[0],n=e[4]+this.localOrigin[1],a=e[5]+this.localOrigin[2],s=this.offset/Math.sqrt(t*t+r*r+i*i);e[0]+=t*s,e[1]+=r*s,e[2]+=i*s;const l=this.offset/Math.sqrt(o*o+n*n+a*a);return e[3]+=o*l,e[4]+=n*l,e[5]+=a*l,e}};const Lt=(0,ht.a)();function zt(e,t,r,i){const o=r.typedBuffer,n=r.typedBufferStride,a=e.length;i*=n;for(let r=0;r<a;++r){const a=2*e[r];o[i]=t[a],o[i+1]=t[a+1],i+=n}}function Ht(e,t,r,i,o){const n=r.typedBuffer,a=r.typedBufferStride,s=e.length;if(i*=a,null==o||1===o)for(let r=0;r<s;++r){const o=3*e[r];n[i]=t[o],n[i+1]=t[o+1],n[i+2]=t[o+2],i+=a}else for(let r=0;r<s;++r){const s=3*e[r];for(let e=0;e<o;++e)n[i]=t[s],n[i+1]=t[s+1],n[i+2]=t[s+2],i+=a}}function It(e,t,r,i,o,n=1){if(!r)return void Ht(e,t,i,o,n);const a=i.typedBuffer,s=i.typedBufferStride,l=e.length,c=r[0],d=r[1],u=r[2],h=r[4],f=r[5],m=r[6],p=r[8],g=r[9],v=r[10],x=r[12],_=r[13],b=r[14];if(o*=s,1===n)for(let r=0;r<l;++r){const i=3*e[r],n=t[i],l=t[i+1],T=t[i+2];a[o]=c*n+h*l+p*T+x,a[o+1]=d*n+f*l+g*T+_,a[o+2]=u*n+m*l+v*T+b,o+=s}else for(let r=0;r<l;++r){const i=3*e[r],l=t[i],T=t[i+1],y=t[i+2],M=c*l+h*T+p*y+x,w=d*l+f*T+g*y+_,S=u*l+m*T+v*y+b;for(let e=0;e<n;++e)a[o]=M,a[o+1]=w,a[o+2]=S,o+=s}}function Nt(e,t,r,i,o,n=1){if(!r)return void Ht(e,t,i,o,n);const a=r,l=i.typedBuffer,c=i.typedBufferStride,d=e.length,u=a[0],h=a[1],f=a[2],m=a[4],p=a[5],g=a[6],v=a[8],x=a[9],_=a[10],b=!(0,s.k)(a),T=1e-6,y=1-T;if(o*=c,1===n)for(let r=0;r<d;++r){const i=3*e[r],n=t[i],a=t[i+1],s=t[i+2];let d=u*n+m*a+v*s,M=h*n+p*a+x*s,w=f*n+g*a+_*s;if(b){const e=d*d+M*M+w*w;if(e<y&&e>T){const t=1/Math.sqrt(e);d*=t,M*=t,w*=t}}l[o+0]=d,l[o+1]=M,l[o+2]=w,o+=c}else for(let r=0;r<d;++r){const i=3*e[r],a=t[i],s=t[i+1],d=t[i+2];let M=u*a+m*s+v*d,w=h*a+p*s+x*d,S=f*a+g*s+_*d;if(b){const e=M*M+w*w+S*S;if(e<y&&e>T){const t=1/Math.sqrt(e);M*=t,w*=t,S*=t}}for(let e=0;e<n;++e)l[o+0]=M,l[o+1]=w,l[o+2]=S,o+=c}}function Bt(e,t,r,i,o,n=1){if(!r)return void function(e,t,r,i,o=1){const n=r.typedBuffer,a=r.typedBufferStride,s=e.length;if(i*=a,1===o)for(let r=0;r<s;++r){const o=4*e[r];n[i]=t[o],n[i+1]=t[o+1],n[i+2]=t[o+2],n[i+3]=t[o+3],i+=a}else for(let r=0;r<s;++r){const s=4*e[r];for(let e=0;e<o;++e)n[i]=t[s],n[i+1]=t[s+1],n[i+2]=t[s+2],n[i+3]=t[s+3],i+=a}}(e,t,i,o,n);const a=r,l=i.typedBuffer,c=i.typedBufferStride,d=e.length,u=a[0],h=a[1],f=a[2],m=a[4],p=a[5],g=a[6],v=a[8],x=a[9],_=a[10],b=!(0,s.k)(a),T=1e-6,y=1-T;if(o*=c,1===n)for(let r=0;r<d;++r){const i=4*e[r],n=t[i],a=t[i+1],s=t[i+2],d=t[i+3];let M=u*n+m*a+v*s,w=h*n+p*a+x*s,S=f*n+g*a+_*s;if(b){const e=M*M+w*w+S*S;if(e<y&&e>T){const t=1/Math.sqrt(e);M*=t,w*=t,S*=t}}l[o+0]=M,l[o+1]=w,l[o+2]=S,l[o+3]=d,o+=c}else for(let r=0;r<d;++r){const i=4*e[r],a=t[i],s=t[i+1],d=t[i+2],M=t[i+3];let w=u*a+m*s+v*d,S=h*a+p*s+x*d,C=f*a+g*s+_*d;if(b){const e=w*w+S*S+C*C;if(e<y&&e>T){const t=1/Math.sqrt(e);w*=t,S*=t,C*=t}}for(let e=0;e<n;++e)l[o+0]=w,l[o+1]=S,l[o+2]=C,l[o+3]=M,o+=c}}function Ut(e,t,r,i,o,n=1){const a=i.typedBuffer,s=i.typedBufferStride,l=e.length;if(o*=s,1===n){if(4===r)for(let r=0;r<l;++r){const i=4*e[r];a[o]=t[i],a[o+1]=t[i+1],a[o+2]=t[i+2],a[o+3]=t[i+3],o+=s}else if(3===r)for(let r=0;r<l;++r){const i=3*e[r];a[o]=t[i],a[o+1]=t[i+1],a[o+2]=t[i+2],a[o+3]=255,o+=s}}else if(4===r)for(let r=0;r<l;++r){const i=4*e[r];for(let e=0;e<n;++e)a[o]=t[i],a[o+1]=t[i+1],a[o+2]=t[i+2],a[o+3]=t[i+3],o+=s}else if(3===r)for(let r=0;r<l;++r){const i=3*e[r];for(let e=0;e<n;++e)a[o]=t[i],a[o+1]=t[i+1],a[o+2]=t[i+2],a[o+3]=255,o+=s}}var Vt=r(43697),kt=r(51546),Gt=r(47624),Wt=r(92555),qt=r(68853),$t=r(42001),jt=r(85504),Xt=r(72303),Zt=r(98401),Kt=r(89243);const Yt=(0,r(10937).c)();class Qt{constructor(e,t){this._module=e,this._loadModule=t}get(){return this._module}async reload(){return this._module=await this._loadModule(),this._module}}function Jt(e={}){return(t,r)=>{var i,o;t._parameterNames=null!=(i=t._parameterNames)?i:[],t._parameterNames.push(r);const n=t._parameterNames.length-1,a=e.count||2,s=Math.ceil(Math.log2(a)),l=null!=(o=t._parameterBits)?o:[0];let c=0;for(;l[c]+s>16;)c++,c>=l.length&&l.push(0);t._parameterBits=l;const d=l[c],u=(1<<s)-1<<d;l[c]+=s,Object.defineProperty(t,r,{get(){return this[n]},set(e){if(this[n]!==e&&(this[n]=e,this._keyDirty=!0,this._parameterBits[c]=this._parameterBits[c]&~u|+e<<d&u,"number"!=typeof e&&"boolean"!=typeof e))throw"Configuration value for "+r+" must be boolean or number, got "+typeof e}})}}const er=["layout","centroid","smooth","case","mat2x2","mat2x3","mat2x4","mat3x2","mat3x3","mat3x4","mat4x2","mat4x3","mat4x4","uint","uvec2","uvec3","uvec4","samplerCubeShadow","sampler2DArray","sampler2DArrayShadow","isampler2D","isampler3D","isamplerCube","isampler2DArray","usampler2D","usampler3D","usamplerCube","usampler2DArray","coherent","restrict","readonly","writeonly","resource","atomic_uint","noperspective","patch","sample","subroutine","common","partition","active","filter","image1D","image2D","image3D","imageCube","iimage1D","iimage2D","iimage3D","iimageCube","uimage1D","uimage2D","uimage3D","uimageCube","image1DArray","image2DArray","iimage1DArray","iimage2DArray","uimage1DArray","uimage2DArray","image1DShadow","image2DShadow","image1DArrayShadow","image2DArrayShadow","imageBuffer","iimageBuffer","uimageBuffer","sampler1DArray","sampler1DArrayShadow","isampler1D","isampler1DArray","usampler1D","usampler1DArray","isampler2DRect","usampler2DRect","samplerBuffer","isamplerBuffer","usamplerBuffer","sampler2DMS","isampler2DMS","usampler2DMS","sampler2DMSArray","isampler2DMSArray","usampler2DMSArray","trunc","round","roundEven","isnan","isinf","floatBitsToInt","floatBitsToUint","intBitsToFloat","uintBitsToFloat","packSnorm2x16","unpackSnorm2x16","packUnorm2x16","unpackUnorm2x16","packHalf2x16","unpackHalf2x16","outerProduct","transpose","determinant","inverse","texture","textureSize","textureProj","textureLod","textureOffset","texelFetch","texelFetchOffset","textureProjOffset","textureLodOffset","textureProjLod","textureProjLodOffset","textureGrad","textureGradOffset","textureProjGrad","textureProjGradOffset"];var tr,rr={exports:{}};void 0!==(tr=["precision","highp","mediump","lowp","attribute","const","uniform","varying","break","continue","do","for","while","if","else","in","out","inout","float","int","void","bool","true","false","discard","return","mat2","mat3","mat4","vec2","vec3","vec4","ivec2","ivec3","ivec4","bvec2","bvec3","bvec4","sampler1D","sampler2D","sampler3D","samplerCube","sampler1DShadow","sampler2DShadow","struct","asm","class","union","enum","typedef","template","this","packed","goto","switch","default","inline","noinline","volatile","public","static","extern","external","interface","long","short","double","half","fixed","unsigned","input","output","hvec2","hvec3","hvec4","dvec2","dvec3","dvec4","fvec2","fvec3","fvec4","sampler2DRect","sampler3DRect","sampler2DRectShadow","sizeof","cast","namespace","using"])&&(rr.exports=tr);const ir=rr.exports;var or,nr={exports:{}};void 0!==(or=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"])&&(nr.exports=or);const ar=nr.exports;var sr,lr,cr={exports:{}};sr=cr,void 0!==(lr=["abs","acos","all","any","asin","atan","ceil","clamp","cos","cross","dFdx","dFdy","degrees","distance","dot","equal","exp","exp2","faceforward","floor","fract","gl_BackColor","gl_BackLightModelProduct","gl_BackLightProduct","gl_BackMaterial","gl_BackSecondaryColor","gl_ClipPlane","gl_ClipVertex","gl_Color","gl_DepthRange","gl_DepthRangeParameters","gl_EyePlaneQ","gl_EyePlaneR","gl_EyePlaneS","gl_EyePlaneT","gl_Fog","gl_FogCoord","gl_FogFragCoord","gl_FogParameters","gl_FragColor","gl_FragCoord","gl_FragData","gl_FragDepth","gl_FragDepthEXT","gl_FrontColor","gl_FrontFacing","gl_FrontLightModelProduct","gl_FrontLightProduct","gl_FrontMaterial","gl_FrontSecondaryColor","gl_LightModel","gl_LightModelParameters","gl_LightModelProducts","gl_LightProducts","gl_LightSource","gl_LightSourceParameters","gl_MaterialParameters","gl_MaxClipPlanes","gl_MaxCombinedTextureImageUnits","gl_MaxDrawBuffers","gl_MaxFragmentUniformComponents","gl_MaxLights","gl_MaxTextureCoords","gl_MaxTextureImageUnits","gl_MaxTextureUnits","gl_MaxVaryingFloats","gl_MaxVertexAttribs","gl_MaxVertexTextureImageUnits","gl_MaxVertexUniformComponents","gl_ModelViewMatrix","gl_ModelViewMatrixInverse","gl_ModelViewMatrixInverseTranspose","gl_ModelViewMatrixTranspose","gl_ModelViewProjectionMatrix","gl_ModelViewProjectionMatrixInverse","gl_ModelViewProjectionMatrixInverseTranspose","gl_ModelViewProjectionMatrixTranspose","gl_MultiTexCoord0","gl_MultiTexCoord1","gl_MultiTexCoord2","gl_MultiTexCoord3","gl_MultiTexCoord4","gl_MultiTexCoord5","gl_MultiTexCoord6","gl_MultiTexCoord7","gl_Normal","gl_NormalMatrix","gl_NormalScale","gl_ObjectPlaneQ","gl_ObjectPlaneR","gl_ObjectPlaneS","gl_ObjectPlaneT","gl_Point","gl_PointCoord","gl_PointParameters","gl_PointSize","gl_Position","gl_ProjectionMatrix","gl_ProjectionMatrixInverse","gl_ProjectionMatrixInverseTranspose","gl_ProjectionMatrixTranspose","gl_SecondaryColor","gl_TexCoord","gl_TextureEnvColor","gl_TextureMatrix","gl_TextureMatrixInverse","gl_TextureMatrixInverseTranspose","gl_TextureMatrixTranspose","gl_Vertex","greaterThan","greaterThanEqual","inversesqrt","length","lessThan","lessThanEqual","log","log2","matrixCompMult","max","min","mix","mod","normalize","not","notEqual","pow","radians","reflect","refract","sign","sin","smoothstep","sqrt","step","tan","texture2D","texture2DLod","texture2DProj","texture2DProjLod","textureCube","textureCubeLod","texture2DLodEXT","texture2DProjLodEXT","textureCubeLodEXT","texture2DGradEXT","texture2DProjGradEXT","textureCubeGradEXT"])&&(sr.exports=lr);const dr=cr.exports;var ur=999,hr=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"];function fr(e){return function(e){var t=function(){var e,t,r,i=0,o=0,n=ur,a=[],s=[],l=1,c=0,d=0,u=!1,h=!1,f="";return function(e){return s=[],null!==e?p(e.replace?e.replace(/\r\n/g,"\n"):e):(a.length&&m(a.join("")),n=10,m("(eof)"),s)};function m(e){e.length&&s.push({type:hr[n],data:e,position:d,line:l,column:c})}function p(t){var a;for(i=0,r=(f+=t).length;e=f[i],i<r;){switch(a=i,n){case 0:i=_();break;case 1:case 2:i=x();break;case 3:i=b();break;case 4:i=M();break;case 11:i=y();break;case 5:i=w();break;case 9999:i=S();break;case 9:i=v();break;case ur:i=g()}a!==i&&("\n"===f[a]?(c=0,++l):++c)}return o+=i,f=f.slice(i),s}function g(){return a=a.length?[]:a,"/"===t&&"*"===e?(d=o+i-1,n=0,t=e,i+1):"/"===t&&"/"===e?(d=o+i-1,n=1,t=e,i+1):"#"===e?(n=2,d=o+i,i):/\s/.test(e)?(n=9,d=o+i,i):(u=/\d/.test(e),h=/[^\w_]/.test(e),d=o+i,n=u?4:h?3:9999,i)}function v(){return/[^\s]/g.test(e)?(m(a.join("")),n=ur,i):(a.push(e),t=e,i+1)}function x(){return"\r"!==e&&"\n"!==e||"\\"===t?(a.push(e),t=e,i+1):(m(a.join("")),n=ur,i)}function _(){return"/"===e&&"*"===t?(a.push(e),m(a.join("")),n=ur,i+1):(a.push(e),t=e,i+1)}function b(){if("."===t&&/\d/.test(e))return n=5,i;if("/"===t&&"*"===e)return n=0,i;if("/"===t&&"/"===e)return n=1,i;if("."===e&&a.length){for(;T(a););return n=5,i}if(";"===e||")"===e||"("===e){if(a.length)for(;T(a););return m(e),n=ur,i+1}var r=2===a.length&&"="!==e;if(/[\w_\d\s]/.test(e)||r){for(;T(a););return n=ur,i}return a.push(e),t=e,i+1}function T(e){for(var t,r,i=0;;){if(t=ar.indexOf(e.slice(0,e.length+i).join("")),r=ar[t],-1===t){if(i--+e.length>0)continue;r=e.slice(0,1).join("")}return m(r),d+=r.length,(a=a.slice(r.length)).length}}function y(){return/[^a-fA-F0-9]/.test(e)?(m(a.join("")),n=ur,i):(a.push(e),t=e,i+1)}function M(){return"."===e||/[eE]/.test(e)?(a.push(e),n=5,t=e,i+1):"x"===e&&1===a.length&&"0"===a[0]?(n=11,a.push(e),t=e,i+1):/[^\d]/.test(e)?(m(a.join("")),n=ur,i):(a.push(e),t=e,i+1)}function w(){return"f"===e&&(a.push(e),t=e,i+=1),/[eE]/.test(e)||"-"===e&&/[eE]/.test(t)?(a.push(e),t=e,i+1):/[^\d]/.test(e)?(m(a.join("")),n=ur,i):(a.push(e),t=e,i+1)}function S(){if(/[^\d\w_]/.test(e)){var r=a.join("");return n=ir.indexOf(r)>-1?8:dr.indexOf(r)>-1?7:6,m(a.join("")),n=ur,i}return a.push(e),t=e,i+1}}(),r=[];return(r=r.concat(t(e))).concat(t(null))}(e)}const mr=["GL_OES_standard_derivatives","GL_EXT_frag_depth","GL_EXT_draw_buffers","GL_EXT_shader_texture_lod"];function pr(e,t){for(let r=t-1;r>=0;r--){const t=e[r];if("whitespace"!==t.type&&"block-comment"!==t.type){if("keyword"!==t.type)break;if("attribute"===t.data||"in"===t.data)return!0}}return!1}function gr(e,t,r,i){i=i||r;for(const o of e)if("ident"===o.type&&o.data===r)return i in t?t[i]++:t[i]=0,gr(e,t,i+"_"+t[i],i);return r}function vr(e,t,r="afterVersion"){function i(e,t){for(let r=t;r<e.length;r++){const t=e[r];if("operator"===t.type&&";"===t.data)return r}return null}const o={data:"\n",type:"whitespace"},n=t=>t<e.length&&/[^\r\n]$/.test(e[t].data);let a=function(e){let t=-1,o=0,n=-1;for(let a=0;a<e.length;a++){const s=e[a];if("preprocessor"===s.type&&(s.data.match(/\#(if|ifdef|ifndef)\s+.+/)?++o:s.data.match(/\#endif\s*.*/)&&--o),"afterVersion"!==r&&"afterPrecision"!==r||"preprocessor"===s.type&&/^#version/.test(s.data)&&(n=Math.max(n,a)),"afterPrecision"===r&&"keyword"===s.type&&"precision"===s.data){const t=i(e,a);if(null===t)throw new Error("precision statement not followed by any semicolons!");n=Math.max(n,t)}t<n&&0===o&&(t=a)}return t+1}(e);n(a-1)&&e.splice(a++,0,o);for(const r of t)e.splice(a++,0,r);n(a-1)&&n(a)&&e.splice(a,0,o)}function xr(e,t,r,i="lowp"){vr(e,[{type:"keyword",data:"out"},{type:"whitespace",data:" "},{type:"keyword",data:i},{type:"whitespace",data:" "},{type:"keyword",data:r},{type:"whitespace",data:" "},{type:"ident",data:t},{type:"operator",data:";"}],"afterPrecision")}function _r(e,t,r,i,o="lowp"){vr(e,[{type:"keyword",data:"layout"},{type:"operator",data:"("},{type:"keyword",data:"location"},{type:"whitespace",data:" "},{type:"operator",data:"="},{type:"whitespace",data:" "},{type:"integer",data:i.toString()},{type:"operator",data:")"},{type:"whitespace",data:" "},{type:"keyword",data:"out"},{type:"whitespace",data:" "},{type:"keyword",data:o},{type:"whitespace",data:" "},{type:"keyword",data:r},{type:"whitespace",data:" "},{type:"ident",data:t},{type:"operator",data:";"}],"afterPrecision")}function br(e,t){let r,i,o=-1;for(let n=t;n<e.length;n++){const t=e[n];if("operator"===t.type&&("["===t.data&&(r=n),"]"===t.data)){i=n;break}"integer"===t.type&&(o=parseInt(t.data,10))}return r&&i&&e.splice(r,i-r+1),o}const Tr=!1,yr=new Map;function Mr(e,t){if((0,o.Wi)(e)||e.length!==t.length)return!0;for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!0;return!1}function wr(e,t,r){const i="webgl2"===e.webglVersion?function(e,t){const r=function(e){return Tr?yr.get(e):null}(e);if((0,o.pC)(r))return r;const i=fr(e);if("300 es"===function(e,t="100",r="300 es"){const i=/^\s*\#version\s+([0-9]+(\s+[a-zA-Z]+)?)\s*/;for(const o of e)if("preprocessor"===o.type){const e=i.exec(o.data);if(e){const i=e[1].replace(/\s\s+/g," ");if(i===r)return i;if(i===t)return o.data="#version "+r,t;throw new Error("unknown glsl version: "+i)}}return e.splice(0,0,{type:"preprocessor",data:"#version "+r},{type:"whitespace",data:"\n"}),null}(i,"100","300 es"))throw new Error("shader is already glsl 300 es");let n=null,a=null;const s={},l={};for(let e=0;e<i.length;++e){const r=i[e];switch(r.type){case"keyword":35633===t&&"attribute"===r.data?r.data="in":"varying"===r.data&&(r.data=35633===t?"out":"in");break;case"builtin":if(/^texture(2D|Cube)(Proj)?(Lod|Grad)?(EXT)?$/.test(r.data.trim())&&(r.data=r.data.replace(/(2D|Cube|EXT)/g,"")),35632===t&&"gl_FragColor"===r.data&&(n||(n=gr(i,s,"fragColor"),xr(i,n,"vec4")),r.data=n),35632===t&&"gl_FragData"===r.data){const t=br(i,e+1),o=gr(i,s,"fragData");_r(i,o,"vec4",t,"mediump"),r.data=o}else 35632===t&&"gl_FragDepthEXT"===r.data&&(a||(a=gr(i,s,"gl_FragDepth")),r.data=a);break;case"ident":if(er.indexOf(r.data)>=0){if(35633===t&&pr(i,e))throw new Error("attribute in vertex shader uses a name that is a reserved word in glsl 300 es");r.data in l||(l[r.data]=gr(i,s,r.data)),r.data=l[r.data]}}}for(let e=i.length-1;e>=0;--e){const t=i[e];if("preprocessor"===t.type){const r=t.data.match(/\#extension\s+(.*)\:/);if(r&&r[1]&&mr.indexOf(r[1].trim())>=0){const t=i[e+1];i.splice(e,t&&"whitespace"===t.type?2:1)}const o=t.data.match(/\#ifdef\s+(.*)/);o&&o[1]&&mr.indexOf(o[1].trim())>=0&&(t.data="#if 1");const n=t.data.match(/\#ifndef\s+(.*)/);n&&n[1]&&mr.indexOf(n[1].trim())>=0&&(t.data="#if 0")}}return function(e,t){return Tr&&yr.set(e,t),t}(e,function(e){return e.map((e=>"eof"!==e.type?e.data:"")).join("")}(i))}(r,t):r,n=e.gl,a=n.createShader(t);return n.shaderSource(a,i),n.compileShader(a),(0,ce.CG)()&&!n.getShaderParameter(a,n.COMPILE_STATUS)&&(console.error("Compile error in ".concat(35633===t?"vertex":"fragment"," shader")),console.error(n.getShaderInfoLog(a)),console.error(function(e){let t=2;return e.replace(/\n/g,(()=>"\n"+function(e){return e>=1e3?e.toString():(" "+e).slice(-3)}(t++)+":"))}(i)),"webgl2"===e.webglVersion&&(console.log("Shader source before transpilation:"),console.log(r))),a}function Sr(e,t){for(let r=0;r<e.length;++r)t[r]=e[r]}class Cr extends class{constructor(e,t,r,i){this._context=e,this._locations=i,this._nameToUniformLocation={},this._nameToUniform1={},this._nameToUniform1v={},this._nameToUniform2={},this._nameToUniform3={},this._nameToUniform4={},this._nameToUniformMatrix3={},this._nameToUniformMatrix4={},e||console.error("RenderingContext isn't initialized!"),0===t.length&&console.error("Shaders source should not be empty!"),this._vShader=wr(this._context,35633,t),this._fShader=wr(this._context,35632,r),this._vShader&&this._fShader||console.error("Error loading shaders!"),this._context.instanceCounter.increment(de._g.VertexShader,this),this._context.instanceCounter.increment(de._g.FragmentShader,this)}get glName(){if((0,o.pC)(this._glName))return this._glName;if((0,o.Wi)(this._vShader))return null;const e=this._context.gl,t=e.createProgram();return e.attachShader(t,this._vShader),e.attachShader(t,this._fShader),this._locations.forEach(((r,i)=>e.bindAttribLocation(t,r,i))),e.linkProgram(t),(0,ce.CG)()&&!e.getProgramParameter(t,e.LINK_STATUS)&&console.error(`Could not link shader\nvalidated: ${e.getProgramParameter(t,e.VALIDATE_STATUS)}, gl error ${e.getError()}, vertex: ${e.getShaderParameter(this._vShader,e.COMPILE_STATUS)}, fragment: ${e.getShaderParameter(this._fShader,e.COMPILE_STATUS)}, info log: ${e.getProgramInfoLog(t)}`),this._glName=t,this._context.instanceCounter.increment(de._g.Program,this),t}dispose(){const e=this._context.gl;this._vShader&&(e.deleteShader(this._vShader),this._vShader=null,this._context.instanceCounter.decrement(de._g.VertexShader,this)),this._fShader&&(e.deleteShader(this._fShader),this._fShader=null,this._context.instanceCounter.decrement(de._g.FragmentShader,this)),this._glName&&(e.deleteProgram(this._glName),this._glName=null,this._context.instanceCounter.decrement(de._g.Program,this))}_getUniformLocation(e){return void 0===this._nameToUniformLocation[e]&&(this._nameToUniformLocation[e]=this._context.gl.getUniformLocation(this.glName,e)),this._nameToUniformLocation[e]}hasUniform(e){return null!==this._getUniformLocation(e)}setUniform1i(e,t){const r=this._nameToUniform1[e];void 0!==r&&t===r||(this._context.useProgram(this),this._context.gl.uniform1i(this._getUniformLocation(e),t),this._nameToUniform1[e]=t)}setUniform1iv(e,t){const r=this._nameToUniform1v[e];Mr(r,t)&&(this._context.useProgram(this),this._context.gl.uniform1iv(this._getUniformLocation(e),t),void 0===r?this._nameToUniform1v[e]=Array.from(t):Sr(t,r))}setUniform2iv(e,t){const r=this._nameToUniform2[e];Mr(r,t)&&(this._context.useProgram(this),this._context.gl.uniform2iv(this._getUniformLocation(e),t),void 0===r?this._nameToUniform2[e]=Array.from(t):Sr(t,r))}setUniform3iv(e,t){const r=this._nameToUniform3[e];Mr(r,t)&&(this._context.useProgram(this),this._context.gl.uniform3iv(this._getUniformLocation(e),t),void 0===r?this._nameToUniform3[e]=Array.from(t):Sr(t,r))}setUniform4iv(e,t){const r=this._nameToUniform4[e];Mr(r,t)&&(this._context.useProgram(this),this._context.gl.uniform4iv(this._getUniformLocation(e),t),void 0===r?this._nameToUniform4[e]=Array.from(t):Sr(t,r))}setUniform1f(e,t){const r=this._nameToUniform1[e];void 0!==r&&t===r||(this._context.useProgram(this),this._context.gl.uniform1f(this._getUniformLocation(e),t),this._nameToUniform1[e]=t)}setUniform1fv(e,t){const r=this._nameToUniform1v[e];Mr(r,t)&&(this._context.useProgram(this),this._context.gl.uniform1fv(this._getUniformLocation(e),t),void 0===r?this._nameToUniform1v[e]=Array.from(t):Sr(t,r))}setUniform2f(e,t,r){const i=this._nameToUniform2[e];void 0!==i&&t===i[0]&&r===i[1]||(this._context.useProgram(this),this._context.gl.uniform2f(this._getUniformLocation(e),t,r),void 0===i?this._nameToUniform2[e]=[t,r]:(i[0]=t,i[1]=r))}setUniform2fv(e,t){const r=this._nameToUniform2[e];Mr(r,t)&&(this._context.useProgram(this),this._context.gl.uniform2fv(this._getUniformLocation(e),t),void 0===r?this._nameToUniform2[e]=Array.from(t):Sr(t,r))}setUniform3f(e,t,r,i){const o=this._nameToUniform3[e];void 0!==o&&t===o[0]&&r===o[1]&&i===o[2]||(this._context.useProgram(this),this._context.gl.uniform3f(this._getUniformLocation(e),t,r,i),void 0===o?this._nameToUniform3[e]=[t,r,i]:(o[0]=t,o[1]=r,o[2]=i))}setUniform3fv(e,t){const r=this._nameToUniform3[e];Mr(r,t)&&(this._context.useProgram(this),this._context.gl.uniform3fv(this._getUniformLocation(e),t),void 0===r?this._nameToUniform3[e]=Array.from(t):Sr(t,r))}setUniform4f(e,t,r,i,o){const n=this._nameToUniform4[e];void 0!==n&&t===n[0]&&r===n[1]&&i===n[2]&&o===n[3]||(this._context.useProgram(this),this._context.gl.uniform4f(this._getUniformLocation(e),t,r,i,o),void 0===n?this._nameToUniform4[e]=[t,r,i,o]:(n[0]=t,n[1]=r,n[2]=i,n[3]=o))}setUniform4fv(e,t){const r=this._nameToUniform4[e];Mr(r,t)&&(this._context.useProgram(this),this._context.gl.uniform4fv(this._getUniformLocation(e),t),void 0===r?this._nameToUniform4[e]=Array.from(t):Sr(t,r))}setUniformMatrix3fv(e,t,r=!1,i=!1){const n=this._nameToUniformMatrix3[e];(i?n!==t:function(e,t){return!!(0,o.Wi)(e)||(9!==e.length?Mr(e,t):9!==e.length||e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||e[4]!==t[4]||e[5]!==t[5]||e[6]!==t[6]||e[7]!==t[7]||e[8]!==t[8])}(n,t))&&(this._context.useProgram(this),this._context.gl.uniformMatrix3fv(this._getUniformLocation(e),r,t),void 0===n?this._nameToUniformMatrix3[e]=Array.from(t):Sr(t,n))}setUniformMatrix4fv(e,t,r=!1){const i=this._nameToUniformMatrix4[e];(function(e,t){return!!(0,o.Wi)(e)||(16!==e.length?Mr(e,t):16!==e.length||e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||e[4]!==t[4]||e[5]!==t[5]||e[6]!==t[6]||e[7]!==t[7]||e[8]!==t[8]||e[9]!==t[9]||e[10]!==t[10]||e[11]!==t[11]||e[12]!==t[12]||e[13]!==t[13]||e[14]!==t[14]||e[15]!==t[15])})(i,t)&&(this._context.useProgram(this),this._context.gl.uniformMatrix4fv(this._getUniformLocation(e),r,t),void 0===i?this._nameToUniformMatrix4[e]=Array.from(t):Sr(t,i))}assertCompatibleVertexAttributeLocations(e){e.locations!==this._locations&&console.error("VertexAttributeLocations are incompatible")}stop(){}}{constructor(e,t,r){super(e,t.generateSource("vertex"),t.generateSource("fragment"),r),this._textures=new Map,this._freeTextureUnits=new C.Z({deallocator:null}),this._fragmentUniforms=(0,ce.hZ)()?t.fragmentUniforms.entries:null}stop(){this._textures.clear(),this._freeTextureUnits.clear()}bindTexture(e,t){if((0,o.Wi)(e)||null==e.glName){const e=this._textures.get(t);return e&&(this._context.bindTexture(null,e.unit),this._freeTextureUnit(e),this._textures.delete(t)),null}let r=this._textures.get(t);return null==r?(r=this._allocTextureUnit(e),this._textures.set(t,r)):r.texture=e,this._context.useProgram(this),this.setUniform1i(t,r.unit),this._context.bindTexture(e,r.unit),r.unit}rebindTextures(){this._context.useProgram(this),this._textures.forEach(((e,t)=>{this._context.bindTexture(e.texture,e.unit),this.setUniform1i(t,e.unit)})),(0,o.pC)(this._fragmentUniforms)&&this._fragmentUniforms.forEach((e=>{if(("sampler2D"===e.type||"samplerCube"===e.type)&&!this._textures.has(e.name))throw new Error(`Texture sampler ${e.name} has no bound texture`)}))}_allocTextureUnit(e){return{texture:e,unit:0===this._freeTextureUnits.length?this._textures.size:this._freeTextureUnits.pop()}}_freeTextureUnit(e){this._freeTextureUnits.push(e.unit)}}const Ar={mask:255},Pr={function:{func:519,ref:2,mask:2},operation:{fail:7680,zFail:7680,zPass:0}},Fr={function:{func:519,ref:2,mask:2},operation:{fail:7680,zFail:7680,zPass:7681}};var Er=r(32078);class Dr extends class{constructor(e,t,r=(()=>this.dispose())){this.release=r,t&&(this._config=t.snapshot()),this._program=this.initializeProgram(e),this._pipeline=this.initializePipeline(e)}dispose(){this._program=(0,o.O3)(this._program),this._pipeline=this._config=null}reload(e){(0,o.O3)(this._program),this._program=this.initializeProgram(e)}get program(){return this._program}get key(){return this._config.key}get configuration(){return this._config}bindPass(e,t){}bindMaterial(e,t){}bindDraw(e){}bindPipelineState(e,t=null,r){e.setPipelineState(this.getPipelineState(t,r))}ensureAttributeLocations(e){this.program.assertCompatibleVertexAttributeLocations(e)}get primitiveType(){return 4}getPipelineState(e,t){return this._pipeline}}{initializeProgram(e){const t=Dr.shader.get(),r=this.configuration,i=t.build({OITEnabled:0===r.transparencyPassType,output:r.output,viewingMode:e.viewingMode,receiveShadows:r.receiveShadows,slicePlaneEnabled:r.slicePlaneEnabled,sliceHighlightDisabled:r.sliceHighlightDisabled,sliceEnabledForVertexPrograms:!1,symbolColor:r.symbolColors,vvSize:r.vvSize,vvColor:r.vvColor,vvInstancingEnabled:!0,instanced:r.instanced,instancedColor:r.instancedColor,instancedDoublePrecision:r.instancedDoublePrecision,pbrMode:r.usePBR?r.isSchematic?2:1:0,hasMetalnessAndRoughnessTexture:r.hasMetalnessAndRoughnessTexture,hasEmissionTexture:r.hasEmissionTexture,hasOcclusionTexture:r.hasOcclusionTexture,hasNormalTexture:r.hasNormalTexture,hasColorTexture:r.hasColorTexture,receiveAmbientOcclusion:r.receiveAmbientOcclusion,useCustomDTRExponentForWater:!1,normalType:r.normalsTypeDerivate?3:0,doubleSidedMode:r.doubleSidedMode,vertexTangents:r.vertexTangents,attributeTextureCoordinates:r.hasMetalnessAndRoughnessTexture||r.hasEmissionTexture||r.hasOcclusionTexture||r.hasNormalTexture||r.hasColorTexture?1:0,textureAlphaPremultiplied:r.textureAlphaPremultiplied,attributeColor:r.vertexColors,screenSizePerspectiveEnabled:r.screenSizePerspective,verticalOffsetEnabled:r.verticalOffset,offsetBackfaces:r.offsetBackfaces,doublePrecisionRequiresObfuscation:(0,Kt.I)(e.rctx),alphaDiscardMode:r.alphaDiscardMode,supportsTextureAtlas:!1,multipassTerrainEnabled:r.multipassTerrainEnabled,cullAboveGround:r.cullAboveGround});return new Cr(e.rctx,i,ae)}bindPass(e,t){var r,i;!function(e,t){e.setUniformMatrix4fv("proj",t)}(this.program,t.camera.projectionMatrix);const o=this.configuration.output;(1===this.configuration.output||t.multipassTerrainEnabled||3===o)&&this.program.setUniform2fv("cameraNearFar",t.camera.nearFar),t.multipassTerrainEnabled&&(this.program.setUniform2fv("inverseViewport",t.inverseViewport),(0,$t.p)(this.program,t)),7===o&&(this.program.setUniform1f("opacity",e.opacity),this.program.setUniform1f("layerOpacity",e.layerOpacity),this.program.setUniform4fv("externalColor",e.externalColor),this.program.setUniform1i("colorMixMode",we.FZ[e.colorMixMode])),0===o?(t.lighting.setUniforms(this.program,!1),this.program.setUniform3fv("ambient",e.ambient),this.program.setUniform3fv("diffuse",e.diffuse),this.program.setUniform4fv("externalColor",e.externalColor),this.program.setUniform1i("colorMixMode",we.FZ[e.colorMixMode]),this.program.setUniform1f("opacity",e.opacity),this.program.setUniform1f("layerOpacity",e.layerOpacity),this.configuration.usePBR&&(0,jt.nW)(this.program,e,this.configuration.isSchematic)):4===o&&(0,qt.wW)(this.program,t),(0,Zt.uj)(this.program,e),(0,Wt.Mo)(this.program,e,t),(0,we.bj)(e.screenSizePerspective,this.program,"screenSizePerspectiveAlignment"),2!==e.textureAlphaMode&&3!==e.textureAlphaMode||this.program.setUniform1f("textureAlphaCutoff",e.textureAlphaCutoff),null==(r=t.shadowMap)||r.bind(this.program),null==(i=t.ssaoHelper)||i.bind(this.program,t.camera)}bindDraw(e){const t=this.configuration.instancedDoublePrecision?(0,d.f)(e.camera.viewInverseTransposeMatrix[3],e.camera.viewInverseTransposeMatrix[7],e.camera.viewInverseTransposeMatrix[11]):e.origin;(function(e,t,r){(0,s.a)(Yt,r,t),e.setUniform3fv("localOrigin",t),e.setUniformMatrix4fv("view",Yt)})(this.program,t,e.camera.viewMatrix),this.program.rebindTextures(),(0===this.configuration.output||7===this.configuration.output||1===this.configuration.output&&this.configuration.screenSizePerspective||2===this.configuration.output&&this.configuration.screenSizePerspective||4===this.configuration.output&&this.configuration.screenSizePerspective)&&function(e,t,r){e.setUniform3f("camPos",r[3]-t[0],r[7]-t[1],r[11]-t[2])}(this.program,t,e.camera.viewInverseTransposeMatrix),2===this.configuration.output&&this.program.setUniformMatrix4fv("viewNormal",e.camera.viewInverseTransposeMatrix),this.configuration.instancedDoublePrecision&&Gt.f.bindCustomOrigin(this.program,t),(0,kt.Vv)(this.program,this.configuration,e.slicePlane,t),0===this.configuration.output&&(0,Xt.vL)(this.program,e,t)}setPipeline(e,t){const r=this.configuration,i=3===e,o=2===e;return function(e){return ot.intern(e)}({blending:0!==r.output&&7!==r.output||!r.transparent?null:i?nt:(n=e,2===n?null:1===n?st:at),culling:Or(r)&&Fe(r.cullFace),depthTest:{func:dt(e)},depthWrite:i||o?r.writeDepth&&Ee:null,colorWrite:De,stencilWrite:r.sceneHasOcludees?Ar:null,stencilTest:r.sceneHasOcludees?t?Fr:Pr:null,polygonOffset:i||o?null:ct(r.enableOffset)});var n}initializePipeline(){return this._occludeePipelineState=this.setPipeline(this.configuration.transparencyPassType,!0),this.setPipeline(this.configuration.transparencyPassType,!1)}getPipelineState(e,t){return t?this._occludeePipelineState:super.getPipelineState(e,t)}}function Or(e){return e.cullFace?0!==e.cullFace:!e.slicePlaneEnabled&&!e.transparent&&!e.doubleSidedMode}Dr.shader=new Qt(Er.D,(()=>r.e(9291).then(r.bind(r,79291))));class Rr extends class{constructor(){this._key="",this._keyDirty=!1,this._parameterBits=this._parameterBits?this._parameterBits.map((()=>0)):[],this._parameterNames||(this._parameterNames=[])}get key(){return this._keyDirty&&(this._keyDirty=!1,this._key=String.fromCharCode.apply(String,this._parameterBits)),this._key}snapshot(){const e=this._parameterNames,t={key:this.key};for(const r of e)t[r]=this[r];return t}}{constructor(){super(...arguments),this.output=0,this.alphaDiscardMode=1,this.doubleSidedMode=0,this.isSchematic=!1,this.vertexColors=!1,this.offsetBackfaces=!1,this.symbolColors=!1,this.vvSize=!1,this.vvColor=!1,this.verticalOffset=!1,this.receiveShadows=!1,this.slicePlaneEnabled=!1,this.sliceHighlightDisabled=!1,this.receiveAmbientOcclusion=!1,this.screenSizePerspective=!1,this.textureAlphaPremultiplied=!1,this.hasColorTexture=!1,this.usePBR=!1,this.hasMetalnessAndRoughnessTexture=!1,this.hasEmissionTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.instanced=!1,this.instancedColor=!1,this.instancedDoublePrecision=!1,this.vertexTangents=!1,this.normalsTypeDerivate=!1,this.writeDepth=!0,this.sceneHasOcludees=!1,this.transparent=!1,this.enableOffset=!0,this.cullFace=0,this.transparencyPassType=3,this.multipassTerrainEnabled=!1,this.cullAboveGround=!1}}(0,Vt._)([Jt({count:8})],Rr.prototype,"output",void 0),(0,Vt._)([Jt({count:4})],Rr.prototype,"alphaDiscardMode",void 0),(0,Vt._)([Jt({count:3})],Rr.prototype,"doubleSidedMode",void 0),(0,Vt._)([Jt()],Rr.prototype,"isSchematic",void 0),(0,Vt._)([Jt()],Rr.prototype,"vertexColors",void 0),(0,Vt._)([Jt()],Rr.prototype,"offsetBackfaces",void 0),(0,Vt._)([Jt()],Rr.prototype,"symbolColors",void 0),(0,Vt._)([Jt()],Rr.prototype,"vvSize",void 0),(0,Vt._)([Jt()],Rr.prototype,"vvColor",void 0),(0,Vt._)([Jt()],Rr.prototype,"verticalOffset",void 0),(0,Vt._)([Jt()],Rr.prototype,"receiveShadows",void 0),(0,Vt._)([Jt()],Rr.prototype,"slicePlaneEnabled",void 0),(0,Vt._)([Jt()],Rr.prototype,"sliceHighlightDisabled",void 0),(0,Vt._)([Jt()],Rr.prototype,"receiveAmbientOcclusion",void 0),(0,Vt._)([Jt()],Rr.prototype,"screenSizePerspective",void 0),(0,Vt._)([Jt()],Rr.prototype,"textureAlphaPremultiplied",void 0),(0,Vt._)([Jt()],Rr.prototype,"hasColorTexture",void 0),(0,Vt._)([Jt()],Rr.prototype,"usePBR",void 0),(0,Vt._)([Jt()],Rr.prototype,"hasMetalnessAndRoughnessTexture",void 0),(0,Vt._)([Jt()],Rr.prototype,"hasEmissionTexture",void 0),(0,Vt._)([Jt()],Rr.prototype,"hasOcclusionTexture",void 0),(0,Vt._)([Jt()],Rr.prototype,"hasNormalTexture",void 0),(0,Vt._)([Jt()],Rr.prototype,"instanced",void 0),(0,Vt._)([Jt()],Rr.prototype,"instancedColor",void 0),(0,Vt._)([Jt()],Rr.prototype,"instancedDoublePrecision",void 0),(0,Vt._)([Jt()],Rr.prototype,"vertexTangents",void 0),(0,Vt._)([Jt()],Rr.prototype,"normalsTypeDerivate",void 0),(0,Vt._)([Jt()],Rr.prototype,"writeDepth",void 0),(0,Vt._)([Jt()],Rr.prototype,"sceneHasOcludees",void 0),(0,Vt._)([Jt()],Rr.prototype,"transparent",void 0),(0,Vt._)([Jt()],Rr.prototype,"enableOffset",void 0),(0,Vt._)([Jt({count:3})],Rr.prototype,"cullFace",void 0),(0,Vt._)([Jt({count:4})],Rr.prototype,"transparencyPassType",void 0),(0,Vt._)([Jt()],Rr.prototype,"multipassTerrainEnabled",void 0),(0,Vt._)([Jt()],Rr.prototype,"cullAboveGround",void 0);var Lr=r(41846);class zr extends Dr{initializeProgram(e){const t=zr.shader.get(),r=this.configuration,i=t.build({OITEnabled:0===r.transparencyPassType,output:r.output,viewingMode:e.viewingMode,receiveShadows:r.receiveShadows,slicePlaneEnabled:r.slicePlaneEnabled,sliceHighlightDisabled:r.sliceHighlightDisabled,sliceEnabledForVertexPrograms:!1,symbolColor:r.symbolColors,vvSize:r.vvSize,vvColor:r.vvColor,vvInstancingEnabled:!0,instanced:r.instanced,instancedColor:r.instancedColor,instancedDoublePrecision:r.instancedDoublePrecision,pbrMode:r.usePBR?1:0,hasMetalnessAndRoughnessTexture:!1,hasEmissionTexture:!1,hasOcclusionTexture:!1,hasNormalTexture:!1,hasColorTexture:r.hasColorTexture,receiveAmbientOcclusion:r.receiveAmbientOcclusion,useCustomDTRExponentForWater:!1,normalType:0,doubleSidedMode:2,vertexTangents:!1,attributeTextureCoordinates:r.hasColorTexture?1:0,textureAlphaPremultiplied:r.textureAlphaPremultiplied,attributeColor:r.vertexColors,screenSizePerspectiveEnabled:r.screenSizePerspective,verticalOffsetEnabled:r.verticalOffset,offsetBackfaces:r.offsetBackfaces,doublePrecisionRequiresObfuscation:(0,Kt.I)(e.rctx),alphaDiscardMode:r.alphaDiscardMode,supportsTextureAtlas:!1,multipassTerrainEnabled:r.multipassTerrainEnabled,cullAboveGround:r.cullAboveGround});return new Cr(e.rctx,i,ae)}}zr.shader=new Qt(Lr.R,(()=>r.e(8625).then(r.bind(r,28625))));class Hr extends Se{constructor(e){super(e,Nr),this.supportsEdges=!0,this.techniqueConfig=new Rr,this.vertexBufferLayout=function(e){const t=e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId,r=(0,ye.U$)().vec3f("position").vec3f("normal");return e.vertexTangents&&r.vec4f("tangent"),t&&r.vec2f("uv0"),e.vertexColors&&r.vec4u8("color"),e.symbolColors&&r.vec4u8("symbolColor"),r}(this.parameters),this.instanceBufferLayout=e.instanced?function(e){let t=(0,ye.U$)();return t=e.instancedDoublePrecision?t.vec3f("modelOriginHi").vec3f("modelOriginLo").mat3f("model").mat3f("modelNormal"):t.mat4f("model").mat4f("modelNormal"),e.instanced&&e.instanced.indexOf("color")>-1&&(t=t.vec4f("instanceColor")),e.instanced&&e.instanced.indexOf("featureAttribute")>-1&&(t=t.vec4f("instanceFeatureAttribute")),t}(this.parameters):null}isVisibleInPass(e){return 4!==e&&6!==e&&7!==e||this.parameters.castShadows}isVisible(){const e=this.parameters;if(!super.isVisible()||0===e.layerOpacity)return!1;const t=e.instanced,r=e.vertexColors,i=e.symbolColors,o=!!t&&t.indexOf("color")>-1,n=e.vvColorEnabled,a="replace"===e.colorMixMode,s=e.opacity>0,l=e.externalColor&&e.externalColor[3]>0;return r&&(o||n||i)?!!a||s:r?a?l:s:o||n||i?!!a||s:a?l:s}getTechniqueConfig(e,t){return this.techniqueConfig.output=e,this.techniqueConfig.hasNormalTexture=!!this.parameters.normalTextureId,this.techniqueConfig.hasColorTexture=!!this.parameters.textureId,this.techniqueConfig.vertexTangents=this.parameters.vertexTangents,this.techniqueConfig.instanced=!!this.parameters.instanced,this.techniqueConfig.instancedDoublePrecision=this.parameters.instancedDoublePrecision,this.techniqueConfig.vvSize=this.parameters.vvSizeEnabled,this.techniqueConfig.verticalOffset=null!==this.parameters.verticalOffset,this.techniqueConfig.screenSizePerspective=null!==this.parameters.screenSizePerspective,this.techniqueConfig.slicePlaneEnabled=this.parameters.slicePlaneEnabled,this.techniqueConfig.sliceHighlightDisabled=this.parameters.sliceHighlightDisabled,this.techniqueConfig.alphaDiscardMode=this.parameters.textureAlphaMode,this.techniqueConfig.normalsTypeDerivate="screenDerivative"===this.parameters.normals,this.techniqueConfig.transparent=this.parameters.transparent,this.techniqueConfig.writeDepth=this.parameters.writeDepth,this.techniqueConfig.sceneHasOcludees=this.parameters.sceneHasOcludees,this.techniqueConfig.cullFace=this.parameters.slicePlaneEnabled?0:this.parameters.cullFace,this.techniqueConfig.multipassTerrainEnabled=t.multipassTerrainEnabled,this.techniqueConfig.cullAboveGround=t.cullAboveGround,0!==e&&7!==e||(this.techniqueConfig.vertexColors=this.parameters.vertexColors,this.techniqueConfig.symbolColors=this.parameters.symbolColors,this.parameters.treeRendering?this.techniqueConfig.doubleSidedMode=2:this.techniqueConfig.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?1:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?2:0,this.techniqueConfig.instancedColor=!!this.parameters.instanced&&this.parameters.instanced.indexOf("color")>-1,this.techniqueConfig.receiveShadows=this.parameters.receiveShadows&&this.parameters.shadowMappingEnabled,this.techniqueConfig.receiveAmbientOcclusion=!!t.ssaoEnabled&&this.parameters.receiveSSAO,this.techniqueConfig.vvColor=this.parameters.vvColorEnabled,this.techniqueConfig.textureAlphaPremultiplied=!!this.parameters.textureAlphaPremultiplied,this.techniqueConfig.usePBR=this.parameters.usePBR,this.techniqueConfig.hasMetalnessAndRoughnessTexture=!!this.parameters.metallicRoughnessTextureId,this.techniqueConfig.hasEmissionTexture=!!this.parameters.emissiveTextureId,this.techniqueConfig.hasOcclusionTexture=!!this.parameters.occlusionTextureId,this.techniqueConfig.offsetBackfaces=!(!this.parameters.transparent||!this.parameters.offsetTransparentBackfaces),this.techniqueConfig.isSchematic=this.parameters.usePBR&&this.parameters.isSchematic,this.techniqueConfig.transparencyPassType=t.transparencyPassType,this.techniqueConfig.enableOffset=t.camera.relativeElevation<5e5),this.techniqueConfig}intersect(e,t,r,i,n,a,s){if(null!==this.parameters.verticalOffset){const e=i.camera;(0,c.s)(qr,r[12],r[13],r[14]);let t=null;switch(i.viewingMode){case 1:t=(0,c.n)(Gr,qr);break;case 2:t=(0,c.g)(Gr,kr)}let o=0;if(null!==this.parameters.verticalOffset){const r=(0,c.f)($r,qr,e.eye),i=(0,c.l)(r),n=(0,c.a)(r,r,1/i);let a=null;this.parameters.screenSizePerspective&&(a=(0,c.d)(t,n)),o+=(0,we.Hx)(e,i,this.parameters.verticalOffset,a,this.parameters.screenSizePerspective)}(0,c.a)(t,t,o),(0,c.t)(Wr,t,i.transform.inverseRotation),n=(0,c.f)(Ur,n,Wr),a=(0,c.f)(Vr,a,Wr)}var l;(0,we.Bw)(e,t,i,n,a,(l=i.verticalOffset,(0,o.pC)(l)?(Rt.offset=l,Rt):null),s)}requiresSlot(e){return e===(this.parameters.transparent?this.parameters.writeDepth?4:7:2)||20===e}createGLMaterial(e){return 0===e.output||7===e.output||1===e.output||2===e.output||3===e.output||4===e.output?new Ir(e):null}createBufferWriter(){return new Br(this.vertexBufferLayout,this.instanceBufferLayout)}}class Ir extends class extends class{constructor(e){this._material=e.material,this._techniqueRep=e.techniqueRep,this._output=e.output}dispose(){this._techniqueRep.release(this._technique)}get technique(){return this._technique}ensureTechnique(e,t,r=this._output){return this._technique=this._techniqueRep.releaseAndAcquire(e,this._material.getTechniqueConfig(r,t),this._technique),this._technique}ensureResources(e){return 2}}{constructor(e){super(e),this._numLoading=0,this._disposed=!1,this._textureRepository=e.textureRep,this._textureId=e.textureId,this._acquire(e.textureId).then((e=>this._texture=e)),this._acquire(e.normalTextureId).then((e=>this._textureNormal=e)),this._acquire(e.emissiveTextureId).then((e=>this._textureEmissive=e)),this._acquire(e.occlusionTextureId).then((e=>this._textureOcclusion=e)),this._acquire(e.metallicRoughnessTextureId).then((e=>this._textureMetallicRoughness=e))}dispose(){this._texture=(0,o.RY)(this._texture),this._textureNormal=(0,o.RY)(this._textureNormal),this._textureEmissive=(0,o.RY)(this._textureEmissive),this._textureOcclusion=(0,o.RY)(this._textureOcclusion),this._textureMetallicRoughness=(0,o.RY)(this._textureMetallicRoughness),this._disposed=!0}ensureResources(e){return 0===this._numLoading?2:1}updateTexture(e){((0,o.Wi)(this._texture)||e!==this._texture.id)&&(this._texture=(0,o.RY)(this._texture),this._textureId=e,this._acquire(this._textureId).then((e=>this._texture=e)))}bindTextures(e){(0,o.pC)(this._texture)&&e.bindTexture(this._texture.glTexture,"tex"),(0,o.pC)(this._textureNormal)&&e.bindTexture(this._textureNormal.glTexture,"normalTexture"),(0,o.pC)(this._textureEmissive)&&e.bindTexture(this._textureEmissive.glTexture,"texEmission"),(0,o.pC)(this._textureOcclusion)&&e.bindTexture(this._textureOcclusion.glTexture,"texOcclusion"),(0,o.pC)(this._textureMetallicRoughness)&&e.bindTexture(this._textureMetallicRoughness.glTexture,"texMetallicRoughness")}bindTextureScale(e){const t=(0,o.pC)(this._texture)?this._texture.glTexture:null;(0,o.pC)(t)&&t.descriptor.textureCoordinateScaleFactor?e.setUniform2fv("textureCoordinateScaleFactor",t.descriptor.textureCoordinateScaleFactor):e.setUniform2f("textureCoordinateScaleFactor",1,1)}_acquire(e){return(0,o.Wi)(e)?Promise.resolve(null):(++this._numLoading,this._textureRepository.acquire(e).then((e=>this._disposed?((0,o.RY)(e),null):e)).finally((()=>--this._numLoading)))}}{constructor(e){super({...e,...e.material.parameters})}updateParameters(e){const t=this._material.parameters;return this.updateTexture(t.textureId),this.ensureTechnique(t.treeRendering?zr:Dr,e)}_updateShadowState(e){e.shadowMappingEnabled!==this._material.parameters.shadowMappingEnabled&&this._material.setParameters({shadowMappingEnabled:e.shadowMappingEnabled})}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.sceneHasOcludees&&this._material.setParameters({sceneHasOcludees:e.hasOccludees})}beginSlot(e){return 0!==this._output&&7!==this._output||(this._updateShadowState(e),this._updateOccludeeState(e)),this.updateParameters(e)}bind(e,t){t.bindPass(this._material.parameters,e),this.bindTextures(t.program)}}const Nr={textureId:void 0,initTextureTransparent:!1,isSchematic:!1,usePBR:!1,normalTextureId:void 0,vertexTangents:!1,occlusionTextureId:void 0,emissiveTextureId:void 0,metallicRoughnessTextureId:void 0,emissiveFactor:[0,0,0],mrrFactors:[0,1,.5],ambient:[.2,.2,.2],diffuse:[.8,.8,.8],externalColor:[1,1,1,1],colorMixMode:"multiply",opacity:1,layerOpacity:1,vertexColors:!1,symbolColors:!1,doubleSided:!1,doubleSidedType:"normal",cullFace:2,instanced:void 0,instancedDoublePrecision:!1,normals:"default",receiveSSAO:!0,receiveShadows:!0,castShadows:!0,shadowMappingEnabled:!1,verticalOffset:null,screenSizePerspective:null,slicePlaneEnabled:!1,sliceHighlightDisabled:!1,offsetTransparentBackfaces:!1,vvSizeEnabled:!1,vvSizeMinSize:[1,1,1],vvSizeMaxSize:[100,100,100],vvSizeOffset:[0,0,0],vvSizeFactor:[1,1,1],vvSizeValue:[1,1,1],vvColorEnabled:!1,vvColorValues:[0,0,0,0,0,0,0,0],vvColorColors:[1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0],vvSymbolAnchor:[0,0,0],vvSymbolRotationMatrix:(0,a.c)(),transparent:!1,writeDepth:!0,textureAlphaMode:0,textureAlphaCutoff:Me.F,textureAlphaPremultiplied:!1,sceneHasOcludees:!1,renderOccluded:1};class Br{constructor(e,t){this.vertexBufferLayout=e,this.instanceBufferLayout=t}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return e.indices.get("position").length}write(e,t,r,i){!function(e,t,r,i,o,n){for(const a of t.fieldNames){const t=e.vertexAttributes.get(a),s=e.indices.get(a);if(t&&s)switch(a){case"position":{(0,A.hu)(3===t.size);const e=o.getField(a,h.ct);e&&It(s,t.data,r,e,n);break}case"normal":{(0,A.hu)(3===t.size);const e=o.getField(a,h.ct);e&&Nt(s,t.data,i,e,n);break}case"uv0":{(0,A.hu)(2===t.size);const e=o.getField(a,h.Eu);e&&zt(s,t.data,e,n);break}case"color":{(0,A.hu)(3===t.size||4===t.size);const e=o.getField(a,h.mc);e&&Ut(s,t.data,t.size,e,n);break}case"symbolColor":{(0,A.hu)(3===t.size||4===t.size);const e=o.getField(a,h.mc);e&&Ut(s,t.data,t.size,e,n);break}case"tangent":{(0,A.hu)(4===t.size);const e=o.getField(a,h.ek);e&&Bt(s,t.data,i,e,n);break}}}}(t,this.vertexBufferLayout,e.transformation,e.invTranspTransformation,r,i)}}const Ur=(0,d.c)(),Vr=(0,d.c)(),kr=(0,d.f)(0,0,1),Gr=(0,d.c)(),Wr=(0,d.c)(),qr=(0,d.c)(),$r=(0,d.c)(),jr=y.Z.getLogger("esri.views.3d.layers.graphics.objectResourceUtils");function Xr(e){throw new T.Z("",`Request for object resource failed: ${e}`)}function Zr(e){const t=e.params,r=t.topology;let i=!0;switch(t.vertexAttributes||(jr.warn("Geometry must specify vertex attributes"),i=!1),t.topology){case"PerAttributeArray":break;case"Indexed":case null:case void 0:{const e=t.faces;if(e){if(t.vertexAttributes)for(const r in t.vertexAttributes){const t=e[r];t&&t.values?(null!=t.valueType&&"UInt32"!==t.valueType&&(jr.warn(`Unsupported indexed geometry indices type '${t.valueType}', only UInt32 is currently supported`),i=!1),null!=t.valuesPerElement&&1!==t.valuesPerElement&&(jr.warn(`Unsupported indexed geometry values per element '${t.valuesPerElement}', only 1 is currently supported`),i=!1)):(jr.warn(`Indexed geometry does not specify face indices for '${r}' attribute`),i=!1)}}else jr.warn("Indexed geometries must specify faces"),i=!1;break}default:jr.warn(`Unsupported topology '${r}'`),i=!1}e.params.material||(jr.warn("Geometry requires material"),i=!1);const o=e.params.vertexAttributes;for(const e in o)o[e].values||(jr.warn("Geometries with externally defined attributes are not yet supported"),i=!1);return i}function Kr(e){const t=(0,u.cS)();return e.forEach((e=>{const r=e.boundingInfo;(0,o.pC)(r)&&((0,u.pp)(t,r.getBBMin()),(0,u.pp)(t,r.getBBMax()))})),t}async function Yr(e,t){const r=[];for(const i in e){const n=e[i],a=n.images[0].data;if(!a){jr.warn("Externally referenced texture data is not yet supported");continue}const s=n.encoding+";base64,"+a,l="/textureDefinitions/"+i,c="rgba"===n.channels?n.alphaChannelUsage||"transparency":"none",d={noUnpackFlip:!0,wrap:{s:10497,t:10497},preMultiplyAlpha:1!==Qr(c)},u=(0,o.pC)(t)&&t.disableTextures?Promise.resolve(null):S(s,t);r.push(u.then((e=>({refId:l,image:e,params:d,alphaChannelUsage:c}))))}const i=await Promise.all(r),n={};for(const e of i)n[e.refId]=e;return n}function Qr(e){switch(e){case"mask":return 2;case"maskAndTransparency":return 3;case"none":return 1;default:return 0}}function Jr(e){const t=e.params;return{id:1,material:t.material,texture:t.texture,region:t.texture}}const ei=new w.G(1,2,"wosr");var ti=r(57758),ri=r(10816),ii=r(75488),oi=r(56067);async function ni(e,t){const r=ai((0,i.pJ)(e));if("wosr"===r.fileType){const e=await(t.cache?t.cache.loadWOSR(r.url,t):async function(e,t){const r=await async function(e,t){const r=(0,o.pC)(t)&&t.streamDataRequester;if(r)return async function(e,t,r){const i=await(0,b.q6)(t.request(e,"json",r));if(!0===i.ok)return i.value;(0,M.r9)(i.error),Xr(i.error.details.url)}(e,r,t);const i=await(0,b.q6)((0,_.default)(e,(0,o.Wg)(t)));if(!0===i.ok)return i.value.data;(0,M.r9)(i.error),Xr(i.error)}(e,t);return{resource:r,textures:await Yr(r.textureDefinitions,t)}}(r.url,t)),i=function(e,t){const r=[],i=[],n=[],a=[],s=e.resource,l=w.G.parse(s.version||"1.0","wosr");ei.validate(l);const c=s.model.name,u=s.model.geometries,h=s.materialDefinitions,f=e.textures;let m=0;const p=new Map;for(let e=0;e<u.length;e++){const s=u[e];if(!Zr(s))continue;const l=Jr(s),c=s.params.vertexAttributes,g=[];for(const e in c){const t=c[e],r=t.values;g.push([e,{data:r,size:t.valuesPerElement,exclusive:!0}])}const v=[];if("PerAttributeArray"!==s.params.topology){const e=s.params.faces;for(const t in e)v.push([t,new Uint32Array(e[t].values)])}const x=f&&f[l.texture];if(x&&!p.has(l.texture)){const{image:e,params:t}=x,r=new Te(e,t);a.push(r),p.set(l.texture,r)}const _=p.get(l.texture),b=_?_.id:void 0;let T=n[l.material]?n[l.material][l.texture]:null;if(!T){const e=h[l.material.substring(l.material.lastIndexOf("/")+1)].params;1===e.transparency&&(e.transparency=0);const r=x&&x.alphaChannelUsage,i=e.transparency>0||"transparency"===r||"maskAndTransparency"===r,a=x?Qr(x.alphaChannelUsage):void 0,s={ambient:(0,d.d)(e.diffuse),diffuse:(0,d.d)(e.diffuse),opacity:1-(e.transparency||0),transparent:i,textureAlphaMode:a,textureAlphaCutoff:.33,textureId:b,initTextureTransparent:!0,doubleSided:!0,cullFace:0,colorMixMode:e.externalColorMixMode||"tint",textureAlphaPremultiplied:!!x&&!!x.params.preMultiplyAlpha};(0,o.pC)(t)&&t.materialParamsMixin&&Object.assign(s,t.materialParamsMixin),T=new Hr(s),n[l.material]||(n[l.material]={}),n[l.material][l.texture]=T}i.push(T);const y=new R(g,v);m+=v.position?v.position.length:0,r.push(y)}return{name:c,stageResources:{textures:a,materials:i,geometries:r},pivotOffset:s.model.pivotOffset,boundingBox:Kr(r),numberOfVertices:m,lodThreshold:null}}(e,t);return{lods:[i],referenceBoundingBox:i.boundingBox,isEsriSymbolResource:!1,isWosr:!0,remove:e.remove}}const n=await(t.cache?t.cache.loadGLTF(r.url,t,t.usePBR):(0,v.z)(new g.C(t.streamDataRequester),r.url,t,t.usePBR)),a=(0,o.U2)(n.model.meta,"ESRI_proxyEllipsoid");n.meta.isEsriSymbolResource&&(0,o.pC)(a)&&-1!==n.meta.uri.indexOf("/RealisticTrees/")&&function(e,t){for(let r=0;r<e.model.lods.length;++r){const i=e.model.lods[r];e.customMeta.esriTreeRendering=!0;for(const n of i.parts){const i=n.attributes.normal;if((0,o.Wi)(i))return;const a=n.attributes.position,u=a.count,f=(0,d.c)(),m=(0,d.c)(),g=(0,d.c)(),v=(0,p.gS)(h.mc,u),x=(0,p.gS)(h.ct,u),_=(0,s.b)((0,l.c)(),n.transform);for(let o=0;o<u;o++){a.getVec(o,m),i.getVec(o,f),(0,c.m)(m,m,n.transform),(0,c.f)(g,m,t.center),(0,c.E)(g,g,t.radius);const s=g[2],l=(0,c.l)(g),d=Math.min(.45+.55*l*l,1);(0,c.E)(g,g,t.radius),(0,c.m)(g,g,_),(0,c.n)(g,g),r+1!==e.model.lods.length&&e.model.lods.length>1&&(0,c.e)(g,g,f,s>-1?.2:Math.min(-4*s-3.8,1)),x.setVec(o,g),v.set(o,0,255*d),v.set(o,1,255*d),v.set(o,2,255*d),v.set(o,3,255)}n.attributes.normal=x,n.attributes.color=v}}}(n,a);const u=n.meta.isEsriSymbolResource?{usePBR:t.usePBR,isSchematic:!1,treeRendering:n.customMeta.esriTreeRendering,mrrFactors:[0,1,.2]}:{usePBR:t.usePBR,isSchematic:!1,mrrFactors:[0,1,.5]},f={...t.materialParamsMixin,treeRendering:n.customMeta.esriTreeRendering};if(null!=r.specifiedLodIndex){const e=si(n,u,f,r.specifiedLodIndex);let t=e[0].boundingBox;return 0!==r.specifiedLodIndex&&(t=si(n,u,f,0)[0].boundingBox),{lods:e,referenceBoundingBox:t,isEsriSymbolResource:n.meta.isEsriSymbolResource,isWosr:!1,remove:n.remove}}const m=si(n,u,f);return{lods:m,referenceBoundingBox:m[0].boundingBox,isEsriSymbolResource:n.meta.isEsriSymbolResource,isWosr:!1,remove:n.remove}}function ai(e){const t=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);return t?{fileType:"gltf",url:t[1],specifiedLodIndex:null!=t[4]?Number(t[4]):null}:e.match(/(.*\.(json|json\.gz))$/)?{fileType:"wosr",url:e,specifiedLodIndex:null}:{fileType:"unknown",url:e,specifiedLodIndex:null}}function si(e,t,r,i){const s=e.model,l=(0,a.c)(),c=new Array,d=new Map,g=new Map;return s.lods.forEach(((e,a)=>{if(void 0!==i&&a!==i)return;const v={name:e.name,stageResources:{textures:new Array,materials:new Array,geometries:new Array},lodThreshold:(0,o.pC)(e.lodThreshold)?e.lodThreshold:null,pivotOffset:[0,0,0],numberOfVertices:0,boundingBox:(0,u.cS)()};c.push(v),e.parts.forEach((e=>{const i=e.material+(e.attributes.normal?"_normal":"")+(e.attributes.color?"_color":"")+(e.attributes.texCoord0?"_texCoord0":"")+(e.attributes.tangent?"_tangent":""),a=s.materials.get(e.material),c=(0,o.pC)(e.attributes.texCoord0),_=(0,o.pC)(e.attributes.normal),b=function(e){switch(e){case"BLEND":return 0;case"MASK":return 2;case"OPAQUE":case null:case void 0:return 1}}(a.alphaMode);if(!d.has(i)){if(c){if((0,o.pC)(a.textureColor)&&!g.has(a.textureColor)){const e=s.textures.get(a.textureColor),t={...e.parameters,preMultiplyAlpha:1!==b};g.set(a.textureColor,new Te(e.data,t))}if((0,o.pC)(a.textureNormal)&&!g.has(a.textureNormal)){const e=s.textures.get(a.textureNormal);g.set(a.textureNormal,new Te(e.data,e.parameters))}if((0,o.pC)(a.textureOcclusion)&&!g.has(a.textureOcclusion)){const e=s.textures.get(a.textureOcclusion);g.set(a.textureOcclusion,new Te(e.data,e.parameters))}if((0,o.pC)(a.textureEmissive)&&!g.has(a.textureEmissive)){const e=s.textures.get(a.textureEmissive);g.set(a.textureEmissive,new Te(e.data,e.parameters))}if((0,o.pC)(a.textureMetallicRoughness)&&!g.has(a.textureMetallicRoughness)){const e=s.textures.get(a.textureMetallicRoughness);g.set(a.textureMetallicRoughness,new Te(e.data,e.parameters))}}const n=a.color[0]**(1/ti.K),l=a.color[1]**(1/ti.K),u=a.color[2]**(1/ti.K),h=a.emissiveFactor[0]**(1/ti.K),f=a.emissiveFactor[1]**(1/ti.K),m=a.emissiveFactor[2]**(1/ti.K),p=(0,o.pC)(a.textureColor)&&c?g.get(a.textureColor):null;d.set(i,new Hr({...t,transparent:0===b,textureAlphaMode:b,textureAlphaCutoff:a.alphaCutoff,diffuse:[n,l,u],ambient:[n,l,u],opacity:a.opacity,doubleSided:a.doubleSided,doubleSidedType:"winding-order",cullFace:a.doubleSided?0:2,vertexColors:!!e.attributes.color,vertexTangents:!!e.attributes.tangent,normals:_?"default":"screenDerivative",castShadows:!0,receiveSSAO:!0,textureId:(0,o.pC)(p)?p.id:void 0,colorMixMode:a.colorMixMode,normalTextureId:(0,o.pC)(a.textureNormal)&&c?g.get(a.textureNormal).id:void 0,textureAlphaPremultiplied:(0,o.pC)(p)&&!!p.params.preMultiplyAlpha,occlusionTextureId:(0,o.pC)(a.textureOcclusion)&&c?g.get(a.textureOcclusion).id:void 0,emissiveTextureId:(0,o.pC)(a.textureEmissive)&&c?g.get(a.textureEmissive).id:void 0,metallicRoughnessTextureId:(0,o.pC)(a.textureMetallicRoughness)&&c?g.get(a.textureMetallicRoughness).id:void 0,emissiveFactor:[h,f,m],mrrFactors:[a.metallicFactor,a.roughnessFactor,t.mrrFactors[2]],isSchematic:!1,...r}))}const T=function(e,t){switch(t){case 4:return(0,x.nh)(e);case 5:return(0,x.DA)(e);case 6:return(0,x.jX)(e)}}(e.indices||e.attributes.position.count,e.primitiveType),y=e.attributes.position.count,M=(0,p.gS)(h.ct,y);(0,f.t)(M,e.attributes.position,e.transform);const w=[["position",{data:M.typedBuffer,size:M.elementCount,exclusive:!0}]],S=[["position",T]];if((0,o.pC)(e.attributes.normal)){const t=(0,p.gS)(h.ct,y);(0,n.a)(l,e.transform),(0,f.a)(t,e.attributes.normal,l),w.push(["normal",{data:t.typedBuffer,size:t.elementCount,exclusive:!0}]),S.push(["normal",T])}if((0,o.pC)(e.attributes.tangent)){const t=(0,p.gS)(h.ek,y);(0,n.a)(l,e.transform),(0,m.t)(t,e.attributes.tangent,l),w.push(["tangent",{data:t.typedBuffer,size:t.elementCount,exclusive:!0}]),S.push(["tangent",T])}if((0,o.pC)(e.attributes.texCoord0)){const t=(0,p.gS)(h.Eu,y);(0,ri.n)(t,e.attributes.texCoord0),w.push(["uv0",{data:t.typedBuffer,size:t.elementCount,exclusive:!0}]),S.push(["uv0",T])}if((0,o.pC)(e.attributes.color)){const t=(0,p.gS)(h.mc,y);if(4===e.attributes.color.elementCount)e.attributes.color instanceof h.ek?(0,m.s)(t,e.attributes.color,255):e.attributes.color instanceof h.mc?(0,ii.c)(t,e.attributes.color):e.attributes.color instanceof h.v6&&(0,m.s)(t,e.attributes.color,1/256);else{(0,ii.f)(t,255,255,255,255);const r=new h.ne(t.buffer,0,4);e.attributes.color instanceof h.ct?(0,f.s)(r,e.attributes.color,255):e.attributes.color instanceof h.ne?(0,oi.c)(r,e.attributes.color):e.attributes.color instanceof h.mw&&(0,f.s)(r,e.attributes.color,1/256)}w.push(["color",{data:t.typedBuffer,size:t.elementCount,exclusive:!0}]),S.push(["color",T])}const C=new R(w,S);v.stageResources.geometries.push(C),v.stageResources.materials.push(d.get(i)),c&&((0,o.pC)(a.textureColor)&&v.stageResources.textures.push(g.get(a.textureColor)),(0,o.pC)(a.textureNormal)&&v.stageResources.textures.push(g.get(a.textureNormal)),(0,o.pC)(a.textureOcclusion)&&v.stageResources.textures.push(g.get(a.textureOcclusion)),(0,o.pC)(a.textureEmissive)&&v.stageResources.textures.push(g.get(a.textureEmissive)),(0,o.pC)(a.textureMetallicRoughness)&&v.stageResources.textures.push(g.get(a.textureMetallicRoughness))),v.numberOfVertices+=y;const A=C.boundingInfo;(0,o.pC)(A)&&((0,u.pp)(v.boundingBox,A.getBBMin()),(0,u.pp)(v.boundingBox,A.getBBMax()))}))})),c}},65576:(e,t,r)=>{r.d(t,{U$:()=>s});var i=r(56481),o=r(79583);class n{constructor(e,t){this.layout=e,this.buffer="number"==typeof t?new ArrayBuffer(t*e.stride):t;for(const t of e.fieldNames){const r=e.fields.get(t);this[t]=new r.constructor(this.buffer,r.offset,this.stride)}}get stride(){return this.layout.stride}get count(){return this.buffer.byteLength/this.stride}get byteLength(){return this.buffer.byteLength}getField(e,t){const r=this[e];return r&&r.elementCount===t.ElementCount&&r.elementType===t.ElementType?r:null}slice(e,t){return new n(this.layout,this.buffer.slice(e*this.stride,t*this.stride))}copyFrom(e,t,r,i){const o=this.stride;if(o%4==0){const n=new Uint32Array(e.buffer,t*o,i*o/4);new Uint32Array(this.buffer,r*o,i*o/4).set(n)}else{const n=new Uint8Array(e.buffer,t*o,i*o);new Uint8Array(this.buffer,r*o,i*o).set(n)}}}class a{constructor(){this.stride=0,this.fields=new Map,this.fieldNames=[]}vec2f(e,t){return this.appendField(e,i.Eu,t),this}vec2f64(e,t){return this.appendField(e,i.q6,t),this}vec3f(e,t){return this.appendField(e,i.ct,t),this}vec3f64(e,t){return this.appendField(e,i.fP,t),this}vec4f(e,t){return this.appendField(e,i.ek,t),this}vec4f64(e,t){return this.appendField(e,i.Cd,t),this}mat3f(e,t){return this.appendField(e,i.gK,t),this}mat3f64(e,t){return this.appendField(e,i.ey,t),this}mat4f(e,t){return this.appendField(e,i.bj,t),this}mat4f64(e,t){return this.appendField(e,i.O1,t),this}vec4u8(e,t){return this.appendField(e,i.mc,t),this}f32(e,t){return this.appendField(e,i.ly,t),this}f64(e,t){return this.appendField(e,i.oS,t),this}u8(e,t){return this.appendField(e,i.D_,t),this}u16(e,t){return this.appendField(e,i.av,t),this}i8(e,t){return this.appendField(e,i.Hz,t),this}vec2i8(e,t){return this.appendField(e,i.Vs,t),this}vec2i16(e,t){return this.appendField(e,i.or,t),this}vec2u8(e,t){return this.appendField(e,i.xA,t),this}vec4u16(e,t){return this.appendField(e,i.v6,t),this}u32(e,t){return this.appendField(e,i.Nu,t),this}appendField(e,t,r){const i=t.ElementCount*(0,o.n1)(t.ElementType),n=this.stride;this.fields.set(e,{size:i,constructor:t,offset:n,optional:r}),this.stride+=i,this.fieldNames.push(e)}alignTo(e){return this.stride=Math.floor((this.stride+e-1)/e)*e,this}hasField(e){return this.fieldNames.indexOf(e)>=0}createBuffer(e){return new n(this,e)}createView(e){return new n(this,e)}clone(){const e=new a;return e.stride=this.stride,e.fields=new Map,this.fields.forEach(((t,r)=>e.fields.set(r,t))),e.fieldNames=this.fieldNames.slice(),e.BufferType=this.BufferType,e}}function s(){return new a}},1391:(e,t,r)=>{r.d(t,{q:()=>o});var i=r(74709);function o(e,t){0===t.output&&t.receiveShadows?(e.varyings.add("linearDepth","float"),e.vertex.code.add(i.H`void forwardLinearDepth() { linearDepth = gl_Position.w; }`)):1===t.output||3===t.output?(e.varyings.add("linearDepth","float"),e.vertex.uniforms.add("cameraNearFar","vec2"),e.vertex.code.add(i.H`void forwardLinearDepth() {
160
160
  linearDepth = (-position_view().z - cameraNearFar[0]) / (cameraNearFar[1] - cameraNearFar[0]);
161
161
  }`)):e.vertex.code.add(i.H`void forwardLinearDepth() {}`)}},62707:(e,t,r)=>{r.d(t,{w:()=>o});var i=r(74709);function o(e){e.vertex.code.add(i.H`vec4 offsetBackfacingClipPosition(vec4 posClip, vec3 posWorld, vec3 normalWorld, vec3 camPosWorld) {
162
162
  vec3 camToVert = posWorld - camPosWorld;