@vertigis/arcgis-extensions 54.13.0 → 54.14.0

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 (451) hide show
  1. package/AppConfig.schema.json +1 -1
  2. package/data/Feature.d.ts +103 -58
  3. package/data/Feature.js +1 -1
  4. package/data/FeatureSet.js +1 -1
  5. package/data/convert.js +1 -1
  6. package/docs/html/assets/hierarchy.js +1 -1
  7. package/docs/html/assets/navigation.js +1 -1
  8. package/docs/html/assets/search.js +1 -1
  9. package/docs/html/classes/data_Feature.Feature.html +107 -41
  10. package/docs/html/classes/data_FeatureList.FeatureList.html +1 -1
  11. package/docs/html/classes/data_FeatureSaveError.FeatureSaveError.html +1 -1
  12. package/docs/html/classes/data_FeatureSet.FeatureSet.html +1 -1
  13. package/docs/html/classes/data_FeatureSettings.FeatureSettings.html +1 -1
  14. package/docs/html/classes/data_FeatureSourceBase.FeatureSourceBase.html +1 -1
  15. package/docs/html/classes/data_FeatureSourceBase.RelationshipCollection.html +1 -1
  16. package/docs/html/classes/data_FeatureStream.FeatureStream.html +1 -1
  17. package/docs/html/classes/data_FieldExtension.FieldExtension.html +1 -1
  18. package/docs/html/classes/data_PopupContentExtension.PopupContentExtension.html +1 -1
  19. package/docs/html/classes/data_RelationshipBase.RelationshipBase.html +1 -1
  20. package/docs/html/classes/data_Schema.Schema.html +1 -1
  21. package/docs/html/classes/data_TaskSettings.TaskSettings.html +1 -1
  22. package/docs/html/classes/data__TableExtension.TableExtension.html +1 -1
  23. package/docs/html/classes/data__TableExtension.TableFeatureSettings.html +1 -1
  24. package/docs/html/classes/data__TableExtension.TableSchema.html +1 -1
  25. package/docs/html/classes/layer-preset_LayerPreset.LayerPreset.html +1 -1
  26. package/docs/html/classes/layer-preset_LayerPresetSettings.LayerPresetSetting.html +1 -1
  27. package/docs/html/classes/mapping_ArcGISSublayerExtension.ArcGISSublayerExtension.html +1 -1
  28. package/docs/html/classes/mapping_ArcGISSublayerExtension.ArcGISSublayerRelationshipCollection.html +1 -1
  29. package/docs/html/classes/mapping_BasemapExtension.BasemapExtension.html +1 -1
  30. package/docs/html/classes/mapping_Bookmark.Bookmark.html +1 -1
  31. package/docs/html/classes/mapping_BuildingComponentSublayerExtension.BuildingComponentSublayerExtension.html +1 -1
  32. package/docs/html/classes/mapping_BuildingComponentSublayerExtension.BuildingComponentSublayerSchema.html +1 -1
  33. package/docs/html/classes/mapping_BuildingGroupSublayerExtension.BuildingGroupSublayerExtension.html +1 -1
  34. package/docs/html/classes/mapping_BuildingGroupSublayerExtension.BuildingGroupSublayerSchema.html +1 -1
  35. package/docs/html/classes/mapping_BuildingSceneLayerExtension.BuildingSceneLayerExtension.html +1 -1
  36. package/docs/html/classes/mapping_BuildingSceneLayerExtension.BuildingSceneLayerReadOnlySchema.html +1 -1
  37. package/docs/html/classes/mapping_BuildingSublayerExtension.BuildingSublayerExtension.html +1 -1
  38. package/docs/html/classes/mapping_BuildingSublayerExtension.BuildingSublayerSchema.html +1 -1
  39. package/docs/html/classes/mapping_CSVLayerExtension.CSVLayerExtension.html +1 -1
  40. package/docs/html/classes/mapping_ElevationLayerExtension.ElevationLayerExtension.html +1 -1
  41. package/docs/html/classes/mapping_FeatureCollectionLayerExtension.FeatureCollectionLayerExtension.html +1 -1
  42. package/docs/html/classes/mapping_FeatureLayerExtension.FeatureLayerExtension.html +1 -1
  43. package/docs/html/classes/mapping_FeatureLayerExtensionBase.FeatureLayerExtensionBase.html +1 -1
  44. package/docs/html/classes/mapping_FeatureLayerExtensionBase.FeatureLayerReadOnlySchema.html +1 -1
  45. package/docs/html/classes/mapping_FeatureLayerExtensionBase.FeatureLayerSchema.html +1 -1
  46. package/docs/html/classes/mapping_GeoJSONLayerExtension.GeoJSONLayerExtension.html +1 -1
  47. package/docs/html/classes/mapping_GeoRSSLayerExtension.GeoRSSLayerExtension.html +1 -1
  48. package/docs/html/classes/mapping_GraphicsLayerExtension.GraphicsLayerExtension.html +1 -1
  49. package/docs/html/classes/mapping_GroundExtension.GroundExtension.html +1 -1
  50. package/docs/html/classes/mapping_GroupLayerExtension.GroupLayerExtension.html +1 -1
  51. package/docs/html/classes/mapping_GroupLayerExtension.GroupLayerExtensionCollection.html +1 -1
  52. package/docs/html/classes/mapping_ImageryLayerExtension.ImageryLayerExtension.html +1 -1
  53. package/docs/html/classes/mapping_ImageryTileLayerExtension.ImageryTileLayerExtension.html +1 -1
  54. package/docs/html/classes/mapping_IntegratedMeshLayerExtension.IntegratedMeshLayerExtension.html +1 -1
  55. package/docs/html/classes/mapping_KMLLayerExtension.KMLLayerExtension.html +1 -1
  56. package/docs/html/classes/mapping_KMLSublayerExtension.KMLSublayerExtension.html +1 -1
  57. package/docs/html/classes/mapping_MapConstraints.MapConstraints.html +1 -1
  58. package/docs/html/classes/mapping_MapExtension.MapExtension.html +1 -1
  59. package/docs/html/classes/mapping_MapImageLayerExtension.MapImageLayerExtension.html +1 -1
  60. package/docs/html/classes/mapping_MapImageSublayerExtension.MapImageSublayerExtension.html +1 -1
  61. package/docs/html/classes/mapping_MapNotesLayerExtension.MapNotesLayerExtension.html +1 -1
  62. package/docs/html/classes/mapping_MapNotesSublayerExtension.MapNotesSublayerExtension.html +1 -1
  63. package/docs/html/classes/mapping_MapNotesSublayerExtension.MapNotesSublayerExtensionSchema.html +1 -1
  64. package/docs/html/classes/mapping_MediaLayerExtension.MediaLayerExtension.html +1 -1
  65. package/docs/html/classes/mapping_OpenStreetMapLayerExtension.OpenStreetMapLayerExtension.html +1 -1
  66. package/docs/html/classes/mapping_PointCloudLayerExtension.PointCloudLayerExtension.html +1 -1
  67. package/docs/html/classes/mapping_RouteLayerExtension.RouteLayerExtension.html +1 -1
  68. package/docs/html/classes/mapping_RouteLayerExtension.RouteLayerExtensionSchema.html +1 -1
  69. package/docs/html/classes/mapping_SceneLayerExtension.SceneLayerExtension.html +1 -1
  70. package/docs/html/classes/mapping_StreamLayerExtension.StreamLayerExtension.html +1 -1
  71. package/docs/html/classes/mapping_StreamLayerExtension.StreamLayerSchema.html +1 -1
  72. package/docs/html/classes/mapping_SubtypeGroupLayerExtension.SubtypeGroupLayerExtension.html +1 -1
  73. package/docs/html/classes/mapping_SubtypeGroupLayerExtension.SubtypeGroupLayerRelationshipCollection.html +1 -1
  74. package/docs/html/classes/mapping_SubtypeGroupLayerExtension.SubtypeGroupLayerSchema.html +1 -1
  75. package/docs/html/classes/mapping_SubtypeSublayerExtension.SubtypeSublayerExtension.html +1 -1
  76. package/docs/html/classes/mapping_SubtypeSublayerExtension.SubtypeSublayerRelationshipCollection.html +1 -1
  77. package/docs/html/classes/mapping_SubtypeSublayerExtension.SubtypeSublayerSchema.html +1 -1
  78. package/docs/html/classes/mapping_TileLayerExtension.TileLayerExtension.html +1 -1
  79. package/docs/html/classes/mapping_TileSublayerExtension.TileSublayerExtension.html +1 -1
  80. package/docs/html/classes/mapping_UnsupportedLayerExtension.UnsupportedLayerExtension.html +1 -1
  81. package/docs/html/classes/mapping_VectorTileLayerExtension.VectorTileLayerExtension.html +1 -1
  82. package/docs/html/classes/mapping_WFSLayerExtension.WFSLayerExtension.html +1 -1
  83. package/docs/html/classes/mapping_WMSLayerExtension.WMSLayerExtension.html +1 -1
  84. package/docs/html/classes/mapping_WMSSublayerExtension.WMSSublayerExtension.html +1 -1
  85. package/docs/html/classes/mapping_WMTSLayerExtension.WMTSLayerExtension.html +1 -1
  86. package/docs/html/classes/mapping_WebTileLayerExtension.WebTileLayerExtension.html +1 -1
  87. package/docs/html/classes/mapping__LayerExtension.LayerExtension.html +1 -1
  88. package/docs/html/classes/mapping__LayerExtension.LayerExtensionReadOnlySchema.html +1 -1
  89. package/docs/html/classes/mapping__LayerExtension.LayerExtensionSchema.html +1 -1
  90. package/docs/html/classes/mapping__LayerExtensionCollectionImpl.LayerExtensionCollectionImpl.html +1 -1
  91. package/docs/html/classes/mapping__SublayerExtension.SubSublayerExtensionCollection.html +1 -1
  92. package/docs/html/classes/mapping__SublayerExtension.SublayerExtension.html +1 -1
  93. package/docs/html/classes/mapping__SublayerExtension.SublayerSchema.html +1 -1
  94. package/docs/html/classes/mapping_support_ArrayWrappedCollection.ArrayWrappedCollection.html +1 -1
  95. package/docs/html/classes/mapping_support_LayerListSettings.ExtensionBaseLayerListSettings.html +1 -1
  96. package/docs/html/classes/mapping_support_LayerListSettings.LayerListSettings.html +1 -1
  97. package/docs/html/classes/mapping_support__LayerExtensionCollection.LayerExtensionCollectionBase.html +1 -1
  98. package/docs/html/classes/mapping_support__SublayerExtensionCollection.SublayerExtensionCollectionBase.html +1 -1
  99. package/docs/html/classes/menus_Menu.Menu.html +1 -1
  100. package/docs/html/classes/menus_MenuItem.MenuItem.html +1 -1
  101. package/docs/html/classes/support_FormatSettings.FormatSettings.html +1 -1
  102. package/docs/html/classes/support_InitializableBase.InitializableBase.html +1 -1
  103. package/docs/html/classes/support_InitializableCollectionProxy.InitializableCollectionProxy.html +1 -1
  104. package/docs/html/classes/support_InitializeError.InitializeError.html +1 -1
  105. package/docs/html/classes/support_ReadOnlyInitializableCollection.ReadOnlyInitializableCollection.html +1 -1
  106. package/docs/html/classes/support_Serializable.SerializableBase.html +1 -1
  107. package/docs/html/classes/support_Settings.Settings.html +1 -1
  108. package/docs/html/classes/support__ArcGISRelationshipCollection.ArcGISRelationshipCollection.html +1 -1
  109. package/docs/html/classes/support_observableUtils.ObservableMixin.html +1 -1
  110. package/docs/html/classes/tasks_geocoding_ArcGISGeocoder.ArcGISGeocoder.html +1 -1
  111. package/docs/html/classes/tasks_geocoding_Geocoder.Geocoder.html +1 -1
  112. package/docs/html/classes/tasks_identify_ArcGISSublayerIdentifyProvider.ArcGISSublayerIdentifyProvider.html +1 -1
  113. package/docs/html/classes/tasks_identify_ArcGISSublayerQueryIdentifyProvider.ArcGISSublayerQueryIdentifyProvider.html +1 -1
  114. package/docs/html/classes/tasks_identify_BuildingComponentSublayerClientSideIdentifyProvider.BuildingComponentSublayerClientSideIdentifyProvider.html +1 -1
  115. package/docs/html/classes/tasks_identify_BuildingComponentSublayerHitTestIdentifyProvider.BuildingComponentSublayerHitTestIdentifyProvider.html +1 -1
  116. package/docs/html/classes/tasks_identify_CSVLayer3DHitTestIdentifyProvider.CSVLayer3DHitTestIdentifyProvider.html +1 -1
  117. package/docs/html/classes/tasks_identify_CSVLayerClientSideQueryIdentifyProvider.CSVLayerClientSideQueryIdentifyProvider.html +1 -1
  118. package/docs/html/classes/tasks_identify_ClientSideIdentifyProvider.ClientSideIdentifyProvider.html +1 -1
  119. package/docs/html/classes/tasks_identify_FeatureLayer3DHitTestIdentifyProvider.FeatureLayer3DHitTestIdentifyProvider.html +1 -1
  120. package/docs/html/classes/tasks_identify_FeatureLayerClientSideIdentifyProvider.FeatureLayerClientSideIdentifyProvider.html +1 -1
  121. package/docs/html/classes/tasks_identify_FeatureLayerQueryIdentifyProvider.FeatureLayerQueryIdentifyProvider.html +1 -1
  122. package/docs/html/classes/tasks_identify_GeoJSONLayer3DHitTestIdentifyProvider.GeoJSONLayer3DHitTestIdentifyProvider.html +1 -1
  123. package/docs/html/classes/tasks_identify_GeoJSONLayerClientSideQueryIdentifyProvider.GeoJSONLayerClientSideQueryIdentifyProvider.html +1 -1
  124. package/docs/html/classes/tasks_identify_GeoRSSLayerIdentifyProvider.GeoRSSLayerIdentifyProvider.html +1 -1
  125. package/docs/html/classes/tasks_identify_GraphicsLayerQueryIdentifyProvider.GraphicsLayerQueryIdentifyProvider.html +1 -1
  126. package/docs/html/classes/tasks_identify_HitTestIdentifyProvider.HitTestIdentifyProvider.html +1 -1
  127. package/docs/html/classes/tasks_identify_IdentifyError.IdentifyError.html +1 -1
  128. package/docs/html/classes/tasks_identify_IdentifyProviderBase.IdentifyProviderBase.html +1 -1
  129. package/docs/html/classes/tasks_identify_IdentifyService.IdentifyService.html +1 -1
  130. package/docs/html/classes/tasks_identify_ImageryLayerIdentifyProvider.ImageryLayerIdentifyProvider.html +1 -1
  131. package/docs/html/classes/tasks_identify_KMLLayerQueryIdentifyProvider.KMLLayerQueryIdentifyProvider.html +1 -1
  132. package/docs/html/classes/tasks_identify_MapNotesSublayerQueryIdentifyProvider.MapNotesSublayerQueryIdentifyProvider.html +1 -1
  133. package/docs/html/classes/tasks_identify_PointCloudLayerHitTestIdentifyProvider.PointCloudLayerHitTestIdentifyProvider.html +1 -1
  134. package/docs/html/classes/tasks_identify_RouteLayerQueryIdentifyProvider.RouteLayerQueryIdentifyProvider.html +1 -1
  135. package/docs/html/classes/tasks_identify_SceneLayerClientSideIdentifyProvider.SceneLayerClientSideIdentifyProvider.html +1 -1
  136. package/docs/html/classes/tasks_identify_SceneLayerHitTestIdentifyProvider.SceneLayerHitTestIdentifyProvider.html +1 -1
  137. package/docs/html/classes/tasks_identify_SceneLayerQueryIdentifyProvider.SceneLayerQueryIdentifyProvider.html +1 -1
  138. package/docs/html/classes/tasks_identify_StreamLayerClientSideQueryIdentifyProvider.StreamLayerClientSideQueryIdentifyProvider.html +1 -1
  139. package/docs/html/classes/tasks_identify_SubtypeSublayerClientSideIdentifyProvider.SubtypeSublayerClientSideIdentifyProvider.html +1 -1
  140. package/docs/html/classes/tasks_identify_SubtypeSublayerQueryIdentifyProvider.SubtypeSublayerQueryIdentifyProvider.html +1 -1
  141. package/docs/html/classes/tasks_identify_WFSLayerClientSideIdentifyProvider.WFSLayerClientSideIdentifyProvider.html +1 -1
  142. package/docs/html/classes/tasks_identify_WFSLayerQueryIdentifyProvider.WFSLayerQueryIdentifyProvider.html +1 -1
  143. package/docs/html/classes/tasks_identify_WMSLayerFeatureInfoIdentifyProvider.WMSLayerFeatureInfoIdentifyProvider.html +1 -1
  144. package/docs/html/classes/tasks_identify_WMSSublayerIdentifyProvider.WMSSublayerIdentifyProvider.html +1 -1
  145. package/docs/html/classes/tasks_query_ArcGISRelationship.ArcGISRelationship.html +1 -1
  146. package/docs/html/classes/tasks_query_ArcGISServiceTableQueryProvider.ArcGISServiceTableQueryProvider.html +1 -1
  147. package/docs/html/classes/tasks_query_ArcGISSublayerQueryProvider.ArcGISSublayerQueryProvider.html +1 -1
  148. package/docs/html/classes/tasks_query_BuildingComponentSublayerClientSideQueryProvider.BuildingComponentSublayerClientSideQueryProvider.html +1 -1
  149. package/docs/html/classes/tasks_query_CSVLayerClientSideQueryProvider.CSVLayerClientSideQueryProvider.html +1 -1
  150. package/docs/html/classes/tasks_query_ClientSideQueryProvider.ClientSideQueryProvider.html +1 -1
  151. package/docs/html/classes/tasks_query_FeatureLayerQueryProvider.FeatureLayerQueryProvider.html +1 -1
  152. package/docs/html/classes/tasks_query_GeoJSONLayerClientSideQueryProvider.GeoJSONLayerClientSideQueryProvider.html +1 -1
  153. package/docs/html/classes/tasks_query_GeoRSSLayerQueryProvider.GeoRSSLayerQueryProvider.html +1 -1
  154. package/docs/html/classes/tasks_query_GraphicsLayerQueryProvider.GraphicsLayerQueryProvider.html +1 -1
  155. package/docs/html/classes/tasks_query_ImageryLayerQueryProvider.ImageryLayerQueryProvider.html +1 -1
  156. package/docs/html/classes/tasks_query_KMLLayerQueryProvider.KMLLayerQueryProvider.html +1 -1
  157. package/docs/html/classes/tasks_query_MapNotesSublayerQueryProvider.MapNotesSublayerQueryProvider.html +1 -1
  158. package/docs/html/classes/tasks_query_QueryBasedRelationship.QueryBasedRelationship.html +1 -1
  159. package/docs/html/classes/tasks_query_QueryError.QueryError.html +1 -1
  160. package/docs/html/classes/tasks_query_QueryProviderBase.QueryProviderBase.html +1 -1
  161. package/docs/html/classes/tasks_query_QueryService.QueryService.html +1 -1
  162. package/docs/html/classes/tasks_query_RouteLayerQueryProvider.RouteLayerQueryProvider.html +1 -1
  163. package/docs/html/classes/tasks_query_SceneLayerClientSideQueryProvider.SceneLayerClientSideQueryProvider.html +1 -1
  164. package/docs/html/classes/tasks_query_SceneLayerQueryProvider.SceneLayerQueryProvider.html +1 -1
  165. package/docs/html/classes/tasks_query_StreamLayerClientSideQueryProvider.StreamLayerClientSideQueryProvider.html +1 -1
  166. package/docs/html/classes/tasks_query_SubtypeSublayerQueryProvider.SubtypeSublayerQueryProvider.html +1 -1
  167. package/docs/html/classes/tasks_query_WFSLayerQueryProvider.WFSLayerQueryProvider.html +1 -1
  168. package/docs/html/classes/tasks_search_ArcGISGeocoderSearchProvider.ArcGISGeocoderSearchProvider.html +1 -1
  169. package/docs/html/classes/tasks_search_GeocoderSearchProvider.GeocoderSearchProvider.html +1 -1
  170. package/docs/html/classes/tasks_search_QuerySearchProvider.QuerySearchProvider.html +1 -1
  171. package/docs/html/classes/tasks_search_SearchError.SearchError.html +1 -1
  172. package/docs/html/classes/tasks_search_SearchProviderBase.SearchProviderBase.html +1 -1
  173. package/docs/html/classes/tasks_search_SearchService.SearchService.html +1 -1
  174. package/docs/html/classes/tasks_search_SubtypeSublayerQuerySearchProvider.SubtypeSublayerQuerySearchProvider.html +1 -1
  175. package/docs/html/classes/utilities_CaseInsensitiveObservableMap.CaseInsensitiveObservableMap.html +1 -1
  176. package/docs/html/classes/utilities_CollectionProxy.CollectionProxy.html +1 -1
  177. package/docs/html/classes/utilities_CopyOnWriteCollection.CopyOnWriteCollection.html +1 -1
  178. package/docs/html/classes/utilities_GeometryServiceError.GeometryServiceError.html +1 -1
  179. package/docs/html/classes/utilities_MapTransformCollection.MapTransformCollection.html +1 -1
  180. package/docs/html/classes/utilities_ObservableMap.ObservableMap.html +1 -1
  181. package/docs/html/classes/utilities_ObservableSet.ObservableSet.html +1 -1
  182. package/docs/html/classes/utilities_ReadOnlyCollection.ReadOnlyCollection.html +1 -1
  183. package/docs/html/classes/utilities_ReadOnlyMap.ReadOnlyMap.html +1 -1
  184. package/docs/html/classes/utilities_format_date.DateFormatter.html +1 -1
  185. package/docs/html/classes/utilities_format_number.NumberFormatter.html +1 -1
  186. package/docs/html/classes/utilities_format_time.TimeFormatter.html +1 -1
  187. package/docs/html/classes/utilities_log.ConsoleLogger.html +1 -1
  188. package/docs/html/classes/utilities_log.LoggerBase.html +1 -1
  189. package/docs/html/hierarchy.html +452 -452
  190. package/docs/html/interfaces/data_Feature.FeatureProperties.html +1 -1
  191. package/docs/html/interfaces/data_Feature.FormatOptions.html +1 -1
  192. package/docs/html/interfaces/data_Feature.PresentableAttributes.html +1 -1
  193. package/docs/html/interfaces/data_FeatureList.FeatureListProperties.html +1 -1
  194. package/docs/html/interfaces/data_FeatureSet.FeatureSetProperties.html +1 -1
  195. package/docs/html/interfaces/data_FeatureSettings.PopupContentExtensionCollection.html +1 -1
  196. package/docs/html/interfaces/data_FeatureSource.FeatureSource.html +1 -1
  197. package/docs/html/interfaces/data_FeatureSource.FeatureSourceProperties.html +1 -1
  198. package/docs/html/interfaces/data_FeatureSourceBase.FeatureSourceBaseProperties.html +1 -1
  199. package/docs/html/interfaces/data_FeatureStream.FeatureStreamProperties.html +1 -1
  200. package/docs/html/interfaces/data_FieldExtension.FieldExtensionProperties.html +1 -1
  201. package/docs/html/interfaces/data_FieldExtension.FieldProperties.html +1 -1
  202. package/docs/html/interfaces/data_PopupContentExtension.ContentProperties.html +1 -1
  203. package/docs/html/interfaces/data_PopupContentExtension.PopupContentExtensionProperties.html +1 -1
  204. package/docs/html/interfaces/data_QuerySourceCapabilities.QuerySourceCapabilities.html +1 -1
  205. package/docs/html/interfaces/data_Schema.FieldCollection.html +1 -1
  206. package/docs/html/interfaces/data_Schema.FieldExtensionCollection.html +1 -1
  207. package/docs/html/interfaces/data_Schema.SchemaEvents.html +1 -1
  208. package/docs/html/interfaces/data__Relationship.Relationship.html +1 -1
  209. package/docs/html/interfaces/data__Relationship.RelationshipProperties.html +1 -1
  210. package/docs/html/interfaces/data__TableExtension.TableExtensionProperties.html +1 -1
  211. package/docs/html/interfaces/data__TableExtension.TableProperties.html +1 -1
  212. package/docs/html/interfaces/data_convert.FromCsvOptions.html +1 -1
  213. package/docs/html/interfaces/data_convert.FromShapefileOptions.html +1 -1
  214. package/docs/html/interfaces/data_convert.FromXLSXOptions.html +1 -1
  215. package/docs/html/interfaces/data_convert.ToCsvOptions.html +1 -1
  216. package/docs/html/interfaces/data_convert.ToShapefileOptions.html +1 -1
  217. package/docs/html/interfaces/data_convert.ToXLSXOptions.html +1 -1
  218. package/docs/html/interfaces/data_convert.UploadDataOptions.html +1 -1
  219. package/docs/html/interfaces/data_support__dxfInterfaces.IAttDefEntity.html +1 -1
  220. package/docs/html/interfaces/data_support__dxfInterfaces.IBaseTable.html +1 -1
  221. package/docs/html/interfaces/data_support__dxfInterfaces.ILayerTypesTable.html +1 -1
  222. package/docs/html/interfaces/data_support__dxfInterfaces.ILayersTable.html +1 -1
  223. package/docs/html/interfaces/data_support__dxfInterfaces.ILineEntityExtended.html +1 -1
  224. package/docs/html/interfaces/data_support__dxfInterfaces.ILwpolylineEntityExtended.html +1 -1
  225. package/docs/html/interfaces/data_support__dxfInterfaces.IMTextEntity.html +1 -1
  226. package/docs/html/interfaces/data_support__dxfInterfaces.IPolylineEntityExtended.html +1 -1
  227. package/docs/html/interfaces/data_support__dxfInterfaces.ITextEntityExtended.html +1 -1
  228. package/docs/html/interfaces/data_support__dxfInterfaces.IViewPortTable.html +1 -1
  229. package/docs/html/interfaces/json_AnnotationLayerJson.AnnotationLayerJson.html +1 -1
  230. package/docs/html/interfaces/json_BasemapJson.BasemapJson.html +1 -1
  231. package/docs/html/interfaces/json_BasemapLayerJson.BasemapLayerJsonBase.html +1 -1
  232. package/docs/html/interfaces/json_BingLayerJson.BingLayerJson.html +1 -1
  233. package/docs/html/interfaces/json_BuildingSceneLayerJson.BuildingSceneLayerJson.html +1 -1
  234. package/docs/html/interfaces/json_BuildingSceneSublayerJson.BuildingSceneSublayerJson.html +1 -1
  235. package/docs/html/interfaces/json_CSVLayerJson.CSVLayerJson.html +1 -1
  236. package/docs/html/interfaces/json_DomainJson.CodedValueDomainJson.html +1 -1
  237. package/docs/html/interfaces/json_DomainJson.DomainJsonBase.html +1 -1
  238. package/docs/html/interfaces/json_DomainJson.InheritedDomainJson.html +1 -1
  239. package/docs/html/interfaces/json_DomainJson.RangeDomainJson.html +1 -1
  240. package/docs/html/interfaces/json_FeatureLayerJson.FeatureLayerJson.html +1 -1
  241. package/docs/html/interfaces/json_GeoJSONLayerJson.GeoJSONLayerJson.html +1 -1
  242. package/docs/html/interfaces/json_GeoRSSLayerJson.GeoRSSLayerJson.html +1 -1
  243. package/docs/html/interfaces/json_GeometryJson.ExtentJson.html +1 -1
  244. package/docs/html/interfaces/json_GeometryJson.GeometryJsonBase.html +1 -1
  245. package/docs/html/interfaces/json_GeometryJson.MultipointJson.html +1 -1
  246. package/docs/html/interfaces/json_GeometryJson.PointJson.html +1 -1
  247. package/docs/html/interfaces/json_GeometryJson.PolygonJson.html +1 -1
  248. package/docs/html/interfaces/json_GeometryJson.PolylineJson.html +1 -1
  249. package/docs/html/interfaces/json_GroundJson.GroundJson.html +1 -1
  250. package/docs/html/interfaces/json_GroupLayerJson.GroupLayerJson.html +1 -1
  251. package/docs/html/interfaces/json_ImageServiceLayerJson.ImageServiceLayerJson.html +1 -1
  252. package/docs/html/interfaces/json_ImageServiceVectorLayerJson.ImageServiceVectorLayerJson.html +1 -1
  253. package/docs/html/interfaces/json_IntegratedMeshLayerJson.IntegratedMeshLayerJson.html +1 -1
  254. package/docs/html/interfaces/json_KMLLayerJson.KMLLayerJson.html +1 -1
  255. package/docs/html/interfaces/json_LayerDefinitionJson.DataSourceJsonBase.html +1 -1
  256. package/docs/html/interfaces/json_LayerDefinitionJson.JoinTableDataSourceJson.html +1 -1
  257. package/docs/html/interfaces/json_LayerDefinitionJson.QueryTableDataSourceJson.html +1 -1
  258. package/docs/html/interfaces/json_LayerDefinitionJson.RasterDataSourceJson.html +1 -1
  259. package/docs/html/interfaces/json_LayerDefinitionJson.TableDataSourceJson.html +1 -1
  260. package/docs/html/interfaces/json_LayerJson.BrightnessEffectFunctionJson.html +1 -1
  261. package/docs/html/interfaces/json_LayerJson.ContrastEffectFunctionJson.html +1 -1
  262. package/docs/html/interfaces/json_LayerJson.GrayscaleEffectFunctionJson.html +1 -1
  263. package/docs/html/interfaces/json_LayerJson.InvertEffectFunctionJson.html +1 -1
  264. package/docs/html/interfaces/json_LayerJson.LayerJsonBase.html +1 -1
  265. package/docs/html/interfaces/json_LayerJson.OpacityEffectFunctionJson.html +1 -1
  266. package/docs/html/interfaces/json_LayerJson.SaturateEffectFunctionJson.html +1 -1
  267. package/docs/html/interfaces/json_LayerJson.SepiaEffectFunctionJson.html +1 -1
  268. package/docs/html/interfaces/json_MapServiceLayerJson.MapServiceLayerJson.html +1 -1
  269. package/docs/html/interfaces/json_MediaLayerJson.MediaLayerJson.html +1 -1
  270. package/docs/html/interfaces/json_OpenStreetMapLayerJson.OpenStreetMapLayerJson.html +1 -1
  271. package/docs/html/interfaces/json_OperationalLayerJson.OperationalLayerJsonBase.html +1 -1
  272. package/docs/html/interfaces/json_PointCloudLayerJson.PointCloudLayerJson.html +1 -1
  273. package/docs/html/interfaces/json_PopupInfoJson.PopupElementJson.html +1 -1
  274. package/docs/html/interfaces/json_RasterDataElevationLayerJson.RasterDataElevationLayerJson.html +1 -1
  275. package/docs/html/interfaces/json_RendererJson.ClassBreaksRendererJson.html +1 -1
  276. package/docs/html/interfaces/json_RendererJson.ColorInfoJson.html +1 -1
  277. package/docs/html/interfaces/json_RendererJson.HeatmapRendererJson.html +1 -1
  278. package/docs/html/interfaces/json_RendererJson.PointCloudClassBreaksRendererJson.html +1 -1
  279. package/docs/html/interfaces/json_RendererJson.PointCloudRGBRendererJson.html +1 -1
  280. package/docs/html/interfaces/json_RendererJson.PointCloudRendererJsonBase.html +1 -1
  281. package/docs/html/interfaces/json_RendererJson.PointCloudStretchRendererJson.html +1 -1
  282. package/docs/html/interfaces/json_RendererJson.PointCloudUniqueValueRendererJson.html +1 -1
  283. package/docs/html/interfaces/json_RendererJson.PredominanceRendererJson.html +1 -1
  284. package/docs/html/interfaces/json_RendererJson.RendererJsonBase.html +1 -1
  285. package/docs/html/interfaces/json_RendererJson.RotationInfoJson.html +1 -1
  286. package/docs/html/interfaces/json_RendererJson.SimpleRendererJson.html +1 -1
  287. package/docs/html/interfaces/json_RendererJson.SizeInfoJson.html +1 -1
  288. package/docs/html/interfaces/json_RendererJson.TemporalRendererJson.html +1 -1
  289. package/docs/html/interfaces/json_RendererJson.TransparencyInfoJson.html +1 -1
  290. package/docs/html/interfaces/json_RendererJson.UniqueValueFromStyleRendererJson.html +1 -1
  291. package/docs/html/interfaces/json_RendererJson.UniqueValueRendererJson.html +1 -1
  292. package/docs/html/interfaces/json_RendererJson.VectorFieldRendererJson.html +1 -1
  293. package/docs/html/interfaces/json_RendererJson.VisualVariableJsonBase.html +1 -1
  294. package/docs/html/interfaces/json_SceneLayerJson.SceneLayerJson.html +1 -1
  295. package/docs/html/interfaces/json_StreamLayerJson.StreamLayerJson.html +1 -1
  296. package/docs/html/interfaces/json_SublayerJson.SublayerJson.html +1 -1
  297. package/docs/html/interfaces/json_SubtypeGroupLayerJson.SubtypeGroupLayerJson.html +1 -1
  298. package/docs/html/interfaces/json_SubtypeGroupLayerJson.SubtypeSubtypeGroupLayerJson.html +1 -1
  299. package/docs/html/interfaces/json_SubtypeSublayerJson.SubtypeSublayerJson.html +1 -1
  300. package/docs/html/interfaces/json_SymbolJson.CIMSymbolJson.html +1 -1
  301. package/docs/html/interfaces/json_SymbolJson.CIMSymbolReferenceJson.html +1 -1
  302. package/docs/html/interfaces/json_SymbolJson.ExtrudeSymbol3DLayerJson.html +1 -1
  303. package/docs/html/interfaces/json_SymbolJson.FillSymbol3DLayerJson.html +1 -1
  304. package/docs/html/interfaces/json_SymbolJson.IconSymbol3DLayerJson.html +1 -1
  305. package/docs/html/interfaces/json_SymbolJson.LabelSymbol3DJson.html +1 -1
  306. package/docs/html/interfaces/json_SymbolJson.LineSymbol3DJson.html +1 -1
  307. package/docs/html/interfaces/json_SymbolJson.LineSymbol3DLayerJson.html +1 -1
  308. package/docs/html/interfaces/json_SymbolJson.MeshSymbol3DJson.html +1 -1
  309. package/docs/html/interfaces/json_SymbolJson.ObjectSymbol3DLayerJson.html +1 -1
  310. package/docs/html/interfaces/json_SymbolJson.PathSymbol3DLayerJson.html +1 -1
  311. package/docs/html/interfaces/json_SymbolJson.PictureFillSymbolJson.html +1 -1
  312. package/docs/html/interfaces/json_SymbolJson.PictureMarkerSymbolJson.html +1 -1
  313. package/docs/html/interfaces/json_SymbolJson.PointSymbol3DJson.html +1 -1
  314. package/docs/html/interfaces/json_SymbolJson.PolygonSymbol3DJson.html +1 -1
  315. package/docs/html/interfaces/json_SymbolJson.SimpleFillSymbolJson.html +1 -1
  316. package/docs/html/interfaces/json_SymbolJson.SimpleLineSymbolJson.html +1 -1
  317. package/docs/html/interfaces/json_SymbolJson.SimpleMarkerSymbolJson.html +1 -1
  318. package/docs/html/interfaces/json_SymbolJson.SketchEdgesJson.html +1 -1
  319. package/docs/html/interfaces/json_SymbolJson.SolidEdgesJson.html +1 -1
  320. package/docs/html/interfaces/json_SymbolJson.Symbol3DJsonBase.html +1 -1
  321. package/docs/html/interfaces/json_SymbolJson.Symbol3DLayerJsonBase.html +1 -1
  322. package/docs/html/interfaces/json_SymbolJson.SymbolJsonBase.html +1 -1
  323. package/docs/html/interfaces/json_SymbolJson.TextSymbol3DLayerJson.html +1 -1
  324. package/docs/html/interfaces/json_SymbolJson.TextSymbolJson.html +1 -1
  325. package/docs/html/interfaces/json_TableJson.TableJson.html +1 -1
  326. package/docs/html/interfaces/json_TiledElevationServiceLayerJson.TiledElevationServiceLayerJson.html +1 -1
  327. package/docs/html/interfaces/json_TiledImageServiceLayerJson.TiledImageServiceLayerJson.html +1 -1
  328. package/docs/html/interfaces/json_TiledMapServiceLayerJson.TiledMapServiceLayerJson.html +1 -1
  329. package/docs/html/interfaces/json_VectorTileLayerJson.VectorTileLayerJson.html +1 -1
  330. package/docs/html/interfaces/json_WFSLayerJson.WFSLayerJson.html +1 -1
  331. package/docs/html/interfaces/json_WMSLayerJson.WMSLayerJson.html +1 -1
  332. package/docs/html/interfaces/json_WMSSublayerJson.WMSSublayerJson.html +1 -1
  333. package/docs/html/interfaces/json_WebMapJson.WebMapJson.html +1 -1
  334. package/docs/html/interfaces/json_WebMapJson.WebMapJsonBase.html +1 -1
  335. package/docs/html/interfaces/json_WebSceneJson.WebSceneJson.html +1 -1
  336. package/docs/html/interfaces/json_WebTileLayerJson.WebTileLayerJson.html +1 -1
  337. package/docs/html/interfaces/layer-preset_LayerPreset.LayerPresetProperties.html +1 -1
  338. package/docs/html/interfaces/mapping_ArcGISSublayerExtension.ArcGISSublayerExtensionCollection.html +1 -1
  339. package/docs/html/interfaces/mapping_ArcGISSublayerExtension.ArcGISSublayerExtensionProperties.html +1 -1
  340. package/docs/html/interfaces/mapping_ArcGISSublayerExtension.ArcGISSublayerProperties.html +1 -1
  341. package/docs/html/interfaces/mapping_BasemapExtension.BasemapExtensionProperties.html +1 -1
  342. package/docs/html/interfaces/mapping_BasemapExtension.BasemapProperties.html +1 -1
  343. package/docs/html/interfaces/mapping_Bookmark.BookmarkProperties.html +1 -1
  344. package/docs/html/interfaces/mapping_BuildingComponentSublayerExtension.BuildingComponentSublayerExtensionProperties.html +1 -1
  345. package/docs/html/interfaces/mapping_BuildingGroupSublayerExtension.BuildingGroupSublayerExtensionProperties.html +1 -1
  346. package/docs/html/interfaces/mapping_BuildingSceneLayerExtension.BuildingSceneLayerExtensionProperties.html +1 -1
  347. package/docs/html/interfaces/mapping_BuildingSceneLayerExtension.BuildingSceneLayerProperties.html +1 -1
  348. package/docs/html/interfaces/mapping_BuildingSceneLayerExtension.BuildingSublayerExtensionCollection.html +1 -1
  349. package/docs/html/interfaces/mapping_BuildingSublayerExtension.BuildingSublayerExtensionProperties.html +1 -1
  350. package/docs/html/interfaces/mapping_BuildingSublayerExtension.BuildingSublayerProperties.html +1 -1
  351. package/docs/html/interfaces/mapping_CSVLayerExtension.CSVLayerExtensionProperties.html +1 -1
  352. package/docs/html/interfaces/mapping_ElevationLayerExtension.ElevationLayerExtensionProperties.html +1 -1
  353. package/docs/html/interfaces/mapping_FeatureLayerExtension.FeatureLayerExtensionProperties.html +1 -1
  354. package/docs/html/interfaces/mapping_FeatureLayerExtension.FeatureLayerProperties.html +1 -1
  355. package/docs/html/interfaces/mapping_FeatureLayerExtensionBase.FeatureLayerBaseProperties.html +1 -1
  356. package/docs/html/interfaces/mapping_FeatureLayerExtensionBase.FeatureLayerExtensionBaseProperties.html +1 -1
  357. package/docs/html/interfaces/mapping_GeoJSONLayerExtension.GeoJSONLayerExtensionProperties.html +1 -1
  358. package/docs/html/interfaces/mapping_GeoRSSLayerExtension.GeoRSSLayerExtensionProperties.html +1 -1
  359. package/docs/html/interfaces/mapping_GraphicsLayerExtension.GraphicsLayerExtensionProperties.html +1 -1
  360. package/docs/html/interfaces/mapping_GroundExtension.GroundExtensionProperties.html +1 -1
  361. package/docs/html/interfaces/mapping_GroundExtension.GroundProperties.html +1 -1
  362. package/docs/html/interfaces/mapping_GroupLayerExtension.GroupLayerExtensionProperties.html +1 -1
  363. package/docs/html/interfaces/mapping_ImageryLayerExtension.ImageryLayerExtensionProperties.html +1 -1
  364. package/docs/html/interfaces/mapping_ImageryTileLayerExtension.ImageryTileLayerExtensionProperties.html +1 -1
  365. package/docs/html/interfaces/mapping_IntegratedMeshLayerExtension.IntegratedMeshLayerExtensionProperties.html +1 -1
  366. package/docs/html/interfaces/mapping_KMLLayerExtension.KMLLayerExtensionProperties.html +1 -1
  367. package/docs/html/interfaces/mapping_KMLSublayerExtension.KMLSublayerExtensionCollection.html +1 -1
  368. package/docs/html/interfaces/mapping_KMLSublayerExtension.KMLSublayerExtensionProperties.html +1 -1
  369. package/docs/html/interfaces/mapping_MapExtension.MapExtensionEvents.html +1 -1
  370. package/docs/html/interfaces/mapping_MapExtension.MapExtensionProperties.html +1 -1
  371. package/docs/html/interfaces/mapping_MapExtension.TableExtensionCollection.html +1 -1
  372. package/docs/html/interfaces/mapping_MapImageLayerExtension.MapImageLayerExtensionProperties.html +1 -1
  373. package/docs/html/interfaces/mapping_MapImageSublayerExtension.MapImageSublayerExtensionProperties.html +1 -1
  374. package/docs/html/interfaces/mapping_MapImageSublayerExtension.MapImageSublayerProperties.html +1 -1
  375. package/docs/html/interfaces/mapping_MapNotesLayerExtension.MapNotesLayerExtensionProperties.html +1 -1
  376. package/docs/html/interfaces/mapping_MapNotesSublayerExtension.MapNotesSublayerExtensionCollection.html +1 -1
  377. package/docs/html/interfaces/mapping_MapNotesSublayerExtension.MapNotesSublayerExtensionProperties.html +1 -1
  378. package/docs/html/interfaces/mapping_MediaLayerExtension.MediaLayerExtensionProperties.html +1 -1
  379. package/docs/html/interfaces/mapping_OpenStreetMapLayerExtension.OpenStreetMapLayerExtensionProperties.html +1 -1
  380. package/docs/html/interfaces/mapping_PointCloudLayerExtension.PointCloudLayerExtensionProperties.html +1 -1
  381. package/docs/html/interfaces/mapping_PointCloudLayerExtension.PointCloudLayerProperties.html +1 -1
  382. package/docs/html/interfaces/mapping_RouteLayerExtension.RouteLayerExtensionProperties.html +1 -1
  383. package/docs/html/interfaces/mapping_SceneLayerExtension.SceneLayerExtensionProperties.html +1 -1
  384. package/docs/html/interfaces/mapping_StreamLayerExtension.StreamLayerExtensionProperties.html +1 -1
  385. package/docs/html/interfaces/mapping_SubtypeGroupLayerExtension.SubtypeGroupLayerExtensionProperties.html +1 -1
  386. package/docs/html/interfaces/mapping_SubtypeSublayerExtension.SubtypeSublayerExtensionCollection.html +1 -1
  387. package/docs/html/interfaces/mapping_SubtypeSublayerExtension.SubtypeSublayerExtensionProperties.html +1 -1
  388. package/docs/html/interfaces/mapping_SubtypeSublayerExtension.SubtypeSublayerProperties.html +1 -1
  389. package/docs/html/interfaces/mapping_TileLayerExtension.TileLayerExtensionProperties.html +1 -1
  390. package/docs/html/interfaces/mapping_TileSublayerExtension.TileSublayerExtensionProperties.html +1 -1
  391. package/docs/html/interfaces/mapping_TileSublayerExtension.TileSublayerProperties.html +1 -1
  392. package/docs/html/interfaces/mapping_VectorTileLayerExtension.VectorTileLayerExtensionProperties.html +1 -1
  393. package/docs/html/interfaces/mapping_WFSLayerExtension.WFSLayerExtensionProperties.html +1 -1
  394. package/docs/html/interfaces/mapping_WMSLayerExtension.WMSLayerExtensionProperties.html +1 -1
  395. package/docs/html/interfaces/mapping_WMSSublayerExtension.WMSSublayerExtensionCollection.html +1 -1
  396. package/docs/html/interfaces/mapping_WMSSublayerExtension.WMSSublayerExtensionProperties.html +1 -1
  397. package/docs/html/interfaces/mapping_WMSSublayerExtension.WMSSublayerProperties.html +1 -1
  398. package/docs/html/interfaces/mapping_WMTSLayerExtension.WMTSLayerExtensionProperties.html +1 -1
  399. package/docs/html/interfaces/mapping_WebTileLayerExtension.WebTileLayerExtensionProperties.html +1 -1
  400. package/docs/html/interfaces/mapping__LayerExtension.LayerExtensionProperties.html +1 -1
  401. package/docs/html/interfaces/mapping__SublayerExtension.SublayerExtensionProperties.html +1 -1
  402. package/docs/html/interfaces/mapping__SublayerExtension.SublayerProperties.html +1 -1
  403. package/docs/html/interfaces/mapping_support__LayerExtensionCollection.LayerExtensionCollection.html +1 -1
  404. package/docs/html/interfaces/mapping_support__SublayerExtensionCollection.SublayerExtensionCollection.html +1 -1
  405. package/docs/html/interfaces/menus_Menu.MenuProperties.html +1 -1
  406. package/docs/html/interfaces/menus_MenuItem.MenuItemProperties.html +1 -1
  407. package/docs/html/interfaces/support_ArcGISRequestHelper.ArcGISRequestHelperResponse.html +1 -1
  408. package/docs/html/interfaces/support_InitializableBase.Initializable.html +1 -1
  409. package/docs/html/interfaces/support_InitializableBase.InitializableBaseEvents.html +1 -1
  410. package/docs/html/interfaces/support_InitializableBase.InitializableBaseProperties.html +1 -1
  411. package/docs/html/interfaces/support_InitializableCollectionProxy.InitializableCollection.html +1 -1
  412. package/docs/html/interfaces/support_Serializable.Serializable.html +1 -1
  413. package/docs/html/interfaces/support_Settings.SettingsEvents.html +1 -1
  414. package/docs/html/interfaces/support__restApiJson.RestApiMapServiceTimeInfo.html +1 -1
  415. package/docs/html/interfaces/support__restApiJson.RestApiServiceTimeInfo.html +1 -1
  416. package/docs/html/interfaces/support_esri.LayerWithSublayers.html +1 -1
  417. package/docs/html/interfaces/support_esri.SublayerLike.html +1 -1
  418. package/docs/html/interfaces/support_observableUtils.WatchEachOptions.html +1 -1
  419. package/docs/html/interfaces/support_observableUtils.WatchOptions.html +1 -1
  420. package/docs/html/interfaces/tasks_geocoding_ArcGISGeocoder.ArcGISGeocoderProperties.html +1 -1
  421. package/docs/html/interfaces/tasks_geocoding_Geocoder.GeocoderCapabilities.html +1 -1
  422. package/docs/html/interfaces/tasks_geocoding_Geocoder.GeocoderProperties.html +1 -1
  423. package/docs/html/interfaces/tasks_query_ArcGISRelationship.ArcGISRelationshipProperties.html +1 -1
  424. package/docs/html/interfaces/tasks_query_QueryBasedRelationship.QueryBasedRelationshipProperties.html +1 -1
  425. package/docs/html/interfaces/utilities_ObservableMap.MapAfterItemEvent.html +1 -1
  426. package/docs/html/interfaces/utilities_ObservableSet.SetAfterItemEvent.html +1 -1
  427. package/docs/html/interfaces/utilities__layers.LayerWithLegendEnabledProperty.html +1 -1
  428. package/docs/html/interfaces/utilities__layers.TimeAwareLayer.html +1 -1
  429. package/docs/html/interfaces/utilities_collection.AfterItemChangeEvent.html +1 -1
  430. package/docs/html/interfaces/utilities_format_FormatSettings.FormatSettings.html +1 -1
  431. package/docs/html/interfaces/utilities_format_date.DateFormatterProperties.html +1 -1
  432. package/docs/html/interfaces/utilities_format_date.DateSettings.html +1 -1
  433. package/docs/html/interfaces/utilities_format_number.NumberFormatterProperties.html +1 -1
  434. package/docs/html/interfaces/utilities_format_number.NumberSettings.html +1 -1
  435. package/docs/html/interfaces/utilities_format_string.FormatOptions.html +1 -1
  436. package/docs/html/interfaces/utilities_format_time.TimeFormatterProperties.html +1 -1
  437. package/docs/html/interfaces/utilities_format_time.TimeSettings.html +1 -1
  438. package/docs/html/interfaces/utilities_log.LogMessageOptions.html +1 -1
  439. package/docs/html/interfaces/utilities_log.LogMessageResourceOptions.html +1 -1
  440. package/docs/html/modules/data_Feature.html +2 -2
  441. package/docs/html/variables/data_Feature.defaultFeatureFactory.html +38 -0
  442. package/docs/html/variables/version.version.html +1 -1
  443. package/mapping/support/ogc.js +1 -1
  444. package/package.json +1 -1
  445. package/tasks/geocoding/ArcGISGeocoder.js +1 -1
  446. package/tasks/identify/ImageryLayerIdentifyProvider.js +1 -1
  447. package/tasks/identify/WMSLayerFeatureInfoIdentifyProvider.js +1 -1
  448. package/tasks/search/support/_querySearchProviderUtils.js +1 -1
  449. package/utilities/query.js +1 -1
  450. package/version.d.ts +1 -1
  451. package/version.js +1 -1
