@arcgis/core 4.27.0-next.20230508 → 4.27.0-next.20230510

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 (400) hide show
  1. package/Graphic.js +1 -1
  2. package/WebScene.js +1 -1
  3. package/arcade/ArcadeDate.js +1 -1
  4. package/arcade/Attachment.js +1 -1
  5. package/arcade/Dictionary.js +1 -1
  6. package/arcade/Feature.js +1 -1
  7. package/arcade/arcadeAsyncRuntime.js +1 -1
  8. package/arcade/arcadeCompiler.js +1 -1
  9. package/arcade/arcadeRuntime.js +1 -1
  10. package/arcade/deepClone.js +5 -0
  11. package/arcade/featureSetUtils.js +1 -1
  12. package/arcade/featureset/actions/GroupBy.js +1 -1
  13. package/arcade/featureset/actions/OrderBy.js +1 -1
  14. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  15. package/arcade/featureset/sources/FeatureLayerMemory.js +1 -1
  16. package/arcade/functions/array.js +1 -1
  17. package/arcade/functions/convertdirection.js +1 -1
  18. package/arcade/functions/date.js +1 -1
  19. package/arcade/functions/featuresetbase.js +1 -1
  20. package/arcade/functions/featuresetgeom.js +1 -1
  21. package/arcade/functions/featuresetstats.js +1 -1
  22. package/arcade/functions/featuresetstring.js +1 -1
  23. package/arcade/functions/fieldStats.js +1 -1
  24. package/arcade/functions/geomasync.js +1 -1
  25. package/arcade/functions/geometry.js +1 -1
  26. package/arcade/functions/geomsync.js +1 -1
  27. package/arcade/functions/maths.js +1 -1
  28. package/arcade/functions/stats.js +1 -1
  29. package/arcade/functions/string.js +1 -1
  30. package/arcade/languageUtils.js +1 -1
  31. package/arcade/parser.js +1 -1
  32. package/arcade/treeAnalysis.js +1 -1
  33. package/arcade.js +1 -1
  34. package/assets/esri/core/workers/RemoteClient.js +1 -1
  35. package/assets/esri/core/workers/chunks/011b8d71a219b76aac16.js +1 -0
  36. package/assets/esri/core/workers/chunks/090e02948640e31336b2.js +1 -0
  37. package/assets/esri/core/workers/chunks/091a9f36e5e9e9dc1d9c.js +1 -0
  38. package/assets/esri/core/workers/chunks/0b918cb195bbcfa6717e.js +1 -0
  39. package/assets/esri/core/workers/chunks/1257825488d2494e901d.js +1 -0
  40. package/assets/esri/core/workers/chunks/163bf2e13abbdd298374.js +1 -0
  41. package/assets/esri/core/workers/chunks/17e57499ce801e1ec9d5.js +1 -0
  42. package/assets/esri/core/workers/chunks/{607281a575446be538ef.js → 1895c6fb8bccfd51a797.js} +1 -1
  43. package/assets/esri/core/workers/chunks/1d8f078a112b4eebe853.js +1 -0
  44. package/assets/esri/core/workers/chunks/1fc3b526e881ada30420.js +1 -0
  45. package/assets/esri/core/workers/chunks/1febd6a0e273ecb263f9.js +1 -0
  46. package/assets/esri/core/workers/chunks/2512fd48d231b392b023.js +1 -0
  47. package/assets/esri/core/workers/chunks/2653729023156eb4d084.js +1 -0
  48. package/assets/esri/core/workers/chunks/2accddbe7f6967200022.js +1 -0
  49. package/assets/esri/core/workers/chunks/2b31ae1f3e51df1e7dd2.js +1 -0
  50. package/assets/esri/core/workers/chunks/2bdc63395c7466ce1641.js +1 -0
  51. package/assets/esri/core/workers/chunks/2dbbc986f339742cdb43.js +1 -0
  52. package/assets/esri/core/workers/chunks/2fabd3121297c54dd8cb.js +1 -0
  53. package/assets/esri/core/workers/chunks/321cabbf7a9b963ef912.js +1 -0
  54. package/assets/esri/core/workers/chunks/329e9a5a76d53aab532f.js +1 -0
  55. package/assets/esri/core/workers/chunks/366dabaac9841f476e5a.js +1 -0
  56. package/assets/esri/core/workers/chunks/377a63f7e7d168419c8d.js +1 -0
  57. package/assets/esri/core/workers/chunks/3a658eb0bc632ff0d01c.js +1 -0
  58. package/assets/esri/core/workers/chunks/4350cf5e02c66ec66520.js +1 -0
  59. package/assets/esri/core/workers/chunks/45a4041881e6235d73a2.js +1 -0
  60. package/assets/esri/core/workers/chunks/{d244e50c981146f018d2.js → 4922a0fed7cbc6895882.js} +1 -1
  61. package/assets/esri/core/workers/chunks/495d6ff5dea55c7e8f94.js +1 -0
  62. package/assets/esri/core/workers/chunks/496ffb00d60d72c26f58.js +1 -0
  63. package/assets/esri/core/workers/chunks/4cfd702c317dd76b3af6.js +1 -0
  64. package/assets/esri/core/workers/chunks/50c52dd31acf223bfb77.js +1 -0
  65. package/assets/esri/core/workers/chunks/50e6bf76dcb372183824.js +1 -0
  66. package/assets/esri/core/workers/chunks/{0eb26c0191d624b9a128.js → 522660da4589739a70c3.js} +1 -1
  67. package/assets/esri/core/workers/chunks/528107548340cfc6a8f0.js +1 -0
  68. package/assets/esri/core/workers/chunks/59caf5d2b99ef99ceb60.js +1 -0
  69. package/assets/esri/core/workers/chunks/6188dbbc29710e388a88.js +1 -0
  70. package/assets/esri/core/workers/chunks/621c91af7c051d44d378.js +1 -0
  71. package/assets/esri/core/workers/chunks/630b3fca46208caf4190.js +1 -0
  72. package/assets/esri/core/workers/chunks/65cdf16070370f9fcf20.js +1 -0
  73. package/assets/esri/core/workers/chunks/{3125061c8dfd69e1ae3b.js → 696f652f3f620e38cccf.js} +1 -1
  74. package/assets/esri/core/workers/chunks/709d01c7512424348e74.js +1 -0
  75. package/assets/esri/core/workers/chunks/7a46cb0a194fbc35ff63.js +1 -0
  76. package/assets/esri/core/workers/chunks/{f833e547b8d038ffa677.js → 7acef6bf6878fe4246c8.js} +1 -1
  77. package/assets/esri/core/workers/chunks/{670e49f9f320cd7fa212.js → 7adf4753744534e26360.js} +1 -1
  78. package/assets/esri/core/workers/chunks/7bbdba52157da13a01fc.js +1 -0
  79. package/assets/esri/core/workers/chunks/7e194ad371cb027d290e.js +1 -0
  80. package/assets/esri/core/workers/chunks/7e84f8bec3c1e8dc308c.js +1 -0
  81. package/assets/esri/core/workers/chunks/{ac1064ace8ede6ff8c2e.js → 7ef100158ca28631fcaf.js} +1 -1
  82. package/assets/esri/core/workers/chunks/{2eb46a774013141cd453.js → 801d1f3b6b33bf918a17.js} +1 -1
  83. package/assets/esri/core/workers/chunks/8074e3b9a6c714f33fc4.js +1 -0
  84. package/assets/esri/core/workers/chunks/80e18a32d9e1a0631b39.js +1 -0
  85. package/assets/esri/core/workers/chunks/82e8d4a9da36c23aeddc.js +1 -0
  86. package/assets/esri/core/workers/chunks/{a4b38c652cd1c7877469.js → 892ffe40c098d023962f.js} +1 -1
  87. package/assets/esri/core/workers/chunks/8bf39a449811c0552709.js +1 -0
  88. package/assets/esri/core/workers/chunks/8c59eb36ccd391074f20.js +1 -0
  89. package/assets/esri/core/workers/chunks/8e86c17f695ccc1240e0.js +1 -0
  90. package/assets/esri/core/workers/chunks/8f95e3e9efa351e2c8b3.js +1 -0
  91. package/assets/esri/core/workers/chunks/8fc8040d6bcaff6228d9.js +1 -0
  92. package/assets/esri/core/workers/chunks/906d05065e0bacd4b31e.js +1 -0
  93. package/assets/esri/core/workers/chunks/932791c76053068e1604.js +1 -0
  94. package/assets/esri/core/workers/chunks/93ae83cd275580e83f90.js +1 -0
  95. package/assets/esri/core/workers/chunks/{46238d4a0a8e2338232c.js → 98a85832751cbb6b0d09.js} +1 -1
  96. package/assets/esri/core/workers/chunks/9de820b7df38b948c92b.js +1 -0
  97. package/assets/esri/core/workers/chunks/a31d482e222565e71a87.js +1 -0
  98. package/assets/esri/core/workers/chunks/{588c660bfe2b51eecaeb.js → a45586a103dbfaa8b76d.js} +1 -1
  99. package/assets/esri/core/workers/chunks/a5add51bd9028324de59.js +1 -0
  100. package/assets/esri/core/workers/chunks/a90192ac7d91c0140a4f.js +1 -0
  101. package/assets/esri/core/workers/chunks/abede19ab6f9cb03c251.js +1 -0
  102. package/assets/esri/core/workers/chunks/ad215f7279e6b0a0d6f3.js +1 -0
  103. package/assets/esri/core/workers/chunks/afbf2549e7f354ce6463.js +1 -0
  104. package/assets/esri/core/workers/chunks/b050d5361e0533cef47e.js +1 -0
  105. package/assets/esri/core/workers/chunks/b22263184f5e0792377d.js +1 -0
  106. package/assets/esri/core/workers/chunks/b81bb096ccfcea182cc1.js +1 -0
  107. package/assets/esri/core/workers/chunks/bd8d6d55719ce1096927.js +1 -0
  108. package/assets/esri/core/workers/chunks/{514346a7831c08ec7c1e.js → bff317b08e91414f6edc.js} +1 -1
  109. package/assets/esri/core/workers/chunks/c420ae8a852b9a82afc6.js +1 -0
  110. package/assets/esri/core/workers/chunks/c8264edb6bb4d296e3fc.js +1 -0
  111. package/assets/esri/core/workers/chunks/cf3dd5aad1d60ff1b0b6.js +1 -0
  112. package/assets/esri/core/workers/chunks/d05d9ddf244bb3dcbcaa.js +1 -0
  113. package/assets/esri/core/workers/chunks/d26eaac455346f4df51a.js +1 -0
  114. package/assets/esri/core/workers/chunks/d2a2a7ee27d503a9152f.js +1 -0
  115. package/assets/esri/core/workers/chunks/{48b85d28960de4f99deb.js → d3a6504fbaf555707c58.js} +1 -1
  116. package/assets/esri/core/workers/chunks/{f61b577428a26a58ae23.js → d981e2e90b8ce617116f.js} +1 -1
  117. package/assets/esri/core/workers/chunks/dd97140d603e2b14b768.js +1 -0
  118. package/assets/esri/core/workers/chunks/e2f4e1c4fe166d249b2e.js +1 -0
  119. package/assets/esri/core/workers/chunks/{777d71da60873a6cb76f.js → e40502d8c11403144837.js} +1 -1
  120. package/assets/esri/core/workers/chunks/e77a3a29ca500a23a6a9.js +1 -0
  121. package/assets/esri/core/workers/chunks/e7fdf72f321f7ed3acf7.js +1 -0
  122. package/assets/esri/core/workers/chunks/eca24f316629ad0c0609.js +1 -0
  123. package/assets/esri/core/workers/chunks/ecbd3cfbdf2a7942c933.js +1 -0
  124. package/assets/esri/core/workers/chunks/efb96aefe979a0f5c632.js +1 -0
  125. package/assets/esri/core/workers/chunks/f5de8d6e9deec58c7569.js +1 -0
  126. package/assets/esri/core/workers/chunks/f63a0b6c207f0ba38ffb.js +1 -0
  127. package/assets/esri/core/workers/chunks/f8805d6062b66f7c6092.js +1 -0
  128. package/assets/esri/core/workers/chunks/fc4f85da3c00b0daf0d5.js +1 -0
  129. package/assets/esri/core/workers/chunks/fdd7dc9566da13f5e659.js +1 -0
  130. package/assets/esri/core/workers/chunks/{fb6c1837830634f5f2ef.js → fdf64f23529a22c79fbd.js} +17 -17
  131. package/assets/esri/core/workers/chunks/ff4c261f916b86cb1ae7.js +1 -0
  132. package/assets/esri/libs/i3s/i3s.wasm +0 -0
  133. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core-simd.wasm +0 -0
  134. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core.wasm +0 -0
  135. package/assets/esri/themes/base/widgets/_FeatureForm.scss +25 -10
  136. package/assets/esri/themes/dark/main.css +1 -1
  137. package/assets/esri/themes/light/main.css +1 -1
  138. package/assets/esri/themes/light/view.css +1 -1
  139. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm.json +1 -1
  140. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_en.json +1 -1
  141. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology.json +1 -0
  142. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ar.json +1 -0
  143. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_bg.json +1 -0
  144. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_bs.json +1 -0
  145. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ca.json +1 -0
  146. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_cs.json +1 -0
  147. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_da.json +1 -0
  148. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_de.json +1 -0
  149. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_el.json +1 -0
  150. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_en.json +1 -0
  151. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_es.json +1 -0
  152. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_et.json +1 -0
  153. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_fi.json +1 -0
  154. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_fr.json +1 -0
  155. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_he.json +1 -0
  156. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_hr.json +1 -0
  157. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_hu.json +1 -0
  158. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_id.json +1 -0
  159. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_it.json +1 -0
  160. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ja.json +1 -0
  161. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ko.json +1 -0
  162. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_lt.json +1 -0
  163. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_lv.json +1 -0
  164. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_nb.json +1 -0
  165. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_nl.json +1 -0
  166. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_pl.json +1 -0
  167. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_pt-BR.json +1 -0
  168. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_pt-PT.json +1 -0
  169. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ro.json +1 -0
  170. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ru.json +1 -0
  171. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_sk.json +1 -0
  172. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_sl.json +1 -0
  173. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_sr.json +1 -0
  174. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_sv.json +1 -0
  175. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_th.json +1 -0
  176. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_tr.json +1 -0
  177. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_uk.json +1 -0
  178. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_vi.json +1 -0
  179. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_zh-CN.json +1 -0
  180. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_zh-HK.json +1 -0
  181. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_zh-TW.json +1 -0
  182. package/chunks/array.js +1 -1
  183. package/chunks/i3s.js +1 -1
  184. package/chunks/languageUtils.js +1 -1
  185. package/chunks/mat4.js +1 -1
  186. package/chunks/quat2.js +1 -1
  187. package/config.js +1 -1
  188. package/core/colorUtils.js +1 -1
  189. package/core/libs/gl-matrix-2/mat4.js +1 -1
  190. package/core/libs/gl-matrix-2/math/mat4.js +1 -1
  191. package/form/elements/RelationshipElement.js +1 -1
  192. package/interfaces.d.ts +106 -0
  193. package/layers/GroupLayer.js +1 -1
  194. package/layers/ImageryTileLayer.js +1 -1
  195. package/layers/LinkChartLayer.js +1 -1
  196. package/layers/SceneLayer.js +1 -1
  197. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  198. package/layers/graphics/data/AttributesBuilder.js +1 -1
  199. package/layers/graphics/data/QueryEngineResult.js +1 -1
  200. package/layers/graphics/sources/interfaces.js +5 -0
  201. package/layers/graphics/sources/support/uploadAssets.js +1 -1
  202. package/layers/graphics/sources/support/uploads.js +5 -0
  203. package/layers/support/TileInfo.js +1 -1
  204. package/layers/support/fieldUtils.js +1 -1
  205. package/layers/support/labelFormatUtils.js +1 -1
  206. package/package.json +1 -1
  207. package/portal/support/layersLoader.js +1 -1
  208. package/renderers/support/DictionaryLoader.js +1 -1
  209. package/rest/knowledgeGraph/GraphSearchStreaming.js +1 -1
  210. package/rest/knowledgeGraph/wasmInterface/WasmDataModelWrapperInterfaces.js +1 -1
  211. package/rest/knowledgeGraphService.js +1 -1
  212. package/rest/support/meshFeatureSet.js +1 -1
  213. package/rest/versionManagement/createVersion.js +1 -1
  214. package/rest/versionManagement/gdbVersion/support/PostParameters.js +1 -1
  215. package/rest/versionManagement/gdbVersion/support/ReconcileParameters.js +1 -1
  216. package/rest/versionManagement/getVersion.js +1 -1
  217. package/rest/versionManagement/getVersionInfos.js +1 -1
  218. package/smartMapping/support/adapters/InMemoryLayerAdapter.js +1 -1
  219. package/support/arcadeOnDemand.js +1 -1
  220. package/support/arcadeUtils.js +1 -1
  221. package/support/revision.js +1 -1
  222. package/support/tagSymbols.js +5 -0
  223. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  224. package/symbols/cim/CIMSymbolHelper.js +1 -1
  225. package/symbols/cim/CIMSymbolRasterizer.js +1 -1
  226. package/symbols/cim/TextRasterizer.js +1 -1
  227. package/symbols/cim/utils.js +1 -1
  228. package/symbols/support/previewSymbol2D.js +1 -1
  229. package/symbols/support/svgUtils.js +1 -1
  230. package/symbols/support/textUtils.js +1 -1
  231. package/versionManagement/VersionManagementService.js +1 -1
  232. package/views/2d/arcade/callExpressionWithCursor.js +1 -1
  233. package/views/2d/arcade/callExpressionWithFeature.js +1 -1
  234. package/views/2d/engine/vectorTiles/TileManager.js +1 -1
  235. package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
  236. package/views/2d/engine/webgl/brushes/WGLBrushInfo.js +1 -1
  237. package/views/2d/engine/webgl/mesh/templates/WGLBaseTextTemplate.js +1 -1
  238. package/views/2d/layers/MediaLayerView2D.js +1 -1
  239. package/views/2d/layers/TileLayerView2D.js +1 -1
  240. package/views/2d/layers/support/DebugOverlay.js +1 -1
  241. package/views/2d/tiling/TileInfoView.js +1 -1
  242. package/views/2d/tiling/TileInfoViewPOT.js +1 -1
  243. package/views/2d/tiling/TileManager.js +1 -1
  244. package/views/2d/tiling/TileStrategy.js +1 -1
  245. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  246. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  247. package/views/3d/interactive/editingTools/lineGraphicVisualElementUtils.js +1 -1
  248. package/views/3d/interactive/editingTools/manipulations/MoveXYAxisManipulation.js +1 -1
  249. package/views/3d/interactive/editingTools/manipulations/MoveXYDiscManipulation.js +1 -1
  250. package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
  251. package/views/3d/interactive/editingTools/manipulations/config.js +1 -1
  252. package/views/3d/interactive/editingTools/meshFastUpdateUtils.js +5 -0
  253. package/views/3d/interactive/editingTools/moveGraphic/GraphicMoveTool.js +1 -1
  254. package/views/3d/interactive/editingTools/originGraphicVisualElementUtils.js +1 -1
  255. package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
  256. package/views/3d/interactive/editingTools/settings.js +1 -1
  257. package/views/3d/interactive/editingTools/transformGraphic/ExtentTransformTool.js +1 -1
  258. package/views/3d/interactive/editingTools/transformGraphic/GraphicScaleRotateTransform.js +1 -1
  259. package/views/3d/interactive/editingTools/transformGraphic/GraphicTransformTool.js +1 -1
  260. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  261. package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
  262. package/views/3d/interactive/visualElements/VerticesVisualElement.js +1 -1
  263. package/views/3d/layers/I3SMeshView3D.js +1 -1
  264. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  265. package/views/3d/layers/SceneLayerView3D.js +1 -1
  266. package/views/3d/layers/SceneLayerWorker.js +1 -1
  267. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  268. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  269. package/views/3d/layers/graphics/Graphics3DMeshObject3DGraphicLayer.js +5 -0
  270. package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
  271. package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
  272. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  273. package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
  274. package/views/3d/layers/graphics/deconflictorDebug.js +1 -1
  275. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  276. package/views/3d/support/StreamTextureCollection.js +1 -1
  277. package/views/3d/support/TextureCollection.js +1 -1
  278. package/views/3d/terrain/PatchRenderData.js +1 -1
  279. package/views/3d/terrain/Tile.js +1 -1
  280. package/views/3d/terrain/TileTexture.js +1 -1
  281. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  282. package/views/3d/webgl-engine/lib/ModelDirtySet.js +1 -1
  283. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  284. package/views/3d/webgl-engine/lib/RenderTargetHelper.js +1 -1
  285. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  286. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  287. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  288. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  289. package/views/3d/webgl-engine/materials/ProceduralTextureRepository.js +1 -1
  290. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  291. package/views/draw/DrawOperation.js +1 -1
  292. package/views/interactive/SegmentLabels.js +1 -1
  293. package/views/interactive/dragEventPipeline.js +1 -1
  294. package/views/support/colorUtils.js +1 -1
  295. package/views/webgl/FramebufferObject.js +1 -1
  296. package/views/webgl/GLObjectType.js +5 -0
  297. package/views/webgl/Renderbuffer.js +1 -1
  298. package/views/webgl/RenderbufferDescriptor.js +1 -1
  299. package/views/webgl/Texture.js +1 -1
  300. package/views/webgl/TextureDescriptor.js +1 -1
  301. package/views/webgl/Util.js +1 -1
  302. package/widgets/Editor/EditorViewModel.js +1 -1
  303. package/widgets/Editor/UpdateWorkflow.js +1 -1
  304. package/widgets/ElevationProfile/support/InputRepresentation3D.js +1 -1
  305. package/widgets/Feature/FeatureMedia.js +1 -1
  306. package/widgets/Feature/FeatureRelationship/FeatureRelationshipViewModel.js +1 -1
  307. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  308. package/widgets/FeatureForm/FieldInput.js +1 -1
  309. package/widgets/FeatureForm/GroupInput.js +1 -1
  310. package/widgets/FeatureForm/RelationshipInput.js +5 -0
  311. package/widgets/FeatureForm/css.js +1 -1
  312. package/widgets/FeatureForm/featureFormUtils.js +1 -1
  313. package/widgets/FeatureForm.js +1 -1
  314. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  315. package/widgets/Sketch/SketchViewModel.js +1 -1
  316. package/assets/esri/core/workers/chunks/05aedc7af19c252ddf9d.js +0 -1
  317. package/assets/esri/core/workers/chunks/05dd706a9f7a022da7b1.js +0 -1
  318. package/assets/esri/core/workers/chunks/0ace9c0c0008ea8f9260.js +0 -1
  319. package/assets/esri/core/workers/chunks/0c1c173180d5cfb104df.js +0 -1
  320. package/assets/esri/core/workers/chunks/0d805fd9cd9ff3a636ca.js +0 -1
  321. package/assets/esri/core/workers/chunks/1055848fd62f8eb4bd67.js +0 -1
  322. package/assets/esri/core/workers/chunks/110160591e5bc5b876aa.js +0 -1
  323. package/assets/esri/core/workers/chunks/1117cc2a9bedad08c620.js +0 -1
  324. package/assets/esri/core/workers/chunks/13901c05ae18fc14a549.js +0 -1
  325. package/assets/esri/core/workers/chunks/17ebe76d4419fe69e13c.js +0 -1
  326. package/assets/esri/core/workers/chunks/17fcfafff87719e470f7.js +0 -1
  327. package/assets/esri/core/workers/chunks/19c1b6655a368504a468.js +0 -1
  328. package/assets/esri/core/workers/chunks/1a43f20703f0c692cb6b.js +0 -1
  329. package/assets/esri/core/workers/chunks/259d3d890f634fb0aba6.js +0 -1
  330. package/assets/esri/core/workers/chunks/29add41db6fe8def4217.js +0 -1
  331. package/assets/esri/core/workers/chunks/2bf63257cd4d0f37ef5d.js +0 -1
  332. package/assets/esri/core/workers/chunks/2c57d16d4aa0462150cf.js +0 -1
  333. package/assets/esri/core/workers/chunks/2e6b4ba63ebc9046ea3f.js +0 -1
  334. package/assets/esri/core/workers/chunks/3027e02a0e8e333acd14.js +0 -1
  335. package/assets/esri/core/workers/chunks/308f3811dfa71f619279.js +0 -1
  336. package/assets/esri/core/workers/chunks/3488af6cb628b9476beb.js +0 -1
  337. package/assets/esri/core/workers/chunks/3a0d1e09414794ec58ec.js +0 -1
  338. package/assets/esri/core/workers/chunks/3bbaa78c68a4bf159722.js +0 -1
  339. package/assets/esri/core/workers/chunks/3c3f65913006b84b2289.js +0 -1
  340. package/assets/esri/core/workers/chunks/3db373fb471c1e09e63b.js +0 -1
  341. package/assets/esri/core/workers/chunks/431d54867bc3bb848fbb.js +0 -1
  342. package/assets/esri/core/workers/chunks/4530327132b992cd5bfc.js +0 -1
  343. package/assets/esri/core/workers/chunks/46ed1a1b3b98959ad7d6.js +0 -1
  344. package/assets/esri/core/workers/chunks/47633db928084082a4c8.js +0 -1
  345. package/assets/esri/core/workers/chunks/4e759fefaf095fb15d76.js +0 -1
  346. package/assets/esri/core/workers/chunks/52f340cf381ecb40c177.js +0 -1
  347. package/assets/esri/core/workers/chunks/5564d87735a888aad626.js +0 -1
  348. package/assets/esri/core/workers/chunks/56e85620a173e608a478.js +0 -1
  349. package/assets/esri/core/workers/chunks/593915087f5ea649e7fa.js +0 -1
  350. package/assets/esri/core/workers/chunks/5b11c0edebb1ef0e629b.js +0 -1
  351. package/assets/esri/core/workers/chunks/5c64fd3bf057a1a5527f.js +0 -1
  352. package/assets/esri/core/workers/chunks/5e9e7c5dd7d7505b1d44.js +0 -1
  353. package/assets/esri/core/workers/chunks/5ff30154a319e3286ef5.js +0 -1
  354. package/assets/esri/core/workers/chunks/6053a78aef54b4a5b172.js +0 -1
  355. package/assets/esri/core/workers/chunks/63bfd2c57a15e4b8f0aa.js +0 -1
  356. package/assets/esri/core/workers/chunks/656320fa38c252390e03.js +0 -1
  357. package/assets/esri/core/workers/chunks/6a988f714a710a3c3656.js +0 -1
  358. package/assets/esri/core/workers/chunks/6b817ea3de7e29197bb6.js +0 -1
  359. package/assets/esri/core/workers/chunks/740dc67038f554431f1b.js +0 -1
  360. package/assets/esri/core/workers/chunks/7459f911d139aab26288.js +0 -1
  361. package/assets/esri/core/workers/chunks/771fe141356463061c50.js +0 -1
  362. package/assets/esri/core/workers/chunks/7c09aa9e5de660c4c37c.js +0 -1
  363. package/assets/esri/core/workers/chunks/7fe49c75681787c7f30f.js +0 -1
  364. package/assets/esri/core/workers/chunks/7fee1f710a74f5c84b1a.js +0 -1
  365. package/assets/esri/core/workers/chunks/8728087db9cb148e7b41.js +0 -1
  366. package/assets/esri/core/workers/chunks/88fdd288ef799a7ac48a.js +0 -1
  367. package/assets/esri/core/workers/chunks/89ea5c385f2dd916387d.js +0 -1
  368. package/assets/esri/core/workers/chunks/8b8468dc657ff1e9ecf1.js +0 -1
  369. package/assets/esri/core/workers/chunks/8d1e9630f86ab3dab4a6.js +0 -1
  370. package/assets/esri/core/workers/chunks/93b6769ac508c266ad5e.js +0 -1
  371. package/assets/esri/core/workers/chunks/9bb12f9ff458f1fd8ff3.js +0 -1
  372. package/assets/esri/core/workers/chunks/9c6967caa4a10bfc197c.js +0 -1
  373. package/assets/esri/core/workers/chunks/9e22a90115de672e7bb8.js +0 -1
  374. package/assets/esri/core/workers/chunks/9fe362d9452f0c744e49.js +0 -1
  375. package/assets/esri/core/workers/chunks/a1978bf3fec80c07798d.js +0 -1
  376. package/assets/esri/core/workers/chunks/a6ece91e6b3343f133a0.js +0 -1
  377. package/assets/esri/core/workers/chunks/b3c5066acb06e54fcede.js +0 -1
  378. package/assets/esri/core/workers/chunks/b793f003760442dca9d5.js +0 -1
  379. package/assets/esri/core/workers/chunks/bf1c92bd7b541db2e7f8.js +0 -1
  380. package/assets/esri/core/workers/chunks/c5ad289e8c52f3f42893.js +0 -1
  381. package/assets/esri/core/workers/chunks/c6dc595a89b454d9b20b.js +0 -1
  382. package/assets/esri/core/workers/chunks/ca0c5c945a374fdbd000.js +0 -1
  383. package/assets/esri/core/workers/chunks/ca3be824c256b5b47091.js +0 -1
  384. package/assets/esri/core/workers/chunks/cd088294601739a5b879.js +0 -1
  385. package/assets/esri/core/workers/chunks/d0ff496834686dbfe29f.js +0 -1
  386. package/assets/esri/core/workers/chunks/d5c8119d6d34628d3126.js +0 -1
  387. package/assets/esri/core/workers/chunks/d9c9bccdd8c116b401a8.js +0 -1
  388. package/assets/esri/core/workers/chunks/e3e286884cfb03a2c450.js +0 -1
  389. package/assets/esri/core/workers/chunks/e3eb1ccf5fde499cbfbf.js +0 -1
  390. package/assets/esri/core/workers/chunks/e8b944020675385ae064.js +0 -1
  391. package/assets/esri/core/workers/chunks/e8cb46da09853804b5e8.js +0 -1
  392. package/assets/esri/core/workers/chunks/ee2950e2504ef249632a.js +0 -1
  393. package/assets/esri/core/workers/chunks/f556490dae3c69419052.js +0 -1
  394. package/assets/esri/core/workers/chunks/f5b6d2b8c8a333bbebdc.js +0 -1
  395. package/assets/esri/core/workers/chunks/f5ec28d0754b2fccd1e5.js +0 -1
  396. package/assets/esri/core/workers/chunks/fa059d94d5051ded85b3.js +0 -1
  397. package/assets/esri/core/workers/chunks/fac717c2952d7a8ebd4c.js +0 -1
  398. package/assets/esri/core/workers/chunks/fd64f62a9bbf9e4341d4.js +0 -1
  399. package/versionManagement/GDBVersion.js +0 -5
  400. /package/views/3d/layers/i3s/{attributeEditing.js → featureEditing.js} +0 -0
