@arcgis/core 4.28.0-next.20230713 → 4.28.0-next.20230714
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Basemap.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{08ee2bd914867fd2cbd5.js → 490629c6f9fee501c9cd.js} +1 -1
- package/assets/esri/core/workers/chunks/{044b15794b6403792f04.js → 4f079d0e69189c1d8bd9.js} +1 -1
- package/assets/esri/core/workers/chunks/{3835a76c017431f19422.js → 51da3c5c50b153ce6bc7.js} +1 -1
- package/assets/esri/core/workers/chunks/b694126184f85a832b39.js +1 -0
- package/assets/esri/core/workers/chunks/b8a45b28a915a423d09d.js +1 -0
- package/assets/esri/core/workers/chunks/{55109f141c9f120833f6.js → c3d773c93efb41088c54.js} +1 -1
- package/assets/esri/core/workers/chunks/e433440fecd0114cb23d.js +1 -0
- package/assets/esri/themes/base/widgets/_ElevationProfile.scss +3 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/RibbonLine.glsl.js +57 -72
- package/core/image/apng.js +1 -1
- package/core/image/gif.js +1 -1
- package/core/urlUtils.js +1 -1
- package/interfaces.d.ts +12 -0
- package/layers/support/ImageElement.js +1 -1
- package/layers/video/VideoController.js +1 -1
- package/package.json +1 -1
- package/support/BasemapStyle.js +5 -0
- package/support/basemapUtils.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/webgl/Overlay.js +1 -1
- package/views/2d/engine/webgl/animatedFormats/utils.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementVisualization.js +1 -1
- package/views/3d/analysis/Dimension/DimensionVisualization.js +1 -1
- package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementVisualization.js +1 -1
- package/views/3d/interactive/editingTools/settings.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/terrain/TileTexture.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +12 -13
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBuffer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/strokes.js +1 -1
- package/views/3d/webgl-engine/lib/glUtil3D.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/WaterTextureRepository.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/statistics/RendererPerformanceInfo.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/widgets/ElevationProfile/support/chartUtils.js +1 -1
- package/assets/esri/core/workers/chunks/308eeeaec591b4eea1de.js +0 -1
- package/assets/esri/core/workers/chunks/498dca81073e1fb477b9.js +0 -1
- package/assets/esri/core/workers/chunks/b2a0e3e1dfccda7ed12e.js +0 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{addLinearDepth as e,addCalculateLinearDepth as
|
|
5
|
+
import{addLinearDepth as e,addCalculateLinearDepth as i}from"../views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js";import{ShaderOutput as t}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SliceDraw as o}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{ObjectAndLayerIdColor as r}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js";import{RibbonVertexPosition as n}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js";import{OutputDepth as a}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputDepth.glsl.js";import{LineStipple as s,computePixelSize as l}from"../views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js";import{MarkerSizing as d}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MarkerSizing.glsl.js";import{multipassTerrainTest as p}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MultipassTerrainTest.glsl.js";import{PiUtils as c}from"../views/3d/webgl-engine/core/shaderLibrary/shading/PiUtils.glsl.js";import{symbolAlphaCutoff as g}from"../views/3d/webgl-engine/core/shaderLibrary/util/AlphaCutoff.js";import{ColorConversion as m}from"../views/3d/webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js";import{addProjViewLocalOrigin as v,addPixelRatio as f}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float2PassUniform as u}from"../views/3d/webgl-engine/core/shaderModules/Float2PassUniform.js";import{Float4PassUniform as h}from"../views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js";import{FloatPassUniform as D}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as S}from"../views/3d/webgl-engine/core/shaderModules/interfaces.js";import{Matrix4PassUniform as b}from"../views/3d/webgl-engine/core/shaderModules/Matrix4PassUniform.js";import{ShaderBuilder as x}from"../views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js";import{TransparencyPassType as L}from"../views/3d/webgl-engine/lib/TransparencyPassType.js";import{VertexAttribute as w}from"../views/3d/webgl-engine/lib/VertexAttribute.js";import{LineMarkerSpace as y}from"../views/3d/webgl-engine/shaders/LineMarkerTechniqueConfiguration.js";import{CapType as C}from"../views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js";const j=1;function R(R){const A=new x,{vertex:P,fragment:F}=A,z=R.multipassEnabled&&(R.output===t.Color||R.output===t.Alpha);A.include(c),A.include(n,R),A.include(s,R);const E=R.applyMarkerOffset&&!R.draped;E&&(P.uniforms.add(new D("markerScale",(e=>e.markerScale))),A.include(d,{space:y.World,draped:!1})),R.output===t.Depth&&A.include(a,R),A.include(r,R),v(P,R),P.uniforms.add(new b("inverseProjectionMatrix",((e,i)=>i.camera.inverseProjectionMatrix)),new u("nearFar",((e,i)=>i.camera.nearFar)),new D("miterLimit",(e=>"miter"!==e.join?0:e.miterLimit)),new h("viewport",((e,i)=>i.camera.fullViewport))),P.constants.add("LARGE_HALF_FLOAT","float",65500),A.attributes.add(w.POSITION,"vec3"),A.attributes.add(w.SUBDIVISIONFACTOR,"float"),A.attributes.add(w.UV0,"vec2"),A.attributes.add(w.AUXPOS1,"vec3"),A.attributes.add(w.AUXPOS2,"vec3"),A.varyings.add("vColor","vec4"),A.varyings.add("vpos","vec3"),e(A),z&&A.varyings.add("depth","float");const T=R.stippleEnabled;T&&A.varyings.add("vLineSizeInv","float");const O=R.capType===C.ROUND,V=T||O;V&&A.varyings.add("vLineWidth","float");const W=R.innerColorEnabled||O;W&&A.varyings.add("vLineDistance","float");const I=R.stippleEnabled&&O,N=R.falloffEnabled||I;N&&A.varyings.add("vLineDistanceNorm","float"),O&&(A.varyings.add("vSegmentSDF","float"),A.varyings.add("vReverseSegmentSDF","float")),P.code.add(S`#define PERPENDICULAR(v) vec2(v.y, -v.x);
|
|
6
6
|
float interp(float ncp, vec4 a, vec4 b) {
|
|
7
7
|
return (-ncp - a.z) / (b.z - a.z);
|
|
8
8
|
}
|
|
@@ -11,11 +11,11 @@ float s = sin(a);
|
|
|
11
11
|
float c = cos(a);
|
|
12
12
|
mat2 m = mat2(c, -s, s, c);
|
|
13
13
|
return m * v;
|
|
14
|
-
}`),P.code.add(
|
|
14
|
+
}`),P.code.add(S`vec4 projectAndScale(vec4 pos) {
|
|
15
15
|
vec4 posNdc = proj * pos;
|
|
16
16
|
posNdc.xy *= viewport.zw / posNdc.w;
|
|
17
17
|
return posNdc;
|
|
18
|
-
}`),
|
|
18
|
+
}`),i(A),P.code.add(S`
|
|
19
19
|
void clipAndTransform(inout vec4 pos, inout vec4 prev, inout vec4 next, in bool isStartVertex) {
|
|
20
20
|
float vnp = nearFar[0] * 0.99;
|
|
21
21
|
|
|
@@ -57,7 +57,7 @@ return posNdc;
|
|
|
57
57
|
next = projectAndScale(next);
|
|
58
58
|
prev = projectAndScale(prev);
|
|
59
59
|
}
|
|
60
|
-
`),f(P),P.code.add(
|
|
60
|
+
`),f(P),P.code.add(S`
|
|
61
61
|
void main(void) {
|
|
62
62
|
// unpack values from uv0.y
|
|
63
63
|
bool isStartVertex = abs(abs(uv0.y)-3.0) == 1.0;
|
|
@@ -77,8 +77,8 @@ return posNdc;
|
|
|
77
77
|
float lineSize = getSize();
|
|
78
78
|
float lineWidth = lineSize * pixelRatio;
|
|
79
79
|
|
|
80
|
-
${
|
|
81
|
-
${T?
|
|
80
|
+
${V?S`vLineWidth = lineWidth;`:""}
|
|
81
|
+
${T?S`vLineSizeInv = 1.0 / lineSize;`:""}
|
|
82
82
|
|
|
83
83
|
// convert sub-pixel coverage to alpha
|
|
84
84
|
if (lineWidth < 1.0) {
|
|
@@ -94,20 +94,20 @@ return posNdc;
|
|
|
94
94
|
vec4 pos = view * vec4(position.xyz, 1.0);
|
|
95
95
|
vec4 prev = view * vec4(auxpos1.xyz, 1.0);
|
|
96
96
|
vec4 next = view * vec4(auxpos2.xyz, 1.0);
|
|
97
|
-
`),E&&P.code.add(
|
|
97
|
+
`),E&&P.code.add(S`vec4 other = isStartVertex ? next : prev;
|
|
98
98
|
bool markersHidden = areWorldMarkersHidden(pos, other);
|
|
99
99
|
if(!isJoin && !markersHidden) {
|
|
100
100
|
pos.xyz += normalize(other.xyz - pos.xyz) * getWorldMarkerSize(pos) * 0.5;
|
|
101
|
-
}`),P.code.add(
|
|
101
|
+
}`),P.code.add(S`clipAndTransform(pos, prev, next, isStartVertex);
|
|
102
102
|
vec2 left = (pos.xy - prev.xy);
|
|
103
103
|
vec2 right = (next.xy - pos.xy);
|
|
104
104
|
float leftLen = length(left);
|
|
105
|
-
float rightLen = length(right);`);(
|
|
105
|
+
float rightLen = length(right);`);(R.stippleEnabled||O)&&P.code.add(S`
|
|
106
106
|
float isEndVertex = float(!isStartVertex);
|
|
107
107
|
vec2 segmentOrigin = mix(pos.xy, prev.xy, isEndVertex);
|
|
108
108
|
vec2 segment = mix(right, left, isEndVertex);
|
|
109
|
-
${
|
|
110
|
-
`),P.code.add(
|
|
109
|
+
${O?S`vec2 segmentEnd = mix(next.xy, pos.xy, isEndVertex);`:""}
|
|
110
|
+
`),P.code.add(S`left = (leftLen > 0.001) ? left/leftLen : vec2(0.0, 0.0);
|
|
111
111
|
right = (rightLen > 0.001) ? right/rightLen : vec2(0.0, 0.0);
|
|
112
112
|
vec2 capDisplacementDir = vec2(0, 0);
|
|
113
113
|
vec2 joinDisplacementDir = vec2(0, 0);
|
|
@@ -123,18 +123,18 @@ if (!isOutside) {
|
|
|
123
123
|
displacementLen = min(displacementLen, min(leftLen, rightLen)/abs(nDotSeg));
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
if (isOutside && (displacementLen > miterLimit * lineWidth)) {`),
|
|
126
|
+
if (isOutside && (displacementLen > miterLimit * lineWidth)) {`),R.roundJoins?P.code.add(S`
|
|
127
127
|
vec2 startDir = leftLen < 0.001 ? right : left;
|
|
128
128
|
startDir = PERPENDICULAR(startDir);
|
|
129
129
|
|
|
130
130
|
vec2 endDir = rightLen < 0.001 ? left : right;
|
|
131
131
|
endDir = PERPENDICULAR(endDir);
|
|
132
132
|
|
|
133
|
-
float factor = ${
|
|
133
|
+
float factor = ${R.stippleEnabled?S`min(1.0, subdivisionFactor * ${S.float((j+2)/(j+1))})`:S`subdivisionFactor`};
|
|
134
134
|
|
|
135
135
|
float rotationAngle = acos(clamp(dot(startDir, endDir), -1.0, 1.0));
|
|
136
136
|
joinDisplacementDir = rotate(startDir, -sign(uv0.y) * factor * rotationAngle);
|
|
137
|
-
`):P.code.add(
|
|
137
|
+
`):P.code.add(S`if (leftLen < 0.001) {
|
|
138
138
|
joinDisplacementDir = right;
|
|
139
139
|
}
|
|
140
140
|
else if (rightLen < 0.001) {
|
|
@@ -143,7 +143,7 @@ joinDisplacementDir = left;
|
|
|
143
143
|
else {
|
|
144
144
|
joinDisplacementDir = (isStartVertex || subdivisionFactor > 0.0) ? right : left;
|
|
145
145
|
}
|
|
146
|
-
joinDisplacementDir = PERPENDICULAR(joinDisplacementDir);`);const $=
|
|
146
|
+
joinDisplacementDir = PERPENDICULAR(joinDisplacementDir);`);const $=R.capType!==C.BUTT;return P.code.add(S`
|
|
147
147
|
displacementLen = lineWidth;
|
|
148
148
|
}
|
|
149
149
|
} else {
|
|
@@ -151,64 +151,49 @@ joinDisplacementDir = PERPENDICULAR(joinDisplacementDir);`);const $=A.capType!==
|
|
|
151
151
|
joinDisplacementDir = isStartVertex ? right : left;
|
|
152
152
|
joinDisplacementDir = PERPENDICULAR(joinDisplacementDir);
|
|
153
153
|
|
|
154
|
-
${$?
|
|
154
|
+
${$?S`capDisplacementDir = isStartVertex ? -right : left;`:""}
|
|
155
155
|
}
|
|
156
|
-
`),P.code.add(
|
|
156
|
+
`),P.code.add(S`
|
|
157
157
|
// Displacement (in pixels) caused by join/or cap
|
|
158
158
|
vec2 dpos = joinDisplacementDir * sign(uv0.y) * displacementLen + capDisplacementDir * displacementLen;
|
|
159
159
|
|
|
160
|
-
${
|
|
160
|
+
${N||W?S`float lineDistNorm = sign(uv0.y) * pos.w;`:""}
|
|
161
161
|
|
|
162
|
-
${
|
|
163
|
-
${
|
|
162
|
+
${W?S`vLineDistance = lineWidth * lineDistNorm;`:""}
|
|
163
|
+
${N?S`vLineDistanceNorm = lineDistNorm;`:""}
|
|
164
164
|
|
|
165
165
|
pos.xy += dpos;
|
|
166
|
-
`),
|
|
166
|
+
`),O&&P.code.add(S`vec2 segmentDir = normalize(segment);
|
|
167
167
|
vSegmentSDF = (isJoin && isStartVertex) ? LARGE_HALF_FLOAT : (dot(pos.xy - segmentOrigin, segmentDir) * pos.w) ;
|
|
168
|
-
vReverseSegmentSDF = (isJoin && !isStartVertex) ? LARGE_HALF_FLOAT : (dot(pos.xy - segmentEnd, -segmentDir) * pos.w);`),
|
|
169
|
-
float worldToScreenRatio = computeWorldToScreenRatio(segmentCenter);`),P.code.add(
|
|
168
|
+
vReverseSegmentSDF = (isJoin && !isStartVertex) ? LARGE_HALF_FLOAT : (dot(pos.xy - segmentEnd, -segmentDir) * pos.w);`),R.stippleEnabled&&(R.draped?P.uniforms.add(new D("worldToScreenRatio",((e,i)=>1/i.screenToPCSRatio))):P.code.add(S`vec3 segmentCenter = mix((auxpos2 + position) * 0.5, (position + auxpos1) * 0.5, isEndVertex);
|
|
169
|
+
float worldToScreenRatio = computeWorldToScreenRatio(segmentCenter);`),P.code.add(S`float segmentLengthScreenDouble = length(segment);
|
|
170
170
|
float segmentLengthScreen = segmentLengthScreenDouble * 0.5;
|
|
171
171
|
float discreteWorldToScreenRatio = discretizeWorldToScreenRatio(worldToScreenRatio);
|
|
172
172
|
float segmentLengthRender = length(mix(auxpos2 - position, position - auxpos1, isEndVertex));
|
|
173
|
-
vStipplePatternStretch = worldToScreenRatio / discreteWorldToScreenRatio;`),
|
|
174
|
-
float startPseudoScreen = uv0.x * discreteWorldToScreenRatio - mix(0.0, segmentLengthPseudoScreen, isEndVertex);`):P.code.add(
|
|
175
|
-
float segmentLengthPseudoScreen = segmentLengthRender * discreteWorldToScreenRatio;`),P.uniforms.add(new D("stipplePatternPixelSize",(e=>l(e)))),P.code.add(
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
// Apply this offset to the actual vertex coordinate (can be screen or pseudo-screen space)
|
|
191
|
-
vStippleDistance += (stippleDisplacementFactor - isEndVertex) * (vStippleDistanceLimits.y - vStippleDistanceLimits.x);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
// Cancel out perspective correct interpolation because we want this length the really represent the screen distance
|
|
195
|
-
vStippleDistanceLimits *= pos.w;
|
|
196
|
-
vStippleDistance *= pos.w;
|
|
197
|
-
|
|
198
|
-
// Disable stipple distance limits on caps
|
|
199
|
-
vStippleDistanceLimits = isJoin ?
|
|
200
|
-
vStippleDistanceLimits :
|
|
201
|
-
isStartVertex ?
|
|
202
|
-
vec2(-1e038, vStippleDistanceLimits.y) :
|
|
203
|
-
vec2(vStippleDistanceLimits.x, 1e038);
|
|
204
|
-
`)),P.code.add(b`
|
|
173
|
+
vStipplePatternStretch = worldToScreenRatio / discreteWorldToScreenRatio;`),R.draped?P.code.add(S`float segmentLengthPseudoScreen = segmentLengthScreen / pixelRatio * discreteWorldToScreenRatio / worldToScreenRatio;
|
|
174
|
+
float startPseudoScreen = uv0.x * discreteWorldToScreenRatio - mix(0.0, segmentLengthPseudoScreen, isEndVertex);`):P.code.add(S`float startPseudoScreen = mix(uv0.x, uv0.x - segmentLengthRender, isEndVertex) * discreteWorldToScreenRatio;
|
|
175
|
+
float segmentLengthPseudoScreen = segmentLengthRender * discreteWorldToScreenRatio;`),P.uniforms.add(new D("stipplePatternPixelSize",(e=>l(e)))),P.code.add(S`float patternLength = lineSize * stipplePatternPixelSize;
|
|
176
|
+
vStippleDistanceLimits = computeStippleDistanceLimits(startPseudoScreen, segmentLengthPseudoScreen, segmentLengthScreen, patternLength);
|
|
177
|
+
vStippleDistance = mix(vStippleDistanceLimits.x, vStippleDistanceLimits.y, isEndVertex);
|
|
178
|
+
if (segmentLengthScreenDouble >= 0.001) {
|
|
179
|
+
vec2 stippleDisplacement = pos.xy - segmentOrigin;
|
|
180
|
+
float stippleDisplacementFactor = dot(segment, stippleDisplacement) / (segmentLengthScreenDouble * segmentLengthScreenDouble);
|
|
181
|
+
vStippleDistance += (stippleDisplacementFactor - isEndVertex) * (vStippleDistanceLimits.y - vStippleDistanceLimits.x);
|
|
182
|
+
}
|
|
183
|
+
vStippleDistanceLimits *= pos.w;
|
|
184
|
+
vStippleDistance *= pos.w;
|
|
185
|
+
vStippleDistanceLimits = isJoin ?
|
|
186
|
+
vStippleDistanceLimits :
|
|
187
|
+
isStartVertex ?
|
|
188
|
+
vec2(-1e038, vStippleDistanceLimits.y) :
|
|
189
|
+
vec2(vStippleDistanceLimits.x, 1e038);`)),P.code.add(S`
|
|
205
190
|
// Convert back into NDC
|
|
206
191
|
pos.xy = (pos.xy / viewport.zw) * pos.w;
|
|
207
192
|
|
|
208
193
|
vColor = getColor();
|
|
209
194
|
vColor.a *= coverage;
|
|
210
195
|
|
|
211
|
-
${
|
|
196
|
+
${R.wireframe&&!R.draped?"pos.z -= 0.001 * pos.w;":""}
|
|
212
197
|
|
|
213
198
|
// transform final position to camera space for slicing
|
|
214
199
|
vpos = (inverseProjectionMatrix * pos).xyz;
|
|
@@ -216,11 +201,11 @@ float segmentLengthPseudoScreen = segmentLengthRender * discreteWorldToScreenRat
|
|
|
216
201
|
forwardObjectAndLayerIdColor();
|
|
217
202
|
}
|
|
218
203
|
}
|
|
219
|
-
`),z&&
|
|
204
|
+
`),z&&A.include(p,R),A.include(o,R),F.include(m),F.code.add(S`
|
|
220
205
|
void main() {
|
|
221
206
|
discardBySlice(vpos);
|
|
222
207
|
${z?"terrainDepthTest(gl_FragCoord, depth);":""}
|
|
223
|
-
`),
|
|
208
|
+
`),R.wireframe?F.code.add(S`vec4 finalColor = vec4(1.0, 0.0, 1.0, 1.0);`):(O&&F.code.add(S`
|
|
224
209
|
float sdf = min(vSegmentSDF, vReverseSegmentSDF);
|
|
225
210
|
vec2 fragmentPosition = vec2(
|
|
226
211
|
min(sdf, 0.0),
|
|
@@ -231,10 +216,10 @@ float segmentLengthPseudoScreen = segmentLengthRender * discreteWorldToScreenRat
|
|
|
231
216
|
float fragmentCapSDF = (fragmentRadius - vLineWidth) * 0.5; // Divide by 2 to transform from double pixel scale
|
|
232
217
|
float capCoverage = clamp(0.5 - fragmentCapSDF, 0.0, 1.0);
|
|
233
218
|
|
|
234
|
-
if (capCoverage < ${
|
|
219
|
+
if (capCoverage < ${S.float(g)}) {
|
|
235
220
|
discard;
|
|
236
221
|
}
|
|
237
|
-
`),
|
|
222
|
+
`),I?F.code.add(S`
|
|
238
223
|
vec2 stipplePosition = vec2(
|
|
239
224
|
min(getStippleSDF() * 2.0 - 1.0, 0.0),
|
|
240
225
|
vLineDistanceNorm * gl_FragCoord.w
|
|
@@ -242,22 +227,22 @@ float segmentLengthPseudoScreen = segmentLengthRender * discreteWorldToScreenRat
|
|
|
242
227
|
float stippleRadius = length(stipplePosition * vLineWidth);
|
|
243
228
|
float stippleCapSDF = (stippleRadius - vLineWidth) * 0.5; // Divide by 2 to transform from double pixel scale
|
|
244
229
|
float stippleCoverage = clamp(0.5 - stippleCapSDF, 0.0, 1.0);
|
|
245
|
-
float stippleAlpha = step(${
|
|
246
|
-
`):F.code.add(
|
|
230
|
+
float stippleAlpha = step(${S.float(g)}, stippleCoverage);
|
|
231
|
+
`):F.code.add(S`float stippleAlpha = getStippleAlpha();`),F.uniforms.add(new h("intrinsicColor",(e=>e.color))),R.output!==t.ObjectAndLayerIdColor&&F.code.add(S`discardByStippleAlpha(stippleAlpha, stippleAlphaColorDiscard);`),F.code.add(S`vec4 color = intrinsicColor * vColor;`),R.innerColorEnabled&&(F.uniforms.add(new h("innerColor",(e=>e.innerColor??e.color)),new D("innerWidth",((e,i)=>e.innerWidth*i.camera.pixelRatio))),F.code.add(S`float distToInner = abs(vLineDistance * gl_FragCoord.w) - innerWidth;
|
|
247
232
|
float innerAA = clamp(0.5 - distToInner, 0.0, 1.0);
|
|
248
233
|
float innerAlpha = innerColor.a + color.a * (1.0 - innerColor.a);
|
|
249
|
-
color = mix(color, vec4(innerColor.rgb, innerAlpha), innerAA);`)),F.code.add(
|
|
250
|
-
${
|
|
234
|
+
color = mix(color, vec4(innerColor.rgb, innerAlpha), innerAA);`)),F.code.add(S`vec4 finalColor = blendStipple(color, stippleAlpha);`),R.falloffEnabled&&(F.uniforms.add(new D("falloff",(e=>e.falloff))),F.code.add(S`finalColor.a *= pow(max(0.0, 1.0 - abs(vLineDistanceNorm * gl_FragCoord.w)), falloff);`))),F.code.add(S`
|
|
235
|
+
${R.output===t.ObjectAndLayerIdColor?S`finalColor.a = 1.0;`:""}
|
|
251
236
|
|
|
252
|
-
if (finalColor.a < ${
|
|
237
|
+
if (finalColor.a < ${S.float(g)}) {
|
|
253
238
|
discard;
|
|
254
239
|
}
|
|
255
240
|
|
|
256
|
-
${
|
|
257
|
-
${
|
|
258
|
-
${
|
|
259
|
-
${
|
|
260
|
-
${
|
|
261
|
-
${
|
|
241
|
+
${R.output===t.Alpha?S`fragColor = vec4(finalColor.a);`:""}
|
|
242
|
+
${R.output===t.Color?S`fragColor = highlightSlice(finalColor, vpos);`:""}
|
|
243
|
+
${R.output===t.Color&&R.transparencyPassType===L.Color?"fragColor = premultiplyAlpha(fragColor);":""}
|
|
244
|
+
${R.output===t.Highlight?S`fragColor = vec4(1.0);`:""}
|
|
245
|
+
${R.output===t.Depth?S`outputDepth(linearDepth);`:""}
|
|
246
|
+
${R.output===t.ObjectAndLayerIdColor?S`outputObjectAndLayerIdColor();`:""}
|
|
262
247
|
}
|
|
263
|
-
`),
|
|
248
|
+
`),A}const A=Object.freeze(Object.defineProperty({__proto__:null,RIBBONLINE_NUM_ROUND_JOIN_SUBDIVISIONS:j,build:R},Symbol.toStringTag,{value:"Module"}));export{j as R,A as a,R as b};
|
package/core/image/apng.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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{p as t}from"../../chunks/index.js";import{throwIfAborted as e}from"../promiseUtils.js";import{Milliseconds as o}from"../time.js";async function r(r,n){const
|
|
5
|
+
import{p as t}from"../../chunks/index.js";import{throwIfAborted as e}from"../promiseUtils.js";import{Milliseconds as o}from"../time.js";async function r(r,n){const a=t(r);if(a instanceof Error)throw a;await a.createImages(),e(n);const{frames:i,width:s,height:p}=a,c=document.createElement("canvas");c.width=s,c.height=p;const l=c.getContext("2d",{willReadFrequently:!0}),m=[],h=[];let g=0;for(const t of i){const e=o(t.delay||100);h.push(e),g+=e;const r=t.imageElement;0===t.blendOp?l.globalCompositeOperation="copy":l.globalCompositeOperation="source-over";const n=2===t.disposeOp?l.getImageData(t.left,t.top,t.width,t.height):void 0;l.drawImage(r,t.left,t.top);const a=l.getImageData(0,0,s,p);m.push(a),0===t.disposeOp||(1===t.disposeOp?l.clearRect(t.left,t.top,t.width,t.height):2===t.disposeOp&&l.putImageData(n,t.left,t.top))}return{frameCount:i.length,duration:g,frameDurations:h,getFrame:t=>m[t],width:s,height:p}}const n=[137,80,78,71,13,10,26,10];function a(t){const e=new Uint8Array(t);return!n.some(((t,o)=>t!==e[o]))}function i(t){if(!a(t))return!1;const e=new DataView(t),o=new Uint8Array(t);let r,n=8;do{const t=e.getUint32(n);if(r=String.fromCharCode.apply(String,Array.prototype.slice.call(o.subarray(n+4,n+8))),"acTL"===r)return!0;n+=12+t}while("IEND"!==r&&n<o.length);return!1}export{i as isAnimatedPNG,a as isPNG,r as parseApng};
|
package/core/image/gif.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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{Milliseconds as t}from"../time.js";import{imageTypeToCanvas as e}from"../../geometry/support/meshUtils/exporters/gltf/imageutils.js";import{p as i,d as
|
|
5
|
+
import{Milliseconds as t}from"../time.js";import{imageTypeToCanvas as e}from"../../geometry/support/meshUtils/exporters/gltf/imageutils.js";import{p as i,d as n}from"../../chunks/index2.js";async function s(s,a){const r=i(s),o=n(r,!0),{width:c,height:d}=r.lsd,m=document.createElement("canvas");m.width=c,m.height=d;const u=m.getContext("2d",{willReadFrequently:!0}),f=[],h=[];let g=0;for(const i of o){const n=t(i.delay||100);h.push(n),g+=n;const s=new ImageData(i.patch,i.dims.width,i.dims.height),a=e(s),r=3===i.disposalType?u.getImageData(i.dims.left,i.dims.top,i.dims.width,i.dims.height):void 0;u.drawImage(a,i.dims.left,i.dims.top);const o=u.getImageData(0,0,c,d);f.push(o),1===i.disposalType||(2===i.disposalType?u.clearRect(i.dims.left,i.dims.top,i.dims.width,i.dims.height):3===i.disposalType&&u.putImageData(r,i.dims.left,i.dims.top))}return{frameCount:o.length,duration:g,frameDurations:h,getFrame:t=>f[t],width:c,height:d}}const a=[71,73,70];function r(t){const e=new Uint8Array(t);return!a.some(((t,i)=>t!==e[i]))}function o(t){if(!r(t))return!1;const e=new DataView(t),i=e.getUint8(10);let n=13+(128&i?3*2**(1+(7&i)):0),s=0,a=!1;for(;!a;){switch(e.getUint8(n++)){case 33:if(!o())return!1;break;case 44:c();break;case 59:a=!0;break;default:return!1}if(s>1)return!0}function o(){switch(e.getUint8(n++)){case 249:d();break;case 1:m();break;case 254:u();break;case 255:f();break;default:return!1}return!0}function c(){s++,n+=8;const t=e.getUint8(n++);n+=128&t?3*2**(1+(7&t)):0,n++,h()}function d(){n++,n+=4,h()}function m(){s++,n++,n+=12,h()}function u(){h()}function f(){n++,n+=8,n+=3,h()}function h(){let t;for(;t=e.getUint8(n++);)n+=t}return!1}export{o as isAnimatedGIF,r as isGIF,s as parseGif};
|
package/core/urlUtils.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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../config.js";import{isSome as n}from"./arrayUtils.js";import e from"./Error.js";import{isSerializable as r}from"./JSONSupport.js";import o from"./Logger.js";import{parseKnownArcGISOnlineDomain as s}from"../portal/support/urlUtils.js";import{base64ToArrayBuffer as i,arrayBufferToBase64 as u}from"../support/base64Utils.js";const l=o.getLogger("esri.core.urlUtils"),c=t.request,f="esri/config: esriConfig.request.proxyUrl is not set.",a=/^\s*[a-z][a-z0-9-+.]*:(?![0-9])/i,p=/^\s*http:/i,h=/^\s*https:/i,m=/^\s*file:/i,d=/:\d+$/,g=/^https?:\/\/[^/]+\.arcgis.com\/sharing(\/|$)/i,y=new RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$"),$=new RegExp("^((([^\\[:]+):)?([^@]+)@)?(\\[([^\\]]+)\\]|([^\\[:]*))(:([0-9]+))?$");class x{constructor(t=""){this.uri=t,this.scheme=null,this.authority=null,this.path=null,this.query=null,this.fragment=null,this.user=null,this.password=null,this.host=null,this.port=null;let n=this.uri.match(y);this.scheme=n[2]||(n[1]?"":null),this.authority=n[4]||(n[3]?"":null),this.path=n[5],this.query=n[7]||(n[6]?"":null),this.fragment=n[9]||(n[8]?"":null),null!=this.authority&&(n=this.authority.match($),this.user=n[3]||null,this.password=n[4]||null,this.host=n[6]||n[7],this.port=n[9]||null)}toString(){return this.uri}}const w={},O=new x(t.applicationUrl);let U=O;const R=j();let C=R;const q=()=>U,b=()=>C;function j(){const t=U.path,n=t.substring(0,t.lastIndexOf(t.split("/")[t.split("/").length-1]));return`${`${U.scheme}://${U.host}${null!=U.port?`:${U.port}`:""}`}${n}`}const L={setAppUrl:t=>U=t,setAppBaseUrl:t=>C=t,restoreUrls:()=>{U=O,C=R}};function I(t){if(!t)return null;const n={path:null,query:null},e=new x(t),r=t.indexOf("?");return null===e.query?n.path=t:(n.path=t.substring(0,r),n.query=A(e.query)),e.fragment&&(n.hash=e.fragment,null===e.query&&(n.path=n.path.substring(0,n.path.length-(e.fragment.length+1)))),n}function A(t){const n=t.split("&"),e={};for(const r of n){if(!r)continue;const t=r.indexOf("=");let n,o;t<0?(n=decodeURIComponent(r),o=""):(n=decodeURIComponent(r.slice(0,t)),o=decodeURIComponent(r.slice(t+1)));let s=e[n];"string"==typeof s&&(s=e[n]=[s]),Array.isArray(s)?s.push(o):e[n]=o}return e}function v(t,n){return t?n&&"function"==typeof n?Object.keys(t).map((e=>encodeURIComponent(e)+"="+encodeURIComponent(n(e,t[e])))).join("&"):Object.keys(t).map((e=>{const o=t[e];if(null==o)return"";const s=encodeURIComponent(e)+"=",i=n&&n[e];return i?s+encodeURIComponent(i(o)):Array.isArray(o)?o.map((t=>r(t)?s+encodeURIComponent(JSON.stringify(t)):s+encodeURIComponent(t))).join("&"):r(o)?s+encodeURIComponent(JSON.stringify(o)):s+encodeURIComponent(o)})).filter((t=>t)).join("&"):""}function P(t=!1){let n,r=c.proxyUrl;if("string"==typeof t){n=ht(t);const e=T(t);e&&(r=e.proxyUrl)}else n=!!t;if(!r)throw l.warn(f),new e("urlutils:proxy-not-set",f);n&&xt()&&(r=yt(r));return I(r)}function S(t){const n=T(t);let e,r;if(n){const t=E(n.proxyUrl);e=t.path,r=t.query?A(t.query):null}if(e){const n=I(t);t=e+"?"+n.path;const o=v({...r,...n.query});o&&(t=`${t}?${o}`)}return t}const k={path:"",query:""};function E(t){const n=t.indexOf("?");return-1!==n?(k.path=t.slice(0,n),k.query=t.slice(n+1)):(k.path=t,k.query=null),k}function B(t){return t=(t=wt(t=Ct(t=E(t).path),!0)).toLowerCase()}function H(t){const n={proxyUrl:t.proxyUrl,urlPrefix:B(t.urlPrefix)},e=c.proxyRules,r=n.urlPrefix;let o=e.length;for(let s=0;s<e.length;s++){const t=e[s].urlPrefix;if(0===r.indexOf(t)){if(r.length===t.length)return-1;o=s;break}0===t.indexOf(r)&&(o=s+1)}return e.splice(o,0,n),o}function T(t){const n=c.proxyRules,e=B(t);for(let r=0;r<n.length;r++)if(0===e.indexOf(n[r].urlPrefix))return n[r]}function J(t,n){if(!t||!n)return!1;t=z(t),n=z(n);const e=s(t),r=s(n);return null!=e&&null!=r?e.portalHostname===r.portalHostname:null==e&&null==r&&F(t,n,!0)}function N(t,n){if(!t||!n)return!1;t=z(t),n=z(n);const e=s(t),r=s(n);return null!=e&&null!=r&&e.portalHostname===r.portalHostname}function W(t,n){return t=z(t),n=z(n),wt(t)===wt(n)}function z(t){const n=(t=K(t)).indexOf("/sharing");return n>0?t.substring(0,n):t.replace(/\/+$/,"")}function D(t){const n=n=>null==n||n instanceof RegExp&&n.test(t)||"string"==typeof n&&t.startsWith(n),e=c.interceptors;if(e)for(const r of e)if(Array.isArray(r.urls)){if(r.urls.some(n))return r}else if(n(r.urls))return r;return null}function F(t,n,e=!1){if(!t||!n)return!1;const r=At(t),o=At(n);return!(!e&&r.scheme!==o.scheme)&&(null!=r.host&&null!=o.host&&(r.host.toLowerCase()===o.host.toLowerCase()&&r.port===o.port))}function M(t){if("string"==typeof t){if(!Y(t))return!0;t=At(t)}if(F(t,U))return!0;const n=c.trustedServers||[];for(let e=0;e<n.length;e++){const r=Q(n[e]);for(let n=0;n<r.length;n++)if(F(t,r[n]))return!0}return!1}function Q(t){return w[t]||(pt(t)||at(t)?w[t]=[new x(_(t))]:w[t]=[new x(`http://${t}`),new x(`https://${t}`)]),w[t]}function _(t,n=C,e){return at(t)?e&&e.preserveProtocolRelative?t:"http"===U.scheme&&U.authority===X(t).slice(2)?`http:${t}`:`https:${t}`:pt(t)?t:V("/"===t[0]?Ot(n):n,t)}function G(t,n=C,e){if(null==t||!Y(t))return t;const r=K(t),o=r.toLowerCase(),s=K(n).toLowerCase().replace(/\/+$/,""),i=e?K(e).toLowerCase().replace(/\/+$/,""):null;if(i&&0!==s.indexOf(i))return t;const u=(t,n,e)=>-1===(e=t.indexOf(n,e))?t.length:e;let l=u(o,"/",o.indexOf("//")+2),c=-1;for(;o.slice(0,l+1)===s.slice(0,l)+"/"&&(c=l+1,l!==o.length);)l=u(o,"/",l+1);if(-1===c)return t;if(i&&c<i.length)return t;t=r.slice(c);const f=s.slice(c-1).replaceAll(/[^/]+/g,"").length;if(f>0)for(let a=0;a<f;a++)t=`../${t}`;else t=`./${t}`;return t}function K(t){return t=Lt(t=jt(t=bt(t=_(t=t.trim()))))}function V(...t){const e=t.filter(n);if(!e||!e.length)return;const r=[];if(Y(e[0])){const t=e[0],n=t.indexOf("//");-1!==n&&(r.push(t.slice(0,n+1)),dt(e[0])&&(r[0]+="/"),e[0]=t.slice(n+2))}else"/"===e[0][0]&&r.push("");const o=e.reduce(((t,n)=>n?t.concat(n.split("/")):t),[]);for(let n=0;n<o.length;n++){const t=o[n];".."===t&&r.length>0&&".."!==r[r.length-1]?r.pop():(!t&&n===o.length-1||t&&("."!==t||0===r.length))&&r.push(t)}return r.join("/")}function X(t,n=!1){if(null==t||Z(t)||tt(t))return null;let e=t.indexOf("://");if(-1===e&&at(t))e=2;else{if(-1===e)return null;e+=3}const r=t.indexOf("/",e);return-1!==r&&(t=t.slice(0,r)),n&&(t=wt(t,!0)),t}function Y(t){return at(t)||pt(t)}function Z(t){return null!=t&&"blob:"===t.slice(0,5)}function tt(t){return null!=t&&"data:"===t.slice(0,5)}function nt(t){const n=ot(t);return n&&n.isBase64?i(n.data):null}function et(t){return u(t).replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}const rt=/^data:(.*?)(;base64)?,(.*)$/;function ot(t){const n=t.match(rt);if(!n)return null;const[,e,r,o]=n;return{mediaType:e,isBase64:!!r,data:o}}function st(t){return t.isBase64?`data:${t.mediaType};base64,${t.data}`:`data:${t.mediaType},${t.data}`}function it(t){const n=nt(t);if(!n)return null;const e=ot(t);return new Blob([n],{type:e.mediaType})}function ut(t,n){ct(t,n)}function lt(t,n){ft(t,n)}function ct(t,n){const e=it(t);return!!e&&ft(e,n)}function ft(t,n){if(!t)return!1;const e=document.createElement("a");if(!("download"in e))return!1;const r=URL.createObjectURL(t);return e.download=n,e.href=r,e.style.display="none",document.body.appendChild(e),e.click(),document.body.removeChild(e),URL.revokeObjectURL(r),!0}function at(t){return null!=t&&"/"===t[0]&&"/"===t[1]}function pt(t){return null!=t&&a.test(t)}function ht(t){return null!=t&&h.test(t)||"https"===U.scheme&&at(t)}function mt(t){return null!=t&&p.test(t)||"http"===U.scheme&&at(t)}function dt(t){return null!=t&&m.test(t)}function gt(t){return at(t)?`http:${t}`:t.replace(h,"http:")}function yt(t){return at(t)?`https:${t}`:t.replace(p,"https:")}function $t(){return"http"===U.scheme}function xt(){return"https"===U.scheme}function wt(t,n=!1){return at(t)?t.slice(2):(t=t.replace(a,""),n&&t.length>1&&"/"===t[0]&&"/"===t[1]&&(t=t.slice(2)),t)}function Ot(t){const n=t.indexOf("//"),e=t.indexOf("/",n+2);return-1===e?t:t.slice(0,e)}function Ut(t){let n=0;if(Y(t)){const e=t.indexOf("//");-1!==e&&(n=e+2)}const e=t.lastIndexOf("/");return e<n?t:t.slice(0,e+1)}function Rt(t,n){if(!t)return"";const e=I(t).path.replace(/\/+$/,""),r=e.substring(e.lastIndexOf("/")+1);if(!n?.length)return r;const o=new RegExp(`.(${n.join("|")})$`,"ig");return r.replace(o,"")}function Ct(t){return t&&"/"===t[t.length-1]?t:`${t}/`}function qt(t){return t.replace(/\/+$/,"")}function bt(t){if(/^https?:\/\//i.test(t)){const n=E(t);t=(t=n.path.replaceAll(/\/{2,}/g,"/")).replace("/","//"),n.query&&(t+=`?${n.query}`)}return t}function jt(t){return t.replace(/^(https?:\/\/)(arcgis\.com)/i,"$1www.$2")}function Lt(t){const n=c.httpsDomains;if(!mt(t))return t;const e=t.indexOf("/",7);let r;if(r=-1===e?t:t.slice(0,e),r=r.toLowerCase().slice(7),d.test(r)){if(!r.endsWith(":80"))return t;r=r.slice(0,-3),t=t.replace(":80","")}return $t()&&r===U.authority&&!g.test(t)||(xt()&&r===U.authority||n&&n.some((t=>r===t||r.endsWith(`.${t}`)))||xt()&&!T(t))&&(t=yt(t)),t}function It(t,n,e){if(!(n&&e&&t&&Y(t)))return t;const r=t.indexOf("//"),o=t.indexOf("/",r+2),s=t.indexOf(":",r+2),i=Math.min(o<0?t.length:o,s<0?t.length:s);if(t.slice(r+2,i).toLowerCase()!==n.toLowerCase())return t;return`${t.slice(0,r+2)}${e}${t.slice(i)}`}function At(t){return"string"==typeof t?new x(_(t)):(t.scheme||(t.scheme=U.scheme),t)}function vt(t){return Nt.test(t)}function Pt(t,n){const e=I(t),r=Object.keys(e.query||{});return r.length>0&&n&&n.warn("removeQueryParameters()",`Url query parameters are not supported, the following parameters have been removed: ${r.join(", ")}.`),e.path}function St(t,n,e){const r=I(t),o=r.query||{};return o[n]=String(e),`${r.path}?${v(o)}`}function kt(t,n){const e=I(t),r=e.query||{};for(const s in n)r[s]=n[s];const o=v(r);return o?`${e.path}?${o}`:e.path}function Et(t,n){const{path:e,query:r}=I(t);if(!r)return t;delete r[n];const o=v(r);return o?`${e}?${o}`:e}function Bt(t){if(null==t)return null;const n=t.match(Jt);return n?n[2]:null}function Ht(t){if(null==t)return null;const n=t.match(Jt);return n?{path:n[1],extension:n[2]}:{path:t,extension:null}}async function Tt(t){if("string"==typeof t){return ot(t)??{data:t}}return new Promise(((n,e)=>{const r=new FileReader;r.readAsDataURL(t),r.onload=()=>n(ot(r.result)),r.onerror=t=>e(t)}))}const Jt=/([^.]*)\.([^\/]*)$/,Nt=/(^data:image\/svg|\.svg$)/i;export{x as Url,S as addProxy,H as addProxyRule,St as addQueryParameter,kt as addQueryParameters,et as base64UrlEncode,It as changeDomain,ot as dataComponents,nt as dataToArrayBuffer,it as dataToBlob,lt as downloadBlobAsFile,ut as downloadDataAsFile,b as getAppBaseUrl,q as getAppUrl,Rt as getFilename,D as getInterceptor,X as getOrigin,Bt as getPathExtension,T as getProxyRule,P as getProxyUrl,pt as hasProtocol,N as hasSameCanonicalArcGISOnlinePortal,J as hasSameCanonicalPortal,F as hasSameOrigin,W as hasSamePortal,Y as isAbsolute,xt as isAppHTTPS,Z as isBlobProtocol,tt as isDataProtocol,ht as isHTTPSProtocol,at as isProtocolRelative,vt as isSVG,M as isTrustedServer,V as join,_ as makeAbsolute,st as makeData,G as makeRelative,K as normalize,v as objectToQuery,Tt as parseData,A as queryToObject,Ut as removeFile,Et as removeQueryParameter,Pt as removeQueryParameters,qt as removeTrailingSlash,Ht as splitPathExtension,L as test,gt as toHTTP,yt as toHTTPS,w as trustedServersUrlCache,I as urlToObject};
|
|
5
|
+
import t from"../config.js";import{isSome as n}from"./arrayUtils.js";import e from"./Error.js";import{isSerializable as r}from"./JSONSupport.js";import o from"./Logger.js";import{parseKnownArcGISOnlineDomain as s}from"../portal/support/urlUtils.js";import{base64ToArrayBuffer as i,arrayBufferToBase64 as u}from"../support/base64Utils.js";const l=o.getLogger("esri.core.urlUtils"),c=t.request,f="esri/config: esriConfig.request.proxyUrl is not set.",a=/^\s*[a-z][a-z0-9-+.]*:(?![0-9])/i,p=/^\s*http:/i,h=/^\s*https:/i,m=/^\s*file:/i,d=/:\d+$/,g=/^https?:\/\/[^/]+\.arcgis.com\/sharing(\/|$)/i,y=new RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$"),$=new RegExp("^((([^\\[:]+):)?([^@]+)@)?(\\[([^\\]]+)\\]|([^\\[:]*))(:([0-9]+))?$");class x{constructor(t=""){this.uri=t,this.scheme=null,this.authority=null,this.path=null,this.query=null,this.fragment=null,this.user=null,this.password=null,this.host=null,this.port=null;let n=this.uri.match(y);this.scheme=n[2]||(n[1]?"":null),this.authority=n[4]||(n[3]?"":null),this.path=n[5],this.query=n[7]||(n[6]?"":null),this.fragment=n[9]||(n[8]?"":null),null!=this.authority&&(n=this.authority.match($),this.user=n[3]||null,this.password=n[4]||null,this.host=n[6]||n[7],this.port=n[9]||null)}toString(){return this.uri}}const w={},O=new x(t.applicationUrl);let U=O;const R=j();let C=R;const q=()=>U,b=()=>C;function j(){const t=U.path,n=t.substring(0,t.lastIndexOf(t.split("/")[t.split("/").length-1]));return`${`${U.scheme}://${U.host}${null!=U.port?`:${U.port}`:""}`}${n}`}const L={setAppUrl:t=>U=t,setAppBaseUrl:t=>C=t,restoreUrls:()=>{U=O,C=R}};function I(t){if(!t)return null;const n={path:null,query:null},e=new x(t),r=t.indexOf("?");return null===e.query?n.path=t:(n.path=t.substring(0,r),n.query=A(e.query)),e.fragment&&(n.hash=e.fragment,null===e.query&&(n.path=n.path.substring(0,n.path.length-(e.fragment.length+1)))),n}function A(t){const n=t.split("&"),e={};for(const r of n){if(!r)continue;const t=r.indexOf("=");let n,o;t<0?(n=decodeURIComponent(r),o=""):(n=decodeURIComponent(r.slice(0,t)),o=decodeURIComponent(r.slice(t+1)));let s=e[n];"string"==typeof s&&(s=e[n]=[s]),Array.isArray(s)?s.push(o):e[n]=o}return e}function v(t,n){return t?n&&"function"==typeof n?Object.keys(t).map((e=>encodeURIComponent(e)+"="+encodeURIComponent(n(e,t[e])))).join("&"):Object.keys(t).map((e=>{const o=t[e];if(null==o)return"";const s=encodeURIComponent(e)+"=",i=n&&n[e];return i?s+encodeURIComponent(i(o)):Array.isArray(o)?o.map((t=>r(t)?s+encodeURIComponent(JSON.stringify(t)):s+encodeURIComponent(t))).join("&"):r(o)?s+encodeURIComponent(JSON.stringify(o)):s+encodeURIComponent(o)})).filter((t=>t)).join("&"):""}function P(t=!1){let n,r=c.proxyUrl;if("string"==typeof t){n=ht(t);const e=T(t);e&&(r=e.proxyUrl)}else n=!!t;if(!r)throw l.warn(f),new e("urlutils:proxy-not-set",f);n&&xt()&&(r=yt(r));return I(r)}function S(t){const n=T(t);let e,r;if(n){const t=E(n.proxyUrl);e=t.path,r=t.query?A(t.query):null}if(e){const n=I(t);t=e+"?"+n.path;const o=v({...r,...n.query});o&&(t=`${t}?${o}`)}return t}const k={path:"",query:""};function E(t){const n=t.indexOf("?");return-1!==n?(k.path=t.slice(0,n),k.query=t.slice(n+1)):(k.path=t,k.query=null),k}function B(t){return t=(t=wt(t=Ct(t=E(t).path),!0)).toLowerCase()}function H(t){const n={proxyUrl:t.proxyUrl,urlPrefix:B(t.urlPrefix)},e=c.proxyRules,r=n.urlPrefix;let o=e.length;for(let s=0;s<e.length;s++){const t=e[s].urlPrefix;if(0===r.indexOf(t)){if(r.length===t.length)return-1;o=s;break}0===t.indexOf(r)&&(o=s+1)}return e.splice(o,0,n),o}function T(t){const n=c.proxyRules,e=B(t);for(let r=0;r<n.length;r++)if(0===e.indexOf(n[r].urlPrefix))return n[r]}function J(t,n){if(!t||!n)return!1;t=z(t),n=z(n);const e=s(t),r=s(n);return null!=e&&null!=r?e.portalHostname===r.portalHostname:null==e&&null==r&&F(t,n,!0)}function N(t,n){if(!t||!n)return!1;t=z(t),n=z(n);const e=s(t),r=s(n);return null!=e&&null!=r&&e.portalHostname===r.portalHostname}function W(t,n){return t=z(t),n=z(n),wt(t)===wt(n)}function z(t){const n=(t=K(t)).indexOf("/sharing");return n>0?t.substring(0,n):t.replace(/\/+$/,"")}function D(t){const n=n=>null==n||n instanceof RegExp&&n.test(t)||"string"==typeof n&&t.startsWith(n),e=c.interceptors;if(e)for(const r of e)if(Array.isArray(r.urls)){if(r.urls.some(n))return r}else if(n(r.urls))return r;return null}function F(t,n,e=!1){if(!t||!n)return!1;const r=At(t),o=At(n);return!(!e&&r.scheme!==o.scheme)&&(null!=r.host&&null!=o.host&&(r.host.toLowerCase()===o.host.toLowerCase()&&r.port===o.port))}function M(t){if("string"==typeof t){if(!Y(t))return!0;t=At(t)}if(F(t,U))return!0;const n=c.trustedServers||[];for(let e=0;e<n.length;e++){const r=Q(n[e]);for(let n=0;n<r.length;n++)if(F(t,r[n]))return!0}return!1}function Q(t){return w[t]||(pt(t)||at(t)?w[t]=[new x(_(t))]:w[t]=[new x(`http://${t}`),new x(`https://${t}`)]),w[t]}function _(t,n=C,e){return at(t)?e&&e.preserveProtocolRelative?t:"http"===U.scheme&&U.authority===X(t).slice(2)?`http:${t}`:`https:${t}`:pt(t)?t:V("/"===t[0]?Ot(n):n,t)}function G(t,n=C,e){if(null==t||!Y(t))return t;const r=K(t),o=r.toLowerCase(),s=K(n).toLowerCase().replace(/\/+$/,""),i=e?K(e).toLowerCase().replace(/\/+$/,""):null;if(i&&0!==s.indexOf(i))return t;const u=(t,n,e)=>-1===(e=t.indexOf(n,e))?t.length:e;let l=u(o,"/",o.indexOf("//")+2),c=-1;for(;o.slice(0,l+1)===s.slice(0,l)+"/"&&(c=l+1,l!==o.length);)l=u(o,"/",l+1);if(-1===c)return t;if(i&&c<i.length)return t;t=r.slice(c);const f=s.slice(c-1).replaceAll(/[^/]+/g,"").length;if(f>0)for(let a=0;a<f;a++)t=`../${t}`;else t=`./${t}`;return t}function K(t){return t=Lt(t=jt(t=bt(t=_(t=t.trim()))))}function V(...t){const e=t.filter(n);if(!e||!e.length)return;const r=[];if(Y(e[0])){const t=e[0],n=t.indexOf("//");-1!==n&&(r.push(t.slice(0,n+1)),dt(e[0])&&(r[0]+="/"),e[0]=t.slice(n+2))}else"/"===e[0][0]&&r.push("");const o=e.reduce(((t,n)=>n?t.concat(n.split("/")):t),[]);for(let n=0;n<o.length;n++){const t=o[n];".."===t&&r.length>0&&".."!==r[r.length-1]?r.pop():(!t&&n===o.length-1||t&&("."!==t||0===r.length))&&r.push(t)}return r.join("/")}function X(t,n=!1){if(null==t||Z(t)||tt(t))return null;let e=t.indexOf("://");if(-1===e&&at(t))e=2;else{if(-1===e)return null;e+=3}const r=t.indexOf("/",e);return-1!==r&&(t=t.slice(0,r)),n&&(t=wt(t,!0)),t}function Y(t){return at(t)||pt(t)}function Z(t){return null!=t&&"blob:"===t.slice(0,5)}function tt(t){return null!=t&&"data:"===t.slice(0,5)}function nt(t){const n=ot(t);return n&&n.isBase64?i(n.data):null}function et(t){return u(t).replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}const rt=/^data:(.*?)(;base64)?,(.*)$/;function ot(t){const n=t.match(rt);if(!n)return null;const[,e,r,o]=n;return{mediaType:e,isBase64:!!r,data:o}}function st(t){return t.isBase64?`data:${t.mediaType};base64,${t.data}`:`data:${t.mediaType},${t.data}`}function it(t){const n=nt(t);if(!n)return null;const e=ot(t);return new Blob([n],{type:e.mediaType})}function ut(t,n){ct(t,n)}function lt(t,n){ft(t,n)}function ct(t,n){const e=it(t);return!!e&&ft(e,n)}function ft(t,n){if(!t)return!1;const e=document.createElement("a");if(!("download"in e))return!1;const r=URL.createObjectURL(t);return e.download=n,e.href=r,e.style.display="none",document.body.appendChild(e),e.click(),document.body.removeChild(e),URL.revokeObjectURL(r),!0}function at(t){return null!=t&&"/"===t[0]&&"/"===t[1]}function pt(t){return null!=t&&a.test(t)}function ht(t){return null!=t&&h.test(t)||"https"===U.scheme&&at(t)}function mt(t){return null!=t&&p.test(t)||"http"===U.scheme&&at(t)}function dt(t){return null!=t&&m.test(t)}function gt(t){return at(t)?`http:${t}`:t.replace(h,"http:")}function yt(t){return at(t)?`https:${t}`:t.replace(p,"https:")}function $t(){return"http"===U.scheme}function xt(){return"https"===U.scheme}function wt(t,n=!1){return at(t)?t.slice(2):(t=t.replace(a,""),n&&t.length>1&&"/"===t[0]&&"/"===t[1]&&(t=t.slice(2)),t)}function Ot(t){const n=t.indexOf("//"),e=t.indexOf("/",n+2);return-1===e?t:t.slice(0,e)}function Ut(t){let n=0;if(Y(t)){const e=t.indexOf("//");-1!==e&&(n=e+2)}const e=t.lastIndexOf("/");return e<n?t:t.slice(0,e+1)}function Rt(t,n){if(!t)return"";const e=I(t).path.replace(/\/+$/,""),r=e.substring(e.lastIndexOf("/")+1);if(!n?.length)return r;const o=new RegExp(`.(${n.join("|")})$`,"ig");return r.replace(o,"")}function Ct(t){return t&&"/"===t[t.length-1]?t:`${t}/`}function qt(t){return t.replace(/\/+$/,"")}function bt(t){if(/^https?:\/\//i.test(t)){const n=E(t);t=(t=n.path.replaceAll(/\/{2,}/g,"/")).replace("/","//"),n.query&&(t+=`?${n.query}`)}return t}function jt(t){return t.replace(/^(https?:\/\/)(arcgis\.com)/i,"$1www.$2")}function Lt(t){const n=c.httpsDomains;if(!mt(t))return t;const e=t.indexOf("/",7);let r;if(r=-1===e?t:t.slice(0,e),r=r.toLowerCase().slice(7),d.test(r)){if(!r.endsWith(":80"))return t;r=r.slice(0,-3),t=t.replace(":80","")}return $t()&&r===U.authority&&!g.test(t)||(xt()&&r===U.authority||n&&n.some((t=>r===t||r.endsWith(`.${t}`)))||xt()&&!T(t))&&(t=yt(t)),t}function It(t,n,e){if(!(n&&e&&t&&Y(t)))return t;const r=t.indexOf("//"),o=t.indexOf("/",r+2),s=t.indexOf(":",r+2),i=Math.min(o<0?t.length:o,s<0?t.length:s);if(t.slice(r+2,i).toLowerCase()!==n.toLowerCase())return t;return`${t.slice(0,r+2)}${e}${t.slice(i)}`}function At(t){return"string"==typeof t?new x(_(t)):(t.scheme||(t.scheme=U.scheme),t)}function vt(t){return Nt.test(t)}function Pt(t,n){const e=I(t),r=Object.keys(e.query||{});return r.length>0&&n&&n.warn("removeQueryParameters()",`Url query parameters are not supported, the following parameters have been removed: ${r.join(", ")}.`),e.path}function St(t,n,e){const r=I(t),o=r.query||{};return o[n]=String(e),`${r.path}?${v(o)}`}function kt(t,n){const e=I(t),r=e.query||{};for(const[s,i]of Object.entries(n))null!=i&&(r[s]=i);const o=v(r);return o?`${e.path}?${o}`:e.path}function Et(t,n){const{path:e,query:r}=I(t);if(!r)return t;delete r[n];const o=v(r);return o?`${e}?${o}`:e}function Bt(t){if(null==t)return null;const n=t.match(Jt);return n?n[2]:null}function Ht(t){if(null==t)return null;const n=t.match(Jt);return n?{path:n[1],extension:n[2]}:{path:t,extension:null}}async function Tt(t){if("string"==typeof t){return ot(t)??{data:t}}return new Promise(((n,e)=>{const r=new FileReader;r.readAsDataURL(t),r.onload=()=>n(ot(r.result)),r.onerror=t=>e(t)}))}const Jt=/([^.]*)\.([^\/]*)$/,Nt=/(^data:image\/svg|\.svg$)/i;export{x as Url,S as addProxy,H as addProxyRule,St as addQueryParameter,kt as addQueryParameters,et as base64UrlEncode,It as changeDomain,ot as dataComponents,nt as dataToArrayBuffer,it as dataToBlob,lt as downloadBlobAsFile,ut as downloadDataAsFile,b as getAppBaseUrl,q as getAppUrl,Rt as getFilename,D as getInterceptor,X as getOrigin,Bt as getPathExtension,T as getProxyRule,P as getProxyUrl,pt as hasProtocol,N as hasSameCanonicalArcGISOnlinePortal,J as hasSameCanonicalPortal,F as hasSameOrigin,W as hasSamePortal,Y as isAbsolute,xt as isAppHTTPS,Z as isBlobProtocol,tt as isDataProtocol,ht as isHTTPSProtocol,at as isProtocolRelative,vt as isSVG,M as isTrustedServer,V as join,_ as makeAbsolute,st as makeData,G as makeRelative,K as normalize,v as objectToQuery,Tt as parseData,A as queryToObject,Ut as removeFile,Et as removeQueryParameter,Pt as removeQueryParameters,qt as removeTrailingSlash,Ht as splitPathExtension,L as test,gt as toHTTP,yt as toHTTPS,w as trustedServersUrlCache,I as urlToObject};
|
package/interfaces.d.ts
CHANGED
|
@@ -1305,6 +1305,12 @@ declare namespace __esri {
|
|
|
1305
1305
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-Basemap.html#spatialReference)
|
|
1306
1306
|
*/
|
|
1307
1307
|
spatialReference: SpatialReference;
|
|
1308
|
+
/**
|
|
1309
|
+
* to doc
|
|
1310
|
+
*
|
|
1311
|
+
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-Basemap.html#style)
|
|
1312
|
+
*/
|
|
1313
|
+
style: any;
|
|
1308
1314
|
/**
|
|
1309
1315
|
* The URL pointing to an image that represents the basemap.
|
|
1310
1316
|
*
|
|
@@ -1381,6 +1387,12 @@ declare namespace __esri {
|
|
|
1381
1387
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-Basemap.html#spatialReference)
|
|
1382
1388
|
*/
|
|
1383
1389
|
spatialReference?: SpatialReferenceProperties;
|
|
1390
|
+
/**
|
|
1391
|
+
* to doc
|
|
1392
|
+
*
|
|
1393
|
+
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-Basemap.html#style)
|
|
1394
|
+
*/
|
|
1395
|
+
style?: any;
|
|
1384
1396
|
/**
|
|
1385
1397
|
* The URL pointing to an image that represents the basemap.
|
|
1386
1398
|
*
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../request.js";import r from"../../core/Error.js";import{getImageData as o}from"../../core/imageUtils.js";import{isDataProtocol as s,isBlobProtocol as i,isAbsolute as n,dataToBlob as a,join as m}from"../../core/urlUtils.js";import{generateUUID as p}from"../../core/uuid.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{reader as l}from"../../core/accessorSupport/decorators/reader.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import{writer as d}from"../../core/accessorSupport/decorators/writer.js";import f from"./MediaElementBase.js";import{getResourceContentExtension as g}from"../../portal/support/resourceExtension.js";import{f as h,t as y,i as v,M as j}from"../../chunks/persistableUrlUtils.js";let I=class extends f{constructor(e){super(e),this.
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../request.js";import r from"../../core/Error.js";import{getImageData as o}from"../../core/imageUtils.js";import{isDataProtocol as s,isBlobProtocol as i,isAbsolute as n,dataToBlob as a,join as m}from"../../core/urlUtils.js";import{generateUUID as p}from"../../core/uuid.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{reader as l}from"../../core/accessorSupport/decorators/reader.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import{writer as d}from"../../core/accessorSupport/decorators/writer.js";import f from"./MediaElementBase.js";import{getResourceContentExtension as g}from"../../portal/support/resourceExtension.js";import{f as h,t as y,i as v,M as j}from"../../chunks/persistableUrlUtils.js";let I=class extends f{constructor(e){super(e),this.animationOptions=null,this.content=null,this.image=null,this.type="image",this.image=null}load(){const e=this.image;if("string"==typeof e){const t=o(e).then((e=>{this._set("content",e)}));this.addResolvingPromise(t)}else if(e instanceof HTMLImageElement){const t=e.decode().then((()=>{this._set("content",e)}));this.addResolvingPromise(t)}else e?this._set("content",e):this.addResolvingPromise(Promise.reject(new r("image-element:invalid-image-type","Invalid image type",{image:e})));return Promise.resolve(this)}readImage(e,t,r){return h(t.url,r)}writeImage(e,t,r,o){if(null==e)return;const a=o?.portalItem,m=o?.resources;if(!a||!m)return void("string"==typeof e&&(t[r]=y(e,o)));const p="string"!=typeof e||s(e)||i(e)?null:e;if(p){if(null==v(p))return void(t[r]=p);const e=y(p,{...o,verifyItemRelativeUrls:o&&o.verifyItemRelativeUrls?{writtenUrls:o.verifyItemRelativeUrls.writtenUrls,rootPath:void 0}:void 0},j.NO);if(a&&e&&!n(e))return m.toKeep.push({resource:a.resourceFromPath(e),compress:!1}),void(t[r]=e)}t[r]="<pending>",m.pendingOperations.push(U(e).then((e=>{const o=P(e,a);t[r]=o.itemRelativeUrl,m.toAdd.push({resource:o,content:e,compress:!1,finish:e=>{this.image=e.url}})})))}};e([c()],I.prototype,"animationOptions",void 0),e([c({readOnly:!0})],I.prototype,"content",void 0),e([c({json:{name:"url",type:String}})],I.prototype,"image",void 0),e([l("image",["url"])],I.prototype,"readImage",null),e([d("image")],I.prototype,"writeImage",null),e([c({readOnly:!0,json:{name:"mediaType"}})],I.prototype,"type",void 0),I=e([u("esri.layers.support.ImageElement")],I);const w=I;async function U(e){if("string"==typeof e){if(i(e)){const{data:r}=await t(e,{responseType:"blob"});return r}if(s(e))return a(e);return U((await t(e,{responseType:"image"})).data)}return new Promise((t=>E(e).toBlob(t)))}function E(e){if(e instanceof HTMLCanvasElement)return e;const t=e instanceof HTMLImageElement?e.naturalWidth:e.width,r=e instanceof HTMLImageElement?e.naturalHeight:e.height,o=document.createElement("canvas"),s=o.getContext("2d");return o.width=t,o.height=r,e instanceof HTMLImageElement?s.drawImage(e,0,0,e.width,e.height):e instanceof ImageData&&s.putImageData(e,0,0),o}function P(e,t){const r=p(),o=`${m("media",r)}.${g(e)}`;return t.resourceFromPath(o)}export{w as default};
|