@arcgis/core 4.31.0-next.20240919 → 4.31.0-next.20240921

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 (283) hide show
  1. package/WebDocument2D.js +1 -1
  2. package/WebLinkChart.js +1 -1
  3. package/WebMap.js +1 -1
  4. package/applications/SceneViewer/sceneViewerUtils.js +1 -1
  5. package/arcade/featureset/actions/Adapted.js +1 -1
  6. package/arcade/featureset/support/StatsField.js +1 -1
  7. package/arcade/featureset/support/errorsupport.js +1 -1
  8. package/arcade/featureset/support/sqlUtils.js +1 -1
  9. package/arcade/functions/maths.js +1 -1
  10. package/assets/esri/core/workers/RemoteClient.js +1 -1
  11. package/assets/esri/core/workers/chunks/{d9d8606f0a7c82b42755.js → 093a1ee161cb6a840283.js} +1 -1
  12. package/assets/esri/core/workers/chunks/2020b99675caabf5ac87.js +1 -0
  13. package/assets/esri/core/workers/chunks/24d45530fe47b3114daf.js +1 -0
  14. package/assets/esri/core/workers/chunks/35f92652df2561845d47.js +1 -0
  15. package/assets/esri/core/workers/chunks/42b92b4c2c9fd2b15f60.js +2 -0
  16. package/assets/esri/core/workers/chunks/{ba561e03df67894e437f.js.LICENSE.txt → 42b92b4c2c9fd2b15f60.js.LICENSE.txt} +1 -1
  17. package/assets/esri/core/workers/chunks/65b1d7fa57d4c764efe8.js +1 -0
  18. package/assets/esri/core/workers/chunks/{b99d380cce485e65c990.js → 6cda92678ffeeaea0330.js} +1 -1
  19. package/assets/esri/core/workers/chunks/736e0c5cb9010ca818d8.js +1 -0
  20. package/assets/esri/core/workers/chunks/757b83799555958e059c.js +1 -0
  21. package/assets/esri/core/workers/chunks/76d8192015ce46dbf92a.js +1 -0
  22. package/assets/esri/core/workers/chunks/7b4880b2dc6b01d70ccc.js +1 -0
  23. package/assets/esri/core/workers/chunks/884cd0bd036c65567929.js +1 -0
  24. package/assets/esri/core/workers/chunks/95ea77a7d63c9d7ed78b.js +1 -0
  25. package/assets/esri/core/workers/chunks/{da3a4eb3fbb9dd509b4b.js → 98e872da08203455a5b6.js} +1 -1
  26. package/assets/esri/core/workers/chunks/ad4fa125e09cc0047f5b.js +1 -0
  27. package/assets/esri/core/workers/chunks/bb5a18dd1e6a71905668.js +2 -0
  28. package/assets/esri/core/workers/chunks/bf406a46515d5dfebe06.js +1 -0
  29. package/assets/esri/core/workers/chunks/d9c34e07627d93d4670b.js +1 -0
  30. package/assets/esri/core/workers/chunks/e1e9a7695e48e34a69bd.js +1 -0
  31. package/assets/esri/core/workers/chunks/e4f1464ed269c301b4ee.js +1 -0
  32. package/assets/esri/core/workers/chunks/{072029d05ccb56979523.js → e611141692355a1ba2b2.js} +1 -1
  33. package/assets/esri/core/workers/chunks/f41e8d0d6f5e81289179.js +1 -0
  34. package/assets/esri/core/workers/chunks/f7c96d34c70ed36da7c2.js +1 -0
  35. package/assets/esri/core/workers/chunks/{5ca8e767cc03e1425338.js → f9e90a2fda559ca68848.js} +1 -1
  36. package/assets/esri/themes/base/_functions.scss +6 -2
  37. package/assets/esri/themes/base/widgets/_BasemapLayerList.scss +4 -0
  38. package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +6 -0
  39. package/assets/esri/themes/dark/main.css +1 -1
  40. package/assets/esri/themes/light/main.css +1 -1
  41. package/assets/esri/themes/light/view.css +1 -1
  42. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery.json +1 -1
  43. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ar.json +1 -1
  44. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_bg.json +1 -1
  45. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_bs.json +1 -1
  46. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ca.json +1 -1
  47. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_cs.json +1 -1
  48. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_da.json +1 -1
  49. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_de.json +1 -1
  50. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_el.json +1 -1
  51. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_en.json +1 -1
  52. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_es.json +1 -1
  53. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_et.json +1 -1
  54. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_fi.json +1 -1
  55. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_fr.json +1 -1
  56. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_he.json +1 -1
  57. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_hr.json +1 -1
  58. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_hu.json +1 -1
  59. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_id.json +1 -1
  60. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_it.json +1 -1
  61. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ja.json +1 -1
  62. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ko.json +1 -1
  63. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_lt.json +1 -1
  64. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_lv.json +1 -1
  65. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_nb.json +1 -1
  66. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_nl.json +1 -1
  67. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_pl.json +1 -1
  68. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_pt-BR.json +1 -1
  69. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_pt-PT.json +1 -1
  70. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ro.json +1 -1
  71. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ru.json +1 -1
  72. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sk.json +1 -1
  73. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sl.json +1 -1
  74. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sr.json +1 -1
  75. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sv.json +1 -1
  76. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_th.json +1 -1
  77. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_tr.json +1 -1
  78. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_uk.json +1 -1
  79. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_vi.json +1 -1
  80. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_zh-CN.json +1 -1
  81. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_zh-HK.json +1 -1
  82. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_zh-TW.json +1 -1
  83. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer.json +1 -1
  84. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ar.json +1 -1
  85. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bg.json +1 -1
  86. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bs.json +1 -1
  87. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ca.json +1 -1
  88. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_cs.json +1 -1
  89. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_da.json +1 -1
  90. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_de.json +1 -1
  91. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_el.json +1 -1
  92. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_en.json +1 -1
  93. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_es.json +1 -1
  94. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_et.json +1 -1
  95. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fi.json +1 -1
  96. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fr.json +1 -1
  97. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_he.json +1 -1
  98. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hr.json +1 -1
  99. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hu.json +1 -1
  100. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_id.json +1 -1
  101. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_it.json +1 -1
  102. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ja.json +1 -1
  103. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ko.json +1 -1
  104. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lt.json +1 -1
  105. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lv.json +1 -1
  106. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_nb.json +1 -1
  107. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_nl.json +1 -1
  108. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pl.json +1 -1
  109. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-BR.json +1 -1
  110. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-PT.json +1 -1
  111. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ro.json +1 -1
  112. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ru.json +1 -1
  113. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sk.json +1 -1
  114. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sl.json +1 -1
  115. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sr.json +1 -1
  116. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sv.json +1 -1
  117. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_th.json +1 -1
  118. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_tr.json +1 -1
  119. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_uk.json +1 -1
  120. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_vi.json +1 -1
  121. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-CN.json +1 -1
  122. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-HK.json +1 -1
  123. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-TW.json +1 -1
  124. package/chunks/Bufferer-93RDFIRm.js +5 -0
  125. package/chunks/Centroid-DZi-eb9F.js +1 -1
  126. package/chunks/ComponentShader.glsl.js +10 -13
  127. package/chunks/Distance2DCalculator-De7WFGFq.js +5 -0
  128. package/chunks/GeodeticDistanceCalculator-CN7xMqrJ.js +5 -0
  129. package/chunks/LineSeries.js +1 -1
  130. package/chunks/{OITCompositing.glsl.js → OITBlend.glsl.js} +1 -1
  131. package/chunks/OperatorGeneralize.js +1 -1
  132. package/chunks/OperatorGeodesicBuffer.js +1 -1
  133. package/chunks/OperatorGeodeticArea.js +1 -1
  134. package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
  135. package/chunks/OperatorGeodeticDistance.js +1 -1
  136. package/chunks/OperatorGeodeticLength.js +1 -1
  137. package/chunks/OperatorProximity.js +1 -1
  138. package/chunks/OperatorShapePreservingLength.js +5 -0
  139. package/chunks/Polyline.js +1 -1
  140. package/chunks/Theme.js +1 -1
  141. package/chunks/Tick.js +1 -1
  142. package/chunks/tslib.es6.js +1 -1
  143. package/core/mathUtils.js +1 -1
  144. package/core/sql/AggregateFunctions.js +1 -1
  145. package/core/sql/SqlInterval.js +1 -1
  146. package/core/sql/StandardizedFunctions.js +1 -1
  147. package/core/sql/WhereClause.js +1 -1
  148. package/core/sql/WhereGrammar.js +1 -1
  149. package/core/sql/errorSupport.js +5 -0
  150. package/core/sql/sqlArithmeticUtils.js +1 -1
  151. package/core/sql/sqlCompareUtils.js +1 -1
  152. package/core/sql/sqlDateParsingUtils.js +1 -1
  153. package/geometry/operators/areaOperator.js +5 -0
  154. package/geometry/operators/containsOperator.js +1 -1
  155. package/geometry/operators/crossesOperator.js +1 -1
  156. package/geometry/operators/disjointOperator.js +1 -1
  157. package/geometry/operators/distanceOperator.js +1 -1
  158. package/geometry/operators/equalsOperator.js +1 -1
  159. package/geometry/operators/geodeticDensifyOperator.js +5 -0
  160. package/geometry/operators/graphicBufferOperator.js +5 -0
  161. package/geometry/operators/gx/operatorAutoComplete.js +1 -1
  162. package/geometry/operators/gx/operatorBuffer.js +1 -1
  163. package/geometry/operators/gx/operatorClip.js +1 -1
  164. package/geometry/operators/gx/operatorConvexHull.js +1 -1
  165. package/geometry/operators/gx/operatorCut.js +1 -1
  166. package/geometry/operators/gx/operatorDifference.js +1 -1
  167. package/geometry/operators/gx/operatorGeodesicBuffer.js +1 -1
  168. package/geometry/operators/gx/operatorGeodeticArea.js +1 -1
  169. package/geometry/operators/gx/{operatorGeodeticDensifyByLength.js → operatorGeodeticDensify.js} +1 -1
  170. package/geometry/operators/gx/operatorGeodeticDistance.js +1 -1
  171. package/geometry/operators/gx/operatorGeodeticLength.js +1 -1
  172. package/geometry/operators/gx/operatorGraphicBuffer.js +5 -0
  173. package/geometry/operators/gx/operatorIntegrate.js +1 -1
  174. package/geometry/operators/gx/operatorIntersection.js +1 -1
  175. package/geometry/operators/gx/operatorLabelPoint.js +1 -1
  176. package/geometry/operators/gx/operatorOffset.js +1 -1
  177. package/geometry/operators/gx/operatorSimplify.js +1 -1
  178. package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
  179. package/geometry/operators/gx/operatorUnion.js +1 -1
  180. package/geometry/operators/intersectsOperator.js +1 -1
  181. package/geometry/operators/isNearOperator.js +1 -1
  182. package/geometry/operators/lengthOperator.js +5 -0
  183. package/geometry/operators/overlapsOperator.js +1 -1
  184. package/geometry/operators/proximityOperator.d.ts +4 -0
  185. package/geometry/operators/proximityOperator.js +1 -1
  186. package/geometry/operators/relateOperator.js +1 -1
  187. package/geometry/operators/reshapeOperator.js +1 -1
  188. package/geometry/operators/touchesOperator.js +1 -1
  189. package/geometry/operators/withinOperator.js +1 -1
  190. package/interfaces.d.ts +310 -28
  191. package/layers/mixins/ArcGISMapService.js +1 -1
  192. package/layers/support/ControlPointsGeoreference.js +1 -1
  193. package/layers/support/MediaElementBase.js +1 -1
  194. package/layers/support/mediaUtils.js +1 -1
  195. package/linkChart/LinkChartProperties.js +1 -1
  196. package/linkChart/utils.js +1 -1
  197. package/package.json +2 -2
  198. package/portal/schemas/definitions.js +1 -1
  199. package/support/revision.js +1 -1
  200. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  201. package/views/2d/layers/GraphicsLayerView2D.js +1 -1
  202. package/views/2d/layers/LayerView2D.js +1 -1
  203. package/views/2d/support/highlightGroupUtils.js +1 -1
  204. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  205. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  206. package/views/3d/interactive/editingTools/transform/ExtentTransformTool.js +1 -1
  207. package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
  208. package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
  209. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  210. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  211. package/views/3d/webgl-engine/effects/transparency/OITBlend.glsl.js +5 -0
  212. package/views/3d/webgl-engine/effects/transparency/OITBlend.js +5 -0
  213. package/views/3d/webgl-engine/effects/transparency/OITBlendTechnique.js +5 -0
  214. package/views/3d/webgl-engine/lib/CompositingHelper.js +1 -1
  215. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  216. package/views/LinkChartView.js +1 -1
  217. package/views/MapView.js +1 -1
  218. package/views/View.js +1 -1
  219. package/views/View2D.js +1 -1
  220. package/views/draw/DrawGraphicTool.js +1 -1
  221. package/views/draw/support/Box.js +1 -1
  222. package/views/draw/support/Reshape.js +1 -1
  223. package/views/interactive/Tooltip.d.ts +4 -0
  224. package/views/interactive/Tooltip.js +5 -0
  225. package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
  226. package/webdoc/widgets/TimeSlider.js +1 -1
  227. package/webmap/InitialViewProperties.js +1 -1
  228. package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
  229. package/widgets/BasemapGallery.js +1 -1
  230. package/widgets/BasemapLayerList/css.js +1 -1
  231. package/widgets/BasemapLayerList.js +1 -1
  232. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  233. package/widgets/BatchAttributeForm/templates/BatchAttributeFormElementTemplate.js +1 -1
  234. package/widgets/BatchAttributeForm/templates/BatchAttributeFormTemplate.js +1 -1
  235. package/widgets/BatchAttributeForm/templates/BatchFieldElementTemplate.js +1 -1
  236. package/widgets/BatchAttributeForm/templates/batchAttributeFormTemplateUtils.js +1 -1
  237. package/widgets/CatalogLayerList.js +1 -1
  238. package/widgets/Feature/FeatureMedia/pieChart.js +1 -1
  239. package/widgets/Feature/FeatureMedia/xyChart.js +1 -1
  240. package/widgets/FeatureForm/FieldInput.js +1 -1
  241. package/widgets/LayerList/LayerListItem.js +1 -1
  242. package/widgets/LayerList/LayerListViewModel.js +1 -1
  243. package/widgets/LayerList.js +1 -1
  244. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  245. package/widgets/OrientedImageryViewer/adapters/OrientedImageryViewerViewModelAdapter2D.js +1 -1
  246. package/widgets/OrientedImageryViewer/adapters/OrientedImageryViewerViewModelAdapter3D.js +1 -1
  247. package/widgets/OrientedImageryViewer/constants.js +1 -1
  248. package/widgets/OrientedImageryViewer/css.js +1 -1
  249. package/widgets/OrientedImageryViewer/utils.js +1 -1
  250. package/widgets/OrientedImageryViewer.js +1 -1
  251. package/widgets/ScaleBar/ScaleBarViewModel.js +1 -1
  252. package/widgets/Sketch/SketchViewModel.js +1 -1
  253. package/widgets/Sketch.js +1 -1
  254. package/widgets/support/SnappingControls.js +1 -1
  255. package/assets/esri/core/workers/chunks/0cfa9665dab31e5235a8.js +0 -1
  256. package/assets/esri/core/workers/chunks/22fb5687932019304225.js +0 -1
  257. package/assets/esri/core/workers/chunks/3b3c8362359a82c66793.js +0 -1
  258. package/assets/esri/core/workers/chunks/3cb1de0b9bf9a25112e0.js +0 -1
  259. package/assets/esri/core/workers/chunks/59833b27d8413b6d9312.js +0 -1
  260. package/assets/esri/core/workers/chunks/5e43cb91bbe20f2d32e3.js +0 -1
  261. package/assets/esri/core/workers/chunks/67df47efb9a9dfeafee2.js +0 -1
  262. package/assets/esri/core/workers/chunks/6be62448e33baabe028c.js +0 -1
  263. package/assets/esri/core/workers/chunks/6d668f7696f280ec9588.js +0 -1
  264. package/assets/esri/core/workers/chunks/74edde71352e1f578a3b.js +0 -1
  265. package/assets/esri/core/workers/chunks/907e74abb4a85a76e3b5.js +0 -1
  266. package/assets/esri/core/workers/chunks/941fe04f47059074c05b.js +0 -2
  267. package/assets/esri/core/workers/chunks/a0005bc65f79e83f26ee.js +0 -1
  268. package/assets/esri/core/workers/chunks/a6560ff77be29344bc50.js +0 -1
  269. package/assets/esri/core/workers/chunks/a6c3c1827d2e8bbfcd9e.js +0 -1
  270. package/assets/esri/core/workers/chunks/ba561e03df67894e437f.js +0 -2
  271. package/assets/esri/core/workers/chunks/df9daac7ea581e9e5ca4.js +0 -1
  272. package/assets/esri/core/workers/chunks/ea51a7c32f716f4f1a34.js +0 -1
  273. package/assets/esri/core/workers/chunks/ef7dcb8758e7f21d30bc.js +0 -1
  274. package/chunks/Distance2DCalculator-BzAEa8Xe.js +0 -5
  275. package/chunks/GeodeticDistanceCalculator-BS_KY66f.js +0 -5
  276. package/chunks/OperatorShapePreservingDensify.js +0 -5
  277. package/geometry/operators/geodeticDensifyByLengthOperator.js +0 -5
  278. package/geometry/operators/gx/operatorShapePreservingDensify.js +0 -5
  279. package/geometry/operators/shapePreservingDensifyOperator.js +0 -5
  280. package/views/3d/webgl-engine/shaders/OITCompositing.glsl.js +0 -5
  281. package/views/3d/webgl-engine/shaders/OITCompositingTechnique.js +0 -5
  282. package/views/interactive/tooltip/Tooltip.js +0 -5
  283. /package/assets/esri/core/workers/chunks/{941fe04f47059074c05b.js.LICENSE.txt → bb5a18dd1e6a71905668.js.LICENSE.txt} +0 -0
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[835],{87449:(e,t,n)=>{n.d(t,{D_:()=>s,L8:()=>u,Z7:()=>r,dr:()=>c});var r,a,i=n(799);(a=r||(r={})).InvalidFunctionParameters="InvalidFunctionParameters",a.InvalidValueForAggregateFunction="InvalidValueForAggregateFunction",a.UnsupportedSqlFunction="UnsupportedSqlFunction",a.UnsupportedOperator="UnsupportedOperator",a.UnsupportedSyntax="UnsupportedSyntax",a.UnsupportedIsRhs="UnsupportedIsRhs",a.UnsupportedIsLhs="UnsupportedIsLhs",a.InvalidDataType="InvalidDataType",a.CannotCastValue="CannotCastValue",a.FunctionNotRecognized="FunctionNotRecognized",a.InvalidTime="InvalidTime",a.InvalidParameterCount="InvalidParameterCount",a.InvalidTimeStamp="InvalidTimeStamp",a.InvalidDate="InvalidDate",a.InvalidOperator="InvalidOperator",a.IllegalInterval="IllegalInterval",a.YearMonthIntervals="YearMonthIntervals",a.PrimarySecondaryQualifiers="PrimarySecondaryQualifiers",a.MissingStatisticParameters="MissingStatisticParameters";const o={[r.InvalidValueForAggregateFunction]:"Invalid value used in aggregate function",[r.MissingStatisticParameters]:"Statistic does not have 1 or 0 Parameters",[r.InvalidFunctionParameters]:"Invalid parameters for call to {function}",[r.UnsupportedIsLhs]:"Unsupported left hand expression in is statement",[r.UnsupportedIsRhs]:"Unsupported right hand expression in is statement",[r.UnsupportedOperator]:"Unsupported operator - {operator}",[r.UnsupportedSyntax]:"Unsupported syntax - {node}",[r.UnsupportedSqlFunction]:"Sql function not found = {function}",[r.InvalidDataType]:"Invalid sql data type",[r.InvalidDate]:"Invalid date encountered",[r.InvalidOperator]:"Invalid operator encountered",[r.InvalidTime]:"Invalid time encountered",[r.IllegalInterval]:"Illegal interval",[r.FunctionNotRecognized]:"Function not recognized",[r.InvalidTimeStamp]:"Invalid timestamp encountered",[r.InvalidParameterCount]:"Invalid parameter count for call to {name}",[r.PrimarySecondaryQualifiers]:"Primary and Secondary SqlInterval qualifiers not supported",[r.YearMonthIntervals]:"Year-Month Intervals not supported",[r.CannotCastValue]:"Cannot cast value to the required data type"};class u extends Error{constructor(e,t){super((0,i.HC)(o[e],t)),this.declaredRootClass="esri.arcade.featureset.support.sqlerror",Error.captureStackTrace&&Error.captureStackTrace(this,u)}}var s;!function(e){e.NeverReach="NeverReach",e.NotImplemented="NotImplemented",e.Cancelled="Cancelled",e.InvalidStatResponse="InvalidStatResponse",e.InvalidRequest="InvalidRequest",e.RequestFailed="RequestFailed",e.MissingFeatures="MissingFeatures",e.AggregationFieldNotFound="AggregationFieldNotFound",e.DataElementsNotFound="DataElementsNotFound"}(s||(s={}));const l={[s.Cancelled]:"Cancelled",[s.InvalidStatResponse]:"Invalid statistics response from service",[s.InvalidRequest]:"Invalid request",[s.RequestFailed]:"Request failed - {reason}",[s.MissingFeatures]:"Missing features",[s.AggregationFieldNotFound]:"Aggregation field not found",[s.DataElementsNotFound]:"Data elements not found on service",[s.NeverReach]:"Encountered unreachable logic",[s.NotImplemented]:"Not implemented"};class c extends Error{constructor(e,t){super((0,i.HC)(l[e],t)),this.declaredRootClass="esri.arcade.featureset.support.featureseterror",Error.captureStackTrace&&Error.captureStackTrace(this,c)}}},55612:(e,t,n)=>{n.d(t,{g:()=>i});var r=n(96285);function a(e){return Number.isNaN(e)||0===e?e:Math.trunc(e)}class i{constructor(e){this._timeStampOffset=e,this._date=null}toDateTime(){return this._date??=r.c9.fromISO(this._timeStampOffset,{setZone:!0}),this._date}get isValid(){return this.toDateTime().isValid}get timezoneOffsetHour(){return a(this.toDateTime().offset/60)}get timezoneOffsetMinutes(){return a(this.toDateTime().offset%60)}toMilliseconds(){return this.toDateTime().toMillis()}get hour(){return this.toDateTime().hour}get minute(){return this.toDateTime().minute}get second(){return this.toDateTime().second}get day(){return this.toDateTime().day}get month(){return this.toDateTime().month}get year(){return this.toDateTime().year}startOfDay(){return i.fromDateTime(this.toDateTime().startOf("day"))}static fromJSDate(e){return new i(r.c9.fromJSDate(e).toISO({includeOffset:!0}))}static fromDateTime(e){return new i(e.toISO({includeOffset:!0}))}static fromParts(e,t,n=0,r=0,a=0,o=0,u=0,s=!1,l=0,c=0){const f=`${e.toString().padStart(4,"0")}-${t.toString().padStart(2,"0")}-${n.toString().padStart(2,"0")}`;let d="";o<10&&(d="0");let p=`${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${d+o.toString()}`;0!==u&&(p+="."+u.toString().padStart(3,"0"));const m=`${s?"-":"+"}${l.toString().padStart(2,"0")}:${c.toString().padStart(2,"0")}`;return new i(f+"T"+p+m)}toStorageFormat(){return this._timeStampOffset}toString(){return this._timeStampOffset}toSQLValue(){let e=this.toDateTime().toSQL({includeOffset:!0,includeOffsetSpace:!0});return e&&(e=e.replace(".000","")),e}toSQLWithKeyword(){return`timestamp '${this.toSQLValue()}'`}addMilliseconds(e){const t=this.toDateTime().plus(e);return i.fromDateTime(t)}}},50835:(e,t,n)=>{n.d(t,{WhereClause:()=>fe});var r=n(66131),a=n(87449),i=n(44208),o=n(44729),u=n(55612),s=n(15032),l=n(96285);function c(e,t){const n=d[e.toLowerCase()];if(null==n)throw new a.L8(a.Z7.FunctionNotRecognized);if(t.length<n.minParams||t.length>n.maxParams)throw new a.L8(a.Z7.InvalidParameterCount,{name:e.toUpperCase()});return n.evaluate(t)}function f(e,t){const n=d[e.toLowerCase()];return null!=n&&t>=n.minParams&&t<=n.maxParams}const d={min:{minParams:1,maxParams:1,evaluate:e=>v(e[0],"min")},max:{minParams:1,maxParams:1,evaluate:e=>v(e[0],"max")},avg:{minParams:1,maxParams:1,evaluate:e=>p(e[0])},sum:{minParams:1,maxParams:1,evaluate:e=>function(e){if(null===e)return null;let t=0;for(let n=0;n<e.length;n++){const r=e[n];if(null!==r){if(!m(r))throw new a.L8(a.Z7.InvalidValueForAggregateFunction);t+=r}}return t}(e[0])},stddev:{minParams:1,maxParams:1,evaluate:e=>function(e){if(null===e)return null;const t=h(e);return null===t?null:Math.sqrt(t)}(e[0])},count:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:e[0].length},var:{minParams:1,maxParams:1,evaluate:e=>h(e[0])}};function p(e){if(null===e)return null;let t=0,n=0;for(let r=0;r<e.length;r++){const i=e[r];if(null!==i){if(!m(i))throw new a.L8(a.Z7.InvalidValueForAggregateFunction);n++,t+=i}}return 0===n?null:t/e.length}function m(e){return"number"==typeof e}function v(e,t){if(null===e)return null;let n=null,r=null;for(const a of e){let e=a;e=a instanceof o.n||a instanceof s.k?a.toNumber():a instanceof l.c9?a.toMillis():a instanceof u.g?a.toMilliseconds():a,(null===n||"max"===t&&null!==r&&null!==e&&r<=e||"min"===t&&null!==r&&null!==e&&r>=e)&&(n=a,r=e)}return n}function h(e){if(null===e)return null;if(0===(e=e.filter((e=>null!==e))).length)return null;const t=p(e);if(null===t)return null;let n=0;for(const r of e){if(!m(r))throw new a.L8(a.Z7.InvalidValueForAggregateFunction);n+=(t-r)**2}return n/(e.length-1)}class w{constructor(){this.op="+",this.day=0,this.second=0,this.hour=0,this.month=0,this.year=0,this.minute=0,this.millis=0}static _fixDefaults(e){if(null!==e.precision||null!==e.secondary)throw new a.L8(a.Z7.PrimarySecondaryQualifiers)}static _parseSecondsComponent(e,t){if(t.includes(".")){const n=t.split(".");e.second=parseFloat(n[0]),e.millis=parseInt(n[1],10)}else e.second=parseFloat(t)}static createFromMilliseconds(e){const t=new w;return t.second=e/1e3,t}static createFromValueAndQualifier(e,t,n){let r=null;const i=new w;if(i.op="-"===n?"-":"+","interval-period"===t.type){w._fixDefaults(t);const n=new RegExp("^[0-9]{1,}$");if("year"===t.period||"month"===t.period)throw new a.L8(a.Z7.YearMonthIntervals);if("second"===t.period){if(!/^[0-9]{1,}([.]{1}[0-9]{1,}){0,1}$/.test(e))throw new a.L8(a.Z7.IllegalInterval);w._parseSecondsComponent(i,e)}else{if(!n.test(e))throw new a.L8(a.Z7.IllegalInterval);i[t.period]=parseFloat(e)}}else{if(w._fixDefaults(t.start),w._fixDefaults(t.end),"year"===t.start.period||"month"===t.start.period||"year"===t.end.period||"month"===t.end.period)throw new a.L8(a.Z7.YearMonthIntervals);switch(t.start.period){case"day":switch(t.end.period){case"hour":if(r=new RegExp("^[0-9]{1,} [0-9]{1,}$"),!r.test(e))throw new a.L8(a.Z7.IllegalInterval);i[t.start.period]=parseFloat(e.split(" ")[0]),i[t.end.period]=parseFloat(e.split(" ")[1]);break;case"minute":if(r=new RegExp("^[0-9]{1,} [0-9]{1,2}:[0-9]{1,}$"),!r.test(e))throw new a.L8(a.Z7.IllegalInterval);{i[t.start.period]=parseFloat(e.split(" ")[0]);const n=e.split(" ")[1].split(":");i.hour=parseFloat(n[0]),i.minute=parseFloat(n[1])}break;case"second":if(r=new RegExp("^[0-9]{1,} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,}([.]{1}[0-9]{1,}){0,1}$"),!r.test(e))throw new a.L8(a.Z7.IllegalInterval);{i[t.start.period]=parseFloat(e.split(" ")[0]);const n=e.split(" ")[1].split(":");i.hour=parseFloat(n[0]),i.minute=parseFloat(n[1]),w._parseSecondsComponent(i,n[2])}break;default:throw new a.L8(a.Z7.IllegalInterval)}break;case"hour":switch(t.end.period){case"minute":if(r=new RegExp("^[0-9]{1,}:[0-9]{1,}$"),!r.test(e))throw new a.L8(a.Z7.IllegalInterval);i.hour=parseFloat(e.split(":")[0]),i.minute=parseFloat(e.split(":")[1]);break;case"second":if(r=new RegExp("^[0-9]{1,}:[0-9]{1,2}:[0-9]{1,}([.]{1}[0-9]{1,}){0,1}$"),!r.test(e))throw new a.L8(a.Z7.IllegalInterval);{const t=e.split(":");i.hour=parseFloat(t[0]),i.minute=parseFloat(t[1]),w._parseSecondsComponent(i,t[2])}break;default:throw new a.L8(a.Z7.IllegalInterval)}break;case"minute":if("second"!==t.end.period)throw new a.L8(a.Z7.IllegalInterval);if(r=new RegExp("^[0-9]{1,}:[0-9]{1,}([.]{1}[0-9]{1,}){0,1}$"),!r.test(e))throw new a.L8(a.Z7.IllegalInterval);{const t=e.split(":");i.minute=parseFloat(t[0]),w._parseSecondsComponent(i,t[1])}break;default:throw new a.L8(a.Z7.IllegalInterval)}}return i}valueInMilliseconds(){return("-"===this.op?-1:1)*(this.millis+1e3*this.second+60*this.minute*1e3+60*this.hour*60*1e3+24*this.day*60*60*1e3+this.month*(365/12)*24*60*60*1e3+365*this.year*24*60*60*1e3)}}var I=n(3330);const g=/^(\d{1,2}):(\d{1,2}):(\d{1,2})$/,y=/^(\d{1,2}):(\d{1,2})$/,L=/^(\d{1,2}):(\d{1,2}):(\d{1,2}).([0-9]+)$/,T=/^(\d{4})-(\d{1,2})-(\d{1,2})$/,N=/^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})(\.[0-9]+)?$/,S=/^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})(\.[0-9]+)?[ ]{0,1}(\+|-)(\d{1,2}):(\d{1,2})$/,O=/^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2})?[ ]{0,1}(\+|-)(\d{1,2}):(\d{1,2})$/,Z=/^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2})$/;function C(e,t){if(t instanceof l.bo)return t===I.GB.instance?l.c9.fromMillis(e.getTime(),{zone:I.GB.instance}):l.c9.fromJSDate(e,{zone:t});switch(t){case"system":case"local":case null:return l.c9.fromJSDate(e);default:return"unknown"===t?.toLowerCase()?l.c9.fromMillis(e.getTime(),{zone:I.GB.instance}):l.c9.fromJSDate(e,{zone:t})}}function x(e){return"number"==typeof e}function E(e){return"string"==typeof e||e instanceof String}function M(e){return e instanceof w}function F(e){return e instanceof Date}function b(e){return e instanceof l.c9}function A(e){return e instanceof o.n}function D(e){return e instanceof s.k}function P(e){return e instanceof u.g}function R(e){let t=g.exec(e);if(null!==t){const[,e,n,r]=t,i=s.k.fromParts(parseInt(e,10),parseInt(n,10),parseInt(r,10),0);if(null!==i)return i;throw new a.L8(a.Z7.InvalidTime)}if(t=y.exec(e),null!==t){const[,e,n]=t,r=s.k.fromParts(parseInt(e,10),parseInt(n,10),0,0);if(null!==r)return r;throw new a.L8(a.Z7.InvalidTime)}if(t=L.exec(e),null!==t){const[,e,n,r,i]=t,o=s.k.fromParts(parseInt(e,10),parseInt(n,10),parseInt(r,10),parseInt(i,10));if(null!==o)return o;throw new a.L8(a.Z7.InvalidTime)}throw new a.L8(a.Z7.InvalidTime)}function _(e,t,n=!1){let r=N.exec(e);if(null!==r){const[,e,n,i,o,u,s,c]=r,f=l.c9.fromObject({year:parseInt(e,10),month:parseInt(n,10),day:parseInt(i,10),hour:parseInt(o,10),minute:parseInt(u,10),second:parseInt(s,10),millisecond:c?parseInt(c.replace(".",""),10):0},{zone:(0,I.Qo)(t)});if(!1===f.isValid)throw new a.L8(a.Z7.InvalidTimeStamp);return f}if(r=S.exec(e),null!==r){const[,e,t,n,i,o,s,l,c,f,d]=r,p=u.g.fromParts(parseInt(e,10),parseInt(t,10),parseInt(n,10),parseInt(i,10),parseInt(o,10),parseInt(s,10),l?parseInt(l.replace(".",""),10):0,"-"===c,parseInt(f,10),parseInt(d,10));if(!1===p.isValid)throw new a.L8(a.Z7.InvalidTimeStamp);return p}if(r=O.exec(e),null!==r){const[,e,t,n,i,o,s,l,c]=r,f=u.g.fromParts(parseInt(e,10),parseInt(t,10),parseInt(n,10),parseInt(i,10),parseInt(o,10),0,0,"-"===s,parseInt(l,10),parseInt(c,10));if(!1===f.isValid)throw new a.L8(a.Z7.InvalidTimeStamp);return f}if(r=Z.exec(e),null!==r){const[,e,n,i,o,u]=r,s=l.c9.fromObject({year:parseInt(e,10),month:parseInt(n,10),day:parseInt(i,10),hour:parseInt(o,10),minute:parseInt(u,10),second:0},{zone:(0,I.Qo)(t)});if(!1===s.isValid)throw new a.L8(a.Z7.InvalidTimeStamp);return s}if(r=T.exec(e),null!==r){const[,e,n,i]=r,o=l.c9.fromObject({year:parseInt(e,10),month:parseInt(n,10),day:parseInt(i,10),hour:0,minute:0,second:0},{zone:(0,I.Qo)(t)});if(!1===o.isValid)throw new a.L8(a.Z7.InvalidTimeStamp);return o}throw new a.L8(a.Z7.InvalidTimeStamp)}function U(e,t){const n=T.exec(e);if(null===n)try{return _(e,t)}catch{throw new a.L8(a.Z7.InvalidDate)}const[,r,i,u]=n,s=o.n.fromParts(parseInt(r,10),parseInt(i,10),parseInt(u,10));if(null===s)throw new a.L8(a.Z7.InvalidDate);return s}var $=n(799);const k=321408e5,J=26784e5,V=864e5,z=36e5,q=6e4;function H(e){return!!b(e)||!!P(e)}function Y(e){return!!(b(e)||A(e)||P(e)||D(e))}function B(e){if(b(e))return e.toMillis();if(A(e))return e.toNumber();if(P(e))return e.toMilliseconds();throw new a.L8(a.Z7.InvalidDataType)}function Q(e,t,n,r){if(null==e||null==t)return null;if(x(e)){if(x(t))return j(e,t,n);if(E(t))return function(e,t,n){const r=parseFloat(t);if(!isNaN(r))return j(e,r,n);const a=e.toString();switch(n){case"<>":return a!==t;case"=":return a===t;case">":return a>t;case"<":return a<t;case">=":return a>=t;case"<=":return a<=t}}(e,t,n);if(Y(t))throw new a.L8(a.Z7.InvalidOperator);if(A(t))throw new a.L8(a.Z7.InvalidOperator)}else if(E(e)){if(x(t))return function(e,t,n){const r=parseFloat(e);if(!isNaN(r))return j(r,t,n);const a=t.toString();switch(n){case"<>":return e!==a;case"=":return e===a;case">":return e>a;case"<":return e<a;case">=":return e>=a;case"<=":return e<=a}}(e,t,n);if(E(t))return function(e,t,n){switch(n){case"<>":return e!==t;case"=":return e===t;case">":return e>t;case"<":return e<t;case">=":return e>=t;case"<=":return e<=t}}(e,t,n);if(b(t))throw new a.L8(a.Z7.InvalidOperator);if(A(t))throw new a.L8(a.Z7.InvalidOperator);if(D(t))throw new a.L8(a.Z7.InvalidOperator);if(P(t))throw new a.L8(a.Z7.InvalidOperator)}else if(b(e)){if(H(t)){if(e instanceof l.c9&&(0,I.Y4)(e.zone)){if(t instanceof l.c9&&!1===(0,I.Y4)(t.zone))return G(e,t,n);if(t instanceof u.g)return G(e,t,n)}else if(t instanceof l.c9&&(0,I.Y4)(t.zone)){if(e instanceof l.c9&&!1===(0,I.Y4)(e.zone))return G(e,t,n);if(e instanceof u.g)return G(e,t,n)}return j(B(e),B(t),n)}if(E(t))throw new a.L8(a.Z7.InvalidOperator);if(A(t))return function(e,t,n){const r=t.toDateTimeLuxon(e.zone);return j((e=e.startOf("day")).toMillis(),r.toMillis(),n)}(e,t,n);if(D(t))throw new a.L8(a.Z7.InvalidOperator);if(x(t))throw new a.L8(a.Z7.InvalidOperator)}else if(A(e)){if(P(t))return function(e,t,n){const r=e.toDateTimeLuxon(t.toDateTime().zone);return t=t.startOfDay(),j(r.toMillis(),t.toMilliseconds(),n)}(e,t,n);if(b(t))return function(e,t,n){const r=e.toDateTimeLuxon(t.zone);return t=t.startOf("day"),j(r.toMillis(),t.toMillis(),n)}(e,t,n);if(E(t))throw new a.L8(a.Z7.InvalidOperator);if(A(t))return j(e.toNumber(),t.toNumber(),n);if(D(t))throw new a.L8(a.Z7.InvalidOperator);if(x(t))throw new a.L8(a.Z7.InvalidOperator)}else if(D(e)){if(D(t))return j(e.toNumber(),t.toNumber(),n);if(E(t))throw new a.L8(a.Z7.InvalidOperator);if(x(t))throw new a.L8(a.Z7.InvalidOperator);if(A(t))throw new a.L8(a.Z7.InvalidOperator);if(H(t))throw new a.L8(a.Z7.InvalidOperator)}else if(P(e)){if(H(t))return t instanceof l.c9&&(0,I.Y4)(t.zone)?G(e,t,n):j(B(e),B(t),n);if(E(t))throw new a.L8(a.Z7.InvalidOperator);if(A(t))return function(e,t,n){const r=t.toDateTimeLuxon(e.toDateTime().zone);return j((e=e.startOfDay()).toMilliseconds(),r.toMillis(),n)}(e,t,n);if(D(t))throw new a.L8(a.Z7.InvalidOperator);if(x(t))throw new a.L8(a.Z7.InvalidOperator)}switch(n){case"<>":return e!==t;case"=":return e===t;case">":return e>t;case"<":return e<t;case">=":return e>=t;case"<=":return e<=t}}function j(e,t,n){switch(n){case"<>":return e!==t;case"=":return e===t;case">":return e>t;case"<":return e<t;case">=":return e>=t;case"<=":return e<=t}}function G(e,t,n){e instanceof u.g&&(e=e.toDateTime()),t instanceof u.g&&(t=t.toDateTime());const r=W(e),a=W(t);switch(n){case"<>":return r!==a;case"=":return r===a;case">":return r>a;case"<":return r<a;case">=":return r>=a;case"<=":return r<=a}}function W(e){return e.year*k+e.month*J+e.day*V+e.hour*z+e.minute*q+1e3*e.second+e.millisecond}function K(e,t,n){const r=ne[e.toLowerCase()];if(null==r)throw new a.L8(a.Z7.FunctionNotRecognized);if(t.length<r.minParams||t.length>r.maxParams)throw new a.L8(a.Z7.InvalidParameterCount,{name:e.toUpperCase()});return r.evaluate(t,n)}function X(e){return"string"==typeof e||e instanceof String}function ee(e){return!(F(e)||A(e)||b(e)||D(e)||P(e))}function te(e){return A(e)||D(e)?e.toString():P(e)?e.toSQLValue():b(e)?0===e.millisecond?e.toFormat("yyyy-LL-dd HH:mm:ss"):e.toSQL({includeOffset:!1}):F(e)?te(l.c9.fromJSDate(e)):e.toString()}const ne={extract:{minParams:2,maxParams:2,evaluate:([e,t])=>{if(null==t)return null;if(F(t))switch(e.toUpperCase()){case"SECOND":return t.getSeconds();case"MINUTE":return t.getMinutes();case"HOUR":return t.getHours();case"DAY":return t.getDate();case"MONTH":return t.getMonth()+1;case"YEAR":return t.getFullYear();case"TIMEZONE_HOUR":case"TIMEZONE_MINUTE":return 0}else if(b(t))switch(e.toUpperCase()){case"SECOND":return t.second;case"MINUTE":return t.minute;case"HOUR":return t.hour;case"DAY":return t.day;case"MONTH":return t.month;case"YEAR":return t.year;case"TIMEZONE_HOUR":case"TIMEZONE_MINUTE":throw new a.L8(a.Z7.InvalidFunctionParameters,{function:"EXTRACT"})}else if(A(t))switch(e.toUpperCase()){case"DAY":return t.day;case"MONTH":return t.month;case"YEAR":return t.year;case"TIMEZONE_HOUR":case"TIMEZONE_MINUTE":throw new a.L8(a.Z7.InvalidFunctionParameters,{function:"EXTRACT"})}else if(D(t))switch(e.toUpperCase()){case"SECOND":return t.second;case"MINUTE":return t.minute;case"HOUR":return t.hour}else if(P(t))switch(e.toUpperCase()){case"SECOND":return t.second;case"MINUTE":return t.minute;case"HOUR":return t.hour;case"DAY":return t.day;case"MONTH":return t.month;case"YEAR":return t.year;case"TIMEZONE_HOUR":return t.timezoneOffsetHour;case"TIMEZONE_MINUTE":return t.timezoneOffsetMinutes}throw new a.L8(a.Z7.InvalidFunctionParameters,{function:"EXTRACT"})}},substring:{minParams:2,maxParams:3,evaluate:e=>{if(2===e.length){const[t,n]=e;return null==t||null==n?null:t.toString().substring(n-1)}if(3===e.length){const[t,n,r]=e;return null==t||null==n||null==r?null:r<=0?"":t.toString().substring(n-1,n+r-1)}}},position:{minParams:2,maxParams:2,evaluate:([e,t])=>null==e||null==t?null:t.indexOf(e)+1},trim:{minParams:2,maxParams:3,evaluate:e=>{const t=3===e.length,n=t?e[1]:" ",r=t?e[2]:e[1];if(null==n||null==r)return null;const i=`(${(0,$.Cj)(n)})`;switch(e[0]){case"BOTH":return r.replaceAll(new RegExp(`^${i}*|${i}*$`,"g"),"");case"LEADING":return r.replaceAll(new RegExp(`^${i}*`,"g"),"");case"TRAILING":return r.replaceAll(new RegExp(`${i}*$`,"g"),"")}throw new a.L8(a.Z7.InvalidFunctionParameters,{function:"TRIM"})}},abs:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:Math.abs(e[0])},ceiling:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:Math.ceil(e[0])},floor:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:Math.floor(e[0])},log:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:Math.log(e[0])},log10:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:Math.log(e[0])*Math.LOG10E},sin:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:Math.sin(e[0])},cos:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:Math.cos(e[0])},tan:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:Math.tan(e[0])},asin:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:Math.asin(e[0])},acos:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:Math.acos(e[0])},atan:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:Math.atan(e[0])},sign:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:e[0]>0?1:e[1]<0?-1:0},power:{minParams:2,maxParams:2,evaluate:e=>null==e[0]||null==e[1]?null:e[0]**e[1]},mod:{minParams:2,maxParams:2,evaluate:e=>null==e[0]||null==e[1]?null:e[0]%e[1]},round:{minParams:1,maxParams:2,evaluate:e=>{const t=e[0],n=2===e.length?10**e[1]:1;return null==t?null:Math.round(t*n)/n}},truncate:{minParams:1,maxParams:2,evaluate:e=>null==e[0]?null:1===e.length?parseInt(e[0].toFixed(0),10):parseFloat(e[0].toFixed(e[1]))},char_length:{minParams:1,maxParams:1,evaluate:e=>X(e[0])?e[0].length:0},concat:{minParams:1,maxParams:1/0,evaluate:e=>{let t="";for(let n=0;n<e.length;n++){if(null==e[n])return null;t+=e[n].toString()}return t}},lower:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:e[0].toString().toLowerCase()},upper:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:e[0].toString().toUpperCase()},coalesce:{minParams:1,maxParams:1/0,evaluate:e=>{for(const t of e)if(null!==t)return t;return null}},cosh:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:Math.cosh(e[0])},sinh:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:Math.sinh(e[0])},tanh:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:Math.tanh(e[0])},nullif:{minParams:2,maxParams:2,evaluate:(e,t)=>Q(e[0],e[1],"=")?null:e[0]},cast:{minParams:2,maxParams:2,evaluate:(e,t)=>{const n=e[0],r=e[1];if(null===n)return null;switch(r.type){case"integer":{if(!ee(n))throw new a.L8(a.Z7.CannotCastValue);const e=parseInt(n,10);if(isNaN(e))throw new a.L8(a.Z7.CannotCastValue);return e}case"smallint":{if(!ee(n))throw new a.L8(a.Z7.CannotCastValue);const e=parseInt(n,10);if(isNaN(e))throw new a.L8(a.Z7.CannotCastValue);if(e>32767||e<-32767)throw new a.L8(a.Z7.CannotCastValue);return e}case"float":case"real":{if(!ee(n))throw new a.L8(a.Z7.CannotCastValue);const e=parseFloat(n);if(isNaN(e))throw new a.L8(a.Z7.CannotCastValue);return e}case"time":return function(e){if(F(e))return s.k.fromDateJS(e);if(b(e))return s.k.fromDateTime(e);if(A(e))throw new a.L8(a.Z7.CannotCastValue);if(D(e))return e;if(P(e))return s.k.fromSqlTimeStampOffset(e);if(X(e))return R(e);throw new a.L8(a.Z7.CannotCastValue)}(n);case"date":return function(e){if(F(e))return o.n.fromDateJS(e);if(b(e))return o.n.fromParts(e.year,e.month,e.day);if(A(e))return e;if(D(e))throw new a.L8(a.Z7.CannotCastValue);if(P(e)&&null===o.n.fromParts(e.year,e.month,e.day))throw new a.L8(a.Z7.CannotCastValue);if(X(e)){const t=o.n.fromReader(e);if(null!==t&&t.isValid)return t}throw new a.L8(a.Z7.CannotCastValue)}(n);case"timestamp":return function(e,t,n){if(F(e))return C(e,t);if(b(e))return e;if(A(e))return e.toDateTimeLuxon("unknown");if(D(e))throw new a.L8(a.Z7.CannotCastValue);if(P(e))return e;if(X(e))return _(e,"unknown",n);throw new a.L8(a.Z7.CannotCastValue)}(n,t,!0===r.withtimezone);case"varchar":{const e=te(n);if(e.length>r.size)throw new a.L8(a.Z7.CannotCastValue);return e}default:throw new a.L8(a.Z7.InvalidDataType)}}}};function re(e,t,n,r){if("||"===e)return K("concat",[t,n],r);if(null===t||null===n)return null;if(x(t)){if(x(n))return ae(t,n,e);if(M(n))return function(e,t,n){switch(n){case"+":return w.createFromMilliseconds(e+t.valueInMilliseconds());case"-":return w.createFromMilliseconds(e-t.valueInMilliseconds());case"*":return w.createFromMilliseconds(e*t.valueInMilliseconds());case"/":return w.createFromMilliseconds(e/t.valueInMilliseconds())}throw new a.L8(a.Z7.InvalidOperator)}(t,n,e);if(D(n))return function(){throw new a.L8(a.Z7.InvalidOperator)}();if(A(n))return function(){throw new a.L8(a.Z7.InvalidOperator)}();if(P(n))return function(){throw new a.L8(a.Z7.InvalidOperator)}();if(b(n))return function(){throw new a.L8(a.Z7.InvalidOperator)}();if(E(n))return function(e,t,n){const r=parseFloat(t);if(isNaN(r))throw new a.L8(a.Z7.InvalidOperator);return ae(e,r,n)}(t,n,e);throw new a.L8(a.Z7.InvalidOperator)}if(A(t)){if(x(n))return function(e,t,n){const r=1e3*t*24*60*60;switch(n){case"+":return e.plus("milliseconds",r);case"-":return e.plus("milliseconds",-1*r)}throw new a.L8(a.Z7.InvalidOperator)}(t,n,e);if(M(n))return function(e,t,n){switch(n){case"+":return e.plus("milliseconds",t.valueInMilliseconds());case"-":return e.plus("milliseconds",-1*t.valueInMilliseconds())}throw new a.L8(a.Z7.InvalidOperator)}(t,n,e);if(D(n))return function(){throw new a.L8(a.Z7.InvalidOperator)}();if(A(n))return function(e,t,n){if("-"===n)return e.toDateTimeLuxon("UTC").diff(t.toDateTimeLuxon("UTC")).as("days");throw new a.L8(a.Z7.InvalidOperator)}(t,n,e);if(P(n))return function(e,t,n){if("-"===n)return e.toDateTimeLuxon(t.toDateTime().zone).diff(t.toDateTime()).as("days");throw new a.L8(a.Z7.InvalidOperator)}(t,n,e);if(b(n))return function(e,t,n){if("-"===n)return e.toDateTimeLuxon(t.zone).diff(t).as("days");throw new a.L8(a.Z7.InvalidOperator)}(t,n,e);if(E(n))return function(){throw new a.L8(a.Z7.InvalidOperator)}();throw new a.L8(a.Z7.InvalidOperator)}if(D(t)){if(x(n))return function(e,t,n){const r=1e3*t*24*60*60;switch(n){case"+":return e.plus("milliseconds",r);case"-":return e.plus("milliseconds",-1*r)}throw new a.L8(a.Z7.InvalidOperator)}(t,n,e);if(M(n))return function(e,t,n){switch(n){case"+":return e.plus("milliseconds",t.valueInMilliseconds());case"-":return e.plus("milliseconds",-1*t.valueInMilliseconds())}throw new a.L8(a.Z7.InvalidOperator)}(t,n,e);if(D(n))return function(){throw new a.L8(a.Z7.InvalidOperator)}();if(A(n))return function(){throw new a.L8(a.Z7.InvalidOperator)}();if(P(n))return function(){throw new a.L8(a.Z7.InvalidOperator)}();if(b(n))return function(){throw new a.L8(a.Z7.InvalidOperator)}();if(E(n))return function(){throw new a.L8(a.Z7.InvalidOperator)}();throw new a.L8(a.Z7.InvalidOperator)}if(M(t)){if(x(n))return function(e,t,n){switch(n){case"+":return w.createFromMilliseconds(e.valueInMilliseconds()+t);case"-":return w.createFromMilliseconds(e.valueInMilliseconds()-t);case"*":return w.createFromMilliseconds(e.valueInMilliseconds()*t);case"/":return w.createFromMilliseconds(e.valueInMilliseconds()/t)}throw new a.L8(a.Z7.InvalidOperator)}(t,n,e);if(M(n))return function(e,t,n){switch(n){case"+":return w.createFromMilliseconds(e.valueInMilliseconds()+t.valueInMilliseconds());case"-":return w.createFromMilliseconds(e.valueInMilliseconds()-t.valueInMilliseconds());case"*":return w.createFromMilliseconds(e.valueInMilliseconds()*t.valueInMilliseconds());case"/":return w.createFromMilliseconds(e.valueInMilliseconds()/t.valueInMilliseconds())}throw new a.L8(a.Z7.InvalidOperator)}(t,n,e);if(D(n))return function(e,t,n){if("+"===n)return t.plus("milliseconds",e.valueInMilliseconds());throw new a.L8(a.Z7.InvalidOperator)}(t,n,e);if(A(n))return function(e,t,n){if("+"===n)return t.plus("milliseconds",e.valueInMilliseconds());throw new a.L8(a.Z7.InvalidOperator)}(t,n,e);if(P(n))return function(e,t,n){if("+"===n)return t.addMilliseconds(e.valueInMilliseconds());throw new a.L8(a.Z7.InvalidOperator)}(t,n,e);if(b(n))return function(e,t,n){switch(n){case"+":return t.plus({milliseconds:e.valueInMilliseconds()});case"-":return e.valueInMilliseconds()-t.toMillis()}throw new a.L8(a.Z7.InvalidOperator)}(t,n,e);if(E(n))return function(){throw new a.L8(a.Z7.InvalidOperator)}();throw new a.L8(a.Z7.InvalidOperator)}if(b(t)){if(x(n))return function(e,t,n){const r=1e3*t*24*60*60;switch(n){case"+":return e.plus({milliseconds:r});case"-":return e.minus({milliseconds:r})}throw new a.L8(a.Z7.InvalidOperator)}(t,n,e);if(M(n))return function(e,t,n){switch(n){case"+":return e.plus({milliseconds:t.valueInMilliseconds()});case"-":return e.minus({milliseconds:t.valueInMilliseconds()})}throw new a.L8(a.Z7.InvalidOperator)}(t,n,e);if(D(n))return function(){throw new a.L8(a.Z7.InvalidOperator)}();if(A(n))return function(e,t,n){if("-"===n)return e.diff(t.toDateTimeLuxon(e.zone)).as("days");throw new a.L8(a.Z7.InvalidOperator)}(t,n,e);if(P(n))return function(e,t,n){if("-"===n)return e.diff(t.toDateTime()).as("days");throw new a.L8(a.Z7.InvalidOperator)}(t,n,e);if(b(n))return function(e,t,n){if("-"===n)return e.diff(t).as("days");throw new a.L8(a.Z7.InvalidOperator)}(t,n,e);if(E(n))return function(){throw new a.L8(a.Z7.InvalidOperator)}();throw new a.L8(a.Z7.InvalidOperator)}if(P(t)){if(x(n))return function(e,t,n){const r=1e3*t*24*60*60;switch(n){case"+":return e.addMilliseconds(r);case"-":return e.addMilliseconds(-1*r)}throw new a.L8(a.Z7.InvalidOperator)}(t,n,e);if(M(n))return function(e,t,n){switch(n){case"+":return e.addMilliseconds(t.valueInMilliseconds());case"-":return e.addMilliseconds(-1*t.valueInMilliseconds())}throw new a.L8(a.Z7.InvalidOperator)}(t,n,e);if(D(n))return function(){throw new a.L8(a.Z7.InvalidOperator)}();if(A(n))return function(e,t,n){if("-"===n)return e.toDateTime().diff(t.toDateTimeLuxon(e.toDateTime().zone)).as("days");throw new a.L8(a.Z7.InvalidOperator)}(t,n,e);if(P(n))return function(e,t,n){if("-"===n)return e.toDateTime().diff(t.toDateTime()).as("days");throw new a.L8(a.Z7.InvalidOperator)}(t,n,e);if(b(n))return function(e,t,n){if("-"===n)return e.toDateTime().diff(t).as("days");throw new a.L8(a.Z7.InvalidOperator)}(t,n,e);if(E(n))return function(){throw new a.L8(a.Z7.InvalidOperator)}();throw new a.L8(a.Z7.InvalidOperator)}if(E(t)){if(x(n))return function(e,t,n){const r=parseFloat(e);if(isNaN(r))throw new a.L8(a.Z7.InvalidOperator);return ae(r,t,n)}(t,n,e);if(M(n))return function(){throw new a.L8(a.Z7.InvalidOperator)}();if(D(n))return function(){throw new a.L8(a.Z7.InvalidOperator)}();if(A(n))return function(){throw new a.L8(a.Z7.InvalidOperator)}();if(P(n))return function(){throw new a.L8(a.Z7.InvalidOperator)}();if(b(n))return function(){throw new a.L8(a.Z7.InvalidOperator)}();if(E(n))return function(e,t,n){if("+"===n)return e+t;throw new a.L8(a.Z7.InvalidOperator)}(t,n,e);throw new a.L8(a.Z7.InvalidOperator)}throw new a.L8(a.Z7.InvalidOperator)}function ae(e,t,n){switch(n){case"+":return e+t;case"-":return e-t;case"*":return e*t;case"/":return e/t}throw new a.L8(a.Z7.InvalidOperator)}function ie(e,t,n,r){var a=Error.call(this,e);return Object.setPrototypeOf&&Object.setPrototypeOf(a,ie.prototype),a.expected=t,a.found=n,a.location=r,a.name="SyntaxError",a}function oe(e,t,n){return n=n||" ",e.length>t?e:(t-=e.length,e+(n+=n.repeat(t)).slice(0,t))}(function(e,t){function n(){this.constructor=e}n.prototype=t.prototype,e.prototype=new n})(ie,Error),ie.prototype.format=function(e){var t="Error: "+this.message;if(this.location){var n,r=null;for(n=0;n<e.length;n++)if(e[n].source===this.location.source){r=e[n].text.split(/\r\n|\n|\r/g);break}var a=this.location.start,i=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(a):a,o=this.location.source+":"+i.line+":"+i.column;if(r){var u=this.location.end,s=oe("",i.line.toString().length," "),l=r[a.line-1],c=(a.line===u.line?u.column:l.length+1)-a.column||1;t+="\n --\x3e "+o+"\n"+s+" |\n"+i.line+" | "+l+"\n"+s+" | "+oe("",a.column-1," ")+oe("",c,"^")}else t+="\n at "+o}return t},ie.buildMessage=function(e,t){var n={literal:function(e){return'"'+a(e.text)+'"'},class:function(e){var t=e.parts.map((function(e){return Array.isArray(e)?i(e[0])+"-"+i(e[1]):i(e)}));return"["+(e.inverted?"^":"")+t.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(e){return e.description}};function r(e){return e.charCodeAt(0).toString(16).toUpperCase()}function a(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+r(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+r(e)}))}function i(e){return e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+r(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+r(e)}))}function o(e){return n[e.type](e)}return"Expected "+function(e){var t,n,r=e.map(o);if(r.sort(),r.length>0){for(t=1,n=1;t<r.length;t++)r[t-1]!==r[t]&&(r[n]=r[t],n++);r.length=n}switch(r.length){case 1:return r[0];case 2:return r[0]+" or "+r[1];default:return r.slice(0,-1).join(", ")+", or "+r[r.length-1]}}(e)+" but "+function(e){return e?'"'+a(e)+'"':"end of input"}(t)+" found."};class ue{static parse(e){return function(e,t){var n,r={},a=(t=void 0!==t?t:{}).grammarSource,i={start:Xa},o=Xa,u="!",s="=",l=">=",c=">",f="<=",d="<>",p="!=",m="||",v="@",h="'",w="N'",I="''",g=".",y="null",L="true",T="false",N="in",S="is",O="like",Z="escape",C="not",x="and",E="or",M="between",F="from",b="for",A="substring",D="extract",P="trim",R="position",_="timestamp",U="date",$="time",k="leading",J="trailing",V="both",z="cast",q="as",H="integer",Y="smallint",B="float",Q="real",j="varchar",G="to",W="interval",K="year",X="timezone_hour",ee="timezone_minute",te="month",ne="day",re="hour",ae="minute",oe="second",ue="case",se="end",le="when",ce="then",fe="else",de=",",pe="(",me=")",ve="`",he=/^[<-=]/,we=/^[+\-]/,Ie=/^[*\/]/,ge=/^[A-Za-z_\x80-\uFFFF]/,ye=/^[A-Za-z0-9_]/,Le=/^[A-Za-z0-9_.\x80-\uFFFF]/,Te=/^["]/,Ne=/^[^']/,Se=/^[0-9]/,Oe=/^[eE]/,Ze=/^[ \t\n\r]/,Ce=/^[^`]/,xe=Ba("!",!1),Ee=Ba("=",!1),Me=Ba(">=",!1),Fe=Ba(">",!1),be=Ba("<=",!1),Ae=Ba("<>",!1),De=Qa([["<","="]],!1,!1),Pe=Ba("!=",!1),Re=Qa(["+","-"],!1,!1),_e=Ba("||",!1),Ue=Qa(["*","/"],!1,!1),$e=Qa([["A","Z"],["a","z"],"_",["€","￿"]],!1,!1),ke=Qa([["A","Z"],["a","z"],["0","9"],"_"],!1,!1),Je=Qa([["A","Z"],["a","z"],["0","9"],"_",".",["€","￿"]],!1,!1),Ve=Qa(['"'],!1,!1),ze=Ba("@",!1),qe=Ba("'",!1),He=Ba("N'",!1),Ye=Ba("''",!1),Be=Qa(["'"],!0,!1),Qe=Ba(".",!1),je=Qa([["0","9"]],!1,!1),Ge=Qa(["e","E"],!1,!1),We=Ba("NULL",!0),Ke=Ba("TRUE",!0),Xe=Ba("FALSE",!0),et=Ba("IN",!0),tt=Ba("IS",!0),nt=Ba("LIKE",!0),rt=Ba("ESCAPE",!0),at=Ba("NOT",!0),it=Ba("AND",!0),ot=Ba("OR",!0),ut=Ba("BETWEEN",!0),st=Ba("FROM",!0),lt=Ba("FOR",!0),ct=Ba("SUBSTRING",!0),ft=Ba("EXTRACT",!0),dt=Ba("TRIM",!0),pt=Ba("POSITION",!0),mt=Ba("TIMESTAMP",!0),vt=Ba("DATE",!0),ht=Ba("TIME",!0),wt=Ba("LEADING",!0),It=Ba("TRAILING",!0),gt=Ba("BOTH",!0),yt=Ba("CAST",!0),Lt=Ba("AS",!0),Tt=Ba("INTEGER",!0),Nt=Ba("SMALLINT",!0),St=Ba("FLOAT",!0),Ot=Ba("REAL",!0),Zt=Ba("VARCHAR",!0),Ct=Ba("TO",!0),xt=Ba("INTERVAL",!0),Et=Ba("YEAR",!0),Mt=Ba("TIMEZONE_HOUR",!0),Ft=Ba("TIMEZONE_MINUTE",!0),bt=Ba("MONTH",!0),At=Ba("DAY",!0),Dt=Ba("HOUR",!0),Pt=Ba("MINUTE",!0),Rt=Ba("SECOND",!0),_t=Ba("CASE",!0),Ut=Ba("END",!0),$t=Ba("WHEN",!0),kt=Ba("THEN",!0),Jt=Ba("ELSE",!0),Vt=Ba(",",!1),zt=Ba("(",!1),qt=Ba(")",!1),Ht=Qa([" ","\t","\n","\r"],!1,!1),Yt=Ba("`",!1),Bt=Qa(["`"],!0,!1),Qt=function(e){return e},jt=function(e){return Uo(Ha(),...e)},Gt=function(e,t,n){return{op:t,expr:n,location:Ha()}},Wt=function(e,t){return $o(e,t)},Kt=function(e,t,n){return{op:t,expr:n,location:Ha()}},Xt=function(e,t){return $o(e,t)},en=function(e){return function(e,t,n){return{type:"unary-expression",location:n,operator:"NOT",expr:t}}(0,e,Ha())},tn=function(e,t){return""==t||null==t||null==t?e:"arithmetic"==t.type?$o(e,t.tail):_o(t.op,e,t.right,t.escape,Ha())},nn=function(e,t){return{op:e,expr:t,location:Ha()}},rn=function(e){return{type:"arithmetic",tail:e}},an=function(e,t){return{op:e+"NOT",right:t}},on=function(e,t){return{op:e,right:t}},un=function(e,t,n){return Uo(Ha(),t,n)},sn=function(e,t){return{op:"NOT"+e,right:t}},ln=function(e,t,n){return Uo(Ha(),t,n)},cn=function(e,t){return{op:e,right:t}},fn=function(e){return e[0]+" "+e[2]},dn=function(e){return e[0]+" "+e[2]},pn=function(e,t,n){return{op:e,right:t,escape:n.value}},mn=function(e,t){return{op:e,right:t,escape:""}},vn=function(e,t){return{op:e,right:t}},hn=function(e,t){return{op:e,right:t}},wn=function(e,t,n){return{op:t,expr:n,location:Ha()}},In=function(e,t){return $o(e,t)},gn=function(e,t,n){return{op:t,expr:n,location:Ha()}},yn=function(e,t){return $o(e,t)},Ln=function(e){return e.paren=!0,e},Tn=function(e){return/^CURRENT_DATE$/i.test(e)?{type:"current-time",location:Ha(),mode:"date"}:/^CURRENT_TIMESTAMP$/i.test(e)?{type:"current-time",location:Ha(),mode:"timestamp"}:/^CURRENT_USER$/i.test(e)?{type:"current-user",location:Ha()}:{type:"column-reference",location:Ha(),table:"",column:e}},Nn=function(e){return{type:"column-reference",location:Ha(),table:"",column:e,delimited:!0}},Sn=function(e){return e},On=function(e,t){return e+t.join("")},Zn=function(e,t){return e+t.join("")},Cn=function(e){return e},xn=function(e){return e.join("")},En=function(){return'"'},Mn=function(e){return{type:"parameter",location:Ha(),value:e[1]}},Fn=function(e,t){return Uo(Ha(),e,t)},bn=function(e,t){return Uo(Ha(),e,t)},An=function(e){return{type:"function",location:Ha(),name:"extract",args:e}},Dn=function(e,t,n){return Uo(Ha(),e,t,...n?[n]:[])},Pn=function(e,t,n){return Uo(Ha(),e,t,n)},Rn=function(e){return{type:"function",location:Ha(),name:"substring",args:e}},_n=function(e,t){return Uo(Ha(),e,t)},Un=function(e,t){return Uo(Ha(),e,t)},$n=function(e){return{type:"function",location:Ha(),name:"cast",args:e}},kn=function(){return{type:"data-type",location:Ha(),value:{type:"integer"}}},Jn=function(){return{type:"data-type",location:Ha(),value:{type:"smallint"}}},Vn=function(){return{type:"data-type",location:Ha(),value:{type:"float"}}},zn=function(){return{type:"data-type",location:Ha(),value:{type:"real"}}},qn=function(){return{type:"data-type",location:Ha(),value:{type:"date"}}},Hn=function(){return{type:"data-type",location:Ha(),value:{type:"timestamp"}}},Yn=function(){return{type:"data-type",location:Ha(),value:{type:"time"}}},Bn=function(e){return{type:"data-type",location:Ha(),value:{type:"varchar",size:parseInt(e)}}},Qn=function(e,t,n){return Uo(Ha(),e,t,n)},jn=function(e,t){return Uo(Ha(),e,t)},Gn=function(e){return{type:"function",location:Ha(),name:"trim",args:e}},Wn=function(e){return{type:"string",location:Ha(),value:e??"BOTH"}},Kn=function(e,t){return Uo(Ha(),e,t)},Xn=function(e,t){return Uo(Ha(),e,t)},er=function(e){return{type:"function",location:Ha(),name:"position",args:e}},tr=function(e,t){return{type:"function",location:Ha(),name:e,args:t}},nr=function(e){return{type:"string",location:Ha(),value:e}},rr=function(e){return"string"===e.type&&function(e){!0!==/^(\d{4})-(\d{1,2})-(\d{1,2})$|^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})(\.[0-9]+)?$|^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})(\.[0-9]+)?[ ]{0,1}(\+|\-)(\d{1,2}):(\d{1,2})$|^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2})?[ ]{0,1}(\+|\-)(\d{1,2}):(\d{1,2})$|^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2})$/.test(e)&&Ya("Timestamp literal is invalid")}(e.value),{type:"timestamp",location:Ha(),value:e.value}},ar=function(e){return"string"===e.type&&function(e){!0!==/^(\d{1,2}):(\d{1,2}):(\d{1,2})$|^(\d{1,2}):(\d{1,2})$|^(\d{1,2}):(\d{1,2}):(\d{1,2}).([0-9]+)$/.test(e)&&Ya("Time literal is invalid")}(e.value),{type:"time",location:Ha(),value:e.value}},ir=function(e,t,n){return{type:"interval",location:Ha(),value:t,qualifier:n,op:e}},or=function(e,t){return{type:"interval",location:Ha(),value:e,qualifier:t,op:""}},ur=function(e,t){return{type:"interval-qualifier",location:Ha(),start:e,end:t}},sr=function(e,t){return{type:"interval-period",location:Ha(),period:e.value,precision:t,secondary:null}},lr=function(e){return{type:"interval-period",location:Ha(),period:e.value,precision:null,secondary:null}},cr=function(e){return{type:"interval-period",location:Ha(),period:e.value,precision:null,secondary:null}},fr=function(e,t){return{type:"interval-period",location:Ha(),period:"second",precision:e,secondary:t}},dr=function(e){return{type:"interval-period",location:Ha(),period:"second",precision:e,secondary:null}},pr=function(){return{type:"interval-period",location:Ha(),period:"second",precision:null,secondary:null}},mr=function(e,t){return{type:"interval-period",location:Ha(),period:e.value,precision:t,secondary:null}},vr=function(e){return{type:"interval-period",location:Ha(),period:e.value,precision:null,secondary:null}},hr=function(e,t){return{type:"interval-period",location:Ha(),period:"second",precision:e,secondary:t}},wr=function(e){return{type:"interval-period",location:Ha(),period:"second",precision:e,secondary:null}},Ir=function(){return{type:"interval-period",location:Ha(),period:"second",precision:null,secondary:null}},gr=function(){return{type:"string",location:Ha(),value:"day"}},yr=function(){return{type:"string",location:Ha(),value:"hour"}},Lr=function(){return{type:"string",location:Ha(),value:"minute"}},Tr=function(){return{type:"string",location:Ha(),value:"month"}},Nr=function(){return{type:"string",location:Ha(),value:"year"}},Sr=function(e){return parseFloat(e)},Or=function(e){return parseFloat(e)},Zr=function(e){return"string"===e.type&&function(e){!0!==/^(\d{4})-(\d{1,2})-(\d{1,2})$|^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})(\.[0-9]+)?$|^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})(\.[0-9]+)?[ ]{0,1}(\+|\-)(\d{1,2}):(\d{1,2})$|^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2})?[ ]{0,1}(\+|\-)(\d{1,2}):(\d{1,2})$|^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2})$/.test(e)&&Ya("Date literal is invalid")}(e.value),{type:"date",location:Ha(),value:e.value}},Cr=function(){return{type:"null",location:Ha(),value:null}},xr=function(){return{type:"boolean",location:Ha(),value:!0}},Er=function(){return{type:"boolean",location:Ha(),value:!1}},Mr=function(){return"'"},Fr=function(e){return{type:"string",location:Ha(),value:e.join("")}},br=function(e,t){return{type:"case-expression",location:Ha(),format:"simple",operand:e,clauses:t,else:null,elseLocation:null}},Ar=function(e,t,n){return{type:"case-expression",location:Ha(),format:"simple",operand:e,clauses:t,else:n.value,elseLocation:n.location}},Dr=function(e){return{type:"case-expression",location:Ha(),format:"searched",clauses:e,else:null,elseLocation:null}},Pr=function(e,t){return{type:"case-expression",location:Ha(),format:"searched",clauses:e,else:t.value,elseLocation:t.location}},Rr=function(e,t){return{type:"when-clause",location:Ha(),operand:e,value:t}},_r=function(e,t){return{type:"when-clause",location:Ha(),operand:e,value:t}},Ur=function(e){return{type:"else-clause",location:Ha(),value:e}},$r=function(e){return{type:"number",location:Ha(),value:e}},kr=function(e,t,n){return parseFloat(e+t+n)},Jr=function(e,t){return parseFloat(e+t)},Vr=function(e,t){return parseFloat(e+t)},zr=function(e){return parseFloat(e)},qr=function(e,t){return e[0]+t},Hr=function(e){return"."+(null!=e?e:"")},Yr=function(e,t){return e+t},Br=function(e){return e.join("")},Qr=function(e,t){return"e"+(null===t?"":t)},jr=function(){return"IN"},Gr=function(){return"IS"},Wr=function(){return"LIKE"},Kr=function(){return"ESCAPE"},Xr=function(){return"NOT"},ea=function(){return"AND"},ta=function(){return"OR"},na=function(){return"BETWEEN"},ra=function(){return"FROM"},aa=function(){return"FOR"},ia=function(){return"SUBSTRING"},oa=function(){return"EXTRACT"},ua=function(){return"TRIM"},sa=function(){return"POSITION"},la=function(){return"TIMESTAMP"},ca=function(){return"DATE"},fa=function(){return"TIME"},da=function(){return"LEADING"},pa=function(){return"TRAILING"},ma=function(){return"BOTH"},va=function(){return"CAST"},ha=function(){return"AS"},wa=function(){return"INTEGER"},Ia=function(){return"SMALLINT"},ga=function(){return"FLOAT"},ya=function(){return"REAL"},La=function(){return"VARCHAR"},Ta=function(){return"TO"},Na=function(){return"INTERVAL"},Sa=function(){return"YEAR"},Oa=function(){return"TIMEZONE_HOUR"},Za=function(){return"TIMEZONE_MINUTE"},Ca=function(){return"MONTH"},xa=function(){return"DAY"},Ea=function(){return"HOUR"},Ma=function(){return"MINUTE"},Fa=function(){return"SECOND"},ba=function(){return"CASE"},Aa=function(){return"END"},Da=function(){return"WHEN"},Pa=function(){return"THEN"},Ra=function(){return"ELSE"},_a=function(e){return e},Ua=function(e){return e.join("")},$a=0|t.peg$currPos,ka=$a,Ja=[{line:1,column:1}],Va=$a,za=t.peg$maxFailExpected||[],qa=0|t.peg$silentFails;if(t.startRule){if(!(t.startRule in i))throw new Error("Can't start parsing from rule \""+t.startRule+'".');o=i[t.startRule]}function Ha(){return Ga(ka,$a)}function Ya(e,t){throw Ka(e,t=void 0!==t?t:Ga(ka,$a))}function Ba(e,t){return{type:"literal",text:e,ignoreCase:t}}function Qa(e,t,n){return{type:"class",parts:e,inverted:t,ignoreCase:n}}function ja(t){var n,r=Ja[t];if(r)return r;if(t>=Ja.length)n=Ja.length-1;else for(n=t;!Ja[--n];);for(r={line:(r=Ja[n]).line,column:r.column};n<t;)10===e.charCodeAt(n)?(r.line++,r.column=1):r.column++,n++;return Ja[t]=r,r}function Ga(e,t,n){var r=ja(e),i=ja(t);return{source:a,start:{offset:e,line:r.line,column:r.column},end:{offset:t,line:i.line,column:i.column}}}function Wa(e){$a<Va||($a>Va&&(Va=$a,za=[]),za.push(e))}function Ka(e,t){return new ie(e,null,null,t)}function Xa(){var e,t;return e=$a,Do(),(t=ti())!==r?(Do(),ka=e,e=Qt(t)):($a=e,e=r),e}function ei(){var e,t,n,a,i,o;if(e=$a,bo()!==r){for(Do(),t=[],n=ti();n!==r;)t.push(n),n=$a,a=$a,i=Do(),(o=Fo())!==r?a=i=[i,o,Do()]:($a=a,a=r),a!==r&&(a=ti())===r?($a=n,n=r):n=a;n=Do(),(a=Ao())!==r?(ka=e,e=jt(t)):($a=e,e=r)}else $a=e,e=r;return e}function ti(){var e,t,n,a,i,o;if(e=$a,(t=ni())!==r){for(n=[],a=$a,Do(),(i=Qi())!==r?(Do(),(o=ni())!==r?(ka=a,a=Gt(t,i,o)):($a=a,a=r)):($a=a,a=r);a!==r;)n.push(a),a=$a,Do(),(i=Qi())!==r?(Do(),(o=ni())!==r?(ka=a,a=Gt(t,i,o)):($a=a,a=r)):($a=a,a=r);ka=e,e=Wt(t,n)}else $a=e,e=r;return e}function ni(){var e,t,n,a,i,o;if(e=$a,(t=ri())!==r){for(n=[],a=$a,Do(),(i=Bi())!==r?(Do(),(o=ri())!==r?(ka=a,a=Kt(t,i,o)):($a=a,a=r)):($a=a,a=r);a!==r;)n.push(a),a=$a,Do(),(i=Bi())!==r?(Do(),(o=ri())!==r?(ka=a,a=Kt(t,i,o)):($a=a,a=r)):($a=a,a=r);ka=e,e=Xt(t,n)}else $a=e,e=r;return e}function ri(){var t,n,a,i,o;return t=$a,(n=Yi())===r&&(n=$a,33===e.charCodeAt($a)?(a=u,$a++):(a=r,0===qa&&Wa(xe)),a!==r?(i=$a,qa++,61===e.charCodeAt($a)?(o=s,$a++):(o=r,0===qa&&Wa(Ee)),qa--,o===r?i=void 0:($a=i,i=r),i!==r?n=a=[a,i]:($a=n,n=r)):($a=n,n=r)),n!==r?(a=Do(),(i=ri())!==r?(ka=t,t=en(i)):($a=t,t=r)):($a=t,t=r),t===r&&(t=function(){var e,t,n,a;return e=$a,(t=ui())!==r?(n=$a,Do(),(a=function(){var e;return(e=function(){var e,t,n,a,i;if(e=$a,t=[],n=$a,Do(),(a=ai())!==r?(Do(),(i=ui())!==r?(ka=n,n=nn(a,i)):($a=n,n=r)):($a=n,n=r),n!==r)for(;n!==r;)t.push(n),n=$a,Do(),(a=ai())!==r?(Do(),(i=ui())!==r?(ka=n,n=nn(a,i)):($a=n,n=r)):($a=n,n=r);else t=r;return t!==r&&(ka=e,t=rn(t)),t}())===r&&(e=function(){var e,t,n;return e=$a,(t=oi())!==r?(Do(),(n=ei())!==r?(ka=e,e=vn(t,n)):($a=e,e=r)):($a=e,e=r),e===r&&(e=$a,(t=oi())!==r?(Do(),(n=gi())!==r?(ka=e,e=hn(t,n)):($a=e,e=r)):($a=e,e=r)),e}())===r&&(e=function(){var e,t,n,a,i,o,u,s;return e=$a,(t=Yi())!==r?(Do(),(n=ji())!==r?(a=Do(),i=$a,(o=ui())!==r?(Do(),(u=Bi())!==r?(Do(),(s=ui())!==r?(ka=i,i=un(n,o,s)):($a=i,i=r)):($a=i,i=r)):($a=i,i=r),i!==r?(ka=e,e=sn(n,i)):($a=e,e=r)):($a=e,e=r)):($a=e,e=r),e===r&&(e=$a,(t=ji())!==r?(Do(),n=$a,(a=ui())!==r?(i=Do(),(o=Bi())!==r?(Do(),(u=ui())!==r?(ka=n,n=ln(t,a,u)):($a=n,n=r)):($a=n,n=r)):($a=n,n=r),n!==r?(ka=e,e=cn(t,n)):($a=e,e=r)):($a=e,e=r)),e}())===r&&(e=function(){var e,t,n,a;return e=$a,(t=zi())!==r?(Do(),(n=Yi())!==r?(Do(),(a=ui())!==r?(ka=e,e=an(t,a)):($a=e,e=r)):($a=e,e=r)):($a=e,e=r),e===r&&(e=$a,(t=zi())!==r?(Do(),(n=ui())!==r?(ka=e,e=on(t,n)):($a=e,e=r)):($a=e,e=r)),e}())===r&&(e=function(){var e,t,n,a;return e=$a,(t=ii())!==r?(Do(),(n=xi())!==r?(Do(),Hi()!==r?(Do(),(a=Ei())!==r?(ka=e,e=pn(t,n,a)):($a=e,e=r)):($a=e,e=r)):($a=e,e=r)):($a=e,e=r),e===r&&(e=$a,(t=ii())!==r?(Do(),(n=xi())!==r?(ka=e,e=mn(t,n)):($a=e,e=r)):($a=e,e=r)),e}()),e}())!==r?n=a:($a=n,n=r),n===r&&(n=null),ka=e,e=tn(t,n)):($a=e,e=r),e}()),t}function ai(){var t;return e.substr($a,2)===l?(t=l,$a+=2):(t=r,0===qa&&Wa(Me)),t===r&&(62===e.charCodeAt($a)?(t=c,$a++):(t=r,0===qa&&Wa(Fe)),t===r&&(e.substr($a,2)===f?(t=f,$a+=2):(t=r,0===qa&&Wa(be)),t===r&&(e.substr($a,2)===d?(t=d,$a+=2):(t=r,0===qa&&Wa(Ae)),t===r&&(t=e.charAt($a),he.test(t)?$a++:(t=r,0===qa&&Wa(De)),t===r&&(e.substr($a,2)===p?(t=p,$a+=2):(t=r,0===qa&&Wa(Pe))))))),t}function ii(){var e,t,n,a,i;return e=$a,t=$a,(n=Yi())!==r?(a=Do(),(i=qi())!==r?t=n=[n,a,i]:($a=t,t=r)):($a=t,t=r),t!==r&&(ka=e,t=fn(t)),(e=t)===r&&(e=qi()),e}function oi(){var e,t,n,a,i;return e=$a,t=$a,(n=Yi())!==r?(a=Do(),(i=Vi())!==r?t=n=[n,a,i]:($a=t,t=r)):($a=t,t=r),t!==r&&(ka=e,t=dn(t)),(e=t)===r&&(e=Vi()),e}function ui(){var e,t,n,a,i,o;if(e=$a,(t=li())!==r){for(n=[],a=$a,Do(),(i=si())!==r?(Do(),(o=li())!==r?(ka=a,a=wn(t,i,o)):($a=a,a=r)):($a=a,a=r);a!==r;)n.push(a),a=$a,Do(),(i=si())!==r?(Do(),(o=li())!==r?(ka=a,a=wn(t,i,o)):($a=a,a=r)):($a=a,a=r);ka=e,e=In(t,n)}else $a=e,e=r;return e}function si(){var t;return t=e.charAt($a),we.test(t)?$a++:(t=r,0===qa&&Wa(Re)),t===r&&(e.substr($a,2)===m?(t=m,$a+=2):(t=r,0===qa&&Wa(_e))),t}function li(){var e,t,n,a,i,o;if(e=$a,(t=fi())!==r){for(n=[],a=$a,Do(),(i=ci())!==r?(Do(),(o=fi())!==r?(ka=a,a=gn(t,i,o)):($a=a,a=r)):($a=a,a=r);a!==r;)n.push(a),a=$a,Do(),(i=ci())!==r?(Do(),(o=fi())!==r?(ka=a,a=gn(t,i,o)):($a=a,a=r)):($a=a,a=r);ka=e,e=yn(t,n)}else $a=e,e=r;return e}function ci(){var t;return t=e.charAt($a),Ie.test(t)?$a++:(t=r,0===qa&&Wa(Ue)),t}function fi(){var e,t;return(e=function(){var e;return(e=Ei())===r&&(e=function(){var e,t,n,a;return e=$a,(t=function(){var e,t,n,a;return e=$a,(t=Ai())!==r&&(n=Di())!==r&&(a=Pi())!==r?(ka=e,e=kr(t,n,a)):($a=e,e=r),e===r&&(e=$a,(t=Ai())!==r&&(n=Di())!==r?(ka=e,e=Jr(t,n)):($a=e,e=r),e===r&&(e=$a,(t=Ai())!==r&&(n=Pi())!==r?(ka=e,e=Vr(t,n)):($a=e,e=r),e===r&&(e=$a,(t=Ai())!==r&&(ka=e,t=zr(t)),e=t))),e}())!==r?(n=$a,qa++,a=pi(),qa--,a===r?n=void 0:($a=n,n=r),n!==r?(ka=e,e=$r(t)):($a=e,e=r)):($a=e,e=r),e}())===r&&(e=function(){var e,t;return e=$a,(t=ki())!==r&&(ka=e,t=xr()),(e=t)===r&&(e=$a,(t=Ji())!==r&&(ka=e,t=Er()),e=t),e}())===r&&(e=function(){var e,t;return e=$a,(t=$i())!==r&&(ka=e,t=Cr()),t}())===r&&(e=function(){var e,t;return e=$a,ro()!==r?(Do(),(t=xi())!==r?(ka=e,e=Zr(t)):($a=e,e=r)):($a=e,e=r),e}())===r&&(e=function(){var e,t;return e=$a,no()!==r?(Do(),(t=xi())!==r?(ka=e,e=rr(t)):($a=e,e=r)):($a=e,e=r),e}())===r&&(e=Ni())===r&&(e=function(){var e,t;return e=$a,ao()!==r?(Do(),(t=xi())!==r?(ka=e,e=ar(t)):($a=e,e=r)):($a=e,e=r),e}()),e}())===r&&(e=function(){var e,t,n,a;return e=$a,Xi()!==r?(Do(),t=$a,bo()!==r?(Do(),(n=Ti())!==r?(Do(),Gi()!==r?(Do(),(a=ti())!==r?(Do(),Ao()!==r?(ka=t,t=Fn(n,a)):($a=t,t=r)):($a=t,t=r)):($a=t,t=r)):($a=t,t=r)):($a=t,t=r),t===r&&(t=$a,bo()!==r?(Do(),(n=Ti())!==r?(Do(),Fo()!==r?(Do(),(a=ti())!==r?(Do(),Ao()!==r?(ka=t,t=bn(n,a)):($a=t,t=r)):($a=t,t=r)):($a=t,t=r)):($a=t,t=r)):($a=t,t=r)),t!==r?(ka=e,e=An(t)):($a=e,e=r)):($a=e,e=r),e}())===r&&(e=function(){var e,t,n,a,i,o,u;return e=$a,Ki()!==r?(Do(),t=$a,bo()!==r?(Do(),(n=ti())!==r?(Do(),Gi()!==r?(Do(),(a=ti())!==r?(Do(),i=$a,Wi()!==r?(o=Do(),(u=ti())!==r?(Do(),i=u):($a=i,i=r)):($a=i,i=r),i===r&&(i=null),Ao()!==r?(ka=t,t=Dn(n,a,i)):($a=t,t=r)):($a=t,t=r)):($a=t,t=r)):($a=t,t=r)):($a=t,t=r),t===r&&(t=$a,bo()!==r?(Do(),(n=ti())!==r?(Do(),Fo()!==r?(Do(),(a=ti())!==r?(Do(),(i=Fo())!==r?(Do(),(o=ti())!==r&&(u=Ao())!==r?(ka=t,t=Pn(n,a,o)):($a=t,t=r)):($a=t,t=r)):($a=t,t=r)):($a=t,t=r)):($a=t,t=r)):($a=t,t=r)),t!==r?(ka=e,e=Rn(t)):($a=e,e=r)):($a=e,e=r),e}())===r&&(e=function(){var e,t,n,a,i;return e=$a,eo()!==r?(Do(),t=$a,bo()!==r?(Do(),n=Li(),Do(),(a=ti())!==r?(Do(),Gi()!==r?(Do(),(i=ti())!==r?(Do(),Ao()!==r?(ka=t,t=Qn(n,a,i)):($a=t,t=r)):($a=t,t=r)):($a=t,t=r)):($a=t,t=r)):($a=t,t=r),t===r&&(t=$a,bo()!==r?(Do(),n=Li(),Do(),(a=ti())!==r?(Do(),Ao()!==r?(ka=t,t=jn(n,a)):($a=t,t=r)):($a=t,t=r)):($a=t,t=r)),t!==r?(ka=e,e=Gn(t)):($a=e,e=r)):($a=e,e=r),e}())===r&&(e=function(){var e,t,n,a;return e=$a,to()!==r?(Do(),t=$a,bo()!==r?(Do(),(n=ti())!==r?(Do(),Vi()!==r?(Do(),(a=ti())!==r?(Do(),Ao()!==r?(ka=t,t=Kn(n,a)):($a=t,t=r)):($a=t,t=r)):($a=t,t=r)):($a=t,t=r)):($a=t,t=r),t===r&&(t=$a,bo()!==r?(Do(),(n=ti())!==r?(Do(),Fo()!==r?(Do(),(a=ti())!==r?(Do(),Ao()!==r?(ka=t,t=Xn(n,a)):($a=t,t=r)):($a=t,t=r)):($a=t,t=r)):($a=t,t=r)):($a=t,t=r)),t!==r?(ka=e,e=er(t)):($a=e,e=r)):($a=e,e=r),e}())===r&&(e=function(){var e,t,n,a;return e=$a,so()!==r?(Do(),t=$a,bo()!==r?(Do(),(n=ti())!==r?(Do(),lo()!==r?(Do(),(a=yi())!==r?(Do(),Ao()!==r?(ka=t,t=_n(n,a)):($a=t,t=r)):($a=t,t=r)):($a=t,t=r)):($a=t,t=r)):($a=t,t=r),t===r&&(t=$a,bo()!==r?(Do(),(n=ti())!==r?(Do(),Fo()!==r?(Do(),(a=yi())!==r?(Do(),Ao()!==r?(ka=t,t=Un(n,a)):($a=t,t=r)):($a=t,t=r)):($a=t,t=r)):($a=t,t=r)):($a=t,t=r)),t!==r?(ka=e,e=$n(t)):($a=e,e=r)):($a=e,e=r),e}())===r&&(e=function(){var e,t,n,a;return e=$a,t=$a,qa++,n=Xi(),qa--,n===r?t=void 0:($a=t,t=r),t!==r&&(n=Ro())!==r?(Do(),(a=ei())!==r?(ka=e,e=tr(n,a)):($a=e,e=r)):($a=e,e=r),e}())===r&&(e=function(){var e;return(e=function(){var e,t,n,a,i;if(e=$a,Zo()!==r)if(Do(),(t=ti())!==r){for(Do(),n=[],a=$a,(i=Fi())!==r?(Do(),a=i):($a=a,a=r);a!==r;)n.push(a),a=$a,(i=Fi())!==r?(Do(),a=i):($a=a,a=r);(a=Co())!==r?(ka=e,e=br(t,n)):($a=e,e=r)}else $a=e,e=r;else $a=e,e=r;if(e===r)if(e=$a,Zo()!==r)if(Do(),(t=ti())!==r){for(Do(),n=[],a=$a,(i=Fi())!==r?(Do(),a=i):($a=a,a=r);a!==r;)n.push(a),a=$a,(i=Fi())!==r?(Do(),a=i):($a=a,a=r);(a=bi())!==r?(i=Do(),Co()!==r?(ka=e,e=Ar(t,n,a)):($a=e,e=r)):($a=e,e=r)}else $a=e,e=r;else $a=e,e=r;return e}())===r&&(e=function(){var e,t,n,a;if(e=$a,Zo()!==r){for(Do(),t=[],n=$a,(a=Mi())!==r?(Do(),n=a):($a=n,n=r);n!==r;)t.push(n),n=$a,(a=Mi())!==r?(Do(),n=a):($a=n,n=r);(n=Co())!==r?(ka=e,e=Dr(t)):($a=e,e=r)}else $a=e,e=r;if(e===r)if(e=$a,Zo()!==r){for(Do(),t=[],n=$a,(a=Mi())!==r?(Do(),n=a):($a=n,n=r);n!==r;)t.push(n),n=$a,(a=Mi())!==r?(Do(),n=a):($a=n,n=r);(n=bi())!==r?(a=Do(),Co()!==r?(ka=e,e=Pr(t,n)):($a=e,e=r)):($a=e,e=r)}else $a=e,e=r;return e}()),e}())===r&&(e=function(){var e,t;return e=$a,(t=function(){var e,t;return e=$a,(t=function(){var e,t,n,a;if(e=$a,(t=pi())!==r){for(n=[],a=vi();a!==r;)n.push(a),a=vi();ka=e,e=On(t,n)}else $a=e,e=r;return e}())!==r&&(ka=e,t=Sn(t)),t}())!==r&&(ka=e,t=Tn(t)),(e=t)===r&&(e=$a,(t=function(){var e,t;return e=$a,Ii()!==r?(t=function(){var e,t,n;for(e=$a,t=[],n=hi();n!==r;)t.push(n),n=hi();return ka=e,xn(t)}(),Ii()!==r?(ka=e,e=Cn(t)):($a=e,e=r)):($a=e,e=r),e}())!==r&&(ka=e,t=Nn(t)),e=t),e}())===r&&(e=gi())===r&&(e=$a,bo()!==r?(Do(),(t=ti())!==r?(Do(),Ao()!==r?(ka=e,e=Ln(t)):($a=e,e=r)):($a=e,e=r)):($a=e,e=r)),e}function di(){var e,t,n,a;if(e=$a,(t=pi())!==r){for(n=[],a=mi();a!==r;)n.push(a),a=mi();ka=e,e=Zn(t,n)}else $a=e,e=r;return e}function pi(){var t;return t=e.charAt($a),ge.test(t)?$a++:(t=r,0===qa&&Wa($e)),t}function mi(){var t;return t=e.charAt($a),ye.test(t)?$a++:(t=r,0===qa&&Wa(ke)),t}function vi(){var t;return t=e.charAt($a),Le.test(t)?$a++:(t=r,0===qa&&Wa(Je)),t}function hi(){var e;return(e=wi())===r&&(e=function(){var e;return e=$a,Ii()!==r&&Ii()!==r?(ka=e,e=En()):($a=e,e=r),e}()),e}function wi(){var t;return t=e.charAt($a),Le.test(t)?$a++:(t=r,0===qa&&Wa(Je)),t}function Ii(){var t;return t=e.charAt($a),Te.test(t)?$a++:(t=r,0===qa&&Wa(Ve)),t}function gi(){var t,n,a,i;return t=$a,n=$a,64===e.charCodeAt($a)?(a=v,$a++):(a=r,0===qa&&Wa(ze)),a!==r&&(i=di())!==r?n=a=[a,i]:($a=n,n=r),n!==r&&(ka=t,n=Mn(n)),n}function yi(){var e,t,n;return e=$a,(t=co())!==r&&(ka=e,t=kn()),(e=t)===r&&(e=$a,(t=fo())!==r&&(ka=e,t=Jn()),(e=t)===r&&(e=$a,(t=po())!==r&&(ka=e,t=Vn()),(e=t)===r&&(e=$a,(t=mo())!==r&&(ka=e,t=zn()),(e=t)===r&&(e=$a,(t=ro())!==r&&(ka=e,t=qn()),(e=t)===r&&(e=$a,(t=no())!==r&&(ka=e,t=Hn()),(e=t)===r&&(e=$a,(t=ao())!==r&&(ka=e,t=Yn()),(e=t)===r&&(e=$a,(t=vo())!==r?(Do(),bo()!==r?(Do(),(n=Ri())!==r?(Do(),Ao()!==r?(ka=e,e=Bn(n)):($a=e,e=r)):($a=e,e=r)):($a=e,e=r)):($a=e,e=r)))))))),e}function Li(){var e,t;return e=$a,(t=io())===r&&(t=oo())===r&&(t=uo()),t===r&&(t=null),ka=e,Wn(t)}function Ti(){var e,t;return e=$a,(t=Io())===r&&(t=Lo())===r&&(t=To())===r&&(t=No())===r&&(t=So())===r&&(t=Oo())===r&&(t=go())===r&&(t=yo()),t!==r&&(ka=e,t=nr(t)),t}function Ni(){var t,n,a,i;return t=$a,wo()!==r?(Do(),n=e.charAt($a),we.test(n)?$a++:(n=r,0===qa&&Wa(Re)),n!==r?(Do(),(a=xi())!==r?(Do(),(i=Si())!==r?(ka=t,t=ir(n,a,i)):($a=t,t=r)):($a=t,t=r)):($a=t,t=r)):($a=t,t=r),t===r&&(t=$a,wo()!==r?(Do(),(n=xi())!==r?(Do(),(a=Si())!==r?(ka=t,t=or(n,a)):($a=t,t=r)):($a=t,t=r)):($a=t,t=r)),t}function Si(){var e,t,n;return e=$a,(t=function(){var e,t,n;return e=$a,(t=Oi())!==r?(Do(),bo()!==r?(Do(),(n=Ci())!==r?(Do(),Ao()!==r?(ka=e,e=sr(t,n)):($a=e,e=r)):($a=e,e=r)):($a=e,e=r)):($a=e,e=r),e===r&&(e=$a,(t=Oi())!==r&&(ka=e,t=lr(t)),e=t),e}())!==r?(Do(),ho()!==r?(Do(),(n=function(){var e,t,n,a;return e=$a,(t=Oi())!==r&&(ka=e,t=cr(t)),(e=t)===r&&(e=$a,(t=Oo())!==r?(Do(),bo()!==r?(Do(),(n=Ci())!==r?(Do(),Fo()!==r?(Do(),(a=Zi())!==r?(Do(),Ao()!==r?(ka=e,e=fr(n,a)):($a=e,e=r)):($a=e,e=r)):($a=e,e=r)):($a=e,e=r)):($a=e,e=r)):($a=e,e=r),e===r&&(e=$a,(t=Oo())!==r?(Do(),bo()!==r?(Do(),(n=Ci())!==r?(Do(),Ao()!==r?(ka=e,e=dr(n)):($a=e,e=r)):($a=e,e=r)):($a=e,e=r)):($a=e,e=r),e===r&&(e=$a,(t=Oo())!==r&&(ka=e,t=pr()),e=t))),e}())!==r?(ka=e,e=ur(t,n)):($a=e,e=r)):($a=e,e=r)):($a=e,e=r),e===r&&(e=function(){var e,t,n,a;return e=$a,(t=Oi())!==r?(Do(),bo()!==r?(Do(),(n=Zi())!==r?(Do(),Ao()!==r?(ka=e,e=mr(t,n)):($a=e,e=r)):($a=e,e=r)):($a=e,e=r)):($a=e,e=r),e===r&&(e=$a,(t=Oi())!==r&&(ka=e,t=vr(t)),(e=t)===r&&(e=$a,(t=Oo())!==r?(Do(),bo()!==r?(Do(),(n=Ci())!==r?(Do(),Fo()!==r?(Do(),(a=Zi())!==r?(Do(),Ao()!==r?(ka=e,e=hr(n,a)):($a=e,e=r)):($a=e,e=r)):($a=e,e=r)):($a=e,e=r)):($a=e,e=r)):($a=e,e=r),e===r&&(e=$a,(t=Oo())!==r?(Do(),bo()!==r?(Do(),(n=Zi())!==r?(Do(),Ao()!==r?(ka=e,e=wr(n)):($a=e,e=r)):($a=e,e=r)):($a=e,e=r)):($a=e,e=r),e===r&&(e=$a,(t=Oo())!==r&&(ka=e,t=Ir()),e=t)))),e}()),e}function Oi(){var e,t;return e=$a,(t=To())!==r&&(ka=e,t=gr()),(e=t)===r&&(e=$a,(t=No())!==r&&(ka=e,t=yr()),(e=t)===r&&(e=$a,(t=So())!==r&&(ka=e,t=Lr()),(e=t)===r&&(e=$a,(t=Lo())!==r&&(ka=e,t=Tr()),(e=t)===r&&(e=$a,(t=Io())!==r&&(ka=e,t=Nr()),e=t)))),e}function Zi(){var e,t;return e=$a,(t=Ri())!==r&&(ka=e,t=Sr(t)),t}function Ci(){var e,t;return e=$a,(t=Ri())!==r&&(ka=e,t=Or(t)),t}function xi(){var e;return(e=Ei())===r&&(e=gi()),e}function Ei(){var t,n,a,i,o;if(t=$a,39===e.charCodeAt($a)?(n=h,$a++):(n=r,0===qa&&Wa(qe)),n===r&&(e.substr($a,2)===w?(n=w,$a+=2):(n=r,0===qa&&Wa(He))),n!==r){for(a=[],i=$a,e.substr($a,2)===I?(o=I,$a+=2):(o=r,0===qa&&Wa(Ye)),o!==r&&(ka=i,o=Mr()),(i=o)===r&&(i=e.charAt($a),Ne.test(i)?$a++:(i=r,0===qa&&Wa(Be)));i!==r;)a.push(i),i=$a,e.substr($a,2)===I?(o=I,$a+=2):(o=r,0===qa&&Wa(Ye)),o!==r&&(ka=i,o=Mr()),(i=o)===r&&(i=e.charAt($a),Ne.test(i)?$a++:(i=r,0===qa&&Wa(Be)));39===e.charCodeAt($a)?(i=h,$a++):(i=r,0===qa&&Wa(qe)),i!==r?(ka=t,t=Fr(a)):($a=t,t=r)}else $a=t,t=r;return t}function Mi(){var e,t,n;return e=$a,xo()!==r?(Do(),(t=ti())!==r?(Do(),Eo()!==r?(Do(),(n=ti())!==r?(ka=e,e=Rr(t,n)):($a=e,e=r)):($a=e,e=r)):($a=e,e=r)):($a=e,e=r),e}function Fi(){var e,t,n;return e=$a,xo()!==r?(Do(),(t=ti())!==r?(Do(),Eo()!==r?(Do(),(n=ti())!==r?(ka=e,e=_r(t,n)):($a=e,e=r)):($a=e,e=r)):($a=e,e=r)):($a=e,e=r),e}function bi(){var e,t;return e=$a,Mo()!==r?(Do(),(t=ti())!==r?(ka=e,e=Ur(t)):($a=e,e=r)):($a=e,e=r),e}function Ai(){var t,n,a;return(t=Ri())===r&&(t=$a,n=e.charAt($a),we.test(n)?$a++:(n=r,0===qa&&Wa(Re)),n!==r&&(a=Ri())!==r?(ka=t,t=qr(n,a)):($a=t,t=r)),t}function Di(){var t,n,a;return t=$a,46===e.charCodeAt($a)?(n=g,$a++):(n=r,0===qa&&Wa(Qe)),n!==r?((a=Ri())===r&&(a=null),ka=t,t=Hr(a)):($a=t,t=r),t}function Pi(){var e,t,n;return e=$a,(t=Ui())!==r&&(n=Ri())!==r?(ka=e,e=Yr(t,n)):($a=e,e=r),e}function Ri(){var e,t,n;if(e=$a,t=[],(n=_i())!==r)for(;n!==r;)t.push(n),n=_i();else t=r;return t!==r&&(ka=e,t=Br(t)),t}function _i(){var t;return t=e.charAt($a),Se.test(t)?$a++:(t=r,0===qa&&Wa(je)),t}function Ui(){var t,n,a;return t=$a,n=e.charAt($a),Oe.test(n)?$a++:(n=r,0===qa&&Wa(Ge)),n!==r?(a=e.charAt($a),we.test(a)?$a++:(a=r,0===qa&&Wa(Re)),a===r&&(a=null),ka=t,t=Qr(n,a)):($a=t,t=r),t}function $i(){var t,n,a,i;return t=$a,(n=e.substr($a,4)).toLowerCase()===y?$a+=4:(n=r,0===qa&&Wa(We)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?t=n=[n,a]:($a=t,t=r)):($a=t,t=r),t}function ki(){var t,n,a,i;return t=$a,(n=e.substr($a,4)).toLowerCase()===L?$a+=4:(n=r,0===qa&&Wa(Ke)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?t=n=[n,a]:($a=t,t=r)):($a=t,t=r),t}function Ji(){var t,n,a,i;return t=$a,(n=e.substr($a,5)).toLowerCase()===T?$a+=5:(n=r,0===qa&&Wa(Xe)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?t=n=[n,a]:($a=t,t=r)):($a=t,t=r),t}function Vi(){var t,n,a,i;return t=$a,(n=e.substr($a,2)).toLowerCase()===N?$a+=2:(n=r,0===qa&&Wa(et)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=jr()):($a=t,t=r)):($a=t,t=r),t}function zi(){var t,n,a,i;return t=$a,(n=e.substr($a,2)).toLowerCase()===S?$a+=2:(n=r,0===qa&&Wa(tt)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=Gr()):($a=t,t=r)):($a=t,t=r),t}function qi(){var t,n,a,i;return t=$a,(n=e.substr($a,4)).toLowerCase()===O?$a+=4:(n=r,0===qa&&Wa(nt)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=Wr()):($a=t,t=r)):($a=t,t=r),t}function Hi(){var t,n,a,i;return t=$a,(n=e.substr($a,6)).toLowerCase()===Z?$a+=6:(n=r,0===qa&&Wa(rt)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=Kr()):($a=t,t=r)):($a=t,t=r),t}function Yi(){var t,n,a,i;return t=$a,(n=e.substr($a,3)).toLowerCase()===C?$a+=3:(n=r,0===qa&&Wa(at)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=Xr()):($a=t,t=r)):($a=t,t=r),t}function Bi(){var t,n,a,i;return t=$a,(n=e.substr($a,3)).toLowerCase()===x?$a+=3:(n=r,0===qa&&Wa(it)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=ea()):($a=t,t=r)):($a=t,t=r),t}function Qi(){var t,n,a,i;return t=$a,(n=e.substr($a,2)).toLowerCase()===E?$a+=2:(n=r,0===qa&&Wa(ot)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=ta()):($a=t,t=r)):($a=t,t=r),t}function ji(){var t,n,a,i;return t=$a,(n=e.substr($a,7)).toLowerCase()===M?$a+=7:(n=r,0===qa&&Wa(ut)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=na()):($a=t,t=r)):($a=t,t=r),t}function Gi(){var t,n,a,i;return t=$a,(n=e.substr($a,4)).toLowerCase()===F?$a+=4:(n=r,0===qa&&Wa(st)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=ra()):($a=t,t=r)):($a=t,t=r),t}function Wi(){var t,n,a,i;return t=$a,(n=e.substr($a,3)).toLowerCase()===b?$a+=3:(n=r,0===qa&&Wa(lt)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=aa()):($a=t,t=r)):($a=t,t=r),t}function Ki(){var t,n,a,i;return t=$a,(n=e.substr($a,9)).toLowerCase()===A?$a+=9:(n=r,0===qa&&Wa(ct)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=ia()):($a=t,t=r)):($a=t,t=r),t}function Xi(){var t,n,a,i;return t=$a,(n=e.substr($a,7)).toLowerCase()===D?$a+=7:(n=r,0===qa&&Wa(ft)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=oa()):($a=t,t=r)):($a=t,t=r),t}function eo(){var t,n,a,i;return t=$a,(n=e.substr($a,4)).toLowerCase()===P?$a+=4:(n=r,0===qa&&Wa(dt)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=ua()):($a=t,t=r)):($a=t,t=r),t}function to(){var t,n,a,i;return t=$a,(n=e.substr($a,8)).toLowerCase()===R?$a+=8:(n=r,0===qa&&Wa(pt)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=sa()):($a=t,t=r)):($a=t,t=r),t}function no(){var t,n,a,i;return t=$a,(n=e.substr($a,9)).toLowerCase()===_?$a+=9:(n=r,0===qa&&Wa(mt)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=la()):($a=t,t=r)):($a=t,t=r),t}function ro(){var t,n,a,i;return t=$a,(n=e.substr($a,4)).toLowerCase()===U?$a+=4:(n=r,0===qa&&Wa(vt)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=ca()):($a=t,t=r)):($a=t,t=r),t}function ao(){var t,n,a,i;return t=$a,(n=e.substr($a,4)).toLowerCase()===$?$a+=4:(n=r,0===qa&&Wa(ht)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=fa()):($a=t,t=r)):($a=t,t=r),t}function io(){var t,n,a,i;return t=$a,(n=e.substr($a,7)).toLowerCase()===k?$a+=7:(n=r,0===qa&&Wa(wt)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=da()):($a=t,t=r)):($a=t,t=r),t}function oo(){var t,n,a,i;return t=$a,(n=e.substr($a,8)).toLowerCase()===J?$a+=8:(n=r,0===qa&&Wa(It)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=pa()):($a=t,t=r)):($a=t,t=r),t}function uo(){var t,n,a,i;return t=$a,(n=e.substr($a,4)).toLowerCase()===V?$a+=4:(n=r,0===qa&&Wa(gt)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=ma()):($a=t,t=r)):($a=t,t=r),t}function so(){var t,n,a,i;return t=$a,(n=e.substr($a,4)).toLowerCase()===z?$a+=4:(n=r,0===qa&&Wa(yt)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=va()):($a=t,t=r)):($a=t,t=r),t}function lo(){var t,n,a,i;return t=$a,(n=e.substr($a,2)).toLowerCase()===q?$a+=2:(n=r,0===qa&&Wa(Lt)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=ha()):($a=t,t=r)):($a=t,t=r),t}function co(){var t,n,a,i;return t=$a,(n=e.substr($a,7)).toLowerCase()===H?$a+=7:(n=r,0===qa&&Wa(Tt)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=wa()):($a=t,t=r)):($a=t,t=r),t}function fo(){var t,n,a,i;return t=$a,(n=e.substr($a,8)).toLowerCase()===Y?$a+=8:(n=r,0===qa&&Wa(Nt)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=Ia()):($a=t,t=r)):($a=t,t=r),t}function po(){var t,n,a,i;return t=$a,(n=e.substr($a,5)).toLowerCase()===B?$a+=5:(n=r,0===qa&&Wa(St)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=ga()):($a=t,t=r)):($a=t,t=r),t}function mo(){var t,n,a,i;return t=$a,(n=e.substr($a,4)).toLowerCase()===Q?$a+=4:(n=r,0===qa&&Wa(Ot)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=ya()):($a=t,t=r)):($a=t,t=r),t}function vo(){var t,n,a,i;return t=$a,(n=e.substr($a,7)).toLowerCase()===j?$a+=7:(n=r,0===qa&&Wa(Zt)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=La()):($a=t,t=r)):($a=t,t=r),t}function ho(){var t,n,a,i;return t=$a,(n=e.substr($a,2)).toLowerCase()===G?$a+=2:(n=r,0===qa&&Wa(Ct)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=Ta()):($a=t,t=r)):($a=t,t=r),t}function wo(){var t,n,a,i;return t=$a,(n=e.substr($a,8)).toLowerCase()===W?$a+=8:(n=r,0===qa&&Wa(xt)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=Na()):($a=t,t=r)):($a=t,t=r),t}function Io(){var t,n,a,i;return t=$a,(n=e.substr($a,4)).toLowerCase()===K?$a+=4:(n=r,0===qa&&Wa(Et)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=Sa()):($a=t,t=r)):($a=t,t=r),t}function go(){var t,n,a,i;return t=$a,(n=e.substr($a,13)).toLowerCase()===X?$a+=13:(n=r,0===qa&&Wa(Mt)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=Oa()):($a=t,t=r)):($a=t,t=r),t}function yo(){var t,n,a,i;return t=$a,(n=e.substr($a,15)).toLowerCase()===ee?$a+=15:(n=r,0===qa&&Wa(Ft)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=Za()):($a=t,t=r)):($a=t,t=r),t}function Lo(){var t,n,a,i;return t=$a,(n=e.substr($a,5)).toLowerCase()===te?$a+=5:(n=r,0===qa&&Wa(bt)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=Ca()):($a=t,t=r)):($a=t,t=r),t}function To(){var t,n,a,i;return t=$a,(n=e.substr($a,3)).toLowerCase()===ne?$a+=3:(n=r,0===qa&&Wa(At)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=xa()):($a=t,t=r)):($a=t,t=r),t}function No(){var t,n,a,i;return t=$a,(n=e.substr($a,4)).toLowerCase()===re?$a+=4:(n=r,0===qa&&Wa(Dt)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=Ea()):($a=t,t=r)):($a=t,t=r),t}function So(){var t,n,a,i;return t=$a,(n=e.substr($a,6)).toLowerCase()===ae?$a+=6:(n=r,0===qa&&Wa(Pt)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=Ma()):($a=t,t=r)):($a=t,t=r),t}function Oo(){var t,n,a,i;return t=$a,(n=e.substr($a,6)).toLowerCase()===oe?$a+=6:(n=r,0===qa&&Wa(Rt)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=Fa()):($a=t,t=r)):($a=t,t=r),t}function Zo(){var t,n,a,i;return t=$a,(n=e.substr($a,4)).toLowerCase()===ue?$a+=4:(n=r,0===qa&&Wa(_t)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=ba()):($a=t,t=r)):($a=t,t=r),t}function Co(){var t,n,a,i;return t=$a,(n=e.substr($a,3)).toLowerCase()===se?$a+=3:(n=r,0===qa&&Wa(Ut)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=Aa()):($a=t,t=r)):($a=t,t=r),t}function xo(){var t,n,a,i;return t=$a,(n=e.substr($a,4)).toLowerCase()===le?$a+=4:(n=r,0===qa&&Wa($t)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=Da()):($a=t,t=r)):($a=t,t=r),t}function Eo(){var t,n,a,i;return t=$a,(n=e.substr($a,4)).toLowerCase()===ce?$a+=4:(n=r,0===qa&&Wa(kt)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=Pa()):($a=t,t=r)):($a=t,t=r),t}function Mo(){var t,n,a,i;return t=$a,(n=e.substr($a,4)).toLowerCase()===fe?$a+=4:(n=r,0===qa&&Wa(Jt)),n!==r?(a=$a,qa++,i=mi(),qa--,i===r?a=void 0:($a=a,a=r),a!==r?(ka=t,t=Ra()):($a=t,t=r)):($a=t,t=r),t}function Fo(){var t;return 44===e.charCodeAt($a)?(t=de,$a++):(t=r,0===qa&&Wa(Vt)),t}function bo(){var t;return 40===e.charCodeAt($a)?(t=pe,$a++):(t=r,0===qa&&Wa(zt)),t}function Ao(){var t;return 41===e.charCodeAt($a)?(t=me,$a++):(t=r,0===qa&&Wa(qt)),t}function Do(){var e,t;for(e=[],t=Po();t!==r;)e.push(t),t=Po();return e}function Po(){var t;return t=e.charAt($a),Ze.test(t)?$a++:(t=r,0===qa&&Wa(Ht)),t}function Ro(){var t,n,a,i;if(t=$a,(n=di())!==r&&(ka=t,n=_a(n)),(t=n)===r)if(t=$a,96===e.charCodeAt($a)?(n=ve,$a++):(n=r,0===qa&&Wa(Yt)),n!==r){if(a=[],i=e.charAt($a),Ce.test(i)?$a++:(i=r,0===qa&&Wa(Bt)),i!==r)for(;i!==r;)a.push(i),i=e.charAt($a),Ce.test(i)?$a++:(i=r,0===qa&&Wa(Bt));else a=r;a!==r?(96===e.charCodeAt($a)?(i=ve,$a++):(i=r,0===qa&&Wa(Yt)),i!==r?(ka=t,t=Ua(a)):($a=t,t=r)):($a=t,t=r)}else $a=t,t=r;return t}function _o(e,t,n,r,a){const i={type:"binary-expression",location:a,operator:e,left:t,right:n};return void 0!==r&&(i.escape=r),i}function Uo(e,...t){return{type:"expression-list",location:e,value:t}}function $o(e,t){let n=e;for(const{op:e,expr:r,location:{end:a}}of t)n=_o(e,n,r,void 0,{...n.location,end:a});return n}if(n=o(),t.peg$library)return{peg$result:n,peg$currPos:$a,peg$FAILED:r,peg$maxFailExpected:za,peg$maxFailPos:Va};if(n!==r&&$a===e.length)return n;throw n!==r&&$a<e.length&&Wa({type:"end"}),function(e,t,n){return new ie(ie.buildMessage(e,t),e,t,n)}(za,Va<e.length?e.charAt(Va):null,Va<e.length?Ga(Va,Va+1):Ga(Va,Va))}(e)}}function se(e,t){if(null!=e)switch(t(e),e.type){case"when-clause":se(e.operand,t),se(e.value,t);break;case"case-expression":for(const n of e.clauses)se(n,t);"simple"===e.format&&se(e.operand,t),null!==e.else&&se(e.else,t);break;case"expression-list":for(const n of e.value)se(n,t);break;case"unary-expression":se(e.expr,t);break;case"binary-expression":se(e.left,t),se(e.right,t);break;case"function":se(e.args,t);break;case"interval":se(e.value,t),se(e.qualifier,t);break;case"interval-qualifier":se(e.start,t),se(e.end,t)}}const le=new Set(["current_timestamp","current_date","current_time"]);class ce{static makeBool(e){return de(e)}static featureValue(e,t,n,r){return Le(e,t,n,r)}static equalsNull(e){return null===e}static applyLike(e,t,n){return ye(e,t,n)}static ensureArray(e){return pe(e)}static applyIn(e,t,n){return we(e,t)}static currentDate(e){return o.n.fromNow(e)}static makeSqlInterval(e,t,n){return w.createFromValueAndQualifier(e,t,n)}static convertInterval(e){return e instanceof w?e.valueInMilliseconds():e}static currentTimestamp(e){return C(new Date,e)}static compare(e,t,n,r){return Q(t,n,e)}static calculate(e,t,n,r){return re(e,t,n,r)}static evaluateTime(e){return R(e)}static evaluateTimestamp(e,t,n){return _(e,t,n)}static evaluateDate(e,t){return U(e,t)}static evaluateFunction(e,t,n){return K(e,t,n)}static lookup(e,t){const n=t[e];return void 0===n?null:n}static between(e,t,n){return null==e||null==t[0]||null==t[1]?null:Q(e,t[0],">=")&&Q(e,t[1],"<=")}static notbetween(e,t,n){return null==e||null==t[0]||null==t[1]?null:Q(e,t[0],"<")||Q(e,t[1],">")}static ternaryNot(e){return me(e)}static ternaryAnd(e,t){return ve(e,t)}static ternaryOr(e,t){return he(e,t)}}class fe{constructor(e,t,n="UTC",r=null){this.fieldsIndex=t,this.timeZone=n,this.currentUser=r,this.parameters={},this._hasDateFunctions=void 0,this.parseTree=ue.parse(e);const{isStandardized:a,isAggregate:i,currentUserRequired:o,referencedFieldNames:u}=this._extractExpressionInfo(t);this._referencedFieldNames=u,this.isStandardized=a,this.isAggregate=i,this.currentUserRequired=o}static convertValueToStorageFormat(e,t=null){if(null===t)return F(e)?e.getTime():b(e)?e.toMillis():P(e)?e.toStorageFormat():D(e)?e.toStorageString():A(e)?e.toStorageFormat():e;switch(t){case"date":return F(e)?e.getTime():b(e)?e.toMillis():P(e)?e.toMilliseconds():A(e)?e.toNumber():e;case"date-only":return F(e)?o.n.fromDateJS(e).toString():P(e)?o.n.fromSqlTimeStampOffset(e).toString():b(e)?o.n.fromDateTime(e).toString():e;case"time-only":return F(e)?s.k.fromDateJS(e).toStorageString():b(e)?s.k.fromDateTime(e).toStorageString():P(e)?s.k.fromSqlTimeStampOffset(e).toStorageString():D(e)?e.toStorageString():e;case"timestamp-offset":if(F(e))return u.g.fromJSDate(e).toStorageFormat();if(b(e))return u.g.fromDateTime(e).toStorageFormat();if(P(e))return e.toStorageFormat()}return e}static create(e,t={}){return new fe(e,t.fieldsIndex,t.timeZone??void 0,t.currentUser)}get fieldNames(){return this._referencedFieldNames}testSet(e,t=Te,n=this.currentUser){return!!this._evaluateNode(this.parseTree,null,t,e,n)}calculateValue(e,t=Te,n=this.currentUser){const r=this._evaluateNode(this.parseTree,e,t,null,n);return r instanceof w?r.valueInMilliseconds()/864e5:r}calculateValueCompiled(e,t=Te,n=this.currentUser){return null!=this.parseTree._compiledVersion?this.parseTree._compiledVersion(e,this.parameters,t,this.fieldsIndex,this.timeZone,n??null):(0,i.A)("esri-csp-restrictions")?this.calculateValue(e,t):(this._compileMe(),this.parseTree._compiledVersion(e,this.parameters,t,this.fieldsIndex,this.timeZone,n??null))}testFeature(e,t=Te,n=this.currentUser){return!!this._evaluateNode(this.parseTree,e,t,null,n)}testFeatureCompiled(e,t=Te,n=this.currentUser){return null!=this.parseTree._compiledVersion?!!this.parseTree._compiledVersion(e,this.parameters,t,this.fieldsIndex,this.timeZone,n??null):(0,i.A)("esri-csp-restrictions")?this.testFeature(e,t):(this._compileMe(),!!this.parseTree._compiledVersion(e,this.parameters,t,this.fieldsIndex,this.timeZone,n??null))}get hasDateFunctions(){return null!=this._hasDateFunctions||(this._hasDateFunctions=!1,se(this.parseTree,(e=>{"current-time"===e.type?this._hasDateFunctions=!0:"function"===e.type&&(this._hasDateFunctions=this._hasDateFunctions||le.has(e.name.toLowerCase()))}))),this._hasDateFunctions}getFunctions(){const e=new Set;return se(this.parseTree,(t=>{"function"===t.type&&e.add(t.name.toLowerCase())})),Array.from(e)}getExpressions(){const e=new Map;return se(this.parseTree,(t=>{if("function"===t.type){const n=t.name.toLowerCase(),r=t.args.value[0];if("column-reference"===r.type){const t=r.column,a=`${n}-${t}`;e.has(a)||e.set(a,{aggregateType:n,field:t})}}})),[...e.values()]}getVariables(){const e=new Set;return se(this.parseTree,(t=>{"parameter"===t.type&&e.add(t.value.toLowerCase())})),Array.from(e)}_compileMe(){const e="return this.convertInterval("+this.evaluateNodeToJavaScript(this.parseTree)+")";this.parseTree._compiledVersion=new Function("feature","lookups","attributeAdapter","fieldsIndex","timeZone","currentUser",e).bind(ce)}_extractExpressionInfo(e){const t=[],n=new Set;let r=!0,a=!1,i=!1;return se(this.parseTree,(o=>{switch(o.type){case"column-reference":{const r=e?.get(o.column);let a,i;r?a=i=r.name??"":(i=o.column,a=i.toLowerCase()),n.has(a)||(n.add(a),t.push(i)),o.column=i;break}case"current-user":i=!0;break;case"function":{const{name:e,args:t}=o,n=t.value.length;r&&(r=function(e,t){const n=ne[e.toLowerCase()];return null!=n&&t>=n.minParams&&t<=n.maxParams}(e,n)),!1===a&&(a=f(e,n));break}}})),{referencedFieldNames:Array.from(t),isStandardized:r,isAggregate:a,currentUserRequired:i}}evaluateNodeToJavaScript(e){switch(e.type){case"interval":return"this.makeSqlInterval("+this.evaluateNodeToJavaScript(e.value)+", "+JSON.stringify(e.qualifier)+","+JSON.stringify(e.op)+")";case"case-expression":{let t="";if("simple"===e.format){const n=this.evaluateNodeToJavaScript(e.operand);t="( ";for(let r=0;r<e.clauses.length;r++)t+=" (this.compare('=',"+n+","+this.evaluateNodeToJavaScript(e.clauses[r].operand)+") ? ("+this.evaluateNodeToJavaScript(e.clauses[r].value)+") : ";null!==e.else?t+=this.evaluateNodeToJavaScript(e.else):t+="null",t+=" )"}else{t="( ";for(let n=0;n<e.clauses.length;n++)t+=" this.makeBool("+this.evaluateNodeToJavaScript(e.clauses[n].operand)+")===true ? ("+this.evaluateNodeToJavaScript(e.clauses[n].value)+") : ";null!==e.else?t+=this.evaluateNodeToJavaScript(e.else):t+="null",t+=" )"}return t}case"parameter":return"this.lookup("+JSON.stringify(e.value.toLowerCase())+",lookups)";case"expression-list":{let t="[";for(const n of e.value)"["!==t&&(t+=","),t+=this.evaluateNodeToJavaScript(n);return t+="]",t}case"unary-expression":return"this.ternaryNot("+this.evaluateNodeToJavaScript(e.expr)+")";case"binary-expression":switch(e.operator){case"AND":return"this.ternaryAnd("+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+" )";case"OR":return"this.ternaryOr("+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+" )";case"IS":if("null"!==e.right.type)throw new a.L8(a.Z7.UnsupportedIsRhs);return"this.equalsNull("+this.evaluateNodeToJavaScript(e.left)+")";case"ISNOT":if("null"!==e.right.type)throw new a.L8(a.Z7.UnsupportedIsRhs);return"(!(this.equalsNull("+this.evaluateNodeToJavaScript(e.left)+")))";case"IN":return"this.applyIn("+this.evaluateNodeToJavaScript(e.left)+",this.ensureArray("+this.evaluateNodeToJavaScript(e.right)+"), timeZone)";case"NOT IN":return"this.ternaryNot(this.applyIn("+this.evaluateNodeToJavaScript(e.left)+",this.ensureArray("+this.evaluateNodeToJavaScript(e.right)+"), timeZone))";case"BETWEEN":return"this.between("+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+", timeZone)";case"NOTBETWEEN":return"this.notbetween("+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+", timeZone)";case"LIKE":return"this.applyLike("+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+","+JSON.stringify(e.escape)+")";case"NOT LIKE":return"this.ternaryNot(this.applyLike("+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+","+JSON.stringify(e.escape)+"))";case"<>":case"<":case">":case">=":case"<=":case"=":return"this.compare("+JSON.stringify(e.operator)+","+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+", timeZone)";case"*":case"-":case"+":case"/":case"||":return"this.calculate("+JSON.stringify(e.operator)+","+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+", timeZone)";default:throw new a.L8(a.Z7.UnsupportedOperator,{operator:e.operator})}case"null":case"boolean":case"string":case"number":return JSON.stringify(e.value);case"time":return"this.evaluateTime("+JSON.stringify(e.value)+")";case"date":return"this.evaluateDate("+JSON.stringify(e.value)+", 'unknown')";case"timestamp":return"this.evaluateTimestamp("+JSON.stringify(e.value)+", 'unknown')";case"current-time":return"date"===e.mode?"this.currentDate(timeZone)":"this.currentTimestamp(timeZone)";case"current-user":return"currentUser";case"column-reference":return"this.featureValue(feature,"+JSON.stringify(e.column)+",fieldsIndex,attributeAdapter)";case"function":return"this.evaluateFunction("+JSON.stringify(e.name)+","+this.evaluateNodeToJavaScript(e.args)+", timeZone)"}throw new a.L8(a.Z7.UnsupportedSyntax,{node:e.type})}_evaluateNode(e,t,n,i,u){let s;switch(e.type){case"interval":{const r=this._evaluateNode(e.value,t,n,i,u);return w.createFromValueAndQualifier(r,e.qualifier,e.op)}case"case-expression":if("simple"===e.format){const r=this._evaluateNode(e.operand,t,n,i,u);for(let a=0;a<e.clauses.length;a++)if(Q(r,this._evaluateNode(e.clauses[a].operand,t,n,i,u),"=",this.timeZone))return this._evaluateNode(e.clauses[a].value,t,n,i,u);if(null!==e.else)return this._evaluateNode(e.else,t,n,i,u)}else{for(let r=0;r<e.clauses.length;r++)if(de(this._evaluateNode(e.clauses[r].operand,t,n,i,u)))return this._evaluateNode(e.clauses[r].value,t,n,i,u);if(null!==e.else)return this._evaluateNode(e.else,t,n,i,u)}return null;case"parameter":return s=this.parameters[e.value.toLowerCase()],F(s)?l.c9.fromJSDate(s):s instanceof r.lY?s.toDateTime():s;case"expression-list":{const r=[];for(const a of e.value)r.push(this._evaluateNode(a,t,n,i,u));return r}case"unary-expression":return me(this._evaluateNode(e.expr,t,n,i,u));case"binary-expression":switch(e.operator){case"AND":return ve(this._evaluateNode(e.left,t,n,i,u),this._evaluateNode(e.right,t,n,i,u));case"OR":return he(this._evaluateNode(e.left,t,n,i,u),this._evaluateNode(e.right,t,n,i,u));case"IS":if("null"!==e.right.type)throw new a.L8(a.Z7.UnsupportedIsRhs);return null===this._evaluateNode(e.left,t,n,i,u);case"ISNOT":if("null"!==e.right.type)throw new a.L8(a.Z7.UnsupportedIsRhs);return null!==this._evaluateNode(e.left,t,n,i,u);case"IN":{const r=pe(this._evaluateNode(e.right,t,n,i,u));return we(this._evaluateNode(e.left,t,n,i,u),r,this.timeZone)}case"NOT IN":{const r=pe(this._evaluateNode(e.right,t,n,i,u));return me(we(this._evaluateNode(e.left,t,n,i,u),r,this.timeZone))}case"BETWEEN":{const r=this._evaluateNode(e.left,t,n,i,u),a=this._evaluateNode(e.right,t,n,i,u);return null==r||null==a[0]||null==a[1]?null:Q(r,a[0],">=",this.timeZone)&&Q(r,a[1],"<=",this.timeZone)}case"NOTBETWEEN":{const r=this._evaluateNode(e.left,t,n,i,u),a=this._evaluateNode(e.right,t,n,i,u);return null==r||null==a[0]||null==a[1]?null:Q(r,a[0],"<",this.timeZone)||Q(r,a[1],">",this.timeZone)}case"LIKE":return ye(this._evaluateNode(e.left,t,n,i,u),this._evaluateNode(e.right,t,n,i,u),e.escape);case"NOT LIKE":return me(ye(this._evaluateNode(e.left,t,n,i,u),this._evaluateNode(e.right,t,n,i,u),e.escape));case"<>":case"<":case">":case">=":case"<=":case"=":return Q(this._evaluateNode(e.left,t,n,i,u),this._evaluateNode(e.right,t,n,i,u),e.operator,this.timeZone);case"-":case"+":case"*":case"/":case"||":return re(e.operator,this._evaluateNode(e.left,t,n,i,u),this._evaluateNode(e.right,t,n,i,u),this.timeZone)}case"null":case"boolean":case"string":case"number":return e.value;case"date":return e.parsedValue??=U(e.value,"unknown"),e.parsedValue;case"timestamp":return e.parsedValue??=_(e.value,"unknown"),e.parsedValue;case"time":return R(e.value);case"current-time":return"date"===e.mode?o.n.fromNow(this.timeZone):C(new Date,this.timeZone);case"current-user":return u??null;case"column-reference":return Le(t,e.column,this.fieldsIndex,n);case"data-type":return e.value;case"function":{if(this.isAggregate&&f(e.name,e.args.value.length)){const t=[];for(const r of e.args?.value||[]){const e=[];for(const t of i||[])e.push(this._evaluateNode(r,t,n,null,u));t.push(e)}return c(e.name,t)}const r=this._evaluateNode(e.args,t,n,i,u);return K(e.name,r,this.timeZone)}}throw new a.L8(a.Z7.UnsupportedSyntax,{node:e.type})}}function de(e){return!0===e}function pe(e){return Array.isArray(e)?e:[e]}function me(e){return null!==e?!0!==e:null}function ve(e,t){return null!=e&&null!=t?!0===e&&!0===t:!1!==e&&!1!==t&&null}function he(e,t){return null!=e&&null!=t?!0===e||!0===t:!0===e||!0===t||null}function we(e,t,n){if(null==e)return null;let r=!1;for(const n of t)if(null==n)r=null;else{if(e===n){r=!0;break}if(Y(e)&&Y(n)&&(r=Q(e,n,"="),r))break}return r}const Ie="-[]/{}()*+?.\\^$|";var ge;function ye(e,t,n){return null==e?null:function(e,t){const n=t;let r="",a=ge.Normal;for(let t=0;t<e.length;t++){const i=e.charAt(t);switch(a){case ge.Normal:i===n?a=ge.Escaped:Ie.includes(i)?r+="\\"+i:r+="%"===i?".*":"_"===i?".":i;break;case ge.Escaped:Ie.includes(i)?r+="\\"+i:r+=i,a=ge.Normal}}return new RegExp("^"+r+"$","m")}(t,n).test(e)}function Le(e,t,n,r){const a=r.getAttribute(e,t),i=n?.get(t);return null==a||"esriFieldTypeDate"!==i?.type&&"date"!==i?.type?null==a||"esriFieldTypeDateOnly"!==i?.type&&"date-only"!==i?.type?null==a||"esriFieldTypeTimeOnly"!==i?.type&&"time-only"!==i?.type?null==a||"esriFieldTypeTimestampOffset"!==i?.type&&"timestamp-offset"!==i?.type?a:new u.g(a):s.k.fromReader(a):o.n.fromReader(a):C(new Date(a),n?.getLuxonTimeZone(i.name)??l.mQ.utcInstance)}!function(e){e[e.Normal=0]="Normal",e[e.Escaped=1]="Escaped"}(ge||(ge={}));const Te={getAttribute:(e,t)=>(function(e){return e&&"object"==typeof e.attributes}(e)?e.attributes:e)[t]}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[382],{30382:(t,n,e)=>{e.r(n),e.d(n,{l:()=>c});var r,i,o,u=e(11053),s={exports:{}};r=s,i="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,o=function(t){var n,e;(t=void 0!==(t=t||{})?t:{}).ready=new Promise((function(t,r){n=t,e=r}));var r=Object.assign({},t),o="object"==typeof window,u="function"==typeof importScripts;"object"==typeof process&&"object"==typeof process.versions&&process.versions.node;var s,a="";(o||u)&&(u?a=self.location.href:"undefined"!=typeof document&&document.currentScript&&(a=document.currentScript.src),i&&(a=i),a=0!==a.indexOf("blob:")?a.substr(0,a.replace(/[?#].*/,"").lastIndexOf("/")+1):"",u&&(s=t=>{var n=new XMLHttpRequest;return n.open("GET",t,!1),n.responseType="arraybuffer",n.send(null),new Uint8Array(n.response)})),t.print||console.log.bind(console);var c,f,l=t.printErr||console.warn.bind(console);Object.assign(t,r),r=null,t.arguments&&t.arguments,t.thisProgram&&t.thisProgram,t.quit&&t.quit,t.wasmBinary&&(c=t.wasmBinary),t.noExitRuntime,"object"!=typeof WebAssembly&&j("no native wasm support detected");var p,h,d,m,_,y,g=!1,b="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function v(t,n){return t?function(t,n,e){for(var r=n+e,i=n;t[i]&&!(i>=r);)++i;if(i-n>16&&t.buffer&&b)return b.decode(t.subarray(n,i));for(var o="";n<i;){var u=t[n++];if(128&u){var s=63&t[n++];if(192!=(224&u)){var a=63&t[n++];if((u=224==(240&u)?(15&u)<<12|s<<6|a:(7&u)<<18|s<<12|a<<6|63&t[n++])<65536)o+=String.fromCharCode(u);else{var c=u-65536;o+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else o+=String.fromCharCode((31&u)<<6|s)}else o+=String.fromCharCode(u)}return o}(d,t,n):""}function w(n){p=n,t.HEAP8=h=new Int8Array(n),t.HEAP16=new Int16Array(n),t.HEAP32=m=new Int32Array(n),t.HEAPU8=d=new Uint8Array(n),t.HEAPU16=new Uint16Array(n),t.HEAPU32=_=new Uint32Array(n),t.HEAPF32=new Float32Array(n),t.HEAPF64=new Float64Array(n)}t.INITIAL_MEMORY;var A=[],R=[],S=[];function I(t){A.unshift(t)}function x(t){S.unshift(t)}var P=0,E=null;function j(n){t.onAbort&&t.onAbort(n),l(n="Aborted("+n+")"),g=!0,n+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(n);throw e(r),r}var C;function k(t){return t.startsWith("data:application/octet-stream;base64,")}function D(t){try{if(t==C&&c)return new Uint8Array(c);if(s)return s(t);throw"both async and sync fetching of the wasm failed"}catch(t){j(t)}}function W(){return c||!o&&!u||"function"!=typeof fetch?Promise.resolve().then((function(){return D(C)})):fetch(C,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at '"+C+"'";return t.arrayBuffer()})).catch((function(){return D(C)}))}function H(n){for(;n.length>0;){var e=n.shift();if("function"!=typeof e){var r=e.func;"number"==typeof r?void 0===e.arg?M(r)():M(r)(e.arg):r(void 0===e.arg?null:e.arg)}else e(t)}}k(C="lerc-wasm.wasm")||(C=function(n){return t.locateFile?t.locateFile(n,a):a+n}(C));var T=[];function M(t){var n=T[t];return n||(t>=T.length&&(T.length=t+1),T[t]=n=y.get(t)),n}function O(t){this.excPtr=t,this.ptr=t-24,this.set_type=function(t){_[this.ptr+4>>2]=t},this.get_type=function(){return _[this.ptr+4>>2]},this.set_destructor=function(t){_[this.ptr+8>>2]=t},this.get_destructor=function(){return _[this.ptr+8>>2]},this.set_refcount=function(t){m[this.ptr>>2]=t},this.set_caught=function(t){t=t?1:0,h[this.ptr+12|0]=t},this.get_caught=function(){return 0!=h[this.ptr+12|0]},this.set_rethrown=function(t){t=t?1:0,h[this.ptr+13|0]=t},this.get_rethrown=function(){return 0!=h[this.ptr+13|0]},this.init=function(t,n){this.set_adjusted_ptr(0),this.set_type(t),this.set_destructor(n),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var t=m[this.ptr>>2];m[this.ptr>>2]=t+1},this.release_ref=function(){var t=m[this.ptr>>2];return m[this.ptr>>2]=t-1,1===t},this.set_adjusted_ptr=function(t){_[this.ptr+16>>2]=t},this.get_adjusted_ptr=function(){return _[this.ptr+16>>2]},this.get_exception_ptr=function(){if(z(this.get_type()))return _[this.excPtr>>2];var t=this.get_adjusted_ptr();return 0!==t?t:this.excPtr}}function U(t){try{return f.grow(t-p.byteLength+65535>>>16),w(f.buffer),1}catch(t){}}var B={a:function(t,n,e,r){j("Assertion failed: "+v(t)+", at: "+[n?v(n):"unknown filename",e,r?v(r):"unknown function"])},c:function(t){return F(t+24)+24},b:function(t,n,e){throw new O(t).init(n,e),t},d:function(){j("")},f:function(t,n,e){d.copyWithin(t,n,n+e)},e:function(t){var n=d.length,e=2147483648;if((t>>>=0)>e)return!1;let r=(t,n)=>t+(n-t%n)%n;for(var i=1;i<=4;i*=2){var o=n*(1+.2/i);if(o=Math.min(o,t+100663296),U(Math.min(e,r(Math.max(t,o),65536))))return!0}return!1}};(function(){var n={a:B};function r(n,e){var r=n.exports;t.asm=r,w((f=t.asm.g).buffer),y=t.asm.m,function(t){R.unshift(t)}(t.asm.h),function(){if(P--,t.monitorRunDependencies&&t.monitorRunDependencies(P),0==P&&E){var n=E;E=null,n()}}()}function i(t){r(t.instance)}function o(t){return W().then((function(t){return WebAssembly.instantiate(t,n)})).then((function(t){return t})).then(t,(function(t){l("failed to asynchronously prepare wasm: "+t),j(t)}))}if(P++,t.monitorRunDependencies&&t.monitorRunDependencies(P),t.instantiateWasm)try{return t.instantiateWasm(n,r)}catch(t){return l("Module.instantiateWasm callback failed with error: "+t),!1}(c||"function"!=typeof WebAssembly.instantiateStreaming||k(C)||"function"!=typeof fetch?o(i):fetch(C,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,n).then(i,(function(t){return l("wasm streaming compile failed: "+t),l("falling back to ArrayBuffer instantiation"),o(i)}))}))).catch(e)})(),t.___wasm_call_ctors=function(){return(t.___wasm_call_ctors=t.asm.h).apply(null,arguments)},t._lerc_getBlobInfo=function(){return(t._lerc_getBlobInfo=t.asm.i).apply(null,arguments)},t._lerc_getDataRanges=function(){return(t._lerc_getDataRanges=t.asm.j).apply(null,arguments)},t._lerc_decode=function(){return(t._lerc_decode=t.asm.k).apply(null,arguments)},t._lerc_decode_4D=function(){return(t._lerc_decode_4D=t.asm.l).apply(null,arguments)};var F=t._malloc=function(){return(F=t._malloc=t.asm.n).apply(null,arguments)};t._free=function(){return(t._free=t.asm.o).apply(null,arguments)};var q,z=t.___cxa_is_pointer_type=function(){return(z=t.___cxa_is_pointer_type=t.asm.p).apply(null,arguments)};function L(e){function r(){q||(q=!0,t.calledRun=!0,g||(H(R),n(t),t.onRuntimeInitialized&&t.onRuntimeInitialized(),function(){if(t.postRun)for("function"==typeof t.postRun&&(t.postRun=[t.postRun]);t.postRun.length;)x(t.postRun.shift());H(S)}()))}P>0||(function(){if(t.preRun)for("function"==typeof t.preRun&&(t.preRun=[t.preRun]);t.preRun.length;)I(t.preRun.shift());H(A)}(),P>0||(t.setStatus?(t.setStatus("Running..."),setTimeout((function(){setTimeout((function(){t.setStatus("")}),1),r()}),1)):r()))}if(E=function t(){q||L(),q||(E=t)},t.run=L,t.preInit)for("function"==typeof t.preInit&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();return L(),t.ready},r.exports=o;const a=(0,u.g)(s.exports),c=Object.freeze(Object.defineProperty({__proto__:null,default:a},Symbol.toStringTag,{value:"Module"}))}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[4068,7364,4983],{40334:(e,t,i)=>{i.r(t),i.d(t,{constructAssociationMetaDataFeatureSetFromUrl:()=>X,constructFeatureSet:()=>$,constructFeatureSetFromPortalItem:()=>ne,constructFeatureSetFromRelationship:()=>ee,constructFeatureSetFromUrl:()=>K,convertToFeatureSet:()=>ae,createFeatureSetCollectionFromMap:()=>re,createFeatureSetCollectionFromService:()=>se,initialiseMetaDataCache:()=>z});var r=i(78888);class s{constructor(){this.declaredRootClass="esri.arcade.featureSetCollection",this._layerById={},this._layerByName={}}add(e,t,i){this._layerById[t]=i,this._layerByName[e]=i}async featureSetByName(e,t=!0,i=["*"]){return void 0===this._layerByName[e]?null:this._layerByName[e]}async featureSetById(e,t=!0,i=["*"]){return void 0===this._layerById[e]?null:this._layerById[e]}castToText(e=!1){return"object, FeatureSetCollection"}}var a=i(78878),n=i(35704),l=i(52106),o=i(68423),u=i(86691),d=i(87449),c=i(11221),h=i(89169),f=i(87594),p=i(33325),y=i(80609),_=i(50145),g=i(50835);class m{constructor(){this.field="",this.tofieldname="",this.typeofstat="MIN",this.workingexpr=null}clone(){const e=new m;return e.field=this.field,e.tofieldname=this.tofieldname,e.typeofstat=this.typeofstat,e.workingexpr=this.workingexpr,e}static parseStatField(e,t,i,r){const s=new m;s.field=e;const a=g.WhereClause.create(t,{fieldsIndex:i,timeZone:r}),n=function(e){if("function"===e.parseTree.type){if(0===e.parseTree.args.value.length)return{name:e.parseTree.name,expr:null};if(e.parseTree.args.value.length>1)throw new d.L8(d.Z7.MissingStatisticParameters);const t=g.WhereClause.create((0,y.Mi)(e.parseTree.args.value[0],p.zl.Standardised,e.parameters),{fieldsIndex:e.fieldsIndex,timeZone:e.timeZone,currentUser:e.currentUser});return{name:e.parseTree.name,expr:t}}return null}(a);if(null===n)throw new d.L8(d.Z7.UnsupportedSqlFunction,{function:""});const l=n.name.toUpperCase().trim();if("MIN"===l){if(s.typeofstat="MIN",s.workingexpr=n.expr,null===a)throw new d.L8(d.Z7.InvalidFunctionParameters,{function:"min"})}else if("MAX"===l){if(s.typeofstat="MAX",s.workingexpr=n.expr,null===a)throw new d.L8(d.Z7.InvalidFunctionParameters,{function:"max"})}else if("COUNT"===l)s.typeofstat="COUNT",s.workingexpr=n.expr;else if("STDEV"===l){if(s.typeofstat="STDDEV",s.workingexpr=n.expr,null===a)throw new d.L8(d.Z7.InvalidFunctionParameters,{function:"stdev"})}else if("SUM"===l){if(s.typeofstat="SUM",s.workingexpr=n.expr,null===a)throw new d.L8(d.Z7.InvalidFunctionParameters,{function:"sum"})}else if("MEAN"===l){if(s.typeofstat="AVG",s.workingexpr=n.expr,null===a)throw new d.L8(d.Z7.InvalidFunctionParameters,{function:l})}else if("AVG"===l){if(s.typeofstat="AVG",s.workingexpr=n.expr,null===a)throw new d.L8(d.Z7.InvalidFunctionParameters,{function:"avg"})}else{if("VAR"!==l)throw new d.L8(d.Z7.UnsupportedSqlFunction,{function:l});if(s.typeofstat="VAR",s.workingexpr=n.expr,null===a)throw new d.L8(d.Z7.InvalidFunctionParameters,{function:"var"})}return s}toStatisticsName(){switch(this.typeofstat.toUpperCase()){case"MIN":return"min";case"MAX":return"max";case"SUM":return"sum";case"COUNT":default:return"count";case"VAR":return"var";case"STDDEV":return"stddev";case"AVG":return"avg"}}}var w=i(80200),F=i(44729),S=i(55612),I=i(15032),b=i(16930),C=i(20437),A=i(95466);function v(e){if(!e)return"COUNT";switch(e.toLowerCase()){case"max":return"MAX";case"var":case"variance":return"VAR";case"avg":case"average":case"mean":return"AVG";case"min":return"MIN";case"sum":return"SUM";case"stdev":case"stddev":return"STDDEV";case"count":return"COUNT"}return"COUNT"}class T extends c.A{constructor(e){super(e),this._decodedStatsfield=[],this._decodedGroupbyfield=[],this._candosimplegroupby=!0,this.phsyicalgroupbyfields=[],this.objectIdField="ROW__ID",this._internalObjectIdField="ROW__ID",this._adaptedFields=[],this.declaredClass="esri.arcade.featureset.actions.Aggregate",this._uniqueIds=1,this._maxQuery=10,this._maxProcessing=10,this._parent=e.parentfeatureset,this._config=e}isTable(){return!0}async _getSet(e){if(null===this._wset){const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,this._wset}return this._wset}_isInFeatureSet(){return p.J6.InFeatureSet}_nextUniqueName(e){for(;1===e["T"+this._uniqueIds.toString()];)this._uniqueIds++;const t="T"+this._uniqueIds.toString();return e[t]=1,t}_convertToEsriFieldType(e){return e}_initialiseFeatureSet(){const e={};let t=!1,i=1;const r=this._parent?this._parent.getFieldsIndex():new A.A([]);for(this.objectIdField="ROW__ID",this.globalIdField="";!1===t;){let e=!1;for(let t=0;t<this._config.groupbyfields.length;t++)if(this._config.groupbyfields[t].name.toLowerCase()===this.objectIdField.toLowerCase()){e=!0;break}if(!1===e)for(let t=0;t<this._config.statsfields.length;t++)if(this._config.statsfields[t].name.toLowerCase()===this.objectIdField.toLowerCase()){e=!0;break}!1===e?t=!0:(this.objectIdField="ROW__ID"+i.toString(),i++)}for(const e of this._config.statsfields){const t=new m;t.field=e.name,t.tofieldname=e.name,t.workingexpr=e.expression instanceof g.WhereClause?e.expression:g.WhereClause.create(e.expression,{fieldsIndex:r,timeZone:this.dateFieldsTimeZoneDefaultUTC}),t.typeofstat=v(e.statistic),this._decodedStatsfield.push(t)}this._decodedGroupbyfield=[];for(const e of this._config.groupbyfields){const t={name:e.name,singlefield:null,tofieldname:e.name,expression:e.expression instanceof g.WhereClause?e.expression:g.WhereClause.create(e.expression,{fieldsIndex:r,timeZone:this.dateFieldsTimeZoneDefaultUTC}),sqlType:null};this._decodedGroupbyfield.push(t)}if(null!==this._parent){this.geometryType=this._parent.geometryType,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField="";for(const t of this._parent.fields)e[t.name.toUpperCase()]=1;this.types=null,this.subtypes=null,this.subtypeField=""}else this.geometryType=p.ik.point,this.typeIdField="",this.types=null,this.subtypes=null,this.subtypeField="",this.spatialReference=new b.A({wkid:4326});this.fields=[];const s=new m;s.field=this._nextUniqueName(e),s.tofieldname=this.objectIdField,s.workingexpr=g.WhereClause.create(this._parent.objectIdField,{fieldsIndex:this._parent.getFieldsIndex(),timeZone:this.dateFieldsTimeZoneDefaultUTC}),s.typeofstat="MIN",this._decodedStatsfield.push(s);for(const t of this._decodedGroupbyfield){const i=new C.A;if(t.name=this._nextUniqueName(e),i.name=t.tofieldname,i.alias=i.name,(0,y.DA)(t.expression)){const e=this._parent.getField((0,y.YY)(t.expression,p.zl.Standardised));if(!e)throw new d.dr(d.D_.AggregationFieldNotFound);t.name=e.name,t.singlefield=e.name,this.phsyicalgroupbyfields.push(e.name),i.type=e.type,t.sqlType=e.type}else{i.type=this._convertToEsriFieldType((0,y.IY)(t.expression,this._parent.fields));const e=new C.A;e.name=t.name,e.alias=e.name,this.phsyicalgroupbyfields.push(t.name),this._adaptedFields.push(new o.Gr(e,t.expression)),this._candosimplegroupby=!1,t.sqlType=i.type}this.fields.push(i)}if(this._adaptedFields.length>0)for(const e of this._parent.fields)this._adaptedFields.push(new o.IO(e));for(let t=0;t<this._decodedStatsfield.length;t++){const i=new C.A;let r=null;const s=this._decodedStatsfield[t];s.field=this._nextUniqueName(e),s.tofieldname===this.objectIdField&&(this._internalObjectIdField=s.field),i.name=s.tofieldname,i.alias=i.name;const a=null!==s.workingexpr&&(0,y.DA)(s.workingexpr)?(0,y.YY)(s.workingexpr,p.zl.Standardised):"";switch(this._decodedStatsfield[t].typeofstat){case"SUM":if(""!==a){if(r=this._parent.getField(a),!r)throw new d.dr(d.D_.AggregationFieldNotFound);i.type=r.type}else i.type="double";break;case"MIN":case"MAX":if(""!==a){if(r=this._parent.getField(a),!r)throw new d.dr(d.D_.AggregationFieldNotFound);i.type=r.type}else i.type="double";break;case"COUNT":i.type="integer";break;case"STDDEV":case"VAR":case"AVG":if(""!==a&&(r=this._parent.getField(a),!r))throw new d.dr(d.D_.AggregationFieldNotFound);i.type="double"}this.fields.push(i)}}async _canDoAggregates(){return!1}async _getFeatures(e,t,i,r){-1!==t&&this._featureCache[t];const s=this._maxQuery;return!0===this._checkIfNeedToExpandKnownPage(e,s)?(await this._expandPagedSet(e,s,0,0,r),this._getFeatures(e,t,i,r)):"success"}async _getFilteredSet(e,t,i,r,s){if(""!==e)return new h.A([],[],!0,null);let a=null;const l={ordered:!1,nowhereclause:!1};if(await this._ensureLoaded(),null!==i)for(let e=0;e<this._decodedStatsfield.length;e++)if(!0===(0,y.Ju)(i,this._decodedStatsfield[e].tofieldname)){l.nowhereclause=!0,i=null;break}if(null!==r){l.ordered=!0;for(let e=0;e<this._decodedStatsfield.length;e++)if(!0===r.scanForField(this._decodedStatsfield[e].tofieldname)){r=null,l.ordered=!1;break}if(null!==r)for(const e of this._decodedGroupbyfield)if(null===e.singlefield&&!0===r.scanForField(e.tofieldname)){r=null,l.ordered=!1;break}}if(!1!==this._candosimplegroupby&&await this._parent._canDoAggregates(this.phsyicalgroupbyfields,this._decodedStatsfield,"",null,null)){let e=null;i&&(e=this._reformulateWhereClauseWithoutGroupByFields(i));let t=null;r&&(t=this._reformulateOrderClauseWithoutGroupByFields(r));const n=await this._parent._getAggregatePagesDataSourceDefinition(this.phsyicalgroupbyfields,this._decodedStatsfield,"",null,e,t,this._internalObjectIdField);return this._checkCancelled(s),a=!0===l.nowhereclause?new h.A(n._candidates.slice().concat(n._known.slice()),[],!0===l.ordered&&n._ordered,this._clonePageDefinition(n.pagesDefinition)):new h.A(n._candidates.slice(),n._known.slice(),!0===l.ordered&&n._ordered,this._clonePageDefinition(n.pagesDefinition)),a}let d=this._parent;if(this._adaptedFields.length>0&&(d=new o.a({parentfeatureset:this._parent,adaptedFields:this._adaptedFields,extraFilter:null})),!0===l.nowhereclause)a=new h.A(["GETPAGES"],[],!1,{aggregatefeaturesetpagedefinition:!0,resultOffset:0,resultRecordCount:this._maxQuery,internal:{fullyResolved:!1,workingItem:null,type:"manual",iterator:null,set:[],subfeatureset:new u.A({parentfeatureset:d,orderbyclause:new f.A(this.phsyicalgroupbyfields.join(",")+","+this._parent.objectIdField+" ASC")})}});else{let e=d;if(null!==i){let t=null;i&&(t=this._reformulateWhereClauseWithoutGroupByFields(i)),e=new n.A({parentfeatureset:e,whereclause:t})}a=new h.A(["GETPAGES"],[],!1,{aggregatefeaturesetpagedefinition:!0,resultOffset:0,resultRecordCount:this._maxQuery,internal:{fullyResolved:!1,workingItem:null,type:"manual",iterator:null,set:[],subfeatureset:new u.A({parentfeatureset:e,orderbyclause:new f.A(this.phsyicalgroupbyfields.join(",")+","+this._parent.objectIdField+" ASC")})}})}return a}_reformulateWhereClauseWithoutStatsFields(e){for(const t of this._decodedStatsfield)e=(0,y.bD)(e,t.tofieldname,(0,y.YY)(t.workingexpr,p.zl.Standardised),this._parent.getFieldsIndex());return e}_reformulateWhereClauseWithoutGroupByFields(e){for(const t of this._decodedGroupbyfield)t.tofieldname!==t.name&&(e=(0,y.bD)(e,t.tofieldname,(0,y.YY)(t.expression,p.zl.Standardised),this._parent.getFieldsIndex()));return e}_reformulateOrderClauseWithoutGroupByFields(e){const t=[];for(const e of this._decodedGroupbyfield)e.tofieldname!==e.name&&t.push({field:e.tofieldname,newfield:e.name});return t.length>0?e.replaceFields(t):e}_clonePageDefinition(e){return null===e?null:!0===e.aggregatefeaturesetpagedefinition?{aggregatefeaturesetpagedefinition:!0,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,internal:e.internal}:this._parent._clonePageDefinition(e)}async _refineSetBlock(e,t,i){return!0===this._checkIfNeedToExpandCandidatePage(e,this._maxQuery)?(await this._expandPagedSet(e,this._maxQuery,0,0,i),this._refineSetBlock(e,t,i)):(this._checkCancelled(i),e._candidates.length,this._refineKnowns(e,t),e._candidates.length,e._candidates.length,e)}_expandPagedSet(e,t,i,r,s){return this._expandPagedSetFeatureSet(e,t,i,r,s)}async _getPhysicalPage(e,t,i){if(!0===e.pagesDefinition.aggregatefeaturesetpagedefinition)return this._sequentialGetPhysicalItem(e,e.pagesDefinition.resultRecordCount,i,[]);const r=await this._getAgregagtePhysicalPage(e,t,i);for(const e of r){const t={geometry:e.geometry,attributes:{}},i={};for(const t in e.attributes)i[t.toLowerCase()]=e.attributes[t];for(const e of this._decodedGroupbyfield)t.attributes[e.tofieldname]=i[e.name.toLowerCase()];for(const e of this._decodedStatsfield)t.attributes[e.tofieldname]=i[e.field.toLowerCase()];this._featureCache[t.attributes[this.objectIdField]]=new l.A(t)}return r.length}_sequentialGetPhysicalItem(e,t,i,r){return new Promise(((s,a)=>{null===e.pagesDefinition.internal.iterator&&(e.pagesDefinition.internal.iterator=e.pagesDefinition.internal.subfeatureset.iterator(i)),!0===e.pagesDefinition.internal.fullyResolved||0===t?s(r.length):this._nextAggregateItem(e,t,i,r,(a=>{null===a?s(r.length):(t-=1,s(this._sequentialGetPhysicalItem(e,t,i,r)))}),a)}))}_nextAggregateItem(e,t,i,r,s,n){try{(0,a.a1)(e.pagesDefinition.internal.iterator.next()).then((a=>{if(null===a)if(null!==e.pagesDefinition.internal.workingItem){const t=this._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);r.push(t),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(t.attributes[this.objectIdField]),e.pagesDefinition.internal.fullyResolved=!0,s(null)}else e.pagesDefinition.internal.fullyResolved=!0,s(null);else{const l=this._generateAggregateHash(a);if(null===e.pagesDefinition.internal.workingItem)e.pagesDefinition.internal.workingItem={features:[a],id:l};else{if(l!==e.pagesDefinition.internal.workingItem.id){const i=this._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);return r.push(i),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(i.attributes[this.objectIdField]),t-=1,e.pagesDefinition.internal.workingItem={features:[a],id:l},void s(i)}e.pagesDefinition.internal.workingItem.features.push(a)}this._nextAggregateItem(e,t,i,r,s,n)}}),n)}catch(e){n(e)}}_calculateFieldStat(e,t,i){const r=[];for(let i=0;i<e.features.length;i++)if(null!==t.workingexpr){const s=t.workingexpr.calculateValue(e.features[i]);null!==s&&(s instanceof F.n||s instanceof I.k?r.push(s.toNumber()):s instanceof S.g?r.push(s.toMilliseconds()):r.push(s))}else r.push(null);switch(t.typeofstat){case"MIN":i.attributes[t.tofieldname]=(0,_.tQ)("min",r,-1);break;case"MAX":i.attributes[t.tofieldname]=(0,_.tQ)("max",r,-1);break;case"SUM":i.attributes[t.tofieldname]=(0,_.tQ)("sum",r,-1);break;case"COUNT":i.attributes[t.tofieldname]=r.length;break;case"VAR":i.attributes[t.tofieldname]=(0,_.tQ)("var",r,-1);break;case"STDDEV":i.attributes[t.tofieldname]=(0,_.tQ)("stddev",r,-1);break;case"AVG":i.attributes[t.tofieldname]=(0,_.tQ)("avg",r,-1)}return!0}_calculateAndAppendAggregateItem(e){const t={attributes:{},geometry:null};for(const i of this._decodedGroupbyfield){const r=i.singlefield?e.features[0].attributes[i.singlefield]:g.WhereClause.convertValueToStorageFormat(i.expression.calculateValue(e.features[0]),i.sqlType);t.attributes[i.tofieldname]=r}for(const i of this._decodedStatsfield)this._calculateFieldStat(e,i,t);const i=[];for(let r=0;r<this._decodedStatsfield.length;r++)i.push(this._calculateFieldStat(e,this._decodedStatsfield[r],t));return this._featureCache[t.attributes[this.objectIdField]]=new l.A({attributes:t.attributes,geometry:t.geometry}),t}_generateAggregateHash(e){let t="";for(const i of this._decodedGroupbyfield){const r=i.singlefield?e.attributes[i.singlefield]:i.expression.calculateValue(e);t+=null==r?":":":"+r.toString()}return(0,w.d)(t,w.T.String)}async _stat(){return{calculated:!1}}async getFeatureByObjectId(){return null}static registerAction(){c.A._featuresetFunctions.groupby=function(e,t){return new T({parentfeatureset:this,groupbyfields:e,statsfields:t})}}}var D=i(54784),R=i(54461),x=i(70333),k=i(61454),N=i(66395),L=i(39516),E=i(65864),O=i(21325),P=i(13600),G=i(54546),j=i(61956),q=i(7562);class B extends c.A{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.sources.FeatureLayerDynamic",this._removeGeometry=!1,this._overrideFields=null,this.formulaCredential=null,this._pageJustIds=!1,this._requestStandardised=!1,this._useDefinitionExpression=!0,e.spatialReference&&(this.spatialReference=e.spatialReference),this._transparent=!0,this._maxProcessing=1e3,this._layer=e.layer,this._wset=null,void 0!==e.outFields&&(this._overrideFields=e.outFields),void 0!==e.includeGeometry&&(this._removeGeometry=!1===e.includeGeometry)}_maxQueryRate(){return p.gO}end(){return this._layer}optimisePagingFeatureQueries(e){this._pageJustIds=e}get urlQueryPath(){return this._layer.parsedUrl.path||""}convertQueryToLruCacheKey(e){const t=this.urlQueryPath+","+(0,p.JB)(e.toJSON());return(0,w.d)(t,w.T.String)}async loadImpl(){return!0===this._layer.loaded?(this._initialiseFeatureSet(),this):(await this._layer.load(),this._initialiseFeatureSet(),this)}_initialiseFeatureSet(){if(null==this.spatialReference&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this._layer.geometryType??"",this.fields=this._layer.fields.slice(),this.hasZ=!0===this._layer?.capabilities?.data?.supportsZ,this.hasM=!0===this._layer?.capabilities?.data?.supportsM,null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{const e=[],t=[];for(const i of this.fields)if("oid"===i.type)e.push(i),t.push(i.name);else for(const r of this._overrideFields)if(r.toLowerCase()===i.name.toLowerCase()){e.push(i),t.push(i.name);break}this.fields=e,this._overrideFields=t}if(this._layer.source&&this._layer.source.sourceJSON){const e=this._layer.source.sourceJSON.currentVersion;!0===this._layer.source.sourceJSON.useStandardizedQueries?(this._databaseType=p.zl.StandardisedNoInterval,null!=e&&e>=10.61&&(this._databaseType=p.zl.Standardised)):null!=e&&(e>=10.5&&(this._databaseType=p.zl.StandardisedNoInterval,this._requestStandardised=!0),e>=10.61&&(this._databaseType=p.zl.Standardised))}this.objectIdField=this._layer.objectIdField;for(const e of this.fields)"global-id"===e.type&&(this.globalIdField=e.name);this.subtypeField=this._layer.subtypeField??"",this.subtypes=this._layer.subtypes,this.typeIdField=("typeIdField"in this._layer?this._layer.typeIdField:null)??"",this.types="types"in this._layer?this._layer.types:null}_isInFeatureSet(){return p.J6.InFeatureSet}async _refineSetBlock(e){return e}_candidateIdTransform(e){return e}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}async _runDatabaseProbe(e){await this._ensureLoaded();const t=new j.A;this.datesInUnknownTimezone&&(t.timeReferenceUnknownClient=!0),t.where=e.replace("OBJECTID",this._layer.objectIdField);try{return await this._layer.queryObjectIds(t),!0}catch(e){return!1}}_canUsePagination(){return!(!this._layer.capabilities||!this._layer.capabilities.query||!0!==this._layer.capabilities.query.supportsPagination)}_cacheableFeatureSetSourceKey(){return this._layer.url}get gdbVersion(){return this._layer&&this._layer.capabilities&&this._layer.capabilities.data&&this._layer.capabilities.data.isVersioned?this._layer.gdbVersion||"SDE.DEFAULT":""}nativeCapabilities(){return{title:this._layer.title??"",source:this,canQueryRelated:!0,capabilities:this._layer.capabilities,databaseType:this._databaseType,requestStandardised:this._requestStandardised}}_createQuery(){const e=this._layer.createQuery();return e.returnZ=this.hasZ,e.returnM=this.hasM,this.datesInUnknownTimezone&&(e.timeReferenceUnknownClient=!0),this._requestStandardised&&(e.sqlFormat="standard"),this._useDefinitionExpression?"subtype-group"===this._layer.type&&(e.where=this._layer.definitionExpression):e.where=null,e}executeQuery(e,t){const i="execute"===t?this._layer.queryFeatures.bind(this._layer):"executeForCount"===t?this._layer.queryFeatureCount.bind(this._layer):this._layer.queryObjectIds.bind(this._layer);let r=null;if(this.recentlyUsedQueries){const t=this.convertQueryToLruCacheKey(e);r=this.recentlyUsedQueries.getFromCache(t),null===r&&(r=i(e),this.recentlyUsedQueries.addToCache(t,r),r=r.catch((e=>{throw this.recentlyUsedQueries?.removeFromCache(t),e})))}return this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:e,method:t}),null===r&&(r=i(e)),r}async _getFilteredSet(e,t,i,r,s){const a=await this.databaseType();if(this.isTable()&&t&&null!==e&&""!==e)return new h.A([],[],!0,null);if(this._canUsePagination())return this._getFilteredSetUsingPaging(e,t,i,r,s);let n="",l=!1;null!==r&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(n=r.constructClause(),l=!0);const o=this._createQuery();o.where=(0,L.m)(o.where,null===i?null===t?"1=1":"":(0,y.YY)(i,a)),o.spatialRelationship=this._makeRelationshipEnum(e),o.outSpatialReference=this.spatialReference,o.orderByFields=""!==n?n.split(","):null,o.geometry=null===t?null:t,o.relationParameter=this._makeRelationshipParam(e);let u=await this.executeQuery(o,"executeForIds");return null===u&&(u=[]),this._checkCancelled(s),new h.A([],u,l,null)}_expandPagedSet(e,t,i,r,s){return this._expandPagedSetFeatureSet(e,t,i,r,s)}async _getFilteredSetUsingPaging(e,t,i,r,s){let a="",n=!1;null!==r&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(a=r.constructClause(),n=!0);const l=await this.databaseType(),o=null===i?null===t?"1=1":"":(0,y.YY)(i,l);let u=this._maxQueryRate();const d=this._layer.capabilities?.query.maxRecordCount;null!=d&&d<u&&(u=d);let c=null;if(!0===this._pageJustIds)c=new h.A([],["GETPAGES"],n,{spatialRel:this._makeRelationshipEnum(e),relationParam:this._makeRelationshipParam(e),outFields:this._layer.objectIdField,resultRecordCount:u,resultOffset:0,geometry:null===t?null:t,where:o,orderByFields:a,returnGeometry:!1,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}});else{let i=!0;!0===this._removeGeometry&&(i=!1);const r=this._overrideFields??this._fieldsIncludingObjectId(["*"]);c=new h.A([],["GETPAGES"],n,{spatialRel:this._makeRelationshipEnum(e),relationParam:this._makeRelationshipParam(e),outFields:r.join(","),resultRecordCount:u,resultOffset:0,geometry:null===t?null:t,where:o,orderByFields:a,returnGeometry:i,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}})}return await this._expandPagedSet(c,u,0,1,s),c}_clonePageDefinition(e){return null===e?null:!0!==e.groupbypage?{groupbypage:!1,spatialRel:e.spatialRel,relationParam:e.relationParam,outFields:e.outFields,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,geometry:e.geometry,where:e.where,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}:{groupbypage:!0,spatialRel:e.spatialRel,relationParam:e.relationParam,outFields:e.outFields,resultRecordCount:e.resultRecordCount,useOIDpagination:e.useOIDpagination,generatedOid:e.generatedOid,groupByFieldsForStatistics:e.groupByFieldsForStatistics,resultOffset:e.resultOffset,outStatistics:e.outStatistics,geometry:e.geometry,where:e.where,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}}async _getPhysicalPage(e,t,i){const r=e.pagesDefinition.internal.lastRetrieved,s=r,a=e.pagesDefinition.internal.lastPage,n=this._createQuery();n.spatialRelationship=e.pagesDefinition.spatialRel,n.relationParameter=e.pagesDefinition.relationParam,n.outFields=e.pagesDefinition.outFields.split(","),n.num=e.pagesDefinition.resultRecordCount,n.start=e.pagesDefinition.internal.lastPage,n.geometry=e.pagesDefinition.geometry,n.where=(0,L.m)(n.where,e.pagesDefinition.where),n.orderByFields=""!==e.pagesDefinition.orderByFields?e.pagesDefinition.orderByFields.split(","):null,n.returnGeometry=e.pagesDefinition.returnGeometry,n.outSpatialReference=this.spatialReference;const l=await this.executeQuery(n,"execute");if(this._checkCancelled(i),e.pagesDefinition.internal.lastPage!==a)return"done";const o=this._layer.objectIdField;for(let t=0;t<l.features.length;t++)e.pagesDefinition.internal.set[s+t]=l.features[t].attributes[o];if(!1===this._pageJustIds)for(let e=0;e<l.features.length;e++)this._featureCache[l.features[e].attributes[o]]=l.features[e];return(void 0===l.exceededTransferLimit&&l.features.length!==e.pagesDefinition.resultRecordCount||!1===l.exceededTransferLimit)&&(e.pagesDefinition.internal.fullyResolved=!0),e.pagesDefinition.internal.lastRetrieved=r+l.features.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,"done"}_fieldsIncludingObjectId(e){if(null===e)return[this.objectIdField];const t=e.slice();if(t.includes("*"))return t;let i=!1;for(const e of t)if(e.toUpperCase()===this.objectIdField.toUpperCase()){i=!0;break}return!1===i&&t.push(this.objectIdField),t}async _getFeatures(e,t,i,r){const s=[];if(-1!==t&&void 0===this._featureCache[t]&&s.push(t),!0===this._checkIfNeedToExpandKnownPage(e,this._maxProcessingRate()))return await this._expandPagedSet(e,this._maxProcessingRate(),0,0,r),this._getFeatures(e,t,i,r);let a=0;for(let r=e._lastFetchedIndex;r<e._known.length;r++){if(e._lastFetchedIndex+=1,a++,void 0===this._featureCache[e._known[r]]){let i=!1;if(null!==this._layer._mode&&void 0!==this._layer._mode){const t=this._layer._mode;if(void 0!==t._featureMap[e._known[r]]){const s=t._featureMap[e._known[r]];null!==s&&(i=!0,this._featureCache[e._known[r]]=s)}}if(!1===i&&(e._known[r]!==t&&s.push(e._known[r]),s.length>=this._maxProcessingRate()-1))break}if(a>=i&&0===s.length)break}if(0===s.length)return"success";const n=this._createQuery();n.objectIds=s,n.outFields=this._overrideFields??this._fieldsIncludingObjectId(["*"]),n.returnGeometry=!0,!0===this._removeGeometry&&(n.returnGeometry=!1),n.outSpatialReference=this.spatialReference;const l=await this.executeQuery(n,"execute");if(this._checkCancelled(r),void 0!==l.error)throw new d.dr(d.D_.RequestFailed,{reason:l.error});const o=this._layer.objectIdField;for(let e=0;e<l.features.length;e++)this._featureCache[l.features[e].attributes[o]]=l.features[e];return"success"}async _getDistinctPages(e,t,i,r,s,a,n,l,o){await this._ensureLoaded();const u=await this.databaseType();let c=i.parseTree.column;const h=this._layer.fields??[];for(let e=0;e<h.length;e++)if(h[e].name.toLowerCase()===c.toLowerCase()){c=h[e].name;break}const f=this._createQuery();f.where=(0,L.m)(f.where,null===a?null===s?"1=1":"":(0,y.YY)(a,u)),f.spatialRelationship=this._makeRelationshipEnum(r),f.relationParameter=this._makeRelationshipParam(r),f.geometry=null===s?null:s,f.returnDistinctValues=!0,f.returnGeometry=!1,f.outFields=[c];const p=await this.executeQuery(f,"execute");if(this._checkCancelled(o),!p.hasOwnProperty("features"))throw new d.dr(d.D_.InvalidStatResponse);let _=!1;for(let e=0;e<h.length;e++)if(h[e].name===c){"date"===h[e].type&&(_=!0);break}for(let e=0;e<p.features.length;e++){if(_){const t=p.features[e].attributes[c];null!==t?l.push(new Date(t)):l.push(t)}else l.push(p.features[e].attributes[c]);if(l.length>=n)break}return 0===p.features.length?l:p.features.length===this._layer.capabilities?.query.maxRecordCount&&l.length<n?{calculated:!0,result:await this._getDistinctPages(e+p.features.length,t,i,r,s,a,n,l,o)}:l}async _distinctStat(e,t,i,r,s,a,n){return{calculated:!0,result:await this._getDistinctPages(0,e,t,i,r,s,a,[],n)}}isTable(){return this._layer.isTable||null===this._layer.geometryType||"table"===this._layer.type||""===this._layer.geometryType||"esriGeometryNull"===this._layer.geometryType}async _countstat(e,t,i,r){const s=await this.databaseType();if(this.isTable()&&i&&null!==t&&""!==t)return{calculated:!0,result:0};const a=this._createQuery();return a.where=(0,L.m)(a.where,null===r?null===i?"1=1":"":(0,y.YY)(r,s)),a.spatialRelationship=this._makeRelationshipEnum(t),a.relationParameter=this._makeRelationshipParam(t),a.geometry=null===i?null:i,a.returnGeometry=!1,{calculated:!0,result:await this.executeQuery(a,"executeForCount")}}async _stats(e,t,i,r,s,a,n){await this._ensureLoaded();const l=this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsSqlExpression,o=this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsStatistics,u=this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsDistinct;if("count"===e)return u?this._countstat(e,i,r,s):{calculated:!1};if(!1===o||!1===(0,y.DA)(t)&&!1===l||!1===t.isStandardized)return""!==i||null!==s?{calculated:!1}:this._manualStat(e,t,a,n);if("distinct"===e)return!1===u?""!==i||null!==s?{calculated:!1}:this._manualStat(e,t,a,n):this._distinctStat(e,t,i,r,s,a,n);const c=await this.databaseType();if(this.isTable()&&r&&null!==i&&""!==i)return{calculated:!0,result:null};const h=this._createQuery();h.where=(0,L.m)(h.where,null===s?null===r?"1=1":"":(0,y.YY)(s,c)),h.spatialRelationship=this._makeRelationshipEnum(i),h.relationParameter=this._makeRelationshipParam(i),h.geometry=null===r?null:r;const f=new q.A;f.statisticType=(0,_.Dp)(e),f.onStatisticField=(0,y.YY)(t,c),f.outStatisticFieldName="ARCADE_STAT_RESULT",h.returnGeometry=!1;let p="ARCADE_STAT_RESULT";h.outStatistics=[f];const g=await this.executeQuery(h,"execute");if(!g.hasOwnProperty("features")||0===g.features.length)throw new d.dr(d.D_.InvalidStatResponse);let m=!1;const w=g.fields??[];for(let e=0;e<w.length;e++)if("ARCADE_STAT_RESULT"===w[e].name.toUpperCase()){p=w[e].name,"date"===w[e].type&&(m=!0);break}if(m){let e=g.features[0].attributes[p];return null!==e&&(e=new Date(g.features[0].attributes[p])),{calculated:!0,result:e}}return{calculated:!0,result:g.features[0].attributes[p]}}_stat(e,t,i,r,s,a,n){return this._stats(e,t,i,r,s,a,n)}async _canDoAggregates(e,t){await this._ensureLoaded();let i=!1;const r=this._layer.capabilities?.query,s=!0===r?.supportsSqlExpression;if(null!=r&&!0===r.supportsStatistics&&!0===r.supportsOrderBy&&(i=!0),i)for(let e=0;e<t.length-1;e++)(!1===t[e].workingexpr?.isStandardized||!1===(0,y.DA)(t[e].workingexpr)&&!1===s)&&(i=!1);return!1!==i}_makeRelationshipEnum(e){if(e.includes("esriSpatialRelRelation"))return"relation";switch(e){case"esriSpatialRelRelation":return"relation";case"esriSpatialRelIntersects":return"intersects";case"esriSpatialRelContains":return"contains";case"esriSpatialRelOverlaps":return"overlaps";case"esriSpatialRelWithin":return"within";case"esriSpatialRelTouches":return"touches";case"esriSpatialRelCrosses":return"crosses";case"esriSpatialRelEnvelopeIntersects":return"envelope-intersects"}return e}_makeRelationshipParam(e){return e.includes("esriSpatialRelRelation")?e.split(":")[1]:""}async _getAggregatePagesDataSourceDefinition(e,t,i,r,s,a,n){await this._ensureLoaded();const l=await this.databaseType();let o="",u=!1,d=!1;null!==a&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(o=a.constructClause(),d=!0),this._layer.capabilities&&this._layer.capabilities.query&&!1===this._layer.capabilities.query.supportsPagination&&(d=!1,u=!0,o=this._layer.objectIdField);const c=[];for(let e=0;e<t.length;e++){const i=new q.A;i.onStatisticField=null!==t[e].workingexpr?(0,y.YY)(t[e].workingexpr,l):"",i.outStatisticFieldName=t[e].field,i.statisticType=t[e].toStatisticsName(),c.push(i)}""===o&&(o=e.join(","));let f=this._maxQueryRate();const p=this._layer.capabilities?.query.maxRecordCount;null!=p&&p<f&&(f=p);const _=null===s?null===r?"1=1":"":(0,y.YY)(s,l);return new h.A([],["GETPAGES"],d,{groupbypage:!0,spatialRel:this._makeRelationshipEnum(i),relationParam:this._makeRelationshipParam(i),outFields:["*"],useOIDpagination:u,generatedOid:n,resultRecordCount:f,resultOffset:0,groupByFieldsForStatistics:e,outStatistics:c,geometry:null===r?null:r,where:_,orderByFields:o,returnGeometry:!1,returnIdsOnly:!1,internal:{lastMaxId:-1,set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}})}async _getAgregagtePhysicalPage(e,t,i){let r=e.pagesDefinition.where;!0===e.pagesDefinition.useOIDpagination&&(r=(0,L.m)(r,e.pagesDefinition.generatedOid+">"+e.pagesDefinition.internal.lastMaxId.toString()));const s=e.pagesDefinition.internal.lastRetrieved,a=s,n=e.pagesDefinition.internal.lastPage,o=this._createQuery();if(o.where=(0,L.m)(o.where,r),o.spatialRelationship=e.pagesDefinition.spatialRel,o.relationParameter=e.pagesDefinition.relationParam,o.outFields=e.pagesDefinition.outFields,o.outStatistics=e.pagesDefinition.outStatistics,o.geometry=e.pagesDefinition.geometry,o.groupByFieldsForStatistics=e.pagesDefinition.groupByFieldsForStatistics,o.num=e.pagesDefinition.resultRecordCount,o.start=e.pagesDefinition.internal.lastPage,o.returnGeometry=e.pagesDefinition.returnGeometry,o.orderByFields=""!==e.pagesDefinition.orderByFields?e.pagesDefinition.orderByFields.split(","):null,this.isTable()&&o.geometry&&o.spatialRelationship)return[];const u=await this.executeQuery(o,"execute");if(this._checkCancelled(i),!u.hasOwnProperty("features"))throw new d.dr(d.D_.InvalidStatResponse);const c=[];if(e.pagesDefinition.internal.lastPage!==n)return[];u.features.length>0&&void 0===u.features[0].attributes[e.pagesDefinition.generatedOid]&&(e.pagesDefinition.generatedOid=e.pagesDefinition.generatedOid.toLowerCase());for(let t=0;t<u.features.length;t++)e.pagesDefinition.internal.set[a+t]=u.features[t].attributes[e.pagesDefinition.generatedOid];for(let e=0;e<u.features.length;e++)c.push(new l.A({attributes:u.features[e].attributes,geometry:null}));return!0===e.pagesDefinition.useOIDpagination?0===u.features.length?e.pagesDefinition.internal.fullyResolved=!0:e.pagesDefinition.internal.lastMaxId=u.features[u.features.length-1].attributes[e.pagesDefinition.generatedOid]:(void 0===u.exceededTransferLimit&&u.features.length!==e.pagesDefinition.resultRecordCount||!1===u.exceededTransferLimit)&&(e.pagesDefinition.internal.fullyResolved=!0),e.pagesDefinition.internal.lastRetrieved=s+u.features.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,c}static create(e,t,i,r,s){const a=new P.default({url:e,outFields:null===t?["*"]:t});return new B({layer:a,spatialReference:i,lrucache:r,interceptor:s})}relationshipMetaData(){return this._layer&&this._layer.source&&this._layer.source.sourceJSON?.relationships?this._layer.source.sourceJSON.relationships:[]}serviceUrl(){return(0,p.Qi)(this._layer.parsedUrl.path)}async queryAttachments(e,t,i,r,s){const a=this._layer;if(function(e){const t=e.capabilities;return t?.data.supportsAttachment&&t?.operations.supportsQueryAttachments}(a)){const n={objectIds:[e],returnMetadata:s};(t&&t>0||i&&i>0)&&(n.size=[t&&t>0?t:0,i&&i>0?i:t+1]),r&&r.length>0&&(n.attachmentTypes=r),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:a,query:n,method:"attachments"});const l=await a.queryAttachments(new G.A(n)),o=[];return l&&l[e]&&l[e].forEach((t=>{const i=this._layer.parsedUrl.path+"/"+e.toString()+"/attachments/"+t.id.toString();let r=null;s&&t.exifInfo&&(r=N.A.convertJsonToArcade(t.exifInfo,"system",!0)),o.push(new k.A(t.id,t.name,t.contentType,t.size,i,r,t.keywords??null))})),o}return[]}async queryRelatedFeatures(e){const t={f:"json",relationshipId:e.relationshipId.toString(),definitionExpression:e.where,outFields:e.outFields?.join(","),returnGeometry:e.returnGeometry.toString()};void 0!==e.resultOffset&&null!==e.resultOffset&&(t.resultOffset=e.resultOffset.toString()),void 0!==e.resultRecordCount&&null!==e.resultRecordCount&&(t.resultRecordCount=e.resultRecordCount.toString()),e.orderByFields&&(t.orderByFields=e.orderByFields.join(",")),e.objectIds&&e.objectIds.length>0&&(t.objectIds=e.objectIds.join(",")),e.outSpatialReference&&(t.outSR=(0,O.YX)(e.outSpatialReference)),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preRequestCallback({layer:this._layer,queryPayload:t,method:"relatedrecords",url:this._layer.parsedUrl.path+"/queryRelatedRecords"});const i=await(0,r.A)(this._layer.parsedUrl.path+"/queryRelatedRecords",{responseType:"json",query:t});if(i.data){const e={},t=i.data;if(t?.relatedRecordGroups){const i=t.spatialReference;for(const r of t.relatedRecordGroups){const s=r.objectId,a=[];for(const e of r.relatedRecords){e.geometry&&(e.geometry.spatialReference=i);const t=new l.A({geometry:e.geometry?(0,E.rS)(e.geometry):null,attributes:e.attributes});a.push(t)}e[s]={features:a,exceededTransferLimit:!0===t.exceededTransferLimit}}}return e}throw new d.dr(d.D_.InvalidRequest)}async getFeatureByObjectId(e,t){const i=this._createQuery();i.outFields=t,i.returnGeometry=!1,i.outSpatialReference=this.spatialReference,i.where=(0,L.m)(i.where,this.objectIdField+"="+e.toString()),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:i,method:"execute"});const r=await this._layer.queryFeatures(i);return 1===r.features.length?r.features[0]:null}async getIdentityUser(){await this.load();const e=x.id?.findCredential(this._layer.url);return e?e.userId:null}async getOwningSystemUrl(){await this.load();const e=x.id?.findServerInfo(this._layer.url);if(e)return e.owningSystemUrl;let t=this._layer.url;const i=t.toLowerCase().indexOf("/rest/services");if(t=i>-1?t.slice(0,i):t,t){t+="/rest/info";try{const e=await(0,r.A)(t,{query:{f:"json"}});let i="";return e.data?.owningSystemUrl&&(i=e.data.owningSystemUrl),i}catch(e){return""}}return""}getDataSourceFeatureSet(){const e=new B({layer:this._layer,spatialReference:this.spatialReference??void 0,outFields:this._overrideFields??void 0,includeGeometry:!this._removeGeometry,lrucache:this.recentlyUsedQueries??void 0,interceptor:this.featureSetQueryInterceptor??void 0});return e._useDefinitionExpression=!1,e}get preferredTimeZone(){return this._layer.preferredTimeZone??null}get dateFieldsTimeZone(){return this._layer.dateFieldsTimeZone??null}get datesInUnknownTimezone(){return this._layer.datesInUnknownTimezone??!1}get editFieldsInfo(){return this._layer.editFieldsInfo??null}get timeInfo(){return this._layer.timeInfo??null}async getFeatureSetInfo(){if(this.fsetInfo)return this.fsetInfo;let e=null,t="serviceItemId"in this._layer?this._layer.serviceItemId:null;const i=this._layer.parsedUrl.path;if(i){const s=await(0,r.A)(i,{responseType:"json",query:{f:"json"}});e=s?.data?.name??null,t=s?.data?.serviceItemId??null}const s=this._layer.title&&null!==(this._layer.parent??null);return this.featureSetInfo={layerId:this._layer.layerId,layerName:""===e?null:e,itemId:""===t?null:t,serviceLayerUrl:""===i?null:i,webMapLayerId:s?this._layer.id??null:null,webMapLayerTitle:s?this._layer.title??null:null,className:null,objectClassId:null},this.fsetInfo}}var M=i(30235),U=i(26591);class W extends c.A{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.sources.FeatureLayerRelated",this._findObjectId=-1,this._requestStandardised=!1,this._removeGeometry=!1,this._overrideFields=null,this.featureObjectId=null,e.spatialReference&&(this.spatialReference=e.spatialReference),this._transparent=!0,this._maxProcessing=1e3,this._layer=e.layer,this._wset=null,this._findObjectId=e.objectId,this.featureObjectId=e.objectId,this.relationship=e.relationship,this._relatedLayer=e.relatedLayer,void 0!==e.outFields&&(this._overrideFields=e.outFields),void 0!==e.includeGeometry&&(this._removeGeometry=!1===e.includeGeometry)}_maxQueryRate(){return p.gO}end(){return this._layer}optimisePagingFeatureQueries(){}async loadImpl(){return await Promise.all([this._layer.load(),this._relatedLayer?.load()]),this._initialiseFeatureSet(),this}nativeCapabilities(){return this._relatedLayer.nativeCapabilities()}_initialiseFeatureSet(){if(null==this.spatialReference&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this._relatedLayer.geometryType,this.fields=this._relatedLayer.fields.slice(),this.hasZ=this._relatedLayer.hasZ,this.hasM=this._relatedLayer.hasM,null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{const e=[],t=[];for(const i of this.fields)if("oid"===i.type)e.push(i),t.push(i.name);else for(const r of this._overrideFields)if(r.toLowerCase()===i.name.toLowerCase()){e.push(i),t.push(i.name);break}this.fields=e,this._overrideFields=t}const e=this._layer.nativeCapabilities();e&&(this._databaseType=e.databaseType,this._requestStandardised=e.requestStandardised),this.objectIdField=this._relatedLayer.objectIdField,this.globalIdField=this._relatedLayer.globalIdField,this.hasM=this._relatedLayer.supportsM,this.hasZ=this._relatedLayer.supportsZ,this.typeIdField=this._relatedLayer.typeIdField,this.types=this._relatedLayer.types,this.subtypeField=this._relatedLayer.subtypeField,this.subtypes=this._relatedLayer.subtypes}async databaseType(){return await this._relatedLayer.databaseType(),this._databaseType=this._relatedLayer._databaseType,this._databaseType}isTable(){return this._relatedLayer.isTable()}_isInFeatureSet(){return p.J6.InFeatureSet}_candidateIdTransform(e){return e}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}_changeFeature(e){const t={};for(const i of this.fields)t[i.name]=e.attributes[i.name];return new l.A({geometry:!0===this._removeGeometry?null:e.geometry,attributes:t})}async _getFilteredSet(e,t,i,r,s){if(await this.databaseType(),this.isTable()&&t&&null!==e&&""!==e)return new h.A([],[],!0,null);const a=this._layer.nativeCapabilities();if(!1===a.canQueryRelated)return new h.A([],[],!0,null);if(a.capabilities?.queryRelated.supportsPagination)return this._getFilteredSetUsingPaging(e,t,i,r,s);let n="",l=!1;null!==r&&!0===a.capabilities?.queryRelated.supportsOrderBy&&(n=r.constructClause(),l=!0);const o=new U.default;o.objectIds=[this._findObjectId];const u=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this._relatedLayer.fields?this._relatedLayer.fields.map((e=>e.name)):["*"]);o.outFields=u,o.relationshipId=this.relationship.id,o.where="1=1";let d=!0;!0===this._removeGeometry&&(d=!1),o.returnGeometry=d,this._requestStandardised&&(o.sqlFormat="standard"),o.outSpatialReference=this.spatialReference,o.orderByFields=""!==n?n.split(","):null;const c=await a.source.queryRelatedFeatures(o);this._checkCancelled(s);const f=c[this._findObjectId]?c[this._findObjectId].features:[],p=[];for(let e=0;e<f.length;e++)this._featureCache[f[e].attributes[this._relatedLayer.objectIdField]]=f[e],p.push(f[e].attributes[this._relatedLayer.objectIdField]);const y=t&&null!==e&&""!==e,_=null!=i;return new h.A(y||_?p:[],y||_?[]:p,l,null)}_fieldsIncludingObjectId(e){if(null===e)return[this.objectIdField];const t=e.slice();if(t.includes("*"))return t;let i=!1;for(const e of t)if(e.toUpperCase()===this.objectIdField.toUpperCase()){i=!0;break}return!1===i&&t.push(this.objectIdField),t}async _getFilteredSetUsingPaging(e,t,i,r,s){let a="",n=!1;const l=this._layer.nativeCapabilities();null!==r&&!0===l.capabilities?.queryRelated.supportsOrderBy&&(a=r.constructClause(),n=!0),await this.databaseType();let o=this._maxQueryRate();const u=l.capabilities?.query.maxRecordCount;null!=u&&u<o&&(o=u);const d=t&&null!==e&&""!==e,c=null!=i;let f=null,p=!0;!0===this._removeGeometry&&(p=!1);const y=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this._relatedLayer.fields?this._relatedLayer.fields.map((e=>e.name)):["*"]);return f=new h.A(d||c?["GETPAGES"]:[],d||c?[]:["GETPAGES"],n,{outFields:y.join(","),resultRecordCount:o,resultOffset:0,objectIds:[this._findObjectId],where:"1=1",orderByFields:a,returnGeometry:p,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}}),await this._expandPagedSet(f,o,0,0,s),f}_expandPagedSet(e,t,i,r,s){return this._expandPagedSetFeatureSet(e,t,i,r,s)}_clonePageDefinition(e){return null===e?null:!0!==e.groupbypage?{groupbypage:!1,outFields:e.outFields,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,where:e.where,objectIds:e.objectIds,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}:{groupbypage:!0,outFields:e.outFields,resultRecordCount:e.resultRecordCount,useOIDpagination:e.useOIDpagination,generatedOid:e.generatedOid,groupByFieldsForStatistics:e.groupByFieldsForStatistics,resultOffset:e.resultOffset,outStatistics:e.outStatistics,geometry:e.geometry,where:e.where,objectIds:e.objectIds,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}}async _getPhysicalPage(e,t,i){const r=e.pagesDefinition.internal.lastRetrieved,s=r,a=e.pagesDefinition.internal.lastPage,n=this._layer.nativeCapabilities(),l=new U.default;!0===this._requestStandardised&&(l.sqlFormat="standard"),l.relationshipId=this.relationship.id,l.objectIds=e.pagesDefinition.objectIds,l.resultOffset=e.pagesDefinition.internal.lastPage,l.resultRecordCount=e.pagesDefinition.resultRecordCount,l.outFields=e.pagesDefinition.outFields.split(","),l.where=e.pagesDefinition.where,l.orderByFields=""!==e.pagesDefinition.orderByFields?e.pagesDefinition.orderByFields.split(","):null,l.returnGeometry=e.pagesDefinition.returnGeometry,l.outSpatialReference=this.spatialReference;const o=await n.source.queryRelatedFeatures(l);if(this._checkCancelled(i),e.pagesDefinition.internal.lastPage!==a)return 0;const u=o[this._findObjectId]?o[this._findObjectId].features:[];for(let t=0;t<u.length;t++)e.pagesDefinition.internal.set[s+t]=u[t].attributes[this._relatedLayer.objectIdField];for(let e=0;e<u.length;e++)this._featureCache[u[e].attributes[this._relatedLayer.objectIdField]]=u[e];const d=!o[this._findObjectId]||!1===o[this._findObjectId].exceededTransferLimit;return u.length!==e.pagesDefinition.resultRecordCount&&d&&(e.pagesDefinition.internal.fullyResolved=!0),e.pagesDefinition.internal.lastRetrieved=r+u.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,u.length}async _getFeatures(e,t,i,r){const s=[];-1!==t&&void 0===this._featureCache[t]&&s.push(t);const a=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,a))return await this._expandPagedSet(e,a,0,0,r),this._getFeatures(e,t,i,r);let n=0;for(let r=e._lastFetchedIndex;r<e._known.length&&(n++,n<=i&&(e._lastFetchedIndex+=1),!("GETPAGES"!==e._known[r]&&void 0===this._featureCache[e._known[r]]&&(e._known[r]!==t&&s.push(e._known[r]),s.length>i)))&&!(n>=i&&0===s.length);r++);if(0===s.length)return"success";throw new d.dr(d.D_.MissingFeatures)}async _refineSetBlock(e,t,i){return e}async _stat(e,t,i,r,s,a,n){return{calculated:!1}}get gdbVersion(){return this._relatedLayer.gdbVersion}async _canDoAggregates(e,t,i,r,s){return!1}relationshipMetaData(){return this._relatedLayer.relationshipMetaData()}serviceUrl(){return this._relatedLayer.serviceUrl()}queryAttachments(e,t,i,r,s){return this._relatedLayer.queryAttachments(e,t,i,r,s)}getFeatureByObjectId(e,t){return this._relatedLayer.getFeatureByObjectId(e,t)}getOwningSystemUrl(){return this._relatedLayer.getOwningSystemUrl()}getIdentityUser(){return this._relatedLayer.getIdentityUser()}getDataSourceFeatureSet(){return this._relatedLayer}get preferredTimeZone(){return this._relatedLayer?.preferredTimeZone??null}get dateFieldsTimeZone(){return this._relatedLayer?.dateFieldsTimeZone??null}get datesInUnknownTimezone(){return this._relatedLayer?.datesInUnknownTimezone}get editFieldsInfo(){return this._relatedLayer?.editFieldsInfo??null}get timeInfo(){return this._relatedLayer?.timeInfo??null}async getFeatureSetInfo(){return this.fsetInfo??this._layer.featureSetInfo}}var Q=i(23732),Z=i(92474),J=i(4146),V=i(80812);function z(){null===Q.A.applicationCache&&(Q.A.applicationCache=new Q.A)}async function Y(e,t,i){if(Q.A.applicationCache){const i=Q.A.applicationCache.getLayerInfo(e);if(i){const r=await i;return new P.default({url:e,outFields:t,sourceJSON:r})}const r=new P.default({url:e,outFields:t}),s=(async()=>(await r.load(),r.sourceJSON))();if(Q.A.applicationCache){Q.A.applicationCache.setLayerInfo(e,s);try{return await s,r}catch(t){throw Q.A.applicationCache.clearLayerInfo(e),t}}return await s,r}if(null!=i){const r=i.getCachedLayerMetadata(e);if(r){const i=await r;return new P.default({url:e,outFields:t,sourceJSON:i})}const s=new P.default({url:e,outFields:t}),a=(async()=>(await s.load(),s.sourceJSON))();i.setCachedLayerMetadata(e,a);try{return await a,s}catch(t){throw i.removeCachedLayerMetadata(e,a),t}}return new P.default({url:e,outFields:t})}async function K(e,t,i,r,s,a=null){return $(await Y(e,["*"],s),t,i,r,s,a)}function $(e,t=null,i=null,r=!0,s=null,a=null){switch(e.type){case"catalog-footprint":return $(e.parent,t,i,r,s,a);case"subtype-sublayer":{const n=$(e.parent,t,i,r,s,a);return n.filter(g.WhereClause.create(e.parent.subtypeField+"="+e.subtypeCode.toString(),{fieldsIndex:e.parent.fieldsIndex,timeZone:n.dateFieldsTimeZoneDefaultUTC}))}case"csv":case"geojson":case"wfs":return new M.A({layer:e,spatialReference:t,outFields:i,includeGeometry:r,lrucache:s,interceptor:a});case"catalog":case"feature":case"oriented-imagery":case"subtype-group":{const n={layer:e,spatialReference:t,outFields:i,includeGeometry:r,lrucache:s,interceptor:a};return!e.url&&e.source?new M.A(n):new B(n)}default:throw new Error(`Unsupported layer type: ${e.type}`)}}async function H(e,t){if(null!==Q.A.applicationCache){const t=Q.A.applicationCache.getLayerInfo(e);if(null!==t)return t}if(null!=t){const i=t.getCachedServiceMetadata(e);if(null!=i)return i}const i=(async()=>{const t=await(0,r.A)(e,{responseType:"json",query:{f:"json"}});if(t.data){const e=t.data;return e.layers||(e.layers=[]),e.tables||(e.tables=[]),e}return{layers:[],tables:[]}})();if(null!==Q.A.applicationCache){Q.A.applicationCache.setLayerInfo(e,i);try{return await i}catch(t){throw Q.A.applicationCache.clearLayerInfo(e),t}}if(null!=t){t.setCachedServiceMetadata(e,i);try{return await i}catch(r){throw t.removeCachedServiceMetadata(e,i),r}}return i}async function X(e,t){const i={metadata:null,networkId:-1,unVersion:3,terminals:[],queryelem:null,layerNameLkp:{},lkp:null},s=await H(e,null);if(i.metadata=s,void 0!==s.controllerDatasetLayers?.utilityNetworkLayerId&&null!==s.controllerDatasetLayers.utilityNetworkLayerId){if(s.layers)for(const e of s.layers)i.layerNameLkp[e.id]=e.name;if(s.tables)for(const e of s.tables)i.layerNameLkp[e.id]=e.name;const a=s.controllerDatasetLayers.utilityNetworkLayerId;i.networkId=a;const n=await async function(e,t){const i="QUERYDATAELEMTS:"+t.toString()+":"+e;if(null!==Q.A.applicationCache){const e=Q.A.applicationCache.getLayerInfo(i);if(null!==e)return e}const s=(async()=>{const i=await(0,r.A)(e+"/queryDataElements",{method:"post",responseType:"json",query:{layers:JSON.stringify([t.toString()]),f:"json"}});if(i.data){const e=i.data;if(e.layerDataElements?.[0])return e.layerDataElements[0]}throw new d.dr(d.D_.DataElementsNotFound)})();if(null!==Q.A.applicationCache){Q.A.applicationCache.setLayerInfo(i,s);try{return await s}catch(e){throw Q.A.applicationCache.clearLayerInfo(i),e}}return s}(e,a);if(n){i.queryelem=n,i.queryelem?.dataElement&&void 0!==i.queryelem.dataElement.schemaGeneration&&(i.unVersion=i.queryelem.dataElement.schemaGeneration),i.lkp={},i.queryelem.dataElement.domainNetworks||(i.queryelem.dataElement.domainNetworks=[]);for(const e of i.queryelem.dataElement.domainNetworks){for(const t of e.edgeSources??[]){const e={layerId:t.layerId,sourceId:t.sourceId,className:i.layerNameLkp[t.layerId]??null};e.className&&(i.lkp[e.className]=e)}for(const t of e.junctionSources??[]){const e={layerId:t.layerId,sourceId:t.sourceId,className:i.layerNameLkp[t.layerId]??null};e.className&&(i.lkp[e.className]=e)}}if(i.queryelem.dataElement.terminalConfigurations)for(const e of i.queryelem.dataElement.terminalConfigurations)for(const t of e.terminals)i.terminals.push({terminalId:t.terminalId,terminalName:t.terminalName});const s=await async function(e){if(null!==Q.A.applicationCache){const t=Q.A.applicationCache.getLayerInfo(e);if(null!==t)return t}const t=(async()=>{const t=await(0,r.A)(e,{responseType:"json",query:{f:"json"}});return t.data?t.data:null})();if(null!==Q.A.applicationCache){Q.A.applicationCache.setLayerInfo(e,t);try{return await t}catch(t){throw Q.A.applicationCache.clearLayerInfo(e),t}}return t}(e+"/"+a);if(void 0!==s.systemLayers?.associationsTableId&&null!==s.systemLayers.associationsTableId){const r=[];i.unVersion>=4&&(r.push("STATUS"),r.push("PERCENTALONG"));let a=await K(e+"/"+s.systemLayers.associationsTableId.toString(),t,["OBJECTID","FROMNETWORKSOURCEID","TONETWORKSOURCEID","FROMGLOBALID","TOGLOBALID","TOTERMINALID","FROMTERMINALID","ASSOCIATIONTYPE","ISCONTENTVISIBLE","GLOBALID",...r],!1,null,null);return await a.load(),i.unVersion>=4&&(a=a.filter(g.WhereClause.create("STATUS NOT IN (1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62, 63)",{fieldsIndex:a.getFieldsIndex(),timeZone:a.dateFieldsTimeZoneDefaultUTC})),await a.load()),{lkp:i.lkp,associations:a,unVersion:i.unVersion,terminals:i.terminals}}return{associations:null,unVersion:i.unVersion,lkp:null,terminals:[]}}return{associations:null,unVersion:i.unVersion,lkp:null,terminals:[]}}return{associations:null,unVersion:i.unVersion,lkp:null,terminals:[]}}async function ee(e,t,i,r=null,s=null,a=!0,n=null,l=null){let o=e.serviceUrl();if(!o)return null;o="/"===o.charAt(o.length-1)?o+t.relatedTableId.toString():o+"/"+t.relatedTableId.toString();const u=await K(o,r,s,a,n,l);return new W({layer:e,relatedLayer:u,relationship:t,objectId:i,spatialReference:r,outFields:s,includeGeometry:a,lrucache:n,interceptor:l})}n.A.registerAction(),T.registerAction(),u.A.registerAction(),D.A.registerAction(),R.A.registerAction();class te extends s{constructor(e,t=null,i=null,r=null){super(),this._map=e,this._overrideSpatialReference=t,this._lrucache=i,this._interceptor=r,this._instantLayers=[]}_makeAndAddFeatureSet(e,t=!0,i=null){const r=$(e,this._overrideSpatialReference,null===i?["*"]:i,t,this._lrucache,this._interceptor);return this._instantLayers.push({featureset:r,opitem:e,includeGeometry:t,outFields:JSON.stringify(i)}),r}async featureSetByName(e,t=!0,i=null){if(Z.A.isLoadable(this._map)&&!this._map.loaded)return await this._map.load(),this.featureSetByName(e,t,i);null===i&&(i=["*"]),i=(i=i.slice()).sort();const r=JSON.stringify(i);for(let i=0;i<this._instantLayers.length;i++){const s=this._instantLayers[i];if(s.opitem.title===e&&s.includeGeometry===t&&s.outFields===r)return this._instantLayers[i].featureset}const s=this._map.allLayers.find((t=>(0,p.eB)(t)&&t.title===e));if(null!=s)return this._makeAndAddFeatureSet(s,t,i);if(this._map.tables){const r=this._map.tables.find((t=>t.title===e));if(null!=r){if(r instanceof P.default)return this._makeAndAddFeatureSet(r,t,i);if(null==r._materializedTable){const e=r.outFields?r:{...r,outFields:["*"]};r._materializedTable=new P.default(e)}return await r._materializedTable.load(),this._makeAndAddFeatureSet(r._materializedTable,t,i)}}return null}async featureSetById(e,t=!0,i=["*"]){if(Z.A.isLoadable(this._map)&&!this._map.loaded)return await this._map.load(),this.featureSetById(e,t,i);null===i&&(i=["*"]),i=(i=i.slice()).sort();const r=JSON.stringify(i);for(let i=0;i<this._instantLayers.length;i++){const s=this._instantLayers[i];if(s.opitem.id===e&&s.includeGeometry===t&&s.outFields===r)return this._instantLayers[i].featureset}const s=this._map.allLayers.find((t=>(0,p.eB)(t)&&t.id===e));if(s)return this._makeAndAddFeatureSet(s,t,i);if(this._map.tables){const r=this._map.tables.find((t=>t.id===e));if(null!=r){if(r instanceof P.default)return this._makeAndAddFeatureSet(r,t,i);if(null==r._materializedTable){const e={...r,outFields:["*"]};r._materializedTable=new P.default(e)}return await r._materializedTable.load(),this._makeAndAddFeatureSet(r._materializedTable,t,i)}}return null}}class ie extends s{constructor(e,t=null,i=null,r=null){super(),this._url=e,this._overrideSpatialReference=t,this._lrucache=i,this._interceptor=r,this.metadata=null,this._instantLayers=[]}get url(){return this._url}_makeAndAddFeatureSet(e,t=!0,i=null){const r=$(e,this._overrideSpatialReference,null===i?["*"]:i,t,this._lrucache);return this._instantLayers.push({featureset:r,opitem:e,includeGeometry:t,outFields:JSON.stringify(i)}),r}async _loadMetaData(){const e=await H(this._url,this._lrucache);return this.metadata=e,e}load(){return this._loadMetaData()}clone(){return new ie(this._url,this._overrideSpatialReference,this._lrucache,this._interceptor)}async featureSetByName(e,t=!0,i=null){null===i&&(i=["*"]),i=(i=i.slice()).sort();const r=JSON.stringify(i);for(let i=0;i<this._instantLayers.length;i++){const s=this._instantLayers[i];if(s.opitem.title===e&&s.includeGeometry===t&&s.outFields===r)return this._instantLayers[i].featureset}const s=await this._loadMetaData();let a=null;for(const t of s.layers??[])t.name===e&&(a=t);if(!a)for(const t of s.tables??[])t.name===e&&(a=t);if(a){const e=await Y(this._url+"/"+a.id,["*"],this._lrucache);return this._makeAndAddFeatureSet(e,t,i)}return null}async featureSetById(e,t=!0,i=["*"]){null===i&&(i=["*"]),i=(i=i.slice()).sort();const r=JSON.stringify(i);e=null!=e?e.toString():"";for(let i=0;i<this._instantLayers.length;i++){const s=this._instantLayers[i];if(s.opitem.id===e&&s.includeGeometry===t&&s.outFields===r)return this._instantLayers[i].featureset}const s=await this._loadMetaData();let a=null;for(const t of s.layers??[])null!==t.id&&void 0!==t.id&&t.id.toString()===e&&(a=t);if(!a)for(const t of s.tables??[])null!==t.id&&void 0!==t.id&&t.id.toString()===e&&(a=t);if(a){const e=await Y(this._url+"/"+a.id,["*"],this._lrucache);return this._makeAndAddFeatureSet(e,t,i)}return null}}function re(e,t,i=null,r=null){return new te(e,t,i,r)}function se(e,t,i=null,r=null){return new ie(e,t,i,r)}function ae(e,t,i,r,s){if(null===e)return null;if((0,a.u)(e)){switch(t){case"datasource":return e.getDataSourceFeatureSet();case"parent":return e;case"root":return e.getRootFeatureSet()}return null}if(e instanceof J.A&&(0,p.NI)(e)){const a=e;switch(t){case"datasource":return $(a,s,a.outFields,!0,i,r).getDataSourceFeatureSet();case"parent":case"root":return $(a,s,a.outFields,!0,i,r)}return null}if((0,a.a0)(e)){switch(t){case"datasource":return $(e.parent,s,e.parent.outFields,!0,i,r).getDataSourceFeatureSet();case"parent":case"root":return $(e,s,e.parent.outFields,!0,i,r)}return null}return null}async function ne(e,t,i,r,s,a,n,l=null){if(Q.A.applicationCache){const o=Q.A.applicationCache.getLayerInfo(e+":"+a.url);if(o)return le(await o,t,i,r,s,n,l)}if(null!=n){const o=n.getCachedPortalItem(a.url,e);if(null!=o)return await le(await o,t,i,r,s,n,l)}const o=new V.default({id:e,portal:a}).load();Q.A.applicationCache?Q.A.applicationCache.setLayerInfo(e+":"+a.url,o):null!=n&&n.setCachedPortalItem(a.url,e,o);try{return await le(await o,t,i,r,s,n,l)}catch(t){throw Q.A.applicationCache&&Q.A.applicationCache.clearLayerInfo(e+":"+a.url),null!=n&&n.removeCachedPortalItem(a.url,e,o),t}}async function le(e,t,i,r,s,a,n){let l;if("Feature Service"===e.type)l=await Y((0,p.Qi)(e.url??"")+"/"+t,["*"],a);else{if(t)throw new Error(`layerId=${t} provided for ${e.type} item`);if(null!=a){const t=a.getCachedPortalItemLayer(e.portal.url,e.id);if(null!=t)l=await t;else{const t=J.A.fromPortalItem(e);a.setCachedPortalItemLayer(e.portal.url,e.id,t);try{l=await t}catch(i){throw a.removeCachedPortalItemLayer(e.portal.url,e.id,t),i}}}else l=await J.A.fromPortalItem(e)}return $(l,i,r,s,a,n)}},68423:(e,t,i)=>{i.d(t,{Gr:()=>g,IO:()=>p,a:()=>m,bV:()=>_,p8:()=>y});var r=i(52106),s=i(78502),a=i(87449),n=i(11221),l=i(89169),o=i(33325),u=i(80609),d=i(97768),c=i(50835),h=i(16930);class f{constructor(e){this.field=e,this.sqlRewritable=!1}postInitialization(e,t){}}class p extends f{constructor(e){super(e),this.sqlRewritable=!0}extractValue(e){return e.attributes[this.field.name]}rewriteSql(e){return{rewritten:this.sqlRewritable,where:e}}}class y extends f{constructor(e,t,i){super((0,o.ke)(e)),this.originalField=e,this.sqlRewritable=!0,this.field.name=t,this.field.alias=i}rewriteSql(e,t){return{rewritten:this.sqlRewritable,where:(0,u.bD)(e,this.field.name,this.originalField.name,t.getFieldsIndex())}}extractValue(e){return e.attributes[this.originalField.name]}}class _ extends f{constructor(e,t,i){super(e),this.codefield=t,this.lkp=i,this.reverseLkp={};for(const e in i)this.reverseLkp[i[e]]=e;this.sqlRewritable=!0}rewriteSql(e,t){const i=this.evaluateNodeToWhereClause(e.parseTree,o.zl.Standardised,this.field.name,this.codefield instanceof c.WhereClause?(0,u.YY)(this.codefield,o.zl.Standardised):this.codefield,e.parameters);return i.includes(_.BADNESS)?{rewritten:!1,where:e}:{rewritten:this.sqlRewritable,where:c.WhereClause.create(i,{fieldsIndex:t._parent.getFieldsIndex(),timeZone:t.dateFieldsTimeZoneDefaultUTC})}}evaluateNodeToWhereClause(e,t,i=null,r=null,s){let n,l,d,c;switch(e.type){case"interval":return(0,u.oj)(this.evaluateNodeToWhereClause(e.value,t,i,r,s),e.qualifier,e.op);case"case-expression":{let r=" CASE ";"simple"===e.format&&(r+=this.evaluateNodeToWhereClause(e.operand,t,i,_.BADNESS,s));for(let a=0;a<e.clauses.length;a++)r+=" WHEN "+this.evaluateNodeToWhereClause(e.clauses[a].operand,t,i,_.BADNESS,s)+" THEN "+this.evaluateNodeToWhereClause(e.clauses[a].value,t,i,_.BADNESS,s);return null!==e.else&&(r+=" ELSE "+this.evaluateNodeToWhereClause(e.else,t,i,_.BADNESS,s)),r+=" END ",r}case"parameter":{const i=s[e.value.toLowerCase()];if("string"==typeof i)return"'"+i.toString().replaceAll("'","''")+"'";if((0,o.$P)(i))return(0,u.bm)(i,t);if((0,o.Lk)(i))return(0,u.bm)(i,t);if((0,o.eg)(i))return(0,u.F1)(i,t);if((0,o.rX)(i))return(0,u.R8)(i,t);if((0,o.f0)(i))return(0,u.Nf)(i,t);if(Array.isArray(i)){const e=[];for(let r=0;r<i.length;r++)"string"==typeof i[r]?e.push("'"+i[r].toString().replaceAll("'","''")+"'"):(0,o.$P)(i[r])||(0,o.Lk)(i[r])?e.push((0,u.bm)(i[r],t)):(0,o.eg)(i[r])?e.push((0,u.F1)(i[r],t)):(0,o.rX)(i[r])?e.push((0,u.R8)(i[r],t)):(0,o.f0)(i[r])?e.push((0,u.Nf)(i[r],t)):e.push(i[r].toString());return e}return i.toString()}case"expression-list":l=[];for(const a of e.value)l.push(this.evaluateNodeToWhereClause(a,t,i,r,s));return l;case"unary-expression":return" ( NOT "+this.evaluateNodeToWhereClause(e.expr,t,i,_.BADNESS,s)+" ) ";case"binary-expression":switch(e.operator){case"AND":return" ("+this.evaluateNodeToWhereClause(e.left,t,i,r,s)+" AND "+this.evaluateNodeToWhereClause(e.right,t,i,r,s)+") ";case"OR":return" ("+this.evaluateNodeToWhereClause(e.left,t,i,r,s)+" OR "+this.evaluateNodeToWhereClause(e.right,t,i,r,s)+") ";case"IS":if("null"!==e.right.type)throw new a.L8(a.Z7.UnsupportedIsRhs);return" ("+this.evaluateNodeToWhereClause(e.left,t,i,r,s)+" IS NULL )";case"ISNOT":if("null"!==e.right.type)throw new a.L8(a.Z7.UnsupportedIsRhs);return" ("+this.evaluateNodeToWhereClause(e.left,t,i,r,s)+" IS NOT NULL )";case"IN":if(n=[],"expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const a=[];let n=!0;for(const t of e.right.value){if("string"!==t.type){n=!1;break}if(void 0===this.lkp[t.value]){n=!1;break}a.push(this.lkp[t.value].toString())}if(n)return" ("+this.evaluateNodeToWhereClause(e.left,t,i,r,s)+" IN ("+a.join(",")+")) "}return n=this.evaluateNodeToWhereClause(e.right,t,i,r,s)," ("+this.evaluateNodeToWhereClause(e.left,t,i,r,s)+" IN ("+n.join(",")+")) "}return c=this.evaluateNodeToWhereClause(e.right,t,i,r,s),Array.isArray(c)?" ("+this.evaluateNodeToWhereClause(e.left,t,i,r,s)+" IN ("+c.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,t,i,r,s)+" IN ("+c+")) ";case"NOT IN":if(n=[],"expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const a=[];let n=!0;for(const t of e.right.value){if("string"!==t.type){n=!1;break}if(void 0===this.lkp[t.value]){n=!1;break}a.push(this.lkp[t.value].toString())}if(n)return" ("+this.evaluateNodeToWhereClause(e.left,t,i,r,s)+" NOT IN ("+a.join(",")+")) "}return n=this.evaluateNodeToWhereClause(e.right,t,i,r,s)," ("+this.evaluateNodeToWhereClause(e.left,t,i,r,s)+" NOT IN ("+n.join(",")+")) "}return c=this.evaluateNodeToWhereClause(e.right,t,i,r,s),Array.isArray(c)?" ("+this.evaluateNodeToWhereClause(e.left,t,i,r,s)+" NOT IN ("+c.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,t,i,r,s)+" NOT IN ("+c+")) ";case"BETWEEN":return d=this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,s)," ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,s)+" BETWEEN "+d[0]+" AND "+d[1]+" ) ";case"NOTBETWEEN":return d=this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,s)," ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,s)+" NOT BETWEEN "+d[0]+" AND "+d[1]+" ) ";case"LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,s)+" LIKE "+this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,s)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,s)+" LIKE "+this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,s)+") ";case"NOT LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,s)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,s)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,s)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,s)+") ";case"<>":case"=":if("column-reference"===e.left.type&&"string"===e.right.type){if(e.left.column.toUpperCase()===this.field.name.toUpperCase()&&void 0!==this.lkp[e.right.value.toString()])return" ("+r+" "+e.operator+" "+this.lkp[e.right.value.toString()].toString()+") "}else if("column-reference"===e.right.type&&"string"===e.left.type&&e.right.column.toUpperCase()===this.field.name.toUpperCase())return" ("+this.lkp[e.right.value.toString()].toString()+" "+e.operator+" "+r+") ";return" ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,s)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,s)+") ";case"<":case">":case">=":case"<=":case"*":case"-":case"+":case"/":case"||":return" ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,s)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,s)+") "}case"null":return"null";case"boolean":return!0===e.value?"1":"0";case"string":return"'"+e.value.toString().replaceAll("'","''")+"'";case"timestamp":return`timestamp '${e.value}'`;case"date":return`date '${e.value}'`;case"time":return`time '${e.value}'`;case"number":return e.value.toString();case"current-time":return(0,u.C6)("date"===e.mode,t);case"current-user":return"CURRENT_USER";case"column-reference":return i&&i.toLowerCase()===e.column.toLowerCase()?"("+r+")":e.column;case"data-type":return e.value;case"function":{const r=this.evaluateNodeToWhereClause(e.args,t,i,_.BADNESS,s);return(0,u.F6)(e.name,r,t)}}throw new a.L8(a.Z7.UnsupportedSyntax,{node:e.type})}extractValue(e){return this.codefield instanceof c.WhereClause?this.reverseLkp[c.WhereClause.convertValueToStorageFormat(this.codefield.calculateValueCompiled(e))]:this.reverseLkp[e.attributes[this.codefield]]}}_.BADNESS="_!!!_BAD_LKP_!!!!";class g extends f{constructor(e,t){super(e),this._sql=t}rewriteSql(e,t){return{rewritten:!0,where:(0,u.bD)(e,this.field.name,(0,u.YY)(this._sql,o.zl.Standardised),t.getFieldsIndex())}}extractValue(e){return c.WhereClause.convertValueToStorageFormat(this._sql.calculateValueCompiled(e),this.field.type)}}class m extends n.A{static findField(e,t){for(const i of e)if(i.name.toLowerCase()===t.toString().toLowerCase())return i;return null}constructor(e){super(e),this._calcFunc=null,this.declaredClass="esri.arcade.featureset.actions.Adapted",this.adaptedFields=[],this._extraFilter=null,this._extraFilter=e.extraFilter,this._parent=e.parentfeatureset,this._maxProcessing=30,this.adaptedFields=e.adaptedFields}_initialiseFeatureSet(){null!==this._parent?(this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.globalIdField=this._parent.globalIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types):(this.spatialReference=new h.A({wkid:4326}),this.objectIdField="",this.globalIdField="",this.geometryType=o.ik.point,this.typeIdField="",this.types=null,this.subtypeField=null,this.subtypes=null),this.fields=[];for(const e of this.adaptedFields)e.postInitialization(this,this._parent),this.fields.push(e.field)}async _getSet(e){if(null===this._wset){await this._ensureLoaded();let t=null;return t=this._extraFilter?await this._getFilteredSet("",null,null,null,e):await(this._parent?._getSet(e)),this._checkCancelled(e),(0,d.Lw)(t),this._wset=new l.A(t._candidates.slice(),t._known.slice(),t._ordered,this._clonePageDefinition(t.pagesDefinition)),this._wset}return this._wset}_isInFeatureSet(e){return this._parent._isInFeatureSet(e)}async _getFeatures(e,t,i,a){const n=[];-1!==t&&void 0===this._featureCache[t]&&n.push(t);const o=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,o))return await this._expandPagedSet(e,o,0,0,a),this._getFeatures(e,t,i,a);let u=0;for(let r=e._lastFetchedIndex;r<e._known.length&&(u++,u<=i&&(e._lastFetchedIndex+=1),!(void 0===this._featureCache[e._known[r]]&&(e._known[r]!==t&&n.push(e._known[r]),n.length>=o)));r++);if(0===n.length)return"success";e=new l.A([],n,e._ordered,null);const d=Math.min(n.length,i);await(this._parent?._getFeatures(e,-1,d,a)),this._checkCancelled(a);const c=[];for(let e=0;e<d;e++){const t=this._parent?._featureFromCache(n[e]);void 0!==t&&c.push({geometry:t.geometry,attributes:t.attributes,id:n[e]})}for(const e of c){const t=[];for(const i of this.adaptedFields)t[i.field.name]=i.extractValue(e);this._featureCache[e.id]=new r.A({attributes:t,geometry:(0,s.Yq)(e.geometry)})}return"success"}async _fetchAndRefineFeatures(){throw new a.dr(a.D_.NeverReach)}async _getFilteredSet(e,t,i,r,s){let a=!1;const n=this._reformulateWithoutAdaptions(i);a=n.cannot,i=n.where;let o=!1;if(null!==r){o=!0;const e=[];for(const t of this.adaptedFields)if(!(t instanceof p)&&!0===r.scanForField(t.field.name)){if(!(t instanceof y)){r=null,o=!1;break}e.push({field:t.field.name,newfield:t.originalField.name})}r&&e.length>0&&(r=r.replaceFields(e))}null!==i?null!==this._extraFilter&&(i=(0,u.kg)(this._extraFilter,i)):i=this._extraFilter,await this._ensureLoaded();const d=await this._parent._getFilteredSet(e,t,i,r,s);let c;return this._checkCancelled(s),c=!0===a?new l.A(d._candidates.slice().concat(d._known.slice()),[],!0===o&&d._ordered,this._clonePageDefinition(d.pagesDefinition)):new l.A(d._candidates.slice(),d._known.slice(),!0===o&&d._ordered,this._clonePageDefinition(d.pagesDefinition)),c}_reformulateWithoutAdaptions(e){const t={cannot:!1,where:e};if(null!==e)for(const i of this.adaptedFields)if(!0===(0,u.Ju)(e,i.field.name)){const r=i.rewriteSql(e,this);if(!0!==r.rewritten){t.cannot=!0,t.where=null;break}t.where=r.where}return t}async _stat(e,t,i,r,s,a,n){let l=!1,o=this._reformulateWithoutAdaptions(t);if(l=o.cannot,t=o.where,o=this._reformulateWithoutAdaptions(s),l=l||o.cannot,null!==(s=o.where)?null!==this._extraFilter&&(s=(0,u.kg)(this._extraFilter,s)):s=this._extraFilter,!0===l)return null===s&&""===i&&null===r?this._manualStat(e,t,a,n):{calculated:!1};const d=await this._parent._stat(e,t,i,r,s,a,n);return!1===d.calculated?null===s&&""===i&&null===r?this._manualStat(e,t,a,n):{calculated:!1}:d}async _canDoAggregates(e,t,i,r,s){if(null===this._parent)return!1;for(let t=0;t<e.length;t++)for(const i of this.adaptedFields)if(e[t].toLowerCase()===i.field.name.toLowerCase()&&!(i instanceof p))return!1;const a=[];for(let e=0;e<t.length;e++){const i=t[e];if(null!==i.workingexpr){const e=this._reformulateWithoutAdaptions(i.workingexpr);if(e.cannot)return!1;const t=i.clone();t.workingexpr=e.where,a.push(t)}else a.push(i)}const n=this._reformulateWithoutAdaptions(s);return!n.cannot&&(null!==(s=n.where)?null!==this._extraFilter&&(s=(0,u.kg)(this._extraFilter,s)):s=this._extraFilter,this._parent._canDoAggregates(e,a,i,r,s))}async _getAggregatePagesDataSourceDefinition(e,t,i,r,s,n,l){if(null===this._parent)throw new a.dr(a.D_.NeverReach);const o=[];for(let e=0;e<t.length;e++){const i=t[e];if(null!==i.workingexpr){const e=this._reformulateWithoutAdaptions(i.workingexpr);if(e.cannot)throw new a.dr(a.D_.NeverReach);const t=i.clone();t.workingexpr=e.where,o.push(t)}else o.push(i)}const d=this._reformulateWithoutAdaptions(s);if(d.cannot)throw new a.dr(a.D_.NeverReach);return null!==(s=d.where)?null!==this._extraFilter&&(s=(0,u.kg)(this._extraFilter,s)):s=this._extraFilter,this._parent._getAggregatePagesDataSourceDefinition(e,o,i,r,s,n,l)}}},35704:(e,t,i)=>{i.d(t,{A:()=>c});var r=i(87449),s=i(11221),a=i(89169),n=i(33325),l=i(80609),o=i(74887),u=i(50835),d=i(16930);class c extends s.A{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.actions.AttributeFilter",this._maxProcessing=1e3,this._parent=e.parentfeatureset,e.whereclause instanceof u.WhereClause?(this._whereclause=e.whereclause,this._whereClauseFunction=null):(this._whereClauseFunction=e.whereclause,this._whereclause=null)}_initialiseFeatureSet(){null!==this._parent?(this.fields=this._parent.fields.slice(),this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.globalIdField=this._parent.globalIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types,this.subtypeField=this._parent.subtypeField,this.subtypes=this._parent.subtypes):(this.fields=[],this.typeIdField="",this.subtypeField="",this.objectIdField="",this.globalIdField="",this.spatialReference=new d.A({wkid:4326}),this.geometryType=n.ik.point)}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._parent._getFilteredSet("",null,this._whereclause,null,e);return this._checkCancelled(e),null!==this._whereClauseFunction?this._wset=new a.A(t._candidates.slice().concat(t._known.slice()),[],t._ordered,this._clonePageDefinition(t.pagesDefinition)):this._wset=new a.A(t._candidates.slice(),t._known.slice(),t._ordered,this._clonePageDefinition(t.pagesDefinition)),this._wset}return this._wset}_isInFeatureSet(e){let t=this._parent?._isInFeatureSet(e);return t===n.J6.NotInFeatureSet?t:(t=this._idstates[e],void 0===t?n.J6.Unknown:t)}_getFeature(e,t,i){return this._parent._getFeature(e,t,i)}_getFeatures(e,t,i,r){return this._parent._getFeatures(e,t,i,r)}_featureFromCache(e){return this._parent._featureFromCache(e)}executeWhereClause(e){return this._whereclause?.testFeature(e)??!1}async executeWhereClauseDeferred(e){if(null!==this._whereClauseFunction){const t=this._whereClauseFunction(e);return(0,o.$X)(t),t}return this.executeWhereClause(e)}async _fetchAndRefineFeatures(e,t,i){const r=new a.A([],e,!1,null),s=Math.min(t,e.length);if(await(this._parent?._getFeatures(r,-1,s,i)),this._checkCancelled(i),null==this._whereClauseFunction){for(let t=0;t<s;t++){const i=this._parent?._featureFromCache(e[t]);!0===this.executeWhereClause(i)?this._idstates[e[t]]=n.J6.InFeatureSet:this._idstates[e[t]]=n.J6.NotInFeatureSet}return"success"}const l=[];for(let t=0;t<s;t++){const i=this._parent?._featureFromCache(e[t]);l.push(await this.executeWhereClauseDeferred(i))}for(let i=0;i<t;i++)!0===l[i]?this._idstates[e[i]]=n.J6.InFeatureSet:this._idstates[e[i]]=n.J6.NotInFeatureSet;return"success"}async _getFilteredSet(e,t,i,r,s){null!==this._whereClauseFunction||(null!==i?null!==this._whereclause&&(i=(0,l.kg)(this._whereclause,i)):i=this._whereclause),await this._ensureLoaded();const n=await this._parent._getFilteredSet(e,t,i,r,s);let o;return this._checkCancelled(s),o=null!==this._whereClauseFunction?new a.A(n._candidates.slice().concat(n._known.slice()),[],n._ordered,this._clonePageDefinition(n.pagesDefinition)):new a.A(n._candidates.slice(),n._known.slice(),n._ordered,this._clonePageDefinition(n.pagesDefinition)),o}async _stat(e,t,i,r,s,a,n){if(null!==this._whereClauseFunction)return null===s&&""===i&&null===r?this._manualStat(e,t,a,n):{calculated:!1};let o=this._whereclause;null!==s&&null!==this._whereclause&&(o=(0,l.kg)(this._whereclause,s));const u=await this._parent._stat(e,t,i,r,o,a,n);return!1===u.calculated?null===s&&""===i&&null===r?this._manualStat(e,t,a,n):{calculated:!1}:u}async _canDoAggregates(e,t,i,r,s){return null===this._whereClauseFunction&&(null!==s?null!==this._whereclause&&(s=(0,l.kg)(this._whereclause,s)):s=this._whereclause,null!==this._parent&&this._parent._canDoAggregates(e,t,i,r,s))}async _getAggregatePagesDataSourceDefinition(e,t,i,s,a,n,o){if(null===this._parent)throw new r.dr(r.D_.NeverReach);return null!==a?null!==this._whereclause&&(a=(0,l.kg)(this._whereclause,a)):a=this._whereclause,this._parent._getAggregatePagesDataSourceDefinition(e,t,i,s,a,n,o)}static registerAction(){s.A._featuresetFunctions.filter=function(e){if("function"==typeof e)return new c({parentfeatureset:this,whereclause:e});let t=null;return e instanceof u.WhereClause&&(t=e),new c({parentfeatureset:this,whereclause:t})}}getFieldsIndex(){return this._parent.getFieldsIndex()}}},86691:(e,t,i)=>{i.d(t,{A:()=>o});var r=i(78878),s=i(87449),a=i(11221),n=i(89169),l=i(87594);class o extends a.A{constructor(e){super(e),this._orderbyclause=null,this.declaredClass="esri.arcade.featureset.actions.OrderBy",this._maxProcessing=100,this._orderbyclause=e.orderbyclause,this._parent=e.parentfeatureset}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,this._orderbyclause,e);return this._checkCancelled(e),this._wset=t,this._wset}return this._wset}async manualOrderSet(e,t){const i=await this.getIdColumnDictionary(e,[],-1,t);this._orderbyclause?.order(i);const r=new n.A([],[],!0,null);for(let e=0;e<i.length;e++)r._known.push(i[e].id);return r}async getIdColumnDictionary(e,t,i,s){if(i<e._known.length-1){const a=this._maxQueryRate();if("GETPAGES"===e._known[i+1])return await(0,r.a1)(this._parent._expandPagedSet(e,a,0,0,s)),this.getIdColumnDictionary(e,t,i,s);let n=i+1;const l=[];for(;n<e._known.length&&"GETPAGES"!==e._known[n];)l.push(e._known[n]),n++;i+=l.length;const o=await(0,r.a1)(this._parent._getFeatureBatch(l,s));this._checkCancelled(s);for(const e of o)t.push({id:e.attributes[this.objectIdField],feature:e});return this.getIdColumnDictionary(e,t,i,s)}return e._candidates.length>0?(await(0,r.a1)(this._refineSetBlock(e,this._maxProcessingRate(),s)),this._checkCancelled(s),this.getIdColumnDictionary(e,t,i,s)):t}_isInFeatureSet(e){return this._parent._isInFeatureSet(e)}_getFeatures(e,t,i,r){return this._parent._getFeatures(e,t,i,r)}_featureFromCache(e){if(void 0===this._featureCache[e]){const t=this._parent._featureFromCache(e);if(void 0===t)return;return null===t?null:(this._featureCache[e]=t,t)}return this._featureCache[e]}async _fetchAndRefineFeatures(){throw new s.dr(s.D_.NeverReach)}async _getFilteredSet(e,t,i,r,s){await this._ensureLoaded();const a=await this._parent._getFilteredSet(e,t,i,null===r?this._orderbyclause:r,s);this._checkCancelled(s);const l=new n.A(a._candidates.slice(),a._known.slice(),a._ordered,this._clonePageDefinition(a.pagesDefinition));let o=!0;if(a._candidates.length>0&&(o=!1),!1===l._ordered){let e=await this.manualOrderSet(l,s);return!1===o&&(null===t&&null===i||(e=new n.A(e._candidates.slice().concat(e._known.slice()),[],e._ordered,this._clonePageDefinition(e.pagesDefinition)))),e}return l}static registerAction(){a.A._featuresetFunctions.orderBy=function(e){return""===e?this:new o({parentfeatureset:this,orderbyclause:new l.A(e)})}}getFieldsIndex(){return this._parent.getFieldsIndex()}}},54461:(e,t,i)=>{i.d(t,{A:()=>l});var r=i(87449),s=i(11221),a=i(89169),n=i(33325);class l extends s.A{constructor(e){super(e),this._topnum=0,this.declaredClass="esri.arcade.featureset.actions.Top",this._countedin=0,this._maxProcessing=100,this._topnum=e.topnum,this._parent=e.parentfeatureset}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._parent._getSet(e);return this._wset=new a.A(t._candidates.slice(),t._known.slice(),!1,this._clonePageDefinition(t.pagesDefinition)),this._setKnownLength(this._wset)>this._topnum&&(this._wset._known=this._wset._known.slice(0,this._topnum)),this._setKnownLength(this._wset)>=this._topnum&&(this._wset._candidates=[]),this._wset}return this._wset}_setKnownLength(e){return e._known.length>0&&"GETPAGES"===e._known[e._known.length-1]?e._known.length-1:e._known.length}_isInFeatureSet(e){const t=this._parent._isInFeatureSet(e);if(t===n.J6.NotInFeatureSet)return t;const i=this._idstates[e];return i===n.J6.InFeatureSet||i===n.J6.NotInFeatureSet?i:t===n.J6.InFeatureSet&&void 0===i?this._countedin<this._topnum?(this._idstates[e]=n.J6.InFeatureSet,this._countedin++,n.J6.InFeatureSet):(this._idstates[e]=n.J6.NotInFeatureSet,n.J6.NotInFeatureSet):n.J6.Unknown}async _expandPagedSet(e,t,i,s,a){if(null===this._parent)throw new r.dr(r.D_.NotImplemented);if(t>this._topnum&&(t=this._topnum),this._countedin>=this._topnum&&e.pagesDefinition.internal.set.length<=e.pagesDefinition.resultOffset){let t=e._known.length;return t>0&&"GETPAGES"===e._known[t-1]&&(e._known.length=t-1),t=e._candidates.length,t>0&&"GETPAGES"===e._candidates[t-1]&&(e._candidates.length=t-1),"success"}const n=await this._parent._expandPagedSet(e,t,i,s,a);return this._setKnownLength(e)>this._topnum&&(e._known.length=this._topnum),this._setKnownLength(e)>=this._topnum&&(e._candidates.length=0),n}async _getFeatures(e,t,i,r){const s=[],n=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,n))return await this._expandPagedSet(e,n,0,0,r),this._getFeatures(e,t,i,r);-1!==t&&void 0===this._featureCache[t]&&s.push(t);let l=0;for(let r=e._lastFetchedIndex;r<e._known.length&&(l++,l<=i&&(e._lastFetchedIndex+=1),!(void 0===this._featureCache[e._known[r]]&&(e._known[r]!==t&&s.push(e._known[r]),s.length>n)));r++);if(0===s.length)return"success";const o=new a.A([],s,!1,null),u=Math.min(s.length,i);await this._parent._getFeatures(o,-1,u,r);for(let e=0;e<u;e++){const t=this._parent._featureFromCache(s[e]);void 0!==t&&(this._featureCache[s[e]]=t)}return"success"}async _getFilteredSet(e,t,i,r,s){await this._ensureLoaded();const n=await this._getSet(s);return new a.A(n._candidates.slice().concat(n._known.slice()),[],!1,this._clonePageDefinition(n.pagesDefinition))}_refineKnowns(e,t){let i=0,r=null;const s=[];for(let a=0;a<e._candidates.length;a++){const l=this._isInFeatureSet(e._candidates[a]);if(l===n.J6.InFeatureSet){if(e._known.push(e._candidates[a]),i+=1,null===r?r={start:a,end:a}:r.end===a-1?r.end=a:(s.push(r),r={start:a,end:a}),e._known.length>=this._topnum)break}else if(l===n.J6.NotInFeatureSet)null===r?r={start:a,end:a}:r.end===a-1?r.end=a:(s.push(r),r={start:a,end:a}),i+=1;else if(l===n.J6.Unknown)break;if(i>=t)break}null!==r&&s.push(r);for(let t=s.length-1;t>=0;t--)e._candidates.splice(s[t].start,s[t].end-s[t].start+1);this._setKnownLength(e)>this._topnum&&(e._known=e._known.slice(0,this._topnum)),this._setKnownLength(e)>=this._topnum&&(e._candidates=[])}async _stat(){return{calculated:!1}}async _canDoAggregates(){return!1}static registerAction(){s.A._featuresetFunctions.top=function(e){return new l({parentfeatureset:this,topnum:e})}}getFieldsIndex(){return this._parent.getFieldsIndex()}}},30235:(e,t,i)=>{i.d(t,{A:()=>y});var r=i(52106),s=i(87449),a=i(11221),n=i(89169),l=i(33325),o=i(80609),u=i(39516),d=i(91075),c=i(13600),h=i(33143),f=i(20437),p=i(61956);class y extends a.A{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.sources.FeatureLayerMemory",this._removeGeometry=!1,this._overrideFields=null,this._forceIsTable=!1,e.spatialReference&&(this.spatialReference=e.spatialReference),this._transparent=!0,this._maxProcessing=1e3,this._layer=e.layer,this._wset=null,!0===e.isTable&&(this._forceIsTable=!0),void 0!==e.outFields&&(this._overrideFields=e.outFields),void 0!==e.includeGeometry&&(this._removeGeometry=!1===e.includeGeometry)}_maxQueryRate(){return l.gO}end(){return this._layer}optimisePagingFeatureQueries(){}async loadImpl(){return!0===this._layer.loaded?(this._initialiseFeatureSet(),this):(await this._layer.load(),this._initialiseFeatureSet(),this)}get gdbVersion(){return""}_initialiseFeatureSet(){if(null==this.spatialReference&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this._layer.geometryType??"",this.fields=this._layer.fields.slice(),null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{const e=[],t=[];for(const i of this.fields)if("oid"===i.type)e.push(i),t.push(i.name);else for(const r of this._overrideFields)if(r.toLowerCase()===i.name.toLowerCase()){e.push(i),t.push(i.name);break}this.fields=e,this._overrideFields=t}this.objectIdField=this._layer.objectIdField;for(const e of this.fields)"global-id"===e.type&&(this.globalIdField=e.name);this._databaseType=l.zl.Standardised,this.hasZ=!0===this._layer?.capabilities?.data?.supportsZ,this.hasM=!0===this._layer?.capabilities?.data?.supportsM,this.subtypeField=("subtypeField"in this._layer?this._layer.subtypeField:null)??"",this.subtypes="subtypes"in this._layer?this._layer.subtypes:null,this.typeIdField=("typeIdField"in this._layer?this._layer.typeIdField:null)??"",this.types="types"in this._layer?this._layer.types:null}isTable(){return this._forceIsTable||"isTable"in this._layer&&this._layer.isTable||"table"===this._layer.type||!this._layer.geometryType}_isInFeatureSet(){return l.J6.InFeatureSet}_candidateIdTransform(e){return e}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}_changeFeature(e){const t={};for(const i of this.fields)t[i.name]=e.attributes[i.name];return new r.A({geometry:!0===this._removeGeometry?null:e.geometry,attributes:t})}async _getFilteredSet(e,t,i,r,s){let a="",d=!1;if(null!==r&&(a=r.constructClause(),d=!0),this.isTable()&&t&&null!==e&&""!==e)return new n.A([],[],!0,null);const c=this._layer.createQuery();c.returnZ=this.hasZ,c.returnM=this.hasM,c.where=(0,u.m)(c.where,null===i?null===t?"1=1":"":(0,o.YY)(i,l.zl.Standardised)),c.spatialRelationship=this._makeRelationshipEnum(e),c.outSpatialReference=this.spatialReference,c.orderByFields=""!==a?a.split(","):null,c.geometry=null===t?null:t,c.returnGeometry=!0,c.relationParameter=this._makeRelationshipParam(e);const h=await this._layer.queryFeatures(c);if(null===h)return new n.A([],[],d,null);this._checkCancelled(s);const f=[];return h.features.forEach((e=>{const t=e.attributes[this._layer.objectIdField];f.push(t),this._featureCache[t]=this._changeFeature(e)})),new n.A([],f,d,null)}_makeRelationshipEnum(e){if(e.includes("esriSpatialRelRelation"))return"relation";switch(e){case"esriSpatialRelRelation":return"relation";case"esriSpatialRelIntersects":return"intersects";case"esriSpatialRelContains":return"contains";case"esriSpatialRelOverlaps":return"overlaps";case"esriSpatialRelWithin":return"within";case"esriSpatialRelTouches":return"touches";case"esriSpatialRelCrosses":return"crosses";case"esriSpatialRelEnvelopeIntersects":return"envelope-intersects"}return e}_makeRelationshipParam(e){return e.includes("esriSpatialRelRelation")?e.split(":")[1]:""}async _queryAllFeatures(){if(this._wset)return this._wset;const e=new p.A;if(e.where="1=1",await this._ensureLoaded(),this._layer.source&&this._layer.source.items){const e=[];return this._layer.source.items.forEach((t=>{const i=t.attributes[this._layer.objectIdField];e.push(i),this._featureCache[i]=this._changeFeature(t)})),this._wset=new n.A([],e,!1,null),this._wset}e.returnZ=this.hasZ,e.returnM=this.hasM;const t=await this._layer.queryFeatures(e),i=[];return t.features.forEach((e=>{const t=e.attributes[this._layer.objectIdField];i.push(t),this._featureCache[t]=this._changeFeature(e)})),this._wset=new n.A([],i,!1,null),this._wset}async _getFeatures(e,t,i){const r=[];-1!==t&&void 0===this._featureCache[t]&&r.push(t);for(let s=e._lastFetchedIndex;s<e._known.length&&(e._lastFetchedIndex+=1,!(void 0===this._featureCache[e._known[s]]&&(e._known[s]!==t&&r.push(e._known[s]),r.length>i)));s++);if(0===r.length)return"success";throw new s.dr(s.D_.MissingFeatures)}async _refineSetBlock(e){return e}async _stat(){return{calculated:!1}}async _canDoAggregates(){return!1}relationshipMetaData(){return[]}static _cloneAttr(e){const t={};for(const i in e)t[i]=e[i];return t}nativeCapabilities(){return{title:this._layer.title??"",canQueryRelated:!1,source:this,capabilities:this._layer.capabilities,databaseType:this._databaseType,requestStandardised:!0}}static create(e,t){let i=e.layerDefinition.objectIdField;const r=e.layerDefinition.typeIdField??"",s=[];if(e.layerDefinition.types)for(const t of e.layerDefinition.types)s.push(h.A.fromJSON(t));let a=e.layerDefinition.geometryType;void 0===a&&(a=e.featureSet.geometryType||"");let n=e.featureSet.features;const l=t.toJSON();if(!i){let t=!1;for(const r of e.layerDefinition.fields)if("oid"===r.type||"esriFieldTypeOID"===r.type){i=r.name,t=!0;break}if(!1===t){let t="FID",r=!0,s=0;for(;r;){let i=!0;for(const r of e.layerDefinition.fields)if(r.name===t){i=!1;break}!0===i?r=!1:(s++,t="FID"+s.toString())}e.layerDefinition.fields.push({type:"esriFieldTypeOID",name:t,alias:t});const a=[];for(let i=0;i<n.length;i++)a.push({geometry:e.featureSet.features[i].geometry,attributes:e.featureSet.features[i].attributes?this._cloneAttr(e.featureSet.features[i].attributes):{}}),a[i].attributes[t]=i;n=a,i=t}}const o=[];for(const t of e.layerDefinition.fields)t instanceof f.A?o.push(t):o.push(f.A.fromJSON(t));let u=a;switch(u||(u=""),u){case"esriGeometryPoint":u="point";break;case"esriGeometryPolyline":u="polyline";break;case"esriGeometryPolygon":u="polygon";break;case"esriGeometryEnvelope":u="extent";break;case"esriGeometryMultipoint":u="multipoint";break;case"":case"esriGeometryNull":u="esriGeometryNull"}if("esriGeometryNull"!==u)for(const e of n)e.geometry&&e.geometry instanceof d.A==0&&(e.geometry.type=u,void 0===e.geometry.spatialReference&&(e.geometry.spatialReference=l));else for(const e of n)e.geometry&&(e.geometry=null);const p={outFields:["*"],source:n,fields:o,hasZ:!0===e?.layerDefinition?.hasZ||!0===e?.featureSet?.hasZ,hasM:!0===e?.layerDefinition?.hasM||!0===e?.featureSet?.hasM,types:s,typeIdField:r,objectIdField:i,spatialReference:t},_="esriGeometryNull"===u||null===u;_||(p.geometryType=u);const g=new c.default(p);return e?.layerDefinition?.subtypeField&&e?.layerDefinition?.subtypes&&g.read({subtypes:e.layerDefinition.subtypes,subtypeField:e.layerDefinition.subtypeField}),new y({layer:g,spatialReference:t,isTable:_})}async queryAttachments(){return[]}async getFeatureByObjectId(e){const t=new p.A;t.where=this.objectIdField+"="+e.toString(),t.returnZ=this.hasZ,t.returnM=this.hasM;const i=await this._layer.queryFeatures(t);return 1===i.features.length?i.features[0]:null}async getOwningSystemUrl(){return""}async getIdentityUser(){return""}get preferredTimeZone(){return"preferredTimeZone"in this._layer?this._layer.preferredTimeZone:null}get dateFieldsTimeZone(){return"dateFieldsTimeZone"in this._layer?this._layer.dateFieldsTimeZone:null}get datesInUnknownTimezone(){return"datesInUnknownTimezone"in this._layer&&this._layer.datesInUnknownTimezone}get editFieldsInfo(){return"editFieldsInfo"in this._layer?this._layer.editFieldsInfo:null}get timeInfo(){return this._layer?.timeInfo}async getFeatureSetInfo(){const e=this._layer.title&&this._layer.parent;return this.fsetInfo??{layerId:null,layerName:null,itemId:null,serviceLayerUrl:null,webMapLayerId:e?this._layer.id??null:null,webMapLayerTitle:e?this._layer.title??null:null,className:null,objectClassId:null}}}},87594:(e,t,i)=>{function r(e,t){return e===t?0:null===e?-1:null===t?1:e<t?-1:1}i.d(t,{A:()=>s});class s{constructor(e){const t=e.split(",");this._fields=[],this._directions=[];for(let e=0;e<t.length;e++){const i=t[e].match(/\S+/g);this._fields.push(i[0]),2===i.length?"asc"===i[1].toLowerCase()?this._directions.push(1):this._directions.push(0):this._directions.push(1)}}constructClause(){let e="";for(let t=0;t<this._fields.length;t++)0!==t&&(e+=","),e+=this._fields[t],1===this._directions[t]?e+=" ASC":e+=" DESC";return e}order(e){e.sort(((e,t)=>{for(let i=0;i<this._fields.length;i++){const s=this.featureValue(e.feature,this._fields[i],i),a=this.featureValue(t.feature,this._fields[i],i);let n=0;if(n=1===this._directions[i]?r(s,a):-1*r(s,a),0!==n)return n}return 0}))}scanForField(e){for(let t=0;t<this._fields.length;t++)if(this._fields[t].toLowerCase().trim()===e.toLowerCase().trim())return!0;return!1}replaceFields(e){let t="";for(let i=0;i<this._fields.length;i++){0!==i&&(t+=",");let r=this._fields[i];for(const t of e)if(r.toLowerCase()===t.field.toLowerCase()){r=t.newfield;break}t+=r,1===this._directions[i]?t+=" ASC":t+=" DESC"}return new s(t)}featureValue(e,t,i){const r=e.attributes[t];if(void 0!==r)return r;for(const r in e.attributes)if(t.toLowerCase()===r.toLowerCase())return this._fields[i]=r,e.attributes[r];return null}}},39516:(e,t,i)=>{async function r(e,t){const{WhereClause:r}=await Promise.all([i.e(835),i.e(4800)]).then(i.bind(i,50835));return r.create(e,{fieldsIndex:t})}function s(e,t){return"1=1"===e?t??e:"1=1"===t?e??t:null!=e&&""!==e?null!=t&&""!==t?`(${e}) AND (${t})`:e:t}i.d(t,{G:()=>r,m:()=>s})},33143:(e,t,i)=>{i.d(t,{A:()=>f});var r=i(90237),s=i(69540),a=i(25482),n=i(10107),l=(i(44208),i(53966),i(87811),i(36005)),o=i(40608),u=i(43937),d=i(72088),c=i(29005);let h=class extends((0,s.O)(a.oY)){constructor(e){super(e),this.id=null,this.name=null,this.domains=null,this.templates=null}readDomains(e){const t={};for(const i of Object.keys(e))t[i]=(0,d.rS)(e[i]);return t}writeDomains(e,t){const i={};for(const t of Object.keys(e))e[t]&&(i[t]=e[t]?.toJSON());t.domains=i}};(0,r._)([(0,n.M)({json:{write:!0}})],h.prototype,"id",void 0),(0,r._)([(0,n.M)({json:{write:!0}})],h.prototype,"name",void 0),(0,r._)([(0,n.M)({json:{write:!0}})],h.prototype,"domains",void 0),(0,r._)([(0,l.w)("domains")],h.prototype,"readDomains",null),(0,r._)([(0,u.K)("domains")],h.prototype,"writeDomains",null),(0,r._)([(0,n.M)({type:[c.A],json:{write:!0}})],h.prototype,"templates",void 0),h=(0,r._)([(0,o.$)("esri.layers.support.FeatureType")],h);const f=h},60694:(e,t,i)=>{i.d(t,{Fi:()=>d,HZ:()=>g,Jf:()=>_,LS:()=>m,Wo:()=>y,bd:()=>w,cr:()=>f,iz:()=>h,qg:()=>c,yG:()=>p});var r=i(84952),s=i(97159);const a={mapserver:"MapServer",imageserver:"ImageServer",featureserver:"FeatureServer",knowledgegraphserver:"KnowledgeGraphServer",sceneserver:"SceneServer",streamserver:"StreamServer",vectortileserver:"VectorTileServer","3dtilesserver":"3DTilesServer",videoserver:"VideoServer"},n=Object.values(a),l=new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/rest\\/services\\/(.+?)\\/(${n.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`,"i"),o=new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/([^/\\n]+)\\/(${n.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`,"i"),u=/(.*?)\/(?:layers\/)?(\d+)\/?$/i;function d(e){return l.test(e)}function c(e){if(null==e)return null;const t=(0,r.An)(e),i=t?.path.match(l)||t?.path.match(o);if(!i)return null;const[,s,n,u,d]=i,c=n.indexOf("/");return{title:f(-1!==c?n.slice(c+1):n),serverType:a[u.toLowerCase()],sublayer:null!=d&&""!==d?parseInt(d,10):null,url:{path:s}}}function h(e){const t=(0,r.An)(e).path.match(u);return t?{serviceUrl:t[1],sublayerId:Number(t[2])}:null}function f(e){return(e=e.replaceAll(/\s*[/_]+\s*/g," "))[0].toUpperCase()+e.slice(1)}function p(e,t){const i=[];if(e){const t=c(e);null!=t&&t.title&&i.push(t.title)}if(t){const e=f(t);i.push(e)}if(2===i.length){if(i[0].toLowerCase().includes(i[1].toLowerCase()))return i[0];if(i[1].toLowerCase().includes(i[0].toLowerCase()))return i[1]}return i.join(" - ")}function y(e){let t=(0,r.$z)(e,!0);return!!t&&(t=t.toLowerCase(),t.endsWith(".arcgis.com")&&(t.startsWith("services")||t.startsWith("tiles")||t.startsWith("features")))}function _(e,t){return e?(0,r.UC)((0,r.zi)(e,t)):e}function g(e){let{url:t}=e;if(!t)return{url:t};t=(0,r.zi)(t,e.logger);const i=(0,r.An)(t),s=c(i.path);let a;if(null!=s)null!=s.sublayer&&null==e.layer.layerId&&(a=s.sublayer),t=s.url.path;else if(e.nonStandardUrlAllowed){const e=h(i.path);null!=e&&(t=e.serviceUrl,a=e.sublayerId)}return{url:(0,r.UC)(t),layerId:a}}function m(e,t,i,a,n){(0,s.w)(t,a,"url",n),a.url&&null!=e.layerId&&(a.url=(0,r.fj)(a.url,i,e.layerId.toString()))}function w(e){if(!e)return!1;const t=e.toLowerCase(),i=t.includes("/services/"),r=t.includes("/mapserver/wmsserver"),s=t.includes("/imageserver/wmsserver"),a=t.includes("/wmsserver");return i&&(r||s||a)}},32730:(e,t,i)=>{i.d(t,{BI:()=>_,D3:()=>p,XJ:()=>y,lc:()=>f,mX:()=>m,rU:()=>g,tH:()=>b});var r=i(799);const s="__begin__",a="__end__",n=new RegExp(s,"ig"),l=new RegExp(a,"ig"),o=new RegExp("^"+s,"i"),u=new RegExp(a+"$","i"),d='"',c=d+" + ",h=" + "+d;function f(e){return e.replaceAll(new RegExp("\\[","g"),"{").replaceAll(new RegExp("\\]","g"),"}")}function p(e){return e.replaceAll(new RegExp("\\{","g"),"[").replaceAll(new RegExp("\\}","g"),"]")}function y(e){const t={expression:"",type:"none"};return e.labelExpressionInfo?e.labelExpressionInfo.value?(t.expression=e.labelExpressionInfo.value,t.type="conventional"):e.labelExpressionInfo.expression&&(t.expression=e.labelExpressionInfo.expression,t.type="arcade"):null!=e.labelExpression&&(t.expression=f(e.labelExpression),t.type="conventional"),t}function _(e){const t=y(e);if(!t)return null;switch(t.type){case"conventional":return m(t.expression);case"arcade":return t.expression}return null}function g(e){const t=y(e);if(!t)return null;switch(t.type){case"conventional":return function(e){const t=e?.match(w);return t?.[1].trim()||null}(t.expression);case"arcade":return b(t.expression)}return null}function m(e){let t;return e?(t=(0,r.HC)(e,(e=>s+'$feature["'+e+'"]'+a)),t=o.test(t)?t.replace(o,""):d+t,t=u.test(t)?t.replace(u,""):t+d,t=t.replaceAll(n,c).replaceAll(l,h)):t='""',t}const w=/^\s*\{([^}]+)\}\s*$/i,F=/^\s*(?:(?:\$feature\.(\w+))|(?:\$feature\[(["'])(.+)(\2)\]));?\s*$/i,S=/^\s*(?:(?:\$feature\.(\w+))|(?:\$feature\[(["'])(.+)(\2)\]));?\s*(?:DomainName\(\s*\$feature\s*,\s*(["'])(\1|\3)(\5)\s*\));?\s*$/i,I=/^\s*(?:DomainName\(\s*\$feature\s*,\s*(["'])(.+)(\1)\s*\));?\s*$/i;function b(e){if(!e)return null;let t=F.exec(e)||S.exec(e);return t?t[1]||t[3]:(t=I.exec(e),t?t[2]:null)}},10407:(e,t,i)=>{i.d(t,{It:()=>h,LG:()=>n,OM:()=>u,Y:()=>l,bK:()=>o,mm:()=>c,sQ:()=>d});var r=i(57251),s=i(16930),a=i(28735);function n(e,t){if(!l(e,t)){const i=e.typeKeywords;i?i.push(t):e.typeKeywords=[t]}}function l(e,t){return!!e.typeKeywords?.includes(t)}function o(e){return l(e,c.HOSTED_SERVICE)}function u(e,t){const i=e.typeKeywords;if(i){const e=i.indexOf(t);e>-1&&i.splice(e,1)}}async function d(e){const t=e.clone().normalize();let i;if(t.length>1)for(const e of t)i?e.width>i.width&&(i=e):i=e;else i=t[0];return async function(e){const t=e.spatialReference;if(t.isWGS84)return e.clone();if(t.isWebMercator)return(0,a.ci)(e);const i=s.A.WGS84;return await(0,r.initializeProjection)(t,i),(0,r.project)(e,i)}(i)}const c={DEVELOPER_BASEMAP:"DeveloperBasemap",JSAPI:"ArcGIS API for JavaScript",METADATA:"Metadata",MULTI_LAYER:"Multilayer",SINGLE_LAYER:"Singlelayer",TABLE:"Table",HOSTED_SERVICE:"Hosted Service",LOCAL_SCENE:"ViewingMode-Local",TILED_IMAGERY:"Tiled Imagery",GROUP_LAYER_MAP:"Map"};function h(e){const{portal:t,isOrgItem:i,itemControl:r}=e,s=t.user?.privileges;let a=!s||s.includes("features:user:edit"),n=!!i&&!!s?.includes("features:user:fullEdit");const l="update"===r||"admin"===r;return l?n=a=!0:n&&(a=!0),{features:{edit:a,fullEdit:n},content:{updateItem:l}}}},58501:(e,t,i)=>{i.d(t,{q:()=>s});var r=i(62815);function s(e,t,i){if(!i?.features||!i.hasZ)return;const s=(0,r.N)(i.geometryType,t,e.outSpatialReference);if(null!=s)for(const e of i.features)s(e.geometry)}},22671:(e,t,i)=>{i.d(t,{A:()=>w});var r,s=i(90237),a=i(59456),n=i(52106),l=i(66552),o=i(25482),u=i(4718),d=i(10107),c=(i(44208),i(53966),i(36005)),h=i(40608),f=i(43937),p=i(16930),y=i(65864),_=i(20437);const g=new l.J({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryEnvelope:"extent",mesh:"mesh","":null});let m=r=class extends o.oY{constructor(e){super(e),this.displayFieldName=null,this.exceededTransferLimit=!1,this.features=[],this.fields=null,this.geometryType=null,this.hasM=!1,this.hasZ=!1,this.queryGeometry=null,this.spatialReference=null}readFeatures(e,t){const i=p.A.fromJSON(t.spatialReference),r=[];for(let t=0;t<e.length;t++){const s=e[t],a=n.A.fromJSON(s),l=s.geometry?.spatialReference;null==a.geometry||l||(a.geometry.spatialReference=i);const o=s.aggregateGeometries,u=a.aggregateGeometries;if(o&&null!=u)for(const e in u){const t=u[e],r=o[e],s=r?.spatialReference;null==t||s||(t.spatialReference=i)}r.push(a)}return r}writeGeometryType(e,t,i,r){if(e)return void g.write(e,t,i,r);const{features:s}=this;if(s)for(const e of s)if(null!=e?.geometry)return void g.write(e.geometry.type,t,i,r)}readQueryGeometry(e,t){if(!e)return null;const i=!!e.spatialReference,r=(0,y.rS)(e);return r&&!i&&t.spatialReference&&(r.spatialReference=p.A.fromJSON(t.spatialReference)),r}writeSpatialReference(e,t){if(e)return void(t.spatialReference=e.toJSON());const{features:i}=this;if(i)for(const e of i)if(e&&null!=e.geometry&&e.geometry.spatialReference)return void(t.spatialReference=e.geometry.spatialReference.toJSON())}clone(){return new r(this.cloneProperties())}cloneProperties(){return(0,u.o8)({displayFieldName:this.displayFieldName,exceededTransferLimit:this.exceededTransferLimit,features:this.features,fields:this.fields,geometryType:this.geometryType,hasM:this.hasM,hasZ:this.hasZ,queryGeometry:this.queryGeometry,spatialReference:this.spatialReference,transform:this.transform})}toJSON(e){const t=this.write();if(t.features&&Array.isArray(e)&&e.length>0)for(let i=0;i<t.features.length;i++){const r=t.features[i];if(r.geometry){const t=e?.[i];r.geometry=t?.toJSON()||r.geometry}}return t}quantize(e){const{scale:[t,i],translate:[r,s]}=e,a=this.features,n=this._getQuantizationFunction(this.geometryType,(e=>Math.round((e-r)/t)),(e=>Math.round((s-e)/i)));for(let e=0,t=a.length;e<t;e++)n?.(a[e].geometry)||(a.splice(e,1),e--,t--);return this.transform=e,this}unquantize(){const{geometryType:e,features:t,transform:i}=this;if(!i)return this;const{translate:[r,s],scale:[a,n]}=i;let l=null,o=null;if(this.hasZ&&null!=i?.scale?.[2]){const{translate:[,,e],scale:[,,t]}=i;l=i=>i*t+e}if(this.hasM&&null!=i?.scale?.[3]){const{translate:[,,,e],scale:[,,,t]}=i;o=i=>null==i?i:i*t+e}const u=this._getHydrationFunction(e,(e=>e*a+r),(e=>s-e*n),l,o);for(const{geometry:e}of t)null!=e&&u&&u(e);return this.transform=null,this}_quantizePoints(e,t,i){let r,s;const a=[];for(let n=0,l=e.length;n<l;n++){const l=e[n];if(n>0){const e=t(l[0]),n=i(l[1]);e===r&&n===s||(a.push([e-r,n-s]),r=e,s=n)}else r=t(l[0]),s=i(l[1]),a.push([r,s])}return a.length>0?a:null}_getQuantizationFunction(e,t,i){return"point"===e?e=>(e.x=t(e.x),e.y=i(e.y),e):"polyline"===e||"polygon"===e?e=>{const r=(0,y.Bi)(e)?e.rings:e.paths,s=[];for(let e=0,a=r.length;e<a;e++){const a=r[e],n=this._quantizePoints(a,t,i);n&&s.push(n)}return s.length>0?((0,y.Bi)(e)?e.rings=s:e.paths=s,e):null}:"multipoint"===e?e=>{const r=this._quantizePoints(e.points,t,i);return r&&r.length>0?(e.points=r,e):null}:"extent"===e?e=>e:null}_getHydrationFunction(e,t,i,r,s){return"point"===e?e=>{e.x=t(e.x),e.y=i(e.y),r&&(e.z=r(e.z))}:"polyline"===e||"polygon"===e?e=>{const a=(0,y.Bi)(e)?e.rings:e.paths;let n,l;for(let e=0,r=a.length;e<r;e++){const r=a[e];for(let e=0,s=r.length;e<s;e++){const s=r[e];e>0?(n+=s[0],l+=s[1]):(n=s[0],l=s[1]),s[0]=t(n),s[1]=i(l)}}if(r&&s)for(let e=0,t=a.length;e<t;e++){const t=a[e];for(let e=0,i=t.length;e<i;e++){const i=t[e];i[2]=r(i[2]),i[3]=s(i[3])}}else if(r)for(let e=0,t=a.length;e<t;e++){const t=a[e];for(let e=0,i=t.length;e<i;e++){const i=t[e];i[2]=r(i[2])}}else if(s)for(let e=0,t=a.length;e<t;e++){const t=a[e];for(let e=0,i=t.length;e<i;e++){const i=t[e];i[2]=s(i[2])}}}:"extent"===e?e=>{e.xmin=t(e.xmin),e.ymin=i(e.ymin),e.xmax=t(e.xmax),e.ymax=i(e.ymax),r&&null!=e.zmax&&null!=e.zmin&&(e.zmax=r(e.zmax),e.zmin=r(e.zmin)),s&&null!=e.mmax&&null!=e.mmin&&(e.mmax=s(e.mmax),e.mmin=s(e.mmin))}:"multipoint"===e?e=>{const a=e.points;let n,l;for(let e=0,r=a.length;e<r;e++){const r=a[e];e>0?(n+=r[0],l+=r[1]):(n=r[0],l=r[1]),r[0]=t(n),r[1]=i(l)}if(r&&s)for(let e=0,t=a.length;e<t;e++){const t=a[e];t[2]=r(t[2]),t[3]=s(t[3])}else if(r)for(let e=0,t=a.length;e<t;e++){const t=a[e];t[2]=r(t[2])}else if(s)for(let e=0,t=a.length;e<t;e++){const t=a[e];t[2]=s(t[2])}}:null}};(0,s._)([(0,d.M)({type:String,json:{write:!0}})],m.prototype,"displayFieldName",void 0),(0,s._)([(0,d.M)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],m.prototype,"exceededTransferLimit",void 0),(0,s._)([(0,d.M)({type:[n.A],json:{write:!0}})],m.prototype,"features",void 0),(0,s._)([(0,c.w)("features")],m.prototype,"readFeatures",null),(0,s._)([(0,d.M)({type:[_.A],json:{write:!0}})],m.prototype,"fields",void 0),(0,s._)([(0,d.M)({type:["point","multipoint","polyline","polygon","extent","mesh"],json:{read:{reader:g.read}}})],m.prototype,"geometryType",void 0),(0,s._)([(0,f.K)("geometryType")],m.prototype,"writeGeometryType",null),(0,s._)([(0,d.M)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],m.prototype,"hasM",void 0),(0,s._)([(0,d.M)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],m.prototype,"hasZ",void 0),(0,s._)([(0,d.M)({types:a.yR,json:{write:!0}})],m.prototype,"queryGeometry",void 0),(0,s._)([(0,c.w)("queryGeometry")],m.prototype,"readQueryGeometry",null),(0,s._)([(0,d.M)({type:p.A,json:{write:!0}})],m.prototype,"spatialReference",void 0),(0,s._)([(0,f.K)("spatialReference")],m.prototype,"writeSpatialReference",null),(0,s._)([(0,d.M)({json:{write:!0}})],m.prototype,"transform",void 0),m=r=(0,s._)([(0,h.$)("esri.rest.support.FeatureSet")],m),m.prototype.toJSON.isDefaultToJSON=!0;const w=m}}]);