@arcgis/core 4.33.0-next.20250318 → 4.33.0-next.20250319

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 (105) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/0b7331613f91a3258352.js +1 -0
  3. package/assets/esri/core/workers/chunks/2219d970ece5676ca6ee.js +1 -0
  4. package/assets/esri/core/workers/chunks/3fc18638f8799b85001d.js +1 -0
  5. package/assets/esri/core/workers/chunks/630a9afdf0523c27ddb6.js +1 -0
  6. package/assets/esri/core/workers/chunks/657ae4a0461d45044b28.js +1 -0
  7. package/assets/esri/core/workers/chunks/{e26e8feabf863350af20.js → 6a97bdd46715fc12e1b4.js} +65 -72
  8. package/assets/esri/core/workers/chunks/8063e35dacf8f99471d8.js +1 -0
  9. package/assets/esri/core/workers/chunks/8e20ec4e8e2cfc582fe7.js +319 -0
  10. package/assets/esri/core/workers/chunks/c528a2ca3b1b73df5a5d.js +1 -0
  11. package/assets/esri/core/workers/chunks/d787474e78360c925fd9.js +1 -0
  12. package/assets/esri/core/workers/chunks/{7ded83eb64eff069b761.js → d8b903b4147b090576f2.js} +1 -1
  13. package/assets/esri/core/workers/chunks/e4290719c8afc2a4ee8c.js +1 -0
  14. package/assets/esri/core/workers/chunks/e5e1f8ac53c70427a60b.js +1 -0
  15. package/assets/esri/core/workers/chunks/fc9758006a7135c7d9c3.js +1 -0
  16. package/assets/esri/core/workers/chunks/fef46b841e8369b30227.js +1 -0
  17. package/assets/esri/libs/dxtEncoder/dxt_encoder.wasm +0 -0
  18. package/assets/esri/themes/base/widgets/_FeatureFormUtilityNetworkAssociationLayers.scss +20 -0
  19. package/assets/esri/themes/dark/main.css +1 -1
  20. package/assets/esri/themes/light/main.css +1 -1
  21. package/assets/esri/themes/light/view.css +1 -1
  22. package/chunks/HUDMaterial.glsl.js +80 -75
  23. package/chunks/RibbonLine.glsl.js +37 -37
  24. package/chunks/ShadowHighlight.glsl.js +2 -2
  25. package/chunks/Terrain.glsl.js +33 -34
  26. package/copyright.txt +29 -0
  27. package/core/typedArrayUtil.js +1 -1
  28. package/geometry/support/HalfFloatArray.js +5 -0
  29. package/geometry/support/buffer/BufferView.js +1 -1
  30. package/geometry/support/buffer/types.js +1 -1
  31. package/interfaces.d.ts +0 -40
  32. package/layers/support/rasterFunctions/pixelUtils.js +1 -1
  33. package/package.json +2 -1
  34. package/renderers/support/RasterSymbolizer.js +1 -1
  35. package/support/revision.js +1 -1
  36. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  37. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  38. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  39. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  40. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  41. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  42. package/views/3d/layers/graphics/Labeler.js +1 -1
  43. package/views/3d/layers/graphics/pipeline/rendering/LodRenderer.js +1 -1
  44. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  45. package/views/3d/support/buffer/InterleavedLayout.js +1 -1
  46. package/views/3d/support/buffer/glUtil.js +1 -1
  47. package/views/3d/terrain/PatchGeometry.js +1 -1
  48. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  49. package/views/3d/terrain/TerrainAttributes.js +1 -1
  50. package/views/3d/terrain/TerrainSurface.js +1 -1
  51. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  52. package/views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js +1 -1
  53. package/views/3d/webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js +2 -9
  54. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +1 -1
  55. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +6 -6
  56. package/views/3d/webgl-engine/lib/AttributeArray.js +1 -1
  57. package/views/3d/webgl-engine/lib/DefaultVertexAttributeLocations.js +1 -1
  58. package/views/3d/webgl-engine/lib/DefaultVertexBufferLayouts.js +1 -1
  59. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  60. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  61. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  62. package/views/3d/webgl-engine/lib/VertexAttribute.js +1 -1
  63. package/views/3d/webgl-engine/lib/glUtil3D.js +1 -1
  64. package/views/3d/webgl-engine/lib/lodRendering/InstanceData.js +1 -1
  65. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  66. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  67. package/views/3d/webgl-engine/materials/DefaultLayouts.js +1 -1
  68. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  69. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  70. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  71. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  72. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  73. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  74. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  75. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  76. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  77. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  78. package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
  79. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  80. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  81. package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
  82. package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
  83. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  84. package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
  85. package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
  86. package/widgets/Editor/AddAssociationWorkflow.js +1 -1
  87. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  88. package/widgets/Editor/UpdateWorkflow.js +1 -1
  89. package/widgets/Editor.js +1 -1
  90. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  91. package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +1 -1
  92. package/widgets/support/LabeledSwitch.js +1 -1
  93. package/widgets/support/Selector2D/selectorUtils.js +1 -1
  94. package/assets/esri/core/workers/chunks/048121d433aa9175348c.js +0 -1
  95. package/assets/esri/core/workers/chunks/0f4a2bdf5bb2f4303b7f.js +0 -1
  96. package/assets/esri/core/workers/chunks/147e412de9972da16a1d.js +0 -1
  97. package/assets/esri/core/workers/chunks/1545bd7d6ac7800c71b6.js +0 -1
  98. package/assets/esri/core/workers/chunks/2b21152c7e2d9c170ed7.js +0 -1
  99. package/assets/esri/core/workers/chunks/385dd6466fd967ce3ae9.js +0 -1
  100. package/assets/esri/core/workers/chunks/8d636075e5aa053940fc.js +0 -1
  101. package/assets/esri/core/workers/chunks/c43c273725b1a33712ec.js +0 -314
  102. package/assets/esri/core/workers/chunks/c8cd9a3175f516624842.js +0 -1
  103. package/assets/esri/core/workers/chunks/d630e64463687090db92.js +0 -1
  104. package/assets/esri/core/workers/chunks/dd6f18bbab50be139d20.js +0 -1
  105. package/assets/esri/core/workers/chunks/de6864e120243cf0bee8.js +0 -1
@@ -2,54 +2,53 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{translate as e}from"../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../core/libs/gl-matrix-2/factories/mat4f64.js";import{n as o,i as a}from"./vec32.js";import{create as i}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{OverlayContent as l}from"../views/3d/terrain/OverlayContent.js";import{TransparencyMode as t}from"../views/3d/terrain/TransparencyMode.js";import{addLinearDepth as n,addNearFar as s,ForwardLinearDepth as c}from"../views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js";import{ShaderOutput as d}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SliceDraw as m}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{Transform as v}from"../views/3d/webgl-engine/core/shaderLibrary/Transform.glsl.js";import{NormalAttribute as g}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{TextureCoordinateAttribute as p}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{VertexTangent as f}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/VertexTangent.glsl.js";import{OutputDepth as w}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputDepth.glsl.js";import{OutputHighlight as u}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js";import{EvaluateAmbientOcclusion as b}from"../views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js";import{EvaluateSceneLighting as h,addAmbientBoostFactor as C,addLightingGlobalFactor as y}from"../views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import{addMainLightDirection as x,addMainLightIntensity as O}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js";import{NormalUtils as j}from"../views/3d/webgl-engine/core/shaderLibrary/shading/NormalUtils.glsl.js";import{PBRMode as S}from"../views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{ReadShadowMapDraw as L}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{OverlayMode as T,OverlayTerrain as z}from"../views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{OverlayTerrainPassParameters as P,TerrainTexture as M}from"../views/3d/webgl-engine/core/shaderLibrary/terrain/TerrainTexture.glsl.js";import{addProjViewLocalOrigin as $,addViewNormal as N,addCameraPosition as D}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float3BindUniform as W}from"../views/3d/webgl-engine/core/shaderModules/Float3BindUniform.js";import{glsl as V,If as A}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Matrix4DrawUniform as F}from"../views/3d/webgl-engine/core/shaderModules/Matrix4DrawUniform.js";import{Texture2DBindUniform as U}from"../views/3d/webgl-engine/core/shaderModules/Texture2DBindUniform.js";import{VertexAttribute as _}from"../views/3d/webgl-engine/lib/VertexAttribute.js";import{ShaderBuilder as B}from"../views/webgl/ShaderBuilder.js";import{alphaCutoff as I}from"../webscene/support/AlphaCutoff.js";class k extends P{}function H(r){const i=new B,{attributes:P,vertex:k,fragment:H,varyings:G}=i,{output:R,pbrMode:J,overlayMode:K,tileBorders:Q,spherical:X,transparencyMode:Y,screenSizePerspective:Z}=r;i.include(g,r),i.include(p,r);const ee=()=>{i.include(j,r),k.code.add(V`vec3 getNormal() {
5
+ import{translate as e}from"../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../core/libs/gl-matrix-2/factories/mat4f64.js";import{n as o,i as a}from"./vec32.js";import{create as i}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{OverlayContent as l}from"../views/3d/terrain/OverlayContent.js";import{TransparencyMode as t}from"../views/3d/terrain/TransparencyMode.js";import{addLinearDepth as n,addNearFar as s,ForwardLinearDepth as c}from"../views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js";import{ShaderOutput as d}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SliceDraw as m}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{Transform as v}from"../views/3d/webgl-engine/core/shaderLibrary/Transform.glsl.js";import{NormalAttribute as g}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{TextureCoordinateAttribute as p}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{VertexTangent as f}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/VertexTangent.glsl.js";import{OutputDepth as w}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputDepth.glsl.js";import{OutputHighlight as u}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js";import{EvaluateAmbientOcclusion as b}from"../views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js";import{EvaluateSceneLighting as h,addAmbientBoostFactor as C,addLightingGlobalFactor as y}from"../views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import{addMainLightDirection as x,addMainLightIntensity as O}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js";import{NormalUtils as j}from"../views/3d/webgl-engine/core/shaderLibrary/shading/NormalUtils.glsl.js";import{PBRMode as S}from"../views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{ReadShadowMapDraw as L}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{OverlayMode as T,OverlayTerrain as z}from"../views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{OverlayTerrainPassParameters as P,TerrainTexture as M}from"../views/3d/webgl-engine/core/shaderLibrary/terrain/TerrainTexture.glsl.js";import{addProjViewLocalOrigin as $,addViewNormal as N,addCameraPosition as D}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float3BindUniform as W}from"../views/3d/webgl-engine/core/shaderModules/Float3BindUniform.js";import{glsl as A,If as F}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Matrix4DrawUniform as V}from"../views/3d/webgl-engine/core/shaderModules/Matrix4DrawUniform.js";import{Texture2DPassUniform as _}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{VertexAttribute as U}from"../views/3d/webgl-engine/lib/VertexAttribute.js";import{ShaderBuilder as B}from"../views/webgl/ShaderBuilder.js";import{alphaCutoff as I}from"../webscene/support/AlphaCutoff.js";class k extends P{}function H(r){const i=new B,{attributes:P,vertex:k,fragment:H,varyings:G}=i;P.add(U.POSITION,"vec3"),i.include(g,r),i.include(p,r);const R=()=>{i.include(j,r),k.code.add(A`vec3 getNormal() {
6
6
  float z = 1.0 - abs(normalCompressed.x) - abs(normalCompressed.y);
7
7
  vec3 n = vec3(normalCompressed + vec2(normalCompressed.x >= 0.0 ? 1.0 : -1.0,
8
8
  normalCompressed.y >= 0.0 ? 1.0 : -1.0) * min(z, 0.0), z);
9
9
  return normalize(n);
10
- }`)};$(k,r),P.add(_.POSITION,"vec3"),i.include(v,r);const re=Y===t.InvisibleWithDraped||Y===t.Invisible,oe=K!==T.Disabled,ae=oe&&re;switch(R){case d.ColorEmission:case d.Color:{i.include(M,r),i.include(h,r),oe&&(r.pbrMode=J===S.Simplified?S.TerrainWithWater:S.Water,i.include(z,r),r.pbrMode=J);const t=K===T.EnabledWithWater;t&&i.include(f,r),G.add("vnormal","vec3"),G.add("vpos","vec3",{invariant:!0}),G.add("vup","vec3"),ee(),Z&&N(k);const n=r.receiveShadows&&!r.renderOccluded;n&&i.include(c,r),Z&&(G.add("screenSizeDistanceToCamera","float"),G.add("screenSizeCosAngle","float")),k.main.add(V`
10
+ }`)};$(k,r),i.include(v,r);const{output:J,pbrMode:K,overlayMode:Q,tileBorders:X,spherical:Y,transparencyMode:Z,screenSizePerspective:ee}=r,re=Z===t.InvisibleWithDraped||Z===t.Invisible,oe=Q!==T.Disabled,ae=oe&&re;switch(J){case d.ColorEmission:case d.Color:{i.include(M,r),i.include(h,r),oe&&(r.pbrMode=K===S.Simplified?S.TerrainWithWater:S.Water,i.include(z,r),r.pbrMode=K);const t=Q===T.EnabledWithWater;t&&i.include(f,r),G.add("vnormal","vec3"),G.add("vpos","vec3",{invariant:!0}),G.add("vup","vec3"),R(),ee&&N(k);const n=r.receiveShadows&&!r.renderOccluded;n&&i.include(c,r),ee&&(G.add("screenSizeDistanceToCamera","float"),G.add("screenSizeCosAngle","float")),k.main.add(A`
11
11
  vpos = position;
12
12
  vec3 positionWorld = position + localOrigin;
13
13
  gl_Position = transformPosition(proj, view, vpos);
14
14
  vnormal = getNormal();
15
15
  vup = getLocalUp(position, localOrigin);
16
- ${A(t,V`forwardVertexTangent(vnormal);`)}
16
+ ${F(t,A`forwardVertexTangent(vnormal);`)}
17
17
 
