@agrotools1/at-components 0.2.1 → 0.2.3

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 (553) hide show
  1. package/dist/AGraphicContainer-98a4c8a4.js +109 -0
  2. package/dist/APIKeyMixin-9511e0a5.js +19 -0
  3. package/dist/Analysis-4b1d1fb5.js +31 -0
  4. package/dist/ArcGISCachedService-93e2cb27.js +47 -0
  5. package/dist/ArcGISService-3f8d89c1.js +25 -0
  6. package/dist/AreaMeasurement2D-e0bb230c.js +405 -0
  7. package/dist/AreaMeasurement3D-a9959ecf.js +488 -0
  8. package/dist/AttachmentInfo-601c56e2.js +34 -0
  9. package/dist/AttachmentQuery-3504d550.js +18 -0
  10. package/dist/AttributeStore-b90878e3.js +1707 -0
  11. package/dist/BaseDynamicLayerView2D-b2faf028.js +63 -0
  12. package/dist/BindType-5e76c8e1.js +7 -0
  13. package/dist/BingMapsLayer-5d79fe2b.js +112 -0
  14. package/dist/Bitmap-f775c851.js +128 -0
  15. package/dist/BitmapContainer-af5942b8.js +23 -0
  16. package/dist/BlendLayer-a792edf6.js +13 -0
  17. package/dist/BoundsStore-789624df.js +63 -0
  18. package/dist/BufferObject-cbd0168e.js +100 -0
  19. package/dist/BufferView-004ad517.js +683 -0
  20. package/dist/BuildingSceneLayer-25bc760b.js +535 -0
  21. package/dist/Button/Button.d.ts +24 -2
  22. package/dist/Button-70963624.js +36 -0
  23. package/dist/ByteSizeUnit-90df2840.js +7 -0
  24. package/dist/CSVLayer-fd3b6750.js +208 -0
  25. package/dist/CSVSourceWorker-eb24cd85.js +367 -0
  26. package/dist/CatalogDynamicGroupLayerView2D-dfc700a4.js +66 -0
  27. package/dist/CatalogFootprintLayerView2D-6eb16597.js +76 -0
  28. package/dist/CatalogLayer-1cc632fe.js +262 -0
  29. package/dist/CatalogLayerView2D-d143aa34.js +52 -0
  30. package/dist/Chips/index.d.ts +1 -0
  31. package/dist/CircularArray-b2bc1dfd.js +40 -0
  32. package/dist/ClassBreaksDefinition-07ba0c64.js +18 -0
  33. package/dist/ColorMaterial.glsl-e7801766.js +64 -0
  34. package/dist/ColorSet-df5696b5.js +45 -0
  35. package/dist/ColorStop-7187f368.js +29 -0
  36. package/dist/Container-ac97765a.js +521 -0
  37. package/dist/CustomParametersMixin-b3432b3e.js +12 -0
  38. package/dist/DatePicker/DatePicker.helper.d.ts +22 -0
  39. package/dist/DatePicker/DatePickerCalendar/DatePickerCalendar.helper.d.ts +18 -0
  40. package/dist/DatePicker/index.d.ts +2 -0
  41. package/dist/DefaultMaterial.glsl-3cc4efe7.js +42 -0
  42. package/dist/DefaultMaterial_COLOR_GAMMA-337c63aa.js +653 -0
  43. package/dist/DefaultTheme-12dffc66.js +130 -0
  44. package/dist/DeleteForwardEditsParameters-ae76d898.js +18 -0
  45. package/dist/DimensionLayer-9eb47c76.js +129 -0
  46. package/dist/DirectLineMeasurement3D-e9903136.js +449 -0
  47. package/dist/DistanceMeasurement2D-a4853462.js +303 -0
  48. package/dist/DoubleArray-5076283e.js +25 -0
  49. package/dist/EdgeProcessingWorker-c1783ddd.js +63 -0
  50. package/dist/EditBusLayer-e812f4c9.js +107 -0
  51. package/dist/ElevationInfo-fad03d5e.js +56 -0
  52. package/dist/ElevationLayer-397792d5.js +129 -0
  53. package/dist/ElevationQuery-beceb62f.js +598 -0
  54. package/dist/ElevationSamplerWorker-0048a204.js +62 -0
  55. package/dist/ExportImageParameters-c6c4bc61.js +66 -0
  56. package/dist/ExportStrategy-908f5b8d.js +93 -0
  57. package/dist/ExportWMSImageParameters-34da6b46.js +33 -0
  58. package/dist/External-14daf0c1.js +110 -0
  59. package/dist/FeatureCollectionSnappingSource-f97a1829.js +130 -0
  60. package/dist/FeatureCommandQueue-d4817eac.js +1244 -0
  61. package/dist/FeatureEffect-08976bbd.js +39 -0
  62. package/dist/FeatureEffectLayer-05c258f4.js +13 -0
  63. package/dist/FeatureFilter-8c5e44b1.js +27 -0
  64. package/dist/FeatureLayer-d3659466.js +693 -0
  65. package/dist/FeatureLayerBase-9b63f732.js +148 -0
  66. package/dist/FeatureLayerSource-960f1c01.js +444 -0
  67. package/dist/FeatureLayerView2D-7503e1ed.js +1967 -0
  68. package/dist/FeaturePipelineWorker-d4301d2a.js +3633 -0
  69. package/dist/FeatureReductionLayer-e6cf73ac.js +225 -0
  70. package/dist/FeatureReductionSelection-d90249a7.js +22 -0
  71. package/dist/FeatureServiceSnappingSource-9e49ca72.js +481 -0
  72. package/dist/FeatureServiceSnappingSourceWorker-39b093b3.js +747 -0
  73. package/dist/FeatureSet-d79f0e48.js +188 -0
  74. package/dist/FeatureStore-eb4b87c0.js +131 -0
  75. package/dist/FeatureTemplate-edb1b782.js +12 -0
  76. package/dist/FeatureType-bba29adb.js +25 -0
  77. package/dist/FieldsIndex-75cca4d0.js +109 -0
  78. package/dist/FormTemplate-22911c47.js +350 -0
  79. package/dist/GeoJSONLayer-b33c96b8.js +236 -0
  80. package/dist/GeoJSONSourceWorker-b04ff552.js +247 -0
  81. package/dist/GeoRSSLayer-6e5fcd0e.js +73 -0
  82. package/dist/GeoRSSLayerView2D-21b6b12e.js +140 -0
  83. package/dist/GeometryUtils-fa897cbd.js +403 -0
  84. package/dist/GraphicContainer-1fd6bfce.js +26 -0
  85. package/dist/GraphicManipulator-f3b7dc9b.js +1499 -0
  86. package/dist/GraphicsLayer-e0686779.js +38 -0
  87. package/dist/GraphicsLayerView2D-a7eba2fe.js +114 -0
  88. package/dist/GraphicsSnappingSource-594f402a.js +273 -0
  89. package/dist/GraphicsView2D-347562b8.js +620 -0
  90. package/dist/GroupLayer-7ae0a916.js +147 -0
  91. package/dist/GroupLayerView2D-ffcde606.js +98 -0
  92. package/dist/HUDMaterial.glsl-b0a3e0ce.js +65 -0
  93. package/dist/HighlightCounter-e18f0179.js +41 -0
  94. package/dist/HighlightGraphicContainer-fd774cea.js +18 -0
  95. package/dist/I3SBinaryReader-190e99de.js +310 -0
  96. package/dist/I3SLayerDefinitions-6ddaca60.js +55 -0
  97. package/dist/I3SUtil-44b83dc0.js +59 -0
  98. package/dist/IdentityManager-fbe91c13.js +899 -0
  99. package/dist/ImageHistogramParameters-d64fd9c8.js +905 -0
  100. package/dist/ImageryLayer-67878a78.js +1799 -0
  101. package/dist/ImageryLayerView2D-ae45faba.js +352 -0
  102. package/dist/ImageryTileLayer-9dca8b93.js +2157 -0
  103. package/dist/ImageryTileLayerView2D-977f66aa.js +1110 -0
  104. package/dist/ImmutableArray-fb7b7a6a.js +20 -0
  105. package/dist/Indices-e6dc3b15.js +67 -0
  106. package/dist/Input/Input.core.d.ts +37 -11
  107. package/dist/Input/index.d.ts +37 -11
  108. package/dist/IntegratedMesh3DTilesLayer-8811e7bf.js +112 -0
  109. package/dist/IntegratedMeshLayer-9162c0b5.js +141 -0
  110. package/dist/InteractiveAnalysisViewModel-b046fcb9.js +7397 -0
  111. package/dist/InterleavedLayout-32973c8a.js +163 -0
  112. package/dist/KMLLayer-80f81df7.js +162 -0
  113. package/dist/KMLLayerView2D-b6ba3b80.js +253 -0
  114. package/dist/KnowledgeGraphLayerView2D-ae91bd81.js +43 -0
  115. package/dist/LRUCache-27e8c401.js +32 -0
  116. package/dist/LabelClass-d9a476d6.js +135 -0
  117. package/dist/LabelMetric-e2728bbf.js +400 -0
  118. package/dist/LaserlinePath.glsl-60d00e61.js +64 -0
  119. package/dist/Laserlines.glsl-499a6cbf.js +65 -0
  120. package/dist/LayerFloorInfo-d05cf9dd.js +15 -0
  121. package/dist/LayerView-036988a9.js +206 -0
  122. package/dist/LercWorker-b1b4bb47.js +157 -0
  123. package/dist/LineOfSightLayer-9a9a60b7.js +147 -0
  124. package/dist/LinkChartLayer-d61803bb.js +1027 -0
  125. package/dist/Lyr3DWorker-87be14e0.js +82 -0
  126. package/dist/MD5-1b5ec1c3.js +76 -0
  127. package/dist/MagnifierPrograms-da7a27ab.js +806 -0
  128. package/dist/Map/Map.d.ts +26 -0
  129. package/dist/Map/index.d.ts +1 -0
  130. package/dist/Map/types/index.d.ts +38 -0
  131. package/dist/Map/utils/index.d.ts +24 -0
  132. package/dist/MapImageLayer-f07adf1a.js +169 -0
  133. package/dist/MapImageLayerView2D-d1b140c3.js +146 -0
  134. package/dist/MapNotesLayer-c662d147.js +283 -0
  135. package/dist/MapNotesLayerView2D-bf9ac698.js +161 -0
  136. package/dist/MapServiceLayerViewHelper-fb724de9.js +288 -0
  137. package/dist/MeasurementWidgetContent-e4888ef2.js +2642 -0
  138. package/dist/MediaLayer-36d873a3.js +523 -0
  139. package/dist/MediaLayerView2D-e58b8ec0.js +332 -0
  140. package/dist/MemCache-a9232ec2.js +227 -0
  141. package/dist/MemorySourceWorker-20ff27d6.js +222 -0
  142. package/dist/Mesh-3839826a.js +980 -0
  143. package/dist/MeshLocalVertexSpace-00151564.js +19 -0
  144. package/dist/MultiOriginJSONSupport-bb258670.js +158 -0
  145. package/dist/NestedMap-83f8e815.js +29 -0
  146. package/dist/OGCFeatureLayer-2a8b7ecc.js +211 -0
  147. package/dist/OGCFeatureLayerView2D-185f9649.js +82 -0
  148. package/dist/ObjectStack-10d91171.js +21 -0
  149. package/dist/Octree-78797046.js +495 -0
  150. package/dist/OpenStreetMapLayer-b0a17790.js +30 -0
  151. package/dist/OperationalLayer-55af27d6.js +44 -0
  152. package/dist/OptimizedFeatureSet-54e095c4.js +12 -0
  153. package/dist/OptimizedGeometry-3b808152.js +68 -0
  154. package/dist/OrderByInfo-22e3c805.js +16 -0
  155. package/dist/OrderIndependentTransparency-3eadfe42.js +214 -0
  156. package/dist/OrderedLayer-1403a591.js +26 -0
  157. package/dist/OrientedImageryLayer-8ec8d7d1.js +216 -0
  158. package/dist/OverlayCompositing.glsl-ba3bd81d.js +65 -0
  159. package/dist/OverrideHelper-82325a2c.js +242 -0
  160. package/dist/PBFDecoderWorker-f6517afc.js +213 -0
  161. package/dist/PointCloudLayer-cff43a10.js +197 -0
  162. package/dist/PointCloudUniqueValueRenderer-f337a895.js +115 -0
  163. package/dist/PointCloudWorker-cdb28dc1.js +212 -0
  164. package/dist/PooledRBush-ee4e60af.js +272 -0
  165. package/dist/Popup-c7f55588.js +3990 -0
  166. package/dist/PortalLayer-07b3c53e.js +126 -0
  167. package/dist/Program-ba2f18b2.js +694 -0
  168. package/dist/ProgramTemplate-eee4f097.js +35 -0
  169. package/dist/ProgressBar/ProgressBar.d.ts +0 -13
  170. package/dist/QueryEngine-10c97624.js +896 -0
  171. package/dist/QueryEngineCapabilities-0d8477a2.js +4 -0
  172. package/dist/QueryTask-115430b6.js +119 -0
  173. package/dist/RasterSymbolizer-fbf433fe.js +3024 -0
  174. package/dist/RasterVFDisplayObject-20b0dd86.js +581 -0
  175. package/dist/RasterWorker-44c37e20.js +78 -0
  176. package/dist/RawBlockCache-25203dbd.js +185 -0
  177. package/dist/RealisticTree.glsl-bc07c4dc.js +42 -0
  178. package/dist/Rect-894f011c.js +14 -0
  179. package/dist/RefreshableLayer-9550b85a.js +80 -0
  180. package/dist/RefreshableLayerView-601f7038.js +16 -0
  181. package/dist/Relationship-c662830e.js +64 -0
  182. package/dist/RelationshipQuery-765f068e.js +22 -0
  183. package/dist/RenderState-b244097f.js +7 -0
  184. package/dist/RenderingContext-3db74548.js +889 -0
  185. package/dist/RibbonLine.glsl-c6a715b7.js +65 -0
  186. package/dist/RouteLayer-3f5411f3.js +786 -0
  187. package/dist/RouteLayerView2D-a5fd4cbf.js +195 -0
  188. package/dist/SDFHelper-a34e90ee.js +140 -0
  189. package/dist/SSAO.glsl-5491a708.js +43 -0
  190. package/dist/SSAOBlur.glsl-f3068b8e.js +42 -0
  191. package/dist/ScaleRangeLayer-7ddf00b4.js +21 -0
  192. package/dist/SceneLayer-c594bfc3.js +542 -0
  193. package/dist/SceneLayerSnappingSource-a0504ac7.js +218 -0
  194. package/dist/SceneLayerSnappingSourceWorker-a04d6692.js +112 -0
  195. package/dist/SceneLayerWorker-1865768e.js +164 -0
  196. package/dist/SceneService-fb9f0142.js +215 -0
  197. package/dist/Scheduler-eacc84bb.js +373 -0
  198. package/dist/Select/Item/Item.d.ts +2 -1
  199. package/dist/Select/{Select.multiple.d.ts → Multiple/Select.multiple.d.ts} +26 -16
  200. package/dist/Select/Select.core.d.ts +18 -15
  201. package/dist/Select/{Select.single.d.ts → Single/Select.single.d.ts} +23 -14
  202. package/dist/Select/index.d.ts +42 -24
  203. package/dist/ShadedColorMaterial.glsl-db97956b.js +64 -0
  204. package/dist/SnappingOperation-9622a00d.js +48 -0
  205. package/dist/SourceLayerData-7016f1a5.js +116 -0
  206. package/dist/SpatialFilter-d20d4f50.js +1701 -0
  207. package/dist/Stop-68022e32.js +281 -0
  208. package/dist/StreamLayer-7c837e3d.js +188 -0
  209. package/dist/StreamLayerView2D-586f5a6a.js +164 -0
  210. package/dist/StyleDefinition-f4862d5a.js +36 -0
  211. package/dist/StyleRepository-fba75e70.js +2212 -0
  212. package/dist/SublayersOwner-3dc574cd.js +545 -0
  213. package/dist/SubtypeGroupLayer-1f9c5398.js +514 -0
  214. package/dist/SubtypeGroupLayerView2D-0f108d9d.js +84 -0
  215. package/dist/Tabs/Tab/Tab.d.ts +3 -3
  216. package/dist/TechniqueInstance-0481dbff.js +233 -0
  217. package/dist/TemporalLayer-8116b4a4.js +23 -0
  218. package/dist/Texture-22a8cca5.js +501 -0
  219. package/dist/TextureOnly.glsl-458f8148.js +65 -0
  220. package/dist/Theme-f05b8eb0.js +3426 -0
  221. package/dist/Tick-aef93b48.js +723 -0
  222. package/dist/TileContainer-0bf0ea1b.js +31 -0
  223. package/dist/TileInfoTilemapCache-d78858c0.js +38 -0
  224. package/dist/TileLayer-0edee064.js +194 -0
  225. package/dist/TileLayerView2D-78d5801b.js +187 -0
  226. package/dist/TilemapCache-79699d61.js +189 -0
  227. package/dist/TimeInfo-40c96ade.js +42 -0
  228. package/dist/TimeOnly-9ee66ca6.js +706 -0
  229. package/dist/Tooltip-e7498dc9.js +138 -0
  230. package/dist/TopFeaturesQuery-ad224e01.js +32 -0
  231. package/dist/TurboLine-6ab04aef.js +565 -0
  232. package/dist/UniqueValueRenderer-eaa5f8a6.js +1039 -0
  233. package/dist/UnknownLayer-e280ddd4.js +30 -0
  234. package/dist/UnknownTimeZone-220952b5.js +15 -0
  235. package/dist/UnsupportedLayer-447f7676.js +31 -0
  236. package/dist/UpdateTracking2D-e9adad8f.js +8566 -0
  237. package/dist/Util-002f5109.js +57 -0
  238. package/dist/VectorTileLayer-3210be81.js +544 -0
  239. package/dist/VectorTileLayerView2D-6a51e3b8.js +2108 -0
  240. package/dist/Version-3de8cbca.js +33 -0
  241. package/dist/VertexArrayObject-07998745.js +73 -0
  242. package/dist/VertexAttribute-faad30bf.js +11 -0
  243. package/dist/VertexColor.glsl-e415cf02.js +2683 -0
  244. package/dist/VertexElementDescriptor-d7c718c2.js +8 -0
  245. package/dist/VertexSnappingCandidate-b676241f.js +13 -0
  246. package/dist/VideoLayerView2D-f659dd0d.js +124 -0
  247. package/dist/VoxelLayer-003f82ff.js +631 -0
  248. package/dist/WFSLayer-3da6c5f7.js +221 -0
  249. package/dist/WFSSourceWorker-9a11693a.js +157 -0
  250. package/dist/WGLContainer-3d159b63.js +5426 -0
  251. package/dist/WMSLayer-fc0632f8.js +536 -0
  252. package/dist/WMSLayerView2D-54e80e1b.js +117 -0
  253. package/dist/WMTSLayer-9324b12b.js +531 -0
  254. package/dist/WMTSLayerView2D-3ef936db.js +142 -0
  255. package/dist/WebTileLayer-45c563ff.js +110 -0
  256. package/dist/WhereClause-7a28b740.js +2766 -0
  257. package/dist/WorkerHandle-0d54a6c7.js +47 -0
  258. package/dist/WorkerTileHandler-786c2b24.js +1539 -0
  259. package/dist/action-163397e3.js +198 -0
  260. package/dist/action-group-4859fb97.js +145 -0
  261. package/dist/action-menu-2d70b2fc.js +1759 -0
  262. package/dist/agrotools-theme.css.map +1 -1
  263. package/dist/apng-9b71d52c.js +392 -0
  264. package/dist/ar-a17f8064.js +18 -0
  265. package/dist/arcade-fa309282.js +229 -0
  266. package/dist/arcadeAsyncRuntime-738498fd.js +943 -0
  267. package/dist/arcadeUtils-f71d80fa.js +8741 -0
  268. package/dist/arcgis-knowledge-client-core-6056bcea.js +1218 -0
  269. package/dist/arcgis-knowledge-client-core-simd-9bc1f83e.js +1218 -0
  270. package/dist/arcgisLayers-b2b878bd.js +152 -0
  271. package/dist/associatedFeatureServiceUtils-df5b5187.js +92 -0
  272. package/dist/axisAngleDegrees-32643b7c.js +49 -0
  273. package/dist/basicInterfaces-fa4f5fa7.js +30 -0
  274. package/dist/basis_transcoder-3187cc92.js +1248 -0
  275. package/dist/bg_BG-9950a70b.js +18 -0
  276. package/dist/bs_BA-60482871.js +18 -0
  277. package/dist/ca_ES-a121088e.js +18 -0
  278. package/dist/calcite-action-bar-5a87c23c.js +303 -0
  279. package/dist/calcite-action-ee2ca847.js +22 -0
  280. package/dist/calcite-action-group-19aa86ee.js +28 -0
  281. package/dist/calcite-button-8e9175c0.js +228 -0
  282. package/dist/calcite-flow-57d26d2d.js +128 -0
  283. package/dist/calcite-flow-item-4a3e3fc0.js +499 -0
  284. package/dist/calcite-icon-d99e280a.js +16 -0
  285. package/dist/calcite-input-28b20785.js +24 -0
  286. package/dist/calcite-label-4f30e08d.js +79 -0
  287. package/dist/calcite-list-0cee7628.js +2135 -0
  288. package/dist/calcite-list-item-0a19efa8.js +576 -0
  289. package/dist/calcite-list-item-group-0706662f.js +71 -0
  290. package/dist/calcite-loader-865045b1.js +14 -0
  291. package/dist/calcite-modal-3e4da6fd.js +333 -0
  292. package/dist/calcite-notice-50b74ab7.js +181 -0
  293. package/dist/calcite-option-713c1d40.js +94 -0
  294. package/dist/calcite-scrim-809fbd0b.js +18 -0
  295. package/dist/calcite-select-28d8edfc.js +231 -0
  296. package/dist/capabilities-c8f838be.js +50 -0
  297. package/dist/chartCommon-13718cda.js +256 -0
  298. package/dist/chartUtilsAm5-6be145fb.js +2954 -0
  299. package/dist/clientSideDefaults-5c1f97c9.js +39 -0
  300. package/dist/colorRamps-8792655e.js +38 -0
  301. package/dist/colorUtils-54f4b662.js +164 -0
  302. package/dist/commonProperties-f9559903.js +60 -0
  303. package/dist/component-51a10bc0.js +18 -0
  304. package/dist/computeTranslationToOriginAndRotation-4876cb93.js +60 -0
  305. package/dist/conditionalSlot-87175989.js +27 -0
  306. package/dist/config-61215215.js +7 -0
  307. package/dist/constants-5bd557fe.js +5 -0
  308. package/dist/createConnection-f974a00a.js +299 -0
  309. package/dist/crsUtils-59933b10.js +7 -0
  310. package/dist/cs_CZ-1b968650.js +18 -0
  311. package/dist/da_DK-e0fe1642.js +18 -0
  312. package/dist/dataUtils-7c276b73.js +1421 -0
  313. package/dist/date-1c28c6a5.js +52 -0
  314. package/dist/de_CH-b0dbd4c8.js +6 -0
  315. package/dist/de_DE-8609ef65.js +6 -0
  316. package/dist/debounce-de27a42a.js +121 -0
  317. package/dist/deduplicate-59fb9cac.js +89 -0
  318. package/dist/defaults-2bfa4a36.js +31 -0
  319. package/dist/defaultsJSON-ba17aa15.js +10 -0
  320. package/dist/definitions-a00a3a6c.js +52 -0
  321. package/dist/deleteForwardEdits-f653b513.js +13 -0
  322. package/dist/devEnvironmentUtils-42cb97c7.js +11 -0
  323. package/dist/diffUtils-e71a6152.js +90 -0
  324. package/dist/dom-b589b728.js +358 -0
  325. package/dist/doublePrecisionUtils-46e21550.js +22 -0
  326. package/dist/drapedUtils-b42fcbc6.js +75 -0
  327. package/dist/earcut-6fa1a128.js +292 -0
  328. package/dist/edgeProcessing-2ff1f201.js +252 -0
  329. package/dist/editingSupport-68545668.js +203 -0
  330. package/dist/editsZScale-c7cdd215.js +37 -0
  331. package/dist/el_GR-5cfd1e7e.js +18 -0
  332. package/dist/elevationInfoUtils-5456a079.js +126 -0
  333. package/dist/en_CA-47f2633b.js +18 -0
  334. package/dist/en_US-47f2633b.js +18 -0
  335. package/dist/enums-25d066fc.js +13 -0
  336. package/dist/enums-2c166c09.js +99 -0
  337. package/dist/enums-fa8f05ab.js +152 -0
  338. package/dist/es_ES-489878a2.js +6 -0
  339. package/dist/et_EE-6472669a.js +18 -0
  340. package/dist/executeForIds-4ab75c0d.js +14 -0
  341. package/dist/executeForTopCount-7e095ec1.js +17 -0
  342. package/dist/executeForTopExtents-19daf9d0.js +17 -0
  343. package/dist/executeForTopIds-1ba3a4af.js +17 -0
  344. package/dist/executeQueryJSON-46168866.js +15 -0
  345. package/dist/executeQueryPBF-d8623daf.js +152 -0
  346. package/dist/executeRelationshipQuery-011dfb45.js +53 -0
  347. package/dist/executeTopFeaturesQuery-02166801.js +18 -0
  348. package/dist/featureConversionUtils-650d7601.js +479 -0
  349. package/dist/featureLayerUtils-64e09283.js +142 -0
  350. package/dist/featureLayerUtils-b07f9c11.js +250 -0
  351. package/dist/featureSetUtils-9d37d6f8.js +2530 -0
  352. package/dist/featuresetbase-62aeb079.js +707 -0
  353. package/dist/featuresetgeom-51f9fc4e.js +99 -0
  354. package/dist/featuresetstats-4db32894.js +81 -0
  355. package/dist/featuresetstring-990c3287.js +95 -0
  356. package/dist/fetchService-5198dd4a.js +33 -0
  357. package/dist/fi_FI-d7a3a525.js +18 -0
  358. package/dist/fieldProperties-edfa24cb.js +33 -0
  359. package/dist/floatRGBA-516d7961.js +20 -0
  360. package/dist/floorFilterUtils-936f7587.js +19 -0
  361. package/dist/focusTrapComponent-e849bb89.js +475 -0
  362. package/dist/form-99719d52.js +138 -0
  363. package/dist/fr_FR-a88f2596.js +7 -0
  364. package/dist/geohashUtils-2bc76440.js +85 -0
  365. package/dist/geojson-603231df.js +208 -0
  366. package/dist/geomasync-e9063b4c.js +567 -0
  367. package/dist/geometryEngine-d3bb2fd6.js +192 -0
  368. package/dist/geometryEngineAsync-55aa6170.js +217 -0
  369. package/dist/geometryEngineBase-527e8b63.js +18463 -0
  370. package/dist/geometryEngineJSON-28087174.js +46 -0
  371. package/dist/geometryEngineJSON-d54949f9.js +171 -0
  372. package/dist/geometryEngineWorker-dc2c7127.js +11 -0
  373. package/dist/geometryServiceUtils-6a3e1e93.js +28 -0
  374. package/dist/georeference-ed8b2c30.js +291 -0
  375. package/dist/gif-204e82dd.js +323 -0
  376. package/dist/glUtil-8f8bce6b.js +19 -0
  377. package/dist/gltfexport-b2566542.js +705 -0
  378. package/dist/groupLayerUtils-ea9e6359.js +39 -0
  379. package/dist/guid-5ee54248.js +17 -0
  380. package/dist/he_IL-e34cf273.js +18 -0
  381. package/dist/heatmapUtils-56758920.js +45 -0
  382. package/dist/highlightReasons-de432106.js +19 -0
  383. package/dist/hr_HR-6a124f87.js +18 -0
  384. package/dist/hu_HU-58f3feb6.js +18 -0
  385. package/dist/hydrated-0e1c7565.js +40 -0
  386. package/dist/i3s-bb0b5b67.js +809 -0
  387. package/dist/icon-c6e3bd23.js +127 -0
  388. package/dist/id_ID-18d97715.js +18 -0
  389. package/dist/imageBitmapUtils-881d8c64.js +23 -0
  390. package/dist/imageUtils-57eeedc5.js +69 -0
  391. package/dist/imageUtils-ef69c578.js +89 -0
  392. package/dist/imageryUtils-23f51cb1.js +43 -0
  393. package/dist/index-01c737ed.js +42563 -0
  394. package/dist/index.d.ts +2 -1
  395. package/dist/index.js +22 -10184
  396. package/dist/infoFor3D-bf4e6c95.js +58 -0
  397. package/dist/input-message-673a9baa.js +92 -0
  398. package/dist/input2-bbf6454e.js +575 -0
  399. package/dist/interactive-aeb2cb9f.js +80 -0
  400. package/dist/interfaces-fac3cfda.js +7 -0
  401. package/dist/it_IT-49e70bbf.js +6 -0
  402. package/dist/ja_JP-eaef2cc3.js +18 -0
  403. package/dist/json-5febf88a.js +57 -0
  404. package/dist/jsonContext-2dc288b1.js +15 -0
  405. package/dist/jsonUtils-1abd4bfc.js +59 -0
  406. package/dist/jsonUtils-913fa1bd.js +86 -0
  407. package/dist/jsonUtils-f6a5e63b.js +476 -0
  408. package/dist/kmlUtils-7c2744fe.js +112 -0
  409. package/dist/knowledgeGraphService-6a349e04.js +739 -0
  410. package/dist/knowledgegraph-c91b0bb2.js +149 -0
  411. package/dist/ko_KR-5c972fd8.js +14 -0
  412. package/dist/label2-1ab25f27.js +90 -0
  413. package/dist/labelUtils-a3634e8f.js +61 -0
  414. package/dist/labelingInfo-568c9210.js +46 -0
  415. package/dist/layerViewUtils-052e603c.js +10 -0
  416. package/dist/layersCreator-4a5366ea.js +151 -0
  417. package/dist/layersLoader-b87d4857.js +197 -0
  418. package/dist/lazyLayerLoader-8817000c.js +10 -0
  419. package/dist/lclayout-64c67b4e.js +773 -0
  420. package/dist/lengthUtils-695e744c.js +5 -0
  421. package/dist/lerc-wasm-13192bf3.js +325 -0
  422. package/dist/libtess-asm-4883179d.js +3673 -0
  423. package/dist/libtess-fc70d1ce.js +269 -0
  424. package/dist/lineSegment-3aa941f5.js +76 -0
  425. package/dist/loadGLTFMesh-db6645f5.js +181 -0
  426. package/dist/loadable-266f324b.js +24 -0
  427. package/dist/loader-d1ce1bc1.js +79 -0
  428. package/dist/lt_LT-26f13fd1.js +6 -0
  429. package/dist/lv_LV-4feafa92.js +18 -0
  430. package/dist/lyr3DWorker-dd48e619.js +2108 -0
  431. package/dist/mapViewDeps-226d9da3.js +3052 -0
  432. package/dist/mask-svg-30f64a7b.js +4 -0
  433. package/dist/mat3f64-03233387.js +19 -0
  434. package/dist/mat4f64-cce69db4.js +19 -0
  435. package/dist/mediaLayerUtils-ae485c27.js +35 -0
  436. package/dist/meshFeatureSet-8a2ad011.js +126 -0
  437. package/dist/meshVertexSpaceUtils-6efe3dcc.js +58 -0
  438. package/dist/multiOriginJSONSupportUtils-207ba4d4.js +6 -0
  439. package/dist/multidimensionalUtils-508a3f3f.js +290 -0
  440. package/dist/nb_NO-21543153.js +18 -0
  441. package/dist/nl_NL-7876d97f.js +7 -0
  442. package/dist/normalizeUtilsSync-1dae280b.js +181 -0
  443. package/dist/number-5aa3a81b.js +128 -0
  444. package/dist/objectIdUtils-93dae423.js +14 -0
  445. package/dist/objectResourceUtils-642ab03e.js +1455 -0
  446. package/dist/observers-f646a6a4.js +30 -0
  447. package/dist/ogcFeatureUtils-46ac1c44.js +206 -0
  448. package/dist/openCloseComponent-47eb52c6.js +37 -0
  449. package/dist/orientedBoundingBox-554ccdc6.js +447 -0
  450. package/dist/originUtils-87edf087.js +9 -0
  451. package/dist/overlay-svg-c3941b3b.js +4 -0
  452. package/dist/parser-0701286c.js +488 -0
  453. package/dist/pbf-5dd791f5.js +215 -0
  454. package/dist/pbfQueryUtils-a6ca7e23.js +422 -0
  455. package/dist/pe-wasm-6c16b121.js +887 -0
  456. package/dist/persistable-9eb0e8df.js +89 -0
  457. package/dist/perspectiveUtils-b194621d.js +42 -0
  458. package/dist/pieChart-b97433d0.js +555 -0
  459. package/dist/pl_PL-276c6dae.js +18 -0
  460. package/dist/plane-3398eec1.js +160 -0
  461. package/dist/popupUtils-c444b896.js +22 -0
  462. package/dist/popupUtils-d871563b.js +50 -0
  463. package/dist/portalItemUtils-4c4caad0.js +57 -0
  464. package/dist/portalLayers-cb07742f.js +312 -0
  465. package/dist/portalUtils-effd590f.js +7 -0
  466. package/dist/programUtils-65af7b7c.js +59 -0
  467. package/dist/project-ee9c2947.js +21 -0
  468. package/dist/projectPointToVector-7dc831a9.js +14 -0
  469. package/dist/projectVectorToVector-5163db7a.js +13 -0
  470. package/dist/pt_BR-4fae3055.js +6 -0
  471. package/dist/pt_PT-14d9efb1.js +6 -0
  472. package/dist/quantityUtils-5cd4cf90.js +33 -0
  473. package/dist/quantizationUtils-0a8f74c6.js +68 -0
  474. package/dist/quat-a508aed3.js +104 -0
  475. package/dist/quatf64-bec1af25.js +19 -0
  476. package/dist/query-b6e1fd14.js +89 -0
  477. package/dist/queryAttachments-7b39ebdc.js +39 -0
  478. package/dist/queryEngineUtils-cb8e309e.js +21 -0
  479. package/dist/queryTopFeatures-2e0e3941.js +50 -0
  480. package/dist/queryZScale-c5733d0a.js +12 -0
  481. package/dist/rasterProjectionHelper-213afa27.js +577 -0
  482. package/dist/rasterUtils-f2e44e8b.js +122 -0
  483. package/dist/rasterizingUtils-25cc0190.js +46 -0
  484. package/dist/request-e0c679b3.js +46 -0
  485. package/dist/requestImageUtils-37d79281.js +8 -0
  486. package/dist/resourceExtension-5f3f1c80.js +17 -0
  487. package/dist/resourceUtils-0d68cbc2.js +69 -0
  488. package/dist/resourceUtils-374db840.js +62 -0
  489. package/dist/resourceUtils-43ce192b.js +42 -0
  490. package/dist/ro_RO-8e733cf5.js +18 -0
  491. package/dist/ru_RU-f7bafc90.js +6 -0
  492. package/dist/saveAPIKeyUtils-1a3d4a8a.js +8 -0
  493. package/dist/saveUtils-43fdc547.js +24 -0
  494. package/dist/scaleUtils-bdf8b6cb.js +23 -0
  495. package/dist/scrim-44eb4dc0.js +114 -0
  496. package/dist/serviceCapabilitiesUtils-823612b8.js +64 -0
  497. package/dist/sizeVariableUtils-a1b694d8.js +27 -0
  498. package/dist/sk_SK-c279eea3.js +6 -0
  499. package/dist/sl_SL-e40950dd.js +6 -0
  500. package/dist/sourceUtils-01d115c6.js +71 -0
  501. package/dist/sphere-908cd9aa.js +199 -0
  502. package/dist/sr_RS-b1835dfa.js +18 -0
  503. package/dist/statsWorker-49f9befe.js +37 -0
  504. package/dist/streamLayerUtils-29324e05.js +31 -0
  505. package/dist/style.css +1 -1
  506. package/dist/styleUtils-82e8da52.js +75 -0
  507. package/dist/styleUtils-8541d60d.js +14 -0
  508. package/dist/sublayerUtils-eaac2486.js +37 -0
  509. package/dist/substitute-1f578d70.js +52 -0
  510. package/dist/sv_SE-15ca9e36.js +6 -0
  511. package/dist/symbolColorUtils-18fd6b3d.js +8 -0
  512. package/dist/symbolLayerUtils-4c58b291.js +31 -0
  513. package/dist/symbologySnappingCandidates-14d94b6b.js +221 -0
  514. package/dist/t9n-c1c2b6c8.js +349 -0
  515. package/dist/testSVGPremultipliedAlpha-159dac90.js +94 -0
  516. package/dist/th_TH-bf624a56.js +18 -0
  517. package/dist/tileUtils-3e0c8c1d.js +7 -0
  518. package/dist/timeSupport-3f529cdb.js +410 -0
  519. package/dist/tr_TR-ca5c315f.js +18 -0
  520. package/dist/triangle-8a3a2ba8.js +98 -0
  521. package/dist/types-adba9034.js +19 -0
  522. package/dist/uk_UA-4b3cb86d.js +6 -0
  523. package/dist/unitConversionUtils-f0ebaf75.js +17 -0
  524. package/dist/unitFormatUtils-555e2d94.js +40 -0
  525. package/dist/uploadAssetErrors-d1389781.js +70 -0
  526. package/dist/uploadAssets-5e85f09d.js +330 -0
  527. package/dist/utils-3a10b10c.js +34 -0
  528. package/dist/utils-505c54e9.js +91 -0
  529. package/dist/utils-5432e258.js +433 -0
  530. package/dist/utils-7a88ec6a.js +419 -0
  531. package/dist/utils-7fa9cdf9.js +2746 -0
  532. package/dist/utils-d252c575.js +73 -0
  533. package/dist/utils-f07e00b3.js +232 -0
  534. package/dist/utils-fda10b4b.js +79 -0
  535. package/dist/utils3-c34ab97c.js +75 -0
  536. package/dist/vec3-f79c600d.js +81 -0
  537. package/dist/vec3f32-304a6a9c.js +36 -0
  538. package/dist/vec42-36edeb73.js +125 -0
  539. package/dist/vec4f32-b2628ced.js +38 -0
  540. package/dist/vec4f64-043e974c.js +45 -0
  541. package/dist/versionUtils-6935648b.js +161 -0
  542. package/dist/vi_VN-ad09e708.js +18 -0
  543. package/dist/visualVariableUtils-c425461a.js +267 -0
  544. package/dist/webStyleSymbolUtils-4f42a29f.js +48 -0
  545. package/dist/webglDeps-5f18210d.js +23 -0
  546. package/dist/wfsUtils-6f7f1e3e.js +343 -0
  547. package/dist/workerHelper-9dc9a790.js +11 -0
  548. package/dist/xmlUtils-64cc47e1.js +24 -0
  549. package/dist/xyChart-e5648fee.js +3335 -0
  550. package/dist/zh_Hans-61faef57.js +14 -0
  551. package/dist/zh_Hant-87a9767b.js +14 -0
  552. package/dist/zipjs-wrapper-1bd67e07.js +6496 -0
  553. package/package.json +3 -2