package/Graphic.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"./chunks/tslib.es6.js";import{geometryTypes as e}from"./geometry.js";import r from"./PopupTemplate.js";import{symbolTypes as o}from"./symbols.js";import{ClonableMixin as s}from"./core/Clonable.js";import{JSONSupport as i}from"./core/JSONSupport.js";import{generateUID as l}from"./core/uid.js";import{property as p}from"./core/accessorSupport/decorators/property.js";import"./core/accessorSupport/ensureType.js";import"./core/arrayUtils.js";import"./core/has.js";import{subclass as a}from"./core/accessorSupport/decorators/subclass.js";import{fromJSON as u}from"./geometry/support/jsonUtils.js";function n(t){if(!t)return null;const e={};for(const r in t){const o=u(t[r]);o&&(e[r]=o)}return 0!==Object.keys(e).length?e:null}function y(t){if(null==t)return null;const e={};for(const r in t){const o=t[r];o&&(e[r]=o.toJSON())}return 0!==Object.keys(e).length?e:null}let m=class extends(s(i)){constructor(...t){super(...t),this.isAggregate=!1,this.layer=null,this.popupTemplate=null,this.sourceLayer=null,Object.defineProperty(this,"uid",{value:l(),configurable:!0})}normalizeCtorArgs(t,e,r,o){return t&&!t.declaredClass?t:{geometry:t,symbol:e,attributes:r,popupTemplate:o}}set aggregateGeometries(t){const e=this._get("aggregateGeometries");JSON.stringify(e)!==JSON.stringify(t)&&this._set("aggregateGeometries",t)}set attributes(t){const e=this._get("attributes");e!==t&&(this._set("attributes",t),this._notifyLayer("attributes",e,t))}set geometry(t){const e=this._get("geometry");e!==t&&(this._set("geometry",t),this._notifyLayer("geometry",e,t))}set symbol(t){const e=this._get("symbol");e!==t&&(this._set("symbol",t),this._notifyLayer("symbol",e,t))}set visible(t){const e=this._get("visible");e!==t&&(this._set("visible",t),this._notifyLayer("visible",e,t))}getEffectivePopupTemplate(t=!1){if(this.popupTemplate)return this.popupTemplate;for(const e of[this.sourceLayer,this.layer])if(e){if("popupTemplate"in e&&e.popupTemplate)return e.popupTemplate;if(t&&"defaultPopupTemplate"in e&&null!=e.defaultPopupTemplate)return e.defaultPopupTemplate}return null}getAttribute(t){return this.attributes?.[t]}setAttribute(t,e){if(this.attributes){const r=this.getAttribute(t);this.attributes[t]=e,this._notifyLayer("attributes",r,e,t)}else this.attributes={[t]:e},this._notifyLayer("attributes",void 0,e,t)}getObjectId(){return this.sourceLayer&&"objectIdField"in this.sourceLayer&&this.sourceLayer.objectIdField?this.getAttribute(this.sourceLayer.objectIdField):null}toJSON(){return{aggregateGeometries:y(this.aggregateGeometries),geometry:null!=this.geometry?this.geometry.toJSON():null,symbol:null!=this.symbol?this.symbol.toJSON():null,attributes:{...this.attributes},popupTemplate:this.popupTemplate&&this.popupTemplate.toJSON()}}notifyGeometryChanged(){this._notifyLayer("geometry",this.geometry,this.geometry)}notifyMeshTransformChanged(){null!=this.geometry&&"mesh"===this.geometry.type&&this._notifyLayer("transform",this.geometry.transform,this.geometry.transform)}_notifyLayer(t,e,r,o){if(!this.layer||!("graphicChanged"in this.layer))return;const s={graphic:this,property:t,oldValue:e,newValue:r};"attributes"===t&&(s.attributeName=o),this.layer.graphicChanged(s)}};t([p({value:null,json:{read:n}})],m.prototype,"aggregateGeometries",null),t([p({value:null})],m.prototype,"attributes",null),t([p({value:null,types:e,json:{read:u}})],m.prototype,"geometry",null),t([p({type:Boolean})],m.prototype,"isAggregate",void 0),t([p({clonable:"reference"})],m.prototype,"layer",void 0),t([p({type:r})],m.prototype,"popupTemplate",void 0),t([p({clonable:"reference"})],m.prototype,"sourceLayer",void 0),t([p({value:null,types:o})],m.prototype,"symbol",null),t([p({type:Boolean,value:!0})],m.prototype,"visible",null),m=t([a("esri.Graphic")],m),function(t){t.generateUID=l}(m||(m={}));const h=m;export{h as default};
5
+ import{_ as t}from"./chunks/tslib.es6.js";import{geometryTypes as e}from"./geometry.js";import r from"./PopupTemplate.js";import{symbolTypes as o}from"./symbols.js";import{ClonableMixin as s}from"./core/Clonable.js";import{JSONSupport as i}from"./core/JSONSupport.js";import{generateUID as l}from"./core/uid.js";import{property as a}from"./core/accessorSupport/decorators/property.js";import"./core/accessorSupport/ensureType.js";import"./core/arrayUtils.js";import"./core/has.js";import{subclass as p}from"./core/accessorSupport/decorators/subclass.js";import{fromJSON as n}from"./geometry/support/jsonUtils.js";function u(t){if(!t)return null;const e={};for(const r in t){const o=n(t[r]);o&&(e[r]=o)}return 0!==Object.keys(e).length?e:null}function y(t){if(null==t)return null;const e={};for(const r in t){const o=t[r];o&&(e[r]=o.toJSON())}return 0!==Object.keys(e).length?e:null}let m=class extends(s(i)){constructor(...t){super(...t),this.isAggregate=!1,this.layer=null,this.popupTemplate=null,this.sourceLayer=null,Object.defineProperty(this,"uid",{value:l(),configurable:!0})}normalizeCtorArgs(t,e,r,o){return t&&!t.declaredClass?t:{geometry:t,symbol:e,attributes:r,popupTemplate:o}}set aggregateGeometries(t){const e=this._get("aggregateGeometries");JSON.stringify(e)!==JSON.stringify(t)&&this._set("aggregateGeometries",t)}set attributes(t){const e=this._get("attributes");e!==t&&(this._set("attributes",t),this._notifyLayer("attributes",e,t))}set geometry(t){const e=this._get("geometry");e!==t&&(this._set("geometry",t),this._notifyLayer("geometry",e,t))}set symbol(t){const e=this._get("symbol");e!==t&&(this._set("symbol",t),this._notifyLayer("symbol",e,t))}set visible(t){const e=this._get("visible");e!==t&&(this._set("visible",t),this._notifyLayer("visible",e,t))}getEffectivePopupTemplate(t=!1){if(this.popupTemplate)return this.popupTemplate;for(const e of[this.sourceLayer,this.layer])if(e){if("popupTemplate"in e&&e.popupTemplate)return e.popupTemplate;if(t&&"defaultPopupTemplate"in e&&null!=e.defaultPopupTemplate)return e.defaultPopupTemplate}return null}getAttribute(t){return this.attributes?.[t]}setAttribute(t,e){if(this.attributes){const r=this.getAttribute(t);this.attributes[t]=e,this._notifyLayer("attributes",r,e,t)}else this.attributes={[t]:e},this._notifyLayer("attributes",void 0,e,t)}getObjectId(){return this.sourceLayer&&"objectIdField"in this.sourceLayer&&this.sourceLayer.objectIdField?this.getAttribute(this.sourceLayer.objectIdField):null}toJSON(){return{aggregateGeometries:y(this.aggregateGeometries),geometry:null!=this.geometry?this.geometry.toJSON():null,symbol:null!=this.symbol?this.symbol.toJSON():null,attributes:{...this.attributes},popupTemplate:this.popupTemplate&&this.popupTemplate.toJSON()}}notifyGeometryChanged(){this._notifyLayer("geometry",this.geometry,this.geometry)}notifyMeshTransformChanged(t={}){"mesh"===this.geometry?.type&&this._notifyLayer("transform",this.geometry.transform,this.geometry.transform,t.action)}_notifyLayer(t,e,r,o){if(!this.layer||!("graphicChanged"in this.layer))return;const s={graphic:this,property:t,oldValue:e,newValue:r};"transform"===t&&(s.action=o),"attributes"===t&&(s.attributeName=o),this.layer.graphicChanged(s)}};t([a({value:null,json:{read:u}})],m.prototype,"aggregateGeometries",null),t([a({value:null})],m.prototype,"attributes",null),t([a({value:null,types:e,json:{read:n}})],m.prototype,"geometry",null),t([a({type:Boolean})],m.prototype,"isAggregate",void 0),t([a({clonable:"reference"})],m.prototype,"layer",void 0),t([a({type:r})],m.prototype,"popupTemplate",void 0),t([a({clonable:"reference"})],m.prototype,"sourceLayer",void 0),t([a({value:null,types:o})],m.prototype,"symbol",null),t([a({type:Boolean,value:!0})],m.prototype,"visible",null),m=t([p("esri.Graphic")],m),function(t){t.generateUID=l}(m||(m={}));const h=m;export{h as default};
package/WebScene.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"./chunks/tslib.es6.js";import{version as t}from"./kernel.js";import r from"./Map.js";import i from"./Viewpoint.js";import o from"./core/Collection.js";import s from"./core/Error.js";import{clone as a}from"./core/lang.js";import n from"./core/Loadable.js";import{loadAll as l}from"./core/loadAll.js";import p from"./core/Logger.js";import{destroyMaybe as c}from"./core/maybe.js";import{MultiOriginJSONMixin as d,MultiOriginJSONSupport as h}from"./core/MultiOriginJSONSupport.js";import{EsriPromiseMixin as u}from"./core/Promise.js";import{debounce as m,eachAlways as y}from"./core/promiseUtils.js";import{urlToObject as w,addQueryParameter as g}from"./core/urlUtils.js";import{property as f}from"./core/accessorSupport/decorators/property.js";import"./core/accessorSupport/ensureType.js";import{reader as v}from"./core/accessorSupport/decorators/reader.js";import{subclass as b}from"./core/accessorSupport/decorators/subclass.js";import{writer as S}from"./core/accessorSupport/decorators/writer.js";import{updateOrigins as A}from"./core/accessorSupport/originUtils.js";import{readLoadable as _}from"./core/accessorSupport/read.js";import I from"./geometry/Extent.js";import j from"./geometry/HeightModelInfo.js";import{canProjectWithoutEngine as L}from"./geometry/projection.js";import R from"./geometry/SpatialReference.js";import{validateWebSceneError as P}from"./geometry/support/heightModelInfoUtils.js";import{fromJSON as V}from"./geometry/support/jsonUtils.js";import{isEarth as M}from"./geometry/support/spatialReferenceUtils.js";import U from"./portal/Portal.js";import O from"./portal/PortalItem.js";import E from"./support/MapFloorInfo.js";import{createSchemaValidationError as C,createCopyError as N}from"./support/webSceneUtils.js";import{ViewingMode as T}from"./views/ViewingMode.js";import{isSpatialReferenceSupported as G}from"./views/support/spatialReferenceSupport.js";import{saveResources as F}from"./webdoc/support/saveUtils.js";import{getOptimalThumbnailSize as $}from"./webdoc/support/thumbnailUtils.js";import W from"./webscene/ApplicationProperties.js";import J from"./webscene/Environment.js";import x from"./webscene/InitialViewProperties.js";import k from"./webscene/Presentation.js";import B from"./webscene/TransportationNetwork.js";import{Version as q}from"./webscene/Version.js";import{getLoader as K}from"./webscene/support/schemaValidatorLoader.js";const D=new q(1,31),H=()=>{const e=8,t=[],r=D.major;for(let i=e;i<=D.minor;i++)t.push(`${r}.${i}`);return t},z="Web Scene",Q="ViewingMode-Local";let X=class extends(n.LoadableMixin(u(d(r)))){constructor(e){super(e),this._layersIdGCTimeoutId=void 0,this._updateFromPromise=null,this.applicationProperties=null,this.clippingArea=null,this.clippingEnabled=!1,this.floorInfo=null,this.heightModelInfo=void 0,this.sourceVersion=null,this.transportationNetworks=null,this.presentation=new k,this.initialViewProperties=new x,this.portalItem=null,this.resourceInfo=null,this._debouncedSaveOperations=m((async(e,t,r)=>{switch(e){case Y.SAVE:return this._saveImpl(t);case Y.SAVE_AS:return this._saveAsImpl(r,t)}})),this._resourceReferences={portalItem:null,paths:[]},this.authoringApp=null,this.authoringAppVersion=null,this._isAuthoringAppSetByUser=!1,this._isAuthoringAppVersionSetByUser=!1}initialize(){if(this.when().catch((e=>{p.getLogger(this.declaredClass).error("#load()","Failed to load web scene",e)})),this.resourceInfo){let t;try{t=this._validateJSON(this.resourceInfo)}catch(e){return void this.addResolvingPromise(Promise.reject(e))}this.read(t),this.addResolvingPromise(this._validateSpatialReference()),this.addResolvingPromise(this._validateHeightModelInfo())}this.addHandles(this.allLayers.on("change",(()=>this._scheduleLayersIdGC())))}destroy(){this._unscheduleLayersIdGC(),this.presentation&&this.presentation.destroy(),this.portalItem=c(this.portalItem),this.basemap?.destroy()}writeClippingArea(e,t){t.clippingArea||(t.clippingArea={}),t.clippingArea.geometry=e.toJSON()}readClippingEnabled(e,t){return!!t.clippingArea&&!!t.clippingArea.clip}writeClippingEnabled(e,t){this.clippingArea&&(t.clippingArea||(t.clippingArea={}),t.clippingArea.clip=e)}writeLayers(e,t,r,i){const o={...i,layerContainerType:"operational-layers"},s=e.map((e=>this.verifyWriteLayer(e,i)?e.write({},o):null)).filter((e=>!!e));t[r]=s.toArray()}verifyWriteLayer(e,t){return"write"in e||(t&&t.messages&&t.messages.push(new s("layer:unsupported",`Layers (${e.title}, ${e.id}) of type '${e.declaredClass}' cannot be persisted in web scenes`,{layer:e})),!1)}readSourceVersion(e,t){const[r,i]=t.version.split(".");return new q(parseInt(r,10),parseInt(i,10))}writeSourceVersion(e,t,r){t[r]=`${D.major}.${D.minor}`}get thumbnailUrl(){return this.portalItem?.thumbnailUrl??null}set thumbnailUrl(e){e?this._override("thumbnailUrl",e):(this._clearOverride("thumbnailUrl"),this.clear("thumbnailUrl","user"))}set authoringApp(e){this._isAuthoringAppSetByUser=!0,this._set("authoringApp",e)}writeAuthoringApp(e,t){e&&this._isAuthoringAppSetByUser?t.authoringApp=e:t.authoringApp="ArcGIS API for JavaScript"}set authoringAppVersion(e){this._isAuthoringAppVersionSetByUser=!0,this._set("authoringAppVersion",e)}writeAuthoringAppVersion(e,r){e&&this._isAuthoringAppVersionSetByUser?r.authoringAppVersion=e:r.authoringAppVersion=t}writeGround(e,t,r,i){t[r]=e?e.write({},i):{transparency:0,layers:[]}}readInitialViewProperties(e,t){const r={};return t.initialState&&t.initialState.environment&&(r.environment=J.fromJSON(t.initialState.environment)),t.spatialReference?r.spatialReference=R.fromJSON(t.spatialReference):r.spatialReference=R.WebMercator,r.viewingMode=t.viewingMode||"global",t.initialState&&t.initialState.viewpoint&&(r.viewpoint=i.fromJSON(t.initialState.viewpoint)),new x(r)}get spatialReference(){return this.initialViewProperties?.spatialReference??R.WebMercator}get viewingMode(){return this.initialViewProperties?.viewingMode??"global"}load(e){const t=this.ground;return this.addResolvingPromise(this._loadFromSource().then((()=>{t&&t!==this.ground&&t.destroy()}))),Promise.resolve(this)}loadAll(){return l(this,(e=>{const t=this.presentation&&this.presentation.slides;e(this.ground,this.basemap,this.layers,t&&t.map((e=>e.basemap)))}))}read(e,t){t={...t,origin:"web-scene"};const r=this._isAuthoringAppVersionSetByUser,i=this._isAuthoringAppSetByUser;if(_(this,e,(t=>super.read(e,t)),t),i||(this._isAuthoringAppSetByUser=!1),r||(this._isAuthoringAppVersionSetByUser=!1),e.baseMap&&Array.isArray(e.baseMap.elevationLayers)&&this.sourceVersion?.supportsVisibleElevationLayersInSlides){const t=e.baseMap.elevationLayers.map((e=>({id:e.id}))),r=this.presentation.slides,i=(e,t)=>e.visibleLayers.some((e=>e.id===t)),o=t.filter((e=>!r.some((t=>i(t,e.id)))));r.forEach((e=>{e.visibleLayers.addMany(o)}))}}_writeBasemapElevationLayers(e){const t=e.ground&&e.ground.layers;!e.baseMap&&t&&t.length&&(e.baseMap={title:"Basemap",baseMapLayers:[]}),e.baseMap&&(e.baseMap.elevationLayers=a(t))}write(e,t){if("loaded"!==this.loadStatus){const e=new s("webscene:not-loaded","Web scene must be loaded before it can be serialized");throw p.getLogger(this.declaredClass).error("#toJSON()","Web scene must be loaded before it can be serialized",this.loadError||this.loadStatus),e}this._runLayersIdGC();const r=!t?.messages;t={messages:[],...t,origin:"web-scene"};const i=super.write(e,t);if(r){const e=t.messages?.filter((e=>"web-document-write:property-required"===e.name))??[];if(e.length){const t=new s("web-document:property-required","One or more properties that are required in the webscene JSON are missing, see details for the specific errors",{errors:e});throw p.getLogger(this.declaredClass).error("#toJSON()","One or more properties that are required in the webscene JSON are missing",e),t}}return this._writeBasemapElevationLayers(i),i}async save(e){return this._debouncedSaveOperations(Y.SAVE,e)}async _saveImpl(e){if(!this.portalItem)throw p.getLogger(this.declaredClass).error("save(): requires the .portalItem property to be set"),await Promise.resolve(),new s("webscene:portal-item-not-set","Portal item to save to has not been set on the WebScene");if(this.portalItem?.type!==z)throw await Promise.resolve(),new s("webscene:portal-item-wrong-type",`Portal item needs to have type "${z}"`);const t=this._updateFromPromise;await this._ensureLoadBeforeSave();const r=this._enableVerifyItemRelativeUrls({origin:"web-scene",url:this.portalItem.itemUrl?w(this.portalItem.itemUrl):null,messages:[],portal:this.portalItem.portal??U.getDefault(),portalItem:this.portalItem,writtenProperties:[],blockedRelativeUrls:[],resources:{toAdd:[],toUpdate:[],toKeep:[],pendingOperations:[]}}),i=this.write({},r);return await Promise.all(r.resources.pendingOperations),await this._verifySave(i,r,e),this._updateTypeKeywords(this.portalItem),await this.portalItem.update({data:i}),await F(this._resourceReferences,r,null),A(r),t&&await t,await this._saveThumbnail(),this.portalItem}async saveAs(e,t){return this._debouncedSaveOperations(Y.SAVE_AS,t,e)}async _saveAsImpl(e,t){let r=O.from(e);r||(p.getLogger(this.declaredClass).error("saveAs(portalItem): requires a portal item parameter"),await Promise.reject(new s("webscene:portal-item-required","saveAs requires a portal item to save to"))),r.id&&(r=r.clone(),r.id=null);const i=r.portal||U.getDefault();await this._ensureLoadBeforeSave(),r.type=z,r.portal=i;const o=this._enableVerifyItemRelativeUrls({origin:"web-scene",url:null,messages:[],portal:i,portalItem:r,writtenProperties:[],blockedRelativeUrls:[],resources:{toAdd:[],toUpdate:[],toKeep:[],pendingOperations:[]}}),a=this.write({},o);await Promise.all(o.resources.pendingOperations),await this._verifySaveAs(a,o,t);const n=this.thumbnailUrl,l=!this._isOverridden("thumbnailUrl");return this._updateTypeKeywords(r),await i.signIn(),await(i.user?.addItem({item:r,folder:t&&t.folder,data:a})),await F(this._resourceReferences,o,null),this.portalItem=r,h.prototype.read.call(this,{version:a.version,authoringApp:a.authoringApp,authoringAppVersion:a.authoringAppVersion},{name:"web-scene",ignoreDefaults:!0,url:r.itemUrl?w(r.itemUrl):void 0}),A(o),n&&(this.thumbnailUrl=l?g(n,"w","8192"):n),o.portalItem=r,await this._saveThumbnail(),r}async _saveThumbnail(){this._isOverridden("thumbnailUrl")&&(await(this.portalItem?.updateThumbnail({thumbnail:this.thumbnailUrl})),this._clearOverride("thumbnailUrl"),this.clear("thumbnailUrl","user"))}_verifySave(e,t,r,i=!1){if(!M(this.spatialReference))return Promise.reject(new s("webscene:unsupported-spatial-reference","Webscenes using spatial reference systems from Mars or Moon can not be saved currently."));let o,a=t.messages?.filter((e=>"error"===e.type)).map((e=>new s(e.name,e.message,e.details)))??[];t.blockedRelativeUrls&&(a=a.concat(t.blockedRelativeUrls.map((e=>new s("url:unsupported",`Relative url '${e}' is not supported in Web Scene`))))),r&&r.ignoreUnsupported&&(a=a.filter((e=>"layer:unsupported"!==e.name&&"symbol:unsupported"!==e.name&&"symbol-layer:unsupported"!==e.name&&"property:unsupported"!==e.name&&"url:unsupported"!==e.name&&"scenemodification:unsupported"!==e.name))),r?.requiredPropertyChecksDisabled&&(a=a.filter((e=>"web-document-write:property-required"!==e.name)));const n=!!r?.strictSchemaValidationEnabled,l=K();return o=n&&l?l().then((t=>{const r=t.validate(e);if(r.length>0){const e=`webscene did not validate:\n${r.join("\n")}`;p.getLogger(this.declaredClass).error(`${i?"saveAs":"save"}(): ${e}`)}return r.map((e=>new s("webscene:schema-validation",e)))})).then((e=>{if(e.length>0)throw C(e.concat(a));return a})):Promise.resolve(a),o.then((e=>{if(e.length>0)throw new s("webscene:save","Failed to save webscene due to unsupported or invalid content. See 'details.errors' for more detailed information",{errors:e})}))}_verifySaveAs(e,t,r){return this.canNotSaveAs(t)?Promise.reject(N()):this._verifySave(e,t,r,!0)}verifySaveAs(e){const t=this._enableVerifyItemRelativeUrls({origin:"web-scene",messages:[]}),r=this.write({},t);return this._verifySaveAs(r,t,e)}canNotSaveAs(e){return e||(e=this._enableVerifyItemRelativeUrls({origin:"web-scene",messages:[]}),this.write({},e)),(e.verifyItemRelativeUrls?.writtenUrls?.length??0)>0}async updateFrom(e,t={}){const r=this._updateFrom(e,t);this._updateFromPromise=r,await r;this._updateFromPromise===r&&(this._updateFromPromise=null)}async _updateFrom(e,t={}){if(await e.whenReady(),!t.environmentExcluded&&e.environment&&(this.initialViewProperties.environment=J.prototype.clone.apply(e.environment)),!t.viewpointExcluded&&e.viewpoint&&(this.initialViewProperties.viewpoint=e.viewpoint.clone()),this.initialViewProperties.spatialReference=e.spatialReference.clone(),this.initialViewProperties.viewingMode=e.viewingMode,null!=e.clippingArea?e.clippingArea!==this.clippingArea&&(this.clippingArea=e.clippingArea.clone(),this.clippingEnabled=!0):this.clippingEnabled=!1,e.heightModelInfo&&(this.heightModelInfo=e.heightModelInfo.clone()),e.map===this)for(const r of e.allLayerViews){const e="visible";e in r&&e in r.layer&&r._isOverridden(e)&&(r.layer[e]=r[e])}(!1===t.thumbnailExcluded||null==t.thumbnailExcluded&&!t.viewpointExcluded)&&await this._updateFromThumbnail(e,t.thumbnailSize??void 0)}async _updateFromThumbnail(e,t){const r=$(e,t),i=await e.takeScreenshot({format:"jpg",width:r.width,height:r.height,disableDecorations:!0});this.thumbnailUrl=i.dataUrl}_loadFromSource(){return this.resourceInfo?this._loadFromJSON(this.resourceInfo,{origin:"web-scene"}):this.portalItem&&this.portalItem.id?this._loadFromItem(this.portalItem):this._loadObjectsWithLayers()}_readAndLoadFromJSON(e,t){const r=this._validateJSON(e);return this.read(r,t),this._loadFromJSON(r,t)}_extractOperationalLayers(e){const t=[];if(!this.sourceVersion?.supportsGround&&e.baseMap&&Array.isArray(e.baseMap.elevationLayers))for(const o of e.baseMap.elevationLayers)t.push(o);const r=[],i=e=>(e.layers&&(e.layers=e.layers.filter(i)),"ArcGISTiledElevationServiceLayer"!==e.layerType||(this.sourceVersion?.supportsGround||r.push(e),!1));return{operationalLayers:e.operationalLayers?e.operationalLayers.filter(i):[],operationalElevationLayers:r,basemapElevationLayers:t}}_loadFromJSON(e,t){const r=new o;return this._validateSpatialReference().then((()=>this._validateHeightModelInfo())).then((()=>import("./layers/support/layersCreator.js"))).then((({populateOperationalLayers:i})=>{const{operationalLayers:o,operationalElevationLayers:s,basemapElevationLayers:a}=this._extractOperationalLayers(e),n=[],l={context:{...t,layerContainerType:"operational-layers"}};if(this.portalItem&&(l.context.portal=this.portalItem.portal||U.getDefault()),a.length>0){const e={...l,context:{...l.context,layerContainerType:"ground"}};e.defaultLayerType="ArcGISTiledElevationServiceLayer",n.push(i(this.ground.layers,a,e))}if(s.length>0){const e={...l,context:{...l.context,layerContainerType:"ground"}};e.defaultLayerType="ArcGISTiledElevationServiceLayer",n.push(i(r,s,e))}return o&&o.length>0&&n.push(i(this.layers,o,l)),y(n).then((()=>{}))})).then((()=>this._loadObjectsWithLayers())).then((()=>{this.ground.layers.addMany(r)}))}async _ensureLoadBeforeSave(){await this.load(),await this._loadObjectsWithLayers();const e=[];for(const t of this.allLayers.items)if("beforeSave"in t&&"function"==typeof t.beforeSave){const r=t.beforeSave();r&&e.push(r)}await y(e)}async _loadObjectsWithLayers(){const e=[];this.ground&&e.push(this.ground.load()),this.basemap&&e.push(this.basemap.load()),this.presentation.slides.forEach((t=>{t.basemap&&e.push(t.basemap.load())})),await y(e)}async _loadFromItem(e){if(await e.load().catch((e=>{throw new s("webscene:load-portal-item","Failed to load portal item",{error:e})})),"Web Scene"!==e.type)throw new s("webscene:invalid-portal-item","Invalid portal item type '${type}', expected 'Web Scene'",{type:e.type});const t=await e.fetchData();this.resourceInfo=t;const r={origin:"web-scene",url:w(e.itemUrl),portal:e.portal||U.getDefault(),portalItem:e,readResourcePaths:[]};await this._readAndLoadFromJSON(t,r),this._resourceReferences={portalItem:e,paths:r.readResourcePaths??[]}}_validateSpatialReference(){const e=this.initialViewProperties,t=this._sceneSpatialReference;let r;if("local"!==e.viewingMode){if(!G(t,T.Global))return Promise.reject(new s("webscene:unsupported-spatial-reference","Unsupported spatial reference (${spatialReference.wkid}) in global mode, only Web Mercator, WGS84 GCS or CGCS2000 are supported",{spatialReference:t,viewingMode:e.viewingMode}));r=e=>!e||L(e,t)}else{if(!G(t,T.Local))return Promise.reject(new s("webscene:unsupported-spatial-reference","Unsupported spatial reference (${spatialReference.wkid}) in local mode, only projected coordinate systems are supported",{spatialReference:t,viewingMode:e.viewingMode}));r=e=>!e||e.equals(t)}const i=e=>e?.camera?.position.spatialReference??e?.targetGeometry?.spatialReference,o=e.viewpoint,a=i(o);if(a&&!r(a))return Promise.reject(new s("webscene:incompatible-camera-spatial-reference","Camera spatial reference (${cameraSpatialReference.wkid}) is incompatible with the scene spatial reference (${sceneSpatialReference.wkid})",{cameraSpatialReference:a,sceneSpatialReference:t,viewingMode:e.viewingMode}));const n=this.presentation.slides.find((e=>!r(i(e.viewpoint))));if(n){const r=i(n.viewpoint);return Promise.reject(new s("webscene:incompatible-slide-spatial-reference","Slide spatial reference (${slideSpatialReference.wkid}) is incompatible with the scene spatial reference (${sceneSpatialReference.wkid})",{slideSpatialReference:r,sceneSpatialReference:t,viewingMode:e.viewingMode}))}return Promise.resolve()}_validateHeightModelInfo(){const e=this._sceneSpatialReference,t=P(this.heightModelInfo,e);return t?Promise.reject(t):Promise.resolve()}_validateJSON(e){const t=q.parse(e.version||"","webscene");return D.validate(t),e.version=`${t.major}.${t.minor}`,1===t.major&&t.minor<=2&&(e.spatialReference=R.WebMercator.toJSON()),e}_updateTypeKeywords(e){"local"===this.initialViewProperties.viewingMode?e.typeKeywords?e.typeKeywords.includes(Q)||e.typeKeywords.push(Q):e.typeKeywords=[Q]:"global"===this.initialViewProperties.viewingMode&&e.typeKeywords&&(e.typeKeywords=e.typeKeywords.filter((e=>e!==Q))),e.typeKeywords&&(e.typeKeywords=e.typeKeywords.filter(((e,t,r)=>r.indexOf(e)===t)))}get _sceneSpatialReference(){return this.initialViewProperties.spatialReference||R.WebMercator}get _verifyItemRelativeRootPath(){return this.portalItem?.itemUrl?w(this.portalItem.itemUrl).path:null}_enableVerifyItemRelativeUrls(e){const t=this._verifyItemRelativeRootPath;return t&&(e.verifyItemRelativeUrls={rootPath:t,writtenUrls:[]}),e}_unscheduleLayersIdGC(){this._layersIdGCTimeoutId&&(clearTimeout(this._layersIdGCTimeoutId),this._layersIdGCTimeoutId=0)}_scheduleLayersIdGC(){this._unscheduleLayersIdGC(),this._layersIdGCTimeoutId=setTimeout((()=>{this._layersIdGCTimeoutId=0,this._runLayersIdGC()}),3e3)}_runLayersIdGC(){this._unscheduleLayersIdGC();const e=this.applicationProperties&&this.applicationProperties.viewing&&this.applicationProperties.viewing.search,t=e=>this.allLayers.some((t=>t.id===e));e&&e.layers&&(e.layers=e.layers.filter((e=>t(e.id))));const r=this.presentation&&this.presentation.slides;r&&r.forEach((e=>{e.visibleLayers&&(e.visibleLayers=e.visibleLayers.filter((e=>t(e.id))))}))}static fromJSON(e){if(!e)throw new s("webscene:empty-resource","Expected a JSON resource but got nothing");return new this({resourceInfo:e})}};var Y;X.version=`${D.major}.${D.minor}`,e([f({type:W,json:{write:!0}})],X.prototype,"applicationProperties",void 0),e([f({json:{read:{source:"baseMap"},write:{target:"baseMap"}}})],X.prototype,"basemap",void 0),e([f({type:I,json:{read:{source:"clippingArea.geometry",reader:V},write:{target:"clippingArea.geometry"}}})],X.prototype,"clippingArea",void 0),e([S("clippingArea")],X.prototype,"writeClippingArea",null),e([f({type:Boolean,json:{write:{target:"clippingArea.clip"}}})],X.prototype,"clippingEnabled",void 0),e([v("clippingEnabled",["clippingArea"])],X.prototype,"readClippingEnabled",null),e([S("clippingEnabled")],X.prototype,"writeClippingEnabled",null),e([f({type:E,json:{read:{source:"mapFloorInfo"},write:{target:"mapFloorInfo"}}})],X.prototype,"floorInfo",void 0),e([f({type:j,json:{write:!0}})],X.prototype,"heightModelInfo",void 0),e([f({json:{write:{target:"operationalLayers",ignoreOrigin:!0}}})],X.prototype,"layers",void 0),e([S("layers")],X.prototype,"writeLayers",null),e([f({readOnly:!0,type:q,json:{type:H(),write:{ignoreOrigin:!0,target:"version",isRequired:!0,overridePolicy:()=>({enabled:!0,allowNull:!0,ignoreOrigin:!0})}}})],X.prototype,"sourceVersion",void 0),e([v("sourceVersion",["version"])],X.prototype,"readSourceVersion",null),e([S("sourceVersion")],X.prototype,"writeSourceVersion",null),e([f({json:{read:!1,write:!1}})],X.prototype,"tables",void 0),e([f()],X.prototype,"thumbnailUrl",null),e([f({type:String,json:{write:{writerEnsuresNonNull:!0,ignoreOrigin:!0}}})],X.prototype,"authoringApp",null),e([S("authoringApp")],X.prototype,"writeAuthoringApp",null),e([f({type:String,json:{write:{writerEnsuresNonNull:!0,ignoreOrigin:!0}}})],X.prototype,"authoringAppVersion",null),e([S("authoringAppVersion")],X.prototype,"writeAuthoringAppVersion",null),e([f({json:{write:{isRequired:!0,allowNull:!0,ignoreOrigin:!0,enabled:!0}}})],X.prototype,"ground",void 0),e([S("ground")],X.prototype,"writeGround",null),e([f({type:o.ofType(B),json:{write:!0}})],X.prototype,"transportationNetworks",void 0),e([f({type:k,nonNullable:!0,json:{write:{ignoreOrigin:!0,writer:(e,t,r,i)=>{if(e.slides&&e.slides.length>0){const r={...i,isPresentation:!0};t.presentation=e.write({},r)}}}}})],X.prototype,"presentation",void 0),e([f({type:x,nonNullable:!0,json:{write:{target:"initialState",isRequired:!0,ignoreOrigin:!0},default:()=>new x({viewingMode:"global",spatialReference:R.WebMercator})}})],X.prototype,"initialViewProperties",void 0),e([v("initialViewProperties",["initialState.environment","spatialReference","viewingMode","initialState.viewpoint"])],X.prototype,"readInitialViewProperties",null),e([f({type:R,json:{read:!1,write:{isRequired:!0,ignoreOrigin:!0}}})],X.prototype,"spatialReference",null),e([f({type:["local","global"],json:{read:!1,write:{isRequired:!0,ignoreOrigin:!0}}})],X.prototype,"viewingMode",null),e([f({type:O})],X.prototype,"portalItem",void 0),e([f()],X.prototype,"resourceInfo",void 0),X=e([b("esri.WebScene")],X),function(e){e[e.SAVE=0]="SAVE",e[e.SAVE_AS=1]="SAVE_AS"}(Y||(Y={}));const Z=X;export{Z as default};
5
+ import{_ as e}from"./chunks/tslib.es6.js";import{version as t}from"./kernel.js";import r from"./Map.js";import i from"./Viewpoint.js";import o from"./core/Collection.js";import s from"./core/Error.js";import{clone as a}from"./core/lang.js";import n from"./core/Loadable.js";import{loadAll as l}from"./core/loadAll.js";import p from"./core/Logger.js";import{destroyMaybe as c}from"./core/maybe.js";import{MultiOriginJSONMixin as d,MultiOriginJSONSupport as h}from"./core/MultiOriginJSONSupport.js";import{EsriPromiseMixin as u}from"./core/Promise.js";import{debounce as m,eachAlways as y}from"./core/promiseUtils.js";import{on as w}from"./core/reactiveUtils.js";import{urlToObject as g,addQueryParameter as f}from"./core/urlUtils.js";import{property as v}from"./core/accessorSupport/decorators/property.js";import"./core/accessorSupport/ensureType.js";import{reader as b}from"./core/accessorSupport/decorators/reader.js";import{subclass as S}from"./core/accessorSupport/decorators/subclass.js";import{writer as A}from"./core/accessorSupport/decorators/writer.js";import{updateOrigins as _}from"./core/accessorSupport/originUtils.js";import{readLoadable as I}from"./core/accessorSupport/read.js";import j from"./geometry/Extent.js";import L from"./geometry/HeightModelInfo.js";import{canProjectWithoutEngine as R}from"./geometry/projection.js";import P from"./geometry/SpatialReference.js";import{validateWebSceneError as V}from"./geometry/support/heightModelInfoUtils.js";import{fromJSON as U}from"./geometry/support/jsonUtils.js";import{isEarth as M}from"./geometry/support/spatialReferenceUtils.js";import O from"./portal/Portal.js";import E from"./portal/PortalItem.js";import C from"./support/MapFloorInfo.js";import{WebSceneTag as N}from"./support/tagSymbols.js";import{createSchemaValidationError as T,createCopyError as G}from"./support/webSceneUtils.js";import{ViewingMode as F}from"./views/ViewingMode.js";import{isSpatialReferenceSupported as W}from"./views/support/spatialReferenceSupport.js";import{saveResources as $}from"./webdoc/support/saveUtils.js";import{getOptimalThumbnailSize as J}from"./webdoc/support/thumbnailUtils.js";import x from"./webscene/ApplicationProperties.js";import k from"./webscene/Environment.js";import B from"./webscene/InitialViewProperties.js";import q from"./webscene/Presentation.js";import K from"./webscene/TransportationNetwork.js";import{Version as D}from"./webscene/Version.js";import{getLoader as H}from"./webscene/support/schemaValidatorLoader.js";var z;const Q=new D(1,31),X=()=>{const e=8,t=[],r=Q.major;for(let i=e;i<=Q.minor;i++)t.push(`${r}.${i}`);return t},Y="Web Scene",Z="ViewingMode-Local";let ee=class extends(n.LoadableMixin(u(d(r)))){constructor(e){super(e),this[z]=!0,this._layersIdGCTimeoutId=void 0,this._updateFromPromise=null,this.applicationProperties=null,this.clippingArea=null,this.clippingEnabled=!1,this.floorInfo=null,this.heightModelInfo=void 0,this.sourceVersion=null,this.transportationNetworks=null,this.presentation=new q,this.initialViewProperties=new B,this.portalItem=null,this.resourceInfo=null,this._debouncedSaveOperations=m((async(e,t,r)=>{switch(e){case te.SAVE:return this._saveImpl(t);case te.SAVE_AS:return this._saveAsImpl(r,t)}})),this._resourceReferences={portalItem:null,paths:[]},this.authoringApp=null,this.authoringAppVersion=null,this._isAuthoringAppSetByUser=!1,this._isAuthoringAppVersionSetByUser=!1}initialize(){if(this.when().catch((e=>{p.getLogger(this.declaredClass).error("#load()","Failed to load web scene",e)})),this.resourceInfo){let t;try{t=this._validateJSON(this.resourceInfo)}catch(e){return void this.addResolvingPromise(Promise.reject(e))}this.read(t),this.addResolvingPromise(this._validateSpatialReference()),this.addResolvingPromise(this._validateHeightModelInfo())}this.addHandles([w((()=>this.tables),"before-add",(e=>{e.preventDefault(),p.getLogger(this.declaredClass).errorOnce("tables","Tables are not yet supported in a WebScene")})),w((()=>this.allLayers),"change",(()=>this._scheduleLayersIdGC()))])}destroy(){this._unscheduleLayersIdGC(),this.presentation&&this.presentation.destroy(),this.portalItem=c(this.portalItem),this.basemap?.destroy()}writeClippingArea(e,t){t.clippingArea||(t.clippingArea={}),t.clippingArea.geometry=e.toJSON()}readClippingEnabled(e,t){return!!t.clippingArea&&!!t.clippingArea.clip}writeClippingEnabled(e,t){this.clippingArea&&(t.clippingArea||(t.clippingArea={}),t.clippingArea.clip=e)}writeLayers(e,t,r,i){const o={...i,layerContainerType:"operational-layers"},s=e.map((e=>this.verifyWriteLayer(e,i)?e.write({},o):null)).filter((e=>!!e));t[r]=s.toArray()}verifyWriteLayer(e,t){return"write"in e||(t&&t.messages&&t.messages.push(new s("layer:unsupported",`Layers (${e.title}, ${e.id}) of type '${e.declaredClass}' cannot be persisted in web scenes`,{layer:e})),!1)}readSourceVersion(e,t){const[r,i]=t.version.split(".");return new D(parseInt(r,10),parseInt(i,10))}writeSourceVersion(e,t,r){t[r]=`${Q.major}.${Q.minor}`}get thumbnailUrl(){return this.portalItem?.thumbnailUrl??null}set thumbnailUrl(e){e?this._override("thumbnailUrl",e):(this._clearOverride("thumbnailUrl"),this.clear("thumbnailUrl","user"))}set authoringApp(e){this._isAuthoringAppSetByUser=!0,this._set("authoringApp",e)}writeAuthoringApp(e,t){e&&this._isAuthoringAppSetByUser?t.authoringApp=e:t.authoringApp="ArcGIS API for JavaScript"}set authoringAppVersion(e){this._isAuthoringAppVersionSetByUser=!0,this._set("authoringAppVersion",e)}writeAuthoringAppVersion(e,r){e&&this._isAuthoringAppVersionSetByUser?r.authoringAppVersion=e:r.authoringAppVersion=t}writeGround(e,t,r,i){t[r]=e?e.write({},i):{transparency:0,layers:[]}}readInitialViewProperties(e,t){const r={};return t.initialState&&t.initialState.environment&&(r.environment=k.fromJSON(t.initialState.environment)),t.spatialReference?r.spatialReference=P.fromJSON(t.spatialReference):r.spatialReference=P.WebMercator,r.viewingMode=t.viewingMode||"global",t.initialState&&t.initialState.viewpoint&&(r.viewpoint=i.fromJSON(t.initialState.viewpoint)),new B(r)}get spatialReference(){return this.initialViewProperties?.spatialReference??P.WebMercator}get viewingMode(){return this.initialViewProperties?.viewingMode??"global"}load(e){const t=this.ground;return this.addResolvingPromise(this._loadFromSource().then((()=>{t&&t!==this.ground&&t.destroy()}))),Promise.resolve(this)}loadAll(){return l(this,(e=>{const t=this.presentation&&this.presentation.slides;e(this.ground,this.basemap,this.layers,t&&t.map((e=>e.basemap)))}))}read(e,t){t={...t,origin:"web-scene"};const r=this._isAuthoringAppVersionSetByUser,i=this._isAuthoringAppSetByUser;if(I(this,e,(t=>super.read(e,t)),t),i||(this._isAuthoringAppSetByUser=!1),r||(this._isAuthoringAppVersionSetByUser=!1),e.baseMap&&Array.isArray(e.baseMap.elevationLayers)&&this.sourceVersion?.supportsVisibleElevationLayersInSlides){const t=e.baseMap.elevationLayers.map((e=>({id:e.id}))),r=this.presentation.slides,i=(e,t)=>e.visibleLayers.some((e=>e.id===t)),o=t.filter((e=>!r.some((t=>i(t,e.id)))));r.forEach((e=>{e.visibleLayers.addMany(o)}))}}_writeBasemapElevationLayers(e){const t=e.ground&&e.ground.layers;!e.baseMap&&t&&t.length&&(e.baseMap={title:"Basemap",baseMapLayers:[]}),e.baseMap&&(e.baseMap.elevationLayers=a(t))}write(e,t){if("loaded"!==this.loadStatus){const e=new s("webscene:not-loaded","Web scene must be loaded before it can be serialized");throw p.getLogger(this.declaredClass).error("#toJSON()","Web scene must be loaded before it can be serialized",this.loadError||this.loadStatus),e}this._runLayersIdGC();const r=!t?.messages;t={messages:[],...t,origin:"web-scene"};const i=super.write(e,t);if(r){const e=t.messages?.filter((e=>"web-document-write:property-required"===e.name))??[];if(e.length){const t=new s("web-document:property-required","One or more properties that are required in the webscene JSON are missing, see details for the specific errors",{errors:e});throw p.getLogger(this.declaredClass).error("#toJSON()","One or more properties that are required in the webscene JSON are missing",e),t}}return this._writeBasemapElevationLayers(i),i}async save(e){return this._debouncedSaveOperations(te.SAVE,e)}async _saveImpl(e){if(!this.portalItem)throw p.getLogger(this.declaredClass).error("save(): requires the .portalItem property to be set"),await Promise.resolve(),new s("webscene:portal-item-not-set","Portal item to save to has not been set on the WebScene");if(this.portalItem?.type!==Y)throw await Promise.resolve(),new s("webscene:portal-item-wrong-type",`Portal item needs to have type "${Y}"`);const t=this._updateFromPromise;await this._ensureLoadBeforeSave();const r=this._enableVerifyItemRelativeUrls({origin:"web-scene",url:this.portalItem.itemUrl?g(this.portalItem.itemUrl):null,messages:[],portal:this.portalItem.portal??O.getDefault(),portalItem:this.portalItem,writtenProperties:[],blockedRelativeUrls:[],resources:{toAdd:[],toUpdate:[],toKeep:[],pendingOperations:[]}}),i=this.write({},r);return await Promise.all(r.resources.pendingOperations),await this._verifySave(i,r,e),this._updateTypeKeywords(this.portalItem),await this.portalItem.update({data:i}),await $(this._resourceReferences,r,null),_(r),t&&await t,await this._saveThumbnail(),this.portalItem}async saveAs(e,t){return this._debouncedSaveOperations(te.SAVE_AS,t,e)}async _saveAsImpl(e,t){let r=E.from(e);r||(p.getLogger(this.declaredClass).error("saveAs(portalItem): requires a portal item parameter"),await Promise.reject(new s("webscene:portal-item-required","saveAs requires a portal item to save to"))),r.id&&(r=r.clone(),r.id=null);const i=r.portal||O.getDefault();await this._ensureLoadBeforeSave(),r.type=Y,r.portal=i;const o=this._enableVerifyItemRelativeUrls({origin:"web-scene",url:null,messages:[],portal:i,portalItem:r,writtenProperties:[],blockedRelativeUrls:[],resources:{toAdd:[],toUpdate:[],toKeep:[],pendingOperations:[]}}),a=this.write({},o);await Promise.all(o.resources.pendingOperations),await this._verifySaveAs(a,o,t);const n=this.thumbnailUrl,l=!this._isOverridden("thumbnailUrl");return this._updateTypeKeywords(r),await i.signIn(),await(i.user?.addItem({item:r,folder:t&&t.folder,data:a})),await $(this._resourceReferences,o,null),this.portalItem=r,h.prototype.read.call(this,{version:a.version,authoringApp:a.authoringApp,authoringAppVersion:a.authoringAppVersion},{name:"web-scene",ignoreDefaults:!0,url:r.itemUrl?g(r.itemUrl):void 0}),_(o),n&&(this.thumbnailUrl=l?f(n,"w","8192"):n),o.portalItem=r,await this._saveThumbnail(),r}async _saveThumbnail(){this._isOverridden("thumbnailUrl")&&(await(this.portalItem?.updateThumbnail({thumbnail:this.thumbnailUrl})),this._clearOverride("thumbnailUrl"),this.clear("thumbnailUrl","user"))}_verifySave(e,t,r,i=!1){if(!M(this.spatialReference))return Promise.reject(new s("webscene:unsupported-spatial-reference","Webscenes using spatial reference systems from Mars or Moon can not be saved currently."));let o,a=t.messages?.filter((e=>"error"===e.type)).map((e=>new s(e.name,e.message,e.details)))??[];t.blockedRelativeUrls&&(a=a.concat(t.blockedRelativeUrls.map((e=>new s("url:unsupported",`Relative url '${e}' is not supported in Web Scene`))))),r&&r.ignoreUnsupported&&(a=a.filter((e=>"layer:unsupported"!==e.name&&"symbol:unsupported"!==e.name&&"symbol-layer:unsupported"!==e.name&&"property:unsupported"!==e.name&&"url:unsupported"!==e.name&&"scenemodification:unsupported"!==e.name))),r?.requiredPropertyChecksDisabled&&(a=a.filter((e=>"web-document-write:property-required"!==e.name)));const n=!!r?.strictSchemaValidationEnabled,l=H();return o=n&&l?l().then((t=>{const r=t.validate(e);if(r.length>0){const e=`webscene did not validate:\n${r.join("\n")}`;p.getLogger(this.declaredClass).error(`${i?"saveAs":"save"}(): ${e}`)}return r.map((e=>new s("webscene:schema-validation",e)))})).then((e=>{if(e.length>0)throw T(e.concat(a));return a})):Promise.resolve(a),o.then((e=>{if(e.length>0)throw new s("webscene:save","Failed to save webscene due to unsupported or invalid content. See 'details.errors' for more detailed information",{errors:e})}))}_verifySaveAs(e,t,r){return this.canNotSaveAs(t)?Promise.reject(G()):this._verifySave(e,t,r,!0)}verifySaveAs(e){const t=this._enableVerifyItemRelativeUrls({origin:"web-scene",messages:[]}),r=this.write({},t);return this._verifySaveAs(r,t,e)}canNotSaveAs(e){return e||(e=this._enableVerifyItemRelativeUrls({origin:"web-scene",messages:[]}),this.write({},e)),(e.verifyItemRelativeUrls?.writtenUrls?.length??0)>0}async updateFrom(e,t={}){const r=this._updateFrom(e,t);this._updateFromPromise=r,await r;this._updateFromPromise===r&&(this._updateFromPromise=null)}async _updateFrom(e,t={}){if(await e.whenReady(),!t.environmentExcluded&&e.environment&&(this.initialViewProperties.environment=k.prototype.clone.apply(e.environment)),!t.viewpointExcluded&&e.viewpoint&&(this.initialViewProperties.viewpoint=e.viewpoint.clone()),this.initialViewProperties.spatialReference=e.spatialReference.clone(),this.initialViewProperties.viewingMode=e.viewingMode,null!=e.clippingArea?e.clippingArea!==this.clippingArea&&(this.clippingArea=e.clippingArea.clone(),this.clippingEnabled=!0):this.clippingEnabled=!1,e.heightModelInfo&&(this.heightModelInfo=e.heightModelInfo.clone()),e.map===this)for(const r of e.allLayerViews){const e="visible";e in r&&e in r.layer&&r._isOverridden(e)&&(r.layer[e]=r[e])}(!1===t.thumbnailExcluded||null==t.thumbnailExcluded&&!t.viewpointExcluded)&&await this._updateFromThumbnail(e,t.thumbnailSize??void 0)}async _updateFromThumbnail(e,t){const r=J(e,t),i=await e.takeScreenshot({format:"jpg",width:r.width,height:r.height,disableDecorations:!0});this.thumbnailUrl=i.dataUrl}_loadFromSource(){return this.resourceInfo?this._loadFromJSON(this.resourceInfo,{origin:"web-scene"}):this.portalItem&&this.portalItem.id?this._loadFromItem(this.portalItem):this._loadObjectsWithLayers()}_readAndLoadFromJSON(e,t){const r=this._validateJSON(e);return this.read(r,t),this._loadFromJSON(r,t)}_extractOperationalLayers(e){const t=[];if(!this.sourceVersion?.supportsGround&&e.baseMap&&Array.isArray(e.baseMap.elevationLayers))for(const o of e.baseMap.elevationLayers)t.push(o);const r=[],i=e=>(e.layers&&(e.layers=e.layers.filter(i)),"ArcGISTiledElevationServiceLayer"!==e.layerType||(this.sourceVersion?.supportsGround||r.push(e),!1));return{operationalLayers:e.operationalLayers?e.operationalLayers.filter(i):[],operationalElevationLayers:r,basemapElevationLayers:t}}_loadFromJSON(e,t){const r=new o;return this._validateSpatialReference().then((()=>this._validateHeightModelInfo())).then((()=>import("./layers/support/layersCreator.js"))).then((({populateOperationalLayers:i})=>{const{operationalLayers:o,operationalElevationLayers:s,basemapElevationLayers:a}=this._extractOperationalLayers(e),n=[],l={context:{...t,layerContainerType:"operational-layers"}};if(this.portalItem&&(l.context.portal=this.portalItem.portal||O.getDefault()),a.length>0){const e={...l,context:{...l.context,layerContainerType:"ground"}};e.defaultLayerType="ArcGISTiledElevationServiceLayer",n.push(i(this.ground.layers,a,e))}if(s.length>0){const e={...l,context:{...l.context,layerContainerType:"ground"}};e.defaultLayerType="ArcGISTiledElevationServiceLayer",n.push(i(r,s,e))}return o&&o.length>0&&n.push(i(this.layers,o,l)),y(n).then((()=>{}))})).then((()=>this._loadObjectsWithLayers())).then((()=>{this.ground.layers.addMany(r)}))}async _ensureLoadBeforeSave(){await this.load(),await this._loadObjectsWithLayers();const e=[];for(const t of this.allLayers.items)if("beforeSave"in t&&"function"==typeof t.beforeSave){const r=t.beforeSave();r&&e.push(r)}await y(e)}async _loadObjectsWithLayers(){const e=[];this.ground&&e.push(this.ground.load()),this.basemap&&e.push(this.basemap.load()),this.presentation.slides.forEach((t=>{t.basemap&&e.push(t.basemap.load())})),await y(e)}async _loadFromItem(e){if(await e.load().catch((e=>{throw new s("webscene:load-portal-item","Failed to load portal item",{error:e})})),"Web Scene"!==e.type)throw new s("webscene:invalid-portal-item","Invalid portal item type '${type}', expected 'Web Scene'",{type:e.type});const t=await e.fetchData();this.resourceInfo=t;const r={origin:"web-scene",url:g(e.itemUrl),portal:e.portal||O.getDefault(),portalItem:e,readResourcePaths:[]};await this._readAndLoadFromJSON(t,r),this._resourceReferences={portalItem:e,paths:r.readResourcePaths??[]}}_validateSpatialReference(){const e=this.initialViewProperties,t=this._sceneSpatialReference;let r;if("local"!==e.viewingMode){if(!W(t,F.Global))return Promise.reject(new s("webscene:unsupported-spatial-reference","Unsupported spatial reference (${spatialReference.wkid}) in global mode, only Web Mercator, WGS84 GCS or CGCS2000 are supported",{spatialReference:t,viewingMode:e.viewingMode}));r=e=>!e||R(e,t)}else{if(!W(t,F.Local))return Promise.reject(new s("webscene:unsupported-spatial-reference","Unsupported spatial reference (${spatialReference.wkid}) in local mode, only projected coordinate systems are supported",{spatialReference:t,viewingMode:e.viewingMode}));r=e=>!e||e.equals(t)}const i=e=>e?.camera?.position.spatialReference??e?.targetGeometry?.spatialReference,o=e.viewpoint,a=i(o);if(a&&!r(a))return Promise.reject(new s("webscene:incompatible-camera-spatial-reference","Camera spatial reference (${cameraSpatialReference.wkid}) is incompatible with the scene spatial reference (${sceneSpatialReference.wkid})",{cameraSpatialReference:a,sceneSpatialReference:t,viewingMode:e.viewingMode}));const n=this.presentation.slides.find((e=>!r(i(e.viewpoint))));if(n){const r=i(n.viewpoint);return Promise.reject(new s("webscene:incompatible-slide-spatial-reference","Slide spatial reference (${slideSpatialReference.wkid}) is incompatible with the scene spatial reference (${sceneSpatialReference.wkid})",{slideSpatialReference:r,sceneSpatialReference:t,viewingMode:e.viewingMode}))}return Promise.resolve()}_validateHeightModelInfo(){const e=this._sceneSpatialReference,t=V(this.heightModelInfo,e);return t?Promise.reject(t):Promise.resolve()}_validateJSON(e){const t=D.parse(e.version||"","webscene");return Q.validate(t),e.version=`${t.major}.${t.minor}`,1===t.major&&t.minor<=2&&(e.spatialReference=P.WebMercator.toJSON()),e}_updateTypeKeywords(e){"local"===this.initialViewProperties.viewingMode?e.typeKeywords?e.typeKeywords.includes(Z)||e.typeKeywords.push(Z):e.typeKeywords=[Z]:"global"===this.initialViewProperties.viewingMode&&e.typeKeywords&&(e.typeKeywords=e.typeKeywords.filter((e=>e!==Z))),e.typeKeywords&&(e.typeKeywords=e.typeKeywords.filter(((e,t,r)=>r.indexOf(e)===t)))}get _sceneSpatialReference(){return this.initialViewProperties.spatialReference||P.WebMercator}get _verifyItemRelativeRootPath(){return this.portalItem?.itemUrl?g(this.portalItem.itemUrl).path:null}_enableVerifyItemRelativeUrls(e){const t=this._verifyItemRelativeRootPath;return t&&(e.verifyItemRelativeUrls={rootPath:t,writtenUrls:[]}),e}_unscheduleLayersIdGC(){this._layersIdGCTimeoutId&&(clearTimeout(this._layersIdGCTimeoutId),this._layersIdGCTimeoutId=0)}_scheduleLayersIdGC(){this._unscheduleLayersIdGC(),this._layersIdGCTimeoutId=setTimeout((()=>{this._layersIdGCTimeoutId=0,this._runLayersIdGC()}),3e3)}_runLayersIdGC(){this._unscheduleLayersIdGC();const e=this.applicationProperties&&this.applicationProperties.viewing&&this.applicationProperties.viewing.search,t=e=>this.allLayers.some((t=>t.id===e));e&&e.layers&&(e.layers=e.layers.filter((e=>t(e.id))));const r=this.presentation&&this.presentation.slides;r&&r.forEach((e=>{e.visibleLayers&&(e.visibleLayers=e.visibleLayers.filter((e=>t(e.id))))}))}static fromJSON(e){if(!e)throw new s("webscene:empty-resource","Expected a JSON resource but got nothing");return new this({resourceInfo:e})}};var te;z=N,ee.version=`${Q.major}.${Q.minor}`,e([v({type:x,json:{write:!0}})],ee.prototype,"applicationProperties",void 0),e([v({json:{read:{source:"baseMap"},write:{target:"baseMap"}}})],ee.prototype,"basemap",void 0),e([v({type:j,json:{read:{source:"clippingArea.geometry",reader:U},write:{target:"clippingArea.geometry"}}})],ee.prototype,"clippingArea",void 0),e([A("clippingArea")],ee.prototype,"writeClippingArea",null),e([v({type:Boolean,json:{write:{target:"clippingArea.clip"}}})],ee.prototype,"clippingEnabled",void 0),e([b("clippingEnabled",["clippingArea"])],ee.prototype,"readClippingEnabled",null),e([A("clippingEnabled")],ee.prototype,"writeClippingEnabled",null),e([v({type:C,json:{read:{source:"mapFloorInfo"},write:{target:"mapFloorInfo"}}})],ee.prototype,"floorInfo",void 0),e([v({type:L,json:{write:!0}})],ee.prototype,"heightModelInfo",void 0),e([v({json:{write:{target:"operationalLayers",ignoreOrigin:!0}}})],ee.prototype,"layers",void 0),e([A("layers")],ee.prototype,"writeLayers",null),e([v({readOnly:!0,type:D,json:{type:X(),write:{ignoreOrigin:!0,target:"version",isRequired:!0,overridePolicy:()=>({enabled:!0,allowNull:!0,ignoreOrigin:!0})}}})],ee.prototype,"sourceVersion",void 0),e([b("sourceVersion",["version"])],ee.prototype,"readSourceVersion",null),e([A("sourceVersion")],ee.prototype,"writeSourceVersion",null),e([v({json:{read:!1,write:!1}})],ee.prototype,"tables",void 0),e([v()],ee.prototype,"thumbnailUrl",null),e([v({type:String,json:{write:{writerEnsuresNonNull:!0,ignoreOrigin:!0}}})],ee.prototype,"authoringApp",null),e([A("authoringApp")],ee.prototype,"writeAuthoringApp",null),e([v({type:String,json:{write:{writerEnsuresNonNull:!0,ignoreOrigin:!0}}})],ee.prototype,"authoringAppVersion",null),e([A("authoringAppVersion")],ee.prototype,"writeAuthoringAppVersion",null),e([v({json:{write:{isRequired:!0,allowNull:!0,ignoreOrigin:!0,enabled:!0}}})],ee.prototype,"ground",void 0),e([A("ground")],ee.prototype,"writeGround",null),e([v({type:o.ofType(K),json:{write:!0}})],ee.prototype,"transportationNetworks",void 0),e([v({type:q,nonNullable:!0,json:{write:{ignoreOrigin:!0,writer:(e,t,r,i)=>{if(e.slides&&e.slides.length>0){const r={...i,isPresentation:!0};t.presentation=e.write({},r)}}}}})],ee.prototype,"presentation",void 0),e([v({type:B,nonNullable:!0,json:{write:{target:"initialState",isRequired:!0,ignoreOrigin:!0},default:()=>new B({viewingMode:"global",spatialReference:P.WebMercator})}})],ee.prototype,"initialViewProperties",void 0),e([b("initialViewProperties",["initialState.environment","spatialReference","viewingMode","initialState.viewpoint"])],ee.prototype,"readInitialViewProperties",null),e([v({type:P,json:{read:!1,write:{isRequired:!0,ignoreOrigin:!0}}})],ee.prototype,"spatialReference",null),e([v({type:["local","global"],json:{read:!1,write:{isRequired:!0,ignoreOrigin:!0}}})],ee.prototype,"viewingMode",null),e([v({type:E})],ee.prototype,"portalItem",void 0),e([v()],ee.prototype,"resourceInfo",void 0),ee=e([S("esri.WebScene")],ee),function(e){e[e.SAVE=0]="SAVE",e[e.SAVE_AS=1]="SAVE_AS"}(te||(te={}));const re=ee;export{re as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{doSubstitutions as e}from"./executionError.js";import{IANAZone as t,DateTime as n,Zone as r,FixedOffsetZone as s}from"luxon";class i{}var o;i.instance=new t("Etc/UTC"),function(e){e.TimeZoneNotRecognised="TimeZoneNotRecognised"}(o||(o={}));const a={[o.TimeZoneNotRecognised]:"Timezone identifier has not been recognised."};class d extends Error{constructor(t,n){super(e(a[t],n)),this.declaredRootClass="esri.arcade.arcadedate.dateerror",Error.captureStackTrace&&Error.captureStackTrace(this,d)}}class c{constructor(e){this._date=e,this.declaredRootClass="esri.arcade.arcadedate"}static fromParts(e=0,t=1,r=1,s=0,i=0,o=0,a=0,d){if(isNaN(e)||isNaN(t)||isNaN(r)||isNaN(s)||isNaN(i)||isNaN(o)||isNaN(a))return null;let m=0;const h=n.local(e,t).daysInMonth;r<1&&(m=r-1,r=1),r>h&&(m=r-h,r=h);let l=0;t>12?(l=t-12,t=12):t<1&&(l=t-1,t=1);let f=0;i>59?(f=i-59,i=59):i<0&&(f=i,i=0);let T=0;o>59?(T=o-59,o=59):o<0&&(T=o,o=0);let w=0;a>999?(w=a-999,a=999):a<0&&(w=a,a=0);let y=n.fromObject({day:r,year:e,month:t,hour:s,minute:i,second:o,millisecond:a},{zone:u(d)});return 0!==l&&(y=y.plus({months:l})),0!==m&&(y=y.plus({days:m})),0!==f&&(y=y.plus({minutes:f})),0!==T&&(y=y.plus({seconds:T})),0!==w&&(y=y.plus({milliseconds:w})),new c(y)}static get systemTimeZoneCanonicalName(){return Intl.DateTimeFormat().resolvedOptions().timeZone??"system"}static arcadeDateAndZoneToArcadeDate(e,t){const n=u(t);return e.isUnknownTimeZone||n===i.instance?c.fromParts(e.year,e.monthJS+1,e.day,e.hour,e.minute,e.second,e.millisecond,n):new c(e._date.setZone(t))}static dateJSToArcadeDate(e){return new c(n.fromJSDate(e,{zone:"system"}))}static dateJSAndZoneToArcadeDate(e,t="system"){return new c(n.fromJSDate(e,{zone:t}))}static unknownEpochToArcadeDate(e){return new c(n.fromMillis(e,{zone:i.instance}))}static unknownDateJSToArcadeDate(e){return new c(n.fromMillis(e.getTime(),{zone:i.instance}))}static epochToArcadeDate(e,t="system"){return new c(n.fromMillis(e,{zone:t}))}static dateTimeToArcadeDate(e){return new c(e)}changeTimeZone(e){const t=u(e);return c.dateTimeToArcadeDate(this._date.setZone(t))}static dateTimeAndZoneToArcadeDate(e,t){const n=u(t);return e.zone===i.instance||n===i.instance?c.fromParts(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond,n):new c(e.setZone(n))}static nowToArcadeDate(e){return new c(n.fromJSDate(new Date,{zone:e}))}static nowUTCToArcadeDate(){return new c(n.utc())}get isSystem(){return"system"===this.timeZone||this.timeZone===c.systemTimeZoneCanonicalName}equals(e){return this.isSystem&&e.isSystem?this.toNumber()===e.toNumber():this.isUnknownTimeZone===e.isUnknownTimeZone&&this._date.equals(e._date)}get isUnknownTimeZone(){return this._date.zone===i.instance}get isValid(){return this._date.isValid}get hour(){return this._date.hour}get second(){return this._date.second}get day(){return this._date.day}get dayOfWeekISO(){return this._date.weekday}get dayOfWeekJS(){let e=this._date.weekday;return e>6&&(e=0),e}get millisecond(){return this._date.millisecond}get monthISO(){return this._date.month}get weekISO(){return this._date.weekNumber}get yearISO(){return this._date.weekYear}get monthJS(){return this._date.month-1}get year(){return this._date.year}get minute(){return this._date.minute}get zone(){return this._date.zone}get timeZoneOffset(){return this.isUnknownTimeZone?0:this._date.offset}get timeZone(){if(this.isUnknownTimeZone)return"unknown";if("system"===this._date.zone.type)return"system";const e=this.zone;return"fixed"===e.type?0===e.fixed?"utc":e.formatOffset(0,"short"):e.name}stringify(){return JSON.stringify(this.toJSDate())}plus(e){return new c(this._date.plus(e))}diff(e,t="milliseconds"){return this._date.diff(e._date,t)[t]}toISOString(e){return e?this._date.toISO({suppressMilliseconds:!0,includeOffset:!this.isUnknownTimeZone}):this._date.toISO({includeOffset:!this.isUnknownTimeZone})}toFormat(e,t){return this._date.toFormat(e,t)}toJSDate(){return this._date.toJSDate()}toSQLString(){return"timestamp '"+this._date.toFormat("yyyy-LL-dd HH:mm:ss")+"'"}toDateTime(){return this._date}toNumber(){return this._date.toMillis()}getTime(){return this._date.toMillis()}toUTC(){return new c(this._date.toUTC())}toLocal(){return new c(this._date.toLocal())}toString(){return this.toISOString(!0)}}function u(e){if(e instanceof r)return e;if("system"===e.toLowerCase())return"system";if("utc"===e.toLowerCase())return"utc";if("unknown"===e.toLowerCase())return i.instance;if(/^[\+\-]?[0-9]{1,2}([:][0-9]{2})?$/.test(e)){const t=s.parseSpecifier("UTC"+(e.startsWith("+")||e.startsWith("-")?"":"+")+e);if(t)return t}const n=t.create(e);if(!n.isValid)throw new d(o.TimeZoneNotRecognised);return n}export{c as ArcadeDate,d as ArcadeDateError,o as ArcadeDateErrorCodes,a as ArcadeDateErrorMessages,i as UnknownTimeZone,u as createDateTimeZone};
5
+ import{doSubstitutions as e}from"./executionError.js";import{IANAZone as t,DateTime as n,Zone as r,FixedOffsetZone as s}from"luxon";class i{}var o;i.instance=new t("Etc/UTC"),function(e){e.TimeZoneNotRecognised="TimeZoneNotRecognised"}(o||(o={}));const a={[o.TimeZoneNotRecognised]:"Timezone identifier has not been recognised."};class d extends Error{constructor(t,n){super(e(a[t],n)),this.declaredRootClass="esri.arcade.arcadedate.dateerror",Error.captureStackTrace&&Error.captureStackTrace(this,d)}}class c{constructor(e){this._date=e,this.declaredRootClass="esri.arcade.arcadedate"}static fromParts(e=0,t=1,r=1,s=0,i=0,o=0,a=0,d){if(isNaN(e)||isNaN(t)||isNaN(r)||isNaN(s)||isNaN(i)||isNaN(o)||isNaN(a))return null;let m=0;const h=n.local(e,t).daysInMonth;r<1&&(m=r-1,r=1),r>h&&(m=r-h,r=h);let l=0;t>12?(l=t-12,t=12):t<1&&(l=t-1,t=1);let f=0;i>59?(f=i-59,i=59):i<0&&(f=i,i=0);let w=0;o>59?(w=o-59,o=59):o<0&&(w=o,o=0);let T=0;a>999?(T=a-999,a=999):a<0&&(T=a,a=0);let y=n.fromObject({day:r,year:e,month:t,hour:s,minute:i,second:o,millisecond:a},{zone:u(d)});return 0!==l&&(y=y.plus({months:l})),0!==m&&(y=y.plus({days:m})),0!==f&&(y=y.plus({minutes:f})),0!==w&&(y=y.plus({seconds:w})),0!==T&&(y=y.plus({milliseconds:T})),new c(y)}static get systemTimeZoneCanonicalName(){return Intl.DateTimeFormat().resolvedOptions().timeZone??"system"}static arcadeDateAndZoneToArcadeDate(e,t){const n=u(t);return e.isUnknownTimeZone||n===i.instance?c.fromParts(e.year,e.monthJS+1,e.day,e.hour,e.minute,e.second,e.millisecond,n):new c(e._date.setZone(t))}static dateJSToArcadeDate(e){return new c(n.fromJSDate(e,{zone:"system"}))}static dateJSAndZoneToArcadeDate(e,t="system"){return new c(n.fromJSDate(e,{zone:t}))}static unknownEpochToArcadeDate(e){return new c(n.fromMillis(e,{zone:i.instance}))}static unknownDateJSToArcadeDate(e){return new c(n.fromMillis(e.getTime(),{zone:i.instance}))}static epochToArcadeDate(e,t="system"){return new c(n.fromMillis(e,{zone:t}))}static dateTimeToArcadeDate(e){return new c(e)}clone(){return new c(this._date)}changeTimeZone(e){const t=u(e);return c.dateTimeToArcadeDate(this._date.setZone(t))}static dateTimeAndZoneToArcadeDate(e,t){const n=u(t);return e.zone===i.instance||n===i.instance?c.fromParts(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond,n):new c(e.setZone(n))}static nowToArcadeDate(e){return new c(n.fromJSDate(new Date,{zone:e}))}static nowUTCToArcadeDate(){return new c(n.utc())}get isSystem(){return"system"===this.timeZone||this.timeZone===c.systemTimeZoneCanonicalName}equals(e){return this.isSystem&&e.isSystem?this.toNumber()===e.toNumber():this.isUnknownTimeZone===e.isUnknownTimeZone&&this._date.equals(e._date)}get isUnknownTimeZone(){return this._date.zone===i.instance}get isValid(){return this._date.isValid}get hour(){return this._date.hour}get second(){return this._date.second}get day(){return this._date.day}get dayOfWeekISO(){return this._date.weekday}get dayOfWeekJS(){let e=this._date.weekday;return e>6&&(e=0),e}get millisecond(){return this._date.millisecond}get monthISO(){return this._date.month}get weekISO(){return this._date.weekNumber}get yearISO(){return this._date.weekYear}get monthJS(){return this._date.month-1}get year(){return this._date.year}get minute(){return this._date.minute}get zone(){return this._date.zone}get timeZoneOffset(){return this.isUnknownTimeZone?0:this._date.offset}get timeZone(){if(this.isUnknownTimeZone)return"unknown";if("system"===this._date.zone.type)return"system";const e=this.zone;return"fixed"===e.type?0===e.fixed?"utc":e.formatOffset(0,"short"):e.name}stringify(){return JSON.stringify(this.toJSDate())}plus(e){return new c(this._date.plus(e))}diff(e,t="milliseconds"){return this._date.diff(e._date,t)[t]}toISOString(e){return e?this._date.toISO({suppressMilliseconds:!0,includeOffset:!this.isUnknownTimeZone}):this._date.toISO({includeOffset:!this.isUnknownTimeZone})}toFormat(e,t){return this._date.toFormat(e,t)}toJSDate(){return this._date.toJSDate()}toSQLString(){return"timestamp '"+this._date.toFormat("yyyy-LL-dd HH:mm:ss")+"'"}toDateTime(){return this._date}toNumber(){return this._date.toMillis()}getTime(){return this._date.toMillis()}toUTC(){return new c(this._date.toUTC())}toLocal(){return new c(this._date.toLocal())}toString(){return this.toISOString(!0)}}function u(e){if(e instanceof r)return e;if("system"===e.toLowerCase())return"system";if("utc"===e.toLowerCase())return"utc";if("unknown"===e.toLowerCase())return i.instance;if(/^[\+\-]?[0-9]{1,2}([:][0-9]{2})?$/.test(e)){const t=s.parseSpecifier("UTC"+(e.startsWith("+")||e.startsWith("-")?"":"+")+e);if(t)return t}const n=t.create(e);if(!n.isValid)throw new d(o.TimeZoneNotRecognised);return n}export{c as ArcadeDate,d as ArcadeDateError,o as ArcadeDateErrorCodes,a as ArcadeDateErrorMessages,i as UnknownTimeZone,u as createDateTimeZone};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import t from"./Dictionary.js";class e extends t{constructor(t,e,s,i,a,l){super(),this.attachmentUrl=a,this.declaredClass="esri.arcade.Attachment",this.immutable=!1,this.setField("id",t),this.setField("name",e),this.setField("contenttype",s),this.setField("size",i),this.setField("exifinfo",l),this.immutable=!0}}export{e as default};
5
+ import e from"./Dictionary.js";class t extends e{constructor(e,t,i,s,l,d,h){super(),this.attachmentUrl=l,this.declaredClass="esri.arcade.Attachment",this.immutable=!1,this.setField("id",e),this.setField("name",t),this.setField("contenttype",i),this.setField("size",s),this.setField("exifinfo",d),this.setField("keywords",h),this.immutable=!0}deepClone(){return new t(this.field("id"),this.field("name"),this.field("contenttype"),this.field("size"),this.attachmentUrl,this.field("exifinfo")?.deepClone()??null,this.field("keywords"))}}export{t as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{ArcadeDate as t}from"./ArcadeDate.js";import{ArcadeExecutionError as s,ExecutionErrorCodes as i}from"./executionError.js";import e from"./ImmutableArray.js";import{i as n,a as r,b as o,c as a,t as u,d as l,e as c,f,g as h,h as b,j as y,k as m,l as d,m as g}from"../chunks/languageUtils.js";import w from"../geometry/Geometry.js";function J(t,s,i=!1){if(null==t)return null;if(o(t))return h(t);if(r(t))return b(t);if(a(t))return y(t);if(m(t))return d(t,s);if(g(t)){const e=[];for(const n of t)e.push(J(n,s,i));return e}const e=new T;e.immutable=!1;for(const n of Object.keys(t)){const r=t[n];void 0!==r&&e.setField(n,J(r,s,i))}return e.immutable=i,e}class T{constructor(t){this.declaredClass="esri.arcade.Dictionary",this.attributes=null,this.plain=!1,this.immutable=!0,this.attributes=t instanceof T?t.attributes:t??{}}field(t){const e=t.toLowerCase(),n=this.attributes[t];if(void 0!==n)return n;for(const s in this.attributes)if(s.toLowerCase()===e)return this.attributes[s];throw new s(null,i.FieldNotFound,null,{key:t})}setField(e,r){if(this.immutable)throw new s(null,i.Immutable,null);if(n(r))throw new s(null,i.NoFunctionInDictionary,null);const o=e.toLowerCase();r instanceof Date&&(r=t.dateJSToArcadeDate(r));if(void 0===this.attributes[e]){for(const t in this.attributes)if(t.toLowerCase()===o)return void(this.attributes[t]=r);this.attributes[e]=r}else this.attributes[e]=r}hasField(t){const s=t.toLowerCase();if(void 0!==this.attributes[t])return!0;for(const i in this.attributes)if(i.toLowerCase()===s)return!0;return!1}keys(){let t=[];for(const s in this.attributes)t.push(s);return t=t.sort(),t}castToText(s=!1){let i="";for(const n in this.attributes){""!==i&&(i+=",");const l=this.attributes[n];null==l?i+=JSON.stringify(n)+":null":r(l)||o(l)||a(l)?i+=JSON.stringify(n)+":"+JSON.stringify(l):l instanceof w?i+=JSON.stringify(n)+":"+u(l):l instanceof e||l instanceof Array?i+=JSON.stringify(n)+":"+u(l,null,s):l instanceof t?i+=s?JSON.stringify(n)+":"+JSON.stringify(l.getTime()):JSON.stringify(n)+":"+l.stringify():null!==l&&"object"==typeof l&&void 0!==l.castToText&&(i+=JSON.stringify(n)+":"+l.castToText(s))}return"{"+i+"}"}static convertObjectToArcadeDictionary(t,s,i=!0){const e=new T;e.immutable=!1;for(const n in t){const i=t[n];void 0!==i&&e.setField(n.toString(),J(i,s))}return e.immutable=i,e}static convertJsonToArcade(t,s,i=!1){return J(t,s,i)}castAsJson(t=null){const s={};for(let i in this.attributes){const e=this.attributes[i];void 0!==e&&(t?.keyTranslate&&(i=t.keyTranslate(i)),s[i]=l(e,t))}return s}async castDictionaryValueAsJsonAsync(t,s,i,e=null,n){const r=await c(i,e,n);return t[s]=r,r}async castAsJsonAsync(s=null,i=null){const e={},n=[];for(let r in this.attributes){const o=this.attributes[r];i?.keyTranslate&&(r=i.keyTranslate(r)),void 0!==o&&(f(o)||o instanceof w||o instanceof t?e[r]=l(o,i):n.push(this.castDictionaryValueAsJsonAsync(e,r,o,s,i)))}return n.length>0&&await Promise.all(n),e}}export{T as default};
5
+ import{ArcadeDate as t}from"./ArcadeDate.js";import{deepClone as s}from"./deepClone.js";import{ArcadeExecutionError as i,ExecutionErrorCodes as e}from"./executionError.js";import n from"./ImmutableArray.js";import{i as r,a as o,b as a,c as u,t as l,d as c,e as f,f as h,g as m,h as b,j as y,k as d,l as g,m as w,n as J}from"../chunks/languageUtils.js";import p from"../geometry/Geometry.js";function T(t,s,i=!1,e=!1){if(null==t)return null;if(a(t))return m(t);if(o(t))return b(t);if(u(t))return y(t);if(d(t))return g(t,s);if(w(t)){const n=[];for(const r of t)n.push(T(r,s,i,e));return n}if(e&&J(t))return t;const n=new A;n.immutable=!1;for(const r of Object.keys(t)){const o=t[r];void 0!==o&&n.setField(r,T(o,s,i,e))}return n.immutable=i,n}class A{constructor(t){this.declaredClass="esri.arcade.Dictionary",this.attributes=null,this.plain=!1,this.immutable=!0,this.attributes=t instanceof A?t.attributes:t??{}}field(t){const s=t.toLowerCase(),n=this.attributes[t];if(void 0!==n)return n;for(const i in this.attributes)if(i.toLowerCase()===s)return this.attributes[i];throw new i(null,e.FieldNotFound,null,{key:t})}setField(s,n){if(this.immutable)throw new i(null,e.Immutable,null);if(r(n))throw new i(null,e.NoFunctionInDictionary,null);const o=s.toLowerCase();n instanceof Date&&(n=t.dateJSToArcadeDate(n));if(void 0===this.attributes[s]){for(const t in this.attributes)if(t.toLowerCase()===o)return void(this.attributes[t]=n);this.attributes[s]=n}else this.attributes[s]=n}hasField(t){const s=t.toLowerCase();if(void 0!==this.attributes[t])return!0;for(const i in this.attributes)if(i.toLowerCase()===s)return!0;return!1}keys(){let t=[];for(const s in this.attributes)t.push(s);return t=t.sort(),t}castToText(s=!1){let i="";for(const e in this.attributes){""!==i&&(i+=",");const r=this.attributes[e];null==r?i+=JSON.stringify(e)+":null":o(r)||a(r)||u(r)?i+=JSON.stringify(e)+":"+JSON.stringify(r):r instanceof p?i+=JSON.stringify(e)+":"+l(r):r instanceof n||r instanceof Array?i+=JSON.stringify(e)+":"+l(r,null,s):r instanceof t?i+=s?JSON.stringify(e)+":"+JSON.stringify(r.getTime()):JSON.stringify(e)+":"+r.stringify():null!==r&&"object"==typeof r&&void 0!==r.castToText&&(i+=JSON.stringify(e)+":"+r.castToText(s))}return"{"+i+"}"}static convertObjectToArcadeDictionary(t,s,i=!0,e=!1){const n=new A;n.immutable=!1;for(const r in t){const o=t[r];void 0!==o&&n.setField(r.toString(),T(o,s,i,e))}return n.immutable=i,n}static convertJsonToArcade(t,s,i=!1){return T(t,s,i)}castAsJson(t=null){const s={};for(let i in this.attributes){const e=this.attributes[i];void 0!==e&&(t?.keyTranslate&&(i=t.keyTranslate(i)),s[i]=c(e,t))}return s}async castDictionaryValueAsJsonAsync(t,s,i,e=null,n){const r=await f(i,e,n);return t[s]=r,r}async castAsJsonAsync(s=null,i=null){const e={},n=[];for(let r in this.attributes){const o=this.attributes[r];i?.keyTranslate&&(r=i.keyTranslate(r)),void 0!==o&&(h(o)||o instanceof p||o instanceof t?e[r]=c(o,i):n.push(this.castDictionaryValueAsJsonAsync(e,r,o,s,i)))}return n.length>0&&await Promise.all(n),e}deepClone(){const t=new A;t.immutable=!1;for(const i of this.keys())t.setField(i,s(this.field(i)));return t}}export{A as default};
package/arcade/Feature.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import e from"./Dictionary.js";import t from"./ImmutableArray.js";import{a as i,b as r,c as s,t as n,k as a,f as o,d as l}from"../chunks/languageUtils.js";import u from"../geometry/Geometry.js";import d from"../geometry/Point.js";import{fromJSON as f}from"../geometry/support/jsonUtils.js";import{convertToGeometry as c}from"../layers/graphics/featureConversionUtils.js";import{ArcadeDate as h}from"./ArcadeDate.js";import{ArcadeExecutionError as m,ExecutionErrorCodes as y}from"./executionError.js";import{DateTimeReferenceFieldIndex as _}from"./arcadeTimeUtils.js";class b{constructor(){this.arcadeDeclaredClass="esri.arcade.Feature",this._optimizedGeomDefinition=null,this._geometry=null,this.attributes=null,this._layer=null,this._datesfixed=!0,this.dateTimeReferenceFieldIndex=null,this.contextTimeReference=null,this.immutable=!0,this._datefields=null,this.immutable=!0}static createFromGraphic(e,t){const i=new b;return i.contextTimeReference=t??null,i._geometry=null!=e.geometry?e.geometry:null,void 0===e.attributes||null===e.attributes?i.attributes={}:i.attributes=e.attributes,e._sourceLayer?(i._layer=e._sourceLayer,i._datesfixed=!1):e._layer?(i._layer=e._layer,i._datesfixed=!1):e.layer&&"fields"in e.layer?(i._layer=e.layer,i._datesfixed=!1):e.sourceLayer&&"fields"in e.sourceLayer&&(i._layer=e.sourceLayer,i._datesfixed=!1),i._layer&&!1===i._datesfixed&&(void 0!==i._layer.dateTimeReferenceFieldIndex?i.dateTimeReferenceFieldIndex=i._layer.dateTimeReferenceFieldIndex:i.dateTimeReferenceFieldIndex=_.createFromLayer(i._layer)),i}static createFromArcadeFeature(e){const t=new b;return t._datesfixed=e._datesfixed,t.attributes=e.attributes,t._geometry=e._geometry,t._optimizedGeomDefinition=e._optimizedGeomDefinition,e._layer&&(t._layer=e._layer),t.dateTimeReferenceFieldIndex=e.dateTimeReferenceFieldIndex,t.contextTimeReference=e.contextTimeReference,t}static createFromOptimisedFeature(e,t,i){const r=new b;return r._geometry=e.geometry?{geometry:e.geometry}:null,r._optimizedGeomDefinition=i,r.attributes=e.attributes||{},r._layer=t,r._datesfixed=!1,r}static createFromArcadeDictionary(t){const i=new b;return i.attributes=t.field("attributes"),null!==i.attributes&&i.attributes instanceof e?(i.attributes=i.attributes.attributes,null===i.attributes&&(i.attributes={})):i.attributes={},i._geometry=t.field("geometry"),null!==i._geometry&&(i._geometry instanceof e?i._geometry=b.parseGeometryFromDictionary(i._geometry):i._geometry instanceof u||(i._geometry=null)),i}static createFromGraphicLikeObject(e,t,i=null,r){const s=new b;return s.contextTimeReference=r??null,null===t&&(t={}),s.attributes=t,s._geometry=null!=e?e:null,s._layer=i,s._layer&&(s._datesfixed=!1,void 0!==s._layer.dateTimeReferenceFieldIndex?s.dateTimeReferenceFieldIndex=s._layer.dateTimeReferenceFieldIndex:s.dateTimeReferenceFieldIndex=_.createFromLayer(s._layer)),s}repurposeFromGraphicLikeObject(e,t,i=null){null===t&&(t={}),this.attributes=t,this._geometry=e??null,this._layer=i,this._layer?this._datesfixed=!1:this._datesfixed=!0}get layerPreferredTimeZone(){return this.dateTimeReferenceFieldIndex?.layerPreferredTimeZone??""}fieldSourceTimeZone(e){return this.dateTimeReferenceFieldIndex?.fieldTimeZone(e)??""}castToText(e=!1){let a="";!1===this._datesfixed&&this._fixDates();for(const o in this.attributes){""!==a&&(a+=",");const l=this.attributes[o];null==l?a+=JSON.stringify(o)+":null":i(l)||r(l)||s(l)?a+=JSON.stringify(o)+":"+JSON.stringify(l):l instanceof u?a+=JSON.stringify(o)+":"+n(l):l instanceof t||l instanceof Array?a+=JSON.stringify(o)+":"+n(l,null,e):l instanceof h?a+=e?JSON.stringify(o)+":"+JSON.stringify(l.getTime()):JSON.stringify(o)+":"+l.stringify():null!==l&&"object"==typeof l&&void 0!==l.castToText&&(a+=JSON.stringify(o)+":"+l.castToText(e))}return'{"geometry":'+(null===this.geometry()?"null":n(this.geometry()))+',"attributes":{'+a+"}}"}_fixDates(){if(null!==this._datefields)return this._datefields.length>0&&this._fixDateFields(this._datefields),void(this._datesfixed=!0);const e=[],t=this._layer.fields;for(let i=0;i<t.length;i++){const r=t[i],s=r.type;"date"!==s&&"esriFieldTypeDate"!==s||e.push(r.name)}this._datefields=e,e.length>0&&this._fixDateFields(e),this._datesfixed=!0}isUnknownDateTimeField(e){return"unknown"===this.dateTimeReferenceFieldIndex?.fieldTimeZone(e)}_fixDateFields(e){this.attributes={...this.attributes};const t=this.contextTimeReference?.timeZone??"system";for(let i=0;i<e.length;i++){let r=this.attributes[e[i]];if(null===r);else if(void 0===r){for(const s in this.attributes)if(s.toLowerCase()===e[i].toLowerCase()){if(r=this.attributes[s],null!==r){const e=this.isUnknownDateTimeField(s);a(r)?this.attributes[s]=r:r instanceof Date?this.attributes[s]=e?h.unknownDateJSToArcadeDate(r):h.dateJSAndZoneToArcadeDate(r,t):this.attributes[s]=e?h.unknownEpochToArcadeDate(r):h.epochToArcadeDate(r,t)}break}}else{const s=this.isUnknownDateTimeField(e[i]);a(r)?this.attributes[e[i]]=r:r instanceof Date?this.attributes[e[i]]=s?h.unknownDateJSToArcadeDate(r):h.dateJSAndZoneToArcadeDate(r,t):this.attributes[e[i]]=s?h.unknownEpochToArcadeDate(r):h.epochToArcadeDate(r,t)}}}geometry(){return null===this._geometry||this._geometry instanceof u||(this._optimizedGeomDefinition?(this._geometry=f(c(this._geometry,this._optimizedGeomDefinition.geometryType,this._optimizedGeomDefinition.hasZ,this._optimizedGeomDefinition.hasM)),this._geometry.spatialReference=this._optimizedGeomDefinition.spatialReference):this._geometry=f(this._geometry)),this._geometry}field(e){!1===this._datesfixed&&this._fixDates();const t=this.attributes[e];if(void 0!==t)return t;const i=e.toLowerCase();for(const r in this.attributes)if(r.toLowerCase()===i)return this.attributes[r];if(this._hasFieldDefinition(i))return null;throw new m(null,y.FieldNotFound,null,{key:e})}_hasFieldDefinition(e){if(null===this._layer)return!1;for(let t=0;t<this._layer.fields.length;t++){if(this._layer.fields[t].name.toLowerCase()===e)return!0}return!1}setField(e,t){if(this.immutable)throw new m(null,y.Immutable,null);if(t instanceof Date&&(t=this.isUnknownDateTimeField(e)?h.unknownDateJSToArcadeDate(t):h.dateJSToArcadeDate(t)),!1===o(t))throw new m(null,y.TypeNotAllowedInFeature,null);const i=e.toLowerCase();if(void 0===this.attributes[e]){for(const e in this.attributes)if(e.toLowerCase()===i)return void(this.attributes[e]=t);this.attributes[e]=t}else this.attributes[e]=t}hasField(e){const t=e.toLowerCase();if(void 0!==this.attributes[e])return!0;for(const i in this.attributes)if(i.toLowerCase()===t)return!0;return!!this._hasFieldDefinition(t)}keys(){let e=[];const t={};for(const i in this.attributes)e.push(i),t[i.toLowerCase()]=1;if(null!==this._layer)for(let i=0;i<this._layer.fields.length;i++){const r=this._layer.fields[i];1!==t[r.name.toLowerCase()]&&e.push(r.name)}return e=e.sort(),e}static parseGeometryFromDictionary(e){const t=b._convertDictionaryToJson(e,!0);return void 0!==t.hasm&&(t.hasM=t.hasm,delete t.hasm),void 0!==t.hasz&&(t.hasZ=t.hasz,delete t.hasz),void 0!==t.spatialreference&&(t.spatialReference=t.spatialreference,delete t.spatialreference),void 0!==t.rings&&(t.rings=this._fixPathArrays(t.rings,!0===t.hasZ,!0===t.hasZ)),void 0!==t.paths&&(t.paths=this._fixPathArrays(t.paths,!0===t.hasZ,!0===t.hasM)),void 0!==t.points&&(t.points=this._fixPointArrays(t.points,!0===t.hasZ,!0===t.hasM)),f(t)}static _fixPathArrays(e,i,r){const s=[];if(e instanceof Array)for(let t=0;t<e.length;t++)s.push(this._fixPointArrays(e[t],i,r));else if(e instanceof t)for(let t=0;t<e.length();t++)s.push(this._fixPointArrays(e.get(t),i,r));return s}static _fixPointArrays(e,i,r){const s=[];if(e instanceof Array)for(let n=0;n<e.length;n++){const a=e[n];a instanceof d?i&&r?s.push([a.x,a.y,a.z,a.m]):i?s.push([a.x,a.y,a.z]):r?s.push([a.x,a.y,a.m]):s.push([a.x,a.y]):a instanceof t?s.push(a.toArray()):s.push(a)}else if(e instanceof t)for(let n=0;n<e.length();n++){const a=e.get(n);a instanceof d?i&&r?s.push([a.x,a.y,a.z,a.m]):i?s.push([a.x,a.y,a.z]):r?s.push([a.x,a.y,a.m]):s.push([a.x,a.y]):a instanceof t?s.push(a.toArray()):s.push(a)}return s}static _convertDictionaryToJson(t,i=!1){const r={};for(const s in t.attributes){let n=t.attributes[s];n instanceof e&&(n=b._convertDictionaryToJson(n)),i?r[s.toLowerCase()]=n:r[s]=n}return r}static parseAttributesFromDictionary(e){const t={};for(const i in e.attributes){const r=e.attributes[i];if(!o(r))throw new m(null,y.InvalidParameter,null);t[i]=r}return t}static fromJson(e,t){let n=null;null!==e.geometry&&void 0!==e.geometry&&(n=f(e.geometry));const o={};if(null!==e.attributes&&void 0!==e.attributes)for(const l in e.attributes){const t=e.attributes[l];if(null===t)o[l]=t;else{if(!(s(t)||r(t)||i(t)||a(t)))throw new m(null,y.InvalidParameter,null);o[l]=t}}return b.createFromGraphicLikeObject(n,o,null,t??null)}fullSchema(){return this._layer}gdbVersion(){if(null===this._layer)return"";const e=this._layer.gdbVersion;return void 0===e?"":""===e&&this._layer.capabilities&&this._layer.capabilities.isVersioned?"SDE.DEFAULT":e}castAsJson(e){const t={attributes:{},geometry:!0===e?.keepGeometryType?this.geometry():this.geometry()?.toJSON()??null};for(const i in this.attributes){const r=this.attributes[i];void 0!==r&&(t.attributes[i]=l(r,e))}return t}async castAsJsonAsync(e=null,t){return this.castAsJson(t)}}export{b as default};
5
+ import e from"./Dictionary.js";import t from"./ImmutableArray.js";import{a as i,b as r,c as s,t as n,k as a,f as o,d as l}from"../chunks/languageUtils.js";import u from"../geometry/Geometry.js";import f from"../geometry/Point.js";import{fromJSON as c}from"../geometry/support/jsonUtils.js";import{convertToGeometry as d}from"../layers/graphics/featureConversionUtils.js";import{ArcadeDate as h}from"./ArcadeDate.js";import{ArcadeExecutionError as m,ExecutionErrorCodes as y}from"./executionError.js";import{DateTimeReferenceFieldIndex as _}from"./arcadeTimeUtils.js";import{configureDeepClone as p}from"./deepClone.js";class b{constructor(){this.arcadeDeclaredClass="esri.arcade.Feature",this._optimizedGeomDefinition=null,this._geometry=null,this.attributes=null,this._layer=null,this._datesfixed=!0,this.dateTimeReferenceFieldIndex=null,this.contextTimeReference=null,this.immutable=!0,this._datefields=null,this.immutable=!0}static createFromGraphic(e,t){const i=new b;return i.contextTimeReference=t??null,i._geometry=null!=e.geometry?e.geometry:null,void 0===e.attributes||null===e.attributes?i.attributes={}:i.attributes=e.attributes,e._sourceLayer?(i._layer=e._sourceLayer,i._datesfixed=!1):e._layer?(i._layer=e._layer,i._datesfixed=!1):e.layer&&"fields"in e.layer?(i._layer=e.layer,i._datesfixed=!1):e.sourceLayer&&"fields"in e.sourceLayer&&(i._layer=e.sourceLayer,i._datesfixed=!1),i._layer&&!1===i._datesfixed&&(void 0!==i._layer.dateTimeReferenceFieldIndex?i.dateTimeReferenceFieldIndex=i._layer.dateTimeReferenceFieldIndex:i.dateTimeReferenceFieldIndex=_.createFromLayer(i._layer)),i}static createFromArcadeFeature(e){if(e instanceof b){const t=new b;return t._datesfixed=e._datesfixed,t.attributes=e.attributes,t._geometry=e._geometry,t._optimizedGeomDefinition=e._optimizedGeomDefinition,e._layer&&(t._layer=e._layer),t.dateTimeReferenceFieldIndex=e.dateTimeReferenceFieldIndex,t.contextTimeReference=e.contextTimeReference,t}const t={};for(const i of e.keys())t[i]=e.field(i);return b.createFromGraphicLikeObject(e.geometry(),t,e.fullSchema(),e.contextTimeReference)}static createFromOptimisedFeature(e,t,i){const r=new b;return r._geometry=e.geometry?{geometry:e.geometry}:null,r._optimizedGeomDefinition=i,r.attributes=e.attributes||{},r._layer=t,r._datesfixed=!1,r}static createFromArcadeDictionary(t){const i=new b;return i.attributes=t.field("attributes"),null!==i.attributes&&i.attributes instanceof e?(i.attributes=i.attributes.attributes,null===i.attributes&&(i.attributes={})):i.attributes={},i._geometry=t.field("geometry"),null!==i._geometry&&(i._geometry instanceof e?i._geometry=b.parseGeometryFromDictionary(i._geometry):i._geometry instanceof u||(i._geometry=null)),i}static createFromGraphicLikeObject(e,t,i=null,r){const s=new b;return s.contextTimeReference=r??null,null===t&&(t={}),s.attributes=t,s._geometry=null!=e?e:null,s._layer=i,s._layer&&(s._datesfixed=!1,void 0!==s._layer.dateTimeReferenceFieldIndex?s.dateTimeReferenceFieldIndex=s._layer.dateTimeReferenceFieldIndex:s.dateTimeReferenceFieldIndex=_.createFromLayer(s._layer)),s}repurposeFromGraphicLikeObject(e,t,i=null){null===t&&(t={}),this.attributes=t,this._geometry=e??null,this._layer=i,this._layer?this._datesfixed=!1:this._datesfixed=!0}get layerPreferredTimeZone(){return this.dateTimeReferenceFieldIndex?.layerPreferredTimeZone??""}fieldSourceTimeZone(e){return this.dateTimeReferenceFieldIndex?.fieldTimeZone(e)??""}castToText(e=!1){let a="";!1===this._datesfixed&&this._fixDates();for(const o in this.attributes){""!==a&&(a+=",");const l=this.attributes[o];null==l?a+=JSON.stringify(o)+":null":i(l)||r(l)||s(l)?a+=JSON.stringify(o)+":"+JSON.stringify(l):l instanceof u?a+=JSON.stringify(o)+":"+n(l):l instanceof t||l instanceof Array?a+=JSON.stringify(o)+":"+n(l,null,e):l instanceof h?a+=e?JSON.stringify(o)+":"+JSON.stringify(l.getTime()):JSON.stringify(o)+":"+l.stringify():null!==l&&"object"==typeof l&&void 0!==l.castToText&&(a+=JSON.stringify(o)+":"+l.castToText(e))}return'{"geometry":'+(null===this.geometry()?"null":n(this.geometry()))+',"attributes":{'+a+"}}"}_fixDates(){if(null!==this._datefields)return this._datefields.length>0&&this._fixDateFields(this._datefields),void(this._datesfixed=!0);const e=[],t=this._layer.fields;for(let i=0;i<t.length;i++){const r=t[i],s=r.type;"date"!==s&&"esriFieldTypeDate"!==s||e.push(r.name)}this._datefields=e,e.length>0&&this._fixDateFields(e),this._datesfixed=!0}isUnknownDateTimeField(e){return"unknown"===this.dateTimeReferenceFieldIndex?.fieldTimeZone(e)}_fixDateFields(e){this.attributes={...this.attributes};const t=this.contextTimeReference?.timeZone??"system";for(let i=0;i<e.length;i++){let r=this.attributes[e[i]];if(null===r);else if(void 0===r){for(const s in this.attributes)if(s.toLowerCase()===e[i].toLowerCase()){if(r=this.attributes[s],null!==r){const e=this.isUnknownDateTimeField(s);a(r)?this.attributes[s]=r:r instanceof Date?this.attributes[s]=e?h.unknownDateJSToArcadeDate(r):h.dateJSAndZoneToArcadeDate(r,t):this.attributes[s]=e?h.unknownEpochToArcadeDate(r):h.epochToArcadeDate(r,t)}break}}else{const s=this.isUnknownDateTimeField(e[i]);a(r)?this.attributes[e[i]]=r:r instanceof Date?this.attributes[e[i]]=s?h.unknownDateJSToArcadeDate(r):h.dateJSAndZoneToArcadeDate(r,t):this.attributes[e[i]]=s?h.unknownEpochToArcadeDate(r):h.epochToArcadeDate(r,t)}}}geometry(){return null===this._geometry||this._geometry instanceof u||(this._optimizedGeomDefinition?(this._geometry=c(d(this._geometry,this._optimizedGeomDefinition.geometryType,this._optimizedGeomDefinition.hasZ,this._optimizedGeomDefinition.hasM)),this._geometry.spatialReference=this._optimizedGeomDefinition.spatialReference):this._geometry=c(this._geometry)),this._geometry}field(e){!1===this._datesfixed&&this._fixDates();const t=this.attributes[e];if(void 0!==t)return t;const i=e.toLowerCase();for(const r in this.attributes)if(r.toLowerCase()===i)return this.attributes[r];if(this._hasFieldDefinition(i))return null;throw new m(null,y.FieldNotFound,null,{key:e})}_hasFieldDefinition(e){if(null===this._layer)return!1;for(let t=0;t<this._layer.fields.length;t++){if(this._layer.fields[t].name.toLowerCase()===e)return!0}return!1}setField(e,t){if(this.immutable)throw new m(null,y.Immutable,null);if(t instanceof Date&&(t=this.isUnknownDateTimeField(e)?h.unknownDateJSToArcadeDate(t):h.dateJSToArcadeDate(t)),!1===o(t))throw new m(null,y.TypeNotAllowedInFeature,null);const i=e.toLowerCase();if(void 0===this.attributes[e]){for(const e in this.attributes)if(e.toLowerCase()===i)return void(this.attributes[e]=t);this.attributes[e]=t}else this.attributes[e]=t}hasField(e){const t=e.toLowerCase();if(void 0!==this.attributes[e])return!0;for(const i in this.attributes)if(i.toLowerCase()===t)return!0;return!!this._hasFieldDefinition(t)}keys(){let e=[];const t={};for(const i in this.attributes)e.push(i),t[i.toLowerCase()]=1;if(null!==this._layer)for(let i=0;i<this._layer.fields.length;i++){const r=this._layer.fields[i];1!==t[r.name.toLowerCase()]&&e.push(r.name)}return e=e.sort(),e}static parseGeometryFromDictionary(e){const t=b._convertDictionaryToJson(e,!0);return void 0!==t.hasm&&(t.hasM=t.hasm,delete t.hasm),void 0!==t.hasz&&(t.hasZ=t.hasz,delete t.hasz),void 0!==t.spatialreference&&(t.spatialReference=t.spatialreference,delete t.spatialreference),void 0!==t.rings&&(t.rings=this._fixPathArrays(t.rings,!0===t.hasZ,!0===t.hasZ)),void 0!==t.paths&&(t.paths=this._fixPathArrays(t.paths,!0===t.hasZ,!0===t.hasM)),void 0!==t.points&&(t.points=this._fixPointArrays(t.points,!0===t.hasZ,!0===t.hasM)),c(t)}static _fixPathArrays(e,i,r){const s=[];if(e instanceof Array)for(let t=0;t<e.length;t++)s.push(this._fixPointArrays(e[t],i,r));else if(e instanceof t)for(let t=0;t<e.length();t++)s.push(this._fixPointArrays(e.get(t),i,r));return s}static _fixPointArrays(e,i,r){const s=[];if(e instanceof Array)for(let n=0;n<e.length;n++){const a=e[n];a instanceof f?i&&r?s.push([a.x,a.y,a.z,a.m]):i?s.push([a.x,a.y,a.z]):r?s.push([a.x,a.y,a.m]):s.push([a.x,a.y]):a instanceof t?s.push(a.toArray()):s.push(a)}else if(e instanceof t)for(let n=0;n<e.length();n++){const a=e.get(n);a instanceof f?i&&r?s.push([a.x,a.y,a.z,a.m]):i?s.push([a.x,a.y,a.z]):r?s.push([a.x,a.y,a.m]):s.push([a.x,a.y]):a instanceof t?s.push(a.toArray()):s.push(a)}return s}static _convertDictionaryToJson(t,i=!1){const r={};for(const s in t.attributes){let n=t.attributes[s];n instanceof e&&(n=b._convertDictionaryToJson(n)),i?r[s.toLowerCase()]=n:r[s]=n}return r}static parseAttributesFromDictionary(e){const t={};for(const i in e.attributes){const r=e.attributes[i];if(!o(r))throw new m(null,y.InvalidParameter,null);t[i]=r}return t}static fromJson(e,t){let n=null;null!==e.geometry&&void 0!==e.geometry&&(n=c(e.geometry));const o={};if(null!==e.attributes&&void 0!==e.attributes)for(const l in e.attributes){const t=e.attributes[l];if(null===t)o[l]=t;else{if(!(s(t)||r(t)||i(t)||a(t)))throw new m(null,y.InvalidParameter,null);o[l]=t}}return b.createFromGraphicLikeObject(n,o,null,t??null)}fullSchema(){return this._layer}gdbVersion(){if(null===this._layer)return"";const e=this._layer.gdbVersion;return void 0===e?"":""===e&&this._layer.capabilities&&this._layer.capabilities.isVersioned?"SDE.DEFAULT":e}castAsJson(e){const t={attributes:{},geometry:!0===e?.keepGeometryType?this.geometry():this.geometry()?.toJSON()??null};for(const i in this.attributes){const r=this.attributes[i];void 0!==r&&(t.attributes[i]=l(r,e))}return t}async castAsJsonAsync(e=null,t){return this.castAsJson(t)}}p(b);export{b as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{ArcadeModule as e}from"./ArcadeModule.js";import{ArcadeModuleLoader as t}from"./ArcadeModuleLoader.js";import n from"./Dictionary.js";import{ArcadeExecutionError as r,ExecutionErrorCodes as o,ensureArcadeExecutionError as a}from"./executionError.js";import i from"./Feature.js";import{NativeFunction as l,ArcadeFunction as s,ScopeMarshalledFunction as c,wrapModuleScopedResponse as u}from"./FunctionWrapper.js";import{y as f,a as p,s as w,p as d,v as h,o as m,i as g,c as y,R as v,m as b,x as S,w as x,T as I,b as R,g as F,I as C,j as A,r as M,u as j,q as L}from"../chunks/languageUtils.js";import{addFunctionDeclaration as k}from"./treeAnalysis.js";import{A as N}from"../chunks/array.js";import{registerFunctions as O}from"./functions/date.js";import{registerFunctions as E}from"./functions/geomasync.js";import{registerFunctions as B,geometryMember as P}from"./functions/geometry.js";import{registerFunctions as K}from"./functions/maths.js";import{registerFunctions as D}from"./functions/stats.js";import{registerFunctions as G}from"./functions/string.js";import T from"../geometry/Geometry.js";import U from"../geometry/SpatialReference.js";function q(e){return e&&"function"==typeof e.then}const W=100;async function V(e,t){const n=[];for(let r=0;r<t.arguments.length;r++)n.push(await J(e,t.arguments[r]));return n}async function _(e,t,n){if(!0===t.preparsed)return n(e,null,t.arguments);return n(e,t,await V(e,t))}class Y extends s{constructor(e,t){super(),this.definition=null,this.context=null,this.definition=e,this.context=t}createFunction(e){return(...t)=>{const n={spatialReference:this.context.spatialReference,console:this.context.console,lrucache:this.context.lrucache,timeReference:this.context.timeReference??null,exports:this.context.exports,libraryResolver:this.context.libraryResolver,interceptor:this.context.interceptor,localScope:{},depthCounter:{depth:e.depthCounter+1},globalScope:this.context.globalScope};if(n.depthCounter.depth>64)throw new r(e,o.MaximumCallDepth,null);return Pe(this.definition,n,t,null)}}call(e,t){return H(e,t,((n,a,i)=>{const l={spatialReference:e.spatialReference,services:e.services,console:e.console,libraryResolver:e.libraryResolver,exports:e.exports,lrucache:e.lrucache,timeReference:e.timeReference??null,interceptor:e.interceptor,localScope:{},abortSignal:e.abortSignal,globalScope:e.globalScope,depthCounter:{depth:e.depthCounter.depth+1}};if(l.depthCounter.depth>64)throw new r(e,o.MaximumCallDepth,t);return Pe(this.definition,l,i,t)}))}marshalledCall(e,t,n,r){return r(e,t,(async(o,a,i)=>{const l={spatialReference:e.spatialReference,globalScope:n.globalScope,depthCounter:{depth:e.depthCounter.depth+1},libraryResolver:e.libraryResolver,exports:e.exports,console:e.console,abortSignal:e.abortSignal,lrucache:e.lrucache,timeReference:e.timeReference??null,interceptor:e.interceptor,localScope:{}};return i=i.map((t=>!g(t)||t instanceof c?t:u(t,e,r))),u(await Pe(this.definition,l,i,t),n,r)}))}}class z extends e{constructor(e){super(e)}async global(e){const t=this.executingContext.globalScope[e.toLowerCase()];if(t.valueset||(t.value=await J(this.executingContext,t.node),t.valueset=!0),g(t.value)&&!(t.value instanceof c)){const e=new c;e.fn=t.value,e.parameterEvaluator=H,e.context=this.executingContext,t.value=e}return t.value}setGlobal(e,t){if(g(t))throw new r(null,o.AssignModuleFunction,null);this.executingContext.globalScope[e.toLowerCase()]={value:t,valueset:!0,node:null}}hasGlobal(e){return void 0===this.executingContext.exports[e]&&(e=e.toLowerCase()),void 0!==this.executingContext.exports[e]}async loadModule(e){let n=e.spatialReference;null==n&&(n=new U({wkid:102100})),this.moduleScope=Ge({},e.customfunctions,e.timeReference),this.executingContext={spatialReference:n,services:e.services,libraryResolver:new t(e.libraryResolver._moduleSingletons,this.source.syntax.loadedModules),exports:{},abortSignal:void 0===e.abortSignal||null===e.abortSignal?{aborted:!1}:e.abortSignal,globalScope:this.moduleScope,console:e.console??Te,lrucache:e.lrucache,timeReference:e.timeReference??null,interceptor:e.interceptor,localScope:null,depthCounter:{depth:1}},await J(this.executingContext,this.source.syntax)}}async function H(e,t,n){if(!0===t.preparsed){const r=n(e,null,t.arguments);return q(r),r}const r=n(e,t,await V(e,t));return q(r),r}async function J(e,t,n){if(t.breakpoint&&!0!==n){const n=t.breakpoint();return await n,J(e,t,!0)}try{switch(t?.type){case"VariableDeclarator":return await xe(e,t);case"ImportDeclaration":return await ve(e,t);case"ExportNamedDeclaration":return await be(e,t);case"VariableDeclaration":return await Se(e,t,0);case"BlockStatement":case"Program":return await he(e,t);case"FunctionDeclaration":return await ye(e,t);case"ReturnStatement":return await ge(e,t);case"IfStatement":return await de(e,t);case"ExpressionStatement":return await we(e,t);case"UpdateExpression":return await ue(e,t);case"AssignmentExpression":return await pe(e,t);case"ForStatement":return await ne(e,t);case"WhileStatement":return await Z(e,t);case"ForInStatement":return await ce(e,t);case"BreakStatement":return m;case"EmptyStatement":return h;case"ContinueStatement":return d;case"TemplateElement":return await Le(e,t);case"TemplateLiteral":return await Ne(e,t);case"Identifier":return await Me(e,t);case"MemberExpression":return await Ie(e,t);case"Literal":return t.value;case"CallExpression":return await je(e,t);case"UnaryExpression":return await Re(e,t);case"BinaryExpression":return await Ce(e,t);case"LogicalExpression":return await Ae(e,t);case"ArrayExpression":return await Fe(e,t);case"ObjectExpression":return await Q(e,t);case"Property":return await X(e,t);default:throw new r(e,o.Unrecognised,t)}}catch(i){throw a(e,t,i)}}async function Q(e,t){const a=[];for(let n=0;n<t.properties.length;n++)a[n]=await J(e,t.properties[n]);const i={},l=new Map;for(let n=0;n<a.length;n++){const s=a[n];if(g(s.value))throw new r(e,o.NoFunctionInDictionary,t);if(!1===y(s.key))throw new r(e,o.KeyMustBeString,t);let c=s.key.toString();const u=c.toLowerCase();l.has(u)?c=l.get(u):l.set(u,c),s.value===h?i[c]=null:i[c]=s.value}const s=new n(i);return s.immutable=!1,s}async function X(e,t){const n=await J(e,t.value);if("Identifier"===t.key.type)return{key:t.key.name,value:n};return{key:await J(e,t.key),value:n}}async function Z(e,t){const n={testResult:!0,lastAction:h};if(n.testResult=await J(e,t.test),!1===n.testResult)return h;if(!0!==n.testResult)throw new r(e,o.BooleanConditionRequired,t);for(;!0===n.testResult&&(n.lastAction=await J(e,t.body),n.lastAction!==m)&&!(n.lastAction instanceof v);)if(n.testResult=await J(e,t.test),!0!==n.testResult&&!1!==n.testResult)throw new r(e,o.BooleanConditionRequired,t);return n.lastAction instanceof v?n.lastAction:h}async function $(e,t,n){const r=await J(e,t.body);return n.lastAction=r,n.lastAction===m||n.lastAction instanceof v?(n.testResult=!1,n):null!==t.update?(await J(e,t.update),n):n}async function ee(e,t,n){if(null!==t.test){const a=await J(e,t.test);if(!0===e.abortSignal?.aborted)throw new r(e,o.Cancelled,t);if(n.testResult=a,!1===n.testResult)return n;if(!0!==n.testResult)throw new r(e,o.BooleanConditionRequired,t);return $(e,t,n)}return $(e,t,n)}function te(e,t,n,r,o,a){try{ee(e,t,n).then((()=>{try{!0===n.testResult?++a>W?(a=0,setTimeout((()=>{te(e,t,n,r,o,a)}),0)):te(e,t,n,r,o,a):n.lastAction instanceof v?r(n.lastAction):r(h)}catch(i){o(i)}}),(e=>{o(e)}))}catch(i){o(i)}}function ne(e,t){try{return null!==t.init?J(e,t.init).then((()=>new Promise(((n,r)=>{te(e,t,{testResult:!0,lastAction:h},(e=>{n(e)}),(e=>{r(e)}),0)})))):new Promise(((n,r)=>{te(e,t,{testResult:!0,lastAction:h},(e=>{n(e)}),(e=>{r(e)}),0)}))}catch(n){return Promise.reject(n)}}function re(e,t,n,r,o,a,i,l,s,c){try{if(r<=a)return void l(h);o.value="k"===i?n[a]:a,J(e,t.body).then((u=>{try{u instanceof v?l(u):u===m?l(h):++c>W?(c=0,setTimeout((()=>{re(e,t,n,r,o,a+1,i,l,s,c)}),0)):re(e,t,n,r,o,a+1,i,l,s,c)}catch(f){s(f)}}),(e=>{s(e)}))}catch(u){s(u)}}function oe(e,t,n,r,o,a,i,l,s){try{if(n.length()<=o)return void i(h);r.value="k"===a?n.get(o):o,J(e,t.body).then((c=>{c instanceof v?i(c):c===m?i(h):++s>W?(s=0,setTimeout((()=>{oe(e,t,n,r,o+1,a,i,l,s)}),0)):oe(e,t,n,r,o+1,a,i,l,s)}),(e=>{l(e)}))}catch(c){l(c)}}function ae(e,t,n,r,o,a){try{if(void 0===a&&(a="i"),0===n.length)return void r.resolve(h);re(e,t,n,n.length,o,0,a,(e=>{r.resolve(e)}),(e=>{r.reject(e)}),0)}catch(i){r.reject(i)}}function ie(e,t,n,r,o,a){try{if(void 0===a&&(a="i"),0===n.length)return void r.resolve(h);oe(e,t,n,o,0,a,(e=>{r.resolve(e)}),(e=>{r.reject(e)}),0)}catch(i){r.reject(i)}}function le(e,t,n,r,o){try{ae(e,t,n.keys(),r,o,"k")}catch(a){r.reject(a)}}function se(e,t,n,r,o,a,l,s){try{e.next().then((c=>{try{if(null===c)a(h);else{const u=i.createFromGraphicLikeObject(c.geometry,c.attributes,r,t.timeReference);u._underlyingGraphic=c,o.value=u;J(t,n.body).then((i=>{try{i===m?a(h):i instanceof v?a(i):++s>W?(s=0,setTimeout((()=>{se(e,t,n,r,o,a,l,s)}),0)):se(e,t,n,r,o,a,l,s)}catch(c){l(c)}}),(e=>{l(e)}))}}catch(u){l(u)}}),(e=>{l(e)}))}catch(c){l(c)}}async function ce(e,t){return new Promise(((a,i)=>{J(e,t.right).then((l=>{try{let s=null;s="VariableDeclaration"===t.left.type?J(e,t.left):Promise.resolve(),s.then((()=>{try{let s="";if("VariableDeclaration"===t.left.type){const e=t.left.declarations[0].id;"Identifier"===e.type&&(s=e.name)}else"Identifier"===t.left.type&&(s=t.left.name);if(!s)throw new r(e,o.InvalidIdentifier,t);s=s.toLowerCase();let c=null;if(null!=e.localScope&&void 0!==e.localScope[s]&&(c=e.localScope[s]),null===c&&void 0!==e.globalScope[s]&&(c=e.globalScope[s]),null===c)return void i(new r(e,o.InvalidIdentifier,t));b(l)||y(l)?ae(e,t,l,{reject:i,resolve:a},c):S(l)?ie(e,t,l,{reject:i,resolve:a},c):l instanceof n||x(l)?le(e,t,l,{reject:i,resolve:a},c):I(l)?se(l.iterator(e.abortSignal),e,t,l,c,(e=>{a(e)}),(e=>{i(e)}),0):ae(e,t,[],{reject:i,resolve:a},c)}catch(s){i(s)}}),i)}catch(s){i(s)}}),i)}))}async function ue(e,t){const a=t.argument;if("MemberExpression"===a.type){const i={t:null},l=await J(e,a.object);let s=null;i.t=l,!0===a.computed?s=await J(e,a.property):"Identifier"===a.property.type&&(s=a.property.name);const c=i.t;let u;if(b(c)){if(!R(s))throw new r(e,o.ArrayAccessorMustBeNumber,t);if(s<0&&(s=c.length+s),s<0||s>=c.length)throw new r(e,o.OutOfBounds,t);u=F(c[s]),c[s]="++"===t.operator?u+1:u-1}else if(c instanceof n){if(!1===y(s))throw new r(e,o.KeyAccessorMustBeString,t);if(!0!==c.hasField(s))throw new r(e,o.FieldNotFound,t,{key:s});u=F(c.field(s)),c.setField(s,"++"===t.operator?u+1:u-1)}else if(c instanceof z){if(!1===y(s))throw new r(e,o.ModuleAccessorMustBeString,t);if(!0!==c.hasGlobal(s))throw new r(e,o.ModuleExportNotFound,t);u=F(await c.global(s)),c.setGlobal(s,"++"===t.operator?u+1:u-1)}else{if(!x(c))throw S(c)?new r(e,o.Immutable,t):new r(e,o.InvalidParameter,t);if(!1===y(s))throw new r(e,o.KeyAccessorMustBeString,t);if(!0!==c.hasField(s))throw new r(e,o.FieldNotFound,t,{key:s});u=F(c.field(s)),c.setField(s,"++"===t.operator?u+1:u-1)}return!1===t.prefix?u:"++"===t.operator?u+1:u-1}const i="Identifier"===t.argument.type?t.argument.name.toLowerCase():"";if(!i)throw new r(e,o.InvalidIdentifier,t);let l;if(null!=e.localScope&&void 0!==e.localScope[i])return l=F(e.localScope[i].value),e.localScope[i]={value:"++"===t.operator?l+1:l-1,valueset:!0,node:t},!1===t.prefix?l:"++"===t.operator?l+1:l-1;if(void 0!==e.globalScope[i])return l=F(e.globalScope[i].value),e.globalScope[i]={value:"++"===t.operator?l+1:l-1,valueset:!0,node:t},!1===t.prefix?l:"++"===t.operator?l+1:l-1;throw new r(e,o.InvalidIdentifier,t)}function fe(e,t,n,a,i){switch(t){case"=":return e===h?null:e;case"/=":return F(n)/F(e);case"*=":return F(n)*F(e);case"-=":return F(n)-F(e);case"+=":return y(n)||y(e)?A(n)+A(e):F(n)+F(e);case"%=":return F(n)%F(e);default:throw new r(i,o.UnsupportedOperator,a)}}async function pe(e,t){const a=t.left;if("MemberExpression"===a.type){const i=await J(e,a.object);let l=null;if(!0===a.computed)l=await J(e,a.property);else{if("Identifier"!==a.property.type)throw new r(e,o.InvalidIdentifier,t);l=a.property.name}const s=await J(e,t.right);if(b(i)){if(!R(l))throw new r(e,o.ArrayAccessorMustBeNumber,t);if(l<0&&(l=i.length+l),l<0||l>i.length)throw new r(e,o.OutOfBounds,t);if(l===i.length){if("="!==t.operator)throw new r(e,o.OutOfBounds,t);i[l]=fe(s,t.operator,i[l],t,e)}else i[l]=fe(s,t.operator,i[l],t,e)}else if(i instanceof n){if(!1===y(l))throw new r(e,o.KeyAccessorMustBeString,t);if(!0===i.hasField(l))i.setField(l,fe(s,t.operator,i.field(l),t,e));else{if("="!==t.operator)throw new r(e,o.FieldNotFound,t,{key:l});i.setField(l,fe(s,t.operator,null,t,e))}}else if(i instanceof z){if(!1===y(l))throw new r(e,o.KeyAccessorMustBeString,t);if(!0!==i.hasGlobal(l))throw new r(e,o.ModuleExportNotFound,t);i.setGlobal(l,fe(s,t.operator,await i.global(l),t,e))}else{if(!x(i))throw S(i)?new r(e,o.Immutable,t):new r(e,o.InvalidParameter,t);if(!1===y(l))throw new r(e,o.KeyAccessorMustBeString,t);if(!0===i.hasField(l))i.setField(l,fe(s,t.operator,i.field(l),t,e));else{if("="!==t.operator)throw new r(e,o.FieldNotFound,t,{key:l});i.setField(l,fe(s,t.operator,null,t,e))}}return h}const i=a.name.toLowerCase();if(null!=e.localScope&&void 0!==e.localScope[i]){const n=await J(e,t.right);return e.localScope[i]={value:fe(n,t.operator,e.localScope[i].value,t,e),valueset:!0,node:t.right},h}if(void 0!==e.globalScope[i]){const n=await J(e,t.right);return e.globalScope[i]={value:fe(n,t.operator,e.globalScope[i].value,t,e),valueset:!0,node:t.right},h}throw new r(e,o.InvalidIdentifier,t)}async function we(e,t){if("AssignmentExpression"===t.expression.type)return J(e,t.expression);if("CallExpression"===t.expression.type){const n=await J(e,t.expression);return n===h?h:new C(n)}const n=await J(e,t.expression);return n===h?h:new C(n)}async function de(e,t){const n=await J(e,t.test);if(!0===n)return J(e,t.consequent);if(!1===n)return null!==t.alternate?J(e,t.alternate):h;throw new r(e,o.BooleanConditionRequired,t)}async function he(e,t){return me(e,t,0)}async function me(e,t,n){if(n>=t.body.length)return h;const r=await J(e,t.body[n]);return r instanceof v||r===m||r===d||n===t.body.length-1?r:me(e,t,n+1)}async function ge(e,t){if(null===t.argument)return new v(h);const n=await J(e,t.argument);return new v(n)}async function ye(e,t){const n=t.id.name.toLowerCase();return e.globalScope[n]={valueset:!0,node:null,value:new Y(t,e)},h}async function ve(e,t){const n=t.specifiers[0].local.name.toLowerCase(),r=e.libraryResolver.loadLibrary(n);let o=null;return e.libraryResolver._moduleSingletons?.has(r.uri)?o=e.libraryResolver._moduleSingletons.get(r.uri):(o=new z(r),await o.loadModule(e),e.libraryResolver._moduleSingletons?.set(r.uri,o)),e.globalScope[n]={value:o,valueset:!0,node:t},h}async function be(e,t){if(await J(e,t.declaration),"FunctionDeclaration"===t.declaration.type)e.exports[t.declaration.id.name.toLowerCase()]="function";else if("VariableDeclaration"===t.declaration.type)for(const n of t.declaration.declarations)e.exports[n.id.name.toLowerCase()]="variable";return h}async function Se(e,t,n){return n>=t.declarations.length?h:(await J(e,t.declarations[n]),n===t.declarations.length-1||await Se(e,t,n+1),h)}async function xe(e,t){let n=null;if(n=null===t.init?null:await J(e,t.init),null!==e.localScope){if(n===h&&(n=null),"Identifier"!==t.id.type)throw new r(e,o.InvalidIdentifier,t);const a=t.id.name.toLowerCase();return null!=e.localScope&&(e.localScope[a]={value:n,valueset:!0,node:t.init}),h}if("Identifier"!==t.id.type)throw new r(e,o.InvalidIdentifier,t);const a=t.id.name.toLowerCase();return n===h&&(n=null),e.globalScope[a]={value:n,valueset:!0,node:t.init},h}async function Ie(e,t){const a=await J(e,t.object);if(null===a)throw new r(e,o.MemberOfNull,t);if(!1===t.computed){if("Identifier"===t.property.type){if(a instanceof n||x(a))return a.field(t.property.name);if(a instanceof T)return P(a,t.property.name,e,t);if(a instanceof z){if(!a.hasGlobal(t.property.name))throw new r(e,o.InvalidIdentifier,t);return a.global(t.property.name)}throw new r(e,o.InvalidMemberAccessKey,t)}throw new r(e,o.InvalidMemberAccessKey,t)}let i=await J(e,t.property);if(a instanceof n||x(a)){if(y(i))return a.field(i);throw new r(e,o.InvalidMemberAccessKey,t)}if(a instanceof z){if(y(i))return a.global(i);throw new r(e,o.InvalidMemberAccessKey,t)}if(a instanceof T){if(y(i))return P(a,i,e,t);throw new r(e,o.InvalidMemberAccessKey,t)}if(b(a)){if(R(i)&&isFinite(i)&&Math.floor(i)===i){if(i<0&&(i=a.length+i),i>=a.length||i<0)throw new r(e,o.OutOfBounds,t);return a[i]}throw new r(e,o.InvalidMemberAccessKey,t)}if(S(a)){if(R(i)&&isFinite(i)&&Math.floor(i)===i){if(i<0&&(i=a.length()+i),i>=a.length()||i<0)throw new r(e,o.OutOfBounds,t);return a.get(i)}throw new r(e,o.InvalidMemberAccessKey,t)}if(y(a)){if(R(i)&&isFinite(i)&&Math.floor(i)===i){if(i<0&&(i=a.length+i),i>=a.length||i<0)throw new r(e,o.OutOfBounds,t);return a[i]}throw new r(e,o.InvalidMemberAccessKey,t)}throw new r(e,o.InvalidMemberAccessKey,t)}async function Re(e,t){const n=await J(e,t.argument);if(p(n)){if("!"===t.operator)return!n;if("-"===t.operator)return-1*F(n);if("+"===t.operator)return 1*F(n);if("~"===t.operator)return~F(n);throw new r(e,o.UnsupportedUnaryOperator,t)}if("-"===t.operator)return-1*F(n);if("+"===t.operator)return 1*F(n);if("~"===t.operator)return~F(n);throw new r(e,o.UnsupportedUnaryOperator,t)}async function Fe(e,t){const n=[];for(let r=0;r<t.elements.length;r++)n.push(await J(e,t.elements[r]));for(let a=0;a<n.length;a++){if(g(n[a]))throw new r(e,o.NoFunctionInArray,t);n[a]===h&&(n[a]=null)}return n}async function Ce(e,t){const n=[];n[0]=await J(e,t.left),n[1]=await J(e,t.right);const a=n[0],i=n[1];switch(t.operator){case"|":case"<<":case">>":case">>>":case"^":case"&":return j(F(a),F(i),t.operator);case"==":return w(a,i);case"!=":return!w(a,i);case"<":case">":case"<=":case">=":return M(a,i,t.operator);case"+":return y(a)||y(i)?A(a)+A(i):F(a)+F(i);case"-":return F(a)-F(i);case"*":return F(a)*F(i);case"/":return F(a)/F(i);case"%":return F(a)%F(i);default:throw new r(e,o.UnsupportedOperator,t)}}async function Ae(e,t){const n=await J(e,t.left);let a=null;if(!p(n))throw new r(e,o.LogicalExpressionOnlyBoolean,t);switch(t.operator){case"||":if(!0===n)return n;if(a=await J(e,t.right),p(a))return a;throw new r(e,o.LogicExpressionOrAnd,t);case"&&":if(!1===n)return n;if(a=await J(e,t.right),p(a))return a;throw new r(e,o.LogicExpressionOrAnd,t);default:throw new r(e,o.LogicExpressionOrAnd,t)}}async function Me(e,t){const n=t.name.toLowerCase();if(null!=e.localScope&&void 0!==e.localScope[n]){const t=e.localScope[n];if(!0===t.valueset)return t.value;if(null!==t.d)return t.d;t.d=J(e,t.node);const r=await t.d;return t.value=r,t.valueset=!0,r}if(void 0!==e.globalScope[n]){const t=e.globalScope[n];if(!0===t.valueset)return t.value;if(null!==t.d)return t.d;t.d=J(e,t.node);const r=await t.d;return t.value=r,t.valueset=!0,r}throw new r(e,o.InvalidIdentifier,t)}async function je(e,t){if("MemberExpression"===t.callee.type){const n=await J(e,t.callee.object);if(!(n instanceof z))throw new r(e,o.FunctionNotFound,t);const a=!1===t.callee.computed?t.callee.property.name:await J(e,t.callee.property);if(!n.hasGlobal(a))throw new r(e,o.FunctionNotFound,t);const i=await n.global(a);if(!g(i))throw new r(e,o.CallNonFunction,t);return i.call(e,t)}if("Identifier"!==t.callee.type)throw new r(e,o.FunctionNotFound,t);if(null!=e.localScope&&void 0!==e.localScope[t.callee.name.toLowerCase()]){const n=e.localScope[t.callee.name.toLowerCase()];if(g(n.value))return n.value.call(e,t);throw new r(e,o.CallNonFunction,t)}if(void 0!==e.globalScope[t.callee.name.toLowerCase()]){const n=e.globalScope[t.callee.name.toLowerCase()];if(g(n.value))return n.value.call(e,t);throw new r(e,o.CallNonFunction,t)}throw new r(e,o.FunctionNotFound,t)}async function Le(e,t){return t.value?t.value.cooked:""}function ke(e,t,n){if(g(e))throw new r(t,o.NoFunctionInTemplateLiteral,n);return e}async function Ne(e,t){const n=[];for(let a=0;a<t.expressions.length;a++){const r=await J(e,t.expressions[a]);n[a]=A(r)}let r="",o=0;for(const a of t.quasis)if(r+=a.value?a.value.cooked:"",!1===a.tail){r+=n[o]?ke(n[o],e,t):"",o++}return r}const Oe={};async function Ee(e,t,n,r){const o=await J(e,t.arguments[n]);if(w(o,r))return J(e,t.arguments[n+1]);const a=t.arguments.length-n;return 1===a?J(e,t.arguments[n]):2===a?null:3===a?J(e,t.arguments[n+2]):Ee(e,t,n+2,r)}async function Be(e,t,n,a){if(!0===a)return J(e,t.arguments[n+1]);if(3===t.arguments.length-n)return J(e,t.arguments[n+2]);const i=await J(e,t.arguments[n+2]);if(!1===p(i))throw new r(e,o.ModuleExportNotFound,t.arguments[n+2]);return Be(e,t,n+2,i)}async function Pe(e,t,n,a){const i=e.body;if(n.length!==e.params.length)throw new r(t,o.WrongNumberOfParameters,null);for(let r=0;r<n.length;r++){const o=e.params[r];"Identifier"===o.type&&null!=t.localScope&&(t.localScope[o.name.toLowerCase()]={d:null,value:n[r],valueset:!0,node:null})}const l=await J(t,i);if(l instanceof v)return l.value;if(l===m)throw new r(t,o.UnexpectedToken,a);if(l===d)throw new r(t,o.UnexpectedToken,a);return l instanceof C?l.value:l}O(Oe,_),G(Oe,_),K(Oe,_),B(Oe,_),D(Oe,_),E({functions:Oe,compiled:!1,signatures:null,evaluateIdentifier:null,mode:"async",standardFunction:_,standardFunctionAsync:H}),Oe.iif=async function(e,t){f(null===t.arguments?[]:t.arguments,3,3,e,t);const n=await J(e,t.arguments[0]);if(!1===p(n))throw new r(e,o.BooleanConditionRequired,t);return J(e,n?t.arguments[1]:t.arguments[2])},Oe.decode=async function(e,t){if(t.arguments.length<2)throw new r(e,o.WrongNumberOfParameters,t);if(2===t.arguments.length)return J(e,t.arguments[1]);if((t.arguments.length-1)%2==0)throw new r(e,o.WrongNumberOfParameters,t);return Ee(e,t,1,await J(e,t.arguments[0]))},Oe.when=async function(e,t){if(t.arguments.length<3)throw new r(e,o.WrongNumberOfParameters,t);if(t.arguments.length%2==0)throw new r(e,o.WrongNumberOfParameters,t);const n=await J(e,t.arguments[0]);if(!1===p(n))throw new r(e,o.BooleanConditionRequired,t.arguments[0]);return Be(e,t,0,n)};const Ke={fixSpatialReference:L,parseArguments:V,standardFunction:_,standardFunctionAsync:H,evaluateIdentifier:Me};for(const Ve in Oe)Oe[Ve]={value:new l(Oe[Ve]),valueset:!0,node:null};const De=function(){};function Ge(e,t,r){const o=new De;null==e&&(e={}),null==t&&(t={});const a=new n({newline:"\n",tab:"\t",singlequote:"'",doublequote:'"',forwardslash:"/",backwardslash:"\\"});a.immutable=!1,o.textformatting={value:a,valueset:!0,node:null};for(const n in t)o[n]={value:new l(t[n]),native:!0,valueset:!0,node:null};for(const n in e)e[n]&&"esri.Graphic"===e[n].declaredClass?o[n]={value:i.createFromGraphic(e[n],r),valueset:!0,node:null}:o[n]={value:e[n],valueset:!0,node:null};return o}function Te(e){console.log(e)}De.prototype=Oe,De.prototype.infinity={value:Number.POSITIVE_INFINITY,valueset:!0,node:null},De.prototype.pi={value:Math.PI,valueset:!0,node:null};const Ue=Ke;function qe(e){const t={mode:"async",compiled:!1,functions:{},signatures:[],standardFunction:_,standardFunctionAsync:H,evaluateIdentifier:Me};for(let n=0;n<e.length;n++)e[n].registerFunctions(t);for(const n in t.functions)Oe[n]={value:new l(t.functions[n]),valueset:!0,node:null},De.prototype[n]=Oe[n];for(let n=0;n<t.signatures.length;n++)k(t.signatures[n],"async")}async function We(e,n){let a=n.spatialReference;null==a&&(a=new U({wkid:102100}));let i=null;e.usesModules&&(i=new t(new Map,e.loadedModules));const l=Ge(n.vars,n.customfunctions,n.timeReference),s={spatialReference:a,services:n.services,exports:{},libraryResolver:i,abortSignal:void 0===n.abortSignal||null===n.abortSignal?{aborted:!1}:n.abortSignal,globalScope:l,console:n.console??Te,timeReference:n.timeReference??null,lrucache:n.lrucache,interceptor:n.interceptor,localScope:null,depthCounter:{depth:1}};let c=await J(s,e);if(c instanceof v&&(c=c.value),c instanceof C&&(c=c.value),c===h&&(c=null),c===m)throw new r(s,o.IllegalResult,null);if(c===d)throw new r(s,o.IllegalResult,null);if(g(c))throw new r(s,o.IllegalResult,null);return c}qe([N]);export{We as executeScript,qe as extend,Ue as functionHelper};
5
+ import{ArcadeModule as e}from"./ArcadeModule.js";import{ArcadeModuleLoader as t}from"./ArcadeModuleLoader.js";import n from"./Dictionary.js";import{ArcadeExecutionError as r,ExecutionErrorCodes as o,ensureArcadeExecutionError as a}from"./executionError.js";import i from"./Feature.js";import{NativeFunction as l,ArcadeFunction as s,ScopeMarshalledFunction as c,wrapModuleScopedResponse as u}from"./FunctionWrapper.js";import{C as f,a as p,A as w,x as d,v as h,w as m,i as g,c as y,R as v,m as b,o as S,p as x,r as I,b as R,g as F,I as C,j as A,z as M,B as j,y as L}from"../chunks/languageUtils.js";import{addFunctionDeclaration as k}from"./treeAnalysis.js";import{A as N}from"../chunks/array.js";import{registerFunctions as O}from"./functions/date.js";import{registerFunctions as E}from"./functions/geomasync.js";import{registerFunctions as B,geometryMember as P}from"./functions/geometry.js";import{registerFunctions as K}from"./functions/maths.js";import{registerFunctions as D}from"./functions/stats.js";import{registerFunctions as G}from"./functions/string.js";import U from"../geometry/Geometry.js";import T from"../geometry/SpatialReference.js";function q(e){return e&&"function"==typeof e.then}const W=100;async function V(e,t){const n=[];for(let r=0;r<t.arguments.length;r++)n.push(await J(e,t.arguments[r]));return n}async function _(e,t,n){if(!0===t.preparsed)return n(e,null,t.arguments);return n(e,t,await V(e,t))}class z extends s{constructor(e,t){super(),this.definition=null,this.context=null,this.definition=e,this.context=t}createFunction(e){return(...t)=>{const n={spatialReference:this.context.spatialReference,console:this.context.console,lrucache:this.context.lrucache,timeReference:this.context.timeReference??null,exports:this.context.exports,libraryResolver:this.context.libraryResolver,interceptor:this.context.interceptor,localScope:{},depthCounter:{depth:e.depthCounter+1},globalScope:this.context.globalScope};if(n.depthCounter.depth>64)throw new r(e,o.MaximumCallDepth,null);return Pe(this.definition,n,t,null)}}call(e,t){return H(e,t,((n,a,i)=>{const l={spatialReference:e.spatialReference,services:e.services,console:e.console,libraryResolver:e.libraryResolver,exports:e.exports,lrucache:e.lrucache,timeReference:e.timeReference??null,interceptor:e.interceptor,localScope:{},abortSignal:e.abortSignal,globalScope:e.globalScope,depthCounter:{depth:e.depthCounter.depth+1}};if(l.depthCounter.depth>64)throw new r(e,o.MaximumCallDepth,t);return Pe(this.definition,l,i,t)}))}marshalledCall(e,t,n,r){return r(e,t,(async(o,a,i)=>{const l={spatialReference:e.spatialReference,globalScope:n.globalScope,depthCounter:{depth:e.depthCounter.depth+1},libraryResolver:e.libraryResolver,exports:e.exports,console:e.console,abortSignal:e.abortSignal,lrucache:e.lrucache,timeReference:e.timeReference??null,interceptor:e.interceptor,localScope:{}};return i=i.map((t=>!g(t)||t instanceof c?t:u(t,e,r))),u(await Pe(this.definition,l,i,t),n,r)}))}}class Y extends e{constructor(e){super(e)}async global(e){const t=this.executingContext.globalScope[e.toLowerCase()];if(t.valueset||(t.value=await J(this.executingContext,t.node),t.valueset=!0),g(t.value)&&!(t.value instanceof c)){const e=new c;e.fn=t.value,e.parameterEvaluator=H,e.context=this.executingContext,t.value=e}return t.value}setGlobal(e,t){if(g(t))throw new r(null,o.AssignModuleFunction,null);this.executingContext.globalScope[e.toLowerCase()]={value:t,valueset:!0,node:null}}hasGlobal(e){return void 0===this.executingContext.exports[e]&&(e=e.toLowerCase()),void 0!==this.executingContext.exports[e]}async loadModule(e){let n=e.spatialReference;null==n&&(n=new T({wkid:102100})),this.moduleScope=Ge({},e.customfunctions,e.timeReference),this.executingContext={spatialReference:n,services:e.services,libraryResolver:new t(e.libraryResolver._moduleSingletons,this.source.syntax.loadedModules),exports:{},abortSignal:void 0===e.abortSignal||null===e.abortSignal?{aborted:!1}:e.abortSignal,globalScope:this.moduleScope,console:e.console??Ue,lrucache:e.lrucache,timeReference:e.timeReference??null,interceptor:e.interceptor,localScope:null,depthCounter:{depth:1}},await J(this.executingContext,this.source.syntax)}}async function H(e,t,n){if(!0===t.preparsed){const r=n(e,null,t.arguments);return q(r),r}const r=n(e,t,await V(e,t));return q(r),r}async function J(e,t,n){if(t.breakpoint&&!0!==n){const n=t.breakpoint();return await n,J(e,t,!0)}try{switch(t?.type){case"VariableDeclarator":return await xe(e,t);case"ImportDeclaration":return await ve(e,t);case"ExportNamedDeclaration":return await be(e,t);case"VariableDeclaration":return await Se(e,t,0);case"BlockStatement":case"Program":return await he(e,t);case"FunctionDeclaration":return await ye(e,t);case"ReturnStatement":return await ge(e,t);case"IfStatement":return await de(e,t);case"ExpressionStatement":return await we(e,t);case"UpdateExpression":return await ue(e,t);case"AssignmentExpression":return await pe(e,t);case"ForStatement":return await ne(e,t);case"WhileStatement":return await Z(e,t);case"ForInStatement":return await ce(e,t);case"BreakStatement":return m;case"EmptyStatement":return h;case"ContinueStatement":return d;case"TemplateElement":return await Le(e,t);case"TemplateLiteral":return await Ne(e,t);case"Identifier":return await Me(e,t);case"MemberExpression":return await Ie(e,t);case"Literal":return t.value;case"CallExpression":return await je(e,t);case"UnaryExpression":return await Re(e,t);case"BinaryExpression":return await Ce(e,t);case"LogicalExpression":return await Ae(e,t);case"ArrayExpression":return await Fe(e,t);case"ObjectExpression":return await Q(e,t);case"Property":return await X(e,t);default:throw new r(e,o.Unrecognised,t)}}catch(i){throw a(e,t,i)}}async function Q(e,t){const a=[];for(let n=0;n<t.properties.length;n++)a[n]=await J(e,t.properties[n]);const i={},l=new Map;for(let n=0;n<a.length;n++){const s=a[n];if(g(s.value))throw new r(e,o.NoFunctionInDictionary,t);if(!1===y(s.key))throw new r(e,o.KeyMustBeString,t);let c=s.key.toString();const u=c.toLowerCase();l.has(u)?c=l.get(u):l.set(u,c),s.value===h?i[c]=null:i[c]=s.value}const s=new n(i);return s.immutable=!1,s}async function X(e,t){const n=await J(e,t.value);if("Identifier"===t.key.type)return{key:t.key.name,value:n};return{key:await J(e,t.key),value:n}}async function Z(e,t){const n={testResult:!0,lastAction:h};if(n.testResult=await J(e,t.test),!1===n.testResult)return h;if(!0!==n.testResult)throw new r(e,o.BooleanConditionRequired,t);for(;!0===n.testResult&&(n.lastAction=await J(e,t.body),n.lastAction!==m)&&!(n.lastAction instanceof v);)if(n.testResult=await J(e,t.test),!0!==n.testResult&&!1!==n.testResult)throw new r(e,o.BooleanConditionRequired,t);return n.lastAction instanceof v?n.lastAction:h}async function $(e,t,n){const r=await J(e,t.body);return n.lastAction=r,n.lastAction===m||n.lastAction instanceof v?(n.testResult=!1,n):null!==t.update?(await J(e,t.update),n):n}async function ee(e,t,n){if(null!==t.test){const a=await J(e,t.test);if(!0===e.abortSignal?.aborted)throw new r(e,o.Cancelled,t);if(n.testResult=a,!1===n.testResult)return n;if(!0!==n.testResult)throw new r(e,o.BooleanConditionRequired,t);return $(e,t,n)}return $(e,t,n)}function te(e,t,n,r,o,a){try{ee(e,t,n).then((()=>{try{!0===n.testResult?++a>W?(a=0,setTimeout((()=>{te(e,t,n,r,o,a)}),0)):te(e,t,n,r,o,a):n.lastAction instanceof v?r(n.lastAction):r(h)}catch(i){o(i)}}),(e=>{o(e)}))}catch(i){o(i)}}function ne(e,t){try{return null!==t.init?J(e,t.init).then((()=>new Promise(((n,r)=>{te(e,t,{testResult:!0,lastAction:h},(e=>{n(e)}),(e=>{r(e)}),0)})))):new Promise(((n,r)=>{te(e,t,{testResult:!0,lastAction:h},(e=>{n(e)}),(e=>{r(e)}),0)}))}catch(n){return Promise.reject(n)}}function re(e,t,n,r,o,a,i,l,s,c){try{if(r<=a)return void l(h);o.value="k"===i?n[a]:a,J(e,t.body).then((u=>{try{u instanceof v?l(u):u===m?l(h):++c>W?(c=0,setTimeout((()=>{re(e,t,n,r,o,a+1,i,l,s,c)}),0)):re(e,t,n,r,o,a+1,i,l,s,c)}catch(f){s(f)}}),(e=>{s(e)}))}catch(u){s(u)}}function oe(e,t,n,r,o,a,i,l,s){try{if(n.length()<=o)return void i(h);r.value="k"===a?n.get(o):o,J(e,t.body).then((c=>{c instanceof v?i(c):c===m?i(h):++s>W?(s=0,setTimeout((()=>{oe(e,t,n,r,o+1,a,i,l,s)}),0)):oe(e,t,n,r,o+1,a,i,l,s)}),(e=>{l(e)}))}catch(c){l(c)}}function ae(e,t,n,r,o,a){try{if(void 0===a&&(a="i"),0===n.length)return void r.resolve(h);re(e,t,n,n.length,o,0,a,(e=>{r.resolve(e)}),(e=>{r.reject(e)}),0)}catch(i){r.reject(i)}}function ie(e,t,n,r,o,a){try{if(void 0===a&&(a="i"),0===n.length)return void r.resolve(h);oe(e,t,n,o,0,a,(e=>{r.resolve(e)}),(e=>{r.reject(e)}),0)}catch(i){r.reject(i)}}function le(e,t,n,r,o){try{ae(e,t,n.keys(),r,o,"k")}catch(a){r.reject(a)}}function se(e,t,n,r,o,a,l,s){try{e.next().then((c=>{try{if(null===c)a(h);else{const u=i.createFromGraphicLikeObject(c.geometry,c.attributes,r,t.timeReference);u._underlyingGraphic=c,o.value=u;J(t,n.body).then((i=>{try{i===m?a(h):i instanceof v?a(i):++s>W?(s=0,setTimeout((()=>{se(e,t,n,r,o,a,l,s)}),0)):se(e,t,n,r,o,a,l,s)}catch(c){l(c)}}),(e=>{l(e)}))}}catch(u){l(u)}}),(e=>{l(e)}))}catch(c){l(c)}}async function ce(e,t){return new Promise(((a,i)=>{J(e,t.right).then((l=>{try{let s=null;s="VariableDeclaration"===t.left.type?J(e,t.left):Promise.resolve(),s.then((()=>{try{let s="";if("VariableDeclaration"===t.left.type){const e=t.left.declarations[0].id;"Identifier"===e.type&&(s=e.name)}else"Identifier"===t.left.type&&(s=t.left.name);if(!s)throw new r(e,o.InvalidIdentifier,t);s=s.toLowerCase();let c=null;if(null!=e.localScope&&void 0!==e.localScope[s]&&(c=e.localScope[s]),null===c&&void 0!==e.globalScope[s]&&(c=e.globalScope[s]),null===c)return void i(new r(e,o.InvalidIdentifier,t));b(l)||y(l)?ae(e,t,l,{reject:i,resolve:a},c):S(l)?ie(e,t,l,{reject:i,resolve:a},c):l instanceof n||x(l)?le(e,t,l,{reject:i,resolve:a},c):I(l)?se(l.iterator(e.abortSignal),e,t,l,c,(e=>{a(e)}),(e=>{i(e)}),0):ae(e,t,[],{reject:i,resolve:a},c)}catch(s){i(s)}}),i)}catch(s){i(s)}}),i)}))}async function ue(e,t){const a=t.argument;if("MemberExpression"===a.type){const i={t:null},l=await J(e,a.object);let s=null;i.t=l,!0===a.computed?s=await J(e,a.property):"Identifier"===a.property.type&&(s=a.property.name);const c=i.t;let u;if(b(c)){if(!R(s))throw new r(e,o.ArrayAccessorMustBeNumber,t);if(s<0&&(s=c.length+s),s<0||s>=c.length)throw new r(e,o.OutOfBounds,t);u=F(c[s]),c[s]="++"===t.operator?u+1:u-1}else if(c instanceof n){if(!1===y(s))throw new r(e,o.KeyAccessorMustBeString,t);if(!0!==c.hasField(s))throw new r(e,o.FieldNotFound,t,{key:s});u=F(c.field(s)),c.setField(s,"++"===t.operator?u+1:u-1)}else if(c instanceof Y){if(!1===y(s))throw new r(e,o.ModuleAccessorMustBeString,t);if(!0!==c.hasGlobal(s))throw new r(e,o.ModuleExportNotFound,t);u=F(await c.global(s)),c.setGlobal(s,"++"===t.operator?u+1:u-1)}else{if(!x(c))throw S(c)?new r(e,o.Immutable,t):new r(e,o.InvalidParameter,t);if(!1===y(s))throw new r(e,o.KeyAccessorMustBeString,t);if(!0!==c.hasField(s))throw new r(e,o.FieldNotFound,t,{key:s});u=F(c.field(s)),c.setField(s,"++"===t.operator?u+1:u-1)}return!1===t.prefix?u:"++"===t.operator?u+1:u-1}const i="Identifier"===t.argument.type?t.argument.name.toLowerCase():"";if(!i)throw new r(e,o.InvalidIdentifier,t);let l;if(null!=e.localScope&&void 0!==e.localScope[i])return l=F(e.localScope[i].value),e.localScope[i]={value:"++"===t.operator?l+1:l-1,valueset:!0,node:t},!1===t.prefix?l:"++"===t.operator?l+1:l-1;if(void 0!==e.globalScope[i])return l=F(e.globalScope[i].value),e.globalScope[i]={value:"++"===t.operator?l+1:l-1,valueset:!0,node:t},!1===t.prefix?l:"++"===t.operator?l+1:l-1;throw new r(e,o.InvalidIdentifier,t)}function fe(e,t,n,a,i){switch(t){case"=":return e===h?null:e;case"/=":return F(n)/F(e);case"*=":return F(n)*F(e);case"-=":return F(n)-F(e);case"+=":return y(n)||y(e)?A(n)+A(e):F(n)+F(e);case"%=":return F(n)%F(e);default:throw new r(i,o.UnsupportedOperator,a)}}async function pe(e,t){const a=t.left;if("MemberExpression"===a.type){const i=await J(e,a.object);let l=null;if(!0===a.computed)l=await J(e,a.property);else{if("Identifier"!==a.property.type)throw new r(e,o.InvalidIdentifier,t);l=a.property.name}const s=await J(e,t.right);if(b(i)){if(!R(l))throw new r(e,o.ArrayAccessorMustBeNumber,t);if(l<0&&(l=i.length+l),l<0||l>i.length)throw new r(e,o.OutOfBounds,t);if(l===i.length){if("="!==t.operator)throw new r(e,o.OutOfBounds,t);i[l]=fe(s,t.operator,i[l],t,e)}else i[l]=fe(s,t.operator,i[l],t,e)}else if(i instanceof n){if(!1===y(l))throw new r(e,o.KeyAccessorMustBeString,t);if(!0===i.hasField(l))i.setField(l,fe(s,t.operator,i.field(l),t,e));else{if("="!==t.operator)throw new r(e,o.FieldNotFound,t,{key:l});i.setField(l,fe(s,t.operator,null,t,e))}}else if(i instanceof Y){if(!1===y(l))throw new r(e,o.KeyAccessorMustBeString,t);if(!0!==i.hasGlobal(l))throw new r(e,o.ModuleExportNotFound,t);i.setGlobal(l,fe(s,t.operator,await i.global(l),t,e))}else{if(!x(i))throw S(i)?new r(e,o.Immutable,t):new r(e,o.InvalidParameter,t);if(!1===y(l))throw new r(e,o.KeyAccessorMustBeString,t);if(!0===i.hasField(l))i.setField(l,fe(s,t.operator,i.field(l),t,e));else{if("="!==t.operator)throw new r(e,o.FieldNotFound,t,{key:l});i.setField(l,fe(s,t.operator,null,t,e))}}return h}const i=a.name.toLowerCase();if(null!=e.localScope&&void 0!==e.localScope[i]){const n=await J(e,t.right);return e.localScope[i]={value:fe(n,t.operator,e.localScope[i].value,t,e),valueset:!0,node:t.right},h}if(void 0!==e.globalScope[i]){const n=await J(e,t.right);return e.globalScope[i]={value:fe(n,t.operator,e.globalScope[i].value,t,e),valueset:!0,node:t.right},h}throw new r(e,o.InvalidIdentifier,t)}async function we(e,t){if("AssignmentExpression"===t.expression.type)return J(e,t.expression);if("CallExpression"===t.expression.type){const n=await J(e,t.expression);return n===h?h:new C(n)}const n=await J(e,t.expression);return n===h?h:new C(n)}async function de(e,t){const n=await J(e,t.test);if(!0===n)return J(e,t.consequent);if(!1===n)return null!==t.alternate?J(e,t.alternate):h;throw new r(e,o.BooleanConditionRequired,t)}async function he(e,t){return me(e,t,0)}async function me(e,t,n){if(n>=t.body.length)return h;const r=await J(e,t.body[n]);return r instanceof v||r===m||r===d||n===t.body.length-1?r:me(e,t,n+1)}async function ge(e,t){if(null===t.argument)return new v(h);const n=await J(e,t.argument);return new v(n)}async function ye(e,t){const n=t.id.name.toLowerCase();return e.globalScope[n]={valueset:!0,node:null,value:new z(t,e)},h}async function ve(e,t){const n=t.specifiers[0].local.name.toLowerCase(),r=e.libraryResolver.loadLibrary(n);let o=null;return e.libraryResolver._moduleSingletons?.has(r.uri)?o=e.libraryResolver._moduleSingletons.get(r.uri):(o=new Y(r),await o.loadModule(e),e.libraryResolver._moduleSingletons?.set(r.uri,o)),e.globalScope[n]={value:o,valueset:!0,node:t},h}async function be(e,t){if(await J(e,t.declaration),"FunctionDeclaration"===t.declaration.type)e.exports[t.declaration.id.name.toLowerCase()]="function";else if("VariableDeclaration"===t.declaration.type)for(const n of t.declaration.declarations)e.exports[n.id.name.toLowerCase()]="variable";return h}async function Se(e,t,n){return n>=t.declarations.length?h:(await J(e,t.declarations[n]),n===t.declarations.length-1||await Se(e,t,n+1),h)}async function xe(e,t){let n=null;if(n=null===t.init?null:await J(e,t.init),null!==e.localScope){if(n===h&&(n=null),"Identifier"!==t.id.type)throw new r(e,o.InvalidIdentifier,t);const a=t.id.name.toLowerCase();return null!=e.localScope&&(e.localScope[a]={value:n,valueset:!0,node:t.init}),h}if("Identifier"!==t.id.type)throw new r(e,o.InvalidIdentifier,t);const a=t.id.name.toLowerCase();return n===h&&(n=null),e.globalScope[a]={value:n,valueset:!0,node:t.init},h}async function Ie(e,t){const a=await J(e,t.object);if(null===a)throw new r(e,o.MemberOfNull,t);if(!1===t.computed){if("Identifier"===t.property.type){if(a instanceof n||x(a))return a.field(t.property.name);if(a instanceof U)return P(a,t.property.name,e,t);if(a instanceof Y){if(!a.hasGlobal(t.property.name))throw new r(e,o.InvalidIdentifier,t);return a.global(t.property.name)}throw new r(e,o.InvalidMemberAccessKey,t)}throw new r(e,o.InvalidMemberAccessKey,t)}let i=await J(e,t.property);if(a instanceof n||x(a)){if(y(i))return a.field(i);throw new r(e,o.InvalidMemberAccessKey,t)}if(a instanceof Y){if(y(i))return a.global(i);throw new r(e,o.InvalidMemberAccessKey,t)}if(a instanceof U){if(y(i))return P(a,i,e,t);throw new r(e,o.InvalidMemberAccessKey,t)}if(b(a)){if(R(i)&&isFinite(i)&&Math.floor(i)===i){if(i<0&&(i=a.length+i),i>=a.length||i<0)throw new r(e,o.OutOfBounds,t);return a[i]}throw new r(e,o.InvalidMemberAccessKey,t)}if(S(a)){if(R(i)&&isFinite(i)&&Math.floor(i)===i){if(i<0&&(i=a.length()+i),i>=a.length()||i<0)throw new r(e,o.OutOfBounds,t);return a.get(i)}throw new r(e,o.InvalidMemberAccessKey,t)}if(y(a)){if(R(i)&&isFinite(i)&&Math.floor(i)===i){if(i<0&&(i=a.length+i),i>=a.length||i<0)throw new r(e,o.OutOfBounds,t);return a[i]}throw new r(e,o.InvalidMemberAccessKey,t)}throw new r(e,o.InvalidMemberAccessKey,t)}async function Re(e,t){const n=await J(e,t.argument);if(p(n)){if("!"===t.operator)return!n;if("-"===t.operator)return-1*F(n);if("+"===t.operator)return 1*F(n);if("~"===t.operator)return~F(n);throw new r(e,o.UnsupportedUnaryOperator,t)}if("-"===t.operator)return-1*F(n);if("+"===t.operator)return 1*F(n);if("~"===t.operator)return~F(n);throw new r(e,o.UnsupportedUnaryOperator,t)}async function Fe(e,t){const n=[];for(let r=0;r<t.elements.length;r++)n.push(await J(e,t.elements[r]));for(let a=0;a<n.length;a++){if(g(n[a]))throw new r(e,o.NoFunctionInArray,t);n[a]===h&&(n[a]=null)}return n}async function Ce(e,t){const n=[];n[0]=await J(e,t.left),n[1]=await J(e,t.right);const a=n[0],i=n[1];switch(t.operator){case"|":case"<<":case">>":case">>>":case"^":case"&":return j(F(a),F(i),t.operator);case"==":return w(a,i);case"!=":return!w(a,i);case"<":case">":case"<=":case">=":return M(a,i,t.operator);case"+":return y(a)||y(i)?A(a)+A(i):F(a)+F(i);case"-":return F(a)-F(i);case"*":return F(a)*F(i);case"/":return F(a)/F(i);case"%":return F(a)%F(i);default:throw new r(e,o.UnsupportedOperator,t)}}async function Ae(e,t){const n=await J(e,t.left);let a=null;if(!p(n))throw new r(e,o.LogicalExpressionOnlyBoolean,t);switch(t.operator){case"||":if(!0===n)return n;if(a=await J(e,t.right),p(a))return a;throw new r(e,o.LogicExpressionOrAnd,t);case"&&":if(!1===n)return n;if(a=await J(e,t.right),p(a))return a;throw new r(e,o.LogicExpressionOrAnd,t);default:throw new r(e,o.LogicExpressionOrAnd,t)}}async function Me(e,t){const n=t.name.toLowerCase();if(null!=e.localScope&&void 0!==e.localScope[n]){const t=e.localScope[n];if(!0===t.valueset)return t.value;if(null!==t.d)return t.d;t.d=J(e,t.node);const r=await t.d;return t.value=r,t.valueset=!0,r}if(void 0!==e.globalScope[n]){const t=e.globalScope[n];if(!0===t.valueset)return t.value;if(null!==t.d)return t.d;t.d=J(e,t.node);const r=await t.d;return t.value=r,t.valueset=!0,r}throw new r(e,o.InvalidIdentifier,t)}async function je(e,t){if("MemberExpression"===t.callee.type){const n=await J(e,t.callee.object);if(!(n instanceof Y))throw new r(e,o.FunctionNotFound,t);const a=!1===t.callee.computed?t.callee.property.name:await J(e,t.callee.property);if(!n.hasGlobal(a))throw new r(e,o.FunctionNotFound,t);const i=await n.global(a);if(!g(i))throw new r(e,o.CallNonFunction,t);return i.call(e,t)}if("Identifier"!==t.callee.type)throw new r(e,o.FunctionNotFound,t);if(null!=e.localScope&&void 0!==e.localScope[t.callee.name.toLowerCase()]){const n=e.localScope[t.callee.name.toLowerCase()];if(g(n.value))return n.value.call(e,t);throw new r(e,o.CallNonFunction,t)}if(void 0!==e.globalScope[t.callee.name.toLowerCase()]){const n=e.globalScope[t.callee.name.toLowerCase()];if(g(n.value))return n.value.call(e,t);throw new r(e,o.CallNonFunction,t)}throw new r(e,o.FunctionNotFound,t)}async function Le(e,t){return t.value?t.value.cooked:""}function ke(e,t,n){if(g(e))throw new r(t,o.NoFunctionInTemplateLiteral,n);return e}async function Ne(e,t){const n=[];for(let a=0;a<t.expressions.length;a++){const r=await J(e,t.expressions[a]);n[a]=A(r)}let r="",o=0;for(const a of t.quasis)if(r+=a.value?a.value.cooked:"",!1===a.tail){r+=n[o]?ke(n[o],e,t):"",o++}return r}const Oe={};async function Ee(e,t,n,r){const o=await J(e,t.arguments[n]);if(w(o,r))return J(e,t.arguments[n+1]);const a=t.arguments.length-n;return 1===a?J(e,t.arguments[n]):2===a?null:3===a?J(e,t.arguments[n+2]):Ee(e,t,n+2,r)}async function Be(e,t,n,a){if(!0===a)return J(e,t.arguments[n+1]);if(3===t.arguments.length-n)return J(e,t.arguments[n+2]);const i=await J(e,t.arguments[n+2]);if(!1===p(i))throw new r(e,o.ModuleExportNotFound,t.arguments[n+2]);return Be(e,t,n+2,i)}async function Pe(e,t,n,a){const i=e.body;if(n.length!==e.params.length)throw new r(t,o.WrongNumberOfParameters,null);for(let r=0;r<n.length;r++){const o=e.params[r];"Identifier"===o.type&&null!=t.localScope&&(t.localScope[o.name.toLowerCase()]={d:null,value:n[r],valueset:!0,node:null})}const l=await J(t,i);if(l instanceof v)return l.value;if(l===m)throw new r(t,o.UnexpectedToken,a);if(l===d)throw new r(t,o.UnexpectedToken,a);return l instanceof C?l.value:l}O(Oe,_),G(Oe,_),K(Oe,_),B(Oe,_),D(Oe,_),E({functions:Oe,compiled:!1,signatures:null,evaluateIdentifier:null,mode:"async",standardFunction:_,standardFunctionAsync:H}),Oe.iif=async function(e,t){f(null===t.arguments?[]:t.arguments,3,3,e,t);const n=await J(e,t.arguments[0]);if(!1===p(n))throw new r(e,o.BooleanConditionRequired,t);return J(e,n?t.arguments[1]:t.arguments[2])},Oe.decode=async function(e,t){if(t.arguments.length<2)throw new r(e,o.WrongNumberOfParameters,t);if(2===t.arguments.length)return J(e,t.arguments[1]);if((t.arguments.length-1)%2==0)throw new r(e,o.WrongNumberOfParameters,t);return Ee(e,t,1,await J(e,t.arguments[0]))},Oe.when=async function(e,t){if(t.arguments.length<3)throw new r(e,o.WrongNumberOfParameters,t);if(t.arguments.length%2==0)throw new r(e,o.WrongNumberOfParameters,t);const n=await J(e,t.arguments[0]);if(!1===p(n))throw new r(e,o.BooleanConditionRequired,t.arguments[0]);return Be(e,t,0,n)};const Ke={fixSpatialReference:L,parseArguments:V,standardFunction:_,standardFunctionAsync:H,evaluateIdentifier:Me};for(const Ve in Oe)Oe[Ve]={value:new l(Oe[Ve]),valueset:!0,node:null};const De=function(){};function Ge(e,t,r){const o=new De;null==e&&(e={}),null==t&&(t={});const a=new n({newline:"\n",tab:"\t",singlequote:"'",doublequote:'"',forwardslash:"/",backwardslash:"\\"});a.immutable=!1,o.textformatting={value:a,valueset:!0,node:null};for(const n in t)o[n]={value:new l(t[n]),native:!0,valueset:!0,node:null};for(const n in e)e[n]&&"esri.Graphic"===e[n].declaredClass?o[n]={value:i.createFromGraphic(e[n],r),valueset:!0,node:null}:o[n]={value:e[n],valueset:!0,node:null};return o}function Ue(e){console.log(e)}De.prototype=Oe,De.prototype.infinity={value:Number.POSITIVE_INFINITY,valueset:!0,node:null},De.prototype.pi={value:Math.PI,valueset:!0,node:null};const Te=Ke;function qe(e){const t={mode:"async",compiled:!1,functions:{},signatures:[],standardFunction:_,standardFunctionAsync:H,evaluateIdentifier:Me};for(let n=0;n<e.length;n++)e[n].registerFunctions(t);for(const n in t.functions)Oe[n]={value:new l(t.functions[n]),valueset:!0,node:null},De.prototype[n]=Oe[n];for(let n=0;n<t.signatures.length;n++)k(t.signatures[n],"async")}async function We(e,n){let a=n.spatialReference;null==a&&(a=new T({wkid:102100}));let i=null;e.usesModules&&(i=new t(new Map,e.loadedModules));const l=Ge(n.vars,n.customfunctions,n.timeReference),s={spatialReference:a,services:n.services,exports:{},libraryResolver:i,abortSignal:void 0===n.abortSignal||null===n.abortSignal?{aborted:!1}:n.abortSignal,globalScope:l,console:n.console??Ue,timeReference:n.timeReference??null,lrucache:n.lrucache,interceptor:n.interceptor,localScope:null,depthCounter:{depth:1}};let c=await J(s,e);if(c instanceof v&&(c=c.value),c instanceof C&&(c=c.value),c===h&&(c=null),c===m)throw new r(s,o.IllegalResult,null);if(c===d)throw new r(s,o.IllegalResult,null);if(g(c))throw new r(s,o.IllegalResult,null);return c}qe([N]);export{We as executeScript,qe as extend,Te as functionHelper};