@doegis/core
Version:
DOE GIS API
286 lines (255 loc) • 225 kB
JavaScript
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[9746],{32078:(e,t,r)=>{r.d(t,{D:()=>k,b:()=>W});var i=r(70586),o=r(13598),n=r(1391),a=r(62707),s=r(55039),l=r(51546),c=r(77171),d=r(47624),u=r(64267),h=r(37099),f=r(76056),m=r(135),p=r(11317),g=r(15719),v=r(92555),_=r(89136),x=r(15817),T=r(72160),b=r(89753),A=r(5802),E=r(42001),w=r(19419),S=r(26322),y=r(85504),C=r(22539),R=r(57806),M=r(82550),O=r(96310),P=r(85787),N=r(90692),I=r(93669),L=r(172),D=r(71250),F=r(21437),H=r(74709),B=r(8319),U=r(33680),z=r(98069),V=r(93144),G=r(35065);function W(e){const t=new U.kG,{vertex:r,fragment:W,varyings:k}=t;return(0,I.Sv)(r,e),t.include(h.f),k.add("vpos","vec3"),t.include(M.k,e),t.include(d.f,e),t.include(v.L,e),e.hasColorTextureTransform&&t.include(R.av),e.output!==s.H.Color&&e.output!==s.H.Alpha||(e.hasNormalTextureTransform&&t.include(R.NI),e.hasEmissionTextureTransform&&t.include(R.R5),e.hasOcclusionTextureTransform&&t.include(R.jF),e.hasMetallicRoughnessTextureTransform&&t.include(R.DT),(0,I.hY)(r,e),t.include(u.O,e),t.include(c.w,e),e.normalType===u.h.Attribute&&e.offsetBackfaces&&t.include(a.w),t.include(x.Q,e),t.include(g.Bb,e),e.instancedColor&&t.attributes.add(G.T.INSTANCECOLOR,"vec4"),k.add("localvpos","vec3"),t.include(m.D,e),t.include(n.qj,e),t.include(f.R,e),t.include(p.c,e),r.uniforms.add(new D.N("externalColor",(e=>e.externalColor))),k.add("vcolorExt","vec4"),e.hasMultipassTerrain&&k.add("depth","float"),e.hasModelTransformation&&r.uniforms.add(new B.g("model",(e=>(0,i.pC)(e.modelTransformation)?e.modelTransformation:o.I))),r.code.add(H.H`
void main(void) {
forwardNormalizedVertexColor();
vcolorExt = externalColor;
${e.instancedColor?"vcolorExt *= instanceColor;":""}
vcolorExt *= vvColor();
vcolorExt *= getSymbolColor();
forwardColorMixMode();
if (vcolorExt.a < ${H.H.float(O.b)}) {
gl_Position = vec4(1e38, 1e38, 1e38, 1.0);
} else {
vpos = calculateVPos();
localvpos = vpos - view[3].xyz;
vpos = subtractOrigin(vpos);
${e.normalType===u.h.Attribute?H.H`vNormalWorld = dpNormal(vvLocalNormal(normalModel()));`:""}
vpos = addVerticalOffset(vpos, localOrigin);
${e.hasVertexTangents?"vTangent = dpTransformVertexTangent(tangent);":""}
gl_Position = transformPosition(proj, view, ${e.hasModelTransformation?"model,":""} vpos);
${e.normalType===u.h.Attribute&&e.offsetBackfaces?"gl_Position = offsetBackfacingClipPosition(gl_Position, vpos, vNormalWorld, cameraPosition);":""}
}
${e.hasMultipassTerrain?"depth = (view * vec4(vpos, 1.0)).z;":""}
forwardLinearDepth();
forwardTextureCoordinates();
${e.hasColorTextureTransform?H.H`forwardColorUV();`:""}
${e.hasNormalTextureTransform?H.H`forwardNormalUV();`:""}
${e.hasEmissionTextureTransform?H.H`forwardEmissiveUV();`:""}
${e.hasOcclusionTextureTransform?H.H`forwardOcclusionUV();`:""}
${e.hasMetallicRoughnessTextureTransform?H.H`forwardMetallicRoughnessUV();`:""}
}
`)),e.output===s.H.Alpha&&(t.include(l.f5,e),t.include(P.z,e),t.include(E.l,e),W.uniforms.add([new F.p("opacity",(e=>e.opacity)),new F.p("layerOpacity",(e=>e.layerOpacity))]),e.hasColorTexture&&W.uniforms.add(new z.A("tex",(e=>e.texture))),W.include(N.y),W.code.add(H.H`
void main() {
discardBySlice(vpos);
${e.hasMultipassTerrain?"terrainDepthTest(gl_FragCoord, depth);":""}
${e.hasColorTexture?H.H`
vec4 texColor = texture2D(tex, ${e.hasColorTextureTransform?H.H`colorUV`:H.H`vuv0`});
${e.textureAlphaPremultiplied?"texColor.rgb /= texColor.a;":""}
discardOrAdjustAlpha(texColor);`:H.H`vec4 texColor = vec4(1.0);`}
${e.hasVertexColors?H.H`float opacity_ = layerOpacity * mixExternalOpacity(vColor.a * opacity, texColor.a, vcolorExt.a, int(colorMixMode));`:H.H`float opacity_ = layerOpacity * mixExternalOpacity(opacity, texColor.a, vcolorExt.a, int(colorMixMode));`}
gl_FragColor = vec4(opacity_);
}
`)),e.output===s.H.Color&&(t.include(l.f5,e),t.include(b.XP,e),t.include(T.K,e),t.include(P.z,e),t.include(e.instancedDoublePrecision?C.hb:C.XE,e),t.include(E.l,e),(0,I.hY)(W,e),W.uniforms.add([r.uniforms.get("localOrigin"),new L.J("ambient",(e=>e.ambient)),new L.J("diffuse",(e=>e.diffuse)),new F.p("opacity",(e=>e.opacity)),new F.p("layerOpacity",(e=>e.layerOpacity))]),e.hasColorTexture&&W.uniforms.add(new z.A("tex",(e=>e.texture))),t.include(y.jV,e),t.include(S.T,e),W.include(N.y),t.include(w.k,e),(0,b.PN)(W),(0,b.sC)(W),(0,A.F1)(W),W.code.add(H.H`
void main() {
discardBySlice(vpos);
${e.hasMultipassTerrain?"terrainDepthTest(gl_FragCoord, depth);":""}
${e.hasColorTexture?H.H`
vec4 texColor = texture2D(tex, ${e.hasColorTextureTransform?H.H`colorUV`:H.H`vuv0`});
${e.textureAlphaPremultiplied?"texColor.rgb /= texColor.a;":""}
discardOrAdjustAlpha(texColor);`:H.H`vec4 texColor = vec4(1.0);`}
shadingParams.viewDirection = normalize(vpos - cameraPosition);
${e.normalType===u.h.ScreenDerivative?H.H`
vec3 normal = screenDerivativeNormal(localvpos);`:H.H`
shadingParams.normalView = vNormalWorld;
vec3 normal = shadingNormal(shadingParams);`}
${e.pbrMode===y.f7.Normal?"applyPBRFactors();":""}
float ssao = evaluateAmbientOcclusionInverse();
ssao *= getBakedOcclusion();
vec3 posWorld = vpos + localOrigin;
float additionalAmbientScale = additionalDirectedAmbientLight(posWorld);
float shadow = ${e.receiveShadows?"readShadowMap(vpos, linearDepth)":e.spherical?"lightingGlobalFactor * (1.0 - additionalAmbientScale)":"0.0"};
vec3 matColor = max(ambient, diffuse);
${e.hasVertexColors?H.H`
vec3 albedo = mixExternalColor(vColor.rgb * matColor, texColor.rgb, vcolorExt.rgb, int(colorMixMode));
float opacity_ = layerOpacity * mixExternalOpacity(vColor.a * opacity, texColor.a, vcolorExt.a, int(colorMixMode));`:H.H`
vec3 albedo = mixExternalColor(matColor, texColor.rgb, vcolorExt.rgb, int(colorMixMode));
float opacity_ = layerOpacity * mixExternalOpacity(opacity, texColor.a, vcolorExt.a, int(colorMixMode));`}
${e.hasNormalTexture?H.H`
mat3 tangentSpace = ${e.hasVertexTangents?"computeTangentSpace(normal);":"computeTangentSpace(normal, vpos, vuv0);"}
vec3 shadingNormal = computeTextureNormal(tangentSpace, vuv0);`:H.H`vec3 shadingNormal = normal;`}
vec3 normalGround = ${e.spherical?H.H`normalize(posWorld);`:H.H`vec3(0.0, 0.0, 1.0);`}
${e.snowCover?H.H`
float snow = smoothstep(0.5, 0.55, dot(normal, normalGround));
albedo = mix(albedo, vec3(1), snow);
shadingNormal = mix(shadingNormal, normal, snow);
ssao = mix(ssao, 1.0, snow);`:""}
vec3 additionalLight = ssao * mainLightIntensity * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor;
${e.pbrMode===y.f7.Normal||e.pbrMode===y.f7.Schematic?H.H`
float additionalAmbientIrradiance = additionalAmbientIrradianceFactor * mainLightIntensity[2];
${e.snowCover?H.H`
mrr = mix(mrr, vec3(0.0, 1.0, 0.04), snow);
emission = mix(emission, vec3(0.0), snow);`:""}
vec3 shadedColor = evaluateSceneLightingPBR(shadingNormal, albedo, shadow, 1.0 - ssao, additionalLight, shadingParams.viewDirection, normalGround, mrr, emission, additionalAmbientIrradiance);`:H.H`vec3 shadedColor = evaluateSceneLighting(shadingNormal, albedo, shadow, 1.0 - ssao, additionalLight);`}
gl_FragColor = highlightSlice(vec4(shadedColor, opacity_), vpos);
${e.transparencyPassType===V.A.Color?H.H`gl_FragColor = premultiplyAlpha(gl_FragColor);`:""}
}
`)),t.include(_.s,e),t}const k=Object.freeze(Object.defineProperty({__proto__:null,build:W},Symbol.toStringTag,{value:"Module"}))},41846:(e,t,r)=>{r.d(t,{R:()=>H,b:()=>F});var i=r(1391),o=r(62707),n=r(55039),a=r(51546),s=r(77171),l=r(47624),c=r(64267),d=r(37099),u=r(76056),h=r(135),f=r(11317),m=r(92555),p=r(89136),g=r(72160),v=r(89753),_=r(5802),x=r(42001),T=r(26322),b=r(85504),A=r(22539),E=r(82550),w=r(96310),S=r(85787),y=r(90692),C=r(93669),R=r(172),M=r(71250),O=r(21437),P=r(74709),N=r(33680),I=r(98069),L=r(93144),D=r(35065);function F(e){const t=new N.kG,{vertex:r,fragment:F,varyings:H}=t;return(0,C.Sv)(r,e),t.include(d.f),H.add("vpos","vec3"),t.include(E.k,e),t.include(l.f,e),t.include(m.L,e),e.output!==n.H.Color&&e.output!==n.H.Alpha||((0,C.hY)(t.vertex,e),t.include(c.O,e),t.include(s.w,e),e.offsetBackfaces&&t.include(o.w),e.instancedColor&&t.attributes.add(D.T.INSTANCECOLOR,"vec4"),H.add("vNormalWorld","vec3"),H.add("localvpos","vec3"),e.hasMultipassTerrain&&H.add("depth","float"),t.include(h.D,e),t.include(i.qj,e),t.include(u.R,e),t.include(f.c,e),r.uniforms.add(new M.N("externalColor",(e=>e.externalColor))),H.add("vcolorExt","vec4"),r.code.add(P.H`
void main(void) {
forwardNormalizedVertexColor();
vcolorExt = externalColor;
${e.instancedColor?"vcolorExt *= instanceColor;":""}
vcolorExt *= vvColor();
vcolorExt *= getSymbolColor();
forwardColorMixMode();
if (vcolorExt.a < ${P.H.float(w.b)}) {
gl_Position = vec4(1e38, 1e38, 1e38, 1.0);
} else {
vpos = calculateVPos();
localvpos = vpos - view[3].xyz;
vpos = subtractOrigin(vpos);
vNormalWorld = dpNormal(vvLocalNormal(normalModel()));
vpos = addVerticalOffset(vpos, localOrigin);
gl_Position = transformPosition(proj, view, vpos);
${e.offsetBackfaces?"gl_Position = offsetBackfacingClipPosition(gl_Position, vpos, vNormalWorld, cameraPosition);":""}
}
${e.hasMultipassTerrain?P.H`depth = (view * vec4(vpos, 1.0)).z;`:""}
forwardLinearDepth();
forwardTextureCoordinates();
}
`)),e.output===n.H.Alpha&&(t.include(a.f5,e),t.include(S.z,e),t.include(x.l,e),F.uniforms.add([new O.p("opacity",(e=>e.opacity)),new O.p("layerOpacity",(e=>e.layerOpacity))]),e.hasColorTexture&&F.uniforms.add(new I.A("tex",(e=>e.texture))),F.include(y.y),F.code.add(P.H`
void main() {
discardBySlice(vpos);
${e.hasMultipassTerrain?P.H`terrainDepthTest(gl_FragCoord, depth);`:""}
${e.hasColorTexture?P.H`
vec4 texColor = texture2D(tex, ${e.hasColorTextureTransform?P.H`colorUV`:P.H`vuv0`});
${e.textureAlphaPremultiplied?"texColor.rgb /= texColor.a;":""}
discardOrAdjustAlpha(texColor);`:P.H`vec4 texColor = vec4(1.0);`}
${e.hasVertexColors?P.H`float opacity_ = layerOpacity * mixExternalOpacity(vColor.a * opacity, texColor.a, vcolorExt.a, int(colorMixMode));`:P.H`float opacity_ = layerOpacity * mixExternalOpacity(opacity, texColor.a, vcolorExt.a, int(colorMixMode));`}
gl_FragColor = vec4(opacity_);
}
`)),e.output===n.H.Color&&(t.include(a.f5,e),t.include(v.XP,e),t.include(g.K,e),t.include(S.z,e),t.include(e.instancedDoublePrecision?A.hb:A.XE,e),t.include(x.l,e),(0,C.hY)(t.fragment,e),(0,_.Pe)(F),(0,v.PN)(F),(0,v.sC)(F),F.uniforms.add([r.uniforms.get("localOrigin"),r.uniforms.get("view"),new R.J("ambient",(e=>e.ambient)),new R.J("diffuse",(e=>e.diffuse)),new O.p("opacity",(e=>e.opacity)),new O.p("layerOpacity",(e=>e.layerOpacity))]),e.hasColorTexture&&F.uniforms.add(new I.A("tex",(e=>e.texture))),t.include(b.jV,e),t.include(T.T,e),F.include(y.y),t.extensions.add("GL_OES_standard_derivatives"),(0,_.F1)(F),F.code.add(P.H`
void main() {
discardBySlice(vpos);
${e.hasMultipassTerrain?P.H`terrainDepthTest(gl_FragCoord, depth);`:""}
${e.hasColorTexture?P.H`
vec4 texColor = texture2D(tex, ${e.hasColorTextureTransform?P.H`colorUV`:P.H`vuv0`});
${e.textureAlphaPremultiplied?"texColor.rgb /= texColor.a;":""}
discardOrAdjustAlpha(texColor);`:P.H`vec4 texColor = vec4(1.0);`}
vec3 viewDirection = normalize(vpos - cameraPosition);
${e.pbrMode===b.f7.Normal?"applyPBRFactors();":""}
float ssao = evaluateAmbientOcclusionInverse();
ssao *= getBakedOcclusion();
float additionalAmbientScale = additionalDirectedAmbientLight(vpos + localOrigin);
vec3 additionalLight = ssao * mainLightIntensity * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor;
${e.receiveShadows?"float shadow = readShadowMap(vpos, linearDepth);":e.spherical?"float shadow = lightingGlobalFactor * (1.0 - additionalAmbientScale);":"float shadow = 0.0;"}
vec3 matColor = max(ambient, diffuse);
${e.hasVertexColors?P.H`
vec3 albedo = mixExternalColor(vColor.rgb * matColor, texColor.rgb, vcolorExt.rgb, int(colorMixMode));
float opacity_ = layerOpacity * mixExternalOpacity(vColor.a * opacity, texColor.a, vcolorExt.a, int(colorMixMode));`:P.H`
vec3 albedo = mixExternalColor(matColor, texColor.rgb, vcolorExt.rgb, int(colorMixMode));
float opacity_ = layerOpacity * mixExternalOpacity(opacity, texColor.a, vcolorExt.a, int(colorMixMode));`}
${e.snowCover?P.H`albedo = mix(albedo, vec3(1), 0.9);`:P.H``}
${P.H`
vec3 shadingNormal = normalize(vNormalWorld);
albedo *= 1.2;
vec3 viewForward = vec3(view[0][2], view[1][2], view[2][2]);
float alignmentLightView = clamp(dot(viewForward, -mainLightDirection), 0.0, 1.0);
float transmittance = 1.0 - clamp(dot(viewForward, shadingNormal), 0.0, 1.0);
float treeRadialFalloff = vColor.r;
float backLightFactor = 0.5 * treeRadialFalloff * alignmentLightView * transmittance * (1.0 - shadow);
additionalLight += backLightFactor * mainLightIntensity;`}
${e.pbrMode===b.f7.Normal||e.pbrMode===b.f7.Schematic?e.spherical?P.H`vec3 normalGround = normalize(vpos + localOrigin);`:P.H`vec3 normalGround = vec3(0.0, 0.0, 1.0);`:P.H``}
${e.pbrMode===b.f7.Normal||e.pbrMode===b.f7.Schematic?P.H`
float additionalAmbientIrradiance = additionalAmbientIrradianceFactor * mainLightIntensity[2];
${e.snowCover?P.H`
mrr = vec3(0.0, 1.0, 0.04);
emission = vec3(0.0);`:""}
vec3 shadedColor = evaluateSceneLightingPBR(shadingNormal, albedo, shadow, 1.0 - ssao, additionalLight, viewDirection, normalGround, mrr, emission, additionalAmbientIrradiance);`:P.H`vec3 shadedColor = evaluateSceneLighting(shadingNormal, albedo, shadow, 1.0 - ssao, additionalLight);`}
gl_FragColor = highlightSlice(vec4(shadedColor, opacity_), vpos);
${e.transparencyPassType===L.A.Color?P.H`gl_FragColor = premultiplyAlpha(gl_FragColor);`:P.H``}
}
`)),t.include(p.s,e),t}const H=Object.freeze(Object.defineProperty({__proto__:null,build:F},Symbol.toStringTag,{value:"Module"}))},25377:(e,t,r)=>{r.d(t,{S:()=>v,b:()=>m,g:()=>p});var i=r(70586),o=r(4307),n=r(97323),a=r(51666),s=r(5543),l=r(20787),c=r(19693),d=r(21437),u=r(74709),h=r(33680),f=r(98069);function m(){const e=new h.kG,t=e.fragment;return e.include(a.k),t.include(s.S),e.include(l.G),t.uniforms.add(new d.p("radius",((e,t)=>p(t.camera)))),t.code.add(u.H`vec3 sphere[16];
void fillSphere() {
sphere[0] = vec3(0.186937, 0.0, 0.0);
sphere[1] = vec3(0.700542, 0.0, 0.0);
sphere[2] = vec3(-0.864858, -0.481795, -0.111713);
sphere[3] = vec3(-0.624773, 0.102853, -0.730153);
sphere[4] = vec3(-0.387172, 0.260319, 0.007229);
sphere[5] = vec3(-0.222367, -0.642631, -0.707697);
sphere[6] = vec3(-0.01336, -0.014956, 0.169662);
sphere[7] = vec3(0.122575, 0.1544, -0.456944);
sphere[8] = vec3(-0.177141, 0.85997, -0.42346);
sphere[9] = vec3(-0.131631, 0.814545, 0.524355);
sphere[10] = vec3(-0.779469, 0.007991, 0.624833);
sphere[11] = vec3(0.308092, 0.209288,0.35969);
sphere[12] = vec3(0.359331, -0.184533, -0.377458);
sphere[13] = vec3(0.192633, -0.482999, -0.065284);
sphere[14] = vec3(0.233538, 0.293706, -0.055139);
sphere[15] = vec3(0.417709, -0.386701, 0.442449);
}
float fallOffFunction(float vv, float vn, float bias) {
float f = max(radius * radius - vv, 0.0);
return f * f * f * max(vn-bias, 0.0);
}`),t.code.add(u.H`float aoValueFromPositionsAndNormal(vec3 C, vec3 n_C, vec3 Q) {
vec3 v = Q - C;
float vv = dot(v, v);
float vn = dot(normalize(v), n_C);
return fallOffFunction(vv, vn, 0.1);
}`),t.uniforms.add([new c.A("nearFar",((e,t)=>t.camera.nearFar)),new f.A("normalMap",(e=>e.normalTexture)),new f.A("depthMap",(e=>e.depthTexture)),new c.A("zScale",((e,t)=>(0,l.R)(t))),new d.p("projScale",(e=>e.projScale)),new f.A("rnm",(e=>e.noiseTexture)),new c.A("rnmScale",((e,t)=>(0,o.s)(g,t.camera.fullWidth/(0,i.Wg)(e.noiseTexture).descriptor.width,t.camera.fullHeight/(0,i.Wg)(e.noiseTexture).descriptor.height))),new d.p("intensity",(e=>e.intensity)),new c.A("screenSize",((e,t)=>(0,o.s)(g,t.camera.fullWidth,t.camera.fullHeight)))]),t.code.add(u.H`
void main(void) {
fillSphere();
vec3 fres = normalize((texture2D(rnm, uv * rnmScale).xyz * 2.0) - vec3(1.0));
float currentPixelDepth = linearDepthFromTexture(depthMap, uv, nearFar);
if (-currentPixelDepth>nearFar.y || -currentPixelDepth<nearFar.x) {
gl_FragColor = vec4(0.0);
return;
}
vec3 currentPixelPos = reconstructPosition(gl_FragCoord.xy,currentPixelDepth);
// get the normal of current fragment
vec4 norm4 = texture2D(normalMap, uv);
vec3 norm = vec3(-1.0) + 2.0 * norm4.xyz;
bool isTerrain = norm4.w<0.5;
float sum = .0;
vec3 tapPixelPos;
// note: the factor 2.0 should not be necessary, but makes ssao much nicer.
// bug or deviation from CE somewhere else?
float ps = projScale / (2.0 * currentPixelPos.z * zScale.x + zScale.y);
for(int i = 0; i < ${u.H.int(16)}; ++i) {
vec2 unitOffset = reflect(sphere[i], fres).xy;
vec2 offset = vec2(-unitOffset * radius * ps);
//don't use current or very nearby samples
if ( abs(offset.x)<2.0 || abs(offset.y)<2.0) continue;
vec2 tc = vec2(gl_FragCoord.xy + offset);
if (tc.x < 0.0 || tc.y < 0.0 || tc.x > screenSize.x || tc.y > screenSize.y) continue;
vec2 tcTap = tc / screenSize;
float occluderFragmentDepth = linearDepthFromTexture(depthMap, tcTap, nearFar);
if (isTerrain) {
bool isTerrainTap = texture2D(normalMap, tcTap).w<0.5;
if (isTerrainTap) {
continue;
}
}
tapPixelPos = reconstructPosition(tc, occluderFragmentDepth);
sum+= aoValueFromPositionsAndNormal(currentPixelPos, norm, tapPixelPos);
}
// output the result
float A = max(1.0 - sum * intensity / float(${u.H.int(16)}),0.0);
// Anti-tone map to reduce contrast and drag dark region farther: (x^0.2 + 1.2 * x^4)/2.2
A = (pow(A, 0.2) + 1.2 * A*A*A*A) / 2.2;
gl_FragColor = vec4(A);
}
`),e}function p(e){return Math.max(10,20*e.computeRenderPixelSizeAtDist(Math.abs(4*e.relativeElevation)))}const g=(0,n.a)(),v=Object.freeze(Object.defineProperty({__proto__:null,build:m,getRadius:p},Symbol.toStringTag,{value:"Module"}))},59915:(e,t,r)=>{r.d(t,{S:()=>m,b:()=>f});var i=r(17896),o=r(51666),n=r(5543),a=r(98925),s=r(19693),l=r(21437),c=r(74709),d=r(33680),u=r(16374),h=r(98069);function f(){const e=new d.kG,t=e.fragment;return e.include(o.k),t.include(n.S),t.uniforms.add([new h.A("depthMap",(e=>e.depthTexture)),new u.R("tex",(e=>e.colorTexture)),new a.q("blurSize",(e=>e.blurSize)),new l.p("projScale",((e,t)=>{const r=(0,i.i)(t.camera.eye,t.camera.center);return r>5e4?Math.max(0,e.projScale-(r-5e4)):e.projScale})),new s.A("nearFar",((e,t)=>t.camera.nearFar))]),t.code.add(c.H`
void blurFunction(vec2 uv, float r, float center_d, float sharpness, inout float wTotal, inout float bTotal) {
float c = texture2D(tex, uv).r;
float d = linearDepthFromTexture(depthMap, uv, nearFar);
float ddiff = d - center_d;
float w = exp(-r * r * ${c.H.float(.08)} - ddiff * ddiff * sharpness);
wTotal += w;
bTotal += w * c;
}
`),t.code.add(c.H`
void main(void) {
float b = 0.0;
float w_total = 0.0;
float center_d = linearDepthFromTexture(depthMap, uv, nearFar);
float sharpness = -0.05 * projScale / center_d;
for (int r = -${c.H.int(4)}; r <= ${c.H.int(4)}; ++r) {
float rf = float(r);
vec2 uvOffset = uv + rf * blurSize;
blurFunction(uvOffset, rf, center_d, sharpness, w_total, b);
}
gl_FragColor = vec4(b / w_total);
}
`),e}const m=Object.freeze(Object.defineProperty({__proto__:null,build:f},Symbol.toStringTag,{value:"Module"}))},14682:(e,t,r)=>{function i(){const e=new Float32Array(9);return e[0]=1,e[4]=1,e[8]=1,e}function o(e,t,r,i,o,n,a,s,l){const c=new Float32Array(9);return c[0]=e,c[1]=t,c[2]=r,c[3]=i,c[4]=o,c[5]=n,c[6]=a,c[7]=s,c[8]=l,c}r.d(t,{c:()=>i,f:()=>o}),Object.freeze(Object.defineProperty({__proto__:null,clone:function(e){const t=new Float32Array(9);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},create:i,createView:function(e,t){return new Float32Array(e,t,9)},fromValues:o},Symbol.toStringTag,{value:"Module"}))},1265:(e,t,r)=>{function i(){return new Float32Array(2)}function o(e,t){const r=new Float32Array(2);return r[0]=e,r[1]=t,r}function n(){return i()}function a(){return o(1,1)}function s(){return o(1,0)}function l(){return o(0,1)}r.d(t,{O:()=>d,Z:()=>c,c:()=>i,f:()=>o});const c=n(),d=a(),u=s(),h=l();Object.freeze(Object.defineProperty({__proto__:null,ONES:d,UNIT_X:u,UNIT_Y:h,ZEROS:c,clone:function(e){const t=new Float32Array(2);return t[0]=e[0],t[1]=e[1],t},create:i,createView:function(e,t){return new Float32Array(e,t,2)},fromValues:o,ones:a,unitX:s,unitY:l,zeros:n},Symbol.toStringTag,{value:"Module"}))},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.c.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,_=e.typedBufferStride,x=t.typedBuffer,T=t.typedBufferStride;for(let e=0;e<o;e++){const t=e*_,r=e*T,i=x[r],o=x[r+1],b=x[r+2];v[t]=n*i+l*o+u*b+m,v[t+1]=a*i+c*o+h*b+p,v[t+2]=s*i+d*o+f*b+g}}function n(e,t,r){if(e.count!==t.count)return void i.c.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],_=g[r+2];m[t]=n*i+l*o+u*_,m[t+1]=a*i+c*o+h*_,m[t+2]=s*i+d*o+f*_}}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=s*s+l*l+c*c;if(d>0){const e=1/Math.sqrt(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(Object.defineProperty({__proto__:null,normalize:s,scale:a,shiftRight:l,transformMat3:n,transformMat4:o},Symbol.toStringTag,{value:"Module"}))},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){const n=e.typedBuffer,a=e.typedBufferStride,s=o?.count??e.count;let l=(o?.dstIndex??0)*a;for(let e=0;e<s;++e)n[l]=t,n[l+1]=r,n[l+2]=i,l+=a}r.d(t,{c:()=>i,f:()=>o}),Object.freeze(Object.defineProperty({__proto__:null,copy:i,fill:o},Symbol.toStringTag,{value:"Module"}))},88669:(e,t,r)=>{function i(){return[0,0,0,0]}function o(e,t,r,i){return[e,t,r,i]}function n(e,t){return new Float64Array(e,t,4)}function a(){return o(1,1,1,1)}function s(){return o(1,0,0,0)}function l(){return o(0,1,0,0)}function c(){return o(0,0,1,0)}function d(){return o(0,0,0,1)}r.d(t,{a:()=>n,c:()=>i,f:()=>o});const u=a(),h=s(),f=l(),m=c(),p=d();Object.freeze(Object.defineProperty({__proto__:null,ONES:u,UNIT_W:p,UNIT_X:h,UNIT_Y:f,UNIT_Z:m,ZEROS:[0,0,0,0],clone:function(e){return[e[0],e[1],e[2],e[3]]},create:i,createView:n,fromArray:function(e){const t=[0,0,0,0],r=Math.min(4,e.length);for(let i=0;i<r;++i)t[i]=e[i];return t},fromValues:o,ones:a,unitW:d,unitX:s,unitY:l,unitZ:c,zeros:function(){return[0,0,0,0]}},Symbol.toStringTag,{value:"Module"}))},32243:(e,t,r)=>{function i(e){return e=e||globalThis.location.hostname,c.some((t=>null!=e?.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,{XO:()=>i,pJ:()=>o});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,{c:()=>i});const i=r(92604).Z.getLogger("esri.views.3d.support.buffer.math")},16996:(e,t,r)=>{r.d(t,{Ue:()=>l,nF:()=>d,zk:()=>c});var i=r(22021),o=r(22807),n=r(17896),a=r(65617),s=r(12981);function l(e){return e?{origin:(0,a.a)(e.origin),vector:(0,a.a)(e.vector)}:{origin:(0,a.c)(),vector:(0,a.c)()}}function c(e,t,r=l()){return(0,n.c)(r.origin,e),(0,n.b)(r.vector,t,e),r}function d(e,t,r){return function(e,t,r,o,a){const{vector:l,origin:c}=e,d=(0,n.b)(s.WM.get(),t,c),u=(0,n.e)(l,d)/(0,n.p)(l);return(0,n.g)(a,l,(0,i.uZ)(u,0,1)),(0,n.a)(a,a,e.origin)}(e,t,0,0,r)}(0,a.c)(),(0,a.c)(),new o.x((()=>l()))},69746:(e,t,r)=>{r.r(t),r.d(t,{fetch:()=>hr,gltfToEngineResources:()=>mr,parseUrl:()=>fr});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(91695),_=r(91911),x=r(15317),T=r(14682),b=r(1265);function A(e){if((0,o.Wi)(e))return null;const t=(0,o.pC)(e.offset)?e.offset:b.Z,r=(0,o.pC)(e.rotation)?e.rotation:0,i=(0,o.pC)(e.scale)?e.scale:b.O,a=(0,T.f)(1,0,0,0,1,0,t[0],t[1],1),s=(0,T.f)(Math.cos(r),-Math.sin(r),0,Math.sin(r),Math.cos(r),0,0,0,1),l=(0,T.f)(i[0],0,0,0,i[1],0,0,0,1),c=(0,T.c)();return(0,n.m)(c,s,l),(0,n.m)(c,a,c),c}class E{constructor(){this.geometries=new Array,this.materials=new Array,this.textures=new Array}}class w{constructor(e,t,r){this.name=e,this.lodThreshold=t,this.pivotOffset=r,this.stageResources=new E,this.numberOfVertices=0}}var S=r(3172),y=r(66643),C=r(43090),R=r(20102),M=r(92604);class O{constructor(){this._outer=new Map}clear(){this._outer.clear()}get empty(){return 0===this._outer.size}get(e,t){return this._outer.get(e)?.get(t)}set(e,t,r){const i=this._outer.get(e);i?i.set(t,r):this._outer.set(e,new Map([[t,r]]))}delete(e,t){const r=this._outer.get(e);r&&(r.delete(t),0===r.size&&this._outer.delete(e))}forEach(e){this._outer.forEach(((t,r)=>e(t,r)))}}var P=r(95330),N=r(23670);async function I(e,t){const{data:r}=await(0,S.default)(e,{responseType:"image",...t});return r}var L=r(51417),D=r(47026),F=r(1533);function H(e){if(e.length<F.DB)return Array.from(e);if(Array.isArray(e))return Float64Array.from(e);switch(e.BYTES_PER_ELEMENT){case 1:return Uint8Array.from(e);case 2:return Uint16Array.from(e);case 4:return Float32Array.from(e);default:return Float64Array.from(e)}}var B=r(44553),U=r(11726);class z{constructor(e,t,r,i){this.primitiveIndices=e,this._numIndexPerPrimitive=t,this.indices=r,this.position=i,this._children=void 0,(0,U.hu)(e.length>=1),(0,U.hu)(r.length%this._numIndexPerPrimitive==0),(0,U.hu)(r.length>=e.length*this._numIndexPerPrimitive),(0,U.hu)(3===i.size||4===i.size);const{data:o,size:n}=i,a=e.length;let s=n*r[this._numIndexPerPrimitive*e[0]];V.clear(),V.push(s);const l=(0,d.f)(o[s],o[s+1],o[s+2]),u=(0,d.a)(l);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],V.push(s);let t=o[s];l[0]=Math.min(t,l[0]),u[0]=Math.max(t,u[0]),t=o[s+1],l[1]=Math.min(t,l[1]),u[1]=Math.max(t,u[1]),t=o[s+2],l[2]=Math.min(t,l[2]),u[2]=Math.max(t,u[2])}}this.bbMin=l,this.bbMax=u;const h=(0,c.h)((0,d.c)(),this.bbMin,this.bbMax,.5);this.radius=.5*Math.max(Math.max(u[0]-l[0],u[1]-l[1]),u[2]-l[2]);let f=this.radius*this.radius;for(let e=0;e<V.length;++e){s=V.getItemAt(e);const t=o[s]-h[0],r=o[s+1]-h[1],i=o[s+2]-h[2],n=t*t+r*r+i*i;if(n<=f)continue;const a=Math.sqrt(n),l=.5*(a-this.radius);this.radius=this.radius+l,f=this.radius*this.radius;const c=l/a;h[0]+=t*c,h[1]+=r*c,h[2]+=i*c}this.center=h,V.clear()}getChildren(){if(this._children||(0,c.d)(this.bbMin,this.bbMax)<=1)return this._children;const e=(0,c.h)((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;for(let e=0;e<8;++e)void 0!==s[e]&&this._children.push(new z(s[e],this._numIndexPerPrimitive,this.indices,this.position));return this._children}static prune(){V.prune()}}const V=new B.Z({deallocator:null});var G=r(17662),W=r(4726),k=r(22807),$=r(16996);function q(e,t,r){return(0,c.b)(j,t,e),(0,c.b)(X,r,e),(0,c.l)((0,c.f)(j,j,X))/2}r(12981),new k.x($.Ue),new k.x((()=>{return e?{p0:(0,d.a)(e.p0),p1:(0,d.a)(e.p1),p2:(0,d.a)(e.p2)}:{p0:(0,d.c)(),p1:(0,d.c)(),p2:(0,d.c)()};var e}));const j=(0,d.c)(),X=(0,d.c)(),J=(0,d.c)(),Y=(0,d.c)(),K=(0,d.c)(),Z=(0,d.c)();var Q=r(54388),ee=r(99001);class te{constructor(e){this.channel=e,this.id=(0,ee.D)()}}var re=r(35065);r(9820),(0,d.c)(),new Float32Array(6);class ie extends G.c{constructor(e,t,r=[],i=null,o=W.U.Mesh,n=null,a=-1){super(),this.material=e,this.mapPositions=i,this.type=o,this.objectAndLayerIdColor=n,this.edgeIndicesLength=a,this.visible=!0,this._vertexAttributes=new Map,this._indices=new Map,this._boundingInfo=null;for(const[e,r]of t)r&&this._vertexAttributes.set(e,{...r});if(null==r||0===r.length){const e=function(e){const t=e.values().next().value;return null==t?0:t.data.length/t.size}(this._vertexAttributes),t=(0,Q.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,t]of r)t&&(this._indices.set(e,(0,Q.mi)(t)),e===re.T.POSITION&&(this.edgeIndicesLength=this.edgeIndicesLength<0?this._indices.get(e).length:this.edgeIndicesLength))}instantiate(e={}){const t=new ie(e.material||this.material,[],void 0,this.mapPositions,this.type,this.objectAndLayerIdColor,this.edgeIndicesLength);return this._vertexAttributes.forEach(((e,r)=>{e.exclusive=!1,t._vertexAttributes.set(r,e)})),this._indices.forEach(((e,r)=>t._indices.set(r,e))),t._boundingInfo=this._boundingInfo,t.transformation=e.transformation||this.transformation,t}get vertexAttributes(){return this._vertexAttributes}getMutableAttribute(e){let t=this._vertexAttributes.get(e);return t&&!t.exclusive&&(t={...t,exclusive:!0,data:H(t.data)},this._vertexAttributes.set(e,t)),t}get indices(){return this._indices}get indexCount(){const e=this._indices.values().next().value;return e?e.length:0}get faceCount(){return this.indexCount/3}get boundingInfo(){return(0,o.Wi)(this._boundingInfo)&&(this._boundingInfo=this._calculateBoundingInfo()),this._boundingInfo}computeAttachmentOrigin(e){return!!(this.type===W.U.Mesh?this._computeAttachmentOriginTriangles(e):this.type===W.U.Line?this._computeAttachmentOriginLines(e):this._computeAttachmentOriginPoints(e))&&((0,o.pC)(this._transformation)&&(0,c.m)(e,e,this._transformation),!0)}_computeAttachmentOriginTriangles(e){const t=this.indices.get(re.T.POSITION);return function(e,t,r){if(!e||!t)return!1;const{size:i,data:o}=e;(0,c.s)(r,0,0,0),(0,c.s)(Z,0,0,0);let n=0,a=0;for(let e=0;e<t.length-2;e+=3){const s=t[e+0]*i,l=t[e+1]*i,d=t[e+2]*i;(0,c.s)(J,o[s+0],o[s+1],o[s+2]),(0,c.s)(Y,o[l+0],o[l+1],o[l+2]),(0,c.s)(K,o[d+0],o[d+1],o[d+2]);const u=q(J,Y,K);u?((0,c.a)(J,J,Y),(0,c.a)(J,J,K),(0,c.g)(J,J,1/3*u),(0,c.a)(r,r,J),n+=u):((0,c.a)(Z,Z,J),(0,c.a)(Z,Z,Y),(0,c.a)(Z,Z,K),a+=3)}return!(0===a&&0===n||(0!==n?((0,c.g)(r,r,1/n),0):0===a||((0,c.g)(r,Z,1/a),0)))}(this.vertexAttributes.get(re.T.POSITION),t,e)}_computeAttachmentOriginLines(e){const t=this.vertexAttributes.get(re.T.POSITION),r=this.indices.get(re.T.POSITION);return function(e,t,r,i){if(!e)return!1;(0,c.s)(i,0,0,0),(0,c.s)(Z,0,0,0);let o=0,n=0;const{size:a,data:s}=e,l=t?t.length-1:s.length/a-1,d=l+(r?2:0);for(let e=0;e<d;e+=2){const r=e<l?e:l,d=e<l?e+1:0,u=(t?t[r]:r)*a,h=(t?t[d]:d)*a;J[0]=s[u],J[1]=s[u+1],J[2]=s[u+2],Y[0]=s[h],Y[1]=s[h+1],Y[2]=s[h+2],(0,c.g)(J,(0,c.a)(J,J,Y),.5);const f=(0,c.j)(J,Y);f>0?((0,c.a)(i,i,(0,c.g)(J,J,f)),o+=f):0===o&&((0,c.a)(Z,Z,J),n++)}return 0!==o?((0,c.g)(i,i,1/o),!0):0!==n&&((0,c.g)(i,Z,1/n),!0)}(t,r,r&&function(e,t,r){return!(!("isClosed"in e)||!e.isClosed)&&(r?r.length>2:t.data.length>6)}(this.material.parameters,t,r),e)}_computeAttachmentOriginPoints(e){const t=this.indices.get(re.T.POSITION);return function(e,t,r){if(!e||!t)return!1;const{size:i,data:o}=e;(0,c.s)(r,0,0,0);let n=-1,a=0;for(let e=0;e<t.length;e++){const s=t[e]*i;n!==s&&(r[0]+=o[s+0],r[1]+=o[s+1],r[2]+=o[s+2],a++),n=s}return a>1&&(0,c.g)(r,r,1/a),a>0}(this.vertexAttributes.get(re.T.POSITION),t,e)}invalidateBoundingInfo(){this._boundingInfo=null}_calculateBoundingInfo(){const e=this.indices.get(re.T.POSITION),t=this.vertexAttributes.get(re.T.POSITION);if(!e||0===e.length||!t)return null;const r=this.type===W.U.Mesh?3:1;(0,U.hu)(e.length%r==0,"Indexing error: "+e.length+" not divisible by "+r);const i=(0,Q.p)(e.length/r);return new z(i,r,e,t)}get transformation(){return(0,o.Pt)(this._transformation,l.I)}set transformation(e){this._transformation=e&&e!==l.I?(0,l.b)(e):null}get shaderTransformation(){return(0,o.pC)(this._shaderTransformer)?this._shaderTransformer(this.transformation):this.transformation}get shaderTransformer(){return this._shaderTransformer}set shaderTransformer(e){this._shaderTransformer=e}get hasVolatileTransformation(){return(0,o.pC)(this._shaderTransformer)}addHighlight(){const e=new te(D.V_.Highlight);return this.highlights=(t=this.highlights,r=e,(0,o.Wi)(t)&&(t=[]),t.push(r),t),e;var t,r}removeHighlight(e){this.highlights=function(e,t){if((0,o.Wi)(e))return null;const r=e.filter((e=>e!==t));return 0===r.length?null:r}(this.highlights,e)}}var oe=r(74085),ne=r(32448),ae=r(22021),se=r(17452),le=r(85958),ce=r(88669),de=r(51666),ue=r(71250),he=r(74709),fe=r(33680),me=r(98069);class pe extends he.K{constructor(){super(...arguments),this.color=(0,ce.f)(1,1,1,1)}}Object.freeze(Object.defineProperty({__proto__:null,TextureOnlyPassParameters:pe,build:function(){const e=new fe.kG;return e.include(de.k),e.fragment.uniforms.add([new me.A("tex",(e=>e.texture)),new ue.N("uColor",(e=>e.color))]),e.fragment.code.add(he.H`void main() {
vec4 texColor = texture2D(tex, uv);
gl_FragColor = texColor * uColor;
}`),e}},Symbol.toStringTag,{value:"Module"}));var ge=r(99880);let ve;var _e;!function(e){e[e.ETC1_RGB=0]="ETC1_RGB",e[e.ETC2_RGBA=1]="ETC2_RGBA",e[e.BC1_RGB=2]="BC1_RGB",e[e.BC3_RGBA=3]="BC3_RGBA",e[e.BC4_R=4]="BC4_R",e[e.BC5_RG=5]="BC5_RG",e[e.BC7_M6_RGB=6]="BC7_M6_RGB",e[e.BC7_M5_RGBA=7]="BC7_M5_RGBA",e[e.PVRTC1_4_RGB=8]="PVRTC1_4_RGB",e[e.PVRTC1_4_RGBA=9]="PVRTC1_4_RGBA",e[e.ASTC_4x4_RGBA=10]="ASTC_4x4_RGBA",e[e.ATC_RGB=11]="ATC_RGB",e[e.ATC_RGBA=12]="ATC_RGBA",e[e.FXT1_RGB=17]="FXT1_RGB",e[e.PVRTC2_4_RGB=18]="PVRTC2_4_RGB",e[e.PVRTC2_4_RGBA=19]="PVRTC2_4_RGBA",e[e.ETC2_EAC_R11=20]="ETC2_EAC_R11",e[e.ETC2_EAC_RG11=21]="ETC2_EAC_RG11",e[e.RGBA32=13]="RGBA32",e[e.RGB565=14]="RGB565",e[e.BGR565=15]="BGR565",e[e.RGBA4444=16]="RGBA4444"}(_e||(_e={}));var xe=r(35371),Te=r(75656),be=r(45762);let Ae=null,Ee=null;async function we(){return(0,o.Wi)(Ee)&&(Ee=function(){if((0,o.Wi)(ve)){const e=e=>(0,ge.V)(`esri/libs/basisu/${e}`);ve=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 ve}(),Ae=await Ee),Ee}function Se(e,t,r,i,o){const n=(0,be.RG)(t?xe.q_.COMPRESSED_RGBA8_ETC2_EAC:xe.q_.COMPRESSED_RGB8_ETC2),a=o&&e>1?(4**e-1)/(3*4**(e-1)):1;return Math.ceil(r*i*n*a)}function ye(e){return e.getNumImages()>=1&&!e.isUASTC()}function Ce(e){return e.getFaces()>=1&&e.isETC1S()}function Re(e,t,r,i,o,n,a,s){const{compressedTextureETC:l,compressedTextureS3TC:c}=e.capabilities,[d,u]=l?i?[_e.ETC2_RGBA,xe.q_.COMPRESSED_RGBA8_ETC2_EAC]:[_e.ETC1_RGB,xe.q_.COMPRESSED_RGB8_ETC2]:c?i?[_e.BC3_RGBA,xe.q_.COMPRESSED_RGBA_S3TC_DXT5_EXT]:[_e.BC1_RGB,xe.q_.COMPRESSED_RGB_S3TC_DXT1_EXT]:[_e.RGBA32,xe.VI.RGBA],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?xe.cw.LINEAR_MIPMAP_LINEAR:xe.cw.LINEAR,g={...t,samplingMode:p,hasMipmap:m,internalFormat:u,width:o,height:n};return new Te.x(e,g,{type:"compressed",levels:f})}const Me=M.Z.getLogger("esri.views.3d.webgl-engine.lib.DDSUtil");function Oe(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}const Pe=Oe("DXT1"),Ne=Oe("DXT3"),Ie=Oe("DXT5");var Le,De,Fe=r(89917),He=r(54738),Be=r(33696);class Ue extends G.c{constructor(e,t){super(),this._data=e,this.type=W.U.Texture,this._glTexture=null,this._powerOfTwoStretchInfo=null,this._loadingPromise=null,this._loadingController=null,this.events=new ne.Z,this._passParameters=new pe,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:xe.e8.REPEAT,t:xe.e8.REPEAT},this.params.powerOfTwoResizeMode=this.params.powerOfTwoResizeMode||D.CE.STRETCH,this.estimatedTexMemRequired=Ue._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){if(!((0,se.jc)(e.src)||"auto"===e.preload&&e.crossOrigin)){e.preload="auto",e.crossOrigin="anonymous";const t=!e.paused;if(e.src=e.src,t&&e.autoplay){const t=()=>{e.removeEventListener("canplay",t),e.play()};e.addEventListener("canplay",t)}}}_startPreloadImageElement(e){(0,se.HK)(e.src)||(0,se.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,F.eP)(e)||(0,F.lq)(e))return t.encoding===D.Ti.KTX2_ENCODING?function(e,t){if((0,o.Wi)(Ae))return e.byteLength;const r=new Ae.KTX2File(new Uint8Array(e)),i=Ce(r)?Se(r.getLevels(),r.getHasAlpha(),r.getWidth(),r.getHeight(),t):0;return r.close(),r.delete(),i}(e,!!t.mipmap):t.encoding===D.Ti.BASIS_ENCODING?function(e,t){if((0,o.Wi)(Ae))return e.byteLength;const r=new Ae.BasisFile(new Uint8Array(e)),i=ye(r)?Se(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?Ue._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){return{target:xe.No.TEXTURE_2D,pixelFormat:xe.VI.RGBA,dataType:xe.Br.UNSIGNED_BYTE,wrapMode:this.params.wrap,flipped:!this.params.noUnpackFlip,samplingMode:this.params.mipmap?xe.cw.LINEAR_MIPMAP_LINEAR:xe.cw.LINEAR,hasMipmap:this.params.mipmap,preMultiplyAlpha:this.params.preMultiplyAlpha,maxAnisotropy:this.params.maxAnisotropy??(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 Te.x(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,F.eP)(r)||(0,F.lq)(r))&&this.params.encoding===D.Ti.DDS_ENCODING?(this._data=void 0,this._loadFromDDSData(e,r)):((0,F.eP)(r)||(0,F.lq)(r))&&this.params.encoding===D.Ti.KTX2_ENCODING?(this._data=void 0,this._loadFromKTX2(e,r)):((0,F.eP)(r)||(0,F.lq)(r))&&this.params.encoding===D.Ti.BASIS_ENCODING?(this._data=void 0,this._loadFromBasis(e,r)):(0,F.lq)(r)?this._loadFromPixelData(e,r):(0,F.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<Le.HAVE_CURRENT_DATA||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{videoWidth:e,videoHeight: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.params.updateCallback&&this.params.updateCallback(),this._data.currentTime}_loadFromDDSData(e,t){return this._glTexture=function(e,t,r){const{textureData:i,internalFormat:n,width:a,height:s}=(0,o.s3)(function(e,t){const r=new Int32Array(e,0,31);if(542327876!==r[0])return Me.error("Invalid magic number in DDS header"),null;if(!(4&r[20]))return Me.error("Unsupported format, must contain a FourCC code"),null;const i=r[21];let o,n;switch(i){case Pe:o=8,n=xe.q_.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case Ne:o=16,n=xe.q_.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case Ie:o=16,n=xe.q_.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:return Me.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)||(Me.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,ae.wt)(s)&&(0,ae.wt)(l)||(Me.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??!1));return t.samplingMode=i.levels.length>1?xe.cw.LINEAR_MIPMAP_LINEAR:xe.cw.LINEAR,t.hasMipmap=i.levels.length>1,t.internalFormat=n,t.width=a,t.height=s,new Te.x(e,t,i)}(e,this._createDescriptor(e),t),this._glTexture}_loadFromKTX2(e,t){return this._loadAsync((()=>async function(e,t,r){(0,o.Wi)(Ae)&&(Ae=await we());const i=new Ae.KTX2File(new Uint8Array(r));if(!Ce(i))return null;i.startTranscoding();const n=Re(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)(Ae)&&(Ae=await we());const i=new Ae.BasisFile(new Uint8Array(r));if(!ye(i))return null;i.startTranscoding();const n=Re(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,U.hu)(this.params.width>0&&this.params.height>0);const r=this._createDescriptor(e);return r.pixelFormat=1===this.params.components?xe.VI.LUMINANCE:3===this.params.components?xe.VI.RGB:xe.VI.RGBA,r.width=this.params.width,r.height=this.params.height,this._glTexture=new Te.x(e,r,t),this._glTexture}_loadFromURL(e,t,r){return this._loadAsync((async i=>{const o=await I(r,{signal:i});return(0,P.k_)(i),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,le.fY)(r,r.src,!1,i);return(0,P.k_)(i),this._loadFromImage(e,o,t)}))}_loadFromVideoElement(e,t,r){return r.readyState>=Le.HAVE_CURRENT_DATA?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>=Le.HAVE_CURRENT_DATA&&(s(),n(this._loadFromImage(e,r,t)))},c=e=>{s(),a(e||new R.Z("Failed to load video"))};r.addEventListener("loadeddata",l),r.addEventListener("error",c);const d=(0,P.fu)(i,(()=>c((0,P.zE)())))}))))}_loadFromImage(e,t,r){const i=Ue._getDataDimensions(t);this.params.width=i.width,this.params.height=i.height;const o=this._createDescriptor(e);return o.pixelFormat=3===this.params.components?xe.VI.RGB:xe.VI.RGBA,!this._requiresPowerOfTwo(e,o)||(0,ae.wt)(i.width)&&(0,ae.wt)(i.height)?(o.width=i.width,o.height=i.height,this._glTexture=new Te.x(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=xe.e8.CLAMP_TO_EDGE,i="number"==typeof t.wrapMode?t.wrapMode===r:t.wrapMode.s===r&&t.wrapMode.t===r;return e.type===He.zO.WEBGL1&&(t.hasMipmap||!i)}_makePowerOfTwoTexture(e,t,r,i,o){const{width:n,height:a}=r,s=(0,ae.Sf)(n),l=(0,ae.Sf)(a);let c;switch(i.width=s,i.height=l,this.params.powerOfTwoResizeMode){case D.CE.PAD:i.textureCoordinateScaleFactor=[n/s,a/l],c=new Te.x(e,i),c.updateData(0,0,0,n,a,t);break;case D.CE.STRETCH:case null:case void 0:c=this._stretchToPowerOfTwo(e,t,i,o());break;default:(0,oe.Bg)(this.params.powerOfTwoResizeMode)}return i.hasMipmap&&c.generateMipmap(),c}_stretchToPowerOfTwo(e,t,r,i){const o=new Te.x(e,r),n=new Be.X(e,{colorTarget:xe.Lm.TEXTURE,depthStencilTarget:xe.OU.NONE},o),a=new Te.x(e,{target:xe.No.TEXTURE_2D,pixelFormat:r.pixelFormat,dataType:xe.Br.UNSIGNED_BYTE,wrapMode:xe.e8.CLAMP_TO_EDGE,samplingMode:xe.cw.LINEAR,flipped:!!r.flipped,maxAnisotropy:8,preMultiplyAlpha:r.preMultiplyAlpha},t),s=(0,Fe.ow)(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){this._passParameters.texture=o,e.bindFramebuffer(r);const a=e.getViewport();e.setViewport(0,0,n.descriptor.width,n.descriptor.height),e.bindTechnique(t,this._passParameters,null),e.bindVAO(i),e.drawArrays(xe.MX.TRIANGLE_STRIP,0,(0,be._V)(i,"geometry")),e.bindFramebuffer(null),e.setViewport(a.x,a.y,a.width,a.height),this._passParameters.texture=null}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")}}(De=Le||(Le={}))[De.HAVE_NOTHING=0]="HAVE_NOTHING",De[De.HAVE_METADATA=1]="HAVE_METADATA",De[De.HAVE_CURRENT_DATA=2]="HAVE_CURRENT_DATA",De[De.HAVE_FUTURE_DATA=3]="HAVE_FUTURE_DATA",De[De.HAVE_ENOUGH_DATA=4]="HAVE_ENOUGH_DATA";var ze=r(80442),Ve=r(64822),Ge=r(65576),We=r(55039),ke=r(19419),$e=r(85504),qe=r(60537),je=r(82791),Xe=r(93144),Je=r(27097);const Ye=(0,Je.wK)(xe.zi.SRC_ALPHA,xe.zi.ONE,xe.zi.ONE_MINUS_SRC_ALPHA,xe.zi.ONE_MINUS_SRC_ALPHA),Ke=(0,Je.if)(xe.zi.ONE,xe.zi.ONE),Ze=(0,Je.if)(xe.zi.ZERO,xe.zi.ONE_MINUS_SRC_ALPHA);function Qe(e){return e===Xe.A.FrontFace?nu