@@ -0,0 +1,3633 @@
1
+ import { n as we, j7 as ht, dc as xe, cK as ke, bR as V, cw as Ht, cx as Jt, ia as Kt, eQ as ut, aO as y, fc as Fe, x as dt, bJ as Y, by as ct, ci as es, bw as ts, e as G, y as K, c as lt, S as _t, o as pe, W as D, ap as ss, s as rs, kG as is, gU as se, gW as ns, hN as pt, b as as, fm as gt, U as os, he as hs, dO as Te, cs as us, bh as ds, kH as cs, cZ as De, h as Le } from "./index-01c737ed.js";
2
+ import { a as x } from "./definitions-a00a3a6c.js";
3
+ import { m as ft, p as he, d as ze, s as Ue } from "./diffUtils-e71a6152.js";
4
+ import { n as Ge, i as A, r as ls, M as Ce, p as Me, d as yt, f as $e, g as _s, a as ps, b as gs, h as fs, j as ys } from "./AttributeStore-b90878e3.js";
5
+ import { o as ms } from "./tileUtils-3e0c8c1d.js";
6
+ import { S as bs, R as Is, A as vs } from "./geohashUtils-2bc76440.js";
7
+ import { g as Ss, e as ws, c as mt, N as xs, n as bt, p as ks, b as Fs, w as Ts, a as X, K as Cs, O as Ms, r as $s, f as It } from "./featureConversionUtils-650d7601.js";
8
+ import { s as H, t as B, e as T } from "./OptimizedGeometry-3b808152.js";
9
+ import { x as Os, j as We } from "./timeSupport-3f529cdb.js";
10
+ import { o as qs, $ as vt } from "./QueryEngine-10c97624.js";
11
+ import { Z as St } from "./FieldsIndex-75cca4d0.js";
12
+ import { d as As, c as Ne, S as Rs } from "./query-b6e1fd14.js";
13
+ import { m as wt } from "./quantizationUtils-0a8f74c6.js";
14
+ import { $ as Be } from "./ogcFeatureUtils-46ac1c44.js";
15
+ import { n as Es } from "./pbf-5dd791f5.js";
16
+ import { b as Ps, h as js } from "./pbfQueryUtils-a6ca7e23.js";
17
+ import { t as Ve } from "./CircularArray-b2bc1dfd.js";
18
+ import { createConnection as Ds } from "./createConnection-f974a00a.js";
19
+ import { d as Ls } from "./UpdateTracking2D-e9adad8f.js";
20
+ import "vue";
21
+ import "./LabelMetric-e2728bbf.js";
22
+ import "./enums-2c166c09.js";
23
+ import "./enums-fa8f05ab.js";
24
+ import "./Texture-22a8cca5.js";
25
+ import "./Program-ba2f18b2.js";
26
+ import "./BufferObject-cbd0168e.js";
27
+ import "./VertexElementDescriptor-d7c718c2.js";
28
+ import "./labelUtils-a3634e8f.js";
29
+ import "./TimeOnly-9ee66ca6.js";
30
+ import "./UnknownTimeZone-220952b5.js";
31
+ import "./highlightReasons-de432106.js";
32
+ import "./OptimizedFeatureSet-54e095c4.js";
33
+ import "./json-5febf88a.js";
34
+ import "./MemCache-a9232ec2.js";
35
+ import "./LRUCache-27e8c401.js";
36
+ import "./WhereClause-7a28b740.js";
37
+ import "./QueryEngineCapabilities-0d8477a2.js";
38
+ import "./utils-d252c575.js";
39
+ import "./heatmapUtils-56758920.js";
40
+ import "./vec42-36edeb73.js";
41
+ import "./vec4f64-043e974c.js";
42
+ import "./utils-3a10b10c.js";
43
+ import "./utils-5432e258.js";
44
+ import "./ClassBreaksDefinition-07ba0c64.js";
45
+ import "./Scheduler-eacc84bb.js";
46
+ import "./RenderState-b244097f.js";
47
+ import "./queryZScale-c5733d0a.js";
48
+ import "./geojson-603231df.js";
49
+ import "./date-1c28c6a5.js";
50
+ import "./clientSideDefaults-5c1f97c9.js";
51
+ import "./defaultsJSON-ba17aa15.js";
52
+ import "./sourceUtils-01d115c6.js";
53
+ import "./TurboLine-6ab04aef.js";
54
+ import "./earcut-6fa1a128.js";
55
+ import "./GeometryUtils-fa897cbd.js";
56
+ import "./utils-7a88ec6a.js";
57
+ import "./Rect-894f011c.js";
58
+ import "./defaults-2bfa4a36.js";
59
+ import "./BindType-5e76c8e1.js";
60
+ import "./Util-002f5109.js";
61
+ import "./constants-5bd557fe.js";
62
+ let zs = class {
63
+ constructor(e) {
64
+ this._client = e, this.layerView = this._client.createInvokeProxy("", { ignoreConnectionErrors: !0 }), this.container = this._client.createInvokeProxy("container", { ignoreConnectionErrors: !0 }), this.eventLog = this._client.createInvokeProxy("eventLog", { ignoreConnectionErrors: !0 });
65
+ }
66
+ };
67
+ const re = 1, Oe = 2, ie = 4, qe = 8, Ae = 16, ne = 32, Re = 64, ae = 128;
68
+ function ue(u) {
69
+ switch (u) {
70
+ case re:
71
+ case qe:
72
+ case ne:
73
+ return -1;
74
+ case Oe:
75
+ case Re:
76
+ return 0;
77
+ case ie:
78
+ case Ae:
79
+ case ae:
80
+ return 1;
81
+ }
82
+ }
83
+ function de(u) {
84
+ switch (u) {
85
+ case re:
86
+ case Oe:
87
+ case ie:
88
+ return -1;
89
+ case qe:
90
+ case Ae:
91
+ return 0;
92
+ case ne:
93
+ case Re:
94
+ case ae:
95
+ return 1;
96
+ }
97
+ }
98
+ const Ye = re | qe | ne, Xe = ie | Ae | ae, Qe = re | Oe | ie, Ze = ne | Re | ae;
99
+ let Us = class {
100
+ constructor(e, t, s, r = 0) {
101
+ this.tileKey = e, this._bufferingEnabled = t, this._sizeHint = r, this._meshes = { self: new Ge(this.id, this._sizeHint), neighbors: new Array() }, this._currentRecordOverlaps = 0, this._currentEntityOverlaps = 0, this._copyBufferedDataIntoSelf = s && this._bufferingEnabled && e.level === 0;
102
+ }
103
+ get id() {
104
+ return this.tileKey.id;
105
+ }
106
+ vertexCount() {
107
+ return this._meshes.self.vertexCount();
108
+ }
109
+ indexCount() {
110
+ return this._meshes.self.indexCount();
111
+ }
112
+ indexEnsureSize(e) {
113
+ this._meshes.self.indexEnsureSize(e);
114
+ }
115
+ entityStart(e, t = e) {
116
+ this._currentEntityOverlaps = 0, this._meshes.self.entityStart(e, t);
117
+ }
118
+ entityRecordCount() {
119
+ return this._meshes.self.entityRecordCount();
120
+ }
121
+ entityEnd() {
122
+ if (this._meshes.self.entityEnd(), this._bufferingEnabled) {
123
+ if (this._copyBufferedDataIntoSelf)
124
+ return;
125
+ for (let e = 0; e < 8; e++) {
126
+ const t = 1 << e;
127
+ this._currentEntityOverlaps & t && this._meshes.neighbors[e].entityEnd();
128
+ }
129
+ }
130
+ }
131
+ recordStart(e, t, s) {
132
+ this._currentRecordOverlaps = 0, this._meshes.self.recordStart(e, t, s);
133
+ }
134
+ recordEnd(e = 0) {
135
+ const t = this._meshes.self.recordEnd(this._currentRecordOverlaps);
136
+ return t && this._currentRecordOverlaps !== 0 ? (this._copyIntoNeighbors(), this._currentEntityOverlaps |= this._currentRecordOverlaps, !0) : t;
137
+ }
138
+ recordBounds(e, t, s, r) {
139
+ this._bufferingEnabled && this._addOverlap(e, t, s, r);
140
+ }
141
+ recordCount() {
142
+ return this._meshes.self.recordCount();
143
+ }
144
+ metricStart(e) {
145
+ this._meshes.self.metricStart(e);
146
+ }
147
+ metricBoxWrite(e) {
148
+ this._meshes.self.metricBoxWrite(e);
149
+ }
150
+ metricEnd() {
151
+ this._meshes.self.metricEnd();
152
+ }
153
+ vertexWrite(e) {
154
+ this._meshes.self.vertexWrite(e);
155
+ }
156
+ vertexWriteF32(e) {
157
+ this._meshes.self.vertexWriteF32(e);
158
+ }
159
+ vertexWriteRegion(e) {
160
+ this._meshes.self.vertexWriteRegion(e);
161
+ }
162
+ indexWrite(e) {
163
+ this._meshes.self.indexWrite(e);
164
+ }
165
+ serialize(e) {
166
+ const t = { message: [], transferList: [] }, s = this._meshes.self.serialize();
167
+ return t.message.push({ tileId: this.tileKey.id, ...s.message }), t.transferList.push(...s.transferList), this._meshes.neighbors.forEach((r, i) => {
168
+ const n = r.serialize(), a = 1 << i, o = ue(a), h = de(a), c = ms(new we(this.tileKey), o, h, e);
169
+ t.message.push({ tileId: c.id, ...n.message }), t.transferList.push(...n.transferList);
170
+ }), t;
171
+ }
172
+ _addOverlap(e, t, s, r) {
173
+ const i = Math.min(x / 2, s), n = Math.min(x / 2, r), a = 255 ^ ((e < 0 + i ? Xe : e >= x - i ? Ye : Xe | Ye) | (t < 0 + n ? Ze : t >= x - n ? Qe : Ze | Qe));
174
+ this._currentRecordOverlaps |= a;
175
+ }
176
+ _copyIntoNeighbors() {
177
+ for (let e = 0; e < 8; e++) {
178
+ const t = 1 << e;
179
+ if (this._currentRecordOverlaps & t) {
180
+ if (this._copyBufferedDataIntoSelf) {
181
+ const n = -ue(t) * x, a = -de(t) * x;
182
+ this._meshes.self.copyLast(n, a);
183
+ continue;
184
+ }
185
+ if (!this._meshes.neighbors[e]) {
186
+ const n = Math.floor(this._sizeHint / 16);
187
+ this._meshes.neighbors[e] = new Ge(t, n);
188
+ }
189
+ const s = this._meshes.neighbors[e], r = -ue(t) * x, i = -de(t) * x;
190
+ s.copyLastFrom(this._meshes.self, r, i);
191
+ }
192
+ }
193
+ }
194
+ }, Gs = class {
195
+ }, L = class xt {
196
+ constructor() {
197
+ this._defaultResult = null, this._backgroundFillResult = null;
198
+ }
199
+ static async from(e, t, s, r) {
200
+ const i = new xt();
201
+ return i.setDefault(await A(e, t, s.meshes, r)), i;
202
+ }
203
+ size() {
204
+ return 1;
205
+ }
206
+ getDefault() {
207
+ return this._defaultResult;
208
+ }
209
+ setDefault(e) {
210
+ this._defaultResult = e;
211
+ }
212
+ getBackgroundFill() {
213
+ return this._backgroundFillResult;
214
+ }
215
+ setBackgroundFill(e) {
216
+ this._backgroundFillResult = e;
217
+ }
218
+ match(e, t) {
219
+ const s = this.doMatch(e, t) || this.getDefault();
220
+ if (s && s.length > 0) {
221
+ const r = this.getBackgroundFill();
222
+ if (r)
223
+ return [...r, ...s];
224
+ }
225
+ return s;
226
+ }
227
+ getSortKey(e, t) {
228
+ return 0;
229
+ }
230
+ doMatch(e, t) {
231
+ return null;
232
+ }
233
+ async fetchResources(e, t) {
234
+ }
235
+ }, Ws = class kt extends L {
236
+ static async fromDictionaryRenderer(e, t, s) {
237
+ return new kt(e, t, s);
238
+ }
239
+ constructor(e, t, s) {
240
+ super(), this._storage = e, this._schema = t, this._viewParams = s, this._hashToGroup = /* @__PURE__ */ new Map();
241
+ }
242
+ get fieldMap() {
243
+ return this._schema.fieldMap;
244
+ }
245
+ async fetchResources(e, t) {
246
+ const s = t.getCursor(), r = [];
247
+ for (; s.next(); )
248
+ r.push(this._updateMeshWriterGroup(e, s));
249
+ await Promise.all(r);
250
+ }
251
+ match(e, t) {
252
+ const s = e.getAttributeHash();
253
+ return this._hashToGroup.get(s);
254
+ }
255
+ async _updateMeshWriterGroup(e, t) {
256
+ const s = t.readLegacyFeatureForDisplay(), r = t.getAttributeHash();
257
+ if (this._hashToGroup.has(r))
258
+ return;
259
+ this._hashToGroup.set(r, null);
260
+ const i = await e.fetchDictionaryResourceImmediate({ type: "dictionary-request", feature: s });
261
+ if (!i)
262
+ return;
263
+ const n = await A(this._storage, e, i.meshes, this._viewParams);
264
+ this._hashToGroup.set(r, n);
265
+ }
266
+ }, Ns = class Ft extends L {
267
+ constructor(e, t) {
268
+ super(), this._intervals = [], this._isMaxInclusive = t, this._field = e;
269
+ }
270
+ static async fromIntervalSchema(e, t, s, r) {
271
+ const i = await e.createComputedField(s), n = new Ft(i, s.isMaxInclusive);
272
+ await Promise.all(s.intervals.map(async (h) => {
273
+ const c = await A(e, t, h.meshes, r);
274
+ n.add(h, c);
275
+ }));
276
+ const a = await A(e, t, s.defaultSymbol, r);
277
+ n.setDefault(a);
278
+ const o = await A(e, t, s.backgroundFill, r);
279
+ return n.setBackgroundFill(o), n;
280
+ }
281
+ add(e, t) {
282
+ this._intervals.push({ interval: e, result: t }), this._intervals.sort((s, r) => s.interval.min - r.interval.min);
283
+ }
284
+ size() {
285
+ return super.size() + this._intervals.length;
286
+ }
287
+ doMatch(e, t) {
288
+ var r;
289
+ const s = (r = this._field) == null ? void 0 : r.read(e, t);
290
+ if (s == null || isNaN(s) || s === 1 / 0 || s === -1 / 0)
291
+ return null;
292
+ for (let i = 0; i < this._intervals.length; i++) {
293
+ const { interval: n, result: a } = this._intervals[i], o = s >= n.min, h = this._isMaxInclusive ? s <= n.max : s < n.max;
294
+ if (o && h)
295
+ return a;
296
+ }
297
+ return null;
298
+ }
299
+ }, Bs = class Tt extends L {
300
+ static async fromLabelSchema(e, t, s, r) {
301
+ const i = s.classes.map(async (a) => {
302
+ const o = await A(e, t, a.meshes, r);
303
+ return { minScale: a.minScale, maxScale: a.maxScale, meshes: o, expression: null, where: await e.createWhereClause(a.where) };
304
+ }), n = await Promise.all(i);
305
+ return new Tt(n);
306
+ }
307
+ constructor(e) {
308
+ super(), this._labels = e;
309
+ }
310
+ match(e, t) {
311
+ if (!this._labels.length)
312
+ return null;
313
+ const s = this._getLabels(t.$view.scale), r = [];
314
+ for (const i of s)
315
+ i.where && !i.where(e) || r.push(...i.meshes);
316
+ return r;
317
+ }
318
+ _getLabels(e) {
319
+ return this._labels.filter((t) => this._validForTileScale(t, e));
320
+ }
321
+ _validForTileScale(e, t) {
322
+ const s = t - t / 4, r = t + t / 2;
323
+ return (!e.minScale || e.minScale >= s) && (!e.maxScale || e.maxScale <= r);
324
+ }
325
+ }, Vs = class Ct extends L {
326
+ constructor(e, t) {
327
+ super(), this._defaultSymbolSortKey = 0, this._nullResult = null, this._resultsMap = /* @__PURE__ */ new Map(), this._fields = [], this._fields = e, this._separator = t || "";
328
+ }
329
+ static async fromMatcherSchema(e, t, s, r) {
330
+ const i = s.expression ? [e.createComputedField({ expression: s.expression })] : [s.field ? e.createComputedField({ field: s.field }) : null, s.field2 ? e.createComputedField({ field: s.field2 }) : null, s.field3 ? e.createComputedField({ field: s.field3 }) : null], n = (await Promise.all(i)).filter((c) => !!c), a = new Ct(n, s.fieldDelimiter), o = await A(e, t, s.defaultSymbol, r);
331
+ a.setDefault(o);
332
+ const h = await A(e, t, s.backgroundFill, r);
333
+ return a.setBackgroundFill(h), await Promise.all(s.map.map(async (c, d) => {
334
+ const l = await A(e, t, c.symbol, r);
335
+ c.value === "<Null>" ? a.setNullResult(l) : a.add(c.value, l, d + 1);
336
+ })), a;
337
+ }
338
+ setNullResult(e) {
339
+ this._nullResult = e;
340
+ }
341
+ getSortKey(e, t) {
342
+ const s = this._getValueFromFields(e, t);
343
+ if (s == null || s === "" || s === "<Null>")
344
+ return 0;
345
+ const r = this._resultsMap.get(s.toString());
346
+ return r ? r.sortKey : this._defaultSymbolSortKey;
347
+ }
348
+ add(e, t, s) {
349
+ this._resultsMap.set(e.toString(), { meshWriters: t, sortKey: s }), this._defaultSymbolSortKey = Math.max(this._defaultSymbolSortKey, s + 1);
350
+ }
351
+ size() {
352
+ return super.size() + this._resultsMap.size;
353
+ }
354
+ doMatch(e, t) {
355
+ var i;
356
+ const s = this._getValueFromFields(e, t);
357
+ if (this._nullResult !== null && (s == null || s === "" || s === "<Null>"))
358
+ return this._nullResult;
359
+ if (s == null)
360
+ return null;
361
+ const r = s.toString();
362
+ return (i = this._resultsMap.get(r)) == null ? void 0 : i.meshWriters;
363
+ }
364
+ _getValueFromFields(e, t) {
365
+ const s = [];
366
+ for (const r of this._fields) {
367
+ const i = r.read(e, t);
368
+ i == null || i === "" ? s.push("<Null>") : s.push(i);
369
+ }
370
+ return s.join(this._separator);
371
+ }
372
+ };
373
+ async function Q(u, e, t, s) {
374
+ switch (t.type) {
375
+ case "simple":
376
+ case "heatmap":
377
+ case "dot-density":
378
+ case "pie-chart":
379
+ return L.from(u, e, t, s);
380
+ case "interval":
381
+ return Ns.fromIntervalSchema(u, e, t, s);
382
+ case "dictionary":
383
+ return Ws.fromDictionaryRenderer(u, t, s);
384
+ case "label":
385
+ return Bs.fromLabelSchema(u, e, t, s);
386
+ case "map":
387
+ return Vs.fromMatcherSchema(u, e, t, s);
388
+ case "subtype":
389
+ return Ys.fromSubtypes(u, e, t, s);
390
+ case "cluster":
391
+ return Xs.fromClusterSchema(u, e, t, s);
392
+ default:
393
+ throw new Error("Impl");
394
+ }
395
+ }
396
+ let Ys = class Mt extends L {
397
+ constructor(e, t) {
398
+ super(), this._subMatchers = e, this._subtypeField = t;
399
+ }
400
+ static async fromSubtypes(e, t, s, r) {
401
+ const i = /* @__PURE__ */ new Map(), n = [];
402
+ for (const a in s.renderers) {
403
+ const o = parseInt(a, 10), h = Q(e, t, s.renderers[a], r).then((c) => i.set(o, c));
404
+ n.push(h);
405
+ }
406
+ return await Promise.all(n), new Mt(i, s.subtypeField);
407
+ }
408
+ match(e, t) {
409
+ const s = e.readAttribute(this._subtypeField), r = this._subMatchers.get(s);
410
+ return r ? r.match(e, t) : null;
411
+ }
412
+ }, Xs = class $t extends L {
413
+ static async fromClusterSchema(e, t, s, r) {
414
+ const [i, n] = await Promise.all([Q(e, t, s.feature, r), Q(e, t, s.cluster, r)]);
415
+ return new $t(i, n);
416
+ }
417
+ constructor(e, t) {
418
+ super(), this._featureMatcher = e, this._clusterMatcher = t;
419
+ }
420
+ match(e, t) {
421
+ return e.readAttribute("cluster_count") === 1 ? this._featureMatcher.match(e, t) : this._clusterMatcher.match(e, t);
422
+ }
423
+ }, Qs = class Ot extends Gs {
424
+ static async create(e, t, s, r) {
425
+ const i = await Q(e, t, s.symbology, r), n = s.labels ? await Q(e, t, s.labels, r) : null;
426
+ return new Ot(i, n);
427
+ }
428
+ constructor(e, t) {
429
+ super(), this._symbology = e, this._labels = t;
430
+ }
431
+ destroy() {
432
+ }
433
+ async enqueueMatcherRequests(e, t) {
434
+ var s;
435
+ await Promise.all([this._symbology.fetchResources(e, t), (s = this._labels) == null ? void 0 : s.fetchResources(e, t)]);
436
+ }
437
+ enqueueWriterRequests(e, t, s) {
438
+ const r = this._symbology.match(t, s);
439
+ if (r) {
440
+ for (const i of r)
441
+ i.enqueueRequest(e, t, s);
442
+ if (this._labels) {
443
+ const i = this._labels.match(t, s);
444
+ if (!i)
445
+ return;
446
+ for (const n of i)
447
+ n.enqueueRequest(e, t, s);
448
+ }
449
+ }
450
+ }
451
+ write(e, t, s, r, i) {
452
+ const n = this._symbology.match(s, r);
453
+ if (n) {
454
+ for (const a of n)
455
+ a.write(e, t, s, r, i);
456
+ if (e.entityRecordCount() >= 1 && this._labels) {
457
+ const a = this._labels.match(s, r);
458
+ if (!a)
459
+ return;
460
+ for (const o of a)
461
+ o.setReferences(n), o.write(e, t, s, r, i);
462
+ }
463
+ }
464
+ }
465
+ getSortKey(e, t) {
466
+ return this._symbology.getSortKey(e, t);
467
+ }
468
+ }, Zs = class {
469
+ constructor(e) {
470
+ this._outstandingMessages = [], this._queue = new ht({ concurrency: e.concurrency, process: (t) => e.process(t) });
471
+ }
472
+ async push(e) {
473
+ if (e.end)
474
+ return await Promise.all(this._outstandingMessages), await this._queue.push(e), void (this._outstandingMessages = []);
475
+ const t = this._queue.push(e);
476
+ return this._outstandingMessages.push(t), t;
477
+ }
478
+ }, qt = class ge {
479
+ static async create(e, t) {
480
+ var r;
481
+ if (t.statisticType === "count") {
482
+ const i = new ls(1);
483
+ return new ge(t.name, t.alias, t.type, t.statisticType, i);
484
+ }
485
+ const s = await e.createComputedField({ expression: (r = t.onStatisticExpression) == null ? void 0 : r.expression, field: t.onStatisticField });
486
+ return new ge(t.name, t.alias, t.type, t.statisticType, s);
487
+ }
488
+ constructor(e, t, s, r, i) {
489
+ this.name = e, this.alias = t, this.type = s, this.statisticType = r, this.computed = i;
490
+ }
491
+ }, Ee = class {
492
+ constructor(e) {
493
+ this.subscription = e, this.handledChunks = /* @__PURE__ */ new Set();
494
+ }
495
+ destroy() {
496
+ }
497
+ }, At = class {
498
+ constructor(e, t) {
499
+ this._source = e, this._attributeStore = t, this._sendStates = /* @__PURE__ */ new Map();
500
+ }
501
+ destroy() {
502
+ }
503
+ get enablePixelBuffering() {
504
+ return !0;
505
+ }
506
+ onSubscribe(e) {
507
+ const t = this.createState(e);
508
+ this._sendStates.set(e.key.id, t), this.updateChunks();
509
+ }
510
+ onUnsubscribe(e) {
511
+ var t;
512
+ (t = this._sendStates.get(e.key.id)) == null || t.destroy(), this._sendStates.delete(e.key.id);
513
+ }
514
+ invalidate() {
515
+ const e = Array.from(this._sendStates.values());
516
+ this._sendStates.clear();
517
+ for (const t of e)
518
+ t.destroy(), this.onSubscribe(t.subscription);
519
+ }
520
+ invalidateAttributeData() {
521
+ }
522
+ getFeatureObjectIdsForAggregate(e) {
523
+ throw new Error("InternalError: AggregateId lookup not supported");
524
+ }
525
+ getDisplayIds(e) {
526
+ return this.displayMap(e, (t) => t, (t) => t);
527
+ }
528
+ getDisplayAndObjectIds(e) {
529
+ return this.displayMap(e, (t) => t, (t, s, r) => [t, r]);
530
+ }
531
+ afterUpdateChunks() {
532
+ }
533
+ }, Rt = class extends At {
534
+ constructor(e, t, s, r) {
535
+ super(e, t), this.spatialReference = s, this.aggregateFields = r, this.events = new xe(), this.featureAdapter = qs;
536
+ }
537
+ get aggregateQueryEngine() {
538
+ return this._aggregateQueryEngine || (this._aggregateQueryEngine = new vt({ featureStore: this, fieldsIndex: this._metadata.fieldsIndex, geometryType: this._metadata.geometryType, objectIdField: this._metadata.objectIdField, spatialReference: this.spatialReference })), this._aggregateQueryEngine;
539
+ }
540
+ removeChunks(e) {
541
+ }
542
+ forEach(e) {
543
+ return this.forEachAggregateWorldSpace(e);
544
+ }
545
+ forEachInBounds(e, t) {
546
+ }
547
+ forEachBounds(e, t) {
548
+ const s = ke();
549
+ for (const r of e) {
550
+ const i = Ss(s, r.geometry, !1, !1);
551
+ i && t(i);
552
+ }
553
+ }
554
+ }, Pe = class {
555
+ constructor(e, t, s, r, i) {
556
+ this.subscription = e, this.reader = t, this.clear = s, this.end = r, this.debugInfo = i, this.type = "append";
557
+ }
558
+ get id() {
559
+ return this.subscription.tile.id;
560
+ }
561
+ createMessage(e, t, s) {
562
+ return { type: "append", clear: this.clear, id: this.id, append: e, end: this.end, debugInfo: this.debugInfo, subscriptionVesrion: this.subscription.version, version: t, attributeEpoch: s };
563
+ }
564
+ }, fe = class {
565
+ constructor(e, t, s, r, i) {
566
+ this.subscription = e, this.reader = t, this.remove = s, this.end = r, this.debugInfo = i, this.type = "update";
567
+ }
568
+ get id() {
569
+ return this.subscription.tile.id;
570
+ }
571
+ createMessage(e, t, s) {
572
+ return { type: "update", id: this.id, modify: e, debugInfo: this.debugInfo, remove: this.remove, version: t, subscriptionVesrion: this.subscription.version, end: this.end, attributeEpoch: s };
573
+ }
574
+ }, M = class j extends Ce {
575
+ static fromFeatures(e, t) {
576
+ const { objectIdField: s, geometryType: r } = t, i = ws([], e, r, !1, !1, s);
577
+ for (let n = 0; n < i.length; n++)
578
+ i[n].displayId = e[n].displayId;
579
+ return j.fromOptimizedFeatures(i, t);
580
+ }
581
+ static fromFeatureSet(e, t) {
582
+ const s = mt(e, t.objectIdField);
583
+ return j.fromOptimizedFeatureSet(s, t);
584
+ }
585
+ static fromOptimizedFeatureSet(e, t) {
586
+ const s = j.fromOptimizedFeatures(e.features, t);
587
+ return s._exceededTransferLimit = e.exceededTransferLimit, s._transform = e.transform, s._fieldsIndex = new St(e.fields), s;
588
+ }
589
+ static fromOptimizedFeatures(e, t, s) {
590
+ const r = new j(e, t);
591
+ return r._fieldsIndex = t.fieldsIndex, r._transform = s, r;
592
+ }
593
+ static empty(e) {
594
+ return new j([], e);
595
+ }
596
+ constructor(e, t) {
597
+ super(t), this._exceededTransferLimit = !1, this._featureIndex = -1, this._fieldsIndex = null, this._geometryType = t.geometryType, this._features = e;
598
+ }
599
+ get fields() {
600
+ return this._fieldsIndex;
601
+ }
602
+ get geometryType() {
603
+ return this._geometryType;
604
+ }
605
+ get hasFeatures() {
606
+ return !!this._features.length;
607
+ }
608
+ get hasNext() {
609
+ return this._featureIndex + 1 < this._features.length;
610
+ }
611
+ get exceededTransferLimit() {
612
+ return this._exceededTransferLimit;
613
+ }
614
+ get hasZ() {
615
+ return !1;
616
+ }
617
+ get hasM() {
618
+ return !1;
619
+ }
620
+ get _current() {
621
+ return this._features[this._featureIndex];
622
+ }
623
+ removeIds(e) {
624
+ const t = new Set(e);
625
+ this._features = this._features.filter((s) => !(s.objectId != null && t.has(s.objectId)));
626
+ }
627
+ getSize() {
628
+ return this._features.length;
629
+ }
630
+ getCursor() {
631
+ return this.copy();
632
+ }
633
+ getInTransform() {
634
+ return this._transform;
635
+ }
636
+ getAttributeHash() {
637
+ let e = "";
638
+ for (const t in this._current.attributes)
639
+ e += this._current.attributes[t];
640
+ return e;
641
+ }
642
+ getIndex() {
643
+ return this._featureIndex;
644
+ }
645
+ setIndex(e) {
646
+ this._featureIndex = e;
647
+ }
648
+ getObjectId() {
649
+ var e;
650
+ return (e = this._current) == null ? void 0 : e.objectId;
651
+ }
652
+ getDisplayId() {
653
+ return this._current.displayId;
654
+ }
655
+ setDisplayId(e) {
656
+ this._current.displayId = e;
657
+ }
658
+ copy() {
659
+ const e = new j(this._features, this.metadata);
660
+ return this.copyInto(e), e;
661
+ }
662
+ next() {
663
+ for (; ++this._featureIndex < this._features.length && !this._getExists(); )
664
+ ;
665
+ return this._featureIndex < this._features.length;
666
+ }
667
+ readGeometryArea() {
668
+ return H(this._current) ? xs(this._current.geometry, 2) : 0;
669
+ }
670
+ _readX() {
671
+ return H(this._current) ? this._current.geometry.coords[0] : 0;
672
+ }
673
+ _readY() {
674
+ return H(this._current) ? this._current.geometry.coords[1] : 0;
675
+ }
676
+ _readGeometry() {
677
+ return H(this._current) ? this._current.geometry ?? null : null;
678
+ }
679
+ _readServerCentroid() {
680
+ return this._current.centroid;
681
+ }
682
+ _readAttribute(e, t) {
683
+ var i;
684
+ if (!this._fieldsIndex) {
685
+ const n = this._current.attributes[e];
686
+ if (n !== void 0)
687
+ return n;
688
+ const a = e.toLowerCase();
689
+ for (const o in this._current.attributes)
690
+ if (o.toLowerCase() === a)
691
+ return this._current.attributes[o];
692
+ return;
693
+ }
694
+ const s = this._fieldsIndex.get(e);
695
+ if (!s)
696
+ return;
697
+ let r = this._current.attributes[s.name];
698
+ return r == null ? r : (((i = this.fields.get(e)) == null ? void 0 : i.type) === "esriFieldTypeTimestampOffset" && (r = this.parseTimestampOffset(r)), t && this.fields.isDateField(e) ? new Date(r) : r);
699
+ }
700
+ _readAttributes() {
701
+ return this._current.attributes;
702
+ }
703
+ copyInto(e) {
704
+ super.copyInto(e), e._featureIndex = this._featureIndex, e._transform = this._transform, e._fieldsIndex = this._fieldsIndex;
705
+ }
706
+ }, Hs = class extends Ee {
707
+ constructor(e, t) {
708
+ super(e), this.bins = /* @__PURE__ */ new Map(), this.done = !1, this._store = t;
709
+ }
710
+ reset() {
711
+ this.destroy(), this.bins.clear(), this.done = !1, this.handledChunks.clear();
712
+ }
713
+ destroy() {
714
+ var t;
715
+ const e = this.subscription.tile.key.level;
716
+ for (const s of this.bins.values()) {
717
+ const r = (t = s.cachedFeature) == null ? void 0 : t.objectId;
718
+ r != null && this._store.releaseDisplayIdForObjectId(`${r}.${e}`);
719
+ }
720
+ }
721
+ *featuresWorldSpace() {
722
+ for (const e of this.bins.values()) {
723
+ const t = e.cachedFeature;
724
+ if (t) {
725
+ const s = t.clone();
726
+ s.geometry && ks(s.geometry, s.geometry, !1, !1, this.subscription.tile.transform), yield s;
727
+ }
728
+ }
729
+ }
730
+ getGeohashBounds(e, t) {
731
+ const s = this.subscription.tile;
732
+ return bs(s.extent, s.resolution, t, e);
733
+ }
734
+ }, Js = class Et extends Rt {
735
+ static async create(e, t, s, r, i) {
736
+ const n = new Me({ spatialReference: t }), a = e.fixedBinLevel, o = await Promise.all(e.fields.map(async (c) => qt.create(n, c))), h = e.featureFilter ? await yt.create({ geometryType: s.metadata.geometryType, hasM: !1, hasZ: !1, timeInfo: s.metadata.timeInfo, fieldsIndex: s.metadata.fieldsIndex, spatialReference: t, filterJSON: e.featureFilter }) : null;
737
+ return await Os(t, V.WGS84), new Et({ fields: o, geohashLevel: a, spatialReference: t, featureFilter: h, timeZone: i }, e.fields, s, r);
738
+ }
739
+ constructor(e, t, s, r) {
740
+ super(s, r, e.spatialReference, e.fields), this._indexOptions = e, this._metadata = new $e({ geometryType: "esriGeometryPolygon", objectIdField: "aggregateId", fields: t, globalIdField: null, spatialReference: s.metadata.spatialReference, subtypeField: null, subtypes: null, timeInfo: null, timeReferenceUnknownClient: null, typeIdField: null, types: null });
741
+ }
742
+ createState(e) {
743
+ return new Hs(e, this._attributeStore);
744
+ }
745
+ async *applyOverride(e) {
746
+ for (const t of this._sendStates.values())
747
+ t.reset(), yield new Pe(t.subscription, M.empty(this._source.metadata), !0, !1, {});
748
+ }
749
+ displayMap(e, t, s) {
750
+ const r = new Map(e.map((n) => [t(n), n])), i = [];
751
+ for (const n of this._sendStates.values())
752
+ for (const a of n.featuresWorldSpace()) {
753
+ const { objectId: o, displayId: h } = a, c = r.get(o);
754
+ if (c != null) {
755
+ const d = s(h, c, o);
756
+ i.push(d), r.delete(o);
757
+ }
758
+ }
759
+ return i;
760
+ }
761
+ getDisplayFeatures(e) {
762
+ const t = new Set(e), s = /* @__PURE__ */ new Set(), r = [];
763
+ for (const i of this._sendStates.values())
764
+ for (const n of i.featuresWorldSpace())
765
+ t.has(n.displayId) && !s.has(n.objectId) && (n.geometry && r.push({ ...bt(n, this._metadata.geometryType, !1, !1), displayId: n.displayId }), s.add(n.objectId));
766
+ return { features: [], aggregates: r };
767
+ }
768
+ getFeatureObjectIdsForAggregate(e) {
769
+ for (const t of this._sendStates.values())
770
+ for (const s of t.bins.values())
771
+ if (s.id === e)
772
+ return Array.from(s.objectIds);
773
+ return [];
774
+ }
775
+ async *updateChunks() {
776
+ if (this._source.chunks().length)
777
+ for (const e of this._sendStates.values())
778
+ yield* this._update(e, this._source);
779
+ }
780
+ forEachAggregateWorldSpace(e) {
781
+ for (const t of this._sendStates.values())
782
+ for (const s of t.featuresWorldSpace())
783
+ e(s);
784
+ }
785
+ async *_update(e, t) {
786
+ const { handledChunks: s, subscription: r, bins: i } = e, { spatialReference: n, geohashLevel: a } = this._indexOptions, o = r.tile;
787
+ if (e.done)
788
+ return;
789
+ for (const p of t.chunks()) {
790
+ if (s.has(p.chunkId))
791
+ continue;
792
+ s.add(p.chunkId);
793
+ const I = p.queryInfo;
794
+ if ("tileId" in I) {
795
+ const b = new we(I.tileId);
796
+ if (b.level !== o.level || b.world !== o.key.world)
797
+ continue;
798
+ }
799
+ const f = p.getGeohashIndex(this._indexOptions), k = e.getGeohashBounds(n, a);
800
+ k != null && f.putBins(i, k);
801
+ }
802
+ const h = [], c = r.tile.transform, d = r.tile.key.level;
803
+ for (const p of i.values()) {
804
+ if (p.cachedFeature)
805
+ p.cachedFeature.attributes = p.getAttributes();
806
+ else {
807
+ const I = p.getGeometry(this.spatialReference, c), f = new B(I, p.getAttributes(), null);
808
+ I || (f.centroid = p.getGeometryCentroid(this.spatialReference, c)), f.objectId = p.id, f.displayId = this._attributeStore.createDisplayIdForObjectId(`${f.objectId}.${d}`), p.cachedFeature = f;
809
+ }
810
+ h.push(p.cachedFeature);
811
+ }
812
+ this.events.emit("changed"), e.done = !t.updateTracking.updating;
813
+ const l = M.fromOptimizedFeatures(h, this._metadata, c), g = l.getCursor(), _ = e.subscription.tile.createArcadeEvaluationOptions(this._indexOptions.timeZone);
814
+ for (; g.next(); )
815
+ this._attributeStore.setAttributeData(g.getDisplayId(), g, _);
816
+ yield new fe(e.subscription, l, [], e.done, {});
817
+ }
818
+ };
819
+ const He = Math.PI / 180;
820
+ let Pt = class ye {
821
+ static create(e) {
822
+ return new ye(e.map((t) => Ks(t)));
823
+ }
824
+ constructor(e) {
825
+ this._statistics = e;
826
+ }
827
+ values() {
828
+ return this._statistics.values();
829
+ }
830
+ insert(e, t) {
831
+ for (const s of this._statistics)
832
+ s.insert(e, t);
833
+ }
834
+ merge(e) {
835
+ for (let t = 0; t < this._statistics.length; t++) {
836
+ const s = this._statistics[t], r = e._statistics[t];
837
+ if (s.field.name !== r.field.name)
838
+ throw new Error("InternalError: Tried to merge incompatible statistics");
839
+ s.merge(r);
840
+ }
841
+ }
842
+ clone() {
843
+ return new ye(this._statistics.map((e) => e.clone()));
844
+ }
845
+ };
846
+ function Ks(u) {
847
+ switch (u.statisticType) {
848
+ case "min":
849
+ return new er(u);
850
+ case "max":
851
+ return new tr(u);
852
+ case "avg":
853
+ return new rr(u);
854
+ case "avg_angle":
855
+ return new ir(u);
856
+ case "sum":
857
+ case "count":
858
+ return new sr(u);
859
+ case "mode":
860
+ return new nr(u);
861
+ }
862
+ }
863
+ let W = class {
864
+ constructor(e) {
865
+ this.field = e;
866
+ }
867
+ insert(e, t) {
868
+ if (!this.field.computed)
869
+ return;
870
+ const s = this.field.computed.read(e, t);
871
+ _s(s) || this._insertValue(s);
872
+ }
873
+ }, er = class jt extends W {
874
+ constructor() {
875
+ super(...arguments), this.type = "min", this.value = Number.MAX_VALUE;
876
+ }
877
+ _insertValue(e) {
878
+ this.value = Math.min(this.value, e);
879
+ }
880
+ merge(e) {
881
+ this.value = Math.min(this.value, e.value);
882
+ }
883
+ clone() {
884
+ const e = new jt(this.field);
885
+ return e.value = this.value, e;
886
+ }
887
+ }, tr = class Dt extends W {
888
+ constructor() {
889
+ super(...arguments), this.type = "max", this.value = Number.MIN_VALUE;
890
+ }
891
+ _insertValue(e) {
892
+ this.value = Math.max(this.value, e);
893
+ }
894
+ merge(e) {
895
+ this.value = Math.max(this.value, e.value);
896
+ }
897
+ clone() {
898
+ const e = new Dt(this.field);
899
+ return e.value = this.value, e;
900
+ }
901
+ }, sr = class Lt extends W {
902
+ constructor() {
903
+ super(...arguments), this.type = "sum", this.value = 0;
904
+ }
905
+ _insertValue(e) {
906
+ this.value += e;
907
+ }
908
+ merge(e) {
909
+ this.value += e.value;
910
+ }
911
+ clone() {
912
+ const e = new Lt(this.field);
913
+ return e.value = this.value, e;
914
+ }
915
+ }, rr = class zt extends W {
916
+ constructor() {
917
+ super(...arguments), this.type = "avg", this._total = 0, this._count = 0;
918
+ }
919
+ get value() {
920
+ return this._total / this._count;
921
+ }
922
+ _insertValue(e) {
923
+ this._total += e, this._count += 1;
924
+ }
925
+ merge(e) {
926
+ this._total += e._total, this._count += e._count;
927
+ }
928
+ clone() {
929
+ const e = new zt(this.field);
930
+ return e._total = this._total, e._count = this._count, e;
931
+ }
932
+ }, ir = class Ut extends W {
933
+ constructor() {
934
+ super(...arguments), this.type = "avg_angle", this._x = 0, this._y = 0, this._count = 0;
935
+ }
936
+ get value() {
937
+ const e = this._x / this._count, t = this._y / this._count, s = 180 / Math.PI;
938
+ return Math.atan2(t, e) * s;
939
+ }
940
+ _insertValue(e) {
941
+ this._x = this._x + Math.cos(e * He), this._y = this._y + Math.sin(e * He), this._count += 1;
942
+ }
943
+ merge(e) {
944
+ this._x += e._x, this._y += e._y, this._count += e._count;
945
+ }
946
+ clone() {
947
+ const e = new Ut(this.field);
948
+ return e._x = this._x, e._y = this._y, e._count = this._count, e;
949
+ }
950
+ }, nr = class Gt extends W {
951
+ constructor() {
952
+ super(...arguments), this._frequencies = /* @__PURE__ */ new Map();
953
+ }
954
+ get value() {
955
+ let e, t = 0;
956
+ for (const [s, r] of this._frequencies.entries())
957
+ r > t && (t = r, e = s);
958
+ return e;
959
+ }
960
+ _insertValue(e) {
961
+ const t = this._frequencies.get(e);
962
+ t != null ? this._frequencies.set(e, t + 1) : this._frequencies.set(e, 1);
963
+ }
964
+ merge(e) {
965
+ for (const [t, s] of e._frequencies.entries()) {
966
+ const r = this._frequencies.get(t);
967
+ r != null ? this._frequencies.set(t, r + s) : this._frequencies.set(t, s);
968
+ }
969
+ }
970
+ clone() {
971
+ const e = new Gt(this.field);
972
+ return e._frequencies = new Map(this._frequencies), e;
973
+ }
974
+ }, me = class ee {
975
+ static createId(e, t) {
976
+ return `${e}.${t}`;
977
+ }
978
+ static create(e, t, s, r) {
979
+ return new ee(e, t, Pt.create(s), r);
980
+ }
981
+ constructor(e, t, s, r) {
982
+ this.gridX = e, this.gridY = t, this._statistics = s, this._worldUnitsPerCell = r, this._count = 0, this._xWorldTotal = 0, this._yWorldTotal = 0, this._objectIds = /* @__PURE__ */ new Set();
983
+ }
984
+ get id() {
985
+ return ee.createId(this.gridX, this.gridY);
986
+ }
987
+ get count() {
988
+ return this._count;
989
+ }
990
+ get statistics() {
991
+ return this._statistics;
992
+ }
993
+ get objectIds() {
994
+ return this._objectIds;
995
+ }
996
+ get firstObjectId() {
997
+ return this._objectIds.values().next().value;
998
+ }
999
+ get centroidXWorld() {
1000
+ return this._xWorldTotal / this._count;
1001
+ }
1002
+ get centroidYWorld() {
1003
+ return this._yWorldTotal / this._count;
1004
+ }
1005
+ clone() {
1006
+ const e = new ee(this.gridX, this.gridY, this._statistics.clone(), this._worldUnitsPerCell);
1007
+ return e._count = this._count, e._xWorldTotal = this._xWorldTotal, e._yWorldTotal = this._yWorldTotal, e._firstFeatureAttributes = this._firstFeatureAttributes, e._objectIds = new Set(this._objectIds), e;
1008
+ }
1009
+ insert(e, t, s, r) {
1010
+ this._count === 0 ? this._firstFeatureAttributes = e.readAttributes() : this._firstFeatureAttributes = null, this._count += 1, this._xWorldTotal += s, this._yWorldTotal += r, this._statistics.insert(e, t), this._objectIds.add(e.getObjectId());
1011
+ }
1012
+ merge(e) {
1013
+ if (e._count !== 0) {
1014
+ this._count += e._count, this._firstFeatureAttributes = e._firstFeatureAttributes, this._xWorldTotal += e._xWorldTotal, this._yWorldTotal += e._yWorldTotal, this._statistics.merge(e._statistics);
1015
+ for (const t of e._objectIds.values())
1016
+ this._objectIds.add(t);
1017
+ }
1018
+ }
1019
+ getCentroidX(e) {
1020
+ return e == null ? this.centroidXWorld : Fs(e, this.centroidXWorld);
1021
+ }
1022
+ getCentroidY(e) {
1023
+ return e == null ? this.centroidYWorld : Ts(e, this.centroidYWorld);
1024
+ }
1025
+ getCentroid(e) {
1026
+ const t = new T([], [this.centroidXWorld, this.centroidYWorld]);
1027
+ if (e != null) {
1028
+ const s = new T();
1029
+ return X(s, t, !1, !1, "esriGeometryPoint", e);
1030
+ }
1031
+ return t;
1032
+ }
1033
+ getGeometricCentroid(e) {
1034
+ const t = this.gridX * this._worldUnitsPerCell + 0.5 * this._worldUnitsPerCell, s = this.gridY * this._worldUnitsPerCell + 0.5 * this._worldUnitsPerCell, r = new T([], [t, s]);
1035
+ if (e != null) {
1036
+ const i = new T();
1037
+ return X(i, r, !1, !1, "esriGeometryPoint", e);
1038
+ }
1039
+ return r;
1040
+ }
1041
+ getAttributes() {
1042
+ const e = { aggregateId: this.id };
1043
+ for (const t of this._statistics.values())
1044
+ e[t.field.name] = t.value;
1045
+ return this._firstFeatureAttributes != null ? { ...e, ...this._firstFeatureAttributes } : e;
1046
+ }
1047
+ };
1048
+ const ar = 96;
1049
+ function be(u, e) {
1050
+ return Ht(u) * Jt * ar / e;
1051
+ }
1052
+ let or = class {
1053
+ constructor(e) {
1054
+ this._options = e, this._cells = /* @__PURE__ */ new Map(), this._pixelsPerMapUnit = be(e.spatialReference, e.scale);
1055
+ }
1056
+ insert(e, t) {
1057
+ const s = e.getCursor(), r = { $view: { scale: this._options.scale, timeZone: this._options.timeZone } };
1058
+ for (; s.next(); )
1059
+ this._insertFeature(s, r, t);
1060
+ }
1061
+ putCellsInBounds(e, t) {
1062
+ const [s, r, i, n] = t, a = Math.floor(s * this._pixelsPerMapUnit / this._options.cellSize), o = Math.floor(r * this._pixelsPerMapUnit / this._options.cellSize), h = Math.ceil(i * this._pixelsPerMapUnit / this._options.cellSize), c = Math.ceil(n * this._pixelsPerMapUnit / this._options.cellSize);
1063
+ for (let d = o; d <= c; d++)
1064
+ for (let l = a; l <= h; l++) {
1065
+ const g = `${l}.${d}`, _ = this._cells.get(g);
1066
+ if (!_)
1067
+ continue;
1068
+ const m = e.get(_.id);
1069
+ m ? _ && !e.has(_.id) && m.merge(_) : e.set(_.id, _.clone());
1070
+ }
1071
+ }
1072
+ putCells(e) {
1073
+ for (const t of this._cells.values()) {
1074
+ const s = e.get(t.id);
1075
+ s ? s.merge(t) : e.set(t.id, t.clone());
1076
+ }
1077
+ }
1078
+ _insertFeature(e, t, s) {
1079
+ const { featureFilter: r } = this._options;
1080
+ if (r !== null && !r.check(e))
1081
+ return;
1082
+ let i = 0, n = 0;
1083
+ if (e.geometryType === "esriGeometryPoint")
1084
+ i = e.readXWorldSpace(), n = e.readYWorldSpace();
1085
+ else {
1086
+ if (s) {
1087
+ const l = e.readCentroidForDisplay();
1088
+ if (l == null)
1089
+ return;
1090
+ const [g, _] = l.coords;
1091
+ if (g < 0 || g > x || _ < 0 || _ > x)
1092
+ return;
1093
+ }
1094
+ const d = e.readCentroidWorldSpace();
1095
+ if (d == null)
1096
+ return;
1097
+ i = d.coords[0], n = d.coords[1];
1098
+ }
1099
+ const a = i * this._pixelsPerMapUnit, o = n * this._pixelsPerMapUnit, h = Math.floor(a / this._options.cellSize), c = Math.floor(o / this._options.cellSize);
1100
+ this._getCellOrCreate(h, c).insert(e, t, i, n);
1101
+ }
1102
+ _getCellOrCreate(e, t) {
1103
+ const s = me.createId(e, t);
1104
+ let r = this._cells.get(s);
1105
+ if (!r) {
1106
+ const i = 1 * this._options.cellSize / this._pixelsPerMapUnit;
1107
+ r = me.create(e, t, this._options.fields, i), this._cells.set(s, r);
1108
+ }
1109
+ return r;
1110
+ }
1111
+ }, hr = class {
1112
+ constructor(e, t) {
1113
+ this.inner = e, this.displayId = t;
1114
+ }
1115
+ };
1116
+ const J = 128;
1117
+ let ur = class extends Ee {
1118
+ constructor(e) {
1119
+ super(e), this.didSend = !1, this.done = !1;
1120
+ }
1121
+ }, dr = class {
1122
+ constructor(e, t, s, r, i) {
1123
+ this._level = e, this._scale = t, this._indexOptions = s, this._clusterRadius = r, this._store = i, this._cells = /* @__PURE__ */ new Map(), this._handledChunks = /* @__PURE__ */ new Set(), this._statistics = /* @__PURE__ */ new Map(), this._clusters = /* @__PURE__ */ new Map();
1124
+ }
1125
+ destroy() {
1126
+ this._clearClusters();
1127
+ }
1128
+ _clearClusters() {
1129
+ for (const e of this._clusters.values())
1130
+ this._store.releaseDisplayIdForObjectId(e.inner.id);
1131
+ this._clusters.clear();
1132
+ }
1133
+ *aggregatesWorldSpace() {
1134
+ for (const e of this._clusters.values()) {
1135
+ const t = e.inner.getCentroid(null), s = new B(t, e.inner.getAttributes(), null);
1136
+ s.objectId = e.inner.id, s.displayId = e.displayId, yield s;
1137
+ }
1138
+ }
1139
+ clusters() {
1140
+ return this._clusters.values();
1141
+ }
1142
+ updateChunks(e, t) {
1143
+ let s = !1;
1144
+ for (const a of e) {
1145
+ const o = a.queryInfo;
1146
+ "tileId" in o && new we(o.tileId).level !== this._level || this._handledChunks.has(a.normalizedChunkId) || (this._handledChunks.add(a.normalizedChunkId), s = !0, a.getGridIndex({ ...this._indexOptions, scale: this._scale }).putCells(this._cells));
1147
+ }
1148
+ const r = { xMin: 1 / 0, yMin: 1 / 0, xMax: -1 / 0, yMax: -1 / 0 }, i = be(this._indexOptions.spatialReference, this._scale), n = this._indexOptions.cellSize;
1149
+ for (const { subscription: a } of t) {
1150
+ const o = a.tile.bounds, h = Math.floor(o[0] * i / n), c = Math.floor(o[1] * i / n), d = Math.ceil(o[2] * i / n), l = Math.ceil(o[3] * i / n);
1151
+ r.xMin = Math.min(r.xMin, h), r.yMin = Math.min(r.yMin, c), r.xMax = Math.max(r.xMax, d), r.yMax = Math.max(r.yMax, l);
1152
+ }
1153
+ return this._lastCellBounds != null && r.xMin === this._lastCellBounds.xMin && r.yMin === this._lastCellBounds.yMin && r.yMin === this._lastCellBounds.yMin && r.yMax === this._lastCellBounds.yMax || (s = !0, this._lastCellBounds = r), s && this._clusterCells(r), s;
1154
+ }
1155
+ async updateStatistics(e) {
1156
+ let t = !1;
1157
+ for (const s of this._clusters.values())
1158
+ s.inner.count > 1 && (t = this._updateAggregateStatistics(this._statistics, s.inner) || t);
1159
+ if (t) {
1160
+ const s = Array.from(this._statistics.entries()).map(([r, i]) => ({ fieldName: r, minValue: i.minValue, maxValue: i.maxValue }));
1161
+ await e.container.updateStatistics(this._level, s);
1162
+ }
1163
+ }
1164
+ createAggregateFeatures(e, t) {
1165
+ const s = e.subscription, r = [], i = s.tile.transform;
1166
+ for (const n of this._clusters.values()) {
1167
+ let a = n.inner.getCentroidX(i);
1168
+ const o = n.inner.getCentroidY(i), h = s.tile.lod, c = h.wrap ? h.worldSize[0] : null, d = n.inner.count === 1 ? n.inner.firstObjectId : n.inner.id, l = n.displayId;
1169
+ if (c != null)
1170
+ if (c === 1) {
1171
+ const g = new T([], [a, o]), _ = new B(g, n.inner.getAttributes(), null);
1172
+ _.geometry.coords[0] -= x, _.objectId = d, _.displayId = l, r.push(_);
1173
+ const m = new T([], [a, o]), p = new B(m, n.inner.getAttributes(), null);
1174
+ p.geometry.coords[0] += x, p.objectId = d, p.displayId = l, r.push(p);
1175
+ } else
1176
+ a > x + x / 2 ? a -= c * x : a < -x / 2 && (a += c * x);
1177
+ if (a < x + J && a >= -J && o < x + J && o >= -J) {
1178
+ const g = new T([], [a, o]), _ = new B(g, n.inner.getAttributes(), null);
1179
+ _.objectId = d, _.displayId = l, r.push(_);
1180
+ }
1181
+ }
1182
+ return M.fromOptimizedFeatures(r, t, s.tile.transform);
1183
+ }
1184
+ _clusterCells(e) {
1185
+ let t = Array.from(this._cells.values());
1186
+ t = t.sort((a, o) => o.count - a.count);
1187
+ const s = [];
1188
+ for (const a of this._clusters.values())
1189
+ s.push(a.inner.id);
1190
+ this._clusters.clear();
1191
+ const r = this._clusterRadius * (1 / be(this._indexOptions.spatialReference, this._scale)), i = 1 + this._clusterRadius / this._indexOptions.cellSize, n = /* @__PURE__ */ new Set();
1192
+ for (const a of t) {
1193
+ if (n.has(a.id) || a.gridX < e.xMin || a.gridX > e.xMax || a.gridY < e.yMin || a.gridY > e.yMax)
1194
+ continue;
1195
+ const o = this._store.createDisplayIdForObjectId(a.id), h = new hr(a.clone(), o);
1196
+ n.add(a.id), this._clusters.set(a.id, h);
1197
+ const c = a.centroidXWorld, d = a.centroidYWorld;
1198
+ for (let l = a.gridY - i; l <= a.gridY + i; l++)
1199
+ for (let g = a.gridX - i; g <= a.gridX + i; g++) {
1200
+ if (l === a.gridY && g === a.gridX)
1201
+ continue;
1202
+ const _ = this._cells.get(me.createId(g, l));
1203
+ if (!_ || n.has(_.id))
1204
+ continue;
1205
+ const m = Math.abs(_.centroidXWorld - c), p = Math.abs(_.centroidYWorld - d);
1206
+ m < r && p < r && (h.inner.merge(_), n.add(_.id));
1207
+ }
1208
+ }
1209
+ for (const a of s)
1210
+ this._store.releaseDisplayIdForObjectId(a);
1211
+ }
1212
+ _updateAggregateStatistics(e, t) {
1213
+ let s = !1;
1214
+ for (const r of t.statistics.values()) {
1215
+ if (r.field.type === "esriFieldTypeString")
1216
+ continue;
1217
+ const i = r.value, n = r.field, a = e.get(n.name);
1218
+ if (a) {
1219
+ const { minValue: o, maxValue: h } = a, c = Math.min(a.minValue, i), d = Math.max(a.maxValue, i);
1220
+ o === c && h === d || (a.minValue = c, a.maxValue = d, s = !0);
1221
+ } else
1222
+ e.set(n.name, { minValue: i, maxValue: i }), s = !0;
1223
+ }
1224
+ return s;
1225
+ }
1226
+ };
1227
+ class je extends Rt {
1228
+ static async create(e, t, s, r, i, n) {
1229
+ const a = new Me({ spatialReference: s }), o = { fields: await Promise.all(t.fields.map(async (h) => qt.create(a, h))), spatialReference: s, featureFilter: t.featureFilter ? await yt.create({ geometryType: r.metadata.geometryType, hasM: !1, hasZ: !1, timeInfo: r.metadata.timeInfo, fieldsIndex: r.metadata.fieldsIndex, spatialReference: s, filterJSON: t.featureFilter }) : null, cellSize: t.clusterRadius / 4, timeZone: n };
1230
+ return new je(e, t.clusterRadius, o, t.fields, r, i);
1231
+ }
1232
+ constructor(e, t, s, r, i, n) {
1233
+ super(i, n, s.spatialReference, s.fields), this._connection = e, this._clusterRadius = t, this._indexOptions = s, this._cellsPerScale = /* @__PURE__ */ new Map(), this._metadata = new $e({ geometryType: "esriGeometryPoint", objectIdField: "aggregateId", fields: [...r, ...this._source.metadata.fieldsIndex.fields, { name: "aggregateId", alias: "aggregateId", type: "esriFieldTypeOID" }], globalIdField: null, spatialReference: i.metadata.spatialReference, subtypeField: null, subtypes: null, timeInfo: null, timeReferenceUnknownClient: null, typeIdField: null, types: null });
1234
+ }
1235
+ get enablePixelBuffering() {
1236
+ return !1;
1237
+ }
1238
+ invalidate() {
1239
+ super.invalidate();
1240
+ for (const e of this._cellsPerScale.values())
1241
+ e.destroy();
1242
+ this._cellsPerScale.clear();
1243
+ }
1244
+ onSubscribe(e) {
1245
+ super.onSubscribe(e), this._requiredLevel = e.tile.level, this._requiredScale = e.tile.scale;
1246
+ }
1247
+ createState(e) {
1248
+ return new ur(e);
1249
+ }
1250
+ async *applyOverride(e) {
1251
+ for (const t of this._cellsPerScale.values())
1252
+ t.destroy();
1253
+ this._cellsPerScale.clear();
1254
+ for (const t of this._sendStates.values())
1255
+ t.done = !1;
1256
+ }
1257
+ displayMap(e, t, s) {
1258
+ const r = new Map(e.map((a) => [t(a), a])), i = [], n = this._getClusterState(this._requiredLevel, this._requiredScale);
1259
+ for (const a of n.clusters()) {
1260
+ const o = r.get(a.inner.id);
1261
+ if (o == null) {
1262
+ if (a.inner.count === 1) {
1263
+ const h = r.get(a.inner.firstObjectId);
1264
+ if (h != null) {
1265
+ const c = s(a.displayId, h, a.inner.firstObjectId);
1266
+ i.push(c), r.delete(a.inner.firstObjectId);
1267
+ }
1268
+ }
1269
+ } else {
1270
+ const h = s(a.displayId, o, a.inner.id);
1271
+ i.push(h), r.delete(a.inner.id);
1272
+ }
1273
+ }
1274
+ return i;
1275
+ }
1276
+ getDisplayFeatures(e) {
1277
+ const t = new Set(e), s = /* @__PURE__ */ new Set(), r = [], i = [], n = this._getClusterState(this._requiredLevel, this._requiredScale);
1278
+ for (const a of n.aggregatesWorldSpace())
1279
+ if (t.has(a.displayId) && !s.has(a.displayId)) {
1280
+ const o = bt(a, this._metadata.geometryType, !1, !1);
1281
+ if (s.add(a.displayId), o.attributes.cluster_count === 1) {
1282
+ r.push({ ...o, displayId: a.displayId });
1283
+ continue;
1284
+ }
1285
+ i.push({ ...o, displayId: a.displayId });
1286
+ }
1287
+ return { features: r, aggregates: i };
1288
+ }
1289
+ getFeatureObjectIdsForAggregate(e) {
1290
+ const t = this._getClusterState(this._requiredLevel, this._requiredScale);
1291
+ for (const s of t.clusters())
1292
+ if (s.inner.id === e)
1293
+ return Array.from(s.inner.objectIds);
1294
+ return [];
1295
+ }
1296
+ async *updateChunks() {
1297
+ const e = this._source.chunks();
1298
+ if (!e.length)
1299
+ return;
1300
+ const t = this._getClusterState(this._requiredLevel, this._requiredScale), s = Array.from(this._sendStates.values()).filter((n) => n.subscription.tile.level === this._requiredLevel);
1301
+ if (t.updateChunks(e, s) || !this._source.updateTracking.updating)
1302
+ for (const n of s)
1303
+ n.subscription.tile.level === this._requiredLevel && (n.didSend = !1, n.done = !1);
1304
+ const r = Array.from(this._sendStates.values()).filter((n) => n.done).map((n) => n.subscription.tile.key), i = new Set(r);
1305
+ for (const n of this._sendStates.values())
1306
+ this._source.updateTracking.updating && (r.some((a) => a.containsChild(n.subscription.tile.key)) || n.subscription.tile.key.getChildKeys().every((a) => i.has(a))) || n.didSend || n.subscription.tile.level !== this._requiredLevel || (n.didSend = !0, yield* this._update(n, t, this._source));
1307
+ await t.updateStatistics(this._connection);
1308
+ }
1309
+ forEachAggregateWorldSpace(e) {
1310
+ if (this._requiredLevel == null || this._requiredScale == null)
1311
+ return;
1312
+ const t = this._getClusterState(this._requiredLevel, this._requiredScale);
1313
+ for (const s of t.aggregatesWorldSpace())
1314
+ e(s);
1315
+ }
1316
+ _getClusterState(e, t) {
1317
+ if (e == null || t == null)
1318
+ throw new Error("InternalError: Level and scale must be defined");
1319
+ let s = this._cellsPerScale.get(t);
1320
+ return s || (s = new dr(e, t, this._indexOptions, this._clusterRadius, this._attributeStore), this._cellsPerScale.set(t, s)), s;
1321
+ }
1322
+ async *_update(e, t, s) {
1323
+ if (e.done)
1324
+ return;
1325
+ const r = t.createAggregateFeatures(e, this._metadata);
1326
+ this.events.emit("changed"), e.done = !s.updateTracking.updating;
1327
+ const i = r.getCursor(), n = e.subscription.tile.createArcadeEvaluationOptions(this._indexOptions.timeZone);
1328
+ for (; i.next(); )
1329
+ this._attributeStore.setAttributeData(i.getDisplayId(), i, n);
1330
+ yield new Pe(e.subscription, r, !0, e.done, {});
1331
+ }
1332
+ }
1333
+ let cr = class Wt {
1334
+ static fromReader(e) {
1335
+ const t = [], s = e.copy(), r = ke();
1336
+ for (; s.next(); )
1337
+ s.getBounds(r) && t.push(s.getIndex());
1338
+ const i = Kt(9, (n) => (s.setIndex(n), { minX: s.getBoundsXMin(), minY: s.getBoundsYMin(), maxX: s.getBoundsXMax(), maxY: s.getBoundsYMax() }));
1339
+ return i.load(t), new Wt(i);
1340
+ }
1341
+ constructor(e) {
1342
+ this._index = e;
1343
+ }
1344
+ search(e) {
1345
+ const t = { minX: e[0], minY: e[1], maxX: e[2], maxY: e[3] };
1346
+ return this._index.search(t);
1347
+ }
1348
+ }, Je = class Ie {
1349
+ static create(e, t, s, r) {
1350
+ const i = Pt.create(e), n = new Array(32);
1351
+ for (let a = 0; a < n.length; a++)
1352
+ n[a] = null;
1353
+ return new Ie(i, t, s, r, n);
1354
+ }
1355
+ constructor(e, t, s, r, i) {
1356
+ this._statistics = e, this.xNode = t, this.yNode = s, this.depth = r, this.children = i, this._objectIds = /* @__PURE__ */ new Set(), this._count = 0, this._xWorldTotal = 0, this._yWorldTotal = 0, this._xGeohashTotal = 0, this._yGeohashTotal = 0, this.next = null;
1357
+ }
1358
+ get id() {
1359
+ return `${this.xNode}.${this.yNode}`;
1360
+ }
1361
+ get objectIds() {
1362
+ return this._objectIds;
1363
+ }
1364
+ clone() {
1365
+ const e = new Ie(this._statistics.clone(), this.xNode, this.yNode, this.depth, this.children);
1366
+ return e._count = this._count, e._xWorldTotal = this._xWorldTotal, e._yWorldTotal = this._yWorldTotal, e._xGeohashTotal = this._xGeohashTotal, e._yGeohashTotal = this._yGeohashTotal, e.next = this.next, e.cachedFeature = this.cachedFeature, e._objectIds = new Set(this._objectIds), e;
1367
+ }
1368
+ insert(e, t, s, r, i, n) {
1369
+ this._count += 1, this._xWorldTotal += t, this._yWorldTotal += s, this._xGeohashTotal += r, this._yGeohashTotal += i, this._statistics.insert(e, n), this._objectIds.add(e.getObjectId());
1370
+ }
1371
+ merge(e) {
1372
+ if (e._count !== 0) {
1373
+ this._count += e._count, this._xWorldTotal += e._xWorldTotal, this._yWorldTotal += e._yWorldTotal, this._xGeohashTotal += e._xWorldTotal, this._yGeohashTotal += e._yWorldTotal, this._statistics.merge(e._statistics);
1374
+ for (const t of e._objectIds.values())
1375
+ this._objectIds.add(t);
1376
+ }
1377
+ }
1378
+ getGeometry(e, t) {
1379
+ const s = this._getLngLatBounds(), [r, i, n, a] = s, o = We({ rings: [[[r, i], [r, a], [n, a], [n, i], [r, i]]] }, V.WGS84, e), h = Cs(new T(), o, !1, !1);
1380
+ return t != null ? X(new T(), h, !1, !1, "esriGeometryPolygon", t, !1, !1) : h;
1381
+ }
1382
+ getGeometryCentroid(e, t) {
1383
+ const s = this._getLngLatBounds(), [r, i, n, a] = s, o = We({ x: (r + n) / 2, y: (i + a) / 2 }, V.WGS84, e), h = Ms(new T(), o);
1384
+ return t != null ? X(new T(), h, !1, !1, "esriGeometryPoint", t, !1, !1) : h;
1385
+ }
1386
+ getAttributes() {
1387
+ const e = { aggregateId: this.id };
1388
+ for (const t of this._statistics.values())
1389
+ e[t.field.name] = t.value;
1390
+ return e.aggregateCount = this._count, e;
1391
+ }
1392
+ _getLngLatBounds() {
1393
+ const e = this.depth, t = Math.ceil(e / 2), s = Math.floor(e / 2), r = 30 - (3 * t + 2 * s), i = 30 - (2 * t + 3 * s), n = this.xNode << r, a = this.yNode << i;
1394
+ return Is({ geohashX: n, geohashY: a }, this.depth);
1395
+ }
1396
+ }, lr = class {
1397
+ constructor(e) {
1398
+ this._fields = e, this._root = Je.create(this._fields, 0, 0, 0);
1399
+ }
1400
+ destroy() {
1401
+ }
1402
+ insert(e, t, s, r, i, n, a) {
1403
+ let o = this._root, h = 0, c = 0, d = 0;
1404
+ for (; o !== null; ) {
1405
+ if (o.insert(e, t, s, r, i, a), h >= n)
1406
+ return;
1407
+ const l = Math.ceil((h + 1) / 2), g = Math.floor((h + 1) / 2), _ = 1 - h % 2, m = 30 - (3 * l + 2 * g), p = 30 - (2 * l + 3 * g), I = (r & 7 * _ + 3 * (1 - _) << m) >> m, f = (i & 3 * _ + 7 * (1 - _) << p) >> p, k = I + f * (8 * _ + 4 * (1 - _));
1408
+ c = c << 3 * _ + 2 * (1 - _) | I, d = d << 2 * _ + 3 * (1 - _) | f, o.children[k] == null && (o.children[k] = Je.create(this._fields, c, d, h + 1)), h += 1, o = o.children[k];
1409
+ }
1410
+ }
1411
+ putBins(e, t) {
1412
+ for (const s of this.getNodes(t)) {
1413
+ const r = e.get(s.id);
1414
+ r ? r.merge(s) : e.set(s.id, s.clone());
1415
+ }
1416
+ }
1417
+ getNodes(e) {
1418
+ const t = [], { geohashBounds: s, level: r } = e;
1419
+ let i = this._root;
1420
+ for (; i !== null; ) {
1421
+ const n = i.depth, a = i.xNode, o = i.yNode;
1422
+ if (n >= r) {
1423
+ t.push(i), i = i.next;
1424
+ continue;
1425
+ }
1426
+ const h = Math.ceil((n + 1) / 2), c = Math.floor((n + 1) / 2), d = 1 - n % 2, l = 30 - (3 * h + 2 * c), g = 30 - (2 * h + 3 * c), _ = ~((1 << l) - 1), m = ~((1 << g) - 1), p = (s.xLL & _) >> l, I = (s.yLL & m) >> g, f = (s.xTR & _) >> l, k = (s.yTR & m) >> g, b = a << 3 * d + 2 * (1 - d), v = o << 2 * d + 3 * (1 - d), S = b + 8 * d + 4 * (1 - d), w = v + 4 * d + 8 * (1 - d), $ = Math.max(b, p), F = Math.max(v, I), O = Math.min(S, f), R = Math.min(w, k);
1427
+ let C = null, q = null;
1428
+ for (let E = F; E <= R; E++)
1429
+ for (let P = $; P <= O; P++) {
1430
+ const Zt = P - b + (E - v) * (8 * d + 4 * (1 - d)), N = i.children[Zt];
1431
+ N && (C || (C = N, C.next = i.next), q && (q.next = N), q = N, N.next = i.next);
1432
+ }
1433
+ i = C || i.next;
1434
+ }
1435
+ return t;
1436
+ }
1437
+ }, _r = class {
1438
+ constructor(e) {
1439
+ this._options = e, this._tree = new lr(e.fields);
1440
+ }
1441
+ insert(e, t) {
1442
+ const s = e.getCursor(), r = { $view: { scale: 0, timeZone: this._options.timeZone } };
1443
+ for (; s.next(); )
1444
+ this._insertFeature(s, r, t);
1445
+ }
1446
+ putBins(e, t) {
1447
+ this._tree.putBins(e, t);
1448
+ }
1449
+ _insertFeature(e, t, s) {
1450
+ const { featureFilter: r, geohashLevel: i, spatialReference: n } = this._options;
1451
+ if (r !== null && !r.check(e))
1452
+ return;
1453
+ let a = 0, o = 0;
1454
+ if (e.geometryType === "esriGeometryPoint")
1455
+ a = e.readXWorldSpace(), o = e.readYWorldSpace();
1456
+ else {
1457
+ if (s) {
1458
+ const d = e.readCentroidForDisplay();
1459
+ if (d == null)
1460
+ return;
1461
+ const [l, g] = d.coords;
1462
+ if (l < 0 || l > x || g < 0 || g > x)
1463
+ return;
1464
+ }
1465
+ const c = e.readCentroidWorldSpace();
1466
+ if (c == null)
1467
+ return;
1468
+ a = c.coords[0], o = c.coords[1];
1469
+ }
1470
+ const h = vs(a, o, i, n);
1471
+ h && this._tree.insert(e, a, o, h[0], h[1], i, t);
1472
+ }
1473
+ }, pr = class ve extends Ce {
1474
+ static from(e, t) {
1475
+ return new ve(e.copy(), t);
1476
+ }
1477
+ constructor(e, t) {
1478
+ super(e.metadata), this._currentIndex = -1, this._displayTranslationX = 0, this._displayTranslationY = 0, this._displayScaleX = 1, this._displayScaleY = 1, this._reader = e, this._indices = t, this._isPoint = e.geometryType === "esriGeometryPoint";
1479
+ }
1480
+ setTransformForDisplay(e) {
1481
+ const t = this._reader.getInTransform();
1482
+ if (t == null) {
1483
+ const [d, l] = e.scale, [g, _] = e.translate;
1484
+ return this._displayTranslationX = -g / d, this._displayScaleX = 1 / d, this._displayTranslationY = _ / l, this._displayScaleY = 1 / -l, void (this._displayTransform = e);
1485
+ }
1486
+ const [s, r] = t.scale, [i, n] = t.translate, [a, o] = e.scale, [h, c] = e.translate;
1487
+ if (this._displayScaleX = s / a, this._displayTranslationX = (i - h) / a, this._displayScaleY = r / o, this._displayTranslationY = (-n + c) / o, !this._isPoint && t)
1488
+ throw new Error("InternalError: Relative transformations not supported for non-point features");
1489
+ this._displayTransform = e;
1490
+ }
1491
+ getInTransform() {
1492
+ return this._reader.getInTransform();
1493
+ }
1494
+ get fields() {
1495
+ return this._reader.fields;
1496
+ }
1497
+ get hasNext() {
1498
+ return this._currentIndex + 1 < this._indices.length;
1499
+ }
1500
+ getSize() {
1501
+ return this._indices.length;
1502
+ }
1503
+ getCursor() {
1504
+ return this.copy();
1505
+ }
1506
+ copy() {
1507
+ const e = new ve(this._reader.copy(), this._indices);
1508
+ return e._currentIndex = this._currentIndex, e._displayTransform = this._displayTransform, e._displayTranslationX = this._displayTranslationX, e._displayTranslationY = this._displayTranslationY, e._displayScaleX = this._displayScaleX, e._displayScaleY = this._displayScaleY, e;
1509
+ }
1510
+ get contextTimeZone() {
1511
+ return this._reader.contextTimeZone;
1512
+ }
1513
+ set contextTimeZone(e) {
1514
+ this._reader.contextTimeZone = e;
1515
+ }
1516
+ _nextIndex() {
1517
+ return ++this._currentIndex < this._indices.length && (this._reader.setIndex(this._indices[this._currentIndex]), !0);
1518
+ }
1519
+ next() {
1520
+ for (; this._nextIndex() && !this._reader._getExists(); )
1521
+ ;
1522
+ return this._currentIndex < this._indices.length;
1523
+ }
1524
+ readXForDisplay() {
1525
+ return this._reader.readXForDisplay() * this._displayScaleX + this._displayTranslationX;
1526
+ }
1527
+ readYForDisplay() {
1528
+ return this._reader.readYForDisplay() * this._displayScaleY + this._displayTranslationY;
1529
+ }
1530
+ readGeometryForDisplay() {
1531
+ const e = this._reader.readGeometryForDisplay();
1532
+ if (!this._displayTransform)
1533
+ return e;
1534
+ const t = new T();
1535
+ return X(t, e, this.hasZ, this.hasM, this.geometryType, this._displayTransform), t.deltaDecode();
1536
+ }
1537
+ readCentroidForDisplay() {
1538
+ var t;
1539
+ const e = (t = this._reader.readCentroidForDisplay()) == null ? void 0 : t.clone();
1540
+ if (e) {
1541
+ const [s, r] = e.coords;
1542
+ e.coords[0] = s * this._displayScaleX + this._displayTranslationX, e.coords[1] = r * this._displayScaleY + this._displayTranslationY;
1543
+ }
1544
+ return e;
1545
+ }
1546
+ get geometryType() {
1547
+ return this._reader.geometryType;
1548
+ }
1549
+ get hasFeatures() {
1550
+ return this._reader.hasFeatures;
1551
+ }
1552
+ get exceededTransferLimit() {
1553
+ return this._reader.exceededTransferLimit;
1554
+ }
1555
+ get hasZ() {
1556
+ return this._reader.hasZ;
1557
+ }
1558
+ get hasM() {
1559
+ return this._reader.hasM;
1560
+ }
1561
+ readAttribute(e, t = !1) {
1562
+ return this._reader.readAttribute(e, t);
1563
+ }
1564
+ readAttributes() {
1565
+ return this._reader.readAttributes();
1566
+ }
1567
+ joinAttributes(e) {
1568
+ return this._reader.joinAttributes(e);
1569
+ }
1570
+ getBounds(e) {
1571
+ return this._reader.getBounds(e);
1572
+ }
1573
+ getAttributeHash() {
1574
+ return this._reader.getAttributeHash();
1575
+ }
1576
+ getObjectId() {
1577
+ return this._reader.getObjectId();
1578
+ }
1579
+ getDisplayId() {
1580
+ return this._reader.getDisplayId();
1581
+ }
1582
+ setDisplayId(e) {
1583
+ return this._reader.setDisplayId(e);
1584
+ }
1585
+ setIndex(e) {
1586
+ return this._reader.setIndex(e);
1587
+ }
1588
+ getIndex() {
1589
+ return this._reader.getIndex();
1590
+ }
1591
+ readXWorldSpace() {
1592
+ return this._reader.readXWorldSpace();
1593
+ }
1594
+ readYWorldSpace() {
1595
+ return this._reader.readYWorldSpace();
1596
+ }
1597
+ _readX() {
1598
+ return this._reader.readXForDisplay();
1599
+ }
1600
+ _readY() {
1601
+ return this._reader.readYForDisplay();
1602
+ }
1603
+ _readServerCentroid() {
1604
+ return this._reader._readServerCentroid();
1605
+ }
1606
+ readLegacyFeatureForDisplay() {
1607
+ const e = this.readCentroidForDisplay();
1608
+ return { attributes: this.readAttributes(), geometry: this.readLegacyGeometryForDisplay(), centroid: (e && { x: e.coords[0], y: e.coords[1] }) ?? null };
1609
+ }
1610
+ readLegacyGeometryForDisplay() {
1611
+ const e = this.readGeometryForDisplay();
1612
+ return $s(e, this.geometryType, !1, !1);
1613
+ }
1614
+ readGeometryArea() {
1615
+ return this._reader.readGeometryArea();
1616
+ }
1617
+ readGeometryWorldSpace() {
1618
+ return this._reader.readGeometryWorldSpace();
1619
+ }
1620
+ _readGeometry() {
1621
+ return this._reader._readGeometry();
1622
+ }
1623
+ _readAttribute(e, t) {
1624
+ throw new Error("Error: Should not be called. Underlying _reader should be used instead");
1625
+ }
1626
+ _readAttributes() {
1627
+ throw new Error("Error: Should not be called. Underlying _reader should be used instead");
1628
+ }
1629
+ readArcadeFeature() {
1630
+ return this._reader.readArcadeFeature();
1631
+ }
1632
+ geometry() {
1633
+ return this._reader.geometry();
1634
+ }
1635
+ field(e) {
1636
+ return this.readAttribute(e, !0);
1637
+ }
1638
+ hasField(e) {
1639
+ return this._reader.hasField(e);
1640
+ }
1641
+ setField(e, t) {
1642
+ return this._reader.setField(e, t);
1643
+ }
1644
+ keys() {
1645
+ return this._reader.keys();
1646
+ }
1647
+ castToText(e = !1) {
1648
+ return this._reader.castToText(e);
1649
+ }
1650
+ }, Z = class {
1651
+ size() {
1652
+ return this.reader.getSize();
1653
+ }
1654
+ get fields() {
1655
+ return this.reader.fields;
1656
+ }
1657
+ invalidate() {
1658
+ this._geohashIndex = null, this._geohashIndexHash = null, this._spatialIndex = null, this._gridIndex = null, this._gridIndexHash = null;
1659
+ }
1660
+ queryFeaturesInBounds(e) {
1661
+ const t = this._getSpatialIndex().search(e);
1662
+ return pr.from(this.reader, t);
1663
+ }
1664
+ getGeohashIndex(e) {
1665
+ const t = JSON.stringify(e);
1666
+ return t !== this._geohashIndexHash && (this._geohashIndexHash = t, this._geohashIndex = new _r(e), this._geohashIndex.insert(this.reader, this.isTiled)), this._geohashIndex;
1667
+ }
1668
+ getGridIndex(e) {
1669
+ const t = JSON.stringify(e);
1670
+ return t !== this._gridIndexHash && (this._gridIndexHash = t, this._gridIndex = new or(e), this._gridIndex.insert(this.reader, this.isTiled)), this._gridIndex;
1671
+ }
1672
+ _getSpatialIndex() {
1673
+ return this._spatialIndex || (this._spatialIndex = cr.fromReader(this.reader)), this._spatialIndex;
1674
+ }
1675
+ }, Nt = class extends Z {
1676
+ constructor(e) {
1677
+ super(), this.metadata = e, this.chunkId = "override", this.normalizedChunkId = "override", this.removed = /* @__PURE__ */ new Set(), this.overridenIds = /* @__PURE__ */ new Set(), this._features = [];
1678
+ }
1679
+ get reader() {
1680
+ return M.fromOptimizedFeatures(this._features, this.metadata);
1681
+ }
1682
+ get queryInfo() {
1683
+ return {};
1684
+ }
1685
+ get first() {
1686
+ return !1;
1687
+ }
1688
+ get end() {
1689
+ return !1;
1690
+ }
1691
+ get isTiled() {
1692
+ return !1;
1693
+ }
1694
+ applyOverrides(e) {
1695
+ super.invalidate();
1696
+ const { reader: t, removed: s } = e, r = [], i = /* @__PURE__ */ new Set(), n = t.getCursor(), a = new Set(s);
1697
+ for (this.overridenIds.clear(); n.next(); ) {
1698
+ const o = n.readOptimizedFeatureWorldSpace(), h = o.objectId;
1699
+ r.push(o), i.add(h), this.overridenIds.add(h), this.removed.delete(h);
1700
+ }
1701
+ for (const o of this._features) {
1702
+ const h = o.objectId;
1703
+ a.has(h) || i.has(h) || (r.push(o), this.overridenIds.add(h));
1704
+ }
1705
+ this._features = r;
1706
+ for (const o of i.values())
1707
+ this.removed.delete(o);
1708
+ for (const o of s)
1709
+ this.removed.add(o), this.overridenIds.add(o);
1710
+ }
1711
+ getTileReader(e) {
1712
+ if (!this._features.length)
1713
+ return null;
1714
+ const t = this.queryFeaturesInBounds(e.bounds);
1715
+ return t.setTransformForDisplay(e.transform), t;
1716
+ }
1717
+ }, gr = class extends Ee {
1718
+ }, fr = class extends At {
1719
+ constructor(e, t, s) {
1720
+ super(e, t), this._timeZone = s, this.handledChunks = /* @__PURE__ */ new Set(), this.handledChunksForIdCreation = /* @__PURE__ */ new Set(), this.handledChunksForAttributeData = /* @__PURE__ */ new Set(), this._streamLayerDeferredObjectIdsToRemove = [];
1721
+ }
1722
+ destroy() {
1723
+ super.destroy();
1724
+ for (const e of this._source.chunks())
1725
+ this._cleanupChunkIds(e);
1726
+ }
1727
+ invalidateAttributeData() {
1728
+ this.handledChunksForAttributeData.clear();
1729
+ }
1730
+ onSubscribe(e) {
1731
+ super.onSubscribe(e), this._evalOptions = e.tile.createArcadeEvaluationOptions(this._timeZone);
1732
+ }
1733
+ createState(e) {
1734
+ return new gr(e);
1735
+ }
1736
+ get aggregateQueryEngine() {
1737
+ return null;
1738
+ }
1739
+ displayMap(e, t, s) {
1740
+ const r = new Map(e.map((n) => [t(n), n])), i = [];
1741
+ for (const n of this._source.chunks()) {
1742
+ const a = n.reader.getCursor();
1743
+ for (; a.next(); ) {
1744
+ const o = a.getObjectId(), h = a.getDisplayId(), c = r.get(o);
1745
+ if (c != null) {
1746
+ const d = s(h, c, o);
1747
+ i.push(d), r.delete(o);
1748
+ }
1749
+ }
1750
+ }
1751
+ return i;
1752
+ }
1753
+ getDisplayFeatures(e) {
1754
+ const t = new Set(e), s = /* @__PURE__ */ new Set(), r = [];
1755
+ for (const i of this._source.chunks()) {
1756
+ const n = i.reader.getCursor();
1757
+ for (; n.next(); ) {
1758
+ const a = n.getObjectId(), o = n.getDisplayId();
1759
+ t.has(o) && !s.has(a) && (r.push({ ...n.readLegacyFeatureWorldSpace(), displayId: o }), s.add(a));
1760
+ }
1761
+ }
1762
+ return { features: r, aggregates: [] };
1763
+ }
1764
+ async *applyOverride(e) {
1765
+ const t = [], s = e.reader.getCursor();
1766
+ for (; s.next(); ) {
1767
+ const a = s.getObjectId();
1768
+ t.push(a);
1769
+ const o = this._attributeStore.createDisplayIdForObjectId(a);
1770
+ s.setDisplayId(o), this._attributeStore.setAttributeData(o, s, this._evalOptions);
1771
+ }
1772
+ const r = this.getDisplayIds(t), i = this.getDisplayIds(e.removed), n = new Nt(this._source.metadata);
1773
+ n.applyOverrides(e), this.handledChunks.add(n.chunkId), this.handledChunksForAttributeData.add(n.chunkId), this.handledChunksForIdCreation.add(n.chunkId);
1774
+ for (const a of this._sendStates.values())
1775
+ a.handledChunks.add(n.chunkId), yield new fe(a.subscription, null, r, !1, n.queryInfo);
1776
+ for (const a of this._sendStates.values()) {
1777
+ const o = n.getTileReader(a.subscription.tile);
1778
+ yield new fe(a.subscription, o, i, !1, n.queryInfo);
1779
+ }
1780
+ for (const a of e.removed)
1781
+ this._attributeStore.releaseDisplayIdForObjectId(a);
1782
+ }
1783
+ async *updateChunks() {
1784
+ if (this._source.chunks().length) {
1785
+ await this._updateAttributeData();
1786
+ for (const e of this._sendStates.values())
1787
+ yield* this._update(e);
1788
+ }
1789
+ }
1790
+ removeChunks(e) {
1791
+ for (const t of e)
1792
+ this.handledChunks.delete(t.chunkId), this.handledChunksForAttributeData.delete(t.chunkId), this._cleanupChunkIds(t);
1793
+ }
1794
+ afterUpdateChunks() {
1795
+ for (const e of this._streamLayerDeferredObjectIdsToRemove)
1796
+ this._attributeStore.releaseDisplayIdForObjectId(e);
1797
+ this._streamLayerDeferredObjectIdsToRemove = [];
1798
+ }
1799
+ _cleanupChunkIds(e) {
1800
+ if (this.handledChunksForIdCreation.has(e.chunkId)) {
1801
+ const t = e.reader.getCursor();
1802
+ for (; t.next(); ) {
1803
+ const s = t.getObjectId();
1804
+ this._source.isStream ? this._streamLayerDeferredObjectIdsToRemove.push(s) : this._attributeStore.releaseDisplayIdForObjectId(s);
1805
+ }
1806
+ this.handledChunksForIdCreation.delete(e.chunkId);
1807
+ }
1808
+ }
1809
+ async _updateAttributeData() {
1810
+ for (const e of this._source.chunks()) {
1811
+ const { chunkId: t, reader: s } = e;
1812
+ if (!this.handledChunksForIdCreation.has(t)) {
1813
+ this.handledChunksForIdCreation.add(t);
1814
+ const r = s.getCursor();
1815
+ for (; r.next(); ) {
1816
+ const i = this._attributeStore.createDisplayIdForObjectId(r.getObjectId());
1817
+ r.setDisplayId(i);
1818
+ }
1819
+ }
1820
+ }
1821
+ for (const e of this._source.chunks())
1822
+ if (!this.handledChunksForAttributeData.has(e.chunkId)) {
1823
+ this.handledChunksForAttributeData.add(e.chunkId);
1824
+ const t = e.reader.getCursor();
1825
+ for (; t.next(); ) {
1826
+ const s = t.getDisplayId();
1827
+ this._attributeStore.setAttributeData(s, t, this._evalOptions);
1828
+ }
1829
+ }
1830
+ }
1831
+ *_update(e) {
1832
+ const { subscription: t, handledChunks: s } = e;
1833
+ for (const r of this._source.chunks()) {
1834
+ const { chunkId: i } = r;
1835
+ if (s.has(i))
1836
+ continue;
1837
+ s.add(i);
1838
+ const n = r.getTileReader(t.tile);
1839
+ n && (yield new Pe(e.subscription, n, !1, r.end, r.queryInfo));
1840
+ }
1841
+ }
1842
+ }, yr = class {
1843
+ constructor(e, t) {
1844
+ this._connection = e, this._source = t, this._version = 1, this._proxy = new ps({ fetch: (s, r) => this._connection.layerView.fetch(s, r), fetchDictionary: (s, r) => this._connection.layerView.fetchDictionary(s, r) }), this._attributeStore = new gs({ isLocal: !1, update: (s) => ut(this._connection.container.updateAttributeView(s)) });
1845
+ }
1846
+ destroy() {
1847
+ var e;
1848
+ this._proxy.destory(), (e = this._strategy) == null || e.destroy(), this._attributeStore.destroy();
1849
+ }
1850
+ get aggregateQueryEngine() {
1851
+ var e;
1852
+ return (e = this._strategy) == null ? void 0 : e.aggregateQueryEngine;
1853
+ }
1854
+ getDisplayFeatures(e) {
1855
+ return this._strategy ? this._strategy.getDisplayFeatures(e) : { features: [], aggregates: [] };
1856
+ }
1857
+ getFeatureObjectIdsForAggregate(e) {
1858
+ return this._strategy ? this._strategy.getFeatureObjectIdsForAggregate(e) : [];
1859
+ }
1860
+ onSubscribe(e) {
1861
+ var t;
1862
+ (t = this._strategy) == null || t.onSubscribe(e);
1863
+ }
1864
+ onUnsubscribe(e) {
1865
+ var t;
1866
+ (t = this._strategy) == null || t.onUnsubscribe(e);
1867
+ }
1868
+ async update(e, t, s, r, i) {
1869
+ var c;
1870
+ const n = e.processor, a = ft(this._schema, n);
1871
+ if (!a && !r)
1872
+ return;
1873
+ y("esri-2d-update-debug") && console.debug(`Version[${this._version}] SymbolProcessor.update`, { changes: a, schema: n }), this._schema = n;
1874
+ const o = V.fromJSON(e.source.mutable.dataFilter.outSpatialReference), h = new Me({ fields: this._source.metadata.fieldsIndex, spatialReference: o });
1875
+ return await this._attributeStore.update(n.storage, h, this._source.metadata, o, t), (c = this._strategy) == null || c.invalidateAttributeData(), r || he(a, "mesh") ? (he(a, "mesh.strategy") && await this._updateStrategy(n.mesh.strategy, o, i, n.mesh.timeZone), this._updateSortKey(h, "sortKey" in n.mesh ? n.mesh.sortKey : null), (he(a, "mesh.factory") || n.mesh.factory.symbology.type === "dictionary") && (this._factory = await Qs.create(h, this._proxy, n.mesh.factory, s)), this._invalidate(), this._version = t, this._connection.container.updateRenderState(this._version)) : void 0;
1876
+ }
1877
+ async applyOverride(e) {
1878
+ if (!this._strategy)
1879
+ return;
1880
+ const t = this._strategy.applyOverride(e);
1881
+ for await (const s of t)
1882
+ try {
1883
+ await this._process(s);
1884
+ } catch {
1885
+ }
1886
+ this._source.applyOverride(e);
1887
+ }
1888
+ async updateChunks() {
1889
+ var e;
1890
+ await this._doUpdateChunks(), (e = this._strategy) == null || e.afterUpdateChunks();
1891
+ }
1892
+ async removeChunks(e) {
1893
+ var t;
1894
+ (t = this._strategy) == null || t.removeChunks(e), this._attributeStore.incrementDisplayIdGeneration();
1895
+ }
1896
+ updateHighlight({ highlights: e }) {
1897
+ if (!this._strategy)
1898
+ return void this._attributeStore.setHighlight(e.map(({ objectId: s, highlightFlags: r }) => ({ objectId: s, highlightFlags: r, displayId: -1 })), e);
1899
+ const t = this._strategy.displayMap(e, ({ objectId: s }) => s, (s, { highlightFlags: r }, i) => ({ objectId: i, displayId: s, highlightFlags: r }));
1900
+ this._attributeStore.setHighlight(t, e);
1901
+ }
1902
+ async _doUpdateChunks() {
1903
+ if (!this._strategy)
1904
+ return;
1905
+ const e = this._strategy.updateChunks(), t = [], s = /* @__PURE__ */ new Map();
1906
+ for await (const r of e) {
1907
+ let i = s.get(r.id);
1908
+ i == null && (i = new Zs({ concurrency: 16, process: (a) => this._process(a) }), s.set(r.id, i));
1909
+ const n = i.push(r).catch((a) => Fe(a));
1910
+ t.push(n);
1911
+ }
1912
+ try {
1913
+ await Promise.all(t);
1914
+ } catch {
1915
+ }
1916
+ y("esri-2d-update-debug") && console.log("SendUpdates"), await this._attributeStore.sendUpdates(), y("esri-2d-update-debug") && console.log("SendUpdates.await");
1917
+ }
1918
+ async _updateStrategy(e, t, s, r) {
1919
+ var i;
1920
+ switch ((i = this._strategy) == null || i.destroy(), e.type) {
1921
+ case "feature":
1922
+ this._strategy = new fr(this._source, this._attributeStore, r);
1923
+ break;
1924
+ case "binning":
1925
+ this._strategy = await Js.create(e, t, this._source, this._attributeStore, r);
1926
+ break;
1927
+ case "cluster":
1928
+ this._strategy = await je.create(this._connection, e, t, this._source, this._attributeStore, r);
1929
+ }
1930
+ for (const n of s)
1931
+ this._strategy.onSubscribe(n);
1932
+ }
1933
+ async _updateSortKey(e, t) {
1934
+ var s;
1935
+ if (this._sortInfo = dt((s = this._sortInfo) == null ? void 0 : s.computed), t != null) {
1936
+ const r = t.byRenderer ? null : await e.createComputedField(t);
1937
+ this._sortInfo = { ...t, computed: r };
1938
+ }
1939
+ }
1940
+ _invalidate() {
1941
+ this._strategy && this._strategy.invalidate();
1942
+ }
1943
+ async _process(e) {
1944
+ const t = e.subscription;
1945
+ if (y("esri-2d-update-debug")) {
1946
+ const o = t.tile;
1947
+ console.debug(`Version[${this._version}] Tile[${o.key.id}, end=${e.end}] Processor._process`);
1948
+ }
1949
+ await this._fetchResources(e), Y(t.signal);
1950
+ const s = await this._write(e, t.tile.createArcadeEvaluationOptions(this._schema.mesh.timeZone)), r = t.tile.tileInfoView.tileInfo.isWrappable, { message: i, transferList: n } = s.serialize(r), a = e.createMessage(i, this._version, this._attributeStore.epoch);
1951
+ if (Y(t.signal), this._connection.container.onMessage(a, { signal: t.signal, transferList: n }), this._attributeStore.sendUpdates(), y("esri-2d-update-debug")) {
1952
+ const o = t.tile;
1953
+ console.debug(`Version[${this._version}] Tile[${o.key.id}, end=${e.end}] Processor._process.await`);
1954
+ }
1955
+ }
1956
+ async _fetchResources(e) {
1957
+ await this._fetchMatcherResources(e), await this._fetchWriterResources(e);
1958
+ }
1959
+ async _fetchMatcherResources(e) {
1960
+ if (e.reader)
1961
+ return this._factory.enqueueMatcherRequests(this._proxy, e.reader);
1962
+ }
1963
+ async _fetchWriterResources(e) {
1964
+ if (!e.reader)
1965
+ return;
1966
+ const t = e.reader.getCursor(), s = e.subscription.tile.createArcadeEvaluationOptions(this._schema.mesh.timeZone);
1967
+ for (; t.next(); )
1968
+ this._factory.enqueueWriterRequests(this._proxy, t, s);
1969
+ await this._proxy.fetchEnqueuedResources();
1970
+ }
1971
+ async _write(e, t) {
1972
+ var h;
1973
+ const s = e.subscription.tile, r = (h = e.reader) == null ? void 0 : h.getCursor(), i = (r == null ? void 0 : r.getSize()) ?? 0, n = s.tileInfoView.tileInfo.isWrappable, a = new Us(s.key, this._strategy.enablePixelBuffering, n, i);
1974
+ if (!r)
1975
+ return a;
1976
+ const o = s.createArcadeEvaluationOptions(this._schema.mesh.timeZone);
1977
+ for (; r.next(); ) {
1978
+ const c = this._getSortKeyValue(r, t);
1979
+ a.entityStart(r.getDisplayId(), c), this._factory.write(a, this._proxy, r, o, s.level), a.entityEnd();
1980
+ }
1981
+ return a;
1982
+ }
1983
+ _getSortKeyValue(e, t) {
1984
+ if (!this._sortInfo)
1985
+ return 0;
1986
+ const { computed: s, order: r, byRenderer: i } = this._sortInfo, n = i ? this._factory.getSortKey(e, t) : s == null ? void 0 : s.read(e, t);
1987
+ return n == null || isNaN(n) ? 0 : n * (r === "asc" ? -1 : 1);
1988
+ }
1989
+ }, mr = class Bt {
1990
+ static from(e) {
1991
+ let t = 0, s = 0, r = 0;
1992
+ return e.forEach((i) => {
1993
+ const n = i._readGeometry();
1994
+ n && (s += n.isPoint ? 1 : n.lengths.reduce((a, o) => a + o, 0), r += n.isPoint ? 1 : n.lengths.length, t += 1);
1995
+ }), new Bt(t, s, r);
1996
+ }
1997
+ constructor(e, t, s) {
1998
+ this.featureCount = e, this.vertexCount = t, this.ringCount = s;
1999
+ }
2000
+ toJSON() {
2001
+ return { featureCount: this.featureCount, ringCount: this.featureCount, vertexCount: this.featureCount };
2002
+ }
2003
+ };
2004
+ const ce = 4;
2005
+ function br(u, e) {
2006
+ const { service: t } = u, s = t.orderByFields ?? e.objectIdField + " ASC", r = t.source, i = { returnCentroid: !(r !== null && typeof r == "object" && "path" in r && es(r.path)) && e.geometryType === "esriGeometryPolygon", returnGeometry: !0, timeReferenceUnknownClient: e.timeReferenceUnknownClient ?? void 0, outSpatialReference: V.fromJSON(u.mutable.dataFilter.outSpatialReference), orderByFields: [s], where: u.mutable.dataFilter.definitionExpression ?? "1=1", outFields: u.mutable.availableFields };
2007
+ if (u.type === "feature") {
2008
+ const { gdbVersion: n, historicMoment: a, timeExtent: o } = u.mutable.dataFilter;
2009
+ return { ...i, gdbVersion: n, historicMoment: a ? new Date(a) : null, timeExtent: o ? ts.fromJSON(o) : null, outFields: u.mutable.availableFields };
2010
+ }
2011
+ return i;
2012
+ }
2013
+ let Ir = class Vt {
2014
+ static fromSchema(e, t) {
2015
+ return new Vt(br(e, t), e.mutable.dataFilter.customParameters, t.geometryType, e.service.queryMetadata.capabilities);
2016
+ }
2017
+ constructor(e, t, s, r) {
2018
+ this._queryParams = e, this._customParameters = t, this._geometryType = s, this._capabilities = r;
2019
+ }
2020
+ get pageSize() {
2021
+ if (this._capabilities == null)
2022
+ throw new Error("InternalError: Service does not support paged queries");
2023
+ const { query: e } = this._capabilities, t = e.supportsMaxRecordCountFactor ? ce : null, s = (e.maxRecordCount ?? 8e3) * (t ?? 1);
2024
+ return Math.min(8e3, s);
2025
+ }
2026
+ updateFields(e) {
2027
+ this._queryParams.outFields = e;
2028
+ }
2029
+ createPatchFieldsQuery(e, t) {
2030
+ const s = e.clone();
2031
+ if (this._queryParams.outFields[0] === "*") {
2032
+ if ((s.outFields ?? [])[0] === "*")
2033
+ return null;
2034
+ s.outFields = this._queryParams.outFields;
2035
+ } else {
2036
+ const r = new Set(this._queryParams.outFields), i = [];
2037
+ for (const n of r)
2038
+ t.hasField(n) || i.push(n);
2039
+ if (i.length === 0)
2040
+ return null;
2041
+ s.outFields = i;
2042
+ }
2043
+ return s.returnGeometry = !1, s.returnCentroid = !1, s.quantizationParameters = null, s.cacheHint = !0, { inner: s, customParameters: this._customParameters };
2044
+ }
2045
+ createQuery(e = {}) {
2046
+ if (!this._queryParams)
2047
+ throw new Error("InternalError: queryInfo should be defined");
2048
+ return { inner: new ct({ ...this._queryParams, ...e }), customParameters: this._customParameters };
2049
+ }
2050
+ createTileQuery(e, t) {
2051
+ if (this._capabilities == null)
2052
+ throw new Error("InternalError: Service does not support tile queries");
2053
+ const s = this.createQuery(t), r = s.inner;
2054
+ return r.quantizationParameters = t.quantizationParameters ?? e.getQuantizationParameters(), r.resultType = "tile", r.geometry = e.extent, this._capabilities.query.supportsQuantization ? this._geometryType === "esriGeometryPolyline" && (r.maxAllowableOffset = e.resolution * y("feature-polyline-generalization-factor")) : this._geometryType !== "esriGeometryPolyline" && this._geometryType !== "esriGeometryPolygon" || (r.maxAllowableOffset = e.resolution, this._geometryType === "esriGeometryPolyline" && (r.maxAllowableOffset *= y("feature-polyline-generalization-factor"))), r.defaultSpatialReferenceEnabled = this._capabilities.query.supportsDefaultSpatialReference, r.compactGeometryEnabled = this._capabilities.query.supportsCompactGeometry, this._capabilities.query.supportsMaxRecordCountFactor && (r.maxRecordCountFactor = ce), s;
2055
+ }
2056
+ createPagedTileQuery(e, t) {
2057
+ const s = this.pageSize;
2058
+ return this.createTileQuery(e, { start: s * t, num: s, returnExceededLimitFeatures: !0 });
2059
+ }
2060
+ createPagedQuery(e) {
2061
+ const t = this.pageSize;
2062
+ return this.createQuery({ start: t * e, num: t, returnExceededLimitFeatures: !0, maxRecordCountFactor: ce });
2063
+ }
2064
+ };
2065
+ const vr = 2500;
2066
+ let te = class extends _t {
2067
+ constructor(e) {
2068
+ super(), this._connection = e, this._enabledEventTypes = /* @__PURE__ */ new Set(), this._updateInfo = { websocket: 0, client: 0 }, this._lastTime = performance.now(), this.addHandles([pe(() => {
2069
+ var t;
2070
+ return ((t = this._strategy) == null ? void 0 : t.connectionStatus) ?? "disconnected";
2071
+ }, (t) => {
2072
+ this._layerView.setProperty({ propertyName: "pipelineConnectionStatus", value: t });
2073
+ }, { initial: !0 }), pe(() => {
2074
+ var t;
2075
+ return ((t = this._strategy) == null ? void 0 : t.errorString) || null;
2076
+ }, (t) => this._layerView.setProperty({ propertyName: "pipelineErrorString", value: t }), { initial: !0 })]);
2077
+ }
2078
+ destroy() {
2079
+ this._strategy = null, this.removeAllHandles();
2080
+ }
2081
+ get _layerView() {
2082
+ return this._connection.layerView;
2083
+ }
2084
+ set strategy(e) {
2085
+ this._strategy == null && this._resetUpdateInfo(performance.now());
2086
+ const t = "event-handles";
2087
+ this.removeHandles(t), e != null && this.addHandles([e.events.on("data-received", (s) => this._onFeature(s)), e.events.on("message-received", (s) => this._onWebSocketMessage(s)), e.events.on("features-updated", (s) => this._onUpdate(s)), e.events.on("tick", () => this._onTick())], t), this._strategy = e;
2088
+ }
2089
+ updateCustomParameters(e) {
2090
+ var t;
2091
+ e != null && ((t = this._strategy) == null || t.updateCustomParameters(e));
2092
+ }
2093
+ sendMessageToSocket(e) {
2094
+ var t;
2095
+ (t = this._strategy) == null || t.sendMessageToSocket(e);
2096
+ }
2097
+ sendMessageToClient(e) {
2098
+ var t;
2099
+ (t = this._strategy) == null || t.sendMessageToClient(e);
2100
+ }
2101
+ enableEvent(e, t) {
2102
+ t ? this._enabledEventTypes.add(e) : this._enabledEventTypes.delete(e);
2103
+ }
2104
+ disconnect() {
2105
+ var e;
2106
+ (e = this._strategy) == null || e.disconnect();
2107
+ }
2108
+ connect() {
2109
+ var e;
2110
+ (e = this._strategy) == null || e.connect();
2111
+ }
2112
+ clear() {
2113
+ var e;
2114
+ (e = this._strategy) == null || e.clear();
2115
+ }
2116
+ _onWebSocketMessage(e) {
2117
+ this._enabledEventTypes.has("message-received") && this._layerView.emitEvent({ name: "message-received", event: e });
2118
+ }
2119
+ _onFeature(e) {
2120
+ this._updateInfo.websocket++, this._enabledEventTypes.has("data-received") && this._layerView.emitEvent({ name: "data-received", event: { attributes: e.attributes, centroid: e.centroid, geometry: e.geometry } });
2121
+ }
2122
+ _onUpdate(e) {
2123
+ this._updateInfo.client += e;
2124
+ }
2125
+ _onTick() {
2126
+ const e = performance.now(), t = e - this._lastTime;
2127
+ if (t > vr) {
2128
+ const s = Math.round(this._updateInfo.client / (t / 1e3)), r = Math.round(this._updateInfo.websocket / (t / 1e3));
2129
+ this._resetUpdateInfo(e), this._layerView.emitEvent({ name: "update-rate", event: { client: s, websocket: r } });
2130
+ }
2131
+ }
2132
+ _resetUpdateInfo(e) {
2133
+ this._lastTime = e, this._updateInfo.client = 0, this._updateInfo.websocket = 0;
2134
+ }
2135
+ };
2136
+ G([K()], te.prototype, "_strategy", void 0), te = G([lt("esri.views.2d.layers.features.sources.StreamMessenger")], te);
2137
+ let Yt = class {
2138
+ constructor(e) {
2139
+ this._store = e, this._controller = new AbortController();
2140
+ }
2141
+ destroy() {
2142
+ this._controller.abort();
2143
+ }
2144
+ get _options() {
2145
+ return { signal: this._controller.signal };
2146
+ }
2147
+ async queryOverride(e) {
2148
+ throw new Error("InternalError: LoadStrategy does not support fetching");
2149
+ }
2150
+ };
2151
+ const le = 268435455;
2152
+ let Sr = class {
2153
+ constructor() {
2154
+ this.hasFeatures = !1, this.exceededTransferLimit = !1, this.fieldCount = 0, this.featureCount = 0, this.objectIdFieldIndex = 0, this.vertexCount = 0, this.offsets = { attributes: new Array(), geometry: new Array() }, this.centroid = new Array();
2155
+ }
2156
+ };
2157
+ function wr(u, e, t = !1) {
2158
+ var $;
2159
+ const h = u.asUnsafe(), c = h.pos(), d = new Sr();
2160
+ let l = 0, g = 0;
2161
+ const _ = 1, m = 2, p = 4, I = 3;
2162
+ let f = null, k = null, b = null, v = !1;
2163
+ const S = [];
2164
+ for (; h.next(); )
2165
+ switch (h.tag()) {
2166
+ case 1:
2167
+ f = h.getString();
2168
+ break;
2169
+ case 3:
2170
+ k = h.getString();
2171
+ break;
2172
+ case 12:
2173
+ b = h.processMessage(js);
2174
+ break;
2175
+ case 9:
2176
+ if (d.exceededTransferLimit = h.getBool(), d.exceededTransferLimit) {
2177
+ d.offsets.geometry = t ? new Float64Array(8e3) : new Int32Array(8e3), d.centroid = t ? new Float64Array(16e3) : new Int32Array(16e3);
2178
+ for (let F = 0; F < d.centroid.length; F++)
2179
+ d.centroid[F] = le;
2180
+ }
2181
+ break;
2182
+ case 13: {
2183
+ const F = h.processMessage(Ps);
2184
+ F.index = l++, S.push(F);
2185
+ break;
2186
+ }
2187
+ case 15: {
2188
+ const F = h.getLength(), O = h.pos() + F;
2189
+ if (!d.exceededTransferLimit) {
2190
+ const C = d.offsets.geometry, q = d.centroid;
2191
+ C.push(0), q.push(le), q.push(le);
2192
+ }
2193
+ !v && d.exceededTransferLimit && (v = !0, d.offsets.attributes = t ? new Float64Array(8e3 * l) : new Uint32Array(8e3 * l));
2194
+ let R = g * l;
2195
+ for (; h.pos() < O && h.next(); )
2196
+ switch (h.tag()) {
2197
+ case _: {
2198
+ v ? d.offsets.attributes[R++] = h.pos() : d.offsets.attributes.push(h.pos());
2199
+ const C = h.getLength();
2200
+ h.skipLen(C);
2201
+ break;
2202
+ }
2203
+ case m:
2204
+ if (e) {
2205
+ const C = h.getLength(), q = h.pos() + C;
2206
+ for (; h.pos() < q && h.next(); )
2207
+ switch (h.tag()) {
2208
+ case I: {
2209
+ h.getUInt32();
2210
+ const E = h.getSInt64(), P = h.getSInt64();
2211
+ d.centroid[2 * g] = E, d.centroid[2 * g + 1] = P;
2212
+ break;
2213
+ }
2214
+ default:
2215
+ h.skip();
2216
+ }
2217
+ } else {
2218
+ d.offsets.geometry[g] = h.pos();
2219
+ const C = h.getLength();
2220
+ d.vertexCount += C, h.skipLen(C);
2221
+ }
2222
+ break;
2223
+ case p: {
2224
+ const C = h.getLength(), q = h.pos() + C;
2225
+ for (; h.pos() < q && h.next(); )
2226
+ switch (h.tag()) {
2227
+ case I: {
2228
+ h.getUInt32();
2229
+ const E = h.getSInt64(), P = h.getSInt64();
2230
+ d.centroid[2 * g] = E, d.centroid[2 * g + 1] = P;
2231
+ break;
2232
+ }
2233
+ default:
2234
+ h.skip();
2235
+ }
2236
+ break;
2237
+ }
2238
+ default:
2239
+ h.skip();
2240
+ }
2241
+ g++, d.hasFeatures = !0;
2242
+ break;
2243
+ }
2244
+ default:
2245
+ h.skip();
2246
+ }
2247
+ const w = f || k;
2248
+ if (!w)
2249
+ throw new D("FeatureSet has no objectId or globalId field name");
2250
+ return d.fields = new St(S), d.featureCount = g, d.fieldCount = l, d.objectIdFieldIndex = ($ = d.fields.get(w)) == null ? void 0 : $.index, d.transform = b, d.displayIds = new Uint32Array(d.featureCount), d.groupIds = new Uint16Array(d.featureCount), h.move(c), d;
2251
+ }
2252
+ const xr = !0, Ke = 268435455, et = 128, tt = 128e3, z = { small: { delta: new Int32Array(et), decoded: new Int32Array(et) }, large: { delta: new Int32Array(tt), decoded: new Int32Array(tt) } };
2253
+ function st(u) {
2254
+ return u <= z.small.delta.length ? z.small : (u <= z.large.delta.length || (z.large.delta = new Int32Array(Math.round(1.25 * u)), z.large.decoded = new Int32Array(Math.round(1.25 * u))), z.large);
2255
+ }
2256
+ function kr(u) {
2257
+ try {
2258
+ const t = new Es(new Uint8Array(u), new DataView(u));
2259
+ for (; t.next(); ) {
2260
+ if (t.tag() === 2)
2261
+ return Fr(t.getMessage());
2262
+ t.skip();
2263
+ }
2264
+ } catch (e) {
2265
+ const t = new D("query:parsing-pbf", "Error while parsing FeatureSet PBF payload", { error: e });
2266
+ rs.getLogger("esri.view.2d.layers.features.support.FeatureSetReaderPBF").error(t);
2267
+ }
2268
+ return null;
2269
+ }
2270
+ function Fr(u) {
2271
+ for (; u.next(); ) {
2272
+ if (u.tag() === 1)
2273
+ return u.getMessage();
2274
+ u.skip();
2275
+ }
2276
+ return null;
2277
+ }
2278
+ function Tr(u) {
2279
+ const c = u.getLength(), d = u.pos() + c;
2280
+ for (; u.pos() < d && u.next(); )
2281
+ switch (u.tag()) {
2282
+ case 1:
2283
+ return u.getString();
2284
+ case 2:
2285
+ return u.getFloat();
2286
+ case 3:
2287
+ return u.getDouble();
2288
+ case 4:
2289
+ return u.getSInt32();
2290
+ case 5:
2291
+ return u.getUInt32();
2292
+ case 6:
2293
+ return u.getInt64();
2294
+ case 7:
2295
+ return u.getUInt64();
2296
+ case 8:
2297
+ return u.getSInt64();
2298
+ case 9:
2299
+ return u.getBool();
2300
+ default:
2301
+ return u.skip(), null;
2302
+ }
2303
+ return null;
2304
+ }
2305
+ function Cr(u, e, t, s, r, i) {
2306
+ return 0.5 * Math.abs(u * s + t * i + r * e - u * i - t * e - r * s);
2307
+ }
2308
+ function _e(u, e, t, s) {
2309
+ return u * s - t * e === 0 && u * t + e * s > 0;
2310
+ }
2311
+ let Mr = class Se extends Ce {
2312
+ static fromBuffer(e, t, s = !1) {
2313
+ const r = t.geometryType, i = kr(e), n = wr(i, r === "esriGeometryPoint", s);
2314
+ return new Se(i, n, t);
2315
+ }
2316
+ constructor(e, t, s) {
2317
+ super(s), this._hasNext = !1, this._isPoints = !1, this._featureIndex = -1, this._featureOffset = 0, this._cache = { area: 0, unquantGeometry: void 0, geometry: void 0, centroid: void 0, legacyFeature: void 0, optFeature: void 0 }, this._parseCaches = new Array(), this._geometryType = s.geometryType, this._reader = e, this._header = t, this._hasNext = t.hasFeatures, this._isPoints = s.geometryType === "esriGeometryPoint";
2318
+ }
2319
+ get _size() {
2320
+ return this._header.featureCount;
2321
+ }
2322
+ get fields() {
2323
+ return this._header.fields;
2324
+ }
2325
+ get geometryType() {
2326
+ return this._geometryType;
2327
+ }
2328
+ get hasZ() {
2329
+ return !1;
2330
+ }
2331
+ get hasM() {
2332
+ return !1;
2333
+ }
2334
+ get hasFeatures() {
2335
+ return this._header.hasFeatures;
2336
+ }
2337
+ get hasNext() {
2338
+ return this._hasNext;
2339
+ }
2340
+ get exceededTransferLimit() {
2341
+ return this._header.exceededTransferLimit;
2342
+ }
2343
+ getSize() {
2344
+ return this._size;
2345
+ }
2346
+ getInTransform() {
2347
+ return this._header.transform;
2348
+ }
2349
+ getCursor() {
2350
+ return this.copy();
2351
+ }
2352
+ getIndex() {
2353
+ return this._featureIndex;
2354
+ }
2355
+ setIndex(e) {
2356
+ this._cache.area = 0, this._cache.unquantGeometry = void 0, this._cache.geometry = void 0, this._cache.centroid = void 0, this._cache.legacyFeature = void 0, this._cache.optFeature = void 0, this._featureIndex = e;
2357
+ }
2358
+ getAttributeHash() {
2359
+ let e = "";
2360
+ for (const t of this._header.fields.fields)
2361
+ e += this._readAttributeAtIndex(t.index) + ".";
2362
+ return e;
2363
+ }
2364
+ getObjectId() {
2365
+ return this._readAttributeAtIndex(this._header.objectIdFieldIndex);
2366
+ }
2367
+ getDisplayId() {
2368
+ return this._header.displayIds[this._featureIndex];
2369
+ }
2370
+ setDisplayId(e) {
2371
+ this._header.displayIds[this._featureIndex] = e;
2372
+ }
2373
+ readGeometryArea() {
2374
+ return this._cache.area || this._readGeometry(!0), this._cache.area;
2375
+ }
2376
+ copy() {
2377
+ const e = this._reader.clone(), t = new Se(e, this._header, this.metadata);
2378
+ return this.copyInto(t), t;
2379
+ }
2380
+ next() {
2381
+ for (this._cache.area = 0, this._cache.unquantGeometry = void 0, this._cache.geometry = void 0, this._cache.centroid = void 0, this._cache.legacyFeature = void 0, this._cache.optFeature = void 0; ++this._featureIndex < this._size && !this._getExists(); )
2382
+ ;
2383
+ return this._featureIndex < this._size;
2384
+ }
2385
+ _readX() {
2386
+ return this._header.centroid[2 * this._featureIndex];
2387
+ }
2388
+ _readY() {
2389
+ return this._header.centroid[2 * this._featureIndex + 1];
2390
+ }
2391
+ _readServerCentroid() {
2392
+ const e = this._header.centroid[2 * this._featureIndex], t = this._header.centroid[2 * this._featureIndex + 1];
2393
+ return e === Ke ? null : new T([], [e, t]);
2394
+ }
2395
+ _readGeometry(e = !1) {
2396
+ if (this._cache.geometry === void 0) {
2397
+ let t = null;
2398
+ if (this._isPoints) {
2399
+ if (this._header.centroid[2 * this._featureIndex] === Ke)
2400
+ return null;
2401
+ const s = this._header.centroid[2 * this._featureIndex], r = this._header.centroid[2 * this._featureIndex + 1];
2402
+ t = new T([], [s, r]);
2403
+ } else {
2404
+ const s = this._header.offsets.geometry[this._featureIndex], r = this._reader;
2405
+ if (s === 0)
2406
+ return null;
2407
+ r.move(s);
2408
+ try {
2409
+ t = e ? this._parseGeometryForDisplay(r) : this._parseGeometry(r);
2410
+ } catch (i) {
2411
+ return console.error("Failed to parse geometry!", i), null;
2412
+ }
2413
+ }
2414
+ return (t == null ? void 0 : t.coords.length) === 0 && (t = null), this._cache.geometry = t, t;
2415
+ }
2416
+ return this._cache.geometry;
2417
+ }
2418
+ _readAttribute(e, t) {
2419
+ var n;
2420
+ const s = this._header.fields.get(e);
2421
+ if (s == null)
2422
+ return;
2423
+ let r = this._readAttributeAtIndex(s.index);
2424
+ ((n = this.fields.get(e)) == null ? void 0 : n.type) === "esriFieldTypeTimestampOffset" && (r = this.parseTimestampOffset(r));
2425
+ const i = this._header.fields.isDateField(s.name);
2426
+ return t ? r == null ? r : i ? new Date(r) : r : r;
2427
+ }
2428
+ _readAttributes() {
2429
+ const e = {};
2430
+ for (const t of this._header.fields.fields)
2431
+ e[t.name] = this._readAttributeAtIndex(t.index);
2432
+ return e;
2433
+ }
2434
+ copyInto(e) {
2435
+ super.copyInto(e), e._featureIndex = this._featureIndex, e._featureOffset = this._featureOffset, e._hasNext = this._hasNext, e._parseCaches = this._parseCaches;
2436
+ }
2437
+ _readAttributeAtIndex(e) {
2438
+ let t = this._parseCaches[e];
2439
+ if (t || (t = new fs(this.getSize()), this._parseCaches[e] = t), t.has(this._featureIndex))
2440
+ return t.get(this._featureIndex);
2441
+ const s = this._header.offsets.attributes[this._featureIndex * this._header.fieldCount + e], r = this._reader;
2442
+ r.move(s);
2443
+ const i = Tr(r);
2444
+ return t.set(this._featureIndex, i), i;
2445
+ }
2446
+ _readGeometryDeltaDecoded(e = !1) {
2447
+ if (this._cache.unquantGeometry === void 0) {
2448
+ const t = this._readGeometry(e);
2449
+ if (!t)
2450
+ return this._cache.unquantGeometry = void 0, null;
2451
+ if (!this.getInTransform())
2452
+ return this._cache.unquantGeometry = t, t;
2453
+ const s = st(t.coords.length).decoded, r = t.clone(s), i = r.coords;
2454
+ let n = 0;
2455
+ for (const a of r.lengths) {
2456
+ for (let o = 1; o < a; o++) {
2457
+ const h = 2 * (n + o), c = 2 * (n + o - 1);
2458
+ i[h] += i[c], i[h + 1] += i[c + 1];
2459
+ }
2460
+ n += a;
2461
+ }
2462
+ return this._cache.unquantGeometry = r, r;
2463
+ }
2464
+ return this._cache.unquantGeometry;
2465
+ }
2466
+ _parseGeometry(e) {
2467
+ const r = e.asUnsafe(), i = r.getLength(), n = r.pos() + i, a = [], o = [];
2468
+ for (; r.pos() < n && r.next(); )
2469
+ switch (r.tag()) {
2470
+ case 2: {
2471
+ const h = r.getUInt32(), c = r.pos() + h;
2472
+ for (; r.pos() < c; )
2473
+ o.push(r.getUInt32());
2474
+ break;
2475
+ }
2476
+ case 3: {
2477
+ const h = r.getUInt32(), c = r.pos() + h;
2478
+ for (a.push(r.getSInt64()), a.push(r.getSInt64()), this.hasZ && r.getSInt64(), this.hasM && r.getSInt64(); r.pos() < c; )
2479
+ a.push(r.getSInt64()), a.push(r.getSInt64()), this.hasZ && r.getSInt64(), this.hasM && r.getSInt64();
2480
+ break;
2481
+ }
2482
+ default:
2483
+ r.skip();
2484
+ }
2485
+ return new T(o, a);
2486
+ }
2487
+ _parseGeometryForDisplay(e) {
2488
+ const r = e.asUnsafe(), i = r.getLength(), n = r.pos() + i, a = [], o = [];
2489
+ let h = 0, c = 0, d = null, l = 0;
2490
+ const g = this.geometryType === "esriGeometryPolygon";
2491
+ for (; r.pos() < n && r.next(); )
2492
+ switch (r.tag()) {
2493
+ case 2: {
2494
+ const _ = r.getUInt32(), m = r.pos() + _;
2495
+ for (; r.pos() < m; ) {
2496
+ const p = r.getUInt32();
2497
+ a.push(p), h += p;
2498
+ }
2499
+ d = st(2 * h).delta;
2500
+ break;
2501
+ }
2502
+ case 3: {
2503
+ r.getUInt32();
2504
+ const _ = 2 + (this.hasZ ? 1 : 0) + (this.hasM ? 1 : 0);
2505
+ ss(d);
2506
+ for (const m of a)
2507
+ if (c + _ * m > d.length)
2508
+ for (let p = 0; p < m; p++)
2509
+ r.getSInt32(), r.getSInt32(), this.hasZ && r.getSInt32(), this.hasM && r.getSInt32();
2510
+ else if (g && xr) {
2511
+ const p = this.getAreaSimplificationThreshold(m, this._header.vertexCount);
2512
+ let I = 2, f = 1;
2513
+ const k = !1;
2514
+ let b = r.getSInt32(), v = r.getSInt32();
2515
+ d[c++] = b, d[c++] = v, this.hasZ && r.getSInt32(), this.hasM && r.getSInt32();
2516
+ let S = r.getSInt32(), w = r.getSInt32();
2517
+ for (this.hasZ && r.getSInt32(), this.hasM && r.getSInt32(); I < m; ) {
2518
+ let $ = r.getSInt32(), F = r.getSInt32();
2519
+ this.hasZ && r.getSInt32(), this.hasM && r.getSInt32();
2520
+ const O = b + S, R = v + w;
2521
+ Cr(b, v, O, R, O + $, R + F) >= p ? (l += -0.5 * (O - b) * (R + v), f > 1 && _e(d[c - 2], d[c - 1], S, w) ? (d[c - 2] += S, d[c - 1] += w) : (d[c++] = S, d[c++] = w, f++), b = O, v = R) : ($ += S, F += w), S = $, w = F, I++;
2522
+ }
2523
+ f < 3 || k ? c -= 2 * f : (l += -0.5 * (b + S - b) * (v + w + v), _e(d[c - 2], d[c - 1], S, w) ? (d[c - 2] += S, d[c - 1] += w, o.push(f)) : (d[c++] = S, d[c++] = w, o.push(++f)));
2524
+ } else {
2525
+ let p = 0, I = r.getSInt32(), f = r.getSInt32();
2526
+ this.hasZ && r.getSInt32(), this.hasM && r.getSInt32(), d[c++] = I, d[c++] = f, p += 1;
2527
+ for (let k = 1; k < m; k++) {
2528
+ const b = r.getSInt32(), v = r.getSInt32(), S = I + b, w = f + v;
2529
+ l += -0.5 * (S - I) * (w + f), this.hasZ && r.getSInt32(), this.hasM && r.getSInt32(), k > 2 && _e(d[c - 2], d[c - 1], b, v) ? (d[c - 2] += b, d[c - 1] += v) : (d[c++] = b, d[c++] = v, p += 1), I = S, f = w;
2530
+ }
2531
+ o.push(p);
2532
+ }
2533
+ break;
2534
+ }
2535
+ default:
2536
+ r.skip();
2537
+ }
2538
+ return this._cache.area = l, o.length ? new T(o, d) : null;
2539
+ }
2540
+ };
2541
+ class oe {
2542
+ constructor(e, t) {
2543
+ this.service = e, this._metadata = t;
2544
+ }
2545
+ destroy() {
2546
+ }
2547
+ }
2548
+ function $r(u, e) {
2549
+ switch (u.type) {
2550
+ case "memory":
2551
+ return new qr(u, e);
2552
+ case "ogc":
2553
+ return new Er(u, e);
2554
+ case "feature-service":
2555
+ return u.queryMetadata.capabilities.query.supportsFormatPBF && y("featurelayer-pbf") ? new Ar(u, e) : new Rr(u, e);
2556
+ }
2557
+ }
2558
+ async function Or(u) {
2559
+ const e = new is();
2560
+ return await e.open(u, {}), e;
2561
+ }
2562
+ class qr extends oe {
2563
+ constructor(e, t) {
2564
+ super(e, t), this._portsOpen = Or(e.source).then((s) => this.client = s);
2565
+ }
2566
+ destroy() {
2567
+ this.client.close(), this.client = null;
2568
+ }
2569
+ async executeQuery(e, t) {
2570
+ await this._portsOpen;
2571
+ const s = await this.client.invoke("queryFeatures", e.toJSON(), t);
2572
+ return M.fromFeatureSet(s, this._metadata);
2573
+ }
2574
+ }
2575
+ class Ar extends oe {
2576
+ async executeQuery(e, t) {
2577
+ const { data: s } = await As(this.service.source, e, t), r = !e.quantizationParameters;
2578
+ return Mr.fromBuffer(s, this._metadata, r);
2579
+ }
2580
+ }
2581
+ class Rr extends oe {
2582
+ async executeQuery(e, t) {
2583
+ var a;
2584
+ const { source: s, queryMetadata: r } = this.service, i = r.capabilities;
2585
+ if (e.quantizationParameters != null && !i.query.supportsQuantization) {
2586
+ const o = e.clone(), h = wt(o.quantizationParameters);
2587
+ o.quantizationParameters = null;
2588
+ const { data: c } = await Ne(s, o, this._metadata.spatialReference, t), d = mt(c, this._metadata.objectIdField);
2589
+ return It(h, d), M.fromOptimizedFeatureSet(d, this._metadata);
2590
+ }
2591
+ const { data: n } = await Ne(s, e, this._metadata.spatialReference, t);
2592
+ return this._metadata.geometryType === "esriGeometryPoint" && (n.features = (a = n.features) == null ? void 0 : a.filter((o) => {
2593
+ if (o.geometry != null) {
2594
+ const h = o.geometry;
2595
+ return Number.isFinite(h.x) && Number.isFinite(h.y);
2596
+ }
2597
+ return !0;
2598
+ })), M.fromFeatureSet(n, this._metadata);
2599
+ }
2600
+ }
2601
+ let Er = class extends oe {
2602
+ async executeQuery(e, t) {
2603
+ const { capabilities: s } = this.service.queryMetadata;
2604
+ if (e.quantizationParameters && !s.query.supportsQuantization) {
2605
+ const i = e.clone(), n = wt(i.quantizationParameters);
2606
+ i.quantizationParameters = null;
2607
+ const a = await Be(this.service.source, e, t);
2608
+ return It(n, a), M.fromOptimizedFeatureSet(a, this._metadata);
2609
+ }
2610
+ const r = await Be(this.service.source, e, t);
2611
+ return M.fromOptimizedFeatureSet(r, this._metadata);
2612
+ }
2613
+ }, Xt = class extends Yt {
2614
+ constructor(e, t, s, r, i) {
2615
+ super(s), this._serviceInfo = e, this._queryInfo = t, this._metadata = r, this._eventLog = i, this._queue = new ht({ concurrency: 16, process: async (n) => {
2616
+ var o;
2617
+ const a = { signal: (o = n.options) == null ? void 0 : o.signal, query: n.query.customParameters };
2618
+ return this._adapter.executeQuery(n.query.inner, a);
2619
+ } }), this._adapter = $r(e, r);
2620
+ }
2621
+ async updateFields(e) {
2622
+ this._queryInfo.updateFields(e);
2623
+ const t = Array.from(this._store.chunks()).map(async (r) => {
2624
+ const i = ct.fromJSON(r.queryInfo.queryJSON);
2625
+ if (i)
2626
+ try {
2627
+ return await this._tryUpdateFields(r.reader, i), null;
2628
+ } catch (n) {
2629
+ return n;
2630
+ }
2631
+ }), s = (await Promise.all(t)).filter((r) => r);
2632
+ if (s.length)
2633
+ throw new D("featurelayer-query", "Encountered errors when downloading fields", { errors: s });
2634
+ }
2635
+ async queryOverride({ edits: e }) {
2636
+ const t = [], s = [];
2637
+ for (const n of e.removed)
2638
+ n.objectId != null && n.objectId !== -1 ? t.push(n.objectId) : s.push(n.globalId);
2639
+ s.length && t.push(...this._mapGlobalIdsToObjectIds(s));
2640
+ const r = e.addOrModified.map(({ objectId: n }) => n);
2641
+ let i;
2642
+ if (r.length) {
2643
+ const n = this._queryInfo.createQuery({ objectIds: r });
2644
+ i = await this._fetch(n);
2645
+ } else
2646
+ i = M.empty(this._metadata);
2647
+ return { reader: i, removed: t };
2648
+ }
2649
+ _mapGlobalIdsToObjectIds(e) {
2650
+ const t = new Set(e), s = this._metadata.globalIdField;
2651
+ if (s == null)
2652
+ throw new Error("InternalError: Recieved an edit with globalIds, but not supported by the service");
2653
+ const r = [];
2654
+ return this._store.forEachUnsafe((i) => {
2655
+ const n = i.readAttribute(s);
2656
+ t.has(n) && r.push(i.getObjectId());
2657
+ }), r;
2658
+ }
2659
+ async _fetch(e, t) {
2660
+ const s = await this._enqueue(e, t);
2661
+ return await this._tryUpdateFields(s, e.inner), s;
2662
+ }
2663
+ async _tryUpdateFields(e, t) {
2664
+ const s = this._queryInfo.createPatchFieldsQuery(t, e);
2665
+ if (!s)
2666
+ return;
2667
+ const r = await this._enqueue(s, this._options);
2668
+ e.joinAttributes(r);
2669
+ }
2670
+ async _enqueue(e, t) {
2671
+ return this._eventLog.onEvent({ type: "fetchStart" }), this._queue.push({ query: e, options: t }).finally(() => {
2672
+ this._eventLog.onEvent({ type: "fetchEnd", done: this._queue.length === 0 });
2673
+ });
2674
+ }
2675
+ }, Qt = class extends Xt {
2676
+ constructor() {
2677
+ super(...arguments), this._chunksById = /* @__PURE__ */ new Map();
2678
+ }
2679
+ unload(e) {
2680
+ this._removeChunks(e.tile);
2681
+ }
2682
+ _addChunk(e) {
2683
+ const t = e.tile.id;
2684
+ this._chunksById.has(t) || this._chunksById.set(t, []);
2685
+ const s = e.size();
2686
+ (s || e.first || e.end) && (y("esri-2d-update-debug") && console.debug(`Chunk[${e.chunkId}] ATileLoadStrategy.addChunk [count=${s}]`), this._chunksById.get(t).push(e), this._store.insert(e));
2687
+ }
2688
+ _removeChunks(e) {
2689
+ const t = this._chunksById.get(e.key.id) ?? [];
2690
+ for (const s of t)
2691
+ y("esri-2d-update-debug") && console.debug(`Tile[${e.key.id}] Chunk[${s.chunkId}] ATileLoadStrategy.removeChunk`), this._store.remove(s);
2692
+ this._chunksById.delete(e.key.id);
2693
+ }
2694
+ }, rt = class extends Z {
2695
+ constructor(e, t, s, r, i, n) {
2696
+ var a, o;
2697
+ super(), this._reader = e, this._queryJSON = t, this._tile = s, this._sourceTile = r, this._sourceTileDepth = i, this._end = n, this.chunkId = `${this._tile.key.id}.${(a = this._sourceTile) == null ? void 0 : a.key.id}${this._end ? "e" : ""}`, this.normalizedChunkId = `${this._tile.key.normalizedId}.${(o = this._sourceTile) == null ? void 0 : o.key.normalizedId}${this._end ? "e" : ""}`;
2698
+ }
2699
+ get queryInfo() {
2700
+ var e;
2701
+ return { type: "drill-down-tile", chunkId: this.chunkId, tileId: this._tile.key.id, queryJSON: this._queryJSON, sourceTileDepth: this._sourceTileDepth, sourceTileId: (e = this._sourceTile) == null ? void 0 : e.key.id, size: this.size(), end: this.end };
2702
+ }
2703
+ get first() {
2704
+ return this._sourceTileDepth === 0;
2705
+ }
2706
+ get reader() {
2707
+ return this._reader;
2708
+ }
2709
+ get end() {
2710
+ return this._end;
2711
+ }
2712
+ get tile() {
2713
+ return this._tile;
2714
+ }
2715
+ get isTiled() {
2716
+ return !0;
2717
+ }
2718
+ getTileReader(e) {
2719
+ return this._tile.key.id === e.key.id ? this.reader : null;
2720
+ }
2721
+ }, Pr = class {
2722
+ constructor(e, t) {
2723
+ this.subscription = e, this._tileIdToResult = /* @__PURE__ */ new Map(), this._controller = new AbortController(), se(e.options, () => this._controller.abort()), se(t, () => this._controller.abort());
2724
+ }
2725
+ get(e) {
2726
+ return this._tileIdToResult.get(e);
2727
+ }
2728
+ set(e, t) {
2729
+ this._tileIdToResult.set(e, t);
2730
+ }
2731
+ get options() {
2732
+ return { signal: this._controller.signal };
2733
+ }
2734
+ }, jr = class extends Qt {
2735
+ constructor() {
2736
+ super(...arguments), this._loadStates = /* @__PURE__ */ new Map();
2737
+ }
2738
+ get about() {
2739
+ return { willQueryAllFeatures: !1, willQueryFullResolutionGeometry: !1 };
2740
+ }
2741
+ async load(e) {
2742
+ this._loadStates.has(e.key.id) || this._loadStates.set(e.key.id, new Pr(e, this._options));
2743
+ const t = this._loadStates.get(e.key.id);
2744
+ let s;
2745
+ try {
2746
+ for await (const i of this._fetchChunkInfos(t, e.tile, 0)) {
2747
+ const { queryJSON: n, reader: a, sourceTile: o, sourceTileDepth: h, tile: c } = i, d = new rt(a, n, c, o, h, !1);
2748
+ Y(e.options), this._addChunk(d);
2749
+ }
2750
+ } catch (i) {
2751
+ s = i;
2752
+ }
2753
+ const r = new rt(M.empty(this._metadata), null, e.tile, null, -1, !0);
2754
+ if (this._addChunk(r), s)
2755
+ throw s;
2756
+ }
2757
+ unload(e) {
2758
+ super.unload(e), this._loadStates.delete(e.key.id);
2759
+ }
2760
+ async *_fetchChunkInfos(e, t, s) {
2761
+ let r = e.get(t.id);
2762
+ const i = !!r;
2763
+ if (r || (r = await this._fetchChunkInfo(e, t, s), e.set(t.id, r)), r.reader.exceededTransferLimit && s < y("featurelayer-query-max-depth"))
2764
+ for (const n of t.createChildTiles())
2765
+ yield* this._fetchChunkInfos(e, n, s + 1);
2766
+ else
2767
+ i || (yield r);
2768
+ }
2769
+ async _fetchChunkInfo(e, t, s) {
2770
+ const r = e.subscription.tile.getQuantizationParameters(), i = this._queryInfo.createTileQuery(t, { returnExceededLimitFeatures: !1, quantizationParameters: r });
2771
+ return { reader: await this._fetch(i, e.subscription.options), queryJSON: i.inner.toJSON(), tile: e.subscription.tile, sourceTile: t, sourceTileDepth: s };
2772
+ }
2773
+ }, it = class extends Z {
2774
+ constructor(e, t, s, r, i) {
2775
+ super(), this._reader = e, this._queryJSON = t, this._tile = s, this._page = r, this._end = i, this.chunkId = `${this._tile.key.id}.${this._page}${this.end ? "e" : ""}`, this.normalizedChunkId = `${this._tile.key.normalizedId}.${this._page}${this.end ? "e" : ""}`;
2776
+ }
2777
+ get queryInfo() {
2778
+ return { type: "paged-tile", chunkId: this.chunkId, tileId: this._tile.key.id, queryJSON: this._queryJSON, page: this._page, size: this.size(), end: this.end };
2779
+ }
2780
+ get reader() {
2781
+ return this._reader;
2782
+ }
2783
+ get first() {
2784
+ return this._page === 0;
2785
+ }
2786
+ get end() {
2787
+ return this._end;
2788
+ }
2789
+ get page() {
2790
+ return this._page;
2791
+ }
2792
+ get tile() {
2793
+ return this._tile;
2794
+ }
2795
+ get isTiled() {
2796
+ return !0;
2797
+ }
2798
+ getTileReader(e) {
2799
+ return this._tile.key.id === e.key.id ? this.reader : null;
2800
+ }
2801
+ }, Dr = class {
2802
+ constructor(e, t) {
2803
+ this.subscription = e, this._pages = /* @__PURE__ */ new Set(), this._controller = new AbortController(), this._done = !1, se(e.options, () => this._controller.abort()), se(t, () => this._controller.abort());
2804
+ }
2805
+ resetAbortController() {
2806
+ this._controller = new AbortController();
2807
+ }
2808
+ get pageStart() {
2809
+ let e = -1;
2810
+ for (const t of this._pages.values())
2811
+ e = Math.max(e, t);
2812
+ return e + 1;
2813
+ }
2814
+ get done() {
2815
+ return this._done;
2816
+ }
2817
+ get options() {
2818
+ return { signal: this._controller.signal };
2819
+ }
2820
+ add(e, t) {
2821
+ this._pages.add(e), this._done = this._done || t;
2822
+ }
2823
+ }, Lr = class extends Qt {
2824
+ constructor() {
2825
+ super(...arguments), this._loadStates = /* @__PURE__ */ new Map();
2826
+ }
2827
+ get about() {
2828
+ return { willQueryAllFeatures: !1, willQueryFullResolutionGeometry: !1 };
2829
+ }
2830
+ async load(e) {
2831
+ this._loadStates.has(e.key.id) || this._loadStates.set(e.key.id, new Dr(e, this._options));
2832
+ const t = this._loadStates.get(e.key.id);
2833
+ let s;
2834
+ t.resetAbortController();
2835
+ try {
2836
+ await this._fetchPages(t);
2837
+ } catch (i) {
2838
+ s = i;
2839
+ }
2840
+ const r = new it(M.empty(this._metadata), null, e.tile, -1, !0);
2841
+ if (ns(t.options) || this._addChunk(r), s)
2842
+ throw s;
2843
+ }
2844
+ unload(e) {
2845
+ super.unload(e), this._loadStates.delete(e.key.id);
2846
+ }
2847
+ async _fetchPages(e) {
2848
+ let r = 0, i = e.pageStart, n = 1;
2849
+ for (; r < 20 && !e.done; ) {
2850
+ const a = [];
2851
+ for (let h = 0; h < n; h++)
2852
+ a.push(this._fetchChunk(e, i++));
2853
+ const o = await Promise.all(a);
2854
+ for (const h of o)
2855
+ (h.size() !== 0 || h.first) && (e.add(h.page, !h.reader.exceededTransferLimit), Y(e.options), this._addChunk(h));
2856
+ r++, n = Math.min(n + 1, 4);
2857
+ }
2858
+ }
2859
+ async _fetchChunk(e, t) {
2860
+ const s = e.subscription.tile, r = this._queryInfo.createPagedTileQuery(s, t), i = await this._fetch(r, e.options);
2861
+ return new it(i, r.inner.toJSON(), s, t, !1);
2862
+ }
2863
+ }, nt = class extends Z {
2864
+ constructor(e, t, s, r) {
2865
+ super(), this._reader = e, this._queryJSON = t, this._page = s, this._end = r, this.chunkId = `${this._page}${this.end ? "e" : ""}`, this.normalizedChunkId = this.chunkId;
2866
+ }
2867
+ get reader() {
2868
+ return this._reader;
2869
+ }
2870
+ get first() {
2871
+ return this._page === 0;
2872
+ }
2873
+ get end() {
2874
+ return this._end;
2875
+ }
2876
+ get queryInfo() {
2877
+ return { type: "snapshot", chunkId: this.chunkId, queryJSON: this._queryJSON, page: this._page, size: this.size(), end: this.end };
2878
+ }
2879
+ get isTiled() {
2880
+ return !1;
2881
+ }
2882
+ getTileReader(e) {
2883
+ const t = this.queryFeaturesInBounds(e.bounds);
2884
+ return t.setTransformForDisplay(e.transform), t;
2885
+ }
2886
+ };
2887
+ class zr extends Xt {
2888
+ constructor(e, t, s, r, i, n) {
2889
+ super(e, t, s, i, n), this._random = new pt(1e3), this._featureCount = r;
2890
+ }
2891
+ get about() {
2892
+ return { willQueryAllFeatures: !0, willQueryFullResolutionGeometry: !0 };
2893
+ }
2894
+ load(e) {
2895
+ return this._promise == null && (this._promise = this._downloadPages(this._featureCount)), this._promise;
2896
+ }
2897
+ unload(e) {
2898
+ }
2899
+ async _downloadPages(e) {
2900
+ const t = Math.ceil(e / this._queryInfo.pageSize), s = Array.from({ length: t }, (a, o) => o).sort((a, o) => this._random.getInt() - this._random.getInt()), r = await Promise.all(s.map((a) => this._downloadPage(a))), i = new nt(M.empty(this._metadata), null, -1, !0);
2901
+ this._store.insert(i);
2902
+ const n = r.filter((a) => a);
2903
+ if (n.length)
2904
+ throw new D("featurelayer-query", "Encountered errors when downloading data", { errors: n });
2905
+ }
2906
+ async _downloadPage(e) {
2907
+ try {
2908
+ const t = this._queryInfo.createPagedQuery(e), s = await this._fetch(t, this._options), r = new nt(s, t.inner.toJSON(), e, !1);
2909
+ return Y(this._options), this._store.insert(r), null;
2910
+ } catch (t) {
2911
+ return t;
2912
+ }
2913
+ }
2914
+ }
2915
+ const Ur = "__esri_stream_id__", at = "__esri_timestamp__", ot = 1e3;
2916
+ class Gr {
2917
+ constructor(e, t, s, r, i = 128) {
2918
+ this._trackIdToObservations = /* @__PURE__ */ new Map(), this._idCounter = 0, this._lastPurge = performance.now(), this._addOrUpdated = /* @__PURE__ */ new Map(), this._removed = [], this._maxAge = 0, this._timeInfo = s, this._purgeOptions = r, this.store = e, this.objectIdField = t, this.purgeInterval = i, this._useGeneratedIds = this.objectIdField === Ur;
2919
+ }
2920
+ removeById(e) {
2921
+ this._removed.push(e);
2922
+ }
2923
+ removeByTrackId(e) {
2924
+ const t = this._trackIdToObservations.get(e);
2925
+ if (t)
2926
+ for (const s of t.entries)
2927
+ this._removed.push(s);
2928
+ }
2929
+ add(e) {
2930
+ var n;
2931
+ if (this._useGeneratedIds) {
2932
+ const a = this._nextId();
2933
+ e.attributes[this.objectIdField] = a, e.objectId = a;
2934
+ } else
2935
+ e.objectId = e.attributes[this.objectIdField];
2936
+ const t = e.objectId;
2937
+ if (this._addOrUpdated.set(t, e), this._maxAge = Math.max(this._maxAge, e.attributes[this._timeInfo.startTimeField]), !this._timeInfo.trackIdField)
2938
+ return this._trackIdLessObservations == null && (this._trackIdLessObservations = new Ve(1e5)), void this._trackIdLessObservations.enqueue(t);
2939
+ const s = e.attributes[this._timeInfo.trackIdField];
2940
+ if (!this._trackIdToObservations.has(s)) {
2941
+ const a = ((n = this._purgeOptions) == null ? void 0 : n.maxObservations) != null ? this._purgeOptions.maxObservations : ot, o = as(a, 0, ot);
2942
+ this._trackIdToObservations.set(s, new Ve(o));
2943
+ }
2944
+ const r = this._trackIdToObservations.get(s), i = r == null ? void 0 : r.enqueue(t);
2945
+ i != null && (this._addOrUpdated.has(i) ? this._addOrUpdated.delete(i) : this._removed.push(i));
2946
+ }
2947
+ checkForUpdates() {
2948
+ const e = this._getToAdd(), t = this._getToRemove(), s = performance.now();
2949
+ s - this._lastPurge >= this.purgeInterval && (this._purge(s), this._lastPurge = s);
2950
+ const r = [];
2951
+ if (t != null)
2952
+ for (const n of t) {
2953
+ const a = this.store.removeById(n);
2954
+ a != null && r.push(a);
2955
+ }
2956
+ const i = [];
2957
+ if (e != null) {
2958
+ const n = new Set(t ?? []);
2959
+ for (const a of e)
2960
+ n.has(a.objectId) || (a.attributes[at] = s, this.store.add(a), i.push(a));
2961
+ }
2962
+ return !(!i.length && !(r != null && r.length)) && (this.store.update(i, r), !0);
2963
+ }
2964
+ _getToAdd() {
2965
+ if (!this._addOrUpdated.size)
2966
+ return null;
2967
+ const e = new Array(this._addOrUpdated.size);
2968
+ let t = 0;
2969
+ return this._addOrUpdated.forEach((s) => e[t++] = s), this._addOrUpdated.clear(), e;
2970
+ }
2971
+ _getToRemove() {
2972
+ const e = this._removed;
2973
+ return this._removed.length ? (this._removed = [], e) : null;
2974
+ }
2975
+ _nextId() {
2976
+ const e = this._idCounter;
2977
+ return this._idCounter = (this._idCounter + 1) % 4294967294 + 1, e;
2978
+ }
2979
+ _purge(e) {
2980
+ const t = this._purgeOptions;
2981
+ t != null && (this._purgeSomeByDisplayCount(t), this._purgeByAge(t), this._purgeByAgeReceived(e, t), this._purgeTracks());
2982
+ }
2983
+ _purgeSomeByDisplayCount(e) {
2984
+ if (!e.displayCount)
2985
+ return;
2986
+ let t = this.store.size;
2987
+ if (t > e.displayCount) {
2988
+ if (this._timeInfo.trackIdField) {
2989
+ for (const s of this._trackIdToObservations.values())
2990
+ if (t > e.displayCount && s.size) {
2991
+ const r = s.dequeue();
2992
+ this._removed.push(r), t--;
2993
+ }
2994
+ }
2995
+ if (this._trackIdLessObservations != null) {
2996
+ let s = t - e.displayCount;
2997
+ for (; s-- > 0; ) {
2998
+ const r = this._trackIdLessObservations.dequeue();
2999
+ r != null && this._removed.push(r);
3000
+ }
3001
+ }
3002
+ }
3003
+ }
3004
+ _purgeByAge(e) {
3005
+ var i;
3006
+ const t = (i = this._timeInfo) == null ? void 0 : i.startTimeField;
3007
+ if (!e.age || !t)
3008
+ return;
3009
+ const s = 60 * e.age * 1e3, r = this._maxAge - s;
3010
+ this.store.forEach((n) => {
3011
+ n.attributes[t] < r && this._removed.push(n.objectId);
3012
+ });
3013
+ }
3014
+ _purgeByAgeReceived(e, t) {
3015
+ if (!t.ageReceived)
3016
+ return;
3017
+ const s = e - 60 * t.ageReceived * 1e3;
3018
+ this.store.forEach((r) => {
3019
+ r.attributes[at] < s && this._removed.push(r.objectId);
3020
+ });
3021
+ }
3022
+ _purgeTracks() {
3023
+ this._trackIdToObservations.forEach((e, t) => {
3024
+ e.size === 0 && this._trackIdToObservations.delete(t);
3025
+ });
3026
+ }
3027
+ }
3028
+ let U = class extends _t {
3029
+ constructor(u) {
3030
+ super(u);
3031
+ }
3032
+ get connectionStatus() {
3033
+ var u;
3034
+ return (u = this.connection) == null ? void 0 : u.connectionStatus;
3035
+ }
3036
+ get errorString() {
3037
+ var u;
3038
+ return (u = this.connection) == null ? void 0 : u.errorString;
3039
+ }
3040
+ };
3041
+ G([K()], U.prototype, "connection", void 0), G([K()], U.prototype, "connectionStatus", null), G([K()], U.prototype, "errorString", null), U = G([lt("esri.views.2d.layers.features.sources.StreamConnectionState")], U);
3042
+ class Wr {
3043
+ constructor(e, t) {
3044
+ this._metadata = e, this._onUpdate = t, this._objectIdToFeature = /* @__PURE__ */ new Map();
3045
+ }
3046
+ get size() {
3047
+ return this._objectIdToFeature.size;
3048
+ }
3049
+ get reader() {
3050
+ return M.fromFeatures([...this._objectIdToFeature.values()], this._metadata);
3051
+ }
3052
+ add(e) {
3053
+ this._objectIdToFeature.set(e.objectId, e);
3054
+ }
3055
+ forEach(e) {
3056
+ this._objectIdToFeature.forEach(e);
3057
+ }
3058
+ removeById(e) {
3059
+ const t = this._objectIdToFeature.get(e);
3060
+ return t ? (this._objectIdToFeature.delete(e), t) : null;
3061
+ }
3062
+ clear() {
3063
+ this._objectIdToFeature = /* @__PURE__ */ new Map();
3064
+ }
3065
+ update(e, t) {
3066
+ this._onUpdate((e == null ? void 0 : e.length) ?? 0);
3067
+ }
3068
+ }
3069
+ let Nr = class extends Z {
3070
+ constructor(e) {
3071
+ super(), this._reader = e, this.chunkId = "stream-chunk", this.normalizedChunkId = "stream-chunk";
3072
+ }
3073
+ get reader() {
3074
+ return this._reader;
3075
+ }
3076
+ get first() {
3077
+ return !0;
3078
+ }
3079
+ get end() {
3080
+ return !0;
3081
+ }
3082
+ get queryInfo() {
3083
+ return { type: "stream", chunkId: this.chunkId, size: this.size(), end: this.end };
3084
+ }
3085
+ get isTiled() {
3086
+ return !1;
3087
+ }
3088
+ getTileReader(e) {
3089
+ const t = this.queryFeaturesInBounds(e.bounds);
3090
+ return t.setTransformForDisplay(e.transform), t;
3091
+ }
3092
+ };
3093
+ class Br extends Yt {
3094
+ constructor(e, t, s, r, i) {
3095
+ super(s), this._service = e, this._dataFilter = t, this._streamOptions = r, this._metadata = i, this._connectionState = new U(), this._forceRefresh = !1, this.events = new xe();
3096
+ const { objectIdField: n, timeInfo: a } = this._metadata, { purgeOptions: o } = t;
3097
+ this._stagingStore = new Wr(this._metadata, (h) => this.events.emit("features-updated", h)), this._manager = new Gr(this._stagingStore, n, a, o), this.connect();
3098
+ }
3099
+ destroy() {
3100
+ super.destroy(), this.disconnect();
3101
+ }
3102
+ get about() {
3103
+ return { willQueryAllFeatures: !1, willQueryFullResolutionGeometry: !1 };
3104
+ }
3105
+ get connectionStatus() {
3106
+ return this._connectionState.connectionStatus;
3107
+ }
3108
+ get errorString() {
3109
+ var e;
3110
+ return (e = this._connectionState) == null ? void 0 : e.errorString;
3111
+ }
3112
+ async refresh() {
3113
+ const e = this._chunk != null;
3114
+ this._manager.checkForUpdates() || !e || this._forceRefresh ? (this._chunk && this._store.remove(this._chunk), this._forceRefresh = !1, this._chunk = new Nr(this._stagingStore.reader), this._store.insert(this._chunk), this.events.emit("tick")) : this.events.emit("tick");
3115
+ }
3116
+ async updateFields(e) {
3117
+ throw new Error("Updating available fields not supported for StreamLayer");
3118
+ }
3119
+ async load(e) {
3120
+ }
3121
+ unload(e) {
3122
+ }
3123
+ disconnect() {
3124
+ var e;
3125
+ this._connection = dt(this._connection), this._connectionState.connection = null, (e = this._handlesGroup) == null || e.remove();
3126
+ }
3127
+ connect() {
3128
+ if (this._connection != null)
3129
+ return;
3130
+ const { geometryType: e, spatialReference: t } = this._metadata, { maxReconnectionAttempts: s, maxReconnectionInterval: r, geometryDefinition: i, definitionExpression: n, customParameters: a } = this._dataFilter;
3131
+ this._connection = Ds(this._service.source, t, this._streamOptions.outSR, e, n, i, s, r, a), this._handlesGroup = gt([this._connection.on("data-received", (o) => this._onFeature(o)), this._connection.on("message-received", (o) => this._onWebSocketMessage(o))]), this._connectionState.connection = this._connection;
3132
+ }
3133
+ clear() {
3134
+ this._manager.checkForUpdates(), this._stagingStore.clear(), this._forceRefresh = !0;
3135
+ }
3136
+ updateCustomParameters(e) {
3137
+ var t;
3138
+ (t = this._connection) == null || t.updateCustomParameters(e);
3139
+ }
3140
+ sendMessageToSocket(e) {
3141
+ var t;
3142
+ (t = this._connection) == null || t.sendMessageToSocket(e);
3143
+ }
3144
+ sendMessageToClient(e) {
3145
+ var t;
3146
+ (t = this._connection) == null || t.sendMessageToClient(e);
3147
+ }
3148
+ _onWebSocketMessage(e) {
3149
+ if ("type" in e)
3150
+ switch (e.type) {
3151
+ case "delete":
3152
+ if (e.objectIds)
3153
+ for (const t of e.objectIds)
3154
+ this._manager.removeById(t);
3155
+ if (e.trackIds)
3156
+ for (const t of e.trackIds)
3157
+ this._manager.removeByTrackId(t);
3158
+ break;
3159
+ case "clear":
3160
+ this.clear();
3161
+ }
3162
+ this.events.emit("message-received", e);
3163
+ }
3164
+ _onFeature(e) {
3165
+ try {
3166
+ this._manager.add(e), this.events.emit("data-received", e);
3167
+ } catch {
3168
+ }
3169
+ }
3170
+ }
3171
+ class Vr {
3172
+ constructor(e) {
3173
+ this._onChange = e, this._chunks = /* @__PURE__ */ new Map(), this._chunksToRemove = [], this.events = new xe(), this.featureAdapter = new ys();
3174
+ }
3175
+ destroy() {
3176
+ this.clear();
3177
+ }
3178
+ clear() {
3179
+ for (const e of this._chunks.values())
3180
+ this._chunksToRemove.push(e);
3181
+ this._chunks.clear(), this._overrideChunk != null && this._chunksToRemove.push(this._overrideChunk), this._overrideChunk = null;
3182
+ }
3183
+ *chunks() {
3184
+ this._overrideChunk && (yield this._overrideChunk), yield* this._chunks.values();
3185
+ }
3186
+ insert(e) {
3187
+ var t;
3188
+ y("esri-2d-update-debug") && console.debug(`Chunk[${e.chunkId}] SourceChunkStore.insert`), (t = this._overrideChunk) != null && t.overridenIds.size && e.reader.removeIds(this._overrideChunk.overridenIds), this._chunks.set(e.chunkId, e), this.events.emit("changed"), this._onChange();
3189
+ }
3190
+ remove(e) {
3191
+ y("esri-2d-update-debug") && console.debug(`Chunk[${e.chunkId}] SourceChunkStore.remove`), this._chunks.delete(e.chunkId), this._chunksToRemove.push(e);
3192
+ }
3193
+ cleanupRemovedChunks() {
3194
+ const e = this._chunksToRemove;
3195
+ return this._chunksToRemove = [], e;
3196
+ }
3197
+ applyOverrides(e, t) {
3198
+ this._overrideChunk == null && (this._overrideChunk = new Nt(t)), this._overrideChunk.applyOverrides(e);
3199
+ for (const s of this._chunks.values())
3200
+ s.reader.removeIds(this._overrideChunk.overridenIds), s.invalidate();
3201
+ }
3202
+ forEach(e) {
3203
+ const t = /* @__PURE__ */ new Set();
3204
+ for (const s of this.chunks()) {
3205
+ const r = s.reader.getCursor();
3206
+ for (; r.next(); ) {
3207
+ const i = r.getObjectId();
3208
+ t.has(i) || (e(r.copy()), t.add(i));
3209
+ }
3210
+ }
3211
+ }
3212
+ forEachUnsafe(e) {
3213
+ const t = /* @__PURE__ */ new Set();
3214
+ for (const s of this.chunks()) {
3215
+ const r = s.reader.getCursor();
3216
+ for (; r.next(); ) {
3217
+ const i = r.getObjectId();
3218
+ t.has(i) || (e(r), t.add(i));
3219
+ }
3220
+ }
3221
+ }
3222
+ forEachInBounds(e, t) {
3223
+ const s = /* @__PURE__ */ new Set();
3224
+ for (const r of this.chunks()) {
3225
+ const i = r.queryFeaturesInBounds(e);
3226
+ for (; i.next(); ) {
3227
+ const n = i.getObjectId();
3228
+ s.has(n) || (t(i.copy()), s.add(n));
3229
+ }
3230
+ }
3231
+ }
3232
+ forEachBounds(e, t) {
3233
+ const s = ke();
3234
+ for (const r of e)
3235
+ r.getBounds(s) && t(s);
3236
+ }
3237
+ }
3238
+ class Yr {
3239
+ constructor(e, t, s, r) {
3240
+ this._aggregateAdapter = e, this._subscriptions = t, this._onChange = s, this._connection = r, this._updateTracking = new Ls({ debugName: "FeatureSource" }), this._didInvalidateData = !1, this._store = new Vr(this._onChange);
3241
+ }
3242
+ destroy() {
3243
+ var e, t;
3244
+ (e = this._strategy) == null || e.destroy(), this._store.destroy(), (t = this._streamMessenger) == null || t.destroy();
3245
+ }
3246
+ get _eventLog() {
3247
+ return this._connection.eventLog;
3248
+ }
3249
+ get metadata() {
3250
+ if (!this._metadata)
3251
+ throw new Error("InternalError: Metadata not defined. Was update called?");
3252
+ return this._metadata;
3253
+ }
3254
+ get service() {
3255
+ return this._schema.service;
3256
+ }
3257
+ get store() {
3258
+ return this._store;
3259
+ }
3260
+ get streamMessenger() {
3261
+ return this._streamMessenger == null && this._initStreamMessenger(), this._streamMessenger;
3262
+ }
3263
+ get statistics() {
3264
+ return mr.from(this._store);
3265
+ }
3266
+ get updateTracking() {
3267
+ return this._updateTracking;
3268
+ }
3269
+ get queryEngine() {
3270
+ if (!this._queryEngine) {
3271
+ if (!this._schema)
3272
+ return null;
3273
+ const { dataFilter: e } = this._schema.mutable, t = this._schema.mutable.availableFields, s = this._metadata;
3274
+ this._queryEngine = new vt({ featureStore: this._store, fieldsIndex: s.fieldsIndex, geometryType: s.geometryType, objectIdField: s.objectIdField, hasM: !1, hasZ: !1, spatialReference: e.outSpatialReference, cacheSpatialQueries: !0, aggregateAdapter: this._aggregateAdapter, timeInfo: s.timeInfo, definitionExpression: e.definitionExpression, availableFields: t });
3275
+ }
3276
+ return this._queryEngine;
3277
+ }
3278
+ get isStream() {
3279
+ return this._schema.type === "stream";
3280
+ }
3281
+ chunks() {
3282
+ return Array.from(this._store.chunks());
3283
+ }
3284
+ cleanupRemovedChunks() {
3285
+ return this._store.cleanupRemovedChunks();
3286
+ }
3287
+ onSubscribe(e) {
3288
+ var s;
3289
+ this._eventLog.onEvent({ type: "subscribe", tile: e.tile.id });
3290
+ const t = (s = this._strategy) == null ? void 0 : s.load(e);
3291
+ t && (t.then(() => this._eventLog.onEvent({ type: "loaded", tile: e.tile.id })).catch((r) => this._eventLog.onEvent({ type: "error", tile: e.tile.id, error: r })), this._updateTracking.addPromise(t));
3292
+ }
3293
+ onResume(e) {
3294
+ var t;
3295
+ this._updateTracking.addPromise(ut((t = this._strategy) == null ? void 0 : t.load(e)));
3296
+ }
3297
+ onUnsubscribe(e) {
3298
+ var t;
3299
+ this._eventLog.onEvent({ type: "unsubscribe", tile: e.tile.id }), (t = this._strategy) == null || t.unload(e);
3300
+ }
3301
+ getOverride(e) {
3302
+ return this._updateTracking.addPromise(this._doGetOverride(e));
3303
+ }
3304
+ applyOverride(e) {
3305
+ this._didInvalidateData = !0, this._store.applyOverrides(e, this.metadata);
3306
+ }
3307
+ async update(e, t) {
3308
+ var i, n, a;
3309
+ const s = e.source, r = ft((i = this._schema) == null ? void 0 : i.mutable, s.mutable);
3310
+ if (!r)
3311
+ return !1;
3312
+ if (y("esri-2d-update-debug") && console.debug(`Version[${t}] FeatureSource.update`, { changes: r }), this._schema = s, this._metadata = new $e(this._schema.service.metadata), (n = this._queryEngine) == null || n.destroy(), this._queryEngine = null, this._schema.type === "feature" && this._schema.service.queryMetadata.lastEditDate != null && (this._lastEditDate = this._schema.service.queryMetadata.lastEditDate), this._streamMessenger == null && this._schema.type === "stream" && this._initStreamMessenger(), ze(r, "sourceRefreshVersion") && ((a = this._strategy) == null ? void 0 : a.refresh))
3313
+ return await this._strategy.refresh(), !0;
3314
+ if (s.type === "feature" && ze(r, "availableFields")) {
3315
+ if (await this._queryLastEditDateChanged() || this._didInvalidateData)
3316
+ this._didInvalidateData = !1, await this._updateStrategy(t);
3317
+ else {
3318
+ this._eventLog.onEvent({ type: "updateFieldsStart" });
3319
+ try {
3320
+ await this._strategy.updateFields(s.mutable.availableFields), this._eventLog.onEvent({ type: "updateFieldsEnd" });
3321
+ } catch (o) {
3322
+ this._eventLog.onEvent({ type: "updateFieldsError", error: o });
3323
+ }
3324
+ }
3325
+ return !1;
3326
+ }
3327
+ return !(!Ue(r, "dataFilter") && !Ue(r, "sourceRefreshVersion")) && (await this._updateStrategy(t), !0);
3328
+ }
3329
+ _initStreamMessenger() {
3330
+ this._streamMessenger == null && (this._streamMessenger = new te(this._connection));
3331
+ }
3332
+ async _doGetOverride(e) {
3333
+ return this._strategy.queryOverride(e);
3334
+ }
3335
+ async _queryLastEditDateChanged() {
3336
+ if (this._lastEditDate == null)
3337
+ return !1;
3338
+ const e = this._schema.service.source, t = { ...e.query, f: "json" }, s = (await os(e.path, { query: t, responseType: "json" })).data.editingInfo.lastEditDate;
3339
+ return s !== this._lastEditDate && (this._lastEditDate = s, !0);
3340
+ }
3341
+ async _createStrategy() {
3342
+ const e = this.service, t = "isSourceHosted" in e && e.isSourceHosted, s = Array.isArray(e.source), r = e.source && "collection" in e.source, i = t || s || r;
3343
+ if (this._schema.type === "stream") {
3344
+ const o = new Br(this._schema.service, this._schema.mutable.dataFilter, this._store, { outSR: this._schema.mutable.dataFilter.outSpatialReference }, this.metadata);
3345
+ return this._streamMessenger.strategy = o, o;
3346
+ }
3347
+ const n = Ir.fromSchema(this._schema, this._metadata), a = await this._supportSnapshotMode(this._schema, n);
3348
+ return a ? new zr(this._schema.service, n, this._store, a.featureCount, this.metadata, this._eventLog) : i ? new Lr(this._schema.service, n, this._store, this.metadata, this._eventLog) : new jr(this._schema.service, n, this._store, this.metadata, this._eventLog);
3349
+ }
3350
+ async _updateStrategy(e) {
3351
+ var n;
3352
+ const t = await this._createStrategy();
3353
+ this._eventLog.onEvent({ type: "updateStrategyStart", about: t.about });
3354
+ const s = !!this._strategy;
3355
+ this._store.clear(), (n = this._strategy) == null || n.destroy(), this._strategy = t, y("esri-2d-update-debug") && console.debug(`Version[${e}] FeatureSource.updateStrategy`, { strategy: t });
3356
+ const r = Array.from(this._subscriptions.values());
3357
+ if (!r.length)
3358
+ return void this._eventLog.onEvent({ type: "updateStrategyEnd" });
3359
+ const i = Promise.all(r.map((a) => this._strategy.load(a).then(() => this._eventLog.onEvent({ type: "loaded", tile: a.tile.id })).catch((o) => this._eventLog.onEvent({ type: "error", tile: a.tile.id, error: o }))));
3360
+ this._updateTracking.addPromise(i);
3361
+ try {
3362
+ s && await i;
3363
+ } catch (a) {
3364
+ Fe(a);
3365
+ }
3366
+ this._eventLog.onEvent({ type: "updateStrategyEnd" }), y("esri-2d-update-debug") && console.debug(`Version[${e}] FeatureSource.updateStrategyEnd`, { strategy: t });
3367
+ }
3368
+ async _supportSnapshotMode(e, t) {
3369
+ const { queryMetadata: s } = e.service, r = s.snapshotInfo;
3370
+ if (!r || !r.supportsSnapshotMinThreshold || !r.snapshotCountThresholds)
3371
+ return null;
3372
+ const i = e.service.source, n = t.createQuery();
3373
+ n.inner.orderByFields = [], n.inner.returnGeometry = !1;
3374
+ const a = (await Rs(i, n.inner, { query: n.customParameters })).data.count, { min: o, max: h } = r.snapshotCountThresholds;
3375
+ return a <= o || r.supportsSnapshotMaxThreshold && a < h ? { featureCount: a } : null;
3376
+ }
3377
+ }
3378
+ class Xr {
3379
+ constructor(e, t) {
3380
+ this._handles = new hs(), this._abortController = new AbortController(), this._resolver = Te(), this._isDone = !1, this._aborted = !1, this.tile = e, this._version = t, this._handles.add([]);
3381
+ }
3382
+ destroy() {
3383
+ this.pause(), this._handles.destroy();
3384
+ }
3385
+ get key() {
3386
+ return this.tile.key;
3387
+ }
3388
+ get version() {
3389
+ return this._version;
3390
+ }
3391
+ set version(e) {
3392
+ this._version = e;
3393
+ }
3394
+ get signal() {
3395
+ return this._abortController.signal;
3396
+ }
3397
+ get options() {
3398
+ return { signal: this._abortController.signal };
3399
+ }
3400
+ get done() {
3401
+ return this._resolver.promise;
3402
+ }
3403
+ get isDone() {
3404
+ return this._isDone;
3405
+ }
3406
+ resolve() {
3407
+ this._isDone = !0, this._resolver.resolve();
3408
+ }
3409
+ get paused() {
3410
+ return this._aborted;
3411
+ }
3412
+ resume() {
3413
+ this._abortController = new AbortController(), this._aborted = !1;
3414
+ }
3415
+ pause() {
3416
+ this._aborted || (this._aborted = !0, this._abortController.abort());
3417
+ }
3418
+ }
3419
+ class Qr {
3420
+ constructor(e) {
3421
+ this.edit = e, this.resolver = Te();
3422
+ }
3423
+ }
3424
+ class Zr {
3425
+ constructor(e, t) {
3426
+ this.schema = e, this.version = t, this.resolver = Te();
3427
+ }
3428
+ }
3429
+ class Un {
3430
+ constructor() {
3431
+ this._aggregateAdapter = { getFeatureObjectIds: (e) => this._processor.getFeatureObjectIdsForAggregate(e) }, this._subscriptions = /* @__PURE__ */ new Map(), this._updateRequested = !1, this._updateSubscriptionRequests = [], this._updateHighlightRequests = [];
3432
+ }
3433
+ destroy() {
3434
+ this._subscriptions.clear(), this._processor.destroy(), this._source.destroy(), this._handles.remove(), this._editState = null, this._tileInfoView = null;
3435
+ }
3436
+ onDetach() {
3437
+ this.destroy(), this._initialize(this._connection);
3438
+ }
3439
+ _initialize(e) {
3440
+ this._source = new Yr(this._aggregateAdapter, this._subscriptions, () => this._requestUpdate(), e), this._processor = new yr(e, this._source), this._handles = gt([pe(() => this._source.updateTracking.updating, () => {
3441
+ this._requestUpdate(), this._connection.layerView.setUpdating({ data: this._source.updateTracking.updating, pipeline: !0 });
3442
+ })]);
3443
+ }
3444
+ set remoteClient(e) {
3445
+ this._connection = new zs(e), this._initialize(this._connection);
3446
+ }
3447
+ get features() {
3448
+ const e = this._source.queryEngine;
3449
+ if (!e)
3450
+ throw new D("no-queryEngine", "No query engine defined");
3451
+ return e;
3452
+ }
3453
+ get aggregates() {
3454
+ const e = this._processor.aggregateQueryEngine;
3455
+ if (!e)
3456
+ throw new D("no-queryEngine", "No aggregate query engine defined");
3457
+ return e;
3458
+ }
3459
+ get processor() {
3460
+ return this._processor;
3461
+ }
3462
+ get streamMessenger() {
3463
+ return this._source.streamMessenger;
3464
+ }
3465
+ getDisplayFeatures(e) {
3466
+ return this._processor.getDisplayFeatures(e);
3467
+ }
3468
+ async updateSchema(e, t) {
3469
+ return y("esri-2d-update-debug") && this._updateSchemaState && console.error("InternalError: Schema already updating"), this._updateSchemaState = new Zr(e, t), this._requestUpdate(), this._updateSchemaState.resolver.promise;
3470
+ }
3471
+ updateSubscriptions(e) {
3472
+ this._updateSubscriptionRequests.push(e), this._requestUpdate();
3473
+ }
3474
+ updateHighlight(e) {
3475
+ this._updateHighlightRequests.push(e), this._requestUpdate();
3476
+ }
3477
+ async onEdits(e) {
3478
+ if (this._editState != null)
3479
+ throw new D("InternalError - Already processing an edit");
3480
+ this._editState = new Qr(e);
3481
+ const t = this._editState.resolver.promise;
3482
+ return this._requestUpdate(), t;
3483
+ }
3484
+ queryStatistics() {
3485
+ return this._source.statistics.toJSON();
3486
+ }
3487
+ async queryVisibleFeatures(e, t) {
3488
+ return this.features.executeQuery(e, t);
3489
+ }
3490
+ async queryHeatmapStatistics(e) {
3491
+ const t = Math.round(us(e.radius));
3492
+ let s = Number.POSITIVE_INFINITY, r = Number.NEGATIVE_INFINITY;
3493
+ const i = typeof e.fieldOffset == "string", n = e.fieldOffset ?? 0, a = Array.from(this._subscriptions.values()), o = this._source.chunks(), h = t ** 2, c = 3 / (Math.PI * h), d = 2 * t, l = Math.ceil(x / d);
3494
+ for (const g of a) {
3495
+ const _ = g.tile, m = new Float64Array(l * l);
3496
+ for (const p of o) {
3497
+ const I = p.getTileReader(_);
3498
+ if (!I)
3499
+ continue;
3500
+ const f = I.getCursor();
3501
+ for (; f.next(); ) {
3502
+ let k = 1;
3503
+ if (e.field != null) {
3504
+ const O = f.readAttribute(e.field);
3505
+ k = i ? -1 * +O : +O + n;
3506
+ }
3507
+ const b = f.readXForDisplay() / d, v = f.readYForDisplay() / d, S = Math.floor(b), w = Math.floor(v);
3508
+ if (S < 0 || w < 0 || S >= l || w >= l)
3509
+ continue;
3510
+ const $ = ((0.5 + S - b) * d) ** 2 + ((0.5 + w - v) * d) ** 2;
3511
+ if ($ > h)
3512
+ continue;
3513
+ const F = k * (c * (1 - $ / h) ** 2);
3514
+ m[w + S * l] += F;
3515
+ }
3516
+ }
3517
+ for (let p = 0; p < m.length; p++)
3518
+ s = Math.min(s, m[p]), r = Math.max(r, m[p]);
3519
+ }
3520
+ return { max: r, min: s };
3521
+ }
3522
+ async getSampleFeatures(e) {
3523
+ const t = this._source.chunks();
3524
+ if (t.reduce((o, h) => o + h.size(), 0) <= e.minFeatureCount) {
3525
+ if (!this._source.updateTracking.updating) {
3526
+ const o = [];
3527
+ return this._source.store.forEachUnsafe((h) => o.push(h.readLegacyFeatureWorldSpace())), o;
3528
+ }
3529
+ return null;
3530
+ }
3531
+ const s = /* @__PURE__ */ new Set(), r = [], i = t.map((o) => o.reader.getCursor()), n = new pt(), a = 3 * e.sampleSize;
3532
+ for (let o = 0; o < a && r.length < e.sampleSize; o++) {
3533
+ const h = i[n.getIntRange(0, t.length - 1)];
3534
+ if (h.getSize() === 0)
3535
+ continue;
3536
+ const c = n.getIntRange(0, h.getSize() - 1);
3537
+ h.setIndex(c);
3538
+ const d = h.getObjectId();
3539
+ s.has(d) || (s.add(d), r.push(h.readLegacyFeatureWorldSpace()));
3540
+ }
3541
+ return r.length >= e.sampleSize ? r : null;
3542
+ }
3543
+ _requestUpdate() {
3544
+ this._updateRequested || (this._updateRequested = !0, ds(() => this._scheduleNextUpdate()));
3545
+ }
3546
+ _scheduleNextUpdate() {
3547
+ this._updateRequested && (this._ongoingUpdate || (this._ongoingUpdate = this._doUpdate().finally(() => {
3548
+ this._ongoingUpdate = null, this._scheduleNextUpdate();
3549
+ }), this._updateRequested = !1));
3550
+ }
3551
+ _subscribe(e) {
3552
+ const t = e.tileId;
3553
+ if (this._subscriptions.has(t)) {
3554
+ const i = this._subscriptions.get(t);
3555
+ return void (i.paused && (y("esri-2d-update-debug") && console.debug(`Tile[${t}] Pipeline.resume`), i.resume(), i.version = e.version, this._source.onResume(i)));
3556
+ }
3557
+ y("esri-2d-update-debug") && console.debug(`Tile[${t}] Pipeline.subscribe`);
3558
+ const s = new cs(this._tileInfoView, t), r = new Xr(s, e.version);
3559
+ this._subscriptions.set(t, r), this._source.onSubscribe(r), this._processor.onSubscribe(r);
3560
+ }
3561
+ _unsubscribe(e) {
3562
+ const t = this._subscriptions.get(e);
3563
+ t && (y("esri-2d-update-debug") && console.debug(`Tile[${e}] Pipeline.unsubscribe`), this._source.onUnsubscribe(t), this._processor.onUnsubscribe(t), this._subscriptions.delete(t.key.id), t.destroy());
3564
+ }
3565
+ _pauseSubscription(e) {
3566
+ const t = this._subscriptions.get(e);
3567
+ t && (y("esri-2d-update-debug") && console.debug(`Tile[${e}] Pipeline.pause`), t.pause());
3568
+ }
3569
+ async _doUpdate() {
3570
+ if (y("esri-2d-update-debug") && console.debug("Pipeline._doUpdateStart"), await this._connection.layerView.setUpdating({ data: this._source.updateTracking.updating, pipeline: !0 }), this._updateSubscriptionRequests.length) {
3571
+ const r = this._updateSubscriptionRequests;
3572
+ this._updateSubscriptionRequests = [];
3573
+ for (const i of r)
3574
+ this._doUpdateSubscriptions(i);
3575
+ }
3576
+ const e = this._updateSchemaState;
3577
+ if (this._updateSchemaState = null, e != null) {
3578
+ const { schema: r, version: i } = e;
3579
+ await this._doUpdateSchema(r, i);
3580
+ }
3581
+ const t = this._editState;
3582
+ if (this._editState = null, t != null) {
3583
+ y("esri-2d-update-debug") && console.debug("Pipeline.applyEditOverride", t.edit);
3584
+ const r = await this._source.getOverride(t.edit);
3585
+ await this._processor.applyOverride(r), y("esri-2d-update-debug") && console.debug("Pipeline.endEditOverride", t.edit);
3586
+ }
3587
+ if (this._updateHighlightRequests.length) {
3588
+ const r = this._updateHighlightRequests;
3589
+ this._updateHighlightRequests = [];
3590
+ for (const i of r)
3591
+ this._processor.updateHighlight(i);
3592
+ }
3593
+ const s = this._source.cleanupRemovedChunks();
3594
+ this._processor.removeChunks(s);
3595
+ try {
3596
+ this._subscriptions.size && (y("esri-2d-update-debug") && console.debug("Pipeline.updateChunksStart"), await this._processor.updateChunks(), y("esri-2d-update-debug") && console.debug("Pipeline.updateChunksEnd"));
3597
+ } catch (r) {
3598
+ Fe(r);
3599
+ }
3600
+ t != null && t.resolver.resolve(), e != null && e.resolver.resolve(), this._updateRequested ? (y("esri-2d-update-debug") && console.debug("Pipeline._doUpdateEnd [updateRequested=true]"), await this._connection.layerView.setUpdating({ data: this._source.updateTracking.updating, pipeline: !0 })) : (y("esri-2d-update-debug") && console.debug("Pipeline._doUpdateEnd [updateRequested=false, After flush]"), await this._connection.layerView.setUpdating({ data: this._source.updateTracking.updating, pipeline: this._updateRequested }));
3601
+ }
3602
+ async _doUpdateSchema(e, t) {
3603
+ var r;
3604
+ if (y("esri-2d-update-debug") && console.debug(`Version[${t}] Pipeline.updateStart`, { schema: e }), !this._tileInfoView) {
3605
+ const i = De.fromJSON(e.source.tileInfoJSON);
3606
+ this._tileInfoView = new Le(i);
3607
+ }
3608
+ const s = { tileInfo: (r = this._tileInfoView) == null ? void 0 : r.tileInfo };
3609
+ try {
3610
+ const i = await this._source.update(e, t), n = Array.from(this._subscriptions.values());
3611
+ await this._processor.update(e, t, s, i, n);
3612
+ } catch (i) {
3613
+ console.error(i);
3614
+ }
3615
+ y("esri-2d-update-debug") && console.debug(`Version[${t}] Pipeline.updateEnd`);
3616
+ }
3617
+ _doUpdateSubscriptions(e) {
3618
+ if (y("esri-2d-update-debug") && console.debug("Pipeline.updateSubscriptions", e), !this._tileInfoView) {
3619
+ const t = De.fromJSON(e.tileInfoJSON);
3620
+ this._tileInfoView = new Le(t);
3621
+ }
3622
+ for (const t of e.subscribe)
3623
+ this._subscribe(t);
3624
+ for (const t of e.unsubscribe)
3625
+ this._unsubscribe(t);
3626
+ if (y("featurelayer-query-pausing-enabled"))
3627
+ for (const t of e.pause)
3628
+ this._pauseSubscription(t);
3629
+ }
3630
+ }
3631
+ export {
3632
+ Un as default
3633
+ };