@arcgis/core 4.28.0-next.20230720 → 4.28.0-next.20230721

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 (261) hide show
  1. package/Color.js +1 -1
  2. package/analysis/AreaMeasurementAnalysis.js +1 -1
  3. package/arcade/arcadeCompiler.js +1 -1
  4. package/arcade/featureSetUtils.js +1 -1
  5. package/arcade/featureset/actions/Top.js +1 -1
  6. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  7. package/arcade/featureset/support/FeatureSet.js +1 -1
  8. package/arcade/featureset/support/FeatureSetIterator.js +1 -1
  9. package/arcade/functions/convertdirection.js +1 -1
  10. package/arcade/functions/featuresetbase.js +1 -1
  11. package/arcade/functions/geomasync.js +1 -1
  12. package/arcade/functions/geomsync.js +1 -1
  13. package/arcade/lib/comment-handler.js +1 -1
  14. package/arcade/lib/parser.js +1 -1
  15. package/arcade/lib/scanner.js +1 -1
  16. package/assets/esri/core/workers/RemoteClient.js +1 -1
  17. package/assets/esri/core/workers/chunks/{75c28da8d0b02d612d69.js → 040b3fc9c9c0736dd893.js} +1 -1
  18. package/assets/esri/core/workers/chunks/0652f6a8d5221e978033.js +1 -0
  19. package/assets/esri/core/workers/chunks/{c13b332afdb3f6be1ec9.js → 092fda62b6f62c2e4869.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{57e0ad037188bd2997e7.js → 0af18a96cbd4e2d35436.js} +1 -1
  21. package/assets/esri/core/workers/chunks/0b5eeec0f66c87a46a0c.js +1 -0
  22. package/assets/esri/core/workers/chunks/{68e568b67b6fb34393db.js → 0cad2b991d0d0fd07846.js} +1 -1
  23. package/assets/esri/core/workers/chunks/0dccbc6c2559fdc0c2ad.js +1 -0
  24. package/assets/esri/core/workers/chunks/256a82f6f6e1405fbcc6.js +1 -0
  25. package/assets/esri/core/workers/chunks/{bb9213899049e1db90da.js → 2c57c9bd71637c5bed8a.js} +1 -1
  26. package/assets/esri/core/workers/chunks/2cdbabcbfe32286ec78d.js +1 -0
  27. package/assets/esri/core/workers/chunks/{2b1c83453a862e01954b.js → 2d9d80b2d0042a9c09fb.js} +1 -1
  28. package/assets/esri/core/workers/chunks/2f9aec2238ff6cb99e09.js +1 -0
  29. package/assets/esri/core/workers/chunks/{7dbd3e6406fb3e3a1a8f.js → 3cf748c025f3936c1cb2.js} +1 -1
  30. package/assets/esri/core/workers/chunks/4481d1103363434f16da.js +1 -0
  31. package/assets/esri/core/workers/chunks/5ae325e6a795c72eac6c.js +1 -0
  32. package/assets/esri/core/workers/chunks/5e4dde2886a1027b4b96.js +1 -0
  33. package/assets/esri/core/workers/chunks/730eb7e5f617fdab4f10.js +1 -0
  34. package/assets/esri/core/workers/chunks/{5a2e6bed9431cf4f42b1.js → 740dc67038f554431f1b.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{09178454bda15bb7929a.js → 7fbdfd1527582c52f9b6.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{1c026947505a9ff94a53.js → 807742f38885fa90b4fe.js} +1 -1
  37. package/assets/esri/core/workers/chunks/82dfbc175b52c7a10475.js +1 -0
  38. package/assets/esri/core/workers/chunks/870a05451e074b58f19a.js +1 -0
  39. package/assets/esri/core/workers/chunks/8c5a8c1dfb086069bb06.js +1 -0
  40. package/assets/esri/core/workers/chunks/99a5a434e0bad48c7a5c.js +1 -0
  41. package/assets/esri/core/workers/chunks/9a5916c66dad91d01d5b.js +1 -0
  42. package/assets/esri/core/workers/chunks/9c133fd8c1fbd0295b86.js +1 -0
  43. package/assets/esri/core/workers/chunks/9cddb504079d396779ea.js +1 -0
  44. package/assets/esri/core/workers/chunks/a3a1d4f32e518e97d071.js +1 -0
  45. package/assets/esri/core/workers/chunks/{9548aa449fe3a300c015.js → a4fa40dc77e116c954ac.js} +1 -1
  46. package/assets/esri/core/workers/chunks/a54ec9929a7db879d5db.js +1 -0
  47. package/assets/esri/core/workers/chunks/afc5b84693757fda2bc8.js +1 -0
  48. package/assets/esri/core/workers/chunks/{591b5c277cfd3a4101a4.js → b08f2a4aa94087c6c367.js} +1 -1
  49. package/assets/esri/core/workers/chunks/c0e12f6a7bb2360e4c21.js +1 -0
  50. package/assets/esri/core/workers/chunks/c8e656cd470a17f538e9.js +1 -0
  51. package/assets/esri/core/workers/chunks/d0e203405f95e14b1399.js +1 -0
  52. package/assets/esri/core/workers/chunks/{ec72f492f24e67e008ae.js → d8e58dc14d3495f0830c.js} +1 -1
  53. package/assets/esri/core/workers/chunks/ddc393a012588f799f42.js +1 -0
  54. package/assets/esri/core/workers/chunks/de3baa85b1639c25458d.js +1 -0
  55. package/assets/esri/core/workers/chunks/e66cea26064ba8353af0.js +1 -0
  56. package/assets/esri/core/workers/chunks/ea478f2f4a19463e13fd.js +1 -0
  57. package/assets/esri/core/workers/chunks/eba197e45507f56f3ed0.js +1 -0
  58. package/assets/esri/core/workers/chunks/ebd006fcd568a7731115.js +1 -0
  59. package/assets/esri/core/workers/chunks/ef9a9a7d66d818720e20.js +1 -0
  60. package/assets/esri/core/workers/chunks/f3b458f55236566c940b.js +1 -0
  61. package/assets/esri/core/workers/chunks/fd0a91b9e0216cc269c3.js +1 -0
  62. package/assets/esri/core/workers/chunks/{a4fe220a912b1f428e49.js → fdd6403a8390d629392b.js} +1 -1
  63. package/assets/esri/themes/base/widgets/_Directions.scss +13 -7
  64. package/assets/esri/themes/dark/main.css +1 -1
  65. package/assets/esri/themes/light/main.css +1 -1
  66. package/assets/esri/themes/light/view.css +1 -1
  67. package/chunks/array.js +1 -1
  68. package/core/Collection.js +1 -1
  69. package/core/accessorSupport/decorators/subclass.js +1 -1
  70. package/core/accessorSupport/ensureType.js +1 -1
  71. package/core/accessorSupport/get.js +1 -1
  72. package/core/accessorSupport/tracking.js +1 -1
  73. package/core/accessorSupport/utils.js +1 -1
  74. package/core/libs/rbush/PooledRBush.js +1 -1
  75. package/core/urlUtils.js +1 -1
  76. package/geometry/GeometryCursor.js +1 -1
  77. package/geometry/support/TileClipper.js +1 -1
  78. package/geometry/support/geodesicUtils.js +1 -1
  79. package/interfaces.d.ts +7 -1
  80. package/layers/LinkChartLayer.js +1 -1
  81. package/layers/VectorTileLayer.js +1 -1
  82. package/layers/VoxelLayer.js +1 -1
  83. package/layers/WCSLayer.js +1 -1
  84. package/layers/effects/EffectView.js +1 -1
  85. package/layers/graphics/sources/geojson/geojson.js +1 -1
  86. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  87. package/layers/mixins/ArcGISCachedService.js +1 -1
  88. package/layers/support/ElevationQuery.js +1 -1
  89. package/layers/support/MultidimensionalSubset.js +1 -1
  90. package/layers/support/TileInfo.js +1 -1
  91. package/layers/support/TileInfoTilemapCache.js +1 -1
  92. package/layers/support/TilemapCache.js +1 -1
  93. package/layers/support/rasterDatasets/multidimensionalUtils.js +1 -1
  94. package/layers/support/rasterDatasets/pamParser.js +1 -1
  95. package/layers/support/rasterDatasets/wcsCoverageParser.js +1 -1
  96. package/layers/support/rasterFormats/Raw.js +1 -1
  97. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  98. package/layers/support/rasterFunctions/ExtractBandFunction.js +1 -1
  99. package/layers/support/rasterFunctions/colormaps.js +1 -1
  100. package/layers/support/rasterFunctions/pixelUtils.js +1 -1
  101. package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
  102. package/layers/video/VideoController.js +1 -1
  103. package/layers/voxel/VoxelDimension.js +1 -1
  104. package/layers/voxel/VoxelTransferFunctionStyle.js +1 -1
  105. package/layers/voxel/VoxelVolume.js +1 -1
  106. package/package.json +1 -1
  107. package/renderers/support/RasterSymbolizer.js +1 -1
  108. package/renderers/support/colorRampUtils.js +1 -1
  109. package/renderers/visualVariables/support/visualVariableUtils.js +1 -1
  110. package/rest/query/operations/pbfDehydratedFeatureSet.js +1 -1
  111. package/rest/query/operations/pbfJSONFeatureSet.js +1 -1
  112. package/rest/support/generateRendererUtils.js +1 -1
  113. package/smartMapping/raster/renderers/classBreaks.js +1 -1
  114. package/smartMapping/renderers/color.js +1 -1
  115. package/smartMapping/renderers/support/utils.js +1 -1
  116. package/smartMapping/renderers/type.js +1 -1
  117. package/smartMapping/renderers/univariateColorSize.js +1 -1
  118. package/smartMapping/support/adapters/support/utils.js +1 -1
  119. package/statistics/utils.js +1 -1
  120. package/support/revision.js +1 -1
  121. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  122. package/symbols/cim/GeometryWalker.js +1 -1
  123. package/symbols/cim/cimAnalyzer.js +1 -1
  124. package/symbols/cim/effects/EffectArrow.js +1 -1
  125. package/symbols/cim/effects/EffectControlMeasureLine.js +1 -1
  126. package/symbols/support/symbolUtils.js +1 -1
  127. package/views/2d/constraints/ZoomConstraint.js +1 -1
  128. package/views/2d/engine/flow/dataUtils.js +1 -1
  129. package/views/2d/engine/flow/utils.js +1 -1
  130. package/views/2d/engine/vectorTiles/VectorTile.js +1 -1
  131. package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
  132. package/views/2d/engine/vectorTiles/expression/expression.js +1 -1
  133. package/views/2d/engine/vectorTiles/style/VectorTileSource.js +1 -1
  134. package/views/2d/engine/vectorTiles/tileInfoUtils.js +1 -1
  135. package/views/2d/engine/webgl/TurboLine.js +1 -1
  136. package/views/2d/engine/webgl/mesh/MeshData.js +1 -1
  137. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  138. package/views/2d/interactive/editingTools/ControlPointsTransformTool.js +1 -1
  139. package/views/2d/interactive/editingTools/draw/DrawGraphicTool2D.js +1 -1
  140. package/views/2d/layers/BaseLayerView2D.js +1 -1
  141. package/views/2d/layers/BaseLayerViewGL2D.js +1 -1
  142. package/views/2d/layers/BitmapTileLayerView2D.js +1 -1
  143. package/views/2d/layers/MediaLayerView2D.js +1 -1
  144. package/views/2d/layers/TileLayerView2D.js +1 -1
  145. package/views/2d/layers/VectorTileLayerView2D.js +1 -1
  146. package/views/2d/layers/WMTSLayerView2D.js +1 -1
  147. package/views/2d/layers/features/support/rendererUtils.js +1 -1
  148. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  149. package/views/2d/layers/support/vectorTileDebugUtils.js +5 -0
  150. package/views/2d/tiling/TileInfoView.js +1 -1
  151. package/views/2d/tiling/TileInfoViewPOT.js +1 -1
  152. package/views/2d/tiling/TileQueue.js +1 -1
  153. package/views/2d/tiling.js +1 -1
  154. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  155. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  156. package/views/3d/interactive/editingTools/moveGraphic/GraphicMoveTool.js +1 -1
  157. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  158. package/views/3d/layers/TiledLayerView3D.js +1 -1
  159. package/views/3d/layers/VectorTileLayerView3D.js +1 -1
  160. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  161. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  162. package/views/3d/layers/support/featureReference.js +1 -1
  163. package/views/3d/support/LaserLineRenderer.js +1 -1
  164. package/views/3d/terrain/Overlay.js +1 -1
  165. package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
  166. package/views/3d/terrain/OverlayRenderTarget.js +1 -1
  167. package/views/3d/terrain/OverlayRenderer.js +1 -1
  168. package/views/3d/terrain/TerrainRenderer.js +1 -1
  169. package/views/3d/terrain/TileCompositor.js +1 -1
  170. package/views/3d/terrain/TileRenderer.js +1 -1
  171. package/views/3d/terrain/TilingScheme.js +1 -1
  172. package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
  173. package/views/3d/webgl-engine/core/shaderModules/interfaces.js +1 -1
  174. package/views/3d/webgl-engine/effects/ScreenSpaceGeometry.js +1 -1
  175. package/views/3d/webgl-engine/effects/SmaaRenderPass.js +1 -1
  176. package/views/3d/webgl-engine/lib/CompositingHelper.js +1 -1
  177. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  178. package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
  179. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  180. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  181. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  182. package/views/3d/webgl-engine/lib/WebGLLayer.js +1 -1
  183. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  184. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  185. package/views/3d/webgl-engine/parts/requireUtils.js +1 -1
  186. package/views/MapView.js +1 -1
  187. package/views/animation/pointToPoint/Path.js +1 -1
  188. package/views/draw/DrawOperation.js +1 -1
  189. package/views/draw/support/Reshape.js +1 -1
  190. package/views/draw/support/createUtils.js +1 -1
  191. package/views/interactive/SegmentLabels.js +1 -1
  192. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  193. package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
  194. package/views/interactive/editGeometry/operations/UndoGroup.js +1 -1
  195. package/views/layers/GroupLayerView.js +1 -1
  196. package/views/webgl/ProgramCache.js +1 -1
  197. package/webscene/spec-certification/api.js +1 -1
  198. package/webscene/spec-certification/spec.js +1 -1
  199. package/webscene/spec-certification/utils.js +1 -1
  200. package/widgets/BuildingExplorer/BuildingNumericFilterViewModel.js +1 -1
  201. package/widgets/BuildingExplorer/BuildingPhase.js +1 -1
  202. package/widgets/BuildingExplorer/support/validation.js +1 -1
  203. package/widgets/Directions/support/resources.js +1 -1
  204. package/widgets/Directions.js +1 -1
  205. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  206. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  207. package/widgets/FeatureForm/FieldInput.js +1 -1
  208. package/widgets/FeatureForm/FormExpressionsManager.js +1 -1
  209. package/widgets/FeatureForm.js +1 -1
  210. package/widgets/Features.js +1 -1
  211. package/widgets/Histogram/HistogramViewModel.js +1 -1
  212. package/widgets/HistogramRangeSlider/HistogramRangeSliderViewModel.js +1 -1
  213. package/widgets/Legend/styles/Card.js +1 -1
  214. package/widgets/Legend/styles/support/univariateUtils.js +1 -1
  215. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  216. package/widgets/Legend/support/colorRampUtils.js +1 -1
  217. package/widgets/Legend/support/sizeRampUtils.js +1 -1
  218. package/widgets/Legend/support/utils.js +1 -1
  219. package/widgets/Popup.js +1 -1
  220. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
  221. package/widgets/ScaleRangeSlider/ScaleRanges.js +1 -1
  222. package/widgets/ValuePicker/ValuePickerSlider.js +1 -1
  223. package/widgets/smartMapping/ClassedSizeSlider.js +1 -1
  224. package/widgets/smartMapping/ColorSizeSlider.js +1 -1
  225. package/widgets/smartMapping/HeatmapSlider/HeatmapSliderViewModel.js +1 -1
  226. package/widgets/smartMapping/SizeSlider.js +1 -1
  227. package/widgets/smartMapping/SmartMappingPrimaryHandleSliderViewModel.js +1 -1
  228. package/widgets/smartMapping/SmartMappingSliderViewModel.js +1 -1
  229. package/assets/esri/core/workers/chunks/0210f4c2e1f3ed13041b.js +0 -1
  230. package/assets/esri/core/workers/chunks/07bb40162d97d098bc19.js +0 -1
  231. package/assets/esri/core/workers/chunks/0a18317566c1fcb68422.js +0 -1
  232. package/assets/esri/core/workers/chunks/0de65e03db8c611af9fb.js +0 -1
  233. package/assets/esri/core/workers/chunks/1a60d23a92bcf91dbb22.js +0 -1
  234. package/assets/esri/core/workers/chunks/205a0b34b698d5329854.js +0 -1
  235. package/assets/esri/core/workers/chunks/25211d5904ee9d5f4a9d.js +0 -1
  236. package/assets/esri/core/workers/chunks/26b12d1ea713c1e07701.js +0 -1
  237. package/assets/esri/core/workers/chunks/2bfa7ee324c32a56b0d3.js +0 -1
  238. package/assets/esri/core/workers/chunks/4510a17839405146130b.js +0 -1
  239. package/assets/esri/core/workers/chunks/524156c3f5383c2dd0e3.js +0 -1
  240. package/assets/esri/core/workers/chunks/59666ecb7c2c1f5a13b2.js +0 -1
  241. package/assets/esri/core/workers/chunks/5c005c9514354c77ec27.js +0 -1
  242. package/assets/esri/core/workers/chunks/620ec5c75561183d3d73.js +0 -1
  243. package/assets/esri/core/workers/chunks/68512670816f59c0e6a5.js +0 -1
  244. package/assets/esri/core/workers/chunks/6c7374ebc18b46b3480a.js +0 -1
  245. package/assets/esri/core/workers/chunks/75ba2af92da232067adb.js +0 -1
  246. package/assets/esri/core/workers/chunks/7c1f0598a016516dcec3.js +0 -1
  247. package/assets/esri/core/workers/chunks/8dcec8d1b670d2b7ea2b.js +0 -1
  248. package/assets/esri/core/workers/chunks/8e07dfb6fc2673b640cb.js +0 -1
  249. package/assets/esri/core/workers/chunks/9050b167355588b7003d.js +0 -1
  250. package/assets/esri/core/workers/chunks/9230d68799f0b0b9ef36.js +0 -1
  251. package/assets/esri/core/workers/chunks/af4083f2aad5f5d49dde.js +0 -1
  252. package/assets/esri/core/workers/chunks/b0a57718a0765d1c8df0.js +0 -1
  253. package/assets/esri/core/workers/chunks/b431b81a7bf45dd527da.js +0 -1
  254. package/assets/esri/core/workers/chunks/bda311ad48efdb265939.js +0 -1
  255. package/assets/esri/core/workers/chunks/d5cce09fbe16cbb8fee4.js +0 -1
  256. package/assets/esri/core/workers/chunks/da547c3cabe4a89c3ce6.js +0 -1
  257. package/assets/esri/core/workers/chunks/dd295fa57b45b7ec4ec5.js +0 -1
  258. package/assets/esri/core/workers/chunks/f553b464e969d45bf451.js +0 -1
  259. package/assets/esri/core/workers/chunks/f5865294983eb160de8c.js +0 -1
  260. package/assets/esri/core/workers/chunks/fdb7b1fbdb6fe091ad83.js +0 -1
  261. package/views/2d/tiling/PagedTileQueue.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{GeometryCursor as s}from"../../../geometry/GeometryCursor.js";import{collectMultipath as t}from"../../../geometry/geometryCursorCollectUtils.js";import{setId as i}from"../CIMCursor.js";import{GeometricEffectControlMeasureLineRule as h}from"../enums.js";class e{static local(){return null===e.instance&&(e.instance=new e),e.instance}execute(s,t,i,h,e){return new r(s,t,i)}}e.instance=null;class r{constructor(s,t,i){this._defaultPointSize=20,this._inputGeometries=s,this._geomUnitsPerPoint=i,this._rule=t.rule??h.FullGeometry,this._defaultSize=this._defaultPointSize*i}next(){let i;for(;i=this._inputGeometries.next();){const h=this._processGeom(t(i));if(h&&h.length)return s.fromJSONCIM({paths:h})}return null}_clone(s){return[s[0],s[1]]}_mid(s,t){return[(s[0]+t[0])/2,(s[1]+t[1])/2]}_mix(s,t,i,h){return[s[0]*t+i[0]*h,s[1]*t+i[1]*h]}_add(s,t){return[s[0]+t[0],s[1]+t[1]]}_add2(s,t,i){return[s[0]+t,s[1]+i]}_sub(s,t){return[s[0]-t[0],s[1]-t[1]]}_dist(s,t){return Math.sqrt((s[0]-t[0])*(s[0]-t[0])+(s[1]-t[1])*(s[1]-t[1]))}_norm(s){return Math.sqrt(s[0]*s[0]+s[1]*s[1])}_normalize(s,t=1){const i=t/this._norm(s);s[0]*=i,s[1]*=i}_leftPerpendicular(s){const t=-s[1],i=s[0];s[0]=t,s[1]=i}_leftPerp(s){return[-s[1],s[0]]}_rightPerpendicular(s){const t=s[1],i=-s[0];s[0]=t,s[1]=i}_rightPerp(s){return[s[1],-s[0]]}_dotProduct(s,t){return s[0]*t[0]+s[1]*t[1]}_crossProduct(s,t){return s[0]*t[1]-s[1]*t[0]}_rotateDirect(s,t,i){const h=s[0]*t-s[1]*i,e=s[0]*i+s[1]*t;s[0]=h,s[1]=e}_makeCtrlPt(s){const t=[s[0],s[1]];return i(t,1),t}_addAngledTicks(s,t,i,h){const e=this._sub(i,t);this._normalize(e);const r=this._crossProduct(e,this._sub(h,t));let _;_=r>0?this._rightPerp(e):this._leftPerp(e);const c=Math.abs(r)/2,u=[];u.push([t[0]+(_[0]-e[0])*c,t[1]+(_[1]-e[1])*c]),u.push(t),u.push(i),u.push([i[0]+(_[0]+e[0])*c,i[1]+(_[1]+e[1])*c]),s.push(u)}_addBezier2(s,t,i,h,e){if(0==e--)return void s.push(h);const r=this._mid(t,i),_=this._mid(i,h),c=this._mid(r,_);this._addBezier2(s,t,r,c,e),this._addBezier2(s,c,_,h,e)}_addBezier3(s,t,i,h,e,r){if(0==r--)return void s.push(e);const _=this._mid(t,i),c=this._mid(i,h),u=this._mid(h,e),o=this._mid(_,c),n=this._mid(c,u),a=this._mid(o,n);this._addBezier3(s,t,_,o,a,r),this._addBezier3(s,a,n,u,e,r)}_add90DegArc(s,t,i,h,e){const r=e??this._crossProduct(this._sub(i,t),this._sub(h,t))>0,_=this._mid(t,i),c=this._sub(_,t);r?this._leftPerpendicular(c):this._rightPerpendicular(c),_[0]+=c[0],_[1]+=c[1],this._addBezier3(s,t,this._mix(t,.33333,_,.66667),this._mix(i,.33333,_,.66667),i,4)}_addArrow(s,t,i){const h=t[0],e=t[1],r=t.at(-1),_=this._sub(h,e);this._normalize(_);const c=this._crossProduct(_,this._sub(r,e)),u=.5*c,o=this._leftPerp(_),n=[r[0]-o[0]*c,r[1]-o[1]*c],a=t.length-1,p=[];p.push(i?[-o[0],-o[1]]:o);let d=[-_[0],-_[1]];for(let l=1;l<a-1;l++){const s=this._sub(t[l+1],t[l]);this._normalize(s);const i=this._dotProduct(s,d),h=this._crossProduct(s,d),e=Math.sqrt((1+i)/2),r=this._sub(s,d);this._normalize(r),r[0]/=e,r[1]/=e,p.push(h<0?[-r[0],-r[1]]:r),d=s}p.push(this._rightPerp(d));for(let l=p.length-1;l>0;l--)s.push([t[l][0]+p[l][0]*u,t[l][1]+p[l][1]*u]);s.push([n[0]+p[0][0]*u,n[1]+p[0][1]*u]),s.push([n[0]+p[0][0]*c,n[1]+p[0][1]*c]),s.push(h),s.push([n[0]-p[0][0]*c,n[1]-p[0][1]*c]),s.push([n[0]-p[0][0]*u,n[1]-p[0][1]*u]);for(let l=1;l<p.length;l++)s.push([t[l][0]-p[l][0]*u,t[l][1]-p[l][1]*u])}_cp2(s,t,i){return s.length>=2?s[1]:this._add2(s[0],t*this._defaultSize,i*this._defaultSize)}_cp3(s,t,i,h){if(s.length>=3)return s[2];const e=this._mix(s[0],1-i,t,i),r=this._sub(t,s[0]);return this._normalize(r),this._rightPerpendicular(r),[e[0]+r[0]*h*this._defaultSize,e[1]+r[1]*h*this._defaultSize]}_arrowPath(s){if(s.length>2)return s;const t=s[0],i=this._cp2(s,-4,0),h=this._sub(t,i);this._normalize(h);const e=this._rightPerp(h);return[t,i,[t[0]+(e[0]-h[0])*this._defaultSize,t[1]+(e[1]-h[1])*this._defaultSize]]}_arrowLastSeg(s){const t=s[0],i=this._cp2(s,-4,0);let h;if(s.length>=3)h=s.at(-1);else{const s=this._sub(t,i);this._normalize(s);const e=this._rightPerp(s);h=[t[0]+(e[0]-s[0])*this._defaultSize,t[1]+(e[1]-s[1])*this._defaultSize]}return[i,h]}_processGeom(s){if(!s)return null;const t=[];for(const e of s){if(!e||0===e.length)continue;const s=e.length;let r=e[0];switch(this._rule){case h.PerpendicularFromFirstSegment:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,4),h=[];h.push(i),h.push(this._mid(r,s)),t.push(h);break}case h.ReversedFirstSegment:{const s=this._cp2(e,0,-1);t.push([s,r]);break}case h.PerpendicularToSecondSegment:{const s=this._cp2(e,-4,1),i=this._cp3(e,s,.882353,-1.94),h=[];h.push(this._mid(s,i)),h.push(r),t.push(h);break}case h.SecondSegmentWithTicks:{const s=this._cp2(e,-4,1),i=this._cp3(e,s,.882353,-1.94),h=this._sub(i,s);let _;_=this._crossProduct(h,this._sub(r,s))>0?this._rightPerp(_):this._leftPerp(h);const c=[];c.push([s[0]+(_[0]-h[0])/3,s[1]+(_[1]-h[1])/3]),c.push(s),c.push(i),c.push([i[0]+(_[0]+h[0])/3,i[1]+(_[1]+h[1])/3]),t.push(c);break}case h.DoublePerpendicular:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,3),h=this._mid(r,s),_=this._sub(h,i);this._normalize(_);const c=this._crossProduct(_,this._sub(r,i));this._leftPerpendicular(_);const u=[];u.push(r),u.push([i[0]+_[0]*c,i[1]+_[1]*c]),t.push(u);const o=[];o.push([i[0]-_[0]*c,i[1]-_[1]*c]),o.push(s),t.push(o);break}case h.OppositeToFirstSegment:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,3),h=this._mid(r,s),_=this._sub(h,i);this._normalize(_);const c=this._crossProduct(_,this._sub(r,i));this._leftPerpendicular(_);const u=[];u.push([i[0]+_[0]*c,i[1]+_[1]*c]),u.push([i[0]-_[0]*c,i[1]-_[1]*c]),t.push(u);break}case h.TriplePerpendicular:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,4),h=this._mid(r,s),_=this._sub(h,i);this._normalize(_);const c=this._crossProduct(_,this._sub(r,i));this._leftPerpendicular(_);const u=[];u.push([i[0]+_[0]*c*.8,i[1]+_[1]*c*.8]),u.push([h[0]+.8*(r[0]-h[0]),h[1]+.8*(r[1]-h[1])]),t.push(u),t.push([i,h]);const o=[];o.push([i[0]-_[0]*c*.8,i[1]-_[1]*c*.8]),o.push([h[0]+.8*(s[0]-h[0]),h[1]+.8*(s[1]-h[1])]),t.push(o);break}case h.HalfCircleFirstSegment:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,4),h=this._mid(r,s);let _=this._sub(s,r);const c=Math.cos(Math.PI/18),u=Math.sin(Math.PI/18),o=Math.sqrt((1+c)/2),n=Math.sqrt((1-c)/2),a=[];let p;this._crossProduct(_,this._sub(i,r))>0?(a.push(r),_=this._sub(r,h),p=s):(a.push(s),_=this._sub(s,h),p=r),this._rotateDirect(_,o,n),_[0]/=o,_[1]/=o;for(let t=1;t<=18;t++)a.push(this._add(h,_)),this._rotateDirect(_,c,u);a.push(p),t.push(a);break}case h.HalfCircleSecondSegment:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,1,-1);let h=this._sub(r,s);this._normalize(h);const _=this._crossProduct(h,this._sub(i,s))/2;this._leftPerpendicular(h);const c=[s[0]+h[0]*_,s[1]+h[1]*_];h=this._sub(s,c);const u=Math.cos(Math.PI/18);let o=Math.sin(Math.PI/18);_>0&&(o=-o);const n=[s];for(let t=1;t<=18;t++)this._rotateDirect(h,u,o),n.push(this._add(c,h));t.push(n);break}case h.HalfCircleExtended:{const i=this._cp2(e,0,-2),h=this._cp3(e,i,1,-1);let _;if(s>=4)_=e[3];else{const s=this._sub(r,i);_=this._add(h,s)}const c=this._dist(i,h)/2/.75,u=this._sub(i,r);this._normalize(u,c);const o=this._sub(h,_);this._normalize(o,c);const n=[_,h];t.push(n);const a=[this._clone(h)];this._addBezier3(a,h,this._add(h,o),this._add(i,u),i,4),a.push(r),t.push(a);break}case h.OpenCircle:{const s=this._cp2(e,-2,0),i=this._sub(s,r),h=Math.cos(Math.PI/18),_=-Math.sin(Math.PI/18),c=[s];for(let t=1;t<=33;t++)this._rotateDirect(i,h,_),c.push(this._add(r,i));t.push(c);break}case h.CoverageEdgesWithTicks:{const i=this._cp2(e,0,-1);let h,_;if(s>=3)h=e[2];else{const s=this._sub(i,r),t=this._leftPerp(s);h=[r[0]+t[0]-.25*s[0],r[1]+t[1]-.25*s[1]]}if(s>=4)_=e[3];else{const s=this._mid(r,i),t=this._sub(r,i);this._normalize(t),this._leftPerpendicular(t);const e=this._crossProduct(t,this._sub(h,s));this._rightPerpendicular(t),_=[h[0]+t[0]*e*2,h[1]+t[1]*e*2]}const c=this._sub(i,r);let u,o;u=this._crossProduct(c,this._sub(h,r))>0?this._rightPerp(c):this._leftPerp(c),o=[],o.push(h),o.push(r),o.push([r[0]+(u[0]-c[0])/3,r[1]+(u[1]-c[1])/3]),t.push(o),u=this._crossProduct(c,this._sub(_,i))>0?this._rightPerp(u):this._leftPerp(c),o=[],o.push([i[0]+(u[0]+c[0])/3,i[1]+(u[1]+c[1])/3]),o.push(i),o.push(_),t.push(o);break}case h.GapExtentWithDoubleTicks:{const i=this._cp2(e,0,2),h=this._cp3(e,i,0,1);let _;if(s>=4)_=e[3];else{const s=this._sub(i,r);_=this._add(h,s)}this._addAngledTicks(t,r,i,this._mid(h,_)),this._addAngledTicks(t,h,_,this._mid(r,i));break}case h.GapExtentMidline:{const i=this._cp2(e,2,0),h=this._cp3(e,i,0,1);let _;if(s>=4)_=e[3];else{const s=this._sub(i,r);_=this._add(h,s)}const c=[];c.push(this._mid(r,h)),c.push(this._mid(i,_)),t.push(c);break}case h.Chevron:{const i=this._cp2(e,-1,-1);let h;if(s>=3)h=e[2];else{const s=this._sub(i,r);this._leftPerpendicular(s),h=this._add(r,s)}t.push([i,this._makeCtrlPt(r),h]);break}case h.PerpendicularWithArc:{const s=this._cp2(e,0,-2),i=this._cp3(e,s,.5,-1);let h=this._sub(s,r);const _=this._norm(h);h[0]/=_,h[1]/=_;const c=this._crossProduct(h,this._sub(i,r));let u=this._dotProduct(h,this._sub(i,r));u<.05*_?u=.05*_:u>.95*_&&(u=.95*_);const o=[r[0]+h[0]*u,r[1]+h[1]*u];this._leftPerpendicular(h);let n=[];n.push([o[0]-h[0]*c,o[1]-h[1]*c]),n.push([o[0]+h[0]*c,o[1]+h[1]*c]),t.push(n);const a=[s[0]+h[0]*c,s[1]+h[1]*c];h=this._sub(s,a);const p=Math.cos(Math.PI/18);let d=Math.sin(Math.PI/18);c<0&&(d=-d),n=[r,s];for(let t=1;t<=9;t++)this._rotateDirect(h,p,d),n.push(this._add(a,h));t.push(n);break}case h.ClosedHalfCircle:{const s=this._cp2(e,2,0),i=this._mid(r,s),h=this._sub(s,i),_=Math.cos(Math.PI/18),c=Math.sin(Math.PI/18),u=[r,s];for(let t=1;t<=18;t++)this._rotateDirect(h,_,c),u.push(this._add(i,h));t.push(u);break}case h.TripleParallelExtended:{const s=this._cp2(e,0,-2),h=this._cp3(e,s,1,-2),_=this._mid(r,s),c=this._sub(h,s);this._normalize(c);const u=Math.abs(this._crossProduct(c,this._sub(_,s)))/2,o=this._dist(s,h),n=[s,r];n.push([r[0]+c[0]*o*.5,r[1]+c[1]*o*.5]),t.push(n);const a=[];a.push([_[0]-c[0]*u,_[1]-c[1]*u]),a.push([_[0]+c[0]*o*.375,_[1]+c[1]*o*.375]),i(a.at(-1),1),a.push([_[0]+c[0]*o*.75,_[1]+c[1]*o*.75]),t.push(a);const p=[s,h];t.push(p);break}case h.ParallelWithTicks:{const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._sub(i,s);this._normalize(h);const _=this._crossProduct(h,this._sub(i,r));this._leftPerpendicular(h),this._addAngledTicks(t,r,s,i),this._addAngledTicks(t,this._mix(r,1,h,_),this._mix(s,1,h,_),this._mid(r,s));break}case h.Parallel:{const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._sub(s,r);this._normalize(h);const _=this._leftPerp(h),c=this._crossProduct(h,this._sub(i,r));let u=[r,s];t.push(u),u=[],u.push([r[0]+_[0]*c,r[1]+_[1]*c]),u.push([s[0]+_[0]*c,s[1]+_[1]*c]),t.push(u);break}case h.PerpendicularToFirstSegment:{const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._mid(r,s),_=this._sub(s,r);this._normalize(_);const c=this._crossProduct(_,this._sub(i,r));this._leftPerpendicular(_);const u=[];u.push([h[0]-_[0]*c*.25,h[1]-_[1]*c*.25]),u.push([h[0]+_[0]*c*1.25,h[1]+_[1]*c*1.25]),t.push(u);break}case h.ParallelOffset:{const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._sub(s,r);this._normalize(h);const _=this._crossProduct(h,this._sub(i,r));this._leftPerpendicular(h);const c=[];c.push([r[0]-h[0]*_,r[1]-h[1]*_]),c.push([s[0]-h[0]*_,s[1]-h[1]*_]),t.push(c);const u=[];u.push([r[0]+h[0]*_,r[1]+h[1]*_]),u.push([s[0]+h[0]*_,s[1]+h[1]*_]),t.push(u);break}case h.OffsetOpposite:{const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._sub(s,r);this._normalize(h);const _=this._crossProduct(h,this._sub(i,r));this._leftPerpendicular(h);const c=[];c.push([r[0]-h[0]*_,r[1]-h[1]*_]),c.push([s[0]-h[0]*_,s[1]-h[1]*_]),t.push(c);break}case h.OffsetSame:{const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._sub(s,r);this._normalize(h);const _=this._crossProduct(h,this._sub(i,r));this._leftPerpendicular(h);const c=[];c.push([r[0]+h[0]*_,r[1]+h[1]*_]),c.push([s[0]+h[0]*_,s[1]+h[1]*_]),t.push(c);break}case h.CircleWithArc:{let h=this._cp2(e,3,0);const _=this._cp3(e,h,.5,-1);let c,u;if(s>=4)c=e[3],u=this._crossProduct(this._sub(c,h),this._sub(_,h))>0;else{c=h,u=this._crossProduct(this._sub(c,r),this._sub(_,r))>0;const s=24*this._geomUnitsPerPoint,t=this._sub(c,r);this._normalize(t,s);const i=Math.sqrt(2)/2;this._rotateDirect(t,i,u?i:-i),h=this._add(r,t)}const o=this._sub(h,r),n=Math.cos(Math.PI/18),a=Math.sin(Math.PI/18),p=[h];for(let s=1;s<=36;s++)this._rotateDirect(o,n,a),p.push(this._add(r,o));this._add90DegArc(p,h,c,_,u),i(p.at(-8),1),t.push(p);break}case h.DoubleJog:{let i,h,_=this._cp2(e,-3,1);if(i=s>=3?e[2]:this._add(r,this._sub(r,_)),s>=4)h=e[3];else{const s=r;r=_,h=i;const t=this._dist(r,s),e=this._dist(h,s);let c=30*this._geomUnitsPerPoint;.5*t<c&&(c=.5*t),.5*e<c&&(c=.5*e),_=this._mix(r,c/t,s,(t-c)/t),i=this._mix(h,c/e,s,(e-c)/e)}const c=this._mid(r,_),u=this._mid(h,i),o=this._dist(r,_),n=this._dist(i,h);let a=Math.min(o,n)/8;a=Math.min(a,24*this._geomUnitsPerPoint);const p=Math.cos(Math.PI/4);let d=this._sub(r,_);this._normalize(d,a),this._crossProduct(d,this._sub(h,_))>0?this._rotateDirect(d,p,-p):this._rotateDirect(d,p,p);let l=[];l.push(_),l.push(this._add(c,d)),l.push(this._sub(c,d)),l.push(r),t.push(l),d=this._sub(h,i),this._normalize(d,a),this._crossProduct(d,this._sub(r,i))<0?this._rotateDirect(d,p,p):this._rotateDirect(d,p,-p),l=[],l.push(i),l.push(this._add(u,d)),l.push(this._sub(u,d)),l.push(h),t.push(l);break}case h.PerpendicularOffset:{const s=this._cp2(e,-4,1),i=this._cp3(e,s,.882353,-1.94),h=this._sub(i,s);this._crossProduct(h,this._sub(r,s))>0?this._rightPerpendicular(h):this._leftPerpendicular(h);const _=[h[0]/8,h[1]/8],c=this._sub(this._mid(s,i),_);t.push([c,r]);break}case h.LineExcludingLastSegment:{const s=this._arrowPath(e),i=[];let h=s.length-2;for(;h--;)i.push(s[h]);t.push(i);break}case h.MultivertexArrow:{const s=this._arrowPath(e),i=[];this._addArrow(i,s,!1),t.push(i);break}case h.CrossedArrow:{const s=this._arrowPath(e),i=[];this._addArrow(i,s,!0),t.push(i);break}case h.ChevronArrow:{const[s,i]=this._arrowLastSeg(e),h=10*this._geomUnitsPerPoint,_=this._sub(r,s);this._normalize(_);const c=this._crossProduct(_,this._sub(i,s)),u=this._leftPerp(_),o=[i[0]-u[0]*c*2,i[1]-u[1]*c*2],n=[];n.push([i[0]+_[0]*h,i[1]+_[1]*h]),n.push(r),n.push([o[0]+_[0]*h,o[1]+_[1]*h]),t.push(n);break}case h.ChevronArrowOffset:{const[s,i]=this._arrowLastSeg(e),h=this._sub(r,s);this._normalize(h);const _=this._crossProduct(h,this._sub(i,s));this._leftPerpendicular(h);const c=[i[0]-h[0]*_,i[1]-h[1]*_],u=[];u.push([c[0]+h[0]*_*.5,c[1]+h[1]*_*.5]),u.push(this._mid(c,r)),u.push([c[0]-h[0]*_*.5,c[1]-h[1]*_*.5]),t.push(u);break}case h.PartialFirstSegment:{const[s,i]=this._arrowLastSeg(e),h=this._sub(r,s);this._normalize(h);const _=this._crossProduct(h,this._sub(i,s));this._leftPerpendicular(h);const c=[i[0]-h[0]*_,i[1]-h[1]*_];t.push([s,c]);break}case h.Arch:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,1),h=this._sub(r,s),_=this._mix(i,1,h,.55),c=this._mix(i,1,h,-.55),u=[r];this._addBezier2(u,r,_,i,4),this._addBezier2(u,i,c,s,4),t.push(u);break}case h.CurvedParallelTicks:{const s=this._cp2(e,-4,1),i=this._cp3(e,s,.882353,-1.94),h=this._sub(i,s);this._crossProduct(h,this._sub(r,s))>0?this._rightPerpendicular(h):this._leftPerpendicular(h);const _=[h[0]/8,h[1]/8],c=this._sub(this._mid(s,i),_),u=this._sub(this._mix(s,.75,i,.25),_),o=this._sub(this._mix(s,.25,i,.75),_),n=[s];this._addBezier2(n,s,u,c,3),this._addBezier2(n,c,o,i,3),t.push(n);for(let e=0;e<8;e++){const s=n[2*e+1],i=[this._clone(s)];i.push(this._add(s,[h[0]/4,h[1]/4])),t.push(i)}break}case h.Arc90Degrees:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,1),h=[s];this._add90DegArc(h,s,r,i),t.push(h);break}case h.FullGeometry:default:t.push(e)}}return t}}export{e as EffectControlMeasureLine};
