@vertigis/arcgis-extensions 38.0.5 → 38.2.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 (748) hide show
  1. package/AccessDeniedError.js +1 -1
  2. package/AppConfig.schema.json +35 -39
  3. package/ArgumentMissingError.js +1 -1
  4. package/ArgumentOutOfRangeError.js +1 -1
  5. package/Entity.js +1 -1
  6. package/FailureMode.d.ts +1 -1
  7. package/Hyperlink.js +1 -1
  8. package/LanguageResources.d.ts +1 -3
  9. package/LanguageResources.js +1 -1
  10. package/NotFoundError.js +1 -1
  11. package/PortalUri.js +1 -1
  12. package/data/ArcGISServiceTableExtension.js +1 -1
  13. package/data/Attachment.js +1 -1
  14. package/data/Feature.js +1 -1
  15. package/data/FeatureList.d.ts +3 -3
  16. package/data/FeatureList.js +1 -1
  17. package/data/FeatureSaveError.js +1 -1
  18. package/data/FeatureSet.js +1 -1
  19. package/data/FeatureSettings.js +1 -1
  20. package/data/FeatureSourceBase.js +1 -1
  21. package/data/FeatureStream.js +1 -1
  22. package/data/FieldExtension.js +1 -1
  23. package/data/PopupContentExtension.js +1 -1
  24. package/data/Relationship.js +1 -1
  25. package/data/RelationshipBase.js +1 -1
  26. package/data/Schema.js +1 -1
  27. package/data/Table.js +1 -1
  28. package/data/TableExtension.js +1 -1
  29. package/data/TaskSettings.js +1 -1
  30. package/data/_Relationship.d.ts +3 -3
  31. package/data/_Relationship.js +1 -1
  32. package/data/_TableExtension.js +1 -1
  33. package/data/convert.js +1 -1
  34. package/data/support/DefaultRelationshipFactory.js +1 -1
  35. package/data/support/DefaultTableExtensionFactory.js +1 -1
  36. package/data/support/attachments.js +1 -1
  37. package/docs/html/assets/main.js +56 -52
  38. package/docs/html/assets/search.js +1 -1
  39. package/docs/html/assets/style.css +23 -0
  40. package/docs/html/classes/data_FeatureSet.FeatureSet.html +2 -2
  41. package/docs/html/classes/data_FeatureStream.FeatureStream.html +1 -1
  42. package/docs/html/classes/utilities_ObservableMap.ObservableMap.html +2 -2
  43. package/docs/html/classes/utilities_ObservableSet.ObservableSet.html +2 -2
  44. package/docs/html/classes/utilities_ObservableWeakSet.ObservableWeakSet.html +1 -1
  45. package/docs/html/classes/utilities_asyncIterable.AsyncQueue.html +1 -1
  46. package/docs/html/classes/utilities_date.DateFormatter.html +1 -1
  47. package/docs/html/classes/utilities_string.StringFormatter.html +6 -24
  48. package/docs/html/functions/utilities_string.format.html +2 -18
  49. package/docs/html/interfaces/LanguageResources.LanguageResourcesProperties.html +2 -7
  50. package/docs/html/interfaces/data_support_attachments.AttachmentEnabledLayer.html +4 -6
  51. package/docs/html/interfaces/mapping_BuildingSceneLayerExtension.BuildingSceneLayerProperties.html +1 -1
  52. package/docs/html/interfaces/mapping_FeatureLayerExtension.FeatureLayerProperties.html +1 -1
  53. package/docs/html/interfaces/mapping_FeatureLayerExtensionBase.FeatureLayerBaseProperties.html +1 -1
  54. package/docs/html/interfaces/mapping_PointCloudLayerExtension.PointCloudLayerProperties.html +1 -1
  55. package/docs/html/interfaces/portal_ApplicationProperties.ApplicationProperties.html +15 -12
  56. package/docs/html/interfaces/portal_Background.ColorBackground.html +3 -2
  57. package/docs/html/interfaces/portal_BaseMap.BaseMap-1.html +2 -1
  58. package/docs/html/interfaces/portal_BaseMapLayer.BaseMapLayerBase.html +2 -1
  59. package/docs/html/interfaces/portal_BingLayer.BingLayer.html +2 -1
  60. package/docs/html/interfaces/portal_Bookmark.Bookmark.html +2 -1
  61. package/docs/html/interfaces/portal_BuildingSceneLayer.BuildingSceneLayer-1.html +1 -1
  62. package/docs/html/interfaces/portal_CIMSymbol.CIMSymbol.html +2 -1
  63. package/docs/html/interfaces/portal_CSVLayer.CSVLayer-1.html +3 -2
  64. package/docs/html/interfaces/portal_Camera.Camera-1.html +2 -1
  65. package/docs/html/interfaces/portal_ClassBreaksRenderer.ClassBreakInfo.html +2 -1
  66. package/docs/html/interfaces/portal_ClassBreaksRenderer.ClassBreaksRenderer.html +2 -1
  67. package/docs/html/interfaces/portal_CodedValueDomain.CodedValue.html +1 -1
  68. package/docs/html/interfaces/portal_CodedValueDomain.CodedValueDomain-1.html +1 -1
  69. package/docs/html/interfaces/portal_ColorClassBreakInfo.ColorClassBreakInfo.html +2 -1
  70. package/docs/html/interfaces/portal_ColorUniqueValueInfos.ColorUniqueValueInfos.html +2 -1
  71. package/docs/html/interfaces/portal_DataSource.DataSourceBase.html +2 -2
  72. package/docs/html/interfaces/portal_DefinitionEditor.DefinitionEditor.html +2 -1
  73. package/docs/html/interfaces/portal_DefinitionEditor.Input.html +1 -1
  74. package/docs/html/interfaces/portal_DefinitionEditor.Parameter.html +1 -1
  75. package/docs/html/interfaces/portal_DrawingInfo.DrawingInfo-1.html +2 -1
  76. package/docs/html/interfaces/portal_DynamicDataLayer.DynamicDataLayer.html +2 -2
  77. package/docs/html/interfaces/portal_DynamicMapLayer.DynamicMapLayer.html +1 -1
  78. package/docs/html/interfaces/portal_ElevationInfo.ElevationInfo-1.html +1 -1
  79. package/docs/html/interfaces/portal_ElevationLayer.ElevationLayer-1.html +3 -2
  80. package/docs/html/interfaces/portal_Environment.Environment-1.html +2 -1
  81. package/docs/html/interfaces/portal_Extent.Extent.html +1 -1
  82. package/docs/html/interfaces/portal_ExtrudeSymbol3DLayer.ExtrudeSymbol3DLayer.html +2 -1
  83. package/docs/html/interfaces/portal_Feature.Feature-1.html +2 -1
  84. package/docs/html/interfaces/portal_FeatureCollection.FeatureCollection.html +2 -1
  85. package/docs/html/interfaces/portal_FeatureLayer.FeatureLayer-1.html +3 -2
  86. package/docs/html/interfaces/portal_FeatureSet.FeatureSet.html +2 -1
  87. package/docs/html/interfaces/portal_Field.Field-1.html +1 -1
  88. package/docs/html/interfaces/portal_FieldInfo.FieldInfo.html +2 -1
  89. package/docs/html/interfaces/portal_FillSymbol3DLayer.FillSymbol3DLayer.html +2 -1
  90. package/docs/html/interfaces/portal_FormInfo.FormAttachmentElement.html +1 -1
  91. package/docs/html/interfaces/portal_FormInfo.FormBarcodeScannerInput.html +1 -1
  92. package/docs/html/interfaces/portal_FormInfo.FormComboBoxInput.html +1 -1
  93. package/docs/html/interfaces/portal_FormInfo.FormDateTimePickerInput.html +1 -1
  94. package/docs/html/interfaces/portal_FormInfo.FormExpressionInfo.html +1 -1
  95. package/docs/html/interfaces/portal_FormInfo.FormFieldElement.html +1 -1
  96. package/docs/html/interfaces/portal_FormInfo.FormGroupElement.html +1 -1
  97. package/docs/html/interfaces/portal_FormInfo.FormInfo-1.html +1 -1
  98. package/docs/html/interfaces/portal_FormInfo.FormRadioButtonsInput.html +1 -1
  99. package/docs/html/interfaces/portal_FormInfo.FormRelationshipElement.html +1 -1
  100. package/docs/html/interfaces/portal_FormInfo.FormSwitchInput.html +1 -1
  101. package/docs/html/interfaces/portal_FormInfo.FormTextAreaInput.html +1 -1
  102. package/docs/html/interfaces/portal_FormInfo.FormTextBoxInput.html +1 -1
  103. package/docs/html/interfaces/portal_Format.Format.html +2 -1
  104. package/docs/html/interfaces/portal_GeoRSSLayer.GeoRSSLayer-1.html +3 -2
  105. package/docs/html/interfaces/portal_GroupLayer.GroupLayer-1.html +3 -2
  106. package/docs/html/interfaces/portal_HeatmapRenderer.ColorStop.html +2 -1
  107. package/docs/html/interfaces/portal_HeatmapRenderer.HeatmapRenderer.html +2 -1
  108. package/docs/html/interfaces/portal_IconSymbol3DLayer.IconSymbol3DLayer.html +2 -1
  109. package/docs/html/interfaces/portal_ImageServiceLayer.ImageServiceLayer-1.html +3 -2
  110. package/docs/html/interfaces/portal_ImageServiceVectorLayer.ImageServiceVectorLayer.html +3 -2
  111. package/docs/html/interfaces/portal_InheritedDomain.InheritedDomain-1.html +1 -1
  112. package/docs/html/interfaces/portal_InitialState.InitialState-1.html +2 -1
  113. package/docs/html/interfaces/portal_IntegratedMeshLayer.IntegratedMeshLayer-1.html +3 -2
  114. package/docs/html/interfaces/portal_Item.Item-1.html +3 -2
  115. package/docs/html/interfaces/portal_JoinTableDataSource.JoinTableDataSource.html +2 -2
  116. package/docs/html/interfaces/portal_KMLLayer.KMLLayer-1.html +3 -2
  117. package/docs/html/interfaces/portal_LabelSymbol3D.LabelSymbol3D.html +2 -1
  118. package/docs/html/interfaces/portal_LabelingInfo.LabelingInfo-1.html +3 -2
  119. package/docs/html/interfaces/portal_Layer.Layer-1.html +1 -1
  120. package/docs/html/interfaces/portal_LayerDefinition.FieldOverride.html +1 -1
  121. package/docs/html/interfaces/portal_LayerDefinition.LayerDefinition-1.html +4 -3
  122. package/docs/html/interfaces/portal_LayerDefinition.LayerTimeInfo.html +2 -2
  123. package/docs/html/interfaces/portal_Lighting.SunLighting.html +2 -1
  124. package/docs/html/interfaces/portal_Lighting.VirtualLighting.html +2 -1
  125. package/docs/html/interfaces/portal_LineSymbol3D.LineSymbol3D.html +2 -1
  126. package/docs/html/interfaces/portal_LineSymbol3DLayer.LineSymbol3DLayer.html +2 -1
  127. package/docs/html/interfaces/portal_LocationInfo.LocationInfo.html +2 -1
  128. package/docs/html/interfaces/portal_MapFloorInfo.FacilityLayerInfo.html +1 -1
  129. package/docs/html/interfaces/portal_MapFloorInfo.LevelLayerInfo.html +1 -1
  130. package/docs/html/interfaces/portal_MapFloorInfo.MapFloorInfo-1.html +1 -1
  131. package/docs/html/interfaces/portal_MapFloorInfo.SiteLayerInfo.html +1 -1
  132. package/docs/html/interfaces/portal_MapRangeInfo.MapRangeInfo.html +2 -1
  133. package/docs/html/interfaces/portal_MapServiceLayer.MapServiceLayer-1.html +3 -2
  134. package/docs/html/interfaces/portal_MeshSymbol3D.MeshSymbol3D.html +2 -1
  135. package/docs/html/interfaces/portal_MosaicRule.MosaicRule-1.html +2 -1
  136. package/docs/html/interfaces/portal_Multipoint.Multipoint.html +1 -1
  137. package/docs/html/interfaces/portal_ObjectSymbol3DLayer.ObjectSymbol3DLayer.html +2 -1
  138. package/docs/html/interfaces/portal_OpenStreetMapLayer.OpenStreetMapLayer-1.html +2 -1
  139. package/docs/html/interfaces/portal_OperationalLayer.OperationalLayerBase.html +1 -1
  140. package/docs/html/interfaces/portal_PathSymbol3DLayer.PathSymbol3DLayer.html +2 -1
  141. package/docs/html/interfaces/portal_PictureFillSymbol.PictureFillSymbol.html +2 -1
  142. package/docs/html/interfaces/portal_PictureMarkerSymbol.PictureMarkerSymbol.html +2 -1
  143. package/docs/html/interfaces/portal_Point.Point.html +2 -1
  144. package/docs/html/interfaces/portal_PointCloudBitfieldFilter.PointCloudBitfieldFilter.html +2 -1
  145. package/docs/html/interfaces/portal_PointCloudClassBreaksRenderer.PointCloudClassBreaksRenderer.html +4 -2
  146. package/docs/html/interfaces/portal_PointCloudFixedSizeAlgorithm.PointCloudFixedSizeAlgorithm.html +2 -1
  147. package/docs/html/interfaces/portal_PointCloudLayer.PointCloudLayer-1.html +3 -2
  148. package/docs/html/interfaces/portal_PointCloudRGBRenderer.PointCloudRGBRenderer.html +4 -2
  149. package/docs/html/interfaces/portal_PointCloudRenderer.PointCloudRendererBase.html +4 -2
  150. package/docs/html/interfaces/portal_PointCloudReturnFilter.PointCloudReturnFilter.html +2 -1
  151. package/docs/html/interfaces/portal_PointCloudSplatAlgorithm.PointCloudSplatAlgorithm.html +2 -1
  152. package/docs/html/interfaces/portal_PointCloudStretchRenderer.PointCloudStretchRenderer.html +4 -2
  153. package/docs/html/interfaces/portal_PointCloudUniqueValueRenderer.PointCloudUniqueValueRenderer.html +4 -2
  154. package/docs/html/interfaces/portal_PointCloudValueFilter.PointCloudValueFilter.html +2 -1
  155. package/docs/html/interfaces/portal_PointSymbol3D.PointSymbol3D.html +3 -2
  156. package/docs/html/interfaces/portal_Polygon.Polygon.html +1 -1
  157. package/docs/html/interfaces/portal_PolygonSymbol3D.PolygonSymbol3D.html +2 -1
  158. package/docs/html/interfaces/portal_Polyline.Polyline.html +1 -1
  159. package/docs/html/interfaces/portal_PopupExpressionInfo.PopupExpressionInfo.html +2 -1
  160. package/docs/html/interfaces/portal_PopupInfo.OrderByFields.html +2 -1
  161. package/docs/html/interfaces/portal_PopupInfo.RelatedRecordsInfo.html +2 -1
  162. package/docs/html/interfaces/portal_PredominanceRenderer.PredominanceRenderer.html +2 -1
  163. package/docs/html/interfaces/portal_Presentation.Presentation-1.html +2 -1
  164. package/docs/html/interfaces/portal_QueryTableDataSource.QueryTableDataSource.html +2 -2
  165. package/docs/html/interfaces/portal_RangeDomain.RangeDomain-1.html +1 -1
  166. package/docs/html/interfaces/portal_RangeInfo.RangeInfo.html +2 -1
  167. package/docs/html/interfaces/portal_RasterDataSource.RasterDataSource.html +2 -2
  168. package/docs/html/interfaces/portal_Renderer.AuthoringInfo.html +2 -1
  169. package/docs/html/interfaces/portal_Renderer.ColorRamp.html +1 -1
  170. package/docs/html/interfaces/portal_Renderer.RendererBase.html +2 -1
  171. package/docs/html/interfaces/portal_RenderingRule.RenderingRule-1.html +3 -2
  172. package/docs/html/interfaces/portal_SceneLayer.SceneLayer-1.html +3 -2
  173. package/docs/html/interfaces/portal_SimpleFillSymbol.SimpleFillSymbol.html +2 -1
  174. package/docs/html/interfaces/portal_SimpleLineSymbol.SimpleLineSymbol.html +2 -1
  175. package/docs/html/interfaces/portal_SimpleMarkerSymbol.SimpleMarkerSymbol.html +2 -1
  176. package/docs/html/interfaces/portal_SimpleRenderer.SimpleRenderer.html +2 -1
  177. package/docs/html/interfaces/portal_Slide.Slide-1.html +4 -4
  178. package/docs/html/interfaces/portal_SpatialReference.SpatialReference-1.html +2 -1
  179. package/docs/html/interfaces/portal_StreamLayer.StreamLayer-1.html +2 -2
  180. package/docs/html/interfaces/portal_StyleSymbolReference.StyleSymbolReference.html +2 -1
  181. package/docs/html/interfaces/portal_SubtypeGroupLayer.SubtypeGroupLayer-1.html +3 -2
  182. package/docs/html/interfaces/portal_SubtypeGroupLayer.SubtypeSubtypeGroupLayer.html +2 -2
  183. package/docs/html/interfaces/portal_SubtypeSublayer.SubtypeSublayer-1.html +3 -2
  184. package/docs/html/interfaces/portal_Symbol.Font.html +1 -1
  185. package/docs/html/interfaces/portal_Symbol3D.Material.html +2 -1
  186. package/docs/html/interfaces/portal_Symbol3D.Outline.html +2 -1
  187. package/docs/html/interfaces/portal_Symbol3D.ResourceIconSymbol.html +2 -1
  188. package/docs/html/interfaces/portal_Symbol3D.ResourceObjectSymbol.html +2 -1
  189. package/docs/html/interfaces/portal_Table.Table.html +1 -1
  190. package/docs/html/interfaces/portal_TableDataSource.TableDataSource.html +2 -2
  191. package/docs/html/interfaces/portal_Template.Template-1.html +2 -1
  192. package/docs/html/interfaces/portal_TemporalRenderer.TemporalRenderer.html +2 -1
  193. package/docs/html/interfaces/portal_TextSymbol.TextSymbol.html +2 -1
  194. package/docs/html/interfaces/portal_TextSymbol3DLayer.TextSymbol3DLayer.html +2 -1
  195. package/docs/html/interfaces/portal_TileInfo.TileInfo-1.html +3 -2
  196. package/docs/html/interfaces/portal_TiledImageServiceLayer.TiledImageServiceLayer-1.html +3 -2
  197. package/docs/html/interfaces/portal_TiledMapServiceLayer.TiledMapServiceLayer-1.html +4 -3
  198. package/docs/html/interfaces/portal_Type.Type-1.html +3 -8
  199. package/docs/html/interfaces/portal_UniqueValueFromStyle.UniqueValueFromStyle.html +2 -1
  200. package/docs/html/interfaces/portal_UniqueValueRenderer.UniqueValueInfo.html +2 -1
  201. package/docs/html/interfaces/portal_UniqueValueRenderer.UniqueValueRenderer.html +2 -1
  202. package/docs/html/interfaces/portal_UtilityNetwork.TraceConfiguration.html +1 -1
  203. package/docs/html/interfaces/portal_UtilityNetwork.UtilityNetwork-1.html +1 -1
  204. package/docs/html/interfaces/portal_Value.Value.html +1 -1
  205. package/docs/html/interfaces/portal_VectorTileLayer.VectorTileLayer-1.html +3 -2
  206. package/docs/html/interfaces/portal_VerticalOffset.VerticalOffset.html +1 -1
  207. package/docs/html/interfaces/portal_Viewpoint.Viewpoint-1.html +2 -1
  208. package/docs/html/interfaces/portal_VisualVariable.ColorInfo.html +3 -2
  209. package/docs/html/interfaces/portal_VisualVariable.RotationInfo.html +3 -2
  210. package/docs/html/interfaces/portal_VisualVariable.Size.html +2 -1
  211. package/docs/html/interfaces/portal_VisualVariable.SizeInfo.html +3 -2
  212. package/docs/html/interfaces/portal_VisualVariable.TransparencyInfo.html +2 -1
  213. package/docs/html/interfaces/portal_VisualVariable.VisualVariableBase.html +1 -1
  214. package/docs/html/interfaces/portal_WMSLayer.WMSLayer-1.html +3 -2
  215. package/docs/html/interfaces/portal_WMSSublayer.WMSSublayer-1.html +2 -1
  216. package/docs/html/interfaces/portal_WMTSInfo.WMTSInfo-1.html +1 -1
  217. package/docs/html/interfaces/portal_Weather.CloudyWeather.html +2 -1
  218. package/docs/html/interfaces/portal_Weather.FoggyWeather.html +2 -1
  219. package/docs/html/interfaces/portal_Weather.RainyWeather.html +2 -1
  220. package/docs/html/interfaces/portal_Weather.SnowyWeather.html +2 -1
  221. package/docs/html/interfaces/portal_Weather.SunnyWeather.html +2 -1
  222. package/docs/html/interfaces/portal_WebMap.WebMap-1.html +3 -3
  223. package/docs/html/interfaces/portal_WebScene.WebScene-1.html +5 -3
  224. package/docs/html/interfaces/portal_WebSceneBaseMap.WebSceneBaseMap-1.html +2 -1
  225. package/docs/html/interfaces/portal_WebTileLayer.WebTileLayer-1.html +3 -2
  226. package/docs/html/interfaces/portal_Widgets.FloorFilter.html +1 -1
  227. package/docs/html/interfaces/portal_Widgets.Range.html +1 -1
  228. package/docs/html/interfaces/portal_Widgets.TimeSlider.html +3 -2
  229. package/docs/html/interfaces/portal_Widgets.Widgets.html +2 -1
  230. package/docs/html/interfaces/support_Serializable.PropertyDef.html +2 -2
  231. package/docs/html/interfaces/tasks_identify_IdentifyOptions.IdentifyOptions-1.html +2 -2
  232. package/docs/html/interfaces/tasks_search_SearchOptions.SearchOptions-1.html +2 -2
  233. package/docs/html/interfaces/utilities_array.CompareOptions.html +8 -8
  234. package/docs/html/interfaces/utilities_geometry.GeographicTransformationJson.html +1 -1
  235. package/docs/html/types/portal_DataSource.DataSource.html +1 -0
  236. package/docs/html/types/portal_Domain.Domain-1.html +2 -1
  237. package/docs/html/types/portal_Geometry.Geometry.html +1 -1
  238. package/docs/html/types/portal_PointCloudFilter.PointCloudFilter.html +2 -1
  239. package/docs/html/types/portal_Symbol.Color.html +1 -1
  240. package/docs/html/types/portal_Symbol.Symbol.html +1 -1
  241. package/docs/html/types/portal_Symbol3D.Symbol3D.html +2 -1
  242. package/docs/html/types/portal_VisualVariable.VisualVariable.html +2 -1
  243. package/docs/html/variables/mapping_BasemapExtension.defaultBasemapExtensionFactory.html +2 -2
  244. package/docs/html/variables/version.version.html +1 -1
  245. package/forked-libs/dbf/src/fields.js +1 -1
  246. package/forked-libs/dbf/src/structure.js +1 -1
  247. package/forked-libs/shp-write/src/download.js +1 -1
  248. package/forked-libs/shp-write/src/fields.js +1 -1
  249. package/forked-libs/shp-write/src/geojson.js +1 -1
  250. package/forked-libs/shp-write/src/multipoint.js +1 -1
  251. package/forked-libs/shp-write/src/points.js +1 -1
  252. package/forked-libs/shp-write/src/poly.js +1 -1
  253. package/forked-libs/shp-write/src/write.js +1 -1
  254. package/forked-libs/shp-write/src/zip.js +1 -1
  255. package/layer-preset/LayerPreset.d.ts +1 -1
  256. package/layer-preset/LayerPreset.js +1 -1
  257. package/layer-preset/LayerPresetSettings.d.ts +1 -1
  258. package/layer-preset/LayerPresetSettings.js +1 -1
  259. package/locale/_registry.js +1 -1
  260. package/locale/af.js +1 -1
  261. package/locale/ar-MA.js +1 -1
  262. package/locale/ar-SA.js +1 -1
  263. package/locale/ar-TN.js +1 -1
  264. package/locale/ar.js +1 -1
  265. package/locale/az.js +1 -1
  266. package/locale/be.js +1 -1
  267. package/locale/bg.js +1 -1
  268. package/locale/bn.js +1 -1
  269. package/locale/bs.js +1 -1
  270. package/locale/ca.js +1 -1
  271. package/locale/cs.js +1 -1
  272. package/locale/cv.js +1 -1
  273. package/locale/cy.js +1 -1
  274. package/locale/da.js +1 -1
  275. package/locale/de-AT.js +1 -1
  276. package/locale/de.js +1 -1
  277. package/locale/el.js +1 -1
  278. package/locale/en-AU.js +1 -1
  279. package/locale/en-CA.js +1 -1
  280. package/locale/en-GB.js +1 -1
  281. package/locale/en.js +1 -1
  282. package/locale/es.js +1 -1
  283. package/locale/et.js +1 -1
  284. package/locale/eu.js +1 -1
  285. package/locale/fa.js +1 -1
  286. package/locale/fi.js +1 -1
  287. package/locale/fo.js +1 -1
  288. package/locale/fr-CA.js +1 -1
  289. package/locale/fr.js +1 -1
  290. package/locale/gl.js +1 -1
  291. package/locale/he.js +1 -1
  292. package/locale/hi.js +1 -1
  293. package/locale/hr.js +1 -1
  294. package/locale/hu.js +1 -1
  295. package/locale/hy.js +1 -1
  296. package/locale/id.js +1 -1
  297. package/locale/inv.js +1 -1
  298. package/locale/is.js +1 -1
  299. package/locale/it.js +1 -1
  300. package/locale/ja.js +1 -1
  301. package/locale/ka.js +1 -1
  302. package/locale/km.js +1 -1
  303. package/locale/ko.js +1 -1
  304. package/locale/language.js +1 -1
  305. package/locale/lt.js +1 -1
  306. package/locale/lv.js +1 -1
  307. package/locale/mk.js +1 -1
  308. package/locale/ml.js +1 -1
  309. package/locale/mr.js +1 -1
  310. package/locale/ms-MY.js +1 -1
  311. package/locale/ms.js +1 -1
  312. package/locale/my.js +1 -1
  313. package/locale/nb.js +1 -1
  314. package/locale/ne.js +1 -1
  315. package/locale/nl.js +1 -1
  316. package/locale/nn.js +1 -1
  317. package/locale/no.js +1 -1
  318. package/locale/pl.js +1 -1
  319. package/locale/pt-BR.js +1 -1
  320. package/locale/pt.js +1 -1
  321. package/locale/ro.js +1 -1
  322. package/locale/ru.js +1 -1
  323. package/locale/si.js +1 -1
  324. package/locale/sk.js +1 -1
  325. package/locale/sl.js +1 -1
  326. package/locale/sq.js +1 -1
  327. package/locale/sr-Cyrl.js +1 -1
  328. package/locale/sr-ME.js +1 -1
  329. package/locale/sr.js +1 -1
  330. package/locale/sv.js +1 -1
  331. package/locale/ta.js +1 -1
  332. package/locale/th.js +1 -1
  333. package/locale/tl.js +1 -1
  334. package/locale/tr.js +1 -1
  335. package/locale/tzm-Latn.js +1 -1
  336. package/locale/tzm.js +1 -1
  337. package/locale/uk.js +1 -1
  338. package/locale/uz.js +1 -1
  339. package/locale/vi.js +1 -1
  340. package/locale/zh-TW.js +1 -1
  341. package/locale/zh.js +1 -1
  342. package/locale.js +1 -1
  343. package/mapping/ArcGISSublayerExtension.js +1 -1
  344. package/mapping/BasemapExtension.js +1 -1
  345. package/mapping/Bookmark.d.ts +1 -1
  346. package/mapping/Bookmark.js +1 -1
  347. package/mapping/BuildingComponentSublayerExtension.js +1 -1
  348. package/mapping/BuildingGroupSublayerExtension.js +1 -1
  349. package/mapping/BuildingSceneLayerExtension.js +1 -1
  350. package/mapping/BuildingSublayerExtension.js +1 -1
  351. package/mapping/CSVLayerExtension.js +1 -1
  352. package/mapping/ElevationLayerExtension.js +1 -1
  353. package/mapping/FeatureCollectionLayerExtension.js +1 -1
  354. package/mapping/FeatureLayerExtension.js +1 -1
  355. package/mapping/FeatureLayerExtensionBase.js +1 -1
  356. package/mapping/GeoRSSLayerExtension.js +1 -1
  357. package/mapping/GraphicsLayerExtension.js +1 -1
  358. package/mapping/GroundExtension.d.ts +1 -1
  359. package/mapping/GroundExtension.js +1 -1
  360. package/mapping/GroupLayerExtension.js +1 -1
  361. package/mapping/ImageryLayerExtension.js +1 -1
  362. package/mapping/ImageryTileLayerExtension.js +1 -1
  363. package/mapping/IntegratedMeshLayerExtension.js +1 -1
  364. package/mapping/KMLLayerExtension.js +1 -1
  365. package/mapping/KMLSublayerExtension.js +1 -1
  366. package/mapping/LayerExtension.js +1 -1
  367. package/mapping/MapConstraints.js +1 -1
  368. package/mapping/MapExtension.d.ts +5 -5
  369. package/mapping/MapExtension.js +1 -1
  370. package/mapping/MapImageLayerExtension.d.ts +1 -1
  371. package/mapping/MapImageLayerExtension.js +1 -1
  372. package/mapping/MapImageSublayerExtension.js +1 -1
  373. package/mapping/OpenStreetMapLayerExtension.js +1 -1
  374. package/mapping/PointCloudLayerExtension.js +1 -1
  375. package/mapping/SceneLayerExtension.js +1 -1
  376. package/mapping/StreamLayerExtension.js +1 -1
  377. package/mapping/SublayerExtension.js +1 -1
  378. package/mapping/SubtypeGroupLayerExtension.js +1 -1
  379. package/mapping/SubtypeSublayerExtension.js +1 -1
  380. package/mapping/TileLayerExtension.js +1 -1
  381. package/mapping/TileSublayerExtension.js +1 -1
  382. package/mapping/UnsupportedLayerExtension.js +1 -1
  383. package/mapping/VectorTileLayerExtension.js +1 -1
  384. package/mapping/WMSLayerExtension.js +1 -1
  385. package/mapping/WMSSublayerExtension.js +1 -1
  386. package/mapping/WMTSLayerExtension.js +1 -1
  387. package/mapping/WMTSSublayerExtension.js +1 -1
  388. package/mapping/WebTileLayerExtension.js +1 -1
  389. package/mapping/_LayerExtension.d.ts +1 -1
  390. package/mapping/_LayerExtension.js +1 -1
  391. package/mapping/_SublayerExtension.d.ts +1 -1
  392. package/mapping/_SublayerExtension.js +1 -1
  393. package/mapping/convert.js +1 -1
  394. package/mapping/support/ArrayWrappedCollection.js +1 -1
  395. package/mapping/support/DefaultLayerExtensionFactory.js +1 -1
  396. package/mapping/support/DefaultSublayerExtensionFactory.js +1 -1
  397. package/mapping/support/LayerListSettings.js +1 -1
  398. package/mapping/support/PopupTemplateFeatureSettings.js +1 -1
  399. package/mapping/support/WfsCapabilities.js +1 -1
  400. package/mapping/support/WfsFeatureType.js +1 -1
  401. package/mapping/support/_LayerExtensionCollection.js +1 -1
  402. package/mapping/support/_SublayerExtensionCollection.js +1 -1
  403. package/mapping/support/_kml.js +1 -1
  404. package/mapping/support/ogc.js +1 -1
  405. package/menus/Menu.js +1 -1
  406. package/menus/MenuItem.js +1 -1
  407. package/package.json +36 -35
  408. package/portal/ApplicationProperties.d.ts +16 -13
  409. package/portal/Background.d.ts +3 -2
  410. package/portal/Background.js +1 -1
  411. package/portal/BaseMap.d.ts +1 -0
  412. package/portal/BaseMap.js +1 -1
  413. package/portal/BaseMapLayer.d.ts +3 -2
  414. package/portal/BingLayer.d.ts +1 -0
  415. package/portal/Bookmark.d.ts +1 -0
  416. package/portal/BuildingSceneLayer.d.ts +1 -1
  417. package/portal/BuildingSceneLayer.js +1 -1
  418. package/portal/BuildingSceneSublayer.js +1 -1
  419. package/portal/CIMSymbol.d.ts +1 -0
  420. package/portal/CSVLayer.d.ts +1 -0
  421. package/portal/CSVLayer.js +1 -1
  422. package/portal/Camera.d.ts +1 -0
  423. package/portal/Camera.js +1 -1
  424. package/portal/ClassBreaksRenderer.d.ts +4 -2
  425. package/portal/CodedValueDomain.d.ts +2 -2
  426. package/portal/CodedValueDomain.js +1 -1
  427. package/portal/ColorClassBreakInfo.d.ts +1 -0
  428. package/portal/ColorUniqueValueInfos.d.ts +1 -0
  429. package/portal/DataSource.d.ts +5 -4
  430. package/portal/DefinitionEditor.d.ts +3 -2
  431. package/portal/Domain.d.ts +3 -2
  432. package/portal/Domain.js +1 -1
  433. package/portal/DrawingInfo.d.ts +1 -0
  434. package/portal/DrawingInfo.js +1 -1
  435. package/portal/DynamicDataLayer.d.ts +2 -2
  436. package/portal/DynamicMapLayer.d.ts +1 -1
  437. package/portal/Edges.d.ts +1 -1
  438. package/portal/Edges.js +1 -1
  439. package/portal/Effect.d.ts +2 -2
  440. package/portal/ElevationInfo.d.ts +2 -2
  441. package/portal/ElevationInfo.js +1 -1
  442. package/portal/ElevationLayer.d.ts +1 -0
  443. package/portal/ElevationLayer.js +1 -1
  444. package/portal/Environment.d.ts +1 -0
  445. package/portal/Environment.js +1 -1
  446. package/portal/Extent.d.ts +1 -1
  447. package/portal/ExtrudeSymbol3DLayer.d.ts +1 -0
  448. package/portal/Feature.d.ts +1 -0
  449. package/portal/Feature.js +1 -1
  450. package/portal/FeatureCollection.d.ts +1 -0
  451. package/portal/FeatureLayer.d.ts +2 -1
  452. package/portal/FeatureLayer.js +1 -1
  453. package/portal/FeatureReduction.d.ts +1 -1
  454. package/portal/FeatureReduction.js +1 -1
  455. package/portal/FeatureSet.d.ts +1 -0
  456. package/portal/Field.d.ts +2 -2
  457. package/portal/Field.js +1 -1
  458. package/portal/FieldInfo.d.ts +2 -1
  459. package/portal/FillSymbol3DLayer.d.ts +1 -0
  460. package/portal/FormInfo.d.ts +13 -13
  461. package/portal/FormInfo.js +1 -1
  462. package/portal/Format.d.ts +2 -1
  463. package/portal/GeoRSSLayer.d.ts +1 -0
  464. package/portal/GeoRSSLayer.js +1 -1
  465. package/portal/Geometry.d.ts +3 -3
  466. package/portal/Geometry.js +1 -1
  467. package/portal/Ground.d.ts +1 -1
  468. package/portal/Ground.js +1 -1
  469. package/portal/GroupLayer.d.ts +2 -1
  470. package/portal/GroupLayer.js +1 -1
  471. package/portal/HeatmapRenderer.d.ts +2 -0
  472. package/portal/IconSymbol3DLayer.d.ts +1 -0
  473. package/portal/ImageServiceLayer.d.ts +1 -0
  474. package/portal/ImageServiceLayer.js +1 -1
  475. package/portal/ImageServiceVectorLayer.d.ts +1 -0
  476. package/portal/InheritedDomain.d.ts +1 -1
  477. package/portal/InheritedDomain.js +1 -1
  478. package/portal/InitialState.d.ts +1 -0
  479. package/portal/InitialState.js +1 -1
  480. package/portal/IntegratedMeshLayer.d.ts +1 -0
  481. package/portal/IntegratedMeshLayer.js +1 -1
  482. package/portal/Item.d.ts +2 -1
  483. package/portal/Item.js +1 -1
  484. package/portal/JoinTableDataSource.d.ts +2 -2
  485. package/portal/KMLLayer.d.ts +1 -0
  486. package/portal/KMLLayer.js +1 -1
  487. package/portal/LabelSymbol3D.d.ts +1 -0
  488. package/portal/LabelingInfo.d.ts +3 -2
  489. package/portal/LabelingInfo.js +1 -1
  490. package/portal/Layer.d.ts +1 -1
  491. package/portal/Layer.js +1 -1
  492. package/portal/LayerBase.js +1 -1
  493. package/portal/LayerDefinition.d.ts +8 -7
  494. package/portal/LayerDefinition.js +1 -1
  495. package/portal/Lighting.d.ts +3 -1
  496. package/portal/Lighting.js +1 -1
  497. package/portal/LineSymbol3D.d.ts +1 -0
  498. package/portal/LineSymbol3DLayer.d.ts +1 -0
  499. package/portal/LocationInfo.d.ts +1 -0
  500. package/portal/MapFloorInfo.d.ts +4 -4
  501. package/portal/MapFloorInfo.js +1 -1
  502. package/portal/MapRangeInfo.d.ts +1 -0
  503. package/portal/MapServiceLayer.d.ts +1 -0
  504. package/portal/MapServiceLayer.js +1 -1
  505. package/portal/MediaInfo.d.ts +1 -1
  506. package/portal/MediaInfo.js +1 -1
  507. package/portal/MeshSymbol3D.d.ts +1 -0
  508. package/portal/MosaicRule.d.ts +3 -2
  509. package/portal/MosaicRule.js +1 -1
  510. package/portal/Multipoint.d.ts +1 -1
  511. package/portal/ObjectSymbol3DLayer.d.ts +1 -0
  512. package/portal/OpenStreetMapLayer.d.ts +1 -0
  513. package/portal/OpenStreetMapLayer.js +1 -1
  514. package/portal/OperationalLayer.d.ts +3 -3
  515. package/portal/PathSymbol3DLayer.d.ts +1 -0
  516. package/portal/PictureFillSymbol.d.ts +1 -0
  517. package/portal/PictureMarkerSymbol.d.ts +1 -0
  518. package/portal/Point.d.ts +2 -1
  519. package/portal/PointCloudBitfieldFilter.d.ts +1 -0
  520. package/portal/PointCloudClassBreaksRenderer.d.ts +1 -0
  521. package/portal/PointCloudFilter.d.ts +2 -1
  522. package/portal/PointCloudFixedSizeAlgorithm.d.ts +1 -0
  523. package/portal/PointCloudLayer.d.ts +1 -0
  524. package/portal/PointCloudLayer.js +1 -1
  525. package/portal/PointCloudRGBRenderer.d.ts +1 -0
  526. package/portal/PointCloudRenderer.d.ts +3 -1
  527. package/portal/PointCloudRenderer.js +1 -1
  528. package/portal/PointCloudReturnFilter.d.ts +1 -0
  529. package/portal/PointCloudSplatAlgorithm.d.ts +1 -0
  530. package/portal/PointCloudStretchRenderer.d.ts +1 -0
  531. package/portal/PointCloudUniqueValueRenderer.d.ts +1 -0
  532. package/portal/PointCloudValueFilter.d.ts +1 -0
  533. package/portal/PointSymbol3D.d.ts +2 -1
  534. package/portal/Polygon.d.ts +1 -1
  535. package/portal/PolygonSymbol3D.d.ts +1 -0
  536. package/portal/Polyline.d.ts +1 -1
  537. package/portal/PopupExpressionInfo.d.ts +2 -1
  538. package/portal/PopupInfo.d.ts +3 -1
  539. package/portal/PopupInfo.js +1 -1
  540. package/portal/PredominanceRenderer.d.ts +1 -0
  541. package/portal/Presentation.d.ts +1 -0
  542. package/portal/Presentation.js +1 -1
  543. package/portal/QueryTableDataSource.d.ts +1 -1
  544. package/portal/RangeDomain.d.ts +1 -1
  545. package/portal/RangeDomain.js +1 -1
  546. package/portal/RangeInfo.d.ts +1 -0
  547. package/portal/RasterDataSource.d.ts +1 -1
  548. package/portal/Renderer.d.ts +8 -6
  549. package/portal/Renderer.js +1 -1
  550. package/portal/RenderingRule.d.ts +3 -2
  551. package/portal/RenderingRule.js +1 -1
  552. package/portal/SceneLayer.d.ts +1 -0
  553. package/portal/SceneLayer.js +1 -1
  554. package/portal/SimpleFillSymbol.d.ts +2 -1
  555. package/portal/SimpleLineSymbol.d.ts +2 -1
  556. package/portal/SimpleMarkerSymbol.d.ts +2 -1
  557. package/portal/SimpleRenderer.d.ts +1 -0
  558. package/portal/Slide.d.ts +4 -4
  559. package/portal/Slide.js +1 -1
  560. package/portal/SpatialReference.d.ts +1 -0
  561. package/portal/SpatialReference.js +1 -1
  562. package/portal/StreamLayer.d.ts +1 -1
  563. package/portal/StreamLayer.js +1 -1
  564. package/portal/StyleSymbolReference.d.ts +1 -0
  565. package/portal/SubtypeGroupLayer.d.ts +3 -2
  566. package/portal/SubtypeGroupLayer.js +1 -1
  567. package/portal/SubtypeSublayer.d.ts +1 -0
  568. package/portal/SubtypeSublayer.js +1 -1
  569. package/portal/Symbol.d.ts +11 -11
  570. package/portal/Symbol.js +1 -1
  571. package/portal/Symbol3D.d.ts +7 -2
  572. package/portal/Table.d.ts +3 -3
  573. package/portal/Table.js +1 -1
  574. package/portal/TableDataSource.d.ts +1 -1
  575. package/portal/Template.d.ts +2 -1
  576. package/portal/Template.js +1 -1
  577. package/portal/TemporalRenderer.d.ts +1 -0
  578. package/portal/TextSymbol.d.ts +1 -0
  579. package/portal/TextSymbol3DLayer.d.ts +1 -0
  580. package/portal/TileInfo.d.ts +2 -1
  581. package/portal/TileInfo.js +1 -1
  582. package/portal/TiledImageServiceLayer.d.ts +1 -0
  583. package/portal/TiledImageServiceLayer.js +1 -1
  584. package/portal/TiledMapServiceLayer.d.ts +2 -1
  585. package/portal/TiledMapServiceLayer.js +1 -1
  586. package/portal/Type.d.ts +2 -4
  587. package/portal/Type.js +1 -1
  588. package/portal/UniqueValueFromStyle.d.ts +1 -0
  589. package/portal/UniqueValueRenderer.d.ts +2 -0
  590. package/portal/UtilityNetwork.d.ts +2 -2
  591. package/portal/UtilityNetwork.js +1 -1
  592. package/portal/Value.d.ts +1 -1
  593. package/portal/VectorFieldRenderer.d.ts +1 -1
  594. package/portal/VectorTileLayer.d.ts +1 -0
  595. package/portal/VectorTileLayer.js +1 -1
  596. package/portal/VerticalOffset.d.ts +1 -1
  597. package/portal/Viewpoint.d.ts +1 -0
  598. package/portal/Viewpoint.js +1 -1
  599. package/portal/VisualVariable.d.ts +10 -4
  600. package/portal/WMSLayer.d.ts +1 -0
  601. package/portal/WMSLayer.js +1 -1
  602. package/portal/WMSSublayer.d.ts +1 -0
  603. package/portal/WMSSublayer.js +1 -1
  604. package/portal/WMTSInfo.d.ts +1 -1
  605. package/portal/WMTSInfo.js +1 -1
  606. package/portal/Weather.d.ts +6 -1
  607. package/portal/Weather.js +1 -1
  608. package/portal/WebMap.d.ts +3 -3
  609. package/portal/WebMap.js +1 -1
  610. package/portal/WebScene.d.ts +3 -1
  611. package/portal/WebScene.js +1 -1
  612. package/portal/WebSceneBaseMap.d.ts +1 -0
  613. package/portal/WebSceneBaseMap.js +1 -1
  614. package/portal/WebTileLayer.d.ts +1 -0
  615. package/portal/WebTileLayer.js +1 -1
  616. package/portal/Widgets.d.ts +6 -4
  617. package/portal/Widgets.js +1 -1
  618. package/portal/_LayerBase.d.ts +2 -2
  619. package/portal/_layerHelper.js +1 -1
  620. package/portal/_utils.js +1 -1
  621. package/support/Action.d.ts +4 -4
  622. package/support/ArcGISRequestHelper.js +1 -1
  623. package/support/Cancellable.d.ts +1 -1
  624. package/support/Cancellable.js +1 -1
  625. package/support/FormatSettings.js +1 -1
  626. package/support/InitializableBase.d.ts +1 -1
  627. package/support/InitializableBase.js +1 -1
  628. package/support/InitializableCollectionProxy.js +1 -1
  629. package/support/InitializeError.js +1 -1
  630. package/support/Observable.js +1 -1
  631. package/support/ReadOnlyInitializableCollection.js +1 -1
  632. package/support/Serializable.d.ts +4 -4
  633. package/support/Serializable.js +1 -1
  634. package/support/Settings.js +1 -1
  635. package/support/_ArcGISRelationshipCollection.js +1 -1
  636. package/support/_esriInternal.js +1 -1
  637. package/support/_graphicsQuery.js +1 -1
  638. package/support/_query.js +1 -1
  639. package/support/_requestCache.js +1 -1
  640. package/support/_restApiJson.d.ts +1 -1
  641. package/support/esri.d.ts +76 -76
  642. package/support/esri.js +1 -1
  643. package/tasks/geocoding/ArcGISGeocoder.js +1 -1
  644. package/tasks/geocoding/Geocoder.d.ts +1 -1
  645. package/tasks/geocoding/Geocoder.js +1 -1
  646. package/tasks/geocoding/utilities.js +1 -1
  647. package/tasks/identify/ArcGISSublayerQueryIdentifyProvider.js +1 -1
  648. package/tasks/identify/BuildingComponentSublayerClientSideIdentifyProvider.js +1 -1
  649. package/tasks/identify/BuildingComponentSublayerHitTestIdentifyProvider.js +1 -1
  650. package/tasks/identify/CSVLayer3DHitTestIdentifyProvider.js +1 -1
  651. package/tasks/identify/CSVLayerClientSideQueryIdentifyProvider.js +1 -1
  652. package/tasks/identify/ClientSideIdentifyProvider.d.ts +2 -2
  653. package/tasks/identify/ClientSideIdentifyProvider.js +1 -1
  654. package/tasks/identify/FeatureLayer3DHitTestIdentifyProvider.js +1 -1
  655. package/tasks/identify/FeatureLayerClientSideIdentifyProvider.js +1 -1
  656. package/tasks/identify/FeatureLayerQueryIdentifyProvider.js +1 -1
  657. package/tasks/identify/GeoRSSLayerIdentifyProvider.js +1 -1
  658. package/tasks/identify/GraphicsLayerQueryIdentifyProvider.js +1 -1
  659. package/tasks/identify/HitTestIdentifyProvider.d.ts +2 -2
  660. package/tasks/identify/HitTestIdentifyProvider.js +1 -1
  661. package/tasks/identify/IdentifyError.js +1 -1
  662. package/tasks/identify/IdentifyProviderBase.js +1 -1
  663. package/tasks/identify/IdentifyService.js +1 -1
  664. package/tasks/identify/ImageryLayerIdentifyProvider.js +1 -1
  665. package/tasks/identify/KMLLayerQueryIdentifyProvider.js +1 -1
  666. package/tasks/identify/PointCloudLayerHitTestIdentifyProvider.js +1 -1
  667. package/tasks/identify/SceneLayerClientSideIdentifyProvider.js +1 -1
  668. package/tasks/identify/SceneLayerHitTestIdentifyProvider.js +1 -1
  669. package/tasks/identify/SceneLayerQueryIdentifyProvider.js +1 -1
  670. package/tasks/identify/StreamLayerClientSideQueryIdentifyProvider.js +1 -1
  671. package/tasks/identify/StreamLayerQueryIdentifyProvider.js +1 -1
  672. package/tasks/identify/SubtypeSublayerClientSideIdentifyProvider.js +1 -1
  673. package/tasks/identify/SubtypeSublayerQueryIdentifyProvider.js +1 -1
  674. package/tasks/identify/WMSSublayerIdentifyProvider.js +1 -1
  675. package/tasks/query/ArcGISRelationship.js +1 -1
  676. package/tasks/query/ArcGISServiceTableQueryProvider.js +1 -1
  677. package/tasks/query/ArcGISSublayerQueryProvider.js +1 -1
  678. package/tasks/query/BuildingComponentSublayerClientSideQueryProvider.js +1 -1
  679. package/tasks/query/CSVLayerClientSideQueryProvider.js +1 -1
  680. package/tasks/query/CSVLayerQueryProvider.js +1 -1
  681. package/tasks/query/ClientSideQueryProvider.d.ts +2 -2
  682. package/tasks/query/ClientSideQueryProvider.js +1 -1
  683. package/tasks/query/FeatureLayerQueryProvider.js +1 -1
  684. package/tasks/query/GeoRSSLayerQueryProvider.js +1 -1
  685. package/tasks/query/GraphicsLayerQueryProvider.js +1 -1
  686. package/tasks/query/ImageryLayerQueryProvider.js +1 -1
  687. package/tasks/query/KMLLayerQueryProvider.js +1 -1
  688. package/tasks/query/QueryBasedRelationship.js +1 -1
  689. package/tasks/query/QueryError.js +1 -1
  690. package/tasks/query/QueryProviderBase.js +1 -1
  691. package/tasks/query/QueryService.js +1 -1
  692. package/tasks/query/SceneLayerClientSideQueryProvider.js +1 -1
  693. package/tasks/query/SceneLayerQueryProvider.js +1 -1
  694. package/tasks/query/StreamLayerClientSideQueryProvider.js +1 -1
  695. package/tasks/query/StreamLayerQueryProvider.js +1 -1
  696. package/tasks/query/SubtypeSublayerQueryProvider.js +1 -1
  697. package/tasks/search/ArcGISGeocoderSearchProvider.js +1 -1
  698. package/tasks/search/GeocoderSearchProvider.js +1 -1
  699. package/tasks/search/QuerySearchProvider.js +1 -1
  700. package/tasks/search/SearchError.js +1 -1
  701. package/tasks/search/SearchProviderBase.js +1 -1
  702. package/tasks/search/SearchService.js +1 -1
  703. package/tasks/search/_utilities.js +1 -1
  704. package/utilities/CollectionProxy.js +1 -1
  705. package/utilities/CopyOnWriteCollection.js +1 -1
  706. package/utilities/GeometryServiceError.js +1 -1
  707. package/utilities/MapTransformCollection.js +1 -1
  708. package/utilities/ObservableMap.js +1 -1
  709. package/utilities/ObservableSet.js +1 -1
  710. package/utilities/ObservableWeakSet.js +1 -1
  711. package/utilities/ReadOnlyCollection.js +1 -1
  712. package/utilities/ReadOnlyMap.js +1 -1
  713. package/utilities/_layers.js +1 -1
  714. package/utilities/_ogc.js +1 -1
  715. package/utilities/arcade.js +1 -1
  716. package/utilities/array.js +1 -1
  717. package/utilities/asyncIterable.d.ts +1 -1
  718. package/utilities/asyncIterable.js +1 -1
  719. package/utilities/basemaps.js +1 -1
  720. package/utilities/checkArg.js +1 -1
  721. package/utilities/collection.js +1 -1
  722. package/utilities/date.js +1 -1
  723. package/utilities/esri.js +1 -1
  724. package/utilities/extensions.js +1 -1
  725. package/utilities/geometry.d.ts +2 -2
  726. package/utilities/geometry.js +1 -1
  727. package/utilities/iterable.js +1 -1
  728. package/utilities/log.d.ts +1 -1
  729. package/utilities/log.js +1 -1
  730. package/utilities/mapping.js +1 -1
  731. package/utilities/math.js +1 -1
  732. package/utilities/number.js +1 -1
  733. package/utilities/object.js +1 -1
  734. package/utilities/portal.d.ts +3 -3
  735. package/utilities/portal.js +1 -1
  736. package/utilities/promise.d.ts +1 -1
  737. package/utilities/promise.js +1 -1
  738. package/utilities/query.js +1 -1
  739. package/utilities/relationships.js +1 -1
  740. package/utilities/scaleRanges.d.ts +1 -1
  741. package/utilities/set.js +1 -1
  742. package/utilities/string.d.ts +6 -21
  743. package/utilities/string.js +1 -1
  744. package/utilities/symbol.js +1 -1
  745. package/utilities/uri.js +1 -1
  746. package/utilities/watch.js +1 -1
  747. package/version.d.ts +1 -1
  748. package/version.js +1 -1
