@arcgis/core 5.2.1 → 5.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/Basemap.d.ts +2 -2
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{67e533748435253aaba6.js → 0284f608d25c654fcc11.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{2d9a1f23ec6ce90723ac.js → 0d99bfb75dcb9fa29080.js} +1 -1
  5. package/assets/esri/core/workers/chunks/0fa29352f2ecf0c515e8.js +1 -0
  6. package/assets/esri/core/workers/chunks/10ad7b35b6800d40444e.js +1 -0
  7. package/assets/esri/core/workers/chunks/1132e28aaa5825b10b6e.js +1 -0
  8. package/assets/esri/core/workers/chunks/{10878932826ddb60fac4.js → 1fcc998421c7c16de2ca.js} +1 -1
  9. package/assets/esri/core/workers/chunks/21e1d423ee33f916547e.js +1 -0
  10. package/assets/esri/core/workers/chunks/251f706d226b1d47ba99.js +1 -0
  11. package/assets/esri/core/workers/chunks/{ba38231193919e093917.js → 2529f12fc16e98c014ca.js} +1 -1
  12. package/assets/esri/core/workers/chunks/2b4dd42920d37b1ff0a9.js +2 -0
  13. package/assets/esri/core/workers/chunks/2b804b5d7ce10f0f0cf0.js +1 -0
  14. package/assets/esri/core/workers/chunks/3537fe95b83a13b156cc.js +1 -0
  15. package/assets/esri/core/workers/chunks/36f31416132de434ec00.js +1 -0
  16. package/assets/esri/core/workers/chunks/3e29ab5ec136e669b633.js +1 -0
  17. package/assets/esri/core/workers/chunks/{36c780a9527c75b36725.js → 40d7e54529d13fdd2bf1.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{2cb209bc51a19487692d.js → 43aef67452fa6ff8d8f9.js} +2 -2
  19. package/assets/esri/core/workers/chunks/449a2dee17b54946f245.js +1 -0
  20. package/assets/esri/core/workers/chunks/{5d42f0898bf30ae940ea.js → 46071e59290bf06bb614.js} +1 -1
  21. package/assets/esri/core/workers/chunks/46d91cd99558304da0c7.js +1 -0
  22. package/assets/esri/core/workers/chunks/4cf72dcccf2be353a701.js +1 -0
  23. package/assets/esri/core/workers/chunks/{e3a742dc0c291b47ba56.js → 510c2eb78f5e12f77bbc.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{7d2be06dfbd92c8b9484.js → 596891426621c403bdef.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{98d1efb6f2439c6344cf.js → 5b2d1c8763a1716677c0.js} +1 -1
  26. package/assets/esri/core/workers/chunks/5bf7de2e2faa55e53629.js +1 -0
  27. package/assets/esri/core/workers/chunks/{042614bf65b7d63025cb.js → 5f49233d5b67a9ad71d7.js} +1 -1
  28. package/assets/esri/core/workers/chunks/604433b02a165d187953.js +1 -0
  29. package/assets/esri/core/workers/chunks/61d36730564c5ac5edab.js +1 -0
  30. package/assets/esri/core/workers/chunks/{094eb9677cdebfaa9e1b.js → 648d5cdfc3e92be3db55.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{bc6fdd9faf8ed54be0cb.js → 6694e2b27fd6ddf44e21.js} +1 -1
  32. package/assets/esri/core/workers/chunks/70268d790c2f1cb83d43.js +1 -0
  33. package/assets/esri/core/workers/chunks/7b45ac83e279fe9516a5.js +1 -0
  34. package/assets/esri/core/workers/chunks/8102f0bf5707c3be3310.js +1 -0
  35. package/assets/esri/core/workers/chunks/{d56fdf5ce5ff53dc0e69.js → 84495695313b01832369.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{31640b41e0ecdff892fa.js → 85b63811ae7bcb6f74b6.js} +2 -2
  37. package/assets/esri/core/workers/chunks/{c4bbe4707e90b7cd0379.js → 8ac4a043a4f185db271f.js} +1 -1
  38. package/assets/esri/core/workers/chunks/8d01dd92f5c897193ab5.js +1 -0
  39. package/assets/esri/core/workers/chunks/900c8569596609183f19.js +2 -0
  40. package/assets/esri/core/workers/chunks/{d1d6154b4af1c9cc497b.js → 934e1f2153e6fad6ed23.js} +1 -1
  41. package/assets/esri/core/workers/chunks/95c9c5677bbe7fd0420a.js +1 -0
  42. package/assets/esri/core/workers/chunks/{b70885deebc6106597ad.js → 983b85727e09c54bede0.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{d20dcd4ce4b0111d924f.js → 9bbc8e5d42921a8050bb.js} +1 -1
  44. package/assets/esri/core/workers/chunks/a07070de96e143a329a4.js +1 -0
  45. package/assets/esri/core/workers/chunks/a17fb26d6ac4895e51a3.js +2 -0
  46. package/assets/esri/core/workers/chunks/{0d52e1b6d38f2670658c.js → a6f74bd1a9c87b9836ca.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{a85cdafbaf1848bb924b.js → a846c94d49df8d4cd5be.js} +1 -1
  48. package/assets/esri/core/workers/chunks/aa4f12fcb9f4ed3dba18.js +1 -0
  49. package/assets/esri/core/workers/chunks/ac10c7d2c4829a150037.js +1 -0
  50. package/assets/esri/core/workers/chunks/{509a74e9334f31b931d4.js → b54ba2bd6b1b90dcc0cc.js} +1 -1
  51. package/assets/esri/core/workers/chunks/bde8f3b3ce5b1d3ee774.js +1 -0
  52. package/assets/esri/core/workers/chunks/c25ae83fd790f181bb42.js +1 -0
  53. package/assets/esri/core/workers/chunks/{dc51dcaa4e2f9a90f5bd.js → c2cbe0f5e8958cf18e58.js} +2 -2
  54. package/assets/esri/core/workers/chunks/c4c55d8a98ba3f51f63c.js +1 -0
  55. package/assets/esri/core/workers/chunks/c5bf19da62a3d31009fe.js +2 -0
  56. package/assets/esri/core/workers/chunks/{2226c20c38e20713bcb5.js.LICENSE.txt → c5bf19da62a3d31009fe.js.LICENSE.txt} +1 -1
  57. package/assets/esri/core/workers/chunks/{2a2a4650dd9b953d317c.js → c93343a91161c4e40c28.js} +1 -1
  58. package/assets/esri/core/workers/chunks/cb4c5544382eb8c4a87f.js +1 -0
  59. package/assets/esri/core/workers/chunks/{2d83ba260dd6bbe38206.js → d05665ddc8d31403aed3.js} +1 -1
  60. package/assets/esri/core/workers/chunks/d24dea0bdb17db07e2b3.js +1 -0
  61. package/assets/esri/core/workers/chunks/d3412518a7b518860fbb.js +1 -0
  62. package/assets/esri/core/workers/chunks/d4bc6d65dff5d0cc93ba.js +1 -0
  63. package/assets/esri/core/workers/chunks/{3048e74e6246324ce6fc.js → d5916500514a41a4758f.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{aea44253c80493ef5755.js → e7b168ba31142c00f765.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{a504a5e06cb89a620799.js → ec8b7476eac4718eb0ac.js} +1 -1
  66. package/assets/esri/core/workers/chunks/f497968055af459c5da4.js +1 -0
  67. package/assets/esri/core/workers/chunks/{d53cc574a21031436c45.js → f79494829a5b65b5b4c9.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{bf4d913e523eae2fda28.js → fa7b189e9b2cc8d4a77f.js} +1 -1
  69. package/assets/esri/core/workers/chunks/fcb4707c2e95099b9f30.js +1 -0
  70. package/assets/esri/core/workers/chunks/{735c1dffc3439bdba3cc.js → fd172c96d2b36032a1d9.js} +1 -1
  71. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ar.json +1 -1
  72. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.bg.json +1 -1
  73. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.bs.json +1 -1
  74. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ca.json +1 -1
  75. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.cs.json +1 -1
  76. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.da.json +1 -1
  77. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.de.json +1 -1
  78. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.el.json +1 -1
  79. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.es.json +1 -1
  80. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.et.json +1 -1
  81. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.fi.json +1 -1
  82. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.fr.json +1 -1
  83. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.he.json +1 -1
  84. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.hr.json +1 -1
  85. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.hu.json +1 -1
  86. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.id.json +1 -1
  87. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.it.json +1 -1
  88. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ja.json +1 -1
  89. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ko.json +1 -1
  90. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.lt.json +1 -1
  91. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.lv.json +1 -1
  92. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.nl.json +1 -1
  93. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.no.json +1 -1
  94. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.pl.json +1 -1
  95. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.pt-BR.json +1 -1
  96. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.pt-PT.json +1 -1
  97. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ro.json +1 -1
  98. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ru.json +1 -1
  99. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sk.json +1 -1
  100. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sl.json +1 -1
  101. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sr.json +1 -1
  102. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sv.json +1 -1
  103. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.th.json +1 -1
  104. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.tr.json +1 -1
  105. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.uk.json +1 -1
  106. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.vi.json +1 -1
  107. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.zh-CN.json +1 -1
  108. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.zh-HK.json +1 -1
  109. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.zh-TW.json +1 -1
  110. package/config.d.ts +3 -3
  111. package/config.js +1 -1
  112. package/core/workers.d.ts +1 -0
  113. package/identity/Credential.d.ts +1 -1
  114. package/identity/IdentityManager.d.ts +1 -1
  115. package/identity/OAuthInfo.d.ts +1 -1
  116. package/identity/ServerInfo.d.ts +1 -1
  117. package/kernel.js +1 -1
  118. package/layers/CSVLayer.js +1 -1
  119. package/layers/SceneLayer.js +1 -1
  120. package/layers/VectorTileLayer.d.ts +2 -2
  121. package/layers/graphics/sources/CSVSource.js +1 -1
  122. package/layers/graphics/sources/GeoJSONSource.js +1 -1
  123. package/layers/graphics/sources/MemorySource.js +2 -2
  124. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  125. package/layers/graphics/sources/support/QueryTask.js +1 -1
  126. package/layers/graphics/sources/support/timeQueryUtils.js +2 -0
  127. package/layers/mixins/APIKeyMixin.d.ts +1 -1
  128. package/layers/mixins/ArcGISImageService.js +1 -1
  129. package/layers/ogc/types.d.ts +1 -1
  130. package/layers/raster/functions/rasterProjectionHelper.js +1 -1
  131. package/layers/support/TimeInformation.js +1 -1
  132. package/layers/support/timeInfoUtils.js +2 -0
  133. package/package.json +4 -4
  134. package/rest/query/executeAttributeBinsQuery.js +1 -1
  135. package/rest/query/executeForExtent.js +1 -1
  136. package/rest/query/executeForTopCount.js +1 -1
  137. package/rest/query/executeForTopExtents.js +1 -1
  138. package/rest/query/executeForTopIds.js +1 -1
  139. package/rest/query/executeTopFeaturesQuery.js +1 -1
  140. package/rest/query/operations/query.js +1 -1
  141. package/rest/query/operations/queryAttributeBins.js +1 -1
  142. package/rest/query/operations/queryTopFeatures.js +1 -1
  143. package/rest/support/timeUtils.js +1 -1
  144. package/support/timeUtils.js +1 -1
  145. package/symbols/TextSymbol.d.ts +0 -1
  146. package/views/2d/engine/webgl/FeatureDisplayList.js +1 -1
  147. package/views/2d/layers/ImageryLayerView2D.js +1 -1
  148. package/views/3d/analysis/LineOfSight/placementUtils.js +1 -1
  149. package/views/3d/analysis/Viewshed/placementUtils.js +1 -1
  150. package/views/3d/environment/SunLighting.d.ts +10 -8
  151. package/views/3d/environment/VirtualLighting.d.ts +10 -8
  152. package/views/draw/DrawTool.js +1 -1
  153. package/widgets/Directions.d.ts +1 -1
  154. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  155. package/widgets/OrientedImageryViewer/navigation/NavigationManager.js +1 -1
  156. package/widgets/OrientedImageryViewer/navigation/queries.js +1 -1
  157. package/widgets/OrientedImageryViewer/navigation/utils.js +1 -1
  158. package/widgets/OrientedImageryViewer.js +2 -2
  159. package/widgets/ScaleRangeSlider/types.d.ts +3 -3
  160. package/assets/esri/core/workers/chunks/20a698709c3c11ff2c16.js +0 -1
  161. package/assets/esri/core/workers/chunks/2226c20c38e20713bcb5.js +0 -2
  162. package/assets/esri/core/workers/chunks/2a570ce6b99dac6ee996.js +0 -1
  163. package/assets/esri/core/workers/chunks/2b6684d057d9ad17ac13.js +0 -1
  164. package/assets/esri/core/workers/chunks/2e66c969bf4209c957b5.js +0 -2
  165. package/assets/esri/core/workers/chunks/377595b23379b0c8fe95.js +0 -1
  166. package/assets/esri/core/workers/chunks/379ef56f6b32494832a6.js +0 -1
  167. package/assets/esri/core/workers/chunks/38d852676677e5697864.js +0 -1
  168. package/assets/esri/core/workers/chunks/3c881b1adc8a5dea9a90.js +0 -1
  169. package/assets/esri/core/workers/chunks/4e6656a5f29e31902fca.js +0 -2
  170. package/assets/esri/core/workers/chunks/50e8943d2c0b96fab2c1.js +0 -1
  171. package/assets/esri/core/workers/chunks/5a9b7eb26f936f03d02e.js +0 -1
  172. package/assets/esri/core/workers/chunks/5f07f52bb8b7721f08d3.js +0 -1
  173. package/assets/esri/core/workers/chunks/60c79934799927114074.js +0 -1
  174. package/assets/esri/core/workers/chunks/63b5418a1c3fe0a97a86.js +0 -1
  175. package/assets/esri/core/workers/chunks/6ddc29a144640acb1192.js +0 -1
  176. package/assets/esri/core/workers/chunks/6f73e41e14817acfaead.js +0 -1
  177. package/assets/esri/core/workers/chunks/7dfbc31f3b56728485a4.js +0 -1
  178. package/assets/esri/core/workers/chunks/822f83d7c09ef0a9bbdf.js +0 -1
  179. package/assets/esri/core/workers/chunks/844eedda8f749972f707.js +0 -2
  180. package/assets/esri/core/workers/chunks/8b8118ab56cc808b5a71.js +0 -1
  181. package/assets/esri/core/workers/chunks/8d86b0cb0e004ad72040.js +0 -1
  182. package/assets/esri/core/workers/chunks/98760040f0c9d47c718d.js +0 -1
  183. package/assets/esri/core/workers/chunks/a2f0894218e665780a21.js +0 -1
  184. package/assets/esri/core/workers/chunks/a65951f1d5702cfd996e.js +0 -1
  185. package/assets/esri/core/workers/chunks/ab6506a3c16f8717fc00.js +0 -1
  186. package/assets/esri/core/workers/chunks/c45edd0a7d57263bb7d6.js +0 -1
  187. package/assets/esri/core/workers/chunks/c52466eb1f3c33ae1f5a.js +0 -1
  188. package/assets/esri/core/workers/chunks/c570b90995c65bbb2e14.js +0 -1
  189. package/assets/esri/core/workers/chunks/c576bef77e34920af188.js +0 -1
  190. package/assets/esri/core/workers/chunks/c80a3b039e510c118399.js +0 -1
  191. package/assets/esri/core/workers/chunks/c88a70f68c8ce8c30e9b.js +0 -1
  192. package/assets/esri/core/workers/chunks/cf1ec61eb2ad147bb931.js +0 -1
  193. package/assets/esri/core/workers/chunks/daae21cf77864f3293ef.js +0 -1
  194. package/assets/esri/core/workers/chunks/e9cdb0b0f074583edebd.js +0 -1
  195. package/assets/esri/core/workers/chunks/f5cc78291b53931b91e8.js +0 -1
  196. /package/assets/esri/core/workers/chunks/{844eedda8f749972f707.js.LICENSE.txt → 2b4dd42920d37b1ff0a9.js.LICENSE.txt} +0 -0
  197. /package/assets/esri/core/workers/chunks/{2cb209bc51a19487692d.js.LICENSE.txt → 43aef67452fa6ff8d8f9.js.LICENSE.txt} +0 -0
  198. /package/assets/esri/core/workers/chunks/{31640b41e0ecdff892fa.js.LICENSE.txt → 85b63811ae7bcb6f74b6.js.LICENSE.txt} +0 -0
  199. /package/assets/esri/core/workers/chunks/{4e6656a5f29e31902fca.js.LICENSE.txt → 900c8569596609183f19.js.LICENSE.txt} +0 -0
  200. /package/assets/esri/core/workers/chunks/{2e66c969bf4209c957b5.js.LICENSE.txt → a17fb26d6ac4895e51a3.js.LICENSE.txt} +0 -0
  201. /package/assets/esri/core/workers/chunks/{dc51dcaa4e2f9a90f5bd.js.LICENSE.txt → c2cbe0f5e8958cf18e58.js.LICENSE.txt} +0 -0
package/config.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"./core/has.js";import{deepMerge as e}from"./core/object.js";const t={apiKey:void 0,apiKeys:{scopes:[]},applicationName:``,applicationUrl:globalThis.location?.href,assetsPath:``,fontsUrl:`https://static.arcgis.com/fonts`,geometryServiceUrl:`https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer`,geoRSSServiceUrl:`https://utility.arcgis.com/sharing/rss`,kmlServiceUrl:`https://utility.arcgis.com/sharing/kml`,userPrivilegesApplied:!0,portalUrl:`https://www.arcgis.com`,respectPrefersReducedMotion:!0,routeServiceUrl:`https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World`,workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:[`arcgis.com`,`arcgisonline.com`,`esrikr.com`,`premiumservices.blackbridge.com`,`esripremium.accuweather.com`,`gbm.digitalglobe.com`,`firstlook.digitalglobe.com`,`msi.digitalglobe.com`],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:`high`,proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};globalThis.esriConfig&&(e(t,globalThis.esriConfig,!0),delete t.has),!t.assetsPath&&(t.assetsPath=`https://js.arcgis.com/5.2.1/@arcgis/core/assets`,t.defaultAssetsPath=t.assetsPath);export{t as default};
2
+ import"./core/has.js";import{deepMerge as e}from"./core/object.js";const t={apiKey:void 0,apiKeys:{scopes:[]},applicationName:``,applicationUrl:globalThis.location?.href,assetsPath:``,fontsUrl:`https://static.arcgis.com/fonts`,geometryServiceUrl:`https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer`,geoRSSServiceUrl:`https://utility.arcgis.com/sharing/rss`,kmlServiceUrl:`https://utility.arcgis.com/sharing/kml`,userPrivilegesApplied:!0,portalUrl:`https://www.arcgis.com`,respectPrefersReducedMotion:!0,routeServiceUrl:`https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World`,workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:[`arcgis.com`,`arcgisonline.com`,`esrikr.com`,`premiumservices.blackbridge.com`,`esripremium.accuweather.com`,`gbm.digitalglobe.com`,`firstlook.digitalglobe.com`,`msi.digitalglobe.com`],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:`high`,proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};globalThis.esriConfig&&(e(t,globalThis.esriConfig,!0),delete t.has),!t.assetsPath&&(t.assetsPath=`https://js.arcgis.com/5.2.3/@arcgis/core/assets`,t.defaultAssetsPath=t.assetsPath);export{t as default};
package/core/workers.d.ts CHANGED
@@ -50,6 +50,7 @@ export interface OpenOptions extends AbortOptions {
50
50
  * Set to `true` when loading a custom ES module worker.
51
51
  * The default is `false` for backward compatibility with legacy AMD custom workers. Loading custom workers this way is deprecated.
52
52
  *
53
+ * @deprecated since version 5.2. This option is temporary and will be removed at version 6.0 when custom worker modules default to ESM. Until then, migrate custom workers to ES modules and set this option to `true`.
53
54
  * @default false
54
55
  * @since 5.2
55
56
  */
@@ -20,7 +20,7 @@ export interface CredentialEvents {
20
20
  *
21
21
  * @since 4.0
22
22
  * @see [Access ArcGIS Online items using OAuth 2.0](https://developers.arcgis.com/javascript/latest/sample-code/identity-oauth-basic/)
23
- * @see [Access Secure Services](https://developers.arcgis.com/javascript/latest/secure-resources/)
23
+ * @see [Authentication and access tokens](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/)
24
24
  * @see [Authentication and OAuth 2](https://developers.arcgis.com/authentication/)
25
25
  * @see [Guide topic - Proxy pages](https://developers.arcgis.com/javascript/latest/proxies/)
26
26
  * @see [ArcGIS Organization portals](https://developers.arcgis.com/javascript/latest/arcgis-organization-portals/)
@@ -18,7 +18,7 @@
18
18
  * > The IdentityManager module is slightly different than other modules in the API. Instead of returning a class constructor, it returns a singleton instance that has already been created by this module.
19
19
  *
20
20
  * @since 4.0
21
- * @see [Access Secure Services](https://developers.arcgis.com/javascript/latest/guide/secure-resources/)
21
+ * @see [Authentication and access tokens](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/)
22
22
  * @see [Authentication and OAuth 2](https://developers.arcgis.com/authentication/)
23
23
  * @see [Guide topic - Proxy pages](https://developers.arcgis.com/javascript/latest/proxies/)
24
24
  * @see [ArcGIS Organization portals](https://developers.arcgis.com/javascript/latest/arcgis-organization-portals/)
@@ -14,7 +14,7 @@ export interface OAuthInfoProperties extends Partial<Pick<OAuthInfo, "appId" | "
14
14
  *
15
15
  * @since 4.0
16
16
  * @see [Sample - Access ArcGIS Online items using OAuth 2.0](https://developers.arcgis.com/javascript/latest/sample-code/identity-oauth-basic/)
17
- * @see [Authentication and secure resources](https://developers.arcgis.com/javascript/latest/secure-resources/)
17
+ * @see [Authentication and access tokens](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/)
18
18
  * @see [Authentication and OAuth 2](https://developers.arcgis.com/authentication/)
19
19
  * @see [Proxy pages with the API](https://developers.arcgis.com/javascript/latest/proxies/)
20
20
  * @see [ArcGIS portals](https://developers.arcgis.com/javascript/latest/arcgis-organization-portals/)
@@ -7,7 +7,7 @@ export interface ServerInfoProperties extends Partial<Pick<ServerInfo, "adminTok
7
7
  *
8
8
  * @since 4.0
9
9
  * @see [IdentityManager](https://developers.arcgis.com/javascript/latest/references/core/identity/IdentityManager/)
10
- * @see [Access Secure Services](https://developers.arcgis.com/javascript/latest/secure-resources/)
10
+ * @see [Authentication and access tokens](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/)
11
11
  * @see [Authentication and OAuth 2](https://developers.arcgis.com/authentication/)
12
12
  * @see [Guide topic - Proxy pages](https://developers.arcgis.com/javascript/latest/proxies/)
13
13
  * @see [Guide topic - CORS](https://developers.arcgis.com/javascript/latest/cors/)
package/kernel.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"./core/has.js";import{addQueryParameter as e}from"./core/urlUtils.js";Symbol.dispose??=Symbol(`Symbol.dispose`),Symbol.asyncDispose??=Symbol(`Symbol.asyncDispose`);const t=`5.2`;let n=`5.2`;n=`5.2.1`;let r;function i(e){r=e}function a(t){let n=r?.findCredential(t);return n?.token?e(t,`token`,n.token):t}globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}});export{a as addTokenParameter,n as fullVersion,r as id,i as setId,t as version};
2
+ import"./core/has.js";import{addQueryParameter as e}from"./core/urlUtils.js";Symbol.dispose??=Symbol(`Symbol.dispose`),Symbol.asyncDispose??=Symbol(`Symbol.asyncDispose`);const t=`5.2`;let n=`5.2`;n=`5.2.3`;let r;function i(e){r=e}function a(t){let n=r?.findCredential(t);return n?.token?e(t,`token`,n.token):t}globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}});export{a as addTokenParameter,n as fullVersion,r as id,i as setId,t as version};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../PopupTemplate.js";import n from"../core/Error.js";import{MultiOriginJSONSupportMixin as r}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as i}from"../core/promiseUtils.js";import{urlToObject as a}from"../core/urlUtils.js";import{property as o,subclass as s}from"../core/accessorSupport/decorators.js";import{excludeTables as c}from"../core/accessorSupport/layerContainerType.js";import l from"../geometry/SpatialReference.js";import u from"../graphic/CSVGraphicOrigin.js";import d from"./Layer.js";import{CSVSource as f}from"./graphics/sources/CSVSource.js";import{createCapabilities as p}from"./graphics/sources/support/clientSideDefaults.js";import{BlendLayer as m}from"./mixins/BlendLayer.js";import{CustomParametersMixin as h}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as g}from"./mixins/DisplayFilteredLayer.js";import{FeatureEffectLayer as _}from"./mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as v}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as y}from"./mixins/OperationalLayer.js";import{OrderedLayer as b}from"./mixins/OrderedLayer.js";import{PortalLayer as x}from"./mixins/PortalLayer.js";import{RefreshableLayer as S}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as C}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as w}from"./mixins/TemporalLayer.js";import{TrackableLayer as T}from"./mixins/TrackableLayer.js";import{attributeTableTemplate as E,elevationInfo as D,labelsVisible as O,legendEnabled as k,maxScale as A,minScale as j,opacityDrawingInfo as M,popupEnabled as N,screenSizePerspectiveEnabled as P,timeInfo as F,url as I}from"./support/commonProperties.js";import{validateBinsQuery as L}from"./support/featureLayerUtils.js";import R from"./support/Field.js";import{defineFieldProperties as z}from"./support/fieldProperties.js";import{fixRendererFields as B,fixTimeInfoFields as V}from"./support/fieldUtils.js";import H from"./support/LabelClass.js";import{reader as U}from"./support/labelingInfo.js";import W from"./support/LayerFloorInfo.js";import{webSceneRendererTypes as G,rendererTypes as K}from"../renderers/support/typeUtils.js";import q from"../rest/support/Query.js";import{createPopupTemplate as J}from"../support/popupUtils.js";import{fromTimeReference as Y}from"../time/timeZoneUtils.js";import{reader as X}from"../core/accessorSupport/decorators/reader.js";const Z=z();let Q=class extends b(g(h(v(_(m(w(T(C(S(y(x(r(d))))))))))))){constructor(e){super(e),this.attributeTableTemplate=null,this.capabilities=p(!1,!1),this.copyright=null,this.definitionExpression=null,this.delimiter=null,this.displayField=null,this.elevationInfo=null,this.fields=null,this.fieldsIndex=null,this.floorInfo=null,this.fullExtent=null,this.geometryType=`point`,this.graphicOrigin=new u(this),this.labelingInfo=null,this.labelsVisible=!0,this.latitudeField=null,this.legendEnabled=!0,this.locationType=`coordinates`,this.longitudeField=null,this.maxScale=0,this.minScale=0,this.objectIdField=null,this.opacity=1,this.operationalLayerType=`CSV`,this.outFields=null,this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.source=new f,this.spatialReference=l.WGS84,this.timeInfo=null,this.type=`csv`}load(e){let t=this.loadFromPortal({supportedTypes:[`CSV`],supportsData:!1},e).catch(i).then(()=>(this.source.loadOptions={delimiter:this.delimiter,fields:this.fields,latitudeField:this.latitudeField??void 0,longitudeField:this.longitudeField??void 0,spatialReference:this.spatialReference??void 0,timeInfo:this.timeInfo??void 0,url:this.url},this.source.customParameters=this.customParameters??void 0,this.source.load(e))).then(()=>{this.read({layerDefinition:this.source.sourceJSON,locationInfo:this.source.locationInfo,columnDelimiter:this.source.delimiter},{origin:`service`,portalItem:this.portalItem,portal:this.portalItem?.portal,url:this.parsedUrl}),B(this.renderer,this.fieldsIndex),V(this.timeInfo,this.fieldsIndex)});return this.addResolvingPromise(t),Promise.resolve(this)}destroy(){this.source?.destroy()}get createQueryVersion(){return this.commitProperty(`definitionExpression`),this.commitProperty(`timeExtent`),this.commitProperty(`timeOffset`),this.commitProperty(`geometryType`),this.commitProperty(`capabilities`),(this._get(`createQueryVersion`)||0)+1}get defaultPopupTemplate(){return this.createPopupTemplate()}get isTable(){return this.loaded&&this.geometryType==null}readWebMapLabelsVisible(e,t){return t.showLabels??!!t.layerDefinition?.drawingInfo?.labelingInfo}get portalItem(){return super.portalItem}set portalItem(e){super.portalItem=e}set renderer(e){B(e,this.fieldsIndex),this._set(`renderer`,e)}set url(e){if(!e){this._set(`url`,e);return}let t=a(e);this._set(`url`,t.path),t.query&&(this.customParameters={...this.customParameters,...t.query})}createPopupTemplate(e){return J(this,e)}createQuery(){let e=new q,t=this.capabilities?.data;e.returnGeometry=!0,t?.supportsZ&&(e.returnZ=!0),e.outFields=[`*`],e.where=this.definitionExpression||`1=1`;let{timeOffset:n,timeExtent:r}=this;return e.timeExtent=n&&r?r.offset(-n.value,n.unit):r??null,e}getFieldDomain(e,t){return this.getField(e)?.domain}getField(e){return this.fieldsIndex.get(e)}async queryAttributeBins(e,t){let{source:r,capabilities:i}=await this.load();if(!r.queryAttributeBins)throw new n(`CSVLayer`,`Layer source does not support queryAttributeBins capability`);L(e,i,`CSVLayer`);let{default:a}=await import(`../rest/support/AttributeBinsQuery.js`),o=await r.queryAttributeBins(a.from(e),t),s=this.graphicOrigin;if(o.features)for(let e of o.features)e.layer=e.sourceLayer=this,e.origin=s;return o}queryFeatures(e,t){return this.load().then(()=>this.source.queryFeatures(q.from(e)||this.createQuery())).then(e=>{let t=this.graphicOrigin;if(e.features)for(let n of e.features)n.layer=n.sourceLayer=this,n.origin=t;return e})}async queryObjectIds(e,t){return await this.load(),this.source.queryObjectIds(q.from(e)||this.createQuery())}queryFeatureCount(e,t){return this.load().then(()=>this.source.queryFeatureCount(q.from(e)||this.createQuery()))}queryExtent(e,t){return this.load().then(()=>this.source.queryExtent(q.from(e)||this.createQuery()))}read(e,t){super.read(e,t),t?.origin===`service`&&([`objectIdField`,`fields`,`timeInfo`,`dateFieldsTimeZone`,`latitudeField`,`longitudeField`].forEach(e=>this.revertToOrigin(e,`service`)),this.spatialReference||this.revertToOrigin(`spatialReference`,`service`))}async hasDataChanged(){try{let{dataChanged:e,updates:t}=await this.source.refresh(this.customParameters);return t!=null&&this.read(t,{origin:`service`,url:this.parsedUrl,ignoreDefaults:!0}),e}catch{}return!1}};e([o(E)],Q.prototype,`attributeTableTemplate`,void 0),e([o({readOnly:!0,json:{read:!1,write:!1}})],Q.prototype,`capabilities`,void 0),e([o({type:String,json:{origins:{service:{read:{source:`copyrightText`}}}}})],Q.prototype,`copyright`,void 0),e([o({readOnly:!0})],Q.prototype,`createQueryVersion`,null),e([o({json:{name:`layerDefinition.dateFieldsTimeReference`,read:{reader:Y}}})],Q.prototype,`dateFieldsTimeZone`,void 0),e([o({readOnly:!0})],Q.prototype,`defaultPopupTemplate`,null),e([o({type:String,json:{name:`layerDefinition.definitionExpression`,write:{enabled:!0,allowNull:!0}}})],Q.prototype,`definitionExpression`,void 0),e([o({type:[`,`,` `,`;`,`|`,` `],json:{name:`columnDelimiter`,write:{ignoreOrigin:!0}}})],Q.prototype,`delimiter`,void 0),e([o({type:String})],Q.prototype,`displayField`,void 0),e([o(D)],Q.prototype,`elevationInfo`,void 0),e([o({type:[R],json:{name:`layerDefinition.fields`,write:{ignoreOrigin:!0}}})],Q.prototype,`fields`,void 0),e([o(Z.fieldsIndex)],Q.prototype,`fieldsIndex`,void 0),e([o({type:W,json:{name:`layerDefinition.floorInfo`,write:{layerContainerTypes:c}}})],Q.prototype,`floorInfo`,void 0),e([o({json:{origins:{service:{name:`layerDefinition.extent`}}}})],Q.prototype,`fullExtent`,void 0),e([o({readOnly:!0,json:{read:!1}})],Q.prototype,`geometryType`,void 0),e([o({readOnly:!0})],Q.prototype,`graphicOrigin`,void 0),e([o({readOnly:!0})],Q.prototype,`isTable`,null),e([o({type:[H],json:{name:`layerDefinition.drawingInfo.labelingInfo`,read:{reader:U},write:!0}})],Q.prototype,`labelingInfo`,void 0),e([o(O)],Q.prototype,`labelsVisible`,void 0),e([X(`web-map`,`labelsVisible`,[`layerDefinition.drawingInfo.labelingInfo`,`showLabels`])],Q.prototype,`readWebMapLabelsVisible`,null),e([o({type:String,json:{name:`locationInfo.latitudeFieldName`,write:{ignoreOrigin:!0}}})],Q.prototype,`latitudeField`,void 0),e([o(k)],Q.prototype,`legendEnabled`,void 0),e([o({type:[`show`,`hide`]})],Q.prototype,`listMode`,void 0),e([o({type:[`coordinates`],json:{name:`locationInfo.locationType`,write:{ignoreOrigin:!0,isRequired:!0}}})],Q.prototype,`locationType`,void 0),e([o({type:String,json:{name:`locationInfo.longitudeFieldName`,write:{ignoreOrigin:!0}}})],Q.prototype,`longitudeField`,void 0),e([o(A)],Q.prototype,`maxScale`,void 0),e([o(j)],Q.prototype,`minScale`,void 0),e([o({type:String,json:{name:`layerDefinition.objectIdField`,origins:{"web-map":{write:{target:`layerDefinition.objectIdField`,ignoreOrigin:!0}}}}})],Q.prototype,`objectIdField`,void 0),e([o(M)],Q.prototype,`opacity`,void 0),e([o({type:[`CSV`]})],Q.prototype,`operationalLayerType`,void 0),e([o()],Q.prototype,`outFields`,void 0),e([o(N)],Q.prototype,`popupEnabled`,void 0),e([o({type:t,json:{name:`popupInfo`,write:!0}})],Q.prototype,`popupTemplate`,void 0),e([o({types:K,json:{name:`layerDefinition.drawingInfo.renderer`,origins:{"web-scene":{types:G,name:`layerDefinition.drawingInfo.renderer`,write:!0}},write:{ignoreOrigin:!0,layerContainerTypes:c}}})],Q.prototype,`renderer`,null),e([o(P)],Q.prototype,`screenSizePerspectiveEnabled`,void 0),e([o({readOnly:!0})],Q.prototype,`source`,void 0),e([o({type:l,json:{origins:{service:{name:`layerDefinition.extent.spatialReference`}}}})],Q.prototype,`spatialReference`,void 0),e([o(F({name:`layerDefinition.timeInfo`,alwaysWriteNonItemOrigin:!0}))],Q.prototype,`timeInfo`,void 0),e([o({type:String,json:{origins:{service:{name:`layerDefinition.name`},"web-document":{name:`title`,write:{isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}}}})],Q.prototype,`title`,void 0),e([o({json:{read:!1},value:`csv`,readOnly:!0})],Q.prototype,`type`,void 0),e([o(I)],Q.prototype,`url`,null),Q=e([s(`esri.layers.CSVLayer`)],Q);const $=Q;export{$ as default};
2
+ import{__decorate as e}from"tslib";import t from"../PopupTemplate.js";import n from"../core/Error.js";import{MultiOriginJSONSupportMixin as r}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as i}from"../core/promiseUtils.js";import{urlToObject as a}from"../core/urlUtils.js";import{property as o,subclass as s}from"../core/accessorSupport/decorators.js";import{excludeTables as c}from"../core/accessorSupport/layerContainerType.js";import l from"../geometry/SpatialReference.js";import u from"../graphic/CSVGraphicOrigin.js";import d from"./Layer.js";import{CSVSource as f}from"./graphics/sources/CSVSource.js";import{createCapabilities as p}from"./graphics/sources/support/clientSideDefaults.js";import{BlendLayer as m}from"./mixins/BlendLayer.js";import{CustomParametersMixin as h}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as g}from"./mixins/DisplayFilteredLayer.js";import{FeatureEffectLayer as _}from"./mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as v}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as y}from"./mixins/OperationalLayer.js";import{OrderedLayer as b}from"./mixins/OrderedLayer.js";import{PortalLayer as x}from"./mixins/PortalLayer.js";import{RefreshableLayer as S}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as C}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as w}from"./mixins/TemporalLayer.js";import{TrackableLayer as T}from"./mixins/TrackableLayer.js";import{attributeTableTemplate as E,elevationInfo as D,labelsVisible as O,legendEnabled as k,maxScale as A,minScale as j,opacityDrawingInfo as M,popupEnabled as N,screenSizePerspectiveEnabled as P,timeInfo as F,url as I}from"./support/commonProperties.js";import{validateBinsQuery as L}from"./support/featureLayerUtils.js";import R from"./support/Field.js";import{defineFieldProperties as z}from"./support/fieldProperties.js";import{fixRendererFields as B,fixTimeInfoFields as V}from"./support/fieldUtils.js";import H from"./support/LabelClass.js";import{reader as U}from"./support/labelingInfo.js";import W from"./support/LayerFloorInfo.js";import{webSceneRendererTypes as G,rendererTypes as K}from"../renderers/support/typeUtils.js";import q from"../rest/support/Query.js";import{createPopupTemplate as J}from"../support/popupUtils.js";import{fromTimeReference as Y}from"../time/timeZoneUtils.js";import{reader as X}from"../core/accessorSupport/decorators/reader.js";const Z=z();let Q=class extends b(g(h(v(_(m(w(T(C(S(y(x(r(d))))))))))))){constructor(e){super(e),this.attributeTableTemplate=null,this.capabilities=p(!1,!1),this.copyright=null,this.definitionExpression=null,this.delimiter=null,this.displayField=null,this.elevationInfo=null,this.fields=null,this.fieldsIndex=null,this.floorInfo=null,this.fullExtent=null,this.geometryType=`point`,this.graphicOrigin=new u(this),this.labelingInfo=null,this.labelsVisible=!0,this.latitudeField=null,this.legendEnabled=!0,this.locationType=`coordinates`,this.longitudeField=null,this.maxScale=0,this.minScale=0,this.objectIdField=null,this.opacity=1,this.operationalLayerType=`CSV`,this.outFields=null,this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.source=new f({layer:this}),this.spatialReference=l.WGS84,this.timeInfo=null,this.type=`csv`}load(e){let t=this.loadFromPortal({supportedTypes:[`CSV`],supportsData:!1},e).catch(i).then(()=>(this.source.loadOptions={delimiter:this.delimiter,fields:this.fields,latitudeField:this.latitudeField??void 0,longitudeField:this.longitudeField??void 0,spatialReference:this.spatialReference??void 0,timeInfo:this.timeInfo??void 0,url:this.url},this.source.customParameters=this.customParameters??void 0,this.source.load(e))).then(()=>{this.read({layerDefinition:this.source.sourceJSON,locationInfo:this.source.locationInfo,columnDelimiter:this.source.delimiter},{origin:`service`,portalItem:this.portalItem,portal:this.portalItem?.portal,url:this.parsedUrl}),B(this.renderer,this.fieldsIndex),V(this.timeInfo,this.fieldsIndex)});return this.addResolvingPromise(t),Promise.resolve(this)}destroy(){this.source?.destroy()}get createQueryVersion(){return this.commitProperty(`definitionExpression`),this.commitProperty(`timeExtent`),this.commitProperty(`timeOffset`),this.commitProperty(`geometryType`),this.commitProperty(`capabilities`),(this._get(`createQueryVersion`)||0)+1}get defaultPopupTemplate(){return this.createPopupTemplate()}get isTable(){return this.loaded&&this.geometryType==null}readWebMapLabelsVisible(e,t){return t.showLabels??!!t.layerDefinition?.drawingInfo?.labelingInfo}get portalItem(){return super.portalItem}set portalItem(e){super.portalItem=e}set renderer(e){B(e,this.fieldsIndex),this._set(`renderer`,e)}set url(e){if(!e){this._set(`url`,e);return}let t=a(e);this._set(`url`,t.path),t.query&&(this.customParameters={...this.customParameters,...t.query})}createPopupTemplate(e){return J(this,e)}createQuery(){let e=new q,t=this.capabilities?.data;e.returnGeometry=!0,t?.supportsZ&&(e.returnZ=!0),e.outFields=[`*`],e.where=this.definitionExpression||`1=1`;let{timeOffset:n,timeExtent:r}=this;return e.timeExtent=n&&r?r.offset(-n.value,n.unit):r??null,e}getFieldDomain(e,t){return this.getField(e)?.domain}getField(e){return this.fieldsIndex.get(e)}async queryAttributeBins(e,t){let{source:r,capabilities:i}=await this.load();if(!r.queryAttributeBins)throw new n(`CSVLayer`,`Layer source does not support queryAttributeBins capability`);L(e,i,`CSVLayer`);let{default:a}=await import(`../rest/support/AttributeBinsQuery.js`),o=await r.queryAttributeBins(a.from(e),t),s=this.graphicOrigin;if(o.features)for(let e of o.features)e.layer=e.sourceLayer=this,e.origin=s;return o}queryFeatures(e,t){return this.load().then(()=>this.source.queryFeatures(q.from(e)||this.createQuery())).then(e=>{let t=this.graphicOrigin;if(e.features)for(let n of e.features)n.layer=n.sourceLayer=this,n.origin=t;return e})}async queryObjectIds(e,t){return await this.load(),this.source.queryObjectIds(q.from(e)||this.createQuery())}queryFeatureCount(e,t){return this.load().then(()=>this.source.queryFeatureCount(q.from(e)||this.createQuery()))}queryExtent(e,t){return this.load().then(()=>this.source.queryExtent(q.from(e)||this.createQuery()))}read(e,t){super.read(e,t),t?.origin===`service`&&([`objectIdField`,`fields`,`timeInfo`,`dateFieldsTimeZone`,`latitudeField`,`longitudeField`].forEach(e=>this.revertToOrigin(e,`service`)),this.spatialReference||this.revertToOrigin(`spatialReference`,`service`))}async hasDataChanged(){try{let{dataChanged:e,updates:t}=await this.source.refresh(this.customParameters);return t!=null&&this.read(t,{origin:`service`,url:this.parsedUrl,ignoreDefaults:!0}),e}catch{}return!1}};e([o(E)],Q.prototype,`attributeTableTemplate`,void 0),e([o({readOnly:!0,json:{read:!1,write:!1}})],Q.prototype,`capabilities`,void 0),e([o({type:String,json:{origins:{service:{read:{source:`copyrightText`}}}}})],Q.prototype,`copyright`,void 0),e([o({readOnly:!0})],Q.prototype,`createQueryVersion`,null),e([o({json:{name:`layerDefinition.dateFieldsTimeReference`,read:{reader:Y}}})],Q.prototype,`dateFieldsTimeZone`,void 0),e([o({readOnly:!0})],Q.prototype,`defaultPopupTemplate`,null),e([o({type:String,json:{name:`layerDefinition.definitionExpression`,write:{enabled:!0,allowNull:!0}}})],Q.prototype,`definitionExpression`,void 0),e([o({type:[`,`,` `,`;`,`|`,` `],json:{name:`columnDelimiter`,write:{ignoreOrigin:!0}}})],Q.prototype,`delimiter`,void 0),e([o({type:String})],Q.prototype,`displayField`,void 0),e([o(D)],Q.prototype,`elevationInfo`,void 0),e([o({type:[R],json:{name:`layerDefinition.fields`,write:{ignoreOrigin:!0}}})],Q.prototype,`fields`,void 0),e([o(Z.fieldsIndex)],Q.prototype,`fieldsIndex`,void 0),e([o({type:W,json:{name:`layerDefinition.floorInfo`,write:{layerContainerTypes:c}}})],Q.prototype,`floorInfo`,void 0),e([o({json:{origins:{service:{name:`layerDefinition.extent`}}}})],Q.prototype,`fullExtent`,void 0),e([o({readOnly:!0,json:{read:!1}})],Q.prototype,`geometryType`,void 0),e([o({readOnly:!0})],Q.prototype,`graphicOrigin`,void 0),e([o({readOnly:!0})],Q.prototype,`isTable`,null),e([o({type:[H],json:{name:`layerDefinition.drawingInfo.labelingInfo`,read:{reader:U},write:!0}})],Q.prototype,`labelingInfo`,void 0),e([o(O)],Q.prototype,`labelsVisible`,void 0),e([X(`web-map`,`labelsVisible`,[`layerDefinition.drawingInfo.labelingInfo`,`showLabels`])],Q.prototype,`readWebMapLabelsVisible`,null),e([o({type:String,json:{name:`locationInfo.latitudeFieldName`,write:{ignoreOrigin:!0}}})],Q.prototype,`latitudeField`,void 0),e([o(k)],Q.prototype,`legendEnabled`,void 0),e([o({type:[`show`,`hide`]})],Q.prototype,`listMode`,void 0),e([o({type:[`coordinates`],json:{name:`locationInfo.locationType`,write:{ignoreOrigin:!0,isRequired:!0}}})],Q.prototype,`locationType`,void 0),e([o({type:String,json:{name:`locationInfo.longitudeFieldName`,write:{ignoreOrigin:!0}}})],Q.prototype,`longitudeField`,void 0),e([o(A)],Q.prototype,`maxScale`,void 0),e([o(j)],Q.prototype,`minScale`,void 0),e([o({type:String,json:{name:`layerDefinition.objectIdField`,origins:{"web-map":{write:{target:`layerDefinition.objectIdField`,ignoreOrigin:!0}}}}})],Q.prototype,`objectIdField`,void 0),e([o(M)],Q.prototype,`opacity`,void 0),e([o({type:[`CSV`]})],Q.prototype,`operationalLayerType`,void 0),e([o()],Q.prototype,`outFields`,void 0),e([o(N)],Q.prototype,`popupEnabled`,void 0),e([o({type:t,json:{name:`popupInfo`,write:!0}})],Q.prototype,`popupTemplate`,void 0),e([o({types:K,json:{name:`layerDefinition.drawingInfo.renderer`,origins:{"web-scene":{types:G,name:`layerDefinition.drawingInfo.renderer`,write:!0}},write:{ignoreOrigin:!0,layerContainerTypes:c}}})],Q.prototype,`renderer`,null),e([o(P)],Q.prototype,`screenSizePerspectiveEnabled`,void 0),e([o({readOnly:!0})],Q.prototype,`source`,void 0),e([o({type:l,json:{origins:{service:{name:`layerDefinition.extent.spatialReference`}}}})],Q.prototype,`spatialReference`,void 0),e([o(F({name:`layerDefinition.timeInfo`,alwaysWriteNonItemOrigin:!0}))],Q.prototype,`timeInfo`,void 0),e([o({type:String,json:{origins:{service:{name:`layerDefinition.name`},"web-document":{name:`title`,write:{isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}}}})],Q.prototype,`title`,void 0),e([o({json:{read:!1},value:`csv`,readOnly:!0})],Q.prototype,`type`,void 0),e([o(I)],Q.prototype,`url`,null),Q=e([s(`esri.layers.CSVLayer`)],Q);const $=Q;export{$ as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../Graphic.js";import n from"../PopupTemplate.js";import{ClonableMixin as r}from"../core/Clonable.js";import i from"../core/Collection.js";import a from"../core/Error.js";import{abortHandle as o}from"../core/handleUtils.js";import s from"../core/Logger.js";import{destroyMaybe as c}from"../core/maybe.js";import{MultiOriginJSONSupportMixin as l}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as u,throwIfAborted as d,isAbortError as f,throwIfNotAbortError as p}from"../core/promiseUtils.js";import{whenOnce as m}from"../core/reactiveUtils.js";import{property as h,subclass as g}from"../core/accessorSupport/decorators.js";import{getProperties as _}from"../core/accessorSupport/utils.js";import v from"../geometry/Point.js";import{projectAsync as y}from"../geometry/projectionUtils.js";import b from"../graphic/SceneGraphicOrigin.js";import x from"./Layer.js";import{NoModelError as ee,MultipleModelsError as S}from"./graphics/sources/support/uploadAssetErrors.js";import{APIKeyMixin as C}from"./mixins/APIKeyMixin.js";import{ArcGISService as w}from"./mixins/ArcGISService.js";import{CustomParametersMixin as te}from"./mixins/CustomParametersMixin.js";import{EditBusLayer as ne}from"./mixins/EditBusLayer.js";import{OperationalLayer as re}from"./mixins/OperationalLayer.js";import{PortalLayer as ie}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as ae}from"./mixins/ScaleRangeLayer.js";import{SceneService as oe}from"./mixins/SceneService.js";import{useViewTimeProperty as se}from"./mixins/TemporalLayer.js";import{isHostedAgolService as T}from"./support/arcgisLayerUrl.js";import{findAssociatedFeatureService as ce}from"./support/associatedFeatureServiceUtils.js";import{zeroCapabilities as le}from"./support/capabilities.js";import{elevationInfo as E,labelsVisible as D,legendEnabled as O,popupEnabled as k,attributeTableTemplate as A,screenSizePerspectiveEnabled as j,timeInfo as M}from"./support/commonProperties.js";import{getFieldDomain as N,computeEffectiveEditingEnabled as P,getGlobalIdToObjectIdMap as F}from"./support/featureLayerUtils.js";import I from"./support/FeatureReductionSelection.js";import{defineFieldProperties as L}from"./support/fieldProperties.js";import R from"./support/FieldsIndex.js";import{fixRendererFields as z,fixTimeInfoFields as B,unpackFieldNames as V}from"./support/fieldUtils.js";import{I3SNodePageDefinition as H,I3SMaterialDefinition as U,I3STextureSetDefinition as W,I3SGeometryDefinition as ue}from"./support/I3SLayerDefinitions.js";import{isFileEditFormat as de,isFileSupported as fe}from"./support/infoFor3D.js";import pe from"./support/LabelClass.js";import{reader as G}from"./support/labelingInfo.js";import me from"./support/LayerFloorInfo.js";import{layersLoaderMap as he}from"./support/layersLoader.js";import{getMeshTransformForMetersToSpatialReference as ge}from"./support/meshSpatialReferenceScaleUtils.js";import{RangeInfo as _e}from"./support/RangeInfo.js";import ve from"./support/SceneFilter.js";import{cacheIsOutOfSync as K}from"./support/sceneLayerCacheUtils.js";import{fetchStatistics as ye}from"./support/sceneLayerStatistics.js";import{SceneServiceTimeInfo as be}from"./support/SceneServiceTimeInfo.js";import xe from"./support/TimeInfo.js";import{loadStyleRenderer as Se}from"../renderers/support/styleUtils.js";import{webSceneRendererTypes as Ce}from"../renderers/support/typeUtils.js";import we from"../rest/support/Query.js";import{logInvalidElevationInfoWarning as q,elevationModeUnsupportedMessage as Te,featureExpressionUnsupportedMessage as Ee}from"../support/elevationInfoUtils.js";import{createPopupTemplate as De}from"../support/popupUtils.js";import{extractZipFiles as Oe}from"../support/zipUtils.js";import J from"../time/TimeExtent.js";import ke from"../time/TimeInterval.js";import{queryAttributesFromCachedAttributesId as Ae}from"../views/3d/layers/i3s/I3SUtil.js";import{getRequiredFields as je,getFetchPopupTemplate as Me}from"../views/layers/support/popupUtils.js";import{transparencyToOpacity as Ne}from"../webdoc/support/opacityUtils.js";import{reader as Y}from"../core/accessorSupport/decorators/reader.js";const X=new Set([`3DObject`,`Point`]),Z=L();let Q=class extends ne(oe(w(re(ie(ae(l(te(C(r(x)))))))))){constructor(...e){super(...e),this.featureReduction=null,this.rangeInfos=null,this.operationalLayerType=`ArcGISSceneServiceLayer`,this.type=`scene`,this.fields=null,this.graphicOrigin=new b(this),this.floorInfo=null,this.outFields=null,this.nodePages=null,this.materialDefinitions=null,this.textureSetDefinitions=null,this.geometryDefinitions=null,this.serviceUpdateTimeStamp=null,this.excludeObjectIds=new i,this.definitionExpression=null,this.filter=null,this.path=null,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.priority=null,this.semantic=null,this.cachedDrawingInfo={color:!1},this.popupEnabled=!0,this.popupTemplate=null,this.attributeTableTemplate=null,this.objectIdField=null,this.globalIdField=null,this._fieldUsageInfo={},this.screenSizePerspectiveEnabled=!0,this.serviceItemId=void 0,this.serviceTimeInfo=null}normalizeCtorArgs(e,t){return typeof e==`string`?{url:e,...t}:e}destroy(){this._set(`renderer`,null),this.associatedLayer=c(this.associatedLayer)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){let n=this.getField(e)?.domain??null;return this.associatedLayer?N(this.associatedLayer,e,t,n):n}getFeatureType(e){return e&&this.associatedLayer?this.associatedLayer.getFeatureType(e):null}get types(){return this.associatedLayer?.types??[]}get typeIdField(){return this.associatedLayer?.typeIdField??null}get templates(){return this.associatedLayer?.templates??null}get formTemplate(){return this.associatedLayer?.formTemplate??null}get fieldsIndex(){return new R(this.fields)}readNodePages(e,t,n){return t.layerType===`Point`&&(e=t.pointNodePages),typeof e!=`object`||!e?null:H.fromJSON(e,n)}set elevationInfo(e){this._set(`elevationInfo`,e),this.loaded&&this._validateElevationInfo()}get effectiveCapabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.effectiveCapabilities)}get effectiveEditingEnabled(){return this.associatedLayer!=null&&P(this.associatedLayer)}get geometryType(){return Pe[this.profile]||`mesh`}set renderer(e){z(e,this.fieldsIndex),this._set(`renderer`,e)}readCachedDrawingInfo(e){return(typeof e!=`object`||!e)&&(e={}),e.color??(e.color=!1),e}get capabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.capabilities)}_capabilitiesFromAssociatedFeatureLayer(e){e??=le;let{query:t,queryRelated:n,editing:{supportsGlobalId:r,supportsRollbackOnFailure:i,supportsUploadWithItemId:a,supportsGeometryUpdate:o,supportsReturnServiceEditsInSourceSpatialReference:s},data:{supportsZ:c,supportsM:l,isVersioned:u,supportsAttachment:d},operations:{supportsEditing:f,supportsAdd:p,supportsUpdate:m,supportsDelete:h,supportsQuery:g,supportsQueryAttachments:_,supportsAsyncConvert3D:v},attachment:y}=e,b=e.operations.supportsChangeTracking,x=!!this.associatedLayer?.infoFor3D;return{query:t,queryRelated:n,editing:{supportsGlobalId:r,supportsReturnServiceEditsInSourceSpatialReference:s,supportsRollbackOnFailure:i,supportsGeometryUpdate:x&&o,supportsUploadWithItemId:a},data:{supportsAttachment:d,supportsZ:c,supportsM:l,isVersioned:u,queryFormats:e.data.queryFormats,sourceFormats:e.data.sourceFormats},operations:{supportsQuery:g,supportsQueryAttachments:_,supportsEditing:f&&b,supportsAdd:x&&p&&b,supportsDelete:x&&h&&b,supportsUpdate:m&&b,supportsAsyncConvert3D:v},attachment:y}}get editingEnabled(){return this._isOverridden(`editingEnabled`)?this._get(`editingEnabled`):this.associatedLayer?.editingEnabled??!1}set editingEnabled(e){this._overrideIfSome(`editingEnabled`,e)}get infoFor3D(){return this.associatedLayer?.infoFor3D??null}get relationships(){return this.associatedLayer?.relationships}get defaultPopupTemplate(){return this.associatedLayer||this.attributeStorageInfo?this.createPopupTemplate():null}readObjectIdField(e,t){return!e&&t.fields&&t.fields.some(t=>(t.type===`esriFieldTypeOID`&&(e=t.name),!!e)),e||void 0}readGlobalIdField(e,t){return!e&&t.fields&&t.fields.some(t=>(t.type===`esriFieldTypeGlobalID`&&(e=t.name),!!e)),e||void 0}get displayField(){return this.associatedLayer?.displayField??null}readProfile(e,t){let n=t.store.profile;return n!=null&&$[n]?$[n]:(s.getLogger(this).error(`Unknown or missing profile`,{profile:n,layer:this}),`mesh-pyramids`)}get useViewTime(){return this.associatedLayer?.useViewTime??!0}set useViewTime(e){this._override(`useViewTime`,e)}get timeInfo(){let e=this.associatedLayer?.timeInfo;if(e==null)return null;let t=e.clone();return B(t,this.fieldsIndex),t}set timeInfo(e){B(e,this.fieldsIndex),this._override(`timeInfo`,e)}get timeExtent(){return this.associatedLayer?.timeExtent}set timeExtent(e){this._override(`timeExtent`,e)}get timeOffset(){return this.associatedLayer?.timeOffset}set timeOffset(e){this._override(`timeOffset`,e)}get datesInUnknownTimezone(){return this.associatedLayer?.datesInUnknownTimezone??!1}set datesInUnknownTimezone(e){this._override(`datesInUnknownTimezone`,e)}load(e){return this.addResolvingPromise(this._load(e)),Promise.resolve(this)}async _load(e){let t=e?.signal;await this.loadFromPortal({supportedTypes:[`Scene Service`]},e).catch(u),await this._fetchService(t),await Promise.all([this._fetchIndexAndUpdateExtent(this.nodePages,t),this._setAssociatedFeatureLayer(t),this._loadFilterGeometries()]),this._validateElevationInfo(),this._applyAssociatedLayerOverrides(),this._populateFieldUsageInfo(),await this.loadTimeInfoFromService(e),await Se(this,{origin:`service`},t),z(this.renderer,this.fieldsIndex),await this.finishLoadEditablePortalLayer(e)}async beforeSave(){this.filter!=null&&(this.filter=this.filter.clone(),await this.load())}async _loadFilterGeometries(){if(this.filter)try{await this.filter.loadGeometries(this.spatialReference)}catch(e){s.getLogger(this).error(`#_loadFilterGeometries()`,this,`Failed to load filter geometries. Geometry filter will not be applied for this layer.`,{error:e}),this.filter=null}}createQuery(){let e=new we;this.geometryType===`mesh`?this.capabilities.query.supportsReturnMesh&&(e.returnGeometry=!0):(e.returnGeometry=!0,e.returnZ=!0);let{timeOffset:t,timeExtent:n}=this;return e.timeExtent=t!=null&&n!=null?n.offset(-t.value,t.unit):n||null,e.where=this.definitionExpression||`1=1`,e.sqlFormat=`standard`,e.outFields=[`*`],e}queryExtent(e,t){return this._getAssociatedLayerForQuery().then(n=>n.queryExtent(e||this.createQuery(),t))}queryFeatureCount(e,t){return this._getAssociatedLayerForQuery().then(n=>n.queryFeatureCount(e||this.createQuery(),t))}queryFeatures(e,t){return this._getAssociatedLayerForQuery().then(n=>n.queryFeatures(e||this.createQuery(),t)).then(e=>{if(e?.features)for(let t of e.features)t.layer=this,t.sourceLayer=this,t.origin=this.graphicOrigin;return e})}async queryModels(e,t){let[n,{queryModels:r}]=await Promise.all([this._getAssociatedLayerForQuery(),import(`./scene/modelQuerySupport.js`)]);return r(this,n,e,t)}async queryModel(e,t){let[n,{queryModel:r}]=await Promise.all([this._getAssociatedLayerForQuery(),import(`./scene/modelQuerySupport.js`)]);return r(this,n,e,t)}async queryRelatedFeatures(e,t){if(await this.load(),!this.associatedLayer)throw new a(`scenelayer:query-not-available`,`SceneLayer queries are not available without an associated feature layer`,{layer:this});return this.associatedLayer.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){if(await this.load(),!this.associatedLayer)throw new a(`scenelayer:query-not-available`,`SceneLayer queries are not available without an associated feature layer`,{layer:this});return this.associatedLayer.queryRelatedFeaturesCount(e,t)}async queryCachedAttributes(e,t){let n=V(this.fieldsIndex,await je(this,Me(this)));return Ae(this.parsedUrl?.path??``,this.attributeStorageInfo??[],e,t,n,this.apiKey,this.customParameters)}async queryCachedFeature(e,n){let r=await this.queryCachedAttributes(e,[n]);if(!r||r.length===0)throw new a(`scenelayer:feature-not-in-cached-data`,`Feature not found in cached data`);let i=new t;return i.attributes=r[0],i.layer=this,i.sourceLayer=this,i.origin=this.graphicOrigin,i}queryObjectIds(e,t){return this._getAssociatedLayerForQuery().then(n=>n.queryObjectIds(e||this.createQuery(),t))}queryAttachments(e,t){return this._getAssociatedLayerForQuery().then(n=>n.queryAttachments(e,t))}getFieldUsageInfo(e){let t={supportsLabelingInfo:!1,supportsRenderer:!1,supportsPopupTemplate:!1,supportsLayerQuery:!1};return this.loaded?this._fieldUsageInfo[e]||t:(s.getLogger(this).error(`#getFieldUsageInfo()`,`Unavailable until layer is loaded`),t)}createPopupTemplate(e){return De(this,e)}_getAssociatedLayerForQuery(){let e=this.associatedLayer;return e?.loaded?Promise.resolve(e):this._loadAssociatedLayerForQuery()}async _loadAssociatedLayerForQuery(){if(await this.load(),!this.associatedLayer)throw new a(`scenelayer:query-not-available`,`SceneLayer queries are not available without an associated feature layer`,{layer:this});try{await this.associatedLayer.load()}catch(e){throw new a(`scenelayer:query-not-available`,`SceneLayer associated feature layer could not be loaded`,{layer:this,error:e})}return this.associatedLayer}hasCachedStatistics(e){return this.statisticsInfo!=null&&this.statisticsInfo.some(t=>t.name===e)}async queryCachedStatistics(e,t){return await this.load(t),await this.fetchStatistics(e,t)}async saveAs(e,t){return this._debouncedSaveOperations(1,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:`scene`},e)}async save(){return this._debouncedSaveOperations(0,{getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:`scene`})}async applyEdits(e,t){let{applyEdits:n}=await import(`./graphics/editingSupport.js`),r=t;await this.load();let i=this.associatedLayer;if(!i)throw new a(`${this.type}-layer:not-editable`,`Service is not editable`);await i.load();let{globalIdField:o}=i,s=!!i.infoFor3D,c=r?.globalIdUsed??!0;if(s&&o==null)throw new a(`${this.type}-layer:not-editable`,`Valid globalIdField expected on editable SceneLayer`);if(s&&!c)throw new a(`${this.type}-layer:globalid-required`,`globalIdUsed must not be false for SceneLayer editing as globalIds are required.`);return T(i.url)&&s&&e.deleteFeatures!=null&&o!=null&&(r={...r,globalIdToObjectId:await F(i,e.deleteFeatures,o)}),n(this,i.source,e,r)}async uploadAssets(e,t){if(await this.load(),this.associatedLayer==null)throw new a(`${this.type}-layer:not-editable`,`Service is not editable`);return await this.associatedLayer.load(),this.associatedLayer.uploadAssets(e,t)}async convertMesh(e,t){t??={};let n=e=>{throw s.getLogger(this).error(`.convertMesh()`,e.message),e};await this.load(t),this.infoFor3D||n(new a(`invalid:layer`,`SceneLayer has no capability for mesh conversion`));let r=await this.extractAndFilterFiles(e);d(t);let i=r.reduce((e,t)=>de(this.infoFor3D,t)?e+1:e,0);i===0&&n(new ee),i>1&&n(new S);let o=this.spatialReference,c=t.origin,l=await y(c??t.defaultOrigin??new v({x:0,y:0,z:0,spatialReference:o}),o,t),u=o.isGeographic?`local`:`georeferenced`,{createWithExternalSource:f}=await import(`../geometry/support/meshUtils.js`);d(t);let p=f(l,{type:`client`,files:r},{vertexSpace:u,transform:ge(o),unitConversionDisabled:!0}),[m]=await this.uploadAssets([p],{...t,useAssetOrigin:!c});return m}async extractAndFilterFiles(e){await this.load();let t=this.infoFor3D;return t?(await Oe(e)).filter(e=>fe(t,e)):e}validateLayer(e){if(e.layerType&&!X.has(e.layerType))throw new a(`scenelayer:layer-type-not-supported`,`SceneLayer does not support this layer type`,{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new a(`layer:service-version-not-supported`,`Service version is not supported.`,{serviceVersion:this.version.versionString,supportedVersions:`1.x, 2.x`});if(this.version.major>2)throw new a(`layer:service-version-too-new`,`Service version is too new.`,{serviceVersion:this.version.versionString,supportedVersions:`1.x, 2.x`});t(this.normalReferenceFrame,this.spatialReference);function t(e,t){let n=!1,r=!1;if(e==null)n=!0,r=!0;else{let i=t&&t.isGeographic;switch(e){case`east-north-up`:case`earth-centered`:n=!0,r=i;break;case`vertex-reference-frame`:n=!0,r=!i;break;default:n=!1}}if(!n)throw new a(`scenelayer:unsupported-normal-reference-frame`,`Normal reference frame is invalid.`);if(!r)throw new a(`scenelayer:incompatible-normal-reference-frame`,`Normal reference frame is incompatible with layer spatial reference.`)}}get isUsedAsGroundLayer(){return!1}_getTypeKeywords(){let e=[];if(this.profile===`points`)e.push(`Point`);else if(this.profile===`mesh-pyramids`)e.push(`3DObject`);else throw new a(`scenelayer:unknown-profile`,`SceneLayer:save() encountered an unknown SceneLayer profile: `+this.profile);return e}_populateFieldUsageInfo(){if(this._fieldUsageInfo={},this.fields)for(let e of this.fields){let t=!!this.attributeStorageInfo?.some(t=>t.name===e.name),n=!!this.associatedLayer?.fields?.some(t=>t&&e.name===t.name),r={supportsLabelingInfo:t,supportsRenderer:t,supportsPopupTemplate:t||n,supportsLayerQuery:n};this._fieldUsageInfo[e.name]=r}}_applyAssociatedLayerOverrides(){this._applyAssociatedLayerFieldsOverrides(),this._applyAssociatedLayerPropertyOverrides(),this._applyAssociatedLayerExtentOverride(),this._applyAssociatedLayerPrivileges()}_applyAssociatedLayerFieldsOverrides(){if(!this.associatedLayer?.fields)return;let e=null;for(let t of this.associatedLayer.fields){let n=this.getField(t.name);n?(!n.domain&&t.domain&&(n.domain=t.domain.clone()),n.editable=t.editable,n.nullable=t.nullable,n.length=t.length):(e||=this.fields?this.fields.slice():[],e.push(t.clone()))}e&&this._set(`fields`,e)}_applyAssociatedLayerPropertyOverrides(){if(!this.associatedLayer)return;let e=[`popupTemplate`,`popupEnabled`,`attributeTableTemplate`],t=_(this);for(let n=0;n<e.length;n++){let r=e[n],i=this.originIdOf(r),a=this.associatedLayer.originIdOf(r);i<a&&(a===2||a===3)&&t.setAtOrigin(r,this.associatedLayer[r],a)}}_applyAssociatedLayerExtentOverride(){let e=this.associatedLayer?.getAtOrigin(`fullExtent`,`service`);this.associatedLayer?.infoFor3D!=null&&e&&T(this.associatedLayer?.url)&&K(this)&&_(this).setAtOrigin(`fullExtent`,e.clone(),2)}_applyAssociatedLayerPrivileges(){let e=this.associatedLayer;e&&(this._set(`userHasEditingPrivileges`,e.userHasEditingPrivileges),this._set(`userHasFullEditingPrivileges`,e.userHasFullEditingPrivileges),this._set(`userHasUpdateItemPrivileges`,e.userHasUpdateItemPrivileges))}async _setAssociatedFeatureLayer(e){if([`mesh-pyramids`,`points`].includes(this.profile))try{let{serverUrl:t,layerId:n,portalItem:r}=await ce(`${this.url}/layers/${this.layerId}`,{sceneLayerItem:this.portalItem,customParameters:this.customParameters,apiKey:this.apiKey,signal:e}),i=await he.FeatureLayer();this.associatedLayer=new i({url:t,customParameters:this.customParameters,apiKey:this.apiKey,layerId:n,portalItem:r}),await this.associatedLayer.load()}catch(e){f(e)||this._logWarningOnPopupEnabled().catch(()=>{})}}async _logWarningOnPopupEnabled(){let e=new AbortController;this.addHandles(o(e));try{await m(()=>this.popupEnabled&&this.popupTemplate!=null,e.signal)}catch(e){p(e);return}let t=`this SceneLayer: ${this.title}`;this.attributeStorageInfo==null?s.getLogger(this).warn(`Associated FeatureLayer could not be loaded and no binary attributes found. Popups will not work on ${t}`):s.getLogger(this).info(`Associated FeatureLayer could not be loaded. Falling back to binary attributes for Popups on ${t}`)}_validateElevationInfo(){let e=this.elevationInfo;this.profile===`mesh-pyramids`&&q(s.getLogger(this),Te(`Mesh scene layers`,`relative-to-scene`,e)),q(s.getLogger(this),Ee(`Scene layers`,e))}async fetchStatistics(e,t){return await ye({fieldName:e,statisticsInfo:this.statisticsInfo,errorContext:`scenelayer`,fieldsIndex:this.fieldsIndex,path:this.parsedUrl?.path??``,customParameters:this.customParameters,apiKey:this.apiKey,signal:t?.signal})}async loadTimeInfoFromService(e){let{serviceTimeInfo:t}=this;if(t==null)return;let{startTimeField:n,endTimeField:r}=t;if(n==null&&r==null||K({associatedLayer:this.associatedLayer,serviceUpdateTimeStamp:this.serviceUpdateTimeStamp}))return;let i=async t=>{let r=null;try{r=(await this.fetchStatistics(t,e))?.stats}catch{}if(r==null)return null;let{minTimeStr:i,min:a,maxTimeStr:o,max:s}=r,c=t===n?i??a:o??s;return c==null?null:new Date(c)},[a,o]=await Promise.all([i(n),i(r)]);if(n!=null&&a==null||r!=null&&o==null)return;let s=new J({start:a,end:o});this.setAtOrigin(`timeInfo`,new xe({endField:r,startField:n,fullTimeExtent:s}),`service`)}};e([h({types:{key:`type`,base:null,typeMap:{selection:I}},json:{origins:{"web-scene":{name:`layerDefinition.featureReduction`,write:{allowNull:!0}},"portal-item":{name:`layerDefinition.featureReduction`,write:{allowNull:!0}}}}})],Q.prototype,`featureReduction`,void 0),e([h({type:[_e],json:{read:!1,origins:{"web-scene":{name:`layerDefinition.rangeInfos`,write:!0},"portal-item":{name:`layerDefinition.rangeInfos`,write:!0}}},clonable:!1})],Q.prototype,`rangeInfos`,void 0),e([h({json:{read:!1}})],Q.prototype,`associatedLayer`,void 0),e([h({type:[`show`,`hide`]})],Q.prototype,`listMode`,void 0),e([h({type:[`ArcGISSceneServiceLayer`]})],Q.prototype,`operationalLayerType`,void 0),e([h({json:{read:!1},readOnly:!0})],Q.prototype,`type`,void 0),e([h({...Z.fields,readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Q.prototype,`fields`,void 0),e([h()],Q.prototype,`types`,null),e([h()],Q.prototype,`typeIdField`,null),e([h()],Q.prototype,`templates`,null),e([h()],Q.prototype,`formTemplate`,null),e([h({readOnly:!0})],Q.prototype,`graphicOrigin`,void 0),e([h({readOnly:!0,clonable:!1})],Q.prototype,`fieldsIndex`,null),e([h({type:me,json:{read:{source:`layerDefinition.floorInfo`},write:{target:`layerDefinition.floorInfo`}}})],Q.prototype,`floorInfo`,void 0),e([h(Z.outFields)],Q.prototype,`outFields`,void 0),e([h({type:H,readOnly:!0,json:{read:!1},clonable:!1})],Q.prototype,`nodePages`,void 0),e([Y(`service`,`nodePages`,[`nodePages`,`pointNodePages`])],Q.prototype,`readNodePages`,null),e([h({type:[U],readOnly:!0,clonable:!1})],Q.prototype,`materialDefinitions`,void 0),e([h({type:[W],readOnly:!0,clonable:!1})],Q.prototype,`textureSetDefinitions`,void 0),e([h({type:[ue],readOnly:!0,clonable:!1})],Q.prototype,`geometryDefinitions`,void 0),e([h({readOnly:!0})],Q.prototype,`serviceUpdateTimeStamp`,void 0),e([h({readOnly:!0})],Q.prototype,`attributeStorageInfo`,void 0),e([h({readOnly:!0})],Q.prototype,`statisticsInfo`,void 0),e([h({type:i.ofType(Number),nonNullable:!0,json:{origins:{service:{read:!1,write:!1}},name:`layerDefinition.excludeObjectIds`,write:{enabled:!0}}})],Q.prototype,`excludeObjectIds`,void 0),e([h({type:String,json:{origins:{service:{read:!1,write:!1}},name:`layerDefinition.definitionExpression`,write:{enabled:!0,allowNull:!0}}})],Q.prototype,`definitionExpression`,void 0),e([h({type:ve,json:{name:`layerDefinition.polygonFilter`,write:{enabled:!0,allowNull:!0},origins:{service:{read:!1,write:!1}}}})],Q.prototype,`filter`,void 0),e([h({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],Q.prototype,`path`,void 0),e([h(E)],Q.prototype,`elevationInfo`,null),e([h({readOnly:!0,json:{read:!1}})],Q.prototype,`effectiveCapabilities`,null),e([h({readOnly:!0})],Q.prototype,`effectiveEditingEnabled`,null),e([h({type:String})],Q.prototype,`geometryType`,null),e([h(D)],Q.prototype,`labelsVisible`,void 0),e([h({type:[pe],json:{origins:{service:{name:`drawingInfo.labelingInfo`,read:{reader:G},write:!1}},name:`layerDefinition.drawingInfo.labelingInfo`,read:{reader:G},write:!0}})],Q.prototype,`labelingInfo`,void 0),e([h(O)],Q.prototype,`legendEnabled`,void 0),e([h({type:Number,json:{origins:{"web-document":{default:1,write:{enabled:!0,target:{opacity:{type:Number},"layerDefinition.drawingInfo.transparency":{type:Number}}},read:{source:[`opacity`,`layerDefinition.drawingInfo.transparency`],reader(e,t){if(typeof e==`number`&&e>=0&&e<=1)return e;let n=t.layerDefinition?.drawingInfo?.transparency;return n===void 0?void 0:Ne(n)}}},"portal-item":{write:!0},service:{read:!1}}}})],Q.prototype,`opacity`,void 0),e([h({type:[`Low`,`High`],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Q.prototype,`priority`,void 0),e([h({type:[`Labels`],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Q.prototype,`semantic`,void 0),e([h({types:Ce,json:{origins:{service:{read:{source:`drawingInfo.renderer`}}},name:`layerDefinition.drawingInfo.renderer`,write:!0},value:null})],Q.prototype,`renderer`,null),e([h({json:{read:!1}})],Q.prototype,`cachedDrawingInfo`,void 0),e([Y(`service`,`cachedDrawingInfo`)],Q.prototype,`readCachedDrawingInfo`,null),e([h({readOnly:!0,json:{read:!1}})],Q.prototype,`capabilities`,null),e([h({type:Boolean,json:{read:!1}})],Q.prototype,`editingEnabled`,null),e([h({readOnly:!0,json:{write:!1,read:!1}})],Q.prototype,`infoFor3D`,null),e([h({readOnly:!0,json:{write:!1,read:!1}})],Q.prototype,`relationships`,null),e([h(k)],Q.prototype,`popupEnabled`,void 0),e([h({type:n,json:{name:`popupInfo`,write:!0}})],Q.prototype,`popupTemplate`,void 0),e([h({readOnly:!0,json:{read:!1}})],Q.prototype,`defaultPopupTemplate`,null),e([h(A)],Q.prototype,`attributeTableTemplate`,void 0),e([h({type:String,json:{read:!1}})],Q.prototype,`objectIdField`,void 0),e([Y(`service`,`objectIdField`,[`objectIdField`,`fields`])],Q.prototype,`readObjectIdField`,null),e([h({type:String,json:{read:!1}})],Q.prototype,`globalIdField`,void 0),e([Y(`service`,`globalIdField`,[`globalIdField`,`fields`])],Q.prototype,`readGlobalIdField`,null),e([h({readOnly:!0,type:String,json:{read:!1}})],Q.prototype,`displayField`,null),e([h({type:String,json:{read:!1}})],Q.prototype,`profile`,void 0),e([Y(`service`,`profile`,[`store.profile`])],Q.prototype,`readProfile`,null),e([h({readOnly:!0,type:String,json:{origins:{service:{read:{source:`store.normalReferenceFrame`}}},read:!1}})],Q.prototype,`normalReferenceFrame`,void 0),e([h(j)],Q.prototype,`screenSizePerspectiveEnabled`,void 0),e([h({json:{read:!1,origins:{service:{read:!0}}}})],Q.prototype,`serviceItemId`,void 0),e([h(se)],Q.prototype,`useViewTime`,null),e([h(M({disableServiceOrigin:!0,webDocumentOrigin:`web-scene`}))],Q.prototype,`timeInfo`,null),e([h({type:J,json:{read:!1,write:!1}})],Q.prototype,`timeExtent`,null),e([h({type:ke,json:{read:!1,write:!1}})],Q.prototype,`timeOffset`,null),e([h({type:Boolean,nonNullable:!0,json:{read:!1,write:!1}})],Q.prototype,`datesInUnknownTimezone`,null),e([h({type:be,readOnly:!0,json:{read:{source:`timeInfo`}},clonable:!1})],Q.prototype,`serviceTimeInfo`,void 0),e([h()],Q.prototype,`isUsedAsGroundLayer`,null),Q=e([g(`esri.layers.SceneLayer`)],Q);const $={"mesh-pyramids":`mesh-pyramids`,meshpyramids:`mesh-pyramids`,"features-meshes":`mesh-pyramids`,points:`points`,"features-points":`points`,lines:`lines`,"features-lines":`lines`,polygons:`polygons`,"features-polygons":`polygons`},Pe={"mesh-pyramids":`mesh`,points:`point`},Fe=Q;export{Fe as default};
2
+ import{__decorate as e}from"tslib";import t from"../Graphic.js";import n from"../PopupTemplate.js";import{ClonableMixin as r}from"../core/Clonable.js";import i from"../core/Collection.js";import a from"../core/Error.js";import{abortHandle as o}from"../core/handleUtils.js";import s from"../core/Logger.js";import{destroyMaybe as c}from"../core/maybe.js";import{MultiOriginJSONSupportMixin as l}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as u,throwIfAborted as d,isAbortError as f,throwIfNotAbortError as p}from"../core/promiseUtils.js";import{whenOnce as m}from"../core/reactiveUtils.js";import{property as h,subclass as g}from"../core/accessorSupport/decorators.js";import{getProperties as _}from"../core/accessorSupport/utils.js";import v from"../geometry/Point.js";import{projectAsync as y}from"../geometry/projectionUtils.js";import b from"../graphic/SceneGraphicOrigin.js";import x from"./Layer.js";import{NoModelError as ee,MultipleModelsError as S}from"./graphics/sources/support/uploadAssetErrors.js";import{APIKeyMixin as C}from"./mixins/APIKeyMixin.js";import{ArcGISService as w}from"./mixins/ArcGISService.js";import{CustomParametersMixin as te}from"./mixins/CustomParametersMixin.js";import{EditBusLayer as ne}from"./mixins/EditBusLayer.js";import{OperationalLayer as re}from"./mixins/OperationalLayer.js";import{PortalLayer as ie}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as ae}from"./mixins/ScaleRangeLayer.js";import{SceneService as oe}from"./mixins/SceneService.js";import{useViewTimeProperty as se}from"./mixins/TemporalLayer.js";import{isHostedAgolService as T}from"./support/arcgisLayerUrl.js";import{findAssociatedFeatureService as ce}from"./support/associatedFeatureServiceUtils.js";import{zeroCapabilities as le}from"./support/capabilities.js";import{elevationInfo as E,labelsVisible as D,legendEnabled as O,popupEnabled as k,attributeTableTemplate as A,screenSizePerspectiveEnabled as j,timeInfo as M}from"./support/commonProperties.js";import{getFieldDomain as N,computeEffectiveEditingEnabled as P,getGlobalIdToObjectIdMap as F}from"./support/featureLayerUtils.js";import I from"./support/FeatureReductionSelection.js";import{defineFieldProperties as L}from"./support/fieldProperties.js";import R from"./support/FieldsIndex.js";import{fixRendererFields as z,fixTimeInfoFields as B,unpackFieldNames as V}from"./support/fieldUtils.js";import{I3SNodePageDefinition as H,I3SMaterialDefinition as U,I3STextureSetDefinition as W,I3SGeometryDefinition as ue}from"./support/I3SLayerDefinitions.js";import{isFileEditFormat as de,isFileSupported as fe}from"./support/infoFor3D.js";import pe from"./support/LabelClass.js";import{reader as G}from"./support/labelingInfo.js";import me from"./support/LayerFloorInfo.js";import{layersLoaderMap as he}from"./support/layersLoader.js";import{getMeshTransformForMetersToSpatialReference as ge}from"./support/meshSpatialReferenceScaleUtils.js";import{RangeInfo as _e}from"./support/RangeInfo.js";import ve from"./support/SceneFilter.js";import{cacheIsOutOfSync as K}from"./support/sceneLayerCacheUtils.js";import{fetchStatistics as ye}from"./support/sceneLayerStatistics.js";import{SceneServiceTimeInfo as be}from"./support/SceneServiceTimeInfo.js";import xe from"./support/TimeInfo.js";import{loadStyleRenderer as Se}from"../renderers/support/styleUtils.js";import{webSceneRendererTypes as Ce}from"../renderers/support/typeUtils.js";import we from"../rest/support/Query.js";import{logInvalidElevationInfoWarning as q,elevationModeUnsupportedMessage as Te,featureExpressionUnsupportedMessage as Ee}from"../support/elevationInfoUtils.js";import{createPopupTemplate as De}from"../support/popupUtils.js";import{extractZipFiles as Oe}from"../support/zipUtils.js";import J from"../time/TimeExtent.js";import ke from"../time/TimeInterval.js";import{queryAttributesFromCachedAttributesId as Ae}from"../views/3d/layers/i3s/I3SUtil.js";import{getRequiredFields as je,getFetchPopupTemplate as Me}from"../views/layers/support/popupUtils.js";import{transparencyToOpacity as Ne}from"../webdoc/support/opacityUtils.js";import{reader as Y}from"../core/accessorSupport/decorators/reader.js";const X=new Set([`3DObject`,`Point`]),Z=L();let Q=class extends ne(oe(w(re(ie(ae(l(te(C(r(x)))))))))){constructor(...e){super(...e),this.featureReduction=null,this.rangeInfos=null,this.operationalLayerType=`ArcGISSceneServiceLayer`,this.type=`scene`,this.fields=null,this.graphicOrigin=new b(this),this.floorInfo=null,this.outFields=null,this.nodePages=null,this.materialDefinitions=null,this.textureSetDefinitions=null,this.geometryDefinitions=null,this.serviceUpdateTimeStamp=null,this.excludeObjectIds=new i,this.definitionExpression=null,this.filter=null,this.path=null,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.priority=null,this.semantic=null,this.cachedDrawingInfo={color:!1},this.popupEnabled=!0,this.popupTemplate=null,this.attributeTableTemplate=null,this.objectIdField=null,this.globalIdField=null,this._fieldUsageInfo={},this.screenSizePerspectiveEnabled=!0,this.serviceItemId=void 0,this.serviceTimeInfo=null}normalizeCtorArgs(e,t){return typeof e==`string`?{url:e,...t}:e}destroy(){this._set(`renderer`,null),this.associatedLayer=c(this.associatedLayer)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){let n=this.getField(e)?.domain??null;return this.associatedLayer?N(this.associatedLayer,e,t,n):n}getFeatureType(e){return e&&this.associatedLayer?this.associatedLayer.getFeatureType(e):null}get types(){return this.associatedLayer?.types??[]}get typeIdField(){return this.associatedLayer?.typeIdField??null}get templates(){return this.associatedLayer?.templates??null}get formTemplate(){return this.associatedLayer?.formTemplate??null}get fieldsIndex(){return new R(this.fields)}readNodePages(e,t,n){return t.layerType===`Point`&&(e=t.pointNodePages),typeof e!=`object`||!e?null:H.fromJSON(e,n)}set elevationInfo(e){this._set(`elevationInfo`,e),this.loaded&&this._validateElevationInfo()}get effectiveCapabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.effectiveCapabilities)}get effectiveEditingEnabled(){return this.associatedLayer!=null&&P(this.associatedLayer)}get geometryType(){return Pe[this.profile]||`mesh`}set renderer(e){z(e,this.fieldsIndex),this._set(`renderer`,e)}readCachedDrawingInfo(e){return(typeof e!=`object`||!e)&&(e={}),e.color??(e.color=!1),e}get capabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.capabilities)}_capabilitiesFromAssociatedFeatureLayer(e){e??=le;let{query:t,queryRelated:n,editing:{supportsGlobalId:r,supportsRollbackOnFailure:i,supportsUploadWithItemId:a,supportsGeometryUpdate:o,supportsReturnServiceEditsInSourceSpatialReference:s},data:{supportsZ:c,supportsM:l,isVersioned:u,supportsAttachment:d},operations:{supportsEditing:f,supportsAdd:p,supportsUpdate:m,supportsDelete:h,supportsQuery:g,supportsQueryAttachments:_,supportsAsyncConvert3D:v},attachment:y}=e,b=e.operations.supportsChangeTracking,x=!!this.associatedLayer?.infoFor3D;return{query:t,queryRelated:n,editing:{supportsGlobalId:r,supportsReturnServiceEditsInSourceSpatialReference:s,supportsRollbackOnFailure:i,supportsGeometryUpdate:x&&o,supportsUploadWithItemId:a},data:{supportsAttachment:d,supportsZ:c,supportsM:l,isVersioned:u,queryFormats:e.data.queryFormats,sourceFormats:e.data.sourceFormats},operations:{supportsQuery:g,supportsQueryAttachments:_,supportsEditing:f&&b,supportsAdd:x&&p&&b,supportsDelete:x&&h&&b,supportsUpdate:m&&b,supportsAsyncConvert3D:v},attachment:y}}get editingEnabled(){return this._isOverridden(`editingEnabled`)?this._get(`editingEnabled`):this.associatedLayer?.editingEnabled??!1}set editingEnabled(e){this._overrideIfSome(`editingEnabled`,e)}get infoFor3D(){return this.associatedLayer?.infoFor3D??null}get relationships(){return this.associatedLayer?.relationships}get defaultPopupTemplate(){return this.associatedLayer||this.attributeStorageInfo?this.createPopupTemplate():null}readObjectIdField(e,t){return!e&&t.fields&&t.fields.some(t=>(t.type===`esriFieldTypeOID`&&(e=t.name),!!e)),e||void 0}readGlobalIdField(e,t){return!e&&t.fields&&t.fields.some(t=>(t.type===`esriFieldTypeGlobalID`&&(e=t.name),!!e)),e||void 0}get displayField(){return this.associatedLayer?.displayField??null}readProfile(e,t){let n=t.store.profile;return n!=null&&$[n]?$[n]:(s.getLogger(this).error(`Unknown or missing profile`,{profile:n,layer:this}),`mesh-pyramids`)}get useViewTime(){return this.associatedLayer?.useViewTime??!0}set useViewTime(e){this._override(`useViewTime`,e)}get timeInfo(){let e=this.associatedLayer?.timeInfo;if(e==null)return null;let t=e.clone();return B(t,this.fieldsIndex),t}set timeInfo(e){B(e,this.fieldsIndex),this._override(`timeInfo`,e),this.associatedLayer&&(this.associatedLayer.timeInfo=e)}get timeExtent(){return this.associatedLayer?.timeExtent}set timeExtent(e){this._override(`timeExtent`,e)}get timeOffset(){return this.associatedLayer?.timeOffset}set timeOffset(e){this._override(`timeOffset`,e)}get datesInUnknownTimezone(){return this.associatedLayer?.datesInUnknownTimezone??!1}set datesInUnknownTimezone(e){this._override(`datesInUnknownTimezone`,e)}load(e){return this.addResolvingPromise(this._load(e)),Promise.resolve(this)}async _load(e){let t=e?.signal;await this.loadFromPortal({supportedTypes:[`Scene Service`]},e).catch(u),await this._fetchService(t),await Promise.all([this._fetchIndexAndUpdateExtent(this.nodePages,t),this._setAssociatedFeatureLayer(t),this._loadFilterGeometries()]),this._validateElevationInfo(),this._applyAssociatedLayerOverrides(),this._populateFieldUsageInfo(),await this.loadTimeInfoFromService(e),await Se(this,{origin:`service`},t),z(this.renderer,this.fieldsIndex),await this.finishLoadEditablePortalLayer(e)}async beforeSave(){this.filter!=null&&(this.filter=this.filter.clone(),await this.load())}async _loadFilterGeometries(){if(this.filter)try{await this.filter.loadGeometries(this.spatialReference)}catch(e){s.getLogger(this).error(`#_loadFilterGeometries()`,this,`Failed to load filter geometries. Geometry filter will not be applied for this layer.`,{error:e}),this.filter=null}}createQuery(){let e=new we;this.geometryType===`mesh`?this.capabilities.query.supportsReturnMesh&&(e.returnGeometry=!0):(e.returnGeometry=!0,e.returnZ=!0);let{timeOffset:t,timeExtent:n}=this;return e.timeExtent=t!=null&&n!=null?n.offset(-t.value,t.unit):n||null,e.where=this.definitionExpression||`1=1`,e.sqlFormat=`standard`,e.outFields=[`*`],e}queryExtent(e,t){return this._getAssociatedLayerForQuery().then(n=>n.queryExtent(e||this.createQuery(),t))}queryFeatureCount(e,t){return this._getAssociatedLayerForQuery().then(n=>n.queryFeatureCount(e||this.createQuery(),t))}queryFeatures(e,t){return this._getAssociatedLayerForQuery().then(n=>n.queryFeatures(e||this.createQuery(),t)).then(e=>{if(e?.features)for(let t of e.features)t.layer=this,t.sourceLayer=this,t.origin=this.graphicOrigin;return e})}async queryModels(e,t){let[n,{queryModels:r}]=await Promise.all([this._getAssociatedLayerForQuery(),import(`./scene/modelQuerySupport.js`)]);return r(this,n,e,t)}async queryModel(e,t){let[n,{queryModel:r}]=await Promise.all([this._getAssociatedLayerForQuery(),import(`./scene/modelQuerySupport.js`)]);return r(this,n,e,t)}async queryRelatedFeatures(e,t){if(await this.load(),!this.associatedLayer)throw new a(`scenelayer:query-not-available`,`SceneLayer queries are not available without an associated feature layer`,{layer:this});return this.associatedLayer.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){if(await this.load(),!this.associatedLayer)throw new a(`scenelayer:query-not-available`,`SceneLayer queries are not available without an associated feature layer`,{layer:this});return this.associatedLayer.queryRelatedFeaturesCount(e,t)}async queryCachedAttributes(e,t){let n=V(this.fieldsIndex,await je(this,Me(this)));return Ae(this.parsedUrl?.path??``,this.attributeStorageInfo??[],e,t,n,this.apiKey,this.customParameters)}async queryCachedFeature(e,n){let r=await this.queryCachedAttributes(e,[n]);if(!r||r.length===0)throw new a(`scenelayer:feature-not-in-cached-data`,`Feature not found in cached data`);let i=new t;return i.attributes=r[0],i.layer=this,i.sourceLayer=this,i.origin=this.graphicOrigin,i}queryObjectIds(e,t){return this._getAssociatedLayerForQuery().then(n=>n.queryObjectIds(e||this.createQuery(),t))}queryAttachments(e,t){return this._getAssociatedLayerForQuery().then(n=>n.queryAttachments(e,t))}getFieldUsageInfo(e){let t={supportsLabelingInfo:!1,supportsRenderer:!1,supportsPopupTemplate:!1,supportsLayerQuery:!1};return this.loaded?this._fieldUsageInfo[e]||t:(s.getLogger(this).error(`#getFieldUsageInfo()`,`Unavailable until layer is loaded`),t)}createPopupTemplate(e){return De(this,e)}_getAssociatedLayerForQuery(){let e=this.associatedLayer;return e?.loaded?Promise.resolve(e):this._loadAssociatedLayerForQuery()}async _loadAssociatedLayerForQuery(){if(await this.load(),!this.associatedLayer)throw new a(`scenelayer:query-not-available`,`SceneLayer queries are not available without an associated feature layer`,{layer:this});try{await this.associatedLayer.load()}catch(e){throw new a(`scenelayer:query-not-available`,`SceneLayer associated feature layer could not be loaded`,{layer:this,error:e})}return this.associatedLayer}hasCachedStatistics(e){return this.statisticsInfo!=null&&this.statisticsInfo.some(t=>t.name===e)}async queryCachedStatistics(e,t){return await this.load(t),await this.fetchStatistics(e,t)}async saveAs(e,t){return this._debouncedSaveOperations(1,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:`scene`},e)}async save(){return this._debouncedSaveOperations(0,{getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:`scene`})}async applyEdits(e,t){let{applyEdits:n}=await import(`./graphics/editingSupport.js`),r=t;await this.load();let i=this.associatedLayer;if(!i)throw new a(`${this.type}-layer:not-editable`,`Service is not editable`);await i.load();let{globalIdField:o}=i,s=!!i.infoFor3D,c=r?.globalIdUsed??!0;if(s&&o==null)throw new a(`${this.type}-layer:not-editable`,`Valid globalIdField expected on editable SceneLayer`);if(s&&!c)throw new a(`${this.type}-layer:globalid-required`,`globalIdUsed must not be false for SceneLayer editing as globalIds are required.`);return T(i.url)&&s&&e.deleteFeatures!=null&&o!=null&&(r={...r,globalIdToObjectId:await F(i,e.deleteFeatures,o)}),n(this,i.source,e,r)}async uploadAssets(e,t){if(await this.load(),this.associatedLayer==null)throw new a(`${this.type}-layer:not-editable`,`Service is not editable`);return await this.associatedLayer.load(),this.associatedLayer.uploadAssets(e,t)}async convertMesh(e,t){t??={};let n=e=>{throw s.getLogger(this).error(`.convertMesh()`,e.message),e};await this.load(t),this.infoFor3D||n(new a(`invalid:layer`,`SceneLayer has no capability for mesh conversion`));let r=await this.extractAndFilterFiles(e);d(t);let i=r.reduce((e,t)=>de(this.infoFor3D,t)?e+1:e,0);i===0&&n(new ee),i>1&&n(new S);let o=this.spatialReference,c=t.origin,l=await y(c??t.defaultOrigin??new v({x:0,y:0,z:0,spatialReference:o}),o,t),u=o.isGeographic?`local`:`georeferenced`,{createWithExternalSource:f}=await import(`../geometry/support/meshUtils.js`);d(t);let p=f(l,{type:`client`,files:r},{vertexSpace:u,transform:ge(o),unitConversionDisabled:!0}),[m]=await this.uploadAssets([p],{...t,useAssetOrigin:!c});return m}async extractAndFilterFiles(e){await this.load();let t=this.infoFor3D;return t?(await Oe(e)).filter(e=>fe(t,e)):e}validateLayer(e){if(e.layerType&&!X.has(e.layerType))throw new a(`scenelayer:layer-type-not-supported`,`SceneLayer does not support this layer type`,{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new a(`layer:service-version-not-supported`,`Service version is not supported.`,{serviceVersion:this.version.versionString,supportedVersions:`1.x, 2.x`});if(this.version.major>2)throw new a(`layer:service-version-too-new`,`Service version is too new.`,{serviceVersion:this.version.versionString,supportedVersions:`1.x, 2.x`});t(this.normalReferenceFrame,this.spatialReference);function t(e,t){let n=!1,r=!1;if(e==null)n=!0,r=!0;else{let i=t&&t.isGeographic;switch(e){case`east-north-up`:case`earth-centered`:n=!0,r=i;break;case`vertex-reference-frame`:n=!0,r=!i;break;default:n=!1}}if(!n)throw new a(`scenelayer:unsupported-normal-reference-frame`,`Normal reference frame is invalid.`);if(!r)throw new a(`scenelayer:incompatible-normal-reference-frame`,`Normal reference frame is incompatible with layer spatial reference.`)}}get isUsedAsGroundLayer(){return!1}_getTypeKeywords(){let e=[];if(this.profile===`points`)e.push(`Point`);else if(this.profile===`mesh-pyramids`)e.push(`3DObject`);else throw new a(`scenelayer:unknown-profile`,`SceneLayer:save() encountered an unknown SceneLayer profile: `+this.profile);return e}_populateFieldUsageInfo(){if(this._fieldUsageInfo={},this.fields)for(let e of this.fields){let t=!!this.attributeStorageInfo?.some(t=>t.name===e.name),n=!!this.associatedLayer?.fields?.some(t=>t&&e.name===t.name),r={supportsLabelingInfo:t,supportsRenderer:t,supportsPopupTemplate:t||n,supportsLayerQuery:n};this._fieldUsageInfo[e.name]=r}}_applyAssociatedLayerOverrides(){this._applyAssociatedLayerFieldsOverrides(),this._applyAssociatedLayerPropertyOverrides(),this._applyAssociatedLayerExtentOverride(),this._applyAssociatedLayerPrivileges()}_applyAssociatedLayerFieldsOverrides(){if(!this.associatedLayer?.fields)return;let e=null;for(let t of this.associatedLayer.fields){let n=this.getField(t.name);n?(!n.domain&&t.domain&&(n.domain=t.domain.clone()),n.editable=t.editable,n.nullable=t.nullable,n.length=t.length):(e||=this.fields?this.fields.slice():[],e.push(t.clone()))}e&&this._set(`fields`,e)}_applyAssociatedLayerPropertyOverrides(){if(!this.associatedLayer)return;let e=[`popupTemplate`,`popupEnabled`,`attributeTableTemplate`],t=_(this);for(let n=0;n<e.length;n++){let r=e[n],i=this.originIdOf(r),a=this.associatedLayer.originIdOf(r);i<a&&(a===2||a===3)&&t.setAtOrigin(r,this.associatedLayer[r],a)}}_applyAssociatedLayerExtentOverride(){let e=this.associatedLayer?.getAtOrigin(`fullExtent`,`service`);this.associatedLayer?.infoFor3D!=null&&e&&T(this.associatedLayer?.url)&&K(this)&&_(this).setAtOrigin(`fullExtent`,e.clone(),2)}_applyAssociatedLayerPrivileges(){let e=this.associatedLayer;e&&(this._set(`userHasEditingPrivileges`,e.userHasEditingPrivileges),this._set(`userHasFullEditingPrivileges`,e.userHasFullEditingPrivileges),this._set(`userHasUpdateItemPrivileges`,e.userHasUpdateItemPrivileges))}async _setAssociatedFeatureLayer(e){if([`mesh-pyramids`,`points`].includes(this.profile))try{let{serverUrl:t,layerId:n,portalItem:r}=await ce(`${this.url}/layers/${this.layerId}`,{sceneLayerItem:this.portalItem,customParameters:this.customParameters,apiKey:this.apiKey,signal:e}),i=await he.FeatureLayer();this.associatedLayer=new i({url:t,customParameters:this.customParameters,apiKey:this.apiKey,layerId:n,portalItem:r}),await this.associatedLayer.load(),this._isOverridden(`timeInfo`)&&(this.associatedLayer.timeInfo=this.timeInfo)}catch(e){f(e)||this._logWarningOnPopupEnabled().catch(()=>{})}}async _logWarningOnPopupEnabled(){let e=new AbortController;this.addHandles(o(e));try{await m(()=>this.popupEnabled&&this.popupTemplate!=null,e.signal)}catch(e){p(e);return}let t=`this SceneLayer: ${this.title}`;this.attributeStorageInfo==null?s.getLogger(this).warn(`Associated FeatureLayer could not be loaded and no binary attributes found. Popups will not work on ${t}`):s.getLogger(this).info(`Associated FeatureLayer could not be loaded. Falling back to binary attributes for Popups on ${t}`)}_validateElevationInfo(){let e=this.elevationInfo;this.profile===`mesh-pyramids`&&q(s.getLogger(this),Te(`Mesh scene layers`,`relative-to-scene`,e)),q(s.getLogger(this),Ee(`Scene layers`,e))}async fetchStatistics(e,t){return await ye({fieldName:e,statisticsInfo:this.statisticsInfo,errorContext:`scenelayer`,fieldsIndex:this.fieldsIndex,path:this.parsedUrl?.path??``,customParameters:this.customParameters,apiKey:this.apiKey,signal:t?.signal})}async loadTimeInfoFromService(e){let{serviceTimeInfo:t}=this;if(t==null)return;let{startTimeField:n,endTimeField:r}=t;if(n==null&&r==null||K({associatedLayer:this.associatedLayer,serviceUpdateTimeStamp:this.serviceUpdateTimeStamp}))return;let i=async t=>{let r=null;try{r=(await this.fetchStatistics(t,e))?.stats}catch{}if(r==null)return null;let{minTimeStr:i,min:a,maxTimeStr:o,max:s}=r,c=t===n?i??a:o??s;return c==null?null:new Date(c)},[a,o]=await Promise.all([i(n),i(r)]);if(n!=null&&a==null||r!=null&&o==null)return;let s=new J({start:a,end:o});this.setAtOrigin(`timeInfo`,new xe({endField:r,startField:n,fullTimeExtent:s}),`service`)}};e([h({types:{key:`type`,base:null,typeMap:{selection:I}},json:{origins:{"web-scene":{name:`layerDefinition.featureReduction`,write:{allowNull:!0}},"portal-item":{name:`layerDefinition.featureReduction`,write:{allowNull:!0}}}}})],Q.prototype,`featureReduction`,void 0),e([h({type:[_e],json:{read:!1,origins:{"web-scene":{name:`layerDefinition.rangeInfos`,write:!0},"portal-item":{name:`layerDefinition.rangeInfos`,write:!0}}},clonable:!1})],Q.prototype,`rangeInfos`,void 0),e([h({json:{read:!1}})],Q.prototype,`associatedLayer`,void 0),e([h({type:[`show`,`hide`]})],Q.prototype,`listMode`,void 0),e([h({type:[`ArcGISSceneServiceLayer`]})],Q.prototype,`operationalLayerType`,void 0),e([h({json:{read:!1},readOnly:!0})],Q.prototype,`type`,void 0),e([h({...Z.fields,readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Q.prototype,`fields`,void 0),e([h()],Q.prototype,`types`,null),e([h()],Q.prototype,`typeIdField`,null),e([h()],Q.prototype,`templates`,null),e([h()],Q.prototype,`formTemplate`,null),e([h({readOnly:!0})],Q.prototype,`graphicOrigin`,void 0),e([h({readOnly:!0,clonable:!1})],Q.prototype,`fieldsIndex`,null),e([h({type:me,json:{read:{source:`layerDefinition.floorInfo`},write:{target:`layerDefinition.floorInfo`}}})],Q.prototype,`floorInfo`,void 0),e([h(Z.outFields)],Q.prototype,`outFields`,void 0),e([h({type:H,readOnly:!0,json:{read:!1},clonable:!1})],Q.prototype,`nodePages`,void 0),e([Y(`service`,`nodePages`,[`nodePages`,`pointNodePages`])],Q.prototype,`readNodePages`,null),e([h({type:[U],readOnly:!0,clonable:!1})],Q.prototype,`materialDefinitions`,void 0),e([h({type:[W],readOnly:!0,clonable:!1})],Q.prototype,`textureSetDefinitions`,void 0),e([h({type:[ue],readOnly:!0,clonable:!1})],Q.prototype,`geometryDefinitions`,void 0),e([h({readOnly:!0})],Q.prototype,`serviceUpdateTimeStamp`,void 0),e([h({readOnly:!0})],Q.prototype,`attributeStorageInfo`,void 0),e([h({readOnly:!0})],Q.prototype,`statisticsInfo`,void 0),e([h({type:i.ofType(Number),nonNullable:!0,json:{origins:{service:{read:!1,write:!1}},name:`layerDefinition.excludeObjectIds`,write:{enabled:!0}}})],Q.prototype,`excludeObjectIds`,void 0),e([h({type:String,json:{origins:{service:{read:!1,write:!1}},name:`layerDefinition.definitionExpression`,write:{enabled:!0,allowNull:!0}}})],Q.prototype,`definitionExpression`,void 0),e([h({type:ve,json:{name:`layerDefinition.polygonFilter`,write:{enabled:!0,allowNull:!0},origins:{service:{read:!1,write:!1}}}})],Q.prototype,`filter`,void 0),e([h({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],Q.prototype,`path`,void 0),e([h(E)],Q.prototype,`elevationInfo`,null),e([h({readOnly:!0,json:{read:!1}})],Q.prototype,`effectiveCapabilities`,null),e([h({readOnly:!0})],Q.prototype,`effectiveEditingEnabled`,null),e([h({type:String})],Q.prototype,`geometryType`,null),e([h(D)],Q.prototype,`labelsVisible`,void 0),e([h({type:[pe],json:{origins:{service:{name:`drawingInfo.labelingInfo`,read:{reader:G},write:!1}},name:`layerDefinition.drawingInfo.labelingInfo`,read:{reader:G},write:!0}})],Q.prototype,`labelingInfo`,void 0),e([h(O)],Q.prototype,`legendEnabled`,void 0),e([h({type:Number,json:{origins:{"web-document":{default:1,write:{enabled:!0,target:{opacity:{type:Number},"layerDefinition.drawingInfo.transparency":{type:Number}}},read:{source:[`opacity`,`layerDefinition.drawingInfo.transparency`],reader(e,t){if(typeof e==`number`&&e>=0&&e<=1)return e;let n=t.layerDefinition?.drawingInfo?.transparency;return n===void 0?void 0:Ne(n)}}},"portal-item":{write:!0},service:{read:!1}}}})],Q.prototype,`opacity`,void 0),e([h({type:[`Low`,`High`],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Q.prototype,`priority`,void 0),e([h({type:[`Labels`],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Q.prototype,`semantic`,void 0),e([h({types:Ce,json:{origins:{service:{read:{source:`drawingInfo.renderer`}}},name:`layerDefinition.drawingInfo.renderer`,write:!0},value:null})],Q.prototype,`renderer`,null),e([h({json:{read:!1}})],Q.prototype,`cachedDrawingInfo`,void 0),e([Y(`service`,`cachedDrawingInfo`)],Q.prototype,`readCachedDrawingInfo`,null),e([h({readOnly:!0,json:{read:!1}})],Q.prototype,`capabilities`,null),e([h({type:Boolean,json:{read:!1}})],Q.prototype,`editingEnabled`,null),e([h({readOnly:!0,json:{write:!1,read:!1}})],Q.prototype,`infoFor3D`,null),e([h({readOnly:!0,json:{write:!1,read:!1}})],Q.prototype,`relationships`,null),e([h(k)],Q.prototype,`popupEnabled`,void 0),e([h({type:n,json:{name:`popupInfo`,write:!0}})],Q.prototype,`popupTemplate`,void 0),e([h({readOnly:!0,json:{read:!1}})],Q.prototype,`defaultPopupTemplate`,null),e([h(A)],Q.prototype,`attributeTableTemplate`,void 0),e([h({type:String,json:{read:!1}})],Q.prototype,`objectIdField`,void 0),e([Y(`service`,`objectIdField`,[`objectIdField`,`fields`])],Q.prototype,`readObjectIdField`,null),e([h({type:String,json:{read:!1}})],Q.prototype,`globalIdField`,void 0),e([Y(`service`,`globalIdField`,[`globalIdField`,`fields`])],Q.prototype,`readGlobalIdField`,null),e([h({readOnly:!0,type:String,json:{read:!1}})],Q.prototype,`displayField`,null),e([h({type:String,json:{read:!1}})],Q.prototype,`profile`,void 0),e([Y(`service`,`profile`,[`store.profile`])],Q.prototype,`readProfile`,null),e([h({readOnly:!0,type:String,json:{origins:{service:{read:{source:`store.normalReferenceFrame`}}},read:!1}})],Q.prototype,`normalReferenceFrame`,void 0),e([h(j)],Q.prototype,`screenSizePerspectiveEnabled`,void 0),e([h({json:{read:!1,origins:{service:{read:!0}}}})],Q.prototype,`serviceItemId`,void 0),e([h(se)],Q.prototype,`useViewTime`,null),e([h(M({disableServiceOrigin:!0,webDocumentOrigin:`web-scene`}))],Q.prototype,`timeInfo`,null),e([h({type:J,json:{read:!1,write:!1}})],Q.prototype,`timeExtent`,null),e([h({type:ke,json:{read:!1,write:!1}})],Q.prototype,`timeOffset`,null),e([h({type:Boolean,nonNullable:!0,json:{read:!1,write:!1}})],Q.prototype,`datesInUnknownTimezone`,null),e([h({type:be,readOnly:!0,json:{read:{source:`timeInfo`}},clonable:!1})],Q.prototype,`serviceTimeInfo`,void 0),e([h()],Q.prototype,`isUsedAsGroundLayer`,null),Q=e([g(`esri.layers.SceneLayer`)],Q);const $={"mesh-pyramids":`mesh-pyramids`,meshpyramids:`mesh-pyramids`,"features-meshes":`mesh-pyramids`,points:`points`,"features-points":`points`,lines:`lines`,"features-lines":`lines`,polygons:`polygons`,"features-polygons":`polygons`},Pe={"mesh-pyramids":`mesh`,points:`point`},Fe=Q;export{Fe as default};
@@ -34,7 +34,7 @@ export interface VectorTileLayerProperties extends LayerProperties, APIKeyMixinP
34
34
  * apiKey: "YOUR_API_KEY"
35
35
  * });
36
36
  * @see [Item access privileges](https://developers.arcgis.com/documentation/security-and-authentication/api-key-authentication/api-key-credentials/#item-access-privileges)
37
- * @see [API key guide](https://developers.arcgis.com/javascript/latest/secure-resources/#api-keys)
37
+ * @see [Authentication and access tokens](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/#api-keys)
38
38
  * @example
39
39
  * // set the api key to access a protected service
40
40
  * const layer = new FeatureLayer({
@@ -427,7 +427,7 @@ export default class VectorTileLayer extends VectorTileLayerSuperclass {
427
427
  * apiKey: "YOUR_API_KEY"
428
428
  * });
429
429
  * @see [Item access privileges](https://developers.arcgis.com/documentation/security-and-authentication/api-key-authentication/api-key-credentials/#item-access-privileges)
430
- * @see [API key guide](https://developers.arcgis.com/javascript/latest/secure-resources/#api-keys)
430
+ * @see [Authentication and access tokens](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/#api-keys)
431
431
  * @example
432
432
  * // set the api key to access a protected service
433
433
  * const layer = new FeatureLayer({
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{Loadable as t}from"../../../core/Loadable.js";import{debounce as n}from"../../../core/promiseUtils.js";import{open as r}from"../../../core/workers.js";import{property as i,subclass as a}from"../../../core/accessorSupport/decorators.js";import o from"../../../geometry/Extent.js";import s from"../../../rest/support/FeatureSet.js";let c=class extends t{constructor(e){super(e),this.type=`csv`,this.refresh=n(async e=>{await this.load();let{extent:t,timeExtent:n}=await this._connection.invoke(`refresh`,e);return t&&(this.sourceJSON.extent=t),n&&(this.sourceJSON.timeInfo.timeExtent=[n.start,n.end]),{dataChanged:!0,updates:{extent:this.sourceJSON.extent,timeInfo:this.sourceJSON.timeInfo}}})}load(e){let t=e==null?null:e.signal;return this.addResolvingPromise(this._startWorker(t)),Promise.resolve(this)}destroy(){this._connection?.close(),this._connection=null}async openPorts(){return await this.load(),this._connection.openPorts()}async queryFeatures(e,t={}){await this.load(t);let n=await this._connection.invoke(`queryFeatures`,e?e.toJSON():null,t);return s.fromJSON(n)}async queryFeaturesJSON(e,t={}){return await this.load(t),this._connection.invoke(`queryFeatures`,e?e.toJSON():null,t)}async queryFeatureCount(e,t={}){return await this.load(t),this._connection.invoke(`queryFeatureCount`,e?e.toJSON():null,t)}async queryObjectIds(e,t={}){return await this.load(t),this._connection.invoke(`queryObjectIds`,e?e.toJSON():null,t)}async queryExtent(e,t={}){await this.load(t);let n=await this._connection.invoke(`queryExtent`,e?e.toJSON():null,t);return{count:n.count,extent:o.fromJSON(n.extent)}}async querySnapping(e,t={}){return await this.load(t),this._connection.invoke(`querySnapping`,e,t)}async queryAttributeBins(e,t={}){return await this.load(),this._connection.invoke(`queryAttributeBins`,e?e.toJSON():null,t)}async _startWorker(e){this._connection=await r(`CSVSourceWorker`,{strategy:has(`feature-layers-workers`)?`dedicated`:`local`,signal:e,registryTarget:this});let{url:t,delimiter:n,fields:i,latitudeField:a,longitudeField:o,spatialReference:s,timeInfo:c}=this.loadOptions,l=await this._connection.invoke(`load`,{url:t,customParameters:this.customParameters,parsingOptions:{delimiter:n,fields:i?.map(e=>e.toJSON()),latitudeField:a,longitudeField:o,spatialReference:s?.toJSON(),timeInfo:c?.toJSON()}},{signal:e});this.locationInfo=l.locationInfo,this.sourceJSON=l.layerDefinition,this.delimiter=l.delimiter}};e([i()],c.prototype,`type`,void 0),e([i()],c.prototype,`loadOptions`,void 0),e([i()],c.prototype,`customParameters`,void 0),e([i()],c.prototype,`locationInfo`,void 0),e([i()],c.prototype,`sourceJSON`,void 0),e([i()],c.prototype,`delimiter`,void 0),c=e([a(`esri.layers.graphics.sources.CSVSource`)],c);export{c as CSVSource};
2
+ import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{Loadable as t}from"../../../core/Loadable.js";import{debounce as n}from"../../../core/promiseUtils.js";import{open as r}from"../../../core/workers.js";import{property as i,subclass as a}from"../../../core/accessorSupport/decorators.js";import o from"../../../geometry/Extent.js";import{applyTimeExtentToQuery as s}from"./support/timeQueryUtils.js";import c from"../../../rest/support/FeatureSet.js";let l=class extends t{constructor(e){super(e),this.type=`csv`,this.refresh=n(async e=>{await this.load();let{extent:t,timeExtent:n}=await this._connection.invoke(`refresh`,e);return t&&(this.sourceJSON.extent=t),n&&(this.sourceJSON.timeInfo.timeExtent=[n.start,n.end]),{dataChanged:!0,updates:{extent:this.sourceJSON.extent,timeInfo:this.sourceJSON.timeInfo}}})}load(e){let t=e==null?null:e.signal;return this.addResolvingPromise(this._startWorker(t)),Promise.resolve(this)}destroy(){this._connection?.close(),this._connection=null}async openPorts(){return await this.load(),this._connection.openPorts()}async queryFeatures(e,t={}){await this.load(t);let n=s(e,this.layer.timeInfo,this.sourceJSON.timeInfo,this.layer.fieldsIndex),r=await this._connection.invoke(`queryFeatures`,n.toJSON(),t);return c.fromJSON(r)}async queryFeaturesJSON(e,t={}){await this.load(t);let n=s(e,this.layer.timeInfo,this.sourceJSON.timeInfo,this.layer.fieldsIndex);return this._connection.invoke(`queryFeatures`,n.toJSON(),t)}async queryFeatureCount(e,t={}){await this.load(t);let n=s(e,this.layer.timeInfo,this.sourceJSON.timeInfo,this.layer.fieldsIndex);return this._connection.invoke(`queryFeatureCount`,n.toJSON(),t)}async queryObjectIds(e,t={}){await this.load(t);let n=s(e,this.layer.timeInfo,this.sourceJSON.timeInfo,this.layer.fieldsIndex);return this._connection.invoke(`queryObjectIds`,n.toJSON(),t)}async queryExtent(e,t={}){await this.load(t);let n=s(e,this.layer.timeInfo,this.sourceJSON.timeInfo,this.layer.fieldsIndex),r=await this._connection.invoke(`queryExtent`,n.toJSON(),t);return{count:r.count,extent:o.fromJSON(r.extent)}}async querySnapping(e,t={}){return await this.load(t),this._connection.invoke(`querySnapping`,e,t)}async queryAttributeBins(e,t={}){await this.load();let n=s(e,this.layer.timeInfo,this.sourceJSON.timeInfo,this.layer.fieldsIndex);return this._connection.invoke(`queryAttributeBins`,n.toJSON(),t)}async _startWorker(e){this._connection=await r(`CSVSourceWorker`,{strategy:has(`feature-layers-workers`)?`dedicated`:`local`,signal:e,registryTarget:this});let{url:t,delimiter:n,fields:i,latitudeField:a,longitudeField:o,spatialReference:s,timeInfo:c}=this.loadOptions,l=await this._connection.invoke(`load`,{url:t,customParameters:this.customParameters,parsingOptions:{delimiter:n,fields:i?.map(e=>e.toJSON()),latitudeField:a,longitudeField:o,spatialReference:s?.toJSON(),timeInfo:c?.toJSON()}},{signal:e});this.locationInfo=l.locationInfo,this.sourceJSON=l.layerDefinition,this.delimiter=l.delimiter}};e([i()],l.prototype,`type`,void 0),e([i()],l.prototype,`loadOptions`,void 0),e([i()],l.prototype,`customParameters`,void 0),e([i({constructOnly:!0})],l.prototype,`layer`,void 0),e([i()],l.prototype,`locationInfo`,void 0),e([i()],l.prototype,`sourceJSON`,void 0),e([i()],l.prototype,`delimiter`,void 0),l=e([a(`esri.layers.graphics.sources.CSVSource`)],l);export{l as CSVSource};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import has from"../../../core/has.js";import{Loadable as n}from"../../../core/Loadable.js";import r from"../../../core/Logger.js";import{debounce as i}from"../../../core/promiseUtils.js";import{open as a}from"../../../core/workers.js";import{property as o,subclass as s}from"../../../core/accessorSupport/decorators.js";import c from"../../../geometry/Extent.js";import l from"../../../geometry/Polygon.js";import{featureGeometryTypeKebabDictionary as u}from"../../../geometry/support/typeUtils.js";import{createCapabilities as d}from"./support/clientSideDefaults.js";import f from"../../../rest/support/FeatureSet.js";let p=class extends n{constructor(){super(...arguments),this.type=`geojson`,this.refresh=i(async e=>{await this.load();let{extent:t,timeExtent:n}=await this._connection.invoke(`refresh`,e);return this.sourceJSON.extent=t,n&&(this.sourceJSON.timeInfo.timeExtent=[n.start,n.end]),{dataChanged:!0,updates:{extent:this.sourceJSON.extent,timeInfo:this.sourceJSON.timeInfo}}})}load(e){let t=e==null?null:e.signal;return this.addResolvingPromise(this._startWorker(t)),Promise.resolve(this)}destroy(){this._connection?.close(),this._connection=null}applyEdits(e){return this.load().then(()=>this._applyEdits(e))}openPorts(){return this.load().then(()=>this._connection.openPorts())}queryFeatures(e,t={}){return this.load(t).then(()=>this._connection.invoke(`queryFeatures`,e?e.toJSON():null,t)).then(e=>f.fromJSON(e))}queryFeaturesJSON(e,t={}){return this.load(t).then(()=>this._connection.invoke(`queryFeatures`,e?e.toJSON():null,t))}queryFeatureCount(e,t={}){return this.load(t).then(()=>this._connection.invoke(`queryFeatureCount`,e?e.toJSON():null,t))}queryObjectIds(e,t={}){return this.load(t).then(()=>this._connection.invoke(`queryObjectIds`,e?e.toJSON():null,t))}queryExtent(e,t={}){return this.load(t).then(()=>this._connection.invoke(`queryExtent`,e?e.toJSON():null,t)).then(e=>({count:e.count,extent:c.fromJSON(e.extent)}))}querySnapping(e,t={}){return this.load(t).then(()=>this._connection.invoke(`querySnapping`,e,t))}async queryAttributeBins(e,t={}){return await this.load(),this._connection.invoke(`queryAttributeBins`,e?.toJSON(),t)}_applyEdits(e){if(!this._connection)throw new t(`geojson-layer-source:edit-failure`,`Memory source not loaded`);let n=this.layer.objectIdField,r=[],i=[],a=[];if(e.addFeatures)for(let t of e.addFeatures)r.push(this._serializeFeature(t));if(e.deleteFeatures)for(let t of e.deleteFeatures)`objectId`in t&&t.objectId!=null?i.push(t.objectId):`attributes`in t&&t.attributes[n]!=null&&i.push(t.attributes[n]);if(e.updateFeatures)for(let t of e.updateFeatures)a.push(this._serializeFeature(t));return this._connection.invoke(`applyEdits`,{adds:r,updates:a,deletes:i}).then(({extent:e,timeExtent:t,featureEditResults:n})=>(this.sourceJSON.extent=e,t&&(this.sourceJSON.timeInfo.timeExtent=[t.start,t.end]),this._createEditsResult(n)))}_createEditsResult(e){return{addFeatureResults:e.addResults?e.addResults.map(this._createFeatureEditResult,this):[],updateFeatureResults:e.updateResults?e.updateResults.map(this._createFeatureEditResult,this):[],deleteFeatureResults:e.deleteResults?e.deleteResults.map(this._createFeatureEditResult,this):[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]}}_createFeatureEditResult(e){let n=e.success===!0?null:e.error||{code:void 0,description:``};return{objectId:e.objectId,globalId:e.globalId,error:n?new t(`geojson-layer-source:edit-failure`,n.description,{code:n.code}):null}}_serializeFeature(e){let{attributes:t}=e,n=this._geometryForSerialization(e);return n?{geometry:n.toJSON(),attributes:t}:{attributes:t}}_geometryForSerialization(e){let{geometry:t}=e;return t==null?null:t.type===`mesh`||t.type===`extent`?l.fromExtent(t.extent):t}async _startWorker(e){this._connection=await a(`GeoJSONSourceWorker`,{strategy:has(`feature-layers-workers`)?`dedicated`:`local`,signal:e,registryTarget:this});let{fields:t,spatialReference:n,hasZ:i,geometryType:o,objectIdField:s,url:c,timeInfo:l,customParameters:f}=this.layer,p=this.layer.originOf(`spatialReference`)===`defaults`,m={url:c,customParameters:f,fields:t&&t.map(e=>e.toJSON()),geometryType:u.toJSON(o),hasZ:i,objectIdField:s,timeInfo:l?l.toJSON():null,spatialReference:p?null:n&&n.toJSON()},h=await this._connection.invoke(`load`,m,{signal:e});for(let e of h.warnings)r.getLogger(this.layer).warn(`#load()`,`${e.message} (title: '${this.layer.title||`no title`}', id: '${this.layer.id??`no id`}')`,{warning:e});h.featureErrors.length&&r.getLogger(this.layer).warn(`#load()`,`Encountered ${h.featureErrors.length} validation errors while loading features. (title: '${this.layer.title||`no title`}', id: '${this.layer.id??`no id`}')`,{errors:h.featureErrors}),this.sourceJSON=h.layerDefinition,this.capabilities=d(this.sourceJSON.hasZ,!0,!this.sourceJSON.geometryType)}};e([o()],p.prototype,`capabilities`,void 0),e([o()],p.prototype,`type`,void 0),e([o({constructOnly:!0})],p.prototype,`layer`,void 0),e([o()],p.prototype,`sourceJSON`,void 0),p=e([s(`esri.layers.graphics.sources.GeoJSONSource`)],p);export{p as GeoJSONSource};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import has from"../../../core/has.js";import{Loadable as n}from"../../../core/Loadable.js";import r from"../../../core/Logger.js";import{debounce as i}from"../../../core/promiseUtils.js";import{open as a}from"../../../core/workers.js";import{property as o,subclass as s}from"../../../core/accessorSupport/decorators.js";import c from"../../../geometry/Extent.js";import l from"../../../geometry/Polygon.js";import{featureGeometryTypeKebabDictionary as u}from"../../../geometry/support/typeUtils.js";import{createCapabilities as d}from"./support/clientSideDefaults.js";import{applyTimeExtentToQuery as f}from"./support/timeQueryUtils.js";import p from"../../../rest/support/FeatureSet.js";let m=class extends n{constructor(){super(...arguments),this.type=`geojson`,this.refresh=i(async e=>{await this.load();let{extent:t,timeExtent:n}=await this._connection.invoke(`refresh`,e);return this.sourceJSON.extent=t,n&&(this.sourceJSON.timeInfo.timeExtent=[n.start,n.end]),{dataChanged:!0,updates:{extent:this.sourceJSON.extent,timeInfo:this.sourceJSON.timeInfo}}})}load(e){let t=e==null?null:e.signal;return this.addResolvingPromise(this._startWorker(t)),Promise.resolve(this)}destroy(){this._connection?.close(),this._connection=null}applyEdits(e){return this.load().then(()=>this._applyEdits(e))}openPorts(){return this.load().then(()=>this._connection.openPorts())}queryFeatures(e,t={}){return this.load(t).then(()=>{let n=f(e,this.layer.timeInfo,this.sourceJSON.timeInfo,this.layer.fieldsIndex);return this._connection.invoke(`queryFeatures`,n.toJSON(),t)}).then(e=>p.fromJSON(e))}queryFeaturesJSON(e,t={}){return this.load(t).then(()=>{let n=f(e,this.layer.timeInfo,this.sourceJSON.timeInfo,this.layer.fieldsIndex);return this._connection.invoke(`queryFeatures`,n.toJSON(),t)})}queryFeatureCount(e,t={}){return this.load(t).then(()=>{let n=f(e,this.layer.timeInfo,this.sourceJSON.timeInfo,this.layer.fieldsIndex);return this._connection.invoke(`queryFeatureCount`,n.toJSON(),t)})}queryObjectIds(e,t={}){return this.load(t).then(()=>{let n=f(e,this.layer.timeInfo,this.sourceJSON.timeInfo,this.layer.fieldsIndex);return this._connection.invoke(`queryObjectIds`,n.toJSON(),t)})}queryExtent(e,t={}){return this.load(t).then(()=>{let n=f(e,this.layer.timeInfo,this.sourceJSON.timeInfo,this.layer.fieldsIndex);return this._connection.invoke(`queryExtent`,n.toJSON(),t)}).then(e=>({count:e.count,extent:c.fromJSON(e.extent)}))}querySnapping(e,t={}){return this.load(t).then(()=>this._connection.invoke(`querySnapping`,e,t))}async queryAttributeBins(e,t={}){await this.load();let n=f(e,this.layer.timeInfo,this.sourceJSON.timeInfo,this.layer.fieldsIndex);return this._connection.invoke(`queryAttributeBins`,n.toJSON(),t)}_applyEdits(e){if(!this._connection)throw new t(`geojson-layer-source:edit-failure`,`Memory source not loaded`);let n=this.layer.objectIdField,r=[],i=[],a=[];if(e.addFeatures)for(let t of e.addFeatures)r.push(this._serializeFeature(t));if(e.deleteFeatures)for(let t of e.deleteFeatures)`objectId`in t&&t.objectId!=null?i.push(t.objectId):`attributes`in t&&t.attributes[n]!=null&&i.push(t.attributes[n]);if(e.updateFeatures)for(let t of e.updateFeatures)a.push(this._serializeFeature(t));return this._connection.invoke(`applyEdits`,{adds:r,updates:a,deletes:i}).then(({extent:e,timeExtent:t,featureEditResults:n})=>(this.sourceJSON.extent=e,t&&(this.sourceJSON.timeInfo.timeExtent=[t.start,t.end]),this._createEditsResult(n)))}_createEditsResult(e){return{addFeatureResults:e.addResults?e.addResults.map(this._createFeatureEditResult,this):[],updateFeatureResults:e.updateResults?e.updateResults.map(this._createFeatureEditResult,this):[],deleteFeatureResults:e.deleteResults?e.deleteResults.map(this._createFeatureEditResult,this):[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]}}_createFeatureEditResult(e){let n=e.success===!0?null:e.error||{code:void 0,description:``};return{objectId:e.objectId,globalId:e.globalId,error:n?new t(`geojson-layer-source:edit-failure`,n.description,{code:n.code}):null}}_serializeFeature(e){let{attributes:t}=e,n=this._geometryForSerialization(e);return n?{geometry:n.toJSON(),attributes:t}:{attributes:t}}_geometryForSerialization(e){let{geometry:t}=e;return t==null?null:t.type===`mesh`||t.type===`extent`?l.fromExtent(t.extent):t}async _startWorker(e){this._connection=await a(`GeoJSONSourceWorker`,{strategy:has(`feature-layers-workers`)?`dedicated`:`local`,signal:e,registryTarget:this});let{fields:t,spatialReference:n,hasZ:i,geometryType:o,objectIdField:s,url:c,timeInfo:l,customParameters:f}=this.layer,p=this.layer.originOf(`spatialReference`)===`defaults`,m={url:c,customParameters:f,fields:t&&t.map(e=>e.toJSON()),geometryType:u.toJSON(o),hasZ:i,objectIdField:s,timeInfo:l?l.toJSON():null,spatialReference:p?null:n&&n.toJSON()},h=await this._connection.invoke(`load`,m,{signal:e});for(let e of h.warnings)r.getLogger(this.layer).warn(`#load()`,`${e.message} (title: '${this.layer.title||`no title`}', id: '${this.layer.id??`no id`}')`,{warning:e});h.featureErrors.length&&r.getLogger(this.layer).warn(`#load()`,`Encountered ${h.featureErrors.length} validation errors while loading features. (title: '${this.layer.title||`no title`}', id: '${this.layer.id??`no id`}')`,{errors:h.featureErrors}),this.sourceJSON=h.layerDefinition,this.capabilities=d(this.sourceJSON.hasZ,!0,!this.sourceJSON.geometryType)}};e([o()],m.prototype,`capabilities`,void 0),e([o()],m.prototype,`type`,void 0),e([o({constructOnly:!0})],m.prototype,`layer`,void 0),e([o()],m.prototype,`sourceJSON`,void 0),m=e([s(`esri.layers.graphics.sources.GeoJSONSource`)],m);export{m as GeoJSONSource};
@@ -1,4 +1,4 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import n from"../../../core/Collection.js";import r from"../../../core/Error.js";import has from"../../../core/has.js";import{LoadableMixin as i}from"../../../core/Loadable.js";import a from"../../../core/Logger.js";import{EsriPromiseMixin as o}from"../../../core/Promise.js";import{isAborted as s,createAbortError as c}from"../../../core/promiseUtils.js";import{open as l}from"../../../core/workers.js";import{property as u,subclass as d}from"../../../core/accessorSupport/decorators.js";import{ensureType as f}from"../../../core/accessorSupport/ensureType.js";import p from"../../../geometry/Extent.js";import m from"../../../geometry/Polygon.js";import{typeKebabDictionary as h}from"../../../geometry/support/typeUtils.js";import{createFeatureIdFromLayer as g}from"../data/createFeatureId.js";import{unapplyEditsZUnitScaling as _}from"../../../rest/query/operations/editsZScale.js";import v from"../../../rest/support/FeatureSet.js";import{shared as y}from"../../../core/accessorSupport/decorators/shared.js";let b=0,x=class extends i(o(n)){constructor(e){super(e),this._idToClientGeometry=null,this.type=`memory`}load(e){let t=e==null?null:e.signal;return this.addResolvingPromise(this._startWorker(t)),Promise.resolve(this)}destroy(){this._connection?.close(),this._connection=null}get _workerGeometryType(){let e=this.layer?.geometryType;return e?this._geometryTypeRequiresClientGraphicMapping(e)?`polygon`:e:null}applyEdits(e){return this.load().then(()=>this._applyEdits(e))}openPorts(){return this.load().then(()=>this._connection.openPorts())}async queryFeatures(e,t={}){if(await this.load(t),s(t)||this._connection==null)throw c();let n=await this._connection.invoke(`queryFeatures`,e?e.toJSON():null,t),r=v.fromJSON(n);if(!this._requiresClientGraphicMapping()||!this._idToClientGeometry)return r;let i=this.layer.objectIdField;for(let e of r.features){let t=e.attributes[i],n=this._idToClientGeometry.get(t);n!==void 0&&(e.geometry=n)}return r.geometryType=this.layer.geometryType,r}async queryFeaturesJSON(e,t={}){if(this._requiresClientGraphicMapping())throw new r(`query-features-json:unsupported`,`Cannot query in JSON format for client only geometry types (mesh and extent)`);if(await this.load(t),s(t)||this._connection==null)throw c();return await this._connection.invoke(`queryFeatures`,e?e.toJSON():null,t)}async queryFeatureCount(e,t={}){if(await this.load(t),s(t)||this._connection==null)throw c();return this._connection.invoke(`queryFeatureCount`,e?e.toJSON():null,t)}async queryObjectIds(e,t={}){if(await this.load(t),s(t)||this._connection==null)throw c();return this._connection.invoke(`queryObjectIds`,e?e.toJSON():null,t)}async queryExtent(e,t={}){if(await this.load(t),s(t)||this._connection==null)throw c();let n=await this._connection.invoke(`queryExtent`,e?e.toJSON():null,t);return{count:n.count,extent:p.fromJSON(n.extent)}}async querySnapping(e,t={}){if(await this.load(t),s(t)||this._connection==null)throw c();return this._connection.invoke(`querySnapping`,e,t)}async queryAttributeBins(e,t={}){if(await this.load(t),s(t)||this._connection==null)throw c();let n=await this._connection.invoke(`queryAttributeBins`,e?.toJSON(),t);return(await import(`../../../rest/support/AttributeBinsFeatureSet.js`)).default.fromJSON(n)}async _applyEdits(e){if(!this._connection)throw new r(`feature-layer-source:edit-failure`,`Memory source not loaded`);let t=this.layer.objectIdField,n=this.layer.uniqueIdFields,i=null,a=[],o=[];await Promise.all([this._prepareClientMapping(e.addFeatures,null),this._prepareClientMapping(e.updateFeatures,null)]);let s=e=>n?.length&&`attributes`in e?g(e,this.layer):`objectId`in e&&e.objectId!=null?e.objectId:`attributes`in e&&e.attributes[t]!=null?e.attributes[t]:null;if(e.addFeatures&&(i=this._prepareAddFeatures(e.addFeatures)),e.deleteFeatures)for(let t of e.deleteFeatures){let e=s(t);e!=null&&a.push(e)}let c=e.updateFeatures&&this._idToClientGeometry?new Map:null;if(e.updateFeatures){for(let t of e.updateFeatures)if(o.push(this._serializeFeature(t)),c&&t.geometry!=null){let e=s(t);e!=null&&c.set(e,t)}}_(i?i.features:null,o,this.layer.spatialReference);let{fullExtent:l,featureEditResults:u}=await this._connection.invoke(`applyEdits`,{adds:i?i.features:[],updates:o,deletes:a});return this.fullExtent=l,i&&i.finish(u.uidToObjectId),this._updateIdToClientGeometries(c,u),this._createEditsResult(u)}async _prepareClientMapping(e,t){if(this._layerOrSourceGeometryType!==`mesh`||e==null)return;let n=[];for(let{geometry:r}of e)r!=null&&r.type===`mesh`&&!r.hasExtent&&!r.loaded&&n.push(r.load({signal:t}));n.length&&await Promise.all(n)}_updateIdToClientGeometries(e,t){if(this._idToClientGeometry){if(e)for(let n of t.updateResults){if(!n.success)continue;let t=e.get(n.objectId);t!=null&&this._addIdToClientGeometry(t)}for(let e of t.deleteResults)e.success&&this._idToClientGeometry.delete(e.objectId)}}_createEditsResult(e){return{addFeatureResults:e.addResults?e.addResults.map(this._createFeatureEditResult,this):[],updateFeatureResults:e.updateResults?e.updateResults.map(this._createFeatureEditResult,this):[],deleteFeatureResults:e.deleteResults?e.deleteResults.map(this._createFeatureEditResult,this):[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]}}_createFeatureEditResult(e){let t=e.success===!0?null:e.error||{code:void 0,description:``};return{objectId:e.objectId,globalId:e.globalId,error:t?new r(`feature-layer-source:edit-failure`,t.description,{code:t.code}):null}}_prepareAddFeatures(e){let t=new Map,n=Array(e.length),r=null;for(let i=0;i<e.length;i++){let a=e[i],o=this._serializeFeature(a);!r&&a.geometry!=null&&(r=a.geometry.type),n[i]=o,t.set(`${o.uid}`,a)}let i=this;return{features:n,inferredGeometryType:r,finish(e){let n=i.sourceJSON.objectIdField;for(let r in e){let a=e[r],o=t.get(r);o&&(o.attributes||={},a===-1?delete o.attributes[n]:o.attributes[n]=a,i._addIdToClientGeometry(o))}}}}_addIdToClientGeometry(e){if(!this._idToClientGeometry)return;let t=this.sourceJSON.objectIdField,n=e.attributes?.[t];n!=null&&this._idToClientGeometry.set(n,e.geometry??null)}get _layerOrSourceGeometryType(){return this.layer?.geometryType??this.sourceJSON?.geometryType}_requiresClientGraphicMapping(){return this._geometryTypeRequiresClientGraphicMapping(this._layerOrSourceGeometryType)}_geometryRequiresClientGraphicMapping(e){return this._geometryTypeRequiresClientGraphicMapping(e.type)}_geometryTypeRequiresClientGraphicMapping(e){return e===`mesh`||e===`multipatch`||e===`extent`}_serializeFeature(e){let{attributes:t}=e,n=this._geometryForSerialization(e),r=(b++).toString();return n?{uid:r,geometry:n.toJSON(),attributes:t}:{uid:r,attributes:t}}_geometryForSerialization(e){let{geometry:t}=e;return t==null?null:this._geometryRequiresClientGraphicMapping(t)?t.extent?m.fromExtent(t.extent):null:t}async _startWorker(e){this._connection=await l(`MemorySourceWorker`,{strategy:has(`feature-layers-workers`)?`dedicated`:`local`,signal:e,registryTarget:this});let{fields:t,spatialReference:n,objectIdField:r,hasM:i,hasZ:o,timeInfo:s,dateFieldsTimeZone:c}=this.layer,u=this.layer.originOf(`spatialReference`)===`defaults`;await this._prepareClientMapping(this.items,e);let d=this._prepareAddFeatures(this.items);this.addHandles(this.on(`before-changes`,e=>{a.getLogger(this).error(`Source modifications will not propagate after layer has been loaded. Please use .applyEdits() instead`),e.preventDefault()}));let{uniqueIdFields:f}=this.layer,p=f?.length?{type:f.length>1?`composite`:`simple`,fields:f.slice(),OIDFieldContainsHashValue:f?.length!==1||f.at(0)!==this.layer.objectIdField}:void 0,m={features:d.features,fields:t?.map(e=>e.toJSON()),geometryType:h.toJSON(this._workerGeometryType),hasM:this._layerOrSourceGeometryType!==`mesh`&&i,hasZ:this._layerOrSourceGeometryType===`mesh`||o,objectIdField:r,spatialReference:u?null:n&&n.toJSON(),timeInfo:s?.toJSON()??null,dateFieldsTimeZone:c,uniqueIdInfo:p},g=await this._connection.invoke(`load`,m,{signal:e});for(let e of g.warnings)a.getLogger(this.layer).warn(`#load()`,`${e.message} (title: '${this.layer.title||`no title`}', id: '${this.layer.id??`no id`}')`,{warning:e});g.featureErrors.length&&a.getLogger(this.layer).error(`#load()`,`Failed to load ${g.featureErrors.length} features due to errors. (title: '${this.layer.title||`no title`}', id: '${this.layer.id??`no id`}').`,g.featureErrors.map(e=>`
2
+ import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import n from"../../../core/Collection.js";import r from"../../../core/Error.js";import has from"../../../core/has.js";import{LoadableMixin as i}from"../../../core/Loadable.js";import a from"../../../core/Logger.js";import{EsriPromiseMixin as o}from"../../../core/Promise.js";import{isAborted as s,createAbortError as c}from"../../../core/promiseUtils.js";import{open as l}from"../../../core/workers.js";import{property as u,subclass as d}from"../../../core/accessorSupport/decorators.js";import{ensureType as f}from"../../../core/accessorSupport/ensureType.js";import p from"../../../geometry/Extent.js";import m from"../../../geometry/Polygon.js";import{typeKebabDictionary as h}from"../../../geometry/support/typeUtils.js";import{createFeatureIdFromLayer as g}from"../data/createFeatureId.js";import{applyTimeExtentToQuery as _}from"./support/timeQueryUtils.js";import{unapplyEditsZUnitScaling as v}from"../../../rest/query/operations/editsZScale.js";import y from"../../../rest/support/FeatureSet.js";import{shared as b}from"../../../core/accessorSupport/decorators/shared.js";let x=0,S=class extends i(o(n)){constructor(e){super(e),this._idToClientGeometry=null,this.type=`memory`}load(e){let t=e==null?null:e.signal;return this.addResolvingPromise(this._startWorker(t)),Promise.resolve(this)}destroy(){this._connection?.close(),this._connection=null}get _workerGeometryType(){let e=this.layer?.geometryType;return e?this._geometryTypeRequiresClientGraphicMapping(e)?`polygon`:e:null}applyEdits(e){return this.load().then(()=>this._applyEdits(e))}openPorts(){return this.load().then(()=>this._connection.openPorts())}async queryFeatures(e,t={}){if(await this.load(t),s(t)||this._connection==null)throw c();let n=_(e,this.layer.timeInfo,this.sourceJSON.timeInfo,this.layer.fieldsIndex),r=await this._connection.invoke(`queryFeatures`,n.toJSON(),t),i=y.fromJSON(r);if(!this._requiresClientGraphicMapping()||!this._idToClientGeometry)return i;let a=this.layer.objectIdField;for(let e of i.features){let t=e.attributes[a],n=this._idToClientGeometry.get(t);n!==void 0&&(e.geometry=n)}return i.geometryType=this.layer.geometryType,i}async queryFeaturesJSON(e,t={}){if(this._requiresClientGraphicMapping())throw new r(`query-features-json:unsupported`,`Cannot query in JSON format for client only geometry types (mesh and extent)`);if(await this.load(t),s(t)||this._connection==null)throw c();let n=_(e,this.layer.timeInfo,this.sourceJSON.timeInfo,this.layer.fieldsIndex);return await this._connection.invoke(`queryFeatures`,n.toJSON(),t)}async queryFeatureCount(e,t={}){if(await this.load(t),s(t)||this._connection==null)throw c();let n=_(e,this.layer.timeInfo,this.sourceJSON.timeInfo,this.layer.fieldsIndex);return this._connection.invoke(`queryFeatureCount`,n.toJSON(),t)}async queryObjectIds(e,t={}){if(await this.load(t),s(t)||this._connection==null)throw c();let n=_(e,this.layer.timeInfo,this.sourceJSON.timeInfo,this.layer.fieldsIndex);return this._connection.invoke(`queryObjectIds`,n.toJSON(),t)}async queryExtent(e,t={}){if(await this.load(t),s(t)||this._connection==null)throw c();let n=_(e,this.layer.timeInfo,this.sourceJSON.timeInfo,this.layer.fieldsIndex),r=await this._connection.invoke(`queryExtent`,n.toJSON(),t);return{count:r.count,extent:p.fromJSON(r.extent)}}async querySnapping(e,t={}){if(await this.load(t),s(t)||this._connection==null)throw c();return this._connection.invoke(`querySnapping`,e,t)}async queryAttributeBins(e,t={}){if(await this.load(t),s(t)||this._connection==null)throw c();let n=_(e,this.layer.timeInfo,this.sourceJSON.timeInfo,this.layer.fieldsIndex),r=await this._connection.invoke(`queryAttributeBins`,n.toJSON(),t);return(await import(`../../../rest/support/AttributeBinsFeatureSet.js`)).default.fromJSON(r)}async _applyEdits(e){if(!this._connection)throw new r(`feature-layer-source:edit-failure`,`Memory source not loaded`);let t=this.layer.objectIdField,n=this.layer.uniqueIdFields,i=null,a=[],o=[];await Promise.all([this._prepareClientMapping(e.addFeatures,null),this._prepareClientMapping(e.updateFeatures,null)]);let s=e=>n?.length&&`attributes`in e?g(e,this.layer):`objectId`in e&&e.objectId!=null?e.objectId:`attributes`in e&&e.attributes[t]!=null?e.attributes[t]:null;if(e.addFeatures&&(i=this._prepareAddFeatures(e.addFeatures)),e.deleteFeatures)for(let t of e.deleteFeatures){let e=s(t);e!=null&&a.push(e)}let c=e.updateFeatures&&this._idToClientGeometry?new Map:null;if(e.updateFeatures){for(let t of e.updateFeatures)if(o.push(this._serializeFeature(t)),c&&t.geometry!=null){let e=s(t);e!=null&&c.set(e,t)}}v(i?i.features:null,o,this.layer.spatialReference);let{fullExtent:l,featureEditResults:u}=await this._connection.invoke(`applyEdits`,{adds:i?i.features:[],updates:o,deletes:a});return this.fullExtent=l,i&&i.finish(u.uidToObjectId),this._updateIdToClientGeometries(c,u),this._createEditsResult(u)}async _prepareClientMapping(e,t){if(this._layerOrSourceGeometryType!==`mesh`||e==null)return;let n=[];for(let{geometry:r}of e)r!=null&&r.type===`mesh`&&!r.hasExtent&&!r.loaded&&n.push(r.load({signal:t}));n.length&&await Promise.all(n)}_updateIdToClientGeometries(e,t){if(this._idToClientGeometry){if(e)for(let n of t.updateResults){if(!n.success)continue;let t=e.get(n.objectId);t!=null&&this._addIdToClientGeometry(t)}for(let e of t.deleteResults)e.success&&this._idToClientGeometry.delete(e.objectId)}}_createEditsResult(e){return{addFeatureResults:e.addResults?e.addResults.map(this._createFeatureEditResult,this):[],updateFeatureResults:e.updateResults?e.updateResults.map(this._createFeatureEditResult,this):[],deleteFeatureResults:e.deleteResults?e.deleteResults.map(this._createFeatureEditResult,this):[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]}}_createFeatureEditResult(e){let t=e.success===!0?null:e.error||{code:void 0,description:``};return{objectId:e.objectId,globalId:e.globalId,error:t?new r(`feature-layer-source:edit-failure`,t.description,{code:t.code}):null}}_prepareAddFeatures(e){let t=new Map,n=Array(e.length),r=null;for(let i=0;i<e.length;i++){let a=e[i],o=this._serializeFeature(a);!r&&a.geometry!=null&&(r=a.geometry.type),n[i]=o,t.set(`${o.uid}`,a)}let i=this;return{features:n,inferredGeometryType:r,finish(e){let n=i.sourceJSON.objectIdField;for(let r in e){let a=e[r],o=t.get(r);o&&(o.attributes||={},a===-1?delete o.attributes[n]:o.attributes[n]=a,i._addIdToClientGeometry(o))}}}}_addIdToClientGeometry(e){if(!this._idToClientGeometry)return;let t=this.sourceJSON.objectIdField,n=e.attributes?.[t];n!=null&&this._idToClientGeometry.set(n,e.geometry??null)}get _layerOrSourceGeometryType(){return this.layer?.geometryType??this.sourceJSON?.geometryType}_requiresClientGraphicMapping(){return this._geometryTypeRequiresClientGraphicMapping(this._layerOrSourceGeometryType)}_geometryRequiresClientGraphicMapping(e){return this._geometryTypeRequiresClientGraphicMapping(e.type)}_geometryTypeRequiresClientGraphicMapping(e){return e===`mesh`||e===`multipatch`||e===`extent`}_serializeFeature(e){let{attributes:t}=e,n=this._geometryForSerialization(e),r=(x++).toString();return n?{uid:r,geometry:n.toJSON(),attributes:t}:{uid:r,attributes:t}}_geometryForSerialization(e){let{geometry:t}=e;return t==null?null:this._geometryRequiresClientGraphicMapping(t)?t.extent?m.fromExtent(t.extent):null:t}async _startWorker(e){this._connection=await l(`MemorySourceWorker`,{strategy:has(`feature-layers-workers`)?`dedicated`:`local`,signal:e,registryTarget:this});let{fields:t,spatialReference:n,objectIdField:r,hasM:i,hasZ:o,timeInfo:s,dateFieldsTimeZone:c}=this.layer,u=this.layer.originOf(`spatialReference`)===`defaults`;await this._prepareClientMapping(this.items,e);let d=this._prepareAddFeatures(this.items);this.addHandles(this.on(`before-changes`,e=>{a.getLogger(this).error(`Source modifications will not propagate after layer has been loaded. Please use .applyEdits() instead`),e.preventDefault()}));let{uniqueIdFields:f}=this.layer,p=f?.length?{type:f.length>1?`composite`:`simple`,fields:f.slice(),OIDFieldContainsHashValue:f?.length!==1||f.at(0)!==this.layer.objectIdField}:void 0,m={features:d.features,fields:t?.map(e=>e.toJSON()),geometryType:h.toJSON(this._workerGeometryType),hasM:this._layerOrSourceGeometryType!==`mesh`&&i,hasZ:this._layerOrSourceGeometryType===`mesh`||o,objectIdField:r,spatialReference:u?null:n&&n.toJSON(),timeInfo:s?.toJSON()??null,dateFieldsTimeZone:c,uniqueIdInfo:p},g=await this._connection.invoke(`load`,m,{signal:e});for(let e of g.warnings)a.getLogger(this.layer).warn(`#load()`,`${e.message} (title: '${this.layer.title||`no title`}', id: '${this.layer.id??`no id`}')`,{warning:e});g.featureErrors.length&&a.getLogger(this.layer).error(`#load()`,`Failed to load ${g.featureErrors.length} features due to errors. (title: '${this.layer.title||`no title`}', id: '${this.layer.id??`no id`}').`,g.featureErrors.map(e=>`
3
3
 
4
- - `+e.error.description).join(``));let _=g.layerDefinition;this._geometryTypeRequiresClientGraphicMapping(d.inferredGeometryType)&&(_.geometryType=h.toJSON(d.inferredGeometryType)),this.sourceJSON=_,this._requiresClientGraphicMapping()&&(this._idToClientGeometry=new Map),d.finish(g.assignedObjectIds)}};e([y({Type:t,ensureType:f(t)})],x.prototype,`itemType`,void 0),e([u()],x.prototype,`type`,void 0),e([u({constructOnly:!0})],x.prototype,`layer`,void 0),e([u({readOnly:!0})],x.prototype,`_workerGeometryType`,null),e([u()],x.prototype,`sourceJSON`,void 0),x=e([d(`esri.layers.graphics.sources.MemorySource`)],x);export{x as MemorySource};
4
+ - `+e.error.description).join(``));let _=g.layerDefinition;this._geometryTypeRequiresClientGraphicMapping(d.inferredGeometryType)&&(_.geometryType=h.toJSON(d.inferredGeometryType)),this.sourceJSON=_,this._requiresClientGraphicMapping()&&(this._idToClientGeometry=new Map),d.finish(g.assignedObjectIds)}};e([b({Type:t,ensureType:f(t)})],S.prototype,`itemType`,void 0),e([u()],S.prototype,`type`,void 0),e([u({constructOnly:!0})],S.prototype,`layer`,void 0),e([u({readOnly:!0})],S.prototype,`_workerGeometryType`,null),e([u()],S.prototype,`sourceJSON`,void 0),S=e([d(`esri.layers.graphics.sources.MemorySource`)],S);export{S as MemorySource};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{toConst as n}from"../../../../core/compilerUtils.js";import r from"../../../../core/Error.js";import i from"../../../../core/Handles.js";import has from"../../../../core/has.js";import a from"../../../../core/Logger.js";import{onAbortOrThrow as o,throwIfAborted as s}from"../../../../core/promiseUtils.js";import{QueueProcessor as c}from"../../../../core/QueueProcessor.js";import{parseWhereClause as l}from"../../../../core/sql.js";import{getMetersPerUnitForSR as u}from"../../../../core/units.js";import d from"../../../../geometry/SpatialReference.js";import{set as f,create as p,expandWithAABB as m,expandWithRect as ee,negativeInfinity as h}from"../../../../geometry/support/aaBoundingBox.js";import{copy as te,create as g,expandWithRect as ne,negativeInfinity as re}from"../../../../geometry/support/aaBoundingRect.js";import{isWebMercator as _,isWGS84 as v}from"../../../../geometry/support/spatialReferenceUtils.js";import{normalizeColumnPath as y,readParquetFileAttribute as b}from"../../../parquet.js";import{convertToGeometry as x}from"../../featureConversionUtils.js";import{getFieldNamesFromStatistics as S}from"../../data/attributeSupport.js";import{getQueryResultExtent as C,getQueryBoundingRects as w,QueryEngine as T}from"../../data/QueryEngine.js";import{queryCapabilities as ie}from"../../data/QueryEngineCapabilities.js";import{QueryEngineResult as E}from"../../data/QueryEngineResult.js";import{normalizeQueryLike as D}from"../../data/queryUtils.js";import{createFileProvider as O}from"../parquet/createFileProvider.js";import{readFieldStatistic as k}from"../parquet/ParquetFileStatistics.js";import{createDrawingInfo as ae}from"./clientSideDefaults.js";import{getParquetFileId as oe,getParquetRowId as se,getParquetObjectId as ce}from"./parquetIdUtils.js";import A from"../../../support/Field.js";import j from"../../../support/FieldsIndex.js";import{isNumericField as M}from"../../../support/fieldUtils.js";import{fromParquetGeometryEncodingJSON as N}from"../../../support/parquetEncodingUtils.js";import{completeParquetLayerInfo as P,fromParquetJSONGeometryType as F,toParquetJSONGeometryType as I}from"../../../support/parquetUtils.js";import{loadParquetModule as L}from"../../../../libs/librust-parquet/loadParquetModule.js";import{utc as R}from"../../../../time/constants.js";import{FeatureStoreQueryAdapter as z}from"../../../../views/2d/layers/features/FeatureStoreQueryAdapter.js";import{FeatureSnapshotSourceChunk as B}from"../../../../views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js";import{FeatureSourceChunkStore as V}from"../../../../views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as H}from"../../../../views/2d/layers/features/support/FeatureMetadata.js";import{FeatureSetReaderParquet as U}from"../../../../views/2d/layers/features/support/FeatureSetReaderParquet.js";const W=new z,G=`__OBJECTID`,K=8e3;class le{constructor(e,t){this._files=e,this._createFileStream=t,this._fileIndex=0,this._streamIndex=0,this._streams=[],this._pending=new Set,this._resolvedCount=0}async next(e){for(await this._fill(e);this._pending.size>0;){s(e),await this._fill(e);let t=await ue(this._pending);if(this._pending.delete(t.read),this._resolvedCount++,t.chunk!=null)return t.chunk}return null}async _fill(e){for(this._removeDone();this._pending.size<8;){let t=this._getOrCreateNextStream(e);if(t==null)return;this._pending.add(t.read(e))}}_getOrCreateNextStream(e){let t=this._resolvedCount>=8?8:2;if(this._fileIndex<this._files.length&&this._streams.length<t){let t=this._files[this._fileIndex++],n=new de(t.id,this._createFileStream(t,e));return this._streams.push(n),n}return this._getNextStream()}_getNextStream(){let e=this._streams.length;for(let t=0;t<e;t++){let n=(this._streamIndex+t)%e,r=this._streams[n];if(r.canRead)return this._streamIndex=(n+1)%e,r}return null}_removeDone(){let e=this._streamIndex;for(let t=this._streams.length-1;t>=0;t--)this._streams[t].done&&(this._streams.splice(t,1),t<e&&e--);this._streamIndex=this._streams.length>0?e%this._streams.length:0}}function ue(e){return Promise.race(Array.from(e,async e=>({read:e,chunk:await e})))}class de{constructor(e,t){this._fileId=e,this._stream=t,this._readCount=0,this._reachedEnd=!1}get canRead(){return!this._reachedEnd}get done(){return this._reachedEnd&&this._readCount===0}async read(e){this._readCount++;try{let t=await(await this._stream).next(e);return t==null?(this._reachedEnd=!0,null):{fileId:this._fileId,chunk:t}}finally{this._readCount--}}}class fe{constructor(){this._hasZ=!1,this._hasM=!1,this._queue=new c({concurrency:4,process:(e,t)=>this._executeQuery(e,t)}),this._streams=new Map,this._streamIdCounter=0,this._indexMap={},this._handles=new i}async load(e){let t=e.spatialReference?d.fromJSON(e.spatialReference):void 0;if(t&&!t.isWGS84&&!t.isWebMercator)throw new r(`parquet:unsupported-projection`,`Only WGS84 and Web Mercator are supported`);this._customParameters=e.customParameters,this._loadParameters=e,await this._updateProvider(O(e.provider,null,()=>this._customParameters));let n=await this._provider.getMetadata(),i=await P(n,{fields:e.fields?.map(e=>A.fromJSON(e)),geometryEncoding:e.geometryEncoding?N(e.geometryEncoding):null,geometryType:e.geometryType?F(e.geometryType):null,displayOptimization:e.displayOptimization,spatialReference:t});if(this._hasZ=!!n?.hasZ,this._hasM=!!n?.hasM,!i.fields)throw new r(`parquet:unsupported`,`Fields must be defined`);let o;if(i.spatialReference&&i.geometryType){if(!i.spatialReference)throw new r(`parquet:unsupported`,`SpatialReference must be defined`);if(!i.spatialReference.isGeographic&&!i.spatialReference.isWebMercator)throw new r(`parquet:unsupported-projection`,`Only WGS84 and Web Mercator are supported`);i.spatialReference.isGeographic&&!i.spatialReference.isWGS84&&(a.getLogger(`parquet:unsupported-projection`).warn(`Found a geographic projection that is not WGS84. Handling as WGS84.`,{spatialReference:i.spatialReference}),i.spatialReference=d.WGS84),o={geometry:i.geometryEncoding?{geometryType:I(i.geometryType),spatialReference:i.spatialReference.toJSON(),encoding:i.geometryEncoding.toJSON()}:null,displayOptimization:i.displayOptimization}}this.setCustomParameters(e.customParameters),this._displayOptimization=i.displayOptimization,await this._provider.updateGeometryInfo(o),this._capabilities=$(await this._getFileStatistics(),this._hasZ,this._hasM);let s=await this._provider.getFiles();if(!s.length)return{layerDefinition:{},capabilities:$(null,this._hasZ,this._hasM)};let c=await s[0].file;i.file=c;let{fields:l}=i;if(l==null)throw new r(`parquet-layer:missing-metadata`,`Unable to create parquet source: cannot infer fields`,l);l.push(new A({name:G,type:`oid`,alias:G}));for(let e of l){let t=c.getColumnId(e.name);t!=null&&(this._indexMap[e.name]=t)}let u=j.fromLayerJSON({fields:l.map(e=>e.toJSON()),dateFieldsTimeReference:{timeZoneIANA:`UTC`}});this._fieldsIndex=u;let f=I(i.geometryType??`point`);return this._metadata=H.createFeature({fieldsIndex:u.toJSON(),geometryType:f,hasZ:this._hasZ,hasM:this._hasM,featureIdInfo:{type:`object-id`,fieldName:G},subtypes:null,subtypeField:null,types:null,typeIdField:null,globalIdField:null,spatialReference:i.spatialReference,outSpatialReference:null,attributeSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:R}),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:f,featureIdInfo:{type:`object-id`,fieldName:G},hasM:this._hasM,hasZ:this._hasZ,spatialReference:i.spatialReference?.toJSON()??{wkid:4326},aggregateAdapter:null,timeInfo:null,definitionExpression:null},this._fullExtent=n?.extent?n.extent:await this._tryDeriveParquetFullExtent(i),{capabilities:this._capabilities,layerDefinition:{fields:i.fields?.map(e=>e.toJSON()),drawingInfo:ae(f),extent:this._fullExtent??void 0,geometryType:f,hasZ:this._hasZ,hasM:this._hasM,geometryEncoding:i.geometryEncoding?.toJSON(),displayOptimization:i.displayOptimization}}}destroy(){this._provider.destroy(),this._queue.destroy();for(let{handle:e}of this._streams.values())e.remove();this._streams.clear(),this._indexMap={},this._handles.removeAll()}async reload(e){this.destroy(),await this.load(e)}set remoteClient(e){this._source=e.createInvokeProxy(``)}setCustomParameters(e){this._customParameters=e}getIndexMap(){return this._indexMap}async updateFileProvider(e){this._loadParameters={...this._loadParameters,provider:e};let t=O(e,this._provider.getGeometryInfo(),()=>this._customParameters);await this._updateProvider(t)}async getDiagnosticsSnapshot(){let e=await this._provider.getFiles();return{files:await Promise.all(e.map(e=>e.getDiagnosticsSnapshot()))}}async getColumnIndex(e){return(await this._getFileInfoById(e.fileId)).getColumnIndex(e.rowGroupIndex,e.columnIndex)}async getOffsetIndex(e){return(await this._getFileInfoById(e.fileId)).getOffsetIndex(e.rowGroupIndex,e.columnIndex)}async queryFeatures(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),we(n)||(n.resultRecordCount=n.resultRecordCount?Math.min(n.resultRecordCount,K):K,n.resultOffset=n.resultOffset??0),n.outStatistics?this._queryStatistics(n,t):(n.returnDistinctValues&&(n.returnGeometry=void 0),(await this._enqueueQuery(n,t)).createQueryResponse())}async queryFeatureCount(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),!q(n)&&!n.returnDistinctValues&&!n.groupByFieldsForStatistics?.length&&!n.outStatistics?.length?this._getFeatureCount():(n.returnDistinctValues||(n.outFields=void 0),n.returnGeometry=void 0,(await this._enqueueQuery(n,t)).createQueryResponseForCount())}async queryObjectIds(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),q(n)?(n.resultRecordCount=n.resultRecordCount?Math.min(n.resultRecordCount,8e3):8e3,n.resultOffset=n.resultOffset??0,n.returnGeometry=void 0,n.outFields=void 0,n.returnDistinctValues=void 0,(await this._enqueueQuery(n,t)).items.map(e=>e.getObjectId())):Array.from({length:await this._getFeatureCount()},(e,t)=>t)}async queryAttributeBins(e,t={}){throw new r(`parquet:unsupported`,`queryAttributeBins not supported.`)}async queryExtent(e,t){let r=await D(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(r),this._fullExtent&&!q(r))return{count:await this._getFeatureCount(),extent:this._fullExtent};let i=n(this._metadata.spatialReference);r.returnGeometry=!0,r.outFields=void 0;let a=f(p(),h),o=p(),s=await this._enqueueQuery(r,t),c=0;for(let e of s.items)e.getBounds(o)&&(m(a,o),c+=1);let l=C(a,i,r.outSR?n(r.outSR):i.toJSON(),i,!1);return{count:c,extent:l}}async queryStream(e,t){if(!t.signal)throw Error(`InternalError: AbortSignal must be passed`);let n=await this._getCandidateFiles(e),r=new le(n,async(t,n)=>{let r=await t.file,i=await this._createParquetDisplayQuery(r,t.id,e);return r.executeQuery(i,K,n)}),i=this._streamIdCounter++,a=o(t.signal,e=>{let t=this._streams.get(i);t!=null&&(t.handle.remove(),this._streams.delete(i))});return this._streams.set(i,{stream:r,handle:a}),i}async getStreamNext(e,t){if(!t.signal)throw Error(`InternalError: AbortSignal must be passed`);let n=this._streams.get(e);if(!n)return{result:null};let r=await n.stream.next(t.signal);if(r==null)return n.handle.remove(),this._streams.delete(e),{result:null};let i=r.chunk.serialize().buffer,a={fileId:r.fileId,buffer:i};return i instanceof ArrayBuffer?{result:a,transferList:[i]}:{result:a}}async getStreamNextFeatures(e,t){let{result:n}=await this.getStreamNext(e,t);if(n==null)return null;let r=(await L()).ParquetChunk.deserialize(new Uint8Array(n.buffer)),i=new U(this._metadata,this._indexMap,r,n.fileId),a=[];for(;i.next();){let e=x(i.readGeometryWorldSpace(),i.geometryType,i.hasZ,i.hasM),t=i.readAttributes();a.push({attributes:t,geometry:e})}return{features:a}}async createPatch(e,t,n,r,i){if(!i.signal)throw Error(`InternalError: AbortSignal must be passed`);return(await(await(await this._getFileInfoById(e)).file).createChunkPatch(t,n,r,i.signal)).serialize().buffer}async _updateProvider(e){let t=this._provider;this._handles.removeAll(),this._provider=e,this._handles.add([e.events.on(`rangeRead`,e=>{this._source.onRangeRead(e)}),e.events.on(`sourceChanged`,async()=>{await this.reload(this._loadParameters),await this._source.onSourceChange()})]),await t?.destroy()}async _getCandidateFiles(e){let t=await this._provider.getFiles(),n=await this._getSpatialFilePruning(e);if(n==null)return t;let r=t.filter(e=>this._mayIncludeFileForSpatialPruning(e,n));return n.type===`xz`?Ce(r,n):r}async _queryStatistics(e,t){let n=await D({...e},null,this._queryEngineParams.spatialReference);if(n.returnGeometry=void 0,ve(n,this._fieldsIndex)){let e=await this._getStatisticsFromFiles(n);if(e)return e}return(await this._enqueueQuery(n,t)).createQueryResponse()}async _getStatisticsFromFiles(e){let t=await this._provider.getFiles(),n={},r=[];for(let i of e.outStatistics??[]){let e=xe(i,t);if(!e.available)return null;n[i.outStatisticFieldName]=e.value,r.push(be(i,this._fieldsIndex))}return{fields:r,features:[{attributes:n}]}}async _getSpatialFilePruning(e){if(e.type!==`tile`&&(e.type!==`arcade`||e.extent==null))return null;let t=this._displayOptimization?.index;if(t==null)return null;let n=e.outSpatialReference.wkid;if(t.wkid==null||n==null)return null;let r=t.wkid,i=await L();switch(t.type){case`xz`:return{type:`xz`,fieldName:y(t.code),intersects:(a,o)=>i.queryIntersectsXZStatistics(t.fullExtent,e.extent,n,r,t.maxLevel,a,o)};case`z`:return{type:`xy`,xFieldName:y(t.xColumn),yFieldName:y(t.yColumn),intersects:(t,a,o,s)=>i.queryIntersectsXYStatistics(e.extent,n,r,t,a,o,s)}}}_mayIncludeFileForSpatialPruning(e,t){switch(t.type){case`xz`:{let n=Z(e,t);return n?.type===`null-only`?!1:n?.type!==`bounds`||t.intersects(n.minValue,n.maxValue)}case`xy`:{let n=e.statistics.statistics.get(t.xFieldName),r=e.statistics.statistics.get(t.yFieldName);return n?.type===`null-only`||r?.type===`null-only`?!1:n?.type!==`bounds`||r?.type!==`bounds`||t.intersects(n.minValue,n.maxValue,r.minValue,r.maxValue)}}}async _tryDeriveParquetFullExtent(n){if(!n.spatialReference)return null;if(this._fullExtent==null&&n.geometryEncoding?.type===`location`){let r=await this._provider.getFiles(),{xField:i,yField:a}=n.geometryEncoding,o=f(p(),h),s=!1;for(let n of r){let r=await n.file;for(let n of r.rowGroups()){let r={stack:[],error:void 0,hasError:!1};try{let t=e(r,n.columnDescriptorForAttribute(i),!1),c=e(r,n.columnDescriptorForAttribute(a),!1),l=k(t),u=k(c);if(l?.type===`bounds`&&u?.type===`bounds`){let e=[l.minValue,u.minValue,l.maxValue,u.maxValue];ee(o,e),s=!0}n.free()}catch(e){r.error=e,r.hasError=!0}finally{t(r)}}}return s?{xmin:o[0],ymin:o[1],xmax:o[3],ymax:o[4],spatialReference:n.spatialReference?.toJSON()}:null}return null}async _getFileInfoById(e){let t=await this._provider.getFiles();for(let n of t)if(n.id===e)return n;throw Error(`InternalError: File ${e} does not exist`)}async _getFileStatistics(){return{featureCount:await this._getFeatureCount(),byteLength:await this._getByteLength()}}async _getFile(e){return(await this._getFileInfoById(e)).file}async _createParquetQuery(e,t,n,r,i){let a=(await L()).Query.new();n!=null&&a.setPreFilterStart(n),r!=null&&a.setPreFilterCount(r),i!=null&&a.setPostFilterCount(i);let o=await this._getRequiredFields(e);a.setOutFields(o),(e.geometry||e.returnGeometry)&&a.setReturnGeometry(!0),a.setReturnZ(!!e.returnZ),a.setReturnM(!!e.returnM);let s=this._tryGetGeneralizedGeometryResolution(e);s!=null&&a.setSourceResolution(s);let c=e.geometry?.spatialReference??this._queryEngineParams.spatialReference,l=c.wkid;if(e.geometry&&(_(c)||v(c))){let t=te(g(),re);for(let n of w(e.geometry))ne(t,n);a.setOutSpatialReference(l),a.setExtent({xmin:t[0],ymin:t[1],xmax:t[2],ymax:t[3]})}if(e.where){let{id:n,file:r}=t;await this._setWhereClause(a,await r,n,e.where)}return a}async _createParquetDisplayQuery(e,t,n){let r=(await L()).Query.new();if(n.type===`tile`){r.setExtent(n.extent),r.setQuantizationTransform(n.transform);let e=this._sourceResolution(n.resolution,n.outSpatialReference);e!=null&&r.setSourceResolution(e)}else n.type===`arcade`&&n.extent!=null&&r.setExtent(n.extent);return r.setOutFields(n.outFields.filter(e=>this._indexMap[e]!=null)),r.setOutSpatialReference(n.outSpatialReference.wkid),r.setReturnGeometry(n.returnGeometry),r.setReturnZ(n.returnZ),r.setReturnM(n.returnM),n.where&&await this._setWhereClause(r,e,t,n.where),r}async _getFeatureCount(){return(await this._provider.getFiles()).map(e=>e.statistics.rowCount).reduce((e,t)=>e+t,0)}async _getByteLength(){return(await this._provider.getFiles()).map(e=>e.statistics.byteSize).reduce((e,t)=>e+t,0)}_validateQuery(e){if(!this._capabilities.query.supportsStatistics&&e.outStatistics)throw new r(`parquet:unsupported`,`Statistics queries are not supported`,{query:e});if(!this._capabilities.query.supportsOrderBy&&e.orderByFields?.length)throw new r(`parquet:unsupported`,`Queries using orderBy are not supported`,{query:e});if(!this._capabilities.query.supportsDistinct&&e.returnDistinctValues)throw new r(`parquet:unsupported`,`Queries using returnDistinctValues are not supported`,{query:e})}async _setWhereClause(e,t,n,i){let a=this._indexMap,o=this._fieldsIndex,s={getAttribute(e,r){let i=a[r];if(i==null){if(o.get(r)?.name===`__OBJECTID`){let t=e.row+e.rowGroupStart;return ce(n,t)}return null}let s=o.get(r);return b(t,e.rowGroup,e.row,i,s.type)}},c=await l(i,this._fieldsIndex);if(!c.isStandardized)throw new r(`sql-parse-error`,`expression is not standardized`);let u=(e,t,n)=>c.testFeatureCompiled({rowGroup:e,row:t,rowGroupStart:n},s,null),d=c.fieldNames.map(e=>o.get(e)).filter(e=>e&&this._indexMap[e?.name]!=null);e.setWhere(i),e.setWhereEvaluator(u),e.setWhereFields(d.map(e=>e.name))}async*_streamFeatures(e,t,n,r,i){let a=await this._provider.getFiles(),o=0;for(let s of a){let a=o,c=o+s.statistics.rowCount;if(o+=s.statistics.rowCount,t!=null&&t>=c)continue;let l=t==null?null:Math.max(t-a,0),u=n;if(n!=null){let e=t??0,r=e+n;u=Math.max(Math.min(r,c)-Math.max(e,a),0)}if(u===0)continue;let d=await this._createParquetQuery(e,s,l,u,r),f=await(await s.file).executeQuery(d,K),p=async()=>{let e=await f.next(i);if(!e)return null;let t=new U(this._metadata,this._indexMap,e,s.id);return X([new B(t,null,0,!1)],this._queryEngineParams)},m=await p();for(;m!=null;)yield m,m=await p()}}async _queryFeaturesWithQueryEnginePagination(e,t){let n=[],r=this._streamFeatures(e,null,null,null,t),i=await r.next();for(;!i.done;){let a=await i.value.executeQueryForOpaqueFeatures({...e,where:void 0},t);for(let e of a)n.push(e);i=await r.next()}return n}async _queryFeaturesWithUpfrontPagination(e,t){let n=e.resultOffset??0,r=e.resultRecordCount??K,i,a,o;ge(e)?_e(e)||(o=n+r):(n&&=(i=n,0),a=e.resultRecordCount);let s=[],c=this._streamFeatures(e,i,a,o,t),l=await c.next();for(;!l.done&&r>0;){let i=await l.value.executeQueryForOpaqueFeatures({...e,where:void 0},t);for(let e of i){if(n>0){n--;continue}if(s.push(e),--r<=0)return s}l=await c.next()}return s}_enqueueQuery(e,t){return this._queue.push(e,t)}async _executeQuery(e,t){if(e.objectIds?.length){let n=new Map;for(let t of e.objectIds){let e=oe(t),r=se(t),i=n.get(e);i||(i=[],n.set(e,i)),i.push(r)}let r=[];for(let[i,a]of n.entries()){let n=await this._executeFileIdQuery(e,i,a,t);for(let e of n)r.push(e)}return new E(r,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:this._hasM,hasZ:this._hasZ,featureAdapter:W,featureIdInfo:this._queryEngineParams.featureIdInfo})}if(e.where===`1=1`&&(e.where=null),e.resultOffset??=0,e.resultRecordCount??=await this._getFeatureCount(),e.resultRecordCount>2e7&&!(this._displayOptimization&&e.geometry))throw new r(`parquet:cannot-execute-query`,`Unable to execute query, dataset is too large.`);let n=!!e.orderByFields?.length||!!e.outStatistics?.length||!!e.returnDistinctValues,i=n?await this._queryFeaturesWithQueryEnginePagination(e,t):await this._queryFeaturesWithUpfrontPagination(e,t);return n||(e.resultOffset=0),new E(i,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:this._hasM,hasZ:this._hasZ,featureAdapter:W,featureIdInfo:this._queryEngineParams.featureIdInfo})}async _executeFileIdQuery(e,t,n,r){let i=new Set(await this._getRequiredFields(e));if(e.where){let t=await l(e.where,this._fieldsIndex);for(let e of t.fieldNames){let t=this._fieldsIndex.get(e);t&&this._indexMap[t.name]!=null&&i.add(t.name)}}let a=(await L()).Query.new();a.setOutFields(Array.from(i)),a.setReturnGeometry(!!e.returnGeometry),a.setReturnZ(!!e.returnZ),a.setReturnM(!!e.returnM),a.setIds(new Uint32Array(n));let o=await(await this._getFile(t)).executeQuery(a,K,r),s=await o.next(r),c=0,u=[];for(;s!=null;){let e=new U(this._metadata,this._indexMap,s,t),n=new B(e,null,c++,!1);u.push(n),s=await o.next(r)}return X(u,this._queryEngineParams).executeQueryForOpaqueFeatures(e,r)}async _getRequiredFields(e){let t=new Set;if(e.outStatistics)for(let n of S(this._fieldsIndex,e.outStatistics,e.groupByFieldsForStatistics))t.add(n);else if(e.outFields)for(let n of e.outFields)t.add(n);return(t.has(`*`)?this._fieldsIndex.fields.map(e=>e.name):Array.from(t)).filter(e=>this._indexMap[e]!=null)}_tryGetGeneralizedGeometryResolution(e){if(!this._displayOptimization)return null;let t=e.outSR??this._queryEngineParams.spatialReference;if(!_(t)&&!v(t))return null;let n=e.quantizationParameters?.tolerance??e.maxAllowableOffset;return n?this._sourceResolution(n,t):null}_sourceResolution(e,t){let n=this._queryEngineParams.spatialReference,r=u(t)/u(n)*e;return!Number.isFinite(r)||r<=0?null:r}}function pe(e){switch(e){case`fullText`:case`having`:case`timeExtent`:case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:case`objectIds`:case`where`:case`geometry`:case`resultOffset`:case`resultRecordCount`:return!0;default:return!1}}function me(e){switch(e){case`fullText`:case`having`:case`timeExtent`:case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:case`objectIds`:case`where`:case`geometry`:return!0;default:return!1}}function he(e){switch(e){case`fullText`:case`having`:case`timeExtent`:return!0;case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:return!1;case`objectIds`:case`where`:case`resultOffset`:case`geometry`:case`resultRecordCount`:return!1}return!1}function q(e){for(let t in e){let n=t;if(pe(n)&&e[n]!==null)return!0}return!1}function ge(e){for(let t in e){let n=t;if(me(n)&&e[n]!==null)return!0}return!1}function _e(e){for(let t in e){let n=t;if(he(n)&&e[n]!==null)return!0}return!1}function ve(e,t){return!!e.outStatistics?.length&&!q(e)&&!e.groupByFieldsForStatistics?.length&&!e.orderByFields?.length&&!e.returnDistinctValues&&!e.returnAggIds&&e.outStatistics.every(e=>ye(e,t))}function ye(e,t){switch(e.statisticType){case`count`:return e.onStatisticField===`1`||t.get(e.onStatisticField)!=null;case`min`:case`max`:{let n=t.get(e.onStatisticField);return n!=null&&M(n)}default:return!1}}function be(e,t){let n=e.statisticType===`exceedslimit`?null:t.get(e.onStatisticField),r=(e.statisticType===`min`||e.statisticType===`max`)&&n?.type===`esriFieldTypeDate`?n.type:`esriFieldTypeDouble`;return{name:e.outStatisticFieldName,alias:e.outStatisticFieldName,type:r}}function xe(e,t){switch(e.statisticType){case`count`:return J(e,t);case`min`:return Y(e,t,Math.min);case`max`:return Y(e,t,Math.max);default:return{available:!1,value:null}}}function J(e,t){if(e.statisticType!==`count`)return{available:!1,value:null};if(e.onStatisticField===`1`)return{available:!0,value:t.reduce((e,t)=>e+t.statistics.rowCount,0)};let n=0;for(let r of t){let t=r.statistics.statistics.get(e.onStatisticField);if(t==null||t.nullCount==null)return{available:!1,value:null};n+=r.statistics.rowCount-t.nullCount}return{available:!0,value:n}}function Y(e,t,n){if(e.statisticType!==`min`&&e.statisticType!==`max`)return{available:!1,value:null};let r=null,i=e.statisticType===`min`?`minValue`:`maxValue`;for(let a of t){let t=a.statistics.statistics.get(e.onStatisticField);if(t==null)return{available:!1,value:null};switch(t.type){case`null-only`:continue;case`unknown`:return{available:!1,value:null};case`bounds`:{let e=Se(t[i]);if(e==null)return{available:!1,value:null};r=r==null?e:n(r,e);break}}}return{available:!0,value:r}}function Se(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function X(e,t){let n=new V;for(let t of e)n.insert(t);return new T({...t,featureStore:n})}function Z(e,t){return e.statistics.statistics.get(t.fieldName)??null}function Ce(e,t){return e.slice().sort((e,n)=>{let r=Q(e,t),i=Q(n,t);return r===i?0:r<i?-1:1})}function Q(e,t){let n=Z(e,t);return n?.type===`bounds`?n.maxValue-n.minValue:1/0}function $(e,t,n){let r=e?.featureCount,i=!1;return r!=null&&r<has(`parquetlayer-full-query-feature-count`)&&(i=!0),{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportedCurveTypes:[],supportsAttachment:!1,supportsM:n,supportsTrueCurve:!1,supportsZ:t},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:{...ie,maxRecordCount:K,supportsOrderBy:i,supportsDistinct:!0,supportsStatistics:!0,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1}},queryAttributeBins:{supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsTrueCurveUpdate:!1,supportsTrueCurveUpdateByTrueCurveClientsOnly:!0,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUploadWithItemId:!1,supportsUpdateWithoutM:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}function we(e){return!!e.objectIds?.length||!!e.outStatistics||!!e.orderByFields?.length||!!e.returnDistinctValues}export{fe as default};
2
+ import{__addDisposableResource as e,__disposeResources as t}from"tslib";import n from"../../../../core/Error.js";import r from"../../../../core/Handles.js";import has from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{onAbortOrThrow as a,throwIfAborted as o}from"../../../../core/promiseUtils.js";import{QueueProcessor as s}from"../../../../core/QueueProcessor.js";import{parseWhereClause as c}from"../../../../core/sql.js";import{getMetersPerUnitForSR as l}from"../../../../core/units.js";import{initializeProjection as u}from"../../../../geometry/projectionUtils.js";import d from"../../../../geometry/SpatialReference.js";import{set as f,create as p,expandWithAABB as m,expandWithRect as h,negativeInfinity as g}from"../../../../geometry/support/aaBoundingBox.js";import{copy as _,create as v,expandWithRect as ee,negativeInfinity as te}from"../../../../geometry/support/aaBoundingRect.js";import{isWebMercator as y,isWGS84 as b}from"../../../../geometry/support/spatialReferenceUtils.js";import{normalizeColumnPath as x,readParquetFileAttribute as ne}from"../../../parquet.js";import{convertToGeometry as S}from"../../featureConversionUtils.js";import{getFieldNamesFromStatistics as re}from"../../data/attributeSupport.js";import{project as ie}from"../../data/projectionSupport.js";import{getQueryResultExtent as ae,getQueryBoundingRects as C,QueryEngine as w}from"../../data/QueryEngine.js";import{queryCapabilities as T}from"../../data/QueryEngineCapabilities.js";import{QueryEngineResult as E}from"../../data/QueryEngineResult.js";import{normalizeQueryLike as D}from"../../data/queryUtils.js";import{createFileProvider as O}from"../parquet/createFileProvider.js";import{readFieldStatistic as k}from"../parquet/ParquetFileStatistics.js";import{createDrawingInfo as oe}from"./clientSideDefaults.js";import{getParquetFileId as se,getParquetRowId as ce,getParquetObjectId as A}from"./parquetIdUtils.js";import j from"../../../support/Field.js";import M from"../../../support/FieldsIndex.js";import{isNumericField as N}from"../../../support/fieldUtils.js";import{fromParquetGeometryEncodingJSON as P}from"../../../support/parquetEncodingUtils.js";import{completeParquetLayerInfo as F,fromParquetJSONGeometryType as I,toParquetJSONGeometryType as L}from"../../../support/parquetUtils.js";import{loadParquetModule as R}from"../../../../libs/librust-parquet/loadParquetModule.js";import{utc as z}from"../../../../time/constants.js";import{FeatureStoreQueryAdapter as B}from"../../../../views/2d/layers/features/FeatureStoreQueryAdapter.js";import{FeatureSnapshotSourceChunk as V}from"../../../../views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js";import{FeatureSourceChunkStore as H}from"../../../../views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as U}from"../../../../views/2d/layers/features/support/FeatureMetadata.js";import{FeatureSetReaderParquet as W}from"../../../../views/2d/layers/features/support/FeatureSetReaderParquet.js";const G=new B,K=`__OBJECTID`,q=8e3;class le{constructor(e,t){this._files=e,this._createFileStream=t,this._fileIndex=0,this._streamIndex=0,this._streams=[],this._pending=new Set,this._resolvedCount=0}async next(e){for(await this._fill(e);this._pending.size>0;){o(e),await this._fill(e);let t=await ue(this._pending);if(this._pending.delete(t.read),this._resolvedCount++,t.chunk!=null)return t.chunk}return null}async _fill(e){for(this._removeDone();this._pending.size<8;){let t=this._getOrCreateNextStream(e);if(t==null)return;this._pending.add(t.read(e))}}_getOrCreateNextStream(e){let t=this._resolvedCount>=8?8:2;if(this._fileIndex<this._files.length&&this._streams.length<t){let t=this._files[this._fileIndex++],n=new de(t.id,this._createFileStream(t,e));return this._streams.push(n),n}return this._getNextStream()}_getNextStream(){let e=this._streams.length;for(let t=0;t<e;t++){let n=(this._streamIndex+t)%e,r=this._streams[n];if(r.canRead)return this._streamIndex=(n+1)%e,r}return null}_removeDone(){let e=this._streamIndex;for(let t=this._streams.length-1;t>=0;t--)this._streams[t].done&&(this._streams.splice(t,1),t<e&&e--);this._streamIndex=this._streams.length>0?e%this._streams.length:0}}function ue(e){return Promise.race(Array.from(e,async e=>({read:e,chunk:await e})))}class de{constructor(e,t){this._fileId=e,this._stream=t,this._readCount=0,this._reachedEnd=!1}get canRead(){return!this._reachedEnd}get done(){return this._reachedEnd&&this._readCount===0}async read(e){this._readCount++;try{let t=await(await this._stream).next(e);return t==null?(this._reachedEnd=!0,null):{fileId:this._fileId,chunk:t}}finally{this._readCount--}}}class fe{constructor(){this._hasZ=!1,this._hasM=!1,this._queue=new s({concurrency:4,process:(e,t)=>this._executeQuery(e,t)}),this._streams=new Map,this._streamIdCounter=0,this._indexMap={},this._handles=new r}async load(e){let t=e.spatialReference?d.fromJSON(e.spatialReference):void 0;if(t&&!t.isWGS84&&!t.isWebMercator)throw new n(`parquet:unsupported-projection`,`Only WGS84 and Web Mercator are supported`);this._customParameters=e.customParameters,this._loadParameters=e,await this._updateProvider(O(e.provider,null,()=>this._customParameters));let r=await this._provider.getMetadata(),a=await F(r,{fields:e.fields?.map(e=>j.fromJSON(e)),geometryEncoding:e.geometryEncoding?P(e.geometryEncoding):null,geometryType:e.geometryType?I(e.geometryType):null,displayOptimization:e.displayOptimization,spatialReference:t});if(this._hasZ=!!r?.hasZ,this._hasM=!!r?.hasM,!a.fields)throw new n(`parquet:unsupported`,`Fields must be defined`);let o;if(a.spatialReference&&a.geometryType){if(!a.spatialReference)throw new n(`parquet:unsupported`,`SpatialReference must be defined`);if(!a.spatialReference.isGeographic&&!a.spatialReference.isWebMercator)throw new n(`parquet:unsupported-projection`,`Only WGS84 and Web Mercator are supported`);a.spatialReference.isGeographic&&!a.spatialReference.isWGS84&&(i.getLogger(`parquet:unsupported-projection`).warn(`Found a geographic projection that is not WGS84. Handling as WGS84.`,{spatialReference:a.spatialReference}),a.spatialReference=d.WGS84),o={geometry:a.geometryEncoding?{geometryType:L(a.geometryType),spatialReference:a.spatialReference.toJSON(),encoding:a.geometryEncoding.toJSON()}:null,displayOptimization:a.displayOptimization}}this.setCustomParameters(e.customParameters),this._displayOptimization=a.displayOptimization,await this._provider.updateGeometryInfo(o),this._capabilities=$(await this._getFileStatistics(),this._hasZ,this._hasM);let s=await this._provider.getFiles();if(!s.length)return{layerDefinition:{},capabilities:$(null,this._hasZ,this._hasM)};let c=await s[0].file;a.file=c;let{fields:l}=a;if(l==null)throw new n(`parquet-layer:missing-metadata`,`Unable to create parquet source: cannot infer fields`,l);l.push(new j({name:K,type:`oid`,alias:K}));for(let e of l){let t=c.getColumnId(e.name);t!=null&&(this._indexMap[e.name]=t)}let u=M.fromLayerJSON({fields:l.map(e=>e.toJSON()),dateFieldsTimeReference:{timeZoneIANA:`UTC`}});this._fieldsIndex=u;let f=L(a.geometryType??`point`);return this._metadata=U.createFeature({fieldsIndex:u.toJSON(),geometryType:f,hasZ:this._hasZ,hasM:this._hasM,featureIdInfo:{type:`object-id`,fieldName:K},subtypes:null,subtypeField:null,types:null,typeIdField:null,globalIdField:null,spatialReference:a.spatialReference,outSpatialReference:null,attributeSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:z}),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:f,featureIdInfo:{type:`object-id`,fieldName:K},hasM:this._hasM,hasZ:this._hasZ,spatialReference:a.spatialReference?.toJSON()??{wkid:4326},aggregateAdapter:null,timeInfo:null,definitionExpression:null},this._fullExtent=r?.extent?r.extent:await this._tryDeriveParquetFullExtent(a),{capabilities:this._capabilities,layerDefinition:{fields:a.fields?.map(e=>e.toJSON()),drawingInfo:oe(f),extent:this._fullExtent??void 0,geometryType:f,hasZ:this._hasZ,hasM:this._hasM,geometryEncoding:a.geometryEncoding?.toJSON(),displayOptimization:a.displayOptimization}}}destroy(){this._provider.destroy(),this._queue.destroy();for(let{handle:e}of this._streams.values())e.remove();this._streams.clear(),this._indexMap={},this._handles.removeAll()}async reload(e){this.destroy(),await this.load(e)}set remoteClient(e){this._source=e.createInvokeProxy(``)}setCustomParameters(e){this._customParameters=e}getIndexMap(){return this._indexMap}async updateFileProvider(e){this._loadParameters={...this._loadParameters,provider:e};let t=O(e,this._provider.getGeometryInfo(),()=>this._customParameters);await this._updateProvider(t)}async getDiagnosticsSnapshot(){let e=await this._provider.getFiles();return{files:await Promise.all(e.map(e=>e.getDiagnosticsSnapshot()))}}async getColumnIndex(e){return(await this._getFileInfoById(e.fileId)).getColumnIndex(e.rowGroupIndex,e.columnIndex)}async getOffsetIndex(e){return(await this._getFileInfoById(e.fileId)).getOffsetIndex(e.rowGroupIndex,e.columnIndex)}async queryFeatures(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),Te(n)||(n.resultRecordCount=n.resultRecordCount?Math.min(n.resultRecordCount,q):q,n.resultOffset=n.resultOffset??0),n.outStatistics?this._queryStatistics(n,t):(n.returnDistinctValues&&(n.returnGeometry=void 0),(await this._enqueueQuery(n,t)).createQueryResponse())}async queryFeatureCount(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),!J(n)&&!n.returnDistinctValues&&!n.groupByFieldsForStatistics?.length&&!n.outStatistics?.length?this._getFeatureCount():(n.returnDistinctValues||(n.outFields=void 0),n.returnGeometry=void 0,(await this._enqueueQuery(n,t)).createQueryResponseForCount())}async queryObjectIds(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),J(n)?(n.resultRecordCount=n.resultRecordCount?Math.min(n.resultRecordCount,8e3):8e3,n.resultOffset=n.resultOffset??0,n.returnGeometry=void 0,n.outFields=void 0,n.returnDistinctValues=void 0,(await this._enqueueQuery(n,t)).items.map(e=>e.getObjectId())):Array.from({length:await this._getFeatureCount()},(e,t)=>t)}async queryAttributeBins(e,t={}){throw new n(`parquet:unsupported`,`queryAttributeBins not supported.`)}async queryExtent(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);this._validateQuery(n);let r=n.outSR??this._queryEngineParams.spatialReference;if(this._fullExtent&&!J(n)){let e=this._fullExtent;return await u(e.spatialReference,n.outSR),{count:await this._getFeatureCount(),extent:n.outSR?ie(e,n.outSR):e}}n.returnGeometry=!0,n.outFields=void 0;let i=f(p(),g),a=p(),o=await this._enqueueQuery(n,t),s=0;for(let e of o.items)e.getBounds(a)&&(m(i,a),s+=1);let c=ae(i,r,r,r,!1);return{count:s,extent:c}}async queryStream(e,t){if(!t.signal)throw Error(`InternalError: AbortSignal must be passed`);let n=await this._getCandidateFiles(e),r=new le(n,async(t,n)=>{let r=await t.file,i=await this._createParquetDisplayQuery(r,t.id,e);return r.executeQuery(i,q,n)}),i=this._streamIdCounter++,o=a(t.signal,e=>{let t=this._streams.get(i);t!=null&&(t.handle.remove(),this._streams.delete(i))});return this._streams.set(i,{stream:r,handle:o}),i}async getStreamNext(e,t){if(!t.signal)throw Error(`InternalError: AbortSignal must be passed`);let n=this._streams.get(e);if(!n)return{result:null};let r=await n.stream.next(t.signal);if(r==null)return n.handle.remove(),this._streams.delete(e),{result:null};let i=r.chunk.serialize().buffer,a={fileId:r.fileId,buffer:i};return i instanceof ArrayBuffer?{result:a,transferList:[i]}:{result:a}}async getStreamNextFeatures(e,t){let{result:n}=await this.getStreamNext(e,t);if(n==null)return null;let r=(await R()).ParquetChunk.deserialize(new Uint8Array(n.buffer)),i=new W(this._metadata,this._indexMap,r,n.fileId),a=[];for(;i.next();){let e=S(i.readGeometryWorldSpace(),i.geometryType,i.hasZ,i.hasM),t=i.readAttributes();a.push({attributes:t,geometry:e})}return{features:a}}async createPatch(e,t,n,r,i){if(!i.signal)throw Error(`InternalError: AbortSignal must be passed`);return(await(await(await this._getFileInfoById(e)).file).createChunkPatch(t,n,r,i.signal)).serialize().buffer}async _updateProvider(e){let t=this._provider;this._handles.removeAll(),this._provider=e,this._handles.add([e.events.on(`rangeRead`,e=>{this._source.onRangeRead(e)}),e.events.on(`sourceChanged`,async()=>{await this.reload(this._loadParameters),await this._source.onSourceChange()})]),await t?.destroy()}async _getCandidateFiles(e){let t=await this._provider.getFiles(),n=await this._getSpatialFilePruning(e);if(n==null)return t;let r=t.filter(e=>this._mayIncludeFileForSpatialPruning(e,n));return n.type===`xz`?we(r,n):r}async _queryStatistics(e,t){let n=await D({...e},null,this._queryEngineParams.spatialReference);if(n.returnGeometry=void 0,ve(n,this._fieldsIndex)){let e=await this._getStatisticsFromFiles(n);if(e)return e}return(await this._enqueueQuery(n,t)).createQueryResponse()}async _getStatisticsFromFiles(e){let t=await this._provider.getFiles(),n={},r=[];for(let i of e.outStatistics??[]){let e=xe(i,t);if(!e.available)return null;n[i.outStatisticFieldName]=e.value,r.push(be(i,this._fieldsIndex))}return{fields:r,features:[{attributes:n}]}}async _getSpatialFilePruning(e){if(e.type!==`tile`&&(e.type!==`arcade`||e.extent==null))return null;let t=this._displayOptimization?.index;if(t==null)return null;let n=e.outSpatialReference.wkid;if(t.wkid==null||n==null)return null;let r=t.wkid,i=await R();switch(t.type){case`xz`:return{type:`xz`,fieldName:x(t.code),intersects:(a,o)=>i.queryIntersectsXZStatistics(t.fullExtent,e.extent,n,r,t.maxLevel,a,o)};case`z`:return{type:`xy`,xFieldName:x(t.xColumn),yFieldName:x(t.yColumn),intersects:(t,a,o,s)=>i.queryIntersectsXYStatistics(e.extent,n,r,t,a,o,s)}}}_mayIncludeFileForSpatialPruning(e,t){switch(t.type){case`xz`:{let n=Z(e,t);return n?.type===`null-only`?!1:n?.type!==`bounds`||t.intersects(n.minValue,n.maxValue)}case`xy`:{let n=e.statistics.statistics.get(t.xFieldName),r=e.statistics.statistics.get(t.yFieldName);return n?.type===`null-only`||r?.type===`null-only`?!1:n?.type!==`bounds`||r?.type!==`bounds`||t.intersects(n.minValue,n.maxValue,r.minValue,r.maxValue)}}}async _tryDeriveParquetFullExtent(n){if(!n.spatialReference)return null;if(this._fullExtent==null&&n.geometryEncoding?.type===`location`){let r=await this._provider.getFiles(),{xField:i,yField:a}=n.geometryEncoding,o=f(p(),g),s=!1;for(let n of r){let r=await n.file;for(let n of r.rowGroups()){let r={stack:[],error:void 0,hasError:!1};try{let t=e(r,n.columnDescriptorForAttribute(i),!1),c=e(r,n.columnDescriptorForAttribute(a),!1),l=k(t),u=k(c);if(l?.type===`bounds`&&u?.type===`bounds`){let e=[l.minValue,u.minValue,l.maxValue,u.maxValue];h(o,e),s=!0}n.free()}catch(e){r.error=e,r.hasError=!0}finally{t(r)}}}return s?{xmin:o[0],ymin:o[1],xmax:o[3],ymax:o[4],spatialReference:n.spatialReference?.toJSON()}:null}return null}async _getFileInfoById(e){let t=await this._provider.getFiles();for(let n of t)if(n.id===e)return n;throw Error(`InternalError: File ${e} does not exist`)}async _getFileStatistics(){return{featureCount:await this._getFeatureCount(),byteLength:await this._getByteLength()}}async _getFile(e){return(await this._getFileInfoById(e)).file}async _createParquetQuery(e,t,n,r,i){let a=(await R()).Query.new();n!=null&&a.setPreFilterStart(n),r!=null&&a.setPreFilterCount(r),i!=null&&a.setPostFilterCount(i);let o=await this._getRequiredFields(e);a.setOutFields(o),(e.geometry||e.returnGeometry)&&a.setReturnGeometry(!0),a.setReturnZ(!!e.returnZ),a.setReturnM(!!e.returnM);let s=this._tryGetGeneralizedGeometryResolution(e);s!=null&&a.setSourceResolution(s);let c=e.geometry?.spatialReference??this._queryEngineParams.spatialReference,l=c.wkid;if(e.geometry&&(y(c)||b(c))){let t=_(v(),te);for(let n of C(e.geometry))ee(t,n);a.setOutSpatialReference(l),a.setExtent({xmin:t[0],ymin:t[1],xmax:t[2],ymax:t[3]})}if(e.where){let{id:n,file:r}=t;await this._setWhereClause(a,await r,n,e.where)}return a}async _createParquetDisplayQuery(e,t,n){let r=(await R()).Query.new();if(n.type===`tile`){r.setExtent(n.extent),r.setQuantizationTransform(n.transform);let e=this._sourceResolution(n.resolution,n.outSpatialReference);e!=null&&r.setSourceResolution(e)}else n.type===`arcade`&&n.extent!=null&&r.setExtent(n.extent);return r.setOutFields(n.outFields.filter(e=>this._indexMap[e]!=null)),r.setOutSpatialReference(n.outSpatialReference.wkid),r.setReturnGeometry(n.returnGeometry),r.setReturnZ(n.returnZ),r.setReturnM(n.returnM),n.where&&await this._setWhereClause(r,e,t,n.where),r}async _getFeatureCount(){return(await this._provider.getFiles()).map(e=>e.statistics.rowCount).reduce((e,t)=>e+t,0)}async _getByteLength(){return(await this._provider.getFiles()).map(e=>e.statistics.byteSize).reduce((e,t)=>e+t,0)}_validateQuery(e){if(!this._capabilities.query.supportsStatistics&&e.outStatistics)throw new n(`parquet:unsupported`,`Statistics queries are not supported`,{query:e});if(!this._capabilities.query.supportsOrderBy&&e.orderByFields?.length)throw new n(`parquet:unsupported`,`Queries using orderBy are not supported`,{query:e});if(!this._capabilities.query.supportsDistinct&&e.returnDistinctValues)throw new n(`parquet:unsupported`,`Queries using returnDistinctValues are not supported`,{query:e})}async _setWhereClause(e,t,r,i){let a=this._indexMap,o=this._fieldsIndex,s={getAttribute(e,n){let i=a[n];if(i==null){if(o.get(n)?.name===`__OBJECTID`){let t=e.row+e.rowGroupStart;return A(r,t)}return null}let s=o.get(n);return ne(t,e.rowGroup,e.row,i,s.type)}},l=await c(i,this._fieldsIndex);if(!l.isStandardized)throw new n(`sql-parse-error`,`expression is not standardized`);let u=(e,t,n)=>l.testFeatureCompiled({rowGroup:e,row:t,rowGroupStart:n},s,null),d=l.fieldNames.map(e=>o.get(e)).filter(e=>e&&this._indexMap[e?.name]!=null);e.setWhere(i),e.setWhereEvaluator(u),e.setWhereFields(d.map(e=>e.name))}async*_streamFeatures(e,t,n,r,i){let a=await this._provider.getFiles(),o=0;for(let s of a){let a=o,c=o+s.statistics.rowCount;if(o+=s.statistics.rowCount,t!=null&&t>=c)continue;let l=t==null?null:Math.max(t-a,0),u=n;if(n!=null){let e=t??0,r=e+n;u=Math.max(Math.min(r,c)-Math.max(e,a),0)}if(u===0)continue;let d=await this._createParquetQuery(e,s,l,u,r),f=await(await s.file).executeQuery(d,q),p=async()=>{let e=await f.next(i);if(!e)return null;let t=new W(this._metadata,this._indexMap,e,s.id);return X([new V(t,null,0,!1)],this._queryEngineParams)},m=await p();for(;m!=null;)yield m,m=await p()}}async _queryFeaturesWithQueryEnginePagination(e,t){let n=[],r=this._streamFeatures(e,null,null,null,t),i=await r.next();for(;!i.done;){let a=await i.value.executeQueryForOpaqueFeatures({...e,where:void 0},t);for(let e of a)n.push(e);i=await r.next()}return n}async _queryFeaturesWithUpfrontPagination(e,t){let n=e.resultOffset??0,r=e.resultRecordCount??q,i,a,o;ge(e)?_e(e)||(o=n+r):(n&&=(i=n,0),a=e.resultRecordCount);let s=[],c=this._streamFeatures(e,i,a,o,t),l=await c.next();for(;!l.done&&r>0;){let i=await l.value.executeQueryForOpaqueFeatures({...e,where:void 0},t);for(let e of i){if(n>0){n--;continue}if(s.push(e),--r<=0)return s}l=await c.next()}return s}_enqueueQuery(e,t){return this._queue.push(e,t)}async _executeQuery(e,t){if(e.objectIds?.length){let n=new Map;for(let t of e.objectIds){let e=se(t),r=ce(t),i=n.get(e);i||(i=[],n.set(e,i)),i.push(r)}let r=[];for(let[i,a]of n.entries()){let n=await this._executeFileIdQuery(e,i,a,t);for(let e of n)r.push(e)}return new E(r,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:this._hasM,hasZ:this._hasZ,featureAdapter:G,featureIdInfo:this._queryEngineParams.featureIdInfo})}if(e.where===`1=1`&&(e.where=null),e.resultOffset??=0,e.resultRecordCount??=await this._getFeatureCount(),e.resultRecordCount>2e7&&!(this._displayOptimization&&e.geometry))throw new n(`parquet:cannot-execute-query`,`Unable to execute query, dataset is too large.`);let r=!!e.orderByFields?.length||!!e.outStatistics?.length||!!e.returnDistinctValues,i=r?await this._queryFeaturesWithQueryEnginePagination(e,t):await this._queryFeaturesWithUpfrontPagination(e,t);return r||(e.resultOffset=0),new E(i,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:this._hasM,hasZ:this._hasZ,featureAdapter:G,featureIdInfo:this._queryEngineParams.featureIdInfo})}async _executeFileIdQuery(e,t,n,r){let i=new Set(await this._getRequiredFields(e));if(e.where){let t=await c(e.where,this._fieldsIndex);for(let e of t.fieldNames){let t=this._fieldsIndex.get(e);t&&this._indexMap[t.name]!=null&&i.add(t.name)}}let a=(await R()).Query.new();a.setOutFields(Array.from(i)),a.setReturnGeometry(!!e.returnGeometry),a.setReturnZ(!!e.returnZ),a.setReturnM(!!e.returnM),a.setIds(new Uint32Array(n));let o=await(await this._getFile(t)).executeQuery(a,q,r),s=await o.next(r),l=0,u=[];for(;s!=null;){let e=new W(this._metadata,this._indexMap,s,t),n=new V(e,null,l++,!1);u.push(n),s=await o.next(r)}return X(u,this._queryEngineParams).executeQueryForOpaqueFeatures(e,r)}async _getRequiredFields(e){let t=new Set;if(e.outStatistics)for(let n of re(this._fieldsIndex,e.outStatistics,e.groupByFieldsForStatistics))t.add(n);else if(e.outFields)for(let n of e.outFields)t.add(n);return(t.has(`*`)?this._fieldsIndex.fields.map(e=>e.name):Array.from(t)).filter(e=>this._indexMap[e]!=null)}_tryGetGeneralizedGeometryResolution(e){if(!this._displayOptimization)return null;let t=e.outSR??this._queryEngineParams.spatialReference;if(!y(t)&&!b(t))return null;let n=e.quantizationParameters?.tolerance??e.maxAllowableOffset;return n?this._sourceResolution(n,t):null}_sourceResolution(e,t){let n=this._queryEngineParams.spatialReference,r=l(t)/l(n)*e;return!Number.isFinite(r)||r<=0?null:r}}function pe(e){switch(e){case`fullText`:case`having`:case`timeExtent`:case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:case`objectIds`:case`where`:case`geometry`:case`resultOffset`:case`resultRecordCount`:return!0;default:return!1}}function me(e){switch(e){case`fullText`:case`having`:case`timeExtent`:case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:case`objectIds`:case`where`:case`geometry`:return!0;default:return!1}}function he(e){switch(e){case`fullText`:case`having`:case`timeExtent`:return!0;case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:return!1;case`objectIds`:case`where`:case`resultOffset`:case`geometry`:case`resultRecordCount`:return!1}return!1}function J(e){for(let t in e){let n=t;if(pe(n)&&e[n]!==null)return!0}return!1}function ge(e){for(let t in e){let n=t;if(me(n)&&e[n]!==null)return!0}return!1}function _e(e){for(let t in e){let n=t;if(he(n)&&e[n]!==null)return!0}return!1}function ve(e,t){return!!e.outStatistics?.length&&!J(e)&&!e.groupByFieldsForStatistics?.length&&!e.orderByFields?.length&&!e.returnDistinctValues&&!e.returnAggIds&&e.outStatistics.every(e=>ye(e,t))}function ye(e,t){switch(e.statisticType){case`count`:return e.onStatisticField===`1`||t.get(e.onStatisticField)!=null;case`min`:case`max`:{let n=t.get(e.onStatisticField);return n!=null&&N(n)}default:return!1}}function be(e,t){let n=e.statisticType===`exceedslimit`?null:t.get(e.onStatisticField),r=(e.statisticType===`min`||e.statisticType===`max`)&&n?.type===`esriFieldTypeDate`?n.type:`esriFieldTypeDouble`;return{name:e.outStatisticFieldName,alias:e.outStatisticFieldName,type:r}}function xe(e,t){switch(e.statisticType){case`count`:return Se(e,t);case`min`:return Y(e,t,Math.min);case`max`:return Y(e,t,Math.max);default:return{available:!1,value:null}}}function Se(e,t){if(e.statisticType!==`count`)return{available:!1,value:null};if(e.onStatisticField===`1`)return{available:!0,value:t.reduce((e,t)=>e+t.statistics.rowCount,0)};let n=0;for(let r of t){let t=r.statistics.statistics.get(e.onStatisticField);if(t==null||t.nullCount==null)return{available:!1,value:null};n+=r.statistics.rowCount-t.nullCount}return{available:!0,value:n}}function Y(e,t,n){if(e.statisticType!==`min`&&e.statisticType!==`max`)return{available:!1,value:null};let r=null,i=e.statisticType===`min`?`minValue`:`maxValue`;for(let a of t){let t=a.statistics.statistics.get(e.onStatisticField);if(t==null)return{available:!1,value:null};switch(t.type){case`null-only`:continue;case`unknown`:return{available:!1,value:null};case`bounds`:{let e=Ce(t[i]);if(e==null)return{available:!1,value:null};r=r==null?e:n(r,e);break}}}return{available:!0,value:r}}function Ce(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function X(e,t){let n=new H;for(let t of e)n.insert(t);return new w({...t,featureStore:n})}function Z(e,t){return e.statistics.statistics.get(t.fieldName)??null}function we(e,t){return e.slice().sort((e,n)=>{let r=Q(e,t),i=Q(n,t);return r===i?0:r<i?-1:1})}function Q(e,t){let n=Z(e,t);return n?.type===`bounds`?n.maxValue-n.minValue:1/0}function $(e,t,n){let r=e?.featureCount,i=!1;return r!=null&&r<has(`parquetlayer-full-query-feature-count`)&&(i=!0),{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportedCurveTypes:[],supportsAttachment:!1,supportsM:n,supportsTrueCurve:!1,supportsZ:t},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:{...T,maxRecordCount:q,supportsOrderBy:i,supportsDistinct:!0,supportsStatistics:!0,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1}},queryAttributeBins:{supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsTrueCurveUpdate:!1,supportsTrueCurveUpdateByTrueCurveClientsOnly:!0,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUploadWithItemId:!1,supportsUpdateWithoutM:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}function Te(e){return!!e.objectIds?.length||!!e.outStatistics||!!e.orderByFields?.length||!!e.returnDistinctValues}export{fe as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import n from"../../../../core/Error.js";import has from"../../../../core/has.js";import{whenOrAbort as r}from"../../../../core/promiseUtils.js";import{urlToObject as i}from"../../../../core/urlUtils.js";import{property as a,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{equals as s}from"../../../../geometry/support/spatialReferenceUtils.js";import{getGltfQueryFormat as c}from"../../../support/infoFor3D.js";import{parseUrl as l}from"../../../../rest/utils.js";import{dynamicDataSourceTypes as u}from"../../../../rest/layerSources/typeUtils.js";import{executeForCount as d}from"../../../../rest/query/executeForCount.js";import{executeForExtent as f}from"../../../../rest/query/executeForExtent.js";import{executeForIds as p}from"../../../../rest/query/executeForIds.js";import{executeRawQueryJSON as m}from"../../../../rest/query/executeQueryJSON.js";import{executeRawQueryPBF as h}from"../../../../rest/query/executeQueryPBF.js";import g from"../../../../rest/support/FeatureSet.js";import _ from"../../../../rest/support/Query.js";let v=class extends t{constructor(e){super(e),this.dynamicDataSource=null,this.fieldsIndex=null,this.gdbVersion=null,this.infoFor3D=null,this.pbfSupported=!1,this.pbfSupportedWithCurves=!1,this.queryAttachmentsSupported=!1,this.relativeTimeBinWindow=0,this.sourceSpatialReference=null,this.timeInformation=null,this.uniqueIdFields=null,this.url=null}get parsedUrl(){return i(this.url)}async execute(e,t){let n=await this.executeJSON(e,t);return this.featureSetFromJSON(e,n,t)}async executeJSON(e,t){let n=this._normalizeQuery(e),r=e.outStatistics?.[0]!=null,i=has(`featurelayer-pbf-statistics`),a=this.pbfSupported&&(!r||i)&&(!e.returnTrueCurves||this.pbfSupportedWithCurves),o;if(a)try{o=await h(this.url,n,t,{timeInformation:this.timeInformation,uniqueIdFields:this.uniqueIdFields})}catch(e){if(e.name===`query:parsing-pbf`)this.pbfSupported=!1;else throw e}return o??=await m(this.url,n,t,{timeInformation:this.timeInformation,uniqueIdFields:this.uniqueIdFields}),this._normalizeFields(o.fields),o}async featureSetFromJSON(e,t,n){if(!this._queryGet3DObjectFormat(e)||this.infoFor3D==null||!t.features)return g.fromJSON(t);let{meshFeatureSetFromJSON:i}=await r(import(`../../../../rest/support/meshFeatureSet.js`),n);return i(e,this.infoFor3D,t)}executeForCount(e,t){return d(this.url,this._normalizeQuery(e),t,{timeInformation:this.timeInformation,uniqueIdFields:this.uniqueIdFields})}executeForExtent(e,t){return f(this.url,this._normalizeQuery(e),t)}executeForIds(e,t){return p(this.url,this._normalizeQuery(e),t,{timeInformation:this.timeInformation,uniqueIdFields:this.uniqueIdFields})}async executeRelationshipQuery(e,t){let[{default:n},{executeRelationshipQuery:i}]=await r(Promise.all([import(`../../../../rest/support/RelationshipQuery.js`),import(`../../../../rest/query/executeRelationshipQuery.js`)]),t),a=n.from(e);return(this.gdbVersion||this.dynamicDataSource)&&(a=a.clone(),a.gdbVersion=a.gdbVersion||this.gdbVersion,a.dynamicDataSource=a.dynamicDataSource||this.dynamicDataSource),i(this.url,a,t)}async executeRelationshipQueryForCount(e,t){let[{default:n},{executeRelationshipQueryForCount:i}]=await r(Promise.all([import(`../../../../rest/support/RelationshipQuery.js`),import(`../../../../rest/query/executeRelationshipQuery.js`)]),t),a=n.from(e);return(this.gdbVersion||this.dynamicDataSource)&&(a=a.clone(),a.gdbVersion=a.gdbVersion||this.gdbVersion,a.dynamicDataSource=a.dynamicDataSource||this.dynamicDataSource),i(this.url,a,t)}async executeAttachmentQuery(e,t){let{executeAttachmentQuery:n,fetchAttachments:i,processAttachmentQueryResult:a}=await r(import(`../../../../rest/query/operations/queryAttachments.js`),t),o=l(this.url);return a(o,await(this.queryAttachmentsSupported?n(o,e,t):i(o,e,t)))}async executeAttributeBinsQuery(e,t){let{executeAttributeBinsQuery:n}=await r(import(`../../../../rest/query/executeAttributeBinsQuery.js`),t);return n(this.parsedUrl,e,t)}async executePivotQuery(e,t){let{executePivotQuery:n}=await r(import(`../../../../rest/query/executePivotQuery.js`),t);return n(this.parsedUrl,e,t)}async executeTopFeaturesQuery(e,t){let{executeTopFeaturesQuery:n}=await r(import(`../../../../rest/query/executeTopFeaturesQuery.js`),t);return n(this.parsedUrl,e,this.sourceSpatialReference,t)}async executeForTopIds(e,t){let{executeForTopIds:n}=await r(import(`../../../../rest/query/executeForTopIds.js`),t);return n(this.parsedUrl,e,t)}async executeForTopExtents(e,t){let{executeForTopExtents:n}=await r(import(`../../../../rest/query/executeForTopExtents.js`),t);return n(this.parsedUrl,e,t)}async executeForTopCount(e,t){let{executeForTopCount:n}=await r(import(`../../../../rest/query/executeForTopCount.js`),t);return n(this.parsedUrl,e,t)}_normalizeQuery(e){let t=_.from(e);t.sourceSpatialReference=t.sourceSpatialReference||this.sourceSpatialReference,(this.gdbVersion||this.dynamicDataSource)&&(t=t===e?t.clone():t,t.gdbVersion=e.gdbVersion||this.gdbVersion,t.dynamicDataSource=e.dynamicDataSource||this.dynamicDataSource);let{infoFor3D:r}=this,i=this._queryGet3DObjectFormat(e);if(r!=null&&i){if(t=t===e?t.clone():t,t.formatOf3DObjects=i,t.outSpatialReference&&!s(t.outSpatialReference,this.sourceSpatialReference))throw new n(`query:unsupported-out-spatial-reference`,`3D object feature services do not support projection of geometries`);if(t.outFields==null||!t.outFields.includes(`*`)){t=t===e?t.clone():t,t.outFields??(t.outFields=[]);let{originX:n,originY:i,originZ:a,translationX:o,translationY:s,translationZ:c,scaleX:l,scaleY:u,scaleZ:d,rotationX:f,rotationY:p,rotationZ:m,rotationDeg:h}=r.transformFieldRoles;t.outFields.push(n,i,a,o,s,c,l,u,d,f,p,m,h)}}return t}_normalizeFields(e){if(this.fieldsIndex!=null&&e!=null)for(let t of e){let e=this.fieldsIndex.get(t.name);e&&Object.assign(t,e.toJSON())}}_queryGet3DObjectFormat({returnGeometry:e,multipatchOption:t,outStatistics:n}){return e===!0&&t!==`xyFootprint`&&!n?c(this.infoFor3D):null}};e([a({types:u})],v.prototype,`dynamicDataSource`,void 0),e([a()],v.prototype,`fieldsIndex`,void 0),e([a()],v.prototype,`gdbVersion`,void 0),e([a()],v.prototype,`infoFor3D`,void 0),e([a({readOnly:!0})],v.prototype,`parsedUrl`,null),e([a()],v.prototype,`pbfSupported`,void 0),e([a()],v.prototype,`pbfSupportedWithCurves`,void 0),e([a()],v.prototype,`queryAttachmentsSupported`,void 0),e([a()],v.prototype,`relativeTimeBinWindow`,void 0),e([a()],v.prototype,`sourceSpatialReference`,void 0),e([a()],v.prototype,`timeInformation`,void 0),e([a()],v.prototype,`uniqueIdFields`,void 0),e([a({type:String})],v.prototype,`url`,void 0),v=e([o(`esri.layers.graphics.sources.support.QueryTask`)],v);export{v as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import n from"../../../../core/Error.js";import has from"../../../../core/has.js";import{whenOrAbort as r}from"../../../../core/promiseUtils.js";import{urlToObject as i}from"../../../../core/urlUtils.js";import{property as a,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{equals as s}from"../../../../geometry/support/spatialReferenceUtils.js";import{getGltfQueryFormat as c}from"../../../support/infoFor3D.js";import{parseUrl as l}from"../../../../rest/utils.js";import{dynamicDataSourceTypes as u}from"../../../../rest/layerSources/typeUtils.js";import{executeForCount as d}from"../../../../rest/query/executeForCount.js";import{executeForExtent as f}from"../../../../rest/query/executeForExtent.js";import{executeForIds as p}from"../../../../rest/query/executeForIds.js";import{executeRawQueryJSON as m}from"../../../../rest/query/executeQueryJSON.js";import{executeRawQueryPBF as h}from"../../../../rest/query/executeQueryPBF.js";import g from"../../../../rest/support/FeatureSet.js";import _ from"../../../../rest/support/Query.js";let v=class extends t{constructor(e){super(e),this.dynamicDataSource=null,this.fieldsIndex=null,this.gdbVersion=null,this.infoFor3D=null,this.pbfSupported=!1,this.pbfSupportedWithCurves=!1,this.queryAttachmentsSupported=!1,this.relativeTimeBinWindow=0,this.sourceSpatialReference=null,this.timeInformation=null,this.uniqueIdFields=null,this.url=null}get parsedUrl(){return i(this.url)}async execute(e,t){let n=await this.executeJSON(e,t);return this.featureSetFromJSON(e,n,t)}async executeJSON(e,t){let n=this._normalizeQuery(e),r=e.outStatistics?.[0]!=null,i=has(`featurelayer-pbf-statistics`),a=this.pbfSupported&&(!r||i)&&(!e.returnTrueCurves||this.pbfSupportedWithCurves),o;if(a)try{o=await h(this.url,n,t,{timeInformation:this.timeInformation,uniqueIdFields:this.uniqueIdFields})}catch(e){if(e.name===`query:parsing-pbf`)this.pbfSupported=!1;else throw e}return o??=await m(this.url,n,t,{timeInformation:this.timeInformation,uniqueIdFields:this.uniqueIdFields}),this._normalizeFields(o.fields),o}async featureSetFromJSON(e,t,n){if(!this._queryGet3DObjectFormat(e)||this.infoFor3D==null||!t.features)return g.fromJSON(t);let{meshFeatureSetFromJSON:i}=await r(import(`../../../../rest/support/meshFeatureSet.js`),n);return i(e,this.infoFor3D,t)}executeForCount(e,t){return d(this.url,this._normalizeQuery(e),t,{timeInformation:this.timeInformation,uniqueIdFields:this.uniqueIdFields})}executeForExtent(e,t){return f(this.url,this._normalizeQuery(e),t,{timeInformation:this.timeInformation,uniqueIdFields:this.uniqueIdFields})}executeForIds(e,t){return p(this.url,this._normalizeQuery(e),t,{timeInformation:this.timeInformation,uniqueIdFields:this.uniqueIdFields})}async executeRelationshipQuery(e,t){let[{default:n},{executeRelationshipQuery:i}]=await r(Promise.all([import(`../../../../rest/support/RelationshipQuery.js`),import(`../../../../rest/query/executeRelationshipQuery.js`)]),t),a=n.from(e);return(this.gdbVersion||this.dynamicDataSource)&&(a=a.clone(),a.gdbVersion=a.gdbVersion||this.gdbVersion,a.dynamicDataSource=a.dynamicDataSource||this.dynamicDataSource),i(this.url,a,t)}async executeRelationshipQueryForCount(e,t){let[{default:n},{executeRelationshipQueryForCount:i}]=await r(Promise.all([import(`../../../../rest/support/RelationshipQuery.js`),import(`../../../../rest/query/executeRelationshipQuery.js`)]),t),a=n.from(e);return(this.gdbVersion||this.dynamicDataSource)&&(a=a.clone(),a.gdbVersion=a.gdbVersion||this.gdbVersion,a.dynamicDataSource=a.dynamicDataSource||this.dynamicDataSource),i(this.url,a,t)}async executeAttachmentQuery(e,t){let{executeAttachmentQuery:n,fetchAttachments:i,processAttachmentQueryResult:a}=await r(import(`../../../../rest/query/operations/queryAttachments.js`),t),o=l(this.url);return a(o,await(this.queryAttachmentsSupported?n(o,e,t):i(o,e,t)))}async executeAttributeBinsQuery(e,t){let{executeAttributeBinsQuery:n}=await r(import(`../../../../rest/query/executeAttributeBinsQuery.js`),t);return n(this.parsedUrl,e,t,{timeInformation:this.timeInformation,uniqueIdFields:this.uniqueIdFields})}async executePivotQuery(e,t){let{executePivotQuery:n}=await r(import(`../../../../rest/query/executePivotQuery.js`),t);return n(this.parsedUrl,e,t)}async executeTopFeaturesQuery(e,t){let{executeTopFeaturesQuery:n}=await r(import(`../../../../rest/query/executeTopFeaturesQuery.js`),t);return n(this.parsedUrl,e,this.sourceSpatialReference,t,{timeInformation:this.timeInformation,uniqueIdFields:this.uniqueIdFields})}async executeForTopIds(e,t){let{executeForTopIds:n}=await r(import(`../../../../rest/query/executeForTopIds.js`),t);return n(this.parsedUrl,e,t,{timeInformation:this.timeInformation,uniqueIdFields:this.uniqueIdFields})}async executeForTopExtents(e,t){let{executeForTopExtents:n}=await r(import(`../../../../rest/query/executeForTopExtents.js`),t);return n(this.parsedUrl,e,t,{timeInformation:this.timeInformation,uniqueIdFields:this.uniqueIdFields})}async executeForTopCount(e,t){let{executeForTopCount:n}=await r(import(`../../../../rest/query/executeForTopCount.js`),t);return n(this.parsedUrl,e,t,{timeInformation:this.timeInformation,uniqueIdFields:this.uniqueIdFields})}_normalizeQuery(e){let t=_.from(e);t.sourceSpatialReference=t.sourceSpatialReference||this.sourceSpatialReference,(this.gdbVersion||this.dynamicDataSource)&&(t=t===e?t.clone():t,t.gdbVersion=e.gdbVersion||this.gdbVersion,t.dynamicDataSource=e.dynamicDataSource||this.dynamicDataSource);let{infoFor3D:r}=this,i=this._queryGet3DObjectFormat(e);if(r!=null&&i){if(t=t===e?t.clone():t,t.formatOf3DObjects=i,t.outSpatialReference&&!s(t.outSpatialReference,this.sourceSpatialReference))throw new n(`query:unsupported-out-spatial-reference`,`3D object feature services do not support projection of geometries`);if(t.outFields==null||!t.outFields.includes(`*`)){t=t===e?t.clone():t,t.outFields??(t.outFields=[]);let{originX:n,originY:i,originZ:a,translationX:o,translationY:s,translationZ:c,scaleX:l,scaleY:u,scaleZ:d,rotationX:f,rotationY:p,rotationZ:m,rotationDeg:h}=r.transformFieldRoles;t.outFields.push(n,i,a,o,s,c,l,u,d,f,p,m,h)}}return t}_normalizeFields(e){if(this.fieldsIndex!=null&&e!=null)for(let t of e){let e=this.fieldsIndex.get(t.name);e&&Object.assign(t,e.toJSON())}}_queryGet3DObjectFormat({returnGeometry:e,multipatchOption:t,outStatistics:n}){return e===!0&&t!==`xyFootprint`&&!n?c(this.infoFor3D):null}};e([a({types:u})],v.prototype,`dynamicDataSource`,void 0),e([a()],v.prototype,`fieldsIndex`,void 0),e([a()],v.prototype,`gdbVersion`,void 0),e([a()],v.prototype,`infoFor3D`,void 0),e([a({readOnly:!0})],v.prototype,`parsedUrl`,null),e([a()],v.prototype,`pbfSupported`,void 0),e([a()],v.prototype,`pbfSupportedWithCurves`,void 0),e([a()],v.prototype,`queryAttachmentsSupported`,void 0),e([a()],v.prototype,`relativeTimeBinWindow`,void 0),e([a()],v.prototype,`sourceSpatialReference`,void 0),e([a()],v.prototype,`timeInformation`,void 0),e([a()],v.prototype,`uniqueIdFields`,void 0),e([a({type:String})],v.prototype,`url`,void 0),v=e([o(`esri.layers.graphics.sources.support.QueryTask`)],v);export{v as default};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import e from"../../../support/TimeInfo.js";import{hasSameTimeFields as t}from"../../../support/timeInfoUtils.js";import{timeExtentToSQL as n}from"../../../../rest/support/timeUtils.js";function r(r,i,a,o){if(!r.timeExtent||!i&&!a)return r;let s=r.clone();if(i&&a){if(!t(i,e.fromJSON(a))){let e=n(r.timeExtent,i,o,r.where);e&&(s.where=e,s.timeExtent=void 0)}return s}return!i&&a?(s.timeExtent=void 0,s):i&&!a?(s.where=n(r.timeExtent,i,o,r.where),s.timeExtent=void 0,s):s}export{r as applyTimeExtentToQuery};
@@ -18,7 +18,7 @@ export abstract class APIKeyMixin {
18
18
  *
19
19
  * @since 4.20
20
20
  * @see [Item access privileges](https://developers.arcgis.com/documentation/security-and-authentication/api-key-authentication/api-key-credentials/#item-access-privileges)
21
- * @see [API key guide](https://developers.arcgis.com/javascript/latest/secure-resources/#api-keys)
21
+ * @see [Authentication and access tokens](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/#api-keys)
22
22
  * @example
23
23
  * // set the api key to access a protected service
24
24
  * const layer = new FeatureLayer({