@arcgis/core 4.29.0-next.20240222 → 4.29.1

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 (279) hide show
  1. package/arcade/treeAnalysis.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{b43fde3e25d0c3b020b5.js → 039a872509872ce67ba4.js} +1 -1
  4. package/assets/esri/core/workers/chunks/0bc21d2a0b65bd4e9d76.js +1 -0
  5. package/assets/esri/core/workers/chunks/{5243f9ff21e768c620c2.js → 23a5d750d93a7829174f.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{47e6119be4a4a5ed640d.js → 2447a4d5886aeb0ff72a.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{7f45a9e9bdbcffc2d6e0.js → 348bcc57b99a975902a8.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{8c9fb2601488998013ba.js → 3523789a2948a4ab8cc8.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{24649b410b757599a549.js → 48db6e0bbb1a9c043193.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{752082be991f1cc8558f.js → 4984e2b79d862114d6a6.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{8d9736fd15cdb54d9855.js → 5227f9eea6988aadad7f.js} +1 -1
  12. package/assets/esri/core/workers/chunks/58723274ef657fe212eb.js +1 -0
  13. package/assets/esri/core/workers/chunks/60ab18c6a04d4b2f1d4c.js +1 -0
  14. package/assets/esri/core/workers/chunks/647515801d94180b8402.js +1 -0
  15. package/assets/esri/core/workers/chunks/6c3ae96ec90e9ed7dd50.js +1 -0
  16. package/assets/esri/core/workers/chunks/7a8bba91769ee18cc39f.js +1 -0
  17. package/assets/esri/core/workers/chunks/7a98d2e026f63a581b1e.js +1 -0
  18. package/assets/esri/core/workers/chunks/8c360923cd1850767d3e.js +1 -0
  19. package/assets/esri/core/workers/chunks/{1a25ba411b89e050fbb7.js → a61f337802ae963d7f65.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{d0c5318d7ef2e923aad0.js → a8ac511280f873960d46.js} +1 -1
  21. package/assets/esri/core/workers/chunks/b125ab84b7761e761734.js +1 -0
  22. package/assets/esri/core/workers/chunks/{b34d6e58b125fe111f91.js → b42a83db83851cb57d44.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{1497dd943df7eede0704.js → b9c55ff1f21db198ce03.js} +1 -1
  24. package/assets/esri/core/workers/chunks/bb3322ddb89c0bd444f0.js +1 -0
  25. package/assets/esri/core/workers/chunks/becfdaeeb07f089d8be7.js +1 -0
  26. package/assets/esri/core/workers/chunks/{b26e39a399963c176d33.js → c527692694688a5b3b07.js} +2 -2
  27. package/assets/esri/core/workers/chunks/{210a93e0b96c5bff44a3.js → c556644bb0cf88770939.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{e7b26c7e9e24dc6255be.js → cacf97b0a7a1057b9f79.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{a5e7b4acae17f88e2208.js → ce93027b6b81428ce9b0.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{b8ece275abac93f3dccf.js → d14f16bfa6c12909929c.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{1594f06a2d7d9439c62e.js → e2147c99cc5839654be1.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{d33ed3a2a0d4b640bd4a.js → e4c7d8c69e4957c9d27c.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{7709248f59520aee6f51.js → eceaa46f622f6fa31128.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{2286db4c83ff1b6fb088.js → ef3e6209e6ac6a56960b.js} +1 -1
  35. package/assets/esri/core/workers/chunks/f59b5ea05caca8a1a398.js +1 -0
  36. package/chunks/Laserlines.glsl.js +3 -3
  37. package/chunks/Precipitation.glsl.js +1 -1
  38. package/chunks/SSAOBlur.glsl.js +2 -2
  39. package/chunks/boundedPlane.js +1 -1
  40. package/chunks/cameraUtilsSpherical.js +1 -1
  41. package/chunks/sphere.js +1 -1
  42. package/chunks/terrainUtilsPlanar.js +1 -1
  43. package/chunks/vec32.js +1 -1
  44. package/config.js +1 -1
  45. package/copyright.txt +56 -28
  46. package/core/libs/gl-matrix-2/math/quat.js +1 -1
  47. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  48. package/core/libs/gl-matrix-2/vec3.js +1 -1
  49. package/geometry/support/axisAngleDegrees.js +1 -1
  50. package/geometry/support/coordinateSystem.js +1 -1
  51. package/geometry/support/lineSegment.js +1 -1
  52. package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
  53. package/geometry/support/meshUtils/georeference.js +1 -1
  54. package/geometry/support/meshUtils/merge.js +1 -1
  55. package/geometry/support/meshUtils/rotate.js +1 -1
  56. package/geometry/support/meshUtils/scale.js +1 -1
  57. package/geometry/support/meshUtils/vertexSpaceConversion.js +5 -0
  58. package/geometry/support/meshVertexSpaceUtils.js +1 -1
  59. package/geometry/support/plane.js +1 -1
  60. package/geometry/support/ray.js +1 -1
  61. package/geometry/support/triangle.js +1 -1
  62. package/geometry/support/vector.js +1 -1
  63. package/interfaces.d.ts +12 -12
  64. package/kernel.js +1 -1
  65. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  66. package/layers/LinkChartLayer.js +1 -1
  67. package/layers/VoxelWasmPerSceneView.js +1 -1
  68. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  69. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  70. package/layers/mixins/FeatureReductionLayer.js +1 -1
  71. package/layers/orientedImagery/core/CameraOrientation.js +1 -1
  72. package/layers/orientedImagery/core/ElevationSourceDefinitions.js +1 -1
  73. package/layers/orientedImagery/core/coverageUtils.js +1 -1
  74. package/layers/orientedImagery/transformations/imageToGroundUtils.js +1 -1
  75. package/layers/orientedImagery/transformations/imageToWorld.js +5 -0
  76. package/layers/orientedImagery/transformations/updateElevation.js +5 -0
  77. package/layers/orientedImagery/transformations/updateElevationUtils.js +5 -0
  78. package/layers/orientedImagery/transformations/utils.js +1 -1
  79. package/layers/orientedImagery/transformations/worldToImage.js +5 -0
  80. package/layers/support/EditingCapabilities.js +1 -1
  81. package/layers/support/editableLayers.js +1 -1
  82. package/layers/support/layerUtils.js +1 -1
  83. package/layers/video/VideoCameraSensorModel.js +1 -1
  84. package/layers/voxel/VoxelVolume.js +1 -1
  85. package/layers/voxel/voxelPlaneUtils.js +1 -1
  86. package/libs/linkchartlayout/LinkChartLayout.js +1 -1
  87. package/package.json +1 -1
  88. package/smartMapping/renderers/pieChart.js +1 -1
  89. package/support/revision.js +1 -1
  90. package/symbols/cim/cimAnalyzer.js +1 -1
  91. package/views/2d/arcade/callExpressionWithCursor.js +1 -1
  92. package/views/2d/engine/webgl/shaderGraph/techniques/createTestMeshData.js +1 -1
  93. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriterInputEvaluator.js +1 -1
  94. package/views/2d/interactive/editingTools/TransformTool.js +1 -1
  95. package/views/2d/interactive/editingTools/manipulations/ScaleManipulation.js +1 -1
  96. package/views/2d/layers/features/Processor.js +1 -1
  97. package/views/2d/layers/features/aggregation/GeohashSpatialIndex.js +1 -1
  98. package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
  99. package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
  100. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
  101. package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
  102. package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
  103. package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
  104. package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
  105. package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
  106. package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
  107. package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
  108. package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
  109. package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
  110. package/views/2d/layers/features/sources/strategies/chunks/DrillDownTileSourceChunk.js +1 -1
  111. package/views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js +1 -1
  112. package/views/2d/layers/features/sources/strategies/chunks/OverrideChunk.js +1 -1
  113. package/views/2d/layers/features/sources/strategies/chunks/PagedTileSourceChunk.js +1 -1
  114. package/views/2d/layers/features/sources/strategies/chunks/StreamSourceChunk.js +1 -1
  115. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  116. package/views/2d/layers/features/support/FeatureMetadata.js +1 -1
  117. package/views/2d/layers/features/support/GraphicsReader.js +1 -1
  118. package/views/2d/layers/features/support/Tile.js +1 -1
  119. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  120. package/views/2d/tiling/TileKey.js +1 -1
  121. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  122. package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
  123. package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
  124. package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
  125. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementController.js +1 -1
  126. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  127. package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
  128. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  129. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  130. package/views/3d/analysis/support/measurementUtils.js +1 -1
  131. package/views/3d/animation/pointToPoint/Camera.js +1 -1
  132. package/views/3d/camera/constraintUtils/common.js +1 -1
  133. package/views/3d/camera/constraintUtils/distance.js +1 -1
  134. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  135. package/views/3d/camera/intersectionUtils.js +1 -1
  136. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  137. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  138. package/views/3d/environment/Fog.js +1 -1
  139. package/views/3d/environment/MarsAtmosphere.js +1 -1
  140. package/views/3d/environment/SceneViewEnvironmentManager.js +1 -1
  141. package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
  142. package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
  143. package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
  144. package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
  145. package/views/3d/interactive/editingTools/reshapeGraphic/edgeOffsetUtils.js +1 -1
  146. package/views/3d/interactive/editingTools/transformGraphic/ExtentScale.js +1 -1
  147. package/views/3d/interactive/editingTools/transformGraphic/extentUtils.js +1 -1
  148. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  149. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  150. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  151. package/views/3d/interactive/visualElements/support/Segment.js +1 -1
  152. package/views/3d/layers/I3SMeshView3D.js +1 -1
  153. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  154. package/views/3d/layers/PointCloudWorker.js +1 -1
  155. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  156. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  157. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  158. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  159. package/views/3d/layers/i3s/I3SOverrides.js +1 -1
  160. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  161. package/views/3d/layers/i3s/LoDUtil.js +1 -1
  162. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  163. package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
  164. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  165. package/views/3d/layers/support/uvUtils.js +1 -1
  166. package/views/3d/state/Frustum.js +1 -1
  167. package/views/3d/state/NearFarHeuristic.js +1 -1
  168. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  169. package/views/3d/state/controllers/RotateController.js +1 -1
  170. package/views/3d/state/controllers/global/PinchAndPanController.js +1 -1
  171. package/views/3d/state/controllers/global/ZoomController.js +1 -1
  172. package/views/3d/state/controllers/global/ZoomStepController.js +1 -1
  173. package/views/3d/state/controllers/local/PinchAndPanController.js +1 -1
  174. package/views/3d/state/controllers/local/ZoomController.js +1 -1
  175. package/views/3d/state/controllers/local/ZoomStepController.js +1 -1
  176. package/views/3d/state/controllers/momentum/ZoomPlanarMomentumController.js +1 -1
  177. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  178. package/views/3d/state/utils/navigationUtils.js +1 -1
  179. package/views/3d/state/utils/viewUtils.js +1 -1
  180. package/views/3d/support/FrustumExtentIntersection.js +1 -1
  181. package/views/3d/support/cameraUtils.js +1 -1
  182. package/views/3d/support/cameraUtilsInternal.js +1 -1
  183. package/views/3d/support/intersectionUtils.js +1 -1
  184. package/views/3d/support/mathUtils.js +1 -1
  185. package/views/3d/support/orientedBoundingBox.js +1 -1
  186. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  187. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  188. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  189. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  190. package/views/3d/support/sunUtils.js +1 -1
  191. package/views/3d/support/viewpointUtils.js +1 -1
  192. package/views/3d/terrain/OverlayManager.js +1 -1
  193. package/views/3d/terrain/PatchRenderData.js +1 -1
  194. package/views/3d/terrain/SphericalPatch.js +1 -1
  195. package/views/3d/terrain/TerrainRenderer.js +1 -1
  196. package/views/3d/terrain/Tile.js +1 -1
  197. package/views/3d/webgl-engine/collections/Component/DepthRange.js +1 -1
  198. package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
  199. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  200. package/views/3d/webgl-engine/core/util/TwoVectorPosition.js +1 -1
  201. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  202. package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
  203. package/views/3d/webgl-engine/lib/Camera.js +1 -1
  204. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  205. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  206. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  207. package/views/3d/webgl-engine/lib/PathVertex.js +1 -1
  208. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  209. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  210. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  211. package/views/3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js +1 -1
  212. package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
  213. package/views/3d/webgl-engine/lib/intersectorUtils.js +1 -1
  214. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  215. package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
  216. package/views/3d/webgl-engine/lighting/SceneLighting.js +1 -1
  217. package/views/3d/webgl-engine/lighting/SphericalHarmonics.js +1 -1
  218. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  219. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  220. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  221. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  222. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  223. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  224. package/views/3d/webgl-engine/materials/pbrUtils.js +1 -1
  225. package/views/SelectionManager.js +1 -1
  226. package/views/draw/support/createUtils.js +1 -1
  227. package/views/draw/support/surfaceCoordinateSystems.js +1 -1
  228. package/views/interactive/GraphicManipulator.js +1 -1
  229. package/views/interactive/SegmentLabels.js +1 -1
  230. package/views/interactive/coordinateHelper.js +1 -1
  231. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  232. package/views/interactive/editGeometry/support/editPlaneUtils.js +1 -1
  233. package/views/interactive/sketch/constraints.js +1 -1
  234. package/views/interactive/snapping/RightAngleSnapper.js +1 -1
  235. package/views/interactive/snapping/candidates/ParallelLineSnappingCandidate.js +1 -1
  236. package/views/interactive/snapping/candidates/RightAngleTriangleSnappingCandidate.js +1 -1
  237. package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
  238. package/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js +1 -1
  239. package/views/interactive/snapping/hints/IntersectionSnappingHint.js +1 -1
  240. package/views/interactive/snapping/hints/LineSnappingHint.js +1 -1
  241. package/views/interactive/snapping/hints/ParallelSnappingHint.js +1 -1
  242. package/views/interactive/snapping/hints/PointSnappingHint.js +1 -1
  243. package/views/interactive/snapping/hints/RightAngleSnappingHint.js +1 -1
  244. package/views/layers/FeatureLayerView.js +1 -1
  245. package/views/layers/support/editableLayerViews.js +5 -0
  246. package/views/navigation/PanSphericalMomentumEstimator.js +1 -1
  247. package/views/support/angularMeasurementUtils.js +1 -1
  248. package/views/support/euclideanAreaMeasurementUtils.js +1 -1
  249. package/views/support/euclideanLengthMeasurementUtils.js +1 -1
  250. package/views/support/geometry3dUtils.js +1 -1
  251. package/widgets/Editor/EditorViewModel.js +1 -1
  252. package/widgets/Editor/support/EditorEditingCapabilities.js +1 -1
  253. package/widgets/Editor/support/EditorItem.js +1 -1
  254. package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
  255. package/widgets/FeatureForm.js +1 -1
  256. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  257. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  258. package/widgets/FeatureTable/support/ColumnTemplateBase.js +1 -1
  259. package/widgets/Features/FeaturesViewModel.js +1 -1
  260. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  261. package/widgets/OrientedImageryViewer.js +1 -1
  262. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  263. package/widgets/PanoramicViewer/utils.js +1 -1
  264. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  265. package/widgets/UtilityNetworkTrace.js +1 -1
  266. package/widgets/support/Selector2D/SelectionOperation.js +1 -1
  267. package/widgets/support/Selector2D/selectorUtils.js +1 -1
  268. package/assets/esri/core/workers/chunks/0e83f3718a0b45652b5e.js +0 -1
  269. package/assets/esri/core/workers/chunks/1fa5c8af69a09a3730b3.js +0 -1
  270. package/assets/esri/core/workers/chunks/25f73748df0ee82d06cb.js +0 -1
  271. package/assets/esri/core/workers/chunks/2d7a18f8c540269ecee9.js +0 -1
  272. package/assets/esri/core/workers/chunks/4736f79b5c94ce103d43.js +0 -1
  273. package/assets/esri/core/workers/chunks/65f7adaaf1f535310c11.js +0 -1
  274. package/assets/esri/core/workers/chunks/79c041b292648c5eaecc.js +0 -1
  275. package/assets/esri/core/workers/chunks/7c4c2c0beddabac672b6.js +0 -1
  276. package/assets/esri/core/workers/chunks/9a758de08dfa57735879.js +0 -1
  277. package/assets/esri/core/workers/chunks/a4c3da057ec2a07bbbe8.js +0 -1
  278. package/assets/esri/core/workers/chunks/b252270b100351779f1f.js +0 -1
  279. package/assets/esri/core/workers/chunks/dc57aa9f2fc69e654559.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{copy as t}from"../../core/libs/gl-matrix-2/math/mat4.js";import{s as e,j as n,c as o,n as r,b as i}from"../../chunks/vec32.js";import{create as s}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as a}from"../ellipsoidUtils.js";import u from"../SpatialReference.js";import{getSphericalPCPF as c}from"../spatialReferenceEllipsoidUtils.js";import{Axis as l}from"./Axis.js";import{f,b as p}from"../../chunks/boundedPlane.js";import{f as m,s as v}from"../../chunks/sphere.js";function j(t){const{value:e,operations:n}=t;return{operations:n,value:n.create(e)}}function h(t,e,n){return t.operations.setExtent(t.value,e,n.value),n}function d(t){return{operations:t,value:t.create()}}function x(t,e,n=d(t)){return n.operations=t,t.copy(e,n.value),n}function A(t){return x(v,m(0,0,0,a(t).radius))}const b=2**50;function P(){return x(p,f([0,0,0],[b,0,0],[0,b,0]))}function R(t,e,n){return t.operations.axisAt(t.value,e,l.Z,n)}function S(t,e,n,o){return t.operations.axisAt(t.value,e,n,o)}function g(t,e,n){return t.operations.intersectRay(t.value,e,n)}function k(t,e,n){return t.operations.closestPoint(t.value,e,n)}function y(t,e,n){return t.operations.intersectRayClosestSilhouette(t.value,e,n)}function C(t,e,n){return t.operations.closestPointOnSilhouette(t.value,e,n)}function E(t,e){return t.operations.distanceToSilhouette(t.value,e)}function U(t,e){return t.operations.altitudeAt(t.value,e)}function G(t,e,n,o){return t.operations.setAltitudeAt(t.value,e,n,o)}function O(n,o,r,i){return o!==i&&t(i,o),e(Z,i[12],i[13],i[14]),G(n,Z,r,Z),i[12]=Z[0],i[13]=Z[1],i[14]=Z[2],i}function T(t,e,n){return t.operations.elevate(t.value,e,n.value)}const Z=s();function q(t,e,o,r,i){return i[0]=n(t,e),i[1]=n(t,o),i[2]=n(t,r),i}function w(t,e,n,s,a){o(n,t),o(B,e),r(B,B),i(s,B,n),i(a,s,n)}function z(t,e){return t?c(e):e.isGeographic?u.PlateCarree:e}const B=s();export{U as altitudeAt,S as axisAt,k as closestPoint,C as closestPointOnSilhouette,w as coordinateSystemFromOneAxisAndNormalVector,j as create,d as createFromOperations,A as createGlobal,P as createLocal,E as distanceToSilhouette,T as elevate,x as fromValues,g as intersectRay,y as intersectRayClosestSilhouette,R as normalAt,z as renderSRFromViewSR,G as setAltitudeAt,O as setAltitudeOfTransformation,h as setExtent,q as vectorCoordinates};
5
+ import{copy as t}from"../../core/libs/gl-matrix-2/math/mat4.js";import{s as e,k as n,c as o,n as r,b as i}from"../../chunks/vec32.js";import{create as s}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as a}from"../ellipsoidUtils.js";import u from"../SpatialReference.js";import{getSphericalPCPF as c}from"../spatialReferenceEllipsoidUtils.js";import{Axis as l}from"./Axis.js";import{f,b as p}from"../../chunks/boundedPlane.js";import{f as m,s as v}from"../../chunks/sphere.js";function h(t){const{value:e,operations:n}=t;return{operations:n,value:n.create(e)}}function j(t,e,n){return t.operations.setExtent(t.value,e,n.value),n}function d(t){return{operations:t,value:t.create()}}function x(t,e,n=d(t)){return n.operations=t,t.copy(e,n.value),n}function A(t){return x(v,m(0,0,0,a(t).radius))}const b=2**50;function k(){return x(p,f([0,0,0],[b,0,0],[0,b,0]))}function P(t,e,n){return t.operations.axisAt(t.value,e,l.Z,n)}function R(t,e,n,o){return t.operations.axisAt(t.value,e,n,o)}function S(t,e,n){return t.operations.intersectRay(t.value,e,n)}function g(t,e,n){return t.operations.closestPoint(t.value,e,n)}function y(t,e,n){return t.operations.intersectRayClosestSilhouette(t.value,e,n)}function C(t,e,n){return t.operations.closestPointOnSilhouette(t.value,e,n)}function E(t,e){return t.operations.distanceToSilhouette(t.value,e)}function U(t,e){return t.operations.altitudeAt(t.value,e)}function G(t,e,n,o){return t.operations.setAltitudeAt(t.value,e,n,o)}function O(n,o,r,i){return o!==i&&t(i,o),e(Z,i[12],i[13],i[14]),G(n,Z,r,Z),i[12]=Z[0],i[13]=Z[1],i[14]=Z[2],i}function T(t,e,n){return t.operations.elevate(t.value,e,n.value)}const Z=s();function q(t,e,o,r,i){return i[0]=n(t,e),i[1]=n(t,o),i[2]=n(t,r),i}function w(t,e,n,s,a){o(n,t),o(B,e),r(B,B),i(s,B,n),i(a,s,n)}function z(t,e){return t?c(e):e.isGeographic?u.PlateCarree:e}const B=s();export{U as altitudeAt,R as axisAt,g as closestPoint,C as closestPointOnSilhouette,w as coordinateSystemFromOneAxisAndNormalVector,h as create,d as createFromOperations,A as createGlobal,k as createLocal,E as distanceToSilhouette,T as elevate,x as fromValues,S as intersectRay,y as intersectRayClosestSilhouette,P as normalAt,z as renderSRFromViewSR,G as setAltitudeAt,O as setAltitudeOfTransformation,j as setExtent,q as vectorCoordinates};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as t}from"../../core/mathUtils.js";import{ObjectStack as r}from"../../core/ObjectStack.js";import{c as n,f as o,j as e,h as i,g as c,o as s,a}from"../../chunks/vec32.js";import{clone as u,create as g}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{sv3d as f}from"./vectorStacks.js";function v(t){return t?{origin:u(t.origin),vector:u(t.vector)}:{origin:g(),vector:g()}}function m(t,r){const n=S.get();return n.origin=t,n.vector=r,n}function p(t,r=v()){return h(t.origin,t.vector,r)}function h(t,r,o=v()){return n(o.origin,t),n(o.vector,r),o}function b(t,r,e=v()){return n(e.origin,t),o(e.vector,r,t),e}function j(r,n){const c=o(f.get(),n,r.origin),s=e(r.vector,c),a=e(r.vector,r.vector),u=t(s/a,0,1),g=o(f.get(),i(f.get(),r.vector,u),c);return e(g,g)}function M(t,r,n){return A(t,r,0,1,n)}function l(t,r,n){return c(n,t.origin,i(n,t.vector,r))}function A(r,n,a,u,g){const{vector:v,origin:m}=r,p=o(f.get(),n,m),h=e(v,p)/s(v);return i(g,v,t(h,a,u)),c(g,g,r.origin)}function B(t,r){if(k(t,m(r.origin,r.direction),!1,x)){const{tA:r,pB:n,distance2:o}=x;if(r>=0&&r<=1)return o;if(r<0)return a(t.origin,n);if(r>1)return a(c(f.get(),t.origin,t.vector),n)}return null}function d(t,r,o){return!!k(t,r,!0,x)&&(n(o,x.pA),!0)}function k(r,n,o,e){const i=1e-6,s=r.origin,u=c(f.get(),s,r.vector),g=n.origin,v=c(f.get(),g,n.vector),m=f.get(),p=f.get();if(m[0]=s[0]-g[0],m[1]=s[1]-g[1],m[2]=s[2]-g[2],p[0]=v[0]-g[0],p[1]=v[1]-g[1],p[2]=v[2]-g[2],Math.abs(p[0])<i&&Math.abs(p[1])<i&&Math.abs(p[2])<i)return!1;const h=f.get();if(h[0]=u[0]-s[0],h[1]=u[1]-s[1],h[2]=u[2]-s[2],Math.abs(h[0])<i&&Math.abs(h[1])<i&&Math.abs(h[2])<i)return!1;const b=m[0]*p[0]+m[1]*p[1]+m[2]*p[2],j=p[0]*h[0]+p[1]*h[1]+p[2]*h[2],M=m[0]*h[0]+m[1]*h[1]+m[2]*h[2],l=p[0]*p[0]+p[1]*p[1]+p[2]*p[2],A=(h[0]*h[0]+h[1]*h[1]+h[2]*h[2])*l-j*j;if(Math.abs(A)<i)return!1;let B=(b*j-M*l)/A,d=(b+j*B)/l;o&&(B=t(B,0,1),d=t(d,0,1));const k=f.get(),x=f.get();return k[0]=s[0]+B*h[0],k[1]=s[1]+B*h[1],k[2]=s[2]+B*h[2],x[0]=g[0]+d*p[0],x[1]=g[1]+d*p[1],x[2]=g[2]+d*p[2],e.tA=B,e.tB=d,e.pA=k,e.pB=x,e.distance2=a(k,x),!0}const x={tA:0,tB:0,pA:g(),pB:g(),distance2:0},S=new r((()=>v()));export{d as closestLineSegmentPoint,B as closestRayDistance2,p as copy,v as create,j as distance2,b as fromPoints,h as fromValues,l as pointAt,M as projectPoint,A as projectPointClamp,m as wrap};
5
+ import{clamp as t}from"../../core/mathUtils.js";import{ObjectStack as r}from"../../core/ObjectStack.js";import{c as n,f as o,k as e,h as i,g as c,p as s,a}from"../../chunks/vec32.js";import{clone as u,create as g}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{sv3d as f}from"./vectorStacks.js";function v(t){return t?{origin:u(t.origin),vector:u(t.vector)}:{origin:g(),vector:g()}}function p(t,r){const n=S.get();return n.origin=t,n.vector=r,n}function m(t,r=v()){return h(t.origin,t.vector,r)}function h(t,r,o=v()){return n(o.origin,t),n(o.vector,r),o}function b(t,r,e=v()){return n(e.origin,t),o(e.vector,r,t),e}function M(r,n){const c=o(f.get(),n,r.origin),s=e(r.vector,c),a=e(r.vector,r.vector),u=t(s/a,0,1),g=o(f.get(),i(f.get(),r.vector,u),c);return e(g,g)}function j(t,r,n){return A(t,r,0,1,n)}function l(t,r,n){return c(n,t.origin,i(n,t.vector,r))}function A(r,n,a,u,g){const{vector:v,origin:p}=r,m=o(f.get(),n,p),h=e(v,m)/s(v);return i(g,v,t(h,a,u)),c(g,g,r.origin)}function B(t,r){if(k(t,p(r.origin,r.direction),!1,x)){const{tA:r,pB:n,distance2:o}=x;if(r>=0&&r<=1)return o;if(r<0)return a(t.origin,n);if(r>1)return a(c(f.get(),t.origin,t.vector),n)}return null}function d(t,r,o){return!!k(t,r,!0,x)&&(n(o,x.pA),!0)}function k(r,n,o,e){const i=1e-6,s=r.origin,u=c(f.get(),s,r.vector),g=n.origin,v=c(f.get(),g,n.vector),p=f.get(),m=f.get();if(p[0]=s[0]-g[0],p[1]=s[1]-g[1],p[2]=s[2]-g[2],m[0]=v[0]-g[0],m[1]=v[1]-g[1],m[2]=v[2]-g[2],Math.abs(m[0])<i&&Math.abs(m[1])<i&&Math.abs(m[2])<i)return!1;const h=f.get();if(h[0]=u[0]-s[0],h[1]=u[1]-s[1],h[2]=u[2]-s[2],Math.abs(h[0])<i&&Math.abs(h[1])<i&&Math.abs(h[2])<i)return!1;const b=p[0]*m[0]+p[1]*m[1]+p[2]*m[2],M=m[0]*h[0]+m[1]*h[1]+m[2]*h[2],j=p[0]*h[0]+p[1]*h[1]+p[2]*h[2],l=m[0]*m[0]+m[1]*m[1]+m[2]*m[2],A=(h[0]*h[0]+h[1]*h[1]+h[2]*h[2])*l-M*M;if(Math.abs(A)<i)return!1;let B=(b*M-j*l)/A,d=(b+M*B)/l;o&&(B=t(B,0,1),d=t(d,0,1));const k=f.get(),x=f.get();return k[0]=s[0]+B*h[0],k[1]=s[1]+B*h[1],k[2]=s[2]+B*h[2],x[0]=g[0]+d*m[0],x[1]=g[1]+d*m[1],x[2]=g[2]+d*m[2],e.tA=B,e.tB=d,e.pA=k,e.pB=x,e.distance2=a(k,x),!0}const x={tA:0,tB:0,pA:g(),pB:g(),distance2:0},S=new r((()=>v()));export{d as closestLineSegmentPoint,B as closestRayDistance2,m as copy,v as create,M as distance2,b as fromPoints,h as fromValues,l as pointAt,j as projectPoint,A as projectPointClamp,p as wrap};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../../core/Error.js";import t from"../../../../../core/Logger.js";import{getOrCreateMapValue as s}from"../../../../../core/MapUtils.js";import{deg2rad as r}from"../../../../../core/mathUtils.js";import{getMetersPerCartesianUnitForSR as i}from"../../../../../core/unitUtils.js";import{scale as a}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as o,create as n}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{exactEquals as l}from"../../../../../core/libs/gl-matrix-2/math/quat.js";import{IDENTITY as c,clone as h}from"../../../../../core/libs/gl-matrix-2/factories/quatf64.js";import{i as f}from"../../../../../chunks/vec32.js";import{ZEROS as u,clone as m,ONES as p}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import d from"../../../MeshGeoreferencedVertexSpace.js";import g from"../../../MeshMaterialMetallicRoughness.js";import{ungeoreferenceByTransform as _,applyTransform as x}from"../../georeference.js";import{Buffer as T}from"./buffer.js";import{smoothNormals as R}from"./geometry.js";import{BufferOutputType as A,ImageOutputType as b,AttributeType as E,TargetBuffer as M,AlphaMode as O}from"./types.js";import{imageToArrayBuffer as w,imageToDataURI as I}from"./imageutils.js";import{isEncodedMeshTexture as N}from"../../../../../views/3d/glTF/internal/resourceUtils.js";import{DataType as B,TextureWrapMode as C}from"../../../../../views/webgl/enums.js";const L=()=>t.getLogger("gltf");class S{constructor(e,t,s){this.params={},this._materialMap=new Array,this._imageMap=new Map,this._textureMap=new Map,this.gltf={asset:{version:"2.0",copyright:e.copyright,generator:e.generator},extras:{options:t,binChunkBuffer:null,promises:[]}},s&&(this.params=s),this._addScenes(e)}_addScenes(e){this.gltf.scene=e.defaultScene;const t=this.gltf.extras,s=t.options.bufferOutputType===A.GLB||t.options.imageOutputType===b.GLB;s&&(t.binChunkBuffer=new T(this.gltf)),e.forEachScene((e=>{this._addScene(e)})),s&&t.binChunkBuffer.finalize()}_addScene(e){this.gltf.scenes||(this.gltf.scenes=[]);const t={};e.name&&(t.name=e.name),e.forEachNode((e=>{t.nodes||(t.nodes=[]),t.nodes.push(...this._addNodes(e))})),this.gltf.scenes.push(t)}_addNodes(e){this.gltf.nodes||(this.gltf.nodes=[]);const t={};e.name&&(t.name=e.name);const s=e.translation;f(s,u)||(t.translation=m(s));const r=e.rotation;l(r,c)||(t.rotation=h(r));const i=e.scale;f(i,p)||(t.scale=m(i));const a=this.gltf.nodes.length;if(this.gltf.nodes.push(t),e.mesh&&e.mesh.vertexAttributes.position){const s=this._createMeshes(e.mesh),r=[a];if(1===s.length)this._addMesh(t,s[0]);else for(const e of s){const t={};this._addMesh(t,e),r.push(this.gltf.nodes.length),this.gltf.nodes.push(t)}return r}return e.forEachNode((e=>{t.children||(t.children=[]),t.children.push(...this._addNodes(e))})),[a]}_addMesh(e,t){this.gltf.meshes??=[];const s=this.gltf.meshes.length;this.gltf.meshes.push(t),e.mesh=s}_createMeshes(t){const s=this.gltf.extras,r=s.options.bufferOutputType===A.GLB;let n;n=r?s.binChunkBuffer:new T(this.gltf),this.params.origin||(this.params.origin=t.anchor);const{ignoreLocalTransform:l}=this.params,c=l?null:t.transform,{vertexSpace:h,spatialReference:f}=t,u=h.origin,p=t.vertexAttributes;let g=null;if("local"===h.type){const e=i(f);a(v,c?.localMatrix??o,[e,e,e]),g=x(p,v)}else{const e=l?new d({origin:u?m(u):null}):h;g=_(p,e,c,this.params.origin,{geographic:this.params.geographic,unit:"meters"})}if(null==g)throw new e("Error during gltf export.");p.position&&g.position===p.position&&(g.position=p.position.slice()),p.normal&&g.normal===p.normal&&(g.normal=p.normal.slice()),p.tangent&&g.tangent===p.tangent&&(g.tangent=p.tangent.slice()),R(t,g),this._flipYZAxis(g);const b=n.addBufferView(B.FLOAT,E.VEC3,M.ARRAY_BUFFER);let O,w,I,N;g.normal&&(O=n.addBufferView(B.FLOAT,E.VEC3,M.ARRAY_BUFFER)),p.uv&&(w=n.addBufferView(B.FLOAT,E.VEC2,M.ARRAY_BUFFER)),g.tangent&&(I=n.addBufferView(B.FLOAT,E.VEC4,M.ARRAY_BUFFER)),p.color&&(N=n.addBufferView(B.UNSIGNED_BYTE,E.VEC4,M.ARRAY_BUFFER)),b.startAccessor("POSITION"),O&&O.startAccessor("NORMAL"),w&&w.startAccessor("TEXCOORD_0"),I&&I.startAccessor("TANGENT"),N&&N.startAccessor("COLOR_0");const C=g.position.length/3,{position:L,normal:S,tangent:y}=g,{color:F,uv:j}=p;for(let e=0;e<C;++e)b.push(L[3*e]),b.push(L[3*e+1]),b.push(L[3*e+2]),O&&null!=S&&(O.push(S[3*e]),O.push(S[3*e+1]),O.push(S[3*e+2])),w&&null!=j&&(w.push(j[2*e]),w.push(j[2*e+1])),I&&null!=y&&(I.push(y[4*e]),I.push(y[4*e+1]),I.push(y[4*e+2]),I.push(y[4*e+3])),N&&null!=F&&(N.push(F[4*e]),N.push(F[4*e+1]),N.push(F[4*e+2]),N.push(F[4*e+3]));const V=b.endAccessor(),D=this._addAccessor(b.index,V);let k,G,Y,U,P;if(O){const e=O.endAccessor();k=this._addAccessor(O.index,e)}if(w){const e=w.endAccessor();G=this._addAccessor(w.index,e)}if(I){const e=I.endAccessor();Y=this._addAccessor(I.index,e)}if(N){const e=N.endAccessor();U=this._addAccessor(N.index,e)}const z=[];return t.components&&t.components.length>0&&t.components[0].faces?(P=n.addBufferView(B.UNSIGNED_INT,E.SCALAR,M.ELEMENT_ARRAY_BUFFER),this._addMeshVertexIndexed(P,t.components,z,D,k,G,Y,U)):this._addMeshVertexNonIndexed(t.components,z,D,k,G,Y,U),b.finalize(),O&&O.finalize(),w&&w.finalize(),I&&I.finalize(),P&&P.finalize(),N&&N.finalize(),r||n.finalize(),z}_flipYZAxis({position:e,normal:t,tangent:s}){this._flipYZBuffer(e,3),this._flipYZBuffer(t,3),this._flipYZBuffer(s,4)}_flipYZBuffer(e,t){if(null!=e)for(let s=1,r=2;s<e.length;s+=t,r+=t){const t=e[s],i=e[r];e[s]=i,e[r]=-t}}_addMaterial(e){if(null===e)return;const t=this._materialMap.indexOf(e);if(-1!==t)return t;this.gltf.materials||(this.gltf.materials=[]);const s={};switch(e.alphaMode){case"mask":s.alphaMode=O.MASK;break;case"auto":case"blend":s.alphaMode=O.BLEND}.5!==e.alphaCutoff&&(s.alphaCutoff=e.alphaCutoff),e.doubleSided&&(s.doubleSided=e.doubleSided),s.pbrMetallicRoughness={};const r=e=>e**2.1,i=e=>{const t=e.toRgba();return t[0]=r(t[0]/255),t[1]=r(t[1]/255),t[2]=r(t[2]/255),t};if(null!=e.color&&(s.pbrMetallicRoughness.baseColorFactor=i(e.color)),null!=e.colorTexture&&(s.pbrMetallicRoughness.baseColorTexture=this._createTextureInfo(e.colorTexture,e.colorTextureTransform)),null!=e.normalTexture&&(s.normalTexture=this._createTextureInfo(e.normalTexture,e.normalTextureTransform)),e instanceof g){if(null!=e.emissiveTexture&&(s.emissiveTexture=this._createTextureInfo(e.emissiveTexture,e.emissiveTextureTransform)),null!=e.emissiveColor){const t=i(e.emissiveColor);s.emissiveFactor=[t[0],t[1],t[2]]}null!=e.occlusionTexture&&(s.occlusionTexture=this._createTextureInfo(e.occlusionTexture,e.occlusionTextureTransform)),null!=e.metallicRoughnessTexture&&(s.pbrMetallicRoughness.metallicRoughnessTexture=this._createTextureInfo(e.metallicRoughnessTexture,e.metallicRoughnessTextureTransform)),s.pbrMetallicRoughness.metallicFactor=e.metallic,s.pbrMetallicRoughness.roughnessFactor=e.roughness}else s.pbrMetallicRoughness.metallicFactor=1,s.pbrMetallicRoughness.roughnessFactor=1,L().warnOnce("Meshes exported to GLTF without MeshMaterialMetallicRoughness material will appear different when imported back.");const a=this.gltf.materials.length;return this.gltf.materials.push(s),this._materialMap.push(e),a}_createTextureInfo(e,t){const s={index:this._addTexture(e)};return t?(s.extensions||(s.extensions={}),s.extensions.KHR_texture_transform={scale:t.scale,offset:t.offset,rotation:r(t.rotation)},s):s}_addTexture(e){const t=this.gltf.textures??[];return this.gltf.textures=t,s(this._textureMap,e,(()=>{const s={sampler:this._addSampler(e),source:this._addImage(e)},r=t.length;return t.push(s),r}))}_addImage(e){const t=this._imageMap.get(e);if(null!=t)return t;this.gltf.images||(this.gltf.images=[]);const s={};if(e.url)s.uri=e.url;else{const t=e.data;s.extras=t;for(let e=0;e<this.gltf.images.length;++e)if(t===this.gltf.images[e].extras)return e;const r=this.gltf.extras;switch(r.options.imageOutputType){case b.GLB:{const e=r.binChunkBuffer.addBufferView(B.UNSIGNED_BYTE,E.SCALAR);if(N(t))null!=t.data&&e.writeOutToBuffer(t.data,0);else{const r=w(t).then((({data:e,type:t})=>(s.mimeType=t,e)));e.writeAsync(r).then((()=>{e.finalize()}))}s.bufferView=e.index;break}case b.DataURI:if(N(t)){L().warnOnce("Image export for basis compressed textures not available.");break}s.uri=I(t);break;default:if(N(t)){L().warnOnce("Image export for basis compressed textures not available.");break}r.promises.push(w(t).then((({data:e,type:t})=>{s.uri=e,s.mimeType=t})))}}const r=this.gltf.images.length;return this.gltf.images.push(s),this._imageMap.set(e,r),r}_addSampler(e){this.gltf.samplers||(this.gltf.samplers=[]);let t=C.REPEAT,s=C.REPEAT;if("string"==typeof e.wrap)switch(e.wrap){case"clamp":t=C.CLAMP_TO_EDGE,s=C.CLAMP_TO_EDGE;break;case"mirror":t=C.MIRRORED_REPEAT,s=C.MIRRORED_REPEAT}else{switch(e.wrap.vertical){case"clamp":s=C.CLAMP_TO_EDGE;break;case"mirror":s=C.MIRRORED_REPEAT}switch(e.wrap.horizontal){case"clamp":t=C.CLAMP_TO_EDGE;break;case"mirror":t=C.MIRRORED_REPEAT}}const r={wrapS:t,wrapT:s};for(let a=0;a<this.gltf.samplers.length;++a)if(JSON.stringify(r)===JSON.stringify(this.gltf.samplers[a]))return a;const i=this.gltf.samplers.length;return this.gltf.samplers.push(r),i}_addAccessor(e,t){this.gltf.accessors||(this.gltf.accessors=[]);const s={bufferView:e,byteOffset:t.byteOffset,componentType:t.componentType,count:t.count,type:t.type,min:t.min,max:t.max,name:t.name};t.normalized&&(s.normalized=!0);const r=this.gltf.accessors.length;return this.gltf.accessors.push(s),r}_addMeshVertexIndexed(e,t,s,r,i,a,o,n){const l=new Map;for(const c of t){e.startAccessor("INDICES");for(let s=0;s<c.faces.length;++s)e.push(c.faces[s]);const t=e.endAccessor(),h={attributes:{POSITION:r},indices:this._addAccessor(e.index,t),material:this._addMaterial(c.material)};i&&"flat"!==c.shading&&(h.attributes.NORMAL=i),a&&(h.attributes.TEXCOORD_0=a),o&&"flat"!==c.shading&&(h.attributes.TANGENT=o),n&&(h.attributes.COLOR_0=n);const f=l.get(c.name);if(f)f.primitives.push(h);else{const e={name:c.name,primitives:[h]};l.set(c.name,e),s.push(e)}}}_addMeshVertexNonIndexed(e,t,s,r,i,a,o){const n={primitives:[]};t.push(n);const l={attributes:{POSITION:s}};r&&(l.attributes.NORMAL=r),i&&(l.attributes.TEXCOORD_0=i),a&&(l.attributes.TANGENT=a),o&&(l.attributes.COLOR_0=o),e&&(l.material=this._addMaterial(e[0].material)),n.primitives.push(l)}}const v=n();export{S as GLTF};
5
+ import e from"../../../../../core/Error.js";import t from"../../../../../core/Logger.js";import{getOrCreateMapValue as s}from"../../../../../core/MapUtils.js";import{deg2rad as r}from"../../../../../core/mathUtils.js";import{getMetersPerCartesianUnitForSR as i}from"../../../../../core/unitUtils.js";import{scale as a}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as o,create as n}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{exactEquals as l}from"../../../../../core/libs/gl-matrix-2/math/quat.js";import{IDENTITY as c,clone as h}from"../../../../../core/libs/gl-matrix-2/factories/quatf64.js";import{j as f}from"../../../../../chunks/vec32.js";import{ZEROS as u,clone as m,ONES as p}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import d from"../../../MeshGeoreferencedVertexSpace.js";import g from"../../../MeshMaterialMetallicRoughness.js";import{ungeoreferenceByTransform as _,applyTransform as x}from"../../georeference.js";import{Buffer as T}from"./buffer.js";import{smoothNormals as R}from"./geometry.js";import{BufferOutputType as A,ImageOutputType as b,AttributeType as E,TargetBuffer as M,AlphaMode as O}from"./types.js";import{imageToArrayBuffer as w,imageToDataURI as I}from"./imageutils.js";import{isEncodedMeshTexture as N}from"../../../../../views/3d/glTF/internal/resourceUtils.js";import{DataType as B,TextureWrapMode as C}from"../../../../../views/webgl/enums.js";const L=()=>t.getLogger("gltf");class S{constructor(e,t,s){this.params={},this._materialMap=new Array,this._imageMap=new Map,this._textureMap=new Map,this.gltf={asset:{version:"2.0",copyright:e.copyright,generator:e.generator},extras:{options:t,binChunkBuffer:null,promises:[]}},s&&(this.params=s),this._addScenes(e)}_addScenes(e){this.gltf.scene=e.defaultScene;const t=this.gltf.extras,s=t.options.bufferOutputType===A.GLB||t.options.imageOutputType===b.GLB;s&&(t.binChunkBuffer=new T(this.gltf)),e.forEachScene((e=>{this._addScene(e)})),s&&t.binChunkBuffer.finalize()}_addScene(e){this.gltf.scenes||(this.gltf.scenes=[]);const t={};e.name&&(t.name=e.name),e.forEachNode((e=>{t.nodes||(t.nodes=[]),t.nodes.push(...this._addNodes(e))})),this.gltf.scenes.push(t)}_addNodes(e){this.gltf.nodes||(this.gltf.nodes=[]);const t={};e.name&&(t.name=e.name);const s=e.translation;f(s,u)||(t.translation=m(s));const r=e.rotation;l(r,c)||(t.rotation=h(r));const i=e.scale;f(i,p)||(t.scale=m(i));const a=this.gltf.nodes.length;if(this.gltf.nodes.push(t),e.mesh&&e.mesh.vertexAttributes.position){const s=this._createMeshes(e.mesh),r=[a];if(1===s.length)this._addMesh(t,s[0]);else for(const e of s){const t={};this._addMesh(t,e),r.push(this.gltf.nodes.length),this.gltf.nodes.push(t)}return r}return e.forEachNode((e=>{t.children||(t.children=[]),t.children.push(...this._addNodes(e))})),[a]}_addMesh(e,t){this.gltf.meshes??=[];const s=this.gltf.meshes.length;this.gltf.meshes.push(t),e.mesh=s}_createMeshes(t){const s=this.gltf.extras,r=s.options.bufferOutputType===A.GLB;let n;n=r?s.binChunkBuffer:new T(this.gltf),this.params.origin||(this.params.origin=t.anchor);const{ignoreLocalTransform:l}=this.params,c=l?null:t.transform,{vertexSpace:h,spatialReference:f}=t,u=h.origin,p=t.vertexAttributes;let g=null;if("local"===h.type){const e=i(f);a(v,c?.localMatrix??o,[e,e,e]),g=x(p,v)}else{const e=l?new d({origin:u?m(u):null}):h;g=_(p,e,c,this.params.origin,{geographic:this.params.geographic,unit:"meters"})}if(null==g)throw new e("Error during gltf export.");p.position&&g.position===p.position&&(g.position=p.position.slice()),p.normal&&g.normal===p.normal&&(g.normal=p.normal.slice()),p.tangent&&g.tangent===p.tangent&&(g.tangent=p.tangent.slice()),R(t,g),this._flipYZAxis(g);const b=n.addBufferView(B.FLOAT,E.VEC3,M.ARRAY_BUFFER);let O,w,I,N;g.normal&&(O=n.addBufferView(B.FLOAT,E.VEC3,M.ARRAY_BUFFER)),p.uv&&(w=n.addBufferView(B.FLOAT,E.VEC2,M.ARRAY_BUFFER)),g.tangent&&(I=n.addBufferView(B.FLOAT,E.VEC4,M.ARRAY_BUFFER)),p.color&&(N=n.addBufferView(B.UNSIGNED_BYTE,E.VEC4,M.ARRAY_BUFFER)),b.startAccessor("POSITION"),O&&O.startAccessor("NORMAL"),w&&w.startAccessor("TEXCOORD_0"),I&&I.startAccessor("TANGENT"),N&&N.startAccessor("COLOR_0");const C=g.position.length/3,{position:L,normal:S,tangent:y}=g,{color:F,uv:j}=p;for(let e=0;e<C;++e)b.push(L[3*e]),b.push(L[3*e+1]),b.push(L[3*e+2]),O&&null!=S&&(O.push(S[3*e]),O.push(S[3*e+1]),O.push(S[3*e+2])),w&&null!=j&&(w.push(j[2*e]),w.push(j[2*e+1])),I&&null!=y&&(I.push(y[4*e]),I.push(y[4*e+1]),I.push(y[4*e+2]),I.push(y[4*e+3])),N&&null!=F&&(N.push(F[4*e]),N.push(F[4*e+1]),N.push(F[4*e+2]),N.push(F[4*e+3]));const V=b.endAccessor(),D=this._addAccessor(b.index,V);let k,G,Y,U,P;if(O){const e=O.endAccessor();k=this._addAccessor(O.index,e)}if(w){const e=w.endAccessor();G=this._addAccessor(w.index,e)}if(I){const e=I.endAccessor();Y=this._addAccessor(I.index,e)}if(N){const e=N.endAccessor();U=this._addAccessor(N.index,e)}const z=[];return t.components&&t.components.length>0&&t.components[0].faces?(P=n.addBufferView(B.UNSIGNED_INT,E.SCALAR,M.ELEMENT_ARRAY_BUFFER),this._addMeshVertexIndexed(P,t.components,z,D,k,G,Y,U)):this._addMeshVertexNonIndexed(t.components,z,D,k,G,Y,U),b.finalize(),O&&O.finalize(),w&&w.finalize(),I&&I.finalize(),P&&P.finalize(),N&&N.finalize(),r||n.finalize(),z}_flipYZAxis({position:e,normal:t,tangent:s}){this._flipYZBuffer(e,3),this._flipYZBuffer(t,3),this._flipYZBuffer(s,4)}_flipYZBuffer(e,t){if(null!=e)for(let s=1,r=2;s<e.length;s+=t,r+=t){const t=e[s],i=e[r];e[s]=i,e[r]=-t}}_addMaterial(e){if(null===e)return;const t=this._materialMap.indexOf(e);if(-1!==t)return t;this.gltf.materials||(this.gltf.materials=[]);const s={};switch(e.alphaMode){case"mask":s.alphaMode=O.MASK;break;case"auto":case"blend":s.alphaMode=O.BLEND}.5!==e.alphaCutoff&&(s.alphaCutoff=e.alphaCutoff),e.doubleSided&&(s.doubleSided=e.doubleSided),s.pbrMetallicRoughness={};const r=e=>e**2.1,i=e=>{const t=e.toRgba();return t[0]=r(t[0]/255),t[1]=r(t[1]/255),t[2]=r(t[2]/255),t};if(null!=e.color&&(s.pbrMetallicRoughness.baseColorFactor=i(e.color)),null!=e.colorTexture&&(s.pbrMetallicRoughness.baseColorTexture=this._createTextureInfo(e.colorTexture,e.colorTextureTransform)),null!=e.normalTexture&&(s.normalTexture=this._createTextureInfo(e.normalTexture,e.normalTextureTransform)),e instanceof g){if(null!=e.emissiveTexture&&(s.emissiveTexture=this._createTextureInfo(e.emissiveTexture,e.emissiveTextureTransform)),null!=e.emissiveColor){const t=i(e.emissiveColor);s.emissiveFactor=[t[0],t[1],t[2]]}null!=e.occlusionTexture&&(s.occlusionTexture=this._createTextureInfo(e.occlusionTexture,e.occlusionTextureTransform)),null!=e.metallicRoughnessTexture&&(s.pbrMetallicRoughness.metallicRoughnessTexture=this._createTextureInfo(e.metallicRoughnessTexture,e.metallicRoughnessTextureTransform)),s.pbrMetallicRoughness.metallicFactor=e.metallic,s.pbrMetallicRoughness.roughnessFactor=e.roughness}else s.pbrMetallicRoughness.metallicFactor=1,s.pbrMetallicRoughness.roughnessFactor=1,L().warnOnce("Meshes exported to GLTF without MeshMaterialMetallicRoughness material will appear different when imported back.");const a=this.gltf.materials.length;return this.gltf.materials.push(s),this._materialMap.push(e),a}_createTextureInfo(e,t){const s={index:this._addTexture(e)};return t?(s.extensions||(s.extensions={}),s.extensions.KHR_texture_transform={scale:t.scale,offset:t.offset,rotation:r(t.rotation)},s):s}_addTexture(e){const t=this.gltf.textures??[];return this.gltf.textures=t,s(this._textureMap,e,(()=>{const s={sampler:this._addSampler(e),source:this._addImage(e)},r=t.length;return t.push(s),r}))}_addImage(e){const t=this._imageMap.get(e);if(null!=t)return t;this.gltf.images||(this.gltf.images=[]);const s={};if(e.url)s.uri=e.url;else{const t=e.data;s.extras=t;for(let e=0;e<this.gltf.images.length;++e)if(t===this.gltf.images[e].extras)return e;const r=this.gltf.extras;switch(r.options.imageOutputType){case b.GLB:{const e=r.binChunkBuffer.addBufferView(B.UNSIGNED_BYTE,E.SCALAR);if(N(t))null!=t.data&&e.writeOutToBuffer(t.data,0);else{const r=w(t).then((({data:e,type:t})=>(s.mimeType=t,e)));e.writeAsync(r).then((()=>{e.finalize()}))}s.bufferView=e.index;break}case b.DataURI:if(N(t)){L().warnOnce("Image export for basis compressed textures not available.");break}s.uri=I(t);break;default:if(N(t)){L().warnOnce("Image export for basis compressed textures not available.");break}r.promises.push(w(t).then((({data:e,type:t})=>{s.uri=e,s.mimeType=t})))}}const r=this.gltf.images.length;return this.gltf.images.push(s),this._imageMap.set(e,r),r}_addSampler(e){this.gltf.samplers||(this.gltf.samplers=[]);let t=C.REPEAT,s=C.REPEAT;if("string"==typeof e.wrap)switch(e.wrap){case"clamp":t=C.CLAMP_TO_EDGE,s=C.CLAMP_TO_EDGE;break;case"mirror":t=C.MIRRORED_REPEAT,s=C.MIRRORED_REPEAT}else{switch(e.wrap.vertical){case"clamp":s=C.CLAMP_TO_EDGE;break;case"mirror":s=C.MIRRORED_REPEAT}switch(e.wrap.horizontal){case"clamp":t=C.CLAMP_TO_EDGE;break;case"mirror":t=C.MIRRORED_REPEAT}}const r={wrapS:t,wrapT:s};for(let a=0;a<this.gltf.samplers.length;++a)if(JSON.stringify(r)===JSON.stringify(this.gltf.samplers[a]))return a;const i=this.gltf.samplers.length;return this.gltf.samplers.push(r),i}_addAccessor(e,t){this.gltf.accessors||(this.gltf.accessors=[]);const s={bufferView:e,byteOffset:t.byteOffset,componentType:t.componentType,count:t.count,type:t.type,min:t.min,max:t.max,name:t.name};t.normalized&&(s.normalized=!0);const r=this.gltf.accessors.length;return this.gltf.accessors.push(s),r}_addMeshVertexIndexed(e,t,s,r,i,a,o,n){const l=new Map;for(const c of t){e.startAccessor("INDICES");for(let s=0;s<c.faces.length;++s)e.push(c.faces[s]);const t=e.endAccessor(),h={attributes:{POSITION:r},indices:this._addAccessor(e.index,t),material:this._addMaterial(c.material)};i&&"flat"!==c.shading&&(h.attributes.NORMAL=i),a&&(h.attributes.TEXCOORD_0=a),o&&"flat"!==c.shading&&(h.attributes.TANGENT=o),n&&(h.attributes.COLOR_0=n);const f=l.get(c.name);if(f)f.primitives.push(h);else{const e={name:c.name,primitives:[h]};l.set(c.name,e),s.push(e)}}}_addMeshVertexNonIndexed(e,t,s,r,i,a,o){const n={primitives:[]};t.push(n);const l={attributes:{POSITION:s}};r&&(l.attributes.NORMAL=r),i&&(l.attributes.TEXCOORD_0=i),a&&(l.attributes.TANGENT=a),o&&(l.attributes.COLOR_0=o),e&&(l.material=this._addMaterial(e[0].material)),n.primitives.push(l)}}const v=n();export{S as GLTF};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{getMetersPerCartesianUnitForSR as t,convertUnit as n}from"../../../core/unitUtils.js";import{create as e}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{equals as r,multiply as o,invert as i,scale as a}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as l,create as s}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as c}from"../../../chunks/vec32.js";import{ZEROS as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{normalFromMat4 as f}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{canProjectWithoutEngine as p}from"../../projection.js";import{getSphericalPCPF as m}from"../../spatialReferenceEllipsoidUtils.js";import{computeTranslationToOriginAndRotation as g}from"../../projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as h}from"../../projection/projectBuffer.js";import{newDoubleArray as j,copyInto as x}from"../DoubleArray.js";import y from"../MeshTransform.js";import{isRelativeVertexSpace as A,vertexSpaceOriginToPoint as w,selectVertexSpace as R}from"../meshVertexSpaceUtils.js";import{a as F,t as b,b as v}from"../../../chunks/vec3.js";import{isGlobal as S,usesLocalTangentPlaneOnECEF as d}from"./geographicUtils.js";import{transformNormal as M,transformTangent as z,projectFromPCPF as U,projectNormalFromPCPF as T,projectTangentFromPCPF as k,projectToPCPF as q,projectNormalToPCPF as B,projectTangentToPCPF as D}from"./projection.js";function E(t,n,e){return S(n.spatialReference,e?.geographic)?I(t,n,!1,e):H(t,n,e)}function O(t,n=l){const{position:e,normal:r,tangent:o}=t;return{position:F(new Float64Array(e.length),e,n),normal:null!=r?M(r,new Float32Array(r.length),n):null,tangent:null!=o?z(o,new Float32Array(o.length),n):null}}function P(t,n,e,r){const{position:o,normal:i,tangent:a}=t;if(!A(n))return{position:o,normal:i,tangent:a};const l=w(n,r);return E(O(t,e?.localMatrix),l,{geographic:"local"===n.type})}function V(t,n,e){const r=R(n,e),o=n.spatialReference,i=A(r);if(!i)return{vertexAttributes:E(t,n,e),vertexSpace:r,transform:null};const{position:a,normal:l,tangent:s}=t,c=d(r,o);switch(r.type){case"georeferenced":return c?{vertexAttributes:I(t,n,i,e),vertexSpace:r,transform:null}:{vertexAttributes:{position:a,normal:l,tangent:s},vertexSpace:r,transform:new y};case"local":return{vertexAttributes:{position:a,normal:l,tangent:s},vertexSpace:r,transform:new y}}}function W(t,n,e){return S(n.spatialReference,e?.geographic)?Q(t,n,e):N(t,n,e)}function C(t,n,e,r,o){if(!A(n))return W(t,r,o);const{spatialReference:i}=r,a=P(t,n,e,i);return r.equals(w(n,i))?N(a,r,o):W(a,r,o)}function G({positions:t,transform:n,vertexSpace:e,inSpatialReference:i,outSpatialReference:a,outPositions:s,localMode:f}){const y=e.origin??u,A=null!=e.origin?n?.localMatrix??l:l;if("georeferenced"===e.type){const n=s??j(t.length);if(r(A,l)?x(n,t):F(n,t,A),!c(y,u)){const[t,e,r]=y;for(let o=0;o<n.length;o+=3)n[o]+=t,n[o+1]+=e,n[o+2]+=r}return h(n,i,0,n,a,0,n.length/3),n}let w=i;const R=m(i);w=a.isWebMercator&&f||!p(i,R)?w:R,g(i,y,tt,w),o(tt,tt,A);const b=s??j(t.length);return F(b,t,tt),h(b,w,0,b,a,0,b.length/3),b}function H(t,n,e){const r=new Float64Array(t.position.length),o=t.position,i=n.x,a=n.y,l=n.z??0,s=_(e?e.unit:null,n.spatialReference);for(let c=0;c<o.length;c+=3)r[c]=o[c]*s+i,r[c+1]=o[c+1]*s+a,r[c+2]=o[c+2]*s+l;return{position:r,normal:t.normal,tangent:t.tangent}}function I(t,n,e,r){const o=n.spatialReference,i=X(n,r,tt),a=new Float64Array(t.position.length),l=J(t.position,i,o,a),s=f(et,i),c=K(l,a,t.normal,s,o),u=L(l,a,t.tangent,s,o);if(e){const{x:t,y:e,z:r}=n;b(l,l,[-t,-e,-(r??0)])}return{position:l,normal:c,tangent:u}}function J(t,n,e,r){F(r,t,n);const o=new Float64Array(t.length);return U(r,o,e)}function K(t,n,e,r,o){if(null==e)return null;const i=new Float32Array(e.length);return v(i,e,r),T(i,t,n,o,i),i}function L(t,n,e,r,o){if(null==e)return null;const i=new Float32Array(e.length);v(i,e,r,4);for(let a=3;a<i.length;a+=4)i[a]=e[a];return k(i,t,n,o,i),i}function N(t,n,e){const r=new Float64Array(t.position.length),o=t.position,i=n.x,a=n.y,l=n.z??0,s=_(e?e.unit:null,n.spatialReference);for(let c=0;c<o.length;c+=3)r[c]=(o[c]-i)/s,r[c+1]=(o[c+1]-a)/s,r[c+2]=(o[c+2]-l)/s;return{position:r,normal:t.normal,tangent:t.tangent}}function Q(t,n,e){const r=n.spatialReference;X(n,e,tt);const o=i(nt,tt),a=new Float64Array(t.position.length),l=Y(t.position,r,o,a),s=f(et,o);return{position:l,normal:Z(t.normal,t.position,a,r,s),tangent:$(t.tangent,t.position,a,r,s)}}function X(t,n,e){g(t.spatialReference,[t.x,t.y,t.z??0],e,m(t.spatialReference));const r=_(n?n.unit:null,t.spatialReference);return a(e,e,[r,r,r]),e}function Y(t,n,e,r){const o=q(t,n,r),i=new Float64Array(o.length);return F(i,o,e),i}function Z(t,n,e,r,o){if(null==t)return null;const i=B(t,n,e,r,new Float32Array(t.length));return v(i,i,o),i}function $(t,n,e,r,o){if(null==t)return null;const i=D(t,n,e,r,new Float32Array(t.length));return v(i,i,o,4),i}function _(e,r){if(null==e)return 1;const o=t(r);return 1/n(o,"meters",e)}const tt=s(),nt=s(),et=e();export{O as applyTransform,E as georeference,P as georeferenceApplyTransform,V as georeferenceByTransform,I as georeferenceGlobal,_ as getUnitScale,G as project,W as ungeoreference,C as ungeoreferenceByTransform,Q as ungeoreferenceGlobal};
5
+ import{getMetersPerCartesianUnitForSR as t,convertUnit as n}from"../../../core/unitUtils.js";import{create as e}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{equals as r,multiply as o,invert as i,scale as a}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as l,create as s}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{j as c}from"../../../chunks/vec32.js";import{ZEROS as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{normalFromMat4 as f}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{canProjectWithoutEngine as p}from"../../projection.js";import{getSphericalPCPF as m}from"../../spatialReferenceEllipsoidUtils.js";import{computeTranslationToOriginAndRotation as g}from"../../projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as h}from"../../projection/projectBuffer.js";import{newDoubleArray as j,copyInto as x}from"../DoubleArray.js";import y from"../MeshTransform.js";import{isRelativeVertexSpace as A,vertexSpaceOriginToPoint as w,selectVertexSpace as R}from"../meshVertexSpaceUtils.js";import{a as F,t as b,b as v}from"../../../chunks/vec3.js";import{isGlobal as S,usesLocalTangentPlaneOnECEF as d}from"./geographicUtils.js";import{transformNormal as M,transformTangent as z,projectFromPCPF as U,projectNormalFromPCPF as T,projectTangentFromPCPF as k,projectToPCPF as q,projectNormalToPCPF as B,projectTangentToPCPF as D}from"./projection.js";function E(t,n,e){return S(n.spatialReference,e?.geographic)?I(t,n,!1,e):H(t,n,e)}function O(t,n=l){const{position:e,normal:r,tangent:o}=t;return{position:F(new Float64Array(e.length),e,n),normal:null!=r?M(r,new Float32Array(r.length),n):null,tangent:null!=o?z(o,new Float32Array(o.length),n):null}}function P(t,n,e,r){const{position:o,normal:i,tangent:a}=t;if(!A(n))return{position:o,normal:i,tangent:a};const l=w(n,r);return E(O(t,e?.localMatrix),l,{geographic:"local"===n.type})}function V(t,n,e){const r=R(n,e),o=n.spatialReference,i=A(r);if(!i)return{vertexAttributes:E(t,n,e),vertexSpace:r,transform:null};const{position:a,normal:l,tangent:s}=t,c=d(r,o);switch(r.type){case"georeferenced":return c?{vertexAttributes:I(t,n,i,e),vertexSpace:r,transform:null}:{vertexAttributes:{position:a,normal:l,tangent:s},vertexSpace:r,transform:new y};case"local":return{vertexAttributes:{position:a,normal:l,tangent:s},vertexSpace:r,transform:new y}}}function W(t,n,e){return S(n.spatialReference,e?.geographic)?Q(t,n,e):N(t,n,e)}function C(t,n,e,r,o){if(!A(n))return W(t,r,o);const{spatialReference:i}=r,a=P(t,n,e,i);return r.equals(w(n,i))?N(a,r,o):W(a,r,o)}function G({positions:t,transform:n,vertexSpace:e,inSpatialReference:i,outSpatialReference:a,outPositions:s,localMode:f}){const y=e.origin??u,A=null!=e.origin?n?.localMatrix??l:l;if("georeferenced"===e.type){const n=s??j(t.length);if(r(A,l)?x(n,t):F(n,t,A),!c(y,u)){const[t,e,r]=y;for(let o=0;o<n.length;o+=3)n[o]+=t,n[o+1]+=e,n[o+2]+=r}return h(n,i,0,n,a,0,n.length/3),n}let w=i;const R=m(i);w=a.isWebMercator&&f||!p(i,R)?w:R,g(i,y,tt,w),o(tt,tt,A);const b=s??j(t.length);return F(b,t,tt),h(b,w,0,b,a,0,b.length/3),b}function H(t,n,e){const r=new Float64Array(t.position.length),o=t.position,i=n.x,a=n.y,l=n.z??0,s=_(e?e.unit:null,n.spatialReference);for(let c=0;c<o.length;c+=3)r[c]=o[c]*s+i,r[c+1]=o[c+1]*s+a,r[c+2]=o[c+2]*s+l;return{position:r,normal:t.normal,tangent:t.tangent}}function I(t,n,e,r){const o=n.spatialReference,i=X(n,r,tt),a=new Float64Array(t.position.length),l=J(t.position,i,o,a),s=f(et,i),c=K(l,a,t.normal,s,o),u=L(l,a,t.tangent,s,o);if(e){const{x:t,y:e,z:r}=n;b(l,l,[-t,-e,-(r??0)])}return{position:l,normal:c,tangent:u}}function J(t,n,e,r){F(r,t,n);const o=new Float64Array(t.length);return U(r,o,e)}function K(t,n,e,r,o){if(null==e)return null;const i=new Float32Array(e.length);return v(i,e,r),T(i,t,n,o,i),i}function L(t,n,e,r,o){if(null==e)return null;const i=new Float32Array(e.length);v(i,e,r,4);for(let a=3;a<i.length;a+=4)i[a]=e[a];return k(i,t,n,o,i),i}function N(t,n,e){const r=new Float64Array(t.position.length),o=t.position,i=n.x,a=n.y,l=n.z??0,s=_(e?e.unit:null,n.spatialReference);for(let c=0;c<o.length;c+=3)r[c]=(o[c]-i)/s,r[c+1]=(o[c+1]-a)/s,r[c+2]=(o[c+2]-l)/s;return{position:r,normal:t.normal,tangent:t.tangent}}function Q(t,n,e){const r=n.spatialReference;X(n,e,tt);const o=i(nt,tt),a=new Float64Array(t.position.length),l=Y(t.position,r,o,a),s=f(et,o);return{position:l,normal:Z(t.normal,t.position,a,r,s),tangent:$(t.tangent,t.position,a,r,s)}}function X(t,n,e){g(t.spatialReference,[t.x,t.y,t.z??0],e,m(t.spatialReference));const r=_(n?n.unit:null,t.spatialReference);return a(e,e,[r,r,r]),e}function Y(t,n,e,r){const o=q(t,n,r),i=new Float64Array(o.length);return F(i,o,e),i}function Z(t,n,e,r,o){if(null==t)return null;const i=B(t,n,e,r,new Float32Array(t.length));return v(i,i,o),i}function $(t,n,e,r,o){if(null==t)return null;const i=D(t,n,e,r,new Float32Array(t.length));return v(i,i,o,4),i}function _(e,r){if(null==e)return 1;const o=t(r);return 1/n(o,"meters",e)}const tt=s(),nt=s(),et=e();export{O as applyTransform,E as georeference,P as georeferenceApplyTransform,V as georeferenceByTransform,I as georeferenceGlobal,_ as getUnitScale,G as project,W as ungeoreference,C as ungeoreferenceByTransform,Q as ungeoreferenceGlobal};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../core/Logger.js";import{F as t,g as r,h as n}from"../../../chunks/vec32.js";import{create as o}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import s from"../MeshComponent.js";import i from"../MeshTransform.js";import{MeshVertexAttributes as l}from"../MeshVertexAttributes.js";import{vertexSpaceOriginToPoint as a}from"../meshVertexSpaceUtils.js";import{georeferenceApplyTransform as c,ungeoreference as f}from"./georeference.js";const u=()=>e.getLogger("esri.geometry.support.triangleMeshMerge");function p(e,t){if(0===e.length)return u().error("merge()","Must specify one more geometries to merge"),null;const r=e[0].spatialReference;for(const c of e){if(!c.spatialReference.equals(r))return u().error("merge()","Geometries must all be in the same spatial reference"),null;if(!c.loaded)return u().error("merge()","Geometries must all be loaded before merging"),null}const n=m(e);if(null==n)return null;const o=y(e),s=[],i={position:0,uv:0,normal:0,tangent:0,color:0},l=new Map,a=new Map;for(const c of e){const e=g(c,n);if(t&&t.reuseMaterials&&c.components)for(const t of c.components)t.material&&l.set(t.material,t.material);x(c,i,l,a,s),b("position",e,o,i,0),b("normal",e,o,i,0),b("tangent",e,o,i,0),b("uv",c.vertexAttributes,o,i,0),b("color",c.vertexAttributes,o,i,255)}return{vertexAttributes:o,components:s,vertexSpace:n.vertexSpace,transform:n.transform,spatialReference:r}}function m(e){let s=null,l=null,a=!0,c=!0,f=null;const p=o();let m=0;for(const n of e){const{vertexSpace:e,transform:o}=n;if(null==l){l=e;const t=l.origin;t&&(f=t)}if(l.type!==e.type)return u().error("merge()",`Inconsistent mesh vertex space for provided geometries. One was ${l.type} while another is ${e.type}. Unable to merge geometries.`),null;null==s||null!=o&&o.equals(s)||(a=!1),null!=o&&null==s&&(s=o);const i=e.origin;i&&(f&&!t(i,f)&&(c=!1),m++,r(p,p,i))}if(null==l)throw new Error;const g=l.clone();if(null==g.origin)return{transform:null,vertexSpace:g,rebake:!1};if(c&&a)return{transform:s?.clone(),vertexSpace:g,rebake:!1};const h=n(p,p,1/m);return g.origin=h,{transform:new i,vertexSpace:g,rebake:!0}}function g(e,t){if(!t.rebake)return e.vertexAttributes;const r=e.vertexSpace,n=t.vertexSpace;if(r.type!==n.type)throw new Error;const o=c(e.vertexAttributes,r,e.transform,e.spatialReference),s="local"===n.type;return f(o,a(n,e.spatialReference),{geographic:s})}function h(e,t){return t.normal>0&&!e.vertexAttributes.normal}function v(e,t,r){h(e,t)&&"source"===r.shading&&(r.shading="flat")}function x(e,t,r,n,o){if(e.components)for(const s of e.components){const i=s.cloneWithDeduplication(r,n),l=t.position/3;if(i.faces)for(let e=0;e<i.faces.length;e++)i.faces[e]+=l;else{i.faces=new Uint32Array(e.vertexAttributes.position.length/3);for(let e=0;e<i.faces.length;e++)i.faces[e]=e+l}v(e,t,i),o.push(i)}else if(e.vertexAttributes&&e.vertexAttributes.position){const r=e.vertexAttributes.position.length/3,n=new Uint32Array(r),i=t.position/3;for(let e=0;e<r;e++)n[e]=e+i;const l=new s({faces:n});v(e,t,l),o.push(l)}}function b(e,t,r,n,o){if(!t)return;const s=t.position;if(!s)return;const i=t[e],l=r[e];if(null==i){let t=n[e];const r=d[e];if(null!=l){for(let e=0;e<s.length;e+=3)for(let n=0;n<r;n++)l[t++]=o;n[e]=t}}else null!=l&&null!=i&&(A(i,0,l,n[e],i.length),n[e]+=i.length)}function A(e,t,r,n,o){for(let s=0;s<o;s++)r[n++]=e[t++];return r}function w(e){let t=!1,r=!1,n=!1,o=!1;for(const s of e){const e=s.vertexAttributes;if(e?.position&&(e.uv&&(t=!0),e.normal&&(r=!0),e.tangent&&(o=!0),e.color&&(n=!0),r&&t&&n&&o))break}return{normal:r,uv:t,color:n,tangent:o}}function y(e){let t=0,r=0,n=0,o=0,s=0;const i=w(e);for(const l of e){const e=l.vertexAttributes;e?.position&&(t+=e.position.length,i.uv&&(r+=e.position.length/d.position*d.uv),i.normal&&(n+=e.position.length/d.position*d.normal),i.color&&(o+=e.position.length/d.position*d.color),i.tangent&&(s+=e.position.length/d.position*d.tangent))}return new l({position:new Float64Array(t),uv:r?new Float32Array(r):null,normal:n?new Float32Array(n):null,tangent:s?new Float32Array(s):null,color:o?new Uint8Array(o):null})}const d={position:3,normal:3,tangent:4,uv:2,color:4};export{p as merge};
5
+ import e from"../../../core/Logger.js";import{G as t,g as r,h as n}from"../../../chunks/vec32.js";import{create as o}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import s from"../MeshComponent.js";import i from"../MeshTransform.js";import{MeshVertexAttributes as l}from"../MeshVertexAttributes.js";import{vertexSpaceOriginToPoint as a}from"../meshVertexSpaceUtils.js";import{georeferenceApplyTransform as c,ungeoreference as f}from"./georeference.js";const u=()=>e.getLogger("esri.geometry.support.triangleMeshMerge");function p(e,t){if(0===e.length)return u().error("merge()","Must specify one more geometries to merge"),null;const r=e[0].spatialReference;for(const c of e){if(!c.spatialReference.equals(r))return u().error("merge()","Geometries must all be in the same spatial reference"),null;if(!c.loaded)return u().error("merge()","Geometries must all be loaded before merging"),null}const n=m(e);if(null==n)return null;const o=y(e),s=[],i={position:0,uv:0,normal:0,tangent:0,color:0},l=new Map,a=new Map;for(const c of e){const e=g(c,n);if(t&&t.reuseMaterials&&c.components)for(const t of c.components)t.material&&l.set(t.material,t.material);x(c,i,l,a,s),b("position",e,o,i,0),b("normal",e,o,i,0),b("tangent",e,o,i,0),b("uv",c.vertexAttributes,o,i,0),b("color",c.vertexAttributes,o,i,255)}return{vertexAttributes:o,components:s,vertexSpace:n.vertexSpace,transform:n.transform,spatialReference:r}}function m(e){let s=null,l=null,a=!0,c=!0,f=null;const p=o();let m=0;for(const n of e){const{vertexSpace:e,transform:o}=n;if(null==l){l=e;const t=l.origin;t&&(f=t)}if(l.type!==e.type)return u().error("merge()",`Inconsistent mesh vertex space for provided geometries. One was ${l.type} while another is ${e.type}. Unable to merge geometries.`),null;null==s||null!=o&&o.equals(s)||(a=!1),null!=o&&null==s&&(s=o);const i=e.origin;i&&(f&&!t(i,f)&&(c=!1),m++,r(p,p,i))}if(null==l)throw new Error;const g=l.clone();if(null==g.origin)return{transform:null,vertexSpace:g,rebake:!1};if(c&&a)return{transform:s?.clone(),vertexSpace:g,rebake:!1};const h=n(p,p,1/m);return g.origin=h,{transform:new i,vertexSpace:g,rebake:!0}}function g(e,t){if(!t.rebake)return e.vertexAttributes;const r=e.vertexSpace,n=t.vertexSpace;if(r.type!==n.type)throw new Error;const o=c(e.vertexAttributes,r,e.transform,e.spatialReference),s="local"===n.type;return f(o,a(n,e.spatialReference),{geographic:s})}function h(e,t){return t.normal>0&&!e.vertexAttributes.normal}function v(e,t,r){h(e,t)&&"source"===r.shading&&(r.shading="flat")}function x(e,t,r,n,o){if(e.components)for(const s of e.components){const i=s.cloneWithDeduplication(r,n),l=t.position/3;if(i.faces)for(let e=0;e<i.faces.length;e++)i.faces[e]+=l;else{i.faces=new Uint32Array(e.vertexAttributes.position.length/3);for(let e=0;e<i.faces.length;e++)i.faces[e]=e+l}v(e,t,i),o.push(i)}else if(e.vertexAttributes&&e.vertexAttributes.position){const r=e.vertexAttributes.position.length/3,n=new Uint32Array(r),i=t.position/3;for(let e=0;e<r;e++)n[e]=e+i;const l=new s({faces:n});v(e,t,l),o.push(l)}}function b(e,t,r,n,o){if(!t)return;const s=t.position;if(!s)return;const i=t[e],l=r[e];if(null==i){let t=n[e];const r=d[e];if(null!=l){for(let e=0;e<s.length;e+=3)for(let n=0;n<r;n++)l[t++]=o;n[e]=t}}else null!=l&&null!=i&&(A(i,0,l,n[e],i.length),n[e]+=i.length)}function A(e,t,r,n,o){for(let s=0;s<o;s++)r[n++]=e[t++];return r}function w(e){let t=!1,r=!1,n=!1,o=!1;for(const s of e){const e=s.vertexAttributes;if(e?.position&&(e.uv&&(t=!0),e.normal&&(r=!0),e.tangent&&(o=!0),e.color&&(n=!0),r&&t&&n&&o))break}return{normal:r,uv:t,color:n,tangent:o}}function y(e){let t=0,r=0,n=0,o=0,s=0;const i=w(e);for(const l of e){const e=l.vertexAttributes;e?.position&&(t+=e.position.length,i.uv&&(r+=e.position.length/d.position*d.uv),i.normal&&(n+=e.position.length/d.position*d.normal),i.color&&(o+=e.position.length/d.position*d.color),i.tangent&&(s+=e.position.length/d.position*d.tangent))}return new l({position:new Float64Array(t),uv:r?new Float32Array(r):null,normal:n?new Float32Array(n):null,tangent:s?new Float32Array(s):null,color:o?new Uint8Array(o):null})}const d={position:3,normal:3,tangent:4,uv:2,color:4};export{p as merge};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../core/Logger.js";import{fromMat4 as e}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromRotation as o}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as n,f as s,g as a,t as l,e as c}from"../../../chunks/vec32.js";import{create as m,ZEROS as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getSphericalPCPF as f}from"../../spatialReferenceEllipsoidUtils.js";import{computeTranslationToOriginAndRotation as g}from"../../projection/computeTranslationToOriginAndRotation.js";import{projectPointToVector as u}from"../../projection/projectPointToVector.js";import{create as j,compose as x,axis as b,angleRad as h}from"../axisAngleDegrees.js";import v from"../MeshTransform.js";import{isRelativeVertexSpace as A}from"../meshVertexSpaceUtils.js";import{usesLocalTangentPlaneOnECEFForOperations as d}from"./geographicUtils.js";import{projectToPCPF as y,projectNormalToPCPF as w,projectTangentToPCPF as R,projectFromPCPF as k,projectNormalFromPCPF as F,projectTangentFromPCPF as L}from"./projection.js";const T="esri.geometry.support.meshUtils.rotate";function U(t,e,r){if(!t.vertexAttributes?.position||0===e[3])return;const{spatialReference:o,vertexSpace:i}=t,n=r?.origin??t.anchor,s=r?.geographic,a=d(T,i,o,s);A(i)?(t.transform??=new v,z(t.transform,i.origin,e,n)):a?C(t,e,n):I(t,e,n)}function z(t,e,r,o){const i=n(S,o.x,o.y,o.z??0),l=s(S,i,e);t.applyLocalInverse(l,V),t.rotation=x(t.rotation,r,j()),t.applyLocalInverse(l,l),s(l,l,V),t.translation=a(m(),t.translation,l)}function C(t,r,o){const i=t.spatialReference,n=f(i),s=M;u(o,s,n)||u(t.origin,s,n);const a=t.vertexAttributes.position,c=t.vertexAttributes.normal,m=t.vertexAttributes.tangent,p=new Float64Array(a.length),j=null!=c?new Float32Array(c.length):null,x=null!=m?new Float32Array(m.length):null;g(n,s,D,n),e(E,D);const h=$;l(b($),b(r),E),h[3]=r[3],y(a,i,p),null!=c&&null!=j&&w(c,a,p,i,j),null!=m&&null!=x&&R(m,a,p,i,x),P(p,h,3,s),k(p,a,i),null!=c&&null!=j&&(P(j,h,3),F(j,a,p,i,c)),null!=m&&null!=x&&(P(x,h,4),L(x,a,p,i,m)),t.vertexAttributesChanged()}function I(e,r,o){const i=M;if(!u(o,i,e.spatialReference)){const r=e.origin;i[0]=r.x,i[1]=r.y,i[2]=r.z,t.getLogger(T).error(`Failed to project specified origin (wkid:${o.spatialReference.wkid}) to mesh spatial reference (wkid:${e.spatialReference.wkid}). Projection may be possible after calling projection.load().`)}P(e.vertexAttributes.position,r,3,i),P(e.vertexAttributes.normal,r,3),P(e.vertexAttributes.tangent,r,4),e.vertexAttributesChanged()}function P(t,e,r,i=p){if(null!=t){o(D,h(e),b(e));for(let e=0;e<t.length;e+=r){for(let r=0;r<3;r++)S[r]=t[e+r]-i[r];c(S,S,D);for(let r=0;r<3;r++)t[e+r]=S[r]+i[r]}}}const S=m(),V=m(),$=j(),D=i(),E=r(),M=m();export{U as rotate};
5
+ import e from"../../../core/Logger.js";import{fromMat4 as t}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromRotationTranslationScaleOrigin as o,multiply as i,getScaling as s,scale as a,getTranslation as n,fromRotation as l}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as c}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{setAxisAngle as m}from"../../../core/libs/gl-matrix-2/math/quat.js";import{create as f}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{s as p,i as g,t as u,e as j}from"../../../chunks/vec32.js";import{ONES as x,ZEROS as b,create as d}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import h from"../../Point.js";import{getSphericalPCPF as v}from"../../spatialReferenceEllipsoidUtils.js";import{computeTranslationToOriginAndRotation as A}from"../../projection/computeTranslationToOriginAndRotation.js";import{projectPointToVector as w}from"../../projection/projectPointToVector.js";import{create as R,angleRad as k,axis as y,fromMatrix as F}from"../axisAngleDegrees.js";import $ from"../MeshTransform.js";import{isMeshWithRelativeVertexSpace as P}from"../meshVertexSpaceUtils.js";import{usesLocalTangentPlaneOnECEFForOperations as S}from"./geographicUtils.js";import{projectToPCPF as T,projectNormalToPCPF as U,projectTangentToPCPF as q,projectFromPCPF as C,projectNormalFromPCPF as L,projectTangentFromPCPF as z}from"./projection.js";import{projectPointToVertexSpace as M}from"./vertexSpaceConversion.js";const V="esri.geometry.support.meshUtils.rotate";function D(e,t,r){if(!e.vertexAttributes?.position||0===t[3])return;const{spatialReference:o,vertexSpace:i}=e,s=r?.origin??e.anchor,a=r?.geographic,n=S(V,i,o,a);P(e)?E(e,t,s):n?O(e,t,s):B(e,t,s)}function E(t,r,l){t.transform??=new $;const{vertexSpace:c,transform:f,spatialReference:u}=t,[j,v,A]=c.origin,w=new h({x:j,y:v,z:A,spatialReference:u}),R=H;if(w.equals(l))p(R,0,0,0);else if(!M(R,l,t))return void e.getLogger(V).error(`Failed to project specified origin (wkid:${l.spatialReference.wkid}) to mesh (wkid:${u.wkid}) ${c.type} vertex space. Projection may be possible after calling projection.load().`);m(W,y(r),k(r));const P=o(I,W,b,x,R),{localMatrix:S}=f,T=i(I,P,S);f.scale=s(d(),T),a(T,T,g(H,f.scale)),f.rotation=F(T),f.translation=n(d(),T)}function O(e,r,o){const i=e.spatialReference,s=v(i),a=Q;w(o,a,s)||w(e.origin,a,s);const n=e.vertexAttributes.position,l=e.vertexAttributes.normal,c=e.vertexAttributes.tangent,m=new Float64Array(n.length),f=null!=l?new Float32Array(l.length):null,p=null!=c?new Float32Array(c.length):null;A(s,a,K,s),t(N,K);const g=J;u(y(J),y(r),N),g[3]=r[3],T(n,i,m),null!=l&&null!=f&&U(l,n,m,i,f),null!=c&&null!=p&&q(c,n,m,i,p),G(m,g,3,a),C(m,n,i),null!=l&&null!=f&&(G(f,g,3),L(f,n,m,i,l)),null!=c&&null!=p&&(G(p,g,4),z(p,n,m,i,c)),e.vertexAttributesChanged()}function B(t,r,o){const i=Q;if(!w(o,i,t.spatialReference)){const r=t.origin;i[0]=r.x,i[1]=r.y,i[2]=r.z,e.getLogger(V).error(`Failed to project specified origin (wkid:${o.spatialReference.wkid}) to mesh spatial reference (wkid:${t.spatialReference.wkid}). Projection may be possible after calling projection.load().`)}G(t.vertexAttributes.position,r,3,i),G(t.vertexAttributes.normal,r,3),G(t.vertexAttributes.tangent,r,4),t.vertexAttributesChanged()}function G(e,t,r,o=b){if(null!=e){l(K,k(t),y(t));for(let t=0;t<e.length;t+=r){for(let r=0;r<3;r++)H[r]=e[t+r]-o[r];j(H,H,K);for(let r=0;r<3;r++)e[t+r]=H[r]+o[r]}}}const H=d(),I=c(),J=R(),K=c(),N=r(),Q=d(),W=f();export{D as rotate};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../core/Logger.js";import{s as t,f as r,h as o,g as n}from"../../../chunks/vec32.js";import{create as i,ZEROS as s}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getSphericalPCPF as l}from"../../spatialReferenceEllipsoidUtils.js";import{projectPointToVector as a}from"../../projection/projectPointToVector.js";import c from"../MeshTransform.js";import{isRelativeVertexSpace as p}from"../meshVertexSpaceUtils.js";import{usesLocalTangentPlaneOnECEFForOperations as f}from"./geographicUtils.js";import{projectToPCPF as m,projectNormalToPCPF as u,projectTangentToPCPF as g,projectFromPCPF as h,projectNormalFromPCPF as j,projectTangentFromPCPF as x}from"./projection.js";const v="esri.geometry.support.meshUtils.scale";function b(e,t,r){if(!e.vertexAttributes?.position)return;const{vertexSpace:o,spatialReference:n}=e,i=r?.origin??e.anchor,s=r?.geographic,l=f(v,o,n,s);p(o)?(e.transform??=new c,d(e.transform,o.origin,t,i)):l?A(e,t,i):y(e,t,i)}function d(e,s,l,a){const c=t(R,a.x,a.y,a.z),p=r(R,c,s);e.applyLocalInverse(p,k);const f=o(i(),e.scale,l);e.scale=f,e.applyLocalInverse(p,p),r(p,p,k),e.translation=n(i(),e.translation,p)}function A(e,t,r){const o=e.spatialReference,n=l(o),i=F;a(r,i,n)||a(e.origin,i,n);const s=e.vertexAttributes.position,c=e.vertexAttributes.normal,p=e.vertexAttributes.tangent,f=new Float64Array(s.length),v=null!=c?new Float32Array(c.length):null,b=null!=p?new Float32Array(p.length):null;m(s,o,f),null!=c&&null!=v&&u(c,s,f,o,v),null!=p&&null!=b&&g(p,s,f,o,b),w(f,t,i),h(f,s,o),null!=c&&null!=v&&j(v,s,f,o,c),null!=p&&null!=b&&x(b,s,f,o,p),e.vertexAttributesChanged()}function y(t,r,o){const n=F;if(!a(o,n,t.spatialReference)){const r=t.origin;n[0]=r.x,n[1]=r.y,n[2]=r.z,e.getLogger(v).error(`Failed to project specified origin (wkid:${o.spatialReference.wkid}) to mesh spatial reference (wkid:${t.spatialReference.wkid}). Projection may be possible after calling projection.load().`)}w(t.vertexAttributes.position,r,n),t.vertexAttributesChanged()}function w(e,t,r=s){if(e)for(let n=0;n<e.length;n+=3){for(let t=0;t<3;t++)R[t]=e[n+t]-r[t];o(R,R,t);for(let t=0;t<3;t++)e[n+t]=R[t]+r[t]}}const R=i(),k=i(),F=i();export{b as scale};
5
+ import e from"../../../core/Logger.js";import{fromRotationTranslationScaleOrigin as t,multiply as r,getScaling as o,scale as i,getTranslation as s}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{IDENTITY as a}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{s as l,i as c,h as f}from"../../../chunks/vec32.js";import{ZEROS as p,create as m}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import g from"../../Point.js";import{getSphericalPCPF as u}from"../../spatialReferenceEllipsoidUtils.js";import{projectPointToVector as j}from"../../projection/projectPointToVector.js";import{fromMatrix as x}from"../axisAngleDegrees.js";import d from"../MeshTransform.js";import{isMeshWithRelativeVertexSpace as h}from"../meshVertexSpaceUtils.js";import{usesLocalTangentPlaneOnECEFForOperations as b}from"./geographicUtils.js";import{projectToPCPF as v,projectNormalToPCPF as w,projectTangentToPCPF as A,projectFromPCPF as k,projectNormalFromPCPF as y,projectTangentFromPCPF as R}from"./projection.js";import{projectPointToVertexSpace as F}from"./vertexSpaceConversion.js";const $="esri.geometry.support.meshUtils.scale";function P(e,t,r){if(!e.vertexAttributes?.position)return;const{vertexSpace:o,spatialReference:i}=e,s=r?.origin??e.anchor,n=r?.geographic,a=b($,o,i,n);h(e)?S(e,t,s):a?U(e,t,s):C(e,t,s)}function S(n,f,u){n.transform??=new d;const{vertexSpace:j,transform:h,spatialReference:b}=n,[v,w,A]=j.origin,k=new g({x:v,y:w,z:A,spatialReference:b}),y=q;if(k.equals(u))l(y,0,0,0);else if(!F(y,u,n))return void e.getLogger($).error(`Failed to project specified origin (wkid:${u.spatialReference.wkid}) to mesh (wkid:${b.wkid}) ${j.type} vertex space. Projection may be possible after calling projection.load().`);const R=l(z,f,f,f),P=t(M,a,p,R,y),{localMatrix:S}=h,U=r(M,P,S);h.scale=o(m(),U),i(U,U,c(q,h.scale)),h.rotation=x(U),h.translation=s(m(),U)}function U(e,t,r){const o=e.spatialReference,i=u(o),s=T;j(r,s,i)||j(e.origin,s,i);const n=e.vertexAttributes.position,a=e.vertexAttributes.normal,l=e.vertexAttributes.tangent,c=new Float64Array(n.length),f=null!=a?new Float32Array(a.length):null,p=null!=l?new Float32Array(l.length):null;v(n,o,c),null!=a&&null!=f&&w(a,n,c,o,f),null!=l&&null!=p&&A(l,n,c,o,p),L(c,t,s),k(c,n,o),null!=a&&null!=f&&y(f,n,c,o,a),null!=l&&null!=p&&R(p,n,c,o,l),e.vertexAttributesChanged()}function C(t,r,o){const i=T;if(!j(o,i,t.spatialReference)){const r=t.origin;i[0]=r.x,i[1]=r.y,i[2]=r.z,e.getLogger($).error(`Failed to project specified origin (wkid:${o.spatialReference.wkid}) to mesh spatial reference (wkid:${t.spatialReference.wkid}). Projection may be possible after calling projection.load().`)}L(t.vertexAttributes.position,r,i),t.vertexAttributesChanged()}function L(e,t,r=p){if(e)for(let o=0;o<e.length;o+=3){for(let t=0;t<3;t++)q[t]=e[o+t]-r[t];f(q,q,t);for(let t=0;t<3;t++)e[o+t]=q[t]+r[t]}}const q=m(),z=m(),M=n(),T=m();export{P as scale};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
+ */
5
+ import{invert as r}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as o}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{f as t,e}from"../../../chunks/vec32.js";import{getSphericalPCPF as i}from"../../spatialReferenceEllipsoidUtils.js";import{computeTranslationToOriginAndRotation as n}from"../../projection/computeTranslationToOriginAndRotation.js";import{projectPointToVector as s}from"../../projection/projectPointToVector.js";function c(o,c,{vertexSpace:f,spatialReference:a}){if("georeferenced"===f.type){const r=o;if(!s(c,r,a))return!1;const{origin:e}=f;return t(o,r,e),!0}const p=i(a),l=o;if(!s(c,l,p))return!1;const{origin:j}=f,u=m;if(!n(a,j,u,p))return!1;const g=r(m,u);return null!=g&&(e(o,l,g),!0)}const m=o();export{c as projectPointToVertexSpace};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{deprecated as e}from"../../core/deprecate.js";import r from"../../core/Logger.js";import n from"../Point.js";import o from"./MeshGeoreferencedVertexSpace.js";import i from"./MeshLocalVertexSpace.js";import{t}from"../../chunks/vec3.js";function c(){return r.getLogger("esri.geometry.Mesh")}function a(e){const{vertexSpace:r}=e;if(null!=r.origin)return e.clone();const{anchor:n}=e,i=n.clone(),c=new o({origin:[i.x,i.y,i.z]}),a=e.cloneWithVertexSpace(c),{position:s}=a.vertexAttributes;return a.vertexAttributes.position=t(new Float64Array(s.length),s,[-i.x,-i.y,-(i.z??0)]),a.vertexAttributesChanged(),a}function s(e,r){switch(e.type){case"georeferenced":return g(e)&&!r.isGeographic&&!r.isWebMercator;case"local":return r.isGeographic||r.isWebMercator}}function g(e){return null!=e.origin}function p(e,r){if(!g(e))return null;const[o,i,t]=e.origin;return new n({x:o,y:i,z:t,spatialReference:r})}function u(r,n){const{x:t,y:a,z:s,spatialReference:g}=r,p=[t,a,s??0];if(void 0!==n?.geographic){if(e(c(),"option: geographic",{replacement:"use vertexSpace option instead",version:"4.29",warnOnce:!0}),!n?.vertexSpace)return n?.geographic?new i({origin:p}):new o({origin:p});c().warn("Deprecated geographic flag ignored since vertexSpace option is provided.")}if(!n?.vertexSpace)return g.isGeographic||g.isWebMercator?new i({origin:p}):new o({origin:p});switch(n.vertexSpace){case"local":return new i({origin:p});case"georeferenced":return new o({origin:p});case"georeferenced-absolute":return new o}}function f(e){return e.isGeographic||e.isWebMercator?"local":"georeferenced"}function l(e,r){return"local"===e?new i({origin:r}):new o({origin:r})}export{l as createVertexSpace,c as getMeshLogger,g as isRelativeVertexSpace,f as preferredVertexSpaceTypeForSR,u as selectVertexSpace,s as shouldUpdateFast,a as toRelativeVertexSpace,p as vertexSpaceOriginToPoint};
5
+ import{deprecated as e}from"../../core/deprecate.js";import r from"../../core/Logger.js";import n from"../Point.js";import o from"./MeshGeoreferencedVertexSpace.js";import i from"./MeshLocalVertexSpace.js";import{t}from"../../chunks/vec3.js";function c(){return r.getLogger("esri.geometry.Mesh")}function a(e){const{vertexSpace:r}=e;if(null!=r.origin)return e.clone();const{anchor:n}=e,i=n.clone(),c=new o({origin:[i.x,i.y,i.z]}),a=e.cloneWithVertexSpace(c),{position:s}=a.vertexAttributes;return a.vertexAttributes.position=t(new Float64Array(s.length),s,[-i.x,-i.y,-(i.z??0)]),a.vertexAttributesChanged(),a}function s(e,r){switch(e.type){case"georeferenced":return g(e)&&!r.isGeographic&&!r.isWebMercator;case"local":return r.isGeographic||r.isWebMercator}}function g(e){return null!=e.origin}function p(e){return g(e.vertexSpace)}function u(e,r){if(!g(e))return null;const[o,i,t]=e.origin;return new n({x:o,y:i,z:t,spatialReference:r})}function f(r,n){const{x:t,y:a,z:s,spatialReference:g}=r,p=[t,a,s??0];if(void 0!==n?.geographic){if(e(c(),"option: geographic",{replacement:"use vertexSpace option instead",version:"4.29",warnOnce:!0}),!n?.vertexSpace)return n?.geographic?new i({origin:p}):new o({origin:p});c().warn("Deprecated geographic flag ignored since vertexSpace option is provided.")}if(!n?.vertexSpace)return g.isGeographic||g.isWebMercator?new i({origin:p}):new o({origin:p});switch(n.vertexSpace){case"local":return new i({origin:p});case"georeferenced":return new o({origin:p});case"georeferenced-absolute":return new o}}function l(e){return e.isGeographic||e.isWebMercator?"local":"georeferenced"}function h(e,r){return"local"===e?new i({origin:r}):new o({origin:r})}export{h as createVertexSpace,c as getMeshLogger,p as isMeshWithRelativeVertexSpace,g as isRelativeVertexSpace,l as preferredVertexSpaceTypeForSR,f as selectVertexSpace,s as shouldUpdateFast,a as toRelativeVertexSpace,u as vertexSpaceOriginToPoint};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as t}from"../../core/mathUtils.js";import{c as n,i as r,f as o,n as c,j as e,s as i,b as u,h as s,g as f}from"../../chunks/vec32.js";import{create as a}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as I,e as N}from"../../chunks/vec42.js";import{projectPointSignedLength as M}from"./vector.js";import{sv4d as m,sv3d as g}from"./vectorStacks.js";import{tangentFrame as h}from"../../views/3d/support/mathUtils.js";function E(t=Y){return[t[0],t[1],t[2],t[3]]}const l=I,p=N;function v(t=Y[0],n=Y[1],r=Y[2],o=Y[3]){return T(t,n,r,o,m.get())}function A(t,n){return T(n[0],n[1],n[2],n[3],t)}function F(t){return t}function T(t,n,r,o,c=E()){return c[0]=t,c[1]=n,c[2]=r,c[3]=o,c}function _(t,r,o){return n(o,t),o[3]=r,o}function j(t,n,r){const o=n[0]*n[0]+n[1]*n[1]+n[2]*n[2],c=Math.abs(o-1)>1e-5&&o>1e-12?1/Math.sqrt(o):1;return r[0]=n[0]*c,r[1]=n[1]*c,r[2]=n[2]*c,r[3]=-(r[0]*t[0]+r[1]*t[1]+r[2]*t[2]),r}function b(t,n,r,o=E()){const c=r[0]-n[0],e=r[1]-n[1],i=r[2]-n[2],u=t[0]-n[0],s=t[1]-n[1],f=t[2]-n[2],a=e*f-i*s,I=i*u-c*f,N=c*s-e*u,M=a*a+I*I+N*N,m=Math.abs(M-1)>1e-5&&M>1e-12?1/Math.sqrt(M):1;return o[0]=a*m,o[1]=I*m,o[2]=N*m,o[3]=-(o[0]*t[0]+o[1]*t[1]+o[2]*t[2]),o}function X(t,n,i,u=0,s=Math.floor(i*(1/3)),f=Math.floor(i*(2/3))){if(i<3)return!1;n(C,u);let a=s,I=!1;for(;a<i-1&&!I;)n(L,a),a++,I=!r(C,L);if(!I)return!1;for(a=Math.max(a,f),I=!1;a<i&&!I;)n(P,a),a++,o(k,C,L),c(k,k),o(x,L,P),c(x,x),I=!r(C,P)&&!r(L,P)&&Math.abs(e(k,x))<y;return I?(b(C,L,P,t),!0):(0!==u||1!==s||2!==f)&&X(t,n,i,0,1,2)}function d(t,n,r=!0){const o=n.length/3;return X(t,((t,r)=>i(t,n[3*r+0],n[3*r+1],n[3*r+2])),r?o-1:o)}const y=.99619469809,C=a(),L=a(),P=a(),k=a(),x=a();function O(t,n,r){return n!==t&&A(t,n),t[3]=-e(F(t),r),t}function q(t,n){return n[0]=-t[0],n[1]=-t[1],n[2]=-t[2],n[3]=-t[3],n}function U(t,n,r,o){return u(P,n,t),j(r,P,o)}function w(t,n,r,c){return W(t,n,o(g.get(),r,n),$,c)}function S(t,n,r){return null!=n&&W(t,n.origin,n.direction,tt,r)}function z(t,n,r){return W(t,n.origin,n.vector,Z.NONE,r)}function B(t,n,r){return W(t,n.origin,n.vector,Z.CLAMP,r)}function D(t,n){return V(t,n)>=0}function G(t,n){const r=e(F(t),n.ray.direction),o=-V(t,n.ray.origin);if(o<0&&r>=0)return!1;if(r>-1e-6&&r<1e-6)return o>0;if((o<0||r<0)&&!(o<0&&r<0))return!0;const c=o/r;return r>0?c<n.c1&&(n.c1=c):c>n.c0&&(n.c0=c),n.c0<=n.c1}function H(t,n){const r=e(F(t),n.ray.direction),o=-V(t,n.ray.origin);if(r>-1e-6&&r<1e-6)return o>0;const c=o/r;return r>0?c<n.c1&&(n.c1=c):c>n.c0&&(n.c0=c),n.c0<=n.c1}function J(t,n,r){const c=s(g.get(),F(t),-t[3]),e=Q(t,o(g.get(),n,c),g.get());return f(r,e,c),r}function K(t,n,r,c){const e=F(t),u=g.get(),s=g.get();h(e,u,s);const f=o(g.get(),r,n),a=M(u,f),I=M(s,f),N=M(e,f);return i(c,a,I,N)}function Q(t,n,r){const c=s(g.get(),F(t),e(F(t),n));return o(r,n,c),r}function R(t,n){return Math.abs(V(t,n))}function V(t,n){return e(F(t),n)+t[3]}function W(n,r,o,c,i){const u=e(F(n),o);if(0===u)return!1;let a=-(e(F(n),r)+n[3])/u;return c&Z.CLAMP&&(a=t(a,0,1)),!(!(c&Z.INFINITE_MIN)&&a<0||!(c&Z.INFINITE_MAX)&&a>1)&&(f(i,r,s(i,o,a)),!0)}const Y=[0,0,1,0];var Z;!function(t){t[t.NONE=0]="NONE",t[t.CLAMP=1]="CLAMP",t[t.INFINITE_MIN=4]="INFINITE_MIN",t[t.INFINITE_MAX=8]="INFINITE_MAX"}(Z||(Z={}));const $=Z.INFINITE_MIN|Z.INFINITE_MAX,tt=Z.INFINITE_MAX;export{G as clip,H as clipInfinite,A as copy,E as create,R as distance,p as equals,l as exactEquals,d as fromArray,X as fromManyPoints,_ as fromNormalAndOffset,b as fromPoints,j as fromPositionAndNormal,T as fromValues,U as fromVectorsAndPoint,F as getNormal,w as intersectLine,z as intersectLineSegment,B as intersectLineSegmentClamp,S as intersectRay,D as isPointInside,q as negate,J as projectPoint,K as projectPointLocal,Q as projectVector,O as setOffsetFromPoint,V as signedDistance,Y as up,v as wrap};
5
+ import{clamp as t}from"../../core/mathUtils.js";import{c as n,j as r,f as o,n as c,k as e,s as u,b as i,h as s,g as f}from"../../chunks/vec32.js";import{create as a}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as I,e as N}from"../../chunks/vec42.js";import{projectPointSignedLength as M}from"./vector.js";import{sv4d as m,sv3d as g}from"./vectorStacks.js";import{tangentFrame as h}from"../../views/3d/support/mathUtils.js";function E(t=Y){return[t[0],t[1],t[2],t[3]]}const l=I,p=N;function v(t=Y[0],n=Y[1],r=Y[2],o=Y[3]){return T(t,n,r,o,m.get())}function A(t,n){return T(n[0],n[1],n[2],n[3],t)}function F(t){return t}function T(t,n,r,o,c=E()){return c[0]=t,c[1]=n,c[2]=r,c[3]=o,c}function _(t,r,o){return n(o,t),o[3]=r,o}function j(t,n,r){const o=n[0]*n[0]+n[1]*n[1]+n[2]*n[2],c=Math.abs(o-1)>1e-5&&o>1e-12?1/Math.sqrt(o):1;return r[0]=n[0]*c,r[1]=n[1]*c,r[2]=n[2]*c,r[3]=-(r[0]*t[0]+r[1]*t[1]+r[2]*t[2]),r}function b(t,n,r,o=E()){const c=r[0]-n[0],e=r[1]-n[1],u=r[2]-n[2],i=t[0]-n[0],s=t[1]-n[1],f=t[2]-n[2],a=e*f-u*s,I=u*i-c*f,N=c*s-e*i,M=a*a+I*I+N*N,m=Math.abs(M-1)>1e-5&&M>1e-12?1/Math.sqrt(M):1;return o[0]=a*m,o[1]=I*m,o[2]=N*m,o[3]=-(o[0]*t[0]+o[1]*t[1]+o[2]*t[2]),o}function X(t,n,u,i=0,s=Math.floor(u*(1/3)),f=Math.floor(u*(2/3))){if(u<3)return!1;n(y,i);let a=s,I=!1;for(;a<u-1&&!I;)n(C,a),a++,I=!r(y,C);if(!I)return!1;for(a=Math.max(a,f),I=!1;a<u&&!I;)n(L,a),a++,o(P,y,C),c(P,P),o(x,C,L),c(x,x),I=!r(y,L)&&!r(C,L)&&Math.abs(e(P,x))<k;return I?(b(y,C,L,t),!0):(0!==i||1!==s||2!==f)&&X(t,n,u,0,1,2)}function d(t,n,r=!0){const o=n.length/3;return X(t,((t,r)=>u(t,n[3*r+0],n[3*r+1],n[3*r+2])),r?o-1:o)}const k=.99619469809,y=a(),C=a(),L=a(),P=a(),x=a();function O(t,n,r){return n!==t&&A(t,n),t[3]=-e(F(t),r),t}function q(t,n){return n[0]=-t[0],n[1]=-t[1],n[2]=-t[2],n[3]=-t[3],n}function U(t,n,r,o){return i(L,n,t),j(r,L,o)}function w(t,n,r,c){return W(t,n,o(g.get(),r,n),$,c)}function S(t,n,r){return null!=n&&W(t,n.origin,n.direction,tt,r)}function z(t,n,r){return W(t,n.origin,n.vector,Z.NONE,r)}function B(t,n,r){return W(t,n.origin,n.vector,Z.CLAMP,r)}function D(t,n){return V(t,n)>=0}function G(t,n){const r=e(F(t),n.ray.direction),o=-V(t,n.ray.origin);if(o<0&&r>=0)return!1;if(r>-1e-6&&r<1e-6)return o>0;if((o<0||r<0)&&!(o<0&&r<0))return!0;const c=o/r;return r>0?c<n.c1&&(n.c1=c):c>n.c0&&(n.c0=c),n.c0<=n.c1}function H(t,n){const r=e(F(t),n.ray.direction),o=-V(t,n.ray.origin);if(r>-1e-6&&r<1e-6)return o>0;const c=o/r;return r>0?c<n.c1&&(n.c1=c):c>n.c0&&(n.c0=c),n.c0<=n.c1}function J(t,n,r){const c=s(g.get(),F(t),-t[3]),e=Q(t,o(g.get(),n,c),g.get());return f(r,e,c),r}function K(t,n,r,c){const e=F(t),i=g.get(),s=g.get();h(e,i,s);const f=o(g.get(),r,n),a=M(i,f),I=M(s,f),N=M(e,f);return u(c,a,I,N)}function Q(t,n,r){const c=s(g.get(),F(t),e(F(t),n));return o(r,n,c),r}function R(t,n){return Math.abs(V(t,n))}function V(t,n){return e(F(t),n)+t[3]}function W(n,r,o,c,u){const i=e(F(n),o);if(0===i)return!1;let a=-(e(F(n),r)+n[3])/i;return c&Z.CLAMP&&(a=t(a,0,1)),!(!(c&Z.INFINITE_MIN)&&a<0||!(c&Z.INFINITE_MAX)&&a>1)&&(f(u,r,s(u,o,a)),!0)}const Y=[0,0,1,0];var Z;!function(t){t[t.NONE=0]="NONE",t[t.CLAMP=1]="CLAMP",t[t.INFINITE_MIN=4]="INFINITE_MIN",t[t.INFINITE_MAX=8]="INFINITE_MAX"}(Z||(Z={}));const $=Z.INFINITE_MIN|Z.INFINITE_MAX,tt=Z.INFINITE_MAX;export{G as clip,H as clipInfinite,A as copy,E as create,R as distance,p as equals,l as exactEquals,d as fromArray,X as fromManyPoints,_ as fromNormalAndOffset,b as fromPoints,j as fromPositionAndNormal,T as fromValues,U as fromVectorsAndPoint,F as getNormal,w as intersectLine,z as intersectLineSegment,B as intersectLineSegmentClamp,S as intersectRay,D as isPointInside,q as negate,J as projectPoint,K as projectPointLocal,Q as projectVector,O as setOffsetFromPoint,V as signedDistance,Y as up,v as wrap};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{equals as i}from"../../core/arrayUtils.js";import{ObjectStack as r}from"../../core/ObjectStack.js";import{c as n,f as o,b as t,n as c,j as e,g as s,h as u}from"../../chunks/vec32.js";import{clone as a,create as f}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{sv3d as g}from"./vectorStacks.js";function d(i){return i?m(a(i.origin),a(i.direction)):m(f(),f())}function m(i,r){return{origin:i,direction:r}}function j(r,n){return i(r.origin,n.origin)&&i(r.direction,n.direction)}function p(i,r){const n=x.get();return n.origin=i,n.direction=r,n}function l(i,r=d()){return k(i.origin,i.direction,r)}function b(i,r,t=d()){return n(t.origin,i),o(t.direction,r,i),t}function k(i,r,o=d()){return n(o.origin,i),n(o.direction,r),o}function v(i,r){const n=t(g.get(),c(g.get(),i.direction),o(g.get(),r,i.origin));return e(n,n)}function h(i,r,n){const t=e(i.direction,o(n,r,i.origin));return s(n,i.origin,u(n,i.direction,t)),n}const x=new r((()=>d()));export{h as closestPoint,l as copy,d as create,v as distance2,j as equals,b as fromPoints,k as fromValues,p as wrap};
5
+ import{equals as i}from"../../core/arrayUtils.js";import{ObjectStack as r}from"../../core/ObjectStack.js";import{c as n,f as o,b as t,n as c,k as e,g as s,h as u}from"../../chunks/vec32.js";import{clone as a,create as f}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{sv3d as g}from"./vectorStacks.js";function d(i){return i?m(a(i.origin),a(i.direction)):m(f(),f())}function m(i,r){return{origin:i,direction:r}}function j(r,n){return i(r.origin,n.origin)&&i(r.direction,n.direction)}function p(i,r){const n=x.get();return n.origin=i,n.direction=r,n}function k(i,r=d()){return b(i.origin,i.direction,r)}function l(i,r,t=d()){return n(t.origin,i),o(t.direction,r,i),t}function b(i,r,o=d()){return n(o.origin,i),n(o.direction,r),o}function v(i,r){const n=t(g.get(),c(g.get(),i.direction),o(g.get(),r,i.origin));return e(n,n)}function h(i,r,n){const t=e(i.direction,o(n,r,i.origin));return s(n,i.origin,u(n,i.direction,t)),n}const x=new r((()=>d()));export{h as closestPoint,k as copy,d as create,v as distance2,j as equals,l as fromPoints,b as fromValues,p as wrap};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{ObjectStack as t}from"../../core/ObjectStack.js";import{c as e,f as n,b as r,j as o,h as c,g as s,l as p}from"../../chunks/vec32.js";import{clone as i,create as a}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as f,distance2 as u,fromValues as g}from"./lineSegment.js";import{sv3d as m}from"./vectorStacks.js";function j(t){return t?{p0:i(t.p0),p1:i(t.p1),p2:i(t.p2)}:{p0:a(),p1:a(),p2:a()}}function l(t,e,n){const r=x.get();return r.p0=t,r.p1=e,r.p2=n,r}function b(t,e=j()){return h(t.p0,t.p1,t.p2,e)}function h(t,n,r,o=j()){return e(o.p0,t),e(o.p1,n),e(o.p2,r),o}function k(t,e){const c=t.p0,s=t.p1,p=t.p2,i=n(m.get(),s,c),a=n(m.get(),p,s),f=n(m.get(),c,p),j=n(m.get(),e,c),l=n(m.get(),e,s),b=n(m.get(),e,p),h=r(i,i,f),k=o(r(m.get(),i,h),j),v=o(r(m.get(),a,h),l),S=o(r(m.get(),f,h),b);if(k>0&&v>0&&S>0){const t=o(h,j);return t*t/o(h,h)}const d=u(g(c,i,w.get()),e),x=u(g(s,a,w.get()),e),M=u(g(p,f,w.get()),e);return Math.min(d,x,M)}function v(t,e,n){const r=1e-5,{direction:o,origin:p}=e,{p0:i,p1:a,p2:f}=t,u=a[0]-i[0],g=a[1]-i[1],m=a[2]-i[2],j=f[0]-i[0],l=f[1]-i[1],b=f[2]-i[2],h=o[1]*b-l*o[2],k=o[2]*j-b*o[0],v=o[0]*l-j*o[1],S=u*h+g*k+m*v;if(S>-r&&S<r)return!1;const d=1/S,w=p[0]-i[0],x=p[1]-i[1],M=p[2]-i[2],O=d*(w*h+x*k+M*v);if(O<0||O>1)return!1;const V=x*m-g*M,q=M*u-m*w,y=w*g-u*x,z=d*(o[0]*V+o[1]*q+o[2]*y);if(z<0||O+z>1)return!1;if(n){c(n,o,d*(j*V+l*q+b*y)),s(n,p,n)}return!0}function S(t,e,n){const r=e[0]-t[0],o=e[1]-t[1],c=n[0]-t[0],s=n[1]-t[1];return.5*Math.abs(r*s-o*c)}function d(t,e,o){return n(M,e,t),n(O,o,t),.5*p(r(M,M,O))}const w=new t(f),x=new t((()=>j())),M=a(),O=a();export{S as areaPoints2d,d as areaPoints3d,b as copy,j as create,k as distance2,h as fromValues,v as intersectRay,l as wrap};
5
+ import{ObjectStack as t}from"../../core/ObjectStack.js";import{c as e,f as n,b as r,k as o,h as c,g as s,l as p}from"../../chunks/vec32.js";import{clone as i,create as a}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as f,distance2 as u,fromValues as g}from"./lineSegment.js";import{sv3d as m}from"./vectorStacks.js";function j(t){return t?{p0:i(t.p0),p1:i(t.p1),p2:i(t.p2)}:{p0:a(),p1:a(),p2:a()}}function l(t,e,n){const r=x.get();return r.p0=t,r.p1=e,r.p2=n,r}function b(t,e=j()){return h(t.p0,t.p1,t.p2,e)}function h(t,n,r,o=j()){return e(o.p0,t),e(o.p1,n),e(o.p2,r),o}function k(t,e){const c=t.p0,s=t.p1,p=t.p2,i=n(m.get(),s,c),a=n(m.get(),p,s),f=n(m.get(),c,p),j=n(m.get(),e,c),l=n(m.get(),e,s),b=n(m.get(),e,p),h=r(i,i,f),k=o(r(m.get(),i,h),j),v=o(r(m.get(),a,h),l),S=o(r(m.get(),f,h),b);if(k>0&&v>0&&S>0){const t=o(h,j);return t*t/o(h,h)}const d=u(g(c,i,w.get()),e),x=u(g(s,a,w.get()),e),M=u(g(p,f,w.get()),e);return Math.min(d,x,M)}function v(t,e,n){const r=1e-5,{direction:o,origin:p}=e,{p0:i,p1:a,p2:f}=t,u=a[0]-i[0],g=a[1]-i[1],m=a[2]-i[2],j=f[0]-i[0],l=f[1]-i[1],b=f[2]-i[2],h=o[1]*b-l*o[2],k=o[2]*j-b*o[0],v=o[0]*l-j*o[1],S=u*h+g*k+m*v;if(S>-r&&S<r)return!1;const d=1/S,w=p[0]-i[0],x=p[1]-i[1],M=p[2]-i[2],O=d*(w*h+x*k+M*v);if(O<0||O>1)return!1;const V=x*m-g*M,q=M*u-m*w,y=w*g-u*x,z=d*(o[0]*V+o[1]*q+o[2]*y);if(z<0||O+z>1)return!1;if(n){c(n,o,d*(j*V+l*q+b*y)),s(n,p,n)}return!0}function S(t,e,n){const r=e[0]-t[0],o=e[1]-t[1],c=n[0]-t[0],s=n[1]-t[1];return.5*Math.abs(r*s-o*c)}function d(t,e,o){return n(M,e,t),n(O,o,t),.5*p(r(M,M,O))}const w=new t(f),x=new t((()=>j())),M=a(),O=a();export{S as areaPoints2d,d as areaPoints3d,b as copy,j as create,k as distance2,h as fromValues,v as intersectRay,l as wrap};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{acosClamped as t}from"../../core/mathUtils.js";import{j as r,h as n,l as o,n as s,b as c}from"../../chunks/vec32.js";import{create as i}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";function e(t,o,s){const c=r(t,o)/r(t,t);return n(s,t,c)}function a(t,n){return r(t,n)/o(t)}function f(n,s){const c=r(n,s)/(o(n)*o(s));return-t(c)}function u(n,o,i){s(m,n),s(h,o);const e=r(m,h),a=t(e),f=c(m,m,h);return r(f,i)<0?2*Math.PI-a:a}const m=i(),h=i();export{f as angle,u as angleAroundAxis,e as projectPoint,a as projectPointSignedLength};
5
+ import{acosClamped as t}from"../../core/mathUtils.js";import{k as r,h as n,l as o,n as s,b as c}from"../../chunks/vec32.js";import{create as i}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";function e(t,o,s){const c=r(t,o)/r(t,t);return n(s,t,c)}function a(t,n){return r(t,n)/o(t)}function f(n,s){const c=r(n,s)/(o(n)*o(s));return-t(c)}function u(n,o,i){s(m,n),s(h,o);const e=r(m,h),a=t(e),f=c(m,m,h);return r(f,i)<0?2*Math.PI-a:a}const m=i(),h=i();export{f as angle,u as angleAroundAxis,e as projectPoint,a as projectPointSignedLength};
package/interfaces.d.ts CHANGED
@@ -7276,7 +7276,7 @@ declare namespace __esri {
7276
7276
  */
7277
7277
  readonly type: "georeferenced";
7278
7278
  /**
7279
- * A georeferenced mesh vertex space.
7279
+ * A mesh vertex space that indicates mesh vertices to be either absolute georeferenced map coordinates or relative offsets in map space to a fully georeferenced origin.
7280
7280
  *
7281
7281
  * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-support-MeshGeoreferencedVertexSpace.html)
7282
7282
  */
@@ -7310,7 +7310,7 @@ declare namespace __esri {
7310
7310
  */
7311
7311
  readonly type: "local";
7312
7312
  /**
7313
- * A local mesh vertex space.
7313
+ * A mesh vertex space that indicates mesh vertices to be in a plain cartesian space as often encountered in 3D modeling and CAD applications.
7314
7314
  *
7315
7315
  * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-support-MeshLocalVertexSpace.html)
7316
7316
  */
@@ -14631,7 +14631,7 @@ declare namespace __esri {
14631
14631
  modifications: SceneModifications;
14632
14632
  readonly type: "integrated-mesh";
14633
14633
  /**
14634
- * The IntegratedMeshLayer is designed for visualizing accurate representations in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html) of infrastructure and natural landscapes that are difficult to access.
14634
+ * The IntegratedMeshLayer is designed for visualizing accurate representations of built and natural environments in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html).
14635
14635
  *
14636
14636
  * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-IntegratedMeshLayer.html)
14637
14637
  */
@@ -45913,7 +45913,7 @@ declare namespace __esri {
45913
45913
 
45914
45914
  export class UniqueValueRenderer {
45915
45915
  /**
45916
- * This property is only relevant When symbolizing polygon features with marker symbols (or [IconSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html)) in the [uniqueValueInfos](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-UniqueValueRenderer.html#uniqueValueInfos) of this renderer.
45916
+ * This property is only relevant when symbolizing polygon features with marker symbols (or [IconSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html)) in the [uniqueValueInfos](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-UniqueValueRenderer.html#uniqueValueInfos) of this renderer.
45917
45917
  *
45918
45918
  * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-UniqueValueRenderer.html#backgroundFillSymbol)
45919
45919
  */
@@ -46033,7 +46033,7 @@ declare namespace __esri {
46033
46033
 
46034
46034
  interface UniqueValueRendererProperties extends RendererProperties, VisualVariablesMixinProperties {
46035
46035
  /**
46036
- * This property is only relevant When symbolizing polygon features with marker symbols (or [IconSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html)) in the [uniqueValueInfos](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-UniqueValueRenderer.html#uniqueValueInfos) of this renderer.
46036
+ * This property is only relevant when symbolizing polygon features with marker symbols (or [IconSymbol3DLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-IconSymbol3DLayer.html)) in the [uniqueValueInfos](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-UniqueValueRenderer.html#uniqueValueInfos) of this renderer.
46037
46037
  *
46038
46038
  * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-UniqueValueRenderer.html#backgroundFillSymbol)
46039
46039
  */
@@ -82305,19 +82305,19 @@ declare namespace __esri {
82305
82305
  *
82306
82306
  * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-3d-webgl.html#fromRenderCoordinates)
82307
82307
  */
82308
- fromRenderCoordinates(view: SceneView, srcCoordinates: number[] | Float32Array | Float64Array, srcStart: number, destCoordinates: number[] | Float32Array | Float64Array, destStart: number, destSpatialReference: SpatialReference, count: number): number[] | Float32Array | Float64Array;
82308
+ fromRenderCoordinates(__0: SceneView, srcCoordinates: number[] | Float32Array | Float64Array, srcStart: number, destCoordinates: number[] | Float32Array | Float64Array, destStart: number, destSpatialReference: SpatialReference, count: number): number[] | Float32Array | Float64Array;
82309
82309
  /**
82310
82310
  * Computes a 4x4 affine transformation matrix that constitutes a linear coordinate transformation from a local Cartesian coordinate system to the virtual world coordinate system.
82311
82311
  *
82312
82312
  * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-3d-webgl.html#renderCoordinateTransformAt)
82313
82313
  */
82314
- renderCoordinateTransformAt(view: SceneView, origin: number[] | Float32Array | Float64Array, srcSpatialReference?: SpatialReference, dest?: number[] | Float32Array): number[] | Float32Array;
82314
+ renderCoordinateTransformAt(__0: SceneView, origin: number[] | Float32Array | Float64Array, srcSpatialReference?: SpatialReference, dest?: number[] | Float32Array): number[] | Float32Array;
82315
82315
  /**
82316
82316
  * Transforms positions from the given spatial reference to the internal rendering coordinate system.
82317
82317
  *
82318
82318
  * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-3d-webgl.html#toRenderCoordinates)
82319
82319
  */
82320
- toRenderCoordinates(view: SceneView, srcCoordinates: number[] | Float32Array | Float64Array, srcStart: number, srcSpatialReference: SpatialReference, destCoordinates: number[] | Float32Array | Float64Array, destStart: number, count: number): number[] | Float32Array | Float64Array;
82320
+ toRenderCoordinates(__0: SceneView, srcCoordinates: number[] | Float32Array | Float64Array, srcStart: number, srcSpatialReference: SpatialReference, destCoordinates: number[] | Float32Array | Float64Array, destStart: number, count: number): number[] | Float32Array | Float64Array;
82321
82321
  }
82322
82322
 
82323
82323
  export const webgl: webgl;
@@ -83852,7 +83852,7 @@ declare namespace __esri {
83852
83852
  *
83853
83853
  * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-interactive-sketch-SketchValueOptions.html#directionMode)
83854
83854
  */
83855
- directionMode: "absolute" | "relative";
83855
+ directionMode: "relative" | "absolute";
83856
83856
  /**
83857
83857
  * The `SketchValueOptions` allows users to configure how numerical values and constraints behave while sketching and editing.
83858
83858
  *
@@ -83869,7 +83869,7 @@ declare namespace __esri {
83869
83869
  *
83870
83870
  * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-interactive-sketch-SketchValueOptions.html#directionMode)
83871
83871
  */
83872
- directionMode?: "absolute" | "relative";
83872
+ directionMode?: "relative" | "absolute";
83873
83873
  }
83874
83874
 
83875
83875
  export class FeatureSnappingLayerSource extends Accessor {
@@ -111318,11 +111318,11 @@ declare namespace __esri {
111318
111318
  */
111319
111319
  duplicate(): void;
111320
111320
  /**
111321
- * Allows creation of a graphic similar to create with the difference that you can provide the geometry of the graphic being created.
111321
+ * Allows creation of a graphic similar to create with the difference that the geometry can be provided directly for the graphic being created.
111322
111322
  *
111323
111323
  * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#place)
111324
111324
  */
111325
- place(): void;
111325
+ place(geometry: Mesh): void;
111326
111326
  /**
111327
111327
  * Incrementally redo actions recorded in the stack.
111328
111328
  *
package/kernel.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";import{buildDate as s,commitHash as e}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const r="4.29";let t,n=r;n=`${"4.29.0"}-next.${s}`;function i(o){t=o}function m(s){const e=t?.findCredential(s);return e?.token?o(s,"token",e.token):s}has("host-webworker");export{m as addTokenParameter,s as buildDate,n as fullVersion,t as id,e as revision,i as setId,r as version};
5
+ import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";import{buildDate as s,commitHash as e}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const r="4.29";let t,i=r;i="4.29.1";function n(o){t=o}function m(s){const e=t?.findCredential(s);return e?.token?o(s,"token",e.token):s}has("host-webworker");export{m as addTokenParameter,s as buildDate,i as fullVersion,t as id,e as revision,n as setId,r as version};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../request.js";import r from"../core/Error.js";import i from"../core/Logger.js";import{rad2deg as o}from"../core/mathUtils.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as a}from"../core/promiseUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import{f as l,g as p,e as c,c as f,x as y,B as h,y as u}from"../chunks/vec32.js";import{fromValues as d,create as x}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{WGS84ECEFSpatialReferenceLike as g}from"../geometry/ellipsoidUtils.js";import v from"../geometry/Extent.js";import j from"../geometry/SpatialReference.js";import{projectBuffer as b}from"../geometry/projection/projectBuffer.js";import S from"./Layer.js";import{APIKeyMixin as w}from"./mixins/APIKeyMixin.js";import{ArcGISService as L}from"./mixins/ArcGISService.js";import{CustomParametersMixin as A}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as I}from"./mixins/OperationalLayer.js";import{PortalLayer as _}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as E}from"./mixins/ScaleRangeLayer.js";import{elevationInfo as M,url as R}from"./support/commonProperties.js";import{logInvalidElevationInfoWarning as N,elevationModeRequiredMessage as T,featureExpressionUnsupportedMessage as D}from"../support/elevationInfoUtils.js";let U=class extends(L(I(_(E(s(A(w(S)))))))){constructor(e){super(e),this.operationalLayerType="IntegratedMesh3DTilesLayer",this.spatialReference=new j({wkid:4326,vcsWkid:115700}),this.fullExtent=new v(-180,-90,180,90,this.spatialReference),this.url=null,this.type="integrated-mesh-3dtiles",this.path=null,this.minScale=0,this.maxScale=0}set elevationInfo(e){this._set("elevationInfo",e),this._validateElevationInfo()}_verifyArray(e,t){if(!Array.isArray(e)||e.length<t)return!1;for(const r of e)if("number"!=typeof r)return!1;return!0}_initFullExtent(e){const t=e.root?.boundingVolume;if(!t)return;if(t.box){const e=t?.box;if(e[3]>7972671&&e[7]>7972671&&e[11]>7945940)return}const r=e.root?.transform,i=x();if(t.region&&this._verifyArray(t.region,6)){const e=t.region,r=o(e[0]),i=o(e[1]),s=e[4],a=o(e[2]),n=o(e[3]),m=e[5];this.fullExtent=new v({xmin:r,ymin:i,zmin:s,xmax:a,ymax:n,zmax:m,spatialReference:this.spatialReference})}else if(t.sphere&&this._verifyArray(t.sphere,4)){const e=t.sphere,o=d(e[0],e[1],e[2]),s=e[3]/Math.sqrt(3),a=x();l(a,o,d(-s,-s,-s));const n=x();if(p(n,o,d(s,s,s)),r&&this._verifyArray(r,16)){const e=r;c(i,a,e),f(a,i),c(i,n,e),f(n,i)}b(a,g,0,a,j.WGS84,0,1),b(n,g,0,n,j.WGS84,0,1);const m=x(),u=x();y(m,a,n),h(u,a,n),this.fullExtent=new v({xmin:m[0],ymin:m[1],zmin:m[2],xmax:u[0],ymax:u[1],zmax:u[2],spatialReference:this.spatialReference})}else if(t.box&&this._verifyArray(t.box,12)){const e=t.box,i=d(e[0],e[1],e[2]),o=d(e[3],e[4],e[5]),s=d(e[6],e[7],e[8]),a=d(e[9],e[10],e[11]),n=[];for(let t=0;t<8;++t)n.push(x());if(p(n[0],i,o),p(n[0],n[0],s),p(n[0],n[0],a),u(n[1],i,o),p(n[1],n[1],s),p(n[1],n[1],a),p(n[2],i,o),u(n[2],n[2],s),p(n[2],n[2],a),u(n[3],i,o),u(n[3],n[3],s),p(n[3],n[3],a),p(n[4],i,o),p(n[4],n[4],s),u(n[4],n[4],a),u(n[5],i,o),p(n[5],n[5],s),u(n[5],n[5],a),p(n[6],i,o),u(n[6],n[6],s),u(n[6],n[6],a),u(n[7],i,o),u(n[7],n[7],s),u(n[7],n[7],a),r&&this._verifyArray(r,16)){const e=r;for(let t=0;t<8;++t)c(n[t],n[t],e)}const m=d(Number.MIN_VALUE,Number.MIN_VALUE,Number.MIN_VALUE),l=d(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE);for(let t=0;t<8;++t)b(n[t],g,0,n[t],j.WGS84,0,1),y(l,l,n[t]),h(m,m,n[t]);this.fullExtent=new v({xmin:l[0],ymin:l[1],zmin:l[2],xmax:m[0],ymax:m[1],zmax:m[2],spatialReference:this.spatialReference})}}async load(e){return this.addResolvingPromise(this._doLoad(e)),this}async _doLoad(e){const i=null!=e?e.signal:null;try{await this.loadFromPortal({supportedTypes:["3DTiles Service"],validateItem:e=>{if(e.typeKeywords?.includes("IntegratedMesh"))return!0;throw new r("portal:invalid-layer-item-type","Invalid layer item, expected '${expectedType}' ",{expectedType:"3DTiles Service containing IntegratedMesh"})}},e)}catch(o){a(o)}if(this.url){const e=t(this.url,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:i}).then((e=>{this._initFullExtent(e.data)}),(e=>{a(e)}));await e}}async fetchAttributionData(){return this.load().then((()=>({})))}_validateElevationInfo(){const e=this.elevationInfo,t="Integrated mesh 3d tiles layers";N(i.getLogger(this),T(t,"absolute-height",e)),N(i.getLogger(this),D(t,e))}};e([n({type:["IntegratedMesh3DTilesLayer"]})],U.prototype,"operationalLayerType",void 0),e([n({type:j})],U.prototype,"spatialReference",void 0),e([n({type:v})],U.prototype,"fullExtent",void 0),e([n(M)],U.prototype,"elevationInfo",null),e([n({type:["show","hide"]})],U.prototype,"listMode",void 0),e([n(R)],U.prototype,"url",void 0),e([n({readOnly:!0})],U.prototype,"type",void 0),e([n({type:String,json:{origins:{"web-scene":{read:!0,write:!0},"portal-item":{read:!0,write:!0}},read:!1}})],U.prototype,"path",void 0),e([n({type:Number,json:{read:!1,origins:{"web-scene":{name:"layerDefinition.minScale",write:!0},"portal-item":{name:"layerDefinition.minScale",write:!0}}}})],U.prototype,"minScale",void 0),e([n({type:Number,json:{read:!1,origins:{"web-scene":{name:"layerDefinition.maxScale",write:!0},"portal-item":{name:"layerDefinition.maxScale",write:!0}}}})],U.prototype,"maxScale",void 0),U=e([m("esri.layers.IntegratedMesh3DTilesLayer")],U);const P=U;export{P as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../request.js";import r from"../core/Error.js";import i from"../core/Logger.js";import{rad2deg as o}from"../core/mathUtils.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as a}from"../core/promiseUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import{f as l,g as p,e as c,c as f,y,C as h,z as d}from"../chunks/vec32.js";import{fromValues as u,create as x}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{WGS84ECEFSpatialReferenceLike as g}from"../geometry/ellipsoidUtils.js";import v from"../geometry/Extent.js";import j from"../geometry/SpatialReference.js";import{projectBuffer as b}from"../geometry/projection/projectBuffer.js";import S from"./Layer.js";import{APIKeyMixin as w}from"./mixins/APIKeyMixin.js";import{ArcGISService as L}from"./mixins/ArcGISService.js";import{CustomParametersMixin as A}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as I}from"./mixins/OperationalLayer.js";import{PortalLayer as _}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as E}from"./mixins/ScaleRangeLayer.js";import{elevationInfo as M,url as R}from"./support/commonProperties.js";import{logInvalidElevationInfoWarning as N,elevationModeRequiredMessage as T,featureExpressionUnsupportedMessage as D}from"../support/elevationInfoUtils.js";let U=class extends(L(I(_(E(s(A(w(S)))))))){constructor(e){super(e),this.operationalLayerType="IntegratedMesh3DTilesLayer",this.spatialReference=new j({wkid:4326,vcsWkid:115700}),this.fullExtent=new v(-180,-90,180,90,this.spatialReference),this.url=null,this.type="integrated-mesh-3dtiles",this.path=null,this.minScale=0,this.maxScale=0}set elevationInfo(e){this._set("elevationInfo",e),this._validateElevationInfo()}_verifyArray(e,t){if(!Array.isArray(e)||e.length<t)return!1;for(const r of e)if("number"!=typeof r)return!1;return!0}_initFullExtent(e){const t=e.root?.boundingVolume;if(!t)return;if(t.box){const e=t?.box;if(e[3]>7972671&&e[7]>7972671&&e[11]>7945940)return}const r=e.root?.transform,i=x();if(t.region&&this._verifyArray(t.region,6)){const e=t.region,r=o(e[0]),i=o(e[1]),s=e[4],a=o(e[2]),n=o(e[3]),m=e[5];this.fullExtent=new v({xmin:r,ymin:i,zmin:s,xmax:a,ymax:n,zmax:m,spatialReference:this.spatialReference})}else if(t.sphere&&this._verifyArray(t.sphere,4)){const e=t.sphere,o=u(e[0],e[1],e[2]),s=e[3]/Math.sqrt(3),a=x();l(a,o,u(-s,-s,-s));const n=x();if(p(n,o,u(s,s,s)),r&&this._verifyArray(r,16)){const e=r;c(i,a,e),f(a,i),c(i,n,e),f(n,i)}b(a,g,0,a,j.WGS84,0,1),b(n,g,0,n,j.WGS84,0,1);const m=x(),d=x();y(m,a,n),h(d,a,n),this.fullExtent=new v({xmin:m[0],ymin:m[1],zmin:m[2],xmax:d[0],ymax:d[1],zmax:d[2],spatialReference:this.spatialReference})}else if(t.box&&this._verifyArray(t.box,12)){const e=t.box,i=u(e[0],e[1],e[2]),o=u(e[3],e[4],e[5]),s=u(e[6],e[7],e[8]),a=u(e[9],e[10],e[11]),n=[];for(let t=0;t<8;++t)n.push(x());if(p(n[0],i,o),p(n[0],n[0],s),p(n[0],n[0],a),d(n[1],i,o),p(n[1],n[1],s),p(n[1],n[1],a),p(n[2],i,o),d(n[2],n[2],s),p(n[2],n[2],a),d(n[3],i,o),d(n[3],n[3],s),p(n[3],n[3],a),p(n[4],i,o),p(n[4],n[4],s),d(n[4],n[4],a),d(n[5],i,o),p(n[5],n[5],s),d(n[5],n[5],a),p(n[6],i,o),d(n[6],n[6],s),d(n[6],n[6],a),d(n[7],i,o),d(n[7],n[7],s),d(n[7],n[7],a),r&&this._verifyArray(r,16)){const e=r;for(let t=0;t<8;++t)c(n[t],n[t],e)}const m=u(Number.MIN_VALUE,Number.MIN_VALUE,Number.MIN_VALUE),l=u(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE);for(let t=0;t<8;++t)b(n[t],g,0,n[t],j.WGS84,0,1),y(l,l,n[t]),h(m,m,n[t]);this.fullExtent=new v({xmin:l[0],ymin:l[1],zmin:l[2],xmax:m[0],ymax:m[1],zmax:m[2],spatialReference:this.spatialReference})}}async load(e){return this.addResolvingPromise(this._doLoad(e)),this}async _doLoad(e){const i=null!=e?e.signal:null;try{await this.loadFromPortal({supportedTypes:["3DTiles Service"],validateItem:e=>{if(e.typeKeywords?.includes("IntegratedMesh"))return!0;throw new r("portal:invalid-layer-item-type","Invalid layer item, expected '${expectedType}' ",{expectedType:"3DTiles Service containing IntegratedMesh"})}},e)}catch(o){a(o)}if(this.url){const e=t(this.url,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:i}).then((e=>{this._initFullExtent(e.data)}),(e=>{a(e)}));await e}}async fetchAttributionData(){return this.load().then((()=>({})))}_validateElevationInfo(){const e=this.elevationInfo,t="Integrated mesh 3d tiles layers";N(i.getLogger(this),T(t,"absolute-height",e)),N(i.getLogger(this),D(t,e))}};e([n({type:["IntegratedMesh3DTilesLayer"]})],U.prototype,"operationalLayerType",void 0),e([n({type:j})],U.prototype,"spatialReference",void 0),e([n({type:v})],U.prototype,"fullExtent",void 0),e([n(M)],U.prototype,"elevationInfo",null),e([n({type:["show","hide"]})],U.prototype,"listMode",void 0),e([n(R)],U.prototype,"url",void 0),e([n({readOnly:!0})],U.prototype,"type",void 0),e([n({type:String,json:{origins:{"web-scene":{read:!0,write:!0},"portal-item":{read:!0,write:!0}},read:!1}})],U.prototype,"path",void 0),e([n({type:Number,json:{origins:{"web-scene":{name:"layerDefinition.minScale",write:()=>{},read:()=>{}},"portal-item":{name:"layerDefinition.minScale",write:()=>{},read:()=>{}}}}})],U.prototype,"minScale",void 0),e([n({type:Number,json:{origins:{"web-scene":{name:"layerDefinition.maxScale",write:()=>{},read:()=>{}},"portal-item":{name:"layerDefinition.maxScale",write:()=>{},read:()=>{}}}}})],U.prototype,"maxScale",void 0),U=e([m("esri.layers.IntegratedMesh3DTilesLayer")],U);const z=U;export{z as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import t from"../core/Collection.js";import a from"../core/Error.js";import i from"../core/Logger.js";import{throwIfAborted as o}from"../core/promiseUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import{encodeGeohash as r}from"../geohash/geohashUtils.js";import h from"./Layer.js";import{convertFromGeometry as l}from"./graphics/featureConversionUtils.js";import p from"./graphics/OptimizedGeometry.js";import{KnowledgeGraphLayerDataManager as c,mockOidFieldName as d,mockOriginIdFieldName as u,mockDestinationIdFieldName as y,mockLayoutGeometryFieldName as m,geohashEncodingPrecision as f}from"./knowledgeGraph/KnowledgeGraphLayerDataManager.js";import g from"./knowledgeGraph/KnowledgeGraphSublayer.js";import{getRelationshipEndNodeIds as k}from"./knowledgeGraph/supportUtils.js";import{BlendLayer as C}from"./mixins/BlendLayer.js";import{ScaleRangeLayer as L}from"./mixins/ScaleRangeLayer.js";import{LCSimpleLayout as M,LCSmartTreeLayout as b,LCRadialTreeLayout as w,LCHierarchicalLayout as D,LCCommunityLayout as x,LCForceDirectedLayout as T,NodeFlag as E,load as N}from"../libs/linkchartlayout/LinkChartLayout.js";import{fetchKnowledgeGraph as G}from"../rest/knowledgeGraphService.js";import R from"../rest/knowledgeGraph/EntityType.js";import I from"../rest/knowledgeGraph/RelationshipType.js";import _ from"../geometry/Extent.js";import A from"../geometry/Point.js";import v from"../geometry/Polyline.js";const S=(e,t,a)=>(e.has(t)||e.set(t,a()),e.get(t));let j=class extends(C(L(h))){constructor(e){if(super(e),this.dataPreloadedInLocalCache=!1,this.defaultLinkChartConfig=null,this._currentLinkChartConfig={layoutMode:"RADIAL_TREE",xScaleFactor:1,yScaleFactor:1},this._graphTypeLookup=new Map,this.dataManager=null,this.knowledgeGraph=null,this.layers=new t,this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map,this.linkChartExtent=new _({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7}),this.linkChartGeohashLookup=new Map,this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.sublayerIdsCache=new Map,this.tables=new t,this.type="link-chart",this._originalInclusionList=e.inclusionModeDefinition,e.dataPreloadedInLocalCache&&!e.inclusionModeDefinition)throw new a("knowledge-graph:linkchart-layer-constructor","If creating a link chart composite layer and configured that data is already loaded in the cache, you must specify an inclusion list so the Composite Layer knows what records belong to it")}normalizeCtorArgs(e){return{url:e.url,title:e.title,dataPreloadedInLocalCache:e.dataPreloadedInLocalCache,defaultLinkChartConfig:e.defaultLinkChartConfig}}_initializeLayerProperties(e){if(!this.title&&this.url){const e=this.url.split("/");this.title=e[e.length-2]}const t=new Set;let o=[],n=[];if(e.inclusionModeDefinition&&(!e.inclusionModeDefinition.namedTypeDefinitions||e.inclusionModeDefinition.namedTypeDefinitions.size<1))throw new a("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined");e.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),e.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),e.inclusionModeDefinition?.generateAllSublayers?(o=e.knowledgeGraph.dataModel.entityTypes??[],n=e.knowledgeGraph.dataModel.relationshipTypes??[]):e.inclusionModeDefinition?.namedTypeDefinitions&&e.inclusionModeDefinition?.namedTypeDefinitions.size>0?e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((a,s)=>{if(!this._graphTypeLookup.get(s))return i.getLogger(this).warn(`A named type, ${s}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(s);this._graphTypeLookup.get(s)instanceof I||"strictOrigin"in this._graphTypeLookup.get(s)?t.has(s)||(t.add(s),n.push(this._graphTypeLookup.get(s))):this._graphTypeLookup.get(s)instanceof R||"properties"in this._graphTypeLookup.get(s)?t.has(s)||(t.add(s),o.push(this._graphTypeLookup.get(s))):(i.getLogger(this).warn(`A named type, ${s}, was in the inclusion list that wasn't properly modeled and will be removed`),e.inclusionModeDefinition?.namedTypeDefinitions.delete(s))})):(o=e.knowledgeGraph.dataModel.entityTypes??[],n=e.knowledgeGraph.dataModel.relationshipTypes??[]);const s=new c({knowledgeGraph:e.knowledgeGraph,inclusionModeDefinition:e.inclusionModeDefinition});this.knowledgeGraph=e.knowledgeGraph,this.memberEntityTypes=o,this.memberRelationshipTypes=n,this.dataManager=s}load(e){return this.addResolvingPromise(new Promise((t=>{G(this.url).then((a=>{if(this._initializeLayerProperties({knowledgeGraph:a,inclusionModeDefinition:this._originalInclusionList}),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.size||(this.dataManager.inclusionModeDefinition={generateAllSublayers:!1,namedTypeDefinitions:new Map},this.dataManager.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})})),this.dataManager.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})}))),this.dataPreloadedInLocalCache)this.loadLayerAssumingLocalCache(),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach((e=>{e.useAllData=!1,e.members?.forEach((e=>{let t;t=e.linkChartLocation instanceof p?e.linkChartLocation:e.linkChartLocation?l(e.linkChartLocation):null,t&&2===t.coords.length&&0===t.lengths.length?(this.linkChartGeohashLookup.set(e.id,r(t.coords[1],t.coords[0],f)),this.entityLinkChartDiagramLookup.set(e.id,t)):(this.linkChartGeohashLookup.set(e.id,""),this.relationshipLinkChartDiagramLookup.set(e.id,t))})),this.addResolvingPromise(this._initializeDiagram().then((async()=>{this.layers.forEach((async e=>{await e.refreshCachedQueryEngine()})),this.tables.forEach((async e=>{await e.refreshCachedQueryEngine()}))})))}));else{const t="GEOGRAPHIC"===this.defaultLinkChartConfig?.layoutMode;this.addResolvingPromise(this.dataManager.refreshCacheContent(void 0,!1,t,!0).then((async()=>{o(e);const t=[],a=[];this.loadLayerAssumingLocalCache(),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1,this.dataManager.inclusionModeDefinition.namedTypeDefinitions.forEach((e=>{e.useAllData=!1}))),await this._initializeDiagram(),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine()),t.push(new Promise((t=>{e.on("layerview-create",(()=>{t(null)}))})))})),this.tables.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),await Promise.all(a)})))}t(null)}))}))),Promise.resolve(this)}async addRecords(e,t){let a=[];t?.cascadeAddRelationshipEndNodes&&this.dataManager.knowledgeGraph.dataModel&&(a=await k(e,this.dataManager.knowledgeGraph));const i=e.concat(a).filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));await this._handleNewRecords(i)}async removeRecords(e,{cascadeRemoveRelationships:t=!0,recalculateLayout:a=!1}={cascadeRemoveRelationships:!0,recalculateLayout:!1}){let i=[];for(const n of e)!1===this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(n.typeName)?.useAllData&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(n.typeName)?.members?.has(n.id)&&i.push(n);if(t){const e=new Set,t=[];for(const a of i)if(this.dataManager.nodeConnectionsLookup.has(a.id))for(const t of this.dataManager.nodeConnectionsLookup.get(a.id))e.add(t);for(const a of e)if(this.dataManager.memberIdTypeLookup.has(a))for(const e of this.dataManager.memberIdTypeLookup.get(a))this.dataManager.relationshipTypeNames.has(e)&&t.push({id:a,typeName:e});i=i.concat(t)}this.dataManager.removeFromLayer(i);for(const n of i)this.sublayerIdsCache.get(n.typeName)?.delete(n.id),this.dataManager.relationshipTypeNames.has(n.typeName)?this.relationshipLinkChartDiagramLookup.delete(n.id):this.entityLinkChartDiagramLookup.delete(n.id);a&&await this.calculateLinkChartLayout(this._currentLinkChartConfig.layoutMode,{xScaleFactor:this._currentLinkChartConfig.xScaleFactor,yScaleFactor:this._currentLinkChartConfig.xScaleFactor});const o=[];return this.layers.forEach((e=>{o.push(e.refreshCachedQueryEngine())})),await Promise.all(o),this._refreshNamedTypes(),i}async expand(e,t){const a=await this.dataManager.getConnectedRecordIds(e,t),i=a.filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));return await this._handleNewRecords(a),{records:i}}loadLayerAssumingLocalCache(){this.memberRelationshipTypes.forEach((e=>{const t=new g({objectType:e,parentCompositeLayer:this,graphType:"relationship",title:e.name});t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.has(e.name)||this.dataManager.sublayerCaches.set(e.name,new Map)})),this.memberEntityTypes.forEach((e=>{const t=new g({objectType:e,parentCompositeLayer:this,graphType:"entity",title:e.name});t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.has(e.name)||this.dataManager.sublayerCaches.set(e.name,new Map)})),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{const a=S(this.sublayerIdsCache,t,(()=>new Set));e.members?.forEach((e=>{if(a.add(e.id),e.linkChartLocation)if(e.linkChartLocation instanceof p)this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e.id,e.linkChartLocation):this.entityLinkChartDiagramLookup.set(e.id,e.linkChartLocation),2===e.linkChartLocation.coords.length&&0===e.linkChartLocation.lengths.length?this.linkChartGeohashLookup.set(e.id,r(e.linkChartLocation.coords[1],e.linkChartLocation.coords[0],f)):this.linkChartGeohashLookup.set(e.id,"");else{const a=l(e.linkChartLocation);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e.id,e.linkChartLocation?a:null):this.entityLinkChartDiagramLookup.set(e.id,e.linkChartLocation?a:null),"x"in e.linkChartLocation&&"y"in e.linkChartLocation?this.linkChartGeohashLookup.set(e.id,r(e.linkChartLocation.x,e.linkChartLocation.y,f)):this.linkChartGeohashLookup.set(e.id,"")}}))}))}async calculateLinkChartLayout(e="RADIAL_TREE",t){const o=[],n=[];this.dataManager.sublayerCaches.forEach(((e,t)=>{this.dataManager.entityTypeNames.has(t)?e.forEach((e=>{o.push({typeName:t,feature:e})})):this.dataManager.relationshipTypeNames.has(t)&&e.forEach((e=>{n.push({typeName:t,feature:e})}))})),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map;const s=new Map,h=new Map,p=new Map,c=new Map,g=new Uint8Array(o.length),k=new Float64Array(o.length),C=new Float64Array(o.length),L=new Uint32Array(n.length),G=new Uint32Array(n.length),R=[],I="FORCE_DIRECTED",S=t?.xScaleFactor??1,j=t?.yScaleFactor??1,P=new _({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7});let F,z="FORCE_DIRECTED",O=0,U=0;switch(z="GEOGRAPHIC"===e?I:e,z){case"FORCE_DIRECTED":F=T.apply;break;case"COMMUNITY":F=x.apply;break;case"HIERARCHICAL":F=D.apply;break;case"RADIAL_TREE":F=w.apply;break;case"SMART_TREE":F=b.apply;break;default:F=M.apply}o.forEach((({typeName:a,feature:i})=>{if(t?.lockedNodeLocations?.has(i.attributes[d])){"GEOGRAPHIC"===e&&this.dataManager.geographicLookup.has(a)?g[O]=E.IsGeographic:g[O]=E.None;const o=t.lockedNodeLocations.get(i.attributes[d]);k[O]=o.x,C[O]=o.y}else if("GEOGRAPHIC"===e&&this.dataManager.geographicLookup.has(a)){g[O]=E.IsGeographic;let e=null;const t=i.attributes[this.dataManager.geographicLookup.get(a).name],o=this.dataManager.geographicLookup.get(a)?.geometryType;switch(o){case"esriGeometryPoint":k[O]=t?.x,C[O]=t?.y;break;case"esriGeometryPolygon":e=t?.centroid,null!=e?.x&&null!=e?.y?(k[O]=e.x,C[O]=e.y):g[O]=E.IsMovable;break;case"esriGeometryPolyline":case"esriGeometryMultipoint":e=t?.extent?.center,null!=e?.x&&null!=e?.y?(k[O]=e.x,C[O]=e.y):g[O]=E.IsMovable;break;default:g[O]=E.IsMovable}(null==k[O]||null==C[O]||Number.isNaN(k[O])||Number.isNaN(C[O]))&&(g[O]=E.IsMovable,k[O]=0,C[O]=0)}else g[O]=E.IsMovable,k[O]=0,C[O]=0;c.set(i.attributes[d],O),R[O]={feature:i,typeName:a},O++}));let Q=!1;n.forEach((e=>{const t=c.get(e.feature.attributes[u]),a=c.get(e.feature.attributes[y]);void 0!==t&&void 0!==a?(L[U]=t,G[U]=a,U++):(Q=!0,this.relationshipLinkChartDiagramLookup.set(e.feature.attributes[u],null),this.linkChartGeohashLookup.set(e.feature.attributes[u],null))})),Q&&i.getLogger(this).warn("A relationship is a member of this layer that has either origin or destination entity nodes that are not members. The diagram geometry will be set to null"),await N();const{success:H}=F(g,k,C,L,G);if(!H)throw new a("knowledge-graph:layout-failed","Attempting to arrange the records in the specified layout failed");for(let a=0;a<R.length;a++){if(g[a]===E.IsMovable&&(k[a]=k[a]*S,C[a]=C[a]*j),C[a]>84.9999&&(C[a]=84.9999),C[a]<-84.9999&&(C[a]=-84.9999),k[a]>179.9999&&(k[a]=179.9999),k[a]<-179.9999&&(k[a]=-179.9999),R[a].feature.attributes[m]=new A(k[a],C[a]),s.has(R[a].typeName)){const e=s.get(R[a].typeName);e?.set(R[a].feature.attributes[d],R[a].feature)}else{const e=new Map;e.set(R[a].feature.attributes[d],R[a].feature),s.set(R[a].typeName,e)}p.set(R[a].feature.attributes[d],R[a].feature);const e=l(R[a].feature.attributes[m]);this.entityLinkChartDiagramLookup.set(R[a].feature.attributes[d],R[a].feature.attributes[m]?e:null),this.linkChartGeohashLookup.set(R[a].feature.attributes[d],r(R[a].feature.attributes[m].y,R[a].feature.attributes[m].x,f)),R[a].feature.attributes[m].x<P.xmin&&(P.xmin=R[a].feature.attributes[m].x),R[a].feature.attributes[m].x>P.xmax&&(P.xmax=R[a].feature.attributes[m].x),R[a].feature.attributes[m].y<P.ymin&&(P.ymin=R[a].feature.attributes[m].y),R[a].feature.attributes[m].y>P.ymax&&(P.ymax=R[a].feature.attributes[m].y)}return this.linkChartExtent.xmin=P.xmin,this.linkChartExtent.xmax=P.xmax,this.linkChartExtent.ymin=P.ymin,this.linkChartExtent.ymax=P.ymax,n.forEach((e=>{const t=R[c.get(e.feature.attributes[u])]?.feature.attributes[m],a=R[c.get(e.feature.attributes[y])]?.feature.attributes[m];if(!t||!a)return;const i=new v({paths:[[t.x,t.y],[a.x,a.y]]});if(e.feature.attributes[m]=i,h.has(e.typeName)){const t=h.get(e.typeName);t?.set(e.feature.attributes[d],e.feature)}else{const t=new Map;t.set(e.feature.attributes[d],e.feature),h.set(e.typeName,t)}p.set(e.feature.attributes[d],e.feature);const o=l(e.feature.attributes[m]);this.relationshipLinkChartDiagramLookup.set(e.feature.attributes[d],e.feature.attributes[m]?o:null),this.linkChartGeohashLookup.set(e.feature.attributes[d],"")})),this._currentLinkChartConfig={layoutMode:e,xScaleFactor:S,yScaleFactor:j},{nodes:s,links:h,idMap:p}}async applyNewLinkChartLayout(e="RADIAL_TREE",t){const a=[];await this.calculateLinkChartLayout(e,t),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),await Promise.all(a),this._refreshNamedTypes()}getCurrentNodeLocations(){const e=new Map;return this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach((t=>{t?.members?.forEach((t=>{const a=t.linkChartLocation;let i;const o=t.id;a&&(i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]},e.set(o,new A({x:i.x,y:i.y})))}))})),e}async synchronizeInclusionListWithCache(){return new Promise((e=>{this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{if(e.useAllData=!1,e.members&&e.members.size>0){if(!this.dataManager.sublayerCaches.get(t))return;const a=new Set(Array.from(this.dataManager.sublayerCaches.get(t).keys()));Array.from(e.members.keys()).filter((e=>!a.has(e))).forEach((t=>{e.members?.delete(t)}))}})),e()}))}async refreshLinkChartCache(e){await this.dataManager.refreshCacheContent(e);const t=[];this.layers.forEach((e=>{t.push(e.refreshCachedQueryEngine())})),await Promise.all(t),this._refreshNamedTypes()}async _handleNewRecords(e){const t=[];this.dataManager.addToLayer(e);for(const a of e)this.sublayerIdsCache.has(a.typeName)||(this.sublayerIdsCache.set(a.typeName,new Set),t.push(a.typeName)),this.sublayerIdsCache.get(a.typeName).add(a.id);for(const a of t)if(this._graphTypeLookup.has(a)){const e=this._graphTypeLookup.get(a),t="endPoints"in e?"relationship":"entity",i=new g({objectType:e,parentCompositeLayer:this,graphType:t,title:a});"entity"===t?this.dataManager.entityTypeNames.add(a):this.dataManager.relationshipTypeNames.add(a),i.geometryType?this.layers.push(i):this.tables.push(i),this.dataManager.sublayerCaches.set(a,new Map)}await this.dataManager.refreshCacheContent(e.map((e=>e.id))),await this.applyNewLinkChartLayout(this._currentLinkChartConfig.layoutMode,{xScaleFactor:this._currentLinkChartConfig.xScaleFactor,yScaleFactor:this._currentLinkChartConfig.xScaleFactor})}async _initializeDiagram(){this.defaultLinkChartConfig?this.defaultLinkChartConfig.doNotRecalculateLayout?(this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e?.members?.forEach((e=>{const a=e.linkChartLocation;let i;const o=e.id;if(!a)return;i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]};const n=l(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(o,n):this.entityLinkChartDiagramLookup.set(o,n),this.linkChartGeohashLookup.set(o,r(i.x,i.y,f)),this.linkChartExtent.xmin>i.x&&(this.linkChartExtent.xmin=i.x),this.linkChartExtent.xmax<i.x&&(this.linkChartExtent.xmax=i.x),this.linkChartExtent.ymin>i.y&&(this.linkChartExtent.ymin=i.y),this.linkChartExtent.ymax<i.y&&(this.linkChartExtent.ymax=i.y)}))})),this.memberRelationshipTypes.forEach((e=>{e.name&&this.dataManager.sublayerCaches.get(e.name)?.forEach((e=>{const t=this.relationshipLinkChartDiagramLookup.get(e.attributes[u]),a=this.relationshipLinkChartDiagramLookup.get(e.attributes[y]);if(t&&a){const i=l(new v({paths:[[t.coords[0],t.coords[1]],[a.coords[0],a.coords[1]]]}));this.relationshipLinkChartDiagramLookup.set(e.attributes[d],i)}else this.relationshipLinkChartDiagramLookup.set(e.attributes[d],null);this.linkChartGeohashLookup.set(e.attributes[d],"")}))}))):await this.calculateLinkChartLayout(this.defaultLinkChartConfig.layoutMode,{xScaleFactor:this.defaultLinkChartConfig.xScaleFactor,yScaleFactor:this.defaultLinkChartConfig.yScaleFactor,lockedNodeLocations:this.getCurrentNodeLocations()}):await this.calculateLinkChartLayout("RADIAL_TREE",{lockedNodeLocations:this.getCurrentNodeLocations()})}_refreshNamedTypes(){for(const e of this.layers)e.emit("refresh",{dataChanged:!0});for(const e of this.tables)e.emit("refresh",{dataChanged:!0})}};e([n()],j.prototype,"dataPreloadedInLocalCache",void 0),e([n()],j.prototype,"defaultLinkChartConfig",void 0),e([n()],j.prototype,"dataManager",void 0),e([n()],j.prototype,"knowledgeGraph",void 0),e([n()],j.prototype,"layers",void 0),e([n()],j.prototype,"entityLinkChartDiagramLookup",void 0),e([n()],j.prototype,"relationshipLinkChartDiagramLookup",void 0),e([n()],j.prototype,"linkChartExtent",void 0),e([n()],j.prototype,"linkChartGeohashLookup",void 0),e([n()],j.prototype,"memberEntityTypes",void 0),e([n()],j.prototype,"memberRelationshipTypes",void 0),e([n()],j.prototype,"sublayerIdsCache",void 0),e([n()],j.prototype,"tables",void 0),e([n({json:{read:!1}})],j.prototype,"type",void 0),j=e([s("esri.layers.LinkChartLayer")],j);const P=j;export{P as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import t from"../core/Collection.js";import a from"../core/Error.js";import i from"../core/Logger.js";import{throwIfAborted as n}from"../core/promiseUtils.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import{encodeGeohash as r}from"../geohash/geohashUtils.js";import h from"./Layer.js";import{convertFromGeometry as l}from"./graphics/featureConversionUtils.js";import p from"./graphics/OptimizedGeometry.js";import{KnowledgeGraphLayerDataManager as d,mockOidFieldName as c,mockOriginIdFieldName as u,mockDestinationIdFieldName as y,mockLayoutGeometryFieldName as m,mockAggregationCountFieldName as g,geohashEncodingPrecision as f}from"./knowledgeGraph/KnowledgeGraphLayerDataManager.js";import k from"./knowledgeGraph/KnowledgeGraphSublayer.js";import{getRelationshipEndNodeIds as L}from"./knowledgeGraph/supportUtils.js";import{BlendLayer as C}from"./mixins/BlendLayer.js";import{ScaleRangeLayer as M}from"./mixins/ScaleRangeLayer.js";import{LCSimpleLayout as w,LCSmartTreeLayout as b,LCRadialTreeLayout as D,LCHierarchicalLayout as x,LCCommunityLayout as T,LCForceDirectedLayout as E,NodeFlag as N,load as G,LinkType as R}from"../libs/linkchartlayout/LinkChartLayout.js";import{fetchKnowledgeGraph as I}from"../rest/knowledgeGraphService.js";import v from"../rest/knowledgeGraph/EntityType.js";import A from"../rest/knowledgeGraph/RelationshipType.js";import _ from"../geometry/Extent.js";import j from"../geometry/Point.js";import P from"../geometry/Polyline.js";const S=(e,t,a)=>(e.has(t)||e.set(t,a()),e.get(t));let z=class extends(C(M(h))){constructor(e){if(super(e),this.dataPreloadedInLocalCache=!1,this.defaultLinkChartConfig=null,this._currentLinkChartConfig={layoutMode:"RADIAL_TREE"},this._graphTypeLookup=new Map,this.dataManager=null,this.knowledgeGraph=null,this.layers=new t,this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map,this.linkChartExtent=new _({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7}),this.linkChartGeohashLookup=new Map,this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.sublayerIdsCache=new Map,this.tables=new t,this.type="link-chart",this._originalInclusionList=e.inclusionModeDefinition,e.dataPreloadedInLocalCache&&!e.inclusionModeDefinition)throw new a("knowledge-graph:linkchart-layer-constructor","If creating a link chart composite layer and configured that data is already loaded in the cache, you must specify an inclusion list so the Composite Layer knows what records belong to it")}normalizeCtorArgs(e){return{url:e.url,title:e.title,dataPreloadedInLocalCache:e.dataPreloadedInLocalCache,defaultLinkChartConfig:e.defaultLinkChartConfig}}_initializeLayerProperties(e){if(!this.title&&this.url){const e=this.url.split("/");this.title=e[e.length-2]}const t=new Set;let n=[],s=[];if(e.inclusionModeDefinition&&(!e.inclusionModeDefinition.namedTypeDefinitions||e.inclusionModeDefinition.namedTypeDefinitions.size<1))throw new a("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined");e.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),e.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),e.inclusionModeDefinition?.generateAllSublayers?(n=e.knowledgeGraph.dataModel.entityTypes??[],s=e.knowledgeGraph.dataModel.relationshipTypes??[]):e.inclusionModeDefinition?.namedTypeDefinitions&&e.inclusionModeDefinition?.namedTypeDefinitions.size>0?e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((a,o)=>{if(!this._graphTypeLookup.get(o))return i.getLogger(this).warn(`A named type, ${o}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(o);this._graphTypeLookup.get(o)instanceof A||"strictOrigin"in this._graphTypeLookup.get(o)?t.has(o)||(t.add(o),s.push(this._graphTypeLookup.get(o))):this._graphTypeLookup.get(o)instanceof v||"properties"in this._graphTypeLookup.get(o)?t.has(o)||(t.add(o),n.push(this._graphTypeLookup.get(o))):(i.getLogger(this).warn(`A named type, ${o}, was in the inclusion list that wasn't properly modeled and will be removed`),e.inclusionModeDefinition?.namedTypeDefinitions.delete(o))})):(n=e.knowledgeGraph.dataModel.entityTypes??[],s=e.knowledgeGraph.dataModel.relationshipTypes??[]);const o=new d({knowledgeGraph:e.knowledgeGraph,inclusionModeDefinition:e.inclusionModeDefinition});this.knowledgeGraph=e.knowledgeGraph,this.memberEntityTypes=n,this.memberRelationshipTypes=s,this.dataManager=o}load(e){return this.addResolvingPromise(new Promise((t=>{I(this.url).then((a=>{if(this._initializeLayerProperties({knowledgeGraph:a,inclusionModeDefinition:this._originalInclusionList}),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.size||(this.dataManager.inclusionModeDefinition={generateAllSublayers:!1,namedTypeDefinitions:new Map},this.dataManager.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})})),this.dataManager.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})}))),this.dataPreloadedInLocalCache)this.loadLayerAssumingLocalCache(),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach((e=>{e.useAllData=!1,e.members?.forEach((e=>{let t;t=e.linkChartLocation instanceof p?e.linkChartLocation:e.linkChartLocation?l(e.linkChartLocation):null,t&&2===t.coords.length&&0===t.lengths.length?(this.linkChartGeohashLookup.set(e.id,r(t.coords[1],t.coords[0],f)),this.entityLinkChartDiagramLookup.set(e.id,t)):(this.linkChartGeohashLookup.set(e.id,""),this.relationshipLinkChartDiagramLookup.set(e.id,t))})),this.addResolvingPromise(this._initializeDiagram().then((async()=>{this.layers.forEach((async e=>{await e.refreshCachedQueryEngine()})),this.tables.forEach((async e=>{await e.refreshCachedQueryEngine()}))})))}));else{const t="GEOGRAPHIC"===this.defaultLinkChartConfig?.layoutMode;this.addResolvingPromise(this.dataManager.refreshCacheContent(void 0,!1,t,!0).then((async()=>{n(e);const t=[],a=[];this.loadLayerAssumingLocalCache(),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1,this.dataManager.inclusionModeDefinition.namedTypeDefinitions.forEach((e=>{e.useAllData=!1}))),await this._initializeDiagram(),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine()),t.push(new Promise((t=>{e.on("layerview-create",(()=>{t(null)}))})))})),this.tables.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),await Promise.all(a)})))}t(null)}))}))),Promise.resolve(this)}async addRecords(e,t){let a=[];t?.cascadeAddRelationshipEndNodes&&this.dataManager.knowledgeGraph.dataModel&&(a=await L(e,this.dataManager.knowledgeGraph));const i=e.concat(a).filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));await this._handleNewRecords(i)}async removeRecords(e,{cascadeRemoveRelationships:t=!0,recalculateLayout:a=!1}={cascadeRemoveRelationships:!0,recalculateLayout:!1}){let i=[];for(const s of e)!1===this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(s.typeName)?.useAllData&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(s.typeName)?.members?.has(s.id)&&i.push(s);if(t){const e=new Set,t=[];for(const a of i)if(this.dataManager.nodeConnectionsLookup.has(a.id))for(const t of this.dataManager.nodeConnectionsLookup.get(a.id))e.add(t);for(const a of e)if(this.dataManager.memberIdTypeLookup.has(a))for(const e of this.dataManager.memberIdTypeLookup.get(a))this.dataManager.relationshipTypeNames.has(e)&&t.push({id:a,typeName:e});i=i.concat(t)}this.dataManager.removeFromLayer(i);for(const s of i)this.sublayerIdsCache.get(s.typeName)?.delete(s.id),this.dataManager.relationshipTypeNames.has(s.typeName)?this.relationshipLinkChartDiagramLookup.delete(s.id):this.entityLinkChartDiagramLookup.delete(s.id);a&&await this.calculateLinkChartLayout(this._currentLinkChartConfig.layoutMode,{});const n=[];return this.layers.forEach((e=>{n.push(e.refreshCachedQueryEngine())})),await Promise.all(n),this._refreshNamedTypes(),i}async expand(e,t){const a=await this.dataManager.getConnectedRecordIds(e,t),i=a.filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));return await this._handleNewRecords(a),{records:i}}loadLayerAssumingLocalCache(){this.memberRelationshipTypes.forEach((e=>{const t=new k({objectType:e,parentCompositeLayer:this,graphType:"relationship",title:e.name});t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.has(e.name)||this.dataManager.sublayerCaches.set(e.name,new Map)})),this.memberEntityTypes.forEach((e=>{const t=new k({objectType:e,parentCompositeLayer:this,graphType:"entity",title:e.name});t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.has(e.name)||this.dataManager.sublayerCaches.set(e.name,new Map)})),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{const a=S(this.sublayerIdsCache,t,(()=>new Set));e.members?.forEach((e=>{if(a.add(e.id),e.linkChartLocation)if(e.linkChartLocation instanceof p)this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e.id,e.linkChartLocation):this.entityLinkChartDiagramLookup.set(e.id,e.linkChartLocation),2===e.linkChartLocation.coords.length&&0===e.linkChartLocation.lengths.length?this.linkChartGeohashLookup.set(e.id,r(e.linkChartLocation.coords[1],e.linkChartLocation.coords[0],f)):this.linkChartGeohashLookup.set(e.id,"");else{const a=l(e.linkChartLocation);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e.id,e.linkChartLocation?a:null):this.entityLinkChartDiagramLookup.set(e.id,e.linkChartLocation?a:null),"x"in e.linkChartLocation&&"y"in e.linkChartLocation?this.linkChartGeohashLookup.set(e.id,r(e.linkChartLocation.x,e.linkChartLocation.y,f)):this.linkChartGeohashLookup.set(e.id,"")}}))}))}async calculateLinkChartLayout(e="RADIAL_TREE",t){const n=[],s=[],o=[];this.dataManager.sublayerCaches.forEach(((e,t)=>{this.dataManager.entityTypeNames.has(t)?e.forEach((e=>{n.push({typeName:t,feature:e})})):this.dataManager.relationshipTypeNames.has(t)&&e.forEach((e=>{s.push({typeName:t,feature:e})}))})),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map;const h=new Map,p=new Map,d=new Map,k=new Map,L=new Uint8Array(n.length),C=new Float64Array(n.length),M=new Float64Array(n.length),I=new Uint32Array(s.length),v=new Uint32Array(s.length),A=[],S="FORCE_DIRECTED",z=new _({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7});let O,U="FORCE_DIRECTED",Q=0,F=0;switch(U="GEOGRAPHIC"===e?S:e,U){case"FORCE_DIRECTED":O=E.apply;break;case"COMMUNITY":O=T.apply;break;case"HIERARCHICAL":O=x.apply;break;case"RADIAL_TREE":O=D.apply;break;case"SMART_TREE":O=b.apply;break;default:O=w.apply}n.forEach((({typeName:a,feature:i})=>{if(t?.lockedNodeLocations?.has(i.attributes[c])){"GEOGRAPHIC"===e&&this.dataManager.geographicLookup.has(a)?L[Q]=N.IsGeographic:L[Q]=N.None;const n=t.lockedNodeLocations.get(i.attributes[c]);C[Q]=n.x,M[Q]=n.y}else if("GEOGRAPHIC"===e&&this.dataManager.geographicLookup.has(a)){L[Q]=N.IsGeographic;let e=null;const t=i.attributes[this.dataManager.geographicLookup.get(a).name],n=this.dataManager.geographicLookup.get(a)?.geometryType;switch(n){case"esriGeometryPoint":C[Q]=t?.x,M[Q]=t?.y;break;case"esriGeometryPolygon":e=t?.centroid,null!=e?.x&&null!=e?.y?(C[Q]=e.x,M[Q]=e.y):L[Q]=N.IsMovable;break;case"esriGeometryPolyline":case"esriGeometryMultipoint":e=t?.extent?.center,null!=e?.x&&null!=e?.y?(C[Q]=e.x,M[Q]=e.y):L[Q]=N.IsMovable;break;default:L[Q]=N.IsMovable}(null==C[Q]||null==M[Q]||Number.isNaN(C[Q])||Number.isNaN(M[Q]))&&(L[Q]=N.IsMovable,C[Q]=0,M[Q]=0)}else L[Q]=N.IsMovable,C[Q]=0,M[Q]=0;k.set(i.attributes[c],Q),A[Q]={feature:i,typeName:a},Q++}));let H=!1;const K=new Map;s.forEach((e=>{const t=e.feature.attributes[u],a=e.feature.attributes[y],i=k.get(t),n=k.get(a);if(void 0!==i&&void 0!==n){const s=t+"-"+a,r=K.get(s),h=r?.has(e.typeName);h||(I[F]=i,v[F]=n,void 0===r?K.set(s,new Map([[e.typeName,F]])):r.set(e.typeName,F),F++),o.push(e)}else H=!0,this.relationshipLinkChartDiagramLookup.set(t,null),this.linkChartGeohashLookup.set(t,null)})),H&&i.getLogger(this).warn("A relationship is a member of this layer that has either origin or destination entity nodes that are not members. The diagram geometry will be set to null"),await G();const{success:$,links:B}=O(L,C,M,I.subarray(0,F),v.subarray(0,F));if(!$)throw new a("knowledge-graph:layout-failed","Attempting to arrange the records in the specified layout failed");for(let a=0;a<A.length;a++){if(M[a]>84.9999?M[a]=84.9999:M[a]<-84.9999&&(M[a]=-84.9999),C[a]>179.9999?C[a]=179.9999:C[a]<-179.9999&&(C[a]=-179.9999),A[a].feature.attributes[m]=new j(C[a],M[a]),h.has(A[a].typeName)){const e=h.get(A[a].typeName);e?.set(A[a].feature.attributes[c],A[a].feature)}else{const e=new Map;e.set(A[a].feature.attributes[c],A[a].feature),h.set(A[a].typeName,e)}d.set(A[a].feature.attributes[c],A[a].feature);const e=l(A[a].feature.attributes[m]);this.entityLinkChartDiagramLookup.set(A[a].feature.attributes[c],A[a].feature.attributes[m]?e:null),this.linkChartGeohashLookup.set(A[a].feature.attributes[c],r(A[a].feature.attributes[m].y,A[a].feature.attributes[m].x,f)),A[a].feature.attributes[m].x<z.xmin&&(z.xmin=A[a].feature.attributes[m].x),A[a].feature.attributes[m].x>z.xmax&&(z.xmax=A[a].feature.attributes[m].x),A[a].feature.attributes[m].y<z.ymin&&(z.ymin=A[a].feature.attributes[m].y),A[a].feature.attributes[m].y>z.ymax&&(z.ymax=A[a].feature.attributes[m].y)}if(this.linkChartExtent.xmin=z.xmin,this.linkChartExtent.xmax=z.xmax,this.linkChartExtent.ymin=z.ymin,this.linkChartExtent.ymax=z.ymax,!B)throw new a("knowledge-graph:layout-failed","Attempting to retrieve link geometry from diagram engine failed");const W=new Map,Y=new Map,q=new Map,J=new Set;for(let a=0;a<o.length;a++){const e=[],t=o[a],n=t.feature.attributes[u],s=t.feature.attributes[y],r=n+"-"+s,h=K.get(r).get(t.typeName),g=0===h?0:B?.vertexEndIndex[h-1];if(!J.has(h)){if(J.add(h),B.types[h]===R.Recursive){const t=[B.vertices[2*g],B.vertices[2*g+1]],a=[B.vertices[2*(g+1)],B.vertices[2*(g+1)+1]],i=[.5*(t[0]+a[0]),.5*(t[1]+a[1])],n=[i[0]-t[0],i[1]-t[1]],s=[i[0]+n[1],i[1]-n[0]],o=[i[0]-n[1],i[1]+n[0]];e.push(t),e.push(s),e.push(a),e.push(o),e.push(t)}else{if(B.types[h]!==R.Regular){i.getLogger(this).warn("A relationship generated an unsupported link geometry type. It will not be rendered");continue}for(let t=g;t<B.vertexEndIndex[h];t++)e.push([B.vertices[2*t],B.vertices[2*t+1]])}const t=A[k.get(n)]?.feature.attributes[m],a=A[k.get(s)]?.feature.attributes[m];e[0][0]===t.x&&e[0][1]===t.y||(e[0]=[t.x,t.y]),e[e.length-1][0]===a.x&&e[e.length-1][1]===a.y||(e[e.length-1]=[a.x,a.y]);for(let i=1;i<e.length-1;i++)e[i][1]>85.5?e[i][1]=85.5:e[i][1]<-85.5&&(e[i][1]=-85.5),e[i][0]>179.9999?e[i][0]=179.9999:e[i][0]<-179.9999&&(e[i][0]=-179.9999);W.has(r)?W.get(r).push(e):W.set(r,[e])}const f=W.get(r);Y.has(r)||(Y.set(r,new Map),q.set(r,new Map));const L=Y.get(r),C=q.get(r);L.has(t.typeName)||(L.set(t.typeName,f.shift()),C.set(t.typeName,0));const M=L.get(t.typeName);C.set(t.typeName,C.get(t.typeName)+1);const w=new P({paths:M});if(t.feature.attributes[m]=w,p.has(t.typeName)){const e=p.get(t.typeName);e?.set(t.feature.attributes[c],t.feature)}else{const e=new Map;e.set(t.feature.attributes[c],t.feature),p.set(t.typeName,e)}d.set(t.feature.attributes[c],t.feature);const b=l(t.feature.attributes[m]);this.relationshipLinkChartDiagramLookup.set(t.feature.attributes[c],t.feature.attributes[m]?b:null),this.linkChartGeohashLookup.set(t.feature.attributes[c],"")}for(const a of o)a.feature.attributes[g]=q.get(a.feature.attributes[u]+"-"+a.feature.attributes[y])?.get(a.typeName)??null;return this._currentLinkChartConfig={layoutMode:e},{nodes:h,links:p,idMap:d}}async applyNewLinkChartLayout(e="RADIAL_TREE",t){const a=[];await this.calculateLinkChartLayout(e,t),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),await Promise.all(a),this._refreshNamedTypes()}getCurrentNodeLocations(){const e=new Map;return this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach((t=>{t?.members?.forEach((t=>{const a=t.linkChartLocation;let i;const n=t.id;a&&(i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]},e.set(n,new j({x:i.x,y:i.y})))}))})),e}async synchronizeInclusionListWithCache(){return new Promise((e=>{this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{if(e.useAllData=!1,e.members&&e.members.size>0){if(!this.dataManager.sublayerCaches.get(t))return;const a=new Set(Array.from(this.dataManager.sublayerCaches.get(t).keys()));Array.from(e.members.keys()).filter((e=>!a.has(e))).forEach((t=>{e.members?.delete(t)}))}})),e()}))}async refreshLinkChartCache(e){await this.dataManager.refreshCacheContent(e);const t=[];this.layers.forEach((e=>{t.push(e.refreshCachedQueryEngine())})),await Promise.all(t),this._refreshNamedTypes()}async _handleNewRecords(e){const t=[];this.dataManager.addToLayer(e);for(const a of e)this.sublayerIdsCache.has(a.typeName)||(this.sublayerIdsCache.set(a.typeName,new Set),t.push(a.typeName)),this.sublayerIdsCache.get(a.typeName).add(a.id);for(const a of t)if(this._graphTypeLookup.has(a)){const e=this._graphTypeLookup.get(a),t="endPoints"in e?"relationship":"entity",i=new k({objectType:e,parentCompositeLayer:this,graphType:t,title:a});"entity"===t?this.dataManager.entityTypeNames.add(a):this.dataManager.relationshipTypeNames.add(a),i.geometryType?this.layers.push(i):this.tables.push(i),this.dataManager.sublayerCaches.set(a,new Map)}await this.dataManager.refreshCacheContent(e.map((e=>e.id))),await this.applyNewLinkChartLayout(this._currentLinkChartConfig.layoutMode)}async _initializeDiagram(){this.defaultLinkChartConfig?this.defaultLinkChartConfig.doNotRecalculateLayout?(this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e?.members?.forEach((e=>{const a=e.linkChartLocation;let i;const n=e.id;if(!a)return;i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]};const s=l(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(n,s):this.entityLinkChartDiagramLookup.set(n,s),this.linkChartGeohashLookup.set(n,r(i.x,i.y,f)),this.linkChartExtent.xmin>i.x&&(this.linkChartExtent.xmin=i.x),this.linkChartExtent.xmax<i.x&&(this.linkChartExtent.xmax=i.x),this.linkChartExtent.ymin>i.y&&(this.linkChartExtent.ymin=i.y),this.linkChartExtent.ymax<i.y&&(this.linkChartExtent.ymax=i.y)}))})),this.memberRelationshipTypes.forEach((e=>{e.name&&this.dataManager.sublayerCaches.get(e.name)?.forEach((e=>{const t=this.relationshipLinkChartDiagramLookup.get(e.attributes[u]),a=this.relationshipLinkChartDiagramLookup.get(e.attributes[y]);if(t&&a){const i=l(new P({paths:[[t.coords[0],t.coords[1]],[a.coords[0],a.coords[1]]]}));this.relationshipLinkChartDiagramLookup.set(e.attributes[c],i)}else this.relationshipLinkChartDiagramLookup.set(e.attributes[c],null);this.linkChartGeohashLookup.set(e.attributes[c],"")}))}))):await this.calculateLinkChartLayout(this.defaultLinkChartConfig.layoutMode,{lockedNodeLocations:this.getCurrentNodeLocations()}):await this.calculateLinkChartLayout("RADIAL_TREE",{lockedNodeLocations:this.getCurrentNodeLocations()})}_refreshNamedTypes(){for(const e of this.layers)e.emit("refresh",{dataChanged:!0});for(const e of this.tables)e.emit("refresh",{dataChanged:!0})}};e([s()],z.prototype,"dataPreloadedInLocalCache",void 0),e([s()],z.prototype,"defaultLinkChartConfig",void 0),e([s()],z.prototype,"dataManager",void 0),e([s()],z.prototype,"knowledgeGraph",void 0),e([s()],z.prototype,"layers",void 0),e([s()],z.prototype,"entityLinkChartDiagramLookup",void 0),e([s()],z.prototype,"relationshipLinkChartDiagramLookup",void 0),e([s()],z.prototype,"linkChartExtent",void 0),e([s()],z.prototype,"linkChartGeohashLookup",void 0),e([s()],z.prototype,"memberEntityTypes",void 0),e([s()],z.prototype,"memberRelationshipTypes",void 0),e([s()],z.prototype,"sublayerIdsCache",void 0),e([s()],z.prototype,"tables",void 0),e([s({json:{read:!1}})],z.prototype,"type",void 0),z=e([o("esri.layers.LinkChartLayer")],z);const O=z;export{O as default};