@arcgis/core 5.2.0-next.41 → 5.2.0-next.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/20fefb9278501781de14.js +1 -0
  4. package/assets/esri/core/workers/chunks/399e23d777a043efa9f1.js +1 -0
  5. package/assets/esri/core/workers/chunks/{2b8909a488cf3b231eec.js → 4063ea53cba3dd897e53.js} +6 -12
  6. package/assets/esri/core/workers/chunks/5133083222588799493f.js +1 -0
  7. package/assets/esri/core/workers/chunks/{7ea65aa6d3e684e12082.js → 57a1e2b716b74f0124f7.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{2e79fb1b8445b2091cdb.js → 60e8524d324fd14444d7.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{b45a013039bbd2614525.js → 7684f0c771d312e05bb4.js} +7 -7
  10. package/assets/esri/core/workers/chunks/{90ace5f9b4af1beea6bf.js → 7b6b8d0673976c6c26de.js} +1 -1
  11. package/assets/esri/core/workers/chunks/81d55594cee124040565.js +1 -0
  12. package/assets/esri/core/workers/chunks/{82f4aa0533db009b11d8.js → 89682d9d4f606f82056b.js} +2 -2
  13. package/assets/esri/core/workers/chunks/9114a575b78a7ea18d0f.js +1 -0
  14. package/assets/esri/core/workers/chunks/{4056659d5c7698265129.js → 9de18cea5780319302cb.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{f1d3cf674b6bea89e122.js → c0637d1c9337a6ba46b0.js} +1 -1
  16. package/assets/esri/core/workers/chunks/c1845682cc9a5aac8703.js +261 -0
  17. package/assets/esri/core/workers/chunks/ce2320e7b9c4ca96ff27.js +1 -0
  18. package/assets/esri/core/workers/chunks/{dd65c32ae55fcf1282fe.js → d45e30f15142b5861111.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{c50e4e8c6188e64e7d45.js → d7775ed1402946e414ef.js} +1 -1
  20. package/assets/esri/core/workers/chunks/e2f45990d8459d14cb90.js +1 -0
  21. package/assets/esri/core/workers/chunks/{aa0fb77c62a2d4eb20a5.js → e6b5c015205d38abe037.js} +1 -1
  22. package/assets/esri/core/workers/chunks/f4eda59ec1e816ecc827.js +1 -0
  23. package/assets/esri/core/workers/chunks/f8f0de841be17cd05c8f.js +1 -0
  24. package/assets/esri/themes/base/_core.scss +0 -6
  25. package/assets/esri/themes/dark/main.css +1 -1
  26. package/assets/esri/themes/light/main.css +1 -1
  27. package/assets/esri/themes/light/view.css +1 -1
  28. package/chunks/Component.glsl.js +2 -2
  29. package/chunks/CutFillMinMaxDepth.glsl.js +2 -0
  30. package/chunks/CutFillTargetDepth.glsl.js +1 -2
  31. package/chunks/CutFillTotalDepth.glsl.js +2 -0
  32. package/chunks/EdgeShader.glsl.js +9 -9
  33. package/chunks/GaussianSplat.glsl.js +1 -1
  34. package/chunks/Path.glsl.js +4 -4
  35. package/chunks/Terrain.glsl.js +2 -2
  36. package/chunks/cameraUtilsSpherical.js +1 -1
  37. package/config.js +1 -1
  38. package/editing/geometry/coordUtils.js +1 -1
  39. package/geohash/geohashUtils.js +1 -1
  40. package/geometry/support/aaBoundingRect.js +1 -1
  41. package/geometry/support/quantizationUtils.js +1 -1
  42. package/intl/date.js +1 -1
  43. package/kernel.js +1 -1
  44. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  45. package/layers/graphics/featureConversionUtils.js +1 -1
  46. package/layers/graphics/sources/support/sourceUtils.js +1 -1
  47. package/layers/raster/formats/Lerc.js +1 -1
  48. package/layers/support/fieldUtils.js +1 -1
  49. package/package.json +2 -2
  50. package/support/revision.js +1 -1
  51. package/third-party-notices.txt +156 -0
  52. package/views/2d/engine/vectorTiles/GeometryUtils.js +1 -1
  53. package/views/2d/engine/webgl/Painter.js +1 -1
  54. package/views/2d/engine/webgl/RenderingDevice.js +1 -1
  55. package/views/2d/engine/webgl/effects/FeatureEffect.js +1 -1
  56. package/views/2d/engine/webgl/effects/HighlightEffect.js +1 -1
  57. package/views/2d/engine/webgl/effects/highlight/HighlightGradient.js +1 -1
  58. package/views/2d/engine/webgl/mesh/templates/segmentUtils.js +1 -1
  59. package/views/2d/engine/webgl/shaderGraph/techniques/TextureStatisticsTechnique.js +1 -1
  60. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AAnimatedShader.js +1 -1
  61. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedLineShader.js +1 -1
  62. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedTechnique.js +1 -1
  63. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimationUniformInfo.js +1 -1
  64. package/views/2d/engine/webgl/shaderGraph/techniques/blend/BlendTechnique.js +1 -1
  65. package/views/2d/engine/webgl/shaderGraph/techniques/bloom/BloomTechnique.js +1 -1
  66. package/views/2d/engine/webgl/shaderGraph/techniques/blur/BlurTechnique.js +1 -1
  67. package/views/2d/engine/webgl/shaderGraph/techniques/opacity/OpacityTechnique.js +1 -1
  68. package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterHighlightTechnique.js +1 -1
  69. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/BaseRasterProcessorTechnique.js +1 -1
  70. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BitBlitShader.js +2 -0
  71. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/DebugOverlayShader.js +2 -0
  72. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/HighlightShader.js +2 -0
  73. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/WorldExtentStencilShader.js +2 -0
  74. package/views/2d/engine/webgl/shaderGraph/techniques/utility/BitBlitTechnique.js +2 -0
  75. package/views/2d/engine/webgl/shaderGraph/techniques/utility/DebugOverlayTechnique.js +2 -0
  76. package/views/2d/engine/webgl/shaderGraph/techniques/utility/HighlightTechnique.js +2 -0
  77. package/views/2d/engine/webgl/shaderGraph/techniques/utility/WorldExtentClipTechnique.js +2 -0
  78. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  79. package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
  80. package/views/2d/layers/features/sources/strategies/FeatureDrillDownTileLoadStrategy.js +1 -1
  81. package/views/2d/layers/features/sources/strategies/FeatureHybridTileLoadStrategy.js +1 -1
  82. package/views/2d/layers/features/sources/strategies/FeaturePagedTileLoadStrategy.js +1 -1
  83. package/views/2d/layers/support/DebugOverlay.js +1 -1
  84. package/views/3d/analysis/LineOfSight/LineOfSightAggregateManipulatedObject3D.js +1 -1
  85. package/views/3d/analysis/LineOfSight/LineOfSightConfiguration.js +1 -1
  86. package/views/3d/analysis/LineOfSight/LineOfSightDrawToolRenderer.js +1 -1
  87. package/views/3d/analysis/LineOfSight/LineOfSightManipulators.js +1 -1
  88. package/views/3d/analysis/LineOfSight/LineOfSightReshapeTool3D.js +1 -1
  89. package/views/3d/analysis/LineOfSight/LineOfSightTool2.js +1 -1
  90. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  91. package/views/3d/layers/i3s/I3SNode.js +1 -1
  92. package/views/3d/layers/i3s/SphereCone.js +1 -1
  93. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  94. package/views/3d/support/cameraUtilsSpherical.js +1 -1
  95. package/views/3d/terrain/GeometryState.js +1 -1
  96. package/views/3d/terrain/OverlayRenderer.js +1 -1
  97. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  98. package/views/3d/terrain/PatchRenderData.js +1 -1
  99. package/views/3d/terrain/TerrainSurface.js +1 -1
  100. package/views/3d/terrain/Tile.js +1 -1
  101. package/views/3d/terrain/TileAgent.js +1 -1
  102. package/views/3d/webgl/RenderCamera.js +1 -1
  103. package/views/3d/webgl-engine/core/shaderLibrary/Laserline.glsl.js +2 -2
  104. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +1 -1
  105. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputDepth.glsl.js +4 -10
  106. package/views/3d/webgl-engine/core/shaderLibrary/util/emissionFilter.glsl.js +1 -1
  107. package/views/3d/webgl-engine/effects/WeatherFader.js +1 -1
  108. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  109. package/views/3d/webgl-engine/effects/glow/Glow.js +1 -1
  110. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  111. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  112. package/views/3d/webgl-engine/lib/CutFillComputation.js +1 -1
  113. package/views/3d/webgl-engine/lib/GaussianSplatShadows.js +1 -1
  114. package/views/3d/webgl-engine/lib/IntersectorInterfaces.js +1 -1
  115. package/views/3d/webgl-engine/lib/PolygonIntersections2D.js +2 -0
  116. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  117. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  118. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  119. package/views/3d/webgl-engine/{shaders/sources/edgeRenderer → lib/edgeRendering}/AdjustProjectedPosition.glsl.js +1 -1
  120. package/views/3d/webgl-engine/{shaders/sources/edgeRenderer → lib/edgeRendering}/DiscardNonSilhouetteEdges.glsl.js +1 -1
  121. package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
  122. package/views/3d/webgl-engine/lib/edgeRendering/EdgeShader.glsl.js +1 -1
  123. package/views/3d/webgl-engine/{shaders/sources/edgeRenderer → lib/edgeRendering}/EdgeUtil.glsl.js +1 -1
  124. package/views/3d/webgl-engine/{shaders/sources/edgeRenderer → lib/edgeRendering}/LineAmplitude.glsl.js +1 -1
  125. package/views/3d/webgl-engine/{shaders/sources/edgeRenderer → lib/edgeRendering}/LineOffset.glsl.js +1 -1
  126. package/views/3d/webgl-engine/{shaders/sources/edgeRenderer → lib/edgeRendering}/UnpackAttributes.glsl.js +1 -1
  127. package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
  128. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  129. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  130. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  131. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  132. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  133. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  134. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  135. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  136. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  137. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  138. package/views/3d/webgl-engine/materials/TriangleMaterial.js +1 -1
  139. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  140. package/views/3d/webgl-engine/shaders/CutFillMinMaxDepth.glsl.js +2 -0
  141. package/views/3d/webgl-engine/shaders/CutFillMinMaxDepthTechnique.js +2 -0
  142. package/views/3d/webgl-engine/shaders/CutFillTargetDepth.glsl.js +1 -1
  143. package/views/3d/webgl-engine/shaders/{CutFillDepth.glsl.js → CutFillTotalDepth.glsl.js} +1 -1
  144. package/views/3d/webgl-engine/shaders/CutFillTotalDepthTechnique.js +2 -0
  145. package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +1 -1
  146. package/views/GroundView.js +1 -1
  147. package/views/input/BrowserEventSource.js +1 -1
  148. package/views/input/InputManager.js +1 -1
  149. package/views/interactive/snapping/snappingUtils.js +1 -1
  150. package/views/support/LayerViewManager.js +1 -1
  151. package/views/support/euclideanLengthMeasurementUtils.js +1 -1
  152. package/views/webgl/VertexAttributeLayouts.js +1 -1
  153. package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
  154. package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
  155. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  156. package/widgets/BatchAttributeForm/inputs/support/multipleChoiceInputUtils.js +1 -1
  157. package/widgets/BatchAttributeForm.js +1 -1
  158. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  159. package/widgets/FeatureTable/Grid/EditorColumn.js +1 -1
  160. package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
  161. package/widgets/Legend/support/relationshipRampUtils.js +1 -1
  162. package/widgets/OrientedImageryViewer/utils.js +1 -1
  163. package/widgets/support/dateUtils.js +1 -1
  164. package/assets/esri/core/workers/chunks/002356e675769d20e5c0.js +0 -1
  165. package/assets/esri/core/workers/chunks/06e71d52773eb656a4bf.js +0 -261
  166. package/assets/esri/core/workers/chunks/18d874739ee9ffad7480.js +0 -1
  167. package/assets/esri/core/workers/chunks/352d144d7651da8a29c9.js +0 -1
  168. package/assets/esri/core/workers/chunks/4f2a61dfae6ca8ed1ec8.js +0 -1
  169. package/assets/esri/core/workers/chunks/551d0c5432f7a08dea77.js +0 -1
  170. package/assets/esri/core/workers/chunks/5923ebadd4f75be2c9cc.js +0 -1
  171. package/assets/esri/core/workers/chunks/c3fae4f4522604a9c17e.js +0 -1
  172. package/assets/esri/core/workers/chunks/ea8f224da4c5c95a3547.js +0 -1
  173. package/assets/esri/core/workers/chunks/f30578843f4faefd53b4.js +0 -1
  174. package/assets/esri/themes/base/_colorVariables.scss +0 -1
  175. package/assets/esri/themes/base/widgets/_DatePicker.scss +0 -170
  176. package/assets/esri/themes/base/widgets/_FeatureUtilityNetworkAssociationList.scss +0 -13
  177. package/assets/esri/themes/base/widgets/_TimePicker.scss +0 -15
  178. package/chunks/CutFillDepth.glsl.js +0 -2
  179. package/core/PLRUCache.js +0 -2
  180. package/views/2d/engine/webgl/BitBlitRenderer.js +0 -2
  181. package/views/2d/engine/webgl/WorldExtentClipRenderer.js +0 -2
  182. package/views/2d/engine/webgl/effects/highlight/HighlightRenderer.js +0 -2
  183. package/views/2d/engine/webgl/shaders/BitBlitPrograms.js +0 -2
  184. package/views/2d/engine/webgl/shaders/HighlightPrograms.js +0 -2
  185. package/views/2d/engine/webgl/shaders/StencilPrograms.js +0 -2
  186. package/views/3d/webgl-engine/shaders/CutFillDepthTechnique.js +0 -2
  187. package/views/3d/webgl-engine/shaders/CutFillDepthTechniqueConfiguration.js +0 -2
  188. package/views/support/euclideanAreaMeasurementUtils.js +0 -2
  189. package/widgets/ShadowCast/ShadowVisualizationType.js +0 -2
  190. /package/assets/esri/core/workers/chunks/{82f4aa0533db009b11d8.js.LICENSE.txt → 89682d9d4f606f82056b.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import t from"../../core/Error.js";import e from"../../core/Logger.js";import{assertIsSome as n}from"../../core/maybe.js";import{is as r,fromRectValues as o}from"../../geometry/support/aaBoundingBox.js";import{fromValues as s}from"../../geometry/support/aaBoundingRect.js";import{isPoint as u,isPolygon as i,isPolyline as c,isMultipoint as l,isGeometryWithZ as a,isGeometryWithM as f}from"../../geometry/support/jsonTypeUtils.js";import{OptimizedFeature as h}from"./OptimizedFeature.js";import m from"./OptimizedFeatureSet.js";import d from"./OptimizedGeometry.js";import{createFeatureId as g}from"./data/createFeatureId.js";const y=()=>e.getLogger("esri.layers.graphics.featureConversionUtils"),p={esriGeometryPoint:0,esriGeometryPolyline:2,esriGeometryPolygon:3,esriGeometryMultipoint:0,esriGeometryMultiPatch:3,esriGeometryEnvelope:0};function I({scale:t,translate:e},n){return Math.round((n-e[0])/t[0])}function M({scale:t,translate:e},n){return Math.round((e[1]-n)/t[1])}function b({scale:t,translate:e},n){return Math.round((n-e[0])/t[0])}function w({scale:t,translate:e},n){return Math.round((n-e[1])/t[1])}function G(t,e){return T(t,e,0)}function N(t,e){return T(t,-e,1)}function T({scale:t,translate:e},n,r){return n*t[r]+e[r]}function P(t,e,n){return e&&(t.hasZ=!0),n&&(t.hasM=!0),t}function x(t,e,n,r){if(e&&r&&t!==n)return(e,n,r,o)=>{r[o++]=e[n++],r[o++]=e[n++],t?n++:r[o++]=0,r[o++]=e[n++]??0};const o=2+(n?1:0)+(r?1:0),s=o-((!t&&n?1:0)+(!e&&r?1:0));return(t,e,n,r)=>{for(let u=0;u<o;++u)n[r++]=u<s?t[e++]??0:0}}function v(t,e,n){if(!t)return null;const{coords:r,hasZ:o,hasM:s}=t,[u,i]=r,c=o?r[2]:0,l=s?r[2+(o?1:0)]:0;return{x:u,y:i,z:e?c:void 0,m:n?l:void 0}}function Z(t,e,n,r){for(const{geometry:o,attributes:s}of e)t.push({attributes:s,geometry:v(o,n,r)});return t}function F(t,e,n,r,o){for(const s of e){const{geometry:e,attributes:u,centroid:i}=s,c=a(e),l=f(e);t.push(new h(e?E(e,n&&c,r&&l):null,u,i?E(i,!1,!1):null,g(s,o),s.displayId,s.distance,s.vertexCount))}return t}function E(t,e=a(t),n=f(t)){const{x:r,y:o,z:s,m:u}=t,i=[r,o];return e&&i.push(s??0),n&&i.push(u??0),new d([],i,e,n)}function j(t,e,n,r){for(const{geometry:o,attributes:s}of e)t.push({geometry:o&&k(o,n,r),attributes:s});return t}function k(t,e,n){if(null==t)return null;const{coords:r,stride:o,hasZ:s,hasM:u}=t,i=x(s,u,e,n),c=[];for(let l=0;l<r.length;l+=o){const t=[];i(r,l,t,0),c.push(t)}return P({points:c},e,n)}function V(t,e,n,r,o){for(const s of e){const{geometry:e,attributes:u}=s,i=a(e),c=f(e);t.push(new h(e?Y(e,n&&i,r&&c):null,u,null,g(s,o),s.displayId,s.distance,s.vertexCount))}return t}function Y(t,e=a(t),n=f(t)){const{points:r,hasZ:o,hasM:s}=t,u=new d([r.length],[],e,n),{coords:i,stride:c}=u;let l=0;const h=x(o??!1,s??!1,e,n);for(const a of r)h(a,0,i,l),l+=c;return u}function _(t,e,n,r){for(const{geometry:o,attributes:s}of e)t.push({geometry:o&&C(o,n,r),attributes:s});return t}function C(t,e,n){if(!t)return null;const{coords:r,lengths:o,stride:s,hasZ:u,hasM:i}=t;let c=0;const l=x(u,i,e,n),a=[];for(const f of o){const t=[];for(let e=0;e<f;e++){const e=[];l(r,c,e,0),c+=s,t.push(e)}a.push(t)}return P({paths:a},e,n)}function L(t,e,n,r,o){for(const s of e){const{geometry:e,attributes:u,centroid:i}=s,c=a(e),l=f(e);t.push(new h(e?O(e,n&&c,r&&l):null,u,i?E(i,!1,!1):null,g(s,o),s.displayId,s.distance,s.vertexCount))}return t}function O(t,e=a(t),n=f(t)){const{paths:r,hasZ:o,hasM:s}=t,u=x(o??!1,s??!1,e,n),i=new d([],[],e,n),{lengths:c,coords:l,stride:h}=i;let m=0;for(const a of r){for(const t of a)u(t,0,l,m),m+=h;c.push(a.length)}return i}function S(t,e,n,r){for(const{geometry:o,attributes:s,centroid:u}of e){const e=U(o,n,r),i=v(u,!1,!1);t.push(u?{geometry:e,attributes:s,centroid:i}:{geometry:e,attributes:s})}return t}function U(t,e,n){if(!t)return null;const{coords:r,lengths:o,stride:s,hasZ:u,hasM:i}=t;let c=0;const l=x(u,i,e,n),a=[];for(const f of o){const t=[];for(let e=0;e<f;e++){const e=[];l(r,c,e,0),c+=s,t.push(e)}a.push(t)}return P({rings:a},e,n)}function z(t,e,n,r,o){for(const s of e){const{geometry:e,attributes:u,centroid:i}=s,c=a(e),l=f(e);t.push(new h(e?R(e,n&&c,r&&l):null,u,i?E(i,!1,!1):null,g(s,o),s.displayId,s.distance,s.vertexCount))}return t}function R(t,e=a(t),n=f(t)){const{rings:r,hasZ:o,hasM:s}=t,u=new d([],[],e,n),{lengths:i,coords:c,stride:l}=u;let h=0;const m=x(o??!1,s??!1,e,n);for(const a of r){for(const t of a)m(t,0,c,h),h+=l;i.push(a.length)}return u}const A=[],$=[];function q(t,e,n,r,o){A[0]=t;const[s]=B($,A,e,n,r,o);return ht(A),ht($),s}function B(e,n,r,o,s,u){if(ht(e),!r){for(const t of n){const n=g(t,u);e.push(new h(null,t.attributes,null,n,void 0,t.distance,t.vertexCount))}return e}switch(r){case"esriGeometryPoint":return F(e,n,o,s,u);case"esriGeometryMultipoint":return V(e,n,o,s,u);case"esriGeometryPolyline":return L(e,n,o,s,u);case"esriGeometryPolygon":case"esriGeometryMultiPatch":return z(e,n,o,s,u);default:y().error("convertToFeatureSet:unknown-geometry",new t("internal:geometry",`Unable to parse unknown geometry type '${r}'`)),ht(e)}return e}function D(t,e,n,r){$[0]=t,Q(A,$,e,n,r);const o=A[0];return ht(A),ht($),o}function H(e,n=a(e),r=f(e)){return null==e?null:u(e)?E(e,n,r):i(e)?R(e,n,r):c(e)?O(e,n,r):l(e)?Y(e,n,r):void y().error("convertFromGeometry:unknown-geometry",new t("internal:geometry",`Unable to parse unknown geometry type '${e}'`))}function J(e,n,r,o){if(null==e)return null;const s="coords"in e?e:e.geometry;if(null==s)return null;switch(n){case"esriGeometryPoint":return v(s,r,o);case"esriGeometryMultipoint":return k(s,r,o);case"esriGeometryPolyline":return C(s,r,o);case"esriGeometryPolygon":return U(s,r,o);default:return y().error("convertToGeometry:unknown-geometry",new t("internal:geometry",`Unable to parse unknown geometry type '${n}'`)),null}}function K(t,e){for(const n of e)t.push({attributes:n.attributes});return t}function Q(e,n,r,o,s){if(ht(e),null==r)return K(e,n);switch(r){case"esriGeometryPoint":return Z(e,n,o,s);case"esriGeometryMultipoint":return j(e,n,o,s);case"esriGeometryPolyline":return _(e,n,o,s);case"esriGeometryPolygon":return S(e,n,o,s);default:y().error("convertToFeatureSet:unknown-geometry",new t("internal:geometry",`Unable to parse unknown geometry type '${r}'`))}return e}function W(t){const{spatialReference:e,transform:n,fields:r,hasM:o,hasZ:s,features:u,geometryType:i,exceededTransferLimit:c,queryGeometry:l,queryGeometryType:a}=t,f={features:Q([],u,i,s,o),fields:r,geometryType:i,spatialReference:e,queryGeometry:J(l,a,s,o)};return n&&(f.transform=n),c&&(f.exceededTransferLimit=c),o&&(f.hasM=o),s&&(f.hasZ=s),f}function X(t,e){const n=new m,{hasM:r,hasZ:o,features:s,spatialReference:u,geometryType:i,exceededTransferLimit:c,transform:l,fields:a,globalIdFieldName:f}=t;return a&&(n.fields=a),n.geometryType=i??null,n.spatialReference=u??null,s&&B(n.features,s,i,o,r,e),c&&(n.exceededTransferLimit=c),r&&(n.hasM=r),o&&(n.hasZ=o),l&&(n.transform=l),f&&(n.globalIdFieldName=f),n}function tt(t){const{transform:e,features:n}=t;if(!e)return t;for(const r of n)null!=r.geometry&&ct(r.geometry,e),null!=r.centroid&&ct(r.centroid,e);return t.transform=null,t}function et(t,e){const{geometryType:n,features:r}=e;if(!t)return e;for(let o=0;o<r.length;o++){const e=r[o],s=e.weakClone();s.geometry=nt(e.geometry,n,t),s.centroid=nt(e.centroid,"esriGeometryPoint",t),r[o]=s}return e.transform=t,e}function nt(t,e,n,r,o,s=!1){if(null==t)return null;if(!t?.coords.length)return null;const u=p[e],{coords:i,lengths:c,stride:l,hasZ:a,hasM:f}=t;r??=a,o??=f;const h=new d([],[],r,o),m=h.stride,g=x(a,f,r,o);let y=0;const G=[0,0,0,0].slice(m),N=s?b:I,T=s?w:M;function P(){g(i,y,G,0),y+=l,G[0]=N(n,G[0]),G[1]=T(n,G[1])}if(t.isPoint)return P(),h.coords.push(...G),h;let v=0;for(const d of c){if(d<u)continue;let t=1;P(),h.coords.push(...G);let[e,n]=G;for(let r=1;r<d;r++){P();const[r,o]=G;e===r&&n===o||(s||(G[0]-=e,G[1]-=n),h.coords.push(...G),e=r,n=o,t++)}t>=u?(h.lengths.push(t),v=h.coords.length):ht(h.coords,v)}return ht(h.coords,v),h.coords.length?h:null}function rt(t,e,n,r=t.hasZ,o=t.hasM){if(!t.coords.length)return null;const s=p[e],{coords:u,lengths:i,stride:c,hasZ:l,hasM:a}=t,f=new d([],[],r,o),h=f.stride,m=x(l,a,r,o);if(t.isPoint)return m(u,0,f.coords,0),f;let g=0;const y=n*n;for(const d of i){if(d<s){g+=d*c;continue}const t=f.coords.length/h,e=g,n=g+(d-1)*c;m(u,e,f.coords,f.coords.length),st(f.coords,u,c,y,m,e,n),m(u,n,f.coords,f.coords.length);const r=f.coords.length/h-t;r>=s?f.lengths.push(r):ht(f.coords,t*h),g+=d*c}return f.coords.length?f:null}function ot(t,e,n,r){const o=t[e],s=t[e+1],u=t[n],i=t[n+1],c=t[r],l=t[r+1];let a=u,f=i,h=c-a,m=l-f;if(0!==h||0!==m){const t=((o-a)*h+(s-f)*m)/(h*h+m*m);t>1?(a=c,f=l):t>0&&(a+=h*t,f+=m*t)}return h=o-a,m=s-f,h*h+m*m}function st(t,e,n,r,o,s,u){let i,c=r,l=0;for(let a=s+n;a<u;a+=n)i=ot(e,a,s,u),i>c&&(l=a,c=i);c>r&&(l-s>n&&st(t,e,n,r,o,s,l),o(e,l,t,t.length),u-l>n&&st(t,e,n,r,o,l,u))}function ut(t,e){if(!e?.coords?.length)return null;let n=Number.POSITIVE_INFINITY,u=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY;const{coords:l,stride:a}=e;for(let r=0;r<l.length;r+=a){const t=l[r],e=l[r+1];n=Math.min(n,t),i=Math.max(i,t),u=Math.min(u,e),c=Math.max(c,e)}return r(t)?o(t,n,u,i,c):s(n,u,i,c,t),t}function it(t,e){const{lengths:n,coords:r,stride:o}=e;let s=Number.POSITIVE_INFINITY,u=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY,l=0;for(const a of n){let t=r[l],e=r[l+1];s=Math.min(t,s),u=Math.min(e,u),i=Math.max(t,i),c=Math.max(e,c),l+=o;for(let n=1;n<a;n++,l+=o){const n=r[l],o=r[l+1];t+=n,e+=o,n<0&&(s=Math.min(s,t)),n>0&&(i=Math.max(i,t)),o<0?u=Math.min(u,e):o>0&&(c=Math.max(c,e))}}return t[0]=s,t[1]=u,t[2]=i,t[3]=c,t}function ct(t,e){const{coords:r,lengths:o,stride:s,hasZ:u,hasM:i}=t;if(!r.length)return void(o.length=0);n(e);const{originPosition:c,scale:l,translate:a}=e,f=mt;f.originPosition=c;const h=f.scale;h[0]=l[0]??1,h[1]=-(l[1]??1),h[2]=l[2]??1,h[3]=l[3]??1;const m=f.translate;if(m[0]=a[0]??0,m[1]=a[1]??0,m[2]=a[2]??0,m[3]=a[3]??0,i&&!u&&(h[2]=h[3],m[2]=m[3]),!o.length){for(let t=0;t<s;++t)r[t]=T(f,r[t],t);return void(o.length=0)}let d=0;for(let n=0;n<o.length;n++){const t=o[n];o[n]=t;for(let n=0;n<s;++n)r[d+n]=T(f,r[d+n],n);let e=r[d],u=r[d+1];d+=s;for(let n=1;n<t;n++,d+=s){e+=r[d]*h[0],u+=r[d+1]*h[1],r[d]=e,r[d+1]=u;for(let t=2;t<s;++t)r[d+t]=T(f,r[d+t],t)}}}function lt(t,e){if(!t?.coords?.length)return null;const n=p[e],{coords:r,lengths:o,stride:s,hasZ:u,hasM:i}=t,c=x(u,i,u,i),l=new d([],[],u,i);let a=0,f=0,h=0,m=0;for(const d of o){f=m,c(r,a,l.coords,f),a+=s,f+=s;let t=r[a],e=r[a+1];for(let n=1;n<d;n++){const o=r[a+s],u=r[a+s+1];t*u-e*o===0&&n!==d-1||(c(r,a,l.coords,f),l.coords[f]=t,l.coords[f+1]=e,f+=s,t=e=0),t+=o,e+=u,a+=s}const o=(f-m)/s;o>=n&&(l.lengths[h]=o,m=f,h++)}return l.coords.length>m&&(l.coords.length=m),l.lengths.length>h&&(l.lengths.length=h),l.coords.length&&l.lengths.length?l:null}function at(t,e,n,r){let o=0,s=t[r*e],u=t[r*(e+1)];for(let i=1;i<n;i++){const n=s+t[r*(e+i)],c=u+t[r*(e+i)+1],l=(n-s)*(c+u);s=n,u=c,o+=l}return.5*o}function ft(t,e){const{coords:n,lengths:r}=t;let o=0,s=0;for(let u=0;u<r.length;u++){const t=r[u];s+=at(n,o,t,e),o+=t}return Math.abs(s)}function ht(t,e=0){t.length!==e&&(t.length=e)}const mt={originPosition:"lowerLeft",scale:[1,1,1,1],translate:[0,0,0,0]};export{q as convertFromFeature,X as convertFromFeatureSet,B as convertFromFeatures,H as convertFromGeometry,Y as convertFromMultipoint,V as convertFromMultipointFeatures,E as convertFromPoint,F as convertFromPointFeatures,R as convertFromPolygon,O as convertFromPolyline,L as convertFromPolylineFeatures,D as convertToFeature,W as convertToFeatureSet,Q as convertToFeatures,J as convertToGeometry,k as convertToMultipoint,j as convertToMultipointFeatures,v as convertToPoint,U as convertToPolygon,C as convertToPolyline,rt as generalizeOptimizedGeometry,ut as getBoundsOptimizedGeometry,ft as getQuantizedArea,it as getQuantizedBoundsOptimizedGeometry,at as getSignedQuantizedRingArea,et as quantizeOptimizedFeatureSet,nt as quantizeOptimizedGeometry,I as quantizeX,M as quantizeY,lt as removeCollinearVertices,tt as unquantizeOptimizedFeatureSetInPlace,ct as unquantizeOptimizedGeometryInPlace,T as unquantizeValue,G as unquantizeX,N as unquantizeY};
2
+ import t from"../../core/Error.js";import e from"../../core/Logger.js";import{assertIsSome as r}from"../../core/maybe.js";import{is as n,fromRectValues as o}from"../../geometry/support/aaBoundingBox.js";import{fromValues as s}from"../../geometry/support/aaBoundingRect.js";import{isPoint as u,isPolygon as i,isPolyline as c,isMultipoint as l,isGeometryWithZ as a,isGeometryWithM as f}from"../../geometry/support/jsonTypeUtils.js";import{OptimizedFeature as h}from"./OptimizedFeature.js";import d from"./OptimizedFeatureSet.js";import m from"./OptimizedGeometry.js";import{createFeatureId as g}from"./data/createFeatureId.js";const y=()=>e.getLogger("esri.layers.graphics.featureConversionUtils"),p={esriGeometryPoint:0,esriGeometryPolyline:2,esriGeometryPolygon:3,esriGeometryMultipoint:0,esriGeometryMultiPatch:3,esriGeometryEnvelope:0};function M({scale:t,translate:e},r){return Math.round((r-e[0])/t[0])}function w({scale:t,translate:e},r){return Math.round((e[1]-r)/t[1])}function b({scale:t,translate:e},r){return Math.round((r-e[0])/t[0])}function G({scale:t,translate:e},r){return Math.round((r-e[1])/t[1])}function I(t,e){return T(t,e,0)}function P(t,e){return T(t,-e,1)}function T({scale:t,translate:e},r,n){return r*t[n]+e[n]}function v(t,e,r){return e&&(t.hasZ=!0),r&&(t.hasM=!0),t}function Z(t,e,r,n){if(e&&n&&t!==r)return(e,r,n,o)=>{n[o++]=e[r++],n[o++]=e[r++],t?r++:n[o++]=0,n[o++]=e[r++]??0};const o=2+(r?1:0)+(n?1:0),s=o-((!t&&r?1:0)+(!e&&n?1:0));return(t,e,r,n)=>{for(let u=0;u<o;++u)r[n++]=u<s?t[e++]??0:0}}function N(t,e,r){if(!t)return null;const{coords:n,hasZ:o,hasM:s}=t,[u,i]=n,c=o?n[2]:0,l=s?n[2+(o?1:0)]:0;return{x:u,y:i,z:e?c:void 0,m:r?l:void 0}}function x(t,e,r,n){for(const{geometry:o,attributes:s}of e)t.push({attributes:s,geometry:N(o,r,n)});return t}function F(t,e,r,n,o){for(const s of e){const{geometry:e,attributes:u,centroid:i}=s,c=a(e),l=f(e);t.push(new h(e?j(e,r&&c,n&&l):null,u,i?j(i,!1,!1):null,g(s,o),s.displayId,s.distance,s.vertexCount))}return t}function j(t,e=a(t),r=f(t)){const{x:n,y:o,z:s,m:u}=t,i=[n,o];return e&&i.push(s??0),r&&i.push(u??0),new m([],i,e,r)}function k(t,e,r,n){for(const{geometry:o,attributes:s}of e)t.push({geometry:o&&E(o,r,n),attributes:s});return t}function E(t,e,r){if(null==t)return null;const{coords:n,stride:o,hasZ:s,hasM:u}=t,i=Z(s,u,e,r),c=[];for(let l=0;l<n.length;l+=o){const t=[];i(n,l,t,0),c.push(t)}return v({points:c},e,r)}function C(t,e,r,n,o){for(const s of e){const{geometry:e,attributes:u}=s,i=a(e),c=f(e);t.push(new h(e?L(e,r&&i,n&&c):null,u,null,g(s,o),s.displayId,s.distance,s.vertexCount))}return t}function L(t,e=a(t),r=f(t)){const{points:n,hasZ:o,hasM:s}=t,u=new m([n.length],[],e,r),{coords:i,stride:c}=u;let l=0;const h=Z(o??!1,s??!1,e,r);for(const a of n)h(a,0,i,l),l+=c;return u}function U(t,e,r,n){for(const{geometry:o,attributes:s}of e)t.push({geometry:o&&z(o,r,n),attributes:s});return t}function z(t,e,r){if(!t)return null;const{coords:n,lengths:o,stride:s,hasZ:u,hasM:i}=t;let c=0;const l=Z(u,i,e,r),a=[];for(const f of o){const t=[];for(let e=0;e<f;e++){const e=[];l(n,c,e,0),c+=s,t.push(e)}a.push(t)}return v({paths:a},e,r)}function O(t,e,r,n,o){for(const s of e){const{geometry:e,attributes:u,centroid:i}=s,c=a(e),l=f(e);t.push(new h(e?R(e,r&&c,n&&l):null,u,i?j(i,!1,!1):null,g(s,o),s.displayId,s.distance,s.vertexCount))}return t}function R(t,e=a(t),r=f(t)){const{paths:n,hasZ:o,hasM:s}=t,u=Z(o??!1,s??!1,e,r),i=new m([],[],e,r),{lengths:c,coords:l,stride:h}=i;let d=0;for(const a of n){for(const t of a)u(t,0,l,d),d+=h;c.push(a.length)}return i}function S(t,e,r,n){for(const{geometry:o,attributes:s,centroid:u}of e){const e=V(o,r,n),i=N(u,!1,!1);t.push(u?{geometry:e,attributes:s,centroid:i}:{geometry:e,attributes:s})}return t}function V(t,e,r){if(!t)return null;const{coords:n,lengths:o,stride:s,hasZ:u,hasM:i}=t;let c=0;const l=Z(u,i,e,r),a=[];for(const f of o){const t=[];for(let e=0;e<f;e++){const e=[];l(n,c,e,0),c+=s,t.push(e)}a.push(t)}return v({rings:a},e,r)}function Y(t,e,r,n,o){for(const s of e){const{geometry:e,attributes:u,centroid:i}=s,c=a(e),l=f(e);t.push(new h(e?$(e,r&&c,n&&l):null,u,i?j(i,!1,!1):null,g(s,o),s.displayId,s.distance,s.vertexCount))}return t}function $(t,e=a(t),r=f(t)){const{rings:n,hasZ:o,hasM:s}=t,u=new m([],[],e,r),{lengths:i,coords:c,stride:l}=u;let h=0;const d=Z(o??!1,s??!1,e,r);for(const a of n){for(const t of a)d(t,0,c,h),h+=l;i.push(a.length)}return u}const _=[],q=[];function B(t,e,r,n,o){_[0]=t;const[s]=A(q,_,e,r,n,o);return ft(_),ft(q),s}function A(e,r,n,o,s,u){if(ft(e),!n){for(const t of r){const r=g(t,u);e.push(new h(null,t.attributes,null,r,void 0,t.distance,t.vertexCount))}return e}switch(n){case"esriGeometryPoint":return F(e,r,o,s,u);case"esriGeometryMultipoint":return C(e,r,o,s,u);case"esriGeometryPolyline":return O(e,r,o,s,u);case"esriGeometryPolygon":case"esriGeometryMultiPatch":return Y(e,r,o,s,u);default:y().error("convertToFeatureSet:unknown-geometry",new t("internal:geometry",`Unable to parse unknown geometry type '${n}'`)),ft(e)}return e}function D(t,e,r,n){q[0]=t,Q(_,q,e,r,n);const o=_[0];return ft(_),ft(q),o}function H(e,r=a(e),n=f(e)){return null==e?null:u(e)?j(e,r,n):i(e)?$(e,r,n):c(e)?R(e,r,n):l(e)?L(e,r,n):void y().error("convertFromGeometry:unknown-geometry",new t("internal:geometry",`Unable to parse unknown geometry type '${e}'`))}function J(e,r,n,o){if(null==e)return null;const s="coords"in e?e:e.geometry;if(null==s)return null;switch(r){case"esriGeometryPoint":return N(s,n,o);case"esriGeometryMultipoint":return E(s,n,o);case"esriGeometryPolyline":return z(s,n,o);case"esriGeometryPolygon":return V(s,n,o);default:return y().error("convertToGeometry:unknown-geometry",new t("internal:geometry",`Unable to parse unknown geometry type '${r}'`)),null}}function K(t,e){for(const r of e)t.push({attributes:r.attributes});return t}function Q(e,r,n,o,s){if(ft(e),null==n)return K(e,r);switch(n){case"esriGeometryPoint":return x(e,r,o,s);case"esriGeometryMultipoint":return k(e,r,o,s);case"esriGeometryPolyline":return U(e,r,o,s);case"esriGeometryPolygon":return S(e,r,o,s);default:y().error("convertToFeatureSet:unknown-geometry",new t("internal:geometry",`Unable to parse unknown geometry type '${n}'`))}return e}function W(t){const{spatialReference:e,transform:r,fields:n,hasM:o,hasZ:s,features:u,geometryType:i,exceededTransferLimit:c,queryGeometry:l,queryGeometryType:a}=t,f={features:Q([],u,i,s,o),fields:n,geometryType:i,spatialReference:e,queryGeometry:J(l,a,s,o)};return r&&(f.transform=r),c&&(f.exceededTransferLimit=c),o&&(f.hasM=o),s&&(f.hasZ=s),f}function X(t,e){const r=new d,{hasM:n,hasZ:o,features:s,spatialReference:u,geometryType:i,exceededTransferLimit:c,transform:l,fields:a,globalIdFieldName:f}=t;return a&&(r.fields=a),r.geometryType=i??null,r.spatialReference=u??null,s&&A(r.features,s,i,o,n,e),c&&(r.exceededTransferLimit=c),n&&(r.hasM=n),o&&(r.hasZ=o),l&&(r.transform=l),f&&(r.globalIdFieldName=f),r}function tt(t){const{transform:e,features:r}=t;if(!e)return t;for(const n of r)null!=n.geometry&&it(n.geometry,e),null!=n.centroid&&it(n.centroid,e);return t.transform=null,t}function et(t,e){const{geometryType:r,features:n}=e;if(!t)return e;for(let o=0;o<n.length;o++){const e=n[o],s=e.weakClone();s.geometry=rt(e.geometry,r,t),s.centroid=rt(e.centroid,"esriGeometryPoint",t),n[o]=s}return e.transform=t,e}function rt(t,e,r,n,o,s=!1){if(null==t)return null;if(!t?.coords.length)return null;const u=p[e],{coords:i,lengths:c,stride:l,hasZ:a,hasM:f}=t;n??=a,o??=f;const h=new m([],[],n,o),d=h.stride,g=Z(a,f,n,o);let y=0;const I=[0,0,0,0].slice(d),P=s?b:M,T=s?G:w;function v(){g(i,y,I,0),y+=l,I[0]=P(r,I[0]),I[1]=T(r,I[1])}if(t.isPoint)return v(),h.coords.push(...I),h;let N=0;for(const m of c){if(m<u)continue;let t=1;v(),h.coords.push(...I);let[e,r]=I;for(let n=1;n<m;n++){v();const[n,o]=I;e===n&&r===o||(s||(I[0]-=e,I[1]-=r),h.coords.push(...I),e=n,r=o,t++)}t>=u?(h.lengths.push(t),N=h.coords.length):ft(h.coords,N)}return ft(h.coords,N),h.coords.length?h:null}function nt(t,e,r,n=t.hasZ,o=t.hasM){if(!t.coords.length)return null;const s=p[e],{coords:u,lengths:i,stride:c,hasZ:l,hasM:a}=t,f=new m([],[],n,o),h=f.stride,d=Z(l,a,n,o);if(t.isPoint)return d(u,0,f.coords,0),f;let g=0;const y=r*r;for(const m of i){if(m<s){g+=m*c;continue}const t=f.coords.length/h,e=g,r=g+(m-1)*c;d(u,e,f.coords,f.coords.length),st(f.coords,u,c,y,d,e,r),d(u,r,f.coords,f.coords.length);const n=f.coords.length/h-t;n>=s?f.lengths.push(n):ft(f.coords,t*h),g+=m*c}return f.coords.length?f:null}function ot(t,e,r,n){const o=t[e],s=t[e+1],u=t[r],i=t[r+1],c=t[n],l=t[n+1];let a=u,f=i,h=c-a,d=l-f;if(0!==h||0!==d){const t=((o-a)*h+(s-f)*d)/(h*h+d*d);t>1?(a=c,f=l):t>0&&(a+=h*t,f+=d*t)}return h=o-a,d=s-f,h*h+d*d}function st(t,e,r,n,o,s,u){let i,c=n,l=0;for(let a=s+r;a<u;a+=r)i=ot(e,a,s,u),i>c&&(l=a,c=i);c>n&&(l-s>r&&st(t,e,r,n,o,s,l),o(e,l,t,t.length),u-l>r&&st(t,e,r,n,o,l,u))}function ut(t,e){if(!e?.coords?.length)return null;let r=Number.POSITIVE_INFINITY,u=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY;const{coords:l,stride:a}=e;for(let n=0;n<l.length;n+=a){const t=l[n],e=l[n+1];r=Math.min(r,t),i=Math.max(i,t),u=Math.min(u,e),c=Math.max(c,e)}return n(t)?o(t,r,u,i,c):s(r,u,i,c,t),t}function it(t,e){const{coords:n,lengths:o,stride:s,hasZ:u,hasM:i}=t;if(!n.length)return void(o.length=0);r(e);const{originPosition:c,scale:l,translate:a}=e,f=ht;f.originPosition=c;const h=f.scale;h[0]=l[0]??1,h[1]=-(l[1]??1),h[2]=l[2]??1,h[3]=l[3]??1;const d=f.translate;if(d[0]=a[0]??0,d[1]=a[1]??0,d[2]=a[2]??0,d[3]=a[3]??0,i&&!u&&(h[2]=h[3],d[2]=d[3]),!o.length){for(let t=0;t<s;++t)n[t]=T(f,n[t],t);return void(o.length=0)}let m=0;for(let r=0;r<o.length;r++){const t=o[r];o[r]=t;for(let r=0;r<s;++r)n[m+r]=T(f,n[m+r],r);let e=n[m],u=n[m+1];m+=s;for(let r=1;r<t;r++,m+=s){e+=n[m]*h[0],u+=n[m+1]*h[1],n[m]=e,n[m+1]=u;for(let t=2;t<s;++t)n[m+t]=T(f,n[m+t],t)}}}function ct(t,e){if(!t?.coords?.length)return null;const r=p[e],{coords:n,lengths:o,stride:s,hasZ:u,hasM:i}=t,c=Z(u,i,u,i),l=new m([],[],u,i);let a=0,f=0,h=0,d=0;for(const m of o){f=d,c(n,a,l.coords,f),a+=s,f+=s;let t=n[a],e=n[a+1];for(let r=1;r<m;r++){const o=n[a+s],u=n[a+s+1];t*u-e*o===0&&r!==m-1||(c(n,a,l.coords,f),l.coords[f]=t,l.coords[f+1]=e,f+=s,t=e=0),t+=o,e+=u,a+=s}const o=(f-d)/s;o>=r&&(l.lengths[h]=o,d=f,h++)}return l.coords.length>d&&(l.coords.length=d),l.lengths.length>h&&(l.lengths.length=h),l.coords.length&&l.lengths.length?l:null}function lt(t,e,r,n){let o=0,s=t[n*e],u=t[n*(e+1)];for(let i=1;i<r;i++){const r=s+t[n*(e+i)],c=u+t[n*(e+i)+1],l=(r-s)*(c+u);s=r,u=c,o+=l}return.5*o}function at(t,e){const{coords:r,lengths:n}=t;let o=0,s=0;for(let u=0;u<n.length;u++){const t=n[u];s+=lt(r,o,t,e),o+=t}return Math.abs(s)}function ft(t,e=0){t.length!==e&&(t.length=e)}const ht={originPosition:"lowerLeft",scale:[1,1,1,1],translate:[0,0,0,0]};export{B as convertFromFeature,X as convertFromFeatureSet,A as convertFromFeatures,H as convertFromGeometry,L as convertFromMultipoint,C as convertFromMultipointFeatures,j as convertFromPoint,F as convertFromPointFeatures,$ as convertFromPolygon,R as convertFromPolyline,O as convertFromPolylineFeatures,D as convertToFeature,W as convertToFeatureSet,Q as convertToFeatures,J as convertToGeometry,E as convertToMultipoint,k as convertToMultipointFeatures,N as convertToPoint,V as convertToPolygon,z as convertToPolyline,nt as generalizeOptimizedGeometry,ut as getBoundsOptimizedGeometry,at as getQuantizedArea,lt as getSignedQuantizedRingArea,et as quantizeOptimizedFeatureSet,rt as quantizeOptimizedGeometry,M as quantizeX,w as quantizeY,ct as removeCollinearVertices,tt as unquantizeOptimizedFeatureSetInPlace,it as unquantizeOptimizedGeometryInPlace,T as unquantizeValue,I as unquantizeX,P as unquantizeY};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{parseDate as t}from"../../../../core/date.js";import{isValid as e}from"../../../../geometry/support/spatialReferenceUtils.js";import{validateFieldValue as n,validationErrorToString as r,isNumericField as o,isStringField as s,isDateField as i,sanitizeNullFieldValue as u}from"../../../support/fieldUtils.js";class l{constructor(t){this.description=t,this.code=null}}class a{constructor(t){this.globalId=null,this.objectId=null,this.success=!1,this.uniqueId=null,this.error=new l(t)}}function p(t){return new a(t)}class c{constructor(t){this.globalId=null,this.success=!0,this.objectId=this.uniqueId=t}}function f(t){return new c(t)}const g=new Set;function d(t,e,o,s=!1){g.clear();for(const i in o){const u=t.get(i);if(!u)continue;const l=m(u,o[i]);if(g.add(u.name),u&&(s||u.editable)){const t=n(u,l);if(t)return p(r(t,u,l));e[u.name]=l}}for(const n of t.requiredFields??[])if(!g.has(n.name))return p(`missing required field "${n.name}"`);return null}function m(e,n){let r=n;return o(e)&&"string"==typeof n?r=parseFloat(n):s(e)&&null!=n&&"string"!=typeof n?r=String(n):i(e)&&"string"==typeof n&&(r=t(n)),u(r)}let y;function h(t,n){if(!t||!e(n))return t;if("rings"in t||"paths"in t){if(null==y)throw new TypeError("geometry engine not loaded");return y.simplify(n,t)}return t}async function I(){return null==y&&(y=await import("../../../../geometry/geometryEngineJSON.js")),y}async function E(t,n){!e(t)||"esriGeometryPolygon"!==n&&"esriGeometryPolyline"!==n||await I()}const S={supportsAutoIntervalBin:!0,supportsFixedIntervalBin:!0,supportsFixedBoundariesBin:!0,supportsDateBin:!0,supportsStackBy:!0,supportsSplitBy:!0,supportsNormalization:!0,supportedStatisticTypes:["COUNT","SUM","AVG","VAR","STDDEV","MIN","MAX","PERCENTILE_CONT","PERCENTILE_DISC","CentroidAggregate","EnvelopeAggregate","ConvexHullAggregate"],supportedNormalizationTypes:["field","log","naturalLog","percentOfTotal","squareRoot"]};export{p as createFeatureEditErrorResult,f as createFeatureEditSuccessResult,E as loadGeometryEngineForSimplify,d as mixAttributes,S as queryBinsCapabilities,h as simplify};
2
+ import{parseDate as t}from"../../../../core/date.js";import{isValid as e}from"../../../../geometry/support/spatialReferenceUtils.js";import{validateFieldValue as n,validationErrorToString as r,isNumericField as o,sanitizedParseFloat as i,isStringField as s,isDateField as u,sanitizeNullFieldValue as l}from"../../../support/fieldUtils.js";class a{constructor(t){this.description=t,this.code=null}}class c{constructor(t){this.globalId=null,this.objectId=null,this.success=!1,this.uniqueId=null,this.error=new a(t)}}function p(t){return new c(t)}class f{constructor(t){this.globalId=null,this.success=!0,this.objectId=this.uniqueId=t}}function g(t){return new f(t)}const d=new Set;function m(t,e,o,i=!1){d.clear();for(const s in o){const u=t.get(s);if(!u)continue;const l=y(u,o[s]);if(d.add(u.name),u&&(i||u.editable)){const t=n(u,l);if(t)return p(r(t,u,l));e[u.name]=l}}for(const n of t.requiredFields??[])if(!d.has(n.name))return p(`missing required field "${n.name}"`);return null}function y(e,n){let r=n;return o(e)&&"string"==typeof n?r=i(n):s(e)&&null!=n&&"string"!=typeof n?r=String(n):u(e)&&"string"==typeof n&&(r=t(n)),l(r)}let h;function I(t,n){if(!t||!e(n))return t;if("rings"in t||"paths"in t){if(null==h)throw new TypeError("geometry engine not loaded");return h.simplify(n,t)}return t}async function E(){return null==h&&(h=await import("../../../../geometry/geometryEngineJSON.js")),h}async function S(t,n){!e(t)||"esriGeometryPolygon"!==n&&"esriGeometryPolyline"!==n||await E()}const T={supportsAutoIntervalBin:!0,supportsFixedIntervalBin:!0,supportsFixedBoundariesBin:!0,supportsDateBin:!0,supportsStackBy:!0,supportsSplitBy:!0,supportsNormalization:!0,supportedStatisticTypes:["COUNT","SUM","AVG","VAR","STDDEV","MIN","MAX","PERCENTILE_CONT","PERCENTILE_DISC","CentroidAggregate","EnvelopeAggregate","ConvexHullAggregate"],supportedNormalizationTypes:["field","log","naturalLog","percentOfTotal","squareRoot"]};export{p as createFeatureEditErrorResult,g as createFeatureEditSuccessResult,S as loadGeometryEngineForSimplify,m as mixAttributes,T as queryBinsCapabilities,I as simplify};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{getAssetUrl as e}from"../../../assets.js";const t=[{pixelType:"S8",size:1,ctor:Int8Array,range:[-128,127]},{pixelType:"U8",size:1,ctor:Uint8Array,range:[0,255]},{pixelType:"S16",size:2,ctor:Int16Array,range:[-32768,32767]},{pixelType:"U16",size:2,ctor:Uint16Array,range:[0,65536]},{pixelType:"S32",size:4,ctor:Int32Array,range:[-2147483648,2147483647]},{pixelType:"U32",size:4,ctor:Uint32Array,range:[0,4294967296]},{pixelType:"F32",size:4,ctor:Float32Array,range:[-34028234663852886e22,34028234663852886e22]},{pixelType:"F64",size:8,ctor:Float64Array,range:[-17976931348623157e292,17976931348623157e292]}];let n=null;function r(){return n||(n=import("../../../chunks/lerc-wasm.js").then(({default:t})=>t({locateFile:t=>e(`esri/layers/raster/formats/${t}`)})).then(e=>{s(e)}),n)}const a={getBlobInfo:null,decode:null};function l(e){return 16+(e>>3<<3)}function o(e,t,n){n.set(e.slice(t,t+n.length))}function s(e){const{_malloc:n,_free:r,memory:s,_lerc_getBlobInfo:i,_lerc_getDataRanges:u,_lerc_decode_4D:c}=e;let f;const y=e=>{const t=e.map(e=>l(e)),r=t.reduce((e,t)=>e+t),a=n(r);f=new Uint8Array(s.buffer);let o=t[0];t[0]=a;for(let n=1;n<t.length;n++){const e=t[n];t[n]=t[n-1]+o,o=e}return t};a.getBlobInfo=e=>{const t=12,n=3,a=new Uint8Array(4*t),l=new Uint8Array(8*n),[c,p,h]=y([e.length,a.length,l.length]);f.set(e,c),f.set(a,p),f.set(l,h);let d=i(c,e.length,p,h,t,n);if(d)throw r(c),new Error(`lerc-getBlobInfo: error code is ${d}`);f=new Uint8Array(s.buffer),o(f,p,a),o(f,h,l);const g=new Uint32Array(a.buffer),w=new Float64Array(l.buffer),[b,A,,m,x,U,C,T,V,D,z]=g,I=0===C,k={version:b,depthCount:D,width:m,height:x,validPixelCount:C,bandCount:U,blobSize:T,maskCount:V,dataType:A,minValue:w[0],maxValue:w[1],maxZerror:w[2],statistics:[],bandCountWithNoData:z};if(z&&D>1)return r(c),k;if(1===D&&1===U){r(c);const e=I?0:w[0],t=I?0:w[1];return k.statistics.push({minValue:e,maxValue:t}),k}const F=D*U*8,_=new Uint8Array(F),v=new Uint8Array(F);let B=c,P=0,S=0,$=!1;if(f.byteLength<c+2*F?(r(c),$=!0,[B,P,S]=y([e.length,F,F]),f.set(e,B)):[P,S]=y([F,F]),f.set(_,P),f.set(v,S),d=u(B,e.length,D,U,P,S),d)throw r(B),$||r(P),new Error(`lerc-getDataRanges: error code is ${d}`);f=new Uint8Array(s.buffer),o(f,P,_),o(f,S,v);const E=new Float64Array(_.buffer),M=new Float64Array(v.buffer),O=k.statistics;for(let r=0;r<U;r++)if(D>1){const e=E.slice(r*D,(r+1)*D),t=M.slice(r*D,(r+1)*D),n=I?0:Math.min.apply(null,e),a=I?0:Math.max.apply(null,t);O.push({minValue:n,maxValue:a,depthStats:{minValues:e,maxValues:t}})}else O.push({minValue:I?0:E[r],maxValue:I?0:M[r]});return r(B),$||r(P),k},a.decode=(e,n)=>{const{maskCount:a,depthCount:l,bandCount:i,width:u,height:p,dataType:h,bandCountWithNoData:d,validPixelCount:g}=n,w=t[h],b=u*p,A=new Uint8Array(b*i),m=b*l*i*w.size,x=new Uint8Array(m),U=new Uint8Array(i),C=new Uint8Array(8*i);if(0===g)return{data:x,maskData:A,noDataValues:null};const[T,V,D,z,I]=y([e.length,A.length,x.length,U.length,C.length]);f.set(e,T),f.set(A,V),f.set(x,D),f.set(U,z),f.set(C,I);const k=c(T,e.length,a,V,l,u,p,i,h,D,z,I);if(k)throw r(T),new Error(`lerc-decode: error code is ${k}`);f=new Uint8Array(s.buffer),o(f,D,x),o(f,V,A);let F=null;if(d){o(f,z,U),o(f,I,C),F=[];const e=new Float64Array(C.buffer);for(let t=0;t<U.length;t++)F.push(U[t]?e[t]:null)}return r(T),{data:x,maskData:A,noDataValues:F}}}function i(e,t,n,r,a){if(n<2)return e;const l=new r(t*n);for(let o=0,s=0;o<t;o++)for(let r=0,a=o;r<n;r++,a+=t)l[a]=e[s++];return l}function u(e,n={}){const r=n.inputOffset??0,l=e instanceof Uint8Array?e.subarray(r):new Uint8Array(e,r),o=a.getBlobInfo(l),{data:s,maskData:u,noDataValues:c}=a.decode(l,o),{width:f,height:y,bandCount:p,depthCount:h,dataType:d,maskCount:g,statistics:w}=o,b=t[d],A=new b.ctor(s.buffer),m=[],x=[],U=f*y,C=U*h,T=t.find(e=>e.pixelType===n.outputPixelType)??b,V=T.pixelType!==b.pixelType;for(let t=0;t<p;t++){const e=t*C,r=e+C,a=A.subarray(e,r),l=V?new T.ctor(a):a;if(n.returnInterleaved)m.push(l);else{const e=i(l,U,h,T.ctor);m.push(e)}x.push(u.subarray(e,r))}const D=0===g?null:1===g?x[0]:new Uint8Array(U);if(g>1){D.set(x[0]);for(let e=1;e<x.length;e++){const t=x[e];for(let e=0;e<U;e++)D[e]=D[e]&t[e]}}const{noDataValue:z}=n,I=null!=z&&T.range[0]<=z&&T.range[1]>=z,{validPixelCount:k}=o;if(g>0&&I)for(let t=0;t<p;t++){const e=m[t];if(0===k)e.fill(z);else{const n=x[t]||D;for(let t=0;t<U;t++)0===n[t]&&(e[t]=z)}}const F=g===p&&p>1?x:null;return{width:f,height:y,bandCount:p,pixelType:T.pixelType,depthCount:h,statistics:w,pixels:m,mask:D,validPixelCount:k,bandMasks:F,noDataValues:c}}function c(e,t={}){const n=e instanceof Uint8Array?e.subarray(t.inputOffset??0):new Uint8Array(e,t.inputOffset??0);return a.getBlobInfo(n)}export{u as decode,c as getBlobInfo,r as load,t as pixelTypeInfoMap};
2
+ import{getAssetUrl as e}from"../../../assets.js";const t=[{pixelType:"S8",size:1,ctor:Int8Array,range:[-128,127]},{pixelType:"U8",size:1,ctor:Uint8Array,range:[0,255]},{pixelType:"S16",size:2,ctor:Int16Array,range:[-32768,32767]},{pixelType:"U16",size:2,ctor:Uint16Array,range:[0,65536]},{pixelType:"S32",size:4,ctor:Int32Array,range:[-2147483648,2147483647]},{pixelType:"U32",size:4,ctor:Uint32Array,range:[0,4294967296]},{pixelType:"F32",size:4,ctor:Float32Array,range:[-34028234663852886e22,34028234663852886e22]},{pixelType:"F64",size:8,ctor:Float64Array,range:[-17976931348623157e292,17976931348623157e292]}];let n=null;function r(){return n||(n=import("../../../chunks/lerc-wasm.js").then(({default:t})=>t({locateFile:t=>e(`esri/layers/raster/formats/${t}`)})).then(e=>{s(e)}),n)}const a={getBlobInfo:null,decode:null};function l(e){return 16+(e>>3<<3)}function o(e,t,n){n.set(e.slice(t,t+n.length))}function s(e){const{_malloc:n,_free:r,memory:s,_lerc_getBlobInfo:i,_lerc_getDataRanges:u,_lerc_decode_4D:c}=e;let f;const p=e=>{const t=e.map(e=>l(e)),r=t.reduce((e,t)=>e+t),a=n(r);f=new Uint8Array(s.buffer);let o=t[0];t[0]=a;for(let n=1;n<t.length;n++){const e=t[n];t[n]=t[n-1]+o,o=e}return t};a.getBlobInfo=e=>{const t=12,n=3,a=new Uint8Array(4*t),l=new Uint8Array(8*n),[c,y,h]=p([e.length,a.length,l.length]);f.set(e,c),f.set(a,y),f.set(l,h);let d=i(c,e.length,y,h,t,n);if(d)throw r(c),new Error(`lerc-getBlobInfo: error code is ${d}`);f=new Uint8Array(s.buffer),o(f,y,a),o(f,h,l);const g=new Uint32Array(a.buffer),w=new Float64Array(l.buffer),[m,b,,A,x,U,C,T,V,D,z]=g,k=0===C,F={version:m,depthCount:D,width:A,height:x,validPixelCount:C,bandCount:U,blobSize:T,maskCount:V,dataType:b,minValue:w[0],maxValue:w[1],maxZerror:w[2],statistics:[],bandCountWithNoData:z};if(z&&D>1)return r(c),F;if(1===D&&1===U){r(c);const e=k?0:w[0],t=k?0:w[1];return F.statistics.push({minValue:e,maxValue:t}),F}const I=D*U*8,_=new Uint8Array(I),v=new Uint8Array(I);let B=c,P=0,S=0,$=!1;if(f.byteLength<c+2*I?(r(c),$=!0,[B,P,S]=p([e.length,I,I]),f.set(e,B)):[P,S]=p([I,I]),f.set(_,P),f.set(v,S),d=u(B,e.length,D,U,P,S),d)throw r(B),$||r(P),new Error(`lerc-getDataRanges: error code is ${d}`);f=new Uint8Array(s.buffer),o(f,P,_),o(f,S,v);const E=new Float64Array(_.buffer),M=new Float64Array(v.buffer),j=F.statistics;for(let r=0;r<U;r++)if(D>1){const e=E.slice(r*D,(r+1)*D),t=M.slice(r*D,(r+1)*D),n=k?0:Math.min.apply(null,e),a=k?0:Math.max.apply(null,t);j.push({minValue:n,maxValue:a,depthStats:{minValues:e,maxValues:t}})}else j.push({minValue:k?0:E[r],maxValue:k?0:M[r]});return r(B),$||r(P),F},a.decode=(e,n)=>{const{maskCount:a,depthCount:l,bandCount:i,width:u,height:y,dataType:h,bandCountWithNoData:d,validPixelCount:g}=n,w=t[h],m=u*y,b=new Uint8Array(m*i),A=m*l*i*w.size,x=new Uint8Array(A),U=new Uint8Array(i),C=new Uint8Array(8*i);if(0===g)return{data:x,maskData:b,noDataValues:null};const[T,V,D,z,k]=p([e.length,b.length,x.length,U.length,C.length]);f.set(e,T),f.set(b,V),f.set(x,D),f.set(U,z),f.set(C,k);const F=c(T,e.length,a,V,l,u,y,i,h,D,z,k);if(F)throw r(T),new Error(`lerc-decode: error code is ${F}`);f=new Uint8Array(s.buffer),o(f,D,x),o(f,V,b);let I=null;if(d){o(f,z,U),o(f,k,C),I=[];const e=new Float64Array(C.buffer);for(let t=0;t<U.length;t++)I.push(U[t]?e[t]:null)}return r(T),{data:x,maskData:b,noDataValues:I}}}function i(e,t,n,r,a){if(n<2)return e;const l=new r(t*n);for(let o=0,s=0;o<t;o++)for(let r=0,a=o;r<n;r++,a+=t)l[a]=e[s++];return l}function u(e,n={}){const r=n.inputOffset??0,l=e instanceof Uint8Array?e.subarray(r):new Uint8Array(e,r),o=a.getBlobInfo(l),{data:s,maskData:u,noDataValues:c}=a.decode(l,o),{width:f,height:p,bandCount:y,depthCount:h,dataType:d,maskCount:g,statistics:w}=o,m=t[d],b=new m.ctor(s.buffer),A=[],x=[],U=f*p,C=U*h,T=t.find(e=>e.pixelType===n.outputPixelType)??m,V=T.pixelType!==m.pixelType;for(let t=0;t<y;t++){const e=t*C,r=e+C,a=b.subarray(e,r),l=V?new T.ctor(a):a;if(n.returnInterleaved)A.push(l);else{const e=i(l,U,h,T.ctor);A.push(e)}x.push(u.subarray(e,r))}const D=0===g?null:1===g?x[0]:new Uint8Array(U);if(g>1){D.set(x[0]);for(let e=1;e<x.length;e++){const t=x[e];for(let e=0;e<U;e++)D[e]=D[e]&t[e]}}const{noDataValue:z}=n,k=null!=z&&T.range[0]<=z&&T.range[1]>=z,{validPixelCount:F}=o;if(g>0&&k)for(let t=0;t<y;t++){const e=A[t];if(0===F)e.fill(z);else{const n=x[t]||D;for(let t=0;t<U;t++)0===n[t]&&(e[t]=z)}}const I=g===y&&y>1?x:null;return{width:f,height:p,bandCount:y,pixelType:T.pixelType,depthCount:h,statistics:w,pixels:A,mask:D,validPixelCount:F,bandMasks:I,noDataValues:c}}export{u as decode,r as load,t as pixelTypeInfoMap};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../core/Error.js";import{getDeepValue as n,setDeepValue as i}from"../../core/object.js";import{union as t}from"../../core/SetUtils.js";import{parseWhereClause as r}from"../../core/sql.js";import{getDomainRange as l}from"./domainUtils.js";import{getFieldNameFromSimpleExpression as o}from"../../support/arcadeExpressionUtils.js";import{isStringOrNull as s,isString as a}from"../../support/guards.js";import{loadArcade as u}from"../../support/loadArcade.js";const f=/^([0-9_])/,c=/[^a-z0-9_\u0080-\uffff]+/gi;function d(e){if(null==e)return null;return e.trim().replaceAll(c,"_").replace(f,"F$1")||null}const p=["field","field2","field3","normalizationField","rotationInfo.field","proportionalSymbolInfo.field","proportionalSymbolInfo.normalizationField","colorInfo.field","colorInfo.normalizationField"],m=["field","normalizationField"];function y(e,n){if(null!=e&&null!=n)for(const i of Array.isArray(e)?e:[e])if(g(p,i,n),"visualVariables"in i&&i.visualVariables)for(const e of i.visualVariables)g(m,e,n)}function g(e,t,r){if(e)for(const l of e){const e=n(l,t),o=e&&"function"!=typeof e&&r.get(e);o&&i(l,o.name,t)}}function F(e,n){if(null!=e&&n?.fields?.length)if("startField"in e){const i=n.get(e.startField),t=n.get(e.endField);e.startField=i?.name??null,e.endField=t?.name??null}else{const i=n.get(e.startTimeField),t=n.get(e.endTimeField);e.startTimeField=i?.name??null,e.endTimeField=t?.name??null}}const b=new Set;function I(e,n){return e&&n?(b.clear(),w(b,e,n),Array.from(b).sort()):[]}function w(e,n,i){if(i)if(n?.fields?.length)if(i.includes("*"))for(const{name:t}of n.fields)e.add(t);else for(const t of i)x(e,n,t);else{if(i.includes("*"))return e.clear(),void e.add("*");for(const n of i)null!=n&&e.add(n)}}function x(e,n,i){if("string"==typeof i)if(n){const t=n.get(i);t&&e.add(t.name)}else e.add(i)}function T(e,n){return null==n||null==e?[]:n.includes("*")?(e.fields??[]).map(e=>e.name):n}function h(e,n,i=1){if(!n||!e)return[];if(n.includes("*"))return["*"];const t=I(e,n);return t.length/e.fields.length>=i?["*"]:t}async function v(e,n,i,t){if(!t)return;const r=o(t);if(r)x(e,n,r);else{const{arcadeUtils:r}=await u(),l=r.extractFieldNames(t,i?.partitions??n?.fields?.map(e=>e.name));for(const t of l)x(e,i?.index??n,t)}}async function S(n,i,t){if(t&&"1=1"!==t){const l=await r(t,i);if(!l.isStandardized)throw new e("fieldUtils:collectFilterFields","Where clause is not standardized",{where:t});w(n,i,l.fieldNames)}}function E({displayField:e,fields:n}){return e||(n?.length?A(n):null)}function A(e){return _(e,"name-or-title")||_(e,"unique-identifier")||_(e,"type-or-category")||$(e)}function $(e){for(const n of e){if(!n?.name)continue;const e=n.name.toLowerCase();if(e.includes("name")||e.includes("title"))return n.name}return null}function _(e,n){for(const i of e)if(i?.valueType&&i.valueType===n)return i.name;return null}async function N(e){if(!e)return[];const n=new Set;return await L(n,e),Array.from(n).sort()}async function L(e,n){if(!n)return;const i=n.elevationInfo?.featureExpressionInfo;return i?i.collectRequiredFields(e,n.fieldsIndex):void 0}function M(e,n,i){i.onStatisticExpression?v(e,n,null,i.onStatisticExpression.expression):e.add(i.onStatisticField)}async function j(e,n,i){if(!n||!i||!("fields"in i))return;const t=[],r=i.popupTemplate;t.push(O(e,n,r)),i.fields&&t.push(...i.fields.map(async i=>M(e,n.fieldsIndex,i))),await Promise.all(t)}async function D(e,n){const{fieldsIndex:i,trackInfo:t}=n;if(!n||!t||!i)return;const r=[t.latestObservations.renderer?.collectRequiredFields(e,i),t.previousObservations.renderer?.collectRequiredFields(e,i),t.trackLines.renderer?.collectRequiredFields(e,i)];t.popupTemplate&&r.push(O(e,n,t.popupTemplate));for(const l of[t.latestObservations.labelingInfo,t.previousObservations.labelingInfo,t.trackLines.labelingInfo])if(l)for(const n of l)r.push(ee(e,i,n));await Promise.all(r)}async function O(e,n,i){const t=[];i?.expressionInfos&&t.push(...i.expressionInfos.map(i=>v(e,n.fieldsIndex,null,i.expression)));const r=i?.content;if(Array.isArray(r))for(const l of r)"expression"===l.type&&l.expressionInfo&&t.push(v(e,n.fieldsIndex,null,l.expressionInfo.expression));await Promise.all(t)}async function C(e,n,i){n&&(n.timeInfo&&i?.timeExtent&&w(e,n.fieldsIndex,[n.timeInfo.startField,n.timeInfo.endField]),n.floorInfo&&w(e,n.fieldsIndex,[n.floorInfo.floorField]),null!=i?.where&&await S(e,n.fieldsIndex,i.where))}async function R(e,n,i){n&&i&&await Promise.all(i.map(i=>V(e,n,i)))}async function V(e,n,i){n&&i&&(i.valueExpression?await v(e,n.fieldsIndex,null,i.valueExpression):i.field&&x(e,n.fieldsIndex,i.field))}async function k(e){if(!e)return[];const n="timeInfo"in e&&e.timeInfo;return n?I(e.fieldsIndex,[e.trackIdField,n.startField,n.endField]):[]}function U(e){return e?I(e.fieldsIndex,J(e)):[]}function q(e){if(!e)return[];const n=e.geometryFieldsInfo;return n?I(e.fieldsIndex,[n.shapeAreaField,n.shapeLengthField]):[]}async function z(e,n,i){if(!n||!i)return;const t=n.fieldsIndex;await Promise.all(i.filters.map(n=>S(e,t,n.where)))}const X=new Set(["oid","global-id","guid"]),P=new Set(["oid","global-id"]),B=[/^fnode_$/i,/^tnode_$/i,/^lpoly_$/i,/^rpoly_$/i,/^poly_$/i,/^shape$/i,/^shape_$/i,/^subclass$/i,/^subclass_$/i,/^rings_ok$/i,/^rings_nok$/i,/objectid/i,/^perimeter_/i,/_perimeter$/i,/_i$/i];function G(e){const n=new Set;W(e).forEach(e=>n.add(e)),q(e).forEach(e=>n.add(e.toLowerCase()));const i=e&&"infoFor3D"in e?e.infoFor3D:void 0;return i&&(Object.values(i.assetMapFieldRoles).forEach(e=>n.add(e.toLowerCase())),Object.values(i.transformFieldRoles).forEach(e=>n.add(e.toLowerCase()))),Array.from(n)}function J(e){if(!e)return[];const n="editFieldsInfo"in e&&e.editFieldsInfo;if(!n)return[];const{creationDateField:i,creatorField:t,editDateField:r,editorField:l}=n;return[i,t,r,l].filter(Boolean)}function W(e){return J(e).map(e=>e.toLowerCase())}function H(e){return!!e.type}function K(e,n){return!!e.editable&&H(e)&&!X.has(e.type)&&!W(n).includes(e.name?.toLowerCase()??"")}function Q(e,n){const i=e.name?.toLowerCase()??"";return!(null!=n?.objectIdField&&i===n.objectIdField.toLowerCase()||null!=n?.globalIdField&&i===n.globalIdField.toLowerCase()||G(n).includes(i)||P.has(e.type)||B.some(e=>e.test(i)))}async function Y(e){if(!e)return[];const n=new Set;return await Z(n,e),Array.from(n).sort()}async function Z(e,n){const{labelingInfo:i,fieldsIndex:t}=n;i?.length&&await Promise.all(i.map(n=>ee(e,t,n)))}async function ee(e,n,i){if(!i)return;const t=i.getLabelExpression(),r=i.where;if("arcade"===t.type)await v(e,n,null,t.expression);else{const i=t.expression.match(/{[^}]*}/g);i&&i.forEach(i=>{x(e,n,i.slice(1,-1))})}await S(e,n,r)}function ne(e){const n=e.defaultValue;return void 0!==n&&se(e,n)?n:e.nullable?null:void 0}function ie(e){const n="string"==typeof e?{type:e}:e;return be(n)?255:"esriFieldTypeDate"===n.type||"date"===n.type?8:void 0}function te(e){return"number"==typeof e&&!isNaN(e)&&isFinite(e)}function re(e){return null===e||te(e)}function le(e){return null===e||Number.isInteger(e)}function oe(){return!0}function se(e,n){let i;switch(e.type){case"date":case"integer":case"long":case"small-integer":case"big-integer":case"esriFieldTypeDate":case"esriFieldTypeInteger":case"esriFieldTypeLong":case"esriFieldTypeSmallInteger":case"esriFieldTypeBigInteger":i=e.nullable?le:Number.isInteger;break;case"double":case"single":case"esriFieldTypeSingle":case"esriFieldTypeDouble":i=e.nullable?re:te;break;case"string":case"esriFieldTypeString":i=e.nullable?s:a;break;default:i=oe}return 1===arguments.length?i:i(n)}const ae=["integer","small-integer","big-integer","long"],ue=["single","double"],fe=[...ae,...ue],ce=["esriFieldTypeInteger","esriFieldTypeSmallInteger","esriFieldTypeLong","esriFieldTypeBigInteger"],de=["esriFieldTypeSingle","esriFieldTypeDouble"],pe=new Set([...ae,...ce]),me=new Set([...ue,...de]),ye=t(pe,me);function ge(e){return null!=e&&pe.has(e.type)}function Fe(e){return null!=e&&ye.has(e.type)}function be(e){return null!=e&&("string"===e.type||"esriFieldTypeString"===e.type)}function Ie(e){return null!=e&&("date"===e.type||"esriFieldTypeDate"===e.type)}function we(e){return null!=e&&("date-only"===e.type||"esriFieldTypeDateOnly"===e.type)}function xe(e){return null!=e&&("timestamp-offset"===e.type||"esriFieldTypeTimestampOffset"===e.type)}function Te(e){return null!=e&&("time-only"===e.type||"esriFieldTypeTimeOnly"===e.type)}function he(e){return null!=e&&("date"===e.type||"date-only"===e.type||"time-only"===e.type||"timestamp-offset"===e.type)}function ve(e){return null!=e&&("oid"===e.type||"esriFieldTypeOID"===e.type)}function Se(e){return null!=e&&("global-id"===e.type||"esriFieldTypeGlobalID"===e.type)}function Ee(e,n){return null===$e(e,n)}function Ae(e){return null==e||"number"==typeof e&&isNaN(e)?null:e}function $e(e,n){return null==e||e.nullable&&null===n?null:se(e,n)?Fe(e)&&!_e(e.type,Number(n))?"numeric-range-validation-error::out-of-range":null:"type-validation-error::invalid-type"}function _e(e,n){const i="string"==typeof e?Le(e):e;if(!i)return!1;const t=i.min,r=i.max;return i.isInteger?Number.isInteger(n)&&n>=t&&n<=r:n>=t&&n<=r}function Ne(e,n){const i=l(e,n);return i||(Fe(e)?Le(e.type):void 0)}function Le(e){switch(e){case"esriFieldTypeSmallInteger":case"small-integer":return je;case"esriFieldTypeInteger":case"esriFieldTypeLong":case"integer":case"long":return De;case"esriFieldTypeBigInteger":case"big-integer":return Oe;case"esriFieldTypeSingle":case"single":return Re;case"esriFieldTypeDouble":case"double":return Ve}}function Me(e){if(!te(e))return null;if(Number.isInteger(e)){if(e>=je.min&&e<=je.max)return"esriFieldTypeSmallInteger";if(e>=De.min&&e<=De.max)return"esriFieldTypeInteger";if(e>=Oe.min&&e<=Oe.max)return"esriFieldTypeBigInteger"}return e>=Re.min&&e<=Re.max?"esriFieldTypeSingle":"esriFieldTypeDouble"}const je={min:-32768,max:32767,isInteger:!0,rawMin:-32768,rawMax:32767},De={min:-2147483648,max:2147483647,isInteger:!0,rawMin:-2147483648,rawMax:2147483647},Oe={min:-Number.MAX_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,isInteger:!0,rawMin:-Number.MAX_SAFE_INTEGER,rawMax:Number.MAX_SAFE_INTEGER},Ce=(2-2**-23)*2**127,Re={min:-Ce,max:Ce,isInteger:!1,rawMin:-Ce,rawMax:Ce},Ve={min:-Number.MAX_VALUE,max:Number.MAX_VALUE,isInteger:!1,rawMin:-Number.MAX_VALUE,rawMax:Number.MAX_VALUE};function ke(e,n,i){switch(e){case"domain-validation-error::invalid-coded-value":return`Value ${i} is not in the coded domain - field: ${n.name}, domain: ${JSON.stringify(n.domain)}`;case"domain-validation-error::value-out-of-range":return`Value ${i} is out of the range of valid values - field: ${n.name}, domain: ${JSON.stringify(n.domain)}`;case"type-validation-error::invalid-type":return`Value ${i} is not a valid value for the field type - field: ${n.name}, type: ${n.type}, nullable: ${n.nullable}`;case"numeric-range-validation-error::out-of-range":{const{min:e,max:t}=Le(n.type);return`Value ${i} is out of range for the number type - field: ${n.name}, type: ${n.type}, value range is ${e} to ${t}`}}}function Ue(e,n){return!qe(e,n,null)}function qe(e,n,i){if(!e?.attributes||!n){if(null!=i)for(const e of n??[])i.add(e);return!0}const t=new Set(Object.keys(e.attributes));let r=!1;for(const l of n)if(!t.has(l)){if(r=!0,null==i)break;i.add(l)}return r}async function ze(e,n){const i=new Set;for(const t of n)await v(i,e.fieldsIndex,null,t);return Array.from(i).sort()}function Xe(e){return!!e&&["raster.itempixelvalue","raster.servicepixelvalue"].some(n=>e.toLowerCase().startsWith(n))}async function Pe(e,n){const i=new Set;return e?.collectRequiredFields&&await e.collectRequiredFields(i,n),Array.from(i).sort()}function Be(e){const n=e?.match(/{[^}]+}/g);return n?n.map(e=>e.slice(1,-1).split(":")[0].trim()):[]}function Ge(e,n){const{statisticType:i,onStatisticField:t,onStatisticExpression:r}=e,l=n.get(t),o=Fe(l),s=r?.returnType;switch(i){case"avg":case"avg_angle":return l?o||Ie(l)?"double":null:s&&"number"===s?"double":null;case"count":return"integer";case"min":case"max":return l?o||he(l)?l?.type??null:null:s&&"number"===s?"double":null;case"sum":return l?o?l?.type??null:null:s&&"number"===s?"double":null;case"mode":return l?l?.type??null:s?"number"===s?"double":"string":null;default:return null}}function Je(e){const{fieldName:n,fieldsMap:i,normalizedFieldsMap:t}=e;if(!n)return;let r=i.get(n);return r||(r=i.get(We(n))??t.get(He(n)),r&&i.set(n,r),r)}function We(e){return e.trim().toLowerCase()}function He(e){return d(e)?.toLowerCase()??""}export{We as applyLowerCaseFieldName,Oe as bigIntegerRange,v as collectArcadeFieldNames,z as collectDisplayFilterFields,L as collectElevationFields,j as collectFeatureReductionFields,x as collectField,w as collectFields,C as collectFilterFields,Z as collectLabelingFields,R as collectOrderByInfos,O as collectPopupTemplateFields,S as collectSQLFieldNames,D as collectTrackInfoFields,Ve as doubleRange,Be as extractSubstitutionTemplatesFromString,Ue as featureHasFields,I as fixFields,y as fixRendererFields,F as fixTimeInfoFields,de as floatJSONTypes,ue as floatTypes,Ge as getAggregateFieldType,E as getDisplayFieldName,A as getDisplayFieldNameFromFields,J as getEditTrackingFields,N as getElevationFields,ze as getExpressionFields,U as getFeatureEditFields,q as getFeatureGeometryFields,ie as getFieldDefaultLength,ne as getFieldDefaultValue,Je as getFieldFromIndex,Ne as getFieldRange,Y as getLabelingFields,G as getLowerCaseDefaultHiddenFields,W as getLowerCaseEditTrackingFields,Me as getNumericTypeForValue,Pe as getRendererFields,k as getTimeFields,ce as integerJSONTypes,De as integerRange,ae as integerTypes,Ie as isDateField,we as isDateOnlyField,K as isFieldEditable,Q as isFieldVisibleByDefault,H as isFieldWithType,Se as isGlobalIDField,ge as isIntegerField,_e as isNumberInRange,Fe as isNumericField,ve as isObjectIDField,Xe as isRasterPixelValueField,be as isStringField,Te as isTimeOnlyField,xe as isTimestampOffsetField,Ee as isValidFieldValue,se as isValueMatchingFieldType,He as lowerCaseNormalizedFieldName,d as normalizeFieldName,fe as numericTypes,h as packFields,qe as populateMissingFields,p as rendererFields,Ae as sanitizeNullFieldValue,Re as singleRange,je as smallIntegerRange,T as unpackFieldNames,$e as validateFieldValue,ke as validationErrorToString,m as visualVariableFields};
2
+ import e from"../../core/Error.js";import{getDeepValue as n,setDeepValue as i}from"../../core/object.js";import{union as t}from"../../core/SetUtils.js";import{parseWhereClause as r}from"../../core/sql.js";import{getDomainRange as l}from"./domainUtils.js";import{getFieldNameFromSimpleExpression as o}from"../../support/arcadeExpressionUtils.js";import{isStringOrNull as s,isString as a}from"../../support/guards.js";import{loadArcade as u}from"../../support/loadArcade.js";const f=/^([0-9_])/,c=/[^a-z0-9_\u0080-\uffff]+/gi;function d(e){if(null==e)return null;return e.trim().replaceAll(c,"_").replace(f,"F$1")||null}const p=["field","field2","field3","normalizationField","rotationInfo.field","proportionalSymbolInfo.field","proportionalSymbolInfo.normalizationField","colorInfo.field","colorInfo.normalizationField"],m=["field","normalizationField"];function y(e,n){if(null!=e&&null!=n)for(const i of Array.isArray(e)?e:[e])if(g(p,i,n),"visualVariables"in i&&i.visualVariables)for(const e of i.visualVariables)g(m,e,n)}function g(e,t,r){if(e)for(const l of e){const e=n(l,t),o=e&&"function"!=typeof e&&r.get(e);o&&i(l,o.name,t)}}function F(e,n){if(null!=e&&n?.fields?.length)if("startField"in e){const i=n.get(e.startField),t=n.get(e.endField);e.startField=i?.name??null,e.endField=t?.name??null}else{const i=n.get(e.startTimeField),t=n.get(e.endTimeField);e.startTimeField=i?.name??null,e.endTimeField=t?.name??null}}const b=new Set;function I(e,n){return e&&n?(b.clear(),w(b,e,n),Array.from(b).sort()):[]}function w(e,n,i){if(i)if(n?.fields?.length)if(i.includes("*"))for(const{name:t}of n.fields)e.add(t);else for(const t of i)x(e,n,t);else{if(i.includes("*"))return e.clear(),void e.add("*");for(const n of i)null!=n&&e.add(n)}}function x(e,n,i){if("string"==typeof i)if(n){const t=n.get(i);t&&e.add(t.name)}else e.add(i)}function T(e,n){return null==n||null==e?[]:n.includes("*")?(e.fields??[]).map(e=>e.name):n}function h(e,n,i=1){if(!n||!e)return[];if(n.includes("*"))return["*"];const t=I(e,n);return t.length/e.fields.length>=i?["*"]:t}async function v(e,n,i,t){if(!t)return;const r=o(t);if(r)x(e,n,r);else{const{arcadeUtils:r}=await u(),l=r.extractFieldNames(t,i?.partitions??n?.fields?.map(e=>e.name));for(const t of l)x(e,i?.index??n,t)}}async function S(n,i,t){if(t&&"1=1"!==t){const l=await r(t,i);if(!l.isStandardized)throw new e("fieldUtils:collectFilterFields","Where clause is not standardized",{where:t});w(n,i,l.fieldNames)}}function E({displayField:e,fields:n}){return e||(n?.length?A(n):null)}function A(e){return _(e,"name-or-title")||_(e,"unique-identifier")||_(e,"type-or-category")||$(e)}function $(e){for(const n of e){if(!n?.name)continue;const e=n.name.toLowerCase();if(e.includes("name")||e.includes("title"))return n.name}return null}function _(e,n){for(const i of e)if(i?.valueType&&i.valueType===n)return i.name;return null}async function N(e){if(!e)return[];const n=new Set;return await L(n,e),Array.from(n).sort()}async function L(e,n){if(!n)return;const i=n.elevationInfo?.featureExpressionInfo;return i?i.collectRequiredFields(e,n.fieldsIndex):void 0}function M(e,n,i){i.onStatisticExpression?v(e,n,null,i.onStatisticExpression.expression):e.add(i.onStatisticField)}async function j(e,n,i){if(!n||!i||!("fields"in i))return;const t=[],r=i.popupTemplate;t.push(O(e,n,r)),i.fields&&t.push(...i.fields.map(async i=>M(e,n.fieldsIndex,i))),await Promise.all(t)}async function D(e,n){const{fieldsIndex:i,trackInfo:t}=n;if(!n||!t||!i)return;const r=[t.latestObservations.renderer?.collectRequiredFields(e,i),t.previousObservations.renderer?.collectRequiredFields(e,i),t.trackLines.renderer?.collectRequiredFields(e,i)];t.popupTemplate&&r.push(O(e,n,t.popupTemplate));for(const l of[t.latestObservations.labelingInfo,t.previousObservations.labelingInfo,t.trackLines.labelingInfo])if(l)for(const n of l)r.push(ee(e,i,n));await Promise.all(r)}async function O(e,n,i){const t=[];i?.expressionInfos&&t.push(...i.expressionInfos.map(i=>v(e,n.fieldsIndex,null,i.expression)));const r=i?.content;if(Array.isArray(r))for(const l of r)"expression"===l.type&&l.expressionInfo&&t.push(v(e,n.fieldsIndex,null,l.expressionInfo.expression));await Promise.all(t)}async function C(e,n,i){n&&(n.timeInfo&&i?.timeExtent&&w(e,n.fieldsIndex,[n.timeInfo.startField,n.timeInfo.endField]),n.floorInfo&&w(e,n.fieldsIndex,[n.floorInfo.floorField]),null!=i?.where&&await S(e,n.fieldsIndex,i.where))}async function R(e,n,i){n&&i&&await Promise.all(i.map(i=>V(e,n,i)))}async function V(e,n,i){n&&i&&(i.valueExpression?await v(e,n.fieldsIndex,null,i.valueExpression):i.field&&x(e,n.fieldsIndex,i.field))}async function k(e){if(!e)return[];const n="timeInfo"in e&&e.timeInfo;return n?I(e.fieldsIndex,[e.trackIdField,n.startField,n.endField]):[]}function U(e){return e?I(e.fieldsIndex,J(e)):[]}function q(e){if(!e)return[];const n=e.geometryFieldsInfo;return n?I(e.fieldsIndex,[n.shapeAreaField,n.shapeLengthField]):[]}async function z(e,n,i){if(!n||!i)return;const t=n.fieldsIndex;await Promise.all(i.filters.map(n=>S(e,t,n.where)))}const X=new Set(["oid","global-id","guid"]),P=new Set(["oid","global-id"]),B=[/^fnode_$/i,/^tnode_$/i,/^lpoly_$/i,/^rpoly_$/i,/^poly_$/i,/^shape$/i,/^shape_$/i,/^subclass$/i,/^subclass_$/i,/^rings_ok$/i,/^rings_nok$/i,/objectid/i,/^perimeter_/i,/_perimeter$/i,/_i$/i];function G(e){const n=new Set;W(e).forEach(e=>n.add(e)),q(e).forEach(e=>n.add(e.toLowerCase()));const i=e&&"infoFor3D"in e?e.infoFor3D:void 0;return i&&(Object.values(i.assetMapFieldRoles).forEach(e=>n.add(e.toLowerCase())),Object.values(i.transformFieldRoles).forEach(e=>n.add(e.toLowerCase()))),Array.from(n)}function J(e){if(!e)return[];const n="editFieldsInfo"in e&&e.editFieldsInfo;if(!n)return[];const{creationDateField:i,creatorField:t,editDateField:r,editorField:l}=n;return[i,t,r,l].filter(Boolean)}function W(e){return J(e).map(e=>e.toLowerCase())}function H(e){return!!e.type}function K(e,n){return!!e.editable&&H(e)&&!X.has(e.type)&&!W(n).includes(e.name?.toLowerCase()??"")}function Q(e,n){const i=e.name?.toLowerCase()??"";return!(null!=n?.objectIdField&&i===n.objectIdField.toLowerCase()||null!=n?.globalIdField&&i===n.globalIdField.toLowerCase()||G(n).includes(i)||P.has(e.type)||B.some(e=>e.test(i)))}async function Y(e){if(!e)return[];const n=new Set;return await Z(n,e),Array.from(n).sort()}async function Z(e,n){const{labelingInfo:i,fieldsIndex:t}=n;i?.length&&await Promise.all(i.map(n=>ee(e,t,n)))}async function ee(e,n,i){if(!i)return;const t=i.getLabelExpression(),r=i.where;if("arcade"===t.type)await v(e,n,null,t.expression);else{const i=t.expression.match(/{[^}]*}/g);i&&i.forEach(i=>{x(e,n,i.slice(1,-1))})}await S(e,n,r)}function ne(e){const n=e.defaultValue;return void 0!==n&&se(e,n)?n:e.nullable?null:void 0}function ie(e){const n="string"==typeof e?{type:e}:e;return be(n)?255:"esriFieldTypeDate"===n.type||"date"===n.type?8:void 0}function te(e){return"number"==typeof e&&!isNaN(e)&&isFinite(e)}function re(e){return null===e||te(e)}function le(e){return null===e||Number.isInteger(e)}function oe(){return!0}function se(e,n){let i;switch(e.type){case"date":case"integer":case"long":case"small-integer":case"big-integer":case"esriFieldTypeDate":case"esriFieldTypeInteger":case"esriFieldTypeLong":case"esriFieldTypeSmallInteger":case"esriFieldTypeBigInteger":i=e.nullable?le:Number.isInteger;break;case"double":case"single":case"esriFieldTypeSingle":case"esriFieldTypeDouble":i=e.nullable?re:te;break;case"string":case"esriFieldTypeString":i=e.nullable?s:a;break;default:i=oe}return 1===arguments.length?i:i(n)}const ae=["integer","small-integer","big-integer","long"],ue=["single","double"],fe=[...ae,...ue],ce=["esriFieldTypeInteger","esriFieldTypeSmallInteger","esriFieldTypeLong","esriFieldTypeBigInteger"],de=["esriFieldTypeSingle","esriFieldTypeDouble"],pe=new Set([...ae,...ce]),me=new Set([...ue,...de]),ye=t(pe,me);function ge(e){return null!=e&&pe.has(e.type)}function Fe(e){return null!=e&&ye.has(e.type)}function be(e){return null!=e&&("string"===e.type||"esriFieldTypeString"===e.type)}function Ie(e){return null!=e&&("date"===e.type||"esriFieldTypeDate"===e.type)}function we(e){return null!=e&&("date-only"===e.type||"esriFieldTypeDateOnly"===e.type)}function xe(e){return null!=e&&("timestamp-offset"===e.type||"esriFieldTypeTimestampOffset"===e.type)}function Te(e){return null!=e&&("time-only"===e.type||"esriFieldTypeTimeOnly"===e.type)}function he(e){return null!=e&&("date"===e.type||"date-only"===e.type||"time-only"===e.type||"timestamp-offset"===e.type)}function ve(e){return null!=e&&("oid"===e.type||"esriFieldTypeOID"===e.type)}function Se(e){return null!=e&&("global-id"===e.type||"esriFieldTypeGlobalID"===e.type)}function Ee(e,n){return null===_e(e,n)}function Ae(e){return null==e||"number"==typeof e&&isNaN(e)?null:e}function $e(e){return parseFloat(e.replaceAll("_",""))}function _e(e,n){return null==e||e.nullable&&null===n?null:se(e,n)?Fe(e)&&!Ne(e.type,Number(n))?"numeric-range-validation-error::out-of-range":null:"type-validation-error::invalid-type"}function Ne(e,n){const i="string"==typeof e?Me(e):e;if(!i)return!1;const t=i.min,r=i.max;return i.isInteger?Number.isInteger(n)&&n>=t&&n<=r:n>=t&&n<=r}function Le(e,n){const i=l(e,n);return i||(Fe(e)?Me(e.type):void 0)}function Me(e){switch(e){case"esriFieldTypeSmallInteger":case"small-integer":return De;case"esriFieldTypeInteger":case"esriFieldTypeLong":case"integer":case"long":return Oe;case"esriFieldTypeBigInteger":case"big-integer":return Ce;case"esriFieldTypeSingle":case"single":return Ve;case"esriFieldTypeDouble":case"double":return ke}}function je(e){if(!te(e))return null;if(Number.isInteger(e)){if(e>=De.min&&e<=De.max)return"esriFieldTypeSmallInteger";if(e>=Oe.min&&e<=Oe.max)return"esriFieldTypeInteger";if(e>=Ce.min&&e<=Ce.max)return"esriFieldTypeBigInteger"}return e>=Ve.min&&e<=Ve.max?"esriFieldTypeSingle":"esriFieldTypeDouble"}const De={min:-32768,max:32767,isInteger:!0,rawMin:-32768,rawMax:32767},Oe={min:-2147483648,max:2147483647,isInteger:!0,rawMin:-2147483648,rawMax:2147483647},Ce={min:-Number.MAX_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,isInteger:!0,rawMin:-Number.MAX_SAFE_INTEGER,rawMax:Number.MAX_SAFE_INTEGER},Re=(2-2**-23)*2**127,Ve={min:-Re,max:Re,isInteger:!1,rawMin:-Re,rawMax:Re},ke={min:-Number.MAX_VALUE,max:Number.MAX_VALUE,isInteger:!1,rawMin:-Number.MAX_VALUE,rawMax:Number.MAX_VALUE};function Ue(e,n,i){switch(e){case"domain-validation-error::invalid-coded-value":return`Value ${i} is not in the coded domain - field: ${n.name}, domain: ${JSON.stringify(n.domain)}`;case"domain-validation-error::value-out-of-range":return`Value ${i} is out of the range of valid values - field: ${n.name}, domain: ${JSON.stringify(n.domain)}`;case"type-validation-error::invalid-type":return`Value ${i} is not a valid value for the field type - field: ${n.name}, type: ${n.type}, nullable: ${n.nullable}`;case"numeric-range-validation-error::out-of-range":{const{min:e,max:t}=Me(n.type);return`Value ${i} is out of range for the number type - field: ${n.name}, type: ${n.type}, value range is ${e} to ${t}`}}}function qe(e,n){return!ze(e,n,null)}function ze(e,n,i){if(!e?.attributes||!n){if(null!=i)for(const e of n??[])i.add(e);return!0}const t=new Set(Object.keys(e.attributes));let r=!1;for(const l of n)if(!t.has(l)){if(r=!0,null==i)break;i.add(l)}return r}async function Xe(e,n){const i=new Set;for(const t of n)await v(i,e.fieldsIndex,null,t);return Array.from(i).sort()}function Pe(e){return!!e&&["raster.itempixelvalue","raster.servicepixelvalue"].some(n=>e.toLowerCase().startsWith(n))}async function Be(e,n){const i=new Set;return e?.collectRequiredFields&&await e.collectRequiredFields(i,n),Array.from(i).sort()}function Ge(e){const n=e?.match(/{[^}]+}/g);return n?n.map(e=>e.slice(1,-1).split(":")[0].trim()):[]}function Je(e,n){const{statisticType:i,onStatisticField:t,onStatisticExpression:r}=e,l=n.get(t),o=Fe(l),s=r?.returnType;switch(i){case"avg":case"avg_angle":return l?o||Ie(l)?"double":null:s&&"number"===s?"double":null;case"count":return"integer";case"min":case"max":return l?o||he(l)?l?.type??null:null:s&&"number"===s?"double":null;case"sum":return l?o?l?.type??null:null:s&&"number"===s?"double":null;case"mode":return l?l?.type??null:s?"number"===s?"double":"string":null;default:return null}}function We(e){const{fieldName:n,fieldsMap:i,normalizedFieldsMap:t}=e;if(!n)return;let r=i.get(n);return r||(r=i.get(He(n))??t.get(Ke(n)),r&&i.set(n,r),r)}function He(e){return e.trim().toLowerCase()}function Ke(e){return d(e)?.toLowerCase()??""}export{He as applyLowerCaseFieldName,Ce as bigIntegerRange,v as collectArcadeFieldNames,z as collectDisplayFilterFields,L as collectElevationFields,j as collectFeatureReductionFields,x as collectField,w as collectFields,C as collectFilterFields,Z as collectLabelingFields,R as collectOrderByInfos,O as collectPopupTemplateFields,S as collectSQLFieldNames,D as collectTrackInfoFields,ke as doubleRange,Ge as extractSubstitutionTemplatesFromString,qe as featureHasFields,I as fixFields,y as fixRendererFields,F as fixTimeInfoFields,de as floatJSONTypes,ue as floatTypes,Je as getAggregateFieldType,E as getDisplayFieldName,A as getDisplayFieldNameFromFields,J as getEditTrackingFields,N as getElevationFields,Xe as getExpressionFields,U as getFeatureEditFields,q as getFeatureGeometryFields,ie as getFieldDefaultLength,ne as getFieldDefaultValue,We as getFieldFromIndex,Le as getFieldRange,Y as getLabelingFields,G as getLowerCaseDefaultHiddenFields,W as getLowerCaseEditTrackingFields,je as getNumericTypeForValue,Be as getRendererFields,k as getTimeFields,ce as integerJSONTypes,Oe as integerRange,ae as integerTypes,Ie as isDateField,we as isDateOnlyField,K as isFieldEditable,Q as isFieldVisibleByDefault,H as isFieldWithType,Se as isGlobalIDField,ge as isIntegerField,Ne as isNumberInRange,Fe as isNumericField,ve as isObjectIDField,Pe as isRasterPixelValueField,be as isStringField,Te as isTimeOnlyField,xe as isTimestampOffsetField,Ee as isValidFieldValue,se as isValueMatchingFieldType,Ke as lowerCaseNormalizedFieldName,d as normalizeFieldName,fe as numericTypes,h as packFields,ze as populateMissingFields,p as rendererFields,Ae as sanitizeNullFieldValue,$e as sanitizedParseFloat,Ve as singleRange,De as smallIntegerRange,T as unpackFieldNames,_e as validateFieldValue,Ue as validationErrorToString,m as visualVariableFields};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "5.2.0-next.41",
3
+ "version": "5.2.0-next.43",
4
4
  "type": "module",
5
5
  "homepage": "https://js.arcgis.com",
6
6
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
@@ -20,7 +20,7 @@
20
20
  "license": "SEE LICENSE IN LICENSE.md",
21
21
  "dependencies": {
22
22
  "@amcharts/amcharts5": "~5.19.1",
23
- "@arcgis/toolkit": "^5.2.0-next.37",
23
+ "@arcgis/toolkit": "^5.2.0-next.39",
24
24
  "@esri/arcgis-html-sanitizer": "~4.1.0",
25
25
  "@esri/calcite-components": "^5.1.1",
26
26
  "@vaadin/grid": "~25.2.1",
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- const d="20260707",e="d85be58255895c31f500d7e0083d1540332dc9e6";export{d as buildDate,e as commitHash};
2
+ const c="20260709",e="ba71ffbe4ca5cceef16b517d145f14dc50399364";export{c as buildDate,e as commitHash};
@@ -2062,3 +2062,159 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2062
2062
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2063
2063
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2064
2064
  SOFTWARE.
2065
+
2066
+ -----------------------------------------------------------------
2067
+
2068
+ snapdom/
2069
+
2070
+ https://github.com/zumerlab/snapdom
2071
+
2072
+ MIT License
2073
+
2074
+ Copyright (c) 2025 ZumerLab
2075
+
2076
+ Permission is hereby granted, free of charge, to any person obtaining a copy
2077
+ of this software and associated documentation files (the "Software"), to deal
2078
+ in the Software without restriction, including without limitation the rights
2079
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2080
+ copies of the Software, and to permit persons to whom the Software is
2081
+ furnished to do so, subject to the following conditions:
2082
+
2083
+ The above copyright notice and this permission notice shall be included in all
2084
+ copies or substantial portions of the Software.
2085
+
2086
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2087
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2088
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2089
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2090
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2091
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2092
+ SOFTWARE.
2093
+
2094
+ -----------------------------------------------------------------
2095
+
2096
+ d3/d3-shape
2097
+
2098
+ https://github.com/d3/d3-shape
2099
+
2100
+ ISC License
2101
+
2102
+ Copyright 2010-2022 Mike Bostock
2103
+
2104
+ Permission to use, copy, modify, and/or distribute this software for any purpose
2105
+ with or without fee is hereby granted, provided that the above copyright notice
2106
+ and this permission notice appear in all copies.
2107
+
2108
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
2109
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
2110
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
2111
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
2112
+ OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
2113
+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
2114
+ THIS SOFTWARE.
2115
+
2116
+ -----------------------------------------------------------------
2117
+
2118
+ jszip/
2119
+
2120
+ https://github.com/Stuk/jszip
2121
+
2122
+ MIT License
2123
+
2124
+ Copyright (c) 2009-2016 Stuart Knightley, David Duponchel, Franz Buchinger, António Afonso
2125
+
2126
+ Permission is hereby granted, free of charge, to any person obtaining a copy
2127
+ of this software and associated documentation files (the "Software"), to deal
2128
+ in the Software without restriction, including without limitation the rights
2129
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2130
+ copies of the Software, and to permit persons to whom the Software is
2131
+ furnished to do so, subject to the following conditions:
2132
+
2133
+ The above copyright notice and this permission notice shall be included in
2134
+ all copies or substantial portions of the Software.
2135
+
2136
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2137
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2138
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2139
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2140
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2141
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2142
+ THE SOFTWARE.
2143
+
2144
+ -----------------------------------------------------------------
2145
+
2146
+ lodash/
2147
+
2148
+ https://github.com/lodash/lodash
2149
+
2150
+ MIT License
2151
+
2152
+ Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
2153
+
2154
+ Based on Underscore.js, copyright Jeremy Ashkenas,
2155
+ DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
2156
+
2157
+ This software consists of voluntary contributions made by many
2158
+ individuals. For exact contribution history, see the revision history
2159
+ available at https://github.com/lodash/lodash
2160
+
2161
+ The following license applies to all parts of this software except as
2162
+ documented below:
2163
+
2164
+ ====
2165
+
2166
+ Permission is hereby granted, free of charge, to any person obtaining
2167
+ a copy of this software and associated documentation files (the
2168
+ "Software"), to deal in the Software without restriction, including
2169
+ without limitation the rights to use, copy, modify, merge, publish,
2170
+ distribute, sublicense, and/or sell copies of the Software, and to
2171
+ permit persons to whom the Software is furnished to do so, subject to
2172
+ the following conditions:
2173
+
2174
+ The above copyright notice and this permission notice shall be
2175
+ included in all copies or substantial portions of the Software.
2176
+
2177
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
2178
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2179
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
2180
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
2181
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
2182
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
2183
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2184
+
2185
+ ====
2186
+
2187
+ Copyright and related rights for sample code are waived via CC0. Sample
2188
+ code is defined as all source code displayed within the prose of the
2189
+ documentation.
2190
+
2191
+ CC0: http://creativecommons.org/publicdomain/zero/1.0/
2192
+
2193
+ ====
2194
+
2195
+ Files located in the node_modules and vendor directories are externally
2196
+ maintained libraries used by this software which have their own
2197
+ licenses; we recommend you read them, as their terms may differ from the
2198
+ terms above.
2199
+
2200
+ -----------------------------------------------------------------
2201
+
2202
+ simple-statistics/
2203
+
2204
+ https://github.com/simple-statistics/simple-statistics
2205
+
2206
+ ISC License
2207
+
2208
+ Copyright (c) 2014, Tom MacWright
2209
+
2210
+ Permission to use, copy, modify, and/or distribute this software for any
2211
+ purpose with or without fee is hereby granted, provided that the above
2212
+ copyright notice and this permission notice appear in all copies.
2213
+
2214
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
2215
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
2216
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
2217
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
2218
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
2219
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2220
+ PERFORMANCE OF THIS SOFTWARE.
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{distanceToSegmentSquared as t}from"../../../../geometry/support/coordsUtils.js";import{Point as n}from"../../../../geometry/support/TileClipper.js";const r=Number.POSITIVE_INFINITY,o=Math.PI,e=2*o,i=128/o,u=256/360,s=o/180,c=1/Math.LN2;function a(t,n){return(t%=n)>=0?t:t+n}function f(t){return a(t*i,256)}function l(t){return a(t*u,256)}function h(t){return Math.log(t)*c}function m(t){return t*t}function p(t,n,r){return t*(1-r)+n*r}function g(t,n,r){return t>=n&&t<=r||t>=r&&t<=n}const x=8,y=14,M=16;function d(t){return x+Math.max((t-y)*M,0)}function I(t,n,r){let o,e,i,u=0;for(const s of r){o=s.length;for(let r=1;r<o;++r){if(e=s[r-1],i=s[r],e.y>n==i.y>n)continue;(i.x-e.x)*(n-e.y)-(i.y-e.y)*(t-e.x)>0?u++:u--}}return 0!==u}function N(n,r,o,e){let i,u,s,c;const a=e*e;for(const f of o){const o=f.length;if(!(o<2)){i=f[0].x,u=f[0].y;for(let e=1;e<o;++e){if(s=f[e].x,c=f[e].y,t(n,r,i,u,s,c)<a)return!0;i=s,u=c}}}return!1}function w(t,n,r,o,e,i,u){const s=Math.max(o,Math.min(n,i))-n,c=Math.max(e,Math.min(r,u))-r;return s*s+c*c<=t*t}function P(t,r){if(0===r||Number.isNaN(r))return t;const o=[],e=new n(0,0),i=new n(0,0),u=new n(0,0);for(let s=0;s<t.length;s++){const c=t[s],a=[];for(let t=0;t<c.length;t++){const o=c[t-1],s=c[t],f=c[t+1];0===t?e.setCoords(0,0):e.assignSub(s,o).normalize().rightPerpendicular(),t===c.length-1?i.setCoords(0,0):i.assignSub(f,s).normalize().rightPerpendicular(),u.assignAdd(e,i).normalize();const l=u.x*i.x+u.y*i.y;0!==l&&u.scale(1/l),a.push(n.add(s,u.scale(r)))}o.push(a)}return o}function b(t,r,o,e){const i=new n(t[0],t[1]);if(i.scale(e),"viewport"===r){const t=-o*(Math.PI/180),n=Math.cos(t),r=Math.sin(t);i.rotate(n,r)}return i}export{g as between,e as c2pi,u as cDegTo256,s as cDegToRad,r as cInfinity,o as cPi,i as cRadTo256,l as degToByte,N as distanceFromToPolylineWithinThreshold,d as getTileMargins,p as interpolate,w as isCircleOverlapingRect,h as log2,P as offsetLine,I as pointInPolygon,a as positiveMod,f as radToByte,m as sqr,b as translateAnchor};
2
+ import{distanceToSegmentSquared as t}from"../../../../geometry/support/coordsUtils.js";import{Point as n}from"../../../../geometry/support/TileClipper.js";const r=Number.POSITIVE_INFINITY,o=Math.PI,e=2*o,i=128/o,s=256/360,u=o/180,c=1/Math.LN2;function a(t,n){return(t%=n)>=0?t:t+n}function f(t){return a(t*i,256)}function l(t){return a(t*s,256)}function h(t){return Math.log(t)*c}function m(t,n,r){return t*(1-r)+n*r}const p=8,g=14,x=16;function y(t){return p+Math.max((t-g)*x,0)}function M(t,n,r){let o,e,i,s=0;for(const u of r){o=u.length;for(let r=1;r<o;++r){if(e=u[r-1],i=u[r],e.y>n==i.y>n)continue;(i.x-e.x)*(n-e.y)-(i.y-e.y)*(t-e.x)>0?s++:s--}}return 0!==s}function d(n,r,o,e){let i,s,u,c;const a=e*e;for(const f of o){const o=f.length;if(!(o<2)){i=f[0].x,s=f[0].y;for(let e=1;e<o;++e){if(u=f[e].x,c=f[e].y,t(n,r,i,s,u,c)<a)return!0;i=u,s=c}}}return!1}function I(t,n,r,o,e,i,s){const u=Math.max(o,Math.min(n,i))-n,c=Math.max(e,Math.min(r,s))-r;return u*u+c*c<=t*t}function N(t,r){if(0===r||Number.isNaN(r))return t;const o=[],e=new n(0,0),i=new n(0,0),s=new n(0,0);for(let u=0;u<t.length;u++){const c=t[u],a=[];for(let t=0;t<c.length;t++){const o=c[t-1],u=c[t],f=c[t+1];0===t?e.setCoords(0,0):e.assignSub(u,o).normalize().rightPerpendicular(),t===c.length-1?i.setCoords(0,0):i.assignSub(f,u).normalize().rightPerpendicular(),s.assignAdd(e,i).normalize();const l=s.x*i.x+s.y*i.y;0!==l&&s.scale(1/l),a.push(n.add(u,s.scale(r)))}o.push(a)}return o}function w(t,r,o,e){const i=new n(t[0],t[1]);if(i.scale(e),"viewport"===r){const t=-o*(Math.PI/180),n=Math.cos(t),r=Math.sin(t);i.rotate(n,r)}return i}export{e as c2pi,s as cDegTo256,u as cDegToRad,r as cInfinity,o as cPi,i as cRadTo256,l as degToByte,d as distanceFromToPolylineWithinThreshold,y as getTileMargins,m as interpolate,I as isCircleOverlapingRect,h as log2,N as offsetLine,M as pointInPolygon,a as positiveMod,f as radToByte,w as translateAnchor};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../../../core/has.js";import{disposeMaybe as e,destroyMaybe as t}from"../../../../core/maybe.js";import{BitBlitRenderer as s}from"./BitBlitRenderer.js";import{backbufferStencilVisible as r}from"./definitions.js";import i from"./MaterialManager.js";import{RenderingDevice as n}from"./RenderingDevice.js";import o from"./TextureManager.js";import{TextureUploadManager as a}from"./TextureUploadManager.js";import{WorldExtentRenderer as f}from"./WorldExtentClipRenderer.js";import{BlendEffect as h}from"./effects/BlendEffect.js";import{FeatureEffect as l}from"./effects/FeatureEffect.js";import c from"./effects/HighlightEffect.js";import{HittestEffect as d}from"./effects/HittestEffect.js";import{EffectManager as u}from"./effects/post-processing/EffectManager.js";import{SimpleMesh as p}from"./meshing/SimpleMesh.js";import{SizedDepthStencilFormat as b}from"../../../webgl/enums.js";import{DisposableFramebufferObject as g}from"../../../webgl/FramebufferObject.js";import{Renderbuffer as _}from"../../../webgl/Renderbuffer.js";import{RenderbufferDescriptor as m}from"../../../webgl/RenderbufferDescriptor.js";import{TextureDescriptor as w}from"../../../webgl/TextureDescriptor.js";class M{constructor(e,t){this.context=e,this._blitRenderer=new s,this._worldExtentRenderer=new f,this._lastWidth=null,this._lastHeight=null,this._blendEffect=new h,this._stencilBuf=null,this._prevBeforeLayerFBOStack=[],this._fboPool=[],this.effects={highlight:new c,hittest:new d,insideEffect:new l("inside"),outsideEffect:new l("outside")},this.materialManager=new i(e),this.textureManager=new o(t),this.textureUploadManager=new a(t),this._effectsManager=new u,this._quadMesh=p.fromVertexStream(e,[0,0,1,0,0,1,1,1]),this._renderingDevice=new n}dispose(){if(this.materialManager.dispose(),this.textureManager.dispose(),this.textureUploadManager.destroy(),this._blitRenderer=e(this._blitRenderer),this._worldExtentRenderer=e(this._worldExtentRenderer),this._quadMesh=t(this._quadMesh),this._fbos){let e;for(e in this._fbos)this._fbos[e]&&this._fbos[e].dispose()}for(const e of this._fboPool)e.dispose();if(this._fboPool.length=0,this.effects){let e;for(e in this.effects)this.effects[e]&&this.effects[e].dispose()}this._effectsManager.dispose(),this._blendEffect.dispose(this.context),this._renderingDevice.dispose()}get blitRenderer(){return this._blitRenderer}get quadMesh(){return this._quadMesh}getFbos(){if(!this._fbos)throw new Error("InternalError: Painter FBOs not initialized");return this._fbos}acquireFbo(e,t){let s;if(this._fboPool.length>0)s=this._fboPool.pop();else{const r=new w(e,t);r.samplingMode=9728,r.wrapMode=33071,s=new g(this.context,r,this._stencilBuf)}return s.width===e&&s.height===t||s.resize(e,t),s}releaseFbo(e){this._fboPool.push(e)}getSharedStencilBuffer(){return this._stencilBuf}beforeRenderPhases(e,t,s){const{context:r}=e;this._worldExtentRenderer.render(e,t,s);const{width:i,height:n}=r.getViewport();if(this.updateFBOs(i,n),this._prevFBO=r.boundFramebuffer,r.bindFramebuffer(this.getFbos().output),r.setColorMask(!0,!0,!0,!0),null!=t){const{r:e,g:s,b:i,a:n}=t;r.setClearColor(n*e/255,n*s/255,n*i/255,n)}else r.setClearColor(0,0,0,0);r.setDepthWriteEnabled(!0),r.setClearDepth(1),r.clear(16640),r.setDepthWriteEnabled(!1)}afterRenderPhases(e){const{context:t}=e;t.bindFramebuffer(this._prevFBO),t.setStencilFunction(514,r,255),t.setStencilTestEnabled(!0),t.setDepthTestEnabled(!1),this.blitTexture(t,this.getFbos().output.colorTexture,9728)}beforeRenderLayer(e,t,s){const{context:r,blendMode:i,effects:n,drawPhase:o,requireFBO:a}=e;if(r.setClearColor(0,0,0,0),a||E(o,i,n,s)){const e=r.boundFramebuffer;this._prevBeforeLayerFBOStack.push(e);const{width:t,height:s}=r.getViewport(),i=this.acquireFbo(t,s);r.bindFramebuffer(i),r.setColorMask(!0,!0,!0,!0),r.setClearColor(0,0,0,0),r.setDepthWriteEnabled(!0),r.setClearDepth(1),r.clear(16640),r.setDepthWriteEnabled(!1)}r.setDepthWriteEnabled(!1),r.setDepthTestEnabled(!1),r.setStencilTestEnabled(!0),r.setClearStencil(t),r.setStencilWriteMask(255),r.clear(1024)}afterRenderLayer(e,t){const{context:s,blendMode:r,effects:i,requireFBO:n,drawPhase:o}=e;if(n||E(o,r,i,t)){const n=s.boundFramebuffer;if(null==n)return;null!=i&&i.length>0&&1===o&&(s.setColorMask(!0,!0,!0,!0),this._applyEffects(e,i,n)),s.bindFramebuffer(this._prevBeforeLayerFBOStack.pop()),s.setStencilTestEnabled(!1),s.setStencilWriteMask(0),s.setBlendingEnabled(!0),s.setBlendFunctionSeparate(1,771,1,771),s.setColorMask(!0,!0,!0,!0);const a=null==r||16===o||2===o||128===o?"normal":r;this._blendEffect.draw(e,n.colorTexture,9728,a,t),this.releaseFbo(n)}}blitTexture(e,t,s,r=1){e.setBlendingEnabled(!0),e.setBlendFunctionSeparate(1,771,1,771),e.setColorMask(!0,!0,!0,!0),this._blitRenderer.render(e,t,s,r),this._renderingDevice.setPipelineStateNeedsUpdate(!0)}getPostProcessingEffects(e){return this._effectsManager.getPostProcessingEffects(e)}updateFBOs(e,t){if(e!==this._lastWidth||t!==this._lastHeight){if(this._lastWidth=e,this._lastHeight=t,this._fbos){let s;for(s in this._fbos)this._fbos[s].resize(e,t);return}const s=new w(e,t);s.samplingMode=9728,s.wrapMode=33071;const r=new m(b.DEPTH24_STENCIL8,e,t);this._stencilBuf=new _(this.context,r),this._fbos={output:new g(this.context,s,this._stencilBuf),effect0:new g(this.context,s,this._stencilBuf)}}}_applyEffects(e,t,s){const{context:r}=e,i=this._effectsManager.getPostProcessingEffects(t);for(const{postProcessingTechnique:n,effect:o}of i)r.bindFramebuffer(s),n.render(e,{layerFBO:s,effect:o});this._renderingDevice.setPipelineStateNeedsUpdate(!0)}setShader(e){return this._renderingDevice.setShader(e)}clearShaderCache(){this._renderingDevice.clearShaderCache()}getProgramCache(){return this._renderingDevice.getProgramCache()}setPipelineState(e){return this._renderingDevice.setPipelineState(e)}getPipelineState(){return this._renderingDevice.getPipelineState()}submitDraw(e,t,s){return this._renderingDevice.submitDraw(e,t,s)}submitDrawMesh(e,t,s,r){this._renderingDevice.submitDrawMesh(e,t,s,r)}submitDrawMeshUntyped(e,t,s,r){this._renderingDevice.submitDrawMeshUntyped(e,t,s,r)}updatePipelineState(e){return this._renderingDevice.updatePipelineState(e)}setStencilRef(e,t){return this._renderingDevice.setStencilRef(e,t)}}function E(e,t,s,r){return 4!==e&&2!==e&&16!==e&&128!==e&&(1!==r||null!=t&&"normal"!==t||null!=s&&s.length>0)}export{M as default};
2
+ import"../../../../core/has.js";import{destroyMaybe as e}from"../../../../core/maybe.js";import t from"./MaterialManager.js";import{RenderingDevice as s}from"./RenderingDevice.js";import i from"./TextureManager.js";import{TextureUploadManager as r}from"./TextureUploadManager.js";import{BlendEffect as n}from"./effects/BlendEffect.js";import{FeatureEffect as o}from"./effects/FeatureEffect.js";import a from"./effects/HighlightEffect.js";import{HittestEffect as h}from"./effects/HittestEffect.js";import{EffectManager as f}from"./effects/post-processing/EffectManager.js";import{SimpleMesh as l}from"./meshing/SimpleMesh.js";import{BitBlitTechnique as c}from"./shaderGraph/techniques/utility/BitBlitTechnique.js";import{WorldExtentClipTechnique as d}from"./shaderGraph/techniques/utility/WorldExtentClipTechnique.js";import{SizedDepthStencilFormat as u}from"../../../webgl/enums.js";import{DisposableFramebufferObject as p}from"../../../webgl/FramebufferObject.js";import{Renderbuffer as g}from"../../../webgl/Renderbuffer.js";import{RenderbufferDescriptor as b}from"../../../webgl/RenderbufferDescriptor.js";import{TextureDescriptor as _}from"../../../webgl/TextureDescriptor.js";class m{constructor(e,u){this.context=e,this._blitTechnique=new c,this._worldExtentClipTechnique=new d,this._lastWidth=null,this._lastHeight=null,this._blendEffect=new n,this._stencilBuf=null,this._prevBeforeLayerFBOStack=[],this._fboPool=[],this.effects={highlight:new a,hittest:new h,insideEffect:new o("inside"),outsideEffect:new o("outside")},this.materialManager=new t(e),this.textureManager=new i(u),this.textureUploadManager=new r(u),this._effectsManager=new f,this._quadMesh=l.fromVertexStream(e,[0,0,1,0,0,1,1,1]),this._renderingDevice=new s}dispose(){if(this.materialManager.dispose(),this.textureManager.dispose(),this.textureUploadManager.destroy(),this._blitTechnique.shutdown(),this._worldExtentClipTechnique.shutdown(),this._quadMesh=e(this._quadMesh),this._fbos){let e;for(e in this._fbos)this._fbos[e]&&this._fbos[e].dispose()}for(const e of this._fboPool)e.dispose();if(this._fboPool.length=0,this.effects){let e;for(e in this.effects)this.effects[e]&&this.effects[e].dispose()}this._effectsManager.dispose(),this._blendEffect.dispose(this.context),this._renderingDevice.dispose()}get quadMesh(){return this._quadMesh}getFbos(){if(!this._fbos)throw new Error("InternalError: Painter FBOs not initialized");return this._fbos}acquireFbo(e,t){let s;if(this._fboPool.length>0)s=this._fboPool.pop();else{const i=new _(e,t);i.samplingMode=9728,i.wrapMode=33071,s=new p(this.context,i,this._stencilBuf)}return s.width===e&&s.height===t||s.resize(e,t),s}releaseFbo(e){this._fboPool.push(e)}getSharedStencilBuffer(){return this._stencilBuf}beforeRenderPhases(e,t,s){const{context:i}=e;this._worldExtentClipTechnique.render(e,{backgroundColor:t,padding:s});const{width:r,height:n}=i.getViewport();if(this.updateFBOs(r,n),this._prevFBO=i.boundFramebuffer,i.bindFramebuffer(this.getFbos().output),i.setColorMask(!0,!0,!0,!0),null!=t){const{r:e,g:s,b:r,a:n}=t;i.setClearColor(n*e/255,n*s/255,n*r/255,n)}else i.setClearColor(0,0,0,0);i.setDepthWriteEnabled(!0),i.setClearDepth(1),i.clear(16640),i.setDepthWriteEnabled(!1)}afterRenderPhases(e){const{context:t}=e;t.bindFramebuffer(this._prevFBO),this._blitTechnique.render(e,{texture:this.getFbos().output.colorTexture,samplingMode:9728,opacity:1,clipToVisibleRegion:!0}),this._renderingDevice.setPipelineStateNeedsUpdate(!0)}beforeRenderLayer(e,t,s){const{context:i,blendMode:r,effects:n,drawPhase:o,requireFBO:a}=e;if(i.setClearColor(0,0,0,0),a||w(o,r,n,s)){const e=i.boundFramebuffer;this._prevBeforeLayerFBOStack.push(e);const{width:t,height:s}=i.getViewport(),r=this.acquireFbo(t,s);i.bindFramebuffer(r),i.setColorMask(!0,!0,!0,!0),i.setClearColor(0,0,0,0),i.setDepthWriteEnabled(!0),i.setClearDepth(1),i.clear(16640),i.setDepthWriteEnabled(!1)}i.setDepthWriteEnabled(!1),i.setDepthTestEnabled(!1),i.setStencilTestEnabled(!0),i.setClearStencil(t),i.setStencilWriteMask(255),i.clear(1024)}afterRenderLayer(e,t){const{context:s,blendMode:i,effects:r,requireFBO:n,drawPhase:o}=e;if(n||w(o,i,r,t)){const n=s.boundFramebuffer;if(null==n)return;null!=r&&r.length>0&&1===o&&(s.setColorMask(!0,!0,!0,!0),this._applyEffects(e,r,n)),s.bindFramebuffer(this._prevBeforeLayerFBOStack.pop()),s.setStencilTestEnabled(!1),s.setStencilWriteMask(0),s.setBlendingEnabled(!0),s.setBlendFunctionSeparate(1,771,1,771),s.setColorMask(!0,!0,!0,!0);const a=null==i||16===o||2===o||128===o?"normal":i;this._blendEffect.draw(e,n.colorTexture,9728,a,t),this.releaseFbo(n)}}blitTexture(e,t,s,i=1){this._blitTechnique.render(e,{texture:t,samplingMode:s,opacity:i}),this._renderingDevice.setPipelineStateNeedsUpdate(!0)}getPostProcessingEffects(e){return this._effectsManager.getPostProcessingEffects(e)}updateFBOs(e,t){if(e!==this._lastWidth||t!==this._lastHeight){if(this._lastWidth=e,this._lastHeight=t,this._fbos){let s;for(s in this._fbos)this._fbos[s].resize(e,t);return}const s=new _(e,t);s.samplingMode=9728,s.wrapMode=33071;const i=new b(u.DEPTH24_STENCIL8,e,t);this._stencilBuf=new g(this.context,i),this._fbos={output:new p(this.context,s,this._stencilBuf),effect0:new p(this.context,s,this._stencilBuf)}}}_applyEffects(e,t,s){const{context:i}=e,r=this._effectsManager.getPostProcessingEffects(t);for(const{postProcessingTechnique:n,effect:o}of r)i.bindFramebuffer(s),n.render(e,{layerFBO:s,effect:o});this._renderingDevice.setPipelineStateNeedsUpdate(!0)}setShader(e){return this._renderingDevice.setShader(e)}clearShaderCache(){this._renderingDevice.clearShaderCache()}getProgramCache(){return this._renderingDevice.getProgramCache()}setPipelineState(e){return this._renderingDevice.setPipelineState(e)}getPipelineState(){return this._renderingDevice.getPipelineState()}submitDraw(e,t,s){return this._renderingDevice.submitDraw(e,t,s)}submitDrawMesh(e,t,s,i){this._renderingDevice.submitDrawMesh(e,t,s,i)}submitDrawMeshUntyped(e,t,s,i){this._renderingDevice.submitDrawMeshUntyped(e,t,s,i)}updatePipelineState(e){return this._renderingDevice.updatePipelineState(e)}setStencilRef(e,t){return this._renderingDevice.setStencilRef(e,t)}}function w(e,t,s,i){return 4!==e&&2!==e&&16!==e&&128!==e&&(1!==i||null!=t&&"normal"!==t||null!=s&&s.length>0)}export{m as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../../../core/has.js";import"../../../../core/Logger.js";import{TechniqueProgramCache as e}from"./shaderGraph/techniques/TechniqueProgramCache.js";class t{constructor(){this._currentPipelineStateNeedsUpdate=!1,this._programCache=new e}dispose(){this._programCache.destroy()}clearShaderCache(){this._programCache.destroy(),this._programCache=new e}setShader(e){return this._shaderState={shader:e.shader,uniforms:e.uniforms,textures:e.textures,defines:e.defines,optionalAttributes:e.optionalAttributes,useComputeBuffer:e.useComputeBuffer??!1},this._shaderState}setPipelineState(e){e!==this._currentPipelineState&&(this._currentPipelineState=e,this._currentPipelineStateNeedsUpdate=!0)}updatePipelineState(e){this._currentPipelineStateNeedsUpdate&&(this._currentPipelineStateNeedsUpdate=!1,this._updatePipelineState(e))}getPipelineState(){return this._currentPipelineState}setStencilRef(e,t){if(null==this._currentPipelineState)throw new Error("Pipeline state not defined. Call setPipelineState before calling submitDraw ");const{stencil:s}=this._currentPipelineState;if(s){const{test:r}=s;if(r){const{compare:s,mask:i}=r;if(null==t)throw new Error("InternalError: Stencil reference expected for target but not defined");e.setStencilFunctionSeparate(1032,s,t,i)}}}setPipelineStateNeedsUpdate(e){this._currentPipelineStateNeedsUpdate=e}getShaderState(){return this._shaderState}getProgramCache(){return this._programCache}submitDraw(e,t,s){let r=s?.stencilRef;if(!this._shaderState)return null;const{shader:i,uniforms:n,textures:a,defines:l,optionalAttributes:o}=this._shaderState,c=e.context,d=t.getAttributePrecisionPackFactors(),p=this._programCache.getProgram(i,d,n,a??{},l??{},o??{});if(p.setUniforms(n),p.setTextures(a),p.bind(c),this.updatePipelineState(c),null==r){const e=t.getStencilReference();null!=e&&(r=e)}return null!=r&&this.setStencilRef(c,r),t.draw(e,i.locationInfo),p.cleanupTemporaryTextures(),{vertexShader:p.vertexShader,fragmentShader:p.fragmentShader}}submitDrawMesh(e,t,s,r){this.submitDrawMeshUntyped(e,t,s,r)}submitDrawMeshUntyped(e,t,s,r){const i=r?.parts,n=r?.stencilRef,{precisionFactors:a,materialKey:l}=t,{shader:o,uniforms:c,textures:d,defines:p,optionalAttributes:h}=this.setShader(t),u=this._programCache.getProgram(o,a||{},c,d??{},p??{},h??{},l);if(u.setUniforms(c),u.setTextures(d),u.bind(e),this.updatePipelineState(e),this.setStencilRef(e,n),i)for(const S of i)s.bind(e,t.shader.locationInfo,S),s.draw(e);else for(let S=0;S<s.parts.length;S++)s.bind(e,t.shader.locationInfo,S),s.draw(e);s.unbind(e),u.cleanupTemporaryTextures()}_updatePipelineState(e){if(null==this._currentPipelineState)throw new Error("Pipeline state not defined. Call setPipelineState before calling submitDraw ");const{color:t,depth:s,stencil:r}=this._currentPipelineState;if(t){const{blendMode:s,write:r}=t;switch(e.setColorMask(...r),e.setBlendingEnabled("none"!==s),e.setBlendEquation(32774),s){case"composite":e.setBlendFunctionSeparate(1,771,1,771);break;case"additive":e.setBlendFunctionSeparate(1,1,1,1);break;case"custom":{const{blendParameters:s,blendEquation:r}=t,{dstAlpha:i,dstRGB:n,srcAlpha:a,srcRGB:l}=s;r&&e.setBlendEquation(r),e.setBlendFunctionSeparate(l,n,a,i);break}case"delete":e.setBlendEquation(32779),e.setBlendFunctionSeparate(1,771,1,771);break;case"none":e.setBlendingEnabled(!1)}}else e.setColorMask(!1,!1,!1,!1);if(s){const{test:t,write:r}=s;r?(e.setDepthWriteEnabled(!0),e.setDepthRange(r.zNear,r.zFar)):e.setDepthWriteEnabled(!1),t?(e.setDepthTestEnabled(!0),e.setDepthFunction(t)):e.setDepthTestEnabled(!1)}else e.setDepthTestEnabled(!1),e.setDepthWriteEnabled(!1);if(r){const{test:t,write:s}=r;if(t){const{op:s}=t;e.setStencilTestEnabled(!0),e.setStencilOpSeparate(1032,s.fail,s.zFail,s.zPass)}else e.setStencilTestEnabled(!1);if(s){const{mask:t}=s;e.setStencilWriteMask(t)}else e.setStencilWriteMask(0)}else e.setStencilTestEnabled(!1),e.setStencilWriteMask(0)}}export{t as RenderingDevice};
2
+ import"../../../../core/has.js";import"../../../../core/Logger.js";import{TechniqueProgramCache as e}from"./shaderGraph/techniques/TechniqueProgramCache.js";class t{constructor(){this._currentPipelineStateNeedsUpdate=!1,this._programCache=new e}dispose(){this._programCache.destroy()}clearShaderCache(){this._programCache.destroy(),this._programCache=new e}setShader(e){return this._shaderState={shader:e.shader,uniforms:e.uniforms,textures:e.textures,defines:e.defines,optionalAttributes:e.optionalAttributes,useComputeBuffer:e.useComputeBuffer??!1},this._shaderState}setPipelineState(e){e!==this._currentPipelineState&&(this._currentPipelineState=e,this._currentPipelineStateNeedsUpdate=!0)}updatePipelineState(e){this._currentPipelineStateNeedsUpdate&&(this._currentPipelineStateNeedsUpdate=!1,this._updatePipelineState(e))}getPipelineState(){return this._currentPipelineState}setStencilRef(e,t){if(null==this._currentPipelineState)throw new Error("Pipeline state not defined. Call setPipelineState before calling submitDraw ");const{stencil:s}=this._currentPipelineState;if(s){const{test:r}=s;if(r){const{compare:s,mask:i}=r;if(null==t)throw new Error("InternalError: Stencil reference expected for target but not defined");e.setStencilFunctionSeparate(1032,s,t,i)}}}setPipelineStateNeedsUpdate(e){this._currentPipelineStateNeedsUpdate=e}getShaderState(){return this._shaderState}getProgramCache(){return this._programCache}submitDraw(e,t,s){let r=s?.stencilRef;if(!this._shaderState)return null;const{shader:i,uniforms:n,textures:a,defines:l,optionalAttributes:o}=this._shaderState,c=e.context,d=t.getAttributePrecisionPackFactors(),p=this._programCache.getProgram(i,d,n,a??{},l??{},o??{});if(p.setUniforms(n),p.setTextures(a),p.bind(c),this.updatePipelineState(c),null==r){const e=t.getStencilReference();null!=e&&(r=e)}return null!=r&&this.setStencilRef(c,r),t.draw(e,i.locationInfo),p.cleanupTemporaryTextures(),{vertexShader:p.vertexShader,fragmentShader:p.fragmentShader}}submitDrawMesh(e,t,s,r){this.submitDrawMeshUntyped(e,t,s,r)}submitDrawMeshUntyped(e,t,s,r){const i=r?.parts,n=r?.stencilRef,{precisionFactors:a,materialKey:l}=t,{shader:o,uniforms:c,textures:d,defines:p,optionalAttributes:h}=this.setShader(t),u=this._programCache.getProgram(o,a||{},c,d??{},p??{},h??{},l);if(u.setUniforms(c),u.setTextures(d),u.bind(e),this.updatePipelineState(e),this.setStencilRef(e,n),i)for(const S of i)s.bind(e,t.shader.locationInfo,S),s.draw(e);else for(let S=0;S<s.parts.length;S++)s.bind(e,t.shader.locationInfo,S),s.draw(e);s.unbind(e),u.cleanupTemporaryTextures()}_updatePipelineState(e){if(null==this._currentPipelineState)throw new Error("Pipeline state not defined. Call setPipelineState before calling submitDraw ");const{color:t,depth:s,stencil:r}=this._currentPipelineState;if(t){const{blendMode:s,write:r}=t;switch(e.setColorMask(...r),e.setBlendingEnabled("none"!==s),e.setBlendEquation(32774),s){case"composite":e.setBlendFunctionSeparate(1,771,1,771);break;case"additive":e.setBlendFunctionSeparate(1,1,1,1);break;case"custom":{const{blendParameters:s,blendEquation:r}=t,{dstAlpha:i,dstRGB:n,srcAlpha:a,srcRGB:l}=s;e.setBlendEquation(r),e.setBlendFunctionSeparate(l,n,a,i);break}case"delete":e.setBlendEquation(32779),e.setBlendFunctionSeparate(1,771,1,771);break;case"none":e.setBlendingEnabled(!1)}}else e.setColorMask(!1,!1,!1,!1);if(s){const{test:t,write:r}=s;r?(e.setDepthWriteEnabled(!0),e.setDepthRange(r.zNear,r.zFar)):e.setDepthWriteEnabled(!1),t?(e.setDepthTestEnabled(!0),e.setDepthFunction(t)):e.setDepthTestEnabled(!1)}else e.setDepthTestEnabled(!1),e.setDepthWriteEnabled(!1);if(r){const{test:t,write:s}=r;if(t){const{op:s}=t;e.setStencilTestEnabled(!0),e.setStencilOpSeparate(1032,s.fail,s.zFail,s.zPass)}else e.setStencilTestEnabled(!1);if(s){const{mask:t}=s;e.setStencilWriteMask(t)}else e.setStencilWriteMask(0)}else e.setStencilTestEnabled(!1),e.setStencilWriteMask(0)}}export{t as RenderingDevice};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{Effect as e}from"./Effect.js";class t extends e{constructor(e){super(),this.name=this.constructor.name,this.defines=[e]}dispose(){}bind({context:e,painter:t}){this._prev=e.boundFramebuffer;const r=t.getFbos().effect0;e.bindFramebuffer(r),e.setColorMask(!0,!0,!0,!0),e.setClearColor(0,0,0,0),e.clear(16384)}unbind(){}draw(e,t){const{context:r,painter:s}=e,n=s.getPostProcessingEffects(t),o=r.boundFramebuffer;if(o){for(const{postProcessingTechnique:t,effect:r}of n)t.render(e,{layerFBO:o,effect:r});r.bindFramebuffer(this._prev),r.setStencilTestEnabled(!1),s.blitTexture(r,o.colorTexture,9728),r.setStencilTestEnabled(!0)}}}export{t as FeatureEffect};
2
+ import{Effect as e}from"./Effect.js";class t extends e{constructor(e){super(),this.name=this.constructor.name,this.defines=[e]}dispose(){}bind({context:e,painter:t}){this._prev=e.boundFramebuffer;const r=t.getFbos().effect0;e.bindFramebuffer(r),e.setColorMask(!0,!0,!0,!0),e.setClearColor(0,0,0,0),e.clear(16384)}unbind(){}draw(e,t){const{context:r,painter:s}=e,n=s.getPostProcessingEffects(t),o=r.boundFramebuffer;if(o){for(const{postProcessingTechnique:t,effect:r}of n)t.render(e,{layerFBO:o,effect:r});r.bindFramebuffer(this._prev),r.setStencilTestEnabled(!1),s.blitTexture(e,o.colorTexture,9728),r.setStencilTestEnabled(!0)}}}export{t as FeatureEffect};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../../../../core/has.js";import{BitBlitRenderer as e}from"../BitBlitRenderer.js";import{Effect as t}from"./Effect.js";import s from"./highlight/HighlightRenderer.js";import r from"./highlight/HighlightSurfaces.js";const i=4,h=4/i;class d extends t{constructor(){super(...arguments),this.defines=["highlight"],this._hlRenderer=new s,this._width=void 0,this._height=void 0,this._hlSurfaces=new r,this._adjustedWidth=void 0,this._adjustedHeight=void 0,this._blitRenderer=new e}dispose(){this._hlSurfaces?.dispose(),this._hlRenderer?.dispose(),this._boundFBO=null}bind(e){const{context:t,painter:s}=e,{width:r,height:i}=t.getViewport(),h=s.getFbos().effect0;this.setup(e,r,i),t.bindFramebuffer(h),t.setColorMask(!0,!0,!0,!0),t.setClearColor(0,0,0,0),t.clear(16384)}unbind(){}setup({context:e},t,s){this._width=t,this._height=s;const r=t%i,d=s%i;t+=r<i/2?-r:i-r,s+=d<i/2?-d:i-d,this._adjustedWidth=t,this._adjustedHeight=s,this._boundFBO=e.boundFramebuffer;const l=Math.round(t*h),o=Math.round(s*h);this._hlRenderer.setup(e,l,o),this._hlSurfaces.setup(e,l,o)}draw(e){const{context:t,passOptions:s}=e,r=s.activeGradient,i=t.boundFramebuffer;t.setViewport(0,0,this._adjustedWidth*h,this._adjustedHeight*h),t.bindFramebuffer(this._hlSurfaces.sharedBlur1Fbo),t.setStencilTestEnabled(!1),t.setClearColor(0,0,0,0),t.clear(16384),this._blitRenderer.render(t,i?.colorTexture,9728,1),t.setStencilTestEnabled(!1),t.setBlendingEnabled(!1),t.setColorMask(!1,!1,!1,!0),t.bindFramebuffer(this._hlSurfaces.sharedBlur2Fbo),t.setClearColor(0,0,0,0),t.clear(16384),this._hlRenderer.preBlur(t,this._hlSurfaces.sharedBlur1Tex),t.bindFramebuffer(this._hlSurfaces.sharedBlur1Fbo),t.setClearColor(0,0,0,0),t.clear(16384),this._hlRenderer.finalBlur(t,this._hlSurfaces.sharedBlur2Tex),t.bindFramebuffer(this._boundFBO),t.setBlendingEnabled(!0),t.setColorMask(!0,!0,!0,!0),t.setViewport(0,0,this._width,this._height),this._hlRenderer.renderHighlight(t,this._hlSurfaces.sharedBlur1Tex,r),this._boundFBO=null}}export{d as default};
2
+ import{Effect as t}from"./Effect.js";import h from"./highlight/HighlightSurfaces.js";import{HighlightTechnique as i}from"../shaderGraph/techniques/utility/HighlightTechnique.js";const e=4,s=4/e;class r extends t{constructor(){super(...arguments),this.defines=["highlight"],this._hlTechnique=new i,this._width=void 0,this._height=void 0,this._hlSurfaces=new h,this._adjustedWidth=void 0,this._adjustedHeight=void 0,this._highlightWidth=void 0,this._highlightHeight=void 0}dispose(){this._hlSurfaces?.dispose(),this._hlTechnique.shutdown(),this._boundFBO=null}bind(t){const{context:h,painter:i}=t,{width:e,height:s}=h.getViewport(),r=i.getFbos().effect0;this.setup(t,e,s),h.bindFramebuffer(r),h.setColorMask(!0,!0,!0,!0),h.setClearColor(0,0,0,0),h.clear(16384)}unbind(){}setup({context:t},h,i){this._width=h,this._height=i;const r=h%e,o=i%e;h+=r<e/2?-r:e-r,i+=o<e/2?-o:e-o,this._adjustedWidth=h,this._adjustedHeight=i,this._boundFBO=t.boundFramebuffer;const u=Math.round(h*s),d=Math.round(i*s);this._highlightWidth=u,this._highlightHeight=d,this._hlSurfaces.setup(t,u,d)}draw(t){const{context:h,passOptions:i}=t,e=i.activeGradient,r=h.boundFramebuffer,o=[0,0,this._adjustedWidth*s,this._adjustedHeight*s];if(null==r?.colorTexture)throw new Error("InternalError: Highlight source framebuffer is missing a color texture");h.bindFramebuffer(this._hlSurfaces.sharedBlur1Fbo),h.setViewport(...o),h.setColorMask(!0,!0,!0,!0),h.setClearColor(0,0,0,0),h.clear(16384),this._hlTechnique.render(t,{sourceTexture:r.colorTexture,maskFbo:this._hlSurfaces.sharedBlur1Fbo,maskTexture:this._hlSurfaces.sharedBlur1Tex,partialMapFbo:this._hlSurfaces.sharedBlur2Fbo,partialMapTexture:this._hlSurfaces.sharedBlur2Tex,highlightWidth:this._highlightWidth,highlightHeight:this._highlightHeight,highlightViewport:o,outputTarget:this._boundFBO,outputViewport:[0,0,this._width,this._height],gradient:e}),this._boundFBO=null}}export{r as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import o from"../../../../../../core/Logger.js";import{textureBindingHighlight1 as i,maxHighlightReasons as t}from"../../definitions.js";import{shadeTextureSize as e,sigma as l}from"./parameters.js";import r from"../../../../../support/HighlightOptions.js";import h from"../../../../../webgl/Texture.js";import{TextureDescriptor as n}from"../../../../../webgl/TextureDescriptor.js";const s=()=>o.getLogger("esri.views.2d.engine.webgl.painter.highlight.HighlightGradient");function a(o,i){i.fillColor[0]=o.color.r/255,i.fillColor[1]=o.color.g/255,i.fillColor[2]=o.color.b/255,i.fillColor[3]=o.color.a,o.haloColor?(i.outlineColor[0]=o.haloColor.r/255,i.outlineColor[1]=o.haloColor.g/255,i.outlineColor[2]=o.haloColor.b/255,i.outlineColor[3]=o.haloColor.a):(i.outlineColor[0]=i.fillColor[0],i.outlineColor[1]=i.fillColor[1],i.outlineColor[2]=i.fillColor[2],i.outlineColor[3]=i.fillColor[3]),i.fillColor[3]*=o.fillOpacity,i.outlineColor[3]*=o.haloOpacity,i.fillColor[0]*=i.fillColor[3],i.fillColor[1]*=i.fillColor[3],i.fillColor[2]*=i.fillColor[3],i.outlineColor[0]*=i.outlineColor[3],i.outlineColor[1]*=i.outlineColor[3],i.outlineColor[2]*=i.outlineColor[3],i.outlineWidth=(1-o.haloBlur)*o.haloWidth,i.outerHaloWidth=o.haloBlur*o.haloWidth/2,i.innerHaloWidth=o.haloBlur*o.haloWidth/2,i.outlinePosition=0}const u=[0,0,0,0];class d{constructor(){this.type="single",this._highlightOptions=new r,this._convertedHighlightOptions={fillColor:[0,0,0,0],outlineColor:[0,0,0,0],outlinePosition:0,outlineWidth:0,innerHaloWidth:0,outerHaloWidth:0},this._optionsShadeTexKey="",this._texelData=new Uint8Array(4*e),this._minMaxDistance=[0,0]}setHighlightOptions(o){this._highlightOptions=o}applyHighlightOptions(o,t){this._updateGradientTexture(o),o.bindTexture(this._shadeTex,i),t.setUniform2fv("u_minMaxDistance",this._minMaxDistance)}destroy(){this._shadeTex?.dispose(),this._shadeTex=null}getReasonsWithGradients(){return[{activeReasons:(1<<t)-1,activeGradient:this}]}_updateGradientTexture(o){const i=g(this._highlightOptions);if(i===this._optionsShadeTexKey)return;this._optionsShadeTexKey=i,a(this._highlightOptions,this._convertedHighlightOptions);const t=this._convertedHighlightOptions,r=t.outlinePosition-t.outlineWidth/2-t.outerHaloWidth,d=t.outlinePosition-t.outlineWidth/2,f=t.outlinePosition+t.outlineWidth/2,p=t.outlinePosition+t.outlineWidth/2+t.innerHaloWidth,C=Math.sqrt(Math.PI/2)*l,c=Math.abs(r)>C?Math.round(10*(Math.abs(r)-C))/10:0,m=Math.abs(p)>C?Math.round(10*(Math.abs(p)-C))/10:0;let x;c&&!m?s().error("The outer rim of the highlight is "+c+"px away from the edge of the feature; consider reducing some width values or shifting the outline position towards positive values (inwards)."):!c&&m?s().error("The inner rim of the highlight is "+m+"px away from the edge of the feature; consider reducing some width values or shifting the outline position towards negative values (outwards)."):c&&m&&s().error("The highlight is "+Math.max(c,m)+"px away from the edge of the feature; consider reducing some width values.");const _=[void 0,void 0,void 0,void 0];function w(o,i,t){_[0]=(1-t)*o[0]+t*i[0],_[1]=(1-t)*o[1]+t*i[1],_[2]=(1-t)*o[2]+t*i[2],_[3]=(1-t)*o[3]+t*i[3]}const{_texelData:v}=this;for(let l=0;l<e;++l)x=r+l/(e-1)*(p-r),x<r?(_[0]=0,_[1]=0,_[2]=0,_[3]=0):x<d?w(u,t.outlineColor,(x-r)/(d-r)):x<f?[_[0],_[1],_[2],_[3]]=t.outlineColor:x<p?w(t.outlineColor,t.fillColor,(x-f)/(p-f)):[_[0],_[1],_[2],_[3]]=t.fillColor,v[4*l]=255*_[0],v[4*l+1]=255*_[1],v[4*l+2]=255*_[2],v[4*l+3]=255*_[3];if(this._minMaxDistance[0]=r,this._minMaxDistance[1]=p,!this._shadeTex){const i=new n(e,1);i.wrapMode=33071,this._shadeTex=new h(o,i)}this._shadeTex.updateData(0,0,0,e,1,this._texelData)}}function g(o){return`${o.color};${o.haloColor};${o.haloOpacity};${o.fillOpacity};${o.haloWidth};${o.haloBlur}`}export{d as default};
2
+ import o from"../../../../../../core/Logger.js";import{maxHighlightReasons as i}from"../../definitions.js";import{shadeTextureSize as t,sigma as e}from"./parameters.js";import l from"../../../../../support/HighlightOptions.js";import r from"../../../../../webgl/Texture.js";import{TextureDescriptor as h}from"../../../../../webgl/TextureDescriptor.js";const n=()=>o.getLogger("esri.views.2d.engine.webgl.painter.highlight.HighlightGradient");function s(o,i){i.fillColor[0]=o.color.r/255,i.fillColor[1]=o.color.g/255,i.fillColor[2]=o.color.b/255,i.fillColor[3]=o.color.a,o.haloColor?(i.outlineColor[0]=o.haloColor.r/255,i.outlineColor[1]=o.haloColor.g/255,i.outlineColor[2]=o.haloColor.b/255,i.outlineColor[3]=o.haloColor.a):(i.outlineColor[0]=i.fillColor[0],i.outlineColor[1]=i.fillColor[1],i.outlineColor[2]=i.fillColor[2],i.outlineColor[3]=i.fillColor[3]),i.fillColor[3]*=o.fillOpacity,i.outlineColor[3]*=o.haloOpacity,i.fillColor[0]*=i.fillColor[3],i.fillColor[1]*=i.fillColor[3],i.fillColor[2]*=i.fillColor[3],i.outlineColor[0]*=i.outlineColor[3],i.outlineColor[1]*=i.outlineColor[3],i.outlineColor[2]*=i.outlineColor[3],i.outlineWidth=(1-o.haloBlur)*o.haloWidth,i.outerHaloWidth=o.haloBlur*o.haloWidth/2,i.innerHaloWidth=o.haloBlur*o.haloWidth/2,i.outlinePosition=0}const a=[0,0,0,0];class u{constructor(){this.type="single",this._highlightOptions=new l,this._convertedHighlightOptions={fillColor:[0,0,0,0],outlineColor:[0,0,0,0],outlinePosition:0,outlineWidth:0,innerHaloWidth:0,outerHaloWidth:0},this._optionsShadeTexKey="",this._texelData=new Uint8Array(4*t),this._minMaxDistance=[0,0]}setHighlightOptions(o){this._highlightOptions=o}getProgramState(o){return this._updateGradientTexture(o),{minMaxDistance:this._minMaxDistance,shadeTexture:this._shadeTex}}destroy(){this._shadeTex?.dispose(),this._shadeTex=null}getReasonsWithGradients(){return[{activeReasons:(1<<i)-1,activeGradient:this}]}_updateGradientTexture(o){const i=d(this._highlightOptions);if(i===this._optionsShadeTexKey)return;this._optionsShadeTexKey=i,s(this._highlightOptions,this._convertedHighlightOptions);const l=this._convertedHighlightOptions,u=l.outlinePosition-l.outlineWidth/2-l.outerHaloWidth,g=l.outlinePosition-l.outlineWidth/2,f=l.outlinePosition+l.outlineWidth/2,C=l.outlinePosition+l.outlineWidth/2+l.innerHaloWidth,c=Math.sqrt(Math.PI/2)*e,p=Math.abs(u)>c?Math.round(10*(Math.abs(u)-c))/10:0,m=Math.abs(C)>c?Math.round(10*(Math.abs(C)-c))/10:0;let x;p&&!m?n().error("The outer rim of the highlight is "+p+"px away from the edge of the feature; consider reducing some width values or shifting the outline position towards positive values (inwards)."):!p&&m?n().error("The inner rim of the highlight is "+m+"px away from the edge of the feature; consider reducing some width values or shifting the outline position towards negative values (outwards)."):p&&m&&n().error("The highlight is "+Math.max(p,m)+"px away from the edge of the feature; consider reducing some width values.");const _=[void 0,void 0,void 0,void 0];function w(o,i,t){_[0]=(1-t)*o[0]+t*i[0],_[1]=(1-t)*o[1]+t*i[1],_[2]=(1-t)*o[2]+t*i[2],_[3]=(1-t)*o[3]+t*i[3]}const{_texelData:v}=this;for(let e=0;e<t;++e)x=u+e/(t-1)*(C-u),x<u?(_[0]=0,_[1]=0,_[2]=0,_[3]=0):x<g?w(a,l.outlineColor,(x-u)/(g-u)):x<f?[_[0],_[1],_[2],_[3]]=l.outlineColor:x<C?w(l.outlineColor,l.fillColor,(x-f)/(C-f)):[_[0],_[1],_[2],_[3]]=l.fillColor,v[4*e]=255*_[0],v[4*e+1]=255*_[1],v[4*e+2]=255*_[2],v[4*e+3]=255*_[3];if(this._minMaxDistance[0]=u,this._minMaxDistance[1]=C,!this._shadeTex){const i=new h(t,1);i.wrapMode=33071,this._shadeTex=new r(o,i)}this._shadeTex.updateData(0,0,0,t,1,this._texelData)}}function d(o){return`${o.color};${o.haloColor};${o.haloOpacity};${o.fillOpacity};${o.haloWidth};${o.haloBlur}`}export{u as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- function t(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t}function e(t,e){return Math.sqrt(t*t+e*e)}function n(t){const n=e(t[0],t[1]);t[0]/=n,t[1]/=n}function s(t,n){return e(t[0]-n[0],t[1]-n[1])}function i(t,e){return t[e+1]}function r(t){return t.length-1}function h(t){let e=0;for(let n=0;n<r(t);n++)e+=a(t,n);return e}function a(t,e,n=1){let[s,r]=i(t,e);return[s,r]=[Math.round(s),Math.round(r)],Math.sqrt(s*s+r*r)*n}class u{constructor(t,e,n,s,i){this._segments=t,this._index=e,this._distance=n,this._xStart=s,this._yStart=i,this._done=!1}static create(t){return new u(t,0,0,t[0][0],t[0][1])}clone(){return new u(this._segments,this._index,this._distance,this.xStart,this.yStart)}equals(t){return this._index===t._index||t._index===this._index-1&&(0===this._distance||1===t._distance)||t._index===this._index+1&&(1===this._distance||0===t._distance)}leq(t){return this._index<t._index||this._index===t._index&&this._distance<=t._distance}geq(t){return this._index>t._index||this._index===t._index&&this._distance>=t._distance}get _segment(){return this._segments[this._index+1]}get angle(){const t=this.dy,e=(0*t+-1*-this.dx)/(1*this.length);let n=Math.acos(e);return t>0&&(n=2*Math.PI-n),n}get xStart(){return this._xStart}get yStart(){return this._yStart}get x(){return this.xStart+this.distance*this.dx}get y(){return this.yStart+this.distance*this.dy}get dx(){return this._segment[0]}get dy(){return this._segment[1]}get xMidpoint(){return this.xStart+.5*this.dx}get yMidpoint(){return this.yStart+.5*this.dy}get xEnd(){return this.xStart+this.dx}get yEnd(){return this.yStart+this.dy}get length(){const{dx:t,dy:e}=this;return Math.sqrt(t*t+e*e)}get remainingLength(){return this.length*(1-this._distance)}get backwardLength(){return this.length*this._distance}get distance(){return this._distance}get done(){return this._done}hasPrev(){return this._index-1>=0}hasNext(){return this._index+1<r(this._segments)}next(){return this.hasNext()?(this._xStart+=this.dx,this._yStart+=this.dy,this._distance=0,this._index+=1,this):null}prev(){return this.hasPrev()?(this._index-=1,this._xStart-=this.dx,this._yStart-=this.dy,this._distance=1,this):(this._done=!0,null)}_seekBackwards(t,e){const n=this.backwardLength;if(t<=n)return this._distance=(n-t)/this.length,this;let s=this.backwardLength;for(;this.prev();){if(s+this.length>t)return this._seekBackwards(t-s);s+=this.length}return this._distance=0,e?this:null}seek(t,e=!1){if(t<0)return this._seekBackwards(Math.abs(t),e);if(t<=this.remainingLength)return this._distance=(this.backwardLength+t)/this.length,this;let n=this.remainingLength;for(;this.next();){if(n+this.length>t)return this.seek(t-n,e);n+=this.length}return this._distance=1,e?this:null}}function d(t,e,n,s=!0){const i=h(t),r=u.create(t),a=i/2;if(!s)return r.seek(a),void n(r.clone(),0,a+0*e,i);const d=Math.max((i-e)/2,0),c=Math.floor(d/e),o=a-c*e;r.seek(o);for(let h=-c;h<=c;h++)n(r.clone(),h,a+h*e,i),r.seek(e)}function c(t,e,n){o(n,e,h(t),u.create(t),0)}function o(t,e,n,s,i){if(n<e)return;const r=s.clone().seek(n/2);if(null==r)return;t(r.clone(),n,i),n=(n-e)/2;const h=r.seek(e/2);o(t,e,n,s,i+1),o(t,e,n,h,i+1)}function _(t,e){const n=e;for(let s=0;s<t.length;s++){let e=t[s];l(e,n);const i=[];i.push(e[0]);for(let t=1;t<e.length;t++){const[n,s]=e[t-1],[r,h]=e[t],a=r-n,u=h-s;i.push([a,u])}t[s]=i,e=i}return t}function l(e,i){const r=1e-6;if(i<=0)return;const h=e.length;if(h<3)return;const a=[];let u=0;a.push(0);for(let t=1;t<h;t++)u+=s(e[t],e[t-1]),a.push(u);i=Math.min(i,.2*u);const d=[];d.push(e[0][0]),d.push(e[0][1]);const c=e[h-1][0],o=e[h-1][1],_=t([0,0],e[0],e[1]);n(_),e[0][0]+=i*_[0],e[0][1]+=i*_[1],t(_,e[h-1],e[h-2]),n(_),e[h-1][0]+=i*_[0],e[h-1][1]+=i*_[1];for(let t=1;t<h;t++)a[t]+=i;a[h-1]+=i;const l=.5*i;for(let t=1;t<h-1;t++){let n=0,s=0,u=0;for(let h=t-1;h>=0&&!(a[h+1]<a[t]-l);h--){const d=l+a[h+1]-a[t],c=a[h+1]-a[h],o=a[t]-a[h]<l?1:d/c;if(Math.abs(o)<r)break;const _=o*o,g=o*d-.5*_*c,x=o*c/i,f=e[h+1],y=e[h][0]-f[0],k=e[h][1]-f[1];n+=x/g*(f[0]*o*d+.5*_*(d*y-c*f[0])-_*o*c*y/3),s+=x/g*(f[1]*o*d+.5*_*(d*k-c*f[1])-_*o*c*k/3),u+=x}for(let d=t+1;d<h&&!(a[d-1]>a[t]+l);d++){const h=l-a[d-1]+a[t],c=a[d]-a[d-1],o=a[d]-a[t]<l?1:h/c;if(Math.abs(o)<r)break;const _=o*o,g=o*h-.5*_*c,x=o*c/i,f=e[d-1],y=e[d][0]-f[0],k=e[d][1]-f[1];n+=x/g*(f[0]*o*h+.5*_*(h*y-c*f[0])-_*o*c*y/3),s+=x/g*(f[1]*o*h+.5*_*(h*k-c*f[1])-_*o*c*k/3),u+=x}d.push(n/u),d.push(s/u)}d.push(c),d.push(o);for(let t=0,n=0;t<h;t++)e[t][0]=d[n++],e[t][1]=d[n++]}export{u as SegmentCursor,d as pathDivide,h as pathLength,c as pathSubdivide,i as segmentAt,r as segmentCount,a as segmentLength,_ as smoothPaths};
2
+ function t(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t}function e(t,e){return Math.sqrt(t*t+e*e)}function n(t){const n=e(t[0],t[1]);t[0]/=n,t[1]/=n}function s(t,n){return e(t[0]-n[0],t[1]-n[1])}function i(t,e){return t[e+1]}function r(t){return t.length-1}function h(t){let e=0;for(let n=0;n<r(t);n++)e+=a(t,n);return e}function a(t,e,n=1){let[s,r]=i(t,e);return[s,r]=[Math.round(s),Math.round(r)],Math.sqrt(s*s+r*r)*n}class d{constructor(t,e,n,s,i){this._segments=t,this._index=e,this._distance=n,this._xStart=s,this._yStart=i,this._done=!1}static create(t){return new d(t,0,0,t[0][0],t[0][1])}clone(){return new d(this._segments,this._index,this._distance,this.xStart,this.yStart)}equals(t){return this._index===t._index||t._index===this._index-1&&(0===this._distance||1===t._distance)||t._index===this._index+1&&(1===this._distance||0===t._distance)}leq(t){return this._index<t._index||this._index===t._index&&this._distance<=t._distance}geq(t){return this._index>t._index||this._index===t._index&&this._distance>=t._distance}get _segment(){return this._segments[this._index+1]}get angle(){const t=this.dy,e=(0*t+-1*-this.dx)/(1*this.length);let n=Math.acos(e);return t>0&&(n=2*Math.PI-n),n}get xStart(){return this._xStart}get yStart(){return this._yStart}get x(){return this.xStart+this.distance*this.dx}get y(){return this.yStart+this.distance*this.dy}get dx(){return this._segment[0]}get dy(){return this._segment[1]}get xMidpoint(){return this.xStart+.5*this.dx}get yMidpoint(){return this.yStart+.5*this.dy}get xEnd(){return this.xStart+this.dx}get yEnd(){return this.yStart+this.dy}get length(){const{dx:t,dy:e}=this;return Math.sqrt(t*t+e*e)}get remainingLength(){return this.length*(1-this._distance)}get backwardLength(){return this.length*this._distance}get distance(){return this._distance}get done(){return this._done}hasPrev(){return this._index-1>=0}hasNext(){return this._index+1<r(this._segments)}next(){return this.hasNext()?(this._xStart+=this.dx,this._yStart+=this.dy,this._distance=0,this._index+=1,this):null}prev(){return this.hasPrev()?(this._index-=1,this._xStart-=this.dx,this._yStart-=this.dy,this._distance=1,this):(this._done=!0,null)}_seekBackwards(t,e){const n=this.backwardLength;if(t<=n)return this._distance=(n-t)/this.length,this;let s=this.backwardLength;for(;this.prev();){if(s+this.length>t)return this._seekBackwards(t-s);s+=this.length}return this._distance=0,e?this:null}seek(t,e=!1){if(t<0)return this._seekBackwards(Math.abs(t),e);if(t<=this.remainingLength)return this._distance=(this.backwardLength+t)/this.length,this;let n=this.remainingLength;for(;this.next();){if(n+this.length>t)return this.seek(t-n,e);n+=this.length}return this._distance=1,e?this:null}}function u(t,e,n,s=!0){const i=h(t),r=d.create(t),a=i/2;if(!s)return r.seek(a),void n(r.clone(),0,a+0*e,i);const u=Math.max((i-e)/2,0),c=Math.floor(u/e),_=a-c*e;r.seek(_);for(let h=-c;h<=c;h++)n(r.clone(),h,a+h*e,i),r.seek(e)}function c(t,e){const n=e;for(let s=0;s<t.length;s++){let e=t[s];_(e,n);const i=[];i.push(e[0]);for(let t=1;t<e.length;t++){const[n,s]=e[t-1],[r,h]=e[t],a=r-n,d=h-s;i.push([a,d])}t[s]=i,e=i}return t}function _(e,i){const r=1e-6;if(i<=0)return;const h=e.length;if(h<3)return;const a=[];let d=0;a.push(0);for(let t=1;t<h;t++)d+=s(e[t],e[t-1]),a.push(d);i=Math.min(i,.2*d);const u=[];u.push(e[0][0]),u.push(e[0][1]);const c=e[h-1][0],_=e[h-1][1],o=t([0,0],e[0],e[1]);n(o),e[0][0]+=i*o[0],e[0][1]+=i*o[1],t(o,e[h-1],e[h-2]),n(o),e[h-1][0]+=i*o[0],e[h-1][1]+=i*o[1];for(let t=1;t<h;t++)a[t]+=i;a[h-1]+=i;const g=.5*i;for(let t=1;t<h-1;t++){let n=0,s=0,d=0;for(let h=t-1;h>=0&&!(a[h+1]<a[t]-g);h--){const u=g+a[h+1]-a[t],c=a[h+1]-a[h],_=a[t]-a[h]<g?1:u/c;if(Math.abs(_)<r)break;const o=_*_,l=_*u-.5*o*c,x=_*c/i,f=e[h+1],y=e[h][0]-f[0],S=e[h][1]-f[1];n+=x/l*(f[0]*_*u+.5*o*(u*y-c*f[0])-o*_*c*y/3),s+=x/l*(f[1]*_*u+.5*o*(u*S-c*f[1])-o*_*c*S/3),d+=x}for(let u=t+1;u<h&&!(a[u-1]>a[t]+g);u++){const h=g-a[u-1]+a[t],c=a[u]-a[u-1],_=a[u]-a[t]<g?1:h/c;if(Math.abs(_)<r)break;const o=_*_,l=_*h-.5*o*c,x=_*c/i,f=e[u-1],y=e[u][0]-f[0],S=e[u][1]-f[1];n+=x/l*(f[0]*_*h+.5*o*(h*y-c*f[0])-o*_*c*y/3),s+=x/l*(f[1]*_*h+.5*o*(h*S-c*f[1])-o*_*c*S/3),d+=x}u.push(n/d),u.push(s/d)}u.push(c),u.push(_);for(let t=0,n=0;t<h;t++)e[t][0]=u[n++],e[t][1]=u[n++]}export{d as SegmentCursor,u as pathDivide,h as pathLength,i as segmentAt,r as segmentCount,a as segmentLength,c as smoothPaths};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../../../../../core/has.js";import{isPowerOfTwo as e,nextPowerOfTwo as t}from"../../../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../../../core/maybe.js";import{simplePipelineState as s}from"../utils.js";import{Technique as u}from"./Technique.js";import{TextureStatisticsDiffShader as o}from"./shaders/TextureStatisticsDiffShader.js";import{TextureStatisticsMinMaxSumShader as i}from"./shaders/TextureStatisticsMinMaxSumShader.js";import{TextureStatisticsStdDevShader as a}from"./shaders/TextureStatisticsStdDevShader.js";import{TextureStatisticsSumOfSquaredDiffShader as n}from"./shaders/TextureStatisticsSumOfSquaredDiffShader.js";import{getWebGLCapabilities as f}from"../../../../../webgl/capabilities.js";import{ColorAttachment2 as l,ColorAttachment3 as h,ColorAttachment0 as m,ColorAttachment1 as x,SizedPixelFormat as c,PixelType as T}from"../../../../../webgl/enums.js";import{DisposableFramebufferObject as d}from"../../../../../webgl/FramebufferObject.js";import p from"../../../../../webgl/Texture.js";import{TextureDescriptor as b}from"../../../../../webgl/TextureDescriptor.js";const _=1048576;class F extends u{constructor(){super(...arguments),this.type=36,this._width=0,this._height=0,this._framebuffers=null,this._minTexture=null,this._maxTexture=null,this._sumTexture=null,this._numOfNoDataTexture=null,this._resultsFramebuffer=null,this._startFramebuffer=null,this._diffFramebuffer=null,this._scaleFbo=null,this.shaders={textureStatisticsMinMaxSum:new i,textureStatisticsSum:new n,textureStatisticsDiff:new o,textureStatisticsStdDev:new a}}dispose(){this.shaders.textureStatisticsMinMaxSum=null,this._framebuffers&&(this._framebuffers.forEach(e=>r(e)),this._framebuffers=null),r(this._resultsFramebuffer),r(this._startFramebuffer),r(this._diffFramebuffer),r(this._scaleFbo),r(this._minTexture),r(this._maxTexture),r(this._sumTexture),r(this._numOfNoDataTexture)}get minValuesTexture(){return this._minTexture||null}get maxValuesTexture(){return this._maxTexture||null}get meanValuesTexture(){return this._resultsFramebuffer?.getColorTexture(l)||null}get stdDevValuesTexture(){return this._resultsFramebuffer?.getColorTexture(h)||null}get statsFbo(){return this._resultsFramebuffer}render(t,r){const{context:u,painter:o}=t;let i=r.fbo.width,a=r.fbo.height,n=r.fbo;const f=u.gl,l=u.boundFramebuffer;if(i*a>_||!e(i)||!e(a)){const t=i/a;if(i*a>_){const e=Math.max(Math.floor(Math.sqrt(_/t)),1);i=Math.max(Math.floor(t*e),1),a=e}if(e(i)||(i=S(i)),e(a)||(a=S(a)),this._scaleFbo)this._scaleFbo.resize(i,a);else{const{dataType:e,internalFormat:t}=r.fbo.getColorTexture(m).descriptor,s=t??c.RGBA8;this._scaleFbo=w(u,i,a,e,s)}u.bindFramebuffer(this._scaleFbo),u.setViewport(0,0,i,a),o.blitTexture(u,n.getColorTexture(m),9728),n=this._scaleFbo}this._updateResources(t,n),o.setPipelineState({...s,color:{write:[!0,!0,!0,!0],blendMode:"none"}});const h=this._applyReductionPass(t);f.readBuffer(f.COLOR_ATTACHMENT3),h.copyToTexture(0,0,1,1,0,0,this._numOfNoDataTexture),f.readBuffer(f.COLOR_ATTACHMENT2),h.copyToTexture(0,0,1,1,0,0,this._sumTexture),f.readBuffer(f.COLOR_ATTACHMENT1),h.copyToTexture(0,0,1,1,0,0,this._maxTexture),f.readBuffer(f.COLOR_ATTACHMENT0),h.copyToTexture(0,0,1,1,0,0,this._minTexture);const x=r.fbo.getColorTexture(m);if(!x)throw new Error("Start buffer color texture is not available, cannot compute diff.");this._computeDiff(t,x,this._sumTexture,this._numOfNoDataTexture,i,a);const T=this._applySecondReductionPass(t,i,a).getColorTexture(m);this._computeSdtDev(t,this._minTexture,this._maxTexture,this._sumTexture,this._numOfNoDataTexture,T,i,a),u.bindFramebuffer(l),u.setViewport(0,0,r.fbo.width,r.fbo.height),o.setPipelineState(s)}_applyReductionPass(e){const{context:t,painter:r}=e,s=this.shaders.textureStatisticsMinMaxSum,u=this._framebuffers;if(null===u)throw new Error("Framebuffers are not initialized, cannot apply reduction pass.");const o=this._startFramebuffer;let i=o.getColorTexture(m),a=o.getColorTexture(x),n=o.getColorTexture(l),f=o.getColorTexture(h);const c=u;let T=0;for(const d of c){t.setViewport(0,0,d.width,d.height),t.bindFramebuffer(d),t.setClearColor(0,0,0,0),t.clear(16384);const e={shader:s,uniforms:{config:{width:d.width,height:d.height,isFirstPass:0===T?1:0}},textures:{minTexture:{texture:i,unit:1},maxTexture:{texture:a,unit:2},sumTexture:{texture:n,unit:3},numOfNoDataTexture:{texture:f,unit:4}},defines:null,optionalAttributes:null,useComputeBuffer:!1};r.submitDrawMesh(t,e,r.quadMesh),i=d.getColorTexture(m),a=d.getColorTexture(x),n=d.getColorTexture(l),f=d.getColorTexture(h),T++}return u.at(-1)}_applySecondReductionPass(e,t,r){const{context:s,painter:u}=e,o=this.shaders.textureStatisticsSum,i=this._framebuffers;if(null===i||null==this._diffFramebuffer)throw new Error("Framebuffers are not initialized, cannot apply reduction pass.");let a=this._diffFramebuffer.getColorTexture(m);const n=i;for(const f of n){s.setViewport(0,0,f.width,f.height),s.bindFramebuffer(f),s.setClearColor(0,0,0,0),s.clear(16384);const e={shader:o,uniforms:{config:{width:f.width,height:f.height}},textures:{sumTexture:{texture:a,unit:2}},defines:null,optionalAttributes:null,useComputeBuffer:!1};u.submitDrawMesh(s,e,u.quadMesh),a=f.getColorTexture(m)}return i.at(-1)}_updateResources(e,t){const{context:r}=e,s=t.width,u=t.height;if(null===this._startFramebuffer){if(!f().supportsColorBufferFloat)throw new Error("WebGL does not support color buffer float, cannot compute texture statistics.");const e=t.getColorTexture(m);if(!e)throw new Error("Input FBO does not have a color attachment 0, cannot compute texture statistics.");const o=e.descriptor,{dataType:i,internalFormat:a}=o,n=w(r,s,u,i,a??c.RGBA8,4),d=n.getColorTexture(m),p=n.getColorTexture(x),b=n.getColorTexture(l),_=n.getColorTexture(h);t.copyToTexture(0,0,s,u,0,0,d),t.copyToTexture(0,0,s,u,0,0,p),t.copyToTexture(0,0,s,u,0,0,b),t.copyToTexture(0,0,s,u,0,0,_),this._startFramebuffer=n,this._diffFramebuffer=w(r,s,u,T.FLOAT,c.RGBA32F),this._resultsFramebuffer=w(r,1,1,T.FLOAT,c.RGBA32F,4),this._minTexture=C(r,1,1,T.FLOAT,c.RGBA32F),this._maxTexture=C(r,1,1,T.FLOAT,c.RGBA32F),this._sumTexture=C(r,1,1,T.FLOAT,c.RGBA32F),this._numOfNoDataTexture=C(r,1,1,T.FLOAT,c.R32F)}else{const e=this._startFramebuffer;e.resize(s,u);const r=e.getColorTexture(m),o=e.getColorTexture(x),i=e.getColorTexture(l),a=e.getColorTexture(h);t.copyToTexture(0,0,s,u,0,0,r),t.copyToTexture(0,0,s,u,0,0,o),t.copyToTexture(0,0,s,u,0,0,i),t.copyToTexture(0,0,s,u,0,0,a),this._diffFramebuffer.resize(s,u)}if(this._width===s&&this._height===u&&null!==this._framebuffers)return;const o=(this._framebuffers||[]).reverse();this._framebuffers=null,this._width=s,this._height=u,this._framebuffers=this._updateFramebuffers(r,s,u,o,4)}_updateFramebuffers(e,t,s,u,o=1){const i=[];let a=t,n=s;for(;a>1||n>1;){const t=Math.max(1,Math.floor(a/2)),r=Math.max(1,Math.floor(n/2)),s=g(e,t,r,u,o);i.push(s),a=t,n=r}return i.at(-1),u.forEach(e=>r(e)),u.length=0,i}_computeDiff(e,t,r,s,u,o){const{context:i,painter:a}=e;i.bindFramebuffer(this._diffFramebuffer),i.setViewport(0,0,u,o),i.setClearColor(0,0,0,0),i.clear(16384);const n={shader:this.shaders.textureStatisticsDiff,uniforms:{config:{numTexels:u*o}},textures:{inputTexture:{texture:t,unit:1},sumTexture:{texture:r,unit:2},numOfNoDataTexture:{texture:s,unit:3}},defines:null,optionalAttributes:null,useComputeBuffer:!1};a.submitDrawMesh(i,n,a.quadMesh)}_computeSdtDev(e,t,r,s,u,o,i,a){const{context:n,painter:f}=e;n.bindFramebuffer(this._resultsFramebuffer),n.setViewport(0,0,1,1),n.setClearColor(0,0,0,0),n.clear(16384);const l={shader:this.shaders.textureStatisticsStdDev,uniforms:{config:{numTexels:i*a}},textures:{minTexture:{texture:t,unit:1},maxTexture:{texture:r,unit:2},sumTexture:{texture:s,unit:3},numOfNoDataTexture:{texture:u,unit:4},diffSqTexture:{texture:o,unit:5}},defines:null,optionalAttributes:null,useComputeBuffer:!1};f.submitDrawMesh(n,l,f.quadMesh)}}function g(e,t,r,s,u=1){let o=s.pop();return void 0!==o?o.resize(t,r):o=w(e,t,r,T.FLOAT,c.RGBA32F,u),o}function w(e,t,r,s,u,o=1){if(o<1||o>4)throw new Error("Number of color attachments must be between 1 and 4.");const i=new d(e,C(e,t,r,s,u));for(let a=1;a<o;a++){const o=C(e,t,r,s,u);i.attachColorTexture(o,m+a)}return i}function C(e,t,r,s,u){const o=new b(t,r);return o.samplingMode=9728,o.wrapMode=33071,o.pixelFormat=6408,o.dataType=s,o.internalFormat=u,new p(e,o)}function S(e){const r=t(e),s=r/2;return Math.abs(r-e)<Math.abs(s-e)?r:s}export{F as TextureStatisticsTechnique};
2
+ import"../../../../../../core/has.js";import{isPowerOfTwo as e,nextPowerOfTwo as t}from"../../../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../../../core/maybe.js";import{simplePipelineState as s}from"../utils.js";import{Technique as u}from"./Technique.js";import{TextureStatisticsDiffShader as o}from"./shaders/TextureStatisticsDiffShader.js";import{TextureStatisticsMinMaxSumShader as i}from"./shaders/TextureStatisticsMinMaxSumShader.js";import{TextureStatisticsStdDevShader as a}from"./shaders/TextureStatisticsStdDevShader.js";import{TextureStatisticsSumOfSquaredDiffShader as n}from"./shaders/TextureStatisticsSumOfSquaredDiffShader.js";import{getWebGLCapabilities as f}from"../../../../../webgl/capabilities.js";import{ColorAttachment2 as l,ColorAttachment3 as h,ColorAttachment0 as m,ColorAttachment1 as x,SizedPixelFormat as c,PixelType as T}from"../../../../../webgl/enums.js";import{DisposableFramebufferObject as d}from"../../../../../webgl/FramebufferObject.js";import p from"../../../../../webgl/Texture.js";import{TextureDescriptor as b}from"../../../../../webgl/TextureDescriptor.js";const _=1048576;class F extends u{constructor(){super(...arguments),this.type=36,this._width=0,this._height=0,this._framebuffers=null,this._minTexture=null,this._maxTexture=null,this._sumTexture=null,this._numOfNoDataTexture=null,this._resultsFramebuffer=null,this._startFramebuffer=null,this._diffFramebuffer=null,this._scaleFbo=null,this.shaders={textureStatisticsMinMaxSum:new i,textureStatisticsSum:new n,textureStatisticsDiff:new o,textureStatisticsStdDev:new a}}dispose(){this.shaders.textureStatisticsMinMaxSum=null,this._framebuffers&&(this._framebuffers.forEach(e=>r(e)),this._framebuffers=null),r(this._resultsFramebuffer),r(this._startFramebuffer),r(this._diffFramebuffer),r(this._scaleFbo),r(this._minTexture),r(this._maxTexture),r(this._sumTexture),r(this._numOfNoDataTexture)}get minValuesTexture(){return this._minTexture||null}get maxValuesTexture(){return this._maxTexture||null}get meanValuesTexture(){return this._resultsFramebuffer?.getColorTexture(l)||null}get stdDevValuesTexture(){return this._resultsFramebuffer?.getColorTexture(h)||null}get statsFbo(){return this._resultsFramebuffer}render(t,r){const{context:u,painter:o}=t;let i=r.fbo.width,a=r.fbo.height,n=r.fbo;const f=u.gl,l=u.boundFramebuffer;if(i*a>_||!e(i)||!e(a)){const s=i/a;if(i*a>_){const e=Math.max(Math.floor(Math.sqrt(_/s)),1);i=Math.max(Math.floor(s*e),1),a=e}if(e(i)||(i=S(i)),e(a)||(a=S(a)),this._scaleFbo)this._scaleFbo.resize(i,a);else{const{dataType:e,internalFormat:t}=r.fbo.getColorTexture(m).descriptor,s=t??c.RGBA8;this._scaleFbo=w(u,i,a,e,s)}u.bindFramebuffer(this._scaleFbo),u.setViewport(0,0,i,a),o.blitTexture(t,n.getColorTexture(m),9728),n=this._scaleFbo}this._updateResources(t,n),o.setPipelineState({...s,color:{write:[!0,!0,!0,!0],blendMode:"none"}});const h=this._applyReductionPass(t);f.readBuffer(f.COLOR_ATTACHMENT3),h.copyToTexture(0,0,1,1,0,0,this._numOfNoDataTexture),f.readBuffer(f.COLOR_ATTACHMENT2),h.copyToTexture(0,0,1,1,0,0,this._sumTexture),f.readBuffer(f.COLOR_ATTACHMENT1),h.copyToTexture(0,0,1,1,0,0,this._maxTexture),f.readBuffer(f.COLOR_ATTACHMENT0),h.copyToTexture(0,0,1,1,0,0,this._minTexture);const x=r.fbo.getColorTexture(m);if(!x)throw new Error("Start buffer color texture is not available, cannot compute diff.");this._computeDiff(t,x,this._sumTexture,this._numOfNoDataTexture,i,a);const T=this._applySecondReductionPass(t,i,a).getColorTexture(m);this._computeSdtDev(t,this._minTexture,this._maxTexture,this._sumTexture,this._numOfNoDataTexture,T,i,a),u.bindFramebuffer(l),u.setViewport(0,0,r.fbo.width,r.fbo.height),o.setPipelineState(s)}_applyReductionPass(e){const{context:t,painter:r}=e,s=this.shaders.textureStatisticsMinMaxSum,u=this._framebuffers;if(null===u)throw new Error("Framebuffers are not initialized, cannot apply reduction pass.");const o=this._startFramebuffer;let i=o.getColorTexture(m),a=o.getColorTexture(x),n=o.getColorTexture(l),f=o.getColorTexture(h);const c=u;let T=0;for(const d of c){t.setViewport(0,0,d.width,d.height),t.bindFramebuffer(d),t.setClearColor(0,0,0,0),t.clear(16384);const e={shader:s,uniforms:{config:{width:d.width,height:d.height,isFirstPass:0===T?1:0}},textures:{minTexture:{texture:i,unit:1},maxTexture:{texture:a,unit:2},sumTexture:{texture:n,unit:3},numOfNoDataTexture:{texture:f,unit:4}},defines:null,optionalAttributes:null,useComputeBuffer:!1};r.submitDrawMesh(t,e,r.quadMesh),i=d.getColorTexture(m),a=d.getColorTexture(x),n=d.getColorTexture(l),f=d.getColorTexture(h),T++}return u.at(-1)}_applySecondReductionPass(e,t,r){const{context:s,painter:u}=e,o=this.shaders.textureStatisticsSum,i=this._framebuffers;if(null===i||null==this._diffFramebuffer)throw new Error("Framebuffers are not initialized, cannot apply reduction pass.");let a=this._diffFramebuffer.getColorTexture(m);const n=i;for(const f of n){s.setViewport(0,0,f.width,f.height),s.bindFramebuffer(f),s.setClearColor(0,0,0,0),s.clear(16384);const e={shader:o,uniforms:{config:{width:f.width,height:f.height}},textures:{sumTexture:{texture:a,unit:2}},defines:null,optionalAttributes:null,useComputeBuffer:!1};u.submitDrawMesh(s,e,u.quadMesh),a=f.getColorTexture(m)}return i.at(-1)}_updateResources(e,t){const{context:r}=e,s=t.width,u=t.height;if(null===this._startFramebuffer){if(!f().supportsColorBufferFloat)throw new Error("WebGL does not support color buffer float, cannot compute texture statistics.");const e=t.getColorTexture(m);if(!e)throw new Error("Input FBO does not have a color attachment 0, cannot compute texture statistics.");const o=e.descriptor,{dataType:i,internalFormat:a}=o,n=w(r,s,u,i,a??c.RGBA8,4),d=n.getColorTexture(m),p=n.getColorTexture(x),b=n.getColorTexture(l),_=n.getColorTexture(h);t.copyToTexture(0,0,s,u,0,0,d),t.copyToTexture(0,0,s,u,0,0,p),t.copyToTexture(0,0,s,u,0,0,b),t.copyToTexture(0,0,s,u,0,0,_),this._startFramebuffer=n,this._diffFramebuffer=w(r,s,u,T.FLOAT,c.RGBA32F),this._resultsFramebuffer=w(r,1,1,T.FLOAT,c.RGBA32F,4),this._minTexture=C(r,1,1,T.FLOAT,c.RGBA32F),this._maxTexture=C(r,1,1,T.FLOAT,c.RGBA32F),this._sumTexture=C(r,1,1,T.FLOAT,c.RGBA32F),this._numOfNoDataTexture=C(r,1,1,T.FLOAT,c.R32F)}else{const e=this._startFramebuffer;e.resize(s,u);const r=e.getColorTexture(m),o=e.getColorTexture(x),i=e.getColorTexture(l),a=e.getColorTexture(h);t.copyToTexture(0,0,s,u,0,0,r),t.copyToTexture(0,0,s,u,0,0,o),t.copyToTexture(0,0,s,u,0,0,i),t.copyToTexture(0,0,s,u,0,0,a),this._diffFramebuffer.resize(s,u)}if(this._width===s&&this._height===u&&null!==this._framebuffers)return;const o=(this._framebuffers||[]).reverse();this._framebuffers=null,this._width=s,this._height=u,this._framebuffers=this._updateFramebuffers(r,s,u,o,4)}_updateFramebuffers(e,t,s,u,o=1){const i=[];let a=t,n=s;for(;a>1||n>1;){const t=Math.max(1,Math.floor(a/2)),r=Math.max(1,Math.floor(n/2)),s=g(e,t,r,u,o);i.push(s),a=t,n=r}return i.at(-1),u.forEach(e=>r(e)),u.length=0,i}_computeDiff(e,t,r,s,u,o){const{context:i,painter:a}=e;i.bindFramebuffer(this._diffFramebuffer),i.setViewport(0,0,u,o),i.setClearColor(0,0,0,0),i.clear(16384);const n={shader:this.shaders.textureStatisticsDiff,uniforms:{config:{numTexels:u*o}},textures:{inputTexture:{texture:t,unit:1},sumTexture:{texture:r,unit:2},numOfNoDataTexture:{texture:s,unit:3}},defines:null,optionalAttributes:null,useComputeBuffer:!1};a.submitDrawMesh(i,n,a.quadMesh)}_computeSdtDev(e,t,r,s,u,o,i,a){const{context:n,painter:f}=e;n.bindFramebuffer(this._resultsFramebuffer),n.setViewport(0,0,1,1),n.setClearColor(0,0,0,0),n.clear(16384);const l={shader:this.shaders.textureStatisticsStdDev,uniforms:{config:{numTexels:i*a}},textures:{minTexture:{texture:t,unit:1},maxTexture:{texture:r,unit:2},sumTexture:{texture:s,unit:3},numOfNoDataTexture:{texture:u,unit:4},diffSqTexture:{texture:o,unit:5}},defines:null,optionalAttributes:null,useComputeBuffer:!1};f.submitDrawMesh(n,l,f.quadMesh)}}function g(e,t,r,s,u=1){let o=s.pop();return void 0!==o?o.resize(t,r):o=w(e,t,r,T.FLOAT,c.RGBA32F,u),o}function w(e,t,r,s,u,o=1){if(o<1||o>4)throw new Error("Number of color attachments must be between 1 and 4.");const i=new d(e,C(e,t,r,s,u));for(let a=1;a<o;a++){const o=C(e,t,r,s,u);i.attachColorTexture(o,m+a)}return i}function C(e,t,r,s,u){const o=new b(t,r);return o.samplingMode=9728,o.wrapMode=33071,o.pixelFormat=6408,o.dataType=s,o.internalFormat=u,new p(e,o)}function S(e){const r=t(e),s=r/2;return Math.abs(r-e)<Math.abs(s-e)?r:s}export{F as TextureStatisticsTechnique};