@arcgis/core 4.24.0-next.20220329 → 4.24.0-next.20220401

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 (456) hide show
  1. package/PopupTemplate.js +1 -1
  2. package/WebMap.js +1 -1
  3. package/WebScene.js +1 -1
  4. package/analysis/LineOfSightAnalysisObserver.js +1 -1
  5. package/analysis/LineOfSightAnalysisTarget.js +1 -1
  6. package/arcade/featureset/actions/Adapted.js +1 -1
  7. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  8. package/arcade/featureset/sources/FeatureLayerMemory.js +1 -1
  9. package/arcade/featureset/sources/FeatureLayerRelated.js +1 -1
  10. package/arcade/featureset/support/FeatureSet.js +1 -1
  11. package/arcade/featureset/support/RecentlyUsedCache.js +1 -1
  12. package/arcade/featureset/support/shared.js +1 -1
  13. package/arcade/functions/convertdirection.js +1 -1
  14. package/arcade/lib/character.js +1 -1
  15. package/arcade/lib/scanner.js +1 -1
  16. package/arcade/lib/tokenizer.js +1 -1
  17. package/arcade/request.js +1 -1
  18. package/arcade/treeAnalysis.js +1 -1
  19. package/assets/esri/core/workers/RemoteClient.js +1 -1
  20. package/assets/esri/core/workers/chunks/0bfedb1dbdff8205e468.js +1 -0
  21. package/assets/esri/core/workers/chunks/{5e472c89a38d6a42b84d.js → 0e29250c24a3a7b1ce13.js} +1 -1
  22. package/assets/esri/core/workers/chunks/0eb9c9477d36cd212f8b.js +1 -0
  23. package/assets/esri/core/workers/chunks/10779a256841c37f2429.js +1 -0
  24. package/assets/esri/core/workers/chunks/10a119889d1ab13402a3.js +1 -0
  25. package/assets/esri/core/workers/chunks/125b14c2ccd96d7c20c2.js +1 -0
  26. package/assets/esri/core/workers/chunks/23ec33a30db201e8b2c3.js +1 -0
  27. package/assets/esri/core/workers/chunks/2530e8ccf6e12787ce76.js +1 -0
  28. package/assets/esri/core/workers/chunks/2d9e97ba5b50aec4dd01.js +1 -0
  29. package/assets/esri/core/workers/chunks/365dc146398420f13f82.js +1 -0
  30. package/assets/esri/core/workers/chunks/3ae2827e8d55d6713d20.js +1 -0
  31. package/assets/esri/core/workers/chunks/3e3eebaa0844742db2f2.js +1 -0
  32. package/assets/esri/core/workers/chunks/3fd5b2d6eccd9098d492.js +1 -0
  33. package/assets/esri/core/workers/chunks/404f1d7bce014c7e6965.js +1 -0
  34. package/assets/esri/core/workers/chunks/411b7777bb5e943c156f.js +1 -0
  35. package/assets/esri/core/workers/chunks/{12ca192a5233bb2875d0.js → 4312902ab6e42fbe119b.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{4ef07f50da39f8607c1c.js → 44e95e87bd9e820aeb53.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{4d4c5e535d8b9ceb865a.js → 4810edf605838d07e5c5.js} +1 -1
  38. package/assets/esri/core/workers/chunks/4bce446391176a9d4588.js +1 -0
  39. package/assets/esri/core/workers/chunks/52a0e387073ea264e194.js +1 -0
  40. package/assets/esri/core/workers/chunks/560234694f3e53802aff.js +1 -0
  41. package/assets/esri/core/workers/chunks/5633710daeb3bbb79bcf.js +1 -0
  42. package/assets/esri/core/workers/chunks/5682039666f874836451.js +1 -0
  43. package/assets/esri/core/workers/chunks/6f01905936396fe87865.js +1 -0
  44. package/assets/esri/core/workers/chunks/6f7917da7166e8c6854b.js +1 -0
  45. package/assets/esri/core/workers/chunks/7388824eac8da01ea03d.js +1 -0
  46. package/assets/esri/core/workers/chunks/7745efef7d5119d0b087.js +1 -0
  47. package/assets/esri/core/workers/chunks/794b47764ebb0257ed41.js +1 -0
  48. package/assets/esri/core/workers/chunks/{da64dedf9270b64f42b2.js → 79bdb26244ec7b4472fe.js} +1 -1
  49. package/assets/esri/core/workers/chunks/79ec28b3e3c57fe026aa.js +1 -0
  50. package/assets/esri/core/workers/chunks/81e9d860a044acec74ce.js +1 -0
  51. package/assets/esri/core/workers/chunks/831dc0187f71e658550c.js +1 -0
  52. package/assets/esri/core/workers/chunks/86ad6b020c01850d9095.js +1 -0
  53. package/assets/esri/core/workers/chunks/{fb7397da8d4ec2ae4587.js → 87458fbf395338511662.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{1a859be598ad96bb4719.js → 8771296b537f366596c4.js} +18 -18
  55. package/assets/esri/core/workers/chunks/8958cd555f4887526e8b.js +1 -0
  56. package/assets/esri/core/workers/chunks/{e57b71ba70f088a3a052.js → 90dcd86cdef90099abfa.js} +1 -1
  57. package/assets/esri/core/workers/chunks/93067e27eea5844edc6c.js +1 -0
  58. package/assets/esri/core/workers/chunks/{9fbee2d9bf50c4c148c6.js → 9a146c9e9b4bf7fba88f.js} +1 -1
  59. package/assets/esri/core/workers/chunks/9b9821772b6cbe189fe0.js +1 -0
  60. package/assets/esri/core/workers/chunks/{6c4ce530b493c6f7c430.js → 9df2f9f7c28b31866be8.js} +1 -1
  61. package/assets/esri/core/workers/chunks/{d0620ce99b620621d8bc.js → a0552044e123a3c51ddf.js} +1 -1
  62. package/assets/esri/core/workers/chunks/acc1a4acd57f5657e782.js +1 -0
  63. package/assets/esri/core/workers/chunks/b055ae7c54796751b64c.js +1 -0
  64. package/assets/esri/core/workers/chunks/{acc2cfb116fee7f82ae9.js → b26bd8fde2fc65bb67fb.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{9b45b94c4dbdc8d2c5fd.js → b34ba22c7a5adce8a7a2.js} +1 -1
  66. package/assets/esri/core/workers/chunks/b75665d0bf417c6ef24a.js +1 -0
  67. package/assets/esri/core/workers/chunks/bd50ec30688463b821d1.js +1 -0
  68. package/assets/esri/core/workers/chunks/c28f7ae4756ad1ba94bd.js +1 -0
  69. package/assets/esri/core/workers/chunks/c4f713959d4115b87c6c.js +1 -0
  70. package/assets/esri/core/workers/chunks/c58aa209492bd94b7aad.js +1 -0
  71. package/assets/esri/core/workers/chunks/{9b117097b7be0efd21d4.js → c59b0b58e24e6a60cf3e.js} +1 -1
  72. package/assets/esri/core/workers/chunks/c7bd5a4d318299388645.js +1 -0
  73. package/assets/esri/core/workers/chunks/c7cee13a962396b23a5e.js +1 -0
  74. package/assets/esri/core/workers/chunks/{3bbff5ea1ea0e955c592.js → cd3679fa86129ebabfdf.js} +1 -1
  75. package/assets/esri/core/workers/chunks/{1a36dc0daffd536ea44d.js → cee7ce362860717713bf.js} +1 -1
  76. package/assets/esri/core/workers/chunks/cf463d6309f14df2f2fa.js +1 -0
  77. package/assets/esri/core/workers/chunks/{224c0e64160bdc170051.js → d076627bb7dadea89e89.js} +1 -1
  78. package/assets/esri/core/workers/chunks/{fff4200bc61b82dd6193.js → d1d1c45243af614f2e74.js} +1 -1
  79. package/assets/esri/core/workers/chunks/{1e0498dc9836658d9aba.js → d5fd12ea541c1a6b7fce.js} +1 -1
  80. package/assets/esri/core/workers/chunks/{10322d990cda5aedf2f0.js → d6e32ca237ad9309c76a.js} +1 -1
  81. package/assets/esri/core/workers/chunks/e06ad3a3d71154fed654.js +1 -0
  82. package/assets/esri/core/workers/chunks/{7a77d4cd27c30f1a5cae.js → ee3387a43dfbb3df23e1.js} +1 -1
  83. package/assets/esri/core/workers/chunks/{5d5fa2b1fc48a17eb9ab.js → f4fc165420d449e442b8.js} +1 -1
  84. package/assets/esri/core/workers/chunks/{3d6d9906a534ddd8fa37.js → f5ee03f3fca7a75192de.js} +1 -1
  85. package/assets/esri/themes/base/widgets/_Daylight.scss +1 -1
  86. package/assets/esri/themes/base/widgets/_ElevationProfile.scss +1 -1
  87. package/assets/esri/themes/base/widgets/_Weather.scss +1 -1
  88. package/assets/esri/themes/base/widgets/_Widget.scss +12 -0
  89. package/assets/esri/themes/dark/main.css +1 -1
  90. package/assets/esri/themes/dark-blue/main.css +1 -1
  91. package/assets/esri/themes/dark-green/main.css +1 -1
  92. package/assets/esri/themes/dark-purple/main.css +1 -1
  93. package/assets/esri/themes/dark-red/main.css +1 -1
  94. package/assets/esri/themes/light/main.css +1 -1
  95. package/assets/esri/themes/light/view.css +1 -1
  96. package/assets/esri/themes/light-blue/main.css +1 -1
  97. package/assets/esri/themes/light-green/main.css +1 -1
  98. package/assets/esri/themes/light-purple/main.css +1 -1
  99. package/assets/esri/themes/light-red/main.css +1 -1
  100. package/chunks/ComponentShader.glsl.js +25 -25
  101. package/chunks/HighlightApply.glsl.js +36 -0
  102. package/chunks/HighlightBlur.glsl.js +26 -0
  103. package/chunks/HighlightDownsample.glsl.js +12 -0
  104. package/chunks/ImageMaterial.glsl.js +8 -8
  105. package/chunks/LineCallout.glsl.js +1 -1
  106. package/chunks/Pattern.glsl.js +2 -2
  107. package/chunks/SimpleAtmosphere.glsl.js +7 -7
  108. package/chunks/Stars.glsl.js +1 -1
  109. package/chunks/arcade.js +1 -1
  110. package/chunks/color.js +1 -1
  111. package/chunks/languageUtils.js +1 -1
  112. package/chunks/mat3.js +1 -1
  113. package/copyright.txt +2 -2
  114. package/core/AsyncUpdate.js +1 -1
  115. package/core/Evented.js +1 -1
  116. package/core/PooledArray.js +1 -1
  117. package/core/accessorSupport/diffUtils.js +1 -1
  118. package/core/accessorSupport/get.js +1 -1
  119. package/core/accessorSupport/read.js +1 -1
  120. package/core/accessorSupport/set.js +1 -1
  121. package/core/accessorSupport/tracking.js +1 -1
  122. package/core/accessorSupport/utils.js +1 -1
  123. package/core/arrayUtils.js +1 -1
  124. package/core/libs/gl-matrix-2/mat3.js +1 -1
  125. package/core/libs/gl-matrix-2/math/mat3.js +1 -1
  126. package/core/number.js +1 -1
  127. package/core/object.js +1 -1
  128. package/core/string.js +1 -1
  129. package/core/unitUtils.js +1 -1
  130. package/core/watchUtils.js +1 -1
  131. package/core/workers/RemoteClient.js +1 -1
  132. package/exports/csv.js +1 -1
  133. package/geometry/support/heightModelInfoUtils.js +1 -1
  134. package/geometry/support/meshUtils/exporters/gltf/geometry.js +1 -1
  135. package/geometry/support/normalizeUtils.js +1 -1
  136. package/identity/IdentityManagerBase.js +1 -1
  137. package/interfaces.d.ts +155 -20
  138. package/layers/ImageryLayer.js +1 -1
  139. package/layers/MapImageLayer.js +1 -1
  140. package/layers/RouteLayer.js +1 -1
  141. package/layers/SceneLayer.js +1 -1
  142. package/layers/SubtypeGroupLayer.js +1 -1
  143. package/layers/TileLayer.js +1 -1
  144. package/layers/VectorTileLayer.js +1 -1
  145. package/layers/WMSLayer.js +1 -1
  146. package/layers/WMTSLayer.js +1 -1
  147. package/layers/WebTileLayer.js +1 -1
  148. package/layers/graphics/data/AttributesBuilder.js +1 -1
  149. package/layers/graphics/data/QueryEngine.js +1 -1
  150. package/layers/graphics/editingSupport.js +1 -1
  151. package/layers/graphics/sources/connections/GeoEventConnection.js +1 -1
  152. package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
  153. package/layers/graphics/sources/support/inferenceUtils.js +1 -1
  154. package/layers/mixins/ArcGISCachedService.js +1 -1
  155. package/layers/mixins/ArcGISImageService.js +1 -1
  156. package/layers/ogc/ogcFeatureUtils.js +1 -1
  157. package/layers/support/ExportImageServiceParameters.js +1 -1
  158. package/layers/support/PixelBlock.js +1 -1
  159. package/layers/support/RasterJobHandler.js +1 -1
  160. package/layers/support/SpriteSource.js +1 -1
  161. package/layers/support/Sublayer.js +1 -1
  162. package/layers/support/TilemapCache.js +1 -1
  163. package/layers/support/WMTSSublayer.js +1 -1
  164. package/layers/support/arcgisLayerUrl.js +1 -1
  165. package/layers/support/fieldUtils.js +1 -1
  166. package/layers/support/kmlUtils.js +1 -1
  167. package/layers/support/layerUtils.js +1 -1
  168. package/layers/support/rasterDatasets/ImageAuxRaster.js +1 -1
  169. package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
  170. package/layers/support/rasterDatasets/RasterFactory.js +1 -1
  171. package/layers/support/rasterDatasets/WCSRaster.js +1 -1
  172. package/layers/support/rasterDatasets/multipartParser.js +1 -1
  173. package/layers/support/rasterDatasets/wcsCoverageParser.js +1 -1
  174. package/layers/support/rasterDatasets/xmlUtilities.js +1 -1
  175. package/layers/support/rasterFormats/RasterCodec.js +1 -1
  176. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  177. package/layers/support/rasterFunctions/pixelUtils.js +1 -1
  178. package/layers/support/vectorTileLayerLoader.js +1 -1
  179. package/layers/support/wmsUtils.js +1 -1
  180. package/layers/support/wmtsUtils.js +1 -1
  181. package/libs/i3s/I3SModule.js +1 -1
  182. package/libs/vxl/VxlModule.js +1 -1
  183. package/package.json +1 -1
  184. package/portal/Portal.js +1 -1
  185. package/portal/PortalItem.js +1 -1
  186. package/portal/schemas/definitions.js +1 -1
  187. package/portal/support/layersLoader.js +1 -1
  188. package/portal/support/portalItemUtils.js +1 -1
  189. package/portal/support/portalLayers.js +1 -1
  190. package/renderers/support/AuthoringInfoVisualVariable.js +1 -1
  191. package/renderers/support/DictionaryLoader.js +1 -1
  192. package/renderers/support/RasterSymbolizer.js +1 -1
  193. package/renderers/support/numberUtils.js +1 -1
  194. package/renderers/support/rasterRendererHelper.js +1 -1
  195. package/renderers/support/utils.js +1 -1
  196. package/request.js +1 -1
  197. package/rest/imageService.js +1 -1
  198. package/rest/operations/find.js +1 -1
  199. package/rest/query/operations/query.js +1 -1
  200. package/rest/query/operations/queryRelatedRecords.js +1 -1
  201. package/rest/query/operations/queryTopFeatures.js +1 -1
  202. package/rest/support/DirectionLine.js +1 -1
  203. package/rest/support/DirectionPoint.js +1 -1
  204. package/rest/support/PointBarrier.js +1 -1
  205. package/rest/support/PolygonBarrier.js +1 -1
  206. package/rest/support/PolylineBarrier.js +1 -1
  207. package/rest/support/RouteInfo.js +1 -1
  208. package/rest/support/Stop.js +1 -1
  209. package/smartMapping/labels/clusters.js +1 -1
  210. package/smartMapping/popup/dotDensity.js +1 -1
  211. package/smartMapping/popup/support/clusterUtils.js +1 -1
  212. package/smartMapping/popup/support/utils.js +1 -1
  213. package/smartMapping/raster/support/utils.js +1 -1
  214. package/smartMapping/renderers/color.js +1 -1
  215. package/smartMapping/renderers/location.js +1 -1
  216. package/smartMapping/renderers/predominance.js +1 -1
  217. package/smartMapping/renderers/relationship.js +1 -1
  218. package/smartMapping/renderers/size.js +1 -1
  219. package/smartMapping/renderers/support/utils.js +1 -1
  220. package/smartMapping/renderers/type.js +1 -1
  221. package/smartMapping/renderers/univariateColorSize.js +1 -1
  222. package/smartMapping/statistics/summaryStatisticsForAge.js +1 -1
  223. package/smartMapping/statistics/support/ageUtils.js +1 -1
  224. package/smartMapping/statistics/support/utils.js +1 -1
  225. package/smartMapping/support/adapters/SceneLayerAdapter.js +1 -1
  226. package/smartMapping/support/adapters/support/utils.js +1 -1
  227. package/smartMapping/support/utils.js +1 -1
  228. package/smartMapping/symbology/support/Theme.js +1 -1
  229. package/smartMapping/symbology/support/colorRamps.js +1 -1
  230. package/smartMapping/symbology/support/symbologyUtils.js +1 -1
  231. package/smartMapping/symbology/support/utils.js +1 -1
  232. package/statistics/utils.js +1 -1
  233. package/support/basemapDefinitions.js +1 -1
  234. package/support/basemapUtils.js +1 -1
  235. package/support/elevationInfoUtils.js +1 -1
  236. package/support/popupUtils.js +1 -1
  237. package/support/revision.js +1 -1
  238. package/symbols/cim/CIMSymbolRasterizer.js +1 -1
  239. package/symbols/cim/cimAnalyzer.js +1 -1
  240. package/symbols/cim/utils.js +1 -1
  241. package/symbols/support/previewSymbol3D.js +1 -1
  242. package/symbols/support/renderUtils.js +1 -1
  243. package/symbols/support/symbolLayerUtils.js +1 -1
  244. package/views/2d/engine/Bitmap.js +1 -1
  245. package/views/2d/engine/flow/FlowDisplayObject.js +1 -1
  246. package/views/2d/engine/imagery/RasterBitmap.js +1 -1
  247. package/views/2d/engine/imagery/RasterVFDisplayObject.js +1 -1
  248. package/views/2d/engine/vectorTiles/TextShaping.js +1 -1
  249. package/views/2d/engine/vectorTiles/TileParser.js +1 -1
  250. package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +1 -1
  251. package/views/2d/engine/vectorTiles/expression/expression.js +1 -1
  252. package/views/2d/engine/vectorTiles/shaders/VTLMaterial.js +1 -1
  253. package/views/2d/engine/webgl/Profiler.js +1 -1
  254. package/views/2d/engine/webgl/Utils.js +1 -1
  255. package/views/2d/engine/webgl/brushes/WGLGeometryBrush.js +1 -1
  256. package/views/2d/engine/webgl/definitions.js +1 -1
  257. package/views/2d/engine/webgl/effects/HittestEffect.js +1 -1
  258. package/views/2d/engine/webgl/effects/HittestEffectVTL.js +1 -1
  259. package/views/2d/engine/webgl/mesh/templates/WGLTemplateStore.js +1 -1
  260. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  261. package/views/2d/engine/webgl/util/Lock.js +1 -1
  262. package/views/2d/layers/RouteLayerView2D.js +1 -1
  263. package/views/2d/layers/features/schemaUtils.js +1 -1
  264. package/views/2d/layers/features/sources/SnapshotFeatureSource.js +1 -1
  265. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  266. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  267. package/views/2d/layers/features/tileRenderers/SymbolTileRenderer.js +1 -1
  268. package/views/2d/layers/support/webStyleUtils.js +1 -1
  269. package/views/2d/support/Timeline.js +1 -1
  270. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  271. package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
  272. package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
  273. package/views/3d/analysis/Slice/SliceController.js +1 -1
  274. package/views/3d/environment/PanoramicAtmosphere.js +1 -1
  275. package/views/3d/environment/SceneViewAtmosphere.js +1 -1
  276. package/views/3d/environment/StarsTechnique.js +1 -1
  277. package/views/3d/externalRenderers/ExternalRendererStore.js +1 -1
  278. package/views/3d/glTF/loader.js +1 -1
  279. package/views/3d/interactive/analysisTools/lineOfSight/LineOfSightTool.js +1 -1
  280. package/views/3d/interactive/analysisTools/slice/SliceTool.js +1 -1
  281. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  282. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  283. package/views/3d/layers/I3SMeshView3D.js +1 -1
  284. package/views/3d/layers/ImageryLayerView3D.js +1 -1
  285. package/views/3d/layers/LayerView3D.js +1 -1
  286. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  287. package/views/3d/layers/RouteLayerView3D.js +1 -1
  288. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  289. package/views/3d/layers/VectorTileLayerView3D.js +1 -1
  290. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  291. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  292. package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
  293. package/views/3d/layers/i3s/I3SNodeLoader.js +1 -1
  294. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  295. package/views/3d/layers/i3s/IDBMockCache.js +5 -0
  296. package/views/3d/layers/i3s/PointCloudWorkerUtil.js +1 -1
  297. package/views/3d/layers/support/PopupSceneLayerView.js +1 -1
  298. package/views/3d/state/ViewStateManager.js +1 -1
  299. package/views/3d/state/controllers/RotateController.js +1 -1
  300. package/views/3d/state/controllers/global/PinchAndPanController.js +1 -1
  301. package/views/3d/state/controllers/global/ZoomController.js +1 -1
  302. package/views/3d/state/controllers/global/ZoomStepController.js +1 -1
  303. package/views/3d/state/controllers/local/PinchAndPanController.js +1 -1
  304. package/views/3d/state/controllers/local/ZoomController.js +1 -1
  305. package/views/3d/support/HighlightOptions.js +1 -1
  306. package/views/3d/support/buffer/InterleavedLayout.js +1 -1
  307. package/views/3d/support/debugFlags.js +1 -1
  308. package/views/3d/support/orientedBoundingBox.js +1 -1
  309. package/views/3d/terrain/TerrainSurface.js +1 -1
  310. package/views/3d/webgl-engine/Stage.js +1 -1
  311. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  312. package/views/3d/webgl-engine/collections/Component/DepthRange.js +1 -1
  313. package/views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js +3 -3
  314. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +5 -5
  315. package/views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js +1 -1
  316. package/views/3d/webgl-engine/lib/HighlightHelper.js +1 -1
  317. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  318. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  319. package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
  320. package/views/3d/webgl-engine/lib/edgeRendering/EdgeShaderParameters.js +1 -1
  321. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  322. package/views/3d/webgl-engine/lib/lodRendering/InstanceData.js +1 -1
  323. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  324. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  325. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  326. package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
  327. package/views/3d/webgl-engine/shaders/HighlightApply.glsl.js +5 -0
  328. package/views/3d/webgl-engine/shaders/HighlightApplyTechnique.js +5 -0
  329. package/views/3d/webgl-engine/shaders/HighlightBlur.glsl.js +5 -0
  330. package/views/3d/webgl-engine/shaders/HighlightBlurTechnique.js +5 -0
  331. package/views/3d/webgl-engine/shaders/HighlightDownsample.glsl.js +5 -0
  332. package/views/3d/webgl-engine/shaders/HighlightDownsampleTechnique.js +5 -0
  333. package/views/3d/webgl-engine/shaders/HighlightOptions.js +4 -0
  334. package/views/3d/webgl-engine/shaders/HighlightPassParameters.js +5 -0
  335. package/views/3d/webgl-engine/shaders/ImageMaterial.glsl.js +1 -1
  336. package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
  337. package/views/3d/webgl-engine/shaders/NativeLineTechnique.js +1 -1
  338. package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
  339. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/AdjustProjectedPosition.glsl.js +5 -7
  340. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeUtil.glsl.js +14 -14
  341. package/views/SceneView.js +1 -1
  342. package/views/draw/support/GraphicMover.js +1 -1
  343. package/views/input/InputHandler.js +1 -1
  344. package/views/input/InputManager.js +1 -1
  345. package/views/layers/ImageryTileLayerView.js +1 -1
  346. package/views/layers/MapImageLayerView.js +1 -1
  347. package/views/layers/TileLayerView.js +1 -1
  348. package/views/layers/support/popupUtils.js +1 -1
  349. package/views/support/DefaultsFromMap.js +1 -1
  350. package/views/support/Scheduler.js +1 -1
  351. package/views/support/screenshotUtils.js +1 -1
  352. package/views/ui/DefaultUI.js +1 -1
  353. package/views/webgl/ShaderTranspiler.js +1 -1
  354. package/webscene/Slide.js +1 -1
  355. package/webscene/spec-certification/spec.js +1 -1
  356. package/widgets/AreaMeasurement3D/AreaMeasurement3DViewModel.js +1 -1
  357. package/widgets/Attachments/support/attachmentUtils.js +1 -1
  358. package/widgets/Attachments.js +1 -1
  359. package/widgets/Attribution.js +1 -1
  360. package/widgets/BasemapLayerList.js +1 -1
  361. package/widgets/Bookmarks/BookmarksViewModel.js +1 -1
  362. package/widgets/Bookmarks.js +1 -1
  363. package/widgets/BuildingExplorer/support/filterUtils.js +1 -1
  364. package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
  365. package/widgets/CoordinateConversion/support/coordinateConversionUtils.js +1 -1
  366. package/widgets/CoordinateConversion/support/formatUtils.js +1 -1
  367. package/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js +1 -1
  368. package/widgets/Directions/DirectionsViewModel.js +1 -1
  369. package/widgets/Directions.js +1 -1
  370. package/widgets/Editor/EditorViewModel.js +1 -1
  371. package/widgets/Editor/workflowUtils.js +1 -1
  372. package/widgets/Editor.js +1 -1
  373. package/widgets/ElevationProfile/ElevationProfileViewModel.js +1 -1
  374. package/widgets/Feature/FeatureMedia.js +1 -1
  375. package/widgets/Feature/support/featureUtils.js +1 -1
  376. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  377. package/widgets/FeatureForm/InputField.js +1 -1
  378. package/widgets/FeatureForm.js +1 -1
  379. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  380. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  381. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  382. package/widgets/FeatureTemplates.js +1 -1
  383. package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
  384. package/widgets/LayerList/ListItemPanel.js +1 -1
  385. package/widgets/LayerList.js +1 -1
  386. package/widgets/Legend/LegendViewModel.js +1 -1
  387. package/widgets/Legend/styles/Card.js +1 -1
  388. package/widgets/Legend/styles/Classic.js +1 -1
  389. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  390. package/widgets/Legend/support/colorRampUtils.js +1 -1
  391. package/widgets/Legend/support/relationshipRampUtils.js +1 -1
  392. package/widgets/Legend/support/sizeRampUtils.js +1 -1
  393. package/widgets/Popup/PopupViewModel.js +1 -1
  394. package/widgets/Popup/actionUtils.js +1 -1
  395. package/widgets/Print/PrintViewModel.js +1 -1
  396. package/widgets/Print.js +1 -1
  397. package/widgets/ScaleBar/ScaleBarViewModel.js +1 -1
  398. package/widgets/Search/SearchViewModel.js +1 -1
  399. package/widgets/Search/support/layerSearchUtils.js +1 -1
  400. package/widgets/Slider.js +1 -1
  401. package/widgets/Swipe.js +1 -1
  402. package/widgets/TableList.js +1 -1
  403. package/widgets/TimeSlider/TimeSliderViewModel.js +1 -1
  404. package/widgets/TimeSlider.js +1 -1
  405. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  406. package/widgets/support/DatePicker.js +1 -1
  407. package/widgets/support/Popover.js +1 -1
  408. package/widgets/support/SnappingControls.js +1 -1
  409. package/widgets/support/TimePicker.js +1 -1
  410. package/widgets/support/timeWidgetUtils.js +1 -1
  411. package/assets/esri/core/workers/chunks/083a5d10f8e243641cb9.js +0 -1
  412. package/assets/esri/core/workers/chunks/0872812ce4d0ec8faf8f.js +0 -1
  413. package/assets/esri/core/workers/chunks/0bc26899780c33637746.js +0 -1
  414. package/assets/esri/core/workers/chunks/113362697da1b69deaed.js +0 -1
  415. package/assets/esri/core/workers/chunks/11a2f9708938eac98815.js +0 -1
  416. package/assets/esri/core/workers/chunks/11a45709b703be84caaf.js +0 -1
  417. package/assets/esri/core/workers/chunks/1c1294ff1ebbd8f774f7.js +0 -1
  418. package/assets/esri/core/workers/chunks/1c915cc9a9d5729b6f17.js +0 -1
  419. package/assets/esri/core/workers/chunks/31786756b3d44540f8c0.js +0 -1
  420. package/assets/esri/core/workers/chunks/36a6f34fe40785beff5d.js +0 -1
  421. package/assets/esri/core/workers/chunks/373c16f8b8093d001064.js +0 -1
  422. package/assets/esri/core/workers/chunks/382a331a592abb61267f.js +0 -1
  423. package/assets/esri/core/workers/chunks/3bf106fe34e3992032c4.js +0 -1
  424. package/assets/esri/core/workers/chunks/3dcec610f1c1497d87bc.js +0 -1
  425. package/assets/esri/core/workers/chunks/46495e726d8739260d44.js +0 -1
  426. package/assets/esri/core/workers/chunks/4a82a6a473b3d540d0be.js +0 -1
  427. package/assets/esri/core/workers/chunks/4b6719377a95ac10fa43.js +0 -1
  428. package/assets/esri/core/workers/chunks/4d2ef57ff3a5cfc1313f.js +0 -1
  429. package/assets/esri/core/workers/chunks/4fd2b8153d62592210a2.js +0 -1
  430. package/assets/esri/core/workers/chunks/56e6a1079269e2964b02.js +0 -1
  431. package/assets/esri/core/workers/chunks/5b4d9786c010d265346c.js +0 -1
  432. package/assets/esri/core/workers/chunks/604637e1c3937b376a0d.js +0 -1
  433. package/assets/esri/core/workers/chunks/60f83257e361f87fa6fd.js +0 -1
  434. package/assets/esri/core/workers/chunks/6d3f80be6fceb2c18b5d.js +0 -1
  435. package/assets/esri/core/workers/chunks/6f827a32646bab0a8777.js +0 -1
  436. package/assets/esri/core/workers/chunks/70bd2ab42e3801ef5974.js +0 -1
  437. package/assets/esri/core/workers/chunks/746222184b361b50d6ba.js +0 -1
  438. package/assets/esri/core/workers/chunks/7fb72b2d11e8d840f982.js +0 -1
  439. package/assets/esri/core/workers/chunks/85bb6a1a7704fcdcbec2.js +0 -1
  440. package/assets/esri/core/workers/chunks/8b4c76cebb100e6c06f8.js +0 -1
  441. package/assets/esri/core/workers/chunks/9586a6b320edb1922926.js +0 -1
  442. package/assets/esri/core/workers/chunks/99638697ffda9022ce92.js +0 -1
  443. package/assets/esri/core/workers/chunks/a9da1cb118ca62a9581d.js +0 -1
  444. package/assets/esri/core/workers/chunks/aaa41a5013eef713c032.js +0 -1
  445. package/assets/esri/core/workers/chunks/ac321f939dd488ff6ce4.js +0 -1
  446. package/assets/esri/core/workers/chunks/add6027a96398ecf69de.js +0 -1
  447. package/assets/esri/core/workers/chunks/b75206b46ba81606087c.js +0 -1
  448. package/assets/esri/core/workers/chunks/bf8456828e38a768eba3.js +0 -1
  449. package/assets/esri/core/workers/chunks/c0720d0d8adcba6738d4.js +0 -1
  450. package/assets/esri/core/workers/chunks/c5bb712d5cf8c05a4e13.js +0 -1
  451. package/assets/esri/core/workers/chunks/d343f05a3366f95e0494.js +0 -1
  452. package/assets/esri/core/workers/chunks/d8b1f00075983d769985.js +0 -1
  453. package/chunks/Highlight.glsl.js +0 -88
  454. package/views/3d/webgl-engine/shaders/Highlight.glsl.js +0 -5
  455. package/views/3d/webgl-engine/shaders/HighlightTechnique.js +0 -5
  456. package/views/3d/webgl-engine/shaders/HighlightTechniqueConfiguration.js +0 -5
package/core/number.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{escapeRegExpString as e}from"./string.js";import{getLocale as n}from"../intl/locale.js";const t={ar:[".",","],bg:[","," "],bs:[",","."],ca:[",","."],cs:[","," "],da:[",","."],de:[",","."],"de-ch":[".","’"],el:[",","."],en:[".",","],"en-au":[".",","],es:[",","."],"es-mx":[".",","],et:[","," "],fi:[","," "],fr:[","," "],"fr-ch":[","," "],he:[".",","],hi:[".",",","#,##,##0.###"],hr:[",","."],hu:[","," "],id:[",","."],it:[",","."],"it-ch":[".","’"],ja:[".",","],ko:[".",","],lt:[","," "],lv:[","," "],mk:[",","."],nb:[","," "],nl:[",","."],pl:[","," "],pt:[",","."],"pt-pt":[","," "],ro:[",","."],ru:[","," "],sk:[","," "],sl:[",","."],sr:[",","."],sv:[","," "],th:[".",","],tr:[",","."],uk:[","," "],vi:[",","."],zh:[".",","]};function r(e){e||(e=n());let r=e in t;if(!r){const n=e.split("-");n.length>1&&n[0]in t&&(e=n[0],r=!0),r||(e="en")}const[o,i,s="#,##0.###"]=t[e];return{decimal:o,group:i,pattern:s}}function o(e,n){const t=r((n={...n}).locale);n.customs=t;const o=n.pattern||t.pattern;return isNaN(e)||Math.abs(e)===1/0?null:s(e,o,n)}const i=/[#0,]*[#0](?:\.0*#*)?/;function s(e,n,t){const r=(t=t||{}).customs.group,o=t.customs.decimal,s=n.split(";"),c=s[0];if(-1!==(n=s[e<0?1:0]||"-"+c).indexOf("%"))e*=100;else if(-1!==n.indexOf("‰"))e*=1e3;else{if(-1!==n.indexOf("¤"))throw new Error("currency notation not supported");if(-1!==n.indexOf("E"))throw new Error("exponential notation not supported")}const a=i,p=c.match(a);if(!p)throw new Error("unable to find a number expression in pattern: "+n);return!1===t.fractional&&(t.places=0),n.replace(a,l(e,p[0],{decimal:o,group:r,places:t.places,round:t.round}))}function l(e,n,t){!0===(t=t||{}).places&&(t.places=0),t.places===1/0&&(t.places=6);const r=n.split("."),o="string"==typeof t.places&&t.places.indexOf(",");let i=t.places;o?i=t.places.substring(o+1):i>=0||(i=(r[1]||[]).length),t.round<0||(e=Number(e.toFixed(Number(i))));const s=String(Math.abs(e)).split("."),l=s[1]||"";if(r[1]||t.places){o&&(t.places=t.places.substring(0,o));const e=void 0!==t.places?t.places:r[1]&&r[1].lastIndexOf("0")+1;e>l.length&&(s[1]=l.padEnd(Number(e),"0")),i<l.length&&(s[1]=l.substr(0,Number(i)))}else s[1]&&s.pop();const c=r[0].replace(",","");let a=c.indexOf("0");-1!==a&&(a=c.length-a,a>s[0].length&&(s[0]=s[0].padStart(a,"0")),-1===c.indexOf("#")&&(s[0]=s[0].substr(s[0].length-a)));let p,u,f=r[0].lastIndexOf(",");if(-1!==f){p=r[0].length-f-1;const e=r[0].substr(0,f);f=e.lastIndexOf(","),-1!==f&&(u=e.length-f-1)}const d=[];for(let g=s[0];g;){const e=g.length-p;d.push(e>0?g.substr(e):g),g=e>0?g.slice(0,e):"",u&&(p=u,u=void 0)}return s[0]=d.reverse().join(t.group||","),s.join(t.decimal||".")}function c(e){return a(e).regexp}function a(n){const t=r((n=n||{}).locale),o=n.pattern||t.pattern,s=t.group,l=t.decimal;let c=1;if(-1!==o.indexOf("%"))c/=100;else if(-1!==o.indexOf("‰"))c/=1e3;else if(-1!==o.indexOf("¤"))throw new Error("currency notation not supported");const a=o.split(";");1===a.length&&a.push("-"+a[0]);const p=d(a,(function(t){return(t="(?:"+e(t,".")+")").replace(i,(function(e){const t={signed:!1,separator:n.strict?s:[s,""],fractional:n.fractional,decimal:l,exponent:!1},r=e.split(".");let o=n.places;1===r.length&&1!==c&&(r[1]="###"),1===r.length||0===o?t.fractional=!1:(void 0===o&&(o=n.pattern?r[1].lastIndexOf("0")+1:1/0),o&&null==n.fractional&&(t.fractional=!0),!n.places&&o<r[1].length&&(o+=","+r[1].length),t.places=o);const i=r[0].split(",");return i.length>1&&(t.groupSize=i.pop().length,i.length>1&&(t.groupSize2=i.pop().length)),"("+u(t)+")"}))}),!0);return{regexp:p.replace(/[\xa0 ]/g,"[\\s\\xa0]"),group:s,decimal:l,factor:c}}function p(e,n){const t=a(n),r=new RegExp("^"+t.regexp+"$").exec(e);if(!r)return NaN;let o=r[1];if(!r[1]){if(!r[2])return NaN;o=r[2],t.factor*=-1}return o=o.replace(new RegExp("["+t.group+"\\s\\xa0]","g"),"").replace(t.decimal,"."),Number(o)*t.factor}function u(e){"places"in(e=e||{})||(e.places=1/0),"string"!=typeof e.decimal&&(e.decimal="."),"fractional"in e&&!/^0/.test(String(e.places))||(e.fractional=[!0,!1]),"exponent"in e||(e.exponent=[!0,!1]),"eSigned"in e||(e.eSigned=[!0,!1]);const n=f(e),t=d(e.fractional,(function(n){let t="";return n&&0!==e.places&&(t="\\"+e.decimal,e.places===1/0?t="(?:"+t+"\\d+)?":t+="\\d{"+e.places+"}"),t}),!0);let r=n+t;return t&&(r="(?:(?:"+r+")|(?:"+t+"))"),r+d(e.exponent,(function(n){return n?"([eE]"+f({signed:e.eSigned})+")":""}))}function f(n){"signed"in(n=n||{})||(n.signed=[!0,!1]),"separator"in n?"groupSize"in n||(n.groupSize=3):n.separator="";return d(n.signed,(function(e){return e?"[-+]":""}),!0)+d(n.separator,(function(t){if(!t)return"(?:\\d+)";" "===(t=e(t))?t="\\s":" "===t&&(t="\\s\\xa0");const r=n.groupSize,o=n.groupSize2;if(o){const e="(?:0|[1-9]\\d{0,"+(o-1)+"}(?:["+t+"]\\d{"+o+"})*["+t+"]\\d{"+r+"})";return r-o>0?"(?:"+e+"|(?:0|[1-9]\\d{0,"+(r-1)+"}))":e}return"(?:0|[1-9]\\d{0,"+(r-1)+"}(?:["+t+"]\\d{"+r+"})*)"}),!0)}const d=function(e,n,t){if(!(e instanceof Array))return n(e);const r=[];for(let o=0;o<e.length;o++)r.push(n(e[o]));return g(r.join("|"),t)},g=function(e,n){return"("+(n?"?:":"")+e+")"};export{a as _parseInfo,o as format,r as getCustoms,p as parse,c as regexp};
5
+ import{escapeRegExpString as e}from"./string.js";import{getLocale as n}from"../intl/locale.js";const t={ar:[".",","],bg:[","," "],bs:[",","."],ca:[",","."],cs:[","," "],da:[",","."],de:[",","."],"de-ch":[".","’"],el:[",","."],en:[".",","],"en-au":[".",","],es:[",","."],"es-mx":[".",","],et:[","," "],fi:[","," "],fr:[","," "],"fr-ch":[","," "],he:[".",","],hi:[".",",","#,##,##0.###"],hr:[",","."],hu:[","," "],id:[",","."],it:[",","."],"it-ch":[".","’"],ja:[".",","],ko:[".",","],lt:[","," "],lv:[","," "],mk:[",","."],nb:[","," "],nl:[",","."],pl:[","," "],pt:[",","."],"pt-pt":[","," "],ro:[",","."],ru:[","," "],sk:[","," "],sl:[",","."],sr:[",","."],sv:[","," "],th:[".",","],tr:[",","."],uk:[","," "],vi:[",","."],zh:[".",","]};function r(e){e||(e=n());let r=e in t;if(!r){const n=e.split("-");n.length>1&&n[0]in t&&(e=n[0],r=!0),r||(e="en")}const[s,o,i="#,##0.###"]=t[e];return{decimal:s,group:o,pattern:i}}function s(e,n){const t=r((n={...n}).locale);n.customs=t;const s=n.pattern||t.pattern;return isNaN(e)||Math.abs(e)===1/0?null:i(e,s,n)}const o=/[#0,]*[#0](?:\.0*#*)?/;function i(e,n,t){const r=(t=t||{}).customs.group,s=t.customs.decimal,i=n.split(";"),c=i[0];if((n=i[e<0?1:0]||"-"+c).includes("%"))e*=100;else if(n.includes("‰"))e*=1e3;else{if(n.includes("¤"))throw new Error("currency notation not supported");if(n.includes("E"))throw new Error("exponential notation not supported")}const a=o,p=c.match(a);if(!p)throw new Error("unable to find a number expression in pattern: "+n);return!1===t.fractional&&(t.places=0),n.replace(a,l(e,p[0],{decimal:s,group:r,places:t.places,round:t.round}))}function l(e,n,t){!0===(t=t||{}).places&&(t.places=0),t.places===1/0&&(t.places=6);const r=n.split("."),s="string"==typeof t.places&&t.places.indexOf(",");let o=t.places;s?o=t.places.substring(s+1):o>=0||(o=(r[1]||[]).length),t.round<0||(e=Number(e.toFixed(Number(o))));const i=String(Math.abs(e)).split("."),l=i[1]||"";if(r[1]||t.places){s&&(t.places=t.places.substring(0,s));const e=void 0!==t.places?t.places:r[1]&&r[1].lastIndexOf("0")+1;e>l.length&&(i[1]=l.padEnd(Number(e),"0")),o<l.length&&(i[1]=l.substr(0,Number(o)))}else i[1]&&i.pop();const c=r[0].replace(",","");let a=c.indexOf("0");-1!==a&&(a=c.length-a,a>i[0].length&&(i[0]=i[0].padStart(a,"0")),c.includes("#")||(i[0]=i[0].substr(i[0].length-a)));let p,u,f=r[0].lastIndexOf(",");if(-1!==f){p=r[0].length-f-1;const e=r[0].substr(0,f);f=e.lastIndexOf(","),-1!==f&&(u=e.length-f-1)}const d=[];for(let g=i[0];g;){const e=g.length-p;d.push(e>0?g.substr(e):g),g=e>0?g.slice(0,e):"",u&&(p=u,u=void 0)}return i[0]=d.reverse().join(t.group||","),i.join(t.decimal||".")}function c(e){return a(e).regexp}function a(n){const t=r((n=n||{}).locale),s=n.pattern||t.pattern,i=t.group,l=t.decimal;let c=1;if(s.includes("%"))c/=100;else if(s.includes("‰"))c/=1e3;else if(s.includes("¤"))throw new Error("currency notation not supported");const a=s.split(";");1===a.length&&a.push("-"+a[0]);const p=d(a,(function(t){return(t="(?:"+e(t,".")+")").replace(o,(function(e){const t={signed:!1,separator:n.strict?i:[i,""],fractional:n.fractional,decimal:l,exponent:!1},r=e.split(".");let s=n.places;1===r.length&&1!==c&&(r[1]="###"),1===r.length||0===s?t.fractional=!1:(void 0===s&&(s=n.pattern?r[1].lastIndexOf("0")+1:1/0),s&&null==n.fractional&&(t.fractional=!0),!n.places&&s<r[1].length&&(s+=","+r[1].length),t.places=s);const o=r[0].split(",");return o.length>1&&(t.groupSize=o.pop().length,o.length>1&&(t.groupSize2=o.pop().length)),"("+u(t)+")"}))}),!0);return{regexp:p.replace(/[\xa0 ]/g,"[\\s\\xa0]"),group:i,decimal:l,factor:c}}function p(e,n){const t=a(n),r=new RegExp("^"+t.regexp+"$").exec(e);if(!r)return NaN;let s=r[1];if(!r[1]){if(!r[2])return NaN;s=r[2],t.factor*=-1}return s=s.replace(new RegExp("["+t.group+"\\s\\xa0]","g"),"").replace(t.decimal,"."),Number(s)*t.factor}function u(e){"places"in(e=e||{})||(e.places=1/0),"string"!=typeof e.decimal&&(e.decimal="."),"fractional"in e&&!/^0/.test(String(e.places))||(e.fractional=[!0,!1]),"exponent"in e||(e.exponent=[!0,!1]),"eSigned"in e||(e.eSigned=[!0,!1]);const n=f(e),t=d(e.fractional,(function(n){let t="";return n&&0!==e.places&&(t="\\"+e.decimal,e.places===1/0?t="(?:"+t+"\\d+)?":t+="\\d{"+e.places+"}"),t}),!0);let r=n+t;return t&&(r="(?:(?:"+r+")|(?:"+t+"))"),r+d(e.exponent,(function(n){return n?"([eE]"+f({signed:e.eSigned})+")":""}))}function f(n){"signed"in(n=n||{})||(n.signed=[!0,!1]),"separator"in n?"groupSize"in n||(n.groupSize=3):n.separator="";return d(n.signed,(function(e){return e?"[-+]":""}),!0)+d(n.separator,(function(t){if(!t)return"(?:\\d+)";" "===(t=e(t))?t="\\s":" "===t&&(t="\\s\\xa0");const r=n.groupSize,s=n.groupSize2;if(s){const e="(?:0|[1-9]\\d{0,"+(s-1)+"}(?:["+t+"]\\d{"+s+"})*["+t+"]\\d{"+r+"})";return r-s>0?"(?:"+e+"|(?:0|[1-9]\\d{0,"+(r-1)+"}))":e}return"(?:0|[1-9]\\d{0,"+(r-1)+"}(?:["+t+"]\\d{"+r+"})*)"}),!0)}const d=function(e,n,t){if(!(e instanceof Array))return n(e);const r=[];for(let s=0;s<e.length;s++)r.push(n(e[s]));return g(r.join("|"),t)},g=function(e,n){return"("+(n?"?:":"")+e+")"};export{a as _parseInfo,s as format,r as getCustoms,p as parse,c as regexp};
package/core/object.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{clone as r}from"./lang.js";function n(r,n,t=!1){return e(r,n,t)}function t(r,n){if(null!=n)return n[r]||i(r.split("."),!1,n)}function o(r,n,t){const o=r.split("."),e=o.pop(),u=i(o,!0,t);u&&e&&(u[e]=n)}function i(r,n,t){let o=t;for(const i of r){if(null==o)return;if(!(i in o)){if(!n)return;o[i]={}}o=o[i]}return o}function e(n,t,o){return t?Object.keys(t).reduce((function(n,i){let u=n[i],c=t[i];return u===c?n:void 0===u?(n[i]=r(c),n):(Array.isArray(c)||Array.isArray(n)?(u=u?Array.isArray(u)?n[i]=u.concat():n[i]=[u]:n[i]=[],c&&(Array.isArray(c)||(c=[c]),o?c.forEach((r=>{-1===u.indexOf(r)&&u.push(r)})):n[i]=c.concat())):c&&"object"==typeof c?n[i]=e(u,c,o):n.hasOwnProperty(i)&&!t.hasOwnProperty(i)||(n[i]=c),n)}),n||{}):n}export{n as deepMerge,t as getDeepValue,o as setDeepValue};
5
+ import{clone as r}from"./lang.js";function n(r,n,t=!1){return e(r,n,t)}function t(r,n){if(null!=n)return n[r]||i(r.split("."),!1,n)}function o(r,n,t){const o=r.split("."),e=o.pop(),u=i(o,!0,t);u&&e&&(u[e]=n)}function i(r,n,t){let o=t;for(const i of r){if(null==o)return;if(!(i in o)){if(!n)return;o[i]={}}o=o[i]}return o}function e(n,t,o){return t?Object.keys(t).reduce((function(n,i){let u=n[i],c=t[i];return u===c?n:void 0===u?(n[i]=r(c),n):(Array.isArray(c)||Array.isArray(n)?(u=u?Array.isArray(u)?n[i]=u.concat():n[i]=[u]:n[i]=[],c&&(Array.isArray(c)||(c=[c]),o?c.forEach((r=>{u.includes(r)||u.push(r)})):n[i]=c.concat())):c&&"object"==typeof c?n[i]=e(u,c,o):n.hasOwnProperty(i)&&!t.hasOwnProperty(i)||(n[i]=c),n)}),n||{}):n}export{n as deepMerge,t as getDeepValue,o as setDeepValue};
package/core/string.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{getDeepValue as t}from"./object.js";const e=/\{([^\}]+)\}/g;function n(t){return null==t?"":t}function r(r,o){return r.replace(e,"object"==typeof o?(e,r)=>n(t(r,o)):(t,e)=>n(o(e)))}function o(t,e){return t.replace(/([\.$?*|{}\(\)\[\]\\\/\+\-^])/g,(t=>e&&-1!==e.indexOf(t)?t:`\\${t}`))}function c(t){let e=0;for(let n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n),e|=0;return e}function u(t){return(new DOMParser).parseFromString(t||"","text/html").body.innerText||""}export{o as escapeRegExpString,c as numericHash,r as replace,u as stripHTML};
5
+ import{getDeepValue as t}from"./object.js";const e=/\{([^\}]+)\}/g;function n(t){return null==t?"":t}function r(r,o){return r.replace(e,"object"==typeof o?(e,r)=>n(t(r,o)):(t,e)=>n(o(e)))}function o(t,e){return t.replace(/([\.$?*|{}\(\)\[\]\\\/\+\-^])/g,(t=>e&&e.includes(t)?t:`\\${t}`))}function c(t){let e=0;for(let n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n),e|=0;return e}function u(t){return(new DOMParser).parseFromString(t||"","text/html").body.innerText||""}export{o as escapeRegExpString,c as numericHash,r as replace,u as stripHTML};
package/core/unitUtils.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import"./has.js";import{strict as e}from"./jsonMap.js";import{isSome as s}from"./maybe.js";import{getReferenceEllipsoid as r}from"../geometry/projectionEllipsoid.js";import t from"../geometry/SpatialReference.js";import{earth as i,mars as n,moon as a}from"../geometry/support/Ellipsoid.js";import{isEarth as u,isWKIDFromMars as c,isWKIDFromMoon as o}from"../geometry/support/spatialReferenceUtils.js";import l from"../geometry/support/WKIDUnitConversion.js";const m=39.37,f=i.radius*Math.PI/200,d=/UNIT\[([^\]]+)\]\]$/i,U=l,q=/UNIT\[([^\]]+)\]/i,p=new Set([4261,4305,4807,4810,4811,4812,4816,4819,4821,4901,4902,37225,104139,104140]),B=e()({meter:"meters",foot:"feet",foot_us:"us-feet",foot_clarke:"clarke-feet",yard_clarke:"clarke-yards",link_clarke:"clarke-links",yard_sears:"sears-yards",foot_sears:"sears-feet",chain_sears:"sears-chains",chain_benoit_1895_b:"benoit-1895-b-chains",yard_indian:"indian-yards",yard_indian_1937:"indian-1937-yards",foot_gold_coast:"gold-coast-feet",chain_sears_1922_truncated:"sears-1922-truncated-chains","50_kilometers":"50-kilometers","150_kilometers":"150-kilometers"}),h=e=>e*e,k=e=>e*e*e,y={length:{baseUnit:"meters",units:{millimeters:{inBaseUnits:.001},centimeters:{inBaseUnits:.01},decimeters:{inBaseUnits:.1},meters:{inBaseUnits:1},kilometers:{inBaseUnits:1e3},inches:{inBaseUnits:.0254},feet:{inBaseUnits:.3048},yards:{inBaseUnits:.9144},miles:{inBaseUnits:1609.344},"nautical-miles":{inBaseUnits:1852},"us-feet":{inBaseUnits:1200/3937}}},area:{baseUnit:"square-meters",units:{"square-millimeters":{inBaseUnits:h(.001)},"square-centimeters":{inBaseUnits:h(.01)},"square-decimeters":{inBaseUnits:h(.1)},"square-meters":{inBaseUnits:1},"square-kilometers":{inBaseUnits:h(1e3)},"square-inches":{inBaseUnits:h(.0254)},"square-feet":{inBaseUnits:h(.3048)},"square-yards":{inBaseUnits:h(.9144)},"square-miles":{inBaseUnits:h(1609.344)},"square-us-feet":{inBaseUnits:h(1200/3937)},acres:{inBaseUnits:.0015625*h(1609.344)},ares:{inBaseUnits:100},hectares:{inBaseUnits:1e4}}},volume:{baseUnit:"liters",units:{liters:{inBaseUnits:1},"cubic-millimeters":{inBaseUnits:1e3*k(.001)},"cubic-centimeters":{inBaseUnits:1e3*k(.01)},"cubic-decimeters":{inBaseUnits:1e3*k(.1)},"cubic-meters":{inBaseUnits:1e3},"cubic-kilometers":{inBaseUnits:1e3*k(1e3)},"cubic-inches":{inBaseUnits:1e3*k(.0254)},"cubic-feet":{inBaseUnits:1e3*k(.3048)},"cubic-yards":{inBaseUnits:1e3*k(.9144)},"cubic-miles":{inBaseUnits:1e3*k(1609.344)}}},angle:{baseUnit:"radians",units:{radians:{inBaseUnits:1},degrees:{inBaseUnits:Math.PI/180}}}},b=function(){const e={};for(const s in y)for(const r in y[s].units)e[r]=s;return e}();function _(e,s,r){return e*y[r].units[s].inBaseUnits}function g(e,s,r){return e/y[r].units[s].inBaseUnits}const S=["metric","imperial","square-inches","square-feet","square-yards","square-miles","square-us-feet","square-meters","square-kilometers","acres","ares","hectares"],w=["metric","imperial","inches","feet","yards","miles","nautical-miles","us-feet","meters","kilometers"];function j(e){return"imperial"===e||"metric"===e}function M(e){const s=b[e];if(s)return s;throw new Error("unknown type")}function I(e){return y[e].baseUnit}function P(e){return I(M(e))}function C(e,s=null){return s=s||M(e),y[s].baseUnit===e}function D(e,s,r){if(s===r)return e;const t=M(s);if(t!==M(r))throw new Error("incompatible units");const i=C(s,t)?e:_(e,s,t);return C(r,t)?i:g(i,r,t)}function x(e,s,r){switch(r){case"metric":return E(e,s);case"imperial":return O(e,s);default:return r}}function v(e,s,r){switch(r){case"metric":return N(e,s);case"imperial":return F(e,s);default:return r}}function E(e,s){return D(e,s,"meters")<3e3?"meters":"kilometers"}function N(e,s){return D(e,s,"meters")<1e5?"meters":"kilometers"}function O(e,s){return D(e,s,"feet")<1e3?"feet":"miles"}function F(e,s){return D(e,s,"feet")<1e5?"feet":"miles"}function J(e,s){return D(e,s,"square-meters")<3e6?"square-meters":"square-kilometers"}function K(e,s){return D(e,s,"square-feet")<1e6?"square-feet":"square-miles"}function R(e,s,r){return D(e,s,"meters")/(r*Math.PI/180)}function A(e){return B.fromJSON(e.toLowerCase())||null}function T(e){return B.toJSON(e)||null}function Y(e){if(e&&"object"==typeof e&&!u(e))return 1;const s=H(e);return s>1e5?1:s}function G(e){return H(e)>=(e instanceof t?r(e).metersPerDegree:1e5)?"meters":z(e)}function H(e,s=i.metersPerDegree){return L(e,!0)||s}function L(e,s=!1){let r,t,i=null;if(null!=e&&("object"==typeof e?(r=e.wkid,t=e.wkt):"number"==typeof e?r=e:"string"==typeof e&&(t=e)),r){if(c(r))return n.metersPerDegree;if(o(r))return a.metersPerDegree;i=U.values[U[r]],!i&&s&&p.has(r)&&(i=f)}else t&&(V(t)?i=W(d.exec(t),i):Q(t)&&(i=W(q.exec(t),i)));return i}function W(e,s){return e&&e[1]?$(e[1]):s}function $(e){return parseFloat(e.split(",")[1])}function z(e){let r,t,i=null;if(null!=e&&("object"==typeof e?(r=e.wkid,t=e.wkt):"number"==typeof e?r=e:"string"==typeof e&&(t=e)),r)i=U.units[U[r]];else if(t){const e=V(t)?d:Q(t)?q:null;if(e){const s=e.exec(t);s&&s[1]&&(i=Z(s[1]))}}return s(i)?A(i):null}function Q(e){return/^GEOCCS/i.test(e)}function V(e){return/^PROJCS/i.test(e)}const X=1e-7;function Z(e){const s=/[\\"\\']{1}([^\\"\\']+)/.exec(e);let r=s&&s[1];if(!r||-1===U.units.indexOf(r)){const s=$(e);r=null;const t=U.values;for(let e=0;e<t.length;++e)if(Math.abs(s-t[e])<X){r=U.units[e];break}}return r}function ee(e){if(!e)return null;switch(z(e)){case"feet":case"us-feet":case"clarke-feet":case"clarke-yards":case"clarke-links":case"sears-yards":case"sears-feet":case"sears-chains":case"benoit-1895-b-chains":case"indian-yards":case"indian-1937-yards":case"gold-coast-feet":case"sears-1922-truncated-chains":return"imperial";case"50-kilometers":case"150-kilometers":case"meters":return"metric";case null:case void 0:return null}return null}const se={esriAcres:"acres",esriAres:"ares",esriHectares:"hectares",esriSquareCentimeters:"square-centimeters",esriSquareDecimeters:"square-decimeters",esriSquareFeet:"square-feet",esriSquareInches:"square-inches",esriSquareKilometers:"square-kilometers",esriSquareMeters:"square-meters",esriSquareMiles:"square-miles",esriSquareMillimeters:"square-millimeters",esriSquareUsFeet:"square-us-feet",esriSquareYards:"square-yards"},re={esriCentimeters:"centimeters",esriDecimeters:"decimeters",esriFeet:"feet",esriInches:"inches",esriKilometers:"kilometers",esriMeters:"meters",esriMiles:"miles",esriMillimeters:"millimeters",esriNauticalMiles:"nautical-miles",esriYards:"yards"},te=e()(se),ie=e()(re),ne=e()({...se,...re});export{te as areaUnitsJSONMap,P as baseUnitForUnit,I as baseUnitForUnitType,D as convertUnit,ee as getDefaultUnitSystem,L as getMetersPerUnit,H as getMetersPerUnitForSR,Y as getMetersPerVerticalUnitForSR,z as getUnitString,G as getVerticalUnitStringForSR,m as inchesPerMeter,C as isBaseUnit,j as isMeasurementSystem,R as lengthToDegrees,ie as lengthUnitsJSONMap,S as measurementAreaUnits,w as measurementLengthUnits,K as preferredImperialAreaUnit,O as preferredImperialLengthUnit,F as preferredImperialVerticalLengthUnit,x as preferredLengthUnit,J as preferredMetricAreaUnit,E as preferredMetricLengthUnit,N as preferredMetricVerticalLengthUnit,v as preferredVerticalLengthUnit,A as unitFromRESTJSON,T as unitToRESTJSON,M as unitType,ne as unitsJSONMap};
5
+ import"./has.js";import{strict as e}from"./jsonMap.js";import{isSome as s}from"./maybe.js";import{getReferenceEllipsoid as r}from"../geometry/projectionEllipsoid.js";import t from"../geometry/SpatialReference.js";import{earth as i,mars as n,moon as a}from"../geometry/support/Ellipsoid.js";import{isEarth as u,isWKIDFromMars as c,isWKIDFromMoon as o}from"../geometry/support/spatialReferenceUtils.js";import l from"../geometry/support/WKIDUnitConversion.js";const m=39.37,f=i.radius*Math.PI/200,d=/UNIT\[([^\]]+)\]\]$/i,U=l,q=/UNIT\[([^\]]+)\]/i,p=new Set([4261,4305,4807,4810,4811,4812,4816,4819,4821,4901,4902,37225,104139,104140]),B=e()({meter:"meters",foot:"feet",foot_us:"us-feet",foot_clarke:"clarke-feet",yard_clarke:"clarke-yards",link_clarke:"clarke-links",yard_sears:"sears-yards",foot_sears:"sears-feet",chain_sears:"sears-chains",chain_benoit_1895_b:"benoit-1895-b-chains",yard_indian:"indian-yards",yard_indian_1937:"indian-1937-yards",foot_gold_coast:"gold-coast-feet",chain_sears_1922_truncated:"sears-1922-truncated-chains","50_kilometers":"50-kilometers","150_kilometers":"150-kilometers"}),h=e=>e*e,k=e=>e*e*e,y={length:{baseUnit:"meters",units:{millimeters:{inBaseUnits:.001},centimeters:{inBaseUnits:.01},decimeters:{inBaseUnits:.1},meters:{inBaseUnits:1},kilometers:{inBaseUnits:1e3},inches:{inBaseUnits:.0254},feet:{inBaseUnits:.3048},yards:{inBaseUnits:.9144},miles:{inBaseUnits:1609.344},"nautical-miles":{inBaseUnits:1852},"us-feet":{inBaseUnits:1200/3937}}},area:{baseUnit:"square-meters",units:{"square-millimeters":{inBaseUnits:h(.001)},"square-centimeters":{inBaseUnits:h(.01)},"square-decimeters":{inBaseUnits:h(.1)},"square-meters":{inBaseUnits:1},"square-kilometers":{inBaseUnits:h(1e3)},"square-inches":{inBaseUnits:h(.0254)},"square-feet":{inBaseUnits:h(.3048)},"square-yards":{inBaseUnits:h(.9144)},"square-miles":{inBaseUnits:h(1609.344)},"square-us-feet":{inBaseUnits:h(1200/3937)},acres:{inBaseUnits:.0015625*h(1609.344)},ares:{inBaseUnits:100},hectares:{inBaseUnits:1e4}}},volume:{baseUnit:"liters",units:{liters:{inBaseUnits:1},"cubic-millimeters":{inBaseUnits:1e3*k(.001)},"cubic-centimeters":{inBaseUnits:1e3*k(.01)},"cubic-decimeters":{inBaseUnits:1e3*k(.1)},"cubic-meters":{inBaseUnits:1e3},"cubic-kilometers":{inBaseUnits:1e3*k(1e3)},"cubic-inches":{inBaseUnits:1e3*k(.0254)},"cubic-feet":{inBaseUnits:1e3*k(.3048)},"cubic-yards":{inBaseUnits:1e3*k(.9144)},"cubic-miles":{inBaseUnits:1e3*k(1609.344)}}},angle:{baseUnit:"radians",units:{radians:{inBaseUnits:1},degrees:{inBaseUnits:Math.PI/180}}}},b=function(){const e={};for(const s in y)for(const r in y[s].units)e[r]=s;return e}();function _(e,s,r){return e*y[r].units[s].inBaseUnits}function g(e,s,r){return e/y[r].units[s].inBaseUnits}const S=["metric","imperial","square-inches","square-feet","square-yards","square-miles","square-us-feet","square-meters","square-kilometers","acres","ares","hectares"],w=["metric","imperial","inches","feet","yards","miles","nautical-miles","us-feet","meters","kilometers"];function j(e){return"imperial"===e||"metric"===e}function M(e){const s=b[e];if(s)return s;throw new Error("unknown type")}function I(e){return y[e].baseUnit}function P(e){return I(M(e))}function C(e,s=null){return s=s||M(e),y[s].baseUnit===e}function D(e,s,r){if(s===r)return e;const t=M(s);if(t!==M(r))throw new Error("incompatible units");const i=C(s,t)?e:_(e,s,t);return C(r,t)?i:g(i,r,t)}function v(e,s,r){switch(r){case"metric":return E(e,s);case"imperial":return F(e,s);default:return r}}function x(e,s,r){switch(r){case"metric":return N(e,s);case"imperial":return O(e,s);default:return r}}function E(e,s){return D(e,s,"meters")<3e3?"meters":"kilometers"}function N(e,s){return D(e,s,"meters")<1e5?"meters":"kilometers"}function F(e,s){return D(e,s,"feet")<1e3?"feet":"miles"}function O(e,s){return D(e,s,"feet")<1e5?"feet":"miles"}function J(e,s){return D(e,s,"square-meters")<3e6?"square-meters":"square-kilometers"}function K(e,s){return D(e,s,"square-feet")<1e6?"square-feet":"square-miles"}function R(e,s,r){return D(e,s,"meters")/(r*Math.PI/180)}function A(e){return B.fromJSON(e.toLowerCase())||null}function T(e){return B.toJSON(e)||null}function Y(e){if(e&&"object"==typeof e&&!u(e))return 1;const s=H(e);return s>1e5?1:s}function G(e){return H(e)>=(e instanceof t?r(e).metersPerDegree:1e5)?"meters":z(e)}function H(e,s=i.metersPerDegree){return L(e,!0)||s}function L(e,s=!1){let r,t,i=null;if(null!=e&&("object"==typeof e?(r=e.wkid,t=e.wkt):"number"==typeof e?r=e:"string"==typeof e&&(t=e)),r){if(c(r))return n.metersPerDegree;if(o(r))return a.metersPerDegree;i=U.values[U[r]],!i&&s&&p.has(r)&&(i=f)}else t&&(V(t)?i=W(d.exec(t),i):Q(t)&&(i=W(q.exec(t),i)));return i}function W(e,s){return e&&e[1]?$(e[1]):s}function $(e){return parseFloat(e.split(",")[1])}function z(e){let r,t,i=null;if(null!=e&&("object"==typeof e?(r=e.wkid,t=e.wkt):"number"==typeof e?r=e:"string"==typeof e&&(t=e)),r)i=U.units[U[r]];else if(t){const e=V(t)?d:Q(t)?q:null;if(e){const s=e.exec(t);s&&s[1]&&(i=Z(s[1]))}}return s(i)?A(i):null}function Q(e){return/^GEOCCS/i.test(e)}function V(e){return/^PROJCS/i.test(e)}const X=1e-7;function Z(e){const s=/[\\"\\']{1}([^\\"\\']+)/.exec(e);let r=s&&s[1];if(!r||!U.units.includes(r)){const s=$(e);r=null;const t=U.values;for(let e=0;e<t.length;++e)if(Math.abs(s-t[e])<X){r=U.units[e];break}}return r}function ee(e){if(!e)return null;switch(z(e)){case"feet":case"us-feet":case"clarke-feet":case"clarke-yards":case"clarke-links":case"sears-yards":case"sears-feet":case"sears-chains":case"benoit-1895-b-chains":case"indian-yards":case"indian-1937-yards":case"gold-coast-feet":case"sears-1922-truncated-chains":return"imperial";case"50-kilometers":case"150-kilometers":case"meters":return"metric";case null:case void 0:return null}return null}const se={esriAcres:"acres",esriAres:"ares",esriHectares:"hectares",esriSquareCentimeters:"square-centimeters",esriSquareDecimeters:"square-decimeters",esriSquareFeet:"square-feet",esriSquareInches:"square-inches",esriSquareKilometers:"square-kilometers",esriSquareMeters:"square-meters",esriSquareMiles:"square-miles",esriSquareMillimeters:"square-millimeters",esriSquareUsFeet:"square-us-feet",esriSquareYards:"square-yards"},re={esriCentimeters:"centimeters",esriDecimeters:"decimeters",esriFeet:"feet",esriInches:"inches",esriKilometers:"kilometers",esriMeters:"meters",esriMiles:"miles",esriMillimeters:"millimeters",esriNauticalMiles:"nautical-miles",esriYards:"yards"},te=e()(se),ie=e()(re),ne=e()({...se,...re});export{te as areaUnitsJSONMap,P as baseUnitForUnit,I as baseUnitForUnitType,D as convertUnit,ee as getDefaultUnitSystem,L as getMetersPerUnit,H as getMetersPerUnitForSR,Y as getMetersPerVerticalUnitForSR,z as getUnitString,G as getVerticalUnitStringForSR,m as inchesPerMeter,C as isBaseUnit,j as isMeasurementSystem,R as lengthToDegrees,ie as lengthUnitsJSONMap,S as measurementAreaUnits,w as measurementLengthUnits,K as preferredImperialAreaUnit,F as preferredImperialLengthUnit,O as preferredImperialVerticalLengthUnit,v as preferredLengthUnit,J as preferredMetricAreaUnit,E as preferredMetricLengthUnit,N as preferredMetricVerticalLengthUnit,x as preferredVerticalLengthUnit,A as unitFromRESTJSON,T as unitToRESTJSON,M as unitType,ne as unitsJSONMap};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{isEventTarget as n,on as t}from"./events.js";import{equals as r}from"./lang.js";import{createDeferred as e,onAbort as o,createAbortError as u}from"./promiseUtils.js";const c=/\?(\.|$)/g;function i(n,t,r,e){const o=Array.isArray(t)?t:t.indexOf(",")>-1?t.split(","):[t],u=f(n,t,r,e);for(const i of o){const t=i.trim().replace(c,"$1"),e=n.get(t);r.call(n,e,e,t,n)}return u}function f(n,t,r,e){return n.watch(t,r,e)}function l(n,t,r,e){return N(n,t,null,r,e)}function s(n,t,r,e){return z(n,t,U,r,e)}function a(n,t,r,e){return N(n,t,U,r,e)}function m(n,t,r,e){return z(n,t,V,r,e)}function p(n,t,r,e){return N(n,t,V,r,e)}function v(n,t,r,e){return z(n,t,k,r,e)}function d(n,t,r,e){return N(n,t,k,r,e)}function h(n,t,r,e){return z(n,t,q,r,e)}function g(n,t,r,e){return N(n,t,q,r,e)}function y(n,t,r,e){return z(n,t,B,r,e)}function j(n,t,r,e){return N(n,t,B,r,e)}function b(n,t,r,e){return z(n,t,C,r,e)}function A(n,t,r,e){return N(n,t,C,r,e)}function w(n,t,e,o,u){return z(n,t,(n=>r(e,n)),o,u)}function x(n,t,e,o,u){return N(n,t,(n=>r(e,n)),o,u)}function O(n,t,r,e){let o=!1;const u=n.watch(t,((t,e,u,c)=>{o||r.call(n,t,e,u,c)}),e);return{remove(){u.remove()},pause(){o=!0},resume(){o=!1}}}function $(r,e,o,u,c,f,l){const s={};function a(n){const t=s[n];t&&(f&&f(t.target,n,r,o),t.handle.remove(),delete s[n])}const m=i(r,e,((e,i,f)=>{a(f),n(e)&&(s[f]={handle:t(e,o,u),target:e},c&&c(e,f,r,o))}),l);return{remove(){m.remove();for(const n in s)a(n)}}}function z(n,t,r,e,o){const u=n.watch(t,((t,o,u,c)=>{r&&!r(t)||null==e||e.call(n,t,o,u,c)}),o);if(Array.isArray(t))for(const c of t){const o=n.get(c);r&&r(o)&&(null==e||e.call(n,o,o,t,n))}else{const o=n.get(t);r&&r(o)&&(null==e||e.call(n,o,o,t,n))}return u}function N(n,t,r,c,i){const f="function"==typeof c?c:null,l="object"==typeof c?c:null;"boolean"==typeof c&&(i=c);let s,a=!1;function m(){s&&(s.remove(),s=null)}const p=e();o(l,(()=>{m(),p.reject(u())}));const v={then:p.promise.then.bind(p.promise),catch:p.promise.catch.bind(p.promise),remove:m};return Object.freeze(v),s=z(n,t,r,((t,r,e,o)=>{a=!0,m(),f&&f.call(n,t,r,e,o),p.resolve({value:t,oldValue:r,propertyName:e,target:o})}),i),a&&m(),v}function U(n){return!!n}function V(n){return!n}function k(n){return!0===n}function q(n){return!1===n}function B(n){return void 0!==n}function C(n){return void 0===n}export{i as init,$ as on,l as once,O as pausable,f as watch,s as when,y as whenDefined,j as whenDefinedOnce,w as whenEqual,x as whenEqualOnce,h as whenFalse,g as whenFalseOnce,m as whenNot,p as whenNotOnce,a as whenOnce,v as whenTrue,d as whenTrueOnce,b as whenUndefined,A as whenUndefinedOnce,N as whenValidOnce};
5
+ import{isEventTarget as n,on as t}from"./events.js";import{equals as r}from"./lang.js";import{createDeferred as e,onAbort as o,createAbortError as u}from"./promiseUtils.js";const c=/\?(\.|$)/g;function i(n,t,r,e){const o=Array.isArray(t)?t:t.includes(",")?t.split(","):[t],u=f(n,t,r,e);for(const i of o){const t=i.trim().replace(c,"$1"),e=n.get(t);r.call(n,e,e,t,n)}return u}function f(n,t,r,e){return n.watch(t,r,e)}function l(n,t,r,e){return O(n,t,null,r,e)}function s(n,t,r,e){return N(n,t,U,r,e)}function a(n,t,r,e){return O(n,t,U,r,e)}function m(n,t,r,e){return N(n,t,V,r,e)}function p(n,t,r,e){return O(n,t,V,r,e)}function v(n,t,r,e){return N(n,t,k,r,e)}function d(n,t,r,e){return O(n,t,k,r,e)}function h(n,t,r,e){return N(n,t,q,r,e)}function g(n,t,r,e){return O(n,t,q,r,e)}function y(n,t,r,e){return N(n,t,B,r,e)}function j(n,t,r,e){return O(n,t,B,r,e)}function b(n,t,r,e){return N(n,t,C,r,e)}function A(n,t,r,e){return O(n,t,C,r,e)}function w(n,t,e,o,u){return N(n,t,(n=>r(e,n)),o,u)}function $(n,t,e,o,u){return O(n,t,(n=>r(e,n)),o,u)}function x(n,t,r,e){let o=!1;const u=n.watch(t,((t,e,u,c)=>{o||r.call(n,t,e,u,c)}),e);return{remove(){u.remove()},pause(){o=!0},resume(){o=!1}}}function z(r,e,o,u,c,f,l){const s={};function a(n){const t=s[n];t&&(f&&f(t.target,n,r,o),t.handle.remove(),delete s[n])}const m=i(r,e,((e,i,f)=>{a(f),n(e)&&(s[f]={handle:t(e,o,u),target:e},c&&c(e,f,r,o))}),l);return{remove(){m.remove();for(const n in s)a(n)}}}function N(n,t,r,e,o){const u=n.watch(t,((t,o,u,c)=>{r&&!r(t)||null==e||e.call(n,t,o,u,c)}),o);if(Array.isArray(t))for(const c of t){const o=n.get(c);r&&r(o)&&(null==e||e.call(n,o,o,t,n))}else{const o=n.get(t);r&&r(o)&&(null==e||e.call(n,o,o,t,n))}return u}function O(n,t,r,c,i){const f="function"==typeof c?c:null,l="object"==typeof c?c:null;"boolean"==typeof c&&(i=c);let s,a=!1;function m(){s&&(s.remove(),s=null)}const p=e();o(l,(()=>{m(),p.reject(u())}));const v={then:p.promise.then.bind(p.promise),catch:p.promise.catch.bind(p.promise),remove:m};return Object.freeze(v),s=N(n,t,r,((t,r,e,o)=>{a=!0,m(),f&&f.call(n,t,r,e,o),p.resolve({value:t,oldValue:r,propertyName:e,target:o})}),i),a&&m(),v}function U(n){return!!n}function V(n){return!n}function k(n){return!0===n}function q(n){return!1===n}function B(n){return void 0!==n}function C(n){return void 0===n}export{i as init,z as on,l as once,x as pausable,f as watch,s as when,y as whenDefined,j as whenDefinedOnce,w as whenEqual,$ as whenEqualOnce,h as whenFalse,g as whenFalseOnce,m as whenNot,p as whenNotOnce,a as whenOnce,v as whenTrue,d as whenTrueOnce,b as whenUndefined,A as whenUndefinedOnce,O as whenValidOnce};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/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,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};
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&&s.includes(".")){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};
package/exports/csv.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import e from"../core/Error.js";import t from"../layers/support/Field.js";function n(e){return Object.keys(e.attributes).map((n=>{const r=e.attributes[n];return"objectid"===n.toLowerCase()||"fid"===n.toLowerCase()?new t({name:n,alias:n,type:"oid"}):new t("number"==typeof r?{name:n,alias:n,type:"double"}:{name:n,alias:n,type:"string"})}))}function r(e){if(!e.fields){const t=e.features[0];if(t.layer){e.fields=t.layer.fields;const n=Object.keys(t.attributes),r=e.fields.filter((e=>n.includes(e.name)));e.fields=r}else e.fields=n(t)}return e}function i(e){return e.map((({attributes:e})=>e))}function o(e){const{delimiter:t,fields:n=[],outFields:r=[]}=e,i=t||",",o=n.map((e=>e.name));return e=>{let t="";return o.filter((e=>r.includes(e))).forEach((r=>{const o=n.find((({name:e})=>e===r));let a=e[r]||"";if("date"===o.type&&(a=new Date(a).toString()),o.domain&&"coded-value"===o.domain.type){const e=o.domain.codedValues.find((e=>a===e.code));e&&(a=e.name)}"string"==typeof a&&a.includes(i)&&(a=`"${a}"`),t+=`${a}${i}`})),`${t}\r\n`}}async function a(n,{includeGeometry:a=!0,delimiter:s=",",outFields:l=["*"]}={}){if(n=r(n),a&&"point"!==n.geometryType)throw new e("export-csv:invalid-geometries",`the input geometry ${n.geometryType} is not supported, must be point`);const{features:u}=n;if(!u.length)return null;let d=n.fields;const[m]=l;"*"===m&&(l=d.map((e=>e.name))),a&&"point"===n.geometryType&&(d.some((e=>"x"===e.name||"y"===e.name))||(d=[...d,new t({name:"lon",alias:"Longitude",type:"double"}),new t({name:"lat",alias:"Latitude",type:"double"})],l=[...l,"lon","lat"]),u.forEach((e=>{e.attributes.lon=e.geometry.longitude,e.attributes.lat=e.geometry.latitude}))),d=d.filter((e=>l.includes(e.name)));const f=s||",",c=i(u),p=d.map((e=>e.name)).join(f),y=o({delimiter:f,outFields:l||d.map((e=>e.name)),fields:d});let g=`${p}${f}\r\n`;c.forEach((e=>{g+=y(e)}));const b=new RegExp(`${f}\r\ns*$`,"g");return g.replace(b,"")}async function s(t,n){return t||!t.features||t.features.length?a(t,n):Promise.reject(new e("csv-export:features-required","exportFeaturesToCSV requires features to export"))}export{o as attributeToString,a as convertFeaturesToCSV,s as exportFeaturesToCSV,i as extractAttributes,n as extractFieldsFromFeature,r as validateFeatureSetFields};
5
+ import e from"../core/Error.js";import t from"../layers/support/Field.js";function n(e){return Object.keys(e.attributes).map((n=>{const r=e.attributes[n];return"objectid"===n.toLowerCase()||"fid"===n.toLowerCase()?new t({name:n,alias:n,type:"oid"}):new t("number"==typeof r?{name:n,alias:n,type:"double"}:{name:n,alias:n,type:"string"})}))}function r(e){if(!e.fields){const t=e.features[0];if(t.layer){e.fields=t.layer.fields;const n=Object.keys(t.attributes),r=e.fields.filter((e=>n.includes(e.name)));e.fields=r}else e.fields=n(t)}return e}function i(e){return e.map((({attributes:e})=>e))}function o(e){const{delimiter:t,fields:n=[],outFields:r=[]}=e,i=t||",",o=n.map((e=>e.name));return e=>{let t="";return o.filter((e=>r.includes(e))).forEach((r=>{const o=n.find((({name:e})=>e===r));let a=e[r]||"";if("date"===o.type&&(a=new Date(a).toString()),o.domain&&"coded-value"===o.domain.type){const e=o.domain.codedValues.find((e=>a===e.code));e&&(a=e.name)}"string"==typeof a&&a.includes(i)&&(a=`"${a}"`),t+=`${a}${i}`})),`${t}\r\n`}}async function a(n,{includeGeometry:a=!0,delimiter:s=",",outFields:l=["*"]}={}){if(n=r(n),a&&"point"!==n.geometryType)throw new e("export-csv:invalid-geometries",`the input geometry ${n.geometryType} is not supported, must be point`);const{features:u}=n;if(!u.length)return null;let d=n.fields;const[m]=l;"*"===m&&(l=d.map((e=>e.name))),a&&"point"===n.geometryType&&(d.some((e=>"x"===e.name||"y"===e.name))||(d=[...d,new t({name:"lon",alias:"Longitude",type:"double"}),new t({name:"lat",alias:"Latitude",type:"double"})],l=[...l,"lon","lat"]),u.forEach((e=>{e.attributes.lon=e.geometry.longitude,e.attributes.lat=e.geometry.latitude}))),d=d.filter((e=>l.includes(e.name)));const f=s||",",c=i(u),p=d.map((e=>e.name)).join(f),y=o({delimiter:f,outFields:l||d.map((e=>e.name)),fields:d});let g=`${p}${f}\r\n`;c.forEach((e=>{g+=y(e)}));const b=new RegExp(`${f}\r\ns*$`,"g");return g.replace(b,"")}async function s(t,n){if(!t&&t.features&&!t.features.length)throw new e("csv-export:features-required","exportFeaturesToCSV requires features to export");return a(t,n)}export{o as attributeToString,a as convertFeaturesToCSV,s as exportFeaturesToCSV,i as extractAttributes,n as extractFieldsFromFeature,r as validateFeatureSetFields};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import"../../core/has.js";import e from"../../core/Error.js";import{isSome as t}from"../../core/maybe.js";import n from"../HeightModelInfo.js";import{parse as i}from"../../layers/support/arcgisLayerUrl.js";function r(t,i){if(!t)return null;if(!c(t))return new e("webscene:unsupported-height-model-info","The vertical coordinate system of the scene is not supported",{heightModelInfo:t});const r=t.heightUnit,o=n.deriveUnitFromSR(t,i).heightUnit;return r!==o?new e("webscene:incompatible-height-unit",`The vertical units of the scene (${r}) must match the horizontal units of the scene (${o})`,{verticalUnit:r,horizontalUnit:o}):null}function o(t,i,r){const o=h(t),c=i,u=a(o,c,r);if(o){const i=n.deriveUnitFromSR(o,t.spatialReference).heightUnit;if(!r&&i!==o.heightUnit){const t=new e("layerview:unmatched-height-unit",`The vertical units of the layer must match the horizontal units (${i})`,{horizontalUnit:i});return new e("layerview:unsupported-height-model-info","The vertical coordinate system of the layer is not supported",{heightModelInfo:o,error:t})}}if(!l(t)||u===s.Unsupported)return new e("layerview:unsupported-height-model-info","The vertical coordinate system of the layer is not supported",{heightModelInfo:o});switch(u){case s.Units:{const t=o.heightUnit||"unknown",n=c.heightUnit||"unknown",i=new e("layerview:incompatible-height-unit",`The vertical units of the layer (${t}) must match the vertical units of the scene (${n})`,{layerUnit:t,sceneUnit:n});return new e("layerview:incompatible-height-model-info","The vertical coordinate system of the layer is incompatible with the scene",{layerHeightModelInfo:o,sceneHeightModelInfo:c,error:i})}case s.HeightModel:{const t=o.heightModel||"unknown",n=c.heightModel||"unknown",i=new e("layerview:incompatible-height-model",`The height model of the layer (${t}) must match the height model of the scene (${n})`,{layerHeightModel:t,sceneHeightModel:n});return new e("layerview:incompatible-height-model-info","The vertical coordinate system of the layer is incompatible with the scene",{layerHeightModelInfo:o,sceneHeightModelInfo:c,error:i})}case s.CRS:{const t=o.vertCRS||"unknown",n=c.vertCRS||"unknown",i=new e("layerview:incompatible-vertical-datum",`The vertical datum of the layer (${t}) must match the vertical datum of the scene (${n})`,{layerDatum:t,sceneDatum:n});return new e("layerview:incompatible-height-model-info","The vertical coordinate system of the layer is incompatible with the scene",{layerHeightModelInfo:o,sceneHeightModelInfo:c,error:i})}}return null}function a(e,t,n){if(!c(e)||!c(t))return s.Unsupported;if(null==e||null==t)return s.Ok;if(!n&&e.heightUnit!==t.heightUnit)return s.Units;if(e.heightModel!==t.heightModel)return s.HeightModel;switch(e.heightModel){case"gravity-related-height":return s.Ok;case"ellipsoidal":return e.vertCRS===t.vertCRS?s.Ok:s.CRS;default:return s.Unsupported}}var s;function c(e){return null==e||null!=e.heightModel&&null!=e.heightUnit}function l(e){return"heightModelInfo"in e&&null!=e.heightModelInfo||null!=e.spatialReference||!d(e)}function h(e){const r=e.url&&i(e.url);return!(null==(e.spatialReference&&e.spatialReference.vcsWkid)&&t(r)&&"ImageServer"===r.serverType)&&u(e)&&e.heightModelInfo?e.heightModelInfo:d(e)?n.deriveUnitFromSR(m,e.spatialReference):null}function u(e){return"heightModelInfo"in e}function f(e){if("unknown"===e.type||!("capabilities"in e))return!1;switch(e.type){case"csv":case"feature":case"geojson":case"subtype-group":case"ogc-feature":case"wfs":return!0;default:return!1}}function d(e){return f(e)?!!(e.capabilities&&e.capabilities.data&&e.capabilities.data.supportsZ):p(e)}function g(e){return null!=e.layers||p(e)||f(e)||u(e)}function p(e){switch(e.type){case"building-scene":case"elevation":case"integrated-mesh":case"point-cloud":case"scene":case"voxel":return!0;case"analysis":case"base-dynamic":case"base-elevation":case"base-tile":case"bing-maps":case"csv":case"geojson":case"feature":case"subtype-group":case"geo-rss":case"graphics":case"group":case"imagery":case"imagery-tile":case"kml":case"map-image":case"map-notes":case"ogc-feature":case"open-street-map":case"route":case"stream":case"tile":case"unknown":case"unsupported":case"vector-tile":case"wcs":case"web-tile":case"wfs":case"wms":case"wmts":case null:return!1}return!1}!function(e){e[e.Ok=0]="Ok",e[e.Units=1]="Units",e[e.HeightModel=2]="HeightModel",e[e.CRS=3]="CRS",e[e.Unsupported=4]="Unsupported"}(s||(s={}));const m=new n({heightModel:"gravity-related-height"});export{h as deriveHeightModelInfoFromLayer,g as mayHaveHeightModelInfo,o as rejectLayerError,r as validateWebSceneError};
5
+ import"../../core/has.js";import e from"../../core/Error.js";import{isSome as t}from"../../core/maybe.js";import n from"../HeightModelInfo.js";import{parse as i}from"../../layers/support/arcgisLayerUrl.js";function r(t,i){if(!t)return null;if(!c(t))return new e("webscene:unsupported-height-model-info","The vertical coordinate system of the scene is not supported",{heightModelInfo:t});const r=t.heightUnit,o=n.deriveUnitFromSR(t,i).heightUnit;return r!==o?new e("webscene:incompatible-height-unit",`The vertical units of the scene (${r}) must match the horizontal units of the scene (${o})`,{verticalUnit:r,horizontalUnit:o}):null}function o(t,i,r){const o=h(t),c=i,u=a(o,c,r);if(o){const i=n.deriveUnitFromSR(o,t.spatialReference).heightUnit;if(!r&&i!==o.heightUnit){const t=new e("layerview:unmatched-height-unit",`The vertical units of the layer must match the horizontal units (${i})`,{horizontalUnit:i});return new e("layerview:unsupported-height-model-info","The vertical coordinate system of the layer is not supported",{heightModelInfo:o,error:t})}}if(!l(t)||u===s.Unsupported)return new e("layerview:unsupported-height-model-info","The vertical coordinate system of the layer is not supported",{heightModelInfo:o});switch(u){case s.Units:{const t=o.heightUnit||"unknown",n=c.heightUnit||"unknown",i=new e("layerview:incompatible-height-unit",`The vertical units of the layer (${t}) must match the vertical units of the scene (${n})`,{layerUnit:t,sceneUnit:n});return new e("layerview:incompatible-height-model-info","The vertical coordinate system of the layer is incompatible with the scene",{layerHeightModelInfo:o,sceneHeightModelInfo:c,error:i})}case s.HeightModel:{const t=o.heightModel||"unknown",n=c.heightModel||"unknown",i=new e("layerview:incompatible-height-model",`The height model of the layer (${t}) must match the height model of the scene (${n})`,{layerHeightModel:t,sceneHeightModel:n});return new e("layerview:incompatible-height-model-info","The vertical coordinate system of the layer is incompatible with the scene",{layerHeightModelInfo:o,sceneHeightModelInfo:c,error:i})}case s.CRS:{const t=o.vertCRS||"unknown",n=c.vertCRS||"unknown",i=new e("layerview:incompatible-vertical-datum",`The vertical datum of the layer (${t}) must match the vertical datum of the scene (${n})`,{layerDatum:t,sceneDatum:n});return new e("layerview:incompatible-height-model-info","The vertical coordinate system of the layer is incompatible with the scene",{layerHeightModelInfo:o,sceneHeightModelInfo:c,error:i})}}return null}function a(e,t,n){if(!c(e)||!c(t))return s.Unsupported;if(null==e||null==t)return s.Ok;if(!n&&e.heightUnit!==t.heightUnit)return s.Units;if(e.heightModel!==t.heightModel)return s.HeightModel;switch(e.heightModel){case"gravity-related-height":return s.Ok;case"ellipsoidal":return e.vertCRS===t.vertCRS?s.Ok:s.CRS;default:return s.Unsupported}}var s;function c(e){return null==e||null!=e.heightModel&&null!=e.heightUnit}function l(e){return"heightModelInfo"in e&&null!=e.heightModelInfo||null!=e.spatialReference||!d(e)}function h(e){const r=e.url&&i(e.url);return!(null==(e.spatialReference&&e.spatialReference.vcsWkid)&&t(r)&&"ImageServer"===r.serverType)&&u(e)&&e.heightModelInfo?e.heightModelInfo:d(e)?n.deriveUnitFromSR(m,e.spatialReference):null}function u(e){return"heightModelInfo"in e}function f(e){if("unknown"===e.type||!("capabilities"in e))return!1;switch(e.type){case"csv":case"feature":case"geojson":case"subtype-group":case"ogc-feature":case"wfs":return!0;default:return!1}}function d(e){return f(e)?!!(e.capabilities&&e.capabilities.data&&e.capabilities.data.supportsZ):p(e)}function g(e){return null!=e.layers||p(e)||f(e)||u(e)}function p(e){switch(e.type){case"building-scene":case"elevation":case"integrated-mesh":case"point-cloud":case"scene":case"voxel":return!0;case"analysis":case"base-dynamic":case"base-elevation":case"base-tile":case"bing-maps":case"csv":case"geojson":case"feature":case"subtype-group":case"geo-rss":case"graphics":case"group":case"imagery":case"imagery-tile":case"kml":case"map-image":case"map-notes":case"ogc-feature":case"open-street-map":case"route":case"stream":case"tile":case"unknown":case"unsupported":case"vector-tile":case"wcs":case"web-tile":case"wfs":case"wms":case"wmts":case null:return!1}return!1}!function(e){e[e.Ok=0]="Ok",e[e.Units=1]="Units",e[e.HeightModel=2]="HeightModel",e[e.CRS=3]="CRS",e[e.Unsupported=4]="Unsupported"}(s||(s={}));const m=new n({heightModel:"gravity-related-height"});export{h as deriveHeightModelInfoFromLayer,o as rejectLayerError,g as supportsHeightModelInfo,r as validateWebSceneError};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../../geometry.js";import{isNone as t,isSome as e}from"../../../../../core/maybe.js";import{s as n,b as o,f as r,n as s}from"../../../../../chunks/vec3.js";import{c as i}from"../../../../../chunks/vec3f64.js";import a from"../../../../Point.js";function f(t,e){if(t.components)for(const n of t.components)n.faces&&"smooth"===n.shading&&m(n,e)}function m(e,i){t(i.normal)&&(i.normal=new Float32Array(i.position.length));const a=e.faces,{position:f,normal:m}=i,c=a.length/3;for(let t=0;t<c;++t){const e=3*a[3*t+0],s=3*a[3*t+1],i=3*a[3*t+2],c=n(p,f[e+0],f[e+1],f[e+2]),h=n(l,f[s+0],f[s+1],f[s+2]),g=n(x,f[i+0],f[i+1],f[i+2]),u=o(h,h,c),j=o(g,g,c),y=r(u,u,j);m[e+0]+=y[0],m[e+1]+=y[1],m[e+2]+=y[2],m[s+0]+=y[0],m[s+1]+=y[1],m[s+2]+=y[2],m[i+0]+=y[0],m[i+1]+=y[1],m[i+2]+=y[2]}for(let t=0;t<m.length;t+=3)n(h,m[t],m[t+1],m[t+2]),s(h,h),m[t+0]=h[0],m[t+1]=h[1],m[t+2]=h[2]}function c(t){if(e(t.transform))return t.transform.getOriginPoint(t.spatialReference);const n=t.extent.xmax-t.extent.width/2,o=t.extent.ymax-t.extent.height/2,r=t.extent.zmin;return new a({x:n,y:o,z:r,spatialReference:t.extent.spatialReference})}const p=i(),l=i(),x=i(),h=i();export{c as computeOrigin,f as smoothNormals};
5
+ import{isNone as t,isSome as n}from"../../../../../core/maybe.js";import{s as e,b as o,f as r,n as s}from"../../../../../chunks/vec3.js";import{c as a}from"../../../../../chunks/vec3f64.js";import i from"../../../../Point.js";function f(t,n){if(t.components)for(const e of t.components)e.faces&&"smooth"===e.shading&&c(e,n)}function c(n,a){t(a.normal)&&(a.normal=new Float32Array(a.position.length));const i=n.faces,{position:f,normal:c}=a,m=i.length/3;for(let t=0;t<m;++t){const n=3*i[3*t+0],s=3*i[3*t+1],a=3*i[3*t+2],m=e(l,f[n+0],f[n+1],f[n+2]),h=e(p,f[s+0],f[s+1],f[s+2]),g=e(x,f[a+0],f[a+1],f[a+2]),u=o(h,h,m),j=o(g,g,m),y=r(u,u,j);c[n+0]+=y[0],c[n+1]+=y[1],c[n+2]+=y[2],c[s+0]+=y[0],c[s+1]+=y[1],c[s+2]+=y[2],c[a+0]+=y[0],c[a+1]+=y[1],c[a+2]+=y[2]}for(let t=0;t<c.length;t+=3)e(h,c[t],c[t+1],c[t+2]),s(h,h),c[t+0]=h[0],c[t+1]=h[1],c[t+2]=h[2]}function m(t){if(n(t.transform))return t.transform.getOriginPoint(t.spatialReference);const e=t.extent.xmax-t.extent.width/2,o=t.extent.ymax-t.extent.height/2,r=t.extent.zmin;return new i({x:e,y:o,z:r,spatialReference:t.extent.spatialReference})}const l=a(),p=a(),x=a(),h=a();export{m as computeOrigin,f as smoothNormals};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../config.js";import e from"../../core/Error.js";import n from"../../core/Logger.js";import{isNone as o,isSome as s}from"../../core/maybe.js";import r from"../Polygon.js";import i from"../Polyline.js";import{getGeometryParts as l,cutParams as f,offsetMagnitude as c,updatePolyGeometry as p}from"./normalizeUtilsCommon.js";import{getInfo as u}from"./spatialReferenceUtils.js";import{geographicToWebMercator as a,webMercatorToGeographic as h}from"./webMercatorUtils.js";import{cut as m}from"../../rest/geometry/cut.js";import{simplify as g}from"../../rest/geometry/simplify.js";const y=n.getLogger("esri.geometry.support.normalizeUtils");function x(t){return"polygon"===t.type}function d(t){return"polygon"===t[0].type}function w(t){return"polyline"===t[0].type}function j(t){const e=[];let n=0,o=0;for(let s=0;s<t.length;s++){const r=t[s];let i=null;for(let t=0;t<r.length;t++)i=r[t],e.push(i),0===t?(n=i[0],o=n):(n=Math.min(n,i[0]),o=Math.max(o,i[0]));i&&e.push([(n+o)/2,0])}return e}function R(t,n){if(!(t instanceof i||t instanceof r)){const t="straightLineDensify: the input geometry is neither polyline nor polygon";throw y.error(t),new e(t)}const o=l(t),s=[];for(const e of o){const t=[];s.push(t),t.push([e[0][0],e[0][1]]);for(let o=0;o<e.length-1;o++){const s=e[o][0],r=e[o][1],i=e[o+1][0],l=e[o+1][1],f=Math.sqrt((i-s)*(i-s)+(l-r)*(l-r)),c=(l-r)/f,p=(i-s)/f,u=f/n;if(u>1){for(let l=1;l<=u-1;l++){const e=l*n,o=p*e+s,i=c*e+r;t.push([o,i])}const e=(f+Math.floor(u-1)*n)/2,o=p*e+s,i=c*e+r;t.push([o,i])}t.push([i,l])}}return x(t)?new r({rings:s,spatialReference:t.spatialReference}):new i({paths:s,spatialReference:t.spatialReference})}function M(t,e,n){if(e){const e=R(t,1e6);t=h(e,!0)}return n&&(t=p(t,n)),t}function P(t,e,n){if(Array.isArray(t)){const o=t[0];if(o>e){const n=c(o,e);t[0]=o+n*(-2*e)}else if(o<n){const e=c(o,n);t[0]=o+e*(-2*n)}}else{const o=t.x;if(o>e){const n=c(o,e);t=t.clone().offset(n*(-2*e),0)}else if(o<n){const e=c(o,n);t=t.clone().offset(e*(-2*n),0)}}return t}function b(t,e){let n=-1;for(let o=0;o<e.cutIndexes.length;o++){const s=e.cutIndexes[o],r=e.geometries[o],i=l(r);for(let t=0;t<i.length;t++){const e=i[t];e.some((n=>{if(n[0]<180)return!0;{let n=0;for(let t=0;t<e.length;t++){const o=e[t][0];n=o>n?o:n}n=Number(n.toFixed(9));const o=-360*c(n,180);for(let s=0;s<e.length;s++){const e=r.getPoint(t,s);r.setPoint(t,s,e.clone().offset(o,0))}return!0}}))}if(s===n){if(d(t))for(const e of l(r))t[s]=t[s].addRing(e);else if(w(t))for(const e of l(r))t[s]=t[s].addPath(e)}else n=s,t[s]=r}return t}async function v(e,n,l){var h;if(!Array.isArray(e))return v([e],n);const y=null!=(h=null==n?void 0:n.url)?h:t.geometryServiceUrl;let x,d,w,j,R,L,U,A,z=0;const k=[],I=[];for(const t of e)if(o(t))I.push(t);else if(x||(x=t.spatialReference,d=u(x),w=x.isWebMercator,L=w?102100:4326,j=f[L].maxX,R=f[L].minX,U=f[L].plus180Line,A=f[L].minus180Line),d)if("mesh"===t.type)I.push(t);else if("point"===t.type)I.push(P(t.clone(),j,R));else if("multipoint"===t.type){const e=t.clone();e.points=e.points.map((t=>P(t,j,R))),I.push(e)}else if("extent"===t.type){const e=t.clone()._normalize(!1,!1,d);I.push(e.rings?new r(e):e)}else if(t.extent){const e=t.extent,n=c(e.xmin,R)*(2*j);let o=0===n?t.clone():p(t.clone(),n);e.offset(n,0),e.intersects(U)&&e.xmax!==j?(z=e.xmax>z?e.xmax:z,o=M(o,w),k.push(o),I.push("cut")):e.intersects(A)&&e.xmin!==R?(z=e.xmax*(2*j)>z?e.xmax*(2*j):z,o=M(o,w,360),k.push(o),I.push("cut")):I.push(o)}else I.push(t.clone());else I.push(t);let X=c(z,j),q=-90;const C=X,D=new i;for(;X>0;){const t=360*X-180;D.addPath([[t,q],[t,-1*q]]),q*=-1,X--}if(k.length>0&&C>0){const t=b(k,await m(y,k,D,l)),n=[],o=[];for(let l=0;l<I.length;l++){const r=I[l];if("cut"!==r)o.push(r);else{const r=t.shift(),i=e[l];s(i)&&"polygon"===i.type&&i.rings&&i.rings.length>1&&r.rings.length>=i.rings.length?(n.push(r),o.push("simplify")):o.push(w?a(r):r)}}if(!n.length)return o;const r=await g(y,n,l),i=[];for(let e=0;e<o.length;e++){const t=o[e];"simplify"!==t?i.push(t):i.push(w?a(r.shift()):r.shift())}return i}const E=[];for(let t=0;t<I.length;t++){const e=I[t];if("cut"!==e)E.push(e);else{const t=k.shift();E.push(!0===w?a(t):t)}}return Promise.resolve(E)}function L(t){if(!t)return null;const e=t.extent;if(!e)return null;const n=t.spatialReference&&u(t.spatialReference);if(!n)return e;const[o,s]=n.valid,r=2*s,{width:i}=e;let l,{xmin:f,xmax:c}=e;if([f,c]=[c,f],"extent"===t.type||0===i||i<=s||i>r||f<o||c>s)return e;switch(t.type){case"polygon":if(!(t.rings.length>1))return e;l=j(t.rings);break;case"polyline":if(!(t.paths.length>1))return e;l=j(t.paths);break;case"multipoint":l=t.points}const p=e.clone();for(let u=0;u<l.length;u++){let t=l[u][0];t<0?(t+=s,c=Math.max(t,c)):(t-=s,f=Math.min(t,f))}return p.xmin=f,p.xmax=c,p.width<i?(p.xmin-=s,p.xmax-=s,p):e}function U(t,e){const n=u(e);if(n){const[e,o]=n.valid,s=o-e;if(t<e)for(;t<e;)t+=s;if(t>o)for(;t>o;)t-=s}return t}export{L as getDenormalizedExtent,v as normalizeCentralMeridian,U as normalizeMapX,R as straightLineDensify};
5
+ import t from"../../config.js";import e from"../../core/Error.js";import n from"../../core/Logger.js";import{isNone as o,isSome as s}from"../../core/maybe.js";import r from"../Polygon.js";import i from"../Polyline.js";import{getGeometryParts as l,cutParams as f,offsetMagnitude as c,updatePolyGeometry as p}from"./normalizeUtilsCommon.js";import{getInfo as u}from"./spatialReferenceUtils.js";import{geographicToWebMercator as a,webMercatorToGeographic as h}from"./webMercatorUtils.js";import{cut as m}from"../../rest/geometry/cut.js";import{simplify as g}from"../../rest/geometry/simplify.js";const y=n.getLogger("esri.geometry.support.normalizeUtils");function x(t){return"polygon"===t.type}function d(t){return"polygon"===t[0].type}function w(t){return"polyline"===t[0].type}function j(t){const e=[];let n=0,o=0;for(let s=0;s<t.length;s++){const r=t[s];let i=null;for(let t=0;t<r.length;t++)i=r[t],e.push(i),0===t?(n=i[0],o=n):(n=Math.min(n,i[0]),o=Math.max(o,i[0]));i&&e.push([(n+o)/2,0])}return e}function R(t,n){if(!(t instanceof i||t instanceof r)){const t="straightLineDensify: the input geometry is neither polyline nor polygon";throw y.error(t),new e(t)}const o=l(t),s=[];for(const e of o){const t=[];s.push(t),t.push([e[0][0],e[0][1]]);for(let o=0;o<e.length-1;o++){const s=e[o][0],r=e[o][1],i=e[o+1][0],l=e[o+1][1],f=Math.sqrt((i-s)*(i-s)+(l-r)*(l-r)),c=(l-r)/f,p=(i-s)/f,u=f/n;if(u>1){for(let l=1;l<=u-1;l++){const e=l*n,o=p*e+s,i=c*e+r;t.push([o,i])}const e=(f+Math.floor(u-1)*n)/2,o=p*e+s,i=c*e+r;t.push([o,i])}t.push([i,l])}}return x(t)?new r({rings:s,spatialReference:t.spatialReference}):new i({paths:s,spatialReference:t.spatialReference})}function M(t,e,n){if(e){const e=R(t,1e6);t=h(e,!0)}return n&&(t=p(t,n)),t}function b(t,e,n){if(Array.isArray(t)){const o=t[0];if(o>e){const n=c(o,e);t[0]=o+n*(-2*e)}else if(o<n){const e=c(o,n);t[0]=o+e*(-2*n)}}else{const o=t.x;if(o>e){const n=c(o,e);t=t.clone().offset(n*(-2*e),0)}else if(o<n){const e=c(o,n);t=t.clone().offset(e*(-2*n),0)}}return t}function P(t,e){let n=-1;for(let o=0;o<e.cutIndexes.length;o++){const s=e.cutIndexes[o],r=e.geometries[o],i=l(r);for(let t=0;t<i.length;t++){const e=i[t];e.some((n=>{if(n[0]<180)return!0;{let n=0;for(let t=0;t<e.length;t++){const o=e[t][0];n=o>n?o:n}n=Number(n.toFixed(9));const o=-360*c(n,180);for(let s=0;s<e.length;s++){const e=r.getPoint(t,s);r.setPoint(t,s,e.clone().offset(o,0))}return!0}}))}if(s===n){if(d(t))for(const e of l(r))t[s]=t[s].addRing(e);else if(w(t))for(const e of l(r))t[s]=t[s].addPath(e)}else n=s,t[s]=r}return t}async function v(e,n,l){var h;if(!Array.isArray(e))return v([e],n);const y=null!=(h=null==n?void 0:n.url)?h:t.geometryServiceUrl;let x,d,w,j,R,L,U,A,z=0;const k=[],I=[];for(const t of e)if(o(t))I.push(t);else if(x||(x=t.spatialReference,d=u(x),w=x.isWebMercator,L=w?102100:4326,j=f[L].maxX,R=f[L].minX,U=f[L].plus180Line,A=f[L].minus180Line),d)if("mesh"===t.type)I.push(t);else if("point"===t.type)I.push(b(t.clone(),j,R));else if("multipoint"===t.type){const e=t.clone();e.points=e.points.map((t=>b(t,j,R))),I.push(e)}else if("extent"===t.type){const e=t.clone()._normalize(!1,!1,d);I.push(e.rings?new r(e):e)}else if(t.extent){const e=t.extent,n=c(e.xmin,R)*(2*j);let o=0===n?t.clone():p(t.clone(),n);e.offset(n,0),e.intersects(U)&&e.xmax!==j?(z=e.xmax>z?e.xmax:z,o=M(o,w),k.push(o),I.push("cut")):e.intersects(A)&&e.xmin!==R?(z=e.xmax*(2*j)>z?e.xmax*(2*j):z,o=M(o,w,360),k.push(o),I.push("cut")):I.push(o)}else I.push(t.clone());else I.push(t);let X=c(z,j),q=-90;const C=X,D=new i;for(;X>0;){const t=360*X-180;D.addPath([[t,q],[t,-1*q]]),q*=-1,X--}if(k.length>0&&C>0){const t=P(k,await m(y,k,D,l)),n=[],o=[];for(let l=0;l<I.length;l++){const r=I[l];if("cut"!==r)o.push(r);else{const r=t.shift(),i=e[l];s(i)&&"polygon"===i.type&&i.rings&&i.rings.length>1&&r.rings.length>=i.rings.length?(n.push(r),o.push("simplify")):o.push(w?a(r):r)}}if(!n.length)return o;const r=await g(y,n,l),i=[];for(let e=0;e<o.length;e++){const t=o[e];"simplify"!==t?i.push(t):i.push(w?a(r.shift()):r.shift())}return i}const E=[];for(let t=0;t<I.length;t++){const e=I[t];if("cut"!==e)E.push(e);else{const t=k.shift();E.push(!0===w?a(t):t)}}return E}function L(t){if(!t)return null;const e=t.extent;if(!e)return null;const n=t.spatialReference&&u(t.spatialReference);if(!n)return e;const[o,s]=n.valid,r=2*s,{width:i}=e;let l,{xmin:f,xmax:c}=e;if([f,c]=[c,f],"extent"===t.type||0===i||i<=s||i>r||f<o||c>s)return e;switch(t.type){case"polygon":if(!(t.rings.length>1))return e;l=j(t.rings);break;case"polyline":if(!(t.paths.length>1))return e;l=j(t.paths);break;case"multipoint":l=t.points}const p=e.clone();for(let u=0;u<l.length;u++){let t=l[u][0];t<0?(t+=s,c=Math.max(t,c)):(t-=s,f=Math.min(t,f))}return p.xmin=f,p.xmax=c,p.width<i?(p.xmin-=s,p.xmax-=s,p):e}function U(t,e){const n=u(e);if(n){const[e,o]=n.valid,s=o-e;if(t<e)for(;t<e;)t+=s;if(t>o)for(;t>o;)t-=s}return t}export{L as getDenormalizedExtent,v as normalizeCentralMeridian,U as normalizeMapX,R as straightLineDensify};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../config.js";import{id as r}from"../kernel.js";import s from"../request.js";import i from"../core/Error.js";import n from"../core/Evented.js";import{on as o}from"../core/events.js";import{fixJson as a}from"../core/lang.js";import{getDeepValue as h}from"../core/object.js";import{createResolver as l,onAbort as c,isAborted as d}from"../core/promiseUtils.js";import{Url as u,urlToObject as p,hasSameOrigin as _,queryToObject as f,base64UrlEncode as g,objectToQuery as m,normalize as v,getProxyRule as S,makeAbsolute as w,addQueryParameters as I}from"../core/urlUtils.js";import{property as A}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import{subclass as k}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 P={},R=e=>{const t=new u(e.owningSystemUrl).host,r=new u(e.server).host,s=/.+\.arcgis\.com$/i;return s.test(t)&&s.test(r)},C=(e,t)=>!!(R(e)&&t&&t.some((t=>t.test(e.server))));let b=null,D=null;try{b=window.localStorage,D=window.sessionStorage}catch{}class q extends n{constructor(){super(),this._portalConfig=globalThis.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=p(window.location.href),this._busy=null,this._rejectOnPersistedPageShow=!1,this._oAuthLocationParams=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|KnowledgeGraphServer|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._getOAuthLocationParams(),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 r of e){const e=this.findOAuthInfo(r.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),r=this._isServerRsrc(t);let s,i=this.findServerInfo(t),n=!0;i||(i=new O,i.server=this._getServerInstanceRoot(t),r?i.hasServer=!0:(i.tokenServiceUrl=this._getTokenSvcUrl(t),i.hasPortal=!0),this.registerServers([i])),s=this._findCredential(t),s?(delete e.server,Object.assign(s,e),n=!1):(s=new j({userId:e.userId,server:i.server,token:e.token,expires:e.expires,ssl:e.ssl,scope:r?"server":"portal"}),s.resources=[t],this.credentials.push(s)),s.emitTokenChange(!1),n||s.refreshServerTokens()}toJSON(){return a({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,r=e.oAuthInfos,s=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(r){const e=[];r.forEach((t=>{t.appId&&e.push(t.declaredClass?t:new x(t))})),e.length&&this.registerOAuthInfos(e)}s&&s.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 r of this.serverInfos)if(this._hasSameServerInstance(r.server,e)){t=r;break}return t}findOAuthInfo(e){let t;e=this._sanitizeUrl(e);for(const r of this.oAuthInfos)if(this._hasSameServerInstance(r.portalUrl,e)){t=r;break}return t}findCredential(e,t){let r;e=this._sanitizeUrl(e);const s=this._isServerRsrc(e)?"server":"portal";if(t){for(const i of this.credentials)if(this._hasSameServerInstance(i.server,e)&&t===i.userId&&i.scope===s){r=i;break}}else for(const i of this.credentials)if(this._hasSameServerInstance(i.server,e)&&-1!==this._getIdenticalSvcIdx(e,i)&&i.scope===s){r=i;break}return r}getCredential(e,t){let r,s,n=!0;t&&(r=!!t.token,s=t.error,n=!1!==t.prompt),t={...t},e=this._sanitizeUrl(e);const o=new AbortController,a=l();if(t.signal&&c(t.signal,(()=>{o.abort()})),c(o,(()=>{a.reject(new i("identity-manager:user-aborted","ABORTED"))})),d(o))return a.promise;t.signal=o.signal;const h=this._isAdminResource(e),u=r?this.findCredential(e):null;let p;if(u&&s&&s.details&&498===s.details.httpStatus)u.destroy();else if(u)return p=new i("identity-manager:not-authorized","You are currently signed in as: '"+u.userId+"'. You do not have access to this resource: "+e,{error:s}),a.reject(p),a.promise;const f=this._findCredential(e,t);if(f)return a.resolve(f),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 O,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||_(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,r){const n=this._rePortalTokenSvc.test(e.tokenServiceUrl),o=new u(this._appOrigin),a=e.shortLivedTokenValidity;let h,l,c,d,p,f,g,m;t&&(m=this.tokenValidity||a||this.defaultTokenValidity,m>a&&a>0&&(m=a)),r&&(h=r.isAdmin,l=r.serverUrl,c=r.token,f=r.signal,g=r.ssl,e.customParameters=r.customParameters),h?d=e.adminTokenServiceUrl:(d=e.tokenServiceUrl,p=new u(d.toLowerCase()),e.webTierAuth&&null!=r&&r.serverUrl&&!g&&"http"===o.scheme&&(_(o.uri,d,!0)||"https"===p.scheme&&o.host===p.host&&"7080"===o.port&&"7443"===p.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,r),signal:f,...null==r?void 0:r.ioArgs};n||(v.withCredentials=!1);return s(d,v).then((r=>{const s=r.data;if(!s||!s.token)return new i("identity-manager:authentication-failed","Unable to generate token");const n=e.server;return P[n]||(P[n]={}),t&&(P[n][t.username]=t.password),s.validity=m,s}))}isBusy(){return!!this._busy}checkSignInStatus(e){return this.checkAppAccess(e,"").then((e=>e.credential))}checkAppAccess(e,t,r){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)||r&&r.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),s(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){e&&("#"===e.charAt(0)&&(e=e.substring(1)),this._processOAuthPopupParams(f(e)))}setOAuthRedirectionHandler(e){this._oAuthRedirectFunc=e}setProtocolErrorHandler(e){this._protocolFunc=e}signIn(e,t,r={}){const s=l(),n=()=>{var e,t,r,s,i;null==(e=h)||e.remove(),null==(t=d)||t.remove(),null==(r=u)||r.remove(),null==(s=a)||s.destroy(),null==(i=this.dialog)||i.destroy(),this.dialog=a=h=d=u=null},o=()=>{n(),this._oAuthDfd=null,s.reject(new i("identity-manager:user-aborted","ABORTED"))};r.signal&&c(r.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),d=this.dialog.watch("open",o),u=a.on("submit",(e=>{this.generateToken(t,e,{isAdmin:r.isAdmin,signal:r.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:r.isAdmin,validity:i.validity});s.resolve(o)})).catch((e=>{a.error=e,a.signingIn=!1}))}));return s.promise}oAuthSignIn(e,t,r,s){this._oAuthDfd=l();const n=this._oAuthDfd;let o;null!=s&&s.signal&&c(s.signal,(()=>{const e=this._oAuthDfd&&this._oAuthDfd.oAuthWin_;e&&!e.closed?e.close():this.dialog&&_()})),n.resUrl_=e,n.sinfo_=t,n.oinfo_=r;const a=r._oAuthCred;if(a.storage&&("authorization-code"===r.flowType||"auto"===r.flowType&&!r.popup&&t.currentVersion>=8.4)){let e=crypto.getRandomValues(new Uint8Array(32));o=g(e),a.codeVerifier=o,e=crypto.getRandomValues(new Uint8Array(32)),a.stateUID=g(e),a.save()||(a.codeVerifier=o=null)}else a.codeVerifier=null;let h,d,u,p;this._getCodeChallenge(o).then((i=>{const n=!s||!1!==s.oAuthPopupConfirmation;r.popup&&n?(h=new this.formConstructor,h.oAuthPrompt=!0,h.server=t.server,this.dialog=new U,this.dialog.content=h,this.dialog.open=!0,this.emit("dialog-create"),d=h.on("cancel",_),u=this.dialog.watch("open",_),p=h.on("submit",(()=>{f(),this._doOAuthSignIn(e,t,r,i)}))):this._doOAuthSignIn(e,t,r,i)}));const _=()=>{f(),this._oAuthDfd=null,n.reject(new i("identity-manager:user-aborted","ABORTED"))},f=()=>{var e,t,r,s,i;null==(e=d)||e.remove(),null==(t=u)||t.remove(),null==(r=p)||r.remove(),null==(s=h)||s.destroy(),null==(i=this.dialog)||i.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 r;if((t.origin===this._appOrigin||t.origin.endsWith(".arcgis.com"))&&"arcgis:auth:requestCredential"===(null==(r=t.data)?void 0:r.type)){const r=t.source;this.getCredential(e).then((e=>{r.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=>{r.postMessage({type:"arcgis:auth:error",error:{name:e.name,message:e.message}},t.origin)}))}}))}disablePostMessageAuth(){this._postMessageAuthHandle&&(this._postMessageAuthHandle.remove(),this._postMessageAuthHandle=null)}_getOAuthLocationParams(){let e=window.location.hash;if(e){"#"===e.charAt(0)&&(e=e.substring(1));const r=f(e);let s=!1;if(r.access_token&&r.expires_in&&r.state&&r.hasOwnProperty("username"))try{r.state=JSON.parse(r.state),r.state.portalUrl&&(this._oAuthLocationParams=r,s=!0)}catch{}else if(r.error&&r.error_description&&(console.log("IdentityManager OAuth Error: ",r.error," - ",r.error_description),"access_denied"===r.error&&(s=!0,r.state)))try{r.state=JSON.parse(r.state)}catch{}var t;if(s)window.location.hash=(null==(t=r.state)?void 0:t.hash)||""}let r=window.location.search;if(r){"?"===r.charAt(0)&&(r=r.substring(1));const e=f(r);let t=!1;if(e.code&&e.state)try{e.state=JSON.parse(e.state),e.state.portalUrl&&e.state.uid&&(this._oAuthLocationParams=e,t=!0)}catch{}else if(e.error&&e.error_description&&(console.log("IdentityManager OAuth Error: ",e.error," - ",e.error_description),"access_denied"===e.error&&(t=!0,e.state)))try{e.state=JSON.parse(e.state)}catch{}if(t){var s;const t={...e};["code","error","error_description","message_code","persist","state"].forEach((e=>{delete t[e]}));const r=m(t),i=window.location.pathname+(r?`?${r}`:"")+((null==(s=e.state)?void 0:s.hash)||"");window.history.replaceState(window.history.state,"",i)}}}_getOAuthToken(e,t,r,i,n){return e=e.replace(/^http:/i,"https:"),s(`${e}/sharing/rest/oauth2/token`,{authMode:"anonymous",method:"post",query:i&&n?{grant_type:"authorization_code",code:t,redirect_uri:i,client_id:r,code_verifier:n}:{grant_type:"refresh_token",refresh_token:t,client_id:r}}).then((e=>e.data))}_getCodeChallenge(e){if(e&&globalThis.isSecureContext){const t=(new TextEncoder).encode(e);return crypto.subtle.digest("SHA-256",t).then((e=>g(new Uint8Array(e))))}return Promise.resolve(null)}_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 r,s,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(r=c[0],n=this.findServerInfo(r.server),s=n&&n.owningSystemUrl,i=s&&this.findCredential(s,r.userId),o=this._getIdenticalSvcIdx(e,r),!a)return-1===o&&r.resources.push(e),this._addResource(e,i),r;-1!==o&&(r.resources.splice(o,1),this._removeResource(e,i))}else{let t,r;if(c.some((a=>(r=this._getIdenticalSvcIdx(e,a),-1!==r&&(t=a,n=this.findServerInfo(t.server),s=n&&n.owningSystemUrl,i=s&&this.findCredential(s,t.userId),o=r,!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 r of this.oAuthInfos)if(this._isIdProvider(r.portalUrl,e)){t=r;break}return t}_addResource(e,t){t&&-1===this._getIdenticalSvcIdx(e,t)&&t.resources.push(e)}_removeResource(e,t){let r=-1;t&&(r=this._getIdenticalSvcIdx(e,t),r>-1&&t.resources.splice(r,1))}_useProxy(e,t){return t&&t.isAdmin&&!_(e.adminTokenServiceUrl,this._appOrigin)||!this._isPortalDomain(e.tokenServiceUrl)&&"10.1"===String(e.currentVersion)&&!_(e.tokenServiceUrl,this._appOrigin)}_getOrigin(e){const t=new u(e);return t.scheme+"://"+t.host+(null!=t.port?":"+t.port:"")}_getServerInstanceRoot(e){const t=e.toLowerCase();let r=t.indexOf(this._agsRest);return-1===r&&this._isAdminResource(e)&&(r=this._agsAdmin.test(e)?e.replace(this._agsAdmin,"$1").length:e.search(this._adminSvcs)),-1===r&&(r=t.indexOf("/sharing")),-1===r&&"/"===t.substr(-1)&&(r=t.length-1),r>-1?e.substring(0,r):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,r=/^https?:\/\/(?:cdndev|[a-z\d-]+\.mapsdevext)\.arcgis\.com/i,s=/^https?:\/\/(?:cdnqa|[a-z\d-]+\.mapsqa)\.arcgis\.com/i;return t.test(e)?e=e.replace(t,"https://www.arcgis.com"):r.test(e)?e=e.replace(r,"https://devext.arcgis.com"):s.test(e)&&(e=e.replace(s,"https://qaext.arcgis.com")),e}_sanitizeUrl(e){const r=(t.request.proxyUrl||"").toLowerCase(),s=r?e.toLowerCase().indexOf(r+"?"):-1;return-1!==s&&(e=e.substring(s+r.length+1)),e=v(e),p(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 r;if(this._isRESTService(e)&&this._isRESTService(t)){const s=this._getSuffix(e).toLowerCase(),i=this._getSuffix(t).toLowerCase();if(r=s===i,!r){const e=/(.*)\/(MapServer|FeatureServer|UtilityNetworkServer).*/gi;r=s.replace(e,"$1")===i.replace(e,"$1")}}else this._isAdminResource(e)&&this._isAdminResource(t)?r=!0:this._isServerRsrc(e)||this._isServerRsrc(t)||!this._isPortalDomain(e)||(r=!0);return r}_isPortalDomain(e){const r=new u(e.toLowerCase()),s=this._portalConfig;let i=this._gwDomains.some((e=>e.regex.test(r.uri)));return!i&&s&&(i=this._hasSameServerInstance(this._getServerInstanceRoot(s.restBaseUrl),r.uri)),i||t.portalUrl&&(i=_(r,t.portalUrl,!0)),i||(i=this._portals.some((e=>this._hasSameServerInstance(e,r.uri)))),i=i||this._agsPortal.test(r.path),i}_isIdProvider(e,t){let r=-1,s=-1;this._gwDomains.forEach(((i,n)=>{-1===r&&i.regex.test(e)&&(r=n),-1===s&&i.regex.test(t)&&(s=n)}));let i=!1;if(r>-1&&s>-1&&(0===r||4===r?0!==s&&4!==s||(i=!0):1===r?1!==s&&2!==s||(i=!0):2===r?2===s&&(i=!0):3===r&&3===s&&(i=!0)),!i){const r=this.findServerInfo(t),s=r&&r.owningSystemUrl;s&&R(r)&&this._isPortalDomain(s)&&this._isIdProvider(e,s)&&(i=!0)}return i}_getIdenticalSvcIdx(e,t){let r=-1;for(let s=0;s<t.resources.length;s++){const i=t.resources[s];if(this._isIdenticalService(e,i)){r=s;break}}return r}_getSuffix(e){return e.replace(this._regexSDirUrl,"").replace(this._regexServerType,"$1")}_getTokenSvcUrl(e){let t,r,i;if(this._isRESTService(e)||this._isAdminResource(e)){const i=this._getServerInstanceRoot(e);return t=i+"/admin/generateToken",r=s(e=i+"/rest/info",{query:{f:"json"}}).then((e=>e.data)),{adminUrl:t,promise:r}}if(this._isPortalDomain(e)){let t="";if(this._gwDomains.some((r=>(r.regex.test(e)&&(t=r.tokenServiceUrl),!!t))),t||this._portals.some((r=>(this._hasSameServerInstance(r,e)&&(t=r+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 r=new u(e).port;/^http:\/\//i.test(e)&&"7080"===r&&(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"}_processOAuthResponseParams(e,t,r){const s=t._oAuthCred;if(e.code){const i=s.codeVerifier;return s.codeVerifier=null,s.stateUID=null,s.save(),this._getOAuthToken(r.server,e.code,t.appId,this._getRedirectURI(t,!0),i).then((i=>{const n=new j({userId:i.username,server:r.server,token:i.access_token,expires:Date.now()+1e3*i.expires_in,ssl:i.ssl,oAuthState:e.state,_oAuthCred:s});return t.userId=n.userId,s.storage=i.persist?b:D,s.refreshToken=i.refresh_token,s.token=null,s.expires=i.refresh_token_expires_in?Date.now()+1e3*i.refresh_token_expires_in:null,s.userId=n.userId,s.ssl=n.ssl,s.save(),n}))}const i=new j({userId:e.username,server:r.server,token:e.access_token,expires:Date.now()+1e3*Number(e.expires_in),ssl:"true"===e.ssl,oAuthState:e.state,_oAuthCred:s});return t.userId=i.userId,s.storage=e.persist?b:D,s.refreshToken=null,s.token=i.token,s.expires=i.expires,s.userId=i.userId,s.ssl=i.ssl,s.save(),Promise.resolve(i)}_processOAuthPopupParams(e){var t;const r=this._oAuthDfd;if(this._oAuthDfd=null,r)if(clearInterval(this._oAuthIntervalId),null==(t=this._oAuthOnPopupHandle)||t.remove(),e.error){const t="access_denied"===e.error,s=new i(t?"identity-manager:user-aborted":"identity-manager:authentication-failed",t?"ABORTED":"OAuth: "+e.error+" - "+e.error_description);r.reject(s)}else this._processOAuthResponseParams(e,r.oinfo_,r.sinfo_).then((e=>{r.resolve(e)})).catch((e=>{r.reject(e)}))}_setOAuthResponseQueryString(e){e&&("?"===e.charAt(0)&&(e=e.substring(1)),this._processOAuthPopupParams(f(e)))}_exchangeToken(e,t,r){return s(`${e}/sharing/rest/oauth2/exchangeToken`,{authMode:"anonymous",method:"post",query:{f:"json",client_id:t,token:r}}).then((e=>e.data.token))}_getPlatformSelf(e,t){return e=e.replace(/^http:/i,"https:"),s(`${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",expiration:30},withCredentials:!0}).then((e=>e.data))}_getPortalSelf(e,t){let r;if(this._gwDomains.some((t=>(t.regex.test(e)&&(r=t.customBaseUrl),!!r))),r)return Promise.resolve({allSSL:!0,currentVersion:"8.4",customBaseUrl:r,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 s(e,{query:{f:"json"},authMode:"anonymous",withCredentials:!0}).then((e=>e.data))}_doPortalSignIn(e){const t=this._portalConfig,r=window.location.href,s=this.findServerInfo(e);return!(!t&&!this._isPortalDomain(r)||!(s?s.hasPortal||s.owningSystemUrl&&this._isPortalDomain(s.owningSystemUrl):this._isPortalDomain(e))||!(this._isIdProvider(r,e)||t&&(this._hasSameServerInstance(this._getServerInstanceRoot(t.restBaseUrl),e)||this._isIdProvider(t.restBaseUrl,e))||_(r,e,!0)))}_checkProtocol(e,t,r,s){let n=!0;const o=s?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)){r(new i("identity-manager:aborted","Aborted the Sign-In process to avoid sending password over insecure connection."))}return n}_enqueue(e,t,r,s,i,n){return s||(s=l()),s.resUrl_=e,s.sinfo_=t,s.options_=r,s.admin_=i,s.refresh_=n,this._busy?this._hasSameServerInstance(this._getServerInstanceRoot(e),this._busy.resUrl_)?(this._oAuthDfd&&this._oAuthDfd.oAuthWin_&&this._oAuthDfd.oAuthWin_.focus(),this._soReqs.push(s)):this._xoReqs.push(s):this._doSignIn(s),s.promise}_doSignIn(e){this._busy=e,this._rejectOnPersistedPageShow=!1;const t=t=>{const r=e.options_&&e.options_.resource,s=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.includes(r||s)||t.resources.push(r||s),t.scope=this._isServerRsrc(s)?"server":"portal",t.emitTokenChange();const o=this._soReqs,a={};this._soReqs=[],o.forEach((e=>{if(!this._isIdenticalService(s,e.resUrl_)){const r=this._getSuffix(e.resUrl_);a[r]||(a[r]=!0,t.resources.push(e.resUrl_))}})),e.resolve(t),o.forEach((e=>{this._hasSameServerInstance(this._getServerInstanceRoot(s),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())},r=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())},s=(n,a,h,l)=>{var d,u;const p=e.sinfo_,f=!e.options_||!1!==e.options_.prompt,g=p.hasPortal&&this._findOAuthInfo(e.resUrl_);let m,v;if(n)t(new j({userId:n,server:p.server,token:h||null,expires:null!=l?Number(l):null,ssl:!!a}));else if(window!==window.parent&&null!=(d=this._appUrlObj.query)&&d["arcgis-auth-origin"]&&null!=(u=this._appUrlObj.query)&&u["arcgis-auth-portal"]&&this._hasSameServerInstance(this._getServerInstanceRoot(this._appUrlObj.query["arcgis-auth-portal"]),e.resUrl_)){var S;window.parent.postMessage({type:"arcgis:auth:requestCredential"},this._appUrlObj.query["arcgis-auth-origin"]);const s=o(window,"message",(e=>{e.source===window.parent&&e.data&&("arcgis:auth:credential"===e.data.type?(s.remove(),e.data.credential.expires<Date.now()?r(new i("identity-manager:credential-request-failed","Parent application's token has expired.")):t(new j(e.data.credential))):"arcgis:auth:error"===e.data.type&&(s.remove(),"tokenExpiredError"===e.data.error.name?r(new i("identity-manager:credential-request-failed","Parent application's token has expired.")):r(i.fromJSON(e.data.error))))}));c(null==(S=e.options_)?void 0:S.signal,(()=>{s.remove()}))}else if(g){let n=g._oAuthCred;if(!n){const e=new T(g,b),t=new T(g,D);e.isValid()&&t.isValid()?e.expires>t.expires?(n=e,t.destroy()):(n=t,e.destroy()):n=e.isValid()?e:t,g._oAuthCred=n}if(n.isValid()){m=new j({userId:n.userId,server:p.server,token:n.token,expires:n.expires,ssl:n.ssl,_oAuthCred:n});const r=g.appId!==n.appId&&this._doPortalSignIn(e.resUrl_);r||n.refreshToken?(e._pendingDfd=n.refreshToken?this._getOAuthToken(p.server,n.refreshToken,n.appId).then((e=>(m.expires=Date.now()+1e3*e.expires_in,m.token=e.access_token,m))):Promise.resolve(m),e._pendingDfd.then((e=>r?this._exchangeToken(e.server,g.appId,e.token).then((t=>(e.token=t,e))).catch((()=>e)):e)).then((e=>{t(e)})).catch((()=>{n.destroy(),s()}))):t(m)}else if(this._oAuthLocationParams&&this._hasSameServerInstance(g.portalUrl,this._oAuthLocationParams.state.portalUrl)&&(this._oAuthLocationParams.access_token||this._oAuthLocationParams.code&&this._oAuthLocationParams.state.uid===n.stateUID&&n.codeVerifier)){const s=this._oAuthLocationParams;this._oAuthLocationParams=null,e._pendingDfd=this._processOAuthResponseParams(s,g,p).then((e=>{t(e)})).catch(r)}else{const s=()=>{f?e._pendingDfd=this.oAuthSignIn(e.resUrl_,p,g,e.options_).then(t,r):(v=new i("identity-manager:not-authenticated","User is not signed in."),r(v))};this._doPortalSignIn(e.resUrl_)?e._pendingDfd=this._getPlatformSelf(p.server,g.appId).then((e=>{_(e.portalUrl,this._appOrigin,!0)?(m=new j({userId:e.username,server:p.server,expires:Date.now()+1e3*e.expires_in,token:e.token}),t(m)):s()})).catch(s):s()}}else if(f){if(this._checkProtocol(e.resUrl_,p,r,e.admin_)){let s=e.options_;e.admin_&&(s=s||{},s.isAdmin=!0),e._pendingDfd=this.signIn(e.resUrl_,p,s).then(t,r)}}else v=new i("identity-manager:not-authenticated","User is not signed in."),r(v)},n=()=>{const s=e.sinfo_,i=s.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(C(s,this._legacyFed)){const e=l.toJSON();e.server=s.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((r=>{t(new j({userId:l.userId,server:s.server,token:r.token,expires:null!=r.expires?Number(r.expires):null,ssl:!!r.ssl,isAdmin:e.admin_,validity:r.validity}))}),r)}}else{this._busy=null,o&&(e.options_.token=null);(e._pendingDfd=this.getCredential(i.replace(/\/?$/,"/sharing"),{resource:e.resUrl_,owningTenant:s.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=r;const a=e.sinfo_.owningSystemUrl,l=this._isServerRsrc(e.resUrl_),d=e.sinfo_._restInfoPms;d?d.promise.then((t=>{const r=e.sinfo_;if(r._restInfoPms){r.adminTokenServiceUrl=r._restInfoPms.adminUrl,r._restInfoPms=null,r.tokenServiceUrl=h("authInfo.tokenServicesUrl",t)||h("authInfo.tokenServiceUrl",t)||h("tokenServiceUrl",t),r.shortLivedTokenValidity=h("authInfo.shortLivedTokenValidity",t),r.currentVersion=t.currentVersion,r.owningTenant=t.owningTenant;const e=r.owningSystemUrl=t.owningSystemUrl;e&&this._portals.push(e)}l&&r.owningSystemUrl?n():s()}),(()=>{e.sinfo_._restInfoPms=null;const t=new i("identity-manager:server-identification-failed","Unknown resource - could not find token service endpoint.");r(t)})):l&&a?n():e.sinfo_._selfReq?e.sinfo_._selfReq.selfDfd.then((t=>{const r={};let s,i,n,o;return t&&(s=t.user&&t.user.username,r.username=s,r.allSSL=t.allSSL,i=t.supportsOAuth,n=parseFloat(t.currentVersion),"multitenant"===t.portalMode&&(o=t.customBaseUrl),e.sinfo_.currentVersion=n),e.sinfo_.webTierAuth=!!s,s&&this.normalizeWebTierAuth?this.generateToken(e.sinfo_,null,{ssl:r.allSSL}).catch((()=>null)).then((e=>(r.portalToken=e&&e.token,r.tokenExpiration=e&&e.expires,r))):!s&&i&&n>=4.4&&!this._findOAuthInfo(e.resUrl_)?this._generateOAuthInfo({portalUrl:e.sinfo_.server,customBaseUrl:o,owningTenant:e.sinfo_._selfReq.owningTenant}).catch((()=>null)).then((()=>r)):r})).catch((()=>null)).then((t=>{e.sinfo_._selfReq=null,t?s(t.username,t.allSSL,t.portalToken,t.tokenExpiration):s()})):s()}_generateOAuthInfo(e){let t,r,i=e.portalUrl;const n=e.customBaseUrl,o=e.owningTenant,a=!this.defaultOAuthInfo&&this._createDefaultOAuthInfo&&!this._hasTestedIfAppIsOnPortal;if(a){r=window.location.href;let e=r.indexOf("?");e>-1&&(r=r.slice(0,e)),e=r.search(/\/(apps|home)\//),r=e>-1?r.slice(0,e):null}return a&&r?(this._hasTestedIfAppIsOnPortal=!0,t=s(r+"/sharing/rest",{query:{f:"json"}}).then((()=>{this.defaultOAuthInfo=new x({appId:"arcgisonline",popupCallbackUrl:r+"/home/oauth-callback.html"})}))):t=Promise.resolve(),t.then((()=>{if(this.defaultOAuthInfo)return i=i.replace(/^http:/i,"https:"),s(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||!(_(i,this._appOrigin)||this._gwDomains.some((e=>e.regex.test(i)&&e.regex.test(this._appOrigin)))),this.oAuthInfos.push(t)}}))}))}_doOAuthSignIn(e,t,r,s){const n=r._oAuthCred,a={portalUrl:r.portalUrl};!r.popup&&r.preserveUrlHash&&window.location.hash&&(a.hash=window.location.hash),n.stateUID&&(a.uid=n.stateUID);const h={client_id:r.appId,response_type:n.codeVerifier?"code":"token",state:JSON.stringify(a),expiration:r.expiration,locale:r.locale,redirect_uri:this._getRedirectURI(r,!!n.codeVerifier)};r.forceLogin&&(h.force_login=!0),r.forceUserId&&r.userId&&(h.prepopulatedusername=r.userId),!r.popup&&this._doPortalSignIn(e)&&(h.redirectToUserOrgUrl=!0),n.codeVerifier&&(h.code_challenge=s||n.codeVerifier,h.code_challenge_method=s?"S256":"plain");const l=r.portalUrl.replace(/^http:/i,"https:")+"/sharing/oauth2/authorize",c=l+"?"+m(h);if(r.popup){const e=window.open(c,"esriJSAPIOAuth",r.popupWindowFeatures);if(e)e.focus(),this._oAuthDfd.oAuthWin_=e,this._oAuthIntervalId=setInterval((()=>{if(e.closed){clearInterval(this._oAuthIntervalId),this._oAuthOnPopupHandle.remove();const e=this._oAuthDfd;if(e){const t=new i("identity-manager:user-aborted","ABORTED");e.reject(t)}}}),500),this._oAuthOnPopupHandle=o(window,["arcgis:auth:hash","arcgis:auth:location:search"],(e=>{"arcgis:auth:hash"===e.type?this.setOAuthResponseHash(e.detail):this._setOAuthResponseQueryString(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:h,authorizeUrl:l,resourceUrl:e,serverInfo:t,oAuthInfo:r}):window.location.href=c}_getRedirectURI(e,t){const r=window.location.href.replace(/#.*$/,"");if(e.popup)return w(e.popupCallbackUrl);if(t){const e=p(r);return e.query&&["code","error","error_description","message_code","persist","state"].forEach((t=>{delete e.query[t]})),I(e.path,e.query)}return r}}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=r.findServerInfo(this.server),t=e&&e.owningSystemUrl,s=!!t&&"server"===this.scope,i=s&&C(e,r._legacyFed),n=e.webTierAuth,o=n&&r.normalizeWebTierAuth,a=P[this.server],h=a&&a[this.userId];let l,c=this.resources&&this.resources[0],d=s&&r.findServerInfo(t),u={username:this.userId,password:h};if(n&&!o)return;s&&!d&&r.serverInfos.some((e=>(r._isIdProvider(t,e.server)&&(d=e),!!d)));const p=d&&r.findCredential(d.server,this.userId);if(!s||p){if(!i){if(s)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=r._sanitizeUrl(c),this._enqueued=1,t=r._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 r.generateToken(s?d:e,s?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&&r.credentials.forEach((e=>{const t=r.findServerInfo(e.server),s=t&&t.owningSystemUrl;e!==this&&e.userId===this.userId&&s&&"server"===e.scope&&(r._hasSameServerInstance(this.server,s)||r._isIdProvider(s,this.server))&&(C(t,r._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&&r.findServerInfo(this.server),s=t&&t.owningSystemUrl,i=s&&r.findServerInfo(s);!1===e||s&&"portal"!==this.scope&&(!i||!i.webTierAuth||r.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=r.credentials.indexOf(this);e>-1&&r.credentials.splice(e,1),this.emitTokenChange(),this.emit("destroy")}toJSON(){const e=a({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 r=(this.validity?this.creationTime+6e4*this.validity:this.expires)-Date.now();r<0?r=0:r>t&&(r=t),this._refreshTimer=setTimeout(this.refreshToken.bind(this),r>e?r-e:r)}};e([A()],j.prototype,"creationTime",void 0),e([A()],j.prototype,"expires",void 0),e([A()],j.prototype,"isAdmin",void 0),e([A()],j.prototype,"oAuthState",void 0),e([A()],j.prototype,"resources",void 0),e([A()],j.prototype,"scope",void 0),e([A()],j.prototype,"server",void 0),e([A()],j.prototype,"ssl",void 0),e([A()],j.prototype,"token",void 0),e([A()],j.prototype,"tokenRefreshBuffer",void 0),e([A()],j.prototype,"userId",void 0),e([A()],j.prototype,"validity",void 0),j=e([k("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 r}from"../kernel.js";import s from"../request.js";import i from"../core/Error.js";import n from"../core/Evented.js";import{on as o}from"../core/events.js";import{fixJson as a}from"../core/lang.js";import{getDeepValue as h}from"../core/object.js";import{createResolver as l,onAbort as c,isAborted as d}from"../core/promiseUtils.js";import{Url as u,urlToObject as p,hasSameOrigin as _,queryToObject as g,base64UrlEncode as f,objectToQuery as m,normalize as v,getProxyRule as S,makeAbsolute as w,addQueryParameters as I}from"../core/urlUtils.js";import{property as A}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import{subclass as k}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 P={},R=e=>{const t=new u(e.owningSystemUrl).host,r=new u(e.server).host,s=/.+\.arcgis\.com$/i;return s.test(t)&&s.test(r)},C=(e,t)=>!!(R(e)&&t&&t.some((t=>t.test(e.server))));let b=null,D=null;try{b=window.localStorage,D=window.sessionStorage}catch{}class q extends n{constructor(){super(),this._portalConfig=globalThis.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=p(window.location.href),this._busy=null,this._rejectOnPersistedPageShow=!1,this._oAuthLocationParams=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|KnowledgeGraphServer|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._getOAuthLocationParams(),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 r of e){const e=this.findOAuthInfo(r.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),r=this._isServerRsrc(t);let s,i=this.findServerInfo(t),n=!0;i||(i=new O,i.server=this._getServerInstanceRoot(t),r?i.hasServer=!0:(i.tokenServiceUrl=this._getTokenSvcUrl(t),i.hasPortal=!0),this.registerServers([i])),s=this._findCredential(t),s?(delete e.server,Object.assign(s,e),n=!1):(s=new j({userId:e.userId,server:i.server,token:e.token,expires:e.expires,ssl:e.ssl,scope:r?"server":"portal"}),s.resources=[t],this.credentials.push(s)),s.emitTokenChange(!1),n||s.refreshServerTokens()}toJSON(){return a({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,r=e.oAuthInfos,s=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(r){const e=[];r.forEach((t=>{t.appId&&e.push(t.declaredClass?t:new x(t))})),e.length&&this.registerOAuthInfos(e)}s&&s.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 r of this.serverInfos)if(this._hasSameServerInstance(r.server,e)){t=r;break}return t}findOAuthInfo(e){let t;e=this._sanitizeUrl(e);for(const r of this.oAuthInfos)if(this._hasSameServerInstance(r.portalUrl,e)){t=r;break}return t}findCredential(e,t){let r;e=this._sanitizeUrl(e);const s=this._isServerRsrc(e)?"server":"portal";if(t){for(const i of this.credentials)if(this._hasSameServerInstance(i.server,e)&&t===i.userId&&i.scope===s){r=i;break}}else for(const i of this.credentials)if(this._hasSameServerInstance(i.server,e)&&-1!==this._getIdenticalSvcIdx(e,i)&&i.scope===s){r=i;break}return r}getCredential(e,t){let r,s,n=!0;t&&(r=!!t.token,s=t.error,n=!1!==t.prompt),t={...t},e=this._sanitizeUrl(e);const o=new AbortController,a=l();if(t.signal&&c(t.signal,(()=>{o.abort()})),c(o,(()=>{a.reject(new i("identity-manager:user-aborted","ABORTED"))})),d(o))return a.promise;t.signal=o.signal;const h=this._isAdminResource(e),u=r?this.findCredential(e):null;let p;if(u&&s&&s.details&&498===s.details.httpStatus)u.destroy();else if(u)return p=new i("identity-manager:not-authorized","You are currently signed in as: '"+u.userId+"'. You do not have access to this resource: "+e,{error:s}),a.reject(p),a.promise;const g=this._findCredential(e,t);if(g)return a.resolve(g),a.promise;let f=this.findServerInfo(e);if(f)!f.hasServer&&this._isServerRsrc(e)&&(f._restInfoPms=this._getTokenSvcUrl(e),f.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;f=new O,f.server=this._getServerInstanceRoot(e),"string"==typeof t?(f.tokenServiceUrl=t,f.hasPortal=!0):(f._restInfoPms=t,f.hasServer=!0),this.registerServers([f])}return f.hasPortal&&void 0===f._selfReq&&(n||_(f.tokenServiceUrl,this._appOrigin)||this._gwDomains.some((e=>e.tokenServiceUrl===f.tokenServiceUrl)))&&(f._selfReq={owningTenant:t&&t.owningTenant,selfDfd:this._getPortalSelf(f.tokenServiceUrl.replace(this._rePortalTokenSvc,"/sharing/rest/portals/self"),e)}),this._enqueue(e,f,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,r){const n=this._rePortalTokenSvc.test(e.tokenServiceUrl),o=new u(this._appOrigin),a=e.shortLivedTokenValidity;let h,l,c,d,p,g,f,m;t&&(m=this.tokenValidity||a||this.defaultTokenValidity,m>a&&a>0&&(m=a)),r&&(h=r.isAdmin,l=r.serverUrl,c=r.token,g=r.signal,f=r.ssl,e.customParameters=r.customParameters),h?d=e.adminTokenServiceUrl:(d=e.tokenServiceUrl,p=new u(d.toLowerCase()),e.webTierAuth&&null!=r&&r.serverUrl&&!f&&"http"===o.scheme&&(_(o.uri,d,!0)||"https"===p.scheme&&o.host===p.host&&"7080"===o.port&&"7443"===p.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,r),signal:g,...null==r?void 0:r.ioArgs};n||(v.withCredentials=!1);return s(d,v).then((r=>{const s=r.data;if(!s||!s.token)return new i("identity-manager:authentication-failed","Unable to generate token");const n=e.server;return P[n]||(P[n]={}),t&&(P[n][t.username]=t.password),s.validity=m,s}))}isBusy(){return!!this._busy}checkSignInStatus(e){return this.checkAppAccess(e,"").then((e=>e.credential))}checkAppAccess(e,t,r){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)||r&&r.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),s(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){e&&("#"===e.charAt(0)&&(e=e.substring(1)),this._processOAuthPopupParams(g(e)))}setOAuthRedirectionHandler(e){this._oAuthRedirectFunc=e}setProtocolErrorHandler(e){this._protocolFunc=e}signIn(e,t,r={}){const s=l(),n=()=>{var e,t,r,s,i;null==(e=h)||e.remove(),null==(t=d)||t.remove(),null==(r=u)||r.remove(),null==(s=a)||s.destroy(),null==(i=this.dialog)||i.destroy(),this.dialog=a=h=d=u=null},o=()=>{n(),this._oAuthDfd=null,s.reject(new i("identity-manager:user-aborted","ABORTED"))};r.signal&&c(r.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),d=this.dialog.watch("open",o),u=a.on("submit",(e=>{this.generateToken(t,e,{isAdmin:r.isAdmin,signal:r.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:r.isAdmin,validity:i.validity});s.resolve(o)})).catch((e=>{a.error=e,a.signingIn=!1}))}));return s.promise}oAuthSignIn(e,t,r,s){this._oAuthDfd=l();const n=this._oAuthDfd;let o;null!=s&&s.signal&&c(s.signal,(()=>{const e=this._oAuthDfd&&this._oAuthDfd.oAuthWin_;e&&!e.closed?e.close():this.dialog&&_()})),n.resUrl_=e,n.sinfo_=t,n.oinfo_=r;const a=r._oAuthCred;if(a.storage&&("authorization-code"===r.flowType||"auto"===r.flowType&&!r.popup&&t.currentVersion>=8.4)){let e=crypto.getRandomValues(new Uint8Array(32));o=f(e),a.codeVerifier=o,e=crypto.getRandomValues(new Uint8Array(32)),a.stateUID=f(e),a.save()||(a.codeVerifier=o=null)}else a.codeVerifier=null;let h,d,u,p;this._getCodeChallenge(o).then((i=>{const n=!s||!1!==s.oAuthPopupConfirmation;r.popup&&n?(h=new this.formConstructor,h.oAuthPrompt=!0,h.server=t.server,this.dialog=new U,this.dialog.content=h,this.dialog.open=!0,this.emit("dialog-create"),d=h.on("cancel",_),u=this.dialog.watch("open",_),p=h.on("submit",(()=>{g(),this._doOAuthSignIn(e,t,r,i)}))):this._doOAuthSignIn(e,t,r,i)}));const _=()=>{g(),this._oAuthDfd=null,n.reject(new i("identity-manager:user-aborted","ABORTED"))},g=()=>{var e,t,r,s,i;null==(e=d)||e.remove(),null==(t=u)||t.remove(),null==(r=p)||r.remove(),null==(s=h)||s.destroy(),null==(i=this.dialog)||i.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 r;if((t.origin===this._appOrigin||t.origin.endsWith(".arcgis.com"))&&"arcgis:auth:requestCredential"===(null==(r=t.data)?void 0:r.type)){const r=t.source;this.getCredential(e).then((e=>{r.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=>{r.postMessage({type:"arcgis:auth:error",error:{name:e.name,message:e.message}},t.origin)}))}}))}disablePostMessageAuth(){this._postMessageAuthHandle&&(this._postMessageAuthHandle.remove(),this._postMessageAuthHandle=null)}_getOAuthLocationParams(){let e=window.location.hash;if(e){"#"===e.charAt(0)&&(e=e.substring(1));const r=g(e);let s=!1;if(r.access_token&&r.expires_in&&r.state&&r.hasOwnProperty("username"))try{r.state=JSON.parse(r.state),r.state.portalUrl&&(this._oAuthLocationParams=r,s=!0)}catch{}else if(r.error&&r.error_description&&(console.log("IdentityManager OAuth Error: ",r.error," - ",r.error_description),"access_denied"===r.error&&(s=!0,r.state)))try{r.state=JSON.parse(r.state)}catch{}var t;if(s)window.location.hash=(null==(t=r.state)?void 0:t.hash)||""}let r=window.location.search;if(r){"?"===r.charAt(0)&&(r=r.substring(1));const e=g(r);let t=!1;if(e.code&&e.state)try{e.state=JSON.parse(e.state),e.state.portalUrl&&e.state.uid&&(this._oAuthLocationParams=e,t=!0)}catch{}else if(e.error&&e.error_description&&(console.log("IdentityManager OAuth Error: ",e.error," - ",e.error_description),"access_denied"===e.error&&(t=!0,e.state)))try{e.state=JSON.parse(e.state)}catch{}if(t){var s;const t={...e};["code","error","error_description","message_code","persist","state"].forEach((e=>{delete t[e]}));const r=m(t),i=window.location.pathname+(r?`?${r}`:"")+((null==(s=e.state)?void 0:s.hash)||"");window.history.replaceState(window.history.state,"",i)}}}_getOAuthToken(e,t,r,i,n){return e=e.replace(/^http:/i,"https:"),s(`${e}/sharing/rest/oauth2/token`,{authMode:"anonymous",method:"post",query:i&&n?{grant_type:"authorization_code",code:t,redirect_uri:i,client_id:r,code_verifier:n}:{grant_type:"refresh_token",refresh_token:t,client_id:r}}).then((e=>e.data))}_getCodeChallenge(e){if(e&&globalThis.isSecureContext){const t=(new TextEncoder).encode(e);return crypto.subtle.digest("SHA-256",t).then((e=>f(new Uint8Array(e))))}return Promise.resolve(null)}_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 r,s,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(r=c[0],n=this.findServerInfo(r.server),s=n&&n.owningSystemUrl,i=s&&this.findCredential(s,r.userId),o=this._getIdenticalSvcIdx(e,r),!a)return-1===o&&r.resources.push(e),this._addResource(e,i),r;-1!==o&&(r.resources.splice(o,1),this._removeResource(e,i))}else{let t,r;if(c.some((a=>(r=this._getIdenticalSvcIdx(e,a),-1!==r&&(t=a,n=this.findServerInfo(t.server),s=n&&n.owningSystemUrl,i=s&&this.findCredential(s,t.userId),o=r,!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 r of this.oAuthInfos)if(this._isIdProvider(r.portalUrl,e)){t=r;break}return t}_addResource(e,t){t&&-1===this._getIdenticalSvcIdx(e,t)&&t.resources.push(e)}_removeResource(e,t){let r=-1;t&&(r=this._getIdenticalSvcIdx(e,t),r>-1&&t.resources.splice(r,1))}_useProxy(e,t){return t&&t.isAdmin&&!_(e.adminTokenServiceUrl,this._appOrigin)||!this._isPortalDomain(e.tokenServiceUrl)&&"10.1"===String(e.currentVersion)&&!_(e.tokenServiceUrl,this._appOrigin)}_getOrigin(e){const t=new u(e);return t.scheme+"://"+t.host+(null!=t.port?":"+t.port:"")}_getServerInstanceRoot(e){const t=e.toLowerCase();let r=t.indexOf(this._agsRest);return-1===r&&this._isAdminResource(e)&&(r=this._agsAdmin.test(e)?e.replace(this._agsAdmin,"$1").length:e.search(this._adminSvcs)),-1===r&&(r=t.indexOf("/sharing")),-1===r&&"/"===t.substr(-1)&&(r=t.length-1),r>-1?e.substring(0,r):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,r=/^https?:\/\/(?:cdndev|[a-z\d-]+\.mapsdevext)\.arcgis\.com/i,s=/^https?:\/\/(?:cdnqa|[a-z\d-]+\.mapsqa)\.arcgis\.com/i;return t.test(e)?e=e.replace(t,"https://www.arcgis.com"):r.test(e)?e=e.replace(r,"https://devext.arcgis.com"):s.test(e)&&(e=e.replace(s,"https://qaext.arcgis.com")),e}_sanitizeUrl(e){const r=(t.request.proxyUrl||"").toLowerCase(),s=r?e.toLowerCase().indexOf(r+"?"):-1;return-1!==s&&(e=e.substring(s+r.length+1)),e=v(e),p(e).path}_isRESTService(e){return e.includes(this._agsRest)}_isAdminResource(e){return this._agsAdmin.test(e)||this._adminSvcs.test(e)}_isServerRsrc(e){return this._isRESTService(e)||this._isAdminResource(e)}_isIdenticalService(e,t){let r;if(this._isRESTService(e)&&this._isRESTService(t)){const s=this._getSuffix(e).toLowerCase(),i=this._getSuffix(t).toLowerCase();if(r=s===i,!r){const e=/(.*)\/(MapServer|FeatureServer|UtilityNetworkServer).*/gi;r=s.replace(e,"$1")===i.replace(e,"$1")}}else this._isAdminResource(e)&&this._isAdminResource(t)?r=!0:this._isServerRsrc(e)||this._isServerRsrc(t)||!this._isPortalDomain(e)||(r=!0);return r}_isPortalDomain(e){const r=new u(e.toLowerCase()),s=this._portalConfig;let i=this._gwDomains.some((e=>e.regex.test(r.uri)));return!i&&s&&(i=this._hasSameServerInstance(this._getServerInstanceRoot(s.restBaseUrl),r.uri)),i||t.portalUrl&&(i=_(r,t.portalUrl,!0)),i||(i=this._portals.some((e=>this._hasSameServerInstance(e,r.uri)))),i=i||this._agsPortal.test(r.path),i}_isIdProvider(e,t){let r=-1,s=-1;this._gwDomains.forEach(((i,n)=>{-1===r&&i.regex.test(e)&&(r=n),-1===s&&i.regex.test(t)&&(s=n)}));let i=!1;if(r>-1&&s>-1&&(0===r||4===r?0!==s&&4!==s||(i=!0):1===r?1!==s&&2!==s||(i=!0):2===r?2===s&&(i=!0):3===r&&3===s&&(i=!0)),!i){const r=this.findServerInfo(t),s=r&&r.owningSystemUrl;s&&R(r)&&this._isPortalDomain(s)&&this._isIdProvider(e,s)&&(i=!0)}return i}_getIdenticalSvcIdx(e,t){let r=-1;for(let s=0;s<t.resources.length;s++){const i=t.resources[s];if(this._isIdenticalService(e,i)){r=s;break}}return r}_getSuffix(e){return e.replace(this._regexSDirUrl,"").replace(this._regexServerType,"$1")}_getTokenSvcUrl(e){let t,r,i;if(this._isRESTService(e)||this._isAdminResource(e)){const i=this._getServerInstanceRoot(e);return t=i+"/admin/generateToken",r=s(e=i+"/rest/info",{query:{f:"json"}}).then((e=>e.data)),{adminUrl:t,promise:r}}if(this._isPortalDomain(e)){let t="";if(this._gwDomains.some((r=>(r.regex.test(e)&&(t=r.tokenServiceUrl),!!t))),t||this._portals.some((r=>(this._hasSameServerInstance(r,e)&&(t=r+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 r=new u(e).port;/^http:\/\//i.test(e)&&"7080"===r&&(t=t.replace(/:7080/i,":7443")),t=t.replace(/http:/i,"https:")}return t}if(e.toLowerCase().includes("premium.arcgisonline.com"))return"https://premium.arcgisonline.com/server/tokens"}_processOAuthResponseParams(e,t,r){const s=t._oAuthCred;if(e.code){const i=s.codeVerifier;return s.codeVerifier=null,s.stateUID=null,s.save(),this._getOAuthToken(r.server,e.code,t.appId,this._getRedirectURI(t,!0),i).then((i=>{const n=new j({userId:i.username,server:r.server,token:i.access_token,expires:Date.now()+1e3*i.expires_in,ssl:i.ssl,oAuthState:e.state,_oAuthCred:s});return t.userId=n.userId,s.storage=i.persist?b:D,s.refreshToken=i.refresh_token,s.token=null,s.expires=i.refresh_token_expires_in?Date.now()+1e3*i.refresh_token_expires_in:null,s.userId=n.userId,s.ssl=n.ssl,s.save(),n}))}const i=new j({userId:e.username,server:r.server,token:e.access_token,expires:Date.now()+1e3*Number(e.expires_in),ssl:"true"===e.ssl,oAuthState:e.state,_oAuthCred:s});return t.userId=i.userId,s.storage=e.persist?b:D,s.refreshToken=null,s.token=i.token,s.expires=i.expires,s.userId=i.userId,s.ssl=i.ssl,s.save(),Promise.resolve(i)}_processOAuthPopupParams(e){var t;const r=this._oAuthDfd;if(this._oAuthDfd=null,r)if(clearInterval(this._oAuthIntervalId),null==(t=this._oAuthOnPopupHandle)||t.remove(),e.error){const t="access_denied"===e.error,s=new i(t?"identity-manager:user-aborted":"identity-manager:authentication-failed",t?"ABORTED":"OAuth: "+e.error+" - "+e.error_description);r.reject(s)}else this._processOAuthResponseParams(e,r.oinfo_,r.sinfo_).then((e=>{r.resolve(e)})).catch((e=>{r.reject(e)}))}_setOAuthResponseQueryString(e){e&&("?"===e.charAt(0)&&(e=e.substring(1)),this._processOAuthPopupParams(g(e)))}_exchangeToken(e,t,r){return s(`${e}/sharing/rest/oauth2/exchangeToken`,{authMode:"anonymous",method:"post",query:{f:"json",client_id:t,token:r}}).then((e=>e.data.token))}_getPlatformSelf(e,t){return e=e.replace(/^http:/i,"https:"),s(`${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",expiration:30},withCredentials:!0}).then((e=>e.data))}_getPortalSelf(e,t){let r;if(this._gwDomains.some((t=>(t.regex.test(e)&&(r=t.customBaseUrl),!!r))),r)return Promise.resolve({allSSL:!0,currentVersion:"8.4",customBaseUrl:r,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 s(e,{query:{f:"json"},authMode:"anonymous",withCredentials:!0}).then((e=>e.data))}_doPortalSignIn(e){const t=this._portalConfig,r=window.location.href,s=this.findServerInfo(e);return!(!t&&!this._isPortalDomain(r)||!(s?s.hasPortal||s.owningSystemUrl&&this._isPortalDomain(s.owningSystemUrl):this._isPortalDomain(e))||!(this._isIdProvider(r,e)||t&&(this._hasSameServerInstance(this._getServerInstanceRoot(t.restBaseUrl),e)||this._isIdProvider(t.restBaseUrl,e))||_(r,e,!0)))}_checkProtocol(e,t,r,s){let n=!0;const o=s?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)){r(new i("identity-manager:aborted","Aborted the Sign-In process to avoid sending password over insecure connection."))}return n}_enqueue(e,t,r,s,i,n){return s||(s=l()),s.resUrl_=e,s.sinfo_=t,s.options_=r,s.admin_=i,s.refresh_=n,this._busy?this._hasSameServerInstance(this._getServerInstanceRoot(e),this._busy.resUrl_)?(this._oAuthDfd&&this._oAuthDfd.oAuthWin_&&this._oAuthDfd.oAuthWin_.focus(),this._soReqs.push(s)):this._xoReqs.push(s):this._doSignIn(s),s.promise}_doSignIn(e){this._busy=e,this._rejectOnPersistedPageShow=!1;const t=t=>{const r=e.options_&&e.options_.resource,s=e.resUrl_,i=e.refresh_;let n=!1;this.credentials.includes(t)||(i&&this.credentials.includes(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.includes(r||s)||t.resources.push(r||s),t.scope=this._isServerRsrc(s)?"server":"portal",t.emitTokenChange();const o=this._soReqs,a={};this._soReqs=[],o.forEach((e=>{if(!this._isIdenticalService(s,e.resUrl_)){const r=this._getSuffix(e.resUrl_);a[r]||(a[r]=!0,t.resources.push(e.resUrl_))}})),e.resolve(t),o.forEach((e=>{this._hasSameServerInstance(this._getServerInstanceRoot(s),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())},r=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())},s=(n,a,h,l)=>{var d,u;const p=e.sinfo_,g=!e.options_||!1!==e.options_.prompt,f=p.hasPortal&&this._findOAuthInfo(e.resUrl_);let m,v;if(n)t(new j({userId:n,server:p.server,token:h||null,expires:null!=l?Number(l):null,ssl:!!a}));else if(window!==window.parent&&null!=(d=this._appUrlObj.query)&&d["arcgis-auth-origin"]&&null!=(u=this._appUrlObj.query)&&u["arcgis-auth-portal"]&&this._hasSameServerInstance(this._getServerInstanceRoot(this._appUrlObj.query["arcgis-auth-portal"]),e.resUrl_)){var S;window.parent.postMessage({type:"arcgis:auth:requestCredential"},this._appUrlObj.query["arcgis-auth-origin"]);const s=o(window,"message",(e=>{e.source===window.parent&&e.data&&("arcgis:auth:credential"===e.data.type?(s.remove(),e.data.credential.expires<Date.now()?r(new i("identity-manager:credential-request-failed","Parent application's token has expired.")):t(new j(e.data.credential))):"arcgis:auth:error"===e.data.type&&(s.remove(),"tokenExpiredError"===e.data.error.name?r(new i("identity-manager:credential-request-failed","Parent application's token has expired.")):r(i.fromJSON(e.data.error))))}));c(null==(S=e.options_)?void 0:S.signal,(()=>{s.remove()}))}else if(f){let n=f._oAuthCred;if(!n){const e=new T(f,b),t=new T(f,D);e.isValid()&&t.isValid()?e.expires>t.expires?(n=e,t.destroy()):(n=t,e.destroy()):n=e.isValid()?e:t,f._oAuthCred=n}if(n.isValid()){m=new j({userId:n.userId,server:p.server,token:n.token,expires:n.expires,ssl:n.ssl,_oAuthCred:n});const r=f.appId!==n.appId&&this._doPortalSignIn(e.resUrl_);r||n.refreshToken?(e._pendingDfd=n.refreshToken?this._getOAuthToken(p.server,n.refreshToken,n.appId).then((e=>(m.expires=Date.now()+1e3*e.expires_in,m.token=e.access_token,m))):Promise.resolve(m),e._pendingDfd.then((e=>r?this._exchangeToken(e.server,f.appId,e.token).then((t=>(e.token=t,e))).catch((()=>e)):e)).then((e=>{t(e)})).catch((()=>{n.destroy(),s()}))):t(m)}else if(this._oAuthLocationParams&&this._hasSameServerInstance(f.portalUrl,this._oAuthLocationParams.state.portalUrl)&&(this._oAuthLocationParams.access_token||this._oAuthLocationParams.code&&this._oAuthLocationParams.state.uid===n.stateUID&&n.codeVerifier)){const s=this._oAuthLocationParams;this._oAuthLocationParams=null,e._pendingDfd=this._processOAuthResponseParams(s,f,p).then((e=>{t(e)})).catch(r)}else{const s=()=>{g?e._pendingDfd=this.oAuthSignIn(e.resUrl_,p,f,e.options_).then(t,r):(v=new i("identity-manager:not-authenticated","User is not signed in."),r(v))};this._doPortalSignIn(e.resUrl_)?e._pendingDfd=this._getPlatformSelf(p.server,f.appId).then((e=>{_(e.portalUrl,this._appOrigin,!0)?(m=new j({userId:e.username,server:p.server,expires:Date.now()+1e3*e.expires_in,token:e.token}),t(m)):s()})).catch(s):s()}}else if(g){if(this._checkProtocol(e.resUrl_,p,r,e.admin_)){let s=e.options_;e.admin_&&(s=s||{},s.isAdmin=!0),e._pendingDfd=this.signIn(e.resUrl_,p,s).then(t,r)}}else v=new i("identity-manager:not-authenticated","User is not signed in."),r(v)},n=()=>{const s=e.sinfo_,i=s.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(C(s,this._legacyFed)){const e=l.toJSON();e.server=s.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((r=>{t(new j({userId:l.userId,server:s.server,token:r.token,expires:null!=r.expires?Number(r.expires):null,ssl:!!r.ssl,isAdmin:e.admin_,validity:r.validity}))}),r)}}else{this._busy=null,o&&(e.options_.token=null);(e._pendingDfd=this.getCredential(i.replace(/\/?$/,"/sharing"),{resource:e.resUrl_,owningTenant:s.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=r;const a=e.sinfo_.owningSystemUrl,l=this._isServerRsrc(e.resUrl_),d=e.sinfo_._restInfoPms;d?d.promise.then((t=>{const r=e.sinfo_;if(r._restInfoPms){r.adminTokenServiceUrl=r._restInfoPms.adminUrl,r._restInfoPms=null,r.tokenServiceUrl=h("authInfo.tokenServicesUrl",t)||h("authInfo.tokenServiceUrl",t)||h("tokenServiceUrl",t),r.shortLivedTokenValidity=h("authInfo.shortLivedTokenValidity",t),r.currentVersion=t.currentVersion,r.owningTenant=t.owningTenant;const e=r.owningSystemUrl=t.owningSystemUrl;e&&this._portals.push(e)}l&&r.owningSystemUrl?n():s()}),(()=>{e.sinfo_._restInfoPms=null;const t=new i("identity-manager:server-identification-failed","Unknown resource - could not find token service endpoint.");r(t)})):l&&a?n():e.sinfo_._selfReq?e.sinfo_._selfReq.selfDfd.then((t=>{const r={};let s,i,n,o;return t&&(s=t.user&&t.user.username,r.username=s,r.allSSL=t.allSSL,i=t.supportsOAuth,n=parseFloat(t.currentVersion),"multitenant"===t.portalMode&&(o=t.customBaseUrl),e.sinfo_.currentVersion=n),e.sinfo_.webTierAuth=!!s,s&&this.normalizeWebTierAuth?this.generateToken(e.sinfo_,null,{ssl:r.allSSL}).catch((()=>null)).then((e=>(r.portalToken=e&&e.token,r.tokenExpiration=e&&e.expires,r))):!s&&i&&n>=4.4&&!this._findOAuthInfo(e.resUrl_)?this._generateOAuthInfo({portalUrl:e.sinfo_.server,customBaseUrl:o,owningTenant:e.sinfo_._selfReq.owningTenant}).catch((()=>null)).then((()=>r)):r})).catch((()=>null)).then((t=>{e.sinfo_._selfReq=null,t?s(t.username,t.allSSL,t.portalToken,t.tokenExpiration):s()})):s()}_generateOAuthInfo(e){let t,r,i=e.portalUrl;const n=e.customBaseUrl,o=e.owningTenant,a=!this.defaultOAuthInfo&&this._createDefaultOAuthInfo&&!this._hasTestedIfAppIsOnPortal;if(a){r=window.location.href;let e=r.indexOf("?");e>-1&&(r=r.slice(0,e)),e=r.search(/\/(apps|home)\//),r=e>-1?r.slice(0,e):null}return a&&r?(this._hasTestedIfAppIsOnPortal=!0,t=s(r+"/sharing/rest",{query:{f:"json"}}).then((()=>{this.defaultOAuthInfo=new x({appId:"arcgisonline",popupCallbackUrl:r+"/home/oauth-callback.html"})}))):t=Promise.resolve(),t.then((()=>{if(this.defaultOAuthInfo)return i=i.replace(/^http:/i,"https:"),s(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||!(_(i,this._appOrigin)||this._gwDomains.some((e=>e.regex.test(i)&&e.regex.test(this._appOrigin)))),this.oAuthInfos.push(t)}}))}))}_doOAuthSignIn(e,t,r,s){const n=r._oAuthCred,a={portalUrl:r.portalUrl};!r.popup&&r.preserveUrlHash&&window.location.hash&&(a.hash=window.location.hash),n.stateUID&&(a.uid=n.stateUID);const h={client_id:r.appId,response_type:n.codeVerifier?"code":"token",state:JSON.stringify(a),expiration:r.expiration,locale:r.locale,redirect_uri:this._getRedirectURI(r,!!n.codeVerifier)};r.forceLogin&&(h.force_login=!0),r.forceUserId&&r.userId&&(h.prepopulatedusername=r.userId),!r.popup&&this._doPortalSignIn(e)&&(h.redirectToUserOrgUrl=!0),n.codeVerifier&&(h.code_challenge=s||n.codeVerifier,h.code_challenge_method=s?"S256":"plain");const l=r.portalUrl.replace(/^http:/i,"https:")+"/sharing/oauth2/authorize",c=l+"?"+m(h);if(r.popup){const e=window.open(c,"esriJSAPIOAuth",r.popupWindowFeatures);if(e)e.focus(),this._oAuthDfd.oAuthWin_=e,this._oAuthIntervalId=setInterval((()=>{if(e.closed){clearInterval(this._oAuthIntervalId),this._oAuthOnPopupHandle.remove();const e=this._oAuthDfd;if(e){const t=new i("identity-manager:user-aborted","ABORTED");e.reject(t)}}}),500),this._oAuthOnPopupHandle=o(window,["arcgis:auth:hash","arcgis:auth:location:search"],(e=>{"arcgis:auth:hash"===e.type?this.setOAuthResponseHash(e.detail):this._setOAuthResponseQueryString(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:h,authorizeUrl:l,resourceUrl:e,serverInfo:t,oAuthInfo:r}):window.location.href=c}_getRedirectURI(e,t){const r=window.location.href.replace(/#.*$/,"");if(e.popup)return w(e.popupCallbackUrl);if(t){const e=p(r);return e.query&&["code","error","error_description","message_code","persist","state"].forEach((t=>{delete e.query[t]})),I(e.path,e.query)}return r}}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=r.findServerInfo(this.server),t=e&&e.owningSystemUrl,s=!!t&&"server"===this.scope,i=s&&C(e,r._legacyFed),n=e.webTierAuth,o=n&&r.normalizeWebTierAuth,a=P[this.server],h=a&&a[this.userId];let l,c=this.resources&&this.resources[0],d=s&&r.findServerInfo(t),u={username:this.userId,password:h};if(n&&!o)return;s&&!d&&r.serverInfos.some((e=>(r._isIdProvider(t,e.server)&&(d=e),!!d)));const p=d&&r.findCredential(d.server,this.userId);if(!s||p){if(!i){if(s)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=r._sanitizeUrl(c),this._enqueued=1,t=r._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 r.generateToken(s?d:e,s?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&&r.credentials.forEach((e=>{const t=r.findServerInfo(e.server),s=t&&t.owningSystemUrl;e!==this&&e.userId===this.userId&&s&&"server"===e.scope&&(r._hasSameServerInstance(this.server,s)||r._isIdProvider(s,this.server))&&(C(t,r._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&&r.findServerInfo(this.server),s=t&&t.owningSystemUrl,i=s&&r.findServerInfo(s);!1===e||s&&"portal"!==this.scope&&(!i||!i.webTierAuth||r.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=r.credentials.indexOf(this);e>-1&&r.credentials.splice(e,1),this.emitTokenChange(),this.emit("destroy")}toJSON(){const e=a({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 r=(this.validity?this.creationTime+6e4*this.validity:this.expires)-Date.now();r<0?r=0:r>t&&(r=t),this._refreshTimer=setTimeout(this.refreshToken.bind(this),r>e?r-e:r)}};e([A()],j.prototype,"creationTime",void 0),e([A()],j.prototype,"expires",void 0),e([A()],j.prototype,"isAdmin",void 0),e([A()],j.prototype,"oAuthState",void 0),e([A()],j.prototype,"resources",void 0),e([A()],j.prototype,"scope",void 0),e([A()],j.prototype,"server",void 0),e([A()],j.prototype,"ssl",void 0),e([A()],j.prototype,"token",void 0),e([A()],j.prototype,"tokenRefreshBuffer",void 0),e([A()],j.prototype,"userId",void 0),e([A()],j.prototype,"validity",void 0),j=e([k("esri.identity.Credential")],j);export{j as Credential,q as IdentityManagerBase};