@arcgis/core 5.2.0-next.47 → 5.2.0-next.49

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 (317) hide show
  1. package/applications/Components/OrientedImageryViewer/PanoramicViewer/utils.d.ts +33 -0
  2. package/applications/Components/OrientedImageryViewer/PanoramicViewer/utils.js +2 -0
  3. package/arcgisGlobal.d.ts +2 -0
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/003a87b16f8a4b476e14.js +1 -0
  6. package/assets/esri/core/workers/chunks/031ccf2e1583beebdf24.js +1 -0
  7. package/assets/esri/core/workers/chunks/0474af7687466d8befd2.js +1 -0
  8. package/assets/esri/core/workers/chunks/{2a4868acd546312aa6d8.js → 05f6887805d92da03122.js} +1 -1
  9. package/assets/esri/core/workers/chunks/069b6d8bdb34ee88d437.js +1 -0
  10. package/assets/esri/core/workers/chunks/{f9b2727b41943d83d4ca.js → 0a413d917f3d19440fc1.js} +1 -1
  11. package/assets/esri/core/workers/chunks/0b2ca406761c63529a6a.js +1 -0
  12. package/assets/esri/core/workers/chunks/{68f7eaa3122de7c00adb.js → 0ea374f7b16745b9bbc7.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{c369d4266f38e9ea6592.js → 1119a33245138e7b3914.js} +1 -1
  14. package/assets/esri/core/workers/chunks/12e0c5b7cc5c3f9e6f0f.js +1 -0
  15. package/assets/esri/core/workers/chunks/172571397c66f992d08c.js +1 -0
  16. package/assets/esri/core/workers/chunks/18edf2846d7546285e5e.js +1 -0
  17. package/assets/esri/core/workers/chunks/1b0557fcb058fc450230.js +1 -0
  18. package/assets/esri/core/workers/chunks/{98f575c038da74ced2a6.js → 1bc45872d22d61dbd7d1.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{835643f716f7058a2722.js → 1cf8fb704c48ac3d3b15.js} +1 -1
  20. package/assets/esri/core/workers/chunks/25cb56c3b538d00e7693.js +1 -0
  21. package/assets/esri/core/workers/chunks/{4d4710d57c72ec75cccc.js → 26f1fd3f2be5102aae1d.js} +1 -1
  22. package/assets/esri/core/workers/chunks/285a5bd708f0fe1c620c.js +1 -0
  23. package/assets/esri/core/workers/chunks/{7777a79f26a06a6c5240.js → 304a22c580ce103480cb.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{383392c63202ac044b6c.js → 33bd9785bd0b6ccef21b.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{2c0d92c0e3511775401a.js → 35cbf00f0c37a86517af.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{0f19bc532be24ca64755.js → 36fe6adf6517d8f80125.js} +1 -1
  27. package/assets/esri/core/workers/chunks/382d9491c2a56c1925fe.js +1 -0
  28. package/assets/esri/core/workers/chunks/3af2b9d6d5466cb2b957.js +256 -0
  29. package/assets/esri/core/workers/chunks/{b3cd17daf5a297b96705.js → 3bc2943035391b44d4cf.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{d36f17d32c654b1ac7fa.js → 3f1a7f8a9ead64bf0b7b.js} +1 -1
  31. package/assets/esri/core/workers/chunks/40f7bb0ebd918d76f078.js +1 -0
  32. package/assets/esri/core/workers/chunks/43b39abd49c4a8ce891f.js +1 -0
  33. package/assets/esri/core/workers/chunks/{821176ee3be724621bb0.js → 461c2de938bf4c9b1442.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{cc637aec16918052548e.js → 47af3525396f890f2a6b.js} +1 -1
  35. package/assets/esri/core/workers/chunks/4ee7232ea41fa41c5ed4.js +29 -0
  36. package/assets/esri/core/workers/chunks/4ee900e5dbb130fa0c7b.js +1 -0
  37. package/assets/esri/core/workers/chunks/50674ba5f24129d61d89.js +1 -0
  38. package/assets/esri/core/workers/chunks/547a2fe53139f705f95e.js +1 -0
  39. package/assets/esri/core/workers/chunks/5ce09c4d06e98b1e9251.js +1 -0
  40. package/assets/esri/core/workers/chunks/5dbd28fce73751d2d1aa.js +1 -0
  41. package/assets/esri/core/workers/chunks/5ec8b02e097cf6718462.js +1 -0
  42. package/assets/esri/core/workers/chunks/5f54d927dc77e92cf145.js +1 -0
  43. package/assets/esri/core/workers/chunks/63e3d338751240479335.js +1 -0
  44. package/assets/esri/core/workers/chunks/69b9a327f23e052fced7.js +1 -0
  45. package/assets/esri/core/workers/chunks/6c2b5087a9df65267f4e.js +1 -0
  46. package/assets/esri/core/workers/chunks/6ccd5fa5e35dc70fcd5d.js +1 -0
  47. package/assets/esri/core/workers/chunks/6e520ef645c5edcd499a.js +1 -0
  48. package/assets/esri/core/workers/chunks/7659391f952d134164cf.js +1 -0
  49. package/assets/esri/core/workers/chunks/78add8e6b54b51eaa299.js +1 -0
  50. package/assets/esri/core/workers/chunks/{2b669473aa2c7cfb63c7.js → 7b0ed52363704cfce129.js} +1 -1
  51. package/assets/esri/core/workers/chunks/7b61f56d0f766421eaef.js +1 -0
  52. package/assets/esri/core/workers/chunks/7f2f2a92dce3f68e579b.js +1 -0
  53. package/assets/esri/core/workers/chunks/801a664f21e0218bc705.js +1 -0
  54. package/assets/esri/core/workers/chunks/{8f9fb4e8a7d73db41664.js → 851bcc75acac4a2f199b.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{6010b7be978698a642d0.js → 8977c85aecc7e08ab13c.js} +1 -1
  56. package/assets/esri/core/workers/chunks/8c5726c7ce40a92901e6.js +1 -0
  57. package/assets/esri/core/workers/chunks/8d21e2dabc5165f1c8ca.js +1 -0
  58. package/assets/esri/core/workers/chunks/9008090a5d8431ddfa22.js +1 -0
  59. package/assets/esri/core/workers/chunks/{f2adf1227a795604d3b8.js → 90ae80b797642bff0efa.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{71ce1009dadcae8f8094.js → 95b3b8fe45ef4ac6b277.js} +1 -1
  61. package/assets/esri/core/workers/chunks/96cec8a02ca96175d602.js +1 -0
  62. package/assets/esri/core/workers/chunks/99eccf9ce53582cfa5b5.js +1 -0
  63. package/assets/esri/core/workers/chunks/9b7cb96acea388d86fa4.js +1 -0
  64. package/assets/esri/core/workers/chunks/{dee4019338a79c1ecd26.js → 9d0a9d465ec3a8ba1ed2.js} +1 -1
  65. package/assets/esri/core/workers/chunks/9e474465d069cb9e94f5.js +1 -0
  66. package/assets/esri/core/workers/chunks/aa3abc07de2921ef6ca1.js +1 -0
  67. package/assets/esri/core/workers/chunks/{ae9f9e975d7a9d442fa5.js → ab5aa4280ed0cb7fcbe9.js} +1 -1
  68. package/assets/esri/core/workers/chunks/b03f09ee2224f0cc526a.js +1 -0
  69. package/assets/esri/core/workers/chunks/{ee58f4bbc0a1f7d03df0.js → b32ede7805c7c6644e4c.js} +1 -1
  70. package/assets/esri/core/workers/chunks/b49952541d189b4b9f7e.js +1 -0
  71. package/assets/esri/core/workers/chunks/b8bdacebd4d24ba90f3f.js +1 -0
  72. package/assets/esri/core/workers/chunks/{85cd0cd721b27c497b18.js → baac90da0703891d59c4.js} +1 -1
  73. package/assets/esri/core/workers/chunks/bb552089b34d6811fb03.js +1 -0
  74. package/assets/esri/core/workers/chunks/cd1f1a72483b7c80bd9a.js +1 -0
  75. package/assets/esri/core/workers/chunks/{744f34e379484e63277c.js → cdb331b58e22f8c1c988.js} +2 -2
  76. package/assets/esri/core/workers/chunks/{b23d1e10fc4161d1f3eb.js → d021775cf747556660a5.js} +1 -1
  77. package/assets/esri/core/workers/chunks/{728ea88e7d4733230e1f.js → d1af0bd611a3dc549858.js} +85 -81
  78. package/assets/esri/core/workers/chunks/d2cb3d5ef0a9285afb78.js +1 -0
  79. package/assets/esri/core/workers/chunks/d49e42f36bc3dc256b9f.js +1 -0
  80. package/assets/esri/core/workers/chunks/d560ed96dde5ca3a5583.js +1 -0
  81. package/assets/esri/core/workers/chunks/dc1787d88b11ed985159.js +1 -0
  82. package/assets/esri/core/workers/chunks/{399e23d777a043efa9f1.js → dd95f50dac3f33cdb6d2.js} +1 -1
  83. package/assets/esri/core/workers/chunks/ddb92c815d17c67a45e6.js +1 -0
  84. package/assets/esri/core/workers/chunks/{7c2784ebbe17d79f669c.js → de50a19944617cd426b8.js} +1 -1
  85. package/assets/esri/core/workers/chunks/{52efa4ded11c1e71f04f.js → e2e2162adbfb9b46bede.js} +1 -1
  86. package/assets/esri/core/workers/chunks/e4353f0792f45aa6a62f.js +1 -0
  87. package/assets/esri/core/workers/chunks/eac8cae89da9ce2f4946.js +1 -0
  88. package/assets/esri/core/workers/chunks/edf87407dd20685c82ab.js +1 -0
  89. package/assets/esri/core/workers/chunks/ee7c8a7f384ea6393487.js +705 -0
  90. package/assets/esri/core/workers/chunks/f1299b4fc760ccca1518.js +1 -0
  91. package/assets/esri/core/workers/chunks/f244632f7934a4b72c91.js +1 -0
  92. package/assets/esri/core/workers/chunks/fc639c730115e07a4a1a.js +1 -0
  93. package/assets/esri/libs/basisu/basis_encoder.wasm +0 -0
  94. package/assets/esri/libs/basisu/basis_transcoder.wasm +0 -0
  95. package/assets/esri/libs/dxtEncoder/dxt_encoder.wasm +0 -0
  96. package/chunks/Component.glsl.js +104 -67
  97. package/chunks/DefaultMaterial.glsl.js +1 -1
  98. package/chunks/LineMarker.glsl.js +31 -31
  99. package/chunks/RibbonLine.glsl.js +60 -49
  100. package/chunks/basis_encoder.js +1 -1
  101. package/chunks/basis_transcoder.js +1 -1
  102. package/chunks/dxt_encoder.js +1 -1
  103. package/chunks/vec3.js +1 -1
  104. package/config.js +1 -1
  105. package/core/has.js +1 -1
  106. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  107. package/core/promiseUtils.js +1 -1
  108. package/core/workers/workerFactory.js +1 -1
  109. package/geometry/Mesh.d.ts +4 -4
  110. package/geometry/support/MeshMaterialMetallicRoughness.d.ts +13 -1
  111. package/geometry/support/MeshMaterialMetallicRoughness.js +1 -1
  112. package/geometry/support/aaBoundingBox.js +1 -1
  113. package/geometry/support/buffer/math/vec3.js +1 -1
  114. package/geometry/support/frustum.js +1 -1
  115. package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
  116. package/geometry/support/meshUtils/extent.js +1 -1
  117. package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
  118. package/geometry/support/meshUtils/vertexSpaceConversion.js +1 -1
  119. package/geometry/support/meshUtils.d.ts +33 -5
  120. package/geometry/support/plane.js +1 -1
  121. package/kernel.js +1 -1
  122. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  123. package/layers/orientedImagery/transformations/utils.js +1 -1
  124. package/layers/raster/formats/ImageCanvasDecoder.js +1 -1
  125. package/layers/raster/formats/JpgPlus.js +1 -1
  126. package/layers/raster/formats/RasterCodec.js +1 -1
  127. package/layers/raster/formats/TiffDecoder.js +1 -1
  128. package/layers/raster/formats/Zlib.js +2 -0
  129. package/package.json +2 -2
  130. package/rest/featureService/FeatureService.d.ts +74 -1
  131. package/rest/featureService/FeatureService.js +1 -1
  132. package/support/revision.js +1 -1
  133. package/symbols/ObjectSymbol3DLayer.d.ts +10 -8
  134. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  135. package/symbols/cim/CIMSymbolHelper.js +1 -1
  136. package/symbols/cim/TextRasterizer.js +1 -1
  137. package/symbols/cim/cimAnalyzer.js +1 -1
  138. package/symbols/cim/richTextUtils.js +2 -0
  139. package/symbols/support/ObjectSymbol3DLayerResource.d.ts +9 -4
  140. package/views/2d/analysis/AreaMeasurement/AreaMeasurementAreaVisualization.js +1 -1
  141. package/views/2d/analysis/AreaMeasurement/AreaMeasurementTool.js +1 -1
  142. package/views/2d/analysis/DistanceMeasurement/DistanceMeasurementTool.js +1 -1
  143. package/views/2d/engine/webgl/TextureManager.js +1 -1
  144. package/views/2d/engine/webgl/definitions.js +1 -1
  145. package/views/2d/engine/webgl/mesh/MultiTileMeshData.js +1 -1
  146. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  147. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  148. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  149. package/views/2d/engine/webgl/util/DimensionMatcher.js +1 -1
  150. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  151. package/views/2d/layers/features/Processor.js +1 -1
  152. package/views/2d/layers/features/processor/AProcessorStrategy.js +1 -1
  153. package/views/2d/layers/features/processor/AggregateStrategy.js +2 -0
  154. package/views/2d/layers/features/processor/bins/BinAdapter.js +2 -0
  155. package/views/2d/layers/features/processor/bins/BinLevelState.js +2 -0
  156. package/views/2d/layers/features/processor/bins/BinState.js +2 -0
  157. package/views/2d/layers/features/processor/bins/createBinningStrategy.js +2 -0
  158. package/views/2d/layers/features/processor/clusters/ClusterAdapter.js +2 -0
  159. package/views/2d/layers/features/processor/clusters/ClusterLevelState.js +2 -0
  160. package/views/2d/layers/features/processor/clusters/ClusterSendState.js +2 -0
  161. package/views/2d/layers/features/processor/clusters/createClusterStrategy.js +2 -0
  162. package/views/2d/layers/features/processor/createAggregateStrategy.js +2 -0
  163. package/views/2d/layers/features/processor/tracks/Track.js +2 -0
  164. package/views/2d/layers/features/processor/tracks/TrackAdapter.js +2 -0
  165. package/views/2d/layers/features/processor/tracks/TrackLevelState.js +2 -0
  166. package/views/2d/layers/features/processor/tracks/TrackSendState.js +2 -0
  167. package/views/2d/layers/features/processor/tracks/createTrackStrategy.js +2 -0
  168. package/views/2d/layers/features/schema/processor/symbols/SymbolSchema.js +1 -1
  169. package/views/2d/layers/features/support/FeatureSetReaderIndirect.js +1 -1
  170. package/views/2d/layers/support/annodime/DimensionInfo.js +1 -1
  171. package/views/2d/layers/support/annodime/dimensionUtils.js +1 -1
  172. package/views/3d/analysis/LineOfSight/LineOfSightReshapeTool3D.js +1 -1
  173. package/views/3d/analysis/Viewshed/ViewshedConfiguration.js +1 -1
  174. package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
  175. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  176. package/views/3d/analysis/Viewshed/ViewshedSubVisualization.js +1 -1
  177. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  178. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  179. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  180. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  181. package/views/3d/focusAreaUtils.js +1 -1
  182. package/views/3d/glTF/LoaderResult.js +1 -1
  183. package/views/3d/glTF/internal/Resource.js +1 -1
  184. package/views/3d/glTF/loader.js +1 -1
  185. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
  186. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  187. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  188. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  189. package/views/3d/layers/graphics/wosrLoader.js +1 -1
  190. package/views/3d/layers/i3s/meshUtils.js +1 -1
  191. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  192. package/views/3d/webgl/RenderCamera.js +1 -1
  193. package/views/3d/webgl/RenderNode.js +1 -1
  194. package/views/3d/webgl-engine/collections/Component/Material/Component.glsl.js +1 -1
  195. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  196. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBuffer.glsl.js +2 -2
  197. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +2 -2
  198. package/views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js +36 -25
  199. package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js +19 -20
  200. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +17 -10
  201. package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
  202. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  203. package/views/3d/webgl-engine/lib/NavigationDepthCache.js +1 -1
  204. package/views/3d/webgl-engine/lib/NavigationDepthCacheStore.js +2 -0
  205. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  206. package/views/3d/webgl-engine/lib/PolygonIntersections2D.js +1 -1
  207. package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
  208. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  209. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  210. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  211. package/views/3d/webgl-engine/lib/intersectorUtils.js +1 -1
  212. package/views/3d/webgl-engine/lib/lodRendering/LodLevel.js +1 -1
  213. package/views/3d/webgl-engine/lib/screenPolygonOverlapUtils.js +1 -1
  214. package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
  215. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  216. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  217. package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.js +1 -1
  218. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  219. package/views/3d/webgl-engine/shaders/AnimatedLine.glsl.js +8 -5
  220. package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
  221. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  222. package/views/3d/webgl-engine/shaders/RibbonLineLayouts.js +1 -1
  223. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  224. package/views/3d/webgl-engine/shaders/RibbonLineTextureBuffer.glsl.js +1 -1
  225. package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
  226. package/views/PopupView.js +1 -1
  227. package/views/SceneView.js +1 -1
  228. package/views/interactive/snapping/RightAngleTriangleSnapper.js +1 -1
  229. package/views/interactive/snapping/SnappingAlgorithm.js +1 -1
  230. package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
  231. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorkerHandle.js +1 -1
  232. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
  233. package/views/selection/SelectionOperation.js +1 -1
  234. package/views/support/AnalysisViewManager.js +1 -1
  235. package/views/support/DefaultsFromMap.js +1 -1
  236. package/views/support/LayerViewManager.js +1 -1
  237. package/views/support/TextureCompressionWorker.js +1 -1
  238. package/views/webgl/RenderingContext.js +1 -1
  239. package/widgets/Editor.js +1 -1
  240. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  241. package/widgets/OrientedImageryViewer/services/SuperimposeService.js +1 -1
  242. package/widgets/OrientedImageryViewer/support/superimposeUtils.js +1 -1
  243. package/widgets/PanoramicViewer/support/PanoramicTileNode.d.ts +63 -0
  244. package/widgets/PanoramicViewer/support/PanoramicTileNode.js +1 -1
  245. package/widgets/PanoramicViewer/support/PanoramicTilePyramid.d.ts +66 -0
  246. package/widgets/PanoramicViewer/support/PanoramicTilePyramid.js +1 -1
  247. package/widgets/PanoramicViewer/utils.js +1 -1
  248. package/widgets/Sketch/VisibleElements.d.ts +0 -10
  249. package/widgets/Sketch.js +1 -1
  250. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
  251. package/widgets/support/SelectionToolbar.js +1 -1
  252. package/widgets/support/Selector3D/selectorUtils.js +2 -0
  253. package/assets/esri/core/workers/chunks/0115681a3de6df0aebdf.js +0 -1
  254. package/assets/esri/core/workers/chunks/025caafc70ac26f0a4ed.js +0 -1
  255. package/assets/esri/core/workers/chunks/08e18fb12533fc76e49c.js +0 -1
  256. package/assets/esri/core/workers/chunks/0e64e20fedfe01a1985f.js +0 -1
  257. package/assets/esri/core/workers/chunks/0f674c625f24ac73e25a.js +0 -1
  258. package/assets/esri/core/workers/chunks/15351354afcbf840a23d.js +0 -29
  259. package/assets/esri/core/workers/chunks/176c5eaaa23a479c88e0.js +0 -1
  260. package/assets/esri/core/workers/chunks/1d1f5578c7d8619f7a46.js +0 -1
  261. package/assets/esri/core/workers/chunks/1f118d85d8271ad7690b.js +0 -1
  262. package/assets/esri/core/workers/chunks/2015f4def2ef201bdab8.js +0 -1
  263. package/assets/esri/core/workers/chunks/268637fd6c50264acfc3.js +0 -1
  264. package/assets/esri/core/workers/chunks/272c8ab189217240d05f.js +0 -1
  265. package/assets/esri/core/workers/chunks/296fa9fb80e521c30cb1.js +0 -1
  266. package/assets/esri/core/workers/chunks/354199a41de44902de84.js +0 -1
  267. package/assets/esri/core/workers/chunks/384b619854ef8a3f6e94.js +0 -1
  268. package/assets/esri/core/workers/chunks/3af923abeb6e65c4468f.js +0 -1
  269. package/assets/esri/core/workers/chunks/46d3ddf62fa7a76dd57d.js +0 -1
  270. package/assets/esri/core/workers/chunks/4b24f72b56edc28bb15e.js +0 -1
  271. package/assets/esri/core/workers/chunks/4f09f208ece2ec1db727.js +0 -1
  272. package/assets/esri/core/workers/chunks/57374213084bef59b776.js +0 -1
  273. package/assets/esri/core/workers/chunks/5f9c4dad6952c4c58ebf.js +0 -1
  274. package/assets/esri/core/workers/chunks/706230b70a36d2e038f7.js +0 -1
  275. package/assets/esri/core/workers/chunks/7cc729b57a6a52c8ac68.js +0 -1
  276. package/assets/esri/core/workers/chunks/8026cc0065f6520c4161.js +0 -1
  277. package/assets/esri/core/workers/chunks/804ab5f614efa12a131b.js +0 -1
  278. package/assets/esri/core/workers/chunks/81d55594cee124040565.js +0 -1
  279. package/assets/esri/core/workers/chunks/8d21f3d6edbcd7b335d0.js +0 -1
  280. package/assets/esri/core/workers/chunks/8d90bef1091204fba0f1.js +0 -1
  281. package/assets/esri/core/workers/chunks/8ec5e470583b75fceae1.js +0 -1
  282. package/assets/esri/core/workers/chunks/9114a575b78a7ea18d0f.js +0 -1
  283. package/assets/esri/core/workers/chunks/93e705c1147cc8ceca02.js +0 -1
  284. package/assets/esri/core/workers/chunks/9a97f6cda2f36941efae.js +0 -1
  285. package/assets/esri/core/workers/chunks/9ceeae787dc7c194d60e.js +0 -1
  286. package/assets/esri/core/workers/chunks/a8033e606b2db1ee332d.js +0 -1
  287. package/assets/esri/core/workers/chunks/a90f7b1c6c69b6033b4c.js +0 -1
  288. package/assets/esri/core/workers/chunks/a9c641bcdef161c754bf.js +0 -1
  289. package/assets/esri/core/workers/chunks/ad5c2b0de6713d0a93a4.js +0 -680
  290. package/assets/esri/core/workers/chunks/ae50b2d5e63f62c088d2.js +0 -1
  291. package/assets/esri/core/workers/chunks/aea247138617e12b699b.js +0 -1
  292. package/assets/esri/core/workers/chunks/b03dcf3d55266745f3d1.js +0 -1
  293. package/assets/esri/core/workers/chunks/b32bdf5730953c2fb16b.js +0 -1
  294. package/assets/esri/core/workers/chunks/bf287f0e2ecb4532dc00.js +0 -1
  295. package/assets/esri/core/workers/chunks/c01a121ebe571a848452.js +0 -1
  296. package/assets/esri/core/workers/chunks/c3cd38ca8690286d40d7.js +0 -1
  297. package/assets/esri/core/workers/chunks/c4b13124a9cfc78c42a6.js +0 -261
  298. package/assets/esri/core/workers/chunks/c5e36544b2d1792e4c5f.js +0 -1
  299. package/assets/esri/core/workers/chunks/c6042825f61cd70d54d8.js +0 -1
  300. package/assets/esri/core/workers/chunks/cba3316910ff088f4d77.js +0 -1
  301. package/assets/esri/core/workers/chunks/d8b67ca02cdc1e8191e3.js +0 -1
  302. package/assets/esri/core/workers/chunks/dadefe369f49e89a2610.js +0 -1
  303. package/assets/esri/core/workers/chunks/db416ba3132034e20642.js +0 -1
  304. package/assets/esri/core/workers/chunks/de9573871f64c01e9f01.js +0 -1
  305. package/assets/esri/core/workers/chunks/dfbdc72c7ea137e3841d.js +0 -1
  306. package/assets/esri/core/workers/chunks/e3e966777f18164afcd8.js +0 -1
  307. package/assets/esri/core/workers/chunks/e9c48630757bea465b7e.js +0 -1
  308. package/assets/esri/core/workers/chunks/f2c8122d31aedc2604ee.js +0 -1
  309. package/assets/esri/core/workers/chunks/f8f0de841be17cd05c8f.js +0 -1
  310. package/assets/esri/core/workers/chunks/ff089723a27859fe18d1.js +0 -1
  311. package/chunks/Zlib.js +0 -2
  312. package/views/2d/layers/features/processor/AAggregateStrategy.js +0 -2
  313. package/views/2d/layers/features/processor/BinningStrategy.js +0 -2
  314. package/views/2d/layers/features/processor/ClusterStrategy.js +0 -2
  315. package/views/2d/layers/features/processor/TrackStrategy.js +0 -2
  316. package/views/3d/analysis/Viewshed/ViewshedTool2.js +0 -2
  317. /package/assets/esri/core/workers/chunks/{744f34e379484e63277c.js.LICENSE.txt → cdb331b58e22f8c1c988.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{isRGB as e}from"../../core/colorUtils.js";import{getFontFamily as t}from"../../core/fontUtils.js";import"../../core/has.js";import{clone as r}from"../../core/lang.js";import i from"../../core/Logger.js";import{pt2px as o,px2pt as a}from"../../core/screenUtils.js";import{numericHash as s}from"../../core/string.js";import{checkForAnimations as l,getAnimationParams as n,handleAbsoluteAnchor as p,handleMarker as m,handleRelativeAnchor as c,getFrameTranslation as d,translate as y,getStaticParam as f,shouldUseAnimatedPath as h}from"./animationUtils.js";import{forEachSymbolLayer as u,CIMSymbolHelper as v}from"./CIMSymbolHelper.js";import{antialiasingOutlineFillSettings as O}from"./constants.js";import{defaultCIMValues as g}from"./defaultCIMValues.js";import{fitVectorMarker as S}from"./fitVectorMarker.js";import{OverrideHelper as _}from"./OverrideHelper.js";import{getExtent as M,getSDFMetrics as k,getSDFDimensions as C}from"./SDFHelper.js";import{CIMSymbolUnits as b}from"./types.js";import{colorToArray as x,normalizeAlpha as P,getSize as z,isCIMMarkerStrokePlacement as I,hasStrokeLayer as E,getTintColor as L,getNumericValue as V,normalizePrimitiveOverrideProps as N,getDefaultCIMValue as R,getEnum as A,getFillColor as T,getStrokeColor as w,fromCIMFontDecoration as G,fromCIMFontStyle as F,getStrokeWidth as X,fromCIMVerticalAlignment as j,fromCIMHorizontalAlignment as Y,getTextCasing as W,isValidCIMValue as D,uncapitalize as U}from"./utils.js";import{EffectHelper as H}from"./effects/EffectHelper.js";import{rasterizedVectorMarkerMinSize as J,randomInsidePolygonTextureSize as B}from"../../views/2d/engine/webgl/definitions.js";const q=()=>i.getLogger("esri.symbols.cim.cimAnalyzer");function K(e){const t=e.markerPlacement;return t&&t.angleToLine?1:0}class Q{constructor(e){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[],this._hasTextStringTemplates=!1,e&&(this._resourceManager=e)}analyzeSymbolReference(t,r,i){if(this._cimLayers=i??[],!t)return this._cimLayers;if(this._reset(),this._hasTextStringTemplates=t.hasTextStringTemplates??!1,t.primitiveOverrides){this._primitiveOverrides=t.primitiveOverrides;for(const t of this._primitiveOverrides){const r=t.valueExpressionInfo;if(r)this._setPoMap(t.primitiveName,t.propertyName,r);else if(null!=t.value){let r=t.value;t.propertyName.includes("Color")&&(e(r)&&(r=x(r)),r=P(r)),this._setPoMap(t.primitiveName,t.propertyName,r)}}}return this._analyzeSymbol(t.symbol,r),this._cimLayers}_reset(){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[]}_analyzeSymbol(e,t){switch(e?.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this._analyzeMultiLayerSymbol(e,t)}}_analyzeMultiLayerSymbol(e,t){const r=e?.symbolLayers;if(!r)return;for(let l=0;l<r.length;l++){const e=r[l];"CIMVectorMarker"===e.type&&(r[l]=S(e))}const i=e.effects;let o=0;const a=z(e)??0;if("CIMPointSymbol"===e.type&&"Map"===e.angleAlignment&&(o=1),oe(r,i))return this._analyzeCompositeOutlineFill(r,i,a);let s={transform:[0,0,0,1],fromColor:[1,1,1,1],toColor:[1,1,1,1],colorMix:[0,0,0,0],toOpacity:[1,1,1,1],opacityMix:[0,0,0,0],shift:[1,1,1,1],hasAnimations:l(e),hasShiftAnimation:!1,hasMotionAnimations:!1};s=n(this._poMap,e,s);const p="CIMPolygonSymbol"===e.type;let m=r.length;for(;m--;){const l=r[m];if(!l||!1===l.enable)continue;let n;i?.length&&(n=[...i]);const c=l.effects;c?.length&&(i?n.push(...c):n=[...c]);let d=null;if(n){d=[];for(const e of n){const t=_.findEffectOverrides(e,this._primitiveOverrides);t&&d.push(t)}}const y=[];switch(_.findApplicableOverrides(l,this._primitiveOverrides,y),l.type){case"CIMSolidFill":this._analyzeSolidFill(l,d,s,E(r));break;case"CIMPictureFill":this._analyzePictureFill(l,d,s);break;case"CIMHatchFill":this._analyzeHatchFill(l,d,s);break;case"CIMGradientFill":this._analyzeGradientFill(l,d);break;case"CIMSolidStroke":this._analyzeSolidStroke(l,d,p,a,s);break;case"CIMPictureStroke":this._analyzePictureStroke(l,d,p,a,s);break;case"CIMGradientStroke":this._analyzeGradientStroke(l,d,p,a);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":{"CIMLineSymbol"!==e.type&&"CIMPolygonSymbol"!==e.type||(o=K(l));const r=[],i=l.primitiveName;i&&r.push(i);const n=p&&I(l.markerPlacement);this._analyzeMarker(l,d,null,r,o,a,t,[],s,!1,n);break}default:q().error("Cannot analyze CIM layer",l.type)}}}_analyzeSolidFill(e,t,r,i){const{primitiveName:o,type:a}=e,s=P(e.color),l=n(this._poMap,e,r);if(!i&&t?.some(e=>"CIMGeometricEffectTaperedPolygon"===e.effect.type)){const r=this._getValueOrOverrideExpression(a,o,"Color",s);return void this._cimLayers.push({type:"outlineFill",name:e.name,colorLocked:!!e.colorLocked,color:r,effects:t,outlineColor:r,outlineColorLocked:!!e.colorLocked,...O,outlineEffects:t})}this._cimLayers.push({type:"fill",name:e.name,spriteRasterizationParam:null,colorLocked:!!e.colorLocked,color:this._getValueOrOverrideExpression(a,o,"Color",s),height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,effects:t,applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!1,animationParams:se(l)})}_analyzePictureFill(e,t,r){const{primitiveName:i,type:o}=e,a=L(e),s=V(e.height,g.CIMPictureFill.height);let l=V(e.scaleX,1);if("width"in e&&"number"==typeof e.width){const t=e.width;let r=1;const i=this._resourceManager.getResource(e.url);null!=i&&(r=i.width/i.height),l/=r*(s/t)}const p={type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(i,o)},m=n(this._poMap,e,r);this._cimLayers.push({type:"fill",name:e.name,spriteRasterizationParam:p,colorLocked:!!e.colorLocked,effects:t,color:this._getValueOrOverrideExpression(o,i,"TintColor",a),height:this._getValueOrOverrideExpression(o,i,"Height",s),scaleX:this._getValueOrOverrideExpression(o,i,"ScaleX",l),angle:this._getValueOrOverrideExpression(o,i,"Rotation",V(e.rotation)),offsetX:this._getValueOrOverrideExpression(o,i,"OffsetX",V(e.offsetX)),offsetY:this._getValueOrOverrideExpression(o,i,"OffsetY",V(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!1,hasUnresolvedReplacementColor:!1,animationParams:se(m)})}_analyzeHatchFill(e,t,r){const{primitiveName:i,type:o}=e,a=n(this._poMap,e,r),s=this._analyzeMaterialOverrides(i,["Rotation","OffsetX","OffsetY"]),l=N(s);let p=[255,255,255,1],m=!1;if(e.lineSymbol?.symbolLayers)for(const n of e.lineSymbol.symbolLayers){if("CIMSolidStroke"!==n.type)continue;const e=n.primitiveName??i;m||!e||n.colorLocked||null==this._poMap[e]?.Color&&null==this._poMap[e]?.StrokeColor||(p=P(n.color),p=this._maybeGetValueOrOverrideExpression(e,"StrokeColor")??this._getValueOrOverrideExpression(o,e,"Color",p),m=!0);const t=this._maybeGetValueOrOverrideExpression(e,"StrokeWidth");if(t){let r=null,i=null;"number"==typeof t?r=t:i=t.valueExpressionInfo;let a=l.find(e=>"strokeWidth"===e.propertyName);a?a.propertyName="width":(a={type:"CIMPrimitiveOverride",primitiveName:e,propertyName:"width",valueExpressionInfo:i,value:r,defaultValue:R(o,"width")},l.push(a))}}const c={type:"sprite-rasterization-param",resource:e,overrides:l};this._cimLayers.push({type:"fill",name:e.name,spriteRasterizationParam:c,colorLocked:!!e.colorLocked,effects:t,color:p,height:this._getValueOrOverrideExpression(o,i,"Separation",V(e.separation,g.CIMHatchFill.separation)),scaleX:1,angle:this._getValueOrOverrideExpression(o,i,"Rotation",V(e.rotation)),offsetX:this._getValueOrOverrideExpression(o,i,"OffsetX",V(e.offsetX)),offsetY:this._getValueOrOverrideExpression(o,i,"OffsetY",V(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!m,animationParams:se(a)})}_analyzeGradientFill(e,t){const{angle:r,gradientMethod:i,gradientSize:o,gradientSizeUnits:a,gradientType:s,interval:l,primitiveName:n,type:p}=e,m=g.CIMGradientFill,c=e.colorRamp;this._cimLayers.push({type:"gradientFill",name:e.name,spriteRasterizationParam:{type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(n,p)},colorLocked:!1,effects:t,color:[255,255,255,1],gradientMethod:this._getValueOrOverrideExpression(p,n,"GradientMethod",i??"Linear"),angle:this._getValueOrOverrideExpression(p,n,"Angle",V(r,m.angle)),gradientType:this._getValueOrOverrideExpression(p,n,"GradientType",s??m.gradientType),interval:this._getValueOrOverrideExpression(p,n,"Interval",V(l,"CIMFixedColorRamp"===c.type?c.colors.length:m.interval)),gradientSize:this._getValueOrOverrideExpression(p,n,"GradientSize",V(o,m.gradientSize)),gradientSizeUnits:"Absolute"===a?b.Absolute:"Relative"===a?b.Relative:m.gradientSizeUnits})}_analyzeCompositeOutlineFill(e,t,r){const i=e.find(e=>"CIMSolidFill"===e.type),o=e.find(e=>"CIMSolidStroke"===e.type);if(null==i||null==o)return;const a=[...t??[],...i.effects??[]].map(e=>_.findEffectOverrides(e,this._primitiveOverrides)).filter(e=>null!=e),s=[...t??[],...o.effects??[]].map(e=>_.findEffectOverrides(e,this._primitiveOverrides)).filter(e=>null!=e),l=V(o.width,g.CIMSolidStroke.width),n=A(o.capStyle,g.CIMSolidStroke.capstyle),p=A(o.joinStyle,g.CIMSolidStroke.joinstyle),m=o.miterLimit;this._cimLayers.push({type:"outlineFill",name:i.name,colorLocked:!!i.colorLocked,color:this._getValueOrOverrideExpression(i.type,i.primitiveName,"Color",P(i.color)),effects:a,outlineColorLocked:!!o.colorLocked,outlineColor:this._getValueOrOverrideExpression(o.type,o.primitiveName,"Color",P(o.color)),outlineWidth:this._getValueOrOverrideExpression(o.type,o.primitiveName,"Width",l),cap:this._getValueOrOverrideExpression(o.type,o.primitiveName,"CapStyle",n),join:this._getValueOrOverrideExpression(o.type,o.primitiveName,"JoinStyle",p),miterLimit:m&&this._getValueOrOverrideExpression(o.type,o.primitiveName,"MiterLimit",m),referenceWidth:r,outlineEffects:s})}_analyzeSolidStroke(e,t,r,i,o){const{primitiveName:a,type:s}=e,l=P(e.color),p=V(e.width,g.CIMSolidStroke.width),m=A(e.capStyle,g.CIMSolidStroke.capstyle),c=A(e.joinStyle,g.CIMSolidStroke.joinstyle),d=e.miterLimit;let y,f,h,u,v=[];if(this._analyzePrimitiveOverrides(a,t,null,null)&&(v=this._getPrimitiveMaterialOverrides(a,s)),t&&Array.isArray(t)&&t.length>0){const e=t[t.length-1].effect;e&&"CIMGeometricEffectDashes"===e.type&&"NoConstraint"===e.lineDashEnding&&(y=e.dashTemplate,f=e.scaleDash,h=e.offsetAlongLine,u=e.primitiveName,(t=[...t]).pop())}null!=u&&v.push(...this._getPrimitiveMaterialOverrides(u,s).filter(e=>"dashTemplate"===e.propertyName));const O=void 0!==y?{type:"sprite-rasterization-param",resource:{type:"dash",dashTemplate:y,primitiveName:u},overrides:v}:null,S=n(this._poMap,e,o);this._cimLayers.push({type:"line",name:e.name,spriteRasterizationParam:O,isOutline:r,colorLocked:!!e.colorLocked,effects:t,color:this._getValueOrOverrideExpression(s,a,"Color",l),width:this._getValueOrOverrideExpression(s,a,"Width",p),cap:this._getValueOrOverrideExpression(s,a,"CapStyle",m),join:this._getValueOrOverrideExpression(s,a,"JoinStyle",c),miterLimit:d&&this._getValueOrOverrideExpression(s,a,"MiterLimit",d),referenceWidth:i,zOrder:$(e.name),dashTemplate:this._maybeGetValueOrOverrideExpression(u,"DashTemplate")??y,offsetAlongLine:this._getValueOrOverrideExpression(s,u,"OffsetAlongLine",h??0),scaleDash:f,sampleAlphaOnly:!0,animationParams:se(S)})}_analyzePictureStroke(e,t,r,i,o){const{primitiveName:a,type:s}=e,l=L(e),p=V(e.width,g.CIMPictureStroke.width),m=A(e.capStyle,g.CIMPictureStroke.capstyle),c=A(e.joinStyle,g.CIMPictureStroke.joinstyle),d=e.miterLimit,y={type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(a,s)},f=n(this._poMap,e,o);this._cimLayers.push({type:"line",name:e.name,spriteRasterizationParam:y,isOutline:r,colorLocked:!!e.colorLocked,effects:t,color:this._getValueOrOverrideExpression(s,a,"TintColor",l),width:this._getValueOrOverrideExpression(s,a,"Width",p),cap:this._getValueOrOverrideExpression(s,a,"CapStyle",m),join:this._getValueOrOverrideExpression(s,a,"JoinStyle",c),miterLimit:d&&this._getValueOrOverrideExpression(s,a,"MiterLimit",d),referenceWidth:i,zOrder:$(e.name),dashTemplate:null,scaleDash:!1,sampleAlphaOnly:!1,animationParams:se(f)})}_analyzeGradientStroke(e,t,r,i){const{gradientMethod:o,gradientSize:a,gradientSizeUnits:s,gradientType:l,interval:n,primitiveName:p,type:m}=e,c=g.CIMGradientStroke,d=V(e.width,c.width),y=A(e.capStyle,c.capstyle),f=A(e.joinStyle,c.joinstyle),h=e.miterLimit,u=e.colorRamp;this._cimLayers.push({type:"gradientStroke",name:e.name,spriteRasterizationParam:{type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(p,m)},colorLocked:!!e.colorLocked,effects:t,color:[255,255,255,1],width:this._getValueOrOverrideExpression(m,p,"Width",d),cap:this._getValueOrOverrideExpression(m,p,"CapStyle",y),join:this._getValueOrOverrideExpression(m,p,"JoinStyle",f),miterLimit:h&&this._getValueOrOverrideExpression(m,p,"MiterLimit",h),referenceWidth:i,isOutline:r,gradientMethod:this._getValueOrOverrideExpression(m,p,"GradientMethod",o??c.gradientMethod),gradientType:this._getValueOrOverrideExpression(m,p,"GradientType",l??c.gradientType),interval:this._getValueOrOverrideExpression(m,p,"Interval",V(n,"CIMFixedColorRamp"===u.type?u.colors.length:c.interval)),gradientSize:this._getValueOrOverrideExpression(m,p,"GradientSize",V(a,c.gradientSize)),gradientSizeUnits:"Absolute"===s?b.Absolute:"Relative"===s?b.Relative:c.gradientSizeUnits})}_analyzeMarker(e,t,r,i,o,a,s,l,d,y=!1,f=!1){y||=!!e.colorLocked;let h=d;if(h=p(e,h),h=m(this._poMap,e,h),h=c(e,h),h=n(this._poMap,e,h),this._analyzeMarkerInsidePolygon(e,t,y,h))return;const u=V(e.size,g.CIMVectorMarker.size),v=V(e.rotation),O=V(e.offsetX),S=V(e.offsetY),{primitiveName:_,type:M}=e,k=this._getValueOrOverrideExpression(M,_,"Size",u),C=this._getValueOrOverrideExpression(M,_,"Rotation",v),b=this._getValueOrOverrideExpression(M,_,"OffsetX",O),x=this._getValueOrOverrideExpression(M,_,"OffsetY",S);switch(e.type){case"CIMPictureMarker":this._analyzePictureMarker(e,t,r,i,o,a,k,C,b,x,l,h,y,f);break;case"CIMVectorMarker":this._analyzeVectorMarker(e,t,r,i,o,a,k,C,b,x,l,h,s,y,f)}}_analyzeMarkerInsidePolygon(e,t,r,i){const{markerPlacement:o,type:s}=e;if(!o||"CIMMarkerPlacementInsidePolygon"!==o.type||i.hasMotionAnimations)return!1;if("CIMVectorMarker"===s||"CIMPictureMarker"===s){const r=e.primitiveName;if(r&&this._analyzePrimitiveOverrides([r],t,null,null))return!1;const i=o.primitiveName;if(i&&this._analyzePrimitiveOverrides([i],t,null,null))return!1;if("CIMVectorMarker"===s){const{markerGraphics:t}=e;if(t)for(const e of t){const{symbol:t}=e;if("CIMPolygonSymbol"===t?.type&&t.symbolLayers){const{symbolLayers:e}=t;for(const t of e)if("CIMSolidStroke"===t.type)return!1}}}else{const{animatedSymbolProperties:t}=e;if(t)return!1}}const l=Math.abs(o.stepX),n=Math.abs(o.stepY);if(0===l||0===n)return!0;let p,m;if("Random"===o.gridType){const e=a(B),t=Math.max(Math.floor(e/l),1);p=n*Math.max(Math.floor(e/n),1);m=t*l/p}else o.shiftOddRows?(p=2*n,m=l/n*.5):(p=n,m=l/n);const c=L(e),d="CIMCharacterMarker"===e.type?null:{type:"sprite-rasterization-param",resource:e,overrides:[]};return this._cimLayers.push({type:"fill",name:e.name,spriteRasterizationParam:d,colorLocked:r,effects:t,color:c,height:p,scaleX:m,angle:o.gridAngle??0,offsetX:V(o.offsetX),offsetY:V(o.offsetY),applyRandomOffset:"Random"===o.gridType,sampleAlphaOnly:"CIMPictureMarker"!==e.type,hasUnresolvedReplacementColor:!0,animationParams:se(i)}),!0}_analyzePictureMarker(e,t,i,o,a,l,n,p,m,c,d,y,f,h){const{animatedSymbolProperties:u,primitiveName:v,type:O}=e;let g=V(e.scaleX,1);const S=L(e);i||(i=this._createMarkerPlacementOverrideExpression(e.markerPlacement));const _=this._createGIFAnimatedSymbolPropertiesOverrideExpression(u),M=e.anchorPoint??{x:0,y:0};if("width"in e&&"number"==typeof e.width){const t=e.width;let r=1;const i=this._resourceManager.getResource(e.url);null!=i&&(r=i.width/i.height);g/=r*(V(e.size)/t)}const k=[...o];let C;e.primitiveName&&k.push(e.primitiveName),u||_?C={type:"animated",url:e.url,urlHash:"H"+s(e.url),playAnimation:e.animatedSymbolProperties?.playAnimation,reverseAnimation:e.animatedSymbolProperties?.reverseAnimation,randomizeStartTime:e.animatedSymbolProperties?.randomizeStartTime,randomizeStartSeed:e.animatedSymbolProperties?.randomizeStartSeed,startTimeOffset:e.animatedSymbolProperties?.startTimeOffset,duration:e.animatedSymbolProperties?.duration,repeatType:e.animatedSymbolProperties?.repeatType,repeatDelay:e.animatedSymbolProperties?.repeatDelay}:(C=r(e),C.markerPlacement=null);const b={type:"sprite-rasterization-param",resource:C,overrides:this._getMaterialOverrides(k,O)};_&&b.overrides.push(..._.overrides);const x=n;this._cimLayers.push({type:"marker",name:e.name,spriteRasterizationParam:b,colorLocked:f,effects:t,scaleSymbolsProportionally:!1,alignment:a,size:n,scaleX:this._getValueOrOverrideExpression(O,v,"ScaleX",g),rotation:p,offsetX:m,offsetY:c,transform:{type:"cim-marker-transform-param",params:d},color:this._getValueOrOverrideExpression(O,v,"TintColor",S),anchorPoint:{x:M.x,y:M.y},isAbsoluteAnchorPoint:"Relative"!==e.anchorPointUnits,outlineColor:[0,0,0,0],outlineWidth:0,frameHeight:0,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:l,sizeRatio:1,isOutline:h,markerPlacement:i,animationParams:se(y),baseSize:x})}_analyzeVectorMarker(e,t,r,i,o,a,s,l,p,m,c,h,u,v,O){const g=e.markerGraphics;if(!g)return;const S=e.frame;let _=0;_=S?S.ymax-S.ymin:a;const M=!!e.scaleSymbolsProportionally;if(_){const t={offsetX:p,offsetY:m,rotation:l,size:s,frameHeight:_,rotateClockWise:!!e.rotateClockwise,absoluteAnchorPoint:!1,scaleSymbolsProportionally:M};c=[...c,t]}r||(r=this._createMarkerPlacementOverrideExpression(e.markerPlacement));for(const k of g)if(k){const s=k.symbol;if(!s)continue;const l=k.primitiveName;l&&i.push(l);let p,m=h;if(("CIMPointSymbol"===s.type||"CIMTextSymbol"===s.type)&&S){let t=0,r=0;const i=k.geometry;"x"in i&&"y"in i&&(t+=i.x-.5*(S.xmin+S.xmax),r+=i.y-.5*(S.ymin+S.ymax));const o=e.anchorPoint;let a=!1;o&&("Absolute"===e.anchorPointUnits?(t-=o.x,r-=o.y,a=!0):S&&(t-=(S.xmax-S.xmin)*o.x,r-=(S.ymax-S.ymin)*o.y));const s={offsetX:t,offsetY:r,rotation:0,size:0,frameHeight:0,rotateClockWise:!1,absoluteAnchorPoint:a,scaleSymbolsProportionally:M};p=[...c,s]}const g=k.geometry,[C,b]=d(g,S);switch(0===C&&0===b||(m=y(m,C,b)),"CIMPointSymbol"===s.type&&(m=n(this._poMap,s,m)),s.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":u||re(s)?(m={...m,transform:{type:"AnimatedTransform",relativeTranslation:!1,absoluteScale:!0,translation:f([0,0]),rotation:f(0),scale:f(_),parent:h.transform}},this._analyzeMultiLayerGraphicNonSDF(e,t,r,k,i,o,a,p??c,m,_,v,O)):this._analyzeMultiLayerGraphic(e,t,r,k,i,o,a,p??c,m,_,v,O);break;case"CIMTextSymbol":this._analyzeTextGraphic(t,r,k,i,o,a,p??c,v)}l&&i.pop()}}_analyzeMultiLayerGraphic(e,t,r,i,o,a,s,l,n,p,m,c){const d=i.symbol,y=d.symbolLayers;if(y){if(!te(y)||h(n))return ie(y)?(u(d,e=>{e.colorLocked&&(m=!0)}),void this._analyzeMultiLayerGraphicNonSDF(e,t,r,i,o,a,s,l,n,p,m,c)):void this._analyzeMarkerGraphicSymbolLayers(e,t,r,i,o,a,s,l,n,p,m,c);this._analyzeCompositeMarkerGraphic(e,t,r,i,y,a,s,l,p,m,c)}}_analyzeMarkerGraphicSymbolLayers(e,t,r,i,o,a,s,l,p,m,c,d){const y=i.symbol,f=y.symbolLayers;if(!f)return;const h=H.applyEffects(y.effects,i.geometry);if(!h)return;let u=f.length;for(;u--;){const y=f[u];if(!y||!1===y.enable)continue;const v=y.primitiveName;switch(v&&o.push(v),y.type){case"CIMSolidFill":case"CIMSolidStroke":{const o=H.applyEffects(y.effects,h),f=M(o);if(!f)continue;const u="Relative"!==e.anchorPointUnits,O="CIMSolidStroke"===y.type?y.width:0,{frameSizeRatio:S,anchorX:_,anchorY:b,widthRatio:x,sdfPaddingRatio:z,sdfTextureSize:I}=k(f,e.frame,e.size,e.anchorPoint,u,O,e.scaleSymbolsProportionally),E="CIMSolidFill"===y.type,L={type:"sdf",geometry:o,sdfPaddingRatio:z,asFill:E,sdfTextureSize:I},{path:N}=y,R=E?P(T(y)):null==N?P(w(y)):[0,0,0,0],A=E?[0,0,0,0]:P(w(y));if(!E&&!O)break;const G=i.primitiveName;let F=null;E&&!y.colorLocked&&(F=this._maybeGetValueOrOverrideExpression(G,"FillColor"));let X=null;E||y.colorLocked||(X=this._maybeGetValueOrOverrideExpression(G,"StrokeColor"));const j=F??this._getValueOrOverrideExpression(y.type,v,"Color",R),Y=X??this._getValueOrOverrideExpression(y.type,v,"Color",A),W=this._maybeGetValueOrOverrideExpression(G,"StrokeWidth")??this._getValueOrOverrideExpression(y.type,v,"Width",O),D=N?{type:"sprite-rasterization-param",resource:{type:"path",path:N,asFill:E},overrides:[]}:{type:"sprite-rasterization-param",resource:L,overrides:[]},U=n(this._poMap,y,p),J=V(e.size,g.CIMVectorMarker.size),B=this._getValueOrOverrideExpression(e.type,e.primitiveName,"Size",J);this._cimLayers.push({type:"marker",name:y.name,groupName:e.name,spriteRasterizationParam:D,colorLocked:!!y.colorLocked||!!c,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:_,y:b},isAbsoluteAnchorPoint:u,size:m,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:"cim-marker-transform-param",params:l},frameHeight:m,widthRatio:x,rotateClockwise:!1,referenceSize:s,sizeRatio:S,color:j,outlineColor:Y,outlineWidth:W,isOutline:d,markerPlacement:r,animationParams:se(U),isStroke:"CIMSolidFill"!==y.type,baseSize:B,...C(o,I,z)});break}case"CIMPictureMarker":case"CIMVectorMarker":if(y.markerPlacement){q().error("Error analyzing CIM, got unexpected marker placement");break}this._analyzeMarker(y,t,r,o,a,s,!1,l,p,c,d)}v&&o.pop()}}_analyzeTextGraphic(e,r,i,o,a,s,l,n){const p=[];_.findApplicableOverrides(i,this._primitiveOverrides,p);const m=i.geometry;if(!("x"in m)||!("y"in m))return;const c=i.symbol,d=G(c),y=F(c.fontStyleName),f=t(c.fontFamilyName);c.font={family:f,decoration:d,...y};const h=V(c.height,g.CIMTextSymbol.height),u=V(c.angle),v=V(c.offsetX),O=V(c.offsetY),{haloSymbol:S}=c,M=V(c.haloSize,0);let k=[0,0,0,0];if(S?.symbolLayers?.length){const e=S.symbolLayers;for(const t of e)if(t.color){k=this._getValueOrOverrideExpression(c?.haloSymbol?.type??"CIMPolygonSymbol",t.primitiveName,"Color",P(t.color));break}}const C=i.primitiveName;let b=[0,0,0,1],x=[0,0,0,0],z=0,I=!1;if(c.symbol?.symbolLayers)for(const t of c.symbol.symbolLayers){const e=t.primitiveName;if("CIMSolidStroke"===t.type)x=this._getValueOrOverrideExpression("CIMSolidStroke",e,"Color",P(t.color)),z=this._getValueOrOverrideExpression("CIMSolidStroke",e,"Width",X(t)??0);else if("CIMSolidFill"===t.type){const r=P(t.color);I=I??!!t.colorLocked,b=this._getValueOrOverrideExpression("CIMSolidFill",e??C,"Color",r)}}let E=null,L=null,N=null,R=null,A=null;C&&(E=this._maybeGetValueOrOverrideExpression(C,"TextSize"),L=this._maybeGetValueOrOverrideExpression(C,"TextAngle"),N=this._maybeGetValueOrOverrideExpression(C,"TextOffsetX"),R=this._maybeGetValueOrOverrideExpression(C,"TextOffsetY"),I||(A=this._maybeGetValueOrOverrideExpression(C,"FillColor")));const T=A??b;let w=null,W=null,D=0;if("CIMBackgroundCallout"===c.callout?.type){const e=c.callout;if(e.backgroundSymbol){const t=e.backgroundSymbol.symbolLayers;if(t)for(const e of t)"CIMSolidFill"===e.type?w=P(e.color):"CIMSolidStroke"===e.type&&(W=P(e.color),D=V(e.width,g.CIMSolidStroke.width))}}const U=this._getValueOrOverrideExpression(c.type,i.primitiveName,"TextString",i.textString??"");if(null==U)return;const{fontStyleName:H}=c,J=f+(H?"-"+H.toLowerCase():"-regular"),B=this._getMaterialOverrides(o,c.type);B.push(...this._getPrimitiveMaterialOverrides(i.primitiveName,c.type)),this._collectDictionaryTemplateOverrides(B,i);const q={type:"text-rasterization-param",resource:{type:"text",textString:i.textString??"",font:c.font,symbol:c,primitiveName:i.primitiveName},overrides:B};this._cimLayers.push({type:"text",lineWidth:c.lineWidth,textRasterizationParam:q,colorLocked:!!n||!!I,effects:e,alignment:a,anchorPoint:{x:0,y:0},isAbsoluteAnchorPoint:!1,fontName:J,decoration:d,haloSize:M,haloColor:k,weight:y.weight,style:y.style,size:E??h,angle:L??u,offsetX:N??v,offsetY:R??O,transform:{type:"cim-marker-transform-param",params:l},horizontalAlignment:Y(c.horizontalAlignment),verticalAlignment:j(c.verticalAlignment),text:U,color:T,outlineColor:x,outlineSize:z,backgroundColor:w,borderLineColor:W,borderLineWidth:D,referenceSize:s,sizeRatio:1,markerPlacement:r})}_collectDictionaryTemplateOverrides(e,t){if(t.textString&&this._hasTextStringTemplates){const r=W(t.symbol);e.push({propertyName:"textString",defaultValue:"",valueExpressionInfo:{type:"dictionary-template",textCase:r,template:t.textString},primitiveName:t.primitiveName})}}_analyzeMultiLayerGraphicNonSDF(e,t,r,i,a,s,l,n,p,m,c,d){const y=Z(e,i),f=e.primitiveName,h=this._analyzeMaterialOverrides(f,["Rotation","OffsetX","OffsetY"]),u=N(h),[O,S,_]=v.getTextureAnchor(y,this._resourceManager,J),M=this._getMaterialOverrides(a,e.type).filter(e=>e.primitiveName!==f||!["rotation","offsetX","offsetY"].includes(e.propertyName));M.push(...u);const k={type:"sprite-rasterization-param",resource:{...y,avoidSDFRasterization:!0},overrides:M},C=V(e.size,g.CIMVectorMarker.size),b=this._getValueOrOverrideExpression(e.type,f,"Size",C);this._cimLayers.push({type:"marker",name:e.name,spriteRasterizationParam:k,colorLocked:c,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:s,anchorPoint:{x:O,y:S},isAbsoluteAnchorPoint:!1,size:m,rotation:0,offsetX:0,offsetY:0,transform:{type:"cim-marker-transform-param",params:n},color:[255,255,255,1],outlineColor:[0,0,0,0],outlineWidth:0,scaleX:1,frameHeight:m,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:l,sizeRatio:_/o(e.size),isOutline:d,markerPlacement:r,animationParams:se(p),baseSize:b})}_createMarkerPlacementOverrideExpression(e){if(!e)return null;const t=[];return _.findApplicableOverrides(e,this._primitiveOverrides,t),{type:"cim-marker-placement-param",placement:e,overrides:ae(t)}}_createGIFAnimatedSymbolPropertiesOverrideExpression(e){if(!e)return null;const t=[];return _.findApplicableOverrides(e,this._primitiveOverrides,t),{type:"cim-gif-animation-params",animation:e,overrides:ae(t)}}_analyzeCompositeMarkerGraphic(e,t,r,i,o,a,s,l,n,p,m){const c=i.geometry,d=o[0],y=o[1],f=M(c);if(!f)return;const h="Relative"!==e.anchorPointUnits,u=V(d.width,g.CIMSolidStroke.width),{frameSizeRatio:v,anchorX:O,anchorY:S,widthRatio:_,sdfPaddingRatio:C,sdfTextureSize:b}=k(f,e.frame,e.size,e.anchorPoint,h,u,e.scaleSymbolsProportionally),{path:x}=y,z=y.primitiveName,I=d.primitiveName,E=i.primitiveName;let L=null;y.colorLocked||p||(L=this._maybeGetValueOrOverrideExpression(E,"FillColor"));const N=L??this._getValueOrOverrideExpression(y.type,z,"Color",P(y.color));let R=null;d.colorLocked||p||(R=this._maybeGetValueOrOverrideExpression(E,"StrokeColor"));const A=R??this._getValueOrOverrideExpression(d.type,I,"Color",P(d.color)),T=this._maybeGetValueOrOverrideExpression(E,"StrokeWidth")??this._getValueOrOverrideExpression(d.type,I,"Width",u),w={type:"sprite-rasterization-param",resource:x?{type:"path",path:x,asFill:!0}:{type:"sdf",geometry:c,sdfTextureSize:b,sdfPaddingRatio:C,asFill:!0},overrides:[]};this._cimLayers.push({type:"marker",name:e.name,spriteRasterizationParam:w,colorLocked:p,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:O,y:S},isAbsoluteAnchorPoint:h,size:n,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:"cim-marker-transform-param",params:l},frameHeight:n,widthRatio:_,rotateClockwise:!1,referenceSize:s,sizeRatio:v,color:N,outlineColor:A,outlineWidth:T,isOutline:m,markerPlacement:r})}_setPoMap(e,t,r){let i;this._poMap[e]?i=this._poMap[e]:(i={},this._poMap[e]=i),i[t]=r}_maybeGetValueOrOverrideExpression(e,t,r){return this._getValueOrOverrideExpression("",e,t,r,!1)}_getValueOrOverrideExpression(e,t,r,i,o=!0){if(o&&!D(i)&&(i=R(e,r.toLowerCase())),null==t)return i;const a=this._poMap[t];if(null==a)return i;const s=a[r];return"string"==typeof s||"number"==typeof s||Array.isArray(s)?s:s?{valueExpressionInfo:s,defaultValue:i}:i}_analyzePrimitiveOverrides(e,t,r,i){if(null==e)return!1;"string"==typeof e&&(e=[e]);for(const o of this._primitiveOverrides)if(e.includes(o.primitiveName)&&o.valueExpressionInfo)return!0;if(null!=t)for(const o of t)if(o?.overrides.length>0)return!0;if(null!=r)for(const o of r)if(o?.overrides.length>0)return!0;if(null!=i)for(const o of i)if(o?.overrides.length>0)return!0;return!1}_getMaterialOverrides(e,t){if(!e)return[];const r=[];for(const i of e)r.push(...this._getPrimitiveMaterialOverrides(i,t));return r}_getPrimitiveMaterialOverrides(e,t){if(!e)return[];const r=N(this._primitiveOverrides.filter(t=>t.primitiveName===e));return r.forEach(e=>e.defaultValue=R(t,e.propertyName.toLowerCase())),r}_analyzeMaterialOverrides(e,t){return this._primitiveOverrides.filter(r=>r.primitiveName!==e||!t.includes(r.propertyName))}}function Z(e,t){return{type:e.type,enable:!0,name:e.name,colorLocked:e.colorLocked,primitiveName:e.primitiveName,anchorPoint:e.anchorPoint,anchorPointUnits:e.anchorPointUnits,offsetX:0,offsetY:0,rotateClockwise:e.rotateClockwise,rotation:0,size:e.size,billboardMode3D:e.billboardMode3D,depth3D:e.depth3D,frame:e.frame,markerGraphics:[t],scaleSymbolsProportionally:e.scaleSymbolsProportionally,respectFrame:e.respectFrame,clippingPath:e.clippingPath}}function $(e){if(e?.startsWith("Level_")){const t=parseInt(e.slice(6),10);if(!isNaN(t))return t}return 0}function ee(e,t){if(!t||0===t.length)return e;const i=r(e);return _.applyOverrides(i,t),i}const te=e=>e&&2===e.length&&e[0].enable&&e[1].enable&&"CIMSolidStroke"===e[0].type&&"CIMSolidFill"===e[1].type&&null==e[0].path&&null==e[1].path&&!e[0].effects&&!e[1].effects&&!e[0].animations&&!e[1].animations;function re(e){const t=e.symbolLayers;if(!t)return!1;const r=t.find(e=>e.effects?.find(e=>"CIMGeometricEffectDashes"===e.type&&null!=e.dashTemplate)),i=t.find(e=>e.effects?.find(e=>"CIMGeometricEffectAddControlPoints"===e.type));return!!r||!!i}function ie(e){return e.some(e=>"CIMSolidFill"!==e.type&&"CIMSolidStroke"!==e.type&&("CIMVectorMarker"!==e.type&&"CIMPictureMarker"!==e.type||null!=e.markerPlacement))}function oe(e,t){if(t?.some(e=>"CIMGeometricEffectRadial"===e.type)&&t?.some(e=>"CIMGeometricEffectTaperedPolygon"===e.type)&&2===e.length){const t=e.find(e=>"CIMSolidFill"===e.type),r=e.find(e=>"CIMSolidStroke"===e.type),i=r?.effects?.some(e=>"CIMGeometricEffectDashes"===e.type);if(null!=t&&null!=r&&!i)return!0}return!1}function ae(e){return r(e).map(e=>({...e,propertyName:U(e.propertyName)}))}function se(e){return h(e)?{type:"animation-params",params:e}:null}export{Q as CIMAnalyzer,ee as analyzeCIMResource};
2
+ import{isRGB as e}from"../../core/colorUtils.js";import{getFontFamily as t}from"../../core/fontUtils.js";import"../../core/has.js";import{clone as r}from"../../core/lang.js";import i from"../../core/Logger.js";import{pt2px as o,px2pt as a}from"../../core/screenUtils.js";import{numericHash as s}from"../../core/string.js";import{checkForAnimations as l,getAnimationParams as n,handleAbsoluteAnchor as p,handleMarker as m,handleRelativeAnchor as c,getFrameTranslation as y,translate as d,getStaticParam as f,shouldUseAnimatedPath as h}from"./animationUtils.js";import{forEachSymbolLayer as u,CIMSymbolHelper as v}from"./CIMSymbolHelper.js";import{antialiasingOutlineFillSettings as O}from"./constants.js";import{defaultCIMValues as g}from"./defaultCIMValues.js";import{fitVectorMarker as S}from"./fitVectorMarker.js";import{OverrideHelper as _}from"./OverrideHelper.js";import{hasRichTextFormattingTags as M}from"./richTextUtils.js";import{getExtent as k,getSDFMetrics as C,getSDFDimensions as x}from"./SDFHelper.js";import{CIMSymbolUnits as b}from"./types.js";import{colorToArray as P,normalizeAlpha as z,getSize as I,isCIMMarkerStrokePlacement as E,hasStrokeLayer as L,getTintColor as V,getNumericValue as N,normalizePrimitiveOverrideProps as R,getDefaultCIMValue as T,getEnum as A,getFillColor as w,getStrokeColor as G,fromCIMFontDecoration as F,fromCIMFontStyle as X,getStrokeWidth as j,fromCIMVerticalAlignment as Y,fromCIMHorizontalAlignment as W,getTextCasing as D,isValidCIMValue as U,uncapitalize as H}from"./utils.js";import{EffectHelper as J}from"./effects/EffectHelper.js";import{rasterizedVectorMarkerMinSize as B,randomInsidePolygonTextureSize as q}from"../../views/2d/engine/webgl/definitions.js";const K=()=>i.getLogger("esri.symbols.cim.cimAnalyzer");function Q(e){const t=e.markerPlacement;return t&&t.angleToLine?1:0}class Z{constructor(e){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[],this._hasTextStringTemplates=!1,e&&(this._resourceManager=e)}analyzeSymbolReference(t,r,i){if(this._cimLayers=i??[],!t)return this._cimLayers;if(this._reset(),this._hasTextStringTemplates=t.hasTextStringTemplates??!1,t.primitiveOverrides){this._primitiveOverrides=t.primitiveOverrides;for(const t of this._primitiveOverrides){const r=t.valueExpressionInfo;if(r)this._setPoMap(t.primitiveName,t.propertyName,r);else if(null!=t.value){let r=t.value;t.propertyName.includes("Color")&&(e(r)&&(r=P(r)),r=z(r)),this._setPoMap(t.primitiveName,t.propertyName,r)}}}return this._analyzeSymbol(t.symbol,r),this._cimLayers}_reset(){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[]}_analyzeSymbol(e,t){switch(e?.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this._analyzeMultiLayerSymbol(e,t)}}_analyzeMultiLayerSymbol(e,t){const r=e?.symbolLayers;if(!r)return;for(let l=0;l<r.length;l++){const e=r[l];"CIMVectorMarker"===e.type&&(r[l]=S(e))}const i=e.effects;let o=0;const a=I(e)??0;if("CIMPointSymbol"===e.type&&"Map"===e.angleAlignment&&(o=1),ae(r,i))return this._analyzeCompositeOutlineFill(r,i,a);let s={transform:[0,0,0,1],fromColor:[1,1,1,1],toColor:[1,1,1,1],colorMix:[0,0,0,0],toOpacity:[1,1,1,1],opacityMix:[0,0,0,0],shift:[1,1,1,1],hasAnimations:l(e),hasShiftAnimation:!1,hasMotionAnimations:!1};s=n(this._poMap,e,s);const p="CIMPolygonSymbol"===e.type;let m=r.length;for(;m--;){const l=r[m];if(!l||!1===l.enable)continue;let n;i?.length&&(n=[...i]);const c=l.effects;c?.length&&(i?n.push(...c):n=[...c]);let y=null;if(n){y=[];for(const e of n){const t=_.findEffectOverrides(e,this._primitiveOverrides);t&&y.push(t)}}const d=[];switch(_.findApplicableOverrides(l,this._primitiveOverrides,d),l.type){case"CIMSolidFill":this._analyzeSolidFill(l,y,s,L(r));break;case"CIMPictureFill":this._analyzePictureFill(l,y,s);break;case"CIMHatchFill":this._analyzeHatchFill(l,y,s);break;case"CIMGradientFill":this._analyzeGradientFill(l,y);break;case"CIMSolidStroke":this._analyzeSolidStroke(l,y,p,a,s);break;case"CIMPictureStroke":this._analyzePictureStroke(l,y,p,a,s);break;case"CIMGradientStroke":this._analyzeGradientStroke(l,y,p,a);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":{"CIMLineSymbol"!==e.type&&"CIMPolygonSymbol"!==e.type||(o=Q(l));const r=[],i=l.primitiveName;i&&r.push(i);const n=p&&E(l.markerPlacement);this._analyzeMarker(l,y,null,r,o,a,t,[],s,!1,n);break}default:K().error("Cannot analyze CIM layer",l.type)}}}_analyzeSolidFill(e,t,r,i){const{primitiveName:o,type:a}=e,s=z(e.color),l=n(this._poMap,e,r);if(!i&&t?.some(e=>"CIMGeometricEffectTaperedPolygon"===e.effect.type)){const r=this._getValueOrOverrideExpression(a,o,"Color",s);return void this._cimLayers.push({type:"outlineFill",name:e.name,colorLocked:!!e.colorLocked,color:r,effects:t,outlineColor:r,outlineColorLocked:!!e.colorLocked,...O,outlineEffects:t})}this._cimLayers.push({type:"fill",name:e.name,spriteRasterizationParam:null,colorLocked:!!e.colorLocked,color:this._getValueOrOverrideExpression(a,o,"Color",s),height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,effects:t,applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!1,animationParams:le(l)})}_analyzePictureFill(e,t,r){const{primitiveName:i,type:o}=e,a=V(e),s=N(e.height,g.CIMPictureFill.height);let l=N(e.scaleX,1);if("width"in e&&"number"==typeof e.width){const t=e.width;let r=1;const i=this._resourceManager.getResource(e.url);null!=i&&(r=i.width/i.height),l/=r*(s/t)}const p={type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(i,o)},m=n(this._poMap,e,r);this._cimLayers.push({type:"fill",name:e.name,spriteRasterizationParam:p,colorLocked:!!e.colorLocked,effects:t,color:this._getValueOrOverrideExpression(o,i,"TintColor",a),height:this._getValueOrOverrideExpression(o,i,"Height",s),scaleX:this._getValueOrOverrideExpression(o,i,"ScaleX",l),angle:this._getValueOrOverrideExpression(o,i,"Rotation",N(e.rotation)),offsetX:this._getValueOrOverrideExpression(o,i,"OffsetX",N(e.offsetX)),offsetY:this._getValueOrOverrideExpression(o,i,"OffsetY",N(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!1,hasUnresolvedReplacementColor:!1,animationParams:le(m)})}_analyzeHatchFill(e,t,r){const{primitiveName:i,type:o}=e,a=n(this._poMap,e,r),s=this._analyzeMaterialOverrides(i,["Rotation","OffsetX","OffsetY"]),l=R(s);let p=[255,255,255,1],m=!1;if(e.lineSymbol?.symbolLayers)for(const n of e.lineSymbol.symbolLayers){if("CIMSolidStroke"!==n.type)continue;const e=n.primitiveName??i;m||!e||n.colorLocked||null==this._poMap[e]?.Color&&null==this._poMap[e]?.StrokeColor||(p=z(n.color),p=this._maybeGetValueOrOverrideExpression(e,"StrokeColor")??this._getValueOrOverrideExpression(o,e,"Color",p),m=!0);const t=this._maybeGetValueOrOverrideExpression(e,"StrokeWidth");if(t){let r=null,i=null;"number"==typeof t?r=t:i=t.valueExpressionInfo;let a=l.find(e=>"strokeWidth"===e.propertyName);a?a.propertyName="width":(a={type:"CIMPrimitiveOverride",primitiveName:e,propertyName:"width",valueExpressionInfo:i,value:r,defaultValue:T(o,"width")},l.push(a))}}const c={type:"sprite-rasterization-param",resource:e,overrides:l};this._cimLayers.push({type:"fill",name:e.name,spriteRasterizationParam:c,colorLocked:!!e.colorLocked,effects:t,color:p,height:this._getValueOrOverrideExpression(o,i,"Separation",N(e.separation,g.CIMHatchFill.separation)),scaleX:1,angle:this._getValueOrOverrideExpression(o,i,"Rotation",N(e.rotation)),offsetX:this._getValueOrOverrideExpression(o,i,"OffsetX",N(e.offsetX)),offsetY:this._getValueOrOverrideExpression(o,i,"OffsetY",N(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!m,animationParams:le(a)})}_analyzeGradientFill(e,t){const{angle:r,gradientMethod:i,gradientSize:o,gradientSizeUnits:a,gradientType:s,interval:l,primitiveName:n,type:p}=e,m=g.CIMGradientFill,c=e.colorRamp;this._cimLayers.push({type:"gradientFill",name:e.name,spriteRasterizationParam:{type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(n,p)},colorLocked:!1,effects:t,color:[255,255,255,1],gradientMethod:this._getValueOrOverrideExpression(p,n,"GradientMethod",i??"Linear"),angle:this._getValueOrOverrideExpression(p,n,"Angle",N(r,m.angle)),gradientType:this._getValueOrOverrideExpression(p,n,"GradientType",s??m.gradientType),interval:this._getValueOrOverrideExpression(p,n,"Interval",N(l,"CIMFixedColorRamp"===c.type?c.colors.length:m.interval)),gradientSize:this._getValueOrOverrideExpression(p,n,"GradientSize",N(o,m.gradientSize)),gradientSizeUnits:"Absolute"===a?b.Absolute:"Relative"===a?b.Relative:m.gradientSizeUnits})}_analyzeCompositeOutlineFill(e,t,r){const i=e.find(e=>"CIMSolidFill"===e.type),o=e.find(e=>"CIMSolidStroke"===e.type);if(null==i||null==o)return;const a=[...t??[],...i.effects??[]].map(e=>_.findEffectOverrides(e,this._primitiveOverrides)).filter(e=>null!=e),s=[...t??[],...o.effects??[]].map(e=>_.findEffectOverrides(e,this._primitiveOverrides)).filter(e=>null!=e),l=N(o.width,g.CIMSolidStroke.width),n=A(o.capStyle,g.CIMSolidStroke.capstyle),p=A(o.joinStyle,g.CIMSolidStroke.joinstyle),m=o.miterLimit;this._cimLayers.push({type:"outlineFill",name:i.name,colorLocked:!!i.colorLocked,color:this._getValueOrOverrideExpression(i.type,i.primitiveName,"Color",z(i.color)),effects:a,outlineColorLocked:!!o.colorLocked,outlineColor:this._getValueOrOverrideExpression(o.type,o.primitiveName,"Color",z(o.color)),outlineWidth:this._getValueOrOverrideExpression(o.type,o.primitiveName,"Width",l),cap:this._getValueOrOverrideExpression(o.type,o.primitiveName,"CapStyle",n),join:this._getValueOrOverrideExpression(o.type,o.primitiveName,"JoinStyle",p),miterLimit:m&&this._getValueOrOverrideExpression(o.type,o.primitiveName,"MiterLimit",m),referenceWidth:r,outlineEffects:s})}_analyzeSolidStroke(e,t,r,i,o){const{primitiveName:a,type:s}=e,l=z(e.color),p=N(e.width,g.CIMSolidStroke.width),m=A(e.capStyle,g.CIMSolidStroke.capstyle),c=A(e.joinStyle,g.CIMSolidStroke.joinstyle),y=e.miterLimit;let d,f,h,u,v=[];if(this._analyzePrimitiveOverrides(a,t,null,null)&&(v=this._getPrimitiveMaterialOverrides(a,s)),t&&Array.isArray(t)&&t.length>0){const e=t[t.length-1].effect;e&&"CIMGeometricEffectDashes"===e.type&&"NoConstraint"===e.lineDashEnding&&(d=e.dashTemplate,f=e.scaleDash,h=e.offsetAlongLine,u=e.primitiveName,(t=[...t]).pop())}null!=u&&v.push(...this._getPrimitiveMaterialOverrides(u,s).filter(e=>"dashTemplate"===e.propertyName));const O=void 0!==d?{type:"sprite-rasterization-param",resource:{type:"dash",dashTemplate:d,primitiveName:u},overrides:v}:null,S=n(this._poMap,e,o);this._cimLayers.push({type:"line",name:e.name,spriteRasterizationParam:O,isOutline:r,colorLocked:!!e.colorLocked,effects:t,color:this._getValueOrOverrideExpression(s,a,"Color",l),width:this._getValueOrOverrideExpression(s,a,"Width",p),cap:this._getValueOrOverrideExpression(s,a,"CapStyle",m),join:this._getValueOrOverrideExpression(s,a,"JoinStyle",c),miterLimit:y&&this._getValueOrOverrideExpression(s,a,"MiterLimit",y),referenceWidth:i,zOrder:ee(e.name),dashTemplate:this._maybeGetValueOrOverrideExpression(u,"DashTemplate")??d,offsetAlongLine:this._getValueOrOverrideExpression(s,u,"OffsetAlongLine",h??0),scaleDash:f,sampleAlphaOnly:!0,animationParams:le(S)})}_analyzePictureStroke(e,t,r,i,o){const{primitiveName:a,type:s}=e,l=V(e),p=N(e.width,g.CIMPictureStroke.width),m=A(e.capStyle,g.CIMPictureStroke.capstyle),c=A(e.joinStyle,g.CIMPictureStroke.joinstyle),y=e.miterLimit,d={type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(a,s)},f=n(this._poMap,e,o);this._cimLayers.push({type:"line",name:e.name,spriteRasterizationParam:d,isOutline:r,colorLocked:!!e.colorLocked,effects:t,color:this._getValueOrOverrideExpression(s,a,"TintColor",l),width:this._getValueOrOverrideExpression(s,a,"Width",p),cap:this._getValueOrOverrideExpression(s,a,"CapStyle",m),join:this._getValueOrOverrideExpression(s,a,"JoinStyle",c),miterLimit:y&&this._getValueOrOverrideExpression(s,a,"MiterLimit",y),referenceWidth:i,zOrder:ee(e.name),dashTemplate:null,scaleDash:!1,sampleAlphaOnly:!1,animationParams:le(f)})}_analyzeGradientStroke(e,t,r,i){const{gradientMethod:o,gradientSize:a,gradientSizeUnits:s,gradientType:l,interval:n,primitiveName:p,type:m}=e,c=g.CIMGradientStroke,y=N(e.width,c.width),d=A(e.capStyle,c.capstyle),f=A(e.joinStyle,c.joinstyle),h=e.miterLimit,u=e.colorRamp;this._cimLayers.push({type:"gradientStroke",name:e.name,spriteRasterizationParam:{type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(p,m)},colorLocked:!!e.colorLocked,effects:t,color:[255,255,255,1],width:this._getValueOrOverrideExpression(m,p,"Width",y),cap:this._getValueOrOverrideExpression(m,p,"CapStyle",d),join:this._getValueOrOverrideExpression(m,p,"JoinStyle",f),miterLimit:h&&this._getValueOrOverrideExpression(m,p,"MiterLimit",h),referenceWidth:i,isOutline:r,gradientMethod:this._getValueOrOverrideExpression(m,p,"GradientMethod",o??c.gradientMethod),gradientType:this._getValueOrOverrideExpression(m,p,"GradientType",l??c.gradientType),interval:this._getValueOrOverrideExpression(m,p,"Interval",N(n,"CIMFixedColorRamp"===u.type?u.colors.length:c.interval)),gradientSize:this._getValueOrOverrideExpression(m,p,"GradientSize",N(a,c.gradientSize)),gradientSizeUnits:"Absolute"===s?b.Absolute:"Relative"===s?b.Relative:c.gradientSizeUnits})}_analyzeMarker(e,t,r,i,o,a,s,l,y,d=!1,f=!1){d||=!!e.colorLocked;let h=y;if(h=p(e,h),h=m(this._poMap,e,h),h=c(e,h),h=n(this._poMap,e,h),this._analyzeMarkerInsidePolygon(e,t,d,h))return;const u=N(e.size,g.CIMVectorMarker.size),v=N(e.rotation),O=N(e.offsetX),S=N(e.offsetY),{primitiveName:_,type:M}=e,k=this._getValueOrOverrideExpression(M,_,"Size",u),C=this._getValueOrOverrideExpression(M,_,"Rotation",v),x=this._getValueOrOverrideExpression(M,_,"OffsetX",O),b=this._getValueOrOverrideExpression(M,_,"OffsetY",S);switch(e.type){case"CIMPictureMarker":this._analyzePictureMarker(e,t,r,i,o,a,k,C,x,b,l,h,d,f);break;case"CIMVectorMarker":this._analyzeVectorMarker(e,t,r,i,o,a,k,C,x,b,l,h,s,d,f)}}_analyzeMarkerInsidePolygon(e,t,r,i){const{markerPlacement:o,type:s}=e;if(!o||"CIMMarkerPlacementInsidePolygon"!==o.type||i.hasMotionAnimations)return!1;if("CIMVectorMarker"===s||"CIMPictureMarker"===s){const r=e.primitiveName;if(r&&this._analyzePrimitiveOverrides([r],t,null,null))return!1;const i=o.primitiveName;if(i&&this._analyzePrimitiveOverrides([i],t,null,null))return!1;if("CIMVectorMarker"===s){const{markerGraphics:t}=e;if(t)for(const e of t){const{symbol:t}=e;if("CIMPolygonSymbol"===t?.type&&t.symbolLayers){const{symbolLayers:e}=t;for(const t of e)if("CIMSolidStroke"===t.type)return!1}}}else{const{animatedSymbolProperties:t}=e;if(t)return!1}}const l=Math.abs(o.stepX),n=Math.abs(o.stepY);if(0===l||0===n)return!0;let p,m;if("Random"===o.gridType){const e=a(q),t=Math.max(Math.floor(e/l),1);p=n*Math.max(Math.floor(e/n),1);m=t*l/p}else o.shiftOddRows?(p=2*n,m=l/n*.5):(p=n,m=l/n);const c=V(e),y="CIMCharacterMarker"===e.type?null:{type:"sprite-rasterization-param",resource:e,overrides:[]};return this._cimLayers.push({type:"fill",name:e.name,spriteRasterizationParam:y,colorLocked:r,effects:t,color:c,height:p,scaleX:m,angle:o.gridAngle??0,offsetX:N(o.offsetX),offsetY:N(o.offsetY),applyRandomOffset:"Random"===o.gridType,sampleAlphaOnly:"CIMPictureMarker"!==e.type,hasUnresolvedReplacementColor:!0,animationParams:le(i)}),!0}_analyzePictureMarker(e,t,i,o,a,l,n,p,m,c,y,d,f,h){const{animatedSymbolProperties:u,primitiveName:v,type:O}=e;let g=N(e.scaleX,1);const S=V(e);i||(i=this._createMarkerPlacementOverrideExpression(e.markerPlacement));const _=this._createGIFAnimatedSymbolPropertiesOverrideExpression(u),M=e.anchorPoint??{x:0,y:0};if("width"in e&&"number"==typeof e.width){const t=e.width;let r=1;const i=this._resourceManager.getResource(e.url);null!=i&&(r=i.width/i.height);g/=r*(N(e.size)/t)}const k=[...o];let C;e.primitiveName&&k.push(e.primitiveName),u||_?C={type:"animated",url:e.url,urlHash:"H"+s(e.url),playAnimation:e.animatedSymbolProperties?.playAnimation,reverseAnimation:e.animatedSymbolProperties?.reverseAnimation,randomizeStartTime:e.animatedSymbolProperties?.randomizeStartTime,randomizeStartSeed:e.animatedSymbolProperties?.randomizeStartSeed,startTimeOffset:e.animatedSymbolProperties?.startTimeOffset,duration:e.animatedSymbolProperties?.duration,repeatType:e.animatedSymbolProperties?.repeatType,repeatDelay:e.animatedSymbolProperties?.repeatDelay}:(C=r(e),C.markerPlacement=null);const x={type:"sprite-rasterization-param",resource:C,overrides:this._getMaterialOverrides(k,O)};_&&x.overrides.push(..._.overrides);const b=n;this._cimLayers.push({type:"marker",name:e.name,spriteRasterizationParam:x,colorLocked:f,effects:t,scaleSymbolsProportionally:!1,alignment:a,size:n,scaleX:this._getValueOrOverrideExpression(O,v,"ScaleX",g),rotation:p,offsetX:m,offsetY:c,transform:{type:"cim-marker-transform-param",params:y},color:this._getValueOrOverrideExpression(O,v,"TintColor",S),anchorPoint:{x:M.x,y:M.y},isAbsoluteAnchorPoint:"Relative"!==e.anchorPointUnits,outlineColor:[0,0,0,0],outlineWidth:0,frameHeight:0,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:l,sizeRatio:1,isOutline:h,markerPlacement:i,animationParams:le(d),baseSize:b})}_analyzeVectorMarker(e,t,r,i,o,a,s,l,p,m,c,h,u,v,O){const g=e.markerGraphics;if(!g)return;const S=e.frame;let _=0;_=S?S.ymax-S.ymin:a;const M=!!e.scaleSymbolsProportionally;if(_){const t={offsetX:p,offsetY:m,rotation:l,size:s,frameHeight:_,rotateClockWise:!!e.rotateClockwise,absoluteAnchorPoint:!1,scaleSymbolsProportionally:M};c=[...c,t]}r||(r=this._createMarkerPlacementOverrideExpression(e.markerPlacement));for(const k of g)if(k){const s=k.symbol;if(!s)continue;const l=k.primitiveName;l&&i.push(l);let p,m=h;if(("CIMPointSymbol"===s.type||"CIMTextSymbol"===s.type)&&S){let t=0,r=0;const i=k.geometry;"x"in i&&"y"in i&&(t+=i.x-.5*(S.xmin+S.xmax),r+=i.y-.5*(S.ymin+S.ymax));const o=e.anchorPoint;let a=!1;o&&("Absolute"===e.anchorPointUnits?(t-=o.x,r-=o.y,a=!0):S&&(t-=(S.xmax-S.xmin)*o.x,r-=(S.ymax-S.ymin)*o.y));const s={offsetX:t,offsetY:r,rotation:0,size:0,frameHeight:0,rotateClockWise:!1,absoluteAnchorPoint:a,scaleSymbolsProportionally:M};p=[...c,s]}const g=k.geometry,[C,x]=y(g,S);switch(0===C&&0===x||(m=d(m,C,x)),"CIMPointSymbol"===s.type&&(m=n(this._poMap,s,m)),s.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":u||ie(s)?(m={...m,transform:{type:"AnimatedTransform",relativeTranslation:!1,absoluteScale:!0,translation:f([0,0]),rotation:f(0),scale:f(_),parent:h.transform}},this._analyzeMultiLayerGraphicNonSDF(e,t,r,k,i,o,a,p??c,m,_,v,O)):this._analyzeMultiLayerGraphic(e,t,r,k,i,o,a,p??c,m,_,v,O);break;case"CIMTextSymbol":this._analyzeTextGraphic(t,r,k,i,o,a,p??c,v)}l&&i.pop()}}_analyzeMultiLayerGraphic(e,t,r,i,o,a,s,l,n,p,m,c){const y=i.symbol,d=y.symbolLayers;if(d){if(!re(d)||h(n))return oe(d)?(u(y,e=>{e.colorLocked&&(m=!0)}),void this._analyzeMultiLayerGraphicNonSDF(e,t,r,i,o,a,s,l,n,p,m,c)):void this._analyzeMarkerGraphicSymbolLayers(e,t,r,i,o,a,s,l,n,p,m,c);this._analyzeCompositeMarkerGraphic(e,t,r,i,d,a,s,l,p,m,c)}}_analyzeMarkerGraphicSymbolLayers(e,t,r,i,o,a,s,l,p,m,c,y){const d=i.symbol,f=d.symbolLayers;if(!f)return;const h=J.applyEffects(d.effects,i.geometry);if(!h)return;let u=f.length;for(;u--;){const d=f[u];if(!d||!1===d.enable)continue;const v=d.primitiveName;switch(v&&o.push(v),d.type){case"CIMSolidFill":case"CIMSolidStroke":{const o=J.applyEffects(d.effects,h),f=k(o);if(!f)continue;const u="Relative"!==e.anchorPointUnits,O="CIMSolidStroke"===d.type?d.width:0,{frameSizeRatio:S,anchorX:_,anchorY:M,widthRatio:b,sdfPaddingRatio:P,sdfTextureSize:I}=C(f,e.frame,e.size,e.anchorPoint,u,O,e.scaleSymbolsProportionally),E="CIMSolidFill"===d.type,L={type:"sdf",geometry:o,sdfPaddingRatio:P,asFill:E,sdfTextureSize:I},{path:V}=d,R=E?z(w(d)):null==V?z(G(d)):[0,0,0,0],T=E?[0,0,0,0]:z(G(d));if(!E&&!O)break;const A=i.primitiveName;let F=null;E&&!d.colorLocked&&(F=this._maybeGetValueOrOverrideExpression(A,"FillColor"));let X=null;E||d.colorLocked||(X=this._maybeGetValueOrOverrideExpression(A,"StrokeColor"));const j=F??this._getValueOrOverrideExpression(d.type,v,"Color",R),Y=X??this._getValueOrOverrideExpression(d.type,v,"Color",T),W=this._maybeGetValueOrOverrideExpression(A,"StrokeWidth")??this._getValueOrOverrideExpression(d.type,v,"Width",O),D=V?{type:"sprite-rasterization-param",resource:{type:"path",path:V,asFill:E},overrides:[]}:{type:"sprite-rasterization-param",resource:L,overrides:[]},U=n(this._poMap,d,p),H=N(e.size,g.CIMVectorMarker.size),B=this._getValueOrOverrideExpression(e.type,e.primitiveName,"Size",H);this._cimLayers.push({type:"marker",name:d.name,groupName:e.name,spriteRasterizationParam:D,colorLocked:!!d.colorLocked||!!c,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:_,y:M},isAbsoluteAnchorPoint:u,size:m,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:"cim-marker-transform-param",params:l},frameHeight:m,widthRatio:b,rotateClockwise:!1,referenceSize:s,sizeRatio:S,color:j,outlineColor:Y,outlineWidth:W,isOutline:y,markerPlacement:r,animationParams:le(U),isStroke:"CIMSolidFill"!==d.type,baseSize:B,...x(o,I,P)});break}case"CIMPictureMarker":case"CIMVectorMarker":if(d.markerPlacement){K().error("Error analyzing CIM, got unexpected marker placement");break}this._analyzeMarker(d,t,r,o,a,s,!1,l,p,c,y)}v&&o.pop()}}_analyzeTextGraphic(e,r,i,o,a,s,l,n){const p=[];_.findApplicableOverrides(i,this._primitiveOverrides,p);const m=i.geometry;if(!("x"in m)||!("y"in m))return;const c=i.symbol,y=F(c),d=X(c.fontStyleName),f=t(c.fontFamilyName);c.font={family:f,decoration:y,...d};const h=N(c.height,g.CIMTextSymbol.height),u=N(c.angle),v=N(c.offsetX),O=N(c.offsetY),{haloSymbol:S}=c,k=N(c.haloSize,0);let C=[0,0,0,0];if(S?.symbolLayers?.length){const e=S.symbolLayers;for(const t of e)if(t.color){C=this._getValueOrOverrideExpression(c?.haloSymbol?.type??"CIMPolygonSymbol",t.primitiveName,"Color",z(t.color));break}}const x=i.primitiveName;let b=[0,0,0,1],P=[0,0,0,0],I=0,E=!1;if(c.symbol?.symbolLayers)for(const t of c.symbol.symbolLayers){const e=t.primitiveName;if("CIMSolidStroke"===t.type)P=this._getValueOrOverrideExpression("CIMSolidStroke",e,"Color",z(t.color)),I=this._getValueOrOverrideExpression("CIMSolidStroke",e,"Width",j(t)??0);else if("CIMSolidFill"===t.type){const r=z(t.color);E=E??!!t.colorLocked,b=this._getValueOrOverrideExpression("CIMSolidFill",e??x,"Color",r)}}let L=null,V=null,R=null,T=null,A=null;x&&(L=this._maybeGetValueOrOverrideExpression(x,"TextSize"),V=this._maybeGetValueOrOverrideExpression(x,"TextAngle"),R=this._maybeGetValueOrOverrideExpression(x,"TextOffsetX"),T=this._maybeGetValueOrOverrideExpression(x,"TextOffsetY"),E||(A=this._maybeGetValueOrOverrideExpression(x,"FillColor")));const w=A??b;let G=null,D=null,U=0;if("CIMBackgroundCallout"===c.callout?.type){const e=c.callout;if(e.backgroundSymbol){const t=e.backgroundSymbol.symbolLayers;if(t)for(const e of t)"CIMSolidFill"===e.type?G=z(e.color):"CIMSolidStroke"===e.type&&(D=z(e.color),U=N(e.width,g.CIMSolidStroke.width))}}const H=this._getValueOrOverrideExpression(c.type,i.primitiveName,"TextString",i.textString??"");if(null==H)return;const{fontStyleName:J}=c,B=f+(J?"-"+J.toLowerCase():"-regular"),q=this._getMaterialOverrides(o,c.type);q.push(...this._getPrimitiveMaterialOverrides(i.primitiveName,c.type)),this._collectDictionaryTemplateOverrides(q,i);const K={type:"text-rasterization-param",resource:{type:"text",textString:i.textString??"",font:c.font,symbol:c,primitiveName:i.primitiveName,supportsRichText:M(i.textString??"")||q.some(e=>"textString"===e.propertyName)},overrides:q};this._cimLayers.push({type:"text",lineWidth:c.lineWidth,textRasterizationParam:K,colorLocked:!!n||!!E,effects:e,alignment:a,anchorPoint:{x:0,y:0},isAbsoluteAnchorPoint:!1,fontName:B,decoration:y,haloSize:k,haloColor:C,weight:d.weight,style:d.style,size:L??h,angle:V??u,offsetX:R??v,offsetY:T??O,transform:{type:"cim-marker-transform-param",params:l},horizontalAlignment:W(c.horizontalAlignment),verticalAlignment:Y(c.verticalAlignment),text:H,color:w,outlineColor:P,outlineSize:I,backgroundColor:G,borderLineColor:D,borderLineWidth:U,referenceSize:s,sizeRatio:1,markerPlacement:r})}_collectDictionaryTemplateOverrides(e,t){if(t.textString&&this._hasTextStringTemplates){const r=D(t.symbol);e.push({propertyName:"textString",defaultValue:"",valueExpressionInfo:{type:"dictionary-template",textCase:r,template:t.textString},primitiveName:t.primitiveName})}}_analyzeMultiLayerGraphicNonSDF(e,t,r,i,a,s,l,n,p,m,c,y){const d=$(e,i),f=e.primitiveName,h=this._analyzeMaterialOverrides(f,["Rotation","OffsetX","OffsetY"]),u=R(h),[O,S,_]=v.getTextureAnchor(d,this._resourceManager,B),M=this._getMaterialOverrides(a,e.type).filter(e=>e.primitiveName!==f||!["rotation","offsetX","offsetY"].includes(e.propertyName));M.push(...u);const k={type:"sprite-rasterization-param",resource:{...d,avoidSDFRasterization:!0},overrides:M},C=N(e.size,g.CIMVectorMarker.size),x=this._getValueOrOverrideExpression(e.type,f,"Size",C);this._cimLayers.push({type:"marker",name:e.name,spriteRasterizationParam:k,colorLocked:c,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:s,anchorPoint:{x:O,y:S},isAbsoluteAnchorPoint:!1,size:m,rotation:0,offsetX:0,offsetY:0,transform:{type:"cim-marker-transform-param",params:n},color:[255,255,255,1],outlineColor:[0,0,0,0],outlineWidth:0,scaleX:1,frameHeight:m,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:l,sizeRatio:_/o(e.size),isOutline:y,markerPlacement:r,animationParams:le(p),baseSize:x})}_createMarkerPlacementOverrideExpression(e){if(!e)return null;const t=[];return _.findApplicableOverrides(e,this._primitiveOverrides,t),{type:"cim-marker-placement-param",placement:e,overrides:se(t)}}_createGIFAnimatedSymbolPropertiesOverrideExpression(e){if(!e)return null;const t=[];return _.findApplicableOverrides(e,this._primitiveOverrides,t),{type:"cim-gif-animation-params",animation:e,overrides:se(t)}}_analyzeCompositeMarkerGraphic(e,t,r,i,o,a,s,l,n,p,m){const c=i.geometry,y=o[0],d=o[1],f=k(c);if(!f)return;const h="Relative"!==e.anchorPointUnits,u=N(y.width,g.CIMSolidStroke.width),{frameSizeRatio:v,anchorX:O,anchorY:S,widthRatio:_,sdfPaddingRatio:M,sdfTextureSize:x}=C(f,e.frame,e.size,e.anchorPoint,h,u,e.scaleSymbolsProportionally),{path:b}=d,P=d.primitiveName,I=y.primitiveName,E=i.primitiveName;let L=null;d.colorLocked||p||(L=this._maybeGetValueOrOverrideExpression(E,"FillColor"));const V=L??this._getValueOrOverrideExpression(d.type,P,"Color",z(d.color));let R=null;y.colorLocked||p||(R=this._maybeGetValueOrOverrideExpression(E,"StrokeColor"));const T=R??this._getValueOrOverrideExpression(y.type,I,"Color",z(y.color)),A=this._maybeGetValueOrOverrideExpression(E,"StrokeWidth")??this._getValueOrOverrideExpression(y.type,I,"Width",u),w={type:"sprite-rasterization-param",resource:b?{type:"path",path:b,asFill:!0}:{type:"sdf",geometry:c,sdfTextureSize:x,sdfPaddingRatio:M,asFill:!0},overrides:[]};this._cimLayers.push({type:"marker",name:e.name,spriteRasterizationParam:w,colorLocked:p,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:O,y:S},isAbsoluteAnchorPoint:h,size:n,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:"cim-marker-transform-param",params:l},frameHeight:n,widthRatio:_,rotateClockwise:!1,referenceSize:s,sizeRatio:v,color:V,outlineColor:T,outlineWidth:A,isOutline:m,markerPlacement:r})}_setPoMap(e,t,r){let i;this._poMap[e]?i=this._poMap[e]:(i={},this._poMap[e]=i),i[t]=r}_maybeGetValueOrOverrideExpression(e,t,r){return this._getValueOrOverrideExpression("",e,t,r,!1)}_getValueOrOverrideExpression(e,t,r,i,o=!0){if(o&&!U(i)&&(i=T(e,r.toLowerCase())),null==t)return i;const a=this._poMap[t];if(null==a)return i;const s=a[r];return"string"==typeof s||"number"==typeof s||Array.isArray(s)?s:s?{valueExpressionInfo:s,defaultValue:i}:i}_analyzePrimitiveOverrides(e,t,r,i){if(null==e)return!1;"string"==typeof e&&(e=[e]);for(const o of this._primitiveOverrides)if(e.includes(o.primitiveName)&&o.valueExpressionInfo)return!0;if(null!=t)for(const o of t)if(o?.overrides.length>0)return!0;if(null!=r)for(const o of r)if(o?.overrides.length>0)return!0;if(null!=i)for(const o of i)if(o?.overrides.length>0)return!0;return!1}_getMaterialOverrides(e,t){if(!e)return[];const r=[];for(const i of e)r.push(...this._getPrimitiveMaterialOverrides(i,t));return r}_getPrimitiveMaterialOverrides(e,t){if(!e)return[];const r=R(this._primitiveOverrides.filter(t=>t.primitiveName===e));return r.forEach(e=>e.defaultValue=T(t,e.propertyName.toLowerCase())),r}_analyzeMaterialOverrides(e,t){return this._primitiveOverrides.filter(r=>r.primitiveName!==e||!t.includes(r.propertyName))}}function $(e,t){return{type:e.type,enable:!0,name:e.name,colorLocked:e.colorLocked,primitiveName:e.primitiveName,anchorPoint:e.anchorPoint,anchorPointUnits:e.anchorPointUnits,offsetX:0,offsetY:0,rotateClockwise:e.rotateClockwise,rotation:0,size:e.size,billboardMode3D:e.billboardMode3D,depth3D:e.depth3D,frame:e.frame,markerGraphics:[t],scaleSymbolsProportionally:e.scaleSymbolsProportionally,respectFrame:e.respectFrame,clippingPath:e.clippingPath}}function ee(e){if(e?.startsWith("Level_")){const t=parseInt(e.slice(6),10);if(!isNaN(t))return t}return 0}function te(e,t){if(!t||0===t.length)return e;const i=r(e);return _.applyOverrides(i,t),i}const re=e=>e&&2===e.length&&e[0].enable&&e[1].enable&&"CIMSolidStroke"===e[0].type&&"CIMSolidFill"===e[1].type&&null==e[0].path&&null==e[1].path&&!e[0].effects&&!e[1].effects&&!e[0].animations&&!e[1].animations;function ie(e){const t=e.symbolLayers;if(!t)return!1;const r=t.find(e=>e.effects?.find(e=>"CIMGeometricEffectDashes"===e.type&&null!=e.dashTemplate)),i=t.find(e=>e.effects?.find(e=>"CIMGeometricEffectAddControlPoints"===e.type));return!!r||!!i}function oe(e){return e.some(e=>"CIMSolidFill"!==e.type&&"CIMSolidStroke"!==e.type&&("CIMVectorMarker"!==e.type&&"CIMPictureMarker"!==e.type||null!=e.markerPlacement))}function ae(e,t){if(t?.some(e=>"CIMGeometricEffectRadial"===e.type)&&t?.some(e=>"CIMGeometricEffectTaperedPolygon"===e.type)&&2===e.length){const t=e.find(e=>"CIMSolidFill"===e.type),r=e.find(e=>"CIMSolidStroke"===e.type),i=r?.effects?.some(e=>"CIMGeometricEffectDashes"===e.type);if(null!=t&&null!=r&&!i)return!0}return!1}function se(e){return r(e).map(e=>({...e,propertyName:H(e.propertyName)}))}function le(e){return h(e)?{type:"animation-params",params:e}:null}export{Z as CIMAnalyzer,te as analyzeCIMResource};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import t from"../../Color.js";import{fromCIMFontStyle as n}from"./utils.js";const e=/([A-Za-z_][\w-]*)\s*=\s*(['"])(.*?)\2/g,o=/&(amp|lt|gt|quot|apos);/g,r=/<\s*\/?\s*(?:CLR|BOL|_BOL|ITA|_ITA|FNT)\b/i;function i(t){return r.test(t)}function s(t){if(!t.supportsRichText||!t.textString.includes("<"))return null;const n=u(t),e=[],o=[];let r=l(n),i="",s=!1;const c=t.textString,g=()=>{if(!i)return;const t=f(i);if(!t)return void(i="");const n=o[o.length-1];n&&a(n,r)?n.text+=t:o.push({text:t,font:{...r.font},fontSize:r.fontSize,color:r.color}),i=""};let b=0;for(;b<c.length;){const t=c[b];if("<"!==t){i+=t,b++;continue}const n=c.indexOf(">",b+1);if(-1===n)return null;const o=h(c.slice(b+1,n));if(!o)return null;if(s=!0,g(),o.isEnd){const t=e.pop();if(!t||t.name!==o.name)return null;r=t.previous}else{const t=l(r);r=m(r,o),e.push({name:o.name,previous:t})}b=n+1}return e.length?null:(g(),s?o.filter(t=>t.text.length>0):null)}function u(t){return{font:{...t.font},fontSize:t.symbol?.height&&!isNaN(t.symbol.height)?t.symbol.height:10}}function l(t){return{font:{...t.font},fontSize:t.fontSize,color:t.color}}function a(t,n){return t.fontSize===n.fontSize&&t.font.family===n.font.family&&t.font.style===n.font.style&&t.font.weight===n.font.weight&&c(t.color,n.color)}function c(t,n){return t===n||!!t&&!!n&&t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]&&t[3]===n[3]}function f(t){return t.replaceAll(o,(t,n)=>{switch(n){case"amp":return"&";case"lt":return"<";case"gt":return">";case"quot":return'"';case"apos":return"'";default:return t}})}function h(t){const n=t.trim();if(!n)return null;const o=n.startsWith("/"),r=o?n.slice(1).trim():n,i=/^([A-Za-z_][\w-]*)/.exec(r);if(!i)return null;const s=i[1],u=r.slice(s.length),l={};let a;for(e.lastIndex=0;a=e.exec(u);)l[a[1]]=a[3];return{isEnd:o,name:s,attributes:l}}function m(t,n){const e=l(t);switch(n.name.toUpperCase()){case"BOL":e.font.weight="bold";break;case"_BOL":e.font.weight="normal";break;case"ITA":e.font.style="italic";break;case"_ITA":e.font.style="normal";break;case"FNT":g(e,n.attributes);break;case"CLR":e.color=b(n.attributes)}return e}function g(t,e){const{name:o,style:r,size:i,scale:s,wght:u,ital:l}=e;if(o&&(t.font.family=o),r){const e=n(r);t.font.style=e.style,t.font.weight=e.weight}if(u){const n=Number(u);t.font.weight=n>=600?"bold":"normal"}if(l){const n=Number(l);isNaN(n)||(t.font.style=0!==n?"italic":"normal")}if(i){const n=Number(i);!isNaN(n)&&n>0&&(t.fontSize=n)}if(s){const n=Number(s);!isNaN(n)&&n>0&&(t.fontSize*=n/100)}}function b(n){if(n.hex){const e=t.fromHex(n.hex)?.toArray();if(e){const t="alpha"in n?y(n.alpha):e[3];return[e[0],e[1],e[2],t]}}if("red"in n||"green"in n||"blue"in n)return[p(n.red),p(n.green),p(n.blue),y(n.alpha)];const e=N(n.cyan),o=N(n.magenta),r=N(n.yellow),i=N(n.black),s=y(n.alpha),u=N(n.tint,100)/100,l=1-i;return[Math.round(255*(1-e)*l*u),Math.round(255*(1-o)*l*u),Math.round(255*(1-r)*l*u),s]}function p(t){const n=Number(t);return d(isNaN(n)?0:n)}function N(t,n=0){const e=Number(t);return x((isNaN(e)?n:e)/100)}function y(t){return Math.round(255*N(t,100))}function d(t){return Math.max(0,Math.min(255,Math.round(t)))}function x(t){return Math.max(0,Math.min(1,t))}export{i as hasRichTextFormattingTags,s as parseRichTextRuns};
@@ -9,10 +9,15 @@ export default class ObjectSymbol3DLayerResource extends JSONSupport {
9
9
  /** @since 5.0 */
10
10
  constructor(properties?: ObjectSymbol3DLayerResourceProperties);
11
11
  /**
12
- * The URL to the 3D model in [glTF format](https://www.khronos.org/gltf/).
13
- * The URL should point to a glTF file (.gltf or .glb)
14
- * which can reference additional binary (.bin) and image files (.jpg, .png). See the guide topic on
15
- * [Visualizing points with 3D symbols](https://developers.arcgis.com/javascript/latest/visualizing-points-3d/) to learn how to use a custom 3D model.
12
+ * The URL to the 3D model in [glTF format](https://www.khronos.org/gltf/). The URL should point to a glTF file (.gltf
13
+ * or .glb) which can reference additional binary (.bin) and image files (.jpg, .png). See the guide topic on
14
+ * [Visualizing points with 3D symbols](https://developers.arcgis.com/javascript/latest/visualizing-points-3d/) to
15
+ * learn how to use a custom 3D model.
16
+ *
17
+ * See [Supported GLTF features](https://developers.arcgis.com/javascript/latest/references/core/geometry/support/meshUtils/#supported-gltf-features)
18
+ * in the meshUtils documentation for details about which glTF extensions are currently supported.
19
+ * In addition for [ObjectSymbol3DLayer](https://developers.arcgis.com/javascript/latest/references/core/symbols/ObjectSymbol3DLayer/) the [MSFT_lod](https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Vendor/MSFT_lod)
20
+ * extension can be used to provide models with multiple levels of details.
16
21
  *
17
22
  * @since 5.0
18
23
  */
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import s from"../../../../Graphic.js";import t from"../../../../core/Accessor.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{formatArea as i}from"../../../../core/quantityFormatUtils.js";import{initial as a}from"../../../../core/reactiveUtils.js";import{property as o,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as n}from"../../../../core/support/UpdatingHandles.js";import{onLocaleChange as m}from"../../../../intl/locale.js";import{fetchMessageBundle as p}from"../../../../intl/messages.js";import h from"../../../../layers/GraphicsLayer.js";import{getAreaMeasurementFillSymbol as u,getAreaMeasurementOutlineSymbol as c,getAreaMeasurementTextSymbol as d}from"./utils.js";let g=class extends t{get _messages(){return this._messagesTask?.value}constructor(e){super(e),this._graphicsLayer=new h({listMode:"hide",internal:!0}),this._updatingHandles=new n}initialize(){this.view.map?.add(this._graphicsLayer),this.addHandles(m(()=>this._updateMessageBundle())),this._updatingHandles.add(()=>({accentColor:this.view.effectiveTheme.accentColor,area:this.measurementViewData.result?.area,fill:this.measurementViewData.result?.display.fill,messages:this._messages,outline:this.measurementViewData.result?.display.outline,textColor:this.view.effectiveTheme.textColor,unit:this.measurementViewData.unit,visible:this.measurementViewData.visible}),({accentColor:e,area:t,fill:r,messages:a,outline:o,textColor:l,unit:n,visible:m},p)=>{if(this._graphicsLayer.visible=m,!m)return;if(!(t&&r&&a&&o))return void this._graphicsLayer.graphics.destroyAll();const h=a&&t?i(a,t,n):null;if(3===this._graphicsLayer.graphics.length&&e.equals(p?.accentColor)&&l.equals(p?.textColor)){const[e,s,t]=this._graphicsLayer.graphics.toArray();return e.geometry=r,s.geometry=o,t.setAttribute("areaText",h),void(t.geometry=r)}this._graphicsLayer.graphics.destroyAll(),this._graphicsLayer.addMany([new s({geometry:r,symbol:u(e)}),new s({geometry:o,symbol:c(e)}),new s({attributes:{areaText:h},geometry:r,symbol:d(l)})])},a),this._updateMessageBundle()}destroy(){this._graphicsLayer.removeFromParent(),this._graphicsLayer.graphics.destroyAll(),this._graphicsLayer.destroy(),this._updatingHandles.destroy()}get updating(){return!this._graphicsLayer.loaded||!this._messagesTask?.finished||this._updatingHandles.updating}_updateMessageBundle(){return this._messagesTask?.abort(),this._messagesTask=r(()=>p("esri/core/t9n/Units")),this._messagesTask.promise}};e([o()],g.prototype,"_messages",null),e([o()],g.prototype,"_messagesTask",void 0),e([o()],g.prototype,"measurementViewData",void 0),e([o()],g.prototype,"updating",null),e([o()],g.prototype,"view",void 0),g=e([l("esri.views.2d.analysis.AreaMeasurement.AreaMeasurementAreaVisualization")],g);export{g as AreaMeasurementAreaVisualization};
2
+ import{__decorate as e}from"tslib";import s from"../../../../Graphic.js";import t from"../../../../core/Accessor.js";import{createTask as i}from"../../../../core/asyncUtils.js";import{formatArea as r}from"../../../../core/quantityFormatUtils.js";import{initial as a}from"../../../../core/reactiveUtils.js";import{property as o,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as n}from"../../../../core/support/UpdatingHandles.js";import p from"../../../../geometry/Polyline.js";import{onLocaleChange as h}from"../../../../intl/locale.js";import{fetchMessageBundle as m}from"../../../../intl/messages.js";import u from"../../../../layers/GraphicsLayer.js";import{getAreaMeasurementFillSymbol as c,getAreaMeasurementOutlineSymbol as g,getAreaMeasurementTextSymbol as d}from"./utils.js";let y=class extends t{get _messages(){return this._messagesTask?.value}constructor(e){super(e),this._graphicsLayer=new u({listMode:"hide",internal:!0}),this._updatingHandles=new n,this._previewOutlineGraphic=null}initialize(){this.view.map?.add(this._graphicsLayer),this.addHandles(h(()=>this._updateMessageBundle())),this._updatingHandles.add(()=>({accentColor:this.view.effectiveTheme.accentColor,area:this.measurementViewData.result?.area,fill:this.measurementViewData.result?.display.fill,geometry:this.measurementViewData.analysis.geometry,messages:this._messages,outline:this.measurementViewData.result?.display.outline,textColor:this.view.effectiveTheme.textColor,unit:this.measurementViewData.unit,visible:this.measurementViewData.visible}),({accentColor:e,area:t,fill:i,geometry:a,messages:o,outline:l,textColor:n,unit:p,visible:h},m)=>{if(this._graphicsLayer.visible=h,!h)return;if(!(t&&i&&o&&l))return void this._updatePreviewOutline(a,e);const u=o&&t?r(o,t,p):null;if(3===this._graphicsLayer.graphics.length&&e.equals(m?.accentColor)&&n.equals(m?.textColor)){const[e,s,t]=this._graphicsLayer.graphics.toArray();return e.geometry=i,s.geometry=l,t.setAttribute("areaText",u),void(t.geometry=i)}this._previewOutlineGraphic=null,this._graphicsLayer.graphics.destroyAll(),this._graphicsLayer.addMany([new s({geometry:i,symbol:c(e)}),new s({geometry:l,symbol:g(e)}),new s({attributes:{areaText:u},geometry:i,symbol:d(n)})])},a),this._updateMessageBundle()}destroy(){this._graphicsLayer.removeFromParent(),this._graphicsLayer.graphics.destroyAll(),this._graphicsLayer.destroy(),this._updatingHandles.destroy(),this._previewOutlineGraphic=null}get updating(){return!this._graphicsLayer.loaded||!this._messagesTask?.finished||this._updatingHandles.updating}_updateMessageBundle(){return this._messagesTask?.abort(),this._messagesTask=i(()=>m("esri/core/t9n/Units")),this._messagesTask.promise}_updatePreviewOutline(e,t){const i=e?.rings.some(e=>e.length>0)?new p({paths:e.rings,spatialReference:e.spatialReference}):null;if(!i)return this._previewOutlineGraphic=null,void this._graphicsLayer.graphics.destroyAll();const r=g(t);if(this._previewOutlineGraphic)return this._previewOutlineGraphic.geometry=i,void(this._previewOutlineGraphic.symbol=r);this._graphicsLayer.graphics.destroyAll(),this._previewOutlineGraphic=new s({geometry:i,symbol:r}),this._graphicsLayer.add(this._previewOutlineGraphic)}};e([o()],y.prototype,"_messages",null),e([o()],y.prototype,"_messagesTask",void 0),e([o()],y.prototype,"measurementViewData",void 0),e([o()],y.prototype,"updating",null),e([o()],y.prototype,"view",void 0),y=e([l("esri.views.2d.analysis.AreaMeasurement.AreaMeasurementAreaVisualization")],y);export{y as AreaMeasurementAreaVisualization};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{multiplyOpacity as i}from"../../../../core/colorUtils.js";import{makeHandle as s}from"../../../../core/handleUtils.js";import{isAborted as a,ignoreAbortErrors as r}from"../../../../core/promiseUtils.js";import{watch as o,initial as n}from"../../../../core/reactiveUtils.js";import{property as l,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as c}from"../../../../core/support/UpdatingHandles.js";import p from"../../../../symbols/SimpleFillSymbol.js";import m from"../../../../symbols/SimpleLineSymbol.js";import{ExclusiveOperationManager as d}from"../../../analysis/ExclusiveOperationManager.js";import u from"../../../../widgets/Sketch/SketchViewModel.js";function y(e){return"polygon"===e?.type}let w=class extends t{constructor(e){super(e),this._invisibleAreaSymbol=new p({color:null,outline:null}),this._operationManager=new d,this._updatingHandles=new c}initialize(){this._sketchViewModel=new u({defaultCreateOptions:{mode:"click"},defaultUpdateOptions:{enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,enableZ:!1,highlightOptions:{enabled:!1},multipleSelectionEnabled:!1,reshapeOptions:{edgeOperation:"none",shapeOperation:"none"},toggleToolOnClick:!1,tool:"reshape"},updateOnGraphicClick:!1,cancelUpdateOnClickAway:!1,view:this.view}),this.addHandles([o(()=>({interactive:this.measurementViewData.interactive,visible:this.measurementViewData.visible}),({interactive:e,visible:t})=>{t&&e&&this._analysis.geometry?"place"!==this._operationManager.currentOperationType&&this.reshape().catch(()=>{}):this._operationManager.stop()}),o(()=>this.measurementViewData.analysis.geometry,e=>{e||(this._operationManager.stop(),this._sketchViewModel?.cancel(),this.measurementViewData.sketchGraphicsLayer?.removeAll())}),o(()=>this.measurementViewData.snappingOptions,e=>{this._sketchViewModel&&(this._sketchViewModel.snappingOptions=e)},n),o(()=>this.view.effectiveTheme.accentColor,e=>{this._areaSymbol=new p({color:i(e,.3),outline:new m({color:e,width:2})})},n)])}destroy(){this._areaSymbol?.destroy(),this._invisibleAreaSymbol.destroy(),this._operationManager.destroy(),this._sketchViewModel?.destroy(),this._updatingHandles.destroy()}get state(){if(!this.measurementViewData.visible||!this._operationManager.currentOperationType)return"idle";switch(this._operationManager.currentOperationType){case"place":return"placing";case"reshape":return"reshaping"}}get updating(){return!this._sketchViewModel||this._sketchViewModel.updating||this._updatingHandles.updating}async place(e){return this._operationManager.start("place",async t=>{if(!this._sketchViewModel||!this.measurementViewData.sketchGraphicsLayer)return;const i=this._analysis.clone(),o=e=>{const i="state"in e?e.state:"active",s="graphic"in e?e.graphic:e.graphics?.at(0);switch(i){case"start":case"active":{const e=s?.geometry;"polygon"===e?.type&&(this._analysis.geometry=e);break}case"cancel":case"complete":t.stop(),this.reshape().catch(()=>{})}},n=this._sketchViewModel.on(["create","undo","redo"],o);t.handles.push(n,s(()=>{n.remove(),this._sketchViewModel?.cancel(),this.measurementViewData.sketchGraphicsLayer?.removeAll();const s=this._analysis;return s.valid?a(e)||i.equals(s)?t.reject():void t.resolve({}):(s.clear(),t.reject())})),this._sketchViewModel.polygonSymbol=this._invisibleAreaSymbol,this._sketchViewModel.layer=this.measurementViewData.sketchGraphicsLayer,this._updatingHandles.consumePromise(r(this._sketchViewModel.create("polygon")))},e)}async reshape(e){return this._operationManager.start("reshape",async t=>{if(!this._sketchViewModel)return;const i=()=>this._areaSymbol&&this._sketchViewModel&&this.measurementViewData.manipulatorGraphic&&this.measurementViewData.manipulatorGraphicsLayer?(this._sketchViewModel.polygonSymbol=this._areaSymbol,this._sketchViewModel.layer=this.measurementViewData.manipulatorGraphicsLayer,this._updatingHandles.addPromise(r(this._sketchViewModel.update(this.measurementViewData.manipulatorGraphic,{tool:"reshape"})))):Promise.resolve(),o=this._sketchViewModel.on("update",e=>{const s=e.graphics[0]?.geometry;this._analysis.geometry=y(s)?s:null,"complete"===e.state&&(this.measurementViewData.interactive?i():t.stop())});t.handles.push(o,s(()=>{if(o.remove(),this._sketchViewModel?.cancel(),a(e))return t.reject();t.resolve()})),await i()},e)}get _analysis(){return this.measurementViewData.analysis}};e([l()],w.prototype,"_sketchViewModel",void 0),e([l()],w.prototype,"measurementViewData",void 0),e([l()],w.prototype,"state",null),e([l()],w.prototype,"updating",null),e([l()],w.prototype,"view",void 0),w=e([h("esri.views.2d.analysis.AreaMeasurement.AreaMeasurementTool")],w);export{w as AreaMeasurementTool};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{multiplyOpacity as i}from"../../../../core/colorUtils.js";import{makeHandle as s}from"../../../../core/handleUtils.js";import{isAborted as a,ignoreAbortErrors as o}from"../../../../core/promiseUtils.js";import{watch as r,initial as n}from"../../../../core/reactiveUtils.js";import{property as l,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as c}from"../../../../core/support/UpdatingHandles.js";import p from"../../../../symbols/SimpleFillSymbol.js";import m from"../../../../symbols/SimpleLineSymbol.js";import{ExclusiveOperationManager as d}from"../../../analysis/ExclusiveOperationManager.js";import u from"../../../../widgets/Sketch/SketchViewModel.js";function y(e){return"polygon"===e?.type}let w=class extends t{constructor(e){super(e),this._invisibleAreaSymbol=new p({color:null,outline:null}),this._invisibleLineSymbol=new m({color:null,width:0}),this._operationManager=new d,this._updatingHandles=new c}initialize(){this._sketchViewModel=new u({defaultCreateOptions:{mode:"click"},defaultUpdateOptions:{enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,enableZ:!1,highlightOptions:{enabled:!1},multipleSelectionEnabled:!1,reshapeOptions:{edgeOperation:"none",shapeOperation:"none"},toggleToolOnClick:!1,tool:"reshape"},updateOnGraphicClick:!1,cancelUpdateOnClickAway:!1,view:this.view}),this.addHandles([r(()=>({interactive:this.measurementViewData.interactive,visible:this.measurementViewData.visible}),({interactive:e,visible:t})=>{t&&e&&this._analysis.geometry?"place"!==this._operationManager.currentOperationType&&this.reshape().catch(()=>{}):this._operationManager.stop()}),r(()=>this.measurementViewData.analysis.geometry,e=>{e||(this._operationManager.stop(),this._sketchViewModel?.cancel(),this.measurementViewData.sketchGraphicsLayer?.removeAll())}),r(()=>this.measurementViewData.snappingOptions,e=>{this._sketchViewModel&&(this._sketchViewModel.snappingOptions=e)},n),r(()=>this.view.effectiveTheme.accentColor,e=>{this._areaSymbol=new p({color:i(e,.3),outline:new m({color:e,width:2})})},n)])}destroy(){this._areaSymbol?.destroy(),this._invisibleAreaSymbol.destroy(),this._invisibleLineSymbol.destroy(),this._operationManager.destroy(),this._sketchViewModel?.destroy(),this._updatingHandles.destroy()}get state(){if(!this.measurementViewData.visible||!this._operationManager.currentOperationType)return"idle";switch(this._operationManager.currentOperationType){case"place":return"placing";case"reshape":return"reshaping"}}get updating(){return!this._sketchViewModel||this._sketchViewModel.updating||this._updatingHandles.updating}async place(e){return this._operationManager.start("place",async t=>{if(!this._sketchViewModel||!this.measurementViewData.sketchGraphicsLayer)return;const i=this._analysis.clone(),r=e=>{const i="state"in e?e.state:"active",s="graphic"in e?e.graphic:e.graphics?.at(0);switch(i){case"start":case"active":{const e=s?.geometry;"polygon"===e?.type&&(this._analysis.geometry=e);break}case"cancel":case"complete":t.stop(),o(this.reshape())}},n=this._sketchViewModel.on(["create","undo","redo"],r);t.handles.push(n,s(()=>{n.remove(),this._sketchViewModel?.cancel(),this.measurementViewData.sketchGraphicsLayer?.removeAll();const s=this._analysis;return s.valid?a(e)||i.equals(s)?t.reject():void t.resolve({}):(s.clear(),t.reject())})),this._sketchViewModel.activeLineSymbol=this._invisibleLineSymbol,this._sketchViewModel.polygonSymbol=this._invisibleAreaSymbol,this._sketchViewModel.layer=this.measurementViewData.sketchGraphicsLayer,this._updatingHandles.consumePromise(o(this._sketchViewModel.create("polygon")))},e)}async reshape(e){return this._operationManager.start("reshape",async t=>{if(!this._sketchViewModel)return;const i=()=>this._areaSymbol&&this._sketchViewModel&&this.measurementViewData.manipulatorGraphic&&this.measurementViewData.manipulatorGraphicsLayer?(this._sketchViewModel.activeLineSymbol=null,this._sketchViewModel.polygonSymbol=this._areaSymbol,this._sketchViewModel.layer=this.measurementViewData.manipulatorGraphicsLayer,this._updatingHandles.addPromise(o(this._sketchViewModel.update(this.measurementViewData.manipulatorGraphic,{tool:"reshape"})))):Promise.resolve(),r=this._sketchViewModel.on("update",e=>{const s=e.graphics[0]?.geometry;this._analysis.geometry=y(s)?s:null,"complete"===e.state&&(this.measurementViewData.interactive?i():t.stop())});t.handles.push(r,s(()=>{if(r.remove(),this._sketchViewModel?.cancel(),a(e))return t.reject();t.resolve()})),await i()},e)}get _analysis(){return this.measurementViewData.analysis}};e([l()],w.prototype,"_sketchViewModel",void 0),e([l()],w.prototype,"measurementViewData",void 0),e([l()],w.prototype,"state",null),e([l()],w.prototype,"updating",null),e([l()],w.prototype,"view",void 0),w=e([h("esri.views.2d.analysis.AreaMeasurement.AreaMeasurementTool")],w);export{w as AreaMeasurementTool};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{multiplyOpacity as i}from"../../../../core/colorUtils.js";import{makeHandle as s}from"../../../../core/handleUtils.js";import{isAborted as a,ignoreAbortErrors as r}from"../../../../core/promiseUtils.js";import{watch as o,initial as n}from"../../../../core/reactiveUtils.js";import{property as l,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as c}from"../../../../core/support/UpdatingHandles.js";import p from"../../../../symbols/SimpleLineSymbol.js";import{ExclusiveOperationManager as m}from"../../../analysis/ExclusiveOperationManager.js";import d from"../../../../widgets/Sketch/SketchViewModel.js";function u(e){return"polyline"===e?.type}let y=class extends t{constructor(e){super(e),this._invisibleLineSymbol=new p({color:null,width:0}),this._operationManager=new m,this._updatingHandles=new c}initialize(){this._sketchViewModel=new d({defaultCreateOptions:{mode:"click"},defaultUpdateOptions:{enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,enableZ:!1,highlightOptions:{enabled:!1},multipleSelectionEnabled:!1,reshapeOptions:{edgeOperation:"none",shapeOperation:"none"},toggleToolOnClick:!1,tool:"reshape"},updateOnGraphicClick:!1,view:this.view}),this.addHandles([o(()=>({interactive:this.measurementViewData.interactive,visible:this.measurementViewData.visible}),({interactive:e,visible:t})=>{t&&e&&this._analysis.geometry?"place"!==this._operationManager.currentOperationType&&this.reshape().catch(()=>{}):this._operationManager.stop()}),o(()=>this.measurementViewData.analysis.geometry,e=>{e||(this._operationManager.stop(),this._sketchViewModel?.cancel(),this.measurementViewData.sketchGraphicsLayer?.removeAll())}),o(()=>this.measurementViewData.snappingOptions,e=>{this._sketchViewModel&&(this._sketchViewModel.snappingOptions=e)},n),o(()=>this.view.effectiveTheme.accentColor,e=>{this._lineSymbol=new p({color:i(e,.3),width:2})},n)])}destroy(){this._invisibleLineSymbol.destroy(),this._lineSymbol?.destroy(),this._operationManager.destroy(),this._sketchViewModel?.destroy(),this._updatingHandles.destroy()}get state(){if(!this.measurementViewData.visible||!this._operationManager.currentOperationType)return"idle";switch(this._operationManager.currentOperationType){case"place":return"placing";case"reshape":return"reshaping"}}get updating(){return!this._sketchViewModel||this._sketchViewModel.updating||this._updatingHandles.updating}async place(e){return this._operationManager.start("place",async t=>{if(!this._sketchViewModel||!this.measurementViewData.sketchGraphicsLayer)return;const i=this._analysis.clone(),o=this._sketchViewModel.on("create",e=>{switch(e.state){case"start":case"active":{const t=e.graphic?.geometry;"polyline"===t?.type&&(this._analysis.geometry=t);break}case"cancel":case"complete":t.stop(),this.reshape().catch(()=>{})}});t.handles.push(o,s(()=>{o.remove(),this._sketchViewModel?.cancel(),this.measurementViewData.sketchGraphicsLayer?.removeAll();const s=this._analysis;return s.valid?a(e)||i.equals(s)?t.reject():void t.resolve({}):(s.clear(),t.reject())})),this._sketchViewModel.polylineSymbol=this._invisibleLineSymbol,this._sketchViewModel.layer=this.measurementViewData.sketchGraphicsLayer,this._updatingHandles.consumePromise(r(this._sketchViewModel.create("polyline")))},e)}async reshape(e){return this._operationManager.start("reshape",async t=>{if(!this._sketchViewModel)return;const i=()=>this._lineSymbol&&this._sketchViewModel&&this.measurementViewData.manipulatorGraphic&&this.measurementViewData.manipulatorGraphicsLayer?(this._sketchViewModel.polylineSymbol=this._lineSymbol,this._sketchViewModel.layer=this.measurementViewData.manipulatorGraphicsLayer,this._updatingHandles.addPromise(r(this._sketchViewModel.update(this.measurementViewData.manipulatorGraphic,{tool:"reshape"})))):Promise.resolve(),o=this._sketchViewModel.on("update",e=>{const s=e.graphics[0]?.geometry;this._analysis.geometry=u(s)?s:null,"complete"===e.state&&(this.measurementViewData.interactive?i():t.stop())});t.handles.push(o,s(()=>{if(o.remove(),this._sketchViewModel?.cancel(),a(e))return t.reject();t.resolve()})),await i()},e)}get _analysis(){return this.measurementViewData.analysis}};e([l()],y.prototype,"_sketchViewModel",void 0),e([l()],y.prototype,"measurementViewData",void 0),e([l()],y.prototype,"state",null),e([l()],y.prototype,"updating",null),e([l()],y.prototype,"view",void 0),y=e([h("esri.views.2d.analysis.DistanceMeasurement.DistanceMeasurementTool")],y);export{y as DistanceMeasurementTool};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{multiplyOpacity as i}from"../../../../core/colorUtils.js";import{makeHandle as s}from"../../../../core/handleUtils.js";import{ignoreAbortErrors as a,isAborted as r}from"../../../../core/promiseUtils.js";import{watch as o,initial as n}from"../../../../core/reactiveUtils.js";import{property as l,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as c}from"../../../../core/support/UpdatingHandles.js";import p from"../../../../symbols/SimpleLineSymbol.js";import{ExclusiveOperationManager as m}from"../../../analysis/ExclusiveOperationManager.js";import d from"../../../../widgets/Sketch/SketchViewModel.js";function u(e){return"polyline"===e?.type}let y=class extends t{constructor(e){super(e),this._invisibleLineSymbol=new p({color:null,width:0}),this._operationManager=new m,this._updatingHandles=new c}initialize(){this._sketchViewModel=new d({defaultCreateOptions:{mode:"click"},defaultUpdateOptions:{enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,enableZ:!1,highlightOptions:{enabled:!1},multipleSelectionEnabled:!1,reshapeOptions:{edgeOperation:"none",shapeOperation:"none"},toggleToolOnClick:!1,tool:"reshape"},updateOnGraphicClick:!1,view:this.view}),this.addHandles([o(()=>({interactive:this.measurementViewData.interactive,visible:this.measurementViewData.visible}),({interactive:e,visible:t})=>{t&&e&&this._analysis.geometry?"place"!==this._operationManager.currentOperationType&&this.reshape().catch(()=>{}):this._operationManager.stop()}),o(()=>this.measurementViewData.analysis.geometry,e=>{e||(this._operationManager.stop(),this._sketchViewModel?.cancel(),this.measurementViewData.sketchGraphicsLayer?.removeAll())}),o(()=>this.measurementViewData.snappingOptions,e=>{this._sketchViewModel&&(this._sketchViewModel.snappingOptions=e)},n),o(()=>this.view.effectiveTheme.accentColor,e=>{this._lineSymbol=new p({color:i(e,.3),width:2})},n)])}destroy(){this._invisibleLineSymbol.destroy(),this._lineSymbol?.destroy(),this._operationManager.destroy(),this._sketchViewModel?.destroy(),this._updatingHandles.destroy()}get state(){if(!this.measurementViewData.visible||!this._operationManager.currentOperationType)return"idle";switch(this._operationManager.currentOperationType){case"place":return"placing";case"reshape":return"reshaping"}}get updating(){return!this._sketchViewModel||this._sketchViewModel.updating||this._updatingHandles.updating}async place(e){return this._operationManager.start("place",async t=>{if(!this._sketchViewModel||!this.measurementViewData.sketchGraphicsLayer)return;const i=this._analysis.clone(),o=this._sketchViewModel.on("create",e=>{switch(e.state){case"start":case"active":{const t=e.graphic?.geometry;"polyline"===t?.type&&(this._analysis.geometry=t);break}case"cancel":case"complete":t.stop(),a(this.reshape())}});t.handles.push(o,s(()=>{o.remove(),this._sketchViewModel?.cancel(),this.measurementViewData.sketchGraphicsLayer?.removeAll();const s=this._analysis;return s.valid?r(e)||i.equals(s)?t.reject():void t.resolve({}):(s.clear(),t.reject())})),this._sketchViewModel.activeLineSymbol=this._invisibleLineSymbol,this._sketchViewModel.polylineSymbol=this._invisibleLineSymbol,this._sketchViewModel.layer=this.measurementViewData.sketchGraphicsLayer,this._updatingHandles.consumePromise(a(this._sketchViewModel.create("polyline")))},e)}async reshape(e){return this._operationManager.start("reshape",async t=>{if(!this._sketchViewModel)return;const i=()=>this._lineSymbol&&this._sketchViewModel&&this.measurementViewData.manipulatorGraphic&&this.measurementViewData.manipulatorGraphicsLayer?(this._sketchViewModel.activeLineSymbol=null,this._sketchViewModel.polylineSymbol=this._lineSymbol,this._sketchViewModel.layer=this.measurementViewData.manipulatorGraphicsLayer,this._updatingHandles.addPromise(a(this._sketchViewModel.update(this.measurementViewData.manipulatorGraphic,{tool:"reshape"})))):Promise.resolve(),o=this._sketchViewModel.on("update",e=>{const s=e.graphics[0]?.geometry;this._analysis.geometry=u(s)?s:null,"complete"===e.state&&(this.measurementViewData.interactive?i():t.stop())});t.handles.push(o,s(()=>{if(o.remove(),this._sketchViewModel?.cancel(),r(e))return t.reject();t.resolve()})),await i()},e)}get _analysis(){return this.measurementViewData.analysis}};e([l()],y.prototype,"_sketchViewModel",void 0),e([l()],y.prototype,"measurementViewData",void 0),e([l()],y.prototype,"state",null),e([l()],y.prototype,"updating",null),e([l()],y.prototype,"view",void 0),y=e([h("esri.views.2d.analysis.DistanceMeasurement.DistanceMeasurementTool")],y);export{y as DistanceMeasurementTool};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../config.js";import t from"../../../../request.js";import i from"../../../../core/Error.js";import{getFullyQualifiedFontName as r}from"../../../../core/fontUtils.js";import has from"../../../../core/has.js";import s from"../../../../core/Logger.js";import{throwIfAborted as a,isAbortError as n}from"../../../../core/promiseUtils.js";import{QueueProcessor as o}from"../../../../core/QueueProcessor.js";import{pt2px as c}from"../../../../core/screenUtils.js";import{numericHash as h}from"../../../../core/string.js";import l from"../../../../symbols/cim/CIMResourceManager.js";import{CIMSymbolHelper as u}from"../../../../symbols/cim/CIMSymbolHelper.js";import p from"../../../../symbols/cim/Rasterizer.js";import{normalizeDashTemplate as m}from"../../../../symbols/cim/utils.js";import{svgSdfTextureInnerSize as d,textureBindingSpriteAtlas as g,textureBindingGlyphAtlas as f}from"./definitions.js";import y from"./GlyphMosaic.js";import M from"./GlyphSource.js";import _ from"./Rect.js";import I from"./SDFConverter.js";import w from"./SpriteMosaic.js";import{discardUrlIfHasUrlHash as S}from"./urlUtils.js";import{getCIMMarkerPlacementHash as z,isSVGImage as T}from"./Utils.js";import{AnimatableTextureResource as C}from"./animatedFormats/AnimatableTextureResource.js";import{AnimationStore as R}from"./animations/store/AnimationStore.js";const x="arial-unicode-ms-regular",b=/[\u0695\u0698\u06a9\u06af\u06b5\u06be\u06c6\u06cc\u06ce\u06d5\u06ca]|\p{Script=Thai}|\p{Script=Lao}|\p{Script=Tamil}|\p{Script=Khmer}/u,P=new Set(["Noto Sans Khmer","Noto Sans Lao","Noto Sans Myanmar","Noto Sans Thai"]),$=()=>s.getLogger("esri.views.MapView"),v=(e,t,r)=>$().error(new i(e,t,r)),j=(e,t="")=>$().warnOnce(e,t);class k{static fromMosaic(e,t){return new k(e,t.page,t.sdf,t.samplingMode)}constructor(e,t,i,r){this.mosaicType=e,this.page=t,this.sdf=i,this.samplingMode=r}}class A{constructor(r){this._requestRender=r,this._resourceManager=new l,this._invalidFonts=new Set,this._sdfConverter=new I(d),this._bindingInfos=new Array,this._hashToBindingIndex=new Map,this._ongoingRasterizations=new Map,this._imageRequestQueue=new o({concurrency:10,process:async(e,r)=>{a(r);try{return await t(e,{responseType:"image",signal:r})}catch(s){if(!n(s))throw new i("mapview-invalid-resource",`Could not fetch requested resource at ${e}`,s);throw s}}}),this.animationStore=new R,this._spriteMosaic=new w(2048,2048,500),this._glyphSource=new M(`${e.fontsUrl}/{fontstack}/{range}.pbf`),this._glyphMosaic=new y(1024,1024,this._glyphSource),this._rasterizer=new p(this.resourceManager)}dispose(){this._spriteMosaic.dispose(),this._glyphMosaic.dispose(),this._rasterizer.dispose(),this._sdfConverter.dispose(),this._spriteMosaic=null,this._glyphMosaic=null,this._sdfConverter=null,this._hashToBindingIndex.clear(),this._hashToBindingIndex=null,this._bindingInfos=null,this._ongoingRasterizations.clear(),this._ongoingRasterizations=null,this._imageRequestQueue.clear(),this._imageRequestQueue=null,this._resourceManager.destroy(),this.animationStore.destroy()}get sprites(){return this._spriteMosaic}get glyphs(){return this._glyphMosaic}get resourceManager(){return this._resourceManager}async rasterizeItem(e,t){if(null==e)return v("mapview-null-resource","Unable to rasterize null resource"),null;if("animation-info"===e.type){const{resource:t}=e,i=this.animationStore.add(t),{location:r}=i;return{rect:new _(r.column,r.row,t.length,1),page:r.page,type:"sprite",width:t.length,height:1,rasterizationScale:1,sdfPaddingRatio:.5,samplingMode:"Linear",sdfDecodeCoeff:1,simplePattern:!1}}if("cim-rasterization-info"!==e.type)return v("mapview-unexpected-resource","Unable to rasterize resource"),null;const{resource:i}=e;if("text"===i.type){const e=await this._rasterizeText(i,t);return e?.glyphs.forEach(e=>this._setTextureBinding(1,e.mosaicItem)),e}const r=await this._rasterizeSprite(i,t);return r&&this._setTextureBinding(0,r),r}getMosaicInfo(e,t,i=!1){const r=this._getTextureBindingInfo(e,t,i);return r?{size:r.size}:(v("mapview-invalid-resource",`Unable to find resource for ${t}`),{size:[0,0]})}getMosaicTexture(e,t,i=!1){const r=this._getTextureBindingInfo(e,t,i);return r?{texture:r.texture,unit:"sprite"===r.type?g:f}:(v("mapview-invalid-resource",`Unable to find resource for ${t}`),null)}_getTextureBindingInfo(e,t,i){const{context:r}=e,s=this._bindingInfos[t-1],a=s.page,n="Nearest"===s.samplingMode?9728:i?9987:9729;switch(s.mosaicType){case 0:{const t=[this.sprites.getWidth(a),this.sprites.getHeight(a)],i=this._spriteMosaic.getTexture(e,a);return i.setSamplingMode(n),{type:"sprite",texture:i,size:t}}case 1:{const e=[this.glyphs.width,this.glyphs.height],t=this._glyphMosaic.getTexture(r,a);return this._glyphMosaic.bind(r,n,a,f),t.setSamplingMode(n),{type:"glyph",texture:t,size:e}}default:return v("mapview-texture-manager",`Cannot handle unknown type ${s.mosaicType}`),null}}_hashMosaic(e,t){return 1|e<<1|(t.sdf?1:0)<<2|("Nearest"===t.samplingMode?1:0)<<3|t.page<<4}_setTextureBinding(e,t){const i=this._hashMosaic(e,t);if(!this._hashToBindingIndex.has(i)){const r=k.fromMosaic(e,t),s=this._bindingInfos.length+1;this._hashToBindingIndex.set(i,s),this._bindingInfos.push(r)}t.textureBinding=this._hashToBindingIndex.get(i)}async _rasterizeText(e,t){const{font:i,textString:s}=e,a=r(i),n=this._invalidFonts.has(a),o=!!has("esri-2d-force-complex-shaping"),c=!!has("esri-2d-complex-shaping")&&b.test(s),h=P.has(i.family),l=o||c||h,u=n?x:a;has("esri-2d-stabilize-glyphs")&&await this._glyphMosaic.preloadASCIIGlyphCache(u).catch(()=>{});let p=await this._glyphMosaic.getGlyphItems(s,l,u,t);return p||(j(`Font ${a} is not available on the web, using "Arial Unicode MS Regular"`),this._invalidFonts.add(a),p=await this._glyphMosaic.getGlyphItems(s,l,x,t)),p}_hashSpriteResource(e){switch(e.type){case"path":return`path:${e.path}.${e.asFill?1:0}`;case"CIMPictureMarker":return`${e.type}:${e.url}:${e.size}:${z(e.markerPlacement)}`;case"CIMPictureFill":return`${e.type}:${e.url}:${e.height}`;case"CIMPictureStroke":return`${e.type}:${e.url}:${e.width}`;case"dash":return`dash:${e.capStyle}.${m(e.dashTemplate).join("")}`;case"sdf":return`sdf:${JSON.stringify(e.geometry)}.${e.sdfTextureSize}.${e.asFill?1:0}`;case"fill-style":return`fill_style:${e.style}`;case"animated":return JSON.stringify(S(e));case"CIMGradientFill":case"CIMGradientStroke":return`gradient:${JSON.stringify(e.colorRamp)}.${e.gradientType}.${e.interval}`;case"CIMHatchFill":case"CIMVectorMarker":return JSON.stringify(e)}}async _rasterizeSprite(e,t){if(!e)return null;const i=h(this._hashSpriteResource(e));if(this._spriteMosaic.has(i))return this._spriteMosaic.getSpriteItem(i);if("url"in e&&e.url&&"animated"!==e.type||"CIMPictureFill"===e.type||"CIMPictureStroke"===e.type||"CIMPictureMarker"===e.type||"CIMVectorMarker"===e.type){const t={type:"CIMPointSymbol",symbolLayers:[e]};await u.normalizeSymbolAndFetchResources(t,this._resourceManager)}switch(e.type){case"CIMPictureMarker":return"CIMMarkerPlacementInsidePolygon"===e.markerPlacement?.type?this._rasterizeJSONResource(i,e):this._handleAsyncResource(i,e,t);case"animated":case"CIMPictureFill":case"CIMPictureStroke":case"path":return this._handleAsyncResource(i,e,t);case"CIMGradientFill":case"CIMGradientStroke":case"CIMHatchFill":case"CIMVectorMarker":case"dash":case"fill-style":case"sdf":return this._rasterizeJSONResource(i,e)}}_rasterizeJSONResource(e,t){const i=this._rasterizer.rasterizeJSONResource(t);if(i){const{size:r,image:s,sdf:a,simplePattern:n,rasterizationScale:o,samplingMode:c,sdfPaddingRatio:h,sdfDecodeCoeff:l}=i;return this._addItemToMosaic(e,r,{type:"static",data:s},F(t),a,n,o,c,h,l)}return null}async _handleAsyncResource(e,t,i){if(this._ongoingRasterizations.has(e))return this._ongoingRasterizations.get(e);let r;return r="path"===t.type?this._handleSVG(t,e,i):this._handleImage(t,e,i),this._ongoingRasterizations.set(e,r),r.finally(()=>this._ongoingRasterizations.delete(e)),r}async _handleSVG(e,t,i){const r=[d,d],{asFill:s}=e,a=await this._sdfConverter.draw(e.path,s,i);return this._addItemToMosaic(t,r,{type:"static",data:new Uint32Array(a.buffer)},!1,!0,!0)}_handleGIFOrPNG(e,t,i){const r=e.url,s=this.resourceManager.getResource(r);if(null==s)return null;const{width:a,height:n}=s;if(s instanceof HTMLImageElement){if("animated"===e.type)return v("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;const i="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:r,sdf:o,image:c}=this._rasterizer.rasterizeImageResource(a,n,s,i);return this._addItemToMosaic(t,r,{type:"static",data:c},F(e),o,!1)}let o,c,h;"animated"===e.type?(o=!1,c={type:"CIMAnimatedSymbolProperties",playAnimation:e.playAnimation,reverseAnimation:e.reverseAnimation,randomizeStartTime:e.randomizeStartTime,randomizeStartSeed:e.randomizeStartSeed,startTimeOffset:e.startTimeOffset,duration:e.duration,repeatType:e.repeatType,repeatDelay:e.repeatDelay},h=e.startGroup||0):(o=F(e),c={type:"CIMAnimatedSymbolProperties",playAnimation:!0},h=0);const l=new C(s,this._requestRender,c,h);return this._addItemToMosaic(t,[l.width,l.height],{type:"animated",data:l},o,!1,!1)}async _handleImage(e,t,r){const s=e.url;if(N(s)||O(s))return this._handleGIFOrPNG(e,t,r);if("animated"===e.type)return v("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;try{let i;const a=this.resourceManager.getResource(s);if(null!=a&&a instanceof HTMLImageElement)i=a;else{const{data:e}=await this._imageRequestQueue.push(s,{...r});i=e}if(T(s))if("width"in e&&"height"in e)i.width=c(e.width),i.height=c(e.height);else if("cim"in e){const t=e;i.width=c(t.width??t.scaleX*t.size),i.height=c(t.size)}if(!i.width||!i.height)return null;const n=i.width,o=i.height,h="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:l,sdf:u,image:p}=this._rasterizer.rasterizeImageResource(n,o,i,h);return this._addItemToMosaic(t,l,{type:"static",data:p},F(e),u,!1)}catch(v){if(!n(v))throw new i("mapview-invalid-resource",`Could not fetch requested resource at ${s}. ${v.message}`);throw v}}_addItemToMosaic(e,t,i,r,s,a,n,o,c,h){return this._spriteMosaic.addSpriteItem(e,t,i,r,s,a,n,o,c,h)}}function F(e){switch(e.type){case"CIMVectorMarker":case"CIMPictureMarker":return U(e);default:return!0}}const G=e=>null!=e&&e.startsWith("data:image/gif"),N=e=>e&&(e.includes(".gif")||G(e)),B=e=>null!=e&&e.startsWith("data:image/png"),O=e=>e&&(e.includes(".png")||B(e)),U=e=>e&&"markerPlacement"in e&&e.markerPlacement&&"CIMMarkerPlacementInsidePolygon"===e.markerPlacement.type;export{A as default};
2
+ import e from"../../../../config.js";import t from"../../../../request.js";import i from"../../../../core/Error.js";import{getFullyQualifiedFontName as s}from"../../../../core/fontUtils.js";import has from"../../../../core/has.js";import r from"../../../../core/Logger.js";import{throwIfAborted as a,isAbortError as n}from"../../../../core/promiseUtils.js";import{QueueProcessor as o}from"../../../../core/QueueProcessor.js";import{pt2px as c}from"../../../../core/screenUtils.js";import{numericHash as l}from"../../../../core/string.js";import h from"../../../../symbols/cim/CIMResourceManager.js";import{CIMSymbolHelper as u}from"../../../../symbols/cim/CIMSymbolHelper.js";import p from"../../../../symbols/cim/Rasterizer.js";import{parseRichTextRuns as m}from"../../../../symbols/cim/richTextUtils.js";import{normalizeDashTemplate as d}from"../../../../symbols/cim/utils.js";import{svgSdfTextureInnerSize as g,textureBindingSpriteAtlas as f,textureBindingGlyphAtlas as y}from"./definitions.js";import _ from"./GlyphMosaic.js";import M from"./GlyphSource.js";import I from"./Rect.js";import w from"./SDFConverter.js";import S from"./SpriteMosaic.js";import{discardUrlIfHasUrlHash as z}from"./urlUtils.js";import{getCIMMarkerPlacementHash as T,isSVGImage as C}from"./Utils.js";import{AnimatableTextureResource as x}from"./animatedFormats/AnimatableTextureResource.js";import{AnimationStore as R}from"./animations/store/AnimationStore.js";const b="arial-unicode-ms-regular",P=/[\u0695\u0698\u06a9\u06af\u06b5\u06be\u06c6\u06cc\u06ce\u06d5\u06ca]|\p{Script=Thai}|\p{Script=Lao}|\p{Script=Tamil}|\p{Script=Khmer}/u,$=new Set(["Noto Sans Khmer","Noto Sans Lao","Noto Sans Myanmar","Noto Sans Thai"]),v=()=>r.getLogger("esri.views.MapView"),j=(e,t,s)=>v().error(new i(e,t,s)),k=(e,t="")=>v().warnOnce(e,t);class G{static fromMosaic(e,t){return new G(e,t.page,t.sdf,t.samplingMode)}constructor(e,t,i,s){this.mosaicType=e,this.page=t,this.sdf=i,this.samplingMode=s}}class A{constructor(s){this._requestRender=s,this._resourceManager=new h,this._invalidFonts=new Set,this._sdfConverter=new w(g),this._bindingInfos=new Array,this._hashToBindingIndex=new Map,this._ongoingRasterizations=new Map,this._imageRequestQueue=new o({concurrency:10,process:async(e,s)=>{a(s);try{return await t(e,{responseType:"image",signal:s})}catch(r){if(!n(r))throw new i("mapview-invalid-resource",`Could not fetch requested resource at ${e}`,r);throw r}}}),this.animationStore=new R,this._spriteMosaic=new S(2048,2048,500),this._glyphSource=new M(`${e.fontsUrl}/{fontstack}/{range}.pbf`),this._glyphMosaic=new _(1024,1024,this._glyphSource),this._rasterizer=new p(this.resourceManager)}dispose(){this._spriteMosaic.dispose(),this._glyphMosaic.dispose(),this._rasterizer.dispose(),this._sdfConverter.dispose(),this._spriteMosaic=null,this._glyphMosaic=null,this._sdfConverter=null,this._hashToBindingIndex.clear(),this._hashToBindingIndex=null,this._bindingInfos=null,this._ongoingRasterizations.clear(),this._ongoingRasterizations=null,this._imageRequestQueue.clear(),this._imageRequestQueue=null,this._resourceManager.destroy(),this.animationStore.destroy()}get sprites(){return this._spriteMosaic}get glyphs(){return this._glyphMosaic}get resourceManager(){return this._resourceManager}async rasterizeItem(e,t){if(null==e)return j("mapview-null-resource","Unable to rasterize null resource"),null;if("animation-info"===e.type){const{resource:t}=e,i=this.animationStore.add(t),{location:s}=i;return{rect:new I(s.column,s.row,t.length,1),page:s.page,type:"sprite",width:t.length,height:1,rasterizationScale:1,sdfPaddingRatio:.5,samplingMode:"Linear",sdfDecodeCoeff:1,simplePattern:!1}}if("cim-rasterization-info"!==e.type)return j("mapview-unexpected-resource","Unable to rasterize resource"),null;const{resource:i}=e;if("text"===i.type){const e=await this._rasterizeText(i,t);return this._forEachGlyphItem(e,e=>this._setTextureBinding(1,e.mosaicItem)),e}const s=await this._rasterizeSprite(i,t);return s&&this._setTextureBinding(0,s),s}getMosaicInfo(e,t,i=!1){const s=this._getTextureBindingInfo(e,t,i);return s?{size:s.size}:(j("mapview-invalid-resource",`Unable to find resource for ${t}`),{size:[0,0]})}getMosaicTexture(e,t,i=!1){const s=this._getTextureBindingInfo(e,t,i);return s?{texture:s.texture,unit:"sprite"===s.type?f:y}:(j("mapview-invalid-resource",`Unable to find resource for ${t}`),null)}_getTextureBindingInfo(e,t,i){const{context:s}=e,r=this._bindingInfos[t-1],a=r.page,n="Nearest"===r.samplingMode?9728:i?9987:9729;switch(r.mosaicType){case 0:{const t=[this.sprites.getWidth(a),this.sprites.getHeight(a)],i=this._spriteMosaic.getTexture(e,a);return i.setSamplingMode(n),{type:"sprite",texture:i,size:t}}case 1:{const e=[this.glyphs.width,this.glyphs.height],t=this._glyphMosaic.getTexture(s,a);return this._glyphMosaic.bind(s,n,a,y),t.setSamplingMode(n),{type:"glyph",texture:t,size:e}}default:return j("mapview-texture-manager",`Cannot handle unknown type ${r.mosaicType}`),null}}_hashMosaic(e,t){return 1|e<<1|(t.sdf?1:0)<<2|("Nearest"===t.samplingMode?1:0)<<3|t.page<<4}_setTextureBinding(e,t){const i=this._hashMosaic(e,t);if(!this._hashToBindingIndex.has(i)){const s=G.fromMosaic(e,t),r=this._bindingInfos.length+1;this._hashToBindingIndex.set(i,r),this._bindingInfos.push(s)}t.textureBinding=this._hashToBindingIndex.get(i)}async _rasterizeText(e,t){const i=e.symbol?m(e):null;if(i){return{type:"rich-glyphs",runs:(await Promise.all(i.map(async e=>({fontSize:e.fontSize,color:e.color,glyphs:await this._getGlyphItems(e.font,e.text,t)})))).filter(e=>null!=e.glyphs)}}return this._getGlyphItems(e.font,e.textString,t)}async _getGlyphItems(e,t,i){const r=s(e),a=this._invalidFonts.has(r),n=!!has("esri-2d-force-complex-shaping"),o=!!has("esri-2d-complex-shaping")&&P.test(t),c=$.has(e.family),l=n||o||c,h=a?b:r;has("esri-2d-stabilize-glyphs")&&await this._glyphMosaic.preloadASCIIGlyphCache(h).catch(()=>{});let u=await this._glyphMosaic.getGlyphItems(t,l,h,i);return u||(k(`Font ${r} is not available on the web, using "Arial Unicode MS Regular"`),this._invalidFonts.add(r),u=await this._glyphMosaic.getGlyphItems(t,l,b,i)),u}_forEachGlyphItem(e,t){if(e)if("glyphs"!==e.type)for(const i of e.runs)i.glyphs.glyphs.forEach(t);else e.glyphs.forEach(t)}_hashSpriteResource(e){switch(e.type){case"path":return`path:${e.path}.${e.asFill?1:0}`;case"CIMPictureMarker":return`${e.type}:${e.url}:${e.size}:${T(e.markerPlacement)}`;case"CIMPictureFill":return`${e.type}:${e.url}:${e.height}`;case"CIMPictureStroke":return`${e.type}:${e.url}:${e.width}`;case"dash":return`dash:${e.capStyle}.${d(e.dashTemplate).join("")}`;case"sdf":return`sdf:${JSON.stringify(e.geometry)}.${e.sdfTextureSize}.${e.asFill?1:0}`;case"fill-style":return`fill_style:${e.style}`;case"animated":return JSON.stringify(z(e));case"CIMGradientFill":case"CIMGradientStroke":return`gradient:${JSON.stringify(e.colorRamp)}.${e.gradientType}.${e.interval}`;case"CIMHatchFill":case"CIMVectorMarker":return JSON.stringify(e)}}async _rasterizeSprite(e,t){if(!e)return null;const i=l(this._hashSpriteResource(e));if(this._spriteMosaic.has(i))return this._spriteMosaic.getSpriteItem(i);if("url"in e&&e.url&&"animated"!==e.type||"CIMPictureFill"===e.type||"CIMPictureStroke"===e.type||"CIMPictureMarker"===e.type||"CIMVectorMarker"===e.type){const t={type:"CIMPointSymbol",symbolLayers:[e]};await u.normalizeSymbolAndFetchResources(t,this._resourceManager)}switch(e.type){case"CIMPictureMarker":return"CIMMarkerPlacementInsidePolygon"===e.markerPlacement?.type?this._rasterizeJSONResource(i,e):this._handleAsyncResource(i,e,t);case"animated":case"CIMPictureFill":case"CIMPictureStroke":case"path":return this._handleAsyncResource(i,e,t);case"CIMGradientFill":case"CIMGradientStroke":case"CIMHatchFill":case"CIMVectorMarker":case"dash":case"fill-style":case"sdf":return this._rasterizeJSONResource(i,e)}}_rasterizeJSONResource(e,t){const i=this._rasterizer.rasterizeJSONResource(t);if(i){const{size:s,image:r,sdf:a,simplePattern:n,rasterizationScale:o,samplingMode:c,sdfPaddingRatio:l,sdfDecodeCoeff:h}=i;return this._addItemToMosaic(e,s,{type:"static",data:r},F(t),a,n,o,c,l,h)}return null}async _handleAsyncResource(e,t,i){if(this._ongoingRasterizations.has(e))return this._ongoingRasterizations.get(e);let s;return s="path"===t.type?this._handleSVG(t,e,i):this._handleImage(t,e,i),this._ongoingRasterizations.set(e,s),s.finally(()=>this._ongoingRasterizations.delete(e)),s}async _handleSVG(e,t,i){const s=[g,g],{asFill:r}=e,a=await this._sdfConverter.draw(e.path,r,i);return this._addItemToMosaic(t,s,{type:"static",data:new Uint32Array(a.buffer)},!1,!0,!0)}_handleGIFOrPNG(e,t,i){const s=e.url,r=this.resourceManager.getResource(s);if(null==r)return null;const{width:a,height:n}=r;if(r instanceof HTMLImageElement){if("animated"===e.type)return j("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;const i="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:s,sdf:o,image:c}=this._rasterizer.rasterizeImageResource(a,n,r,i);return this._addItemToMosaic(t,s,{type:"static",data:c},F(e),o,!1)}let o,c,l;"animated"===e.type?(o=!1,c={type:"CIMAnimatedSymbolProperties",playAnimation:e.playAnimation,reverseAnimation:e.reverseAnimation,randomizeStartTime:e.randomizeStartTime,randomizeStartSeed:e.randomizeStartSeed,startTimeOffset:e.startTimeOffset,duration:e.duration,repeatType:e.repeatType,repeatDelay:e.repeatDelay},l=e.startGroup||0):(o=F(e),c={type:"CIMAnimatedSymbolProperties",playAnimation:!0},l=0);const h=new x(r,this._requestRender,c,l);return this._addItemToMosaic(t,[h.width,h.height],{type:"animated",data:h},o,!1,!1)}async _handleImage(e,t,s){const r=e.url;if(B(r)||U(r))return this._handleGIFOrPNG(e,t,s);if("animated"===e.type)return j("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;try{let i;const a=this.resourceManager.getResource(r);if(null!=a&&a instanceof HTMLImageElement)i=a;else{const{data:e}=await this._imageRequestQueue.push(r,{...s});i=e}if(C(r))if("width"in e&&"height"in e)i.width=c(e.width),i.height=c(e.height);else if("cim"in e){const t=e;i.width=c(t.width??t.scaleX*t.size),i.height=c(t.size)}if(!i.width||!i.height)return null;const n=i.width,o=i.height,l="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:h,sdf:u,image:p}=this._rasterizer.rasterizeImageResource(n,o,i,l);return this._addItemToMosaic(t,h,{type:"static",data:p},F(e),u,!1)}catch(j){if(!n(j))throw new i("mapview-invalid-resource",`Could not fetch requested resource at ${r}. ${j.message}`);throw j}}_addItemToMosaic(e,t,i,s,r,a,n,o,c,l){return this._spriteMosaic.addSpriteItem(e,t,i,s,r,a,n,o,c,l)}}function F(e){switch(e.type){case"CIMVectorMarker":case"CIMPictureMarker":return q(e);default:return!0}}const N=e=>null!=e&&e.startsWith("data:image/gif"),B=e=>e&&(e.includes(".gif")||N(e)),O=e=>null!=e&&e.startsWith("data:image/png"),U=e=>e&&(e.includes(".png")||O(e)),q=e=>e&&"markerPlacement"in e&&e.markerPlacement&&"CIMMarkerPlacementInsidePolygon"===e.markerPlacement.type;export{A as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- const t=8,e=t-2,c=1e-30,h=64,i=4294967295,o=512,a=256,d=256/360,n=128,p=16777216,r=!1,s=128,f=8,g=10,l=29,m=10,v=1,w=16,x=16,b=o/s,j=8,k=50,q=10,u=24,y=3,z=24,A=8,B=3,C=24,D=8,E=4,F={metrics:{width:15,height:17,left:0,top:-7,advance:14}},G=1024,H=0,I=0,J=0,K=1,L=2,M=3,N=4,O=5,P=6,Q=12,R=13,S=5,T=6,U=5,V=6,W=6,X=1<<W,Y=X<<1,Z=!1,$=1.05,_=3,tt=1,et=3,ct=3,ht=5,it=6,ot=1.15,at=2,dt=4,nt=128,pt=256,rt=pt-2*dt,st=2,ft=128,gt=1,lt=8,mt=500,vt=4,wt=128,xt=1024,bt=2,jt=0,kt=1,qt=4,ut=8,yt=16,zt=4,At=1,Bt=4,Ct=8,Dt=32,Et=64,Ft=128,Gt=4,Ht=1,It=1<<20,Jt=.75,Kt=10,Lt=.75,Mt=12,Nt=256,Ot=32,Pt=512,Qt=0,Rt=1;export{Ht as MAX_TILE_RESHUFFLES_PER_FRAME,Kt as RESHUFFLING_EXEMPT_DRAW_CALLS,It as RESHUFFLING_EXEMPT_MEMORY_BYTES,Lt as RESHUFFLING_TARGET_DRAW_EFFICIENCY,Jt as RESHUFFLING_TARGET_MEMORY_EFFICIENCY,L as animationUnit,Nt as attributeStoreInitialSize,G as attributeStoreTextureSize,F as averageGlyphMosaicItem,Rt as backbufferStencilClipped,Qt as backbufferStencilVisible,Dt as bitsetFillHasPatternHeightPrecisionFactor,Et as bitsetFillHasPatternWidthPrecisionFactor,Ct as bitsetFillHasUnresolvedReplacementColor,Bt as bitsetFillRandomPatternOffset,yt as bitsetGenericConsiderAlphaOnly,bt as bitsetGenericLockColor,zt as bitsetLineScaleDash,kt as bitsetMarkerAlignmentMap,jt as bitsetMarkerAlignmentScreen,qt as bitsetMarkerOutlineAllowColorOverride,ut as bitsetMarkerScaleSymbolsProportionally,At as bitsetTypeFillOutline,wt as bufferDataMinimumSize,vt as bufferDataPoolSize,g as chartMaxFields,x as collisionBoxPadding,s as collisionBucketSize,w as collisionEarlyRejectBucketSize,v as collisionMaxZoomDelta,j as collisionPlacementPadding,b as collisionTileBoxSize,n as compressionFactorForU16,N as dataDrivenUnit0,O as dataDrivenUnit1,P as dataDrivenUnit2,r as debugLabels,nt as defaultSdfTextureSize,lt as displayRecordIntPerElement,f as dotDensityMaxFields,Y as effectFlag0,Z as enableEarlyLabelDiscard,h as extrudeScale,X as filterFlag0,K as filterFlagsUnit,u as glyphSize,Q as gpgpuUnit,gt as gradientTextureExternalPadding,q as heuristicGlyphsPerFeature,k as heuristicGlyphsPerLine,ct as hittestSmallSymbolThreshold,tt as hittestToleranceDesktop,_ as hittestToleranceMobile,et as hittestToleranceSmallSymbol,E as labelPlacementOffsetPadding,m as labelU16ZoomPrecisionFactor,R as localTimeOriginUnit,l as magicLabelLineHeight,Mt as maxGeohashLevel,at as maxGpuUploadsPerFrame,W as maxHighlightReasons,p as maxRepresentableInt,Pt as maxTextLineWidth,Ot as minTextLineWidth,c as nanMagicNumber,d as packDegreesU8,mt as patchPixelBufferAllocSize,st as patternFillRasterizationScale,i as pictureFillColor,xt as randomInsidePolygonTextureSize,a as rasterTileSize,ft as rasterizedVectorMarkerMinSize,B as sdfBufferGlyphSDFCreator,y as sdfBufferServer,D as sdfRadiusComplex,A as sdfRadiusSimple,C as sdfSizeComplex,z as sdfSizeSimple,dt as spritePadding,rt as svgSdfTextureInnerSize,pt as svgSdfTextureSize,J as textureBindingBitmap,I as textureBindingGlyphAtlas,S as textureBindingHighlight0,T as textureBindingHighlight1,U as textureBindingRenderer0,V as textureBindingRenderer1,H as textureBindingSpriteAtlas,Gt as textureUploadManagerBudget,Ft as textureUploadManagerChunkSize,$ as thinLineHalfWidthThreshold,o as tileSize,M as visualVariableUnit,ot as vtlHighResCutoff,it as vtlTextureBindingUnitGlyphs,ht as vtlTextureBindingUnitSprites,e as webglMaxInnerStops,t as webglMaxStops};
2
+ const t=8,e=t-2,c=1e-30,h=64,i=4294967295,o=512,a=256,d=256/360,n=128,p=16777216,r=!1,s=128,f=8,g=10,l=29,m=.25,v=4,w=10,x=1,b=16,j=16,k=o/s,q=8,u=50,y=10,z=24,A=3,B=24,C=8,D=3,E=24,F=8,G=4,H={metrics:{width:15,height:17,left:0,top:-7,advance:14}},I=1024,J=0,K=0,L=0,M=1,N=2,O=3,P=4,Q=5,R=6,S=12,T=13,U=5,V=6,W=5,X=6,Y=6,Z=1<<Y,$=Z<<1,_=!1,tt=1.05,et=3,ct=1,ht=3,it=3,ot=5,at=6,dt=1.15,nt=2,pt=4,rt=128,st=256,ft=st-2*pt,gt=2,lt=128,mt=1,vt=8,wt=500,xt=4,bt=128,jt=1024,kt=2,qt=0,ut=1,yt=4,zt=8,At=16,Bt=4,Ct=1,Dt=4,Et=8,Ft=32,Gt=64,Ht=128,It=4,Jt=1,Kt=1<<20,Lt=.75,Mt=10,Nt=.75,Ot=12,Pt=256,Qt=32,Rt=512,St=0,Tt=1;export{Jt as MAX_TILE_RESHUFFLES_PER_FRAME,Mt as RESHUFFLING_EXEMPT_DRAW_CALLS,Kt as RESHUFFLING_EXEMPT_MEMORY_BYTES,Nt as RESHUFFLING_TARGET_DRAW_EFFICIENCY,Lt as RESHUFFLING_TARGET_MEMORY_EFFICIENCY,N as animationUnit,Pt as attributeStoreInitialSize,I as attributeStoreTextureSize,H as averageGlyphMosaicItem,Tt as backbufferStencilClipped,St as backbufferStencilVisible,Ft as bitsetFillHasPatternHeightPrecisionFactor,Gt as bitsetFillHasPatternWidthPrecisionFactor,Et as bitsetFillHasUnresolvedReplacementColor,Dt as bitsetFillRandomPatternOffset,At as bitsetGenericConsiderAlphaOnly,kt as bitsetGenericLockColor,Bt as bitsetLineScaleDash,ut as bitsetMarkerAlignmentMap,qt as bitsetMarkerAlignmentScreen,yt as bitsetMarkerOutlineAllowColorOverride,zt as bitsetMarkerScaleSymbolsProportionally,Ct as bitsetTypeFillOutline,bt as bufferDataMinimumSize,xt as bufferDataPoolSize,g as chartMaxFields,j as collisionBoxPadding,s as collisionBucketSize,b as collisionEarlyRejectBucketSize,x as collisionMaxZoomDelta,q as collisionPlacementPadding,k as collisionTileBoxSize,n as compressionFactorForU16,P as dataDrivenUnit0,Q as dataDrivenUnit1,R as dataDrivenUnit2,r as debugLabels,rt as defaultSdfTextureSize,vt as displayRecordIntPerElement,f as dotDensityMaxFields,$ as effectFlag0,_ as enableEarlyLabelDiscard,h as extrudeScale,Z as filterFlag0,M as filterFlagsUnit,z as glyphSize,S as gpgpuUnit,mt as gradientTextureExternalPadding,y as heuristicGlyphsPerFeature,u as heuristicGlyphsPerLine,it as hittestSmallSymbolThreshold,ct as hittestToleranceDesktop,et as hittestToleranceMobile,ht as hittestToleranceSmallSymbol,G as labelPlacementOffsetPadding,w as labelU16ZoomPrecisionFactor,T as localTimeOriginUnit,l as magicLabelLineHeight,Ot as maxGeohashLevel,nt as maxGpuUploadsPerFrame,Y as maxHighlightReasons,v as maxLineHeightRatio,p as maxRepresentableInt,Rt as maxTextLineWidth,m as minLineHeightRatio,Qt as minTextLineWidth,c as nanMagicNumber,d as packDegreesU8,wt as patchPixelBufferAllocSize,gt as patternFillRasterizationScale,i as pictureFillColor,jt as randomInsidePolygonTextureSize,a as rasterTileSize,lt as rasterizedVectorMarkerMinSize,D as sdfBufferGlyphSDFCreator,A as sdfBufferServer,F as sdfRadiusComplex,C as sdfRadiusSimple,E as sdfSizeComplex,B as sdfSizeSimple,pt as spritePadding,ft as svgSdfTextureInnerSize,st as svgSdfTextureSize,L as textureBindingBitmap,K as textureBindingGlyphAtlas,U as textureBindingHighlight0,V as textureBindingHighlight1,W as textureBindingRenderer0,X as textureBindingRenderer1,J as textureBindingSpriteAtlas,It as textureUploadManagerBudget,Ht as textureUploadManagerChunkSize,tt as thinLineHalfWidthThreshold,o as tileSize,O as visualVariableUnit,dt as vtlHighResCutoff,at as vtlTextureBindingUnitGlyphs,ot as vtlTextureBindingUnitSprites,e as webglMaxInnerStops,t as webglMaxStops};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../../tiling/TileInfoView.js";import e from"../../../tiling/TileKey.js";import"../../../tiling/TileQueue.js";import"../../../tiling/TileStrategy.js";import{tileSize as s}from"../definitions.js";import{MeshData as t}from"./MeshData.js";const r=1,i=2,n=4,h=8,o=16,c=32,a=64,f=128;function l(e){switch(e){case r:case h:case c:return-1;case i:case a:return 0;case n:case o:case f:return 1}}function u(e){switch(e){case r:case i:case n:return-1;case h:case o:return 0;case c:case a:case f:return 1}}const m=r|h|c,_=n|o|f,d=r|i|n,p=c|a|f;class g{constructor(e,s,r,i,n=0){this.tileKey=e,this._bufferingEnabled=s,this._sizeHint=n,this._meshes={self:new t(this.id,this._sizeHint),neighbors:new Array},this._currentRecordOverlaps=0,this._currentEntityOverlaps=0;const h=i?1:0;this._copyBufferedDataIntoSelf=r&&this._bufferingEnabled&&e.level===h}get id(){return this.tileKey.id}get requiresRefresh(){return this._meshes.self.requiresRefresh||this._meshes.neighbors.some(e=>e.requiresRefresh)}set requiresRefresh(e){this._meshes.self.requiresRefresh=e}vertexStart(){return this._meshes.self.vertexStart()??0}vertexCount(){return this._meshes.self.vertexCount()}indexCount(){return this._meshes.self.indexCount()}indexEnsureSize(e){this._meshes.self.indexEnsureSize(e)}entityStart(e,s=e){this._currentEntityOverlaps=0,this._meshes.self.entityStart(e,s)}entityRecordCount(){return this._meshes.self.entityRecordCount()}entityEnd(){if(this._meshes.self.entityEnd(),this._bufferingEnabled){if(this._copyBufferedDataIntoSelf)return;for(let e=0;e<8;e++){const s=1<<e;!!(this._currentEntityOverlaps&s)&&this._meshes.neighbors[e].entityEnd()}}}recordStart(e,s,t){this._currentRecordOverlaps=0,this._meshes.self.recordStart(e,s,t)}recordEnd(e=0){const s=this._meshes.self.recordEnd(this._currentRecordOverlaps);return s&&0!==this._currentRecordOverlaps?(this._copyIntoNeighbors(),this._currentEntityOverlaps|=this._currentRecordOverlaps,!0):s}recordBounds(e,s,t,r){this._bufferingEnabled&&this._addOverlap(e,s,t,r)}recordCount(){return this._meshes.self.recordCount()}metricStart(e){this._meshes.self.metricStart(e)}metricBoxWrite(e){this._meshes.self.metricBoxWrite(e)}metricEnd(){this._meshes.self.metricEnd()}vertexWrite(e){this._meshes.self.vertexWrite(e)}vertexWriteF32(e){this._meshes.self.vertexWriteF32(e)}vertexWriteRegion(e){this._meshes.self.vertexWriteRegion(e)}indexWrite(e){this._meshes.self.indexWrite(e)}serialize(s){const t={message:[],transferList:[]},r=this._meshes.self.serialize();return t.message.push({tileId:this.tileKey.id,requiresRefresh:this.requiresRefresh,...r.message}),t.transferList.push(...r.transferList),this._meshes.neighbors.forEach((r,i)=>{const n=r.serialize(),h=1<<i,o=l(h),c=u(h),a=new e(this.tileKey).getNormalizedNeighbor(o,c,s);t.message.push({tileId:a.id,requiresRefresh:this.requiresRefresh,...n.message}),t.transferList.push(...n.transferList)}),t}_addOverlap(e,t,r,i){const n=Math.min(s/2,r),h=Math.min(s/2,i),o=255^((e<0+n?_:e>=s-n?m:_|m)|(t<0+h?p:t>=s-h?d:p|d));this._currentRecordOverlaps|=o}_copyIntoNeighbors(){for(let e=0;e<8;e++){const r=1<<e;if(!!(this._currentRecordOverlaps&r)){if(this._copyBufferedDataIntoSelf){const e=-l(r)*s,t=-u(r)*s;if(0!==t)continue;this._meshes.self.copyLast(e,t);continue}if(!this._meshes.neighbors[e]){const s=Math.floor(this._sizeHint/16);this._meshes.neighbors[e]=new t(r,s)}const i=this._meshes.neighbors[e],n=-l(r)*s,h=-u(r)*s;i.copyLastFrom(this._meshes.self,n,h)}}}}export{g as MultiTileMeshData};
2
+ import has from"../../../../../core/has.js";import"../../../tiling/TileInfoView.js";import e from"../../../tiling/TileKey.js";import"../../../tiling/TileQueue.js";import"../../../tiling/TileStrategy.js";import{tileSize as s}from"../definitions.js";import{MeshData as t}from"./MeshData.js";const r=!!has("featurelayer-pixel-buffering-enabled"),i=1,n=2,h=4,o=8,c=16,a=32,f=64,l=128;function u(e){switch(e){case i:case o:case a:return-1;case n:case f:return 0;case h:case c:case l:return 1}}function m(e){switch(e){case i:case n:case h:return-1;case o:case c:return 0;case a:case f:case l:return 1}}const _=i|o|a,d=h|c|l,p=i|n|h,g=a|f|l;class y{constructor(e,s,i,n=0){this.tileKey=e,this._sizeHint=n,this._meshes={self:new t(this.id,this._sizeHint),neighbors:new Array},this._currentRecordOverlaps=0,this._currentEntityOverlaps=0;const h=i?1:0;this._copyBufferedDataIntoSelf=s&&r&&e.level===h}get id(){return this.tileKey.id}get requiresRefresh(){return this._meshes.self.requiresRefresh||this._meshes.neighbors.some(e=>e.requiresRefresh)}set requiresRefresh(e){this._meshes.self.requiresRefresh=e}vertexStart(){return this._meshes.self.vertexStart()??0}vertexCount(){return this._meshes.self.vertexCount()}indexCount(){return this._meshes.self.indexCount()}indexEnsureSize(e){this._meshes.self.indexEnsureSize(e)}entityStart(e,s=e){this._currentEntityOverlaps=0,this._meshes.self.entityStart(e,s)}entityRecordCount(){return this._meshes.self.entityRecordCount()}entityEnd(){if(this._meshes.self.entityEnd(),r){if(this._copyBufferedDataIntoSelf)return;for(let e=0;e<8;e++){const s=1<<e;!!(this._currentEntityOverlaps&s)&&this._meshes.neighbors[e].entityEnd()}}}recordStart(e,s,t){this._currentRecordOverlaps=0,this._meshes.self.recordStart(e,s,t)}recordEnd(e=0){const s=this._meshes.self.recordEnd(this._currentRecordOverlaps);return s&&0!==this._currentRecordOverlaps?(this._copyIntoNeighbors(),this._currentEntityOverlaps|=this._currentRecordOverlaps,!0):s}recordBounds(e,s,t,i){r&&this._addOverlap(e,s,t,i)}recordCount(){return this._meshes.self.recordCount()}metricStart(e){this._meshes.self.metricStart(e)}metricBoxWrite(e){this._meshes.self.metricBoxWrite(e)}metricEnd(){this._meshes.self.metricEnd()}vertexWrite(e){this._meshes.self.vertexWrite(e)}vertexWriteF32(e){this._meshes.self.vertexWriteF32(e)}vertexWriteRegion(e){this._meshes.self.vertexWriteRegion(e)}indexWrite(e){this._meshes.self.indexWrite(e)}serialize(s){const t={message:[],transferList:[]},r=this._meshes.self.serialize();return t.message.push({tileId:this.tileKey.id,requiresRefresh:this.requiresRefresh,...r.message}),t.transferList.push(...r.transferList),this._meshes.neighbors.forEach((r,i)=>{const n=r.serialize(),h=1<<i,o=u(h),c=m(h),a=new e(this.tileKey).getNormalizedNeighbor(o,c,s);t.message.push({tileId:a.id,requiresRefresh:this.requiresRefresh,...n.message}),t.transferList.push(...n.transferList)}),t}_addOverlap(e,t,r,i){const n=Math.min(s/2,r),h=Math.min(s/2,i),o=255^((e<0+n?d:e>=s-n?_:d|_)|(t<0+h?g:t>=s-h?p:g|p));this._currentRecordOverlaps|=o}_copyIntoNeighbors(){for(let e=0;e<8;e++){const r=1<<e;if(!!(this._currentRecordOverlaps&r)){if(this._copyBufferedDataIntoSelf){const e=-u(r)*s,t=-m(r)*s;if(0!==t)continue;this._meshes.self.copyLast(e,t);continue}if(!this._meshes.neighbors[e]){const s=Math.floor(this._sizeHint/16);this._meshes.neighbors[e]=new t(r,s)}const i=this._meshes.neighbors[e],n=-u(r)*s,h=-m(r)*s;i.copyLastFrom(this._meshes.self,n,h)}}}}export{y as MultiTileMeshData};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{fromRotation as t,multiply as e,translate as i,rotate as s}from"../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as n}from"../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as o,set as h}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{getXAnchorDirection as a,getYAnchorDirection as f}from"../../alignmentUtils.js";import c from"../../Rect.js";import d from"../../collisions/BoundingBox.js";const l=22,g=4,m=l+g,u=l-6,x=Math.PI/180,p=8,w=1.5;class _{constructor(t,e,i,s){this._rotationT=n(),this._transform=n(),this._angle=0,this._bounds=null;const{mosaicItem:o,rect:h,shaping:r,code:a}=i,f=o.rect;this.width=0===a?h.width:f.width*s,this.height=0===a?h.height:f.height*s,this.x=s*(t+r.xOffset+h.left),this.y=s*(e+r.yOffset-h.top),this.textureBinding=o.textureBinding,this.texcoords={topLeft:[f.x,f.y],topRight:[f.x+f.width,f.y],bottomLeft:[f.x,f.y+f.height],bottomRight:[f.x+f.width,f.y+f.height]}}set angle(e){this._angle=e,t(this._rotationT,-e),this._offsets=this._bounds=null}get angle(){return this._angle}get offsets(){if(!this._offsets){const{x:i,y:s,width:h,height:r}=this,a=t(n(),-this.angle),f=e(n(),a,this._transform);this._offsets={topLeft:o([0,0],[i,s],f),topRight:o([0,0],[i+h,s],f),bottomLeft:o([0,0],[i,s+r],f),bottomRight:o([0,0],[i+h,s+r],f)}}return this._offsets}get bounds(){if(this.width<=0)return null;if(!this._bounds){const t=this.offsets;let e=1/0,i=1/0,s=-1/0,n=-1/0;for(const[f,c]of[t.topLeft,t.topRight,t.bottomLeft,t.bottomRight])e=Math.min(e,f),i=Math.min(i,c),s=Math.max(s,f),n=Math.max(n,c);const o=s-e,h=n-i,r=e+o/2,a=i+h/2;this._bounds=new d(r,a,o,h)}return this._bounds}setTransform(t){this._transform=t,this._offsets=null}}const y=(t,e)=>({code:0,mosaicItem:{rect:new c(0,0,11,8),sdf:!0,page:0,textureBinding:e},rect:{height:4,width:t,left:0,top:0},shaping:{xOffset:0,yOffset:0,xAdvance:0,yAdvance:0}});function b(t,e){return t.forEach(t=>o(t,t,e)),{topLeft:t[0],topRight:t[1],bottomLeft:t[2],bottomRight:t[3]}}class M{constructor(t,e,i,s){this._rotation=0,this._decorate(t,e,i,s),this.glyphs=t,this.bounds=this._createBounds(t),this.isMultiline=e.length>1,this._hasRotation=0!==i.angle,this._transform=this._createGlyphTransform(this.bounds,i),this._borderLineSizePx=i.borderLineSizePx,(i.borderLineSizePx||i.hasBackground)&&([this.bounds,this.textBox]=this.shapeBackground(this._transform));for(const n of t)n.setTransform(this._transform)}setRotation(i){if(0===i&&0===this._rotation)return;this._rotation=i;const s=this._transform,o=t(n(),i);e(s,o,s);for(const t of this.glyphs)t.setTransform(this._transform)}_decorate(t,e,i,s){if(!i.decoration||"none"===i.decoration||!t.length)return;const n=i.scale,o="underline"===i.decoration?s?.baseline??m:s?.midline??u,h=t[0].textureBinding;for(const r of e){const e=r.startX*n,i=r.startY*n,s=(r.width+r.glyphWidthEnd)*n;t.push(new _(e,i+o*n,y(s,h),1))}}shapeBackground(t){const e=this._borderLineSizePx||0,i=(w+e)/2,s=this._borderLineSizePx?i:0,{xmin:n,ymin:o,xmax:h,ymax:r,x:a,y:f,width:c,height:l}=this.bounds,g=[n-p,o-p],m=[h+p,o-p],u=[n-p,r+p],x=[h+p,r+p],_=b([[g[0]-i,g[1]-i],[m[0]+i,m[1]-i],[g[0]+s,g[1]+s],[m[0]-s,m[1]+s]],t),y=b([[u[0]+s,u[1]-s],[x[0]-s,x[1]-s],[u[0]-i,u[1]+i],[x[0]+i,x[1]+i]],t),M=b([[g[0]-i,g[1]-i],[g[0]+s,g[1]+s],[u[0]-i,u[1]+i],[u[0]+s,u[1]-s]],t),L=b([[m[0]-s,m[1]+s],[m[0]+i,m[1]-i],[x[0]-s,x[1]-s],[x[0]+i,x[1]+i]],t),A={main:b([g,m,u,x],t),top:_,bot:y,left:M,right:L};return[new d(a,f,c+2*i,l+2*i),A]}get boundsT(){const t=this.bounds,e=h(r(),t.x,t.y);if(o(e,e,this._transform),this._hasRotation){const i=Math.max(t.width,t.height);return new d(e[0],e[1],i,i)}return new d(e[0],e[1],t.width,t.height)}_createBounds(t){let e=1/0,i=1/0,s=0,n=0;for(const r of t)e=Math.min(e,r.offsets.topLeft[0]),i=Math.min(i,r.offsets.topLeft[1]),s=Math.max(s,r.offsets.bottomRight[0]),n=Math.max(n,r.offsets.bottomRight[1]);const o=s-e,h=n-i;return new d(e+o/2,i+h/2,o,h)}_createGlyphTransform(t,e){const o=x*e.angle,a=n(),f=r();return i(a,a,h(f,e.xOffset,-e.yOffset)),e.useCIMAngleBehavior?s(a,a,o):(i(a,a,h(f,t.x,t.y)),s(a,a,o),i(a,a,h(f,-t.x,-t.y))),a}}class L{constructor(t,e,i,s,n,o){this.glyphWidthEnd=0,this.startX=0,this.startY=0,this.start=Math.max(0,Math.min(e,i)),this.end=Math.max(0,Math.max(e,i)),this.end<t.length&&(this.glyphWidthEnd=t[this.end].rect.width),this.width=s,this.yMin=n,this.yMax=o}}const A=t=>10===t,R=t=>32===t;function v(t,e,i){const s=new Array,n=1/i.scale,o=i.maxLineWidth*n,h=e?t.length-1:0,r=e?-1:t.length,a=e?-1:1;let f=h,c=0,d=0,l=f,g=l,m=0,u=1/0,x=0;for(;f!==r;){const{code:e,rect:i,shaping:n}=t[f],r=Math.abs(i.top);if(A(e)||R(e)||(u=Math.min(u,r),x=Math.max(x,r+i.height)),A(e))f!==h&&(s.push(new L(t,l,f-a,c,u===1/0?0:u,x)),u=1/0,x=0),c=0,l=f+a,g=f+a,d=0;else if(R(e))g=f+a,d=0,m=n.xAdvance,c+=n.xAdvance;else if(c>o){if(g!==l){const e=g-2*a;c-=m,s.push(new L(t,l,e,c-d,u,x)),u=1/0,x=0,l=g,c=d}else s.push(new L(t,l,f-a,c,u,x)),u=1/0,x=0,l=f,g=f,c=0;c+=n.xAdvance,d+=n.xAdvance}else c+=n.xAdvance,d+=n.xAdvance;f+=a}const p=new L(t,l,f-a,c,u,x);return p.start>=0&&p.end<t.length&&s.push(p),s}function B(t,e){let i=0;for(let o=0;o<t.length;o++){const{width:e}=t[o];i=Math.max(e,i)}const s="underline"===e.decoration?g:0,n=t[0].yMin;return{x:0,y:n,height:t[t.length-1].yMax+e.lineHeight*(t.length-1)+s-n,width:i}}function T(t,e,i){let s=0;for(let n=e;n<i;n++)R(t[n].code)&&!A(t[n+1].code)&&s++;return s}function j(t,e){const i=e.scale,s=new Array,n=t.sdfPadding,{faceInfo:o,glyphs:h,isRightToLeft:r}=t,c="justify"===e.horizontalAlignment||"Justify"===e.horizontalAlignment,d=v(h,r,e),g=d.length?B(d,e):{y:0,height:0,width:0},m=c?r?1:-1:a(e.horizontalAlignment),u=f(e.verticalAlignment),x=2===u?1:0,p=x?0:u-1,w=o?.baseline??l,y=d.length>1,b=x?y?-g.y-g.height:-w:-g.y+p*(g.height/2);for(let a=0;a<d.length;a++){const{start:o,end:r,width:f}=d[a],l=c&&a<d.length-1?T(h,o,r):0,u=l>0?(g.width-f)/l:0;let x=-1*(m+1)*((u>0?g.width:f)/2)-n;const p=(t.isRightToLeft?d.length-1-a:a)*e.lineHeight+b-n;d[a].startX=x,d[a].startY=p;for(let t=o;t<=r;t++){const e=h[t];if(A(e.code))continue;const n=new _(x,p,e,i);x+=e.shaping.xAdvance,u>0&&R(e.code)&&(x+=u),s.push(n)}}return new M(s,d,e,o)}function z(t,e){const i=e.scale,{faceInfo:s,glyphs:n}=t,o=n.reduce((t,e)=>Math.max(t,e.rect.height),0),h=n.map(t=>new _(-t.rect.width/2,-o,t,i));return new M(h,[],e,s)}export{_ as ShapedGlyph,M as ShapingInfo,j as shapeGlyphs,z as shapeGlyphsForMultipoint};
2
+ import{pt2px as t}from"../../../../../../core/screenUtils.js";import{fromRotation as e,multiply as n,translate as i,rotate as s}from"../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as o}from"../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as h,set as r}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{getXAnchorDirection as l,getYAnchorDirection as c}from"../../alignmentUtils.js";import{magicLabelLineHeight as f}from"../../definitions.js";import d from"../../Rect.js";import g from"../../collisions/BoundingBox.js";const m=22,u=4,p=m+u,y=m-6,x=Math.PI/180,w=8,b=1.5;class M{static fromGlyph(t,e,n,i,s){const{mosaicItem:o,rect:h,shaping:r,code:a}=n,l=o.rect;return new M({width:0===a?h.width:l.width*i,height:0===a?h.height:l.height*i,x:i*(t+r.xOffset+h.left),y:i*(e+r.yOffset-h.top),textureBinding:o.textureBinding,texcoords:{topLeft:[l.x,l.y],topRight:[l.x+l.width,l.y],bottomLeft:[l.x,l.y+l.height],bottomRight:[l.x+l.width,l.y+l.height]},fontSize:s?.fontSize,color:s?.color})}constructor(t){this._rotationT=o(),this._transform=o(),this._angle=0,this._bounds=null,this.width=t.width,this.height=t.height,this.x=t.x,this.y=t.y,this.textureBinding=t.textureBinding,this.texcoords=t.texcoords,this.fontSize=t.fontSize,this.color=t.color}set angle(t){this._angle=t,e(this._rotationT,-t),this._offsets=this._bounds=null}get angle(){return this._angle}get offsets(){if(!this._offsets){const{x:t,y:i,width:s,height:r}=this,a=e(o(),-this.angle),l=n(o(),a,this._transform);this._offsets={topLeft:h([0,0],[t,i],l),topRight:h([0,0],[t+s,i],l),bottomLeft:h([0,0],[t,i+r],l),bottomRight:h([0,0],[t+s,i+r],l)}}return this._offsets}get bounds(){if(this.width<=0)return null;if(!this._bounds){const t=this.offsets;let e=1/0,n=1/0,i=-1/0,s=-1/0;for(const[l,c]of[t.topLeft,t.topRight,t.bottomLeft,t.bottomRight])e=Math.min(e,l),n=Math.min(n,c),i=Math.max(i,l),s=Math.max(s,c);const o=i-e,h=s-n,r=e+o/2,a=n+h/2;this._bounds=new g(r,a,o,h)}return this._bounds}setTransform(t){this._transform=t,this._offsets=null}}const _=(t,e)=>({code:0,mosaicItem:{rect:new d(0,0,11,8),sdf:!0,page:0,textureBinding:e},rect:{height:4,width:t,left:0,top:0},shaping:{xOffset:0,yOffset:0,xAdvance:0,yAdvance:0}});function A(t,e){return t.forEach(t=>h(t,t,e)),{topLeft:t[0],topRight:t[1],bottomLeft:t[2],bottomRight:t[3]}}class v{constructor(t,e,n,i){this._rotation=0,this._decorate(t,e,n,i),this.glyphs=t,this.bounds=this._createBounds(t),this.isMultiline=e.length>1,this._hasRotation=0!==n.angle,this._transform=this._createGlyphTransform(this.bounds,n),this._borderLineSizePx=n.borderLineSizePx,(n.borderLineSizePx||n.hasBackground)&&([this.bounds,this.textBox]=this.shapeBackground(this._transform));for(const s of t)s.setTransform(this._transform)}setRotation(t){if(0===t&&0===this._rotation)return;this._rotation=t;const i=this._transform,s=e(o(),t);n(i,s,i);for(const e of this.glyphs)e.setTransform(this._transform)}_decorate(t,e,n,i){if(!n.decoration||"none"===n.decoration||!t.length)return;const s=n.scale,o=t[0].textureBinding;for(const h of e){const e=h.scale??s,r="underline"===n.decoration?h.baseline??i?.baseline??p:h.midline??i?.midline??y,a=h.startX*e,l=h.startY*e,c=(h.width+h.glyphWidthEnd)*e;t.push(M.fromGlyph(a,l+r*e,_(c,o),1))}}shapeBackground(t){const e=this._borderLineSizePx||0,n=(b+e)/2,i=this._borderLineSizePx?n:0,{xmin:s,ymin:o,xmax:h,ymax:r,x:a,y:l,width:c,height:f}=this.bounds,d=[s-w,o-w],m=[h+w,o-w],u=[s-w,r+w],p=[h+w,r+w],y=A([[d[0]-n,d[1]-n],[m[0]+n,m[1]-n],[d[0]+i,d[1]+i],[m[0]-i,m[1]+i]],t),x=A([[u[0]+i,u[1]-i],[p[0]-i,p[1]-i],[u[0]-n,u[1]+n],[p[0]+n,p[1]+n]],t),M=A([[d[0]-n,d[1]-n],[d[0]+i,d[1]+i],[u[0]-n,u[1]+n],[u[0]+i,u[1]-i]],t),_=A([[m[0]-i,m[1]+i],[m[0]+n,m[1]-n],[p[0]-i,p[1]-i],[p[0]+n,p[1]+n]],t),v={main:A([d,m,u,p],t),top:y,bot:x,left:M,right:_};return[new g(a,l,c+2*n,f+2*n),v]}get boundsT(){const t=this.bounds,e=r(a(),t.x,t.y);if(h(e,e,this._transform),this._hasRotation){const n=Math.max(t.width,t.height);return new g(e[0],e[1],n,n)}return new g(e[0],e[1],t.width,t.height)}_createBounds(t){let e=1/0,n=1/0,i=0,s=0;for(const r of t)e=Math.min(e,r.offsets.topLeft[0]),n=Math.min(n,r.offsets.topLeft[1]),i=Math.max(i,r.offsets.bottomRight[0]),s=Math.max(s,r.offsets.bottomRight[1]);const o=i-e,h=s-n;return new g(e+o/2,n+h/2,o,h)}_createGlyphTransform(t,e){const n=x*e.angle,h=o(),l=a();return i(h,h,r(l,e.xOffset,-e.yOffset)),e.useCIMAngleBehavior?s(h,h,n):(i(h,h,r(l,t.x,t.y)),s(h,h,n),i(h,h,r(l,-t.x,-t.y))),h}}class z{constructor(t,e,n,i,s,o){this.glyphWidthEnd=0,this.startX=0,this.startY=0,this.start=Math.max(0,Math.min(e,n)),this.end=Math.max(0,Math.max(e,n)),this.end<t.length&&(this.glyphWidthEnd=t[this.end].rect.width),this.width=i,this.yMin=s,this.yMax=o}}const L=t=>10===t,R=t=>32===t;function S(t,e,n){const i=new Array,s=1/n.scale,o=n.maxLineWidth*s,h=e?t.length-1:0,r=e?-1:t.length,a=e?-1:1;let l=h,c=0,f=0,d=l,g=d,m=0,u=1/0,p=0;for(;l!==r;){const{code:e,rect:n,shaping:s}=t[l],r=Math.abs(n.top);if(L(e)||R(e)||(u=Math.min(u,r),p=Math.max(p,r+n.height)),L(e))l!==h&&(i.push(new z(t,d,l-a,c,u===1/0?0:u,p)),u=1/0,p=0),c=0,d=l+a,g=l+a,f=0;else if(R(e))g=l+a,f=0,m=s.xAdvance,c+=s.xAdvance;else if(c>o){if(g!==d){const e=g-2*a;c-=m,i.push(new z(t,d,e,c-f,u,p)),u=1/0,p=0,d=g,c=f}else i.push(new z(t,d,l-a,c,u,p)),u=1/0,p=0,d=l,g=l,c=0;c+=s.xAdvance,f+=s.xAdvance}else c+=s.xAdvance,f+=s.xAdvance;l+=a}const y=new z(t,d,l-a,c,u,p);return y.start>=0&&y.end<t.length&&i.push(y),i}function B(t,e){let n=0;for(let o=0;o<t.length;o++){const{width:e}=t[o];n=Math.max(e,n)}const i="underline"===e.decoration?u:0,s=t[0].yMin;return{x:0,y:s,height:t[t.length-1].yMax+e.lineHeight*(t.length-1)+i-s,width:n}}function Y(t,e,n){let i=0;for(let s=e;s<n;s++)R(t[s].code)&&!L(t[s+1].code)&&i++;return i}function j(t,e){const n=e.scale,i=new Array,s=t.sdfPadding,{faceInfo:o,glyphs:h,isRightToLeft:r}=t,a="justify"===e.horizontalAlignment||"Justify"===e.horizontalAlignment,f=S(h,r,e),d=f.length?B(f,e):{y:0,height:0,width:0},g=a?r?1:-1:l(e.horizontalAlignment),u=c(e.verticalAlignment),p=2===u?1:0,y=p?0:u-1,x=o?.baseline??m,w=f.length>1,b=p?w?-d.y-d.height:-x:-d.y+y*(d.height/2);for(let l=0;l<f.length;l++){const{start:o,end:r,width:c}=f[l],m=a&&l<f.length-1?Y(h,o,r):0,u=m>0?(d.width-c)/m:0;let p=-1*(g+1)*((u>0?d.width:c)/2)-s;const y=(t.isRightToLeft?f.length-1-l:l)*e.lineHeight+b-s;f[l].startX=p,f[l].startY=y;for(let t=o;t<=r;t++){const e=h[t];if(L(e.code))continue;const s=M.fromGlyph(p,y,e,n);p+=e.shaping.xAdvance,u>0&&R(e.code)&&(p+=u),i.push(s)}}return new v(i,f,e,o)}function H(t,e){const n=e.scale,{faceInfo:i,glyphs:s}=t,o=s.reduce((t,e)=>Math.max(t,e.rect.height),0),h=s.map(t=>M.fromGlyph(-t.rect.width/2,-o,t,n));return new v(h,[],e,i)}function T(t,e){return"glyphs"===t.type?j(t,e):E(t,e)}function W(t,e){return"glyphs"===t.type?H(t,e):G(t,e)}function E(t,e){const n=I(t,e),i=X(n,e),s=i.length?O(i):{width:0},o=new Array,h="justify"===e.horizontalAlignment||"Justify"===e.horizontalAlignment,r=h?-1:l(e.horizontalAlignment),a=c(e.verticalAlignment),f=2===a,d=i.length?i[0].yMin:0,g=i.length?i[i.length-1].startY+i[i.length-1].yMax:0,m=g-d,u=f?i.length>1?-g:-(i[0]?.baseline??0):1===a?-d:-1===a?-g:-(d+m/2);for(let l=0;l<i.length;l++){const t=i[l],e=h&&l<i.length-1?k(n,t.start,t.end):0,a=e>0?(s.width-t.width)/e:0;let c=-1*(r+1)*((a>0?s.width:t.width)/2);const f=t.startY+u;t.startX=c,t.startY=f;for(let i=t.start;i<=t.end;i++){const e=n[i],{glyph:s,scale:h,fontSize:r}=e;if(L(s.code))continue;const l=f+t.baseline-e.baseline;o.push(M.fromGlyph(c/h,l/h,s,h,{fontSize:r,color:e.color})),c+=e.xAdvance,a>0&&R(s.code)&&(c+=a)}}return new v(o,i,e)}function G(t,e){const n=I(t,e),i=n.reduce((t,e)=>Math.max(t,e.glyph.rect.height*e.scale),0),s=n.filter(t=>!L(t.glyph.code)).map(t=>M.fromGlyph(-t.glyph.rect.width/2,-i/t.scale,t.glyph,t.scale,{fontSize:t.fontSize,color:t.color}));return new v(s,[],e)}function I(e,n){const i=n.lineHeightRatio??1,s=[];for(const o of e.runs){const e=t(o.fontSize),n=e/o.glyphs.sdfSize,h=e*(f/24)*i,r=(o.glyphs.faceInfo?.baseline??m)*n,a=(o.glyphs.faceInfo?.midline??y)*n;for(const t of o.glyphs.glyphs){const i=Math.abs(t.rect.top)*n,l=i+t.rect.height*n;s.push({glyph:t,scale:n,fontSize:e,color:o.color,xAdvance:t.shaping.xAdvance*n,top:i,bottom:l,lineHeight:h,baseline:r,midline:a})}}return s}function X(t,e){const n=[],i=e.maxLineWidth;let s=0,o=0,h=0,r=0,a=0,l=0;for(;s<t.length;){const e=t[s],{glyph:c}=e;if(L(c.code))0!==s&&n.push({width:o,start:r,end:s-1,glyphWidthEnd:t[s-1]?.glyph.rect.width*t[s-1]?.scale||0,yMin:0,yMax:0,lineHeight:0,baseline:0,midline:0,startX:0,startY:0,scale:1}),o=0,r=s+1,a=r,h=0,l=0;else if(R(c.code))a=s+1,h=0,l=e.xAdvance,o+=e.xAdvance;else if(o>i){if(a!==r){const e=a-2;o-=l,n.push({width:o-h,start:r,end:e,glyphWidthEnd:t[e]?.glyph.rect.width*t[e]?.scale||0,yMin:0,yMax:0,lineHeight:0,baseline:0,midline:0,startX:0,startY:0,scale:1}),r=a,o=h}else n.push({width:o,start:r,end:s-1,glyphWidthEnd:t[s-1]?.glyph.rect.width*t[s-1]?.scale||0,yMin:0,yMax:0,lineHeight:0,baseline:0,midline:0,startX:0,startY:0,scale:1}),r=s,a=s,o=0;o+=e.xAdvance,h+=e.xAdvance}else o+=e.xAdvance,h+=e.xAdvance;s++}if(r<t.length){const e=t.length-1;n.push({width:o,start:r,end:e,glyphWidthEnd:t[e]?.glyph.rect.width*t[e]?.scale||0,yMin:0,yMax:0,lineHeight:0,baseline:0,midline:0,startX:0,startY:0,scale:1})}return P(t,n)}function P(t,e){for(let n=0;n<e.length;n++){const i=e[n];let s=0,o=1/0,h=0;for(let e=i.start;e<=i.end;e++){const n=t[e];L(n.glyph.code)||R(n.glyph.code)||(s=Math.max(s,n.baseline),h=Math.max(h,n.lineHeight))}let r=1/0,a=-1/0;for(let e=i.start;e<=i.end;e++){const n=t[e];L(n.glyph.code)||R(n.glyph.code)||(r=Math.min(r,s-n.baseline+n.top),a=Math.max(a,s-n.baseline+n.bottom),o=Math.min(o,s-n.baseline+n.midline))}i.baseline=s,i.midline=o===1/0?s:o,i.lineHeight=h||Math.max(0,a-r),i.yMin=r===1/0?0:r,i.yMax=a===-1/0?0:a,i.startY=n>0?e[n-1].startY+e[n-1].lineHeight:0}return e}function O(t){let e=0;for(const s of t)e=Math.max(s.width+s.glyphWidthEnd,e);const n=t[0].yMin,i=t[t.length-1];return{x:0,y:n,height:i.startY+i.yMax-n,width:e}}function k(t,e,n){let i=0;for(let s=e;s<n;s++)R(t[s].glyph.code)&&!L(t[s+1].glyph.code)&&i++;return i}export{M as ShapedGlyph,v as ShapingInfo,j as shapeGlyphs,H as shapeGlyphsForMultipoint,E as shapeRichText,G as shapeRichTextForMultipoint,T as shapeTextResource,W as shapeTextResourceForMultipoint};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{memoize as e}from"../../../../../../../core/MapUtils.js";import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{numericHash as i}from"../../../../../../../core/string.js";import{fromRotation as r,translate as s}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as o}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as n,set as a,sub as l,normalize as c,add as h,scale as m}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as u}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{create as d}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{convertGeometryToFlat as f,convertOptimizedGeometryToFlat as g,convertFlatToOptimizedGeometry as p,FlatGeometry as _}from"../../../../../../../geometry/FlatGeometry.js";import{GeometryCursor as y}from"../../../../../../../geometry/GeometryCursor.js";import{getLabelPoint as x}from"../../../../../../../geometry/support/labelPoint.js";import{generalizeOptimizedGeometry as P,convertToGeometry as v}from"../../../../../../../layers/graphics/featureConversionUtils.js";import b from"../../../../../../../layers/graphics/OptimizedGeometry.js";import{importLazily as M}from"../../../../../../../symbols/cim/utils.js";import{tileSize as w}from"../../../definitions.js";import L from"../../../collisions/BoundingBox.js";import{LabelMetric as I}from"../../../collisions/LabelMetric.js";import{smoothPaths as B,pathDivide as S}from"../../../mesh/templates/segmentUtils.js";import{getMinMaxZoom as z,processColorInput as G}from"../fill/meshWriterUtils.js";import{TextMeshWriter as j,maxLabelZoom as D}from"../text/TextMeshWriter.js";const A=1,F=0,R=128,$=w*w/16,k=M(()=>import("../../../../../../../geometry/operators/gx/operatorIntersection.js")),C=M(()=>import("../../../../../../../chunks/FlatGeometry.js"));function E(e,t,r){return i(`${e}${t}${r}`)}function O(e,t,r,s,o){return i(`${e}${t}${r}${s*2**(D-o)}`)}function T(e,t,r){return i(`${e}${t}${r}`)}function X(e,t,r,s,o){return i(`${e}${o}${t}${r*2**(D-s)}`)}const Y=e(e=>{let t=0;if(0===e)return 1/0;for(;!(e%2);)t++,e/=2;return t});class W extends j{constructor(){super(...arguments),this._zoomLevel=0}async loadDependencies(){await Promise.all([super.loadDependencies(),k.getImportPromise(),C.getImportPromise()])}_write(e,{target:t,effectGeometry:i,level:r,viewExtent:s}){if(this._zoomLevel=r,null!=i)throw new Error("InternalError: EffectGeometry not support for LabelMeshWriter");switch(t.geometryType){case"esriGeometryPoint":{const i=t.readXForDisplay(),r=t.readYForDisplay();this._writePoint(e,i,r,0,t);break}case"esriGeometryEnvelope":case"esriGeometryPolygon":this._writePolygon(e,t,s);break;case"esriGeometryMultipoint":{let i=0;const r=y.fromFeatureSetReader(t);if(r?.nextPath())for(;r.nextPoint();)this._writePoint(e,r.x,r.y,i++,t);break}case"esriGeometryPolyline":this._writeLines(e,t)}}_getMetricDir(){const{horizontalAlignment:e,verticalAlignment:t}=this.evaluatedMeshParams;return["center"===e?0:"right"===e?-1:1,"middle"===t?0:"bottom"===t?-1:1]}_createLineLabelMetric(e,t,i,r,s,o){const[n,a]=this._getMetricDir(),l=this.evaluatedMeshParams.scaleInfo?.maxScale??0,c=this.evaluatedMeshParams.scaleInfo?.minScale??0,h=this.evaluatedMeshParams.labelClassId;return new I(e,h,t,i,r,s,n,a,l,c,o)}_writePolygon(e,t,i){const r=k.module,s=C.module.constructFromFlatGeometry,o=t.readGeometryForDisplay()?.justXY(),n=t.readCentroidForDisplay()?.coords,a=o?.area()||0;if(!n)return;const l=a>=$;e.requiresRefresh||=l;const c=s(f(i)),h=s(f({x:n[0],y:n[1]})),m=!!r.execute(h,c,null);if(!o||!l||!m)return void this._writePoint(e,n[0],n[1],0,t);const u=s(g("polygon",o,null)),d=r.execute(u,c,null);if(!d)return void this._writePoint(e,n[0],n[1],0,t);const P=p(new _(d.toFlatGeometry())),v=y.fromOptimized(P,"esriGeometryPolygon",1),b=x(v)??n;this._writePoint(e,b[0],b[1],0,t)}_writePoint(e,t,i,r,s){if(t<0||t>w||i<0||i>w)return;const o=this._getShaping();if(!o)return;const n=s.getDisplayId(),a=this.evaluatedMeshParams.labelClassId,l=E(this.evaluatedMeshParams.layerId,s.getObjectId(),r),c=T(s.getObjectId(),a,r),[h,m]=this._getMetricDir(),u=this.evaluatedMeshParams.scaleInfo?.maxScale??0,d=this.evaluatedMeshParams.scaleInfo?.minScale??0,f=this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0};e.metricStart(new I(n,a,l,c,t,i,h,m,u,d,f)),this._writeGlyphs(e,n,t,i,o,0,f,void 0,!1),e.metricBoxWrite(o.boundsT),e.metricEnd()}_getPointReferenceBounds(){if(!this._references)return null;for(const e of this._references){const t=e.getBoundsInfo();if(t)return t}return null}_writeLines(e,t){const{scaleInfo:i,verticalAlignment:r}=this.evaluatedMeshParams,s=this.evaluatedMeshParams.repeatLabelDistance||128,o=this._getShaping("middle");if(!o)return;const n=(e,t,i,r)=>this._placeSubdivGlyphs(e,t,i,r),a=(o.bounds.width+s)/(1<<A);this._current={out:e,id:t.getDisplayId(),objId:t.getObjectId(),shaping:o,zoomRange:z(i,this.getTileInfo()),referenceBounds:this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0},offsetDirection:null,pathIndex:0},this._verticalPlacement="bottom"===r?"above":"top"===r?"below":null,this._verticalPlacement?this._writeAboveAndBelowAlong(t,n,a):this._writeCenterAlong(t,n,a)}_writeAboveAndBelowAlong(e,t,i){const{repeatLabel:r}=this.evaluatedMeshParams,{shaping:s}=this._current,o=s.bounds.halfHeight,n=e.readGeometryForDisplay()?.justXY();if(!n)return;const a=P(n,"esriGeometryPolyline",1)??new b,l=Z(a,o),c=Z(a,-o),h=v(c,"esriGeometryPolyline",!1,!1),m=v(l,"esriGeometryPolyline",!1,!1),u=B(m.paths,s.bounds.width),d=B(h.paths,s.bounds.width);this._current.offsetDirection="above";for(let f=0;f<u.length;f++)this._current.pathIndex=f,S(u[f],i,t,!!r);this._current.offsetDirection="below";for(let f=0;f<d.length;f++)this._current.pathIndex=f,S(d[f],i,t,!!r)}_writeCenterAlong(e,t,i){const{repeatLabel:r}=this.evaluatedMeshParams,{shaping:s}=this._current,o=B(e.readLegacyGeometryForDisplay().paths,s.bounds.width);for(let n=0;n<o.length;n++)this._current.pathIndex=n,S(o[n],i,t,!!r)}_placeSubdivGlyphs(e,t,i,r){const{allowOverrun:s,labelPosition:o,repeatLabelDistance:n,layerId:a,labelClassId:l}=this.evaluatedMeshParams,{objId:c,shaping:h,pathIndex:m}=this._current,u=this._current.zoomRange[0],d=Y(t),f=this._current.shaping.bounds.width/(1<<A),g=Math.sqrt(n||R)/(1<<A),p=Math.min(i,r-i),_=h.isMultiline?D:Math.log2(p/(g+f/2)),y=0===t?_:Math.min(d,_),x=Math.max(u,this._zoomLevel+A-y),P=this._zoomLevel-x,v=h.bounds.width/2*2**P,b=O(a,c,m,t,this._zoomLevel),M=X(c,m,t,this._zoomLevel,l);this._current.shaping.isMultiline?0===t&&this._placeStraight(e,x,b,M):s&&P<0?this._placeStraightAlong(e,u,b,M):"parallel"===o?this._placeStraightAlong(e,x,b,M):"curved"===o&&this._placeCurved(e,x,v,b,M)}_placeStraight(e,t,i,r){const{out:s,id:o,shaping:n,referenceBounds:a}=this._current,{x:l,y:c}=e;s.metricStart(this._createLineLabelMetric(o,i,r,l,c)),s.metricBoxWrite(n.boundsT);const h=e.angle*(180/Math.PI)%360,m=(e.angle*(180/Math.PI)+180)%360;if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const e={clipAngle:h,mapAligned:!0,isLineLabel:!0,minZoom:t};this._writeGlyphs(s,o,l,c,n,0,a,e,!1)}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const e={clipAngle:m,mapAligned:!0,isLineLabel:!0,minZoom:t};this._writeGlyphs(s,o,l,c,n,0,a,e,!1)}s.metricEnd()}_placeCurved(e,t,i,r,s){const{out:o,id:n}=this._current;o.metricStart(this._createLineLabelMetric(n,r,s,e.x,e.y));const a=e.clone(),l=e.angle*(180/Math.PI)%360,c=(e.angle*(180/Math.PI)+180)%360;this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||(this._placeFirst(a,t,1,l),this._placeBack(e,a,t,i,1,l),this._placeForward(e,a,t,i,1,l)),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||(this._placeFirst(a,t,0,c),this._placeBack(e,a,t,i,0,c),this._placeForward(e,a,t,i,0,c)),o.metricEnd()}_placeStraightAlong(e,i,n,a){const{out:l,id:c,shaping:h,zoomRange:m,referenceBounds:d}=this._current,{boxBorderLineColor:f,boxBackgroundColor:g}=this.evaluatedMeshParams,p=e.clone(),_=e.angle*(180/Math.PI)%360,y=(e.angle*(180/Math.PI)+180)%360,x=h.glyphs.length>0&&!(!f&&!g);if(l.metricStart(this._createLineLabelMetric(c,n,a,e.x,e.y)),x){const n=Math.max(i,m[0],0),a=Math.min(D,m[1]),f=r(o(),-e.angle),g={minZoom:n,maxZoom:a,clipAngle:_,mapAligned:!0,isLineLabel:!0},p=t(this.evaluatedMeshParams.offsetX),x=t(this.evaluatedMeshParams.offsetY);if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const t=u(p,-1*x),[i,r]=h.shapeBackground(s(o(),f,t));l.recordStart(this.instanceId,this.attributeLayout,h.glyphs[0].textureBinding),this._writeTextBox(l,c,e.x,e.y,r,d,g),l.recordEnd()}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const t=u(p,x),[i,r]=h.shapeBackground(s(o(),f,t));g.clipAngle=y,l.recordStart(this.instanceId,this.attributeLayout,h.glyphs[0].textureBinding),this._writeTextBox(l,c,e.x,e.y,r,d,g),l.recordEnd()}}this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||this._placeFirst(p,i,1,_,!0),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||this._placeFirst(p,i,0,y,!0),l.metricEnd()}_placeBack(e,t,i,r,s,o){const n=e.clone();let a=e.backwardLength+F;for(;n.prev()&&!(a>=r);)this._placeOnSegment(n,t,a,i,-1,s,o),a+=n.length+F}_placeForward(e,t,i,r,s,o){const n=e.clone();let a=e.remainingLength+F;for(;n.next()&&!(a>=r);)this._placeOnSegment(n,t,a,i,1,s,o),a+=n.length+F}_placeFirst(e,t,i,r,s=!1){const{out:o,id:n,shaping:a,zoomRange:l,referenceBounds:c}=this._current,h=a.glyphs,m=this._getBoundsOffset(e.angle);for(const u of h){const h=u.x>a.bounds.x?i:1-i,d=h*e.remainingLength+(1-h)*e.backwardLength,f=Math.abs(u.x+u.width/2-a.bounds.x),g=Math.max(0,this._zoomLevel+Math.log2(f/(d+F))),p=Math.max(t,s?0:g);u.angle=e.angle+(1-i)*Math.PI;const _=[Math.max(l[0],p),Math.min(l[1],D)];this._writeLineGlyph(o,n,e.x,e.y,u,_,r,c),this._writeLineGlyphBox(o,u,i,_,m)}}_placeOnSegment(e,t,i,r,s,o,n){const{out:a,id:l,shaping:c,referenceBounds:h}=this._current,m=c.glyphs,u=e.dx/e.length,d=e.dy/e.length,f={x:e.x+i*-s*u,y:e.y+i*-s*d},g=this._getBoundsOffset(e.angle);for(const p of m){const t=p.x>c.bounds.x?o:1-o;if(!(t&&1===s||!t&&-1===s))continue;const m=Math.abs(p.x+p.width/2-c.bounds.x),u=Math.max(0,this._zoomLevel+Math.log2(m/i)-.1),d=Math.max(r,this._zoomLevel+Math.log2(m/(i+e.length+F)));if(0===u)continue;p.angle=e.angle+(1-o)*Math.PI;const _=[d,u];this._writeLineGlyph(a,l,f.x,f.y,p,_,n,h),this._writeLineGlyphBox(a,p,o,_,g)}}_getBoundsOffset(e){const i=t(this.evaluatedMeshParams.offsetX),s=t(this.evaluatedMeshParams.offsetY),a=u(i,s),l=r(o(),-e);return n(a,a,l)}_writeLineGlyph(e,t,i,r,s,o,n,a){if(i<0||i>w||r<0||r>w)return;e.recordStart(this.instanceId,this.attributeLayout,s.textureBinding);const{texcoords:l,offsets:c}=s,{fontSize:h,haloSize:m,outlineSize:u}=this._textMeshTransformProps,{sdfSize:d,sdfRadius:f}=this.evaluatedMeshParams.glyphs;this._writeQuad(e,t,i,r,{sdfSize:d,sdfRadius:f,texcoords:l,offsets:c,fontSize:h,haloSize:m,outlineSize:u,color:G(this.evaluatedMeshParams.color),isBackground:!1,referenceBounds:a,minZoom:Math.max(this._current.zoomRange[0],o[0]),maxZoom:Math.min(this._current.zoomRange[1],o[1]),clipAngle:n,mapAligned:!0,isLineLabel:!0}),e.recordEnd()}_writeLineGlyphBox(e,t,i,r,s){if((i||this._current.offsetDirection)&&this._isVisible(r)&&t.bounds){const i=t.bounds,r=new L(i.x+s[0],i.y+s[1],i.width,i.height);e.metricBoxWrite(r)}}_isVisible(e){const t=Math.max(this._current.zoomRange[0],e[0]),i=Math.min(this._current.zoomRange[1],e[1]),r=this._zoomLevel;return t<=r&&r<=i}}function Z(e,t){const i=new b,{coords:r,lengths:s}=e,o=d(),n=d(),u=d(),f=d(),g=d(),p=d(),_=2;let y=0;for(let d=0;d<s.length;d++){const e=s[d];for(let s=0;s<e;s++){const d=_*(s+y-1),x=_*(s+y),P=_*(s+y+1);s>0?a(o,r[d],r[d+1]):a(o,0,0),a(n,r[x],r[x+1]),s<e-1?a(u,r[P],r[P+1]):a(u,0,0),0===s?a(f,0,0):(l(f,n,o),c(f,f),a(f,f[1],-f[0])),s===e-1?a(g,0,0):(l(g,u,n),c(g,g),a(g,g[1],-g[0])),h(p,f,g),c(p,p);const v=p[0]*g[0]+p[1]*g[1];0!==v&&m(p,p,v),m(p,p,t),i.coords.push(n[0]+p[0],n[1]+p[1])}i.lengths.push(e),y+=e}return i}export{W as LabelMeshWriter,E as labelIdHash,T as labelMetricHash,O as lineLabelIdHash,X as lineLabelMetricHash};
2
+ import{memoize as e}from"../../../../../../../core/MapUtils.js";import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{numericHash as i}from"../../../../../../../core/string.js";import{fromRotation as r,translate as s}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as o}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as n,set as a,sub as l,normalize as c,add as h,scale as m}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as u}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{create as d}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{convertGeometryToFlat as f,convertOptimizedGeometryToFlat as g,convertFlatToOptimizedGeometry as p,FlatGeometry as _}from"../../../../../../../geometry/FlatGeometry.js";import{GeometryCursor as y}from"../../../../../../../geometry/GeometryCursor.js";import{getLabelPoint as x}from"../../../../../../../geometry/support/labelPoint.js";import{generalizeOptimizedGeometry as P,convertToGeometry as v}from"../../../../../../../layers/graphics/featureConversionUtils.js";import b from"../../../../../../../layers/graphics/OptimizedGeometry.js";import{importLazily as M}from"../../../../../../../symbols/cim/utils.js";import{tileSize as w}from"../../../definitions.js";import L from"../../../collisions/BoundingBox.js";import{LabelMetric as I}from"../../../collisions/LabelMetric.js";import{smoothPaths as B,pathDivide as S}from"../../../mesh/templates/segmentUtils.js";import{getMinMaxZoom as z,processColorInput as G}from"../fill/meshWriterUtils.js";import{TextMeshWriter as j,maxLabelZoom as D}from"../text/TextMeshWriter.js";const A=1,F=0,R=128,$=w*w/16,k=M(()=>import("../../../../../../../geometry/operators/gx/operatorIntersection.js")),C=M(()=>import("../../../../../../../chunks/FlatGeometry.js"));function E(e,t,r){return i(`${e}${t}${r}`)}function O(e,t,r,s,o){return i(`${e}${t}${r}${s*2**(D-o)}`)}function T(e,t,r){return i(`${e}${t}${r}`)}function X(e,t,r,s,o){return i(`${e}${o}${t}${r*2**(D-s)}`)}const Y=e(e=>{let t=0;if(0===e)return 1/0;for(;!(e%2);)t++,e/=2;return t});class W extends j{constructor(){super(...arguments),this._zoomLevel=0}async loadDependencies(){await Promise.all([super.loadDependencies(),k.getImportPromise(),C.getImportPromise()])}_write(e,{target:t,effectGeometry:i,level:r,viewExtent:s}){if(this._zoomLevel=r,null!=i)throw new Error("InternalError: EffectGeometry not support for LabelMeshWriter");switch(t.geometryType){case"esriGeometryPoint":{const i=t.readXForDisplay(),r=t.readYForDisplay();this._writePoint(e,i,r,0,t);break}case"esriGeometryEnvelope":case"esriGeometryPolygon":this._writePolygon(e,t,s);break;case"esriGeometryMultipoint":{let i=0;const r=y.fromFeatureSetReader(t);if(r?.nextPath())for(;r.nextPoint();)this._writePoint(e,r.x,r.y,i++,t);break}case"esriGeometryPolyline":this._writeLines(e,t)}}_getMetricDir(){const{horizontalAlignment:e,verticalAlignment:t}=this.evaluatedMeshParams;return["center"===e?0:"right"===e?-1:1,"middle"===t?0:"bottom"===t?-1:1]}_createLineLabelMetric(e,t,i,r,s,o){const[n,a]=this._getMetricDir(),l=this.evaluatedMeshParams.scaleInfo?.maxScale??0,c=this.evaluatedMeshParams.scaleInfo?.minScale??0,h=this.evaluatedMeshParams.labelClassId;return new I(e,h,t,i,r,s,n,a,l,c,o)}_writePolygon(e,t,i){const r=k.module,s=C.module.constructFromFlatGeometry,o=t.readGeometryForDisplay()?.justXY(),n=t.readCentroidForDisplay()?.coords,a=o?.area()||0;if(!n)return;const l=a>=$;e.requiresRefresh||=l;const c=s(f(i)),h=s(f({x:n[0],y:n[1]})),m=!!r.execute(h,c,null);if(!o||!l||!m)return void this._writePoint(e,n[0],n[1],0,t);const u=s(g("polygon",o,null)),d=r.execute(u,c,null);if(!d)return void this._writePoint(e,n[0],n[1],0,t);const P=p(new _(d.toFlatGeometry())),v=y.fromOptimized(P,"esriGeometryPolygon",1),b=x(v)??n;this._writePoint(e,b[0],b[1],0,t)}_writePoint(e,t,i,r,s){if(t<0||t>w||i<0||i>w)return;const o=this._getShaping();if(!o)return;const n=s.getDisplayId(),a=this.evaluatedMeshParams.labelClassId,l=E(this.evaluatedMeshParams.layerId,s.getObjectId(),r),c=T(s.getObjectId(),a,r),[h,m]=this._getMetricDir(),u=this.evaluatedMeshParams.scaleInfo?.maxScale??0,d=this.evaluatedMeshParams.scaleInfo?.minScale??0,f=this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0};e.metricStart(new I(n,a,l,c,t,i,h,m,u,d,f)),this._writeGlyphs(e,n,t,i,o,0,f,void 0,!1),e.metricBoxWrite(o.boundsT),e.metricEnd()}_getPointReferenceBounds(){if(!this._references)return null;for(const e of this._references){const t=e.getBoundsInfo();if(t)return t}return null}_writeLines(e,t){const{scaleInfo:i,verticalAlignment:r}=this.evaluatedMeshParams,s=this.evaluatedMeshParams.repeatLabelDistance||128,o=this._getShaping("middle");if(!o)return;const n=(e,t,i,r)=>this._placeSubdivGlyphs(e,t,i,r),a=(o.bounds.width+s)/(1<<A);this._current={out:e,id:t.getDisplayId(),objId:t.getObjectId(),shaping:o,zoomRange:z(i,this.getTileInfo()),referenceBounds:this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0},offsetDirection:null,pathIndex:0},this._verticalPlacement="bottom"===r?"above":"top"===r?"below":null,this._verticalPlacement?this._writeAboveAndBelowAlong(t,n,a):this._writeCenterAlong(t,n,a)}_writeAboveAndBelowAlong(e,t,i){const{repeatLabel:r}=this.evaluatedMeshParams,{shaping:s}=this._current,o=s.bounds.halfHeight,n=e.readGeometryForDisplay()?.justXY();if(!n)return;const a=P(n,"esriGeometryPolyline",1)??new b,l=Z(a,o),c=Z(a,-o),h=v(c,"esriGeometryPolyline",!1,!1),m=v(l,"esriGeometryPolyline",!1,!1),u=B(m.paths,s.bounds.width),d=B(h.paths,s.bounds.width);this._current.offsetDirection="above";for(let f=0;f<u.length;f++)this._current.pathIndex=f,S(u[f],i,t,!!r);this._current.offsetDirection="below";for(let f=0;f<d.length;f++)this._current.pathIndex=f,S(d[f],i,t,!!r)}_writeCenterAlong(e,t,i){const{repeatLabel:r}=this.evaluatedMeshParams,{shaping:s}=this._current,o=B(e.readLegacyGeometryForDisplay().paths,s.bounds.width);for(let n=0;n<o.length;n++)this._current.pathIndex=n,S(o[n],i,t,!!r)}_placeSubdivGlyphs(e,t,i,r){const{allowOverrun:s,labelPosition:o,repeatLabelDistance:n,layerId:a,labelClassId:l}=this.evaluatedMeshParams,{objId:c,shaping:h,pathIndex:m}=this._current,u=this._current.zoomRange[0],d=Y(t),f=this._current.shaping.bounds.width/(1<<A),g=Math.sqrt(n||R)/(1<<A),p=Math.min(i,r-i),_=h.isMultiline?D:Math.log2(p/(g+f/2)),y=0===t?_:Math.min(d,_),x=Math.max(u,this._zoomLevel+A-y),P=this._zoomLevel-x,v=h.bounds.width/2*2**P,b=O(a,c,m,t,this._zoomLevel),M=X(c,m,t,this._zoomLevel,l);this._current.shaping.isMultiline?0===t&&this._placeStraight(e,x,b,M):s&&P<0?this._placeStraightAlong(e,u,b,M):"parallel"===o?this._placeStraightAlong(e,x,b,M):"curved"===o&&this._placeCurved(e,x,v,b,M)}_placeStraight(e,t,i,r){const{out:s,id:o,shaping:n,referenceBounds:a}=this._current,{x:l,y:c}=e;s.metricStart(this._createLineLabelMetric(o,i,r,l,c)),s.metricBoxWrite(n.boundsT);const h=e.angle*(180/Math.PI)%360,m=(e.angle*(180/Math.PI)+180)%360;if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const e={clipAngle:h,mapAligned:!0,isLineLabel:!0,minZoom:t};this._writeGlyphs(s,o,l,c,n,0,a,e,!1)}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const e={clipAngle:m,mapAligned:!0,isLineLabel:!0,minZoom:t};this._writeGlyphs(s,o,l,c,n,0,a,e,!1)}s.metricEnd()}_placeCurved(e,t,i,r,s){const{out:o,id:n}=this._current;o.metricStart(this._createLineLabelMetric(n,r,s,e.x,e.y));const a=e.clone(),l=e.angle*(180/Math.PI)%360,c=(e.angle*(180/Math.PI)+180)%360;this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||(this._placeFirst(a,t,1,l),this._placeBack(e,a,t,i,1,l),this._placeForward(e,a,t,i,1,l)),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||(this._placeFirst(a,t,0,c),this._placeBack(e,a,t,i,0,c),this._placeForward(e,a,t,i,0,c)),o.metricEnd()}_placeStraightAlong(e,i,n,a){const{out:l,id:c,shaping:h,zoomRange:m,referenceBounds:d}=this._current,{boxBorderLineColor:f,boxBackgroundColor:g}=this.evaluatedMeshParams,p=e.clone(),_=e.angle*(180/Math.PI)%360,y=(e.angle*(180/Math.PI)+180)%360,x=h.glyphs.length>0&&!(!f&&!g);if(l.metricStart(this._createLineLabelMetric(c,n,a,e.x,e.y)),x){const n=Math.max(i,m[0],0),a=Math.min(D,m[1]),f=r(o(),-e.angle),g={minZoom:n,maxZoom:a,clipAngle:_,mapAligned:!0,isLineLabel:!0},p=t(this.evaluatedMeshParams.offsetX),x=t(this.evaluatedMeshParams.offsetY);if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const t=u(p,-1*x),[i,r]=h.shapeBackground(s(o(),f,t));l.recordStart(this.instanceId,this.attributeLayout,h.glyphs[0].textureBinding),this._writeTextBox(l,c,e.x,e.y,r,d,g),l.recordEnd()}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const t=u(p,x),[i,r]=h.shapeBackground(s(o(),f,t));g.clipAngle=y,l.recordStart(this.instanceId,this.attributeLayout,h.glyphs[0].textureBinding),this._writeTextBox(l,c,e.x,e.y,r,d,g),l.recordEnd()}}this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||this._placeFirst(p,i,1,_,!0),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||this._placeFirst(p,i,0,y,!0),l.metricEnd()}_placeBack(e,t,i,r,s,o){const n=e.clone();let a=e.backwardLength+F;for(;n.prev()&&!(a>=r);)this._placeOnSegment(n,t,a,i,-1,s,o),a+=n.length+F}_placeForward(e,t,i,r,s,o){const n=e.clone();let a=e.remainingLength+F;for(;n.next()&&!(a>=r);)this._placeOnSegment(n,t,a,i,1,s,o),a+=n.length+F}_placeFirst(e,t,i,r,s=!1){const{out:o,id:n,shaping:a,zoomRange:l,referenceBounds:c}=this._current,h=a.glyphs,m=this._getBoundsOffset(e.angle);for(const u of h){const h=u.x>a.bounds.x?i:1-i,d=h*e.remainingLength+(1-h)*e.backwardLength,f=Math.abs(u.x+u.width/2-a.bounds.x),g=Math.max(0,this._zoomLevel+Math.log2(f/(d+F))),p=Math.max(t,s?0:g);u.angle=e.angle+(1-i)*Math.PI;const _=[Math.max(l[0],p),Math.min(l[1],D)];this._writeLineGlyph(o,n,e.x,e.y,u,_,r,c),this._writeLineGlyphBox(o,u,i,_,m)}}_placeOnSegment(e,t,i,r,s,o,n){const{out:a,id:l,shaping:c,referenceBounds:h}=this._current,m=c.glyphs,u=e.dx/e.length,d=e.dy/e.length,f={x:e.x+i*-s*u,y:e.y+i*-s*d},g=this._getBoundsOffset(e.angle);for(const p of m){const t=p.x>c.bounds.x?o:1-o;if(!(t&&1===s||!t&&-1===s))continue;const m=Math.abs(p.x+p.width/2-c.bounds.x),u=Math.max(0,this._zoomLevel+Math.log2(m/i)-.1),d=Math.max(r,this._zoomLevel+Math.log2(m/(i+e.length+F)));if(0===u)continue;p.angle=e.angle+(1-o)*Math.PI;const _=[d,u];this._writeLineGlyph(a,l,f.x,f.y,p,_,n,h),this._writeLineGlyphBox(a,p,o,_,g)}}_getBoundsOffset(e){const i=t(this.evaluatedMeshParams.offsetX),s=t(this.evaluatedMeshParams.offsetY),a=u(i,s),l=r(o(),-e);return n(a,a,l)}_writeLineGlyph(e,t,i,r,s,o,n,a){if(i<0||i>w||r<0||r>w)return;e.recordStart(this.instanceId,this.attributeLayout,s.textureBinding);const{texcoords:l,offsets:c}=s,{fontSize:h,haloSize:m,outlineSize:u}=this._textMeshTransformProps,d=this._getDefaultGlyphMetrics(this.evaluatedMeshParams.glyphs),f=s.fontSize??h;this._writeQuad(e,t,i,r,{sdfSize:d.sdfSize,sdfRadius:d.sdfRadius,texcoords:l,offsets:c,fontSize:f,haloSize:m,outlineSize:u,color:s.color?G(s.color):G(this.evaluatedMeshParams.color),isBackground:!1,referenceBounds:a,minZoom:Math.max(this._current.zoomRange[0],o[0]),maxZoom:Math.min(this._current.zoomRange[1],o[1]),clipAngle:n,mapAligned:!0,isLineLabel:!0}),e.recordEnd()}_writeLineGlyphBox(e,t,i,r,s){if((i||this._current.offsetDirection)&&this._isVisible(r)&&t.bounds){const i=t.bounds,r=new L(i.x+s[0],i.y+s[1],i.width,i.height);e.metricBoxWrite(r)}}_isVisible(e){const t=Math.max(this._current.zoomRange[0],e[0]),i=Math.min(this._current.zoomRange[1],e[1]),r=this._zoomLevel;return t<=r&&r<=i}}function Z(e,t){const i=new b,{coords:r,lengths:s}=e,o=d(),n=d(),u=d(),f=d(),g=d(),p=d(),_=2;let y=0;for(let d=0;d<s.length;d++){const e=s[d];for(let s=0;s<e;s++){const d=_*(s+y-1),x=_*(s+y),P=_*(s+y+1);s>0?a(o,r[d],r[d+1]):a(o,0,0),a(n,r[x],r[x+1]),s<e-1?a(u,r[P],r[P+1]):a(u,0,0),0===s?a(f,0,0):(l(f,n,o),c(f,f),a(f,f[1],-f[0])),s===e-1?a(g,0,0):(l(g,u,n),c(g,g),a(g,g[1],-g[0])),h(p,f,g),c(p,p);const v=p[0]*g[0]+p[1]*g[1];0!==v&&m(p,p,v),m(p,p,t),i.coords.push(n[0]+p[0],n[1]+p[1])}i.lengths.push(e),y+=e}return i}export{W as LabelMeshWriter,E as labelIdHash,T as labelMetricHash,O as lineLabelIdHash,X as lineLabelMetricHash};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{clamp as t}from"../../../../../../../core/mathUtils.js";import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as o}from"../../../../../../../geometry/GeometryCursor.js";import{asCIMGeometryCursor as i}from"../../../../../../../symbols/cim/utils.js";import{CIMMarkerPlacementHelper as r}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{getXDirection as s,getYDirection as n}from"../../../alignmentUtils.js";import{labelU16ZoomPrecisionFactor as a,maxTextLineWidth as l,minTextLineWidth as c,magicLabelLineHeight as d,packDegreesU8 as h}from"../../../definitions.js";import{shapeGlyphs as f,shapeGlyphsForMultipoint as u}from"../../../mesh/templates/shapingUtils.js";import{getMinMaxZoom as p,processColorInput as m,packBitset as g}from"../fill/meshWriterUtils.js";import{MeshWriter as x}from"../mesh/MeshWriter.js";import{bitsetTextIsBackground as y,bitsetTextIsMapAligned as S}from"../shaders/constants.js";import{TextMeshTransformProps as z}from"./TextParams.js";import{DataType as b}from"../../../../../../webgl/enums.js";const _=28,P=[4,4],M=[16,4],R={topLeft:M,topRight:M,bottomLeft:M,bottomRight:M},B=[4,2],L=[4,6],T={topLeft:B,topRight:B,bottomLeft:L,bottomRight:L},k={topLeft:B,topRight:L,bottomLeft:B,bottomRight:L},v={topLeft:L,topRight:L,bottomLeft:P,bottomRight:P},A={topLeft:P,topRight:P,bottomLeft:L,bottomRight:L},w={topLeft:L,topRight:P,bottomLeft:L,bottomRight:P},I={topLeft:P,topRight:L,bottomLeft:P,bottomRight:L};function C(t){return{backgroundColor:t.boxBackgroundColor??t.backgroundColor??null,borderLineColor:t.boxBorderLineColor??t.borderLineColor??null,borderLineSize:t.boxBorderLineSize>0?t.boxBorderLineSize:t.borderLineWidth??0}}const G={createComputedParams:t=>t,optionalAttributes:{zoomRange:{type:b.UNSIGNED_SHORT,count:2,packPrecisionFactor:a,packTessellation:({minZoom:t,maxZoom:e})=>[t||0,e||_]},clipAngle:{type:b.UNSIGNED_BYTE,count:1,packTessellation:({clipAngle:t})=>N(t||0)},referenceSymbol:{type:b.BYTE,count:4,packTessellation:(t,o)=>{const i=t.isLineLabel||!t.referenceBounds,r=s(i?"center":o.horizontalAlignment),a=n(i?"middle":o.verticalAlignment),{offsetX:l,offsetY:c,size:d}=i?{offsetX:0,offsetY:0,size:0}:t.referenceBounds;return[e(l),-e(c),Math.round(e(d)),r+1<<2|a+1]}},visibility:{type:b.FLOAT,count:1,otherSource:!0}},attributes:{pos:{type:b.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:b.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:b.UNSIGNED_BYTE,count:1,packTessellation:({isBackground:t,mapAligned:e})=>g([[y,t],[S,!!e]])},offset:{type:b.SHORT,count:2,packPrecisionFactor:8,packAlternating:{count:4,packTessellation:({offsets:t})=>{const{bottomLeft:e,bottomRight:o,topLeft:i,topRight:r}=t;return[i,r,e,o]}}},textureUV:{type:b.UNSIGNED_SHORT,count:2,packAlternating:{count:4,packTessellation:({texcoords:t})=>{const{bottomLeft:e,bottomRight:o,topLeft:i,topRight:r}=t;return[i,r,e,o]}}},color:{type:b.UNSIGNED_BYTE,count:4,normalized:!0,packTessellation:({color:t})=>t},fontAndReferenceSize:{type:b.UNSIGNED_SHORT,count:4,packPrecisionFactor:4,packTessellation:({fontSize:t,sdfSize:o,sdfRadius:i},{referenceSize:r})=>[Math.round(e(t)),Math.round(e(r||t)),o,i]},outlineColor:{type:b.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:t})=>m(t)},haloColor:{type:b.UNSIGNED_BYTE,count:4,normalized:!0,pack:({haloColor:t})=>m(t)},outlineAndHaloSize:{type:b.UNSIGNED_SHORT,count:2,packPrecisionFactor:4,packTessellation:({outlineSize:t,haloSize:o})=>[Math.round(e(t)),Math.round(e(o))]}}};class E extends x{constructor(){super(...arguments),this.vertexSpec=G,this._textMeshParamsPropsInitialized=!1}ensurePacked(t,e,o){super.ensurePacked(t,e,o),this._textMeshParamsPropsInitialized&&!this._evaluator.hasDynamicProperties||(this._textMeshTransformProps=new z(this.evaluatedMeshParams),this._textMeshParamsPropsInitialized=!0)}_write(t,{target:e,effectGeometry:o}){const r=this._getShaping();if(!r)return;const s=1===this.evaluatedMeshParams.alignment,n=e.getDisplayId(),{placement:a}=this.evaluatedMeshParams;if(null!=a){if("PrivatePlacementMultipoint"!==a.type)this._writePlacedTextMarkers(t,e,r,i(o));else{const r=this._getMultipointShaping();r&&this._writeMultipointText(t,e,r,i(o))}return}if(o?.nextPath())return o.nextPoint(),this._writeGlyphs(t,n,o.x,o.y,r,0,void 0,{mapAligned:s});if("esriGeometryPolygon"===e.geometryType){const o=e.readCentroidForDisplay();if(!o)return;const[i,a]=o.coords;return this._writeGlyphs(t,n,i,a,r,0,void 0,{mapAligned:s})}if("esriGeometryMultipoint"===e.geometryType){const o=e.readGeometryForDisplay();return void o?.forEachVertex((e,o)=>this._writeGlyphs(t,n,e,o,r,0,void 0,{mapAligned:s}))}const l=e.readXForDisplay(),c=e.readYForDisplay();return this._writeGlyphs(t,n,l,c,r,0,void 0,{mapAligned:s})}_writePlacedTextMarkers(t,i,s,n){const a=n??o.fromFeatureSetReaderCIM(i);if(!a)return;const l=-1,c=r.getPlacement(a,l,this.evaluatedMeshParams.placement,e(1),t.id);if(!c)return;const d=i.getDisplayId();let h=c.next();for(;null!=h;){const e=-h.getAngle(),o=h.tx,i=-h.ty;this._writeGlyphs(t,d,o,i,s,e,void 0,{mapAligned:1===this.evaluatedMeshParams.alignment}),h=c.next()}}_writeMultipointText(t,i,s,n){const a=n??o.fromFeatureSetReaderCIM(i);if(!a)return;const l=-1,c=r.getPlacement(a,l,this.evaluatedMeshParams.placement,e(1),t.id);if(!c)return;const d=i.getDisplayId();let h=c.next(),f=0;for(;null!=h;){const e=h.tx,o=-h.ty,i=-h.getAngle();if(f>=s.glyphs.length)break;this._writeGlyph(t,d,e,o,s,f,i,void 0,{mapAligned:1===this.evaluatedMeshParams.alignment}),h=c.next(),f++}}_getShaping(o){const i=this._textMeshTransformProps,r=this.evaluatedMeshParams;if(!r.glyphs?.glyphs.length)return null;const s=e(i.fontSize),n=e(i.offsetX),a=e(i.offsetY),h=r.glyphs.sdfSize,u=t(e(r.lineWidth),c,l),p=h/24*d*t(r.lineHeightRatio,.25,4),{backgroundColor:m,borderLineSize:g}=C(r);return f(r.glyphs,{scale:s/h,angle:i.postAngle,xOffset:n,yOffset:a,horizontalAlignment:r.horizontalAlignment,verticalAlignment:o||r.verticalAlignment,maxLineWidth:u,lineHeight:p,decoration:r.decoration,borderLineSizePx:e(g),hasBackground:!!m,useCIMAngleBehavior:r.useCIMAngleBehavior})}_getMultipointShaping(){const o=this._textMeshTransformProps,i=this.evaluatedMeshParams;if(!i.glyphs?.glyphs.length)return null;const r=e(o.fontSize),s=e(o.offsetX),n=e(o.offsetY),a=i.glyphs.sdfSize,h=t(e(i.lineWidth),c,l),f=a/24*d*t(i.lineHeightRatio,.25,4),{backgroundColor:p,borderLineSize:m}=C(i);return u(i.glyphs,{scale:r/a,angle:o.postAngle,xOffset:s,yOffset:n,horizontalAlignment:i.horizontalAlignment,verticalAlignment:i.verticalAlignment,maxLineWidth:h,lineHeight:f,decoration:i.decoration,borderLineSizePx:e(m),hasBackground:!!p,useCIMAngleBehavior:i.useCIMAngleBehavior})}_writeGlyphs(t,o,i,r,s,n,a,l,c=!0){const d=this.evaluatedMeshParams,h=this._textMeshTransformProps,f=e(h.fontSize),u=h.haloSize,g=h.outlineSize,x=e(h.offsetX),y=e(h.offsetY),{sdfSize:S,sdfRadius:z}=d.glyphs,[b,_]=p(d.scaleInfo,this.getTileInfo());0!==n&&s.setRotation(n);const P=s.bounds,M=i+P.x+x,R=r+P.y-y,B=2*(d.minPixelBuffer?d.minPixelBuffer/f:1),L=Math.max(P.width,P.height)*B;s.textBox&&(t.recordStart(this.instanceId,this.attributeLayout,s.glyphs[0].textureBinding),c&&t.recordBounds(M,R,L,L),this._writeTextBox(t,o,i,r,s.textBox,a,l),t.recordEnd());for(const e of s.glyphs){t.recordStart(this.instanceId,this.attributeLayout,e.textureBinding),c&&t.recordBounds(M,R,L,L);const{texcoords:s,offsets:n}=e;this._writeQuad(t,o,i,r,{texcoords:s,offsets:n,fontSize:f,haloSize:u,outlineSize:g,sdfSize:S,sdfRadius:z,color:m(d.color),isBackground:!1,referenceBounds:a,minZoom:b,maxZoom:_,...l}),t.recordEnd()}0!==n&&s.setRotation(-n)}_writeGlyph(t,o,i,r,s,n,a,l,c,d=!0){const h=this.evaluatedMeshParams,f=this._textMeshTransformProps,u=e(f.fontSize),p=f.haloSize,g=f.outlineSize,x=e(f.offsetX),y=e(f.offsetY),{sdfSize:S,sdfRadius:z}=h.glyphs;0!==a&&s.setRotation(a);const b=s.bounds,_=i+b.x+x,P=r+b.y-y,M=2*(h.minPixelBuffer?h.minPixelBuffer/u:1),R=Math.max(b.width,b.height)*M,B=s.glyphs[n];t.recordStart(this.instanceId,this.attributeLayout,B.textureBinding),d&&t.recordBounds(_,P,R,R);const{texcoords:L,offsets:T}=B;this._writeQuad(t,o,i,r,{texcoords:L,offsets:T,fontSize:u,haloSize:p,outlineSize:g,sdfSize:S,sdfRadius:z,color:m(h.color),isBackground:!1,referenceBounds:l,minZoom:0,maxZoom:30,...c}),t.recordEnd(),0!==a&&s.setRotation(-a)}_writeTextBox(t,e,o,i,r,s,n){const a=this.evaluatedMeshParams,{fontSize:l,haloSize:c,outlineSize:d}=this._textMeshTransformProps,{backgroundColor:h,borderLineColor:f,borderLineSize:u}=C(a),{sdfSize:p,sdfRadius:g}=a.glyphs,x=!!f&&u>0,y={isBackground:!0,fontSize:l,haloSize:c,outlineSize:d,referenceBounds:s,sdfSize:p,sdfRadius:g,...n};h&&(this._writeQuad(t,e,o,i,{texcoords:R,offsets:r.main,color:m(h),...y}),x||(this._writeQuad(t,e,o,i,{texcoords:v,offsets:r.top,color:m(h),...y}),this._writeQuad(t,e,o,i,{texcoords:A,offsets:r.bot,color:m(h),...y}),this._writeQuad(t,e,o,i,{texcoords:w,offsets:r.left,color:m(h),...y}),this._writeQuad(t,e,o,i,{texcoords:I,offsets:r.right,color:m(h),...y}))),x&&(this._writeQuad(t,e,o,i,{texcoords:T,offsets:r.top,color:m(f),...y}),this._writeQuad(t,e,o,i,{texcoords:T,offsets:r.bot,color:m(f),...y}),this._writeQuad(t,e,o,i,{texcoords:k,offsets:r.left,color:m(f),...y}),this._writeQuad(t,e,o,i,{texcoords:k,offsets:r.right,color:m(f),...y}))}_writeQuad(t,e,o,i,r){const s=t.vertexCount();this._writeVertex(t,e,o,i,r),t.indexWrite(s+0),t.indexWrite(s+1),t.indexWrite(s+2),t.indexWrite(s+1),t.indexWrite(s+3),t.indexWrite(s+2)}}const N=t=>Math.round(t*h);export{E as TextMeshWriter,G as TextVertexSpec,C as getTextBoxStyle,_ as maxLabelZoom};
2
+ import{clamp as t}from"../../../../../../../core/mathUtils.js";import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as o}from"../../../../../../../geometry/GeometryCursor.js";import{asCIMGeometryCursor as i}from"../../../../../../../symbols/cim/utils.js";import{CIMMarkerPlacementHelper as s}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{getXDirection as r,getYDirection as n}from"../../../alignmentUtils.js";import{labelU16ZoomPrecisionFactor as a,maxLineHeightRatio as l,minLineHeightRatio as h,maxTextLineWidth as c,minTextLineWidth as d,magicLabelLineHeight as f,packDegreesU8 as u}from"../../../definitions.js";import{shapeTextResource as p,shapeTextResourceForMultipoint as m}from"../../../mesh/templates/shapingUtils.js";import{processColorInput as g,getMinMaxZoom as y,packBitset as x}from"../fill/meshWriterUtils.js";import{MeshWriter as S}from"../mesh/MeshWriter.js";import{bitsetTextIsBackground as z,bitsetTextIsMapAligned as _}from"../shaders/constants.js";import{TextMeshTransformProps as b}from"./TextParams.js";import{DataType as M}from"../../../../../../webgl/enums.js";const P=28,R=[4,4],B=[16,4],L={topLeft:B,topRight:B,bottomLeft:B,bottomRight:B};function T(o){return null==o?c:t(e(o),d,c)}function k(e,o){return e/24*f*t(o,h,l)}const v=[4,2],A=[4,6],w={topLeft:v,topRight:v,bottomLeft:A,bottomRight:A},G={topLeft:v,topRight:A,bottomLeft:v,bottomRight:A},I={topLeft:A,topRight:A,bottomLeft:R,bottomRight:R},C={topLeft:R,topRight:R,bottomLeft:A,bottomRight:A},D={topLeft:A,topRight:R,bottomLeft:A,bottomRight:R},E={topLeft:R,topRight:A,bottomLeft:R,bottomRight:A};function N(t){return{backgroundColor:t.boxBackgroundColor??t.backgroundColor??null,borderLineColor:t.boxBorderLineColor??t.borderLineColor??null,borderLineSize:t.boxBorderLineSize>0?t.boxBorderLineSize:t.borderLineWidth??0}}const H={createComputedParams:t=>t,optionalAttributes:{zoomRange:{type:M.UNSIGNED_SHORT,count:2,packPrecisionFactor:a,packTessellation:({minZoom:t,maxZoom:e})=>[t||0,e||P]},clipAngle:{type:M.UNSIGNED_BYTE,count:1,packTessellation:({clipAngle:t})=>Y(t||0)},referenceSymbol:{type:M.BYTE,count:4,packTessellation:(t,o)=>{const i=t.isLineLabel||!t.referenceBounds,s=r(i?"center":o.horizontalAlignment),a=n(i?"middle":o.verticalAlignment),{offsetX:l,offsetY:h,size:c}=i?{offsetX:0,offsetY:0,size:0}:t.referenceBounds;return[e(l),-e(h),Math.round(e(c)),s+1<<2|a+1]}},visibility:{type:M.FLOAT,count:1,otherSource:!0}},attributes:{pos:{type:M.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:M.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:M.UNSIGNED_BYTE,count:1,packTessellation:({isBackground:t,mapAligned:e})=>x([[z,t],[_,!!e]])},offset:{type:M.SHORT,count:2,packPrecisionFactor:8,packAlternating:{count:4,packTessellation:({offsets:t})=>{const{bottomLeft:e,bottomRight:o,topLeft:i,topRight:s}=t;return[i,s,e,o]}}},textureUV:{type:M.UNSIGNED_SHORT,count:2,packAlternating:{count:4,packTessellation:({texcoords:t})=>{const{bottomLeft:e,bottomRight:o,topLeft:i,topRight:s}=t;return[i,s,e,o]}}},color:{type:M.UNSIGNED_BYTE,count:4,normalized:!0,packTessellation:({color:t})=>t},fontAndReferenceSize:{type:M.UNSIGNED_SHORT,count:4,packPrecisionFactor:4,packTessellation:({fontSize:t,sdfSize:o,sdfRadius:i},{referenceSize:s})=>[Math.round(e(t)),Math.round(e(s||t)),o,i]},outlineColor:{type:M.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:t})=>g(t)},haloColor:{type:M.UNSIGNED_BYTE,count:4,normalized:!0,pack:({haloColor:t})=>g(t)},outlineAndHaloSize:{type:M.UNSIGNED_SHORT,count:2,packPrecisionFactor:4,packTessellation:({outlineSize:t,haloSize:o})=>[Math.round(e(t)),Math.round(e(o))]}}};class U extends S{constructor(){super(...arguments),this.vertexSpec=H,this._textMeshParamsPropsInitialized=!1}ensurePacked(t,e,o){super.ensurePacked(t,e,o),this._textMeshParamsPropsInitialized&&!this._evaluator.hasDynamicProperties||(this._textMeshTransformProps=new b(this.evaluatedMeshParams),this._textMeshParamsPropsInitialized=!0)}_write(t,{target:e,effectGeometry:o}){const s=this._getShaping();if(!s)return;const r=1===this.evaluatedMeshParams.alignment,n=e.getDisplayId(),{placement:a}=this.evaluatedMeshParams;if(null!=a){if("PrivatePlacementMultipoint"!==a.type)this._writePlacedTextMarkers(t,e,s,i(o));else{const s=this._getMultipointShaping();s&&this._writeMultipointText(t,e,s,i(o))}return}if(o?.nextPath())return o.nextPoint(),this._writeGlyphs(t,n,o.x,o.y,s,0,void 0,{mapAligned:r});if("esriGeometryPolygon"===e.geometryType){const o=e.readCentroidForDisplay();if(!o)return;const[i,a]=o.coords;return this._writeGlyphs(t,n,i,a,s,0,void 0,{mapAligned:r})}if("esriGeometryMultipoint"===e.geometryType){const o=e.readGeometryForDisplay();return void o?.forEachVertex((e,o)=>this._writeGlyphs(t,n,e,o,s,0,void 0,{mapAligned:r}))}const l=e.readXForDisplay(),h=e.readYForDisplay();return this._writeGlyphs(t,n,l,h,s,0,void 0,{mapAligned:r})}_writePlacedTextMarkers(t,i,r,n){const a=n??o.fromFeatureSetReaderCIM(i);if(!a)return;const l=-1,h=s.getPlacement(a,l,this.evaluatedMeshParams.placement,e(1),t.id);if(!h)return;const c=i.getDisplayId();let d=h.next();for(;null!=d;){const e=-d.getAngle(),o=d.tx,i=-d.ty;this._writeGlyphs(t,c,o,i,r,e,void 0,{mapAligned:1===this.evaluatedMeshParams.alignment}),d=h.next()}}_writeMultipointText(t,i,r,n){const a=n??o.fromFeatureSetReaderCIM(i);if(!a)return;const l=-1,h=s.getPlacement(a,l,this.evaluatedMeshParams.placement,e(1),t.id);if(!h)return;const c=i.getDisplayId();let d=h.next(),f=0;for(;null!=d;){const e=d.tx,o=-d.ty,i=-d.getAngle();if(f>=r.glyphs.length)break;this._writeGlyph(t,c,e,o,r,f,i,void 0,{mapAligned:1===this.evaluatedMeshParams.alignment}),d=h.next(),f++}}_getShaping(o){const i=this._textMeshTransformProps,s=this.evaluatedMeshParams;if(!this._hasGlyphs(s.glyphs))return null;const r=e(i.fontSize),n=e(i.offsetX),a=e(i.offsetY),{sdfSize:c}=this._getDefaultGlyphMetrics(s.glyphs),d=T(s.lineWidth),f=k(c,s.lineHeightRatio),{backgroundColor:u,borderLineSize:m}=N(s);return p(s.glyphs,{scale:r/c,angle:i.postAngle,xOffset:n,yOffset:a,horizontalAlignment:s.horizontalAlignment,verticalAlignment:o||s.verticalAlignment,maxLineWidth:d,lineHeight:f,lineHeightRatio:t(s.lineHeightRatio,h,l),decoration:s.decoration,borderLineSizePx:e(m),hasBackground:!!u,useCIMAngleBehavior:s.useCIMAngleBehavior})}_getMultipointShaping(){const o=this._textMeshTransformProps,i=this.evaluatedMeshParams;if(!this._hasGlyphs(i.glyphs))return null;const s=e(o.fontSize),r=e(o.offsetX),n=e(o.offsetY),{sdfSize:a}=this._getDefaultGlyphMetrics(i.glyphs),c=T(i.lineWidth),d=k(a,i.lineHeightRatio),{backgroundColor:f,borderLineSize:u}=N(i);return m(i.glyphs,{scale:s/a,angle:o.postAngle,xOffset:r,yOffset:n,horizontalAlignment:i.horizontalAlignment,verticalAlignment:i.verticalAlignment,maxLineWidth:c,lineHeight:d,lineHeightRatio:t(i.lineHeightRatio,h,l),decoration:i.decoration,borderLineSizePx:e(u),hasBackground:!!f,useCIMAngleBehavior:i.useCIMAngleBehavior})}_hasGlyphs(t){return!!t&&("glyphs"===t.type?t.glyphs.length>0:t.runs.some(t=>t.glyphs.glyphs.length>0))}_getDefaultGlyphMetrics(t){if("glyphs"===t.type)return{sdfSize:t.sdfSize,sdfRadius:t.sdfRadius};const[e]=t.runs;return{sdfSize:e?.glyphs.sdfSize??24,sdfRadius:e?.glyphs.sdfRadius??8}}_writeGlyphs(t,o,i,s,r,n,a,l,h=!0){const c=this.evaluatedMeshParams,d=this._textMeshTransformProps,f=e(d.fontSize),u=d.haloSize,p=d.outlineSize,m=e(d.offsetX),x=e(d.offsetY),S=this._getDefaultGlyphMetrics(c.glyphs),z=g(c.color),[_,b]=y(c.scaleInfo,this.getTileInfo());0!==n&&r.setRotation(n);const M=r.bounds,P=i+M.x+m,R=s+M.y-x,B=2*(c.minPixelBuffer?c.minPixelBuffer/f:1),L=Math.max(M.width,M.height)*B;r.textBox&&(t.recordStart(this.instanceId,this.attributeLayout,r.glyphs[0].textureBinding),h&&t.recordBounds(P,R,L,L),this._writeTextBox(t,o,i,s,r.textBox,a,l),t.recordEnd());for(const e of r.glyphs){t.recordStart(this.instanceId,this.attributeLayout,e.textureBinding),h&&t.recordBounds(P,R,L,L);const{texcoords:r,offsets:n}=e,c=e.fontSize??f;this._writeQuad(t,o,i,s,{texcoords:r,offsets:n,fontSize:c,haloSize:u,outlineSize:p,sdfSize:S.sdfSize,sdfRadius:S.sdfRadius,color:e.color?g(e.color):z,isBackground:!1,referenceBounds:a,minZoom:_,maxZoom:b,...l}),t.recordEnd()}0!==n&&r.setRotation(-n)}_writeGlyph(t,o,i,s,r,n,a,l,h,c=!0){const d=this.evaluatedMeshParams,f=this._textMeshTransformProps,u=e(f.fontSize),p=f.haloSize,m=f.outlineSize,y=e(f.offsetX),x=e(f.offsetY),S=this._getDefaultGlyphMetrics(d.glyphs),z=g(d.color);0!==a&&r.setRotation(a);const _=r.bounds,b=i+_.x+y,M=s+_.y-x,P=2*(d.minPixelBuffer?d.minPixelBuffer/u:1),R=Math.max(_.width,_.height)*P,B=r.glyphs[n];t.recordStart(this.instanceId,this.attributeLayout,B.textureBinding),c&&t.recordBounds(b,M,R,R);const{texcoords:L,offsets:T}=B,k=B.fontSize??u;this._writeQuad(t,o,i,s,{texcoords:L,offsets:T,fontSize:k,haloSize:p,outlineSize:m,sdfSize:S.sdfSize,sdfRadius:S.sdfRadius,color:B.color?g(B.color):z,isBackground:!1,referenceBounds:l,minZoom:0,maxZoom:30,...h}),t.recordEnd(),0!==a&&r.setRotation(-a)}_writeTextBox(t,e,o,i,s,r,n){const a=this.evaluatedMeshParams,{fontSize:l,haloSize:h,outlineSize:c}=this._textMeshTransformProps,{backgroundColor:d,borderLineColor:f,borderLineSize:u}=N(a),{sdfSize:p,sdfRadius:m}=this._getDefaultGlyphMetrics(a.glyphs),y=!!f&&u>0,x={isBackground:!0,fontSize:l,haloSize:h,outlineSize:c,referenceBounds:r,sdfSize:p,sdfRadius:m,...n};d&&(this._writeQuad(t,e,o,i,{texcoords:L,offsets:s.main,color:g(d),...x}),y||(this._writeQuad(t,e,o,i,{texcoords:I,offsets:s.top,color:g(d),...x}),this._writeQuad(t,e,o,i,{texcoords:C,offsets:s.bot,color:g(d),...x}),this._writeQuad(t,e,o,i,{texcoords:D,offsets:s.left,color:g(d),...x}),this._writeQuad(t,e,o,i,{texcoords:E,offsets:s.right,color:g(d),...x}))),y&&(this._writeQuad(t,e,o,i,{texcoords:w,offsets:s.top,color:g(f),...x}),this._writeQuad(t,e,o,i,{texcoords:w,offsets:s.bot,color:g(f),...x}),this._writeQuad(t,e,o,i,{texcoords:G,offsets:s.left,color:g(f),...x}),this._writeQuad(t,e,o,i,{texcoords:G,offsets:s.right,color:g(f),...x}))}_writeQuad(t,e,o,i,s){const r=t.vertexCount();this._writeVertex(t,e,o,i,s),t.indexWrite(r+0),t.indexWrite(r+1),t.indexWrite(r+2),t.indexWrite(r+1),t.indexWrite(r+3),t.indexWrite(r+2)}}const Y=t=>Math.round(t*u);export{U as TextMeshWriter,H as TextVertexSpec,N as getTextBoxStyle,P as maxLabelZoom};