@@ -2315,7 +2315,7 @@
2315
2315
  "description": "Possible modes of failure when there is an error resolving or initializing an\nitem."
2316
2316
  },
2317
2317
  "Feature": {
2318
- "description": "Represents a record in a {@link data /FeatureSource!FeatureSource}. Both\nspatial and non-spatial features have attributes, while only spatial features\nhave geometry."
2318
+ "description": "Represents a record in a {@link data /FeatureSource!FeatureSource}. Both\nspatial and non-spatial features have attributes, while only spatial features\nhave geometry. When creating features directly via the constructor you will\nbe responsible for destroying the feature when it is no longer needed. If you\ncreate a feature via {@link data /Feature!Feature.create} the feature will be\nautomatically cleaned up when it is no longer referenced."
2319
2319
  },
2320
2320
  "FeatureLayerJson": {
2321
2321
  "description": "Feature layers can be created by referencing a layer from either a map\nservice or a feature service or by specifying a feature collection object.\nUse a map service if you just want to retrieve geometries and attributes from\nthe server and symbolize them yourself. Use a feature service if you want to\ntake advantage of symbols from the service's source map document. Also, use a\nfeature service if you plan on doing editing with the feature layer. Feature\nlayers honor any feature templates configured in the source map document.\nFeature collection objects are used to create a feature layer based on the\nsupplied definition.\n\nSee\n{@link https://developers.arcgis.com/web-map-specification/objects/featureLayer/}\n{@link https://developers.arcgis.com/web-scene-specification/objects/featureLayer/}."
package/data/Feature.d.ts CHANGED
@@ -21,6 +21,13 @@ import { FeatureSettings } from "./FeatureSettings.js";
21
21
  import type { FeatureSource } from "./FeatureSource.js";
22
22
  import { type SchemaProperties, Schema } from "./Schema.js";
23
23
  import type { Relationship } from "./_Relationship.js";
24
+ /**
25
+ * The default Feature factory that will be used whenever a Feature needs to be
26
+ * created.
27
+ */
28
+ export declare const defaultFeatureFactory: {
29
+ create: (properties?: FeatureProperties) => Feature;
30
+ };
24
31
  /**
25
32
  * The name of a special attribute that will be added to search or geocode
26
33
  * results indicating the strength of the match. Values range from 0 to 100.
@@ -80,57 +87,60 @@ export interface FetchRelatedFeaturesOptions {
80
87
  /**
81
88
  * Represents a record in a {@link data/FeatureSource!FeatureSource}. Both
82
89
  * spatial and non-spatial features have attributes, while only spatial features
83
- * have geometry.
90
+ * have geometry. When creating features directly via the constructor you will
91
+ * be responsible for destroying the feature when it is no longer needed. If you
92
+ * create a feature via {@link data/Feature!Feature.create} the feature will be
93
+ * automatically cleaned up when it is no longer referenced.
84
94
  */
85
95
  export declare class Feature extends EntityBase<FeatureProperties> {
86
96
  /**
87
- * The feature's attributes, keyed by field name.
97
+ * The factory that will be used whenever a new table extension needs to be
98
+ * created. Applications can supply their own factory to customize table
99
+ * extension creation.
88
100
  */
89
- readonly attributes: CaseInsensitiveObservableMap<unknown>;
101
+ static factory: {
102
+ create: (properties?: FeatureProperties) => Feature;
103
+ };
90
104
  /**
91
- * The feature's geometry. For non-spatial features, this will be undefined.
105
+ * @inheritDoc
92
106
  */
93
- get geometry(): GeometryUnion | undefined;
94
- set geometry(value: GeometryUnion | undefined);
107
+ protected readonly _itemType: string;
95
108
  /**
96
- * Settings for this feature.
109
+ * Attachments associated with this feature. See {@link fetchAttachments}.
97
110
  */
98
- readonly settings: FeatureSettings;
111
+ get attachments(): Collection<Attachment>;
99
112
  /**
100
- * Metadata about the feature, such as fields, domains, geometry type, etc.
113
+ * Indicates whether attachments have been fetched at least once.
101
114
  */
102
- readonly schema: Schema;
115
+ get attachmentsInitialized(): boolean;
103
116
  /**
104
- * Attachments associated with this feature. See {@link fetchAttachments}.
117
+ * The feature's attributes, keyed by field name.
105
118
  */
106
- readonly attachments: Collection<Attachment>;
119
+ get attributes(): CaseInsensitiveObservableMap<unknown>;
120
+ /**
121
+ * A human-readable description for the feature.
122
+ */
123
+ get description(): string;
107
124
  /**
108
125
  * The Expression values associated with this feature. See
109
126
  * {@link fetchExpressionInfos}.
110
127
  */
111
- readonly expressionFieldValues: ReadOnlyMap<string, unknown>;
128
+ get expressionFieldValues(): ReadOnlyMap<string, unknown>;
112
129
  /**
113
- * @inheritDoc
130
+ * Indicates whether async Arcade expressions have been evaluated at least
131
+ * once.
114
132
  */
115
- protected readonly _itemType: string;
133
+ get expressionsInitialized(): boolean;
134
+ /**
135
+ * The feature's geometry. For non-spatial features, this will be undefined.
136
+ */
137
+ get geometry(): GeometryUnion | undefined;
138
+ set geometry(value: GeometryUnion | undefined);
116
139
  /**
117
140
  * The type of geometry. This property will be undefined if the data is not
118
141
  * spatial.
119
142
  */
120
143
  get geometryType(): string;
121
- /**
122
- * The source of this feature.
123
- */
124
- get source(): FeatureSource;
125
- set source(value: FeatureSource);
126
- /**
127
- * The attribute value of the Feature's OBJECTID (oid) field.
128
- */
129
- get primaryKey(): string | undefined;
130
- /**
131
- * Determines whether this feature has a global ID field.
132
- */
133
- get hasGlobalId(): boolean;
134
144
  /**
135
145
  * Returns the feature's global ID if set and supported by its underlying
136
146
  * source. If the feature's source does not support global IDs, then reading
@@ -140,23 +150,23 @@ export declare class Feature extends EntityBase<FeatureProperties> {
140
150
  get globalId(): string | undefined;
141
151
  set globalId(value: string | undefined);
142
152
  /**
143
- * Feature attributes that have been formatted for display. Read-only.
144
- */
145
- get presentableAttributes(): PresentableAttributes;
146
- /**
147
- * A human readable title for the feature.
148
- */
149
- get title(): string;
150
- /**
151
- * A human-readable description for the feature.
153
+ * Determines whether this feature has a global ID field.
152
154
  */
153
- get description(): string;
155
+ get hasGlobalId(): boolean;
154
156
  /**
155
157
  * Hyperlinks associated with the feature. Note: This collection is
156
158
  * read-only. To change hyperlinks, modify the hyperlinkTemplates setting
157
159
  * instead.
158
160
  */
159
161
  get hyperlinks(): Collection<Hyperlink>;
162
+ /**
163
+ * Feature attributes that have been formatted for display. Read-only.
164
+ */
165
+ get presentableAttributes(): PresentableAttributes;
166
+ /**
167
+ * The attribute value of the Feature's OBJECTID (oid) field.
168
+ */
169
+ get primaryKey(): string | undefined;
160
170
  /**
161
171
  * Gets features that are related to this feature. Returns sets of related
162
172
  * features keyed by the relationship that they came from. In order to make
@@ -164,41 +174,74 @@ export declare class Feature extends EntityBase<FeatureProperties> {
164
174
  */
165
175
  get relatedFeatures(): ObservableMap<Relationship, FeatureSet>;
166
176
  /**
167
- * The Esri API FeatureType object that is associated with this feature.
177
+ * Indicates whether related features have been fetched at least once, if
178
+ * this feature has relationships.
168
179
  */
169
- get type(): FeatureType | undefined;
180
+ get relatedFeaturesInitialized(): boolean;
170
181
  /**
171
- * The Esri API Subtype object that is associated with this feature.
182
+ * Metadata about the feature, such as fields, domains, geometry type, etc.
172
183
  */
173
- get subtype(): Subtype | undefined;
184
+ get schema(): Schema;
185
+ private set schema(value);
174
186
  /**
175
- * Indicates whether attachments have been fetched at least once.
187
+ * Settings for this feature.
176
188
  */
177
- get attachmentsInitialized(): boolean;
189
+ get settings(): FeatureSettings;
190
+ private set settings(value);
178
191
  /**
179
- * Indicates whether related features have been fetched at least once, if
180
- * this feature has relationships.
192
+ * The source of this feature.
181
193
  */
182
- get relatedFeaturesInitialized(): boolean;
194
+ get source(): FeatureSource;
195
+ set source(value: FeatureSource);
183
196
  /**
184
- * Indicates whether async Arcade expressions have been evaluated at least
185
- * once.
197
+ * The Esri API Subtype object that is associated with this feature.
186
198
  */
187
- get expressionsInitialized(): boolean;
199
+ get subtype(): Subtype | undefined;
200
+ /**
201
+ * A human readable title for the feature.
202
+ */
203
+ get title(): string;
204
+ /**
205
+ * The Esri API FeatureType object that is associated with this feature.
206
+ */
207
+ get type(): FeatureType | undefined;
188
208
  private get _title();
189
209
  private get _description();
190
- private _geometry;
191
- private _source;
192
- private _presentableAttributes;
193
- private _hyperlinks;
194
- private _featureHydrationStatus;
195
- private readonly _relatedFeatures;
196
- private readonly _expressionFieldValues;
197
- private _expressionValuesUpdatePending;
210
+ private _attachments;
198
211
  private _attachmentsInitialized;
212
+ private _attributes;
213
+ private _expressionFieldValues;
199
214
  private _expressionsInitialized;
215
+ private _expressionValuesUpdatePending;
216
+ private _featureHydrationStatus;
217
+ private _geometry;
218
+ private _hyperlinks;
219
+ private _presentableAttributes;
220
+ private _schema;
221
+ private _settings;
222
+ private _source;
223
+ private readonly _expressionFieldValuesBacking;
200
224
  private readonly _initializedRelationships;
225
+ private readonly _relatedFeatures;
226
+ /**
227
+ * Self references resolve to the proxy object when the feature is wrapped
228
+ * in a Proxy. This will defeat the finalizationRegistry and prevent the
229
+ * feature from being cleaned up when it is no longer referenced. To avoid
230
+ * this, we store a reference to the feature instance itself in a private
231
+ * property that is not proxied and use it for all internal references to
232
+ * the feature.
233
+ */
234
+ private readonly _self;
201
235
  constructor(properties?: FeatureProperties);
236
+ /**
237
+ * Creates an instance of {@link data/Feature!Feature} based on the supplied
238
+ * properties. This feature will be wrapped in a Proxy that will be
239
+ * automatically cleaned up via a finalizationRegistry when it is no longer
240
+ * referenced.
241
+ *
242
+ * @param properties The feature properties.
243
+ */
244
+ static create(properties?: FeatureProperties): Feature;
202
245
  /**
203
246
  * Same as {@link utilities/format/string!StringFormatter.format}, except
204
247
  * that the format string may also contain field format items, which have
@@ -263,8 +306,10 @@ export declare class Feature extends EntityBase<FeatureProperties> {
263
306
  * delete.
264
307
  */
265
308
  deleteAttachments(attachments: (Attachment | string)[]): Promise<void>;
309
+ protected _onDestroy(): Promise<void>;
266
310
  protected _getSerializableProperties(): PropertyDefs<FeatureProperties>;
267
311
  protected _onInitialize(): Promise<void>;
312
+ private _initializeSchemaAndSettings;
268
313
  private _findRelationshipIds;
269
314
  }
270
315
  /**
package/data/Feature.js CHANGED
@@ -1 +1 @@
1
- import{__decorate as e}from"tslib";import t from"@arcgis/core/Graphic";import s from"@arcgis/core/core/Collection";import{fromJSON as i}from"@arcgis/core/geometry/support/jsonUtils";import{EntityBase as r}from"../Entity.js";import{Hyperlink as a}from"../Hyperlink.js";import{InvalidOperationError as o}from"../InvalidOperationError.js";import{isLayerExtension as n,isSublayerExtension as l,isTableExtension as h,ItemType as u}from"../ItemType.js";import{handles as p}from"../support/HandlesMixin.js";import{serializable as c}from"../support/Serializable.js";import{createIHandle as m,notifyChange as f,onWatch as d,watch as g,watchEvent as y}from"../support/observableUtils.js";import{CaseInsensitiveObservableMap as _}from"../utilities/CaseInsensitiveObservableMap.js";import{MapTransformCollection as b}from"../utilities/MapTransformCollection.js";import{ObservableMap as F}from"../utilities/ObservableMap.js";import{ReadOnlyMap as x}from"../utilities/ReadOnlyMap.js";import{Time as w}from"../utilities/Time.js";import{flatten as v,groupBy as I}from"../utilities/array.js";import{checkArg as S}from"../utilities/checkArg.js";import{compare as A}from"../utilities/collection.js";import{isCodedValueDomain as z,isGeometry as E}from"../utilities/esri.js";import{getArcadeExpressionFromField as j,getRelationshipFromField as T,isArcadeExpressionField as k}from"../utilities/field.js";import{esriFormatToGeocortexFormat as R,parse as O}from"../utilities/format/date.js";import{NumberFormat as M}from"../utilities/format/formats.js";import{parse as N}from"../utilities/format/number.js";import{format as D}from"../utilities/format/string.js";import{esriFormatToGeocortexFormat as V,parse as U}from"../utilities/format/time.js";import{find as P,map as C}from"../utilities/iterable.js";import{getLogger as G}from"../utilities/log.js";import{map as H}from"../utilities/promise.js";import{caseInsensitiveEquals as L}from"../utilities/string.js";import{FeatureSettings as Z}from"./FeatureSettings.js";import{Schema as $}from"./Schema.js";const K=G("geocortex.api.data.Feature");export const SCORE_FIELD="_score";export const SCORE_FIELD_ORIGINAL="_score_original";let J=class extends r{attributes;get geometry(){return this._geometry}set geometry(e){this._geometry=E(e)||!e?e:i(e),this.schema.spatialReference=this._geometry?.spatialReference,f(this,"geometryType")}settings;schema;attachments;expressionFieldValues;_itemType=u.FEATURE;get geometryType(){return this.geometry?this.geometry.type:void 0}get source(){return this._source}set source(e){this._source===e||null==this._source&&null==e||(this.settings.parent===this._source?.featureSettings&&(this.settings.parent=void 0),this.schema.parent===this._source?.schema&&(this.schema.parent=void 0),this._source=e,this.settings.parent||(this.settings.parent=e?e.featureSettings:void 0),this.schema.parent||(this.schema.parent=e?e.schema:void 0),f(this,"attachmentsInitialized"),f(this,"relatedFeaturesInitialized"))}get primaryKey(){const{primaryKeyField:e}=this.schema;if(!e)return;const t=this.attributes.get(e);return null!=t?`${t}`:void 0}get hasGlobalId(){return!!this.schema.fields.find(e=>"global-id"===e.type)}get globalId(){const e=this.schema.fields.find(e=>"global-id"===e.type);return e?this.attributes.get(e.name):void 0}set globalId(e){const t=this.schema.fields.find(e=>"global-id"===e.type);if(!t)throw new o("Cannot set global ID on feature -- no global ID field.");this.attributes.set(t.name,e)}get presentableAttributes(){return null==this._presentableAttributes&&(this._presentableAttributes=new q(this)),this._presentableAttributes}get title(){return this.format(this._title||"")}get description(){return this.format(this._description)}get hyperlinks(){return this._hyperlinks||(this._hyperlinks=new re(this))}get relatedFeatures(){return this._relatedFeatures}get type(){if(this.schema.typeIdField&&this.attributes.has(this.schema.typeIdField)){const e=this.attributes.get(this.schema.typeIdField);return this.schema.types.find(t=>t.id===e)}}get subtype(){if(this.schema.subtypeField&&this.attributes.has(this.schema.subtypeField)){const e=this.attributes.get(this.schema.subtypeField);return this.schema.subtypes.find(t=>t.code===e)}}get attachmentsInitialized(){return!this.source||this._attachmentsInitialized}get relatedFeaturesInitialized(){return!this.source||this.source.relationships.every(e=>this._initializedRelationships.has(e))}get expressionsInitialized(){return!this.settings.popupTemplate?.expressionInfos?.length||this._expressionsInitialized}get _hydrationStatus(){return this._featureHydrationStatus?this._featureHydrationStatus:this.source?.capabilities?.supportsQuery&&1===this.attributes.size&&void 0!==this.primaryKey?"dehydrated":"hydrated"}set _hydrationStatus(e){this._featureHydrationStatus=e}get _key(){return`${this.source?.id}//${this.primaryKey??this.globalId??this.id}`}get _title(){let e;return this.settings.popupTemplate&&(e="function"==typeof this.settings.popupTemplate.title?this.settings.popupTemplate.title():this.settings.popupTemplate.title),e||this.schema.displayField&&this.presentableAttributes.get(this.schema.displayField)||""}get _description(){if(this.settings.popupTemplate?.content){if("string"==typeof this.settings.popupTemplate.content)return this.settings.popupTemplate.content;if(Array.isArray(this.settings.popupTemplate.content)){const e=this.settings.popupTemplate.content.find(e=>"text"===e.type);if(e)return e.text}}return""}_geometry;_source;_presentableAttributes;_hyperlinks;_featureHydrationStatus;_relatedFeatures;_expressionFieldValues=new F;_expressionValuesUpdatePending=!1;_attachmentsInitialized=!1;_expressionsInitialized=!1;_initializedRelationships=new WeakSet;constructor(e){super(e),this.settings=new Z,this.settings._setFeature(this),this.schema=new $,this.schema._featureSettings=this.settings,this.attachments=new s,this.attributes=new _,this._relatedFeatures=new F,this.expressionFieldValues=new W(this._expressionFieldValues,this),this._handles.add([g(this.settings,"popupTemplate",()=>{this._expressionsInitialized=!1,f(this,"expressionsInitialized")},{sync:!0}),d(this,"title",()=>{const e=g(this.settings,"popupTemplate.title",()=>f(this,"title"),{sync:!0}),t=this.presentableAttributes.on("change",()=>f(this,"title"));return m([e,t])}),d(this,"description",()=>{const e=g(this.settings,"popupTemplate.content",()=>f(this,"description"),{sync:!0}),t=this.presentableAttributes.on("change",()=>f(this,"description"));return m([e,t])}),d(this,"relatedFeaturesInitialized",()=>y(this,"source.relationships",["after-changes",()=>{f(this,"relatedFeaturesInitialized")}]))])}format(e,...t){let s="string"==typeof e?{format:e}:e;S("options",s).isNotMissing();const{format:i}=s;S("format",i).isNotMissing();let r=s.format.replace(ee,te);return r=r.replace(X,(e,t,i,r,a)=>oe(this,t||i,r,{...s,format:a?`{0:${a}}`:"{0}"})),r=r.replace(se,"{{"),s={...s},s.format=r,D(s,...t)}clearExpressionInfos(){this._expressionFieldValues.clear()}toGraphic(){return toGraphic(this)}async fetchExpressionInfos(e=!1){const{expressionInfos:t}=this.settings.popupTemplate??{};if(!t)return;const{runAsyncArcadeExpression:s}=await import("../utilities/arcade.js");if(await Promise.all(t.map(async e=>{try{const t=this.source?.layer??this.source?.sublayer;let i=this.source?.mapExtension;if(!i){const e=this.source?.layerExtension;i=e?.mapExtension}this._expressionFieldValues.set(e.name,await s(e.expression,{layer:t,map:i?.map,feature:this,spatialReference:this.schema.spatialReference}))}catch(t){t instanceof Error&&K.error({message:"Error evaluating expression '{0}': {1}.",error:t},e.name,t.message),this._expressionFieldValues.set(e.name,ie)}})),e)return this.attributes.on("change",async e=>{this._expressionValuesUpdatePending||(this._expressionValuesUpdatePending=!0,setTimeout(async()=>{this._expressionValuesUpdatePending=!1,await this.fetchExpressionInfos()},0))});this._expressionsInitialized=!0,f(this,"expressionsInitialized")}async fetchRelatedFeatures(e,t){if(!this.source)return;let s=[];if(e){const t=new Set(Array.isArray(e)?e:[e]);for(const e of t){const t="string"==typeof e?this.source.relationships.find(t=>t.id===e):e;if(!t||!this.source.relationships.includes(t))throw new o("Relationship not found in feature source.");s.push(t)}}else s=this.source.relationships.toArray();const i=await H(s,async e=>[e,await(async()=>{const s=await e.getRelatedFeatures(this,t);return this._initializedRelationships.add(e),s})()]);for(const e of i)this._relatedFeatures.set(e[0],e[1]);f(this,"relatedFeaturesInitialized")}async fetchAttachments(){if(this.source){const e=await this.source.getAttachments(this);A(this.attachments,e,{equals:(e,t)=>e.id===t.id,onMissing:(e,t)=>{this.attachments.remove(e)},onNew:(e,t)=>{this.attachments.add(e)},onMatch:(e,t,s,i)=>{this.attachments.splice(s,1,t)}}),this._attachmentsInitialized=!0,f(this,"attachmentsInitialized")}}async addAttachment(e){return this.source?.addAttachment(this,e)}async deleteAttachments(e){return this.source?.deleteAttachments(this,e)}_getSerializableProperties(){return{...super._getSerializableProperties(),attributes:{serializeModes:["project"],serialize:e=>{const t={};if("project"===e&&this.primaryKey&&(this.source?.capabilities).supportsQuery)t[this.schema.primaryKeyField]=this.primaryKey;else for(const[e,s]of this.attributes.entries())t[e]=s;return t},deserialize:e=>{if(this.attributes.clear(),e instanceof Map||e instanceof F)e.forEach((e,t)=>{this.attributes.set(t,e)});else for(const[t,s]of Object.entries(e))this.attributes.set(t,s)}},geometry:{serializeModes:["project"],serialize:e=>"project"===e&&(this.source?.capabilities).supportsQuery?this.getDefault("geometry"):this.geometry?.toJSON(),deserialize:e=>{E(e)?this.geometry=e:this.geometry=e?i(e):void 0}},settings:{serializeModes:["project"],serialize:e=>"project"===e&&(this.source?.capabilities).supportsQuery?this.getDefault("settings"):this.settings.toJSON(e)},schema:{serializeModes:["project"],serialize:e=>"project"===e&&(this.source?.capabilities).supportsQuery?this.getDefault("schema"):this.schema.toJSON(e)},source:["project"]}}async _onInitialize(){const e=this._findRelationshipIds(this._title,this._description),t=this.source?this.source.relationships.map(e=>e.id).toArray():[],s=[];for(const i of e)t.includes(i)?s.push(this.fetchRelatedFeatures(i)):K.error("Could not find relationship '{0}' referenced in feature title or description.",i);await Promise.all(s)}_findRelationshipIds(...e){const t=[];for(const s of e){let e;const i=s.replace(ee,te);for(;e=Y.exec(i),null!==e;){const s=e[0];t.includes(s)||t.push(e[1])}}return t}};J=e([c],J);export{J as Feature};export function toFeature(e,t){const s=new J(t);if(e.attributes){const t=e.attributes;for(const[e,i]of Object.entries(t))s.attributes.set(e,i)}return s.geometry=e.geometry,e.popupTemplate&&(s.settings.popupTemplate=e.popupTemplate),s}export function toGraphic(e){const s=new t;s.attributes={};for(const t of e.attributes.keys())s.attributes[t]=e.attributes.get(t);return n(e.source)&&e.source.layer?s.layer=e.source.layer:l(e.source)&&e.source.sublayer&&(s.layer=e.source.sublayer),h(e.source)&&e.source.table&&(s.layer=e.source.table),s.geometry=e.geometry,e.settings.popupTemplate&&(s.popupTemplate=e.settings.popupTemplate),s}const Q="Presentable attributes are read-only.",B="Feature hyperlinks are read-only. Modify the feature's hyperlink templates instead.";class W extends x{_feature;_pending=new Set;constructor(e,t){super(e),this._feature=t}get(e){return super.has(e)||this._calcExpressionValue(e),super.get(e)}async _calcExpressionValue(e){if(!this._pending.has(e)){this._pending.add(e);try{const{spatialReference:t}=this._feature.schema,s=this._feature.settings.popupTemplate?.expressionInfos?.find(t=>t.name===e);if(!s)return;const{isArcadeScriptAsync:i,runAsyncArcadeExpression:r,arcadeScriptUsesGeometry:a,runArcadeExpression:o}=await import("../utilities/arcade.js");try{if(i(s.expression,t)){const i=this._feature.source?.layer??this._feature.source?.sublayer;let a=this._feature.source?.mapExtension;if(!a){const e=this._feature.source?.layerExtension;a=e?.mapExtension}this._originalMap.set(e,await r(s.expression,{feature:this._feature,layer:i,map:a?.map,spatialReference:t}))}else{if(a(s.expression,t)){const{enableGeometrySupport:e}=await import("@arcgis/core/arcade/arcade.js");await e()}this._originalMap.set(e,o(s.expression,{feature:this._feature,spatialReference:t}))}}catch(t){t instanceof Error&&K.error({message:"Error evaluating expression '{0}': {1}.",error:t},e,t.message),this._originalMap.set(e,ie)}}finally{this._pending.delete(e)}}}}class q extends x{get size(){return this._feature.attributes.size+this._feature.schema.fields._expressionFieldsLength}_feature;_numObservers;_onAllObserversRemoved;constructor(e){super(new _),this._feature=e,this._handles.add([d(this,"size",()=>g(this._feature.attributes,"size",()=>f(this,"size"),{sync:!0})),d(this,"size",()=>g(this._feature.schema.fields,"_expressionFieldsLength",()=>f(this,"size"),{sync:!0}))])}destroy(){this._onAllObserversRemoved?.(),this._numObservers=0,super.destroy()}clear(){throw new o(Q)}delete(e){throw new o(Q)}forEach(e,t){S("callback",e).isNotMissing();for(const s of this.keys())e.call(t,this.get(s),s,this)}get(e){const t=this._getFieldExtensionFormat(e);return this._formatAttribute(e,t)}has(e){for(const t of this.keys())if(L(t,e))return!0;return!1}set(...e){throw new o(Q)}*entries(){yield*C(this.keys(),e=>[e,this.get(e)])}*keys(){yield*this._feature.attributes.keys();for(const e of this._feature.schema.fields.expressionFields)yield e.name;if(null!=this._feature.source?.relationships)for(const e of this._feature.source.relationships)if("one-to-one"===e.cardinality||"many-to-one"===e.cardinality)for(const t of e.relatedSource.schema.fields)yield`relationships/${e.id}/${t.name}`}*values(){yield*C(this.keys(),e=>this.get(e))}[Symbol.iterator](){return this.entries()}toJSON(){return Array.from(this.entries())}on(e,t){if(S("callback",t).isNotMissing(),!this._numObservers){const e=new Map,t=new Set,s=()=>{for(const e of t)e.remove();t.clear()};let i;const r=()=>{const t=()=>{i&&(window.clearTimeout(i),i=void 0)};t(),i=window.setTimeout(()=>{const s=[],i=[];for(const[t,i]of this.entries())i!==e.get(t)&&s.push([t,i]);for(const[t,s]of e.entries())this.has(t)&&s===this.get(t)||i.push([t,s]);if(s.length||i.length){const e={added:s,removed:i,target:this};if(this.hasEventListener("after-add"))for(const e of s)this.emit("after-add",{target:this,item:e});if(this.hasEventListener("after-remove"))for(const e of i)this.emit("after-remove",{target:this,item:e});this.emit("change",e),a()}t()})},a=()=>{e.clear(),s();for(const s of this.keys()){const i=this._getFieldExtension(s);let a="{0}";if(i){const e=g(i,"format",r);t.add(e),i.format&&(a=i.format)}e.set(s,this._formatAttribute(s,a))}};a();const o=this._feature.attributes.on("change",r),n=this._feature.schema.fieldExtensions.on("change",r),l=[g(this._feature.settings.formatSettings,"numberFormat",r),g(this._feature.settings.formatSettings,"dateFormat",r),g(this._feature.settings.formatSettings,"timeFormat",r),g(this._feature.settings.formatSettings,"locale",r)],h=this._feature.expressionFieldValues.on("change",r),u=this._feature.schema.fields.on("change",e=>{(e.added?.some(e=>k(e.name))||e.removed?.some(e=>k(e.name)))&&r()}),p=g(this._feature.settings,"popupTemplate",r);this._onAllObserversRemoved=()=>{h.remove(),o.remove(),n.remove(),u.remove();for(const e of l)e.remove();p.remove(),e.clear(),s()}}const s=super.on(e,t);return this._numObservers++,{remove:()=>{s.remove(),this._numObservers--,this._numObservers||this._onAllObserversRemoved()}}}_getFieldExtension(e){const t=this._feature.schema.findFieldByName(e);if(t)return this._feature.schema.fieldExtensions.forField(t)}_getFieldExtensionFormat(e){const t=this._getFieldExtension(e);return t?t.format:"{0}"}_formatAttribute(e,t){const s=j(e);if(null!=s)return oe(this._feature,"expression",s,{format:t});const[i,r]=T(e);return null!=i?oe(this._feature,i,r,{format:t}):oe(this._feature,void 0,e,{format:t})}}const X=/\{(?:relationships[\\/]([\w-]*)[\\/])?(?:(expression)[\\/])?([_a-zA-ZÀ-ÖØ-öø-ÿ][._a-zA-ZÀ-ÖØ-öø-ÿ0-9()]*)(?::([^}]*))?\}/gi,Y=/\{relationships\/([\w-]*)[\\/]([^}]*)\}/gi,ee=/{{/g,te="\0MAGIC\0",se=new RegExp(te,"g"),ie="#INVALID";class re extends b{_feature;_hyperlinks;constructor(e){super(e.settings.hyperlinkTemplates,e=>this._getHyperlink(e)),this._feature=e}destroy(){for(const e of this)e.destroy();super.destroy()}_getHyperlink(e){return null==this._hyperlinks&&(this._hyperlinks=new WeakMap),this._hyperlinks.has(e)||this._hyperlinks.set(e,new ae(this._feature,e)),this._hyperlinks.get(e)}}let ae=class extends(p(a)){get url(){return this._template.url?this._feature.format(this._template.url):this._template.url}set url(e){throw new o(B)}get text(){return this._template.text?this._feature.format(this._template.text):this._template.text}set text(e){throw new o(B)}get iconUrl(){return this._template.iconUrl?this._feature.format(this._template.iconUrl):this._template.iconUrl}set iconUrl(e){throw new o(B)}get target(){return this._template.target?this._feature.format(this._template.target):this._template.target}set target(e){throw new o(B)}get tooltip(){return this._template.tooltip?this._feature.format(this._template.tooltip):this._template.tooltip}set tooltip(e){throw new o(B)}_feature;_template;constructor(e,t){super(t.toJSON()),this._feature=e,this._template=t,this._handles.add(d(this,e=>{const t=g(this._template,e,()=>f(this,e),{sync:!0}),s=this._feature.presentableAttributes.on("change",()=>{f(this,e)}),i=this._feature.relatedFeatures.on("change",()=>{f(this,e)});return m([t,s,i])}))}_getSerializableProperties(){return{}}};function oe(e,t,s,i={format:"{0}"}){if(!L(t,"expression")){if(t){const r=P(e.relatedFeatures.keys(),e=>L(e.id,t));if(!r)return K.debug("Could not resolve related field '{0}/{1}",t,s),ie;const a=Array.from(e.relatedFeatures.get(r));return"many-to-one"===r.cardinality||"one-to-one"===r.cardinality?a.length<1?(K.debug("Could not resolve related field '{0}/{1}",t,s),ie):ne(a[0],s,i):a.map(e=>ne(e,s,i)).filter(e=>""!==e).join(",")}return ne(e,s,i)}if(!e.settings.popupTemplate?.expressionInfos?.find(e=>L(e.name,s)))return K.debug("Could not find expression '{0}'.",s),ie;try{const t=e.expressionFieldValues.get(s)??i.defaultExpressionValue??"",r=e.schema.findFieldByName(`expression/${s}`),a=null==r?void 0:e.schema.fieldExtensions.forField(r);return le(e,t,s,a?.formatSettings,i)}catch(e){if(e instanceof Error)return K.error({message:"Error evaluating expression '{0}': {1}.",error:e},s,e.message),ie;throw e}}function ne(e,t,s){let i;if(i=e.attributes.get(t),null==i)return"";const r=e.schema.findFieldByName(t);let a,o;if(void 0===e.schema.subtypeField){a=e.schema.typeIdField;const t=e.schema.types;o=t.filter(t=>t?.id?.toString()===e.type?.id?.toString())?.getItemAt(0)}else{a=e.schema.subtypeField;const t=e.schema.subtypes;o=t.filter(t=>t?.code?.toString()===e.subtype?.code?.toString())?.getItemAt(0)}const n=o?.domains?.[r?.name??t],l=e=>e.codedValues?.find(e=>e.code.toString()===i.toString())?.name??i;let h;if(L(t,a)){const e=n&&"inherited"!==n.type?n:r?.domain;i="coded-value"===e?.type?l(e):o?.name??i}else if(n&&z(n))i=l(n);else if(r?.domain&&z(r.domain))i=l(r.domain);else if(r){switch(r.type){case"integer":case"small-integer":case"big-integer":case"single":case"double":i=N(i);break;case"date":i=O({timeZone:e.schema.timeZone},i);break;case"timestamp-offset":case"date-only":i=O({},i),"date-only"===r.type&&(s.isDateOnly=!0);break;case"time-only":i=U(i);break;default:i=`${i.toString()}`}const t=e.schema.fieldExtensions.forField(r);t&&(h=t.formatSettings)}return le(e,i,t,h,s)}function le(e,t,s,i,r){if("string"==typeof t&&(null==r.format||"{0}"===r.format))return t;const a={...r};if("number"==typeof t||t instanceof Date||t instanceof w){null==a.locale&&(a.locale=i?.locale??e.settings.formatSettings.locale);const r=e.settings.popupTemplate?.fieldInfos?.find(e=>L(e.fieldName,s))?.format;"number"==typeof t?function(e,t,s,i){null==e.currency&&(e.currency=t?.currency??i.settings.formatSettings.currency);null==e.numberFormat&&(e.numberFormat=t?.numberFormat,null==e.numberFormat&&(e.numberFormat=null==s?i.settings.formatSettings.numberFormat:s.digitSeparator?M.NUMBER:M.FIXED_POINT));null==e.fractionalDigits&&(e.fractionalDigits=t?.fractionalDigits,null==e.fractionalDigits&&(e.fractionalDigits=null==s?i.settings.formatSettings.fractionalDigits:s.places))}(a,i,r,e):t instanceof Date?function(e,t,s,i){null==e.dateFormat&&(e.dateFormat=t?.dateFormat,null==e.dateFormat&&(e.dateFormat=null==s?i.settings.formatSettings.dateFormat:R(s.dateFormat)));null==e.timeZone&&(e.timeZone=t?.timeZone??i.settings.formatSettings.timeZone)}(a,i,r,e):function(e,t,s,i){null==e.timeFormat&&(e.timeFormat=t?.timeFormat,null==e.timeFormat&&(e.timeFormat=null==s?i.settings.formatSettings.timeFormat:V(s.dateFormat)))}(a,i,r,e)}return D(a,t)}ae=e([c],ae);export async function resolveRelatedFeatures(e){const t=I(e,e=>e.source);await Promise.all(v([...t.keys()].map(e=>e.relationships.toArray())).map(e=>(async e=>{[...(await e.getAllRelatedFeatures(t.get(e.source))).entries()].forEach(([t,s])=>{t.relatedFeatures.set(e,s)})})(e)))}
1
+ var e;import{__decorate as t}from"tslib";import s from"@arcgis/core/Graphic";import i from"@arcgis/core/core/Collection";import{fromJSON as r}from"@arcgis/core/geometry/support/jsonUtils";import{EntityBase as a}from"../Entity.js";import{Hyperlink as n}from"../Hyperlink.js";import{InvalidOperationError as o}from"../InvalidOperationError.js";import{isLayerExtension as l,isSublayerExtension as h,isTableExtension as u,ItemType as c}from"../ItemType.js";import{handles as p}from"../support/HandlesMixin.js";import{serializable as m}from"../support/Serializable.js";import{createIHandle as f,notifyChange as d,onWatch as g,watch as _,watchEvent as y}from"../support/observableUtils.js";import{CaseInsensitiveObservableMap as b}from"../utilities/CaseInsensitiveObservableMap.js";import{MapTransformCollection as F}from"../utilities/MapTransformCollection.js";import{ObservableMap as x}from"../utilities/ObservableMap.js";import{ReadOnlyMap as v}from"../utilities/ReadOnlyMap.js";import{Time as w}from"../utilities/Time.js";import{flatten as S,groupBy as A}from"../utilities/array.js";import{checkArg as I}from"../utilities/checkArg.js";import{compare as z}from"../utilities/collection.js";import{isCodedValueDomain as E,isGeometry as j}from"../utilities/esri.js";import{getArcadeExpressionFromField as k,getRelationshipFromField as T,isArcadeExpressionField as R}from"../utilities/field.js";import{esriFormatToGeocortexFormat as O,parse as M}from"../utilities/format/date.js";import{NumberFormat as V}from"../utilities/format/formats.js";import{parse as D}from"../utilities/format/number.js";import{format as N}from"../utilities/format/string.js";import{esriFormatToGeocortexFormat as U,parse as P}from"../utilities/format/time.js";import{find as C,map as G}from"../utilities/iterable.js";import{getLogger as B}from"../utilities/log.js";import{map as H}from"../utilities/promise.js";import{caseInsensitiveEquals as L}from"../utilities/string.js";import{FeatureSettings as Z}from"./FeatureSettings.js";import{Schema as $}from"./Schema.js";const K=B("geocortex.api.data.Feature"),J=new FinalizationRegistry(async e=>{await e.destroy()});export const defaultFeatureFactory={create:e=>new Q(e)};export const SCORE_FIELD="_score";export const SCORE_FIELD_ORIGINAL="_score_original";let Q=class extends a{static{e=this}static factory=defaultFeatureFactory;_itemType=c.FEATURE;get attachments(){return this._attachments??=new i,this._attachments}get attachmentsInitialized(){return!this.source||this._attachmentsInitialized}get attributes(){return this._attributes??=new b,this._attributes}get description(){return this.format(this._description)}get expressionFieldValues(){return this._expressionFieldValues??=new X(this._expressionFieldValuesBacking,this),this._expressionFieldValues}get expressionsInitialized(){return!this.settings.popupTemplate?.expressionInfos?.length||this._expressionsInitialized}get geometry(){return this._geometry}set geometry(e){this._geometry=j(e)||!e?e:r(e),this.schema.spatialReference=this._geometry?.spatialReference,d(this,"geometryType")}get geometryType(){return this.geometry?this.geometry.type:void 0}get globalId(){const e=this.schema.fields.find(e=>"global-id"===e.type);return e?this.attributes.get(e.name):void 0}set globalId(e){const t=this.schema.fields.find(e=>"global-id"===e.type);if(!t)throw new o("Cannot set global ID on feature -- no global ID field.");this.attributes.set(t.name,e)}get hasGlobalId(){return!!this.schema.fields.find(e=>"global-id"===e.type)}get hyperlinks(){return this._hyperlinks??=new ne(this._self),this._hyperlinks}get presentableAttributes(){return this._presentableAttributes??=new Y(this._self),this._presentableAttributes}get primaryKey(){const{primaryKeyField:e}=this.schema;if(!e)return;const t=this.attributes.get(e);return null!=t?`${t}`:void 0}get relatedFeatures(){return this._relatedFeatures}get relatedFeaturesInitialized(){return!this.source||this.source.relationships.every(e=>this._initializedRelationships.has(e))}get schema(){return this._schema||this._initializeSchemaAndSettings(),this._schema}set schema(e){this._schema?.destroy(),this._schema=e}get settings(){return this._settings||this._initializeSchemaAndSettings(),this._settings}set settings(e){this._settings?.destroy(),this._settings=e}get source(){return this._source}set source(e){this._source===e||null==this._source&&null==e||(this._settings&&(this.settings.parent===this._source?.featureSettings&&(this.settings.parent=void 0),this.schema.parent===this._source?.schema&&(this.schema.parent=void 0)),this._source=e,this._settings&&(this.settings.parent||(this.settings.parent=e?.featureSettings),this.schema.parent||(this.schema.parent=e?.schema)),d(this,"attachmentsInitialized"),d(this,"relatedFeaturesInitialized"))}get subtype(){if(this.schema.subtypeField&&this.attributes.has(this.schema.subtypeField)){const e=this.attributes.get(this.schema.subtypeField);return this.schema.subtypes.find(t=>t.code===e)}}get title(){return this.format(this._title||"")}get type(){if(this.schema.typeIdField&&this.attributes.has(this.schema.typeIdField)){const e=this.attributes.get(this.schema.typeIdField);return this.schema.types.find(t=>t.id===e)}}get _hydrationStatus(){return this._featureHydrationStatus?this._featureHydrationStatus:this.source?.capabilities?.supportsQuery&&1===this.attributes.size&&void 0!==this.primaryKey?"dehydrated":"hydrated"}set _hydrationStatus(e){this._featureHydrationStatus=e}get _key(){return`${this.source?.id}//${this.primaryKey??this.globalId??this.id}`}get _title(){let e;return this.settings.popupTemplate&&(e="function"==typeof this.settings.popupTemplate.title?this.settings.popupTemplate.title():this.settings.popupTemplate.title),e||this.schema.displayField&&this.presentableAttributes.get(this.schema.displayField)||""}get _description(){if(this.settings.popupTemplate?.content){if("string"==typeof this.settings.popupTemplate.content)return this.settings.popupTemplate.content;if(Array.isArray(this.settings.popupTemplate.content)){const e=this.settings.popupTemplate.content.find(e=>"text"===e.type);if(e)return e.text}}return""}_attachments;_attachmentsInitialized=!1;_attributes;_expressionFieldValues;_expressionsInitialized=!1;_expressionValuesUpdatePending=!1;_featureHydrationStatus;_geometry;_hyperlinks;_presentableAttributes;_schema;_settings;_source;_expressionFieldValuesBacking=new x;_initializedRelationships=new WeakSet;_relatedFeatures=new x;_self=this;constructor(e){super(e);const t=this._self;this._handles.add([g(this,"title",()=>{const e=_(t.settings,"popupTemplate.title",()=>d(t,"title"),{sync:!0}),s=t.presentableAttributes.on("change",()=>d(t,"title"));return f([e,s])}),g(this,"description",()=>{const e=_(t.settings,"popupTemplate.content",()=>d(t,"description"),{sync:!0}),s=t.presentableAttributes.on("change",()=>d(t,"description"));return f([e,s])}),g(this,"relatedFeaturesInitialized",()=>y(t,"source.relationships",["after-changes",()=>{d(t,"relatedFeaturesInitialized")}]))])}static create(t){if(!e.factory)throw new o("Cannot create feature: no feature factory has been registered.");const s=e.factory.create(t),i=new Proxy(s,{});return J.register(i,s,s),i}format(e,...t){let s="string"==typeof e?{format:e}:e;I("options",s).isNotMissing();const{format:i}=s;I("format",i).isNotMissing();let r=s.format.replace(se,ie);return r=r.replace(ee,(e,t,i,r,a)=>le(this,t||i,r,{...s,format:a?`{0:${a}}`:"{0}"})),r=r.replace(re,"{{"),s={...s},s.format=r,N(s,...t)}clearExpressionInfos(){this._expressionFieldValuesBacking.clear()}toGraphic(){return toGraphic(this)}async fetchExpressionInfos(e=!1){const{expressionInfos:t}=this.settings.popupTemplate??{};if(!t)return;const{runAsyncArcadeExpression:s}=await import("../utilities/arcade.js");if(await Promise.all(t.map(async e=>{try{const t=this.source?.layer??this.source?.sublayer;let i=this.source?.mapExtension;if(!i){const e=this.source?.layerExtension;i=e?.mapExtension}this._expressionFieldValuesBacking.set(e.name,await s(e.expression,{layer:t,map:i?.map,feature:this,spatialReference:this.schema.spatialReference}))}catch(t){t instanceof Error&&K.error({message:"Error evaluating expression '{0}': {1}.",error:t},e.name,t.message),this._expressionFieldValuesBacking.set(e.name,ae)}})),e)return this.attributes.on("change",async e=>{this._expressionValuesUpdatePending||(this._expressionValuesUpdatePending=!0,setTimeout(async()=>{this._expressionValuesUpdatePending=!1,await this.fetchExpressionInfos()},0))});this._expressionsInitialized=!0,d(this,"expressionsInitialized")}async fetchRelatedFeatures(e,t){if(!this.source)return;let s=[];if(e){const t=new Set(Array.isArray(e)?e:[e]);for(const e of t){const t="string"==typeof e?this.source.relationships.find(t=>t.id===e):e;if(!t||!this.source.relationships.includes(t))throw new o("Relationship not found in feature source.");s.push(t)}}else s=this.source.relationships.toArray();const i=await H(s,async e=>[e,await(async()=>{const s=await e.getRelatedFeatures(this,t);return this._initializedRelationships.add(e),s})()]);for(const e of i)this._relatedFeatures.set(e[0],e[1]);d(this,"relatedFeaturesInitialized")}async fetchAttachments(){if(this.source){const e=await this.source.getAttachments(this);z(this.attachments,e,{equals:(e,t)=>e.id===t.id,onMissing:(e,t)=>{this.attachments.remove(e)},onNew:(e,t)=>{this.attachments.add(e)},onMatch:(e,t,s,i)=>{this.attachments.splice(s,1,t)}}),this._attachmentsInitialized=!0,d(this,"attachmentsInitialized")}}async addAttachment(e){return this.source?.addAttachment(this,e)}async deleteAttachments(e){return this.source?.deleteAttachments(this,e)}async _onDestroy(){J.unregister(this),await super._onDestroy(),this._attributes?.destroy(),this._attributes=void 0,this._attachments?.destroy(),this._attachments=void 0,this._hyperlinks?.destroy(),this._hyperlinks=void 0,this._relatedFeatures?.destroy(),this._expressionFieldValues?.destroy(),this._expressionFieldValues=void 0,this._expressionFieldValuesBacking?.destroy(),this._source=void 0,this._settings?.destroy(),this._settings=void 0,this._schema?.destroy(),this._schema=void 0,this._presentableAttributes?.destroy(),this._presentableAttributes=void 0}_getSerializableProperties(){return{...super._getSerializableProperties(),attributes:{serializeModes:["project"],serialize:e=>{const t={};if("project"===e&&this.primaryKey&&(this.source?.capabilities).supportsQuery)t[this.schema.primaryKeyField]=this.primaryKey;else for(const[e,s]of this.attributes.entries())t[e]=s;return t},deserialize:e=>{if(this.attributes.clear(),e instanceof Map||e instanceof x)e.forEach((e,t)=>{this.attributes.set(t,e)});else for(const[t,s]of Object.entries(e))this.attributes.set(t,s)}},geometry:{serializeModes:["project"],serialize:e=>"project"===e&&(this.source?.capabilities).supportsQuery?this.getDefault("geometry"):this.geometry?.toJSON(),deserialize:e=>{j(e)?this.geometry=e:this.geometry=e?r(e):void 0}},settings:{serializeModes:["project"],serialize:e=>"project"===e&&(this.source?.capabilities).supportsQuery?this.getDefault("settings"):this.settings.toJSON(e)},schema:{serializeModes:["project"],serialize:e=>"project"===e&&(this.source?.capabilities).supportsQuery?this.getDefault("schema"):this.schema.toJSON(e)},source:["project"]}}async _onInitialize(){const e=this._findRelationshipIds(this._title,this._description),t=this.source?this.source.relationships.map(e=>e.id).toArray():[],s=[];for(const i of e)t.includes(i)?s.push(this.fetchRelatedFeatures(i)):K.error("Could not find relationship '{0}' referenced in feature title or description.",i);await Promise.all(s)}_initializeSchemaAndSettings(){if(!this._schema){this._settings=new Z,this._settings._setFeature(this._self),this._settings.parent=this._source?.featureSettings,this._schema=new $,this._schema.parent=this._source?.schema,this._schema._featureSettings=this._settings;const e=this._self;this._handles.add(_(this._settings,"popupTemplate",()=>{e._expressionsInitialized=!1,d(e,"expressionsInitialized")},{sync:!0}))}}_findRelationshipIds(...e){const t=[];for(const s of e){let e;const i=s.replace(se,ie);for(;e=te.exec(i),null!==e;){const s=e[0];t.includes(s)||t.push(e[1])}}return t}};Q=e=t([m],Q);export{Q as Feature};export function toFeature(e,t){const s=Q.create(t);if(e.attributes){const t=e.attributes;for(const[e,i]of Object.entries(t))s.attributes.set(e,i)}return s.geometry=e.geometry,e.popupTemplate&&(s.settings.popupTemplate=e.popupTemplate),s}export function toGraphic(e){const t=new s;t.attributes={};for(const s of e.attributes.keys())t.attributes[s]=e.attributes.get(s);return l(e.source)&&e.source.layer?t.layer=e.source.layer:h(e.source)&&e.source.sublayer&&(t.layer=e.source.sublayer),u(e.source)&&e.source.table&&(t.layer=e.source.table),t.geometry=e.geometry,e.settings.popupTemplate&&(t.popupTemplate=e.settings.popupTemplate),t}const W="Presentable attributes are read-only.",q="Feature hyperlinks are read-only. Modify the feature's hyperlink templates instead.";class X extends v{_feature;_pending=new Set;constructor(e,t){super(e),this._feature=t}get(e){return super.has(e)||this._calcExpressionValue(e),super.get(e)}async _calcExpressionValue(e){if(!this._pending.has(e)){this._pending.add(e);try{const{spatialReference:t}=this._feature.schema,s=this._feature.settings.popupTemplate?.expressionInfos?.find(t=>t.name===e);if(!s)return;const{isArcadeScriptAsync:i,runAsyncArcadeExpression:r,arcadeScriptUsesGeometry:a,runArcadeExpression:n}=await import("../utilities/arcade.js");try{if(i(s.expression,t)){const i=this._feature.source?.layer??this._feature.source?.sublayer;let a=this._feature.source?.mapExtension;if(!a){const e=this._feature.source?.layerExtension;a=e?.mapExtension}this._originalMap.set(e,await r(s.expression,{feature:this._feature,layer:i,map:a?.map,spatialReference:t}))}else{if(a(s.expression,t)){const{enableGeometrySupport:e}=await import("@arcgis/core/arcade/arcade.js");await e()}this._originalMap.set(e,n(s.expression,{feature:this._feature,spatialReference:t}))}}catch(t){t instanceof Error&&K.error({message:"Error evaluating expression '{0}': {1}.",error:t},e,t.message),this._originalMap.set(e,ae)}}finally{this._pending.delete(e)}}}}class Y extends v{get size(){return this._feature.attributes.size+this._feature.schema.fields._expressionFieldsLength}_feature;_numObservers=0;_onAllObserversRemoved;constructor(e){super(new b),this._feature=e,this._handles.add([g(this,"size",()=>_(this._feature.attributes,"size",()=>d(this,"size"),{sync:!0})),g(this,"size",()=>_(this._feature.schema.fields,"_expressionFieldsLength",()=>d(this,"size"),{sync:!0}))])}destroy(){this._onAllObserversRemoved?.(),this._numObservers=0,super.destroy()}clear(){throw new o(W)}delete(e){throw new o(W)}forEach(e,t){I("callback",e).isNotMissing();for(const s of this.keys())e.call(t,this.get(s),s,this)}get(e){const t=this._getFieldExtensionFormat(e);return this._formatAttribute(e,t)}has(e){for(const t of this.keys())if(L(t,e))return!0;return!1}set(...e){throw new o(W)}*entries(){yield*G(this.keys(),e=>[e,this.get(e)])}*keys(){yield*this._feature.attributes.keys();for(const e of this._feature.schema.fields.expressionFields)yield e.name;if(null!=this._feature.source?.relationships)for(const e of this._feature.source.relationships)if("one-to-one"===e.cardinality||"many-to-one"===e.cardinality)for(const t of e.relatedSource.schema.fields)yield`relationships/${e.id}/${t.name}`}*values(){yield*G(this.keys(),e=>this.get(e))}[Symbol.iterator](){return this.entries()}toJSON(){return Array.from(this.entries())}on(e,t){if(I("callback",t).isNotMissing(),!this._numObservers){const e=new Map,t=new Set,s=()=>{for(const e of t)e.remove();t.clear()};let i;const r=()=>{const t=()=>{i&&(window.clearTimeout(i),i=void 0)};t(),i=window.setTimeout(()=>{const s=[],i=[];for(const[t,i]of this.entries())i!==e.get(t)&&s.push([t,i]);for(const[t,s]of e.entries())this.has(t)&&s===this.get(t)||i.push([t,s]);if(s.length||i.length){const e={added:s,removed:i,target:this};if(this.hasEventListener("after-add"))for(const e of s)this.emit("after-add",{target:this,item:e});if(this.hasEventListener("after-remove"))for(const e of i)this.emit("after-remove",{target:this,item:e});this.emit("change",e),a()}t()})},a=()=>{e.clear(),s();for(const s of this.keys()){const i=this._getFieldExtension(s);let a="{0}";if(i){const e=_(i,"format",r);t.add(e),i.format&&(a=i.format)}e.set(s,this._formatAttribute(s,a))}};a();const n=this._feature.attributes.on("change",r),o=this._feature.schema.fieldExtensions.on("change",r),l=[_(this._feature.settings.formatSettings,"numberFormat",r),_(this._feature.settings.formatSettings,"dateFormat",r),_(this._feature.settings.formatSettings,"timeFormat",r),_(this._feature.settings.formatSettings,"locale",r)],h=this._feature.expressionFieldValues.on("change",r),u=this._feature.schema.fields.on("change",e=>{(e.added?.some(e=>R(e.name))||e.removed?.some(e=>R(e.name)))&&r()}),c=_(this._feature.settings,"popupTemplate",r);this._onAllObserversRemoved=()=>{h.remove(),n.remove(),o.remove(),u.remove();for(const e of l)e.remove();c.remove(),e.clear(),s()}}const s=super.on(e,t);return this._numObservers++,{remove:()=>{s.remove(),this._numObservers>0&&this._numObservers--,!this._numObservers&&this._onAllObserversRemoved&&(this._onAllObserversRemoved(),this._onAllObserversRemoved=void 0)}}}_getFieldExtension(e){const t=this._feature.schema.findFieldByName(e);if(t)return this._feature.schema.fieldExtensions.forField(t)}_getFieldExtensionFormat(e){const t=this._getFieldExtension(e);return t?t.format:"{0}"}_formatAttribute(e,t){const s=k(e);if(null!=s)return le(this._feature,"expression",s,{format:t});const[i,r]=T(e);return null!=i?le(this._feature,i,r,{format:t}):le(this._feature,void 0,e,{format:t})}}const ee=/\{(?:relationships[\\/]([\w-]*)[\\/])?(?:(expression)[\\/])?([_a-zA-ZÀ-ÖØ-öø-ÿ][._a-zA-ZÀ-ÖØ-öø-ÿ0-9()]*)(?::([^}]*))?\}/gi,te=/\{relationships\/([\w-]*)[\\/]([^}]*)\}/gi,se=/{{/g,ie="\0MAGIC\0",re=new RegExp(ie,"g"),ae="#INVALID";class ne extends F{_feature;_hyperlinks;constructor(e){super(e.settings.hyperlinkTemplates,e=>this._getHyperlink(e)),this._feature=e}destroy(){for(const e of this)e.destroy();super.destroy()}_getHyperlink(e){return null==this._hyperlinks&&(this._hyperlinks=new WeakMap),this._hyperlinks.has(e)||this._hyperlinks.set(e,new oe(this._feature,e)),this._hyperlinks.get(e)}}let oe=class extends(p(n)){get url(){return this._template.url?this._feature.format(this._template.url):this._template.url}set url(e){throw new o(q)}get text(){return this._template.text?this._feature.format(this._template.text):this._template.text}set text(e){throw new o(q)}get iconUrl(){return this._template.iconUrl?this._feature.format(this._template.iconUrl):this._template.iconUrl}set iconUrl(e){throw new o(q)}get target(){return this._template.target?this._feature.format(this._template.target):this._template.target}set target(e){throw new o(q)}get tooltip(){return this._template.tooltip?this._feature.format(this._template.tooltip):this._template.tooltip}set tooltip(e){throw new o(q)}_feature;_template;constructor(e,t){super(t.toJSON()),this._feature=e,this._template=t,this._handles.add(g(this,e=>{const t=_(this._template,e,()=>d(this,e),{sync:!0}),s=this._feature.presentableAttributes.on("change",()=>{d(this,e)}),i=this._feature.relatedFeatures.on("change",()=>{d(this,e)});return f([t,s,i])}))}_getSerializableProperties(){return{}}};function le(e,t,s,i={format:"{0}"}){if(!L(t,"expression")){if(t){const r=C(e.relatedFeatures.keys(),e=>L(e.id,t));if(!r)return K.debug("Could not resolve related field '{0}/{1}",t,s),ae;const a=Array.from(e.relatedFeatures.get(r));return"many-to-one"===r.cardinality||"one-to-one"===r.cardinality?a.length<1?(K.debug("Could not resolve related field '{0}/{1}",t,s),ae):he(a[0],s,i):a.map(e=>he(e,s,i)).filter(e=>""!==e).join(",")}return he(e,s,i)}if(!e.settings.popupTemplate?.expressionInfos?.find(e=>L(e.name,s)))return K.debug("Could not find expression '{0}'.",s),ae;try{const t=e.expressionFieldValues.get(s)??i.defaultExpressionValue??"",r=e.schema.findFieldByName(`expression/${s}`),a=null==r?void 0:e.schema.fieldExtensions.forField(r);return ue(e,t,s,a?.formatSettings,i)}catch(e){if(e instanceof Error)return K.error({message:"Error evaluating expression '{0}': {1}.",error:e},s,e.message),ae;throw e}}function he(e,t,s){let i;if(i=e.attributes.get(t),null==i)return"";const r=e.schema.findFieldByName(t);let a,n;if(void 0===e.schema.subtypeField){a=e.schema.typeIdField;const t=e.schema.types;n=t.filter(t=>t?.id?.toString()===e.type?.id?.toString())?.getItemAt(0)}else{a=e.schema.subtypeField;const t=e.schema.subtypes;n=t.filter(t=>t?.code?.toString()===e.subtype?.code?.toString())?.getItemAt(0)}const o=n?.domains?.[r?.name??t],l=e=>e.codedValues?.find(e=>e.code.toString()===i.toString())?.name??i;let h;if(L(t,a)){const e=o&&"inherited"!==o.type?o:r?.domain;i="coded-value"===e?.type?l(e):n?.name??i}else if(o&&E(o))i=l(o);else if(r?.domain&&E(r.domain))i=l(r.domain);else if(r){switch(r.type){case"integer":case"small-integer":case"big-integer":case"single":case"double":i=D(i);break;case"date":i=M({timeZone:e.schema.timeZone},i);break;case"timestamp-offset":case"date-only":i=M({},i),"date-only"===r.type&&(s.isDateOnly=!0);break;case"time-only":i=P(i);break;default:i=`${i.toString()}`}const t=e.schema.fieldExtensions.forField(r);t&&(h=t.formatSettings)}return ue(e,i,t,h,s)}function ue(e,t,s,i,r){if("string"==typeof t&&(null==r.format||"{0}"===r.format))return t;const a={...r};if("number"==typeof t||t instanceof Date||t instanceof w){null==a.locale&&(a.locale=i?.locale??e.settings.formatSettings.locale);const r=e.settings.popupTemplate?.fieldInfos?.find(e=>L(e.fieldName,s))?.format;"number"==typeof t?function(e,t,s,i){null==e.currency&&(e.currency=t?.currency??i.settings.formatSettings.currency);null==e.numberFormat&&(e.numberFormat=t?.numberFormat,null==e.numberFormat&&(e.numberFormat=null==s?i.settings.formatSettings.numberFormat:s.digitSeparator?V.NUMBER:V.FIXED_POINT));null==e.fractionalDigits&&(e.fractionalDigits=t?.fractionalDigits,null==e.fractionalDigits&&(e.fractionalDigits=null==s?i.settings.formatSettings.fractionalDigits:s.places))}(a,i,r,e):t instanceof Date?function(e,t,s,i){null==e.dateFormat&&(e.dateFormat=t?.dateFormat,null==e.dateFormat&&(e.dateFormat=null==s?i.settings.formatSettings.dateFormat:O(s.dateFormat)));null==e.timeZone&&(e.timeZone=t?.timeZone??i.settings.formatSettings.timeZone)}(a,i,r,e):function(e,t,s,i){null==e.timeFormat&&(e.timeFormat=t?.timeFormat,null==e.timeFormat&&(e.timeFormat=null==s?i.settings.formatSettings.timeFormat:U(s.dateFormat)))}(a,i,r,e)}return N(a,t)}oe=t([m],oe);export async function resolveRelatedFeatures(e){const t=A(e,e=>e.source);await Promise.all(S([...t.keys()].map(e=>e.relationships.toArray())).map(e=>(async e=>{[...(await e.getAllRelatedFeatures(t.get(e.source))).entries()].forEach(([t,s])=>{t.relatedFeatures.set(e,s)})})(e)))}
@@ -1 +1 @@
1
- var e;import{__decorate as t}from"tslib";import r from"@arcgis/core/core/Collection";import{Evented as s}from"@arcgis/core/core/Evented.js";import{generateId as i}from"../Entity.js";import{isFeature as a,ItemType as h}from"../ItemType.js";import{assignProperties as o,assignPropertiesAsync as n,filterJSONProperties as u,getDefaults as d,getSerializableProperties as c,serializable as m}from"../support/Serializable.js";import{notifyChange as g,observable as l,watchEach as p}from"../support/observableUtils.js";import{ObservableMap as y}from"../utilities/ObservableMap.js";import{groupBy as _}from"../utilities/array.js";import{toArray as f,from as S,empty as v}from"../utilities/asyncIterable.js";import{compare as b,find as F}from"../utilities/iterable.js";import{getLogger as z}from"../utilities/log.js";import{Feature as j}from"./Feature.js";import{FeatureSettings as E}from"./FeatureSettings.js";import{Schema as P}from"./Schema.js";const C=z("feature-set");let k=e=class extends(l(s)){[Symbol.toStringTag];id;title;get size(){return this._features.size}get source(){return this._source}set source(e){this._source===e||null==this._source&&null==e||(this.settings.parent===this._source?.featureSettings&&(this.settings.parent=void 0),this.schema.parent===this._source?.schema&&(this.schema.parent=void 0),this._source=e,this.settings.parent||(this.settings.parent=e?e.featureSettings:void 0),this.schema.parent||(this.schema.parent=e?e.schema:void 0))}settings=new E;schema=new P;get itemType(){return h.FEATURE_SET}_source;_rehydratingFeatureCount=0;_rehydratingFeatures=new r;_features=new y;constructor(e){super(),this.schema._featureSettings=this.settings,this.id=e?.id??i(),p(this._rehydratingFeatures,"[]._hydrationStatus",()=>{if(this._rehydratingFeatureCount--,!this._rehydratingFeatureCount){const e=this._rehydratingFeatures.toArray();this.addMany(e),this.emit("feature-hydration-complete",e)}}),this.on("dehydrated-features-added",async e=>{this._rehydratingFeatures.addMany(e);const t=_(e,e=>e.source),r=_(await f(S([...t.entries()].map(([e,t])=>{let r;try{r=e?.getFeatures(t.map(e=>e.primaryKey).filter(e=>!!e))??v()}catch(t){r=v(),C.error({error:t,message:`Failed to hydrate features from source '${e?.title??e?.id}`})}return r}))),e=>e.source);[...t.entries()].forEach(([e,t])=>{const s=r.get(e);t.forEach(e=>{const t=s?.find(t=>t.primaryKey===e.primaryKey);t&&(e.geometry=t.geometry,[...t.attributes.entries()].forEach(([t,r])=>{e.attributes.set(t,r)})),e._hydrationStatus=void 0})})}),this.assignProperties(e)}static async fromFeatureStream(t,r){const s=new e(r);for await(const e of t)s.add(e);return s}assignProperties(e){o(this._getSerializableProperties(),this,e)}async assignPropertiesAsync(e){return n(this._getSerializableProperties(),this,e)}async finishAssignProperties(){}has(e){return this._features.has(e._key)}entries(){return[...this._features].map(([e,t])=>[t,t])[Symbol.iterator]()}keys(){return this._features.values()}values(){return this._features.values()}toJSON(e="all"){return u(this._getSerializableProperties(),this,e)}toItemUri(){return`item://${encodeURIComponent(h.FEATURE_SET)}/${encodeURIComponent(this.id)}`}add(e){return this._add(e)}addMany(e){const t=[],r=[];for(const s of e){const e=this._features.get(s._key);s!==e&&(this._add(s,!1),t.push(s),e&&r.push(e))}return t.length&&(g(this,"size"),this.emit("change",{added:t,removed:r,moved:[],target:this})),this}clear(){const e=Array.from(this.values());this._features.clear(),g(this,"size"),this.emit("change",{added:[],removed:e,moved:[],target:this})}delete(e){return this._delete(e)}deleteMany(e){const t=[];for(const r of e){const e=this._features.get(r._key);this._delete(r,!1)&&t.push(e)}return t.length&&(g(this,"size"),this.emit("change",{added:[],removed:t,moved:[],target:this})),!!t.length}forEach(e,t){this._features.forEach(t=>e(t,t,this),t)}findById(e){return F(this,t=>t.id===e)}findByPrimaryKey(e){return F(this,t=>t.primaryKey===e)}getSerializableProperties(e="all"){return c(this._getSerializableProperties(),e)}getDefaults(){return d(this._getSerializableProperties())}getDefault(e){return this.getDefaults()[e]}[Symbol.iterator](){return this._features.values()[Symbol.iterator]()}_add(e,t=!0){const r=e._key,s=this._features.get(r);return s&&s!==e&&this._delete(s,!1),this._features.set(r,e),t&&s!==e&&(g(this,"size"),this.emit("change",{added:[e],removed:s?[s]:[],moved:[],target:this})),this.source&&!e.source&&(e.source=this.source),e.schema.parent||(e.schema.parent=this.schema),e.settings.parent||(e.settings.parent=this.settings),this}_delete(e,t=!0){if(!this.has(e))return!1;const r=this._features.get(e._key);return this._features.delete(e._key),t&&(g(this,"size"),this.emit("change",{added:[],removed:[r],moved:[],target:this})),e.schema.parent===this.schema&&(e.schema.parent=void 0),e.settings.parent===this.settings&&(e.settings.parent=void 0),!0}_getSerializableProperties(){return{id:["project"],features:{serializeModes:["project"],serialize:()=>[...this],deserialize:e=>{const t=[],r=[];b(this._rehydratingFeatures.concat([...this]),e,{onNew:e=>{if(a(e))"dehydrated"===e._hydrationStatus?(e._hydrationStatus="rehydrating",this._rehydratingFeatureCount++,t.push(e)):"rehydrating"===e._hydrationStatus?(this._rehydratingFeatureCount++,this._rehydratingFeatures.push(e)):(r.push(e),this.add(e));else{const t=new j(e);r.push(t),this.add(t)}},onMatch:(e,r)=>{a(r)?"dehydrated"===e._hydrationStatus?(e._hydrationStatus="rehydrating",this._rehydratingFeatureCount++,t.push(e)):e!==r&&this.add(r):e.assignProperties(r)},onMissing:e=>{this.delete(e)},equals:(e,t)=>a(t)?e._key===t._key:e.id===t.id}),t.length?this.emit("dehydrated-features-added",t):this._rehydratingFeatureCount||this.emit("feature-hydration-complete",r)}},title:["project"],source:[],schema:[],settings:[]}}};k=e=t([m],k);export{k as FeatureSet};
1
+ var e;import{__decorate as t}from"tslib";import r from"@arcgis/core/core/Collection";import{Evented as s}from"@arcgis/core/core/Evented.js";import{generateId as i}from"../Entity.js";import{isFeature as a,ItemType as h}from"../ItemType.js";import{assignProperties as o,assignPropertiesAsync as n,filterJSONProperties as u,getDefaults as d,getSerializableProperties as c,serializable as m}from"../support/Serializable.js";import{notifyChange as g,observable as l,watchEach as p}from"../support/observableUtils.js";import{ObservableMap as y}from"../utilities/ObservableMap.js";import{groupBy as _}from"../utilities/array.js";import{toArray as f,from as S,empty as v}from"../utilities/asyncIterable.js";import{compare as b,find as F}from"../utilities/iterable.js";import{getLogger as z}from"../utilities/log.js";import{Feature as j}from"./Feature.js";import{FeatureSettings as E}from"./FeatureSettings.js";import{Schema as P}from"./Schema.js";const C=z("feature-set");let k=e=class extends(l(s)){[Symbol.toStringTag];id;title;get size(){return this._features.size}get source(){return this._source}set source(e){this._source===e||null==this._source&&null==e||(this.settings.parent===this._source?.featureSettings&&(this.settings.parent=void 0),this.schema.parent===this._source?.schema&&(this.schema.parent=void 0),this._source=e,this.settings.parent||(this.settings.parent=e?e.featureSettings:void 0),this.schema.parent||(this.schema.parent=e?e.schema:void 0))}settings=new E;schema=new P;get itemType(){return h.FEATURE_SET}_source;_rehydratingFeatureCount=0;_rehydratingFeatures=new r;_features=new y;constructor(e){super(),this.schema._featureSettings=this.settings,this.id=e?.id??i(),p(this._rehydratingFeatures,"[]._hydrationStatus",()=>{if(this._rehydratingFeatureCount--,!this._rehydratingFeatureCount){const e=this._rehydratingFeatures.toArray();this.addMany(e),this.emit("feature-hydration-complete",e)}}),this.on("dehydrated-features-added",async e=>{this._rehydratingFeatures.addMany(e);const t=_(e,e=>e.source),r=_(await f(S([...t.entries()].map(([e,t])=>{let r;try{r=e?.getFeatures(t.map(e=>e.primaryKey).filter(e=>!!e))??v()}catch(t){r=v(),C.error({error:t,message:`Failed to hydrate features from source '${e?.title??e?.id}`})}return r}))),e=>e.source);[...t.entries()].forEach(([e,t])=>{const s=r.get(e);t.forEach(e=>{const t=s?.find(t=>t.primaryKey===e.primaryKey);t&&(e.geometry=t.geometry,[...t.attributes.entries()].forEach(([t,r])=>{e.attributes.set(t,r)})),e._hydrationStatus=void 0})})}),this.assignProperties(e)}static async fromFeatureStream(t,r){const s=new e(r);for await(const e of t)s.add(e);return s}assignProperties(e){o(this._getSerializableProperties(),this,e)}async assignPropertiesAsync(e){return n(this._getSerializableProperties(),this,e)}async finishAssignProperties(){}has(e){return this._features.has(e._key)}entries(){return[...this._features].map(([e,t])=>[t,t])[Symbol.iterator]()}keys(){return this._features.values()}values(){return this._features.values()}toJSON(e="all"){return u(this._getSerializableProperties(),this,e)}toItemUri(){return`item://${encodeURIComponent(h.FEATURE_SET)}/${encodeURIComponent(this.id)}`}add(e){return this._add(e)}addMany(e){const t=[],r=[];for(const s of e){const e=this._features.get(s._key);s!==e&&(this._add(s,!1),t.push(s),e&&r.push(e))}return t.length&&(g(this,"size"),this.emit("change",{added:t,removed:r,moved:[],target:this})),this}clear(){const e=Array.from(this.values());this._features.clear(),g(this,"size"),this.emit("change",{added:[],removed:e,moved:[],target:this})}delete(e){return this._delete(e)}deleteMany(e){const t=[];for(const r of e){const e=this._features.get(r._key);this._delete(r,!1)&&t.push(e)}return t.length&&(g(this,"size"),this.emit("change",{added:[],removed:t,moved:[],target:this})),!!t.length}forEach(e,t){this._features.forEach(t=>e(t,t,this),t)}findById(e){return F(this,t=>t.id===e)}findByPrimaryKey(e){return F(this,t=>t.primaryKey===e)}getSerializableProperties(e="all"){return c(this._getSerializableProperties(),e)}getDefaults(){return d(this._getSerializableProperties())}getDefault(e){return this.getDefaults()[e]}[Symbol.iterator](){return this._features.values()[Symbol.iterator]()}_add(e,t=!0){const r=e._key,s=this._features.get(r);return s&&s!==e&&this._delete(s,!1),this._features.set(r,e),t&&s!==e&&(g(this,"size"),this.emit("change",{added:[e],removed:s?[s]:[],moved:[],target:this})),this.source&&!e.source&&(e.source=this.source),e.schema.parent||(e.schema.parent=this.schema),e.settings.parent||(e.settings.parent=this.settings),this}_delete(e,t=!0){if(!this.has(e))return!1;const r=this._features.get(e._key);return this._features.delete(e._key),t&&(g(this,"size"),this.emit("change",{added:[],removed:[r],moved:[],target:this})),e.schema.parent===this.schema&&(e.schema.parent=void 0),e.settings.parent===this.settings&&(e.settings.parent=void 0),!0}_getSerializableProperties(){return{id:["project"],features:{serializeModes:["project"],serialize:()=>[...this],deserialize:e=>{const t=[],r=[];b(this._rehydratingFeatures.concat([...this]),e,{onNew:e=>{if(a(e))"dehydrated"===e._hydrationStatus?(e._hydrationStatus="rehydrating",this._rehydratingFeatureCount++,t.push(e)):"rehydrating"===e._hydrationStatus?(this._rehydratingFeatureCount++,this._rehydratingFeatures.push(e)):(r.push(e),this.add(e));else{const t=j.create(e);r.push(t),this.add(t)}},onMatch:(e,r)=>{a(r)?"dehydrated"===e._hydrationStatus?(e._hydrationStatus="rehydrating",this._rehydratingFeatureCount++,t.push(e)):e!==r&&this.add(r):e.assignProperties(r)},onMissing:e=>{this.delete(e)},equals:(e,t)=>a(t)?e._key===t._key:e.id===t.id}),t.length?this.emit("dehydrated-features-added",t):this._rehydratingFeatureCount||this.emit("feature-hydration-complete",r)}},title:["project"],source:[],schema:[],settings:[]}}};k=e=t([m],k);export{k as FeatureSet};
package/data/convert.js CHANGED
@@ -1 +1 @@
1
- import e from"@arcgis/core/Color.js";import t from"@arcgis/core/Graphic.js";import r from"@arcgis/core/geometry/Point";import o from"@arcgis/core/geometry/Polygon.js";import n from"@arcgis/core/geometry/Polyline.js";import i from"@arcgis/core/geometry/SpatialReference";import a from"@arcgis/core/layers/FeatureLayer.js";import s from"@arcgis/core/layers/GroupLayer.js";import c from"@arcgis/core/layers/support/Field.js";import l from"@arcgis/core/renderers/SimpleRenderer.js";import m from"@arcgis/core/renderers/UniqueValueRenderer.js";import u from"@arcgis/core/renderers/support/UniqueValueInfo.js";import f from"@arcgis/core/symbols/MeshSymbol3D.js";import p from"@arcgis/core/symbols/PictureMarkerSymbol.js";import y from"@arcgis/core/symbols/SimpleFillSymbol.js";import d from"@arcgis/core/symbols/SimpleLineSymbol.js";import g from"@arcgis/core/symbols/SimpleMarkerSymbol.js";import w from"dxf-parser";import{ArgumentError as h}from"../ArgumentError.js";import{NotFoundError as F}from"../NotFoundError.js";import{geometryTypeToJson as S}from"../json/GeometryJson.js";import{translate as N}from"../locale/language.js";import{INVARIANT as T}from"../locale.js";import{FeatureCollectionLayerExtension as O}from"../mapping/FeatureCollectionLayerExtension.js";import{GroupLayerExtension as x}from"../mapping/GroupLayerExtension.js";import{MapImageLayerExtension as b}from"../mapping/MapImageLayerExtension.js";import{CaseInsensitiveObservableMap as D}from"../utilities/CaseInsensitiveObservableMap.js";import{Time as M}from"../utilities/Time.js";import{checkArg as E,assertNever as R}from"../utilities/checkArg.js";import{isPoint as A,isMultipoint as I,isPolyline as _,isPolygon as G,isExtent as L}from"../utilities/esri.js";import{parse as C,format as v,DEFAULT_PARSING_FORMATS as P,INVALID_DATE as j}from"../utilities/format/date.js";import{DateFormat as U,NumberFormat as $,TimeFormat as B}from"../utilities/format/formats.js";import{parse as H,format as k}from"../utilities/format/number.js";import{parse as z,format as J,DEFAULT_PARSING_FORMATS as X}from"../utilities/format/time.js";import{project as W,esriToWKT as q,wktToEsri as Y,esriWkidToWkt as Z,esriWktToWkid as K,esriToGeoJSON as V,geoJSONToEsri as Q}from"../utilities/geometry.js";import{getLogger as ee}from"../utilities/log.js";import{isNumeric as te}from"../utilities/number.js";import{delay as re}from"../utilities/promise.js";import{caseInsensitiveEquals as oe}from"../utilities/string.js";import{Feature as ne}from"./Feature.js";import{FeatureSet as ie}from"./FeatureSet.js";import{DxfEntityProcessor as ae}from"./support/_dxfConverters.js";import{createGpxDocument as se,serializeGpxDocument as ce,buildGpxTrack as le,buildGpxTrackPoint as me,buildGpxWaypoint as ue,getGpxExtensions as fe,getGpxTrackDescription as pe,getGpxTrackName as ye,getGpxTrackTime as de,getGpxTrackId as ge}from"./support/_gpxExport.js";import{addAndPopulateFidField as we}from"./support/_shapefileConverter.js";const he=["=","-","+","@"],Fe='"',Se="\r\n",Ne="\n",Te=[...P.map(et),"M/d/yy"],Oe=[...X.map(rt).map(e=>e.replace("AM/PM","tt"))],xe=10,be=/(\w+)_(point|multipoint|polyline|polygon)z?/;var De;function Me(){return ee("geocortex.api.data.convert")}!function(e){e.DATE="D",e.NUMBER="N",e.STRING="C",e.BOOLEAN="L"}(De||(De={}));export const FIELD_NAME_REGEX=/[^a-zA-Z\d_]/g;export var GeometryFormat;!function(e){e.NONE="NONE",e.WKT="WKT",e.XY="XY",e.XYZ="XYZ",e.LAT_LON="LAT_LONG",e.GEO_JSON="GEO_JSON",e.ARCGIS_JSON="ARCGIS_JSON"}(GeometryFormat||(GeometryFormat={}));export const geometryTypeHeaders={[GeometryFormat.XYZ]:[["x","y","z"]],[GeometryFormat.XY]:[["x","y"]],[GeometryFormat.LAT_LON]:[["latitude","longitude"],["lat","lon"],["lat","long"]],[GeometryFormat.ARCGIS_JSON]:[["geometry"]],[GeometryFormat.GEO_JSON]:[["geometry"]],[GeometryFormat.WKT]:[["geometry"]]};const Ee=[[GeometryFormat.ARCGIS_JSON,ze],[GeometryFormat.GEO_JSON,Je],[GeometryFormat.WKT,Xe]],Re=new Map(Ee);export async function uploadDataToFeatureSet(e){const t=await async function(e){const{data:t,includeHeaderRow:o,geometryFormat:n,geometryFields:i,locale:a,numberFormat:s,inSpatialReference:c}=e,l=o?t.slice(1):t;if(n===GeometryFormat.NONE)return{columnIndices:[]};const m=e=>Ye(e,a,s),u=(e,t)=>{const o=t===GeometryFormat.XYZ,n=t===GeometryFormat.LAT_LON;return{columnIndices:e,geometries:l.map(t=>{if(t.length>=Math.max(...e)&&te(t[e[0]]?.raw,a)&&te(t[e[1]]?.raw,a)&&(!o||te(t[e[2]]?.raw,a)))return new r({x:m(n?t[e[1]].raw:t[e[0]].raw),y:m(n?t[e[0]].raw:t[e[1]].raw),z:o?m(t[e[2]].raw):0,spatialReference:c})})}},f=async(e,t)=>({columnIndices:[e],geometries:await Promise.all(l.map(t=>t[e]).map(e=>{if(e?.raw)return t(e.raw.toString(),c)}))}),p=async(e,t)=>{switch(t){case GeometryFormat.NONE:return{columnIndices:[0]};case GeometryFormat.LAT_LON:case GeometryFormat.XYZ:case GeometryFormat.XY:return u(e,t);case GeometryFormat.ARCGIS_JSON:return f(e[0],ze);case GeometryFormat.GEO_JSON:return f(e[0],Je);case GeometryFormat.WKT:return f(e[0],Xe);default:return R(t,new Error(`Unknown geometry format "${t}".`))}};if(n){const e=We(o?t[0]:t[0].map((e,t)=>({raw:t.toString()})),n,o?i:i.map(e=>""+(parseInt(e.match(/\d+/g)[0])-1)));if(o&&void 0===e)throw new Error(`Error parsing file data: Expected geometry columns ${geometryTypeHeaders[n][0].join(",")} are missing for GeometryType.${n}`);return p(e??[0],n)}const[y,d]=await Ze(t,c,o);if(y===GeometryFormat.NONE)return{columnIndices:[]};return d.length>1?u(d,y):f(d[0],Re.get(y))}(e),o=function(e,t){const{data:r,displayField:o,includeHeaderRow:n,inSpatialReference:i,outSpatialReference:a,generatePrimaryKey:s}=e,c={fields:[]},l=e=>!(!t.columnIndices||0===t.columnIndices.length)&&t.columnIndices.includes(e);let{primaryKeyField:m}=e,u=0;for(let t=0;t<r[0].length;t++){if(l(t))continue;const o=Ve(e,t,!s&&!m&&!c.fields.find(e=>"esriFieldTypeOID"===e.type));let i=r[0][t]?.raw?.toString(),a=i?.replace(FIELD_NAME_REGEX,"_");n&&a||(a="field"+ ++u,i=N("gcx.api.data.convert.import-field-alias",u)),c.fields.push({alias:i,name:a,type:o}),"esriFieldTypeOID"===o&&(m=a)}if(c.spatialReference=a??t.geometries?.[0]?.spatialReference??i,t.geometries?.length){const e=t.geometries.filter(e=>void 0!==e).map(e=>e.type),r=e[0];c.geometryType=e.every(e=>e===r)?S(r):void 0}if(!c.fields.find(e=>"esriFieldTypeOID"===e.type)){const e=c.fields.length+1,t=!!c.fields.find(e=>"objectid"===e.name.toLowerCase());m=t?`OBJECTID_${e}`:"OBJECTID",c.fields.push({name:m,alias:m,type:"esriFieldTypeOID"})}return c.displayField=o??c.fields.find(e=>!oe(e.name,m)&&"esriFieldTypeString"===e.type)?.name??c.fields.find(e=>!oe(e.name,m))?.name??m,c.primaryKeyField=m,c}(e,t),n=await async function(e,t,r){const{data:o,includeHeaderRow:n,outFields:i,escapeFormulaChars:a,locale:s,numberFormat:c,dateFormat:l,timeFormat:m}=e,{spatialReference:u}=r,f=[],p=n?o.slice(1):o,y=(e,r)=>!t.columnIndices||0===t.columnIndices.length||!t.columnIndices.includes(r);return await Promise.all(p.map(async(e,o)=>{const n=new ne;for(let t=0;t<r.fields.length;t++){const u=r.fields[t],f=e.filter(y);if(i.includes("*")||i.filter(e=>oe(e,u.name)).length>0){let e=await Qe(f[t]?.raw,u,{escapeFormulaChars:a,dateFormat:l,numberFormat:c,timeFormat:m,locale:s});"esriFieldTypeOID"===u.type&&null===e&&(e=o),n.attributes.set(u.name,e)}}t.geometries&&(n.geometry=await ve(t.geometries[o],u)),f.push(n)})),f}(e,t,o);return new ie({features:n,schema:o})}export async function toCsv(e,t){E("featureSet",e).isNotMissing();const r=Array.from(e),o={...{useFormattedValues:!1,alwaysQuote:!1,escapeFormulaChars:!0,delimiter:",",dateFormat:U.ROUND_TRIP,timeFormat:B.ROUND_TRIP,geometryFormat:r.some(e=>void 0!==e.geometry&&null!==e.geometry)?GeometryFormat.WKT:GeometryFormat.NONE,includeByteOrderMark:!0,outSpatialReference:i.WGS84,includeHeaderRow:!0,outFields:Le(e.source),rowDelimiter:navigator.platform?.startsWith("Win")?Se:"\n"},...t},{includeByteOrderMark:n,includeHeaderRow:a,delimiter:s,outFields:c,rowDelimiter:l}=o,m=[];n&&m.push("\ufeff");const u=_e(r,o),f=Ge(r,c,e.schema,!0),p=Ge(r,c,e.schema,!1);if(a){const e=[];for(const t of u)e.push(Pe(t,o));for(const t of f)e.push(Pe(t,o));for(const t of p)e.push(Pe(t,o));const t=e.join(s)+l;m.push(t)}await Promise.all(r.map(async e=>{const t=[],r=(t,r)=>{const o=Ue(e,t,r),n=e.schema.findFieldByName(t)?.type;return Pe(je(o,{...r,isDateOnly:"date-only"===n}),r)};t.push(...await async function(e,t){let r=await Ce(e,t);t.geometryFormat!==GeometryFormat.XYZ&&t.geometryFormat!==GeometryFormat.XY&&t.geometryFormat!==GeometryFormat.LAT_LON||(r=r.map(e=>void 0===e?"":je(e,t)));return r.map(e=>""===e?"":Pe(e,t))}(e.geometry,o)),t.push(...f.map(e=>r(e,o))),t.push(...p.map(e=>r(e,o)));const n=`${t.join(s)}${l}`;m.push(n)}));return new Blob(m,{type:"text/plain",endings:"\n"===l||l===Se?"transparent":"native"})}export async function csvToUploadData(e,t){let r;if(E("csvData",e).isNotMissing(),e instanceof Blob){const t=new Promise((t,r)=>{const o=new FileReader;o.onload=()=>{t(o.result)},o.onerror=()=>{r(o.error)},o.readAsText(e)});r=await t}else r=e;const o=Ie(t),n=o.rowDelimiter||function(e){let t=Ne;return ke(e,Se,(r,o)=>(0===r&&o===e.length||(t=Se),!1)),t}(r),i=o.delimiter??function(e,t,r){const o=",";if(0===e.length)return o;const n=[];if(ke(e,t,(t,r)=>(r!==e.length||t!==r)&&(n.push(e.substring(t,r)),n.length<3)),0===n.length)return o;let i=[{delimiter:",",rowsDelimiterOccurrences:[],rowsNumberAdjacentOccurrences:[]},{delimiter:";",rowsDelimiterOccurrences:[]},{delimiter:"|",rowsDelimiterOccurrences:[]},{delimiter:"\t",rowsDelimiterOccurrences:[]},{delimiter:" ",rowsDelimiterOccurrences:[]}].filter(e=>n[0].includes(e.delimiter));if(0===i.length)return o;for(const e of n)for(const t of i){let o=0,n=0;ke(e,t.delimiter,(i,a)=>{if(a!==e.length&&o++,","===t.delimiter){const t=e.charAt(a-1),o=e.charAt(a+1);te(t,r)&&te(o,r)&&n++}return!0}),t.rowsDelimiterOccurrences.push(o),","===t.delimiter&&t.rowsNumberAdjacentOccurrences.push(n)}if(i=i.filter(e=>e.rowsDelimiterOccurrences.every(t=>e.rowsDelimiterOccurrences[0]===t)).sort((e,t)=>t.rowsDelimiterOccurrences[0]-e.rowsDelimiterOccurrences[0]),i.length>1&&","===i[0].delimiter&&null!=r&&r!==T){const e=i[0];if(","===e?.delimiter&&","===Intl.NumberFormat(r).formatToParts(1.1).find(e=>"decimal"===e.type)?.value)for(let t=0;t<e.rowsDelimiterOccurrences.length;t++)if(e.rowsDelimiterOccurrences[t]<=e.rowsNumberAdjacentOccurrences[t]){i=i.filter(e=>","!==e.delimiter);break}}if(0===i.length)return o;return i[0].delimiter}(r,n,o.locale),a=function(e,t,r){const o=[],n=(e,t)=>{const o=[];return ke(e,r,(r,n)=>{const i=e.substring(r,n);return o.push({raw:He(i,t,o.length)}),!0}),o};if(ke(e,t,(t,r)=>{const i=e.substring(t,r);return i.length>0&&o.push(n(i,o.length)),!0}),o.length){const e=o[0].length;o.forEach((t,r)=>{if(t.length!==e)throw new Error(`Detected invalid CSV: Row ${r} does not have expected number of columns: ${e}`)})}return o}(r,n,i);let{geometryFormat:s,geometryFields:c}=o;if(!s){const[e,t]=await Ze(a,o.inSpatialReference,o.includeHeaderRow);s=e,c=t.map(e=>o.includeHeaderRow?a[0][e]?.raw??N("gcx.api.data.convert.import-field-alias",(e+1).toString()):N("gcx.api.data.convert.import-field-alias",(e+1).toString()))}return{data:a,...o,geometryFormat:s,geometryFields:c}}export async function csvToFeatureSet(e,t){const r=Ie(t);return uploadDataToFeatureSet(await csvToUploadData(e,r))}export async function toGpx(e){E("featureSet",e).isNotMissing();const t=Array.from(e),r=se(),o=r.documentElement,n=new Set;for(const e of t){if(!e.geometry)continue;const t=await ve(e.geometry,i.WGS84),a={name:ye(e),desc:pe(e),time:de(e),extensions:fe(r,e),id:ge(e)};if(A(t))o.appendChild(ue(r,t.y,t.x,t.hasZ?t.z:void 0,a));else if(_(t))for(const e of t.paths){if(e.length<2)continue;const n=e.map(([e,o,n])=>me(r,o,e,t.hasZ?n:void 0));o.appendChild(le(r,n,a))}else n.add(t.type)}if(n.size>0){const e=Array.from(n).join(", ");Me().warn(`One or more features with unsupported geometry types (${e}) were ignored during GPX conversion. GPX format only supports points and polylines.`)}const a=ce(r);return new Blob([a],{type:"application/gpx+xml"})}export async function toXLSX(e,t){E("featureSet",e).isNotMissing();const r=Array.from(e),o={...{useFormattedValues:!1,includeHeaderRow:!0,escapeFormulaChars:!0,geometryFormat:r.some(e=>void 0!==e.geometry&&null!==e.geometry)?GeometryFormat.WKT:GeometryFormat.NONE,outFields:Le(e.source),outSpatialReference:i.WGS84,dateFormat:U.DEFAULT,timeFormat:B.DEFAULT,numberFormat:$.DEFAULT,sheetName:"sheet1"},...t},{outFields:n,includeHeaderRow:a,dateFormat:s,timeFormat:c,numberFormat:l}=o,m=_e(r,o),u=Ge(r,n,e.schema,!0),f=Ge(r,n,e.schema,!1),p=await import("xlsx"),y=p.utils.sheet_new();let d=!1;if(a){const t=m.concat(u).concat(function(e,t){const r=t?.schema?.fieldExtensions.initializedItems.map(e=>e.field);return e.map(e=>r?.find(t=>oe(t.name,e))?.alias??e)}(f,e.source));d=!0,p.utils.sheet_add_aoa(y,[t],{cellDates:!0})}await Promise.all(r.map(async e=>{const t=[],r=new Set,n=new Set;t.push(...await Ce(e.geometry,o));for(const r of u){const n=nt(e.attributes.get(r),o);t.push(n)}for(const i of f){const a=Ue(e,i,o);if(a instanceof M){const o=e.schema.findFieldByName(i);"time-only"===o?.type&&r.add(t.length)}else if(a instanceof Date){const r=e.schema.findFieldByName(i);"date-only"===r?.type&&n.add(t.length)}const s=nt(a,o);t.push(s)}if(!t.every(e=>"string"!=typeof e||e.length<=32767))return void Me().warn(`toXLSX cell limit exceeded, feature (${e.primaryKey??e.id}) omitted.`);p.utils.sheet_add_aoa(y,[t],{cellDates:!0,origin:d?-1:void 0}),d=!0;const i=p.utils.decode_range(y["!ref"]);for(let e=i.s.c;e<=i.e.c;e++){const t=y[p.utils.encode_cell({r:i.e.r,c:e})];"d"===t.t?r.has(e)?t.z=rt(c??B.ROUND_TRIP):n.has(e)?t.z=tt(s??U.ROUND_TRIP):t.z=et(s??U.ROUND_TRIP):"n"===t.t&&(t.z=ot(l))}}));const g={SheetNames:[],Sheets:{}};g.SheetNames.push(o.sheetName),g.Sheets[o.sheetName]=y;const w=p.write(g,{type:"binary",bookType:"xlsx",compression:!0,bookSST:!0,cellDates:!0}),h=new Uint8Array(w.length);for(let e=0;e<w.length;e++)h[e]=w.charCodeAt(e);return new Blob([h.buffer],{type:"text/plain"})}export async function xlsxToUploadData(e,t){E("xlsxData",e).isNotMissing();const r=function(e){const t={includeHeaderRow:!0,inSpatialReference:i.WGS84,...Ae(e)};return{...t,...e}}(t),o=await async function(e,t){const r=await import("xlsx"),o=new Promise((o,n)=>{const i=new FileReader;i.onload=()=>{const e=new Uint8Array(i.result);let n="";for(const t of e)n+=String.fromCharCode(t);const a=r.read(n,{type:"binary",cellDates:!0}),s=t.sheetName||a.SheetNames[0],c=a.Sheets[s];o(c)},i.onerror=()=>{n(i.error)},i.readAsArrayBuffer(e)}),n=await o,i=r.utils.decode_range(n["!ref"]),a=[];for(let e=i.s.r;e<=i.e.r;e++){const t=[];for(let o=i.s.c;o<=i.e.c;o++){const i=n[`${r.utils.encode_cell({r:e,c:o})}`];"d"===i?.t&&i.v instanceof Date&&(i.v=new Date(i.v.getTime()+6e4*i.v.getTimezoneOffset())),t.push(i?{raw:i.v,formatted:"s"===i.t?void 0:i.w}:{raw:""})}a.push(t)}return a}(e,r);let{geometryFormat:n,geometryFields:a}=r;if(!n){const[e,t]=await Ze(o,r.inSpatialReference,r.includeHeaderRow);n=e,a=t.map(e=>r.includeHeaderRow?o[0][e]?.raw.toString()??N("gcx.api.data.convert.import-field-alias",(e+1).toString()):N("gcx.api.data.convert.import-field-alias",(e+1).toString()))}return{data:o,...r,geometryFormat:n,geometryFields:a}}export async function xlsxToFeatureSet(e,t){E("xlsxData",e).isNotMissing();return uploadDataToFeatureSet(await xlsxToUploadData(e,t))}export function kmlHexToEsriColor(t){return e.fromHex(`#${t.match(/.{2}/g).reverse().join("")}`)}export function parseKMLCoordinates(e){return e.trim().split(/\s+/).map(e=>{const[t,r,o]=e.split(",").map(Number);return{x:t,y:r,z:o}})}export function parseKMLSymbol(t,r,o){if(t){const r=t.querySelector("IconStyle > Icon > href")?.textContent;if(r)return new p({url:r,width:32,height:32});const o=t.querySelector("PolyStyle");if(o){const t=o.querySelector("color")?.textContent,r=t?kmlHexToEsriColor(t):new e([0,0,0,1]);return new y({color:r,outline:{color:[0,0,0,.5],width:1}})}const n=t.querySelector("LineStyle");if(n){const t=n.querySelector("color")?.textContent,r=t?kmlHexToEsriColor(t):new e([0,0,0,1]),o=parseFloat(n.querySelector("width")?.textContent||"1");return new d({color:r,width:o})}}return getDefaultSymbol(o,"polygon"===r?"polygon":"point"===r?"point":"polyline")}export async function toShapefile(e,t){E("featureSet",e).isNotMissing();const[{default:r},o]=await Promise.all([import("jszip"),import("../forked-libs/shp-write/index.js")]),n=Array.from(e),a={...{useFormattedValues:!1,outFields:Le(e.source),fileName:e.title||"export"},...t},{outFields:s,outSpatialReference:c,fileName:l}=a,m=e=>e.geometry.hasZ||e.geometry.hasM,u=new Map,f=n.filter(e=>A(e.geometry));u.set("POINTZ",f.filter(m)),u.set("POINT",f.filter(e=>!m(e)));const p=n.filter(e=>I(e.geometry));u.set("MULTIPOINTZ",p.filter(m)),u.set("MULTIPOINT",p.filter(e=>!m(e)));const y=n.filter(e=>_(e.geometry));u.set("POLYLINEZ",y.filter(m)),u.set("POLYLINE",y.filter(e=>!m(e)));const d=n.filter(e=>G(e.geometry)||L(e.geometry));u.set("POLYGONZ",d.filter(m)),u.set("POLYGON",d.filter(e=>!m(e)));const g=Ge(n,s,e.schema,!0);let w=Ge(n,s,e.schema,!1);w=g.concat(w);const h=new r,F=Array.from(u.keys()).filter(e=>u.get(e).length>0);await Promise.all(F.map(async t=>{const r=u.get(t),n=await Promise.all(r.map(e=>ve(e.geometry,c))),s=await async function(e){const{wkid:t,wkt:r}=e[0].spatialReference;if(!e.every(e=>e.spatialReference.wkid===t&&e.spatialReference.wkt===r))throw new Error("Cannot create shapefile that contains geometries with different spatial references.");return r??await Z(t??i.WGS84.wkid)}(n),m=a.useFormattedValues?Object.assign({},...w.map(e=>({[e]:De.STRING}))):function(e,t,r,o){const n={};for(const i of t){if(e.some(e=>$e(e,i))){n[i]=De.STRING;continue}const t=r?r.fields.find(e=>oe(e.name,i)):void 0;if(t){switch(t.type){case"oid":case"double":case"integer":case"single":case"small-integer":case"big-integer":n[i]=De.NUMBER;break;case"date":case"timestamp-offset":n[i]=o?De.NUMBER:De.DATE;break;default:n[i]=De.STRING}continue}const a=(e,t)=>e.attributes.get(t)??e.presentableAttributes.get(t);e.every(e=>a(e,i)instanceof Date||void 0===a(e,i))&&e.some(e=>a(e,i)instanceof Date)?n[i]=o?De.NUMBER:De.DATE:e.every(e=>"number"==typeof a(e,i)||void 0===a(e,i))&&e.some(e=>"number"==typeof a(e,i))?n[i]=De.NUMBER:e.every(e=>"boolean"==typeof a(e,i)||void 0===a(e,i))&&e.some(e=>"boolean"==typeof a(e,i))?n[i]=De.BOOLEAN:n[i]=De.STRING}return n}(r,w,e.schema,"timestamp"===a.dateFormat),f=function(e){return e.map(e=>{if(A(e)){const{x:t,y:r,z:o,m:n}=e,i=[t,r];return e.hasZ&&i.push(o),e.hasM&&i.push(n),it(i,e)}if(I(e))return at(e.points,e);if(_(e))return st(e.paths,e);if(G(e))return st(e.rings,e);if(L(e)){const t=[e.xmin,e.ymax];return[[t,[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin],t]]}throw new Error("Unsupported geometry type.")})}(n),p=function(e,t,r,o){const n=function(e){const t=new Set,r=new Map;for(const o of e){let e=o.replaceAll(".","_");e.length>xe&&(e=e.substring(0,xe));let n=1;for(;t.has(e);){const t=`_${n}`,r=xe-t.length;e=`${e.substring(0,r)}${t}`,n++}t.add(e),r.set(o,e)}return r}(t),i=[];for(const a of e){const e={};for(const i of t){let t=Ue(a,i,o);if(null==t&&(t=""),o.useFormattedValues)t=t.toString();else{t=ct(t,r[i],{...o,isDateOnly:"date-only"===a.schema.findFieldByName(i)?.type})}e[n.get(i)]=t}i.push(e)}return i}(r,w,m,a);o.write(p,t,f,(e,r)=>{const o=F.length>1?`${l}_${t.toLowerCase()}`:l;h.file(`${o}.shp`,r.shp.buffer,{binary:!0}),h.file(`${o}.shx`,r.shx.buffer,{binary:!0}),h.file(`${o}.dbf`,r.dbf.buffer,{binary:!0}),h.file(`${o}.prj`,s)})}));const S=await h.generateAsync({type:"uint8array"});return new Blob([S.buffer],{type:"text/plain"})}export async function kmlToLayerExtensions(e){E("blob",e).isNotMissing();const i=await e.text(),l=(new DOMParser).parseFromString(i,"application/xml"),m=function(e,i,u=!1){const f={};l.querySelectorAll("Style").forEach(e=>{f[`#${e.id}`]=e});const p=e.querySelector(":scope > name")?.textContent??"Unnamed Container",y=new Map;e.querySelectorAll(":scope > Placemark").forEach((e,a)=>{const s=e.querySelector("name")?.textContent??"",c=e.querySelector("description")?.textContent??"",l=function(e){const t=e.querySelector("Point > coordinates"),i=e.querySelector("LineString > coordinates"),a=e.querySelector("Polygon");if(t?.textContent){const[e]=parseKMLCoordinates(t.textContent.replace(/ /g,""));return new r(e)}if(i?.textContent)return new n({paths:[parseKMLCoordinates(i.textContent).map(({x:e,y:t})=>[e,t])]});if(a?.textContent){const e=a.querySelector("outerBoundaryIs > LinearRing > coordinates");if(e?.textContent){const t=[parseKMLCoordinates(e.textContent).map(({x:e,y:t})=>[e,t])];return new o({rings:t})}}return}(e);if(l?.type){const r=e.querySelector("styleUrl")?.textContent,o=parseKMLSymbol(r?f[r]:e.querySelector("Style"),l.type,i);y.has(l.type)||y.set(l.type,{graphics:[],symbols:[]});let n=function(e,t){for(let r=0;r<e.length;r++)if(lt(e[r],t))return r;return-1}(y.get(l.type).symbols,o);-1===n&&(y.get(l.type).symbols.push(o),n=y.get(l.type).symbols.length-1),y.get(l.type).graphics.push(new t({geometry:l,attributes:{name:s,description:c,SymbolID:n,OBJECTID:p+a}}))}});const d=e.querySelectorAll(":scope > Folder, :scope > Document");if(u||1!==y.size||0!==d.length){const e=new x({layer:new s({title:p})});return y.forEach((t,r)=>{const o=new a({displayField:"name",title:`${r.slice(0,1).toUpperCase()+r.slice(1)}s`,source:t.graphics,renderer:mt(t.symbols),fields:[new c({name:"OBJECTID",type:"oid",alias:"OBJECTID"}),new c({name:"SymbolID",type:"integer",alias:"SymbolID",editable:!1}),new c({name:"name",type:"string",alias:"name"}),new c({name:"description",type:"string",alias:"description",defaultValue:""})]}),n=new O({layer:o});e.layerExtensions.add(n)}),d.forEach((t,r)=>{const o=m(t,r);e.layerExtensions.add(o)}),e}{const e=[...y.values()][0],t=new a({displayField:"name",title:p,source:e.graphics,renderer:mt(e.symbols),fields:[new c({name:"OBJECTID",type:"oid",alias:"OBJECTID"}),new c({name:"SymbolID",type:"integer",alias:"SymbolID",editable:!1}),new c({name:"name",type:"string",alias:"name"}),new c({name:"description",type:"string",alias:"description",defaultValue:""})]});return new O({layer:t})}},u=[];return l.querySelectorAll("kml > Document, kml > Folder").forEach((e,t)=>{const r=m(e,t,!0);r.layerExtensions.length&&u.push(r)}),u}export async function lpkxToLayerExtensions(e,t){const{displayServiceUrl:r,geoProcessedLpkxData:o}=t;E("options.lpkxBlob",e).isNotMissing(),E("options.displayServiceUrl",r).isNotMissing();const{createLpkxLayer:n}=await import("./support/_lpkxConverter.js"),i=await n(o,e,r);return[new b({layer:i})]}export async function dxfToLayerExtensions(e,t,r){const{inputSpatialReference:o,outputSpatialReference:n}=t;E("options.dxfBlob",e).isNotMissing(),E("options.inputSpatialReference",o).isNotMissing(),E("options.outputSpatialReference",n).isNotMissing();const i=new ae(o,n,r),a=i.getContext(),c=await e.text(),l=new w;await re();try{const e=l.parseSync(c);if(!e)throw new Error("DXF parsing failed: parser returned null");a.dxf=e}catch(e){throw e instanceof Error?e:new Error(String(e))}const m=e instanceof File?e.name:"dxf-layer",u=m.replace(/[^a-zA-Z0-9_.-]/g,"_");if(a.fileName=m,a.sanitizedFileName=u,a.subLayers=await i.processAll(),!a.subLayers||0===a.subLayers.length)return[];const f=new s({id:`dxf-group-${u}-${(new Date).getTime()}`,title:m,visible:!0}),p={layer:f,visibilityMode:"independent"};return f.layers.addMany(a.subLayers),[new x(p)]}export async function fgdbToLayerExtensions(e,t){const{displayServiceUrl:r,geoProcessedFgdbData:o}=t;E("options.fgdbBlob",e).isNotMissing(),E("options.displayServiceUrl",r).isNotMissing(),E("options.geoProcessedFgdbData",o).isNotMissing();const{createFgdbLayer:n}=await import("./support/_fgdbConverter.js"),i=await n(o,e,r);return[new b({layer:i})]}export async function shapefileToUploadData(e,t){E("shapefileData",e).isNotMissing();const o=function(e){const t={...Ae(e)};return{...t,...e}}(t),n=new Promise((t,r)=>{const o=new FileReader;o.onload=()=>{t(o.result)},o.onerror=()=>{r(o.error)},o.readAsArrayBuffer(e)}),[{default:a},s]=await Promise.all([import("jszip"),import("shpjs")]),c=await n,l=await a.loadAsync(new Uint8Array(c)),m=new D;l.forEach((e,t)=>{t&&m.set(t.name,t)});const u=l.filter(()=>!0).map(e=>e.name);let f,p=u.filter(e=>e.endsWith(".shp")).map(e=>e.substring(0,e.length-4));if(p=function(e){if(!e.length)return[];let t=e[0];const r=t.match(be);return r?(t=r[1],e.filter(e=>{const r=e.match(be);return r?.[1]===t})):[t]}(p),u.some(e=>e.endsWith(".prj"))&&!p.every(e=>m.has(`${e}.prj`)))throw new Error("Shapefile zip must contain the same prj file for each separate shapefile");if(0===p.length)throw new h("shapefileData",`No shapefile found in the provided ${u.map(e=>e.substring(0,e.length-4))} zip file(s).`);await Promise.all(u.filter(e=>e.endsWith(".prj")).map(async e=>{const t=await l.file(e).async("string");if(f){if(t!==f)throw new Error("Shapefile zip must contain the same prj file for each separate shapefile")}else f=t}));let y=[],d=[];for(const e of p){if(!m.has(`${e}.shp`)||!m.has(`${e}.shx`)||!m.has(`${e}.dbf`))throw new F("Shapefile must contain shp, shx, and dbf files.");const t=s.parseShp(await m.get(`${e}.shp`).async("uint8array")),r=s.parseDbf(await m.get(`${e}.dbf`).async("uint8array"));if(r.length!==t.length)throw new Error("Shapefile must contain shp, shx, and dbf files.");y=y.concat(r),d=d.concat(t)}const g=await Promise.all(d.map(e=>async function(e,t){if(!e)return;const o=A(e)?function(e){E("geometry.coordinates",e.type).matches("Point"),E("geometry.coordinates",e.coordinates).satisfies(e=>"number"==typeof e||Array.isArray(e));const[t,o,n]=e.coordinates,a=new r({x:t,y:o,spatialReference:i.WGS84});if(Array.isArray(n)){const[e,t]=n;!e&&!t||e?a.z=e:a.m=t}return a}(e):await Q(e);if(t){let e;try{const r=await K(t);e=new i({wkid:H(r)})}catch{}e||(e=new i({wkt:t})),o.spatialReference=e}return o}(e,f))),w=geometryTypeHeaders[GeometryFormat.ARCGIS_JSON][0][0];y.forEach((e,t)=>e[w]=JSON.stringify(g[t]?g[t].toJSON():void 0));const S=function(e){const t=e.map(e=>Object.keys(e)).reduce((e,t)=>e.concat(t.filter(t=>!e.includes(t))),[]);return[t.map(e=>({raw:e})),...e.map(e=>t.map(t=>({raw:e[t]})))]}(y);return o.primaryKeyField||(o.primaryKeyField=we(S)),{data:S,...o,includeHeaderRow:!0,geometryFormat:GeometryFormat.ARCGIS_JSON,geometryFields:[w],inSpatialReference:g[0]?.spatialReference??i.fromJSON({wkid:4326})}}export async function shapefileToFeatureSet(e,t){return uploadDataToFeatureSet(await shapefileToUploadData(e,t))}export function getDefaultSymbol(e,t){const r=e%8;let o=["#FFDBFF","#88D6FF","#7F9FC3","#FF8200","#F34A53","#76E3B9","#E7BFFF","#FFC467"][r],n=["#EF3786","#005A99","#2D5070","#790C00","#4C0000","#006543","#6244A9","#904200"][r];if(Math.floor(e/8)%2!=0){const e=o;o=n,n=e}switch(t){case"point":case"multipoint":return new g({color:o,outline:{color:n}});case"polyline":return new d({color:o,width:"2"});case"polygon":return new y({color:o,outline:{color:n}});case"mesh":return new f({symbolLayers:[{type:"fill",material:{color:o},outline:{color:n}}]})}}function Ae(e){return{escapeFormulaChars:!0,outFields:["*"],generatePrimaryKey:!1,locale:T,detectOid:!e?.primaryKeyField}}function Ie(e){return{...{includeHeaderRow:!0,inSpatialReference:i.WGS84,...Ae(e)},...e}}function _e(e,t){return t.geometryFormat===GeometryFormat.XYZ?["x","y","z"]:t.geometryFormat===GeometryFormat.XY?["x","y"]:t.geometryFormat===GeometryFormat.LAT_LON?["latitude","longitude"]:t.geometryFormat===GeometryFormat.NONE?[]:["geometry"]}function Ge(e,t,r,o){const n=r.fields.filter(e=>"oid"===e.type).map(e=>e.name).toArray();if(o)return n;if(t&&!t.includes("*"))return t.filter(e=>!n.includes(e));{const t=r.fields.filter(e=>"oid"!==e.type).map(e=>e.name).toArray();let o=[];for(const r of e)for(const e of r.attributes.keys())t.includes(e)||n.includes(e)||o.includes(e)||o.push(e);return o=o.sort(),t.concat(o)}}function Le(e){if(!e)return["*"];const t=e.featureSettings.popupTemplate?.content;if(Array.isArray(t)){const e=new Set;for(const r of t)if("fields"===r.type&&Array.isArray(r.fieldInfos))for(const t of r.fieldInfos)t.visible&&e.add(t.fieldName);if(e.size>0)return Array.from(e)}const r=e.featureSettings.popupTemplate?.fieldInfos;if(Array.isArray(r)){const e=[];for(const t of r)t.visible&&e.push(t.fieldName);if(e.length>0)return e}return["*"]}async function Ce(e,t){const r=await ve(e,t.outSpatialReference);if(t.geometryFormat===GeometryFormat.XYZ){if(!r)return["","",""];if(!A(r))throw new Error("Cannot use geometry format XYZ with non-point geometry");return[r.x,r.y,r.z]}if(t.geometryFormat===GeometryFormat.XY){if(!r)return["",""];if(!A(r))throw new Error("Cannot use geometry format XY with non-point geometry");return[r.x,r.y]}if(t.geometryFormat===GeometryFormat.LAT_LON){if(!r)return["",""];if(!A(r))throw new Error("Cannot use geometry format LAT_LONG with non-point geometry");return[r.y,r.x]}return t.geometryFormat===GeometryFormat.ARCGIS_JSON?r?[JSON.stringify(r.toJSON())]:[""]:t.geometryFormat===GeometryFormat.WKT?r?[await q(r)]:[""]:t.geometryFormat===GeometryFormat.GEO_JSON?r?[JSON.stringify(await V(r))]:[""]:[]}async function ve(e,t){return e?.spatialReference&&!e.spatialReference.equals(t)&&t?(await W([e],t))[0]:e}function Pe(e,t){const r=[t.delimiter,Fe,"\r","\n",t.rowDelimiter];if(t.alwaysQuote||r.some(t=>e.includes(t))){const t=e.replace(new RegExp(Fe,"g"),`${Fe}${Fe}`);return`${Fe}${t}${Fe}`}return e}function je(e,t){if(null==e)return"";if(!t.useFormattedValues){if("number"==typeof e){const r=t.numberFormat||$.ROUND_TRIP;return k(r,e)}if(e instanceof Date)return"timestamp"===t.dateFormat?e.getTime().toString():v({format:t.dateFormat,timeZone:"UTC",isDateOnly:t.isDateOnly},e);if(e instanceof M)return J({format:t.timeFormat},e)}let r=e.toString();return t.escapeFormulaChars&&(r=Be(r)),r}function Ue(e,t,r){if(r.useFormattedValues||$e(e,t))return e.presentableAttributes.get(t)??e.attributes.get(t);const o=e.schema.findFieldByName(t)?.type;if(null!=o)switch(o){case"date":case"date-only":case"timestamp-offset":{const r=C(e.attributes.get(t));if(!isNaN(r.getTime()))return r;break}case"time-only":{const r=z(e.attributes.get(t));if(r.isValid)return r;break}}return e.attributes.get(t)??e.presentableAttributes.get(t)}function $e(e,t){return!!oe(t,e.schema.typeIdField)||("coded-value"===e.type?.domains?.[t]?.type||"coded-value"===e.schema.findFieldByName(t)?.domain?.type)}function Be(e){for(const t of he)if(e.startsWith(t))return`\t${e}`;return e}function He(e,t,r){const o=e.startsWith(Fe),n=e.endsWith(Fe);if(o&&!n||!o&&n)throw new Error(`Detected invalid CSV: Missing opening or closing quote for value at row:${t} column:${r}`);const i=o?e.substring(1,e.length-1):e;let a=-1;return ke(i,Fe,(e,o)=>{if(o===i.length)return!0;if(a<0){if(o!==i.length)return a=o,!0}else if(o===a+1)return a=-1,!0;throw new Error(`Detected invalid CSV: Non-escaped quote for value at row:${t} column:${r}`)}),i.replace(new RegExp(`${Fe}${Fe}`,"g"),Fe)}function ke(e,t,r){let o,n=!1,i=0,a=0;for(;o=e.indexOf(t,i),!(o<0);){for(let t=i;t<o;)e.substring(t).startsWith(Fe)?(n=!n,t+=1):t++;const s=o+t.length;if(!n){const e=r(a,o);if(a=s,!e)return}i=s}r(a,e.length)}async function ze(e,t){const r=JSON.parse(e),o=(await import("@arcgis/core/geometry/support/jsonUtils")).fromJSON(r);return r.spatialReference||(o.spatialReference=t),o}async function Je(e,t){const r=await Q(JSON.parse(e));return r.spatialReference=t,r}async function Xe(e,t){const r=await Y(e);return r.spatialReference=t,r}function We(e,t,r){const o=r?[r]:geometryTypeHeaders[t];for(const t of o){const r=t.map(t=>e.map(e=>e?.raw?.toString().trim().toLowerCase()).indexOf(t.trim().toLowerCase()));if(r.every(e=>e>=0))return r}}async function qe(e,t){return(await Promise.all(e.map(async(e,r)=>{const o=e?.raw;if("string"==typeof o&&""!==o)try{return await t(o,void 0),r}catch{return}}))).find(e=>void 0!==e)}function Ye(e,t,r){return"inv"===t?"string"==typeof e?parseFloat(e.replaceAll(",","")):e:H({locale:t,format:r},e)}async function Ze(e,t,r){const o=r?e.slice(1):e;if(r){const r=We(e[0],GeometryFormat.ARCGIS_JSON);if(void 0!==r)for(const[e,n]of Ee){try{await Ke(r[0],n,t,o)}catch{continue}return[e,[r[0]]]}const n=[GeometryFormat.XYZ,GeometryFormat.XY,GeometryFormat.LAT_LON];for(const t of n){const r=We(e[0],t);if(void 0!==r)return[t,r]}}for(const[e,r]of Ee){const n=await qe(o[0],r);if(void 0!==n){try{await Ke(n,r,t,o)}catch{continue}return[e,[n]]}}return[GeometryFormat.NONE,[]]}async function Ke(e,t,r,o){return{columnIndices:[e],geometries:await Promise.all(o.map(t=>t[e]).map(e=>{if(e?.raw)return t(e.raw.toString(),r)}))}}function Ve(e,t,r){let o=!1,n=!0,i=!0,a=!0,s=!0,c=!0;const l=new Set,{data:m,includeHeaderRow:u,dateFormat:f,timeFormat:p,primaryKeyField:y,locale:d}=e,g=u?m[0]:[],w=u?m.slice(1):m;for(const e of w){const r=e[t];r?.raw&&(l.add(r.raw),o=!0,n&&(n=te(r.raw,d)||Number.isNaN(r.raw)),i&&(i=r.raw instanceof Date||C(f||P,r.raw)!==j),s&&(s=C(f||Te,r.formatted)!==j),a&&(a=r.raw instanceof M||z(p||X,r.raw).isValid),c&&(c=z({format:p||Oe,locale:"en"},r.formatted).isValid))}const h=l.size===w.length;return y&&g[t]?.raw===y||r&&o&&h&&n?"esriFieldTypeOID":o&&c?"esriFieldTypeTimeOnly":o&&s?"esriFieldTypeDate":o&&n?"esriFieldTypeDouble":o&&a?"esriFieldTypeTimeOnly":o&&i?"esriFieldTypeDate":"esriFieldTypeString"}async function Qe(e,t,r){const{escapeFormulaChars:o,locale:n,numberFormat:i,dateFormat:a,timeFormat:s}=r;if("esriFieldTypeDouble"===t.type||"esriFieldTypeOID"===t.type)return"number"==typeof e?e:e?Ye(e,n,i):null;if("esriFieldTypeDate"===t.type){if(e instanceof Date)return e.getTime();if("number"==typeof e){const t=(await import("xlsx")).SSF.parse_date_code(e);return t?new Date(t.y,t.m-1,t.d,t.H,t.M,t.S).getTime():void 0}return""===e?null:C({locale:n,format:a},e).getTime()}if("esriFieldTypeTimeOnly"===t.type){if(e instanceof M)return e.toString();if(e instanceof Date)return new M(e).toString();if("number"==typeof e){const t=(await import("xlsx")).SSF.parse_date_code(e);return t?new M(`${t.H.toString().padStart(2,"0")}:${t.M.toString().padStart(2,"0")}:${t.S.toString().padStart(2,"0")}`).toString():void 0}return""===e?null:z({locale:n,format:s},e).toString()}const c=e?.toString()??"";if(o&&c.startsWith("\t"))for(const e of he)if(c.length>1&&c.charAt(1)===e)return c.substring(1);return c}function et(e){switch(e){case U.DATE_SHORT:return"dd/MM/yyyy";case U.DATE_LONG:return"MMMM d, yyyy";case U.TIME_SHORT:return"h:mm AM/PM";case U.TIME_LONG:return"h:mm:ss AM/PM";case U.DATE_TIME_SHORT:case U.DEFAULT:return"MMM d yyyy h:mm AM/PM";case U.DATE_TIME_LONG:return"MMMM d yyyy h:mm AM/PM";case U.FULL:return"dddd, MMMM d yyyy h:mm AM/PM";case U.ISO_8601:case U.ROUND_TRIP:return'yyyy-MM-dd"T"HH:mm:ss';default:{const t=e.replace(/tt/g,"AM/PM");return t.includes("z")&&Me().warn("Warning: Excel will not recognize timezone format 'z', 'zz', or 'zzz'"),t.includes("h")&&!t.includes("AM/PM")&&Me().warn("Warning: Excel will interpret 'h' as 'H' if the format does not have an AM/PM designator"),t}}}function tt(e){switch(e){case U.DATE_SHORT:return"dd/MM/yyyy";case U.DATE_LONG:return"MMMM d, yyyy";case U.DATE_TIME_SHORT:case U.DEFAULT:return"MMM d yyyy";case U.DATE_TIME_LONG:return"MMMM d yyyy";case U.FULL:return"dddd, MMMM d yyyy";case U.ISO_8601:case U.ROUND_TRIP:return"yyyy-MM-dd";default:return e.replace(/TtZzHhmSsUua/g,"")}}function rt(e){switch(e){case B.TIME_SHORT:return"h:mm AM/PM";case B.TIME_LONG:return"h:mm:ss AM/PM";case B.ISO_8601:case B.ROUND_TRIP:return"HH:mm:ss";default:{const t=e.replace(/tt/g,"AM/PM");return t.includes("h")&&!t.includes("AM/PM")&&Me().warn("Warning: Excel will interpret 'h' as 'H' if the format does not have an AM/PM designator"),t}}}function ot(e){switch(e){case $.ACCOUNTING:return'_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)';case $.CURRENCY:return'"$"#,##0.00';case $.FIXED_POINT:case $.DEFAULT:return"0.0000";case $.NUMBER:return"#,##0.0000";case $.PERCENT:return"0%";case $.ROUND_TRIP:return"0.00000";default:return e}}function nt(e,t){if(null==e)return"";if(!t.useFormattedValues){if("number"==typeof e)return e;if(e instanceof Date)return"timestamp"===t.dateFormat?e.getTime():e;if(e instanceof M)return e.toDate()}let r=e.toString();return t.escapeFormulaChars&&(r=Be(r)),r}function it(e,t){return 3===e.length&&!t.hasZ&&t.hasM?[e[0],e[1],void 0,e[2]]:e}function at(e,t){return e.map(e=>it(e,t))}function st(e,t){return e.map(e=>at(e,t))}function ct(e,t,r){switch(t){case De.NUMBER:return e instanceof Date?e.getTime():H(e);case De.STRING:return e instanceof Date?v({format:r.dateFormat??U.ROUND_TRIP,timeZone:"UTC",isDateOnly:r.isDateOnly},e):e instanceof M?J({format:r.timeFormat??B.ROUND_TRIP},e):"number"==typeof e?k(r.numberFormat??$.DEFAULT,e):e.toString();case De.BOOLEAN:return!!e;case De.DATE:return C(e);default:return e.toString()}}function lt(e,t){return JSON.stringify(e.toJSON())===JSON.stringify(t.toJSON())}function mt(e){return 1===e.length?new l({symbol:e[0]}):new m({field:"SymbolID",uniqueValueInfos:[...e.map((e,t)=>new u({label:t.toString(),symbol:e,value:t}))]})}
1
+ import e from"@arcgis/core/Color.js";import t from"@arcgis/core/Graphic.js";import r from"@arcgis/core/geometry/Point";import o from"@arcgis/core/geometry/Polygon.js";import n from"@arcgis/core/geometry/Polyline.js";import i from"@arcgis/core/geometry/SpatialReference";import a from"@arcgis/core/layers/FeatureLayer.js";import s from"@arcgis/core/layers/GroupLayer.js";import c from"@arcgis/core/layers/support/Field.js";import l from"@arcgis/core/renderers/SimpleRenderer.js";import m from"@arcgis/core/renderers/UniqueValueRenderer.js";import u from"@arcgis/core/renderers/support/UniqueValueInfo.js";import f from"@arcgis/core/symbols/MeshSymbol3D.js";import p from"@arcgis/core/symbols/PictureMarkerSymbol.js";import y from"@arcgis/core/symbols/SimpleFillSymbol.js";import d from"@arcgis/core/symbols/SimpleLineSymbol.js";import g from"@arcgis/core/symbols/SimpleMarkerSymbol.js";import w from"dxf-parser";import{ArgumentError as h}from"../ArgumentError.js";import{NotFoundError as F}from"../NotFoundError.js";import{geometryTypeToJson as S}from"../json/GeometryJson.js";import{translate as N}from"../locale/language.js";import{INVARIANT as T}from"../locale.js";import{FeatureCollectionLayerExtension as O}from"../mapping/FeatureCollectionLayerExtension.js";import{GroupLayerExtension as x}from"../mapping/GroupLayerExtension.js";import{MapImageLayerExtension as b}from"../mapping/MapImageLayerExtension.js";import{CaseInsensitiveObservableMap as D}from"../utilities/CaseInsensitiveObservableMap.js";import{Time as M}from"../utilities/Time.js";import{checkArg as E,assertNever as R}from"../utilities/checkArg.js";import{isPoint as A,isMultipoint as I,isPolyline as _,isPolygon as G,isExtent as L}from"../utilities/esri.js";import{parse as C,format as v,DEFAULT_PARSING_FORMATS as P,INVALID_DATE as j}from"../utilities/format/date.js";import{DateFormat as U,NumberFormat as $,TimeFormat as B}from"../utilities/format/formats.js";import{parse as H,format as k}from"../utilities/format/number.js";import{parse as z,format as J,DEFAULT_PARSING_FORMATS as X}from"../utilities/format/time.js";import{project as W,esriToWKT as q,wktToEsri as Y,esriWkidToWkt as Z,esriWktToWkid as K,esriToGeoJSON as V,geoJSONToEsri as Q}from"../utilities/geometry.js";import{getLogger as ee}from"../utilities/log.js";import{isNumeric as te}from"../utilities/number.js";import{delay as re}from"../utilities/promise.js";import{caseInsensitiveEquals as oe}from"../utilities/string.js";import{Feature as ne}from"./Feature.js";import{FeatureSet as ie}from"./FeatureSet.js";import{DxfEntityProcessor as ae}from"./support/_dxfConverters.js";import{createGpxDocument as se,serializeGpxDocument as ce,buildGpxTrack as le,buildGpxTrackPoint as me,buildGpxWaypoint as ue,getGpxExtensions as fe,getGpxTrackDescription as pe,getGpxTrackName as ye,getGpxTrackTime as de,getGpxTrackId as ge}from"./support/_gpxExport.js";import{addAndPopulateFidField as we}from"./support/_shapefileConverter.js";const he=["=","-","+","@"],Fe='"',Se="\r\n",Ne="\n",Te=[...P.map(et),"M/d/yy"],Oe=[...X.map(rt).map(e=>e.replace("AM/PM","tt"))],xe=10,be=/(\w+)_(point|multipoint|polyline|polygon)z?/;var De;function Me(){return ee("geocortex.api.data.convert")}!function(e){e.DATE="D",e.NUMBER="N",e.STRING="C",e.BOOLEAN="L"}(De||(De={}));export const FIELD_NAME_REGEX=/[^a-zA-Z\d_]/g;export var GeometryFormat;!function(e){e.NONE="NONE",e.WKT="WKT",e.XY="XY",e.XYZ="XYZ",e.LAT_LON="LAT_LONG",e.GEO_JSON="GEO_JSON",e.ARCGIS_JSON="ARCGIS_JSON"}(GeometryFormat||(GeometryFormat={}));export const geometryTypeHeaders={[GeometryFormat.XYZ]:[["x","y","z"]],[GeometryFormat.XY]:[["x","y"]],[GeometryFormat.LAT_LON]:[["latitude","longitude"],["lat","lon"],["lat","long"]],[GeometryFormat.ARCGIS_JSON]:[["geometry"]],[GeometryFormat.GEO_JSON]:[["geometry"]],[GeometryFormat.WKT]:[["geometry"]]};const Ee=[[GeometryFormat.ARCGIS_JSON,ze],[GeometryFormat.GEO_JSON,Je],[GeometryFormat.WKT,Xe]],Re=new Map(Ee);export async function uploadDataToFeatureSet(e){const t=await async function(e){const{data:t,includeHeaderRow:o,geometryFormat:n,geometryFields:i,locale:a,numberFormat:s,inSpatialReference:c}=e,l=o?t.slice(1):t;if(n===GeometryFormat.NONE)return{columnIndices:[]};const m=e=>Ye(e,a,s),u=(e,t)=>{const o=t===GeometryFormat.XYZ,n=t===GeometryFormat.LAT_LON;return{columnIndices:e,geometries:l.map(t=>{if(t.length>=Math.max(...e)&&te(t[e[0]]?.raw,a)&&te(t[e[1]]?.raw,a)&&(!o||te(t[e[2]]?.raw,a)))return new r({x:m(n?t[e[1]].raw:t[e[0]].raw),y:m(n?t[e[0]].raw:t[e[1]].raw),z:o?m(t[e[2]].raw):0,spatialReference:c})})}},f=async(e,t)=>({columnIndices:[e],geometries:await Promise.all(l.map(t=>t[e]).map(e=>{if(e?.raw)return t(e.raw.toString(),c)}))}),p=async(e,t)=>{switch(t){case GeometryFormat.NONE:return{columnIndices:[0]};case GeometryFormat.LAT_LON:case GeometryFormat.XYZ:case GeometryFormat.XY:return u(e,t);case GeometryFormat.ARCGIS_JSON:return f(e[0],ze);case GeometryFormat.GEO_JSON:return f(e[0],Je);case GeometryFormat.WKT:return f(e[0],Xe);default:return R(t,new Error(`Unknown geometry format "${t}".`))}};if(n){const e=We(o?t[0]:t[0].map((e,t)=>({raw:t.toString()})),n,o?i:i.map(e=>""+(parseInt(e.match(/\d+/g)[0])-1)));if(o&&void 0===e)throw new Error(`Error parsing file data: Expected geometry columns ${geometryTypeHeaders[n][0].join(",")} are missing for GeometryType.${n}`);return p(e??[0],n)}const[y,d]=await Ze(t,c,o);if(y===GeometryFormat.NONE)return{columnIndices:[]};return d.length>1?u(d,y):f(d[0],Re.get(y))}(e),o=function(e,t){const{data:r,displayField:o,includeHeaderRow:n,inSpatialReference:i,outSpatialReference:a,generatePrimaryKey:s}=e,c={fields:[]},l=e=>!(!t.columnIndices||0===t.columnIndices.length)&&t.columnIndices.includes(e);let{primaryKeyField:m}=e,u=0;for(let t=0;t<r[0].length;t++){if(l(t))continue;const o=Ve(e,t,!s&&!m&&!c.fields.find(e=>"esriFieldTypeOID"===e.type));let i=r[0][t]?.raw?.toString(),a=i?.replace(FIELD_NAME_REGEX,"_");n&&a||(a="field"+ ++u,i=N("gcx.api.data.convert.import-field-alias",u)),c.fields.push({alias:i,name:a,type:o}),"esriFieldTypeOID"===o&&(m=a)}if(c.spatialReference=a??t.geometries?.[0]?.spatialReference??i,t.geometries?.length){const e=t.geometries.filter(e=>void 0!==e).map(e=>e.type),r=e[0];c.geometryType=e.every(e=>e===r)?S(r):void 0}if(!c.fields.find(e=>"esriFieldTypeOID"===e.type)){const e=c.fields.length+1,t=!!c.fields.find(e=>"objectid"===e.name.toLowerCase());m=t?`OBJECTID_${e}`:"OBJECTID",c.fields.push({name:m,alias:m,type:"esriFieldTypeOID"})}return c.displayField=o??c.fields.find(e=>!oe(e.name,m)&&"esriFieldTypeString"===e.type)?.name??c.fields.find(e=>!oe(e.name,m))?.name??m,c.primaryKeyField=m,c}(e,t),n=await async function(e,t,r){const{data:o,includeHeaderRow:n,outFields:i,escapeFormulaChars:a,locale:s,numberFormat:c,dateFormat:l,timeFormat:m}=e,{spatialReference:u}=r,f=[],p=n?o.slice(1):o,y=(e,r)=>!t.columnIndices||0===t.columnIndices.length||!t.columnIndices.includes(r);return await Promise.all(p.map(async(e,o)=>{const n=ne.create();for(let t=0;t<r.fields.length;t++){const u=r.fields[t],f=e.filter(y);if(i.includes("*")||i.filter(e=>oe(e,u.name)).length>0){let e=await Qe(f[t]?.raw,u,{escapeFormulaChars:a,dateFormat:l,numberFormat:c,timeFormat:m,locale:s});"esriFieldTypeOID"===u.type&&null===e&&(e=o),n.attributes.set(u.name,e)}}t.geometries&&(n.geometry=await ve(t.geometries[o],u)),f.push(n)})),f}(e,t,o);return new ie({features:n,schema:o})}export async function toCsv(e,t){E("featureSet",e).isNotMissing();const r=Array.from(e),o={...{useFormattedValues:!1,alwaysQuote:!1,escapeFormulaChars:!0,delimiter:",",dateFormat:U.ROUND_TRIP,timeFormat:B.ROUND_TRIP,geometryFormat:r.some(e=>void 0!==e.geometry&&null!==e.geometry)?GeometryFormat.WKT:GeometryFormat.NONE,includeByteOrderMark:!0,outSpatialReference:i.WGS84,includeHeaderRow:!0,outFields:Le(e.source),rowDelimiter:navigator.platform?.startsWith("Win")?Se:"\n"},...t},{includeByteOrderMark:n,includeHeaderRow:a,delimiter:s,outFields:c,rowDelimiter:l}=o,m=[];n&&m.push("\ufeff");const u=_e(r,o),f=Ge(r,c,e.schema,!0),p=Ge(r,c,e.schema,!1);if(a){const e=[];for(const t of u)e.push(Pe(t,o));for(const t of f)e.push(Pe(t,o));for(const t of p)e.push(Pe(t,o));const t=e.join(s)+l;m.push(t)}await Promise.all(r.map(async e=>{const t=[],r=(t,r)=>{const o=Ue(e,t,r),n=e.schema.findFieldByName(t)?.type;return Pe(je(o,{...r,isDateOnly:"date-only"===n}),r)};t.push(...await async function(e,t){let r=await Ce(e,t);t.geometryFormat!==GeometryFormat.XYZ&&t.geometryFormat!==GeometryFormat.XY&&t.geometryFormat!==GeometryFormat.LAT_LON||(r=r.map(e=>void 0===e?"":je(e,t)));return r.map(e=>""===e?"":Pe(e,t))}(e.geometry,o)),t.push(...f.map(e=>r(e,o))),t.push(...p.map(e=>r(e,o)));const n=`${t.join(s)}${l}`;m.push(n)}));return new Blob(m,{type:"text/plain",endings:"\n"===l||l===Se?"transparent":"native"})}export async function csvToUploadData(e,t){let r;if(E("csvData",e).isNotMissing(),e instanceof Blob){const t=new Promise((t,r)=>{const o=new FileReader;o.onload=()=>{t(o.result)},o.onerror=()=>{r(o.error)},o.readAsText(e)});r=await t}else r=e;const o=Ie(t),n=o.rowDelimiter||function(e){let t=Ne;return ke(e,Se,(r,o)=>(0===r&&o===e.length||(t=Se),!1)),t}(r),i=o.delimiter??function(e,t,r){const o=",";if(0===e.length)return o;const n=[];if(ke(e,t,(t,r)=>(r!==e.length||t!==r)&&(n.push(e.substring(t,r)),n.length<3)),0===n.length)return o;let i=[{delimiter:",",rowsDelimiterOccurrences:[],rowsNumberAdjacentOccurrences:[]},{delimiter:";",rowsDelimiterOccurrences:[]},{delimiter:"|",rowsDelimiterOccurrences:[]},{delimiter:"\t",rowsDelimiterOccurrences:[]},{delimiter:" ",rowsDelimiterOccurrences:[]}].filter(e=>n[0].includes(e.delimiter));if(0===i.length)return o;for(const e of n)for(const t of i){let o=0,n=0;ke(e,t.delimiter,(i,a)=>{if(a!==e.length&&o++,","===t.delimiter){const t=e.charAt(a-1),o=e.charAt(a+1);te(t,r)&&te(o,r)&&n++}return!0}),t.rowsDelimiterOccurrences.push(o),","===t.delimiter&&t.rowsNumberAdjacentOccurrences.push(n)}if(i=i.filter(e=>e.rowsDelimiterOccurrences.every(t=>e.rowsDelimiterOccurrences[0]===t)).sort((e,t)=>t.rowsDelimiterOccurrences[0]-e.rowsDelimiterOccurrences[0]),i.length>1&&","===i[0].delimiter&&null!=r&&r!==T){const e=i[0];if(","===e?.delimiter&&","===Intl.NumberFormat(r).formatToParts(1.1).find(e=>"decimal"===e.type)?.value)for(let t=0;t<e.rowsDelimiterOccurrences.length;t++)if(e.rowsDelimiterOccurrences[t]<=e.rowsNumberAdjacentOccurrences[t]){i=i.filter(e=>","!==e.delimiter);break}}if(0===i.length)return o;return i[0].delimiter}(r,n,o.locale),a=function(e,t,r){const o=[],n=(e,t)=>{const o=[];return ke(e,r,(r,n)=>{const i=e.substring(r,n);return o.push({raw:He(i,t,o.length)}),!0}),o};if(ke(e,t,(t,r)=>{const i=e.substring(t,r);return i.length>0&&o.push(n(i,o.length)),!0}),o.length){const e=o[0].length;o.forEach((t,r)=>{if(t.length!==e)throw new Error(`Detected invalid CSV: Row ${r} does not have expected number of columns: ${e}`)})}return o}(r,n,i);let{geometryFormat:s,geometryFields:c}=o;if(!s){const[e,t]=await Ze(a,o.inSpatialReference,o.includeHeaderRow);s=e,c=t.map(e=>o.includeHeaderRow?a[0][e]?.raw??N("gcx.api.data.convert.import-field-alias",(e+1).toString()):N("gcx.api.data.convert.import-field-alias",(e+1).toString()))}return{data:a,...o,geometryFormat:s,geometryFields:c}}export async function csvToFeatureSet(e,t){const r=Ie(t);return uploadDataToFeatureSet(await csvToUploadData(e,r))}export async function toGpx(e){E("featureSet",e).isNotMissing();const t=Array.from(e),r=se(),o=r.documentElement,n=new Set;for(const e of t){if(!e.geometry)continue;const t=await ve(e.geometry,i.WGS84),a={name:ye(e),desc:pe(e),time:de(e),extensions:fe(r,e),id:ge(e)};if(A(t))o.appendChild(ue(r,t.y,t.x,t.hasZ?t.z:void 0,a));else if(_(t))for(const e of t.paths){if(e.length<2)continue;const n=e.map(([e,o,n])=>me(r,o,e,t.hasZ?n:void 0));o.appendChild(le(r,n,a))}else n.add(t.type)}if(n.size>0){const e=Array.from(n).join(", ");Me().warn(`One or more features with unsupported geometry types (${e}) were ignored during GPX conversion. GPX format only supports points and polylines.`)}const a=ce(r);return new Blob([a],{type:"application/gpx+xml"})}export async function toXLSX(e,t){E("featureSet",e).isNotMissing();const r=Array.from(e),o={...{useFormattedValues:!1,includeHeaderRow:!0,escapeFormulaChars:!0,geometryFormat:r.some(e=>void 0!==e.geometry&&null!==e.geometry)?GeometryFormat.WKT:GeometryFormat.NONE,outFields:Le(e.source),outSpatialReference:i.WGS84,dateFormat:U.DEFAULT,timeFormat:B.DEFAULT,numberFormat:$.DEFAULT,sheetName:"sheet1"},...t},{outFields:n,includeHeaderRow:a,dateFormat:s,timeFormat:c,numberFormat:l}=o,m=_e(r,o),u=Ge(r,n,e.schema,!0),f=Ge(r,n,e.schema,!1),p=await import("xlsx"),y=p.utils.sheet_new();let d=!1;if(a){const t=m.concat(u).concat(function(e,t){const r=t?.schema?.fieldExtensions.initializedItems.map(e=>e.field);return e.map(e=>r?.find(t=>oe(t.name,e))?.alias??e)}(f,e.source));d=!0,p.utils.sheet_add_aoa(y,[t],{cellDates:!0})}await Promise.all(r.map(async e=>{const t=[],r=new Set,n=new Set;t.push(...await Ce(e.geometry,o));for(const r of u){const n=nt(e.attributes.get(r),o);t.push(n)}for(const i of f){const a=Ue(e,i,o);if(a instanceof M){const o=e.schema.findFieldByName(i);"time-only"===o?.type&&r.add(t.length)}else if(a instanceof Date){const r=e.schema.findFieldByName(i);"date-only"===r?.type&&n.add(t.length)}const s=nt(a,o);t.push(s)}if(!t.every(e=>"string"!=typeof e||e.length<=32767))return void Me().warn(`toXLSX cell limit exceeded, feature (${e.primaryKey??e.id}) omitted.`);p.utils.sheet_add_aoa(y,[t],{cellDates:!0,origin:d?-1:void 0}),d=!0;const i=p.utils.decode_range(y["!ref"]);for(let e=i.s.c;e<=i.e.c;e++){const t=y[p.utils.encode_cell({r:i.e.r,c:e})];"d"===t.t?r.has(e)?t.z=rt(c??B.ROUND_TRIP):n.has(e)?t.z=tt(s??U.ROUND_TRIP):t.z=et(s??U.ROUND_TRIP):"n"===t.t&&(t.z=ot(l))}}));const g={SheetNames:[],Sheets:{}};g.SheetNames.push(o.sheetName),g.Sheets[o.sheetName]=y;const w=p.write(g,{type:"binary",bookType:"xlsx",compression:!0,bookSST:!0,cellDates:!0}),h=new Uint8Array(w.length);for(let e=0;e<w.length;e++)h[e]=w.charCodeAt(e);return new Blob([h.buffer],{type:"text/plain"})}export async function xlsxToUploadData(e,t){E("xlsxData",e).isNotMissing();const r=function(e){const t={includeHeaderRow:!0,inSpatialReference:i.WGS84,...Ae(e)};return{...t,...e}}(t),o=await async function(e,t){const r=await import("xlsx"),o=new Promise((o,n)=>{const i=new FileReader;i.onload=()=>{const e=new Uint8Array(i.result);let n="";for(const t of e)n+=String.fromCharCode(t);const a=r.read(n,{type:"binary",cellDates:!0}),s=t.sheetName||a.SheetNames[0],c=a.Sheets[s];o(c)},i.onerror=()=>{n(i.error)},i.readAsArrayBuffer(e)}),n=await o,i=r.utils.decode_range(n["!ref"]),a=[];for(let e=i.s.r;e<=i.e.r;e++){const t=[];for(let o=i.s.c;o<=i.e.c;o++){const i=n[`${r.utils.encode_cell({r:e,c:o})}`];"d"===i?.t&&i.v instanceof Date&&(i.v=new Date(i.v.getTime()+6e4*i.v.getTimezoneOffset())),t.push(i?{raw:i.v,formatted:"s"===i.t?void 0:i.w}:{raw:""})}a.push(t)}return a}(e,r);let{geometryFormat:n,geometryFields:a}=r;if(!n){const[e,t]=await Ze(o,r.inSpatialReference,r.includeHeaderRow);n=e,a=t.map(e=>r.includeHeaderRow?o[0][e]?.raw.toString()??N("gcx.api.data.convert.import-field-alias",(e+1).toString()):N("gcx.api.data.convert.import-field-alias",(e+1).toString()))}return{data:o,...r,geometryFormat:n,geometryFields:a}}export async function xlsxToFeatureSet(e,t){E("xlsxData",e).isNotMissing();return uploadDataToFeatureSet(await xlsxToUploadData(e,t))}export function kmlHexToEsriColor(t){return e.fromHex(`#${t.match(/.{2}/g).reverse().join("")}`)}export function parseKMLCoordinates(e){return e.trim().split(/\s+/).map(e=>{const[t,r,o]=e.split(",").map(Number);return{x:t,y:r,z:o}})}export function parseKMLSymbol(t,r,o){if(t){const r=t.querySelector("IconStyle > Icon > href")?.textContent;if(r)return new p({url:r,width:32,height:32});const o=t.querySelector("PolyStyle");if(o){const t=o.querySelector("color")?.textContent,r=t?kmlHexToEsriColor(t):new e([0,0,0,1]);return new y({color:r,outline:{color:[0,0,0,.5],width:1}})}const n=t.querySelector("LineStyle");if(n){const t=n.querySelector("color")?.textContent,r=t?kmlHexToEsriColor(t):new e([0,0,0,1]),o=parseFloat(n.querySelector("width")?.textContent||"1");return new d({color:r,width:o})}}return getDefaultSymbol(o,"polygon"===r?"polygon":"point"===r?"point":"polyline")}export async function toShapefile(e,t){E("featureSet",e).isNotMissing();const[{default:r},o]=await Promise.all([import("jszip"),import("../forked-libs/shp-write/index.js")]),n=Array.from(e),a={...{useFormattedValues:!1,outFields:Le(e.source),fileName:e.title||"export"},...t},{outFields:s,outSpatialReference:c,fileName:l}=a,m=e=>e.geometry.hasZ||e.geometry.hasM,u=new Map,f=n.filter(e=>A(e.geometry));u.set("POINTZ",f.filter(m)),u.set("POINT",f.filter(e=>!m(e)));const p=n.filter(e=>I(e.geometry));u.set("MULTIPOINTZ",p.filter(m)),u.set("MULTIPOINT",p.filter(e=>!m(e)));const y=n.filter(e=>_(e.geometry));u.set("POLYLINEZ",y.filter(m)),u.set("POLYLINE",y.filter(e=>!m(e)));const d=n.filter(e=>G(e.geometry)||L(e.geometry));u.set("POLYGONZ",d.filter(m)),u.set("POLYGON",d.filter(e=>!m(e)));const g=Ge(n,s,e.schema,!0);let w=Ge(n,s,e.schema,!1);w=g.concat(w);const h=new r,F=Array.from(u.keys()).filter(e=>u.get(e).length>0);await Promise.all(F.map(async t=>{const r=u.get(t),n=await Promise.all(r.map(e=>ve(e.geometry,c))),s=await async function(e){const{wkid:t,wkt:r}=e[0].spatialReference;if(!e.every(e=>e.spatialReference.wkid===t&&e.spatialReference.wkt===r))throw new Error("Cannot create shapefile that contains geometries with different spatial references.");return r??await Z(t??i.WGS84.wkid)}(n),m=a.useFormattedValues?Object.assign({},...w.map(e=>({[e]:De.STRING}))):function(e,t,r,o){const n={};for(const i of t){if(e.some(e=>$e(e,i))){n[i]=De.STRING;continue}const t=r?r.fields.find(e=>oe(e.name,i)):void 0;if(t){switch(t.type){case"oid":case"double":case"integer":case"single":case"small-integer":case"big-integer":n[i]=De.NUMBER;break;case"date":case"timestamp-offset":n[i]=o?De.NUMBER:De.DATE;break;default:n[i]=De.STRING}continue}const a=(e,t)=>e.attributes.get(t)??e.presentableAttributes.get(t);e.every(e=>a(e,i)instanceof Date||void 0===a(e,i))&&e.some(e=>a(e,i)instanceof Date)?n[i]=o?De.NUMBER:De.DATE:e.every(e=>"number"==typeof a(e,i)||void 0===a(e,i))&&e.some(e=>"number"==typeof a(e,i))?n[i]=De.NUMBER:e.every(e=>"boolean"==typeof a(e,i)||void 0===a(e,i))&&e.some(e=>"boolean"==typeof a(e,i))?n[i]=De.BOOLEAN:n[i]=De.STRING}return n}(r,w,e.schema,"timestamp"===a.dateFormat),f=function(e){return e.map(e=>{if(A(e)){const{x:t,y:r,z:o,m:n}=e,i=[t,r];return e.hasZ&&i.push(o),e.hasM&&i.push(n),it(i,e)}if(I(e))return at(e.points,e);if(_(e))return st(e.paths,e);if(G(e))return st(e.rings,e);if(L(e)){const t=[e.xmin,e.ymax];return[[t,[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin],t]]}throw new Error("Unsupported geometry type.")})}(n),p=function(e,t,r,o){const n=function(e){const t=new Set,r=new Map;for(const o of e){let e=o.replaceAll(".","_");e.length>xe&&(e=e.substring(0,xe));let n=1;for(;t.has(e);){const t=`_${n}`,r=xe-t.length;e=`${e.substring(0,r)}${t}`,n++}t.add(e),r.set(o,e)}return r}(t),i=[];for(const a of e){const e={};for(const i of t){let t=Ue(a,i,o);if(null==t&&(t=""),o.useFormattedValues)t=t.toString();else{t=ct(t,r[i],{...o,isDateOnly:"date-only"===a.schema.findFieldByName(i)?.type})}e[n.get(i)]=t}i.push(e)}return i}(r,w,m,a);o.write(p,t,f,(e,r)=>{const o=F.length>1?`${l}_${t.toLowerCase()}`:l;h.file(`${o}.shp`,r.shp.buffer,{binary:!0}),h.file(`${o}.shx`,r.shx.buffer,{binary:!0}),h.file(`${o}.dbf`,r.dbf.buffer,{binary:!0}),h.file(`${o}.prj`,s)})}));const S=await h.generateAsync({type:"uint8array"});return new Blob([S.buffer],{type:"text/plain"})}export async function kmlToLayerExtensions(e){E("blob",e).isNotMissing();const i=await e.text(),l=(new DOMParser).parseFromString(i,"application/xml"),m=function(e,i,u=!1){const f={};l.querySelectorAll("Style").forEach(e=>{f[`#${e.id}`]=e});const p=e.querySelector(":scope > name")?.textContent??"Unnamed Container",y=new Map;e.querySelectorAll(":scope > Placemark").forEach((e,a)=>{const s=e.querySelector("name")?.textContent??"",c=e.querySelector("description")?.textContent??"",l=function(e){const t=e.querySelector("Point > coordinates"),i=e.querySelector("LineString > coordinates"),a=e.querySelector("Polygon");if(t?.textContent){const[e]=parseKMLCoordinates(t.textContent.replace(/ /g,""));return new r(e)}if(i?.textContent)return new n({paths:[parseKMLCoordinates(i.textContent).map(({x:e,y:t})=>[e,t])]});if(a?.textContent){const e=a.querySelector("outerBoundaryIs > LinearRing > coordinates");if(e?.textContent){const t=[parseKMLCoordinates(e.textContent).map(({x:e,y:t})=>[e,t])];return new o({rings:t})}}return}(e);if(l?.type){const r=e.querySelector("styleUrl")?.textContent,o=parseKMLSymbol(r?f[r]:e.querySelector("Style"),l.type,i);y.has(l.type)||y.set(l.type,{graphics:[],symbols:[]});let n=function(e,t){for(let r=0;r<e.length;r++)if(lt(e[r],t))return r;return-1}(y.get(l.type).symbols,o);-1===n&&(y.get(l.type).symbols.push(o),n=y.get(l.type).symbols.length-1),y.get(l.type).graphics.push(new t({geometry:l,attributes:{name:s,description:c,SymbolID:n,OBJECTID:p+a}}))}});const d=e.querySelectorAll(":scope > Folder, :scope > Document");if(u||1!==y.size||0!==d.length){const e=new x({layer:new s({title:p})});return y.forEach((t,r)=>{const o=new a({displayField:"name",title:`${r.slice(0,1).toUpperCase()+r.slice(1)}s`,source:t.graphics,renderer:mt(t.symbols),fields:[new c({name:"OBJECTID",type:"oid",alias:"OBJECTID"}),new c({name:"SymbolID",type:"integer",alias:"SymbolID",editable:!1}),new c({name:"name",type:"string",alias:"name"}),new c({name:"description",type:"string",alias:"description",defaultValue:""})]}),n=new O({layer:o});e.layerExtensions.add(n)}),d.forEach((t,r)=>{const o=m(t,r);e.layerExtensions.add(o)}),e}{const e=[...y.values()][0],t=new a({displayField:"name",title:p,source:e.graphics,renderer:mt(e.symbols),fields:[new c({name:"OBJECTID",type:"oid",alias:"OBJECTID"}),new c({name:"SymbolID",type:"integer",alias:"SymbolID",editable:!1}),new c({name:"name",type:"string",alias:"name"}),new c({name:"description",type:"string",alias:"description",defaultValue:""})]});return new O({layer:t})}},u=[];return l.querySelectorAll("kml > Document, kml > Folder").forEach((e,t)=>{const r=m(e,t,!0);r.layerExtensions.length&&u.push(r)}),u}export async function lpkxToLayerExtensions(e,t){const{displayServiceUrl:r,geoProcessedLpkxData:o}=t;E("options.lpkxBlob",e).isNotMissing(),E("options.displayServiceUrl",r).isNotMissing();const{createLpkxLayer:n}=await import("./support/_lpkxConverter.js"),i=await n(o,e,r);return[new b({layer:i})]}export async function dxfToLayerExtensions(e,t,r){const{inputSpatialReference:o,outputSpatialReference:n}=t;E("options.dxfBlob",e).isNotMissing(),E("options.inputSpatialReference",o).isNotMissing(),E("options.outputSpatialReference",n).isNotMissing();const i=new ae(o,n,r),a=i.getContext(),c=await e.text(),l=new w;await re();try{const e=l.parseSync(c);if(!e)throw new Error("DXF parsing failed: parser returned null");a.dxf=e}catch(e){throw e instanceof Error?e:new Error(String(e))}const m=e instanceof File?e.name:"dxf-layer",u=m.replace(/[^a-zA-Z0-9_.-]/g,"_");if(a.fileName=m,a.sanitizedFileName=u,a.subLayers=await i.processAll(),!a.subLayers||0===a.subLayers.length)return[];const f=new s({id:`dxf-group-${u}-${(new Date).getTime()}`,title:m,visible:!0}),p={layer:f,visibilityMode:"independent"};return f.layers.addMany(a.subLayers),[new x(p)]}export async function fgdbToLayerExtensions(e,t){const{displayServiceUrl:r,geoProcessedFgdbData:o}=t;E("options.fgdbBlob",e).isNotMissing(),E("options.displayServiceUrl",r).isNotMissing(),E("options.geoProcessedFgdbData",o).isNotMissing();const{createFgdbLayer:n}=await import("./support/_fgdbConverter.js"),i=await n(o,e,r);return[new b({layer:i})]}export async function shapefileToUploadData(e,t){E("shapefileData",e).isNotMissing();const o=function(e){const t={...Ae(e)};return{...t,...e}}(t),n=new Promise((t,r)=>{const o=new FileReader;o.onload=()=>{t(o.result)},o.onerror=()=>{r(o.error)},o.readAsArrayBuffer(e)}),[{default:a},s]=await Promise.all([import("jszip"),import("shpjs")]),c=await n,l=await a.loadAsync(new Uint8Array(c)),m=new D;l.forEach((e,t)=>{t&&m.set(t.name,t)});const u=l.filter(()=>!0).map(e=>e.name);let f,p=u.filter(e=>e.endsWith(".shp")).map(e=>e.substring(0,e.length-4));if(p=function(e){if(!e.length)return[];let t=e[0];const r=t.match(be);return r?(t=r[1],e.filter(e=>{const r=e.match(be);return r?.[1]===t})):[t]}(p),u.some(e=>e.endsWith(".prj"))&&!p.every(e=>m.has(`${e}.prj`)))throw new Error("Shapefile zip must contain the same prj file for each separate shapefile");if(0===p.length)throw new h("shapefileData",`No shapefile found in the provided ${u.map(e=>e.substring(0,e.length-4))} zip file(s).`);await Promise.all(u.filter(e=>e.endsWith(".prj")).map(async e=>{const t=await l.file(e).async("string");if(f){if(t!==f)throw new Error("Shapefile zip must contain the same prj file for each separate shapefile")}else f=t}));let y=[],d=[];for(const e of p){if(!m.has(`${e}.shp`)||!m.has(`${e}.shx`)||!m.has(`${e}.dbf`))throw new F("Shapefile must contain shp, shx, and dbf files.");const t=s.parseShp(await m.get(`${e}.shp`).async("uint8array")),r=s.parseDbf(await m.get(`${e}.dbf`).async("uint8array"));if(r.length!==t.length)throw new Error("Shapefile must contain shp, shx, and dbf files.");y=y.concat(r),d=d.concat(t)}const g=await Promise.all(d.map(e=>async function(e,t){if(!e)return;const o=A(e)?function(e){E("geometry.coordinates",e.type).matches("Point"),E("geometry.coordinates",e.coordinates).satisfies(e=>"number"==typeof e||Array.isArray(e));const[t,o,n]=e.coordinates,a=new r({x:t,y:o,spatialReference:i.WGS84});if(Array.isArray(n)){const[e,t]=n;!e&&!t||e?a.z=e:a.m=t}return a}(e):await Q(e);if(t){let e;try{const r=await K(t);e=new i({wkid:H(r)})}catch{}e||(e=new i({wkt:t})),o.spatialReference=e}return o}(e,f))),w=geometryTypeHeaders[GeometryFormat.ARCGIS_JSON][0][0];y.forEach((e,t)=>e[w]=JSON.stringify(g[t]?g[t].toJSON():void 0));const S=function(e){const t=e.map(e=>Object.keys(e)).reduce((e,t)=>e.concat(t.filter(t=>!e.includes(t))),[]);return[t.map(e=>({raw:e})),...e.map(e=>t.map(t=>({raw:e[t]})))]}(y);return o.primaryKeyField||(o.primaryKeyField=we(S)),{data:S,...o,includeHeaderRow:!0,geometryFormat:GeometryFormat.ARCGIS_JSON,geometryFields:[w],inSpatialReference:g[0]?.spatialReference??i.fromJSON({wkid:4326})}}export async function shapefileToFeatureSet(e,t){return uploadDataToFeatureSet(await shapefileToUploadData(e,t))}export function getDefaultSymbol(e,t){const r=e%8;let o=["#FFDBFF","#88D6FF","#7F9FC3","#FF8200","#F34A53","#76E3B9","#E7BFFF","#FFC467"][r],n=["#EF3786","#005A99","#2D5070","#790C00","#4C0000","#006543","#6244A9","#904200"][r];if(Math.floor(e/8)%2!=0){const e=o;o=n,n=e}switch(t){case"point":case"multipoint":return new g({color:o,outline:{color:n}});case"polyline":return new d({color:o,width:"2"});case"polygon":return new y({color:o,outline:{color:n}});case"mesh":return new f({symbolLayers:[{type:"fill",material:{color:o},outline:{color:n}}]})}}function Ae(e){return{escapeFormulaChars:!0,outFields:["*"],generatePrimaryKey:!1,locale:T,detectOid:!e?.primaryKeyField}}function Ie(e){return{...{includeHeaderRow:!0,inSpatialReference:i.WGS84,...Ae(e)},...e}}function _e(e,t){return t.geometryFormat===GeometryFormat.XYZ?["x","y","z"]:t.geometryFormat===GeometryFormat.XY?["x","y"]:t.geometryFormat===GeometryFormat.LAT_LON?["latitude","longitude"]:t.geometryFormat===GeometryFormat.NONE?[]:["geometry"]}function Ge(e,t,r,o){const n=r.fields.filter(e=>"oid"===e.type).map(e=>e.name).toArray();if(o)return n;if(t&&!t.includes("*"))return t.filter(e=>!n.includes(e));{const t=r.fields.filter(e=>"oid"!==e.type).map(e=>e.name).toArray();let o=[];for(const r of e)for(const e of r.attributes.keys())t.includes(e)||n.includes(e)||o.includes(e)||o.push(e);return o=o.sort(),t.concat(o)}}function Le(e){if(!e)return["*"];const t=e.featureSettings.popupTemplate?.content;if(Array.isArray(t)){const e=new Set;for(const r of t)if("fields"===r.type&&Array.isArray(r.fieldInfos))for(const t of r.fieldInfos)t.visible&&e.add(t.fieldName);if(e.size>0)return Array.from(e)}const r=e.featureSettings.popupTemplate?.fieldInfos;if(Array.isArray(r)){const e=[];for(const t of r)t.visible&&e.push(t.fieldName);if(e.length>0)return e}return["*"]}async function Ce(e,t){const r=await ve(e,t.outSpatialReference);if(t.geometryFormat===GeometryFormat.XYZ){if(!r)return["","",""];if(!A(r))throw new Error("Cannot use geometry format XYZ with non-point geometry");return[r.x,r.y,r.z]}if(t.geometryFormat===GeometryFormat.XY){if(!r)return["",""];if(!A(r))throw new Error("Cannot use geometry format XY with non-point geometry");return[r.x,r.y]}if(t.geometryFormat===GeometryFormat.LAT_LON){if(!r)return["",""];if(!A(r))throw new Error("Cannot use geometry format LAT_LONG with non-point geometry");return[r.y,r.x]}return t.geometryFormat===GeometryFormat.ARCGIS_JSON?r?[JSON.stringify(r.toJSON())]:[""]:t.geometryFormat===GeometryFormat.WKT?r?[await q(r)]:[""]:t.geometryFormat===GeometryFormat.GEO_JSON?r?[JSON.stringify(await V(r))]:[""]:[]}async function ve(e,t){return e?.spatialReference&&!e.spatialReference.equals(t)&&t?(await W([e],t))[0]:e}function Pe(e,t){const r=[t.delimiter,Fe,"\r","\n",t.rowDelimiter];if(t.alwaysQuote||r.some(t=>e.includes(t))){const t=e.replace(new RegExp(Fe,"g"),`${Fe}${Fe}`);return`${Fe}${t}${Fe}`}return e}function je(e,t){if(null==e)return"";if(!t.useFormattedValues){if("number"==typeof e){const r=t.numberFormat||$.ROUND_TRIP;return k(r,e)}if(e instanceof Date)return"timestamp"===t.dateFormat?e.getTime().toString():v({format:t.dateFormat,timeZone:"UTC",isDateOnly:t.isDateOnly},e);if(e instanceof M)return J({format:t.timeFormat},e)}let r=e.toString();return t.escapeFormulaChars&&(r=Be(r)),r}function Ue(e,t,r){if(r.useFormattedValues||$e(e,t))return e.presentableAttributes.get(t)??e.attributes.get(t);const o=e.schema.findFieldByName(t)?.type;if(null!=o)switch(o){case"date":case"date-only":case"timestamp-offset":{const r=C(e.attributes.get(t));if(!isNaN(r.getTime()))return r;break}case"time-only":{const r=z(e.attributes.get(t));if(r.isValid)return r;break}}return e.attributes.get(t)??e.presentableAttributes.get(t)}function $e(e,t){return!!oe(t,e.schema.typeIdField)||("coded-value"===e.type?.domains?.[t]?.type||"coded-value"===e.schema.findFieldByName(t)?.domain?.type)}function Be(e){for(const t of he)if(e.startsWith(t))return`\t${e}`;return e}function He(e,t,r){const o=e.startsWith(Fe),n=e.endsWith(Fe);if(o&&!n||!o&&n)throw new Error(`Detected invalid CSV: Missing opening or closing quote for value at row:${t} column:${r}`);const i=o?e.substring(1,e.length-1):e;let a=-1;return ke(i,Fe,(e,o)=>{if(o===i.length)return!0;if(a<0){if(o!==i.length)return a=o,!0}else if(o===a+1)return a=-1,!0;throw new Error(`Detected invalid CSV: Non-escaped quote for value at row:${t} column:${r}`)}),i.replace(new RegExp(`${Fe}${Fe}`,"g"),Fe)}function ke(e,t,r){let o,n=!1,i=0,a=0;for(;o=e.indexOf(t,i),!(o<0);){for(let t=i;t<o;)e.substring(t).startsWith(Fe)?(n=!n,t+=1):t++;const s=o+t.length;if(!n){const e=r(a,o);if(a=s,!e)return}i=s}r(a,e.length)}async function ze(e,t){const r=JSON.parse(e),o=(await import("@arcgis/core/geometry/support/jsonUtils")).fromJSON(r);return r.spatialReference||(o.spatialReference=t),o}async function Je(e,t){const r=await Q(JSON.parse(e));return r.spatialReference=t,r}async function Xe(e,t){const r=await Y(e);return r.spatialReference=t,r}function We(e,t,r){const o=r?[r]:geometryTypeHeaders[t];for(const t of o){const r=t.map(t=>e.map(e=>e?.raw?.toString().trim().toLowerCase()).indexOf(t.trim().toLowerCase()));if(r.every(e=>e>=0))return r}}async function qe(e,t){return(await Promise.all(e.map(async(e,r)=>{const o=e?.raw;if("string"==typeof o&&""!==o)try{return await t(o,void 0),r}catch{return}}))).find(e=>void 0!==e)}function Ye(e,t,r){return"inv"===t?"string"==typeof e?parseFloat(e.replaceAll(",","")):e:H({locale:t,format:r},e)}async function Ze(e,t,r){const o=r?e.slice(1):e;if(r){const r=We(e[0],GeometryFormat.ARCGIS_JSON);if(void 0!==r)for(const[e,n]of Ee){try{await Ke(r[0],n,t,o)}catch{continue}return[e,[r[0]]]}const n=[GeometryFormat.XYZ,GeometryFormat.XY,GeometryFormat.LAT_LON];for(const t of n){const r=We(e[0],t);if(void 0!==r)return[t,r]}}for(const[e,r]of Ee){const n=await qe(o[0],r);if(void 0!==n){try{await Ke(n,r,t,o)}catch{continue}return[e,[n]]}}return[GeometryFormat.NONE,[]]}async function Ke(e,t,r,o){return{columnIndices:[e],geometries:await Promise.all(o.map(t=>t[e]).map(e=>{if(e?.raw)return t(e.raw.toString(),r)}))}}function Ve(e,t,r){let o=!1,n=!0,i=!0,a=!0,s=!0,c=!0;const l=new Set,{data:m,includeHeaderRow:u,dateFormat:f,timeFormat:p,primaryKeyField:y,locale:d}=e,g=u?m[0]:[],w=u?m.slice(1):m;for(const e of w){const r=e[t];r?.raw&&(l.add(r.raw),o=!0,n&&(n=te(r.raw,d)||Number.isNaN(r.raw)),i&&(i=r.raw instanceof Date||C(f||P,r.raw)!==j),s&&(s=C(f||Te,r.formatted)!==j),a&&(a=r.raw instanceof M||z(p||X,r.raw).isValid),c&&(c=z({format:p||Oe,locale:"en"},r.formatted).isValid))}const h=l.size===w.length;return y&&g[t]?.raw===y||r&&o&&h&&n?"esriFieldTypeOID":o&&c?"esriFieldTypeTimeOnly":o&&s?"esriFieldTypeDate":o&&n?"esriFieldTypeDouble":o&&a?"esriFieldTypeTimeOnly":o&&i?"esriFieldTypeDate":"esriFieldTypeString"}async function Qe(e,t,r){const{escapeFormulaChars:o,locale:n,numberFormat:i,dateFormat:a,timeFormat:s}=r;if("esriFieldTypeDouble"===t.type||"esriFieldTypeOID"===t.type)return"number"==typeof e?e:e?Ye(e,n,i):null;if("esriFieldTypeDate"===t.type){if(e instanceof Date)return e.getTime();if("number"==typeof e){const t=(await import("xlsx")).SSF.parse_date_code(e);return t?new Date(t.y,t.m-1,t.d,t.H,t.M,t.S).getTime():void 0}return""===e?null:C({locale:n,format:a},e).getTime()}if("esriFieldTypeTimeOnly"===t.type){if(e instanceof M)return e.toString();if(e instanceof Date)return new M(e).toString();if("number"==typeof e){const t=(await import("xlsx")).SSF.parse_date_code(e);return t?new M(`${t.H.toString().padStart(2,"0")}:${t.M.toString().padStart(2,"0")}:${t.S.toString().padStart(2,"0")}`).toString():void 0}return""===e?null:z({locale:n,format:s},e).toString()}const c=e?.toString()??"";if(o&&c.startsWith("\t"))for(const e of he)if(c.length>1&&c.charAt(1)===e)return c.substring(1);return c}function et(e){switch(e){case U.DATE_SHORT:return"dd/MM/yyyy";case U.DATE_LONG:return"MMMM d, yyyy";case U.TIME_SHORT:return"h:mm AM/PM";case U.TIME_LONG:return"h:mm:ss AM/PM";case U.DATE_TIME_SHORT:case U.DEFAULT:return"MMM d yyyy h:mm AM/PM";case U.DATE_TIME_LONG:return"MMMM d yyyy h:mm AM/PM";case U.FULL:return"dddd, MMMM d yyyy h:mm AM/PM";case U.ISO_8601:case U.ROUND_TRIP:return'yyyy-MM-dd"T"HH:mm:ss';default:{const t=e.replace(/tt/g,"AM/PM");return t.includes("z")&&Me().warn("Warning: Excel will not recognize timezone format 'z', 'zz', or 'zzz'"),t.includes("h")&&!t.includes("AM/PM")&&Me().warn("Warning: Excel will interpret 'h' as 'H' if the format does not have an AM/PM designator"),t}}}function tt(e){switch(e){case U.DATE_SHORT:return"dd/MM/yyyy";case U.DATE_LONG:return"MMMM d, yyyy";case U.DATE_TIME_SHORT:case U.DEFAULT:return"MMM d yyyy";case U.DATE_TIME_LONG:return"MMMM d yyyy";case U.FULL:return"dddd, MMMM d yyyy";case U.ISO_8601:case U.ROUND_TRIP:return"yyyy-MM-dd";default:return e.replace(/TtZzHhmSsUua/g,"")}}function rt(e){switch(e){case B.TIME_SHORT:return"h:mm AM/PM";case B.TIME_LONG:return"h:mm:ss AM/PM";case B.ISO_8601:case B.ROUND_TRIP:return"HH:mm:ss";default:{const t=e.replace(/tt/g,"AM/PM");return t.includes("h")&&!t.includes("AM/PM")&&Me().warn("Warning: Excel will interpret 'h' as 'H' if the format does not have an AM/PM designator"),t}}}function ot(e){switch(e){case $.ACCOUNTING:return'_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)';case $.CURRENCY:return'"$"#,##0.00';case $.FIXED_POINT:case $.DEFAULT:return"0.0000";case $.NUMBER:return"#,##0.0000";case $.PERCENT:return"0%";case $.ROUND_TRIP:return"0.00000";default:return e}}function nt(e,t){if(null==e)return"";if(!t.useFormattedValues){if("number"==typeof e)return e;if(e instanceof Date)return"timestamp"===t.dateFormat?e.getTime():e;if(e instanceof M)return e.toDate()}let r=e.toString();return t.escapeFormulaChars&&(r=Be(r)),r}function it(e,t){return 3===e.length&&!t.hasZ&&t.hasM?[e[0],e[1],void 0,e[2]]:e}function at(e,t){return e.map(e=>it(e,t))}function st(e,t){return e.map(e=>at(e,t))}function ct(e,t,r){switch(t){case De.NUMBER:return e instanceof Date?e.getTime():H(e);case De.STRING:return e instanceof Date?v({format:r.dateFormat??U.ROUND_TRIP,timeZone:"UTC",isDateOnly:r.isDateOnly},e):e instanceof M?J({format:r.timeFormat??B.ROUND_TRIP},e):"number"==typeof e?k(r.numberFormat??$.DEFAULT,e):e.toString();case De.BOOLEAN:return!!e;case De.DATE:return C(e);default:return e.toString()}}function lt(e,t){return JSON.stringify(e.toJSON())===JSON.stringify(t.toJSON())}function mt(e){return 1===e.length?new l({symbol:e[0]}):new m({field:"SymbolID",uniqueValueInfos:[...e.map((e,t)=>new u({label:t.toString(),symbol:e,value:t}))]})}