@@ -1 +1 @@
1
- import{__decorate}from"tslib";import PopupTemplate from"@arcgis/core/PopupTemplate";import{Hyperlink}from"../Hyperlink.js";import{isPopupContentExtension}from"../ItemType.js";import{ArrayWrappedCollection}from"../mapping/support/ArrayWrappedCollection.js";import{PopupInfo as PopupInfoJson}from"../portal/PopupInfo.js";import{FormatSettings}from"../support/FormatSettings.js";import{InitializableCollectionProxy}from"../support/InitializableCollectionProxy.js";import{filterJSONProperties,isDefault,serializable,shouldExcludeDefaults}from"../support/Serializable.js";import{Settings}from"../support/Settings.js";import{compare}from"../utilities/array.js";import{checkArg}from"../utilities/checkArg.js";import{getAllFieldInfos,getAllReferencedFieldNames,isPopupTemplate}from"../utilities/esri.js";import{isQueryBasedRelationship}from"../utilities/relationships.js";import{onCollectionPropertyChange}from"../utilities/watch.js";import{PopupContentExtension,_popupContentExtensionMap}from"./PopupContentExtension.js";import{fieldWithArcadeXRegex,fieldWithRelationshipRegex}from"./Schema.js";let FeatureSettings=class extends Settings{constructor(t){super(t),this._isDefaultPopupTemplate=!1,this._popupContentCollection=this._createPopupContentCollection(),this.popupContentExtensions=new PopupContentExtensionCollectionImpl(this)}get _popupContent(){return this._popupContentCollection}get hyperlinkTemplates(){return this._getCollectionSetting("hyperlinkTemplates")}get popupTemplate(){return this._getSetting("popupTemplate")}set popupTemplate(t){let e;e=t instanceof Object&&!isPopupTemplate(t)?PopupInfoJson.toEsriApiPopupTemplate(t):t;const i=this?._feature?.schema?.createPopupTemplate()??this?._featureSource?.schema?.createPopupTemplate();e&&i&&(e.content=e.content??i.content,e.fieldInfos=e.fieldInfos??i.fieldInfos),this._setSetting("popupTemplate",e),this._isDefaultPopupTemplate=!1}get formatSettings(){return this._getNestedSettings("formatSettings",(()=>new FormatSettings))}get returnGeometry(){return this._getSetting("returnGeometry",!0)}set returnGeometry(t){this._setSetting("returnGeometry",t)}get outFields(){return this._getSetting("outFields",this._defaultOutFields)}set outFields(t){this._setSetting("outFields",t)}get outSpatialReference(){return this._getSetting("outSpatialReference")}set outSpatialReference(t){this._setSetting("outSpatialReference",t)}get maxAllowableOffset(){return this._getSetting("maxAllowableOffset")}set maxAllowableOffset(t){this._setSetting("maxAllowableOffset",t)}get zoomScale(){return this._getSetting("zoomScale")}set zoomScale(t){this._setSetting("zoomScale",t)}get zoomFactor(){const t=this._feature?this._feature.schema:this._featureSource?.schema,e=t&&"point"===t.geometryType?void 0:1.5;return this._getSetting("zoomFactor",e)}set zoomFactor(t){this._setSetting("zoomFactor",t)}get featureSource(){return this._featureSource}get feature(){return this._feature}get _defaultOutFields(){const t=getAllFieldInfos(this.popupTemplate),e=this.featureSource?.schema?.primaryKeyField;if(t&&e){const i=new Set;i.add(e);const n=this.featureSource.schema.fields.toArray().map((t=>t.name)),o=getAllReferencedFieldNames(this.popupTemplate),s=t.filter((t=>t.visible||t.isEditable&&this.featureSource.capabilities.supportsEditing)).map((t=>t.fieldName)).concat(...o).filter((t=>n.includes(t)));return this._featureSource.relationships.forEach((t=>{isQueryBasedRelationship(t)&&s.push(t.keyField)})),s.filter((t=>!(t.match(fieldWithArcadeXRegex)||t.match(fieldWithRelationshipRegex)))).forEach((t=>i.add(t))),Array.from(i.values())}return["*"]}_setFeatureSource(t){this._featureSource=t,this.notifyChange("featureSource")}_setFeature(t){this._feature=t,this.notifyChange("feature")}toJSON(t="all"){const e=filterJSONProperties(this._getSerializableProperties(),this,t)||{},i=e.popupContentExtensions?.filter((t=>!this.parent?.popupContentExtensions?.some((e=>e.id===t.id))));if(e)for(const t of Object.keys(e))this.isModified(t)||delete e[t];if(i?.length&&(e.popupContentExtensions=i),!shouldExcludeDefaults(t)||!isDefault(e))return e}_createPopupContentCollection(){return new ArrayWrappedCollection({parent:this,targetProperty:"popupTemplate",arrayProperty:"content"})}_getSerializableProperties(){return{hyperlinkTemplates:{serializeModes:["initial"],deserialize:t=>{t.forEach((t=>{this.hyperlinkTemplates.find((e=>this._hyperlinksAreEquivalent(e,t)))||this.hyperlinkTemplates.add(t instanceof Hyperlink?t:new Hyperlink(t))})),this.hyperlinkTemplates.toArray().forEach((e=>{const i=this.hyperlinkTemplates.indexOf(e),n=t.findIndex((t=>this._hyperlinksAreEquivalent(t,e)));n<0?this.hyperlinkTemplates.removeAt(i):n!==i&&this.hyperlinkTemplates.reorder(e,n)}))}},popupTemplate:{serialize:!1},formatSettings:"initial",outFields:{serializeModes:["initial"],serialize:()=>this.isModified("outFields")?this.outFields:void 0},returnGeometry:{serializeModes:["initial"],default:!0},outSpatialReference:"initial",maxAllowableOffset:"initial",zoomScale:"initial",zoomFactor:{serializeModes:["initial"],isDefault:t=>{const e=this._feature?this._feature.schema:this._featureSource?.schema;return t===(e&&"point"===e.geometryType?void 0:1.5)}},popupContentExtensions:{serializeModes:["initial"],serialize:t=>this.popupContentExtensions.map((e=>e.toJSON(t))).filter((t=>!(t&&2===Object.keys(t).length&&t.id&&t.content))).toArray(),deserialize:t=>{t&&compare(this.popupContentExtensions,t,{onNew:(t,e)=>{this.popupContentExtensions.add(isPopupContentExtension(t)?t:new PopupContentExtension(t),e)},onMatch:(t,e,i,n)=>{isPopupContentExtension(e)||t.assignProperties(e),i!==n&&this.popupContentExtensions.reorder(t,n)},onMissing:t=>{this.popupContentExtensions.remove(t)},equals:(t,e)=>isPopupContentExtension(e)?e===t||e.id===t.id:!(!e?.content||!PopupContentExtension.matchesRef(this.popupContentExtensions.toArray(),this.popupContentExtensions.indexOf(t),e.content))||t.id===e.id})}}}}_hyperlinksAreEquivalent(t,e){if(t===e)return!0;const i=t=>t||"";return i(t.text)===i(e.text)&&i(t.url)===i(e.url)&&i(t.iconUrl)===i(e.iconUrl)&&i(t.target)===i(e.target)&&i(t.tooltip)===i(e.tooltip)}};FeatureSettings=__decorate([serializable],FeatureSettings);export{FeatureSettings};class PopupContentExtensionCollectionImpl extends InitializableCollectionProxy{constructor(t){super(),this._uninitializedPopupContentExtensions=new Set,this._featureSettings=t,onCollectionPropertyChange(this._featureSettings,"_popupContent",(t=>{const e={added:(t.added||[]).map((t=>this._forContent(t))),moved:(t.moved||[]).map((t=>this._forContent(t))),removed:(t.removed||[]).map((t=>this._forContent(t))),target:this};this.emit("change",e)})),t.watch("_popupContent.length",(()=>this.notifyChange("length")))}get _collection(){return this._featureSettings._popupContent.map((t=>this._forContent(t))).concat(Array.from(this._uninitializedPopupContentExtensions))}get _popupTemplateIsInherited(){return this._featureSettings.parent&&this._featureSettings.popupTemplate===this._featureSettings.parent.popupTemplate}forContent(t){if(checkArg("content",t).isNotMissing(),this._featureSettings._popupContent.includes(t))return this._forContent(t)}add(t,e){if(checkArg("contentX",t).isNotMissing(),this._popupTemplateIsInherited&&(this._featureSettings.popupTemplate=new PopupTemplate({content:this._featureSettings._popupContent.toArray()})),t.featureSettings&&t.featureSettings.popupContentExtensions.remove(t),t._setFeatureSettings(this._featureSettings),t.content){const i=_popupContentExtensionMap.get(t.content);if(_popupContentExtensionMap.set(t.content,t),i&&i!==t&&this._onRemoved(i),this._featureSettings._popupContent.includes(t.content))if(void 0===e){const e={added:[t],moved:[],removed:i?[i]:[],target:this};this.emit("change",e)}else this._featureSettings._popupContent.reorder(t.content,e);else this._featureSettings._popupContent.add(t.content,e)}else{this._uninitializedPopupContentExtensions.add(t);const e={added:[t],moved:[],removed:[],target:this};this.emit("change",e)}return this._onAdded(t),this}removeAt(t){const e=this.getItemAt(t);if(void 0!==e){if(this._popupTemplateIsInherited&&(this._featureSettings.popupTemplate=new PopupTemplate({content:this._featureSettings._popupContent.toArray()})),this._uninitializedPopupContentExtensions.has(e)){this._uninitializedPopupContentExtensions.delete(e);const t={added:[],moved:[],removed:[e],target:this};this.emit("change",t)}else this._featureSettings._popupContent.remove(e.content);return this._onRemoved(e),e}}reorder(t,e){if(t&&this._featureSettings._popupContent.includes(t.content))return this._popupTemplateIsInherited&&(this._featureSettings.popupTemplate=new PopupTemplate({content:this._featureSettings._popupContent.toArray()})),this._featureSettings._popupContent.reorder(t.content,e),t}sort(t){return this._popupTemplateIsInherited&&(this._featureSettings.popupTemplate=new PopupTemplate({content:this._featureSettings._popupContent.toArray()})),this._featureSettings._popupContent.sort(((e,i)=>t(this._forContent(e),this._forContent(i)))),this}_itemIsInitialized(t){return super._itemIsInitialized(t)&&!!t.content}_onAdded(t){}_onRemoved(t){t.featureSettings===this._featureSettings&&t._setFeatureSettings(void 0)}_forContent(t){if(this._uninitializedPopupContentExtensions.size)for(const t of this._uninitializedPopupContentExtensions)t._resolveContent(),t.content&&(_popupContentExtensionMap.set(t.content,t),this._uninitializedPopupContentExtensions.delete(t));if(!_popupContentExtensionMap.has(t)){const e=new PopupContentExtension({content:t});_popupContentExtensionMap.set(t,e),e._setFeatureSettings(this._featureSettings),this._onAdded(e)}return _popupContentExtensionMap.get(t)}}
1
+ import{__decorate as t}from"tslib";import e from"@arcgis/core/PopupTemplate";import{Hyperlink as i}from"../Hyperlink.js";import{isPopupContentExtension as n}from"../ItemType.js";import{ArrayWrappedCollection as o}from"../mapping/support/ArrayWrappedCollection.js";import{PopupInfo as s}from"../portal/PopupInfo.js";import{FormatSettings as r}from"../support/FormatSettings.js";import{InitializableCollectionProxy as p}from"../support/InitializableCollectionProxy.js";import{filterJSONProperties as a,isDefault as u,serializable as l,shouldExcludeDefaults as h}from"../support/Serializable.js";import{Settings as f}from"../support/Settings.js";import{compare as m}from"../utilities/array.js";import{checkArg as c}from"../utilities/checkArg.js";import{getAllFieldInfos as d,getAllReferencedFieldNames as _,isPopupTemplate as g}from"../utilities/esri.js";import{isQueryBasedRelationship as S}from"../utilities/relationships.js";import{onCollectionPropertyChange as C}from"../utilities/watch.js";import{PopupContentExtension as y,_popupContentExtensionMap as T}from"./PopupContentExtension.js";import{fieldWithArcadeXRegex as x,fieldWithRelationshipRegex as z}from"./Schema.js";let E=class extends f{get _popupContent(){return this._popupContentCollection}get hyperlinkTemplates(){return this._getCollectionSetting("hyperlinkTemplates")}get popupTemplate(){return this._getSetting("popupTemplate")}set popupTemplate(t){let e;e=t instanceof Object&&!g(t)?s.toEsriApiPopupTemplate(t):t;const i=this?._feature?.schema?.createPopupTemplate()??this?._featureSource?.schema?.createPopupTemplate();e&&i&&(e.content=e.content??i.content,e.fieldInfos=e.fieldInfos??i.fieldInfos),this._setSetting("popupTemplate",e),this._isDefaultPopupTemplate=!1}get formatSettings(){return this._getNestedSettings("formatSettings",(()=>new r))}get returnGeometry(){return this._getSetting("returnGeometry",!0)}set returnGeometry(t){this._setSetting("returnGeometry",t)}get outFields(){return this._getSetting("outFields",this._defaultOutFields)}set outFields(t){this._setSetting("outFields",t)}get outSpatialReference(){return this._getSetting("outSpatialReference")}set outSpatialReference(t){this._setSetting("outSpatialReference",t)}get maxAllowableOffset(){return this._getSetting("maxAllowableOffset")}set maxAllowableOffset(t){this._setSetting("maxAllowableOffset",t)}get zoomScale(){return this._getSetting("zoomScale")}set zoomScale(t){this._setSetting("zoomScale",t)}get zoomFactor(){const t=this._feature?this._feature.schema:this._featureSource?.schema,e=t&&"point"===t.geometryType?void 0:1.5;return this._getSetting("zoomFactor",e)}set zoomFactor(t){this._setSetting("zoomFactor",t)}get featureSource(){return this._featureSource}get feature(){return this._feature}constructor(t){super(t),this._isDefaultPopupTemplate=!1,this._popupContentCollection=this._createPopupContentCollection(),this.popupContentExtensions=new v(this)}get _defaultOutFields(){const t=d(this.popupTemplate),e=this.featureSource?.schema?.primaryKeyField;if(t&&e){const i=new Set;i.add(e);const n=this.featureSource.schema.fields.toArray().map((t=>t.name)),o=_(this.popupTemplate),s=t.filter((t=>t.visible||t.isEditable&&this.featureSource.capabilities.supportsEditing)).map((t=>t.fieldName)).concat(...o).filter((t=>n.includes(t)));return this._featureSource.relationships.forEach((t=>{S(t)&&s.push(t.keyField)})),s.filter((t=>!(t.match(x)||t.match(z)))).forEach((t=>i.add(t))),Array.from(i.values())}return["*"]}_setFeatureSource(t){this._featureSource=t,this.notifyChange("featureSource")}_setFeature(t){this._feature=t,this.notifyChange("feature")}toJSON(t="all"){const e=a(this._getSerializableProperties(),this,t)||{},i=e.popupContentExtensions?.filter((t=>!this.parent?.popupContentExtensions?.some((e=>e.id===t.id))));if(e)for(const t of Object.keys(e))this.isModified(t)||delete e[t];if(i?.length&&(e.popupContentExtensions=i),!h(t)||!u(e))return e}_createPopupContentCollection(){return new o({parent:this,targetProperty:"popupTemplate",arrayProperty:"content"})}_getSerializableProperties(){return{hyperlinkTemplates:{serializeModes:["initial"],deserialize:t=>{t.forEach((t=>{this.hyperlinkTemplates.find((e=>this._hyperlinksAreEquivalent(e,t)))||this.hyperlinkTemplates.add(t instanceof i?t:new i(t))})),this.hyperlinkTemplates.toArray().forEach((e=>{const i=this.hyperlinkTemplates.indexOf(e),n=t.findIndex((t=>this._hyperlinksAreEquivalent(t,e)));n<0?this.hyperlinkTemplates.removeAt(i):n!==i&&this.hyperlinkTemplates.reorder(e,n)}))}},popupTemplate:{serialize:!1},formatSettings:"initial",outFields:{serializeModes:["initial"],serialize:()=>this.isModified("outFields")?this.outFields:void 0},returnGeometry:{serializeModes:["initial"],default:!0},outSpatialReference:"initial",maxAllowableOffset:"initial",zoomScale:"initial",zoomFactor:{serializeModes:["initial"],isDefault:t=>{const e=this._feature?this._feature.schema:this._featureSource?.schema;return t===(e&&"point"===e.geometryType?void 0:1.5)}},popupContentExtensions:{serializeModes:["initial"],serialize:t=>this.popupContentExtensions.map((e=>e.toJSON(t))).filter((t=>!(t&&2===Object.keys(t).length&&t.id&&t.content))).toArray(),deserialize:t=>{t&&m(this.popupContentExtensions,t,{onNew:(t,e)=>{this.popupContentExtensions.add(n(t)?t:new y(t),e)},onMatch:(t,e,i,o)=>{n(e)||t.assignProperties(e),i!==o&&this.popupContentExtensions.reorder(t,o)},onMissing:t=>{this.popupContentExtensions.remove(t)},equals:(t,e)=>n(e)?e===t||e.id===t.id:!(!e?.content||!y.matchesRef(this.popupContentExtensions.toArray(),this.popupContentExtensions.indexOf(t),e.content))||t.id===e.id})}}}}_hyperlinksAreEquivalent(t,e){if(t===e)return!0;const i=t=>t||"";return i(t.text)===i(e.text)&&i(t.url)===i(e.url)&&i(t.iconUrl)===i(e.iconUrl)&&i(t.target)===i(e.target)&&i(t.tooltip)===i(e.tooltip)}};E=t([l],E);export{E as FeatureSettings};class v extends p{get _collection(){return this._featureSettings._popupContent.map((t=>this._forContent(t))).concat(Array.from(this._uninitializedPopupContentExtensions))}get _popupTemplateIsInherited(){return this._featureSettings.parent&&this._featureSettings.popupTemplate===this._featureSettings.parent.popupTemplate}constructor(t){super(),this._uninitializedPopupContentExtensions=new Set,this._featureSettings=t,C(this._featureSettings,"_popupContent",(t=>{const e={added:(t.added||[]).map((t=>this._forContent(t))),moved:(t.moved||[]).map((t=>this._forContent(t))),removed:(t.removed||[]).map((t=>this._forContent(t))),target:this};this.emit("change",e)})),t.watch("_popupContent.length",(()=>this.notifyChange("length")))}forContent(t){if(c("content",t).isNotMissing(),this._featureSettings._popupContent.includes(t))return this._forContent(t)}add(t,i){if(c("contentX",t).isNotMissing(),this._popupTemplateIsInherited&&(this._featureSettings.popupTemplate=new e({content:this._featureSettings._popupContent.toArray()})),t.featureSettings&&t.featureSettings.popupContentExtensions.remove(t),t._setFeatureSettings(this._featureSettings),t.content){const e=T.get(t.content);if(T.set(t.content,t),e&&e!==t&&this._onRemoved(e),this._featureSettings._popupContent.includes(t.content))if(void 0===i){const i={added:[t],moved:[],removed:e?[e]:[],target:this};this.emit("change",i)}else this._featureSettings._popupContent.reorder(t.content,i);else this._featureSettings._popupContent.add(t.content,i)}else{this._uninitializedPopupContentExtensions.add(t);const e={added:[t],moved:[],removed:[],target:this};this.emit("change",e)}return this._onAdded(t),this}removeAt(t){const i=this.getItemAt(t);if(void 0!==i){if(this._popupTemplateIsInherited&&(this._featureSettings.popupTemplate=new e({content:this._featureSettings._popupContent.toArray()})),this._uninitializedPopupContentExtensions.has(i)){this._uninitializedPopupContentExtensions.delete(i);const t={added:[],moved:[],removed:[i],target:this};this.emit("change",t)}else this._featureSettings._popupContent.remove(i.content);return this._onRemoved(i),i}}reorder(t,i){if(t&&this._featureSettings._popupContent.includes(t.content))return this._popupTemplateIsInherited&&(this._featureSettings.popupTemplate=new e({content:this._featureSettings._popupContent.toArray()})),this._featureSettings._popupContent.reorder(t.content,i),t}sort(t){return this._popupTemplateIsInherited&&(this._featureSettings.popupTemplate=new e({content:this._featureSettings._popupContent.toArray()})),this._featureSettings._popupContent.sort(((e,i)=>t(this._forContent(e),this._forContent(i)))),this}_itemIsInitialized(t){return super._itemIsInitialized(t)&&!!t.content}_onAdded(t){}_onRemoved(t){t.featureSettings===this._featureSettings&&t._setFeatureSettings(void 0)}_forContent(t){if(this._uninitializedPopupContentExtensions.size)for(const t of this._uninitializedPopupContentExtensions)t._resolveContent(),t.content&&(T.set(t.content,t),this._uninitializedPopupContentExtensions.delete(t));if(!T.has(t)){const e=new y({content:t});T.set(t,e),e._setFeatureSettings(this._featureSettings),this._onAdded(e)}return T.get(t)}}
@@ -1 +1 @@
1
- import TextContent from"@arcgis/core/popup/content/TextContent.js";import{ArgumentError}from"../ArgumentError.js";import{EntityBase}from"../Entity.js";import{Hyperlink}from"../Hyperlink.js";import{InvalidOperationError}from"../InvalidOperationError.js";import{isMenu,isRelationship}from"../ItemType.js";import{NotFoundError}from"../NotFoundError.js";import{FeatureReadOptions}from"../data/FeatureSource.js";import{Menu}from"../menus/Menu.js";import{initializeCollection}from"../support/InitializableBase.js";import{CollectionProxy}from"../utilities/CollectionProxy.js";import{first}from"../utilities/asyncIterable.js";import{checkArg}from"../utilities/checkArg.js";import{Collection,compare}from"../utilities/collection.js";import{getLogger}from"../utilities/log.js";import{FeatureSettings}from"./FeatureSettings.js";import{Schema}from"./Schema.js";import{TaskSettings}from"./TaskSettings.js";import{Relationship}from"./_Relationship.js";const ERR_GET_FEATURES_NOT_SUPPORTED="Querying features is not supported.",ERR_ADD_FEATURES_NOT_SUPPORTED="Adding features is not supported.",ERR_ADD_ATTACHMENTS_NOT_SUPPORTED="Adding attachments is not supported.",ERR_DELETE_ATTACHMENTS_NOT_SUPPORTED="Deleting attachments is not supported.",ERR_UPDATE_FEATURES_NOT_SUPPORTED="Updating features is not supported.",ERR_DELETE_FEATURES_NOT_SUPPORTED="Deleting features is not supported.",DEFAULT_CAPABILITIES=Object.freeze({supportsAdd:!1,supportsUpdate:!1,supportsDelete:!1,supportsEditing:!1,supportsAttachmentEditing:!1}),log=getLogger("FeatureSourceBase");export class FeatureSourceBase extends EntityBase{constructor(t){super(t),this.featureSettings=this._createAndSetupFeatureSettings(),this.taskSettings=this._createTaskSettings(),this.schema=this._createAndSetupSchema(),this.relationships=this._createRelationships(),this.hyperlinks=this._createHyperlinks()}get featureActions(){return this._featureActions}set featureActions(t){this._featureActions=t,t&&this.isInitialized&&!t.isInitialized&&(async()=>{try{await t.initialize()}catch(t){t instanceof Error&&log.error({message:"An error occurred while initializing feature action menu.",error:t})}})()}get capabilities(){return this._capabilities()}getFullExtent(){}async getAttachments(t){return checkArg("feature",t).isNotMissing(),await this.initialize(),this._getAttachments(t)}async addAttachment(t,e){if(checkArg("feature",t).isNotMissing(),checkArg("attachment",e).isNotMissing(),t.source&&t.source!==this)throw new ArgumentError("feature",`Cannot add an attachment to a feature not of this source (${this.title??this.id})`);return await this.initialize(),this._addAttachment(t,e)}async deleteAttachments(t,e){if(checkArg("feature",t).isNotMissing(),checkArg("attachmentIds",e).isNotMissing(),t.source&&t.source!==this)throw new ArgumentError("feature",`Cannot delete attachments from a feature not of this source (${this.title??this.id})`);await this.initialize(),await this._deleteAttachments(t,e)}async getFeature(t,e){checkArg("id",t).isNotMissing();const i=this.getFeatures([t],e),s=await first(i);if(!s)throw new NotFoundError("No feature exists with ID '{0}'.",t);return s}getFeatures(t,e){checkArg("ids",t).isNotMissing();const i=this;return async function*(){await i.initialize(),yield*i._getFeatures(t,{...FeatureReadOptions.DEFAULTS,...FeatureReadOptions.fromFeatureSource(i),...e})}()}async addFeature(t,e){checkArg("feature",t).isNotMissing(),await this.addFeatures([t])}async addFeatures(t,e){if(checkArg("features",t).isNotMissing(),await this.initialize(),!this.capabilities.supportsAdd)throw new InvalidOperationError(ERR_ADD_FEATURES_NOT_SUPPORTED);await this._addFeatures(t,e)}async updateFeature(t,e){checkArg("feature",t).isNotMissing(),await this.updateFeatures([t])}async updateFeatures(t,e){if(checkArg("features",t).isNotMissing(),await this.initialize(),!this.capabilities.supportsUpdate)throw new InvalidOperationError(ERR_UPDATE_FEATURES_NOT_SUPPORTED);await this._updateFeatures(t,e)}async deleteFeature(t,e){checkArg("feature",t).isNotMissing(),await this.deleteFeatures([t])}async deleteFeatures(t,e){if(checkArg("features",t).isNotMissing(),await this.initialize(),!this.capabilities.supportsDelete)throw new InvalidOperationError(ERR_DELETE_FEATURES_NOT_SUPPORTED);const i=[];for(const e of t)i.push("string"==typeof e?e:e.primaryKey);await this._deleteFeatures(i,e)}_getSerializableProperties(){return{...super._getSerializableProperties(),featureSettings:{serializeModes:["initial"],isDefault:t=>{if(!t)return!0;if(t.constructor===Object){if(!Object.keys(t).length)return!0}return!1}},taskSettings:"initial",onAddFeature:"initial",onEditFeature:"initial",schema:"initial",relationships:{serializeModes:["initial"],serialize:t=>this.relationships?this.relationships.filter((t=>"ArcGISRelationship"!==t.relationshipType)).toArray():[],deserialize:t=>{compare(this.relationships,t,{onNew:t=>{isRelationship(t)?this.relationships.add(t):this.relationships.add(Relationship.create(t))},onMatch:(t,e)=>{isRelationship(t)&&t.assignProperties({title:e.title})},onMissing:t=>{"ArcGISRelationship"!==t.relationshipType&&this.relationships.remove(t)},equals:(t,e)=>t.id===e.id})},default:[]},hyperlinks:{serialize:!1,deserialize:t=>{this.hyperlinks.removeAll(),this.hyperlinks.addMany(t.map((t=>t instanceof Hyperlink?t:new Hyperlink(t))))}},featureActions:{serializeModes:["initial"],deserialize:t=>{t?isMenu(t)?this.featureActions=t:this.featureActions?this.featureActions.assignProperties(t):this.featureActions=Menu.create(t):this.featureActions=void 0}}}}*_initializableChildCollections(){yield*super._initializableChildCollections(),yield this.schema.fieldExtensions}async _onInitialize(){await super._onInitialize(),this.featureActions&&await this.featureActions.initialize()}async _postInitialize(){await super._postInitialize(),this.featureSettings.popupTemplate||(this.featureSettings.popupTemplate=this.schema.createPopupTemplate(),this.featureSettings._isDefaultPopupTemplate=!0);const{popupTemplate:t}=this.featureSettings;"function"==typeof t.content&&(t.content=t.content()),t.content=await t.content,"string"==typeof t.content&&(t.content=[new TextContent({text:t.content})]),!t.title&&this.schema.displayField&&(t.title=`{${this.schema.displayField}}`),await initializeCollection(this.featureSettings.popupContentExtensions,{target:this,onInitializeWarning:t=>this.emit("initializeWarning",t)}),await Promise.all(this.relationships.toArray().map((t=>t.relatedSource?.initialize())))}_createSchema(){return new Schema}_createFeatureSettings(){return new FeatureSettings}_createTaskSettings(){return new TaskSettings}_createRelationships(){return new RelationshipCollection(this)}_createHyperlinks(){return new Collection}async _getAttachments(t){return[]}async _addAttachment(t,e){throw new InvalidOperationError(ERR_ADD_ATTACHMENTS_NOT_SUPPORTED)}async _deleteAttachments(t,e){throw new InvalidOperationError(ERR_DELETE_ATTACHMENTS_NOT_SUPPORTED)}_getFeatures(t,e){const{primaryKeyField:i}=this.schema;if(this.queryService&&i){const s=t.map((t=>`${i} = ${t}`)).join(" OR ");return this.queryService.query(this,s,e)}throw new InvalidOperationError(ERR_GET_FEATURES_NOT_SUPPORTED)}_addFeatures(t,e){throw new InvalidOperationError(ERR_ADD_FEATURES_NOT_SUPPORTED)}_updateFeatures(t,e){throw new InvalidOperationError(ERR_UPDATE_FEATURES_NOT_SUPPORTED)}_deleteFeatures(t,e){throw new InvalidOperationError(ERR_DELETE_FEATURES_NOT_SUPPORTED)}_capabilities(){return DEFAULT_CAPABILITIES}_isRelationship(t){return"function"==typeof t.getRelatedFeatures}_createAndSetupSchema(){const t=this._createSchema();return t._featureSettings=this.featureSettings,t}_createAndSetupFeatureSettings(){const t=this._createFeatureSettings();return t._setFeatureSource(this),t}}export class RelationshipCollection extends CollectionProxy{constructor(t){super(new Collection),this._source=t}add(t,e){return checkArg("relationship",t).isNotMissing(),t.source&&t.source.relationships.remove(t),isRelationship(t)&&t._setSource(this._source),super.add(t,e)}removeAt(t){const e=super.removeAt(t);return isRelationship(e)&&e._setSource(void 0),e}}
1
+ import t from"@arcgis/core/popup/content/TextContent.js";import{ArgumentError as e}from"../ArgumentError.js";import{EntityBase as i}from"../Entity.js";import{Hyperlink as s}from"../Hyperlink.js";import{InvalidOperationError as a}from"../InvalidOperationError.js";import{isMenu as r,isRelationship as n}from"../ItemType.js";import{NotFoundError as o}from"../NotFoundError.js";import{FeatureReadOptions as u}from"../data/FeatureSource.js";import{Menu as c}from"../menus/Menu.js";import{initializeCollection as h}from"../support/InitializableBase.js";import{CollectionProxy as p}from"../utilities/CollectionProxy.js";import{first as l}from"../utilities/asyncIterable.js";import{checkArg as d}from"../utilities/checkArg.js";import{Collection as f,compare as m}from"../utilities/collection.js";import{getLogger as g}from"../utilities/log.js";import{FeatureSettings as w}from"./FeatureSettings.js";import{Schema as y}from"./Schema.js";import{TaskSettings as _}from"./TaskSettings.js";import{Relationship as S}from"./_Relationship.js";const A="Adding features is not supported.",F="Updating features is not supported.",z="Deleting features is not supported.",j=Object.freeze({supportsAdd:!1,supportsUpdate:!1,supportsDelete:!1,supportsEditing:!1,supportsAttachmentEditing:!1}),M=g("FeatureSourceBase");export class FeatureSourceBase extends i{get featureActions(){return this._featureActions}set featureActions(t){this._featureActions=t,t&&this.isInitialized&&!t.isInitialized&&(async()=>{try{await t.initialize()}catch(t){t instanceof Error&&M.error({message:"An error occurred while initializing feature action menu.",error:t})}})()}get capabilities(){return this._capabilities()}constructor(t){super(t),this.featureSettings=this._createAndSetupFeatureSettings(),this.taskSettings=this._createTaskSettings(),this.schema=this._createAndSetupSchema(),this.relationships=this._createRelationships(),this.hyperlinks=this._createHyperlinks()}getFullExtent(){}async getAttachments(t){return d("feature",t).isNotMissing(),await this.initialize(),this._getAttachments(t)}async addAttachment(t,i){if(d("feature",t).isNotMissing(),d("attachment",i).isNotMissing(),t.source&&t.source!==this)throw new e("feature",`Cannot add an attachment to a feature not of this source (${this.title??this.id})`);return await this.initialize(),this._addAttachment(t,i)}async deleteAttachments(t,i){if(d("feature",t).isNotMissing(),d("attachmentIds",i).isNotMissing(),t.source&&t.source!==this)throw new e("feature",`Cannot delete attachments from a feature not of this source (${this.title??this.id})`);await this.initialize(),await this._deleteAttachments(t,i)}async getFeature(t,e){d("id",t).isNotMissing();const i=this.getFeatures([t],e),s=await l(i);if(!s)throw new o("No feature exists with ID '{0}'.",t);return s}getFeatures(t,e){d("ids",t).isNotMissing();const i=this;return async function*(){await i.initialize(),yield*i._getFeatures(t,{...u.DEFAULTS,...u.fromFeatureSource(i),...e})}()}async addFeature(t,e){d("feature",t).isNotMissing(),await this.addFeatures([t])}async addFeatures(t,e){if(d("features",t).isNotMissing(),await this.initialize(),!this.capabilities.supportsAdd)throw new a(A);await this._addFeatures(t,e)}async updateFeature(t,e){d("feature",t).isNotMissing(),await this.updateFeatures([t])}async updateFeatures(t,e){if(d("features",t).isNotMissing(),await this.initialize(),!this.capabilities.supportsUpdate)throw new a(F);await this._updateFeatures(t,e)}async deleteFeature(t,e){d("feature",t).isNotMissing(),await this.deleteFeatures([t])}async deleteFeatures(t,e){if(d("features",t).isNotMissing(),await this.initialize(),!this.capabilities.supportsDelete)throw new a(z);const i=[];for(const e of t)i.push("string"==typeof e?e:e.primaryKey);await this._deleteFeatures(i,e)}_getSerializableProperties(){return{...super._getSerializableProperties(),featureSettings:{serializeModes:["initial"],isDefault:t=>{if(!t)return!0;if(t.constructor===Object){if(!Object.keys(t).length)return!0}return!1}},taskSettings:"initial",onAddFeature:"initial",onEditFeature:"initial",schema:"initial",relationships:{serializeModes:["initial"],serialize:t=>this.relationships?this.relationships.filter((t=>"ArcGISRelationship"!==t.relationshipType)).toArray():[],deserialize:t=>{m(this.relationships,t,{onNew:t=>{n(t)?this.relationships.add(t):this.relationships.add(S.create(t))},onMatch:(t,e)=>{n(t)&&t.assignProperties({title:e.title})},onMissing:t=>{"ArcGISRelationship"!==t.relationshipType&&this.relationships.remove(t)},equals:(t,e)=>t.id===e.id})},default:[]},hyperlinks:{serialize:!1,deserialize:t=>{this.hyperlinks.removeAll(),this.hyperlinks.addMany(t.map((t=>t instanceof s?t:new s(t))))}},featureActions:{serializeModes:["initial"],deserialize:t=>{t?r(t)?this.featureActions=t:this.featureActions?this.featureActions.assignProperties(t):this.featureActions=c.create(t):this.featureActions=void 0}}}}*_initializableChildCollections(){yield*super._initializableChildCollections(),yield this.schema.fieldExtensions}async _onInitialize(){await super._onInitialize(),this.featureActions&&await this.featureActions.initialize()}async _postInitialize(){await super._postInitialize(),this.featureSettings.popupTemplate||(this.featureSettings.popupTemplate=this.schema.createPopupTemplate(),this.featureSettings._isDefaultPopupTemplate=!0);const{popupTemplate:e}=this.featureSettings;"function"==typeof e.content&&(e.content=e.content()),e.content=await e.content,"string"==typeof e.content&&(e.content=[new t({text:e.content})]),!e.title&&this.schema.displayField&&(e.title=`{${this.schema.displayField}}`),await h(this.featureSettings.popupContentExtensions,{target:this,onInitializeWarning:t=>this.emit("initializeWarning",t)}),await Promise.all(this.relationships.toArray().map((t=>t.relatedSource?.initialize())))}_createSchema(){return new y}_createFeatureSettings(){return new w}_createTaskSettings(){return new _}_createRelationships(){return new RelationshipCollection(this)}_createHyperlinks(){return new f}async _getAttachments(t){return[]}async _addAttachment(t,e){throw new a("Adding attachments is not supported.")}async _deleteAttachments(t,e){throw new a("Deleting attachments is not supported.")}_getFeatures(t,e){const{primaryKeyField:i}=this.schema;if(this.queryService&&i){const s=t.map((t=>`${i} = ${t}`)).join(" OR ");return this.queryService.query(this,s,e)}throw new a("Querying features is not supported.")}_addFeatures(t,e){throw new a(A)}_updateFeatures(t,e){throw new a(F)}_deleteFeatures(t,e){throw new a(z)}_capabilities(){return j}_isRelationship(t){return"function"==typeof t.getRelatedFeatures}_createAndSetupSchema(){const t=this._createSchema();return t._featureSettings=this.featureSettings,t}_createAndSetupFeatureSettings(){const t=this._createFeatureSettings();return t._setFeatureSource(this),t}}export class RelationshipCollection extends p{constructor(t){super(new f),this._source=t}add(t,e){return d("relationship",t).isNotMissing(),t.source&&t.source.relationships.remove(t),n(t)&&t._setSource(this._source),super.add(t,e)}removeAt(t){const e=super.removeAt(t);return n(e)&&e._setSource(void 0),e}}
@@ -1 +1 @@
1
- import{__decorate}from"tslib";import{EntityBase}from"../Entity.js";import{serializable}from"../support/Serializable.js";import{from,toArray}from"../utilities/asyncIterable.js";import{FeatureSet}from"./FeatureSet.js";let FeatureStream=class extends EntityBase{constructor(t){if(super(getEntityProperties(t)),this._itemType="feature-stream",t)if(t[Symbol.asyncIterator])this._features=t;else if(t[Symbol.iterator])this._features=from(t);else{const{features:e}=t;e?.[Symbol.asyncIterator]?this._features=e:e?.[Symbol.iterator]&&(this._features=from(e))}this._features=this._features||from([])}[Symbol.asyncIterator](){return this._features[Symbol.asyncIterator]()}toArray(){return toArray(this)}async toFeatureSet(){return new FeatureSet({title:this.title,features:await toArray(this)})}_getSerializableProperties(){return{...super._getSerializableProperties(),title:"initial"}}};FeatureStream=__decorate([serializable],FeatureStream);export{FeatureStream};function getEntityProperties(t){return!t||t[Symbol.iterator]||t[Symbol.asyncIterator]?void 0:t}
1
+ import{__decorate as t}from"tslib";import{EntityBase as e}from"../Entity.js";import{serializable as r}from"../support/Serializable.js";import{from as s,toArray as i}from"../utilities/asyncIterable.js";import{FeatureSet as a}from"./FeatureSet.js";let o=class extends e{constructor(t){var e;if(super(!(e=t)||e[Symbol.iterator]||e[Symbol.asyncIterator]?void 0:e),this._itemType="feature-stream",t)if(t[Symbol.asyncIterator])this._features=t;else if(t[Symbol.iterator])this._features=s(t);else{const{features:e}=t;e?.[Symbol.asyncIterator]?this._features=e:e?.[Symbol.iterator]&&(this._features=s(e))}this._features=this._features||s([])}[Symbol.asyncIterator](){return this._features[Symbol.asyncIterator]()}toArray(){return i(this)}async toFeatureSet(){return new a({title:this.title,features:await i(this)})}_getSerializableProperties(){return{...super._getSerializableProperties(),title:"initial"}}};o=t([r],o);export{o as FeatureStream};
@@ -1 +1 @@
1
- var FieldExtension_1;import{__decorate}from"tslib";import EsriField from"@arcgis/core/layers/support/Field";import{EntityBase}from"../Entity.js";import{InvalidOperationError}from"../InvalidOperationError.js";import{isFieldExtension,ItemType}from"../ItemType.js";import{Field as PortalField}from"../portal/Field.js";import{FormatSettings}from"../support/FormatSettings.js";import{serializable}from"../support/Serializable.js";import{esriFormatToGeocortexFormat}from"../utilities/date.js";import{isField}from"../utilities/esri.js";import{NumberFormat}from"../utilities/number.js";import{deepClone}from"../utilities/object.js";import{fieldWithArcadeXRegex}from"./Schema.js";export const _fieldExtensionMap=new WeakMap;let FieldExtension=FieldExtension_1=class extends EntityBase{constructor(e){super(e),this.format="{0}",this.formatSettings=new FieldExtensionFormatSettings(this),this.searchable=!0,this._itemType=ItemType.FIELD_EXTENSION;const{field:i}=e??{};isField(i)?this._setField(i):"string"==typeof i?this._deferredFieldProperties={$ref:i}:i?i.$ref?this._deferredFieldProperties=i:this._setField(PortalField.toEsriApiField(i)):this._setField(new EsriField),this.watch("_schema.featureSource",(()=>this.notifyChange("fieldInfo"))),this.watch("_schema._featureSettings",(e=>{this.formatSettings.parent=e?e.formatSettings:void 0}),!0)}get field(){return this._field}get schema(){return this._schema}get fieldInfo(){if(this._fieldInfo)return this._fieldInfo;if(!this.field||!this.field.name)return;const e=this._schema?._featureSettings?.popupTemplate,i=e?.fieldInfos||[];return this._fieldInfo=i.find((e=>e.fieldName===this.field.name)),this._fieldInfo}static matchesRef(e,i){return isFieldExtension(e)?(e.field?.name??e._deferredFieldProperties?.$ref)===i.$ref:e.name===i.$ref}_setSchema(e){this._schema=e,this._resolveField(),this.notifyChange("schema"),this.notifyChange("fieldInfo")}_resolveField(){if(this._field||!this._deferredFieldProperties||!this._schema)return;const e=this._schema.fields.find((e=>FieldExtension_1.matchesRef(e,this._deferredFieldProperties)));e&&(this._setField(e),this.assignProperties({field:this._deferredFieldProperties}),this._originalRef=this._deferredFieldProperties.$ref,delete this._deferredFieldProperties,_fieldExtensionMap.set(e,this))}_getSerializableProperties(){return{...super._getSerializableProperties(),field:{serializeModes:["initial"],serialize:()=>this.field?this._originalRef?{$ref:this._originalRef}:this._schema?.fields.includes(this._field)&&this.field.name?{$ref:this.field.name}:PortalField.fromEsriApiField(this.field):this._deferredFieldProperties?deepClone(this._deferredFieldProperties):void 0,deserialize:e=>{if(isField(e)){if(e!==this.field)throw new Error("Property 'field' is read-only.")}else e&&this.field&&PortalField.applyToEsriApiField(e,this.field)}},searchable:{serializeModes:["initial"],isDefault:e=>e!==this._isArcadeExpressionField},format:{serializeModes:["initial"],default:"{0}"},formatSettings:"initial"}}async _onInitialize(){if(this._resolveField(),!this._field){const e=this._deferredFieldProperties.$ref;throw this._schema?new InvalidOperationError(`Field not found with name: ${e}. Field does not exist.`):new InvalidOperationError(`Field not found with name: ${e}. Field does not have a parent schema.`)}}_setField(e){this._field=e,this._isArcadeExpressionField&&(this.searchable=!1),this.notifyChange("field"),this.notifyChange("fieldInfo")}get _isArcadeExpressionField(){return!!this._field&&!!this._field.name&&!!this._field.name.match(fieldWithArcadeXRegex)}};FieldExtension=FieldExtension_1=__decorate([serializable],FieldExtension);export{FieldExtension};let FieldExtensionFormatSettings=class extends FormatSettings{constructor(e,i){super(i),this.fieldExtension=e,e.watch("fieldInfo.format.places",(()=>this.notifyChange("fractionalDigits"))),e.watch("fieldInfo.format.digitSeparator",(()=>this.notifyChange("numberFormat"))),e.watch("fieldInfo.format.dateFormat",(()=>this.notifyChange("dateFormat")))}get fractionalDigits(){const e=this.fieldExtension.fieldInfo?.format?.places;return!this.isModified("fractionalDigits")&&this.useFieldInfo&&e?e:this._getSetting("fractionalDigits")}set fractionalDigits(e){this._setSetting("fractionalDigits",e)}get numberFormat(){const e=this.fieldExtension.fieldInfo?.format?.digitSeparator;return!this.isModified("numberFormat")&&this.useFieldInfo&&e?e?NumberFormat.NUMBER:NumberFormat.FIXED_POINT:this._getSetting("numberFormat")}set numberFormat(e){this._setSetting("numberFormat",e)}get dateFormat(){const e=this.fieldExtension.fieldInfo?.format?.dateFormat;return!this.isModified("dateFormat")&&this.useFieldInfo&&e?esriFormatToGeocortexFormat(e):this._getSetting("dateFormat")}set dateFormat(e){this._setSetting("dateFormat",e)}};FieldExtensionFormatSettings=__decorate([serializable],FieldExtensionFormatSettings);
1
+ var e;import{__decorate as i}from"tslib";import t from"@arcgis/core/layers/support/Field";import{EntityBase as s}from"../Entity.js";import{InvalidOperationError as r}from"../InvalidOperationError.js";import{isFieldExtension as o,ItemType as a}from"../ItemType.js";import{Field as f}from"../portal/Field.js";import{FormatSettings as d}from"../support/FormatSettings.js";import{serializable as n}from"../support/Serializable.js";import{esriFormatToGeocortexFormat as l}from"../utilities/date.js";import{isField as h}from"../utilities/esri.js";import{NumberFormat as m}from"../utilities/number.js";import{deepClone as p}from"../utilities/object.js";import{fieldWithArcadeXRegex as _}from"./Schema.js";export const _fieldExtensionMap=new WeakMap;let c=e=class extends s{get field(){return this._field}get schema(){return this._schema}get fieldInfo(){if(this._fieldInfo)return this._fieldInfo;if(!this.field?.name)return;const e=this._schema?._featureSettings?.popupTemplate,i=e?.fieldInfos||[];return this._fieldInfo=i.find((e=>e.fieldName===this.field.name)),this._fieldInfo}constructor(e){super(e),this.format="{0}",this.formatSettings=new F(this),this.searchable=!0,this._itemType=a.FIELD_EXTENSION;const{field:i}=e??{};h(i)?this._setField(i):"string"==typeof i?this._deferredFieldProperties={$ref:i}:i?i.$ref?this._deferredFieldProperties=i:this._setField(f.toEsriApiField(i)):this._setField(new t),this.watch("_schema.featureSource",(()=>this.notifyChange("fieldInfo"))),this.watch("_schema._featureSettings",(e=>{this.formatSettings.parent=e?e.formatSettings:void 0}),!0)}static matchesRef(e,i){return o(e)?(e.field?.name??e._deferredFieldProperties?.$ref)===i.$ref:e.name===i.$ref}_setSchema(e){this._schema=e,this._resolveField(),this.notifyChange("schema"),this.notifyChange("fieldInfo")}_resolveField(){if(this._field||!this._deferredFieldProperties||!this._schema)return;const i=this._schema.fields.find((i=>e.matchesRef(i,this._deferredFieldProperties)));i&&(this._setField(i),this.assignProperties({field:this._deferredFieldProperties}),this._originalRef=this._deferredFieldProperties.$ref,delete this._deferredFieldProperties,_fieldExtensionMap.set(i,this))}_getSerializableProperties(){return{...super._getSerializableProperties(),field:{serializeModes:["initial"],serialize:()=>this.field?this._originalRef?{$ref:this._originalRef}:this._schema?.fields.includes(this._field)&&this.field.name?{$ref:this.field.name}:f.fromEsriApiField(this.field):this._deferredFieldProperties?p(this._deferredFieldProperties):void 0,deserialize:e=>{if(h(e)){if(e!==this.field)throw new Error("Property 'field' is read-only.")}else e&&this.field&&f.applyToEsriApiField(e,this.field)}},searchable:{serializeModes:["initial"],isDefault:e=>e!==this._isArcadeExpressionField},format:{serializeModes:["initial"],default:"{0}"},formatSettings:"initial"}}async _onInitialize(){if(this._resolveField(),!this._field){const e=this._deferredFieldProperties.$ref;throw this._schema?new r(`Field not found with name: ${e}. Field does not exist.`):new r(`Field not found with name: ${e}. Field does not have a parent schema.`)}}_setField(e){this._field=e,this._isArcadeExpressionField&&(this.searchable=!1),this.notifyChange("field"),this.notifyChange("fieldInfo")}get _isArcadeExpressionField(){return!!this._field&&!!this._field.name&&!!this._field.name.match(_)}};c=e=i([n],c);export{c as FieldExtension};let F=class extends d{constructor(e,i){super(i),this.fieldExtension=e,e.watch("fieldInfo.format.places",(()=>this.notifyChange("fractionalDigits"))),e.watch("fieldInfo.format.digitSeparator",(()=>this.notifyChange("numberFormat"))),e.watch("fieldInfo.format.dateFormat",(()=>this.notifyChange("dateFormat")))}get fractionalDigits(){const e=this.fieldExtension.fieldInfo?.format?.places;return!this.isModified("fractionalDigits")&&this.useFieldInfo&&e?e:this._getSetting("fractionalDigits")}set fractionalDigits(e){this._setSetting("fractionalDigits",e)}get numberFormat(){const e=this.fieldExtension.fieldInfo?.format?.digitSeparator;return!this.isModified("numberFormat")&&this.useFieldInfo&&e?e?m.NUMBER:m.FIXED_POINT:this._getSetting("numberFormat")}set numberFormat(e){this._setSetting("numberFormat",e)}get dateFormat(){const e=this.fieldExtension.fieldInfo?.format?.dateFormat;return!this.isModified("dateFormat")&&this.useFieldInfo&&e?l(e):this._getSetting("dateFormat")}set dateFormat(e){this._setSetting("dateFormat",e)}};F=i([n],F);
@@ -1 +1 @@
1
- var PopupContentExtension_1;import{__decorate}from"tslib";import Content from"@arcgis/core/popup/content/Content.js";import{EntityBase}from"../Entity.js";import{InvalidOperationError}from"../InvalidOperationError.js";import{ItemType}from"../ItemType.js";import{PopupContent}from"../portal/PopupInfo.js";import{serializable}from"../support/Serializable.js";import{Collection}from"../support/esri.js";import{compare}from"../utilities/array.js";import{isCustomContent,isExpressionContent,isPopupContent,isTextContent}from"../utilities/esri.js";import{deepClone}from"../utilities/object.js";export const _popupContentExtensionMap=new WeakMap;let PopupContentExtension=PopupContentExtension_1=class extends EntityBase{constructor(t){super(t),this.summaryHiddenFields=new Collection,this._itemType=ItemType.POPUP_CONTENT_EXTENSION;const{content:e,visibleInSummary:n}=t??{};isPopupContent(e)?this._setContent(e):"string"==typeof e?this._deferredContentProperties={$ref:e}:e?e.$ref?this._deferredContentProperties=e:this._setContent(PopupContent.toEsriApiPopupContent(e)):this._setContent(new Content),this.visibleInSummary=n??this._getDefaultSummaryVisibility()}get content(){return this._content}get featureSettings(){return this._featureSettings}get _index(){return Array.isArray(this.featureSettings.popupTemplate?.content)?this.featureSettings.popupTemplate.content.indexOf(this.content):-1}static matchesRef(t,e,n){const i=t.map(((t,e)=>contentToRef(t,t instanceof PopupContentExtension_1?t._index:e))),o=i[e],{type:r,index:s,title:p,text:a}=n.$ref;if(r!==o.type)return!1;if("text"===r&&a===o.text)return!0;if(p&&p===o.title)return!0;if("number"==typeof s&&s===o.index)return!0;return 1===i.map(((t,e)=>t.type===r?t.index:void 0)).filter((t=>"number"==typeof t)).length}_setFeatureSettings(t){this._featureSettings=t,this._resolveContent(),this.notifyChange("featureSettings")}_resolveContent(){if(this._content||!this._deferredContentProperties||!this._featureSettings)return;const t=this._featureSettings._popupContent.find(((t,e)=>PopupContentExtension_1.matchesRef(this.featureSettings._popupContent.toArray(),e,this._deferredContentProperties)));t&&(this._setContent(t),this.assignProperties({content:this._deferredContentProperties}),this._originalRef={...this._deferredContentProperties.$ref},delete this._deferredContentProperties,_popupContentExtensionMap.set(t,this))}_getSerializableProperties(){return{...super._getSerializableProperties(),content:{serializeModes:["initial"],serialize:()=>this.content?this._originalRef?{$ref:this._originalRef}:this._featureSettings?._popupContent.includes(this._content)?{$ref:contentToRef(this.content,this._index)}:PopupContent.fromEsriApiPopupContent(this.content):this._deferredContentProperties?deepClone(this._deferredContentProperties):void 0,deserialize:t=>{if(isPopupContent(t)){if(t!==this.content)throw new Error("Property 'popupContent' is read-only.")}else t&&this.content&&PopupContent.applyToEsriApiPopupContent(t,this.content)}},visibleInSummary:{serializeModes:["initial"],isDefault:(t,e)=>t===this._getDefaultSummaryVisibility()},summaryHiddenFields:{serializeModes:["initial"],serialize:()=>this.summaryHiddenFields.toArray(),deserialize:t=>{compare(this.summaryHiddenFields,t,{onMatch:(t,e,n,i)=>{this.summaryHiddenFields.reorder(t,i)},onMissing:t=>this.summaryHiddenFields.remove(t),onNew:t=>{this.summaryHiddenFields.add(t)}})}}}}async _onInitialize(){if(this._resolveContent(),!this._content){const t=this._deferredContentProperties.$ref;throw this._featureSettings?new InvalidOperationError(`PopupContent not found with reference: ${JSON.stringify(t)}. PopupContent does not exist.`):new InvalidOperationError(`PopupContent not found with reference: ${JSON.stringify(t)}. PopupContent does not have a parent featureSettings.`)}}_setContent(t){this._content=t,this.notifyChange("content")}_getDefaultSummaryVisibility(){return"text"===(this.content?.type??this._deferredContentProperties?.type??this._deferredContentProperties?.$ref?.type)}};PopupContentExtension=PopupContentExtension_1=__decorate([serializable],PopupContentExtension);export{PopupContentExtension};function contentToRef(t,e){const n=t instanceof PopupContentExtension?t.content:t;if(!n)return t._deferredContentProperties?.$ref;const i={type:n.type};return e>=0&&(i.index=e),isExpressionContent(n)?i.title=n.expressionInfo.title:isTextContent(n)?i.text=n.text:isCustomContent(n)||(i.title=n.title),i}
1
+ var t;import{__decorate as e}from"tslib";import i from"@arcgis/core/popup/content/Content.js";import{EntityBase as n}from"../Entity.js";import{InvalidOperationError as r}from"../InvalidOperationError.js";import{ItemType as s}from"../ItemType.js";import{PopupContent as o}from"../portal/PopupInfo.js";import{serializable as p}from"../support/Serializable.js";import{Collection as a}from"../support/esri.js";import{compare as f}from"../utilities/array.js";import{isCustomContent as d,isExpressionContent as u,isPopupContent as h,isTextContent as l}from"../utilities/esri.js";import{deepClone as m}from"../utilities/object.js";export const _popupContentExtensionMap=new WeakMap;let _=t=class extends n{get content(){return this._content}get featureSettings(){return this._featureSettings}get _index(){return Array.isArray(this.featureSettings.popupTemplate?.content)?this.featureSettings.popupTemplate.content.indexOf(this.content):-1}constructor(t){super(t),this.summaryHiddenFields=new a,this._itemType=s.POPUP_CONTENT_EXTENSION;const{content:e,visibleInSummary:n}=t??{};h(e)?this._setContent(e):"string"==typeof e?this._deferredContentProperties={$ref:e}:e?e.$ref?this._deferredContentProperties=e:this._setContent(o.toEsriApiPopupContent(e)):this._setContent(new i),this.visibleInSummary=n??this._getDefaultSummaryVisibility()}static matchesRef(e,i,n){const r=e.map(((e,i)=>c(e,e instanceof t?e._index:i))),s=r[i],{type:o,index:p,title:a,text:f}=n.$ref;if(o!==s.type)return!1;if("text"===o&&f===s.text)return!0;if(a&&a===s.title)return!0;if("number"==typeof p&&p===s.index)return!0;return 1===r.map(((t,e)=>t.type===o?t.index:void 0)).filter((t=>"number"==typeof t)).length}_setFeatureSettings(t){this._featureSettings=t,this._resolveContent(),this.notifyChange("featureSettings")}_resolveContent(){if(this._content||!this._deferredContentProperties||!this._featureSettings)return;const e=this._featureSettings._popupContent.find(((e,i)=>t.matchesRef(this.featureSettings._popupContent.toArray(),i,this._deferredContentProperties)));e&&(this._setContent(e),this.assignProperties({content:this._deferredContentProperties}),this._originalRef={...this._deferredContentProperties.$ref},delete this._deferredContentProperties,_popupContentExtensionMap.set(e,this))}_getSerializableProperties(){return{...super._getSerializableProperties(),content:{serializeModes:["initial"],serialize:()=>this.content?this._originalRef?{$ref:this._originalRef}:this._featureSettings?._popupContent.includes(this._content)?{$ref:c(this.content,this._index)}:o.fromEsriApiPopupContent(this.content):this._deferredContentProperties?m(this._deferredContentProperties):void 0,deserialize:t=>{if(h(t)){if(t!==this.content)throw new Error("Property 'popupContent' is read-only.")}else t&&this.content&&o.applyToEsriApiPopupContent(t,this.content)}},visibleInSummary:{serializeModes:["initial"],isDefault:(t,e)=>t===this._getDefaultSummaryVisibility()},summaryHiddenFields:{serializeModes:["initial"],serialize:()=>this.summaryHiddenFields.toArray(),deserialize:t=>{f(this.summaryHiddenFields,t,{onMatch:(t,e,i,n)=>{this.summaryHiddenFields.reorder(t,n)},onMissing:t=>this.summaryHiddenFields.remove(t),onNew:t=>{this.summaryHiddenFields.add(t)}})}}}}async _onInitialize(){if(this._resolveContent(),!this._content){const t=this._deferredContentProperties.$ref;throw this._featureSettings?new r(`PopupContent not found with reference: ${JSON.stringify(t)}. PopupContent does not exist.`):new r(`PopupContent not found with reference: ${JSON.stringify(t)}. PopupContent does not have a parent featureSettings.`)}}_setContent(t){this._content=t,this.notifyChange("content")}_getDefaultSummaryVisibility(){return"text"===(this.content?.type??this._deferredContentProperties?.type??this._deferredContentProperties?.$ref?.type)}};_=t=e([p],_);export{_ as PopupContentExtension};function c(t,e){const i=t instanceof _?t.content:t;if(!i)return t._deferredContentProperties?.$ref;const n={type:i.type};return e>=0&&(n.index=e),u(i)?n.title=i.expressionInfo.title:l(i)?n.text=i.text:d(i)||(n.title=i.title),n}
@@ -1 +1 @@
1
- import{Relationship}from"./_Relationship.js";import{DefaultRelationshipFactory}from"./support/DefaultRelationshipFactory.js";export{Relationship}from"./_Relationship.js";Relationship.factory=DefaultRelationshipFactory.instance;
1
+ import{Relationship as o}from"./_Relationship.js";import{DefaultRelationshipFactory as t}from"./support/DefaultRelationshipFactory.js";export{Relationship}from"./_Relationship.js";o.factory=t.instance;
@@ -1 +1 @@
1
- var _RelationshipBase_getRelatedFeaturesPromises;import{__classPrivateFieldGet}from"tslib";import{EntityBase}from"../Entity.js";import{InvalidOperationError}from"../InvalidOperationError.js";import{isFeatureSet,ItemType}from"../ItemType.js";import{cancelify}from"../support/Cancellable.js";import{checkArg}from"../utilities/checkArg.js";const ERR_NO_FEATURE_SOURCE="Cannot get related features without feature source.";export class RelationshipBase extends EntityBase{constructor(){super(...arguments),_RelationshipBase_getRelatedFeaturesPromises.set(this,new WeakMap),this._itemType=ItemType.RELATIONSHIP}get source(){return this._source}async getRelatedFeatures(e,t){if(checkArg("feature",e).isNotMissing(),!this.source)throw new InvalidOperationError(ERR_NO_FEATURE_SOURCE);__classPrivateFieldGet(this,_RelationshipBase_getRelatedFeaturesPromises,"f").has(e)||__classPrivateFieldGet(this,_RelationshipBase_getRelatedFeaturesPromises,"f").set(e,(async()=>{try{return await this._getRelatedFeatures(e,t)}finally{__classPrivateFieldGet(this,_RelationshipBase_getRelatedFeaturesPromises,"f").delete(e)}})());const s=__classPrivateFieldGet(this,_RelationshipBase_getRelatedFeaturesPromises,"f").get(e);return cancelify(s,t?.cancelToken)}async getAllRelatedFeatures(e,t){if(checkArg("feature",e).isNotMissing(),!this.source)throw new InvalidOperationError(ERR_NO_FEATURE_SOURCE);let s;s=Array.isArray(e)?e:isFeatureSet(e)?[...e]:await e.toArray();const a=cancelify(this._getAllRelatedFeatures(s,t),t?.cancelToken);for(const e of s)__classPrivateFieldGet(this,_RelationshipBase_getRelatedFeaturesPromises,"f").has(e)||__classPrivateFieldGet(this,_RelationshipBase_getRelatedFeaturesPromises,"f").set(e,(async()=>{try{return(await a).get(e)}finally{__classPrivateFieldGet(this,_RelationshipBase_getRelatedFeaturesPromises,"f").delete(e)}})());return a}_setSource(e){this._source=e}_getSerializableProperties(){return{...super._getSerializableProperties(),title:"initial"}}}_RelationshipBase_getRelatedFeaturesPromises=new WeakMap;
1
+ var e;import{__classPrivateFieldGet as t}from"tslib";import{EntityBase as r}from"../Entity.js";import{InvalidOperationError as s}from"../InvalidOperationError.js";import{isFeatureSet as i,ItemType as a}from"../ItemType.js";import{cancelify as o}from"../support/Cancellable.js";import{checkArg as n}from"../utilities/checkArg.js";const l="Cannot get related features without feature source.";export class RelationshipBase extends r{constructor(){super(...arguments),e.set(this,new WeakMap),this._itemType=a.RELATIONSHIP}get source(){return this._source}async getRelatedFeatures(r,i){if(n("feature",r).isNotMissing(),!this.source)throw new s(l);t(this,e,"f").has(r)||t(this,e,"f").set(r,(async()=>{try{return await this._getRelatedFeatures(r,i)}finally{t(this,e,"f").delete(r)}})());const a=t(this,e,"f").get(r);return o(a,i?.cancelToken)}async getAllRelatedFeatures(r,a){if(n("feature",r).isNotMissing(),!this.source)throw new s(l);let u;u=Array.isArray(r)?r:i(r)?[...r]:await r.toArray();const c=o(this._getAllRelatedFeatures(u,a),a?.cancelToken);for(const r of u)t(this,e,"f").has(r)||t(this,e,"f").set(r,(async()=>{try{return(await c).get(r)}finally{t(this,e,"f").delete(r)}})());return c}_setSource(e){this._source=e}_getSerializableProperties(){return{...super._getSerializableProperties(),title:"initial"}}}e=new WeakMap;
package/data/Schema.js CHANGED
@@ -1 +1 @@
1
- var Schema_1;import{__decorate}from"tslib";import PopupTemplate from"@arcgis/core/PopupTemplate";import Field from"@arcgis/core/layers/support/Field";import FieldInfo from"@arcgis/core/popup/FieldInfo";import{InvalidOperationError}from"../InvalidOperationError.js";import{isFieldExtension}from"../ItemType.js";import{Field as PortalField}from"../portal/Field.js";import{GeometryType as PortalGeometryType}from"../portal/Geometry.js";import{Type as PortalType}from"../portal/Type.js";import{InitializableCollectionProxy}from"../support/InitializableCollectionProxy.js";import{filterJSONProperties,isDefault,serializable,shouldExcludeDefaults}from"../support/Serializable.js";import{Settings}from"../support/Settings.js";import{CollectionProxy}from"../utilities/CollectionProxy.js";import{checkArg}from"../utilities/checkArg.js";import{Collection,compare}from"../utilities/collection.js";import{isValidTimeZone,ERR_TIME_ZONE_INVALID}from"../utilities/date.js";import{isFeatureType,isField}from"../utilities/esri.js";import{onCollectionPropertyChange}from"../utilities/watch.js";import{_fieldExtensionMap,FieldExtension}from"./FieldExtension.js";const esriFields=new Map;esriFields.set("objectid","oid"),esriFields.set("oid","oid"),esriFields.set("fid","oid"),esriFields.set("shape","geometry"),esriFields.set("shape__length","double"),esriFields.set("shape_length","double"),esriFields.set("shape__area","double"),esriFields.set("shape_area","double"),esriFields.set("area","double"),esriFields.set("perimeter","double"),esriFields.set("length","double"),esriFields.set("fnode_","double"),esriFields.set("tnode_","double"),esriFields.set("lpoly_","double"),esriFields.set("rpoly_","double"),esriFields.set("cover_","integer"),esriFields.set("cover_id","integer"),esriFields.set("idtic","integer"),esriFields.set("xtic","double"),esriFields.set("ytic","double"),esriFields.set("xmin","double"),esriFields.set("ymin","double"),esriFields.set("xmax","double"),esriFields.set("ymax","double"),esriFields.set("arc_","double"),esriFields.set("subclass_","integer"),esriFields.set("subclass_id","integer"),esriFields.set("routelink","integer"),esriFields.set("arclink","integer"),esriFields.set("f_meas","double"),esriFields.set("t_meas","double"),esriFields.set("f_pos","double"),esriFields.set("t_pos","double"),esriFields.set("f_meas","double"),esriFields.set("globalid","global-id"),esriFields.set("guid","guid");export const fieldWithArcadeXRegex=/expression\/((\w|-)*)/;export const fieldWithRelationshipRegex=/relationships\/(\d*)\/(\w*)/;const FIELD_INFO_MAP=new WeakMap;let Schema=Schema_1=class extends Settings{constructor(e){super(e),this.fieldExtensions=new FieldExtensionCollectionImpl(this),this.fields=new FieldCollectionImpl(this)}get spatialReference(){return this._getSetting("spatialReference")}set spatialReference(e){this._setSetting("spatialReference",e)}get primaryKeyField(){const e=this._getSetting("primaryKeyField");if(!e){const e=this.fields.filter((e=>"oid"===e.type));if(1===e.length)return e.getItemAt(0).name}return e}set primaryKeyField(e){this._setSetting("primaryKeyField",e)}get displayField(){return this._getSetting("displayField",this.primaryKeyField)}set displayField(e){!this._featureSettings?.popupTemplate||this._featureSettings.popupTemplate.title&&this._featureSettings.popupTemplate.title!==`{${this.displayField}}`||(this._featureSettings.popupTemplate.title=`{${e}}`),this._setSetting("displayField",e)}get geometryType(){return this._getSetting("geometryType")}set geometryType(e){this._setSetting("geometryType",e)}get hasGeometry(){return void 0!==this.geometryType&&null!==this.geometryType}get timeZone(){return this._getSetting("timeZone","UTC")}set timeZone(e){checkArg("timeZone",e).satisfies((e=>isValidTimeZone(e)),ERR_TIME_ZONE_INVALID(e)),this._setSetting("timeZone",e)}get typeIdField(){return this._getSetting("typeIdField")}set typeIdField(e){this._setSetting("typeIdField",e)}get types(){return this._getCollectionSetting("types")}get _fields(){return this._getCollectionSetting("_fields")}static createFieldInfoFromField(e){let i=!0;const t=e.name.toLowerCase();return("oid"===e.type||"geometry"===e.type||esriFields.has(t)&&esriFields.get(t)===e.type)&&(i=!1),new FieldInfo({visible:i,fieldName:e.name,format:void 0,label:e.alias,stringFieldOption:void 0,tooltip:void 0,isEditable:e.editable})}findFieldByName(e){return this.fields.find((i=>i.name===e))}toJSON(e="all"){const i=filterJSONProperties(this._getSerializableProperties(),this,e)||{};let t=i.fieldExtensions;this.parent&&(t=t?.filter((e=>!this.parent?.fieldExtensions?.some((i=>i.id===e.id)))));const{fields:s}=i;if(i)for(const e of Object.keys(i))this.isModified(e)||delete i[e];if(s&&(i.fields=s),t?.length&&(i.fieldExtensions=t),!shouldExcludeDefaults(e)||!isDefault(i))return i}createPopupTemplate(){const e=this.createAllFieldInfos();return new PopupTemplate({fieldInfos:e,content:[{type:"fields"},{type:"attachments"}]})}createAllFieldInfos(){return this.fields.toArray().filter((e=>!!e.name)).map((e=>Schema_1.createFieldInfoFromField(e)))}_getSerializableProperties(){return{geometryType:{serialize:!1,deserialize:e=>{this.geometryType=PortalGeometryType.toEsriApiGeometryType(e)}},spatialReference:{serialize:!1},primaryKeyField:{serialize:!1},displayField:{serialize:!1},typeIdField:{serialize:!1},fields:{serializeModes:["initial"],serialize:()=>this.isModified("_fields")?this.fields.toArray().map((e=>PortalField.fromEsriApiField(e))):void 0,deserialize:e=>{if(!e)return;const i=e.map((e=>isField(e)?e:PortalField.toEsriApiField(e)));compare(this.fields,i,{onNew:(e,i)=>{this.fields.add(e,i)},onMatch:(e,i,t,s)=>{e!==i&&(e.alias=i.alias,e.editable=i.editable,e.length=i.length,e.nullable=i.nullable,e.type=i.type),t!==s&&this.fields.reorder(e,s)},onMissing:e=>{this.fields.remove(e)},equals:(e,i)=>e.name===i.name})}},fieldExtensions:{serializeModes:["initial"],serialize:e=>this.fieldExtensions.toArray().map((i=>i.toJSON(e))).filter((e=>this._alwaysSerializeFieldExtensions||!(e&&2===Object.keys(e).length&&e.id&&e.field))),deserialize:e=>{e&&compare(this.fieldExtensions,e,{onNew:(e,i)=>{this.fieldExtensions.add(isFieldExtension(e)?e:new FieldExtension(e),i)},onMatch:(e,i,t,s)=>{isFieldExtension(i)||e.assignProperties(i),t!==s&&this.fieldExtensions.reorder(e,s)},onMissing:e=>{this._alwaysSerializeFieldExtensions&&this.fieldExtensions.remove(e)},equals:(e,i)=>isFieldExtension(i)?i===e:!(!i?.field||!FieldExtension.matchesRef(e,i.field))||e.id===i.id})}},types:{serialize:!1,deserialize:e=>{if(!e)return;const i=e.map((e=>isFeatureType(e)?e:PortalType.toEsriApiFeatureType(e)));compare(this.types,i,{onNew:(e,i)=>{this.types.add(e,i)},onMatch:(e,i,t,s)=>{e!==i&&(e.name=i.name,e.templates=i.templates?[...i.templates]:[],e.domains=i.domains),t!==s&&this.types.reorder(e,s)},onMissing:e=>{this.types.remove(e)},equals:(e,i)=>e.id===i.id})}},timeZone:{serialize:!1,deserialize:e=>{e&&(this.timeZone=e)}}}}};Schema=Schema_1=__decorate([serializable],Schema);export{Schema};class FieldCollectionImpl extends CollectionProxy{constructor(e){super(),this._schema=e,onCollectionPropertyChange(this._schema,"_fields",(e=>{this.emit("change",e),this._fieldLookup=void 0})),e.watch("_fields.length",(()=>this.notifyChange("length")))}get _createFieldLookup(){return this._collection.reduce(((e,i)=>(e.add(i),e)),new WeakSet)}get _expressionFieldsLength(){return this.expressionFields.length}get expressionFields(){if(!this._popupTemplate||!this._popupTemplate.fieldInfos||!this._popupTemplate.expressionInfos)return new Collection;const e=new Collection;for(const i of this._popupTemplate.fieldInfos){const t=i.fieldName.match(fieldWithArcadeXRegex);if(t){const s=this._popupTemplate.expressionInfos.find((e=>e.name===t[1]));if(s){if(!FIELD_INFO_MAP.has(i)){const e=new Field({name:i.fieldName,alias:i.label||s.title||i.fieldName,type:"number"===s.returnType?"double":"string",editable:!1});FIELD_INFO_MAP.set(i,e)}e.add(FIELD_INFO_MAP.get(i))}}}return e}get _collection(){return this._schema._fields.concat(this.expressionFields)}get _popupTemplate(){return this._schema._featureSettings?this._schema._featureSettings.popupTemplate:void 0}includes(e){return this._fieldLookup=this._fieldLookup??this._createFieldLookup,this._fieldLookup.has(e)}clone(){return new FieldCollectionImpl(this._schema)}add(e,i){checkArg("field",e).isNotMissing(),this._fieldLookup=void 0;const t=e.name?e.name.match(fieldWithArcadeXRegex):void 0;if(t){if(!this._popupTemplate)throw new InvalidOperationError("Cannot create a field that references an arcade expression without a feature source and popup template.");const i=this._popupTemplate.expressionInfos.find((e=>e.name===t[1]));if(!i)throw new InvalidOperationError("Cannot create a field that references a non-existent arcade expression.");this._popupTemplate.fieldInfos||(this._popupTemplate.fieldInfos=[]);let s=this._popupTemplate.fieldInfos.find((i=>i.fieldName===e.name));s||(s=new FieldInfo({fieldName:e.name,label:i.title}),this._popupTemplate.fieldInfos.push(s));const l=FIELD_INFO_MAP.get(s);FIELD_INFO_MAP.set(s,e);const o={added:[e],moved:[],removed:l?[l]:[],target:this};this.emit("change",o),this.notifyChange("length"),this.notifyChange("_expressionFieldsLength")}else this._schema._fields.add(e,i);return this}removeAt(e){checkArg("index",e).isNotMissing();const i=this.getItemAt(e);if(!i)return;this._fieldLookup=void 0;if(i.name?i.name.match(fieldWithArcadeXRegex):void 0){const e=this._popupTemplate.fieldInfos.findIndex((e=>e.fieldName===i.name));this._popupTemplate.fieldInfos.splice(e,1);const t={added:[],moved:[],removed:[i],target:this};this.emit("change",t),this.notifyChange("length"),this.notifyChange("_expressionFieldsLength")}else this._schema._fields.remove(i);return i}reorder(e,i){if(e&&this._schema._fields.includes(e))return this._schema._fields.reorder(e,i),e}sort(e){return this._schema._fields.sort(e),this}}class FieldExtensionCollectionImpl extends InitializableCollectionProxy{constructor(e){super(),this._uninitializedFieldExtensions=new Set,this._schema=e,onCollectionPropertyChange(this._schema,"fields",(e=>{const i={added:(e.added||[]).map((e=>this._forField(e))),moved:(e.moved||[]).map((e=>this._forField(e))),removed:(e.removed||[]).map((e=>this._forField(e))),target:this};this.emit("change",i)})),e.watch("fields.length",(()=>this.notifyChange("length")))}get _collection(){return this._schema.fields.map((e=>this._forField(e))).concat(Array.from(this._uninitializedFieldExtensions))}forField(e){if(checkArg("field",e).isNotMissing(),this._schema.fields.includes(e))return this._forField(e)}add(e,i){if(checkArg("fieldX",e).isNotMissing(),e.schema&&e.schema.fieldExtensions.remove(e),e._setSchema(this._schema),e.field){const t=_fieldExtensionMap.get(e.field);if(_fieldExtensionMap.set(e.field,e),t&&t!==e&&this._onRemoved(t),this._schema.fields.includes(e.field))if(void 0===i){const i={added:[e],moved:[],removed:t?[t]:[],target:this};this.emit("change",i)}else this._schema.fields.reorder(e.field,i);else this._schema.fields.add(e.field,i)}else{this._uninitializedFieldExtensions.add(e);const i={added:[e],moved:[],removed:[],target:this};this.emit("change",i)}return this._onAdded(e),this}removeAt(e){const i=this.getItemAt(e);if(void 0!==i){if(this._uninitializedFieldExtensions.has(i)){this._uninitializedFieldExtensions.delete(i);const e={added:[],moved:[],removed:[i],target:this};this.emit("change",e)}else this._schema.fields.remove(i.field);return this._onRemoved(i),i}}reorder(e,i){if(e&&this._schema.fields.includes(e.field))return this._schema.fields.reorder(e.field,i),e}sort(e){return this._schema.fields.sort(((i,t)=>e(this._forField(i),this._forField(t)))),this}_itemIsInitialized(e){return super._itemIsInitialized(e)&&!!e.field}_onAdded(e){}_onRemoved(e){e.schema===this._schema&&e._setSchema(void 0)}_forField(e){if(this._uninitializedFieldExtensions.size)for(const e of this._uninitializedFieldExtensions)e._resolveField(),e.field&&(_fieldExtensionMap.set(e.field,e),this._uninitializedFieldExtensions.delete(e));if(!_fieldExtensionMap.has(e)){const i=new FieldExtension({field:e});_fieldExtensionMap.set(e,i),i._setSchema(this._schema),this._onAdded(i)}return _fieldExtensionMap.get(e)}}
1
+ var e;import{__decorate as t}from"tslib";import i from"@arcgis/core/PopupTemplate";import s from"@arcgis/core/layers/support/Field";import o from"@arcgis/core/popup/FieldInfo";import{InvalidOperationError as l}from"../InvalidOperationError.js";import{isFieldExtension as n}from"../ItemType.js";import{Field as r}from"../portal/Field.js";import{GeometryType as d}from"../portal/Geometry.js";import{Type as a}from"../portal/Type.js";import{InitializableCollectionProxy as h}from"../support/InitializableCollectionProxy.js";import{filterJSONProperties as p,isDefault as m,serializable as f,shouldExcludeDefaults as c}from"../support/Serializable.js";import{Settings as u}from"../support/Settings.js";import{CollectionProxy as _}from"../utilities/CollectionProxy.js";import{checkArg as g}from"../utilities/checkArg.js";import{Collection as y,compare as F}from"../utilities/collection.js";import{isValidTimeZone as x,ERR_TIME_ZONE_INVALID as b}from"../utilities/date.js";import{isFeatureType as v,isField as T}from"../utilities/esri.js";import{onCollectionPropertyChange as z}from"../utilities/watch.js";import{_fieldExtensionMap as I,FieldExtension as S}from"./FieldExtension.js";const w=new Map;w.set("objectid","oid"),w.set("oid","oid"),w.set("fid","oid"),w.set("shape","geometry"),w.set("shape__length","double"),w.set("shape_length","double"),w.set("shape__area","double"),w.set("shape_area","double"),w.set("area","double"),w.set("perimeter","double"),w.set("length","double"),w.set("fnode_","double"),w.set("tnode_","double"),w.set("lpoly_","double"),w.set("rpoly_","double"),w.set("cover_","integer"),w.set("cover_id","integer"),w.set("idtic","integer"),w.set("xtic","double"),w.set("ytic","double"),w.set("xmin","double"),w.set("ymin","double"),w.set("xmax","double"),w.set("ymax","double"),w.set("arc_","double"),w.set("subclass_","integer"),w.set("subclass_id","integer"),w.set("routelink","integer"),w.set("arclink","integer"),w.set("f_meas","double"),w.set("t_meas","double"),w.set("f_pos","double"),w.set("t_pos","double"),w.set("f_meas","double"),w.set("globalid","global-id"),w.set("guid","guid");export const fieldWithArcadeXRegex=/expression\/((\w|-)*)/;export const fieldWithRelationshipRegex=/relationships\/(\d*)\/(\w*)/;const E=new WeakMap;let A=e=class extends u{get spatialReference(){return this._getSetting("spatialReference")}set spatialReference(e){this._setSetting("spatialReference",e)}get primaryKeyField(){const e=this._getSetting("primaryKeyField");if(!e){const e=this.fields.filter((e=>"oid"===e.type));if(1===e.length)return e.getItemAt(0).name}return e}set primaryKeyField(e){this._setSetting("primaryKeyField",e)}get displayField(){return this._getSetting("displayField",this.primaryKeyField)}set displayField(e){!this._featureSettings?.popupTemplate||this._featureSettings.popupTemplate.title&&this._featureSettings.popupTemplate.title!==`{${this.displayField}}`||(this._featureSettings.popupTemplate.title=`{${e}}`),this._setSetting("displayField",e)}get geometryType(){return this._getSetting("geometryType")}set geometryType(e){this._setSetting("geometryType",e)}get hasGeometry(){return void 0!==this.geometryType&&null!==this.geometryType}get timeZone(){return this._getSetting("timeZone","UTC")}set timeZone(e){g("timeZone",e).satisfies((e=>x(e)),b(e)),this._setSetting("timeZone",e)}get typeIdField(){return this._getSetting("typeIdField")}set typeIdField(e){this._setSetting("typeIdField",e)}get types(){return this._getCollectionSetting("types")}get _fields(){return this._getCollectionSetting("_fields")}constructor(e){super(e),this.fieldExtensions=new N(this),this.fields=new j(this)}static createFieldInfoFromField(e){let t=!0;const i=e.name.toLowerCase();return("oid"===e.type||"geometry"===e.type||w.has(i)&&w.get(i)===e.type)&&(t=!1),new o({visible:t,fieldName:e.name,format:void 0,label:e.alias,stringFieldOption:void 0,tooltip:void 0,isEditable:e.editable})}findFieldByName(e){return this.fields.find((t=>t.name===e))}toJSON(e="all"){const t=p(this._getSerializableProperties(),this,e)||{};let i=t.fieldExtensions;this.parent&&(i=i?.filter((e=>!this.parent?.fieldExtensions?.some((t=>t.id===e.id)))));const{fields:s}=t;if(t)for(const e of Object.keys(t))this.isModified(e)||delete t[e];if(s&&(t.fields=s),i?.length&&(t.fieldExtensions=i),!c(e)||!m(t))return t}createPopupTemplate(){const e=this.createAllFieldInfos();return new i({fieldInfos:e,content:[{type:"fields"},{type:"attachments"}]})}createAllFieldInfos(){return this.fields.toArray().filter((e=>!!e.name)).map((t=>e.createFieldInfoFromField(t)))}_getSerializableProperties(){return{geometryType:{serialize:!1,deserialize:e=>{this.geometryType=d.toEsriApiGeometryType(e)}},spatialReference:{serialize:!1},primaryKeyField:{serialize:!1},displayField:{serialize:!1},typeIdField:{serialize:!1},fields:{serializeModes:["initial"],serialize:()=>this.isModified("_fields")?this.fields.toArray().map((e=>r.fromEsriApiField(e))):void 0,deserialize:e=>{if(!e)return;const t=e.map((e=>T(e)?e:r.toEsriApiField(e)));F(this.fields,t,{onNew:(e,t)=>{this.fields.add(e,t)},onMatch:(e,t,i,s)=>{e!==t&&(e.alias=t.alias,e.editable=t.editable,e.length=t.length,e.nullable=t.nullable,e.type=t.type),i!==s&&this.fields.reorder(e,s)},onMissing:e=>{this.fields.remove(e)},equals:(e,t)=>e.name===t.name})}},fieldExtensions:{serializeModes:["initial"],serialize:e=>this.fieldExtensions.toArray().map((t=>t.toJSON(e))).filter((e=>this._alwaysSerializeFieldExtensions||!(e&&2===Object.keys(e).length&&e.id&&e.field))),deserialize:e=>{e&&F(this.fieldExtensions,e,{onNew:(e,t)=>{this.fieldExtensions.add(n(e)?e:new S(e),t)},onMatch:(e,t,i,s)=>{n(t)||e.assignProperties(t),i!==s&&this.fieldExtensions.reorder(e,s)},onMissing:e=>{this._alwaysSerializeFieldExtensions&&this.fieldExtensions.remove(e)},equals:(e,t)=>n(t)?t===e:!(!t?.field||!S.matchesRef(e,t.field))||e.id===t.id})}},types:{serialize:!1,deserialize:e=>{if(!e)return;const t=e.map((e=>v(e)?e:a.toEsriApiFeatureType(e)));F(this.types,t,{onNew:(e,t)=>{this.types.add(e,t)},onMatch:(e,t,i,s)=>{e!==t&&(e.name=t.name,e.templates=t.templates?[...t.templates]:[],e.domains=t.domains),i!==s&&this.types.reorder(e,s)},onMissing:e=>{this.types.remove(e)},equals:(e,t)=>e.id===t.id})}},timeZone:{serialize:!1,deserialize:e=>{e&&(this.timeZone=e)}}}}};A=e=t([f],A);export{A as Schema};class j extends _{get _createFieldLookup(){return this._collection.reduce(((e,t)=>(e.add(t),e)),new WeakSet)}get _expressionFieldsLength(){return this.expressionFields.length}get expressionFields(){if(!this._popupTemplate?.fieldInfos||!this._popupTemplate?.expressionInfos)return new y;const e=new y;for(const t of this._popupTemplate.fieldInfos){const i=t.fieldName.match(fieldWithArcadeXRegex);if(i){const o=this._popupTemplate.expressionInfos.find((e=>e.name===i[1]));if(o){if(!E.has(t)){const e=new s({name:t.fieldName,alias:t.label||o.title||t.fieldName,type:"number"===o.returnType?"double":"string",editable:!1});E.set(t,e)}e.add(E.get(t))}}}return e}get _collection(){return this._schema._fields.concat(this.expressionFields)}get _popupTemplate(){return this._schema._featureSettings?this._schema._featureSettings.popupTemplate:void 0}constructor(e){super(),this._schema=e,z(this._schema,"_fields",(e=>{this.emit("change",e),this._fieldLookup=void 0})),e.watch("_fields.length",(()=>this.notifyChange("length")))}includes(e){return this._fieldLookup=this._fieldLookup??this._createFieldLookup,this._fieldLookup.has(e)}clone(){return new j(this._schema)}add(e,t){g("field",e).isNotMissing(),this._fieldLookup=void 0;const i=e.name?e.name.match(fieldWithArcadeXRegex):void 0;if(i){if(!this._popupTemplate)throw new l("Cannot create a field that references an arcade expression without a feature source and popup template.");const t=this._popupTemplate.expressionInfos.find((e=>e.name===i[1]));if(!t)throw new l("Cannot create a field that references a non-existent arcade expression.");this._popupTemplate.fieldInfos||(this._popupTemplate.fieldInfos=[]);let s=this._popupTemplate.fieldInfos.find((t=>t.fieldName===e.name));s||(s=new o({fieldName:e.name,label:t.title}),this._popupTemplate.fieldInfos.push(s));const n=E.get(s);E.set(s,e);const r={added:[e],moved:[],removed:n?[n]:[],target:this};this.emit("change",r),this.notifyChange("length"),this.notifyChange("_expressionFieldsLength")}else this._schema._fields.add(e,t);return this}removeAt(e){g("index",e).isNotMissing();const t=this.getItemAt(e);if(!t)return;this._fieldLookup=void 0;if(t.name?t.name.match(fieldWithArcadeXRegex):void 0){const e=this._popupTemplate.fieldInfos.findIndex((e=>e.fieldName===t.name));this._popupTemplate.fieldInfos.splice(e,1);const i={added:[],moved:[],removed:[t],target:this};this.emit("change",i),this.notifyChange("length"),this.notifyChange("_expressionFieldsLength")}else this._schema._fields.remove(t);return t}reorder(e,t){if(e&&this._schema._fields.includes(e))return this._schema._fields.reorder(e,t),e}sort(e){return this._schema._fields.sort(e),this}}class N extends h{get _collection(){return this._schema.fields.map((e=>this._forField(e))).concat(Array.from(this._uninitializedFieldExtensions))}constructor(e){super(),this._uninitializedFieldExtensions=new Set,this._schema=e,z(this._schema,"fields",(e=>{const t={added:(e.added||[]).map((e=>this._forField(e))),moved:(e.moved||[]).map((e=>this._forField(e))),removed:(e.removed||[]).map((e=>this._forField(e))),target:this};this.emit("change",t)})),e.watch("fields.length",(()=>this.notifyChange("length")))}forField(e){if(g("field",e).isNotMissing(),this._schema.fields.includes(e))return this._forField(e)}add(e,t){if(g("fieldX",e).isNotMissing(),e.schema&&e.schema.fieldExtensions.remove(e),e._setSchema(this._schema),e.field){const i=I.get(e.field);if(I.set(e.field,e),i&&i!==e&&this._onRemoved(i),this._schema.fields.includes(e.field))if(void 0===t){const t={added:[e],moved:[],removed:i?[i]:[],target:this};this.emit("change",t)}else this._schema.fields.reorder(e.field,t);else this._schema.fields.add(e.field,t)}else{this._uninitializedFieldExtensions.add(e);const t={added:[e],moved:[],removed:[],target:this};this.emit("change",t)}return this._onAdded(e),this}removeAt(e){const t=this.getItemAt(e);if(void 0!==t){if(this._uninitializedFieldExtensions.has(t)){this._uninitializedFieldExtensions.delete(t);const e={added:[],moved:[],removed:[t],target:this};this.emit("change",e)}else this._schema.fields.remove(t.field);return this._onRemoved(t),t}}reorder(e,t){if(e&&this._schema.fields.includes(e.field))return this._schema.fields.reorder(e.field,t),e}sort(e){return this._schema.fields.sort(((t,i)=>e(this._forField(t),this._forField(i)))),this}_itemIsInitialized(e){return super._itemIsInitialized(e)&&!!e.field}_onAdded(e){}_onRemoved(e){e.schema===this._schema&&e._setSchema(void 0)}_forField(e){if(this._uninitializedFieldExtensions.size)for(const e of this._uninitializedFieldExtensions)e._resolveField(),e.field&&(I.set(e.field,e),this._uninitializedFieldExtensions.delete(e));if(!I.has(e)){const t=new S({field:e});I.set(e,t),t._setSchema(this._schema),this._onAdded(t)}return I.get(e)}}
package/data/Table.js CHANGED
@@ -1 +1 @@
1
- import PortalItem from"@arcgis/core/portal/PortalItem";import{LayerDefinition}from"../portal/LayerDefinition.js";import{PopupInfo}from"../portal/PopupInfo.js";import{checkArg}from"../utilities/checkArg.js";export async function toEsriApiTable(e){const i=new((await import("@arcgis/core/layers/FeatureLayer")).default);return await applyToEsriTable(e,i),i}export async function applyToEsriTable(e,i){checkArg("tableJson",e).isNotMissing(),checkArg("table",i).isNotMissing(),checkArg("tableJson.$tableType",e.$tableType).satisfies((e=>"ArcGISServiceTable"===e||void 0===e)),e.hasOwnProperty("id")&&(i.id=e.id),e.hasOwnProperty("title")&&(i.title=e.title),e.hasOwnProperty("url")&&(i.url=e.url),e.hasOwnProperty("itemId")&&(i.portalItem=new PortalItem({id:e.itemId})),e.hasOwnProperty("popupInfo")&&(i.popupTemplate=PopupInfo.toEsriApiPopupTemplate(e.popupInfo)),e.hasOwnProperty("layerDefinition")&&await LayerDefinition.applyToEsriApiLayer(e.layerDefinition,i)}export function fromEsriTable(e){checkArg("table",e).isNotMissing();const i={layerDefinition:LayerDefinition.fromEsriApiLayer(e)};return i.id=e.id,i.$tableType="ArcGISServiceTable",e.title&&(i.title=e.title),e.url&&(i.url=e.url),e.portalItem?.id&&(i.itemId=e.portalItem.id),e.popupTemplate&&(i.popupInfo=PopupInfo.fromEsriApiPopupTemplate(e.popupTemplate)),e.objectIdField&&(i.layerDefinition.objectIdField=e.objectIdField),i}
1
+ import e from"@arcgis/core/portal/PortalItem";import{LayerDefinition as t}from"../portal/LayerDefinition.js";import{PopupInfo as i}from"../portal/PopupInfo.js";import{checkArg as r}from"../utilities/checkArg.js";export async function toEsriApiTable(e){const t=new((await import("@arcgis/core/layers/FeatureLayer")).default);return await applyToEsriTable(e,t),t}export async function applyToEsriTable(o,p){r("tableJson",o).isNotMissing(),r("table",p).isNotMissing(),r("tableJson.$tableType",o.$tableType).satisfies((e=>"ArcGISServiceTable"===e||void 0===e)),o.hasOwnProperty("id")&&(p.id=o.id),o.hasOwnProperty("title")&&(p.title=o.title),o.hasOwnProperty("url")&&(p.url=o.url),o.hasOwnProperty("itemId")&&(p.portalItem=new e({id:o.itemId})),o.hasOwnProperty("popupInfo")&&(p.popupTemplate=i.toEsriApiPopupTemplate(o.popupInfo)),o.hasOwnProperty("layerDefinition")&&await t.applyToEsriApiLayer(o.layerDefinition,p)}export function fromEsriTable(e){r("table",e).isNotMissing();const o={layerDefinition:t.fromEsriApiLayer(e)};return o.id=e.id,o.$tableType="ArcGISServiceTable",e.title&&(o.title=e.title),e.url&&(o.url=e.url),e.portalItem?.id&&(o.itemId=e.portalItem.id),e.popupTemplate&&(o.popupInfo=i.fromEsriApiPopupTemplate(e.popupTemplate)),e.objectIdField&&(o.layerDefinition.objectIdField=e.objectIdField),o}
@@ -1 +1 @@
1
- import{TableExtension}from"./_TableExtension.js";import{DefaultTableExtensionFactory}from"./support/DefaultTableExtensionFactory.js";export{TableExtension}from"./_TableExtension.js";TableExtension.factory=DefaultTableExtensionFactory.instance;
1
+ import{TableExtension as o}from"./_TableExtension.js";import{DefaultTableExtensionFactory as t}from"./support/DefaultTableExtensionFactory.js";export{TableExtension}from"./_TableExtension.js";o.factory=t.instance;
@@ -1 +1 @@
1
- import{__decorate}from"tslib";import{serializable}from"../support/Serializable.js";import{Settings}from"../support/Settings.js";let TaskSettings=class extends Settings{get enableExport(){return this._getSetting("enableExport",!0)}set enableExport(e){this._setSetting("enableExport",e)}get enableIdentify(){return this._getSetting("enableIdentify",!0)}set enableIdentify(e){this._setSetting("enableIdentify",e)}get enableQuery(){return this._getSetting("enableQuery",!0)}set enableQuery(e){this._setSetting("enableQuery",e)}get enableSearch(){return this._getSetting("enableSearch",!0)}set enableSearch(e){this._setSetting("enableSearch",e)}get enableAdd(){return this._getSetting("enableAdd",!0)}set enableAdd(e){this._setSetting("enableAdd",e)}get enableUpdate(){return this._getSetting("enableUpdate",!0)}set enableUpdate(e){this._setSetting("enableUpdate",e)}get enableDelete(){return this._getSetting("enableDelete",!0)}set enableDelete(e){this._setSetting("enableDelete",e)}get enableEditing(){return this._getSetting("enableEditing",!0)}set enableEditing(e){this._setSetting("enableEditing",e)}_getSerializableProperties(){return{enableAdd:"initial",enableDelete:"initial",enableEditing:"initial",enableExport:"initial",enableIdentify:"initial",enableQuery:"initial",enableSearch:"initial",enableUpdate:"initial"}}};TaskSettings=__decorate([serializable],TaskSettings);export{TaskSettings};
1
+ import{__decorate as e}from"tslib";import{serializable as t}from"../support/Serializable.js";import{Settings as n}from"../support/Settings.js";let i=class extends n{get enableExport(){return this._getSetting("enableExport",!0)}set enableExport(e){this._setSetting("enableExport",e)}get enableIdentify(){return this._getSetting("enableIdentify",!0)}set enableIdentify(e){this._setSetting("enableIdentify",e)}get enableQuery(){return this._getSetting("enableQuery",!0)}set enableQuery(e){this._setSetting("enableQuery",e)}get enableSearch(){return this._getSetting("enableSearch",!0)}set enableSearch(e){this._setSetting("enableSearch",e)}get enableAdd(){return this._getSetting("enableAdd",!0)}set enableAdd(e){this._setSetting("enableAdd",e)}get enableUpdate(){return this._getSetting("enableUpdate",!0)}set enableUpdate(e){this._setSetting("enableUpdate",e)}get enableDelete(){return this._getSetting("enableDelete",!0)}set enableDelete(e){this._setSetting("enableDelete",e)}get enableEditing(){return this._getSetting("enableEditing",!0)}set enableEditing(e){this._setSetting("enableEditing",e)}_getSerializableProperties(){return{enableAdd:"initial",enableDelete:"initial",enableEditing:"initial",enableExport:"initial",enableIdentify:"initial",enableQuery:"initial",enableSearch:"initial",enableUpdate:"initial"}}};i=e([t],i);export{i as TaskSettings};
@@ -71,7 +71,7 @@ export declare namespace Relationship {
71
71
  /**
72
72
  * The cardinality of the Relationship.
73
73
  */
74
- export declare type Cardinality = "one-to-one" | "one-to-many" | "many-to-one" | "many-to-many";
74
+ export type Cardinality = "one-to-one" | "one-to-many" | "many-to-one" | "many-to-many";
75
75
  /**
76
76
  * Converts Geodatabase Relationship Cardinality type to the ESRI JS API
77
77
  * Cardinality type.
@@ -89,8 +89,8 @@ export declare function fromEsriApiCardinality(type: string): GeodatabaseCardina
89
89
  /**
90
90
  * Relationship cardinality type values for Geodatabase tables.
91
91
  */
92
- export declare type GeodatabaseCardinality = "esriRelCardinalityOneToOne" | "esriRelCardinalityOneToMany" | "esriRelCardinalityManyToOne" | "esriRelCardinalityManyToMany";
92
+ export type GeodatabaseCardinality = "esriRelCardinalityOneToOne" | "esriRelCardinalityOneToMany" | "esriRelCardinalityManyToOne" | "esriRelCardinalityManyToMany";
93
93
  /**
94
94
  * The type of the Relationship.
95
95
  */
96
- export declare type RelationshipType = "QueryBasedRelationship" | "ArcGISRelationship" | string;
96
+ export type RelationshipType = "QueryBasedRelationship" | "ArcGISRelationship" | string;
@@ -1 +1 @@
1
- import{InvalidOperationError}from"../InvalidOperationError.js";import{assertNever}from"../utilities/checkArg.js";export var Relationship;!function(e){e.create=function(r){if(!e.factory)throw new InvalidOperationError("Cannot create relationship: no relationship factory has been registered.");return e.factory.create(r)}}(Relationship||(Relationship={}));export function toEsriApiCardinality(e){if(!e)return;return!!toGeodatabaseCardinality(e)?e:fromGeodatabaseCardinality(e,new Error("Unknown relationship cardinality type."))}export function fromEsriApiCardinality(e){if(!e)return;return!!fromGeodatabaseCardinality(e)?e:toGeodatabaseCardinality(e,new Error("Unknown relationship cardinality type."))}function fromGeodatabaseCardinality(e,r){const a=e;switch(a){case"esriRelCardinalityOneToOne":return"one-to-one";case"esriRelCardinalityOneToMany":return"one-to-many";case"esriRelCardinalityManyToOne":return"many-to-one";case"esriRelCardinalityManyToMany":return"many-to-many";default:return assertNever(a,r)}}function toGeodatabaseCardinality(e,r){const a=e;switch(a){case"one-to-one":return"esriRelCardinalityOneToOne";case"one-to-many":return"esriRelCardinalityOneToMany";case"many-to-one":return"esriRelCardinalityManyToOne";case"many-to-many":return"esriRelCardinalityManyToMany";default:return assertNever(a,r)}}
1
+ import{InvalidOperationError as n}from"../InvalidOperationError.js";import{assertNever as e}from"../utilities/checkArg.js";export var Relationship;!function(e){e.create=function(r){if(!e.factory)throw new n("Cannot create relationship: no relationship factory has been registered.");return e.factory.create(r)}}(Relationship||(Relationship={}));export function toEsriApiCardinality(n){if(!n)return;return!!t(n)?n:r(n,new Error("Unknown relationship cardinality type."))}export function fromEsriApiCardinality(n){if(!n)return;return!!r(n)?n:t(n,new Error("Unknown relationship cardinality type."))}function r(n,r){const t=n;switch(t){case"esriRelCardinalityOneToOne":return"one-to-one";case"esriRelCardinalityOneToMany":return"one-to-many";case"esriRelCardinalityManyToOne":return"many-to-one";case"esriRelCardinalityManyToMany":return"many-to-many";default:return e(t,r)}}function t(n,r){const t=n;switch(t){case"one-to-one":return"esriRelCardinalityOneToOne";case"one-to-many":return"esriRelCardinalityOneToMany";case"many-to-one":return"esriRelCardinalityManyToOne";case"many-to-many":return"esriRelCardinalityManyToMany";default:return e(t,r)}}
@@ -1 +1 @@
1
- import{__decorate}from"tslib";import Collection from"@arcgis/core/core/Collection";import{InvalidOperationError}from"../InvalidOperationError.js";import{ItemType}from"../ItemType.js";import{applyToEsriTable,fromEsriTable,toEsriApiTable}from"../portal/Table.js";import{serializable}from"../support/Serializable.js";import{CollectionProxy}from"../utilities/CollectionProxy.js";import{isFeatureLayer,isLayer}from"../utilities/_layers.js";import{checkArg}from"../utilities/checkArg.js";import{deepClone}from"../utilities/object.js";import{FeatureSettings}from"./FeatureSettings.js";import{FeatureSourceBase}from"./FeatureSourceBase.js";import{Schema}from"./Schema.js";const ERR_INVALID_TABLE_TYPE="Invalid type of table for this type of table extension.",ERR_SPATIAL_SETTINGS_NOT_SUPPORTED="Spatial settings are not supported for tables.",DEFAULT_CAPABILITIES=Object.freeze({supportsAdd:!1,supportsUpdate:!1,supportsDelete:!1,supportsEditing:!1,supportsQuery:!1,supportsAttachmentEditing:!1});export class TableExtension extends FeatureSourceBase{constructor(e){super(e),this._itemType=ItemType.TABLE_EXTENSION;const{table:t}={...this.getDefaults(),...e};if(isLayer(t))checkArg("properties.table",t).satisfies((e=>isFeatureLayer(e)),ERR_INVALID_TABLE_TYPE),this._setTable(t);else{if(!t)throw new Error("Missing 'table' property.");this._deferredTableProperties=t}}get mapExtension(){return this._mapExtension}get table(){return this._table}get capabilities(){return DEFAULT_CAPABILITIES}get title(){return this.table?.title??this._deferredTableProperties?.title??("string"==typeof this._deferredTableProperties?.$ref?this._deferredTableProperties?.$ref:this._deferredTableProperties?.$ref?.title??this._deferredTableProperties?.$ref?.id)??"Table"}static create(e){if(!TableExtension.factory)throw new InvalidOperationError("Cannot create table extension: no table extension factory has been registered.");return TableExtension.factory.create(e)}static _matchesRef(e,t){if(!e||!t)return!1;const i=e.table?.id??e._deferredTableProperties.id,r=e.table?.title??e._deferredTableProperties.title,s=t.$ref;return"string"==typeof s?i===s||r===s:!!s&&(i===s.id||r===s.title)}async _createBackingTable(){this.table||this._deferredTableProperties&&this._deferredTableProperties.$ref||(this._setTable(await toEsriApiTable(this._deferredTableProperties)),await this.table.load(),checkArg("properties.table",this.table).satisfies((e=>this._isSupportedTable(e)),ERR_INVALID_TABLE_TYPE),this._deferredTableProperties=void 0)}_setMapExtension(e){const t=this.mapExtension;this._mapExtension=e,t&&this.featureSettings.formatSettings.parent===t.formatSettings&&(this.featureSettings.formatSettings.parent=void 0),e&&(this.featureSettings.formatSettings.parent||(this.featureSettings.formatSettings.parent=e.formatSettings)),this._resolveTable(),this.notifyChange("mapExtension")}_resolveTable(){if(this._table||!this._deferredTableProperties||!this.mapExtension)return;let e;e="string"==typeof this._deferredTableProperties.$ref?{id:this._deferredTableProperties.$ref,title:this._deferredTableProperties.$ref}:this._deferredTableProperties.$ref;let t=this._mapExtension.map?.tables.find((t=>t.id===e.id));if(t||(t=this._mapExtension.map?.tables.find((t=>t.title===e.title))),t&&this._isSupportedTable(t)){this._setTable(t);const e={table:this._deferredTableProperties};this.assignProperties(e),this._originalRef=this._deferredTableProperties.$ref,this._deferredTableProperties=void 0}}_getSerializableProperties(){return{...super._getSerializableProperties(),table:{serializeModes:["initial","project"],serialize:()=>this.table?this._mapExtension&&(this.table.id||this.table.title)?this._originalRef?{$ref:this._originalRef}:{$ref:{id:this.table.id,title:this.table.title}}:fromEsriTable(this.table):this._deferredTableProperties?deepClone(this._deferredTableProperties):void 0,deserialize:e=>{if(isLayer(e)){if(e!==this.table)throw new Error("Property 'table' is read-only.")}else this.table?applyToEsriTable(e,this.table):this._deferredTableProperties&&(this._deferredTableProperties={...this._deferredTableProperties,...e})}}}}async _onInitialize(){if(await super._onInitialize(),await this._createBackingTable(),this._resolveTable(),!this.table){const e=this._deferredTableProperties.$ref;throw this._mapExtension?new InvalidOperationError(`No table found matching reference "${e?.toString()}".`):new InvalidOperationError("Cannot resolve table reference: missing parent map extension.")}await this.table.load()}_createSchema(){return new TableSchema(this)}_createFeatureSettings(){return new TableFeatureSettings}_setTable(e){this._table=e,this.notifyChange("table"),this.notifyChange("title"),this.notifyChange("capabilities")}}let TableSchema=class extends Schema{constructor(e){if(super(),this._tableBindings=new Map,this._tableExtension=e,this._bindSettingToTableProperty("primaryKeyField","objectIdField"),this._fieldCollection=this._createFieldCollection(),e.table)this._onTableResolved(e.table);else{const t=e.watch("table",(()=>{this._onTableResolved(e.table),t.remove()}),!0)}}get _fields(){return this._fieldCollection}get geometryType(){}set geometryType(e){throw new InvalidOperationError("Tables do not support a geometry type.")}get spatialReference(){}set spatialReference(e){throw new InvalidOperationError("Tables do not support a spatial reference.")}_getSetting(e,t){return this._tableBindings.has(e)&&this._tableExtension.table?this._tableExtension.table[this._tableBindings.get(e)]:super._getSetting(e,t)}_setSetting(e,t){this._tableBindings.has(e)&&this._tableExtension.table?this._tableExtension.table[this._tableBindings.get(e)]=t:super._setSetting(e,t)}_bindSettingToTableProperty(e,t){const i=t??e;this._tableBindings.set(e,i),this._tableExtension.watch(`table.${i}`,(()=>this.notifyChange(e)),!0)}_onTableResolved(e){for(const t of this._tableBindings.keys())this.isModified(t)&&(e[t]=this[t],this.reset(t))}_createFieldCollection(){return new FieldCollection(this._tableExtension)}};TableSchema=__decorate([serializable],TableSchema);export{TableSchema};class FieldCollection extends CollectionProxy{constructor(e){super(),this._tableResolved=!1;if(e.table?.fields)this._onTableResolved(e.table);else{this._collection=new Collection;const t=e.watch(["table","table.loaded"],(()=>{e.table?.fields&&(this._onTableResolved(e.table),t.remove())}),!0)}}_onTableResolved(e){if(!this._tableResolved){this._tableResolved=!0;const t=e;this.length&&(t.fields.length=0,t.fields.push(...this.toArray())),t.fields||(t.fields=[]),this._collection=wrapArrayWithCollection(t.fields)}}}function wrapArrayWithCollection(e){const t=new Collection;return Object.defineProperty(t,"_items",{get:()=>e}),Object.defineProperty(t,"length",{get:()=>e.length,set:t=>e.length=t}),t}let TableFeatureSettings=class extends FeatureSettings{get returnGeometry(){}set returnGeometry(e){throw new InvalidOperationError(ERR_SPATIAL_SETTINGS_NOT_SUPPORTED)}get outSpatialReference(){}set outSpatialReference(e){throw new InvalidOperationError(ERR_SPATIAL_SETTINGS_NOT_SUPPORTED)}get maxAllowableOffset(){}set maxAllowableOffset(e){throw new InvalidOperationError(ERR_SPATIAL_SETTINGS_NOT_SUPPORTED)}get zoomScale(){}set zoomScale(e){throw new InvalidOperationError(ERR_SPATIAL_SETTINGS_NOT_SUPPORTED)}get zoomFactor(){}set zoomFactor(e){throw new InvalidOperationError(ERR_SPATIAL_SETTINGS_NOT_SUPPORTED)}};TableFeatureSettings=__decorate([serializable],TableFeatureSettings);export{TableFeatureSettings};
1
+ import{__decorate as e}from"tslib";import t from"@arcgis/core/core/Collection";import{InvalidOperationError as i}from"../InvalidOperationError.js";import{ItemType as s}from"../ItemType.js";import{applyToEsriTable as r,fromEsriTable as a,toEsriApiTable as o}from"../portal/Table.js";import{serializable as l}from"../support/Serializable.js";import{CollectionProxy as n}from"../utilities/CollectionProxy.js";import{isFeatureLayer as h,isLayer as b}from"../utilities/_layers.js";import{checkArg as p}from"../utilities/checkArg.js";import{deepClone as d}from"../utilities/object.js";import{FeatureSettings as f}from"./FeatureSettings.js";import{FeatureSourceBase as _}from"./FeatureSourceBase.js";import{Schema as c}from"./Schema.js";const g="Invalid type of table for this type of table extension.",m="Spatial settings are not supported for tables.",T=Object.freeze({supportsAdd:!1,supportsUpdate:!1,supportsDelete:!1,supportsEditing:!1,supportsQuery:!1,supportsAttachmentEditing:!1});export class TableExtension extends _{get mapExtension(){return this._mapExtension}get table(){return this._table}get capabilities(){return T}get title(){return this.table?.title??this._deferredTableProperties?.title??("string"==typeof this._deferredTableProperties?.$ref?this._deferredTableProperties?.$ref:this._deferredTableProperties?.$ref?.title??this._deferredTableProperties?.$ref?.id)??"Table"}constructor(e){super(e),this._itemType=s.TABLE_EXTENSION;const{table:t}={...this.getDefaults(),...e};if(b(t))p("properties.table",t).satisfies((e=>h(e)),g),this._setTable(t);else{if(!t)throw new Error("Missing 'table' property.");this._deferredTableProperties=t}}static create(e){if(!TableExtension.factory)throw new i("Cannot create table extension: no table extension factory has been registered.");return TableExtension.factory.create(e)}static _matchesRef(e,t){if(!e||!t)return!1;const i=e.table?.id??e._deferredTableProperties.id,s=e.table?.title??e._deferredTableProperties.title,r=t.$ref;return"string"==typeof r?i===r||s===r:!!r&&(i===r.id||s===r.title)}async _createBackingTable(){this.table||this._deferredTableProperties?.$ref||(this._setTable(await o(this._deferredTableProperties)),await this.table.load(),p("properties.table",this.table).satisfies((e=>this._isSupportedTable(e)),g),this._deferredTableProperties=void 0)}_setMapExtension(e){const t=this.mapExtension;this._mapExtension=e,t&&this.featureSettings.formatSettings.parent===t.formatSettings&&(this.featureSettings.formatSettings.parent=void 0),e&&(this.featureSettings.formatSettings.parent||(this.featureSettings.formatSettings.parent=e.formatSettings)),this._resolveTable(),this.notifyChange("mapExtension")}_resolveTable(){if(this._table||!this._deferredTableProperties||!this.mapExtension)return;let e;e="string"==typeof this._deferredTableProperties.$ref?{id:this._deferredTableProperties.$ref,title:this._deferredTableProperties.$ref}:this._deferredTableProperties.$ref;let t=this._mapExtension.map?.tables.find((t=>t.id===e.id));if(t||(t=this._mapExtension.map?.tables.find((t=>t.title===e.title))),t&&this._isSupportedTable(t)){this._setTable(t);const e={table:this._deferredTableProperties};this.assignProperties(e),this._originalRef=this._deferredTableProperties.$ref,this._deferredTableProperties=void 0}}_getSerializableProperties(){return{...super._getSerializableProperties(),table:{serializeModes:["initial","project"],serialize:()=>this.table?this._mapExtension&&(this.table.id||this.table.title)?this._originalRef?{$ref:this._originalRef}:{$ref:{id:this.table.id,title:this.table.title}}:a(this.table):this._deferredTableProperties?d(this._deferredTableProperties):void 0,deserialize:e=>{if(b(e)){if(e!==this.table)throw new Error("Property 'table' is read-only.")}else this.table?r(e,this.table):this._deferredTableProperties&&(this._deferredTableProperties={...this._deferredTableProperties,...e})}}}}async _onInitialize(){if(await super._onInitialize(),await this._createBackingTable(),this._resolveTable(),!this.table){const e=this._deferredTableProperties.$ref;throw this._mapExtension?new i(`No table found matching reference "${e?.toString()}".`):new i("Cannot resolve table reference: missing parent map extension.")}await this.table.load()}_createSchema(){return new u(this)}_createFeatureSettings(){return new y}_setTable(e){this._table=e,this.notifyChange("table"),this.notifyChange("title"),this.notifyChange("capabilities")}}let u=class extends c{constructor(e){if(super(),this._tableBindings=new Map,this._tableExtension=e,this._bindSettingToTableProperty("primaryKeyField","objectIdField"),this._fieldCollection=this._createFieldCollection(),e.table)this._onTableResolved(e.table);else{const t=e.watch("table",(()=>{this._onTableResolved(e.table),t.remove()}),!0)}}get _fields(){return this._fieldCollection}get geometryType(){}set geometryType(e){throw new i("Tables do not support a geometry type.")}get spatialReference(){}set spatialReference(e){throw new i("Tables do not support a spatial reference.")}_getSetting(e,t){return this._tableBindings.has(e)&&this._tableExtension.table?this._tableExtension.table[this._tableBindings.get(e)]:super._getSetting(e,t)}_setSetting(e,t){this._tableBindings.has(e)&&this._tableExtension.table?this._tableExtension.table[this._tableBindings.get(e)]=t:super._setSetting(e,t)}_bindSettingToTableProperty(e,t){const i=t??e;this._tableBindings.set(e,i),this._tableExtension.watch(`table.${i}`,(()=>this.notifyChange(e)),!0)}_onTableResolved(e){for(const t of this._tableBindings.keys())this.isModified(t)&&(e[t]=this[t],this.reset(t))}_createFieldCollection(){return new w(this._tableExtension)}};u=e([l],u);export{u as TableSchema};class w extends n{constructor(e){super(),this._tableResolved=!1;if(e.table?.fields)this._onTableResolved(e.table);else{this._collection=new t;const i=e.watch(["table","table.loaded"],(()=>{e.table?.fields&&(this._onTableResolved(e.table),i.remove())}),!0)}}_onTableResolved(e){if(!this._tableResolved){this._tableResolved=!0;const i=e;this.length&&(i.fields.length=0,i.fields.push(...this.toArray())),i.fields||(i.fields=[]),this._collection=function(e){const i=new t;return Object.defineProperty(i,"_items",{get:()=>e}),Object.defineProperty(i,"length",{get:()=>e.length,set:t=>e.length=t}),i}(i.fields)}}}let y=class extends f{get returnGeometry(){}set returnGeometry(e){throw new i(m)}get outSpatialReference(){}set outSpatialReference(e){throw new i(m)}get maxAllowableOffset(){}set maxAllowableOffset(e){throw new i(m)}get zoomScale(){}set zoomScale(e){throw new i(m)}get zoomFactor(){}set zoomFactor(e){throw new i(m)}};y=e([l],y);export{y as TableFeatureSettings};
package/data/convert.js CHANGED
@@ -1 +1 @@
1
- import Point from"@arcgis/core/geometry/Point";import SpatialReference from"@arcgis/core/geometry/SpatialReference";import{translate}from"../locale/language.js";import{toEsriApiGeometry,toPortalGeometry}from"../portal/Geometry.js";import{checkArg,assertNever}from"../utilities/checkArg.js";import{parse as parseDate,format as formatDate,DEFAULT_PARSING_FORMATS,DateFormat,INVALID_DATE}from"../utilities/date.js";import{esriToWKT,esriToGeoJSON,geoJSONToEsri,wktToEsri,esriWkidToWkt,esriWktToWkid,project,isPoint,isMultipoint,isPolyline,isPolygon,isExtent}from"../utilities/geometry.js";import{getLogger}from"../utilities/log.js";import{parse as parseNumber,format as formatNumber,NumberFormat,isNumeric}from"../utilities/number.js";import{Feature}from"./Feature.js";import{FeatureSet}from"./FeatureSet.js";const FORMULA_TRIGGER_CHARS=["=","-","+","@"],QUOTE='"',FIELD_NAME_REGEX=/[^a-zA-Z\d_]/g,DEFAULT_WINDOWS_ROW_DELIMITER="\r\n",DEFAULT_UNIX_ROW_DELIMITER="\n",DEFAULT_SHEET_NAME="sheet1",DEFAULT_EXCEL_DATE_FORMATS=[...DEFAULT_PARSING_FORMATS.map(_convertToExcelDateFormatString),"M/d/yy"],shapefileNameRegex=/(\w+)_(point|multipoint|polyline|polygon)z?/;var DBaseTypes;function _getConvertLogger(){return getLogger("geocortex.api.data.convert")}!function(e){e.DATE="D",e.NUMBER="N",e.STRING="C",e.BOOLEAN="L"}(DBaseTypes||(DBaseTypes={}));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 async function toCsv(e,t){checkArg("featureSet",e).isNotMissing();const r=Array.from(e),o={...{useFormattedValues:!1,alwaysQuote:!1,escapeFormulaChars:!0,delimiter:",",dateFormat:DateFormat.ROUND_TRIP,geometryFormat:r.some((e=>void 0!==e.geometry&&null!==e.geometry))?GeometryFormat.WKT:GeometryFormat.NONE,includeByteOrderMark:!0,outSpatialReference:SpatialReference.WGS84,includeHeaderRow:!0,outFields:_getDefaultOutFields(e.source),rowDelimiter:navigator.platform.startsWith("Win")?"\r\n":"\n"},...t},{includeByteOrderMark:a,includeHeaderRow:n,delimiter:s,outFields:i,rowDelimiter:m}=o,u=[];a&&u.push("\ufeff");const l=_getGeometryColumns(r,o),c=_getAttributeColumns(r,i,e.schema,!0),f=_getAttributeColumns(r,i,e.schema,!1);if(n){const e=[];for(const t of l)e.push(_quotify(t,o));for(const t of c)e.push(_quotify(t,o));for(const t of f)e.push(_quotify(t,o));const t=e.join(s)+m;u.push(t)}await Promise.all(r.map((async e=>{const t=[],r=(t,r)=>_quotify(_stringify(_getAttributeValue(e,t,r),r),r);t.push(...await _getCSVGeometry(e.geometry,o)),t.push(...c.map((e=>r(e,o)))),t.push(...f.map((e=>r(e,o))));const a=`${t.join(s)}${m}`;u.push(a)})));return new Blob(u,{type:"text/plain",endings:"\n"===m||"\r\n"===m?"transparent":"native"})}export async function csvToFeatureSet(e,t){let r;if(checkArg("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={...{delimiter:",",escapeFormulaChars:!0,includeHeaderRow:!0,outFields:["*"],inSpatialReference:SpatialReference.WGS84,generatePrimaryKey:!0,primaryKeyField:"OBJECTID"},...t,detectOid:!t?.primaryKeyField},a=_parseCSV(r,o.rowDelimiter||_parseRowDelimiter(r),o.delimiter),n=_parseGeometries(a,o),s=_parseSchema(a,n,o),i=await _parseFeatures(a,n,s,o);return new FeatureSet({features:i,schema:s})}export async function toXLSX(e,t){checkArg("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:_getDefaultOutFields(e.source),outSpatialReference:SpatialReference.WGS84,dateFormat:DateFormat.DEFAULT,numberFormat:NumberFormat.DEFAULT,sheetName:"sheet1"},...t},{outFields:a,includeHeaderRow:n,numberFormat:s}=o,i=[],m=_getGeometryColumns(r,o),u=_getAttributeColumns(r,a,e.schema,!0),l=_getAttributeColumns(r,a,e.schema,!1);if(n){const t=m.concat(u).concat(_getXlsxColumnName(l,e.source));i.push(t)}await Promise.all(r.map((async e=>{const t=[];t.push(...await _getGeometry(e.geometry,o));for(const r of u){const a=_toXLSXValue(e.attributes.get(r),o);t.push(a)}for(const r of l){const a=_toXLSXValue(_getAttributeValue(e,r,o),o);t.push(a)}t.every((e=>"string"!=typeof e||e.length<=32767))?i.push(t):_getConvertLogger().warn(`toXLSX cell limit exceeded, feature (${e.primaryKey??e.id}) omitted.`)})));const c=await import("xlsx"),f={SheetNames:[],Sheets:{}},p=c.utils.aoa_to_sheet(i,{cellDates:!0});for(const e of Object.keys(p).filter((e=>!e.startsWith("!")))){const t=p[e];"d"===t.t?t.z=_convertToExcelDateFormatString(o.dateFormat??DateFormat.ROUND_TRIP):"n"===t.t&&(t.z=_convertToExcelNumberFormatString(s))}f.SheetNames.push(o.sheetName),f.Sheets[o.sheetName]=p;const y=c.write(f,{type:"binary",bookType:"xlsx",compression:!0,bookSST:!0,cellDates:!0}),d=new Uint8Array(y.length);for(let e=0;e<y.length;e++)d[e]=y.charCodeAt(e);return new Blob([d.buffer],{type:"text/plain"})}export async function xlsxToFeatureSet(e,t){checkArg("xlsxData",e).isNotMissing();const r={...{includeHeaderRow:!0,escapeFormulaChars:!0,outFields:["*"],inSpatialReference:SpatialReference.WGS84,generatePrimaryKey:!0,primaryKeyField:"OBJECTID"},...t,detectOid:!t?.primaryKeyField},o=await _parseXLSX(e,r),a=_parseGeometries(o,r),n=_parseSchema(o,a,r),s=await _parseFeatures(o,a,n,r);return new FeatureSet({features:s,schema:n})}export async function toShapefile(e,t){checkArg("featureSet",e).isNotMissing();const[{default:r},o]=await Promise.all([import("jszip"),import("../forked-libs/shp-write/index.js")]),a=Array.from(e),n={...{useFormattedValues:!1,outFields:_getDefaultOutFields(e.source),fileName:e.title||"export"},...t},{outFields:s,outSpatialReference:i,fileName:m}=n,u=e=>e.geometry.hasZ||e.geometry.hasM,l=new Map,c=a.filter((e=>isPoint(e.geometry)));l.set("POINTZ",c.filter(u)),l.set("POINT",c.filter((e=>!u(e))));const f=a.filter((e=>isMultipoint(e.geometry)));l.set("MULTIPOINTZ",f.filter(u)),l.set("MULTIPOINT",f.filter((e=>!u(e))));const p=a.filter((e=>isPolyline(e.geometry)));l.set("POLYLINEZ",p.filter(u)),l.set("POLYLINE",p.filter((e=>!u(e))));const y=a.filter((e=>isPolygon(e.geometry)||isExtent(e.geometry)));l.set("POLYGONZ",y.filter(u)),l.set("POLYGON",y.filter((e=>!u(e))));const d=_getAttributeColumns(a,s,e.schema,!0);let g=_getAttributeColumns(a,s,e.schema,!1);g=d.concat(g);const h=new r,F=Array.from(l.keys()).filter((e=>l.get(e).length>0));await Promise.all(F.map((async t=>{const r=l.get(t),a=await Promise.all(r.map((e=>_projectGeometry(e.geometry,i)))),s=await _getDBaseSpatialReferenceWKT(a),u=n.useFormattedValues?Object.assign({},...g.map((e=>({[e]:DBaseTypes.STRING})))):_getDBaseColumnTypes(r,g,e.schema,"timestamp"===n.dateFormat),c=_getDBaseGeometries(a),f=_getDbaseValues(r,g,u,n);o.write(f,t,c,((e,r)=>{const o=F.length>1?`${m}_${t.toLowerCase()}`:m;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 _=await h.generateAsync({type:"uint8array"});return new Blob([_.buffer],{type:"text/plain"})}export async function shapefileToFeatureSet(e,t){checkArg("shapefileData",e).isNotMissing();const r={outFields:["*"],includeHeaderRow:!0,generatePrimaryKey:!0,primaryKeyField:"OBJECTID",...t,detectOid:!t?.primaryKeyField},o=new Promise(((t,r)=>{const o=new FileReader;o.onload=()=>{t(o.result)},o.onerror=()=>{r(o.error)},o.readAsArrayBuffer(e)})),[{default:a},{default:n}]=await Promise.all([import("jszip"),import("shpjs")]),s=await o,i=await a.loadAsync(new Uint8Array(s)),m=i.filter((()=>!0)).map((e=>e.name));let u,l=m.filter((e=>e.endsWith(".shp"))).map((e=>e.substring(0,e.length-4)));if(l=_parseShapefileNames(l),m.some((e=>e.endsWith(".prj")))&&!l.every((e=>m.includes(`${e}.prj`))))throw new Error("Shapefile zip must contain the same prj file for each separate shapefile");await Promise.all(m.filter((e=>e.endsWith(".prj"))).map((async e=>{const t=await i.file(e).async("string");if(u){if(t!==u)throw new Error("Shapefile zip must contain the same prj file for each separate shapefile")}else u=t})));const c={geometries:[],columnCount:0,columnIndex:0};let f=[];for(const e of l){if(!m.includes(`${e}.shx`)||!m.includes(`${e}.dbf`))throw new Error("Shapefile must contain shp, shx, and dbf files.");const t=await i.file(`${e}.shp`).async("uint8array"),r=n.parseShp(t),o=await i.file(`${e}.dbf`).async("uint8array"),a=n.parseDbf(o);if(a.length!==r.length)throw new Error("Shapefile must contain shp, shx, and dbf files.");const s=await Promise.all(r.map((e=>_parseShpGeometry(e,u))));c.geometries=c.geometries.concat(s),f=f.concat(a)}const p=_parseDBaseData(f),y=_parseSchema(p,c,r),d=await _parseFeatures(p,c,y,r);return new FeatureSet({features:d,schema:y})}function _getGeometryColumns(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 _getAttributeColumns(e,t,r,o){const a=r.fields.filter((e=>"oid"===e.type)).map((e=>e.name)).toArray();if(o)return a;if(t&&!t.includes("*"))return t.filter((e=>!a.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)||a.includes(e)||o.includes(e)||o.push(e);return o=o.sort(),t.concat(o)}}function _getXlsxColumnName(e,t){const r=t?.schema?.fieldExtensions.initializedItems.map((e=>e.field));return e.map((e=>r?.find((t=>t.name===e))?.alias??e))}function _getDefaultOutFields(e){if(!e)return["*"];const t=e.featureSettings.popupTemplate?.content;return(Array.isArray(t)?t.find((e=>"fields"===e.type))?.fieldInfos?.filter((e=>e.visible))?.map((e=>e.fieldName)):void 0)??e.featureSettings.popupTemplate?.fieldInfos?.filter((e=>e.visible))?.map((e=>e.fieldName))??["*"]}async function _getCSVGeometry(e,t){let r=await _getGeometry(e,t);return t.geometryFormat!==GeometryFormat.XYZ&&t.geometryFormat!==GeometryFormat.XY&&t.geometryFormat!==GeometryFormat.LAT_LON||(r=r.map((e=>void 0===e?"":_stringify(e,t)))),r.map((e=>""===e?"":_quotify(e,t)))}async function _getGeometry(e,t){const r=await _projectGeometry(e,t.outSpatialReference);if(t.geometryFormat===GeometryFormat.XYZ){if(!r)return["","",""];if(!isPoint(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(!isPoint(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(!isPoint(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(toPortalGeometry(r))]:[""]:t.geometryFormat===GeometryFormat.WKT?r?[esriToWKT(r)]:[""]:t.geometryFormat===GeometryFormat.GEO_JSON?r?[JSON.stringify(esriToGeoJSON(r))]:[""]:[]}async function _projectGeometry(e,t){return e?.spatialReference&&!e.spatialReference.equals(t)&&t?(await project([e],t))[0]:e}function _quotify(e,t){const r=[t.delimiter,'"',"\r","\n",t.rowDelimiter];if(t.alwaysQuote||r.some((t=>e.includes(t)))){return`"${e.replace(new RegExp('"',"g"),'""')}"`}return e}function _stringify(e,t){if(null==e)return"";if(!t.useFormattedValues){if("number"==typeof e){const r=t.numberFormat||NumberFormat.ROUND_TRIP;return formatNumber(r,e)}if(e instanceof Date)return"timestamp"===t.dateFormat?e.getTime().toString():formatDate({format:t.dateFormat,timeZone:"UTC"},e)}let r=e.toString();return t.escapeFormulaChars&&(r=escapeFormulaChars(r)),r}function _getAttributeValue(e,t,r){if(r.useFormattedValues||_hasCodedDomain(e,t))return e.presentableAttributes.get(t)??e.attributes.get(t);if("date"===e.schema.findFieldByName(t)?.type){const r=parseDate(e.attributes.get(t));if(!isNaN(r.getTime()))return r}return e.attributes.get(t)??e.presentableAttributes.get(t)}function _hasCodedDomain(e,t){return t===e.schema.typeIdField||("coded-value"===e.type?.domains?.[t]?.type||"coded-value"===e.schema.findFieldByName(t)?.domain?.type)}function escapeFormulaChars(e){for(const t of FORMULA_TRIGGER_CHARS)if(e.startsWith(t))return`\t${e}`;return e}function _parseRowDelimiter(e){let t="\n";return _forDelimiter(e,"\r\n",((r,o)=>(0===r&&o===e.length||(t="\r\n"),!1))),t}function _parseCSV(e,t,r){const o=[];if(_forDelimiter(e,t,((t,a)=>{const n=e.substring(t,a);return n.length>0&&o.push(((e,t)=>{const o=[];return _forDelimiter(e,r,((r,a)=>{const n=e.substring(r,a);return o.push({raw:_parseQuotes(n,t,o.length)}),!0})),o})(n,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}function _parseQuotes(e,t,r){const o=e.startsWith('"'),a=e.endsWith('"');if(o&&!a||!o&&a)throw new Error(`Detected invalid CSV: Missing opening or closing quote for value at row:${t} column:${r}`);const n=o?e.substring('"'.length,e.length-'"'.length):e;let s=-1;return _forDelimiter(n,'"',((e,o)=>{if(o===n.length)return!0;if(s<0){if(o!==n.length)return s=o,!0}else if(o===s+'"'.length)return s=-1,!0;throw new Error(`Detected invalid CSV: Non-escaped quote for value at row:${t} column:${r}`)})),n.replace(new RegExp('""',"g"),'"')}function _forDelimiter(e,t,r){let o,a=!1,n=0,s=0;for(;o=e.indexOf(t,n),!(o<0);){for(let t=n;t<o;)e.substring(t).startsWith('"')?(a=!a,t+='"'.length):t++;const i=o+t.length;if(!a){const e=r(s,o);if(s=i,!e)break}n=i}r(s,e.length)}const geometryTypeHeaders={[GeometryFormat.XYZ]:[["x","y","z"]],[GeometryFormat.XY]:[["x","y"]],[GeometryFormat.LAT_LON]:[["lat","lon"],["lat","long"],["latitude","longitude"]],[GeometryFormat.ARCGIS_JSON]:[["geometry"]],[GeometryFormat.GEO_JSON]:[["geometry"]],[GeometryFormat.WKT]:[["geometry"]]};function _parseArcGisJson(e,t){const r=JSON.parse(e),o=toEsriApiGeometry(r);return r.spatialReference||(o.spatialReference=t),o}function _parseGeoJson(e,t){const r=geoJSONToEsri(JSON.parse(e));return r.spatialReference=t,r}function _parseWkt(e,t){const r=wktToEsri(e);return r.spatialReference=t,r}function _findGeometryFormatIndex(e,t){const r=geometryTypeHeaders[t];for(const t of r){const r=e.findIndex(((r,o)=>!(o+t.length>e.length)&&t.every(((t,r)=>e[o+r].raw.toString().toLowerCase()===t))));if(-1!==r)return r}}function _detectGeometry(e,t){return e.map(((e,r)=>{const o=e?.raw;if("string"==typeof o&&""!==o)try{return t(o,void 0),r}catch{return}})).find((e=>void 0!==e))}function _parseGeometries(e,t){const r=t.includeHeaderRow?e.slice(1):e;if(t.geometryFormat===GeometryFormat.NONE)return{columnCount:0,columnIndex:0};const o=(e,o)=>{const a=o===GeometryFormat.XYZ,n=o===GeometryFormat.LAT_LON,s=a?3:2;return{columnCount:s,columnIndex:e,geometries:r.map((r=>{if(r.length>=e+s&&isNumeric(r[e+0].raw)&&isNumeric(r[e+1].raw)&&(!a||isNumeric(r[e+2].raw)))return new Point({x:parseNumber(n?r[e+1].raw:r[e+0].raw),y:parseNumber(n?r[e+0].raw:r[e+1].raw),z:a?parseNumber(r[e+2].raw):0,spatialReference:t.inSpatialReference})}))}},a=(e,o)=>({columnCount:1,columnIndex:e,geometries:r.map((t=>t[e])).map((e=>{if(""!==e.raw)return o(e.raw.toString(),t.inSpatialReference)}))});if(t.geometryFormat){const r=_findGeometryFormatIndex(e[0],t.geometryFormat);if(t.includeHeaderRow&&void 0===r)throw new Error(`Error parsing CSV: Expected geometry columns ${geometryTypeHeaders[t.geometryFormat][0].join(",")} are missing for GeometryType.${t.geometryFormat}`);return((e,t)=>{switch(t){case GeometryFormat.NONE:return{columnCount:0,columnIndex:0};case GeometryFormat.LAT_LON:case GeometryFormat.XYZ:case GeometryFormat.XY:return o(e,t);case GeometryFormat.ARCGIS_JSON:return a(e,_parseArcGisJson);case GeometryFormat.GEO_JSON:return a(e,_parseGeoJson);case GeometryFormat.WKT:return a(e,_parseWkt);default:return assertNever(t,new Error(`Unknown geometry format "${t}".`))}})(r??0,t.geometryFormat)}if(t.includeHeaderRow){const t=_findGeometryFormatIndex(e[0],GeometryFormat.ARCGIS_JSON);if(void 0!==t)for(const e of[_parseArcGisJson,_parseGeoJson,_parseWkt])try{return a(t,e)}catch(e){}const r=[GeometryFormat.XYZ,GeometryFormat.XY,GeometryFormat.LAT_LON];for(const t of r){const r=_findGeometryFormatIndex(e[0],t);if(void 0!==r)return o(r,t)}}for(const e of[_parseArcGisJson,_parseGeoJson,_parseWkt])try{const t=_detectGeometry(r[0],e);return a(t,e)}catch(e){}return{columnCount:0,columnIndex:0}}function _parseSchema(e,t,r){const o={fields:[]};let a=0;for(let s=0;s<e[0].length;s++){if(n=s,0!==t.columnCount&&n>=t.columnIndex&&n<t.columnIndex+t.columnCount)continue;const i=_parseFieldType(e,s,r);let m=e[0][s].raw.toString(),u=m.replace(FIELD_NAME_REGEX,"_");if(r.includeHeaderRow||(u="field"+ ++a,m=translate("gcx.api.data.convert.import-field-alias",a)),!u)throw new Error("Error parsing CSV or XLSX: Header cannot contain blank values");o.fields.push({alias:m,name:u,type:i})}var n;if(o.spatialReference=r.outSpatialReference,t.geometries?.length){const e=t.geometries.filter((e=>void 0!==e)).map((e=>e.type)),r=e[0];o.geometryType=e.every((e=>e===r))?r:void 0}if(r.generatePrimaryKey&&!o.fields.find((e=>"esriFieldTypeOID"===e.type))){const e=o.fields.length+1,t=!!o.fields.find((e=>"id"===e.name.toLowerCase()));o.fields.push({name:t?`field${e}`:"id",alias:t?translate("gcx.api.data.convert.import-field-alias",e):"id",type:"esriFieldTypeOID"})}return o}function _parseFieldType(e,t,r){let o=!1,a=!0,n=!0,s=!0;const i=new Set,m=r.includeHeaderRow?e[0]:[],u=r.includeHeaderRow?e.slice(1):e;for(const e of u){const m=e[t];""!==m.raw&&(i.add(m.raw),o=!0,a&&(a=isNumeric(m.raw)||Number.isNaN(m.raw)),n&&(n=m.raw instanceof Date||parseDate(r.dateFormat||DEFAULT_PARSING_FORMATS,m.raw)!==INVALID_DATE),s&&(s=parseDate(r.dateFormat||DEFAULT_EXCEL_DATE_FORMATS,m.formatted)!==INVALID_DATE))}const l=i.size===u.length;return r.primaryKeyField&&m[t]?.raw===r.primaryKeyField||r.detectOid&&o&&l&&a?(r.detectOid=!1,"esriFieldTypeOID"):o&&s?"esriFieldTypeDate":o&&a?"esriFieldTypeDouble":o&&n?"esriFieldTypeDate":"esriFieldTypeString"}async function _parseFeatures(e,t,r,o){const a=[],n=o.includeHeaderRow?e.slice(1):e,s=(e,r)=>0===t.columnCount||(r<t.columnIndex||r>=t.columnIndex+t.columnCount);return await Promise.all(n.map((async(e,n)=>{const i=new Feature;for(let t=0;t<r.fields.length;t++){const a=r.fields[t],m=e.filter(s);if(o.outFields.includes("*")||o.outFields.includes(a.name)){let e=await _parseValue(m[t]?.raw,a,o);"esriFieldTypeOID"===a.type&&null===e&&(e=n),i.attributes.set(a.name,e)}}t.geometries&&(i.geometry=await _projectGeometry(t.geometries[n],o.outSpatialReference)),a.push(i)}))),a}async function _parseValue(e,t,r){if("esriFieldTypeDouble"===t.type||"esriFieldTypeOID"===t.type)return"number"==typeof e?e:e?parseNumber(e):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:parseDate(e).getTime()}const o=e.toString();if(r.escapeFormulaChars&&o.startsWith("\t"))for(const e of FORMULA_TRIGGER_CHARS)if(o.length>1&&o.charAt(1)===e)return o.substring(1);return o}function _convertToExcelDateFormatString(e){switch(e){case DateFormat.DATE_SHORT:return"dd/MM/yyyy";case DateFormat.DATE_LONG:return"MMMM d, yyyy";case DateFormat.TIME_SHORT:return"h:mm AM/PM";case DateFormat.TIME_LONG:return"h:mm:ss AM/PM";case DateFormat.DATE_TIME_SHORT:case DateFormat.DEFAULT:return"MMM d yyyy h:mm AM/PM";case DateFormat.DATE_TIME_LONG:return"MMMM d yyyy h:mm AM/PM";case DateFormat.FULL:return"dddd, MMMM d yyyy h:mm AM/PM";case DateFormat.ISO_8601:case DateFormat.ROUND_TRIP:return'yyyy-MM-dd"T"HH:mm:ss';default:{const t=e.replace(/tt/g,"AM/PM");return t.includes("z")&&_getConvertLogger().warn("Warning: Excel will not recognize timezone format 'z', 'zz', or 'zzz'"),t.includes("h")&&!t.includes("AM/PM")&&_getConvertLogger().warn("Warning: Excel will interpret 'h' as 'H' if the format does not have an AM/PM designator"),t}}}function _convertToExcelNumberFormatString(e){switch(e){case NumberFormat.ACCOUNTING:return'_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)';case NumberFormat.CURRENCY:return'"$"#,##0.00';case NumberFormat.FIXED_POINT:case NumberFormat.DEFAULT:return"0.0000";case NumberFormat.NUMBER:return"#,##0.0000";case NumberFormat.PERCENT:return"0%";case NumberFormat.ROUND_TRIP:return"0.00000";default:return e}}function _toXLSXValue(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}let r=e.toString();return t.escapeFormulaChars&&(r=escapeFormulaChars(r)),r}async function _parseXLSX(e,t){const r=await import("xlsx"),o=new Promise(((o,a)=>{const n=new FileReader;n.onload=()=>{const e=new Uint8Array(n.result);let a="";for(const t of e)a+=String.fromCharCode(t);const s=r.read(a,{type:"binary",cellDates:!0}),i=t.sheetName||s.SheetNames[0],m=s.Sheets[i];o(m)},n.onerror=()=>{a(n.error)},n.readAsArrayBuffer(e)})),a=await o,n=r.utils.decode_range(a["!ref"]),s=[];for(let e=n.s.r;e<=n.e.r;e++){const t=[];for(let o=n.s.c;o<=n.e.c;o++){const n=a[`${r.utils.encode_cell({r:e,c:o})}`];t.push(n?{raw:n.v,formatted:"s"===n.t?void 0:n.w}:{raw:""})}s.push(t)}return s}async function _getDBaseSpatialReferenceWKT(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??esriWkidToWkt(t??SpatialReference.WGS84.wkid)}function _getDBaseColumnTypes(e,t,r,o){const a={};for(const n of t){if(e.some((e=>_hasCodedDomain(e,n)))){a[n]=DBaseTypes.STRING;continue}const t=r?r.fields.find((e=>e.name===n)):void 0;if(t){switch(t.type){case"oid":case"double":case"integer":case"single":case"small-integer":a[n]=DBaseTypes.NUMBER;break;case"date":a[n]=o?DBaseTypes.NUMBER:DBaseTypes.DATE;break;default:a[n]=DBaseTypes.STRING}continue}const s=(e,t)=>e.attributes.get(t)??e.presentableAttributes.get(t);e.every((e=>s(e,n)instanceof Date||void 0===s(e,n)))&&e.some((e=>s(e,n)instanceof Date))?a[n]=o?DBaseTypes.NUMBER:DBaseTypes.DATE:e.every((e=>"number"==typeof s(e,n)||void 0===s(e,n)))&&e.some((e=>"number"==typeof s(e,n)))?a[n]=DBaseTypes.NUMBER:e.every((e=>"boolean"==typeof s(e,n)||void 0===s(e,n)))&&e.some((e=>"boolean"==typeof s(e,n)))?a[n]=DBaseTypes.BOOLEAN:a[n]=DBaseTypes.STRING}return a}function _getDBaseGeometries(e){return e.map((e=>{if(isPoint(e)){const{x:t,y:r,z:o,m:a}=e,n=[t,r];return e.hasZ&&n.push(o),e.hasM&&n.push(a),_padZValues(n,e)}if(isMultipoint(e))return _padZValuesArray(e.points,e);if(isPolyline(e))return _padZValues2DArray(e.paths,e);if(isPolygon(e))return _padZValues2DArray(e.rings,e);if(isExtent(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.")}))}function _padZValues(e,t){return 3===e.length&&!t.hasZ&&t.hasM?[e[0],e[1],void 0,e[2]]:e}function _padZValuesArray(e,t){return e.map((e=>_padZValues(e,t)))}function _padZValues2DArray(e,t){return e.map((e=>_padZValuesArray(e,t)))}function _getDbaseValues(e,t,r,o){const a=[];for(const n of e){const e={};for(const a of t){let t=_getAttributeValue(n,a,o);if(null==t&&(t=""),o.useFormattedValues)t=t.toString();else{t=getDbaseValue(t,r[a],o)}e[a]=t}a.push(e)}return a}function getDbaseValue(e,t,r){switch(t){case DBaseTypes.NUMBER:return e instanceof Date?e.getTime():parseNumber(e);case DBaseTypes.STRING:return e instanceof Date?formatDate({format:r.dateFormat??DateFormat.ROUND_TRIP,timeZone:"UTC"},e):"number"==typeof e?formatNumber(r.numberFormat??NumberFormat.DEFAULT,e):e.toString();case DBaseTypes.BOOLEAN:return!!e;case DBaseTypes.DATE:return parseDate(e);default:return e.toString()}}function _parseShapefileNames(e){if(!e.length)return[];let t=e[0];const r=t.match(shapefileNameRegex);return r?(t=r[1],e.filter((e=>{const r=e.match(shapefileNameRegex);return r&&r[1]===t}))):[t]}function _parseDBaseData(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]})))))]}function _parseShpPointGeometry(e){checkArg("geometry.coordinates",e.type).matches("Point"),checkArg("geometry.coordinates",e.coordinates).satisfies((e=>"number"==typeof e||Array.isArray(e)));const[t,r,o]=e.coordinates,a=new Point({x:t,y:r,spatialReference:SpatialReference.WGS84});if(Array.isArray(o)){const[e,t]=o;!e&&!t||e?a.z=e:a.m=t}return a}async function _parseShpGeometry(e,t){const r=isPoint(e)?_parseShpPointGeometry(e):geoJSONToEsri(e);if(t){let e;try{const r=await esriWktToWkid(t);e=new SpatialReference({wkid:parseNumber(r)})}catch{}e||(e=new SpatialReference({wkt:t})),r.spatialReference=e}return r}
1
+ import e from"@arcgis/core/geometry/Point";import t from"@arcgis/core/geometry/SpatialReference";import{translate as r}from"../locale/language.js";import{toEsriApiGeometry as o,toPortalGeometry as n}from"../portal/Geometry.js";import{checkArg as a,assertNever as i}from"../utilities/checkArg.js";import{parse as s,format as m,DEFAULT_PARSING_FORMATS as c,DateFormat as l,INVALID_DATE as u}from"../utilities/date.js";import{esriToWKT as f,esriToGeoJSON as y,geoJSONToEsri as d,wktToEsri as p,esriWkidToWkt as g,esriWktToWkid as h,project as w,isPoint as F,isMultipoint as N,isPolyline as S,isPolygon as T,isExtent as O}from"../utilities/geometry.js";import{getLogger as R}from"../utilities/log.js";import{parse as G,format as b,NumberFormat as E,isNumeric as x}from"../utilities/number.js";import{Feature as A}from"./Feature.js";import{FeatureSet as M}from"./FeatureSet.js";const D=["=","-","+","@"],I='"',_=/[^a-zA-Z\d_]/g,v="\r\n",C="\n",L="sheet1",P=[...c.map(le),"M/d/yy"],$=/(\w+)_(point|multipoint|polyline|polygon)z?/;var U;function W(){return R("geocortex.api.data.convert")}!function(e){e.DATE="D",e.NUMBER="N",e.STRING="C",e.BOOLEAN="L"}(U||(U={}));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 async function toCsv(e,r){a("featureSet",e).isNotMissing();const o=Array.from(e),n={...{useFormattedValues:!1,alwaysQuote:!1,escapeFormulaChars:!0,delimiter:",",dateFormat:l.ROUND_TRIP,geometryFormat:o.some((e=>void 0!==e.geometry&&null!==e.geometry))?GeometryFormat.WKT:GeometryFormat.NONE,includeByteOrderMark:!0,outSpatialReference:t.WGS84,includeHeaderRow:!0,outFields:z(e.source),rowDelimiter:navigator.platform.startsWith("Win")?v:C},...r},{includeByteOrderMark:i,includeHeaderRow:s,delimiter:m,outFields:c,rowDelimiter:u}=n,f=[];i&&f.push("\ufeff");const y=X(o,n),d=j(o,c,e.schema,!0),p=j(o,c,e.schema,!1);if(s){const e=[];for(const t of y)e.push(k(t,n));for(const t of d)e.push(k(t,n));for(const t of p)e.push(k(t,n));const t=e.join(m)+u;f.push(t)}await Promise.all(o.map((async e=>{const t=[],r=(t,r)=>k(H(K(e,t,r),r),r);t.push(...await async function(e,t){let r=await Y(e,t);t.geometryFormat!==GeometryFormat.XYZ&&t.geometryFormat!==GeometryFormat.XY&&t.geometryFormat!==GeometryFormat.LAT_LON||(r=r.map((e=>void 0===e?"":H(e,t))));return r.map((e=>""===e?"":k(e,t)))}(e.geometry,n)),t.push(...d.map((e=>r(e,n)))),t.push(...p.map((e=>r(e,n))));const o=`${t.join(m)}${u}`;f.push(o)})));return new Blob(f,{type:"text/plain",endings:u===C||u===v?"transparent":"native"})}export async function csvToFeatureSet(e,r){let o;if(a("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)}));o=await t}else o=e;const n={...{delimiter:",",escapeFormulaChars:!0,includeHeaderRow:!0,outFields:["*"],inSpatialReference:t.WGS84,generatePrimaryKey:!0,primaryKeyField:"OBJECTID"},...r,detectOid:!r?.primaryKeyField},i=function(e,t,r){const o=[],n=(e,t)=>{const o=[];return q(e,r,((r,n)=>{const a=e.substring(r,n);return o.push({raw:V(a,t,o.length)}),!0})),o};if(q(e,t,((t,r)=>{const a=e.substring(t,r);return a.length>0&&o.push(n(a,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}(o,n.rowDelimiter||function(e){let t=C;return q(e,v,((r,o)=>(0===r&&o===e.length||(t=v),!1))),t}(o),n.delimiter),s=ae(i,n),m=ie(i,s,n),c=await me(i,s,m,n);return new M({features:c,schema:m})}export async function toXLSX(e,r){a("featureSet",e).isNotMissing();const o=Array.from(e),n={...{useFormattedValues:!1,includeHeaderRow:!0,escapeFormulaChars:!0,geometryFormat:o.some((e=>void 0!==e.geometry&&null!==e.geometry))?GeometryFormat.WKT:GeometryFormat.NONE,outFields:z(e.source),outSpatialReference:t.WGS84,dateFormat:l.DEFAULT,numberFormat:E.DEFAULT,sheetName:L},...r},{outFields:i,includeHeaderRow:s,numberFormat:m}=n,c=[],u=X(o,n),f=j(o,i,e.schema,!0),y=j(o,i,e.schema,!1);if(s){const t=u.concat(f).concat(function(e,t){const r=t?.schema?.fieldExtensions.initializedItems.map((e=>e.field));return e.map((e=>r?.find((t=>t.name===e))?.alias??e))}(y,e.source));c.push(t)}await Promise.all(o.map((async e=>{const t=[];t.push(...await Y(e.geometry,n));for(const r of f){const o=fe(e.attributes.get(r),n);t.push(o)}for(const r of y){const o=fe(K(e,r,n),n);t.push(o)}t.every((e=>"string"!=typeof e||e.length<=32767))?c.push(t):W().warn(`toXLSX cell limit exceeded, feature (${e.primaryKey??e.id}) omitted.`)})));const d=await import("xlsx"),p={SheetNames:[],Sheets:{}},g=d.utils.aoa_to_sheet(c,{cellDates:!0});for(const e of Object.keys(g).filter((e=>!e.startsWith("!")))){const t=g[e];"d"===t.t?t.z=le(n.dateFormat??l.ROUND_TRIP):"n"===t.t&&(t.z=ue(m))}p.SheetNames.push(n.sheetName),p.Sheets[n.sheetName]=g;const h=d.write(p,{type:"binary",bookType:"xlsx",compression:!0,bookSST:!0,cellDates:!0}),w=new Uint8Array(h.length);for(let e=0;e<h.length;e++)w[e]=h.charCodeAt(e);return new Blob([w.buffer],{type:"text/plain"})}export async function xlsxToFeatureSet(e,r){a("xlsxData",e).isNotMissing();const o={...{includeHeaderRow:!0,escapeFormulaChars:!0,outFields:["*"],inSpatialReference:t.WGS84,generatePrimaryKey:!0,primaryKeyField:"OBJECTID"},...r,detectOid:!r?.primaryKeyField},n=await async function(e,t){const r=await import("xlsx"),o=new Promise(((o,n)=>{const a=new FileReader;a.onload=()=>{const e=new Uint8Array(a.result);let n="";for(const t of e)n+=String.fromCharCode(t);const i=r.read(n,{type:"binary",cellDates:!0}),s=t.sheetName||i.SheetNames[0],m=i.Sheets[s];o(m)},a.onerror=()=>{n(a.error)},a.readAsArrayBuffer(e)})),n=await o,a=r.utils.decode_range(n["!ref"]),i=[];for(let e=a.s.r;e<=a.e.r;e++){const t=[];for(let o=a.s.c;o<=a.e.c;o++){const a=n[`${r.utils.encode_cell({r:e,c:o})}`];t.push(a?{raw:a.v,formatted:"s"===a.t?void 0:a.w}:{raw:""})}i.push(t)}return i}(e,o),i=ae(n,o),s=ie(n,i,o),m=await me(n,i,s,o);return new M({features:m,schema:s})}export async function toShapefile(e,r){a("featureSet",e).isNotMissing();const[{default:o},n]=await Promise.all([import("jszip"),import("../forked-libs/shp-write/index.js")]),i=Array.from(e),s={...{useFormattedValues:!1,outFields:z(e.source),fileName:e.title||"export"},...r},{outFields:m,outSpatialReference:c,fileName:l}=s,u=e=>e.geometry.hasZ||e.geometry.hasM,f=new Map,y=i.filter((e=>F(e.geometry)));f.set("POINTZ",y.filter(u)),f.set("POINT",y.filter((e=>!u(e))));const d=i.filter((e=>N(e.geometry)));f.set("MULTIPOINTZ",d.filter(u)),f.set("MULTIPOINT",d.filter((e=>!u(e))));const p=i.filter((e=>S(e.geometry)));f.set("POLYLINEZ",p.filter(u)),f.set("POLYLINE",p.filter((e=>!u(e))));const h=i.filter((e=>T(e.geometry)||O(e.geometry)));f.set("POLYGONZ",h.filter(u)),f.set("POLYGON",h.filter((e=>!u(e))));const w=j(i,m,e.schema,!0);let R=j(i,m,e.schema,!1);R=w.concat(R);const G=new o,b=Array.from(f.keys()).filter((e=>f.get(e).length>0));await Promise.all(b.map((async r=>{const o=f.get(r),a=await Promise.all(o.map((e=>B(e.geometry,c)))),i=await async function(e){const{wkid:r,wkt:o}=e[0].spatialReference;if(!e.every((e=>e.spatialReference.wkid===r&&e.spatialReference.wkt===o)))throw new Error("Cannot create shapefile that contains geometries with different spatial references.");return o??g(r??t.WGS84.wkid)}(a),m=s.useFormattedValues?Object.assign({},...R.map((e=>({[e]:U.STRING})))):function(e,t,r,o){const n={};for(const a of t){if(e.some((e=>Z(e,a)))){n[a]=U.STRING;continue}const t=r?r.fields.find((e=>e.name===a)):void 0;if(t){switch(t.type){case"oid":case"double":case"integer":case"single":case"small-integer":n[a]=U.NUMBER;break;case"date":n[a]=o?U.NUMBER:U.DATE;break;default:n[a]=U.STRING}continue}const i=(e,t)=>e.attributes.get(t)??e.presentableAttributes.get(t);e.every((e=>i(e,a)instanceof Date||void 0===i(e,a)))&&e.some((e=>i(e,a)instanceof Date))?n[a]=o?U.NUMBER:U.DATE:e.every((e=>"number"==typeof i(e,a)||void 0===i(e,a)))&&e.some((e=>"number"==typeof i(e,a)))?n[a]=U.NUMBER:e.every((e=>"boolean"==typeof i(e,a)||void 0===i(e,a)))&&e.some((e=>"boolean"==typeof i(e,a)))?n[a]=U.BOOLEAN:n[a]=U.STRING}return n}(o,R,e.schema,"timestamp"===s.dateFormat),u=function(e){return e.map((e=>{if(F(e)){const{x:t,y:r,z:o,m:n}=e,a=[t,r];return e.hasZ&&a.push(o),e.hasM&&a.push(n),ye(a,e)}if(N(e))return de(e.points,e);if(S(e))return pe(e.paths,e);if(T(e))return pe(e.rings,e);if(O(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.")}))}(a),y=function(e,t,r,o){const n=[];for(const a of e){const e={};for(const n of t){let t=K(a,n,o);if(null==t&&(t=""),o.useFormattedValues)t=t.toString();else{t=ge(t,r[n],o)}e[n]=t}n.push(e)}return n}(o,R,m,s);n.write(y,r,u,((e,t)=>{const o=b.length>1?`${l}_${r.toLowerCase()}`:l;G.file(`${o}.shp`,t.shp.buffer,{binary:!0}),G.file(`${o}.shx`,t.shx.buffer,{binary:!0}),G.file(`${o}.dbf`,t.dbf.buffer,{binary:!0}),G.file(`${o}.prj`,i)}))})));const E=await G.generateAsync({type:"uint8array"});return new Blob([E.buffer],{type:"text/plain"})}export async function shapefileToFeatureSet(e,t){a("shapefileData",e).isNotMissing();const r={outFields:["*"],includeHeaderRow:!0,generatePrimaryKey:!0,primaryKeyField:"OBJECTID",...t,detectOid:!t?.primaryKeyField},o=new Promise(((t,r)=>{const o=new FileReader;o.onload=()=>{t(o.result)},o.onerror=()=>{r(o.error)},o.readAsArrayBuffer(e)})),[{default:n},{default:i}]=await Promise.all([import("jszip"),import("shpjs")]),s=await o,m=await n.loadAsync(new Uint8Array(s)),c=m.filter((()=>!0)).map((e=>e.name));let l,u=c.filter((e=>e.endsWith(".shp"))).map((e=>e.substring(0,e.length-4)));if(u=function(e){if(!e.length)return[];let t=e[0];const r=t.match($);return r?(t=r[1],e.filter((e=>{const r=e.match($);return r&&r[1]===t}))):[t]}(u),c.some((e=>e.endsWith(".prj")))&&!u.every((e=>c.includes(`${e}.prj`))))throw new Error("Shapefile zip must contain the same prj file for each separate shapefile");await Promise.all(c.filter((e=>e.endsWith(".prj"))).map((async e=>{const t=await m.file(e).async("string");if(l){if(t!==l)throw new Error("Shapefile zip must contain the same prj file for each separate shapefile")}else l=t})));const f={geometries:[],columnCount:0,columnIndex:0};let y=[];for(const e of u){if(!c.includes(`${e}.shx`)||!c.includes(`${e}.dbf`))throw new Error("Shapefile must contain shp, shx, and dbf files.");const t=await m.file(`${e}.shp`).async("uint8array"),r=i.parseShp(t),o=await m.file(`${e}.dbf`).async("uint8array"),n=i.parseDbf(o);if(n.length!==r.length)throw new Error("Shapefile must contain shp, shx, and dbf files.");const a=await Promise.all(r.map((e=>he(e,l))));f.geometries=f.geometries.concat(a),y=y.concat(n)}const d=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),p=ie(d,f,r),g=await me(d,f,p,r);return new M({features:g,schema:p})}function X(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 j(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 z(e){if(!e)return["*"];const t=e.featureSettings.popupTemplate?.content;return(Array.isArray(t)?t.find((e=>"fields"===e.type))?.fieldInfos?.filter((e=>e.visible))?.map((e=>e.fieldName)):void 0)??e.featureSettings.popupTemplate?.fieldInfos?.filter((e=>e.visible))?.map((e=>e.fieldName))??["*"]}async function Y(e,t){const r=await B(e,t.outSpatialReference);if(t.geometryFormat===GeometryFormat.XYZ){if(!r)return["","",""];if(!F(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(!F(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(!F(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(n(r))]:[""]:t.geometryFormat===GeometryFormat.WKT?r?[f(r)]:[""]:t.geometryFormat===GeometryFormat.GEO_JSON?r?[JSON.stringify(y(r))]:[""]:[]}async function B(e,t){return e?.spatialReference&&!e.spatialReference.equals(t)&&t?(await w([e],t))[0]:e}function k(e,t){const r=[t.delimiter,I,"\r","\n",t.rowDelimiter];if(t.alwaysQuote||r.some((t=>e.includes(t)))){const t=e.replace(new RegExp(I,"g"),`${I}${I}`);return`${I}${t}${I}`}return e}function H(e,t){if(null==e)return"";if(!t.useFormattedValues){if("number"==typeof e){const r=t.numberFormat||E.ROUND_TRIP;return b(r,e)}if(e instanceof Date)return"timestamp"===t.dateFormat?e.getTime().toString():m({format:t.dateFormat,timeZone:"UTC"},e)}let r=e.toString();return t.escapeFormulaChars&&(r=J(r)),r}function K(e,t,r){if(r.useFormattedValues||Z(e,t))return e.presentableAttributes.get(t)??e.attributes.get(t);if("date"===e.schema.findFieldByName(t)?.type){const r=s(e.attributes.get(t));if(!isNaN(r.getTime()))return r}return e.attributes.get(t)??e.presentableAttributes.get(t)}function Z(e,t){return t===e.schema.typeIdField||("coded-value"===e.type?.domains?.[t]?.type||"coded-value"===e.schema.findFieldByName(t)?.domain?.type)}function J(e){for(const t of D)if(e.startsWith(t))return`\t${e}`;return e}function V(e,t,r){const o=e.startsWith(I),n=e.endsWith(I);if(o&&!n||!o&&n)throw new Error(`Detected invalid CSV: Missing opening or closing quote for value at row:${t} column:${r}`);const a=o?e.substring(I.length,e.length-I.length):e;let i=-1;return q(a,I,((e,o)=>{if(o===a.length)return!0;if(i<0){if(o!==a.length)return i=o,!0}else if(o===i+I.length)return i=-1,!0;throw new Error(`Detected invalid CSV: Non-escaped quote for value at row:${t} column:${r}`)})),a.replace(new RegExp(`${I}${I}`,"g"),I)}function q(e,t,r){let o,n=!1,a=0,i=0;for(;o=e.indexOf(t,a),!(o<0);){for(let t=a;t<o;)e.substring(t).startsWith(I)?(n=!n,t+=I.length):t++;const s=o+t.length;if(!n){const e=r(i,o);if(i=s,!e)break}a=s}r(i,e.length)}const Q={[GeometryFormat.XYZ]:[["x","y","z"]],[GeometryFormat.XY]:[["x","y"]],[GeometryFormat.LAT_LON]:[["lat","lon"],["lat","long"],["latitude","longitude"]],[GeometryFormat.ARCGIS_JSON]:[["geometry"]],[GeometryFormat.GEO_JSON]:[["geometry"]],[GeometryFormat.WKT]:[["geometry"]]};function ee(e,t){const r=JSON.parse(e),n=o(r);return r.spatialReference||(n.spatialReference=t),n}function te(e,t){const r=d(JSON.parse(e));return r.spatialReference=t,r}function re(e,t){const r=p(e);return r.spatialReference=t,r}function oe(e,t){const r=Q[t];for(const t of r){const r=e.findIndex(((r,o)=>!(o+t.length>e.length)&&t.every(((t,r)=>e[o+r].raw.toString().toLowerCase()===t))));if(-1!==r)return r}}function ne(e,t){return e.map(((e,r)=>{const o=e?.raw;if("string"==typeof o&&""!==o)try{return t(o,void 0),r}catch{return}})).find((e=>void 0!==e))}function ae(t,r){const o=r.includeHeaderRow?t.slice(1):t;if(r.geometryFormat===GeometryFormat.NONE)return{columnCount:0,columnIndex:0};const n=(t,n)=>{const a=n===GeometryFormat.XYZ,i=n===GeometryFormat.LAT_LON,s=a?3:2;return{columnCount:s,columnIndex:t,geometries:o.map((o=>{if(o.length>=t+s&&x(o[t+0].raw)&&x(o[t+1].raw)&&(!a||x(o[t+2].raw)))return new e({x:G(i?o[t+1].raw:o[t+0].raw),y:G(i?o[t+0].raw:o[t+1].raw),z:a?G(o[t+2].raw):0,spatialReference:r.inSpatialReference})}))}},a=(e,t)=>({columnCount:1,columnIndex:e,geometries:o.map((t=>t[e])).map((e=>{if(""!==e.raw)return t(e.raw.toString(),r.inSpatialReference)}))});if(r.geometryFormat){const e=oe(t[0],r.geometryFormat);if(r.includeHeaderRow&&void 0===e)throw new Error(`Error parsing CSV: Expected geometry columns ${Q[r.geometryFormat][0].join(",")} are missing for GeometryType.${r.geometryFormat}`);return((e,t)=>{switch(t){case GeometryFormat.NONE:return{columnCount:0,columnIndex:0};case GeometryFormat.LAT_LON:case GeometryFormat.XYZ:case GeometryFormat.XY:return n(e,t);case GeometryFormat.ARCGIS_JSON:return a(e,ee);case GeometryFormat.GEO_JSON:return a(e,te);case GeometryFormat.WKT:return a(e,re);default:return i(t,new Error(`Unknown geometry format "${t}".`))}})(e??0,r.geometryFormat)}if(r.includeHeaderRow){const e=oe(t[0],GeometryFormat.ARCGIS_JSON);if(void 0!==e)for(const t of[ee,te,re])try{return a(e,t)}catch(e){}const r=[GeometryFormat.XYZ,GeometryFormat.XY,GeometryFormat.LAT_LON];for(const e of r){const r=oe(t[0],e);if(void 0!==r)return n(r,e)}}for(const e of[ee,te,re])try{const t=ne(o[0],e);return a(t,e)}catch(e){}return{columnCount:0,columnIndex:0}}function ie(e,t,o){const n={fields:[]};let a=0;for(let s=0;s<e[0].length;s++){if(i=s,0!==t.columnCount&&i>=t.columnIndex&&i<t.columnIndex+t.columnCount)continue;const m=se(e,s,o);let c=e[0][s].raw.toString(),l=c.replace(_,"_");if(o.includeHeaderRow||(l="field"+ ++a,c=r("gcx.api.data.convert.import-field-alias",a)),!l)throw new Error("Error parsing CSV or XLSX: Header cannot contain blank values");n.fields.push({alias:c,name:l,type:m})}var i;if(n.spatialReference=o.outSpatialReference,t.geometries?.length){const e=t.geometries.filter((e=>void 0!==e)).map((e=>e.type)),r=e[0];n.geometryType=e.every((e=>e===r))?r:void 0}if(o.generatePrimaryKey&&!n.fields.find((e=>"esriFieldTypeOID"===e.type))){const e=n.fields.length+1,t=!!n.fields.find((e=>"id"===e.name.toLowerCase()));n.fields.push({name:t?`field${e}`:"id",alias:t?r("gcx.api.data.convert.import-field-alias",e):"id",type:"esriFieldTypeOID"})}return n}function se(e,t,r){let o=!1,n=!0,a=!0,i=!0;const m=new Set,l=r.includeHeaderRow?e[0]:[],f=r.includeHeaderRow?e.slice(1):e;for(const e of f){const l=e[t];""!==l.raw&&(m.add(l.raw),o=!0,n&&(n=x(l.raw)||Number.isNaN(l.raw)),a&&(a=l.raw instanceof Date||s(r.dateFormat||c,l.raw)!==u),i&&(i=s(r.dateFormat||P,l.formatted)!==u))}const y=m.size===f.length;return r.primaryKeyField&&l[t]?.raw===r.primaryKeyField||r.detectOid&&o&&y&&n?(r.detectOid=!1,"esriFieldTypeOID"):o&&i?"esriFieldTypeDate":o&&n?"esriFieldTypeDouble":o&&a?"esriFieldTypeDate":"esriFieldTypeString"}async function me(e,t,r,o){const n=[],a=o.includeHeaderRow?e.slice(1):e,i=(e,r)=>0===t.columnCount||(r<t.columnIndex||r>=t.columnIndex+t.columnCount);return await Promise.all(a.map((async(e,a)=>{const s=new A;for(let t=0;t<r.fields.length;t++){const n=r.fields[t],m=e.filter(i);if(o.outFields.includes("*")||o.outFields.includes(n.name)){let e=await ce(m[t]?.raw,n,o);"esriFieldTypeOID"===n.type&&null===e&&(e=a),s.attributes.set(n.name,e)}}t.geometries&&(s.geometry=await B(t.geometries[a],o.outSpatialReference)),n.push(s)}))),n}async function ce(e,t,r){if("esriFieldTypeDouble"===t.type||"esriFieldTypeOID"===t.type)return"number"==typeof e?e:e?G(e):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:s(e).getTime()}const o=e.toString();if(r.escapeFormulaChars&&o.startsWith("\t"))for(const e of D)if(o.length>1&&o.charAt(1)===e)return o.substring(1);return o}function le(e){switch(e){case l.DATE_SHORT:return"dd/MM/yyyy";case l.DATE_LONG:return"MMMM d, yyyy";case l.TIME_SHORT:return"h:mm AM/PM";case l.TIME_LONG:return"h:mm:ss AM/PM";case l.DATE_TIME_SHORT:case l.DEFAULT:return"MMM d yyyy h:mm AM/PM";case l.DATE_TIME_LONG:return"MMMM d yyyy h:mm AM/PM";case l.FULL:return"dddd, MMMM d yyyy h:mm AM/PM";case l.ISO_8601:case l.ROUND_TRIP:return'yyyy-MM-dd"T"HH:mm:ss';default:{const t=e.replace(/tt/g,"AM/PM");return t.includes("z")&&W().warn("Warning: Excel will not recognize timezone format 'z', 'zz', or 'zzz'"),t.includes("h")&&!t.includes("AM/PM")&&W().warn("Warning: Excel will interpret 'h' as 'H' if the format does not have an AM/PM designator"),t}}}function ue(e){switch(e){case E.ACCOUNTING:return'_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)';case E.CURRENCY:return'"$"#,##0.00';case E.FIXED_POINT:case E.DEFAULT:return"0.0000";case E.NUMBER:return"#,##0.0000";case E.PERCENT:return"0%";case E.ROUND_TRIP:return"0.00000";default:return e}}function fe(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}let r=e.toString();return t.escapeFormulaChars&&(r=J(r)),r}function ye(e,t){return 3===e.length&&!t.hasZ&&t.hasM?[e[0],e[1],void 0,e[2]]:e}function de(e,t){return e.map((e=>ye(e,t)))}function pe(e,t){return e.map((e=>de(e,t)))}function ge(e,t,r){switch(t){case U.NUMBER:return e instanceof Date?e.getTime():G(e);case U.STRING:return e instanceof Date?m({format:r.dateFormat??l.ROUND_TRIP,timeZone:"UTC"},e):"number"==typeof e?b(r.numberFormat??E.DEFAULT,e):e.toString();case U.BOOLEAN:return!!e;case U.DATE:return s(e);default:return e.toString()}}async function he(r,o){const n=F(r)?function(r){a("geometry.coordinates",r.type).matches("Point"),a("geometry.coordinates",r.coordinates).satisfies((e=>"number"==typeof e||Array.isArray(e)));const[o,n,i]=r.coordinates,s=new e({x:o,y:n,spatialReference:t.WGS84});if(Array.isArray(i)){const[e,t]=i;!e&&!t||e?s.z=e:s.m=t}return s}(r):d(r);if(o){let e;try{const r=await h(o);e=new t({wkid:G(r)})}catch{}e||(e=new t({wkt:o})),n.spatialReference=e}return n}
@@ -1 +1 @@
1
- import{ArgumentError}from"../../ArgumentError.js";import{ArcGISRelationship}from"../../tasks/query/ArcGISRelationship.js";import{QueryBasedRelationship}from"../../tasks/query/QueryBasedRelationship.js";import{checkArg}from"../../utilities/checkArg.js";export class DefaultRelationshipFactory{create(e){switch(checkArg("properties",e).isNotMissing(),checkArg("properties.$relationshipType",e.$relationshipType).isNotMissing(),e.$relationshipType){case"QueryBasedRelationship":return new QueryBasedRelationship(e);case"ArcGISRelationship":return new ArcGISRelationship(e)}throw new ArgumentError("properties.$relationshipType","Unsupported relationship type.")}}DefaultRelationshipFactory.instance=new DefaultRelationshipFactory;
1
+ import{ArgumentError as e}from"../../ArgumentError.js";import{ArcGISRelationship as i}from"../../tasks/query/ArcGISRelationship.js";import{QueryBasedRelationship as r}from"../../tasks/query/QueryBasedRelationship.js";import{checkArg as t}from"../../utilities/checkArg.js";export class DefaultRelationshipFactory{create(s){switch(t("properties",s).isNotMissing(),t("properties.$relationshipType",s.$relationshipType).isNotMissing(),s.$relationshipType){case"QueryBasedRelationship":return new r(s);case"ArcGISRelationship":return new i(s)}throw new e("properties.$relationshipType","Unsupported relationship type.")}}DefaultRelationshipFactory.instance=new DefaultRelationshipFactory;
@@ -1 +1 @@
1
- import{ArgumentError}from"../../ArgumentError.js";import{checkArg}from"../../utilities/checkArg.js";import{isFeatureLayer}from"../../utilities/layers.js";import{ArcGISServiceTableExtension}from"../ArcGISServiceTableExtension.js";export class DefaultTableExtensionFactory{create(e){if(checkArg("properties",e).isNotMissing(),checkArg("properties.table",e.table).isNotMissing(),isFeatureLayer(e.table))return new ArcGISServiceTableExtension(e);if(e.table.$tableType&&"ArcGISServiceTable"===e.table.$tableType)return new ArcGISServiceTableExtension(e);throw new ArgumentError("properties.table","Unable to determine correct type of table extension to create.")}}DefaultTableExtensionFactory.instance=new DefaultTableExtensionFactory;
1
+ import{ArgumentError as e}from"../../ArgumentError.js";import{checkArg as t}from"../../utilities/checkArg.js";import{isFeatureLayer as r}from"../../utilities/layers.js";import{ArcGISServiceTableExtension as i}from"../ArcGISServiceTableExtension.js";export class DefaultTableExtensionFactory{create(o){if(t("properties",o).isNotMissing(),t("properties.table",o.table).isNotMissing(),r(o.table))return new i(o);if(o.table.$tableType&&"ArcGISServiceTable"===o.table.$tableType)return new i(o);throw new e("properties.table","Unable to determine correct type of table extension to create.")}}DefaultTableExtensionFactory.instance=new DefaultTableExtensionFactory;
@@ -1 +1 @@
1
- import{ArgumentError}from"../../ArgumentError.js";import{InvalidOperationError}from"../../InvalidOperationError.js";import{isLayerExtension,isTableExtension}from"../../ItemType.js";import{DefaultArcGISRequestHelper}from"../../support/ArcGISRequestHelper.js";import{checkArg}from"../../utilities/checkArg.js";import{isFeatureLayerExtension,isSubtypeGroupLayerExtension,isSubtypeSublayerExtension}from"../../utilities/extensions.js";import{isFeatureLayer,isSubtypeGroupLayer,isSubtypeSublayer}from"../../utilities/layers.js";import{toGraphic}from"../Feature.js";const requestHelper=new DefaultArcGISRequestHelper;export async function toAttachmentFile(e,t){let r;if(e instanceof File)r=e;else if(e?.url)try{const t=await requestHelper.request(e.url,{responseType:"blob"});r=new File([t.data],e.title,{type:e.contentType})}catch(e){throw new Error(`${`${t} `??""}Failed to fetch attachment from url.`,{cause:e})}if(!r)throw new Error(`${`${t} `??""}No attachment data found.`);return r}export function supportsAttachments(e){if(isSubtypeSublayerExtension(e)){const t=e.sublayer?.layer;return isSubtypeGroupLayer(t)&&t.capabilities?.data?.supportsAttachment}return(isFeatureLayerExtension(e)||isSubtypeGroupLayerExtension(e))&&(isFeatureLayer(e.layer)||isSubtypeGroupLayer(e.layer))&&!!e.layer.capabilities?.data?.supportsAttachment}export function supportsAttachmentEditing(e){const t=isSubtypeSublayer(e)?e.layer:e;return(isFeatureLayer(t)||isSubtypeGroupLayer(t))&&!!t.capabilities?.data?.supportsAttachment&&(t.capabilities.operations?.supportsUpdate||t.capabilities.operations?.supportsAdd)}export async function addAttachment(e,t,r,a){if(checkArg("feature",e).isDefined(),checkArg("layer",t).isDefined(),checkArg("attachment",r).isDefined(),isLayerExtension(e.source)&&e.source.layer!==t||isTableExtension(e.source)&&e.source.table!==t)throw new ArgumentError("layer","The feature's source layer/table does not match the layer.");if(!supportsAttachmentEditing(t))throw new InvalidOperationError("Cannot add attachment; the Table does not support attachments.");const o=`Failed to add attachment to ${e.primaryKey??e.id} of source ${e.source?.title??e.source?.id}.`,s=await toAttachmentFile(r,o),n=s.name?.split(".").pop()?.toLowerCase();if(a?.attachmentTypes&&!isValidFileType(s,a.attachmentTypes))throw new ArgumentError("attachment",`The attachment type '${n}' does not exist in the set of accepted attachment types: ${a.attachmentTypes}.`);let i;const c=new FormData;c.append("attachment",s,s.name);try{const r=await t.addAttachment(toGraphic(e),c);if(r.error)throw new Error(r.error.message);i=`${r.objectId}`}catch(e){throw new Error(o,{cause:e})}return await e.fetchAttachments(),e.attachments.find((e=>e.id===i))}function isValidFileType(e,t){if(!t.map((e=>e.toLowerCase())).includes(e.type.toLowerCase())){const r=t.filter((e=>!e.includes("/"))).map((e=>e.toLowerCase())),a=e.name?.split(".").pop()?.toLowerCase();return r.includes(a)}return!0}export function isAttachmentTypeError(e){return ATTACHMENT_TYPE_ERROR_REGEX.test(e.message)}export const ATTACHMENT_TYPE_ERROR_REGEX=/^The attachment type .+ does not exist in the set of accepted attachment types: .+.$/;export async function deleteAttachments(e,t,r){if(checkArg("feature",e).isDefined(),checkArg("layer",t).isDefined(),checkArg("attachments",r).isDefined(),isLayerExtension(e.source)&&e.source.layer!==t||isTableExtension(e.source)&&e.source.table!==t)throw new ArgumentError("layer","The feature's source layer/table does not match the layer.");if(!supportsAttachmentEditing(t))throw new InvalidOperationError("Cannot delete attachments; the layer/table does not support attachments.");const a=`Failed to delete attachment(s) from ${e.primaryKey??e.id} of source ${e.source?.title??e.source?.id}.`;try{const a=await t.deleteAttachments(toGraphic(e),r.map((e=>"string"==typeof e?+e:+e.id)));if(a?.length>1){const e=a.filter((e=>e.error));if(e.length>0)throw new AggregateError(e.map((e=>new Error(e.error.message))))}else if(a?.[0].error)throw new Error(a?.[0].error.message)}catch(e){throw new Error(a,{cause:e})}await e.fetchAttachments()}
1
+ import{ArgumentError as t}from"../../ArgumentError.js";import{InvalidOperationError as e}from"../../InvalidOperationError.js";import{isLayerExtension as r,isTableExtension as a}from"../../ItemType.js";import{DefaultArcGISRequestHelper as o}from"../../support/ArcGISRequestHelper.js";import{checkArg as s}from"../../utilities/checkArg.js";import{isFeatureLayerExtension as n,isSubtypeGroupLayerExtension as i,isSubtypeSublayerExtension as c}from"../../utilities/extensions.js";import{isFeatureLayer as p,isSubtypeGroupLayer as m,isSubtypeSublayer as h}from"../../utilities/layers.js";import{toGraphic as l}from"../Feature.js";const u=new o;export async function toAttachmentFile(t,e){let r;if(t instanceof File)r=t;else if(t?.url)try{const e=await u.request(t.url,{responseType:"blob"});r=new File([e.data],t.title,{type:t.contentType})}catch(t){throw new Error(`${`${e} `??""}Failed to fetch attachment from url.`,{cause:t})}if(!r)throw new Error(`${`${e} `??""}No attachment data found.`);return r}export function supportsAttachments(t){if(c(t)){const e=t.sublayer?.layer;return m(e)&&e.capabilities?.data?.supportsAttachment}return(n(t)||i(t))&&(p(t.layer)||m(t.layer))&&!!t.layer.capabilities?.data?.supportsAttachment}export function supportsAttachmentEditing(t){const e=h(t)?t.layer:t;return(p(e)||m(e))&&!!e.capabilities?.data?.supportsAttachment&&(e.capabilities.operations?.supportsUpdate||e.capabilities.operations?.supportsAdd)}export async function addAttachment(o,n,i,c){if(s("feature",o).isDefined(),s("layer",n).isDefined(),s("attachment",i).isDefined(),r(o.source)&&o.source.layer!==n||a(o.source)&&o.source.table!==n)throw new t("layer","The feature's source layer/table does not match the layer.");if(!supportsAttachmentEditing(n))throw new e("Cannot add attachment; the Table does not support attachments.");const p=`Failed to add attachment to ${o.primaryKey??o.id} of source ${o.source?.title??o.source?.id}.`,m=await toAttachmentFile(i,p),h=m.name?.split(".").pop()?.toLowerCase();if(c?.attachmentTypes&&!function(t,e){if(!e.map((t=>t.toLowerCase())).includes(t.type.toLowerCase())){const r=e.filter((t=>!t.includes("/"))).map((t=>t.toLowerCase())),a=t.name?.split(".").pop()?.toLowerCase();return r.includes(a)}return!0}(m,c.attachmentTypes))throw new t("attachment",`The attachment type '${h}' does not exist in the set of accepted attachment types: ${c.attachmentTypes}.`);let u;const d=new FormData;d.append("attachment",m,m.name);try{const t=await n.addAttachment(l(o),d);if(t.error)throw new Error(t.error.message);u=`${t.objectId}`}catch(t){throw new Error(p,{cause:t})}return await o.fetchAttachments(),o.attachments.find((t=>t.id===u))}export function isAttachmentTypeError(t){return ATTACHMENT_TYPE_ERROR_REGEX.test(t.message)}export const ATTACHMENT_TYPE_ERROR_REGEX=/^The attachment type .+ does not exist in the set of accepted attachment types: .+.$/;export async function deleteAttachments(o,n,i){if(s("feature",o).isDefined(),s("layer",n).isDefined(),s("attachments",i).isDefined(),r(o.source)&&o.source.layer!==n||a(o.source)&&o.source.table!==n)throw new t("layer","The feature's source layer/table does not match the layer.");if(!supportsAttachmentEditing(n))throw new e("Cannot delete attachments; the layer/table does not support attachments.");const c=`Failed to delete attachment(s) from ${o.primaryKey??o.id} of source ${o.source?.title??o.source?.id}.`;try{const t=await n.deleteAttachments(l(o),i.map((t=>"string"==typeof t?+t:+t.id)));if(t?.length>1){const e=t.filter((t=>t.error));if(e.length>0)throw new AggregateError(e.map((t=>new Error(t.error.message))))}else if(t?.[0].error)throw new Error(t?.[0].error.message)}catch(t){throw new Error(c,{cause:t})}await o.fetchAttachments()}