@arcgis/core 4.22.0-next.20211021 → 4.22.0-next.20211025

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 (440) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/00ac1ce56f9885a8be83.js +1 -0
  3. package/assets/esri/core/workers/chunks/01c9afe41ab4ccc597c9.js +1 -0
  4. package/assets/esri/core/workers/chunks/02a3d14adc504a51fa24.js +1 -0
  5. package/assets/esri/core/workers/chunks/035a9ab0202d5386b782.js +1 -0
  6. package/assets/esri/core/workers/chunks/062bace5505f13689c7d.js +1 -0
  7. package/assets/esri/core/workers/chunks/06c7745d813bcb540ce8.js +1 -0
  8. package/assets/esri/core/workers/chunks/0950b488a60b2abc21fc.js +1 -0
  9. package/assets/esri/core/workers/chunks/0af396f2e0de681113ef.js +1 -0
  10. package/assets/esri/core/workers/chunks/131838059f0f81d8eaee.js +1 -0
  11. package/assets/esri/core/workers/chunks/146cba0d172ec2f4eba2.js +1 -0
  12. package/assets/esri/core/workers/chunks/17e49c0dfa5a5a6213e2.js +1 -0
  13. package/assets/esri/core/workers/chunks/1a0b08190274725dc956.js +1 -0
  14. package/assets/esri/core/workers/chunks/1add7f0779accdf8d204.js +1 -0
  15. package/assets/esri/core/workers/chunks/20b81d11e6286d347bfc.js +1 -0
  16. package/assets/esri/core/workers/chunks/{e596bd3de960d1dc1c57.js → 2207580a78ee292ed9b8.js} +1 -1
  17. package/assets/esri/core/workers/chunks/2d3646a83465c75986f9.js +1 -0
  18. package/assets/esri/core/workers/chunks/2d38ee3ef3ebe32a1194.js +1 -0
  19. package/assets/esri/core/workers/chunks/3737dcc3c0dea3ca05d5.js +1 -0
  20. package/assets/esri/core/workers/chunks/3e2042e70647c1afa6aa.js +1 -0
  21. package/assets/esri/core/workers/chunks/3ebfaab2855a2236a95d.js +1 -0
  22. package/assets/esri/core/workers/chunks/{d6fe616192a8efbfbc3e.js → 440f8101402a4c0d7019.js} +1 -1
  23. package/assets/esri/core/workers/chunks/4587d770767966985e22.js +1 -0
  24. package/assets/esri/core/workers/chunks/487b8892fae85810a8c0.js +1 -0
  25. package/assets/esri/core/workers/chunks/4901a78f32c3ea6b823b.js +1 -0
  26. package/assets/esri/core/workers/chunks/496fe47fc4d28e1a716d.js +1 -0
  27. package/assets/esri/core/workers/chunks/{9f22f47d4b2e72d7bdcf.js → 4c010119c24510ea31bb.js} +2 -2
  28. package/assets/esri/core/workers/chunks/{9f22f47d4b2e72d7bdcf.js.LICENSE.txt → 4c010119c24510ea31bb.js.LICENSE.txt} +0 -0
  29. package/assets/esri/core/workers/chunks/4f5076e1f2b18ce8156d.js +1 -0
  30. package/assets/esri/core/workers/chunks/{f291ebc4b089bd1f0a3f.js → 50e86a6bb13042b1dbac.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{64d9a062c1f1ac08a3ac.js → 565020b1c02a8cb33c2b.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{d78c60a22f76df7c48c7.js → 59640d78295e2e363f18.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{a0356f320a1b2fbd03f0.js → 5ac2b2598245aa17cdbd.js} +1 -1
  34. package/assets/esri/core/workers/chunks/5b4a8cce5601cc92c8a3.js +1 -0
  35. package/assets/esri/core/workers/chunks/5b92d5d4049622531109.js +1 -0
  36. package/assets/esri/core/workers/chunks/{751c1a2838b54a74a9a6.js → 5f3caa0ddb215342c728.js} +2 -2
  37. package/assets/esri/core/workers/chunks/615e995d5ce8fa044b09.js +1 -0
  38. package/assets/esri/core/workers/chunks/62a2453699e0dd2393b9.js +1 -0
  39. package/assets/esri/core/workers/chunks/67013547be1a7ae1670a.js +1 -0
  40. package/assets/esri/core/workers/chunks/67eddf4808f8888faeb4.js +1 -0
  41. package/assets/esri/core/workers/chunks/695dbedff2340aa019ba.js +1 -0
  42. package/assets/esri/core/workers/chunks/6a7e388c94206d2f61ff.js +1 -0
  43. package/assets/esri/core/workers/chunks/6e22b69d55e791ab3d9a.js +1 -0
  44. package/assets/esri/core/workers/chunks/71e6c0c5ef0aa7eb1703.js +1 -0
  45. package/assets/esri/core/workers/chunks/7a74e230439c5111f852.js +1 -0
  46. package/assets/esri/core/workers/chunks/7e76a8e6fa67e607d09e.js +1 -0
  47. package/assets/esri/core/workers/chunks/7fe4985ca0cb3e6d35c6.js +1 -0
  48. package/assets/esri/core/workers/chunks/8027330714ff5ffb020e.js +1 -0
  49. package/assets/esri/core/workers/chunks/844b564d1a422a17f6ac.js +1 -0
  50. package/assets/esri/core/workers/chunks/856f9281a08cb032238e.js +1 -0
  51. package/assets/esri/core/workers/chunks/89b4983de872780e9aa1.js +1 -0
  52. package/assets/esri/core/workers/chunks/8f3bc0cd2c2b01ab80cd.js +1 -0
  53. package/assets/esri/core/workers/chunks/8fd912e325ccd48b98a9.js +1 -0
  54. package/assets/esri/core/workers/chunks/901907a5c01f0fd1478f.js +1 -0
  55. package/assets/esri/core/workers/chunks/92a0b88a14c92239df8a.js +1 -0
  56. package/assets/esri/core/workers/chunks/972e9aeb3c29c9bf441a.js +1 -0
  57. package/assets/esri/core/workers/chunks/9758c34ce61c3714515a.js +1 -0
  58. package/assets/esri/core/workers/chunks/{457ea4feaa006d60c6b1.js → 9a04d087a29f0f3937a3.js} +1 -1
  59. package/assets/esri/core/workers/chunks/9b0bb171224b35ce2031.js +1 -0
  60. package/assets/esri/core/workers/chunks/9cbe7afdaef8720dfc8d.js +1 -0
  61. package/assets/esri/core/workers/chunks/9ccde5b6562f0007fe45.js +1 -0
  62. package/assets/esri/core/workers/chunks/9d320bbeedeea15522ab.js +1 -0
  63. package/assets/esri/core/workers/chunks/a001b3b4527817548094.js +1 -0
  64. package/assets/esri/core/workers/chunks/{197b72bca45065e0eb4a.js → a0c580d4a1915ddd3fe4.js} +1 -1
  65. package/assets/esri/core/workers/chunks/a4a9c15929b43d83701f.js +1 -0
  66. package/assets/esri/core/workers/chunks/a54d11f44721f808b82f.js +1 -0
  67. package/assets/esri/core/workers/chunks/a646a11673d513c00e7a.js +1 -0
  68. package/assets/esri/core/workers/chunks/a792e2bc7cafdc29f05e.js +1 -0
  69. package/assets/esri/core/workers/chunks/acae1771697034f265b1.js +1 -0
  70. package/assets/esri/core/workers/chunks/af2ee804a9c63eea610c.js +1 -0
  71. package/assets/esri/core/workers/chunks/b28b487047da3aeef3fd.js +1 -0
  72. package/assets/esri/core/workers/chunks/b3e57824a5855cb37a96.js +1 -0
  73. package/assets/esri/core/workers/chunks/b89449ead32e4cd21edd.js +1 -0
  74. package/assets/esri/core/workers/chunks/b99891ed5a02cab02173.js +1 -0
  75. package/assets/esri/core/workers/chunks/bac84bc621be73a7a4bc.js +1 -0
  76. package/assets/esri/core/workers/chunks/{25037dcf8a0c72b7b647.js → bbe068388167e9dd0c11.js} +1 -1
  77. package/assets/esri/core/workers/chunks/c271a1857bcc4e9a36dd.js +1 -0
  78. package/assets/esri/core/workers/chunks/{eb3035e49a45ecc82575.js → c5030664720fcdc6d85e.js} +1 -1
  79. package/assets/esri/core/workers/chunks/c534ed122f8a1202d3a3.js +1 -0
  80. package/assets/esri/core/workers/chunks/c5ef2e28b0c539ddb6a7.js +1 -0
  81. package/assets/esri/core/workers/chunks/c65e5ccfae03d148d82b.js +1 -0
  82. package/assets/esri/core/workers/chunks/c91660f3982be4e03705.js +1 -0
  83. package/assets/esri/core/workers/chunks/ce93113b99bdbeddd07b.js +1 -0
  84. package/assets/esri/core/workers/chunks/cf2d408e669cfa2c65be.js +1 -0
  85. package/assets/esri/core/workers/chunks/d08f63ffeecefa02ad91.js +1 -0
  86. package/assets/esri/core/workers/chunks/{8d33644192c01e5416b4.js → d1a71b58ef62e71979c5.js} +1 -1
  87. package/assets/esri/core/workers/chunks/d30eade5afecd334f6cb.js +1 -0
  88. package/assets/esri/core/workers/chunks/d8782d0856b9d815cb6c.js +1 -0
  89. package/assets/esri/core/workers/chunks/db16c21b650001502e6c.js +1 -0
  90. package/assets/esri/core/workers/chunks/db18110c57253a31ac96.js +1 -0
  91. package/assets/esri/core/workers/chunks/dbaa5fb466d6c0214f24.js +1 -0
  92. package/assets/esri/core/workers/chunks/deae370788a7aacf4dd5.js +1 -0
  93. package/assets/esri/core/workers/chunks/e6ca132e1eeea3aa174e.js +1 -0
  94. package/assets/esri/core/workers/chunks/e878ccc431729ef3360f.js +1 -0
  95. package/assets/esri/core/workers/chunks/eb124f15ad4b9193f00a.js +1 -0
  96. package/assets/esri/core/workers/chunks/ebc71c06c1c22aaef54e.js +1 -0
  97. package/assets/esri/core/workers/chunks/f183da283af0836421ab.js +1 -0
  98. package/assets/esri/core/workers/chunks/f42bdc2a134833d33b4e.js +1 -0
  99. package/assets/esri/core/workers/chunks/{736d628cda4e02d40337.js → f8612c2fc5739e98be58.js} +1 -1
  100. package/assets/esri/core/workers/chunks/f965e3e5f6f4f9ba54ac.js +1 -0
  101. package/assets/esri/core/workers/chunks/fa4089640f480b69962e.js +1 -0
  102. package/assets/esri/core/workers/chunks/fb219563e5169ea67d68.js +1 -0
  103. package/assets/esri/libs/i3s/i3s.wasm +0 -0
  104. package/chunks/ChapmanAtmosphere.glsl.js +56 -77
  105. package/chunks/Clouds.glsl.js +1 -1
  106. package/chunks/Pattern.glsl.js +9 -11
  107. package/chunks/RibbonLine.glsl.js +60 -68
  108. package/chunks/i3s.js +1 -1
  109. package/chunks/mat4.js +1 -1
  110. package/chunks/vec3.js +1 -1
  111. package/core/Collection.js +1 -1
  112. package/core/Loadable.js +1 -1
  113. package/core/accessorSupport/ensureType.js +1 -1
  114. package/core/promiseUtils.js +1 -1
  115. package/core/support/OwningCollection.js +1 -1
  116. package/core/workers/RemoteClient.js +1 -1
  117. package/core/workers/WorkerOwner.js +1 -1
  118. package/core/workers/workers.js +2 -2
  119. package/geometry/projection.js +1 -1
  120. package/identity/IdentityManagerBase.js +1 -1
  121. package/interfaces.d.ts +205 -497
  122. package/layers/ElevationLayer.js +1 -1
  123. package/layers/GeoJSONLayer.js +1 -1
  124. package/layers/ImageryTileLayer.js +1 -1
  125. package/layers/VectorTileLayer.js +1 -1
  126. package/layers/VoxelWasmPerScene.js +1 -1
  127. package/layers/WCSLayer.js +1 -1
  128. package/layers/analyses/AreaMeasurement3D.js +1 -1
  129. package/layers/analyses/DirectLineMeasurement3D.js +1 -1
  130. package/layers/analyses/Slice.js +1 -1
  131. package/layers/effects/EffectList.js +1 -1
  132. package/layers/effects/effects.js +1 -1
  133. package/layers/effects/jsonUtils.js +1 -1
  134. package/layers/effects/parser.js +1 -1
  135. package/layers/effects/utils.js +5 -0
  136. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  137. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  138. package/layers/graphics/data/QueryEngine.js +1 -1
  139. package/layers/graphics/data/QueryEngineResult.js +1 -1
  140. package/layers/graphics/sources/connections/GeoEventConnection.js +1 -1
  141. package/layers/mixins/ImageryTileMixin.js +1 -1
  142. package/layers/support/RasterWorker.js +1 -1
  143. package/layers/support/TilemapCache.js +1 -1
  144. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  145. package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
  146. package/layers/support/rasterDatasets/WCSRaster.js +1 -1
  147. package/layers/support/rasterFunctions/pixelUtils.js +1 -1
  148. package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
  149. package/package.json +2 -2
  150. package/portal/support/portalLayers.js +1 -1
  151. package/request.js +1 -1
  152. package/smartMapping/renderers/support/utils.js +1 -1
  153. package/smartMapping/statistics/support/WorkerClient.js +1 -1
  154. package/smartMapping/statistics/support/statsWorker.js +1 -1
  155. package/smartMapping/statistics/support/utils.js +1 -1
  156. package/smartMapping/support/adapters/CSVLayerAdapter.js +1 -1
  157. package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
  158. package/smartMapping/support/adapters/SceneLayerAdapter.js +1 -1
  159. package/smartMapping/support/adapters/support/utils.js +1 -1
  160. package/statistics/utils.js +1 -1
  161. package/support/GraphicsCollection.js +1 -1
  162. package/support/revision.js +1 -1
  163. package/symbols/FillSymbol3DLayer.js +1 -1
  164. package/symbols/IconSymbol3DLayer.js +1 -1
  165. package/symbols/LineSymbol3DLayer.js +1 -1
  166. package/symbols/patterns/LinePattern3D.js +5 -0
  167. package/symbols/patterns/LineStylePattern3D.d.ts +4 -0
  168. package/symbols/patterns/LineStylePattern3D.js +5 -0
  169. package/symbols/patterns/StylePattern3D.js +1 -1
  170. package/symbols/patterns/lineStyles.js +5 -0
  171. package/symbols/patterns/utils.js +1 -1
  172. package/symbols/support/Symbol3DFillMaterial.js +1 -1
  173. package/symbols/support/Symbol3DIconOutline.js +5 -0
  174. package/symbols/support/Symbol3DMaterial.js +1 -1
  175. package/symbols/support/Symbol3DOutline.js +1 -1
  176. package/symbols/support/defaults3D.js +1 -1
  177. package/symbols/support/previewSymbol3D.js +1 -1
  178. package/symbols/support/symbolLayerUtils3D.js +1 -1
  179. package/views/2d/engine/vectorTiles/TileParser.js +1 -1
  180. package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
  181. package/views/2d/engine/vectorTiles/style/StyleRepository.js +1 -1
  182. package/views/2d/engine/webgl/effects/HittestEffect.js +1 -1
  183. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  184. package/views/2d/layers/ImageryLayerView2D.js +1 -1
  185. package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
  186. package/views/2d/layers/VectorTileLayerView2D.js +1 -1
  187. package/views/2d/layers/features/controllers/EditsQueue.js +1 -1
  188. package/views/2d/layers/features/controllers/FeatureController2D.js +1 -1
  189. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  190. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  191. package/views/2d/layers/support/FeatureLayerProxy.js +1 -1
  192. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  193. package/views/3d/environment/ChapmanAtmosphereTechnique.js +1 -1
  194. package/views/3d/environment/CloudsGenerator.js +1 -1
  195. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  196. package/views/3d/environment/PanoramicAtmosphere.js +1 -1
  197. package/views/3d/environment/SimpleAtmosphere.js +1 -1
  198. package/views/3d/externalRenderers/ExternalRendererStore.js +1 -1
  199. package/views/3d/externalRenderers.js +1 -1
  200. package/views/3d/interactive/Manipulator3D.js +1 -1
  201. package/views/3d/interactive/analysisTools/slice/SliceTool.js +1 -1
  202. package/views/3d/interactive/analysisTools/slice/images/Factory.js +5 -0
  203. package/views/3d/interactive/analysisTools/slice/sliceToolConfig.js +1 -1
  204. package/views/3d/interactive/analysisTools/slice/sliceToolUtils.js +1 -1
  205. package/views/3d/interactive/editingTools/settings.js +1 -1
  206. package/views/3d/interactive/editingTools/transformGraphic/ExtentTransformTool.js +1 -1
  207. package/views/3d/interactive/graphics/Slice/SliceController.js +1 -1
  208. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
  209. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
  210. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DView.js +1 -1
  211. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  212. package/views/3d/interactive/visualElements/LaserlineVisualElement.js +1 -1
  213. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  214. package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
  215. package/views/3d/interactive/visualElements/MeasurementArrowVisualElement.js +1 -1
  216. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  217. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  218. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  219. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  220. package/views/3d/interactive/visualElements/SlicePlaneVisualElement.js +1 -1
  221. package/views/3d/interactive/visualElements/VerticesVisualElement.js +1 -1
  222. package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
  223. package/views/3d/layers/DynamicLayerView3D.js +1 -1
  224. package/views/3d/layers/I3SMeshView3D.js +1 -1
  225. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  226. package/views/3d/layers/VectorTileLayerView3D.js +1 -1
  227. package/views/3d/layers/analyses/AreaMeasurement3D/AreaMeasurementView3D.js +1 -1
  228. package/views/3d/layers/analyses/AreaMeasurement3D/support/AreaMeasurementPathHelper.js +1 -1
  229. package/views/3d/layers/analyses/AreaMeasurement3D/support/AreaMeasurementVisualization.js +1 -1
  230. package/views/3d/layers/analyses/DirectLineMeasurement3D/DirectLineMeasurementView3D.js +1 -1
  231. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  232. package/views/3d/layers/graphics/ElevationAligners.js +1 -1
  233. package/views/3d/layers/graphics/ElevationQuery.js +1 -1
  234. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  235. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  236. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  237. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  238. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  239. package/views/3d/layers/graphics/Graphics3DLodInstanceGraphicLayer.js +1 -1
  240. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  241. package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
  242. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  243. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  244. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  245. package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
  246. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  247. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  248. package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
  249. package/views/3d/layers/graphics/Labeler.js +1 -1
  250. package/views/3d/layers/graphics/Loadable.js +1 -1
  251. package/views/3d/layers/graphics/ObjectResourceCache.js +1 -1
  252. package/views/3d/layers/graphics/elevationAlignmentUtils.js +1 -1
  253. package/views/3d/layers/graphics/graphicUtils.js +1 -1
  254. package/views/3d/layers/graphics/labelPlacement.js +1 -1
  255. package/views/3d/layers/graphics/pointUtils.js +1 -1
  256. package/views/3d/layers/i3s/I3SAttributeOverrides.js +1 -1
  257. package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
  258. package/views/3d/layers/i3s/I3SStreamDataController.js +1 -1
  259. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  260. package/views/3d/layers/support/FastSymbolUpdates.js +1 -1
  261. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  262. package/views/3d/layers/support/patternUtils.js +1 -1
  263. package/views/3d/state/GoToOperation.js +1 -1
  264. package/views/3d/state/ViewStateManager.js +1 -1
  265. package/views/3d/support/LaserLineRenderer.js +1 -1
  266. package/views/3d/support/SharedSymbolResources.js +1 -1
  267. package/views/3d/support/StreamDataLoader.js +1 -1
  268. package/views/3d/support/StreamTextureCollection.js +5 -0
  269. package/views/3d/support/TextureCollection.js +1 -1
  270. package/views/3d/support/debugFlags.js +1 -1
  271. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  272. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  273. package/views/3d/support/pointsOfInterest/StableSurfaceCenter.js +1 -1
  274. package/views/3d/terrain/OverlayManager.js +1 -1
  275. package/views/3d/terrain/OverlayRenderTarget.js +1 -1
  276. package/views/3d/terrain/OverlayRenderer.js +1 -1
  277. package/views/3d/terrain/Tile.js +1 -1
  278. package/views/3d/webgl-engine/Stage.js +1 -1
  279. package/views/3d/webgl-engine/core/material/RenderTexture.js +1 -1
  280. package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +13 -12
  281. package/views/3d/webgl-engine/core/shaderLibrary/shading/Reprojection.glsl.js +1 -1
  282. package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +10 -3
  283. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechniqueRepository.js +1 -1
  284. package/views/3d/webgl-engine/lib/Camera.js +1 -1
  285. package/views/3d/webgl-engine/lib/GLMaterialRepository.js +1 -1
  286. package/views/3d/webgl-engine/lib/GLMaterialTexture.js +1 -1
  287. package/views/3d/webgl-engine/lib/GLMaterials.js +1 -1
  288. package/views/3d/webgl-engine/lib/Material.js +1 -1
  289. package/views/3d/webgl-engine/lib/ModelDirtySet.js +1 -1
  290. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  291. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  292. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  293. package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
  294. package/views/3d/webgl-engine/lib/SmaaRenderPass.js +1 -1
  295. package/views/3d/webgl-engine/lib/TextTexture.js +1 -1
  296. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  297. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  298. package/views/3d/webgl-engine/lib/TextureRepository.js +1 -1
  299. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  300. package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
  301. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  302. package/views/3d/webgl-engine/lib/lodRendering/LodComponentData.js +1 -1
  303. package/views/3d/webgl-engine/lib/lodRendering/LodLevel.js +1 -1
  304. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  305. package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
  306. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  307. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  308. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  309. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  310. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  311. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  312. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  313. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  314. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  315. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  316. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  317. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  318. package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
  319. package/views/3d/webgl-engine/materials/WaterGLMaterial.js +1 -1
  320. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  321. package/views/3d/webgl-engine/materials/lineStippleUtils.js +1 -1
  322. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  323. package/views/3d/webgl-engine/parts/Model.js +1 -1
  324. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  325. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  326. package/views/LayerViewManager.js +1 -1
  327. package/views/SceneView.js +1 -1
  328. package/views/ToolViewManager.js +1 -1
  329. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
  330. package/views/support/AllocationTracer.js +1 -1
  331. package/views/support/DefaultsFromMap.js +1 -1
  332. package/views/support/QueueProcessor.js +1 -1
  333. package/views/webgl/capabilities/load.js +1 -1
  334. package/webscene/Slide.js +1 -1
  335. package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
  336. package/widgets/AreaMeasurement3D/AreaMeasurement3DViewModel.js +1 -1
  337. package/widgets/BuildingExplorer/support/layerUtils.js +1 -1
  338. package/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js +1 -1
  339. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
  340. package/widgets/Editor/UpdateWorkflow.js +1 -1
  341. package/widgets/Feature/FeatureViewModel.js +1 -1
  342. package/widgets/Home/HomeViewModel.js +1 -1
  343. package/widgets/Locate/LocateViewModel.js +1 -1
  344. package/widgets/Popup/PopupViewModel.js +1 -1
  345. package/widgets/Search/SearchViewModel.js +1 -1
  346. package/widgets/Search.js +1 -1
  347. package/widgets/Sketch/SketchViewModel.js +1 -1
  348. package/widgets/Slice/SliceViewModel.js +1 -1
  349. package/widgets/TimeSlider/TimeSliderViewModel.js +1 -1
  350. package/assets/esri/core/workers/chunks/0283801d442984997abe.js +0 -1
  351. package/assets/esri/core/workers/chunks/0419e14a520b8fcf3e7a.js +0 -1
  352. package/assets/esri/core/workers/chunks/05318446b6a40caea361.js +0 -1
  353. package/assets/esri/core/workers/chunks/09e714d4381649348ac9.js +0 -1
  354. package/assets/esri/core/workers/chunks/0cecd668b9d5d3f83293.js +0 -1
  355. package/assets/esri/core/workers/chunks/13a73a88efd4f464173e.js +0 -1
  356. package/assets/esri/core/workers/chunks/1576727e8174d672555b.js +0 -1
  357. package/assets/esri/core/workers/chunks/1a3cbeb0a53d03a51dad.js +0 -1
  358. package/assets/esri/core/workers/chunks/1b8524b617bfc6fe422c.js +0 -1
  359. package/assets/esri/core/workers/chunks/1dc1d750046912ff6cef.js +0 -1
  360. package/assets/esri/core/workers/chunks/21fa174c114640be5e40.js +0 -1
  361. package/assets/esri/core/workers/chunks/2a3f6e56079620421a02.js +0 -1
  362. package/assets/esri/core/workers/chunks/2a5bcc73e55986ad93fe.js +0 -1
  363. package/assets/esri/core/workers/chunks/2a6f2e3d639aae491171.js +0 -1
  364. package/assets/esri/core/workers/chunks/2c17d1bad17bcee53f7d.js +0 -1
  365. package/assets/esri/core/workers/chunks/2cea27a0d07aa9a88ad4.js +0 -1
  366. package/assets/esri/core/workers/chunks/2e193d97d199b29b00c2.js +0 -1
  367. package/assets/esri/core/workers/chunks/2eb41fdf0d0a3b0c3232.js +0 -1
  368. package/assets/esri/core/workers/chunks/2f09ea639ca5d1d6ca7e.js +0 -1
  369. package/assets/esri/core/workers/chunks/2fb847ab1440bd1bdf15.js +0 -1
  370. package/assets/esri/core/workers/chunks/402d22ebbae608760b4f.js +0 -1
  371. package/assets/esri/core/workers/chunks/44daef7f0cbc6f6af09f.js +0 -1
  372. package/assets/esri/core/workers/chunks/46899156159e398c693f.js +0 -1
  373. package/assets/esri/core/workers/chunks/46bf8921db25845c63c0.js +0 -1
  374. package/assets/esri/core/workers/chunks/4eb23554e375350f73b5.js +0 -1
  375. package/assets/esri/core/workers/chunks/551917be63a513dfa4de.js +0 -1
  376. package/assets/esri/core/workers/chunks/564f6f5484bcb13ebb2b.js +0 -1
  377. package/assets/esri/core/workers/chunks/61df67ae47b7fb5875d9.js +0 -1
  378. package/assets/esri/core/workers/chunks/62642a8fc7bafe339984.js +0 -1
  379. package/assets/esri/core/workers/chunks/6304f4e53027df04eb8f.js +0 -1
  380. package/assets/esri/core/workers/chunks/6331987617ad166ea098.js +0 -1
  381. package/assets/esri/core/workers/chunks/6b13fcbc71c0088d317e.js +0 -1
  382. package/assets/esri/core/workers/chunks/6f7a6841e7269d2764ad.js +0 -1
  383. package/assets/esri/core/workers/chunks/70110efd2de23d9a5263.js +0 -1
  384. package/assets/esri/core/workers/chunks/7eae3f0588cde44fce39.js +0 -1
  385. package/assets/esri/core/workers/chunks/80d3c7a429c6412f1a8d.js +0 -1
  386. package/assets/esri/core/workers/chunks/80deebdf54bea04a0889.js +0 -1
  387. package/assets/esri/core/workers/chunks/81aa5fe7dcb4fdeb0974.js +0 -1
  388. package/assets/esri/core/workers/chunks/840d08b41913cad4df89.js +0 -1
  389. package/assets/esri/core/workers/chunks/85d154aeb511c5d70bb1.js +0 -1
  390. package/assets/esri/core/workers/chunks/8681e99e2bc9ece61c43.js +0 -1
  391. package/assets/esri/core/workers/chunks/8e5ef967f6518f4c93b1.js +0 -1
  392. package/assets/esri/core/workers/chunks/8edd7f70c8b95c34125c.js +0 -1
  393. package/assets/esri/core/workers/chunks/9044a7b90a53312b6392.js +0 -1
  394. package/assets/esri/core/workers/chunks/905b4dfc1ce57a225fa4.js +0 -1
  395. package/assets/esri/core/workers/chunks/945f90b31ebfae623ea0.js +0 -1
  396. package/assets/esri/core/workers/chunks/9943fd69b67cd1871d68.js +0 -1
  397. package/assets/esri/core/workers/chunks/9ad91c23480ffb656030.js +0 -1
  398. package/assets/esri/core/workers/chunks/9d103681372ab01a4147.js +0 -1
  399. package/assets/esri/core/workers/chunks/9d3230f59b4c4d1b2713.js +0 -1
  400. package/assets/esri/core/workers/chunks/9db75bc0980d16b730a1.js +0 -1
  401. package/assets/esri/core/workers/chunks/a0659b8bdc067da7badd.js +0 -1
  402. package/assets/esri/core/workers/chunks/a480ee9a994410177961.js +0 -1
  403. package/assets/esri/core/workers/chunks/a9b279975d7df0f295d7.js +0 -1
  404. package/assets/esri/core/workers/chunks/aa3abaa5ad4a5a3bcb84.js +0 -1
  405. package/assets/esri/core/workers/chunks/aa8e607f908297786675.js +0 -1
  406. package/assets/esri/core/workers/chunks/ab5a302b5f62d38293f9.js +0 -1
  407. package/assets/esri/core/workers/chunks/abd6a84396e0eb3f01ad.js +0 -1
  408. package/assets/esri/core/workers/chunks/abe9f8516b03a3fb0477.js +0 -1
  409. package/assets/esri/core/workers/chunks/aff6aa5c7f75f8e052d9.js +0 -1
  410. package/assets/esri/core/workers/chunks/b601cc5304b132536239.js +0 -1
  411. package/assets/esri/core/workers/chunks/b85f614ddbddd3c3007e.js +0 -1
  412. package/assets/esri/core/workers/chunks/b944f4ab25a691b3e611.js +0 -1
  413. package/assets/esri/core/workers/chunks/bbdacddb61e651ca0098.js +0 -1
  414. package/assets/esri/core/workers/chunks/c2fa728e805637a1783e.js +0 -1
  415. package/assets/esri/core/workers/chunks/c901f5f85d962254fc2c.js +0 -1
  416. package/assets/esri/core/workers/chunks/ca173b908d89a4e334f6.js +0 -1
  417. package/assets/esri/core/workers/chunks/cc2ef3bfa1f614d7452c.js +0 -1
  418. package/assets/esri/core/workers/chunks/cdb32a9ac9f5804c4212.js +0 -1
  419. package/assets/esri/core/workers/chunks/ce9a4997973da80141a5.js +0 -1
  420. package/assets/esri/core/workers/chunks/d0674b50a358d3bb9db2.js +0 -1
  421. package/assets/esri/core/workers/chunks/d18b7b4b3b9bea7204b0.js +0 -1
  422. package/assets/esri/core/workers/chunks/d2ce983f7babdf18a0ed.js +0 -1
  423. package/assets/esri/core/workers/chunks/d38a0d867dc6cecdc551.js +0 -1
  424. package/assets/esri/core/workers/chunks/e39ca33e9e463c1d6060.js +0 -1
  425. package/assets/esri/core/workers/chunks/e471d103205018a5cf7f.js +0 -1
  426. package/assets/esri/core/workers/chunks/e542fb044fc96f7e8af2.js +0 -1
  427. package/assets/esri/core/workers/chunks/e94e00a28591337b2def.js +0 -1
  428. package/assets/esri/core/workers/chunks/eb2709ccbc001f42ac1b.js +0 -1
  429. package/assets/esri/core/workers/chunks/f905511ca5f9b59fc17f.js +0 -1
  430. package/assets/esri/core/workers/chunks/f910e80dd87727af5184.js +0 -1
  431. package/assets/esri/core/workers/chunks/f9300a24305b0af1d227.js +0 -1
  432. package/assets/esri/core/workers/chunks/fa1e1ac5b3ef7bdf8a78.js +0 -1
  433. package/assets/esri/core/workers/chunks/fce76a84c7d25d8d47e8.js +0 -1
  434. package/assets/esri/core/workers/chunks/fef4f97fbe861a1b60e8.js +0 -1
  435. package/layers/AreaMeasurementLayer.d.ts +0 -4
  436. package/layers/DirectLineMeasurementLayer.d.ts +0 -4
  437. package/symbols/support/symbolPreview.d.ts +0 -4
  438. package/symbols/support/symbolPreview.js +0 -5
  439. package/views/3d/layers/AreaMeasurementLayerView3D.d.ts +0 -4
  440. package/views/3d/layers/DirectLineMeasurementLayerView3D.d.ts +0 -4
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.22/esri/copyright.txt for details.
4
4
  */
5
- import"../has.js";import e from"../Logger.js";const n=e.getLogger("esri.core.Accessor");function r(e){return null==e?e:new Date(e)}function t(e){return null==e?e:!!e}function o(e){return null==e?e:e.toString()}function u(e){return null==e?e:(e=parseFloat(e),isNaN(e)?0:e)}function a(e){return null==e?e:Math.round(parseFloat(e))}function s(e){return e&&e.constructor&&void 0!==e.constructor.__accessorMetadata__}function l(e,n){return null!=n&&e&&!(n instanceof e)}function i(e){return e&&"isCollection"in e}function c(e){return e&&e.Type?"function"==typeof e.Type?e.Type:e.Type.base:null}function f(e,n){if(!n||!n.constructor||!i(n.constructor))return p(e,n)?n:new e(n);const r=c(e.prototype.itemType),t=c(n.constructor.prototype.itemType);return r?t?r===t?n:r.prototype.isPrototypeOf(t.prototype)?new e(n):(p(e,n),n):new e(n):n}function p(e,r){return!!s(r)&&(n.error("Accessor#set","Assigning an instance of '"+(r.declaredClass||"unknown")+"' which is not a subclass of '"+v(e)+"'"),!0)}function y(e,n){return null==n?n:i(e)?f(e,n):l(e,n)?p(e,n)?n:new e(n):n}function v(e){return e&&e.prototype&&e.prototype.declaredClass||"unknown"}function g(e){switch(e){case Number:return u;case N:return a;case Boolean:return t;case String:return o;case Date:return r;default:return y.bind(null,e)}}function d(e,n){const r=g(e);return 1===arguments.length?r:r(n)}function h(e,n,r){return 1===arguments.length?h.bind(null,e):n?Array.isArray(n)?n.map((n=>e(n,r))):[e(n,r)]:n}function b(e,n){return 1===arguments.length?h(d.bind(null,e)):h(d.bind(null,e),n)}function m(e,n,r){return 0!==n&&Array.isArray(r)?r.map((r=>m(e,n-1,r))):e(r)}function w(e,n,r){if(2===arguments.length)return w.bind(null,e,n);if(!r)return r;let t=n,o=r=m(e,n,r);for(;t>0&&Array.isArray(o);)t--,o=o[0];if(void 0!==o)for(let u=0;u<t;u++)r=[r];return r}function A(e,n,r){return 2===arguments.length?w(d.bind(null,e),n):w(d.bind(null,e),n,r)}function $(e){return!!Array.isArray(e)&&!e.some((n=>{const r=typeof n;return!("string"===r||"number"===r||"function"===r&&e.length>1)}))}function j(e,r){if(2===arguments.length)return j(e).call(null,r);const t=new Set,o=e.filter((e=>"function"!=typeof e)),u=e.filter((e=>"function"==typeof e));for(const n of e)"string"!=typeof n&&"number"!=typeof n||t.add(n);let a=null,s=null;return(e,r)=>{if(null==e)return e;const i=typeof e,c="string"===i||"number"===i;return c&&(t.has(e)||u.some((e=>"string"===i&&e===String||"number"===i&&e===Number)))||"object"===i&&u.some((n=>!l(e,n)))?e:(c&&o.length?(a||(a=o.map((e=>"string"==typeof e?`'${e}'`:`${e}`)).join(", ")),n.error("Accessor#set",`'${e}' is not a valid value for this property, only the following values are valid: ${a}`)):"object"==typeof e&&u.length?(s||(s=u.map((e=>v(e))).join(", ")),n.error("Accessor#set",`'${e}' is not a valid value for this property, value must be one of ${s}`)):n.error("Accessor#set",`'${e}' is not a valid value for this property`),r&&(r.valid=!1),null)}}function k(e,r){if(2===arguments.length)return k(e).call(null,r);const t={},o=[],u=[];for(const n in e.typeMap){const r=e.typeMap[n];t[n]=d(r),o.push(v(r)),u.push(n)}const a=()=>`'${o.join("', '")}'`,i=()=>`'${u.join("', '")}'`,c="string"==typeof e.key?n=>n[e.key]:e.key;return r=>{if(e.base&&!l(e.base,r))return r;if(null==r)return r;const o=c(r)||e.defaultKeyValue,u=t[o];if(!u)return n.error("Accessor#set",`Invalid property value, value needs to be one of ${a()}, or a plain object that can autocast (having .type = ${i()})`),null;if(!l(e.typeMap[o],r))return r;if("string"==typeof e.key&&!s(r)){const n={};for(const t in r)t!==e.key&&(n[t]=r[t]);return u(n)}return u(r)}}class N{}const S={native:e=>({type:"native",value:e}),array:e=>({type:"array",value:e}),oneOf:e=>({type:"one-of",values:e})};function T(e){if(!e||!("type"in e))return!1;switch(e.type){case"native":case"array":case"one-of":return!0}return!1}function M(e){switch(e.type){case"native":return d(e.value);case"array":return h(M(e.value));case"one-of":return _(e);default:return null}}function _(e){let r=null;return(t,o)=>C(t,e)?t:(null==r&&(r=B(e)),n.error("Accessor#set",`Invalid property value, value needs to be of type ${r}`),o&&(o.valid=!1),null)}function B(e){switch(e.type){case"native":switch(e.value){case Number:return"number";case String:return"string";case Boolean:return"boolean";case N:return"integer";case Date:return"date";default:return v(e.value)}case"array":return`array of ${B(e.value)}`;case"one-of":{const n=e.values.map((e=>B(e)));return`one of ${n.slice(0,n.length-1)} or ${n[n.length-1]}`}}return"unknown"}function C(e,n){if(null==e)return!0;switch(n.type){case"native":switch(n.value){case Number:case N:return"number"==typeof e;case Boolean:return"boolean"==typeof e;case String:return"string"==typeof e}return e instanceof n.value;case"array":return!!Array.isArray(e)&&!e.some((e=>!C(e,n.value)));case"one-of":return n.values.some((n=>C(e,n)))}}export{N as Integer,d as default,b as ensureArray,h as ensureArrayTyped,t as ensureBoolean,y as ensureClass,r as ensureDate,a as ensureInteger,M as ensureLongFormType,A as ensureNArray,w as ensureNArrayTyped,u as ensureNumber,j as ensureOneOf,k as ensureOneOfType,o as ensureString,d as ensureType,s as isClassedType,T as isLongFormType,$ as isOneOf,l as requiresType,S as types};
5
+ import"../has.js";import e from"../Logger.js";import{getOrCreateMapValue as n}from"../MapUtils.js";const r=e.getLogger("esri.core.Accessor");function t(e){return null==e?e:new Date(e)}function o(e){return null==e?e:!!e}function u(e){return null==e?e:e.toString()}function a(e){return null==e?e:(e=parseFloat(e),isNaN(e)?0:e)}function s(e){return null==e?e:Math.round(parseFloat(e))}function l(e){return e&&e.constructor&&void 0!==e.constructor.__accessorMetadata__}function i(e,n){return null!=n&&e&&!(n instanceof e)}function c(e){return e&&"isCollection"in e}function f(e){return e&&e.Type?"function"==typeof e.Type?e.Type:e.Type.base:null}function p(e,n){if(!n||!n.constructor||!c(n.constructor))return y(e,n)?n:new e(n);const r=f(e.prototype.itemType),t=f(n.constructor.prototype.itemType);return r?t?r===t?n:r.prototype.isPrototypeOf(t.prototype)?new e(n):(y(e,n),n):new e(n):n}function y(e,n){return!!l(n)&&(r.error("Accessor#set","Assigning an instance of '"+(n.declaredClass||"unknown")+"' which is not a subclass of '"+g(e)+"'"),!0)}function v(e,n){return null==n?n:c(e)?p(e,n):i(e,n)?y(e,n)?n:new e(n):n}function g(e){return e&&e.prototype&&e.prototype.declaredClass||"unknown"}const d=new WeakMap;function h(e){switch(e){case Number:return a;case S:return s;case Boolean:return o;case String:return u;case Date:return t;default:return n(d,e,(()=>v.bind(null,e)))}}function b(e,n){const r=h(e);return 1===arguments.length?r:r(n)}function m(e,n,r){return 1===arguments.length?m.bind(null,e):n?Array.isArray(n)?n.map((n=>e(n,r))):[e(n,r)]:n}function w(e,n){return 1===arguments.length?m(b.bind(null,e)):m(b.bind(null,e),n)}function A(e,n,r){return 0!==n&&Array.isArray(r)?r.map((r=>A(e,n-1,r))):e(r)}function $(e,n,r){if(2===arguments.length)return $.bind(null,e,n);if(!r)return r;let t=n,o=r=A(e,n,r);for(;t>0&&Array.isArray(o);)t--,o=o[0];if(void 0!==o)for(let u=0;u<t;u++)r=[r];return r}function j(e,n,r){return 2===arguments.length?$(b.bind(null,e),n):$(b.bind(null,e),n,r)}function k(e){return!!Array.isArray(e)&&!e.some((n=>{const r=typeof n;return!("string"===r||"number"===r||"function"===r&&e.length>1)}))}function M(e,n){if(2===arguments.length)return M(e).call(null,n);const t=new Set,o=e.filter((e=>"function"!=typeof e)),u=e.filter((e=>"function"==typeof e));for(const r of e)"string"!=typeof r&&"number"!=typeof r||t.add(r);let a=null,s=null;return(e,n)=>{if(null==e)return e;const l=typeof e,c="string"===l||"number"===l;return c&&(t.has(e)||u.some((e=>"string"===l&&e===String||"number"===l&&e===Number)))||"object"===l&&u.some((n=>!i(e,n)))?e:(c&&o.length?(a||(a=o.map((e=>"string"==typeof e?`'${e}'`:`${e}`)).join(", ")),r.error("Accessor#set",`'${e}' is not a valid value for this property, only the following values are valid: ${a}`)):"object"==typeof e&&u.length?(s||(s=u.map((e=>g(e))).join(", ")),r.error("Accessor#set",`'${e}' is not a valid value for this property, value must be one of ${s}`)):r.error("Accessor#set",`'${e}' is not a valid value for this property`),n&&(n.valid=!1),null)}}function N(e,n){if(2===arguments.length)return N(e).call(null,n);const t={},o=[],u=[];for(const r in e.typeMap){const n=e.typeMap[r];t[r]=b(n),o.push(g(n)),u.push(r)}const a=()=>`'${o.join("', '")}'`,s=()=>`'${u.join("', '")}'`,c="string"==typeof e.key?n=>n[e.key]:e.key;return n=>{if(e.base&&!i(e.base,n))return n;if(null==n)return n;const o=c(n)||e.defaultKeyValue,u=t[o];if(!u)return r.error("Accessor#set",`Invalid property value, value needs to be one of ${a()}, or a plain object that can autocast (having .type = ${s()})`),null;if(!i(e.typeMap[o],n))return n;if("string"==typeof e.key&&!l(n)){const r={};for(const t in n)t!==e.key&&(r[t]=n[t]);return u(r)}return u(n)}}class S{}const T={native:e=>({type:"native",value:e}),array:e=>({type:"array",value:e}),oneOf:e=>({type:"one-of",values:e})};function _(e){if(!e||!("type"in e))return!1;switch(e.type){case"native":case"array":case"one-of":return!0}return!1}function B(e){switch(e.type){case"native":return b(e.value);case"array":return m(B(e.value));case"one-of":return C(e);default:return null}}function C(e){let n=null;return(t,o)=>F(t,e)?t:(null==n&&(n=D(e)),r.error("Accessor#set",`Invalid property value, value needs to be of type ${n}`),o&&(o.valid=!1),null)}function D(e){switch(e.type){case"native":switch(e.value){case Number:return"number";case String:return"string";case Boolean:return"boolean";case S:return"integer";case Date:return"date";default:return g(e.value)}case"array":return`array of ${D(e.value)}`;case"one-of":{const n=e.values.map((e=>D(e)));return`one of ${n.slice(0,n.length-1)} or ${n[n.length-1]}`}}return"unknown"}function F(e,n){if(null==e)return!0;switch(n.type){case"native":switch(n.value){case Number:case S:return"number"==typeof e;case Boolean:return"boolean"==typeof e;case String:return"string"==typeof e}return e instanceof n.value;case"array":return!!Array.isArray(e)&&!e.some((e=>!F(e,n.value)));case"one-of":return n.values.some((n=>F(e,n)))}}export{S as Integer,b as default,w as ensureArray,m as ensureArrayTyped,o as ensureBoolean,v as ensureClass,t as ensureDate,s as ensureInteger,B as ensureLongFormType,j as ensureNArray,$ as ensureNArrayTyped,a as ensureNumber,M as ensureOneOf,N as ensureOneOfType,u as ensureString,b as ensureType,l as isClassedType,_ as isLongFormType,k as isOneOf,i as requiresType,T as types};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.22/esri/copyright.txt for details.
4
4
  */
5
- import t from"./clock.js";import n from"./Error.js";import{once as e}from"./events.js";import r from"./Logger.js";import{isSome as o,isNone as i,assumeNonNull as u,removeMaybe as c}from"./maybe.js";function s(t){return Promise.all(t)}function f(t,n){const e=t.slice();return Promise.all(t.map(((t,e)=>n(t,e)))).then((t=>e.filter(((n,e)=>t[e]))))}function l(t){return new Promise(((n,e)=>{try{t(n,e)}catch(r){Promise.resolve().then((()=>e(r)))}}))}function m(t="Aborted"){return new n("AbortError",t)}function h(){return new AbortController}function a(t,n="Aborted"){if(b(t))throw m(n)}function p(t){return o(t)?"aborted"in t?t:t.signal:t}function b(t){const n=p(t);return o(n)&&n.aborted}function w(t){if(g(t))throw t}function j(t){if(!g(t))throw t}function v(t,n){const r=p(t);if(!i(r)){if(!r.aborted)return e(r,"abort",(()=>n()));n()}}function P(t,n){const r=p(t);if(!i(r))return a(r),e(r,"abort",(()=>n(m())))}function d(t,n){const e=p(n);return i(e)?t:new Promise(((e,r)=>{let o=v(n,(()=>r(m())));const i=()=>o=c(o);t.then(i,i),t.then(e,r)}))}function g(t){return t&&"AbortError"===t.name}function y(t){return t.catch((t=>{if(!g(t))throw t}))}function T(t,n=r.getLogger("esri")){return t.catch((t=>{g(t)||n.error(t)}))}function E(){let t=null;const n=new Promise(((n,e)=>{t={promise:void 0,resolve:n,reject:e}}));return t.promise=n,t}function A(t){if(!t)return;if("function"!=typeof t.forEach){const n=Object.keys(t);return A(n.map((n=>t[n]))).then((t=>{const e={};return n.forEach(((n,r)=>e[n]=t[r])),e}))}const n=t;return l((t=>{const e=[];let r=n.length;0===r&&t(e),n.forEach((n=>{const o={promise:n||Promise.resolve(n)};e.push(o),o.promise.then((t=>{o.value=t})).catch((t=>{o.error=t})).then((()=>{--r,0===r&&t(e)}))}))}))}function k(t){return A(t).then((t=>t.filter((t=>!!t.value)).map((t=>t.value))))}function L(t){return Promise.reject(t)}function x(t){return Promise.resolve(t)}function C(t,n,e){const r=h();return v(e,(()=>r.abort())),new Promise(((e,o)=>{let i=setTimeout((()=>{i=0,e(n)}),t);v(r,(()=>{i&&(clearTimeout(i),o(m()))}))}))}function O(t,e,r,o){const i=r&&"abort"in r?r:null;null!=o||i||(o=r);let u=setTimeout((()=>{u=0,i&&i.abort()}),e);const c=()=>{throw o||new n("promiseUtils:timeout","The wrapped promise did not resolve within "+e+" ms")};return t.then((t=>{if(0===u)throw c();return clearTimeout(u),t}),(t=>{throw clearTimeout(u),0===u?c():t}))}function U(t){return t&&"function"==typeof t.then}function q(t){return z(t)?t:Promise.resolve(t)}function z(t){return t&&"object"==typeof t&&"then"in t&&"function"==typeof t.then}function B(t,n=-1){let e,r,o,i,c=null;const s=(...f)=>{if(e){r=f,i&&i.reject(m()),i=E();const t=u(i.promise);if(c){const t=c;c=null,t.abort()}return t}if(o=i||E(),i=null,n>0){const r=h();e=q(t(...f,r.signal));const o=e;C(n).then((()=>{e===o&&(i?r.abort():c=r)}))}else e=1,e=q(t(...f));const l=()=>{const t=r;r=o=e=c=null,null!=t&&s(...t)},a=e,p=o;return a.then(l,l),a.then(p.resolve,p.reject),u(p.promise)};return s}function D(){let n,e;const r=new Promise(((t,r)=>{n=t,e=r})),o=t=>{n(t)};return o.resolve=t=>n(t),o.reject=t=>e(t),o.timeout=(n,e)=>t.setTimeout((()=>o.reject(e)),n),o.promise=r,o}function F(t,n){return t.then(n,n)}function G(t){let n=h();const e=t(n.signal);let r={promise:e,finished:!1,abort:()=>{n&&(n.abort(),n=null)}};const o=()=>{r&&(r.finished=!0,r=null),n=null};return e.then(o,o),r}export{C as after,s as all,F as always,l as create,h as createAbortController,m as createAbortError,E as createDeferred,D as createResolver,G as createTask,B as debounce,A as eachAlways,k as eachAlwaysValues,f as filter,y as ignoreAbortErrors,g as isAbortError,b as isAborted,z as isPromise,U as isPromiseLike,T as logOnError,v as onAbort,P as onAbortOrThrow,L as reject,x as resolve,w as throwIfAbortError,a as throwIfAborted,j as throwIfNotAbortError,O as timeout,q as when,d as whenOrAbort};
5
+ import t from"./clock.js";import n from"./Error.js";import{once as e}from"./events.js";import r from"./Logger.js";import{isSome as o,isNone as i,assumeNonNull as u,removeMaybe as c}from"./maybe.js";function s(t){return Promise.all(t)}function l(t,n){const e=t.slice();return Promise.all(t.map(((t,e)=>n(t,e)))).then((t=>e.filter(((n,e)=>t[e]))))}function f(t){return new Promise(((n,e)=>{try{t(n,e)}catch(r){Promise.resolve().then((()=>e(r)))}}))}function m(t="Aborted"){return new n("AbortError",t)}function h(t,n="Aborted"){if(p(t))throw m(n)}function a(t){return o(t)?"aborted"in t?t:t.signal:t}function p(t){const n=a(t);return o(n)&&n.aborted}function b(t){if(d(t))throw t}function w(t){if(!d(t))throw t}function j(t,n){const r=a(t);if(!i(r)){if(!r.aborted)return e(r,"abort",(()=>n()));n()}}function v(t,n){const r=a(t);if(!i(r))return h(r),e(r,"abort",(()=>n(m())))}function P(t,n){const e=a(n);return i(e)?t:new Promise(((e,r)=>{let o=j(n,(()=>r(m())));const i=()=>o=c(o);t.then(i,i),t.then(e,r)}))}function d(t){return t&&"AbortError"===t.name}function g(t){return t.catch((t=>{if(!d(t))throw t}))}function y(t,n=r.getLogger("esri")){return t.catch((t=>{d(t)||n.error(t)}))}function A(){let t=null;const n=new Promise(((n,e)=>{t={promise:void 0,resolve:n,reject:e}}));return t.promise=n,t}function T(t){if(!t)return;if("function"!=typeof t.forEach){const n=Object.keys(t);return T(n.map((n=>t[n]))).then((t=>{const e={};return n.forEach(((n,r)=>e[n]=t[r])),e}))}const n=t;return f((t=>{const e=[];let r=n.length;0===r&&t(e),n.forEach((n=>{const o={promise:n||Promise.resolve(n)};e.push(o),o.promise.then((t=>{o.value=t})).catch((t=>{o.error=t})).then((()=>{--r,0===r&&t(e)}))}))}))}function E(t){return T(t).then((t=>t.filter((t=>!!t.value)).map((t=>t.value))))}function C(t){return Promise.reject(t)}function k(t){return Promise.resolve(t)}function L(t,n,e){const r=new AbortController;return j(e,(()=>r.abort())),new Promise(((e,o)=>{let i=setTimeout((()=>{i=0,e(n)}),t);j(r,(()=>{i&&(clearTimeout(i),o(m()))}))}))}function x(t,e,r,o){const i=r&&"abort"in r?r:null;null!=o||i||(o=r);let u=setTimeout((()=>{u=0,i&&i.abort()}),e);const c=()=>{throw o||new n("promiseUtils:timeout","The wrapped promise did not resolve within "+e+" ms")};return t.then((t=>{if(0===u)throw c();return clearTimeout(u),t}),(t=>{throw clearTimeout(u),0===u?c():t}))}function O(t){return t&&"function"==typeof t.then}function U(t){return q(t)?t:Promise.resolve(t)}function q(t){return t&&"object"==typeof t&&"then"in t&&"function"==typeof t.then}function z(t,n=-1){let e,r,o,i,c=null;const s=(...l)=>{if(e){r=l,i&&i.reject(m()),i=A();const t=u(i.promise);if(c){const t=c;c=null,t.abort()}return t}if(o=i||A(),i=null,n>0){const r=new AbortController;e=U(t(...l,r.signal));const o=e;L(n).then((()=>{e===o&&(i?r.abort():c=r)}))}else e=1,e=U(t(...l));const f=()=>{const t=r;r=o=e=c=null,null!=t&&s(...t)},h=e,a=o;return h.then(f,f),h.then(a.resolve,a.reject),u(a.promise)};return s}function B(){let n,e;const r=new Promise(((t,r)=>{n=t,e=r})),o=t=>{n(t)};return o.resolve=t=>n(t),o.reject=t=>e(t),o.timeout=(n,e)=>t.setTimeout((()=>o.reject(e)),n),o.promise=r,o}function D(t,n){return t.then(n,n)}function F(t){let n=new AbortController;const e=t(n.signal);let r={promise:e,finished:!1,abort:()=>{n&&(n.abort(),n=null)}};const o=()=>{r&&(r.finished=!0,r=null),n=null};return e.then(o,o),r}export{L as after,s as all,D as always,f as create,m as createAbortError,A as createDeferred,B as createResolver,F as createTask,z as debounce,T as eachAlways,E as eachAlwaysValues,l as filter,g as ignoreAbortErrors,d as isAbortError,p as isAborted,q as isPromise,O as isPromiseLike,y as logOnError,j as onAbort,v as onAbortOrThrow,C as reject,k as resolve,b as throwIfAbortError,h as throwIfAborted,w as throwIfNotAbortError,x as timeout,U as when,P as whenOrAbort};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.22/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../Collection.js";import{castForReferenceSetter as s,referenceSetter as o}from"../collectionUtils.js";import r from"../Handles.js";import"../has.js";import i from"../Logger.js";import{isNone as n}from"../maybe.js";import{property as l}from"../accessorSupport/decorators/property.js";import"../arrayUtils.js";import"../accessorSupport/ensureType.js";import{subclass as p}from"../accessorSupport/decorators/subclass.js";i.getLogger("esri.core.support.OwningCollection");let a=class extends t{constructor(e){super(e),this._handles=new r,this._handles.add([this.on("before-add",(e=>{n(e.item)&&e.preventDefault()})),this.on("after-add",(e=>this._own(e.item))),this.on("after-remove",(e=>this._release(e.item)))])}destroy(){super.destroy(),this._handles.destroy()}get owner(){return this._get("owner")}set owner(e){e!==this._get("owner")&&(this._releaseAll(),this._set("owner",e),this._ownAll())}_createNewInstance(e){return new t(e)}_ownAll(){for(const e of this.items)this._own(e)}_releaseAll(){for(const e of this.items)this._release(e)}};function c(e,t){return{type:e,cast:s,set(s){const r=o(s,this._get(t),e);r.owner=this,this._set(t,r)}}}e([l()],a.prototype,"owner",null),a=e([p("esri.core.support.OwningCollection")],a);export{a as OwningCollection,c as owningCollectionProperty};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../Collection.js";import{castForReferenceSetter as s,referenceSetter as o}from"../collectionUtils.js";import{HandleOwnerMixin as r}from"../HandleOwner.js";import"../has.js";import i from"../Logger.js";import{isNone as n}from"../maybe.js";import{property as p}from"../accessorSupport/decorators/property.js";import"../arrayUtils.js";import"../accessorSupport/ensureType.js";import{subclass as l}from"../accessorSupport/decorators/subclass.js";i.getLogger("esri.core.support.OwningCollection");let m=class extends(r(t)){constructor(e){super(e),this.handles.add([this.on("before-add",(e=>{n(e.item)&&e.preventDefault()})),this.on("after-add",(e=>this._own(e.item))),this.on("after-remove",(e=>this._release(e.item)))])}get owner(){return this._get("owner")}set owner(e){e!==this._get("owner")&&(this._releaseAll(),this._set("owner",e),this._ownAll())}_ownAll(){for(const e of this.items)this._own(e)}_releaseAll(){for(const e of this.items)this._release(e)}_createNewInstance(e){return this.itemType?new(t.ofType(this.itemType.Type))(e):new t(e)}};function a(e,t){return{type:e,cast:s,set(s){const r=o(s,this._get(t),e);r.owner=this,this._set(t,r)}}}e([p()],m.prototype,"owner",null),m=e([l("esri.core.support.OwningCollection")],m);export{m as OwningCollection,a as owningCollectionProperty};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.22/esri/copyright.txt for details.
4
4
  */
5
- import{version as e}from"../../kernel.js";import s from"../Error.js";import{on as t}from"../events.js";import{isSome as o}from"../maybe.js";import{onAbortOrThrow as r,createAbortError as i,createAbortController as n,isPromiseLike as a,isAbortError as l}from"../promiseUtils.js";import{newJobId as c,MessageType as p,receiveMessage as h,toInvokeError as u,postMessage as _}from"./utils.js";import{commitHash as d,buildDate as m}from"../../support/revision.js";const g={statsWorker:()=>import("../../smartMapping/statistics/support/statsWorker.js"),geometryEngineWorker:()=>import("../../geometry/geometryEngineWorker.js"),CSVSourceWorker:()=>import("../../layers/graphics/sources/support/CSVSourceWorker.js"),EdgeProcessingWorker:()=>import("../../views/3d/webgl-engine/lib/edgeRendering/EdgeProcessingWorker.js"),ElevationSamplerWorker:()=>import("../../geometry/support/meshUtils/ElevationSamplerWorker.js"),FeatureServiceSnappingSourceWorker:()=>import("../../views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorker.js"),GeoJSONSourceWorker:()=>import("../../layers/graphics/sources/geojson/GeoJSONSourceWorker.js"),LercWorker:()=>import("../../layers/support/LercWorker.js"),MemorySourceWorker:()=>import("../../layers/graphics/sources/support/MemorySourceWorker.js"),PBFDecoderWorker:()=>import("../../views/3d/support/PBFDecoderWorker.js"),Pipeline:()=>import("../../views/2d/layers/features/Pipeline.js"),PointCloudWorker:()=>import("../../views/3d/layers/PointCloudWorker.js"),RasterWorker:()=>import("../../layers/support/RasterWorker.js"),SceneLayerWorker:()=>import("../../views/3d/layers/SceneLayerWorker.js"),WFSSourceWorker:()=>import("../../layers/graphics/sources/WFSSourceWorker.js"),WorkerTileHandler:()=>import("../../views/2d/engine/vectorTiles/WorkerTileHandler.js")},{CLOSE:b,ABORT:k,INVOKE:v,RESPONSE:y,OPEN_PORT:j,ON:f}=p;class M{constructor(e){this._timer=null,this._cancelledJobIds=new Set,this._invokeMessages=[],this._invoke=e,this._timer=null,this._process=this._process.bind(this)}push(e){e.type===p.ABORT?this._cancelledJobIds.add(e.jobId):(this._invokeMessages.push(e),null===this._timer&&(this._timer=setTimeout(this._process,0)))}clear(){this._invokeMessages.length=0,this._cancelledJobIds.clear(),this._timer=null}_process(){this._timer=null;for(const e of this._invokeMessages)this._cancelledJobIds.has(e.jobId)||this._invoke(e);this._cancelledJobIds.clear(),this._invokeMessages.length=0}}class S{constructor(e,s){this._port=e,this._outJobs=new Map,this._inJobs=new Map,this._invokeQueue=new M((e=>this._onInvokeMessage(e))),this._client=s.client,this._onMessage=this._onMessage.bind(this),this._channel=s.channel,this._schedule=s.schedule,this._port.addEventListener("message",this._onMessage),this._port.start()}static connect(e){const s=new MessageChannel;let t;t="function"==typeof e?new e:"default"in e&&"function"==typeof e.default?new e.default:e;const o=new S(s.port1,{channel:s,client:t});return"object"==typeof t&&"remoteClient"in t&&(t.remoteClient=o),S.clients.set(o,t),s.port2}static loadWorker(e){const s=g[e];return s?s():Promise.resolve(null)}close(){this._post({type:b}),this._close()}isBusy(){return this._outJobs.size>0}invoke(e,t,o){const n=o&&o.signal,a=o&&o.transferList;if(!this._port)return Promise.reject(new s("worker:port-closed",`Cannot call invoke('${e}'), port is closed`,{methodName:e,data:t}));const l=c();return new Promise(((s,o)=>{const c=r(n,(()=>{var e;const s=this._outJobs.get(l);s&&(this._outJobs.delete(l),null==(e=s.abortHandle)||e.remove(),this._post({type:k,jobId:l}),o(i()))})),p={resolve:s,reject:o,abortHandle:c,debugInfo:e};this._outJobs.set(l,p),this._post({type:v,jobId:l,methodName:e,abortable:null!=n},t,a)}))}on(e,s){const t=new MessageChannel;function o(e){s(e.data)}return this._port.postMessage({type:p.ON,eventType:e,port:t.port2},[t.port2]),t.port1.addEventListener("message",o),t.port1.start(),{remove(){t.port1.postMessage({type:p.CLOSE}),t.port1.close(),t.port1.removeEventListener("message",o)}}}openPort(){const e=new MessageChannel;return this._post({type:j,port:e.port2}),e.port1}_close(){this._channel&&(this._channel=null),this._port.removeEventListener("message",this._onMessage),this._port.close(),this._outJobs.forEach((e=>{var s;null==(s=e.abortHandle)||s.remove(),e.reject(i(`Worker closing, aborting job calling '${e.debugInfo}'`))})),this._inJobs.clear(),this._outJobs.clear(),this._invokeQueue.clear(),this._port=this._client=this._schedule=null}_onMessage(e){o(this._schedule)?this._schedule((()=>this._processMessage(e))):this._processMessage(e)}_processMessage(e){const s=h(e);if(s)switch(s.type){case y:this._onResponseMessage(s);break;case v:this._invokeQueue.push(s);break;case k:this._onAbortMessage(s);break;case b:this._onCloseMessage();break;case j:this._onOpenPortMessage(s);break;case f:this._onOnMessage(s)}}_onAbortMessage(e){const s=this._inJobs,t=e.jobId,o=s.get(t);this._invokeQueue.push(e),o&&(o.controller&&o.controller.abort(),s.delete(t))}_onCloseMessage(){const e=this._client;this._close(),e&&"destroy"in e&&S.clients.get(this)===e&&e.destroy(),S.clients.delete(this),e&&e.remoteClient&&(e.remoteClient=null)}_onInvokeMessage(e){const{methodName:s,jobId:t,data:o,abortable:r}=e,i=r?n():null,c=this._inJobs;let p,h=this._client,_=h[s];try{if(!_&&s&&-1!==s.indexOf(".")){const e=s.split(".");for(let s=0;s<e.length-1;s++)h=h[e[s]],_=h[e[s+1]]}if("function"!=typeof _)throw new TypeError(`${s} is not a function`);p=_.call(h,o,{client:this,signal:i?i.signal:null})}catch(d){return void this._post({type:y,jobId:t,error:u(d)})}a(p)?(c.set(t,{controller:i,promise:p}),p.then((e=>{c.has(t)&&(c.delete(t),this._post({type:y,jobId:t},e))}),(e=>{c.has(t)&&(c.delete(t),l(e)||this._post({type:y,jobId:t,error:u(e||{message:`Error encountered at method ${s}`})}))}))):this._post({type:y,jobId:t},p)}_onOpenPortMessage(e){new S(e.port,{client:this._client})}_onOnMessage(e){const{port:s}=e,o=this._client.on(e.eventType,(e=>{s.postMessage(e)})),r=t(e.port,"message",(e=>{h(e).type===p.CLOSE&&(r.remove(),o.remove(),s.close())}))}_onResponseMessage(e){var t;const{jobId:o,error:r,data:i}=e,n=this._outJobs;if(!n.has(o))return;const a=n.get(o);n.delete(o),null==(t=a.abortHandle)||t.remove(),r?a.reject(s.fromJSON(JSON.parse(r))):a.resolve(i)}_post(e,s,t){return _(this._port,e,s,t)}}S.kernelInfo={revision:d,version:e,buildDate:m},S.clients=new Map;export{S as default};
5
+ import{version as e}from"../../kernel.js";import s from"../Error.js";import{on as t}from"../events.js";import{isSome as o}from"../maybe.js";import{onAbortOrThrow as r,createAbortError as i,isPromiseLike as n,isAbortError as a}from"../promiseUtils.js";import{newJobId as l,MessageType as c,receiveMessage as p,toInvokeError as h,postMessage as u}from"./utils.js";import{commitHash as _,buildDate as d}from"../../support/revision.js";const m={statsWorker:()=>import("../../smartMapping/statistics/support/statsWorker.js"),geometryEngineWorker:()=>import("../../geometry/geometryEngineWorker.js"),CSVSourceWorker:()=>import("../../layers/graphics/sources/support/CSVSourceWorker.js"),EdgeProcessingWorker:()=>import("../../views/3d/webgl-engine/lib/edgeRendering/EdgeProcessingWorker.js"),ElevationSamplerWorker:()=>import("../../geometry/support/meshUtils/ElevationSamplerWorker.js"),FeatureServiceSnappingSourceWorker:()=>import("../../views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorker.js"),GeoJSONSourceWorker:()=>import("../../layers/graphics/sources/geojson/GeoJSONSourceWorker.js"),LercWorker:()=>import("../../layers/support/LercWorker.js"),MemorySourceWorker:()=>import("../../layers/graphics/sources/support/MemorySourceWorker.js"),PBFDecoderWorker:()=>import("../../views/3d/support/PBFDecoderWorker.js"),Pipeline:()=>import("../../views/2d/layers/features/Pipeline.js"),PointCloudWorker:()=>import("../../views/3d/layers/PointCloudWorker.js"),RasterWorker:()=>import("../../layers/support/RasterWorker.js"),SceneLayerWorker:()=>import("../../views/3d/layers/SceneLayerWorker.js"),WFSSourceWorker:()=>import("../../layers/graphics/sources/WFSSourceWorker.js"),WorkerTileHandler:()=>import("../../views/2d/engine/vectorTiles/WorkerTileHandler.js")},{CLOSE:g,ABORT:b,INVOKE:k,RESPONSE:v,OPEN_PORT:y,ON:j}=c;class f{constructor(e){this._timer=null,this._cancelledJobIds=new Set,this._invokeMessages=[],this._invoke=e,this._timer=null,this._process=this._process.bind(this)}push(e){e.type===c.ABORT?this._cancelledJobIds.add(e.jobId):(this._invokeMessages.push(e),null===this._timer&&(this._timer=setTimeout(this._process,0)))}clear(){this._invokeMessages.length=0,this._cancelledJobIds.clear(),this._timer=null}_process(){this._timer=null;for(const e of this._invokeMessages)this._cancelledJobIds.has(e.jobId)||this._invoke(e);this._cancelledJobIds.clear(),this._invokeMessages.length=0}}class M{constructor(e,s){this._port=e,this._outJobs=new Map,this._inJobs=new Map,this._invokeQueue=new f((e=>this._onInvokeMessage(e))),this._client=s.client,this._onMessage=this._onMessage.bind(this),this._channel=s.channel,this._schedule=s.schedule,this._port.addEventListener("message",this._onMessage),this._port.start()}static connect(e){const s=new MessageChannel;let t;t="function"==typeof e?new e:"default"in e&&"function"==typeof e.default?new e.default:e;const o=new M(s.port1,{channel:s,client:t});return"object"==typeof t&&"remoteClient"in t&&(t.remoteClient=o),M.clients.set(o,t),s.port2}static loadWorker(e){const s=m[e];return s?s():Promise.resolve(null)}close(){this._post({type:g}),this._close()}isBusy(){return this._outJobs.size>0}invoke(e,t,o){const n=o&&o.signal,a=o&&o.transferList;if(!this._port)return Promise.reject(new s("worker:port-closed",`Cannot call invoke('${e}'), port is closed`,{methodName:e,data:t}));const c=l();return new Promise(((s,o)=>{const l=r(n,(()=>{var e;const s=this._outJobs.get(c);s&&(this._outJobs.delete(c),null==(e=s.abortHandle)||e.remove(),this._post({type:b,jobId:c}),o(i()))})),p={resolve:s,reject:o,abortHandle:l,debugInfo:e};this._outJobs.set(c,p),this._post({type:k,jobId:c,methodName:e,abortable:null!=n},t,a)}))}on(e,s){const t=new MessageChannel;function o(e){s(e.data)}return this._port.postMessage({type:c.ON,eventType:e,port:t.port2},[t.port2]),t.port1.addEventListener("message",o),t.port1.start(),{remove(){t.port1.postMessage({type:c.CLOSE}),t.port1.close(),t.port1.removeEventListener("message",o)}}}openPort(){const e=new MessageChannel;return this._post({type:y,port:e.port2}),e.port1}_close(){this._channel&&(this._channel=null),this._port.removeEventListener("message",this._onMessage),this._port.close(),this._outJobs.forEach((e=>{var s;null==(s=e.abortHandle)||s.remove(),e.reject(i(`Worker closing, aborting job calling '${e.debugInfo}'`))})),this._inJobs.clear(),this._outJobs.clear(),this._invokeQueue.clear(),this._port=this._client=this._schedule=null}_onMessage(e){o(this._schedule)?this._schedule((()=>this._processMessage(e))):this._processMessage(e)}_processMessage(e){const s=p(e);if(s)switch(s.type){case v:this._onResponseMessage(s);break;case k:this._invokeQueue.push(s);break;case b:this._onAbortMessage(s);break;case g:this._onCloseMessage();break;case y:this._onOpenPortMessage(s);break;case j:this._onOnMessage(s)}}_onAbortMessage(e){const s=this._inJobs,t=e.jobId,o=s.get(t);this._invokeQueue.push(e),o&&(o.controller&&o.controller.abort(),s.delete(t))}_onCloseMessage(){const e=this._client;this._close(),e&&"destroy"in e&&M.clients.get(this)===e&&e.destroy(),M.clients.delete(this),e&&e.remoteClient&&(e.remoteClient=null)}_onInvokeMessage(e){const{methodName:s,jobId:t,data:o,abortable:r}=e,i=r?new AbortController:null,l=this._inJobs;let c,p=this._client,u=p[s];try{if(!u&&s&&-1!==s.indexOf(".")){const e=s.split(".");for(let s=0;s<e.length-1;s++)p=p[e[s]],u=p[e[s+1]]}if("function"!=typeof u)throw new TypeError(`${s} is not a function`);c=u.call(p,o,{client:this,signal:i?i.signal:null})}catch(_){return void this._post({type:v,jobId:t,error:h(_)})}n(c)?(l.set(t,{controller:i,promise:c}),c.then((e=>{l.has(t)&&(l.delete(t),this._post({type:v,jobId:t},e))}),(e=>{l.has(t)&&(l.delete(t),a(e)||this._post({type:v,jobId:t,error:h(e||{message:`Error encountered at method ${s}`})}))}))):this._post({type:v,jobId:t},c)}_onOpenPortMessage(e){new M(e.port,{client:this._client})}_onOnMessage(e){const{port:s}=e,o=this._client.on(e.eventType,(e=>{s.postMessage(e)})),r=t(e.port,"message",(e=>{p(e).type===c.CLOSE&&(r.remove(),o.remove(),s.close())}))}_onResponseMessage(e){var t;const{jobId:o,error:r,data:i}=e,n=this._outJobs;if(!n.has(o))return;const a=n.get(o);n.delete(o),null==(t=a.abortHandle)||t.remove(),r?a.reject(s.fromJSON(JSON.parse(r))):a.resolve(i)}_post(e,s,t){return u(this._port,e,s,t)}}M.kernelInfo={revision:_,version:e,buildDate:d},M.clients=new Map;export{M 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.22/esri/copyright.txt for details.
4
4
  */
5
- import{workerMessages as e}from"../../kernel.js";import t from"../Error.js";import o from"../Logger.js";import{onAbortOrThrow as s,createAbortController as r,isPromiseLike as n,isAbortError as a}from"../promiseUtils.js";import{newJobId as i,receiveMessage as l,toInvokeError as d,postMessage as h,MessageType as c}from"./utils.js";import{createWorker as p}from"./workerFactory.js";const b=o.getLogger("esri.core.workers"),{ABORT:m,INVOKE:_,OPEN:u,OPENED:g,RESPONSE:j}=c;class f{constructor(e,t){this._outJobs=new Map,this._inJobs=new Map,this.worker=e,this.id=t,e.addEventListener("message",this._onMessage.bind(this)),e.addEventListener("error",(e=>{e.preventDefault(),b.error(e)}))}static async create(e){const t=await p();return new f(t,e)}terminate(){this.worker.terminate()}async open(e,t={}){const{signal:o}=t,r=i();return new Promise(((t,n)=>{const a={resolve:t,reject:n,abortHandle:s(o,(()=>{this._outJobs.delete(r),this._post({type:m,jobId:r})}))};this._outJobs.set(r,a),this._post({type:u,jobId:r,modulePath:e})}))}_onMessage(e){const t=l(e);if(t)switch(t.type){case g:this._onOpenedMessage(t);break;case j:this._onResponseMessage(t);break;case m:this._onAbortMessage(t);break;case _:this._onInvokeMessage(t)}}_onAbortMessage(e){const t=this._inJobs,o=e.jobId,s=t.get(o);s&&(s.controller&&s.controller.abort(),t.delete(o))}_onInvokeMessage(t){const{methodName:o,jobId:s,data:i,abortable:l}=t,h=l?r():null,c=this._inJobs,p=e[o];let b;try{if("function"!=typeof p)throw new TypeError(`${o} is not a function`);b=p.call(null,i,{signal:h?h.signal:null})}catch(m){return void this._post({type:j,jobId:s,error:d(m)})}n(b)?(c.set(s,{controller:h,promise:b}),b.then((e=>{c.has(s)&&(c.delete(s),this._post({type:j,jobId:s},e))}),(e=>{c.has(s)&&(c.delete(s),e||(e={message:"Error encountered at method"+o}),a(e)||this._post({type:j,jobId:s,error:d(e||{message:`Error encountered at method ${o}`})}))}))):this._post({type:j,jobId:s},b)}_onOpenedMessage(e){var t;const{jobId:o,data:s}=e,r=this._outJobs.get(o);r&&(this._outJobs.delete(o),null==(t=r.abortHandle)||t.remove(),r.resolve(s))}_onResponseMessage(e){var o;const{jobId:s,error:r,data:n}=e,a=this._outJobs.get(s);a&&(this._outJobs.delete(s),null==(o=a.abortHandle)||o.remove(),r?a.reject(t.fromJSON(JSON.parse(r))):a.resolve(n))}_post(e,t,o){return h(this.worker,e,t,o)}}export{f as default};
5
+ import{workerMessages as e}from"../../kernel.js";import t from"../Error.js";import o from"../Logger.js";import{onAbortOrThrow as s,isPromiseLike as r,isAbortError as n}from"../promiseUtils.js";import{newJobId as a,receiveMessage as i,toInvokeError as l,postMessage as d,MessageType as h}from"./utils.js";import{createWorker as c}from"./workerFactory.js";const p=o.getLogger("esri.core.workers"),{ABORT:b,INVOKE:m,OPEN:_,OPENED:u,RESPONSE:g}=h;class j{constructor(e,t){this._outJobs=new Map,this._inJobs=new Map,this.worker=e,this.id=t,e.addEventListener("message",this._onMessage.bind(this)),e.addEventListener("error",(e=>{e.preventDefault(),p.error(e)}))}static async create(e){const t=await c();return new j(t,e)}terminate(){this.worker.terminate()}async open(e,t={}){const{signal:o}=t,r=a();return new Promise(((t,n)=>{const a={resolve:t,reject:n,abortHandle:s(o,(()=>{this._outJobs.delete(r),this._post({type:b,jobId:r})}))};this._outJobs.set(r,a),this._post({type:_,jobId:r,modulePath:e})}))}_onMessage(e){const t=i(e);if(t)switch(t.type){case u:this._onOpenedMessage(t);break;case g:this._onResponseMessage(t);break;case b:this._onAbortMessage(t);break;case m:this._onInvokeMessage(t)}}_onAbortMessage(e){const t=this._inJobs,o=e.jobId,s=t.get(o);s&&(s.controller&&s.controller.abort(),t.delete(o))}_onInvokeMessage(t){const{methodName:o,jobId:s,data:a,abortable:i}=t,d=i?new AbortController:null,h=this._inJobs,c=e[o];let p;try{if("function"!=typeof c)throw new TypeError(`${o} is not a function`);p=c.call(null,a,{signal:d?d.signal:null})}catch(b){return void this._post({type:g,jobId:s,error:l(b)})}r(p)?(h.set(s,{controller:d,promise:p}),p.then((e=>{h.has(s)&&(h.delete(s),this._post({type:g,jobId:s},e))}),(e=>{h.has(s)&&(h.delete(s),e||(e={message:"Error encountered at method"+o}),n(e)||this._post({type:g,jobId:s,error:l(e||{message:`Error encountered at method ${o}`})}))}))):this._post({type:g,jobId:s},p)}_onOpenedMessage(e){var t;const{jobId:o,data:s}=e,r=this._outJobs.get(o);r&&(this._outJobs.delete(o),null==(t=r.abortHandle)||t.remove(),r.resolve(s))}_onResponseMessage(e){var o;const{jobId:s,error:r,data:n}=e,a=this._outJobs.get(s);a&&(this._outJobs.delete(s),null==(o=a.abortHandle)||o.remove(),r?a.reject(t.fromJSON(JSON.parse(r))):a.resolve(n))}_post(e,t,o){return d(this.worker,e,t,o)}}export{j as default};
@@ -2,7 +2,7 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.22/esri/copyright.txt for details.
4
4
  */
5
- import t from"../Error.js";import r from"../has.js";import{throwIfAborted as e,createAbortController as o}from"../promiseUtils.js";import n from"./Connection.js";export{default as Connection}from"./Connection.js";import i from"./RemoteClient.js";export{default as RemoteClient}from"./RemoteClient.js";import s from"./WorkerOwner.js";let a=r("esri-workers-debug")?1:r("host-browser")?navigator.hardwareConcurrency-1:0;a||(a=r("safari")&&r("mac")||r("trident")?7:2);let l=0;const c=[];function m(){g()}function f(t,r){return u(t,{client:r})}async function u(t,r){const e=new n;return await e.open(t,r),e}async function p(o,n={}){if("string"!=typeof o)throw new t("workers:undefined-module","modulePath is missing");let s=n.strategy||"distributed";if(r("host-webworker")&&!r("esri-workers")&&(s="local"),"local"===s){let t=await i.loadWorker(o);t||(t=await import(
5
+ import t from"../Error.js";import r from"../has.js";import{throwIfAborted as e}from"../promiseUtils.js";import o from"./Connection.js";export{default as Connection}from"./Connection.js";import n from"./RemoteClient.js";export{default as RemoteClient}from"./RemoteClient.js";import i from"./WorkerOwner.js";let s=r("esri-workers-debug")?1:r("host-browser")?navigator.hardwareConcurrency-1:0;s||(s=r("safari")&&r("mac")||r("trident")?7:2);let a=0;const l=[];function c(){h()}function m(t,r){return f(t,{client:r})}async function f(t,r){const e=new o;return await e.open(t,r),e}async function u(o,i={}){if("string"!=typeof o)throw new t("workers:undefined-module","modulePath is missing");let c=i.strategy||"distributed";if(r("host-webworker")&&!r("esri-workers")&&(c="local"),"local"===c){let t=await n.loadWorker(o);t||(t=await import(
6
6
  /* @vite-ignore */
7
7
  /* webpackIgnore: true */
8
- o)),e(n.signal);const r=n.client||t;return u([i.connect(t)],{...n,client:r})}if(await g(),e(n.signal),"dedicated"===s){const t=l++%a;return u([await c[t].open(o,n)],n)}if(n.maxNumWorkers&&n.maxNumWorkers>0){const t=Math.min(n.maxNumWorkers,a);if(t<a){const r=new Array(t);for(let e=0;e<t;++e){const t=l++%a;r[e]=c[t].open(o,n)}return u(r,n)}}return u(c.map((t=>t.open(o,n))),n)}function w(){h&&(d.abort(),h=null);for(let t=0;t<c.length;t++)c[t]&&c[t].terminate();c.length=0}let d,h=null;async function g(){if(h)return h;d=o();const t=[];for(let r=0;r<a;r++){const e=s.create(r).then((t=>(c[r]=t,t)));t.push(e)}return h=Promise.all(t),h}export{m as initialize,p as open,f as openWithPorts,w as terminate};
8
+ o)),e(i.signal);const r=i.client||t;return f([n.connect(t)],{...i,client:r})}if(await h(),e(i.signal),"dedicated"===c){const t=a++%s;return f([await l[t].open(o,i)],i)}if(i.maxNumWorkers&&i.maxNumWorkers>0){const t=Math.min(i.maxNumWorkers,s);if(t<s){const r=new Array(t);for(let e=0;e<t;++e){const t=a++%s;r[e]=l[t].open(o,i)}return f(r,i)}}return f(l.map((t=>t.open(o,i))),i)}function p(){d&&(w.abort(),d=null);for(let t=0;t<l.length;t++)l[t]&&l[t].terminate();l.length=0}let w,d=null;async function h(){if(d)return d;w=new AbortController;const t=[];for(let r=0;r<s;r++){const e=i.create(r).then((t=>(l[r]=t,t)));t.push(e)}return d=Promise.all(t),d}export{c as initialize,u as open,m as openWithPorts,p as terminate};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.22/esri/copyright.txt for details.
4
4
  */
5
- import n from"../core/Error.js";import{clamp as e,deg2rad as t,rad2deg as r,asinClamped as l}from"../core/mathUtils.js";import{isNone as u,unwrap as o,isSome as a}from"../core/maybe.js";import{throwIfAborted as s}from"../core/promiseUtils.js";import{getMetersPerUnitForSR as i}from"../core/unitUtils.js";import{i as c,t as f,a as p}from"../chunks/mat4.js";import{g as h,b as m,f as d,n as M,l as R}from"../chunks/vec3.js";import{c as j}from"../chunks/vec3f64.js";import w from"./Extent.js";import y from"./Multipoint.js";import{p as g,i as E,l as I}from"../chunks/pe.js";import P from"./Point.js";import x from"./Polygon.js";import T from"./Polyline.js";import{SphericalECEFSpatialReference as C,WGS84ECEFSpatialReference as F,SphericalPCPFMars as S,SphericalPCPFMoon as b}from"./projectionEllipsoid.js";import{copy as k}from"./support/aaBoundingRect.js";import{earth as v,moon as q,mars as z}from"./support/Ellipsoid.js";import{earthEllipsoidConstants as A}from"./support/geodesicConstants.js";import U from"./support/GeographicTransformation.js";import{equals as G,isValid as W,isWGS84 as Z,isWebMercator as _,isPlateCarree as B,isMars as K,isMoon as L}from"./support/spatialReferenceUtils.js";let N=null,V=null,X=null,D={};function H(){return!!N&&E()}function J(){return!0}function O(n){return u(X)&&(X=Promise.all([I(),import("../chunks/geometryEngineBase.js").then((n=>n.g)),import("./geometryAdapters/hydrated.js")])),X.then((([,e,{hydratedAdapter:t}])=>{s(n),V=t,N=e.default,N._enableProjection(g)}))}function Q(n,e,t=null){return Array.isArray(n)?0===n.length?[]:Y(V,n,n[0].spatialReference,e,t):Y(V,[n],n.spatialReference,e,t)[0]}function Y(n,e,t,r,l=null){if(u(t)||u(r))return e;if(rn(t,r,l))return e.map((n=>o(on(n,t,r))));if(u(l)){const n=U.cacheKey(t,r);void 0!==D[n]?l=D[n]:(l=$(t,r,null),u(l)&&(l=new U),D[n]=l)}if(u(N))throw new en;return N._project(n,e,t,r,l)}function $(n,e,t=null){if(u(N))throw new en;if(u(n)||u(e))return null;const r=N._getTransformation(V,n,e,t,null==t?void 0:t.spatialReference);return null!==r?U.fromGE(r):null}function nn(n,e,t=null){if(u(N))throw new en;const r=N._getTransformationBySuitability(V,n,e,t,null==t?void 0:t.spatialReference);if(null!==r){const n=[];for(const e of r)n.push(U.fromGE(e));return n}return[]}class en extends n{constructor(){super("projection:not-loaded","projection engine not fully loaded yet, please call load()")}}function tn(){N=null,V=null,X=null,D={}}function rn(n,e,t){return!t&&(!!G(n,e)||W(n)&&W(e)&&!!je(n,e,Ie))}async function ln(n,e,t,r){if(!H())if(Array.isArray(n)){for(const{source:l,dest:u,geographicTransformation:o}of n)if(!rn(l,u,o))return O(r)}else if(!rn(n,e,t))return O(r)}function un(n,e){switch(je(n,e,Ie)){case Wn:return"copy3";case ue:return"wgs84ToSphericalECEF";case Ln:return"wgs84ToWebMercator";case Xn:return"wgs84ToPlateCarree";case he:return"wgs84ToWGS84ECEF";case Zn:return"webMercatorToWGS84";case _n:return"webMercatorToSphericalECEF";case Bn:return"webMercatorToWGS84ECEF";case Hn:return"webMercatorToPlateCarree";case me:return"wgs84ECEFToWGS84";case de:return"wgs84ECEFToSphericalECEF";case Me:return"wgs84ECEFToWebMercator";case ie:return"sphericalECEFToWGS84";case ce:return"sphericalECEFToWebMercator";case se:return"sphericalMarsPCPFToMars2000";case ae:return"sphericalMoonPCPFToMoon2000";case fe:return"sphericalECEFToWGS84ECEF";case le:return"mars2000ToSphericalPCPF";case re:return"moon2000ToSphericalPCPF";default:return null}}function on(n,e,t){return n?"x"in n?sn(n,e,new P,t,0):"xmin"in n?Rn(n,e,new w,t,0):"rings"in n?dn(n,e,new x,t,0):"paths"in n?hn(n,e,new T,t,0):"points"in n?fn(n,e,new y,t,0):null:null}function an(n,e,t=e.spatialReference,r=0){return!u(t)&&a(sn(n,n.spatialReference,e,t,r))}function sn(n,e,t,r,l){be[0]=n.x,be[1]=n.y;const u=n.z;return be[2]=void 0!==u?u:l,Tn(be,e,0,be,r,0,1)?(t.x=be[0],t.y=be[1],t.spatialReference=r,void 0===u?(t.z=void 0,t.hasZ=!1):(t.z=be[2],t.hasZ=!0),void 0===n.m?(t.m=void 0,t.hasM=!1):(t.m=n.m,t.hasM=!0),t):null}function cn(n,e,t=e.spatialReference,r=0){return!u(t)&&a(fn(n,n.spatialReference,e,t,r))}function fn(n,e,t,r,l){const{points:u,hasZ:o,hasM:a}=n,s=[],i=u.length,c=[];for(const f of u)c.push(f[0],f[1],o?f[2]:l);if(!Tn(c,e,0,c,r,0,i))return null;for(let f=0;f<i;++f){const n=3*f,e=c[n],t=c[n+1];o&&a?s.push([e,t,c[n+2],u[f][3]]):o?s.push([e,t,c[n+2]]):a?s.push([e,t,u[f][2]]):s.push([e,t])}return t.points=s,t.spatialReference=r,t.hasZ=o,t.hasM=a,t}function pn(n,e,t=e.spatialReference,r=0){return a(t)&&a(hn(n,n.spatialReference,e,t,r))}function hn(n,e,t,r,l){const{paths:u,hasZ:o,hasM:a}=n,s=[];return Fn(u,o,a,e,s,r,l)?(t.paths=s,t.spatialReference=r,t.hasZ=o,t.hasM=a,t):null}function mn(n,e,t=e.spatialReference,r=0){return a(t)&&a(dn(n,n.spatialReference,e,t,r))}function dn(n,e,t,r,l){const{rings:u,hasZ:o,hasM:a}=n,s=[];return Fn(u,o,a,e,s,r,l)?(t.rings=s,t.spatialReference=r,t.hasZ=o,t.hasM=a,t):null}function Mn(n,e,t=e.spatialReference,r=0){return a(t)&&a(Rn(n,n.spatialReference,e,t,r))}function Rn(n,e,t,r,l){const{xmin:u,ymin:o,xmax:a,ymax:s,hasZ:i,hasM:c}=n;if(!gn(u,o,i?n.zmin:l,e,be,r))return null;t.xmin=be[0],t.ymin=be[1],i&&(t.zmin=be[2]);return gn(a,s,i?n.zmax:l,e,be,r)?(t.xmax=be[0],t.ymax=be[1],i&&(t.zmax=be[2]),c&&(t.mmin=n.mmin,t.mmax=n.mmax),t.spatialReference=r,t):null}function jn(n,e,t){if(u(e)||u(t))return null;const r=new P({spatialReference:t});return Tn(n,e,0,be,t,0,1)?(r.x=be[0],r.y=be[1],r.z=be[2],r):null}function wn(n,e,t){return Tn(n,e,0,be,t.spatialReference,0,1)?(t.x=be[0],t.y=be[1],t.z=be[2],t):null}function yn(n,e,t,r=0){be[0]=n.x,be[1]=n.y;const l=n.z;return be[2]=void 0!==l?l:r,Tn(be,n.spatialReference,0,e,t,0,1)}function gn(n,e,t,r,l,u){return Ce[0]=n,Ce[1]=e,Ce[2]=t,Tn(Ce,r,0,l,u,0,1)}function En(n,e,t,r){return!(u(e)||u(r)||n.length<2)&&(2===n.length&&(Ce[0]=n[0],Ce[1]=n[1],Ce[2]=0,n=Ce),Tn(n,e,0,t,r,0,1))}function In(n,e){be[0]=n.x,be[1]=n.y;const t=n.z;return be[2]=void 0!==t?t:0,Pn(be,n.spatialReference,e)}function Pn(n,e,t){return xn(n,e,t)}function xn(n,e,t){if(u(e))return!1;const r=Gn(e,ge),l=Re[r][6];return!u(l)&&(l(n,0,Ce,0),t!==Ce&&(t[0]=Ce[0],t[1]=Ce[1],t.length>2&&(t[2]=Ce[2])),!0)}function Tn(n,e,t,r,l,o,a=1){const s=je(e,l,Ie);if(u(s))return!1;if(s===Wn){if(n===r&&t===o)return!0;const e=t+3*a;for(let l=t,u=o;l<e;l++,u++)r[u]=n[l];return!0}const i=t+3*a;for(let u=t,c=o;u<i;u+=3,c+=3)s(n,u,r,c);return!0}function Cn(n,e,t,r,l){h(be,n),m(ke,n,e),En(be,t,be,l),En(ke,t,ke,l),d(r,ke,be),M(r,r)}function Fn(n,e,t,r,l,u,o=0){const a=new Array;for(const i of n)for(const n of i)a.push(n[0],n[1],e?n[2]:o);if(!Tn(a,r,0,a,u,0,a.length/3))return!1;let s=0;l.length=0;for(const i of n){const n=new Array;for(const r of i)e&&t?n.push([a[s++],a[s++],a[s++],r[3]]):e?n.push([a[s++],a[s++],a[s++]]):t?(n.push([a[s++],a[s++],r[2]]),s++):(n.push([a[s++],a[s++]]),s++);l.push(n)}return!0}function Sn(n,e,t,r){if(u(e)||u(r))return!1;const l=we(e,r,Pe);if(l.projector===Wn)return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],!0;if(u(l.projector))return!1;const{source:o,dest:s}=l;if(3===s.spatialReferenceId){const e=Re[o.spatialReferenceId][2];return!u(e)&&(e(n,0,Fe,0),Ln(Fe,0,t,0),t[3]=bn(Fe[1],n[2],n[3],v.radius),!0)}if(2!==o.spatialReferenceId&&5!==o.spatialReferenceId||12!==s.spatialReferenceId)l.projector(n,0,t,0),t[3]=n[3]*o.metersPerUnit/s.metersPerUnit;else{const e=Re[o.spatialReferenceId][1],r=Re[1][12];let u=n[3];a(e)&&a(r)&&(u=bn(n[1],n[2],n[3],v.radius)),l.projector(n,0,t,0),t[3]=u}return!0}function bn(n,e,t,r){const l=Math.abs(xe*n)+Math.asin(t/(r+e));return l>=Math.PI/2?Number.MAX_VALUE:t/Math.cos(l)}function kn(n,e,t,r){return null!=n&&(G(e,r)?(k(t,n),!0):(Ce[0]=n[0],Ce[1]=n[1],Ce[2]=0,!!Tn(Ce,e,0,Ce,r,0,1)&&(t[0]=Ce[0],t[1]=Ce[1],Ce[0]=n[2],Ce[1]=n[3],Ce[2]=0,!!Tn(Ce,e,0,Ce,r,0,1)&&(t[2]=Ce[0],t[3]=Ce[1],!0))))}function vn(n,e,t,r){if(u(e)||u(r))return!1;const l=Gn(e,ge),o=Gn(r,Ee);if(l===o&&0!==l||G(e,r))return t[0]=1,t[1]=1,t[2]=1,!0;if(1===l){const e=R(n),r=e/Math.sqrt(n[0]*n[0]+n[1]*n[1]),l=e/v.radius;if(3===o)return t[0]=r*l,t[1]=r*l,t[2]=1,!0;if(2===o||5===o){const n=180/(v.radius*Math.PI);return t[0]=n*r*l,t[1]=n*l,t[2]=1,!0}}else if(12===l&&(2===o||5===o))return t[0]=Vn,t[1]=Vn,t[2]=1,!0;return!1}function qn(n,e,t,r){if(u(n)||u(r))return!1;const l=Gn(n,ge),o=Gn(r,Ee);if(l===o&&!zn(o)&&(0!==l||G(n,r)))return c(t),f(t,t,e),!0;if(zn(o)){const n=Re[l][11],r=Re[11][o];return!u(n)&&!u(r)&&(n(e,0,Fe,0),r(Fe,0,Se,0),An(xe*Fe[0],xe*Fe[1],t),t[12]=Se[0],t[13]=Se[1],t[14]=Se[2],!0)}if(!(3!==o&&12!==o||2!==l&&1!==l&&3!==l)){const n=Re[l][11],r=Re[11][o];return!u(n)&&!u(r)&&(n(e,0,Fe,0),r(Fe,0,Se,0),1===l?Un(xe*Fe[0],xe*Fe[1],t):c(t),t[12]=Se[0],t[13]=Se[1],t[14]=Se[2],!0)}return!1}function zn(n){return 1===n||7===n||9===n}function An(n,e,t){const r=Math.sin(n),l=Math.cos(n),u=Math.sin(e),o=Math.cos(e),a=t;return a[0]=-r,a[4]=-u*l,a[8]=o*l,a[12]=0,a[1]=l,a[5]=-u*r,a[9]=o*r,a[13]=0,a[2]=0,a[6]=o,a[10]=u,a[14]=0,a[3]=0,a[7]=0,a[11]=0,a[15]=1,a}function Un(n,e,t){return An(n,e,t),p(t,t),t}function Gn(n,e){return e.spatialReference===n?e.spatialReferenceId:(e.spatialReference=n,"metersPerUnit"in e&&(e.metersPerUnit=i(n,1)),n.wkt===C.wkt?e.spatialReferenceId=1:Z(n)?e.spatialReferenceId=2:_(n)?e.spatialReferenceId=3:B(n)?e.spatialReferenceId=12:n.wkt===F.wkt?e.spatialReferenceId=4:4490===n.wkid?e.spatialReferenceId=5:n.wkt===S.wkt?e.spatialReferenceId=7:n.wkt===b.wkt?e.spatialReferenceId=9:K(n)?e.spatialReferenceId=8:L(n)?e.spatialReferenceId=10:e.spatialReferenceId=0)}function Wn(n,e,t,r){n!==t&&(t[r++]=n[e++],t[r++]=n[e++],t[r]=n[e])}function Zn(n,e,t,r){t[r++]=Te*(n[e++]/v.radius),t[r++]=Te*(Math.PI/2-2*Math.atan(Math.exp(-n[e++]/v.radius))),t[r]=n[e]}function _n(n,e,t,r){Zn(n,e,t,r),ue(t,r,t,r)}function Bn(n,e,t,r){Zn(n,e,t,r),he(t,r,t,r)}function Kn(n,t,r,l,u){const o=.4999999*Math.PI,a=e(xe*n[t+1],-o,o),s=Math.sin(a);r[l++]=xe*n[t]*u.radius,r[l++]=u.halfSemiMajorAxis*Math.log((1+s)/(1-s)),r[l]=n[t+2]}function Ln(n,e,t,r){Kn(n,e,t,r,v)}const Nn=v.radius*Math.PI/180,Vn=180/(v.radius*Math.PI);function Xn(n,e,t,r){t[r]=n[e]*Nn,t[r+1]=n[e+1]*Nn,t[r+2]=n[e+2]}function Dn(n,e,t,r){t[r]=n[e]*Vn,t[r+1]=n[e+1]*Vn,t[r+2]=n[e+2]}function Hn(n,e,t,r){Zn(n,e,t,r),Xn(t,r,t,r)}function Jn(n,e,t,r){me(n,e,t,r),Xn(t,r,t,r)}function On(n,e,t,r){ie(n,e,t,r),Xn(t,r,t,r)}function Qn(n,e,t,r){Dn(n,e,t,r),ue(t,r,t,r)}function Yn(n,e,t,r){Dn(n,e,t,r),Ln(t,r,t,r)}function $n(n,e,t,r){Dn(n,e,t,r),he(t,r,t,r)}function ne(n){if(u(n))return!1;const e=Gn(n,ge);return!!Re[e][6]}function ee(n,e,t,r,l=0){const u=r+l,o=Math.cos(t);n[0]=Math.cos(e)*o*u,n[1]=Math.sin(e)*o*u,n[2]=Math.sin(t)*u}function te(n,e,t,r,l){const u=l+n[e+2],o=xe*n[e+1],a=xe*n[e],s=Math.cos(o);t[r++]=Math.cos(a)*s*u,t[r++]=Math.sin(a)*s*u,t[r]=Math.sin(o)*u}function re(n,e,t,r){te(n,e,t,r,q.radius)}function le(n,e,t,r){te(n,e,t,r,z.radius)}function ue(n,e,t,r){te(n,e,t,r,v.radius)}function oe(n,e,t,r,u){const o=n[e],a=n[e+1],s=n[e+2],i=Math.sqrt(o*o+a*a+s*s),c=l(s/(0===i?1:i)),f=Math.atan2(a,o);t[r++]=Te*f,t[r++]=Te*c,t[r]=i-u}function ae(n,e,t,r){oe(n,e,t,r,q.radius)}function se(n,e,t,r){oe(n,e,t,r,z.radius)}function ie(n,e,t,r){oe(n,e,t,r,v.radius)}function ce(n,e,t,r){ie(n,e,t,r),Ln(t,r,t,r)}function fe(n,e,t,r){ie(n,e,t,r),he(t,r,t,r)}function pe(n,e,t,r,l){const u=xe*n[e],o=xe*n[e+1],a=n[e+2],s=Math.sin(o),i=Math.cos(o),c=l.radius/Math.sqrt(1-l.eccentricitySquared*s*s);t[r++]=(c+a)*i*Math.cos(u),t[r++]=(c+a)*i*Math.sin(u),t[r++]=(c*(1-l.eccentricitySquared)+a)*s}function he(n,e,t,r){pe(n,e,t,r,v)}function me(n,e,t,r){const l=A,u=n[e],o=n[e+1],a=n[e+2];let s,i,c,f,p,h,m,d,M,R,j,w,y,g,E,I,P,x,T,C,F;s=Math.abs(a),i=u*u+o*o,c=Math.sqrt(i),f=i+a*a,p=Math.sqrt(f),C=Math.atan2(o,u),h=a*a/f,m=i/f,g=l.a2/p,E=l.a3-l.a4/p,m>.3?(d=s/p*(1+m*(l.a1+g+h*E)/p),T=Math.asin(d),R=d*d,M=Math.sqrt(1-R)):(M=c/p*(1-h*(l.a5-g-m*E)/p),T=Math.acos(M),R=1-M*M,d=Math.sqrt(R)),j=1-v.eccentricitySquared*R,w=v.radius/Math.sqrt(j),y=l.a6*w,g=c-w*M,E=s-y*d,P=M*g+d*E,I=M*E-d*g,x=I/(y/j+P),T+=x,F=P+I*x/2,a<0&&(T=-T),t[r++]=Te*C,t[r++]=Te*T,t[r]=F}function de(n,e,t,r){me(n,e,t,r),ue(t,r,t,r)}function Me(n,e,t,r){me(n,e,t,r),Ln(t,r,t,r)}const Re={2:{5:null,8:null,10:null,11:Wn,6:Wn,1:ue,7:null,9:null,0:null,3:Ln,12:Xn,2:Wn,4:he},5:{5:Wn,8:null,10:null,11:Wn,6:Wn,1:ue,7:null,9:null,0:null,3:null,12:Xn,2:null,4:he},8:{5:null,8:Wn,10:null,11:Wn,6:null,1:null,7:le,9:null,0:null,3:null,12:null,2:null,4:null},10:{5:null,8:null,10:Wn,11:Wn,6:null,1:null,7:null,9:re,0:null,3:null,12:null,2:null,4:null},3:{5:null,8:null,10:null,11:Zn,6:Zn,1:_n,7:null,9:null,0:null,3:Wn,12:Hn,2:Zn,4:Bn},4:{5:me,8:null,10:null,11:me,6:me,1:de,7:null,9:null,0:null,3:Me,12:Jn,2:me,4:Wn},1:{5:ie,8:null,10:null,11:ie,6:ie,1:Wn,7:null,9:null,0:null,3:ce,12:On,2:ie,4:fe},7:{5:null,8:se,10:null,11:se,6:null,1:null,7:Wn,9:null,0:null,3:null,12:null,2:null,4:null},9:{5:null,8:null,10:ae,11:ae,6:null,1:null,7:null,9:Wn,0:null,3:null,12:null,2:null,4:null},0:{5:null,8:null,10:null,11:null,6:null,1:null,7:null,9:null,0:Wn,3:null,12:null,2:null,4:null},11:{5:Wn,8:Wn,10:Wn,11:Wn,6:Wn,1:ue,7:le,9:re,0:null,3:Ln,12:Xn,2:Wn,4:he},6:{5:null,8:null,10:null,11:Wn,6:Wn,1:ue,7:null,9:null,0:null,3:null,12:Xn,2:Wn,4:he},12:{5:Dn,8:null,10:null,11:Dn,6:Dn,1:Qn,7:null,9:null,0:null,3:Yn,12:Wn,2:Dn,4:$n}};function je(n,e,t=ye()){return u(n)||u(e)?null:we(n,e,t).projector}function we(n,e,t){if(u(n)||u(e)||t.source.spatialReference===n&&t.dest.spatialReference===e)return t;const r=Gn(n,t.source),l=Gn(e,t.dest);return 0===r&&0===l?G(n,e)?t.projector=Wn:t.projector=null:t.projector=Re[r][l],t}function ye(){return{source:{spatialReference:null,spatialReferenceId:0,metersPerUnit:1},dest:{spatialReference:null,spatialReferenceId:0,metersPerUnit:1},projector:Wn}}const ge={spatialReference:null,spatialReferenceId:0},Ee={spatialReference:null,spatialReferenceId:0},Ie=ye(),Pe=ye(),xe=t(1),Te=r(1),Ce=j(),Fe=j(),Se=j(),be=j(),ke=j();export{ne as canProjectToWGS84ComparableLonLat,rn as canProjectWithoutEngine,An as computeENUToSphericalPCPFLocalRotation,Un as computeSphericalPCPFToENULocalRotation,qn as computeTranslationToOriginAndRotation,un as getProjectorName,$ as getTransformation,nn as getTransformations,ln as initializeProjection,H as isLoaded,J as isSupported,O as load,vn as localLinearScaleFactors,ee as lonLatToSphericalPCPF,Kn as lonLatToWebMercatorComparable,Q as project,kn as projectBoundingRect,Sn as projectBoundingSphere,Tn as projectBuffer,Cn as projectDirection,Mn as projectExtent,Y as projectMany,cn as projectMultipoint,an as projectPoint,yn as projectPointToVector,In as projectPointToWGS84ComparableLonLat,mn as projectPolygon,pn as projectPolyline,wn as projectVectorToDehydratedPoint,jn as projectVectorToPoint,En as projectVectorToVector,Pn as projectVectorToWGS84ComparableLonLat,on as projectWithoutEngine,gn as projectXYZToVector,oe as sphericalPCPFtoLonLatElevation,tn as unload};
5
+ import n from"../core/Error.js";import{clamp as e,deg2rad as t,rad2deg as r,asinClamped as l}from"../core/mathUtils.js";import{isNone as u,unwrap as o,isSome as a}from"../core/maybe.js";import{throwIfAborted as s}from"../core/promiseUtils.js";import{getMetersPerUnitForSR as i}from"../core/unitUtils.js";import{i as c,t as f,a as p}from"../chunks/mat4.js";import{g as h,b as m,f as d,n as M,l as R}from"../chunks/vec3.js";import{c as j}from"../chunks/vec3f64.js";import w from"./Extent.js";import y from"./Multipoint.js";import{p as g,i as E,l as I}from"../chunks/pe.js";import P from"./Point.js";import x from"./Polygon.js";import T from"./Polyline.js";import{SphericalECEFSpatialReference as C,WGS84ECEFSpatialReference as F,SphericalPCPFMars as S,SphericalPCPFMoon as b}from"./projectionEllipsoid.js";import{copy as k}from"./support/aaBoundingRect.js";import{earth as v,moon as q,mars as z}from"./support/Ellipsoid.js";import{earthEllipsoidConstants as A}from"./support/geodesicConstants.js";import U from"./support/GeographicTransformation.js";import{equals as G,isValid as W,isWGS84 as Z,isWebMercator as _,isPlateCarree as B,isMars as K,isMoon as L}from"./support/spatialReferenceUtils.js";let N=null,V=null,X=null,D={};function H(){return!!N&&E()}function J(n){return u(X)&&(X=Promise.all([I(),import("../chunks/geometryEngineBase.js").then((n=>n.g)),import("./geometryAdapters/hydrated.js")])),X.then((([,e,{hydratedAdapter:t}])=>{s(n),V=t,N=e.default,N._enableProjection(g)}))}function O(n,e,t=null){return Array.isArray(n)?0===n.length?[]:Q(V,n,n[0].spatialReference,e,t):Q(V,[n],n.spatialReference,e,t)[0]}function Q(n,e,t,r,l=null){if(u(t)||u(r))return e;if(tn(t,r,l))return e.map((n=>o(un(n,t,r))));if(u(l)){const n=U.cacheKey(t,r);void 0!==D[n]?l=D[n]:(l=Y(t,r,null),u(l)&&(l=new U),D[n]=l)}if(u(N))throw new nn;return N._project(n,e,t,r,l)}function Y(n,e,t=null){if(u(N))throw new nn;if(u(n)||u(e))return null;const r=N._getTransformation(V,n,e,t,null==t?void 0:t.spatialReference);return null!==r?U.fromGE(r):null}function $(n,e,t=null){if(u(N))throw new nn;const r=N._getTransformationBySuitability(V,n,e,t,null==t?void 0:t.spatialReference);if(null!==r){const n=[];for(const e of r)n.push(U.fromGE(e));return n}return[]}class nn extends n{constructor(){super("projection:not-loaded","projection engine not fully loaded yet, please call load()")}}function en(){N=null,V=null,X=null,D={}}function tn(n,e,t){return!t&&(!!G(n,e)||W(n)&&W(e)&&!!Re(n,e,Ee))}async function rn(n,e,t,r){if(!H())if(Array.isArray(n)){for(const{source:l,dest:u,geographicTransformation:o}of n)if(!tn(l,u,o))return J(r)}else if(!tn(n,e,t))return J(r)}function ln(n,e){switch(Re(n,e,Ee)){case Gn:return"copy3";case le:return"wgs84ToSphericalECEF";case Kn:return"wgs84ToWebMercator";case Vn:return"wgs84ToPlateCarree";case pe:return"wgs84ToWGS84ECEF";case Wn:return"webMercatorToWGS84";case Zn:return"webMercatorToSphericalECEF";case _n:return"webMercatorToWGS84ECEF";case Dn:return"webMercatorToPlateCarree";case he:return"wgs84ECEFToWGS84";case me:return"wgs84ECEFToSphericalECEF";case de:return"wgs84ECEFToWebMercator";case se:return"sphericalECEFToWGS84";case ie:return"sphericalECEFToWebMercator";case ae:return"sphericalMarsPCPFToMars2000";case oe:return"sphericalMoonPCPFToMoon2000";case ce:return"sphericalECEFToWGS84ECEF";case re:return"mars2000ToSphericalPCPF";case te:return"moon2000ToSphericalPCPF";default:return null}}function un(n,e,t){return n?"x"in n?an(n,e,new P,t,0):"xmin"in n?Mn(n,e,new w,t,0):"rings"in n?mn(n,e,new x,t,0):"paths"in n?pn(n,e,new T,t,0):"points"in n?cn(n,e,new y,t,0):null:null}function on(n,e,t=e.spatialReference,r=0){return!u(t)&&a(an(n,n.spatialReference,e,t,r))}function an(n,e,t,r,l){Se[0]=n.x,Se[1]=n.y;const u=n.z;return Se[2]=void 0!==u?u:l,xn(Se,e,0,Se,r,0,1)?(t.x=Se[0],t.y=Se[1],t.spatialReference=r,void 0===u?(t.z=void 0,t.hasZ=!1):(t.z=Se[2],t.hasZ=!0),void 0===n.m?(t.m=void 0,t.hasM=!1):(t.m=n.m,t.hasM=!0),t):null}function sn(n,e,t=e.spatialReference,r=0){return!u(t)&&a(cn(n,n.spatialReference,e,t,r))}function cn(n,e,t,r,l){const{points:u,hasZ:o,hasM:a}=n,s=[],i=u.length,c=[];for(const f of u)c.push(f[0],f[1],o?f[2]:l);if(!xn(c,e,0,c,r,0,i))return null;for(let f=0;f<i;++f){const n=3*f,e=c[n],t=c[n+1];o&&a?s.push([e,t,c[n+2],u[f][3]]):o?s.push([e,t,c[n+2]]):a?s.push([e,t,u[f][2]]):s.push([e,t])}return t.points=s,t.spatialReference=r,t.hasZ=o,t.hasM=a,t}function fn(n,e,t=e.spatialReference,r=0){return a(t)&&a(pn(n,n.spatialReference,e,t,r))}function pn(n,e,t,r,l){const{paths:u,hasZ:o,hasM:a}=n,s=[];return Cn(u,o,a,e,s,r,l)?(t.paths=s,t.spatialReference=r,t.hasZ=o,t.hasM=a,t):null}function hn(n,e,t=e.spatialReference,r=0){return a(t)&&a(mn(n,n.spatialReference,e,t,r))}function mn(n,e,t,r,l){const{rings:u,hasZ:o,hasM:a}=n,s=[];return Cn(u,o,a,e,s,r,l)?(t.rings=s,t.spatialReference=r,t.hasZ=o,t.hasM=a,t):null}function dn(n,e,t=e.spatialReference,r=0){return a(t)&&a(Mn(n,n.spatialReference,e,t,r))}function Mn(n,e,t,r,l){const{xmin:u,ymin:o,xmax:a,ymax:s,hasZ:i,hasM:c}=n;if(!yn(u,o,i?n.zmin:l,e,Se,r))return null;t.xmin=Se[0],t.ymin=Se[1],i&&(t.zmin=Se[2]);return yn(a,s,i?n.zmax:l,e,Se,r)?(t.xmax=Se[0],t.ymax=Se[1],i&&(t.zmax=Se[2]),c&&(t.mmin=n.mmin,t.mmax=n.mmax),t.spatialReference=r,t):null}function Rn(n,e,t){if(u(e)||u(t))return null;const r=new P({spatialReference:t});return xn(n,e,0,Se,t,0,1)?(r.x=Se[0],r.y=Se[1],r.z=Se[2],r):null}function jn(n,e,t){return xn(n,e,0,Se,t.spatialReference,0,1)?(t.x=Se[0],t.y=Se[1],t.z=Se[2],t):null}function wn(n,e,t,r=0){Se[0]=n.x,Se[1]=n.y;const l=n.z;return Se[2]=void 0!==l?l:r,xn(Se,n.spatialReference,0,e,t,0,1)}function yn(n,e,t,r,l,u){return Te[0]=n,Te[1]=e,Te[2]=t,xn(Te,r,0,l,u,0,1)}function gn(n,e,t,r){return!(u(e)||u(r)||n.length<2)&&(2===n.length&&(Te[0]=n[0],Te[1]=n[1],Te[2]=0,n=Te),xn(n,e,0,t,r,0,1))}function En(n,e){Se[0]=n.x,Se[1]=n.y;const t=n.z;return Se[2]=void 0!==t?t:0,In(Se,n.spatialReference,e)}function In(n,e,t){return Pn(n,e,t)}function Pn(n,e,t){if(u(e))return!1;const r=Un(e,ye),l=Me[r][6];return!u(l)&&(l(n,0,Te,0),t!==Te&&(t[0]=Te[0],t[1]=Te[1],t.length>2&&(t[2]=Te[2])),!0)}function xn(n,e,t,r,l,o,a=1){const s=Re(e,l,Ee);if(u(s))return!1;if(s===Gn){if(n===r&&t===o)return!0;const e=t+3*a;for(let l=t,u=o;l<e;l++,u++)r[u]=n[l];return!0}const i=t+3*a;for(let u=t,c=o;u<i;u+=3,c+=3)s(n,u,r,c);return!0}function Tn(n,e,t,r,l){h(Se,n),m(be,n,e),gn(Se,t,Se,l),gn(be,t,be,l),d(r,be,Se),M(r,r)}function Cn(n,e,t,r,l,u,o=0){const a=new Array;for(const i of n)for(const n of i)a.push(n[0],n[1],e?n[2]:o);if(!xn(a,r,0,a,u,0,a.length/3))return!1;let s=0;l.length=0;for(const i of n){const n=new Array;for(const r of i)e&&t?n.push([a[s++],a[s++],a[s++],r[3]]):e?n.push([a[s++],a[s++],a[s++]]):t?(n.push([a[s++],a[s++],r[2]]),s++):(n.push([a[s++],a[s++]]),s++);l.push(n)}return!0}function Fn(n,e,t,r){if(u(e)||u(r))return!1;const l=je(e,r,Ie);if(l.projector===Gn)return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],!0;if(u(l.projector))return!1;const{source:o,dest:s}=l;if(3===s.spatialReferenceId){const e=Me[o.spatialReferenceId][2];return!u(e)&&(e(n,0,Ce,0),Kn(Ce,0,t,0),t[3]=Sn(Ce[1],n[2],n[3],v.radius),!0)}if(2!==o.spatialReferenceId&&5!==o.spatialReferenceId||12!==s.spatialReferenceId)l.projector(n,0,t,0),t[3]=n[3]*o.metersPerUnit/s.metersPerUnit;else{const e=Me[o.spatialReferenceId][1],r=Me[1][12];let u=n[3];a(e)&&a(r)&&(u=Sn(n[1],n[2],n[3],v.radius)),l.projector(n,0,t,0),t[3]=u}return!0}function Sn(n,e,t,r){const l=Math.abs(Pe*n)+Math.asin(t/(r+e));return l>=Math.PI/2?Number.MAX_VALUE:t/Math.cos(l)}function bn(n,e,t,r){return null!=n&&(G(e,r)?(k(t,n),!0):(Te[0]=n[0],Te[1]=n[1],Te[2]=0,!!xn(Te,e,0,Te,r,0,1)&&(t[0]=Te[0],t[1]=Te[1],Te[0]=n[2],Te[1]=n[3],Te[2]=0,!!xn(Te,e,0,Te,r,0,1)&&(t[2]=Te[0],t[3]=Te[1],!0))))}function kn(n,e,t,r){if(u(e)||u(r))return!1;const l=Un(e,ye),o=Un(r,ge);if(l===o&&0!==l||G(e,r))return t[0]=1,t[1]=1,t[2]=1,!0;if(1===l){const e=R(n),r=e/Math.sqrt(n[0]*n[0]+n[1]*n[1]),l=e/v.radius;if(3===o)return t[0]=r*l,t[1]=r*l,t[2]=1,!0;if(2===o||5===o){const n=180/(v.radius*Math.PI);return t[0]=n*r*l,t[1]=n*l,t[2]=1,!0}}else if(12===l&&(2===o||5===o))return t[0]=Nn,t[1]=Nn,t[2]=1,!0;return!1}function vn(n,e,t,r){if(u(n)||u(r))return!1;const l=Un(n,ye),o=Un(r,ge);if(l===o&&!qn(o)&&(0!==l||G(n,r)))return c(t),f(t,t,e),!0;if(qn(o)){const n=Me[l][11],r=Me[11][o];return!u(n)&&!u(r)&&(n(e,0,Ce,0),r(Ce,0,Fe,0),zn(Pe*Ce[0],Pe*Ce[1],t),t[12]=Fe[0],t[13]=Fe[1],t[14]=Fe[2],!0)}if(!(3!==o&&12!==o||2!==l&&1!==l&&3!==l)){const n=Me[l][11],r=Me[11][o];return!u(n)&&!u(r)&&(n(e,0,Ce,0),r(Ce,0,Fe,0),1===l?An(Pe*Ce[0],Pe*Ce[1],t):c(t),t[12]=Fe[0],t[13]=Fe[1],t[14]=Fe[2],!0)}return!1}function qn(n){return 1===n||7===n||9===n}function zn(n,e,t){const r=Math.sin(n),l=Math.cos(n),u=Math.sin(e),o=Math.cos(e),a=t;return a[0]=-r,a[4]=-u*l,a[8]=o*l,a[12]=0,a[1]=l,a[5]=-u*r,a[9]=o*r,a[13]=0,a[2]=0,a[6]=o,a[10]=u,a[14]=0,a[3]=0,a[7]=0,a[11]=0,a[15]=1,a}function An(n,e,t){return zn(n,e,t),p(t,t),t}function Un(n,e){return e.spatialReference===n?e.spatialReferenceId:(e.spatialReference=n,"metersPerUnit"in e&&(e.metersPerUnit=i(n,1)),n.wkt===C.wkt?e.spatialReferenceId=1:Z(n)?e.spatialReferenceId=2:_(n)?e.spatialReferenceId=3:B(n)?e.spatialReferenceId=12:n.wkt===F.wkt?e.spatialReferenceId=4:4490===n.wkid?e.spatialReferenceId=5:n.wkt===S.wkt?e.spatialReferenceId=7:n.wkt===b.wkt?e.spatialReferenceId=9:K(n)?e.spatialReferenceId=8:L(n)?e.spatialReferenceId=10:e.spatialReferenceId=0)}function Gn(n,e,t,r){n!==t&&(t[r++]=n[e++],t[r++]=n[e++],t[r]=n[e])}function Wn(n,e,t,r){t[r++]=xe*(n[e++]/v.radius),t[r++]=xe*(Math.PI/2-2*Math.atan(Math.exp(-n[e++]/v.radius))),t[r]=n[e]}function Zn(n,e,t,r){Wn(n,e,t,r),le(t,r,t,r)}function _n(n,e,t,r){Wn(n,e,t,r),pe(t,r,t,r)}function Bn(n,t,r,l,u){const o=.4999999*Math.PI,a=e(Pe*n[t+1],-o,o),s=Math.sin(a);r[l++]=Pe*n[t]*u.radius,r[l++]=u.halfSemiMajorAxis*Math.log((1+s)/(1-s)),r[l]=n[t+2]}function Kn(n,e,t,r){Bn(n,e,t,r,v)}const Ln=v.radius*Math.PI/180,Nn=180/(v.radius*Math.PI);function Vn(n,e,t,r){t[r]=n[e]*Ln,t[r+1]=n[e+1]*Ln,t[r+2]=n[e+2]}function Xn(n,e,t,r){t[r]=n[e]*Nn,t[r+1]=n[e+1]*Nn,t[r+2]=n[e+2]}function Dn(n,e,t,r){Wn(n,e,t,r),Vn(t,r,t,r)}function Hn(n,e,t,r){he(n,e,t,r),Vn(t,r,t,r)}function Jn(n,e,t,r){se(n,e,t,r),Vn(t,r,t,r)}function On(n,e,t,r){Xn(n,e,t,r),le(t,r,t,r)}function Qn(n,e,t,r){Xn(n,e,t,r),Kn(t,r,t,r)}function Yn(n,e,t,r){Xn(n,e,t,r),pe(t,r,t,r)}function $n(n){if(u(n))return!1;const e=Un(n,ye);return!!Me[e][6]}function ne(n,e,t,r,l=0){const u=r+l,o=Math.cos(t);n[0]=Math.cos(e)*o*u,n[1]=Math.sin(e)*o*u,n[2]=Math.sin(t)*u}function ee(n,e,t,r,l){const u=l+n[e+2],o=Pe*n[e+1],a=Pe*n[e],s=Math.cos(o);t[r++]=Math.cos(a)*s*u,t[r++]=Math.sin(a)*s*u,t[r]=Math.sin(o)*u}function te(n,e,t,r){ee(n,e,t,r,q.radius)}function re(n,e,t,r){ee(n,e,t,r,z.radius)}function le(n,e,t,r){ee(n,e,t,r,v.radius)}function ue(n,e,t,r,u){const o=n[e],a=n[e+1],s=n[e+2],i=Math.sqrt(o*o+a*a+s*s),c=l(s/(0===i?1:i)),f=Math.atan2(a,o);t[r++]=xe*f,t[r++]=xe*c,t[r]=i-u}function oe(n,e,t,r){ue(n,e,t,r,q.radius)}function ae(n,e,t,r){ue(n,e,t,r,z.radius)}function se(n,e,t,r){ue(n,e,t,r,v.radius)}function ie(n,e,t,r){se(n,e,t,r),Kn(t,r,t,r)}function ce(n,e,t,r){se(n,e,t,r),pe(t,r,t,r)}function fe(n,e,t,r,l){const u=Pe*n[e],o=Pe*n[e+1],a=n[e+2],s=Math.sin(o),i=Math.cos(o),c=l.radius/Math.sqrt(1-l.eccentricitySquared*s*s);t[r++]=(c+a)*i*Math.cos(u),t[r++]=(c+a)*i*Math.sin(u),t[r++]=(c*(1-l.eccentricitySquared)+a)*s}function pe(n,e,t,r){fe(n,e,t,r,v)}function he(n,e,t,r){const l=A,u=n[e],o=n[e+1],a=n[e+2];let s,i,c,f,p,h,m,d,M,R,j,w,y,g,E,I,P,x,T,C,F;s=Math.abs(a),i=u*u+o*o,c=Math.sqrt(i),f=i+a*a,p=Math.sqrt(f),C=Math.atan2(o,u),h=a*a/f,m=i/f,g=l.a2/p,E=l.a3-l.a4/p,m>.3?(d=s/p*(1+m*(l.a1+g+h*E)/p),T=Math.asin(d),R=d*d,M=Math.sqrt(1-R)):(M=c/p*(1-h*(l.a5-g-m*E)/p),T=Math.acos(M),R=1-M*M,d=Math.sqrt(R)),j=1-v.eccentricitySquared*R,w=v.radius/Math.sqrt(j),y=l.a6*w,g=c-w*M,E=s-y*d,P=M*g+d*E,I=M*E-d*g,x=I/(y/j+P),T+=x,F=P+I*x/2,a<0&&(T=-T),t[r++]=xe*C,t[r++]=xe*T,t[r]=F}function me(n,e,t,r){he(n,e,t,r),le(t,r,t,r)}function de(n,e,t,r){he(n,e,t,r),Kn(t,r,t,r)}const Me={2:{5:null,8:null,10:null,11:Gn,6:Gn,1:le,7:null,9:null,0:null,3:Kn,12:Vn,2:Gn,4:pe},5:{5:Gn,8:null,10:null,11:Gn,6:Gn,1:le,7:null,9:null,0:null,3:null,12:Vn,2:null,4:pe},8:{5:null,8:Gn,10:null,11:Gn,6:null,1:null,7:re,9:null,0:null,3:null,12:null,2:null,4:null},10:{5:null,8:null,10:Gn,11:Gn,6:null,1:null,7:null,9:te,0:null,3:null,12:null,2:null,4:null},3:{5:null,8:null,10:null,11:Wn,6:Wn,1:Zn,7:null,9:null,0:null,3:Gn,12:Dn,2:Wn,4:_n},4:{5:he,8:null,10:null,11:he,6:he,1:me,7:null,9:null,0:null,3:de,12:Hn,2:he,4:Gn},1:{5:se,8:null,10:null,11:se,6:se,1:Gn,7:null,9:null,0:null,3:ie,12:Jn,2:se,4:ce},7:{5:null,8:ae,10:null,11:ae,6:null,1:null,7:Gn,9:null,0:null,3:null,12:null,2:null,4:null},9:{5:null,8:null,10:oe,11:oe,6:null,1:null,7:null,9:Gn,0:null,3:null,12:null,2:null,4:null},0:{5:null,8:null,10:null,11:null,6:null,1:null,7:null,9:null,0:Gn,3:null,12:null,2:null,4:null},11:{5:Gn,8:Gn,10:Gn,11:Gn,6:Gn,1:le,7:re,9:te,0:null,3:Kn,12:Vn,2:Gn,4:pe},6:{5:null,8:null,10:null,11:Gn,6:Gn,1:le,7:null,9:null,0:null,3:null,12:Vn,2:Gn,4:pe},12:{5:Xn,8:null,10:null,11:Xn,6:Xn,1:On,7:null,9:null,0:null,3:Qn,12:Gn,2:Xn,4:Yn}};function Re(n,e,t=we()){return u(n)||u(e)?null:je(n,e,t).projector}function je(n,e,t){if(u(n)||u(e)||t.source.spatialReference===n&&t.dest.spatialReference===e)return t;const r=Un(n,t.source),l=Un(e,t.dest);return 0===r&&0===l?G(n,e)?t.projector=Gn:t.projector=null:t.projector=Me[r][l],t}function we(){return{source:{spatialReference:null,spatialReferenceId:0,metersPerUnit:1},dest:{spatialReference:null,spatialReferenceId:0,metersPerUnit:1},projector:Gn}}const ye={spatialReference:null,spatialReferenceId:0},ge={spatialReference:null,spatialReferenceId:0},Ee=we(),Ie=we(),Pe=t(1),xe=r(1),Te=j(),Ce=j(),Fe=j(),Se=j(),be=j();export{$n as canProjectToWGS84ComparableLonLat,tn as canProjectWithoutEngine,zn as computeENUToSphericalPCPFLocalRotation,An as computeSphericalPCPFToENULocalRotation,vn as computeTranslationToOriginAndRotation,ln as getProjectorName,Y as getTransformation,$ as getTransformations,rn as initializeProjection,H as isLoaded,J as load,kn as localLinearScaleFactors,ne as lonLatToSphericalPCPF,Bn as lonLatToWebMercatorComparable,O as project,bn as projectBoundingRect,Fn as projectBoundingSphere,xn as projectBuffer,Tn as projectDirection,dn as projectExtent,Q as projectMany,sn as projectMultipoint,on as projectPoint,wn as projectPointToVector,En as projectPointToWGS84ComparableLonLat,hn as projectPolygon,fn as projectPolyline,jn as projectVectorToDehydratedPoint,Rn as projectVectorToPoint,gn as projectVectorToVector,In as projectVectorToWGS84ComparableLonLat,un as projectWithoutEngine,yn as projectXYZToVector,ue as sphericalPCPFtoLonLatElevation,en as unload};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.22/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../config.js";import{id as s}from"../kernel.js";import r from"../request.js";import i from"../core/Error.js";import n from"../core/Evented.js";import{on as o}from"../core/events.js";import a from"../core/global.js";import{fixJson as h}from"../core/lang.js";import{getDeepValue as l}from"../core/object.js";import{createAbortController as c,createResolver as d,onAbort as u,isAborted as p}from"../core/promiseUtils.js";import{Url as _,urlToObject as f,hasSameOrigin as g,queryToObject as m,normalize as v,getProxyRule as S,makeAbsolute as w,objectToQuery as I}from"../core/urlUtils.js";import{property as k}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import{subclass as A}from"../core/accessorSupport/decorators/subclass.js";import y from"./IdentityForm.js";import U from"./IdentityModal.js";import T from"./OAuthCredential.js";import x from"./OAuthInfo.js";import O from"./ServerInfo.js";const R={},b=e=>{const t=new _(e.owningSystemUrl).host,s=new _(e.server).host,r=/.+\.arcgis\.com$/i;return r.test(t)&&r.test(s)},P=(e,t)=>!!(b(e)&&t&&t.some((t=>t.test(e.server))));let C=null,D=null;try{C=window.localStorage,D=window.sessionStorage}catch{}class q extends n{constructor(){super(),this._portalConfig=a.esriGeowConfig,this.serverInfos=[],this.oAuthInfos=[],this.credentials=[],this._soReqs=[],this._xoReqs=[],this._portals=[],this.defaultOAuthInfo=null,this.defaultTokenValidity=60,this.dialog=null,this.formConstructor=y,this.tokenValidity=null,this.normalizeWebTierAuth=!1,this._appOrigin="null"!==window.origin?window.origin:window.location.origin,this._appUrlObj=f(window.location.href),this._busy=null,this._rejectOnPersistedPageShow=!1,this._oAuthHash=null,this._gwTokenUrl="/sharing/rest/generateToken",this._agsRest="/rest/services",this._agsPortal=/\/sharing(\/|$)/i,this._agsAdmin=/(https?:\/\/[^\/]+\/[^\/]+)\/admin\/?(\/.*)?$/i,this._adminSvcs=/\/rest\/admin\/services(\/|$)/i,this._gwDomains=[{regex:/^https?:\/\/www\.arcgis\.com/i,customBaseUrl:"maps.arcgis.com",tokenServiceUrl:"https://www.arcgis.com/sharing/rest/generateToken"},{regex:/^https?:\/\/(?:dev|[a-z\d-]+\.mapsdev)\.arcgis\.com/i,customBaseUrl:"mapsdev.arcgis.com",tokenServiceUrl:"https://dev.arcgis.com/sharing/rest/generateToken"},{regex:/^https?:\/\/(?:devext|[a-z\d-]+\.mapsdevext)\.arcgis\.com/i,customBaseUrl:"mapsdevext.arcgis.com",tokenServiceUrl:"https://devext.arcgis.com/sharing/rest/generateToken"},{regex:/^https?:\/\/(?:qaext|[a-z\d-]+\.mapsqa)\.arcgis\.com/i,customBaseUrl:"mapsqa.arcgis.com",tokenServiceUrl:"https://qaext.arcgis.com/sharing/rest/generateToken"},{regex:/^https?:\/\/[a-z\d-]+\.maps\.arcgis\.com/i,customBaseUrl:"maps.arcgis.com",tokenServiceUrl:"https://www.arcgis.com/sharing/rest/generateToken"}],this._legacyFed=[],this._regexSDirUrl=/http.+\/rest\/services\/?/gi,this._regexServerType=/(\/(FeatureServer|GPServer|GeoDataServer|GeocodeServer|GeoenrichmentServer|GeometryServer|GlobeServer|ImageServer|MapServer|MobileServer|NAServer|NetworkDiagramServer|OGCFeatureServer|ParcelFabricServer|RelationalCatalogServer|SceneServer|StreamServer|UtilityNetworkServer|ValidationServer|VectorTileServer|VersionManagementServer)).*/gi,this._gwUser=/http.+\/users\/([^\/]+)\/?.*/i,this._gwItem=/http.+\/items\/([^\/]+)\/?.*/i,this._gwGroup=/http.+\/groups\/([^\/]+)\/?.*/i,this._rePortalTokenSvc=/\/sharing(\/rest)?\/generatetoken/i,this._createDefaultOAuthInfo=!0,this._hasTestedIfAppIsOnPortal=!1,this._getOAuthHash(),window.addEventListener("pageshow",(e=>{this._pageShowHandler(e)}))}registerServers(e){const t=this.serverInfos;t?(e=e.filter((e=>!this.findServerInfo(e.server))),this.serverInfos=t.concat(e)):this.serverInfos=e,e.forEach((e=>{e.owningSystemUrl&&this._portals.push(e.owningSystemUrl),e.hasPortal&&this._portals.push(e.server)}))}registerOAuthInfos(e){const t=this.oAuthInfos;if(t){for(const s of e){const e=this.findOAuthInfo(s.portalUrl);e&&t.splice(t.indexOf(e),1)}this.oAuthInfos=t.concat(e)}else this.oAuthInfos=e}registerToken(e){e={...e};const t=this._sanitizeUrl(e.server),s=this._isServerRsrc(t);let r,i=this.findServerInfo(t),n=!0;i||(i=new O,i.server=this._getServerInstanceRoot(t),s?i.hasServer=!0:(i.tokenServiceUrl=this._getTokenSvcUrl(t),i.hasPortal=!0),this.registerServers([i])),r=this._findCredential(t),r?(delete e.server,Object.assign(r,e),n=!1):(r=new j({userId:e.userId,server:i.server,token:e.token,expires:e.expires,ssl:e.ssl,scope:s?"server":"portal"}),r.resources=[t],this.credentials.push(r)),r.emitTokenChange(!1),n||r.refreshServerTokens()}toJSON(){return h({serverInfos:this.serverInfos.map((e=>e.toJSON())),oAuthInfos:this.oAuthInfos.map((e=>e.toJSON())),credentials:this.credentials.map((e=>e.toJSON()))})}initialize(e){if(!e)return;"string"==typeof e&&(e=JSON.parse(e));const t=e.serverInfos,s=e.oAuthInfos,r=e.credentials;if(t){const e=[];t.forEach((t=>{t.server&&t.tokenServiceUrl&&e.push(t.declaredClass?t:new O(t))})),e.length&&this.registerServers(e)}if(s){const e=[];s.forEach((t=>{t.appId&&e.push(t.declaredClass?t:new x(t))})),e.length&&this.registerOAuthInfos(e)}r&&r.forEach((e=>{e.server&&e.token&&e.expires&&e.expires>Date.now()&&((e=e.declaredClass?e:new j(e)).emitTokenChange(),this.credentials.push(e))}))}findServerInfo(e){let t;e=this._sanitizeUrl(e);for(const s of this.serverInfos)if(this._hasSameServerInstance(s.server,e)){t=s;break}return t}findOAuthInfo(e){let t;e=this._sanitizeUrl(e);for(const s of this.oAuthInfos)if(this._hasSameServerInstance(s.portalUrl,e)){t=s;break}return t}findCredential(e,t){let s;e=this._sanitizeUrl(e);const r=this._isServerRsrc(e)?"server":"portal";if(t){for(const i of this.credentials)if(this._hasSameServerInstance(i.server,e)&&t===i.userId&&i.scope===r){s=i;break}}else for(const i of this.credentials)if(this._hasSameServerInstance(i.server,e)&&-1!==this._getIdenticalSvcIdx(e,i)&&i.scope===r){s=i;break}return s}getCredential(e,t){let s,r,n=!0;t&&(s=!!t.token,r=t.error,n=!1!==t.prompt),t={...t},e=this._sanitizeUrl(e);const o=c(),a=d();if(t.signal&&u(t.signal,(()=>{o.abort()})),u(o,(()=>{a.reject(new i("identity-manager:user-aborted","ABORTED"))})),p(o))return a.promise;t.signal=o.signal;const h=this._isAdminResource(e),l=s?this.findCredential(e):null;let _;if(l&&r&&r.details&&498===r.details.httpStatus)l.destroy();else if(l)return _=new i("identity-manager:not-authorized","You are currently signed in as: '"+l.userId+"'. You do not have access to this resource: "+e,{error:r}),a.reject(_),a.promise;const f=this._findCredential(e,t);if(f)return a.resolve(f),a.promise;let m=this.findServerInfo(e);if(m)!m.hasServer&&this._isServerRsrc(e)&&(m._restInfoPms=this._getTokenSvcUrl(e),m.hasServer=!0);else{const t=this._getTokenSvcUrl(e);if(!t)return _=new i("identity-manager:unknown-resource","Unknown resource - could not find token service endpoint."),a.reject(_),a.promise;m=new O,m.server=this._getServerInstanceRoot(e),"string"==typeof t?(m.tokenServiceUrl=t,m.hasPortal=!0):(m._restInfoPms=t,m.hasServer=!0),this.registerServers([m])}return m.hasPortal&&void 0===m._selfReq&&(n||g(m.tokenServiceUrl,this._appOrigin)||this._gwDomains.some((e=>e.tokenServiceUrl===m.tokenServiceUrl)))&&(m._selfReq={owningTenant:t&&t.owningTenant,selfDfd:this._getPortalSelf(m.tokenServiceUrl.replace(this._rePortalTokenSvc,"/sharing/rest/portals/self"),e)}),this._enqueue(e,m,t,a,h)}getResourceName(e){return this._isRESTService(e)?e.replace(this._regexSDirUrl,"").replace(this._regexServerType,"")||"":this._gwUser.test(e)&&e.replace(this._gwUser,"$1")||this._gwItem.test(e)&&e.replace(this._gwItem,"$1")||this._gwGroup.test(e)&&e.replace(this._gwGroup,"$1")||""}generateToken(e,t,s){const n=this._rePortalTokenSvc.test(e.tokenServiceUrl),o=new _(this._appOrigin),a=e.shortLivedTokenValidity;let h,l,c,d,u,p,f,m;t&&(m=this.tokenValidity||a||this.defaultTokenValidity,m>a&&a>0&&(m=a)),s&&(h=s.isAdmin,l=s.serverUrl,c=s.token,p=s.signal,f=s.ssl,e.customParameters=s.customParameters),h?d=e.adminTokenServiceUrl:(d=e.tokenServiceUrl,u=new _(d.toLowerCase()),e.webTierAuth&&null!=s&&s.serverUrl&&!f&&"http"===o.scheme&&(g(o.uri,d,!0)||"https"===u.scheme&&o.host===u.host&&"7080"===o.port&&"7443"===u.port)&&(d=d.replace(/^https:/i,"http:").replace(/:7443/i,":7080")));const v={query:{request:"getToken",username:null==t?void 0:t.username,password:null==t?void 0:t.password,serverUrl:l,token:c,expiration:m,referer:h||n?this._appOrigin:null,client:h?"referer":null,f:"json",...e.customParameters},method:"post",authMode:"anonymous",useProxy:this._useProxy(e,s),signal:p,...null==s?void 0:s.ioArgs};n||(v.withCredentials=!1);return r(d,v).then((s=>{const r=s.data;if(!r||!r.token)return new i("identity-manager:authentication-failed","Unable to generate token");const n=e.server;return R[n]||(R[n]={}),t&&(R[n][t.username]=t.password),r.validity=m,r}))}isBusy(){return!!this._busy}checkSignInStatus(e){return this.checkAppAccess(e,"").then((e=>e.credential))}checkAppAccess(e,t,s){let n=!1;return this.getCredential(e,{prompt:!1}).then((o=>{let a;const h={f:"json"};if("portal"===o.scope)if(t&&(this._doPortalSignIn(e)||s&&s.force))a=o.server+"/sharing/rest/oauth2/validateAppAccess",h.client_id=t;else{if(!o.token)return{credential:o};a=o.server+"/sharing/rest"}else{if(!o.token)return{credential:o};a=o.server+"/rest/services"}return o.token&&(h.token=o.token),r(a,{query:h,authMode:"anonymous"}).then((e=>{if(!1===e.data.valid)throw new i("identity-manager:not-authorized",`You are currently signed in as: '${o.userId}'.`,e.data);return n=!!e.data.viewOnlyUserTypeApp,{credential:o}})).catch((e=>{if("identity-manager:not-authorized"===e.name)throw e;const t=e.details&&e.details.httpStatus;if(498===t)throw o.destroy(),new i("identity-manager:not-authenticated","User is not signed in.");if(400===t)throw new i("identity-manager:invalid-request");return{credential:o}}))})).then((e=>({credential:e.credential,viewOnly:n})))}setOAuthResponseHash(e){var t;const s=this._oAuthDfd;if(this._oAuthDfd=null,!s||!e)return;clearInterval(this._oAuthIntervalId),null==(t=this._oAuthOnHashHandle)||t.remove(),"#"===e.charAt(0)&&(e=e.substring(1));const r=m(e);if(r.error){const e="access_denied"===r.error,t=new i(e?"identity-manager:user-aborted":"identity-manager:authentication-failed",e?"ABORTED":"OAuth: "+r.error+" - "+r.error_description);s.reject(t)}else{const e=s.sinfo_,t=s.oinfo_,i=t._oAuthCred,n=new j({userId:r.username,server:e.server,token:r.access_token,expires:Date.now()+1e3*Number(r.expires_in),ssl:"true"===r.ssl,_oAuthCred:i});t.userId=n.userId,i.storage=r.persist?C:D,i.token=n.token,i.expires=n.expires,i.userId=n.userId,i.ssl=n.ssl,i.save(),s.resolve(n)}}setOAuthRedirectionHandler(e){this._oAuthRedirectFunc=e}setProtocolErrorHandler(e){this._protocolFunc=e}signIn(e,t,s={}){const r=d(),n=()=>{var e,t,s,r,i;null==(e=h)||e.remove(),null==(t=l)||t.remove(),null==(s=c)||s.remove(),null==(r=a)||r.destroy(),null==(i=this.dialog)||i.destroy(),this.dialog=a=h=l=c=null},o=()=>{n(),this._oAuthDfd=null,r.reject(new i("identity-manager:user-aborted","ABORTED"))};s.signal&&u(s.signal,(()=>{o()}));let a=new this.formConstructor;a.resource=this.getResourceName(e),a.server=t.server,this.dialog=new U,this.dialog.content=a,this.dialog.open=!0,this.emit("dialog-create");let h=a.on("cancel",o),l=this.dialog.watch("open",o),c=a.on("submit",(e=>{this.generateToken(t,e,{isAdmin:s.isAdmin,signal:s.signal}).then((i=>{n();const o=new j({userId:e.username,server:t.server,token:i.token,expires:null!=i.expires?Number(i.expires):null,ssl:!!i.ssl,isAdmin:s.isAdmin,validity:i.validity});r.resolve(o)})).catch((e=>{a.error=e,a.signingIn=!1}))}));return r.promise}oAuthSignIn(e,t,s,r){this._oAuthDfd=d();const n=this._oAuthDfd;null!=r&&r.signal&&u(r.signal,(()=>{const e=this._oAuthDfd&&this._oAuthDfd.oAuthWin_;e&&!e.closed?e.close():this.dialog&&h()})),n.resUrl_=e,n.sinfo_=t,n.oinfo_=s;const o=!r||!1!==r.oAuthPopupConfirmation;if(!s.popup||!o)return this._doOAuthSignIn(e,t,s),n.promise;const a=new this.formConstructor;a.oAuthPrompt=!0,a.server=t.server,this.dialog=new U,this.dialog.content=a,this.dialog.open=!0,this.emit("dialog-create");const h=()=>{_(),this._oAuthDfd=null,n.reject(new i("identity-manager:user-aborted","ABORTED"))},l=a.on("cancel",h),c=this.dialog.watch("open",h),p=a.on("submit",(()=>{_(),this._doOAuthSignIn(e,t,s)})),_=()=>{l.remove(),c.remove(),p.remove(),a.destroy(),this.dialog.destroy(),this.dialog=null};return n.promise}destroyCredentials(){if(this.credentials){this.credentials.slice().forEach((e=>{e.destroy()}))}this.emit("credentials-destroy")}enablePostMessageAuth(e="https://www.arcgis.com/sharing/rest"){this._postMessageAuthHandle&&this._postMessageAuthHandle.remove(),this._postMessageAuthHandle=o(window,"message",(t=>{var s;if((t.origin===this._appOrigin||t.origin.endsWith(".arcgis.com"))&&"arcgis:auth:requestCredential"===(null==(s=t.data)?void 0:s.type)){const s=t.source;this.getCredential(e).then((e=>{s.postMessage({type:"arcgis:auth:credential",credential:{expires:e.expires,server:e.server,ssl:e.ssl,token:e.token,userId:e.userId}},t.origin)})).catch((e=>{s.postMessage({type:"arcgis:auth:error",error:{name:e.name,message:e.message}},t.origin)}))}}))}disablePostMessageAuth(){this._postMessageAuthHandle&&(this._postMessageAuthHandle.remove(),this._postMessageAuthHandle=null)}_getOAuthHash(){let e=window.location.hash;if(e){"#"===e.charAt(0)&&(e=e.substring(1));const t=m(e);let s=!1;if(t.access_token&&t.expires_in&&t.state&&t.hasOwnProperty("username"))try{t.state=JSON.parse(t.state),"object"==typeof t.state&&t.state.portalUrl&&(this._oAuthHash=t,s=!0)}catch{}else t.error&&t.error_description&&(console.log("IdentityManager OAuth Error: ",t.error," - ",t.error_description),"access_denied"===t.error&&(s=!0));s&&(window.location.hash="object"==typeof t.state&&t.state.hash||"")}}_pageShowHandler(e){if(e.persisted&&this.isBusy()&&this._rejectOnPersistedPageShow){const e=new i("identity-manager:user-aborted","ABORTED");this._errbackFunc(e)}}_findCredential(e,t){let s,r,i,n,o=-1;const a=t&&t.token,h=t&&t.resource,l=this._isServerRsrc(e)?"server":"portal",c=this.credentials.filter((t=>this._hasSameServerInstance(t.server,e)&&t.scope===l));if(e=h||e,c.length)if(1===c.length){if(s=c[0],n=this.findServerInfo(s.server),r=n&&n.owningSystemUrl,i=r&&this.findCredential(r,s.userId),o=this._getIdenticalSvcIdx(e,s),!a)return-1===o&&s.resources.push(e),this._addResource(e,i),s;-1!==o&&(s.resources.splice(o,1),this._removeResource(e,i))}else{let t,s;if(c.some((a=>(s=this._getIdenticalSvcIdx(e,a),-1!==s&&(t=a,n=this.findServerInfo(t.server),r=n&&n.owningSystemUrl,i=r&&this.findCredential(r,t.userId),o=s,!0)))),a)t&&(t.resources.splice(o,1),this._removeResource(e,i));else if(t)return this._addResource(e,i),t}}_findOAuthInfo(e){let t=this.findOAuthInfo(e);if(!t)for(const s of this.oAuthInfos)if(this._isIdProvider(s.portalUrl,e)){t=s;break}return t}_addResource(e,t){t&&-1===this._getIdenticalSvcIdx(e,t)&&t.resources.push(e)}_removeResource(e,t){let s=-1;t&&(s=this._getIdenticalSvcIdx(e,t),s>-1&&t.resources.splice(s,1))}_useProxy(e,t){return t&&t.isAdmin&&!g(e.adminTokenServiceUrl,this._appOrigin)||!this._isPortalDomain(e.tokenServiceUrl)&&"10.1"===String(e.currentVersion)&&!g(e.tokenServiceUrl,this._appOrigin)}_getOrigin(e){const t=new _(e);return t.scheme+"://"+t.host+(null!=t.port?":"+t.port:"")}_getServerInstanceRoot(e){const t=e.toLowerCase();let s=t.indexOf(this._agsRest);return-1===s&&this._isAdminResource(e)&&(s=this._agsAdmin.test(e)?e.replace(this._agsAdmin,"$1").length:e.search(this._adminSvcs)),-1===s&&(s=t.indexOf("/sharing")),-1===s&&"/"===t.substr(-1)&&(s=t.length-1),s>-1?e.substring(0,s):e}_hasSameServerInstance(e,t){return"/"===e.substr(-1)&&(e=e.slice(0,-1)),e=e.toLowerCase(),t=this._getServerInstanceRoot(t).toLowerCase(),e=this._normalizeAGOLorgDomain(e),t=this._normalizeAGOLorgDomain(t),(e=e.substr(e.indexOf(":")))===(t=t.substr(t.indexOf(":")))}_normalizeAGOLorgDomain(e){const t=/^https?:\/\/(?:cdn|[a-z\d-]+\.maps)\.arcgis\.com/i,s=/^https?:\/\/(?:cdndev|[a-z\d-]+\.mapsdevext)\.arcgis\.com/i,r=/^https?:\/\/(?:cdnqa|[a-z\d-]+\.mapsqa)\.arcgis\.com/i;return t.test(e)?e=e.replace(t,"https://www.arcgis.com"):s.test(e)?e=e.replace(s,"https://devext.arcgis.com"):r.test(e)&&(e=e.replace(r,"https://qaext.arcgis.com")),e}_sanitizeUrl(e){const s=(t.request.proxyUrl||"").toLowerCase(),r=s?e.toLowerCase().indexOf(s+"?"):-1;return-1!==r&&(e=e.substring(r+s.length+1)),e=v(e),f(e).path}_isRESTService(e){return e.indexOf(this._agsRest)>-1}_isAdminResource(e){return this._agsAdmin.test(e)||this._adminSvcs.test(e)}_isServerRsrc(e){return this._isRESTService(e)||this._isAdminResource(e)}_isIdenticalService(e,t){let s;if(this._isRESTService(e)&&this._isRESTService(t)){const r=this._getSuffix(e).toLowerCase(),i=this._getSuffix(t).toLowerCase();if(s=r===i,!s){const e=/(.*)\/(MapServer|FeatureServer|UtilityNetworkServer).*/gi;s=r.replace(e,"$1")===i.replace(e,"$1")}}else this._isAdminResource(e)&&this._isAdminResource(t)?s=!0:this._isServerRsrc(e)||this._isServerRsrc(t)||!this._isPortalDomain(e)||(s=!0);return s}_isPortalDomain(e){const s=new _(e.toLowerCase()),r=this._portalConfig;let i=this._gwDomains.some((e=>e.regex.test(s.uri)));return!i&&r&&(i=this._hasSameServerInstance(this._getServerInstanceRoot(r.restBaseUrl),s.uri)),i||t.portalUrl&&(i=g(s,t.portalUrl,!0)),i||(i=this._portals.some((e=>this._hasSameServerInstance(e,s.uri)))),i=i||this._agsPortal.test(s.path),i}_isIdProvider(e,t){let s=-1,r=-1;this._gwDomains.forEach(((i,n)=>{-1===s&&i.regex.test(e)&&(s=n),-1===r&&i.regex.test(t)&&(r=n)}));let i=!1;if(s>-1&&r>-1&&(0===s||4===s?0!==r&&4!==r||(i=!0):1===s?1!==r&&2!==r||(i=!0):2===s?2===r&&(i=!0):3===s&&3===r&&(i=!0)),!i){const s=this.findServerInfo(t),r=s&&s.owningSystemUrl;r&&b(s)&&this._isPortalDomain(r)&&this._isIdProvider(e,r)&&(i=!0)}return i}_getIdenticalSvcIdx(e,t){let s=-1;for(let r=0;r<t.resources.length;r++){const i=t.resources[r];if(this._isIdenticalService(e,i)){s=r;break}}return s}_getSuffix(e){return e.replace(this._regexSDirUrl,"").replace(this._regexServerType,"$1")}_getTokenSvcUrl(e){let t,s,i;if(this._isRESTService(e)||this._isAdminResource(e)){const i=this._getServerInstanceRoot(e);return t=i+"/admin/generateToken",s=r(e=i+"/rest/info",{query:{f:"json"}}).then((e=>e.data)),{adminUrl:t,promise:s}}if(this._isPortalDomain(e)){let t="";if(this._gwDomains.some((s=>(s.regex.test(e)&&(t=s.tokenServiceUrl),!!t))),t||this._portals.some((s=>(this._hasSameServerInstance(s,e)&&(t=s+this._gwTokenUrl),!!t))),t||(i=e.toLowerCase().indexOf("/sharing"),-1!==i&&(t=e.substring(0,i)+this._gwTokenUrl)),t||(t=this._getOrigin(e)+this._gwTokenUrl),t){const s=new _(e).port;/^http:\/\//i.test(e)&&"7080"===s&&(t=t.replace(/:7080/i,":7443")),t=t.replace(/http:/i,"https:")}return t}if(-1!==e.toLowerCase().indexOf("premium.arcgisonline.com"))return"https://premium.arcgisonline.com/server/tokens"}_exchangeToken(e,t,s){return r(`${e}/sharing/rest/oauth2/exchangeToken`,{authMode:"anonymous",method:"post",query:{f:"json",client_id:t,token:s}}).then((e=>e.data.token))}_getPlatformSelf(e,t){return e=e.replace(/^http:/i,"https:"),r(`${e}/sharing/rest/oauth2/platformSelf`,{authMode:"anonymous",headers:{"X-Esri-Auth-Client-Id":t,"X-Esri-Auth-Redirect-Uri":window.location.href.replace(/#.*$/,"")},method:"post",query:{f:"json"},withCredentials:!0}).then((e=>e.data))}_getPortalSelf(e,t){let s;if(this._gwDomains.some((t=>(t.regex.test(e)&&(s=t.customBaseUrl),!!s))),s)return Promise.resolve({allSSL:!0,currentVersion:"4.4",customBaseUrl:s,portalMode:"multitenant",supportsOAuth:!0});this._appOrigin.startsWith("https:")?e=e.replace(/^http:/i,"https:").replace(/:7080/i,":7443"):/^http:/i.test(t)&&(e=e.replace(/^https:/i,"http:").replace(/:7443/i,":7080"));return r(e,{query:{f:"json"},authMode:"anonymous",withCredentials:!0}).then((e=>e.data))}_doPortalSignIn(e){const t=this._portalConfig,s=window.location.href,r=this.findServerInfo(e);return!(!t&&!this._isPortalDomain(s)||!(r?r.hasPortal||r.owningSystemUrl&&this._isPortalDomain(r.owningSystemUrl):this._isPortalDomain(e))||!(this._isIdProvider(s,e)||t&&(this._hasSameServerInstance(this._getServerInstanceRoot(t.restBaseUrl),e)||this._isIdProvider(t.restBaseUrl,e))||g(s,e,!0)))}_checkProtocol(e,t,s,r){let n=!0;const o=r?t.adminTokenServiceUrl:t.tokenServiceUrl;if(o.trim().toLowerCase().startsWith("https:")&&!this._appOrigin.startsWith("https:")&&S(o)&&(n=!!this._protocolFunc&&!!this._protocolFunc({resourceUrl:e,serverInfo:t}),!n)){s(new i("identity-manager:aborted","Aborted the Sign-In process to avoid sending password over insecure connection."))}return n}_enqueue(e,t,s,r,i,n){return r||(r=d()),r.resUrl_=e,r.sinfo_=t,r.options_=s,r.admin_=i,r.refresh_=n,this._busy?this._hasSameServerInstance(this._getServerInstanceRoot(e),this._busy.resUrl_)?(this._oAuthDfd&&this._oAuthDfd.oAuthWin_&&this._oAuthDfd.oAuthWin_.focus(),this._soReqs.push(r)):this._xoReqs.push(r):this._doSignIn(r),r.promise}_doSignIn(e){this._busy=e,this._rejectOnPersistedPageShow=!1;const t=t=>{const s=e.options_&&e.options_.resource,r=e.resUrl_,i=e.refresh_;let n=!1;-1===this.credentials.indexOf(t)&&(i&&-1!==this.credentials.indexOf(i)?(i.userId=t.userId,i.token=t.token,i.expires=t.expires,i.validity=t.validity,i.ssl=t.ssl,i.creationTime=t.creationTime,n=!0,t=i):this.credentials.push(t)),t.resources||(t.resources=[]),t.resources.push(s||r),t.scope=this._isServerRsrc(r)?"server":"portal",t.emitTokenChange();const o=this._soReqs,a={};this._soReqs=[],o.forEach((e=>{if(!this._isIdenticalService(r,e.resUrl_)){const s=this._getSuffix(e.resUrl_);a[s]||(a[s]=!0,t.resources.push(e.resUrl_))}})),e.resolve(t),o.forEach((e=>{this._hasSameServerInstance(this._getServerInstanceRoot(r),e.resUrl_)?e.resolve(t):this._soReqs.push(e)})),this._busy=e.resUrl_=e.sinfo_=e.refresh_=null,n||this.emit("credential-create",{credential:t}),this._soReqs.length?this._doSignIn(this._soReqs.shift()):this._xoReqs.length&&this._doSignIn(this._xoReqs.shift())},s=t=>{e.reject(t),this._busy=e.resUrl_=e.sinfo_=e.refresh_=null,this._soReqs.length?this._doSignIn(this._soReqs.shift()):this._xoReqs.length&&this._doSignIn(this._xoReqs.shift())},r=(r,n,a,h)=>{var l,c;const d=e.sinfo_,p=!e.options_||!1!==e.options_.prompt,_=d.hasPortal&&this._findOAuthInfo(e.resUrl_);let f,m;if(r)t(new j({userId:r,server:d.server,token:a||null,expires:null!=h?Number(h):null,ssl:!!n}));else if(window!==window.parent&&null!=(l=this._appUrlObj.query)&&l["arcgis-auth-origin"]&&null!=(c=this._appUrlObj.query)&&c["arcgis-auth-portal"]&&this._hasSameServerInstance(this._getServerInstanceRoot(this._appUrlObj.query["arcgis-auth-portal"]),e.resUrl_)){var v;window.parent.postMessage({type:"arcgis:auth:requestCredential"},this._appUrlObj.query["arcgis-auth-origin"]);const r=o(window,"message",(e=>{e.source===window.parent&&e.data&&("arcgis:auth:credential"===e.data.type?(r.remove(),t(new j(e.data.credential))):"arcgis:auth:error"===e.data.type&&(r.remove(),s(i.fromJSON(e.data.error))))}));u(null==(v=e.options_)?void 0:v.signal,(()=>{r.remove()}))}else if(_){let r=_._oAuthCred;if(!r){const e=new T(_,C),t=new T(_,D);e.isValid()&&t.isValid()?e.expires>t.expires?(r=e,t.destroy()):(r=t,e.destroy()):r=e.isValid()?e:t,_._oAuthCred=r}if(r.isValid())f=new j({userId:r.userId,server:d.server,token:r.token,expires:r.expires,ssl:r.ssl,_oAuthCred:r}),_.appId!==r.appId&&this._doPortalSignIn(e.resUrl_)?e._pendingDfd=this._exchangeToken(f.server,_.appId,f.token).then((e=>{f.token=e,r.token=e,r.save(),t(f)})).catch((()=>{t(f)})):t(f);else if(this._oAuthHash&&this._hasSameServerInstance(_.portalUrl,this._oAuthHash.state.portalUrl)){const e=this._oAuthHash;f=new j({userId:e.username,server:d.server,token:e.access_token,expires:Date.now()+1e3*Number(e.expires_in),ssl:"true"===e.ssl,oAuthState:e.state,_oAuthCred:r}),_.userId=f.userId,r.storage=e.persist?C:D,r.token=f.token,r.expires=f.expires,r.userId=f.userId,r.ssl=f.ssl,r.save(),this._oAuthHash=null,t(f)}else{const r=()=>{p?e._pendingDfd=this.oAuthSignIn(e.resUrl_,d,_,e.options_).then(t,s):(m=new i("identity-manager:not-authenticated","User is not signed in."),s(m))};this._doPortalSignIn(e.resUrl_)?e._pendingDfd=this._getPlatformSelf(d.server,_.appId).then((({portalUrl:e,token:s,username:i})=>{!e||g(e,this._appOrigin,!0)?(f=new j({server:d.server,userId:i,token:s}),t(f)):r()})).catch(r):r()}}else if(p){if(this._checkProtocol(e.resUrl_,d,s,e.admin_)){let r=e.options_;e.admin_&&(r=r||{},r.isAdmin=!0),e._pendingDfd=this.signIn(e.resUrl_,d,r).then(t,s)}}else m=new i("identity-manager:not-authenticated","User is not signed in."),s(m)},n=()=>{const r=e.sinfo_,i=r.owningSystemUrl,n=e.options_;let o,a,h,l;if(n&&(o=n.token,a=n.error,h=n.prompt),l=this._findCredential(i,{token:o,resource:e.resUrl_}),!l)for(const e of this.credentials)if(this._isIdProvider(i,e.server)){l=e;break}if(l){const i=this.findCredential(e.resUrl_,l.userId);if(i)t(i);else if(P(r,this._legacyFed)){const e=l.toJSON();e.server=r.server,e.resources=null,t(new j(e))}else{(e._pendingDfd=this.generateToken(this.findServerInfo(l.server),null,{serverUrl:e.resUrl_,token:l.token,signal:e.options_.signal,ssl:l.ssl})).then((s=>{t(new j({userId:l.userId,server:r.server,token:s.token,expires:null!=s.expires?Number(s.expires):null,ssl:!!s.ssl,isAdmin:e.admin_,validity:s.validity}))}),s)}}else{this._busy=null,o&&(e.options_.token=null);(e._pendingDfd=this.getCredential(i.replace(/\/?$/,"/sharing"),{resource:e.resUrl_,owningTenant:r.owningTenant,signal:e.options_.signal,token:o,error:a,prompt:h})).then((()=>{this._enqueue(e.resUrl_,e.sinfo_,e.options_,e,e.admin_)}),(t=>{e.resUrl_=e.sinfo_=e.refresh_=null,e.reject(t)}))}};this._errbackFunc=s;const a=e.sinfo_.owningSystemUrl,h=this._isServerRsrc(e.resUrl_),c=e.sinfo_._restInfoPms;c?c.promise.then((t=>{const s=e.sinfo_;if(s._restInfoPms){s.adminTokenServiceUrl=s._restInfoPms.adminUrl,s._restInfoPms=null,s.tokenServiceUrl=l("authInfo.tokenServicesUrl",t)||l("authInfo.tokenServiceUrl",t)||l("tokenServiceUrl",t),s.shortLivedTokenValidity=l("authInfo.shortLivedTokenValidity",t),s.currentVersion=t.currentVersion,s.owningTenant=t.owningTenant;const e=s.owningSystemUrl=t.owningSystemUrl;e&&this._portals.push(e)}h&&s.owningSystemUrl?n():r()}),(()=>{e.sinfo_._restInfoPms=null;const t=new i("identity-manager:server-identification-failed","Unknown resource - could not find token service endpoint.");s(t)})):h&&a?n():e.sinfo_._selfReq?e.sinfo_._selfReq.selfDfd.then((t=>{const s={};let r,i,n,o;return t&&(r=t.user&&t.user.username,s.username=r,s.allSSL=t.allSSL,i=t.supportsOAuth,n=t.currentVersion,"multitenant"===t.portalMode&&(o=t.customBaseUrl)),e.sinfo_.webTierAuth=!!r,r&&this.normalizeWebTierAuth?this.generateToken(e.sinfo_,null,{ssl:s.allSSL}).catch((()=>null)).then((e=>(s.portalToken=e&&e.token,s.tokenExpiration=e&&e.expires,s))):!r&&i&&parseFloat(n)>=4.4&&!this._findOAuthInfo(e.resUrl_)?this._generateOAuthInfo({portalUrl:e.sinfo_.server,customBaseUrl:o,owningTenant:e.sinfo_._selfReq.owningTenant}).catch((()=>null)).then((()=>s)):s})).catch((()=>null)).then((t=>{e.sinfo_._selfReq=null,t?r(t.username,t.allSSL,t.portalToken,t.tokenExpiration):r()})):r()}_generateOAuthInfo(e){let t,s,i=e.portalUrl;const n=e.customBaseUrl,o=e.owningTenant,a=!this.defaultOAuthInfo&&this._createDefaultOAuthInfo&&!this._hasTestedIfAppIsOnPortal;if(a){s=window.location.href;let e=s.indexOf("?");e>-1&&(s=s.slice(0,e)),e=s.search(/\/(apps|home)\//),s=e>-1?s.slice(0,e):null}return a&&s?(this._hasTestedIfAppIsOnPortal=!0,t=r(s+"/sharing/rest",{query:{f:"json"}}).then((()=>{this.defaultOAuthInfo=new x({appId:"arcgisonline",popupCallbackUrl:s+"/home/oauth-callback.html"})}))):t=Promise.resolve(),t.then((()=>{if(this.defaultOAuthInfo)return i=i.replace(/^http:/i,"https:"),r(i+"/sharing/rest/oauth2/validateRedirectUri",{query:{accountId:o,client_id:this.defaultOAuthInfo.appId,redirect_uri:w(this.defaultOAuthInfo.popupCallbackUrl),f:"json"}}).then((e=>{if(e.data.valid){const t=this.defaultOAuthInfo.clone();e.data.urlKey&&n?t.portalUrl="https://"+e.data.urlKey.toLowerCase()+"."+n:t.portalUrl=i,t.popup=window!==window.top||!(g(i,this._appOrigin)||this._gwDomains.some((e=>e.regex.test(i)&&e.regex.test(this._appOrigin)))),this.oAuthInfos.push(t)}}))}))}_doOAuthSignIn(e,t,s){const r={portalUrl:s.portalUrl};!s.popup&&s.preserveUrlHash&&window.location.hash&&(r.hash=window.location.hash);const n={client_id:s.appId,response_type:"token",state:JSON.stringify(r),expiration:s.expiration,locale:s.locale,redirect_uri:s.popup?w(s.popupCallbackUrl):window.location.href.replace(/#.*$/,"")};s.forceLogin&&(n.force_login=!0),s.forceUserId&&s.userId&&(n.prepopulatedusername=s.userId),!s.popup&&this._doPortalSignIn(e)&&(n.redirectToUserOrgUrl=!0);const h=s.portalUrl.replace(/^http:/i,"https:")+"/sharing/oauth2/authorize",l=h+"?"+I(n);if(s.popup){const e=window.open(l,"esriJSAPIOAuth",s.popupWindowFeatures);if(e)e.focus(),this._oAuthDfd.oAuthWin_=e,this._oAuthIntervalId=setInterval((()=>{if(e.closed){clearInterval(this._oAuthIntervalId),this._oAuthOnHashHandle.remove();const e=this._oAuthDfd;if(e){const t=new i("identity-manager:user-aborted","ABORTED");e.reject(t)}}}),500),this._oAuthOnHashHandle=o(a,"arcgis:auth:hash",(e=>{this.setOAuthResponseHash(e.detail)}));else{const e=new i("identity-manager:popup-blocked","ABORTED");this._oAuthDfd.reject(e)}}else this._rejectOnPersistedPageShow=!0,this._oAuthRedirectFunc?this._oAuthRedirectFunc({authorizeParams:n,authorizeUrl:h,resourceUrl:e,serverInfo:t,oAuthInfo:s}):window.location.href=l}}q.prototype.declaredClass="esri.identity.IdentityManagerBase";let j=class extends n.EventedAccessor{constructor(e){super(e),this._oAuthCred=null,this.tokenRefreshBuffer=2,e&&e._oAuthCred&&(this._oAuthCred=e._oAuthCred)}initialize(){this.resources=this.resources||[],null==this.creationTime&&(this.creationTime=Date.now())}refreshToken(){const e=s.findServerInfo(this.server),t=e&&e.owningSystemUrl,r=!!t&&"server"===this.scope,i=r&&P(e,s._legacyFed),n=e.webTierAuth,o=n&&s.normalizeWebTierAuth,a=R[this.server],h=a&&a[this.userId];let l,c=this.resources&&this.resources[0],d=r&&s.findServerInfo(t),u={username:this.userId,password:h};if(n&&!o)return;r&&!d&&s.serverInfos.some((e=>(s._isIdProvider(t,e.server)&&(d=e),!!d)));const p=d&&s.findCredential(d.server,this.userId);if(!r||p){if(!i){if(r)l={serverUrl:c,token:p&&p.token,ssl:p&&p.ssl};else if(o)u=null,l={ssl:this.ssl};else{if(!h){let t;return c&&(c=s._sanitizeUrl(c),this._enqueued=1,t=s._enqueue(c,e,null,null,this.isAdmin,this),t.then((()=>{this._enqueued=0,this.refreshServerTokens()})).catch((()=>{this._enqueued=0}))),t}this.isAdmin&&(l={isAdmin:!0})}return s.generateToken(r?d:e,r?null:u,l).then((e=>{this.token=e.token,this.expires=null!=e.expires?Number(e.expires):null,this.creationTime=Date.now(),this.validity=e.validity,this.emitTokenChange(),this.refreshServerTokens()})).catch((()=>{}))}p.refreshToken()}}refreshServerTokens(){"portal"===this.scope&&s.credentials.forEach((e=>{const t=s.findServerInfo(e.server),r=t&&t.owningSystemUrl;e!==this&&e.userId===this.userId&&r&&"server"===e.scope&&(s._hasSameServerInstance(this.server,r)||s._isIdProvider(r,this.server))&&(P(t,s._legacyFed)?(e.token=this.token,e.expires=this.expires,e.creationTime=this.creationTime,e.validity=this.validity,e.emitTokenChange()):e.refreshToken())}))}emitTokenChange(e){clearTimeout(this._refreshTimer);const t=this.server&&s.findServerInfo(this.server),r=t&&t.owningSystemUrl,i=r&&s.findServerInfo(r);!1===e||r&&"portal"!==this.scope&&(!i||!i.webTierAuth||s.normalizeWebTierAuth)||null==this.expires&&null==this.validity||this._startRefreshTimer(),this.emit("token-change")}destroy(){this.userId=this.server=this.token=this.expires=this.validity=this.resources=this.creationTime=null,this._oAuthCred&&(this._oAuthCred.destroy(),this._oAuthCred=null);const e=s.credentials.indexOf(this);e>-1&&s.credentials.splice(e,1),this.emitTokenChange(),this.emit("destroy")}toJSON(){const e=h({userId:this.userId,server:this.server,token:this.token,expires:this.expires,validity:this.validity,ssl:this.ssl,isAdmin:this.isAdmin,creationTime:this.creationTime,scope:this.scope}),t=this.resources;return t&&t.length>0&&(e.resources=t.slice()),e}_startRefreshTimer(){clearTimeout(this._refreshTimer);const e=6e4*this.tokenRefreshBuffer,t=2**31-1;let s=(this.validity?this.creationTime+6e4*this.validity:this.expires)-Date.now();s<0?s=0:s>t&&(s=t),this._refreshTimer=setTimeout(this.refreshToken.bind(this),s>e?s-e:s)}};e([k()],j.prototype,"creationTime",void 0),e([k()],j.prototype,"expires",void 0),e([k()],j.prototype,"isAdmin",void 0),e([k()],j.prototype,"oAuthState",void 0),e([k()],j.prototype,"resources",void 0),e([k()],j.prototype,"scope",void 0),e([k()],j.prototype,"server",void 0),e([k()],j.prototype,"ssl",void 0),e([k()],j.prototype,"token",void 0),e([k()],j.prototype,"tokenRefreshBuffer",void 0),e([k()],j.prototype,"userId",void 0),e([k()],j.prototype,"validity",void 0),j=e([A("esri.identity.Credential")],j);export{j as Credential,q as IdentityManagerBase};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../config.js";import{id as s}from"../kernel.js";import r from"../request.js";import i from"../core/Error.js";import n from"../core/Evented.js";import{on as o}from"../core/events.js";import a from"../core/global.js";import{fixJson as h}from"../core/lang.js";import{getDeepValue as l}from"../core/object.js";import{createResolver as c,onAbort as d,isAborted as u}from"../core/promiseUtils.js";import{Url as p,urlToObject as _,hasSameOrigin as f,queryToObject as g,normalize as m,getProxyRule as v,makeAbsolute as S,objectToQuery as w}from"../core/urlUtils.js";import{property as I}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import{subclass as k}from"../core/accessorSupport/decorators/subclass.js";import A from"./IdentityForm.js";import y from"./IdentityModal.js";import U from"./OAuthCredential.js";import T from"./OAuthInfo.js";import x from"./ServerInfo.js";const O={},R=e=>{const t=new p(e.owningSystemUrl).host,s=new p(e.server).host,r=/.+\.arcgis\.com$/i;return r.test(t)&&r.test(s)},b=(e,t)=>!!(R(e)&&t&&t.some((t=>t.test(e.server))));let C=null,P=null;try{C=window.localStorage,P=window.sessionStorage}catch{}class D extends n{constructor(){super(),this._portalConfig=a.esriGeowConfig,this.serverInfos=[],this.oAuthInfos=[],this.credentials=[],this._soReqs=[],this._xoReqs=[],this._portals=[],this.defaultOAuthInfo=null,this.defaultTokenValidity=60,this.dialog=null,this.formConstructor=A,this.tokenValidity=null,this.normalizeWebTierAuth=!1,this._appOrigin="null"!==window.origin?window.origin:window.location.origin,this._appUrlObj=_(window.location.href),this._busy=null,this._rejectOnPersistedPageShow=!1,this._oAuthHash=null,this._gwTokenUrl="/sharing/rest/generateToken",this._agsRest="/rest/services",this._agsPortal=/\/sharing(\/|$)/i,this._agsAdmin=/(https?:\/\/[^\/]+\/[^\/]+)\/admin\/?(\/.*)?$/i,this._adminSvcs=/\/rest\/admin\/services(\/|$)/i,this._gwDomains=[{regex:/^https?:\/\/www\.arcgis\.com/i,customBaseUrl:"maps.arcgis.com",tokenServiceUrl:"https://www.arcgis.com/sharing/rest/generateToken"},{regex:/^https?:\/\/(?:dev|[a-z\d-]+\.mapsdev)\.arcgis\.com/i,customBaseUrl:"mapsdev.arcgis.com",tokenServiceUrl:"https://dev.arcgis.com/sharing/rest/generateToken"},{regex:/^https?:\/\/(?:devext|[a-z\d-]+\.mapsdevext)\.arcgis\.com/i,customBaseUrl:"mapsdevext.arcgis.com",tokenServiceUrl:"https://devext.arcgis.com/sharing/rest/generateToken"},{regex:/^https?:\/\/(?:qaext|[a-z\d-]+\.mapsqa)\.arcgis\.com/i,customBaseUrl:"mapsqa.arcgis.com",tokenServiceUrl:"https://qaext.arcgis.com/sharing/rest/generateToken"},{regex:/^https?:\/\/[a-z\d-]+\.maps\.arcgis\.com/i,customBaseUrl:"maps.arcgis.com",tokenServiceUrl:"https://www.arcgis.com/sharing/rest/generateToken"}],this._legacyFed=[],this._regexSDirUrl=/http.+\/rest\/services\/?/gi,this._regexServerType=/(\/(FeatureServer|GPServer|GeoDataServer|GeocodeServer|GeoenrichmentServer|GeometryServer|GlobeServer|ImageServer|MapServer|MobileServer|NAServer|NetworkDiagramServer|OGCFeatureServer|ParcelFabricServer|RelationalCatalogServer|SceneServer|StreamServer|UtilityNetworkServer|ValidationServer|VectorTileServer|VersionManagementServer)).*/gi,this._gwUser=/http.+\/users\/([^\/]+)\/?.*/i,this._gwItem=/http.+\/items\/([^\/]+)\/?.*/i,this._gwGroup=/http.+\/groups\/([^\/]+)\/?.*/i,this._rePortalTokenSvc=/\/sharing(\/rest)?\/generatetoken/i,this._createDefaultOAuthInfo=!0,this._hasTestedIfAppIsOnPortal=!1,this._getOAuthHash(),window.addEventListener("pageshow",(e=>{this._pageShowHandler(e)}))}registerServers(e){const t=this.serverInfos;t?(e=e.filter((e=>!this.findServerInfo(e.server))),this.serverInfos=t.concat(e)):this.serverInfos=e,e.forEach((e=>{e.owningSystemUrl&&this._portals.push(e.owningSystemUrl),e.hasPortal&&this._portals.push(e.server)}))}registerOAuthInfos(e){const t=this.oAuthInfos;if(t){for(const s of e){const e=this.findOAuthInfo(s.portalUrl);e&&t.splice(t.indexOf(e),1)}this.oAuthInfos=t.concat(e)}else this.oAuthInfos=e}registerToken(e){e={...e};const t=this._sanitizeUrl(e.server),s=this._isServerRsrc(t);let r,i=this.findServerInfo(t),n=!0;i||(i=new x,i.server=this._getServerInstanceRoot(t),s?i.hasServer=!0:(i.tokenServiceUrl=this._getTokenSvcUrl(t),i.hasPortal=!0),this.registerServers([i])),r=this._findCredential(t),r?(delete e.server,Object.assign(r,e),n=!1):(r=new q({userId:e.userId,server:i.server,token:e.token,expires:e.expires,ssl:e.ssl,scope:s?"server":"portal"}),r.resources=[t],this.credentials.push(r)),r.emitTokenChange(!1),n||r.refreshServerTokens()}toJSON(){return h({serverInfos:this.serverInfos.map((e=>e.toJSON())),oAuthInfos:this.oAuthInfos.map((e=>e.toJSON())),credentials:this.credentials.map((e=>e.toJSON()))})}initialize(e){if(!e)return;"string"==typeof e&&(e=JSON.parse(e));const t=e.serverInfos,s=e.oAuthInfos,r=e.credentials;if(t){const e=[];t.forEach((t=>{t.server&&t.tokenServiceUrl&&e.push(t.declaredClass?t:new x(t))})),e.length&&this.registerServers(e)}if(s){const e=[];s.forEach((t=>{t.appId&&e.push(t.declaredClass?t:new T(t))})),e.length&&this.registerOAuthInfos(e)}r&&r.forEach((e=>{e.server&&e.token&&e.expires&&e.expires>Date.now()&&((e=e.declaredClass?e:new q(e)).emitTokenChange(),this.credentials.push(e))}))}findServerInfo(e){let t;e=this._sanitizeUrl(e);for(const s of this.serverInfos)if(this._hasSameServerInstance(s.server,e)){t=s;break}return t}findOAuthInfo(e){let t;e=this._sanitizeUrl(e);for(const s of this.oAuthInfos)if(this._hasSameServerInstance(s.portalUrl,e)){t=s;break}return t}findCredential(e,t){let s;e=this._sanitizeUrl(e);const r=this._isServerRsrc(e)?"server":"portal";if(t){for(const i of this.credentials)if(this._hasSameServerInstance(i.server,e)&&t===i.userId&&i.scope===r){s=i;break}}else for(const i of this.credentials)if(this._hasSameServerInstance(i.server,e)&&-1!==this._getIdenticalSvcIdx(e,i)&&i.scope===r){s=i;break}return s}getCredential(e,t){let s,r,n=!0;t&&(s=!!t.token,r=t.error,n=!1!==t.prompt),t={...t},e=this._sanitizeUrl(e);const o=new AbortController,a=c();if(t.signal&&d(t.signal,(()=>{o.abort()})),d(o,(()=>{a.reject(new i("identity-manager:user-aborted","ABORTED"))})),u(o))return a.promise;t.signal=o.signal;const h=this._isAdminResource(e),l=s?this.findCredential(e):null;let p;if(l&&r&&r.details&&498===r.details.httpStatus)l.destroy();else if(l)return p=new i("identity-manager:not-authorized","You are currently signed in as: '"+l.userId+"'. You do not have access to this resource: "+e,{error:r}),a.reject(p),a.promise;const _=this._findCredential(e,t);if(_)return a.resolve(_),a.promise;let g=this.findServerInfo(e);if(g)!g.hasServer&&this._isServerRsrc(e)&&(g._restInfoPms=this._getTokenSvcUrl(e),g.hasServer=!0);else{const t=this._getTokenSvcUrl(e);if(!t)return p=new i("identity-manager:unknown-resource","Unknown resource - could not find token service endpoint."),a.reject(p),a.promise;g=new x,g.server=this._getServerInstanceRoot(e),"string"==typeof t?(g.tokenServiceUrl=t,g.hasPortal=!0):(g._restInfoPms=t,g.hasServer=!0),this.registerServers([g])}return g.hasPortal&&void 0===g._selfReq&&(n||f(g.tokenServiceUrl,this._appOrigin)||this._gwDomains.some((e=>e.tokenServiceUrl===g.tokenServiceUrl)))&&(g._selfReq={owningTenant:t&&t.owningTenant,selfDfd:this._getPortalSelf(g.tokenServiceUrl.replace(this._rePortalTokenSvc,"/sharing/rest/portals/self"),e)}),this._enqueue(e,g,t,a,h)}getResourceName(e){return this._isRESTService(e)?e.replace(this._regexSDirUrl,"").replace(this._regexServerType,"")||"":this._gwUser.test(e)&&e.replace(this._gwUser,"$1")||this._gwItem.test(e)&&e.replace(this._gwItem,"$1")||this._gwGroup.test(e)&&e.replace(this._gwGroup,"$1")||""}generateToken(e,t,s){const n=this._rePortalTokenSvc.test(e.tokenServiceUrl),o=new p(this._appOrigin),a=e.shortLivedTokenValidity;let h,l,c,d,u,_,g,m;t&&(m=this.tokenValidity||a||this.defaultTokenValidity,m>a&&a>0&&(m=a)),s&&(h=s.isAdmin,l=s.serverUrl,c=s.token,_=s.signal,g=s.ssl,e.customParameters=s.customParameters),h?d=e.adminTokenServiceUrl:(d=e.tokenServiceUrl,u=new p(d.toLowerCase()),e.webTierAuth&&null!=s&&s.serverUrl&&!g&&"http"===o.scheme&&(f(o.uri,d,!0)||"https"===u.scheme&&o.host===u.host&&"7080"===o.port&&"7443"===u.port)&&(d=d.replace(/^https:/i,"http:").replace(/:7443/i,":7080")));const v={query:{request:"getToken",username:null==t?void 0:t.username,password:null==t?void 0:t.password,serverUrl:l,token:c,expiration:m,referer:h||n?this._appOrigin:null,client:h?"referer":null,f:"json",...e.customParameters},method:"post",authMode:"anonymous",useProxy:this._useProxy(e,s),signal:_,...null==s?void 0:s.ioArgs};n||(v.withCredentials=!1);return r(d,v).then((s=>{const r=s.data;if(!r||!r.token)return new i("identity-manager:authentication-failed","Unable to generate token");const n=e.server;return O[n]||(O[n]={}),t&&(O[n][t.username]=t.password),r.validity=m,r}))}isBusy(){return!!this._busy}checkSignInStatus(e){return this.checkAppAccess(e,"").then((e=>e.credential))}checkAppAccess(e,t,s){let n=!1;return this.getCredential(e,{prompt:!1}).then((o=>{let a;const h={f:"json"};if("portal"===o.scope)if(t&&(this._doPortalSignIn(e)||s&&s.force))a=o.server+"/sharing/rest/oauth2/validateAppAccess",h.client_id=t;else{if(!o.token)return{credential:o};a=o.server+"/sharing/rest"}else{if(!o.token)return{credential:o};a=o.server+"/rest/services"}return o.token&&(h.token=o.token),r(a,{query:h,authMode:"anonymous"}).then((e=>{if(!1===e.data.valid)throw new i("identity-manager:not-authorized",`You are currently signed in as: '${o.userId}'.`,e.data);return n=!!e.data.viewOnlyUserTypeApp,{credential:o}})).catch((e=>{if("identity-manager:not-authorized"===e.name)throw e;const t=e.details&&e.details.httpStatus;if(498===t)throw o.destroy(),new i("identity-manager:not-authenticated","User is not signed in.");if(400===t)throw new i("identity-manager:invalid-request");return{credential:o}}))})).then((e=>({credential:e.credential,viewOnly:n})))}setOAuthResponseHash(e){var t;const s=this._oAuthDfd;if(this._oAuthDfd=null,!s||!e)return;clearInterval(this._oAuthIntervalId),null==(t=this._oAuthOnHashHandle)||t.remove(),"#"===e.charAt(0)&&(e=e.substring(1));const r=g(e);if(r.error){const e="access_denied"===r.error,t=new i(e?"identity-manager:user-aborted":"identity-manager:authentication-failed",e?"ABORTED":"OAuth: "+r.error+" - "+r.error_description);s.reject(t)}else{const e=s.sinfo_,t=s.oinfo_,i=t._oAuthCred,n=new q({userId:r.username,server:e.server,token:r.access_token,expires:Date.now()+1e3*Number(r.expires_in),ssl:"true"===r.ssl,_oAuthCred:i});t.userId=n.userId,i.storage=r.persist?C:P,i.token=n.token,i.expires=n.expires,i.userId=n.userId,i.ssl=n.ssl,i.save(),s.resolve(n)}}setOAuthRedirectionHandler(e){this._oAuthRedirectFunc=e}setProtocolErrorHandler(e){this._protocolFunc=e}signIn(e,t,s={}){const r=c(),n=()=>{var e,t,s,r,i;null==(e=h)||e.remove(),null==(t=l)||t.remove(),null==(s=u)||s.remove(),null==(r=a)||r.destroy(),null==(i=this.dialog)||i.destroy(),this.dialog=a=h=l=u=null},o=()=>{n(),this._oAuthDfd=null,r.reject(new i("identity-manager:user-aborted","ABORTED"))};s.signal&&d(s.signal,(()=>{o()}));let a=new this.formConstructor;a.resource=this.getResourceName(e),a.server=t.server,this.dialog=new y,this.dialog.content=a,this.dialog.open=!0,this.emit("dialog-create");let h=a.on("cancel",o),l=this.dialog.watch("open",o),u=a.on("submit",(e=>{this.generateToken(t,e,{isAdmin:s.isAdmin,signal:s.signal}).then((i=>{n();const o=new q({userId:e.username,server:t.server,token:i.token,expires:null!=i.expires?Number(i.expires):null,ssl:!!i.ssl,isAdmin:s.isAdmin,validity:i.validity});r.resolve(o)})).catch((e=>{a.error=e,a.signingIn=!1}))}));return r.promise}oAuthSignIn(e,t,s,r){this._oAuthDfd=c();const n=this._oAuthDfd;null!=r&&r.signal&&d(r.signal,(()=>{const e=this._oAuthDfd&&this._oAuthDfd.oAuthWin_;e&&!e.closed?e.close():this.dialog&&h()})),n.resUrl_=e,n.sinfo_=t,n.oinfo_=s;const o=!r||!1!==r.oAuthPopupConfirmation;if(!s.popup||!o)return this._doOAuthSignIn(e,t,s),n.promise;const a=new this.formConstructor;a.oAuthPrompt=!0,a.server=t.server,this.dialog=new y,this.dialog.content=a,this.dialog.open=!0,this.emit("dialog-create");const h=()=>{_(),this._oAuthDfd=null,n.reject(new i("identity-manager:user-aborted","ABORTED"))},l=a.on("cancel",h),u=this.dialog.watch("open",h),p=a.on("submit",(()=>{_(),this._doOAuthSignIn(e,t,s)})),_=()=>{l.remove(),u.remove(),p.remove(),a.destroy(),this.dialog.destroy(),this.dialog=null};return n.promise}destroyCredentials(){if(this.credentials){this.credentials.slice().forEach((e=>{e.destroy()}))}this.emit("credentials-destroy")}enablePostMessageAuth(e="https://www.arcgis.com/sharing/rest"){this._postMessageAuthHandle&&this._postMessageAuthHandle.remove(),this._postMessageAuthHandle=o(window,"message",(t=>{var s;if((t.origin===this._appOrigin||t.origin.endsWith(".arcgis.com"))&&"arcgis:auth:requestCredential"===(null==(s=t.data)?void 0:s.type)){const s=t.source;this.getCredential(e).then((e=>{s.postMessage({type:"arcgis:auth:credential",credential:{expires:e.expires,server:e.server,ssl:e.ssl,token:e.token,userId:e.userId}},t.origin)})).catch((e=>{s.postMessage({type:"arcgis:auth:error",error:{name:e.name,message:e.message}},t.origin)}))}}))}disablePostMessageAuth(){this._postMessageAuthHandle&&(this._postMessageAuthHandle.remove(),this._postMessageAuthHandle=null)}_getOAuthHash(){let e=window.location.hash;if(e){"#"===e.charAt(0)&&(e=e.substring(1));const t=g(e);let s=!1;if(t.access_token&&t.expires_in&&t.state&&t.hasOwnProperty("username"))try{t.state=JSON.parse(t.state),"object"==typeof t.state&&t.state.portalUrl&&(this._oAuthHash=t,s=!0)}catch{}else t.error&&t.error_description&&(console.log("IdentityManager OAuth Error: ",t.error," - ",t.error_description),"access_denied"===t.error&&(s=!0));s&&(window.location.hash="object"==typeof t.state&&t.state.hash||"")}}_pageShowHandler(e){if(e.persisted&&this.isBusy()&&this._rejectOnPersistedPageShow){const e=new i("identity-manager:user-aborted","ABORTED");this._errbackFunc(e)}}_findCredential(e,t){let s,r,i,n,o=-1;const a=t&&t.token,h=t&&t.resource,l=this._isServerRsrc(e)?"server":"portal",c=this.credentials.filter((t=>this._hasSameServerInstance(t.server,e)&&t.scope===l));if(e=h||e,c.length)if(1===c.length){if(s=c[0],n=this.findServerInfo(s.server),r=n&&n.owningSystemUrl,i=r&&this.findCredential(r,s.userId),o=this._getIdenticalSvcIdx(e,s),!a)return-1===o&&s.resources.push(e),this._addResource(e,i),s;-1!==o&&(s.resources.splice(o,1),this._removeResource(e,i))}else{let t,s;if(c.some((a=>(s=this._getIdenticalSvcIdx(e,a),-1!==s&&(t=a,n=this.findServerInfo(t.server),r=n&&n.owningSystemUrl,i=r&&this.findCredential(r,t.userId),o=s,!0)))),a)t&&(t.resources.splice(o,1),this._removeResource(e,i));else if(t)return this._addResource(e,i),t}}_findOAuthInfo(e){let t=this.findOAuthInfo(e);if(!t)for(const s of this.oAuthInfos)if(this._isIdProvider(s.portalUrl,e)){t=s;break}return t}_addResource(e,t){t&&-1===this._getIdenticalSvcIdx(e,t)&&t.resources.push(e)}_removeResource(e,t){let s=-1;t&&(s=this._getIdenticalSvcIdx(e,t),s>-1&&t.resources.splice(s,1))}_useProxy(e,t){return t&&t.isAdmin&&!f(e.adminTokenServiceUrl,this._appOrigin)||!this._isPortalDomain(e.tokenServiceUrl)&&"10.1"===String(e.currentVersion)&&!f(e.tokenServiceUrl,this._appOrigin)}_getOrigin(e){const t=new p(e);return t.scheme+"://"+t.host+(null!=t.port?":"+t.port:"")}_getServerInstanceRoot(e){const t=e.toLowerCase();let s=t.indexOf(this._agsRest);return-1===s&&this._isAdminResource(e)&&(s=this._agsAdmin.test(e)?e.replace(this._agsAdmin,"$1").length:e.search(this._adminSvcs)),-1===s&&(s=t.indexOf("/sharing")),-1===s&&"/"===t.substr(-1)&&(s=t.length-1),s>-1?e.substring(0,s):e}_hasSameServerInstance(e,t){return"/"===e.substr(-1)&&(e=e.slice(0,-1)),e=e.toLowerCase(),t=this._getServerInstanceRoot(t).toLowerCase(),e=this._normalizeAGOLorgDomain(e),t=this._normalizeAGOLorgDomain(t),(e=e.substr(e.indexOf(":")))===(t=t.substr(t.indexOf(":")))}_normalizeAGOLorgDomain(e){const t=/^https?:\/\/(?:cdn|[a-z\d-]+\.maps)\.arcgis\.com/i,s=/^https?:\/\/(?:cdndev|[a-z\d-]+\.mapsdevext)\.arcgis\.com/i,r=/^https?:\/\/(?:cdnqa|[a-z\d-]+\.mapsqa)\.arcgis\.com/i;return t.test(e)?e=e.replace(t,"https://www.arcgis.com"):s.test(e)?e=e.replace(s,"https://devext.arcgis.com"):r.test(e)&&(e=e.replace(r,"https://qaext.arcgis.com")),e}_sanitizeUrl(e){const s=(t.request.proxyUrl||"").toLowerCase(),r=s?e.toLowerCase().indexOf(s+"?"):-1;return-1!==r&&(e=e.substring(r+s.length+1)),e=m(e),_(e).path}_isRESTService(e){return e.indexOf(this._agsRest)>-1}_isAdminResource(e){return this._agsAdmin.test(e)||this._adminSvcs.test(e)}_isServerRsrc(e){return this._isRESTService(e)||this._isAdminResource(e)}_isIdenticalService(e,t){let s;if(this._isRESTService(e)&&this._isRESTService(t)){const r=this._getSuffix(e).toLowerCase(),i=this._getSuffix(t).toLowerCase();if(s=r===i,!s){const e=/(.*)\/(MapServer|FeatureServer|UtilityNetworkServer).*/gi;s=r.replace(e,"$1")===i.replace(e,"$1")}}else this._isAdminResource(e)&&this._isAdminResource(t)?s=!0:this._isServerRsrc(e)||this._isServerRsrc(t)||!this._isPortalDomain(e)||(s=!0);return s}_isPortalDomain(e){const s=new p(e.toLowerCase()),r=this._portalConfig;let i=this._gwDomains.some((e=>e.regex.test(s.uri)));return!i&&r&&(i=this._hasSameServerInstance(this._getServerInstanceRoot(r.restBaseUrl),s.uri)),i||t.portalUrl&&(i=f(s,t.portalUrl,!0)),i||(i=this._portals.some((e=>this._hasSameServerInstance(e,s.uri)))),i=i||this._agsPortal.test(s.path),i}_isIdProvider(e,t){let s=-1,r=-1;this._gwDomains.forEach(((i,n)=>{-1===s&&i.regex.test(e)&&(s=n),-1===r&&i.regex.test(t)&&(r=n)}));let i=!1;if(s>-1&&r>-1&&(0===s||4===s?0!==r&&4!==r||(i=!0):1===s?1!==r&&2!==r||(i=!0):2===s?2===r&&(i=!0):3===s&&3===r&&(i=!0)),!i){const s=this.findServerInfo(t),r=s&&s.owningSystemUrl;r&&R(s)&&this._isPortalDomain(r)&&this._isIdProvider(e,r)&&(i=!0)}return i}_getIdenticalSvcIdx(e,t){let s=-1;for(let r=0;r<t.resources.length;r++){const i=t.resources[r];if(this._isIdenticalService(e,i)){s=r;break}}return s}_getSuffix(e){return e.replace(this._regexSDirUrl,"").replace(this._regexServerType,"$1")}_getTokenSvcUrl(e){let t,s,i;if(this._isRESTService(e)||this._isAdminResource(e)){const i=this._getServerInstanceRoot(e);return t=i+"/admin/generateToken",s=r(e=i+"/rest/info",{query:{f:"json"}}).then((e=>e.data)),{adminUrl:t,promise:s}}if(this._isPortalDomain(e)){let t="";if(this._gwDomains.some((s=>(s.regex.test(e)&&(t=s.tokenServiceUrl),!!t))),t||this._portals.some((s=>(this._hasSameServerInstance(s,e)&&(t=s+this._gwTokenUrl),!!t))),t||(i=e.toLowerCase().indexOf("/sharing"),-1!==i&&(t=e.substring(0,i)+this._gwTokenUrl)),t||(t=this._getOrigin(e)+this._gwTokenUrl),t){const s=new p(e).port;/^http:\/\//i.test(e)&&"7080"===s&&(t=t.replace(/:7080/i,":7443")),t=t.replace(/http:/i,"https:")}return t}if(-1!==e.toLowerCase().indexOf("premium.arcgisonline.com"))return"https://premium.arcgisonline.com/server/tokens"}_exchangeToken(e,t,s){return r(`${e}/sharing/rest/oauth2/exchangeToken`,{authMode:"anonymous",method:"post",query:{f:"json",client_id:t,token:s}}).then((e=>e.data.token))}_getPlatformSelf(e,t){return e=e.replace(/^http:/i,"https:"),r(`${e}/sharing/rest/oauth2/platformSelf`,{authMode:"anonymous",headers:{"X-Esri-Auth-Client-Id":t,"X-Esri-Auth-Redirect-Uri":window.location.href.replace(/#.*$/,"")},method:"post",query:{f:"json"},withCredentials:!0}).then((e=>e.data))}_getPortalSelf(e,t){let s;if(this._gwDomains.some((t=>(t.regex.test(e)&&(s=t.customBaseUrl),!!s))),s)return Promise.resolve({allSSL:!0,currentVersion:"4.4",customBaseUrl:s,portalMode:"multitenant",supportsOAuth:!0});this._appOrigin.startsWith("https:")?e=e.replace(/^http:/i,"https:").replace(/:7080/i,":7443"):/^http:/i.test(t)&&(e=e.replace(/^https:/i,"http:").replace(/:7443/i,":7080"));return r(e,{query:{f:"json"},authMode:"anonymous",withCredentials:!0}).then((e=>e.data))}_doPortalSignIn(e){const t=this._portalConfig,s=window.location.href,r=this.findServerInfo(e);return!(!t&&!this._isPortalDomain(s)||!(r?r.hasPortal||r.owningSystemUrl&&this._isPortalDomain(r.owningSystemUrl):this._isPortalDomain(e))||!(this._isIdProvider(s,e)||t&&(this._hasSameServerInstance(this._getServerInstanceRoot(t.restBaseUrl),e)||this._isIdProvider(t.restBaseUrl,e))||f(s,e,!0)))}_checkProtocol(e,t,s,r){let n=!0;const o=r?t.adminTokenServiceUrl:t.tokenServiceUrl;if(o.trim().toLowerCase().startsWith("https:")&&!this._appOrigin.startsWith("https:")&&v(o)&&(n=!!this._protocolFunc&&!!this._protocolFunc({resourceUrl:e,serverInfo:t}),!n)){s(new i("identity-manager:aborted","Aborted the Sign-In process to avoid sending password over insecure connection."))}return n}_enqueue(e,t,s,r,i,n){return r||(r=c()),r.resUrl_=e,r.sinfo_=t,r.options_=s,r.admin_=i,r.refresh_=n,this._busy?this._hasSameServerInstance(this._getServerInstanceRoot(e),this._busy.resUrl_)?(this._oAuthDfd&&this._oAuthDfd.oAuthWin_&&this._oAuthDfd.oAuthWin_.focus(),this._soReqs.push(r)):this._xoReqs.push(r):this._doSignIn(r),r.promise}_doSignIn(e){this._busy=e,this._rejectOnPersistedPageShow=!1;const t=t=>{const s=e.options_&&e.options_.resource,r=e.resUrl_,i=e.refresh_;let n=!1;-1===this.credentials.indexOf(t)&&(i&&-1!==this.credentials.indexOf(i)?(i.userId=t.userId,i.token=t.token,i.expires=t.expires,i.validity=t.validity,i.ssl=t.ssl,i.creationTime=t.creationTime,n=!0,t=i):this.credentials.push(t)),t.resources||(t.resources=[]),t.resources.push(s||r),t.scope=this._isServerRsrc(r)?"server":"portal",t.emitTokenChange();const o=this._soReqs,a={};this._soReqs=[],o.forEach((e=>{if(!this._isIdenticalService(r,e.resUrl_)){const s=this._getSuffix(e.resUrl_);a[s]||(a[s]=!0,t.resources.push(e.resUrl_))}})),e.resolve(t),o.forEach((e=>{this._hasSameServerInstance(this._getServerInstanceRoot(r),e.resUrl_)?e.resolve(t):this._soReqs.push(e)})),this._busy=e.resUrl_=e.sinfo_=e.refresh_=null,n||this.emit("credential-create",{credential:t}),this._soReqs.length?this._doSignIn(this._soReqs.shift()):this._xoReqs.length&&this._doSignIn(this._xoReqs.shift())},s=t=>{e.reject(t),this._busy=e.resUrl_=e.sinfo_=e.refresh_=null,this._soReqs.length?this._doSignIn(this._soReqs.shift()):this._xoReqs.length&&this._doSignIn(this._xoReqs.shift())},r=(r,n,a,h)=>{var l,c;const u=e.sinfo_,p=!e.options_||!1!==e.options_.prompt,_=u.hasPortal&&this._findOAuthInfo(e.resUrl_);let g,m;if(r)t(new q({userId:r,server:u.server,token:a||null,expires:null!=h?Number(h):null,ssl:!!n}));else if(window!==window.parent&&null!=(l=this._appUrlObj.query)&&l["arcgis-auth-origin"]&&null!=(c=this._appUrlObj.query)&&c["arcgis-auth-portal"]&&this._hasSameServerInstance(this._getServerInstanceRoot(this._appUrlObj.query["arcgis-auth-portal"]),e.resUrl_)){var v;window.parent.postMessage({type:"arcgis:auth:requestCredential"},this._appUrlObj.query["arcgis-auth-origin"]);const r=o(window,"message",(e=>{e.source===window.parent&&e.data&&("arcgis:auth:credential"===e.data.type?(r.remove(),t(new q(e.data.credential))):"arcgis:auth:error"===e.data.type&&(r.remove(),s(i.fromJSON(e.data.error))))}));d(null==(v=e.options_)?void 0:v.signal,(()=>{r.remove()}))}else if(_){let r=_._oAuthCred;if(!r){const e=new U(_,C),t=new U(_,P);e.isValid()&&t.isValid()?e.expires>t.expires?(r=e,t.destroy()):(r=t,e.destroy()):r=e.isValid()?e:t,_._oAuthCred=r}if(r.isValid())g=new q({userId:r.userId,server:u.server,token:r.token,expires:r.expires,ssl:r.ssl,_oAuthCred:r}),_.appId!==r.appId&&this._doPortalSignIn(e.resUrl_)?e._pendingDfd=this._exchangeToken(g.server,_.appId,g.token).then((e=>{g.token=e,r.token=e,r.save(),t(g)})).catch((()=>{t(g)})):t(g);else if(this._oAuthHash&&this._hasSameServerInstance(_.portalUrl,this._oAuthHash.state.portalUrl)){const e=this._oAuthHash;g=new q({userId:e.username,server:u.server,token:e.access_token,expires:Date.now()+1e3*Number(e.expires_in),ssl:"true"===e.ssl,oAuthState:e.state,_oAuthCred:r}),_.userId=g.userId,r.storage=e.persist?C:P,r.token=g.token,r.expires=g.expires,r.userId=g.userId,r.ssl=g.ssl,r.save(),this._oAuthHash=null,t(g)}else{const r=()=>{p?e._pendingDfd=this.oAuthSignIn(e.resUrl_,u,_,e.options_).then(t,s):(m=new i("identity-manager:not-authenticated","User is not signed in."),s(m))};this._doPortalSignIn(e.resUrl_)?e._pendingDfd=this._getPlatformSelf(u.server,_.appId).then((({portalUrl:e,token:s,username:i})=>{!e||f(e,this._appOrigin,!0)?(g=new q({server:u.server,userId:i,token:s}),t(g)):r()})).catch(r):r()}}else if(p){if(this._checkProtocol(e.resUrl_,u,s,e.admin_)){let r=e.options_;e.admin_&&(r=r||{},r.isAdmin=!0),e._pendingDfd=this.signIn(e.resUrl_,u,r).then(t,s)}}else m=new i("identity-manager:not-authenticated","User is not signed in."),s(m)},n=()=>{const r=e.sinfo_,i=r.owningSystemUrl,n=e.options_;let o,a,h,l;if(n&&(o=n.token,a=n.error,h=n.prompt),l=this._findCredential(i,{token:o,resource:e.resUrl_}),!l)for(const e of this.credentials)if(this._isIdProvider(i,e.server)){l=e;break}if(l){const i=this.findCredential(e.resUrl_,l.userId);if(i)t(i);else if(b(r,this._legacyFed)){const e=l.toJSON();e.server=r.server,e.resources=null,t(new q(e))}else{(e._pendingDfd=this.generateToken(this.findServerInfo(l.server),null,{serverUrl:e.resUrl_,token:l.token,signal:e.options_.signal,ssl:l.ssl})).then((s=>{t(new q({userId:l.userId,server:r.server,token:s.token,expires:null!=s.expires?Number(s.expires):null,ssl:!!s.ssl,isAdmin:e.admin_,validity:s.validity}))}),s)}}else{this._busy=null,o&&(e.options_.token=null);(e._pendingDfd=this.getCredential(i.replace(/\/?$/,"/sharing"),{resource:e.resUrl_,owningTenant:r.owningTenant,signal:e.options_.signal,token:o,error:a,prompt:h})).then((()=>{this._enqueue(e.resUrl_,e.sinfo_,e.options_,e,e.admin_)}),(t=>{e.resUrl_=e.sinfo_=e.refresh_=null,e.reject(t)}))}};this._errbackFunc=s;const a=e.sinfo_.owningSystemUrl,h=this._isServerRsrc(e.resUrl_),c=e.sinfo_._restInfoPms;c?c.promise.then((t=>{const s=e.sinfo_;if(s._restInfoPms){s.adminTokenServiceUrl=s._restInfoPms.adminUrl,s._restInfoPms=null,s.tokenServiceUrl=l("authInfo.tokenServicesUrl",t)||l("authInfo.tokenServiceUrl",t)||l("tokenServiceUrl",t),s.shortLivedTokenValidity=l("authInfo.shortLivedTokenValidity",t),s.currentVersion=t.currentVersion,s.owningTenant=t.owningTenant;const e=s.owningSystemUrl=t.owningSystemUrl;e&&this._portals.push(e)}h&&s.owningSystemUrl?n():r()}),(()=>{e.sinfo_._restInfoPms=null;const t=new i("identity-manager:server-identification-failed","Unknown resource - could not find token service endpoint.");s(t)})):h&&a?n():e.sinfo_._selfReq?e.sinfo_._selfReq.selfDfd.then((t=>{const s={};let r,i,n,o;return t&&(r=t.user&&t.user.username,s.username=r,s.allSSL=t.allSSL,i=t.supportsOAuth,n=t.currentVersion,"multitenant"===t.portalMode&&(o=t.customBaseUrl)),e.sinfo_.webTierAuth=!!r,r&&this.normalizeWebTierAuth?this.generateToken(e.sinfo_,null,{ssl:s.allSSL}).catch((()=>null)).then((e=>(s.portalToken=e&&e.token,s.tokenExpiration=e&&e.expires,s))):!r&&i&&parseFloat(n)>=4.4&&!this._findOAuthInfo(e.resUrl_)?this._generateOAuthInfo({portalUrl:e.sinfo_.server,customBaseUrl:o,owningTenant:e.sinfo_._selfReq.owningTenant}).catch((()=>null)).then((()=>s)):s})).catch((()=>null)).then((t=>{e.sinfo_._selfReq=null,t?r(t.username,t.allSSL,t.portalToken,t.tokenExpiration):r()})):r()}_generateOAuthInfo(e){let t,s,i=e.portalUrl;const n=e.customBaseUrl,o=e.owningTenant,a=!this.defaultOAuthInfo&&this._createDefaultOAuthInfo&&!this._hasTestedIfAppIsOnPortal;if(a){s=window.location.href;let e=s.indexOf("?");e>-1&&(s=s.slice(0,e)),e=s.search(/\/(apps|home)\//),s=e>-1?s.slice(0,e):null}return a&&s?(this._hasTestedIfAppIsOnPortal=!0,t=r(s+"/sharing/rest",{query:{f:"json"}}).then((()=>{this.defaultOAuthInfo=new T({appId:"arcgisonline",popupCallbackUrl:s+"/home/oauth-callback.html"})}))):t=Promise.resolve(),t.then((()=>{if(this.defaultOAuthInfo)return i=i.replace(/^http:/i,"https:"),r(i+"/sharing/rest/oauth2/validateRedirectUri",{query:{accountId:o,client_id:this.defaultOAuthInfo.appId,redirect_uri:S(this.defaultOAuthInfo.popupCallbackUrl),f:"json"}}).then((e=>{if(e.data.valid){const t=this.defaultOAuthInfo.clone();e.data.urlKey&&n?t.portalUrl="https://"+e.data.urlKey.toLowerCase()+"."+n:t.portalUrl=i,t.popup=window!==window.top||!(f(i,this._appOrigin)||this._gwDomains.some((e=>e.regex.test(i)&&e.regex.test(this._appOrigin)))),this.oAuthInfos.push(t)}}))}))}_doOAuthSignIn(e,t,s){const r={portalUrl:s.portalUrl};!s.popup&&s.preserveUrlHash&&window.location.hash&&(r.hash=window.location.hash);const n={client_id:s.appId,response_type:"token",state:JSON.stringify(r),expiration:s.expiration,locale:s.locale,redirect_uri:s.popup?S(s.popupCallbackUrl):window.location.href.replace(/#.*$/,"")};s.forceLogin&&(n.force_login=!0),s.forceUserId&&s.userId&&(n.prepopulatedusername=s.userId),!s.popup&&this._doPortalSignIn(e)&&(n.redirectToUserOrgUrl=!0);const h=s.portalUrl.replace(/^http:/i,"https:")+"/sharing/oauth2/authorize",l=h+"?"+w(n);if(s.popup){const e=window.open(l,"esriJSAPIOAuth",s.popupWindowFeatures);if(e)e.focus(),this._oAuthDfd.oAuthWin_=e,this._oAuthIntervalId=setInterval((()=>{if(e.closed){clearInterval(this._oAuthIntervalId),this._oAuthOnHashHandle.remove();const e=this._oAuthDfd;if(e){const t=new i("identity-manager:user-aborted","ABORTED");e.reject(t)}}}),500),this._oAuthOnHashHandle=o(a,"arcgis:auth:hash",(e=>{this.setOAuthResponseHash(e.detail)}));else{const e=new i("identity-manager:popup-blocked","ABORTED");this._oAuthDfd.reject(e)}}else this._rejectOnPersistedPageShow=!0,this._oAuthRedirectFunc?this._oAuthRedirectFunc({authorizeParams:n,authorizeUrl:h,resourceUrl:e,serverInfo:t,oAuthInfo:s}):window.location.href=l}}D.prototype.declaredClass="esri.identity.IdentityManagerBase";let q=class extends n.EventedAccessor{constructor(e){super(e),this._oAuthCred=null,this.tokenRefreshBuffer=2,e&&e._oAuthCred&&(this._oAuthCred=e._oAuthCred)}initialize(){this.resources=this.resources||[],null==this.creationTime&&(this.creationTime=Date.now())}refreshToken(){const e=s.findServerInfo(this.server),t=e&&e.owningSystemUrl,r=!!t&&"server"===this.scope,i=r&&b(e,s._legacyFed),n=e.webTierAuth,o=n&&s.normalizeWebTierAuth,a=O[this.server],h=a&&a[this.userId];let l,c=this.resources&&this.resources[0],d=r&&s.findServerInfo(t),u={username:this.userId,password:h};if(n&&!o)return;r&&!d&&s.serverInfos.some((e=>(s._isIdProvider(t,e.server)&&(d=e),!!d)));const p=d&&s.findCredential(d.server,this.userId);if(!r||p){if(!i){if(r)l={serverUrl:c,token:p&&p.token,ssl:p&&p.ssl};else if(o)u=null,l={ssl:this.ssl};else{if(!h){let t;return c&&(c=s._sanitizeUrl(c),this._enqueued=1,t=s._enqueue(c,e,null,null,this.isAdmin,this),t.then((()=>{this._enqueued=0,this.refreshServerTokens()})).catch((()=>{this._enqueued=0}))),t}this.isAdmin&&(l={isAdmin:!0})}return s.generateToken(r?d:e,r?null:u,l).then((e=>{this.token=e.token,this.expires=null!=e.expires?Number(e.expires):null,this.creationTime=Date.now(),this.validity=e.validity,this.emitTokenChange(),this.refreshServerTokens()})).catch((()=>{}))}p.refreshToken()}}refreshServerTokens(){"portal"===this.scope&&s.credentials.forEach((e=>{const t=s.findServerInfo(e.server),r=t&&t.owningSystemUrl;e!==this&&e.userId===this.userId&&r&&"server"===e.scope&&(s._hasSameServerInstance(this.server,r)||s._isIdProvider(r,this.server))&&(b(t,s._legacyFed)?(e.token=this.token,e.expires=this.expires,e.creationTime=this.creationTime,e.validity=this.validity,e.emitTokenChange()):e.refreshToken())}))}emitTokenChange(e){clearTimeout(this._refreshTimer);const t=this.server&&s.findServerInfo(this.server),r=t&&t.owningSystemUrl,i=r&&s.findServerInfo(r);!1===e||r&&"portal"!==this.scope&&(!i||!i.webTierAuth||s.normalizeWebTierAuth)||null==this.expires&&null==this.validity||this._startRefreshTimer(),this.emit("token-change")}destroy(){this.userId=this.server=this.token=this.expires=this.validity=this.resources=this.creationTime=null,this._oAuthCred&&(this._oAuthCred.destroy(),this._oAuthCred=null);const e=s.credentials.indexOf(this);e>-1&&s.credentials.splice(e,1),this.emitTokenChange(),this.emit("destroy")}toJSON(){const e=h({userId:this.userId,server:this.server,token:this.token,expires:this.expires,validity:this.validity,ssl:this.ssl,isAdmin:this.isAdmin,creationTime:this.creationTime,scope:this.scope}),t=this.resources;return t&&t.length>0&&(e.resources=t.slice()),e}_startRefreshTimer(){clearTimeout(this._refreshTimer);const e=6e4*this.tokenRefreshBuffer,t=2**31-1;let s=(this.validity?this.creationTime+6e4*this.validity:this.expires)-Date.now();s<0?s=0:s>t&&(s=t),this._refreshTimer=setTimeout(this.refreshToken.bind(this),s>e?s-e:s)}};e([I()],q.prototype,"creationTime",void 0),e([I()],q.prototype,"expires",void 0),e([I()],q.prototype,"isAdmin",void 0),e([I()],q.prototype,"oAuthState",void 0),e([I()],q.prototype,"resources",void 0),e([I()],q.prototype,"scope",void 0),e([I()],q.prototype,"server",void 0),e([I()],q.prototype,"ssl",void 0),e([I()],q.prototype,"token",void 0),e([I()],q.prototype,"tokenRefreshBuffer",void 0),e([I()],q.prototype,"userId",void 0),e([I()],q.prototype,"validity",void 0),q=e([k("esri.identity.Credential")],q);export{q as Credential,D as IdentityManagerBase};