18
- vec2 uv = getUV0();
19
- forwardTextureCoordinatesWithTransform(uv);
20
- ${A(oe,"setOverlayVTC(uv);")}
21
- ${A(Q,"forwardTextureCoordinates();")}
22
- ${A(Z,V`vec3 viewPos = (view * vec4(vpos, 1.0)).xyz;
18
+ forwardTextureCoordinatesWithTransform(uv0);
19
+ ${F(oe,"setOverlayVTC(uv0);")}
20
+ ${F(X,"forwardTextureCoordinates();")}
21
+ ${F(ee,A`vec3 viewPos = (view * vec4(vpos, 1.0)).xyz;
23
22
  screenSizeDistanceToCamera = length(viewPos);
24
23
  vec3 viewSpaceNormal = (viewNormal * vec4(normalize(positionWorld), 1.0)).xyz;
25
24
  screenSizeCosAngle = abs(viewSpaceNormal.z);`)}
26
- ${A(n,"forwardLinearDepth();")}`),i.fragment.include(m,r),i.include(h,r),i.include(b,r),i.include(L,r),D(H,r),C(H),y(H),H.uniforms.add(k.uniforms.get("localOrigin"),new W("viewDirection",(({camera:e})=>o(q,a(q,e.viewMatrix[12],e.viewMatrix[13],e.viewMatrix[14]))))),t&&H.uniforms.add(new U("ovWaterTex",(e=>e.overlay?.getTexture(l.WaterNormal))),new F("view",(({origin:r},{camera:o})=>e(E,o.viewMatrix,r))));const s=.2;H.code.add(V`float lum(vec3 c) {
25
+ ${F(n,"forwardLinearDepth();")}`),i.fragment.include(m,r),i.include(h,r),i.include(b,r),i.include(L,r),D(H,r),C(H),y(H),H.uniforms.add(k.uniforms.get("localOrigin"),new W("viewDirection",(({camera:e})=>o(q,a(q,e.viewMatrix[12],e.viewMatrix[13],e.viewMatrix[14]))))),t&&H.uniforms.add(new _("ovWaterTex",((e,r)=>r.overlay?.getTexture(l.WaterNormal))),new V("view",(({origin:r},{camera:o})=>e(E,o.viewMatrix,r))));const s=.2;H.code.add(A`float lum(vec3 c) {
27
26
  return (min(min(c.r, c.g), c.b) + max(max(c.r, c.g), c.b)) * 0.5;
28
- }`),x(H),O(H),H.main.add(V`
27
+ }`),x(H),O(H),H.main.add(A`
29
28
  vec3 normal = normalize(vnormal);
30
29
  float vndl = dot(normal, mainLightDirection);
31
30
 
32
31
  float additionalAmbientScale = smoothstep(0.0, 1.0, clamp(vndl*2.5, 0.0, 1.0));
33
- float shadow = ${n?"max(lightingGlobalFactor * (1.0 - additionalAmbientScale), readShadowMap(vpos, linearDepth))":X?"lightingGlobalFactor * (1.0 - additionalAmbientScale)":"0.0"};
32
+ float shadow = ${n?"max(lightingGlobalFactor * (1.0 - additionalAmbientScale), readShadowMap(vpos, linearDepth))":Y?"lightingGlobalFactor * (1.0 - additionalAmbientScale)":"0.0"};
34
33
 
35
34
  float ssao = evaluateAmbientOcclusionInverse();
36
35
  vec4 tileColor = getTileColor();
37
36
 
38
- ${A(oe,V`vec4 overlayColorOpaque = getOverlayColor(ovColorTex, vtcOverlay);
37
+ ${F(oe,A`vec4 overlayColorOpaque = getOverlayColor(ovColorTex, vtcOverlay);
39
38
  vec4 overlayColor = overlayOpacity * overlayColorOpaque;
40
- ${A(re,`if (overlayColor.a < ${V.float(I)}) { discard; }`)}
39
+ ${F(re,`if (overlayColor.a < ${A.float(I)}) { discard; }`)}
41
40
  vec4 groundColor = tileColor;
42
41
  tileColor = tileColor * (1.0 - overlayColor.a) + overlayColor;`)}
43
42
 
44
43
  // If combined alpha is 0 we can discard pixel. The performance impact by having a discard here
45
44
  // is neglectable because terrain typically renders first into the framebuffer.
46
- if(tileColor.a < ${V.float(I)}) {
45
+ if(tileColor.a < ${A.float(I)}) {
47
46
  discard;
48
47
  }
49
48
 
50
49
  bool sliced = rejectBySlice(vpos);
51
50
  if (sliced) {
52
- tileColor *= ${V.float(s)};
51
+ tileColor *= ${A.float(s)};
53
52
  }
54
53
 
55
54
  vec3 albedo = tileColor.rgb;
@@ -58,8 +57,8 @@ return (min(min(c.r, c.g), c.b) + max(max(c.r, c.g), c.b)) * 0.5;
58
57
 
59
58
  vec3 additionalLight = ssao * mainLightIntensity * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor;
60
59
 
61
- ${J===S.Simplified||J===S.TerrainWithWater?V`fragColor = vec4(evaluatePBRSimplifiedLighting(normal, albedo, shadow, 1.0 - ssao, additionalLight, normalize(vpos - cameraPosition), vup), tileColor.a);`:V`fragColor = vec4(evaluateSceneLighting(normal, albedo, shadow, 1.0 - ssao, additionalLight), tileColor.a);`}
62
- ${A(t,V`vec4 overlayWaterMask = getOverlayColor(ovWaterTex, vtcOverlay);
60
+ ${K===S.Simplified||K===S.TerrainWithWater?A`fragColor = vec4(evaluatePBRSimplifiedLighting(normal, albedo, shadow, 1.0 - ssao, additionalLight, normalize(vpos - cameraPosition), vup), tileColor.a);`:A`fragColor = vec4(evaluateSceneLighting(normal, albedo, shadow, 1.0 - ssao, additionalLight), tileColor.a);`}
61
+ ${F(t,A`vec4 overlayWaterMask = getOverlayColor(ovWaterTex, vtcOverlay);
63
62
  float waterNormalLength = length(overlayWaterMask);
64
63
  if (waterNormalLength > 0.95) {
65
64
  mat3 tbnMatrix = mat3(tbnTangent, tbnBiTangent, vnormal);
@@ -67,11 +66,11 @@ return (min(min(c.r, c.g), c.b) + max(max(c.r, c.g), c.b)) * 0.5;
67
66
  vec4 viewPosition = view*vec4(vpos, 1.0);
68
67
  vec4 waterColorLinear = getOverlayWaterColor(overlayWaterMask, waterOverlayColor, -normalize(vpos - cameraPosition), shadow, vnormal, tbnMatrix, viewPosition.xyz, vpos + localOrigin);
69
68
  vec4 waterColorNonLinear = delinearizeGamma(vec4(waterColorLinear.xyz, 1.0));
70
- float opacity = sliced ? ${V.float(s)} : 1.0;
69
+ float opacity = sliced ? ${A.float(s)} : 1.0;
71
70
  // un-gamma the ground color to mix in linear space
72
71
  fragColor = mix(groundColor, waterColorNonLinear, waterColorLinear.w) * opacity;
73
72
  }`)}
74
- ${A(Z,V`float perspectiveScale = screenSizePerspectiveScaleFloat(1.0, screenSizeCosAngle, screenSizeDistanceToCamera, vec4(0.0));
73
+ ${F(ee,A`float perspectiveScale = screenSizePerspectiveScaleFloat(1.0, screenSizeCosAngle, screenSizeDistanceToCamera, vec4(0.0));
75
74
  if (perspectiveScale <= 0.25) {
76
75
  fragColor = mix(fragColor, vec4(1.0, 0.0, 0.0, 1.0), perspectiveScale * 4.0);
77
76
  } else if (perspectiveScale <= 0.5) {
@@ -81,34 +80,34 @@ return (min(min(c.r, c.g), c.b) + max(max(c.r, c.g), c.b)) * 0.5;
81
80
  } else {
82
81
  fragColor = mix(fragColor, vec4(1.0, 0.0, 1.0, 1.0), (perspectiveScale - 0.5) * 2.0);
83
82
  }`)}
84
- ${A(r.visualizeNormals,X?V`
83
+ ${F(r.visualizeNormals,Y?A`
85
84
  vec3 localUp = normalize(vpos + localOrigin);
86
85
  vec3 right = normalize(cross(vec3(0.0, 0.0, 1.0), localUp));
87
86
  vec3 forward = normalize(cross(localUp, right));
88
87
  mat3 tbn = mat3(right, forward, localUp);
89
88
  vec3 tNormal = normalize(normal * tbn);
90
- fragColor = vec4(vec3(0.5) + 0.5 * tNormal, 0.0);`:V`
89
+ fragColor = vec4(vec3(0.5) + 0.5 * tNormal, 0.0);`:A`
91
90
  vec3 tNormal = normalize(normal);
92
91
  fragColor = vec4(vec3(0.5) + 0.5 * tNormal, 0.0);`)}
93
- ${A(Q,V`vec2 dVuv = fwidth(vuv0);
92
+ ${F(X,A`vec2 dVuv = fwidth(vuv0);
94
93
  vec2 edgeFactors = smoothstep(vec2(0.0), 1.5 * dVuv, min(vuv0, 1.0 - vuv0));
95
94
  float edgeFactor = 1.0 - min(edgeFactors.x, edgeFactors.y);
96
95
  fragColor = mix(fragColor, vec4(1.0, 0.0, 0.0, 1.0), edgeFactor);`)}
97
- fragColor = applySlice(fragColor, vpos);`)}break;case d.Depth:ae&&i.include(z,r),k.main.add(V`
98
- ${A(ae,"setOverlayVTC(getUV0());")}
99
- gl_Position = transformPosition(proj, view, position);`),H.main.add(`${A(ae,`if (getCombinedOverlayColor().a < ${V.float(I)}) discard;`)}`);break;case d.Shadow:case d.ShadowHighlight:case d.ShadowExcludeHighlight:case d.ViewshedShadow:i.include(w,r),n(i),s(i),k.main.add(V`gl_Position = transformPositionWithDepth(proj, view, position, nearFar, linearDepth);`),H.main.add(V`outputDepth(linearDepth);`);break;case d.Normal:ae&&i.include(z,r),G.add("vnormal","vec3"),N(k),ee(),k.main.add(V`
100
- ${A(ae,"setOverlayVTC(getUV0());")}
96
+ fragColor = applySlice(fragColor, vpos);`)}break;case d.Depth:ae&&i.include(z,r),k.main.add(A`
97
+ ${F(ae,"setOverlayVTC(uv0);")}
98
+ gl_Position = transformPosition(proj, view, position);`),H.main.add(`${F(ae,`if (getCombinedOverlayColor().a < ${A.float(I)}) discard;`)}`);break;case d.Shadow:case d.ShadowHighlight:case d.ShadowExcludeHighlight:case d.ViewshedShadow:i.include(w,r),n(i),s(i),k.main.add(A`gl_Position = transformPositionWithDepth(proj, view, position, nearFar, linearDepth);`),H.main.add(A`outputDepth(linearDepth);`);break;case d.Normal:ae&&i.include(z,r),G.add("vnormal","vec3"),N(k),R(),k.main.add(A`
99
+ ${F(ae,"setOverlayVTC(uv0);")}
101
100
  gl_Position = transformPosition(proj, view, position);
102
- vnormal = normalize((viewNormal * vec4(getNormal(), 1.0)).xyz);`),H.main.add(V`
103
- ${A(ae,`if (getCombinedOverlayColor().a < ${V.float(I)}) discard;`)}
101
+ vnormal = normalize((viewNormal * vec4(getNormal(), 1.0)).xyz);`),H.main.add(A`
102
+ ${F(ae,`if (getCombinedOverlayColor().a < ${A.float(I)}) discard;`)}
104
103
  vec3 normal = normalize(vnormal);
105
104
  if (gl_FrontFacing == false) {
106
105
  normal = -normal;
107
106
  }
108
- fragColor = vec4(vec3(0.5) + 0.5 * normal, 1.0);`);break;case d.Highlight:oe&&i.include(z,r),k.main.add(V`
109
- ${A(oe,"setOverlayVTC(getUV0());")}
110
- gl_Position = transformPosition(proj, view, position);`),i.include(u,r),H.main.add(V`
111
- ${A(oe,V`
107
+ fragColor = vec4(vec3(0.5) + 0.5 * normal, 1.0);`);break;case d.Highlight:oe&&i.include(z,r),k.main.add(A`
108
+ ${F(oe,"setOverlayVTC(uv0);")}
109
+ gl_Position = transformPosition(proj, view, position);`),i.include(u,r),H.main.add(A`
110
+ ${F(oe,A`
112
111
  calculateOcclusionAndOutputHighlightOverlay(getAllOverlayHighlightValuesEncoded());`,"calculateOcclusionAndOutputHighlight();")}
113
- `)}if(R===d.ObjectAndLayerIdColor)if(oe)r.pbrMode=S.Disabled,i.include(z,r),r.pbrMode=J,k.main.add(V`gl_Position = transformPosition(proj, view, position);
114
- setOverlayVTC(getUV0());`),H.main.add(V`fragColor = getOverlayColorTexel();`);else{const e=Y===t.Opaque;k.main.add(V`${A(e,"gl_Position = transformPosition(proj, view, position);")}`),H.main.add(V`fragColor = vec4(0.0);`)}return i}const E=r(),q=i(),G=Object.freeze(Object.defineProperty({__proto__:null,TerrainPassParameters:k,build:H},Symbol.toStringTag,{value:"Module"}));export{k as T,G as a,H as b};
112
+ `)}if(J===d.ObjectAndLayerIdColor)if(oe)r.pbrMode=S.Disabled,i.include(z,r),r.pbrMode=K,k.main.add(A`gl_Position = transformPosition(proj, view, position);
113
+ setOverlayVTC(uv0);`),H.main.add(A`fragColor = getOverlayColorTexel();`);else{const e=Z===t.Opaque;k.main.add(A`${F(e,"gl_Position = transformPosition(proj, view, position);")}`),H.main.add(A`fragColor = vec4(0.0);`)}return i}const E=r(),q=i(),G=Object.freeze(Object.defineProperty({__proto__:null,TerrainPassParameters:k,build:H},Symbol.toStringTag,{value:"Module"}));export{k as T,G as a,H as b};
package/copyright.txt CHANGED
@@ -1674,3 +1674,32 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1674
1674
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1675
1675
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1676
1676
  SOFTWARE.
1677
+
1678
+
1679
+ -----------------------------------------------------------------
1680
+
1681
+ float16/
1682
+
1683
+ https://github.com/petamoriken/float16
1684
+
1685
+ MIT License
1686
+
1687
+ Copyright (c) 2017-2025 Kenta Moriuchi
1688
+
1689
+ Permission is hereby granted, free of charge, to any person obtaining a copy
1690
+ of this software and associated documentation files (the "Software"), to deal
1691
+ in the Software without restriction, including without limitation the rights
1692
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1693
+ copies of the Software, and to permit persons to whom the Software is
1694
+ furnished to do so, subject to the following conditions:
1695
+
1696
+ The above copyright notice and this permission notice shall be included in all
1697
+ copies or substantial portions of the Software.
1698
+
1699
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1700
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1701
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1702
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1703
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1704
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1705
+ SOFTWARE.
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import"./has.js";function n(n){return n instanceof ArrayBuffer}function r(n){return"Int8Array"===n?.constructor?.name}function t(n){return"Uint8Array"===n?.constructor?.name}function u(n){return"Uint8ClampedArray"===n?.constructor?.name}function o(n){return"Int16Array"===n?.constructor?.name}function c(n){return"Uint16Array"===n?.constructor?.name}function e(n){return"Int32Array"===n?.constructor?.name}function a(n){return"Uint32Array"===n?.constructor?.name}function i(n){return"Float32Array"===n?.constructor?.name}function f(n){return"Float64Array"===n?.constructor?.name}function s(n){return"buffer"in n}const m=1024;function y(n){return f(n)||i(n)||e(n)||o(n)||r(n)}function A(n){return f(n)||i(n)}function U(n){return f(n)?179769e303:i(n)?3402823e32:a(n)?4294967295:c(n)?65535:t(n)||u(n)?255:e(n)?2147483647:o(n)?32767:r(n)?127:256}export{n as isArrayBuffer,A as isFloat,i as isFloat32Array,f as isFloat64Array,o as isInt16Array,e as isInt32Array,r as isInt8Array,y as isSigned,s as isTypedArray,c as isUint16Array,a as isUint32Array,t as isUint8Array,u as isUint8ClampedArray,U as maximumValue,m as nativeArrayMaxSize};
5
+ import"./has.js";function n(n){return n instanceof ArrayBuffer}function r(n){return"Int8Array"===n?.constructor?.name}function t(n){return"Uint8Array"===n?.constructor?.name}function o(n){return"Uint8ClampedArray"===n?.constructor?.name}function u(n){return"Int16Array"===n?.constructor?.name}function c(n){return"Uint16Array"===n?.constructor?.name}function e(n){return"Int32Array"===n?.constructor?.name}function a(n){return"Uint32Array"===n?.constructor?.name}function i(n){return"Float16Array"===n?.constructor?.name}function f(n){return"Float32Array"===n?.constructor?.name}function s(n){return"Float64Array"===n?.constructor?.name}function m(n){return"buffer"in n}const y=1024;function A(n){return s(n)||f(n)||e(n)||u(n)||r(n)}function l(n){return s(n)||f(n)}function U(n){return s(n)?179769e303:i(n)?65504:f(n)?3402823e32:a(n)?4294967295:c(n)?65535:t(n)||o(n)?255:e(n)?2147483647:u(n)?32767:r(n)?127:256}export{n as isArrayBuffer,l as isFloat,i as isFloat16Array,f as isFloat32Array,s as isFloat64Array,u as isInt16Array,e as isInt32Array,r as isInt8Array,A as isSigned,m as isTypedArray,c as isUint16Array,a as isUint32Array,t as isUint8Array,o as isUint8ClampedArray,U as maximumValue,y as nativeArrayMaxSize};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import{Float16Array as r}from"@petamoriken/float16";import{nativeArrayMaxSize as n}from"../../core/typedArrayUtil.js";function e(e,t=!1){return e<=n?t?new Array(e).fill(0):new Array(e):new r(e)}function t(e){return Array.isArray(e)?e.length<n?e:new r(e):e.length<n?Array.from(e):e}function a(e){return(Array.isArray(e)?e.length:e.byteLength/8)<=n?Array.from(e):new r(e)}function o(r,n,e){return Array.isArray(r)?r.slice(n,n+e):r.subarray(n,n+e)}export{t as compactHalfFloatArray,a as floatArrayFrom,o as floatSubArray,e as newHalfFloatArray};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{BufferViewMat3Impl as e}from"./internals/Mat3.js";import{BufferViewMat4Impl as t}from"./internals/Mat4.js";import{BufferViewScalarImpl as r}from"./internals/Scalar.js";import{BufferViewVec2Impl as s}from"./internals/Vec2.js";import{BufferViewVec3Impl as f}from"./internals/Vec3.js";import{BufferViewVec4Impl as n}from"./internals/Vec4.js";class i extends r{constructor(e,t=0,r,s){super(Float32Array,e,t,r,s),this.elementType="f32"}static fromTypedArray(e,t){return new i(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="f32"}}class y extends s{constructor(e,t=0,r,s){super(Float32Array,e,t,r,s),this.elementType="f32"}slice(e,t){return this.sliceBuffer(y,e,t)}static fromTypedArray(e,t){return new y(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="f32"}}class c extends f{constructor(e,t=0,r,s){super(Float32Array,e,t,r,s),this.elementType="f32"}slice(e,t){return this.sliceBuffer(c,e,t)}static fromTypedArray(e,t){return new c(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="f32"}}class u extends n{constructor(e,t=0,r,s){super(Float32Array,e,t,r,s),this.elementType="f32"}slice(e,t){return this.sliceBuffer(u,e,t)}static fromTypedArray(e,t){return new u(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="f32"}}class a extends e{constructor(e,t=0,r,s){super(Float32Array,e,t,r,s),this.elementType="f32"}slice(e,t){return this.sliceBuffer(a,e,t)}static fromTypedArray(e,t){return new a(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="f32"}}class l extends e{constructor(e,t=0,r,s){super(Float64Array,e,t,r,s),this.elementType="f64"}slice(e,t){return this.sliceBuffer(l,e,t)}static fromTypedArray(e,t){return new l(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="f64"}}class p extends t{constructor(e,t=0,r,s){super(Float32Array,e,t,r,s),this.elementType="f32"}slice(e,t){return this.sliceBuffer(p,e,t)}static fromTypedArray(e,t){return new p(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="f32"}}class b extends t{constructor(e,t=0,r,s){super(Float64Array,e,t,r,s),this.elementType="f64"}slice(e,t){return this.sliceBuffer(b,e,t)}static fromTypedArray(e,t){return new b(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="f64"}}class h extends r{constructor(e,t=0,r,s){super(Float64Array,e,t,r,s),this.elementType="f64"}slice(e,t){return this.sliceBuffer(h,e,t)}static fromTypedArray(e,t){return new h(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="f64"}}class o extends s{constructor(e,t=0,r,s){super(Float64Array,e,t,r,s),this.elementType="f64"}slice(e,t){return this.sliceBuffer(o,e,t)}static fromTypedArray(e,t){return new o(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="f64"}}class m extends f{constructor(e,t=0,r,s){super(Float64Array,e,t,r,s),this.elementType="f64"}slice(e,t){return this.sliceBuffer(m,e,t)}static fromTypedArray(e,t){return new m(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="f64"}}class T extends n{constructor(e,t=0,r,s){super(Float64Array,e,t,r,s),this.elementType="f64"}slice(e,t){return this.sliceBuffer(T,e,t)}static fromTypedArray(e,t){return new T(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="f64"}}class d extends r{constructor(e,t=0,r,s){super(Uint8Array,e,t,r,s),this.elementType="u8"}slice(e,t){return this.sliceBuffer(d,e,t)}static fromTypedArray(e,t){return new d(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="u8"}}class A extends s{constructor(e,t=0,r,s){super(Uint8Array,e,t,r,s),this.elementType="u8"}slice(e,t){return this.sliceBuffer(A,e,t)}static fromTypedArray(e,t){return new A(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="u8"}}class O extends f{constructor(e,t=0,r,s){super(Uint8Array,e,t,r,s),this.elementType="u8"}slice(e,t){return this.sliceBuffer(O,e,t)}static fromTypedArray(e,t){return new O(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="u8"}}class x extends n{constructor(e,t=0,r,s){super(Uint8Array,e,t,r,s),this.elementType="u8"}slice(e,t){return this.sliceBuffer(x,e,t)}static fromTypedArray(e,t){return new x(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="u8"}}class g extends r{constructor(e,t=0,r,s){super(Uint16Array,e,t,r,s),this.elementType="u16"}slice(e,t){return this.sliceBuffer(g,e,t)}static fromTypedArray(e,t){return new g(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="u16"}}class w extends s{constructor(e,t=0,r,s){super(Uint16Array,e,t,r,s),this.elementType="u16"}slice(e,t){return this.sliceBuffer(w,e,t)}static fromTypedArray(e,t){return new w(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="u16"}}class E extends f{constructor(e,t=0,r,s){super(Uint16Array,e,t,r,s),this.elementType="u16"}slice(e,t){return this.sliceBuffer(E,e,t)}static fromTypedArray(e,t){return new E(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="u16"}}class L extends n{constructor(e,t=0,r,s){super(Uint16Array,e,t,r,s),this.elementType="u16"}slice(e,t){return this.sliceBuffer(L,e,t)}static fromTypedArray(e,t){return new L(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="u16"}}class B extends r{constructor(e,t=0,r,s){super(Uint32Array,e,t,r,s),this.elementType="u32"}slice(e,t){return this.sliceBuffer(B,e,t)}static fromTypedArray(e,t){return new B(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="u32"}}class F extends s{constructor(e,t=0,r,s){super(Uint32Array,e,t,r,s),this.elementType="u32"}slice(e,t){return this.sliceBuffer(F,e,t)}static fromTypedArray(e,t){return new F(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="u32"}}class I extends f{constructor(e,t=0,r,s){super(Uint32Array,e,t,r,s),this.elementType="u32"}slice(e,t){return this.sliceBuffer(I,e,t)}static fromTypedArray(e,t){return new I(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="u32"}}class U extends n{constructor(e,t=0,r,s){super(Uint32Array,e,t,r,s),this.elementType="u32"}slice(e,t){return this.sliceBuffer(U,e,t)}static fromTypedArray(e,t){return new U(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="u32"}}class j extends r{constructor(e,t=0,r,s){super(Int8Array,e,t,r,s),this.elementType="i8"}slice(e,t){return this.sliceBuffer(j,e,t)}static fromTypedArray(e,t){return new j(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="i8"}}class V extends s{constructor(e,t=0,r,s){super(Int8Array,e,t,r,s),this.elementType="i8"}slice(e,t){return this.sliceBuffer(V,e,t)}static fromTypedArray(e,t){return new V(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="i8"}}class M extends f{constructor(e,t=0,r,s){super(Int8Array,e,t,r,s),this.elementType="i8"}slice(e,t){return this.sliceBuffer(M,e,t)}static fromTypedArray(e,t){return new M(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="i8"}}class S extends n{constructor(e,t=0,r,s){super(Int8Array,e,t,r,s),this.elementType="i8"}slice(e,t){return this.sliceBuffer(S,e,t)}static fromTypedArray(e,t){return new S(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="i8"}}class k extends r{constructor(e,t=0,r,s){super(Int16Array,e,t,r,s),this.elementType="i16"}slice(e,t){return this.sliceBuffer(k,e,t)}static fromTypedArray(e,t){return new k(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="i16"}}class q extends s{constructor(e,t=0,r,s){super(Int16Array,e,t,r,s),this.elementType="i16"}slice(e,t){return this.sliceBuffer(q,e,t)}static fromTypedArray(e,t){return new q(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="i16"}}class v extends f{constructor(e,t=0,r,s){super(Int16Array,e,t,r,s),this.elementType="i16"}slice(e,t){return this.sliceBuffer(v,e,t)}static fromTypedArray(e,t){return new v(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="i16"}}class z extends n{constructor(e,t=0,r,s){super(Int16Array,e,t,r,s),this.elementType="i16"}slice(e,t){return this.sliceBuffer(z,e,t)}static fromTypedArray(e,t){return new z(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="i16"}}class C extends r{constructor(e,t=0,r,s){super(Int32Array,e,t,r,s),this.elementType="i32"}slice(e,t){return this.sliceBuffer(C,e,t)}static fromTypedArray(e,t){return new C(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="i32"}}class D extends s{constructor(e,t=0,r,s){super(Int32Array,e,t,r,s),this.elementType="i32"}slice(e,t){return this.sliceBuffer(D,e,t)}static fromTypedArray(e,t){return new D(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="i32"}}class G extends f{constructor(e,t=0,r,s){super(Int32Array,e,t,r,s),this.elementType="i32"}slice(e,t){return this.sliceBuffer(G,e,t)}static fromTypedArray(e,t){return new G(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="i32"}}class H extends n{constructor(e,t=0,r,s){super(Int32Array,e,t,r,s),this.elementType="i32"}slice(e,t){return this.sliceBuffer(H,e,t)}static fromTypedArray(e,t){return new H(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="i32"}}export{i as BufferViewFloat,h as BufferViewFloat64,k as BufferViewInt16,C as BufferViewInt32,j as BufferViewInt8,a as BufferViewMat3f,l as BufferViewMat3f64,p as BufferViewMat4f,b as BufferViewMat4f64,g as BufferViewUint16,B as BufferViewUint32,d as BufferViewUint8,y as BufferViewVec2f,o as BufferViewVec2f64,q as BufferViewVec2i16,D as BufferViewVec2i32,V as BufferViewVec2i8,w as BufferViewVec2u16,F as BufferViewVec2u32,A as BufferViewVec2u8,c as BufferViewVec3f,m as BufferViewVec3f64,v as BufferViewVec3i16,G as BufferViewVec3i32,M as BufferViewVec3i8,E as BufferViewVec3u16,I as BufferViewVec3u32,O as BufferViewVec3u8,u as BufferViewVec4f,T as BufferViewVec4f64,z as BufferViewVec4i16,H as BufferViewVec4i32,S as BufferViewVec4i8,L as BufferViewVec4u16,U as BufferViewVec4u32,x as BufferViewVec4u8};
5
+ import{Float16Array as e}from"@petamoriken/float16";import{BufferViewMat3Impl as t}from"./internals/Mat3.js";import{BufferViewMat4Impl as r}from"./internals/Mat4.js";import{BufferViewScalarImpl as s}from"./internals/Scalar.js";import{BufferViewVec2Impl as f}from"./internals/Vec2.js";import{BufferViewVec3Impl as n}from"./internals/Vec3.js";import{BufferViewVec4Impl as i}from"./internals/Vec4.js";class y extends s{constructor(e,t=0,r,s){super(Float32Array,e,t,r,s),this.elementType="f32"}static fromTypedArray(e,t){return new y(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="f32"}}class c extends f{constructor(t,r=0,s,f){super(e,t,r,s,f),this.elementType="f16"}slice(e,t){return this.sliceBuffer(c,e,t)}static fromTypedArray(e,t){return new c(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="f16"}}class u extends f{constructor(e,t=0,r,s){super(Float32Array,e,t,r,s),this.elementType="f32"}slice(e,t){return this.sliceBuffer(u,e,t)}static fromTypedArray(e,t){return new u(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="f32"}}class a extends n{constructor(e,t=0,r,s){super(Float32Array,e,t,r,s),this.elementType="f32"}slice(e,t){return this.sliceBuffer(a,e,t)}static fromTypedArray(e,t){return new a(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="f32"}}class l extends i{constructor(e,t=0,r,s){super(Float32Array,e,t,r,s),this.elementType="f32"}slice(e,t){return this.sliceBuffer(l,e,t)}static fromTypedArray(e,t){return new l(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="f32"}}class p extends t{constructor(e,t=0,r,s){super(Float32Array,e,t,r,s),this.elementType="f32"}slice(e,t){return this.sliceBuffer(p,e,t)}static fromTypedArray(e,t){return new p(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="f32"}}class b extends t{constructor(e,t=0,r,s){super(Float64Array,e,t,r,s),this.elementType="f64"}slice(e,t){return this.sliceBuffer(b,e,t)}static fromTypedArray(e,t){return new b(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="f64"}}class h extends r{constructor(e,t=0,r,s){super(Float32Array,e,t,r,s),this.elementType="f32"}slice(e,t){return this.sliceBuffer(h,e,t)}static fromTypedArray(e,t){return new h(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="f32"}}class o extends r{constructor(e,t=0,r,s){super(Float64Array,e,t,r,s),this.elementType="f64"}slice(e,t){return this.sliceBuffer(o,e,t)}static fromTypedArray(e,t){return new o(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="f64"}}class m extends s{constructor(e,t=0,r,s){super(Float64Array,e,t,r,s),this.elementType="f64"}slice(e,t){return this.sliceBuffer(m,e,t)}static fromTypedArray(e,t){return new m(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="f64"}}class T extends f{constructor(e,t=0,r,s){super(Float64Array,e,t,r,s),this.elementType="f64"}slice(e,t){return this.sliceBuffer(T,e,t)}static fromTypedArray(e,t){return new T(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="f64"}}class d extends n{constructor(e,t=0,r,s){super(Float64Array,e,t,r,s),this.elementType="f64"}slice(e,t){return this.sliceBuffer(d,e,t)}static fromTypedArray(e,t){return new d(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="f64"}}class O extends i{constructor(e,t=0,r,s){super(Float64Array,e,t,r,s),this.elementType="f64"}slice(e,t){return this.sliceBuffer(O,e,t)}static fromTypedArray(e,t){return new O(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="f64"}}class A extends s{constructor(e,t=0,r,s){super(Uint8Array,e,t,r,s),this.elementType="u8"}slice(e,t){return this.sliceBuffer(A,e,t)}static fromTypedArray(e,t){return new A(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="u8"}}class x extends f{constructor(e,t=0,r,s){super(Uint8Array,e,t,r,s),this.elementType="u8"}slice(e,t){return this.sliceBuffer(x,e,t)}static fromTypedArray(e,t){return new x(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="u8"}}class g extends n{constructor(e,t=0,r,s){super(Uint8Array,e,t,r,s),this.elementType="u8"}slice(e,t){return this.sliceBuffer(g,e,t)}static fromTypedArray(e,t){return new g(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="u8"}}class w extends i{constructor(e,t=0,r,s){super(Uint8Array,e,t,r,s),this.elementType="u8"}slice(e,t){return this.sliceBuffer(w,e,t)}static fromTypedArray(e,t){return new w(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="u8"}}class E extends s{constructor(e,t=0,r,s){super(Uint16Array,e,t,r,s),this.elementType="u16"}slice(e,t){return this.sliceBuffer(E,e,t)}static fromTypedArray(e,t){return new E(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="u16"}}class L extends f{constructor(e,t=0,r,s){super(Uint16Array,e,t,r,s),this.elementType="u16"}slice(e,t){return this.sliceBuffer(L,e,t)}static fromTypedArray(e,t){return new L(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="u16"}}class B extends n{constructor(e,t=0,r,s){super(Uint16Array,e,t,r,s),this.elementType="u16"}slice(e,t){return this.sliceBuffer(B,e,t)}static fromTypedArray(e,t){return new B(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="u16"}}class F extends i{constructor(e,t=0,r,s){super(Uint16Array,e,t,r,s),this.elementType="u16"}slice(e,t){return this.sliceBuffer(F,e,t)}static fromTypedArray(e,t){return new F(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="u16"}}class I extends s{constructor(e,t=0,r,s){super(Uint32Array,e,t,r,s),this.elementType="u32"}slice(e,t){return this.sliceBuffer(I,e,t)}static fromTypedArray(e,t){return new I(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="u32"}}class U extends f{constructor(e,t=0,r,s){super(Uint32Array,e,t,r,s),this.elementType="u32"}slice(e,t){return this.sliceBuffer(U,e,t)}static fromTypedArray(e,t){return new U(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="u32"}}class j extends n{constructor(e,t=0,r,s){super(Uint32Array,e,t,r,s),this.elementType="u32"}slice(e,t){return this.sliceBuffer(j,e,t)}static fromTypedArray(e,t){return new j(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="u32"}}class V extends i{constructor(e,t=0,r,s){super(Uint32Array,e,t,r,s),this.elementType="u32"}slice(e,t){return this.sliceBuffer(V,e,t)}static fromTypedArray(e,t){return new V(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="u32"}}class M extends s{constructor(e,t=0,r,s){super(Int8Array,e,t,r,s),this.elementType="i8"}slice(e,t){return this.sliceBuffer(M,e,t)}static fromTypedArray(e,t){return new M(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="i8"}}class k extends f{constructor(e,t=0,r,s){super(Int8Array,e,t,r,s),this.elementType="i8"}slice(e,t){return this.sliceBuffer(k,e,t)}static fromTypedArray(e,t){return new k(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="i8"}}class S extends n{constructor(e,t=0,r,s){super(Int8Array,e,t,r,s),this.elementType="i8"}slice(e,t){return this.sliceBuffer(S,e,t)}static fromTypedArray(e,t){return new S(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="i8"}}class q extends i{constructor(e,t=0,r,s){super(Int8Array,e,t,r,s),this.elementType="i8"}slice(e,t){return this.sliceBuffer(q,e,t)}static fromTypedArray(e,t){return new q(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="i8"}}class v extends s{constructor(e,t=0,r,s){super(Int16Array,e,t,r,s),this.elementType="i16"}slice(e,t){return this.sliceBuffer(v,e,t)}static fromTypedArray(e,t){return new v(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="i16"}}class z extends f{constructor(e,t=0,r,s){super(Int16Array,e,t,r,s),this.elementType="i16"}slice(e,t){return this.sliceBuffer(z,e,t)}static fromTypedArray(e,t){return new z(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="i16"}}class C extends n{constructor(e,t=0,r,s){super(Int16Array,e,t,r,s),this.elementType="i16"}slice(e,t){return this.sliceBuffer(C,e,t)}static fromTypedArray(e,t){return new C(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="i16"}}class D extends i{constructor(e,t=0,r,s){super(Int16Array,e,t,r,s),this.elementType="i16"}slice(e,t){return this.sliceBuffer(D,e,t)}static fromTypedArray(e,t){return new D(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="i16"}}class G extends s{constructor(e,t=0,r,s){super(Int32Array,e,t,r,s),this.elementType="i32"}slice(e,t){return this.sliceBuffer(G,e,t)}static fromTypedArray(e,t){return new G(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="i32"}}class H extends f{constructor(e,t=0,r,s){super(Int32Array,e,t,r,s),this.elementType="i32"}slice(e,t){return this.sliceBuffer(H,e,t)}static fromTypedArray(e,t){return new H(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="i32"}}class J extends n{constructor(e,t=0,r,s){super(Int32Array,e,t,r,s),this.elementType="i32"}slice(e,t){return this.sliceBuffer(J,e,t)}static fromTypedArray(e,t){return new J(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="i32"}}class K extends i{constructor(e,t=0,r,s){super(Int32Array,e,t,r,s),this.elementType="i32"}slice(e,t){return this.sliceBuffer(K,e,t)}static fromTypedArray(e,t){return new K(e.buffer,e.byteOffset,t,e.byteOffset+e.byteLength)}static{this.ElementType="i32"}}export{y as BufferViewFloat,m as BufferViewFloat64,v as BufferViewInt16,G as BufferViewInt32,M as BufferViewInt8,p as BufferViewMat3f,b as BufferViewMat3f64,h as BufferViewMat4f,o as BufferViewMat4f64,E as BufferViewUint16,I as BufferViewUint32,A as BufferViewUint8,u as BufferViewVec2f,c as BufferViewVec2f16,T as BufferViewVec2f64,z as BufferViewVec2i16,H as BufferViewVec2i32,k as BufferViewVec2i8,L as BufferViewVec2u16,U as BufferViewVec2u32,x as BufferViewVec2u8,a as BufferViewVec3f,d as BufferViewVec3f64,C as BufferViewVec3i16,J as BufferViewVec3i32,S as BufferViewVec3i8,B as BufferViewVec3u16,j as BufferViewVec3u32,g as BufferViewVec3u8,l as BufferViewVec4f,O as BufferViewVec4f64,D as BufferViewVec4i16,K as BufferViewVec4i32,q as BufferViewVec4i8,F as BufferViewVec4u16,V as BufferViewVec4u32,w as BufferViewVec4u8};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- function e(e){switch(e){case"u8":case"i8":return 1;case"u16":case"i16":return 2;case"u32":case"i32":case"f32":return 4;case"f64":return 8}}function c(e){switch(e){case"u8":case"u16":case"u32":return!1;case"i8":case"i16":case"i32":case"f32":case"f64":return!0}}function s(e){switch(e){case"u8":case"u16":case"u32":case"i8":case"i16":case"i32":return!0;case"f32":case"f64":return!1}}function r(e){switch(e){case"u8":return 255;case"u16":return 65535;case"u32":return 4294967295;case"i8":return 127;case"i16":return 32767;case"i32":return 2147483647;case"f32":return 3402823e32;case"f64":return 179769e303}}export{e as elementTypeSize,s as isInteger,c as isSigned,r as maximumValue};
5
+ function e(e){switch(e){case"u8":case"i8":return 1;case"u16":case"i16":case"f16":return 2;case"u32":case"i32":case"f32":return 4;case"f64":return 8}}function c(e){switch(e){case"u8":case"u16":case"u32":return!1;case"i8":case"i16":case"i32":case"f16":case"f32":case"f64":return!0}}function s(e){switch(e){case"u8":case"u16":case"u32":case"i8":case"i16":case"i32":return!0;case"f16":case"f32":case"f64":return!1}}function a(e){switch(e){case"u8":return 255;case"u16":return 65535;case"u32":return 4294967295;case"i8":return 127;case"i16":return 32767;case"i32":return 2147483647;case"f16":return 65504;case"f32":return 3402823e32;case"f64":return 179769e303}}export{e as elementTypeSize,s as isInteger,c as isSigned,a as maximumValue};
package/interfaces.d.ts CHANGED
@@ -10992,14 +10992,6 @@ declare namespace __esri {
10992
10992
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Polygon.html#centroid Read more...}
10993
10993
  */
10994
10994
  readonly centroid: Point | nullish;
10995
- /**
10996
- * A two dimensional array of points and curves that define the polygon geometry.
10997
- *
10998
- * @default undefined
10999
- *
11000
- * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Polygon.html#curveRings Read more...}
11001
- */
11002
- curveRings: any[][] | undefined;
11003
10995
  /**
11004
10996
  * Checks to see if polygon rings cross each other and indicates if the polygon is
11005
10997
  * self-intersecting, which means the ring of the polygon crosses itself.
@@ -11113,12 +11105,6 @@ declare namespace __esri {
11113
11105
  }
11114
11106
 
11115
11107
  interface PolygonProperties extends GeometryProperties {
11116
- /**
11117
- * A two dimensional array of points and curves that define the polygon geometry.
11118
- *
11119
- * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Polygon.html#curveRings Read more...}
11120
- */
11121
- curveRings?: any[][] | undefined;
11122
11108
  /**
11123
11109
  * An array of rings.
11124
11110
  *
@@ -11128,14 +11114,6 @@ declare namespace __esri {
11128
11114
  }
11129
11115
 
11130
11116
  export class Polyline extends Geometry {
11131
- /**
11132
- * A two dimensional array of points and curves that define the polyline geometry.
11133
- *
11134
- * @default undefined
11135
- *
11136
- * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Polyline.html#curvePaths Read more...}
11137
- */
11138
- curvePaths: any[][] | undefined;
11139
11117
  /**
11140
11118
  * An array of paths, or line segments, that make up the polyline.
11141
11119
  *
@@ -11213,12 +11191,6 @@ declare namespace __esri {
11213
11191
  }
11214
11192
 
11215
11193
  interface PolylineProperties extends GeometryProperties {
11216
- /**
11217
- * A two dimensional array of points and curves that define the polyline geometry.
11218
- *
11219
- * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Polyline.html#curvePaths Read more...}
11220
- */
11221
- curvePaths?: any[][] | undefined;
11222
11194
  /**
11223
11195
  * An array of paths, or line segments, that make up the polyline.
11224
11196
  *
@@ -75580,12 +75552,6 @@ declare namespace __esri {
75580
75552
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html#returnQueryGeometry Read more...}
75581
75553
  */
75582
75554
  returnQueryGeometry: boolean;
75583
- /**
75584
- * When `true` output geometry will include curves.
75585
- *
75586
- * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html#returnTrueCurves Read more...}
75587
- */
75588
- returnTrueCurves: boolean | nullish;
75589
75555
  /**
75590
75556
  * If `true`, and {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html#returnGeometry returnGeometry} is `true`, then z-values are included in the geometry.
75591
75557
  *
@@ -75917,12 +75883,6 @@ declare namespace __esri {
75917
75883
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html#returnQueryGeometry Read more...}
75918
75884
  */
75919
75885
  returnQueryGeometry?: boolean;
75920
- /**
75921
- * When `true` output geometry will include curves.
75922
- *
75923
- * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html#returnTrueCurves Read more...}
75924
- */
75925
- returnTrueCurves?: boolean | nullish;
75926
75886
  /**
75927
75887
  * If `true`, and {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html#returnGeometry returnGeometry} is `true`, then z-values are included in the geometry.
75928
75888
  *
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{numberMaxFloat32 as t}from"../../../core/mathUtils.js";import e from"../PixelBlock.js";import{getPixelValueRange as n}from"../rasterFormats/pixelRangeUtils.js";var l,i;!function(t){t[t.matchAny=0]="matchAny",t[t.matchAll=1]="matchAll"}(l||(l={})),function(t){t[t.bestMatch=0]="bestMatch",t[t.fail=1]="fail"}(i||(i={}));const o=9;function r(t){return null!=t&&"esri.layers.support.PixelBlock"===t.declaredClass&&t.pixels&&t.pixels.length>0}function s(t,e){return e?.length&&r(t)?t.extractBands(e):t}function a(t){if(!t?.length||t.some((t=>!r(t))))return null;if(1===t.length)return t[0]?.clone()??null;const n=t,{width:l,height:i,pixelType:o}=n[0];if(n.some((t=>t.width!==l||t.height!==i)))return null;const s=n.map((({mask:t})=>t)).filter((t=>null!=t));let a=null;s.length&&(a=new Uint8Array(l*i),a.set(s[0]),s.length>1&&y(s.slice(1),a));const h=[];n.forEach((({pixels:t})=>h.push(...t)));const f=n.map((({statistics:t})=>t)).filter((t=>t?.length)),c=[];return f.forEach((t=>c.push(...t))),new e({pixelType:o,width:l,height:i,mask:a,pixels:h,statistics:c.length?c:null})}function h(t){if(!t)return;const e=t.colormap;if(!e||0===e.length)return;const n=e.sort(((t,e)=>t[0]-e[0]));let l=0;n[0][0]<0&&(l=n[0][0]);const i=Math.max(256,n[n.length-1][0]-l+1),o=new Uint8Array(4*i),r=[];let s,a=0,h=0;const f=5===n[0].length;if(i>65536)return n.forEach((t=>{r[t[0]-l]=f?t.slice(1):t.slice(1).concat([255])})),{indexed2DColormap:r,offset:l,alphaSpecified:f};if(t.fillUnspecified)for(s=n[h],a=s[0]-l;a<i;a++)o[4*a]=s[1],o[4*a+1]=s[2],o[4*a+2]=s[3],o[4*a+3]=f?s[4]:255,a===s[0]-l&&(s=h===n.length-1?s:n[++h]);else for(a=0;a<n.length;a++)s=n[a],h=4*(s[0]-l),o[h]=s[1],o[h+1]=s[2],o[h+2]=s[3],o[h+3]=f?s[4]:255;return{indexedColormap:o,offset:l,alphaSpecified:f}}function f(t,e){if(!r(t))return t;if(!e||!e.indexedColormap&&!e.indexed2DColormap)return t;const n=t.clone(),l=n.pixels;let i=n.mask;const o=n.width*n.height;if(1!==l.length)return t;const{indexedColormap:s,indexed2DColormap:a,offset:h,alphaSpecified:f}=e;let c=0;const u=l[0],p=new Uint8Array(u.length),x=new Uint8Array(u.length),m=new Uint8Array(u.length);let d,g=0;if(s){const t=s.length-1;if(null!=i)for(c=0;c<o;c++)i[c]&&(g=4*(u[c]-h),g<h||g>t?i[c]=0:(p[c]=s[g],x[c]=s[g+1],m[c]=s[g+2],i[c]=s[g+3]));else{for(i=new Uint8Array(o),c=0;c<o;c++)g=4*(u[c]-h),g<h||g>t?i[c]=0:(p[c]=s[g],x[c]=s[g+1],m[c]=s[g+2],i[c]=s[g+3]);n.mask=i}}else if(a)if(null!=i)for(c=0;c<o;c++)i[c]&&(d=a[u[c]],p[c]=d[0],x[c]=d[1],m[c]=d[2],i[c]=d[3]);else{for(i=new Uint8Array(o),c=0;c<o;c++)d=a[u[c]],p[c]=d[0],x[c]=d[1],m[c]=d[2],i[c]=d[3];n.mask=i}return n.pixels=[p,x,m],n.statistics=null,n.pixelType="u8",n.maskIsAlpha=f,n}function c(t,n){if(!r(t))return null;const{pixels:l,mask:i}=t,o=l.length;let s=n.lut;const{offset:a}=n;s&&1===s[0].length&&(s=l.map((()=>s)));const h=[],f=n.outputPixelType||"u8";for(let e=0;e<o;e++){const t=u(l[e],i,s[e],a||0,f);h.push(t)}const c=new e({width:t.width,height:t.height,pixels:h,mask:i,pixelType:f});return c.updateStatistics(),c}function u(t,n,l,i,o){const r=t.length,s=e.createEmptyBand(o,r);if(n)for(let e=0;e<r;e++)n[e]&&(s[e]=l[t[e]-i]);else for(let e=0;e<r;e++)s[e]=l[t[e]-i];return s}function p(t,e){if(!r(t))return null;const n=t.clone(),{pixels:l}=n,i=n.width*n.height,o=e.length,s=Math.floor(o/2),a=e[Math.floor(s)],h=l[0];let f,c,u,p,x,m,d=!1;const g=new Uint8Array(i),y=new Uint8Array(i),w=new Uint8Array(i);let k=n.mask;const M=4===e[0].mappedColor.length;for(k||(k=new Uint8Array(i),k.fill(M?255:1),n.mask=k),x=0;x<i;x++)if(k[x]){for(f=h[x],d=!1,m=s,c=a,u=0,p=o-1;p-u>1;){if(f===c.value){d=!0;break}f>c.value?u=m:p=m,m=Math.floor((u+p)/2),c=e[Math.floor(m)]}d||(f===e[u].value?(c=e[u],d=!0):f===e[p].value?(c=e[p],d=!0):f<e[u].value?(d=!1,c=null):f>e[u].value&&(f<e[p].value?(c=e[u],d=!0):p===o-1?(d=!1,c=null):(c=e[p],d=!0))),d?(g[x]=c.mappedColor[0],y[x]=c.mappedColor[1],w[x]=c.mappedColor[2],k[x]=c.mappedColor[3]):g[x]=y[x]=w[x]=k[x]=0}return n.pixels=[g,y,w],n.mask=k,n.pixelType="u8",n.maskIsAlpha=M,n}function x(e,n,l=!1){const i=1e-5,r=new Float32Array(3*o),s=n.length;for(let a=0;a<o;a++)r[3*a]=e[2*a]??t-1,r[3*a+1]=e[2*a+1]??t,r[3*a+2]=n[a]??0,a<s&&(a>0&&(r[3*a]-=i),(a<s-1||!l)&&(r[3*a+1]-=i));return r}function m(t,l){if(!r(t))return null;const{width:i,height:o}=t,{inputRanges:s,outputValues:a,outputPixelType:h,noDataRanges:f,allowUnmatched:c,replacementValue:u,isLastInputRangeInclusive:p}=l,x=t.pixels[0],m=e.createEmptyBand(h,x.length),d=t.mask,g=new Uint8Array(i*o);d?g.set(d):g.fill(255);const y=t.pixelType.startsWith("f")?1e-6:0,w=s.map((t=>t-y));w[0]=s[0],w[w.length-1]=s[s.length-1]+(p?1e-6:0);const k=s.length/2,[M,A]=n(h);for(let e=0;e<o;e++)for(let t=0;t<i;t++){const n=e*i+t;if(g[n]){const t=x[n];let e=!1;for(let l=k-1;l>=0;l--)if(t===w[2*l]||t>w[2*l]&&t<w[2*l+1]){m[n]=a[l],e=!0;break}e||(c?m[n]=t>A?A:t<M?M:u??t:g[n]=0)}}const U=f?.length;if(U)for(let e=0;e<o;e++)for(let t=0;t<i;t++){const n=e*i+t;if(!d||d[n]){const t=x[n];for(let e=0;e<U;e+=2)if(t>=f[e]&&t<=f[e+1]){m[n]=0,g[n]=0;break}}}return new e({width:i,height:o,pixelType:h,pixels:[m],mask:g})}function d(t,e,n,l){const i=null!=n&&n.length>=2?new Set(n):null,o=1===n?.length?n[0]:null,r=!!e?.length;for(let s=0;s<t.length;s++)if(l[s]){const n=t[s];if(r){let t=!1;for(let l=0;l<e.length;l+=2)if(n>=e[l]&&n<=e[l+1]){t=!0;break}t||(l[s]=0)}l[s]&&(n===o||i?.has(n))&&(l[s]=0)}}function g(t,e){const n=t[0].length;for(let l=0;l<n;l++)if(e[l]){let n=!1;for(let e=0;e<t.length;e++)if(t[e][l]){n=!0;break}n||(e[l]=0)}}function y(t,e){const n=t[0].length;for(let l=0;l<n;l++)if(e[l]){let n=!1;for(let e=0;e<t.length;e++)if(0===t[e][l]){n=!0;break}n&&(e[l]=0)}}function w(t,n){if(!r(t))return null;const{width:l,height:i,pixels:o}=t,s=l*i,a=new Uint8Array(s);t.mask?a.set(t.mask):a.fill(255);const h=o.length,{includedRanges:f,noDataValues:c,outputPixelType:p,matchAll:x,lookups:m}=n;if(m){const t=[];for(let e=0;e<h;e++){const n=m[e],l=u(o[e],a,n.lut,n.offset||0,"u8");t.push(l)}1===t.length?a.set(t[0]):x?g(t,a):y(t,a)}else if(x){const t=[];for(let e=0;e<h;e++){const n=new Uint8Array(s);n.set(a),d(o[e],f?.slice(2*e,2*e+2),c?.[e],n),t.push(n)}1===t.length?a.set(t[0]):g(t,a)}else for(let e=0;e<h;e++)d(o[e],f?.slice(2*e,2*e+2),c?.[e],a);return new e({width:l,height:i,pixelType:p,pixels:o,mask:a})}function k(t){const{srcPixelType:l,inputRanges:i,outputValues:o,allowUnmatched:r,noDataRanges:s,isLastInputRangeInclusive:a,outputPixelType:h}=t;if("u8"!==l&&"s8"!==l&&"u16"!==l&&"s16"!==l)return null;const f=l.includes("16")?65536:256,c=l.includes("s")?-f/2:0,u=e.createEmptyBand(h,f),p=new Uint8Array(f);r&&p.fill(255);const[x,m]=n(h);if(i?.length&&o?.length){const t=1e-6,e=i.map((e=>e-t));e[0]=i[0],a&&(e[e.length-1]=i[i.length-1]);for(let n=0;n<e.length;n++){const t=o[n]>m?m:o[n]<x?x:o[n],l=Math.ceil(e[2*n]-c),i=Math.floor(e[2*n+1]-c);for(let e=l;e<=i;e++)u[e]=t,p[e]=255}}if(s?.length)for(let e=0;e<s.length;e++){const t=Math.ceil(s[2*e]-c),n=Math.floor(s[2*e+1]-c);for(let e=t;e<=n;e++)p[e]=0}return{lut:u,offset:c,mask:p}}function M(t,e,n){if("u8"!==t&&"s8"!==t&&"u16"!==t&&"s16"!==t)return null;const l=t.includes("16")?65536:256,i=t.includes("s")?-l/2:0,o=new Uint8Array(l);if(e)for(let r=0;r<e.length;r++){const t=Math.ceil(e[2*r]-i),n=Math.floor(e[2*r+1]-i);for(let e=t;e<=n;e++)o[e]=255}else o.fill(255);if(n)for(let r=0;r<n.length;r++)o[n[r]-i]=0;return{lut:o,offset:i}}function A(t,e,n,l,i,o,r,s){return{xmin:i<=n*t?0:i<n*t+t?i-n*t:t,ymin:o<=l*e?0:o<l*e+e?o-l*e:e,xmax:i+r<=n*t?0:i+r<n*t+t?i+r-n*t:t,ymax:o+s<=l*e?0:o+s<l*e+e?o+s-l*e:e}}function U(t,e){if(!t||0===t.length)return null;const n=t.find((t=>t.pixelBlock));if(null==n?.pixelBlock)return null;const l=(n.extent.xmax-n.extent.xmin)/n.pixelBlock.width,i=(n.extent.ymax-n.extent.ymin)/n.pixelBlock.height,o=.01*Math.min(l,i),r=t.sort(((t,e)=>Math.abs(t.extent.ymax-e.extent.ymax)>o?e.extent.ymax-t.extent.ymax:Math.abs(t.extent.xmin-e.extent.xmin)>o?t.extent.xmin-e.extent.xmin:0)),s=Math.min.apply(null,r.map((t=>t.extent.xmin))),a=Math.min.apply(null,r.map((t=>t.extent.ymin))),h=Math.max.apply(null,r.map((t=>t.extent.xmax))),f=Math.max.apply(null,r.map((t=>t.extent.ymax))),c={x:Math.round((e.xmin-s)/l),y:Math.round((f-e.ymax)/i)},u={width:Math.round((h-s)/l),height:Math.round((f-a)/i)},p={width:Math.round((e.xmax-e.xmin)/l),height:Math.round((e.ymax-e.ymin)/i)};if(Math.round(u.width/n.pixelBlock.width)*Math.round(u.height/n.pixelBlock.height)!==r.length||c.x<0||c.y<0||u.width<p.width||u.height<p.height)return null;return{extent:e,pixelBlock:T(r.map((t=>t.pixelBlock)),u,{clipOffset:c,clipSize:p})}}function b(t,e,n,l,i,o){const{width:r,height:s}=n.block,{x:a,y:h}=n.offset,{width:f,height:c}=n.mosaic,u=A(r,s,l,i,a,h,f,c);let p=0,x=0;if(o){const t=o.hasGCSSShiftTransform?360:o.halfWorldWidth??0,e=r*o.resolutionX,n=o.startX+l*e;n<t&&n+e>t?x=o.rightPadding:n>=t&&(p=o.leftMargin-o.rightPadding,x=0)}if(u.xmax-=x,"number"!=typeof e)for(let m=u.ymin;m<u.ymax;m++){const n=(i*s+m-h)*f+(l*r-a)+p,o=m*r;for(let l=u.xmin;l<u.xmax;l++)t[n+l]=e[o+l]}else for(let m=u.ymin;m<u.ymax;m++){const n=(i*s+m-h)*f+(l*r-a)+p;for(let l=u.xmin;l<u.xmax;l++)t[n+l]=e}}function T(t,n,l={}){const{clipOffset:i,clipSize:o,alignmentInfo:s,blockWidths:a}=l;if(a)return v(t,n,{blockWidths:a});const h=t.find((t=>r(t)));if(null==h)return null;const f=o?o.width:n.width,c=o?o.height:n.height,u=h.width,p=h.height,x=n.width/u,m=n.height/p,d={offset:i||{x:0,y:0},mosaic:o||n,block:{width:u,height:p}},g=h.pixelType,y=e.getPixelArrayConstructor(g),w=h.pixels.length,k=[];let M,A;for(let e=0;e<w;e++){A=new y(f*c);for(let n=0;n<m;n++)for(let l=0;l<x;l++){const i=t[n*x+l];r(i)&&(M=i.pixels[e],b(A,M,d,l,n,s))}k.push(A)}const U=t.some((t=>null==t||null!=t.mask&&t.mask.length>0)),T=t.some((t=>t?.bandMasks&&t.bandMasks.length>1)),B=U?new Uint8Array(f*c):void 0,C=T?[]:void 0;if(B){for(let e=0;e<m;e++)for(let n=0;n<x;n++){const l=t[e*x+n],i=null!=l?l.mask:null;b(B,null!=i?i:l?255:0,d,n,e,s)}if(C)for(let e=0;e<w;e++){const n=new Uint8Array(f*c);for(let l=0;l<m;l++)for(let i=0;i<x;i++){const o=t[l*x+i],r=o?.bandMasks?.[e]??o?.mask;b(n,null!=r?r:o?255:0,d,i,l,s)}C.push(n)}}const S=new e({width:f,height:c,pixels:k,pixelType:g,bandMasks:C,mask:B});return S.updateStatistics(),S}function v(t,n,l){const i=t.find((t=>null!=t));if(null==i)return null;const o=t.some((t=>null==t||!!t.mask)),{width:s,height:a}=n,h=o?new Uint8Array(s*a):null,{blockWidths:f}=l,c=[],u=i.getPlaneCount(),p=e.getPixelArrayConstructor(i.pixelType);if(o)for(let e=0,y=0;e<t.length;y+=f[e],e++){const n=t[e];if(!r(n))continue;const l=n.mask;for(let t=0;t<a;t++)for(let i=0;i<f[e];i++)h[t*s+i+y]=null==l?255:l[t*n.width+i]}const x=t.some((t=>t?.bandMasks&&t.bandMasks.length>1)),m=x?[]:void 0,d=s*a;for(let e=0;e<u;e++){const n=new p(d),l=x?new Uint8Array(d):void 0;for(let i=0,o=0;i<t.length;o+=f[i],i++){const h=t[i];if(!r(h))continue;const c=h.pixels[e];if(null!=c){for(let t=0;t<a;t++)for(let e=0;e<f[i];e++)n[t*s+e+o]=c[t*h.width+e];if(l){const t=h.bandMasks?.[e]??h.mask;for(let e=0;e<a;e++)for(let n=0;n<f[i];n++)l[e*s+n+o]=t?t[e*h.width+n]:255}}}c.push(n),m&&l&&m.push(l)}const g=new e({width:s,height:a,mask:h,bandMasks:m,pixels:c,pixelType:i.pixelType});return g.updateStatistics(),g}function B(t,e,n){if(!r(t))return null;const{width:l,height:i}=t,o=e.x,s=e.y,a=n.width+o,h=n.height+s;if(o<0||s<0||a>l||h>i)return t;if(0===o&&0===s&&a===l&&h===i)return t;t.mask||(t.mask=new Uint8Array(l*i));const f=t.mask;for(let r=0;r<i;r++){const t=r*l;for(let e=0;e<l;e++)f[t+e]=r<s||r>=h||e<o||e>=a?0:1}return t.updateStatistics(),t}function C(t){if(!r(t))return null;const e=t.clone(),{width:n,height:l,pixels:i}=t,o=i[0],s=e.pixels[0],a=t.mask;for(let r=2;r<l-1;r++){const t=new Map;for(let l=r-2;l<r+2;l++)for(let e=0;e<4;e++){const i=l*n+e;_(t,o[i],a?a[i]:1)}s[r*n]=S(t),s[r*n+1]=s[r*n+2]=s[r*n];let e=3;for(;e<n-1;e++){let l=(r-2)*n+e+1;_(t,o[l],a?a[l]:1),l=(r-1)*n+e+1,_(t,o[l],a?a[l]:1),l=r*n+e+1,_(t,o[l],a?a[l]:1),l=(r+1)*n+e+1,_(t,o[l],a?a[l]:1),l=(r-2)*n+e-3,P(t,o[l],a?a[l]:1),l=(r-1)*n+e-3,P(t,o[l],a?a[l]:1),l=r*n+e-3,P(t,o[l],a?a[l]:1),l=(r+1)*n+e-3,P(t,o[l],a?a[l]:1),s[r*n+e]=S(t)}s[r*n+e+1]=s[r*n+e]}for(let r=0;r<n;r++)s[r]=s[n+r]=s[2*n+r],s[(l-1)*n+r]=s[(l-2)*n+r];return e.updateStatistics(),e}function S(t){if(0===t.size)return 0;let e=0,n=-1,l=0;const i=t.keys();let o=i.next();for(;!o.done;)l=t.get(o.value),l>e&&(n=o.value,e=l),o=i.next();return n}function P(t,e,n){if(0===n)return;const l=t.get(e);1===l?t.delete(e):t.set(e,l-1)}function _(t,e,n){0!==n&&t.set(e,t.has(e)?t.get(e)+1:1)}function W(t,n,l){let{x:i,y:o}=n;const{width:s,height:a}=l;if(0===i&&0===o&&a===t.height&&s===t.width)return t;const{width:h,height:f}=t,c=Math.max(0,o),u=Math.max(0,i),p=Math.min(i+s,h),x=Math.min(o+a,f);if(p<0||x<0||!r(t))return null;i=Math.max(0,-i),o=Math.max(0,-o);const{pixels:m}=t,d=s*a,g=m.length,y=[];for(let r=0;r<g;r++){const n=m[r],l=e.createEmptyBand(t.pixelType,d);for(let t=c;t<x;t++){const e=t*h;let r=(t+o-c)*s+i;for(let t=u;t<p;t++)l[r++]=n[e+t]}y.push(l)}const w=new Uint8Array(d),k=t.mask;for(let e=c;e<x;e++){const t=e*h;let n=(e+o-c)*s+i;for(let e=u;e<p;e++)w[n++]=k?k[t+e]:1}const M=new e({width:l.width,height:l.height,pixelType:t.pixelType,pixels:y,mask:w});return M.updateStatistics(),M}function E(t,n=!0){if(!r(t))return null;const{pixels:l,width:i,height:o,mask:s,pixelType:a}=t,h=[],f=Math.round(i/2),c=Math.round(o/2),u=o-1,p=i-1;for(let r=0;r<l.length;r++){const t=l[r],s=e.createEmptyBand(a,f*c);let x=0;for(let e=0;e<o;e+=2)for(let l=0;l<i;l+=2){const o=t[e*i+l];if(n){const n=l===p?o:t[e*i+l+1],r=e===u?o:t[e*i+l+i],a=l===p?r:e===u?n:t[e*i+l+i+1];s[x++]=(o+n+r+a)/4}else s[x++]=o}h.push(s)}let x=null;if(null!=s){x=new Uint8Array(f*c);let t=0;for(let e=0;e<o;e+=2)for(let l=0;l<i;l+=2){const o=s[e*i+l];if(n){const n=l===p?o:s[e*i+l+1],r=e===u?o:s[e*i+l+i],a=l===p?r:e===u?n:s[e*i+l+i+1];x[t++]=o*n*r*a?1:0}else x[t++]=o}}return new e({width:f,height:c,pixelType:a,pixels:h,mask:x})}function I(t,e,n=0,l=!0){if(!r(t))return null;const{width:i,height:o}=e;let{width:s,height:a}=t;const h=new Map,f={x:0,y:0},c=1+n;let u=t;for(let r=0;r<c;r++){const t=Math.ceil(s/i),n=Math.ceil(a/o);for(let l=0;l<n;l++){f.y=l*o;for(let n=0;n<t;n++){f.x=n*i;const t=W(u,f,e);h.set(`${r}/${l}/${n}`,t)}}r<c-1&&(u=E(u,l)),s=Math.round(s/2),a=Math.round(a/2)}return h}function R(t){const{pixelBlock:e,tileSize:n,level:l,row:i,col:o,useBilinear:s}=t;if(!r(e))return null;const{width:a,height:h}=n,f=2**l,c=f*a,u=f*h;let p=W(e,{y:i*u,x:o*c},{width:c,height:u});if(!p)return null;for(let r=l;r>0;r--)p=E(p,s);return p}function F(t,e,n,l,i=0){const{width:o,height:r}=t,{width:s,height:a}=e,h=l.cols,f=l.rows,c=Math.ceil(s/h-.1/h),u=Math.ceil(a/f-.1/f);let p,x,m,d,g,y,w;const k=c*h,M=k*u*f,A=new Float32Array(M),U=new Float32Array(M),b=new Uint32Array(M),T=new Uint32Array(M);let v,B,C=0;for(let S=0;S<u;S++)for(let t=0;t<c;t++){p=12*(S*c+t),x=n[p],m=n[p+1],d=n[p+2],g=n[p+3],y=n[p+4],w=n[p+5];for(let e=0;e<f;e++){C=(S*f+e)*k+t*h,B=(e+.5)/f;for(let t=0;t<e;t++)v=(t+.5)/h,A[C+t]=(x*v+m*B+d)*o+i,U[C+t]=(g*v+y*B+w)*r+i,b[C+t]=Math.floor(A[C+t]),T[C+t]=Math.floor(U[C+t])}p+=6,x=n[p],m=n[p+1],d=n[p+2],g=n[p+3],y=n[p+4],w=n[p+5];for(let e=0;e<f;e++){C=(S*f+e)*k+t*h,B=(e+.5)/f;for(let t=e;t<h;t++)v=(t+.5)/h,A[C+t]=(x*v+m*B+d)*o+i,U[C+t]=(g*v+y*B+w)*r+i,b[C+t]=Math.floor(A[C+t]),T[C+t]=Math.floor(U[C+t])}}return{offsets_x:A,offsets_y:U,offsets_xi:b,offsets_yi:T,gridWidth:k}}function j(t,e){const{coefficients:n,spacing:l}=e,{offsets_x:i,offsets_y:o,gridWidth:r}=F(t,t,n,{rows:l[0],cols:l[1]}),{width:s,height:a}=t,h=new Float32Array(s*a),f=180/Math.PI;for(let c=0;c<a;c++)for(let t=0;t<s;t++){const e=c*r+t,n=0===c?e:e-r,l=c===a-1?e:e+r,u=i[n]-i[l],p=o[l]-o[n];if(isNaN(u)||isNaN(p))h[c*s+t]=90;else{let e=Math.atan2(p,u)*f;e=(360+e)%360,h[c*s+t]=e}}return h}function D(t,n,l,i,o="nearest"){if(!r(t))return null;"majority"===o&&(t=C(t));const{pixels:s,mask:a,bandMasks:h,pixelType:f}=t,c=t.width,u=t.height,p=e.getPixelArrayConstructor(f),x=s.length,{width:m,height:d}=n;let g=!1;for(let e=0;e<l.length;e+=3)-1===l[e]&&-1===l[e+1]&&-1===l[e+2]&&(g=!0);const{offsets_x:y,offsets_y:w,offsets_xi:k,offsets_yi:M,gridWidth:A}=F({width:c,height:u},n,l,i,"majority"===o?.5:0);let U;const b=(t,e,n,l)=>{const i=t instanceof Float32Array||t instanceof Float64Array?0:.5;for(let o=0;o<d;o++){U=o*A;for(let r=0;r<m;r++){if(y[U]<0||w[U]<0)t[o*m+r]=0;else if(l)t[o*m+r]=e[k[U]+M[U]*c];else{const l=Math.floor(y[U]),s=Math.floor(w[U]),a=Math.ceil(y[U]),h=Math.ceil(w[U]),f=y[U]-l,u=w[U]-s;if(!n||n[l+s*c]&&n[a+s*c]&&n[l+h*c]&&n[a+h*c]){const n=(1-f)*e[l+s*c]+f*e[a+s*c],p=(1-f)*e[l+h*c]+f*e[a+h*c];t[o*m+r]=(1-u)*n+u*p+i}else t[o*m+r]=e[k[U]+M[U]*c]}U++}}},T=[];let v;const B=h?.length===x,S=[];for(let e=0;e<x;e++){if(B){const t=new Uint8Array(m*d);b(t,h[e],h[e],!0),S.push(t)}v=new p(m*d),b(v,s[e],B?h[e]:a,"nearest"===o||"majority"===o),T.push(v)}const P=new e({width:m,height:d,pixelType:f,pixels:T,bandMasks:B?S:void 0});if(null!=a)P.mask=new Uint8Array(m*d),b(P.mask,a,a,!0);else if(g){P.mask=new Uint8Array(m*d);for(let t=0;t<m*d;t++)P.mask[t]=y[t]<0||w[t]<0?0:1}return P.updateStatistics(),P}export{i as MissingBandAction,l as NoDataInterpretation,D as approximateTransform,W as clip,R as clipTile,f as colorize,a as compositeBands,h as createColormapLUT,M as createMaskLUT,x as createRangeMaps,k as createRemapLUT,s as extractBands,A as getClipBounds,j as getLocalArithmeticNorthRotations,F as interpolateOffsets,r as isValidPixelBlock,u as lookupBandValues,c as lookupPixels,w as mask,o as maxMapSizeGpu,T as mosaic,U as mosaicPixelData,m as remap,p as remapColor,C as resampleByMajority,B as setValidBoundary,I as split};
5
+ import{numberMaxFloat32 as t}from"../../../core/mathUtils.js";import e from"../PixelBlock.js";import{getPixelValueRange as n}from"../rasterFormats/pixelRangeUtils.js";var l,i;!function(t){t[t.matchAny=0]="matchAny",t[t.matchAll=1]="matchAll"}(l||(l={})),function(t){t[t.bestMatch=0]="bestMatch",t[t.fail=1]="fail"}(i||(i={}));const o=9;function r(t){return null!=t&&t.pixels?.length>0}function s(t,e){return e?.length&&r(t)?t.extractBands(e):t}function a(t){if(!t?.length||t.some((t=>!r(t))))return null;if(1===t.length)return t[0]?.clone()??null;const n=t,{width:l,height:i,pixelType:o}=n[0];if(n.some((t=>t.width!==l||t.height!==i)))return null;const s=n.map((({mask:t})=>t)).filter((t=>null!=t));let a=null;s.length&&(a=new Uint8Array(l*i),a.set(s[0]),s.length>1&&y(s.slice(1),a));const h=[];n.forEach((({pixels:t})=>h.push(...t)));const f=n.map((({statistics:t})=>t)).filter((t=>t?.length)),c=[];return f.forEach((t=>c.push(...t))),new e({pixelType:o,width:l,height:i,mask:a,pixels:h,statistics:c.length?c:null})}function h(t){if(!t)return;const e=t.colormap;if(!e||0===e.length)return;const n=e.sort(((t,e)=>t[0]-e[0])),l=n[0][0]<0?n[0][0]:0,i=Math.max(256,n[n.length-1][0]-l+1),o=new Uint8Array(4*i),r=[],s=5===n[0].length;if(i>65536)return n.forEach((t=>{r[t[0]-l]=s?t.slice(1):t.slice(1).concat([255])})),{indexed2DColormap:r,offset:l,alphaSpecified:s};if(t.fillUnspecified){let t=n[0];for(let e=t[0]-l,r=0;e<i;e++)o[4*e]=t[1],o[4*e+1]=t[2],o[4*e+2]=t[3],o[4*e+3]=s?t[4]:255,e===t[0]-l&&(t=r===n.length-1?t:n[++r])}else for(let a=0;a<n.length;a++){const t=n[a],e=4*(t[0]-l);o[e]=t[1],o[e+1]=t[2],o[e+2]=t[3],o[e+3]=s?t[4]:255}return{indexedColormap:o,offset:l,alphaSpecified:s}}function f(t,e){if(!r(t))return t;if(!e||!e.indexedColormap&&!e.indexed2DColormap)return t;const n=t.clone(),l=n.pixels;let i=n.mask;const o=n.width*n.height;if(1!==l.length)return t;const{indexedColormap:s,indexed2DColormap:a,offset:h,alphaSpecified:f}=e,c=l[0],u=new Uint8Array(c.length),p=new Uint8Array(c.length),x=new Uint8Array(c.length);let m,d=0;if(s){const t=s.length-1;if(null!=i)for(let e=0;e<o;e++)i[e]&&(d=4*(c[e]-h),d<h||d>t?i[e]=0:(u[e]=s[d],p[e]=s[d+1],x[e]=s[d+2],i[e]=s[d+3]));else{i=new Uint8Array(o);for(let e=0;e<o;e++)d=4*(c[e]-h),d<h||d>t?i[e]=0:(u[e]=s[d],p[e]=s[d+1],x[e]=s[d+2],i[e]=s[d+3]);n.mask=i}}else if(a)if(null!=i)for(let r=0;r<o;r++)i[r]&&(m=a[c[r]],u[r]=m[0],p[r]=m[1],x[r]=m[2],i[r]=m[3]);else{i=new Uint8Array(o);for(let t=0;t<o;t++)m=a[c[t]],u[t]=m[0],p[t]=m[1],x[t]=m[2],i[t]=m[3];n.mask=i}return n.pixels=[u,p,x],n.statistics=null,n.pixelType="u8",n.maskIsAlpha=f,n}function c(t,n){if(!r(t))return null;const{pixels:l,mask:i}=t,o=l.length;let s=n.lut;const{offset:a}=n;s&&1===s[0].length&&(s=l.map((()=>s)));const h=[],f=n.outputPixelType||"u8";for(let e=0;e<o;e++){const t=u(l[e],i,s[e],a||0,f);h.push(t)}const c=new e({width:t.width,height:t.height,pixels:h,mask:i,pixelType:f});return c.updateStatistics(),c}function u(t,n,l,i,o){const r=t.length,s=e.createEmptyBand(o,r);if(n)for(let e=0;e<r;e++)n[e]&&(s[e]=l[t[e]-i]);else for(let e=0;e<r;e++)s[e]=l[t[e]-i];return s}function p(t,e){if(!r(t))return null;const n=t.clone(),{pixels:l}=n,i=n.width*n.height,o=e.length,s=Math.floor(o/2),a=e[Math.floor(s)],h=l[0],f=new Uint8Array(i),c=new Uint8Array(i),u=new Uint8Array(i);let p=n.mask;const x=4===e[0].mappedColor.length;p||(p=new Uint8Array(i),p.fill(x?255:1),n.mask=p);for(let r=0;r<i;r++)if(p[r]){const t=h[r];let n=!1,l=s,i=a,x=0,m=o-1;for(;m-x>1;){if(t===i.value){n=!0;break}t>i.value?x=l:m=l,l=Math.floor((x+m)/2),i=e[Math.floor(l)]}n||(t===e[x].value?(i=e[x],n=!0):t===e[m].value?(i=e[m],n=!0):t<e[x].value?n=!1:t>e[x].value&&(t<e[m].value?(i=e[x],n=!0):m===o-1?n=!1:(i=e[m],n=!0))),n?(f[r]=i.mappedColor[0],c[r]=i.mappedColor[1],u[r]=i.mappedColor[2],p[r]=i.mappedColor[3]):f[r]=c[r]=u[r]=p[r]=0}return n.pixels=[f,c,u],n.mask=p,n.pixelType="u8",n.maskIsAlpha=x,n}function x(e,n,l=!1){const i=1e-5,r=new Float32Array(3*o),s=n.length;for(let a=0;a<o;a++)r[3*a]=e[2*a]??t-1,r[3*a+1]=e[2*a+1]??t,r[3*a+2]=n[a]??0,a<s&&(a>0&&(r[3*a]-=i),(a<s-1||!l)&&(r[3*a+1]-=i));return r}function m(t,l){if(!r(t))return null;const{width:i,height:o}=t,{inputRanges:s,outputValues:a,outputPixelType:h,noDataRanges:f,allowUnmatched:c,replacementValue:u,isLastInputRangeInclusive:p}=l,x=t.pixels[0],m=e.createEmptyBand(h,x.length),d=t.mask,g=new Uint8Array(i*o);d?g.set(d):g.fill(255);const y=t.pixelType.startsWith("f")?1e-6:0,w=s.map((t=>t-y));w[0]=s[0],w[w.length-1]=s[s.length-1]+(p?1e-6:0);const k=s.length/2,[M,A]=n(h);for(let e=0;e<o;e++)for(let t=0;t<i;t++){const n=e*i+t;if(g[n]){const t=x[n];let e=!1;for(let l=k-1;l>=0;l--)if(t===w[2*l]||t>w[2*l]&&t<w[2*l+1]){m[n]=a[l],e=!0;break}e||(c?m[n]=t>A?A:t<M?M:u??t:g[n]=0)}}const U=f?.length;if(U)for(let e=0;e<o;e++)for(let t=0;t<i;t++){const n=e*i+t;if(!d||d[n]){const t=x[n];for(let e=0;e<U;e+=2)if(t>=f[e]&&t<=f[e+1]){m[n]=0,g[n]=0;break}}}return new e({width:i,height:o,pixelType:h,pixels:[m],mask:g})}function d(t,e,n,l){const i=null!=n&&n.length>=2?new Set(n):null,o=1===n?.length?n[0]:null,r=!!e?.length;for(let s=0;s<t.length;s++)if(l[s]){const n=t[s];if(r){let t=!1;for(let l=0;l<e.length;l+=2)if(n>=e[l]&&n<=e[l+1]){t=!0;break}t||(l[s]=0)}l[s]&&(n===o||i?.has(n))&&(l[s]=0)}}function g(t,e){const n=t[0].length;for(let l=0;l<n;l++)if(e[l]){let n=!1;for(let e=0;e<t.length;e++)if(t[e][l]){n=!0;break}n||(e[l]=0)}}function y(t,e){const n=t[0].length;for(let l=0;l<n;l++)if(e[l]){let n=!1;for(let e=0;e<t.length;e++)if(0===t[e][l]){n=!0;break}n&&(e[l]=0)}}function w(t,n){if(!r(t))return null;const{width:l,height:i,pixels:o}=t,s=l*i,a=new Uint8Array(s);t.mask?a.set(t.mask):a.fill(255);const h=o.length,{includedRanges:f,noDataValues:c,outputPixelType:p,matchAll:x,lookups:m}=n;if(m){const t=[];for(let e=0;e<h;e++){const n=m[e],l=u(o[e],a,n.lut,n.offset||0,"u8");t.push(l)}1===t.length?a.set(t[0]):x?g(t,a):y(t,a)}else if(x){const t=[];for(let e=0;e<h;e++){const n=new Uint8Array(s);n.set(a),d(o[e],f?.slice(2*e,2*e+2),c?.[e],n),t.push(n)}1===t.length?a.set(t[0]):g(t,a)}else for(let e=0;e<h;e++)d(o[e],f?.slice(2*e,2*e+2),c?.[e],a);return new e({width:l,height:i,pixelType:p,pixels:o,mask:a})}function k(t){const{srcPixelType:l,inputRanges:i,outputValues:o,allowUnmatched:r,noDataRanges:s,isLastInputRangeInclusive:a,outputPixelType:h}=t;if("u8"!==l&&"s8"!==l&&"u16"!==l&&"s16"!==l)return null;const f=l.includes("16")?65536:256,c=l.includes("s")?-f/2:0,u=e.createEmptyBand(h,f),p=new Uint8Array(f);r&&p.fill(255);const[x,m]=n(h);if(i?.length&&o?.length){const t=1e-6,e=i.map((e=>e-t));e[0]=i[0],a&&(e[e.length-1]=i[i.length-1]);for(let n=0;n<e.length;n++){const t=o[n]>m?m:o[n]<x?x:o[n],l=Math.ceil(e[2*n]-c),i=Math.floor(e[2*n+1]-c);for(let e=l;e<=i;e++)u[e]=t,p[e]=255}}if(s?.length)for(let e=0;e<s.length;e++){const t=Math.ceil(s[2*e]-c),n=Math.floor(s[2*e+1]-c);for(let e=t;e<=n;e++)p[e]=0}return{lut:u,offset:c,mask:p}}function M(t,e,n){if("u8"!==t&&"s8"!==t&&"u16"!==t&&"s16"!==t)return null;const l=t.includes("16")?65536:256,i=t.includes("s")?-l/2:0,o=new Uint8Array(l);if(e)for(let r=0;r<e.length;r++){const t=Math.ceil(e[2*r]-i),n=Math.floor(e[2*r+1]-i);for(let e=t;e<=n;e++)o[e]=255}else o.fill(255);if(n)for(let r=0;r<n.length;r++)o[n[r]-i]=0;return{lut:o,offset:i}}function A(t,e,n,l,i,o,r,s){return{xmin:i<=n*t?0:i<n*t+t?i-n*t:t,ymin:o<=l*e?0:o<l*e+e?o-l*e:e,xmax:i+r<=n*t?0:i+r<n*t+t?i+r-n*t:t,ymax:o+s<=l*e?0:o+s<l*e+e?o+s-l*e:e}}function U(t,e){if(!t||0===t.length)return null;const n=t.find((t=>t.pixelBlock));if(null==n?.pixelBlock)return null;const l=(n.extent.xmax-n.extent.xmin)/n.pixelBlock.width,i=(n.extent.ymax-n.extent.ymin)/n.pixelBlock.height,o=.01*Math.min(l,i),r=t.sort(((t,e)=>Math.abs(t.extent.ymax-e.extent.ymax)>o?e.extent.ymax-t.extent.ymax:Math.abs(t.extent.xmin-e.extent.xmin)>o?t.extent.xmin-e.extent.xmin:0)),s=Math.min.apply(null,r.map((t=>t.extent.xmin))),a=Math.min.apply(null,r.map((t=>t.extent.ymin))),h=Math.max.apply(null,r.map((t=>t.extent.xmax))),f=Math.max.apply(null,r.map((t=>t.extent.ymax))),c={x:Math.round((e.xmin-s)/l),y:Math.round((f-e.ymax)/i)},u={width:Math.round((h-s)/l),height:Math.round((f-a)/i)},p={width:Math.round((e.xmax-e.xmin)/l),height:Math.round((e.ymax-e.ymin)/i)};if(Math.round(u.width/n.pixelBlock.width)*Math.round(u.height/n.pixelBlock.height)!==r.length||c.x<0||c.y<0||u.width<p.width||u.height<p.height)return null;return{extent:e,pixelBlock:T(r.map((t=>t.pixelBlock)),u,{clipOffset:c,clipSize:p})}}function b(t,e,n,l,i,o){const{width:r,height:s}=n.block,{x:a,y:h}=n.offset,{width:f,height:c}=n.mosaic,u=A(r,s,l,i,a,h,f,c);let p=0,x=0;if(o){const t=o.hasGCSSShiftTransform?360:o.halfWorldWidth??0,e=r*o.resolutionX,n=o.startX+l*e;n<t&&n+e>t?x=o.rightPadding:n>=t&&(p=o.leftMargin-o.rightPadding,x=0)}if(u.xmax-=x,"number"!=typeof e)for(let m=u.ymin;m<u.ymax;m++){const n=(i*s+m-h)*f+(l*r-a)+p,o=m*r;for(let l=u.xmin;l<u.xmax;l++)t[n+l]=e[o+l]}else for(let m=u.ymin;m<u.ymax;m++){const n=(i*s+m-h)*f+(l*r-a)+p;for(let l=u.xmin;l<u.xmax;l++)t[n+l]=e}}function T(t,n,l={}){const{clipOffset:i,clipSize:o,alignmentInfo:s,blockWidths:a}=l;if(a)return v(t,n,{blockWidths:a});const h=t.find((t=>r(t)));if(null==h)return null;const f=o?o.width:n.width,c=o?o.height:n.height,u=h.width,p=h.height,x=n.width/u,m=n.height/p,d={offset:i||{x:0,y:0},mosaic:o||n,block:{width:u,height:p}},g=h.pixelType,y=e.getPixelArrayConstructor(g),w=h.pixels.length,k=[];let M,A;for(let e=0;e<w;e++){A=new y(f*c);for(let n=0;n<m;n++)for(let l=0;l<x;l++){const i=t[n*x+l];r(i)&&(M=i.pixels[e],b(A,M,d,l,n,s))}k.push(A)}const U=t.some((t=>null==t||null!=t.mask&&t.mask.length>0)),T=t.some((t=>t?.bandMasks&&t.bandMasks.length>1)),B=U?new Uint8Array(f*c):void 0,S=T?[]:void 0;if(B){for(let e=0;e<m;e++)for(let n=0;n<x;n++){const l=t[e*x+n],i=null!=l?l.mask:null;b(B,null!=i?i:l?255:0,d,n,e,s)}if(S)for(let e=0;e<w;e++){const n=new Uint8Array(f*c);for(let l=0;l<m;l++)for(let i=0;i<x;i++){const o=t[l*x+i],r=o?.bandMasks?.[e]??o?.mask;b(n,null!=r?r:o?255:0,d,i,l,s)}S.push(n)}}const C=new e({width:f,height:c,pixels:k,pixelType:g,bandMasks:S,mask:B});return C.updateStatistics(),C}function v(t,n,l){const i=t.find((t=>null!=t));if(null==i)return null;const o=t.some((t=>null==t||!!t.mask)),{width:s,height:a}=n,h=o?new Uint8Array(s*a):null,{blockWidths:f}=l,c=[],u=i.getPlaneCount(),p=e.getPixelArrayConstructor(i.pixelType);if(o)for(let e=0,y=0;e<t.length;y+=f[e],e++){const n=t[e];if(!r(n))continue;const l=n.mask;for(let t=0;t<a;t++)for(let i=0;i<f[e];i++)h[t*s+i+y]=null==l?255:l[t*n.width+i]}const x=t.some((t=>t?.bandMasks&&t.bandMasks.length>1)),m=x?[]:void 0,d=s*a;for(let e=0;e<u;e++){const n=new p(d),l=x?new Uint8Array(d):void 0;for(let i=0,o=0;i<t.length;o+=f[i],i++){const h=t[i];if(!r(h))continue;const c=h.pixels[e];if(null!=c){for(let t=0;t<a;t++)for(let e=0;e<f[i];e++)n[t*s+e+o]=c[t*h.width+e];if(l){const t=h.bandMasks?.[e]??h.mask;for(let e=0;e<a;e++)for(let n=0;n<f[i];n++)l[e*s+n+o]=t?t[e*h.width+n]:255}}}c.push(n),m&&l&&m.push(l)}const g=new e({width:s,height:a,mask:h,bandMasks:m,pixels:c,pixelType:i.pixelType});return g.updateStatistics(),g}function B(t,e,n){if(!r(t))return null;const{width:l,height:i}=t,o=e.x,s=e.y,a=n.width+o,h=n.height+s;if(o<0||s<0||a>l||h>i)return t;if(0===o&&0===s&&a===l&&h===i)return t;t.mask||(t.mask=new Uint8Array(l*i));const f=t.mask;for(let r=0;r<i;r++){const t=r*l;for(let e=0;e<l;e++)f[t+e]=r<s||r>=h||e<o||e>=a?0:1}return t.updateStatistics(),t}function S(t){if(!r(t))return null;const e=t.clone(),{width:n,height:l,pixels:i}=t,o=i[0],s=e.pixels[0],a=t.mask;for(let r=2;r<l-1;r++){const t=new Map;for(let l=r-2;l<r+2;l++)for(let e=0;e<4;e++){const i=l*n+e;_(t,o[i],a?a[i]:1)}s[r*n]=C(t),s[r*n+1]=s[r*n+2]=s[r*n];let e=3;for(;e<n-1;e++){let l=(r-2)*n+e+1;_(t,o[l],a?a[l]:1),l=(r-1)*n+e+1,_(t,o[l],a?a[l]:1),l=r*n+e+1,_(t,o[l],a?a[l]:1),l=(r+1)*n+e+1,_(t,o[l],a?a[l]:1),l=(r-2)*n+e-3,P(t,o[l],a?a[l]:1),l=(r-1)*n+e-3,P(t,o[l],a?a[l]:1),l=r*n+e-3,P(t,o[l],a?a[l]:1),l=(r+1)*n+e-3,P(t,o[l],a?a[l]:1),s[r*n+e]=C(t)}s[r*n+e+1]=s[r*n+e]}for(let r=0;r<n;r++)s[r]=s[n+r]=s[2*n+r],s[(l-1)*n+r]=s[(l-2)*n+r];return e.updateStatistics(),e}function C(t){if(0===t.size)return 0;let e=0,n=-1,l=0;const i=t.keys();let o=i.next();for(;!o.done;)l=t.get(o.value),l>e&&(n=o.value,e=l),o=i.next();return n}function P(t,e,n){if(0===n)return;const l=t.get(e);1===l?t.delete(e):t.set(e,l-1)}function _(t,e,n){0!==n&&t.set(e,t.has(e)?t.get(e)+1:1)}function W(t,n,l){let{x:i,y:o}=n;const{width:s,height:a}=l;if(0===i&&0===o&&a===t.height&&s===t.width)return t;const{width:h,height:f}=t,c=Math.max(0,o),u=Math.max(0,i),p=Math.min(i+s,h),x=Math.min(o+a,f);if(p<0||x<0||!r(t))return null;i=Math.max(0,-i),o=Math.max(0,-o);const{pixels:m}=t,d=s*a,g=m.length,y=[];for(let r=0;r<g;r++){const n=m[r],l=e.createEmptyBand(t.pixelType,d);for(let t=c;t<x;t++){const e=t*h;let r=(t+o-c)*s+i;for(let t=u;t<p;t++)l[r++]=n[e+t]}y.push(l)}const w=new Uint8Array(d),k=t.mask;for(let e=c;e<x;e++){const t=e*h;let n=(e+o-c)*s+i;for(let e=u;e<p;e++)w[n++]=k?k[t+e]:1}const M=new e({width:l.width,height:l.height,pixelType:t.pixelType,pixels:y,mask:w});return M.updateStatistics(),M}function E(t,n=!0){if(!r(t))return null;const{pixels:l,width:i,height:o,mask:s,pixelType:a}=t,h=[],f=Math.round(i/2),c=Math.round(o/2),u=o-1,p=i-1;for(let r=0;r<l.length;r++){const t=l[r],s=e.createEmptyBand(a,f*c);let x=0;for(let e=0;e<o;e+=2)for(let l=0;l<i;l+=2){const o=t[e*i+l];if(n){const n=l===p?o:t[e*i+l+1],r=e===u?o:t[e*i+l+i],a=l===p?r:e===u?n:t[e*i+l+i+1];s[x++]=(o+n+r+a)/4}else s[x++]=o}h.push(s)}let x=null;if(null!=s){x=new Uint8Array(f*c);let t=0;for(let e=0;e<o;e+=2)for(let l=0;l<i;l+=2){const o=s[e*i+l];if(n){const n=l===p?o:s[e*i+l+1],r=e===u?o:s[e*i+l+i],a=l===p?r:e===u?n:s[e*i+l+i+1];x[t++]=o*n*r*a?1:0}else x[t++]=o}}return new e({width:f,height:c,pixelType:a,pixels:h,mask:x})}function I(t,e,n=0,l=!0){if(!r(t))return null;const{width:i,height:o}=e;let{width:s,height:a}=t;const h=new Map,f={x:0,y:0},c=1+n;let u=t;for(let r=0;r<c;r++){const t=Math.ceil(s/i),n=Math.ceil(a/o);for(let l=0;l<n;l++){f.y=l*o;for(let n=0;n<t;n++){f.x=n*i;const t=W(u,f,e);h.set(`${r}/${l}/${n}`,t)}}r<c-1&&(u=E(u,l)),s=Math.round(s/2),a=Math.round(a/2)}return h}function R(t){const{pixelBlock:e,tileSize:n,level:l,row:i,col:o,useBilinear:s}=t;if(!r(e))return null;const{width:a,height:h}=n,f=2**l,c=f*a,u=f*h;let p=W(e,{y:i*u,x:o*c},{width:c,height:u});if(!p)return null;for(let r=l;r>0;r--)p=E(p,s);return p}function F(t,e,n,l,i=0){const{width:o,height:r}=t,{width:s,height:a}=e,h=l.cols,f=l.rows,c=Math.ceil(s/h-.1/h),u=Math.ceil(a/f-.1/f);let p,x,m,d,g,y,w;const k=c*h,M=k*u*f,A=new Float32Array(M),U=new Float32Array(M),b=new Uint32Array(M),T=new Uint32Array(M);let v,B,S=0;for(let C=0;C<u;C++)for(let t=0;t<c;t++){p=12*(C*c+t),x=n[p],m=n[p+1],d=n[p+2],g=n[p+3],y=n[p+4],w=n[p+5];for(let e=0;e<f;e++){S=(C*f+e)*k+t*h,B=(e+.5)/f;for(let t=0;t<e;t++)v=(t+.5)/h,A[S+t]=(x*v+m*B+d)*o+i,U[S+t]=(g*v+y*B+w)*r+i,b[S+t]=Math.floor(A[S+t]),T[S+t]=Math.floor(U[S+t])}p+=6,x=n[p],m=n[p+1],d=n[p+2],g=n[p+3],y=n[p+4],w=n[p+5];for(let e=0;e<f;e++){S=(C*f+e)*k+t*h,B=(e+.5)/f;for(let t=e;t<h;t++)v=(t+.5)/h,A[S+t]=(x*v+m*B+d)*o+i,U[S+t]=(g*v+y*B+w)*r+i,b[S+t]=Math.floor(A[S+t]),T[S+t]=Math.floor(U[S+t])}}return{offsets_x:A,offsets_y:U,offsets_xi:b,offsets_yi:T,gridWidth:k}}function j(t,e){const{coefficients:n,spacing:l}=e,{offsets_x:i,offsets_y:o,gridWidth:r}=F(t,t,n,{rows:l[0],cols:l[1]}),{width:s,height:a}=t,h=new Float32Array(s*a),f=180/Math.PI;for(let c=0;c<a;c++)for(let t=0;t<s;t++){const e=c*r+t,n=0===c?e:e-r,l=c===a-1?e:e+r,u=i[n]-i[l],p=o[l]-o[n];if(isNaN(u)||isNaN(p))h[c*s+t]=90;else{let e=Math.atan2(p,u)*f;e=(360+e)%360,h[c*s+t]=e}}return h}function D(t,n,l,i,o="nearest"){if(!r(t))return null;"majority"===o&&(t=S(t));const{pixels:s,mask:a,bandMasks:h,pixelType:f}=t,c=t.width,u=t.height,p=e.getPixelArrayConstructor(f),x=s.length,{width:m,height:d}=n;let g=!1;for(let e=0;e<l.length;e+=3)-1===l[e]&&-1===l[e+1]&&-1===l[e+2]&&(g=!0);const{offsets_x:y,offsets_y:w,offsets_xi:k,offsets_yi:M,gridWidth:A}=F({width:c,height:u},n,l,i,"majority"===o?.5:0);let U;const b=(t,e,n,l)=>{const i=t instanceof Float32Array||t instanceof Float64Array?0:.5;for(let o=0;o<d;o++){U=o*A;for(let r=0;r<m;r++){if(y[U]<0||w[U]<0)t[o*m+r]=0;else if(l)t[o*m+r]=e[k[U]+M[U]*c];else{const l=Math.floor(y[U]),s=Math.floor(w[U]),a=Math.ceil(y[U]),h=Math.ceil(w[U]),f=y[U]-l,u=w[U]-s;if(!n||n[l+s*c]&&n[a+s*c]&&n[l+h*c]&&n[a+h*c]){const n=(1-f)*e[l+s*c]+f*e[a+s*c],p=(1-f)*e[l+h*c]+f*e[a+h*c];t[o*m+r]=(1-u)*n+u*p+i}else t[o*m+r]=e[k[U]+M[U]*c]}U++}}},T=[];let v;const B=h?.length===x,C=[];for(let e=0;e<x;e++){if(B){const t=new Uint8Array(m*d);b(t,h[e],h[e],!0),C.push(t)}v=new p(m*d),b(v,s[e],B?h[e]:a,"nearest"===o||"majority"===o),T.push(v)}const P=new e({width:m,height:d,pixelType:f,pixels:T,bandMasks:B?C:void 0});if(null!=a)P.mask=new Uint8Array(m*d),b(P.mask,a,a,!0);else if(g){P.mask=new Uint8Array(m*d);for(let t=0;t<m*d;t++)P.mask[t]=y[t]<0||w[t]<0?0:1}return P.updateStatistics(),P}export{i as MissingBandAction,l as NoDataInterpretation,D as approximateTransform,W as clip,R as clipTile,f as colorize,a as compositeBands,h as createColormapLUT,M as createMaskLUT,x as createRangeMaps,k as createRemapLUT,s as extractBands,A as getClipBounds,j as getLocalArithmeticNorthRotations,F as interpolateOffsets,r as isValidPixelBlock,u as lookupBandValues,c as lookupPixels,w as mask,o as maxMapSizeGpu,T as mosaic,U as mosaicPixelData,m as remap,p as remapColor,S as resampleByMajority,B as setValidBoundary,I as split};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.33.0-next.20250318",
3
+ "version": "4.33.0-next.20250319",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -27,6 +27,7 @@
27
27
  "dependencies": {
28
28
  "@esri/arcgis-html-sanitizer": "~4.1.0",
29
29
  "@esri/calcite-components": "^3.0.3",
30
+ "@petamoriken/float16": "~3.9.2",
30
31
  "@vaadin/grid": "~24.6.6",
31
32
  "@zip.js/zip.js": "~2.7.57",
32
33
  "luxon": "~3.5.0",
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/JSONSupport.js";import r from"../../core/Logger.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import o from"../../layers/support/RasterInfo.js";import{colorize as n,remapColor as i,lookupPixels as l,createColormapLUT as u,isValidPixelBlock as c}from"../../layers/support/rasterFunctions/pixelUtils.js";import{stretch as p,getStretchCutoff as d,isStandardU8Histogram as h,createStretchLUT as m,computeGammaValues as f,createHistogramEqualizationLUT as y}from"../../layers/support/rasterFunctions/stretchUtils.js";import{hillshade as g,tintHillshade as b,calculateHillshadeParams as S}from"../../layers/support/rasterFunctions/surfaceUtils.js";import{convertColorRampToColormap as k,createHsvMap as x}from"./colorRampUtils.js";import{isUVRendererSupported as I,isColormapSupportedByWebGL as R,isColormapRendererSupported as C,isShadedReliefRendererSupported as L}from"./rasterRendererChecks.js";let _=class extends t{constructor(e){super(e)}bind(){const{rendererJSON:e}=this;if(!e)return{success:!1};let t;switch(this.lookup={rendererJSON:{}},e.type){case"uniqueValue":t=this._updateUVRenderer(e);break;case"rasterColormap":t=this._updateColormapRenderer(e);break;case"rasterStretch":t=this._updateStretchRenderer(e);break;case"classBreaks":t=this._updateClassBreaksRenderer(e);break;case"rasterShadedRelief":t=this._updateShadedReliefRenderer(e);break;case"vectorField":t=this._updateVectorFieldRenderer();break;case"flowRenderer":t=this._updateFlowRenderer()}return t}symbolize(e){let t=e?.pixelBlock;if(!T(t))return t;if(e.simpleStretchParams&&"rasterStretch"===this.rendererJSON.type)return this.simpleStretch(t,e.simpleStretchParams);try{let r;switch(t.pixels.length>3&&(t=t.extractBands(e.bandIds??[0,1,2])),this.rendererJSON.type){case"uniqueValue":case"rasterColormap":r=this._symbolizeColormap(t);break;case"classBreaks":r=this._symbolizeClassBreaks(t);break;case"rasterStretch":r=this._symbolizeStretch(t,e.bandIds);break;case"rasterShadedRelief":{const s=e.extent,a=s.spatialReference.isGeographic,o={x:(s.xmax-s.xmin)/t.width,y:(s.ymax-s.ymin)/t.height};r=this._symbolizeShadedRelief(t,{isGCS:a,resolution:o});break}}return r}catch(s){return r.getLogger(this).error("symbolize",s.message),t}}simpleStretch(e,t){if(!T(e))return e;try{return e.pixels.length>3&&(e=e.extractBands([0,1,2])),p(e,{...t,isRenderer:!0})}catch(s){return r.getLogger(this).error("symbolize",s.message),e}}generateWebGLParameters(e){if(["uniqueValue","rasterColormap","classBreaks"].includes(this.rendererJSON.type)){const{indexedColormap:e,offset:t}=this.lookup.colormapLut||{};return{colormap:e,colormapOffset:t,isClassBreaks:"classBreaks"===this.rendererJSON.type,type:"lut"}}const{pixelBlock:t,isGCS:r,resolution:s,bandIds:a}=e,{rendererJSON:o}=this;return"rasterStretch"===o.type?this._generateStretchWebGLParams(t,o,a):"rasterShadedRelief"===o.type?this._generateShadedReliefWebGLParams(o,r,s??void 0):"vectorField"===o.type?this._generateVectorFieldWebGLParams(o):null}_isLUTChanged(e){if(!this.lookup||!this.lookup.rendererJSON)return!0;if("colorRamp"in this.rendererJSON){const t=this.rendererJSON.colorRamp;return e?JSON.stringify(t)!==JSON.stringify(this.lookup.rendererJSON.colorRamp):(this.rendererJSON,this.lookup.rendererJSON,JSON.stringify(this.rendererJSON)!==JSON.stringify(this.lookup.rendererJSON))}return JSON.stringify(this.rendererJSON)!==JSON.stringify(this.lookup.rendererJSON)}_symbolizeColormap(e){if(this._isLUTChanged()){if(!this.bind().success)return e}return n(e,this.lookup.colormapLut)}_symbolizeClassBreaks(e){const{canUseIndexedLUT:t}=this._analyzeClassBreaks(this.rendererJSON);if(this._isLUTChanged()){if(!this.bind().success)return e}return t?n(e,this.lookup.colormapLut):i(e,this.lookup.remapLut??[])}_symbolizeStretch(e,t){const{rasterInfo:r}=this,{pixelType:s,bandCount:a}=r,o=this.rendererJSON,i=["u8","u16","s8","s16"].includes(s);let u,c;const{dra:f}=o,{gamma:y}=this.lookup;if("histogramEqualization"===o.stretchType){const s=f?null:this.lookup?.histogramLut,a=d(o,{rasterInfo:r,pixelBlock:e,bandIds:t,returnHistogramLut:!s}),n="u8"===r.pixelType&&!f&&h(r.histograms?.[0])?e:p(e,{...a,gamma:y,isRenderer:!0});c=l(n,{lut:f?a.histogramLut:t?.length?t.map((e=>s[e])):s,offset:0})}else if(i){if(f){const a=d(o,{rasterInfo:r,pixelBlock:e,bandIds:t});u=m({pixelType:s,...a,gamma:y,rounding:"floor"})}else if(this._isLUTChanged()){if(!this.bind().success)return e;u=this.lookup?this.lookup.stretchLut:null}else u=this.lookup?this.lookup.stretchLut:null;if(!u)return e;a>1&&null!=t&&t.length===e?.pixels.length&&u?.lut.length===a&&(u={lut:t.map((e=>u.lut[e])),offset:u.offset}),c=l(e,u)}else{const s=d(o,{rasterInfo:r,pixelBlock:e,bandIds:t});c=p(e,{...s,gamma:y,isRenderer:!0})}if(o.colorRamp){if(this._isLUTChanged(!0)){if(!this.bind().success)return e}c=n(c,this.lookup?.colormapLut)}return c}_symbolizeShadedRelief(e,t){const r=this.rendererJSON,s={...r,...t},a=g(e,s);if(!r.colorRamp)return a;let o;if(this._isLUTChanged(!0)){if(!this.bind().success)return a;o=this.lookup?this.lookup.hsvMap:null}else o=this.lookup?this.lookup.hsvMap:null;if(!o)return a;const n=this.rasterInfo.statistics?.[0]??{min:0,max:8e3};return b(a,e,o,n),a}_isVectorFieldData(){const{bandCount:e,dataType:t}=this.rasterInfo;return 2===e&&("vector-magdir"===t||"vector-uv"===t)}_updateVectorFieldRenderer(){return this._isVectorFieldData()?{success:!0}:{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; VectorFieldRenderer only supports "vector-magdir" and "vector-uv".`}}_updateFlowRenderer(){return this._isVectorFieldData()?{success:!0}:{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; FlowRenderer only supports "vector-magdir" and "vector-uv".`}}_updateUVRenderer(e){const{bandCount:t,attributeTable:r,pixelType:s}=this.rasterInfo,a=e.field1;if(!a)return{success:!1,error:"Unsupported renderer; missing UniqueValueRenderer.field."};const o=e.defaultSymbol,n=1===t&&["u8","s8"].includes(s);if(!I(this.rasterInfo,a)&&!n)return{success:!1,error:"Unsupported data; UniqueValueRenderer is only supported on single band data with a valid raster attribute table."};const i=[];if(null!=r){const t=r.fields.find((e=>"value"===e.name.toLowerCase()));if(!t)return{success:!1,error:"Unsupported data; the data's raster attribute table does not have a value field."};r.features.forEach((r=>{const s=e.uniqueValueInfos?.find((e=>String(e.value)===String(r.attributes[a]))),n=s?.symbol?.color;n?i.push([r.attributes[t.name]].concat(n)):o&&i.push([r.attributes[t.name]].concat(o.color))}))}else{if("value"!==a.toLowerCase())return{success:!1,error:'Unsupported renderer; UniqueValueRenderer.field must be "Value" when raster attribute table is not available.'};e.uniqueValueInfos?.forEach((e=>{const t=e?.symbol?.color;t?i.push([parseInt(""+e.value,10)].concat(t)):o&&i.push([parseInt(""+e.value,10)].concat(o?.color))}))}if(0===i.length)return{success:!1,error:"Invalid UniqueValueRenderer. Cannot find matching records in the raster attribute table."};const l=u({colormap:i});return this.lookup={rendererJSON:e,colormapLut:l},this.canRenderInWebGL=R(l?.indexedColormap),{success:!0}}_updateColormapRenderer(e){if(!C(this.rasterInfo))return{success:!1,error:"Unsupported data; the data source does not have a colormap."};const t=e.colormapInfos.map((e=>[e.value].concat(e.color))).sort(((e,t)=>e[0]-t[0]));if(!t||0===t.length)return{success:!1,error:"Unsupported renderer; ColormapRenderer must have meaningful colormapInfos."};const r=u({colormap:t});return this.lookup={rendererJSON:e,colormapLut:r},this.canRenderInWebGL=R(r?.indexedColormap),{success:!0}}_updateShadedReliefRenderer(e){if(!L(this.rasterInfo))return{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; ShadedReliefRenderer only supports "elevation", or single band float/s16 data.`};if(e.colorRamp){const t=k(e.colorRamp,{interpolateAlpha:!0}),r=u({colormap:t}),s=x(r.indexedColormap);this.lookup={rendererJSON:e,colormapLut:r,hsvMap:s}}else this.lookup=null;return this.canRenderInWebGL=!0,{success:!0}}_analyzeClassBreaks(e){const{attributeTable:t,pixelType:r}=this.rasterInfo,s=null!=t?t.fields.find((e=>"value"===e.name.toLowerCase())):null,a=null!=t?t.fields.find((t=>t.name.toLowerCase()===e.field.toLowerCase())):null,o=null!=s&&null!==a;return{canUseIndexedLUT:["u8","u16","s8","s16"].includes(r)||o,tableValueField:s,tableBreakField:a}}_updateClassBreaksRenderer(e){const{attributeTable:t}=this.rasterInfo,{canUseIndexedLUT:r,tableValueField:s,tableBreakField:a}=this._analyzeClassBreaks(e),o=e.classBreakInfos;if(!o?.length)return{success:!1,error:"Unsupported renderer; missing or invalid ClassBreaksRenderer.classBreakInfos."};const n=o.sort(((e,t)=>e.classMaxValue-t.classMaxValue)),i=n[n.length-1];let l=e.minValue;if(!r){const t=[];for(let e=0;e<n.length;e++)t.push({value:n[e].classMinValue??l,mappedColor:n[e].symbol.color}),l=n[e].classMaxValue;return t.push({value:i.classMaxValue,mappedColor:i.symbol.color}),this.lookup={rendererJSON:e,remapLut:t},this.canRenderInWebGL=!1,{success:!0}}const c=[];if(null!=t&&null!=s&&null!==a&&s!==a){const r=s.name,o=a.name,i=n[n.length-1],{classMaxValue:u}=i;l=e.minValue;for(const e of t.features){const t=e.attributes[r],s=e.attributes[o],a=s===u?i:s<l?null:n.find((({classMaxValue:e})=>e>s));a&&c.push([t].concat(a.symbol.color))}}else{l=Math.floor(e.minValue);for(let e=0;e<n.length;e++){const t=n[e];for(let e=l;e<t.classMaxValue;e++)c.push([e].concat(t.symbol.color));l=Math.ceil(t.classMaxValue)}i.classMaxValue===l&&c.push([i.classMaxValue].concat(i.symbol.color))}const p=u({colormap:c,fillUnspecified:!1});return this.lookup={rendererJSON:e,colormapLut:p},this.canRenderInWebGL=R(p?.indexedColormap),{success:!0}}_updateStretchRenderer(e){let{stretchType:t,dra:r}=e;if(!("none"===t||e.statistics?.length||v(this.rasterInfo.statistics)||r))return{success:!1,error:"Unsupported renderer; StretchRenderer.statistics is required when dynamic range adjustment is not used."};const s=e.histograms||this.rasterInfo.histograms;!V(e.stretchType)||s?.length||r||(t="minMax");const{computeGamma:a,useGamma:o,colorRamp:n}=e;let{gamma:i}=e;if(o&&a&&!i?.length){const t=e.statistics?.length?e.statistics:this.rasterInfo.statistics;i=f(this.rasterInfo.pixelType,t)}const l=this.rasterInfo.pixelType,c=!r&&["u8","u16","s8","s16"].includes(l);if("histogramEqualization"===t){const t=s.map((e=>y(e)));this.lookup={rendererJSON:e,histogramLut:t}}else if(c){const t=d(e,{rasterInfo:this.rasterInfo}),r=m({pixelType:l,...t,gamma:o?i:null,rounding:"floor"});this.lookup={rendererJSON:e,stretchLut:r}}if(n&&!U(n)){const t=k(n,{interpolateAlpha:!0});this.lookup||(this.lookup={rendererJSON:e}),this.lookup.colormapLut=u({colormap:t}),this.lookup.rendererJSON=e}return this.lookup.gamma=o&&i?.length?i:null,this.canRenderInWebGL="histogramEqualization"!==t,{success:!0}}_generateStretchWebGLParams(e,t,r){let s=null,a=null;const o=this.lookup?.colormapLut;t.colorRamp&&o&&(s=o.indexedColormap,a=o.offset),"histogramEqualization"===t.stretchType&&(t={...t,stretchType:"minMax"});const{gamma:n}=this.lookup,i=!(!t.useGamma||!n?.some((e=>1!==e))),{minCutOff:l,maxCutOff:u,minOutput:c,maxOutput:p}=d(t,{rasterInfo:this.rasterInfo,pixelBlock:e,bandIds:r});let h=0;null!=e&&(h=e.getPlaneCount(),2===h&&((e=e.clone()).statistics=[e.statistics[0]],e.pixels=[e.pixels[0]]));const{bandCount:m}=this.rasterInfo,f=Math.min(3,r?.length||h||m,m),y=s||i?1:255,g=new Float32Array(f);if(i&&n)for(let d=0;d<f;d++)n[d]>1?n[d]>2?g[d]=6.5+(n[d]-2)**2.5:g[d]=6.5+100*(2-n[d])**4:g[d]=1;1===l.length&&(l[2]=l[1]=l[0]),1===u.length&&(u[2]=u[1]=u[0]);const b=i&&n?[n[0],n[1]??n[0],n[2]??n[0]]:[1,1,1],S=i?[g[0],g[1]??g[0],g[2]??g[0]]:[1,1,1],k=u.map(((e,t)=>u[t]===l[t]?0:(p-c)/(u[t]-l[t])/y));return{bandCount:f,minOutput:c/y,maxOutput:p/y,minCutOff:l,maxCutOff:u,factor:k,useGamma:i,gamma:b,gammaCorrection:S,colormap:s,colormapOffset:a,stretchType:t.stretchType,type:"stretch"}}_generateShadedReliefWebGLParams(e,t=!1,r={x:0,y:0}){let s=null,a=null;const o=this.lookup?.colormapLut;e.colorRamp&&o&&(s=o.indexedColormap,a=o.offset);const n={...e,isGCS:t,resolution:r},i=S(n),l=this.rasterInfo.statistics?.[0];return{...i,minValue:l?.min??0,maxValue:l?.max??8e3,hillshadeType:"traditional"===e.hillshadeType?0:1,type:"hillshade",colormap:s,colormapOffset:a}}_generateVectorFieldWebGLParams(e){const{style:t,inputUnit:r,outputUnit:s,visualVariables:a,symbolTileSize:o,flowRepresentation:n}=e;let i;const l=this.rasterInfo.statistics?.[0].min??0,u=this.rasterInfo.statistics?.[0].max??50,c=a?.find((e=>"sizeInfo"===e.type))??{type:"sizeInfo",field:"Magnitude",maxDataValue:u,maxSize:.8*o,minDataValue:l,minSize:.2*o},p=c.minDataValue??l,d=c.maxDataValue??u,h=null!=c.maxSize&&null!=c.minSize?[c.minSize/o,c.maxSize/o]:[.2,.8];if("wind_speed"===t){const e=(h[0]+h[1])/2;h[0]=h[1]=e}const m=null!=p&&null!=d?[p,d]:null;if("classified_arrow"===t)if(null!=p&&null!=d&&null!=c){i=[];const e=(c.maxDataValue-c.minDataValue)/5;for(let t=0;t<6;t++)i.push(c.minDataValue+e*t)}else i=[0,1e-6,3.5,7,10.5,14];const f="flow_to"===n===("ocean_current_kn"===t||"ocean_current_m"===t)?0:Math.PI,y=a?.find((e=>"rotationInfo"===e.type));return{breakValues:i,dataRange:m,inputUnit:r,outputUnit:s,symbolTileSize:o,symbolPercentRange:h,style:t||"single_arrow",rotation:f,rotationType:this.rasterInfo.storageInfo?.tileInfo&&"vector-uv"===this.rasterInfo.dataType?"geographic":y?.rotationType||e.rotationType,type:"vectorField"}}};e([s({json:{write:!0}})],_.prototype,"rendererJSON",void 0),e([s({type:o,json:{write:!0}})],_.prototype,"rasterInfo",void 0),e([s({json:{write:!0}})],_.prototype,"lookup",void 0),e([s()],_.prototype,"canRenderInWebGL",void 0),_=e([a("esri.renderers.support.RasterSymbolizer")],_);const O=_;function V(e){return"percentClip"===e||"histogramEqualization"===e}function v(e){return null!=e&&e.length>0&&null!=e[0].min&&null!=e[0].max}function T(e){return c(e)&&0!==e.validPixelCount}function U(e){return"algorithmic"===e.type&&["0,0,0,255","0,0,0"].includes(e.fromColor.join(","))&&["255,255,255,255","255,255,255"].includes(e.toColor.join(","))}export{O as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../core/has.js";import t from"../../core/JSONSupport.js";import r from"../../core/Logger.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import o from"../../layers/support/RasterInfo.js";import{colorize as n,remapColor as i,lookupPixels as l,createColormapLUT as u,isValidPixelBlock as c}from"../../layers/support/rasterFunctions/pixelUtils.js";import{stretch as p,getStretchCutoff as d,isStandardU8Histogram as m,createStretchLUT as h,computeGammaValues as f,createHistogramEqualizationLUT as b}from"../../layers/support/rasterFunctions/stretchUtils.js";import{hillshade as g,tintHillshade as y,calculateHillshadeParams as S}from"../../layers/support/rasterFunctions/surfaceUtils.js";import{convertColorRampToColormap as x,createHsvMap as R}from"./colorRampUtils.js";import{isUVRendererSupported as I,isColormapSupportedByWebGL as k,isColormapRendererSupported as C,isShadedReliefRendererSupported as L}from"./rasterRendererChecks.js";let _=class extends t{constructor(e){super(e),this.lookup={rendererJSON:{}},this.canRenderInWebGL=!1}bind(){const{rendererJSON:e}=this;if(!e)return{success:!1};let t;switch(this.lookup={rendererJSON:{}},e.type){case"uniqueValue":t=this._updateUVRenderer(e);break;case"rasterColormap":t=this._updateColormapRenderer(e);break;case"rasterStretch":t=this._updateStretchRenderer(e);break;case"classBreaks":t=this._updateClassBreaksRenderer(e);break;case"rasterShadedRelief":t=this._updateShadedReliefRenderer(e);break;case"vectorField":t=this._updateVectorFieldRenderer();break;case"flowRenderer":t=this._updateFlowRenderer()}return t}symbolize(e){let t=e?.pixelBlock;if(!O(t))return t;if(e.simpleStretchParams&&"rasterStretch"===this.rendererJSON.type)return this.simpleStretch(t,e.simpleStretchParams);try{let r;switch(t.pixels.length>3&&(t=t.extractBands(e.bandIds??[0,1,2])),this.rendererJSON.type){case"uniqueValue":case"rasterColormap":r=this._symbolizeColormap(t);break;case"classBreaks":r=this._symbolizeClassBreaks(t);break;case"rasterStretch":r=this._symbolizeStretch(t,e.bandIds);break;case"rasterShadedRelief":{const s=e.extent,a=s.spatialReference.isGeographic,o={x:(s.xmax-s.xmin)/t.width,y:(s.ymax-s.ymin)/t.height};r=this._symbolizeShadedRelief(t,{isGCS:a,resolution:o});break}}return r}catch(s){return r.getLogger(this).error("symbolize",s.message),t}}simpleStretch(e,t){if(!O(e))return e;try{return e.pixels.length>3&&(e=e.extractBands([0,1,2])),p(e,{...t,isRenderer:!0})}catch(s){return r.getLogger(this).error("symbolize",s.message),e}}generateWebGLParameters(e){const{rendererJSON:t}=this;switch(t.type){case"uniqueValue":case"rasterColormap":case"classBreaks":return this._generateColormapWebGLParams("classBreaks"===t.type);case"rasterStretch":return this._generateStretchWebGLParams(e.pixelBlock,t,e.bandIds);case"rasterShadedRelief":return this._generateShadedReliefWebGLParams(t,e.isGCS,e.resolution??void 0);case"vectorField":return this._generateVectorFieldWebGLParams(t);default:return null}}_isLUTChanged(e){const t=this.lookup.rendererJSON;if(!t)return!0;const{rendererJSON:r}=this;if("colorRamp"in r&&r.colorRamp){const s=r.colorRamp;if(e)return JSON.stringify(s)!==JSON.stringify(t.colorRamp)}return JSON.stringify(r)!==JSON.stringify(t)}_symbolizeColormap(e){if(this._isLUTChanged()){if(!this.bind().success)return e}return n(e,this.lookup.colormapLut)}_symbolizeClassBreaks(e){const{canUseIndexedLUT:t}=this._analyzeClassBreaks(this.rendererJSON);if(this._isLUTChanged()){if(!this.bind().success)return e}return t?n(e,this.lookup.colormapLut):i(e,this.lookup.remapLut??[])}_symbolizeStretch(e,t){if(!e)return null;const{rasterInfo:r,lookup:s}=this,{pixelType:a,bandCount:o}=r,i=this.rendererJSON,u=["u8","u16","s8","s16"].includes(a);let c;const{dra:f}=i,{gamma:b}=s;if("histogramEqualization"===i.stretchType){const a=f?null:s.histogramLut,o=d(i,{rasterInfo:r,pixelBlock:e,bandIds:t,returnHistogramLut:!a}),n="u8"===r.pixelType&&!f&&m(r.histograms?.[0])?e:p(e,{...o,gamma:b,isRenderer:!0});c=l(n,{lut:f?o.histogramLut:t?.length?t.map((e=>a[e])):a,offset:0})}else if(u){let n;if(f){const s=d(i,{rasterInfo:r,pixelBlock:e,bandIds:t});n=h({pixelType:a,...s,gamma:b,rounding:"floor"})}else{if(this._isLUTChanged()){if(!this.bind().success)return e}n=s.stretchLut}if(!n)return e;o>1&&null!=t&&t.length===e?.pixels.length&&n.lut.length===o&&(n={lut:t.map((e=>n.lut[e])),offset:n.offset}),c=l(e,n)}else{const s=d(i,{rasterInfo:r,pixelBlock:e,bandIds:t});c=p(e,{...s,gamma:b,isRenderer:!0})}if(i.colorRamp){if(this._isLUTChanged(!0)){if(!this.bind().success)return e}c=n(c,s.colormapLut)}return c}_symbolizeShadedRelief(e,t){const r=this.rendererJSON,s={...r,...t},a=g(e,s);if(!r.colorRamp)return a;if(this._isLUTChanged(!0)){if(!this.bind().success)return a}const{hsvMap:o}=this.lookup;if(!o)return a;const n=this.rasterInfo.statistics?.[0]??{min:0,max:8e3};return y(a,e,o,n),a}_isVectorFieldData(){const{bandCount:e,dataType:t}=this.rasterInfo;return 2===e&&("vector-magdir"===t||"vector-uv"===t)}_updateVectorFieldRenderer(){return this._isVectorFieldData()?{success:!0}:{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; VectorFieldRenderer only supports "vector-magdir" and "vector-uv".`}}_updateFlowRenderer(){return this._isVectorFieldData()?{success:!0}:{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; FlowRenderer only supports "vector-magdir" and "vector-uv".`}}_updateUVRenderer(e){const{bandCount:t,attributeTable:r,pixelType:s}=this.rasterInfo,a=e.field1;if(!a)return{success:!1,error:"Unsupported renderer; missing UniqueValueRenderer.field."};const o=e.defaultSymbol,n=1===t&&["u8","s8"].includes(s);if(!I(this.rasterInfo,a)&&!n)return{success:!1,error:"Unsupported data; UniqueValueRenderer is only supported on single band data with a valid raster attribute table."};const i=[];if(null!=r){const t=r.fields.find((e=>"value"===e.name.toLowerCase()));if(!t)return{success:!1,error:"Unsupported data; the data's raster attribute table does not have a value field."};r.features.forEach((r=>{const s=e.uniqueValueInfos?.find((e=>String(e.value)===String(r.attributes[a]))),n=s?.symbol?.color;n?i.push([r.attributes[t.name]].concat(n)):o&&i.push([r.attributes[t.name]].concat(o.color))}))}else{if("value"!==a.toLowerCase())return{success:!1,error:'Unsupported renderer; UniqueValueRenderer.field must be "Value" when raster attribute table is not available.'};e.uniqueValueInfos?.forEach((e=>{const t=e?.symbol?.color;t?i.push([parseInt(""+e.value,10)].concat(t)):o&&i.push([parseInt(""+e.value,10)].concat(o?.color))}))}if(0===i.length)return{success:!1,error:"Invalid UniqueValueRenderer. Cannot find matching records in the raster attribute table."};const l=u({colormap:i});return this.lookup={rendererJSON:e,colormapLut:l},this.canRenderInWebGL=k(l?.indexedColormap),{success:!0}}_updateColormapRenderer(e){if(!C(this.rasterInfo))return{success:!1,error:"Unsupported data; the data source does not have a colormap."};const t=e.colormapInfos.map((e=>[e.value].concat(e.color))).sort(((e,t)=>e[0]-t[0]));if(!t||0===t.length)return{success:!1,error:"Unsupported renderer; ColormapRenderer must have meaningful colormapInfos."};const r=u({colormap:t});return this.lookup={rendererJSON:e,colormapLut:r},this.canRenderInWebGL=k(r?.indexedColormap),{success:!0}}_updateShadedReliefRenderer(e){if(!L(this.rasterInfo))return{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; ShadedReliefRenderer only supports "elevation", or single band float/s16 data.`};if(e.colorRamp){const t=x(e.colorRamp,{interpolateAlpha:!0}),r=u({colormap:t}),s=R(r.indexedColormap);this.lookup={rendererJSON:e,colormapLut:r,hsvMap:s}}else this.lookup={rendererJSON:e};return this.canRenderInWebGL=!0,{success:!0}}_analyzeClassBreaks(e){const{attributeTable:t,pixelType:r}=this.rasterInfo,s=t?.fields.find((e=>"value"===e.name.toLowerCase())),a=t?.fields.find((t=>t.name.toLowerCase()===e.field.toLowerCase())),o=null!=s&&null!==a;return{canUseIndexedLUT:["u8","u16","s8","s16"].includes(r)||o,tableValueField:s,tableBreakField:a}}_updateClassBreaksRenderer(e){const{attributeTable:t}=this.rasterInfo,{canUseIndexedLUT:r,tableValueField:s,tableBreakField:a}=this._analyzeClassBreaks(e),o=e.classBreakInfos;if(!o?.length)return{success:!1,error:"Unsupported renderer; missing or invalid ClassBreaksRenderer.classBreakInfos."};const n=o.sort(((e,t)=>e.classMaxValue-t.classMaxValue)),i=n[n.length-1];let l=e.minValue;if(!r){const t=[];for(let e=0;e<n.length;e++)t.push({value:n[e].classMinValue??l,mappedColor:n[e].symbol.color}),l=n[e].classMaxValue;return t.push({value:i.classMaxValue,mappedColor:i.symbol.color}),this.lookup={rendererJSON:e,remapLut:t},this.canRenderInWebGL=!1,{success:!0}}const c=[];if(null!=t&&null!=s&&null!==a&&s!==a){const r=s.name,o=a.name,i=n[n.length-1],{classMaxValue:u}=i;l=e.minValue;for(const e of t.features){const t=e.attributes[r],s=e.attributes[o],a=s===u?i:s<l?null:n.find((({classMaxValue:e})=>e>s));a&&c.push([t].concat(a.symbol.color))}}else{l=Math.floor(e.minValue);for(let e=0;e<n.length;e++){const t=n[e];for(let e=l;e<t.classMaxValue;e++)c.push([e].concat(t.symbol.color));l=Math.ceil(t.classMaxValue)}i.classMaxValue===l&&c.push([i.classMaxValue].concat(i.symbol.color))}const p=u({colormap:c,fillUnspecified:!1});return this.lookup={rendererJSON:e,colormapLut:p},this.canRenderInWebGL=k(p?.indexedColormap),{success:!0}}_updateStretchRenderer(e){let{stretchType:t,dra:r}=e;if(!("none"===t||e.statistics?.length||T(this.rasterInfo.statistics)||r))return{success:!1,error:"Unsupported renderer; StretchRenderer.statistics is required when dynamic range adjustment is not used."};const s=e.histograms||this.rasterInfo.histograms;!v(e.stretchType)||s?.length||r||(t="minMax");const{computeGamma:a,useGamma:o,colorRamp:n}=e;let{gamma:i}=e;if(o&&a&&!i?.length){const t=e.statistics?.length?e.statistics:this.rasterInfo.statistics;i=f(this.rasterInfo.pixelType,t)}const l=this.rasterInfo.pixelType,c=!r&&["u8","u16","s8","s16"].includes(l);if("histogramEqualization"===t){const t=s.map((e=>b(e)));this.lookup={rendererJSON:e,histogramLut:t}}else if(c){const t=d(e,{rasterInfo:this.rasterInfo}),r=h({pixelType:l,...t,gamma:o?i:null,rounding:"floor"});this.lookup={rendererJSON:e,stretchLut:r}}else this.lookup={rendererJSON:e};if(n&&!U(n)){const t=x(n,{interpolateAlpha:!0});this.lookup.colormapLut=u({colormap:t}),this.lookup.rendererJSON=e}return this.lookup.gamma=o&&i?.length?i:null,this.canRenderInWebGL="histogramEqualization"!==t,{success:!0}}_generateColormapWebGLParams(e){const{indexedColormap:t,offset:r}=this.lookup.colormapLut||{};return{colormap:t,colormapOffset:r,isClassBreaks:e,type:"lut"}}_generateStretchWebGLParams(e,t,r){const{colormapLut:s}=this.lookup,a=t.colorRamp?s?.indexedColormap:null,o=t.colorRamp?s?.offset:null;"histogramEqualization"===t.stretchType&&(t={...t,stretchType:"minMax"});const{gamma:n}=this.lookup,i=!(!t.useGamma||!n?.some((e=>1!==e))),{minCutOff:l,maxCutOff:u,minOutput:c,maxOutput:p}=d(t,{rasterInfo:this.rasterInfo,pixelBlock:e,bandIds:r});let m=0;null!=e&&(m=e.getPlaneCount(),2===m&&((e=e.clone()).statistics=[e.statistics[0]],e.pixels=[e.pixels[0]]));const{bandCount:h}=this.rasterInfo,f=Math.min(3,r?.length||m||h,h),b=a||i?1:255,g=new Float32Array(f);if(i&&n)for(let d=0;d<f;d++)n[d]>1?n[d]>2?g[d]=6.5+(n[d]-2)**2.5:g[d]=6.5+100*(2-n[d])**4:g[d]=1;1===l.length&&(l[2]=l[1]=l[0]),1===u.length&&(u[2]=u[1]=u[0]);const y=i&&n?[n[0],n[1]??n[0],n[2]??n[0]]:[1,1,1],S=i?[g[0],g[1]??g[0],g[2]??g[0]]:[1,1,1],x=u.map(((e,t)=>u[t]===l[t]?0:(p-c)/(u[t]-l[t])/b));return{bandCount:f,minOutput:c/b,maxOutput:p/b,minCutOff:l,maxCutOff:u,factor:x,useGamma:i,gamma:y,gammaCorrection:S,colormap:a,colormapOffset:o,stretchType:t.stretchType,type:"stretch"}}_generateShadedReliefWebGLParams(e,t=!1,r={x:0,y:0}){const{colormapLut:s}=this.lookup,a=e.colorRamp?s?.indexedColormap:null,o=e.colorRamp?s?.offset:null,n={...e,isGCS:t,resolution:r},i=S(n),l=this.rasterInfo.statistics?.[0];return{...i,minValue:l?.min??0,maxValue:l?.max??8e3,hillshadeType:"traditional"===e.hillshadeType?0:1,type:"hillshade",colormap:a,colormapOffset:o}}_generateVectorFieldWebGLParams(e){const{style:t,inputUnit:r,outputUnit:s,visualVariables:a,symbolTileSize:o,flowRepresentation:n}=e,i=this.rasterInfo.statistics?.[0].min??0,l=this.rasterInfo.statistics?.[0].max??50,u=a?.find((e=>"sizeInfo"===e.type))??{type:"sizeInfo",field:"Magnitude",maxDataValue:l,maxSize:.8*o,minDataValue:i,minSize:.2*o},c=u.minDataValue??i,p=u.maxDataValue??l,d=null!=u.maxSize&&null!=u.minSize?[u.minSize/o,u.maxSize/o]:[.2,.8];if("wind_speed"===t){const e=(d[0]+d[1])/2;d[0]=d[1]=e}const m=null!=c&&null!=p?[c,p]:null;let h=null;if("classified_arrow"===t)if(null!=c&&null!=p&&null!=u){h=[];const e=(u.maxDataValue-u.minDataValue)/5;for(let t=0;t<6;t++)h.push(u.minDataValue+e*t)}else h=[0,1e-6,3.5,7,10.5,14];const f="flow_to"===n===("ocean_current_kn"===t||"ocean_current_m"===t)?0:Math.PI,b=a?.find((e=>"rotationInfo"===e.type));return{breakValues:h,dataRange:m,inputUnit:r,outputUnit:s,symbolTileSize:o,symbolPercentRange:d,style:t||"single_arrow",rotation:f,rotationType:this.rasterInfo.storageInfo?.tileInfo&&"vector-uv"===this.rasterInfo.dataType?"geographic":b?.rotationType||e.rotationType,type:"vectorField"}}};e([s({json:{write:!0}})],_.prototype,"rendererJSON",void 0),e([s({type:o,json:{write:!0}})],_.prototype,"rasterInfo",void 0),e([s({json:{write:!0}})],_.prototype,"lookup",void 0),e([s()],_.prototype,"canRenderInWebGL",void 0),_=e([a("esri.renderers.support.RasterSymbolizer")],_);const V=_;function v(e){return"percentClip"===e||"histogramEqualization"===e}function T(e){return null!=e&&e.length>0&&null!=e[0].min&&null!=e[0].max}function O(e){return c(e)&&0!==e.validPixelCount}function U(e){return"algorithmic"===e.type&&["0,0,0,255","0,0,0"].includes(e.fromColor.join(","))&&["255,255,255,255","255,255,255"].includes(e.toColor.join(","))}export{V as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- const c="20250318",e="ef4c9f46abb255c3d3294d88be1c85d1e8676aa2";export{c as buildDate,e as commitHash};
5
+ const b="20250319",a="5b62772b25284e27caf0a27bb9162037f23850b9";export{b as buildDate,a as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import{property as t}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{isFunctionRaster as s}from"../../../../layers/support/rasterDatasets/datasetUtils.js";import{RasterTileContainer as i}from"../../engine/imagery/RasterTileContainer.js";import{BaseImageryTileSubView2D as o}from"./BaseImageryTileSubView2D.js";import{canUseMajorityInterpolationOnDataSource as n}from"../support/util.js";import a from"../../../layers/support/Geometry.js";let l=class extends o{constructor(){super(...arguments),this.type="raster"}get canUseWebGLForProcessing(){const{loaded:e,symbolizer:t}=this.layer;if(!e||!t)return!1;const r=t.lookup?.colormapLut?.indexedColormap,s=r&&r.length>this._maxIndexedColormapSize;return this.useWebGLForProcessing&&t.canRenderInWebGL&&!s&&!("majority"===this.layer.interpolation&&n(this.layer))}attach(){super.attach(),this.container=new i(this._tileInfoView),this.container.isCustomTilingScheme=this._isCustomTilingScheme,this.updateRasterFunctionParameters()}detach(){super.detach(),this.container.removeAllChildren(),this.container=null}fetchTile(e,t){return this.layer.fetchTile(e.level,e.row,e.col,t)}updateRasterFunctionParameters(){const{clips:e,view:t}=this.layerView;null!=this._geometry&&e.remove(this._geometry);const{raster:r,type:i}=this.layer;if(s(r)){const s=r.getClippingGeometry(t.spatialReference);if(s){const t=new a({geometry:s});e.add(t),this._geometry=t}}const{container:o}=this;if("Function"!==r.datasetFormat||"wcs"===i)return o.rasterFunctionChain=null,o.children.forEach((e=>{const{bitmap:t}=e;t&&(t.suspended=!0,t.processed=!1,t.projected&&(t.invalidateTexture(),t.rasterTexture=null))})),void(this._rasterFunctionState="na");const n=this._rasterFunctionState,{rasterFunction:l,primaryRasters:c}=r,u=l.supportsGPU&&(!c||c.rasters.length<=1),p=u?l.flatWebGLFunctionChain:null,{renderer:d}=this.layer,h=!u||!p?.functions.length||"raster-stretch"===d?.type&&d.dynamicRangeAdjustment||!this.canUseWebGLForProcessing;o.rasterFunctionChain=h?null:this._addProjection(p);const m=null==l?"na":o.rasterFunctionChain?"gpu":"cpu",y=n===m||"na"===n&&"cpu"===m&&0===p?.functions?.length;o.children.forEach((e=>{const{bitmap:t}=e;t&&(t.suspended=!y,t.processed=!1,t.processedTexture=null)})),this._rasterFunctionState=m}async updateTileSource(e,t){const r=this._getBandIds(),s=this._getLayerInterpolation(),{canUseWebGLForProcessing:i}=this,{source:o,globalSymbolizerParams:n,suspended:a,coords:l,resolution:c}=t,u=this.layerView.hasTilingEffects?n:t.symbolizerParams,{bitmap:p}=e;if([p.x,p.y]=l,p.resolution=c,null!=o?.pixelBlock){const e={extent:o.extent,pixelBlock:o.pixelBlock,srcPixelSize:o.srcTilePixelSize};if(p.rawPixelData=e,i)p.source=o.pixelBlock,p.isRendereredSource=!1;else{const t=await this.layer.applyRenderer(e,"stretch"===n?.type?n:void 0);p.source=t,p.isRendereredSource=!0}p.symbolizerParameters=i?u:null,p.transformGrid=i?o.transformGrid:null}else{const e=this.createEmptyTilePixelBlock();p.source=e,p.symbolizerParameters=i?u:null,p.transformGrid=null}p.bandIds=i?r:null,p.width=this._tileInfoView.tileInfo.size[0],p.height=this._tileInfoView.tileInfo.size[1],p.interpolation=s,p.suspended=a,p.invalidateTexture()}async updateTileSymbolizerParameters(e,t){const{local:r,global:s}=t,i=this._getBandIds(),o=this._getLayerInterpolation(),{canUseWebGLForProcessing:n}=this,{bitmap:a}=e,{rawPixelData:l}=a;n||null==l?(a.isRendereredSource&&null!=l&&(a.source=l.pixelBlock),a.isRendereredSource=!1):(a.source=await this.layer.applyRenderer(l,"stretch"===s?.type?s:void 0),a.isRendereredSource=!0),a.symbolizerParameters=n?this.layerView.hasTilingEffects?s:r:null,a.bandIds=n?i:null,a.interpolation=o,a.suspended=!1}_getLayerInterpolation(){const{interpolation:e,renderer:t}=this.layer;if(!t)return e;const r=t.type;return"raster-colormap"===r||"unique-value"===r?"nearest":"raster-stretch"===t.type&&null!=t.colorRamp?"bilinear"===e||"cubic"===e?"bilinear":"nearest":e}_addProjection(e){return e?.functions?.length&&!e.hasFocalFunction&&e.functions.unshift({name:"Reproject",parameters:{targetImageSize:this._tileInfoView.tileInfo.size,requireNNEdge:e.isSourceSingleBand},pixelType:"f32",id:0,isNoopProcess:!1}),e}};e([t()],l.prototype,"container",void 0),e([t()],l.prototype,"layer",void 0),e([t()],l.prototype,"type",void 0),l=e([r("esri.views.2d.layers.imagery.ImageryTileView2D")],l);const c=l;export{c as default};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import{property as t}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{isFunctionRaster as s}from"../../../../layers/support/rasterDatasets/datasetUtils.js";import{RasterTileContainer as i}from"../../engine/imagery/RasterTileContainer.js";import{BaseImageryTileSubView2D as o}from"./BaseImageryTileSubView2D.js";import{canUseMajorityInterpolationOnDataSource as n}from"../support/util.js";import a from"../../../layers/support/Geometry.js";let l=class extends o{constructor(){super(...arguments),this.type="raster"}get canUseWebGLForProcessing(){const{loaded:e,symbolizer:t}=this.layer;if(!e||!t)return!1;const r=t.lookup.colormapLut?.indexedColormap,s=r&&r.length>this._maxIndexedColormapSize;return this.useWebGLForProcessing&&t.canRenderInWebGL&&!s&&!("majority"===this.layer.interpolation&&n(this.layer))}attach(){super.attach(),this.container=new i(this._tileInfoView),this.container.isCustomTilingScheme=this._isCustomTilingScheme,this.updateRasterFunctionParameters()}detach(){super.detach(),this.container.removeAllChildren(),this.container=null}fetchTile(e,t){return this.layer.fetchTile(e.level,e.row,e.col,t)}updateRasterFunctionParameters(){const{clips:e,view:t}=this.layerView;null!=this._geometry&&e.remove(this._geometry);const{raster:r,type:i}=this.layer;if(s(r)){const s=r.getClippingGeometry(t.spatialReference);if(s){const t=new a({geometry:s});e.add(t),this._geometry=t}}const{container:o}=this;if("Function"!==r.datasetFormat||"wcs"===i)return o.rasterFunctionChain=null,o.children.forEach((e=>{const{bitmap:t}=e;t&&(t.suspended=!0,t.processed=!1,t.projected&&(t.invalidateTexture(),t.rasterTexture=null))})),void(this._rasterFunctionState="na");const n=this._rasterFunctionState,{rasterFunction:l,primaryRasters:c}=r,u=l.supportsGPU&&(!c||c.rasters.length<=1),p=u?l.flatWebGLFunctionChain:null,{renderer:d}=this.layer,h=!u||!p?.functions.length||"raster-stretch"===d?.type&&d.dynamicRangeAdjustment||!this.canUseWebGLForProcessing;o.rasterFunctionChain=h?null:this._addProjection(p);const m=null==l?"na":o.rasterFunctionChain?"gpu":"cpu",y=n===m||"na"===n&&"cpu"===m&&0===p?.functions?.length;o.children.forEach((e=>{const{bitmap:t}=e;t&&(t.suspended=!y,t.processed=!1,t.processedTexture=null)})),this._rasterFunctionState=m}async updateTileSource(e,t){const r=this._getBandIds(),s=this._getLayerInterpolation(),{canUseWebGLForProcessing:i}=this,{source:o,globalSymbolizerParams:n,suspended:a,coords:l,resolution:c}=t,u=this.layerView.hasTilingEffects?n:t.symbolizerParams,{bitmap:p}=e;if([p.x,p.y]=l,p.resolution=c,null!=o?.pixelBlock){const e={extent:o.extent,pixelBlock:o.pixelBlock,srcPixelSize:o.srcTilePixelSize};if(p.rawPixelData=e,i)p.source=o.pixelBlock,p.isRendereredSource=!1;else{const t=await this.layer.applyRenderer(e,"stretch"===n?.type?n:void 0);p.source=t,p.isRendereredSource=!0}p.symbolizerParameters=i?u:null,p.transformGrid=i?o.transformGrid:null}else{const e=this.createEmptyTilePixelBlock();p.source=e,p.symbolizerParameters=i?u:null,p.transformGrid=null}p.bandIds=i?r:null,p.width=this._tileInfoView.tileInfo.size[0],p.height=this._tileInfoView.tileInfo.size[1],p.interpolation=s,p.suspended=a,p.invalidateTexture()}async updateTileSymbolizerParameters(e,t){const{local:r,global:s}=t,i=this._getBandIds(),o=this._getLayerInterpolation(),{canUseWebGLForProcessing:n}=this,{bitmap:a}=e,{rawPixelData:l}=a;n||null==l?(a.isRendereredSource&&null!=l&&(a.source=l.pixelBlock),a.isRendereredSource=!1):(a.source=await this.layer.applyRenderer(l,"stretch"===s?.type?s:void 0),a.isRendereredSource=!0),a.symbolizerParameters=n?this.layerView.hasTilingEffects?s:r:null,a.bandIds=n?i:null,a.interpolation=o,a.suspended=!1}_getLayerInterpolation(){const{interpolation:e,renderer:t}=this.layer;if(!t)return e;const r=t.type;return"raster-colormap"===r||"unique-value"===r?"nearest":"raster-stretch"===t.type&&null!=t.colorRamp?"bilinear"===e||"cubic"===e?"bilinear":"nearest":e}_addProjection(e){return e?.functions?.length&&!e.hasFocalFunction&&e.functions.unshift({name:"Reproject",parameters:{targetImageSize:this._tileInfoView.tileInfo.size,requireNNEdge:e.isSourceSingleBand},pixelType:"f32",id:0,isNoopProcess:!1}),e}};e([t()],l.prototype,"container",void 0),e([t()],l.prototype,"layer",void 0),e([t()],l.prototype,"type",void 0),l=e([r("esri.views.2d.layers.imagery.ImageryTileView2D")],l);const c=l;export{c as default};