@arcgis/core 4.26.1 → 4.26.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{w as e}from"./mat4.js";import{c as r}from"./mat4f64.js";import{n as o,s as i}from"./vec3.js";import{c as a}from"./vec3f64.js";import{OverlayIndex as l}from"../views/3d/terrain/interfaces.js";import{addLinearDepth as t,addNearFar as n,ForwardLinearDepth as s}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 c}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 m}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{PositionAttribute as g}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/PositionAttribute.glsl.js";import{TextureCoordinateAttribute as p}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{VertexTangent as h}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 f,addAmbientBoostFactor as y,addLightingGlobalFactor as C}from"../views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import{addMainLightDirection as x,addMainLightIntensity as L}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js";import{NormalUtils as O}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 j}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{OverlayMode as T}from"../views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{OverlayTerrainPassParameters as z,OverlayTerrain as _,TerrainTexture as F}from"../views/3d/webgl-engine/core/shaderLibrary/terrain/TerrainTexture.glsl.js";import{addProjViewLocalOrigin as P,addViewNormal as M,addCameraPosition as N}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{textureSize as D,texelFetch as $}from"../views/3d/webgl-engine/core/shaderLibrary/util/WebGL2Utils.js";import{Float3PassUniform as W}from"../views/3d/webgl-engine/core/shaderModules/Float3PassUniform.js";import{glsl as U}from"../views/3d/webgl-engine/core/shaderModules/interfaces.js";import{Matrix4DrawUniform as V}from"../views/3d/webgl-engine/core/shaderModules/Matrix4DrawUniform.js";import{ShaderBuilder as A}from"../views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js";import{Texture2DPassUniform as k}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";class B extends z{}function E(r){const a=new A,{vertex:z,fragment:B,varyings:E}=a;a.include(g),a.include(m,r),a.include(p,r);const I=()=>{a.include(O,r),z.code.add(U`
5
+ import{w as e}from"./mat4.js";import{c as r}from"./mat4f64.js";import{n as o,s as a}from"./vec3.js";import{c as i}from"./vec3f64.js";import{OverlayIndex as l}from"../views/3d/terrain/interfaces.js";import{addLinearDepth as t,addNearFar as n,ForwardLinearDepth as s}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 c}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 m}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{PositionAttribute as g}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/PositionAttribute.glsl.js";import{TextureCoordinateAttribute as p}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{VertexTangent as h}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 f,addAmbientBoostFactor as y,addLightingGlobalFactor as C}from"../views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import{addMainLightDirection as x,addMainLightIntensity as L}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js";import{NormalUtils as O}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 j}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{OverlayMode as z}from"../views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{OverlayTerrainPassParameters as T,OverlayTerrain as _,TerrainTexture as F}from"../views/3d/webgl-engine/core/shaderLibrary/terrain/TerrainTexture.glsl.js";import{addProjViewLocalOrigin as P,addViewNormal as M,addCameraPosition as N}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float3PassUniform as D}from"../views/3d/webgl-engine/core/shaderModules/Float3PassUniform.js";import{glsl as $}from"../views/3d/webgl-engine/core/shaderModules/interfaces.js";import{Matrix4DrawUniform as W}from"../views/3d/webgl-engine/core/shaderModules/Matrix4DrawUniform.js";import{ShaderBuilder as U}from"../views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js";import{Texture2DPassUniform as V}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";class A extends T{}function k(r){const i=new U,{vertex:T,fragment:A,varyings:k}=i;i.include(g),i.include(m,r),i.include(p,r);const G=()=>{i.include(O,r),T.code.add($`
6
6
  vec3 decodeNormalTerrain(vec2 e) {
7
7
  float z = 1.0 - abs(e.x) - abs(e.y);
8
8
  vec3 n = vec3(e + vec2(e.x >= 0.0 ? 1.0 : -1.0, e.y >= 0.0 ? 1.0 : -1.0) * min(z,0.0),z);
@@ -10,9 +10,9 @@ import{w as e}from"./mat4.js";import{c as r}from"./mat4f64.js";import{n as o,s a
10
10
  }
11
11
 
12
12
  vec3 getNormal() {
13
- return ${r.shading?U`decodeNormalTerrain(normalCompressed)`:U`getLocalUp(position, localOrigin)`};
13
+ return ${r.shading?$`decodeNormalTerrain(normalCompressed)`:$`getLocalUp(position, localOrigin)`};
14
14
  }
15
- `)};P(z,r),a.include(v,r);const q=r.overlayMode!==T.Disabled;switch(r.output){case d.Color:{a.include(F,r),a.include(f,r),q&&a.include(_,{...r,pbrMode:r.pbrMode===S.Terrain?S.TerrainWithWater:S.Water});const t=r.overlayMode===T.EnabledWithWater;t&&a.include(h,r),E.add("vnormal","vec3"),E.add("vpos","vec3"),E.add("vup","vec3"),I(),(r.atmosphere||r.screenSizePerspective)&&M(z);const n=r.receiveShadows&&!r.renderOccluded;n&&a.include(s,r),r.atmosphere&&E.add("wnormal","vec3"),r.screenSizePerspective&&(E.add("screenSizeDistanceToCamera","float"),E.add("screenSizeCosAngle","float")),z.code.add(U`
15
+ `)};P(T,r),i.include(v,r);const H=r.overlayMode!==z.Disabled;switch(r.output){case d.Color:{i.include(F,r),i.include(f,r),H&&i.include(_,{...r,pbrMode:r.pbrMode===S.Terrain?S.TerrainWithWater:S.Water});const t=r.overlayMode===z.EnabledWithWater;t&&i.include(h,r),k.add("vnormal","vec3"),k.add("vpos","vec3"),k.add("vup","vec3"),G(),(r.atmosphere||r.screenSizePerspective)&&M(T);const n=r.receiveShadows&&!r.renderOccluded;n&&i.include(s,r),r.atmosphere&&k.add("wnormal","vec3"),r.screenSizePerspective&&(k.add("screenSizeDistanceToCamera","float"),k.add("screenSizeCosAngle","float")),T.code.add($`
16
16
  void main(void) {
17
17
  //Position
18
18
  vpos = position;
@@ -25,29 +25,29 @@ import{w as e}from"./mat4.js";import{c as r}from"./mat4f64.js";import{n as o,s a
25
25
  //Up
26
26
  vup = getLocalUp(position, localOrigin);
27
27
 
28
- ${t?U`forwardVertexTangent(vnormal);`:U``}
28
+ ${t?$`forwardVertexTangent(vnormal);`:$``}
29
29
 
30
- ${r.atmosphere?U`wnormal = normalize((viewNormal * vec4(normalize(positionWorld), 1.0)).xyz);`:""}
30
+ ${r.atmosphere?$`wnormal = normalize((viewNormal * vec4(normalize(positionWorld), 1.0)).xyz);`:""}
31
31
 
32
32
  //Texture UV
33
33
  vec2 uv = getUV0();
34
34
  forwardTextureCoordinatesWithTransform(uv);
35
- ${q?U`setOverlayVTC(uv);`:""}
36
- ${r.tileBorders?U`forwardTextureCoordinates();`:""}
35
+ ${H?$`setOverlayVTC(uv);`:""}
36
+ ${r.tileBorders?$`forwardTextureCoordinates();`:""}
37
37
 
38
- ${r.screenSizePerspective?U`
38
+ ${r.screenSizePerspective?$`
39
39
  vec3 viewPos = (view * vec4(vpos, 1.0)).xyz;
40
40
  screenSizeDistanceToCamera = length(viewPos);
41
41
  vec3 viewSpaceNormal = (viewNormal * vec4(normalize(positionWorld), 1.0)).xyz;
42
42
  screenSizeCosAngle = abs(viewSpaceNormal.z);`:""}
43
43
 
44
- ${n?U`forwardLinearDepth();`:""}
44
+ ${n?$`forwardLinearDepth();`:""}
45
45
 
46
46
  }
47
- `),a.extensions.add("GL_OES_standard_derivatives"),a.extensions.add("GL_EXT_shader_texture_lod"),a.include(c,r),a.include(f,r),a.include(b,r),a.include(j,r),N(B,r),y(B),C(B),B.uniforms.add([z.uniforms.get("localOrigin"),new W("viewDirection",((e,r)=>o(H,i(H,r.camera.viewMatrix[12],r.camera.viewMatrix[13],r.camera.viewMatrix[14]))))]),t&&B.uniforms.add([new k("ovWaterTex",((e,r)=>0===r.overlays.length?null:r.overlays[l.INNER].getNormalTexture(e.overlaySource))),new V("view",((r,o)=>e(G,o.camera.viewMatrix,r.origin)))]),B.code.add(U`const float sliceOpacity = 0.2;
47
+ `),i.extensions.add("GL_OES_standard_derivatives"),i.extensions.add("GL_EXT_shader_texture_lod"),i.include(c,r),i.include(f,r),i.include(b,r),i.include(j,r),N(A,r),y(A),C(A),A.uniforms.add([T.uniforms.get("localOrigin"),new D("viewDirection",((e,r)=>o(E,a(E,r.camera.viewMatrix[12],r.camera.viewMatrix[13],r.camera.viewMatrix[14]))))]),t&&A.uniforms.add([new V("ovWaterTex",((e,r)=>0===r.overlays.length?null:r.overlays[l.INNER].getNormalTexture(e.overlaySource))),new W("view",((r,o)=>e(B,o.camera.viewMatrix,r.origin)))]),A.code.add($`const float sliceOpacity = 0.2;
48
48
  float lum(vec3 c) {
49
49
  return (min(min(c.r, c.g), c.b) + max(max(c.r, c.g), c.b)) * 0.5;
50
- }`),x(B),L(B),B.code.add(U`
50
+ }`),x(A),L(A),A.code.add($`
51
51
  void main() {
52
52
  vec3 normal = normalize(vnormal);
53
53
  float vndl = dot(normal, mainLightDirection);
@@ -58,10 +58,10 @@ return (min(min(c.r, c.g), c.b) + max(max(c.r, c.g), c.b)) * 0.5;
58
58
  float ssao = evaluateAmbientOcclusionInverse();
59
59
  vec4 tileColor = getTileColor();
60
60
 
61
- ${q?U`
61
+ ${H?$`
62
62
  vec4 overlayColorOpaque = getOverlayColor(ovColorTex, vtcOverlay);
63
63
  vec4 overlayColor = overlayOpacity * overlayColorOpaque;
64
- ${r.invisible?U`if (overlayColor.a == 0.0) { discard; }`:""}
64
+ ${r.invisible?$`if (overlayColor.a == 0.0) { discard; }`:""}
65
65
  vec4 groundColor = tileColor;
66
66
  tileColor = tileColor * (1.0 - overlayColor.a) + overlayColor;`:""}
67
67
 
@@ -75,21 +75,21 @@ return (min(min(c.r, c.g), c.b) + max(max(c.r, c.g), c.b)) * 0.5;
75
75
  if (sliced) {
76
76
  tileColor *= sliceOpacity;
77
77
  }
78
- ${r.atmosphere?U`
78
+ ${r.atmosphere?$`
79
79
  float ndotl = clamp(vndl, 0.0, 1.0);
80
80
  vec3 atm = vec3(clamp(1.0 - dot(-viewDirection, wnormal), 0.0, 1.0));
81
81
  atm *= clamp(1.0 - lum(tileColor.rgb) * 1.5, 0.0, 1.0); // avoid atmosphere on bright base maps
82
82
  atm *= clamp(ndotl * 2.0, 0.0, 1.0); // avoid atmosphere on dark side of the globe
83
83
  atm *= tileColor.a; // premultiply with tile alpha`:""}
84
84
 
85
- vec3 albedo = ${r.atmosphere?U`atm + tileColor.rgb;`:U`tileColor.rgb;`}
85
+ vec3 albedo = ${r.atmosphere?$`atm + tileColor.rgb;`:$`tileColor.rgb;`}
86
86
 
87
87
  // heuristic shading function used in the old terrain, now used to add ambient lighting
88
88
 
89
89
  vec3 additionalLight = ssao * mainLightIntensity * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor;
90
90
 
91
- ${r.pbrMode===S.Terrain||r.pbrMode===S.TerrainWithWater?U`gl_FragColor = vec4(evaluateTerrainLighting(normal, albedo, shadow, 1.0 - ssao, additionalLight, normalize(vpos - cameraPosition), vup), tileColor.a);`:U`gl_FragColor = vec4(evaluateSceneLighting(normal, albedo, shadow, 1.0 - ssao, additionalLight), tileColor.a);`}
92
- ${t?U`
91
+ ${r.pbrMode===S.Terrain||r.pbrMode===S.TerrainWithWater?$`gl_FragColor = vec4(evaluateTerrainLighting(normal, albedo, shadow, 1.0 - ssao, additionalLight, normalize(vpos - cameraPosition), vup), tileColor.a);`:$`gl_FragColor = vec4(evaluateSceneLighting(normal, albedo, shadow, 1.0 - ssao, additionalLight), tileColor.a);`}
92
+ ${t?$`
93
93
  vec4 overlayWaterMask = getOverlayColor(ovWaterTex, vtcOverlay);
94
94
  float waterNormalLength = length(overlayWaterMask);
95
95
  if (waterNormalLength > 0.95) {
@@ -102,7 +102,7 @@ return (min(min(c.r, c.g), c.b) + max(max(c.r, c.g), c.b)) * 0.5;
102
102
  // un-gamma the ground color to mix in linear space
103
103
  gl_FragColor = mix(groundColor, waterColorNonLinear, waterColorLinear.w) * opacity;
104
104
  }`:""}
105
- ${r.screenSizePerspective?U`
105
+ ${r.screenSizePerspective?$`
106
106
  float perspectiveScale = screenSizePerspectiveScaleFloat(1.0, screenSizeCosAngle, screenSizeDistanceToCamera, vec4(0.0, 0.0, 0.0, 0.0));
107
107
  if (perspectiveScale <= 0.25) {
108
108
  gl_FragColor = mix(gl_FragColor, vec4(1.0, 0.0, 0.0, 1.0), perspectiveScale * 4.0);
@@ -116,69 +116,66 @@ return (min(min(c.r, c.g), c.b) + max(max(c.r, c.g), c.b)) * 0.5;
116
116
  else {
117
117
  gl_FragColor = mix(gl_FragColor, vec4(1.0, 0.0, 1.0, 1.0), (perspectiveScale - 0.5) * 2.0);
118
118
  }`:""}
119
- ${r.visualizeNormals?r.spherical?U`
119
+ ${r.visualizeNormals?r.spherical?$`
120
120
  vec3 localUp = normalize(vpos + localOrigin);
121
121
  vec3 right = normalize(cross(vec3(0.0, 0.0, 1.0), localUp));
122
122
  vec3 forward = normalize(cross(localUp, right));
123
123
  mat3 tbn = mat3(right, forward, localUp);
124
124
  vec3 tNormal = normalize(normal * tbn);
125
125
  gl_FragColor = vec4(vec3(0.5) + 0.5 * tNormal, 0.0);
126
- `:U`
126
+ `:$`
127
127
  vec3 tNormal = normalize(normal);
128
128
  gl_FragColor = vec4(vec3(0.5) + 0.5 * tNormal, 0.0);
129
129
  `:""}
130
- ${r.tileBorders?U`
130
+ ${r.tileBorders?$`
131
131
  vec2 dVuv = fwidth(vuv0);
132
132
  vec2 edgeFactors = smoothstep(vec2(0.0), 1.5 * dVuv, min(vuv0, 1.0 - vuv0));
133
133
  float edgeFactor = 1.0 - min(edgeFactors.x, edgeFactors.y);
134
134
  gl_FragColor = mix(gl_FragColor, vec4(1.0, 0.0, 0.0, 1.0), edgeFactor);`:""}
135
135
  gl_FragColor = highlightSlice(gl_FragColor, vpos);
136
136
  }
137
- `)}break;case d.Depth:q&&a.include(_,r),a.include(w,r),t(a),n(a),z.code.add(U`
137
+ `)}break;case d.Depth:H&&i.include(_,r),i.include(w,r),t(i),n(i),T.code.add($`
138
138
  void main(void) {
139
- ${q?U`setOverlayVTC(getUV0());`:""}
139
+ ${H?$`setOverlayVTC(getUV0());`:""}
140
140
  gl_Position = transformPositionWithDepth(proj, view, position, nearFar, linearDepth);
141
141
  }
142
- `),B.code.add(U`
142
+ `),A.code.add($`
143
143
  void main() {
144
- ${q&&r.invisible?U`if (getCombinedOverlayColor().a == 0.0) { discard; }`:""}
144
+ ${H&&r.invisible?$`if (getCombinedOverlayColor().a == 0.0) { discard; }`:""}
145
145
  outputDepth(linearDepth);
146
146
  }
147
- `);break;case d.Shadow:case d.ShadowHighlight:case d.ShadowExcludeHighlight:a.include(w,r),t(a),n(a),z.code.add(U`void main(void) {
147
+ `);break;case d.Shadow:case d.ShadowHighlight:case d.ShadowExcludeHighlight:i.include(w,r),t(i),n(i),T.code.add($`void main(void) {
148
148
  gl_Position = transformPositionWithDepth(proj, view, position, nearFar, linearDepth);
149
- }`),B.code.add(U`void main() {
149
+ }`),A.code.add($`void main() {
150
150
  outputDepth(linearDepth);
151
- }`);break;case d.Normal:q&&a.include(_,r),E.add("vnormal","vec3"),M(z),I(),z.code.add(U`
151
+ }`);break;case d.Normal:H&&i.include(_,r),k.add("vnormal","vec3"),M(T),G(),T.code.add($`
152
152
  void main(void) {
153
- ${q?U`setOverlayVTC(getUV0());`:""}
153
+ ${H?$`setOverlayVTC(getUV0());`:""}
154
154
  gl_Position = transformPosition(proj, view, position);
155
155
  vnormal = normalize((viewNormal * vec4(getNormal(), 1.0)).xyz);
156
156
  }
157
- `),B.code.add(U`
157
+ `),A.code.add($`
158
158
  void main() {
159
- ${q&&r.invisible?U`if (getCombinedOverlayColor().a == 0.0) { discard; }`:""}
159
+ ${H&&r.invisible?$`if (getCombinedOverlayColor().a == 0.0) { discard; }`:""}
160
160
  vec3 normal = normalize(vnormal);
161
161
  if (gl_FrontFacing == false) {
162
162
  normal = -normal;
163
163
  }
164
164
  gl_FragColor = vec4(vec3(0.5) + 0.5 * normal, 0.0);
165
165
  }
166
- `);break;case d.Highlight:q&&a.include(_,r),z.code.add(U`
166
+ `);break;case d.Highlight:H&&i.include(_,r),T.code.add($`
167
167
  void main() {
168
- ${q?U`setOverlayVTC(getUV0());`:""}
168
+ ${H?$`setOverlayVTC(getUV0());`:""}
169
169
  gl_Position = transformPosition(proj, view, position);
170
170
  }
171
- `),a.include(u,r),B.code.add(U`
171
+ `),i.include(u,r),A.code.add($`
172
172
  void main() {
173
- ${q?U`if (getCombinedOverlayColor().a == 0.0) { discard; }`:""}
173
+ ${H?$`if (getCombinedOverlayColor().a == 0.0) { discard; }`:""}
174
174
  outputHighlight();
175
175
  }
176
- `)}return r.output===d.ObjectAndLayerIdColor&&(a.include(_,{...r,pbrMode:S.Disabled}),z.code.add(U`void main(void) {
176
+ `)}return r.output===d.ObjectAndLayerIdColor&&(i.include(_,{...r,pbrMode:S.Disabled}),T.code.add($`void main(void) {
177
177
  gl_Position = transformPosition(proj, view, position);
178
178
  setOverlayVTC(getUV0());
179
- }`),B.code.add(U`
180
- void main() {
181
- vec2 texDim = ${D(r,"ovColorTex")};
182
- gl_FragColor = ${$(r,"ovColorTex","vec2(vtcOverlay.x * 0.5, vtcOverlay.y)*texDim")};
183
- }
184
- `)),a}const G=r(),H=a(),I=Object.freeze(Object.defineProperty({__proto__:null,TerrainPassParameters:B,build:E},Symbol.toStringTag,{value:"Module"}));export{B as T,I as a,E as b};
179
+ }`),A.code.add($`void main() {
180
+ gl_FragColor = getOverlayColorTexel(vtcOverlay);
181
+ }`)),i}const B=r(),E=i(),G=Object.freeze(Object.defineProperty({__proto__:null,TerrainPassParameters:A,build:k},Symbol.toStringTag,{value:"Module"}));export{A as T,G as a,k as b};
package/config.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={analysisTheme:{accentColor:[255,128,0],textColor:"white"},apiKey:void 0,applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!1,portalUrl:"https://www.arcgis.com",routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:6e4,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="4.26.1";s.assetsPath=`https://js.arcgis.com/${e.slice(0,-2)}/@arcgis/core/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
5
+ import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={analysisTheme:{accentColor:[255,128,0],textColor:"white"},apiKey:void 0,applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!1,portalUrl:"https://www.arcgis.com",routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:6e4,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="4.26.3";s.assetsPath=`https://js.arcgis.com/${e.slice(0,-2)}/@arcgis/core/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
package/core/string.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{getDeepValue as t}from"./object.js";const e=/\{([^\}]+)\}/g;function r(t){return t??""}function n(n,o){return n.replace(e,"object"==typeof o?(e,n)=>r(t(n,o)):(t,e)=>r(o(e)))}function o(t,e){return t.replace(/([\.$?*|{}\(\)\[\]\\\/\+\-^])/g,(t=>e&&e.includes(t)?t:`\\${t}`))}function c(t){let e=0;for(let r=0;r<t.length;r++)e=(e<<5)-e+t.charCodeAt(r),e|=0;return e}function u(t){return(new DOMParser).parseFromString(t||"","text/html").body.innerText||""}export{o as escapeRegExpString,c as numericHash,n as replace,u as stripHTML};
5
+ import{getDeepValue as t}from"./object.js";const e=/\{([^\}]+)\}/g;function n(t){return t??""}function r(r,o){return r.replace(e,"object"==typeof o?(e,r)=>n(t(r,o)):(t,e)=>n(o(e)))}function o(t,e){return t.replace(/([\.$?*|{}\(\)\[\]\\\/\+\-^])/g,(t=>e&&e.includes(t)?t:`\\${t}`))}function c(t){let e=0;for(let n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n),e|=0;return e}function u(t){return(new DOMParser).parseFromString(t||"","text/html").body.innerText||""}function i(t,e){return new RegExp(`{${e}}`,"ig").test(t)}export{o as escapeRegExpString,c as numericHash,r as replace,u as stripHTML,i as templateHasKey};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Error.js";import{JSONSupport as s}from"../../core/JSONSupport.js";import{clone as i}from"../../core/lang.js";import r from"../../core/Logger.js";import{isSome as l,isNone as o}from"../../core/maybe.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import{cast as h}from"../../core/accessorSupport/decorators/cast.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{SimpleBandStatistics as p}from"./SimpleBandStatistics.js";import{getPixelValueRange as c}from"./rasterFormats/pixelRangeUtils.js";var u;let g=u=class extends s{static createEmptyBand(t,e){return new(u.getPixelArrayConstructor(t))(e)}static getPixelArrayConstructor(t){let e;switch(t){case"u1":case"u2":case"u4":case"u8":e=Uint8Array;break;case"u16":e=Uint16Array;break;case"u32":e=Uint32Array;break;case"s8":e=Int8Array;break;case"s16":e=Int16Array;break;case"s32":e=Int32Array;break;case"f32":case"c64":case"c128":case"unknown":e=Float32Array;break;case"f64":e=Float64Array}return e}constructor(t){super(t),this.width=null,this.height=null,this.pixelType="f32",this.validPixelCount=null,this.mask=null,this.maskIsAlpha=!1,this.statistics=null,this.depthCount=1}castPixelType(t){if(!t)return"f32";let e=t.toLowerCase();return["u1","u2","u4"].includes(e)?e="u8":["unknown","u8","s8","u16","s16","u32","s32","f32","f64"].includes(e)||(e="f32"),e}getPlaneCount(){return this.pixels?.length}addData(t){if(!t.pixels||t.pixels.length!==this.width*this.height)throw new e("pixelblock:invalid-or-missing-pixels","add data requires valid pixels array that has same length defined by pixel block width * height");this.pixels||(this.pixels=[]),this.statistics||(this.statistics=[]),this.pixels.push(t.pixels),this.statistics.push(t.statistics??new p)}getAsRGBA(){const t=new ArrayBuffer(this.width*this.height*4);switch(this.pixelType){case"s8":case"s16":case"u16":case"s32":case"u32":case"f32":case"f64":this._fillFromNon8Bit(t);break;default:this._fillFrom8Bit(t)}return new Uint8ClampedArray(t)}getAsRGBAFloat(){const t=new Float32Array(this.width*this.height*4);return this._fillFrom32Bit(t),t}updateStatistics(){if(!this.pixels)return;this.statistics=this.pixels.map((t=>this._calculateBandStatistics(t,this.mask)));const t=this.mask;let e=0;if(l(t))for(let s=0;s<t.length;s++)t[s]&&e++;else e=this.width*this.height;this.validPixelCount=e}clamp(t){if(!t||"f64"===t||"f32"===t||!this.pixels)return;const[e,s]=c(t),i=this.pixels,r=this.width*this.height,l=i.length;let o,a,h;const n=[];for(let p=0;p<l;p++){h=u.createEmptyBand(t,r),o=i[p];for(let t=0;t<r;t++)a=o[t],h[t]=a>s?s:a<e?e:a;n.push(h)}this.pixels=n,this.pixelType=t}extractBands(t){const{pixels:e,statistics:s}=this;if(o(t)||0===t.length||!e||0===e.length)return this;const i=e.length,r=t.some((t=>t>=e.length)),l=i===t.length&&!t.some(((t,e)=>t!==e));return r||l?this:new u({pixelType:this.pixelType,width:this.width,height:this.height,mask:this.mask,validPixelCount:this.validPixelCount,maskIsAlpha:this.maskIsAlpha,pixels:t.map((t=>e[t])),statistics:s&&t.map((t=>s[t]))})}clone(){const t=new u({width:this.width,height:this.height,pixelType:this.pixelType,maskIsAlpha:this.maskIsAlpha,validPixelCount:this.validPixelCount});let e;l(this.mask)&&(this.mask instanceof Uint8Array?t.mask=new Uint8Array(this.mask):t.mask=this.mask.slice(0));const s=u.getPixelArrayConstructor(this.pixelType);if(this.pixels&&this.pixels.length>0){t.pixels=[];const i=!!this.pixels[0].slice;for(e=0;e<this.pixels.length;e++)t.pixels[e]=i?this.pixels[e].slice(0,this.pixels[e].length):new s(this.pixels[e])}if(this.statistics)for(t.statistics=[],e=0;e<this.statistics.length;e++)t.statistics[e]=i(this.statistics[e]);return t}_fillFrom8Bit(t){const{mask:e,maskIsAlpha:s,pixels:i}=this;if(!t||!i||!i.length)return void r.getLogger(this.declaredClass).error("getAsRGBA()","Unable to convert to RGBA. The input pixel block is empty.");let o,a,h,n;o=a=h=i[0],i.length>=3?(a=i[1],h=i[2]):2===i.length&&(a=i[1]);const p=new Uint32Array(t),c=this.width*this.height;if(o.length===c)if(l(e)&&e.length===c)if(s)for(n=0;n<c;n++){const t=e[n];if(t){const e=t/255;p[n]=t<<24|h[n]*e<<16|a[n]*e<<8|o[n]*e}}else for(n=0;n<c;n++)e[n]&&(p[n]=255<<24|h[n]<<16|a[n]<<8|o[n]);else for(n=0;n<c;n++)p[n]=255<<24|h[n]<<16|a[n]<<8|o[n];else r.getLogger(this.declaredClass).error("getAsRGBA()","Unable to convert to RGBA. The pixelblock is invalid.")}_fillFromNon8Bit(t){const{pixels:e,mask:s,statistics:i}=this;if(!t||!e||!e.length)return void r.getLogger(this.declaredClass).error("getAsRGBA()","Unable to convert to RGBA. The input pixel block is empty.");const o=this.pixelType;let a=1,h=0,n=1;if(i&&i.length>0){for(const t of i)if(null!=t.minValue&&(h=Math.min(h,t.minValue)),null!=t.maxValue&&null!=t.minValue){const e=t.maxValue-t.minValue;n=Math.max(n,e)}a=255/n}else{let t=255;"s8"===o?(h=-128,t=127):"u16"===o?t=65535:"s16"===o?(h=-32768,t=32767):"u32"===o?t=4294967295:"s32"===o?(h=-2147483648,t=2147483647):"f32"===o?(h=-34e38,t=34e38):"f64"===o&&(h=-Number.MAX_VALUE,t=Number.MAX_VALUE),a=255/(t-h)}const p=new Uint32Array(t),c=this.width*this.height;let u,g,d,f,m;if(u=g=d=e[0],u.length!==c)return r.getLogger(this.declaredClass).error("getAsRGBA()","Unable to convert to RGBA. The pixelblock is invalid.");if(e.length>=2)if(g=e[1],e.length>=3&&(d=e[2]),l(s)&&s.length===c)for(f=0;f<c;f++)s[f]&&(p[f]=255<<24|(d[f]-h)*a<<16|(g[f]-h)*a<<8|(u[f]-h)*a);else for(f=0;f<c;f++)p[f]=255<<24|(d[f]-h)*a<<16|(g[f]-h)*a<<8|(u[f]-h)*a;else if(l(s)&&s.length===c)for(f=0;f<c;f++)m=(u[f]-h)*a,s[f]&&(p[f]=255<<24|m<<16|m<<8|m);else for(f=0;f<c;f++)m=(u[f]-h)*a,p[f]=255<<24|m<<16|m<<8|m}_fillFrom32Bit(t){const{pixels:e,mask:s}=this;if(!t||!e||!e.length)return r.getLogger(this.declaredClass).error("getAsRGBAFloat()","Unable to convert to RGBA. The input pixel block is empty.");let i,o,a,h;i=o=a=e[0],e.length>=3?(o=e[1],a=e[2]):2===e.length&&(o=e[1]);const n=this.width*this.height;if(i.length!==n)return r.getLogger(this.declaredClass).error("getAsRGBAFloat()","Unable to convert to RGBA. The pixelblock is invalid.");let p=0;if(l(s)&&s.length===n)for(h=0;h<n;h++)t[p++]=i[h],t[p++]=o[h],t[p++]=a[h],t[p++]=1&s[h];else for(h=0;h<n;h++)t[p++]=i[h],t[p++]=o[h],t[p++]=a[h],t[p++]=1}_calculateBandStatistics(t,e){let s=1/0,i=-1/0;const r=t.length;let o,a=0;if(l(e))for(o=0;o<r;o++)e[o]&&(a=t[o],s=a<s?a:s,i=a>i?a:i);else for(o=0;o<r;o++)a=t[o],s=a<s?a:s,i=a>i?a:i;return new p(s,i)}};t([a({json:{write:!0}})],g.prototype,"width",void 0),t([a({json:{write:!0}})],g.prototype,"height",void 0),t([a({json:{write:!0}})],g.prototype,"pixelType",void 0),t([h("pixelType")],g.prototype,"castPixelType",null),t([a({json:{write:!0}})],g.prototype,"validPixelCount",void 0),t([a({json:{write:!0}})],g.prototype,"mask",void 0),t([a({json:{write:!0}})],g.prototype,"maskIsAlpha",void 0),t([a({json:{write:!0}})],g.prototype,"pixels",void 0),t([a({json:{write:!0}})],g.prototype,"statistics",void 0),t([a({json:{write:!0}})],g.prototype,"depthCount",void 0),t([a({json:{write:!0}})],g.prototype,"noDataValues",void 0),t([a({json:{write:!0}})],g.prototype,"bandMasks",void 0),g=u=t([n("esri.layers.support.PixelBlock")],g);const d=g;export{d as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Error.js";import{JSONSupport as s}from"../../core/JSONSupport.js";import{clone as i}from"../../core/lang.js";import l from"../../core/Logger.js";import{isSome as r,isNone as o}from"../../core/maybe.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import{cast as h}from"../../core/accessorSupport/decorators/cast.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{SimpleBandStatistics as p}from"./SimpleBandStatistics.js";import{getPixelValueRange as c}from"./rasterFormats/pixelRangeUtils.js";var u;let g=u=class extends s{static createEmptyBand(t,e){return new(u.getPixelArrayConstructor(t))(e)}static getPixelArrayConstructor(t){let e;switch(t){case"u1":case"u2":case"u4":case"u8":e=Uint8Array;break;case"u16":e=Uint16Array;break;case"u32":e=Uint32Array;break;case"s8":e=Int8Array;break;case"s16":e=Int16Array;break;case"s32":e=Int32Array;break;case"f32":case"c64":case"c128":case"unknown":e=Float32Array;break;case"f64":e=Float64Array}return e}constructor(t){super(t),this.width=null,this.height=null,this.pixelType="f32",this.validPixelCount=null,this.mask=null,this.maskIsAlpha=!1,this.premultiplyAlpha=!1,this.statistics=null,this.depthCount=1}castPixelType(t){if(!t)return"f32";let e=t.toLowerCase();return["u1","u2","u4"].includes(e)?e="u8":["unknown","u8","s8","u16","s16","u32","s32","f32","f64"].includes(e)||(e="f32"),e}getPlaneCount(){return this.pixels?.length}addData(t){if(!t.pixels||t.pixels.length!==this.width*this.height)throw new e("pixelblock:invalid-or-missing-pixels","add data requires valid pixels array that has same length defined by pixel block width * height");this.pixels||(this.pixels=[]),this.statistics||(this.statistics=[]),this.pixels.push(t.pixels),this.statistics.push(t.statistics??new p)}getAsRGBA(){const t=new ArrayBuffer(this.width*this.height*4);switch(this.pixelType){case"s8":case"s16":case"u16":case"s32":case"u32":case"f32":case"f64":this._fillFromNon8Bit(t);break;default:this._fillFrom8Bit(t)}return new Uint8ClampedArray(t)}getAsRGBAFloat(){const t=new Float32Array(this.width*this.height*4);return this._fillFrom32Bit(t),t}updateStatistics(){if(!this.pixels)return;this.statistics=this.pixels.map((t=>this._calculateBandStatistics(t,this.mask)));const t=this.mask;let e=0;if(r(t))for(let s=0;s<t.length;s++)t[s]&&e++;else e=this.width*this.height;this.validPixelCount=e}clamp(t){if(!t||"f64"===t||"f32"===t||!this.pixels)return;const[e,s]=c(t),i=this.pixels,l=this.width*this.height,r=i.length;let o,a,h;const n=[];for(let p=0;p<r;p++){h=u.createEmptyBand(t,l),o=i[p];for(let t=0;t<l;t++)a=o[t],h[t]=a>s?s:a<e?e:a;n.push(h)}this.pixels=n,this.pixelType=t}extractBands(t){const{pixels:e,statistics:s}=this;if(o(t)||0===t.length||!e||0===e.length)return this;const i=e.length,l=t.some((t=>t>=e.length)),r=i===t.length&&!t.some(((t,e)=>t!==e));return l||r?this:new u({pixelType:this.pixelType,width:this.width,height:this.height,mask:this.mask,validPixelCount:this.validPixelCount,maskIsAlpha:this.maskIsAlpha,pixels:t.map((t=>e[t])),statistics:s&&t.map((t=>s[t]))})}clone(){const t=new u({width:this.width,height:this.height,pixelType:this.pixelType,maskIsAlpha:this.maskIsAlpha,validPixelCount:this.validPixelCount});let e;r(this.mask)&&(this.mask instanceof Uint8Array?t.mask=new Uint8Array(this.mask):t.mask=this.mask.slice(0));const s=u.getPixelArrayConstructor(this.pixelType);if(this.pixels&&this.pixels.length>0){t.pixels=[];const i=!!this.pixels[0].slice;for(e=0;e<this.pixels.length;e++)t.pixels[e]=i?this.pixels[e].slice(0,this.pixels[e].length):new s(this.pixels[e])}if(this.statistics)for(t.statistics=[],e=0;e<this.statistics.length;e++)t.statistics[e]=i(this.statistics[e]);return t.premultiplyAlpha=this.premultiplyAlpha,t}_fillFrom8Bit(t){const{mask:e,maskIsAlpha:s,premultiplyAlpha:i,pixels:o}=this;if(!t||!o||!o.length)return void l.getLogger(this.declaredClass).error("getAsRGBA()","Unable to convert to RGBA. The input pixel block is empty.");let a,h,n,p;a=h=n=o[0],o.length>=3?(h=o[1],n=o[2]):2===o.length&&(h=o[1]);const c=new Uint32Array(t),u=this.width*this.height;if(a.length===u)if(r(e)&&e.length===u)if(s)for(p=0;p<u;p++){const t=e[p];if(t){const e=t/255;c[p]=i?t<<24|n[p]*e<<16|h[p]*e<<8|a[p]*e:t<<24|n[p]<<16|h[p]<<8|a[p]}}else for(p=0;p<u;p++)e[p]&&(c[p]=255<<24|n[p]<<16|h[p]<<8|a[p]);else for(p=0;p<u;p++)c[p]=255<<24|n[p]<<16|h[p]<<8|a[p];else l.getLogger(this.declaredClass).error("getAsRGBA()","Unable to convert to RGBA. The pixelblock is invalid.")}_fillFromNon8Bit(t){const{pixels:e,mask:s,statistics:i}=this;if(!t||!e||!e.length)return void l.getLogger(this.declaredClass).error("getAsRGBA()","Unable to convert to RGBA. The input pixel block is empty.");const o=this.pixelType;let a=1,h=0,n=1;if(i&&i.length>0){for(const t of i)if(null!=t.minValue&&(h=Math.min(h,t.minValue)),null!=t.maxValue&&null!=t.minValue){const e=t.maxValue-t.minValue;n=Math.max(n,e)}a=255/n}else{let t=255;"s8"===o?(h=-128,t=127):"u16"===o?t=65535:"s16"===o?(h=-32768,t=32767):"u32"===o?t=4294967295:"s32"===o?(h=-2147483648,t=2147483647):"f32"===o?(h=-34e38,t=34e38):"f64"===o&&(h=-Number.MAX_VALUE,t=Number.MAX_VALUE),a=255/(t-h)}const p=new Uint32Array(t),c=this.width*this.height;let u,g,m,d,f;if(u=g=m=e[0],u.length!==c)return l.getLogger(this.declaredClass).error("getAsRGBA()","Unable to convert to RGBA. The pixelblock is invalid.");if(e.length>=2)if(g=e[1],e.length>=3&&(m=e[2]),r(s)&&s.length===c)for(d=0;d<c;d++)s[d]&&(p[d]=255<<24|(m[d]-h)*a<<16|(g[d]-h)*a<<8|(u[d]-h)*a);else for(d=0;d<c;d++)p[d]=255<<24|(m[d]-h)*a<<16|(g[d]-h)*a<<8|(u[d]-h)*a;else if(r(s)&&s.length===c)for(d=0;d<c;d++)f=(u[d]-h)*a,s[d]&&(p[d]=255<<24|f<<16|f<<8|f);else for(d=0;d<c;d++)f=(u[d]-h)*a,p[d]=255<<24|f<<16|f<<8|f}_fillFrom32Bit(t){const{pixels:e,mask:s}=this;if(!t||!e||!e.length)return l.getLogger(this.declaredClass).error("getAsRGBAFloat()","Unable to convert to RGBA. The input pixel block is empty.");let i,o,a,h;i=o=a=e[0],e.length>=3?(o=e[1],a=e[2]):2===e.length&&(o=e[1]);const n=this.width*this.height;if(i.length!==n)return l.getLogger(this.declaredClass).error("getAsRGBAFloat()","Unable to convert to RGBA. The pixelblock is invalid.");let p=0;if(r(s)&&s.length===n)for(h=0;h<n;h++)t[p++]=i[h],t[p++]=o[h],t[p++]=a[h],t[p++]=1&s[h];else for(h=0;h<n;h++)t[p++]=i[h],t[p++]=o[h],t[p++]=a[h],t[p++]=1}_calculateBandStatistics(t,e){let s=1/0,i=-1/0;const l=t.length;let o,a=0;if(r(e))for(o=0;o<l;o++)e[o]&&(a=t[o],s=a<s?a:s,i=a>i?a:i);else for(o=0;o<l;o++)a=t[o],s=a<s?a:s,i=a>i?a:i;return new p(s,i)}};t([a({json:{write:!0}})],g.prototype,"width",void 0),t([a({json:{write:!0}})],g.prototype,"height",void 0),t([a({json:{write:!0}})],g.prototype,"pixelType",void 0),t([h("pixelType")],g.prototype,"castPixelType",null),t([a({json:{write:!0}})],g.prototype,"validPixelCount",void 0),t([a({json:{write:!0}})],g.prototype,"mask",void 0),t([a({json:{write:!0}})],g.prototype,"maskIsAlpha",void 0),t([a({json:{write:!0}})],g.prototype,"pixels",void 0),t([a()],g.prototype,"premultiplyAlpha",void 0),t([a({json:{write:!0}})],g.prototype,"statistics",void 0),t([a({json:{write:!0}})],g.prototype,"depthCount",void 0),t([a({json:{write:!0}})],g.prototype,"noDataValues",void 0),t([a({json:{write:!0}})],g.prototype,"bandMasks",void 0),g=u=t([n("esri.layers.support.PixelBlock")],g);const m=g;export{m 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.26/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../chunks/tslib.es6.js";import{isNone as e}from"../../../core/maybe.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{convolutionKernel as r}from"../rasterFunctionConstants.js";import{getPixelValueRange as n}from"../rasterFormats/pixelRangeUtils.js";import i from"./BaseRasterFunction.js";import u from"./ConvolutionFunctionArguments.js";import{convolute as c}from"./convolutionUtils.js";const p=25;let l=class extends i{constructor(){super(...arguments),this.functionName="Convolution",this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{convolutionType:t,rows:e,cols:o,kernel:s}=this.functionArguments;if(!Object.values(r).includes[t])return{success:!1,supportsGPU:!1,error:`convolution-function: the specified kernel type is not supported ${t}`};if(t!==r.none&&e*o!==s.length)return{success:!1,supportsGPU:!1,error:"convolution-function: the specified rows and cols do not match the length of the kernel"};const n=this.sourceRasterInfos[0];this.outputPixelType=this._getOutputPixelType(n.pixelType);const i=n.clone();i.pixelType=this.outputPixelType;const u=[r.none,r.sharpen,r.sharpen2,r.sharpening3x3,r.sharpening5x5];"u8"===this.outputPixelType||u.includes(t)||(i.statistics=null,i.histograms=null),i.colormap=null,i.attributeTable=null,this.rasterInfo=i;return{success:!0,supportsGPU:s.length<=p}}_processPixels(t){const o=t.pixelBlocks?.[0];if(e(o)||this.functionArguments.convolutionType===r.none)return o;let{kernel:s,rows:n,cols:i}=this.functionArguments;const u=s.reduce(((t,e)=>t+e));return 0!==u&&1!==u&&(s=s.map((t=>t/u))),c(o,{kernel:s,rows:n,cols:i,outputPixelType:this.outputPixelType})}_getWebGLParameters(){let{kernel:t}=this.functionArguments;const e=t.reduce(((t,e)=>t+e));0!==e&&1!==e&&(t=t.map((t=>t/e)));const o=new Float32Array(p);return o.set(t),{kernelRows:this.functionArguments.rows,kernelCols:this.functionArguments.cols,kernel:o,clampRange:n(this.outputPixelType)}}};t([o({json:{write:!0,name:"rasterFunction"}})],l.prototype,"functionName",void 0),t([o({type:u,json:{write:!0,name:"rasterFunctionArguments"}})],l.prototype,"functionArguments",void 0),t([o()],l.prototype,"rasterArgumentNames",void 0),l=t([s("esri.layers.support.rasterFunctions.ConvolutionFunction")],l);const a=l;export{a as default};
5
+ import{_ as t}from"../../../chunks/tslib.es6.js";import{isNone as e}from"../../../core/maybe.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{convolutionKernel as r}from"../rasterFunctionConstants.js";import{getPixelValueRange as n}from"../rasterFormats/pixelRangeUtils.js";import i from"./BaseRasterFunction.js";import u from"./ConvolutionFunctionArguments.js";import{convolute as c}from"./convolutionUtils.js";const p=25;let l=class extends i{constructor(){super(...arguments),this.functionName="Convolution",this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{convolutionType:t,rows:e,cols:o,kernel:s}=this.functionArguments;if(!Object.values(r).includes(t))return{success:!1,supportsGPU:!1,error:`convolution-function: the specified kernel type is not supported ${t}`};if(t!==r.none&&e*o!==s.length)return{success:!1,supportsGPU:!1,error:"convolution-function: the specified rows and cols do not match the length of the kernel"};const n=this.sourceRasterInfos[0];this.outputPixelType=this._getOutputPixelType(n.pixelType);const i=n.clone();i.pixelType=this.outputPixelType;const u=[r.none,r.sharpen,r.sharpen2,r.sharpening3x3,r.sharpening5x5];"u8"===this.outputPixelType||u.includes(t)||(i.statistics=null,i.histograms=null),i.colormap=null,i.attributeTable=null,this.rasterInfo=i;return{success:!0,supportsGPU:s.length<=p}}_processPixels(t){const o=t.pixelBlocks?.[0];if(e(o)||this.functionArguments.convolutionType===r.none)return o;let{kernel:s,rows:n,cols:i}=this.functionArguments;const u=s.reduce(((t,e)=>t+e));return 0!==u&&1!==u&&(s=s.map((t=>t/u))),c(o,{kernel:s,rows:n,cols:i,outputPixelType:this.outputPixelType})}_getWebGLParameters(){let{kernel:t}=this.functionArguments;const e=t.reduce(((t,e)=>t+e));0!==e&&1!==e&&(t=t.map((t=>t/e)));const o=new Float32Array(p);return o.set(t),{kernelRows:this.functionArguments.rows,kernelCols:this.functionArguments.cols,kernel:o,clampRange:n(this.outputPixelType)}}};t([o({json:{write:!0,name:"rasterFunction"}})],l.prototype,"functionName",void 0),t([o({type:u,json:{write:!0,name:"rasterFunctionArguments"}})],l.prototype,"functionArguments",void 0),t([o()],l.prototype,"rasterArgumentNames",void 0),l=t([s("esri.layers.support.rasterFunctions.ConvolutionFunction")],l);const a=l;export{a as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.26.1",
3
+ "version": "4.26.3",
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": [
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- const a="20230223",b="0854ba88dc8b0906b08c4ba3bef443356a6da5ad";export{a as buildDate,b as commitHash};
5
+ const c="20230227",f="2ffb373909cc330536324a33c00959f98d434afa";export{c as buildDate,f 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.26/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as e,isNone as t}from"../../../core/maybe.js";class i{constructor(e,t,i){this.pixelBlock=e,this.extent=t,this.originalPixelBlock=i}get width(){return e(this.pixelBlock)?this.pixelBlock.width:0}get height(){return e(this.pixelBlock)?this.pixelBlock.height:0}render(e){const i=this.pixelBlock;if(t(i))return;const l=this.filter({extent:this.extent,pixelBlock:this.originalPixelBlock??i});if(t(l.pixelBlock))return;const o=l.pixelBlock.getAsRGBA(),r=e.createImageData(l.pixelBlock.width,l.pixelBlock.height);r.data.set(o),e.putImageData(r,0,0)}getRenderedRasterPixels(){const e=this.filter({extent:this.extent,pixelBlock:this.pixelBlock});return t(e.pixelBlock)?null:{width:e.pixelBlock.width,height:e.pixelBlock.height,renderedRasterPixels:new Uint8Array(e.pixelBlock.getAsRGBA().buffer)}}}export{i as default};
5
+ import{isSome as e,isNone as t}from"../../../core/maybe.js";class l{constructor(e,t,l){this.pixelBlock=e,this.extent=t,this.originalPixelBlock=l}get width(){return e(this.pixelBlock)?this.pixelBlock.width:0}get height(){return e(this.pixelBlock)?this.pixelBlock.height:0}render(e){const l=this.pixelBlock;if(t(l))return;const i=this.filter({extent:this.extent,pixelBlock:this.originalPixelBlock??l});if(t(i.pixelBlock))return;i.pixelBlock.maskIsAlpha&&(i.pixelBlock.premultiplyAlpha=!0);const o=i.pixelBlock.getAsRGBA(),s=e.createImageData(i.pixelBlock.width,i.pixelBlock.height);s.data.set(o),e.putImageData(s,0,0)}getRenderedRasterPixels(){const e=this.filter({extent:this.extent,pixelBlock:this.pixelBlock});return t(e.pixelBlock)?null:(e.pixelBlock.maskIsAlpha&&(e.pixelBlock.premultiplyAlpha=!0),{width:e.pixelBlock.width,height:e.pixelBlock.height,renderedRasterPixels:new Uint8Array(e.pixelBlock.getAsRGBA().buffer)})}}export{l 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.26/esri/copyright.txt for details.
4
4
  */
5
- import{C as e}from"../../../chunks/CloudsComposition.glsl.js";import{ReloadableShaderModule as r}from"../webgl-engine/core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as i}from"../webgl-engine/core/shaderTechnique/ShaderTechnique.js";import{ShaderTechniqueConfiguration as o}from"../webgl-engine/core/shaderTechnique/ShaderTechniqueConfiguration.js";import{Default3D as n}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{Program as t}from"../webgl-engine/lib/Program.js";import{BlendFactor as s,CompareFunction as l}from"../../webgl/enums.js";import{makePipelineState as m,simpleBlendingParams as a,defaultColorWriteParams as g}from"../../webgl/renderState.js";class u extends i{constructor(e){super(e,new o,(()=>this.destroy()))}initializeProgram(e){return new t(e.rctx,u.shader.get().build(),n)}initializePipeline(){return m({blending:a(s.ONE,s.SRC_ALPHA),depthTest:{func:l.LEQUAL},colorWrite:g})}}u.shader=new r(e,(()=>import("./CloudsComposition.glsl.js")));export{u as CloudsCompositionTechnique};
5
+ import{C as e}from"../../../chunks/CloudsComposition.glsl.js";import{ReloadableShaderModule as r}from"../webgl-engine/core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as i}from"../webgl-engine/core/shaderTechnique/ShaderTechnique.js";import{ShaderTechniqueConfiguration as o}from"../webgl-engine/core/shaderTechnique/ShaderTechniqueConfiguration.js";import{Default3D as n}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{Program as t}from"../webgl-engine/lib/Program.js";import{BlendFactor as s,CompareFunction as l}from"../../webgl/enums.js";import{makePipelineState as m,separateBlendingParams as a,defaultColorWriteParams as g}from"../../webgl/renderState.js";class u extends i{constructor(e){super(e,new o,(()=>this.destroy()))}initializeProgram(e){return new t(e.rctx,u.shader.get().build(),n)}initializePipeline(){return m({blending:a(s.ONE,s.ZERO,s.SRC_ALPHA,s.ONE),depthTest:{func:l.LEQUAL},colorWrite:g})}}u.shader=new r(e,(()=>import("./CloudsComposition.glsl.js")));export{u as CloudsCompositionTechnique};
@@ -2,9 +2,9 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{c as e}from"../../../../../../chunks/vec4f64.js";import{area as o,width as r,height as t}from"../../../../../../geometry/support/aaBoundingRect.js";import{OverlayIndex as a,RenderTargetType as i}from"../../../../terrain/interfaces.js";import{RenderPassIdentifier as n}from"../../renderPasses/AllRenderPasses.js";import{ShaderOutput as s}from"../ShaderOutput.js";import{addMainLightDirection as d,addMainLightIntensity as l}from"../shading/MainLighting.glsl.js";import{PBRMode as c}from"../shading/PhysicallyBasedRenderingParameters.glsl.js";import{Water as v}from"../shading/Water.glsl.js";import{Float4DrawUniform as p}from"../../shaderModules/Float4DrawUniform.js";import{glsl as u}from"../../shaderModules/interfaces.js";import{Texture2DPassUniform as f}from"../../shaderModules/Texture2DPassUniform.js";var x;function m(e,o){const{vertex:r,fragment:t}=e;r.uniforms.add([new p("overlayTexOffset",((e,o)=>h(e,o))),new p("overlayTexScale",((e,o)=>C(e,o)))]),t.constants.add("overlayOpacity","float",1),t.uniforms.add(new f("ovColorTex",((e,o)=>g(e,o)))),y(e,o)}function y(e,o){e.extensions.add("GL_OES_standard_derivatives"),o.pbrMode!==c.Water&&o.pbrMode!==c.WaterOnIntegratedMesh&&o.pbrMode!==c.TerrainWithWater||e.include(v,o);const{vertex:r,fragment:t}=e;e.varyings.add("vtcOverlay","vec4"),r.code.add(u`void setOverlayVTC(in vec2 uv) {
5
+ import{c as e}from"../../../../../../chunks/vec4f64.js";import{area as o,width as r,height as t}from"../../../../../../geometry/support/aaBoundingRect.js";import{OverlayIndex as a,RenderTargetType as i}from"../../../../terrain/interfaces.js";import{OverlaySource as l}from"../../../../terrain/Overlay.js";import{RenderPassIdentifier as d}from"../../renderPasses/AllRenderPasses.js";import{ShaderOutput as s}from"../ShaderOutput.js";import{addMainLightDirection as n,addMainLightIntensity as c}from"../shading/MainLighting.glsl.js";import{PBRMode as v}from"../shading/PhysicallyBasedRenderingParameters.glsl.js";import{Water as x}from"../shading/Water.glsl.js";import{textureSize as u,texelFetch as p}from"../util/WebGL2Utils.js";import{Float4DrawUniform as f}from"../../shaderModules/Float4DrawUniform.js";import{glsl as m}from"../../shaderModules/interfaces.js";import{Texture2DPassUniform as y}from"../../shaderModules/Texture2DPassUniform.js";var C;function g(e,o){const{vertex:r,fragment:t}=e;r.uniforms.add([new f("overlayTexOffset",((e,o)=>O(e,o))),new f("overlayTexScale",((e,o)=>T(e,o)))]),t.constants.add("overlayOpacity","float",1),t.uniforms.add(new y("ovColorTex",((e,o)=>b(e,o)))),h(e,o)}function h(e,o){e.extensions.add("GL_OES_standard_derivatives"),o.pbrMode!==v.Water&&o.pbrMode!==v.WaterOnIntegratedMesh&&o.pbrMode!==v.TerrainWithWater||e.include(x,o);const{vertex:r,fragment:t}=e;e.varyings.add("vtcOverlay","vec4"),r.code.add(m`void setOverlayVTC(in vec2 uv) {
6
6
  vtcOverlay = vec4(uv, uv) * overlayTexScale + overlayTexOffset;
7
- }`),t.code.add(u`bool isValid(vec2 uv, vec2 dxdy) {
7
+ }`),t.code.add(m`bool isValid(vec2 uv, vec2 dxdy) {
8
8
  return (uv.x >= 0.0 + dxdy.x) && (uv.x <= 1.0 - dxdy.x) && (uv.y >= 0.0 + dxdy.y) && (uv.y <= 1.0 - dxdy.y);
9
9
  }
10
10
  vec4 getOverlayColor(sampler2D ov0Tex, vec4 texCoords) {
@@ -13,12 +13,24 @@ vec4 color1 = texture2D(ov0Tex, vec2(texCoords.z * 0.5 + 0.5, texCoords.w));
13
13
  bool isValid0 = isValid(texCoords.xy, fwidth(texCoords.xy));
14
14
  bool isValid1 = isValid(texCoords.zw, vec2(0.0, 0.0));
15
15
  return mix(color1 * float(isValid1), color0, float(isValid0));
16
- }`),t.code.add(u`vec4 getCombinedOverlayColor() {
16
+ }`),t.code.add(m`vec4 getCombinedOverlayColor() {
17
17
  return overlayOpacity * getOverlayColor(ovColorTex, vtcOverlay);
18
- }`),o.pbrMode!==c.Water&&o.pbrMode!==c.WaterOnIntegratedMesh&&o.pbrMode!==c.TerrainWithWater||(d(t),l(t),t.code.add(u`vec4 getOverlayWaterColor(vec4 maskInput, vec4 colorInput, vec3 vposEyeDir,
18
+ }`),t.code.add(m`
19
+ vec4 getOverlayColorTexel(vec4 texCoords) {
20
+ vec2 texDim = ${u(o,"ovColorTex")};
21
+
22
+ vec4 color0 = ${p(o,"ovColorTex","vec2(texCoords.x * 0.5, texCoords.y)*texDim")};
23
+ vec4 color1 = ${p(o,"ovColorTex","vec2(texCoords.z * 0.5 + 0.5, texCoords.w)*texDim")};
24
+
25
+ bool isValid0 = isValid(texCoords.xy, fwidth(texCoords.xy));
26
+ bool isValid1 = isValid(texCoords.zw, vec2(0.0, 0.0));
27
+
28
+ return mix(color1 * float(isValid1), color0, float(isValid0));
29
+ }
30
+ `),o.pbrMode!==v.Water&&o.pbrMode!==v.WaterOnIntegratedMesh&&o.pbrMode!==v.TerrainWithWater||(n(t),c(t),t.code.add(m`vec4 getOverlayWaterColor(vec4 maskInput, vec4 colorInput, vec3 vposEyeDir,
19
31
  float shadow, vec3 localUp, mat3 tbn, vec3 position, vec3 positionWorld) {
20
32
  vec3 n = normalize(tbn * (2.0 * maskInput.rgb - vec3(1.0)));
21
33
  vec3 v = vposEyeDir;
22
34
  vec3 final = getSeaColor(n, v, mainLightDirection, colorInput.rgb, mainLightIntensity, localUp, 1.0 - shadow, maskInput.w, position, positionWorld);
23
35
  return vec4(final, colorInput.w);
24
- }`))}function g(e,o){return 0===o.overlays.length?null:e.identifier===n.Material&&e.output===s.Color?o.overlays[a.INNER].getColorTextureNoRasterImage():e.identifier===n.Highlight?o.overlays[a.INNER].getValidTexture(i.Highlight):null}function h(e,a){for(const i of a.overlays){const{index:a,extent:n}=i;o(n)>0&&(b[2*a]=e.toMapSpace[0]/r(n)-n[0]/r(n),b[2*a+1]=e.toMapSpace[1]/t(n)-n[1]/t(n))}return b}function C(e,a){for(const i of a.overlays){const{index:a,extent:n}=i;o(n)>0&&(b[2*a]=e.toMapSpace[2]/r(n),b[2*a+1]=e.toMapSpace[3]/t(n))}return b}!function(e){e[e.Disabled=0]="Disabled",e[e.Enabled=1]="Enabled",e[e.EnabledWithWater=2]="EnabledWithWater",e[e.COUNT=3]="COUNT"}(x||(x={}));const b=e();export{m as OverlayIM,x as OverlayMode,g as getColorTexture,y as overlay};
36
+ }`))}function b(e,o){return 0===o.overlays.length?null:e.identifier===d.Material&&e.output===s.Color?o.overlays[a.INNER].getColorTextureNoRasterImage():e.identifier===d.Material&&e.output===s.ObjectAndLayerIdColor?o.overlays[a.INNER].getColorTexture(l.ObjectAndLayerIdColor):e.identifier===d.Highlight?o.overlays[a.INNER].getValidTexture(i.Highlight):null}function O(e,a){for(const i of a.overlays){const{index:a,extent:l}=i;o(l)>0&&(M[2*a]=e.toMapSpace[0]/r(l)-l[0]/r(l),M[2*a+1]=e.toMapSpace[1]/t(l)-l[1]/t(l))}return M}function T(e,a){for(const i of a.overlays){const{index:a,extent:l}=i;o(l)>0&&(M[2*a]=e.toMapSpace[2]/r(l),M[2*a+1]=e.toMapSpace[3]/t(l))}return M}!function(e){e[e.Disabled=0]="Disabled",e[e.Enabled=1]="Enabled",e[e.EnabledWithWater=2]="EnabledWithWater",e[e.COUNT=3]="COUNT"}(C||(C={}));const M=e();export{g as OverlayIM,C as OverlayMode,b as getColorTexture,h as overlay};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../../../chunks/mat4.js";import"../../../../../../chunks/mat4f64.js";import"../../../../../../chunks/vec3.js";import"../../../../../../chunks/vec3f64.js";import"../../../../terrain/interfaces.js";import"../ForwardLinearDepth.glsl.js";import"../ShaderOutput.js";import"../Slice.glsl.js";import"../Transform.glsl.js";import"../attributes/NormalAttribute.glsl.js";import"../attributes/PositionAttribute.glsl.js";import"../attributes/TextureCoordinateAttribute.glsl.js";import"../attributes/VertexTangent.glsl.js";import"../output/OutputDepth.glsl.js";import"../output/OutputHighlight.glsl.js";import"../shading/EvaluateAmbientOcclusion.glsl.js";import"../shading/EvaluateSceneLighting.glsl.js";import"../shading/MainLighting.glsl.js";import"../shading/NormalUtils.glsl.js";import"../shading/PhysicallyBasedRenderingParameters.glsl.js";import"../shading/ReadShadowMap.glsl.js";import"./Overlay.glsl.js";import"./TerrainTexture.glsl.js";import"../util/View.glsl.js";import"../util/WebGL2Utils.js";import"../../shaderModules/Float3PassUniform.js";import"../../shaderModules/interfaces.js";import"../../shaderModules/Matrix4DrawUniform.js";import"../../shaderModules/ShaderBuilder.js";import"../../shaderModules/Texture2DPassUniform.js";export{T as TerrainPassParameters,b as build}from"../../../../../../chunks/Terrain.glsl.js";
5
+ import"../../../../../../chunks/mat4.js";import"../../../../../../chunks/mat4f64.js";import"../../../../../../chunks/vec3.js";import"../../../../../../chunks/vec3f64.js";import"../../../../terrain/interfaces.js";import"../ForwardLinearDepth.glsl.js";import"../ShaderOutput.js";import"../Slice.glsl.js";import"../Transform.glsl.js";import"../attributes/NormalAttribute.glsl.js";import"../attributes/PositionAttribute.glsl.js";import"../attributes/TextureCoordinateAttribute.glsl.js";import"../attributes/VertexTangent.glsl.js";import"../output/OutputDepth.glsl.js";import"../output/OutputHighlight.glsl.js";import"../shading/EvaluateAmbientOcclusion.glsl.js";import"../shading/EvaluateSceneLighting.glsl.js";import"../shading/MainLighting.glsl.js";import"../shading/NormalUtils.glsl.js";import"../shading/PhysicallyBasedRenderingParameters.glsl.js";import"../shading/ReadShadowMap.glsl.js";import"./Overlay.glsl.js";import"./TerrainTexture.glsl.js";import"../util/View.glsl.js";import"../../shaderModules/Float3PassUniform.js";import"../../shaderModules/interfaces.js";import"../../shaderModules/Matrix4DrawUniform.js";import"../../shaderModules/ShaderBuilder.js";import"../../shaderModules/Texture2DPassUniform.js";export{T as TerrainPassParameters,b as build}from"../../../../../../chunks/Terrain.glsl.js";
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import"../../intl.js";import s from"../../core/Evented.js";import{HandleOwnerMixin as n}from"../../core/HandleOwner.js";import i from"../../core/Logger.js";import{destroyMaybe as o,isSome as a,isNone as r,unwrap as l}from"../../core/maybe.js";import{EsriPromiseMixin as u}from"../../core/Promise.js";import{watch as p}from"../../core/reactiveUtils.js";import{property as d}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import f from"../../form/FormTemplate.js";import h from"../../layers/support/ContingentValue.js";import{isEditableLayer as g}from"../../layers/support/editableLayers.js";import m from"../../layers/support/LayerContingentValuesCache.js";import{isGroupField as y,getNormalizedFeatureTypeInfo as _}from"./featureFormUtils.js";import{createFormExpressionArcadeExecutor as F}from"./FormExpressionArcadeExecutor.js";import{FormExpressionsManager as C}from"./FormExpressionsManager.js";import v from"./InputField.js";import E from"./InputFieldGroup.js";import{onLocaleChange as x}from"../../intl/locale.js";import{fetchMessageBundle as I}from"../../intl/messages.js";const V=new t({attributes:{}}),b=["editableExpression","requiredExpression","valueExpression","visibilityExpression"],j=["visibilityExpression"],w="#JSAPI_CONTINGENT_VALUE_EMPTY_HASH",A="#JSAPI_CONTINGENT_VALUE_ANY_HASH",M="#JSAPI_CONTINGENT_VALUE_NULL_HASH";let T=class extends(n(u(s.EventedAccessor))){constructor(e){super(e),this._expressionExecutorLookup=new Map,this._expressionLookup=new Map,this._expressionsManager=null,this._contingentValuesCache=null,this._featureClone=V.clone(),this._initialFeature=V.clone(),this.arcadeEditType="NA",this.contingencyConstraintViolations=new Map,this.inputFields=[],this.messages=null,this.strict=!1}initialize(){const e=async()=>{const e=await I("esri/widgets/FeatureForm/t9n/FeatureForm");this.messages=e;for(const t of this.allInputFields)t.messages=e};e();const t=p((()=>[this.layer,this.layer?.loaded,this.formTemplate]),(([e,t])=>{a(e)&&(t?this._updateInputFields():e.load().catch((()=>i.getLogger(this.declaredClass).error("Failed to load layer",e.loadError))))}),{equals:([e,t,s],[n,i,o])=>e===n&&t===i&&s===o,initial:!0}),s=p((()=>this._arcadeContextInfo),(e=>{a(this._expressionsManager)&&(this._expressionsManager.arcadeContextInfo=e)})),n=p((()=>this.layer),(e=>{const t="subtype-sublayer"===e?.type?e.parent:"feature"===e?.type?e:null;t&&this.addResolvingPromise(m.createLoadedLayerContingentValuesCache(t).then((e=>{this._contingentValuesCache=e,this.notifyChange("fieldsWithContingentValues")})))}),{initial:!0});this.handles.add([x(e),t,s,n])}destroy(){this.feature=null,this.layer=null,this._contingentValuesCache=o(this._contingentValuesCache)}get _arcadeContextInfo(){const{_initialFeature:e,arcadeEditType:t,layer:s,spatialReference:n,view:i}=this;return{layer:g(s)?s:null,originalFeature:e,editType:t,spatialReference:n,map:i?.map}}get updating(){return this.updatingHandles.updating}get allInputFields(){return L(this.inputFields)}get _layerFieldsByName(){return new Map(this.layer.fields.map((e=>[e.name,e])))}get feature(){return this._get("feature")}set feature(e){this._featureClone=e?e.clone():V.clone(),this._initialFeature=this._featureClone.clone(),this._resetInputFieldValues(this._featureClone),this.contingencyConstraintViolations.clear(),a(this._expressionsManager)&&(this._expressionsManager.resetExecutors(),this._expressionsManager.feature=this._featureClone,this.updatingHandles.addPromise(this._expressionsManager.evaluateAll().finally((()=>this._afterExpressionsEvaluated())))),this._set("feature",e)}get fieldsWithContingentValues(){if(r(this._contingentValuesCache))return new Set;const e=this._contingentValuesCache.fieldGroups.flatMap((e=>e.fields));return new Set(e)}get formTemplate(){return this.layer&&"formTemplate"in this.layer?this.layer.formTemplate:null}set formTemplate(e){void 0===e?this._clearOverride("formTemplate"):this._override("formTemplate",e)}get joinedContingentValues(){return this._joinContingentValues()}get layer(){return this.feature?.sourceLayer&&"applyEdits"in this.feature.sourceLayer?this.feature.sourceLayer:null}set layer(e){this._override("layer",e)}get spatialReference(){return this.layer?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){return this.messages&&this.get("layer.loaded")?"ready":"disabled"}get submittable(){return!!this.valid||this.allInputFields.filter((e=>!e.valid)).every((({submittable:e})=>e))}get valid(){const e=this.allInputFields;return e.length>0&&e.every((({valid:e})=>e))}findField(e){return this.allInputFields.find((t=>t.name===e))}getValue(e){const{_featureClone:t,layer:s}=this,n=!!s?.getField(e);return t.getAttribute(e)??(n?null:void 0)}setValue(e,t){const{_featureClone:s,strict:n}=this,i=this.findField(e);t=""===t?null:t,i&&s.getAttribute(e)!==t&&(i.value=t,n&&!i.valid||(this._afterValueChange(i),a(this._expressionsManager)&&this.updatingHandles.addPromise(this._expressionsManager.evaluateInvalidated([i.name]).finally((()=>this._afterExpressionsEvaluated())))))}getValues(){return{...this._featureClone.attributes}}submit(){const e=this.allInputFields,t=new Set(e.filter((e=>e.valid)).map((({name:e})=>e))),s=e.filter((e=>!e.valid)).map((({name:e})=>e)),n=this.getValues();if(this.validateContingencyConstraints(n,{includeIncompleteViolations:!0}).length>0)for(const[i,o]of this.contingencyConstraintViolations.entries())"error"===o.type&&(t.delete(i),s.push(i));this.emit("submit",{valid:[...t],invalid:s,values:n})}validateContingencyConstraints(e,t){const{_contingentValuesCache:s}=this,n=new Map;if(this.contingencyConstraintViolations=n,r(s))return[];const{invalid:i,incomplete:o}=s.validateContingencyConstraints(e),a=[...i,...t?.includeIncompleteViolations?o:[]];for(const r of a)for(const e of r.fieldGroup.fields)n.set(e,r);return a}notifyFeatureGeometryChanged(){const{_expressionsManager:e,feature:t,_featureClone:s}=this;s.geometry=t.geometry,a(e)&&this.updatingHandles.addPromise(e.evaluateInvalidatedByGeometry().finally((()=>this._afterExpressionsEvaluated())))}_emitChangeEvent({name:e,valid:t,value:s}){this.emit("value-change",{layer:this.layer,feature:this.feature,fieldName:e,value:s,valid:t})}_updateInputFields(){const{_featureClone:e,_initialFeature:t,arcadeEditType:s,formTemplate:n,inputFields:i,messages:o,layer:r}=this,l={arcadeEditType:s,feature:e,initialFeature:t,layer:r,messages:o},u=i.slice(),p=a(n)&&n.elements.length>0?this._updateInputFieldsFromElements(u,n.elements,l):this._updateInputFieldsFromLayerFields(u,r?.fields,l);this.inputFields=p}_updateInputFieldsFromElements(e,t,s){const n=new Map;for(const a of e)if(y(a)){N(n,a.groupElement,a);for(const e of a.inputFields)N(n,e.fieldElement,e)}else N(n,a.fieldElement,a);const i=new Map,o=this._updateInputFieldsRecursive({existingInputFieldsByElement:n,updatedElements:t.filter(this._isSupportedElement),sharedInitializationProperties:s,group:null,newExpressionExecutorPromises:i});this.updatingHandles.addPromise(Promise.all(Array.from(i.values())).then((()=>{const e=Array.from(this._expressionExecutorLookup.values()),t=L(o);return this._createExpressionsManager(e,t),l(this._expressionsManager).evaluateAll().finally((()=>this._afterExpressionsEvaluated()))})));for(const[a,r]of n.entries())n.delete(a),r.destroy();return o}_updateInputFieldsRecursive(e){const{existingInputFieldsByElement:t,updatedElements:s,sharedInitializationProperties:n,group:i,newExpressionExecutorPromises:o}=e,a=[];for(const r of s){const e=t.has(r),s=e?t.get(r):S(r)?this._makeInputFieldGroupFromGroupElement(r,n):this._makeInputFieldFromFieldElement(r,n,i);if(a.push(s),e)if(t.delete(r),y(s)){const{feature:e}=n;s.set({feature:e})}else s.set(n);else this._assignExpressionExecutors(s,r,o);if(S(r)){const e=r.elements.filter((e=>this._isSupportedElement(e)));s.inputFields=this._updateInputFieldsRecursive({existingInputFieldsByElement:t,updatedElements:e,sharedInitializationProperties:n,group:s,newExpressionExecutorPromises:o})}}return a}_updateInputFieldsFromLayerFields(e,t,s){if(!Array.isArray(t))return i.getLogger(this.declaredClass).warn(this.declaredClass,"No attribute fields found."),[];const n=new Map;for(const i of e)if(y(i)){for(const e of i.inputFields)e.destroy();i.inputFields.length=0,i.destroy()}else a(i.fieldElement)?i.destroy():n.set(i.field,i);const o=[],{arcadeEditType:r,feature:l,initialFeature:u,layer:p,messages:d}=s;for(const i of t){const e=n.get(i)??new v({arcadeEditType:r,field:i,feature:l,initialFeature:u,layer:p,messages:d,value:l.getAttribute(i.name)??null});o.push(e),n.delete(i)}for(const[i,a]of n.entries())n.delete(i),a.destroy();return o}_resetInputFieldValues(e){for(const t of this.allInputFields)t.value=e.getAttribute(t.name)}_makeInputFieldFromFieldElement(e,t,s=null){const{arcadeEditType:n,feature:i,initialFeature:o,layer:a,messages:r}=t;return new v({arcadeEditType:n,fieldElement:e,field:this._layerFieldsByName.get(e.fieldName),value:i.getAttribute(e.fieldName)??null,feature:i,initialFeature:o,layer:a,group:s,messages:r})}_makeInputFieldGroupFromGroupElement(e,t){const{feature:s,initialFeature:n}=t;return new E({groupElement:e,inputFields:[],feature:s,initialFeature:n})}_assignExpressionExecutors(e,t,s){const n=S(t)?j:b,i=[];for(const o of n){const n=t[o],{_expressionExecutorLookup:i}=this;if(a(n)&&""!==n){const t=`${o}Executor`,a=this._expressionLookup.get(n)??this._addToExpressionLookup(n);if(i.has(a))e[t]=i.get(a);else if(s.has(a)){const n=s.get(a).then((s=>(e[t]=s,s)));s.set(a,n)}else{const n=F(a,this.layer).then((s=>(e[t]=s,i.set(a,s),s)));s.set(a,n)}}}return i}_createExpressionsManager(e,t){const{_arcadeContextInfo:s,_featureClone:n}=this;this._expressionsManager=new C({executors:e,feature:n,arcadeContextInfo:s,inputFields:t})}_afterValueChange(e){const{name:t,value:s}=e,{_featureClone:n}=this,i=n.getAttribute(t);n.setAttribute(t,s);const{typeFieldName:o,types:a}=_(this.layer);if(t===o&&s!==i){if("subtype-sublayer"===this.layer.type){const e=this.layer.parent?.findSublayerForFeature(n);n.sourceLayer=this.feature.sourceLayer=e}const e=new Set;for(const t of a)if(t.domains&&"object"==typeof t.domains)for(const s of Object.keys(t.domains))e.add(s);for(const t of e){const e=this.findField(t);e&&e.notifyChange("domain")}}this._emitChangeEvent(e)}_afterExpressionsEvaluated(){const{_featureClone:e}=this;for(const t of this.allInputFields)t.value!==e.getAttribute(t.name)&&this._afterValueChange(t)}_addToExpressionLookup(e){const{_expressionLookup:t,formTemplate:s}=this,n=(a(s)&&a(s.expressionInfos)?Object.values(s.expressionInfos).find((t=>t.name===e)):null)?.expression??e;return t.set(e,n),e!==n&&t.set(n,n),n}_isSupportedElement(e){return"field"===e.type||"group"===e.type||(i.getLogger(this.declaredClass).warn("form-info::unsupported-element-type","Only element types 'field' and 'group' are supported",`Element ${e.label} has unsupported type '${e.type}'`),!1)}_joinContingentValues(){const e=this._contingentValuesCache;if(r(e))return[];const{typeFieldName:t}=_(this.layer),s=t?this.getValue(t):null,n=[];for(const r of e.fieldGroups){const{contingencies:e,fields:t,name:i}=r,o=[];for(const n of e)n.isRetired||a(n.subtype)&&n.subtype.code!==s||o.push({values:n.values});o.length>0&&n.push({name:i,fields:t,contingencies:o})}const[i,o]=this._generateJoinPlan(n);return[...i.flatMap((e=>this._joinFieldGroupContingencies(e))),...o.flatMap((e=>e.contingencies))]}_generateJoinPlan(e){const t=new Map,s=[],n=new Set;for(const l of e)for(const e of l.fields)if(t.has(e)){const i=t.get(e),o=l,a=[i.name,o.name].sort().join("|");if(n.has(a))continue;s.push([i,o]),n.add(a),t.set(e,o)}else t.set(e,l);const i=new Set(s.flat()),o=new Set(e);for(const l of i)o.delete(l);const a=new Map,r=new Map;for(const l of new Set(s.flat())){const e=Symbol(l.name);a.set(e,new Set([l])),r.set(l,e)}for(const[l,u]of s){const e=r.get(l),t=r.get(u);if(e===t)continue;const s=a.get(e),n=a.get(t);for(const i of n)s.add(i),r.set(i,e);a.delete(t)}return[[...a.values()].map((e=>[...e])),[...o]]}_joinFieldGroupContingencies(e){const t=e.slice(),s=t.shift();let n=t.shift(),i=this._generateJoinKey(s.fields,n.fields),o=new Set([...s.fields,...n.fields]),l=new Map;for(const a of s.contingencies){const[e]=this._hashContingency(a,i.codedValueFields,!0);l.has(e)?l.get(e).push(a):l.set(e,[a])}for(;t.length>0;){const e=new Map,s=t.shift(),a=this._generateJoinKey(o,s.fields);for(const t of n.contingencies){const[s,n]=this._hashContingency(t,i.codedValueFields),o=n?this._findMatchingContingenciesWithAnyHashMask(l,s):l.get(s);if(l.has(A)&&o.push(...this._findMatchingContingenciesContainingAny(t,l.get(A),i.codedValueFields)),!r(o))for(const l of o){const s=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(l,t,i.rangeFields):this._joinContingencies(l,t);if(r(s))break;const[n]=this._hashContingency(s,a.codedValueFields,!0);e.has(n)?e.get(n).push(s):e.set(n,[s])}}l=e,n=s,i=a,o=new Set([...o,...n.fields])}const u=[];for(const p of n.contingencies){const[e,t]=this._hashContingency(p,i.codedValueFields),s=t?this._findMatchingContingenciesWithAnyHashMask(l,e):l.get(e);if(l.has(A)&&s.push(...this._findMatchingContingenciesContainingAny(p,l.get(A),i.codedValueFields)),!r(s))for(const n of s){const e=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(n,p,i.rangeFields):this._joinContingencies(n,p);a(e)&&u.push(e)}}return u}_joinContingencies(e,t){const s={values:{...e.values,...t.values}};for(const[n,i]of Object.entries(s.values))"any"===i.objectType&&a(e.values[n])&&(s.values[n]=e.values[n]);return s}_joinContingenciesWithRangeDomains(e,t,s){const n=this._joinContingencies(e,t);for(const i of s){const s=e.values[i],o=t.values[i],{leftIsNull:a,rightIsNull:r,bothAreNull:l,leftIsAny:u,rightIsAny:p,bothAreAny:d,leftIsRange:c,rightIsRange:f}=this._compareObjectTypes(s.objectType,o.objectType);if(l||d)continue;if(a&&p||r&&u){n.values[i]=new h({objectType:"null"});continue}if(a&&f||r&&c)return null;u?(s.minValue=-1/0,s.maxValue=1/0):p&&(o.minValue=-1/0,o.maxValue=1/0);const g=Math.max(s.minValue,o.minValue),m=Math.min(s.maxValue,o.maxValue);if(g>m)return null;n.values[i]=new h({objectType:"range",minValue:g,maxValue:m})}return n}_findMatchingContingenciesContainingAny(e,t,s){return t.filter((t=>s.every((s=>{const n=t.values[s],i=e.values[s];return"any"===n.objectType||"any"===i.objectType||n.codedValue?.code===i.codedValue?.code}))))}_findMatchingContingenciesWithAnyHashMask(e,t){const s=RegExp(`${t}$`),n=[];for(const[i,o]of e){if(i===A)break;s.test(i)&&n.push(...o)}return n}_generateJoinKey(e,t){const s=Array.isArray(e)?new Set(e):e,n=Array.isArray(t)?new Set(t):t,i=s.size<n.size?s:n,o=i===s?n:s,a=new Set,l=new Set;for(const u of i)if(o.has(u)){const e=this.layer.getFieldDomain(u,{feature:this.feature});if(r(e))continue;switch(e.type){case"coded-value":a.add(u);break;case"range":l.add(u)}}return{codedValueFields:[...a],rangeFields:[...l]}}_hashContingency(e,t,s=!1){if(t.length<1)return[w,!1];const n=[];let i=!1;for(const o of t){const t=e.values[o];if("any"===t.objectType){if(s)return[A,!0];i=!0,n.push(`${o}:.*`)}else"null"===t.objectType?n.push(`${o}:${M}`):n.push(`${o}:${t.codedValue?.code}`)}return[n.sort().join("&"),i]}_compareObjectTypes(e,t){return{leftIsNull:"null"===e,rightIsNull:"null"===t,bothAreNull:"null"===e&&"null"===t,leftIsAny:"any"===e,rightIsAny:"any"===t,bothAreAny:"any"===e&&"any"===t,leftIsRange:"range"===e,rightIsRange:"range"===t}}};e([d()],T.prototype,"_featureClone",void 0),e([d()],T.prototype,"_arcadeContextInfo",null),e([d()],T.prototype,"updating",null),e([d({readOnly:!0})],T.prototype,"allInputFields",null),e([d()],T.prototype,"_layerFieldsByName",null),e([d()],T.prototype,"arcadeEditType",void 0),e([d()],T.prototype,"contingencyConstraintViolations",void 0),e([d()],T.prototype,"feature",null),e([d()],T.prototype,"fieldsWithContingentValues",null),e([d({type:f})],T.prototype,"formTemplate",null),e([d()],T.prototype,"inputFields",void 0),e([d()],T.prototype,"joinedContingentValues",null),e([d()],T.prototype,"layer",null),e([d()],T.prototype,"messages",void 0),e([d()],T.prototype,"spatialReference",null),e([d()],T.prototype,"state",null),e([d()],T.prototype,"strict",void 0),e([d()],T.prototype,"submittable",null),e([d()],T.prototype,"valid",null),e([d()],T.prototype,"view",void 0),e([d()],T.prototype,"getValues",null),e([d()],T.prototype,"submit",null),T=e([c("esri.widgets.FeatureForm.FeatureFormViewModel")],T);const S=e=>"group"===e.type,L=e=>e.reduce(((e,t)=>y(t)?[...e,...t.inputFields]:[...e,t]),[]),N=(e,t,s)=>{a(t)&&e.set(t,s)},k=T;export{k as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import"../../intl.js";import s from"../../core/Evented.js";import{HandleOwnerMixin as n}from"../../core/HandleOwner.js";import i from"../../core/Logger.js";import{destroyMaybe as o,isSome as r,isNone as a,unwrap as l}from"../../core/maybe.js";import{EsriPromiseMixin as u}from"../../core/Promise.js";import{watch as p}from"../../core/reactiveUtils.js";import{templateHasKey as d}from"../../core/string.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import h from"../../form/FormTemplate.js";import g from"../../layers/support/ContingentValue.js";import{isEditableLayer as m}from"../../layers/support/editableLayers.js";import y from"../../layers/support/LayerContingentValuesCache.js";import{parseFormTemplateString as _,isGroupField as F,getNormalizedFeatureTypeInfo as C}from"./featureFormUtils.js";import{createFormExpressionArcadeExecutor as v}from"./FormExpressionArcadeExecutor.js";import{FormExpressionsManager as E}from"./FormExpressionsManager.js";import x from"./InputField.js";import I from"./InputFieldGroup.js";import{onLocaleChange as V}from"../../intl/locale.js";import{fetchMessageBundle as b}from"../../intl/messages.js";const j=new t({attributes:{}}),w=["editableExpression","requiredExpression","valueExpression","visibilityExpression"],T=["visibilityExpression"],A="#JSAPI_CONTINGENT_VALUE_EMPTY_HASH",M="#JSAPI_CONTINGENT_VALUE_ANY_HASH",S="#JSAPI_CONTINGENT_VALUE_NULL_HASH";let L=class extends(n(u(s.EventedAccessor))){constructor(e){super(e),this._expressionExecutorLookup=new Map,this._expressionLookup=new Map,this._expressionsManager=null,this._contingentValuesCache=null,this._featureClone=j.clone(),this._initialFeature=j.clone(),this.arcadeEditType="NA",this.contingencyConstraintViolations=new Map,this.inputFields=[],this.messages=null,this.strict=!1,this._isSupportedElement=this._isSupportedElement.bind(this)}initialize(){const e=async()=>{const e=await b("esri/widgets/FeatureForm/t9n/FeatureForm");this.messages=e;for(const t of this.allInputFields)t.messages=e};e();const t=p((()=>[this.layer,this.layer?.loaded,this.formTemplate]),(([e,t])=>{r(e)&&(t?this._updateInputFields():e.load().catch((()=>i.getLogger(this.declaredClass).error("Failed to load layer",e.loadError))))}),{equals:([e,t,s],[n,i,o])=>e===n&&t===i&&s===o,initial:!0}),s=p((()=>this._arcadeContextInfo),(e=>{r(this._expressionsManager)&&(this._expressionsManager.arcadeContextInfo=e)})),n=p((()=>this.layer),(e=>{const t="subtype-sublayer"===e?.type?e.parent:"feature"===e?.type?e:null;t&&this.addResolvingPromise(y.createLoadedLayerContingentValuesCache(t).then((e=>{this._contingentValuesCache=e,this.notifyChange("fieldsWithContingentValues")})))}),{initial:!0});this.handles.add([V(e),t,s,n])}destroy(){this.feature=null,this.layer=null,this._contingentValuesCache=o(this._contingentValuesCache)}get _arcadeContextInfo(){const{_initialFeature:e,arcadeEditType:t,layer:s,spatialReference:n,view:i}=this;return{layer:m(s)?s:null,originalFeature:e,editType:t,spatialReference:n,map:i?.map}}get updating(){return this.updatingHandles.updating}get allInputFields(){return k(this.inputFields)}get _layerFieldsByName(){return new Map(this.layer.fields.map((e=>[e.name,e])))}get feature(){return this._get("feature")}set feature(e){this._featureClone=e?e.clone():j.clone(),this._initialFeature=this._featureClone.clone(),this._resetInputFieldValues(this._featureClone),this.contingencyConstraintViolations.clear(),r(this._expressionsManager)&&(this._expressionsManager.resetExecutors(),this._expressionsManager.feature=this._featureClone,this.updatingHandles.addPromise(this._expressionsManager.evaluateAll().finally((()=>this._afterExpressionsEvaluated())))),this._set("feature",e)}get fieldsWithContingentValues(){if(a(this._contingentValuesCache))return new Set;const e=this._contingentValuesCache.fieldGroups.flatMap((e=>e.fields));return new Set(e)}get formTemplate(){return this.layer&&"formTemplate"in this.layer?this.layer.formTemplate:null}set formTemplate(e){void 0===e?this._clearOverride("formTemplate"):this._override("formTemplate",e)}get formDescription(){const{formTemplate:e,layer:t}=this;return!a(e)&&e.description&&t?_(e.description,this.getValues(),t.fieldsIndex):null}get formTitle(){const{formTemplate:e,layer:t}=this;return!a(e)&&e.title&&t?_(e.title,this.getValues(),t.fieldsIndex):null}get joinedContingentValues(){return this._joinContingentValues()}get layer(){return this.feature?.sourceLayer&&"applyEdits"in this.feature.sourceLayer?this.feature.sourceLayer:null}set layer(e){this._override("layer",e)}get spatialReference(){return this.layer?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){return this.messages&&this.get("layer.loaded")?"ready":"disabled"}get submittable(){return!!this.valid||this.allInputFields.filter((e=>!e.valid)).every((({submittable:e})=>e))}get valid(){const e=this.allInputFields;return e.length>0&&e.every((({valid:e})=>e))}findField(e){return this.allInputFields.find((t=>t.name===e))}getValue(e){const{_featureClone:t,layer:s}=this,n=!!s?.getField(e);return t.getAttribute(e)??(n?null:void 0)}setValue(e,t){const{_featureClone:s,strict:n}=this,i=this.findField(e);t=""===t?null:t,i&&s.getAttribute(e)!==t&&(i.value=t,n&&!i.valid||(this._afterValueChange(i),r(this._expressionsManager)&&this.updatingHandles.addPromise(this._expressionsManager.evaluateInvalidated([i.name]).finally((()=>this._afterExpressionsEvaluated())))))}getValues(){return{...this._featureClone.attributes}}submit(){const e=this.allInputFields,t=new Set(e.filter((e=>e.valid)).map((({name:e})=>e))),s=e.filter((e=>!e.valid)).map((({name:e})=>e)),n=this.getValues();if(this.validateContingencyConstraints(n,{includeIncompleteViolations:!0}).length>0)for(const[i,o]of this.contingencyConstraintViolations.entries())"error"===o.type&&(t.delete(i),s.push(i));this.emit("submit",{valid:[...t],invalid:s,values:n})}validateContingencyConstraints(e,t){const{_contingentValuesCache:s}=this,n=new Map;if(this.contingencyConstraintViolations=n,a(s))return[];const{invalid:i,incomplete:o}=s.validateContingencyConstraints(e),r=[...i,...t?.includeIncompleteViolations?o:[]];for(const a of r)for(const e of a.fieldGroup.fields)n.set(e,a);return r}notifyFeatureGeometryChanged(){const{_expressionsManager:e,feature:t,_featureClone:s}=this;s.geometry=t.geometry,r(e)&&this.updatingHandles.addPromise(e.evaluateInvalidatedByGeometry().finally((()=>this._afterExpressionsEvaluated())))}_emitChangeEvent({name:e,valid:t,value:s}){this.emit("value-change",{layer:this.layer,feature:this.feature,fieldName:e,value:s,valid:t})}_updateInputFields(){const{_featureClone:e,_initialFeature:t,arcadeEditType:s,formTemplate:n,inputFields:i,messages:o,layer:a}=this,l={arcadeEditType:s,feature:e,initialFeature:t,layer:a,messages:o},u=i.slice(),p=r(n)&&n.elements.length>0?this._updateInputFieldsFromElements(u,n.elements,l):this._updateInputFieldsFromLayerFields(u,a?.fields,l);this.inputFields=p}_updateInputFieldsFromElements(e,t,s){const n=new Map;for(const r of e)if(F(r)){R(n,r.groupElement,r);for(const e of r.inputFields)R(n,e.fieldElement,e)}else R(n,r.fieldElement,r);const i=new Map,o=this._updateInputFieldsRecursive({existingInputFieldsByElement:n,updatedElements:t.filter(this._isSupportedElement),sharedInitializationProperties:s,group:null,newExpressionExecutorPromises:i});this.updatingHandles.addPromise(Promise.all(Array.from(i.values())).then((()=>{const e=Array.from(this._expressionExecutorLookup.values()),t=k(o);return this._createExpressionsManager(e,t),l(this._expressionsManager).evaluateAll().finally((()=>this._afterExpressionsEvaluated()))})));for(const[r,a]of n.entries())n.delete(r),a.destroy();return o}_updateInputFieldsRecursive(e){const{existingInputFieldsByElement:t,updatedElements:s,sharedInitializationProperties:n,group:i,newExpressionExecutorPromises:o}=e,r=[];for(const a of s){const e=t.has(a),s=e?t.get(a):N(a)?this._makeInputFieldGroupFromGroupElement(a,n):this._makeInputFieldFromFieldElement(a,n,i);if(r.push(s),e)if(t.delete(a),F(s)){const{feature:e}=n;s.set({feature:e})}else s.set(n);else this._assignExpressionExecutors(s,a,o);if(N(a)){const e=a.elements.filter((e=>this._isSupportedElement(e)));s.inputFields=this._updateInputFieldsRecursive({existingInputFieldsByElement:t,updatedElements:e,sharedInitializationProperties:n,group:s,newExpressionExecutorPromises:o})}}return r}_updateInputFieldsFromLayerFields(e,t,s){if(!Array.isArray(t))return i.getLogger(this.declaredClass).warn(this.declaredClass,"No attribute fields found."),[];const n=new Map;for(const i of e)if(F(i)){for(const e of i.inputFields)e.destroy();i.inputFields.length=0,i.destroy()}else r(i.fieldElement)?i.destroy():n.set(i.field,i);const o=[],{arcadeEditType:a,feature:l,initialFeature:u,layer:p,messages:d}=s;for(const i of t){const e=n.get(i)??new x({arcadeEditType:a,field:i,feature:l,initialFeature:u,layer:p,messages:d,value:l.getAttribute(i.name)??null});o.push(e),n.delete(i)}for(const[i,r]of n.entries())n.delete(i),r.destroy();return o}_resetInputFieldValues(e){for(const t of this.allInputFields)t.value=e.getAttribute(t.name)}_makeInputFieldFromFieldElement(e,t,s=null){const{arcadeEditType:n,feature:i,initialFeature:o,layer:r,messages:a}=t;return new x({arcadeEditType:n,fieldElement:e,field:this._layerFieldsByName.get(e.fieldName),value:i.getAttribute(e.fieldName)??null,feature:i,initialFeature:o,layer:r,group:s,messages:a})}_makeInputFieldGroupFromGroupElement(e,t){const{feature:s,initialFeature:n}=t;return new I({groupElement:e,inputFields:[],feature:s,initialFeature:n})}_assignExpressionExecutors(e,t,s){const n=N(t)?T:w,i=[];for(const o of n){const n=t[o],{_expressionExecutorLookup:i}=this;if(r(n)&&""!==n){const t=`${o}Executor`,r=this._expressionLookup.get(n)??this._addToExpressionLookup(n);if(i.has(r))e[t]=i.get(r);else if(s.has(r)){const n=s.get(r).then((s=>(e[t]=s,s)));s.set(r,n)}else{const n=v(r,this.layer).then((s=>(e[t]=s,i.set(r,s),s)));s.set(r,n)}}}return i}_createExpressionsManager(e,t){const{_arcadeContextInfo:s,_featureClone:n}=this;this._expressionsManager=new E({executors:e,feature:n,arcadeContextInfo:s,inputFields:t})}_afterValueChange(e){const{name:t,value:s}=e,{_featureClone:n,formTemplate:i,layer:o}=this;if(!o)return;const a=n.getAttribute(t);n.setAttribute(t,s);const{typeFieldName:l,types:u}=C(o);if(t===l&&s!==a){if("subtype-sublayer"===o.type){const e=o.parent?.findSublayerForFeature(n);n.sourceLayer=this.feature.sourceLayer=e}const e=new Set;for(const t of u)if(t.domains&&"object"==typeof t.domains)for(const s of Object.keys(t.domains))e.add(s);for(const t of e){const e=this.findField(t);e&&e.notifyChange("domain")}}if(r(i)){const{description:e,title:s}=i;s&&d(s,t)&&this.notifyChange("formTitle"),e&&d(e,t)&&this.notifyChange("formDescription")}this._emitChangeEvent(e)}_afterExpressionsEvaluated(){const{_featureClone:e}=this;for(const t of this.allInputFields)t.value!==e.getAttribute(t.name)&&this._afterValueChange(t)}_addToExpressionLookup(e){const{_expressionLookup:t,formTemplate:s}=this,n=(r(s)&&r(s.expressionInfos)?Object.values(s.expressionInfos).find((t=>t.name===e)):null)?.expression??e;return t.set(e,n),e!==n&&t.set(n,n),n}_isSupportedElement(e){return"field"===e.type||"group"===e.type||(i.getLogger(this.declaredClass).warn("form-info::unsupported-element-type","Only element types 'field' and 'group' are supported",`Element ${e.label} has unsupported type '${e.type}'`),!1)}_joinContingentValues(){const e=this._contingentValuesCache;if(a(e))return[];const{typeFieldName:t}=C(this.layer),s=t?this.getValue(t):null,n=[];for(const a of e.fieldGroups){const{contingencies:e,fields:t,name:i}=a,o=[];for(const n of e)n.isRetired||r(n.subtype)&&n.subtype.code!==s||o.push({values:n.values});o.length>0&&n.push({name:i,fields:t,contingencies:o})}const[i,o]=this._generateJoinPlan(n);return[...i.flatMap((e=>this._joinFieldGroupContingencies(e))),...o.flatMap((e=>e.contingencies))]}_generateJoinPlan(e){const t=new Map,s=[],n=new Set;for(const l of e)for(const e of l.fields)if(t.has(e)){const i=t.get(e),o=l,r=[i.name,o.name].sort().join("|");if(n.has(r))continue;s.push([i,o]),n.add(r),t.set(e,o)}else t.set(e,l);const i=new Set(s.flat()),o=new Set(e);for(const l of i)o.delete(l);const r=new Map,a=new Map;for(const l of new Set(s.flat())){const e=Symbol(l.name);r.set(e,new Set([l])),a.set(l,e)}for(const[l,u]of s){const e=a.get(l),t=a.get(u);if(e===t)continue;const s=r.get(e),n=r.get(t);for(const i of n)s.add(i),a.set(i,e);r.delete(t)}return[[...r.values()].map((e=>[...e])),[...o]]}_joinFieldGroupContingencies(e){const t=e.slice(),s=t.shift();let n=t.shift(),i=this._generateJoinKey(s.fields,n.fields),o=new Set([...s.fields,...n.fields]),l=new Map;for(const r of s.contingencies){const[e]=this._hashContingency(r,i.codedValueFields,!0);l.has(e)?l.get(e).push(r):l.set(e,[r])}for(;t.length>0;){const e=new Map,s=t.shift(),r=this._generateJoinKey(o,s.fields);for(const t of n.contingencies){const[s,n]=this._hashContingency(t,i.codedValueFields),o=n?this._findMatchingContingenciesWithAnyHashMask(l,s):l.get(s);if(l.has(M)&&o.push(...this._findMatchingContingenciesContainingAny(t,l.get(M),i.codedValueFields)),!a(o))for(const l of o){const s=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(l,t,i.rangeFields):this._joinContingencies(l,t);if(a(s))break;const[n]=this._hashContingency(s,r.codedValueFields,!0);e.has(n)?e.get(n).push(s):e.set(n,[s])}}l=e,n=s,i=r,o=new Set([...o,...n.fields])}const u=[];for(const p of n.contingencies){const[e,t]=this._hashContingency(p,i.codedValueFields),s=t?this._findMatchingContingenciesWithAnyHashMask(l,e):l.get(e);if(l.has(M)&&s.push(...this._findMatchingContingenciesContainingAny(p,l.get(M),i.codedValueFields)),!a(s))for(const n of s){const e=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(n,p,i.rangeFields):this._joinContingencies(n,p);r(e)&&u.push(e)}}return u}_joinContingencies(e,t){const s={values:{...e.values,...t.values}};for(const[n,i]of Object.entries(s.values))"any"===i.objectType&&r(e.values[n])&&(s.values[n]=e.values[n]);return s}_joinContingenciesWithRangeDomains(e,t,s){const n=this._joinContingencies(e,t);for(const i of s){const s=e.values[i],o=t.values[i],{leftIsNull:r,rightIsNull:a,bothAreNull:l,leftIsAny:u,rightIsAny:p,bothAreAny:d,leftIsRange:c,rightIsRange:f}=this._compareObjectTypes(s.objectType,o.objectType);if(l||d)continue;if(r&&p||a&&u){n.values[i]=new g({objectType:"null"});continue}if(r&&f||a&&c)return null;u?(s.minValue=-1/0,s.maxValue=1/0):p&&(o.minValue=-1/0,o.maxValue=1/0);const h=Math.max(s.minValue,o.minValue),m=Math.min(s.maxValue,o.maxValue);if(h>m)return null;n.values[i]=new g({objectType:"range",minValue:h,maxValue:m})}return n}_findMatchingContingenciesContainingAny(e,t,s){return t.filter((t=>s.every((s=>{const n=t.values[s],i=e.values[s];return"any"===n.objectType||"any"===i.objectType||n.codedValue?.code===i.codedValue?.code}))))}_findMatchingContingenciesWithAnyHashMask(e,t){const s=RegExp(`${t}$`),n=[];for(const[i,o]of e){if(i===M)break;s.test(i)&&n.push(...o)}return n}_generateJoinKey(e,t){const s=Array.isArray(e)?new Set(e):e,n=Array.isArray(t)?new Set(t):t,i=s.size<n.size?s:n,o=i===s?n:s,r=new Set,l=new Set;for(const u of i)if(o.has(u)){const e=this.layer.getFieldDomain(u,{feature:this.feature});if(a(e))continue;switch(e.type){case"coded-value":r.add(u);break;case"range":l.add(u)}}return{codedValueFields:[...r],rangeFields:[...l]}}_hashContingency(e,t,s=!1){if(t.length<1)return[A,!1];const n=[];let i=!1;for(const o of t){const t=e.values[o];if("any"===t.objectType){if(s)return[M,!0];i=!0,n.push(`${o}:.*`)}else"null"===t.objectType?n.push(`${o}:${S}`):n.push(`${o}:${t.codedValue?.code}`)}return[n.sort().join("&"),i]}_compareObjectTypes(e,t){return{leftIsNull:"null"===e,rightIsNull:"null"===t,bothAreNull:"null"===e&&"null"===t,leftIsAny:"any"===e,rightIsAny:"any"===t,bothAreAny:"any"===e&&"any"===t,leftIsRange:"range"===e,rightIsRange:"range"===t}}};e([c()],L.prototype,"_featureClone",void 0),e([c()],L.prototype,"_arcadeContextInfo",null),e([c()],L.prototype,"updating",null),e([c({readOnly:!0})],L.prototype,"allInputFields",null),e([c()],L.prototype,"_layerFieldsByName",null),e([c()],L.prototype,"arcadeEditType",void 0),e([c()],L.prototype,"contingencyConstraintViolations",void 0),e([c()],L.prototype,"feature",null),e([c()],L.prototype,"fieldsWithContingentValues",null),e([c({type:h})],L.prototype,"formTemplate",null),e([c()],L.prototype,"formDescription",null),e([c()],L.prototype,"formTitle",null),e([c()],L.prototype,"inputFields",void 0),e([c()],L.prototype,"joinedContingentValues",null),e([c()],L.prototype,"layer",null),e([c()],L.prototype,"messages",void 0),e([c()],L.prototype,"spatialReference",null),e([c()],L.prototype,"state",null),e([c()],L.prototype,"strict",void 0),e([c()],L.prototype,"submittable",null),e([c()],L.prototype,"valid",null),e([c()],L.prototype,"view",void 0),e([c()],L.prototype,"getValues",null),e([c()],L.prototype,"submit",null),L=e([f("esri.widgets.FeatureForm.FeatureFormViewModel")],L);const N=e=>"group"===e.type,k=e=>e.reduce(((e,t)=>F(t)?[...e,...t.inputFields]:[...e,t]),[]),R=(e,t,s)=>{r(t)&&e.set(t,s)},P=L;export{P 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.26/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as e}from"../../core/maybe.js";const p=e=>!!e.inputFields,t=(p,t)=>e(p)&&p.input?.type===t,y={typeFieldName:null,types:[]},s=e=>e?"subtype-sublayer"===e.type?{typeFieldName:e.parent?.subtypeField,types:e.parent?.subtypes}:"types"in e&&e.types?{typeFieldName:e.typeIdField,types:e.types.map((({id:e,name:p,domains:t})=>({code:e,name:p,domains:t})))}:y:y;export{s as getNormalizedFeatureTypeInfo,t as isFieldElementWithInputType,p as isGroupField};
5
+ import{isSome as e}from"../../core/maybe.js";import{templateHasKey as t,replace as n}from"../../core/string.js";const o=e=>!!e.inputFields,s=(t,n)=>e(t)&&t.input?.type===n,i={typeFieldName:null,types:[]};function p(n,o,s){const i=Object.keys(o).filter((e=>t(n,e))),p=i.map((e=>o[e])),m=i.map((e=>s.get(e))).filter(e);return a(n,r(p,m))}function r(e,t){const n=t.map(((t,n)=>{let o=e[n];if(t.domain&&"coded-value"===t.domain.type){const e=t.domain.codedValues.find((e=>e.code===o));e?.name&&(o=e.name)}return[t.name,o]}));return Object.fromEntries(n)}function a(e,t){return n(n(e,(e=>`{${e.toLowerCase()}}`)),Object.fromEntries(Object.entries(t).map((([e,t])=>[e.toLowerCase(),t]))))}const m=e=>e?"subtype-sublayer"===e.type?{typeFieldName:e.parent?.subtypeField,types:e.parent?.subtypes}:"types"in e&&e.types?{typeFieldName:e.typeIdField,types:e.types.map((({id:e,name:t,domains:n})=>({code:e,name:t,domains:n})))}:i:i;export{r as getComputedAttributes,m as getNormalizedFeatureTypeInfo,s as isFieldElementWithInputType,o as isGroupField,p as parseFormTemplateString,a as substituteFieldTemplatesInString};