@vertigis/arcgis-extensions 32.9.1 → 33.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 (407) hide show
  1. package/AppConfig.schema.json +5 -0
  2. package/Entity.d.ts +11 -3
  3. package/Entity.js +1 -1
  4. package/ItemType.d.ts +156 -30
  5. package/ItemType.js +1 -1
  6. package/LanguageResources.d.ts +1 -1
  7. package/LanguageResources.js +1 -1
  8. package/data/ArcGISServiceTableExtension.d.ts +1 -1
  9. package/data/ArcGISServiceTableExtension.js +1 -1
  10. package/data/Attachment.d.ts +1 -1
  11. package/data/Attachment.js +1 -1
  12. package/data/Feature.d.ts +4 -4
  13. package/data/Feature.js +1 -1
  14. package/data/FeatureList.d.ts +4 -0
  15. package/data/FeatureList.js +1 -1
  16. package/data/FeatureSet.d.ts +4 -0
  17. package/data/FeatureSet.js +1 -1
  18. package/data/FeatureSettings.d.ts +1 -1
  19. package/data/FeatureSettings.js +1 -1
  20. package/data/FeatureSourceBase.js +1 -1
  21. package/data/FeatureStream.d.ts +4 -4
  22. package/data/FeatureStream.js +1 -1
  23. package/data/FieldExtension.d.ts +4 -4
  24. package/data/FieldExtension.js +1 -1
  25. package/data/RelationshipBase.d.ts +7 -3
  26. package/data/RelationshipBase.js +1 -1
  27. package/data/Schema.d.ts +1 -1
  28. package/data/Schema.js +1 -1
  29. package/data/_Relationship.d.ts +6 -1
  30. package/data/_TableExtension.d.ts +2 -2
  31. package/data/_TableExtension.js +1 -1
  32. package/data/convert.js +1 -1
  33. package/docs/html/assets/js/search.js +1 -1
  34. package/docs/html/classes/data__tableextension.tableextension.html +93 -76
  35. package/docs/html/classes/data__tableextension.tablefeaturesettings.html +20 -20
  36. package/docs/html/classes/data__tableextension.tableschema.html +31 -31
  37. package/docs/html/classes/data_arcgisservicetableextension.arcgisservicetableextension.html +88 -74
  38. package/docs/html/classes/data_attachment.attachment.html +54 -37
  39. package/docs/html/classes/data_feature.feature.html +72 -55
  40. package/docs/html/classes/data_featurelist.featurelist.html +40 -13
  41. package/docs/html/classes/data_featureset.featureset.html +43 -16
  42. package/docs/html/classes/data_featuresettings.featuresettings.html +20 -20
  43. package/docs/html/classes/data_featuresourcebase.featuresourcebase.html +72 -45
  44. package/docs/html/classes/data_featuresourcebase.relationshipcollection.html +4 -4
  45. package/docs/html/classes/data_featurestream.featurestream.html +57 -40
  46. package/docs/html/classes/data_fieldextension.fieldextension.html +64 -47
  47. package/docs/html/classes/data_relationshipbase.relationshipbase.html +112 -61
  48. package/docs/html/classes/data_schema.schema.html +23 -23
  49. package/docs/html/classes/entity.entitybase.html +34 -7
  50. package/docs/html/classes/languageresources.languageresources-1.html +20 -20
  51. package/docs/html/classes/layer_preset_layerpreset.layerpreset.html +56 -39
  52. package/docs/html/classes/mapping__layerextension.arraywrappedcollection.html +4 -4
  53. package/docs/html/classes/mapping__layerextension.layerextension.html +129 -113
  54. package/docs/html/classes/mapping__layerextension.layerextensionschema.html +28 -28
  55. package/docs/html/classes/mapping__sublayerextension.sublayerextension.html +101 -85
  56. package/docs/html/classes/mapping__sublayerextension.sublayerschema.html +24 -24
  57. package/docs/html/classes/mapping__sublayerextension.subsublayerextensioncollection.html +6 -6
  58. package/docs/html/classes/mapping_arcgissublayerextension.arcgissublayerextension.html +81 -67
  59. package/docs/html/classes/mapping_arcgissublayerextension.arcgissublayerfeaturesettings.html +18 -18
  60. package/docs/html/classes/mapping_arcgissublayerextension.arcgissublayerrelationshipcollection.html +3 -3
  61. package/docs/html/classes/mapping_arcgissublayerextension.arcgissublayerschema.html +13 -13
  62. package/docs/html/classes/mapping_basemapextension.basemapextension.html +70 -54
  63. package/docs/html/classes/mapping_bookmark.bookmark.html +57 -36
  64. package/docs/html/classes/mapping_buildingcomponentsublayerextension.buildingcomponentsublayerextension.html +83 -69
  65. package/docs/html/classes/mapping_buildingcomponentsublayerextension.buildingcomponentsublayerschema.html +18 -18
  66. package/docs/html/classes/mapping_buildinggroupsublayerextension.buildinggroupsublayerextension.html +86 -72
  67. package/docs/html/classes/mapping_buildinggroupsublayerextension.buildinggroupsublayerschema.html +24 -24
  68. package/docs/html/classes/mapping_buildingscenelayerextension.buildingscenelayerextension.html +112 -98
  69. package/docs/html/classes/mapping_buildingscenelayerextension.buildingscenelayerreadonlyschema.html +26 -26
  70. package/docs/html/classes/mapping_buildingsublayerextension.buildingsublayerextension.html +91 -77
  71. package/docs/html/classes/mapping_buildingsublayerextension.buildingsublayerfeaturesettings.html +20 -20
  72. package/docs/html/classes/mapping_buildingsublayerextension.buildingsublayerschema.html +19 -19
  73. package/docs/html/classes/mapping_csvlayerextension.csvlayerextension.html +117 -103
  74. package/docs/html/classes/mapping_elevationlayerextension.elevationlayerextension.html +118 -104
  75. package/docs/html/classes/mapping_featurecollectionlayerextension.featurecollectionlayerextension.html +110 -96
  76. package/docs/html/classes/mapping_featurelayerextension.featurelayerextension.html +121 -107
  77. package/docs/html/classes/mapping_featurelayerextensionbase.featurelayerextensionbase.html +114 -100
  78. package/docs/html/classes/mapping_featurelayerextensionbase.featurelayerschema.html +25 -25
  79. package/docs/html/classes/mapping_georsslayerextension.georsslayerextension.html +117 -103
  80. package/docs/html/classes/mapping_graphicslayerextension.graphicslayerextension.html +112 -98
  81. package/docs/html/classes/mapping_groundextension.groundextension.html +59 -43
  82. package/docs/html/classes/mapping_grouplayerextension.grouplayerextension.html +110 -96
  83. package/docs/html/classes/mapping_grouplayerextension.grouplayerextensioncollection.html +13 -13
  84. package/docs/html/classes/mapping_imagerylayerextension.imagerylayerextension.html +115 -101
  85. package/docs/html/classes/mapping_imagerytilelayerextension.imagerytilelayerextension.html +115 -101
  86. package/docs/html/classes/mapping_integratedmeshlayerextension.integratedmeshlayerextension.html +119 -105
  87. package/docs/html/classes/mapping_kmllayerextension.kmllayerextension.html +113 -99
  88. package/docs/html/classes/mapping_kmlsublayerextension.kmlsublayerextension.html +89 -75
  89. package/docs/html/classes/mapping_mapextension.mapextension.html +106 -90
  90. package/docs/html/classes/mapping_mapimagelayerextension.mapimagelayerextension.html +115 -101
  91. package/docs/html/classes/mapping_mapimagesublayerextension.mapimagesublayerextension.html +80 -66
  92. package/docs/html/classes/mapping_openstreetmaplayerextension.openstreetmaplayerextension.html +120 -106
  93. package/docs/html/classes/mapping_pointcloudlayerextension.pointcloudlayerextension.html +116 -102
  94. package/docs/html/classes/mapping_scenelayerextension.scenelayerextension.html +115 -101
  95. package/docs/html/classes/mapping_streamlayerextension.streamlayerextension.html +116 -102
  96. package/docs/html/classes/mapping_streamlayerextension.streamlayerschema.html +26 -26
  97. package/docs/html/classes/mapping_support__layerextensioncollection.layerextensioncollectionbase.html +19 -19
  98. package/docs/html/classes/mapping_support_layerlistsettings.extensionbaselayerlistsettings.html +3 -3
  99. package/docs/html/classes/mapping_tilelayerextension.tilelayerextension.html +114 -100
  100. package/docs/html/classes/mapping_tilesublayerextension.tilesublayerextension.html +80 -66
  101. package/docs/html/classes/mapping_vectortilelayerextension.vectortilelayerextension.html +117 -103
  102. package/docs/html/classes/mapping_webtilelayerextension.webtilelayerextension.html +120 -106
  103. package/docs/html/classes/mapping_wmslayerextension.wmslayerextension.html +115 -101
  104. package/docs/html/classes/mapping_wmssublayerextension.wmssublayerextension.html +89 -75
  105. package/docs/html/classes/mapping_wmtslayerextension.wmtslayerextension.html +119 -105
  106. package/docs/html/classes/mapping_wmtssublayerextension.wmtssublayerextension.html +90 -76
  107. package/docs/html/classes/menus_menu.menu.html +60 -43
  108. package/docs/html/classes/menus_menuitem.menuitem.html +72 -55
  109. package/docs/html/classes/support_cancellable.cancellable.html +3 -3
  110. package/docs/html/classes/support_cancellable.cancellation.html +3 -3
  111. package/docs/html/classes/tasks_geocoding_arcgisgeocoder.arcgisgeocoder.html +96 -82
  112. package/docs/html/classes/tasks_geocoding_geocoder.geocoder.html +94 -78
  113. package/docs/html/classes/tasks_identify_arcgissublayerqueryidentifyprovider.arcgissublayerqueryidentifyprovider.html +2 -2
  114. package/docs/html/classes/tasks_identify_buildingcomponentsublayerclientsideidentifyprovider.buildingcomponentsublayerclientsideidentifyprovider.html +48 -5
  115. package/docs/html/classes/tasks_identify_buildingcomponentsublayerhittestidentifyprovider.buildingcomponentsublayerhittestidentifyprovider.html +5 -5
  116. package/docs/html/classes/tasks_identify_clientsideidentifyprovider.clientsideidentifyprovider.html +55 -7
  117. package/docs/html/classes/tasks_identify_csvlayer3dhittestidentifyprovider.csvlayer3dhittestidentifyprovider.html +7 -7
  118. package/docs/html/classes/tasks_identify_csvlayerclientsidequeryidentifyprovider.csvlayerclientsidequeryidentifyprovider.html +13 -7
  119. package/docs/html/classes/tasks_identify_featurelayer3dhittestidentifyprovider.featurelayer3dhittestidentifyprovider.html +9 -9
  120. package/docs/html/classes/tasks_identify_featurelayerclientsideidentifyprovider.featurelayerclientsideidentifyprovider.html +66 -8
  121. package/docs/html/classes/tasks_identify_featurelayerqueryidentifyprovider.featurelayerqueryidentifyprovider.html +5 -5
  122. package/docs/html/classes/tasks_identify_georsslayeridentifyprovider.georsslayeridentifyprovider.html +5 -5
  123. package/docs/html/classes/tasks_identify_graphicslayerqueryidentifyprovider.graphicslayerqueryidentifyprovider.html +2 -2
  124. package/docs/html/classes/tasks_identify_hittestidentifyprovider.hittestidentifyprovider.html +9 -9
  125. package/docs/html/classes/tasks_identify_identifyproviderbase.identifyproviderbase.html +18 -6
  126. package/docs/html/classes/tasks_identify_imagerylayeridentifyprovider.imagerylayeridentifyprovider.html +5 -5
  127. package/docs/html/classes/tasks_identify_kmllayerqueryidentifyprovider.kmllayerqueryidentifyprovider.html +2 -2
  128. package/docs/html/classes/tasks_identify_pointcloudlayerhittestidentifyprovider.pointcloudlayerhittestidentifyprovider.html +6 -6
  129. package/docs/html/classes/tasks_identify_scenelayerclientsideidentifyprovider.scenelayerclientsideidentifyprovider.html +48 -5
  130. package/docs/html/classes/tasks_identify_scenelayerhittestidentifyprovider.scenelayerhittestidentifyprovider.html +5 -5
  131. package/docs/html/classes/tasks_identify_scenelayerqueryidentifyprovider.scenelayerqueryidentifyprovider.html +2 -2
  132. package/docs/html/classes/tasks_identify_streamlayerclientsidequeryidentifyprovider.streamlayerclientsidequeryidentifyprovider.html +48 -5
  133. package/docs/html/classes/tasks_identify_wmssublayeridentifyprovider.wmssublayeridentifyprovider.html +6 -6
  134. package/docs/html/classes/tasks_query_arcgissublayerqueryprovider.arcgissublayerqueryprovider.html +3 -3
  135. package/docs/html/classes/tasks_query_querybasedrelationship.querybasedrelationship.html +78 -42
  136. package/docs/html/classes/tasks_search_geocodersearchprovider.geocodersearchprovider.html +4 -4
  137. package/docs/html/classes/tasks_search_querysearchprovider.querysearchprovider.html +7 -7
  138. package/docs/html/classes/tasks_search_searchservice.searchservice.html +12 -12
  139. package/docs/html/classes/utilities_geometry.coordinatesystembounds.html +26 -5
  140. package/docs/html/enums/data_convert.geometryformat.html +7 -7
  141. package/docs/html/enums/itemtype.itemtype-1.html +73 -19
  142. package/docs/html/index.html +15 -0
  143. package/docs/html/interfaces/data__relationship.relationship-1.html +230 -7
  144. package/docs/html/interfaces/data__relationship.relationshipproperties.html +3 -3
  145. package/docs/html/interfaces/data__tableextension.tableextensionproperties.html +2 -2
  146. package/docs/html/interfaces/data_arcgisservicetableextension.arcgisservicetableextensionproperties.html +4 -4
  147. package/docs/html/interfaces/data_attachment.attachmentproperties.html +1 -1
  148. package/docs/html/interfaces/data_convert.fromcsvoptions.html +13 -13
  149. package/docs/html/interfaces/data_convert.fromshapefileoptions.html +9 -9
  150. package/docs/html/interfaces/data_convert.fromxlsxoptions.html +12 -12
  151. package/docs/html/interfaces/data_convert.tocsvoptions.html +13 -13
  152. package/docs/html/interfaces/data_convert.toshapefileoptions.html +8 -8
  153. package/docs/html/interfaces/data_convert.toxlsxoptions.html +10 -10
  154. package/docs/html/interfaces/data_feature.featureproperties.html +1 -1
  155. package/docs/html/interfaces/data_featurelist.featurelistproperties.html +1 -1
  156. package/docs/html/interfaces/data_featureset.featuresetproperties.html +1 -1
  157. package/docs/html/interfaces/data_featuresettings.featuresettingsproperties.html +9 -9
  158. package/docs/html/interfaces/data_featuresource.featuresource.html +21 -1
  159. package/docs/html/interfaces/data_featuresourcebase.featuresourcebaseproperties.html +2 -2
  160. package/docs/html/interfaces/data_featurestream.featurestreamproperties.html +1 -1
  161. package/docs/html/interfaces/data_fieldextension.fieldextensionproperties.html +5 -5
  162. package/docs/html/interfaces/data_fieldextension.fieldproperties.html +1 -1
  163. package/docs/html/interfaces/data_schema.fieldcollection.html +1 -1
  164. package/docs/html/interfaces/data_schema.fieldextensioncollection.html +1 -1
  165. package/docs/html/interfaces/data_schema.schemaproperties.html +9 -9
  166. package/docs/html/interfaces/data_table.tableproperties.html +1 -1
  167. package/docs/html/interfaces/entity.entity-1.html +20 -1
  168. package/docs/html/interfaces/entity.entitybaseproperties.html +1 -1
  169. package/docs/html/interfaces/entity.entityproperties.html +1 -1
  170. package/docs/html/interfaces/languageresources.languageresourcesproperties.html +1 -1
  171. package/docs/html/interfaces/layer_preset_layerpreset.layerpresetproperties.html +1 -1
  172. package/docs/html/interfaces/mapping__layerextension.layerextensionproperties.html +9 -9
  173. package/docs/html/interfaces/mapping__layerextension.layerproperties.html +2 -2
  174. package/docs/html/interfaces/mapping__layerextension.layerreference.html +4 -4
  175. package/docs/html/interfaces/mapping__sublayerextension.sublayerextensionproperties.html +2 -2
  176. package/docs/html/interfaces/mapping_arcgissublayerextension.arcgissublayerextensionproperties.html +2 -2
  177. package/docs/html/interfaces/mapping_arcgissublayerextension.arcgissublayerproperties.html +16 -16
  178. package/docs/html/interfaces/mapping_basemapextension.basemapextensionproperties.html +8 -8
  179. package/docs/html/interfaces/mapping_bookmark.bookmarkproperties.html +4 -4
  180. package/docs/html/interfaces/mapping_buildingcomponentsublayerextension.buildingcomponentsublayerextensionproperties.html +2 -2
  181. package/docs/html/interfaces/mapping_buildinggroupsublayerextension.buildinggroupsublayerextensionproperties.html +2 -2
  182. package/docs/html/interfaces/mapping_buildingscenelayerextension.buildingscenelayerextensionproperties.html +7 -7
  183. package/docs/html/interfaces/mapping_buildingscenelayerextension.buildingscenelayerproperties.html +2 -2
  184. package/docs/html/interfaces/mapping_buildingsublayerextension.buildingsublayerextensionproperties.html +2 -2
  185. package/docs/html/interfaces/mapping_csvlayerextension.csvlayerextensionproperties.html +8 -8
  186. package/docs/html/interfaces/mapping_elevationlayerextension.elevationlayerextensionproperties.html +8 -8
  187. package/docs/html/interfaces/mapping_featurelayerextension.featurelayerextensionproperties.html +10 -10
  188. package/docs/html/interfaces/mapping_featurelayerextension.featurelayerproperties.html +4 -4
  189. package/docs/html/interfaces/mapping_featurelayerextensionbase.featurelayerbaseproperties.html +2 -2
  190. package/docs/html/interfaces/mapping_featurelayerextensionbase.featurelayerextensionbaseproperties.html +8 -8
  191. package/docs/html/interfaces/mapping_georsslayerextension.georsslayerextensionproperties.html +8 -8
  192. package/docs/html/interfaces/mapping_graphicslayerextension.graphicslayerextensionproperties.html +8 -8
  193. package/docs/html/interfaces/mapping_groundextension.groundextensionproperties.html +1 -1
  194. package/docs/html/interfaces/mapping_grouplayerextension.grouplayerextensionproperties.html +8 -8
  195. package/docs/html/interfaces/mapping_imagerylayerextension.imagerylayerextensionproperties.html +8 -8
  196. package/docs/html/interfaces/mapping_imagerytilelayerextension.imagerytilelayerextensionproperties.html +8 -8
  197. package/docs/html/interfaces/mapping_imagerytilelayerextension.imagerytilelayerproperties.html +2 -2
  198. package/docs/html/interfaces/mapping_integratedmeshlayerextension.integratedmeshlayerextensionproperties.html +8 -8
  199. package/docs/html/interfaces/mapping_kmllayerextension.kmllayerextensionproperties.html +7 -7
  200. package/docs/html/interfaces/mapping_kmlsublayerextension.kmlsublayerextensionproperties.html +2 -2
  201. package/docs/html/interfaces/mapping_mapextension.mapextensionproperties.html +24 -24
  202. package/docs/html/interfaces/mapping_mapextension.tableextensioncollection.html +3 -3
  203. package/docs/html/interfaces/mapping_mapimagelayerextension.mapimagelayerextensionproperties.html +7 -7
  204. package/docs/html/interfaces/mapping_mapimagesublayerextension.mapimagesublayerextensionproperties.html +2 -2
  205. package/docs/html/interfaces/mapping_mapimagesublayerextension.mapimagesublayerproperties.html +16 -16
  206. package/docs/html/interfaces/mapping_openstreetmaplayerextension.openstreetmaplayerextensionproperties.html +8 -8
  207. package/docs/html/interfaces/mapping_pointcloudlayerextension.pointcloudlayerextensionproperties.html +8 -8
  208. package/docs/html/interfaces/mapping_scenelayerextension.scenelayerextensionproperties.html +8 -8
  209. package/docs/html/interfaces/mapping_streamlayerextension.streamlayerextensionproperties.html +8 -8
  210. package/docs/html/interfaces/mapping_support__layerextensioncollection.layerextensioncollection.html +3 -3
  211. package/docs/html/interfaces/mapping_tilelayerextension.tilelayerextensionproperties.html +8 -8
  212. package/docs/html/interfaces/mapping_tilelayerextension.tilelayerproperties.html +2 -2
  213. package/docs/html/interfaces/mapping_tilesublayerextension.tilesublayerextensionproperties.html +2 -2
  214. package/docs/html/interfaces/mapping_tilesublayerextension.tilesublayerproperties.html +16 -16
  215. package/docs/html/interfaces/mapping_vectortilelayerextension.vectortilelayerextensionproperties.html +8 -8
  216. package/docs/html/interfaces/mapping_webtilelayerextension.webtilelayerextensionproperties.html +8 -8
  217. package/docs/html/interfaces/mapping_wmslayerextension.wmslayerextensionproperties.html +7 -7
  218. package/docs/html/interfaces/mapping_wmssublayerextension.wmssublayerextensionproperties.html +2 -2
  219. package/docs/html/interfaces/mapping_wmtslayerextension.wmtslayerextensionproperties.html +7 -7
  220. package/docs/html/interfaces/mapping_wmtssublayerextension.wmtssublayerextensionproperties.html +2 -2
  221. package/docs/html/interfaces/menus_menu.menuproperties.html +1 -1
  222. package/docs/html/interfaces/menus_menuitem.menuitemproperties.html +1 -1
  223. package/docs/html/interfaces/portal_drawinginfo.drawinginfo-1.html +7 -7
  224. package/docs/html/interfaces/portal_extent.extent.html +1 -1
  225. package/docs/html/interfaces/portal_geometry.geometrybase.html +1 -1
  226. package/docs/html/interfaces/portal_layer.layer-1.html +16 -16
  227. package/docs/html/interfaces/portal_layerdefinition.fieldoverride.html +3 -3
  228. package/docs/html/interfaces/portal_layerdefinition.layerdefinition-1.html +47 -47
  229. package/docs/html/interfaces/portal_layerdefinition.layerdefinitiondefaults.html +8 -8
  230. package/docs/html/interfaces/portal_layerdefinition.layertimeinfo.html +9 -9
  231. package/docs/html/interfaces/portal_layerdefinition.timeinfoexportoptions.html +4 -4
  232. package/docs/html/interfaces/portal_multipoint.multipoint.html +1 -1
  233. package/docs/html/interfaces/portal_point.point.html +1 -1
  234. package/docs/html/interfaces/portal_polygon.polygon.html +1 -1
  235. package/docs/html/interfaces/portal_polyline.polyline.html +1 -1
  236. package/docs/html/interfaces/portal_symbol.font.html +5 -5
  237. package/docs/html/interfaces/portal_symbol.symbolbase.html +1 -1
  238. package/docs/html/interfaces/portal_symbol3d.symbol3dbase.html +1 -1
  239. package/docs/html/interfaces/portal_tiledmapservicelayer.tiledmapservicelayer-1.html +8 -8
  240. package/docs/html/interfaces/portal_webmap.webmap-1.html +16 -16
  241. package/docs/html/interfaces/portal_webscene.webscene-1.html +16 -16
  242. package/docs/html/interfaces/support_serializable.serializable.html +5 -0
  243. package/docs/html/interfaces/tasks_geocoding_arcgisgeocoder.arcgisgeocoderproperties.html +7 -7
  244. package/docs/html/interfaces/tasks_geocoding_geocoder.geocodeoptions-1.html +6 -6
  245. package/docs/html/interfaces/tasks_geocoding_geocoder.geocodercapabilities.html +4 -4
  246. package/docs/html/interfaces/tasks_geocoding_geocoder.geocoderproperties.html +2 -2
  247. package/docs/html/interfaces/tasks_query_querybasedrelationship.querybasedrelationshipproperties.html +2 -2
  248. package/docs/html/interfaces/utilities_geometry.geographictransformationjson.html +22 -1
  249. package/docs/html/interfaces/utilities_geometry.geographictransformationstepjson.html +24 -3
  250. package/docs/html/interfaces/utilities_geometry.geojsonlinestring.html +23 -2
  251. package/docs/html/interfaces/utilities_geometry.geojsonmultilinestring.html +23 -2
  252. package/docs/html/interfaces/utilities_geometry.geojsonmultipoint.html +23 -2
  253. package/docs/html/interfaces/utilities_geometry.geojsonmultipolygon.html +23 -2
  254. package/docs/html/interfaces/utilities_geometry.geojsonpoint.html +23 -2
  255. package/docs/html/interfaces/utilities_geometry.geojsonpolygon.html +23 -2
  256. package/docs/html/interfaces/utilities_geometry.gmloptions.html +24 -3
  257. package/docs/html/modules/data__relationship.html +5 -5
  258. package/docs/html/modules/data__relationship.relationship.html +2 -2
  259. package/docs/html/modules/data_attachment.html +1 -1
  260. package/docs/html/modules/data_convert.html +6 -6
  261. package/docs/html/modules/data_feature.html +3 -3
  262. package/docs/html/modules/itemtype.html +638 -0
  263. package/docs/html/modules/mapping__layerextension.html +1 -1
  264. package/docs/html/modules/mapping_bookmark.html +1 -1
  265. package/docs/html/modules/mapping_layerextension.html +27 -0
  266. package/docs/html/modules/mapping_mapextension.html +5 -5
  267. package/docs/html/modules/mapping_sublayerextension.html +9 -0
  268. package/docs/html/modules/portal_drawinginfo.drawinginfo.html +2 -2
  269. package/docs/html/modules/portal_geometry.geometrytype.html +2 -2
  270. package/docs/html/modules/portal_geometry.html +4 -4
  271. package/docs/html/modules/portal_layer.layer.html +4 -4
  272. package/docs/html/modules/portal_layerdefinition.html +2 -2
  273. package/docs/html/modules/portal_layerdefinition.layerdefinition.html +2 -2
  274. package/docs/html/modules/portal_layerdefinition.layerdefinitioncapabilities.html +6 -6
  275. package/docs/html/modules/portal_symbol.html +10 -10
  276. package/docs/html/modules/portal_symbol.symboltype.html +2 -2
  277. package/docs/html/modules/portal_tiledmapservicelayer.tiledmapservicelayer.html +11 -5
  278. package/docs/html/modules/portal_webmap.webmap.html +3 -3
  279. package/docs/html/modules/portal_webscene.webscene.html +3 -3
  280. package/docs/html/modules/support_cancellable.html +3 -3
  281. package/docs/html/modules/support_utilities.html +164 -0
  282. package/docs/html/modules/tasks_geocoding_geocoder.geocodeoptions.html +2 -2
  283. package/docs/html/modules/tasks_identify__utilities.html +114 -0
  284. package/docs/html/modules/tasks_search_searchservice.html +1 -1
  285. package/docs/html/modules/utilities__layers.html +117 -82
  286. package/docs/html/modules/utilities_esri.html +389 -4
  287. package/docs/html/modules/utilities_extensions.html +654 -0
  288. package/docs/html/modules/utilities_geometry.html +263 -18
  289. package/docs/html/modules/utilities_layers.html +9 -0
  290. package/docs/html/modules/utilities_mapping.html +74 -4
  291. package/docs/html/modules/utilities_portal.html +9 -9
  292. package/docs/html/modules/utilities_query.html +3 -3
  293. package/docs/html/modules/utilities_relationships.html +164 -0
  294. package/docs/html/modules/utilities_renderers.html +339 -0
  295. package/docs/html/modules/utilities_symbol.html +264 -19
  296. package/docs/html/modules/version.html +1 -1
  297. package/docs/html/modules.html +20 -0
  298. package/layer-preset/LayerPreset.d.ts +3 -3
  299. package/layer-preset/LayerPreset.js +1 -1
  300. package/layer-preset/LayerPresetSettings.d.ts +1 -1
  301. package/mapping/ArcGISSublayerExtension.d.ts +1 -1
  302. package/mapping/ArcGISSublayerExtension.js +1 -1
  303. package/mapping/BasemapExtension.d.ts +4 -4
  304. package/mapping/BasemapExtension.js +1 -1
  305. package/mapping/Bookmark.d.ts +3 -3
  306. package/mapping/Bookmark.js +1 -1
  307. package/mapping/FeatureLayerExtension.js +1 -1
  308. package/mapping/GroundExtension.d.ts +1 -1
  309. package/mapping/GroundExtension.js +1 -1
  310. package/mapping/LayerExtension.d.ts +2 -1
  311. package/mapping/LayerExtension.js +1 -1
  312. package/mapping/MapExtension.d.ts +4 -1
  313. package/mapping/MapExtension.js +1 -1
  314. package/mapping/SublayerExtension.d.ts +2 -1
  315. package/mapping/SublayerExtension.js +1 -1
  316. package/mapping/WMTSLayerExtension.js +1 -1
  317. package/mapping/_LayerExtension.d.ts +5 -5
  318. package/mapping/_LayerExtension.js +1 -1
  319. package/mapping/_SublayerExtension.d.ts +4 -4
  320. package/mapping/_SublayerExtension.js +1 -1
  321. package/mapping/support/_LayerExtensionCollection.js +1 -1
  322. package/menus/Menu.d.ts +4 -4
  323. package/menus/Menu.js +1 -1
  324. package/menus/MenuItem.d.ts +4 -4
  325. package/menus/MenuItem.js +1 -1
  326. package/package.json +1 -1
  327. package/portal/DrawingInfo.d.ts +1 -1
  328. package/portal/DrawingInfo.js +1 -1
  329. package/portal/Geometry.d.ts +1 -1
  330. package/portal/Geometry.js +1 -1
  331. package/portal/Layer.js +1 -1
  332. package/portal/LayerDefinition.d.ts +1 -1
  333. package/portal/LayerDefinition.js +1 -1
  334. package/portal/Slide.js +1 -1
  335. package/portal/Symbol.d.ts +1 -1
  336. package/portal/Symbol.js +1 -1
  337. package/portal/TiledMapServiceLayer.d.ts +3 -1
  338. package/portal/TiledMapServiceLayer.js +1 -1
  339. package/portal/WebMap.d.ts +1 -1
  340. package/portal/WebMap.js +1 -1
  341. package/portal/WebScene.d.ts +1 -1
  342. package/portal/WebScene.js +1 -1
  343. package/support/Cancellable.js +1 -1
  344. package/support/_graphicsQuery.js +1 -1
  345. package/support/utilities.d.ts +7 -0
  346. package/support/utilities.js +1 -0
  347. package/tasks/geocoding/ArcGISGeocoder.js +1 -1
  348. package/tasks/geocoding/Geocoder.d.ts +1 -1
  349. package/tasks/geocoding/Geocoder.js +1 -1
  350. package/tasks/identify/ArcGISSublayerQueryIdentifyProvider.js +1 -1
  351. package/tasks/identify/BuildingComponentSublayerClientSideIdentifyProvider.js +1 -1
  352. package/tasks/identify/CSVLayer3DHitTestIdentifyProvider.js +1 -1
  353. package/tasks/identify/CSVLayerClientSideQueryIdentifyProvider.d.ts +3 -3
  354. package/tasks/identify/CSVLayerClientSideQueryIdentifyProvider.js +1 -1
  355. package/tasks/identify/ClientSideIdentifyProvider.d.ts +6 -4
  356. package/tasks/identify/ClientSideIdentifyProvider.js +1 -1
  357. package/tasks/identify/FeatureLayer3DHitTestIdentifyProvider.js +1 -1
  358. package/tasks/identify/FeatureLayerClientSideIdentifyProvider.d.ts +6 -0
  359. package/tasks/identify/FeatureLayerClientSideIdentifyProvider.js +1 -1
  360. package/tasks/identify/FeatureLayerQueryIdentifyProvider.js +1 -1
  361. package/tasks/identify/GeoRSSLayerIdentifyProvider.js +1 -1
  362. package/tasks/identify/HitTestIdentifyProvider.d.ts +1 -1
  363. package/tasks/identify/HitTestIdentifyProvider.js +1 -1
  364. package/tasks/identify/IdentifyProviderBase.d.ts +4 -2
  365. package/tasks/identify/IdentifyProviderBase.js +1 -1
  366. package/tasks/identify/IdentifyService.d.ts +1 -1
  367. package/tasks/identify/IdentifyService.js +1 -1
  368. package/tasks/identify/ImageryLayerIdentifyProvider.js +1 -1
  369. package/tasks/identify/PointCloudLayerHitTestIdentifyProvider.d.ts +1 -1
  370. package/tasks/identify/PointCloudLayerHitTestIdentifyProvider.js +1 -1
  371. package/tasks/identify/SceneLayerHitTestIdentifyProvider.d.ts +1 -1
  372. package/tasks/identify/SceneLayerHitTestIdentifyProvider.js +1 -1
  373. package/tasks/identify/WMSSublayerIdentifyProvider.js +1 -1
  374. package/tasks/identify/_utilities.d.ts +1 -0
  375. package/tasks/identify/_utilities.js +1 -0
  376. package/tasks/query/ArcGISSublayerQueryProvider.js +1 -1
  377. package/tasks/query/QueryBasedRelationship.d.ts +4 -0
  378. package/tasks/query/QueryBasedRelationship.js +1 -1
  379. package/tasks/query/QueryService.js +1 -1
  380. package/tasks/search/GeocoderSearchProvider.js +1 -1
  381. package/tasks/search/QuerySearchProvider.js +1 -1
  382. package/tasks/search/SearchService.d.ts +1 -1
  383. package/tasks/search/SearchService.js +1 -1
  384. package/tasks/search/_utilities.js +1 -1
  385. package/utilities/_layers.d.ts +33 -27
  386. package/utilities/_layers.js +1 -1
  387. package/utilities/esri.d.ts +76 -0
  388. package/utilities/esri.js +1 -1
  389. package/utilities/extensions.d.ts +105 -0
  390. package/utilities/extensions.js +1 -0
  391. package/utilities/geometry.d.ts +46 -0
  392. package/utilities/geometry.js +1 -1
  393. package/utilities/layers.d.ts +1 -1
  394. package/utilities/layers.js +1 -1
  395. package/utilities/mapping.d.ts +14 -0
  396. package/utilities/mapping.js +1 -1
  397. package/utilities/portal.js +1 -1
  398. package/utilities/query.d.ts +1 -1
  399. package/utilities/query.js +1 -1
  400. package/utilities/relationships.d.ts +7 -0
  401. package/utilities/relationships.js +1 -0
  402. package/utilities/renderers.d.ts +43 -0
  403. package/utilities/renderers.js +1 -0
  404. package/utilities/symbol.d.ts +49 -0
  405. package/utilities/symbol.js +1 -1
  406. package/version.d.ts +1 -1
  407. package/version.js +1 -1
