@arcgis/core 4.23.0-next.20220131 → 4.23.0-next.20220205

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 (402) hide show
  1. package/Graphic.js +1 -1
  2. package/TimeExtent.js +1 -1
  3. package/assets/components/assets/calcite-date-picker/nls/pt-BR.json +31 -0
  4. package/assets/components/assets/calcite-date-picker/nls/pt-PT.json +3 -3
  5. package/assets/components/assets/calcite-icon/clipboard16.json +1 -0
  6. package/assets/components/assets/calcite-icon/clipboard24.json +1 -0
  7. package/assets/components/assets/calcite-icon/clipboard32.json +1 -0
  8. package/assets/components/assets/calcite-icon/folders16.json +1 -0
  9. package/assets/components/assets/calcite-icon/folders24.json +1 -0
  10. package/assets/components/assets/calcite-icon/folders32.json +1 -0
  11. package/assets/components/assets/calcite-icon/initiative16.json +1 -0
  12. package/assets/components/assets/calcite-icon/initiative24.json +1 -0
  13. package/assets/components/assets/calcite-icon/initiative32.json +1 -0
  14. package/assets/components/assets/calcite-icon/initiativeTemplate16.json +1 -0
  15. package/assets/components/assets/calcite-icon/initiativeTemplate24.json +1 -0
  16. package/assets/components/assets/calcite-icon/initiativeTemplate32.json +1 -0
  17. package/assets/components/assets/calcite-icon/multipleVariables16.json +1 -0
  18. package/assets/components/assets/calcite-icon/multipleVariables24.json +1 -0
  19. package/assets/components/assets/calcite-icon/multipleVariables32.json +1 -0
  20. package/assets/components/assets/calcite-icon/paletteCheck16.json +1 -0
  21. package/assets/components/assets/calcite-icon/paletteCheck24.json +1 -0
  22. package/assets/components/assets/calcite-icon/paletteCheck32.json +1 -0
  23. package/assets/components/assets/calcite-icon/pentagon16.json +1 -0
  24. package/assets/components/assets/calcite-icon/pentagon24.json +1 -0
  25. package/assets/components/assets/calcite-icon/pentagon32.json +1 -0
  26. package/assets/components/assets/calcite-icon/puzzlePiece16.json +1 -0
  27. package/assets/components/assets/calcite-icon/puzzlePiece24.json +1 -0
  28. package/assets/components/assets/calcite-icon/puzzlePiece32.json +1 -0
  29. package/assets/components/assets/calcite-icon/ribbonRosette16.json +1 -0
  30. package/assets/components/assets/calcite-icon/ribbonRosette24.json +1 -0
  31. package/assets/components/assets/calcite-icon/ribbonRosette32.json +1 -0
  32. package/assets/components/assets/calcite-icon/speechBubbleExclamation16.json +1 -0
  33. package/assets/components/assets/calcite-icon/speechBubbleExclamation24.json +1 -0
  34. package/assets/components/assets/calcite-icon/speechBubbleExclamation32.json +1 -0
  35. package/assets/components/assets/calcite-icon/survey16.json +1 -0
  36. package/assets/components/assets/calcite-icon/survey24.json +1 -0
  37. package/assets/components/assets/calcite-icon/survey32.json +1 -0
  38. package/assets/esri/core/workers/RemoteClient.js +1 -1
  39. package/assets/esri/core/workers/chunks/{7a5f5acfbd4ca1a5c1f3.js → 06116433eb6e669f146b.js} +1 -1
  40. package/assets/esri/core/workers/chunks/0a4401a148c3cb73d6ff.js +1 -0
  41. package/assets/esri/core/workers/chunks/{83d00afae4406ec78bc9.js → 0c6be307709523eb8a05.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{e0c8d61c7a85ce15499a.js → 0d9adefd00c44585be2e.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{44f0c3663b293afbd172.js → 0e09691edb44641de5f0.js} +1 -1
  44. package/assets/esri/core/workers/chunks/0e215fa28a0448169132.js +1 -0
  45. package/assets/esri/core/workers/chunks/{391e96192d1ec4e55ce2.js → 101b4f02f0572afb666f.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{db3c729ce0c0b2690dc9.js → 1180ffd523c6292bc04e.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{826c983100569586b61f.js → 1571e8213feb518ff100.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{929c9b7cdab7c4ca3d87.js → 17c51f5a13f471e6656a.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{37c03cfc19086ce631c6.js → 18a8b9e2f6bd89827189.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{ed0bcc66fb1e0ee75a4b.js → 1f34957ef42e5b5977d0.js} +1 -1
  51. package/assets/esri/core/workers/chunks/236de5f0476f6080ee62.js +1 -0
  52. package/assets/esri/core/workers/chunks/288ca064cd0472439276.js +1 -0
  53. package/assets/esri/core/workers/chunks/29aa6046534a43d7ce19.js +1 -0
  54. package/assets/esri/core/workers/chunks/2e1291cd831592216446.js +1 -0
  55. package/assets/esri/core/workers/chunks/{68a59ce98177d8513337.js → 3403cb53e4e60923c5fc.js} +1 -1
  56. package/assets/esri/core/workers/chunks/34bed896b68993cabaa1.js +1 -0
  57. package/assets/esri/core/workers/chunks/{99619fcb772807c74f3b.js → 444829a840b8ded16fd7.js} +1 -1
  58. package/assets/esri/core/workers/chunks/467b5faa1c90d9821609.js +1 -0
  59. package/assets/esri/core/workers/chunks/49353182a16218a84251.js +1 -0
  60. package/assets/esri/core/workers/chunks/{fc046a15466c25d081ff.js → 4a2e93b12d60e8d92491.js} +1 -1
  61. package/assets/esri/core/workers/chunks/4de996ebc432f5e149bc.js +1 -0
  62. package/assets/esri/core/workers/chunks/50976921acf7bd636123.js +1 -0
  63. package/assets/esri/core/workers/chunks/5144ef135e0deb48c7bf.js +1 -0
  64. package/assets/esri/core/workers/chunks/584bbb675ed225f68171.js +1 -0
  65. package/assets/esri/core/workers/chunks/5a90d121ba79613cc2aa.js +1 -0
  66. package/assets/esri/core/workers/chunks/5b286f3f3deea10bdd91.js +1 -0
  67. package/assets/esri/core/workers/chunks/{0463ba46df855a92b9c0.js → 65ccd204ec3053687a77.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{1f8c6a179e39fd4c5e6f.js → 6a2b8d6a9bada45ab66d.js} +1 -1
  69. package/assets/esri/core/workers/chunks/6be326edd9829781d926.js +1 -0
  70. package/assets/esri/core/workers/chunks/6ea99a6e21b09674f6b3.js +1 -0
  71. package/assets/esri/core/workers/chunks/{5bcb3240b3c005e5fe72.js → 7215af7810d15e89aa5a.js} +1 -1
  72. package/assets/esri/core/workers/chunks/7509c1693ffedc0fa018.js +1 -0
  73. package/assets/esri/core/workers/chunks/7b0b75878370b3475fe5.js +1 -0
  74. package/assets/esri/core/workers/chunks/{bfedd6ebff817c9b31c0.js → 7b618c449d793aacd874.js} +1 -1
  75. package/assets/esri/core/workers/chunks/{2460f3b6ada6ae900dec.js → 7c0ff01f081c7e9050d2.js} +1 -1
  76. package/assets/esri/core/workers/chunks/806a7db0084214a53c79.js +1 -0
  77. package/assets/esri/core/workers/chunks/{8fa0a14165d43ffe87a5.js → 8325b577f52936f86cff.js} +1 -1
  78. package/assets/esri/core/workers/chunks/84d8e77d78d0d5134083.js +1 -0
  79. package/assets/esri/core/workers/chunks/{dd13772a5e2eccc6a2bc.js → 8598f762f15ca68d52b7.js} +1 -1
  80. package/assets/esri/core/workers/chunks/85b1ae51da3689bccf92.js +1 -0
  81. package/assets/esri/core/workers/chunks/873b0cbd343dc71755ed.js +1 -0
  82. package/assets/esri/core/workers/chunks/8804b8489eeab888275b.js +1 -0
  83. package/assets/esri/core/workers/chunks/{5ec98f4ddac707d0fbd1.js → 88815d533808aabb1fa9.js} +1 -1
  84. package/assets/esri/core/workers/chunks/8c8c0ecdf44fdbb56000.js +1 -0
  85. package/assets/esri/core/workers/chunks/{f2124f4d0f2b8a91f0ea.js → 90c5edcd8a609224ce55.js} +1 -1
  86. package/assets/esri/core/workers/chunks/{bac9fc90e6756e211160.js → 94d9951509c0db09547a.js} +1 -1
  87. package/assets/esri/core/workers/chunks/996d6ae7f2e2273f9bce.js +1 -0
  88. package/assets/esri/core/workers/chunks/{c1135cb02ec46c491459.js → 9ce961bc390202c87941.js} +1 -1
  89. package/assets/esri/core/workers/chunks/9fbc7d2e0326be41b382.js +1 -0
  90. package/assets/esri/core/workers/chunks/a363fb40096679b011f6.js +1 -0
  91. package/assets/esri/core/workers/chunks/a41522b0a853b85c8269.js +1 -0
  92. package/assets/esri/core/workers/chunks/a763c11d2b02b3ec36ad.js +1 -0
  93. package/assets/esri/core/workers/chunks/{aeaa1667c2d9f1b3366b.js → a85ed251d3d3668e474f.js} +1 -1
  94. package/assets/esri/core/workers/chunks/{69fd99b7c76e9992ccf3.js → b32bf9808cb4be3a6bd0.js} +1 -1
  95. package/assets/esri/core/workers/chunks/b33a6fbbc8de2969b1ca.js +1 -0
  96. package/assets/esri/core/workers/chunks/b548e6b3add4154ac4e6.js +1 -0
  97. package/assets/esri/core/workers/chunks/b6c55bdd8c957b062bc1.js +1 -0
  98. package/assets/esri/core/workers/chunks/b90509b2088fd444fc39.js +1 -0
  99. package/assets/esri/core/workers/chunks/{b9e9cb354822c6d995a4.js → bea473dba8e57617a71d.js} +1 -1
  100. package/assets/esri/core/workers/chunks/{0d02c6ad1f4688bfa374.js → bf7c44644fe7b0aa60cf.js} +1 -1
  101. package/assets/esri/core/workers/chunks/c1a70f025e90d97fac6d.js +1 -0
  102. package/assets/esri/core/workers/chunks/{d72488db62fcf39447b6.js → c23d965a55215168a1a2.js} +1 -1
  103. package/assets/esri/core/workers/chunks/c3192cfe115ce354ffbc.js +1 -0
  104. package/assets/esri/core/workers/chunks/c3d768801f2f6cb9d5d0.js +1 -0
  105. package/assets/esri/core/workers/chunks/d09a0b2dc3a6fc10fa41.js +1 -0
  106. package/assets/esri/core/workers/chunks/d21526570300597aa6ae.js +1 -0
  107. package/assets/esri/core/workers/chunks/d2ffb0f21363c0d3d2a9.js +1 -0
  108. package/assets/esri/core/workers/chunks/{ec10151a2a95e95a0bb5.js → d304fe0ac836afd46e3d.js} +1 -1
  109. package/assets/esri/core/workers/chunks/{37a7bd30352b1309b8f8.js → d3f05b8e4bd53eb1eb9d.js} +1 -1
  110. package/assets/esri/core/workers/chunks/{17de7a324dfa7f57ad5d.js → d780e946149b1c3d1246.js} +1 -1
  111. package/assets/esri/core/workers/chunks/dc037f1496bb4aa40d10.js +1 -0
  112. package/assets/esri/core/workers/chunks/{8cbb04a9065aa3756638.js → dc04a8ba6c770bdc2bd4.js} +1 -1
  113. package/assets/esri/core/workers/chunks/dd5a71818a989a6edb00.js +1 -0
  114. package/assets/esri/core/workers/chunks/{89820b200ee44e678af5.js → dd891a98105904f8a06b.js} +1 -1
  115. package/assets/esri/core/workers/chunks/e17edd48179d41ddf1e7.js +1 -0
  116. package/assets/esri/core/workers/chunks/e323086de328a164f7f0.js +1 -0
  117. package/assets/esri/core/workers/chunks/ea50a6a994e5ee578d97.js +1 -0
  118. package/assets/esri/core/workers/chunks/{655b55ac0cd533d7e9d7.js → ecf074743183c1749581.js} +1 -1
  119. package/assets/esri/core/workers/chunks/f067b4fc65b835437afd.js +1 -0
  120. package/assets/esri/core/workers/chunks/f0e5c82e9c4fbe3c9d0a.js +1 -0
  121. package/assets/esri/core/workers/chunks/f96b24c075771d028e20.js +1 -0
  122. package/assets/esri/core/workers/chunks/{5790d171072b3c7d108f.js → f9a6de00c628538f07f6.js} +1 -1
  123. package/assets/esri/core/workers/chunks/{2c607d30ff8ca1b61286.js → fe0c3b7c9b428d9c3f25.js} +1 -1
  124. package/assets/esri/core/workers/chunks/{49a1a633bb0d93764aae.js → fffea9587ec14c6d34e8.js} +1 -1
  125. package/assets/esri/themes/base/_mixins.scss +1 -1
  126. package/assets/esri/themes/base/widgets/_Directions.scss +0 -6
  127. package/assets/esri/themes/base/widgets/_Legend.scss +8 -7
  128. package/assets/esri/themes/dark/main.css +1 -1
  129. package/assets/esri/themes/dark-blue/main.css +1 -1
  130. package/assets/esri/themes/dark-green/main.css +1 -1
  131. package/assets/esri/themes/dark-purple/main.css +1 -1
  132. package/assets/esri/themes/dark-red/main.css +1 -1
  133. package/assets/esri/themes/light/main.css +1 -1
  134. package/assets/esri/themes/light/view.css +1 -1
  135. package/assets/esri/themes/light-blue/main.css +1 -1
  136. package/assets/esri/themes/light-green/main.css +1 -1
  137. package/assets/esri/themes/light-purple/main.css +1 -1
  138. package/assets/esri/themes/light-red/main.css +1 -1
  139. package/assets/esri/widgets/Directions/t9n/Directions.json +1 -1
  140. package/assets/esri/widgets/Directions/t9n/Directions_ar.json +1 -1
  141. package/assets/esri/widgets/Directions/t9n/Directions_bg.json +1 -1
  142. package/assets/esri/widgets/Directions/t9n/Directions_bs.json +1 -1
  143. package/assets/esri/widgets/Directions/t9n/Directions_ca.json +1 -1
  144. package/assets/esri/widgets/Directions/t9n/Directions_cs.json +1 -1
  145. package/assets/esri/widgets/Directions/t9n/Directions_da.json +1 -1
  146. package/assets/esri/widgets/Directions/t9n/Directions_de.json +1 -1
  147. package/assets/esri/widgets/Directions/t9n/Directions_el.json +1 -1
  148. package/assets/esri/widgets/Directions/t9n/Directions_en.json +1 -1
  149. package/assets/esri/widgets/Directions/t9n/Directions_es.json +1 -1
  150. package/assets/esri/widgets/Directions/t9n/Directions_et.json +1 -1
  151. package/assets/esri/widgets/Directions/t9n/Directions_fi.json +1 -1
  152. package/assets/esri/widgets/Directions/t9n/Directions_fr.json +1 -1
  153. package/assets/esri/widgets/Directions/t9n/Directions_he.json +1 -1
  154. package/assets/esri/widgets/Directions/t9n/Directions_hr.json +1 -1
  155. package/assets/esri/widgets/Directions/t9n/Directions_hu.json +1 -1
  156. package/assets/esri/widgets/Directions/t9n/Directions_id.json +1 -1
  157. package/assets/esri/widgets/Directions/t9n/Directions_it.json +1 -1
  158. package/assets/esri/widgets/Directions/t9n/Directions_ja.json +1 -1
  159. package/assets/esri/widgets/Directions/t9n/Directions_ko.json +1 -1
  160. package/assets/esri/widgets/Directions/t9n/Directions_lt.json +1 -1
  161. package/assets/esri/widgets/Directions/t9n/Directions_lv.json +1 -1
  162. package/assets/esri/widgets/Directions/t9n/Directions_nb.json +1 -1
  163. package/assets/esri/widgets/Directions/t9n/Directions_nl.json +1 -1
  164. package/assets/esri/widgets/Directions/t9n/Directions_pl.json +1 -1
  165. package/assets/esri/widgets/Directions/t9n/Directions_pt-BR.json +1 -1
  166. package/assets/esri/widgets/Directions/t9n/Directions_pt-PT.json +1 -1
  167. package/assets/esri/widgets/Directions/t9n/Directions_ro.json +1 -1
  168. package/assets/esri/widgets/Directions/t9n/Directions_ru.json +1 -1
  169. package/assets/esri/widgets/Directions/t9n/Directions_sk.json +1 -1
  170. package/assets/esri/widgets/Directions/t9n/Directions_sl.json +1 -1
  171. package/assets/esri/widgets/Directions/t9n/Directions_sr.json +1 -1
  172. package/assets/esri/widgets/Directions/t9n/Directions_sv.json +1 -1
  173. package/assets/esri/widgets/Directions/t9n/Directions_th.json +1 -1
  174. package/assets/esri/widgets/Directions/t9n/Directions_tr.json +1 -1
  175. package/assets/esri/widgets/Directions/t9n/Directions_uk.json +1 -1
  176. package/assets/esri/widgets/Directions/t9n/Directions_vi.json +1 -1
  177. package/assets/esri/widgets/Directions/t9n/Directions_zh-CN.json +1 -1
  178. package/assets/esri/widgets/Directions/t9n/Directions_zh-HK.json +1 -1
  179. package/assets/esri/widgets/Directions/t9n/Directions_zh-TW.json +1 -1
  180. package/chunks/Fog.glsl.js +12 -24
  181. package/chunks/Heatmap.glsl.js +10 -0
  182. package/chunks/HeatmapDensity.glsl.js +21 -0
  183. package/chunks/Precipitation.glsl.js +2 -2
  184. package/core/maybe.js +1 -1
  185. package/core/promiseUtils.js +1 -1
  186. package/interfaces.d.ts +2432 -231
  187. package/layers/ImageryTileLayer.js +1 -1
  188. package/layers/graphics/data/optimizedFeatureQueryEngineAdapter.js +1 -1
  189. package/layers/graphics/featureConversionUtils.js +1 -1
  190. package/layers/mixins/ArcGISImageService.js +1 -1
  191. package/layers/support/imageryRendererUtils.js +1 -1
  192. package/layers/support/rasterFunctions/pixelUtils.js +1 -1
  193. package/layers/support/rasterFunctions/vectorFieldUtils.js +1 -1
  194. package/package.json +2 -2
  195. package/rasterRenderers.js +1 -1
  196. package/renderers/DictionaryRenderer.js +1 -1
  197. package/renderers/FlowRenderer.d.ts +4 -0
  198. package/renderers/FlowRenderer.js +5 -0
  199. package/renderers/support/DictionaryLoader.js +5 -0
  200. package/renderers/support/RasterSymbolizer.js +1 -1
  201. package/renderers/support/rasterRendererHelper.js +1 -1
  202. package/renderers/support/rendererConversion.js +1 -1
  203. package/rest/geoprocessor/GPOptions.js +1 -1
  204. package/rest/print.js +1 -1
  205. package/rest/support/DirectionLine.js +1 -1
  206. package/rest/support/DirectionPoint.js +1 -1
  207. package/rest/support/FeatureSet.js +1 -1
  208. package/rest/support/LegendLayer.js +1 -1
  209. package/rest/support/LinearUnit.js +1 -1
  210. package/rest/support/PointBarrier.js +1 -1
  211. package/rest/support/PolygonBarrier.js +1 -1
  212. package/rest/support/PolylineBarrier.js +1 -1
  213. package/rest/support/RasterData.js +1 -1
  214. package/smartMapping/raster/renderers/flow.js +5 -0
  215. package/smartMapping/raster/support/utils.js +1 -1
  216. package/support/basemapUtils.js +1 -1
  217. package/support/featureFlags.js +1 -1
  218. package/support/revision.js +1 -1
  219. package/symbols/TextSymbol3DLayer.js +1 -1
  220. package/symbols/cim/effects/EffectArrow.js +1 -1
  221. package/symbols/support/Symbol3DHalo.js +1 -1
  222. package/symbols/support/Symbol3DTextBackground.js +5 -0
  223. package/symbols/support/previewSymbol2D.js +1 -1
  224. package/symbols/support/svgUtils.js +1 -1
  225. package/tasks/Geoprocessor.js +1 -1
  226. package/views/2d/FrameTask.js +1 -1
  227. package/views/2d/ViewState.js +1 -1
  228. package/views/2d/constraints/GeometryConstraint.js +1 -1
  229. package/views/2d/engine/BitmapTileContainer.js +1 -1
  230. package/views/2d/engine/DisplayObject.js +1 -1
  231. package/views/2d/engine/RasterTileContainer.js +1 -1
  232. package/views/2d/engine/RasterVFContainer.js +5 -0
  233. package/views/2d/engine/RasterVFDisplayObject.js +1 -1
  234. package/views/2d/engine/RasterVFTileContainer.js +1 -1
  235. package/views/2d/engine/Stage.js +1 -1
  236. package/views/2d/engine/flow/BrushFlow.js +1 -1
  237. package/views/2d/engine/flow/FlowDisplayData.js +1 -1
  238. package/views/2d/engine/flow/FlowGLResources.js +1 -1
  239. package/views/2d/engine/flow/FlowStyle.js +1 -1
  240. package/views/2d/engine/flow/FlowView2D.js +5 -0
  241. package/views/2d/engine/flow/dataUtils.js +1 -1
  242. package/views/2d/engine/flow/flowRendererUtils.js +5 -0
  243. package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
  244. package/views/2d/engine/webgl/brushes/raster/BrushVectorField.js +1 -1
  245. package/views/2d/engine/webgl/cpuMapped/Buffer.js +1 -1
  246. package/views/2d/engine/webgl/mesh/templates/WGLBaseTextTemplate.js +1 -1
  247. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  248. package/views/2d/engine/webgl/util/Matcher.js +1 -1
  249. package/views/2d/input/handlers/DragPan.js +1 -1
  250. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  251. package/views/2d/layers/ImageryLayerView2D.js +1 -1
  252. package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
  253. package/views/2d/layers/KMLLayerView2D.js +1 -1
  254. package/views/2d/layers/LayerView2D.js +1 -1
  255. package/views/2d/layers/MapImageLayerView2D.js +1 -1
  256. package/views/2d/layers/TileLayerView2D.js +1 -1
  257. package/views/2d/layers/WMSLayerView2D.js +1 -1
  258. package/views/2d/layers/WMTSLayerView2D.js +1 -1
  259. package/views/2d/layers/features/Pipeline.js +1 -1
  260. package/views/2d/layers/features/createSymbolSchema.js +5 -0
  261. package/views/2d/layers/features/processors/HeatmapProcessor.js +1 -1
  262. package/views/2d/layers/features/processors/SymbolProcessor.js +1 -1
  263. package/views/2d/layers/features/schemaUtils.js +1 -1
  264. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  265. package/views/2d/layers/features/support/ClusterStore.js +1 -1
  266. package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
  267. package/views/2d/layers/features/tileRenderers/SymbolTileRenderer.js +1 -1
  268. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  269. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  270. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  271. package/views/2d/layers/imagery/ImageryVFStrategy.js +5 -0
  272. package/views/2d/layers/imagery/ImageryView2D.js +1 -1
  273. package/views/2d/layers/imagery/VectorFieldTileView2D.js +1 -1
  274. package/views/2d/layers/imagery/VectorFieldView2D.js +5 -0
  275. package/views/2d/layers/support/FeatureCommandQueue.js +1 -1
  276. package/views/2d/navigation/MapViewNavigation.js +1 -1
  277. package/views/2d/navigation/actions/Pan.js +1 -1
  278. package/views/2d/viewpointUtils.js +1 -1
  279. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  280. package/views/3d/environment/Fog.js +1 -1
  281. package/views/3d/environment/Precipitation.js +1 -1
  282. package/views/3d/environment/PrecipitationTechnique.js +1 -1
  283. package/views/3d/environment/SceneViewEnvironment.js +1 -1
  284. package/views/3d/environment/SimpleAtmosphere.js +1 -1
  285. package/views/3d/environment/weather.js +1 -1
  286. package/views/3d/interactive/analysisTools/lineOfSight/LineOfSightTool.js +1 -1
  287. package/views/3d/layerViewModuleImportUtils.js +1 -1
  288. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  289. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  290. package/views/3d/layers/IRouteLayerView3D.js +4 -0
  291. package/views/3d/layers/RouteLayerView3D.js +5 -0
  292. package/views/3d/layers/VectorTileLayerView3D.js +1 -1
  293. package/views/3d/layers/VoxelLayerView3D.js +1 -1
  294. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  295. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  296. package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
  297. package/views/3d/layers/graphics/GraphicsProcessor.js +1 -1
  298. package/views/3d/layers/graphics/Labeler.js +1 -1
  299. package/views/3d/layers/graphics/graphicUtils.js +1 -1
  300. package/views/3d/layers/graphics/labelPlacement.js +1 -1
  301. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  302. package/views/3d/terrain/OverlayRenderer.js +1 -1
  303. package/views/3d/terrain/terrainUtils.js +1 -1
  304. package/views/3d/webgl-engine/lib/DrapedHeatmapRenderer.js +5 -0
  305. package/views/3d/webgl-engine/lib/TextRenderParameters.js +1 -1
  306. package/views/3d/webgl-engine/lib/TextRenderer.js +1 -1
  307. package/views/3d/webgl-engine/lib/TextTexture.js +1 -1
  308. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +5 -0
  309. package/views/3d/webgl-engine/shaders/Heatmap.glsl.js +5 -0
  310. package/views/3d/webgl-engine/shaders/HeatmapDensity.glsl.js +5 -0
  311. package/views/3d/webgl-engine/shaders/HeatmapDensityTechnique.js +5 -0
  312. package/views/3d/webgl-engine/shaders/HeatmapTechnique.js +5 -0
  313. package/views/MapView.js +1 -1
  314. package/views/ToolViewManager.js +1 -1
  315. package/views/View.js +1 -1
  316. package/views/draw/support/Box.js +1 -1
  317. package/views/draw/support/GraphicMover.js +1 -1
  318. package/views/draw/support/HighlightHelper.js +5 -0
  319. package/views/draw/support/Reshape.js +1 -1
  320. package/views/draw/support/layerUtils.js +1 -1
  321. package/views/interactive/InteractiveToolBase.js +1 -1
  322. package/views/support/WatchUpdatingTracking.js +1 -1
  323. package/views/support/projectionUtils.js +1 -1
  324. package/views/webgl/RenderingContext.js +1 -1
  325. package/views/webgl/enums.js +1 -1
  326. package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
  327. package/widgets/BasemapGallery/support/BasemapGalleryItem.js +1 -1
  328. package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
  329. package/widgets/BasemapToggle.js +1 -1
  330. package/widgets/Directions/support/resources.js +1 -1
  331. package/widgets/Directions.js +1 -1
  332. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  333. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  334. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  335. package/widgets/FeatureTable.js +1 -1
  336. package/widgets/Legend/styles/Card.js +1 -1
  337. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  338. package/widgets/Legend/support/sizeRampUtils.js +1 -1
  339. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  340. package/widgets/Sketch/SketchViewModel.js +1 -1
  341. package/widgets/Sketch.js +1 -1
  342. package/widgets/TimeSlider.js +1 -1
  343. package/widgets/Weather/WeatherViewModel.js +1 -1
  344. package/widgets/Weather.js +1 -1
  345. package/widgets/Widget.js +1 -1
  346. package/widgets/support/InteractiveAnalysisViewModel.js +1 -1
  347. package/widgets/support/vnodeCache.js +5 -0
  348. package/widgets/support/widgetUtils.js +1 -1
  349. package/assets/esri/core/workers/chunks/0453fad5cb819797b4f6.js +0 -1
  350. package/assets/esri/core/workers/chunks/0c15d77d8e817cf45a9a.js +0 -1
  351. package/assets/esri/core/workers/chunks/0cd0a6eef51fc5b9ea61.js +0 -1
  352. package/assets/esri/core/workers/chunks/0d684f16f37d5dc385dd.js +0 -1
  353. package/assets/esri/core/workers/chunks/16b6d0f8378582c051c3.js +0 -1
  354. package/assets/esri/core/workers/chunks/1877ab1b6a115dbba1c5.js +0 -1
  355. package/assets/esri/core/workers/chunks/197ec52641aed20029c6.js +0 -1
  356. package/assets/esri/core/workers/chunks/1b2a961f776a0b57e57a.js +0 -1
  357. package/assets/esri/core/workers/chunks/1b3fd66577b19aa5f2b6.js +0 -1
  358. package/assets/esri/core/workers/chunks/1c733b7db092a2a88ef3.js +0 -1
  359. package/assets/esri/core/workers/chunks/2629adf79e7fd9f25f07.js +0 -1
  360. package/assets/esri/core/workers/chunks/27474b007988855bea9d.js +0 -1
  361. package/assets/esri/core/workers/chunks/2b25fc7945a187c2bb9d.js +0 -1
  362. package/assets/esri/core/workers/chunks/34b59d7099904dcb28b5.js +0 -1
  363. package/assets/esri/core/workers/chunks/422537fc3df707bb62c9.js +0 -1
  364. package/assets/esri/core/workers/chunks/483d5d8593d96d0f0b15.js +0 -1
  365. package/assets/esri/core/workers/chunks/4ba6de8aa7e2960bad49.js +0 -1
  366. package/assets/esri/core/workers/chunks/4be35af7d6babbfe9d84.js +0 -1
  367. package/assets/esri/core/workers/chunks/5457962a70bd3c557a75.js +0 -1
  368. package/assets/esri/core/workers/chunks/57856b4a9b8784a69844.js +0 -1
  369. package/assets/esri/core/workers/chunks/57b349d1dbc0bed75b79.js +0 -1
  370. package/assets/esri/core/workers/chunks/5d11b97b667921d67ae7.js +0 -1
  371. package/assets/esri/core/workers/chunks/5dbe555a5a662ff3d9ce.js +0 -1
  372. package/assets/esri/core/workers/chunks/64b7e8d812ea8fcf269e.js +0 -1
  373. package/assets/esri/core/workers/chunks/75d812955a473d0e8960.js +0 -1
  374. package/assets/esri/core/workers/chunks/94515fb3ef38067eeadd.js +0 -1
  375. package/assets/esri/core/workers/chunks/952980635afc7ec81804.js +0 -1
  376. package/assets/esri/core/workers/chunks/96f148a556a2418038de.js +0 -1
  377. package/assets/esri/core/workers/chunks/9876a1bae350795fab36.js +0 -1
  378. package/assets/esri/core/workers/chunks/a1930e4f035bc9aa1ae5.js +0 -1
  379. package/assets/esri/core/workers/chunks/a8692bffb76444c34760.js +0 -1
  380. package/assets/esri/core/workers/chunks/b3f5e91116112b0b612a.js +0 -1
  381. package/assets/esri/core/workers/chunks/ba762bcfd74af0bb8218.js +0 -1
  382. package/assets/esri/core/workers/chunks/be588873c16770ceb9ef.js +0 -1
  383. package/assets/esri/core/workers/chunks/bf6dda4a2af14c4b7716.js +0 -1
  384. package/assets/esri/core/workers/chunks/c2253a9f29c1aabb2b75.js +0 -1
  385. package/assets/esri/core/workers/chunks/c984b3040e120e502b11.js +0 -1
  386. package/assets/esri/core/workers/chunks/cdbc005eebec1503b99d.js +0 -1
  387. package/assets/esri/core/workers/chunks/d04fca5d46cca02500b7.js +0 -1
  388. package/assets/esri/core/workers/chunks/d1fe53b597351dc58305.js +0 -1
  389. package/assets/esri/core/workers/chunks/d98dab12b71912fa397b.js +0 -1
  390. package/assets/esri/core/workers/chunks/dedc333a61081772ca7b.js +0 -1
  391. package/assets/esri/core/workers/chunks/e218bde41ffbcc5194f5.js +0 -1
  392. package/assets/esri/core/workers/chunks/e287f49184d076af17e2.js +0 -1
  393. package/assets/esri/core/workers/chunks/e9e5196b44b6923be1a3.js +0 -1
  394. package/assets/esri/core/workers/chunks/ea595b0df5050eda2a13.js +0 -1
  395. package/assets/esri/core/workers/chunks/eb82ff10cef2bde6e57f.js +0 -1
  396. package/assets/esri/core/workers/chunks/ee6e0db58dc64410e687.js +0 -1
  397. package/assets/esri/core/workers/chunks/f0a9f161805fc7a30fc5.js +0 -1
  398. package/renderers/AnimatedFlowRenderer.d.ts +0 -4
  399. package/renderers/AnimatedFlowRenderer.js +0 -5
  400. package/views/2d/engine/flow/AnimatedFlowView2D.js +0 -5
  401. package/views/2d/engine/flow/animatedFlowRendererUtils.js +0 -5
  402. package/views/2d/layers/imagery/ImageryGraphicsView2D.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{isNone as t,isSome as e,unwrapOr as s}from"../../core/maybe.js";import{after as i}from"../../core/promiseUtils.js";import"./BufferObject.js";import"./FramebufferObject.js";import"../../core/has.js";import{webglDebugEnabled as a}from"./checkWebGLError.js";import{ContextType as r}from"./context-util.js";import{BufferType as n,Face as l,BASE_TEXTURE_UNIT as h,ClearBufferBit as f,FramebufferTarget as o,TextureSamplingMode as _,SyncCondition as u,ClientWaitSyncStatus as c,BlendFactor as d,BlendOperation as b,CullMode as F,CompareFunction as g,StencilOperation as p,TextureType as E,PrimitiveType as B}from"./enums.js";import"./ShaderTranspiler.js";import{ProgramCache as m}from"./ProgramCache.js";import{Texture as R}from"./Texture.js";import"./VertexArrayObject.js";import{ContextState as T}from"./ContextState.js";import{InstanceCounter as A}from"./InstanceCounter.js";import{StateTracker as x}from"./renderState.js";import{WebGLDriverTest as O}from"./WebGLDriverTest.js";import{Capabilities as U}from"./capabilities/Capabilities.js";import C from"./capabilities/isWebGL2Context.js";class S{constructor(t,e){this.gl=t,this.instanceCounter=new A,this.programCache=new m(this),this._state=new T,this._numOfDrawCalls=0,this._numOfTriangles=0,this.type=C(t)?r.WEBGL2:r.WEBGL1,this._loadExtensions(),this.configure(e)}configure(t){this._capabilities=new U(this.gl,t),this._parameters=this._loadParameters(t);const e=this.gl.getParameter(this.gl.VIEWPORT);this._state=new T,this._state.viewport={x:e[0],y:e[1],width:e[2],height:e[3]},this._stateTracker=new x({setBlending:t=>{if(t){this.setBlendingEnabled(!0),this.setBlendEquationSeparate(t.opRgb,t.opAlpha),this.setBlendFunctionSeparate(t.srcRgb,t.dstRgb,t.srcAlpha,t.dstAlpha);const e=t.color;this.setBlendColor(e.r,e.g,e.b,e.a)}else this.setBlendingEnabled(!1)},setCulling:t=>{t?(this.setFaceCullingEnabled(!0),this.setCullFace(t.face),this.setFrontFace(t.mode)):this.setFaceCullingEnabled(!1)},setPolygonOffset:t=>{t?(this.setPolygonOffsetFillEnabled(!0),this.setPolygonOffset(t.factor,t.units)):this.setPolygonOffsetFillEnabled(!1)},setDepthTest:t=>{t?(this.setDepthTestEnabled(!0),this.setDepthFunction(t.func)):this.setDepthTestEnabled(!1)},setStencilTest:t=>{if(t){this.setStencilTestEnabled(!0);const e=t.function;this.setStencilFunction(e.func,e.ref,e.mask);const s=t.operation;this.setStencilOp(s.fail,s.zFail,s.zPass)}else this.setStencilTestEnabled(!1)},setDepthWrite:t=>{t?(this.setDepthWriteEnabled(!0),this.setDepthRange(t.zNear,t.zFar)):this.setDepthWriteEnabled(!1)},setColorWrite:t=>{t?this.setColorMask(t.r,t.g,t.b,t.a):this.setColorMask(!1,!1,!1,!1)},setStencilWrite:t=>{t?this.setStencilWriteMask(t.mask):this.setStencilWriteMask(0)}}),this.enforceState(),this._driverTest=new O(this)}get driverTest(){return this._driverTest}get contextAttributes(){return this.gl.getContextAttributes()}get parameters(){return this._parameters}dispose(){this.programCache.dispose(),this.bindVAO(null),this.unbindBuffer(n.ARRAY_BUFFER),this.unbindBuffer(n.ELEMENT_ARRAY_BUFFER),C(this.gl)&&(this.unbindBuffer(n.UNIFORM_BUFFER),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(n.PIXEL_PACK_BUFFER),this.unbindBuffer(n.PIXEL_UNPACK_BUFFER),this.unbindBuffer(n.COPY_READ_BUFFER),this.unbindBuffer(n.COPY_WRITE_BUFFER)),this._state.textureUnitMap.length=0,a()&&this.instanceCounter.printResourceCount()}setPipelineState(t){this._stateTracker.setPipeline(t)}setBlendingEnabled(t){this._state.blend!==t&&(!0===t?this.gl.enable(this.gl.BLEND):this.gl.disable(this.gl.BLEND),this._state.blend=t,this._stateTracker.invalidateBlending())}externalProgramUpdate(){var t;null==(t=this._state.program)||t.stop(),this._state.program=null}externalTextureUnitUpdate(t,e){for(let s=0;s<t.length;++s)this._state.textureUnitMap[t[s]]=null;e>=0&&(this._state.activeTexture=e)}externalVertexArrayObjectUpdate(){const t=this.capabilities.vao;t&&(t.bindVertexArray(null),this._state.vertexArrayObject=null),this._state.vertexBuffer=null,this._state.indexBuffer=null}externalVertexBufferUpdate(){this._state.vertexBuffer=null}externalIndexBufferUpdate(){this._state.indexBuffer=null}setBlendColor(t,e,s,i){t===this._state.blendColor.r&&e===this._state.blendColor.g&&s===this._state.blendColor.b&&i===this._state.blendColor.a||(this.gl.blendColor(t,e,s,i),this._state.blendColor.r=t,this._state.blendColor.g=e,this._state.blendColor.b=s,this._state.blendColor.a=i,this._stateTracker.invalidateBlending())}setBlendFunction(t,e){t===this._state.blendFunction.srcRGB&&e===this._state.blendFunction.dstRGB||(this.gl.blendFunc(t,e),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=t,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=e,this._stateTracker.invalidateBlending())}setBlendFunctionSeparate(t,e,s,i){this._state.blendFunction.srcRGB===t&&this._state.blendFunction.srcAlpha===s&&this._state.blendFunction.dstRGB===e&&this._state.blendFunction.dstAlpha===i||(this.gl.blendFuncSeparate(t,e,s,i),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=s,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=i,this._stateTracker.invalidateBlending())}setBlendEquation(t){this._state.blendEquation.mode!==t&&(this.gl.blendEquation(t),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=t,this._stateTracker.invalidateBlending())}setBlendEquationSeparate(t,e){this._state.blendEquation.mode===t&&this._state.blendEquation.modeAlpha===e||(this.gl.blendEquationSeparate(t,e),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=e,this._stateTracker.invalidateBlending())}setColorMask(t,e,s,i){this._state.colorMask.r===t&&this._state.colorMask.g===e&&this._state.colorMask.b===s&&this._state.colorMask.a===i||(this.gl.colorMask(t,e,s,i),this._state.colorMask.r=t,this._state.colorMask.g=e,this._state.colorMask.b=s,this._state.colorMask.a=i,this._stateTracker.invalidateColorWrite())}setClearColor(t,e,s,i){this._state.clearColor.r===t&&this._state.clearColor.g===e&&this._state.clearColor.b===s&&this._state.clearColor.a===i||(this.gl.clearColor(t,e,s,i),this._state.clearColor.r=t,this._state.clearColor.g=e,this._state.clearColor.b=s,this._state.clearColor.a=i)}setFaceCullingEnabled(t){this._state.faceCulling!==t&&(!0===t?this.gl.enable(this.gl.CULL_FACE):this.gl.disable(this.gl.CULL_FACE),this._state.faceCulling=t,this._stateTracker.invalidateCulling())}setPolygonOffsetFillEnabled(t){this._state.polygonOffsetFill!==t&&(!0===t?this.gl.enable(this.gl.POLYGON_OFFSET_FILL):this.gl.disable(this.gl.POLYGON_OFFSET_FILL),this._state.polygonOffsetFill=t,this._stateTracker.invalidatePolygonOffset())}setPolygonOffset(t,e){this._state.polygonOffset[0]===t&&this._state.polygonOffset[1]===e||(this._state.polygonOffset[0]=t,this._state.polygonOffset[1]=e,this.gl.polygonOffset(t,e),this._stateTracker.invalidatePolygonOffset())}setCullFace(t){this._state.cullFace!==t&&(this.gl.cullFace(t),this._state.cullFace=t,this._stateTracker.invalidateCulling())}setFrontFace(t){this._state.frontFace!==t&&(this.gl.frontFace(t),this._state.frontFace=t,this._stateTracker.invalidateCulling())}setScissorTestEnabled(t){this._state.scissorTest!==t&&(!0===t?this.gl.enable(this.gl.SCISSOR_TEST):this.gl.disable(this.gl.SCISSOR_TEST),this._state.scissorTest=t)}setScissorRect(t,e,s,i){this._state.scissorRect.x===t&&this._state.scissorRect.y===e&&this._state.scissorRect.width===s&&this._state.scissorRect.height===i||(this.gl.scissor(t,e,s,i),this._state.scissorRect.x=t,this._state.scissorRect.y=e,this._state.scissorRect.width=s,this._state.scissorRect.height=i)}setDepthTestEnabled(t){this._state.depthTest!==t&&(!0===t?this.gl.enable(this.gl.DEPTH_TEST):this.gl.disable(this.gl.DEPTH_TEST),this._state.depthTest=t,this._stateTracker.invalidateDepthTest())}setClearDepth(t){this._state.clearDepth!==t&&(this.gl.clearDepth(t),this._state.clearDepth=t)}setDepthFunction(t){this._state.depthFunction!==t&&(this.gl.depthFunc(t),this._state.depthFunction=t,this._stateTracker.invalidateDepthTest())}setDepthWriteEnabled(t){this._state.depthWrite!==t&&(this.gl.depthMask(t),this._state.depthWrite=t,this._stateTracker.invalidateDepthWrite())}setDepthRange(t,e){this._state.depthRange.zNear===t&&this._state.depthRange.zFar===e||(this.gl.depthRange(t,e),this._state.depthRange.zNear=t,this._state.depthRange.zFar=e,this._stateTracker.invalidateDepthWrite())}setStencilTestEnabled(t){this._state.stencilTest!==t&&(!0===t?this.gl.enable(this.gl.STENCIL_TEST):this.gl.disable(this.gl.STENCIL_TEST),this._state.stencilTest=t,this._stateTracker.invalidateStencilTest())}setClearStencil(t){t!==this._state.clearStencil&&(this.gl.clearStencil(t),this._state.clearStencil=t)}setStencilFunction(t,e,s){this._state.stencilFunction.func===t&&this._state.stencilFunction.ref===e&&this._state.stencilFunction.mask===s||(this.gl.stencilFunc(t,e,s),this._state.stencilFunction.face=l.FRONT_AND_BACK,this._state.stencilFunction.func=t,this._state.stencilFunction.ref=e,this._state.stencilFunction.mask=s,this._stateTracker.invalidateStencilTest())}setStencilFunctionSeparate(t,e,s,i){this._state.stencilFunction.face===t&&this._state.stencilFunction.func===e&&this._state.stencilFunction.ref===s&&this._state.stencilFunction.mask===i||(this.gl.stencilFuncSeparate(t,e,s,i),this._state.stencilFunction.face=t,this._state.stencilFunction.func=e,this._state.stencilFunction.ref=s,this._state.stencilFunction.mask=i,this._stateTracker.invalidateStencilTest())}setStencilWriteMask(t){this._state.stencilWriteMask!==t&&(this.gl.stencilMask(t),this._state.stencilWriteMask=t,this._stateTracker.invalidateStencilWrite())}setStencilOp(t,e,s){this._state.stencilOperation.face===l.FRONT_AND_BACK&&this._state.stencilOperation.fail===t&&this._state.stencilOperation.zFail===e&&this._state.stencilOperation.zPass===s||(this.gl.stencilOp(t,e,s),this._state.stencilOperation.face=l.FRONT_AND_BACK,this._state.stencilOperation.fail=t,this._state.stencilOperation.zFail=e,this._state.stencilOperation.zPass=s,this._stateTracker.invalidateStencilTest())}setStencilOpSeparate(t,e,s,i){this._state.stencilOperation.face===t&&this._state.stencilOperation.fail===e&&this._state.stencilOperation.zFail===s&&this._state.stencilOperation.zPass===i||(this.gl.stencilOpSeparate(t,e,s,i),this._state.stencilOperation.face=t,this._state.stencilOperation.fail=e,this._state.stencilOperation.zFail=s,this._state.stencilOperation.zPass=i,this._stateTracker.invalidateStencilTest())}setActiveTexture(t,e=!1){const s=this._state.activeTexture;return t>=0&&(e||t!==this._state.activeTexture)&&(this.gl.activeTexture(h+t),this._state.activeTexture=t),s}clear(t){t&&this.gl.clear(t)}clearSafe(t,e=255){t&&(t&f.COLOR_BUFFER_BIT&&this.setColorMask(!0,!0,!0,!0),t&f.DEPTH_BUFFER_BIT&&this.setDepthWriteEnabled(!0),t&f.STENCIL_BUFFER_BIT&&this.setStencilWriteMask(e),this.gl.clear(t))}drawArrays(t,e,s){a()&&(this._numOfDrawCalls++,this._numOfTriangles+=M(t,s)),this.gl.drawArrays(t,e,s)}drawElements(t,e,s,i){a()&&(this._numOfDrawCalls++,this._numOfTriangles+=M(t,e)),this.gl.drawElements(t,e,s,i)}logIno(){a()&&console.log(`DrawCalls: ${this._numOfDrawCalls}, Triangles: ${this._numOfTriangles}`)}get capabilities(){return this._capabilities}setViewport(t,e,s,i){s=Math.max(Math.round(s),1),i=Math.max(Math.round(i),1);const a=this._state.viewport;a.x===t&&a.y===e&&a.width===s&&a.height===i||(a.x=t,a.y=e,a.width=s,a.height=i,this.gl.viewport(t,e,s,i))}getViewport(){return{x:this._state.viewport.x,y:this._state.viewport.y,width:this._state.viewport.width,height:this._state.viewport.height}}useProgram(t){var e,s;this._state.program!==t&&(null==(e=this._state.program)||e.stop(),this._state.program=t,this.gl.useProgram(null!=(s=null==t?void 0:t.glName)?s:null))}bindTexture(s,i,a=!1){(i>=this.parameters.maxTextureImageUnits||i<0)&&console.error("Input texture unit is out of range of available units!");const r=this._state.textureUnitMap[i];return t(s)||null==s.glName?(e(r)&&(this.setActiveTexture(i,a),this.gl.bindTexture(r.descriptor.target,null)),this._state.textureUnitMap[i]=null,r):a||r!==s?(this.setActiveTexture(i,a),this.gl.bindTexture(s.descriptor.target,s.glName),s.applyChanges(),this._state.textureUnitMap[i]=s,r):(s.isDirty&&(this.setActiveTexture(i,a),s.applyChanges()),r)}unbindTextureAllUnits(t){for(let e=0;e<this.parameters.maxTextureImageUnits;e++)this._state.textureUnitMap[e]===t&&(this.bindTexture(null,e),this._state.textureUnitMap[e]=null)}bindFramebuffer(e,s=!1){if(s||this._state.readFramebuffer!==e||this._state.drawFramebuffer!==e){if(t(e))return this.gl.bindFramebuffer(o.FRAMEBUFFER,null),this._state.readFramebuffer=null,void(this._state.drawFramebuffer=null);e.initializeAndBind(o.FRAMEBUFFER),this._state.readFramebuffer=e,this._state.drawFramebuffer=e}}bindFramebufferSeparate(e,i,a=!1){const r=i===o.READ_FRAMEBUFFER,n=r?this._state.readFramebuffer:this._state.drawFramebuffer;(a||n!==e)&&(t(e)?this.gl.bindFramebuffer(i,null):e.initializeAndBind(i),r?this._state.readFramebuffer=s(e,null):this._state.drawFramebuffer=s(e,null))}blitFramebuffer(t,e,s=0,i=0,a=t.width,r=t.height,n=0,l=0,h=e.width,u=e.height,c=f.COLOR_BUFFER_BIT,d=_.NEAREST){this.bindFramebufferSeparate(t,o.READ_FRAMEBUFFER),this.bindFramebufferSeparate(e,o.DRAW_FRAMEBUFFER);this.gl.blitFramebuffer(s,i,a,r,n,l,h,u,c,d)}bindBuffer(t,e){if(t)switch(null!=e||(e=t.bufferType),e){case n.ARRAY_BUFFER:this._state.vertexBuffer=P(this.gl,t,e,this._state.vertexBuffer);break;case n.ELEMENT_ARRAY_BUFFER:this._state.indexBuffer=P(this.gl,t,e,this._state.indexBuffer);break;case n.UNIFORM_BUFFER:this._state.uniformBuffer=P(this.gl,t,e,this._state.uniformBuffer);break;case n.PIXEL_PACK_BUFFER:this._state.pixelPackBuffer=P(this.gl,t,e,this._state.pixelPackBuffer);break;case n.PIXEL_UNPACK_BUFFER:this._state.pixelUnpackBuffer=P(this.gl,t,e,this._state.pixelUnpackBuffer);break;case n.COPY_READ_BUFFER:this._state.copyReadBuffer=P(this.gl,t,e,this._state.copyReadBuffer);break;case n.COPY_WRITE_BUFFER:this._state.copyWriteBuffer=P(this.gl,t,e,this._state.copyWriteBuffer)}}bindRenderbuffer(t){const e=this.gl;t||(e.bindRenderbuffer(e.RENDERBUFFER,null),this._state.renderbuffer=null),this._state.renderbuffer!==t&&(e.bindRenderbuffer(e.RENDERBUFFER,t.glName),this._state.renderbuffer=t)}_getBufferBinding(e,s){if(s>=this.parameters.maxUniformBufferBindings||s<0)return console.error("Uniform buffer binding point is out of range!"),null;const i=this._state.uniformBufferBindingPoints;let a=i[s];return t(a)&&(a={buffer:null,offset:0,size:0},i[s]=a),a}bindBufferBase(e,s,i){const a=this._getBufferBinding(e,s);if(t(a))return;if(a.buffer===i&&0===a.offset&&0===a.size)return;this.gl.bindBufferBase(e,s,i?i.glName:null),a.buffer=i,a.offset=0,a.size=0}bindBufferRange(e,s,i,a,r){const n=this._getBufferBinding(e,s);if(t(n))return;if(n.buffer===i&&n.offset===a&&n.size===r)return;if(a%this._parameters.uniformBufferOffsetAlignment!=0)return void console.error("Uniform buffer binding offset is not a multiple of the context offset alignment");this.gl.bindBufferRange(e,s,i.glName,a,r),n.buffer=i,n.offset=a,n.size=r}bindUBO(e,s,i,r){t(s)?this.bindBufferBase(n.UNIFORM_BUFFER,e,null):(a()&&(null!=r?r:s.byteLength)>this._parameters.maxUniformBlockSize&&console.error("Attempting to bind more data than the maximum uniform block size"),s.initialize(),void 0!==i&&void 0!==r?this.bindBufferRange(n.UNIFORM_BUFFER,e,s.buffer,i,r):this.bindBufferBase(n.UNIFORM_BUFFER,e,s.buffer))}unbindUBO(t){for(let s=0,i=this._state.uniformBufferBindingPoints.length;s<i;s++){const i=this._state.uniformBufferBindingPoints[s];e(i)&&i.buffer===t.buffer&&this.bindBufferBase(n.UNIFORM_BUFFER,s,null)}}unbindBuffer(t){switch(t){case n.ARRAY_BUFFER:this._state.vertexBuffer=P(this.gl,null,t,this._state.vertexBuffer);break;case n.ELEMENT_ARRAY_BUFFER:this._state.indexBuffer=P(this.gl,null,t,this._state.indexBuffer);break;case n.UNIFORM_BUFFER:this._state.uniformBuffer=P(this.gl,null,t,this._state.uniformBuffer);break;case n.PIXEL_PACK_BUFFER:this._state.pixelPackBuffer=P(this.gl,null,t,this._state.pixelPackBuffer);break;case n.PIXEL_UNPACK_BUFFER:this._state.pixelUnpackBuffer=P(this.gl,null,t,this._state.pixelUnpackBuffer);break;case n.COPY_READ_BUFFER:this._state.copyReadBuffer=P(this.gl,null,t,this._state.copyReadBuffer);break;case n.COPY_WRITE_BUFFER:this._state.copyWriteBuffer=P(this.gl,null,t,this._state.copyWriteBuffer)}}bindVAO(e=null){t(e)?this._state.vertexArrayObject&&(this._state.vertexArrayObject.unbind(),this._state.vertexArrayObject=null):this._state.vertexArrayObject!==e&&(e.bind(),this._state.vertexArrayObject=e)}async clientWaitAsync(t=0){const e=this.gl,s=e.fenceSync(u.SYNC_GPU_COMMANDS_COMPLETE,0);let a;e.flush();do{await i(t),a=e.clientWaitSync(s,0,0)}while(a===c.TIMEOUT_EXPIRED);if(e.deleteSync(s),a===c.WAIT_FAILED)throw new Error("Client wait failed")}getBoundFramebufferObject(t=o.FRAMEBUFFER){return t===o.READ_FRAMEBUFFER?this._state.readFramebuffer:this._state.drawFramebuffer}getBoundVAO(){return this._state.vertexArrayObject}resetState(){this.useProgram(null),this.bindVAO(null),this.bindFramebuffer(null,!0),this.unbindBuffer(n.ARRAY_BUFFER),this.unbindBuffer(n.ELEMENT_ARRAY_BUFFER),C(this.gl)&&(this.unbindBuffer(n.UNIFORM_BUFFER),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(n.PIXEL_PACK_BUFFER),this.unbindBuffer(n.PIXEL_UNPACK_BUFFER),this.unbindBuffer(n.COPY_READ_BUFFER),this.unbindBuffer(n.COPY_WRITE_BUFFER));for(let t=0;t<this.parameters.maxTextureImageUnits;++t)this.bindTexture(null,t);this.setBlendingEnabled(!1),this.setBlendFunction(d.ONE,d.ZERO),this.setBlendEquation(b.ADD),this.setBlendColor(0,0,0,0),this.setFaceCullingEnabled(!1),this.setCullFace(l.BACK),this.setFrontFace(F.CCW),this.setPolygonOffsetFillEnabled(!1),this.setPolygonOffset(0,0),this.setScissorTestEnabled(!1),this.setScissorRect(0,0,this.gl.canvas.width,this.gl.canvas.height),this.setDepthTestEnabled(!1),this.setDepthFunction(g.LESS),this.setDepthRange(0,1),this.setStencilTestEnabled(!1),this.setStencilFunction(g.ALWAYS,0,0),this.setStencilOp(p.KEEP,p.KEEP,p.KEEP),this.setClearColor(0,0,0,0),this.setClearDepth(1),this.setClearStencil(0),this.setColorMask(!0,!0,!0,!0),this.setStencilWriteMask(4294967295),this.setDepthWriteEnabled(!0),this.setViewport(0,0,this.gl.canvas.width,this.gl.canvas.height)}enforceState(){var t,s;const i=this.gl,r=this.capabilities.vao;r&&r.bindVertexArray(null);for(let e=0;e<this.parameters.maxVertexAttributes;e++)i.disableVertexAttribArray(e);if(this._state.vertexBuffer?i.bindBuffer(this._state.vertexBuffer.bufferType,this._state.vertexBuffer.glName):i.bindBuffer(n.ARRAY_BUFFER,null),this._state.indexBuffer?i.bindBuffer(this._state.indexBuffer.bufferType,this._state.indexBuffer.glName):i.bindBuffer(n.ELEMENT_ARRAY_BUFFER,null),C(i)){var l,f,_,u;this._state.uniformBuffer?i.bindBuffer(this._state.uniformBuffer.bufferType,this._state.uniformBuffer.glName):i.bindBuffer(n.UNIFORM_BUFFER,null);for(let t=0;t<this._parameters.maxUniformBufferBindings;t++){const s=this._state.uniformBufferBindingPoints[t];if(e(s)&&null!==s.buffer){const{buffer:e,offset:a,size:r}=s;0===a&&0===r?i.bindBufferBase(n.UNIFORM_BUFFER,t,e.glName):i.bindBufferRange(n.UNIFORM_BUFFER,t,e.glName,a,r)}else i.bindBufferBase(n.UNIFORM_BUFFER,t,null)}this._state.pixelPackBuffer?i.bindBuffer(this._state.pixelPackBuffer.bufferType,this._state.pixelPackBuffer.glName):i.bindBuffer(n.PIXEL_PACK_BUFFER,null),this._state.pixelUnpackBuffer?i.bindBuffer(this._state.pixelUnpackBuffer.bufferType,this._state.pixelUnpackBuffer.glName):i.bindBuffer(n.PIXEL_UNPACK_BUFFER,null),this._state.copyReadBuffer?i.bindBuffer(this._state.copyReadBuffer.bufferType,this._state.copyReadBuffer.glName):i.bindBuffer(n.COPY_READ_BUFFER,null),this._state.copyWriteBuffer?i.bindBuffer(this._state.copyWriteBuffer.bufferType,this._state.copyWriteBuffer.glName):i.bindBuffer(n.COPY_WRITE_BUFFER,null),i.bindFramebuffer(o.READ_FRAMEBUFFER,null!=(l=null==(f=this._state.readFramebuffer)?void 0:f.glName)?l:null),i.bindFramebuffer(o.DRAW_FRAMEBUFFER,null!=(_=null==(u=this._state.drawFramebuffer)?void 0:u.glName)?_:null)}else{var c,d;this._state.readFramebuffer=this._state.drawFramebuffer,i.bindFramebuffer(o.FRAMEBUFFER,null!=(c=null==(d=this._state.drawFramebuffer)?void 0:d.glName)?c:null)}if(r&&this._state.vertexArrayObject){const t=this._state.vertexArrayObject;this._state.vertexArrayObject&&(this._state.vertexArrayObject.unbind(),this._state.vertexArrayObject=null),this.bindVAO(t)}i.useProgram(null!=(t=null==(s=this._state.program)?void 0:s.glName)?t:null),i.blendColor(this._state.blendColor.r,this._state.blendColor.g,this._state.blendColor.b,this._state.blendColor.a),i.bindRenderbuffer(i.RENDERBUFFER,this._state.renderbuffer?this._state.renderbuffer.glName:null),!0===this._state.blend?i.enable(this.gl.BLEND):i.disable(this.gl.BLEND),i.blendEquationSeparate(this._state.blendEquation.mode,this._state.blendEquation.modeAlpha),i.blendFuncSeparate(this._state.blendFunction.srcRGB,this._state.blendFunction.dstRGB,this._state.blendFunction.srcAlpha,this._state.blendFunction.dstAlpha),i.clearColor(this._state.clearColor.r,this._state.clearColor.g,this._state.clearColor.b,this._state.clearColor.a),i.clearDepth(this._state.clearDepth),i.clearStencil(this._state.clearStencil),i.colorMask(this._state.colorMask.r,this._state.colorMask.g,this._state.colorMask.b,this._state.colorMask.a),i.cullFace(this._state.cullFace),i.depthFunc(this._state.depthFunction),i.depthRange(this._state.depthRange.zNear,this._state.depthRange.zFar),!0===this._state.depthTest?i.enable(i.DEPTH_TEST):i.disable(i.DEPTH_TEST),i.depthMask(this._state.depthWrite),i.frontFace(this._state.frontFace),i.lineWidth(1),!0===this._state.faceCulling?i.enable(i.CULL_FACE):i.disable(i.CULL_FACE),i.polygonOffset(this._state.polygonOffset[0],this._state.polygonOffset[1]),!0===this._state.polygonOffsetFill?i.enable(i.POLYGON_OFFSET_FILL):i.disable(i.POLYGON_OFFSET_FILL),i.scissor(this._state.scissorRect.x,this._state.scissorRect.y,this._state.scissorRect.width,this._state.scissorRect.height),!0===this._state.scissorTest?i.enable(i.SCISSOR_TEST):i.disable(i.SCISSOR_TEST),i.stencilFunc(this._state.stencilFunction.func,this._state.stencilFunction.ref,this._state.stencilFunction.mask),i.stencilOpSeparate(this._state.stencilOperation.face,this._state.stencilOperation.fail,this._state.stencilOperation.zFail,this._state.stencilOperation.zPass),!0===this._state.stencilTest?i.enable(i.STENCIL_TEST):i.disable(i.STENCIL_TEST),i.stencilMask(this._state.stencilWriteMask);for(let a=0;a<this.parameters.maxTextureImageUnits;a++){i.activeTexture(h+a),i.bindTexture(E.TEXTURE_2D,null),i.bindTexture(E.TEXTURE_CUBE_MAP,null),C(i)&&(i.bindTexture(E.TEXTURE_3D,null),i.bindTexture(E.TEXTURE_2D_ARRAY,null));const t=this._state.textureUnitMap[a];e(t)&&i.bindTexture(t.descriptor.target,t.glName)}i.activeTexture(h+this._state.activeTexture),i.viewport(this._state.viewport.x,this._state.viewport.y,this._state.viewport.width,this._state.viewport.height),a()&&(this._numOfDrawCalls=0,this._numOfTriangles=0)}_loadExtensions(){this.type===r.WEBGL1&&this.gl.getExtension("OES_element_index_uint"),this.gl.getExtension("KHR_parallel_shader_compile")}_loadParameters(t){var e;const s=this.capabilities.textureFilterAnisotropic,i=null!=(e=t.maxAnisotropy)?e:1/0,a=C(this.gl),r=this.gl,n={versionString:this.gl.getParameter(this.gl.VERSION),maxVertexTextureImageUnits:this.gl.getParameter(this.gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxVertexAttributes:this.gl.getParameter(this.gl.MAX_VERTEX_ATTRIBS),maxMaxAnisotropy:s?Math.min(this.gl.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY),i):1,maxTextureImageUnits:this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS),maxTextureSize:this.gl.getParameter(this.gl.MAX_TEXTURE_SIZE),maxUniformBufferBindings:a?r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS):0,maxVertexUniformBlocks:a?r.getParameter(r.MAX_VERTEX_UNIFORM_BLOCKS):0,maxFragmentUniformBlocks:a?r.getParameter(r.MAX_FRAGMENT_UNIFORM_BLOCKS):0,maxUniformBlockSize:a?r.getParameter(r.MAX_UNIFORM_BLOCK_SIZE):0,uniformBufferOffsetAlignment:a?r.getParameter(r.UNIFORM_BUFFER_OFFSET_ALIGNMENT):1,maxArrayTextureLayers:a?r.getParameter(r.MAX_ARRAY_TEXTURE_LAYERS):1,maxSamples:a?r.getParameter(r.MAX_SAMPLES):1};return R.TEXTURE_UNIT_FOR_UPDATES=n.maxTextureImageUnits-1,n}}function P(t,e,s,i){return e?i!==e&&t.bindBuffer(s,e.glName):t.bindBuffer(s,null),e}function M(t,e){switch(t){case B.POINTS:return 2*e;case B.TRIANGLES:return e/3;case B.TRIANGLE_STRIP:case B.TRIANGLE_FAN:return e-2;default:return 0}}export{S as RenderingContext};
5
+ import{isNone as t,isSome as e,unwrapOr as s}from"../../core/maybe.js";import{after as i}from"../../core/promiseUtils.js";import{Milliseconds as a}from"../../core/time.js";import"./BufferObject.js";import"./FramebufferObject.js";import"../../core/has.js";import{webglDebugEnabled as r}from"./checkWebGLError.js";import{ContextType as n}from"./context-util.js";import{BufferType as l,Face as h,BASE_TEXTURE_UNIT as f,ClearBufferBit as o,FramebufferTarget as _,TextureSamplingMode as u,ResourceType as c,SyncCondition as d,ClientWaitSyncStatus as b,BlendFactor as F,BlendOperation as g,CullMode as p,CompareFunction as E,StencilOperation as B,ColorAttachment as m,TextureType as R,PrimitiveType as T}from"./enums.js";import"./ShaderTranspiler.js";import{ProgramCache as A}from"./ProgramCache.js";import{Texture as O}from"./Texture.js";import"./VertexArrayObject.js";import{ContextState as x}from"./ContextState.js";import{InstanceCounter as U}from"./InstanceCounter.js";import{StateTracker as C}from"./renderState.js";import{WebGLDriverTest as S}from"./WebGLDriverTest.js";import{Capabilities as P}from"./capabilities/Capabilities.js";import M from"./capabilities/isWebGL2Context.js";class N{constructor(t,e){this.gl=t,this.instanceCounter=new U,this.programCache=new A(this),this._state=new x,this._numOfDrawCalls=0,this._numOfTriangles=0,this.type=M(t)?n.WEBGL2:n.WEBGL1,this._loadExtensions(),this.configure(e)}configure(t){this._capabilities=new P(this.gl,t),this._parameters=this._loadParameters(t);const e=this.gl.getParameter(this.gl.VIEWPORT);this._state=new x,this._state.viewport={x:e[0],y:e[1],width:e[2],height:e[3]},this._stateTracker=new C({setBlending:t=>{if(t){this.setBlendingEnabled(!0),this.setBlendEquationSeparate(t.opRgb,t.opAlpha),this.setBlendFunctionSeparate(t.srcRgb,t.dstRgb,t.srcAlpha,t.dstAlpha);const e=t.color;this.setBlendColor(e.r,e.g,e.b,e.a)}else this.setBlendingEnabled(!1)},setCulling:t=>{t?(this.setFaceCullingEnabled(!0),this.setCullFace(t.face),this.setFrontFace(t.mode)):this.setFaceCullingEnabled(!1)},setPolygonOffset:t=>{t?(this.setPolygonOffsetFillEnabled(!0),this.setPolygonOffset(t.factor,t.units)):this.setPolygonOffsetFillEnabled(!1)},setDepthTest:t=>{t?(this.setDepthTestEnabled(!0),this.setDepthFunction(t.func)):this.setDepthTestEnabled(!1)},setStencilTest:t=>{if(t){this.setStencilTestEnabled(!0);const e=t.function;this.setStencilFunction(e.func,e.ref,e.mask);const s=t.operation;this.setStencilOp(s.fail,s.zFail,s.zPass)}else this.setStencilTestEnabled(!1)},setDepthWrite:t=>{t?(this.setDepthWriteEnabled(!0),this.setDepthRange(t.zNear,t.zFar)):this.setDepthWriteEnabled(!1)},setColorWrite:t=>{t?this.setColorMask(t.r,t.g,t.b,t.a):this.setColorMask(!1,!1,!1,!1)},setStencilWrite:t=>{t?this.setStencilWriteMask(t.mask):this.setStencilWriteMask(0)}}),this.enforceState(),this._driverTest=new S(this)}get driverTest(){return this._driverTest}get contextAttributes(){return this.gl.getContextAttributes()}get parameters(){return this._parameters}dispose(){this.programCache.dispose(),this.bindVAO(null),this.unbindBuffer(l.ARRAY_BUFFER),this.unbindBuffer(l.ELEMENT_ARRAY_BUFFER),M(this.gl)&&(this.unbindBuffer(l.UNIFORM_BUFFER),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(l.PIXEL_PACK_BUFFER),this.unbindBuffer(l.PIXEL_UNPACK_BUFFER),this.unbindBuffer(l.COPY_READ_BUFFER),this.unbindBuffer(l.COPY_WRITE_BUFFER)),this._state.textureUnitMap.length=0,r()&&this.instanceCounter.printResourceCount()}setPipelineState(t){this._stateTracker.setPipeline(t)}setBlendingEnabled(t){this._state.blend!==t&&(!0===t?this.gl.enable(this.gl.BLEND):this.gl.disable(this.gl.BLEND),this._state.blend=t,this._stateTracker.invalidateBlending())}externalProgramUpdate(){var t;null==(t=this._state.program)||t.stop(),this._state.program=null}externalTextureUnitUpdate(t,e){for(let s=0;s<t.length;++s)this._state.textureUnitMap[t[s]]=null;e>=0&&(this._state.activeTexture=e)}externalVertexArrayObjectUpdate(){const t=this.capabilities.vao;t&&(t.bindVertexArray(null),this._state.vertexArrayObject=null),this._state.vertexBuffer=null,this._state.indexBuffer=null}externalVertexBufferUpdate(){this._state.vertexBuffer=null}externalIndexBufferUpdate(){this._state.indexBuffer=null}setBlendColor(t,e,s,i){t===this._state.blendColor.r&&e===this._state.blendColor.g&&s===this._state.blendColor.b&&i===this._state.blendColor.a||(this.gl.blendColor(t,e,s,i),this._state.blendColor.r=t,this._state.blendColor.g=e,this._state.blendColor.b=s,this._state.blendColor.a=i,this._stateTracker.invalidateBlending())}setBlendFunction(t,e){t===this._state.blendFunction.srcRGB&&e===this._state.blendFunction.dstRGB||(this.gl.blendFunc(t,e),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=t,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=e,this._stateTracker.invalidateBlending())}setBlendFunctionSeparate(t,e,s,i){this._state.blendFunction.srcRGB===t&&this._state.blendFunction.srcAlpha===s&&this._state.blendFunction.dstRGB===e&&this._state.blendFunction.dstAlpha===i||(this.gl.blendFuncSeparate(t,e,s,i),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=s,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=i,this._stateTracker.invalidateBlending())}setBlendEquation(t){this._state.blendEquation.mode!==t&&(this.gl.blendEquation(t),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=t,this._stateTracker.invalidateBlending())}setBlendEquationSeparate(t,e){this._state.blendEquation.mode===t&&this._state.blendEquation.modeAlpha===e||(this.gl.blendEquationSeparate(t,e),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=e,this._stateTracker.invalidateBlending())}setColorMask(t,e,s,i){this._state.colorMask.r===t&&this._state.colorMask.g===e&&this._state.colorMask.b===s&&this._state.colorMask.a===i||(this.gl.colorMask(t,e,s,i),this._state.colorMask.r=t,this._state.colorMask.g=e,this._state.colorMask.b=s,this._state.colorMask.a=i,this._stateTracker.invalidateColorWrite())}setClearColor(t,e,s,i){this._state.clearColor.r===t&&this._state.clearColor.g===e&&this._state.clearColor.b===s&&this._state.clearColor.a===i||(this.gl.clearColor(t,e,s,i),this._state.clearColor.r=t,this._state.clearColor.g=e,this._state.clearColor.b=s,this._state.clearColor.a=i)}setFaceCullingEnabled(t){this._state.faceCulling!==t&&(!0===t?this.gl.enable(this.gl.CULL_FACE):this.gl.disable(this.gl.CULL_FACE),this._state.faceCulling=t,this._stateTracker.invalidateCulling())}setPolygonOffsetFillEnabled(t){this._state.polygonOffsetFill!==t&&(!0===t?this.gl.enable(this.gl.POLYGON_OFFSET_FILL):this.gl.disable(this.gl.POLYGON_OFFSET_FILL),this._state.polygonOffsetFill=t,this._stateTracker.invalidatePolygonOffset())}setPolygonOffset(t,e){this._state.polygonOffset[0]===t&&this._state.polygonOffset[1]===e||(this._state.polygonOffset[0]=t,this._state.polygonOffset[1]=e,this.gl.polygonOffset(t,e),this._stateTracker.invalidatePolygonOffset())}setCullFace(t){this._state.cullFace!==t&&(this.gl.cullFace(t),this._state.cullFace=t,this._stateTracker.invalidateCulling())}setFrontFace(t){this._state.frontFace!==t&&(this.gl.frontFace(t),this._state.frontFace=t,this._stateTracker.invalidateCulling())}setScissorTestEnabled(t){this._state.scissorTest!==t&&(!0===t?this.gl.enable(this.gl.SCISSOR_TEST):this.gl.disable(this.gl.SCISSOR_TEST),this._state.scissorTest=t)}setScissorRect(t,e,s,i){this._state.scissorRect.x===t&&this._state.scissorRect.y===e&&this._state.scissorRect.width===s&&this._state.scissorRect.height===i||(this.gl.scissor(t,e,s,i),this._state.scissorRect.x=t,this._state.scissorRect.y=e,this._state.scissorRect.width=s,this._state.scissorRect.height=i)}setDepthTestEnabled(t){this._state.depthTest!==t&&(!0===t?this.gl.enable(this.gl.DEPTH_TEST):this.gl.disable(this.gl.DEPTH_TEST),this._state.depthTest=t,this._stateTracker.invalidateDepthTest())}setClearDepth(t){this._state.clearDepth!==t&&(this.gl.clearDepth(t),this._state.clearDepth=t)}setDepthFunction(t){this._state.depthFunction!==t&&(this.gl.depthFunc(t),this._state.depthFunction=t,this._stateTracker.invalidateDepthTest())}setDepthWriteEnabled(t){this._state.depthWrite!==t&&(this.gl.depthMask(t),this._state.depthWrite=t,this._stateTracker.invalidateDepthWrite())}setDepthRange(t,e){this._state.depthRange.zNear===t&&this._state.depthRange.zFar===e||(this.gl.depthRange(t,e),this._state.depthRange.zNear=t,this._state.depthRange.zFar=e,this._stateTracker.invalidateDepthWrite())}setStencilTestEnabled(t){this._state.stencilTest!==t&&(!0===t?this.gl.enable(this.gl.STENCIL_TEST):this.gl.disable(this.gl.STENCIL_TEST),this._state.stencilTest=t,this._stateTracker.invalidateStencilTest())}setClearStencil(t){t!==this._state.clearStencil&&(this.gl.clearStencil(t),this._state.clearStencil=t)}setStencilFunction(t,e,s){this._state.stencilFunction.func===t&&this._state.stencilFunction.ref===e&&this._state.stencilFunction.mask===s||(this.gl.stencilFunc(t,e,s),this._state.stencilFunction.face=h.FRONT_AND_BACK,this._state.stencilFunction.func=t,this._state.stencilFunction.ref=e,this._state.stencilFunction.mask=s,this._stateTracker.invalidateStencilTest())}setStencilFunctionSeparate(t,e,s,i){this._state.stencilFunction.face===t&&this._state.stencilFunction.func===e&&this._state.stencilFunction.ref===s&&this._state.stencilFunction.mask===i||(this.gl.stencilFuncSeparate(t,e,s,i),this._state.stencilFunction.face=t,this._state.stencilFunction.func=e,this._state.stencilFunction.ref=s,this._state.stencilFunction.mask=i,this._stateTracker.invalidateStencilTest())}setStencilWriteMask(t){this._state.stencilWriteMask!==t&&(this.gl.stencilMask(t),this._state.stencilWriteMask=t,this._stateTracker.invalidateStencilWrite())}setStencilOp(t,e,s){this._state.stencilOperation.face===h.FRONT_AND_BACK&&this._state.stencilOperation.fail===t&&this._state.stencilOperation.zFail===e&&this._state.stencilOperation.zPass===s||(this.gl.stencilOp(t,e,s),this._state.stencilOperation.face=h.FRONT_AND_BACK,this._state.stencilOperation.fail=t,this._state.stencilOperation.zFail=e,this._state.stencilOperation.zPass=s,this._stateTracker.invalidateStencilTest())}setStencilOpSeparate(t,e,s,i){this._state.stencilOperation.face===t&&this._state.stencilOperation.fail===e&&this._state.stencilOperation.zFail===s&&this._state.stencilOperation.zPass===i||(this.gl.stencilOpSeparate(t,e,s,i),this._state.stencilOperation.face=t,this._state.stencilOperation.fail=e,this._state.stencilOperation.zFail=s,this._state.stencilOperation.zPass=i,this._stateTracker.invalidateStencilTest())}setActiveTexture(t,e=!1){const s=this._state.activeTexture;return t>=0&&(e||t!==this._state.activeTexture)&&(this.gl.activeTexture(f+t),this._state.activeTexture=t),s}clear(t){t&&this.gl.clear(t)}clearSafe(t,e=255){t&&(t&o.COLOR_BUFFER_BIT&&this.setColorMask(!0,!0,!0,!0),t&o.DEPTH_BUFFER_BIT&&this.setDepthWriteEnabled(!0),t&o.STENCIL_BUFFER_BIT&&this.setStencilWriteMask(e),this.gl.clear(t))}drawArrays(t,e,s){r()&&(this._numOfDrawCalls++,this._numOfTriangles+=v(t,s)),this.gl.drawArrays(t,e,s)}drawElements(t,e,s,i){r()&&(this._numOfDrawCalls++,this._numOfTriangles+=v(t,e)),this.gl.drawElements(t,e,s,i)}logIno(){r()&&console.log(`DrawCalls: ${this._numOfDrawCalls}, Triangles: ${this._numOfTriangles}`)}get capabilities(){return this._capabilities}setViewport(t,e,s,i){s=Math.max(Math.round(s),1),i=Math.max(Math.round(i),1);const a=this._state.viewport;a.x===t&&a.y===e&&a.width===s&&a.height===i||(a.x=t,a.y=e,a.width=s,a.height=i,this.gl.viewport(t,e,s,i))}getViewport(){return{x:this._state.viewport.x,y:this._state.viewport.y,width:this._state.viewport.width,height:this._state.viewport.height}}useProgram(t){var e,s;this._state.program!==t&&(null==(e=this._state.program)||e.stop(),this._state.program=t,this.gl.useProgram(null!=(s=null==t?void 0:t.glName)?s:null))}bindTexture(s,i,a=!1){(i>=this.parameters.maxTextureImageUnits||i<0)&&console.error("Input texture unit is out of range of available units!");const r=this._state.textureUnitMap[i];return t(s)||null==s.glName?(e(r)&&(this.setActiveTexture(i,a),this.gl.bindTexture(r.descriptor.target,null)),this._state.textureUnitMap[i]=null,r):a||r!==s?(this.setActiveTexture(i,a),this.gl.bindTexture(s.descriptor.target,s.glName),s.applyChanges(),this._state.textureUnitMap[i]=s,r):(s.isDirty&&(this.setActiveTexture(i,a),s.applyChanges()),r)}unbindTextureAllUnits(t){for(let e=0;e<this.parameters.maxTextureImageUnits;e++)this._state.textureUnitMap[e]===t&&(this.bindTexture(null,e),this._state.textureUnitMap[e]=null)}bindFramebuffer(e,s=!1){if(s||this._state.readFramebuffer!==e||this._state.drawFramebuffer!==e){if(t(e))return this.gl.bindFramebuffer(_.FRAMEBUFFER,null),this._state.readFramebuffer=null,void(this._state.drawFramebuffer=null);e.initializeAndBind(_.FRAMEBUFFER),this._state.readFramebuffer=e,this._state.drawFramebuffer=e}}bindFramebufferSeparate(e,i,a=!1){const r=i===_.READ_FRAMEBUFFER,n=r?this._state.readFramebuffer:this._state.drawFramebuffer;(a||n!==e)&&(t(e)?this.gl.bindFramebuffer(i,null):e.initializeAndBind(i),r?this._state.readFramebuffer=s(e,null):this._state.drawFramebuffer=s(e,null))}blitFramebuffer(t,e,s=0,i=0,a=t.width,r=t.height,n=0,l=0,h=e.width,f=e.height,c=o.COLOR_BUFFER_BIT,d=u.NEAREST){this.bindFramebufferSeparate(t,_.READ_FRAMEBUFFER),this.bindFramebufferSeparate(e,_.DRAW_FRAMEBUFFER);this.gl.blitFramebuffer(s,i,a,r,n,l,h,f,c,d)}bindBuffer(t,e){if(t)switch(null!=e||(e=t.bufferType),e){case l.ARRAY_BUFFER:this._state.vertexBuffer=k(this.gl,t,e,this._state.vertexBuffer);break;case l.ELEMENT_ARRAY_BUFFER:this._state.indexBuffer=k(this.gl,t,e,this._state.indexBuffer);break;case l.UNIFORM_BUFFER:this._state.uniformBuffer=k(this.gl,t,e,this._state.uniformBuffer);break;case l.PIXEL_PACK_BUFFER:this._state.pixelPackBuffer=k(this.gl,t,e,this._state.pixelPackBuffer);break;case l.PIXEL_UNPACK_BUFFER:this._state.pixelUnpackBuffer=k(this.gl,t,e,this._state.pixelUnpackBuffer);break;case l.COPY_READ_BUFFER:this._state.copyReadBuffer=k(this.gl,t,e,this._state.copyReadBuffer);break;case l.COPY_WRITE_BUFFER:this._state.copyWriteBuffer=k(this.gl,t,e,this._state.copyWriteBuffer)}}bindRenderbuffer(t){const e=this.gl;t||(e.bindRenderbuffer(e.RENDERBUFFER,null),this._state.renderbuffer=null),this._state.renderbuffer!==t&&(e.bindRenderbuffer(e.RENDERBUFFER,t.glName),this._state.renderbuffer=t)}_getBufferBinding(e,s){if(s>=this.parameters.maxUniformBufferBindings||s<0)return console.error("Uniform buffer binding point is out of range!"),null;const i=this._state.uniformBufferBindingPoints;let a=i[s];return t(a)&&(a={buffer:null,offset:0,size:0},i[s]=a),a}bindBufferBase(e,s,i){const a=this._getBufferBinding(e,s);if(t(a))return;if(a.buffer===i&&0===a.offset&&0===a.size)return;this.gl.bindBufferBase(e,s,i?i.glName:null),a.buffer=i,a.offset=0,a.size=0}bindBufferRange(e,s,i,a,r){const n=this._getBufferBinding(e,s);if(t(n))return;if(n.buffer===i&&n.offset===a&&n.size===r)return;if(a%this._parameters.uniformBufferOffsetAlignment!=0)return void console.error("Uniform buffer binding offset is not a multiple of the context offset alignment");this.gl.bindBufferRange(e,s,i.glName,a,r),n.buffer=i,n.offset=a,n.size=r}bindUBO(e,s,i,a){t(s)?this.bindBufferBase(l.UNIFORM_BUFFER,e,null):(r()&&(null!=a?a:s.byteLength)>this._parameters.maxUniformBlockSize&&console.error("Attempting to bind more data than the maximum uniform block size"),s.initialize(),void 0!==i&&void 0!==a?this.bindBufferRange(l.UNIFORM_BUFFER,e,s.buffer,i,a):this.bindBufferBase(l.UNIFORM_BUFFER,e,s.buffer))}unbindUBO(t){for(let s=0,i=this._state.uniformBufferBindingPoints.length;s<i;s++){const i=this._state.uniformBufferBindingPoints[s];e(i)&&i.buffer===t.buffer&&this.bindBufferBase(l.UNIFORM_BUFFER,s,null)}}unbindBuffer(t){switch(t){case l.ARRAY_BUFFER:this._state.vertexBuffer=k(this.gl,null,t,this._state.vertexBuffer);break;case l.ELEMENT_ARRAY_BUFFER:this._state.indexBuffer=k(this.gl,null,t,this._state.indexBuffer);break;case l.UNIFORM_BUFFER:this._state.uniformBuffer=k(this.gl,null,t,this._state.uniformBuffer);break;case l.PIXEL_PACK_BUFFER:this._state.pixelPackBuffer=k(this.gl,null,t,this._state.pixelPackBuffer);break;case l.PIXEL_UNPACK_BUFFER:this._state.pixelUnpackBuffer=k(this.gl,null,t,this._state.pixelUnpackBuffer);break;case l.COPY_READ_BUFFER:this._state.copyReadBuffer=k(this.gl,null,t,this._state.copyReadBuffer);break;case l.COPY_WRITE_BUFFER:this._state.copyWriteBuffer=k(this.gl,null,t,this._state.copyWriteBuffer)}}bindVAO(e=null){t(e)?this._state.vertexArrayObject&&(this._state.vertexArrayObject.unbind(),this._state.vertexArrayObject=null):this._state.vertexArrayObject!==e&&(e.bind(),this._state.vertexArrayObject=e)}async clientWaitAsync(t=a(10)){const e={};this.instanceCounter.increment(c.Sync,e);const s=this.gl,r=s.fenceSync(d.SYNC_GPU_COMMANDS_COMPLETE,0);let n;s.flush();do{await i(t),n=s.clientWaitSync(r,0,0)}while(n===b.TIMEOUT_EXPIRED);if(s.deleteSync(r),this.instanceCounter.decrement(c.Sync,e),n===b.WAIT_FAILED)throw new Error("Client wait failed")}getBoundFramebufferObject(t=_.FRAMEBUFFER){return t===_.READ_FRAMEBUFFER?this._state.readFramebuffer:this._state.drawFramebuffer}getBoundVAO(){return this._state.vertexArrayObject}resetState(){this.useProgram(null),this.bindVAO(null),this.bindFramebuffer(null,!0),this.unbindBuffer(l.ARRAY_BUFFER),this.unbindBuffer(l.ELEMENT_ARRAY_BUFFER),M(this.gl)&&(this.unbindBuffer(l.UNIFORM_BUFFER),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(l.PIXEL_PACK_BUFFER),this.unbindBuffer(l.PIXEL_UNPACK_BUFFER),this.unbindBuffer(l.COPY_READ_BUFFER),this.unbindBuffer(l.COPY_WRITE_BUFFER));for(let t=0;t<this.parameters.maxTextureImageUnits;++t)this.bindTexture(null,t);this.setBlendingEnabled(!1),this.setBlendFunction(F.ONE,F.ZERO),this.setBlendEquation(g.ADD),this.setBlendColor(0,0,0,0),this.setFaceCullingEnabled(!1),this.setCullFace(h.BACK),this.setFrontFace(p.CCW),this.setPolygonOffsetFillEnabled(!1),this.setPolygonOffset(0,0),this.setScissorTestEnabled(!1),this.setScissorRect(0,0,this.gl.canvas.width,this.gl.canvas.height),this.setDepthTestEnabled(!1),this.setDepthFunction(E.LESS),this.setDepthRange(0,1),this.setStencilTestEnabled(!1),this.setStencilFunction(E.ALWAYS,0,0),this.setStencilOp(B.KEEP,B.KEEP,B.KEEP),this.setClearColor(0,0,0,0),this.setClearDepth(1),this.setClearStencil(0),this.setColorMask(!0,!0,!0,!0),this.setStencilWriteMask(4294967295),this.setDepthWriteEnabled(!0),this.setViewport(0,0,this.gl.canvas.width,this.gl.canvas.height)}enforceState(){var t,s;const i=this.gl,a=this.capabilities.vao;a&&a.bindVertexArray(null);for(let e=0;e<this.parameters.maxVertexAttributes;e++)i.disableVertexAttribArray(e);if(this._state.vertexBuffer?i.bindBuffer(this._state.vertexBuffer.bufferType,this._state.vertexBuffer.glName):i.bindBuffer(l.ARRAY_BUFFER,null),this._state.indexBuffer?i.bindBuffer(this._state.indexBuffer.bufferType,this._state.indexBuffer.glName):i.bindBuffer(l.ELEMENT_ARRAY_BUFFER,null),M(i)){var n,h;this._state.uniformBuffer?i.bindBuffer(this._state.uniformBuffer.bufferType,this._state.uniformBuffer.glName):i.bindBuffer(l.UNIFORM_BUFFER,null);for(let t=0;t<this._parameters.maxUniformBufferBindings;t++){const s=this._state.uniformBufferBindingPoints[t];if(e(s)&&null!==s.buffer){const{buffer:e,offset:a,size:r}=s;0===a&&0===r?i.bindBufferBase(l.UNIFORM_BUFFER,t,e.glName):i.bindBufferRange(l.UNIFORM_BUFFER,t,e.glName,a,r)}else i.bindBufferBase(l.UNIFORM_BUFFER,t,null)}this._state.pixelPackBuffer?i.bindBuffer(this._state.pixelPackBuffer.bufferType,this._state.pixelPackBuffer.glName):i.bindBuffer(l.PIXEL_PACK_BUFFER,null),this._state.pixelUnpackBuffer?i.bindBuffer(this._state.pixelUnpackBuffer.bufferType,this._state.pixelUnpackBuffer.glName):i.bindBuffer(l.PIXEL_UNPACK_BUFFER,null),this._state.copyReadBuffer?i.bindBuffer(this._state.copyReadBuffer.bufferType,this._state.copyReadBuffer.glName):i.bindBuffer(l.COPY_READ_BUFFER,null),this._state.copyWriteBuffer?i.bindBuffer(this._state.copyWriteBuffer.bufferType,this._state.copyWriteBuffer.glName):i.bindBuffer(l.COPY_WRITE_BUFFER,null),i.bindFramebuffer(_.READ_FRAMEBUFFER,null),i.readBuffer(i.BACK),this._state.readFramebuffer&&(i.bindFramebuffer(_.READ_FRAMEBUFFER,this._state.readFramebuffer.glName),i.readBuffer(m.COLOR_ATTACHMENT0)),i.bindFramebuffer(_.DRAW_FRAMEBUFFER,null!=(n=null==(h=this._state.drawFramebuffer)?void 0:h.glName)?n:null)}else{var o,u;this._state.readFramebuffer=this._state.drawFramebuffer,i.bindFramebuffer(_.FRAMEBUFFER,null!=(o=null==(u=this._state.drawFramebuffer)?void 0:u.glName)?o:null)}if(a&&this._state.vertexArrayObject){const t=this._state.vertexArrayObject;this._state.vertexArrayObject&&(this._state.vertexArrayObject.unbind(),this._state.vertexArrayObject=null),this.bindVAO(t)}i.useProgram(null!=(t=null==(s=this._state.program)?void 0:s.glName)?t:null),i.blendColor(this._state.blendColor.r,this._state.blendColor.g,this._state.blendColor.b,this._state.blendColor.a),i.bindRenderbuffer(i.RENDERBUFFER,this._state.renderbuffer?this._state.renderbuffer.glName:null),!0===this._state.blend?i.enable(this.gl.BLEND):i.disable(this.gl.BLEND),i.blendEquationSeparate(this._state.blendEquation.mode,this._state.blendEquation.modeAlpha),i.blendFuncSeparate(this._state.blendFunction.srcRGB,this._state.blendFunction.dstRGB,this._state.blendFunction.srcAlpha,this._state.blendFunction.dstAlpha),i.clearColor(this._state.clearColor.r,this._state.clearColor.g,this._state.clearColor.b,this._state.clearColor.a),i.clearDepth(this._state.clearDepth),i.clearStencil(this._state.clearStencil),i.colorMask(this._state.colorMask.r,this._state.colorMask.g,this._state.colorMask.b,this._state.colorMask.a),i.cullFace(this._state.cullFace),i.depthFunc(this._state.depthFunction),i.depthRange(this._state.depthRange.zNear,this._state.depthRange.zFar),!0===this._state.depthTest?i.enable(i.DEPTH_TEST):i.disable(i.DEPTH_TEST),i.depthMask(this._state.depthWrite),i.frontFace(this._state.frontFace),i.lineWidth(1),!0===this._state.faceCulling?i.enable(i.CULL_FACE):i.disable(i.CULL_FACE),i.polygonOffset(this._state.polygonOffset[0],this._state.polygonOffset[1]),!0===this._state.polygonOffsetFill?i.enable(i.POLYGON_OFFSET_FILL):i.disable(i.POLYGON_OFFSET_FILL),i.scissor(this._state.scissorRect.x,this._state.scissorRect.y,this._state.scissorRect.width,this._state.scissorRect.height),!0===this._state.scissorTest?i.enable(i.SCISSOR_TEST):i.disable(i.SCISSOR_TEST),i.stencilFunc(this._state.stencilFunction.func,this._state.stencilFunction.ref,this._state.stencilFunction.mask),i.stencilOpSeparate(this._state.stencilOperation.face,this._state.stencilOperation.fail,this._state.stencilOperation.zFail,this._state.stencilOperation.zPass),!0===this._state.stencilTest?i.enable(i.STENCIL_TEST):i.disable(i.STENCIL_TEST),i.stencilMask(this._state.stencilWriteMask);for(let r=0;r<this.parameters.maxTextureImageUnits;r++){i.activeTexture(f+r),i.bindTexture(R.TEXTURE_2D,null),i.bindTexture(R.TEXTURE_CUBE_MAP,null),M(i)&&(i.bindTexture(R.TEXTURE_3D,null),i.bindTexture(R.TEXTURE_2D_ARRAY,null));const t=this._state.textureUnitMap[r];e(t)&&i.bindTexture(t.descriptor.target,t.glName)}i.activeTexture(f+this._state.activeTexture),i.viewport(this._state.viewport.x,this._state.viewport.y,this._state.viewport.width,this._state.viewport.height),r()&&(this._numOfDrawCalls=0,this._numOfTriangles=0)}_loadExtensions(){this.type===n.WEBGL1&&this.gl.getExtension("OES_element_index_uint"),this.gl.getExtension("KHR_parallel_shader_compile")}_loadParameters(t){var e;const s=this.capabilities.textureFilterAnisotropic,i=null!=(e=t.maxAnisotropy)?e:1/0,a=M(this.gl),r=this.gl,n={versionString:this.gl.getParameter(this.gl.VERSION),maxVertexTextureImageUnits:this.gl.getParameter(this.gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxVertexAttributes:this.gl.getParameter(this.gl.MAX_VERTEX_ATTRIBS),maxMaxAnisotropy:s?Math.min(this.gl.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY),i):1,maxTextureImageUnits:this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS),maxTextureSize:this.gl.getParameter(this.gl.MAX_TEXTURE_SIZE),maxUniformBufferBindings:a?r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS):0,maxVertexUniformBlocks:a?r.getParameter(r.MAX_VERTEX_UNIFORM_BLOCKS):0,maxFragmentUniformBlocks:a?r.getParameter(r.MAX_FRAGMENT_UNIFORM_BLOCKS):0,maxUniformBlockSize:a?r.getParameter(r.MAX_UNIFORM_BLOCK_SIZE):0,uniformBufferOffsetAlignment:a?r.getParameter(r.UNIFORM_BUFFER_OFFSET_ALIGNMENT):1,maxArrayTextureLayers:a?r.getParameter(r.MAX_ARRAY_TEXTURE_LAYERS):1,maxSamples:a?r.getParameter(r.MAX_SAMPLES):1};return O.TEXTURE_UNIT_FOR_UPDATES=n.maxTextureImageUnits-1,n}}function k(t,e,s,i){return e?i!==e&&t.bindBuffer(s,e.glName):t.bindBuffer(s,null),e}function v(t,e){switch(t){case T.POINTS:return 2*e;case T.TRIANGLES:return e/3;case T.TRIANGLE_STRIP:case T.TRIANGLE_FAN:return e-2;default:return 0}}export{N as RenderingContext};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- var _,E,R,T,A,N,S,C,I,O,L,D,M,P,U,G,B,F,H,n,Y,V;!function(_){_[_.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",_[_.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",_[_.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT"}(_||(_={})),function(_){_[_.POINTS=0]="POINTS",_[_.LINES=1]="LINES",_[_.LINE_LOOP=2]="LINE_LOOP",_[_.LINE_STRIP=3]="LINE_STRIP",_[_.TRIANGLES=4]="TRIANGLES",_[_.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",_[_.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(E||(E={})),function(_){_[_.ZERO=0]="ZERO",_[_.ONE=1]="ONE",_[_.SRC_COLOR=768]="SRC_COLOR",_[_.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",_[_.SRC_ALPHA=770]="SRC_ALPHA",_[_.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",_[_.DST_ALPHA=772]="DST_ALPHA",_[_.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",_[_.DST_COLOR=774]="DST_COLOR",_[_.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",_[_.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",_[_.CONSTANT_COLOR=32769]="CONSTANT_COLOR",_[_.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",_[_.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",_[_.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA"}(R||(R={})),function(_){_[_.ADD=32774]="ADD",_[_.SUBTRACT=32778]="SUBTRACT",_[_.REVERSE_SUBTRACT=32779]="REVERSE_SUBTRACT"}(T||(T={})),function(_){_[_.ARRAY_BUFFER=34962]="ARRAY_BUFFER",_[_.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",_[_.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",_[_.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",_[_.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",_[_.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",_[_.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER"}(A||(A={})),function(_){_[_.FRONT=1028]="FRONT",_[_.BACK=1029]="BACK",_[_.FRONT_AND_BACK=1032]="FRONT_AND_BACK"}(N||(N={})),function(_){_[_.CW=2304]="CW",_[_.CCW=2305]="CCW"}(S||(S={})),function(_){_[_.BYTE=5120]="BYTE",_[_.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",_[_.SHORT=5122]="SHORT",_[_.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",_[_.INT=5124]="INT",_[_.UNSIGNED_INT=5125]="UNSIGNED_INT",_[_.FLOAT=5126]="FLOAT"}(C||(C={})),function(_){_[_.NEVER=512]="NEVER",_[_.LESS=513]="LESS",_[_.EQUAL=514]="EQUAL",_[_.LEQUAL=515]="LEQUAL",_[_.GREATER=516]="GREATER",_[_.NOTEQUAL=517]="NOTEQUAL",_[_.GEQUAL=518]="GEQUAL",_[_.ALWAYS=519]="ALWAYS"}(I||(I={})),function(_){_[_.ZERO=0]="ZERO",_[_.KEEP=7680]="KEEP",_[_.REPLACE=7681]="REPLACE",_[_.INCR=7682]="INCR",_[_.DECR=7683]="DECR",_[_.INVERT=5386]="INVERT",_[_.INCR_WRAP=34055]="INCR_WRAP",_[_.DECR_WRAP=34056]="DECR_WRAP"}(O||(O={})),function(_){_[_.NEAREST=9728]="NEAREST",_[_.LINEAR=9729]="LINEAR",_[_.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",_[_.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",_[_.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",_[_.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR"}(L||(L={})),function(_){_[_.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",_[_.REPEAT=10497]="REPEAT",_[_.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(D||(D={})),function(_){_[_.TEXTURE_2D=3553]="TEXTURE_2D",_[_.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",_[_.TEXTURE_3D=32879]="TEXTURE_3D",_[_.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",_[_.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",_[_.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",_[_.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",_[_.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",_[_.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",_[_.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY"}(M||(M={})),function(_){_[_.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",_[_.DEPTH_STENCIL=34041]="DEPTH_STENCIL",_[_.ALPHA=6406]="ALPHA",_[_.RGB=6407]="RGB",_[_.RGBA=6408]="RGBA",_[_.LUMINANCE=6409]="LUMINANCE",_[_.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",_[_.RED=6403]="RED",_[_.RG=33319]="RG",_[_.RED_INTEGER=36244]="RED_INTEGER",_[_.RG_INTEGER=33320]="RG_INTEGER",_[_.RGB_INTEGER=36248]="RGB_INTEGER",_[_.RGBA_INTEGER=36249]="RGBA_INTEGER"}(P||(P={})),function(_){_[_.RGBA4=32854]="RGBA4",_[_.R16F=33325]="R16F",_[_.RG16F=33327]="RG16F",_[_.RGB32F=34837]="RGB32F",_[_.RGBA16F=34842]="RGBA16F",_[_.R32F=33326]="R32F",_[_.RG32F=33328]="RG32F",_[_.RGBA32F=34836]="RGBA32F",_[_.R11F_G11F_B10F=35898]="R11F_G11F_B10F",_[_.RGB8=32849]="RGB8",_[_.RGBA8=32856]="RGBA8",_[_.RGB5_A1=32855]="RGB5_A1",_[_.R8=33321]="R8",_[_.RG8=33323]="RG8",_[_.R8I=33329]="R8I",_[_.R8UI=33330]="R8UI",_[_.R16I=33331]="R16I",_[_.R16UI=33332]="R16UI",_[_.R32I=33333]="R32I",_[_.R32UI=33334]="R32UI",_[_.RG8I=33335]="RG8I",_[_.RG8UI=33336]="RG8UI",_[_.RG16I=33337]="RG16I",_[_.RG16UI=33338]="RG16UI",_[_.RG32I=33339]="RG32I",_[_.RG32UI=33340]="RG32UI",_[_.RGB16F=34843]="RGB16F",_[_.RGB9_E5=35901]="RGB9_E5",_[_.SRGB8=35905]="SRGB8",_[_.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",_[_.RGB565=36194]="RGB565",_[_.RGBA32UI=36208]="RGBA32UI",_[_.RGB32UI=36209]="RGB32UI",_[_.RGBA16UI=36214]="RGBA16UI",_[_.RGB16UI=36215]="RGB16UI",_[_.RGBA8UI=36220]="RGBA8UI",_[_.RGB8UI=36221]="RGB8UI",_[_.RGBA32I=36226]="RGBA32I",_[_.RGB32I=36227]="RGB32I",_[_.RGBA16I=36232]="RGBA16I",_[_.RGB16I=36233]="RGB16I",_[_.RGBA8I=36238]="RGBA8I",_[_.RGB8I=36239]="RGB8I",_[_.R8_SNORM=36756]="R8_SNORM",_[_.RG8_SNORM=36757]="RG8_SNORM",_[_.RGB8_SNORM=36758]="RGB8_SNORM",_[_.RGBA8_SNORM=36759]="RGBA8_SNORM",_[_.RGB10_A2=32857]="RGB10_A2",_[_.RGB10_A2UI=36975]="RGB10_A2UI"}(U||(U={})),function(_){_[_.FLOAT=5126]="FLOAT",_[_.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",_[_.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",_[_.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",_[_.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",_[_.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",_[_.BYTE=5120]="BYTE",_[_.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",_[_.SHORT=5122]="SHORT",_[_.UNSIGNED_INT=5125]="UNSIGNED_INT",_[_.INT=5124]="INT",_[_.HALF_FLOAT=5131]="HALF_FLOAT",_[_.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",_[_.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",_[_.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",_[_.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV"}(G||(G={})),function(_){_[_.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",_[_.STENCIL_INDEX8=36168]="STENCIL_INDEX8",_[_.DEPTH_STENCIL=34041]="DEPTH_STENCIL",_[_.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",_[_.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",_[_.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",_[_.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8"}(B||(B={})),function(_){_[_.STATIC_DRAW=35044]="STATIC_DRAW",_[_.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",_[_.STREAM_DRAW=35040]="STREAM_DRAW",_[_.STATIC_READ=35045]="STATIC_READ",_[_.DYNAMIC_READ=35049]="DYNAMIC_READ",_[_.STREAM_READ=35041]="STREAM_READ",_[_.STATIC_COPY=35046]="STATIC_COPY",_[_.DYNAMIC_COPY=35050]="DYNAMIC_COPY",_[_.STREAM_COPY=35042]="STREAM_COPY"}(F||(F={})),function(_){_[_.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",_[_.VERTEX_SHADER=35633]="VERTEX_SHADER"}(H||(H={})),function(_){_[_.FRAMEBUFFER=36160]="FRAMEBUFFER",_[_.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",_[_.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER"}(n||(n={})),function(_){_[_.TEXTURE=0]="TEXTURE",_[_.RENDER_BUFFER=1]="RENDER_BUFFER",_[_.CUBEMAP=2]="CUBEMAP"}(Y||(Y={})),function(_){_[_.NONE=0]="NONE",_[_.DEPTH_RENDER_BUFFER=1]="DEPTH_RENDER_BUFFER",_[_.STENCIL_RENDER_BUFFER=2]="STENCIL_RENDER_BUFFER",_[_.DEPTH_STENCIL_RENDER_BUFFER=3]="DEPTH_STENCIL_RENDER_BUFFER",_[_.DEPTH_STENCIL_TEXTURE=4]="DEPTH_STENCIL_TEXTURE"}(V||(V={}));const X=33984;var f,u;!function(_){_[_.Texture=0]="Texture",_[_.Buffer=1]="Buffer",_[_.VAO=2]="VAO",_[_.Shader=3]="Shader",_[_.Program=4]="Program",_[_.Framebuffer=5]="Framebuffer",_[_.Renderbuffer=6]="Renderbuffer",_[_.COUNT=7]="COUNT"}(f||(f={})),function(_){_[_.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",_[_.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",_[_.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",_[_.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",_[_.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",_[_.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",_[_.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",_[_.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",_[_.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",_[_.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",_[_.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",_[_.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",_[_.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",_[_.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",_[_.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",_[_.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15"}(u||(u={}));const o=33306;var t,c,i,W,r,e,x;!function(_){_[_.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",_[_.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",_[_.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",_[_.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",_[_.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",_[_.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",_[_.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",_[_.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",_[_.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",_[_.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",_[_.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",_[_.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",_[_.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",_[_.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC"}(t||(t={})),function(_){_[_.FLOAT=5126]="FLOAT",_[_.FLOAT_VEC2=35664]="FLOAT_VEC2",_[_.FLOAT_VEC3=35665]="FLOAT_VEC3",_[_.FLOAT_VEC4=35666]="FLOAT_VEC4",_[_.INT=5124]="INT",_[_.INT_VEC2=35667]="INT_VEC2",_[_.INT_VEC3=35668]="INT_VEC3",_[_.INT_VEC4=35669]="INT_VEC4",_[_.BOOL=35670]="BOOL",_[_.BOOL_VEC2=35671]="BOOL_VEC2",_[_.BOOL_VEC3=35672]="BOOL_VEC3",_[_.BOOL_VEC4=35673]="BOOL_VEC4",_[_.FLOAT_MAT2=35674]="FLOAT_MAT2",_[_.FLOAT_MAT3=35675]="FLOAT_MAT3",_[_.FLOAT_MAT4=35676]="FLOAT_MAT4",_[_.SAMPLER_2D=35678]="SAMPLER_2D",_[_.SAMPLER_CUBE=35680]="SAMPLER_CUBE",_[_.UNSIGNED_INT=5125]="UNSIGNED_INT",_[_.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",_[_.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",_[_.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",_[_.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",_[_.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",_[_.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",_[_.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",_[_.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",_[_.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",_[_.SAMPLER_3D=35679]="SAMPLER_3D",_[_.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",_[_.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",_[_.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",_[_.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",_[_.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",_[_.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",_[_.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",_[_.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",_[_.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",_[_.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",_[_.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",_[_.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY"}(c||(c={})),function(_){_[_.OBJECT_TYPE=37138]="OBJECT_TYPE",_[_.SYNC_CONDITION=37139]="SYNC_CONDITION",_[_.SYNC_STATUS=37140]="SYNC_STATUS",_[_.SYNC_FLAGS=37141]="SYNC_FLAGS"}(i||(i={})),function(_){_[_.UNSIGNALED=37144]="UNSIGNALED",_[_.SIGNALED=37145]="SIGNALED"}(W||(W={})),function(_){_[_.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",_[_.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",_[_.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",_[_.WAIT_FAILED=37149]="WAIT_FAILED"}(r||(r={})),function(_){_[_.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE"}(e||(e={})),function(_){_[_.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT"}(x||(x={}));export{X as BASE_TEXTURE_UNIT,R as BlendFactor,T as BlendOperation,A as BufferType,_ as ClearBufferBit,r as ClientWaitSyncStatus,u as ColorAttachment,I as CompareFunction,t as CompressedTextureFormat,S as CullMode,C as DataType,o as DepthStencilAttachment,V as DepthStencilTargetType,N as Face,n as FramebufferTarget,P as PixelFormat,G as PixelType,E as PrimitiveType,B as RenderbufferFormat,f as ResourceType,H as ShaderType,U as SizedPixelFormat,O as StencilOperation,e as SyncCondition,x as SyncFlag,i as SyncParameter,W as SyncStatus,Y as TargetType,L as TextureSamplingMode,M as TextureType,D as TextureWrapMode,c as UniformType,F as Usage};
5
+ var _,E,R,T,A,N,S,C,I,O,L,D,M,P,U,G,B,F,H,n,Y,V;!function(_){_[_.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",_[_.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",_[_.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT"}(_||(_={})),function(_){_[_.POINTS=0]="POINTS",_[_.LINES=1]="LINES",_[_.LINE_LOOP=2]="LINE_LOOP",_[_.LINE_STRIP=3]="LINE_STRIP",_[_.TRIANGLES=4]="TRIANGLES",_[_.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",_[_.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(E||(E={})),function(_){_[_.ZERO=0]="ZERO",_[_.ONE=1]="ONE",_[_.SRC_COLOR=768]="SRC_COLOR",_[_.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",_[_.SRC_ALPHA=770]="SRC_ALPHA",_[_.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",_[_.DST_ALPHA=772]="DST_ALPHA",_[_.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",_[_.DST_COLOR=774]="DST_COLOR",_[_.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",_[_.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",_[_.CONSTANT_COLOR=32769]="CONSTANT_COLOR",_[_.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",_[_.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",_[_.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA"}(R||(R={})),function(_){_[_.ADD=32774]="ADD",_[_.SUBTRACT=32778]="SUBTRACT",_[_.REVERSE_SUBTRACT=32779]="REVERSE_SUBTRACT"}(T||(T={})),function(_){_[_.ARRAY_BUFFER=34962]="ARRAY_BUFFER",_[_.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",_[_.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",_[_.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",_[_.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",_[_.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",_[_.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER"}(A||(A={})),function(_){_[_.FRONT=1028]="FRONT",_[_.BACK=1029]="BACK",_[_.FRONT_AND_BACK=1032]="FRONT_AND_BACK"}(N||(N={})),function(_){_[_.CW=2304]="CW",_[_.CCW=2305]="CCW"}(S||(S={})),function(_){_[_.BYTE=5120]="BYTE",_[_.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",_[_.SHORT=5122]="SHORT",_[_.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",_[_.INT=5124]="INT",_[_.UNSIGNED_INT=5125]="UNSIGNED_INT",_[_.FLOAT=5126]="FLOAT"}(C||(C={})),function(_){_[_.NEVER=512]="NEVER",_[_.LESS=513]="LESS",_[_.EQUAL=514]="EQUAL",_[_.LEQUAL=515]="LEQUAL",_[_.GREATER=516]="GREATER",_[_.NOTEQUAL=517]="NOTEQUAL",_[_.GEQUAL=518]="GEQUAL",_[_.ALWAYS=519]="ALWAYS"}(I||(I={})),function(_){_[_.ZERO=0]="ZERO",_[_.KEEP=7680]="KEEP",_[_.REPLACE=7681]="REPLACE",_[_.INCR=7682]="INCR",_[_.DECR=7683]="DECR",_[_.INVERT=5386]="INVERT",_[_.INCR_WRAP=34055]="INCR_WRAP",_[_.DECR_WRAP=34056]="DECR_WRAP"}(O||(O={})),function(_){_[_.NEAREST=9728]="NEAREST",_[_.LINEAR=9729]="LINEAR",_[_.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",_[_.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",_[_.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",_[_.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR"}(L||(L={})),function(_){_[_.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",_[_.REPEAT=10497]="REPEAT",_[_.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(D||(D={})),function(_){_[_.TEXTURE_2D=3553]="TEXTURE_2D",_[_.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",_[_.TEXTURE_3D=32879]="TEXTURE_3D",_[_.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",_[_.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",_[_.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",_[_.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",_[_.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",_[_.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",_[_.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY"}(M||(M={})),function(_){_[_.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",_[_.DEPTH_STENCIL=34041]="DEPTH_STENCIL",_[_.ALPHA=6406]="ALPHA",_[_.RGB=6407]="RGB",_[_.RGBA=6408]="RGBA",_[_.LUMINANCE=6409]="LUMINANCE",_[_.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",_[_.RED=6403]="RED",_[_.RG=33319]="RG",_[_.RED_INTEGER=36244]="RED_INTEGER",_[_.RG_INTEGER=33320]="RG_INTEGER",_[_.RGB_INTEGER=36248]="RGB_INTEGER",_[_.RGBA_INTEGER=36249]="RGBA_INTEGER"}(P||(P={})),function(_){_[_.RGBA4=32854]="RGBA4",_[_.R16F=33325]="R16F",_[_.RG16F=33327]="RG16F",_[_.RGB32F=34837]="RGB32F",_[_.RGBA16F=34842]="RGBA16F",_[_.R32F=33326]="R32F",_[_.RG32F=33328]="RG32F",_[_.RGBA32F=34836]="RGBA32F",_[_.R11F_G11F_B10F=35898]="R11F_G11F_B10F",_[_.RGB8=32849]="RGB8",_[_.RGBA8=32856]="RGBA8",_[_.RGB5_A1=32855]="RGB5_A1",_[_.R8=33321]="R8",_[_.RG8=33323]="RG8",_[_.R8I=33329]="R8I",_[_.R8UI=33330]="R8UI",_[_.R16I=33331]="R16I",_[_.R16UI=33332]="R16UI",_[_.R32I=33333]="R32I",_[_.R32UI=33334]="R32UI",_[_.RG8I=33335]="RG8I",_[_.RG8UI=33336]="RG8UI",_[_.RG16I=33337]="RG16I",_[_.RG16UI=33338]="RG16UI",_[_.RG32I=33339]="RG32I",_[_.RG32UI=33340]="RG32UI",_[_.RGB16F=34843]="RGB16F",_[_.RGB9_E5=35901]="RGB9_E5",_[_.SRGB8=35905]="SRGB8",_[_.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",_[_.RGB565=36194]="RGB565",_[_.RGBA32UI=36208]="RGBA32UI",_[_.RGB32UI=36209]="RGB32UI",_[_.RGBA16UI=36214]="RGBA16UI",_[_.RGB16UI=36215]="RGB16UI",_[_.RGBA8UI=36220]="RGBA8UI",_[_.RGB8UI=36221]="RGB8UI",_[_.RGBA32I=36226]="RGBA32I",_[_.RGB32I=36227]="RGB32I",_[_.RGBA16I=36232]="RGBA16I",_[_.RGB16I=36233]="RGB16I",_[_.RGBA8I=36238]="RGBA8I",_[_.RGB8I=36239]="RGB8I",_[_.R8_SNORM=36756]="R8_SNORM",_[_.RG8_SNORM=36757]="RG8_SNORM",_[_.RGB8_SNORM=36758]="RGB8_SNORM",_[_.RGBA8_SNORM=36759]="RGBA8_SNORM",_[_.RGB10_A2=32857]="RGB10_A2",_[_.RGB10_A2UI=36975]="RGB10_A2UI"}(U||(U={})),function(_){_[_.FLOAT=5126]="FLOAT",_[_.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",_[_.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",_[_.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",_[_.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",_[_.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",_[_.BYTE=5120]="BYTE",_[_.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",_[_.SHORT=5122]="SHORT",_[_.UNSIGNED_INT=5125]="UNSIGNED_INT",_[_.INT=5124]="INT",_[_.HALF_FLOAT=5131]="HALF_FLOAT",_[_.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",_[_.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",_[_.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",_[_.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV"}(G||(G={})),function(_){_[_.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",_[_.STENCIL_INDEX8=36168]="STENCIL_INDEX8",_[_.DEPTH_STENCIL=34041]="DEPTH_STENCIL",_[_.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",_[_.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",_[_.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",_[_.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8"}(B||(B={})),function(_){_[_.STATIC_DRAW=35044]="STATIC_DRAW",_[_.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",_[_.STREAM_DRAW=35040]="STREAM_DRAW",_[_.STATIC_READ=35045]="STATIC_READ",_[_.DYNAMIC_READ=35049]="DYNAMIC_READ",_[_.STREAM_READ=35041]="STREAM_READ",_[_.STATIC_COPY=35046]="STATIC_COPY",_[_.DYNAMIC_COPY=35050]="DYNAMIC_COPY",_[_.STREAM_COPY=35042]="STREAM_COPY"}(F||(F={})),function(_){_[_.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",_[_.VERTEX_SHADER=35633]="VERTEX_SHADER"}(H||(H={})),function(_){_[_.FRAMEBUFFER=36160]="FRAMEBUFFER",_[_.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",_[_.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER"}(n||(n={})),function(_){_[_.TEXTURE=0]="TEXTURE",_[_.RENDER_BUFFER=1]="RENDER_BUFFER",_[_.CUBEMAP=2]="CUBEMAP"}(Y||(Y={})),function(_){_[_.NONE=0]="NONE",_[_.DEPTH_RENDER_BUFFER=1]="DEPTH_RENDER_BUFFER",_[_.STENCIL_RENDER_BUFFER=2]="STENCIL_RENDER_BUFFER",_[_.DEPTH_STENCIL_RENDER_BUFFER=3]="DEPTH_STENCIL_RENDER_BUFFER",_[_.DEPTH_STENCIL_TEXTURE=4]="DEPTH_STENCIL_TEXTURE"}(V||(V={}));const X=33984;var f,u;!function(_){_[_.Texture=0]="Texture",_[_.Buffer=1]="Buffer",_[_.VAO=2]="VAO",_[_.Shader=3]="Shader",_[_.Program=4]="Program",_[_.Framebuffer=5]="Framebuffer",_[_.Renderbuffer=6]="Renderbuffer",_[_.Sync=7]="Sync",_[_.COUNT=8]="COUNT"}(f||(f={})),function(_){_[_.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",_[_.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",_[_.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",_[_.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",_[_.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",_[_.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",_[_.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",_[_.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",_[_.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",_[_.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",_[_.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",_[_.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",_[_.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",_[_.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",_[_.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",_[_.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15"}(u||(u={}));const o=33306;var t,c,i,W,r,e,x;!function(_){_[_.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",_[_.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",_[_.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",_[_.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",_[_.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",_[_.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",_[_.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",_[_.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",_[_.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",_[_.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",_[_.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",_[_.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",_[_.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",_[_.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC"}(t||(t={})),function(_){_[_.FLOAT=5126]="FLOAT",_[_.FLOAT_VEC2=35664]="FLOAT_VEC2",_[_.FLOAT_VEC3=35665]="FLOAT_VEC3",_[_.FLOAT_VEC4=35666]="FLOAT_VEC4",_[_.INT=5124]="INT",_[_.INT_VEC2=35667]="INT_VEC2",_[_.INT_VEC3=35668]="INT_VEC3",_[_.INT_VEC4=35669]="INT_VEC4",_[_.BOOL=35670]="BOOL",_[_.BOOL_VEC2=35671]="BOOL_VEC2",_[_.BOOL_VEC3=35672]="BOOL_VEC3",_[_.BOOL_VEC4=35673]="BOOL_VEC4",_[_.FLOAT_MAT2=35674]="FLOAT_MAT2",_[_.FLOAT_MAT3=35675]="FLOAT_MAT3",_[_.FLOAT_MAT4=35676]="FLOAT_MAT4",_[_.SAMPLER_2D=35678]="SAMPLER_2D",_[_.SAMPLER_CUBE=35680]="SAMPLER_CUBE",_[_.UNSIGNED_INT=5125]="UNSIGNED_INT",_[_.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",_[_.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",_[_.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",_[_.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",_[_.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",_[_.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",_[_.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",_[_.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",_[_.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",_[_.SAMPLER_3D=35679]="SAMPLER_3D",_[_.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",_[_.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",_[_.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",_[_.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",_[_.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",_[_.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",_[_.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",_[_.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",_[_.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",_[_.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",_[_.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",_[_.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY"}(c||(c={})),function(_){_[_.OBJECT_TYPE=37138]="OBJECT_TYPE",_[_.SYNC_CONDITION=37139]="SYNC_CONDITION",_[_.SYNC_STATUS=37140]="SYNC_STATUS",_[_.SYNC_FLAGS=37141]="SYNC_FLAGS"}(i||(i={})),function(_){_[_.UNSIGNALED=37144]="UNSIGNALED",_[_.SIGNALED=37145]="SIGNALED"}(W||(W={})),function(_){_[_.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",_[_.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",_[_.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",_[_.WAIT_FAILED=37149]="WAIT_FAILED"}(r||(r={})),function(_){_[_.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE"}(e||(e={})),function(_){_[_.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT"}(x||(x={}));export{X as BASE_TEXTURE_UNIT,R as BlendFactor,T as BlendOperation,A as BufferType,_ as ClearBufferBit,r as ClientWaitSyncStatus,u as ColorAttachment,I as CompareFunction,t as CompressedTextureFormat,S as CullMode,C as DataType,o as DepthStencilAttachment,V as DepthStencilTargetType,N as Face,n as FramebufferTarget,P as PixelFormat,G as PixelType,E as PrimitiveType,B as RenderbufferFormat,f as ResourceType,H as ShaderType,U as SizedPixelFormat,O as StencilOperation,e as SyncCondition,x as SyncFlag,i as SyncParameter,W as SyncStatus,Y as TargetType,L as TextureSamplingMode,M as TextureType,D as TextureWrapMode,c as UniformType,F as Usage};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Collection.js";import{HandleOwnerMixin as i}from"../../core/HandleOwner.js";import s from"../../core/Loadable.js";import{isSome as r}from"../../core/maybe.js";import{watch as a,on as o}from"../../core/reactiveUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{cast as c}from"../../core/accessorSupport/decorators/cast.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{i as l,l as m}from"../../chunks/pe.js";import{canProjectWithoutEngine as u}from"../../geometry/projection.js";import{equals as h}from"../../geometry/support/spatialReferenceUtils.js";import{contentEquals as v}from"../../support/basemapUtils.js";import{default3DCompatibility as d,default2DCompatibility as f}from"./support/basemapCompatibilityUtils.js";import y from"./support/BasemapGalleryItem.js";import b from"./support/LocalBasemapsSource.js";import w from"./support/PortalBasemapsSource.js";const j=t.ofType(y);function _(e){return e&&"esri.portal.Portal"===e.declaredClass}function B(e){return e&&!(e instanceof w)&&(!!e.portal||!!e.query)}function g(e){return e&&"basemaps"in e&&"state"in e&&"refresh"in e}let F=class extends(i(s)){constructor(e){super(e),this.items=new j,this.source=new w,this.view=null}initialize(){const e=()=>this._recreateItems();this.handles.add([a((()=>"ready"===this.state?this.compatibilityFunction:null),(()=>this._updateItems())),o((()=>{var e;return null==(e=this.source)?void 0:e.basemaps}),"change",e,{onListenerAdd:e})])}get activeBasemap(){var e,t,i;return null!=(e=null==(t=this.view)||null==(i=t.map)?void 0:i.basemap)?e:null}set activeBasemap(e){if(!this.view.map)return;if(!e)return this.view.map.basemap=e,void this._clearOverride("activeBasemap");const{spatialReference:t}=this.items.find((t=>t.basemap===e));if("spatialReferenceLocked"in this.view&&!this.view.spatialReferenceLocked){const i=this.view.spatialReference;if(r(t)&&!h(i,t)&&!u(this.view.spatialReference,t)&&!l())return this._override("activeBasemap",e),void m().then((()=>{this._get("activeBasemap")===e&&(this.view.map.basemap=e,this.view.spatialReference=t,this._clearOverride("activeBasemap"))}),(()=>{}));this.view.map.basemap=e,this._clearOverride("activeBasemap"),r(t)&&!h(this.view.spatialReference,t)&&(this.view.spatialReference=t)}else this.view.map.basemap=e,this._clearOverride("activeBasemap")}get compatibilityFunction(){if(void 0===this._get("compatibilityFunction")){var e;return"3d"===(null==(e=this.view)?void 0:e.type)?d:f}return this._get("compatibilityFunction")}set compatibilityFunction(e){this._set("compatibilityFunction",e)}castSource(e){return Array.isArray(e)||t.isCollection(e)?new b({basemaps:e}):_(e)?new w({portal:e}):B(e)?new w(e):g(e)?e:null}get state(){var e;return null!=(e=this.view)&&e.ready&&this.source?"ready":"disabled"}basemapEquals(e,t){return v(e,t)}refresh(){this._recreateItems()}load(e){return this.addResolvingPromise(s.isLoadable(this.source)?this.source.load(e):null),Promise.resolve(this)}_recreateItems(){var e;const t=null==(e=this.source)?void 0:e.basemaps,{view:i,compatibilityFunction:s}=this;this.items.removeAll().forEach((e=>e.destroy())),t&&this.items.addMany(t.map((e=>new y({basemap:e,compatibilityFunction:s,view:i}))))}_updateItems(){for(const e of this.items)e.compatibilityFunction=this.compatibilityFunction,e.view=this.view}};e([p()],F.prototype,"activeBasemap",null),e([p()],F.prototype,"compatibilityFunction",null),e([p({readOnly:!0,type:j})],F.prototype,"items",void 0),e([p()],F.prototype,"source",void 0),e([c("source")],F.prototype,"castSource",null),e([p({readOnly:!0})],F.prototype,"state",null),e([p()],F.prototype,"view",void 0),F=e([n("esri.widgets.BasemapGallery.BasemapGalleryViewModel")],F);const R=F;export{R as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Collection.js";import{HandleOwnerMixin as i}from"../../core/HandleOwner.js";import s from"../../core/Loadable.js";import{isSome as r}from"../../core/maybe.js";import{watch as a,on as o}from"../../core/reactiveUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{cast as c}from"../../core/accessorSupport/decorators/cast.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{canProjectWithoutEngine as l,isLoaded as m,load as u}from"../../geometry/projection.js";import{equals as h}from"../../geometry/support/spatialReferenceUtils.js";import{contentEquals as v}from"../../support/basemapUtils.js";import{default3DCompatibility as d,default2DCompatibility as f}from"./support/basemapCompatibilityUtils.js";import y from"./support/BasemapGalleryItem.js";import b from"./support/LocalBasemapsSource.js";import w from"./support/PortalBasemapsSource.js";const j=t.ofType(y);function _(e){return e&&"esri.portal.Portal"===e.declaredClass}function B(e){return e&&!(e instanceof w)&&(!!e.portal||!!e.query)}function g(e){return e&&"basemaps"in e&&"state"in e&&"refresh"in e}let F=class extends(i(s)){constructor(e){super(e),this.items=new j,this.source=new w,this.view=null}initialize(){const e=()=>this._recreateItems();this.handles.add([a((()=>"ready"===this.state?this.compatibilityFunction:null),(()=>this._updateItems())),o((()=>{var e;return null==(e=this.source)?void 0:e.basemaps}),"change",e,{onListenerAdd:e})])}get activeBasemap(){var e,t,i;return null!=(e=null==(t=this.view)||null==(i=t.map)?void 0:i.basemap)?e:null}set activeBasemap(e){if(!this.view.map)return;if(!e)return this.view.map.basemap=e,void this._clearOverride("activeBasemap");const{spatialReference:t}=this.items.find((t=>t.basemap===e));if("spatialReferenceLocked"in this.view&&!this.view.spatialReferenceLocked){const i=this.view.spatialReference;if(r(t)&&!h(i,t)&&!l(this.view.spatialReference,t)&&!m())return this._override("activeBasemap",e),void u().then((()=>{this._get("activeBasemap")===e&&(this.view.map.basemap=e,this.view.spatialReference=t,this._clearOverride("activeBasemap"))}),(()=>{}));this.view.map.basemap=e,this._clearOverride("activeBasemap"),r(t)&&!h(this.view.spatialReference,t)&&(this.view.spatialReference=t)}else this.view.map.basemap=e,this._clearOverride("activeBasemap")}get compatibilityFunction(){if(void 0===this._get("compatibilityFunction")){var e;return"3d"===(null==(e=this.view)?void 0:e.type)?d:f}return this._get("compatibilityFunction")}set compatibilityFunction(e){this._set("compatibilityFunction",e)}castSource(e){return Array.isArray(e)||t.isCollection(e)?new b({basemaps:e}):_(e)?new w({portal:e}):B(e)?new w(e):g(e)?e:null}get state(){var e;return null!=(e=this.view)&&e.ready&&this.source?"ready":"disabled"}basemapEquals(e,t){return v(e,t)}refresh(){this._recreateItems()}load(e){return this.addResolvingPromise(s.isLoadable(this.source)?this.source.load(e):null),Promise.resolve(this)}_recreateItems(){var e;const t=null==(e=this.source)?void 0:e.basemaps,{view:i,compatibilityFunction:s}=this;this.items.removeAll().forEach((e=>e.destroy())),t&&this.items.addMany(t.map((e=>new y({basemap:e,compatibilityFunction:s,view:i}))))}_updateItems(){for(const e of this.items)e.compatibilityFunction=this.compatibilityFunction,e.view=this.view}};e([p()],F.prototype,"activeBasemap",null),e([p()],F.prototype,"compatibilityFunction",null),e([p({readOnly:!0,type:j})],F.prototype,"items",void 0),e([p()],F.prototype,"source",void 0),e([c("source")],F.prototype,"castSource",null),e([p({readOnly:!0})],F.prototype,"state",null),e([p()],F.prototype,"view",void 0),F=e([n("esri.widgets.BasemapGallery.BasemapGalleryViewModel")],F);const R=F;export{R as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{HandleOwnerMixin as r}from"../../../core/HandleOwner.js";import{isAbortError as s}from"../../../core/promiseUtils.js";import{watch as a,whenOnce as i}from"../../../core/reactiveUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";let n=class extends(r(t)){constructor(e){super(e),this.compatibilityFunction=null,this.error=null,this.state="loading",this.view=null}initialize(){const e=()=>this.refresh();this.handles.add([a((()=>{var e;return null==(e=this.basemap)?void 0:e.loadStatus}),e),a((()=>this.compatibilityFunction),e),a((()=>{var e;return this.view&&"basemapTerrain"in this.view&&(null==(e=this.view.basemapTerrain)?void 0:e.tilingScheme)}),e),a((()=>{var e;return null==(e=this.view)?void 0:e.ready}),e),a((()=>{var e;return null==(e=this.view)?void 0:e.spatialReference}),e)]),this.refresh()}destroy(){this._cancelRefresh(),this.basemap=null,this.compatibilityFunction=null,this.view=null}set basemap(e){const t=this._get("basemap");t&&t.cancelLoad(),e&&e.load().catch((()=>{})),this._set("basemap",e)}get spatialReference(){return this.spatialReferenceTask.spatialReference}get spatialReferenceTask(){var e,t;const{basemap:r,view:s}=this;if(!r||!s)return{spatialReference:null,updating:!1};if("not-loaded"===r.loadStatus)return r.load(),{spatialReference:null,updating:!0};if(r.spatialReference)return{spatialReference:r.spatialReference,updating:!1};if(0===r.baseLayers.length)return{spatialReference:null,updating:!1};const a=r.baseLayers.getItemAt(0);if("not-loaded"===a.loadStatus)return a.load(),{spatialReference:null,updating:!0};const i=(("supportedSpatialReferences"in a?a.supportedSpatialReferences:null)||["tileInfo"in a?a.tileInfo.spatialReference:a.spatialReference]).filter(Boolean);return{spatialReference:null!=(e=null!=(t=i.find((e=>s.spatialReference.equals(e))))?t:i[0])?e:null,updating:!1}}refresh(){var e;this._cancelRefresh(),this._set("state","loading");const t=null==(e=this.basemap)?void 0:e.loadStatus;if("loaded"!==t&&"failed"!==t)return;if(!this.compatibilityFunction)return void("loaded"===t?(this._set("state","ready"),this._set("error",null)):(this._set("state","error"),this._set("error",this.basemap.loadError)));const r=new AbortController,{signal:a}=r;this.compatibilityFunction(this,{signal:a}).then((()=>i((()=>!this.spatialReferenceTask.updating),a))).then((()=>{this._set("state","ready"),this._set("error",null)})).catch((e=>{s(e)||(this._set("state","error"),this._set("error",e))})),this._refreshController=r}_cancelRefresh(){this._refreshController&&(this._refreshController.abort(),this._refreshController=null)}};e([l()],n.prototype,"basemap",null),e([l()],n.prototype,"compatibilityFunction",void 0),e([l({readOnly:!0})],n.prototype,"error",void 0),e([l({readOnly:!0})],n.prototype,"spatialReference",null),e([l({readOnly:!0})],n.prototype,"spatialReferenceTask",null),e([l({readOnly:!0})],n.prototype,"state",void 0),e([l()],n.prototype,"view",void 0),n=e([o("esri.widgets.BasemapGallery.support.BasemapGalleryItem")],n);const p=n;export{p as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{HandleOwnerMixin as r}from"../../../core/HandleOwner.js";import{isAbortError as s}from"../../../core/promiseUtils.js";import{watch as i,whenOnce as o}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{findSpatialReference as n}from"../../../support/basemapUtils.js";let p=class extends(r(t)){constructor(e){super(e),this.compatibilityFunction=null,this.error=null,this.state="loading",this.view=null}initialize(){const e=()=>this.refresh();this.handles.add([i((()=>{var e;return null==(e=this.basemap)?void 0:e.loadStatus}),e),i((()=>this.compatibilityFunction),e),i((()=>{var e;return this.view&&"basemapTerrain"in this.view&&(null==(e=this.view.basemapTerrain)?void 0:e.tilingScheme)}),e),i((()=>{var e;return null==(e=this.view)?void 0:e.ready}),e),i((()=>{var e;return null==(e=this.view)?void 0:e.spatialReference}),e)]),this.refresh()}destroy(){this._cancelRefresh(),this.basemap=null,this.compatibilityFunction=null,this.view=null}get _spatialReferenceTask(){return n(this.view,this.basemap)}set basemap(e){const t=this._get("basemap");t&&t.cancelLoad(),e&&e.load().catch((()=>{})),this._set("basemap",e)}get spatialReference(){return this._spatialReferenceTask.spatialReference}refresh(){var e;this._cancelRefresh(),this._set("state","loading");const t=null==(e=this.basemap)?void 0:e.loadStatus;if("loaded"!==t&&"failed"!==t)return;if(!this.compatibilityFunction)return void("loaded"===t?(this._set("state","ready"),this._set("error",null)):(this._set("state","error"),this._set("error",this.basemap.loadError)));const r=new AbortController,{signal:i}=r;this.compatibilityFunction(this,{signal:i}).then((()=>o((()=>!this._spatialReferenceTask.updating),i))).then((()=>{this._set("state","ready"),this._set("error",null)})).catch((e=>{s(e)||(this._set("state","error"),this._set("error",e))})),this._refreshController=r}_cancelRefresh(){this._refreshController&&(this._refreshController.abort(),this._refreshController=null)}};e([a({readOnly:!0})],p.prototype,"_spatialReferenceTask",null),e([a()],p.prototype,"basemap",null),e([a()],p.prototype,"compatibilityFunction",void 0),e([a({readOnly:!0})],p.prototype,"error",void 0),e([a({readOnly:!0})],p.prototype,"spatialReference",null),e([a({readOnly:!0})],p.prototype,"state",void 0),e([a()],p.prototype,"view",void 0),p=e([l("esri.widgets.BasemapGallery.support.BasemapGalleryItem")],p);const c=p;export{c as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import{typeCast as e}from"../../core/compilerUtils.js";import s from"../../core/Evented.js";import{init as a}from"../../core/watchUtils.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{cast as o}from"../../core/accessorSupport/decorators/cast.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{esriBasemapDefinitions as p}from"../../support/basemapDefinitions.js";import{ensureType as l,destroyCache as m,getWellKnownBasemapId as c}from"../../support/basemapUtils.js";let n=class extends s.EventedAccessor{constructor(t){super(t),this._basemapCache={},this.nextBasemap=l("hybrid",this._basemapCache),this.view=null,this.toggle=this.toggle.bind(this)}initialize(){a(this,"nextBasemap",(t=>{t&&!t.loaded&&t.load().catch((()=>{}))}))}destroy(){this.view=null,m(this._basemapCache),this._basemapCache=null}get activeBasemap(){return l(this.get("view.map.basemap")||"topo",this._basemapCache)}castNextBasemap(t){return l(t,this._basemapCache)}get state(){return this.get("view.ready")?"ready":"disabled"}toggle(){if("disabled"===this.state)return;const t=this.activeBasemap,e=this.nextBasemap;this.view.map.basemap=e,this.nextBasemap=t,this.emit("toggle",{previous:t,current:e})}static getThumbnailUrl(t){if(!t)return null;const{thumbnailUrl:s}=t;if(s)return s;const a=c(t);if(a)return p[a].thumbnailUrl;const r=t.baseLayers.find((t=>!!e(t)().get("portalItem.thumbnailUrl")));return r?e(r)().get("portalItem.thumbnailUrl"):null}};t([r({readOnly:!0})],n.prototype,"activeBasemap",null),t([r()],n.prototype,"nextBasemap",void 0),t([o("nextBasemap")],n.prototype,"castNextBasemap",null),t([r({readOnly:!0})],n.prototype,"state",null),t([r()],n.prototype,"view",void 0),t([r()],n.prototype,"toggle",null),n=t([i("esri.widgets.BasemapToggle.BasemapToggleViewModel")],n);const h=n;export{h as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{typeCast as t}from"../../core/compilerUtils.js";import a from"../../core/Evented.js";import{isSome as s}from"../../core/maybe.js";import{watch as i,whenOnce as r,initial as p}from"../../core/reactiveUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{cast as n}from"../../core/accessorSupport/decorators/cast.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import{isLoaded as m,canProjectWithoutEngine as c,load as h}from"../../geometry/projection.js";import{equals as u}from"../../geometry/support/spatialReferenceUtils.js";import{esriBasemapDefinitions as f}from"../../support/basemapDefinitions.js";import{ensureType as d,destroyCache as v,findSpatialReference as B,getWellKnownBasemapId as g}from"../../support/basemapUtils.js";let b=class extends a.EventedAccessor{constructor(e){super(e),this._basemapCache={},this.nextBasemap=d("hybrid",this._basemapCache),this.view=null,this.toggle=this.toggle.bind(this)}initialize(){i((()=>this.nextBasemap),(e=>{e&&!e.loaded&&e.load().catch((()=>{}))}),p)}destroy(){this.view=null,v(this._basemapCache),this._basemapCache=null}get _nextBasemapSpatialReferenceTask(){return B(this.view,this.nextBasemap)}get activeBasemap(){var e,t,a;return d(null!=(e=null==(t=this.view)||null==(a=t.map)?void 0:a.basemap)?e:"topo",this._basemapCache)}castNextBasemap(e){return d(e,this._basemapCache)}get state(){var e;return null!=(e=this.view)&&e.ready?"ready":"disabled"}async toggle(){if("disabled"===this.state)return;const{activeBasemap:e,nextBasemap:t}=this,a=!("spatialReferenceLocked"in this.view)||this.view.spatialReferenceLocked;if(!a){if(await r((()=>!this._nextBasemapSpatialReferenceTask.updating)),t!==this.nextBasemap||e!==this.activeBasemap)return;const{spatialReference:a}=this._nextBasemapSpatialReferenceTask;if(!s(a)||u(this.view.spatialReference,a)||m()||c(this.view.spatialReference,a)||await h(),t!==this.nextBasemap||e!==this.activeBasemap)return}this.view.map.basemap=t,a||!s(this._nextBasemapSpatialReferenceTask.spatialReference)||u(this.view.spatialReference,this._nextBasemapSpatialReferenceTask.spatialReference)||(this.view.spatialReference=this._nextBasemapSpatialReferenceTask.spatialReference),this.nextBasemap=e,this.emit("toggle",{previous:e,current:t})}static getThumbnailUrl(e){if(!e)return null;const{thumbnailUrl:a}=e;if(a)return a;const s=g(e);if(s)return f[s].thumbnailUrl;const i=e.baseLayers.find((e=>!!t(e)().get("portalItem.thumbnailUrl")));return i?t(i)().get("portalItem.thumbnailUrl"):null}};e([o({readOnly:!0})],b.prototype,"_nextBasemapSpatialReferenceTask",null),e([o({readOnly:!0})],b.prototype,"activeBasemap",null),e([o()],b.prototype,"nextBasemap",void 0),e([n("nextBasemap")],b.prototype,"castNextBasemap",null),e([o({readOnly:!0})],b.prototype,"state",null),e([o()],b.prototype,"view",void 0),e([o()],b.prototype,"toggle",null),b=e([l("esri.widgets.BasemapToggle.BasemapToggleViewModel")],b);const y=b;export{y as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{aliasOf as s}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import{cast as t}from"../core/accessorSupport/decorators/cast.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import i from"./Widget.js";import r from"./BasemapToggle/BasemapToggleViewModel.js";import{accessibleHandler as l}from"./support/decorators/accessibleHandler.js";import{messageBundle as p}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{vmEvent as m}from"./support/decorators/vmEvent.js";import{tsx as n}from"./support/jsxFactory.js";import"./support/widgetUtils.js";const g={base:"esri-basemap-toggle esri-widget",secondaryBasemapImage:"esri-basemap-toggle__image--secondary",container:"esri-basemap-thumbnail esri-basemap-toggle__container",image:"esri-basemap-thumbnail__image esri-basemap-toggle__image",imageLoading:"esri-basemap-toggle__image--loading",overlay:"esri-basemap-thumbnail__overlay esri-basemap-toggle__image-overlay",title:"esri-basemap-thumbnail__title esri-basemap-toggle__title",disabled:"esri-disabled",loaderAnimation:"esri-widget__loader-animation"};function d(e){const s=r.getThumbnailUrl(e);return s?{backgroundImage:"url("+s+")"}:{backgroundImage:""}}const c={title:!1};let b=class extends i{constructor(e,s){super(e,s),this.activeBasemap=null,this.label=void 0,this.messages=null,this.nextBasemap=null,this.view=null,this.viewModel=new r,this.visibleElements={...c}}castVisibleElements(e){return{...c,...e}}toggle(){}render(){const e=this.viewModel,s="disabled"===e.state?null:e.activeBasemap,t="disabled"===e.state?null:e.nextBasemap,a=t?t.title:"",o=t&&"loaded"!==t.loadStatus;let i;return this.visibleElements.title&&a&&(i=n("div",{class:g.overlay,key:"esri-basemap-toggle__overlay"},n("span",{class:g.title,title:a},a))),n("div",{class:g.base,role:"button","data-basemap-id":t?t.id:"",bind:this,onclick:this._toggle,onkeydown:this._toggle,tabIndex:0,title:this.label},n("div",{class:this.classes(g.container,g.secondaryBasemapImage)},n("div",{class:g.image,styles:d(s)})),n("div",{class:g.container},n("div",{class:this.classes(g.image,o?g.imageLoading:null),styles:d(t)},o?n("span",{"aria-hidden":"true",role:"presentation",class:g.loaderAnimation}):null),i))}_toggle(){this.toggle()}};e([s("viewModel.activeBasemap")],b.prototype,"activeBasemap",void 0),e([a({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],b.prototype,"label",void 0),e([a(),p("esri/widgets/BasemapToggle/t9n/BasemapToggle")],b.prototype,"messages",void 0),e([s("viewModel.nextBasemap")],b.prototype,"nextBasemap",void 0),e([s("viewModel.view")],b.prototype,"view",void 0),e([m("toggle"),a({type:r})],b.prototype,"viewModel",void 0),e([a()],b.prototype,"visibleElements",void 0),e([t("visibleElements")],b.prototype,"castVisibleElements",null),e([s("viewModel.toggle")],b.prototype,"toggle",null),e([l()],b.prototype,"_toggle",null),b=e([o("esri.widgets.BasemapToggle")],b);const u=b;export{u as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{aliasOf as s}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import{cast as t}from"../core/accessorSupport/decorators/cast.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import i from"./Widget.js";import r from"./BasemapToggle/BasemapToggleViewModel.js";import{accessibleHandler as l}from"./support/decorators/accessibleHandler.js";import{messageBundle as p}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{vmEvent as m}from"./support/decorators/vmEvent.js";import{tsx as n}from"./support/jsxFactory.js";import"./support/widgetUtils.js";const g={base:"esri-basemap-toggle esri-widget",secondaryBasemapImage:"esri-basemap-toggle__image--secondary",container:"esri-basemap-thumbnail esri-basemap-toggle__container",image:"esri-basemap-thumbnail__image esri-basemap-toggle__image",imageLoading:"esri-basemap-toggle__image--loading",overlay:"esri-basemap-thumbnail__overlay esri-basemap-toggle__image-overlay",title:"esri-basemap-thumbnail__title esri-basemap-toggle__title",disabled:"esri-disabled",loaderAnimation:"esri-widget__loader-animation"};function d(e){const s=r.getThumbnailUrl(e);return s?{backgroundImage:"url("+s+")"}:{backgroundImage:""}}const c={title:!1};let u=class extends i{constructor(e,s){super(e,s),this.activeBasemap=null,this.label=void 0,this.messages=null,this.nextBasemap=null,this.view=null,this.viewModel=new r,this.visibleElements={...c}}castVisibleElements(e){return{...c,...e}}toggle(){return null}render(){const e=this.viewModel,s="disabled"===e.state?null:e.activeBasemap,t="disabled"===e.state?null:e.nextBasemap,a=t?t.title:"",o=t&&"loaded"!==t.loadStatus;let i;return this.visibleElements.title&&a&&(i=n("div",{class:g.overlay,key:"esri-basemap-toggle__overlay"},n("span",{class:g.title,title:a},a))),n("div",{class:g.base,role:"button","data-basemap-id":t?t.id:"",bind:this,onclick:this._toggle,onkeydown:this._toggle,tabIndex:0,title:this.label},n("div",{class:this.classes(g.container,g.secondaryBasemapImage)},n("div",{class:g.image,styles:d(s)})),n("div",{class:g.container},n("div",{class:this.classes(g.image,o?g.imageLoading:null),styles:d(t)},o?n("span",{"aria-hidden":"true",role:"presentation",class:g.loaderAnimation}):null),i))}_toggle(){this.toggle()}};e([s("viewModel.activeBasemap")],u.prototype,"activeBasemap",void 0),e([a({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],u.prototype,"label",void 0),e([a(),p("esri/widgets/BasemapToggle/t9n/BasemapToggle")],u.prototype,"messages",void 0),e([s("viewModel.nextBasemap")],u.prototype,"nextBasemap",void 0),e([s("viewModel.view")],u.prototype,"view",void 0),e([m("toggle"),a({type:r})],u.prototype,"viewModel",void 0),e([a()],u.prototype,"visibleElements",void 0),e([t("visibleElements")],u.prototype,"castVisibleElements",null),e([s("viewModel.toggle")],u.prototype,"toggle",null),e([l()],u.prototype,"_toggle",null),u=e([o("esri.widgets.BasemapToggle")],u);const b=u;export{b as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{getAssetUrl as e}from"../../../assets.js";import{isNone as t}from"../../../core/maybe.js";const n="esri-directions",r={base:`${n} esri-widget esri-widget--panel`,directionsButton:`${n}__button`,clearRouteButton:`${n}__clear-route-button`,scroller:`${n}__scroller`,panelContent:`${n}__panel-content`,panelContentLoading:`${n}__panel-content--loading`,panelContentError:`${n}__panel-content--error`,panelContentSignIn:`${n}__panel-content--sign-in`,loader:`${n}__loader`,message:`${n}__message`,travelModeSelect:`${n}__travel-modes-select`,departureTime:`${n}__departure-time`,departureTimeSelect:`${n}__departure-time-select`,directionsSection:`${n}__directions-section`,departureTimeControls:`${n}__departure-time-controls`,section:`${n}__section`,summary:`${n}__summary`,stopIcon:`${n}__stop-icon`,interactiveStopIcon:`${n}__stop-icon--interactive`,removeStopButton:`${n}__remove-stop`,removeStop:`${n}__remove-stop-icon`,reverseStops:`${n}__reverse-stops`,stopIconContainer:`${n}__stop-icon-container`,lastStopIconContainer:`${n}__stop-icon-container--last`,stopHandle:`${n}__stop-handle`,stopInput:`${n}__stop-input`,stopOptions:`${n}__stop-options`,stopHandleIcon:`${n}__stop-handle-icon`,verticalSplitter:`${n}__vertical-splitter`,stopRow:`${n}__stop-row`,stopRowGhost:`${n}__stop-row-ghost`,validStopRow:`${n}__stop-row--valid`,stops:`${n}__stops`,addStop:`${n}__add-stop`,addStopText:`${n}__add-stop-text`,directionCosts:`${n}__costs`,costsDetails:`${n}__costs-details`,primaryCosts:`${n}__costs-value`,secondaryCosts:`${n}__other-costs-total`,routeActions:`${n}__route-actions`,maneuvers:`${n}__maneuvers`,maneuverList:`${n}__maneuver-list`,maneuverSection:`${n}__maneuver-section`,maneuverSectionHeader:`${n}__maneuver-section-header`,maneuverSectionHeaderButton:`${n}__maneuver-section-header-toggle-button`,maneuverSectionTitle:`${n}__maneuver-section-title`,collapsibleSection:`${n}__maneuver-section--collapsible`,maneuverSectionToggle:`${n}__maneuver-section-toggle`,maneuver:`${n}__maneuver`,maneuverActive:`${n}__maneuver--active`,maneuverCosts:`${n}__maneuver-costs`,maneuverCostsContainer:`${n}__maneuver-costs-container`,maneuverIcon:`${n}__maneuver-icon`,cumulativeCost:`${n}__cost--cumulative`,intermediateCost:`${n}__cost--intermediate`,horizontalSplitter:`${n}__horizontal-splitter`,sectionSplitter:`${n}__section-splitter`,disclaimer:`${n}__disclaimer`,signInContent:`${n}__sign-in-content`,signInButton:`${n}__sign-in-button`,contentTitle:`${n}__content-title`,warningCard:`${n}__warning-card`,warningHeader:`${n}__warning-header`,warningHeading:`${n}__warning-heading`,warningMessage:`${n}__warning-message`,stopsIcon:"esri-icon-radio-unchecked",lastStopIcon:"esri-icon-radio-checked",handleIcon:"esri-icon-handle-vertical",addStopIcon:"esri-icon-plus",removeStopIcon:"esri-icon-trash",reverseStopIcon:"esri-icon-up-down-arrows",openIcon:"esri-icon-down",closeIcon:"esri-icon-up",warningIcon:"esri-icon-notice-triangle",widgetIcon:"esri-icon-directions",anchor:"esri-widget__anchor",button:"esri-button",buttonSecondary:"esri-button--secondary",buttonTertiary:"esri-button--tertiary",emptyContent:"esri-widget__content--empty",emptyIllustration:"esri-widget__content-illustration--empty",select:"esri-select",screenReaderText:"esri-icon-font-fallback-text"},o=new Map([["bear-left","bear-left"],["bear-right","bear-right"],["central-fork","fork-middle"],["door","walk-through-door"],["elevator","elevator"],["escalator","escalator"],["left-fork","fork-left"],["left-ramp","ramp-left"],["left-turn","left"],["left-turn-and-immediate-left-turn","left-left"],["left-turn-and-immediate-right-turn","left-right"],["off-ferry","disembark"],["on-ferry","embark"],["pedestrian-ramp","take-pedestrian-ramp"],["right-fork","fork-right"],["right-ramp","exit-highway-right"],["right-ramp","ramp-right"],["right-turn","right"],["right-turn-and-immediate-left-turn","right-left"],["right-turn-and-immediate-right-turn","right-right"],["roundabout","roundabout-left"],["sharp-left","sharp-left"],["sharp-right","sharp-right"],["stairs","stairs"],["straight","straight"],["u-turn","u-turn-left"]]);var i;!function(e){e.NOW="now",e.DEPART_BY="depart-by",e.UNSPECIFIED="unspecified"}(i||(i={}));const a=()=>e("esri/themes/base/images/maneuvers/");function s(e){if(t(e)||!o.has(e))return null;const n=o.get(e),r=2===window.devicePixelRatio?"@2x":"";return`${a()}${n}${r}.png`}export{r as CSS,i as DepartureTime,s as getIconPath,a as getManeuversIconDir};
5
+ import{getAssetUrl as e}from"../../../assets.js";import{isNone as t}from"../../../core/maybe.js";const n="esri-directions",r={base:`${n} esri-widget esri-widget--panel`,directionsButton:`${n}__button`,clearRouteButton:`${n}__clear-route-button`,scroller:`${n}__scroller`,panelContent:`${n}__panel-content`,panelContentLoading:`${n}__panel-content--loading`,panelContentError:`${n}__panel-content--error`,panelContentSignIn:`${n}__panel-content--sign-in`,loader:`${n}__loader`,message:`${n}__message`,travelModeSelect:`${n}__travel-modes-select`,departureTime:`${n}__departure-time`,departureTimeSelect:`${n}__departure-time-select`,directionsSection:`${n}__directions-section`,departureTimeControls:`${n}__departure-time-controls`,section:`${n}__section`,summary:`${n}__summary`,stopIcon:`${n}__stop-icon`,interactiveStopIcon:`${n}__stop-icon--interactive`,removeStopButton:`${n}__remove-stop`,removeStop:`${n}__remove-stop-icon`,reverseStops:`${n}__reverse-stops`,stopIconContainer:`${n}__stop-icon-container`,lastStopIconContainer:`${n}__stop-icon-container--last`,stopHandle:`${n}__stop-handle`,stopInput:`${n}__stop-input`,stopOptions:`${n}__stop-options`,stopHandleIcon:`${n}__stop-handle-icon`,verticalSplitter:`${n}__vertical-splitter`,stopRow:`${n}__stop-row`,stopRowGhost:`${n}__stop-row-ghost`,validStopRow:`${n}__stop-row--valid`,stops:`${n}__stops`,addStop:`${n}__add-stop`,addStopText:`${n}__add-stop-text`,directionCosts:`${n}__costs`,costsDetails:`${n}__costs-details`,primaryCosts:`${n}__costs-value`,secondaryCosts:`${n}__other-costs-total`,routeActions:`${n}__route-actions`,maneuvers:`${n}__maneuvers`,maneuverList:`${n}__maneuver-list`,maneuverSection:`${n}__maneuver-section`,maneuverSectionHeader:`${n}__maneuver-section-header`,maneuverSectionHeaderButton:`${n}__maneuver-section-header-toggle-button`,maneuverSectionTitle:`${n}__maneuver-section-title`,collapsibleSection:`${n}__maneuver-section--collapsible`,maneuverSectionToggle:`${n}__maneuver-section-toggle`,maneuver:`${n}__maneuver`,maneuverActive:`${n}__maneuver--active`,maneuverCosts:`${n}__maneuver-costs`,maneuverCostsContainer:`${n}__maneuver-costs-container`,maneuverIcon:`${n}__maneuver-icon`,cumulativeCost:`${n}__cost--cumulative`,intermediateCost:`${n}__cost--intermediate`,horizontalSplitter:`${n}__horizontal-splitter`,sectionSplitter:`${n}__section-splitter`,disclaimer:`${n}__disclaimer`,signInContent:`${n}__sign-in-content`,signInButton:`${n}__sign-in-button`,contentTitle:`${n}__content-title`,warningCard:`${n}__warning-card`,warningHeader:`${n}__warning-header`,warningHeading:`${n}__warning-heading`,warningMessage:`${n}__warning-message`,stopsIcon:"esri-icon-radio-unchecked",lastStopIcon:"esri-icon-radio-checked",handleIcon:"esri-icon-handle-vertical",addStopIcon:"esri-icon-plus",removeStopIcon:"esri-icon-trash",reverseStopIcon:"esri-icon-up-down-arrows",openIcon:"esri-icon-down",closeIcon:"esri-icon-up",warningIcon:"esri-icon-notice-triangle",widgetIcon:"esri-icon-directions",button:"esri-button",buttonSecondary:"esri-button--secondary",buttonTertiary:"esri-button--tertiary",emptyContent:"esri-widget__content--empty",emptyIllustration:"esri-widget__content-illustration--empty",select:"esri-select",screenReaderText:"esri-icon-font-fallback-text"},o=new Map([["bear-left","bear-left"],["bear-right","bear-right"],["central-fork","fork-middle"],["door","walk-through-door"],["elevator","elevator"],["escalator","escalator"],["left-fork","fork-left"],["left-ramp","ramp-left"],["left-turn","left"],["left-turn-and-immediate-left-turn","left-left"],["left-turn-and-immediate-right-turn","left-right"],["off-ferry","disembark"],["on-ferry","embark"],["pedestrian-ramp","take-pedestrian-ramp"],["right-fork","fork-right"],["right-ramp","exit-highway-right"],["right-ramp","ramp-right"],["right-turn","right"],["right-turn-and-immediate-left-turn","right-left"],["right-turn-and-immediate-right-turn","right-right"],["roundabout","roundabout-left"],["sharp-left","sharp-left"],["sharp-right","sharp-right"],["stairs","stairs"],["straight","straight"],["u-turn","u-turn-left"]]);var i;!function(e){e.NOW="now",e.DEPART_BY="depart-by",e.UNSPECIFIED="unspecified"}(i||(i={}));const a=()=>e("esri/themes/base/images/maneuvers/");function s(e){if(t(e)||!o.has(e))return null;const n=o.get(e),r=2===window.devicePixelRatio?"@2x":"";return`${a()}${n}${r}.png`}export{r as CSS,i as DepartureTime,s as getIconPath,a as getManeuversIconDir};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import"../intl.js";import s from"../core/Collection.js";import{on as i,pausable as o}from"../core/events.js";import r from"../core/Handles.js";import{isSome as n,isNone as a,unwrap as l,unwrapOrValue as c}from"../core/maybe.js";import{watch as d,initial as h,when as u,on as p}from"../core/reactiveUtils.js";import{aliasOf as m}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as v}from"../core/accessorSupport/decorators/property.js";import{subclass as _}from"../core/accessorSupport/decorators/subclass.js";import g from"../rest/support/Stop.js";import S from"./Search.js";import w from"./Widget.js";import y from"./Directions/DirectionsViewModel.js";import{formatDistance as b,formatTime as M,isTimeUnits as f}from"./Directions/support/directionsUtils.js";import{DepartureTime as T,CSS as C,getIconPath as I}from"./Directions/support/resources.js";import{isArcGISWorldGeocoder as k,meteredArcGISLocatorUrl as R}from"./Search/support/locatorUtils.js";import D from"./support/DatePicker.js";import{Heading as P,incrementHeadingLevel as j}from"./support/Heading.js";import x from"./support/TimePicker.js";import{accessibleHandler as H}from"./support/decorators/accessibleHandler.js";import{messageBundle as U}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{tsx as L}from"./support/jsxFactory.js";import"./support/widgetUtils.js";import A from"sortablejs";import{substitute as z}from"../intl/substitute.js";import{formatDate as E,convertDateFormatToIntlOptions as O}from"../intl/date.js";import{formatNumber as $}from"../intl/number.js";function N(e){const t=e.getTimezoneOffset(),s=t>0?"-":"+",i=60,o=Math.abs(Math.floor(t/i)),r=Math.abs(Math.floor(t)%i),n={minimumIntegerDigits:2};return`GMT${s}${$(o,n)}${$(r,n)}`}function B(){return[{},{}]}function F(e){return e.results[0].results[0]}function V(e){return!(null==e.composedPath||!e.composedPath().find((e=>{var t;return null==(t=e.classList)?void 0:t.contains("esri-search__suggestions-list")})))}const W={awaitingViewClickStop:"awaiting-view-click-stop"},K=100,q=500;let Y=class extends w{constructor(e,t){super(e,t),this._autoStopRemovalDelay=K,this._departureTime=T.NOW,this._datePicker=new D,this._handles=new r,this._newPlaceholderStop=null,this._pointerPressedSearchSuggestionStop=null,this._sections=null,this._stops=new s(B()),this._stopsToSearches=new Map,this._timePicker=new x,this.apiKey=null,this.goToOverride=null,this.headingLevel=2,this.iconClass=C.widgetIcon,this.label=void 0,this.lastRoute=null,this.maxStops=null,this.messages=null,this.messagesCommon=null,this.messagesUnits=null,this.routeServiceUrl=void 0,this.routeSymbol=null,this.searchProperties=null,this.stopSymbols=null,this.view=null,this.viewModel=new y,this._setUpDragAndDropStops=e=>{this._sortable=A.create(e,{draggable:`.${C.validStopRow}`,ghostClass:C.stopRowGhost,handle:`.${C.stopHandle}`,onEnd:this._handleStopInputDragEnd})},this._handleDragHandlePointerDown=()=>this._stops.forEach((e=>this._acquireSearch(e).activeMenu="none")),this._handleStopInputDragEnd=({oldIndex:e,newIndex:t,target:s})=>{if(e===t)return;const{children:i}=s,o=i[t],r=i[e],n=t-e<0;s.insertBefore(o,n?r.nextElementSibling:r);const a=this._stops;a.reorder(a.getItemAt(e),t),this._processStops()}}initialize(){this.own([d((()=>this.viewModel.lastRoute),(()=>{this._activeManeuver=null,this._focusedManeuver=null,this._sections=this._getSections(),this.scheduleRender()}),h),d((()=>[this.viewModel.selectedTravelMode,this.viewModel.departureTime]),(()=>{this.viewModel.stops.length>1&&this.getDirections()}),h),u((()=>this.view),((e,t)=>{if(t&&(this._viewClickHandle=null,this._handles.remove(t)),e){const t=this._prepPointerDownUpClick(),s=this._prepViewClick();t.pause(),s.pause(),this._handles.add([i(e.surface,"mousedown",(()=>this._autoStopRemovalDelay=q)),i(e.surface,"mouseup",(()=>this._autoStopRemovalDelay=K)),t,s],this.view.surface),this._pointerDownUpHandle=t,this._viewClickHandle=s}}),h),u((()=>0===this.viewModel.stops.length),(()=>{this._stops.drain((e=>{this._disposeSearch(e)})),this._stops.addMany(B()),this.scheduleRender()}))])}destroy(){this._datePicker.destroy(),this._timePicker.destroy(),this._stopsToSearches.forEach((e=>e.destroy())),this._sortable&&this._sortable.destroy()}getDirections(){return null}zoomToRoute(){}render(){return L("div",{class:this.classes(C.base,C.scroller)},this._renderPanelContent())}_renderPanelContent(){const{viewModel:{state:e}}=this,t="initializing"===e,s="error"===e&&!this.viewModel.serviceDescription,i="unauthenticated"===e,o={[C.panelContentLoading]:t,[C.panelContentError]:s,[C.panelContentSignIn]:i},r=t?"presentation":"group",n=i?this._renderSignIn():s?this._renderMessage(this._getErrorMessage()):t?this._renderLoader():this._renderReadyContent();return L("div",{class:this.classes(C.panelContent,o),role:r},n)}_renderReadyContent(){return[this._renderStopsContainer(),this._renderTravelModeOptions(),this._renderDepartureTimeControls(),this._renderSectionSplitter(),this._renderDirectionsContainer(),this._renderDisclaimer()]}_renderSignIn(){return L("div",{key:"sign-in",class:C.signInContent},L(P,{class:C.contentTitle,level:this.headingLevel},this.messages.widgetLabel),this._renderPlaceholder(),L(P,{level:j(this.headingLevel)},this.messages.signInRequired),L("button",{class:this.classes(C.button,C.buttonSecondary,C.signInButton),tabIndex:0,onclick:this._handleSignInClick,bind:this,type:"button"},this.messagesCommon.auth.signIn))}_handleSignInClick(){this.viewModel.load().catch((()=>{}))}_renderTravelModeOptions(){const{selectedTravelMode:e,travelModes:t}=this.viewModel;if(0===t.length)return null;const s=n(e)?e.name:this.messages.travelMode;return L("select",{"aria-label":s,bind:this,class:this.classes(C.travelModeSelect,C.select),key:"esri-directions__travel-mode-options",onchange:this._handleTravelModeChange,title:s},t.map((t=>{const s=n(e)&&t.id===e.id;return L("option",{key:t,"data-mode":t,selected:s,value:t.id},t.name)})))}_handleTravelModeChange(e){const t=e.currentTarget,s=t.item(t.selectedIndex);this.viewModel.selectedTravelMode=s["data-mode"]}_renderStopsContainer(){return L("div",{class:C.section,key:"esri-directions__stops-container",role:"group"},this._renderStops())}_renderDepartureTimeControls(){const e=this._departureTime,{messages:t}=this,s=t.departureTime;return L("div",{class:C.departureTime,key:"esri-directions__departure-time-controls",role:"group"},L("select",{"aria-label":s,bind:this,class:this.classes(C.departureTimeSelect,C.select),onchange:this._handleDepartureOptionChange,title:s},L("option",{value:T.NOW,selected:e===T.NOW},t.leaveNow),L("option",{value:T.DEPART_BY,selected:e===T.DEPART_BY},t.departBy),L("option",{value:T.UNSPECIFIED,selected:e===T.UNSPECIFIED},t.timeUnspecified)),e===T.DEPART_BY?this._renderTimeControls():null)}_renderStops(){const e=this._stops;let t=0;e.forEach((e=>{"none"!==this._acquireSearch(e).activeMenu&&(t+=1)}));const s=e.toArray().map(((s,i)=>{const o=e.length,r=i>1&&!s.result,n={[C.stopsIcon]:i>=0&&i<o-1,[C.lastStopIcon]:i===o-1},a={[C.lastStopIconContainer]:i===o-1},l={[C.validStopRow]:!r},c=e.getItemAt(o-1),d=c&&c.result,h=e.getItemAt(i+1),u=h&&h.result,p=i===o-1,m=i===o-2,v=2===o&&0===i||o>2&&!p&&!m||o>2&&m&&u||o>2&&p&&!s.result,_=2===o||3===o&&!d||r,g=this._acquireSearch(s),{messages:S}=this,{removeStop:w,reverseStops:y,unlocated:b}=S,M=z(S.stopLabelTemplate,{number:i+1,label:s.result?s.result.name:b}),f=`${this.id}__stop--${i}`,T=!!g.searchTerm&&!!g.selectedResult&&!!s.result&&g.selectedResult===s.result,I={zIndex:"none"!==g.activeMenu?""+t--:""};return L("li",{"aria-label":M,afterCreate:this._handleStopFieldCreation,bind:this,class:this.classes(C.stopRow,l),id:f,key:i,"data-stop-index":i,styles:I},L("div",{class:C.stopHandle},L("span",{"aria-hidden":"true",class:this.classes(C.stopIcon,C.handleIcon,C.stopHandleIcon,C.interactiveStopIcon),onpointerdown:this._handleDragHandlePointerDown}),L("div",{bind:this,"aria-labelledby":f,class:this.classes(C.stopIconContainer,a),"data-stop-index":i,onclick:this._handleStopIconClick,onkeydown:this._handleStopIconClick,role:"button"},L("span",{class:this.classes(C.stopIcon,n),tabindex:T?"0":null}))),L("div",{class:C.stopInput},g.render()),L("div",{class:C.stopOptions,role:"group"},L("div",{"aria-label":w,class:C.removeStopButton,bind:this,"data-stop-index":i,hidden:_,onkeydown:this._handleRemoveStop,onclick:this._handleRemoveStop,role:"button",tabIndex:0,title:w},L("span",{"aria-hidden":"true",class:this.classes(C.stopIcon,C.removeStop,C.removeStopIcon,C.interactiveStopIcon)}),L("span",{class:C.screenReaderText},"removeStopTitle")),L("div",{"aria-label":y,class:C.reverseStops,bind:this,hidden:v,onkeydown:this._handleReverseStops,onclick:this._handleReverseStops,role:"button",tabIndex:0,title:y},L("span",{"aria-hidden":"true",class:this.classes(C.stopIcon,C.reverseStopIcon,C.interactiveStopIcon)}),L("span",{class:C.screenReaderText},"removeStopTitle"))))})),i=e.every((e=>{const t=this._stopsToSearches.get(e);return e.result&&t.selectedResult===e.result})),o=this._stops.length>=this.maxStops,r=this.messages.addStop,n=e.length>=2&&i&&!o?L("div",{"aria-label":r,bind:this,class:C.addStop,key:"esri-directions__add-stop",onfocus:this._handleAddStopFocus,tabIndex:0},L("span",{"aria-hidden":"true",class:this.classes(C.addStopIcon,C.stopIcon,C.interactiveStopIcon)}),L("div",{"aria-hidden":"true",class:C.addStopText},r)):null;return L("div",null,L("ol",{class:C.stops,role:"group",afterCreate:this._setUpDragAndDropStops},s),n)}_handleStopIconClick(e){const t=e.currentTarget["data-stop-index"],s=this._stops.getItemAt(t);s&&s.result&&this._centerAtStop(s)}_handleClearRouteClick(){this.viewModel.reset()}_centerAtStop(e){this.viewModel.centerAt(e.result.feature)}_handleStopFieldCreation(e){const t=this._newPlaceholderStop;if(!t)return;const s=e["data-stop-index"],i=this._stops.getItemAt(s);if(t===i){const e=this._acquireSearch(i);e.when((()=>{this.renderNow(),e.focus()}))}this._newPlaceholderStop=null}_handleStopInputBlur(e,t){this._handles.remove(W.awaitingViewClickStop),this.view.cursor=this._previousCursor;if(!e.selectedResult||!t.result||e.selectedResult!==t.result)return"none"!==e.activeMenu||!e.searchTerm||e.selectedResult===t.result&&(e.selectedResult||t.result)?void(e.searchTerm||(this._viewClickHandle.resume(),clearTimeout(this._autoStopRemovalTimeoutId),this._autoStopRemovalTimeoutId=setTimeout((()=>{if(this.destroyed)return;if(this._viewClickHandle.pause(),"searching"===e.viewModel.state)return void this._pointerDownUpHandle.pause();if(this._pointerPressedSearchSuggestionStop)return;this._removeStop(t);!!t.result&&(t.result=null,this._processStops()),this.scheduleRender()}),this._autoStopRemovalDelay))):(e.search(),void this._pointerDownUpHandle.pause());this._pointerDownUpHandle.pause()}_handleStopInputFocus(e,t){if(this._pointerDownUpHandle.resume(),this._handles.has(W.awaitingViewClickStop))return;const{view:s,view:{cursor:i}}=this;this._previousCursor=i,this._handles.add(d((()=>e.searchTerm),(e=>{s.cursor=0===e.length?"copy":i}),h),W.awaitingViewClickStop),this._activeStop=t}_prepViewClick(){const{view:e}=this.viewModel,t=o(e,"click",this._handleViewClick.bind(this)),s=o(e.surface,"click",(()=>{clearTimeout(this._autoStopRemovalTimeoutId),s.pause()}));return{remove(){s.remove(),t.remove()},pause(){s.pause(),t.pause()},resume(){s.resume(),t.resume()}}}_prepPointerDownUpClick(){const e=o(document,"pointerdown",(e=>{this._pointerPressedSearchSuggestionStop=V(e)?this._activeStop:null})),t=o(document,"pointerup",(e=>{this._pointerDownUpHandle.pause();const t=V(e),s=this._activeStop;t||s!==this._pointerPressedSearchSuggestionStop||this._removeStop(s),this.scheduleRender(),this._pointerPressedSearchSuggestionStop=t?this._activeStop:null}));return{remove(){t.remove(),e.remove()},pause(){t.pause(),e.pause()},resume(){e.resume()}}}_handleViewClick(e){const t=this._stopsToSearches.get(this._activeStop);t&&!t.searchTerm&&(t.search(e.mapPoint).then((e=>{const s=F(e),i=this._activeStop;i.result=s,i.result.feature.attributes.Name=s.name,t.searchTerm=s.name})),this.scheduleRender()),this._viewClickHandle.pause(),clearTimeout(this._autoStopRemovalTimeoutId)}_handleAddStopFocus(){this._addNewPlaceholder()}_addNewPlaceholder(){if(this._pointerDownUpHandle.pause(),this._newPlaceholderStop)return;const e={};this._stops.add(e),this._newPlaceholderStop=e}_handleReverseStops(){this._reverseStops()}_reverseStops(){this._stops.reverse(),this._processStops()}_handleRemoveStop(e){const t=e.currentTarget["data-stop-index"];this._removeStop(this._stops.getItemAt(t)),this._processStops()}_removeStop(e){this._stops.length<=2||(this._disposeSearch(e),this._stops.remove(e))}_handleDepartureOptionChange(e){const t=e.currentTarget,s=t.item(t.selectedIndex);s.value===T.NOW?(this._departureTime=T.NOW,this.viewModel.departureTime=T.NOW,this._handles.remove("departure-time-controls")):s.value===T.DEPART_BY?(this._departureTime=T.DEPART_BY,this._handles.add([d((()=>this._datePicker.value),(()=>this._updateDepartureTime()),h),d((()=>this._timePicker.value),(()=>this._updateDepartureTime()),h)],"departure-time-controls")):(this._departureTime=T.UNSPECIFIED,this.viewModel.departureTime=null)}_updateDepartureTime(){const e=this._datePicker.value,t=this._timePicker.value;e&&t&&(this.viewModel.departureTime=new Date(e.getFullYear(),e.getMonth(),e.getDate(),t.getHours(),t.getMinutes()))}_renderTimeControls(){return L("div",{class:C.departureTimeControls,key:"esri-directions__time-controls",role:"group"},this._datePicker.render(),this._timePicker.render())}_renderSectionSplitter(){return L("div",{class:C.sectionSplitter})}_renderDisclaimer(){const{messages:e}=this,t=`<a class="${C.anchor}" href="http://www.esri.com/legal/software-license" rel="noreferrer" target="_blank">${e.esriTerms}</a>`,s=z(e.disclaimer,{esriTerms:t});return L("div",{class:C.disclaimer,innerHTML:s,key:"esri-directions__disclaimer"})}_renderDirectionsContainer(){return L("div",{class:this.classes(C.directionsSection,C.section),key:"esri-directions__container"},this._renderDirectionsContainerContent())}_renderLoader(){return L("div",{class:C.loader,key:"loader"})}_renderWarningCard(){return L("div",{class:C.warningCard,role:"alert"},L("div",{class:C.warningHeader},L("span",{class:C.warningIcon,"aria-hidden":"true"}),L(P,{class:C.warningHeading,level:this.headingLevel},this.messagesCommon.warning)),L("div",{class:C.warningMessage},this._getErrorMessage()))}_renderDirectionsContainerContent(){const{lastRoute:e,viewModel:{state:t}}=this,s="routing"===t;return"error"===t?this._renderWarningCard():s?this._renderLoader():n(e)&&n(e.directionLines)?L("div",{class:C.summary,key:"esri-directions__summary",role:"group"},this._renderCosts(),this._renderRouteActions(),this._renderManeuverSections()):L("div",{key:"esri-directions__placeholder",class:C.emptyContent},this._renderPlaceholder(),L(P,{class:C.message,level:this.headingLevel},this.messages.directionsPlaceholder))}_renderPlaceholder(){return L("svg",{class:C.emptyIllustration,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 256"},L("path",{fill:"currentcolor",d:"M192 36c-15.477 0-24 6.034-24 16.99v45.822l24 24 24-24v-45.82C216 42.033 207.477 36 192 36zm20 61.155l-20 20-20-20V52.99c0-8.62 6.73-12.99 20-12.99s20 4.37 20 12.99zM192 52a12 12 0 1 0 12 12 12.013 12.013 0 0 0-12-12zm0 20a8 8 0 1 1 8-8 8.008 8.008 0 0 1-8 8zM92 140.99C92 130.035 83.477 124 68 124s-24 6.034-24 16.99v45.822l24 24 24-24zm-4 44.165l-20 20-20-20V140.99c0-8.62 6.73-12.99 20-12.99s20 4.37 20 12.99zM68 140a12 12 0 1 0 12 12 12.013 12.013 0 0 0-12-12zm0 20a8 8 0 1 1 8-8 8.008 8.008 0 0 1-8 8zm84-44h16v4h-16zm-24 80h4v12h-12v-4h8zm0-28h4v16h-4zm0-52h12v4h-8v8h-4zm0 24h4v16h-4zm-36 64h16v4H92z"}))}_renderMessage(e){return L(P,{level:this.headingLevel},e)}_renderRouteActions(){return L("div",{class:C.routeActions},L("button",{"aria-label":this.messages.clearRoute,class:this.classes(C.clearRouteButton,C.button,C.buttonTertiary),tabIndex:0,onclick:this._handleClearRouteClick,bind:this,type:"button"},this.messages.clearRoute))}_getSections(){if(a(this.lastRoute))return null;const{directionPoints:e,directionLines:t,stops:s}=this.lastRoute;if(a(e)||a(t))return null;const i=[];let o=null;for(const r of e){const{objectId:e,stopId:l}=r;if(n(l)){const e=s.find((e=>e.objectId===l)),t=0===i.length;(a(o)||o.stop!==e)&&(o={stop:e,directions:[],open:t},i.push(o));continue}if(a(o))continue;const c=t.find((t=>t.directionPointId===e));a(c)||o.directions.push({directionPoint:r,directionLine:c})}return i}_renderManeuverSections(){return a(this._sections)?null:L("div",{class:C.maneuvers,role:"group"},this._sections.map(((e,t)=>{const{open:s}=e;let i;e.directions.length>0&&s&&(i=L("ol",{class:C.maneuverList},e.directions.map((e=>this._renderManeuver(e)))));const o=l(this._sections).length>2,r=t===l(this._sections).length-1,n={[C.collapsibleSection]:o},a={[C.openIcon]:!s,[C.closeIcon]:s};let c;if(o&&!r){const t=s?this.messagesCommon.open:this.messagesCommon.close;c=L("header",{class:this.classes(C.maneuverSectionHeader,C.maneuverSectionToggle),key:"esri-directions__maneuver-section-header"},L("div",{"aria-expanded":s.toString(),"aria-label":t,bind:this,class:C.maneuverSectionHeaderButton,"data-maneuver-section":e,onkeydown:this._handleSectionToggle,onclick:this._handleSectionToggle,role:"button",tabIndex:0,title:t},L(P,{class:C.maneuverSectionTitle,level:this.headingLevel},e.stop.name),L("span",{"aria-hidden":"true",class:this.classes(a)})))}else c=L("header",{class:C.maneuverSectionHeader,key:"esri-directions__maneuver-section-header"},L(P,{class:C.maneuverSectionTitle,level:this.headingLevel},e.stop.name));return L("section",{class:this.classes(C.maneuverSection,n),key:t},c,i)})))}_handleSectionToggle(e){const t=e.currentTarget["data-maneuver-section"];t.open=!t.open}_renderCosts(){const{lastRoute:e}=this;if(a(e))return null;const t=this._getCostSummary(),{directionPoints:s}=e;if(a(s)||a(t))return null;const i=s.getItemAt(s.length-1).arrivalTime,{primary:o,secondary:r}=t,{eta:l,etaTemplate:c,primaryCosts:d,secondaryCosts:h,zoomToRoute:u}=this.messages,p=O("short-time"),m=n(i)?`<strong>${E(i,p)}</strong>`:null,v=n(i)?`${N(i)}`:null,_=z(c,{time:m,gmt:v});return L("div",{"aria-label":u,bind:this,class:C.directionCosts,onkeydown:this._handleSummaryInteraction,onclick:this._handleSummaryInteraction,role:"button",tabIndex:0,title:u},L("div",{class:C.costsDetails,role:"group"},L("div",{"aria-label":d,class:C.primaryCosts,title:d},o),L("div",{class:C.verticalSplitter}),L("div",{"aria-label":h,class:C.secondaryCosts,title:h},r)),L("div",{"aria-label":l,innerHTML:_,title:l}))}_handleSummaryInteraction(){this._activeManeuver=null,this._focusedManeuver=null,this.viewModel.clearHighlights(),this.zoomToRoute()}_getErrorMessage(){const{messages:e,viewModel:{error:t}}=this;if(n(t))switch(t.name){case"directions-view-model:unable-to-route":return e.errors.unableToRoute;case"directions-view-model:service-metadata-unavailable":return e.errors.unableToLoadServiceMetadata}return e.errors.unknownError}_normalizeSearchSources(e){this._overrideDefaultSources(e),this._applyLocatorSourceOverrides(e)}_overrideDefaultSources(e){e.viewModel.defaultSources.forEach((e=>{e.autoNavigate=!1}))}_applyLocatorSourceOverrides({allSources:e}){0!==e.length&&e.forEach((e=>{"url"in e&&e.url&&(null===e.locationType&&(e.locationType="street"),k(e.url)&&this.apiKey&&null==e.apiKey&&(e.apiKey=this.apiKey,e.url=R))}))}_acquireSearch(e){const t=this.get("viewModel.view");if(this._stopsToSearches.has(e)){const s=this._stopsToSearches.get(e);return s.view=t,this._overrideDefaultSources(s),s}const s=new S({view:t,resultGraphicEnabled:!1,popupEnabled:!1,...this.searchProperties});return this._normalizeSearchSources(s),this._handles.add([p((()=>s.allSources),"change",(()=>this._normalizeSearchSources(s))),s.on("select-result",(()=>{e.result=s.selectedResult,e.result.feature.attributes.Name=s.selectedResult.name,this._processStops(),this.scheduleRender()})),s.on("search-focus",(()=>this._handleStopInputFocus(s,e))),s.on("search-blur",(()=>this._handleStopInputBlur(s,e)))],s),this._stopsToSearches.set(e,s),s}_disposeSearch(e){this._stopsToSearches.get(e).destroy(),this._stopsToSearches.delete(e)}_processStops(){const e=this._stops.filter((e=>!!e.result)).map((e=>g.fromJSON(e.result.feature.toJSON())));switch(e.length){case 0:break;case 1:e.getItemAt(0).symbol=this.stopSymbols.first;break;case 2:e.getItemAt(0).symbol=this.stopSymbols.first,e.getItemAt(1).symbol=this.stopSymbols.last;break;default:e.forEach(((t,s)=>{switch(s){case 0:t.symbol=this.stopSymbols.first;break;case e.length-1:t.symbol=this.stopSymbols.last;break;default:t.symbol=this.stopSymbols.middle}}))}this.viewModel.stops=e,e.length>1&&this.getDirections()}_renderManeuver(e){const t="",{directionsLengthUnits:s}=this.viewModel.routeParameters,{directionPoint:i,directionLine:o}=e,{distance:r,duration:a}=o,{messages:l,messagesUnits:d}=this,h=b(l,d,c(r,0),{fromUnits:"meters",toUnits:s}),u=M(c(a,0),"minutes"),p=h&&u?`${h}&nbsp;&middot;&nbsp;${u}`:`${h}${u}`,m=this._getFormattedManeuverText(i),{objectId:v,directionPointType:_}=i,g=I(_),S=`esri-directions__maneuver-${v}`,w=`esri-directions__cumulative-costs-${v}`,y=`esri-directions__intermediate-costs-${v}`,f={[C.maneuverActive]:this._activeManeuver===o};return L("li",{"aria-labelledby":`${S} ${w} ${y}`,bind:this,class:this.classes(C.maneuver,f),"data-maneuver":o,key:o,onclick:this._handleManeuverClick,onkeydown:this._handleManeuverClick,onfocus:this._handleManeuverFocus,onmouseover:this._handleManeuverMouseOver,onmouseout:this._handleManeuverMouseOut,onblur:this._handleManeuverBlur,tabIndex:0},n(g)&&L("img",{alt:"",class:C.maneuverIcon,src:g}),L("div",{class:C.maneuverCostsContainer},L("span",{id:S,innerHTML:c(m,"")}),L("div",{class:C.maneuverCosts},L("div",{class:C.horizontalSplitter}),L("div",{id:w,"aria-label":l.cumulativeCosts,class:C.cumulativeCost,innerHTML:t,title:l.cumulativeCosts}),L("div",{id:y,"aria-label":l.intermediateCosts,class:C.intermediateCost,innerHTML:p,title:l.intermediateCosts}))))}_handleManeuverClick(e){const s=e.currentTarget["data-maneuver"];if(this._activeManeuver===s)return this._activeManeuver=null,void this.zoomToRoute();this._activeManeuver=s;const{geometry:i,symbol:o}=s,r=new t({geometry:i,symbol:o});this.viewModel.centerAt(r),this.viewModel.highlightSegment(r)}_handleManeuverMouseOver(e){if(this._activeManeuver||this._focusedManeuver)return;const s=e.currentTarget["data-maneuver"],{geometry:i,symbol:o}=s,r=new t({geometry:i,symbol:o});this.viewModel.highlightSegment(r)}_handleManeuverMouseOut(){this._activeManeuver||this._focusedManeuver||this.viewModel.clearHighlights()}_handleManeuverBlur(){this._activeManeuver||(this._focusedManeuver=null,this.viewModel.clearHighlights())}_handleManeuverFocus(e){if(this._activeManeuver)return;const s=e.currentTarget["data-maneuver"];this._focusedManeuver=s;const{geometry:i,symbol:o}=s,r=new t({geometry:i,symbol:o});this.viewModel.highlightSegment(r)}_getFormattedManeuverText(e){const{displayText:t,name:s,intersectingName:i}=e;if(a(t))return"";let o=t;return n(s)&&o.includes(s)&&(o=o.replace(s,`<strong>${s}</strong>`)),n(i)&&o.includes(i)&&(o=o.replace(i,`<strong>${i}</strong>`)),o}_getCostSummary(){const{viewModel:{impedanceAttribute:e,routeParameters:t},lastRoute:s}=this;if(a(e)||a(s))return null;const{routeInfo:i}=s;let{totalDuration:o,totalDistance:r}=i;const{directionsLengthUnits:l}=t;r=n(r)?r:0,o=n(o)?o:0;const c=b(this.messages,this.messagesUnits,r,{fromUnits:"meters",toUnits:l}),d=M(o,"minutes"),[h,u]=f(e.units)?[d,c]:[c,d];return{primary:h,secondary:u}}};e([m("viewModel.apiKey")],Y.prototype,"apiKey",void 0),e([m("viewModel.goToOverride")],Y.prototype,"goToOverride",void 0),e([v()],Y.prototype,"headingLevel",void 0),e([v()],Y.prototype,"iconClass",void 0),e([v({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],Y.prototype,"label",void 0),e([m("viewModel.lastRoute")],Y.prototype,"lastRoute",void 0),e([m("viewModel.maxStops")],Y.prototype,"maxStops",void 0),e([v(),U("esri/widgets/Directions/t9n/Directions")],Y.prototype,"messages",void 0),e([v(),U("esri/t9n/common")],Y.prototype,"messagesCommon",void 0),e([v(),U("esri/core/t9n/Units")],Y.prototype,"messagesUnits",void 0),e([m("viewModel.routeServiceUrl")],Y.prototype,"routeServiceUrl",void 0),e([m("viewModel.routeSymbol")],Y.prototype,"routeSymbol",void 0),e([v()],Y.prototype,"searchProperties",void 0),e([m("viewModel.stopSymbols")],Y.prototype,"stopSymbols",void 0),e([m("viewModel.view")],Y.prototype,"view",void 0),e([v({type:y})],Y.prototype,"viewModel",void 0),e([m("viewModel.getDirections")],Y.prototype,"getDirections",null),e([m("viewModel.zoomToRoute")],Y.prototype,"zoomToRoute",null),e([H()],Y.prototype,"_handleStopIconClick",null),e([H()],Y.prototype,"_handleClearRouteClick",null),e([H()],Y.prototype,"_handleReverseStops",null),e([H()],Y.prototype,"_handleRemoveStop",null),e([H()],Y.prototype,"_handleSectionToggle",null),e([H()],Y.prototype,"_handleSummaryInteraction",null),e([H()],Y.prototype,"_handleManeuverClick",null),Y=e([_("esri.widgets.Directions")],Y);const G=Y;export{G as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import"../intl.js";import s from"../core/Collection.js";import{on as i,pausable as o}from"../core/events.js";import r from"../core/Handles.js";import{isSome as n,isNone as a,unwrap as l,unwrapOrValue as c}from"../core/maybe.js";import{watch as d,initial as h,when as u,on as p}from"../core/reactiveUtils.js";import{aliasOf as m}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as v}from"../core/accessorSupport/decorators/property.js";import{subclass as _}from"../core/accessorSupport/decorators/subclass.js";import g from"../rest/support/Stop.js";import S from"./Search.js";import w from"./Widget.js";import y from"./Directions/DirectionsViewModel.js";import{formatDistance as b,formatTime as M,isTimeUnits as f}from"./Directions/support/directionsUtils.js";import{DepartureTime as T,CSS as C,getIconPath as I}from"./Directions/support/resources.js";import{isArcGISWorldGeocoder as k,meteredArcGISLocatorUrl as R}from"./Search/support/locatorUtils.js";import D from"./support/DatePicker.js";import{Heading as P,incrementHeadingLevel as j}from"./support/Heading.js";import x from"./support/TimePicker.js";import{accessibleHandler as H}from"./support/decorators/accessibleHandler.js";import{messageBundle as U}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{tsx as L}from"./support/jsxFactory.js";import"./support/widgetUtils.js";import A from"sortablejs";import{substitute as z}from"../intl/substitute.js";import{formatDate as E,convertDateFormatToIntlOptions as O}from"../intl/date.js";import{formatNumber as $}from"../intl/number.js";function N(e){const t=e.getTimezoneOffset(),s=t>0?"-":"+",i=60,o=Math.abs(Math.floor(t/i)),r=Math.abs(Math.floor(t)%i),n={minimumIntegerDigits:2};return`GMT${s}${$(o,n)}${$(r,n)}`}function B(){return[{},{}]}function F(e){return e.results[0].results[0]}function V(e){return!(null==e.composedPath||!e.composedPath().find((e=>{var t;return null==(t=e.classList)?void 0:t.contains("esri-search__suggestions-list")})))}const W={awaitingViewClickStop:"awaiting-view-click-stop"},K=100,q=500;let Y=class extends w{constructor(e,t){super(e,t),this._autoStopRemovalDelay=K,this._departureTime=T.NOW,this._datePicker=new D,this._handles=new r,this._newPlaceholderStop=null,this._pointerPressedSearchSuggestionStop=null,this._sections=null,this._stops=new s(B()),this._stopsToSearches=new Map,this._timePicker=new x,this.apiKey=null,this.goToOverride=null,this.headingLevel=2,this.iconClass=C.widgetIcon,this.label=void 0,this.lastRoute=null,this.maxStops=null,this.messages=null,this.messagesCommon=null,this.messagesUnits=null,this.routeServiceUrl=void 0,this.routeSymbol=null,this.searchProperties=null,this.stopSymbols=null,this.view=null,this.viewModel=new y,this._setUpDragAndDropStops=e=>{this._sortable=A.create(e,{draggable:`.${C.validStopRow}`,ghostClass:C.stopRowGhost,handle:`.${C.stopHandle}`,onEnd:this._handleStopInputDragEnd})},this._handleDragHandlePointerDown=()=>this._stops.forEach((e=>this._acquireSearch(e).activeMenu="none")),this._handleStopInputDragEnd=({oldIndex:e,newIndex:t,target:s})=>{if(e===t)return;const{children:i}=s,o=i[t],r=i[e],n=t-e<0;s.insertBefore(o,n?r.nextElementSibling:r);const a=this._stops;a.reorder(a.getItemAt(e),t),this._processStops()}}initialize(){this.own([d((()=>this.viewModel.lastRoute),(()=>{this._activeManeuver=null,this._focusedManeuver=null,this._sections=this._getSections(),this.scheduleRender()}),h),d((()=>[this.viewModel.selectedTravelMode,this.viewModel.departureTime]),(()=>{this.viewModel.stops.length>1&&this.getDirections()}),h),u((()=>this.view),((e,t)=>{if(t&&(this._viewClickHandle=null,this._handles.remove(t)),e){const t=this._prepPointerDownUpClick(),s=this._prepViewClick();t.pause(),s.pause(),this._handles.add([i(e.surface,"mousedown",(()=>this._autoStopRemovalDelay=q)),i(e.surface,"mouseup",(()=>this._autoStopRemovalDelay=K)),t,s],this.view.surface),this._pointerDownUpHandle=t,this._viewClickHandle=s}}),h),u((()=>0===this.viewModel.stops.length),(()=>{this._stops.drain((e=>{this._disposeSearch(e)})),this._stops.addMany(B()),this.scheduleRender()}))])}destroy(){this._datePicker.destroy(),this._timePicker.destroy(),this._stopsToSearches.forEach((e=>e.destroy())),this._sortable&&this._sortable.destroy()}getDirections(){return null}zoomToRoute(){}render(){return L("div",{class:this.classes(C.base,C.scroller)},this._renderPanelContent())}_renderPanelContent(){const{viewModel:{state:e}}=this,t="initializing"===e,s="error"===e&&!this.viewModel.serviceDescription,i="unauthenticated"===e,o={[C.panelContentLoading]:t,[C.panelContentError]:s,[C.panelContentSignIn]:i},r=t?"presentation":"group",n=i?this._renderSignIn():s?this._renderMessage(this._getErrorMessage()):t?this._renderLoader():this._renderReadyContent();return L("div",{class:this.classes(C.panelContent,o),role:r},n)}_renderReadyContent(){return[this._renderStopsContainer(),this._renderTravelModeOptions(),this._renderDepartureTimeControls(),this._renderSectionSplitter(),this._renderDirectionsContainer()]}_renderSignIn(){return L("div",{key:"sign-in",class:C.signInContent},L(P,{class:C.contentTitle,level:this.headingLevel},this.messages.widgetLabel),this._renderPlaceholder(),L(P,{level:j(this.headingLevel)},this.messages.signInRequired),L("button",{class:this.classes(C.button,C.buttonSecondary,C.signInButton),tabIndex:0,onclick:this._handleSignInClick,bind:this,type:"button"},this.messagesCommon.auth.signIn))}_handleSignInClick(){this.viewModel.load().catch((()=>{}))}_renderTravelModeOptions(){const{selectedTravelMode:e,travelModes:t}=this.viewModel;if(0===t.length)return null;const s=n(e)?e.name:this.messages.travelMode;return L("select",{"aria-label":s,bind:this,class:this.classes(C.travelModeSelect,C.select),key:"esri-directions__travel-mode-options",onchange:this._handleTravelModeChange,title:s},t.map((t=>{const s=n(e)&&t.id===e.id;return L("option",{key:t,"data-mode":t,selected:s,value:t.id},t.name)})))}_handleTravelModeChange(e){const t=e.currentTarget,s=t.item(t.selectedIndex);this.viewModel.selectedTravelMode=s["data-mode"]}_renderStopsContainer(){return L("div",{class:C.section,key:"esri-directions__stops-container",role:"group"},this._renderStops())}_renderDepartureTimeControls(){const e=this._departureTime,{messages:t}=this,s=t.departureTime;return L("div",{class:C.departureTime,key:"esri-directions__departure-time-controls",role:"group"},L("select",{"aria-label":s,bind:this,class:this.classes(C.departureTimeSelect,C.select),onchange:this._handleDepartureOptionChange,title:s},L("option",{value:T.NOW,selected:e===T.NOW},t.leaveNow),L("option",{value:T.DEPART_BY,selected:e===T.DEPART_BY},t.departBy),L("option",{value:T.UNSPECIFIED,selected:e===T.UNSPECIFIED},t.timeUnspecified)),e===T.DEPART_BY?this._renderTimeControls():null)}_renderStops(){const e=this._stops;let t=0;e.forEach((e=>{"none"!==this._acquireSearch(e).activeMenu&&(t+=1)}));const s=e.toArray().map(((s,i)=>{const o=e.length,r=i>1&&!s.result,n={[C.stopsIcon]:i>=0&&i<o-1,[C.lastStopIcon]:i===o-1},a={[C.lastStopIconContainer]:i===o-1},l={[C.validStopRow]:!r},c=e.getItemAt(o-1),d=c&&c.result,h=e.getItemAt(i+1),u=h&&h.result,p=i===o-1,m=i===o-2,v=2===o&&0===i||o>2&&!p&&!m||o>2&&m&&u||o>2&&p&&!s.result,_=2===o||3===o&&!d||r,g=this._acquireSearch(s),{messages:S}=this,{removeStop:w,reverseStops:y,unlocated:b}=S,M=z(S.stopLabelTemplate,{number:i+1,label:s.result?s.result.name:b}),f=`${this.id}__stop--${i}`,T=!!g.searchTerm&&!!g.selectedResult&&!!s.result&&g.selectedResult===s.result,I={zIndex:"none"!==g.activeMenu?""+t--:""};return L("li",{"aria-label":M,afterCreate:this._handleStopFieldCreation,bind:this,class:this.classes(C.stopRow,l),id:f,key:i,"data-stop-index":i,styles:I},L("div",{class:C.stopHandle},L("span",{"aria-hidden":"true",class:this.classes(C.stopIcon,C.handleIcon,C.stopHandleIcon,C.interactiveStopIcon),onpointerdown:this._handleDragHandlePointerDown}),L("div",{bind:this,"aria-labelledby":f,class:this.classes(C.stopIconContainer,a),"data-stop-index":i,onclick:this._handleStopIconClick,onkeydown:this._handleStopIconClick,role:"button"},L("span",{class:this.classes(C.stopIcon,n),tabindex:T?"0":null}))),L("div",{class:C.stopInput},g.render()),L("div",{class:C.stopOptions,role:"group"},L("div",{"aria-label":w,class:C.removeStopButton,bind:this,"data-stop-index":i,hidden:_,onkeydown:this._handleRemoveStop,onclick:this._handleRemoveStop,role:"button",tabIndex:0,title:w},L("span",{"aria-hidden":"true",class:this.classes(C.stopIcon,C.removeStop,C.removeStopIcon,C.interactiveStopIcon)}),L("span",{class:C.screenReaderText},"removeStopTitle")),L("div",{"aria-label":y,class:C.reverseStops,bind:this,hidden:v,onkeydown:this._handleReverseStops,onclick:this._handleReverseStops,role:"button",tabIndex:0,title:y},L("span",{"aria-hidden":"true",class:this.classes(C.stopIcon,C.reverseStopIcon,C.interactiveStopIcon)}),L("span",{class:C.screenReaderText},"removeStopTitle"))))})),i=e.every((e=>{const t=this._stopsToSearches.get(e);return e.result&&t.selectedResult===e.result})),o=this._stops.length>=this.maxStops,r=this.messages.addStop,n=e.length>=2&&i&&!o?L("div",{"aria-label":r,bind:this,class:C.addStop,key:"esri-directions__add-stop",onfocus:this._handleAddStopFocus,tabIndex:0},L("span",{"aria-hidden":"true",class:this.classes(C.addStopIcon,C.stopIcon,C.interactiveStopIcon)}),L("div",{"aria-hidden":"true",class:C.addStopText},r)):null;return L("div",null,L("ol",{class:C.stops,role:"group",afterCreate:this._setUpDragAndDropStops},s),n)}_handleStopIconClick(e){const t=e.currentTarget["data-stop-index"],s=this._stops.getItemAt(t);s&&s.result&&this._centerAtStop(s)}_handleClearRouteClick(){this.viewModel.reset()}_centerAtStop(e){this.viewModel.centerAt(e.result.feature)}_handleStopFieldCreation(e){const t=this._newPlaceholderStop;if(!t)return;const s=e["data-stop-index"],i=this._stops.getItemAt(s);if(t===i){const e=this._acquireSearch(i);e.when((()=>{this.renderNow(),e.focus()}))}this._newPlaceholderStop=null}_handleStopInputBlur(e,t){this._handles.remove(W.awaitingViewClickStop),this.view.cursor=this._previousCursor;if(!e.selectedResult||!t.result||e.selectedResult!==t.result)return"none"!==e.activeMenu||!e.searchTerm||e.selectedResult===t.result&&(e.selectedResult||t.result)?void(e.searchTerm||(this._viewClickHandle.resume(),clearTimeout(this._autoStopRemovalTimeoutId),this._autoStopRemovalTimeoutId=setTimeout((()=>{if(this.destroyed)return;if(this._viewClickHandle.pause(),"searching"===e.viewModel.state)return void this._pointerDownUpHandle.pause();if(this._pointerPressedSearchSuggestionStop)return;this._removeStop(t);!!t.result&&(t.result=null,this._processStops()),this.scheduleRender()}),this._autoStopRemovalDelay))):(e.search(),void this._pointerDownUpHandle.pause());this._pointerDownUpHandle.pause()}_handleStopInputFocus(e,t){if(this._pointerDownUpHandle.resume(),this._handles.has(W.awaitingViewClickStop))return;const{view:s,view:{cursor:i}}=this;this._previousCursor=i,this._handles.add(d((()=>e.searchTerm),(e=>{s.cursor=0===e.length?"copy":i}),h),W.awaitingViewClickStop),this._activeStop=t}_prepViewClick(){const{view:e}=this.viewModel,t=o(e,"click",this._handleViewClick.bind(this)),s=o(e.surface,"click",(()=>{clearTimeout(this._autoStopRemovalTimeoutId),s.pause()}));return{remove(){s.remove(),t.remove()},pause(){s.pause(),t.pause()},resume(){s.resume(),t.resume()}}}_prepPointerDownUpClick(){const e=o(document,"pointerdown",(e=>{this._pointerPressedSearchSuggestionStop=V(e)?this._activeStop:null})),t=o(document,"pointerup",(e=>{this._pointerDownUpHandle.pause();const t=V(e),s=this._activeStop;t||s!==this._pointerPressedSearchSuggestionStop||this._removeStop(s),this.scheduleRender(),this._pointerPressedSearchSuggestionStop=t?this._activeStop:null}));return{remove(){t.remove(),e.remove()},pause(){t.pause(),e.pause()},resume(){e.resume()}}}_handleViewClick(e){const t=this._stopsToSearches.get(this._activeStop);t&&!t.searchTerm&&(t.search(e.mapPoint).then((e=>{const s=F(e),i=this._activeStop;i.result=s,i.result.feature.attributes.Name=s.name,t.searchTerm=s.name})),this.scheduleRender()),this._viewClickHandle.pause(),clearTimeout(this._autoStopRemovalTimeoutId)}_handleAddStopFocus(){this._addNewPlaceholder()}_addNewPlaceholder(){if(this._pointerDownUpHandle.pause(),this._newPlaceholderStop)return;const e={};this._stops.add(e),this._newPlaceholderStop=e}_handleReverseStops(){this._reverseStops()}_reverseStops(){this._stops.reverse(),this._processStops()}_handleRemoveStop(e){const t=e.currentTarget["data-stop-index"];this._removeStop(this._stops.getItemAt(t)),this._processStops()}_removeStop(e){this._stops.length<=2||(this._disposeSearch(e),this._stops.remove(e))}_handleDepartureOptionChange(e){const t=e.currentTarget,s=t.item(t.selectedIndex);s.value===T.NOW?(this._departureTime=T.NOW,this.viewModel.departureTime=T.NOW,this._handles.remove("departure-time-controls")):s.value===T.DEPART_BY?(this._departureTime=T.DEPART_BY,this._handles.add([d((()=>this._datePicker.value),(()=>this._updateDepartureTime()),h),d((()=>this._timePicker.value),(()=>this._updateDepartureTime()),h)],"departure-time-controls")):(this._departureTime=T.UNSPECIFIED,this.viewModel.departureTime=null)}_updateDepartureTime(){const e=this._datePicker.value,t=this._timePicker.value;e&&t&&(this.viewModel.departureTime=new Date(e.getFullYear(),e.getMonth(),e.getDate(),t.getHours(),t.getMinutes()))}_renderTimeControls(){return L("div",{class:C.departureTimeControls,key:"esri-directions__time-controls",role:"group"},this._datePicker.render(),this._timePicker.render())}_renderSectionSplitter(){return L("div",{class:C.sectionSplitter})}_renderDirectionsContainer(){return L("div",{class:this.classes(C.directionsSection,C.section),key:"esri-directions__container"},this._renderDirectionsContainerContent())}_renderLoader(){return L("div",{class:C.loader,key:"loader"})}_renderWarningCard(){return L("div",{class:C.warningCard,role:"alert"},L("div",{class:C.warningHeader},L("span",{class:C.warningIcon,"aria-hidden":"true"}),L(P,{class:C.warningHeading,level:this.headingLevel},this.messagesCommon.warning)),L("div",{class:C.warningMessage},this._getErrorMessage()))}_renderDirectionsContainerContent(){const{lastRoute:e,viewModel:{state:t}}=this,s="routing"===t;return"error"===t?this._renderWarningCard():s?this._renderLoader():n(e)&&n(e.directionLines)?L("div",{class:C.summary,key:"esri-directions__summary",role:"group"},this._renderCosts(),this._renderRouteActions(),this._renderManeuverSections()):L("div",{key:"esri-directions__placeholder",class:C.emptyContent},this._renderPlaceholder(),L(P,{class:C.message,level:this.headingLevel},this.messages.directionsPlaceholder))}_renderPlaceholder(){return L("svg",{class:C.emptyIllustration,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 256"},L("path",{fill:"currentcolor",d:"M192 36c-15.477 0-24 6.034-24 16.99v45.822l24 24 24-24v-45.82C216 42.033 207.477 36 192 36zm20 61.155l-20 20-20-20V52.99c0-8.62 6.73-12.99 20-12.99s20 4.37 20 12.99zM192 52a12 12 0 1 0 12 12 12.013 12.013 0 0 0-12-12zm0 20a8 8 0 1 1 8-8 8.008 8.008 0 0 1-8 8zM92 140.99C92 130.035 83.477 124 68 124s-24 6.034-24 16.99v45.822l24 24 24-24zm-4 44.165l-20 20-20-20V140.99c0-8.62 6.73-12.99 20-12.99s20 4.37 20 12.99zM68 140a12 12 0 1 0 12 12 12.013 12.013 0 0 0-12-12zm0 20a8 8 0 1 1 8-8 8.008 8.008 0 0 1-8 8zm84-44h16v4h-16zm-24 80h4v12h-12v-4h8zm0-28h4v16h-4zm0-52h12v4h-8v8h-4zm0 24h4v16h-4zm-36 64h16v4H92z"}))}_renderMessage(e){return L(P,{level:this.headingLevel},e)}_renderRouteActions(){return L("div",{class:C.routeActions},L("button",{"aria-label":this.messages.clearRoute,class:this.classes(C.clearRouteButton,C.button,C.buttonTertiary),tabIndex:0,onclick:this._handleClearRouteClick,bind:this,type:"button"},this.messages.clearRoute))}_getSections(){if(a(this.lastRoute))return null;const{directionPoints:e,directionLines:t,stops:s}=this.lastRoute;if(a(e)||a(t))return null;const i=[];let o=null;for(const r of e){const{objectId:e,stopId:l}=r;if(n(l)){const e=s.find((e=>e.objectId===l)),t=0===i.length;(a(o)||o.stop!==e)&&(o={stop:e,directions:[],open:t},i.push(o));continue}if(a(o))continue;const c=t.find((t=>t.directionPointId===e));a(c)||o.directions.push({directionPoint:r,directionLine:c})}return i}_renderManeuverSections(){return a(this._sections)?null:L("div",{class:C.maneuvers,role:"group"},this._sections.map(((e,t)=>{const{open:s}=e;let i;e.directions.length>0&&s&&(i=L("ol",{class:C.maneuverList},e.directions.map((e=>this._renderManeuver(e)))));const o=l(this._sections).length>2,r=t===l(this._sections).length-1,n={[C.collapsibleSection]:o},a={[C.openIcon]:!s,[C.closeIcon]:s};let c;if(o&&!r){const t=s?this.messagesCommon.open:this.messagesCommon.close;c=L("header",{class:this.classes(C.maneuverSectionHeader,C.maneuverSectionToggle),key:"esri-directions__maneuver-section-header"},L("div",{"aria-expanded":s.toString(),"aria-label":t,bind:this,class:C.maneuverSectionHeaderButton,"data-maneuver-section":e,onkeydown:this._handleSectionToggle,onclick:this._handleSectionToggle,role:"button",tabIndex:0,title:t},L(P,{class:C.maneuverSectionTitle,level:this.headingLevel},e.stop.name),L("span",{"aria-hidden":"true",class:this.classes(a)})))}else c=L("header",{class:C.maneuverSectionHeader,key:"esri-directions__maneuver-section-header"},L(P,{class:C.maneuverSectionTitle,level:this.headingLevel},e.stop.name));return L("section",{class:this.classes(C.maneuverSection,n),key:t},c,i)})))}_handleSectionToggle(e){const t=e.currentTarget["data-maneuver-section"];t.open=!t.open}_renderCosts(){const{lastRoute:e}=this;if(a(e))return null;const t=this._getCostSummary(),{directionPoints:s}=e;if(a(s)||a(t))return null;const i=s.getItemAt(s.length-1).arrivalTime,{primary:o,secondary:r}=t,{eta:l,etaTemplate:c,primaryCosts:d,secondaryCosts:h,zoomToRoute:u}=this.messages,p=O("short-time"),m=n(i)?`<strong>${E(i,p)}</strong>`:null,v=n(i)?`${N(i)}`:null,_=z(c,{time:m,gmt:v});return L("div",{"aria-label":u,bind:this,class:C.directionCosts,onkeydown:this._handleSummaryInteraction,onclick:this._handleSummaryInteraction,role:"button",tabIndex:0,title:u},L("div",{class:C.costsDetails,role:"group"},L("div",{"aria-label":d,class:C.primaryCosts,title:d},o),L("div",{class:C.verticalSplitter}),L("div",{"aria-label":h,class:C.secondaryCosts,title:h},r)),L("div",{"aria-label":l,innerHTML:_,title:l}))}_handleSummaryInteraction(){this._activeManeuver=null,this._focusedManeuver=null,this.viewModel.clearHighlights(),this.zoomToRoute()}_getErrorMessage(){const{messages:e,viewModel:{error:t}}=this;if(n(t))switch(t.name){case"directions-view-model:unable-to-route":return e.errors.unableToRoute;case"directions-view-model:service-metadata-unavailable":return e.errors.unableToLoadServiceMetadata}return e.errors.unknownError}_normalizeSearchSources(e){this._overrideDefaultSources(e),this._applyLocatorSourceOverrides(e)}_overrideDefaultSources(e){e.viewModel.defaultSources.forEach((e=>{e.autoNavigate=!1}))}_applyLocatorSourceOverrides({allSources:e}){0!==e.length&&e.forEach((e=>{"url"in e&&e.url&&(null===e.locationType&&(e.locationType="street"),k(e.url)&&this.apiKey&&null==e.apiKey&&(e.apiKey=this.apiKey,e.url=R))}))}_acquireSearch(e){const t=this.get("viewModel.view");if(this._stopsToSearches.has(e)){const s=this._stopsToSearches.get(e);return s.view=t,this._overrideDefaultSources(s),s}const s=new S({view:t,resultGraphicEnabled:!1,popupEnabled:!1,...this.searchProperties});return this._normalizeSearchSources(s),this._handles.add([p((()=>s.allSources),"change",(()=>this._normalizeSearchSources(s))),s.on("select-result",(()=>{e.result=s.selectedResult,e.result.feature.attributes.Name=s.selectedResult.name,this._processStops(),this.scheduleRender()})),s.on("search-focus",(()=>this._handleStopInputFocus(s,e))),s.on("search-blur",(()=>this._handleStopInputBlur(s,e)))],s),this._stopsToSearches.set(e,s),s}_disposeSearch(e){this._stopsToSearches.get(e).destroy(),this._stopsToSearches.delete(e)}_processStops(){const e=this._stops.filter((e=>!!e.result)).map((e=>g.fromJSON(e.result.feature.toJSON())));switch(e.length){case 0:break;case 1:e.getItemAt(0).symbol=this.stopSymbols.first;break;case 2:e.getItemAt(0).symbol=this.stopSymbols.first,e.getItemAt(1).symbol=this.stopSymbols.last;break;default:e.forEach(((t,s)=>{switch(s){case 0:t.symbol=this.stopSymbols.first;break;case e.length-1:t.symbol=this.stopSymbols.last;break;default:t.symbol=this.stopSymbols.middle}}))}this.viewModel.stops=e,e.length>1&&this.getDirections()}_renderManeuver(e){const t="",{directionsLengthUnits:s}=this.viewModel.routeParameters,{directionPoint:i,directionLine:o}=e,{distance:r,duration:a}=o,{messages:l,messagesUnits:d}=this,h=b(l,d,c(r,0),{fromUnits:"meters",toUnits:s}),u=M(c(a,0),"minutes"),p=h&&u?`${h}&nbsp;&middot;&nbsp;${u}`:`${h}${u}`,m=this._getFormattedManeuverText(i),{objectId:v,directionPointType:_}=i,g=I(_),S=`esri-directions__maneuver-${v}`,w=`esri-directions__cumulative-costs-${v}`,y=`esri-directions__intermediate-costs-${v}`,f={[C.maneuverActive]:this._activeManeuver===o};return L("li",{"aria-labelledby":`${S} ${w} ${y}`,bind:this,class:this.classes(C.maneuver,f),"data-maneuver":o,key:o,onclick:this._handleManeuverClick,onkeydown:this._handleManeuverClick,onfocus:this._handleManeuverFocus,onmouseover:this._handleManeuverMouseOver,onmouseout:this._handleManeuverMouseOut,onblur:this._handleManeuverBlur,tabIndex:0},n(g)&&L("img",{alt:"",class:C.maneuverIcon,src:g}),L("div",{class:C.maneuverCostsContainer},L("span",{id:S,innerHTML:c(m,"")}),L("div",{class:C.maneuverCosts},L("div",{class:C.horizontalSplitter}),L("div",{id:w,"aria-label":l.cumulativeCosts,class:C.cumulativeCost,innerHTML:t,title:l.cumulativeCosts}),L("div",{id:y,"aria-label":l.intermediateCosts,class:C.intermediateCost,innerHTML:p,title:l.intermediateCosts}))))}_handleManeuverClick(e){const s=e.currentTarget["data-maneuver"];if(this._activeManeuver===s)return this._activeManeuver=null,void this.zoomToRoute();this._activeManeuver=s;const{geometry:i,symbol:o}=s,r=new t({geometry:i,symbol:o});this.viewModel.centerAt(r),this.viewModel.highlightSegment(r)}_handleManeuverMouseOver(e){if(this._activeManeuver||this._focusedManeuver)return;const s=e.currentTarget["data-maneuver"],{geometry:i,symbol:o}=s,r=new t({geometry:i,symbol:o});this.viewModel.highlightSegment(r)}_handleManeuverMouseOut(){this._activeManeuver||this._focusedManeuver||this.viewModel.clearHighlights()}_handleManeuverBlur(){this._activeManeuver||(this._focusedManeuver=null,this.viewModel.clearHighlights())}_handleManeuverFocus(e){if(this._activeManeuver)return;const s=e.currentTarget["data-maneuver"];this._focusedManeuver=s;const{geometry:i,symbol:o}=s,r=new t({geometry:i,symbol:o});this.viewModel.highlightSegment(r)}_getFormattedManeuverText(e){const{displayText:t,name:s,intersectingName:i}=e;if(a(t))return"";let o=t;return n(s)&&o.includes(s)&&(o=o.replace(s,`<strong>${s}</strong>`)),n(i)&&o.includes(i)&&(o=o.replace(i,`<strong>${i}</strong>`)),o}_getCostSummary(){const{viewModel:{impedanceAttribute:e,routeParameters:t},lastRoute:s}=this;if(a(e)||a(s))return null;const{routeInfo:i}=s;let{totalDuration:o,totalDistance:r}=i;const{directionsLengthUnits:l}=t;r=n(r)?r:0,o=n(o)?o:0;const c=b(this.messages,this.messagesUnits,r,{fromUnits:"meters",toUnits:l}),d=M(o,"minutes"),[h,u]=f(e.units)?[d,c]:[c,d];return{primary:h,secondary:u}}};e([m("viewModel.apiKey")],Y.prototype,"apiKey",void 0),e([m("viewModel.goToOverride")],Y.prototype,"goToOverride",void 0),e([v()],Y.prototype,"headingLevel",void 0),e([v()],Y.prototype,"iconClass",void 0),e([v({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],Y.prototype,"label",void 0),e([m("viewModel.lastRoute")],Y.prototype,"lastRoute",void 0),e([m("viewModel.maxStops")],Y.prototype,"maxStops",void 0),e([v(),U("esri/widgets/Directions/t9n/Directions")],Y.prototype,"messages",void 0),e([v(),U("esri/t9n/common")],Y.prototype,"messagesCommon",void 0),e([v(),U("esri/core/t9n/Units")],Y.prototype,"messagesUnits",void 0),e([m("viewModel.routeServiceUrl")],Y.prototype,"routeServiceUrl",void 0),e([m("viewModel.routeSymbol")],Y.prototype,"routeSymbol",void 0),e([v()],Y.prototype,"searchProperties",void 0),e([m("viewModel.stopSymbols")],Y.prototype,"stopSymbols",void 0),e([m("viewModel.view")],Y.prototype,"view",void 0),e([v({type:y})],Y.prototype,"viewModel",void 0),e([m("viewModel.getDirections")],Y.prototype,"getDirections",null),e([m("viewModel.zoomToRoute")],Y.prototype,"zoomToRoute",null),e([H()],Y.prototype,"_handleStopIconClick",null),e([H()],Y.prototype,"_handleClearRouteClick",null),e([H()],Y.prototype,"_handleReverseStops",null),e([H()],Y.prototype,"_handleRemoveStop",null),e([H()],Y.prototype,"_handleSectionToggle",null),e([H()],Y.prototype,"_handleSummaryInteraction",null),e([H()],Y.prototype,"_handleManeuverClick",null),Y=e([_("esri.widgets.Directions")],Y);const G=Y;export{G as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import"../../intl.js";import s from"../../core/Collection.js";import{HandleOwnerMixin as i}from"../../core/HandleOwner.js";import r from"../../core/Handles.js";import{on as o,watch as l}from"../../core/watchUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{highlightsSupported as d}from"../../views/support/layerViewUtils.js";import h from"./AttachmentsColumn.js";import m from"./FieldColumn.js";import c from"./Grid/Grid.js";import g from"./Grid/GridViewModel.js";import u from"./support/FeatureStore.js";import{onLocaleChange as p}from"../../intl/locale.js";import{fetchMessageBundle as f}from"../../intl/messages.js";let y=class extends(i(g)){constructor(e){super(e),this._defaultHiddenFields=["CreationDate","Creator","EditDate","Editor","GlobalID"],this._highlights=new r,this.cellClassNameGenerator=(e,t)=>e.path||null,this.dataProvider=async(e,t)=>{const{store:s}=this,{page:i,pageSize:r,sortOrders:o}=e,l=this._sortOrdersToLayerOrderByFields(o);t&&(s?(await s.set({orderByFields:l}),"loaded"!==s.state&&"loading"!==s.state&&await s.load(),t&&t(await s.fetchItems({page:i,pageSize:r}))):t&&t([]))},this.editingEnabled=!1,this.grid=null,this.hiddenFields=new s,this.highlightOnRowSelectEnabled=!0,this.itemIdPath="objectId",this.messagesCommon=null,this.relatedRecordsEnabled=!1,this.store=null,this.view=null;const{hiddenFields:t,itemIdPath:i}=this;t.addMany(this._defaultHiddenFields),this._set("store",new u),this._set("grid",new c({itemIdPath:i,viewModel:this}))}initialize(){const e=async()=>{this.messages=await f("esri/widgets/FeatureTable/t9n/FeatureTable"),this.messagesCommon=await f("esri/t9n/common")};e(),this.handles.add([p(e),o(this,"grid.selectedItems","change",(e=>this._onSelectionChange(e))),l(this,"relatedRecordsEnabled",(e=>this.store.relatedRecordsEnabled=e)),l(this,["layer.loaded"],(()=>{var e;null!=(e=this.layer)&&e.loaded&&this._onLayerLoad()})),l(this.store,"state",(e=>{var t;"loaded"===e&&(null==(t=this.grid)||t.scrollToTop())})),l(this,["editingEnabled","messages"],(()=>{var e;return(null==(e=this.layer)?void 0:e.loaded)&&this._generateColumns()})),l(this,"layer.definitionExpression",((e,t)=>(e||t)&&"loaded"===this.store.state&&this.refresh()))])}destroy(){var e,t;this._resetColumns(),this.handles.removeAll(),this._highlights.removeAll(),this._highlights.destroy(),null==(e=this.grid)||e.destroy(),null==(t=this.columns)||t.destroy(),this.layer=null,this.view=null}set attachmentsEnabled(e){this.attachmentsEnabled!==e&&(this._set("attachmentsEnabled",e),this._generateColumns(),this.store.attachmentsEnabled=e)}set fieldConfigs(e){var t;this._set("fieldConfigs",e),(null==(t=this.layer)?void 0:t.loaded)&&this._generateColumns()}set filterGeometry(e){(this.filterGeometry||e)&&(this.clearSelection(),this._set("filterGeometry",e),this.store.filterGeometry=e)}set layer(e){var t;this._set("layer",e),null==(t=this.grid)||t.clearSort(),this._resetColumns(),this.store.layer=e,e&&(e.loaded?this._onLayerLoad():e.load()),this.notifyChange("state")}set messages(e){var t;null==(t=this.grid)||t.set("messages",e),this._set("messages",e)}clearHighlights(){this._highlights.removeAll()}clearSelection(){var e;null==(e=this.grid)||e.clearSelection()}deselectRows(e){const t=this._getStoreItemsFromSelectionParams(e);this.grid.deselectRows(t)}getObjectIdIndex(e){var t;return null==(t=this.store)?void 0:t.getObjectIdIndex(e)}getValue(e,t){var s;const i=this.store.getItemByObjectId(e);return null==i||null==(s=i.feature)?void 0:s.attributes[t]}refresh(){var e;null==(e=this.grid)||e.refresh()}selectRows(e){const t=this._getStoreItemsFromSelectionParams(e);this.grid.selectRows(t)}scrollToIndex(e){var t;null==(t=this.grid)||t.scrollToIndex(e)}_onLayerLoad(){const e=this.layer.capabilities.query.maxRecordCount;e&&e<this.pageSize&&this.grid&&(this.grid.pageSize=e),this._generateColumns()}_generateColumns(){this._resetColumns(),this.columns.addMany([...this._createFieldColumns()]),this.attachmentsEnabled&&this.columns.push(this._createAttachmentsColumn())}_createFieldColumns(){return this.fieldConfigs&&this.fieldConfigs.length?this._createColumnsFromConfigs():this._createColumnsFromFields()}_createColumnsFromConfigs(){var e,t;const{editingEnabled:s,fieldConfigs:i,grid:r,hiddenFields:o,layer:l,messages:a,messagesCommon:n,store:d}=this,h=null!=(e=null==(t=this.layer)?void 0:t.fields)?e:[];return i.filter((e=>(h||[]).find((t=>e.name===t.name)))).map((e=>{const t=e.direction||null,i=e.formatFunction||null,c=e.textAlign||null,g=(h||[]).find((t=>e.name===t.name)),u=!1===e.visible||!0!==e.visible&&o.indexOf(g.name)>-1;return new m({config:e,direction:t,editingEnabled:s,field:g,formatFunction:i,grid:r,hidden:u,layer:l,store:d,messages:a,messagesCommon:n,textAlign:c})}))}_createColumnsFromFields(){var e,t;const{editingEnabled:s,grid:i,hiddenFields:r,layer:o,messages:l,messagesCommon:a,store:n}=this;return(null!=(e=null==(t=this.layer)?void 0:t.fields)?e:[]).map((e=>{const t=r.indexOf(e.name)>-1;return new m({editingEnabled:s,field:e,grid:i,hidden:t,layer:o,store:n,messages:l,messagesCommon:a})}))}_createAttachmentsColumn(){var e;return new h({header:null==(e=this.messages)?void 0:e.attachments})}_sortOrdersToLayerOrderByFields(e){return e&&e.length?e.filter(((e,t,s)=>s.map((e=>e.path)).indexOf(e.path)===t)).filter((({direction:e})=>!!e)).map((({direction:e,path:t})=>t+" "+e.toUpperCase())):[]}_highlight(e){const{view:t}=this,s=t&&e&&t.allLayerViews.items.find((({layer:t})=>t===e.layer));d(s)&&this._highlights.add(s.highlight(e),`feature-${e.getObjectId()}`)}_unhighlight(e){e&&this._highlights.remove(`feature-${e.getObjectId()}`)}_getStoreItemsFromSelectionParams(e){const s=[];return(e=e instanceof Array?e:[e]).forEach((e=>{let i=e instanceof t?e:null;const r=i?i.getObjectId():e;if("number"==typeof r||"string"==typeof r){if(!i){const e=this.store.getItemByObjectId(r);e&&(i=e.feature)}s.push({objectId:r,feature:i})}})),s}_onSelectionChange(e){const{highlightOnRowSelectEnabled:t}=this,{added:s,removed:i}=e;t&&s.forEach((e=>this._highlight(e.feature))),t&&i.forEach((e=>this._unhighlight(e.feature)))}_resetColumns(){this.columns.items.forEach((e=>e.destroy())),this.columns.removeAll()}};e([a()],y.prototype,"attachmentsEnabled",null),e([a()],y.prototype,"cellClassNameGenerator",void 0),e([a()],y.prototype,"dataProvider",void 0),e([a()],y.prototype,"editingEnabled",void 0),e([a()],y.prototype,"fieldConfigs",null),e([a()],y.prototype,"filterGeometry",null),e([a({readOnly:!0})],y.prototype,"grid",void 0),e([a()],y.prototype,"hiddenFields",void 0),e([a()],y.prototype,"highlightOnRowSelectEnabled",void 0),e([a({readOnly:!0})],y.prototype,"itemIdPath",void 0),e([a()],y.prototype,"layer",null),e([a()],y.prototype,"messages",null),e([a()],y.prototype,"messagesCommon",void 0),e([a()],y.prototype,"relatedRecordsEnabled",void 0),e([a({readOnly:!0,type:u})],y.prototype,"store",void 0),e([a()],y.prototype,"view",void 0),y=e([n("esri.widgets.FeatureTable.FeatureTableViewModel")],y);const v=y;export{v as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import"../../intl.js";import s from"../../core/Collection.js";import{HandleOwnerMixin as i}from"../../core/HandleOwner.js";import r from"../../core/Handles.js";import{on as o,watch as l}from"../../core/watchUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{highlightsSupported as d}from"../../views/support/layerViewUtils.js";import h from"./AttachmentsColumn.js";import m from"./FieldColumn.js";import c from"./Grid/Grid.js";import g from"./Grid/GridViewModel.js";import u from"./support/FeatureStore.js";import{onLocaleChange as p}from"../../intl/locale.js";import{fetchMessageBundle as f}from"../../intl/messages.js";let y=class extends(i(g)){constructor(e){super(e),this._defaultHiddenFields=["CreationDate","Creator","EditDate","Editor","GlobalID"],this._highlights=new r,this.activeFilters=new s,this.cellClassNameGenerator=(e,t)=>e.path||null,this.dataProvider=async(e,t)=>{const{store:s}=this,{page:i,pageSize:r,sortOrders:o}=e,l=this._sortOrdersToLayerOrderByFields(o);t&&(s?(await s.set({orderByFields:l}),"loaded"!==s.state&&"loading"!==s.state&&await s.load(),t&&t(await s.fetchItems({page:i,pageSize:r}))):t&&t([]))},this.editingEnabled=!1,this.grid=null,this.hiddenFields=new s,this.highlightOnRowSelectEnabled=!0,this.itemIdPath="objectId",this.messagesCommon=null,this.relatedRecordsEnabled=!1,this.store=null,this.view=null;const{hiddenFields:t,itemIdPath:i}=this;t.addMany(this._defaultHiddenFields),this._set("store",new u),this._set("grid",new c({itemIdPath:i,viewModel:this}))}initialize(){const e=async()=>{this.messages=await f("esri/widgets/FeatureTable/t9n/FeatureTable"),this.messagesCommon=await f("esri/t9n/common")};e(),this.handles.add([p(e),o(this,"grid.selectedItems","change",(e=>this._onSelectionChange(e))),l(this,"relatedRecordsEnabled",(e=>this.store.relatedRecordsEnabled=e)),l(this,["layer.loaded"],(()=>{var e;null!=(e=this.layer)&&e.loaded&&this._onLayerLoad()})),l(this.store,"state",(e=>{var t;"loaded"===e&&(null==(t=this.grid)||t.scrollToTop())})),l(this,["editingEnabled","messages"],(()=>{var e;return(null==(e=this.layer)?void 0:e.loaded)&&this._generateColumns()})),l(this,"layer.definitionExpression",((e,t)=>(e||t)&&"loaded"===this.store.state&&this.refresh()))])}destroy(){var e,t;this._resetColumns(),this.handles.removeAll(),this._highlights.removeAll(),this._highlights.destroy(),null==(e=this.grid)||e.destroy(),null==(t=this.columns)||t.destroy(),this.layer=null,this.view=null}set attachmentsEnabled(e){this.attachmentsEnabled!==e&&(this._set("attachmentsEnabled",e),this._generateColumns(),this.store.attachmentsEnabled=e)}set fieldConfigs(e){var t;this._set("fieldConfigs",e),(null==(t=this.layer)?void 0:t.loaded)&&this._generateColumns()}set filterGeometry(e){if(!this.filterGeometry&&!e)return;const t=this.activeFilters.find((e=>"geometry"===e.type));t&&this.activeFilters.remove(t),this.clearSelection(),this._set("filterGeometry",e),this.store.filterGeometry=e,e&&this.activeFilters.add({type:"geometry",geometry:e})}set layer(e){var t;this._set("layer",e),null==(t=this.grid)||t.clearSort(),this._resetColumns(),this.store.layer=e,e&&(e.loaded?this._onLayerLoad():e.load()),this.notifyChange("state")}set messages(e){var t;null==(t=this.grid)||t.set("messages",e),this._set("messages",e)}clearHighlights(){this._highlights.removeAll()}clearSelection(){var e;null==(e=this.grid)||e.clearSelection()}deselectRows(e){const t=this._getStoreItemsFromSelectionParams(e);this.grid.deselectRows(t)}getObjectIdIndex(e){var t;return null==(t=this.store)?void 0:t.getObjectIdIndex(e)}getValue(e,t){var s;const i=this.store.getItemByObjectId(e);return null==i||null==(s=i.feature)?void 0:s.attributes[t]}refresh(){var e;null==(e=this.grid)||e.refresh()}selectRows(e){const t=this._getStoreItemsFromSelectionParams(e);this.grid.selectRows(t)}scrollToIndex(e){var t;null==(t=this.grid)||t.scrollToIndex(e)}filterBySelection(){const e=this.grid.selectedItems.map((e=>e.objectId));e.length&&(this.removeSelectionFilter(),e.length&&(this.store.objectIds=e.items,this.activeFilters.add({type:"selection",objectIds:e.items})))}removeSelectionFilter(){this.clearSelection(),this.store.objectIds=null;const e=this.activeFilters.find((e=>"selection"===e.type));e&&this.activeFilters.remove(e)}_onLayerLoad(){const e=this.layer.capabilities.query.maxRecordCount;e&&e<this.pageSize&&this.grid&&(this.grid.pageSize=e),this._generateColumns()}_generateColumns(){this._resetColumns(),this.columns.addMany([...this._createFieldColumns()]),this.attachmentsEnabled&&this.columns.push(this._createAttachmentsColumn())}_createFieldColumns(){return this.fieldConfigs&&this.fieldConfigs.length?this._createColumnsFromConfigs():this._createColumnsFromFields()}_createColumnsFromConfigs(){var e,t;const{editingEnabled:s,fieldConfigs:i,grid:r,hiddenFields:o,layer:l,messages:a,messagesCommon:n,store:d}=this,h=null!=(e=null==(t=this.layer)?void 0:t.fields)?e:[];return i.filter((e=>(h||[]).find((t=>e.name===t.name)))).map((e=>{const t=e.direction||null,i=e.formatFunction||null,c=e.textAlign||null,g=(h||[]).find((t=>e.name===t.name)),u=!1===e.visible||!0!==e.visible&&o.indexOf(g.name)>-1;return new m({config:e,direction:t,editingEnabled:s,field:g,formatFunction:i,grid:r,hidden:u,layer:l,store:d,messages:a,messagesCommon:n,textAlign:c})}))}_createColumnsFromFields(){var e,t;const{editingEnabled:s,grid:i,hiddenFields:r,layer:o,messages:l,messagesCommon:a,store:n}=this;return(null!=(e=null==(t=this.layer)?void 0:t.fields)?e:[]).map((e=>{const t=r.indexOf(e.name)>-1;return new m({editingEnabled:s,field:e,grid:i,hidden:t,layer:o,store:n,messages:l,messagesCommon:a})}))}_createAttachmentsColumn(){var e;return new h({header:null==(e=this.messages)?void 0:e.attachments})}_sortOrdersToLayerOrderByFields(e){return e&&e.length?e.filter(((e,t,s)=>s.map((e=>e.path)).indexOf(e.path)===t)).filter((({direction:e})=>!!e)).map((({direction:e,path:t})=>t+" "+e.toUpperCase())):[]}_highlight(e){const{view:t}=this,s=t&&e&&t.allLayerViews.items.find((({layer:t})=>t===e.layer));d(s)&&this._highlights.add(s.highlight(e),`feature-${e.getObjectId()}`)}_unhighlight(e){e&&this._highlights.remove(`feature-${e.getObjectId()}`)}_getStoreItemsFromSelectionParams(e){const s=[];return(e=e instanceof Array?e:[e]).forEach((e=>{let i=e instanceof t?e:null;const r=i?i.getObjectId():e;if("number"==typeof r||"string"==typeof r){if(!i){const e=this.store.getItemByObjectId(r);e&&(i=e.feature)}s.push({objectId:r,feature:i})}})),s}_onSelectionChange(e){const{highlightOnRowSelectEnabled:t}=this,{added:s,removed:i}=e;t&&s.forEach((e=>this._highlight(e.feature))),t&&i.forEach((e=>this._unhighlight(e.feature)))}_resetColumns(){this.columns.items.forEach((e=>e.destroy())),this.columns.removeAll()}};e([a()],y.prototype,"attachmentsEnabled",null),e([a()],y.prototype,"cellClassNameGenerator",void 0),e([a()],y.prototype,"dataProvider",void 0),e([a()],y.prototype,"editingEnabled",void 0),e([a()],y.prototype,"fieldConfigs",null),e([a()],y.prototype,"filterGeometry",null),e([a({readOnly:!0})],y.prototype,"grid",void 0),e([a()],y.prototype,"hiddenFields",void 0),e([a()],y.prototype,"highlightOnRowSelectEnabled",void 0),e([a({readOnly:!0})],y.prototype,"itemIdPath",void 0),e([a()],y.prototype,"layer",null),e([a()],y.prototype,"messages",null),e([a()],y.prototype,"messagesCommon",void 0),e([a()],y.prototype,"relatedRecordsEnabled",void 0),e([a({readOnly:!0,type:u})],y.prototype,"store",void 0),e([a()],y.prototype,"view",void 0),y=e([n("esri.widgets.FeatureTable.FeatureTableViewModel")],y);const v=y;export{v as default};
@@ -956,4 +956,4 @@ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Col
956
956
  <template class="header" id="headerTemplate">
957
957
  <vaadin-grid-sorter path="[[path]]" direction="{{direction}}">[[_getHeader(header, path)]]</vaadin-grid-sorter>
958
958
  </template>
959
- `}static get is(){return"vaadin-grid-sort-column"}static get properties(){return{path:String,direction:{type:String,notify:!0}}}_prepareHeaderTemplate(){const e=this._prepareTemplatizer(this.$.headerTemplate);return e.templatizer.dataHost=this,e}_getHeader(e,t){return e||this._generateHeader(t)}}customElements.define(Ka.is,Ka);const Qa={selectionColumn:!0,columnMenus:!0},el={base:"esri-grid",content:"esri-grid__content",grid:"esri-grid__grid",noColumnMenu:"esri-grid--no-column-menu",widget:"esri-widget"};let tl=class extends(s(c)){constructor(e,i){super(e,i),this._grid=null,this._headerStyles="display: flex; font-weight: 400;",this._hostStyles='font-family: "Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 1em; background-color: inherit; color: inherit;',this._rowHoverStyles="background-color: var(--lumo-row-background-hover);",this._columnElements=[],this.cellClassNameGenerator=null,this.columnReorderingEnabled=!0,this.dataProvider=null,this.itemIdPath=null,this.label=void 0,this.messages=null,this.pageSize=50,this.selectedItems=new t,this.size=null,this.rowDetailsRenderer=null,this.store=null,this.viewModel=new u,this.visibleElements={...Qa}}initialize(){this.handles.add([this.columns.on("change",(()=>this._syncColumnRenderers())),n(this,"viewModel.size",(()=>this._updateGridSize())),n(this,"store.state",((e,t)=>{"ready"!==e||"loaded"!==t&&"error"!==t||this.refreshCache()})),o(this,"_grid.$.table","scroll",(()=>{var e;null==(e=this.viewModel)||e.closeColumnMenus()}))])}destroy(){var e;this.handles.removeAll(),this.resetColumns(),null==(e=this.columns)||e.destroy()}resetColumns(){this.columns.items.forEach((e=>e.destroy())),this.columns.removeAll()}castVisibleElements(e){return{...Qa,...e}}render(){const{columnMenus:e}=this.visibleElements;return m("div",{bind:this,class:this.classes(el.base,el.widget,{[el.noColumnMenu]:!e})},m("div",{bind:this,class:el.content},this.renderGrid()))}renderGrid(){return m("vaadin-grid",{...this.getGridProps()},this.renderAllColumns())}renderAllColumns(){if("disabled"!==this.viewModel.state&&this.columns&&this.columns.length)return[this.renderSelectionColumn(),this.renderColumns()]}renderSelectionColumn(){return m("vaadin-grid-selection-column",{_selectAllHidden:!0,selectAll:!1,bind:this,hidden:!this.visibleElements.selectionColumn,sortable:!1,frozen:!p(this.container)})}renderColumns(){return this.columns.items.map(((e,t)=>m("vaadin-grid-column",{...this.getColumnProps(e,t)})))}getGridProps(){const{columnReorderingEnabled:e,id:t,pageSize:i,size:s}=this;return{_safari:!1,class:el.grid,id:`${t}_grid`,theme:"compact column-borders",ref:"grid",bind:this,afterCreate:this._afterGridCreate,afterUpdate:this._afterGridUpdate,columnReorderingAllowed:e,pageSize:i,size:s}}getColumnProps(e,t){const{id:i}=this,{autoWidth:s,direction:n,flexGrow:o,frozen:a,header:l,hidden:d,path:h,resizable:c,textAlign:u,width:p}=e;return{autoWidth:s,direction:n,flexGrow:o,frozen:a,header:l,hidden:d,key:`${i}_${l}_${r(t)?t:h}`,path:h,resizable:c,"text-align":u,width:"number"==typeof p?`${p}px`:p,bind:this,afterCreate:this._afterColumnCreate,afterRemoved:this._afterColumnRemoved}}clearSelection(){this._clearSelection(),this.scheduleRender()}clearSort(){let e=!1;if(this._grid&&this._grid._sorters&&this._grid._sorters.length&&(this._grid._sorters=[],e=!0),this.columns&&this.columns.length){!!this.columns.find((e=>!!e.direction))&&(this.columns.forEach((e=>e.direction=null)),e=!0)}e&&this.scheduleRender()}deselectItem(e){this._deselectRowByItem(e)}deselectRow(e){const t=this.viewModel.getRowItemAt(e);t&&this._deselectRowByItem(t)}findColumn(){}generateCellClassNames(){var e;null==(e=this._grid)||e.generateCellClassNames()}getSlotElementByName(e){var t,i;return null==(t=this._grid)||null==(i=t.shadowRoot)?void 0:i.querySelector(`slot[name='${e}']`)}hideColumn(e){var t;null==(t=this.viewModel)||t.hideColumn(e),this.scheduleRender()}notifyResize(){var e;null==(e=this._grid)||e.notifyResize()}recalculateColumnWidths(){var e;null==(e=this._grid)||e.recalculateColumnWidths()}async refresh(){var e;this._clearSelection(),await(null==(e=this.store)?void 0:e.reset()),this.scrollToTop()}refreshCache(){var e;null==(e=this._grid)||e.clearCache()}selectRows(e){const t=this._grid.selectedItems.slice();e.forEach((e=>{t.findIndex((t=>t.objectId===e.objectId))<0&&this._grid.selectedItems.push(e)})),this._updateSelectionProps(),this._grid.render()}deselectRows(e){const t=this._grid.selectedItems.slice();e.forEach((e=>{const i=t.findIndex((t=>t.objectId===e.objectId));i>-1&&t.splice(i,1)})),this._grid.selectedItems=t,this._updateSelectionProps(),this._grid.render()}selectItem(e){this._selectRowByItem(e)}selectRow(e){const t=this.viewModel.getRowItemAt(e);t&&this._selectRowByItem(t)}showColumn(e){var t;null==(t=this.viewModel)||t.showColumn(e),this.scheduleRender()}sort({path:e,direction:t}){var i;null==(i=this.viewModel)||i.sortColumn(e,t)}scrollToIndex(e){var t;null==(t=this._grid)||t.scrollToIndex(e)}scrollToTop(){var e;null==(e=this._grid)||e.scrollToIndex(0)}_afterGridCreate(e){const{cellClassNameGenerator:t,dataProvider:i,itemIdPath:s,rowDetailsRenderer:r}=this;e.cellClassNameGenerator=t,e.dataProvider=i,e.rowDetailsRenderer=r,e.itemIdPath=s,this._grid=e,customElements.whenDefined("vaadin-grid").then((()=>{this._appendStyles(),this._addGridEventListeners()}))}_afterGridUpdate(e){this._grid||(this._grid=e)}_afterColumnCreate(e){this._applyRenderersToColumnElement(e),this._columnElements.push(e)}_afterColumnRemoved(e){const t=this._columnElements.indexOf(e,0);t>-1&&this._columnElements.splice(t,1)}_syncColumnRenderers(){this._columnElements.forEach((e=>this._applyRenderersToColumnElement(e)))}_appendStyles(){var e;const t=null==(e=this._grid)?void 0:e.shadowRoot,i=document.createElement("style");i.textContent=`\n :host { ${this._hostStyles} }\n [part~="header-cell"] ::slotted(vaadin-grid-cell-content) { ${this._headerStyles} }\n [part~="row"]:hover [part~="body-cell"] { ${this._rowHoverStyles} }\n `,null==t||t.appendChild(i)}_updateGridSize(){this._grid&&(this._grid.size=this.size||0,this.scheduleRender())}_addGridEventListeners(){const{_grid:e}=this;this.handles.add([i(e,"click",(e=>this._onRowClick(e))),i(e,"selected-items-changed",(e=>this._onSelectionChange(e)))])}_onRowClick(e){const{_grid:t}=this,i=t.getEventContext(e),{item:s,section:r}=i;s&&r&&"details"!==r&&"header"!==r&&this.emit("row-click",{context:i,native:e})}_selectRowByItem(e){var t;null==(t=this._grid)||t.selectItem(e)}_deselectRowByItem(e){var t;null==(t=this._grid)||t.deselectItem(e)}_clearSelection(){var e,t;null!=(e=this._grid)&&null!=(t=e.selectedItems)&&t.length&&(this._grid.selectedItems=[],this._updateSelectionProps(),this._grid.render())}_onSelectionChange(e){const t=e;if("selectedItems.splices"===t.detail.path){const{removed:e,index:i,object:s}=t.detail.value.indexSplices[0];this._updateSelectionProps(),this.emit("selection-change",{index:i,added:s,removed:e})}}_updateSelectionProps(){this.selectedItems.length&&this.selectedItems.removeAll(),this._grid&&this.selectedItems.addMany(this._grid.selectedItems)}_applyRenderersToColumnElement(e){const t=e.getAttribute("path"),i=this.viewModel.findColumn(t);if(i)try{i.renderFunction&&(e.renderer=(e,t,s)=>i.renderFunction({root:e,column:t,rowData:s})),i.footerRenderFunction&&(e.footerRenderer=(e,t)=>i.footerRenderFunction({root:e,column:t})),i.headerRenderFunction&&(e.headerRenderer=(e,t)=>i.headerRenderFunction({root:e,column:t}))}catch(s){}}};e([d()],tl.prototype,"_grid",void 0),e([a("viewModel.cellClassNameGenerator")],tl.prototype,"cellClassNameGenerator",void 0),e([a("viewModel.columns")],tl.prototype,"columns",void 0),e([a("viewModel.columnReorderingEnabled")],tl.prototype,"columnReorderingEnabled",void 0),e([a("viewModel.dataProvider")],tl.prototype,"dataProvider",void 0),e([d()],tl.prototype,"itemIdPath",void 0),e([d({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],tl.prototype,"label",void 0),e([d(),_("esri/widgets/FeatureTable/t9n/FeatureTable")],tl.prototype,"messages",void 0),e([a("viewModel.pageSize")],tl.prototype,"pageSize",void 0),e([d({readOnly:!0})],tl.prototype,"selectedItems",void 0),e([a("viewModel.size")],tl.prototype,"size",void 0),e([a("viewModel.rowDetailsRenderer")],tl.prototype,"rowDetailsRenderer",void 0),e([a("viewModel.store")],tl.prototype,"store",void 0),e([d()],tl.prototype,"viewModel",void 0),e([d()],tl.prototype,"visibleElements",void 0),e([l("visibleElements")],tl.prototype,"castVisibleElements",null),e([a("viewModel.findColumn")],tl.prototype,"findColumn",null),tl=e([h("esri.widgets.FeatureTable.Grid.Grid")],tl);const il=tl;export{il as default};
959
+ `}static get is(){return"vaadin-grid-sort-column"}static get properties(){return{path:String,direction:{type:String,notify:!0}}}_prepareHeaderTemplate(){const e=this._prepareTemplatizer(this.$.headerTemplate);return e.templatizer.dataHost=this,e}_getHeader(e,t){return e||this._generateHeader(t)}}customElements.define(Ka.is,Ka);const Qa={selectionColumn:!0,columnMenus:!0},el={base:"esri-grid",content:"esri-grid__content",grid:"esri-grid__grid",noColumnMenu:"esri-grid--no-column-menu",widget:"esri-widget"};let tl=class extends(s(c)){constructor(e,i){super(e,i),this._grid=null,this._headerStyles="display: flex; font-weight: 400;",this._hostStyles='font-family: "Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 1em; background-color: inherit; color: inherit;',this._rowHoverStyles="background-color: var(--lumo-row-background-hover);",this._columnElements=[],this.cellClassNameGenerator=null,this.columnReorderingEnabled=!0,this.dataProvider=null,this.itemIdPath=null,this.label=void 0,this.messages=null,this.pageSize=50,this.selectedItems=new t,this.size=null,this.rowDetailsRenderer=null,this.store=null,this.viewModel=new u,this.visibleElements={...Qa}}initialize(){this.handles.add([this.columns.on("change",(()=>this._syncColumnRenderers())),n(this,"viewModel.size",(()=>this._updateGridSize())),n(this,"store.state",((e,t)=>{"ready"!==e||"loaded"!==t&&"error"!==t||this.refreshCache()})),o(this,"_grid.$.table","scroll",(()=>{var e;null==(e=this.viewModel)||e.closeColumnMenus()}))])}destroy(){var e;this.handles.removeAll(),this.resetColumns(),null==(e=this.columns)||e.destroy()}resetColumns(){this.columns.items.forEach((e=>e.destroy())),this.columns.removeAll()}castVisibleElements(e){return{...Qa,...e}}render(){const{columnMenus:e}=this.visibleElements;return m("div",{bind:this,class:this.classes(el.base,el.widget,{[el.noColumnMenu]:!e})},m("div",{bind:this,class:el.content},this.renderGrid()))}renderGrid(){return m("vaadin-grid",{...this.getGridProps()},this.renderAllColumns())}renderAllColumns(){if("disabled"!==this.viewModel.state&&this.columns&&this.columns.length)return[this.renderSelectionColumn(),this.renderColumns()]}renderSelectionColumn(){return m("vaadin-grid-selection-column",{_selectAllHidden:!0,selectAll:!1,bind:this,hidden:!this.visibleElements.selectionColumn,sortable:!1,frozen:!p(this.container)})}renderColumns(){return this.columns.items.map(((e,t)=>m("vaadin-grid-column",{...this.getColumnProps(e,t)})))}getGridProps(){const{columnReorderingEnabled:e,id:t,pageSize:i,size:s}=this;return{_safari:!1,class:el.grid,id:`${t}_grid`,theme:"compact column-borders",ref:"grid",bind:this,afterCreate:this._afterGridCreate,afterUpdate:this._afterGridUpdate,columnReorderingAllowed:e,pageSize:i,size:s}}getColumnProps(e,t){const{id:i}=this,{autoWidth:s,direction:n,flexGrow:o,frozen:a,header:l,hidden:d,path:h,resizable:c,textAlign:u,width:p}=e;return{autoWidth:s,direction:n,flexGrow:o,frozen:a,header:l,hidden:d,key:`${i}_${l}_${r(t)?t:h}`,path:h,resizable:c,"text-align":u,width:"number"==typeof p?`${p}px`:p,bind:this,afterCreate:this._afterColumnCreate,afterRemoved:this._afterColumnRemoved}}clearSelection(){this._clearSelection(),this.scheduleRender()}clearSort(){let e=!1;if(this._grid&&this._grid._sorters&&this._grid._sorters.length&&(this._grid._sorters=[],e=!0),this.columns&&this.columns.length){!!this.columns.find((e=>!!e.direction))&&(this.columns.forEach((e=>e.direction=null)),e=!0)}e&&this.scheduleRender()}deselectItem(e){this._deselectRowByItem(e)}deselectRow(e){const t=this.viewModel.getRowItemAt(e);t&&this._deselectRowByItem(t)}findColumn(){}generateCellClassNames(){var e;null==(e=this._grid)||e.generateCellClassNames()}getSlotElementByName(e){var t,i;return null==(t=this._grid)||null==(i=t.shadowRoot)?void 0:i.querySelector(`slot[name='${e}']`)}hideColumn(e){var t;null==(t=this.viewModel)||t.hideColumn(e),this.scheduleRender()}notifyResize(){var e;null==(e=this._grid)||e.notifyResize()}recalculateColumnWidths(){var e;null==(e=this._grid)||e.recalculateColumnWidths()}async refresh(){var e;this._clearSelection(),await(null==(e=this.store)?void 0:e.reset()),this.scrollToTop()}refreshCache(){var e;null==(e=this._grid)||e.clearCache()}selectRows(e){const t=this._grid.selectedItems.slice();e.forEach((e=>{t.findIndex((t=>t.objectId===e.objectId))<0&&this._grid.selectedItems.push(e)})),this._updateSelectionProps(),this._grid.render()}deselectRows(e){const t=this._grid.selectedItems.slice();e.forEach((e=>{const i=t.findIndex((t=>t.objectId===e.objectId));i>-1&&t.splice(i,1)})),this._grid.selectedItems=t,this._updateSelectionProps(),this._grid.render()}selectItem(e){this._selectRowByItem(e)}selectRow(e){const t=this.viewModel.getRowItemAt(e);t&&this._selectRowByItem(t)}showColumn(e){var t;null==(t=this.viewModel)||t.showColumn(e),this.scheduleRender()}sort({path:e,direction:t}){var i;null==(i=this.viewModel)||i.sortColumn(e,t)}scrollToIndex(e){var t;null==(t=this._grid)||t.scrollToIndex(e)}scrollToTop(){var e;null==(e=this._grid)||e.scrollToIndex(0)}_afterGridCreate(e){const{cellClassNameGenerator:t,dataProvider:i,itemIdPath:s,rowDetailsRenderer:r}=this;e.cellClassNameGenerator=t,e.dataProvider=i,e.rowDetailsRenderer=r,e.itemIdPath=s,this._grid=e,customElements.whenDefined("vaadin-grid").then((()=>{this._appendStyles(),this._addGridEventListeners()}))}_afterGridUpdate(e){this._grid||(this._grid=e)}_afterColumnCreate(e){this._applyRenderersToColumnElement(e),this._columnElements.push(e)}_afterColumnRemoved(e){const t=this._columnElements.indexOf(e,0);t>-1&&this._columnElements.splice(t,1)}_syncColumnRenderers(){this._columnElements.forEach((e=>this._applyRenderersToColumnElement(e)))}_appendStyles(){var e;const t=null==(e=this._grid)?void 0:e.shadowRoot,i=document.createElement("style");i.textContent=`\n :host { ${this._hostStyles} }\n [part~="header-cell"] ::slotted(vaadin-grid-cell-content) { ${this._headerStyles} }\n [part~="row"]:hover [part~="body-cell"] { ${this._rowHoverStyles} }\n `,null==t||t.appendChild(i)}_updateGridSize(){this._grid&&(this._grid.size=this.size||0,this.scheduleRender())}_addGridEventListeners(){const{_grid:e}=this;this.handles.add([i(e,"click",(e=>this._onRowClick(e))),i(e,"selected-items-changed",(e=>this._onSelectionChange(e)))])}_onRowClick(e){const{_grid:t}=this,i=t.getEventContext(e),{item:s,section:r}=i;s&&r&&"details"!==r&&"header"!==r&&this.emit("row-click",{context:i,native:e})}_selectRowByItem(e){var t;null==(t=this._grid)||t.selectItem(e)}_deselectRowByItem(e){var t;null==(t=this._grid)||t.deselectItem(e)}_clearSelection(){this._grid.selectedItems=[],this._updateSelectionProps(),this._grid.render()}_onSelectionChange(e){const t=e;if("selectedItems.splices"===t.detail.path){const{removed:e,index:i,object:s}=t.detail.value.indexSplices[0];this._updateSelectionProps(),this.emit("selection-change",{index:i,added:s,removed:e})}}_updateSelectionProps(){this.selectedItems.length&&this.selectedItems.removeAll(),this._grid&&this.selectedItems.addMany(this._grid.selectedItems)}_applyRenderersToColumnElement(e){const t=e.getAttribute("path"),i=this.viewModel.findColumn(t);if(i)try{i.renderFunction&&(e.renderer=(e,t,s)=>i.renderFunction({root:e,column:t,rowData:s})),i.footerRenderFunction&&(e.footerRenderer=(e,t)=>i.footerRenderFunction({root:e,column:t})),i.headerRenderFunction&&(e.headerRenderer=(e,t)=>i.headerRenderFunction({root:e,column:t}))}catch(s){}}};e([d()],tl.prototype,"_grid",void 0),e([a("viewModel.cellClassNameGenerator")],tl.prototype,"cellClassNameGenerator",void 0),e([a("viewModel.columns")],tl.prototype,"columns",void 0),e([a("viewModel.columnReorderingEnabled")],tl.prototype,"columnReorderingEnabled",void 0),e([a("viewModel.dataProvider")],tl.prototype,"dataProvider",void 0),e([d()],tl.prototype,"itemIdPath",void 0),e([d({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],tl.prototype,"label",void 0),e([d(),_("esri/widgets/FeatureTable/t9n/FeatureTable")],tl.prototype,"messages",void 0),e([a("viewModel.pageSize")],tl.prototype,"pageSize",void 0),e([d({readOnly:!0})],tl.prototype,"selectedItems",void 0),e([a("viewModel.size")],tl.prototype,"size",void 0),e([a("viewModel.rowDetailsRenderer")],tl.prototype,"rowDetailsRenderer",void 0),e([a("viewModel.store")],tl.prototype,"store",void 0),e([d()],tl.prototype,"viewModel",void 0),e([d()],tl.prototype,"visibleElements",void 0),e([l("visibleElements")],tl.prototype,"castVisibleElements",null),e([a("viewModel.findColumn")],tl.prototype,"findColumn",null),tl=e([h("esri.widgets.FeatureTable.Grid.Grid")],tl);const il=tl;export{il as default};