5
+ import{GeometryCursor as s}from"../../../geometry/GeometryCursor.js";import{collectMultipath as t}from"../../../geometry/geometryCursorCollectUtils.js";import{setId as i}from"../CIMCursor.js";import{GeometricEffectControlMeasureLineRule as h}from"../enums.js";class e{static local(){return null===e.instance&&(e.instance=new e),e.instance}execute(s,t,i,h,e){return new r(s,t,i)}}e.instance=null;class r{constructor(s,t,i){this._defaultPointSize=20,this._inputGeometries=s,this._geomUnitsPerPoint=i,this._rule=t.rule??h.FullGeometry,this._defaultSize=this._defaultPointSize*i}next(){let i;for(;i=this._inputGeometries.next();){const h=this._processGeom(t(i));if(h&&h.length)return s.fromJSONCIM({paths:h})}return null}_clone(s){return[s[0],s[1]]}_mid(s,t){return[(s[0]+t[0])/2,(s[1]+t[1])/2]}_mix(s,t,i,h){return[s[0]*t+i[0]*h,s[1]*t+i[1]*h]}_add(s,t){return[s[0]+t[0],s[1]+t[1]]}_add2(s,t,i){return[s[0]+t,s[1]+i]}_sub(s,t){return[s[0]-t[0],s[1]-t[1]]}_dist(s,t){return Math.sqrt((s[0]-t[0])*(s[0]-t[0])+(s[1]-t[1])*(s[1]-t[1]))}_norm(s){return Math.sqrt(s[0]*s[0]+s[1]*s[1])}_normalize(s,t=1){const i=t/this._norm(s);s[0]*=i,s[1]*=i}_leftPerpendicular(s){const t=-s[1],i=s[0];s[0]=t,s[1]=i}_leftPerp(s){return[-s[1],s[0]]}_rightPerpendicular(s){const t=s[1],i=-s[0];s[0]=t,s[1]=i}_rightPerp(s){return[s[1],-s[0]]}_dotProduct(s,t){return s[0]*t[0]+s[1]*t[1]}_crossProduct(s,t){return s[0]*t[1]-s[1]*t[0]}_rotateDirect(s,t,i){const h=s[0]*t-s[1]*i,e=s[0]*i+s[1]*t;s[0]=h,s[1]=e}_makeCtrlPt(s){const t=[s[0],s[1]];return i(t,1),t}_addAngledTicks(s,t,i,h){const e=this._sub(i,t);this._normalize(e);const r=this._crossProduct(e,this._sub(h,t));let _;_=r>0?this._rightPerp(e):this._leftPerp(e);const c=Math.abs(r)/2,u=[];u.push([t[0]+(_[0]-e[0])*c,t[1]+(_[1]-e[1])*c]),u.push(t),u.push(i),u.push([i[0]+(_[0]+e[0])*c,i[1]+(_[1]+e[1])*c]),s.push(u)}_addBezier2(s,t,i,h,e){if(0==e--)return void s.push(h);const r=this._mid(t,i),_=this._mid(i,h),c=this._mid(r,_);this._addBezier2(s,t,r,c,e),this._addBezier2(s,c,_,h,e)}_addBezier3(s,t,i,h,e,r){if(0==r--)return void s.push(e);const _=this._mid(t,i),c=this._mid(i,h),u=this._mid(h,e),o=this._mid(_,c),n=this._mid(c,u),a=this._mid(o,n);this._addBezier3(s,t,_,o,a,r),this._addBezier3(s,a,n,u,e,r)}_add90DegArc(s,t,i,h,e){const r=e??this._crossProduct(this._sub(i,t),this._sub(h,t))>0,_=this._mid(t,i),c=this._sub(_,t);r?this._leftPerpendicular(c):this._rightPerpendicular(c),_[0]+=c[0],_[1]+=c[1],this._addBezier3(s,t,this._mix(t,.33333,_,.66667),this._mix(i,.33333,_,.66667),i,4)}_addArrow(s,t,i){const h=t[0],e=t[1],r=t[t.length-1],_=this._sub(h,e);this._normalize(_);const c=this._crossProduct(_,this._sub(r,e)),u=.5*c,o=this._leftPerp(_),n=[r[0]-o[0]*c,r[1]-o[1]*c],a=t.length-1,p=[];p.push(i?[-o[0],-o[1]]:o);let l=[-_[0],-_[1]];for(let d=1;d<a-1;d++){const s=this._sub(t[d+1],t[d]);this._normalize(s);const i=this._dotProduct(s,l),h=this._crossProduct(s,l),e=Math.sqrt((1+i)/2),r=this._sub(s,l);this._normalize(r),r[0]/=e,r[1]/=e,p.push(h<0?[-r[0],-r[1]]:r),l=s}p.push(this._rightPerp(l));for(let d=p.length-1;d>0;d--)s.push([t[d][0]+p[d][0]*u,t[d][1]+p[d][1]*u]);s.push([n[0]+p[0][0]*u,n[1]+p[0][1]*u]),s.push([n[0]+p[0][0]*c,n[1]+p[0][1]*c]),s.push(h),s.push([n[0]-p[0][0]*c,n[1]-p[0][1]*c]),s.push([n[0]-p[0][0]*u,n[1]-p[0][1]*u]);for(let d=1;d<p.length;d++)s.push([t[d][0]-p[d][0]*u,t[d][1]-p[d][1]*u])}_cp2(s,t,i){return s.length>=2?s[1]:this._add2(s[0],t*this._defaultSize,i*this._defaultSize)}_cp3(s,t,i,h){if(s.length>=3)return s[2];const e=this._mix(s[0],1-i,t,i),r=this._sub(t,s[0]);return this._normalize(r),this._rightPerpendicular(r),[e[0]+r[0]*h*this._defaultSize,e[1]+r[1]*h*this._defaultSize]}_arrowPath(s){if(s.length>2)return s;const t=s[0],i=this._cp2(s,-4,0),h=this._sub(t,i);this._normalize(h);const e=this._rightPerp(h);return[t,i,[t[0]+(e[0]-h[0])*this._defaultSize,t[1]+(e[1]-h[1])*this._defaultSize]]}_arrowLastSeg(s){const t=s[0],i=this._cp2(s,-4,0);let h;if(s.length>=3)h=s[s.length-1];else{const s=this._sub(t,i);this._normalize(s);const e=this._rightPerp(s);h=[t[0]+(e[0]-s[0])*this._defaultSize,t[1]+(e[1]-s[1])*this._defaultSize]}return[i,h]}_processGeom(s){if(!s)return null;const t=[];for(const e of s){if(!e||0===e.length)continue;const s=e.length;let r=e[0];switch(this._rule){case h.PerpendicularFromFirstSegment:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,4),h=[];h.push(i),h.push(this._mid(r,s)),t.push(h);break}case h.ReversedFirstSegment:{const s=this._cp2(e,0,-1);t.push([s,r]);break}case h.PerpendicularToSecondSegment:{const s=this._cp2(e,-4,1),i=this._cp3(e,s,.882353,-1.94),h=[];h.push(this._mid(s,i)),h.push(r),t.push(h);break}case h.SecondSegmentWithTicks:{const s=this._cp2(e,-4,1),i=this._cp3(e,s,.882353,-1.94),h=this._sub(i,s);let _;_=this._crossProduct(h,this._sub(r,s))>0?this._rightPerp(_):this._leftPerp(h);const c=[];c.push([s[0]+(_[0]-h[0])/3,s[1]+(_[1]-h[1])/3]),c.push(s),c.push(i),c.push([i[0]+(_[0]+h[0])/3,i[1]+(_[1]+h[1])/3]),t.push(c);break}case h.DoublePerpendicular:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,3),h=this._mid(r,s),_=this._sub(h,i);this._normalize(_);const c=this._crossProduct(_,this._sub(r,i));this._leftPerpendicular(_);const u=[];u.push(r),u.push([i[0]+_[0]*c,i[1]+_[1]*c]),t.push(u);const o=[];o.push([i[0]-_[0]*c,i[1]-_[1]*c]),o.push(s),t.push(o);break}case h.OppositeToFirstSegment:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,3),h=this._mid(r,s),_=this._sub(h,i);this._normalize(_);const c=this._crossProduct(_,this._sub(r,i));this._leftPerpendicular(_);const u=[];u.push([i[0]+_[0]*c,i[1]+_[1]*c]),u.push([i[0]-_[0]*c,i[1]-_[1]*c]),t.push(u);break}case h.TriplePerpendicular:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,4),h=this._mid(r,s),_=this._sub(h,i);this._normalize(_);const c=this._crossProduct(_,this._sub(r,i));this._leftPerpendicular(_);const u=[];u.push([i[0]+_[0]*c*.8,i[1]+_[1]*c*.8]),u.push([h[0]+.8*(r[0]-h[0]),h[1]+.8*(r[1]-h[1])]),t.push(u),t.push([i,h]);const o=[];o.push([i[0]-_[0]*c*.8,i[1]-_[1]*c*.8]),o.push([h[0]+.8*(s[0]-h[0]),h[1]+.8*(s[1]-h[1])]),t.push(o);break}case h.HalfCircleFirstSegment:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,4),h=this._mid(r,s);let _=this._sub(s,r);const c=Math.cos(Math.PI/18),u=Math.sin(Math.PI/18),o=Math.sqrt((1+c)/2),n=Math.sqrt((1-c)/2),a=[];let p;this._crossProduct(_,this._sub(i,r))>0?(a.push(r),_=this._sub(r,h),p=s):(a.push(s),_=this._sub(s,h),p=r),this._rotateDirect(_,o,n),_[0]/=o,_[1]/=o;for(let t=1;t<=18;t++)a.push(this._add(h,_)),this._rotateDirect(_,c,u);a.push(p),t.push(a);break}case h.HalfCircleSecondSegment:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,1,-1);let h=this._sub(r,s);this._normalize(h);const _=this._crossProduct(h,this._sub(i,s))/2;this._leftPerpendicular(h);const c=[s[0]+h[0]*_,s[1]+h[1]*_];h=this._sub(s,c);const u=Math.cos(Math.PI/18);let o=Math.sin(Math.PI/18);_>0&&(o=-o);const n=[s];for(let t=1;t<=18;t++)this._rotateDirect(h,u,o),n.push(this._add(c,h));t.push(n);break}case h.HalfCircleExtended:{const i=this._cp2(e,0,-2),h=this._cp3(e,i,1,-1);let _;if(s>=4)_=e[3];else{const s=this._sub(r,i);_=this._add(h,s)}const c=this._dist(i,h)/2/.75,u=this._sub(i,r);this._normalize(u,c);const o=this._sub(h,_);this._normalize(o,c);const n=[_,h];t.push(n);const a=[this._clone(h)];this._addBezier3(a,h,this._add(h,o),this._add(i,u),i,4),a.push(r),t.push(a);break}case h.OpenCircle:{const s=this._cp2(e,-2,0),i=this._sub(s,r),h=Math.cos(Math.PI/18),_=-Math.sin(Math.PI/18),c=[s];for(let t=1;t<=33;t++)this._rotateDirect(i,h,_),c.push(this._add(r,i));t.push(c);break}case h.CoverageEdgesWithTicks:{const i=this._cp2(e,0,-1);let h,_;if(s>=3)h=e[2];else{const s=this._sub(i,r),t=this._leftPerp(s);h=[r[0]+t[0]-.25*s[0],r[1]+t[1]-.25*s[1]]}if(s>=4)_=e[3];else{const s=this._mid(r,i),t=this._sub(r,i);this._normalize(t),this._leftPerpendicular(t);const e=this._crossProduct(t,this._sub(h,s));this._rightPerpendicular(t),_=[h[0]+t[0]*e*2,h[1]+t[1]*e*2]}const c=this._sub(i,r);let u,o;u=this._crossProduct(c,this._sub(h,r))>0?this._rightPerp(c):this._leftPerp(c),o=[],o.push(h),o.push(r),o.push([r[0]+(u[0]-c[0])/3,r[1]+(u[1]-c[1])/3]),t.push(o),u=this._crossProduct(c,this._sub(_,i))>0?this._rightPerp(u):this._leftPerp(c),o=[],o.push([i[0]+(u[0]+c[0])/3,i[1]+(u[1]+c[1])/3]),o.push(i),o.push(_),t.push(o);break}case h.GapExtentWithDoubleTicks:{const i=this._cp2(e,0,2),h=this._cp3(e,i,0,1);let _;if(s>=4)_=e[3];else{const s=this._sub(i,r);_=this._add(h,s)}this._addAngledTicks(t,r,i,this._mid(h,_)),this._addAngledTicks(t,h,_,this._mid(r,i));break}case h.GapExtentMidline:{const i=this._cp2(e,2,0),h=this._cp3(e,i,0,1);let _;if(s>=4)_=e[3];else{const s=this._sub(i,r);_=this._add(h,s)}const c=[];c.push(this._mid(r,h)),c.push(this._mid(i,_)),t.push(c);break}case h.Chevron:{const i=this._cp2(e,-1,-1);let h;if(s>=3)h=e[2];else{const s=this._sub(i,r);this._leftPerpendicular(s),h=this._add(r,s)}t.push([i,this._makeCtrlPt(r),h]);break}case h.PerpendicularWithArc:{const s=this._cp2(e,0,-2),i=this._cp3(e,s,.5,-1);let h=this._sub(s,r);const _=this._norm(h);h[0]/=_,h[1]/=_;const c=this._crossProduct(h,this._sub(i,r));let u=this._dotProduct(h,this._sub(i,r));u<.05*_?u=.05*_:u>.95*_&&(u=.95*_);const o=[r[0]+h[0]*u,r[1]+h[1]*u];this._leftPerpendicular(h);let n=[];n.push([o[0]-h[0]*c,o[1]-h[1]*c]),n.push([o[0]+h[0]*c,o[1]+h[1]*c]),t.push(n);const a=[s[0]+h[0]*c,s[1]+h[1]*c];h=this._sub(s,a);const p=Math.cos(Math.PI/18);let l=Math.sin(Math.PI/18);c<0&&(l=-l),n=[r,s];for(let t=1;t<=9;t++)this._rotateDirect(h,p,l),n.push(this._add(a,h));t.push(n);break}case h.ClosedHalfCircle:{const s=this._cp2(e,2,0),i=this._mid(r,s),h=this._sub(s,i),_=Math.cos(Math.PI/18),c=Math.sin(Math.PI/18),u=[r,s];for(let t=1;t<=18;t++)this._rotateDirect(h,_,c),u.push(this._add(i,h));t.push(u);break}case h.TripleParallelExtended:{const s=this._cp2(e,0,-2),h=this._cp3(e,s,1,-2),_=this._mid(r,s),c=this._sub(h,s);this._normalize(c);const u=Math.abs(this._crossProduct(c,this._sub(_,s)))/2,o=this._dist(s,h),n=[s,r];n.push([r[0]+c[0]*o*.5,r[1]+c[1]*o*.5]),t.push(n);const a=[];a.push([_[0]-c[0]*u,_[1]-c[1]*u]),a.push([_[0]+c[0]*o*.375,_[1]+c[1]*o*.375]),i(a[a.length-1],1),a.push([_[0]+c[0]*o*.75,_[1]+c[1]*o*.75]),t.push(a);const p=[s,h];t.push(p);break}case h.ParallelWithTicks:{const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._sub(i,s);this._normalize(h);const _=this._crossProduct(h,this._sub(i,r));this._leftPerpendicular(h),this._addAngledTicks(t,r,s,i),this._addAngledTicks(t,this._mix(r,1,h,_),this._mix(s,1,h,_),this._mid(r,s));break}case h.Parallel:{const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._sub(s,r);this._normalize(h);const _=this._leftPerp(h),c=this._crossProduct(h,this._sub(i,r));let u=[r,s];t.push(u),u=[],u.push([r[0]+_[0]*c,r[1]+_[1]*c]),u.push([s[0]+_[0]*c,s[1]+_[1]*c]),t.push(u);break}case h.PerpendicularToFirstSegment:{const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._mid(r,s),_=this._sub(s,r);this._normalize(_);const c=this._crossProduct(_,this._sub(i,r));this._leftPerpendicular(_);const u=[];u.push([h[0]-_[0]*c*.25,h[1]-_[1]*c*.25]),u.push([h[0]+_[0]*c*1.25,h[1]+_[1]*c*1.25]),t.push(u);break}case h.ParallelOffset:{const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._sub(s,r);this._normalize(h);const _=this._crossProduct(h,this._sub(i,r));this._leftPerpendicular(h);const c=[];c.push([r[0]-h[0]*_,r[1]-h[1]*_]),c.push([s[0]-h[0]*_,s[1]-h[1]*_]),t.push(c);const u=[];u.push([r[0]+h[0]*_,r[1]+h[1]*_]),u.push([s[0]+h[0]*_,s[1]+h[1]*_]),t.push(u);break}case h.OffsetOpposite:{const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._sub(s,r);this._normalize(h);const _=this._crossProduct(h,this._sub(i,r));this._leftPerpendicular(h);const c=[];c.push([r[0]-h[0]*_,r[1]-h[1]*_]),c.push([s[0]-h[0]*_,s[1]-h[1]*_]),t.push(c);break}case h.OffsetSame:{const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._sub(s,r);this._normalize(h);const _=this._crossProduct(h,this._sub(i,r));this._leftPerpendicular(h);const c=[];c.push([r[0]+h[0]*_,r[1]+h[1]*_]),c.push([s[0]+h[0]*_,s[1]+h[1]*_]),t.push(c);break}case h.CircleWithArc:{let h=this._cp2(e,3,0);const _=this._cp3(e,h,.5,-1);let c,u;if(s>=4)c=e[3],u=this._crossProduct(this._sub(c,h),this._sub(_,h))>0;else{c=h,u=this._crossProduct(this._sub(c,r),this._sub(_,r))>0;const s=24*this._geomUnitsPerPoint,t=this._sub(c,r);this._normalize(t,s);const i=Math.sqrt(2)/2;this._rotateDirect(t,i,u?i:-i),h=this._add(r,t)}const o=this._sub(h,r),n=Math.cos(Math.PI/18),a=Math.sin(Math.PI/18),p=[h];for(let s=1;s<=36;s++)this._rotateDirect(o,n,a),p.push(this._add(r,o));this._add90DegArc(p,h,c,_,u),i(p[p.length-8],1),t.push(p);break}case h.DoubleJog:{let i,h,_=this._cp2(e,-3,1);if(i=s>=3?e[2]:this._add(r,this._sub(r,_)),s>=4)h=e[3];else{const s=r;r=_,h=i;const t=this._dist(r,s),e=this._dist(h,s);let c=30*this._geomUnitsPerPoint;.5*t<c&&(c=.5*t),.5*e<c&&(c=.5*e),_=this._mix(r,c/t,s,(t-c)/t),i=this._mix(h,c/e,s,(e-c)/e)}const c=this._mid(r,_),u=this._mid(h,i),o=this._dist(r,_),n=this._dist(i,h);let a=Math.min(o,n)/8;a=Math.min(a,24*this._geomUnitsPerPoint);const p=Math.cos(Math.PI/4);let l=this._sub(r,_);this._normalize(l,a),this._crossProduct(l,this._sub(h,_))>0?this._rotateDirect(l,p,-p):this._rotateDirect(l,p,p);let d=[];d.push(_),d.push(this._add(c,l)),d.push(this._sub(c,l)),d.push(r),t.push(d),l=this._sub(h,i),this._normalize(l,a),this._crossProduct(l,this._sub(r,i))<0?this._rotateDirect(l,p,p):this._rotateDirect(l,p,-p),d=[],d.push(i),d.push(this._add(u,l)),d.push(this._sub(u,l)),d.push(h),t.push(d);break}case h.PerpendicularOffset:{const s=this._cp2(e,-4,1),i=this._cp3(e,s,.882353,-1.94),h=this._sub(i,s);this._crossProduct(h,this._sub(r,s))>0?this._rightPerpendicular(h):this._leftPerpendicular(h);const _=[h[0]/8,h[1]/8],c=this._sub(this._mid(s,i),_);t.push([c,r]);break}case h.LineExcludingLastSegment:{const s=this._arrowPath(e),i=[];let h=s.length-2;for(;h--;)i.push(s[h]);t.push(i);break}case h.MultivertexArrow:{const s=this._arrowPath(e),i=[];this._addArrow(i,s,!1),t.push(i);break}case h.CrossedArrow:{const s=this._arrowPath(e),i=[];this._addArrow(i,s,!0),t.push(i);break}case h.ChevronArrow:{const[s,i]=this._arrowLastSeg(e),h=10*this._geomUnitsPerPoint,_=this._sub(r,s);this._normalize(_);const c=this._crossProduct(_,this._sub(i,s)),u=this._leftPerp(_),o=[i[0]-u[0]*c*2,i[1]-u[1]*c*2],n=[];n.push([i[0]+_[0]*h,i[1]+_[1]*h]),n.push(r),n.push([o[0]+_[0]*h,o[1]+_[1]*h]),t.push(n);break}case h.ChevronArrowOffset:{const[s,i]=this._arrowLastSeg(e),h=this._sub(r,s);this._normalize(h);const _=this._crossProduct(h,this._sub(i,s));this._leftPerpendicular(h);const c=[i[0]-h[0]*_,i[1]-h[1]*_],u=[];u.push([c[0]+h[0]*_*.5,c[1]+h[1]*_*.5]),u.push(this._mid(c,r)),u.push([c[0]-h[0]*_*.5,c[1]-h[1]*_*.5]),t.push(u);break}case h.PartialFirstSegment:{const[s,i]=this._arrowLastSeg(e),h=this._sub(r,s);this._normalize(h);const _=this._crossProduct(h,this._sub(i,s));this._leftPerpendicular(h);const c=[i[0]-h[0]*_,i[1]-h[1]*_];t.push([s,c]);break}case h.Arch:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,1),h=this._sub(r,s),_=this._mix(i,1,h,.55),c=this._mix(i,1,h,-.55),u=[r];this._addBezier2(u,r,_,i,4),this._addBezier2(u,i,c,s,4),t.push(u);break}case h.CurvedParallelTicks:{const s=this._cp2(e,-4,1),i=this._cp3(e,s,.882353,-1.94),h=this._sub(i,s);this._crossProduct(h,this._sub(r,s))>0?this._rightPerpendicular(h):this._leftPerpendicular(h);const _=[h[0]/8,h[1]/8],c=this._sub(this._mid(s,i),_),u=this._sub(this._mix(s,.75,i,.25),_),o=this._sub(this._mix(s,.25,i,.75),_),n=[s];this._addBezier2(n,s,u,c,3),this._addBezier2(n,c,o,i,3),t.push(n);for(let e=0;e<8;e++){const s=n[2*e+1],i=[this._clone(s)];i.push(this._add(s,[h[0]/4,h[1]/4])),t.push(i)}break}case h.Arc90Degrees:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,1),h=[s];this._add90DegArc(h,s,r,i),t.push(h);break}case h.FullGeometry:default:t.push(e)}}return t}}export{e as EffectControlMeasureLine};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import"../../core/has.js";import{loadArcade as e}from"../../support/arcadeOnDemand.js";import{getStroke as t}from"./gfxUtils.js";import{SymbolSizeDefaults as l}from"./previewUtils.js";import{renderSymbol as i,renderOnce as r}from"./renderUtils.js";import{getCSSFilterFromEffectList as a,fetchWebStyleSymbol as s,applyColorToSymbol as n,applySizesToSymbol as o,applyRotationToSymbol as c,getColorFromSymbol as u,applyOpacityToColor as f}from"./utils.js";import{renderRelationshipRamp as p}from"../../widgets/Legend/styles/support/relationshipUtils.js";import{getRelationshipRampElement as h}from"../../widgets/Legend/support/relationshipRampUtils.js";let y=null;const d=[255,255,255];function b(e,t){return Math.floor(Math.random()*(t-e+1)+e)}function m(e,t,i){const{backgroundColor:r,outline:a,dotSize:s}=e,n=i&&i.swatchSize||l.size,o=.8,c=Math.round(n*n/s**2*o),u=window.devicePixelRatio,f=document.createElement("canvas"),p=n*u;f.width=p,f.height=p,f.style.width=f.width/u+"px",f.style.height=f.height/u+"px";const h=f.getContext("2d");if(r&&(h.fillStyle=r.toCss(!0),h.fillRect(0,0,p,p),h.fill()),h.fillStyle=t?.toCss(!0)??"",y&&y.length/2===c)for(let l=0;l<2*c;l+=2){const e=y[l],t=y[l+1];h.fillRect(e,t,s*u,s*u),h.fill()}else{y=[];for(let e=0;e<2*c;e+=2){const e=b(0,p),t=b(0,p);y.push(e,t),h.fillRect(e,t,s*u,s*u),h.fill()}}a&&(a.color&&(h.strokeStyle=a.color.toCss(!0)),h.lineWidth=a.width,h.strokeRect(0,0,p,p));const d=new Image(n,n);return d.src=f.toDataURL(),d.ariaLabel=i?.ariaLabel??null,d.alt=i?.ariaLabel??"",d}function g(e,l={}){const r=l.radius||40,a=2*Math.PI*r,s=e.length,n=a/s,o=[],c=t(l.outline);null!=c?.width&&(c.width*=2),(c||l.backgroundColor)&&o.push({shape:{type:"circle",cx:r,cy:r,r},fill:l.backgroundColor,stroke:c,offset:[0,0]});const u=l.values,f=u&&u.length===s&&100===u.reduce(((e,t)=>e+t),0),p=[0];for(let t=0;t<s;t++){let l=null;f&&(l=u[t]*a/100,p.push(l+p[t])),o.push({shape:{type:"circle",cx:r,cy:r,r:r/2},fill:[0,0,0,0],stroke:{width:r,dashArray:`${(l??n)/2} ${a}`,dashoffset:"-"+(f?p[t]/2:t*(n/2)),color:e[t]},offset:[0,0]})}let h=null;const y=2*r+(c?.width||0),b=l.holePercentage;if(b){c&&o.push({shape:{type:"circle",cx:r,cy:r,r:r*b},fill:null,stroke:c,offset:[0,0]});const e=y/2;h=[[{shape:{type:"circle",cx:e,cy:e,r:e},fill:d,stroke:c?{...c,color:d}:null,offset:[0,0]},{shape:{type:"circle",cx:e,cy:e,r:r*b},fill:[0,0,0],stroke:null,offset:[0,0]}]]}return i([o],[y,y],{effectView:l.effectList,ignoreStrokeWidth:!0,masking:h,rotation:-90,ariaLabel:l.ariaLabel})}function w(e,t={}){const l=e?.authoringInfo;if(!("relationship"===l?.type)||!l?.numClasses||!e.uniqueValueInfos)return null;const{focus:i,numClasses:a}=l,s=h({focus:i,numClasses:a,infos:e.uniqueValueInfos}),n=t&&t.node||document.createElement("div");return r(n,(()=>p(s,t.id||"relationship",{opacity:t.opacity||1,effectList:t.effectList,ariaLabel:t.ariaLabel}))),n}function v(e,t={}){const l=24,i=75,r="horizontal"===t.align,a=r?i:l,s=r?l:i,n=t.width??a,o=t.height??s,c=t.gradient??!0,u=window.devicePixelRatio,f=n*u,p=o*u,h=document.createElement("canvas");h.width=f,h.height=p,h.ariaLabel=t.ariaLabel??null,h.style.width=`${n}px`,h.style.height=`${o}px`;const y=h.getContext("2d"),d=r?f:0,b=r?0:p;if(c){const t=y.createLinearGradient(0,0,d,b),l=e.length,i=1===l?0:1/(l-1);e.forEach(((e,l)=>t.addColorStop(l*i,e.toString()))),y.fillStyle=t,y.fillRect(0,0,f,p)}else{const t=r?f/e.length:f,l=r?p:p/e.length;let i=0,a=0;for(const s of e)y.fillStyle=s.toString(),y.fillRect(i,a,t,l),i=r?i+t:0,a=r?0:a+l}const m=document.createElement("div");return m.style.width=`${n}px`,m.style.height=`${o}px`,S(m,t?.effectList),m.appendChild(h),m}function S(e,t){if(!t)return;e.style.filter=a(t);const l=t.effects;if(l)for(const i of l)if("drop-shadow"===i?.type){i.offsetX<0?e.style.marginLeft=`${Math.abs(i.offsetX)}px`:e.style.marginRight=`${i.offsetX}px`;break}}async function V(e,t){switch(e.type){case"web-style":{const{previewWebStyleSymbol:l}=await import("./previewWebStyleSymbol.js");return l(e,V,t)}case"label-3d":case"line-3d":case"mesh-3d":case"point-3d":case"polygon-3d":{const{previewSymbol3D:l}=await import("./previewSymbol3D.js");return l(e,t)}case"simple-marker":case"simple-line":case"simple-fill":case"picture-marker":case"picture-fill":case"text":{const{previewSymbol2D:l}=await import("./previewSymbol2D.js");return l(e,t)}case"cim":{const{previewCIMSymbol:l}=await import("./previewCIMSymbol.js");return l(e,t)}default:return}}function x(e){return e&&"opacity"in e?e.opacity*x(e.parent):1}async function L(t,l){if(!t)return;const i=t.sourceLayer,r=(null!=l&&l.useSourceLayer?i:t.layer)??i,a=x(r);if(null!=t.symbol&&(null==l||!0!==l.ignoreGraphicSymbol)){const e="web-style"===t.symbol.type?await s(t.symbol,{...l,cache:null!=l?l.webStyleCache:null}):t.symbol.clone();return n(e,null,a),e}const u=(null!=l?l.renderer:null)??(r&&"renderer"in r?r.renderer:null);let f=u&&"getSymbolAsync"in u?await u.getSymbolAsync(t,l):null;if(!f)return;if(f="web-style"===f.type?await f.fetchSymbol({...l,cache:null!=l?l.webStyleCache:null}):f.clone(),!(u&&"visualVariables"in u&&u.visualVariables&&u.visualVariables.length))return n(f,null,a),f;if("arcadeRequiredForVisualVariables"in u&&u.arcadeRequiredForVisualVariables&&(null==l||null==l.arcade)){const t={...l};t.arcade=await e(),l=t}const{getColor:p,getOpacity:h,getAllSizes:y,getRotationAngle:d}=await import("../../renderers/visualVariables/support/visualVariableUtils.js"),b=[],m=[],g=[],w=[];for(const e of u.visualVariables)switch(e.type){case"color":b.push(e);break;case"opacity":m.push(e);break;case"rotation":w.push(e);break;case"size":e.target||g.push(e)}const v=!!b.length&&b.at(-1),S=v?p(v,t,l):null,V=!!m.length&&m.at(-1);let L=V?h(V,t,l):null;if(null!=a&&(L=null!=L?L*a:a),n(f,S,L),g.length){const e=y(g,t,l);await o(f,e)}for(const e of w)c(f,d(e,t,l),e.axis);return f}async function k(t,l){if(!t)return;const i=t.layer,r=t.sourceLayer,a=x(i??r);if(null!=t.symbol&&(null==l||!0!==l.ignoreGraphicSymbol)){const e="web-style"===t.symbol.type?await s(t.symbol,l):t.symbol.clone();return u(e,a)}const n=null!=l&&l.renderer||(i&&"renderer"in i?i.renderer:void 0)||(r&&"renderer"in r?r.renderer:void 0);let o=n&&"getSymbolAsync"in n?await n.getSymbolAsync(t,l):void 0;if(!o)return;o="web-style"===o.type?await s(o,l):o.clone();const c=u(o,a);if(!n||!("visualVariables"in n)||"visualVariables"in n&&!n.visualVariables||"visualVariables"in n&&!n.visualVariables?.length)return c;if("arcadeRequiredForVisualVariables"in n&&n.arcadeRequiredForVisualVariables&&(null==l||null==l.arcade)){const t={...l};t.arcade=await e(),l=t}const{getColor:p,getOpacity:h}=await import("../../renderers/visualVariables/support/visualVariableUtils.js"),y=[],d=[];for(const e of n.visualVariables)switch(e.type){case"color":y.push(e);break;case"opacity":d.push(e)}const b=y.length>0?y.at(-1):null,m=b?p(b,t,l):c,g=d.length>0?d.at(-1):null;let w=g?h(g,t,l):null;return null!=a&&(w=null!=w?w*a:a),m?f(m,w):null}export{k as getDisplayedColor,L as getDisplayedSymbol,v as renderColorRampPreviewHTML,m as renderDotDensityPreviewHTML,g as renderPieChartPreviewHTML,V as renderPreviewHTML,w as renderRelationshipRampPreviewHTML};
5
+ import"../../core/has.js";import{loadArcade as e}from"../../support/arcadeOnDemand.js";import{getStroke as t}from"./gfxUtils.js";import{SymbolSizeDefaults as l}from"./previewUtils.js";import{renderSymbol as i,renderOnce as r}from"./renderUtils.js";import{getCSSFilterFromEffectList as a,fetchWebStyleSymbol as s,applyColorToSymbol as n,applySizesToSymbol as o,applyRotationToSymbol as c,getColorFromSymbol as u,applyOpacityToColor as f}from"./utils.js";import{renderRelationshipRamp as p}from"../../widgets/Legend/styles/support/relationshipUtils.js";import{getRelationshipRampElement as h}from"../../widgets/Legend/support/relationshipRampUtils.js";let y=null;const d=[255,255,255];function b(e,t){return Math.floor(Math.random()*(t-e+1)+e)}function m(e,t,i){const{backgroundColor:r,outline:a,dotSize:s}=e,n=i&&i.swatchSize||l.size,o=.8,c=Math.round(n*n/s**2*o),u=window.devicePixelRatio,f=document.createElement("canvas"),p=n*u;f.width=p,f.height=p,f.style.width=f.width/u+"px",f.style.height=f.height/u+"px";const h=f.getContext("2d");if(r&&(h.fillStyle=r.toCss(!0),h.fillRect(0,0,p,p),h.fill()),h.fillStyle=t?.toCss(!0)??"",y&&y.length/2===c)for(let l=0;l<2*c;l+=2){const e=y[l],t=y[l+1];h.fillRect(e,t,s*u,s*u),h.fill()}else{y=[];for(let e=0;e<2*c;e+=2){const e=b(0,p),t=b(0,p);y.push(e,t),h.fillRect(e,t,s*u,s*u),h.fill()}}a&&(a.color&&(h.strokeStyle=a.color.toCss(!0)),h.lineWidth=a.width,h.strokeRect(0,0,p,p));const d=new Image(n,n);return d.src=f.toDataURL(),d.ariaLabel=i?.ariaLabel??null,d.alt=i?.ariaLabel??"",d}function g(e,l={}){const r=l.radius||40,a=2*Math.PI*r,s=e.length,n=a/s,o=[],c=t(l.outline);null!=c?.width&&(c.width*=2),(c||l.backgroundColor)&&o.push({shape:{type:"circle",cx:r,cy:r,r},fill:l.backgroundColor,stroke:c,offset:[0,0]});const u=l.values,f=u&&u.length===s&&100===u.reduce(((e,t)=>e+t),0),p=[0];for(let t=0;t<s;t++){let l=null;f&&(l=u[t]*a/100,p.push(l+p[t])),o.push({shape:{type:"circle",cx:r,cy:r,r:r/2},fill:[0,0,0,0],stroke:{width:r,dashArray:`${(l??n)/2} ${a}`,dashoffset:"-"+(f?p[t]/2:t*(n/2)),color:e[t]},offset:[0,0]})}let h=null;const y=2*r+(c?.width||0),b=l.holePercentage;if(b){c&&o.push({shape:{type:"circle",cx:r,cy:r,r:r*b},fill:null,stroke:c,offset:[0,0]});const e=y/2;h=[[{shape:{type:"circle",cx:e,cy:e,r:e},fill:d,stroke:c?{...c,color:d}:null,offset:[0,0]},{shape:{type:"circle",cx:e,cy:e,r:r*b},fill:[0,0,0],stroke:null,offset:[0,0]}]]}return i([o],[y,y],{effectView:l.effectList,ignoreStrokeWidth:!0,masking:h,rotation:-90,ariaLabel:l.ariaLabel})}function w(e,t={}){const l=e?.authoringInfo;if(!("relationship"===l?.type)||!l?.numClasses||!e.uniqueValueInfos)return null;const{focus:i,numClasses:a}=l,s=h({focus:i,numClasses:a,infos:e.uniqueValueInfos}),n=t&&t.node||document.createElement("div");return r(n,(()=>p(s,t.id||"relationship",{opacity:t.opacity||1,effectList:t.effectList,ariaLabel:t.ariaLabel}))),n}function v(e,t={}){const l=24,i=75,r="horizontal"===t.align,a=r?i:l,s=r?l:i,n=t.width??a,o=t.height??s,c=t.gradient??!0,u=window.devicePixelRatio,f=n*u,p=o*u,h=document.createElement("canvas");h.width=f,h.height=p,h.ariaLabel=t.ariaLabel??null,h.style.width=`${n}px`,h.style.height=`${o}px`;const y=h.getContext("2d"),d=r?f:0,b=r?0:p;if(c){const t=y.createLinearGradient(0,0,d,b),l=e.length,i=1===l?0:1/(l-1);e.forEach(((e,l)=>t.addColorStop(l*i,e.toString()))),y.fillStyle=t,y.fillRect(0,0,f,p)}else{const t=r?f/e.length:f,l=r?p:p/e.length;let i=0,a=0;for(const s of e)y.fillStyle=s.toString(),y.fillRect(i,a,t,l),i=r?i+t:0,a=r?0:a+l}const m=document.createElement("div");return m.style.width=`${n}px`,m.style.height=`${o}px`,S(m,t?.effectList),m.appendChild(h),m}function S(e,t){if(!t)return;e.style.filter=a(t);const l=t.effects;if(l)for(const i of l)if("drop-shadow"===i?.type){i.offsetX<0?e.style.marginLeft=`${Math.abs(i.offsetX)}px`:e.style.marginRight=`${i.offsetX}px`;break}}async function V(e,t){switch(e.type){case"web-style":{const{previewWebStyleSymbol:l}=await import("./previewWebStyleSymbol.js");return l(e,V,t)}case"label-3d":case"line-3d":case"mesh-3d":case"point-3d":case"polygon-3d":{const{previewSymbol3D:l}=await import("./previewSymbol3D.js");return l(e,t)}case"simple-marker":case"simple-line":case"simple-fill":case"picture-marker":case"picture-fill":case"text":{const{previewSymbol2D:l}=await import("./previewSymbol2D.js");return l(e,t)}case"cim":{const{previewCIMSymbol:l}=await import("./previewCIMSymbol.js");return l(e,t)}default:return}}function x(e){return e&&"opacity"in e?e.opacity*x(e.parent):1}async function L(t,l){if(!t)return;const i=t.sourceLayer,r=(null!=l&&l.useSourceLayer?i:t.layer)??i,a=x(r);if(null!=t.symbol&&(null==l||!0!==l.ignoreGraphicSymbol)){const e="web-style"===t.symbol.type?await s(t.symbol,{...l,cache:null!=l?l.webStyleCache:null}):t.symbol.clone();return n(e,null,a),e}const u=(null!=l?l.renderer:null)??(r&&"renderer"in r?r.renderer:null);let f=u&&"getSymbolAsync"in u?await u.getSymbolAsync(t,l):null;if(!f)return;if(f="web-style"===f.type?await f.fetchSymbol({...l,cache:null!=l?l.webStyleCache:null}):f.clone(),!(u&&"visualVariables"in u&&u.visualVariables&&u.visualVariables.length))return n(f,null,a),f;if("arcadeRequiredForVisualVariables"in u&&u.arcadeRequiredForVisualVariables&&(null==l||null==l.arcade)){const t={...l};t.arcade=await e(),l=t}const{getColor:p,getOpacity:h,getAllSizes:y,getRotationAngle:d}=await import("../../renderers/visualVariables/support/visualVariableUtils.js"),b=[],m=[],g=[],w=[];for(const e of u.visualVariables)switch(e.type){case"color":b.push(e);break;case"opacity":m.push(e);break;case"rotation":w.push(e);break;case"size":e.target||g.push(e)}const v=!!b.length&&b[b.length-1],S=v?p(v,t,l):null,V=!!m.length&&m[m.length-1];let L=V?h(V,t,l):null;if(null!=a&&(L=null!=L?L*a:a),n(f,S,L),g.length){const e=y(g,t,l);await o(f,e)}for(const e of w)c(f,d(e,t,l),e.axis);return f}async function k(t,l){if(!t)return;const i=t.layer,r=t.sourceLayer,a=x(i??r);if(null!=t.symbol&&(null==l||!0!==l.ignoreGraphicSymbol)){const e="web-style"===t.symbol.type?await s(t.symbol,l):t.symbol.clone();return u(e,a)}const n=null!=l&&l.renderer||(i&&"renderer"in i?i.renderer:void 0)||(r&&"renderer"in r?r.renderer:void 0);let o=n&&"getSymbolAsync"in n?await n.getSymbolAsync(t,l):void 0;if(!o)return;o="web-style"===o.type?await s(o,l):o.clone();const c=u(o,a);if(!n||!("visualVariables"in n)||"visualVariables"in n&&!n.visualVariables||"visualVariables"in n&&!n.visualVariables?.length)return c;if("arcadeRequiredForVisualVariables"in n&&n.arcadeRequiredForVisualVariables&&(null==l||null==l.arcade)){const t={...l};t.arcade=await e(),l=t}const{getColor:p,getOpacity:h}=await import("../../renderers/visualVariables/support/visualVariableUtils.js"),y=[],d=[];for(const e of n.visualVariables)switch(e.type){case"color":y.push(e);break;case"opacity":d.push(e)}const b=y.length>0?y[y.length-1]:null,m=b?p(b,t,l):c,g=d.length>0?d[d.length-1]:null;let w=g?h(g,t,l):null;return null!=a&&(w=null!=w?w*a:a),m?f(m,w):null}export{k as getDisplayedColor,L as getDisplayedSymbol,v as renderColorRampPreviewHTML,m as renderDotDensityPreviewHTML,g as renderPieChartPreviewHTML,V as renderPreviewHTML,w as renderRelationshipRampPreviewHTML};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{NumericIdentifiableMixin as o}from"../../../core/Identifiable.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";var a;let c=a=class extends(o(t)){constructor(e){super(e),this._lodByScale={},this._scales=[],this.effectiveLODs=null,this.effectiveMinZoom=-1,this.effectiveMaxZoom=-1,this.effectiveMinScale=0,this.effectiveMaxScale=0,this.lods=null,this.minZoom=-1,this.maxZoom=-1,this.minScale=0,this.maxScale=0,this.snapToZoom=!0}initialize(){let e,{lods:t,minScale:o,maxScale:s,minZoom:i,maxZoom:a}=this,c=-1,r=-1,l=!1,n=!1;if(0!==o&&0!==s&&o<s&&([o,s]=[s,o]),!t||!t.length)return this._set("effectiveMinScale",o),void this._set("effectiveMaxScale",s);t=t.map((e=>e.clone())),t.sort(((e,t)=>t.scale-e.scale)),t.forEach(((e,t)=>e.level=t));for(const f of t)!l&&o>0&&o>=f.scale&&(c=f.level,l=!0),!n&&s>0&&s>=f.scale&&(r=e?e.level:-1,n=!0),e=f;-1===i&&(i=0===o?0:c),-1===a&&(a=0===s?t.length-1:r),i=Math.max(i,0),i=Math.min(i,t.length-1),a=Math.max(a,0),a=Math.min(a,t.length-1),i>a&&([i,a]=[a,i]),o=t[i].scale,s=t[a].scale,t.splice(0,i),t.splice(a-i+1,t.length),t.forEach(((e,t)=>{this._lodByScale[e.scale]=e,this._scales[t]=e.scale})),this._set("effectiveLODs",t),this._set("effectiveMinZoom",i),this._set("effectiveMaxZoom",a),this._set("effectiveMinScale",o),this._set("effectiveMaxScale",s)}constrain(e,t){if(t&&e.scale===t.scale)return e;const o=this.effectiveMinScale,s=this.effectiveMaxScale,i=e.targetGeometry,a=t&&t.targetGeometry,c=0!==s&&e.scale<s,r=0!==o&&e.scale>o;if(c||r){const c=r?o:s;if(t&&a){const o=(c-t.scale)/(e.scale-t.scale);i.x=a.x+(i.x-a.x)*o,i.y=a.y+(i.y-a.y)*o}e.scale=c}return this.snapToZoom&&this.effectiveLODs&&(e.scale=this._getClosestScale(e.scale)),e}fit(e){if(!this.effectiveLODs||!this.snapToZoom)return this.constrain(e,null);const t=this.scaleToZoom(e.scale),o=Math.abs(t-Math.floor(t));return e.scale=this.zoomToScale(o>.99?Math.round(t):Math.floor(t)),e}zoomToScale(e){if(!this.effectiveLODs)return 0;e-=this.effectiveMinZoom,e=Math.max(0,e);const t=this._scales;if(e<=0)return t[0];if(e>=t.length)return t.at(-1);const o=Math.round(e-.5),s=Math.round(e);return t[s]+(s-e)*(t[o]-t[s])}scaleToZoom(e){if(!this.effectiveLODs)return-1;const t=this._scales;let o,s;if(e>=t[0])return this.effectiveMinZoom;if(e<=t.at(-1))return this.effectiveMaxZoom;for(let i=0;i<t.length-1;i++){if(o=t[i],s=t[i+1],s===e){return i+this.effectiveMinZoom+1}if(o>e&&s<e){return i+this.effectiveMinZoom+1-(e-s)/(o-s)}}return-1}snapToClosestScale(e){if(!this.effectiveLODs)return e;const t=this.scaleToZoom(e);return this.zoomToScale(Math.round(t))}snapToNextScale(e,t=.5){if(!this.effectiveLODs)return e*t;const o=Math.round(this.scaleToZoom(e));return this.zoomToScale(o+1)}snapToPreviousScale(e,t=2){if(!this.effectiveLODs)return e*t;const o=Math.round(this.scaleToZoom(e));return this.zoomToScale(o-1)}clone(){return new a({lods:this.lods,minZoom:this.minZoom,maxZoom:this.maxZoom,minScale:this.minScale,maxScale:this.maxScale})}_getClosestScale(e){return this._lodByScale[e]||(e=this._scales.reduce(((t,o)=>Math.abs(o-e)<=Math.abs(t-e)?o:t),this._scales[0])),this._lodByScale[e].scale}};e([s({readOnly:!0})],c.prototype,"effectiveLODs",void 0),e([s({readOnly:!0})],c.prototype,"effectiveMinZoom",void 0),e([s({readOnly:!0})],c.prototype,"effectiveMaxZoom",void 0),e([s({readOnly:!0})],c.prototype,"effectiveMinScale",void 0),e([s({readOnly:!0})],c.prototype,"effectiveMaxScale",void 0),e([s()],c.prototype,"lods",void 0),e([s()],c.prototype,"minZoom",void 0),e([s()],c.prototype,"maxZoom",void 0),e([s()],c.prototype,"minScale",void 0),e([s()],c.prototype,"maxScale",void 0),e([s()],c.prototype,"snapToZoom",void 0),c=a=e([i("esri.views.2d.constraints.ZoomConstraint")],c);const r=c;export{r as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{NumericIdentifiableMixin as o}from"../../../core/Identifiable.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";var a;let c=a=class extends(o(t)){constructor(e){super(e),this._lodByScale={},this._scales=[],this.effectiveLODs=null,this.effectiveMinZoom=-1,this.effectiveMaxZoom=-1,this.effectiveMinScale=0,this.effectiveMaxScale=0,this.lods=null,this.minZoom=-1,this.maxZoom=-1,this.minScale=0,this.maxScale=0,this.snapToZoom=!0}initialize(){let e,{lods:t,minScale:o,maxScale:s,minZoom:i,maxZoom:a}=this,c=-1,r=-1,l=!1,n=!1;if(0!==o&&0!==s&&o<s&&([o,s]=[s,o]),!t||!t.length)return this._set("effectiveMinScale",o),void this._set("effectiveMaxScale",s);t=t.map((e=>e.clone())),t.sort(((e,t)=>t.scale-e.scale)),t.forEach(((e,t)=>e.level=t));for(const f of t)!l&&o>0&&o>=f.scale&&(c=f.level,l=!0),!n&&s>0&&s>=f.scale&&(r=e?e.level:-1,n=!0),e=f;-1===i&&(i=0===o?0:c),-1===a&&(a=0===s?t.length-1:r),i=Math.max(i,0),i=Math.min(i,t.length-1),a=Math.max(a,0),a=Math.min(a,t.length-1),i>a&&([i,a]=[a,i]),o=t[i].scale,s=t[a].scale,t.splice(0,i),t.splice(a-i+1,t.length),t.forEach(((e,t)=>{this._lodByScale[e.scale]=e,this._scales[t]=e.scale})),this._set("effectiveLODs",t),this._set("effectiveMinZoom",i),this._set("effectiveMaxZoom",a),this._set("effectiveMinScale",o),this._set("effectiveMaxScale",s)}constrain(e,t){if(t&&e.scale===t.scale)return e;const o=this.effectiveMinScale,s=this.effectiveMaxScale,i=e.targetGeometry,a=t&&t.targetGeometry,c=0!==s&&e.scale<s,r=0!==o&&e.scale>o;if(c||r){const c=r?o:s;if(t&&a){const o=(c-t.scale)/(e.scale-t.scale);i.x=a.x+(i.x-a.x)*o,i.y=a.y+(i.y-a.y)*o}e.scale=c}return this.snapToZoom&&this.effectiveLODs&&(e.scale=this._getClosestScale(e.scale)),e}fit(e){if(!this.effectiveLODs||!this.snapToZoom)return this.constrain(e,null);const t=this.scaleToZoom(e.scale),o=Math.abs(t-Math.floor(t));return e.scale=this.zoomToScale(o>.99?Math.round(t):Math.floor(t)),e}zoomToScale(e){if(!this.effectiveLODs)return 0;e-=this.effectiveMinZoom,e=Math.max(0,e);const t=this._scales;if(e<=0)return t[0];if(e>=t.length)return t[t.length-1];const o=Math.round(e-.5),s=Math.round(e);return t[s]+(s-e)*(t[o]-t[s])}scaleToZoom(e){if(!this.effectiveLODs)return-1;const t=this._scales;let o,s;if(e>=t[0])return this.effectiveMinZoom;if(e<=t[t.length-1])return this.effectiveMaxZoom;for(let i=0;i<t.length-1;i++){if(o=t[i],s=t[i+1],s===e){return i+this.effectiveMinZoom+1}if(o>e&&s<e){return i+this.effectiveMinZoom+1-(e-s)/(o-s)}}return-1}snapToClosestScale(e){if(!this.effectiveLODs)return e;const t=this.scaleToZoom(e);return this.zoomToScale(Math.round(t))}snapToNextScale(e,t=.5){if(!this.effectiveLODs)return e*t;const o=Math.round(this.scaleToZoom(e));return this.zoomToScale(o+1)}snapToPreviousScale(e,t=2){if(!this.effectiveLODs)return e*t;const o=Math.round(this.scaleToZoom(e));return this.zoomToScale(o-1)}clone(){return new a({lods:this.lods,minZoom:this.minZoom,maxZoom:this.maxZoom,minScale:this.minScale,maxScale:this.maxScale})}_getClosestScale(e){return this._lodByScale[e]||(e=this._scales.reduce(((t,o)=>Math.abs(o-e)<=Math.abs(t-e)?o:t),this._scales[0])),this._lodByScale[e].scale}};e([s({readOnly:!0})],c.prototype,"effectiveLODs",void 0),e([s({readOnly:!0})],c.prototype,"effectiveMinZoom",void 0),e([s({readOnly:!0})],c.prototype,"effectiveMaxZoom",void 0),e([s({readOnly:!0})],c.prototype,"effectiveMinScale",void 0),e([s({readOnly:!0})],c.prototype,"effectiveMaxScale",void 0),e([s()],c.prototype,"lods",void 0),e([s()],c.prototype,"minZoom",void 0),e([s()],c.prototype,"maxZoom",void 0),e([s()],c.prototype,"minScale",void 0),e([s()],c.prototype,"maxScale",void 0),e([s()],c.prototype,"snapToZoom",void 0),c=a=e([i("esri.views.2d.constraints.ZoomConstraint")],c);const r=c;export{r as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../geometry.js";import has from"../../../../core/has.js";import t from"../../../../core/Logger.js";import{deg2rad as e}from"../../../../core/mathUtils.js";import{throwIfAborted as n}from"../../../../core/promiseUtils.js";import r from"../../../../core/RandomLCG.js";import{getInfo as o}from"../../../../geometry/support/spatialReferenceUtils.js";import l from"../../../../geometry/Extent.js";const i=t.getLogger("esri.views.2d.engine.flow.dataUtils"),a=10;async function s(t,e,r,o){const l=performance.now(),s=c(e,r),f=performance.now(),h=u(e,s,r.width,r.height),p=performance.now(),g=m(h,!0),y=performance.now(),x="Streamlines"===t?d(g,a):w(g),M=performance.now();return has("esri-2d-profiler")&&(i.info("I.1","_createFlowFieldFromData (ms)",Math.round(f-l)),i.info("I.2","_getStreamlines (ms)",Math.round(p-f)),i.info("I.3","createAnimatedLinesData (ms)",Math.round(y-p)),i.info("I.4","create{Streamlines|Particles}Mesh (ms)",Math.round(M-y)),i.info("I.5","createFlowMesh (ms)",Math.round(M-l)),i.info("I.6","Mesh size (bytes)",x.vertexData.buffer.byteLength+x.indexData.buffer.byteLength)),await Promise.resolve(),n(o),x}function c(t,e){const n=h(e.data,e.width,e.height,t.smoothing);if(t.interpolate){return(t,r)=>{const o=Math.floor(t),l=Math.floor(r);if(o<0||o>=e.width)return[0,0];if(l<0||l>=e.height)return[0,0];const i=t-o,a=r-l,s=o,c=l,f=o<e.width-1?o+1:o,u=l<e.height-1?l+1:l,h=n[2*(c*e.width+s)],m=n[2*(c*e.width+f)],d=n[2*(u*e.width+s)],w=n[2*(u*e.width+f)],p=n[2*(c*e.width+s)+1],g=n[2*(c*e.width+f)+1];return[(h*(1-a)+d*a)*(1-i)+(m*(1-a)+w*a)*i,(p*(1-a)+n[2*(u*e.width+s)+1]*a)*(1-i)+(g*(1-a)+n[2*(u*e.width+f)+1]*a)*i]}}return(t,r)=>{const o=Math.round(t),l=Math.round(r);return o<0||o>=e.width||l<0||l>=e.height?[0,0]:[n[2*(l*e.width+o)],n[2*(l*e.width+o)+1]]}}function f(t,e,n,r,o,l,i,a,s){const c=[];let f=n,u=r,h=0,[m,d]=e(f,u);m*=t.velocityScale,d*=t.velocityScale;const w=Math.sqrt(m*m+d*d);let p,g;c.push({x:f,y:u,t:h,speed:w});for(let y=0;y<t.verticesPerLine;y++){let[n,r]=e(f,u);n*=t.velocityScale,r*=t.velocityScale;const m=Math.sqrt(n*n+r*r);if(m<t.minSpeedThreshold)return c;const d=n/m,w=r/m;f+=d*t.segmentLength,u+=w*t.segmentLength;if(h+=t.segmentLength/m,Math.acos(d*p+w*g)>t.maxTurnAngle)return c;if(t.collisions){const t=Math.round(f*s),e=Math.round(u*s);if(t<0||t>i-1||e<0||e>a-1)return c;const n=l[e*i+t];if(-1!==n&&n!==o)return c;l[e*i+t]=o}c.push({x:f,y:u,t:h,speed:m}),p=d,g=w}return c}function u(t,e,n,o){const l=[],i=new r,a=1/Math.max(t.lineCollisionWidth,1),s=Math.round(n*a),c=Math.round(o*a),u=new Int32Array(s*c);for(let r=0;r<u.length;r++)u[r]=-1;const h=[];for(let r=0;r<o;r+=t.lineSpacing)for(let e=0;e<n;e+=t.lineSpacing)h.push({x:e,y:r,sort:i.getFloat()});h.sort(((t,e)=>t.sort-e.sort));for(const{x:r,y:m}of h)if(i.getFloat()<t.density){const n=f(t,e,r,m,l.length,u,s,c,a);if(n.length<2)continue;l.push(n)}return l}function h(t,e,n,r){if(0===r)return t;const o=Math.round(3*r),l=new Array(2*o+1);let i=0;for(let c=-o;c<=o;c++){const t=Math.exp(-c*c/(r*r));l[c+o]=t,i+=t}for(let c=-o;c<=o;c++)l[c+o]/=i;const a=new Float32Array(t.length);for(let c=0;c<n;c++)for(let n=0;n<e;n++){let r=0,i=0;for(let a=-o;a<=o;a++){if(n+a<0||n+a>=e)continue;const s=l[a+o];r+=s*t[2*(c*e+(n+a))],i+=s*t[2*(c*e+(n+a))+1]}a[2*(c*e+n)]=r,a[2*(c*e+n)+1]=i}const s=new Float32Array(t.length);for(let c=0;c<e;c++)for(let t=0;t<n;t++){let r=0,i=0;for(let s=-o;s<=o;s++){if(t+s<0||t+s>=n)continue;const f=l[s+o];r+=f*a[2*((t+s)*e+c)],i+=f*a[2*((t+s)*e+c)+1]}s[2*(t*e+c)]=r,s[2*(t*e+c)+1]=i}return s}function m(t,e){const n=new r,o=t.reduce(((t,e)=>t+e.length),0),l=new Float32Array(4*o),i=new Array(t.length);let a=0,s=0;for(const r of t){const t=a;for(const e of r)l[4*a]=e.x,l[4*a+1]=e.y,l[4*a+2]=e.t,l[4*a+3]=e.speed,a++;i[s++]={startVertex:t,numberOfVertices:r.length,totalTime:r.at(-1).t,timeSeed:e?n.getFloat():0}}return{lineVertices:l,lineDescriptors:i}}function d(t,e){const n=9,{lineVertices:r,lineDescriptors:o}=t;let l=0,i=0;for(const m of o){l+=2*m.numberOfVertices;i+=6*(m.numberOfVertices-1)}const a=new Float32Array(l*n),s=new Uint32Array(i);let c=0,f=0;function u(){s[f++]=c-2,s[f++]=c,s[f++]=c-1,s[f++]=c,s[f++]=c+1,s[f++]=c-1}function h(t,e,r,o,l,i,s,f){const u=c*n;let h=0;a[u+h++]=t,a[u+h++]=e,a[u+h++]=1,a[u+h++]=r,a[u+h++]=i,a[u+h++]=s,a[u+h++]=o/2,a[u+h++]=l/2,a[u+h++]=f,c++,a[u+h++]=t,a[u+h++]=e,a[u+h++]=-1,a[u+h++]=r,a[u+h++]=i,a[u+h++]=s,a[u+h++]=-o/2,a[u+h++]=-l/2,a[u+h++]=f,c++}for(const m of o){const{totalTime:t,timeSeed:n}=m;let o=null,l=null,i=null,a=null,s=null,c=null;for(let f=0;f<m.numberOfVertices;f++){const d=r[4*(m.startVertex+f)],w=r[4*(m.startVertex+f)+1],p=r[4*(m.startVertex+f)+2],g=r[4*(m.startVertex+f)+3];let y=null,x=null,M=null,A=null;if(f>0){y=d-o,x=w-l;const r=Math.sqrt(y*y+x*x);if(y/=r,x/=r,f>1){let t=y+s,n=x+c;const r=Math.sqrt(t*t+n*n);t/=r,n/=r;const o=Math.min(1/(t*y+n*x),e);t*=o,n*=o,M=-n,A=t}else M=-x,A=y;null!==M&&null!==A&&(h(o,l,i,M,A,t,n,g),u())}o=d,l=w,i=p,s=y,c=x,a=g}h(o,l,i,-c,s,t,n,a)}return{vertexData:a,indexData:s}}function w(t){const e=16,n=1,r=2,{lineVertices:o,lineDescriptors:l}=t;let i=0,a=0;for(const U of l){const t=U.numberOfVertices-1;i+=4*t*2,a+=6*t*2}const s=new Float32Array(i*e),c=new Uint32Array(a);let f,u,h,m,d,w,p,g,y,x,M,A,I,V,F=0,D=0;function v(){c[D++]=F-8,c[D++]=F-7,c[D++]=F-6,c[D++]=F-7,c[D++]=F-5,c[D++]=F-6,c[D++]=F-4,c[D++]=F-3,c[D++]=F-2,c[D++]=F-3,c[D++]=F-1,c[D++]=F-2}function b(t,o,l,i,a,c,f,u,h,m,d,w,p,g){const y=F*e;let x=0;for(const e of[n,r])for(const n of[1,2,3,4])s[y+x++]=t,s[y+x++]=o,s[y+x++]=l,s[y+x++]=i,s[y+x++]=f,s[y+x++]=u,s[y+x++]=h,s[y+x++]=m,s[y+x++]=e,s[y+x++]=n,s[y+x++]=p,s[y+x++]=g,s[y+x++]=a/2,s[y+x++]=c/2,s[y+x++]=d/2,s[y+x++]=w/2,F++}function S(t,e){let n=y+M,r=x+A;const o=Math.sqrt(n*n+r*r);n/=o,r/=o;const l=y*n+x*r;n/=l,r/=l;let i=M+I,a=A+V;const s=Math.sqrt(i*i+a*a);i/=s,a/=s;const c=M*i+A*a;i/=c,a/=c,b(f,u,h,m,-r,n,d,w,p,g,-a,i,t,e),v()}function k(t,e,n,r,o,l){if(y=M,x=A,M=I,A=V,null==y&&null==x&&(y=M,x=A),null!=d&&null!=w){I=t-d,V=e-w;const n=Math.sqrt(I*I+V*V);I/=n,V/=n}null!=y&&null!=x&&S(o,l),f=d,u=w,h=p,m=g,d=t,w=e,p=n,g=r}function L(t,e){y=M,x=A,M=I,A=V,null==y&&null==x&&(y=M,x=A),null!=y&&null!=x&&S(t,e)}for(const U of l){f=null,u=null,h=null,m=null,d=null,w=null,p=null,g=null,y=null,x=null,M=null,A=null,I=null,V=null;const{totalTime:t,timeSeed:e}=U;for(let n=0;n<U.numberOfVertices;n++){k(o[4*(U.startVertex+n)],o[4*(U.startVertex+n)+1],o[4*(U.startVertex+n)+2],o[4*(U.startVertex+n)+3],t,e)}L(t,e)}return{vertexData:s,indexData:c}}function p(t,n){const r=n.pixels,{width:o,height:l}=n,i=new Float32Array(o*l*2),a=n.mask||new Uint8Array(o*l*2);if(n.mask||a.fill(255),"vector-uv"===t)for(let e=0;e<o*l;e++)i[2*e]=r[0][e],i[2*e+1]=-r[1][e];else if("vector-magdir"===t)for(let s=0;s<o*l;s++){const t=r[0][s],n=e(r[1][s]),o=Math.cos(n-Math.PI/2),l=Math.sin(n-Math.PI/2);i[2*s]=o*t,i[2*s+1]=l*t}return{data:i,mask:a,width:o,height:l}}async function g(t,e,n,r,a,s){const c=performance.now(),f=o(e.spatialReference);if(!f){const o=await y(t,e,n,r,a,s);return has("esri-2d-profiler")&&i.info("I.7","loadImagery, early exit (ms)",Math.round(performance.now()-c)),has("esri-2d-profiler")&&i.info("I.9","Number of parts",1),o}const[u,h]=f.valid,m=h-u,d=Math.ceil(e.width/m),w=e.width/d,p=Math.round(n/d);let g=e.xmin;const x=[],M=performance.now();for(let o=0;o<d;o++){const n=new l({xmin:g,xmax:g+w,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference});x.push(y(t,n,p,r,a,s)),g+=w}const A=await Promise.all(x);has("esri-2d-profiler")&&i.info("I.8","All calls to _fetchPart (ms)",Math.round(performance.now()-M)),has("esri-2d-profiler")&&i.info("I.9","Number of parts",A.length);const I={data:new Float32Array(n*r*2),mask:new Uint8Array(n*r),width:n,height:r};let V=0;for(const o of A){for(let t=0;t<o.height;t++)for(let e=0;e<o.width;e++)V+e>=n||(I.data[2*(t*n+V+e)]=o.data[2*(t*o.width+e)],I.data[2*(t*n+V+e)+1]=o.data[2*(t*o.width+e)+1],I.mask[t*n+V+e]=o.mask[t*o.width+e]);V+=o.width}return has("esri-2d-profiler")&&i.info("I.10","loadImagery, general exit (ms)",Math.round(performance.now()-c)),I}async function y(t,e,n,r,o,l){const i={requestProjectedLocalDirections:!0,signal:l};if(null!=o&&(i.timeExtent=o),"imagery"===t.type){await t.load({signal:l});const o=t.rasterInfo.dataType,a=await t.fetchImage(e,n,r,i);return a&&null!=a.pixelData&&null!=a.pixelData.pixelBlock?p(o,a.pixelData.pixelBlock):{data:new Float32Array(n*r*2),mask:new Uint8Array(n*r),width:n,height:r}}await t.load({signal:l});const a=t.rasterInfo.dataType,s=await t.fetchPixels(e,n,r,i);return s&&null!=s.pixelBlock?p(a,s.pixelBlock):{data:new Float32Array(n*r*2),mask:new Uint8Array(n*r),width:n,height:r}}export{m as createAnimatedLinesData,s as createFlowMesh,w as createParticlesMesh,d as createStreamlinesMesh,g as loadImagery};
5
+ import"../../../../geometry.js";import has from"../../../../core/has.js";import t from"../../../../core/Logger.js";import{deg2rad as e}from"../../../../core/mathUtils.js";import{throwIfAborted as n}from"../../../../core/promiseUtils.js";import r from"../../../../core/RandomLCG.js";import{getInfo as o}from"../../../../geometry/support/spatialReferenceUtils.js";import l from"../../../../geometry/Extent.js";const i=t.getLogger("esri.views.2d.engine.flow.dataUtils"),a=10;async function s(t,e,r,o){const l=performance.now(),s=c(e,r),f=performance.now(),h=u(e,s,r.width,r.height),p=performance.now(),g=m(h,!0),y=performance.now(),x="Streamlines"===t?d(g,a):w(g),M=performance.now();return has("esri-2d-profiler")&&(i.info("I.1","_createFlowFieldFromData (ms)",Math.round(f-l)),i.info("I.2","_getStreamlines (ms)",Math.round(p-f)),i.info("I.3","createAnimatedLinesData (ms)",Math.round(y-p)),i.info("I.4","create{Streamlines|Particles}Mesh (ms)",Math.round(M-y)),i.info("I.5","createFlowMesh (ms)",Math.round(M-l)),i.info("I.6","Mesh size (bytes)",x.vertexData.buffer.byteLength+x.indexData.buffer.byteLength)),await Promise.resolve(),n(o),x}function c(t,e){const n=h(e.data,e.width,e.height,t.smoothing);if(t.interpolate){return(t,r)=>{const o=Math.floor(t),l=Math.floor(r);if(o<0||o>=e.width)return[0,0];if(l<0||l>=e.height)return[0,0];const i=t-o,a=r-l,s=o,c=l,f=o<e.width-1?o+1:o,u=l<e.height-1?l+1:l,h=n[2*(c*e.width+s)],m=n[2*(c*e.width+f)],d=n[2*(u*e.width+s)],w=n[2*(u*e.width+f)],p=n[2*(c*e.width+s)+1],g=n[2*(c*e.width+f)+1];return[(h*(1-a)+d*a)*(1-i)+(m*(1-a)+w*a)*i,(p*(1-a)+n[2*(u*e.width+s)+1]*a)*(1-i)+(g*(1-a)+n[2*(u*e.width+f)+1]*a)*i]}}return(t,r)=>{const o=Math.round(t),l=Math.round(r);return o<0||o>=e.width||l<0||l>=e.height?[0,0]:[n[2*(l*e.width+o)],n[2*(l*e.width+o)+1]]}}function f(t,e,n,r,o,l,i,a,s){const c=[];let f=n,u=r,h=0,[m,d]=e(f,u);m*=t.velocityScale,d*=t.velocityScale;const w=Math.sqrt(m*m+d*d);let p,g;c.push({x:f,y:u,t:h,speed:w});for(let y=0;y<t.verticesPerLine;y++){let[n,r]=e(f,u);n*=t.velocityScale,r*=t.velocityScale;const m=Math.sqrt(n*n+r*r);if(m<t.minSpeedThreshold)return c;const d=n/m,w=r/m;f+=d*t.segmentLength,u+=w*t.segmentLength;if(h+=t.segmentLength/m,Math.acos(d*p+w*g)>t.maxTurnAngle)return c;if(t.collisions){const t=Math.round(f*s),e=Math.round(u*s);if(t<0||t>i-1||e<0||e>a-1)return c;const n=l[e*i+t];if(-1!==n&&n!==o)return c;l[e*i+t]=o}c.push({x:f,y:u,t:h,speed:m}),p=d,g=w}return c}function u(t,e,n,o){const l=[],i=new r,a=1/Math.max(t.lineCollisionWidth,1),s=Math.round(n*a),c=Math.round(o*a),u=new Int32Array(s*c);for(let r=0;r<u.length;r++)u[r]=-1;const h=[];for(let r=0;r<o;r+=t.lineSpacing)for(let e=0;e<n;e+=t.lineSpacing)h.push({x:e,y:r,sort:i.getFloat()});h.sort(((t,e)=>t.sort-e.sort));for(const{x:r,y:m}of h)if(i.getFloat()<t.density){const n=f(t,e,r,m,l.length,u,s,c,a);if(n.length<2)continue;l.push(n)}return l}function h(t,e,n,r){if(0===r)return t;const o=Math.round(3*r),l=new Array(2*o+1);let i=0;for(let c=-o;c<=o;c++){const t=Math.exp(-c*c/(r*r));l[c+o]=t,i+=t}for(let c=-o;c<=o;c++)l[c+o]/=i;const a=new Float32Array(t.length);for(let c=0;c<n;c++)for(let n=0;n<e;n++){let r=0,i=0;for(let a=-o;a<=o;a++){if(n+a<0||n+a>=e)continue;const s=l[a+o];r+=s*t[2*(c*e+(n+a))],i+=s*t[2*(c*e+(n+a))+1]}a[2*(c*e+n)]=r,a[2*(c*e+n)+1]=i}const s=new Float32Array(t.length);for(let c=0;c<e;c++)for(let t=0;t<n;t++){let r=0,i=0;for(let s=-o;s<=o;s++){if(t+s<0||t+s>=n)continue;const f=l[s+o];r+=f*a[2*((t+s)*e+c)],i+=f*a[2*((t+s)*e+c)+1]}s[2*(t*e+c)]=r,s[2*(t*e+c)+1]=i}return s}function m(t,e){const n=new r,o=t.reduce(((t,e)=>t+e.length),0),l=new Float32Array(4*o),i=new Array(t.length);let a=0,s=0;for(const r of t){const t=a;for(const e of r)l[4*a]=e.x,l[4*a+1]=e.y,l[4*a+2]=e.t,l[4*a+3]=e.speed,a++;i[s++]={startVertex:t,numberOfVertices:r.length,totalTime:r[r.length-1].t,timeSeed:e?n.getFloat():0}}return{lineVertices:l,lineDescriptors:i}}function d(t,e){const n=9,{lineVertices:r,lineDescriptors:o}=t;let l=0,i=0;for(const m of o){l+=2*m.numberOfVertices;i+=6*(m.numberOfVertices-1)}const a=new Float32Array(l*n),s=new Uint32Array(i);let c=0,f=0;function u(){s[f++]=c-2,s[f++]=c,s[f++]=c-1,s[f++]=c,s[f++]=c+1,s[f++]=c-1}function h(t,e,r,o,l,i,s,f){const u=c*n;let h=0;a[u+h++]=t,a[u+h++]=e,a[u+h++]=1,a[u+h++]=r,a[u+h++]=i,a[u+h++]=s,a[u+h++]=o/2,a[u+h++]=l/2,a[u+h++]=f,c++,a[u+h++]=t,a[u+h++]=e,a[u+h++]=-1,a[u+h++]=r,a[u+h++]=i,a[u+h++]=s,a[u+h++]=-o/2,a[u+h++]=-l/2,a[u+h++]=f,c++}for(const m of o){const{totalTime:t,timeSeed:n}=m;let o=null,l=null,i=null,a=null,s=null,c=null;for(let f=0;f<m.numberOfVertices;f++){const d=r[4*(m.startVertex+f)],w=r[4*(m.startVertex+f)+1],p=r[4*(m.startVertex+f)+2],g=r[4*(m.startVertex+f)+3];let y=null,x=null,M=null,A=null;if(f>0){y=d-o,x=w-l;const r=Math.sqrt(y*y+x*x);if(y/=r,x/=r,f>1){let t=y+s,n=x+c;const r=Math.sqrt(t*t+n*n);t/=r,n/=r;const o=Math.min(1/(t*y+n*x),e);t*=o,n*=o,M=-n,A=t}else M=-x,A=y;null!==M&&null!==A&&(h(o,l,i,M,A,t,n,g),u())}o=d,l=w,i=p,s=y,c=x,a=g}h(o,l,i,-c,s,t,n,a)}return{vertexData:a,indexData:s}}function w(t){const e=16,n=1,r=2,{lineVertices:o,lineDescriptors:l}=t;let i=0,a=0;for(const U of l){const t=U.numberOfVertices-1;i+=4*t*2,a+=6*t*2}const s=new Float32Array(i*e),c=new Uint32Array(a);let f,u,h,m,d,w,p,g,y,x,M,A,I,V,F=0,D=0;function v(){c[D++]=F-8,c[D++]=F-7,c[D++]=F-6,c[D++]=F-7,c[D++]=F-5,c[D++]=F-6,c[D++]=F-4,c[D++]=F-3,c[D++]=F-2,c[D++]=F-3,c[D++]=F-1,c[D++]=F-2}function b(t,o,l,i,a,c,f,u,h,m,d,w,p,g){const y=F*e;let x=0;for(const e of[n,r])for(const n of[1,2,3,4])s[y+x++]=t,s[y+x++]=o,s[y+x++]=l,s[y+x++]=i,s[y+x++]=f,s[y+x++]=u,s[y+x++]=h,s[y+x++]=m,s[y+x++]=e,s[y+x++]=n,s[y+x++]=p,s[y+x++]=g,s[y+x++]=a/2,s[y+x++]=c/2,s[y+x++]=d/2,s[y+x++]=w/2,F++}function S(t,e){let n=y+M,r=x+A;const o=Math.sqrt(n*n+r*r);n/=o,r/=o;const l=y*n+x*r;n/=l,r/=l;let i=M+I,a=A+V;const s=Math.sqrt(i*i+a*a);i/=s,a/=s;const c=M*i+A*a;i/=c,a/=c,b(f,u,h,m,-r,n,d,w,p,g,-a,i,t,e),v()}function k(t,e,n,r,o,l){if(y=M,x=A,M=I,A=V,null==y&&null==x&&(y=M,x=A),null!=d&&null!=w){I=t-d,V=e-w;const n=Math.sqrt(I*I+V*V);I/=n,V/=n}null!=y&&null!=x&&S(o,l),f=d,u=w,h=p,m=g,d=t,w=e,p=n,g=r}function L(t,e){y=M,x=A,M=I,A=V,null==y&&null==x&&(y=M,x=A),null!=y&&null!=x&&S(t,e)}for(const U of l){f=null,u=null,h=null,m=null,d=null,w=null,p=null,g=null,y=null,x=null,M=null,A=null,I=null,V=null;const{totalTime:t,timeSeed:e}=U;for(let n=0;n<U.numberOfVertices;n++){k(o[4*(U.startVertex+n)],o[4*(U.startVertex+n)+1],o[4*(U.startVertex+n)+2],o[4*(U.startVertex+n)+3],t,e)}L(t,e)}return{vertexData:s,indexData:c}}function p(t,n){const r=n.pixels,{width:o,height:l}=n,i=new Float32Array(o*l*2),a=n.mask||new Uint8Array(o*l*2);if(n.mask||a.fill(255),"vector-uv"===t)for(let e=0;e<o*l;e++)i[2*e]=r[0][e],i[2*e+1]=-r[1][e];else if("vector-magdir"===t)for(let s=0;s<o*l;s++){const t=r[0][s],n=e(r[1][s]),o=Math.cos(n-Math.PI/2),l=Math.sin(n-Math.PI/2);i[2*s]=o*t,i[2*s+1]=l*t}return{data:i,mask:a,width:o,height:l}}async function g(t,e,n,r,a,s){const c=performance.now(),f=o(e.spatialReference);if(!f){const o=await y(t,e,n,r,a,s);return has("esri-2d-profiler")&&i.info("I.7","loadImagery, early exit (ms)",Math.round(performance.now()-c)),has("esri-2d-profiler")&&i.info("I.9","Number of parts",1),o}const[u,h]=f.valid,m=h-u,d=Math.ceil(e.width/m),w=e.width/d,p=Math.round(n/d);let g=e.xmin;const x=[],M=performance.now();for(let o=0;o<d;o++){const n=new l({xmin:g,xmax:g+w,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference});x.push(y(t,n,p,r,a,s)),g+=w}const A=await Promise.all(x);has("esri-2d-profiler")&&i.info("I.8","All calls to _fetchPart (ms)",Math.round(performance.now()-M)),has("esri-2d-profiler")&&i.info("I.9","Number of parts",A.length);const I={data:new Float32Array(n*r*2),mask:new Uint8Array(n*r),width:n,height:r};let V=0;for(const o of A){for(let t=0;t<o.height;t++)for(let e=0;e<o.width;e++)V+e>=n||(I.data[2*(t*n+V+e)]=o.data[2*(t*o.width+e)],I.data[2*(t*n+V+e)+1]=o.data[2*(t*o.width+e)+1],I.mask[t*n+V+e]=o.mask[t*o.width+e]);V+=o.width}return has("esri-2d-profiler")&&i.info("I.10","loadImagery, general exit (ms)",Math.round(performance.now()-c)),I}async function y(t,e,n,r,o,l){const i={requestProjectedLocalDirections:!0,signal:l};if(null!=o&&(i.timeExtent=o),"imagery"===t.type){await t.load({signal:l});const o=t.rasterInfo.dataType,a=await t.fetchImage(e,n,r,i);return a&&null!=a.pixelData&&null!=a.pixelData.pixelBlock?p(o,a.pixelData.pixelBlock):{data:new Float32Array(n*r*2),mask:new Uint8Array(n*r),width:n,height:r}}await t.load({signal:l});const a=t.rasterInfo.dataType,s=await t.fetchPixels(e,n,r,i);return s&&null!=s.pixelBlock?p(a,s.pixelBlock):{data:new Float32Array(n*r*2),mask:new Uint8Array(n*r),width:n,height:r}}export{m as createAnimatedLinesData,s as createFlowMesh,w as createParticlesMesh,d as createStreamlinesMesh,g as loadImagery};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{pt2px as e}from"../../../../core/screenUtils.js";function n(n){const i=t(s(n)),o=i,a=!0,l=Math.max(i/2,5),r=Math.round(e(n.maxPathLength)/l)+1,u=10,{density:c}=n;return{smoothing:e(n.smoothing),interpolate:!0,velocityScale:"flow-from"===n.flowRepresentation?1:-1,verticesPerLine:r,minSpeedThreshold:.001,segmentLength:l,maxTurnAngle:1,collisions:a,lineCollisionWidth:o,lineSpacing:u,density:c}}function t(e){return"constant"===e.kind?e.value[0]:e.values.at(-1)}function i(e){const n=e.toRgba();return[n[0]/255,n[1]/255,n[2]/255,n[3]]}function o(e){return{kind:"constant",value:[.1,.1,.1,1]}}function s(n){if(!n.hasVisualVariables("size"))return{kind:"constant",value:[e(n.trailWidth)]};const t=n.getVisualVariablesForType("size")[0],i=[],o=[];let s;if(t.stops){for(const n of t.stops)i.push(n.value),o.push(e(n.size));s=t.stops.length}else i.push(t.minDataValue,t.maxDataValue),o.push(e(t.minSize),e(t.maxSize)),s=2;return{kind:"ramp",stops:i,values:o,count:s}}function a(e){if(!e.hasVisualVariables("color"))return{kind:"constant",value:i(e.color)};const n=e.getVisualVariablesForType("color")[0],t=[],o=[];for(const s of n.stops)t.push(s.value),Array.prototype.push.apply(o,i(s.color));return{kind:"ramp",stops:t,values:o,count:n.stops.length}}function l(e){if(!e.hasVisualVariables("opacity"))return{kind:"constant",value:[1]};const n=e.getVisualVariablesForType("opacity")[0],t=[],i=[];for(const o of n.stops)t.push(o.value),i.push(o.opacity);return{kind:"ramp",stops:t,values:i,count:n.stops.length}}function r(e,n,t,i){switch(n){case"int":e.setUniform1iv(t,i);break;case"float":e.setUniform1fv(t,i);break;case"vec2":e.setUniform2fv(t,i);break;case"vec3":e.setUniform3fv(t,i);break;case"vec4":e.setUniform4fv(t,i)}}function u(e,n,t,i){"constant"===i.kind?r(e,t,`u_${n}`,i.value):(r(e,"float",`u_${n}_stops`,i.stops),r(e,t,`u_${n}_values`,i.values),e.setUniform1i(`u_${n}_count`,i.count))}function c(e,n){let t=!0;return t=t&&e.collisions===n.collisions,t=t&&e.density===n.density,t=t&&e.interpolate===n.interpolate,t=t&&e.lineCollisionWidth===n.lineCollisionWidth,t=t&&e.lineSpacing===n.lineSpacing,t=t&&e.maxTurnAngle===n.maxTurnAngle,t=t&&e.minSpeedThreshold===n.minSpeedThreshold,t=t&&e.segmentLength===n.segmentLength,t=t&&e.smoothing===n.smoothing,t=t&&e.velocityScale===n.velocityScale,t=t&&e.verticesPerLine===n.verticesPerLine,t}function p(e,n){return e===n||null!=e&&null!=n&&e.equals(n)}function f(e,n){if(!c(e.simulationSettings,n.simulationSettings))return!1;if(!p(e.timeExtent,n.timeExtent))return!1;let t=!0;return t=t&&e.loadImagery===n.loadImagery,t=t&&e.createFlowMesh===n.createFlowMesh,t=t&&e.color.kind===n.color.kind,t=t&&e.opacity.kind===n.opacity.kind,t=t&&e.size.kind===n.size.kind,t}export{f as areStreamlinesCompatible,a as getColor,n as getFlowSimulationSettings,o as getForegroundColor,t as getMax,l as getOpacity,s as getSize,r as setUniform,u as setUniforms,p as timeExtentsEqual,i as toRgba};
5
+ import{pt2px as e}from"../../../../core/screenUtils.js";function n(n){const i=t(s(n)),o=i,a=!0,l=Math.max(i/2,5),r=Math.round(e(n.maxPathLength)/l)+1,u=10,{density:c}=n;return{smoothing:e(n.smoothing),interpolate:!0,velocityScale:"flow-from"===n.flowRepresentation?1:-1,verticesPerLine:r,minSpeedThreshold:.001,segmentLength:l,maxTurnAngle:1,collisions:a,lineCollisionWidth:o,lineSpacing:u,density:c}}function t(e){return"constant"===e.kind?e.value[0]:e.values[e.values.length-1]}function i(e){const n=e.toRgba();return[n[0]/255,n[1]/255,n[2]/255,n[3]]}function o(e){return{kind:"constant",value:[.1,.1,.1,1]}}function s(n){if(!n.hasVisualVariables("size"))return{kind:"constant",value:[e(n.trailWidth)]};const t=n.getVisualVariablesForType("size")[0],i=[],o=[];let s;if(t.stops){for(const n of t.stops)i.push(n.value),o.push(e(n.size));s=t.stops.length}else i.push(t.minDataValue,t.maxDataValue),o.push(e(t.minSize),e(t.maxSize)),s=2;return{kind:"ramp",stops:i,values:o,count:s}}function a(e){if(!e.hasVisualVariables("color"))return{kind:"constant",value:i(e.color)};const n=e.getVisualVariablesForType("color")[0],t=[],o=[];for(const s of n.stops)t.push(s.value),Array.prototype.push.apply(o,i(s.color));return{kind:"ramp",stops:t,values:o,count:n.stops.length}}function l(e){if(!e.hasVisualVariables("opacity"))return{kind:"constant",value:[1]};const n=e.getVisualVariablesForType("opacity")[0],t=[],i=[];for(const o of n.stops)t.push(o.value),i.push(o.opacity);return{kind:"ramp",stops:t,values:i,count:n.stops.length}}function r(e,n,t,i){switch(n){case"int":e.setUniform1iv(t,i);break;case"float":e.setUniform1fv(t,i);break;case"vec2":e.setUniform2fv(t,i);break;case"vec3":e.setUniform3fv(t,i);break;case"vec4":e.setUniform4fv(t,i)}}function u(e,n,t,i){"constant"===i.kind?r(e,t,`u_${n}`,i.value):(r(e,"float",`u_${n}_stops`,i.stops),r(e,t,`u_${n}_values`,i.values),e.setUniform1i(`u_${n}_count`,i.count))}function c(e,n){let t=!0;return t=t&&e.collisions===n.collisions,t=t&&e.density===n.density,t=t&&e.interpolate===n.interpolate,t=t&&e.lineCollisionWidth===n.lineCollisionWidth,t=t&&e.lineSpacing===n.lineSpacing,t=t&&e.maxTurnAngle===n.maxTurnAngle,t=t&&e.minSpeedThreshold===n.minSpeedThreshold,t=t&&e.segmentLength===n.segmentLength,t=t&&e.smoothing===n.smoothing,t=t&&e.velocityScale===n.velocityScale,t=t&&e.verticesPerLine===n.verticesPerLine,t}function p(e,n){return e===n||null!=e&&null!=n&&e.equals(n)}function f(e,n){if(!c(e.simulationSettings,n.simulationSettings))return!1;if(!p(e.timeExtent,n.timeExtent))return!1;let t=!0;return t=t&&e.loadImagery===n.loadImagery,t=t&&e.createFlowMesh===n.createFlowMesh,t=t&&e.color.kind===n.color.kind,t=t&&e.opacity.kind===n.opacity.kind,t=t&&e.size.kind===n.size.kind,t}export{f as areStreamlinesCompatible,a as getColor,n as getFlowSimulationSettings,o as getForegroundColor,t as getMax,l as getOpacity,s as getSize,r as setUniform,u as setUniforms,p as timeExtentsEqual,i as toRgba};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../core/has.js";import{g as e,h as t,r as s,s as a}from"../../../../chunks/mat3.js";import{c as r}from"../../../../chunks/mat3f32.js";import{BucketType as i}from"./enums.js";import{CircleRenderBucket as o,SymbolRenderBucket as h,LineRenderBucket as n,FillRenderBucket as l}from"./RenderBucket.js";import{FADE_DURATION as y}from"./decluttering/config.js";import{TiledDisplayObject as c}from"../webgl/TiledDisplayObject.js";class d extends c{constructor(e,t,s,a,r,i,o,h=null){super(e,t,s,a,r,i,4096,4096),this.styleRepository=o,this._memCache=h,this.type="vector-tile",this._referenced=0,this._hasSymbolBuckets=!1,this._memoryUsedByLayerData=0,this.layerData=new Map,this.layerCount=0,this.status="loading",this.allSymbolsFadingOut=!1,this.lastOpacityUpdate=0,this.symbols=new Map,this.isCoverage=!1,this.neededForCoverage=!1,this.decluttered=!1,this.invalidating=!1,this.parentTile=null,this.childrenTiles=new Set,this._processed=!1,this._referenced=1,this.id=e.id}get hasSymbolBuckets(){return this._hasSymbolBuckets}get isFading(){return this._hasSymbolBuckets&&performance.now()-this.lastOpacityUpdate<y}get isHoldingForFade(){return this._hasSymbolBuckets&&(!this.allSymbolsFadingOut||performance.now()-this.lastOpacityUpdate<y)}get wasRequested(){return"errored"===this.status||"loaded"===this.status||"reloading"===this.status}setData(e){this.changeDataImpl(e),this.requestRender(),this.ready(),this.invalidating=!1,this._processed=!0}deleteLayerData(e){let t=!1;for(const s of e)if(this.layerData.has(s)){const e=this.layerData.get(s);this._memoryUsedByLayerData-=e.memoryUsed,e.type===i.SYMBOL&&this.symbols.has(s)&&(this.symbols.delete(s),t=!0),e.destroy(),this.layerData.delete(s),this.layerCount--}this._memCache?.updateSize(this.key.id,this,this._memoryUsedByLayerData),t&&this.emit("symbols-changed"),this.requestRender()}processed(){return this._processed}hasData(){return this.layerCount>0}dispose(){"unloaded"!==this.status&&(m.delete(this),d._destroyRenderBuckets(this.layerData),this.layerData=null,this.layerCount=0,this._memoryUsedByLayerData=0,this.destroy(),this.status="unloaded")}release(){return 0==--this._referenced&&(this.dispose(),this.stage=null,!0)}retain(){++this._referenced}get referenced(){return this._referenced}get memoryUsed(){return this._memoryUsedByLayerData+256}changeDataImpl(e){let t=!1;if(e){const{bucketsWithData:s,emptyBuckets:a}=e,r=this._createRenderBuckets(s);if(a&&a.byteLength>0){const e=new Uint32Array(a);for(const t of e)this._deleteLayerData(t)}for(const[e,o]of r)this._deleteLayerData(e),o.type===i.SYMBOL&&(this.symbols.set(e,o.symbols),t=!0),this._memoryUsedByLayerData+=o.memoryUsed,this.layerData.set(e,o),this.layerCount++;this._memCache?.updateSize(this.key.id,this,this.memoryUsed)}this._hasSymbolBuckets=!1;for(const[s,a]of this.layerData)a.type===i.SYMBOL&&(this._hasSymbolBuckets=!0);t&&this.emit("symbols-changed")}attachWithContext(e){this.stage={context:e,trashDisplayObject(e){e.processDetach()},untrashDisplayObject:()=>!1}}setTransform(r){super.setTransform(r);const i=this.resolution/(r.resolution*r.pixelRatio),o=this.width/this.rangeX*i,h=this.height/this.rangeY*i,n=[0,0];r.toScreen(n,[this.x,this.y]);const l=this.transforms.tileUnitsToPixels;e(l),t(l,l,n),s(l,l,Math.PI*r.rotation/180),a(l,l,[o,h,1])}_createTransforms(){return{dvs:r(),tileMat3:r(),tileUnitsToPixels:r()}}static _destroyRenderBuckets(e){if(!e)return;const t=new Set;e.forEach((e=>{t.has(e)||(e.destroy(),t.add(e))})),e.clear()}_createRenderBuckets(e){const t=new Map,s=new Map;for(const a of e){const e=this._deserializeBucket(a,s);for(const s of e.layerUIDs)t.set(s,e)}return t}_deserializeBucket(e,t){let s=t.get(e);if(s)return s;switch(new Uint32Array(e)[0]){case i.FILL:s=new l(e,this.styleRepository);break;case i.LINE:s=new n(e,this.styleRepository);break;case i.SYMBOL:s=new h(e,this.styleRepository,this);break;case i.CIRCLE:s=new o(e,this.styleRepository)}return t.set(e,s),s}_deleteLayerData(e){if(!this.layerData.has(e))return;const t=this.layerData.get(e);this._memoryUsedByLayerData-=t.memoryUsed,t.destroy(),this.layerData.delete(e),this.layerCount--}}const m=new Map;function u(){m.forEach(((e,t)=>{console.log(`\n${t.key}:`),e[0].forEach((e=>console.log(e))),console.log("========"),e[1].forEach((e=>console.log(e)))}))}export{d as VectorTile,u as printAllocations};
5
+ import"../../../../core/has.js";import{g as e,h as t,r as s,s as a}from"../../../../chunks/mat3.js";import{c as r}from"../../../../chunks/mat3f32.js";import{BucketType as i}from"./enums.js";import{CircleRenderBucket as o,SymbolRenderBucket as h,LineRenderBucket as n,FillRenderBucket as l}from"./RenderBucket.js";import{FADE_DURATION as y}from"./decluttering/config.js";import{TiledDisplayObject as c}from"../webgl/TiledDisplayObject.js";class d extends c{constructor(e,t,s,a,r,i,o,h=null){super(e,t,s,a,r,i,4096,4096),this.styleRepository=o,this._memCache=h,this.type="vector-tile",this._referenced=0,this._hasSymbolBuckets=!1,this._memoryUsedByLayerData=0,this.layerData=new Map,this.layerCount=0,this.status="loading",this.allSymbolsFadingOut=!1,this.lastOpacityUpdate=0,this.symbols=new Map,this.isCoverage=!1,this.neededForCoverage=!1,this.decluttered=!1,this.parentTile=null,this.childrenTiles=new Set,this._processed=!1,this._referenced=1,this.id=e.id}get hasSymbolBuckets(){return this._hasSymbolBuckets}get isFading(){return this._hasSymbolBuckets&&performance.now()-this.lastOpacityUpdate<y}get isHoldingForFade(){return this._hasSymbolBuckets&&(!this.allSymbolsFadingOut||performance.now()-this.lastOpacityUpdate<y)}get wasRequested(){return"errored"===this.status||"loaded"===this.status||"reloading"===this.status}setData(e){this.changeDataImpl(e),this.requestRender(),this.ready(),this._processed=!0}deleteLayerData(e){let t=!1;for(const s of e)if(this.layerData.has(s)){const e=this.layerData.get(s);this._memoryUsedByLayerData-=e.memoryUsed,e.type===i.SYMBOL&&this.symbols.has(s)&&(this.symbols.delete(s),t=!0),e.destroy(),this.layerData.delete(s),this.layerCount--}this._memCache?.updateSize(this.key.id,this,this._memoryUsedByLayerData),t&&this.emit("symbols-changed"),this.requestRender()}processed(){return this._processed}hasData(){return this.layerCount>0}dispose(){"unloaded"!==this.status&&(m.delete(this),d._destroyRenderBuckets(this.layerData),this.layerData=null,this.layerCount=0,this._memoryUsedByLayerData=0,this.destroy(),this.status="unloaded")}release(){return 0==--this._referenced&&(this.dispose(),this.stage=null,!0)}retain(){++this._referenced}get referenced(){return this._referenced}get memoryUsed(){return this._memoryUsedByLayerData+256}changeDataImpl(e){let t=!1;if(e){const{bucketsWithData:s,emptyBuckets:a}=e,r=this._createRenderBuckets(s);if(a&&a.byteLength>0){const e=new Uint32Array(a);for(const t of e)this._deleteLayerData(t)}for(const[e,o]of r)this._deleteLayerData(e),o.type===i.SYMBOL&&(this.symbols.set(e,o.symbols),t=!0),this._memoryUsedByLayerData+=o.memoryUsed,this.layerData.set(e,o),this.layerCount++;this._memCache?.updateSize(this.key.id,this,this.memoryUsed)}this._hasSymbolBuckets=!1;for(const[s,a]of this.layerData)a.type===i.SYMBOL&&(this._hasSymbolBuckets=!0);t&&this.emit("symbols-changed")}attachWithContext(e){this.stage={context:e,trashDisplayObject(e){e.processDetach()},untrashDisplayObject:()=>!1}}setTransform(r){super.setTransform(r);const i=this.resolution/(r.resolution*r.pixelRatio),o=this.width/this.rangeX*i,h=this.height/this.rangeY*i,n=[0,0];r.toScreen(n,[this.x,this.y]);const l=this.transforms.tileUnitsToPixels;e(l),t(l,l,n),s(l,l,Math.PI*r.rotation/180),a(l,l,[o,h,1])}_createTransforms(){return{dvs:r(),tileMat3:r(),tileUnitsToPixels:r()}}static _destroyRenderBuckets(e){if(!e)return;const t=new Set;e.forEach((e=>{t.has(e)||(e.destroy(),t.add(e))})),e.clear()}_createRenderBuckets(e){const t=new Map,s=new Map;for(const a of e){const e=this._deserializeBucket(a,s);for(const s of e.layerUIDs)t.set(s,e)}return t}_deserializeBucket(e,t){let s=t.get(e);if(s)return s;switch(new Uint32Array(e)[0]){case i.FILL:s=new l(e,this.styleRepository);break;case i.LINE:s=new n(e,this.styleRepository);break;case i.SYMBOL:s=new h(e,this.styleRepository,this);break;case i.CIRCLE:s=new o(e,this.styleRepository)}return t.set(e,s),s}_deleteLayerData(e){if(!this.layerData.has(e))return;const t=this.layerData.get(e);this._memoryUsedByLayerData-=t.memoryUsed,t.destroy(),this.layerData.delete(e),this.layerCount--}}const m=new Map;function u(){m.forEach(((e,t)=>{console.log(`\n${t.key}:`),e[0].forEach((e=>console.log(e))),console.log("========"),e[1].forEach((e=>console.log(e)))}))}export{d as VectorTile,u as printAllocations};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{createResolver as e}from"../../../../core/promiseUtils.js";import{create as t}from"../../../../geometry/support/aaBoundingRect.js";import{SymbolFader as s}from"./decluttering/SymbolFader.js";import{Visibility as r,StyleLayerType as i}from"./style/StyleDefinition.js";import{WGLDrawPhase as l}from"../webgl/enums.js";import{RenderableTile as o}from"../webgl/RenderableTile.js";import n from"../webgl/TileContainer.js";import a from"../../tiling/TileCoverage.js";import d from"../../tiling/TileKey.js";import{StencilOperation as h,CompareFunction as c,BlendFactor as u}from"../../../webgl/enums.js";const y=1e-6;function p(e,t){if(e){const s=e.getLayoutProperty("visibility");if(!s||s.getValue()!==r.NONE&&(void 0===e.minzoom||e.minzoom<t+y)&&(void 0===e.maxzoom||e.maxzoom>=t-y))return!0}return!1}class m extends n{constructor(e){super(e),this._backgroundTiles=[],this._pointToCallbacks=new Map}destroy(){this.removeAllChildren(),this._spriteMosaic?.dispose(),this._spriteMosaic=null,this._glyphMosaic?.dispose(),this._glyphMosaic=null,null!=this._symbolFader&&(this._symbolFader.clear(),this._symbolFader=null),this._styleRepository=null,this._backgroundTiles=[],this._pointToCallbacks.clear()}setStyleResources(e,t,r){if(this._spriteMosaic=e,this._glyphMosaic=t,this._styleRepository=r,null==this._symbolFader){const e=new s(this._styleRepository,this.children);e.on("fade-start",(()=>{this.emit("fade-start"),this.requestRender()})),e.on("fade-complete",(()=>{this.emit("fade-complete"),this.requestRender()})),this._symbolFader=e}this._symbolFader.styleRepository=r}setSpriteMosaic(e){this._spriteMosaic?.dispose(),this._spriteMosaic=e}deleteStyleLayers(e){null!=this._symbolFader&&this._symbolFader.deleteStyleLayers(e)}async hitTest(t){const s=e();return this._pointToCallbacks.set(t,s),this.requestRender(),s.promise}enterTileInvalidation(){for(const e of this.children)e.invalidating=!0}createRenderParams(e){return{...super.createRenderParams(e),renderPass:null,styleLayer:null,styleLayerUID:-1,glyphMosaic:this._glyphMosaic,spriteMosaic:this._spriteMosaic,hasClipping:!!this._clippingInfos}}doRender(e){!this.visible||e.drawPhase!==l.MAP&&e.drawPhase!==l.DEBUG||void 0===this._spriteMosaic||super.doRender(e)}addChild(e){return super.addChild(e),null!=this._symbolFader?this._symbolFader.addTile(e):e.decluttered=!0,this.requestRender(),e}removeChild(e){return null!=this._symbolFader&&this._symbolFader.removeTile(e),this.requestRender(),super.removeChild(e)}renderChildren(e){const{drawPhase:t}=e;if(t!==l.DEBUG){if(this._doRender(e),this._pointToCallbacks.size>0){e.drawPhase=l.HITTEST;const s=e.painter.effects.hittestVTL;s.bind(e),this._doRender(e),s.draw(e,this._pointToCallbacks),s.unbind(e),e.drawPhase=t}}else super.renderChildren(e)}removeAllChildren(){for(let e=0;e<this.children.length;e++){const t=this.children[e];null!=this._symbolFader&&this._symbolFader.removeTile(t),t.dispose()}super.removeAllChildren()}getStencilTarget(){return this.children.filter((e=>e.neededForCoverage&&e.hasData()))}restartDeclutter(){null!=this._symbolFader&&this._symbolFader.restartDeclutter()}_doRender(e){const{context:t}=e,s=this._styleRepository;if(!s)return;const r=s.layers;let i=!0;e.drawPhase===l.HITTEST&&(i=!1),s.backgroundBucketIds.length>0&&(e.renderPass="background",this._renderBackgroundLayers(e,s.backgroundBucketIds)),super.renderChildren(e),e.drawPhase===l.MAP&&this._fade(e.displayLevel,e.state);const o=this.children.filter((e=>e.visible&&e.hasData()));if(!o||0===o.length)return t.bindVAO(),t.setStencilTestEnabled(!0),void t.setBlendingEnabled(!0);for(const l of o)l.triangleCount=0;t.setStencilWriteMask(0),t.setColorMask(!0,!0,!0,!0),t.setStencilOp(h.KEEP,h.KEEP,h.REPLACE),t.setStencilTestEnabled(!0),t.setBlendingEnabled(!1),t.setDepthTestEnabled(!0),t.setDepthWriteEnabled(!0),t.setDepthFunction(c.LEQUAL),t.setClearDepth(1),t.clear(t.gl.DEPTH_BUFFER_BIT),e.renderPass="opaque";for(let l=r.length-1;l>=0;l--)this._renderStyleLayer(r[l],e,o);t.setDepthWriteEnabled(!1),t.setBlendingEnabled(i),t.setBlendFunctionSeparate(u.ONE,u.ONE_MINUS_SRC_ALPHA,u.ONE,u.ONE_MINUS_SRC_ALPHA),e.renderPass="translucent";for(let l=0;l<r.length;l++)this._renderStyleLayer(r[l],e,o);t.bindVAO(),t.setStencilTestEnabled(!0),t.setBlendingEnabled(!0)}_fade(e,t){null!=this._symbolFader&&(this._symbolFader.update(e,t)||this.requestRender())}_renderStyleLayer(e,t,s){const{painter:l,renderPass:o}=t;if(void 0===e)return;const n=e.getLayoutProperty("visibility");if(n&&n.getValue()===r.NONE)return;let a;switch(e.type){case i.BACKGROUND:return;case i.FILL:if("opaque"!==o&&"translucent"!==t.renderPass)return;a="vtlFill";break;case i.LINE:if("translucent"!==o)return;a="vtlLine";break;case i.CIRCLE:if("translucent"!==o)return;a="vtlCircle";break;case i.SYMBOL:if("translucent"!==o)return;a="vtlSymbol"}if(s=e.type===i.SYMBOL?s.filter((e=>e.decluttered)):s.filter((e=>e.neededForCoverage)),"vtlSymbol"!==a){const r=t.displayLevel;if(0===s.length||void 0!==e.minzoom&&e.minzoom>=r+y||void 0!==e.maxzoom&&e.maxzoom<r-y)return}const d=e.uid;t.styleLayerUID=d,t.styleLayer=e;for(const r of s)if(r.layerData.has(d)){l.renderObjects(t,s,a);break}}_renderBackgroundLayers(e,s){const{context:r,displayLevel:n,painter:u,state:y}=e,m=this._styleRepository;let f=!1;for(const t of s){if(m.getLayerById(t).type===i.BACKGROUND&&p(m.getLayerById(t),n)){f=!0;break}}if(!f)return;const _=this._tileInfoView.getTileCoverage(e.state,0,!0,"smallest"),{spans:b,lodInfo:g}=_,{level:T}=g,E=t(),C=[];if(this._renderPasses){const t=this._renderPasses[0];null!=this._clippingInfos&&(t.brushes[0].prepareState(e),t.brushes[0].drawMany(e,this._clippingInfos))}const L=this._backgroundTiles;let v,R=0;for(const{row:i,colFrom:l,colTo:a}of b)for(let e=l;e<=a;e++){if(R<L.length)v=L[R],v.key.set(T,i,g.normalizeCol(e),g.getWorldForColumn(e)),this._tileInfoView.getTileBounds(E,v.key,!1),v.x=E[0],v.y=E[3],v.resolution=this._tileInfoView.getTileResolution(T);else{const s=new d(T,i,g.normalizeCol(e),g.getWorldForColumn(e)),r=this._tileInfoView.getTileBounds(t(),s),l=this._tileInfoView.getTileResolution(T);v=new o(s,l,r[0],r[3],512,512,4096,4096),L.push(v)}v.setTransform(y),C.push(v),R++}r.setStencilWriteMask(0),r.setColorMask(!0,!0,!0,!0),r.setStencilOp(h.KEEP,h.KEEP,h.REPLACE),r.setStencilFunction(c.EQUAL,0,255);let S=!0;e.drawPhase===l.HITTEST&&(S=!1),r.setStencilTestEnabled(S);for(const t of s){const s=m.getLayerById(t);s.type===i.BACKGROUND&&p(s,n)&&(e.styleLayerUID=s.uid,e.styleLayer=s,u.renderObjects(e,C,"vtlBackground"))}a.pool.release(_)}}export{m as VectorTileContainer};
5
+ import{createResolver as e}from"../../../../core/promiseUtils.js";import{create as t}from"../../../../geometry/support/aaBoundingRect.js";import{SymbolFader as s}from"./decluttering/SymbolFader.js";import{Visibility as r,StyleLayerType as i}from"./style/StyleDefinition.js";import{WGLDrawPhase as l}from"../webgl/enums.js";import{RenderableTile as o}from"../webgl/RenderableTile.js";import n from"../webgl/TileContainer.js";import a from"../../tiling/TileCoverage.js";import d from"../../tiling/TileKey.js";import{StencilOperation as h,CompareFunction as c,BlendFactor as u}from"../../../webgl/enums.js";const y=1e-6;function p(e,t){if(e){const s=e.getLayoutProperty("visibility");if(!s||s.getValue()!==r.NONE&&(void 0===e.minzoom||e.minzoom<t+y)&&(void 0===e.maxzoom||e.maxzoom>=t-y))return!0}return!1}class m extends n{constructor(e){super(e),this._backgroundTiles=[],this._pointToCallbacks=new Map}destroy(){this.removeAllChildren(),this._spriteMosaic?.dispose(),this._spriteMosaic=null,this._glyphMosaic?.dispose(),this._glyphMosaic=null,null!=this._symbolFader&&(this._symbolFader.clear(),this._symbolFader=null),this._styleRepository=null,this._backgroundTiles=[],this._pointToCallbacks.clear()}setStyleResources(e,t,r){if(this._spriteMosaic=e,this._glyphMosaic=t,this._styleRepository=r,null==this._symbolFader){const e=new s(this._styleRepository,this.children);e.on("fade-start",(()=>{this.emit("fade-start"),this.requestRender()})),e.on("fade-complete",(()=>{this.emit("fade-complete"),this.requestRender()})),this._symbolFader=e}this._symbolFader.styleRepository=r}setSpriteMosaic(e){this._spriteMosaic?.dispose(),this._spriteMosaic=e}deleteStyleLayers(e){null!=this._symbolFader&&this._symbolFader.deleteStyleLayers(e)}async hitTest(t){const s=e();return this._pointToCallbacks.set(t,s),this.requestRender(),s.promise}createRenderParams(e){return{...super.createRenderParams(e),renderPass:null,styleLayer:null,styleLayerUID:-1,glyphMosaic:this._glyphMosaic,spriteMosaic:this._spriteMosaic,hasClipping:!!this._clippingInfos}}doRender(e){!this.visible||e.drawPhase!==l.MAP&&e.drawPhase!==l.DEBUG||void 0===this._spriteMosaic||super.doRender(e)}addChild(e){return super.addChild(e),null!=this._symbolFader?this._symbolFader.addTile(e):e.decluttered=!0,this.requestRender(),e}removeChild(e){return null!=this._symbolFader&&this._symbolFader.removeTile(e),this.requestRender(),super.removeChild(e)}renderChildren(e){const{drawPhase:t}=e;if(t!==l.DEBUG){if(this._doRender(e),this._pointToCallbacks.size>0){e.drawPhase=l.HITTEST;const s=e.painter.effects.hittestVTL;s.bind(e),this._doRender(e),s.draw(e,this._pointToCallbacks),s.unbind(e),e.drawPhase=t}}else super.renderChildren(e)}removeAllChildren(){for(let e=0;e<this.children.length;e++){const t=this.children[e];null!=this._symbolFader&&this._symbolFader.removeTile(t),t.dispose()}super.removeAllChildren()}getStencilTarget(){return this.children.filter((e=>e.neededForCoverage&&e.hasData()))}restartDeclutter(){null!=this._symbolFader&&this._symbolFader.restartDeclutter()}_doRender(e){const{context:t}=e,s=this._styleRepository;if(!s)return;const r=s.layers;let i=!0;e.drawPhase===l.HITTEST&&(i=!1),s.backgroundBucketIds.length>0&&(e.renderPass="background",this._renderBackgroundLayers(e,s.backgroundBucketIds)),super.renderChildren(e),e.drawPhase===l.MAP&&this._fade(e.displayLevel,e.state);const o=this.children.filter((e=>e.visible&&e.hasData()));if(!o||0===o.length)return t.bindVAO(),t.setStencilTestEnabled(!0),void t.setBlendingEnabled(!0);for(const l of o)l.triangleCount=0;t.setStencilWriteMask(0),t.setColorMask(!0,!0,!0,!0),t.setStencilOp(h.KEEP,h.KEEP,h.REPLACE),t.setStencilTestEnabled(!0),t.setBlendingEnabled(!1),t.setDepthTestEnabled(!0),t.setDepthWriteEnabled(!0),t.setDepthFunction(c.LEQUAL),t.setClearDepth(1),t.clear(t.gl.DEPTH_BUFFER_BIT),e.renderPass="opaque";for(let l=r.length-1;l>=0;l--)this._renderStyleLayer(r[l],e,o);t.setDepthWriteEnabled(!1),t.setBlendingEnabled(i),t.setBlendFunctionSeparate(u.ONE,u.ONE_MINUS_SRC_ALPHA,u.ONE,u.ONE_MINUS_SRC_ALPHA),e.renderPass="translucent";for(let l=0;l<r.length;l++)this._renderStyleLayer(r[l],e,o);t.bindVAO(),t.setStencilTestEnabled(!0),t.setBlendingEnabled(!0)}_fade(e,t){null!=this._symbolFader&&(this._symbolFader.update(e,t)||this.requestRender())}_renderStyleLayer(e,t,s){const{painter:l,renderPass:o}=t;if(void 0===e)return;const n=e.getLayoutProperty("visibility");if(n&&n.getValue()===r.NONE)return;let a;switch(e.type){case i.BACKGROUND:return;case i.FILL:if("opaque"!==o&&"translucent"!==t.renderPass)return;a="vtlFill";break;case i.LINE:if("translucent"!==o)return;a="vtlLine";break;case i.CIRCLE:if("translucent"!==o)return;a="vtlCircle";break;case i.SYMBOL:if("translucent"!==o)return;a="vtlSymbol"}if(s=e.type===i.SYMBOL?s.filter((e=>e.decluttered)):s.filter((e=>e.neededForCoverage)),"vtlSymbol"!==a){const r=t.displayLevel;if(0===s.length||void 0!==e.minzoom&&e.minzoom>=r+y||void 0!==e.maxzoom&&e.maxzoom<r-y)return}const d=e.uid;t.styleLayerUID=d,t.styleLayer=e;for(const r of s)if(r.layerData.has(d)){l.renderObjects(t,s,a);break}}_renderBackgroundLayers(e,s){const{context:r,displayLevel:n,painter:u,state:y}=e,m=this._styleRepository;let _=!1;for(const t of s){if(m.getLayerById(t).type===i.BACKGROUND&&p(m.getLayerById(t),n)){_=!0;break}}if(!_)return;const f=this._tileInfoView.getTileCoverage(e.state,0,!0,"smallest"),{spans:b,lodInfo:g}=f,{level:T}=g,E=t(),C=[];if(this._renderPasses){const t=this._renderPasses[0];null!=this._clippingInfos&&(t.brushes[0].prepareState(e),t.brushes[0].drawMany(e,this._clippingInfos))}const L=this._backgroundTiles;let R,v=0;for(const{row:i,colFrom:l,colTo:a}of b)for(let e=l;e<=a;e++){if(v<L.length)R=L[v],R.key.set(T,i,g.normalizeCol(e),g.getWorldForColumn(e)),this._tileInfoView.getTileBounds(E,R.key,!1),R.x=E[0],R.y=E[3],R.resolution=this._tileInfoView.getTileResolution(T);else{const s=new d(T,i,g.normalizeCol(e),g.getWorldForColumn(e)),r=this._tileInfoView.getTileBounds(t(),s),l=this._tileInfoView.getTileResolution(T);R=new o(s,l,r[0],r[3],512,512,4096,4096),L.push(R)}R.setTransform(y),C.push(R),v++}r.setStencilWriteMask(0),r.setColorMask(!0,!0,!0,!0),r.setStencilOp(h.KEEP,h.KEEP,h.REPLACE),r.setStencilFunction(c.EQUAL,0,255);let S=!0;e.drawPhase===l.HITTEST&&(S=!1),r.setStencilTestEnabled(S);for(const t of s){const s=m.getLayerById(t);s.type===i.BACKGROUND&&p(s,n)&&(e.styleLayerUID=s.uid,e.styleLayer=s,u.renderObjects(e,C,"vtlBackground"))}a.pool.release(f)}}export{m as VectorTileContainer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../../../Color.js";import{toLCH as e,toRGB as r,toLAB as s}from"../../../../../core/colorUtils.js";import{GeometryType as n}from"../../../../../geometry/support/TileClipper.js";import{unitBezier as a}from"../../../unitBezier.js";import{interpolate as o}from"../GeometryUtils.js";import{ValueType as i,StringType as l,ObjectType as u,NumberType as c,BooleanType as h,ColorType as p,typeToString as f,arrayType as g,getType as w,matchType as m,valueToString as y}from"./types.js";class _{constructor(t){this._parent=t,this._vars={}}add(t,e){this._vars[t]=e}get(t){return this._vars[t]?this._vars[t]:this._parent?this._parent.get(t):null}}class v{constructor(){this.type=i}static parse(t){if(t.length>1)throw new Error('"id" does not expect arguments');return new v}evaluate(t,e){return t?.id}}class b{constructor(){this.type=l}static parse(t){if(t.length>1)throw new Error('"geometry-type" does not expect arguments');return new b}evaluate(t,e){if(!t)return null;switch(t.type){case n.Point:return"Point";case n.LineString:return"LineString";case n.Polygon:return"Polygon";default:return null}}}class d{constructor(){this.type=u}static parse(t){if(t.length>1)throw new Error('"properties" does not expect arguments');return new d}evaluate(t,e){return t?.values}}class x{constructor(){this.type=c}static parse(t){if(t.length>1)throw new Error('"zoom" does not expect arguments');return new x}evaluate(t,e){return e}}class E{constructor(t,e,r){this._lhs=t,this._rhs=e,this._compare=r,this.type=h}static parse(t,e,r){if(3!==t.length&&4!==t.length)throw new Error(`"${t[0]}" expects 2 or 3 arguments`);if(4===t.length)throw new Error(`"${t[0]}" collator not supported`);return new E(pt(t[1],e),pt(t[2],e),r)}evaluate(t,e){return this._compare(this._lhs.evaluate(t,e),this._rhs.evaluate(t,e))}}class $ extends E{static parse(t,e){return E.parse(t,e,((t,e)=>t===e))}}class M extends E{static parse(t,e){return E.parse(t,e,((t,e)=>t!==e))}}class k extends E{static parse(t,e){return E.parse(t,e,((t,e)=>t<e))}}class A extends E{static parse(t,e){return E.parse(t,e,((t,e)=>t<=e))}}class j extends E{static parse(t,e){return E.parse(t,e,((t,e)=>t>e))}}class q extends E{static parse(t,e){return E.parse(t,e,((t,e)=>t>=e))}}class N{constructor(t){this._arg=t,this.type=h}static parse(t,e){if(2!==t.length)throw new Error('"!" expects 1 argument');return new N(pt(t[1],e))}evaluate(t,e){return!this._arg.evaluate(t,e)}}class C{constructor(t){this._args=t,this.type=h}static parse(t,e){const r=[];for(let s=1;s<t.length;s++)r.push(pt(t[s],e));return new C(r)}evaluate(t,e){for(const r of this._args)if(!r.evaluate(t,e))return!1;return!0}}class R{constructor(t){this._args=t,this.type=h}static parse(t,e){const r=[];for(let s=1;s<t.length;s++)r.push(pt(t[s],e));return new R(r)}evaluate(t,e){for(const r of this._args)if(r.evaluate(t,e))return!0;return!1}}class z{constructor(t){this._args=t,this.type=h}static parse(t,e){const r=[];for(let s=1;s<t.length;s++)r.push(pt(t[s],e));return new z(r)}evaluate(t,e){for(const r of this._args)if(r.evaluate(t,e))return!1;return!0}}class I{constructor(t,e,r){this.type=t,this._args=e,this._fallback=r}static parse(t,e,r){if(t.length<4)throw new Error('"case" expects at least 3 arguments');if(t.length%2==1)throw new Error('"case" expects an odd number of arguments');let s;const n=[];for(let o=1;o<t.length-1;o+=2){const a=pt(t[o],e),i=pt(t[o+1],e,r);s||(s=i.type),n.push({condition:a,output:i})}const a=pt(t.at(-1),e,r);return s||(s=a.type),new I(s,n,a)}evaluate(t,e){for(const r of this._args)if(r.condition.evaluate(t,e))return r.output.evaluate(t,e);return this._fallback.evaluate(t,e)}}class L{constructor(t,e){this.type=t,this._args=e}static parse(t,e){if(t.length<2)throw new Error('"coalesce" expects at least 1 argument');let r;const s=[];for(let n=1;n<t.length;n++){const a=pt(t[n],e);r||(r=a.type),s.push(a)}return new L(r,s)}evaluate(t,e){for(const r of this._args){const s=r.evaluate(t,e);if(null!==s)return s}return null}}class U{constructor(t,e,r,s,n){this.type=t,this._input=e,this._labels=r,this._outputs=s,this._fallback=n}static parse(t,e){if(t.length<3)throw new Error('"match" expects at least 3 arguments');if(t.length%2==0)throw new Error('"case" expects an even number of arguments');let r;const s=pt(t[1],e),n=[],a={};let o;for(let i=2;i<t.length-1;i+=2){let s=t[i];Array.isArray(s)||(s=[s]);for(const t of s){const e=typeof t;if("string"!==e&&"number"!==e)throw new Error('"match" requires string or number literal as labels');if(o){if(e!==o)throw new Error('"match" requires labels to have the same type')}else o=e;a[t]=n.length}const l=pt(t[i+1],e);r||(r=l.type),n.push(l)}return new U(r,s,a,n,pt(t.at(-1),e))}evaluate(t,e){const r=this._input.evaluate(t,e);return(this._outputs[this._labels[r]]||this._fallback).evaluate(t,e)}}class P{constructor(t,e,r,s,n){this._operator=t,this.type=e,this.interpolation=r,this.input=s,this._stops=n}static parse(t,e,r){const s=t[0];if(t.length<5)throw new Error(`"${s}" expects at least 4 arguments`);const n=t[1];if(!Array.isArray(n)||0===n.length)throw new Error(`"${n}" is not a valid interpolation`);switch(n[0]){case"linear":if(1!==n.length)throw new Error("Linear interpolation cannot have parameters");break;case"exponential":if(2!==n.length||"number"!=typeof n[1])throw new Error("Exponential interpolation requires one numeric argument");break;case"cubic-bezier":if(5!==n.length)throw new Error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1");for(let t=1;t<5;t++){const e=n[t];if("number"!=typeof e||e<0||e>1)throw new Error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1")}break;default:throw new Error(`"${t[0]}" unknown interpolation type "${n[0]}"`)}if(t.length%2!=1)throw new Error(`"${s}" expects an even number of arguments`);const a=pt(t[2],e,c);let o;"interpolate-hcl"===s||"interpolate-lab"===s?o=p:r&&"value"!==r.kind&&(o=r);const i=[];for(let l=3;l<t.length;l+=2){const r=t[l];if("number"!=typeof r)throw new Error(`"${s}" requires stop inputs as literal numbers`);if(i.length&&i.at(-1)[0]>=r)throw new Error(`"${s}" requires strictly ascending stop inputs`);const n=pt(t[l+1],e,o);o||(o=n.type),i.push([r,n])}if(o&&o!==p&&o!==c&&("array"!==o.kind||o.itemType!==c))throw new Error(`"${s}" cannot interpolate type ${f(o)}`);return new P(s,o,n,a,i)}evaluate(n,a){const i=this._stops;if(1===i.length)return i[0][1].evaluate(n,a);const l=this.input.evaluate(n,a);if(l<=i[0][0])return i[0][1].evaluate(n,a);const u=i.at(-1);if(l>=u[0])return u[1].evaluate(n,a);let c=0;for(;++c<i.length&&!(l<i[c][0]););const h=i[c-1][0],p=i[c][0],g=P.interpolationRatio(this.interpolation,l,h,p),w=i[c-1][1].evaluate(n,a),m=i[c][1].evaluate(n,a);if("interpolate"===this._operator){if("array"===this.type.kind&&Array.isArray(w)&&Array.isArray(m))return w.map(((t,e)=>o(t,m[e],g)));if("color"===this.type.kind&&w instanceof t&&m instanceof t){const e=new t(w),r=new t(m);return new t([o(e.r,r.r,g),o(e.g,r.g,g),o(e.b,r.b,g),o(e.a,r.a,g)])}if("number"===this.type.kind&&"number"==typeof w&&"number"==typeof m)return o(w,m,g);throw new Error(`"${this._operator}" cannot interpolate type ${f(this.type)}`)}if("interpolate-hcl"===this._operator){const s=e(w),n=e(m),a=n.h-s.h,i=r({h:s.h+g*(a>180||a<-180?a-360*Math.round(a/360):a),c:o(s.c,n.c,g),l:o(s.l,n.l,g)});return new t({a:o(w.a,m.a,g),...i})}if("interpolate-lab"===this._operator){const e=s(w),n=s(m),a=r({l:o(e.l,n.l,g),a:o(e.a,n.a,g),b:o(e.b,n.b,g)});return new t({a:o(w.a,m.a,g),...a})}throw new Error(`Unexpected operator "${this._operator}"`)}interpolationUniformValue(t,e){const r=this._stops;if(1===r.length)return 0;if(t>=r.at(-1)[0])return 0;let s=0;for(;++s<r.length&&!(t<r[s][0]););const n=r[s-1][0],a=r[s][0];return P.interpolationRatio(this.interpolation,e,n,a)}getInterpolationRange(t){const e=this._stops;if(1===e.length){const t=e[0][0];return[t,t]}const r=e.at(-1)[0];if(t>=r)return[r,r];let s=0;for(;++s<e.length&&!(t<e[s][0]););return[e[s-1][0],e[s][0]]}static interpolationRatio(t,e,r,s){let n=0;if("linear"===t[0])n=P._exponentialInterpolationRatio(e,1,r,s);else if("exponential"===t[0])n=P._exponentialInterpolationRatio(e,t[1],r,s);else if("cubic-bezier"===t[0]){n=a(t[1],t[2],t[3],t[4])(P._exponentialInterpolationRatio(e,1,r,s),1e-5)}return n<0?n=0:n>1&&(n=1),n}static _exponentialInterpolationRatio(t,e,r,s){const n=s-r;if(0===n)return 0;const a=t-r;return 1===e?a/n:(e**a-1)/(e**n-1)}}class S{constructor(t,e,r){this.type=t,this._input=e,this._stops=r}static parse(t,e){if(t.length<5)throw new Error('"step" expects at least 4 arguments');if(t.length%2!=1)throw new Error('"step" expects an even number of arguments');const r=pt(t[1],e,c);let s;const n=[];n.push([-1/0,pt(t[2],e)]);for(let a=3;a<t.length;a+=2){const r=t[a];if("number"!=typeof r)throw new Error('"step" requires stop inputs as literal numbers');if(n.length&&n.at(-1)[0]>=r)throw new Error('"step" requires strictly ascending stop inputs');const o=pt(t[a+1],e);s||(s=o.type),n.push([r,o])}return new S(s,r,n)}evaluate(t,e){const r=this._stops;if(1===r.length)return r[0][1].evaluate(t,e);const s=this._input.evaluate(t,e);let n=0;for(;++n<r.length&&!(s<r[n][0]););return this._stops[n-1][1].evaluate(t,e)}}class B{constructor(t,e){this.type=t,this._output=e}static parse(t,e,r){if(t.length<4)throw new Error('"let" expects at least 3 arguments');if(t.length%2==1)throw new Error('"let" expects an odd number of arguments');const s=new _(e);for(let a=1;a<t.length-1;a+=2){const r=t[a];if("string"!=typeof r)throw new Error(`"let" requires a string to define variable names - found ${r}`);s.add(r,pt(t[a+1],e))}const n=pt(t.at(-1),s,r);return new B(n.type,n)}evaluate(t,e){return this._output.evaluate(t,e)}}class T{constructor(t,e){this.type=t,this.output=e}static parse(t,e,r){if(2!==t.length||"string"!=typeof t[1])throw new Error('"var" requires just one literal string argument');const s=e.get(t[1]);if(!s)throw new Error(`${t[1]} must be defined before being used in a "var" expression`);return new T(r||i,s)}evaluate(t,e){return this.output.evaluate(t,e)}}class O{constructor(t,e,r){this.type=t,this._index=e,this._array=r}static parse(t,e){if(3!==t.length)throw new Error('"at" expects 2 arguments');const r=pt(t[1],e,c),s=pt(t[2],e);return new O(s.type.itemType,r,s)}evaluate(t,e){const r=this._index.evaluate(t,e),s=this._array.evaluate(t,e);if(r<0||r>=s.length)throw new Error('"at" index out of bounds');if(r!==Math.floor(r))throw new Error('"at" index must be an integer');return s[r]}}class F{constructor(t,e){this._key=t,this._obj=e,this.type=i}static parse(t,e){let r,s;switch(t.length){case 2:return r=pt(t[1],e),new F(r);case 3:return r=pt(t[1],e),s=pt(t[2],e),new F(r,s);default:throw new Error('"get" expects 1 or 2 arguments')}}evaluate(t,e){const r=this._key.evaluate(t,e);if(this._obj){return this._obj.evaluate(t,e)[r]}return t?.values[r]}}class G{constructor(t,e){this._key=t,this._obj=e,this.type=h}static parse(t,e){let r,s;switch(t.length){case 2:return r=pt(t[1],e),new G(r);case 3:return r=pt(t[1],e),s=pt(t[2],e),new G(r,s);default:throw new Error('"has" expects 1 or 2 arguments')}}evaluate(t,e){const r=this._key.evaluate(t,e);if(this._obj){return r in this._obj.evaluate(t,e)}return!!t?.values[r]}}class V{constructor(t,e){this._key=t,this._vals=e,this.type=h}static parse(t,e){if(3!==t.length)throw new Error('"in" expects 2 arguments');return new V(pt(t[1],e),pt(t[2],e))}evaluate(t,e){const r=this._key.evaluate(t,e);return this._vals.evaluate(t,e).includes(r)}}class D{constructor(t,e,r){this._item=t,this._array=e,this._from=r,this.type=c}static parse(t,e){if(t.length<3||t.length>4)throw new Error('"index-of" expects 3 or 4 arguments');const r=pt(t[1],e),s=pt(t[2],e);if(4===t.length){const n=pt(t[3],e,c);return new D(r,s,n)}return new D(r,s)}evaluate(t,e){const r=this._item.evaluate(t,e),s=this._array.evaluate(t,e);if(this._from){const n=this._from.evaluate(t,e);if(n!==Math.floor(n))throw new Error('"index-of" index must be an integer');return s.indexOf(r,n)}return s.indexOf(r)}}class H{constructor(t){this._arg=t,this.type=c}static parse(t,e){if(2!==t.length)throw new Error('"length" expects 2 arguments');const r=pt(t[1],e);return new H(r)}evaluate(t,e){const r=this._arg.evaluate(t,e);if("string"==typeof r)return r.length;if(Array.isArray(r))return r.length;throw new Error('"length" expects string or array')}}class J{constructor(t,e,r,s){this.type=t,this._array=e,this._from=r,this._to=s}static parse(t,e){if(t.length<3||t.length>4)throw new Error('"slice" expects 2 or 3 arguments');const r=pt(t[1],e),s=pt(t[2],e,c);if(s.type!==c)throw new Error('"slice" index must return a number');if(4===t.length){const n=pt(t[3],e,c);if(n.type!==c)throw new Error('"slice" index must return a number');return new J(r.type,r,s,n)}return new J(r.type,r,s)}evaluate(t,e){const r=this._array.evaluate(t,e);if(!Array.isArray(r)&&"string"!=typeof r)throw new Error('"slice" input must be an array or a string');const s=this._from.evaluate(t,e);if(s<0||s>=r.length)throw new Error('"slice" index out of bounds');if(s!==Math.floor(s))throw new Error('"slice" index must be an integer');if(this._to){const n=this._to.evaluate(t,e);if(n<0||n>=r.length)throw new Error('"slice" index out of bounds');if(n!==Math.floor(n))throw new Error('"slice" index must be an integer');return r.slice(s,n)}return r.slice(s)}}class K{constructor(){this.type=h}static parse(t){if(1!==t.length)throw new Error('"has-id" expects no arguments');return new K}evaluate(t,e){return t&&void 0!==t.id}}class Q{constructor(t,e){this._args=t,this._calculate=e,this.type=c}static parse(t,e,r){const s=t.slice(1).map((t=>pt(t,e)));return new Q(s,r)}evaluate(t,e){let r;return this._args&&(r=this._args.map((r=>r.evaluate(t,e)))),this._calculate(r)}}class W extends Q{static parse(t,e){switch(t.length){case 2:return Q.parse(t,e,(t=>-t[0]));case 3:return Q.parse(t,e,(t=>t[0]-t[1]));default:throw new Error('"-" expects 1 or 2 arguments')}}}class X extends Q{static parse(t,e){return Q.parse(t,e,(t=>{let e=1;for(const r of t)e*=r;return e}))}}class Y extends Q{static parse(t,e){if(3===t.length)return Q.parse(t,e,(t=>t[0]/t[1]));throw new Error('"/" expects 2 arguments')}}class Z extends Q{static parse(t,e){if(3===t.length)return Q.parse(t,e,(t=>t[0]%t[1]));throw new Error('"%" expects 2 arguments')}}class tt extends Q{static parse(t,e){if(3===t.length)return Q.parse(t,e,(t=>t[0]**t[1]));throw new Error('"^" expects 1 or 2 arguments')}}class et extends Q{static parse(t,e){return Q.parse(t,e,(t=>{let e=0;for(const r of t)e+=r;return e}))}}class rt{constructor(t,e){this._args=t,this._calculate=e,this.type=c}static parse(t,e){const r=t.slice(1).map((t=>pt(t,e)));return new rt(r,rt.ops[t[0]])}evaluate(t,e){let r;return this._args&&(r=this._args.map((r=>r.evaluate(t,e)))),this._calculate(r)}}rt.ops={abs:t=>Math.abs(t[0]),acos:t=>Math.acos(t[0]),asin:t=>Math.asin(t[0]),atan:t=>Math.atan(t[0]),ceil:t=>Math.ceil(t[0]),cos:t=>Math.cos(t[0]),e:()=>Math.E,floor:t=>Math.floor(t[0]),ln:t=>Math.log(t[0]),ln2:()=>Math.LN2,log10:t=>Math.log(t[0])/Math.LN10,log2:t=>Math.log(t[0])/Math.LN2,max:t=>Math.max(...t),min:t=>Math.min(...t),pi:()=>Math.PI,round:t=>Math.round(t[0]),sin:t=>Math.sin(t[0]),sqrt:t=>Math.sqrt(t[0]),tan:t=>Math.tan(t[0])};class st{constructor(t){this._args=t,this.type=l}static parse(t,e){return new st(t.slice(1).map((t=>pt(t,e))))}evaluate(t,e){return this._args.map((r=>r.evaluate(t,e))).join("")}}class nt{constructor(t,e){this._arg=t,this._calculate=e,this.type=l}static parse(t,e){if(2!==t.length)throw new Error(`${t[0]} expects 1 argument`);const r=pt(t[1],e);return new nt(r,nt.ops[t[0]])}evaluate(t,e){return this._calculate(this._arg.evaluate(t,e))}}nt.ops={downcase:t=>t.toLowerCase(),upcase:t=>t.toUpperCase()};class at{constructor(t){this._args=t,this.type=p}static parse(t,e){if(4!==t.length)throw new Error('"rgb" expects 3 arguments');const r=t.slice(1).map((t=>pt(t,e)));return new at(r)}evaluate(e,r){const s=this._validate(this._args[0].evaluate(e,r)),n=this._validate(this._args[1].evaluate(e,r)),a=this._validate(this._args[2].evaluate(e,r));return new t({r:s,g:n,b:a})}_validate(t){if("number"!=typeof t||t<0||t>255)throw new Error(`${t}: invalid color component`);return Math.round(t)}}class ot{constructor(t){this._args=t,this.type=p}static parse(t,e){if(5!==t.length)throw new Error('"rgba" expects 4 arguments');const r=t.slice(1).map((t=>pt(t,e)));return new ot(r)}evaluate(e,r){const s=this._validate(this._args[0].evaluate(e,r)),n=this._validate(this._args[1].evaluate(e,r)),a=this._validate(this._args[2].evaluate(e,r)),o=this._validateAlpha(this._args[3].evaluate(e,r));return new t({r:s,g:n,b:a,a:o})}_validate(t){if("number"!=typeof t||t<0||t>255)throw new Error(`${t}: invalid color component`);return Math.round(t)}_validateAlpha(t){if("number"!=typeof t||t<0||t>1)throw new Error(`${t}: invalid alpha color component`);return t}}class it{constructor(t){this._color=t,this.type=g(c,4)}static parse(t,e){if(2!==t.length)throw new Error('"to-rgba" expects 1 argument');const r=pt(t[1],e);return new it(r)}evaluate(e,r){return new t(this._color.evaluate(e,r)).toRgba()}}class lt{constructor(t,e){this.type=t,this._args=e}static parse(t,e){const r=t[0];if(t.length<2)throw new Error(`${r} expects at least one argument`);let s,n=1;if("array"===r){if(t.length>2){switch(t[1]){case"string":s=l;break;case"number":s=c;break;case"boolean":s=h;break;default:throw new Error('"array" type argument must be string, number or boolean')}n++}else s=i;let e;if(t.length>3){if(e=t[2],null!==e&&("number"!=typeof e||e<0||e!==Math.floor(e)))throw new Error('"array" length argument must be a positive integer literal');n++}s=g(s,e)}else switch(r){case"string":s=l;break;case"number":s=c;break;case"boolean":s=h;break;case"object":s=u}const a=[];for(;n<t.length;n++){const r=pt(t[n],e);a.push(r)}return new lt(s,a)}evaluate(t,e){let r;for(const s of this._args){const n=s.evaluate(t,e);if(r=w(n),m(r,this.type))return n}throw new Error(`Expected ${f(this.type)} but got ${f(r)}`)}}class ut{constructor(t,e){this.type=t,this._args=e}static parse(t,e){const r=t[0],s=ut.types[r];if(s===h||s===l){if(2!==t.length)throw new Error(`${r} expects one argument`)}else if(t.length<2)throw new Error(`${r} expects at least one argument`);const n=[];for(let a=1;a<t.length;a++){const r=pt(t[a],e);n.push(r)}return new ut(s,n)}evaluate(e,r){if(this.type===h)return Boolean(this._args[0].evaluate(e,r));if(this.type===l)return y(this._args[0].evaluate(e,r));if(this.type===c){for(const t of this._args){const s=Number(t.evaluate(e,r));if(!isNaN(s))return s}return null}if(this.type===p){for(const s of this._args)try{const n=ut.toColor(s.evaluate(e,r));if(n instanceof t)return n}catch{}return null}}static toBoolean(t){return Boolean(t)}static toString(t){return y(t)}static toNumber(t){const e=Number(t);if(isNaN(e))throw new Error(`"${t}" is not a number`);return e}static toColor(e){if(e instanceof t)return e;if("string"==typeof e){const r=t.fromString(e);if(r)return r;throw new Error(`"${e}" is not a color`)}if(Array.isArray(e))return t.fromArray(e);throw new Error(`"${e}" is not a color`)}}ut.types={"to-boolean":h,"to-color":p,"to-number":c,"to-string":l};class ct{constructor(t){this._val=t,this.type=w(t)}static parse(t){if(2!==t.length)throw new Error('"literal" expects 1 argument');return new ct(t[1])}evaluate(t,e){return this._val}}class ht{constructor(t){this._arg=t,this.type=l}static parse(t,e){if(2!==t.length)throw new Error('"typeof" expects 1 argument');return new ht(pt(t[1],e))}evaluate(t,e){return f(w(this._arg.evaluate(t,e)))}}function pt(t,e,r){const s=typeof t;if("string"===s||"boolean"===s||"number"===s||null===t){if(r)switch(r.kind){case"string":"string"!==s&&(t=ut.toString(t));break;case"number":"number"!==s&&(t=ut.toNumber(t));break;case"color":t=ut.toColor(t)}t=["literal",t]}if(!Array.isArray(t)||0===t.length)throw new Error("Expression must be a non empty array");const n=t[0];if("string"!=typeof n)throw new Error("First element of expression must be a string");const a=ft[n];if(void 0===a)throw new Error(`Invalid expression operator "${n}"`);if(!a)throw new Error(`Unimplemented expression operator "${n}"`);return a.parse(t,e,r)}const ft={array:lt,boolean:lt,collator:null,format:null,image:null,literal:ct,number:lt,"number-format":null,object:lt,string:lt,"to-boolean":ut,"to-color":ut,"to-number":ut,"to-string":ut,typeof:ht,accumulated:null,"feature-state":null,"geometry-type":b,id:v,"line-progress":null,properties:d,at:O,get:F,has:G,in:V,"index-of":D,length:H,slice:J,"!":N,"!=":M,"<":k,"<=":A,"==":$,">":j,">=":q,all:C,any:R,case:I,coalesce:L,match:U,within:null,interpolate:P,"interpolate-hcl":P,"interpolate-lab":P,step:S,let:B,var:T,concat:st,downcase:nt,"is-supported-script":null,"resolved-locale":null,upcase:nt,rgb:at,rgba:ot,"to-rgba":it,"-":W,"*":X,"/":Y,"%":Z,"^":tt,"+":et,abs:rt,acos:rt,asin:rt,atan:rt,ceil:rt,cos:rt,e:rt,floor:rt,ln:rt,ln2:rt,log10:rt,log2:rt,max:rt,min:rt,pi:rt,round:rt,sin:rt,sqrt:rt,tan:rt,zoom:x,"heatmap-density":null,"has-id":K,none:z};export{C as ALL,R as ANY,et as Add,lt as Assert,O as At,rt as Calculate,I as Case,L as Coalesce,ut as Coerce,st as Concat,Y as Div,$ as EQ,q as GE,j as GT,b as GeomType,F as Get,G as Has,K as HasID,v as ID,V as In,D as IndexOf,P as Interpolate,A as LE,k as LT,H as Length,B as Let,ct as Literal,U as Match,Z as Mod,X as Mul,M as NE,z as NONE,N as NOT,tt as Pow,d as Properties,at as Rgb,ot as Rgba,J as Slice,S as Step,nt as String,W as Sub,it as ToRgba,ht as TypeOf,T as Var,x as Zoom,pt as createExpression,ft as ops};
5
+ import t from"../../../../../Color.js";import{toLCH as e,toRGB as r,toLAB as s}from"../../../../../core/colorUtils.js";import{GeometryType as n}from"../../../../../geometry/support/TileClipper.js";import{unitBezier as a}from"../../../unitBezier.js";import{interpolate as o}from"../GeometryUtils.js";import{ValueType as i,StringType as l,ObjectType as u,NumberType as c,BooleanType as h,ColorType as p,typeToString as g,arrayType as f,getType as w,matchType as m,valueToString as y}from"./types.js";class _{constructor(t){this._parent=t,this._vars={}}add(t,e){this._vars[t]=e}get(t){return this._vars[t]?this._vars[t]:this._parent?this._parent.get(t):null}}class v{constructor(){this.type=i}static parse(t){if(t.length>1)throw new Error('"id" does not expect arguments');return new v}evaluate(t,e){return t?.id}}class b{constructor(){this.type=l}static parse(t){if(t.length>1)throw new Error('"geometry-type" does not expect arguments');return new b}evaluate(t,e){if(!t)return null;switch(t.type){case n.Point:return"Point";case n.LineString:return"LineString";case n.Polygon:return"Polygon";default:return null}}}class d{constructor(){this.type=u}static parse(t){if(t.length>1)throw new Error('"properties" does not expect arguments');return new d}evaluate(t,e){return t?.values}}class x{constructor(){this.type=c}static parse(t){if(t.length>1)throw new Error('"zoom" does not expect arguments');return new x}evaluate(t,e){return e}}class E{constructor(t,e,r){this._lhs=t,this._rhs=e,this._compare=r,this.type=h}static parse(t,e,r){if(3!==t.length&&4!==t.length)throw new Error(`"${t[0]}" expects 2 or 3 arguments`);if(4===t.length)throw new Error(`"${t[0]}" collator not supported`);return new E(pt(t[1],e),pt(t[2],e),r)}evaluate(t,e){return this._compare(this._lhs.evaluate(t,e),this._rhs.evaluate(t,e))}}class $ extends E{static parse(t,e){return E.parse(t,e,((t,e)=>t===e))}}class M extends E{static parse(t,e){return E.parse(t,e,((t,e)=>t!==e))}}class k extends E{static parse(t,e){return E.parse(t,e,((t,e)=>t<e))}}class A extends E{static parse(t,e){return E.parse(t,e,((t,e)=>t<=e))}}class j extends E{static parse(t,e){return E.parse(t,e,((t,e)=>t>e))}}class q extends E{static parse(t,e){return E.parse(t,e,((t,e)=>t>=e))}}class N{constructor(t){this._arg=t,this.type=h}static parse(t,e){if(2!==t.length)throw new Error('"!" expects 1 argument');return new N(pt(t[1],e))}evaluate(t,e){return!this._arg.evaluate(t,e)}}class C{constructor(t){this._args=t,this.type=h}static parse(t,e){const r=[];for(let s=1;s<t.length;s++)r.push(pt(t[s],e));return new C(r)}evaluate(t,e){for(const r of this._args)if(!r.evaluate(t,e))return!1;return!0}}class R{constructor(t){this._args=t,this.type=h}static parse(t,e){const r=[];for(let s=1;s<t.length;s++)r.push(pt(t[s],e));return new R(r)}evaluate(t,e){for(const r of this._args)if(r.evaluate(t,e))return!0;return!1}}class z{constructor(t){this._args=t,this.type=h}static parse(t,e){const r=[];for(let s=1;s<t.length;s++)r.push(pt(t[s],e));return new z(r)}evaluate(t,e){for(const r of this._args)if(r.evaluate(t,e))return!1;return!0}}class I{constructor(t,e,r){this.type=t,this._args=e,this._fallback=r}static parse(t,e,r){if(t.length<4)throw new Error('"case" expects at least 3 arguments');if(t.length%2==1)throw new Error('"case" expects an odd number of arguments');let s;const n=[];for(let o=1;o<t.length-1;o+=2){const a=pt(t[o],e),i=pt(t[o+1],e,r);s||(s=i.type),n.push({condition:a,output:i})}const a=pt(t[t.length-1],e,r);return s||(s=a.type),new I(s,n,a)}evaluate(t,e){for(const r of this._args)if(r.condition.evaluate(t,e))return r.output.evaluate(t,e);return this._fallback.evaluate(t,e)}}class L{constructor(t,e){this.type=t,this._args=e}static parse(t,e){if(t.length<2)throw new Error('"coalesce" expects at least 1 argument');let r;const s=[];for(let n=1;n<t.length;n++){const a=pt(t[n],e);r||(r=a.type),s.push(a)}return new L(r,s)}evaluate(t,e){for(const r of this._args){const s=r.evaluate(t,e);if(null!==s)return s}return null}}class U{constructor(t,e,r,s,n){this.type=t,this._input=e,this._labels=r,this._outputs=s,this._fallback=n}static parse(t,e){if(t.length<3)throw new Error('"match" expects at least 3 arguments');if(t.length%2==0)throw new Error('"case" expects an even number of arguments');let r;const s=pt(t[1],e),n=[],a={};let o;for(let i=2;i<t.length-1;i+=2){let s=t[i];Array.isArray(s)||(s=[s]);for(const t of s){const e=typeof t;if("string"!==e&&"number"!==e)throw new Error('"match" requires string or number literal as labels');if(o){if(e!==o)throw new Error('"match" requires labels to have the same type')}else o=e;a[t]=n.length}const l=pt(t[i+1],e);r||(r=l.type),n.push(l)}return new U(r,s,a,n,pt(t[t.length-1],e))}evaluate(t,e){const r=this._input.evaluate(t,e);return(this._outputs[this._labels[r]]||this._fallback).evaluate(t,e)}}class P{constructor(t,e,r,s,n){this._operator=t,this.type=e,this.interpolation=r,this.input=s,this._stops=n}static parse(t,e,r){const s=t[0];if(t.length<5)throw new Error(`"${s}" expects at least 4 arguments`);const n=t[1];if(!Array.isArray(n)||0===n.length)throw new Error(`"${n}" is not a valid interpolation`);switch(n[0]){case"linear":if(1!==n.length)throw new Error("Linear interpolation cannot have parameters");break;case"exponential":if(2!==n.length||"number"!=typeof n[1])throw new Error("Exponential interpolation requires one numeric argument");break;case"cubic-bezier":if(5!==n.length)throw new Error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1");for(let t=1;t<5;t++){const e=n[t];if("number"!=typeof e||e<0||e>1)throw new Error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1")}break;default:throw new Error(`"${t[0]}" unknown interpolation type "${n[0]}"`)}if(t.length%2!=1)throw new Error(`"${s}" expects an even number of arguments`);const a=pt(t[2],e,c);let o;"interpolate-hcl"===s||"interpolate-lab"===s?o=p:r&&"value"!==r.kind&&(o=r);const i=[];for(let l=3;l<t.length;l+=2){const r=t[l];if("number"!=typeof r)throw new Error(`"${s}" requires stop inputs as literal numbers`);if(i.length&&i[i.length-1][0]>=r)throw new Error(`"${s}" requires strictly ascending stop inputs`);const n=pt(t[l+1],e,o);o||(o=n.type),i.push([r,n])}if(o&&o!==p&&o!==c&&("array"!==o.kind||o.itemType!==c))throw new Error(`"${s}" cannot interpolate type ${g(o)}`);return new P(s,o,n,a,i)}evaluate(n,a){const i=this._stops;if(1===i.length)return i[0][1].evaluate(n,a);const l=this.input.evaluate(n,a);if(l<=i[0][0])return i[0][1].evaluate(n,a);if(l>=i[i.length-1][0])return i[i.length-1][1].evaluate(n,a);let u=0;for(;++u<i.length&&!(l<i[u][0]););const c=i[u-1][0],h=i[u][0],p=P.interpolationRatio(this.interpolation,l,c,h),f=i[u-1][1].evaluate(n,a),w=i[u][1].evaluate(n,a);if("interpolate"===this._operator){if("array"===this.type.kind&&Array.isArray(f)&&Array.isArray(w))return f.map(((t,e)=>o(t,w[e],p)));if("color"===this.type.kind&&f instanceof t&&w instanceof t){const e=new t(f),r=new t(w);return new t([o(e.r,r.r,p),o(e.g,r.g,p),o(e.b,r.b,p),o(e.a,r.a,p)])}if("number"===this.type.kind&&"number"==typeof f&&"number"==typeof w)return o(f,w,p);throw new Error(`"${this._operator}" cannot interpolate type ${g(this.type)}`)}if("interpolate-hcl"===this._operator){const s=e(f),n=e(w),a=n.h-s.h,i=r({h:s.h+p*(a>180||a<-180?a-360*Math.round(a/360):a),c:o(s.c,n.c,p),l:o(s.l,n.l,p)});return new t({a:o(f.a,w.a,p),...i})}if("interpolate-lab"===this._operator){const e=s(f),n=s(w),a=r({l:o(e.l,n.l,p),a:o(e.a,n.a,p),b:o(e.b,n.b,p)});return new t({a:o(f.a,w.a,p),...a})}throw new Error(`Unexpected operator "${this._operator}"`)}interpolationUniformValue(t,e){const r=this._stops;if(1===r.length)return 0;if(t>=r[r.length-1][0])return 0;let s=0;for(;++s<r.length&&!(t<r[s][0]););const n=r[s-1][0],a=r[s][0];return P.interpolationRatio(this.interpolation,e,n,a)}getInterpolationRange(t){const e=this._stops;if(1===e.length){const t=e[0][0];return[t,t]}const r=e[e.length-1][0];if(t>=r)return[r,r];let s=0;for(;++s<e.length&&!(t<e[s][0]););return[e[s-1][0],e[s][0]]}static interpolationRatio(t,e,r,s){let n=0;if("linear"===t[0])n=P._exponentialInterpolationRatio(e,1,r,s);else if("exponential"===t[0])n=P._exponentialInterpolationRatio(e,t[1],r,s);else if("cubic-bezier"===t[0]){n=a(t[1],t[2],t[3],t[4])(P._exponentialInterpolationRatio(e,1,r,s),1e-5)}return n<0?n=0:n>1&&(n=1),n}static _exponentialInterpolationRatio(t,e,r,s){const n=s-r;if(0===n)return 0;const a=t-r;return 1===e?a/n:(e**a-1)/(e**n-1)}}class S{constructor(t,e,r){this.type=t,this._input=e,this._stops=r}static parse(t,e){if(t.length<5)throw new Error('"step" expects at least 4 arguments');if(t.length%2!=1)throw new Error('"step" expects an even number of arguments');const r=pt(t[1],e,c);let s;const n=[];n.push([-1/0,pt(t[2],e)]);for(let a=3;a<t.length;a+=2){const r=t[a];if("number"!=typeof r)throw new Error('"step" requires stop inputs as literal numbers');if(n.length&&n[n.length-1][0]>=r)throw new Error('"step" requires strictly ascending stop inputs');const o=pt(t[a+1],e);s||(s=o.type),n.push([r,o])}return new S(s,r,n)}evaluate(t,e){const r=this._stops;if(1===r.length)return r[0][1].evaluate(t,e);const s=this._input.evaluate(t,e);let n=0;for(;++n<r.length&&!(s<r[n][0]););return this._stops[n-1][1].evaluate(t,e)}}class B{constructor(t,e){this.type=t,this._output=e}static parse(t,e,r){if(t.length<4)throw new Error('"let" expects at least 3 arguments');if(t.length%2==1)throw new Error('"let" expects an odd number of arguments');const s=new _(e);for(let a=1;a<t.length-1;a+=2){const r=t[a];if("string"!=typeof r)throw new Error(`"let" requires a string to define variable names - found ${r}`);s.add(r,pt(t[a+1],e))}const n=pt(t[t.length-1],s,r);return new B(n.type,n)}evaluate(t,e){return this._output.evaluate(t,e)}}class T{constructor(t,e){this.type=t,this.output=e}static parse(t,e,r){if(2!==t.length||"string"!=typeof t[1])throw new Error('"var" requires just one literal string argument');const s=e.get(t[1]);if(!s)throw new Error(`${t[1]} must be defined before being used in a "var" expression`);return new T(r||i,s)}evaluate(t,e){return this.output.evaluate(t,e)}}class O{constructor(t,e,r){this.type=t,this._index=e,this._array=r}static parse(t,e){if(3!==t.length)throw new Error('"at" expects 2 arguments');const r=pt(t[1],e,c),s=pt(t[2],e);return new O(s.type.itemType,r,s)}evaluate(t,e){const r=this._index.evaluate(t,e),s=this._array.evaluate(t,e);if(r<0||r>=s.length)throw new Error('"at" index out of bounds');if(r!==Math.floor(r))throw new Error('"at" index must be an integer');return s[r]}}class F{constructor(t,e){this._key=t,this._obj=e,this.type=i}static parse(t,e){let r,s;switch(t.length){case 2:return r=pt(t[1],e),new F(r);case 3:return r=pt(t[1],e),s=pt(t[2],e),new F(r,s);default:throw new Error('"get" expects 1 or 2 arguments')}}evaluate(t,e){const r=this._key.evaluate(t,e);if(this._obj){return this._obj.evaluate(t,e)[r]}return t?.values[r]}}class G{constructor(t,e){this._key=t,this._obj=e,this.type=h}static parse(t,e){let r,s;switch(t.length){case 2:return r=pt(t[1],e),new G(r);case 3:return r=pt(t[1],e),s=pt(t[2],e),new G(r,s);default:throw new Error('"has" expects 1 or 2 arguments')}}evaluate(t,e){const r=this._key.evaluate(t,e);if(this._obj){return r in this._obj.evaluate(t,e)}return!!t?.values[r]}}class V{constructor(t,e){this._key=t,this._vals=e,this.type=h}static parse(t,e){if(3!==t.length)throw new Error('"in" expects 2 arguments');return new V(pt(t[1],e),pt(t[2],e))}evaluate(t,e){const r=this._key.evaluate(t,e);return this._vals.evaluate(t,e).includes(r)}}class D{constructor(t,e,r){this._item=t,this._array=e,this._from=r,this.type=c}static parse(t,e){if(t.length<3||t.length>4)throw new Error('"index-of" expects 3 or 4 arguments');const r=pt(t[1],e),s=pt(t[2],e);if(4===t.length){const n=pt(t[3],e,c);return new D(r,s,n)}return new D(r,s)}evaluate(t,e){const r=this._item.evaluate(t,e),s=this._array.evaluate(t,e);if(this._from){const n=this._from.evaluate(t,e);if(n!==Math.floor(n))throw new Error('"index-of" index must be an integer');return s.indexOf(r,n)}return s.indexOf(r)}}class H{constructor(t){this._arg=t,this.type=c}static parse(t,e){if(2!==t.length)throw new Error('"length" expects 2 arguments');const r=pt(t[1],e);return new H(r)}evaluate(t,e){const r=this._arg.evaluate(t,e);if("string"==typeof r)return r.length;if(Array.isArray(r))return r.length;throw new Error('"length" expects string or array')}}class J{constructor(t,e,r,s){this.type=t,this._array=e,this._from=r,this._to=s}static parse(t,e){if(t.length<3||t.length>4)throw new Error('"slice" expects 2 or 3 arguments');const r=pt(t[1],e),s=pt(t[2],e,c);if(s.type!==c)throw new Error('"slice" index must return a number');if(4===t.length){const n=pt(t[3],e,c);if(n.type!==c)throw new Error('"slice" index must return a number');return new J(r.type,r,s,n)}return new J(r.type,r,s)}evaluate(t,e){const r=this._array.evaluate(t,e);if(!Array.isArray(r)&&"string"!=typeof r)throw new Error('"slice" input must be an array or a string');const s=this._from.evaluate(t,e);if(s<0||s>=r.length)throw new Error('"slice" index out of bounds');if(s!==Math.floor(s))throw new Error('"slice" index must be an integer');if(this._to){const n=this._to.evaluate(t,e);if(n<0||n>=r.length)throw new Error('"slice" index out of bounds');if(n!==Math.floor(n))throw new Error('"slice" index must be an integer');return r.slice(s,n)}return r.slice(s)}}class K{constructor(){this.type=h}static parse(t){if(1!==t.length)throw new Error('"has-id" expects no arguments');return new K}evaluate(t,e){return t&&void 0!==t.id}}class Q{constructor(t,e){this._args=t,this._calculate=e,this.type=c}static parse(t,e,r){const s=t.slice(1).map((t=>pt(t,e)));return new Q(s,r)}evaluate(t,e){let r;return this._args&&(r=this._args.map((r=>r.evaluate(t,e)))),this._calculate(r)}}class W extends Q{static parse(t,e){switch(t.length){case 2:return Q.parse(t,e,(t=>-t[0]));case 3:return Q.parse(t,e,(t=>t[0]-t[1]));default:throw new Error('"-" expects 1 or 2 arguments')}}}class X extends Q{static parse(t,e){return Q.parse(t,e,(t=>{let e=1;for(const r of t)e*=r;return e}))}}class Y extends Q{static parse(t,e){if(3===t.length)return Q.parse(t,e,(t=>t[0]/t[1]));throw new Error('"/" expects 2 arguments')}}class Z extends Q{static parse(t,e){if(3===t.length)return Q.parse(t,e,(t=>t[0]%t[1]));throw new Error('"%" expects 2 arguments')}}class tt extends Q{static parse(t,e){if(3===t.length)return Q.parse(t,e,(t=>t[0]**t[1]));throw new Error('"^" expects 1 or 2 arguments')}}class et extends Q{static parse(t,e){return Q.parse(t,e,(t=>{let e=0;for(const r of t)e+=r;return e}))}}class rt{constructor(t,e){this._args=t,this._calculate=e,this.type=c}static parse(t,e){const r=t.slice(1).map((t=>pt(t,e)));return new rt(r,rt.ops[t[0]])}evaluate(t,e){let r;return this._args&&(r=this._args.map((r=>r.evaluate(t,e)))),this._calculate(r)}}rt.ops={abs:t=>Math.abs(t[0]),acos:t=>Math.acos(t[0]),asin:t=>Math.asin(t[0]),atan:t=>Math.atan(t[0]),ceil:t=>Math.ceil(t[0]),cos:t=>Math.cos(t[0]),e:()=>Math.E,floor:t=>Math.floor(t[0]),ln:t=>Math.log(t[0]),ln2:()=>Math.LN2,log10:t=>Math.log(t[0])/Math.LN10,log2:t=>Math.log(t[0])/Math.LN2,max:t=>Math.max(...t),min:t=>Math.min(...t),pi:()=>Math.PI,round:t=>Math.round(t[0]),sin:t=>Math.sin(t[0]),sqrt:t=>Math.sqrt(t[0]),tan:t=>Math.tan(t[0])};class st{constructor(t){this._args=t,this.type=l}static parse(t,e){return new st(t.slice(1).map((t=>pt(t,e))))}evaluate(t,e){return this._args.map((r=>r.evaluate(t,e))).join("")}}class nt{constructor(t,e){this._arg=t,this._calculate=e,this.type=l}static parse(t,e){if(2!==t.length)throw new Error(`${t[0]} expects 1 argument`);const r=pt(t[1],e);return new nt(r,nt.ops[t[0]])}evaluate(t,e){return this._calculate(this._arg.evaluate(t,e))}}nt.ops={downcase:t=>t.toLowerCase(),upcase:t=>t.toUpperCase()};class at{constructor(t){this._args=t,this.type=p}static parse(t,e){if(4!==t.length)throw new Error('"rgb" expects 3 arguments');const r=t.slice(1).map((t=>pt(t,e)));return new at(r)}evaluate(e,r){const s=this._validate(this._args[0].evaluate(e,r)),n=this._validate(this._args[1].evaluate(e,r)),a=this._validate(this._args[2].evaluate(e,r));return new t({r:s,g:n,b:a})}_validate(t){if("number"!=typeof t||t<0||t>255)throw new Error(`${t}: invalid color component`);return Math.round(t)}}class ot{constructor(t){this._args=t,this.type=p}static parse(t,e){if(5!==t.length)throw new Error('"rgba" expects 4 arguments');const r=t.slice(1).map((t=>pt(t,e)));return new ot(r)}evaluate(e,r){const s=this._validate(this._args[0].evaluate(e,r)),n=this._validate(this._args[1].evaluate(e,r)),a=this._validate(this._args[2].evaluate(e,r)),o=this._validateAlpha(this._args[3].evaluate(e,r));return new t({r:s,g:n,b:a,a:o})}_validate(t){if("number"!=typeof t||t<0||t>255)throw new Error(`${t}: invalid color component`);return Math.round(t)}_validateAlpha(t){if("number"!=typeof t||t<0||t>1)throw new Error(`${t}: invalid alpha color component`);return t}}class it{constructor(t){this._color=t,this.type=f(c,4)}static parse(t,e){if(2!==t.length)throw new Error('"to-rgba" expects 1 argument');const r=pt(t[1],e);return new it(r)}evaluate(e,r){return new t(this._color.evaluate(e,r)).toRgba()}}class lt{constructor(t,e){this.type=t,this._args=e}static parse(t,e){const r=t[0];if(t.length<2)throw new Error(`${r} expects at least one argument`);let s,n=1;if("array"===r){if(t.length>2){switch(t[1]){case"string":s=l;break;case"number":s=c;break;case"boolean":s=h;break;default:throw new Error('"array" type argument must be string, number or boolean')}n++}else s=i;let e;if(t.length>3){if(e=t[2],null!==e&&("number"!=typeof e||e<0||e!==Math.floor(e)))throw new Error('"array" length argument must be a positive integer literal');n++}s=f(s,e)}else switch(r){case"string":s=l;break;case"number":s=c;break;case"boolean":s=h;break;case"object":s=u}const a=[];for(;n<t.length;n++){const r=pt(t[n],e);a.push(r)}return new lt(s,a)}evaluate(t,e){let r;for(const s of this._args){const n=s.evaluate(t,e);if(r=w(n),m(r,this.type))return n}throw new Error(`Expected ${g(this.type)} but got ${g(r)}`)}}class ut{constructor(t,e){this.type=t,this._args=e}static parse(t,e){const r=t[0],s=ut.types[r];if(s===h||s===l){if(2!==t.length)throw new Error(`${r} expects one argument`)}else if(t.length<2)throw new Error(`${r} expects at least one argument`);const n=[];for(let a=1;a<t.length;a++){const r=pt(t[a],e);n.push(r)}return new ut(s,n)}evaluate(e,r){if(this.type===h)return Boolean(this._args[0].evaluate(e,r));if(this.type===l)return y(this._args[0].evaluate(e,r));if(this.type===c){for(const t of this._args){const s=Number(t.evaluate(e,r));if(!isNaN(s))return s}return null}if(this.type===p){for(const s of this._args)try{const n=ut.toColor(s.evaluate(e,r));if(n instanceof t)return n}catch{}return null}}static toBoolean(t){return Boolean(t)}static toString(t){return y(t)}static toNumber(t){const e=Number(t);if(isNaN(e))throw new Error(`"${t}" is not a number`);return e}static toColor(e){if(e instanceof t)return e;if("string"==typeof e){const r=t.fromString(e);if(r)return r;throw new Error(`"${e}" is not a color`)}if(Array.isArray(e))return t.fromArray(e);throw new Error(`"${e}" is not a color`)}}ut.types={"to-boolean":h,"to-color":p,"to-number":c,"to-string":l};class ct{constructor(t){this._val=t,this.type=w(t)}static parse(t){if(2!==t.length)throw new Error('"literal" expects 1 argument');return new ct(t[1])}evaluate(t,e){return this._val}}class ht{constructor(t){this._arg=t,this.type=l}static parse(t,e){if(2!==t.length)throw new Error('"typeof" expects 1 argument');return new ht(pt(t[1],e))}evaluate(t,e){return g(w(this._arg.evaluate(t,e)))}}function pt(t,e,r){const s=typeof t;if("string"===s||"boolean"===s||"number"===s||null===t){if(r)switch(r.kind){case"string":"string"!==s&&(t=ut.toString(t));break;case"number":"number"!==s&&(t=ut.toNumber(t));break;case"color":t=ut.toColor(t)}t=["literal",t]}if(!Array.isArray(t)||0===t.length)throw new Error("Expression must be a non empty array");const n=t[0];if("string"!=typeof n)throw new Error("First element of expression must be a string");const a=gt[n];if(void 0===a)throw new Error(`Invalid expression operator "${n}"`);if(!a)throw new Error(`Unimplemented expression operator "${n}"`);return a.parse(t,e,r)}const gt={array:lt,boolean:lt,collator:null,format:null,image:null,literal:ct,number:lt,"number-format":null,object:lt,string:lt,"to-boolean":ut,"to-color":ut,"to-number":ut,"to-string":ut,typeof:ht,accumulated:null,"feature-state":null,"geometry-type":b,id:v,"line-progress":null,properties:d,at:O,get:F,has:G,in:V,"index-of":D,length:H,slice:J,"!":N,"!=":M,"<":k,"<=":A,"==":$,">":j,">=":q,all:C,any:R,case:I,coalesce:L,match:U,within:null,interpolate:P,"interpolate-hcl":P,"interpolate-lab":P,step:S,let:B,var:T,concat:st,downcase:nt,"is-supported-script":null,"resolved-locale":null,upcase:nt,rgb:at,rgba:ot,"to-rgba":it,"-":W,"*":X,"/":Y,"%":Z,"^":tt,"+":et,abs:rt,acos:rt,asin:rt,atan:rt,ceil:rt,cos:rt,e:rt,floor:rt,ln:rt,ln2:rt,log10:rt,log2:rt,max:rt,min:rt,pi:rt,round:rt,sin:rt,sqrt:rt,tan:rt,zoom:x,"heatmap-density":null,"has-id":K,none:z};export{C as ALL,R as ANY,et as Add,lt as Assert,O as At,rt as Calculate,I as Case,L as Coalesce,ut as Coerce,st as Concat,Y as Div,$ as EQ,q as GE,j as GT,b as GeomType,F as Get,G as Has,K as HasID,v as ID,V as In,D as IndexOf,P as Interpolate,A as LE,k as LT,H as Length,B as Let,ct as Literal,U as Match,Z as Mod,X as Mul,M as NE,z as NONE,N as NOT,tt as Pow,d as Properties,at as Rgb,ot as Rgba,J as Slice,S as Step,nt as String,W as Sub,it as ToRgba,ht as TypeOf,T as Var,x as Zoom,pt as createExpression,gt as ops};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{clone as t}from"../../../../../core/lang.js";import{urlToObject as e,isAbsolute as i,join as l,addQueryParameters as s}from"../../../../../core/urlUtils.js";import r from"../../../../../geometry/Extent.js";import o from"../../../../../layers/support/TileInfo.js";import{TilemapCache as a}from"../../../../../layers/support/TilemapCache.js";import n from"../TilemapIndex.js";import p from"../TilemapRequest.js";import{request as u}from"./VectorTilesRequestManager.js";class h{constructor(u,h,m){this.tilemap=null,this.tileInfo=null,this.capabilities=null,this.fullExtent=null,this.name=u,this.sourceUrl=h;const f=e(this.sourceUrl),c=t(m),d=c.tiles;if(f)for(let t=0;t<d.length;t++){const r=e(d[t]);r&&(i(r.path)||(r.path=l(f.path,r.path)),d[t]=s(r.path,{...f.query,...r.query}))}this.tileServers=d;const x=m.capabilities&&m.capabilities.split(",").map((t=>t.toLowerCase().trim())),y=!0===m?.exportTilesAllowed,T=!0===x?.includes("tilemap"),I=y&&m.hasOwnProperty("maxExportTilesCount")?m.maxExportTilesCount:0;this.capabilities={operations:{supportsExportTiles:y,supportsTileMap:T},exportTiles:y?{maxExportTilesCount:+I}:null},this.tileInfo=o.fromJSON(c.tileInfo);const g=m.tileMap?s(l(f.path,m.tileMap),f.query??{}):null;T?(this.type="vector-tile",this.tilemap=new p(new a({layer:{parsedUrl:f,tileInfo:this.tileInfo},minLOD:c.minLOD??this.tileInfo.lods[0].level,maxLOD:c.maxLOD??this.tileInfo.lods.at(-1).level}),g)):g&&(this.tilemap=new n(g)),this.fullExtent=r.fromJSON(m.fullExtent)}destroy(){this.tilemap?.destroy()}async getRefKey(t,e){return await(this.tilemap?.dataKey(t,e))??t}requestTile(t,e,i,l){const s=this.tileServers[e%this.tileServers.length];return u(s,t,e,i,l)}isCompatibleWith(t){const e=this.tileInfo,i=t.tileInfo;if(!e.spatialReference.equals(i.spatialReference))return!1;if(!e.origin.equals(i.origin))return!1;if(Math.round(e.dpi)!==Math.round(i.dpi))return!1;const l=e.lods,s=i.lods,r=Math.min(l.length,s.length);for(let o=0;o<r;o++){const t=l[o],e=s[o];if(t.level!==e.level||Math.round(t.scale)!==Math.round(e.scale))return!1}return!0}}export{h as default};
5
+ import{clone as t}from"../../../../../core/lang.js";import{urlToObject as e,isAbsolute as i,join as l,addQueryParameters as s}from"../../../../../core/urlUtils.js";import r from"../../../../../geometry/Extent.js";import o from"../../../../../layers/support/TileInfo.js";import{TilemapCache as n}from"../../../../../layers/support/TilemapCache.js";import a from"../TilemapIndex.js";import p from"../TilemapRequest.js";import{request as h}from"./VectorTilesRequestManager.js";class u{constructor(h,u,m){this.tilemap=null,this.tileInfo=null,this.capabilities=null,this.fullExtent=null,this.name=h,this.sourceUrl=u;const f=e(this.sourceUrl),c=t(m),d=c.tiles;if(f)for(let t=0;t<d.length;t++){const r=e(d[t]);r&&(i(r.path)||(r.path=l(f.path,r.path)),d[t]=s(r.path,{...f.query,...r.query}))}this.tileServers=d;const x=m.capabilities&&m.capabilities.split(",").map((t=>t.toLowerCase().trim())),y=!0===m?.exportTilesAllowed,T=!0===x?.includes("tilemap"),I=y&&m.hasOwnProperty("maxExportTilesCount")?m.maxExportTilesCount:0;this.capabilities={operations:{supportsExportTiles:y,supportsTileMap:T},exportTiles:y?{maxExportTilesCount:+I}:null},this.tileInfo=o.fromJSON(c.tileInfo);const g=m.tileMap?s(l(f.path,m.tileMap),f.query??{}):null;T?(this.type="vector-tile",this.tilemap=new p(new n({layer:{parsedUrl:f,tileInfo:this.tileInfo},minLOD:c.minLOD??this.tileInfo.lods[0].level,maxLOD:c.maxLOD??this.tileInfo.lods[this.tileInfo.lods.length-1].level}),g)):g&&(this.tilemap=new a(g)),this.fullExtent=r.fromJSON(m.fullExtent)}destroy(){this.tilemap?.destroy()}async getRefKey(t,e){return await(this.tilemap?.dataKey(t,e))??t}requestTile(t,e,i,l){const s=this.tileServers[e%this.tileServers.length];return h(s,t,e,i,l)}isCompatibleWith(t){const e=this.tileInfo,i=t.tileInfo;if(!e.spatialReference.equals(i.spatialReference))return!1;if(!e.origin.equals(i.origin))return!1;if(Math.round(e.dpi)!==Math.round(i.dpi))return!1;const l=e.lods,s=i.lods,r=Math.min(l.length,s.length);for(let o=0;o<r;o++){const t=l[o],e=s[o];if(t.level!==e.level||Math.round(t.scale)!==Math.round(e.scale))return!1}return!0}}export{u as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import l from"../../../../geometry/Point.js";import e from"../../../../layers/support/LOD.js";import r from"../../../../layers/support/TileInfo.js";const n=1e-6;function s(l,e){if(l===e)return!0;if(null==l&&null!=e)return!1;if(null!=l&&null==e)return!1;if(null==l||null==e)return!1;if(!l.spatialReference.equals(e.spatialReference)||l.dpi!==e.dpi)return!1;const r=l.origin,s=e.origin;if(Math.abs(r.x-s.x)>=n||Math.abs(r.y-s.y)>=n)return!1;let t,o;l.lods[0].scale>e.lods[0].scale?(t=l,o=e):(o=l,t=e);for(let i=t.lods[0].scale;i>=o.lods.at(-1).scale-n;i/=2)if(Math.abs(i-o.lods[0].scale)<n)return!0;return!1}function t(n,s){if(n===s)return n;if(null==n&&null!=s)return s;if(null!=n&&null==s)return n;if(null==n||null==s)return null;const t=n.size[0],o=n.format,i=n.dpi,a=new l({x:n.origin.x,y:n.origin.y}),u=n.spatialReference,f=n.lods[0].scale>s.lods[0].scale?n.lods[0]:s.lods[0],c=n.lods.at(-1).scale<=s.lods.at(-1).scale?n.lods.at(-1):s.lods.at(-1),d=f.scale,p=f.resolution,m=c.scale,y=[];let g=d,x=p,b=0;for(;g>m;)y.push(new e({level:b,resolution:x,scale:g})),b++,g/=2,x/=2;return new r({size:[t,t],dpi:i,format:o||"pbf",origin:a,lods:y,spatialReference:u})}export{s as areSchemasOverlapping,t as unionTileInfos};
5
+ import l from"../../../../geometry/Point.js";import e from"../../../../layers/support/LOD.js";import n from"../../../../layers/support/TileInfo.js";const s=1e-6;function r(l,e){if(l===e)return!0;if(null==l&&null!=e)return!1;if(null!=l&&null==e)return!1;if(null==l||null==e)return!1;if(!l.spatialReference.equals(e.spatialReference)||l.dpi!==e.dpi)return!1;const n=l.origin,r=e.origin;if(Math.abs(n.x-r.x)>=s||Math.abs(n.y-r.y)>=s)return!1;let o,t;l.lods[0].scale>e.lods[0].scale?(o=l,t=e):(t=l,o=e);for(let i=o.lods[0].scale;i>=t.lods[t.lods.length-1].scale-s;i/=2)if(Math.abs(i-t.lods[0].scale)<s)return!0;return!1}function o(s,r){if(s===r)return s;if(null==s&&null!=r)return r;if(null!=s&&null==r)return s;if(null==s||null==r)return null;const o=s.size[0],t=s.format,i=s.dpi,u=new l({x:s.origin.x,y:s.origin.y}),a=s.spatialReference,f=s.lods[0].scale>r.lods[0].scale?s.lods[0]:r.lods[0],d=s.lods[s.lods.length-1].scale<=r.lods[r.lods.length-1].scale?s.lods[s.lods.length-1]:r.lods[r.lods.length-1],c=f.scale,p=f.resolution,g=d.scale,h=[];let m=c,y=p,x=0;for(;m>g;)h.push(new e({level:x,resolution:y,scale:m})),x++,m/=2,y/=2;return new n({size:[o,o],dpi:i,format:t||"pbf",origin:u,lods:h,spatialReference:a})}export{r as areSchemasOverlapping,o as unionTileInfos};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{CapType as t,JoinType as e}from"../../../../symbols/cim/enums.js";import{THIN_LINE_HALF_WIDTH_THRESHOLD as i}from"./definitions.js";function x(t,e){return t.x===e.x&&t.y===e.y}function r(t){if(!t)return;const e=t.length;if(e<=1)return;let i=0;for(let r=1;r<e;r++)x(t[r],t[i])||++i===r||(t[i]=t[r]);t.length=i+1}function s(t,e){return t.x=e.y,t.y=-e.x,t}function n(t,e){return t.x=-e.y,t.y=e.x,t}function y(t,e){return t.x=e.x,t.y=e.y,t}function o(t,e){return t.x=-e.x,t.y=-e.y,t}function h(t){return Math.sqrt(t.x*t.x+t.y*t.y)}function l(t,e){return t.x*e.y-t.y*e.x}function _(t,e){return t.x*e.x+t.y*e.y}function a(t,e,i,x){return t.x=e.x*i+e.y*x,t.y=e.x*x-e.y*i,t}class c{constructor(t,e,i){this._writeVertex=t,this._writeTriangle=e,this._canUseThinTessellation=i,this._prevNormal={x:void 0,y:void 0},this._nextNormal={x:void 0,y:void 0},this._textureNormalLeft={x:0,y:1},this._textureNormalRight={x:0,y:-1},this._textureNormal={x:void 0,y:void 0},this._joinNormal={x:void 0,y:void 0},this._inner={x:void 0,y:void 0},this._outer={x:void 0,y:void 0},this._roundStart={x:void 0,y:void 0},this._roundEnd={x:void 0,y:void 0},this._startBreak={x:void 0,y:void 0},this._endBreak={x:void 0,y:void 0},this._innerPrev={x:void 0,y:void 0},this._innerNext={x:void 0,y:void 0},this._bevelStart={x:void 0,y:void 0},this._bevelEnd={x:void 0,y:void 0},this._bevelMiddle={x:void 0,y:void 0}}tessellate(t,e){r(t),this._canUseThinTessellation&&e.halfWidth<i&&!e.offset?this._tessellateThin(t,e):this._tessellate(t,e)}_tessellateThin(t,e){if(t.length<2)return;const i=e.wrapDistance||65535;let x=e.initialDistance||0,r=!1,s=t[0].x,n=t[0].y;const y=t.length;for(let o=1;o<y;++o){r&&(r=!1,x=0);let e=t[o].x,y=t[o].y,h=e-s,l=y-n,_=Math.sqrt(h*h+l*l);if(h/=_,l/=_,x+_>i){r=!0;const t=(i-x)/_;_=i-x,e=(1-t)*s+t*e,y=(1-t)*n+t*y,--o}const a=this._writeVertex(s,n,0,0,h,l,l,-h,0,-1,x),c=this._writeVertex(s,n,0,0,h,l,-l,h,0,1,x);x+=_;const d=this._writeVertex(e,y,0,0,h,l,l,-h,0,-1,x),u=this._writeVertex(e,y,0,0,h,l,-l,h,0,1,x);this._writeTriangle(a,c,d),this._writeTriangle(c,d,u),s=e,n=y}}_tessellate(i,r){const c=i[0],d=i.at(-1),u=x(c,d),v=u?3:2;if(i.length<v)return;const f=r.pixelCoordRatio,w=null!=r.capType?r.capType:t.BUTT,T=null!=r.joinType?r.joinType:e.MITER,m=null!=r.miterLimit?Math.min(r.miterLimit,4):2,g=null!=r.roundLimit?Math.min(r.roundLimit,1.05):1.05,V=null!=r.halfWidth?r.halfWidth:2,N=!!r.textured;let E,b,R,U=null;const k=this._prevNormal,p=this._nextNormal;let M=-1,B=-1;const L=this._joinNormal;let D,S;const j=this._textureNormalLeft,A=this._textureNormalRight,O=this._textureNormal;let I=-1,P=-1;const W=r.wrapDistance||65535;let q=r.initialDistance||0;const Q=this._writeVertex,X=this._writeTriangle,C=(t,e,i,x,r,s)=>{const n=Q(b,R,D,S,i,x,t,e,r,s,q);return I>=0&&P>=0&&n>=0&&X(I,P,n),I=P,P=n,n};u&&(E=i.at(-2),p.x=d.x-E.x,p.y=d.y-E.y,B=h(p),p.x/=B,p.y/=B);let z=!1;for(let x=0;x<i.length;++x){if(z&&(z=!1,q=0),E&&(k.x=-p.x,k.y=-p.y,M=B,q+M>W&&(z=!0)),z){const t=(W-q)/M;M=W-q,E={x:(1-t)*E.x+t*i[x].x,y:(1-t)*E.y+t*i[x].y},--x}else E=i[x];b=E.x,R=E.y;const r=x<=0&&!z,c=x===i.length-1;if(r||(q+=M),U=c?u?i[1]:null:i[x+1],U?(p.x=U.x-b,p.y=U.y-R,B=h(p),p.x/=B,p.y/=B):(p.x=void 0,p.y=void 0),!u){if(r){n(L,p),D=L.x,S=L.y,w===t.SQUARE&&(C(-p.y-p.x,p.x-p.y,p.x,p.y,0,-1),C(p.y-p.x,-p.x-p.y,p.x,p.y,0,1)),w===t.ROUND&&(C(-p.y-p.x,p.x-p.y,p.x,p.y,-1,-1),C(p.y-p.x,-p.x-p.y,p.x,p.y,-1,1)),w!==t.ROUND&&w!==t.BUTT||(C(-p.y,p.x,p.x,p.y,0,-1),C(p.y,-p.x,p.x,p.y,0,1));continue}if(c){s(L,k),D=L.x,S=L.y,w!==t.ROUND&&w!==t.BUTT||(C(k.y,-k.x,-k.x,-k.y,0,-1),C(-k.y,k.x,-k.x,-k.y,0,1)),w===t.SQUARE&&(C(k.y-k.x,-k.x-k.y,-k.x,-k.y,0,-1),C(-k.y-k.x,k.x-k.y,-k.x,-k.y,0,1)),w===t.ROUND&&(C(k.y-k.x,-k.x-k.y,-k.x,-k.y,1,-1),C(-k.y-k.x,k.x-k.y,-k.x,-k.y,1,1));continue}}let d,v,Q=-l(k,p);if(Math.abs(Q)<.01)_(k,p)>0?(L.x=k.x,L.y=k.y,Q=1,d=Number.MAX_VALUE,v=!0):(n(L,p),Q=1,d=1,v=!1);else{L.x=(k.x+p.x)/Q,L.y=(k.y+p.y)/Q,d=h(L);const t=(d-1)*V*f;v=d>4||t>M&&t>B}D=L.x,S=L.y;let X=T;switch(T){case e.BEVEL:d<1.05&&(X=e.MITER);break;case e.ROUND:d<g&&(X=e.MITER);break;case e.MITER:d>m&&(X=e.BEVEL)}switch(X){case e.MITER:if(C(L.x,L.y,-k.x,-k.y,0,-1),C(-L.x,-L.y,-k.x,-k.y,0,1),c)break;if(N){const t=z?0:q;I=this._writeVertex(b,R,D,S,p.x,p.y,L.x,L.y,0,-1,t),P=this._writeVertex(b,R,D,S,p.x,p.y,-L.x,-L.y,0,1,t)}break;case e.BEVEL:{const t=Q<0;let e,i,x,r;if(t){const t=I;I=P,P=t,e=j,i=A}else e=A,i=j;if(v)x=t?n(this._innerPrev,k):s(this._innerPrev,k),r=t?s(this._innerNext,p):n(this._innerNext,p);else{const e=t?o(this._inner,L):y(this._inner,L);x=e,r=e}const h=t?s(this._bevelStart,k):n(this._bevelStart,k);C(x.x,x.y,-k.x,-k.y,e.x,e.y);const l=C(h.x,h.y,-k.x,-k.y,i.x,i.y);if(c)break;const _=t?n(this._bevelEnd,p):s(this._bevelEnd,p);if(v){const t=this._writeVertex(b,R,D,S,-k.x,-k.y,0,0,0,0,q);I=this._writeVertex(b,R,D,S,p.x,p.y,r.x,r.y,e.x,e.y,q),P=this._writeVertex(b,R,D,S,p.x,p.y,_.x,_.y,i.x,i.y,q),this._writeTriangle(l,t,P)}else{if(N){const t=this._bevelMiddle;t.x=(h.x+_.x)/2,t.y=(h.y+_.y)/2,a(O,t,-k.x,-k.y),C(t.x,t.y,-k.x,-k.y,O.x,O.y),a(O,t,p.x,p.y),I=this._writeVertex(b,R,D,S,p.x,p.y,t.x,t.y,O.x,O.y,q),P=this._writeVertex(b,R,D,S,p.x,p.y,r.x,r.y,e.x,e.y,q)}else{const t=I;I=P,P=t}C(_.x,_.y,p.x,p.y,i.x,i.y)}if(t){const t=I;I=P,P=t}break}case e.ROUND:{const t=Q<0;let e,i;if(t){const t=I;I=P,P=t,e=j,i=A}else e=A,i=j;const x=t?o(this._inner,L):y(this._inner,L);let r,h;v?(r=t?n(this._innerPrev,k):s(this._innerPrev,k),h=t?s(this._innerNext,p):n(this._innerNext,p)):(r=x,h=x);const l=t?s(this._roundStart,k):n(this._roundStart,k),u=t?n(this._roundEnd,p):s(this._roundEnd,p),f=C(r.x,r.y,-k.x,-k.y,e.x,e.y),w=C(l.x,l.y,-k.x,-k.y,i.x,i.y);if(c)break;const T=this._writeVertex(b,R,D,S,-k.x,-k.y,0,0,0,0,q);v||this._writeTriangle(I,P,T);const m=o(this._outer,x),g=this._writeVertex(b,R,D,S,p.x,p.y,u.x,u.y,i.x,i.y,q);let V,E;const U=d>2;if(U){let e;d!==Number.MAX_VALUE?(m.x/=d,m.y/=d,e=_(k,m),e=(d*(e*e-1)+1)/e):e=-1,V=t?s(this._startBreak,k):n(this._startBreak,k),V.x+=k.x*e,V.y+=k.y*e,E=t?n(this._endBreak,p):s(this._endBreak,p),E.x+=p.x*e,E.y+=p.y*e}a(O,m,-k.x,-k.y);const M=this._writeVertex(b,R,D,S,-k.x,-k.y,m.x,m.y,O.x,O.y,q);a(O,m,p.x,p.y);const B=N?this._writeVertex(b,R,D,S,p.x,p.y,m.x,m.y,O.x,O.y,q):M,W=T,X=N?this._writeVertex(b,R,D,S,p.x,p.y,0,0,0,0,q):T;let z=-1,F=-1;if(U&&(a(O,V,-k.x,-k.y),z=this._writeVertex(b,R,D,S,-k.x,-k.y,V.x,V.y,O.x,O.y,q),a(O,E,p.x,p.y),F=this._writeVertex(b,R,D,S,p.x,p.y,E.x,E.y,O.x,O.y,q)),N?U?(this._writeTriangle(W,w,z),this._writeTriangle(W,z,M),this._writeTriangle(X,B,F),this._writeTriangle(X,F,g)):(this._writeTriangle(W,w,M),this._writeTriangle(X,B,g)):U?(this._writeTriangle(T,w,z),this._writeTriangle(T,z,F),this._writeTriangle(T,F,g)):(this._writeTriangle(T,w,M),this._writeTriangle(T,B,g)),v?(I=this._writeVertex(b,R,D,S,p.x,p.y,h.x,h.y,e.x,e.y,q),P=g):(I=N?this._writeVertex(b,R,D,S,p.x,p.y,h.x,h.y,e.x,e.y,q):f,this._writeTriangle(I,X,g),P=g),t){const t=I;I=P,P=t}break}}}}}export{c as LineTessellation};
5
+ import{CapType as t,JoinType as e}from"../../../../symbols/cim/enums.js";import{THIN_LINE_HALF_WIDTH_THRESHOLD as i}from"./definitions.js";function x(t,e){return t.x===e.x&&t.y===e.y}function r(t){if(!t)return;const e=t.length;if(e<=1)return;let i=0;for(let r=1;r<e;r++)x(t[r],t[i])||++i===r||(t[i]=t[r]);t.length=i+1}function n(t,e){return t.x=e.y,t.y=-e.x,t}function s(t,e){return t.x=-e.y,t.y=e.x,t}function y(t,e){return t.x=e.x,t.y=e.y,t}function o(t,e){return t.x=-e.x,t.y=-e.y,t}function h(t){return Math.sqrt(t.x*t.x+t.y*t.y)}function l(t,e){return t.x*e.y-t.y*e.x}function _(t,e){return t.x*e.x+t.y*e.y}function a(t,e,i,x){return t.x=e.x*i+e.y*x,t.y=e.x*x-e.y*i,t}class c{constructor(t,e,i){this._writeVertex=t,this._writeTriangle=e,this._canUseThinTessellation=i,this._prevNormal={x:void 0,y:void 0},this._nextNormal={x:void 0,y:void 0},this._textureNormalLeft={x:0,y:1},this._textureNormalRight={x:0,y:-1},this._textureNormal={x:void 0,y:void 0},this._joinNormal={x:void 0,y:void 0},this._inner={x:void 0,y:void 0},this._outer={x:void 0,y:void 0},this._roundStart={x:void 0,y:void 0},this._roundEnd={x:void 0,y:void 0},this._startBreak={x:void 0,y:void 0},this._endBreak={x:void 0,y:void 0},this._innerPrev={x:void 0,y:void 0},this._innerNext={x:void 0,y:void 0},this._bevelStart={x:void 0,y:void 0},this._bevelEnd={x:void 0,y:void 0},this._bevelMiddle={x:void 0,y:void 0}}tessellate(t,e){r(t),this._canUseThinTessellation&&e.halfWidth<i&&!e.offset?this._tessellateThin(t,e):this._tessellate(t,e)}_tessellateThin(t,e){if(t.length<2)return;const i=e.wrapDistance||65535;let x=e.initialDistance||0,r=!1,n=t[0].x,s=t[0].y;const y=t.length;for(let o=1;o<y;++o){r&&(r=!1,x=0);let e=t[o].x,y=t[o].y,h=e-n,l=y-s,_=Math.sqrt(h*h+l*l);if(h/=_,l/=_,x+_>i){r=!0;const t=(i-x)/_;_=i-x,e=(1-t)*n+t*e,y=(1-t)*s+t*y,--o}const a=this._writeVertex(n,s,0,0,h,l,l,-h,0,-1,x),c=this._writeVertex(n,s,0,0,h,l,-l,h,0,1,x);x+=_;const d=this._writeVertex(e,y,0,0,h,l,l,-h,0,-1,x),u=this._writeVertex(e,y,0,0,h,l,-l,h,0,1,x);this._writeTriangle(a,c,d),this._writeTriangle(c,d,u),n=e,s=y}}_tessellate(i,r){const c=i[0],d=i[i.length-1],u=x(c,d),v=u?3:2;if(i.length<v)return;const f=r.pixelCoordRatio,w=null!=r.capType?r.capType:t.BUTT,T=null!=r.joinType?r.joinType:e.MITER,g=null!=r.miterLimit?Math.min(r.miterLimit,4):2,m=null!=r.roundLimit?Math.min(r.roundLimit,1.05):1.05,V=null!=r.halfWidth?r.halfWidth:2,N=!!r.textured;let E,b,R,U=null;const k=this._prevNormal,p=this._nextNormal;let M=-1,B=-1;const L=this._joinNormal;let D,S;const j=this._textureNormalLeft,A=this._textureNormalRight,O=this._textureNormal;let I=-1,P=-1;const W=r.wrapDistance||65535;let q=r.initialDistance||0;const Q=this._writeVertex,X=this._writeTriangle,C=(t,e,i,x,r,n)=>{const s=Q(b,R,D,S,i,x,t,e,r,n,q);return I>=0&&P>=0&&s>=0&&X(I,P,s),I=P,P=s,s};u&&(E=i[i.length-2],p.x=d.x-E.x,p.y=d.y-E.y,B=h(p),p.x/=B,p.y/=B);let z=!1;for(let x=0;x<i.length;++x){if(z&&(z=!1,q=0),E&&(k.x=-p.x,k.y=-p.y,M=B,q+M>W&&(z=!0)),z){const t=(W-q)/M;M=W-q,E={x:(1-t)*E.x+t*i[x].x,y:(1-t)*E.y+t*i[x].y},--x}else E=i[x];b=E.x,R=E.y;const r=x<=0&&!z,c=x===i.length-1;if(r||(q+=M),U=c?u?i[1]:null:i[x+1],U?(p.x=U.x-b,p.y=U.y-R,B=h(p),p.x/=B,p.y/=B):(p.x=void 0,p.y=void 0),!u){if(r){s(L,p),D=L.x,S=L.y,w===t.SQUARE&&(C(-p.y-p.x,p.x-p.y,p.x,p.y,0,-1),C(p.y-p.x,-p.x-p.y,p.x,p.y,0,1)),w===t.ROUND&&(C(-p.y-p.x,p.x-p.y,p.x,p.y,-1,-1),C(p.y-p.x,-p.x-p.y,p.x,p.y,-1,1)),w!==t.ROUND&&w!==t.BUTT||(C(-p.y,p.x,p.x,p.y,0,-1),C(p.y,-p.x,p.x,p.y,0,1));continue}if(c){n(L,k),D=L.x,S=L.y,w!==t.ROUND&&w!==t.BUTT||(C(k.y,-k.x,-k.x,-k.y,0,-1),C(-k.y,k.x,-k.x,-k.y,0,1)),w===t.SQUARE&&(C(k.y-k.x,-k.x-k.y,-k.x,-k.y,0,-1),C(-k.y-k.x,k.x-k.y,-k.x,-k.y,0,1)),w===t.ROUND&&(C(k.y-k.x,-k.x-k.y,-k.x,-k.y,1,-1),C(-k.y-k.x,k.x-k.y,-k.x,-k.y,1,1));continue}}let d,v,Q=-l(k,p);if(Math.abs(Q)<.01)_(k,p)>0?(L.x=k.x,L.y=k.y,Q=1,d=Number.MAX_VALUE,v=!0):(s(L,p),Q=1,d=1,v=!1);else{L.x=(k.x+p.x)/Q,L.y=(k.y+p.y)/Q,d=h(L);const t=(d-1)*V*f;v=d>4||t>M&&t>B}D=L.x,S=L.y;let X=T;switch(T){case e.BEVEL:d<1.05&&(X=e.MITER);break;case e.ROUND:d<m&&(X=e.MITER);break;case e.MITER:d>g&&(X=e.BEVEL)}switch(X){case e.MITER:if(C(L.x,L.y,-k.x,-k.y,0,-1),C(-L.x,-L.y,-k.x,-k.y,0,1),c)break;if(N){const t=z?0:q;I=this._writeVertex(b,R,D,S,p.x,p.y,L.x,L.y,0,-1,t),P=this._writeVertex(b,R,D,S,p.x,p.y,-L.x,-L.y,0,1,t)}break;case e.BEVEL:{const t=Q<0;let e,i,x,r;if(t){const t=I;I=P,P=t,e=j,i=A}else e=A,i=j;if(v)x=t?s(this._innerPrev,k):n(this._innerPrev,k),r=t?n(this._innerNext,p):s(this._innerNext,p);else{const e=t?o(this._inner,L):y(this._inner,L);x=e,r=e}const h=t?n(this._bevelStart,k):s(this._bevelStart,k);C(x.x,x.y,-k.x,-k.y,e.x,e.y);const l=C(h.x,h.y,-k.x,-k.y,i.x,i.y);if(c)break;const _=t?s(this._bevelEnd,p):n(this._bevelEnd,p);if(v){const t=this._writeVertex(b,R,D,S,-k.x,-k.y,0,0,0,0,q);I=this._writeVertex(b,R,D,S,p.x,p.y,r.x,r.y,e.x,e.y,q),P=this._writeVertex(b,R,D,S,p.x,p.y,_.x,_.y,i.x,i.y,q),this._writeTriangle(l,t,P)}else{if(N){const t=this._bevelMiddle;t.x=(h.x+_.x)/2,t.y=(h.y+_.y)/2,a(O,t,-k.x,-k.y),C(t.x,t.y,-k.x,-k.y,O.x,O.y),a(O,t,p.x,p.y),I=this._writeVertex(b,R,D,S,p.x,p.y,t.x,t.y,O.x,O.y,q),P=this._writeVertex(b,R,D,S,p.x,p.y,r.x,r.y,e.x,e.y,q)}else{const t=I;I=P,P=t}C(_.x,_.y,p.x,p.y,i.x,i.y)}if(t){const t=I;I=P,P=t}break}case e.ROUND:{const t=Q<0;let e,i;if(t){const t=I;I=P,P=t,e=j,i=A}else e=A,i=j;const x=t?o(this._inner,L):y(this._inner,L);let r,h;v?(r=t?s(this._innerPrev,k):n(this._innerPrev,k),h=t?n(this._innerNext,p):s(this._innerNext,p)):(r=x,h=x);const l=t?n(this._roundStart,k):s(this._roundStart,k),u=t?s(this._roundEnd,p):n(this._roundEnd,p),f=C(r.x,r.y,-k.x,-k.y,e.x,e.y),w=C(l.x,l.y,-k.x,-k.y,i.x,i.y);if(c)break;const T=this._writeVertex(b,R,D,S,-k.x,-k.y,0,0,0,0,q);v||this._writeTriangle(I,P,T);const g=o(this._outer,x),m=this._writeVertex(b,R,D,S,p.x,p.y,u.x,u.y,i.x,i.y,q);let V,E;const U=d>2;if(U){let e;d!==Number.MAX_VALUE?(g.x/=d,g.y/=d,e=_(k,g),e=(d*(e*e-1)+1)/e):e=-1,V=t?n(this._startBreak,k):s(this._startBreak,k),V.x+=k.x*e,V.y+=k.y*e,E=t?s(this._endBreak,p):n(this._endBreak,p),E.x+=p.x*e,E.y+=p.y*e}a(O,g,-k.x,-k.y);const M=this._writeVertex(b,R,D,S,-k.x,-k.y,g.x,g.y,O.x,O.y,q);a(O,g,p.x,p.y);const B=N?this._writeVertex(b,R,D,S,p.x,p.y,g.x,g.y,O.x,O.y,q):M,W=T,X=N?this._writeVertex(b,R,D,S,p.x,p.y,0,0,0,0,q):T;let z=-1,F=-1;if(U&&(a(O,V,-k.x,-k.y),z=this._writeVertex(b,R,D,S,-k.x,-k.y,V.x,V.y,O.x,O.y,q),a(O,E,p.x,p.y),F=this._writeVertex(b,R,D,S,p.x,p.y,E.x,E.y,O.x,O.y,q)),N?U?(this._writeTriangle(W,w,z),this._writeTriangle(W,z,M),this._writeTriangle(X,B,F),this._writeTriangle(X,F,m)):(this._writeTriangle(W,w,M),this._writeTriangle(X,B,m)):U?(this._writeTriangle(T,w,z),this._writeTriangle(T,z,F),this._writeTriangle(T,F,m)):(this._writeTriangle(T,w,M),this._writeTriangle(T,B,m)),v?(I=this._writeVertex(b,R,D,S,p.x,p.y,h.x,h.y,e.x,e.y,q),P=m):(I=N?this._writeVertex(b,R,D,S,p.x,p.y,h.x,h.y,e.x,e.y,q):f,this._writeTriangle(I,X,m),P=m),t){const t=I;I=P,P=t}break}}}}}export{c as LineTessellation};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import"../../../tiling/PagedTileQueue.js";import"../../../tiling/TileInfoView.js";import e from"../../../tiling/TileKey.js";import"../../../tiling/TileQueue.js";import"../../../tiling/TileStrategy.js";import{PATCH_PIXEL_BUFFER_ALLOC_SIZE as t,TILE_SIZE as r}from"../definitions.js";import{getDisplayIdTexel as i}from"../DisplayId.js";import{WGLGeometryType as s}from"../enums.js";import{getStrides as n}from"../Utils.js";import{VertexDataWriter as a}from"./VertexDataWriter.js";import{getPow2NeighborKey as h}from"../../../layers/features/support/tileUtils.js";const u=1,c=2,o=4,_=8,l=16,d=32,g=64,p=128;function x(e){switch(e){case u:case _:case d:return-1;case c:case g:return 0;case o:case l:case p:return 1}}function m(e){switch(e){case u:case c:case o:return-1;case _:case l:return 0;case d:case g:case p:return 1}}const f=u|_|d,y=o|l|p,w=u|c|o,v=d|g|p;class E{constructor(e,t,r,i,s,n=0){this._hasAggregate=!1,this.hasRecords=!1,this._data={self:new Map,neighbors:new Array},this._version=0,this._current={geometryType:0,writer:null,overlaps:0,start:0,insertAfter:0,sortKey:0,id:0,materialKey:0,indexStart:0,vertStart:0,isDotDensity:!1,bufferingEnabled:!1,metricBoxLenPointer:0},this.hint=t,this.tileKey=e,this._hasAggregate=i,this._pixelBufferEnabled=s,this._version=n,this._symbologyType=r}get hasAggregates(){return this._hasAggregate}get hasPixelBufferEnabled(){return this._pixelBufferEnabled}serialize(t){const r=[];return r.push(this._serializeTileVertexData(this.tileKey,this.tileKey,this._data.self)),this._data.neighbors.forEach(((i,s)=>{const n=1<<s,a=x(n),u=m(n),c=h(new e(this.tileKey),a,u,t),o=this._serializeTileVertexData(this.tileKey,c.id,i.vertexData);o.message.bufferIds=i.displayIds,r.push(o)})),r}_serializeTileVertexData(e,t,r){const i=new Array;return{message:{tileKeyOrigin:e,tileKey:t,data:{[s.MARKER]:r.get(s.MARKER)?.serialize(i),[s.FILL]:r.get(s.FILL)?.serialize(i),[s.LINE]:r.get(s.LINE)?.serialize(i),[s.TEXT]:r.get(s.TEXT)?.serialize(i),[s.LABEL]:r.get(s.LABEL)?.serialize(i)},version:this._version},transferList:i}}featureStart(e,t){this._current.insertAfter=e,this._current.sortKey=t}featureEnd(){}recordStart(e,t,r,i){this._current.writer=this._getVertexWriter(r),this._current.overlaps=0,this._current.indexStart=this._current.writer.indexCount,this._current.vertStart=this._current.writer.vertexCount,this._current.bufferingEnabled=i,this._current.id=e,this._current.materialKey=t,this._current.geometryType=r,this._current.isDotDensity=!1,this._current.writer.recordStart()}recordCount(){return this._current.writer.recordCount}vertexCount(){return this._current.writer.vertexCount}indexCount(){return this._current.writer.indexCount}vertexEnsureSize(e){this._current.writer.vertexEnsureSize(e)}indexEnsureSize(e){this._current.writer.indexEnsureSize(e)}vertexBounds(e,t,r,i){this._current.bufferingEnabled&&this._addOverlap(e,t,r,i)}vertexWrite(e){this._current.writer.writeVertex(e)}vertexWriteF32(e){this._current.writer.writeVertexF32(e)}vertexEnd(){}vertexWriter(){return this._current.writer.vertexWriter}indexWrite(e){this._current.writer.writeIndex(e)}indexWriter(){return this._current.writer.indexWriter}metricWriter(){return this._current.writer.metricWriter}metricStart(e,t,r,n,a,h,u,c){this._current.writer=this._getVertexWriter(s.LABEL);const o=this._current.writer.metricWriter;o.push(i(e)),o.push(t),o.push(r),o.push(n),o.push(a),o.push(h),o.push(u),o.push(c),o.push(255),this._current.metricBoxLenPointer=o.push(0)}metricEnd(){const e=this._current.writer.metricWriter;0===e.getValue(this._current.metricBoxLenPointer)&&e.seek(e.length-10)}metricBoxWrite(e,t,r,i){const s=this._current.writer.metricWriter;s.incr(this._current.metricBoxLenPointer),s.push(0),s.push(0),s.push(e),s.push(t),s.push(r),s.push(i)}recordEnd(){const e=this._current.vertStart,r=this._current.writer.vertexCount-e;if(!r)return!1;this.hasRecords=!0;const i=this._current.indexStart,h=this._current.writer.indexCount-i;if(this._current.writer.recordEnd(this._current.id,this._current.materialKey,this._current.insertAfter,i,h,e,r,this._current.sortKey),!this._pixelBufferEnabled||this._hasAggregate||0===this._current.overlaps||this._current.geometryType===s.LABEL)return!0;const u=this._current.writer;for(let s=0;s<8;s++){const e=1<<s;if(!!(this._current.overlaps&e)){this._data.neighbors[s]||(this._data.neighbors[s]={vertexData:new Map,displayIds:new Set});const r=this._data.neighbors[s],i=this._current.geometryType;if(!r.vertexData.has(i)){const e=n(i,this._symbologyType).geometry,s=new a(i,e,t);r.vertexData.set(i,s)}const h=r.vertexData.get(this._current.geometryType),c=8,o=512*-x(e)*c,_=512*-m(e)*c;h?.copyLastFrom(u,o,_),r.displayIds.add(this._current.id)}}return!0}_addOverlap(e,t,i,s){const n=255^((e<0+i?y:e>=r-i?f:y|f)|(t<0+s?v:t>=r-s?w:v|w));this._current.overlaps|=n}_getVertexWriter(e){if(!this._data.self.has(e)){const t=this._data.self,r=n(e,this._symbologyType).geometry;t.set(e,new a(e,r,this.hint.records))}return this._data.self.get(e)}}export{E as MeshData};
5
+ import"../../../tiling/TileInfoView.js";import e from"../../../tiling/TileKey.js";import"../../../tiling/TileQueue.js";import"../../../tiling/TileStrategy.js";import{PATCH_PIXEL_BUFFER_ALLOC_SIZE as t,TILE_SIZE as r}from"../definitions.js";import{getDisplayIdTexel as i}from"../DisplayId.js";import{WGLGeometryType as s}from"../enums.js";import{getStrides as n}from"../Utils.js";import{VertexDataWriter as a}from"./VertexDataWriter.js";import{getPow2NeighborKey as h}from"../../../layers/features/support/tileUtils.js";const u=1,c=2,o=4,_=8,l=16,d=32,p=64,g=128;function x(e){switch(e){case u:case _:case d:return-1;case c:case p:return 0;case o:case l:case g:return 1}}function f(e){switch(e){case u:case c:case o:return-1;case _:case l:return 0;case d:case p:case g:return 1}}const m=u|_|d,y=o|l|g,w=u|c|o,v=d|p|g;class E{constructor(e,t,r,i,s,n=0){this._hasAggregate=!1,this.hasRecords=!1,this._data={self:new Map,neighbors:new Array},this._version=0,this._current={geometryType:0,writer:null,overlaps:0,start:0,insertAfter:0,sortKey:0,id:0,materialKey:0,indexStart:0,vertStart:0,isDotDensity:!1,bufferingEnabled:!1,metricBoxLenPointer:0},this.hint=t,this.tileKey=e,this._hasAggregate=i,this._pixelBufferEnabled=s,this._version=n,this._symbologyType=r}get hasAggregates(){return this._hasAggregate}get hasPixelBufferEnabled(){return this._pixelBufferEnabled}serialize(t){const r=[];return r.push(this._serializeTileVertexData(this.tileKey,this.tileKey,this._data.self)),this._data.neighbors.forEach(((i,s)=>{const n=1<<s,a=x(n),u=f(n),c=h(new e(this.tileKey),a,u,t),o=this._serializeTileVertexData(this.tileKey,c.id,i.vertexData);o.message.bufferIds=i.displayIds,r.push(o)})),r}_serializeTileVertexData(e,t,r){const i=new Array;return{message:{tileKeyOrigin:e,tileKey:t,data:{[s.MARKER]:r.get(s.MARKER)?.serialize(i),[s.FILL]:r.get(s.FILL)?.serialize(i),[s.LINE]:r.get(s.LINE)?.serialize(i),[s.TEXT]:r.get(s.TEXT)?.serialize(i),[s.LABEL]:r.get(s.LABEL)?.serialize(i)},version:this._version},transferList:i}}featureStart(e,t){this._current.insertAfter=e,this._current.sortKey=t}featureEnd(){}recordStart(e,t,r,i){this._current.writer=this._getVertexWriter(r),this._current.overlaps=0,this._current.indexStart=this._current.writer.indexCount,this._current.vertStart=this._current.writer.vertexCount,this._current.bufferingEnabled=i,this._current.id=e,this._current.materialKey=t,this._current.geometryType=r,this._current.isDotDensity=!1,this._current.writer.recordStart()}recordCount(){return this._current.writer.recordCount}vertexCount(){return this._current.writer.vertexCount}indexCount(){return this._current.writer.indexCount}vertexEnsureSize(e){this._current.writer.vertexEnsureSize(e)}indexEnsureSize(e){this._current.writer.indexEnsureSize(e)}vertexBounds(e,t,r,i){this._current.bufferingEnabled&&this._addOverlap(e,t,r,i)}vertexWrite(e){this._current.writer.writeVertex(e)}vertexWriteF32(e){this._current.writer.writeVertexF32(e)}vertexEnd(){}vertexWriter(){return this._current.writer.vertexWriter}indexWrite(e){this._current.writer.writeIndex(e)}indexWriter(){return this._current.writer.indexWriter}metricWriter(){return this._current.writer.metricWriter}metricStart(e,t,r,n,a,h,u,c){this._current.writer=this._getVertexWriter(s.LABEL);const o=this._current.writer.metricWriter;o.push(i(e)),o.push(t),o.push(r),o.push(n),o.push(a),o.push(h),o.push(u),o.push(c),o.push(255),this._current.metricBoxLenPointer=o.push(0)}metricEnd(){const e=this._current.writer.metricWriter;0===e.getValue(this._current.metricBoxLenPointer)&&e.seek(e.length-10)}metricBoxWrite(e,t,r,i){const s=this._current.writer.metricWriter;s.incr(this._current.metricBoxLenPointer),s.push(0),s.push(0),s.push(e),s.push(t),s.push(r),s.push(i)}recordEnd(){const e=this._current.vertStart,r=this._current.writer.vertexCount-e;if(!r)return!1;this.hasRecords=!0;const i=this._current.indexStart,h=this._current.writer.indexCount-i;if(this._current.writer.recordEnd(this._current.id,this._current.materialKey,this._current.insertAfter,i,h,e,r,this._current.sortKey),!this._pixelBufferEnabled||this._hasAggregate||0===this._current.overlaps||this._current.geometryType===s.LABEL)return!0;const u=this._current.writer;for(let s=0;s<8;s++){const e=1<<s;if(!!(this._current.overlaps&e)){this._data.neighbors[s]||(this._data.neighbors[s]={vertexData:new Map,displayIds:new Set});const r=this._data.neighbors[s],i=this._current.geometryType;if(!r.vertexData.has(i)){const e=n(i,this._symbologyType).geometry,s=new a(i,e,t);r.vertexData.set(i,s)}const h=r.vertexData.get(this._current.geometryType),c=8,o=512*-x(e)*c,_=512*-f(e)*c;h?.copyLastFrom(u,o,_),r.displayIds.add(this._current.id)}}return!0}_addOverlap(e,t,i,s){const n=255^((e<0+i?y:e>=r-i?m:y|m)|(t<0+s?v:t>=r-s?w:v|w));this._current.overlaps|=n}_getVertexWriter(e){if(!this._data.self.has(e)){const t=this._data.self,r=n(e,this._symbologyType).geometry;t.set(e,new a(e,r,this.hint.records))}return this._data.self.get(e)}}export{E as MeshData};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{pt2px as t}from"../../../../../../core/screenUtils.js";import{b as s,m as e,t as i,r as n}from"../../../../../../chunks/mat2d.js";import{c as o,t as h}from"../../../../../../chunks/mat2df32.js";import{s as r,t as a}from"../../../../../../chunks/vec2.js";import{c}from"../../../../../../chunks/vec2f32.js";import{VAlign as d}from"../../alignmentUtils.js";import{i1616to32 as f}from"../../number.js";import m from"../../Rect.js";import u from"../../collisions/BoundingBox.js";const l=26,g=4,_=l+g,p=l-6,x=3,w=8,y=Math.PI/180,M=8,b=1.5;class B{constructor(t,s,e,i){this._rotationT=o(),this._xBounds=0,this._yBounds=0,this.minZoom=0,this.maxZoom=255,this._bounds=null;const n=e.rect,h=new Float32Array(8);t*=i,s*=i;const r=e.code?n.width*i:e.metrics.width,a=e.code?n.height*i:e.metrics.height;this.width=r,this.height=a,h[0]=t,h[1]=s,h[2]=t+r,h[3]=s,h[4]=t,h[5]=s+a,h[6]=t+r,h[7]=s+a,this._data=h,this._setTextureCoords(n),this._scale=i,this._mosaic=e,this.x=t,this.y=s,this.maxOffset=Math.max(t+r,s+a)}get mosaic(){return this._mosaic}set angle(t){this._angle=t,s(this._rotationT,-t),this._setOffsets(this._data)}get angle(){return this._angle}get xTopLeft(){return this._data[0]}get yTopLeft(){return this._data[1]}get xBottomRight(){return this._data[6]}get yBottomRight(){return this._data[7]}get texcoords(){return this._texcoords}get textureBinding(){return this._mosaic.textureBinding}get offsets(){return this._offsets||this._setOffsets(this._data),this._offsets}get char(){return String.fromCharCode(this._mosaic.code)}get code(){return this._mosaic.code}get bounds(){if(!this._bounds){const{height:t,width:s}=this._mosaic.metrics,i=s*this._scale,n=Math.abs(t)*this._scale,r=new Float32Array(8);r[0]=this.x,r[1]=this.y,r[2]=this.x+i,r[3]=this.y,r[4]=this.x,r[5]=this.y+n,r[6]=this.x+i,r[7]=this.y+n;const a=e(o(),this._rotationT,this._transform);h(r,r,a);let c=1/0,d=1/0,f=0,m=0;for(let e=0;e<4;e++){const t=r[2*e],s=r[2*e+1];c=Math.min(c,t),d=Math.min(d,s),f=Math.max(f,t),m=Math.max(m,s)}const l=f-c,g=m-d,_=c+l/2,p=d+g/2;this._bounds=new u(_,p,l,g)}return this._bounds}setTransform(t){this._transform=t,this._offsets=null}_setOffsets(t){this._offsets||(this._offsets={upperLeft:0,upperRight:0,lowerLeft:0,lowerRight:0});const s=this._offsets,i=new Float32Array(8),n=e(o(),this._rotationT,this._transform);h(i,t,n),s.upperLeft=f(i[0]*w,i[1]*w),s.upperRight=f(i[2]*w,i[3]*w),s.lowerLeft=f(i[4]*w,i[5]*w),s.lowerRight=f(i[6]*w,i[7]*w)}_setTextureCoords({x:t,y:s,width:e,height:i}){this._texcoords={upperLeft:f(t,s),upperRight:f(t+e,s),lowerLeft:f(t,s+i),lowerRight:f(t+e,s+i)}}}const L=(t,s)=>({code:0,page:0,sdf:!0,rect:new m(0,0,11,8),textureBinding:s,metrics:{advance:0,height:4,width:t,left:0,top:0}});function R(t,s){return t.forEach((t=>a(t,t,s))),{upperLeft:f(w*t[0][0],w*t[0][1]),upperRight:f(w*t[1][0],w*t[1][1]),lowerLeft:f(w*t[2][0],w*t[2][1]),lowerRight:f(w*t[3][0],w*t[3][1])}}class T{constructor(t,s,e){this._rotation=0,this._decorate(t,s,e),this.glyphs=t,this.bounds=this._createBounds(t),this.isMultiline=s.length>1,this._hasRotation=0!==e.angle,this._transform=this._createGlyphTransform(this.bounds,e),this._borderLineSize=e.borderLineSize,(e.borderLineSize||e.hasBackground)&&([this.bounds,this.background]=this.shapeBackground(this._transform));for(const i of t)i.setTransform(this._transform)}setRotation(t){if(0===t&&0===this._rotation)return;this._rotation=t;const i=this._transform,n=s(o(),t);e(i,n,i);for(const s of this.glyphs)s.setTransform(this._transform)}_decorate(t,s,e){if(!e.decoration||"none"===e.decoration||!t.length)return;const i=e.scale,n="underline"===e.decoration?_:p,o=t[0].textureBinding;for(const h of s){const s=h.startX*i,e=h.startY*i,r=(h.width+h.glyphWidthEnd)*i;t.push(new B(s,e+n*i,L(r,o),1))}}shapeBackground(s){const e=M,{xmin:i,ymin:n,xmax:o,ymax:h,x:r,y:a,width:c,height:d}=this.bounds,f=Math.min(c,d)+2*e-b,m=Math.min(t(this._borderLineSize||0),f),l=(b+m)/2,g=this._borderLineSize?l:0,_=[i-e,n-e],p=[o+e,n-e],x=[i-e,h+e],w=[o+e,h+e],y=R([[_[0]-l,_[1]-l],[p[0]+l,p[1]-l],[_[0]+g,_[1]+g],[p[0]-g,p[1]+g]],s),B=R([[x[0]+g,x[1]-g],[w[0]-g,w[1]-g],[x[0]-l,x[1]+l],[w[0]+l,w[1]+l]],s),L=R([[_[0]-l,_[1]-l],[_[0]+g,_[1]+g],[x[0]-l,x[1]+l],[x[0]+g,x[1]-g]],s),T=R([[p[0]-g,p[1]+g],[p[0]+l,p[1]-l],[w[0]-g,w[1]-g],[w[0]+l,w[1]+l]],s),v={main:R([_,p,x,w],s),top:y,bot:B,left:L,right:T};return[new u(r,a,c+2*l,d+2*l),v]}get boundsT(){const t=this.bounds,s=r(c(),t.x,t.y);if(a(s,s,this._transform),this._hasRotation){const e=Math.max(t.width,t.height);return new u(s[0],s[1],e,e)}return new u(s[0],s[1],t.width,t.height)}_createBounds(t){let s=1/0,e=1/0,i=0,n=0;for(const r of t)s=Math.min(s,r.xTopLeft),e=Math.min(e,r.yTopLeft),i=Math.max(i,r.xBottomRight),n=Math.max(n,r.yBottomRight);const o=i-s,h=n-e;return new u(s+o/2,e+h/2,o,h)}_createGlyphTransform(t,s){const e=y*s.angle,h=o(),a=c();return i(h,h,r(a,s.xOffset,-s.yOffset)),s.isCIM?n(h,h,e):(i(h,h,r(a,t.x,t.y)),n(h,h,e),i(h,h,r(a,-t.x,-t.y))),h}}class v{constructor(t,s,e,i,n,o){this.glyphWidthEnd=0,this.startX=0,this.startY=0,this.start=Math.max(0,Math.min(s,e)),this.end=Math.max(0,Math.max(s,e)),this.end<t.length&&(this.glyphWidthEnd=t[this.end].metrics.width),this.width=i,this.yMin=n,this.yMax=o}}const j=t=>10===t,k=t=>32===t;function A(t,s,e){const i=new Array,n=1/e.scale,o=e.maxLineWidth*n,h=s?t.length-1:0,r=s?-1:t.length,a=s?-1:1;let c=h,d=0,f=0,m=c,u=m,l=0,g=1/0,_=0;for(;c!==r;){const{code:s,metrics:e}=t[c],n=Math.abs(e.top);if(j(s)||k(s)||(g=Math.min(g,n),_=Math.max(_,n+e.height)),j(s))c!==h&&(i.push(new v(t,m,c-a,d,g,_)),g=1/0,_=0),d=0,m=c+a,u=c+a,f=0;else if(k(s))u=c+a,f=0,l=e.advance,d+=e.advance;else if(d>o){if(u!==m){const s=u-2*a;d-=l,i.push(new v(t,m,s,d-f,g,_)),g=1/0,_=0,m=u,d=f}else i.push(new v(t,m,c-a,d,g,_)),g=1/0,_=0,m=c,u=c,d=0;d+=e.advance,f+=e.advance}else d+=e.advance,f+=e.advance;c+=a}const p=new v(t,m,c-a,d,g,_);return p.start>=0&&p.end<t.length&&i.push(p),i}function O(t,s){let e=0;for(let o=0;o<t.length;o++){const{width:s}=t[o];e=Math.max(s,e)}const i="underline"===s.decoration?g:0,n=t[0].yMin;return{x:0,y:n,height:t.at(-1).yMax+s.lineHeight*(t.length-1)+i-n,width:e}}function S(t,s,e){const i=e.scale,n=new Array,o=A(t,s,e),h=O(o,e),{vAlign:r,hAlign:a}=e,c=r===d.Baseline?1:0,f=c?0:r-1,m=(1-c)*-h.y+f*(h.height/2)+(c?1:0)*-l;for(let d=0;d<o.length;d++){const{start:s,end:h,width:r}=o[d];let c=-1*(a+1)*(r/2)-x;const f=d*e.lineHeight+m-x;o[d].startX=c,o[d].startY=f;for(let e=s;e<=h;e++){const s=t[e];if(j(s.code))continue;const o=new B(c+s.metrics.left,f-s.metrics.top,s,i);c+=s.metrics.advance,n.push(o)}}return new T(n,o,e)}export{B as ShapedGlyph,T as ShapingInfo,S as shapeGlyphs};
5
+ import{pt2px as t}from"../../../../../../core/screenUtils.js";import{b as s,m as e,t as i,r as n}from"../../../../../../chunks/mat2d.js";import{c as o,t as h}from"../../../../../../chunks/mat2df32.js";import{s as r,t as a}from"../../../../../../chunks/vec2.js";import{c}from"../../../../../../chunks/vec2f32.js";import{VAlign as d}from"../../alignmentUtils.js";import{i1616to32 as f}from"../../number.js";import m from"../../Rect.js";import u from"../../collisions/BoundingBox.js";const l=26,g=4,_=l+g,p=l-6,x=3,w=8,y=Math.PI/180,M=8,b=1.5;class B{constructor(t,s,e,i){this._rotationT=o(),this._xBounds=0,this._yBounds=0,this.minZoom=0,this.maxZoom=255,this._bounds=null;const n=e.rect,h=new Float32Array(8);t*=i,s*=i;const r=e.code?n.width*i:e.metrics.width,a=e.code?n.height*i:e.metrics.height;this.width=r,this.height=a,h[0]=t,h[1]=s,h[2]=t+r,h[3]=s,h[4]=t,h[5]=s+a,h[6]=t+r,h[7]=s+a,this._data=h,this._setTextureCoords(n),this._scale=i,this._mosaic=e,this.x=t,this.y=s,this.maxOffset=Math.max(t+r,s+a)}get mosaic(){return this._mosaic}set angle(t){this._angle=t,s(this._rotationT,-t),this._setOffsets(this._data)}get angle(){return this._angle}get xTopLeft(){return this._data[0]}get yTopLeft(){return this._data[1]}get xBottomRight(){return this._data[6]}get yBottomRight(){return this._data[7]}get texcoords(){return this._texcoords}get textureBinding(){return this._mosaic.textureBinding}get offsets(){return this._offsets||this._setOffsets(this._data),this._offsets}get char(){return String.fromCharCode(this._mosaic.code)}get code(){return this._mosaic.code}get bounds(){if(!this._bounds){const{height:t,width:s}=this._mosaic.metrics,i=s*this._scale,n=Math.abs(t)*this._scale,r=new Float32Array(8);r[0]=this.x,r[1]=this.y,r[2]=this.x+i,r[3]=this.y,r[4]=this.x,r[5]=this.y+n,r[6]=this.x+i,r[7]=this.y+n;const a=e(o(),this._rotationT,this._transform);h(r,r,a);let c=1/0,d=1/0,f=0,m=0;for(let e=0;e<4;e++){const t=r[2*e],s=r[2*e+1];c=Math.min(c,t),d=Math.min(d,s),f=Math.max(f,t),m=Math.max(m,s)}const l=f-c,g=m-d,_=c+l/2,p=d+g/2;this._bounds=new u(_,p,l,g)}return this._bounds}setTransform(t){this._transform=t,this._offsets=null}_setOffsets(t){this._offsets||(this._offsets={upperLeft:0,upperRight:0,lowerLeft:0,lowerRight:0});const s=this._offsets,i=new Float32Array(8),n=e(o(),this._rotationT,this._transform);h(i,t,n),s.upperLeft=f(i[0]*w,i[1]*w),s.upperRight=f(i[2]*w,i[3]*w),s.lowerLeft=f(i[4]*w,i[5]*w),s.lowerRight=f(i[6]*w,i[7]*w)}_setTextureCoords({x:t,y:s,width:e,height:i}){this._texcoords={upperLeft:f(t,s),upperRight:f(t+e,s),lowerLeft:f(t,s+i),lowerRight:f(t+e,s+i)}}}const L=(t,s)=>({code:0,page:0,sdf:!0,rect:new m(0,0,11,8),textureBinding:s,metrics:{advance:0,height:4,width:t,left:0,top:0}});function R(t,s){return t.forEach((t=>a(t,t,s))),{upperLeft:f(w*t[0][0],w*t[0][1]),upperRight:f(w*t[1][0],w*t[1][1]),lowerLeft:f(w*t[2][0],w*t[2][1]),lowerRight:f(w*t[3][0],w*t[3][1])}}class T{constructor(t,s,e){this._rotation=0,this._decorate(t,s,e),this.glyphs=t,this.bounds=this._createBounds(t),this.isMultiline=s.length>1,this._hasRotation=0!==e.angle,this._transform=this._createGlyphTransform(this.bounds,e),this._borderLineSize=e.borderLineSize,(e.borderLineSize||e.hasBackground)&&([this.bounds,this.background]=this.shapeBackground(this._transform));for(const i of t)i.setTransform(this._transform)}setRotation(t){if(0===t&&0===this._rotation)return;this._rotation=t;const i=this._transform,n=s(o(),t);e(i,n,i);for(const s of this.glyphs)s.setTransform(this._transform)}_decorate(t,s,e){if(!e.decoration||"none"===e.decoration||!t.length)return;const i=e.scale,n="underline"===e.decoration?_:p,o=t[0].textureBinding;for(const h of s){const s=h.startX*i,e=h.startY*i,r=(h.width+h.glyphWidthEnd)*i;t.push(new B(s,e+n*i,L(r,o),1))}}shapeBackground(s){const e=M,{xmin:i,ymin:n,xmax:o,ymax:h,x:r,y:a,width:c,height:d}=this.bounds,f=Math.min(c,d)+2*e-b,m=Math.min(t(this._borderLineSize||0),f),l=(b+m)/2,g=this._borderLineSize?l:0,_=[i-e,n-e],p=[o+e,n-e],x=[i-e,h+e],w=[o+e,h+e],y=R([[_[0]-l,_[1]-l],[p[0]+l,p[1]-l],[_[0]+g,_[1]+g],[p[0]-g,p[1]+g]],s),B=R([[x[0]+g,x[1]-g],[w[0]-g,w[1]-g],[x[0]-l,x[1]+l],[w[0]+l,w[1]+l]],s),L=R([[_[0]-l,_[1]-l],[_[0]+g,_[1]+g],[x[0]-l,x[1]+l],[x[0]+g,x[1]-g]],s),T=R([[p[0]-g,p[1]+g],[p[0]+l,p[1]-l],[w[0]-g,w[1]-g],[w[0]+l,w[1]+l]],s),v={main:R([_,p,x,w],s),top:y,bot:B,left:L,right:T};return[new u(r,a,c+2*l,d+2*l),v]}get boundsT(){const t=this.bounds,s=r(c(),t.x,t.y);if(a(s,s,this._transform),this._hasRotation){const e=Math.max(t.width,t.height);return new u(s[0],s[1],e,e)}return new u(s[0],s[1],t.width,t.height)}_createBounds(t){let s=1/0,e=1/0,i=0,n=0;for(const r of t)s=Math.min(s,r.xTopLeft),e=Math.min(e,r.yTopLeft),i=Math.max(i,r.xBottomRight),n=Math.max(n,r.yBottomRight);const o=i-s,h=n-e;return new u(s+o/2,e+h/2,o,h)}_createGlyphTransform(t,s){const e=y*s.angle,h=o(),a=c();return i(h,h,r(a,s.xOffset,-s.yOffset)),s.isCIM?n(h,h,e):(i(h,h,r(a,t.x,t.y)),n(h,h,e),i(h,h,r(a,-t.x,-t.y))),h}}class v{constructor(t,s,e,i,n,o){this.glyphWidthEnd=0,this.startX=0,this.startY=0,this.start=Math.max(0,Math.min(s,e)),this.end=Math.max(0,Math.max(s,e)),this.end<t.length&&(this.glyphWidthEnd=t[this.end].metrics.width),this.width=i,this.yMin=n,this.yMax=o}}const j=t=>10===t,k=t=>32===t;function A(t,s,e){const i=new Array,n=1/e.scale,o=e.maxLineWidth*n,h=s?t.length-1:0,r=s?-1:t.length,a=s?-1:1;let c=h,d=0,f=0,m=c,u=m,l=0,g=1/0,_=0;for(;c!==r;){const{code:s,metrics:e}=t[c],n=Math.abs(e.top);if(j(s)||k(s)||(g=Math.min(g,n),_=Math.max(_,n+e.height)),j(s))c!==h&&(i.push(new v(t,m,c-a,d,g,_)),g=1/0,_=0),d=0,m=c+a,u=c+a,f=0;else if(k(s))u=c+a,f=0,l=e.advance,d+=e.advance;else if(d>o){if(u!==m){const s=u-2*a;d-=l,i.push(new v(t,m,s,d-f,g,_)),g=1/0,_=0,m=u,d=f}else i.push(new v(t,m,c-a,d,g,_)),g=1/0,_=0,m=c,u=c,d=0;d+=e.advance,f+=e.advance}else d+=e.advance,f+=e.advance;c+=a}const p=new v(t,m,c-a,d,g,_);return p.start>=0&&p.end<t.length&&i.push(p),i}function O(t,s){let e=0;for(let o=0;o<t.length;o++){const{width:s}=t[o];e=Math.max(s,e)}const i="underline"===s.decoration?g:0,n=t[0].yMin;return{x:0,y:n,height:t[t.length-1].yMax+s.lineHeight*(t.length-1)+i-n,width:e}}function S(t,s,e){const i=e.scale,n=new Array,o=A(t,s,e),h=O(o,e),{vAlign:r,hAlign:a}=e,c=r===d.Baseline?1:0,f=c?0:r-1,m=(1-c)*-h.y+f*(h.height/2)+(c?1:0)*-l;for(let d=0;d<o.length;d++){const{start:s,end:h,width:r}=o[d];let c=-1*(a+1)*(r/2)-x;const f=d*e.lineHeight+m-x;o[d].startX=c,o[d].startY=f;for(let e=s;e<=h;e++){const s=t[e];if(j(s.code))continue;const o=new B(c+s.metrics.left,f-s.metrics.top,s,i);c+=s.metrics.advance,n.push(o)}}return new T(n,o,e)}export{B as ShapedGlyph,T as ShapingInfo,S as shapeGlyphs};