@@ -1 +1 @@
1
- import{EntityBase}from"../Entity.js";import{Hyperlink}from"../Hyperlink.js";import{InvalidOperationError}from"../InvalidOperationError.js";import{NotFoundError}from"../NotFoundError.js";import{FeatureReadOptions}from"../data/FeatureSource.js";import{Menu}from"../menus/Menu.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{RelationshipBase}from"./RelationshipBase.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_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}),log=getLogger("FeatureSourceBase");export class FeatureSourceBase extends EntityBase{constructor(e){super(e),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(e){this._featureActions=e,e&&this.isInitialized&&!e.isInitialized&&(async()=>{try{await e.initialize()}catch(e){e instanceof Error&&log.error({message:"An error occurred while initializing feature action menu.",error:e})}})()}get capabilities(){return this._capabilities()}getFullExtent(){}async getAttachments(e){return checkArg("feature",e).isNotMissing(),await this.initialize(),this._getAttachments(e)}async getFeature(e,t){checkArg("id",e).isNotMissing();const i=this.getFeatures([e],t),s=await first(i);if(!s)throw new NotFoundError("No feature exists with ID '{0}'.",e);return s}getFeatures(e,t){checkArg("ids",e).isNotMissing();const i=this;return async function*(){await i.initialize(),yield*i._getFeatures(e,{...FeatureReadOptions.DEFAULTS,...FeatureReadOptions.fromFeatureSource(i),...t})}()}async addFeature(e,t){checkArg("feature",e).isNotMissing(),await this.addFeatures([e])}async addFeatures(e,t){if(checkArg("features",e).isNotMissing(),await this.initialize(),!this.capabilities.supportsAdd)throw new InvalidOperationError(ERR_ADD_FEATURES_NOT_SUPPORTED);await this._addFeatures(e,t)}async updateFeature(e,t){checkArg("feature",e).isNotMissing(),await this.updateFeatures([e])}async updateFeatures(e,t){if(checkArg("features",e).isNotMissing(),await this.initialize(),!this.capabilities.supportsUpdate)throw new InvalidOperationError(ERR_UPDATE_FEATURES_NOT_SUPPORTED);await this._updateFeatures(e,t)}async deleteFeature(e,t){checkArg("feature",e).isNotMissing(),await this.deleteFeatures([e])}async deleteFeatures(e,t){if(checkArg("features",e).isNotMissing(),await this.initialize(),!this.capabilities.supportsDelete)throw new InvalidOperationError(ERR_DELETE_FEATURES_NOT_SUPPORTED);const i=[];for(const t of e)i.push("string"==typeof t?t:t.primaryKey);await this._deleteFeatures(i,t)}_getSerializableProperties(){return{...super._getSerializableProperties(),featureSettings:{serializeModes:["initial"],isDefault:e=>{if(!e)return!0;if(e.constructor===Object){if(!Object.keys(e).length)return!0}return!1}},taskSettings:"initial",onAddFeature:"initial",onEditFeature:"initial",schema:"initial",relationships:{serialize:!1,deserialize:e=>{compare(this.relationships,e,{onNew:e=>{this.relationships.add(this._isRelationship(e)?e:Relationship.create(e))},onMatch:(e,t)=>{e instanceof RelationshipBase&&e.assignProperties({title:t.title})},onMissing:e=>{this.relationships.remove(e)},equals:(e,t)=>e.id===t.id})}},hyperlinks:{serialize:!1,deserialize:e=>{this.hyperlinks.removeAll(),this.hyperlinks.addMany(e.map((e=>e instanceof Hyperlink?e:new Hyperlink(e))))}},featureActions:{serializeModes:["initial"],deserialize:e=>{e?e instanceof Menu?this.featureActions=e:this.featureActions?this.featureActions.assignProperties(e):this.featureActions=Menu.create(e):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(){var e;await super._postInitialize(),this.featureSettings.popupTemplate||(this.featureSettings.popupTemplate=this.schema.createPopupTemplate());const{popupTemplate:t}=this.featureSettings;"function"==typeof t.content&&(t.content=t.content()),t.content=await t.content;const{content:i}=t;Array.isArray(i)&&i.some((e=>{var t;return"fields"===e.type&&!(null===(t=e.fieldInfos)||void 0===t?void 0:t.length)}))&&!(null===(e=t.fieldInfos)||void 0===e?void 0:e.length)&&(t.fieldInfos=this.schema.createAllFieldInfos()),!t.title&&this.schema.displayField&&(t.title=`{${this.schema.displayField}}`)}_createSchema(){return new Schema}_createFeatureSettings(){return new FeatureSettings}_createTaskSettings(){return new TaskSettings}_createRelationships(){return new RelationshipCollection(this)}_createHyperlinks(){return new Collection}async _getAttachments(e){return[]}_getFeatures(e,t){const{primaryKeyField:i}=this.schema;if(this.queryService&&i){const s=e.map((e=>`${i} = ${e}`)).join(" OR ");return this.queryService.query(this,s,t)}throw new InvalidOperationError(ERR_GET_FEATURES_NOT_SUPPORTED)}_addFeatures(e,t){throw new InvalidOperationError(ERR_ADD_FEATURES_NOT_SUPPORTED)}_updateFeatures(e,t){throw new InvalidOperationError(ERR_UPDATE_FEATURES_NOT_SUPPORTED)}_deleteFeatures(e,t){throw new InvalidOperationError(ERR_DELETE_FEATURES_NOT_SUPPORTED)}_capabilities(){return DEFAULT_CAPABILITIES}_createAndSetupSchema(){const e=this._createSchema();return e._featureSettings=this.featureSettings,e}_createAndSetupFeatureSettings(){const e=this._createFeatureSettings();return e._setFeatureSource(this),e}_isRelationship(e){return"function"==typeof e.getRelatedFeatures}}export class RelationshipCollection extends CollectionProxy{constructor(e){super(new Collection),this._source=e}add(e,t){checkArg("relationship",e).isNotMissing(),e.source&&e.source.relationships.remove(e),e instanceof RelationshipBase&&e._setSource(this._source),super.add(e,t)}removeAt(e){const t=super.removeAt(e);return t instanceof RelationshipBase&&t._setSource(void 0),t}}
1
+ 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{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_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}),log=getLogger("FeatureSourceBase");export class FeatureSourceBase extends EntityBase{constructor(e){super(e),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(e){this._featureActions=e,e&&this.isInitialized&&!e.isInitialized&&(async()=>{try{await e.initialize()}catch(e){e instanceof Error&&log.error({message:"An error occurred while initializing feature action menu.",error:e})}})()}get capabilities(){return this._capabilities()}getFullExtent(){}async getAttachments(e){return checkArg("feature",e).isNotMissing(),await this.initialize(),this._getAttachments(e)}async getFeature(e,t){checkArg("id",e).isNotMissing();const i=this.getFeatures([e],t),s=await first(i);if(!s)throw new NotFoundError("No feature exists with ID '{0}'.",e);return s}getFeatures(e,t){checkArg("ids",e).isNotMissing();const i=this;return async function*(){await i.initialize(),yield*i._getFeatures(e,{...FeatureReadOptions.DEFAULTS,...FeatureReadOptions.fromFeatureSource(i),...t})}()}async addFeature(e,t){checkArg("feature",e).isNotMissing(),await this.addFeatures([e])}async addFeatures(e,t){if(checkArg("features",e).isNotMissing(),await this.initialize(),!this.capabilities.supportsAdd)throw new InvalidOperationError(ERR_ADD_FEATURES_NOT_SUPPORTED);await this._addFeatures(e,t)}async updateFeature(e,t){checkArg("feature",e).isNotMissing(),await this.updateFeatures([e])}async updateFeatures(e,t){if(checkArg("features",e).isNotMissing(),await this.initialize(),!this.capabilities.supportsUpdate)throw new InvalidOperationError(ERR_UPDATE_FEATURES_NOT_SUPPORTED);await this._updateFeatures(e,t)}async deleteFeature(e,t){checkArg("feature",e).isNotMissing(),await this.deleteFeatures([e])}async deleteFeatures(e,t){if(checkArg("features",e).isNotMissing(),await this.initialize(),!this.capabilities.supportsDelete)throw new InvalidOperationError(ERR_DELETE_FEATURES_NOT_SUPPORTED);const i=[];for(const t of e)i.push("string"==typeof t?t:t.primaryKey);await this._deleteFeatures(i,t)}_getSerializableProperties(){return{...super._getSerializableProperties(),featureSettings:{serializeModes:["initial"],isDefault:e=>{if(!e)return!0;if(e.constructor===Object){if(!Object.keys(e).length)return!0}return!1}},taskSettings:"initial",onAddFeature:"initial",onEditFeature:"initial",schema:"initial",relationships:{serialize:!1,deserialize:e=>{compare(this.relationships,e,{onNew:e=>{this.relationships.add(this._isRelationship(e)?e:Relationship.create(e))},onMatch:(e,t)=>{isRelationship(e)&&e.assignProperties({title:t.title})},onMissing:e=>{this.relationships.remove(e)},equals:(e,t)=>e.id===t.id})}},hyperlinks:{serialize:!1,deserialize:e=>{this.hyperlinks.removeAll(),this.hyperlinks.addMany(e.map((e=>e instanceof Hyperlink?e:new Hyperlink(e))))}},featureActions:{serializeModes:["initial"],deserialize:e=>{e?isMenu(e)?this.featureActions=e:this.featureActions?this.featureActions.assignProperties(e):this.featureActions=Menu.create(e):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(){var e;await super._postInitialize(),this.featureSettings.popupTemplate||(this.featureSettings.popupTemplate=this.schema.createPopupTemplate());const{popupTemplate:t}=this.featureSettings;"function"==typeof t.content&&(t.content=t.content()),t.content=await t.content;const{content:i}=t;Array.isArray(i)&&i.some((e=>{var t;return"fields"===e.type&&!(null===(t=e.fieldInfos)||void 0===t?void 0:t.length)}))&&!(null===(e=t.fieldInfos)||void 0===e?void 0:e.length)&&(t.fieldInfos=this.schema.createAllFieldInfos()),!t.title&&this.schema.displayField&&(t.title=`{${this.schema.displayField}}`)}_createSchema(){return new Schema}_createFeatureSettings(){return new FeatureSettings}_createTaskSettings(){return new TaskSettings}_createRelationships(){return new RelationshipCollection(this)}_createHyperlinks(){return new Collection}async _getAttachments(e){return[]}_getFeatures(e,t){const{primaryKeyField:i}=this.schema;if(this.queryService&&i){const s=e.map((e=>`${i} = ${e}`)).join(" OR ");return this.queryService.query(this,s,t)}throw new InvalidOperationError(ERR_GET_FEATURES_NOT_SUPPORTED)}_addFeatures(e,t){throw new InvalidOperationError(ERR_ADD_FEATURES_NOT_SUPPORTED)}_updateFeatures(e,t){throw new InvalidOperationError(ERR_UPDATE_FEATURES_NOT_SUPPORTED)}_deleteFeatures(e,t){throw new InvalidOperationError(ERR_DELETE_FEATURES_NOT_SUPPORTED)}_capabilities(){return DEFAULT_CAPABILITIES}_createAndSetupSchema(){const e=this._createSchema();return e._featureSettings=this.featureSettings,e}_createAndSetupFeatureSettings(){const e=this._createFeatureSettings();return e._setFeatureSource(this),e}_isRelationship(e){return"function"==typeof e.getRelatedFeatures}}export class RelationshipCollection extends CollectionProxy{constructor(e){super(new Collection),this._source=e}add(e,t){checkArg("relationship",e).isNotMissing(),e.source&&e.source.relationships.remove(e),isRelationship(e)&&e._setSource(this._source),super.add(e,t)}removeAt(e){const t=super.removeAt(e);return isRelationship(t)&&t._setSource(void 0),t}}
@@ -24,6 +24,10 @@ export declare class FeatureStream extends EntityBase<FeatureStreamProperties> i
24
24
  * A human readable title describing the feature results.
25
25
  */
26
26
  title: string;
27
+ /**
28
+ * @inheritdoc
29
+ */
30
+ protected readonly _itemType = "feature-stream";
27
31
  private readonly _features;
28
32
  constructor(arg?: Iterable<Feature> | AsyncIterable<Feature> | FeatureStreamProperties);
29
33
  /**
@@ -38,10 +42,6 @@ export declare class FeatureStream extends EntityBase<FeatureStreamProperties> i
38
42
  * Reads the stream into a FeatureSet.
39
43
  */
40
44
  toFeatureSet(): Promise<FeatureSet>;
41
- /**
42
- * @inheritdoc
43
- */
44
- protected get _itemType(): string;
45
45
  /**
46
46
  * @inheritdoc
47
47
  */
@@ -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)),t)if(t[Symbol.asyncIterator])this._features=t;else if(t[Symbol.iterator])this._features=from(t);else{const{features:e}=t;(null==e?void 0:e[Symbol.asyncIterator])?this._features=e:(null==e?void 0: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)})}get _itemType(){return"feature-stream"}_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}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;(null==e?void 0:e[Symbol.asyncIterator])?this._features=e:(null==e?void 0: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}
@@ -56,10 +56,6 @@ export declare class FieldExtension extends EntityBase<FieldExtensionProperties>
56
56
  * The corresponding esri field info object.
57
57
  */
58
58
  get fieldInfo(): FieldInfo;
59
- /**
60
- * @inheritdoc
61
- */
62
- protected get _itemType(): string;
63
59
  /**
64
60
  * The field format specifier. This is a standard .NET-style format string
65
61
  * containing as `{0}` placeholder that will be replaced by the actual field
@@ -75,6 +71,10 @@ export declare class FieldExtension extends EntityBase<FieldExtensionProperties>
75
71
  * Whether the field is searchable or not.
76
72
  */
77
73
  searchable: boolean;
74
+ /**
75
+ * @inheritdoc
76
+ */
77
+ protected readonly _itemType: string;
78
78
  private _field;
79
79
  /**
80
80
  * The cached corresponding esri field info object.
@@ -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{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{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;const{field:i}=null!=e?e:{};i instanceof EsriField?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(){var e,i;if(this._fieldInfo)return this._fieldInfo;if(!this.field||!this.field.name)return;const t=null===(i=null===(e=this._schema)||void 0===e?void 0:e._featureSettings)||void 0===i?void 0:i.popupTemplate,r=(null==t?void 0:t.fieldInfos)||[];return this._fieldInfo=r.find((e=>e.fieldName===this.field.name)),this._fieldInfo}get _itemType(){return ItemType.FIELD_EXTENSION}static matchesRef(e,i){var t,r,s;return e instanceof FieldExtension_1?(null!==(r=null===(t=e.field)||void 0===t?void 0:t.name)&&void 0!==r?r:null===(s=e._deferredFieldProperties)||void 0===s?void 0:s.$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:()=>{var e;return this.field?this._originalRef?{$ref:this._originalRef}:(null===(e=this._schema)||void 0===e?void 0:e.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(e instanceof EsriField){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(){var e,i;const t=null===(i=null===(e=this.fieldExtension.fieldInfo)||void 0===e?void 0:e.format)||void 0===i?void 0:i.places;return!this.isModified("fractionalDigits")&&this.useFieldInfo&&t?t:this._getSetting("fractionalDigits")}set fractionalDigits(e){this._setSetting("fractionalDigits",e)}get numberFormat(){var e,i;const t=null===(i=null===(e=this.fieldExtension.fieldInfo)||void 0===e?void 0:e.format)||void 0===i?void 0:i.digitSeparator;return!this.isModified("numberFormat")&&this.useFieldInfo&&t?t?NumberFormat.NUMBER:NumberFormat.FIXED_POINT:this._getSetting("numberFormat")}set numberFormat(e){this._setSetting("numberFormat",e)}get dateFormat(){var e,i;const t=null===(i=null===(e=this.fieldExtension.fieldInfo)||void 0===e?void 0:e.format)||void 0===i?void 0:i.dateFormat;return!this.isModified("dateFormat")&&this.useFieldInfo&&t?esriFormatToGeocortexFormat(t):this._getSetting("dateFormat")}set dateFormat(e){this._setSetting("dateFormat",e)}};FieldExtensionFormatSettings=__decorate([serializable],FieldExtensionFormatSettings);
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}=null!=e?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(){var e,i;if(this._fieldInfo)return this._fieldInfo;if(!this.field||!this.field.name)return;const t=null===(i=null===(e=this._schema)||void 0===e?void 0:e._featureSettings)||void 0===i?void 0:i.popupTemplate,r=(null==t?void 0:t.fieldInfos)||[];return this._fieldInfo=r.find((e=>e.fieldName===this.field.name)),this._fieldInfo}static matchesRef(e,i){var t,r,s;return isFieldExtension(e)?(null!==(r=null===(t=e.field)||void 0===t?void 0:t.name)&&void 0!==r?r:null===(s=e._deferredFieldProperties)||void 0===s?void 0:s.$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:()=>{var e;return this.field?this._originalRef?{$ref:this._originalRef}:(null===(e=this._schema)||void 0===e?void 0:e.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(){var e,i;const t=null===(i=null===(e=this.fieldExtension.fieldInfo)||void 0===e?void 0:e.format)||void 0===i?void 0:i.places;return!this.isModified("fractionalDigits")&&this.useFieldInfo&&t?t:this._getSetting("fractionalDigits")}set fractionalDigits(e){this._setSetting("fractionalDigits",e)}get numberFormat(){var e,i;const t=null===(i=null===(e=this.fieldExtension.fieldInfo)||void 0===e?void 0:e.format)||void 0===i?void 0:i.digitSeparator;return!this.isModified("numberFormat")&&this.useFieldInfo&&t?t?NumberFormat.NUMBER:NumberFormat.FIXED_POINT:this._getSetting("numberFormat")}set numberFormat(e){this._setSetting("numberFormat",e)}get dateFormat(){var e,i;const t=null===(i=null===(e=this.fieldExtension.fieldInfo)||void 0===e?void 0:e.format)||void 0===i?void 0:i.dateFormat;return!this.isModified("dateFormat")&&this.useFieldInfo&&t?esriFormatToGeocortexFormat(t):this._getSetting("dateFormat")}set dateFormat(e){this._setSetting("dateFormat",e)}};FieldExtensionFormatSettings=__decorate([serializable],FieldExtensionFormatSettings);
@@ -1,10 +1,10 @@
1
1
  import { EntityBase } from "../Entity.js";
2
2
  import type { Feature } from "../data/Feature.js";
3
- import { FeatureSet } from "../data/FeatureSet.js";
3
+ import type { FeatureSet } from "../data/FeatureSet.js";
4
4
  import type { FeatureSource } from "../data/FeatureSource.js";
5
5
  import type { PropertyDefs } from "../support/Serializable.js";
6
6
  import type { FeatureStream } from "./FeatureStream.js";
7
- import type { Cardinality, Relationship, RelationshipProperties } from "./_Relationship.js";
7
+ import type { Cardinality, Relationship, RelationshipProperties, RelationshipType } from "./_Relationship.js";
8
8
  /**
9
9
  * A base class for implementations of {@link Relationship}.
10
10
  */
@@ -28,7 +28,11 @@ export declare abstract class RelationshipBase<TProperties extends RelationshipP
28
28
  /**
29
29
  * @inheritdoc
30
30
  */
31
- protected get _itemType(): string;
31
+ abstract readonly relationshipType: RelationshipType;
32
+ /**
33
+ * @inheritdoc
34
+ */
35
+ protected readonly _itemType: string;
32
36
  private _source;
33
37
  /**
34
38
  * @inheritdoc
@@ -1 +1 @@
1
- import{EntityBase}from"../Entity.js";import{InvalidOperationError}from"../InvalidOperationError.js";import{ItemType}from"../ItemType.js";import{FeatureSet}from"../data/FeatureSet.js";import{checkArg}from"../utilities/checkArg.js";const ERR_NO_FEATURE_SOURCE="Cannot get related features without feature source.";export class RelationshipBase extends EntityBase{get source(){return this._source}get _itemType(){return ItemType.RELATIONSHIP}async getRelatedFeatures(e){if(checkArg("feature",e).isNotMissing(),!this.source)throw new InvalidOperationError(ERR_NO_FEATURE_SOURCE);return this._getRelatedFeatures(e)}async getAllRelatedFeatures(e){if(checkArg("feature",e).isNotMissing(),!this.source)throw new InvalidOperationError(ERR_NO_FEATURE_SOURCE);let t;return t=Array.isArray(e)?e:e instanceof FeatureSet?[...e]:await e.toArray(),this._getAllRelatedFeatures(t)}_setSource(e){this._source=e}_getSerializableProperties(){return{...super._getSerializableProperties(),title:"initial"}}}
1
+ import{EntityBase}from"../Entity.js";import{InvalidOperationError}from"../InvalidOperationError.js";import{isFeatureSet,ItemType}from"../ItemType.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),this._itemType=ItemType.RELATIONSHIP}get source(){return this._source}async getRelatedFeatures(e){if(checkArg("feature",e).isNotMissing(),!this.source)throw new InvalidOperationError(ERR_NO_FEATURE_SOURCE);return this._getRelatedFeatures(e)}async getAllRelatedFeatures(e){if(checkArg("feature",e).isNotMissing(),!this.source)throw new InvalidOperationError(ERR_NO_FEATURE_SOURCE);let t;return t=Array.isArray(e)?e:isFeatureSet(e)?[...e]:await e.toArray(),this._getAllRelatedFeatures(t)}_setSource(e){this._source=e}_getSerializableProperties(){return{...super._getSerializableProperties(),title:"initial"}}}
package/data/Schema.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import PopupTemplate from "@arcgis/core/PopupTemplate";
2
2
  import type SpatialReference from "@arcgis/core/geometry/SpatialReference";
3
- import FeatureType from "@arcgis/core/layers/support/FeatureType";
3
+ import type FeatureType from "@arcgis/core/layers/support/FeatureType";
4
4
  import Field from "@arcgis/core/layers/support/Field";
5
5
  import FieldInfo from "@arcgis/core/popup/FieldInfo";
6
6
  import { Field as PortalField } from "../portal/Field.js";
package/data/Schema.js CHANGED
@@ -1 +1 @@
1
- var Schema_1;import{__decorate}from"tslib";import PopupTemplate from"@arcgis/core/PopupTemplate";import FeatureType from"@arcgis/core/layers/support/FeatureType";import Field from"@arcgis/core/layers/support/Field";import FieldInfo from"@arcgis/core/popup/FieldInfo";import{InvalidOperationError}from"../InvalidOperationError.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{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_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");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){var i;!(null===(i=this._featureSettings)||void 0===i?void 0:i.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})}findFieldByName(e){return this.fields.find((i=>i.name===e))}toJSON(e="all"){var i;const t=filterJSONProperties(this._getSerializableProperties(),this,e)||{},s=null===(i=t.fieldExtensions)||void 0===i?void 0:i.filter((e=>{var i;const t=this.parent;return!(null===(i=null==t?void 0:t.fieldExtensions)||void 0===i?void 0:i.some((i=>i.id===e.id)))})),{fields:l}=t;if(t)for(const e of Object.keys(t))this.isModified(e)||delete t[e];if(l&&(t.fields=l),(null==s?void 0:s.length)&&(t.fieldExtensions=s),!shouldExcludeDefaults(e)||!isDefault(t))return t}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=>e instanceof Field?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.map((i=>i.toJSON(e))).filter((e=>this._alwaysSerializeFieldExtensions||!(e&&2===Object.keys(e).length&&e.id&&e.field))).toArray(),deserialize:e=>{e&&compare(this.fieldExtensions,e,{onNew:(e,i)=>{this.fieldExtensions.add(e instanceof FieldExtension?e:new FieldExtension(e),i)},onMatch:(e,i,t,s)=>{i instanceof FieldExtension||e.assignProperties(i),t!==s&&this.fieldExtensions.reorder(e,s)},onMissing:e=>{this._alwaysSerializeFieldExtensions&&this.fieldExtensions.remove(e)},equals:(e,i)=>i instanceof FieldExtension?i===e:!(!(null==i?void 0:i.field)||!FieldExtension.matchesRef(e,i.field))||e.id===i.id})}},types:{serialize:!1,deserialize:e=>{if(!e)return;const i=e.map((e=>e instanceof FeatureType?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)})),e.watch("_fields.length",(()=>this.notifyChange("length")))}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}clone(){return new FieldCollectionImpl(this._schema)}add(e,i){checkArg("field",e).isNotMissing();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)}removeAt(e){checkArg("index",e).isNotMissing();const i=this.getItemAt(e);if(!i)return;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){this._schema._fields.sort(e)}}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)}this._onAdded(e)}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){this._schema.fields.sort(((i,t)=>e(this._forField(i),this._forField(t))))}_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 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_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");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){var i;!(null===(i=this._featureSettings)||void 0===i?void 0:i.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})}findFieldByName(e){return this.fields.find((i=>i.name===e))}toJSON(e="all"){var i;const t=filterJSONProperties(this._getSerializableProperties(),this,e)||{},s=null===(i=t.fieldExtensions)||void 0===i?void 0:i.filter((e=>{var i;const t=this.parent;return!(null===(i=null==t?void 0:t.fieldExtensions)||void 0===i?void 0:i.some((i=>i.id===e.id)))})),{fields:l}=t;if(t)for(const e of Object.keys(t))this.isModified(e)||delete t[e];if(l&&(t.fields=l),(null==s?void 0:s.length)&&(t.fieldExtensions=s),!shouldExcludeDefaults(e)||!isDefault(t))return t}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.map((i=>i.toJSON(e))).filter((e=>this._alwaysSerializeFieldExtensions||!(e&&2===Object.keys(e).length&&e.id&&e.field))).toArray(),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:!(!(null==i?void 0: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)})),e.watch("_fields.length",(()=>this.notifyChange("length")))}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}clone(){return new FieldCollectionImpl(this._schema)}add(e,i){checkArg("field",e).isNotMissing();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)}removeAt(e){checkArg("index",e).isNotMissing();const i=this.getItemAt(e);if(!i)return;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){this._schema._fields.sort(e)}}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)}this._onAdded(e)}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){this._schema.fields.sort(((i,t)=>e(this._forField(i),this._forField(t))))}_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,5 +1,6 @@
1
1
  import type { Entity, EntityBaseProperties } from "../Entity.js";
2
2
  import type { Observable } from "../support/Observable.js";
3
+ import type { Serializable } from "../support/Serializable.js";
3
4
  import type { Feature } from "./Feature.js";
4
5
  import type { FeatureSet } from "./FeatureSet.js";
5
6
  import type { FeatureSource } from "./FeatureSource.js";
@@ -21,7 +22,7 @@ export interface RelationshipProperties extends EntityBaseProperties {
21
22
  /**
22
23
  * Describes a relationship between a {@link FeatureSource} and another source.
23
24
  */
24
- export interface Relationship extends Observable, Entity {
25
+ export interface Relationship extends Observable, Entity, Serializable<RelationshipProperties> {
25
26
  /**
26
27
  * The human-readable name for the relationship.
27
28
  */
@@ -38,6 +39,10 @@ export interface Relationship extends Observable, Entity {
38
39
  * The cardinality of the relationship.
39
40
  */
40
41
  readonly cardinality: Cardinality;
42
+ /**
43
+ * The type of relationship.
44
+ */
45
+ readonly relationshipType: RelationshipType;
41
46
  /**
42
47
  * Gets features that are related to the given feature.
43
48
  */
@@ -1,6 +1,6 @@
1
1
  import Collection from "@arcgis/core/core/Collection";
2
2
  import type SpatialReference from "@arcgis/core/geometry/SpatialReference";
3
- import Layer from "@arcgis/core/layers/Layer";
3
+ import type Layer from "@arcgis/core/layers/Layer";
4
4
  import type Field from "@arcgis/core/layers/support/Field";
5
5
  import type { MapExtension } from "../mapping/MapExtension.js";
6
6
  import { Table as PortalTable } from "../portal/Table.js";
@@ -72,7 +72,7 @@ export declare abstract class TableExtension<TProperties extends TableExtensionP
72
72
  /**
73
73
  * @inheritdoc
74
74
  */
75
- protected get _itemType(): string;
75
+ protected readonly _itemType: string;
76
76
  private _table;
77
77
  private _mapExtension;
78
78
  private _deferredTableProperties;
@@ -1 +1 @@
1
- import{__decorate}from"tslib";import Collection from"@arcgis/core/core/Collection";import Layer from"@arcgis/core/layers/Layer";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}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});export class TableExtension extends FeatureSourceBase{constructor(e){super(e);const{table:t}={...this.getDefaults(),...e};if(t instanceof Layer)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?this.table.title:void 0}get _itemType(){return ItemType.TABLE_EXTENSION}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){var i,r,s,a;if(!e||!t)return!1;const o=null!==(r=null===(i=e.table)||void 0===i?void 0:i.id)&&void 0!==r?r:e._deferredTableProperties.id,l=null!==(a=null===(s=e.table)||void 0===s?void 0:s.title)&&void 0!==a?a:e._deferredTableProperties.title,n=t.$ref;return"string"==typeof n?o===n||l===n:!!n&&(o===n.id||l===n.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(){var e,t;if(this._table||!this._deferredTableProperties||!this.mapExtension)return;let i;i="string"==typeof this._deferredTableProperties.$ref?{id:this._deferredTableProperties.$ref,title:this._deferredTableProperties.$ref}:this._deferredTableProperties.$ref;let r=null===(e=this._mapExtension.map)||void 0===e?void 0:e.tables.find((e=>e.id===i.id));if(r||(r=null===(t=this._mapExtension.map)||void 0===t?void 0:t.tables.find((e=>e.title===i.title))),r&&this._isSupportedTable(r)){this._setTable(r);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(e instanceof Layer){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 "${null==e?void 0: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=null!=t?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;const t=e.table;if(null==t?void 0:t.fields)this._onTableResolved(e.table);else{this._collection=new Collection;const t=e.watch(["table","table.loaded"],(()=>{const i=e.table;(null==i?void 0:i.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}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});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?this.table.title:void 0}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){var i,r,s,a;if(!e||!t)return!1;const o=null!==(r=null===(i=e.table)||void 0===i?void 0:i.id)&&void 0!==r?r:e._deferredTableProperties.id,l=null!==(a=null===(s=e.table)||void 0===s?void 0:s.title)&&void 0!==a?a:e._deferredTableProperties.title,n=t.$ref;return"string"==typeof n?o===n||l===n:!!n&&(o===n.id||l===n.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(){var e,t;if(this._table||!this._deferredTableProperties||!this.mapExtension)return;let i;i="string"==typeof this._deferredTableProperties.$ref?{id:this._deferredTableProperties.$ref,title:this._deferredTableProperties.$ref}:this._deferredTableProperties.$ref;let r=null===(e=this._mapExtension.map)||void 0===e?void 0:e.tables.find((e=>e.id===i.id));if(r||(r=null===(t=this._mapExtension.map)||void 0===t?void 0:t.tables.find((e=>e.title===i.title))),r&&this._isSupportedTable(r)){this._setTable(r);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 "${null==e?void 0: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=null!=t?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;const t=e.table;if(null==t?void 0:t.fields)this._onTableResolved(e.table);else{this._collection=new Collection;const t=e.watch(["table","table.loaded"],(()=>{const i=e.table;(null==i?void 0:i.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};
package/data/convert.js CHANGED
@@ -1 +1 @@
1
- import Extent from"@arcgis/core/geometry/Extent";import Multipoint from"@arcgis/core/geometry/Multipoint";import Point from"@arcgis/core/geometry/Point";import Polygon from"@arcgis/core/geometry/Polygon";import Polyline from"@arcgis/core/geometry/Polyline";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}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:i,outFields:s,rowDelimiter:m}=o,l=[];a&&l.push("\ufeff");const u=_getGeometryColumns(r,o),c=_getAttributeColumns(r,s,e.schema,!0),f=_getAttributeColumns(r,s,e.schema,!1);if(n){const e=[];for(const t of u)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(i)+m;l.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(i)}${m}`;l.push(a)})));return new Blob(l,{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:!(null==t?void 0:t.primaryKeyField)},a=_parseCSV(r,o.rowDelimiter||_parseRowDelimiter(r),o.delimiter),n=_parseGeometries(a,o),i=_parseSchema(a,n,o),s=await _parseFeatures(a,n,i,o);return new FeatureSet({features:s,schema:i})}export async function toXLSX(e,t){var r;checkArg("featureSet",e).isNotMissing();const o=Array.from(e),a={...{useFormattedValues:!1,includeHeaderRow:!0,escapeFormulaChars:!0,geometryFormat:o.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:n,includeHeaderRow:i,numberFormat:s}=a,m=[],l=_getGeometryColumns(o,a),u=_getAttributeColumns(o,n,e.schema,!0),c=_getAttributeColumns(o,n,e.schema,!1);if(i){const t=l.concat(u).concat(_getXlsxColumnName(c,e.source));m.push(t)}await Promise.all(o.map((async e=>{const t=[];t.push(...await _getGeometry(e.geometry,a));for(const r of u){const o=_toXLSXValue(e.attributes.get(r),a);t.push(o)}for(const r of c){const o=_toXLSXValue(_getAttributeValue(e,r,a),a);t.push(o)}m.push(t)})));const f=await import("xlsx"),p={SheetNames:[],Sheets:{}},d=f.utils.aoa_to_sheet(m,{cellDates:!0});for(const e of Object.keys(d).filter((e=>!e.startsWith("!")))){const t=d[e];"d"===t.t?t.z=_convertToExcelDateFormatString(null!==(r=a.dateFormat)&&void 0!==r?r:DateFormat.ROUND_TRIP):"n"===t.t&&(t.z=_convertToExcelNumberFormatString(s))}p.SheetNames.push(a.sheetName),p.Sheets[a.sheetName]=d;const y=f.write(p,{type:"binary",bookType:"xlsx",compression:!0,bookSST:!0,cellDates:!0}),g=new Uint8Array(y.length);for(let e=0;e<y.length;e++)g[e]=y.charCodeAt(e);return new Blob([g.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:!(null==t?void 0:t.primaryKeyField)},o=await _parseXLSX(e,r),a=_parseGeometries(o,r),n=_parseSchema(o,a,r),i=await _parseFeatures(o,a,n,r);return new FeatureSet({features:i,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:i,outSpatialReference:s,fileName:m}=n,l=new Map,u=a.filter((e=>e.geometry instanceof Point));l.set(u.some((e=>e.geometry.hasZ||e.geometry.hasM))?"POINTZ":"POINT",u);const c=a.filter((e=>e.geometry instanceof Multipoint));l.set(c.some((e=>e.geometry.hasZ||e.geometry.hasM))?"MULTIPOINTZ":"MULTIPOINT",c);const f=a.filter((e=>e.geometry instanceof Polyline));l.set(f.some((e=>e.geometry.hasZ||e.geometry.hasM))?"POLYLINEZ":"POLYLINE",f);const p=a.filter((e=>e.geometry instanceof Polygon||e.geometry instanceof Extent));l.set(p.some((e=>e.geometry.hasZ||e.geometry.hasM))?"POLYGONZ":"POLYGON",p);const d=_getAttributeColumns(a,i,e.schema,!0);let y=_getAttributeColumns(a,i,e.schema,!1);y=d.concat(y);const g=new r,h=Array.from(l.keys()).filter((e=>l.get(e).length>0));await Promise.all(h.map((async t=>{const r=l.get(t),a=await Promise.all(r.map((e=>_projectGeometry(e.geometry,s)))),i=await _getDBaseSpatialReferenceWKT(a),u=n.useFormattedValues?Object.assign({},...y.map((e=>({[e]:DBaseTypes.STRING})))):_getDBaseColumnTypes(r,y,e.schema,"timestamp"===n.dateFormat),c=_getDBaseGeometries(a),f=_getDbaseValues(r,y,u,n);o.write(f,t,c,((e,r)=>{const o=h.length>1?`${m}_${t.toLowerCase()}`:m;g.file(`${o}.shp`,r.shp.buffer,{binary:!0}),g.file(`${o}.shx`,r.shx.buffer,{binary:!0}),g.file(`${o}.dbf`,r.dbf.buffer,{binary:!0}),g.file(`${o}.prj`,i)}))})));const F=g.generate({type:"uint8array"});return new Blob([F.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:!(null==t?void 0: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},n]=await Promise.all([import("jszip"),import("shpjs")]),i=await o,s=new a(new Uint8Array(i)),m=s.filter((()=>!0)).map((e=>e.name));let l,u=m.filter((e=>e.endsWith(".shp"))).map((e=>e.substring(0,e.length-4)));if(u=_parseShapefileNames(u),m.some((e=>e.endsWith(".prj")))&&!u.every((e=>m.includes(`${e}.prj`))))throw new Error("Shapefile zip must contain the same prj file for each separate shapefile");for(const e of m.filter((e=>e.endsWith(".prj")))){const t=s.file(e).asText();if(l){if(t!==l)throw new Error("Shapefile zip must contain the same prj file for each separate shapefile")}else l=t}const c={geometries:[],columnCount:0,columnIndex:0};let f=[];for(const e of u){if(!m.includes(`${e}.shx`)||!m.includes(`${e}.dbf`))throw new Error("Shapefile must contain shp, shx, and dbf files.");const t=s.file(`${e}.shp`).asUint8Array(),r=n.parseShp(t),o=s.file(`${e}.dbf`).asUint8Array(),a=n.parseDbf(o);if(a.length!==r.length)throw new Error("Shapefile must contain shp, shx, and dbf files.");const i=await Promise.all(r.map((e=>_parseShpGeometry(e,l))));c.geometries=c.geometries.concat(i),f=f.concat(a)}const p=_parseDBaseData(f),d=_parseSchema(p,c,r),y=await _parseFeatures(p,c,d,r);return new FeatureSet({features:y,schema:d})}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){var r;const o=null===(r=null==t?void 0:t.schema)||void 0===r?void 0:r.fieldExtensions.initializedItems.map((e=>e.field));return e.map((e=>{var t,r;return null!==(r=null===(t=null==o?void 0:o.find((t=>t.name===e)))||void 0===t?void 0:t.alias)&&void 0!==r?r:e}))}function _getDefaultOutFields(e){var t,r,o,a,n,i,s,m;if(!e)return["*"];const l=null===(t=e.featureSettings.popupTemplate)||void 0===t?void 0:t.content,u=Array.isArray(l)?null===(a=null===(o=null===(r=l.find((e=>"fields"===e.type)))||void 0===r?void 0:r.fieldInfos)||void 0===o?void 0:o.filter((e=>e.visible)))||void 0===a?void 0:a.map((e=>e.fieldName)):void 0;return null!==(m=null!=u?u:null===(s=null===(i=null===(n=e.featureSettings.popupTemplate)||void 0===n?void 0:n.fieldInfos)||void 0===i?void 0:i.filter((e=>e.visible)))||void 0===s?void 0:s.map((e=>e.fieldName)))&&void 0!==m?m:["*"]}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(!(r instanceof Point))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(!(r instanceof Point))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(!(r instanceof Point))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(null==e?void 0: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){var o,a,n;if(r.useFormattedValues||_hasCodedDomain(e,t))return null!==(o=e.presentableAttributes.get(t))&&void 0!==o?o:e.attributes.get(t);if("date"===(null===(a=e.schema.findFieldByName(t))||void 0===a?void 0:a.type)){const r=parseDate(e.attributes.get(t));if(!isNaN(r.getTime()))return r}return null!==(n=e.attributes.get(t))&&void 0!==n?n:e.presentableAttributes.get(t)}function _hasCodedDomain(e,t){var r,o,a,n,i;return t===e.schema.typeIdField||("coded-value"===(null===(a=null===(o=null===(r=e.type)||void 0===r?void 0:r.domains)||void 0===o?void 0:o[t])||void 0===a?void 0:a.type)||"coded-value"===(null===(i=null===(n=e.schema.findFieldByName(t))||void 0===n?void 0:n.domain)||void 0===i?void 0:i.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 i=-1;return _forDelimiter(n,'"',((e,o)=>{if(o===n.length)return!0;if(i<0){if(o!==n.length)return i=o,!0}else if(o===i+'"'.length)return i=-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,i=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 s=o+t.length;if(!a){const e=r(i,o);if(i=s,!e)break}n=s}r(i,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=null==e?void 0: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,i=a?3:2;return{columnCount:i,columnIndex:e,geometries:r.map((r=>{if(r.length>=e+i&&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}".`))}})(null!=r?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){var o;const a={fields:[]};let n=0;for(let o=t.columnCount;o<e[0].length;o++){if(i=o,0!==t.columnCount&&i>=t.columnIndex&&i<t.columnIndex+t.columnCount)continue;const s=_parseFieldType(e,o,r);let m=e[0][o].raw.toString(),l=m.replace(FIELD_NAME_REGEX,"_");if(r.includeHeaderRow||(l="field"+ ++n,m=translate("gcx.api.data.convert.import-field-alias",n)),!l)throw new Error("Error parsing CSV or XLSX: Header cannot contain blank values");a.fields.push({alias:m,name:l,type:s})}var i;if(a.spatialReference=r.outSpatialReference,null===(o=t.geometries)||void 0===o?void 0:o.length){const e=t.geometries.filter((e=>void 0!==e)).map((e=>e.type)),r=e[0];a.geometryType=e.every((e=>e===r))?r:void 0}if(r.generatePrimaryKey&&!a.fields.find((e=>"esriFieldTypeOID"===e.type))){const e=a.fields.length+1,t=!!a.fields.find((e=>"id"===e.name.toLowerCase()));a.fields.push({name:t?`field${e}`:"id",alias:t?translate("gcx.api.data.convert.import-field-alias",e):"id",type:"esriFieldTypeOID"})}return a}function _parseFieldType(e,t,r){var o;let a=!1,n=!0,i=!0,s=!0;const m=new Set,l=r.includeHeaderRow?e[0]:[],u=r.includeHeaderRow?e.slice(1):e;for(const e of u){const o=e[t];""!==o.raw&&(m.add(o.raw),a=!0,n&&(n=isNumeric(o.raw)||Number.isNaN(o.raw)),i&&(i=o.raw instanceof Date||parseDate(r.dateFormat||DEFAULT_PARSING_FORMATS,o.raw)!==INVALID_DATE),s&&(s=parseDate(r.dateFormat||DEFAULT_EXCEL_DATE_FORMATS,o.formatted)!==INVALID_DATE))}const c=m.size===u.length;return r.primaryKeyField&&(null===(o=l[t])||void 0===o?void 0:o.raw)===r.primaryKeyField||r.detectOid&&a&&c&&n?(r.detectOid=!1,"esriFieldTypeOID"):a&&s?"esriFieldTypeDate":a&&n?"esriFieldTypeDouble":a&&i?"esriFieldTypeDate":"esriFieldTypeString"}async function _parseFeatures(e,t,r,o){const a=[],n=o.includeHeaderRow?e.slice(1):e,i=(e,r)=>0===t.columnCount||(r<t.columnIndex||r>=t.columnIndex+t.columnCount);return await Promise.all(n.map((async(e,n)=>{var s;const m=new Feature;for(let t=0;t<r.fields.length;t++){const a=r.fields[t],l=e.filter(i);if(o.outFields.includes("*")||o.outFields.includes(a.name)){let e=await _parseValue(null===(s=l[t])||void 0===s?void 0:s.raw,a,o);"esriFieldTypeOID"===a.type&&null===e&&(e=n),m.attributes.set(a.name,e)}}t.geometries&&(m.geometry=await _projectGeometry(t.geometries[n],o.outSpatialReference)),a.push(m)}))),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){const r=(new Date).getTimezoneOffset()-e.getTimezoneOffset(),o=new Date(e.getTime()+60*r*1e3);return"timestamp"===t.dateFormat?o.getTime():o}}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 i=r.read(a,{type:"binary",cellDates:!0}),s=t.sheetName||i.SheetNames[0],m=i.Sheets[s];o(m)},n.onerror=()=>{a(n.error)},n.readAsArrayBuffer(e)})),a=await o,n=r.utils.decode_range(a["!ref"]),i=[];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:""})}i.push(t)}return i}async function _getDBaseSpatialReferenceWKT(e){let t;for(const r of e)if(t){if(r.spatialReference.wkid!==t)throw new Error("Cannot create shapefile that contains geometries with different spatial references.")}else t=r.spatialReference.wkid;return t||(t=SpatialReference.WGS84.wkid),esriWkidToWkt(t)}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 i=(e,t)=>{var r;return null!==(r=e.attributes.get(t))&&void 0!==r?r:e.presentableAttributes.get(t)};e.every((e=>i(e,n)instanceof Date||void 0===i(e,n)))&&e.some((e=>i(e,n)instanceof Date))?a[n]=o?DBaseTypes.NUMBER:DBaseTypes.DATE:e.every((e=>"number"==typeof i(e,n)||void 0===i(e,n)))&&e.some((e=>"number"==typeof i(e,n)))?a[n]=DBaseTypes.NUMBER:e.every((e=>"boolean"==typeof i(e,n)||void 0===i(e,n)))&&e.some((e=>"boolean"==typeof i(e,n)))?a[n]=DBaseTypes.BOOLEAN:a[n]=DBaseTypes.STRING}return a}function _getDBaseGeometries(e){return e.map((e=>{if(e instanceof Point){const t=[e.x,e.y];return e.hasZ&&t.push(e.z),e.hasM&&t.push(e.m),_padZValues(t,e)}if(e instanceof Multipoint)return _padZValuesArray(e.points,e);if(e instanceof Polyline)return _padZValues2DArray(e.paths,e);if(e instanceof Polygon)return _padZValues2DArray(e.rings,e);if(e instanceof Extent){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){var o,a;switch(t){case DBaseTypes.NUMBER:return e instanceof Date?e.getTime():parseNumber(e);case DBaseTypes.STRING:return e instanceof Date?formatDate({format:null!==(o=r.dateFormat)&&void 0!==o?o:DateFormat.ROUND_TRIP,timeZone:"UTC"},e):"number"==typeof e?formatNumber(null!==(a=r.numberFormat)&&void 0!==a?a: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="Point"===e.type?_parseShpPointGeometry(e):geoJSONToEsri(e);if(t){let e;const o=await esriWktToWkid(t);if(o&&(e=new SpatialReference({wkid:parseNumber(o)})),!e)throw new Error(`Could go find wkid that matches wkt: ${t}`);r.spatialReference=e}return r}
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:i,outFields:s,rowDelimiter:m}=o,l=[];a&&l.push("\ufeff");const u=_getGeometryColumns(r,o),c=_getAttributeColumns(r,s,e.schema,!0),f=_getAttributeColumns(r,s,e.schema,!1);if(n){const e=[];for(const t of u)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(i)+m;l.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(i)}${m}`;l.push(a)})));return new Blob(l,{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:!(null==t?void 0:t.primaryKeyField)},a=_parseCSV(r,o.rowDelimiter||_parseRowDelimiter(r),o.delimiter),n=_parseGeometries(a,o),i=_parseSchema(a,n,o),s=await _parseFeatures(a,n,i,o);return new FeatureSet({features:s,schema:i})}export async function toXLSX(e,t){var r;checkArg("featureSet",e).isNotMissing();const o=Array.from(e),a={...{useFormattedValues:!1,includeHeaderRow:!0,escapeFormulaChars:!0,geometryFormat:o.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:n,includeHeaderRow:i,numberFormat:s}=a,m=[],l=_getGeometryColumns(o,a),u=_getAttributeColumns(o,n,e.schema,!0),c=_getAttributeColumns(o,n,e.schema,!1);if(i){const t=l.concat(u).concat(_getXlsxColumnName(c,e.source));m.push(t)}await Promise.all(o.map((async e=>{const t=[];t.push(...await _getGeometry(e.geometry,a));for(const r of u){const o=_toXLSXValue(e.attributes.get(r),a);t.push(o)}for(const r of c){const o=_toXLSXValue(_getAttributeValue(e,r,a),a);t.push(o)}m.push(t)})));const f=await import("xlsx"),p={SheetNames:[],Sheets:{}},d=f.utils.aoa_to_sheet(m,{cellDates:!0});for(const e of Object.keys(d).filter((e=>!e.startsWith("!")))){const t=d[e];"d"===t.t?t.z=_convertToExcelDateFormatString(null!==(r=a.dateFormat)&&void 0!==r?r:DateFormat.ROUND_TRIP):"n"===t.t&&(t.z=_convertToExcelNumberFormatString(s))}p.SheetNames.push(a.sheetName),p.Sheets[a.sheetName]=d;const y=f.write(p,{type:"binary",bookType:"xlsx",compression:!0,bookSST:!0,cellDates:!0}),g=new Uint8Array(y.length);for(let e=0;e<y.length;e++)g[e]=y.charCodeAt(e);return new Blob([g.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:!(null==t?void 0:t.primaryKeyField)},o=await _parseXLSX(e,r),a=_parseGeometries(o,r),n=_parseSchema(o,a,r),i=await _parseFeatures(o,a,n,r);return new FeatureSet({features:i,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:i,outSpatialReference:s,fileName:m}=n,l=new Map,u=a.filter((e=>isPoint(e.geometry)));l.set(u.some((e=>e.geometry.hasZ||e.geometry.hasM))?"POINTZ":"POINT",u);const c=a.filter((e=>isMultipoint(e.geometry)));l.set(c.some((e=>e.geometry.hasZ||e.geometry.hasM))?"MULTIPOINTZ":"MULTIPOINT",c);const f=a.filter((e=>isPolyline(e.geometry)));l.set(f.some((e=>e.geometry.hasZ||e.geometry.hasM))?"POLYLINEZ":"POLYLINE",f);const p=a.filter((e=>isPolygon(e.geometry)||isExtent(e.geometry)));l.set(p.some((e=>e.geometry.hasZ||e.geometry.hasM))?"POLYGONZ":"POLYGON",p);const d=_getAttributeColumns(a,i,e.schema,!0);let y=_getAttributeColumns(a,i,e.schema,!1);y=d.concat(y);const g=new r,h=Array.from(l.keys()).filter((e=>l.get(e).length>0));await Promise.all(h.map((async t=>{const r=l.get(t),a=await Promise.all(r.map((e=>_projectGeometry(e.geometry,s)))),i=await _getDBaseSpatialReferenceWKT(a),u=n.useFormattedValues?Object.assign({},...y.map((e=>({[e]:DBaseTypes.STRING})))):_getDBaseColumnTypes(r,y,e.schema,"timestamp"===n.dateFormat),c=_getDBaseGeometries(a),f=_getDbaseValues(r,y,u,n);o.write(f,t,c,((e,r)=>{const o=h.length>1?`${m}_${t.toLowerCase()}`:m;g.file(`${o}.shp`,r.shp.buffer,{binary:!0}),g.file(`${o}.shx`,r.shx.buffer,{binary:!0}),g.file(`${o}.dbf`,r.dbf.buffer,{binary:!0}),g.file(`${o}.prj`,i)}))})));const F=g.generate({type:"uint8array"});return new Blob([F.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:!(null==t?void 0: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},n]=await Promise.all([import("jszip"),import("shpjs")]),i=await o,s=new a(new Uint8Array(i)),m=s.filter((()=>!0)).map((e=>e.name));let l,u=m.filter((e=>e.endsWith(".shp"))).map((e=>e.substring(0,e.length-4)));if(u=_parseShapefileNames(u),m.some((e=>e.endsWith(".prj")))&&!u.every((e=>m.includes(`${e}.prj`))))throw new Error("Shapefile zip must contain the same prj file for each separate shapefile");for(const e of m.filter((e=>e.endsWith(".prj")))){const t=s.file(e).asText();if(l){if(t!==l)throw new Error("Shapefile zip must contain the same prj file for each separate shapefile")}else l=t}const c={geometries:[],columnCount:0,columnIndex:0};let f=[];for(const e of u){if(!m.includes(`${e}.shx`)||!m.includes(`${e}.dbf`))throw new Error("Shapefile must contain shp, shx, and dbf files.");const t=s.file(`${e}.shp`).asUint8Array(),r=n.parseShp(t),o=s.file(`${e}.dbf`).asUint8Array(),a=n.parseDbf(o);if(a.length!==r.length)throw new Error("Shapefile must contain shp, shx, and dbf files.");const i=await Promise.all(r.map((e=>_parseShpGeometry(e,l))));c.geometries=c.geometries.concat(i),f=f.concat(a)}const p=_parseDBaseData(f),d=_parseSchema(p,c,r),y=await _parseFeatures(p,c,d,r);return new FeatureSet({features:y,schema:d})}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){var r;const o=null===(r=null==t?void 0:t.schema)||void 0===r?void 0:r.fieldExtensions.initializedItems.map((e=>e.field));return e.map((e=>{var t,r;return null!==(r=null===(t=null==o?void 0:o.find((t=>t.name===e)))||void 0===t?void 0:t.alias)&&void 0!==r?r:e}))}function _getDefaultOutFields(e){var t,r,o,a,n,i,s,m;if(!e)return["*"];const l=null===(t=e.featureSettings.popupTemplate)||void 0===t?void 0:t.content,u=Array.isArray(l)?null===(a=null===(o=null===(r=l.find((e=>"fields"===e.type)))||void 0===r?void 0:r.fieldInfos)||void 0===o?void 0:o.filter((e=>e.visible)))||void 0===a?void 0:a.map((e=>e.fieldName)):void 0;return null!==(m=null!=u?u:null===(s=null===(i=null===(n=e.featureSettings.popupTemplate)||void 0===n?void 0:n.fieldInfos)||void 0===i?void 0:i.filter((e=>e.visible)))||void 0===s?void 0:s.map((e=>e.fieldName)))&&void 0!==m?m:["*"]}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(null==e?void 0: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){var o,a,n;if(r.useFormattedValues||_hasCodedDomain(e,t))return null!==(o=e.presentableAttributes.get(t))&&void 0!==o?o:e.attributes.get(t);if("date"===(null===(a=e.schema.findFieldByName(t))||void 0===a?void 0:a.type)){const r=parseDate(e.attributes.get(t));if(!isNaN(r.getTime()))return r}return null!==(n=e.attributes.get(t))&&void 0!==n?n:e.presentableAttributes.get(t)}function _hasCodedDomain(e,t){var r,o,a,n,i;return t===e.schema.typeIdField||("coded-value"===(null===(a=null===(o=null===(r=e.type)||void 0===r?void 0:r.domains)||void 0===o?void 0:o[t])||void 0===a?void 0:a.type)||"coded-value"===(null===(i=null===(n=e.schema.findFieldByName(t))||void 0===n?void 0:n.domain)||void 0===i?void 0:i.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 i=-1;return _forDelimiter(n,'"',((e,o)=>{if(o===n.length)return!0;if(i<0){if(o!==n.length)return i=o,!0}else if(o===i+'"'.length)return i=-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,i=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 s=o+t.length;if(!a){const e=r(i,o);if(i=s,!e)break}n=s}r(i,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=null==e?void 0: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,i=a?3:2;return{columnCount:i,columnIndex:e,geometries:r.map((r=>{if(r.length>=e+i&&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}".`))}})(null!=r?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){var o;const a={fields:[]};let n=0;for(let o=t.columnCount;o<e[0].length;o++){if(i=o,0!==t.columnCount&&i>=t.columnIndex&&i<t.columnIndex+t.columnCount)continue;const s=_parseFieldType(e,o,r);let m=e[0][o].raw.toString(),l=m.replace(FIELD_NAME_REGEX,"_");if(r.includeHeaderRow||(l="field"+ ++n,m=translate("gcx.api.data.convert.import-field-alias",n)),!l)throw new Error("Error parsing CSV or XLSX: Header cannot contain blank values");a.fields.push({alias:m,name:l,type:s})}var i;if(a.spatialReference=r.outSpatialReference,null===(o=t.geometries)||void 0===o?void 0:o.length){const e=t.geometries.filter((e=>void 0!==e)).map((e=>e.type)),r=e[0];a.geometryType=e.every((e=>e===r))?r:void 0}if(r.generatePrimaryKey&&!a.fields.find((e=>"esriFieldTypeOID"===e.type))){const e=a.fields.length+1,t=!!a.fields.find((e=>"id"===e.name.toLowerCase()));a.fields.push({name:t?`field${e}`:"id",alias:t?translate("gcx.api.data.convert.import-field-alias",e):"id",type:"esriFieldTypeOID"})}return a}function _parseFieldType(e,t,r){var o;let a=!1,n=!0,i=!0,s=!0;const m=new Set,l=r.includeHeaderRow?e[0]:[],u=r.includeHeaderRow?e.slice(1):e;for(const e of u){const o=e[t];""!==o.raw&&(m.add(o.raw),a=!0,n&&(n=isNumeric(o.raw)||Number.isNaN(o.raw)),i&&(i=o.raw instanceof Date||parseDate(r.dateFormat||DEFAULT_PARSING_FORMATS,o.raw)!==INVALID_DATE),s&&(s=parseDate(r.dateFormat||DEFAULT_EXCEL_DATE_FORMATS,o.formatted)!==INVALID_DATE))}const c=m.size===u.length;return r.primaryKeyField&&(null===(o=l[t])||void 0===o?void 0:o.raw)===r.primaryKeyField||r.detectOid&&a&&c&&n?(r.detectOid=!1,"esriFieldTypeOID"):a&&s?"esriFieldTypeDate":a&&n?"esriFieldTypeDouble":a&&i?"esriFieldTypeDate":"esriFieldTypeString"}async function _parseFeatures(e,t,r,o){const a=[],n=o.includeHeaderRow?e.slice(1):e,i=(e,r)=>0===t.columnCount||(r<t.columnIndex||r>=t.columnIndex+t.columnCount);return await Promise.all(n.map((async(e,n)=>{var s;const m=new Feature;for(let t=0;t<r.fields.length;t++){const a=r.fields[t],l=e.filter(i);if(o.outFields.includes("*")||o.outFields.includes(a.name)){let e=await _parseValue(null===(s=l[t])||void 0===s?void 0:s.raw,a,o);"esriFieldTypeOID"===a.type&&null===e&&(e=n),m.attributes.set(a.name,e)}}t.geometries&&(m.geometry=await _projectGeometry(t.geometries[n],o.outSpatialReference)),a.push(m)}))),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){const r=(new Date).getTimezoneOffset()-e.getTimezoneOffset(),o=new Date(e.getTime()+60*r*1e3);return"timestamp"===t.dateFormat?o.getTime():o}}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 i=r.read(a,{type:"binary",cellDates:!0}),s=t.sheetName||i.SheetNames[0],m=i.Sheets[s];o(m)},n.onerror=()=>{a(n.error)},n.readAsArrayBuffer(e)})),a=await o,n=r.utils.decode_range(a["!ref"]),i=[];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:""})}i.push(t)}return i}async function _getDBaseSpatialReferenceWKT(e){let t;for(const r of e)if(t){if(r.spatialReference.wkid!==t)throw new Error("Cannot create shapefile that contains geometries with different spatial references.")}else t=r.spatialReference.wkid;return t||(t=SpatialReference.WGS84.wkid),esriWkidToWkt(t)}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 i=(e,t)=>{var r;return null!==(r=e.attributes.get(t))&&void 0!==r?r:e.presentableAttributes.get(t)};e.every((e=>i(e,n)instanceof Date||void 0===i(e,n)))&&e.some((e=>i(e,n)instanceof Date))?a[n]=o?DBaseTypes.NUMBER:DBaseTypes.DATE:e.every((e=>"number"==typeof i(e,n)||void 0===i(e,n)))&&e.some((e=>"number"==typeof i(e,n)))?a[n]=DBaseTypes.NUMBER:e.every((e=>"boolean"==typeof i(e,n)||void 0===i(e,n)))&&e.some((e=>"boolean"==typeof i(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){var o,a;switch(t){case DBaseTypes.NUMBER:return e instanceof Date?e.getTime():parseNumber(e);case DBaseTypes.STRING:return e instanceof Date?formatDate({format:null!==(o=r.dateFormat)&&void 0!==o?o:DateFormat.ROUND_TRIP,timeZone:"UTC"},e):"number"==typeof e?formatNumber(null!==(a=r.numberFormat)&&void 0!==a?a: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;const o=await esriWktToWkid(t);if(o&&(e=new SpatialReference({wkid:parseNumber(o)})),!e)throw new Error(`Could go find wkid that matches wkt: ${t}`);r.spatialReference=e}return r}