@arcgis/core 5.2.0-next.155 → 5.2.0-next.157

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 (484) hide show
  1. package/analysis/LineOfSightAnalysis.d.ts +49 -32
  2. package/analysis/LineOfSightAnalysisObserver.d.ts +19 -3
  3. package/analysis/LineOfSightAnalysisTarget.d.ts +19 -3
  4. package/analysis/Viewshed.d.ts +23 -3
  5. package/analysis/ViewshedAnalysis.d.ts +33 -13
  6. package/arcade/geometry/operatorsWorkerConnection.js +1 -1
  7. package/assets/esri/core/workers/RemoteClient.js +1 -1
  8. package/assets/esri/core/workers/chunks/{d994bcf0a65d1c07160f.js → 0320cbd825f9a4222042.js} +1 -1
  9. package/assets/esri/core/workers/chunks/0590857215c547e63b51.js +1 -0
  10. package/assets/esri/core/workers/chunks/08fe248e412bb170210d.js +1 -0
  11. package/assets/esri/core/workers/chunks/0cb50bc2b2125c5fedf2.js +1 -0
  12. package/assets/esri/core/workers/chunks/1201b8c5852830836eac.js +1 -0
  13. package/assets/esri/core/workers/chunks/129e04d24ced77c9bb6d.js +1 -0
  14. package/assets/esri/core/workers/chunks/15e1117a706a98b17ad5.js +1 -0
  15. package/assets/esri/core/workers/chunks/164e74d586297946a717.js +1 -0
  16. package/assets/esri/core/workers/chunks/168a523bdc3653081f8a.js +1 -0
  17. package/assets/esri/core/workers/chunks/{6f4e6022a52de0c54aab.js → 172cfeb5f415e4662432.js} +1 -1
  18. package/assets/esri/core/workers/chunks/22b01fe31bbf0bdc48db.js +1 -0
  19. package/assets/esri/core/workers/chunks/27c2da2e779def2ee08b.js +1 -0
  20. package/assets/esri/core/workers/chunks/{925271bb763607a326ae.js → 2f04b8679c9f15390517.js} +1 -1
  21. package/assets/esri/core/workers/chunks/35e5762642d1a3a2e375.js +1 -0
  22. package/assets/esri/core/workers/chunks/{481589c3eddad6e026ad.js → 369780276b2755361f7d.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{2a226b69d38c72a47a08.js → 3914d96147642a9d4b01.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{731018c0deffc41ffc97.js → 3e3e076fa5e8d5d5f33f.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{96b6ea199ad949fef17c.js → 43cf862577bf37344ff4.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{eb815148ae65388dd733.js → 44918ff37818a7d36d76.js} +1 -1
  27. package/assets/esri/core/workers/chunks/4932773663469919d10a.js +1 -0
  28. package/assets/esri/core/workers/chunks/4996869b9cbd8c8ddcfa.js +1 -0
  29. package/assets/esri/core/workers/chunks/{be5f92e98d09d6e6e38e.js → 4bb1bb3ffb1b71bc43c8.js} +1 -1
  30. package/assets/esri/core/workers/chunks/4c389472b8cdb0c55154.js +1 -0
  31. package/assets/esri/core/workers/chunks/4e4f747de424941a0bfa.js +1 -0
  32. package/assets/esri/core/workers/chunks/4eae066673484986d4c1.js +1 -0
  33. package/assets/esri/core/workers/chunks/5736feefa261589b6273.js +1 -0
  34. package/assets/esri/core/workers/chunks/{aeaaff7a4b1a99540f52.js → 5cb26bbaa08114aec5ce.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{5f4feca26102088ea565.js → 60737732ce495bbdd0fc.js} +1 -1
  36. package/assets/esri/core/workers/chunks/6f73e41e14817acfaead.js +1 -0
  37. package/assets/esri/core/workers/chunks/{320e5942a098dd104366.js → 74137ffec5265628c33b.js} +1 -1
  38. package/assets/esri/core/workers/chunks/7446d0dfebf93e86c098.js +1 -0
  39. package/assets/esri/core/workers/chunks/{688f2dbf784e66082308.js → 74c866e0b66e61751861.js} +1 -1
  40. package/assets/esri/core/workers/chunks/7711ae5612f685078fc8.js +1 -0
  41. package/assets/esri/core/workers/chunks/{5116b569a8dbda4910c8.js → 784a2fba3e18286958d1.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{916b363c342b61ba5461.js → 787c1a8bda7d745633f2.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{f6e62d2d279a328cbed7.js → 7bcedf479b07a4b4a234.js} +1 -1
  44. package/assets/esri/core/workers/chunks/842893e75696428d536f.js +1 -0
  45. package/assets/esri/core/workers/chunks/{acfa03c65ba3ca6c5685.js → 8715661a838361d4211a.js} +1 -1
  46. package/assets/esri/core/workers/chunks/8e19629899a5becf8e19.js +1 -0
  47. package/assets/esri/core/workers/chunks/9215b59c5ccecf9add58.js +1 -0
  48. package/assets/esri/core/workers/chunks/950d4578dc450467404c.js +1 -0
  49. package/assets/esri/core/workers/chunks/{68be3fb88ca61f82fb90.js → 95dbbddac6581b9d671f.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{fafb92ca2c5e4b0b2c23.js → a09d2e1e2540921e4717.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{900181f68449d8f82eeb.js → aa1ac7954e4f0fefe15b.js} +1 -1
  52. package/assets/esri/core/workers/chunks/ac24b4370dc7194a3107.js +1 -0
  53. package/assets/esri/core/workers/chunks/ace2e0a9d9013edd8624.js +1 -0
  54. package/assets/esri/core/workers/chunks/b1d5d236d5268fcbc74b.js +1 -0
  55. package/assets/esri/core/workers/chunks/{49ff0985fb307ac193ab.js → b573df59391ca41ee5a7.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{f3da30d7300b92bd8bb0.js → befa32b9e7b3fbdd431e.js} +1 -1
  57. package/assets/esri/core/workers/chunks/{6c469b43089767176ced.js → c5ed67fdf261cbb1624b.js} +1 -1
  58. package/assets/esri/core/workers/chunks/cb4be68cc5085d421615.js +1 -0
  59. package/assets/esri/core/workers/chunks/{de6081df29183bf80787.js → d65383f4058dc813f40d.js} +1 -1
  60. package/assets/esri/core/workers/chunks/d6cd0039d6e9c40961e3.js +1 -0
  61. package/assets/esri/core/workers/chunks/{c598b22f78ccc57f9d6d.js → dfd2dc5cdc97ffba8926.js} +1 -1
  62. package/assets/esri/core/workers/chunks/e1b7806ab3e1967b15f0.js +1 -0
  63. package/assets/esri/core/workers/chunks/eaddffcc7004101fc230.js +1 -0
  64. package/assets/esri/core/workers/chunks/eb2652ec48faa78de3c5.js +1 -0
  65. package/assets/esri/core/workers/chunks/{c62738f84c914671b143.js → f4a7aa3cdbc0c429c359.js} +1 -1
  66. package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +4 -0
  67. package/assets/esri/themes/dark/main.css +1 -1
  68. package/assets/esri/themes/light/main.css +1 -1
  69. package/assets/esri/themes/light/view.css +1 -1
  70. package/assets/esri/views/interactive/tooltip/t9n/messages.ar.json +1 -1
  71. package/assets/esri/views/interactive/tooltip/t9n/messages.bg.json +1 -1
  72. package/assets/esri/views/interactive/tooltip/t9n/messages.bs.json +1 -1
  73. package/assets/esri/views/interactive/tooltip/t9n/messages.ca.json +1 -1
  74. package/assets/esri/views/interactive/tooltip/t9n/messages.cs.json +1 -1
  75. package/assets/esri/views/interactive/tooltip/t9n/messages.da.json +1 -1
  76. package/assets/esri/views/interactive/tooltip/t9n/messages.de.json +1 -1
  77. package/assets/esri/views/interactive/tooltip/t9n/messages.el.json +1 -1
  78. package/assets/esri/views/interactive/tooltip/t9n/messages.es.json +1 -1
  79. package/assets/esri/views/interactive/tooltip/t9n/messages.et.json +1 -1
  80. package/assets/esri/views/interactive/tooltip/t9n/messages.fi.json +1 -1
  81. package/assets/esri/views/interactive/tooltip/t9n/messages.fr.json +1 -1
  82. package/assets/esri/views/interactive/tooltip/t9n/messages.he.json +1 -1
  83. package/assets/esri/views/interactive/tooltip/t9n/messages.hr.json +1 -1
  84. package/assets/esri/views/interactive/tooltip/t9n/messages.hu.json +1 -1
  85. package/assets/esri/views/interactive/tooltip/t9n/messages.id.json +1 -1
  86. package/assets/esri/views/interactive/tooltip/t9n/messages.it.json +1 -1
  87. package/assets/esri/views/interactive/tooltip/t9n/messages.ja.json +1 -1
  88. package/assets/esri/views/interactive/tooltip/t9n/messages.ko.json +1 -1
  89. package/assets/esri/views/interactive/tooltip/t9n/messages.lt.json +1 -1
  90. package/assets/esri/views/interactive/tooltip/t9n/messages.lv.json +1 -1
  91. package/assets/esri/views/interactive/tooltip/t9n/messages.nl.json +1 -1
  92. package/assets/esri/views/interactive/tooltip/t9n/messages.no.json +1 -1
  93. package/assets/esri/views/interactive/tooltip/t9n/messages.pl.json +1 -1
  94. package/assets/esri/views/interactive/tooltip/t9n/messages.pt-BR.json +1 -1
  95. package/assets/esri/views/interactive/tooltip/t9n/messages.pt-PT.json +1 -1
  96. package/assets/esri/views/interactive/tooltip/t9n/messages.ro.json +1 -1
  97. package/assets/esri/views/interactive/tooltip/t9n/messages.ru.json +1 -1
  98. package/assets/esri/views/interactive/tooltip/t9n/messages.sk.json +1 -1
  99. package/assets/esri/views/interactive/tooltip/t9n/messages.sl.json +1 -1
  100. package/assets/esri/views/interactive/tooltip/t9n/messages.sr.json +1 -1
  101. package/assets/esri/views/interactive/tooltip/t9n/messages.sv.json +1 -1
  102. package/assets/esri/views/interactive/tooltip/t9n/messages.th.json +1 -1
  103. package/assets/esri/views/interactive/tooltip/t9n/messages.tr.json +1 -1
  104. package/assets/esri/views/interactive/tooltip/t9n/messages.uk.json +1 -1
  105. package/assets/esri/views/interactive/tooltip/t9n/messages.vi.json +1 -1
  106. package/assets/esri/views/interactive/tooltip/t9n/messages.zh-CN.json +1 -1
  107. package/assets/esri/views/interactive/tooltip/t9n/messages.zh-HK.json +1 -1
  108. package/assets/esri/views/interactive/tooltip/t9n/messages.zh-TW.json +1 -1
  109. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ar.json +1 -1
  110. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.bg.json +1 -1
  111. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.bs.json +1 -1
  112. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ca.json +1 -1
  113. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.cs.json +1 -1
  114. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.da.json +1 -1
  115. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.de.json +1 -1
  116. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.el.json +1 -1
  117. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.es.json +1 -1
  118. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.et.json +1 -1
  119. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.fi.json +1 -1
  120. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.fr.json +1 -1
  121. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.he.json +1 -1
  122. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.hr.json +1 -1
  123. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.hu.json +1 -1
  124. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.id.json +1 -1
  125. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.it.json +1 -1
  126. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ja.json +1 -1
  127. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ko.json +1 -1
  128. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.lt.json +1 -1
  129. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.lv.json +1 -1
  130. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.nl.json +1 -1
  131. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.no.json +1 -1
  132. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.pl.json +1 -1
  133. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.pt-BR.json +1 -1
  134. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.pt-PT.json +1 -1
  135. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ro.json +1 -1
  136. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ru.json +1 -1
  137. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sk.json +1 -1
  138. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sl.json +1 -1
  139. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sr.json +1 -1
  140. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sv.json +1 -1
  141. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.th.json +1 -1
  142. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.tr.json +1 -1
  143. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.uk.json +1 -1
  144. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.vi.json +1 -1
  145. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.zh-CN.json +1 -1
  146. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.zh-HK.json +1 -1
  147. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.zh-TW.json +1 -1
  148. package/assets/esri/widgets/Editor/t9n/messages.ar.json +1 -1
  149. package/assets/esri/widgets/Editor/t9n/messages.bg.json +1 -1
  150. package/assets/esri/widgets/Editor/t9n/messages.bs.json +1 -1
  151. package/assets/esri/widgets/Editor/t9n/messages.ca.json +1 -1
  152. package/assets/esri/widgets/Editor/t9n/messages.cs.json +1 -1
  153. package/assets/esri/widgets/Editor/t9n/messages.da.json +1 -1
  154. package/assets/esri/widgets/Editor/t9n/messages.de.json +1 -1
  155. package/assets/esri/widgets/Editor/t9n/messages.el.json +1 -1
  156. package/assets/esri/widgets/Editor/t9n/messages.es.json +1 -1
  157. package/assets/esri/widgets/Editor/t9n/messages.et.json +1 -1
  158. package/assets/esri/widgets/Editor/t9n/messages.fi.json +1 -1
  159. package/assets/esri/widgets/Editor/t9n/messages.fr.json +1 -1
  160. package/assets/esri/widgets/Editor/t9n/messages.he.json +1 -1
  161. package/assets/esri/widgets/Editor/t9n/messages.hr.json +1 -1
  162. package/assets/esri/widgets/Editor/t9n/messages.hu.json +1 -1
  163. package/assets/esri/widgets/Editor/t9n/messages.id.json +1 -1
  164. package/assets/esri/widgets/Editor/t9n/messages.it.json +1 -1
  165. package/assets/esri/widgets/Editor/t9n/messages.ja.json +1 -1
  166. package/assets/esri/widgets/Editor/t9n/messages.ko.json +1 -1
  167. package/assets/esri/widgets/Editor/t9n/messages.lt.json +1 -1
  168. package/assets/esri/widgets/Editor/t9n/messages.lv.json +1 -1
  169. package/assets/esri/widgets/Editor/t9n/messages.nl.json +1 -1
  170. package/assets/esri/widgets/Editor/t9n/messages.no.json +1 -1
  171. package/assets/esri/widgets/Editor/t9n/messages.pl.json +1 -1
  172. package/assets/esri/widgets/Editor/t9n/messages.pt-BR.json +1 -1
  173. package/assets/esri/widgets/Editor/t9n/messages.pt-PT.json +1 -1
  174. package/assets/esri/widgets/Editor/t9n/messages.ro.json +1 -1
  175. package/assets/esri/widgets/Editor/t9n/messages.ru.json +1 -1
  176. package/assets/esri/widgets/Editor/t9n/messages.sk.json +1 -1
  177. package/assets/esri/widgets/Editor/t9n/messages.sl.json +1 -1
  178. package/assets/esri/widgets/Editor/t9n/messages.sr.json +1 -1
  179. package/assets/esri/widgets/Editor/t9n/messages.sv.json +1 -1
  180. package/assets/esri/widgets/Editor/t9n/messages.th.json +1 -1
  181. package/assets/esri/widgets/Editor/t9n/messages.tr.json +1 -1
  182. package/assets/esri/widgets/Editor/t9n/messages.uk.json +1 -1
  183. package/assets/esri/widgets/Editor/t9n/messages.vi.json +1 -1
  184. package/assets/esri/widgets/Editor/t9n/messages.zh-CN.json +1 -1
  185. package/assets/esri/widgets/Editor/t9n/messages.zh-HK.json +1 -1
  186. package/assets/esri/widgets/Editor/t9n/messages.zh-TW.json +1 -1
  187. package/assets/esri/widgets/FeatureForm/t9n/messages.ar.json +1 -1
  188. package/assets/esri/widgets/FeatureForm/t9n/messages.bg.json +1 -1
  189. package/assets/esri/widgets/FeatureForm/t9n/messages.bs.json +1 -1
  190. package/assets/esri/widgets/FeatureForm/t9n/messages.ca.json +1 -1
  191. package/assets/esri/widgets/FeatureForm/t9n/messages.cs.json +1 -1
  192. package/assets/esri/widgets/FeatureForm/t9n/messages.da.json +1 -1
  193. package/assets/esri/widgets/FeatureForm/t9n/messages.de.json +1 -1
  194. package/assets/esri/widgets/FeatureForm/t9n/messages.el.json +1 -1
  195. package/assets/esri/widgets/FeatureForm/t9n/messages.es.json +1 -1
  196. package/assets/esri/widgets/FeatureForm/t9n/messages.et.json +1 -1
  197. package/assets/esri/widgets/FeatureForm/t9n/messages.fi.json +1 -1
  198. package/assets/esri/widgets/FeatureForm/t9n/messages.fr.json +1 -1
  199. package/assets/esri/widgets/FeatureForm/t9n/messages.he.json +1 -1
  200. package/assets/esri/widgets/FeatureForm/t9n/messages.hr.json +1 -1
  201. package/assets/esri/widgets/FeatureForm/t9n/messages.hu.json +1 -1
  202. package/assets/esri/widgets/FeatureForm/t9n/messages.id.json +1 -1
  203. package/assets/esri/widgets/FeatureForm/t9n/messages.it.json +1 -1
  204. package/assets/esri/widgets/FeatureForm/t9n/messages.ja.json +1 -1
  205. package/assets/esri/widgets/FeatureForm/t9n/messages.ko.json +1 -1
  206. package/assets/esri/widgets/FeatureForm/t9n/messages.lt.json +1 -1
  207. package/assets/esri/widgets/FeatureForm/t9n/messages.lv.json +1 -1
  208. package/assets/esri/widgets/FeatureForm/t9n/messages.nl.json +1 -1
  209. package/assets/esri/widgets/FeatureForm/t9n/messages.no.json +1 -1
  210. package/assets/esri/widgets/FeatureForm/t9n/messages.pl.json +1 -1
  211. package/assets/esri/widgets/FeatureForm/t9n/messages.pt-BR.json +1 -1
  212. package/assets/esri/widgets/FeatureForm/t9n/messages.pt-PT.json +1 -1
  213. package/assets/esri/widgets/FeatureForm/t9n/messages.ro.json +1 -1
  214. package/assets/esri/widgets/FeatureForm/t9n/messages.ru.json +1 -1
  215. package/assets/esri/widgets/FeatureForm/t9n/messages.sk.json +1 -1
  216. package/assets/esri/widgets/FeatureForm/t9n/messages.sl.json +1 -1
  217. package/assets/esri/widgets/FeatureForm/t9n/messages.sr.json +1 -1
  218. package/assets/esri/widgets/FeatureForm/t9n/messages.sv.json +1 -1
  219. package/assets/esri/widgets/FeatureForm/t9n/messages.th.json +1 -1
  220. package/assets/esri/widgets/FeatureForm/t9n/messages.tr.json +1 -1
  221. package/assets/esri/widgets/FeatureForm/t9n/messages.uk.json +1 -1
  222. package/assets/esri/widgets/FeatureForm/t9n/messages.vi.json +1 -1
  223. package/assets/esri/widgets/FeatureForm/t9n/messages.zh-CN.json +1 -1
  224. package/assets/esri/widgets/FeatureForm/t9n/messages.zh-HK.json +1 -1
  225. package/assets/esri/widgets/FeatureForm/t9n/messages.zh-TW.json +1 -1
  226. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.ar.json +1 -1
  227. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.bg.json +1 -1
  228. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.bs.json +1 -1
  229. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.ca.json +1 -1
  230. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.cs.json +1 -1
  231. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.da.json +1 -1
  232. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.de.json +1 -1
  233. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.el.json +1 -1
  234. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.es.json +1 -1
  235. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.et.json +1 -1
  236. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.fi.json +1 -1
  237. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.fr.json +1 -1
  238. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.he.json +1 -1
  239. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.hr.json +1 -1
  240. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.hu.json +1 -1
  241. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.id.json +1 -1
  242. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.it.json +1 -1
  243. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.ja.json +1 -1
  244. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.ko.json +1 -1
  245. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.lt.json +1 -1
  246. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.lv.json +1 -1
  247. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.nl.json +1 -1
  248. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.no.json +1 -1
  249. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.pl.json +1 -1
  250. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.pt-BR.json +1 -1
  251. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.pt-PT.json +1 -1
  252. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.ro.json +1 -1
  253. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.ru.json +1 -1
  254. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.sk.json +1 -1
  255. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.sl.json +1 -1
  256. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.sr.json +1 -1
  257. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.sv.json +1 -1
  258. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.th.json +1 -1
  259. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.tr.json +1 -1
  260. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.uk.json +1 -1
  261. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.vi.json +1 -1
  262. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.zh-CN.json +1 -1
  263. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.zh-HK.json +1 -1
  264. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.zh-TW.json +1 -1
  265. package/assets/esri/widgets/Sketch/t9n/messages.ar.json +1 -1
  266. package/assets/esri/widgets/Sketch/t9n/messages.bg.json +1 -1
  267. package/assets/esri/widgets/Sketch/t9n/messages.bs.json +1 -1
  268. package/assets/esri/widgets/Sketch/t9n/messages.ca.json +1 -1
  269. package/assets/esri/widgets/Sketch/t9n/messages.cs.json +1 -1
  270. package/assets/esri/widgets/Sketch/t9n/messages.da.json +1 -1
  271. package/assets/esri/widgets/Sketch/t9n/messages.de.json +1 -1
  272. package/assets/esri/widgets/Sketch/t9n/messages.el.json +1 -1
  273. package/assets/esri/widgets/Sketch/t9n/messages.es.json +1 -1
  274. package/assets/esri/widgets/Sketch/t9n/messages.et.json +1 -1
  275. package/assets/esri/widgets/Sketch/t9n/messages.fi.json +1 -1
  276. package/assets/esri/widgets/Sketch/t9n/messages.fr.json +1 -1
  277. package/assets/esri/widgets/Sketch/t9n/messages.he.json +1 -1
  278. package/assets/esri/widgets/Sketch/t9n/messages.hr.json +1 -1
  279. package/assets/esri/widgets/Sketch/t9n/messages.hu.json +1 -1
  280. package/assets/esri/widgets/Sketch/t9n/messages.id.json +1 -1
  281. package/assets/esri/widgets/Sketch/t9n/messages.it.json +1 -1
  282. package/assets/esri/widgets/Sketch/t9n/messages.ja.json +1 -1
  283. package/assets/esri/widgets/Sketch/t9n/messages.ko.json +1 -1
  284. package/assets/esri/widgets/Sketch/t9n/messages.lt.json +1 -1
  285. package/assets/esri/widgets/Sketch/t9n/messages.lv.json +1 -1
  286. package/assets/esri/widgets/Sketch/t9n/messages.nl.json +1 -1
  287. package/assets/esri/widgets/Sketch/t9n/messages.no.json +1 -1
  288. package/assets/esri/widgets/Sketch/t9n/messages.pl.json +1 -1
  289. package/assets/esri/widgets/Sketch/t9n/messages.pt-BR.json +1 -1
  290. package/assets/esri/widgets/Sketch/t9n/messages.pt-PT.json +1 -1
  291. package/assets/esri/widgets/Sketch/t9n/messages.ro.json +1 -1
  292. package/assets/esri/widgets/Sketch/t9n/messages.ru.json +1 -1
  293. package/assets/esri/widgets/Sketch/t9n/messages.sk.json +1 -1
  294. package/assets/esri/widgets/Sketch/t9n/messages.sl.json +1 -1
  295. package/assets/esri/widgets/Sketch/t9n/messages.sr.json +1 -1
  296. package/assets/esri/widgets/Sketch/t9n/messages.sv.json +1 -1
  297. package/assets/esri/widgets/Sketch/t9n/messages.th.json +1 -1
  298. package/assets/esri/widgets/Sketch/t9n/messages.tr.json +1 -1
  299. package/assets/esri/widgets/Sketch/t9n/messages.uk.json +1 -1
  300. package/assets/esri/widgets/Sketch/t9n/messages.vi.json +1 -1
  301. package/assets/esri/widgets/Sketch/t9n/messages.zh-CN.json +1 -1
  302. package/assets/esri/widgets/Sketch/t9n/messages.zh-HK.json +1 -1
  303. package/assets/esri/widgets/Sketch/t9n/messages.zh-TW.json +1 -1
  304. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.ar.json +1 -1
  305. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.bg.json +1 -1
  306. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.bs.json +1 -1
  307. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.ca.json +1 -1
  308. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.cs.json +1 -1
  309. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.da.json +1 -1
  310. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.de.json +1 -1
  311. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.el.json +1 -1
  312. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.es.json +1 -1
  313. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.et.json +1 -1
  314. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.fi.json +1 -1
  315. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.fr.json +1 -1
  316. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.he.json +1 -1
  317. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.hr.json +1 -1
  318. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.hu.json +1 -1
  319. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.id.json +1 -1
  320. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.it.json +1 -1
  321. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.ja.json +1 -1
  322. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.ko.json +1 -1
  323. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.lt.json +1 -1
  324. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.lv.json +1 -1
  325. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.nl.json +1 -1
  326. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.no.json +1 -1
  327. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.pl.json +1 -1
  328. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.pt-BR.json +1 -1
  329. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.pt-PT.json +1 -1
  330. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.ro.json +1 -1
  331. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.ru.json +1 -1
  332. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.sk.json +1 -1
  333. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.sl.json +1 -1
  334. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.sr.json +1 -1
  335. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.sv.json +1 -1
  336. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.th.json +1 -1
  337. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.tr.json +1 -1
  338. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.uk.json +1 -1
  339. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.vi.json +1 -1
  340. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.zh-CN.json +1 -1
  341. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.zh-HK.json +1 -1
  342. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.zh-TW.json +1 -1
  343. package/config.d.ts +2 -0
  344. package/config.js +1 -1
  345. package/core/ObjectPool.js +1 -1
  346. package/core/PooledArray.js +1 -1
  347. package/core/accessorSupport/tracking/SimpleTrackingTarget.js +1 -1
  348. package/core/workers/WorkerOwner.js +1 -1
  349. package/core/workers/workerFactory.js +1 -1
  350. package/core/workers/workers.js +2 -2
  351. package/core/workers.d.ts +9 -0
  352. package/geometry/Mesh.js +1 -1
  353. package/geometry/support/buffer/BufferPool.js +1 -1
  354. package/geometry/support/coordsUtils.js +1 -1
  355. package/geometry/support/curves/bezierCurveUtils.js +1 -1
  356. package/geometry/support/curves/ellipticArc7Utils.js +1 -1
  357. package/geometry/support/meshUtils/rotate.js +1 -1
  358. package/kernel.js +1 -1
  359. package/layers/AnnotationFeatureLayer.d.ts +2 -2
  360. package/layers/AnnotationFeatureLayer.js +1 -1
  361. package/layers/CatalogLayer.d.ts +2 -2
  362. package/layers/CatalogLayer.js +1 -1
  363. package/layers/DimensionFeatureLayer.d.ts +2 -2
  364. package/layers/DimensionFeatureLayer.js +1 -1
  365. package/layers/FeatureLayer.d.ts +2 -2
  366. package/layers/FeatureLayer.js +1 -1
  367. package/layers/ImageryTileLayer.js +1 -1
  368. package/layers/LineOfSightLayer.d.ts +10 -8
  369. package/layers/SubtypeGroupLayer.d.ts +2 -2
  370. package/layers/SubtypeGroupLayer.js +1 -1
  371. package/layers/ViewshedLayer.d.ts +1 -1
  372. package/layers/geospatialPDF/GeospatialPDFFrame.js +1 -1
  373. package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +9 -9
  374. package/layers/geospatialPDF/GeospatialPDFWorkerClient.js +1 -1
  375. package/layers/geospatialPDF/LGIDictMapFrame.js +1 -1
  376. package/layers/geospatialPDF/ViewportMeasureFrame.js +1 -1
  377. package/layers/geospatialPDF/geospatialPDFParserUtils.js +1 -1
  378. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  379. package/layers/graphics/data/QueryEngineResult.js +1 -1
  380. package/layers/graphics/sources/parquet/FileProvider.js +1 -1
  381. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  382. package/layers/mixins/{FeatureLayerReload.d.ts → ReloadableLayer.d.ts} +5 -3
  383. package/layers/mixins/ReloadableLayer.js +2 -0
  384. package/layers/orientedImagery/core/coverageUtils.js +1 -1
  385. package/layers/raster/datasets/BaseRaster.js +1 -1
  386. package/layers/raster/datasets/GeospatialPDFRaster.js +1 -1
  387. package/layers/raster/datasets/ImageAuxRaster.js +2 -2
  388. package/layers/raster/datasets/ImageServerRaster.js +1 -1
  389. package/layers/raster/datasets/InMemoryRaster.js +1 -1
  390. package/layers/raster/datasets/MRFRaster.js +1 -1
  391. package/layers/raster/datasets/TIFFRaster.js +1 -1
  392. package/layers/raster/datasets/WCSRaster.js +1 -1
  393. package/layers/raster/formats/ImageCanvasDecoder.js +1 -1
  394. package/layers/raster/formats/RasterCodec.js +1 -1
  395. package/layers/raster/formats/TiffDecoder.js +1 -1
  396. package/layers/raster/formats/Zlib.js +1 -1
  397. package/layers/support/RasterWorker.js +1 -1
  398. package/layers/support/kmlUtils.js +1 -1
  399. package/package.json +2 -2
  400. package/popup/FeatureModel.js +1 -1
  401. package/popup/FeaturesModel.js +1 -1
  402. package/request/process.js +1 -1
  403. package/request/types.d.ts +7 -0
  404. package/smartMapping/statistics/support/statsWorker.js +1 -1
  405. package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
  406. package/smartMapping/support/adapters/InMemoryLayerAdapter.js +1 -1
  407. package/smartMapping/support/adapters/OGCFeatureLayerAdapter.js +1 -1
  408. package/smartMapping/support/adapters/SceneLayerAdapter.js +1 -1
  409. package/smartMapping/support/adapters/support/utils.js +1 -1
  410. package/symbols/support/ElevationInfo.d.ts +4 -3
  411. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  412. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueBackground.js +1 -1
  413. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueFill.js +1 -1
  414. package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
  415. package/views/3d/analysis/LineOfSight/LineOfSightItemTool.js +1 -1
  416. package/views/3d/analysis/LineOfSight/LineOfSightPlacementController.js +1 -1
  417. package/views/3d/analysis/LineOfSight/{LineOfSightRootPlugin.js → LineOfSightPlacementRootPlugin.js} +1 -1
  418. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  419. package/views/3d/analysis/LineOfSight/types.d.ts +14 -3
  420. package/views/3d/analysis/LineOfSightAnalysisView3D.d.ts +39 -13
  421. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  422. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  423. package/views/3d/analysis/Viewshed/types.d.ts +7 -0
  424. package/views/3d/analysis/ViewshedAnalysisView3D.d.ts +43 -15
  425. package/views/3d/interactive/editingTools/ManipulatedObject3DGraphic.js +1 -1
  426. package/views/3d/support/MemoryController.js +1 -1
  427. package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
  428. package/views/3d/webgl-engine/effects/geometry/RenderOccluded.js +1 -1
  429. package/views/interactive/options/TooltipOptions.d.ts +2 -0
  430. package/views/interactive/sketch/SketchTooltipOptions.d.ts +2 -0
  431. package/views/layers/LineOfSightLayerView.d.ts +35 -13
  432. package/views/layers/SketchLayerView.d.ts +1 -0
  433. package/views/layers/ViewshedLayerView.d.ts +36 -12
  434. package/widgets/BatchAttributeForm/inputs/support/DynamicChoiceController.js +1 -1
  435. package/widgets/HistogramRangeSlider.d.ts +2 -2
  436. package/widgets/HistogramRangeSlider.js +1 -1
  437. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  438. package/widgets/OrientedImageryViewer.js +2 -2
  439. package/widgets/PanoramicViewer/PanoramicVideoViewerViewModel.js +1 -1
  440. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.d.ts +5 -2
  441. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
  442. package/widgets/ScaleRangeSlider.js +1 -1
  443. package/widgets/ValuePicker/ValuePickerBaseComponent.d.ts +5 -1
  444. package/widgets/ValuePicker/ValuePickerCollection.d.ts +2 -0
  445. package/widgets/ValuePicker/ValuePickerCombobox.d.ts +7 -1
  446. package/widgets/ValuePicker/ValuePickerLabel.d.ts +7 -1
  447. package/widgets/ValuePicker/ValuePickerSlider.d.ts +2 -0
  448. package/widgets/ValuePicker/ValuePickerSliderVisibleElements.d.ts +5 -1
  449. package/widgets/ValuePicker/ValuePickerVisibleElements.d.ts +5 -1
  450. package/widgets/ValuePicker/types.d.ts +2 -0
  451. package/assets/esri/core/workers/chunks/03261b9451e293a0fac8.js +0 -1
  452. package/assets/esri/core/workers/chunks/0ad0484ffcbe4ad21bd3.js +0 -1
  453. package/assets/esri/core/workers/chunks/19743dedaa40446259ec.js +0 -1
  454. package/assets/esri/core/workers/chunks/1c65ab9ed611c322ce27.js +0 -1
  455. package/assets/esri/core/workers/chunks/1f339247b68b061ab0a4.js +0 -1
  456. package/assets/esri/core/workers/chunks/251921cd10ecfbc89451.js +0 -1
  457. package/assets/esri/core/workers/chunks/3252b1fae363bb0129a0.js +0 -1
  458. package/assets/esri/core/workers/chunks/408e81c8f1eff8a7b379.js +0 -1
  459. package/assets/esri/core/workers/chunks/50036a323c2e7f155311.js +0 -1
  460. package/assets/esri/core/workers/chunks/55dcbf296d8d0092e473.js +0 -1
  461. package/assets/esri/core/workers/chunks/59b216b60464611742d4.js +0 -1
  462. package/assets/esri/core/workers/chunks/5bfea0c55aca826de536.js +0 -1
  463. package/assets/esri/core/workers/chunks/60d3056a31d982c9cad0.js +0 -1
  464. package/assets/esri/core/workers/chunks/6558488ea96620439f34.js +0 -1
  465. package/assets/esri/core/workers/chunks/6aebf7cfd294e88bf926.js +0 -1
  466. package/assets/esri/core/workers/chunks/6b43bb78f9839ed43135.js +0 -1
  467. package/assets/esri/core/workers/chunks/6c83398cf586ecea0eb1.js +0 -1
  468. package/assets/esri/core/workers/chunks/7267b17de212207142c9.js +0 -1
  469. package/assets/esri/core/workers/chunks/88c74f3316f1fc253207.js +0 -1
  470. package/assets/esri/core/workers/chunks/912080c90b5cc2e817cf.js +0 -1
  471. package/assets/esri/core/workers/chunks/a97d85774f9a417202df.js +0 -1
  472. package/assets/esri/core/workers/chunks/aff32980d91dab07dfb7.js +0 -1
  473. package/assets/esri/core/workers/chunks/b1b4066e8d1c0c9656e5.js +0 -1
  474. package/assets/esri/core/workers/chunks/b6ba66a05030d3815dfd.js +0 -1
  475. package/assets/esri/core/workers/chunks/bbec9d2e3b75a5c59681.js +0 -1
  476. package/assets/esri/core/workers/chunks/bf69024804ac51c8f733.js +0 -1
  477. package/assets/esri/core/workers/chunks/c1254cd131a62750ff6f.js +0 -1
  478. package/assets/esri/core/workers/chunks/d938987344bce83cc660.js +0 -1
  479. package/assets/esri/core/workers/chunks/db1ab9b9c8bf5c7635d3.js +0 -1
  480. package/assets/esri/core/workers/chunks/de02a6a1f4810f99e9bb.js +0 -1
  481. package/assets/esri/core/workers/chunks/f4f9d08b2df856e3b694.js +0 -1
  482. package/assets/esri/core/workers/chunks/fd9663952d5a94f3a83f.js +0 -1
  483. package/layers/mixins/FeatureLayerReload.js +0 -2
  484. /package/views/3d/analysis/LineOfSight/{lineOfSightPlacementUtils.js → placementUtils.js} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../config.js";import{id as t}from"../../kernel.js";import n from"../../PopupTemplate.js";import r from"../../request.js";import{clone as i}from"../../core/lang.js";import{addQueryParameters as a}from"../../core/urlUtils.js";import o from"../../geometry/SpatialReference.js";import{create as s,expandWithAABB as c,equals as l,negativeInfinity as u}from"../../geometry/support/aaBoundingBox.js";import{getBoundsXYZ as d}from"../../geometry/support/boundsUtils.js";import{fromJSON as f}from"../../renderers/support/jsonUtils.js";import p from"../../rest/support/FeatureSet.js";const m={esriGeometryPoint:`points`,esriGeometryPolyline:`polylines`,esriGeometryPolygon:`polygons`};function h(e){let t=e.folders||[],n=t.slice(),r=new Map,a=new Map,o=new Map,s=new Map,c=new Map,l={esriGeometryPoint:a,esriGeometryPolyline:o,esriGeometryPolygon:s};return(e.featureCollection?.layers||[]).forEach(e=>{let t=i(e);t.featureSet.features=[];let n=e.featureSet.geometryType;r.set(n,t);let c=e.layerDefinition.objectIdField;n===`esriGeometryPoint`?v(a,c,e.featureSet.features):n===`esriGeometryPolyline`?v(o,c,e.featureSet.features):n===`esriGeometryPolygon`&&v(s,c,e.featureSet.features)}),e.groundOverlays&&e.groundOverlays.forEach(e=>{c.set(e.id,e)}),t.forEach(t=>{t.networkLinkIds.forEach(r=>{let i=b(r,t.id,e.networkLinks);i&&n.push(i)})}),n.forEach(e=>{if(e.featureInfos){e.points=i(r.get(`esriGeometryPoint`)),e.polylines=i(r.get(`esriGeometryPolyline`)),e.polygons=i(r.get(`esriGeometryPolygon`)),e.mapImages=[];for(let t of e.featureInfos)switch(t.type){case`esriGeometryPoint`:case`esriGeometryPolyline`:case`esriGeometryPolygon`:{let n=l[t.type].get(t.id);n&&e[m[t.type]]?.featureSet.features.push(n);break}case`GroundOverlay`:{let n=c.get(t.id);n&&e.mapImages.push(n);break}}e.fullExtent=S([e])}}),{folders:t,sublayers:n,extent:S(n)}}function g(n,i,o,s){let c=t?.findCredential(n);n=a(n,{token:c?.token});let l=e.kmlServiceUrl;return r(l,{query:{url:n,model:`simple`,folders:``,refresh:o!==0||void 0,outSR:JSON.stringify(i)},responseType:`json`,signal:s})}function _(e,t,n=null,r=[]){let i=[],a={},o=t.sublayers,s=new Set(t.folders.map(e=>e.id));return o.forEach(t=>{let o=new e;if(n?o.read(t,n):o.read(t),r.length&&s.has(o.id)&&(o.visible=r.includes(o.id)),a[t.id]=o,t.parentFolderId!=null&&t.parentFolderId!==-1){let e=a[t.parentFolderId];e.sublayers||=[],e.sublayers?.unshift(o)}else i.unshift(o)}),i}function v(e,t,n){n.forEach(n=>{e.set(n.attributes[t],n)})}function y(e,t){let n;return t.some(t=>t.id===e&&(n=t,!0)),n}function b(e,t,n){let r=y(e,n);return r&&(r.parentFolderId=t,r.networkLink=r),r}async function x(e,t,r,i){let a=e[t];if(!a)return[];let o=p.fromJSON(a.featureSet).features,s=a.layerDefinition,c=f(s.drawingInfo.renderer),l=n.fromJSON(a.popupInfo),u=[];for(let e of o)e.symbol=await c.getSymbolAsync(e),e.popupTemplate=l,e.visible=!0,e.origin=r.sublayerById.get(i).origin,u.push(e);return u}function S(e){let t=s(u),n=s(u);for(let r of e){if(r.polygons?.featureSet?.features)for(let e of r.polygons.featureSet.features)d(t,e.geometry),c(n,t);if(r.polylines?.featureSet?.features)for(let e of r.polylines.featureSet.features)d(t,e.geometry),c(n,t);if(r.points?.featureSet?.features)for(let e of r.points.featureSet.features)d(t,e.geometry),c(n,t);if(r.mapImages)for(let e of r.mapImages)d(t,e.extent),c(n,t)}return l(n,u)?void 0:{xmin:n[0],ymin:n[1],zmin:n[2],xmax:n[3],ymax:n[4],zmax:n[5],spatialReference:o.WGS84}}export{S as computeExtent,g as fetchService,x as getGraphics,h as parseKML,_ as sublayersFromJSON};
2
+ import e from"../../config.js";import{id as t}from"../../kernel.js";import n from"../../PopupTemplate.js";import r from"../../request.js";import{clone as i}from"../../core/lang.js";import{addQueryParameters as a}from"../../core/urlUtils.js";import o from"../../geometry/SpatialReference.js";import{create as s,negativeInfinity as c,expandWithAABB as l,equals as u}from"../../geometry/support/aaBoundingBox.js";import{getBoundsXYZ as d}from"../../geometry/support/boundsUtils.js";import{fromJSON as f}from"../../renderers/support/jsonUtils.js";import p from"../../rest/support/FeatureSet.js";const m={esriGeometryPoint:`points`,esriGeometryPolyline:`polylines`,esriGeometryPolygon:`polygons`};function h(e){let t=e.folders||[],n=t.slice(),r=new Map,a=new Map,o=new Map,s=new Map,c=new Map,l={esriGeometryPoint:a,esriGeometryPolyline:o,esriGeometryPolygon:s};return(e.featureCollection?.layers||[]).forEach(e=>{let t=i(e);t.featureSet.features=[];let n=e.featureSet.geometryType;r.set(n,t);let c=e.layerDefinition.objectIdField;n===`esriGeometryPoint`?v(a,c,e.featureSet.features):n===`esriGeometryPolyline`?v(o,c,e.featureSet.features):n===`esriGeometryPolygon`&&v(s,c,e.featureSet.features)}),e.groundOverlays&&e.groundOverlays.forEach(e=>{c.set(e.id,e)}),t.forEach(t=>{t.networkLinkIds.forEach(r=>{let i=b(r,t.id,e.networkLinks);i&&n.push(i)})}),n.forEach(e=>{if(e.featureInfos){e.points=i(r.get(`esriGeometryPoint`)),e.polylines=i(r.get(`esriGeometryPolyline`)),e.polygons=i(r.get(`esriGeometryPolygon`)),e.mapImages=[];for(let t of e.featureInfos)switch(t.type){case`esriGeometryPoint`:case`esriGeometryPolyline`:case`esriGeometryPolygon`:{let n=l[t.type].get(t.id);n&&e[m[t.type]]?.featureSet.features.push(n);break}case`GroundOverlay`:{let n=c.get(t.id);n&&e.mapImages.push(n);break}}e.fullExtent=S([e])}}),{folders:t,sublayers:n,extent:S(n)}}function g(n,i,o,s){let c=t?.findCredential(n);n=a(n,{token:c?.token});let l=e.kmlServiceUrl;return r(l,{query:{url:n,model:`simple`,folders:``,refresh:o!==0||void 0,outSR:JSON.stringify(i)},responseType:`json`,signal:s})}function _(e,t,n=null,r=[]){let i=[],a={},o=t.sublayers,s=new Set(t.folders.map(e=>e.id));return o.forEach(t=>{let o=new e;if(n?o.read(t,n):o.read(t),r.length&&s.has(o.id)&&(o.visible=r.includes(o.id)),a[t.id]=o,t.parentFolderId!=null&&t.parentFolderId!==-1){let e=a[t.parentFolderId];e.sublayers||=[],e.sublayers?.unshift(o)}else i.unshift(o)}),i}function v(e,t,n){n.forEach(n=>{e.set(n.attributes[t],n)})}function y(e,t){let n;return t.some(t=>t.id===e&&(n=t,!0)),n}function b(e,t,n){let r=y(e,n);return r&&(r.parentFolderId=t,r.networkLink=r),r}async function x(e,t,r,i){let a=e[t];if(!a)return[];let o=p.fromJSON(a.featureSet).features,s=a.layerDefinition,c=f(s.drawingInfo.renderer),l=n.fromJSON(a.popupInfo),u=[];for(let e of o)e.symbol=await c.getSymbolAsync(e),e.popupTemplate=l,e.visible=!0,e.origin=r.sublayerById.get(i).origin,u.push(e);return u}function S(e){let t=s(c),n=s(c);for(let r of e){if(r.polygons?.featureSet?.features)for(let e of r.polygons.featureSet.features)d(t,e.geometry),l(n,t);if(r.polylines?.featureSet?.features)for(let e of r.polylines.featureSet.features)d(t,e.geometry),l(n,t);if(r.points?.featureSet?.features)for(let e of r.points.featureSet.features)d(t,e.geometry),l(n,t);if(r.mapImages)for(let e of r.mapImages)d(t,e.extent),l(n,t)}return u(n,c)?void 0:{xmin:n[0],ymin:n[1],zmin:n[2],xmax:n[3],ymax:n[4],zmax:n[5],spatialReference:o.WGS84}}export{S as computeExtent,g as fetchService,x as getGraphics,h as parseKML,_ as sublayersFromJSON};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "5.2.0-next.155",
3
+ "version": "5.2.0-next.157",
4
4
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
5
5
  "keywords": [
6
6
  "ArcGIS",
@@ -20,7 +20,7 @@
20
20
  "license": "SEE LICENSE IN LICENSE.md",
21
21
  "dependencies": {
22
22
  "@amcharts/amcharts5": "~5.20.8",
23
- "@arcgis/toolkit": "5.2.0-next.155",
23
+ "@arcgis/toolkit": "5.2.0-next.157",
24
24
  "@esri/arcgis-html-sanitizer": "~4.2.0-next.2",
25
25
  "@esri/calcite-components": "^5.2.0-next.89",
26
26
  "@vaadin/grid": "~25.3.2",
@@ -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{FeatureSetQueryInterceptor as n}from"../arcade/featureset/support/FeatureSetQueryInterceptor.js";import r from"../core/Accessor.js";import{isSome as i}from"../core/arrayUtils.js";import{createTask as a}from"../core/asyncUtils.js";import{IdentifiableMixin as o}from"../core/Identifiable.js";import s from"../core/Logger.js";import{abortMaybe as c}from"../core/maybe.js";import{eachAlways as l,isAbortError as u,throwIfAborted as d}from"../core/promiseUtils.js";import{watch as f,initial as p,when as m}from"../core/reactiveUtils.js";import{throttle as h}from"../core/throttle.js";import{property as g,subclass as _}from"../core/accessorSupport/decorators.js";import v from"../geometry/Point.js";import y from"../geometry/SpatialReference.js";import{ActionsCollection as b,createDefaultAggregateActions as x,createDefaultActions as S}from"./actions.js";import C from"./content/TextContent.js";import{compileExpressionInfos as w,formatArcadeValue as T}from"./support/arcadeFeatureUtils.js";import E from"./support/FeatureAbilities.js";import{preLayerQueryCallback as D,preRequestCallback as O,getPopupLayer as k,createFieldInfoMap as A,getAllFieldInfos as j,querySourceLayer as M,queryUpdatedFeature as N,isRelatableFeatureSupportedLayer as P,isAssociatedFeatureSupportedLayer as F,formatEditInfo as I,substituteFieldsInLinksAndAttributes as L,graphicCallback as R,formatAttributes as z,isRelatedField as B}from"./support/featureUtils.js";import{queryLayerInfos as V,queryRelatedFeatures as H,setRelatedFeatures as U,getRelatedFieldInfo as W,createRelatedInfo as G,updateRelatedInfo as K}from"./support/relatedFeatureUtils.js";import{system as q}from"../time/constants.js";var J;let Y=class extends o(r){static{J=this}constructor(e){super(e),this._error=null,this._graphicChangedTask=null,this._evaluateExpressionAttributesTask=null,this._graphicExpressionAttributes=null,this.abilities=new E,this.content=null,this.description=null,this.actions=new b,this.includeDefaultActions=!1,this.defaultPopupTemplateEnabled=!1,this.expressionAttributes=null,this.formattedAttributes=null,this.graphic=null,this.lastEditInfo=null,this.location=null,this.relatedInfos=new Map,this.heading=``,this.view=null,this._graphicChangedThrottled=h(this._graphicChanged,()=>this.notifyChange(`waitingForContent`),1,this),this._isAllowedContentType=e=>{let{abilities:t}=this;return e.type===`attachments`&&!!t.attachmentsContent||e.type===`custom`&&!!t.customContent||e.type===`fields`&&!!t.fieldsContent||e.type===`media`&&!!t.mediaContent||e.type===`text`&&!!t.textContent||e.type===`expression`&&!!t.expressionContent||e.type===`relationship`&&!!t.relationshipContent||e.type===`utility-network-associations`&&!!t.utilityNetworkAssociationsContent},this._evaluateExpressionAttributesThrottled=h(this._evaluateExpressionAttributes,()=>this.notifyChange(`waitingForContent`),1,this),this.addHandles([f(()=>[this._effectivePopupTemplate,this.abilities.attachmentsContent,this.abilities.chartAnimation,this.abilities.customContent,this.abilities.expressionContent,this.abilities.fieldsContent,this.abilities.mediaContent,this.abilities.relationshipContent,this.abilities.textContent,this.abilities.utilityNetworkAssociationsContent,this.graphic,this.timeZone],()=>this._graphicChangedThrottled(),p),m(()=>{if(!this._graphicChangedTask?.finished||this._graphicChangedTask.value==null)return null;let e=this._graphicChangedTask.value,t=e?.expressionInfos?.dependencies;return[e,t?.has(`view-scale`)?this.view?.scale:null,t?.has(`view-time-extent`)?this.view?.timeExtent?.start:null,t?.has(`view-time-extent`)?this.view?.timeExtent?.end:null]},([e])=>this._evaluateExpressionAttributesThrottled(e))])}initialize(){this.addHandles([this._graphicChangedThrottled,this._evaluateExpressionAttributesThrottled])}destroy(){this._clear(),this._graphicChangedTask=c(this._graphicChangedTask),this._evaluateExpressionAttributesTask=c(this._evaluateExpressionAttributesTask),this._error=null,this.graphic=null,this.relatedInfos.clear()}static{this.interceptor=new n(D,O)}get _effectivePopupTemplate(){return this.graphic?.getEffectivePopupTemplate(this.defaultPopupTemplateEnabled)??null}get _fieldInfoMap(){let e=k(this.graphic);return A(j(this._effectivePopupTemplate),e)}get defaultActions(){let e=this._get(`defaultActions`)||new b;return e.removeAll(),e.addMany(this.graphic?.isAggregate?x():S()),e}get allActions(){let e=this._get(`allActions`)||new b,{actions:t,defaultPopupTemplateEnabled:n,includeDefaultActions:r,graphic:a}=this,o=[];if(a){let e=r?this.defaultActions.concat(t):t,s=typeof a.getEffectivePopupTemplate==`function`&&a.getEffectivePopupTemplate(n)||a.popupTemplate,c=s?.actions;o=(s?.overwriteActions?c:c?.concat(e)??e)?.filter(i).toArray()??[]}let s=e.toArray();return(s.length!==o.length||s.some((e,t)=>e!==o[t]))&&(e.removeAll(),e.addMany(o)),e}get isFeatureFromTable(){return k(this.graphic)?.isTable??!1}get state(){return this.graphic?this._error?`error`:this.waitingForContent?`loading`:`ready`:`disabled`}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override(`spatialReference`,e)}get timeZone(){return this.view?.timeZone??q}set timeZone(e){this._overrideIfSome(`timeZone`,e)}get map(){return this.view?.map||null}set map(e){this._override(`map`,e)}get waitingForContent(){let{_graphicChangedThrottled:e,_evaluateExpressionAttributesThrottled:t,_graphicChangedTask:n,_evaluateExpressionAttributesTask:r}=this;return e.hasPendingUpdates()||t.hasPendingUpdates()||n!=null&&!n.finished||r!=null&&!r.finished}async updateGeometry(){let{graphic:e,spatialReference:t}=this,n=k(e);await n?.load();let r=n?.objectIdField;if(!r||!e)return;let i=e.attributes?.[r];if(i==null)return;let a=(await M({layer:n,graphic:e,outFields:[],objectIds:[i],returnGeometry:!0,spatialReference:t}))?.geometry;a&&(e.geometry=a)}_clear(){this._set(`heading`,``),this._set(`content`,null),this._set(`formattedAttributes`,null),this._set(`expressionAttributes`,null)}_graphicChanged(){this._evaluateExpressionAttributesTask=c(this._evaluateExpressionAttributesTask),this._graphicChangedTask=c(this._graphicChangedTask),this._graphicChangedTask=a(async e=>{this._error=null,this._clear();let{graphic:t}=this;try{if(!t)return null;let{_effectivePopupTemplate:n}=this,r=k(t),i=this.spatialReference;await N({graphic:t,popupTemplate:n,layer:r,spatialReference:i},{signal:e});let[{value:a},{value:o}]=await l([this._getContent(),this._getTitle()]),[,{value:s}]=await l([this._checkForRelatedFeatures({signal:e}),w(n?.expressionInfos,t)]);return{expressionInfos:s,content:a,heading:o}}catch(e){throw u(e)||(this._error=e,s.getLogger(this).error(`error`,`The popupTemplate could not be displayed for this feature.`,{error:e,graphic:t,popupTemplate:this._effectivePopupTemplate})),e}})}_compileContentElement(e){let t=k(this.graphic);return e.type===`relationship`?P(t)?e:void 0:e.type===`utility-network-associations`?F(t)?e:void 0:e}_compileContent(e){if(this.graphic)return Array.isArray(e)?e.filter(this._isAllowedContentType).map(e=>this._compileContentElement(e)).filter(i):typeof e==`string`?new C({text:e}).text:e}_compileLastEditInfo(){let{_effectivePopupTemplate:e,graphic:t,timeZone:n}=this,r=k(t);if(!e)return;let{lastEditInfoEnabled:i}=e,a=r?.editFieldsInfo;if(i&&a)return I(a,t?.attributes,n,r)}_compileHeading(e){let{_fieldInfoMap:t,graphic:n,expressionAttributes:r}=this,i=k(n),a=n?.attributes??{},o=this.formattedAttributes?.global??{};return L({attributes:a,fieldInfoMap:t,globalAttributes:o,expressionAttributes:r,layer:i,text:e})}async _getTitle(){let{_effectivePopupTemplate:e,graphic:t}=this;return t?R({type:`title`,value:e?.title,event:{graphic:t}}):null}async _getContent(){let{_effectivePopupTemplate:e,graphic:t}=this;return t?R({type:`content`,value:e?.content,event:{graphic:t}}):null}_evaluateExpressionAttributes({heading:e,content:t,expressionInfos:n}){this._evaluateExpressionAttributesTask=c(this._evaluateExpressionAttributesTask),this._evaluateExpressionAttributesTask=a(async r=>{let{graphic:i,map:a,view:o,spatialReference:c,location:l}=this;try{if(!i)return;let s;if(n!=null){let e=[];for(let[t,s]of n.expressions.entries())s==null?e.push(Promise.resolve([t,void 0])):e.push(s.evaluate({graphic:i,interceptor:J.interceptor,location:l,map:a,options:{signal:r},spatialReference:c,view:o}).then(e=>[t,typeof e==`string`?T(e):e]).catch(()=>[t,void 0]));s=Object.fromEntries(await Promise.all(e)),d(r)}this._set(`expressionAttributes`,s??null),this._graphicExpressionAttributes={...i.attributes,...s},this._set(`formattedAttributes`,this._createFormattedAttributes(t)),this._set(`heading`,this._compileHeading(e)),this._set(`lastEditInfo`,this._compileLastEditInfo()||null),this._set(`content`,this._compileContent(t)||null)}catch(e){u(e)||(this._error=e,s.getLogger(this).error(`error`,`The popupTemplate could not be displayed for this feature.`,{error:e,graphic:i,popupTemplate:this._effectivePopupTemplate}))}})}_createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:n}){let{_effectivePopupTemplate:r,graphic:i,relatedInfos:a,_fieldInfoMap:o,_graphicExpressionAttributes:s,timeZone:c}=this,l=k(i);n.content[t]=z({attributes:{...s,...e.attributes},fieldInfoMap:o,fieldInfos:r?.fieldInfos,graphic:i,layer:l,relatedInfos:a,timeZone:c})}_createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:n}){if(e.fieldInfos){let{graphic:r,relatedInfos:i,_fieldInfoMap:a,_graphicExpressionAttributes:o,timeZone:s}=this,c=k(r);n.content[t]=z({attributes:{...o,...e.attributes},fieldInfoMap:a,fieldInfos:e.fieldInfos,graphic:r,isContentFieldInfos:!0,layer:c,relatedInfos:i,timeZone:s})}}_createFormattedAttributes(e){let{_effectivePopupTemplate:t,graphic:n,relatedInfos:r,_fieldInfoMap:i,_graphicExpressionAttributes:a,timeZone:o}=this,s=k(n),c=t?.fieldInfos,l={global:z({attributes:a,fieldInfoMap:i,fieldInfos:c,graphic:n,layer:s,relatedInfos:r,timeZone:o}),content:[]};return Array.isArray(e)&&e.forEach((e,t)=>{e.type===`fields`&&this._createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:l}),e.type===`media`&&this._createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:l})}),l}_checkForRelatedFeatures(e){let{graphic:t,_effectivePopupTemplate:n}=this;return this._queryRelatedInfos(t,j(n),e)}async _queryRelatedInfos(e,t,n){let{relatedInfos:r}=this,i=k(e);r.clear();let a=await i?.associatedLayer?.load(n)??i;if(!a||!e||!t.filter(e=>!!e.fieldName&&B(e.fieldName))?.length)return;t.forEach(e=>this._configureRelatedInfo(e,a));let o=await V({relatedInfos:r,layer:a},n);Object.keys(o).forEach(e=>{let t=r.get(e.toString()),n=o[e]?.value;t&&n&&(t.layerInfo=n.data)});let s=await H({graphic:e,relatedInfos:r,layer:a},n);Object.keys(s).forEach(e=>{U(s[e]?.value,r.get(e.toString()))})}_configureRelatedInfo(e,t){let{relatedInfos:n}=this,r=W(e.fieldName||``);if(!r)return;let{layerId:i,fieldName:a}=r;if(!i)return;let o=n.get(i.toString())||G(i,t);o&&(K({relatedInfo:o,fieldName:a,fieldInfo:e}),this.relatedInfos.set(i,o))}};e([g()],Y.prototype,`_error`,void 0),e([g()],Y.prototype,`_graphicChangedTask`,void 0),e([g()],Y.prototype,`_evaluateExpressionAttributesTask`,void 0),e([g({readOnly:!0})],Y.prototype,`_effectivePopupTemplate`,null),e([g({readOnly:!0})],Y.prototype,`_fieldInfoMap`,null),e([g({type:E})],Y.prototype,`abilities`,void 0),e([g({readOnly:!0})],Y.prototype,`content`,void 0),e([g()],Y.prototype,`description`,void 0),e([g({type:b,readOnly:!0})],Y.prototype,`defaultActions`,null),e([g({type:b})],Y.prototype,`actions`,void 0),e([g()],Y.prototype,`includeDefaultActions`,void 0),e([g({type:b,readOnly:!0})],Y.prototype,`allActions`,null),e([g({type:Boolean})],Y.prototype,`defaultPopupTemplateEnabled`,void 0),e([g({readOnly:!0})],Y.prototype,`expressionAttributes`,void 0),e([g({readOnly:!0})],Y.prototype,`isFeatureFromTable`,null),e([g({readOnly:!0})],Y.prototype,`state`,null),e([g({readOnly:!0})],Y.prototype,`formattedAttributes`,void 0),e([g({type:t})],Y.prototype,`graphic`,void 0),e([g({readOnly:!0})],Y.prototype,`lastEditInfo`,void 0),e([g({type:v})],Y.prototype,`location`,void 0),e([g({readOnly:!0})],Y.prototype,`relatedInfos`,void 0),e([g({type:y})],Y.prototype,`spatialReference`,null),e([g()],Y.prototype,`timeZone`,null),e([g({readOnly:!0})],Y.prototype,`heading`,void 0),e([g()],Y.prototype,`map`,null),e([g({readOnly:!0})],Y.prototype,`waitingForContent`,null),e([g()],Y.prototype,`view`,void 0),Y=J=e([_(`esri.popup.FeatureModel`)],Y);const X=Y;export{X as default};
2
+ import{__decorate as e}from"tslib";import t from"../Graphic.js";import{FeatureSetQueryInterceptor as n}from"../arcade/featureset/support/FeatureSetQueryInterceptor.js";import r from"../core/Accessor.js";import{isSome as i}from"../core/arrayUtils.js";import{createTask as a}from"../core/asyncUtils.js";import{IdentifiableMixin as o}from"../core/Identifiable.js";import s from"../core/Logger.js";import{abortMaybe as c}from"../core/maybe.js";import{eachAlways as l,isAbortError as u,throwIfAborted as d}from"../core/promiseUtils.js";import{watch as f,initial as p,when as m}from"../core/reactiveUtils.js";import{throttle as h}from"../core/throttle.js";import{property as g,subclass as _}from"../core/accessorSupport/decorators.js";import v from"../geometry/Point.js";import y from"../geometry/SpatialReference.js";import{ActionsCollection as b,createDefaultAggregateActions as x,createDefaultActions as S}from"./actions.js";import C from"./content/TextContent.js";import{compileExpressionInfos as w,formatArcadeValue as T}from"./support/arcadeFeatureUtils.js";import E from"./support/FeatureAbilities.js";import{preLayerQueryCallback as D,preRequestCallback as O,getPopupLayer as k,createFieldInfoMap as A,getAllFieldInfos as j,querySourceLayer as M,queryUpdatedFeature as N,isRelatableFeatureSupportedLayer as P,isAssociatedFeatureSupportedLayer as F,formatEditInfo as I,substituteFieldsInLinksAndAttributes as L,graphicCallback as R,formatAttributes as z,isRelatedField as B}from"./support/featureUtils.js";import{queryLayerInfos as V,queryRelatedFeatures as H,setRelatedFeatures as U,getRelatedFieldInfo as W,createRelatedInfo as G,updateRelatedInfo as K}from"./support/relatedFeatureUtils.js";import{system as q}from"../time/constants.js";var J;let Y=class extends o(r){static{J=this}constructor(e){super(e),this._error=null,this._graphicChangedTask=null,this._evaluateExpressionAttributesTask=null,this._graphicExpressionAttributes=null,this.abilities=new E,this.content=null,this.description=null,this.actions=new b,this.includeDefaultActions=!1,this.defaultPopupTemplateEnabled=!1,this.expressionAttributes=null,this.formattedAttributes=null,this.graphic=null,this.lastEditInfo=null,this.location=null,this.relatedInfos=new Map,this.heading=``,this.view=null,this._graphicChangedThrottled=h(this._graphicChanged,()=>{this._evaluateExpressionAttributesThrottled.remove(),this._evaluateExpressionAttributesTask=c(this._evaluateExpressionAttributesTask),this._graphicChangedTask=c(this._graphicChangedTask),this.notifyChange(`waitingForContent`)},1,this),this._isAllowedContentType=e=>{let{abilities:t}=this;return e.type===`attachments`&&!!t.attachmentsContent||e.type===`custom`&&!!t.customContent||e.type===`fields`&&!!t.fieldsContent||e.type===`media`&&!!t.mediaContent||e.type===`text`&&!!t.textContent||e.type===`expression`&&!!t.expressionContent||e.type===`relationship`&&!!t.relationshipContent||e.type===`utility-network-associations`&&!!t.utilityNetworkAssociationsContent},this._evaluateExpressionAttributesThrottled=h(this._evaluateExpressionAttributes,()=>this.notifyChange(`waitingForContent`),1,this),this.addHandles([f(()=>[this._effectivePopupTemplate,this.abilities.attachmentsContent,this.abilities.chartAnimation,this.abilities.customContent,this.abilities.expressionContent,this.abilities.fieldsContent,this.abilities.mediaContent,this.abilities.relationshipContent,this.abilities.textContent,this.abilities.utilityNetworkAssociationsContent,this.graphic,this.timeZone],()=>this._graphicChangedThrottled(),p),m(()=>{if(!this._graphicChangedTask?.finished||this._graphicChangedTask.value==null)return null;let e=this._graphicChangedTask.value,t=e?.expressionInfos?.dependencies;return[e,t?.has(`view-scale`)?this.view?.scale:null,t?.has(`view-time-extent`)?this.view?.timeExtent?.start:null,t?.has(`view-time-extent`)?this.view?.timeExtent?.end:null]},([e])=>this._evaluateExpressionAttributesThrottled(e))])}initialize(){this.addHandles([this._graphicChangedThrottled,this._evaluateExpressionAttributesThrottled])}destroy(){this._clear(),this._graphicChangedTask=c(this._graphicChangedTask),this._evaluateExpressionAttributesTask=c(this._evaluateExpressionAttributesTask),this._error=null,this.graphic=null,this.relatedInfos.clear()}static{this.interceptor=new n(D,O)}get _effectivePopupTemplate(){return this.graphic?.getEffectivePopupTemplate(this.defaultPopupTemplateEnabled)??null}get _fieldInfoMap(){let e=k(this.graphic);return A(j(this._effectivePopupTemplate),e)}get defaultActions(){let e=this._get(`defaultActions`)||new b;return e.removeAll(),e.addMany(this.graphic?.isAggregate?x():S()),e}get allActions(){let e=this._get(`allActions`)||new b,{actions:t,defaultPopupTemplateEnabled:n,includeDefaultActions:r,graphic:a}=this,o=[];if(a){let e=r?this.defaultActions.concat(t):t,s=typeof a.getEffectivePopupTemplate==`function`&&a.getEffectivePopupTemplate(n)||a.popupTemplate,c=s?.actions;o=(s?.overwriteActions?c:c?.concat(e)??e)?.filter(i).toArray()??[]}let s=e.toArray();return(s.length!==o.length||s.some((e,t)=>e!==o[t]))&&(e.removeAll(),e.addMany(o)),e}get isFeatureFromTable(){return k(this.graphic)?.isTable??!1}get state(){return this.graphic?this._error?`error`:this.waitingForContent?`loading`:`ready`:`disabled`}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override(`spatialReference`,e)}get timeZone(){return this.view?.timeZone??q}set timeZone(e){this._overrideIfSome(`timeZone`,e)}get map(){return this.view?.map||null}set map(e){this._override(`map`,e)}get waitingForContent(){let{_graphicChangedThrottled:e,_evaluateExpressionAttributesThrottled:t,_graphicChangedTask:n,_evaluateExpressionAttributesTask:r}=this;return e.hasPendingUpdates()||t.hasPendingUpdates()||n!=null&&!n.finished||r!=null&&!r.finished}async updateGeometry(){let{graphic:e,spatialReference:t}=this,n=k(e);await n?.load();let r=n?.objectIdField;if(!r||!e)return;let i=e.attributes?.[r];if(i==null)return;let a=(await M({layer:n,graphic:e,outFields:[],objectIds:[i],returnGeometry:!0,spatialReference:t}))?.geometry;a&&(e.geometry=a)}_clear(){this._set(`heading`,``),this._set(`content`,null),this._set(`formattedAttributes`,null),this._set(`expressionAttributes`,null)}_graphicChanged(){this._graphicChangedTask=a(async e=>{this._error=null;let{graphic:t}=this;try{if(!t)return this._clear(),null;let{_effectivePopupTemplate:n}=this,r=k(t),i=this.spatialReference;await N({graphic:t,popupTemplate:n,layer:r,spatialReference:i},{signal:e});let[{value:a},{value:o}]=await l([this._getContent(),this._getTitle()]),[,{value:s}]=await l([this._checkForRelatedFeatures({signal:e}),w(n?.expressionInfos,t)]);return{expressionInfos:s,content:a,heading:o}}catch(n){throw!u(n)&&!e.aborted&&(this._clear(),this._error=n,s.getLogger(this).error(`error`,`The popupTemplate could not be displayed for this feature.`,{error:n,graphic:t,popupTemplate:this._effectivePopupTemplate})),n}})}_compileContentElement(e){let t=k(this.graphic);return e.type===`relationship`?P(t)?e:void 0:e.type===`utility-network-associations`?F(t)?e:void 0:e}_compileContent(e){if(this.graphic)return Array.isArray(e)?e.filter(this._isAllowedContentType).map(e=>this._compileContentElement(e)).filter(i):typeof e==`string`?new C({text:e}).text:e}_compileLastEditInfo(){let{_effectivePopupTemplate:e,graphic:t,timeZone:n}=this,r=k(t);if(!e)return;let{lastEditInfoEnabled:i}=e,a=r?.editFieldsInfo;if(i&&a)return I(a,t?.attributes,n,r)}_compileHeading(e){let{_fieldInfoMap:t,graphic:n,expressionAttributes:r}=this,i=k(n),a=n?.attributes??{},o=this.formattedAttributes?.global??{};return L({attributes:a,fieldInfoMap:t,globalAttributes:o,expressionAttributes:r,layer:i,text:e})}async _getTitle(){let{_effectivePopupTemplate:e,graphic:t}=this;return t?R({type:`title`,value:e?.title,event:{graphic:t}}):null}async _getContent(){let{_effectivePopupTemplate:e,graphic:t}=this;return t?R({type:`content`,value:e?.content,event:{graphic:t}}):null}_evaluateExpressionAttributes({heading:e,content:t,expressionInfos:n}){this._evaluateExpressionAttributesTask=c(this._evaluateExpressionAttributesTask),this._evaluateExpressionAttributesTask=a(async r=>{let{graphic:i,map:a,view:o,spatialReference:c,location:l}=this;try{if(!i)return;let s;if(n!=null){let e=[];for(let[t,s]of n.expressions.entries())s==null?e.push(Promise.resolve([t,void 0])):e.push(s.evaluate({graphic:i,interceptor:J.interceptor,location:l,map:a,options:{signal:r},spatialReference:c,view:o}).then(e=>[t,typeof e==`string`?T(e):e]).catch(()=>[t,void 0]));s=Object.fromEntries(await Promise.all(e)),d(r)}this._set(`expressionAttributes`,s??null),this._graphicExpressionAttributes={...i.attributes,...s},this._set(`formattedAttributes`,this._createFormattedAttributes(t)),this._set(`heading`,this._compileHeading(e)),this._set(`lastEditInfo`,this._compileLastEditInfo()||null),this._set(`content`,this._compileContent(t)||null)}catch(e){!u(e)&&!r.aborted&&(this._clear(),this._error=e,s.getLogger(this).error(`error`,`The popupTemplate could not be displayed for this feature.`,{error:e,graphic:i,popupTemplate:this._effectivePopupTemplate}))}})}_createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:n}){let{_effectivePopupTemplate:r,graphic:i,relatedInfos:a,_fieldInfoMap:o,_graphicExpressionAttributes:s,timeZone:c}=this,l=k(i);n.content[t]=z({attributes:{...s,...e.attributes},fieldInfoMap:o,fieldInfos:r?.fieldInfos,graphic:i,layer:l,relatedInfos:a,timeZone:c})}_createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:n}){if(e.fieldInfos){let{graphic:r,relatedInfos:i,_fieldInfoMap:a,_graphicExpressionAttributes:o,timeZone:s}=this,c=k(r);n.content[t]=z({attributes:{...o,...e.attributes},fieldInfoMap:a,fieldInfos:e.fieldInfos,graphic:r,isContentFieldInfos:!0,layer:c,relatedInfos:i,timeZone:s})}}_createFormattedAttributes(e){let{_effectivePopupTemplate:t,graphic:n,relatedInfos:r,_fieldInfoMap:i,_graphicExpressionAttributes:a,timeZone:o}=this,s=k(n),c=t?.fieldInfos,l={global:z({attributes:a,fieldInfoMap:i,fieldInfos:c,graphic:n,layer:s,relatedInfos:r,timeZone:o}),content:[]};return Array.isArray(e)&&e.forEach((e,t)=>{e.type===`fields`&&this._createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:l}),e.type===`media`&&this._createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:l})}),l}_checkForRelatedFeatures(e){let{graphic:t,_effectivePopupTemplate:n}=this;return this._queryRelatedInfos(t,j(n),e)}async _queryRelatedInfos(e,t,n){let{relatedInfos:r}=this,i=k(e);r.clear();let a=await i?.associatedLayer?.load(n)??i;if(!a||!e||!t.filter(e=>!!e.fieldName&&B(e.fieldName))?.length)return;t.forEach(e=>this._configureRelatedInfo(e,a));let o=await V({relatedInfos:r,layer:a},n);Object.keys(o).forEach(e=>{let t=r.get(e.toString()),n=o[e]?.value;t&&n&&(t.layerInfo=n.data)});let s=await H({graphic:e,relatedInfos:r,layer:a},n);Object.keys(s).forEach(e=>{U(s[e]?.value,r.get(e.toString()))})}_configureRelatedInfo(e,t){let{relatedInfos:n}=this,r=W(e.fieldName||``);if(!r)return;let{layerId:i,fieldName:a}=r;if(!i)return;let o=n.get(i.toString())||G(i,t);o&&(K({relatedInfo:o,fieldName:a,fieldInfo:e}),this.relatedInfos.set(i,o))}};e([g()],Y.prototype,`_error`,void 0),e([g()],Y.prototype,`_graphicChangedTask`,void 0),e([g()],Y.prototype,`_evaluateExpressionAttributesTask`,void 0),e([g({readOnly:!0})],Y.prototype,`_effectivePopupTemplate`,null),e([g({readOnly:!0})],Y.prototype,`_fieldInfoMap`,null),e([g({type:E})],Y.prototype,`abilities`,void 0),e([g({readOnly:!0})],Y.prototype,`content`,void 0),e([g()],Y.prototype,`description`,void 0),e([g({type:b,readOnly:!0})],Y.prototype,`defaultActions`,null),e([g({type:b})],Y.prototype,`actions`,void 0),e([g()],Y.prototype,`includeDefaultActions`,void 0),e([g({type:b,readOnly:!0})],Y.prototype,`allActions`,null),e([g({type:Boolean})],Y.prototype,`defaultPopupTemplateEnabled`,void 0),e([g({readOnly:!0})],Y.prototype,`expressionAttributes`,void 0),e([g({readOnly:!0})],Y.prototype,`isFeatureFromTable`,null),e([g({readOnly:!0})],Y.prototype,`state`,null),e([g({readOnly:!0})],Y.prototype,`formattedAttributes`,void 0),e([g({type:t})],Y.prototype,`graphic`,void 0),e([g({readOnly:!0})],Y.prototype,`lastEditInfo`,void 0),e([g({type:v})],Y.prototype,`location`,void 0),e([g({readOnly:!0})],Y.prototype,`relatedInfos`,void 0),e([g({type:y})],Y.prototype,`spatialReference`,null),e([g()],Y.prototype,`timeZone`,null),e([g({readOnly:!0})],Y.prototype,`heading`,void 0),e([g()],Y.prototype,`map`,null),e([g({readOnly:!0})],Y.prototype,`waitingForContent`,null),e([g()],Y.prototype,`view`,void 0),Y=J=e([_(`esri.popup.FeatureModel`)],Y);const X=Y;export{X 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/Error.js";import{EventedAccessor as n}from"../core/Evented.js";import r from"../core/Logger.js";import{abortMaybe as i}from"../core/maybe.js";import{debounce as a,logOnError as o,isAbortError as s}from"../core/promiseUtils.js";import{watch as c,when as l}from"../core/reactiveUtils.js";import{throttle as u}from"../core/throttle.js";import{property as d,subclass as f}from"../core/accessorSupport/decorators.js";import p from"../geometry/Point.js";import{project as m}from"../geometry/projectionUtils.js";import h from"../geometry/SpatialReference.js";import{geographicToWebMercator as g}from"../geometry/support/webMercatorUtils.js";import{getGraphicLayer as _}from"../graphic/graphicOriginUtils.js";import{fallbackObjectIDAttribute as v}from"../layers/LayerConstants.js";import{ActionsCollection as y,createDefaultActions as b}from"./actions.js";import{getSelectedTarget as x}from"./actionUtils.js";import S from"./FeatureModel.js";import C from"./support/FeatureAbilities.js";import{getDisplayedSymbol as w}from"../symbols/support/symbolUtils.js";import{system as T}from"../time/constants.js";import{highlightsSupported as E}from"../views/support/layerViewUtils.js";import{GoTo as D}from"../widgets/support/GoTo.js";const O=Symbol(`feature-stream-flush`);let k=null;function A(e,t){switch(e){case`building-scene`:case`map-image`:case`tile`:case`imagery`:return!0;case`imagery-tile`:return t===`2d`;default:return!1}}let j=class extends D(n){constructor(e){super(e),this._centerAtLocationController=null,this._locationUpdateController=null,this._highlightPromises={"highlight-active-feature":null,"highlight-selected-feature":null},this._defaultFeatureAbilities=new C,this._activeFeatureStream=null,this._featureStreamHasYielded=!1,this.actions=new y,this.activeFeature=null,this.aggregatedFeaturesEnabled=!1,this.defaultPopupTemplateEnabled=!1,this.diagnostics=null,this.featuresPerPage=20,this.featureMenuOpen=!1,this.featureItemAbilities=null,this.featureModels=[],this.heading=null,this.highlightEnabled=!0,this.includeDefaultActions=!0,this.open=!1,this.updateLocationEnabled=!1,this.view=null,this.zoomFactor=4,this._debouncedLocationUpdate=a(async()=>{this._cancelLocationUpdate();let e=new AbortController,{signal:t}=e;this._locationUpdateController=e,await this._locationUpdate({signal:t}).catch(()=>{}).finally(()=>{this._locationUpdateController===e&&(this._locationUpdateController=null)})})}initialize(){this.addHandles([c(()=>this.view?.scale,()=>{this.open&&o(this._debouncedLocationUpdate(),r.getLogger(this))}),c(()=>[this.highlightEnabled,this.selectedFeature,this.open,this.view],()=>this._highlightSelectedFeature()),c(()=>[this.highlightEnabled,this.activeFeature,this.open,this.view],()=>this._highlightActiveFeature()),c(()=>this.location,e=>this._locationChange(e)),c(()=>this.selectedFeature,e=>this._selectedFeatureChange(e)),c(()=>[this.featurePage,this.selectedFeatureIndex,this.featuresPerPage,this.featureMenuOpen,this.open,this.initialDisplayMode,this.featureItemAbilities?.attachmentsContent,this.featureItemAbilities?.chartAnimation,this.featureItemAbilities?.customContent,this.featureItemAbilities?.expressionContent,this.featureItemAbilities?.fieldsContent,this.featureItemAbilities?.mediaContent,this.featureItemAbilities?.relationshipContent,this.featureItemAbilities?.textContent,this.featureItemAbilities?.utilityNetworkAssociationsContent,this.actions,this.defaultPopupTemplateEnabled,this.includeDefaultActions,this.features,this.map,this.spatialReference,this.timeZone],()=>this._updateFeatureModels(),{initial:!0}),l(()=>!this.open,()=>this.aggregatedFeaturesEnabled=!1)])}destroy(){this._cancelLocationUpdate(),this._cancelCenterAtLocation(),this._cancelFeatureStream(),this._destroyFeatureModels(),this.aggregatedFeaturesEnabled=!1,this.view=null,this.map=null,this.spatialReference=null,this.timeZone=null}get defaultActions(){let e=this._get(`defaultActions`)||new y;return e.removeAll(),e.addMany(this.selectedFeatureItem?.defaultActions.toArray()??b()),e}get active(){return this.open&&!this.waitingForResult}set content(e){this.featureStream=null,this._set(`diagnostics`,null),this.features=[],this._set(`content`,e)}get effectiveHeading(){return this.selectedFeatureItem?.heading??this.heading}get featureCount(){return this.features.length}get featurePage(){return this._get(`featurePage`)}set featurePage(e){if(e==null){this.featureCount||this._set(`featurePage`,null);return}!Number.isInteger(e)||e<1||e>Math.ceil(this.featureCount/this.featuresPerPage)||e!==1&&e!==(this.featurePage??0)+1||this._set(`featurePage`,e)}set features(e){if(this._get(`features`)===e)return;let t=e||[];this._set(`features`,t),(!this._activeFeatureStream||!t.length||this.featurePage==null)&&(this.featurePage=t.length?1:null),this._syncSelectedFeatureIndex(t)}get featureStream(){return this._get(`featureStream`)||null}set featureStream(e){this._setFeatureStream(e)}_setFeatureStream(e,t,n){this._set(`diagnostics`,n??null),this._get(`featureStream`)!==e&&(this._set(`featureStream`,e),this._cancelFeatureStream(),e&&(this._featureStreamHasYielded=!1,this._set(`pendingLocation`,t??null),this._activeFeatureStream=e,this._consumeFeatureStream(e,t).catch(()=>{})))}get initialDisplayMode(){return this._initialDisplayMode??(this.view?.focusRegionVisible?`list`:`feature`)}set initialDisplayMode(e){this._initialDisplayMode=e,this._syncSelectedFeatureIndex(this.features)}set location(e){let t=e?.spatialReference?.isWGS84&&this.spatialReference?.isWebMercator?g(e):e;this._set(`location`,t)}get map(){return this.view?.map??null}set map(e){this._override(`map`,e)}get pendingLocation(){return this._get(`pendingLocation`)??null}get streamingFeatures(){return this._activeFeatureStream!=null}get selectedFeature(){return this.selectedFeatureIndex===-1?null:this.features[this.selectedFeatureIndex]??null}get selectedFeatureIndex(){let e=this._get(`selectedFeatureIndex`);return typeof e==`number`?e:-1}set selectedFeatureIndex(e){let{featureCount:t}=this;(isNaN(e)||e<0||!t)&&(e=-1),this.activeFeature=null,this._set(`selectedFeatureIndex`,e)}get selectedFeatureItem(){return this.featureModels[this.selectedFeatureIndex]||null}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override(`spatialReference`,e)}get state(){return this.view?this.view.ready?`ready`:`disabled`:this.map?`ready`:`disabled`}get timeZone(){return this.view?.timeZone??T}set timeZone(e){this._overrideIfSome(`timeZone`,e)}get waitingForContents(){return this.featureModels.some(e=>e.waitingForContent)}get waitingForResult(){return this.streamingFeatures&&!this._featureStreamHasYielded}zoomTo(e){return this.callGoTo(e)}clear(){this._cancelFeatureStream(),this._set(`diagnostics`,null),this.set({featureStream:null,features:[],content:null,heading:null,location:null,activeFeature:null})}openFeatureStream(e){this._setFeatureStream(e.featureStream,e.location??null,e.diagnostics),this.open=!0}async fetchFeatures(e,n){let{view:r}=this;if(!r||!e)throw new t(`fetch-features:invalid-screenpoint-or-view`,`Cannot fetch features without a screen point/screen area and view.`,{screenPoint:e,view:r});let i={},a=r.fetchPopupFeatures(e,{diagnostics:i,pointerType:n?.event?.pointerType,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:n?.signal});this._setFeatureStream(a,void 0,i)}next(){this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex+1,this.featureCount)}previous(){this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex-1,this.featureCount)}_syncSelectedFeatureIndex(e){let{selectedFeatureIndex:t}=this,n=this._activeFeatureStream!=null&&e.length>0;if(this.initialDisplayMode===`list`){n||(this.selectedFeatureIndex=-1);return}if(n&&t===-1){this.selectedFeatureIndex=0;return}n&&t!==-1||(this.selectedFeatureIndex=e.length?0:-1)}_centerAtLocation(){let{view:e}=this,n=x(this);this._cancelCenterAtLocation();let i=new AbortController,{signal:a}=i;return this._centerAtLocationController=i,!n||!e?Promise.reject(new t(`center-at-location:invalid-target-or-view`,`Cannot center at a location without a target and view.`,{target:n,view:e})):this.callGoTo({target:{target:n,scale:e.scale},options:{signal:a}}).catch(e=>{s(e)||r.getLogger(this).error(e)})}_getRoundRobinIndex(e,t){return(e+t)%t}_locationChange(e){let{selectedFeature:t,updateLocationEnabled:n,view:r}=this;r&&!this._locationUpdateController&&n&&e&&(!t||t.geometry)&&this._centerAtLocation()}async _selectedFeatureChange(e){let{location:t,updateLocationEnabled:n,view:r}=this;if(this.aggregatedFeaturesEnabled=!1,!e||!r)return;let i=_(e)?.type;if((i===`map-image`||i===`imagery`||i===`imagery-tile`)&&(e.symbol=await w(e)),(n||!t)&&e.geometry){if(e.geometry.type===`point`){this.location=e.geometry;return}let{labelPointExecute:t}=await import(`../geometry/operators/labelPointOperator.js`);this.location=t(e.geometry);return}if(n&&!e.geometry){await this._centerAtLocation();let e=r.center?.clone();e&&(this.location=e)}}_waitingForResultChange(){!this.featureCount&&this.featureStream&&(this.open=!1)}_destroyFeatureModels(){this.featureModels.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set(`featureModels`,[])}_reconcileFeatureModels(e){let t=[],n=new Map,r=[];if(this.featureModels.forEach((i,a)=>{let o=i?.graphic;!o||i.destroyed?i.destroy():e[a]===o?t[a]=i:(r.push(i),n.has(o)||n.set(o,[]))}),r.length){for(let r=e.length-1;r>=0;r--)t[r]||n.get(e[r])?.push(r);r.forEach(e=>{let r=n.get(e.graphic)?.pop();r==null?e.destroy():t[r]=e})}return t}_updateFeatureModels(){let{selectedFeature:e,features:t}=this;if(!t.length){this._destroyFeatureModels();return}let n={abilities:this.featureItemAbilities??this._defaultFeatureAbilities,actions:this.actions,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,includeDefaultActions:this.includeDefaultActions,spatialReference:this.spatialReference,location:this.location,map:this.map,view:this.view,timeZone:this.timeZone},r=this._reconcileFeatureModels(t);r.forEach(e=>e.set(n));let i=e=>{let i=t[e];i&&!r[e]&&(r[e]=new S({...n,graphic:i}))};if(e&&i(this.selectedFeatureIndex),(this.featurePage??0)>1||this.open&&(this.featureMenuOpen||this.initialDisplayMode===`list`)){let e=Math.min((this.featurePage??0)*this.featuresPerPage,t.length);for(let t=0;t<e;t++)i(t)}this._set(`featureModels`,r)}_cancelCenterAtLocation(){this._centerAtLocationController=i(this._centerAtLocationController)}_cancelFeatureStream(){this.removeHandles(O);let e=this._activeFeatureStream;this._activeFeatureStream=null,this._set(`pendingLocation`,null),this._get(`featureStream`)===e&&this._set(`featureStream`,null),e?.return&&e.return(void 0).catch(()=>{})}async _locationUpdate(e){let{spatialReference:t}=this,n=this.selectedFeature,i=n?.geometry?.type,a=this.location;if(i&&i!==`mesh`&&t&&a&&n){if(i===`point`){let{labelPointExecute:t}=await import(`../geometry/operators/labelPointOperator.js`);if(e?.signal?.aborted||this.selectedFeature!==n||!n.geometry)return;this.location=t(n.geometry);return}try{let r=n.geometry,i=this._getHighlightLayer(n),o=n.getObjectId();if(!i||!this.view)return;if(o!=null){let n=this.view?.allLayerViews.find(e=>e.layer.uid===i.uid);if(!n||!(`queryFeatures`in n))return;let a=n.createQuery();a.outSpatialReference=t,a.objectIds=[o],a.returnGeometry=!0;let{features:s}=await n.queryFeatures(a,e);if(e?.signal?.aborted)return;r=s[0]?.geometry}if(!r||r.type===`mesh`)return;r=m(r,t),k??=await Promise.all([import(`../geometry/operators/intersectsOperator.js`),import(`../geometry/operators/proximityOperator.js`)]);let[{intersectsExecute:s},{proximityGetNearestCoordinate:c}]=k;if(!s(r,a)){let e=c(r,a).coordinate??a;this.selectedFeature===n&&(this.location=e)}}catch(e){s(e)||r.getLogger(this).error(e)}}}_cancelLocationUpdate(){this._locationUpdateController=i(this._locationUpdateController)}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}_getHighlightLayer(e){let t=_(e),{layer:n}=e;return t&&`layer`in t&&t.layer?t.layer:t?.type===`map-notes`||t?.type===`sketch`||t?.type===`subtype-group`?t:n??t}_getHighlightLayerView(e,t){return t.type===`subtype-sublayer`&&t.parent&&this._mapIncludesLayer(t.parent)?this._getLayerView(e,t.parent):t&&this._mapIncludesLayer(t)?this._getLayerView(e,t):null}_getHighlightTarget(e,t,n){if(A(t.type,n))return e;let r=e.getObjectId();if(r!=null)return r;let i=t.type===`imagery`?void 0:`objectIdField`in t?t.objectIdField||v:null,a=e.attributes;return a&&i&&a[i]||e}_mapIncludesLayer(e){return!!this.map?.allLayers?.includes(e)}async _highlightFeature(e,t){this.removeHandles(e);let n=this[t];if(!n)return;let{highlightEnabled:r,view:i,open:a}=this;if(!i||!r||!a)return;let o=this._getHighlightLayer(n);if(!o)return;let s=this._getHighlightLayerView(i,o);if(!s)return;this._highlightPromises[e]=s;let c=await s;if(!c||!E(c)||this._highlightPromises[e]!==s||!this[t]||!this.highlightEnabled)return;let l=c.highlight(this._getHighlightTarget(n,o,i.type));this.addHandles(l,e)}async _highlightActiveFeature(){return this._highlightFeature(`highlight-active-feature`,`activeFeature`)}async _highlightSelectedFeature(){return this._highlightFeature(`highlight-selected-feature`,`selectedFeature`)}async _consumeFeatureStream(e,t){if(e!==this._activeFeatureStream)return;let n=[],r=u(()=>{let t=n;n=[],e===this._activeFeatureStream&&t.length&&this._addFeatures(t)},16);this.addHandles({remove:()=>{r.remove(),n=[]}},O);try{for await(let i of e){if(e!==this._activeFeatureStream)return;let a=!this._featureStreamHasYielded;a&&(this.features=[]),t!==void 0&&(this.location=t,t=void 0),this._set(`pendingLocation`,null),a?(this._addFeatures([i]),e===this._activeFeatureStream&&(this._featureStreamHasYielded=!0)):(n.push(i),r())}}finally{this._activeFeatureStream===e&&r.forceUpdate(),this._activeFeatureStream===e&&(this.removeHandles(O),this._featureStreamHasYielded||(this.features=[]),this._activeFeatureStream=null,this._set(`pendingLocation`,null),this._waitingForResultChange())}}_addFeatures(e){let{features:t}=this,n=new Set(t),r=e.filter(e=>!n.has(e)&&(n.add(e),!0));r.length&&(this.features=t.concat(r))}};e([d()],j.prototype,`_initialDisplayMode`,void 0),e([d()],j.prototype,`_activeFeatureStream`,void 0),e([d()],j.prototype,`_featureStreamHasYielded`,void 0),e([d({type:y})],j.prototype,`actions`,void 0),e([d({type:y,readOnly:!0})],j.prototype,`defaultActions`,null),e([d({readOnly:!0})],j.prototype,`active`,null),e([d()],j.prototype,`activeFeature`,void 0),e([d()],j.prototype,`aggregatedFeaturesEnabled`,void 0),e([d({value:null})],j.prototype,`content`,null),e([d({type:Boolean})],j.prototype,`defaultPopupTemplateEnabled`,void 0),e([d({readOnly:!0})],j.prototype,`diagnostics`,void 0),e([d({readOnly:!0})],j.prototype,`effectiveHeading`,null),e([d({readOnly:!0})],j.prototype,`featureCount`,null),e([d({value:null})],j.prototype,`featurePage`,null),e([d({value:[]})],j.prototype,`features`,null),e([d()],j.prototype,`featureStream`,null),e([d()],j.prototype,`featuresPerPage`,void 0),e([d()],j.prototype,`featureMenuOpen`,void 0),e([d({type:C})],j.prototype,`featureItemAbilities`,void 0),e([d({readOnly:!0})],j.prototype,`featureModels`,void 0),e([d()],j.prototype,`heading`,void 0),e([d()],j.prototype,`highlightEnabled`,void 0),e([d()],j.prototype,`includeDefaultActions`,void 0),e([d()],j.prototype,`initialDisplayMode`,null),e([d({type:p})],j.prototype,`location`,null),e([d()],j.prototype,`map`,null),e([d()],j.prototype,`open`,void 0),e([d({readOnly:!0})],j.prototype,`pendingLocation`,null),e([d({readOnly:!0})],j.prototype,`streamingFeatures`,null),e([d({value:null,readOnly:!0})],j.prototype,`selectedFeature`,null),e([d({value:-1})],j.prototype,`selectedFeatureIndex`,null),e([d({readOnly:!0})],j.prototype,`selectedFeatureItem`,null),e([d({type:h})],j.prototype,`spatialReference`,null),e([d({readOnly:!0})],j.prototype,`state`,null),e([d()],j.prototype,`timeZone`,null),e([d()],j.prototype,`updateLocationEnabled`,void 0),e([d()],j.prototype,`view`,void 0),e([d({readOnly:!0})],j.prototype,`waitingForContents`,null),e([d({readOnly:!0})],j.prototype,`waitingForResult`,null),e([d()],j.prototype,`zoomFactor`,void 0),j=e([f(`esri.popup.FeaturesModel`)],j);const M=j;export{M as default};
2
+ import{__decorate as e}from"tslib";import t from"../core/Error.js";import{EventedAccessor as n}from"../core/Evented.js";import r from"../core/Logger.js";import{abortMaybe as i}from"../core/maybe.js";import{debounce as a,logOnError as o,isAbortError as s}from"../core/promiseUtils.js";import{watch as c,when as l}from"../core/reactiveUtils.js";import{throttle as u}from"../core/throttle.js";import{property as d,subclass as f}from"../core/accessorSupport/decorators.js";import p from"../geometry/Point.js";import{project as m}from"../geometry/projectionUtils.js";import h from"../geometry/SpatialReference.js";import{geographicToWebMercator as g}from"../geometry/support/webMercatorUtils.js";import{getGraphicLayer as _}from"../graphic/graphicOriginUtils.js";import{fallbackObjectIDAttribute as v}from"../layers/LayerConstants.js";import{ActionsCollection as y,createDefaultActions as b}from"./actions.js";import{getSelectedTarget as x}from"./actionUtils.js";import S from"./FeatureModel.js";import C from"./support/FeatureAbilities.js";import{getDisplayedSymbol as w}from"../symbols/support/symbolUtils.js";import{system as T}from"../time/constants.js";import{highlightsSupported as E}from"../views/support/layerViewUtils.js";import{GoTo as D}from"../widgets/support/GoTo.js";const O=Symbol(`feature-stream-flush`);let k=null;function A(e,t){switch(e){case`building-scene`:case`map-image`:case`tile`:case`imagery`:return!0;case`imagery-tile`:return t===`2d`;default:return!1}}let j=class extends D(n){constructor(e){super(e),this._centerAtLocationController=null,this._locationUpdateController=null,this._highlightPromises={"highlight-active-feature":null,"highlight-selected-feature":null},this._defaultFeatureAbilities=new C,this._activeFeatureStream=null,this._featureStreamHasYielded=!1,this.actions=new y,this.activeFeature=null,this.aggregatedFeaturesEnabled=!1,this.defaultPopupTemplateEnabled=!1,this.diagnostics=null,this.featuresPerPage=20,this.featureMenuOpen=!1,this.featureItemAbilities=null,this.featureModels=[],this.heading=null,this.highlightEnabled=!0,this.includeDefaultActions=!0,this.open=!1,this.updateLocationEnabled=!1,this.view=null,this.zoomFactor=4,this._debouncedLocationUpdate=a(async()=>{this._cancelLocationUpdate();let e=new AbortController,{signal:t}=e;this._locationUpdateController=e,await this._locationUpdate({signal:t}).catch(()=>{}).finally(()=>{this._locationUpdateController===e&&(this._locationUpdateController=null)})})}initialize(){this.addHandles([c(()=>this.view?.scale,()=>{this.open&&o(this._debouncedLocationUpdate(),r.getLogger(this))}),c(()=>[this.highlightEnabled,this.selectedFeature,this.open,this.view],()=>this._highlightSelectedFeature()),c(()=>[this.highlightEnabled,this.activeFeature,this.open,this.view],()=>this._highlightActiveFeature()),c(()=>this.location,e=>this._locationChange(e)),c(()=>this.selectedFeature,e=>this._selectedFeatureChange(e)),c(()=>[this.featurePage,this.selectedFeatureIndex,this.featuresPerPage,this.featureMenuOpen,this.open,this.initialDisplayMode,this.featureItemAbilities?.attachmentsContent,this.featureItemAbilities?.chartAnimation,this.featureItemAbilities?.customContent,this.featureItemAbilities?.expressionContent,this.featureItemAbilities?.fieldsContent,this.featureItemAbilities?.mediaContent,this.featureItemAbilities?.relationshipContent,this.featureItemAbilities?.textContent,this.featureItemAbilities?.utilityNetworkAssociationsContent,this.actions,this.defaultPopupTemplateEnabled,this.includeDefaultActions,this.features,this.map,this.spatialReference,this.timeZone],(e,t)=>this._updateFeatureModels(t?.[1]??-1),{initial:!0}),l(()=>!this.open,()=>this.aggregatedFeaturesEnabled=!1)])}destroy(){this._cancelLocationUpdate(),this._cancelCenterAtLocation(),this._cancelFeatureStream(),this._destroyFeatureModels(),this.aggregatedFeaturesEnabled=!1,this.view=null,this.map=null,this.spatialReference=null,this.timeZone=null}get defaultActions(){let e=this._get(`defaultActions`)||new y;return e.removeAll(),e.addMany(this.selectedFeatureItem?.defaultActions.toArray()??b()),e}get active(){return this.open&&!this.waitingForResult}set content(e){this.featureStream=null,this._set(`diagnostics`,null),this.features=[],this._set(`content`,e)}get effectiveHeading(){return this.selectedFeatureItem?.heading??this.heading}get featureCount(){return this.features.length}get featurePage(){return this._get(`featurePage`)}set featurePage(e){if(e==null){this.featureCount||this._set(`featurePage`,null);return}!Number.isInteger(e)||e<1||e>Math.ceil(this.featureCount/this.featuresPerPage)||e!==1&&e!==(this.featurePage??0)+1||this._set(`featurePage`,e)}set features(e){if(this._get(`features`)===e)return;let t=e||[];this._set(`features`,t),(!this._activeFeatureStream||!t.length||this.featurePage==null)&&(this.featurePage=t.length?1:null),this._syncSelectedFeatureIndex(t)}get featureStream(){return this._get(`featureStream`)||null}set featureStream(e){this._setFeatureStream(e)}_setFeatureStream(e,t,n){this._set(`diagnostics`,n??null),this._get(`featureStream`)!==e&&(this._set(`featureStream`,e),this._cancelFeatureStream(),e&&(this._featureStreamHasYielded=!1,this._set(`pendingLocation`,t??null),this._activeFeatureStream=e,this._consumeFeatureStream(e,t).catch(()=>{})))}get initialDisplayMode(){return this._initialDisplayMode??(this.view?.focusRegionVisible?`list`:`feature`)}set initialDisplayMode(e){this._initialDisplayMode=e,this._syncSelectedFeatureIndex(this.features)}set location(e){let t=e?.spatialReference?.isWGS84&&this.spatialReference?.isWebMercator?g(e):e;this._set(`location`,t)}get map(){return this.view?.map??null}set map(e){this._override(`map`,e)}get pendingLocation(){return this._get(`pendingLocation`)??null}get streamingFeatures(){return this._activeFeatureStream!=null}get selectedFeature(){return this.selectedFeatureIndex===-1?null:this.features[this.selectedFeatureIndex]??null}get selectedFeatureIndex(){let e=this._get(`selectedFeatureIndex`);return typeof e==`number`?e:-1}set selectedFeatureIndex(e){let{featureCount:t}=this;(isNaN(e)||e<0||!t)&&(e=-1),this.activeFeature=null,this._set(`selectedFeatureIndex`,e)}get selectedFeatureItem(){return this.featureModels[this.selectedFeatureIndex]||null}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override(`spatialReference`,e)}get state(){return this.view?this.view.ready?`ready`:`disabled`:this.map?`ready`:`disabled`}get timeZone(){return this.view?.timeZone??T}set timeZone(e){this._overrideIfSome(`timeZone`,e)}get waitingForContents(){return this.featureModels.some(e=>e.waitingForContent)}get waitingForResult(){return this.streamingFeatures&&!this._featureStreamHasYielded}zoomTo(e){return this.callGoTo(e)}clear(){this._cancelFeatureStream(),this._set(`diagnostics`,null),this.set({featureStream:null,features:[],content:null,heading:null,location:null,activeFeature:null})}openFeatureStream(e){this._setFeatureStream(e.featureStream,e.location??null,e.diagnostics),this.open=!0}async fetchFeatures(e,n){let{view:r}=this;if(!r||!e)throw new t(`fetch-features:invalid-screenpoint-or-view`,`Cannot fetch features without a screen point/screen area and view.`,{screenPoint:e,view:r});let i={},a=r.fetchPopupFeatures(e,{diagnostics:i,pointerType:n?.event?.pointerType,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:n?.signal});this._setFeatureStream(a,void 0,i)}next(){this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex+1,this.featureCount)}previous(){this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex-1,this.featureCount)}_syncSelectedFeatureIndex(e){let{selectedFeatureIndex:t}=this,n=this._activeFeatureStream!=null&&e.length>0;if(this.initialDisplayMode===`list`){n||(this.selectedFeatureIndex=-1);return}if(n&&t===-1){this.selectedFeatureIndex=0;return}n&&t!==-1||(this.selectedFeatureIndex=e.length?0:-1)}_centerAtLocation(){let{view:e}=this,n=x(this);this._cancelCenterAtLocation();let i=new AbortController,{signal:a}=i;return this._centerAtLocationController=i,!n||!e?Promise.reject(new t(`center-at-location:invalid-target-or-view`,`Cannot center at a location without a target and view.`,{target:n,view:e})):this.callGoTo({target:{target:n,scale:e.scale},options:{signal:a}}).catch(e=>{s(e)||r.getLogger(this).error(e)})}_getRoundRobinIndex(e,t){return(e+t)%t}_locationChange(e){let{selectedFeature:t,updateLocationEnabled:n,view:r}=this;r&&!this._locationUpdateController&&n&&e&&(!t||t.geometry)&&this._centerAtLocation()}async _selectedFeatureChange(e){let{location:t,updateLocationEnabled:n,view:r}=this;if(this.aggregatedFeaturesEnabled=!1,!e||!r)return;let i=_(e)?.type;if((i===`map-image`||i===`imagery`||i===`imagery-tile`)&&(e.symbol=await w(e)),(n||!t)&&e.geometry){if(e.geometry.type===`point`){this.location=e.geometry;return}let{labelPointExecute:t}=await import(`../geometry/operators/labelPointOperator.js`);this.location=t(e.geometry);return}if(n&&!e.geometry){await this._centerAtLocation();let e=r.center?.clone();e&&(this.location=e)}}_waitingForResultChange(){!this.featureCount&&this.featureStream&&(this.open=!1)}_destroyFeatureModels(){this.featureModels.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set(`featureModels`,[])}_reconcileFeatureModels(e,t){let n=[],r=new Map;if(this.featureModels.forEach((t,i)=>{let a=t?.graphic;if(!a||t.destroyed)t.destroy();else if(e[i]===a)n[i]=t;else{let e=r.get(a);e?e.push(t):r.set(a,[t])}}),!r.size)return n;for(let e of r.values())e.reverse();for(let t=0;t<e.length&&r.size;t++){if(n[t])continue;let i=e[t],a=r.get(i);a&&(n[t]=a.pop(),a.length||r.delete(i))}let i=this.selectedFeatureIndex,a=e[i],o=this.featureModels[t],s=null;for(let e of r.values())for(let t of e)t===o?s=t:t.destroy();return s&&(a&&!n[i]?(s.graphic=a,n[i]=s):s.destroy()),n}_updateFeatureModels(e){let{selectedFeature:t,features:n}=this;if(!n.length){this._destroyFeatureModels();return}let r={abilities:this.featureItemAbilities??this._defaultFeatureAbilities,actions:this.actions,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,includeDefaultActions:this.includeDefaultActions,spatialReference:this.spatialReference,location:this.location,map:this.map,view:this.view,timeZone:this.timeZone},i=this._reconcileFeatureModels(n,e);i.forEach(e=>e.set(r));let a=e=>{let t=n[e];t&&!i[e]&&(i[e]=new S({...r,graphic:t}))};if(t&&a(this.selectedFeatureIndex),(this.featurePage??0)>1||this.open&&(this.featureMenuOpen||this.initialDisplayMode===`list`)){let e=Math.min((this.featurePage??0)*this.featuresPerPage,n.length);for(let t=0;t<e;t++)a(t)}this._set(`featureModels`,i)}_cancelCenterAtLocation(){this._centerAtLocationController=i(this._centerAtLocationController)}_cancelFeatureStream(){this.removeHandles(O);let e=this._activeFeatureStream;this._activeFeatureStream=null,this._set(`pendingLocation`,null),this._get(`featureStream`)===e&&this._set(`featureStream`,null),e?.return&&e.return(void 0).catch(()=>{})}async _locationUpdate(e){let{spatialReference:t}=this,n=this.selectedFeature,i=n?.geometry?.type,a=this.location;if(i&&i!==`mesh`&&t&&a&&n){if(i===`point`){let{labelPointExecute:t}=await import(`../geometry/operators/labelPointOperator.js`);if(e?.signal?.aborted||this.selectedFeature!==n||!n.geometry)return;this.location=t(n.geometry);return}try{let r=n.geometry,i=this._getHighlightLayer(n),o=n.getObjectId();if(!i||!this.view)return;if(o!=null){let n=this.view?.allLayerViews.find(e=>e.layer.uid===i.uid);if(!n||!(`queryFeatures`in n))return;let a=n.createQuery();a.outSpatialReference=t,a.objectIds=[o],a.returnGeometry=!0;let{features:s}=await n.queryFeatures(a,e);if(e?.signal?.aborted)return;r=s[0]?.geometry}if(!r||r.type===`mesh`)return;r=m(r,t),k??=await Promise.all([import(`../geometry/operators/intersectsOperator.js`),import(`../geometry/operators/proximityOperator.js`)]);let[{intersectsExecute:s},{proximityGetNearestCoordinate:c}]=k;if(!s(r,a)){let e=c(r,a).coordinate??a;this.selectedFeature===n&&(this.location=e)}}catch(e){s(e)||r.getLogger(this).error(e)}}}_cancelLocationUpdate(){this._locationUpdateController=i(this._locationUpdateController)}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}_getHighlightLayer(e){let t=_(e),{layer:n}=e;return t&&`layer`in t&&t.layer?t.layer:t?.type===`map-notes`||t?.type===`sketch`||t?.type===`subtype-group`?t:n??t}_getHighlightLayerView(e,t){return t.type===`subtype-sublayer`&&t.parent&&this._mapIncludesLayer(t.parent)?this._getLayerView(e,t.parent):t&&this._mapIncludesLayer(t)?this._getLayerView(e,t):null}_getHighlightTarget(e,t,n){if(A(t.type,n))return e;let r=e.getObjectId();if(r!=null)return r;let i=t.type===`imagery`?void 0:`objectIdField`in t?t.objectIdField||v:null,a=e.attributes;return a&&i&&a[i]||e}_mapIncludesLayer(e){return!!this.map?.allLayers?.includes(e)}async _highlightFeature(e,t){this.removeHandles(e);let n=this[t];if(!n)return;let{highlightEnabled:r,view:i,open:a}=this;if(!i||!r||!a)return;let o=this._getHighlightLayer(n);if(!o)return;let s=this._getHighlightLayerView(i,o);if(!s)return;this._highlightPromises[e]=s;let c=await s;if(!c||!E(c)||this._highlightPromises[e]!==s||!this[t]||!this.highlightEnabled)return;let l=c.highlight(this._getHighlightTarget(n,o,i.type));this.addHandles(l,e)}async _highlightActiveFeature(){return this._highlightFeature(`highlight-active-feature`,`activeFeature`)}async _highlightSelectedFeature(){return this._highlightFeature(`highlight-selected-feature`,`selectedFeature`)}async _consumeFeatureStream(e,t){if(e!==this._activeFeatureStream)return;let n=[],r=u(()=>{let t=n;n=[],e===this._activeFeatureStream&&t.length&&this._addFeatures(t)},16);this.addHandles({remove:()=>{r.remove(),n=[]}},O);try{for await(let i of e){if(e!==this._activeFeatureStream)return;let a=!this._featureStreamHasYielded;a&&(this.features=[]),t!==void 0&&(this.location=t,t=void 0),this._set(`pendingLocation`,null),a?(this._addFeatures([i]),e===this._activeFeatureStream&&(this._featureStreamHasYielded=!0)):(n.push(i),r())}}finally{this._activeFeatureStream===e&&r.forceUpdate(),this._activeFeatureStream===e&&(this.removeHandles(O),this._featureStreamHasYielded||(this.features=[]),this._activeFeatureStream=null,this._set(`pendingLocation`,null),this._waitingForResultChange())}}_addFeatures(e){let{features:t}=this,n=new Set(t),r=e.filter(e=>!n.has(e)&&(n.add(e),!0));r.length&&(this.features=t.concat(r))}};e([d()],j.prototype,`_initialDisplayMode`,void 0),e([d()],j.prototype,`_activeFeatureStream`,void 0),e([d()],j.prototype,`_featureStreamHasYielded`,void 0),e([d({type:y})],j.prototype,`actions`,void 0),e([d({type:y,readOnly:!0})],j.prototype,`defaultActions`,null),e([d({readOnly:!0})],j.prototype,`active`,null),e([d()],j.prototype,`activeFeature`,void 0),e([d()],j.prototype,`aggregatedFeaturesEnabled`,void 0),e([d({value:null})],j.prototype,`content`,null),e([d({type:Boolean})],j.prototype,`defaultPopupTemplateEnabled`,void 0),e([d({readOnly:!0})],j.prototype,`diagnostics`,void 0),e([d({readOnly:!0})],j.prototype,`effectiveHeading`,null),e([d({readOnly:!0})],j.prototype,`featureCount`,null),e([d({value:null})],j.prototype,`featurePage`,null),e([d({value:[]})],j.prototype,`features`,null),e([d()],j.prototype,`featureStream`,null),e([d()],j.prototype,`featuresPerPage`,void 0),e([d()],j.prototype,`featureMenuOpen`,void 0),e([d({type:C})],j.prototype,`featureItemAbilities`,void 0),e([d({readOnly:!0})],j.prototype,`featureModels`,void 0),e([d()],j.prototype,`heading`,void 0),e([d()],j.prototype,`highlightEnabled`,void 0),e([d()],j.prototype,`includeDefaultActions`,void 0),e([d()],j.prototype,`initialDisplayMode`,null),e([d({type:p})],j.prototype,`location`,null),e([d()],j.prototype,`map`,null),e([d()],j.prototype,`open`,void 0),e([d({readOnly:!0})],j.prototype,`pendingLocation`,null),e([d({readOnly:!0})],j.prototype,`streamingFeatures`,null),e([d({value:null,readOnly:!0})],j.prototype,`selectedFeature`,null),e([d({value:-1})],j.prototype,`selectedFeatureIndex`,null),e([d({readOnly:!0})],j.prototype,`selectedFeatureItem`,null),e([d({type:h})],j.prototype,`spatialReference`,null),e([d({readOnly:!0})],j.prototype,`state`,null),e([d()],j.prototype,`timeZone`,null),e([d()],j.prototype,`updateLocationEnabled`,void 0),e([d()],j.prototype,`view`,void 0),e([d({readOnly:!0})],j.prototype,`waitingForContents`,null),e([d({readOnly:!0})],j.prototype,`waitingForResult`,null),e([d()],j.prototype,`zoomFactor`,void 0),j=e([f(`esri.popup.FeaturesModel`)],j);const M=j;export{M as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../config.js";import{id as t}from"../kernel.js";import n from"../core/Error.js";import has from"../core/has.js";import{clone as r}from"../core/lang.js";import{isAbortError as i,createAbortError as a,isAborted as o}from"../core/promiseUtils.js";import{isTrustedServer as s,getOrigin as c,isBlobProtocol as l,isDataProtocol as u,toHTTPS as d,objectToQuery as f,getProxyRule as p,getProxyUrl as m,addQueryParameters as h,hasSameOrigin as g,addProxyRule as _,getAppUrl as v}from"../core/urlUtils.js";import{isSecureProxyService as y}from"../portal/support/urlUtils.js";import{requestConfig as b}from"./config.js";import{registerNoCorsDomains as x,isNoCorsRequestRequired as S,sendNoCorsRequest as C}from"./cors.js";import{loadImage as w}from"./loadImage.js";import{setPreferredHost as T,getPreferredUrl as E}from"./preferredHosts.js";const D=`FormData`in globalThis,O=new Set([499,498,403,401]),k=new Set([`COM_0056`,`COM_0057`,`SB_0008`]),A=[/\/arcgis\/tokens/i,/\/sharing(\/rest)?\/generatetoken/i,/\/rest\/info/i];async function j(t){await M(t);let n,r;try{do[n,r]=await N(t);while(!await V(t,n,r))}catch(e){let r=H(`request:server`,e,t.parameters,n);throw r.details.ssl=t.useSSL,t.interceptor?.error?.(r),r}let i=t.parameters.url;if(r){if(/\/sharing\/rest\/(accounts|portals)\/self/i.test(i)){if(!t.hasToken&&!t.credentialToken&&r.user?.username&&!s(i)){let t=c(i,!0);t&&e.request.trustedServers.push(t)}Array.isArray(r.authorizedCrossOriginNoCorsDomains)&&x(r.authorizedCrossOriginNoCorsDomains)}else(t.parameters.requestOptions.responseType||`json`)===`json`&&T(i,r)}return{data:r,getAllHeaders:n?()=>Array.from(n.headers):W,getHeader:n?e=>n.headers.get(e):W,httpStatus:n?.status??200,requestOptions:t.parameters.requestOptions,ssl:t.useSSL,url:t.parameters.url}}async function M(n){let r=n.parameters.url,i=n.parameters.requestOptions,a=n.controller.signal,s=i.body,c=null,l=null;if(D&&`HTMLFormElement`in globalThis&&(s instanceof FormData?c=s:s instanceof HTMLFormElement&&(c=new FormData(s))),typeof s==`string`&&(l=s),n.fetchOptions={cache:i.cacheMode??(i.cacheBust?`no-cache`:`default`),credentials:`same-origin`,headers:i.headers||{},keepalive:i.keepAlive??!1,method:i.method===`head`?`HEAD`:`GET`,mode:`cors`,priority:i.priority??e.request.priority,redirect:`follow`,signal:a},(c||l)&&(n.fetchOptions.body=c||l),(b.isForeignWorker||i.authMode===`anonymous`)&&(n.useIdentity=!1),n.hasToken=!!(/token=/i.test(r)||i.query?.token||c?.get(`token`)),!n.hasToken){let{getApiKey:e,getSessionToken:t}=await import(`../support/apiKeyUtils.js`),a=await t(r)??e(r);a&&(i.query??={},i.query.token=a,n.hasToken=!0)}if(n.useIdentity&&!n.hasToken&&!n.credential&&!n.credentialToken&&!R(r)&&!o(a)){let e;i.authMode===`immediate`?(await L(),e=await t.getCredential(r,{signal:a})):i.authMode===`no-prompt`?(await L(),e=await t.getCredential(r,{prompt:!1,signal:a}).catch(()=>void 0)):t&&(e=t.findCredential(r)),e&&(n.credential=e,n.credentialToken=e.token,n.useSSL=!!e.ssl)}}async function N(n){let r=n.parameters.url,i=E(r),o=n.parameters.requestOptions,x=n.fetchOptions??{},w=l(r)||u(r),T=o.responseType??`json`,O=w?0:o.timeout==null?e.request.timeout:o.timeout,k=!1;if(!w){n.useSSL&&(r=d(r));let a={...o.query};n.credentialToken&&(a.token=n.credentialToken);let c=f(a);has(`esri-url-encodes-apostrophe`)&&(c=c.replaceAll(`'`,`%27`));let l=i.length+1+c.length,u;k=o.method===`delete`||o.method===`post`||o.method===`put`||!!o.body||l>e.request.maxUrlLength;let _=o.useProxy||!!p(r);if(_){let t=m(r);u=t.path,!k&&u.length+1+l>e.request.maxUrlLength&&(k=!0),t.query&&(a={...t.query,...a})}if(x.method===`HEAD`&&(k||_)){if(k)throw l>e.request.maxUrlLength?H(`request:invalid-parameters`,Error(`URL exceeds maximum length`),n.parameters):H(`request:invalid-parameters`,Error(`cannot use POST request when method is 'head'`),n.parameters);if(_)throw H(`request:invalid-parameters`,Error(`cannot use proxy when method is 'head'`),n.parameters)}k?(x.method=o.method===`delete`?`DELETE`:o.method===`put`?`PUT`:`POST`,o.body?r=h(r,a):(x.body=f(a),x.headers||={},x.headers[`Content-Type`]=`application/x-www-form-urlencoded`)):r=h(r,a),_&&(n.useProxy=!0,r=`${u}?${r}`),a.token&&D&&x.body instanceof FormData&&!y(r)&&x.body.set(`token`,a.token),o.hasOwnProperty(`withCredentials`)?n.withCredentials=o.withCredentials:g(r,v())||(s(r)||t&&t.findServerInfo(r)?.webTierAuth)&&(n.withCredentials=!0),n.withCredentials&&(x.credentials=`include`,S(r)&&await C(k?h(r,a):r)),i=E(r)}let A=0,j=!1;O>0&&(A=setTimeout(()=>{j=!0,n.controller.abort()},O));let M,N;try{if(o.responseType===`native-request-init`)N=x,N.url=i,o.signal?N.signal=o.signal:delete N.signal;else if(o.responseType===`image`&&x.cache==="default"&&!x.keepalive&&x.method===`GET`&&!k&&!z(o.headers)&&(w||n.useProxy||!e.request.proxyUrl||I(r)))N=await P(i,n);else if(await b.beforeFetch?.(r,x),M=await fetch(i,x),await b.afterFetch?.(M),n.useProxy||F(r),o.responseType===`native`)N=M;else if(x.method!==`HEAD`){if(M.ok){switch(T){case`array-buffer`:N=await M.arrayBuffer();break;case`blob`:case`image`:N=await M.blob();break;default:N=await M.text()}if(A&&=(clearTimeout(A),0),T===`json`||T===`xml`||T===`document`){if(N)switch(T){case`json`:N=JSON.parse(N);break;case`xml`:N=B(N,`application/xml`);break;case`document`:N=B(N,`text/html`)}else N=null}if(N){if((T===`array-buffer`||T===`blob`)&&N[T===`blob`?`size`:`byteLength`]<=750)try{let e=await new Response(N).json();e.error&&(N=e)}catch{}T===`image`&&N instanceof Blob&&(N=await P(URL.createObjectURL(N),n,!0))}}else{N=await M.text();try{N=JSON.parse(N)}catch{}}}}catch(t){if(t.name===`AbortError`)throw j?K():a(`Request canceled`);if(!M&&t instanceof TypeError&&e.request.proxyUrl&&!o.body&&o.method!==`delete`&&o.method!==`head`&&o.method!==`post`&&o.method!==`put`&&!n.useProxy&&!I(r))n.redoRequest=!0,_({proxyUrl:e.request.proxyUrl,urlPrefix:c(r)??``});else throw t}finally{A&&clearTimeout(A)}return[M,N]}function P(t,n,r=!1){let i=n.controller.signal,a=new Image;return a.crossOrigin=n.withCredentials?`use-credentials`:`anonymous`,a.alt=``,a.fetchPriority=e.request.priority,a.src=t,w(a,t,r,i)}function F(e){let t=c(e);t&&!b.corsServers.includes(t)&&b.corsServers.push(t)}function I(e){let t=c(e);return!t||t.endsWith(`.arcgis.com`)||b.corsServers.includes(t)||s(t)}async function L(){t||await import(`../identity/IdentityManager.js`)}function R(e){return A.some(t=>t.test(e))}function z(e){if(e){for(let t of Object.getOwnPropertyNames(e))if(e[t])return!0}return!1}function B(e,t){let n;try{n=new DOMParser().parseFromString(e,t)}catch{}if(!n||n.getElementsByTagName(`parsererror`).length)throw SyntaxError(`XML Parse error`);return n}async function V(e,n,r){if(e.redoRequest)return e.redoRequest=!1,!1;let i=e.parameters.requestOptions;if(!n||i.responseType===`native`||i.responseType===`native-request-init`)return!0;let a;if(r&&(r.error&&typeof r.error==`object`?a=r.error:r.status===`error`&&Array.isArray(r.messages)&&(a={...r},a[U]=r,a.details=r.messages)),!a&&!n.ok)throw a=Error(`Unable to load ${n.url} status: ${n.status}`),a[U]=r,a;let o,s=null,c;a&&(o=Number(a.code),s=a.hasOwnProperty(`subcode`)?Number(a.subcode):null,c=a.messageCode,c=c?.toUpperCase());let l=i.authMode;if(o===403&&(s===4||a.message?.toLowerCase().includes(`ssl`)&&!a.message.toLowerCase().includes(`permission`))){if(!e.useSSL)return e.useSSL=!0,!1}else if(!e.hasToken&&e.useIdentity&&(l!==`no-prompt`||o===498)&&o!==void 0&&O.has(o)&&!R(e.parameters.url)&&(o!==403||(!c||!k.has(c))&&(s==null||s===2&&e.credentialToken))){await L();try{let n=await t.getCredential(e.parameters.url,{error:H(`request:server`,a,e.parameters),credential:e.credential,prompt:l!==`no-prompt`,signal:e.controller.signal,token:e.credentialToken});return e.credential=n,e.credentialToken=n.token,e.useSSL=e.useSSL||n.ssl,!1}catch(t){if(l===`no-prompt`)return e.credential=void 0,e.credentialToken=void 0,!1;a=t}}if(a)throw a;return!0}function H(e,t,o,s){let c,l={url:o.url,requestOptions:o.requestOptions,getAllHeaders:W,getHeader:W,ssl:!1};if(t instanceof n)return t.details?(t.details=r(t.details),t.details.url=o.url,t.details.requestOptions=o.requestOptions):t.details=l,t;if(t){let e=s&&(()=>Array.from(s.headers)),n=s&&(e=>s.headers.get(e)),r=s?.status,i=t.message;i&&(c=i),e&&n&&(l.getAllHeaders=e,l.getHeader=n),l.httpStatus=(t.httpCode==null?t.code:t.httpCode)||r||0,l.subCode=t.subcode,l.messageCode=t.messageCode,typeof t.details==`string`?(l.messages=[t.details],c??=t.details):(l.messages=t.details,c??=l.messages?.[0]),l.raw=U in t?t[U]:t}return c??=`Error`,i(t)?a():new n(e,c,l)}const U=Symbol(),W=()=>null,G=`Timeout exceeded`;function K(){return Error(G)}function q(e){return typeof e==`object`&&!!e&&`message`in e&&e.message===G}export{H as createRequestError,q as isTimeoutError,j as processRequest};
2
+ import e from"../config.js";import{id as t}from"../kernel.js";import n from"../core/Error.js";import has from"../core/has.js";import{clone as r}from"../core/lang.js";import{isAbortError as i,createAbortError as a,isAborted as o}from"../core/promiseUtils.js";import{isTrustedServer as s,getOrigin as c,isBlobProtocol as l,isDataProtocol as u,toHTTPS as d,objectToQuery as f,getProxyRule as p,getProxyUrl as m,addQueryParameters as h,hasSameOrigin as g,addProxyRule as _,getAppUrl as v}from"../core/urlUtils.js";import{isSecureProxyService as y}from"../portal/support/urlUtils.js";import{requestConfig as b}from"./config.js";import{registerNoCorsDomains as x,isNoCorsRequestRequired as S,sendNoCorsRequest as C}from"./cors.js";import{loadImage as w}from"./loadImage.js";import{setPreferredHost as T,getPreferredUrl as E}from"./preferredHosts.js";const D=`FormData`in globalThis,O=new Set([499,498,403,401]),k=new Set([`COM_0056`,`COM_0057`,`SB_0008`]),A=[/\/arcgis\/tokens/i,/\/sharing(\/rest)?\/generatetoken/i,/\/rest\/info/i];async function j(t){await M(t);let n,r;try{do[n,r]=await N(t);while(!await V(t,n,r))}catch(e){let r=H(`request:server`,e,t.parameters,n);throw r.details.ssl=t.useSSL,t.interceptor?.error?.(r),r}let i=t.parameters.url;if(r){if(/\/sharing\/rest\/(accounts|portals)\/self/i.test(i)){if(!t.hasToken&&!t.credentialToken&&r.user?.username&&!s(i)){let t=c(i,!0);t&&e.request.trustedServers.push(t)}Array.isArray(r.authorizedCrossOriginNoCorsDomains)&&x(r.authorizedCrossOriginNoCorsDomains)}else(t.parameters.requestOptions.responseType||`json`)===`json`&&T(i,r)}return{data:r,getAllHeaders:n?()=>Array.from(n.headers):W,getHeader:n?e=>n.headers.get(e):W,httpStatus:n?.status??200,requestOptions:t.parameters.requestOptions,ssl:t.useSSL,url:t.parameters.url}}async function M(n){let r=n.parameters.url,i=n.parameters.requestOptions,a=n.controller.signal,s=i.body,c=null,l=null;if(D&&`HTMLFormElement`in globalThis&&(s instanceof FormData?c=s:s instanceof HTMLFormElement&&(c=new FormData(s))),typeof s==`string`&&(l=s),n.fetchOptions={cache:i.cacheMode??(i.cacheBust?`no-cache`:`default`),credentials:`same-origin`,headers:i.headers||{},keepalive:i.keepAlive??!1,method:i.method===`head`?`HEAD`:`GET`,mode:`cors`,priority:i.priority??e.request.priority,redirect:`follow`,signal:a},(c||l)&&(n.fetchOptions.body=c||l),(b.isForeignWorker||i.authMode===`anonymous`)&&(n.useIdentity=!1),n.hasToken=!!(/token=/i.test(r)||i.query?.token||c?.get(`token`)),!n.hasToken){let{getApiKey:e,getSessionToken:t}=await import(`../support/apiKeyUtils.js`),a=await t(r)??e(r);a&&(i.query??={},i.query.token=a,n.hasToken=!0)}if(n.useIdentity&&!n.hasToken&&!n.credential&&!n.credentialToken&&!R(r)&&!o(a)){let e;i.authMode===`immediate`?(await L(),e=await t.getCredential(r,{signal:a})):i.authMode===`no-prompt`?(await L(),e=await t.getCredential(r,{prompt:!1,signal:a}).catch(()=>void 0)):t&&(e=t.findCredential(r)),e&&(n.credential=e,n.credentialToken=e.token,n.useSSL=!!e.ssl)}}async function N(n){let r=n.parameters.url,i=E(r),o=n.parameters.requestOptions,x=n.fetchOptions??{},w=l(r)||u(r),T=o.responseType??`json`,O=w?0:o.timeout==null?e.request.timeout:o.timeout,k=!1;if(!w){n.useSSL&&(r=d(r));let a={...o.query};n.credentialToken&&(a.token=n.credentialToken);let c=f(a);has(`esri-url-encodes-apostrophe`)&&(c=c.replaceAll(`'`,`%27`));let l=o.maxUrlLength??e.request.maxUrlLength;l===0&&(l=1/0);let u=i.length+1+c.length,_;k=o.method===`delete`||o.method===`post`||o.method===`put`||!!o.body||u>l;let b=o.useProxy||!!p(r);if(b){let e=m(r);_=e.path,!k&&_.length+1+u>l&&(k=!0),e.query&&(a={...e.query,...a})}if(x.method===`HEAD`&&(k||b)){if(k)throw u>l?H(`request:invalid-parameters`,Error(`URL exceeds maximum length`),n.parameters):H(`request:invalid-parameters`,Error(`cannot use POST request when method is 'head'`),n.parameters);if(b)throw H(`request:invalid-parameters`,Error(`cannot use proxy when method is 'head'`),n.parameters)}k?(x.method=o.method===`delete`?`DELETE`:o.method===`put`?`PUT`:`POST`,o.body?r=h(r,a):(x.body=f(a),x.headers||={},x.headers[`Content-Type`]=`application/x-www-form-urlencoded`)):r=h(r,a),b&&(n.useProxy=!0,r=`${_}?${r}`),a.token&&D&&x.body instanceof FormData&&!y(r)&&x.body.set(`token`,a.token),o.hasOwnProperty(`withCredentials`)?n.withCredentials=o.withCredentials:g(r,v())||(s(r)||t&&t.findServerInfo(r)?.webTierAuth)&&(n.withCredentials=!0),n.withCredentials&&(x.credentials=`include`,S(r)&&await C(k?h(r,a):r)),i=E(r)}let A=0,j=!1;O>0&&(A=setTimeout(()=>{j=!0,n.controller.abort()},O));let M,N;try{if(o.responseType===`native-request-init`)N=x,N.url=i,o.signal?N.signal=o.signal:delete N.signal;else if(o.responseType===`image`&&x.cache==="default"&&!x.keepalive&&x.method===`GET`&&!k&&!z(o.headers)&&(w||n.useProxy||!e.request.proxyUrl||I(r)))N=await P(i,n);else if(await b.beforeFetch?.(r,x),M=await fetch(i,x),await b.afterFetch?.(M),n.useProxy||F(r),o.responseType===`native`)N=M;else if(x.method!==`HEAD`){if(M.ok){switch(T){case`array-buffer`:N=await M.arrayBuffer();break;case`blob`:case`image`:N=await M.blob();break;default:N=await M.text()}if(A&&=(clearTimeout(A),0),T===`json`||T===`xml`||T===`document`){if(N)switch(T){case`json`:N=JSON.parse(N);break;case`xml`:N=B(N,`application/xml`);break;case`document`:N=B(N,`text/html`)}else N=null}if(N){if((T===`array-buffer`||T===`blob`)&&N[T===`blob`?`size`:`byteLength`]<=750)try{let e=await new Response(N).json();e.error&&(N=e)}catch{}T===`image`&&N instanceof Blob&&(N=await P(URL.createObjectURL(N),n,!0))}}else{N=await M.text();try{N=JSON.parse(N)}catch{}}}}catch(t){if(t.name===`AbortError`)throw j?K():a(`Request canceled`);if(!M&&t instanceof TypeError&&e.request.proxyUrl&&!o.body&&o.method!==`delete`&&o.method!==`head`&&o.method!==`post`&&o.method!==`put`&&!n.useProxy&&!I(r))n.redoRequest=!0,_({proxyUrl:e.request.proxyUrl,urlPrefix:c(r)??``});else throw t}finally{A&&clearTimeout(A)}return[M,N]}function P(t,n,r=!1){let i=n.controller.signal,a=new Image;return a.crossOrigin=n.withCredentials?`use-credentials`:`anonymous`,a.alt=``,a.fetchPriority=e.request.priority,a.src=t,w(a,t,r,i)}function F(e){let t=c(e);t&&!b.corsServers.includes(t)&&b.corsServers.push(t)}function I(e){let t=c(e);return!t||t.endsWith(`.arcgis.com`)||b.corsServers.includes(t)||s(t)}async function L(){t||await import(`../identity/IdentityManager.js`)}function R(e){return A.some(t=>t.test(e))}function z(e){if(e){for(let t of Object.getOwnPropertyNames(e))if(e[t])return!0}return!1}function B(e,t){let n;try{n=new DOMParser().parseFromString(e,t)}catch{}if(!n||n.getElementsByTagName(`parsererror`).length)throw SyntaxError(`XML Parse error`);return n}async function V(e,n,r){if(e.redoRequest)return e.redoRequest=!1,!1;let i=e.parameters.requestOptions;if(!n||i.responseType===`native`||i.responseType===`native-request-init`)return!0;let a;if(r&&(r.error&&typeof r.error==`object`?a=r.error:r.status===`error`&&Array.isArray(r.messages)&&(a={...r},a[U]=r,a.details=r.messages)),!a&&!n.ok)throw a=Error(`Unable to load ${n.url} status: ${n.status}`),a[U]=r,a;let o,s=null,c;a&&(o=Number(a.code),s=a.hasOwnProperty(`subcode`)?Number(a.subcode):null,c=a.messageCode,c=c?.toUpperCase());let l=i.authMode;if(o===403&&(s===4||a.message?.toLowerCase().includes(`ssl`)&&!a.message.toLowerCase().includes(`permission`))){if(!e.useSSL)return e.useSSL=!0,!1}else if(!e.hasToken&&e.useIdentity&&(l!==`no-prompt`||o===498)&&o!==void 0&&O.has(o)&&!R(e.parameters.url)&&(o!==403||(!c||!k.has(c))&&(s==null||s===2&&e.credentialToken))){await L();try{let n=await t.getCredential(e.parameters.url,{error:H(`request:server`,a,e.parameters),credential:e.credential,prompt:l!==`no-prompt`,signal:e.controller.signal,token:e.credentialToken});return e.credential=n,e.credentialToken=n.token,e.useSSL=e.useSSL||n.ssl,!1}catch(t){if(l===`no-prompt`)return e.credential=void 0,e.credentialToken=void 0,!1;a=t}}if(a)throw a;return!0}function H(e,t,o,s){let c,l={url:o.url,requestOptions:o.requestOptions,getAllHeaders:W,getHeader:W,ssl:!1};if(t instanceof n)return t.details?(t.details=r(t.details),t.details.url=o.url,t.details.requestOptions=o.requestOptions):t.details=l,t;if(t){let e=s&&(()=>Array.from(s.headers)),n=s&&(e=>s.headers.get(e)),r=s?.status,i=t.message;i&&(c=i),e&&n&&(l.getAllHeaders=e,l.getHeader=n),l.httpStatus=(t.httpCode==null?t.code:t.httpCode)||r||0,l.subCode=t.subcode,l.messageCode=t.messageCode,typeof t.details==`string`?(l.messages=[t.details],c??=t.details):(l.messages=t.details,c??=l.messages?.[0]),l.raw=U in t?t[U]:t}return c??=`Error`,i(t)?a():new n(e,c,l)}const U=Symbol(),W=()=>null,G=`Timeout exceeded`;function K(){return Error(G)}function q(e){return typeof e==`object`&&!!e&&`message`in e&&e.message===G}export{H as createRequestError,q as isTimeoutError,j as processRequest};
@@ -56,6 +56,13 @@ export interface RequestOptions extends AbortOptions {
56
56
  * @since 5.0
57
57
  */
58
58
  keepAlive?: boolean;
59
+ /**
60
+ * Maximum number of characters allowed in the URL for HTTP GET requests. If this limit is exceeded, HTTP POST method will be used.
61
+ * Defaults to `maxUrlLength` in [RequestConfig](https://developers.arcgis.com/javascript/latest/references/core/config/#RequestConfig-maxUrlLength). Set to `0` to skip URL-length checks.
62
+ *
63
+ * @since 5.2
64
+ */
65
+ maxUrlLength?: number;
59
66
  /**
60
67
  * Indicates if the request should be made using the
61
68
  * HTTP DELETE, HEAD, POST, or PUT method. By default, HTTP POST will be used for `auto` if the request size is longer than the `maxUrlLength` property set in [Config](https://developers.arcgis.com/javascript/latest/references/core/config/#Config-request).
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{getDataValues as e,quantizeFeatures as t,calculateHeatmapStats as n}from"./utils.js";import{calculateClassBreaks as r,resolveCBResult as i,calculateHistogram as a,isNullCountSupported as o,calculateStringStatistics as s,calculateStatistics as c,processSummaryStatisticsResult as l,calculateUniqueValuesCount as u,createUVResult as d}from"../../../statistics/utils.js";async function f(t){let{attribute:n,features:r}=t,{normalizationType:i,normalizationField:a,minValue:u,maxValue:d,fieldType:f,outStatisticTypes:p}=n,m=await e({field:n.field,valueExpression:n.valueExpression,normalizationType:i,normalizationField:a,normalizationTotal:n.normalizationTotal,viewInfoParams:n.viewInfoParams,timeZone:n.timeZone,fieldInfos:n.fieldInfos},r),h=o({normalizationType:i,normalizationField:a,minValue:u,maxValue:d}),g={value:.5,fieldType:f},_=f===`esriFieldTypeString`?s({values:m,supportsNullCount:h,percentileParams:g,outStatisticTypes:p}):c({values:m,minValue:u,maxValue:d,useSampleStdDev:!i,supportsNullCount:h,percentileParams:g,outStatisticTypes:p});return l(_,p,f===`esriFieldTypeDate`)}async function p(t){let{attribute:n,features:r}=t,i=await e({field:n.field,field2:n.field2,field3:n.field3,fieldDelimiter:n.fieldDelimiter,valueExpression:n.valueExpression,viewInfoParams:n.viewInfoParams,timeZone:n.timeZone,fieldInfos:n.fieldInfos},r,!1),a=u(i);return d(a,n.domains,n.returnAllCodedValues,n.fieldDelimiter)}async function m(t){let{attribute:n,features:a}=t,{field:o,normalizationType:s,normalizationField:c,normalizationTotal:l,classificationMethod:u}=n,d=await e({field:o,valueExpression:n.valueExpression,normalizationType:s,normalizationField:c,normalizationTotal:l,viewInfoParams:n.viewInfoParams,timeZone:n.timeZone,fieldInfos:n.fieldInfos},a),f=r(d,{field:o,normalizationType:s,normalizationField:c,normalizationTotal:l,classificationMethod:u,standardDeviationInterval:n.standardDeviationInterval,numClasses:n.numClasses,minValue:n.minValue,maxValue:n.maxValue});return i(f,u)}async function h(t){let{attribute:n,features:r}=t,{field:i,normalizationType:o,normalizationField:s,normalizationTotal:c,classificationMethod:l}=n,u=await e({field:i,valueExpression:n.valueExpression,sqlExpression:n.sqlExpression,normalizationType:o,normalizationField:s,normalizationTotal:c,viewInfoParams:n.viewInfoParams,timeZone:n.timeZone,fieldInfos:n.fieldInfos},r);return a(u,{field:i,normalizationType:o,normalizationField:s,normalizationTotal:c,classificationMethod:l,standardDeviationInterval:n.standardDeviationInterval,numBins:n.numBins,minValue:n.minValue,maxValue:n.maxValue})}async function g(e){let{attribute:r,features:i}=e,{field:a,radius:o,transform:s,spatialReference:c}=r,l=r.size??[0,0],u=t(i??[],s,c,l);return n(u,o??void 0,a,l[0],l[1])}export{m as classBreaks,g as heatmapStatistics,h as histogram,f as summaryStatistics,p as uniqueValues};
2
+ import{getDataValues as e,quantizeFeatures as t,calculateHeatmapStats as n}from"./utils.js";import{calculateClassBreaks as r,resolveCBResult as i,calculateHistogram as a,calculateStringStatistics as o,calculateStatistics as s,processSummaryStatisticsResult as c,calculateUniqueValuesCount as l,createUVResult as u,isNullCountSupported as d}from"../../../statistics/utils.js";async function f(t){let{attribute:n,features:r}=t,{normalizationType:i,normalizationField:a,minValue:l,maxValue:u,fieldType:f,outStatisticTypes:p}=n,m=await e({field:n.field,valueExpression:n.valueExpression,normalizationType:i,normalizationField:a,normalizationTotal:n.normalizationTotal,viewInfoParams:n.viewInfoParams,timeZone:n.timeZone,fieldInfos:n.fieldInfos},r),h=d({normalizationType:i,normalizationField:a,minValue:l,maxValue:u}),g={value:.5,fieldType:f},_=f===`esriFieldTypeString`?o({values:m,supportsNullCount:h,percentileParams:g,outStatisticTypes:p}):s({values:m,minValue:l,maxValue:u,useSampleStdDev:!i,supportsNullCount:h,percentileParams:g,outStatisticTypes:p});return c(_,p,f===`esriFieldTypeDate`)}async function p(t){let{attribute:n,features:r}=t,i=await e({field:n.field,field2:n.field2,field3:n.field3,fieldDelimiter:n.fieldDelimiter,valueExpression:n.valueExpression,viewInfoParams:n.viewInfoParams,timeZone:n.timeZone,fieldInfos:n.fieldInfos},r,!1),a=l(i);return u(a,n.domains,n.returnAllCodedValues,n.fieldDelimiter)}async function m(t){let{attribute:n,features:a}=t,{field:o,normalizationType:s,normalizationField:c,normalizationTotal:l,classificationMethod:u}=n,d=await e({field:o,valueExpression:n.valueExpression,normalizationType:s,normalizationField:c,normalizationTotal:l,viewInfoParams:n.viewInfoParams,timeZone:n.timeZone,fieldInfos:n.fieldInfos},a),f=r(d,{field:o,normalizationType:s,normalizationField:c,normalizationTotal:l,classificationMethod:u,standardDeviationInterval:n.standardDeviationInterval,numClasses:n.numClasses,minValue:n.minValue,maxValue:n.maxValue});return i(f,u)}async function h(t){let{attribute:n,features:r}=t,{field:i,normalizationType:o,normalizationField:s,normalizationTotal:c,classificationMethod:l}=n,u=await e({field:i,valueExpression:n.valueExpression,sqlExpression:n.sqlExpression,normalizationType:o,normalizationField:s,normalizationTotal:c,viewInfoParams:n.viewInfoParams,timeZone:n.timeZone,fieldInfos:n.fieldInfos},r);return a(u,{field:i,normalizationType:o,normalizationField:s,normalizationTotal:c,classificationMethod:l,standardDeviationInterval:n.standardDeviationInterval,numBins:n.numBins,minValue:n.minValue,maxValue:n.maxValue})}async function g(e){let{attribute:r,features:i}=e,{field:a,radius:o,transform:s,spatialReference:c}=r,l=r.size??[0,0],u=t(i??[],s,c,l);return n(u,o??void 0,a,l[0],l[1])}export{m as classBreaks,g as heatmapStatistics,h as histogram,f as summaryStatistics,p as uniqueValues};
@@ -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{pickRandom as n}from"../../../core/arrayUtils.js";import r from"../../../core/Error.js";import{throwIfAborted as i}from"../../../core/promiseUtils.js";import{property as a,subclass as o}from"../../../core/accessorSupport/decorators.js";import{isHostedAgolService as s}from"../../../layers/support/arcgisLayerUrl.js";import{isTimeOnlyField as c,isNumericField as l}from"../../../layers/support/fieldUtils.js";import{generateRenderer as u}from"../../../rest/generateRenderer.js";import d from"../../../rest/support/GenerateRendererParameters.js";import f from"../../../rest/support/PivotQuery.js";import p from"../../../rest/support/StatisticDefinition.js";import m from"../../../rest/support/UniqueValueDefinition.js";import h from"../../../rest/support/UnPivotDefinition.js";import{getArcadeForPredominantCategory as g,getSQLForPredominantCategoryName as _}from"../../statistics/support/predominanceUtils.js";import{mergeWhereClauses as v,getRangeExpr as y,getSQLFilterForNormalization as b}from"../../statistics/support/utils.js";import{WorkerClient as x}from"../../statistics/support/WorkerClient.js";import{isAnyDateField as S,isIntegerField as C,castIntegerFieldToFloat as w,fieldDelimiter as T}from"../utils.js";import E from"./InMemoryLayerAdapter.js";import{getQueryParamsForExpr as ee,getDataRange as D,getAttributeBinsQuery as O,processQueryAttributeBinsResult as k,binParamsFromGenRend as A}from"./support/histogramUtils.js";import{ensureFeaturesJSON as j,getSummaryStatsQuery as M,getSummaryStatisticsFromFeatureSet as N,getSummaryStatsQueryForFields as P,getSummaryStatsPivotQuery as F,getUVQuery as I,getUniqueValuesFromFeatureSet as L,defaultNumBins as R,updateQueryWithFeatureFilter as z,getHistogramFromFeatureSet as B,getFieldExpr as V,getDomainsForFields as H,getBins as U,getPredominantCategoriesFromUVInfos as W,getMissingFields as G}from"./support/utils.js";import{processSummaryStatisticsResult as K,createUVResult as q,getEqualIntervalBins as J,createClassBreaksDefinition as Y,resolveCBResult as X}from"../../../statistics/utils.js";import{getScaleToResolutionFactor as te}from"../../../views/2d/viewpointUtils.js";const Z=2e4;let Q=class extends E{constructor(){super(...arguments),this.adapterName=`feature-layer-adapter`}_isStatsSupportedOnService(){let e=this.layer;if(!e.capabilities?.query?.supportsStatistics||this.geometryType===`multipatch`&&!s(e.url)&&e.version<10.5)throw new r(`${this.adapterName}:not-supported`,`Layer does not support statistics query`);return Promise.resolve()}_fetchFeaturesFromService(e,t){return this.layer.queryFeatures(e,{signal:t}).then(e=>e.features)}_fetchFeaturesJSONFromService(e,t){return this._fetchFeaturesFromService(e,t).then(j)}_summaryStatsFromGenRend(e){let t=e.normalizationType,n=e.normalizationField;return this.classBreaks({field:e.field,numClasses:5,classificationMethod:`standard-deviation`,standardDeviationInterval:.25,normalizationType:t,normalizationField:t===`field`?n:void 0,minValue:e.minValue,maxValue:e.maxValue,filter:e.filter,signal:e.signal}).then(t=>{let n,r,i;if(t.classBreakInfos?.some(e=>(e.hasAvg&&(n=e),!!n)),n){let e=n.maxValue-n.minValue;r=n.minValue+e/2,i=e*4}let a={min:t.minValue,max:t.maxValue,avg:r,stddev:i};return K(a,e.outStatisticTypes)})}async _summaryStatsFromServiceQuery(e,t){await this._isStatsSupportedOnService(),e.normalizationType===`percent-of-total`&&(e.normalizationTotal=await this._getNormalizationTotal(e.field,e.normalizationType,e.filter));let n=S(t)||c(t),r=(`capabilities`in this.layer?this.layer.capabilities:null)?.query?.supportsPercentileStatistics??!1,i=M(this,e,t,r),a=await this.layer.queryFeatures(i,{signal:e.signal}),o=N(a,n);return K(o,e.outStatisticTypes)}async _summaryStatsForFieldsBasic(e){let{outStatisticTypes:t,fields:n}=e,r=[];for(let t=0;t<n.length;t+=50){let i=n.slice(t,t+50),a=P(this,e,i);r.push(this.layer.queryFeatures(a,{signal:e.signal}))}let i=(await Promise.all(r)).flatMap(e=>e.features).map(e=>e.attributes).reduce((e,t)=>Object.assign(e,t),{}),a={};for(let e in i){let t=e.match(/^(\w+)_value_/);if(i[e]!=null&&t)switch(t[1]){case`min`:a.min=a.min==null?i[e]:Math.min(a.min,i[e]);break;case`max`:a.max=a.max==null?i[e]:Math.max(a.max,i[e]);break;case`sum`:a.sum=(a.sum||0)+i[e];break;case`count`:a.count=(a.count||0)+i[e]}}return K(a,t)}async _summaryStatsForFieldsAdvanced(e,t){let{outStatisticTypes:n,fields:r}=e,i=n?.exclude?.includes(`variance`)||n?.include&&!n.include.includes(`variance`),a=n?.exclude?.includes(`stddev`)||n?.include&&!n.include.includes(`stddev`);if(t.sum==null||!t.count||i&&a)return t;t.avg=t.sum/t.count;let o=[];for(let n=0;n<r.length;n+=50){let i=r.slice(n,n+50),a=P(this,e,i);a.outStatistics=[];for(let e of i){let n=`sumOfSquares_${e}`,r=`(power(${C(this.layer,e)?w(e):e} - ${t.avg}, 2))`,i=new p({statisticType:`sum`,onStatisticField:r,outStatisticFieldName:n});a.outStatistics.push(i)}o.push(this.layer.queryFeatures(a,{signal:e.signal}))}return t.variance=(await Promise.all(o)).reduce((e,t)=>e+Object.values(t.features[0].attributes).reduce((e,t)=>e+t,0),0)/(t.count-1),t.stddev=Math.sqrt(t.variance),K(t,n)}async _summaryStatsForFields(e){let t=await this._summaryStatsForFieldsBasic(e);return this._summaryStatsForFieldsAdvanced(e,t)}async _summaryStatsUsingQueryPivot(e){await this._isStatsSupportedOnService();let t=(`capabilities`in this.layer?this.layer.capabilities:null)?.query?.supportsPercentileStatistics??!1,n=F(this,e,t),r=await this.layer.queryPivot(n,{signal:e.signal}),i=N(r,!1);return K(i,e.outStatisticTypes)}_uvFromGenRenderer(e,t){let n=e.field??void 0,r=new m({attributeField:n}),i=new d({classificationDefinition:r});return this.generateRenderer(i,e.signal).then(e=>{let t={},r=this.getField(n);return e.uniqueValues.forEach(e=>{let n=e.value;(n==null||n===``||typeof n==`string`&&(n.trim()===``||n.toLowerCase()===`<null>`))&&(n=null),t[n]==null?t[n]={count:e.count,data:l(r)&&n?Number(n):n}:t[n].count=t[n].count+e.count}),{count:t}}).then(n=>q(n,[t],e.returnAllCodedValues))}async _uvFromServiceQuery(e,t){return this._isStatsSupportedOnService().then(()=>this.layer.queryFeatures(I(this,e),{signal:e.signal})).then(t=>L(t,{layer:this,field:e.field,field2:e.field2,field3:e.field3,fieldDelimiter:T,view:e.view,signal:e.signal})).then(n=>q(n,t,e.returnAllCodedValues,T))}_getNormalizationTotal(e,t,n,r){return e&&t===`percent-of-total`?this.summaryStatistics({field:e,outStatisticTypes:{include:[`sum`]},filter:n,signal:r}).then(e=>e.sum):Promise.resolve(null)}_histogramForExpr(e){return this._getNormalizationTotal(e.field,e.normalizationType,e.filter,e.signal).then(t=>{let n=ee(e,this,t);return D(n,this,e.minValue,e.maxValue).then(r=>{let i=r.min,a=r.max;if(i==null||a==null)return{bins:[],minValue:i,maxValue:a,normalizationTotal:t};let o=e.numBins||R,s=J(i,a,o),c=$(n.sqlExpression,s,e.minValue!=null&&e.maxValue!=null),l=new p({statisticType:`count`,outStatisticFieldName:`countOFExpr`,onStatisticField:`1`}),u=this.layer.createQuery();return u.where=v(u.where,n.sqlWhere),u.sqlFormat=`standard`,u.outStatistics=[l],u.groupByFieldsForStatistics=[c],u.orderByFields=[c],z(u,e.filter),this._isStatsSupportedOnService().then(()=>this.layer.queryFeatures(u,{signal:n.signal})).then(e=>B(e,i,a,o,t))})})}async _histogramForFields(e){let{min:t,max:n}=await D({fields:e.fields,sqlWhere:e.sqlWhere,filter:e.filter,signal:e.signal},this,e.minValue,e.maxValue);if(t==null||n==null)return{bins:[],minValue:t,maxValue:n};let r=`newField`,i=e.numBins||R,a=$(r,J(t,n,i),e.minValue!=null&&e.maxValue!=null),o=new p({statisticType:`count`,outStatisticFieldName:`countOFExpr`,onStatisticField:r}),s=new f,{where:c,timeExtent:l}=this.createQuery();return s.where=v(c,e.sqlWhere),s.outPivots=[new h({sourceFields:e.fields,valueFieldName:r})],s.outStatistics=[o],s.groupByFieldsForStatistics=[a],s.orderByFields=[a],s.timeExtent=l,z(s,e.filter),this._isStatsSupportedOnService().then(()=>this.layer.queryPivot(s,{signal:e.signal})).then(e=>B(e,t,n,i))}async _histogramFromQueryAttributeBins(e){let{field:t,normalizationType:n,filter:r,signal:i}=e,a=await this._getNormalizationTotal(t,n,r,i),{query:o,min:s,max:c}=await O(e,this,a,this.createQuery());if(!o)return{bins:[],minValue:s,maxValue:c,normalizationTotal:a};let l=await this.layer.queryAttributeBins(o,{signal:i});return k(l,t?this.getField(t):null,{minValue:s,maxValue:c,normalizationTotal:a})}_classBreaksFromGenRend(e){let{field:t,normalizationType:n,normalizationField:r,normalizationTotal:i,signal:a}=e,o=b({field:t,normalizationType:n,normalizationField:r}),s=V({field:t,normalizationType:n,normalizationField:r,normalizationTotal:i,layer:this}),c=y(s,e.minValue,e.maxValue),l=Y({field:t,normalizationType:n,normalizationField:r,classificationMethod:e.classificationMethod,standardDeviationInterval:e.standardDeviationInterval,breakCount:e.numClasses||5}),u=new d({classificationDefinition:l});return u.where=v(o,c),this.generateRenderer(u,a).then(t=>X(t,e.classificationMethod))}async summaryStatistics(e){let{field:t,fields:n,normalizationType:a,valueExpression:o,sqlExpression:s,view:l,features:u,useFeaturesInView:d}=e,f=t?this.getField(t):null,p=S(f)||c(f),m=o&&!(s&&this.supportsSQLExpression),h=this._hasLocalSource||u||d,g=l?.type===`3d`;if(n?.length){let t={...e,fields:n};if(!this.layer.capabilities?.operations?.supportsQueryPivot)return await this._summaryStatsForFields(t);try{return await this._summaryStatsUsingQueryPivot(t)}catch{return await this._summaryStatsForFields(t)}}if(h||m)return m||u||d||g||this._hasLocalSource&&!this.layer.capabilities.query.supportsStatistics?this._summaryStatsFromMemory(e,f):this._summaryStatsFromClientQuery(e,f);if(!this.supportsSQLExpression&&(p||s||a===`natural-log`||a===`square-root`))throw new r(`${this.adapterName}:not-supported`,`Layer does not support standardized SQL expression for queries`);return(a&&!this.supportsSQLExpression?this._summaryStatsFromGenRend(e):this._summaryStatsFromServiceQuery(e,f)).catch(()=>(i(e.signal),this._summaryStatsFromMemory(e,f)))}async uniqueValues(e){let{valueExpression:t,sqlExpression:n,features:r,useFeaturesInView:a,signal:o}=e,s=t&&!(n&&this.supportsSQLExpression),c=this._hasLocalSource||r||a||s,l=e.view?.type===`3d`,u=await H(e,this);return c?s||r||a||l||this._hasLocalSource&&!this.layer.capabilities.query.supportsStatistics?this._uvFromMemory(e,u):this._uvFromClientQuery(e,u):this._uvFromServiceQuery(e,u).catch(t=>(i(o),e.field&&!e.field2&&!e.field3&&!e.filter?this._uvFromGenRenderer(e,u[0]):t)).catch(()=>(i(o),l?this._uvFromMemory(e,u):this._uvFromClientQuery(e,u)))}async histogram(e){let{field:t,normalizationType:n,normalizationField:a,classificationMethod:o,view:s,filter:l,signal:u}=e,d=t?this.getField(t):null,f=S(d)||c(d),p=e.valueExpression||e.sqlExpression,m=e.valueExpression&&!(e.sqlExpression&&this.supportsSQLExpression),h=this._hasLocalSource||e.features||e.useFeaturesInView||m,g=this.supportsSQLExpression,_=!o||o===`equal-interval`,v=e.minValue,b=e.maxValue,x=v!=null&&b!=null,C=e.numBins||R;if(e.fields?.length){if(!g)throw new r(`${this.adapterName}:not-supported`,`Layer does not support standardized SQL expression for queries`);if(!this.layer.capabilities?.operations?.supportsQueryPivot)throw new r(`${this.adapterName}:not-supported`,`Layer does not support pivot queries`);return this._histogramForFields(e)}if(this.layer.capabilities?.operations?.supportsQueryBins&&e.useQueryAttributeBins&&!m){if(h)return this._histogramFromQueryAttributeBinsFromMemory(e);try{return await this._histogramFromQueryAttributeBins(e)}catch{return i(u),this._histogramFromQueryAttributeBinsFromMemory(e)}}if(e.returnAggregateIds)throw new r(`${this.adapterName}:not-supported`,`returnAggregateIds option is only supported with queryAttributeBins`);if(h)return this._histogramFromMemory(e);if((p||g)&&_){if(!g&&(p||n===`natural-log`||n===`square-root`))throw new r(`${this.adapterName}:not-supported`,`Layer does not support standardized SQL expression for queries`);if(this.layer.capabilities.query.supportsOrderBy)return this._histogramForExpr(e)}if(f&&_)throw new r(`${this.adapterName}:not-supported`,`Normalization and date field are not allowed when layer does not support standardized SQL expression for queries`);return n||!_?A(e,this).then(i=>{if(!x)return U(this,i,t,C,s,l,u);if(v>i.max||b<i.min)throw new r(`${this.adapterName}:insufficient-data`,`Range defined by 'minValue' and 'maxValue' does not intersect available data range of the field`);if(_)return U(this,{min:v,max:b,sqlExpr:i.sqlExpr,excludeZerosExpr:i.excludeZerosExpr},t,C,s,l,u);{let r={field:t,normalizationType:n,normalizationField:a,normalizationTotal:i.normTotal,layer:this},o=V(r),c=y(o,v,b);return A(e,this,c).then(e=>U(this,e,t,C,s,l,u))}}):this._histogramForField(e)}async classBreaks(e){let t=e.analyzeData!==!1,n=this._hasLocalSource||e.features||e.useFeaturesInView||e.valueExpression||e.filter;return t&&n?this._classBreaksFromMemory(e):(t?this._classBreaksFromGenRend(e):this._classBreaksFromInterpolation(e)).catch(()=>(i(e.signal),this._classBreaksFromMemory(e)))}async queryFeatureCount(e){if(this._hasLocalSource)throw new r(`${this.adapterName}:not-supported`,`Layer does not support count query`);let t=this.layer,n=t.createQuery();return n.where=v(n.where,e.whereClause),z(n,e.filter),t.queryFeatureCount(n,{signal:e.signal})}async generateRenderer(e,t){let n=this.layer;if(this._hasLocalSource||n.version<10.1)throw new r(`${this.adapterName}:not-supported`,`Layer does not support generateRenderer operation (requires ArcGIS Server version 10.1+)`);let i=n.createQuery();return e.where=v(e.where,i.where),u(n.parsedUrl?.path??``,{source:n.dynamicDataSource??void 0,gdbVersion:n.gdbVersion??void 0},e,{signal:t})}async predominantCategories(e){if(!this._hasLocalSource&&!this.supportsSQLExpression)throw new r(`${this.adapterName}:not-supported`,`Layer does not support advanced SQL expressions and standardized queries`);let{fields:t,view:n,signal:i,filter:a}=e,o=g(t),s=_(t),c=n&&this._hasLocalSource?await this._uvFromMemory({valueExpression:o,view:n,signal:i,filter:a}):await this._uvFromServiceQuery({sqlExpression:s.expression,valueExpression:o,signal:i,filter:a});return W(c.uniqueValueInfos,t)}async getSampleFeatures(e,r){let{view:a,requiredFields:o,returnGeometry:s,sqlWhere:c,filter:l,signal:u}=e,d=e.sampleSize;if(d==null||d===0)return[];let f=this.layer.createQuery(),p=r===`json`;f.outSpatialReference=a?.spatialReference,f.returnGeometry=!!s,f.outFields=o,f.where=v(f.where,c),z(f,l);let m=[],h=!1;if(a)try{let i=await a.whenLayerView(this.layer);if(h=!G(this,o,i).length,h){if(d>=1&&!e.filter&&`getSampleFeatures`in i){await this._waitForLayerViewUpdate(i);let e=await i.getSampleFeatures({minFeatureCount:d,sampleSize:d});if(e!=null)return p?e:e.map(e=>t.fromJSON(e))}if(m=await this._fetchFeaturesFromMemory(i,f,u,r),m.length>=d&&d>0)return n(m,d,1)}}catch{i(u)}try{if(this._hasLocalSource)return h?m:p?await this._fetchFeaturesJSONFromService(f,u):await this._fetchFeaturesFromService(f,u);let t=await this.queryFeatureCount({view:a,filter:l,signal:u}),r=this.layer.capabilities.query.maxRecordCount,i=d===-1?t:d;if(i=r&&i>r?r:i,t<=m.length||m.length>=r)return m;if(f.maxAllowableOffset=e.resolution||(a?a.extent.width/a.width/a.scale:te(this.layer.spatialReference))*4e5,t<=i)return p?await this._fetchFeaturesJSONFromService(f,u):await this._fetchFeaturesFromService(f,u);if(t<=Z){let e=this.layer.createQuery();z(e,l);let t=await this.layer.queryObjectIds();return f.objectIds=n(t,i,1),p?await this._fetchFeaturesJSONFromService(f,u):await this._fetchFeaturesFromService(f,u)}return this.layer.capabilities?.query?.supportsPagination&&(f.num=Math.min(i,Z)),p?await this._fetchFeaturesJSONFromService(f,u):await this._fetchFeaturesFromService(f,u)}catch{return i(u),m}}load(e){let t=this.layer.load(e).then(async t=>{this.geometryType=t.geometryType,this.objectIdField=t.objectIdField,this.supportsSQLExpression=t.capabilities?.query?.supportsSqlExpression,this._hasLocalSource=t.type!==`parquet`&&!t.url&&!!t.source,this.hasQueryEngine=this._hasLocalSource,this.minScale=t.minScale,this.maxScale=t.maxScale,this.fullExtent=t.fullExtent,this.workerClient=x.getInstance(),await this.workerClient.open(e.signal)});return this.addResolvingPromise(t),Promise.resolve(this)}};e([a({readOnly:!0})],Q.prototype,`adapterName`,void 0),e([a({constructOnly:!0})],Q.prototype,`layer`,void 0),Q=e([o(`esri.smartMapping.support.adapters.FeatureLayerAdapter`)],Q);function $(e,t,n){let r=[],i=t.length;return t.forEach((t,a)=>{let[o,s]=t,c=null;c=a===0&&!n?`${e} < ${s}`:a===i-1&&!n?`${e} >= ${o}`:v(`${e} >= ${o}`,`${e} ${a===i-1?` <= `:` < `} ${s}`),r.push(`WHEN (`+c+`) THEN `+(a+1))}),[`CASE`,r.join(` `),`ELSE 0`,`END`].join(` `)}export{Q as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import{pickRandom as n}from"../../../core/arrayUtils.js";import r from"../../../core/Error.js";import{throwIfAborted as i}from"../../../core/promiseUtils.js";import{property as a,subclass as o}from"../../../core/accessorSupport/decorators.js";import{isHostedAgolService as s}from"../../../layers/support/arcgisLayerUrl.js";import{isTimeOnlyField as c,isNumericField as l}from"../../../layers/support/fieldUtils.js";import{generateRenderer as u}from"../../../rest/generateRenderer.js";import d from"../../../rest/support/GenerateRendererParameters.js";import f from"../../../rest/support/PivotQuery.js";import p from"../../../rest/support/StatisticDefinition.js";import m from"../../../rest/support/UniqueValueDefinition.js";import h from"../../../rest/support/UnPivotDefinition.js";import{getArcadeForPredominantCategory as g,getSQLForPredominantCategoryName as _}from"../../statistics/support/predominanceUtils.js";import{mergeWhereClauses as v,getRangeExpr as y,getSQLFilterForNormalization as b}from"../../statistics/support/utils.js";import{WorkerClient as x}from"../../statistics/support/WorkerClient.js";import{isAnyDateField as S,isIntegerField as C,castIntegerFieldToFloat as w,fieldDelimiter as T}from"../utils.js";import E from"./InMemoryLayerAdapter.js";import{getQueryParamsForExpr as ee,getDataRange as D,getAttributeBinsQuery as O,processQueryAttributeBinsResult as k,binParamsFromGenRend as A}from"./support/histogramUtils.js";import{ensureFeaturesJSON as j,getSummaryStatsQuery as M,getSummaryStatisticsFromFeatureSet as N,getSummaryStatsQueryForFields as P,getSummaryStatsPivotQuery as F,getUVQuery as I,getUniqueValuesFromFeatureSet as L,defaultNumBins as R,updateQueryWithFeatureFilter as z,getHistogramFromFeatureSet as B,getFieldExpr as V,getDomainsForFields as H,getBins as U,getPredominantCategoriesFromUVInfos as W,getMissingFields as G}from"./support/utils.js";import{processSummaryStatisticsResult as K,createUVResult as q,getEqualIntervalBins as J,createClassBreaksDefinition as Y,resolveCBResult as X}from"../../../statistics/utils.js";import{getScaleToResolutionFactor as te}from"../../../views/2d/viewpointUtils.js";const Z=2e4;let Q=class extends E{constructor(){super(...arguments),this.adapterName=`feature-layer-adapter`}_isStatsSupportedOnService(){let e=this.layer;if(!e.capabilities?.query?.supportsStatistics||this.geometryType===`multipatch`&&!s(e.url)&&e.version<10.5)throw new r(`${this.adapterName}:not-supported`,`Layer does not support statistics query`);return Promise.resolve()}_fetchFeaturesFromService(e,t){return this.layer.queryFeatures(e,{signal:t}).then(e=>e.features)}_fetchFeaturesJSONFromService(e,t){return this._fetchFeaturesFromService(e,t).then(j)}_summaryStatsFromGenRend(e){let t=e.normalizationType,n=e.normalizationField;return this.classBreaks({field:e.field,numClasses:5,classificationMethod:`standard-deviation`,standardDeviationInterval:.25,normalizationType:t,normalizationField:t===`field`?n:void 0,minValue:e.minValue,maxValue:e.maxValue,filter:e.filter,signal:e.signal}).then(t=>{let n,r,i;if(t.classBreakInfos?.some(e=>(e.hasAvg&&(n=e),!!n)),n){let e=n.maxValue-n.minValue;r=n.minValue+e/2,i=e*4}let a={min:t.minValue,max:t.maxValue,avg:r,stddev:i};return K(a,e.outStatisticTypes)})}async _summaryStatsFromServiceQuery(e,t){await this._isStatsSupportedOnService(),e.normalizationType===`percent-of-total`&&(e.normalizationTotal=await this._getNormalizationTotal(e.field,e.normalizationType,e.filter));let n=S(t)||c(t),r=(`capabilities`in this.layer?this.layer.capabilities:null)?.query?.supportsPercentileStatistics??!1,i=M(this,e,t,r),a=await this.layer.queryFeatures(i,{signal:e.signal}),o=N(a,n);return K(o,e.outStatisticTypes)}async _summaryStatsForFieldsBasic(e){let{outStatisticTypes:t,fields:n}=e,r=[];for(let t=0;t<n.length;t+=50){let i=n.slice(t,t+50),a=P(this,e,i);r.push(this.layer.queryFeatures(a,{signal:e.signal}))}let i=(await Promise.all(r)).flatMap(e=>e.features).map(e=>e.attributes).reduce((e,t)=>Object.assign(e,t),{}),a={};for(let e in i){let t=e.match(/^(\w+)_value_/);if(i[e]!=null&&t)switch(t[1]){case`min`:a.min=a.min==null?i[e]:Math.min(a.min,i[e]);break;case`max`:a.max=a.max==null?i[e]:Math.max(a.max,i[e]);break;case`sum`:a.sum=(a.sum||0)+i[e];break;case`count`:a.count=(a.count||0)+i[e]}}return K(a,t)}async _summaryStatsForFieldsAdvanced(e,t){let{outStatisticTypes:n,fields:r}=e,i=n?.exclude?.includes(`variance`)||n?.include&&!n.include.includes(`variance`),a=n?.exclude?.includes(`stddev`)||n?.include&&!n.include.includes(`stddev`);if(t.sum==null||!t.count||i&&a)return t;t.avg=t.sum/t.count;let o=[];for(let n=0;n<r.length;n+=50){let i=r.slice(n,n+50),a=P(this,e,i);a.outStatistics=[];for(let e of i){let n=`sumOfSquares_${e}`,r=`(power(${C(this.layer,e)?w(e):e} - ${t.avg}, 2))`,i=new p({statisticType:`sum`,onStatisticField:r,outStatisticFieldName:n});a.outStatistics.push(i)}o.push(this.layer.queryFeatures(a,{signal:e.signal}))}return t.variance=(await Promise.all(o)).reduce((e,t)=>e+Object.values(t.features[0].attributes).reduce((e,t)=>e+t,0),0)/(t.count-1),t.stddev=Math.sqrt(t.variance),K(t,n)}async _summaryStatsForFields(e){let t=await this._summaryStatsForFieldsBasic(e);return this._summaryStatsForFieldsAdvanced(e,t)}async _summaryStatsUsingQueryPivot(e){await this._isStatsSupportedOnService();let t=(`capabilities`in this.layer?this.layer.capabilities:null)?.query?.supportsPercentileStatistics??!1,n=F(this,e,t),r=await this.layer.queryPivot(n,{signal:e.signal}),i=N(r,!1);return K(i,e.outStatisticTypes)}_uvFromGenRenderer(e,t){let n=e.field??void 0,r=new m({attributeField:n}),i=new d({classificationDefinition:r});return this.generateRenderer(i,e.signal).then(e=>{let t={},r=this.getField(n);return e.uniqueValues.forEach(e=>{let n=e.value;(n==null||n===``||typeof n==`string`&&(n.trim()===``||n.toLowerCase()===`<null>`))&&(n=null),t[n]==null?t[n]={count:e.count,data:l(r)&&n?Number(n):n}:t[n].count=t[n].count+e.count}),{count:t}}).then(n=>q(n,[t],e.returnAllCodedValues))}async _uvFromServiceQuery(e,t){return this._isStatsSupportedOnService().then(()=>this.layer.queryFeatures(I(this,e),{signal:e.signal})).then(t=>L(t,{layer:this,field:e.field,field2:e.field2,field3:e.field3,fieldDelimiter:T,filter:e.filter,view:e.view,signal:e.signal})).then(n=>q(n,t,e.returnAllCodedValues,T))}_getNormalizationTotal(e,t,n,r){return e&&t===`percent-of-total`?this.summaryStatistics({field:e,outStatisticTypes:{include:[`sum`]},filter:n,signal:r}).then(e=>e.sum):Promise.resolve(null)}_histogramForExpr(e){return this._getNormalizationTotal(e.field,e.normalizationType,e.filter,e.signal).then(t=>{let n=ee(e,this,t);return D(n,this,e.minValue,e.maxValue).then(r=>{let i=r.min,a=r.max;if(i==null||a==null)return{bins:[],minValue:i,maxValue:a,normalizationTotal:t};let o=e.numBins||R,s=J(i,a,o),c=$(n.sqlExpression,s,e.minValue!=null&&e.maxValue!=null),l=new p({statisticType:`count`,outStatisticFieldName:`countOFExpr`,onStatisticField:`1`}),u=this.layer.createQuery();return u.where=v(u.where,n.sqlWhere),u.sqlFormat=`standard`,u.outStatistics=[l],u.groupByFieldsForStatistics=[c],u.orderByFields=[c],z(u,e.filter),this._isStatsSupportedOnService().then(()=>this.layer.queryFeatures(u,{signal:n.signal})).then(e=>B(e,i,a,o,t))})})}async _histogramForFields(e){let{min:t,max:n}=await D({fields:e.fields,sqlWhere:e.sqlWhere,filter:e.filter,signal:e.signal},this,e.minValue,e.maxValue);if(t==null||n==null)return{bins:[],minValue:t,maxValue:n};let r=`newField`,i=e.numBins||R,a=$(r,J(t,n,i),e.minValue!=null&&e.maxValue!=null),o=new p({statisticType:`count`,outStatisticFieldName:`countOFExpr`,onStatisticField:r}),s=new f,{where:c,timeExtent:l}=this.createQuery();return s.where=v(c,e.sqlWhere),s.outPivots=[new h({sourceFields:e.fields,valueFieldName:r})],s.outStatistics=[o],s.groupByFieldsForStatistics=[a],s.orderByFields=[a],s.timeExtent=l,z(s,e.filter),this._isStatsSupportedOnService().then(()=>this.layer.queryPivot(s,{signal:e.signal})).then(e=>B(e,t,n,i))}async _histogramFromQueryAttributeBins(e){let{field:t,normalizationType:n,filter:r,signal:i}=e,a=await this._getNormalizationTotal(t,n,r,i),{query:o,min:s,max:c}=await O(e,this,a,this.createQuery());if(!o)return{bins:[],minValue:s,maxValue:c,normalizationTotal:a};let l=await this.layer.queryAttributeBins(o,{signal:i});return k(l,t?this.getField(t):null,{minValue:s,maxValue:c,normalizationTotal:a})}_classBreaksFromGenRend(e){let{field:t,normalizationType:n,normalizationField:r,normalizationTotal:i,signal:a}=e,o=b({field:t,normalizationType:n,normalizationField:r}),s=V({field:t,normalizationType:n,normalizationField:r,normalizationTotal:i,layer:this}),c=y(s,e.minValue,e.maxValue),l=Y({field:t,normalizationType:n,normalizationField:r,classificationMethod:e.classificationMethod,standardDeviationInterval:e.standardDeviationInterval,breakCount:e.numClasses||5}),u=new d({classificationDefinition:l});return u.where=v(o,c),this.generateRenderer(u,a).then(t=>X(t,e.classificationMethod))}async summaryStatistics(e){let{field:t,fields:n,normalizationType:a,valueExpression:o,sqlExpression:s,view:l,features:u,useFeaturesInView:d}=e,f=t?this.getField(t):null,p=S(f)||c(f),m=o&&!(s&&this.supportsSQLExpression),h=this._hasLocalSource||u||d,g=l?.type===`3d`;if(n?.length){let t={...e,fields:n};if(!this.layer.capabilities?.operations?.supportsQueryPivot)return await this._summaryStatsForFields(t);try{return await this._summaryStatsUsingQueryPivot(t)}catch{return await this._summaryStatsForFields(t)}}if(h||m)return m||u||d||g||this._hasLocalSource&&!this.layer.capabilities.query.supportsStatistics?this._summaryStatsFromMemory(e,f):this._summaryStatsFromClientQuery(e,f);if(!this.supportsSQLExpression&&(p||s||a===`natural-log`||a===`square-root`))throw new r(`${this.adapterName}:not-supported`,`Layer does not support standardized SQL expression for queries`);return(a&&!this.supportsSQLExpression?this._summaryStatsFromGenRend(e):this._summaryStatsFromServiceQuery(e,f)).catch(()=>(i(e.signal),this._summaryStatsFromMemory(e,f)))}async uniqueValues(e){let{valueExpression:t,sqlExpression:n,features:r,useFeaturesInView:a,signal:o}=e,s=t&&!(n&&this.supportsSQLExpression),c=this._hasLocalSource||r||a||s,l=e.view?.type===`3d`,u=await H(e,this);return c?s||r||a||l||this._hasLocalSource&&!this.layer.capabilities.query.supportsStatistics?this._uvFromMemory(e,u):this._uvFromClientQuery(e,u):this._uvFromServiceQuery(e,u).catch(t=>(i(o),e.field&&!e.field2&&!e.field3&&!e.filter?this._uvFromGenRenderer(e,u[0]):t)).catch(()=>(i(o),l?this._uvFromMemory(e,u):this._uvFromClientQuery(e,u)))}async histogram(e){let{field:t,normalizationType:n,normalizationField:a,classificationMethod:o,view:s,filter:l,signal:u}=e,d=t?this.getField(t):null,f=S(d)||c(d),p=e.valueExpression||e.sqlExpression,m=e.valueExpression&&!(e.sqlExpression&&this.supportsSQLExpression),h=this._hasLocalSource||e.features||e.useFeaturesInView||m,g=this.supportsSQLExpression,_=!o||o===`equal-interval`,v=e.minValue,b=e.maxValue,x=v!=null&&b!=null,C=e.numBins||R;if(e.fields?.length){if(!g)throw new r(`${this.adapterName}:not-supported`,`Layer does not support standardized SQL expression for queries`);if(!this.layer.capabilities?.operations?.supportsQueryPivot)throw new r(`${this.adapterName}:not-supported`,`Layer does not support pivot queries`);return this._histogramForFields(e)}if(this.layer.capabilities?.operations?.supportsQueryBins&&e.useQueryAttributeBins&&!m){if(h)return this._histogramFromQueryAttributeBinsFromMemory(e);try{return await this._histogramFromQueryAttributeBins(e)}catch{return i(u),this._histogramFromQueryAttributeBinsFromMemory(e)}}if(e.returnAggregateIds)throw new r(`${this.adapterName}:not-supported`,`returnAggregateIds option is only supported with queryAttributeBins`);if(h)return this._histogramFromMemory(e);if((p||g)&&_){if(!g&&(p||n===`natural-log`||n===`square-root`))throw new r(`${this.adapterName}:not-supported`,`Layer does not support standardized SQL expression for queries`);if(this.layer.capabilities.query.supportsOrderBy)return this._histogramForExpr(e)}if(f&&_)throw new r(`${this.adapterName}:not-supported`,`Normalization and date field are not allowed when layer does not support standardized SQL expression for queries`);return n||!_?A(e,this).then(i=>{if(!x)return U(this,i,t,C,s,l,u);if(v>i.max||b<i.min)throw new r(`${this.adapterName}:insufficient-data`,`Range defined by 'minValue' and 'maxValue' does not intersect available data range of the field`);if(_)return U(this,{min:v,max:b,sqlExpr:i.sqlExpr,excludeZerosExpr:i.excludeZerosExpr},t,C,s,l,u);{let r={field:t,normalizationType:n,normalizationField:a,normalizationTotal:i.normTotal,layer:this},o=V(r),c=y(o,v,b);return A(e,this,c).then(e=>U(this,e,t,C,s,l,u))}}):this._histogramForField(e)}async classBreaks(e){let t=e.analyzeData!==!1,n=this._hasLocalSource||e.features||e.useFeaturesInView||e.valueExpression||e.filter;return t&&n?this._classBreaksFromMemory(e):(t?this._classBreaksFromGenRend(e):this._classBreaksFromInterpolation(e)).catch(()=>(i(e.signal),this._classBreaksFromMemory(e)))}async queryFeatureCount(e){if(this._hasLocalSource)throw new r(`${this.adapterName}:not-supported`,`Layer does not support count query`);let t=this.layer,n=t.createQuery();return n.where=v(n.where,e.whereClause),z(n,e.filter),t.queryFeatureCount(n,{signal:e.signal})}async generateRenderer(e,t){let n=this.layer;if(this._hasLocalSource||n.version<10.1)throw new r(`${this.adapterName}:not-supported`,`Layer does not support generateRenderer operation (requires ArcGIS Server version 10.1+)`);let i=n.createQuery();return e.where=v(e.where,i.where),u(n.parsedUrl?.path??``,{source:n.dynamicDataSource??void 0,gdbVersion:n.gdbVersion??void 0},e,{signal:t})}async predominantCategories(e){if(!this._hasLocalSource&&!this.supportsSQLExpression)throw new r(`${this.adapterName}:not-supported`,`Layer does not support advanced SQL expressions and standardized queries`);let{fields:t,view:n,signal:i,filter:a}=e,o=g(t),s=_(t),c=n&&this._hasLocalSource?await this._uvFromMemory({valueExpression:o,view:n,signal:i,filter:a}):await this._uvFromServiceQuery({sqlExpression:s.expression,valueExpression:o,signal:i,filter:a});return W(c.uniqueValueInfos,t)}async getSampleFeatures(e,r){let{view:a,requiredFields:o,returnGeometry:s,sqlWhere:c,filter:l,signal:u}=e,d=e.sampleSize;if(d==null||d===0)return[];let f=this.layer.createQuery(),p=r===`json`;f.outSpatialReference=a?.spatialReference,f.returnGeometry=!!s,f.outFields=o,f.where=v(f.where,c),z(f,l);let m=[],h=!1;if(a)try{let i=await a.whenLayerView(this.layer);if(h=!G(this,o,i).length,h){if(d>=1&&!e.filter&&`getSampleFeatures`in i){await this._waitForLayerViewUpdate(i);let e=await i.getSampleFeatures({minFeatureCount:d,sampleSize:d});if(e!=null)return p?e:e.map(e=>t.fromJSON(e))}if(m=await this._fetchFeaturesFromMemory(i,f,u,r),m.length>=d&&d>0)return n(m,d,1)}}catch{i(u)}try{if(this._hasLocalSource)return h?m:p?await this._fetchFeaturesJSONFromService(f,u):await this._fetchFeaturesFromService(f,u);let t=await this.queryFeatureCount({view:a,filter:l,signal:u}),r=this.layer.capabilities.query.maxRecordCount,i=d===-1?t:d;if(i=r&&i>r?r:i,t<=m.length||m.length>=r)return m;if(f.maxAllowableOffset=e.resolution||(a?a.extent.width/a.width/a.scale:te(this.layer.spatialReference))*4e5,t<=i)return p?await this._fetchFeaturesJSONFromService(f,u):await this._fetchFeaturesFromService(f,u);if(t<=Z){let e=this.layer.createQuery();z(e,l);let t=await this.layer.queryObjectIds();return f.objectIds=n(t,i,1),p?await this._fetchFeaturesJSONFromService(f,u):await this._fetchFeaturesFromService(f,u)}return this.layer.capabilities?.query?.supportsPagination&&(f.num=Math.min(i,Z)),p?await this._fetchFeaturesJSONFromService(f,u):await this._fetchFeaturesFromService(f,u)}catch{return i(u),m}}load(e){let t=this.layer.load(e).then(async t=>{this.geometryType=t.geometryType,this.objectIdField=t.objectIdField,this.supportsSQLExpression=t.capabilities?.query?.supportsSqlExpression,this._hasLocalSource=t.type!==`parquet`&&!t.url&&!!t.source,this.hasQueryEngine=this._hasLocalSource,this.minScale=t.minScale,this.maxScale=t.maxScale,this.fullExtent=t.fullExtent,this.workerClient=x.getInstance(),await this.workerClient.open(e.signal)});return this.addResolvingPromise(t),Promise.resolve(this)}};e([a({readOnly:!0})],Q.prototype,`adapterName`,void 0),e([a({constructOnly:!0})],Q.prototype,`layer`,void 0),Q=e([o(`esri.smartMapping.support.adapters.FeatureLayerAdapter`)],Q);function $(e,t,n){let r=[],i=t.length;return t.forEach((t,a)=>{let[o,s]=t,c=null;c=a===0&&!n?`${e} < ${s}`:a===i-1&&!n?`${e} >= ${o}`:v(`${e} >= ${o}`,`${e} ${a===i-1?` <= `:` < `} ${s}`),r.push(`WHEN (`+c+`) THEN `+(a+1))}),[`CASE`,r.join(` `),`ELSE 0`,`END`].join(` `)}export{Q 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{pickRandom as t}from"../../../core/arrayUtils.js";import n from"../../../core/Error.js";import r from"../../../core/Logger.js";import{assertIsSome as i}from"../../../core/maybe.js";import{timeout as a,throwIfAborted as o}from"../../../core/promiseUtils.js";import{whenOnce as s}from"../../../core/reactiveUtils.js";import{property as c,subclass as l}from"../../../core/accessorSupport/decorators.js";import{toQuantizationTransform as u}from"../../../geometry/support/quantizationUtils.js";import{kebabDict as d}from"../../../layers/support/fieldType.js";import{isTimeOnlyField as f}from"../../../layers/support/fieldUtils.js";import p from"../../../rest/support/QuantizationParameters.js";import{getArcadeForPredominantCategory as m}from"../../statistics/support/predominanceUtils.js";import{summaryStatistics as h,uniqueValues as g,histogram as _,classBreaks as v,heatmapStatistics as y}from"../../statistics/support/statsWorker.js";import{mergeWhereClauses as b}from"../../statistics/support/utils.js";import{WorkerClient as x}from"../../statistics/support/WorkerClient.js";import{getFieldsList as S,isAnyDateField as C,getFieldsFromWhereClauses as w,fieldDelimiter as T}from"../utils.js";import E from"./LayerAdapter.js";import{getHistogramAttributeDefinition as D,getAttributeBinsQuery as O,processQueryAttributeBinsResult as k}from"./support/histogramUtils.js";import{ensureFeaturesJSON as A,getSummaryStatsQuery as j,getSummaryStatisticsFromFeatureSet as M,getViewInfoParams as N,getMissingFields as P,updateQueryWithFeatureFilter as F,getUVQuery as I,getUniqueValuesFromFeatureSet as L,getBins as R,getDomainsForFields as z,getPredominantCategoriesFromUVInfos as B}from"./support/utils.js";import{processSummaryStatisticsResult as V,createUVResult as H,resolveCBResult as U}from"../../../statistics/utils.js";import{loadArcade as W}from"../../../support/loadArcade.js";let G,K=class extends E{constructor(){super(...arguments),this._hasLocalSource=!1,this.adapterName=`in-memory-layer-adapter`}destroy(){this.workerClient?.destroy()}async _waitForLayerViewUpdate(e){if(!e)throw new n(`${this.adapterName}:insufficient-data`,`layerView is required to fetch the features`);let t=new AbortController,i=s(()=>!e.updating,t.signal);await a(i,5e3,t).catch(e=>{throw r.getLogger(this).warn(`LayerView is taking too long to update. Aborting fetch from layerView.`),e})}async _fetchFeatureSetFromMemory(e,t,r){let i=this.layer;if(this._hasLocalSource&&`queryFeatures`in i)return i.queryFeatures(e);if(!t)throw new n(`${this.adapterName}:insufficient-data`,`view is required to fetch the features from layerView`);let a=await t.whenLayerView(this.layer);return await this._waitForLayerViewUpdate(a),a.queryFeatures(e,{signal:r})}async _fetchFeaturesFromMemory(e,t,r,i){let a=this.layer,o=i===`json`;if(this._hasLocalSource&&`queryFeatures`in a){let e=await a.queryFeatures(t);return o?A(e.features):e.features}if(await this._waitForLayerViewUpdate(e),o&&`queryFeaturesJSON`in e&&e.queryFeaturesJSON){let{features:n}=await e.queryFeaturesJSON(t,{signal:r});return n}if(!(`queryFeatures`in e))throw new n(`${this.adapterName}:not-supported`,`'queryFeatures' is not supported on the layerView`);let s=await e.queryFeatures(t,{signal:r});return o?A(s.features):s.features}_fetchFeaturesForStats(e,t){return S({field:e.field,field2:e.field2,field3:e.field3,normalizationField:e.normalizationField,valueExpression:e.valueExpression,fields:e.fields}).then(n=>this.getSampleFeatures({sampleSize:-1,view:e.view,returnGeometry:e.returnGeometry,filter:e.filter,requiredFields:n,sqlWhere:e.sqlWhere,signal:e.signal},t))}async _summaryStatsFromClientQuery(e,t){let{view:n,signal:r}=e,i=j(this,e,t),a=await this._fetchFeatureSetFromMemory(i,n,r),o=M(a,C(t)||f(t));return V(o,e.outStatisticTypes)}async _getNormalizationTotalFromMemory(e,t,r){let{featuresJSON:i,graphics:a,layerView:o,query:s}=t,c={include:[`sum`]},l=(!i&&!a&&o&&`querySummaryStatistics`in o?await o.querySummaryStatistics(s,{field:e},{signal:r}):i?await this.workerClient.summaryStatistics({field:e,outStatisticTypes:c},i):await h({attribute:{field:e,outStatisticTypes:c},features:a??[]})).sum;if(l==null)throw new n(`${this.adapterName}:invalid`,`invalid normalizationTotal`);return l}async _summaryStatsFromMemory(e,t){let{view:n,field:r,valueExpression:i,normalizationType:a,signal:o}=e,s={field:r,valueExpression:i,normalizationType:a,normalizationField:e.normalizationField,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue,outStatisticTypes:e.outStatisticTypes},{featuresJSON:c,graphics:l,layerView:u,query:f,fieldInfos:p}=await this._processStatsFromMemoryParams({...e,layerViewFunc:`querySummaryStatistics`});return i&&n&&(c||l)&&(s.fieldType=t?.type?d.toJSON(t.type):null,s.viewInfoParams=N(n),s.timeZone=n.timeZone,s.fieldInfos=p),a===`percent-of-total`&&e.normalizationTotal==null&&(s.normalizationTotal=await this._getNormalizationTotalFromMemory(r,{featuresJSON:c,graphics:l,layerView:u,query:f},o)),!c&&!l&&u&&`querySummaryStatistics`in u?u.querySummaryStatistics(f,s,{signal:o}):c?this.workerClient.summaryStatistics(s,c):h({attribute:s,features:l})}async _getFilteredFeatures(e,t){let n=e,r=t?.geometry;if(t?.spatialRelationship===`intersects`&&r){let{intersectionExecute:t}=await import(`../../../geometry/operators/intersectionOperator.js`);n=e.filter(({geometry:e})=>!!(e&&t(e,r)))}return e.length&&`declaredClass`in e[0]&&e[0].declaredClass===`esri.Graphic`?{graphics:n}:{featuresJSON:n}}async _processStatsFromMemoryParams(e){let{features:t,filter:n}=e;if(t?.length)return this._getFilteredFeatures(t,n);let{view:r,field:i,field2:a,field3:o,normalizationField:s,valueExpression:c,sqlExpression:l,sqlWhere:u,layerViewFunc:d,signal:f}=e,p=e.returnGeometry;if(p==null&&c){if(!G){let{arcadeUtils:e}=await W();G=e}let e=G.hasGeometryOperations(c);e&&await G.enableGeometryOperations(),p=e}let m=null,h=null,g=null,_=null,v=null;if(r)try{let e=this.layer.type===`subtype-sublayer`?this.layer.parent:this.layer;m=await r.whenLayerView(e),h=d!=null&&m!=null&&d in m&&typeof m[d]==`function`}catch{h=!1}if(h)try{await this._waitForLayerViewUpdate(m);let e=await S({field:i,field2:a,field3:o,normalizationField:s,valueExpression:c,fields:await w([l,u],this.layer.fieldsIndex)});P(this,e,m).length?h=!1:(g=this.layer.createQuery(),g.outFields=e,g.returnGeometry=!1,g.where=b(g.where,u),F(g,n)),m.suspended&&(h=!1)}catch{h=!1}return h||(_=await this._fetchFeaturesForStats({field:i,field2:a,field3:o,fields:await w([l,u],this.layer.fieldsIndex),valueExpression:c,normalizationField:s,returnGeometry:p,filter:n,sqlWhere:u,view:r,signal:f},`json`),v=(await S({valueExpression:c})).map(e=>this.getField(e)?.toJSON()).filter(Boolean)),{layerView:m,query:g,featuresJSON:_,fieldInfos:v}}async _uvFromClientQuery(e,t){let{view:n,signal:r}=e,i=I(this,e),a=await this._fetchFeatureSetFromMemory(i,n,r),o=await L(a,{layer:this,field:e.field,field2:e.field2,field3:e.field3,fieldDelimiter:T,view:e.view,signal:e.signal});return H(o,t,e.returnAllCodedValues,T)}async _uvFromMemory(e,t){let{view:n,field:r,valueExpression:i,returnAllCodedValues:a,signal:o}=e,{featuresJSON:s,graphics:c,layerView:l,query:u,fieldInfos:d}=await this._processStatsFromMemoryParams({...e,layerViewFunc:`queryUniqueValues`}),f={field:r,field2:e.field2,field3:e.field3,fieldDelimiter:T,valueExpression:i,domains:t,returnAllCodedValues:a};return i&&n&&(s||c)&&(f.viewInfoParams=N(n),f.timeZone=n.timeZone,f.fieldInfos=d),!s&&!c&&l&&`queryUniqueValues`in l?l.queryUniqueValues(u,f,{signal:o}):s?this.workerClient.uniqueValues(f,s):g({attribute:f,features:c})}_histogramForField(e){let t=null;return t=e.minValue!=null&&e.maxValue!=null?Promise.resolve({min:e.minValue,max:e.maxValue}):this.summaryStatistics({...e,outStatisticTypes:{include:[`min`,`max`,`count`]}}).then(e=>{if(!e.count)throw new n(`${this.adapterName}:insufficient-data`,`Either the layer has no features or none of the features have data for the field`);return{min:e.min,max:e.max}}),t.then(t=>R(this,{min:t.min,max:t.max},e.field,e.numBins??void 0,e.view,e.filter,e.signal))}async _histogramFromQueryAttributeBinsFromMemory(e){let{field:t,normalizationType:n,signal:r}=e,i=await this._processStatsFromMemoryParams({...e,layerViewFunc:`queryAttributeBins`}),{featuresJSON:a,graphics:o,layerView:s,query:c}=i,l=n===`percent-of-total`?e.normalizationTotal??await this._getNormalizationTotalFromMemory(t,i,r):void 0;if(!s||!(`queryAttributeBins`in s)||a||o){let t=D(e,i,l);return a?this.workerClient.histogram(t,a):_({attribute:t,features:o})}let{query:u,min:d,max:f}=await O(e,this,l,c);if(!u)return{bins:[],minValue:d,maxValue:f,normalizationTotal:l};let p=await s.queryAttributeBins(u,{signal:r});return k(p,t?this.getField(t):null,{minValue:d,maxValue:f,normalizationTotal:l})}async _histogramFromMemory(e){let{field:t,signal:n}=e,r=await this._processStatsFromMemoryParams({...e,layerViewFunc:`queryHistogram`}),{featuresJSON:i,graphics:a,layerView:o,query:s}=r,c=e.normalizationType===`percent-of-total`?e.normalizationTotal??await this._getNormalizationTotalFromMemory(t,r,n):void 0,l=D(e,r,c);return!i&&!a&&o&&`queryHistogram`in o?o.queryHistogram(s,l,{signal:n}):i?this.workerClient.histogram(l,i):_({attribute:l,features:a})}_classBreaksFromInterpolation(e){let{minValue:t,maxValue:n}=e,r=e.numClasses||5,i=[],a=(n-t)/r;for(let e=0;e<r;e++){let n=t+e*a;i.push({minValue:n,maxValue:n+a})}i[r-1].maxValue=n;let o={classBreaks:i,normalizationTotal:e.normalizationTotal},s=U(o,e.classificationMethod);return Promise.resolve(s)}async _classBreaksFromMemory(e){let{view:t,field:n,valueExpression:r,signal:i}=e,{featuresJSON:a,graphics:o,layerView:s,query:c,fieldInfos:l}=await this._processStatsFromMemoryParams({...e,layerViewFunc:`queryClassBreaks`}),u={field:n,valueExpression:r,normalizationType:e.normalizationType,normalizationField:e.normalizationField,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue,standardDeviationInterval:e.standardDeviationInterval,classificationMethod:e.classificationMethod,numClasses:e.numClasses};return r&&t&&(a||o)&&(u.viewInfoParams=N(t),u.timeZone=t.timeZone,u.fieldInfos=l),e.normalizationType===`percent-of-total`&&e.normalizationTotal==null&&(u.normalizationTotal=await this._getNormalizationTotalFromMemory(n,{featuresJSON:a,graphics:o,layerView:s,query:c},i)),!a&&!o&&s&&`queryClassBreaks`in s?s.queryClassBreaks(c,u,{signal:i}):a?this.workerClient.classBreaks(u,a):v({attribute:u,features:o})}async _heatmapStatsFromMemory(e){let{view:t,field:n,radius:r,signal:a}=e;i(t,`InMemoryLayerAdapter: must have a view`);try{let n=await t.whenLayerView(this.layer);if(`queryHeatmapStatistics`in n&&!n.updating&&!e.filter)return await n.queryHeatmapStatistics({field:e.field,radius:e.radius})}catch{o(a)}let{featuresJSON:s,graphics:c}=await this._processStatsFromMemoryParams({...e,returnGeometry:!0}),l=new p({extent:t.extent,tolerance:t.type===`2d`?t.state.resolution:t.pixelSizeAt?.(t.center)}),d={field:n,radius:r,transform:u(l),spatialReference:t.spatialReference?.toJSON(),size:t.size};return!s?.length&&!c?.length?{min:null,max:null}:s?this.workerClient.heatmapStatistics(d,s):y({attribute:d,features:c})}getField(e=``){return this.layer.getField(e)}getFieldUsageInfo(e){return this.getField(e)?{supportsLabelingInfo:!0,supportsRenderer:!0,supportsPopupTemplate:!0,supportsLayerQuery:!0,supportsStatistics:!0}:null}getFieldDomain(e,t){return this.layer.getFieldDomain(e,t)}createQuery(){return this.layer.createQuery()}async summaryStatistics(e){let{field:t,valueExpression:r,sqlExpression:i,features:a,view:o}=e,s=t?this.getField(t):null,c=!!r,l=o?.type===`3d`;if(!r&&i&&!this.supportsSQLExpression)throw new n(`${this.adapterName}:not-supported`,`Layer does not support standardized SQL expression for queries`);return c||a||l?this._summaryStatsFromMemory(e,s):this._summaryStatsFromClientQuery(e,s)}async uniqueValues(e){let{valueExpression:t,sqlExpression:r,features:i,view:a}=e,o=await z(e,this),s=!!t,c=a?.type===`3d`;if(!t&&r&&!this.supportsSQLExpression)throw new n(`${this.adapterName}:not-supported`,`Layer does not support standardized SQL expression for queries`);return s||i||c?this._uvFromMemory(e,o):this._uvFromClientQuery(e,o)}async histogram(e){let{features:t,valueExpression:r,normalizationType:i,sqlExpression:a}=e,o=t||!!r;if(!r&&a&&!this.supportsSQLExpression)throw new n(`${this.adapterName}:not-supported`,`Layer does not support standardized SQL expression for queries`);return o||i?this._histogramFromMemory(e):this._histogramForField(e)}async classBreaks(e){return e.analyzeData===!1?this._classBreaksFromInterpolation(e):this._classBreaksFromMemory(e)}async queryFeatureCount(e){let{whereClause:t,view:r,signal:i}=e;if(!r)throw new n(`${this.adapterName}:insufficient-data`,`view is required to fetch the features from layerView`);let a=this.layer.createQuery();a.where=b(a.where,t);let o=await r.whenLayerView(this.layer);return await s(()=>!o.updating,i),o.queryFeatureCount(a,{signal:i})}async generateRenderer(e,t){throw new n(`${this.adapterName}:not-supported`,`Layer does not support generateRenderer operation`)}async predominantCategories(e){let{fields:t,view:n,signal:r,filter:i}=e,a=m(t),o=await this._uvFromMemory({valueExpression:a,view:n,signal:r,filter:i});return B(o.uniqueValueInfos,t)}async heatmapStatistics(e){return this._heatmapStatsFromMemory(e)}async getSampleFeatures(e,r){let{view:i,sampleSize:a,requiredFields:o,returnGeometry:s,sqlWhere:c,filter:l,signal:u}=e,d=this.layer.createQuery();if(d.outSpatialReference=i?.spatialReference,d.returnGeometry=!!s,d.outFields=o,d.where=b(d.where,c),F(d,l),!i)throw new n(`${this.adapterName}:not-supported`,`view is required to get sample features for Layer`);let f=await i.whenLayerView(this.layer);if(P(this,o,f).length)throw new n(`${this.adapterName}:not-supported`,`Required fields need to be passed in the outFields for Layer`);let p=await this._fetchFeaturesFromMemory(f,d,u,r),m=a!=null&&a>0&&a<=p.length?a:p.length;return t(p,m,1)}load(e){let t=this.layer.load(e).then(async t=>{this.geometryType=t.geometryType,this.objectIdField=t.objectIdField,this.supportsSQLExpression=t.type===`stream`||!!t.capabilities?.query?.supportsSqlExpression,this.minScale=t.minScale,this.maxScale=t.maxScale,this.fullExtent=`fullExtent`in t?t.fullExtent:t.parent?.fullExtent,this._hasLocalSource=!1,this.hasQueryEngine=!0,this.workerClient=x.getInstance(),await this.workerClient.open(e.signal)});return this.addResolvingPromise(t),Promise.resolve(this)}};e([c({readOnly:!0})],K.prototype,`adapterName`,void 0),e([c({constructOnly:!0})],K.prototype,`layer`,void 0),K=e([l(`esri.smartMapping.support.adapters.InMemoryLayerAdapter`)],K);export{K as default};
2
+ import{__decorate as e}from"tslib";import{pickRandom as t}from"../../../core/arrayUtils.js";import n from"../../../core/Error.js";import r from"../../../core/Logger.js";import{assertIsSome as i}from"../../../core/maybe.js";import{timeout as a,throwIfAborted as o}from"../../../core/promiseUtils.js";import{whenOnce as s}from"../../../core/reactiveUtils.js";import{property as c,subclass as l}from"../../../core/accessorSupport/decorators.js";import{toQuantizationTransform as u}from"../../../geometry/support/quantizationUtils.js";import{kebabDict as d}from"../../../layers/support/fieldType.js";import{isTimeOnlyField as f}from"../../../layers/support/fieldUtils.js";import p from"../../../rest/support/QuantizationParameters.js";import{getArcadeForPredominantCategory as m}from"../../statistics/support/predominanceUtils.js";import{summaryStatistics as h,uniqueValues as g,histogram as _,classBreaks as v,heatmapStatistics as y}from"../../statistics/support/statsWorker.js";import{mergeWhereClauses as b}from"../../statistics/support/utils.js";import{WorkerClient as x}from"../../statistics/support/WorkerClient.js";import{getFieldsList as S,isAnyDateField as C,getFieldsFromWhereClauses as w,fieldDelimiter as T}from"../utils.js";import E from"./LayerAdapter.js";import{getHistogramAttributeDefinition as D,getAttributeBinsQuery as O,processQueryAttributeBinsResult as k}from"./support/histogramUtils.js";import{ensureFeaturesJSON as A,getSummaryStatsQuery as j,getSummaryStatisticsFromFeatureSet as M,getViewInfoParams as N,getMissingFields as P,updateQueryWithFeatureFilter as F,getUVQuery as I,getUniqueValuesFromFeatureSet as L,getBins as R,getDomainsForFields as z,getPredominantCategoriesFromUVInfos as B}from"./support/utils.js";import{processSummaryStatisticsResult as V,createUVResult as H,resolveCBResult as U}from"../../../statistics/utils.js";import{loadArcade as W}from"../../../support/loadArcade.js";let G,K=class extends E{constructor(){super(...arguments),this._hasLocalSource=!1,this.adapterName=`in-memory-layer-adapter`}destroy(){this.workerClient?.destroy()}async _waitForLayerViewUpdate(e){if(!e)throw new n(`${this.adapterName}:insufficient-data`,`layerView is required to fetch the features`);let t=new AbortController,i=s(()=>!e.updating,t.signal);await a(i,5e3,t).catch(e=>{throw r.getLogger(this).warn(`LayerView is taking too long to update. Aborting fetch from layerView.`),e})}async _fetchFeatureSetFromMemory(e,t,r){let i=this.layer;if(this._hasLocalSource&&`queryFeatures`in i)return i.queryFeatures(e);if(!t)throw new n(`${this.adapterName}:insufficient-data`,`view is required to fetch the features from layerView`);let a=await t.whenLayerView(this.layer);return await this._waitForLayerViewUpdate(a),a.queryFeatures(e,{signal:r})}async _fetchFeaturesFromMemory(e,t,r,i){let a=this.layer,o=i===`json`;if(this._hasLocalSource&&`queryFeatures`in a){let e=await a.queryFeatures(t);return o?A(e.features):e.features}if(await this._waitForLayerViewUpdate(e),o&&`queryFeaturesJSON`in e&&e.queryFeaturesJSON){let{features:n}=await e.queryFeaturesJSON(t,{signal:r});return n}if(!(`queryFeatures`in e))throw new n(`${this.adapterName}:not-supported`,`'queryFeatures' is not supported on the layerView`);let s=await e.queryFeatures(t,{signal:r});return o?A(s.features):s.features}_fetchFeaturesForStats(e,t){return S({field:e.field,field2:e.field2,field3:e.field3,normalizationField:e.normalizationField,valueExpression:e.valueExpression,fields:e.fields}).then(n=>this.getSampleFeatures({sampleSize:-1,view:e.view,returnGeometry:e.returnGeometry,filter:e.filter,requiredFields:n,sqlWhere:e.sqlWhere,signal:e.signal},t))}async _summaryStatsFromClientQuery(e,t){let{view:n,signal:r}=e,i=j(this,e,t),a=await this._fetchFeatureSetFromMemory(i,n,r),o=M(a,C(t)||f(t));return V(o,e.outStatisticTypes)}async _getNormalizationTotalFromMemory(e,t,r){let{featuresJSON:i,graphics:a,layerView:o,query:s}=t,c={include:[`sum`]},l=(!i&&!a&&o&&`querySummaryStatistics`in o?await o.querySummaryStatistics(s,{field:e},{signal:r}):i?await this.workerClient.summaryStatistics({field:e,outStatisticTypes:c},i):await h({attribute:{field:e,outStatisticTypes:c},features:a??[]})).sum;if(l==null)throw new n(`${this.adapterName}:invalid`,`invalid normalizationTotal`);return l}async _summaryStatsFromMemory(e,t){let{view:n,field:r,valueExpression:i,normalizationType:a,signal:o}=e,s={field:r,valueExpression:i,normalizationType:a,normalizationField:e.normalizationField,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue,outStatisticTypes:e.outStatisticTypes},{featuresJSON:c,graphics:l,layerView:u,query:f,fieldInfos:p}=await this._processStatsFromMemoryParams({...e,layerViewFunc:`querySummaryStatistics`});return i&&n&&(c||l)&&(s.fieldType=t?.type?d.toJSON(t.type):null,s.viewInfoParams=N(n),s.timeZone=n.timeZone,s.fieldInfos=p),a===`percent-of-total`&&e.normalizationTotal==null&&(s.normalizationTotal=await this._getNormalizationTotalFromMemory(r,{featuresJSON:c,graphics:l,layerView:u,query:f},o)),!c&&!l&&u&&`querySummaryStatistics`in u?u.querySummaryStatistics(f,s,{signal:o}):c?this.workerClient.summaryStatistics(s,c):h({attribute:s,features:l})}async _getFilteredFeatures(e,t){let n=e,r=t?.geometry;if(t?.spatialRelationship===`intersects`&&r){let{intersectionExecute:t}=await import(`../../../geometry/operators/intersectionOperator.js`);n=e.filter(({geometry:e})=>!!(e&&t(e,r)))}return e.length&&`declaredClass`in e[0]&&e[0].declaredClass===`esri.Graphic`?{graphics:n}:{featuresJSON:n}}async _processStatsFromMemoryParams(e){let{features:t,filter:n}=e;if(t?.length)return this._getFilteredFeatures(t,n);let{view:r,field:i,field2:a,field3:o,normalizationField:s,valueExpression:c,sqlExpression:l,sqlWhere:u,layerViewFunc:d,signal:f}=e,p=e.returnGeometry;if(p==null&&c){if(!G){let{arcadeUtils:e}=await W();G=e}let e=G.hasGeometryOperations(c);e&&await G.enableGeometryOperations(),p=e}let m=null,h=null,g=null,_=null,v=null;if(r)try{let e=this.layer.type===`subtype-sublayer`?this.layer.parent:this.layer;m=await r.whenLayerView(e),h=d!=null&&m!=null&&d in m&&typeof m[d]==`function`}catch{h=!1}if(h)try{await this._waitForLayerViewUpdate(m);let e=await S({field:i,field2:a,field3:o,normalizationField:s,valueExpression:c,fields:await w([l,u],this.layer.fieldsIndex)});P(this,e,m).length?h=!1:(g=this.layer.createQuery(),g.outFields=e,g.returnGeometry=!1,g.where=b(g.where,u),F(g,n)),m.suspended&&(h=!1)}catch{h=!1}return h||(_=await this._fetchFeaturesForStats({field:i,field2:a,field3:o,fields:await w([l,u],this.layer.fieldsIndex),valueExpression:c,normalizationField:s,returnGeometry:p,filter:n,sqlWhere:u,view:r,signal:f},`json`),v=(await S({valueExpression:c})).map(e=>this.getField(e)?.toJSON()).filter(Boolean)),{layerView:m,query:g,featuresJSON:_,fieldInfos:v}}async _uvFromClientQuery(e,t){let{view:n,signal:r}=e,i=I(this,e),a=await this._fetchFeatureSetFromMemory(i,n,r),o=await L(a,{layer:this,field:e.field,field2:e.field2,field3:e.field3,fieldDelimiter:T,filter:e.filter,view:e.view,signal:e.signal});return H(o,t,e.returnAllCodedValues,T)}async _uvFromMemory(e,t){let{view:n,field:r,valueExpression:i,returnAllCodedValues:a,signal:o}=e,{featuresJSON:s,graphics:c,layerView:l,query:u,fieldInfos:d}=await this._processStatsFromMemoryParams({...e,layerViewFunc:`queryUniqueValues`}),f={field:r,field2:e.field2,field3:e.field3,fieldDelimiter:T,valueExpression:i,domains:t,returnAllCodedValues:a};return i&&n&&(s||c)&&(f.viewInfoParams=N(n),f.timeZone=n.timeZone,f.fieldInfos=d),!s&&!c&&l&&`queryUniqueValues`in l?l.queryUniqueValues(u,f,{signal:o}):s?this.workerClient.uniqueValues(f,s):g({attribute:f,features:c})}_histogramForField(e){let t=null;return t=e.minValue!=null&&e.maxValue!=null?Promise.resolve({min:e.minValue,max:e.maxValue}):this.summaryStatistics({...e,outStatisticTypes:{include:[`min`,`max`,`count`]}}).then(e=>{if(!e.count)throw new n(`${this.adapterName}:insufficient-data`,`Either the layer has no features or none of the features have data for the field`);return{min:e.min,max:e.max}}),t.then(t=>R(this,{min:t.min,max:t.max},e.field,e.numBins??void 0,e.view,e.filter,e.signal))}async _histogramFromQueryAttributeBinsFromMemory(e){let{field:t,normalizationType:n,signal:r}=e,i=await this._processStatsFromMemoryParams({...e,layerViewFunc:`queryAttributeBins`}),{featuresJSON:a,graphics:o,layerView:s,query:c}=i,l=n===`percent-of-total`?e.normalizationTotal??await this._getNormalizationTotalFromMemory(t,i,r):void 0;if(!s||!(`queryAttributeBins`in s)||a||o){let t=D(e,i,l);return a?this.workerClient.histogram(t,a):_({attribute:t,features:o})}let{query:u,min:d,max:f}=await O(e,this,l,c);if(!u)return{bins:[],minValue:d,maxValue:f,normalizationTotal:l};let p=await s.queryAttributeBins(u,{signal:r});return k(p,t?this.getField(t):null,{minValue:d,maxValue:f,normalizationTotal:l})}async _histogramFromMemory(e){let{field:t,signal:n}=e,r=await this._processStatsFromMemoryParams({...e,layerViewFunc:`queryHistogram`}),{featuresJSON:i,graphics:a,layerView:o,query:s}=r,c=e.normalizationType===`percent-of-total`?e.normalizationTotal??await this._getNormalizationTotalFromMemory(t,r,n):void 0,l=D(e,r,c);return!i&&!a&&o&&`queryHistogram`in o?o.queryHistogram(s,l,{signal:n}):i?this.workerClient.histogram(l,i):_({attribute:l,features:a})}_classBreaksFromInterpolation(e){let{minValue:t,maxValue:n}=e,r=e.numClasses||5,i=[],a=(n-t)/r;for(let e=0;e<r;e++){let n=t+e*a;i.push({minValue:n,maxValue:n+a})}i[r-1].maxValue=n;let o={classBreaks:i,normalizationTotal:e.normalizationTotal},s=U(o,e.classificationMethod);return Promise.resolve(s)}async _classBreaksFromMemory(e){let{view:t,field:n,valueExpression:r,signal:i}=e,{featuresJSON:a,graphics:o,layerView:s,query:c,fieldInfos:l}=await this._processStatsFromMemoryParams({...e,layerViewFunc:`queryClassBreaks`}),u={field:n,valueExpression:r,normalizationType:e.normalizationType,normalizationField:e.normalizationField,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue,standardDeviationInterval:e.standardDeviationInterval,classificationMethod:e.classificationMethod,numClasses:e.numClasses};return r&&t&&(a||o)&&(u.viewInfoParams=N(t),u.timeZone=t.timeZone,u.fieldInfos=l),e.normalizationType===`percent-of-total`&&e.normalizationTotal==null&&(u.normalizationTotal=await this._getNormalizationTotalFromMemory(n,{featuresJSON:a,graphics:o,layerView:s,query:c},i)),!a&&!o&&s&&`queryClassBreaks`in s?s.queryClassBreaks(c,u,{signal:i}):a?this.workerClient.classBreaks(u,a):v({attribute:u,features:o})}async _heatmapStatsFromMemory(e){let{view:t,field:n,radius:r,signal:a}=e;i(t,`InMemoryLayerAdapter: must have a view`);try{let n=await t.whenLayerView(this.layer);if(`queryHeatmapStatistics`in n&&!n.updating&&!e.filter)return await n.queryHeatmapStatistics({field:e.field,radius:e.radius})}catch{o(a)}let{featuresJSON:s,graphics:c}=await this._processStatsFromMemoryParams({...e,returnGeometry:!0}),l=new p({extent:t.extent,tolerance:t.type===`2d`?t.state.resolution:t.pixelSizeAt?.(t.center)}),d={field:n,radius:r,transform:u(l),spatialReference:t.spatialReference?.toJSON(),size:t.size};return!s?.length&&!c?.length?{min:null,max:null}:s?this.workerClient.heatmapStatistics(d,s):y({attribute:d,features:c})}getField(e=``){return this.layer.getField(e)}getFieldUsageInfo(e){return this.getField(e)?{supportsLabelingInfo:!0,supportsRenderer:!0,supportsPopupTemplate:!0,supportsLayerQuery:!0,supportsStatistics:!0}:null}getFieldDomain(e,t){return this.layer.getFieldDomain(e,t)}createQuery(){return this.layer.createQuery()}async summaryStatistics(e){let{field:t,valueExpression:r,sqlExpression:i,features:a,view:o}=e,s=t?this.getField(t):null,c=!!r,l=o?.type===`3d`;if(!r&&i&&!this.supportsSQLExpression)throw new n(`${this.adapterName}:not-supported`,`Layer does not support standardized SQL expression for queries`);return c||a||l?this._summaryStatsFromMemory(e,s):this._summaryStatsFromClientQuery(e,s)}async uniqueValues(e){let{valueExpression:t,sqlExpression:r,features:i,view:a}=e,o=await z(e,this),s=!!t,c=a?.type===`3d`;if(!t&&r&&!this.supportsSQLExpression)throw new n(`${this.adapterName}:not-supported`,`Layer does not support standardized SQL expression for queries`);return s||i||c?this._uvFromMemory(e,o):this._uvFromClientQuery(e,o)}async histogram(e){let{features:t,valueExpression:r,normalizationType:i,sqlExpression:a}=e,o=t||!!r;if(!r&&a&&!this.supportsSQLExpression)throw new n(`${this.adapterName}:not-supported`,`Layer does not support standardized SQL expression for queries`);return o||i?this._histogramFromMemory(e):this._histogramForField(e)}async classBreaks(e){return e.analyzeData===!1?this._classBreaksFromInterpolation(e):this._classBreaksFromMemory(e)}async queryFeatureCount(e){let{whereClause:t,view:r,signal:i}=e;if(!r)throw new n(`${this.adapterName}:insufficient-data`,`view is required to fetch the features from layerView`);let a=this.layer.createQuery();a.where=b(a.where,t),F(a,e.filter);let o=await r.whenLayerView(this.layer);return await s(()=>!o.updating,i),o.queryFeatureCount(a,{signal:i})}async generateRenderer(e,t){throw new n(`${this.adapterName}:not-supported`,`Layer does not support generateRenderer operation`)}async predominantCategories(e){let{fields:t,view:n,signal:r,filter:i}=e,a=m(t),o=await this._uvFromMemory({valueExpression:a,view:n,signal:r,filter:i});return B(o.uniqueValueInfos,t)}async heatmapStatistics(e){return this._heatmapStatsFromMemory(e)}async getSampleFeatures(e,r){let{view:i,sampleSize:a,requiredFields:o,returnGeometry:s,sqlWhere:c,filter:l,signal:u}=e,d=this.layer.createQuery();if(d.outSpatialReference=i?.spatialReference,d.returnGeometry=!!s,d.outFields=o,d.where=b(d.where,c),F(d,l),!i)throw new n(`${this.adapterName}:not-supported`,`view is required to get sample features for Layer`);let f=await i.whenLayerView(this.layer);if(P(this,o,f).length)throw new n(`${this.adapterName}:not-supported`,`Required fields need to be passed in the outFields for Layer`);let p=await this._fetchFeaturesFromMemory(f,d,u,r),m=a!=null&&a>0&&a<=p.length?a:p.length;return t(p,m,1)}load(e){let t=this.layer.load(e).then(async t=>{this.geometryType=t.geometryType,this.objectIdField=t.objectIdField,this.supportsSQLExpression=t.type===`stream`||!!t.capabilities?.query?.supportsSqlExpression,this.minScale=t.minScale,this.maxScale=t.maxScale,this.fullExtent=`fullExtent`in t?t.fullExtent:t.parent?.fullExtent,this._hasLocalSource=!1,this.hasQueryEngine=!0,this.workerClient=x.getInstance(),await this.workerClient.open(e.signal)});return this.addResolvingPromise(t),Promise.resolve(this)}};e([c({readOnly:!0})],K.prototype,`adapterName`,void 0),e([c({constructOnly:!0})],K.prototype,`layer`,void 0),K=e([l(`esri.smartMapping.support.adapters.InMemoryLayerAdapter`)],K);export{K 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{pickRandom as t}from"../../../core/arrayUtils.js";import n from"../../../core/Error.js";import{whenOnce as r}from"../../../core/reactiveUtils.js";import{property as i,subclass as a}from"../../../core/accessorSupport/decorators.js";import{isTimeOnlyField as o}from"../../../layers/support/fieldUtils.js";import{getArcadeForPredominantCategory as s}from"../../statistics/support/predominanceUtils.js";import{mergeWhereClauses as c}from"../../statistics/support/utils.js";import{WorkerClient as l}from"../../statistics/support/WorkerClient.js";import{isAnyDateField as u,fieldDelimiter as d}from"../utils.js";import f from"./FeatureLayerAdapter.js";import{getSummaryStatsQuery as p,getSummaryStatisticsFromFeatureSet as m,getUVQuery as h,getUniqueValuesFromFeatureSet as g,getDomainsForFields as _,getPredominantCategoriesFromUVInfos as v,getMissingFields as y}from"./support/utils.js";import{processSummaryStatisticsResult as b,createUVResult as x}from"../../../statistics/utils.js";let S=class extends f{constructor(e){super(e),this.adapterName=`ogc-feature-layer-adapter`}async _waitForLayerViewUpdate(e){if(!e)throw new n(`ogc-feature-layer-adapter:insufficient-data`,`layerView is required to fetch the features`);await r(()=>!e.updating)}async _summaryStatsFromClientQuery(e,t){let{signal:i,view:a}=e;if(!a)throw new n(`ogc-feature-layer-adapter:insufficient-data`,`view is required to fetch the features from layerView`);let s=p(this,e,t),c=await a.whenLayerView(this.layer);await r(()=>!c.updating,i);let l=await c.queryFeatures(s,{signal:i}),d=m(l,u(t)||o(t));return b(d,e.outStatisticTypes)}async _uvFromClientQuery(e,t){let{signal:i,view:a}=e;if(!a)throw new n(`ogc-feature-layer-adapter:insufficient-data`,`view is required to fetch the features from layerView`);let o=h(this,e),s=await a.whenLayerView(this.layer);await r(()=>!s.updating,i);let c=await s.queryFeatures(o,{signal:i}),l=await g(c,{layer:this,field:e.field,field2:e.field2,field3:e.field3,fieldDelimiter:d,view:e.view,signal:e.signal});return x(l,t,e.returnAllCodedValues,d)}summaryStatistics(e){let{field:t,valueExpression:r,sqlExpression:i,features:a,view:o}=e,s=t?this.getField(t):null,c=!!r,l=o?.type===`3d`;if(!r&&i&&!this.supportsSQLExpression)throw new n(`ogc-feature-layer-adapter:not-supported`,`Layer does not support standardized SQL expression for queries`);return c||a||l?this._summaryStatsFromMemory(e,s):this._summaryStatsFromClientQuery(e,s)}async uniqueValues(e){let{valueExpression:t,sqlExpression:r,features:i,view:a}=e,o=await _(e,this),s=!!t,c=a?.type===`3d`;if(!t&&r&&!this.supportsSQLExpression)throw new n(`ogc-feature-layer-adapter:not-supported`,`Layer does not support standardized SQL expression for queries`);return s||i||c?this._uvFromMemory(e,o):this._uvFromClientQuery(e,o)}histogram(e){let{features:t,valueExpression:r,normalizationType:i,sqlExpression:a}=e,o=t||!!r;if(!r&&a&&!this.supportsSQLExpression)throw new n(`ogc-feature-layer-adapter:not-supported`,`Layer does not support standardized SQL expression for queries`);return o||i?this._histogramFromMemory(e):this._histogramForField(e)}classBreaks(e){return e.analyzeData===!1?this._classBreaksFromInterpolation(e):this._classBreaksFromMemory(e)}async queryFeatureCount(e){let{whereClause:t,view:i,signal:a}=e;if(!i)throw new n(`ogc-feature-layer-adapter:insufficient-data`,`view is required to fetch the features from layerView`);let o=this.layer.createQuery();o.where=c(o.where,t);let s=await i.whenLayerView(this.layer);return await r(()=>!s.updating,a),s.queryFeatureCount(o,{signal:a})}generateRenderer(e,t){throw new n(`ogc-feature-layer-adapter:not-supported`,`OGCFeatureLayer does not support generateRenderer operation`)}async predominantCategories(e){let{fields:t,view:n,signal:r}=e,i=s(t),a=await this._uvFromMemory({valueExpression:i,view:n,signal:r});return v(a.uniqueValueInfos,t)}async getSampleFeatures(e,r){let{view:i,sampleSize:a,requiredFields:o,returnGeometry:s,signal:c}=e,l=this.layer.createQuery();if(l.outSpatialReference=i?.spatialReference,l.returnGeometry=!!s,l.outFields=o,!i)throw new n(`ogc-feature-layer-adapter:not-supported`,`view is required to get sample features for OGCFeatureLayer`);let u=await i.whenLayerView(this.layer);if(y(this,o,u).length)throw new n(`ogc-feature-layer-adapter:not-supported`,`Required fields need to be passed in the outFields for OGCFeatureLayer`);let d=await this._fetchFeaturesFromMemory(u,l,c,r),f=a!=null&&a>0&&a<=d.length?a:d.length;return t(d,f,1)}load(e){let t=this.layer.load(e).then(async t=>{this.geometryType=t.geometryType,this.objectIdField=t.objectIdField,this.supportsSQLExpression=t.capabilities?.query?.supportsSqlExpression,this.minScale=t.minScale,this.maxScale=t.maxScale,this.fullExtent=t.fullExtent,this.workerClient=l.getInstance(),await this.workerClient.open(e.signal)});return this.addResolvingPromise(t),Promise.resolve(this)}};e([i({readOnly:!0})],S.prototype,`adapterName`,void 0),S=e([a(`esri.smartMapping.support.adapters.OGCFeatureLayerAdapter`)],S);const C=S;export{C as default};
2
+ import{__decorate as e}from"tslib";import{pickRandom as t}from"../../../core/arrayUtils.js";import n from"../../../core/Error.js";import{whenOnce as r}from"../../../core/reactiveUtils.js";import{property as i,subclass as a}from"../../../core/accessorSupport/decorators.js";import{isTimeOnlyField as o}from"../../../layers/support/fieldUtils.js";import{getArcadeForPredominantCategory as s}from"../../statistics/support/predominanceUtils.js";import{mergeWhereClauses as c}from"../../statistics/support/utils.js";import{WorkerClient as l}from"../../statistics/support/WorkerClient.js";import{isAnyDateField as u,fieldDelimiter as d}from"../utils.js";import f from"./FeatureLayerAdapter.js";import{getSummaryStatsQuery as p,getSummaryStatisticsFromFeatureSet as m,getUVQuery as h,getUniqueValuesFromFeatureSet as g,getDomainsForFields as _,updateQueryWithFeatureFilter as v,getPredominantCategoriesFromUVInfos as y,getMissingFields as b}from"./support/utils.js";import{processSummaryStatisticsResult as x,createUVResult as S}from"../../../statistics/utils.js";let C=class extends f{constructor(e){super(e),this.adapterName=`ogc-feature-layer-adapter`}async _waitForLayerViewUpdate(e){if(!e)throw new n(`ogc-feature-layer-adapter:insufficient-data`,`layerView is required to fetch the features`);await r(()=>!e.updating)}async _summaryStatsFromClientQuery(e,t){let{signal:i,view:a}=e;if(!a)throw new n(`ogc-feature-layer-adapter:insufficient-data`,`view is required to fetch the features from layerView`);let s=p(this,e,t),c=await a.whenLayerView(this.layer);await r(()=>!c.updating,i);let l=await c.queryFeatures(s,{signal:i}),d=m(l,u(t)||o(t));return x(d,e.outStatisticTypes)}async _uvFromClientQuery(e,t){let{signal:i,view:a}=e;if(!a)throw new n(`ogc-feature-layer-adapter:insufficient-data`,`view is required to fetch the features from layerView`);let o=h(this,e),s=await a.whenLayerView(this.layer);await r(()=>!s.updating,i);let c=await s.queryFeatures(o,{signal:i}),l=await g(c,{layer:this,field:e.field,field2:e.field2,field3:e.field3,fieldDelimiter:d,filter:e.filter,view:e.view,signal:e.signal});return S(l,t,e.returnAllCodedValues,d)}summaryStatistics(e){let{field:t,valueExpression:r,sqlExpression:i,features:a,view:o}=e,s=t?this.getField(t):null,c=!!r,l=o?.type===`3d`;if(!r&&i&&!this.supportsSQLExpression)throw new n(`ogc-feature-layer-adapter:not-supported`,`Layer does not support standardized SQL expression for queries`);return c||a||l?this._summaryStatsFromMemory(e,s):this._summaryStatsFromClientQuery(e,s)}async uniqueValues(e){let{valueExpression:t,sqlExpression:r,features:i,view:a}=e,o=await _(e,this),s=!!t,c=a?.type===`3d`;if(!t&&r&&!this.supportsSQLExpression)throw new n(`ogc-feature-layer-adapter:not-supported`,`Layer does not support standardized SQL expression for queries`);return s||i||c?this._uvFromMemory(e,o):this._uvFromClientQuery(e,o)}histogram(e){let{features:t,valueExpression:r,normalizationType:i,sqlExpression:a}=e,o=t||!!r;if(!r&&a&&!this.supportsSQLExpression)throw new n(`ogc-feature-layer-adapter:not-supported`,`Layer does not support standardized SQL expression for queries`);return o||i?this._histogramFromMemory(e):this._histogramForField(e)}classBreaks(e){return e.analyzeData===!1?this._classBreaksFromInterpolation(e):this._classBreaksFromMemory(e)}async queryFeatureCount(e){let{whereClause:t,view:i,signal:a}=e;if(!i)throw new n(`ogc-feature-layer-adapter:insufficient-data`,`view is required to fetch the features from layerView`);let o=this.layer.createQuery();o.where=c(o.where,t),v(o,e.filter);let s=await i.whenLayerView(this.layer);return await r(()=>!s.updating,a),s.queryFeatureCount(o,{signal:a})}generateRenderer(e,t){throw new n(`ogc-feature-layer-adapter:not-supported`,`OGCFeatureLayer does not support generateRenderer operation`)}async predominantCategories(e){let{fields:t,view:n,signal:r}=e,i=s(t),a=await this._uvFromMemory({valueExpression:i,view:n,signal:r});return y(a.uniqueValueInfos,t)}async getSampleFeatures(e,r){let{view:i,sampleSize:a,requiredFields:o,returnGeometry:s,signal:c}=e,l=this.layer.createQuery();if(l.outSpatialReference=i?.spatialReference,l.returnGeometry=!!s,l.outFields=o,!i)throw new n(`ogc-feature-layer-adapter:not-supported`,`view is required to get sample features for OGCFeatureLayer`);let u=await i.whenLayerView(this.layer);if(b(this,o,u).length)throw new n(`ogc-feature-layer-adapter:not-supported`,`Required fields need to be passed in the outFields for OGCFeatureLayer`);let d=await this._fetchFeaturesFromMemory(u,l,c,r),f=a!=null&&a>0&&a<=d.length?a:d.length;return t(d,f,1)}load(e){let t=this.layer.load(e).then(async t=>{this.geometryType=t.geometryType,this.objectIdField=t.objectIdField,this.supportsSQLExpression=t.capabilities?.query?.supportsSqlExpression,this.minScale=t.minScale,this.maxScale=t.maxScale,this.fullExtent=t.fullExtent,this.workerClient=l.getInstance(),await this.workerClient.open(e.signal)});return this.addResolvingPromise(t),Promise.resolve(this)}};e([i({readOnly:!0})],C.prototype,`adapterName`,void 0),C=e([a(`esri.smartMapping.support.adapters.OGCFeatureLayerAdapter`)],C);const w=C;export{w 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{pickRandom as n}from"../../../core/arrayUtils.js";import r from"../../../core/Error.js";import{timeout as i,throwIfAborted as a}from"../../../core/promiseUtils.js";import{whenOnce as o}from"../../../core/reactiveUtils.js";import{property as s,subclass as c}from"../../../core/accessorSupport/decorators.js";import{kebabDict as l}from"../../../layers/support/fieldType.js";import{isNumericField as u}from"../../../layers/support/fieldUtils.js";import d from"../../../rest/support/FeatureSet.js";import{summaryStatistics as f,uniqueValues as p,classBreaks as m,histogram as h}from"../../statistics/support/statsWorker.js";import{WorkerClient as g}from"../../statistics/support/WorkerClient.js";import{getFieldsList as _,isAnyDateField as v,fieldDelimiter as y}from"../utils.js";import b from"./FeatureLayerAdapter.js";import x from"./LayerAdapter.js";import{getMissingFields as S,ensureFeaturesJSON as C,getViewInfoParams as w,getUniqueValuesFromFeatureSet as T,getHistogramFromFeatureSet as E,getDomainsForFields as D}from"./support/utils.js";import{createUVResult as O}from"../../../statistics/utils.js";let k=class extends x{constructor(e){super(e),this._featureLayerAdapter=null,this.workerClient=null,this.adapterName=`scene-layer-adapter`}destroy(){this.workerClient?.destroy()}_hasCachedStatistics(e){return this.layer.hasCachedStatistics(e)}_updateQuery(e,t=[],n=[]){if(!e||!n.length)return e;let r=this.layer.objectIdField,i=e.clone(),a=t.filter(e=>{let t=this.layer.getField(e);return!n.includes(t.name)});return i.outFields=a.some(e=>this.layer.getField(e).name===r)?a:[...a,r],i}async _fetchFeaturesFromMemory(e,t,n){if(!e)throw new r(`scene-layer-adapter:insufficient-data`,`view is required to fetch the features from layerView`);let s=await e.whenLayerView(this.layer),c=new AbortController,l=c.signal,u=o(()=>!s.updating,l);await i(u,5e3,c);let d=S(this,n,s);a(l);let f=this._updateQuery(t,n??[],d),p=await s.queryFeatures(f,{signal:l});a(l);let m=p.features;return d.length?s.whenGraphicAttributes(m,d):m}async _fetchFeaturesJSONFromMemory(e,t,n){return this._fetchFeaturesFromMemory(e,t,n).then(C)}_fetchFeaturesForStats(e,t){return _({field:e.field,normalizationField:e.normalizationField,valueExpression:e.valueExpression}).then(n=>this.getSampleFeatures({sampleSize:-1,view:e.view,returnGeometry:e.returnGeometry,requiredFields:n,signal:e.signal},t))}async _processStatsFromMemoryParams(e){let t=e.features;if(t?.length)return t.length&&`declaredClass`in t[0]&&t[0].declaredClass===`esri.Graphic`?{graphics:t}:{featuresJSON:t};let{view:n,field:i,normalizationField:a,valueExpression:o,signal:s}=e,c=await this._fetchFeaturesForStats({field:i,valueExpression:o,normalizationField:a,view:n,signal:s},null);if(!c?.length)throw new r(`scene-layer-adapter:insufficient-data`,`No features are available to calculate statistics`);return{graphics:c}}_getCachedStatistics(e,t){let n=this.layer;return e.valueExpression||e.sqlExpression||e.sqlWhere||e.minValue||e.maxValue?Promise.reject(new r(`scene-layer-adapter:not-supported`,`This Layer does not support calculating statistics when 'valueExpression', 'sqlExpression', 'sqlWhere', 'minValue' or 'maxValue' is specified`)):n.queryCachedStatistics(t?.name,{signal:e.signal}).then(e=>{let t=e.stats,{min:n,max:r,totalValuesCount:i}=t,{avg:a,stddev:o,sum:s,variance:c,count:l}=t;return(n!==0||r!==0)&&(a=a===0?null:a,s=s===0?null:s,o=o===0?null:o,c=c===0?null:c,l=l===0?null:l),l??(s!=null&&a!=null?l=Math.round(s/a):i!=null&&(l=i)),{avg:a,count:l,max:r,min:n,stddev:o,sum:s,variance:c}})}async _getNormalizationTotal(e,t,n){let i={include:[`sum`]},a=(t?await this.workerClient.summaryStatistics({field:e,outStatisticTypes:i},t):await f({attribute:{field:e,outStatisticTypes:i},features:n})).sum;if(a==null)throw new r(`scene-layer-adapter:invalid`,`invalid normalizationTotal`);return a}async _getSummaryStatisticsFromMemory(e,t){let{view:n,field:r,normalizationField:i,valueExpression:a}=e,{featuresJSON:o,graphics:s}=await this._processStatsFromMemoryParams(e),c={field:r,valueExpression:a,normalizationType:e.normalizationType,normalizationField:i,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue,outStatisticTypes:e.outStatisticTypes};return e.valueExpression&&n&&o&&(c.fieldType=t?.type?l.toJSON(t.type):null,c.viewInfoParams=w(n),c.timeZone=n.timeZone),e.normalizationType===`percent-of-total`&&e.normalizationTotal==null&&(c.normalizationTotal=await this._getNormalizationTotal(r,o,s)),o?this.workerClient.summaryStatistics(c,o):f({attribute:c,features:s})}_getCachedStatisticsForUniqueValues(e,n){let i=this.layer,a=n?.name,o=n&&e.field?this.getFieldDomain(e.field):null;return e.valueExpression||e.sqlExpression||e.sqlWhere?Promise.reject(new r(`scene-layer-adapter:not-supported`,`This Layer does not support calculating statistics when 'valueExpression', 'sqlExpression' or 'sqlWhere' is specified`)):i.queryCachedStatistics(a,{signal:e.signal}).then(r=>{let o=r.stats;if(!o.mostFrequentValues)throw Error();let s=r.labels?.labels,c={},l=[],f=`countOF`+a;o.mostFrequentValues.forEach(e=>{let r=new t({attributes:{}});r.attributes[a]=n&&n.name!==i.objectIdField&&(u(n)||v(n))?Number(e.value):e.value,r.attributes[f]=e.count,l.push(r)}),s&&s.forEach(e=>{c[e.value]=e.label});let p=new d({features:l});return T(p,{layer:this,field:e.field,labels:c,view:e.view,signal:e.signal})}).then(t=>O(t,[o],e.returnAllCodedValues))}async _getUniqueValuesFromMemory(e,t){let{view:n,field:r,field2:i,field3:a,valueExpression:o,returnAllCodedValues:s}=e,c={field:r,field2:i,field3:a,fieldDelimiter:y,valueExpression:o,domains:t,returnAllCodedValues:s},{featuresJSON:l,graphics:u}=await this._processStatsFromMemoryParams(e);return e.valueExpression&&n&&l&&(c.viewInfoParams=w(n),c.timeZone=n.timeZone),l?this.workerClient.uniqueValues(c,l):p({attribute:c,features:u})}_getCachedStatisticsForHistogram(e,t){let n=this.layer;return e.valueExpression||e.sqlExpression||e.sqlWhere||e.normalizationType?Promise.reject(new r(`scene-layer-adapter:not-supported`,`This Layer does not support calculating statistics when 'valueExpression' or 'sqlExpression' or 'sqlWhere' or 'normalizationType' is specified`)):n.queryCachedStatistics(t&&t.name,{signal:e.signal}).then(t=>{let n=t.stats,{minValue:r,maxValue:i}=e,a=r??n.min,o=i??n.max,s=e.numBins||10,c=A(n.histogram,a,o,s);return E(c,a,o,s)})}async _getClassBreaksFromMemory(e){let{view:t,field:n,normalizationField:r,valueExpression:i}=e,{featuresJSON:a,graphics:o}=await this._processStatsFromMemoryParams(e),s={field:n,valueExpression:i,normalizationType:e.normalizationType,normalizationField:r,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue,standardDeviationInterval:e.standardDeviationInterval,classificationMethod:e.classificationMethod,numClasses:e.numClasses};return e.valueExpression&&t&&a&&(s.viewInfoParams=w(t),s.timeZone=t.timeZone),e.normalizationType===`percent-of-total`&&e.normalizationTotal==null&&(s.normalizationTotal=await this._getNormalizationTotal(n,a,o)),a?this.workerClient.classBreaks(s,a):m({attribute:s,features:o})}async _getHistogramFromMemory(e){let{view:t,field:n}=e,{featuresJSON:r,graphics:i}=await this._processStatsFromMemoryParams(e),a={field:n,valueExpression:e.valueExpression,normalizationType:e.normalizationType,normalizationField:e.normalizationField,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue,standardDeviationInterval:e.standardDeviationInterval,classificationMethod:e.classificationMethod,numBins:e.numBins};return e.valueExpression&&t&&r&&(a.viewInfoParams=w(t),a.timeZone=t.timeZone),e.normalizationType===`percent-of-total`&&e.normalizationTotal==null&&(a.normalizationTotal=await this._getNormalizationTotal(n,r,i)),r?this.workerClient.histogram(a,r):h({attribute:a,features:i})}getField(e){return this.layer.getField(e??``)}getFieldUsageInfo(e){let t=this.getField(e);if(!t)return null;let n=this.layer.getFieldUsageInfo(t.name);return{supportsLabelingInfo:n.supportsLabelingInfo,supportsPopupTemplate:n.supportsPopupTemplate,supportsRenderer:n.supportsRenderer,supportsLayerQuery:n.supportsLayerQuery,supportsStatistics:!0}}getFieldDomain(e,t){return this._featureLayerAdapter?this._featureLayerAdapter.getFieldDomain(e,t):null}createQuery(){return this.layer.createQuery()}summaryStatistics(e){let t=this.getField(e.field);if(this._featureLayerAdapter)return this._featureLayerAdapter.summaryStatistics(e);if(e.filter)throw new r(`scene-layer-adapter:not-supported`,`filter is not supported`);return this._hasCachedStatistics(t?.name)?this._getCachedStatistics(e,t).catch(()=>(a(e.signal),this._getSummaryStatisticsFromMemory(e,t))):this._getSummaryStatisticsFromMemory(e,t)}async uniqueValues(e){if(this._featureLayerAdapter)return this._featureLayerAdapter.uniqueValues(e);if(e.filter)throw new r(`scene-layer-adapter:not-supported`,`filter is not supported`);let t=await D(e,this),{field:n,field2:i}=e,o=n&&i,s=this.getField(n);return!o&&s&&this._hasCachedStatistics(s.name)?this._getCachedStatisticsForUniqueValues(e,s).catch(()=>(a(e.signal),this._getUniqueValuesFromMemory(e,t))):this._getUniqueValuesFromMemory(e,t)}histogram(e){let t=this.getField(e.field);if(this._featureLayerAdapter)return this._featureLayerAdapter.histogram(e);if(e.filter)throw new r(`scene-layer-adapter:not-supported`,`filter is not supported`);return t&&this._hasCachedStatistics(t.name)?this._getCachedStatisticsForHistogram(e,t).catch(()=>(a(e.signal),this._getHistogramFromMemory(e))):this._getHistogramFromMemory(e)}classBreaks(e){let t=this.getField(e.field);if(this._featureLayerAdapter)return this._featureLayerAdapter.classBreaks(e);if(e.filter)throw new r(`scene-layer-adapter:not-supported`,`filter is not supported`);return this._hasCachedStatistics(t?.name)?Promise.reject(new r(`scene-layer-adapter:not-supported`,`Cached stats not supported`)):this._getClassBreaksFromMemory(e)}queryFeatureCount(e){return this._featureLayerAdapter?this._featureLayerAdapter.queryFeatureCount(e):Promise.reject(new r(`scene-layer-adapter:not-supported`,`SceneLayer without associated FeatureLayer does not support count query`))}generateRenderer(e,t){return this._featureLayerAdapter?this._featureLayerAdapter.generateRenderer(e,t):Promise.reject(new r(`scene-layer-adapter:not-supported`,`SceneLayer without associated FeatureLayer does not support generateRenderer operation`))}heatmapStatistics(e){return this._featureLayerAdapter?this._featureLayerAdapter.heatmapStatistics(e):Promise.reject(new r(`scene-layer-adapter:not-supported`,`SceneLayer without associated FeatureLayer does not support heatmapStatistics operation`))}async predominantCategories(e){if(this._featureLayerAdapter)return this._featureLayerAdapter.predominantCategories(e);throw new r(`scene-layer-adapter:not-supported`,`SceneLayer without associated FeatureLayer does not support predominantCategories`)}async getSampleFeatures(e,t){if(e.filter)throw new r(`scene-layer-adapter:not-supported`,`filter is not supported`);let{view:i,sampleSize:o,requiredFields:s,returnGeometry:c,signal:l}=e,u=t===`json`,d=this.createQuery();d.outFields=s,d.returnGeometry=!!c,d.where=null,d.num=o;let f=[];try{if(f=u?await this._fetchFeaturesJSONFromMemory(i,d,s):await this._fetchFeaturesFromMemory(i,d,s),f.length&&o!=null&&o>0&&o<=f.length)return n(f,o,1)}catch{a(l)}let p=null;if(this._featureLayerAdapter){let n={...e};delete n.view,p=await this._featureLayerAdapter.getSampleFeatures(n,t)}return p?.length?p:n(f,f.length,1)}load(e){let t=this.layer.load(e).then(async t=>{this.workerClient=g.getInstance(),await this.workerClient.open(e.signal);let n=t.associatedLayer;if(this.geometryType=t.geometryType,n!=null)return this._featureLayerAdapter=new b({layer:n}),this._featureLayerAdapter.load(e).then(()=>{this.objectIdField=this._featureLayerAdapter.objectIdField,this.supportsSQLExpression=this._featureLayerAdapter.supportsSQLExpression,this.minScale=this._featureLayerAdapter.minScale,this.maxScale=this._featureLayerAdapter.maxScale,this.fullExtent=this._featureLayerAdapter.fullExtent});this.objectIdField=t.objectIdField,this.supportsSQLExpression=!1,this.hasQueryEngine=!1,this.fullExtent=t.fullExtent});return this.addResolvingPromise(t),Promise.resolve(this)}};e([s({readOnly:!0})],k.prototype,`adapterName`,void 0),e([s({constructOnly:!0})],k.prototype,`layer`,void 0),k=e([c(`esri.smartMapping.support.adapters.SceneLayerAdapter`)],k);function A(e,n=e.minimum,r=e.maximum,i){let a=[];for(let e=0;e<i;e++)a[e]=0;let o=e.counts.length,s=e.minimum,c=e.maximum;for(let t=0;t<o;t++){let l=(t+.5)/o,u=((1-l)*s+l*c-n)/(r-n)*i;u>=0&&u<=i&&(a[u===i?i-1:Math.floor(u)]+=e.counts[t])}let l=[];return a.forEach((e,n)=>{let r=new t({attributes:{}});r.attributes.EXPR_1=n+1,r.attributes.countOFExpr=e,l.push(r)}),new d({features:l})}export{k as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import{pickRandom as n}from"../../../core/arrayUtils.js";import r from"../../../core/Error.js";import{timeout as i,throwIfAborted as a}from"../../../core/promiseUtils.js";import{whenOnce as o}from"../../../core/reactiveUtils.js";import{property as s,subclass as c}from"../../../core/accessorSupport/decorators.js";import{kebabDict as l}from"../../../layers/support/fieldType.js";import{isNumericField as u}from"../../../layers/support/fieldUtils.js";import d from"../../../rest/support/FeatureSet.js";import{summaryStatistics as f,uniqueValues as p,classBreaks as m,histogram as h}from"../../statistics/support/statsWorker.js";import{WorkerClient as g}from"../../statistics/support/WorkerClient.js";import{getFieldsList as _,isAnyDateField as v,fieldDelimiter as y}from"../utils.js";import b from"./FeatureLayerAdapter.js";import x from"./LayerAdapter.js";import{getMissingFields as S,ensureFeaturesJSON as C,getViewInfoParams as w,getUniqueValuesFromFeatureSet as T,getHistogramFromFeatureSet as E,getDomainsForFields as D}from"./support/utils.js";import{createUVResult as O}from"../../../statistics/utils.js";let k=class extends x{constructor(e){super(e),this._featureLayerAdapter=null,this.workerClient=null,this.adapterName=`scene-layer-adapter`}destroy(){this.workerClient?.destroy()}_hasCachedStatistics(e){return this.layer.hasCachedStatistics(e)}_updateQuery(e,t=[],n=[]){if(!e||!n.length)return e;let r=this.layer.objectIdField,i=e.clone(),a=t.filter(e=>{let t=this.layer.getField(e);return!n.includes(t.name)});return i.outFields=a.some(e=>this.layer.getField(e).name===r)?a:[...a,r],i}async _fetchFeaturesFromMemory(e,t,n){if(!e)throw new r(`scene-layer-adapter:insufficient-data`,`view is required to fetch the features from layerView`);let s=await e.whenLayerView(this.layer),c=new AbortController,l=c.signal,u=o(()=>!s.updating,l);await i(u,5e3,c);let d=S(this,n,s);a(l);let f=this._updateQuery(t,n??[],d),p=await s.queryFeatures(f,{signal:l});a(l);let m=p.features;return d.length?s.whenGraphicAttributes(m,d):m}async _fetchFeaturesJSONFromMemory(e,t,n){return this._fetchFeaturesFromMemory(e,t,n).then(C)}_fetchFeaturesForStats(e,t){return _({field:e.field,normalizationField:e.normalizationField,valueExpression:e.valueExpression}).then(n=>this.getSampleFeatures({sampleSize:-1,view:e.view,returnGeometry:e.returnGeometry,requiredFields:n,signal:e.signal},t))}async _processStatsFromMemoryParams(e){let t=e.features;if(t?.length)return t.length&&`declaredClass`in t[0]&&t[0].declaredClass===`esri.Graphic`?{graphics:t}:{featuresJSON:t};let{view:n,field:i,normalizationField:a,valueExpression:o,signal:s}=e,c=await this._fetchFeaturesForStats({field:i,valueExpression:o,normalizationField:a,view:n,signal:s},null);if(!c?.length)throw new r(`scene-layer-adapter:insufficient-data`,`No features are available to calculate statistics`);return{graphics:c}}_getCachedStatistics(e,t){let n=this.layer;return e.valueExpression||e.sqlExpression||e.sqlWhere||e.minValue||e.maxValue?Promise.reject(new r(`scene-layer-adapter:not-supported`,`This Layer does not support calculating statistics when 'valueExpression', 'sqlExpression', 'sqlWhere', 'minValue' or 'maxValue' is specified`)):n.queryCachedStatistics(t?.name,{signal:e.signal}).then(e=>{let t=e.stats,{min:n,max:r,totalValuesCount:i}=t,{avg:a,stddev:o,sum:s,variance:c,count:l}=t;return(n!==0||r!==0)&&(a=a===0?null:a,s=s===0?null:s,o=o===0?null:o,c=c===0?null:c,l=l===0?null:l),l??(s!=null&&a!=null?l=Math.round(s/a):i!=null&&(l=i)),{avg:a,count:l,max:r,min:n,stddev:o,sum:s,variance:c}})}async _getNormalizationTotal(e,t,n){let i={include:[`sum`]},a=(t?await this.workerClient.summaryStatistics({field:e,outStatisticTypes:i},t):await f({attribute:{field:e,outStatisticTypes:i},features:n})).sum;if(a==null)throw new r(`scene-layer-adapter:invalid`,`invalid normalizationTotal`);return a}async _getSummaryStatisticsFromMemory(e,t){let{view:n,field:r,normalizationField:i,valueExpression:a}=e,{featuresJSON:o,graphics:s}=await this._processStatsFromMemoryParams(e),c={field:r,valueExpression:a,normalizationType:e.normalizationType,normalizationField:i,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue,outStatisticTypes:e.outStatisticTypes};return e.valueExpression&&n&&o&&(c.fieldType=t?.type?l.toJSON(t.type):null,c.viewInfoParams=w(n),c.timeZone=n.timeZone),e.normalizationType===`percent-of-total`&&e.normalizationTotal==null&&(c.normalizationTotal=await this._getNormalizationTotal(r,o,s)),o?this.workerClient.summaryStatistics(c,o):f({attribute:c,features:s})}_getCachedStatisticsForUniqueValues(e,n){let i=this.layer,a=n?.name,o=n&&e.field?this.getFieldDomain(e.field):null;return e.valueExpression||e.sqlExpression||e.sqlWhere?Promise.reject(new r(`scene-layer-adapter:not-supported`,`This Layer does not support calculating statistics when 'valueExpression', 'sqlExpression' or 'sqlWhere' is specified`)):i.queryCachedStatistics(a,{signal:e.signal}).then(r=>{let o=r.stats;if(!o.mostFrequentValues)throw Error();let s=r.labels?.labels,c={},l=[],f=`countOF`+a;o.mostFrequentValues.forEach(e=>{let r=new t({attributes:{}});r.attributes[a]=n&&n.name!==i.objectIdField&&(u(n)||v(n))?Number(e.value):e.value,r.attributes[f]=e.count,l.push(r)}),s&&s.forEach(e=>{c[e.value]=e.label});let p=new d({features:l});return T(p,{layer:this,field:e.field,labels:c,filter:e.filter,view:e.view,signal:e.signal})}).then(t=>O(t,[o],e.returnAllCodedValues))}async _getUniqueValuesFromMemory(e,t){let{view:n,field:r,field2:i,field3:a,valueExpression:o,returnAllCodedValues:s}=e,c={field:r,field2:i,field3:a,fieldDelimiter:y,valueExpression:o,domains:t,returnAllCodedValues:s},{featuresJSON:l,graphics:u}=await this._processStatsFromMemoryParams(e);return e.valueExpression&&n&&l&&(c.viewInfoParams=w(n),c.timeZone=n.timeZone),l?this.workerClient.uniqueValues(c,l):p({attribute:c,features:u})}_getCachedStatisticsForHistogram(e,t){let n=this.layer;return e.valueExpression||e.sqlExpression||e.sqlWhere||e.normalizationType?Promise.reject(new r(`scene-layer-adapter:not-supported`,`This Layer does not support calculating statistics when 'valueExpression' or 'sqlExpression' or 'sqlWhere' or 'normalizationType' is specified`)):n.queryCachedStatistics(t&&t.name,{signal:e.signal}).then(t=>{let n=t.stats,{minValue:r,maxValue:i}=e,a=r??n.min,o=i??n.max,s=e.numBins||10,c=A(n.histogram,a,o,s);return E(c,a,o,s)})}async _getClassBreaksFromMemory(e){let{view:t,field:n,normalizationField:r,valueExpression:i}=e,{featuresJSON:a,graphics:o}=await this._processStatsFromMemoryParams(e),s={field:n,valueExpression:i,normalizationType:e.normalizationType,normalizationField:r,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue,standardDeviationInterval:e.standardDeviationInterval,classificationMethod:e.classificationMethod,numClasses:e.numClasses};return e.valueExpression&&t&&a&&(s.viewInfoParams=w(t),s.timeZone=t.timeZone),e.normalizationType===`percent-of-total`&&e.normalizationTotal==null&&(s.normalizationTotal=await this._getNormalizationTotal(n,a,o)),a?this.workerClient.classBreaks(s,a):m({attribute:s,features:o})}async _getHistogramFromMemory(e){let{view:t,field:n}=e,{featuresJSON:r,graphics:i}=await this._processStatsFromMemoryParams(e),a={field:n,valueExpression:e.valueExpression,normalizationType:e.normalizationType,normalizationField:e.normalizationField,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue,standardDeviationInterval:e.standardDeviationInterval,classificationMethod:e.classificationMethod,numBins:e.numBins};return e.valueExpression&&t&&r&&(a.viewInfoParams=w(t),a.timeZone=t.timeZone),e.normalizationType===`percent-of-total`&&e.normalizationTotal==null&&(a.normalizationTotal=await this._getNormalizationTotal(n,r,i)),r?this.workerClient.histogram(a,r):h({attribute:a,features:i})}getField(e){return this.layer.getField(e??``)}getFieldUsageInfo(e){let t=this.getField(e);if(!t)return null;let n=this.layer.getFieldUsageInfo(t.name);return{supportsLabelingInfo:n.supportsLabelingInfo,supportsPopupTemplate:n.supportsPopupTemplate,supportsRenderer:n.supportsRenderer,supportsLayerQuery:n.supportsLayerQuery,supportsStatistics:!0}}getFieldDomain(e,t){return this._featureLayerAdapter?this._featureLayerAdapter.getFieldDomain(e,t):null}createQuery(){return this.layer.createQuery()}summaryStatistics(e){let t=this.getField(e.field);if(this._featureLayerAdapter)return this._featureLayerAdapter.summaryStatistics(e);if(e.filter)throw new r(`scene-layer-adapter:not-supported`,`filter is not supported`);return this._hasCachedStatistics(t?.name)?this._getCachedStatistics(e,t).catch(()=>(a(e.signal),this._getSummaryStatisticsFromMemory(e,t))):this._getSummaryStatisticsFromMemory(e,t)}async uniqueValues(e){if(this._featureLayerAdapter)return this._featureLayerAdapter.uniqueValues(e);if(e.filter)throw new r(`scene-layer-adapter:not-supported`,`filter is not supported`);let t=await D(e,this),{field:n,field2:i}=e,o=n&&i,s=this.getField(n);return!o&&s&&this._hasCachedStatistics(s.name)?this._getCachedStatisticsForUniqueValues(e,s).catch(()=>(a(e.signal),this._getUniqueValuesFromMemory(e,t))):this._getUniqueValuesFromMemory(e,t)}histogram(e){let t=this.getField(e.field);if(this._featureLayerAdapter)return this._featureLayerAdapter.histogram(e);if(e.filter)throw new r(`scene-layer-adapter:not-supported`,`filter is not supported`);return t&&this._hasCachedStatistics(t.name)?this._getCachedStatisticsForHistogram(e,t).catch(()=>(a(e.signal),this._getHistogramFromMemory(e))):this._getHistogramFromMemory(e)}classBreaks(e){let t=this.getField(e.field);if(this._featureLayerAdapter)return this._featureLayerAdapter.classBreaks(e);if(e.filter)throw new r(`scene-layer-adapter:not-supported`,`filter is not supported`);return this._hasCachedStatistics(t?.name)?Promise.reject(new r(`scene-layer-adapter:not-supported`,`Cached stats not supported`)):this._getClassBreaksFromMemory(e)}queryFeatureCount(e){return this._featureLayerAdapter?this._featureLayerAdapter.queryFeatureCount(e):Promise.reject(new r(`scene-layer-adapter:not-supported`,`SceneLayer without associated FeatureLayer does not support count query`))}generateRenderer(e,t){return this._featureLayerAdapter?this._featureLayerAdapter.generateRenderer(e,t):Promise.reject(new r(`scene-layer-adapter:not-supported`,`SceneLayer without associated FeatureLayer does not support generateRenderer operation`))}heatmapStatistics(e){return this._featureLayerAdapter?this._featureLayerAdapter.heatmapStatistics(e):Promise.reject(new r(`scene-layer-adapter:not-supported`,`SceneLayer without associated FeatureLayer does not support heatmapStatistics operation`))}async predominantCategories(e){if(this._featureLayerAdapter)return this._featureLayerAdapter.predominantCategories(e);throw new r(`scene-layer-adapter:not-supported`,`SceneLayer without associated FeatureLayer does not support predominantCategories`)}async getSampleFeatures(e,t){if(e.filter)throw new r(`scene-layer-adapter:not-supported`,`filter is not supported`);let{view:i,sampleSize:o,requiredFields:s,returnGeometry:c,signal:l}=e,u=t===`json`,d=this.createQuery();d.outFields=s,d.returnGeometry=!!c,d.where=null,d.num=o;let f=[];try{if(f=u?await this._fetchFeaturesJSONFromMemory(i,d,s):await this._fetchFeaturesFromMemory(i,d,s),f.length&&o!=null&&o>0&&o<=f.length)return n(f,o,1)}catch{a(l)}let p=null;if(this._featureLayerAdapter){let n={...e};delete n.view,p=await this._featureLayerAdapter.getSampleFeatures(n,t)}return p?.length?p:n(f,f.length,1)}load(e){let t=this.layer.load(e).then(async t=>{this.workerClient=g.getInstance(),await this.workerClient.open(e.signal);let n=t.associatedLayer;if(this.geometryType=t.geometryType,n!=null)return this._featureLayerAdapter=new b({layer:n}),this._featureLayerAdapter.load(e).then(()=>{this.objectIdField=this._featureLayerAdapter.objectIdField,this.supportsSQLExpression=this._featureLayerAdapter.supportsSQLExpression,this.minScale=this._featureLayerAdapter.minScale,this.maxScale=this._featureLayerAdapter.maxScale,this.fullExtent=this._featureLayerAdapter.fullExtent});this.objectIdField=t.objectIdField,this.supportsSQLExpression=!1,this.hasQueryEngine=!1,this.fullExtent=t.fullExtent});return this.addResolvingPromise(t),Promise.resolve(this)}};e([s({readOnly:!0})],k.prototype,`adapterName`,void 0),e([s({constructOnly:!0})],k.prototype,`layer`,void 0),k=e([c(`esri.smartMapping.support.adapters.SceneLayerAdapter`)],k);function A(e,n=e.minimum,r=e.maximum,i){let a=[];for(let e=0;e<i;e++)a[e]=0;let o=e.counts.length,s=e.minimum,c=e.maximum;for(let t=0;t<o;t++){let l=(t+.5)/o,u=((1-l)*s+l*c-n)/(r-n)*i;u>=0&&u<=i&&(a[u===i?i-1:Math.floor(u)]+=e.counts[t])}let l=[];return a.forEach((e,n)=>{let r=new t({attributes:{}});r.attributes.EXPR_1=n+1,r.attributes.countOFExpr=e,l.push(r)}),new d({features:l})}export{k as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{isSome as e}from"../../../../core/arrayUtils.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import n from"../../../../layers/support/CodedValue.js";import r from"../../../../layers/support/CodedValueDomain.js";import i from"../../../../layers/support/Field.js";import{isStringField as a,isTimeOnlyField as o,getAggregateFieldType as s}from"../../../../layers/support/fieldUtils.js";import c from"../../../../rest/support/PivotQuery.js";import l from"../../../../rest/support/StatisticDefinition.js";import u from"../../../../rest/support/UnPivotDefinition.js";import{noDominantCategoryField as d}from"../../../statistics/support/predominanceUtils.js";import{getSQLFilterForNormalization as f,mergeWhereClauses as p,getRangeExpr as m}from"../../../statistics/support/utils.js";import{isIntegerField as h,isAnyDateField as g,getDateDiffSQL as _,castIntegerFieldToFloat as v}from"../../utils.js";import{isNullCountSupported as y,statisticTypes as b,getEqualIntervalBins as x,processNullValue as S}from"../../../../statistics/utils.js";const C=/_value$/i,w=Math.LOG10E,T={SECOND:1e3,MINUTE:6e4,HOUR:36e5},E=10;function D(e){return e.map(e=>e.toJSON())}function O(e,t){let n=[],r=e.layer,i=`featureReduction`in r?r.featureReduction:null,a=i?.type===`binning`,o=i!=null&&`fields`in i?i.fields?.map(e=>e.name?.toLowerCase()).filter(Boolean):[];if(!a||!t)return n;for(let e of t)o.includes(e.toLowerCase())||n.push(e);return n}function k(e,t,n){let r=[];if(t)for(let i of t){let t=e.getField(i);t&&n&&`availableFields`in n&&!n.availableFields?.includes(t.name)&&r.push(t.name)}return r}function A(e,t){let n=e&&e.features;if(n?.length===0)return{avg:null,count:0,max:null,median:null,min:null,nullcount:0,stddev:null,sum:null,variance:null};let r=n?.[0]?.attributes,i={};for(let e in r)i[e.replace(C,``).toLowerCase()]=r[e];return i.totalcount!=null&&i.totalcount>=i.count&&(i.nullcount=i.totalcount-i.count),delete i.totalcount,i.min===i.max&&i.min!=null&&i.stddev==null&&(i.stddev=i.variance=0),t&&([`min`,`max`,`avg`,`stddev`,`sum`,`variance`].forEach(e=>{i[e]!=null&&(i[e]=Math.ceil(i[e]))}),i.min===i.max&&i.min!=null&&(i.avg=i.min,i.stddev=i.variance=0)),i}function j(e){let t=[],n=e.classBreaks,r=n[0].minValue,i=n[n.length-1].maxValue;return n.forEach(e=>{t.push([e.minValue,e.maxValue])}),{min:r,max:i,intervals:t,sqlExpr:M({field:e.field,normalizationType:e.normalizationType,normalizationField:e.normalizationField,normalizationTotal:e.normalizationTotal,layer:e.layer}),excludeZerosExpr:e.where,normTotal:e.normalizationTotal}}function M(e){let{field:t,normalizationType:n,normalizationField:r,normalizationTotal:i,layer:a}=e,o=h(a,t),s=t;return n===`percent-of-total`?s=`((${o?v(t):t} / ${i}) * 100)`:n===`log`?s=`(log(${t}) * ${w})`:n===`field`?s=`(${o?v(t):t} / ${r})`:n===`natural-log`?s=`(log(${o?v(t):t}))`:n===`square-root`&&(s=`(power(${o?v(t):t}, 0.5))`),s}function N(e,t){let n;if(t=t.toLowerCase(),e){for(let r in e)if(r.toLowerCase()!==t){n=e[r];break}}return n}function P(e,t){let n;if(t=t.toLowerCase(),e){for(let r in e)if(r.toLowerCase()===t){n=e[r];break}}return n}function F(e,t,n,r,i){let a={},o=`countOFExpr`;e&&e.features&&e.features.forEach(e=>{let t=e.attributes,n=N(t,o),r=P(t,o);n!=null&&r!=null&&n!==0&&(a[n]=r)});let s=[];return x(t,n,r).forEach((e,t)=>{let n=(t+1).toString();s.push({minValue:e[0],maxValue:e[1],count:a.hasOwnProperty(n)?a[n]:0})}),{bins:s,minValue:t,maxValue:n,normalizationTotal:i}}async function I(e,n){let r=e&&e.features,{field:i,field2:a,field3:o,fieldDelimiter:s,layer:c,view:l,signal:u,labels:d}=n,f=`countOF${i&&a?`Expr`:i||`Expr`}`,p={},m=!1;for(let e of r){let t=e.attributes,n=P(t,f),r=i?P(t,i):N(t,f),c=a?P(t,a):null,l=o?P(t,o):null;r===null&&n===0&&(m=!0),(r==null||typeof r==`string`&&r.trim()===``)&&(r=null),a&&(c==null||typeof c==`string`&&c.trim()===``)&&(c=null),o&&(l==null||typeof l==`string`&&l.trim()===``)&&(l=null);let u=r;a&&(u=`${S(u)}${s}${S(c)}`,o&&(u=`${u}${s}${S(l)}`)),p[u]==null?p[u]={count:n,data:u}:p[u].count=p[u].count+n}if(i&&m){let e=i+` is NULL`;try{let t=await c.queryFeatureCount({whereClause:e,view:l,signal:u});return p.null.count=p.null.count+t,L(p,d)}catch{return t(u),L(p,d)}}return L(p,d)}function L(e,t){if(t)for(let n in e)e[n].label=t[n];return{count:e}}async function R(e,t,i){let a=e?i.getField(e):null,o=a?i.getFieldDomain(a.name):null;if(o)return o;let{uniqueValueInfos:s}=await i.uniqueValues({field:e,sqlWhere:t.sqlWhere,features:t.features,useFeaturesInView:t.useFeaturesInView,view:t.view,signal:t.signal}),c=s.map(e=>new n({code:e.value}));return new r({codedValues:c})}async function z(e,t){if(!e.returnAllCodedValues)return[];let{field:n,field2:r,field3:i}=e;if(n&&!r){let e=n?t.getField(n):null,r=e?t.getFieldDomain(e.name):null;return r?[r]:[]}let a=[];return n&&(a.push(R(n,e,t)),r&&(a.push(R(r,e,t)),i&&a.push(R(i,e,t)))),Promise.all(a)}function B(e,t){return _(e,new Date(0),t,`milliseconds`).sqlExpression}function V(e,t){return`EXTRACT(${t} FROM ${e}) * ${T[t]}`}function H(e){return e?v([`HOUR`,`MINUTE`,`SECOND`].map(t=>`(${V(e,t)})`).join(` + `)):null}function U(e){return{viewingMode:e.type===`2d`?`map`:e.viewingMode,scale:e.scale,spatialReference:e.spatialReference?.toJSON()}}function W(e,t){let n=new Set(e.map(e=>e.value)),r=t.filter(e=>!n.has(e));for(let t of r)e.push({value:t,count:0});e.sort((e,n)=>t.indexOf(e.value)-t.indexOf(n.value));for(let t of e)t.value===d&&(t.value=null);return{predominantCategoryInfos:e}}function G(t){let n=`featureReduction`in t?t.featureReduction:null;return((n!=null&&`fields`in n?n.fields:null)??[]).map(e=>{let n=s(e,t.fieldsIndex);return n?new i({type:n,name:e.name,alias:e.alias}):null}).filter(e)}function K(e,t){return g(t)?B(e,t?.name):o(t)?H(t?.name):null}function q(e,t,n){let r=null;for(let i of n){let n=i?e.getField(i):null,a=Y(e,{...t,field:i,outStatisticTypes:{include:[`min`,`max`,`sum`,`count`]}},n,!0,!0);r?r.outStatistics=r.outStatistics.concat(a.outStatistics):r=a}return r.where=e.createQuery()?.where,r}function J(e,t,n,r){return t.map(t=>{let i=new l,a=null,o=null,s=`${t}_value${r?`_${r}`:``}`;if(t===`variance`)a=`var`,o=n;else if(t===`nullcount`){let t=e.objectIdField;a=`count`,o=t&&e.getField(t)?t:`1`,s=`totalcount_value`}else t===`median`?(a=`percentile-continuous`,o=n,i.statisticParameters={value:.5}):(a=t,o=n);return i.statisticType=a,i.onStatisticField=o,i.outStatisticFieldName=s,i})}function Y(e,t,n,r=!0,i=!1){let{field:o,normalizationType:s,normalizationField:c,normalizationTotal:l,minValue:u,maxValue:d,filter:h}=t,g=e.supportsSQLExpression?K(e,n)||t.sqlExpression:null,_=M({field:o,normalizationType:s,normalizationField:c,normalizationTotal:l,layer:e}),v=g||_,x=v?m(v,u,d):null,S=f({field:o,normalizationField:c,normalizationType:s}),C=p(t.sqlWhere,S),w=p(C,x),T=y({normalizationField:c,normalizationType:s,sqlExpression:g,supportsSQLExpression:e.supportsSQLExpression,minValue:u,maxValue:d}),E=a(e.getField(o??void 0)),{include:D,exclude:O}=t.outStatisticTypes||{},k=b.filter(e=>(!D||D.includes(e))&&(!O||!O.includes(e))&&(e===`nullcount`?T:!E||e===`count`)&&(e!==`median`||r)),A=e.createQuery();return A.where=p(A.where,w),A.sqlFormat=g?`standard`:null,A.outStatistics=J(e,k,v,i?o:void 0),Z(A,h),A}function X(e,t,n=!0){let{fields:r,filter:i}=t,{include:a,exclude:o}=t.outStatisticTypes||{},s=b.filter(e=>(!a||a.includes(e))&&(!o||!o.includes(e))&&(e!==`median`||n)),l=new c;l.where=p(e.createQuery()?.where,t.sqlWhere)??void 0;let d=`new_value`;return l.outPivots=[new u({sourceFields:r,valueFieldName:d})],l.outStatistics=J(e,s,d),Z(l,i),l}function Z(e,t){t&&(e.geometry=t.geometry,e.spatialRelationship=t.spatialRelationship,e.timeExtent=e.timeExtent?.intersection(t.timeExtent)??t.timeExtent,e.distance=t.distance,e.units=t.units)}function Q(e,t){let{field:n,field2:r,field3:i,sqlExpression:a}=t,o=!!(n&&r),s=e.createQuery();return s.where=p(s.where,t.sqlWhere),s.sqlFormat=a?`standard`:null,s.outStatistics=[$(o?null:n,o?`1`:a)].filter(Boolean),s.groupByFieldsForStatistics=[n||a,r,i].filter(Boolean),Z(s,t.filter),s}function $(e,t){let n=`countOF`+(e||`Expr`),r=new l;return r.statisticType=`count`,r.onStatisticField=t?`1`:e,r.outStatisticFieldName=n,r}function ee(e,t,n,r=10,i,a,o){let{min:s,max:c,normTotal:l,excludeZerosExpr:u}=t,d=t.intervals||x(s,c,r);return te(e,d,t.sqlExpr||n,u,i,a,o).then(e=>({bins:e.map((e,t)=>({minValue:d[t][0],maxValue:d[t][1],count:e.status===`fulfilled`?e.value:0})),minValue:s,maxValue:c,normalizationTotal:l}))}function te(e,t,n,r,i,a,o){let s=[],c=t.length;for(let e=0;e<c;e++){let i=p(r,p(n+` >= `+t[e][0],t[e][1]===null?``:n+(e===c-1?` <= `:` < `)+t[e][1]));s.push(i)}return Promise.allSettled(s.map(t=>e.queryFeatureCount({whereClause:t,view:i,filter:a,signal:o})))}export{E as defaultNumBins,D as ensureFeaturesJSON,j as generateBinParams,ee as getBins,z as getDomainsForFields,G as getFeatureReductionFields,M as getFieldExpr,F as getHistogramFromFeatureSet,k as getMissingFields,O as getMissingFieldsForBinning,W as getPredominantCategoriesFromUVInfos,K as getSQLExpressionForDateOrTimeField,A as getSummaryStatisticsFromFeatureSet,X as getSummaryStatsPivotQuery,Y as getSummaryStatsQuery,q as getSummaryStatsQueryForFields,Q as getUVQuery,I as getUniqueValuesFromFeatureSet,U as getViewInfoParams,H as msForTimeOnlyFieldSQL,B as msSinceUnixEpochSQL,Z as updateQueryWithFeatureFilter};
2
+ import{isSome as e}from"../../../../core/arrayUtils.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import n from"../../../../layers/support/CodedValue.js";import r from"../../../../layers/support/CodedValueDomain.js";import i from"../../../../layers/support/Field.js";import{isStringField as a,isTimeOnlyField as o,getAggregateFieldType as s}from"../../../../layers/support/fieldUtils.js";import c from"../../../../rest/support/PivotQuery.js";import l from"../../../../rest/support/StatisticDefinition.js";import u from"../../../../rest/support/UnPivotDefinition.js";import{noDominantCategoryField as d}from"../../../statistics/support/predominanceUtils.js";import{getSQLFilterForNormalization as f,mergeWhereClauses as p,getRangeExpr as m}from"../../../statistics/support/utils.js";import{isIntegerField as h,isAnyDateField as g,getDateDiffSQL as _,castIntegerFieldToFloat as v}from"../../utils.js";import{isNullCountSupported as y,statisticTypes as b,getEqualIntervalBins as x,processNullValue as S}from"../../../../statistics/utils.js";const C=/_value$/i,w=Math.LOG10E,T={SECOND:1e3,MINUTE:6e4,HOUR:36e5},E=10;function D(e){return e.map(e=>e.toJSON())}function O(e,t){let n=[],r=e.layer,i=`featureReduction`in r?r.featureReduction:null,a=i?.type===`binning`,o=i!=null&&`fields`in i?i.fields?.map(e=>e.name?.toLowerCase()).filter(Boolean):[];if(!a||!t)return n;for(let e of t)o.includes(e.toLowerCase())||n.push(e);return n}function k(e,t,n){let r=[];if(t)for(let i of t){let t=e.getField(i);t&&n&&`availableFields`in n&&!n.availableFields?.includes(t.name)&&r.push(t.name)}return r}function A(e,t){let n=e&&e.features;if(n?.length===0)return{avg:null,count:0,max:null,median:null,min:null,nullcount:0,stddev:null,sum:null,variance:null};let r=n?.[0]?.attributes,i={};for(let e in r)i[e.replace(C,``).toLowerCase()]=r[e];return i.totalcount!=null&&i.totalcount>=i.count&&(i.nullcount=i.totalcount-i.count),delete i.totalcount,i.min===i.max&&i.min!=null&&i.stddev==null&&(i.stddev=i.variance=0),t&&([`min`,`max`,`avg`,`stddev`,`sum`,`variance`].forEach(e=>{i[e]!=null&&(i[e]=Math.ceil(i[e]))}),i.min===i.max&&i.min!=null&&(i.avg=i.min,i.stddev=i.variance=0)),i}function j(e){let t=[],n=e.classBreaks,r=n[0].minValue,i=n[n.length-1].maxValue;return n.forEach(e=>{t.push([e.minValue,e.maxValue])}),{min:r,max:i,intervals:t,sqlExpr:M({field:e.field,normalizationType:e.normalizationType,normalizationField:e.normalizationField,normalizationTotal:e.normalizationTotal,layer:e.layer}),excludeZerosExpr:e.where,normTotal:e.normalizationTotal}}function M(e){let{field:t,normalizationType:n,normalizationField:r,normalizationTotal:i,layer:a}=e,o=h(a,t),s=t;return n===`percent-of-total`?s=`((${o?v(t):t} / ${i}) * 100)`:n===`log`?s=`(log(${t}) * ${w})`:n===`field`?s=`(${o?v(t):t} / ${r})`:n===`natural-log`?s=`(log(${o?v(t):t}))`:n===`square-root`&&(s=`(power(${o?v(t):t}, 0.5))`),s}function N(e,t){let n;if(t=t.toLowerCase(),e){for(let r in e)if(r.toLowerCase()!==t){n=e[r];break}}return n}function P(e,t){let n;if(t=t.toLowerCase(),e){for(let r in e)if(r.toLowerCase()===t){n=e[r];break}}return n}function F(e,t,n,r,i){let a={},o=`countOFExpr`;e&&e.features&&e.features.forEach(e=>{let t=e.attributes,n=N(t,o),r=P(t,o);n!=null&&r!=null&&n!==0&&(a[n]=r)});let s=[];return x(t,n,r).forEach((e,t)=>{let n=(t+1).toString();s.push({minValue:e[0],maxValue:e[1],count:a.hasOwnProperty(n)?a[n]:0})}),{bins:s,minValue:t,maxValue:n,normalizationTotal:i}}async function I(e,n){let r=e&&e.features,{field:i,field2:a,field3:o,fieldDelimiter:s,filter:c,layer:l,view:u,signal:d,labels:f}=n,p=`countOF${i&&a?`Expr`:i||`Expr`}`,m={},h=!1;for(let e of r){let t=e.attributes,n=P(t,p),r=i?P(t,i):N(t,p),c=a?P(t,a):null,l=o?P(t,o):null;r===null&&n===0&&(h=!0),(r==null||typeof r==`string`&&r.trim()===``)&&(r=null),a&&(c==null||typeof c==`string`&&c.trim()===``)&&(c=null),o&&(l==null||typeof l==`string`&&l.trim()===``)&&(l=null);let u=r;a&&(u=`${S(u)}${s}${S(c)}`,o&&(u=`${u}${s}${S(l)}`)),m[u]==null?m[u]={count:n,data:u}:m[u].count=m[u].count+n}if(i&&h){let e=i+` is NULL`;try{let t=await l.queryFeatureCount({whereClause:e,filter:c,view:u,signal:d});return m.null.count=m.null.count+t,L(m,f)}catch{return t(d),L(m,f)}}return L(m,f)}function L(e,t){if(t)for(let n in e)e[n].label=t[n];return{count:e}}async function R(e,t,i){let a=e?i.getField(e):null,o=a?i.getFieldDomain(a.name):null;if(o)return o;let{uniqueValueInfos:s}=await i.uniqueValues({field:e,sqlWhere:t.sqlWhere,features:t.features,useFeaturesInView:t.useFeaturesInView,view:t.view,signal:t.signal}),c=s.map(e=>new n({code:e.value}));return new r({codedValues:c})}async function z(e,t){if(!e.returnAllCodedValues)return[];let{field:n,field2:r,field3:i}=e;if(n&&!r){let e=n?t.getField(n):null,r=e?t.getFieldDomain(e.name):null;return r?[r]:[]}let a=[];return n&&(a.push(R(n,e,t)),r&&(a.push(R(r,e,t)),i&&a.push(R(i,e,t)))),Promise.all(a)}function B(e,t){return _(e,new Date(0),t,`milliseconds`).sqlExpression}function V(e,t){return`EXTRACT(${t} FROM ${e}) * ${T[t]}`}function H(e){return e?v([`HOUR`,`MINUTE`,`SECOND`].map(t=>`(${V(e,t)})`).join(` + `)):null}function U(e){return{viewingMode:e.type===`2d`?`map`:e.viewingMode,scale:e.scale,spatialReference:e.spatialReference?.toJSON()}}function W(e,t){let n=new Set(e.map(e=>e.value)),r=t.filter(e=>!n.has(e));for(let t of r)e.push({value:t,count:0});e.sort((e,n)=>t.indexOf(e.value)-t.indexOf(n.value));for(let t of e)t.value===d&&(t.value=null);return{predominantCategoryInfos:e}}function G(t){let n=`featureReduction`in t?t.featureReduction:null;return((n!=null&&`fields`in n?n.fields:null)??[]).map(e=>{let n=s(e,t.fieldsIndex);return n?new i({type:n,name:e.name,alias:e.alias}):null}).filter(e)}function K(e,t){return g(t)?B(e,t?.name):o(t)?H(t?.name):null}function q(e,t,n){let r=null;for(let i of n){let n=i?e.getField(i):null,a=Y(e,{...t,field:i,outStatisticTypes:{include:[`min`,`max`,`sum`,`count`]}},n,!0,!0);r?r.outStatistics=r.outStatistics.concat(a.outStatistics):r=a}return r.where=e.createQuery()?.where,r}function J(e,t,n,r){return t.map(t=>{let i=new l,a=null,o=null,s=`${t}_value${r?`_${r}`:``}`;if(t===`variance`)a=`var`,o=n;else if(t===`nullcount`){let t=e.objectIdField;a=`count`,o=t&&e.getField(t)?t:`1`,s=`totalcount_value`}else t===`median`?(a=`percentile-continuous`,o=n,i.statisticParameters={value:.5}):(a=t,o=n);return i.statisticType=a,i.onStatisticField=o,i.outStatisticFieldName=s,i})}function Y(e,t,n,r=!0,i=!1){let{field:o,normalizationType:s,normalizationField:c,normalizationTotal:l,minValue:u,maxValue:d,filter:h}=t,g=e.supportsSQLExpression?K(e,n)||t.sqlExpression:null,_=M({field:o,normalizationType:s,normalizationField:c,normalizationTotal:l,layer:e}),v=g||_,x=v?m(v,u,d):null,S=f({field:o,normalizationField:c,normalizationType:s}),C=p(t.sqlWhere,S),w=p(C,x),T=y({normalizationField:c,normalizationType:s,sqlExpression:g,supportsSQLExpression:e.supportsSQLExpression,minValue:u,maxValue:d}),E=a(e.getField(o??void 0)),{include:D,exclude:O}=t.outStatisticTypes||{},k=b.filter(e=>(!D||D.includes(e))&&(!O||!O.includes(e))&&(e===`nullcount`?T:!E||e===`count`)&&(e!==`median`||r)),A=e.createQuery();return A.where=p(A.where,w),A.sqlFormat=g?`standard`:null,A.outStatistics=J(e,k,v,i?o:void 0),Z(A,h),A}function X(e,t,n=!0){let{fields:r,filter:i}=t,{include:a,exclude:o}=t.outStatisticTypes||{},s=b.filter(e=>(!a||a.includes(e))&&(!o||!o.includes(e))&&(e!==`median`||n)),l=new c;l.where=p(e.createQuery()?.where,t.sqlWhere)??void 0;let d=`new_value`;return l.outPivots=[new u({sourceFields:r,valueFieldName:d})],l.outStatistics=J(e,s,d),Z(l,i),l}function Z(e,t){t&&(e.geometry=t.geometry,e.spatialRelationship=t.spatialRelationship,e.timeExtent=e.timeExtent?.intersection(t.timeExtent)??t.timeExtent,e.distance=t.distance,e.units=t.units)}function Q(e,t){let{field:n,field2:r,field3:i,sqlExpression:a}=t,o=!!(n&&r),s=e.createQuery();return s.where=p(s.where,t.sqlWhere),s.sqlFormat=a?`standard`:null,s.outStatistics=[$(o?null:n,o?`1`:a)].filter(Boolean),s.groupByFieldsForStatistics=[n||a,r,i].filter(Boolean),Z(s,t.filter),s}function $(e,t){let n=`countOF`+(e||`Expr`),r=new l;return r.statisticType=`count`,r.onStatisticField=t?`1`:e,r.outStatisticFieldName=n,r}function ee(e,t,n,r=10,i,a,o){let{min:s,max:c,normTotal:l,excludeZerosExpr:u}=t,d=t.intervals||x(s,c,r);return te(e,d,t.sqlExpr||n,u,i,a,o).then(e=>({bins:e.map((e,t)=>({minValue:d[t][0],maxValue:d[t][1],count:e.status===`fulfilled`?e.value:0})),minValue:s,maxValue:c,normalizationTotal:l}))}function te(e,t,n,r,i,a,o){let s=[],c=t.length;for(let e=0;e<c;e++){let i=p(r,p(n+` >= `+t[e][0],t[e][1]===null?``:n+(e===c-1?` <= `:` < `)+t[e][1]));s.push(i)}return Promise.allSettled(s.map(t=>e.queryFeatureCount({whereClause:t,view:i,filter:a,signal:o})))}export{E as defaultNumBins,D as ensureFeaturesJSON,j as generateBinParams,ee as getBins,z as getDomainsForFields,G as getFeatureReductionFields,M as getFieldExpr,F as getHistogramFromFeatureSet,k as getMissingFields,O as getMissingFieldsForBinning,W as getPredominantCategoriesFromUVInfos,K as getSQLExpressionForDateOrTimeField,A as getSummaryStatisticsFromFeatureSet,X as getSummaryStatsPivotQuery,Y as getSummaryStatsQuery,q as getSummaryStatsQueryForFields,Q as getUVQuery,I as getUniqueValuesFromFeatureSet,U as getViewInfoParams,H as msForTimeOnlyFieldSQL,B as msSinceUnixEpochSQL,Z as updateQueryWithFeatureFilter};