@arcgis/core 4.27.0-next.20230516 → 4.27.0-next.20230518

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 (194) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/03dba2a2bbc363369a0f.js +1 -0
  3. package/assets/esri/core/workers/chunks/12714d64a0154688072e.js +1 -0
  4. package/assets/esri/core/workers/chunks/{a507135977d83aea4421.js → 1827a3da6b5b9272ffe1.js} +1 -1
  5. package/assets/esri/core/workers/chunks/1edc5c06874cb12c5478.js +1 -0
  6. package/assets/esri/core/workers/chunks/{395ef46b635f9e9a5643.js → 20e8e18e4bd2fd5da47c.js} +1 -1
  7. package/assets/esri/core/workers/chunks/23f73f81aea461c0c6e6.js +1 -0
  8. package/assets/esri/core/workers/chunks/{15dda462b979e90b58fe.js → 3cebdd77a8401495097f.js} +1 -1
  9. package/assets/esri/core/workers/chunks/3eb75b6c3c4b3aea2325.js +1 -0
  10. package/assets/esri/core/workers/chunks/48cb634255e39711a720.js +1 -0
  11. package/assets/esri/core/workers/chunks/4d5f71d84c85f45c97ea.js +1 -0
  12. package/assets/esri/core/workers/chunks/55ca6ba8b40921025181.js +2 -0
  13. package/assets/esri/core/workers/chunks/{ef141014ed21a7fd1ff3.js.LICENSE.txt → 55ca6ba8b40921025181.js.LICENSE.txt} +1 -1
  14. package/assets/esri/core/workers/chunks/6312783626bacf52df7a.js +1 -0
  15. package/assets/esri/core/workers/chunks/{a3822a97701890c12d63.js → 6b3b277a21de7c434717.js} +1 -1
  16. package/assets/esri/core/workers/chunks/6d80f81bf6ad97a7e69e.js +1 -0
  17. package/assets/esri/core/workers/chunks/887a630c5c980c5028e1.js +1 -0
  18. package/assets/esri/core/workers/chunks/{522660da4589739a70c3.js → c7fb48ea5d907883bcce.js} +1 -1
  19. package/assets/esri/core/workers/chunks/d0ff968e42116f592065.js +1 -0
  20. package/assets/esri/core/workers/chunks/{fdf64f23529a22c79fbd.js → d52c920acf08c95277c3.js} +19 -19
  21. package/assets/esri/core/workers/chunks/d64c271c173797d98286.js +1 -0
  22. package/assets/esri/core/workers/chunks/e1b2076d0040fcb7d864.js +1 -0
  23. package/assets/esri/core/workers/chunks/e3397036e060dac3b4d5.js +1 -0
  24. package/assets/esri/core/workers/chunks/e6836c84470fb6bd25bf.js +1 -0
  25. package/assets/esri/core/workers/chunks/f3f6035a17f7dcd19675.js +1 -0
  26. package/assets/esri/core/workers/chunks/{bff317b08e91414f6edc.js → f720967ba8c5486a26a2.js} +1 -1
  27. package/assets/esri/themes/base/widgets/_BasemapGallery.scss +20 -11
  28. package/assets/esri/themes/base/widgets/_Editor.scss +0 -9
  29. package/assets/esri/themes/base/widgets/_FeatureForm.scss +4 -2
  30. package/assets/esri/themes/base/widgets/_ItemList.scss +0 -49
  31. package/assets/esri/themes/base/widgets/_ValuePicker.scss +27 -10
  32. package/assets/esri/themes/dark/main.css +1 -1
  33. package/assets/esri/themes/light/main.css +1 -1
  34. package/assets/esri/themes/light/view.css +1 -1
  35. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ar.json +1 -1
  36. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_bg.json +1 -1
  37. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_bs.json +1 -1
  38. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ca.json +1 -1
  39. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_cs.json +1 -1
  40. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_da.json +1 -1
  41. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_de.json +1 -1
  42. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_el.json +1 -1
  43. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_es.json +1 -1
  44. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_et.json +1 -1
  45. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_fi.json +1 -1
  46. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_fr.json +1 -1
  47. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_he.json +1 -1
  48. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_hr.json +1 -1
  49. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_hu.json +1 -1
  50. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_id.json +1 -1
  51. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_it.json +1 -1
  52. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ja.json +1 -1
  53. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ko.json +1 -1
  54. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_lt.json +1 -1
  55. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_lv.json +1 -1
  56. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_nb.json +1 -1
  57. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_nl.json +1 -1
  58. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_pl.json +1 -1
  59. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_pt-BR.json +1 -1
  60. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_pt-PT.json +1 -1
  61. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ro.json +1 -1
  62. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ru.json +1 -1
  63. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sk.json +1 -1
  64. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sl.json +1 -1
  65. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sr.json +1 -1
  66. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sv.json +1 -1
  67. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_th.json +1 -1
  68. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_tr.json +1 -1
  69. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_uk.json +1 -1
  70. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_vi.json +1 -1
  71. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_zh-CN.json +1 -1
  72. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_zh-HK.json +1 -1
  73. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_zh-TW.json +1 -1
  74. package/chunks/DefaultMaterial.glsl.js +4 -4
  75. package/chunks/HUDMaterial.glsl.js +22 -22
  76. package/chunks/HeatmapDensity.glsl.js +5 -5
  77. package/chunks/LineMarker.glsl.js +35 -35
  78. package/chunks/RibbonLine.glsl.js +47 -47
  79. package/chunks/ShadowCastVisualize.glsl.js +2 -2
  80. package/core/Queue.js +1 -1
  81. package/core/a11yUtils.js +5 -0
  82. package/interfaces.d.ts +769 -25
  83. package/intl/date.js +1 -1
  84. package/layers/ImageryTileLayer.js +1 -1
  85. package/layers/WMSLayer.js +1 -1
  86. package/layers/graphics/data/QueryEngine.js +1 -1
  87. package/layers/graphics/data/attributeSupport.js +1 -1
  88. package/layers/mixins/ArcGISImageService.js +1 -1
  89. package/layers/support/RasterBandInfo.d.ts +4 -0
  90. package/layers/support/RasterSensorInfo.d.ts +4 -0
  91. package/layers/support/infoFor3D.js +1 -1
  92. package/layers/support/rasterDatasets/TIFFRaster.js +1 -1
  93. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  94. package/layers/support/rasterFunctions/rasterFunctionHelper.js +1 -1
  95. package/package.json +2 -2
  96. package/popup/FieldInfo.js +1 -1
  97. package/popup/support/FieldInfoFormat.js +1 -1
  98. package/portal/schemas/definitions.js +1 -1
  99. package/rest/support/BaseImageMeasureParameters.d.ts +4 -0
  100. package/rest/support/BaseImageMeasureParameters.js +1 -1
  101. package/rest/support/ImageHistogramParameters.js +1 -1
  102. package/rest/support/ImageIdentifyParameters.js +1 -1
  103. package/smartMapping/raster/support/adapters/ImageryLayerAdapter.js +1 -1
  104. package/smartMapping/raster/support/adapters/ImageryTileLayerAdapter.js +1 -1
  105. package/support/revision.js +1 -1
  106. package/views/2d/engine/vectorTiles/GlyphMosaic.js +1 -1
  107. package/views/2d/engine/vectorTiles/GlyphSource.js +1 -1
  108. package/views/2d/engine/vectorTiles/TextShaping.js +1 -1
  109. package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +1 -1
  110. package/views/2d/engine/webgl/GlyphSource.js +1 -1
  111. package/views/2d/layers/MediaLayerView2D.js +1 -1
  112. package/views/2d/layers/TileLayerView2D.js +1 -1
  113. package/views/2d/layers/support/cimSymbolUtils.js +1 -1
  114. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  115. package/views/3d/support/DisplayQualityProfile.js +1 -1
  116. package/views/3d/support/QualitySettings.js +1 -1
  117. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  118. package/views/3d/terrain/Overlay.js +1 -1
  119. package/views/3d/terrain/OverlayManager.js +1 -1
  120. package/views/3d/terrain/OverlayRenderer.js +1 -1
  121. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +13 -13
  122. package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +18 -18
  123. package/views/3d/webgl-engine/core/shaderLibrary/shading/MarkerSizing.glsl.js +8 -8
  124. package/views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js +1 -1
  125. package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
  126. package/views/3d/webgl-engine/lib/RenderFeature.js +1 -1
  127. package/views/3d/webgl-engine/lib/RenderTargetHelper.js +1 -1
  128. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  129. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  130. package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
  131. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  132. package/views/3d/webgl-engine/lib/lodRendering/LodComponentData.js +1 -1
  133. package/views/3d/webgl-engine/materials/DefaultBufferWriter.js +1 -1
  134. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  135. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  136. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  137. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  138. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  139. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  140. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  141. package/views/3d/webgl-engine/materials/lineStippleUtils.js +1 -1
  142. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  143. package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
  144. package/views/3d/webgl-engine/shaders/HUDMaterialTechniqueConfiguration.js +1 -1
  145. package/views/3d/webgl-engine/shaders/HeatmapDensity.glsl.js +1 -1
  146. package/views/3d/webgl-engine/shaders/LineCalloutTechniqueConfiguration.js +1 -1
  147. package/views/3d/webgl-engine/shaders/LineMarkerTechniqueConfiguration.js +1 -1
  148. package/views/DOMContainer.js +1 -1
  149. package/views/PopupView.js +1 -1
  150. package/views/draw/DrawOperation.js +1 -1
  151. package/views/webgl/ValidatedTextureDescriptor.js +1 -1
  152. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  153. package/widgets/Editor/CreateWorkflow.js +1 -1
  154. package/widgets/Editor/EditorViewModel.js +1 -1
  155. package/widgets/Editor/UpdateWorkflow.js +1 -1
  156. package/widgets/Editor/Upload.js +1 -1
  157. package/widgets/Editor/Workflow.js +1 -1
  158. package/widgets/Editor/modelUploadUtils.js +1 -1
  159. package/widgets/Editor/workflowUtils.js +1 -1
  160. package/widgets/Editor.js +1 -1
  161. package/widgets/Feature/FeatureMedia.js +1 -1
  162. package/widgets/FeatureForm/InputField.js +5 -0
  163. package/widgets/FeatureForm/InputFieldGroup.js +5 -0
  164. package/widgets/FeatureForm/css.js +1 -1
  165. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  166. package/widgets/FeatureTable.js +1 -1
  167. package/widgets/FeatureTemplates/ItemList.js +1 -1
  168. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  169. package/widgets/Print/PrintViewModel.js +1 -1
  170. package/widgets/Search/SearchViewModel.js +1 -1
  171. package/widgets/ValuePicker/ValuePickerBaseComponent.js +1 -1
  172. package/widgets/ValuePicker/ValuePickerCollection.js +1 -1
  173. package/widgets/ValuePicker/ValuePickerCombobox.js +1 -1
  174. package/widgets/ValuePicker/ValuePickerLabel.js +1 -1
  175. package/widgets/ValuePicker/ValuePickerSlider.js +1 -1
  176. package/widgets/ValuePicker/ValuePickerViewModel.js +1 -1
  177. package/widgets/ValuePicker.js +1 -1
  178. package/assets/esri/core/workers/chunks/009026614cae60e9505c.js +0 -1
  179. package/assets/esri/core/workers/chunks/415c326d268b1a8fd03f.js +0 -1
  180. package/assets/esri/core/workers/chunks/504e929b686570ee858d.js +0 -1
  181. package/assets/esri/core/workers/chunks/5c811527898eb1c04e67.js +0 -1
  182. package/assets/esri/core/workers/chunks/6164a9c654c38f9cb64e.js +0 -1
  183. package/assets/esri/core/workers/chunks/6dd99db0adce09ac9794.js +0 -1
  184. package/assets/esri/core/workers/chunks/7cec069db0598431829e.js +0 -1
  185. package/assets/esri/core/workers/chunks/8bb3b10a777ae19f57f9.js +0 -1
  186. package/assets/esri/core/workers/chunks/91971a76a4ae0474a878.js +0 -1
  187. package/assets/esri/core/workers/chunks/9ed9e2ad50816a4f937a.js +0 -1
  188. package/assets/esri/core/workers/chunks/b3013a5a39d038b2d748.js +0 -1
  189. package/assets/esri/core/workers/chunks/b81bb096ccfcea182cc1.js +0 -1
  190. package/assets/esri/core/workers/chunks/cf3dd5aad1d60ff1b0b6.js +0 -1
  191. package/assets/esri/core/workers/chunks/d05d9ddf244bb3dcbcaa.js +0 -1
  192. package/assets/esri/core/workers/chunks/d3a6504fbaf555707c58.js +0 -1
  193. package/assets/esri/core/workers/chunks/ef141014ed21a7fd1ff3.js +0 -2
  194. package/assets/esri/core/workers/chunks/f4933025edecdc1aae76.js +0 -1
package/intl/date.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{strict as t}from"../core/jsonMap.js";import{beforeLocaleChange as o,getLocale as e}from"./locale.js";import{DateTime as r}from"luxon";const n={year:void 0,month:void 0,day:void 0,weekday:void 0},a={hour:void 0,minute:void 0,second:void 0},h={timeZoneName:"short"},m={timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone},i={timeZone:"Etc/UTC"},s={year:"numeric",month:"numeric",day:"numeric"},l={year:"numeric",month:"long",day:"numeric"},d={year:"numeric",month:"short",day:"numeric"},y={year:"numeric",month:"long",weekday:"long",day:"numeric"},g={hour:"numeric",minute:"numeric"},u={...g,second:"numeric"},c={"short-date":s,"short-date-short-time":{...s,...g},"short-date-short-time-24":{...s,...g,hour12:!1},"short-date-long-time":{...s,...u},"short-date-long-time-24":{...s,...u,hour12:!1},"short-date-le":s,"short-date-le-short-time":{...s,...g},"short-date-le-short-time-24":{...s,...g,hour12:!1},"short-date-le-long-time":{...s,...u},"short-date-le-long-time-24":{...s,...u,hour12:!1},"long-month-day-year":l,"long-month-day-year-short-time":{...l,...g},"long-month-day-year-short-time-24":{...l,...g,hour12:!1},"long-month-day-year-long-time":{...l,...u},"long-month-day-year-long-time-24":{...l,...u,hour12:!1},"day-short-month-year":d,"day-short-month-year-short-time":{...d,...g},"day-short-month-year-short-time-24":{...d,...g,hour12:!1},"day-short-month-year-long-time":{...d,...u},"day-short-month-year-long-time-24":{...d,...u,hour12:!1},"long-date":y,"long-date-short-time":{...y,...g},"long-date-short-time-24":{...y,...g,hour12:!1},"long-date-long-time":{...y,...u},"long-date-long-time-24":{...y,...u,hour12:!1},"long-month-year":{month:"long",year:"numeric"},"short-month-year":{month:"short",year:"numeric"},year:{year:"numeric"},"short-time":g,"long-time":u},D=t()({shortDate:"short-date",shortDateShortTime:"short-date-short-time",shortDateShortTime24:"short-date-short-time-24",shortDateLongTime:"short-date-long-time",shortDateLongTime24:"short-date-long-time-24",shortDateLE:"short-date-le",shortDateLEShortTime:"short-date-le-short-time",shortDateLEShortTime24:"short-date-le-short-time-24",shortDateLELongTime:"short-date-le-long-time",shortDateLELongTime24:"short-date-le-long-time-24",longMonthDayYear:"long-month-day-year",longMonthDayYearShortTime:"long-month-day-year-short-time",longMonthDayYearShortTime24:"long-month-day-year-short-time-24",longMonthDayYearLongTime:"long-month-day-year-long-time",longMonthDayYearLongTime24:"long-month-day-year-long-time-24",dayShortMonthYear:"day-short-month-year",dayShortMonthYearShortTime:"day-short-month-year-short-time",dayShortMonthYearShortTime24:"day-short-month-year-short-time-24",dayShortMonthYearLongTime:"day-short-month-year-long-time",dayShortMonthYearLongTime24:"day-short-month-year-long-time-24",longDate:"long-date",longDateShortTime:"long-date-short-time",longDateShortTime24:"long-date-short-time-24",longDateLongTime:"long-date-long-time",longDateLongTime24:"long-date-long-time-24",longMonthYear:"long-month-year",shortMonthYear:"short-month-year",year:"year"}),T={ar:"ar-u-nu-latn-ca-gregory"};let S=new WeakMap,L=c["short-date-short-time"];function M(t){const o=t||L;let r=S.get(o);if(!r){const t=e(),n=T[t]||t;r=new Intl.DateTimeFormat(n,o),S.set(o,r)}return r}function f(t){return t?c[t]:null}function Y(t,o){return M(o).format(t)}function p(t,o){return Y(new Date(t),{...o,...i,...a})}function v(t,o){return Y(new Date(`1970-01-01T${t}Z`),{...o,...i,...n})}function w(t,o){const n=r.fromISO(t,{setZone:!0}),a=e(),h=T[a]??a;return n.toLocaleString(o,{locale:h})}o((()=>{S=new WeakMap,L=c["short-date-short-time"]}));export{f as convertDateFormatToIntlOptions,D as dateFormatJSONMap,Y as formatDate,p as formatDateOnly,v as formatTimeOnly,w as formatTimestamp,M as getDateTimeFormatter,h as shortTimeZoneName,m as systemTimeZone,i as utcTimeZone};
5
+ import{strict as t}from"../core/jsonMap.js";import{beforeLocaleChange as o,getLocale as e}from"./locale.js";import{DateTime as r}from"luxon";const n={year:void 0,month:void 0,day:void 0,weekday:void 0},a={hour:void 0,minute:void 0,second:void 0},h={timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone},m={timeZone:"Etc/UTC"},i={year:"numeric",month:"numeric",day:"numeric"},s={year:"numeric",month:"long",day:"numeric"},l={year:"numeric",month:"short",day:"numeric"},d={year:"numeric",month:"long",weekday:"long",day:"numeric"},y={hour:"numeric",minute:"numeric"},g={...y,second:"numeric"},u={"short-date":i,"short-date-short-time":{...i,...y},"short-date-short-time-24":{...i,...y,hour12:!1},"short-date-long-time":{...i,...g},"short-date-long-time-24":{...i,...g,hour12:!1},"short-date-le":i,"short-date-le-short-time":{...i,...y},"short-date-le-short-time-24":{...i,...y,hour12:!1},"short-date-le-long-time":{...i,...g},"short-date-le-long-time-24":{...i,...g,hour12:!1},"long-month-day-year":s,"long-month-day-year-short-time":{...s,...y},"long-month-day-year-short-time-24":{...s,...y,hour12:!1},"long-month-day-year-long-time":{...s,...g},"long-month-day-year-long-time-24":{...s,...g,hour12:!1},"day-short-month-year":l,"day-short-month-year-short-time":{...l,...y},"day-short-month-year-short-time-24":{...l,...y,hour12:!1},"day-short-month-year-long-time":{...l,...g},"day-short-month-year-long-time-24":{...l,...g,hour12:!1},"long-date":d,"long-date-short-time":{...d,...y},"long-date-short-time-24":{...d,...y,hour12:!1},"long-date-long-time":{...d,...g},"long-date-long-time-24":{...d,...g,hour12:!1},"long-month-year":{month:"long",year:"numeric"},"short-month-year":{month:"short",year:"numeric"},year:{year:"numeric"},"short-time":y,"long-time":g},c=t()({shortDate:"short-date",shortDateShortTime:"short-date-short-time",shortDateShortTime24:"short-date-short-time-24",shortDateLongTime:"short-date-long-time",shortDateLongTime24:"short-date-long-time-24",shortDateLE:"short-date-le",shortDateLEShortTime:"short-date-le-short-time",shortDateLEShortTime24:"short-date-le-short-time-24",shortDateLELongTime:"short-date-le-long-time",shortDateLELongTime24:"short-date-le-long-time-24",longMonthDayYear:"long-month-day-year",longMonthDayYearShortTime:"long-month-day-year-short-time",longMonthDayYearShortTime24:"long-month-day-year-short-time-24",longMonthDayYearLongTime:"long-month-day-year-long-time",longMonthDayYearLongTime24:"long-month-day-year-long-time-24",dayShortMonthYear:"day-short-month-year",dayShortMonthYearShortTime:"day-short-month-year-short-time",dayShortMonthYearShortTime24:"day-short-month-year-short-time-24",dayShortMonthYearLongTime:"day-short-month-year-long-time",dayShortMonthYearLongTime24:"day-short-month-year-long-time-24",longDate:"long-date",longDateShortTime:"long-date-short-time",longDateShortTime24:"long-date-short-time-24",longDateLongTime:"long-date-long-time",longDateLongTime24:"long-date-long-time-24",longMonthYear:"long-month-year",shortMonthYear:"short-month-year",year:"year"}),D={ar:"ar-u-nu-latn-ca-gregory"};let T=new WeakMap,S=u["short-date-short-time"];function L(t){const o=t||S;let r=T.get(o);if(!r){const t=e(),n=D[t]||t;r=new Intl.DateTimeFormat(n,o),T.set(o,r)}return r}function M(t){return u[t]}function f(t,o){return L(o).format(t)}function Y(t,o=u["short-date"]){return f(new Date(t),{...o,...m,...a})}function p(t,o=u["short-time"]){return f(new Date(`1970-01-01T${t}Z`),{...o,...m,...n})}function v(t,o=u["short-date-short-time"]){const n=r.fromISO(t,{setZone:!0}),a=e(),h=D[a]??a;return n.toLocaleString(o,{locale:h})}o((()=>{T=new WeakMap,S=u["short-date-short-time"]}));export{M as convertDateFormatToIntlOptions,c as dateFormatJSONMap,f as formatDate,Y as formatDateOnly,p as formatTimeOnly,v as formatTimestamp,L as getDateTimeFormatter,h as systemTimeZone,m as utcTimeZone};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import r from"../PopupTemplate.js";import t from"../core/Error.js";import s from"../core/Logger.js";import{MultiOriginJSONMixin as i}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as o}from"../core/promiseUtils.js";import{watch as a}from"../core/reactiveUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import{ensureClass as l,Integer as p}from"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{enumeration as m}from"../core/accessorSupport/decorators/enumeration.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import c from"./Layer.js";import{ArcGISService as d}from"./mixins/ArcGISService.js";import{BlendLayer as h}from"./mixins/BlendLayer.js";import{CustomParametersMixin as y}from"./mixins/CustomParametersMixin.js";import{ImageryTileMixin as f}from"./mixins/ImageryTileMixin.js";import{OperationalLayer as g}from"./mixins/OperationalLayer.js";import{PortalLayer as v}from"./mixins/PortalLayer.js";import{RefreshableLayer as j}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as R}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as S}from"./mixins/TemporalLayer.js";import{legendEnabled as b}from"./support/commonProperties.js";import w from"./support/Field.js";import{interpolationKebab as I}from"./support/rasterEnums.js";import P from"./support/RasterFunction.js";import T from"./support/rasterDatasets/FunctionRaster.js";import O from"./support/rasterDatasets/RasterFactory.js";import{create as x,getPrimaryRasterUrls as F}from"./support/rasterFunctions/rasterFunctionHelper.js";import{createPopupTemplate as _}from"../support/popupUtils.js";let L=class extends(h(R(g(v(y(f(S(d(j(i(c))))))))))){constructor(...e){super(...e),this._primaryRasters=null,this.bandIds=null,this.interpolation=null,this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.type="imagery-tile",this.operationalLayerType="ArcGISTiledImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.fields=null}normalizeCtorArgs(e,r){return"string"==typeof e?{url:e,...r}:e}load(e){const r=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(o).then((()=>this._openRaster(r)))),Promise.resolve(this)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){const e=[new w({name:"Raster.ServicePixelValue",alias:"Pixel Value",domain:null,editable:!1,length:50,type:"string"}),new w({name:"Raster.ServicePixelValue.Raw",alias:"Raw Pixel Value",domain:null,editable:!1,length:50,type:"string"})],{rasterInfo:r}=this,t=r?.attributeTable,s=null!=t?t.fields:null,i="Raster.";if(s){const r=s.filter((e=>"oid"!==e.type&&"value"!==e.name.toLowerCase())).map((e=>{const r=e.clone();return r.name=i+e.name,r}));e.push(...r)}const o=r?.dataType,a=r?.multidimensionalInfo;if(("vector-magdir"===o||"vector-uv"===o)&&null!=a){const r=a.variables[0].unit?.trim(),t="Magnitude"+(r?` (${r})`:"");e.push(new w({name:"Raster.Magnitude",alias:t,domain:null,editable:!1,type:"double"})),e.push(new w({name:"Raster.Direction",alias:"Direction (°)",domain:null,editable:!1,type:"double"}))}return e}createPopupTemplate(e){const{rasterFields:r}=this,t=new Set(r.map((({name:e})=>e)).filter((e=>"raster.servicepixelvalue.raw"!==e.toLowerCase())));return _({fields:r,title:this.title},{...e,visibleFieldNames:t})}async generateRasterInfo(e,r){if(!(e=l(P,e)))return this._primaryRasters[0].rasterInfo;try{const t={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach((e=>t[e.url]=e));const s=x(e.rasterFunctionDefinition??e.toJSON(),t),i=new T({rasterFunction:s});return await i.open(r),i.rasterInfo}catch{return null}}write(e,r){const{raster:s}=this;if(this.loaded?"RasterTileServer"===s.datasetFormat&&("Raster"===s.tileType||"Map"===s.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))return super.write(e,r);if(r&&r.messages){const e=`${r.origin}/${r.layerContainerType||"operational-layers"}`;r.messages.push(new t("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this}))}return null}async _openRaster(e){let r=!1;if(this.raster)this.raster.rasterInfo||await this.raster.open(),"Function"===this.raster.datasetFormat?(r=!0,this._primaryRasters=this.raster.primaryRasters.rasters):this._primaryRasters=[this.raster],this.url=this.raster.url;else{const{rasterFunction:r}=this,i=[this.url];r&&F(r.toJSON(),i);const a=await Promise.all(i.map((r=>O.open({url:r,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:e})))),n=a.findIndex((e=>null==e));if(n>-1)throw new t("imagery-tile-layer:open",`cannot open raster: ${i[n]}`);if(this._primaryRasters=a,r){const e={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach((r=>e[r.url]=r));const i=x(r.rasterFunctionDefinition??r.toJSON(),e),n=new T({rasterFunction:i});try{await n.open(),this.raster=n}catch(o){const e=s.getLogger(this);o instanceof t&&e.error("imagery-tile-layer:open",o.message),e.warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=a[0]}}else this.raster=a[0]}const i=this.raster.rasterInfo;if(!i)throw new t("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("rasterInfo",r?i:this._primaryRasters[0].rasterInfo),this._set("spatialReference",i.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){const e="Map"===this.raster.tileType&&null!=this.sourceJSON.minLOD&&null!=this.sourceJSON.maxLOD?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:"service"})}else this.read({tileInfo:this.rasterInfo.storageInfo.tileInfo.toJSON()},{origin:"service"});this.title||(this.title=this.raster.datasetName),"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles(a((()=>this.customParameters),(e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)})))}};e([n()],L.prototype,"_primaryRasters",void 0),e([n({type:[p],json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"0,1,2"!==this.bandIds?.join(",")}}}}})],L.prototype,"bandIds",void 0),e([n({json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"bilinear"!==this.interpolation}}}}}),m(I)],L.prototype,"interpolation",void 0),e([n(b)],L.prototype,"legendEnabled",void 0),e([n({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],L.prototype,"isReference",void 0),e([n({type:["show","hide"]})],L.prototype,"listMode",void 0),e([n({json:{read:!0,write:!0}})],L.prototype,"blendMode",void 0),e([n()],L.prototype,"sourceJSON",void 0),e([n({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],L.prototype,"version",void 0),e([n({readOnly:!0,json:{read:!1}})],L.prototype,"type",void 0),e([n({type:["ArcGISTiledImageServiceLayer"]})],L.prototype,"operationalLayerType",void 0),e([n({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,r)=>!r.disablePopup},write:{target:"disablePopup",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}},writer(e,r,t){r[t]=!e}}}})],L.prototype,"popupEnabled",void 0),e([n({type:r,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],L.prototype,"popupTemplate",void 0),e([n({readOnly:!0})],L.prototype,"defaultPopupTemplate",null),e([n({readOnly:!0,type:[w]})],L.prototype,"fields",void 0),e([n({readOnly:!0,type:[w]})],L.prototype,"rasterFields",null),L=e([u("esri.layers.ImageryTileLayer")],L);const N=L;export{N as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import r from"../PopupTemplate.js";import t from"../core/Error.js";import s from"../core/Logger.js";import{MultiOriginJSONMixin as i}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as o}from"../core/promiseUtils.js";import{watch as a}from"../core/reactiveUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import{ensureClass as l,Integer as p}from"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{enumeration as m}from"../core/accessorSupport/decorators/enumeration.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import c from"./Layer.js";import{ArcGISService as d}from"./mixins/ArcGISService.js";import{BlendLayer as h}from"./mixins/BlendLayer.js";import{CustomParametersMixin as y}from"./mixins/CustomParametersMixin.js";import{ImageryTileMixin as f}from"./mixins/ImageryTileMixin.js";import{OperationalLayer as g}from"./mixins/OperationalLayer.js";import{PortalLayer as v}from"./mixins/PortalLayer.js";import{RefreshableLayer as j}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as R}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as S}from"./mixins/TemporalLayer.js";import{legendEnabled as w}from"./support/commonProperties.js";import b from"./support/Field.js";import{interpolationKebab as I}from"./support/rasterEnums.js";import P from"./support/RasterFunction.js";import T from"./support/rasterDatasets/FunctionRaster.js";import O from"./support/rasterDatasets/RasterFactory.js";import{create as x,getPrimaryRasterUrls as F}from"./support/rasterFunctions/rasterFunctionHelper.js";import{createPopupTemplate as L}from"../support/popupUtils.js";let N=class extends(h(R(g(v(y(f(S(d(j(i(c))))))))))){constructor(...e){super(...e),this._primaryRasters=null,this.bandIds=null,this.interpolation=null,this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.type="imagery-tile",this.operationalLayerType="ArcGISTiledImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.fields=null}normalizeCtorArgs(e,r){return"string"==typeof e?{url:e,...r}:e}load(e){const r=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(o).then((()=>this._openRaster(r)))),Promise.resolve(this)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){const e=[new b({name:"Raster.ServicePixelValue",alias:"Pixel Value",domain:null,editable:!1,length:50,type:"string"}),new b({name:"Raster.ServicePixelValue.Raw",alias:"Raw Pixel Value",domain:null,editable:!1,length:50,type:"string"})],{rasterInfo:r}=this,t=r?.attributeTable,s=null!=t?t.fields:null,i="Raster.";if(s){const r=s.filter((e=>"oid"!==e.type&&"value"!==e.name.toLowerCase())).map((e=>{const r=e.clone();return r.name=i+e.name,r}));e.push(...r)}const o=r?.dataType,a=r?.multidimensionalInfo;if(("vector-magdir"===o||"vector-uv"===o)&&null!=a){const r=a.variables[0].unit?.trim(),t="Magnitude"+(r?` (${r})`:"");e.push(new b({name:"Raster.Magnitude",alias:t,domain:null,editable:!1,type:"double"})),e.push(new b({name:"Raster.Direction",alias:"Direction (°)",domain:null,editable:!1,type:"double"}))}return e}createPopupTemplate(e){const{rasterFields:r}=this,t=new Set(r.map((({name:e})=>e)).filter((e=>"raster.servicepixelvalue.raw"!==e.toLowerCase())));return L({fields:r,title:this.title},{...e,visibleFieldNames:t})}async generateRasterInfo(e,r){if(!(e=l(P,e)))return this.rasterInfo;try{const t={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach((e=>t[e.url]=e));const s=x(e.rasterFunctionDefinition??e.toJSON(),t),i=new T({rasterFunction:s});return await i.open(r),i.rasterInfo}catch(s){if(s instanceof t)throw s;throw new t("imagery-tile-layer","the given raster function is not supported")}}write(e,r){const{raster:s}=this;if(this.loaded?"RasterTileServer"===s.datasetFormat&&("Raster"===s.tileType||"Map"===s.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))return super.write(e,r);if(r&&r.messages){const e=`${r.origin}/${r.layerContainerType||"operational-layers"}`;r.messages.push(new t("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this}))}return null}async _openRaster(e){let r=!1;if(this.raster)this.raster.rasterInfo||await this.raster.open(),"Function"===this.raster.datasetFormat?(r=!0,this._primaryRasters=this.raster.primaryRasters.rasters):this._primaryRasters=[this.raster],this.url=this.raster.url;else{const{rasterFunction:r}=this,i=[this.url];r&&F(r.toJSON(),i);const a=await Promise.all(i.map((r=>O.open({url:r,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:e})))),n=a.findIndex((e=>null==e));if(n>-1)throw new t("imagery-tile-layer:open",`cannot open raster: ${i[n]}`);if(this._primaryRasters=a,r){const e={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach((r=>e[r.url]=r));const i=x(r.rasterFunctionDefinition??r.toJSON(),e),n=new T({rasterFunction:i});try{await n.open(),this.raster=n}catch(o){const e=s.getLogger(this);o instanceof t&&e.error("imagery-tile-layer:open",o.message),e.warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=a[0]}}else this.raster=a[0]}const i=this.raster.rasterInfo;if(!i)throw new t("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("rasterInfo",r?i:this._primaryRasters[0].rasterInfo),this._set("spatialReference",i.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){const e="Map"===this.raster.tileType&&null!=this.sourceJSON.minLOD&&null!=this.sourceJSON.maxLOD?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:"service"})}else this.read({tileInfo:this.rasterInfo.storageInfo.tileInfo.toJSON()},{origin:"service"});this.title||(this.title=this.raster.datasetName),"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles(a((()=>this.customParameters),(e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)})))}};e([n()],N.prototype,"_primaryRasters",void 0),e([n({type:[p],json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"0,1,2"!==this.bandIds?.join(",")}}}}})],N.prototype,"bandIds",void 0),e([n({json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"bilinear"!==this.interpolation}}}}}),m(I)],N.prototype,"interpolation",void 0),e([n(w)],N.prototype,"legendEnabled",void 0),e([n({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],N.prototype,"isReference",void 0),e([n({type:["show","hide"]})],N.prototype,"listMode",void 0),e([n({json:{read:!0,write:!0}})],N.prototype,"blendMode",void 0),e([n()],N.prototype,"sourceJSON",void 0),e([n({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],N.prototype,"version",void 0),e([n({readOnly:!0,json:{read:!1}})],N.prototype,"type",void 0),e([n({type:["ArcGISTiledImageServiceLayer"]})],N.prototype,"operationalLayerType",void 0),e([n({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,r)=>!r.disablePopup},write:{target:"disablePopup",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}},writer(e,r,t){r[t]=!e}}}})],N.prototype,"popupEnabled",void 0),e([n({type:r,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],N.prototype,"popupTemplate",void 0),e([n({readOnly:!0})],N.prototype,"defaultPopupTemplate",null),e([n({readOnly:!0,type:[b]})],N.prototype,"fields",void 0),e([n({readOnly:!0,type:[b]})],N.prototype,"rasterFields",null),N=e([u("esri.layers.ImageryTileLayer")],N);const _=N;export{_ as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../config.js";import r from"../Graphic.js";import o from"../PopupTemplate.js";import s from"../request.js";import i from"../core/Collection.js";import a from"../core/CollectionFlattener.js";import{JSONMap as n}from"../core/jsonMap.js";import{clone as l}from"../core/lang.js";import{MultiOriginJSONMixin as p}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as m}from"../core/promiseUtils.js";import{on as u,watch as c,sync as f}from"../core/reactiveUtils.js";import{addQueryParameters as y,addProxy as d,Url as h}from"../core/urlUtils.js";import{property as g}from"../core/accessorSupport/decorators/property.js";import{Integer as b}from"../core/accessorSupport/ensureType.js";import{reader as v}from"../core/accessorSupport/decorators/reader.js";import{subclass as w}from"../core/accessorSupport/decorators/subclass.js";import{writer as x}from"../core/accessorSupport/decorators/writer.js";import{willPropertyWrite as j}from"../core/accessorSupport/write.js";import I from"../geometry/Extent.js";import S from"../geometry/SpatialReference.js";import{getScale as F}from"../geometry/support/scaleUtils.js";import{equals as E}from"../geometry/support/spatialReferenceUtils.js";import R from"./Layer.js";import{BlendLayer as P}from"./mixins/BlendLayer.js";import{OperationalLayer as O}from"./mixins/OperationalLayer.js";import{PortalLayer as L}from"./mixins/PortalLayer.js";import{RefreshableLayer as U}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as M}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as T}from"./mixins/TemporalLayer.js";import{isAxesOrderReversedForWkid as _}from"./ogc/crsUtils.js";import{isWmsServer as C}from"./support/arcgisLayerUrl.js";import{legendEnabled as W,url as $}from"./support/commonProperties.js";import{ExportWMSImageParameters as q}from"./support/ExportWMSImageParameters.js";import{createBitmap as N}from"./support/imageBitmapUtils.js";import B from"./support/WMSSublayer.js";import{normalizeWKID as H,toISOString as k,getPopupLayers as G,parseCapabilities as A}from"./support/wmsUtils.js";const D=new n({bmp:"image/bmp",gif:"image/gif",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml"},{ignoreUnknown:!1});function J(e){return"text/html"===e}function V(e){return"text/plain"===e}let Q=class extends(P(T(U(M(O(L(p(R)))))))){constructor(...e){super(...e),this.allSublayers=new a({getCollections:()=>[this.sublayers],getChildrenFunction:e=>e.sublayers}),this.customParameters=null,this.customLayerParameters=null,this.copyright=null,this.description=null,this.dimensions=null,this.fullExtent=null,this.fullExtents=null,this.featureInfoFormats=null,this.featureInfoUrl=null,this.fetchFeatureInfoFunction=null,this.imageFormat=null,this.imageMaxHeight=2048,this.imageMaxWidth=2048,this.imageTransparency=!0,this.legendEnabled=!0,this.mapUrl=null,this.isReference=null,this.operationalLayerType="WMS",this.spatialReference=null,this.spatialReferences=null,this.sublayers=null,this.type="wms",this.url=null,this.version=null,this.addHandles([u((()=>this.sublayers),"after-add",(({item:e})=>{e.parent=e.layer=this}),f),u((()=>this.sublayers),"after-remove",(({item:e})=>{e.layer=e.parent=null}),f),c((()=>this.sublayers),((e,t)=>{if(t)for(const r of t)r.layer=r.parent=null;if(e)for(const r of e)r.parent=r.layer=this}),f)])}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}destroy(){this.allSublayers.destroy()}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["WMS"]},e).catch(m).then((()=>this._fetchService(t)))),Promise.resolve(this)}readFullExtentFromItemOrMap(e,t){const r=t.extent;return r?new I({xmin:r[0][0],ymin:r[0][1],xmax:r[1][0],ymax:r[1][1]}):null}writeFullExtent(e,t){t.extent=[[e.xmin,e.ymin],[e.xmax,e.ymax]]}get featureInfoFormat(){return null==this.featureInfoFormats?null:this.featureInfoFormats.find(J)??this.featureInfoFormats.find(V)??null}set featureInfoFormat(e){null==e?(this.revert("featureInfoFormat","service"),this._clearOverride("featureInfoFormat")):(J(e)||V(e))&&this._override("featureInfoFormat",e)}readImageFormat(e,t){const r=t.supportedImageFormatTypes;return r&&r.includes("image/png")?"image/png":r&&r[0]}readSpatialReferenceFromItemOrDocument(e,t){return new S(t.spatialReferences[0])}writeSpatialReferences(e,t){const r=this.spatialReference?.wkid;e&&r?(t.spatialReferences=e.filter((e=>e!==r)),t.spatialReferences.unshift(r)):t.spatialReferences=e}readSublayersFromItemOrMap(e,t,r){return K(t.layers,r,t.visibleLayers)}readSublayers(e,t,r){return K(t.layers,r)}writeSublayers(e,t,r,o){t.layers=[];const s=new Map,i=e.flatten((({sublayers:e})=>e??[]));for(const a of i)if("number"==typeof a.parent?.id){const e=s.get(a.parent.id);null!=e?e.push(a.id):s.set(a.parent.id,[a.id])}for(const a of i){const e={sublayer:a,...o},r=a.write({parentLayerId:"number"==typeof a.parent?.id?a.parent.id:-1},e);if(s.has(a.id)&&(r.sublayerIds=s.get(a.id)),!a.sublayers&&a.name){const r=a.write({},e);delete r.id,t.layers.push(r)}}t.visibleLayers=i.filter((({visible:e,sublayers:t})=>e&&!t)).map((({name:e})=>e)).toArray()}createExportImageParameters(e,t,r,o){const s=o?.pixelRatio??1,i=F({extent:e,width:t})*s,a=new q({layer:this,scale:i}),{xmin:n,ymin:l,xmax:p,ymax:m,spatialReference:u}=e,c=H(u,this.spatialReferences),f="1.3.0"===this.version&&_(c)?`${l},${n},${m},${p}`:`${n},${l},${p},${m}`,y=a.toJSON();return{bbox:f,["1.3.0"===this.version?"crs":"srs"]:null==c||isNaN(c)?void 0:"EPSG:"+c,...y}}async fetchImage(e,t,r,o){const i=this.mapUrl,a=this.createExportImageParameters(e,t,r,o);if(!a.layers){const e=document.createElement("canvas");return e.width=t,e.height=r,e}const n=o?.timeExtent?.start,l=o?.timeExtent?.end,p=null!=n&&null!=l?n.getTime()===l.getTime()?k(n):`${k(n)}/${k(l)}`:void 0,m={responseType:"image",query:this._mixCustomParameters({width:t,height:r,...a,time:p,...this.refreshParameters}),signal:o?.signal};return s(i??"",m).then((e=>e.data))}async fetchImageBitmap(e,t,r,o){const i=this.mapUrl??"",a=this.createExportImageParameters(e,t,r,o);if(!a.layers){const e=document.createElement("canvas");return e.width=t,e.height=r,e}const n=o?.timeExtent?.start,l=o?.timeExtent?.end,p=null!=n&&null!=l?n.getTime()===l.getTime()?k(n):`${k(n)}/${k(l)}`:void 0,m={responseType:"blob",query:this._mixCustomParameters({width:t,height:r,...a,time:p,...this.refreshParameters}),signal:o?.signal},{data:u}=await s(i,m);return N(u,i,o?.signal)}fetchFeatureInfo(e,t,r,o,s){const i=F({extent:e,width:t}),a=new q({layer:this,scale:i}),n=G(a.visibleSublayers);if(null==this.featureInfoUrl||null==n)return Promise.resolve([]);if(null==this.fetchFeatureInfoFunction&&null==this.featureInfoFormat)return Promise.resolve([]);const l="1.3.0"===this.version?{I:o,J:s}:{x:o,y:s},p={query_layers:n,request:"GetFeatureInfo",info_format:this.featureInfoFormat,feature_count:25,width:t,height:r,...l},m={...this.createExportImageParameters(e,t,r),...p},u=this._mixCustomParameters(m);return null!=this.fetchFeatureInfoFunction?this.fetchFeatureInfoFunction(u):this._defaultFetchFeatureInfoFunction(y(this.featureInfoUrl,u))}findSublayerById(e){return this.allSublayers.find((t=>t.id===e))}findSublayerByName(e){return this.allSublayers.find((t=>t.name===e))}serviceSupportsSpatialReference(e){return C(this.url)||null!=this.spatialReferences&&this.spatialReferences.some((t=>{const r=900913===t?S.WebMercator:new S({wkid:t});return E(r,e)}))}_defaultFetchFeatureInfoFunction(e){const t=document.createElement("iframe");t.src=d(e),t.style.border="none",t.style.margin="0",t.style.width="100%",t.setAttribute("sandbox","");const s=new o({title:this.title,content:t}),i=new r({sourceLayer:this,popupTemplate:s});return Promise.resolve([i])}async _fetchService(e){if(!this.resourceInfo){const{path:t,query:r}=this.parsedUrl??{};r?.service&&(r.SERVICE=r.service,delete r.service),r?.request&&(r.REQUEST=r.request,delete r.request);const{data:o}=await s(t??"",{query:{SERVICE:"WMS",REQUEST:"GetCapabilities",...r,...this.customParameters},responseType:"xml",signal:e});this.resourceInfo=A(o)}if(this.parsedUrl){const e=new h(this.parsedUrl.path),{httpsDomains:r}=t.request;"https"!==e.scheme||e.port&&"443"!==e.port||!e.host||r.includes(e.host)||r.push(e.host)}this.read(this.resourceInfo,{origin:"service"})}_mixCustomParameters(e){if(!this.customLayerParameters&&!this.customParameters)return e;const t={...this.customParameters,...this.customLayerParameters};for(const r in t)e[r.toLowerCase()]=t[r];return e}};function z(e,t){return e.some((e=>{for(const r in e)if(j(e,r,null,t))return!0;return!1}))}function K(e,t,r){e=e??[];const o=new Map;e.every((e=>null==e.id))&&(e=l(e)).forEach(((e,t)=>e.id=t));for(const i of e){const e=new B;e.read(i,t),r&&!r.includes(e.name)&&(e.visible=!1),o.set(e.id,e)}const s=[];for(const a of e){const e=null!=a.id?o.get(a.id):null;if(e)if(null!=a.parentLayerId&&a.parentLayerId>=0){const t=o.get(a.parentLayerId);if(!t)continue;t.sublayers||(t.sublayers=new i),t.sublayers.push(e)}else s.push(e)}return s}e([g({readOnly:!0})],Q.prototype,"allSublayers",void 0),e([g({json:{type:Object,write:!0}})],Q.prototype,"customParameters",void 0),e([g({json:{type:Object,write:!0}})],Q.prototype,"customLayerParameters",void 0),e([g({type:String,json:{write:!0}})],Q.prototype,"copyright",void 0),e([g()],Q.prototype,"description",void 0),e([g({readOnly:!0})],Q.prototype,"dimensions",void 0),e([g({json:{type:[[Number]],read:{source:"extent"},write:{target:"extent"},origins:{"web-document":{write:{ignoreOrigin:!0}},"portal-item":{write:{ignoreOrigin:!0}}}}})],Q.prototype,"fullExtent",void 0),e([v(["web-document","portal-item"],"fullExtent",["extent"])],Q.prototype,"readFullExtentFromItemOrMap",null),e([x(["web-document","portal-item"],"fullExtent",{extent:{type:[[Number]]}})],Q.prototype,"writeFullExtent",null),e([g()],Q.prototype,"fullExtents",void 0),e([g({type:String,json:{write:{ignoreOrigin:!0}}})],Q.prototype,"featureInfoFormat",null),e([g({type:[String],readOnly:!0})],Q.prototype,"featureInfoFormats",void 0),e([g({type:String,json:{write:{ignoreOrigin:!0}}})],Q.prototype,"featureInfoUrl",void 0),e([g()],Q.prototype,"fetchFeatureInfoFunction",void 0),e([g({type:String,json:{origins:{"web-document":{default:"image/png",type:D.jsonValues,read:{reader:D.read,source:"format"},write:{writer:D.write,target:"format"}}}}})],Q.prototype,"imageFormat",void 0),e([v("imageFormat",["supportedImageFormatTypes"])],Q.prototype,"readImageFormat",null),e([g({type:Number,json:{read:{source:"maxHeight"},write:{target:"maxHeight"}}})],Q.prototype,"imageMaxHeight",void 0),e([g({type:Number,json:{read:{source:"maxWidth"},write:{target:"maxWidth"}}})],Q.prototype,"imageMaxWidth",void 0),e([g()],Q.prototype,"imageTransparency",void 0),e([g(W)],Q.prototype,"legendEnabled",void 0),e([g({type:["show","hide","hide-children"]})],Q.prototype,"listMode",void 0),e([g({type:String,json:{write:{ignoreOrigin:!0}}})],Q.prototype,"mapUrl",void 0),e([g({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],Q.prototype,"isReference",void 0),e([g({type:["WMS"]})],Q.prototype,"operationalLayerType",void 0),e([g()],Q.prototype,"resourceInfo",void 0),e([g({type:S,json:{origins:{service:{read:{source:"extent.spatialReference"}}},write:!1}})],Q.prototype,"spatialReference",void 0),e([v(["web-document","portal-item"],"spatialReference",["spatialReferences"])],Q.prototype,"readSpatialReferenceFromItemOrDocument",null),e([g({type:[b],json:{read:!1,origins:{service:{read:!0},"web-document":{read:!1,write:{ignoreOrigin:!0}},"portal-item":{read:!1,write:{ignoreOrigin:!0}}}}})],Q.prototype,"spatialReferences",void 0),e([x(["web-document","portal-item"],"spatialReferences")],Q.prototype,"writeSpatialReferences",null),e([g({type:i.ofType(B),json:{write:{target:"layers",overridePolicy(e,t,r){if(z(this.allSublayers,r))return{ignoreOrigin:!0}}}}})],Q.prototype,"sublayers",void 0),e([v(["web-document","portal-item"],"sublayers",["layers","visibleLayers"])],Q.prototype,"readSublayersFromItemOrMap",null),e([v("service","sublayers",["layers"])],Q.prototype,"readSublayers",null),e([x("sublayers",{layers:{type:[B]},visibleLayers:{type:[String]}})],Q.prototype,"writeSublayers",null),e([g({json:{read:!1},readOnly:!0,value:"wms"})],Q.prototype,"type",void 0),e([g($)],Q.prototype,"url",void 0),e([g({type:String,json:{write:{ignoreOrigin:!0}}})],Q.prototype,"version",void 0),Q=e([w("esri.layers.WMSLayer")],Q);const X=Q;export{X as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../config.js";import r from"../Graphic.js";import o from"../PopupTemplate.js";import s from"../request.js";import i from"../core/Collection.js";import a from"../core/CollectionFlattener.js";import{JSONMap as n}from"../core/jsonMap.js";import{clone as l}from"../core/lang.js";import{MultiOriginJSONMixin as p}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as m}from"../core/promiseUtils.js";import{on as u,watch as c,sync as f}from"../core/reactiveUtils.js";import{urlToObject as y,addQueryParameters as d,addProxy as h,Url as g}from"../core/urlUtils.js";import{property as b}from"../core/accessorSupport/decorators/property.js";import{Integer as w}from"../core/accessorSupport/ensureType.js";import{reader as v}from"../core/accessorSupport/decorators/reader.js";import{subclass as x}from"../core/accessorSupport/decorators/subclass.js";import{writer as j}from"../core/accessorSupport/decorators/writer.js";import{willPropertyWrite as I}from"../core/accessorSupport/write.js";import S from"../geometry/Extent.js";import F from"../geometry/SpatialReference.js";import{getScale as P}from"../geometry/support/scaleUtils.js";import{equals as R}from"../geometry/support/spatialReferenceUtils.js";import E from"./Layer.js";import{BlendLayer as O}from"./mixins/BlendLayer.js";import{OperationalLayer as L}from"./mixins/OperationalLayer.js";import{PortalLayer as U}from"./mixins/PortalLayer.js";import{RefreshableLayer as M}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as T}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as _}from"./mixins/TemporalLayer.js";import{isAxesOrderReversedForWkid as $}from"./ogc/crsUtils.js";import{isWmsServer as C}from"./support/arcgisLayerUrl.js";import{legendEnabled as W,url as q}from"./support/commonProperties.js";import{ExportWMSImageParameters as N}from"./support/ExportWMSImageParameters.js";import{createBitmap as B}from"./support/imageBitmapUtils.js";import H from"./support/WMSSublayer.js";import{normalizeWKID as k,toISOString as G,getPopupLayers as A,parseCapabilities as D}from"./support/wmsUtils.js";const J=new n({bmp:"image/bmp",gif:"image/gif",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml"},{ignoreUnknown:!1});function V(e){return"text/html"===e}function z(e){return"text/plain"===e}let Q=class extends(O(_(M(T(L(U(p(E)))))))){constructor(...e){super(...e),this.allSublayers=new a({getCollections:()=>[this.sublayers],getChildrenFunction:e=>e.sublayers}),this.customParameters=null,this.customLayerParameters=null,this.copyright=null,this.description=null,this.dimensions=null,this.fullExtent=null,this.fullExtents=null,this.featureInfoFormats=null,this.featureInfoUrl=null,this.fetchFeatureInfoFunction=null,this.imageFormat=null,this.imageMaxHeight=2048,this.imageMaxWidth=2048,this.imageTransparency=!0,this.legendEnabled=!0,this.mapUrl=null,this.isReference=null,this.operationalLayerType="WMS",this.spatialReference=null,this.spatialReferences=null,this.sublayers=null,this.type="wms",this.version=null,this.addHandles([u((()=>this.sublayers),"after-add",(({item:e})=>{e.parent=e.layer=this}),f),u((()=>this.sublayers),"after-remove",(({item:e})=>{e.layer=e.parent=null}),f),c((()=>this.sublayers),((e,t)=>{if(t)for(const r of t)r.layer=r.parent=null;if(e)for(const r of e)r.parent=r.layer=this}),f)])}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}destroy(){this.allSublayers.destroy()}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["WMS"]},e).catch(m).then((()=>this._fetchService(t)))),Promise.resolve(this)}readFullExtentFromItemOrMap(e,t){const r=t.extent;return r?new S({xmin:r[0][0],ymin:r[0][1],xmax:r[1][0],ymax:r[1][1]}):null}writeFullExtent(e,t){t.extent=[[e.xmin,e.ymin],[e.xmax,e.ymax]]}get featureInfoFormat(){return null==this.featureInfoFormats?null:this.featureInfoFormats.find(V)??this.featureInfoFormats.find(z)??null}set featureInfoFormat(e){null==e?(this.revert("featureInfoFormat","service"),this._clearOverride("featureInfoFormat")):(V(e)||z(e))&&this._override("featureInfoFormat",e)}readImageFormat(e,t){const r=t.supportedImageFormatTypes;return r&&r.includes("image/png")?"image/png":r&&r[0]}readSpatialReferenceFromItemOrDocument(e,t){return new F(t.spatialReferences[0])}writeSpatialReferences(e,t){const r=this.spatialReference?.wkid;e&&r?(t.spatialReferences=e.filter((e=>e!==r)),t.spatialReferences.unshift(r)):t.spatialReferences=e}readSublayersFromItemOrMap(e,t,r){return X(t.layers,r,t.visibleLayers)}readSublayers(e,t,r){return X(t.layers,r)}writeSublayers(e,t,r,o){t.layers=[];const s=new Map,i=e.flatten((({sublayers:e})=>e??[]));for(const a of i)if("number"==typeof a.parent?.id){const e=s.get(a.parent.id);null!=e?e.push(a.id):s.set(a.parent.id,[a.id])}for(const a of i){const e={sublayer:a,...o},r=a.write({parentLayerId:"number"==typeof a.parent?.id?a.parent.id:-1},e);if(s.has(a.id)&&(r.sublayerIds=s.get(a.id)),!a.sublayers&&a.name){const r=a.write({},e);delete r.id,t.layers.push(r)}}t.visibleLayers=i.filter((({visible:e,sublayers:t})=>e&&!t)).map((({name:e})=>e)).toArray()}set url(e){if(!e)return void this._set("url",e);const{path:t,query:r}=y(e);for(const s in r)/^(request|service)$/i.test(s)&&delete r[s];const o=d(t,r??{});this._set("url",o)}createExportImageParameters(e,t,r,o){const s=o?.pixelRatio??1,i=P({extent:e,width:t})*s,a=new N({layer:this,scale:i}),{xmin:n,ymin:l,xmax:p,ymax:m,spatialReference:u}=e,c=k(u,this.spatialReferences),f="1.3.0"===this.version&&$(c)?`${l},${n},${m},${p}`:`${n},${l},${p},${m}`,y=a.toJSON();return{bbox:f,["1.3.0"===this.version?"crs":"srs"]:null==c||isNaN(c)?void 0:"EPSG:"+c,...y}}async fetchImage(e,t,r,o){const i=this.mapUrl,a=this.createExportImageParameters(e,t,r,o);if(!a.layers){const e=document.createElement("canvas");return e.width=t,e.height=r,e}const n=o?.timeExtent?.start,l=o?.timeExtent?.end,p=null!=n&&null!=l?n.getTime()===l.getTime()?G(n):`${G(n)}/${G(l)}`:void 0,m={responseType:"image",query:this._mixCustomParameters({width:t,height:r,...a,time:p,...this.refreshParameters}),signal:o?.signal};return s(i??"",m).then((e=>e.data))}async fetchImageBitmap(e,t,r,o){const i=this.mapUrl??"",a=this.createExportImageParameters(e,t,r,o);if(!a.layers){const e=document.createElement("canvas");return e.width=t,e.height=r,e}const n=o?.timeExtent?.start,l=o?.timeExtent?.end,p=null!=n&&null!=l?n.getTime()===l.getTime()?G(n):`${G(n)}/${G(l)}`:void 0,m={responseType:"blob",query:this._mixCustomParameters({width:t,height:r,...a,time:p,...this.refreshParameters}),signal:o?.signal},{data:u}=await s(i,m);return B(u,i,o?.signal)}fetchFeatureInfo(e,t,r,o,s){const i=P({extent:e,width:t}),a=new N({layer:this,scale:i}),n=A(a.visibleSublayers);if(null==this.featureInfoUrl||null==n)return Promise.resolve([]);if(null==this.fetchFeatureInfoFunction&&null==this.featureInfoFormat)return Promise.resolve([]);const l="1.3.0"===this.version?{I:o,J:s}:{x:o,y:s},p={query_layers:n,request:"GetFeatureInfo",info_format:this.featureInfoFormat,feature_count:25,width:t,height:r,...l},m={...this.createExportImageParameters(e,t,r),...p},u=this._mixCustomParameters(m);return null!=this.fetchFeatureInfoFunction?this.fetchFeatureInfoFunction(u):this._defaultFetchFeatureInfoFunction(d(this.featureInfoUrl,u))}findSublayerById(e){return this.allSublayers.find((t=>t.id===e))}findSublayerByName(e){return this.allSublayers.find((t=>t.name===e))}serviceSupportsSpatialReference(e){return C(this.url)||null!=this.spatialReferences&&this.spatialReferences.some((t=>{const r=900913===t?F.WebMercator:new F({wkid:t});return R(r,e)}))}_defaultFetchFeatureInfoFunction(e){const t=document.createElement("iframe");t.src=h(e),t.style.border="none",t.style.margin="0",t.style.width="100%",t.setAttribute("sandbox","");const s=new o({title:this.title,content:t}),i=new r({sourceLayer:this,popupTemplate:s});return Promise.resolve([i])}async _fetchService(e){if(!this.resourceInfo&&this.parsedUrl?.path){const{path:t,query:r}=this.parsedUrl,{data:o}=await s(t,{query:{SERVICE:"WMS",REQUEST:"GetCapabilities",...r,...this.customParameters},responseType:"xml",signal:e});this.resourceInfo=D(o)}if(this.parsedUrl){const e=new g(this.parsedUrl.path),{httpsDomains:r}=t.request;"https"!==e.scheme||e.port&&"443"!==e.port||!e.host||r.includes(e.host)||r.push(e.host)}this.read(this.resourceInfo,{origin:"service"})}_mixCustomParameters(e){if(!this.customLayerParameters&&!this.customParameters)return e;const t={...this.customParameters,...this.customLayerParameters};for(const r in t)e[r.toLowerCase()]=t[r];return e}};function K(e,t){return e.some((e=>{for(const r in e)if(I(e,r,null,t))return!0;return!1}))}function X(e,t,r){e=e??[];const o=new Map;e.every((e=>null==e.id))&&(e=l(e)).forEach(((e,t)=>e.id=t));for(const i of e){const e=new H;e.read(i,t),r&&!r.includes(e.name)&&(e.visible=!1),o.set(e.id,e)}const s=[];for(const a of e){const e=null!=a.id?o.get(a.id):null;if(e)if(null!=a.parentLayerId&&a.parentLayerId>=0){const t=o.get(a.parentLayerId);if(!t)continue;t.sublayers||(t.sublayers=new i),t.sublayers.push(e)}else s.push(e)}return s}e([b({readOnly:!0})],Q.prototype,"allSublayers",void 0),e([b({json:{type:Object,write:!0}})],Q.prototype,"customParameters",void 0),e([b({json:{type:Object,write:!0}})],Q.prototype,"customLayerParameters",void 0),e([b({type:String,json:{write:!0}})],Q.prototype,"copyright",void 0),e([b()],Q.prototype,"description",void 0),e([b({readOnly:!0})],Q.prototype,"dimensions",void 0),e([b({json:{type:[[Number]],read:{source:"extent"},write:{target:"extent"},origins:{"web-document":{write:{ignoreOrigin:!0}},"portal-item":{write:{ignoreOrigin:!0}}}}})],Q.prototype,"fullExtent",void 0),e([v(["web-document","portal-item"],"fullExtent",["extent"])],Q.prototype,"readFullExtentFromItemOrMap",null),e([j(["web-document","portal-item"],"fullExtent",{extent:{type:[[Number]]}})],Q.prototype,"writeFullExtent",null),e([b()],Q.prototype,"fullExtents",void 0),e([b({type:String,json:{write:{ignoreOrigin:!0}}})],Q.prototype,"featureInfoFormat",null),e([b({type:[String],readOnly:!0})],Q.prototype,"featureInfoFormats",void 0),e([b({type:String,json:{write:{ignoreOrigin:!0}}})],Q.prototype,"featureInfoUrl",void 0),e([b()],Q.prototype,"fetchFeatureInfoFunction",void 0),e([b({type:String,json:{origins:{"web-document":{default:"image/png",type:J.jsonValues,read:{reader:J.read,source:"format"},write:{writer:J.write,target:"format"}}}}})],Q.prototype,"imageFormat",void 0),e([v("imageFormat",["supportedImageFormatTypes"])],Q.prototype,"readImageFormat",null),e([b({type:Number,json:{read:{source:"maxHeight"},write:{target:"maxHeight"}}})],Q.prototype,"imageMaxHeight",void 0),e([b({type:Number,json:{read:{source:"maxWidth"},write:{target:"maxWidth"}}})],Q.prototype,"imageMaxWidth",void 0),e([b()],Q.prototype,"imageTransparency",void 0),e([b(W)],Q.prototype,"legendEnabled",void 0),e([b({type:["show","hide","hide-children"]})],Q.prototype,"listMode",void 0),e([b({type:String,json:{write:{ignoreOrigin:!0}}})],Q.prototype,"mapUrl",void 0),e([b({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],Q.prototype,"isReference",void 0),e([b({type:["WMS"]})],Q.prototype,"operationalLayerType",void 0),e([b()],Q.prototype,"resourceInfo",void 0),e([b({type:F,json:{origins:{service:{read:{source:"extent.spatialReference"}}},write:!1}})],Q.prototype,"spatialReference",void 0),e([v(["web-document","portal-item"],"spatialReference",["spatialReferences"])],Q.prototype,"readSpatialReferenceFromItemOrDocument",null),e([b({type:[w],json:{read:!1,origins:{service:{read:!0},"web-document":{read:!1,write:{ignoreOrigin:!0}},"portal-item":{read:!1,write:{ignoreOrigin:!0}}}}})],Q.prototype,"spatialReferences",void 0),e([j(["web-document","portal-item"],"spatialReferences")],Q.prototype,"writeSpatialReferences",null),e([b({type:i.ofType(H),json:{write:{target:"layers",overridePolicy(e,t,r){if(K(this.allSublayers,r))return{ignoreOrigin:!0}}}}})],Q.prototype,"sublayers",void 0),e([v(["web-document","portal-item"],"sublayers",["layers","visibleLayers"])],Q.prototype,"readSublayersFromItemOrMap",null),e([v("service","sublayers",["layers"])],Q.prototype,"readSublayers",null),e([j("sublayers",{layers:{type:[H]},visibleLayers:{type:[String]}})],Q.prototype,"writeSublayers",null),e([b({json:{read:!1},readOnly:!0,value:"wms"})],Q.prototype,"type",void 0),e([b(q)],Q.prototype,"url",null),e([b({type:String,json:{write:{ignoreOrigin:!0}}})],Q.prototype,"version",void 0),Q=e([x("esri.layers.WMSLayer")],Q);const Y=Q;export{Y as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{PositionHint as e,indexOf as t}from"../../../core/arrayUtils.js";import i from"../../../core/Error.js";import{clone as s}from"../../../core/lang.js";import{removeMaybe as r,destroyMaybe as a}from"../../../core/maybe.js";import{MemCacheStorage as n,MemCache as u}from"../../../core/MemCache.js";import{throwIfAborted as o}from"../../../core/promiseUtils.js";import{getMetersPerUnitForSR as l}from"../../../core/unitUtils.js";import{set as c,NEGATIVE_INFINITY as h,create as m,expandWithAABB as p}from"../../../geometry/support/aaBoundingBox.js";import{fromValues as f,create as d}from"../../../geometry/support/aaBoundingRect.js";import{getBoundsXY as y}from"../../../geometry/support/boundsUtils.js";import{fromJSON as g,isExtent as _,isPolygon as x}from"../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridian as w}from"../../../geometry/support/normalizeUtils.js";import{equals as S,isValid as F}from"../../../geometry/support/spatialReferenceUtils.js";import{convertFromGeometry as R}from"../featureConversionUtils.js";import{getWhereClause as Q,validateFields as I,validateWhere as j,validateHaving as E,hasInvalidFieldType as A}from"./attributeSupport.js";import{checkProjectionSupport as b,project as P,projectMany as T}from"./projectionSupport.js";import{queryCapabilities as B}from"./QueryEngineCapabilities.js";import{QueryEngineResult as C}from"./QueryEngineResult.js";import{getSpatialQueryOperator as k,canQueryWithRBush as v,checkSpatialQuerySupport as q}from"./spatialQuerySupport.js";import{getTimeExtent as z,getTimeOperator as O}from"./timeSupport.js";import{QUERY_ENGINE_EMPTY_RESULT as G,cleanFromGeometryEngine as M,normalizeQuery as U,getGeometry as Z}from"./utils.js";import N from"../../support/FieldsIndex.js";import{loadArcade as H}from"../../../support/arcadeOnDemand.js";import{noBudget as D}from"../../../views/support/Scheduler.js";function L(e){return null!=e&&e.every((e=>"exceedslimit"!==e.statisticType))}const V="feature-store:unsupported-query";class J{constructor(e,t=null,i,s,r){this.attributes=e,this.geometry=i,this.centroid=s,this.filterFlags=r,this.groupId=-1,this.displayId=t}}const W=new n(2e6);let $=0;class K{constructor(e){this._geometryQueryCache=null,this._changeHandle=null,this.capabilities={query:B},this.geometryType=e.geometryType,this.hasM=!!e.hasM,this.hasZ=!!e.hasZ,this.objectIdField=e.objectIdField,this.spatialReference=e.spatialReference,this.definitionExpression=e.definitionExpression,this.featureStore=e.featureStore,this.aggregateAdapter=e.aggregateAdapter,this._changeHandle=this.featureStore.events.on("changed",(()=>this.clearCache())),this.timeInfo=e.timeInfo,e.cacheSpatialQueries&&(this._geometryQueryCache=new u($+++"$$",W)),this.fieldsIndex=new N(e.fields),e.scheduler&&e.priority&&(this._frameTask=e.scheduler.registerTask(e.priority))}destroy(){this._frameTask=r(this._frameTask),this.clearCache(),a(this._geometryQueryCache),this._changeHandle=r(this._changeHandle),a(this.fieldsIndex)}get featureAdapter(){return this.featureStore.featureAdapter}clearCache(){this._geometryQueryCache?.clear(),this._allFeaturesPromise=null,this._timeExtentPromise=null}async executeQuery(e,t){try{return(await this._executeQuery(e,{},t)).createQueryResponse()}catch(i){if(i!==G)throw i;return new C([],e,this).createQueryResponse()}}async executeQueryForCount(e={},t){try{return(await this._executeQuery(e,{returnGeometry:!1,returnCentroid:!1,outSR:null},t)).createQueryResponseForCount()}catch(i){if(i!==G)throw i;return 0}}async executeQueryForExtent(e,t){const i=e.outSR;try{const s=await this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null},t),r=s.size;if(!r)return{count:0,extent:null};return{count:r,extent:await this._getBounds(s.items,s.spatialReference,i||this.spatialReference)}}catch(s){if(s===G)return{count:0,extent:null};throw s}}async executeQueryForIds(e,t){return this.executeQueryForIdSet(e,t).then((e=>Array.from(e)))}async executeQueryForIdSet(e,t){try{const i=await this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null},t),s=i.items,r=new Set;return await this._reschedule((()=>{for(const e of s)r.add(i.featureAdapter.getObjectId(e))}),t),r}catch(i){if(i===G)return new Set;throw i}}async executeQueryForSnapping(e,t){const{point:i,distance:s,returnEdge:r,returnVertex:a}=e;if(!r&&!a)return{candidates:[]};const n=await this._reschedule((()=>this._checkQuerySupport(e.query)),t),u=!S(i.spatialReference,this.spatialReference);u&&await b(i.spatialReference,this.spatialReference);const o="number"==typeof s?s:s.x,l="number"==typeof s?s:s.y,c={xmin:i.x-o,xmax:i.x+o,ymin:i.y-l,ymax:i.y+l,spatialReference:i.spatialReference},h=u?P(c,this.spatialReference):c;if(!h)return{candidates:[]};const m=(await w(g(i),null,{signal:t}))[0],p=(await w(g(h),null,{signal:t}))[0];if(null==m||null==p)return{candidates:[]};const f=new C(await this._reschedule((()=>this._searchFeatures(this._getQueryBBoxes(p.toJSON()))),t),n,this);await this._reschedule((()=>this._executeObjectIdsQuery(f)),t),await this._reschedule((()=>this._executeTimeQuery(f)),t),await this._reschedule((()=>this._executeAttributesQuery(f)),t);const d=m.toJSON(),y=u?P(d,this.spatialReference):d,_=u?Math.max(h.xmax-h.xmin,h.ymax-h.ymin)/2:s;return f.createSnappingResponse({...e,point:y,distance:_},i.spatialReference)}async executeQueryForLatestObservations(e,t){if(!this.timeInfo||!this.timeInfo.trackIdField)throw new i(V,"Missing timeInfo or timeInfo.trackIdField",{query:e,timeInfo:this.timeInfo});try{const i=await this._executeQuery(e,{},t);return await this._reschedule((()=>this._filterLatest(i)),t),i.createQueryResponse()}catch(s){if(s!==G)throw s;return new C([],e,this).createQueryResponse()}}async executeQueryForSummaryStatistics(e={},t,i){const{field:s,normalizationField:r,valueExpression:a}=t;return(await this._getQueryEngineResultForStats(e,{field:s,normalizationField:r,valueExpression:a},i)).createSummaryStatisticsResponse(t)}async executeQueryForUniqueValues(e={},t,i){const{field:s,field2:r,field3:a,valueExpression:n}=t;return(await this._getQueryEngineResultForStats(e,{field:s,field2:r,field3:a,valueExpression:n},i)).createUniqueValuesResponse(t)}async executeQueryForClassBreaks(e={},t,i){const{field:s,normalizationField:r,valueExpression:a}=t;return(await this._getQueryEngineResultForStats(e,{field:s,normalizationField:r,valueExpression:a},i)).createClassBreaksResponse(t)}async executeQueryForHistogram(e={},t,i){const{field:s,normalizationField:r,valueExpression:a}=t;return(await this._getQueryEngineResultForStats(e,{field:s,normalizationField:r,valueExpression:a},i)).createHistogramResponse(t)}async fetchRecomputedExtents(e){const[t,i]=await Promise.all(["getFullExtent"in this.featureStore&&this.featureStore.getFullExtent?Promise.resolve(this.featureStore.getFullExtent(this.spatialReference)):this._getBounds(await this._getAllFeatures(),this.spatialReference,this.spatialReference),null!=this._timeExtentPromise?this._timeExtentPromise:this._timeExtentPromise=z(this.timeInfo,this.featureStore)]);return o(e),{fullExtent:t,timeExtent:i}}async _getBounds(e,t,i){const s=c(m(),h);await this.featureStore.forEachBounds(e,(e=>p(s,e)));const r={xmin:s[0],ymin:s[1],xmax:s[3],ymax:s[4],spatialReference:M(this.spatialReference)};this.hasZ&&isFinite(s[2])&&isFinite(s[5])&&(r.zmin=s[2],r.zmax=s[5]);const a=P(r,t,i);if(a.spatialReference=M(i),a.xmax-a.xmin==0){const e=l(a.spatialReference);a.xmin-=e,a.xmax+=e}if(a.ymax-a.ymin==0){const e=l(a.spatialReference);a.ymin-=e,a.ymax+=e}if(this.hasZ&&null!=a.zmin&&null!=a.zmax&&a.zmax-a.zmin==0){const e=l(a.spatialReference);a.zmin-=e,a.zmax+=e}return a}async _schedule(e,t){return null!=this._frameTask?this._frameTask.schedule(e,t):e(D)}async _reschedule(e,t){return null!=this._frameTask?this._frameTask.reschedule(e,t):e(D)}async _getAllFeaturesQueryEngineResult(e){return new C(await this._getAllFeatures(),e,this)}async _getAllFeatures(){if(null==this._allFeaturesPromise){const e=[];this._allFeaturesPromise=(async()=>{await this.featureStore.forEach((t=>e.push(t)))})().then((()=>e))}const e=this._allFeaturesPromise,t=await e;return e===this._allFeaturesPromise?t.slice():this._getAllFeatures()}async _executeQuery(e,t,i){e=s(e),e=await this._schedule((()=>U(e,this.definitionExpression,this.spatialReference)),i),e=await this._reschedule((()=>this._checkQuerySupport(e)),i),e={...e,...t};const r=await this._reschedule((()=>this._executeSceneFilterQuery(e,i)),i),a=await this._reschedule((()=>this._executeGeometryQuery(e,r,i)),i);return await this._reschedule((()=>this._executeAggregateIdsQuery(a)),i),await this._reschedule((()=>this._executeObjectIdsQuery(a)),i),await this._reschedule((()=>this._executeTimeQuery(a)),i),await this._reschedule((()=>this._executeAttributesQuery(a)),i),a}async _executeSceneFilterQuery(e,t){if(null==e.sceneFilter)return null;const{outSR:i,returnGeometry:s,returnCentroid:r}=e,a=this.featureStore.featureSpatialReference,n=e.sceneFilter.geometry,u=null==a||S(a,n.spatialReference)?n:P(n,a);if(!u)return null;const o=s||r,l=F(i)&&!S(this.spatialReference,i)&&o?async e=>this._project(e,i):e=>e,c=this.featureAdapter,h=await this._reschedule((()=>this._searchFeatures(this._getQueryBBoxes(u))),t);if("disjoint"===e.sceneFilter.spatialRelationship){if(!h.length)return null;const i=new Set;for(const e of h)i.add(c.getObjectId(e));const s=await this._reschedule((()=>this._getAllFeatures()),t),r=await this._reschedule((async()=>{const r=await k("esriSpatialRelDisjoint",u,this.geometryType,this.hasZ,this.hasM),a=e=>!i.has(c.getObjectId(e))||r(c.getGeometry(e)),n=await this._runSpatialFilter(s,a,t);return new C(n,e,this)}),t);return l(r)}if(!h.length)return new C([],e,this);if(this._canExecuteSinglePass(u,e))return l(new C(h,e,this));const m=await k("esriSpatialRelContains",u,this.geometryType,this.hasZ,this.hasM),p=await this._runSpatialFilter(h,(e=>m(c.getGeometry(e))),t);return l(new C(p,e,this))}async _executeGeometryQuery(i,s,r){if(null!=s&&0===s.items.length)return s;i=null!=s?s.query:i;const{geometry:a,outSR:n,spatialRel:u,returnGeometry:o,returnCentroid:l}=i,c=this.featureStore.featureSpatialReference,h=!a||null==c||S(c,a.spatialReference)?a:P(a,c),m=o||l,p=F(n)&&!S(this.spatialReference,n),f=this._geometryQueryCache&&null==s?p&&m?JSON.stringify({originalFilterGeometry:a,spatialRelationship:u,outSpatialReference:n}):JSON.stringify({originalFilterGeometry:a,spatialRelationship:u}):null,d=f?this._geometryQueryCache.get(f):null;if(null!=d)return new C(d,i,this);const y=async e=>(p&&m&&await this._project(e,n),f&&this._geometryQueryCache.put(f,e.items,e.items.length+1),e);if(!h)return y(null!=s?s:await this._getAllFeaturesQueryEngineResult(i));const g=this.featureAdapter;let _=await this._reschedule((()=>this._searchFeatures(this._getQueryBBoxes(a))),r);if("esriSpatialRelDisjoint"===u){if(!_.length)return y(null!=s?s:await this._getAllFeaturesQueryEngineResult(i));const e=new Set;for(const i of _)e.add(g.getObjectId(i));const t=null!=s?s.items:await this._reschedule((()=>this._getAllFeatures()),r),a=await this._reschedule((async()=>{const s=await k(u,h,this.geometryType,this.hasZ,this.hasM),a=t=>!e.has(g.getObjectId(t))||s(g.getGeometry(t)),n=await this._runSpatialFilter(t,a,r);return new C(n,i,this)}),r);return y(a)}if(null!=s){const i=new e;_=_.filter((e=>t(s.items,e,s.items.length,i)>=0))}if(!_.length){const e=new C([],i,this);return f&&this._geometryQueryCache.put(f,e.items,1),e}if(this._canExecuteSinglePass(h,i))return y(new C(_,i,this));const x=await k(u,h,this.geometryType,this.hasZ,this.hasM),w=await this._runSpatialFilter(_,(e=>x(g.getGeometry(e))),r);return y(new C(w,i,this))}_executeAggregateIdsQuery(e){if(0===e.items.length||!e.query.aggregateIds||!e.query.aggregateIds.length||null==this.aggregateAdapter)return;const t=new Set;for(const s of e.query.aggregateIds){this.aggregateAdapter.getFeatureObjectIds(s).forEach((e=>t.add(e)))}const i=this.featureAdapter.getObjectId;e.items=e.items.filter((e=>t.has(i(e))))}_executeObjectIdsQuery(e){if(0===e.items.length||!e.query.objectIds||!e.query.objectIds.length)return;const t=new Set(e.query.objectIds),i=this.featureAdapter.getObjectId;e.items=e.items.filter((e=>t.has(i(e))))}_executeTimeQuery(e){if(0===e.items.length)return;const t=O(this.timeInfo,e.query.timeExtent,this.featureAdapter);null!=t&&(e.items=e.items.filter(t))}_executeAttributesQuery(e){if(0===e.items.length)return;const t=Q(e.query.where,this.fieldsIndex);if(t){if(!t.isStandardized)throw new TypeError("Where clause is not standardized");e.items=e.items.filter((e=>t.testFeature(e,this.featureAdapter)))}}async _runSpatialFilter(e,t,i){if(!t)return e;if(null==this._frameTask)return e.filter((e=>t(e)));let s=0;const r=new Array,a=async n=>{for(;s<e.length;){const u=e[s++];t(u)&&(r.push(u),n.madeProgress()),n.done&&await this._reschedule((e=>a(e)),i)}};return this._reschedule((e=>a(e)),i).then((()=>r))}_filterLatest(e){const{trackIdField:t,startTimeField:i,endTimeField:s}=this.timeInfo,r=s||i,a=new Map,n=this.featureAdapter.getAttribute;for(const u of e.items){const e=n(u,t),i=n(u,r),s=a.get(e);(!s||i>n(s,r))&&a.set(e,u)}e.items=Array.from(a.values())}_canExecuteSinglePass(e,t){const{spatialRel:i}=t;return v(e)&&("esriSpatialRelEnvelopeIntersects"===i||"esriGeometryPoint"===this.geometryType&&("esriSpatialRelIntersects"===i||"esriSpatialRelContains"===i||"esriSpatialRelWithin"===i))}async _project(e,t){if(!t||S(this.spatialReference,t))return e;const i=this.featureAdapter,s=await T(e.items.map((e=>Z(this.geometryType,this.hasZ,this.hasM,i.getGeometry(e)))),this.spatialReference,t);return e.items=s.map(((t,s)=>i.cloneWithGeometry(e.items[s],R(t,this.hasZ,this.hasM)))),e}_getQueryBBoxes(e){if(v(e)){if(_(e))return[f(e.xmin,e.ymin,e.xmax,e.ymax)];if(x(e))return e.rings.map((e=>f(Math.min(e[0][0],e[2][0]),Math.min(e[0][1],e[2][1]),Math.max(e[0][0],e[2][0]),Math.max(e[0][1],e[2][1]))))}return[y(d(),e)]}async _searchFeatures(e){const t=new Set;await Promise.all(e.map((e=>this.featureStore.forEachInBounds(e,(e=>t.add(e))))));const i=Array.from(t.values());return t.clear(),i}async _checkStatisticsSupport(e,t){if((e.distance??0)<0||null!=e.geometryPrecision||e.multipatchOption||e.pixelSize||e.relationParam||e.text||e.outStatistics||e.groupByFieldsForStatistics||e.having||e.orderByFields)throw new i(V,"Unsupported query options",{query:e});return this._checkAttributesQuerySupport(e),Promise.all([this._checkStatisticsParamsSupport(t),q(e,this.geometryType,this.spatialReference),b(this.spatialReference,e.outSR)]).then((()=>e))}async _checkStatisticsParamsSupport(e){let t=[];if(e.valueExpression){const{arcadeUtils:i}=await H();t=i.extractFieldNames(e.valueExpression)}if(e.field&&t.push(e.field),e.field2&&t.push(e.field2),e.field3&&t.push(e.field3),e.normalizationField&&t.push(e.normalizationField),!t.length&&!e.valueExpression)throw new i(V,"params should have at least a field or valueExpression",{params:e});I(this.fieldsIndex,t,"params contains missing fields")}async _checkQuerySupport(e){if((e.distance??0)<0||null!=e.geometryPrecision||e.multipatchOption||e.pixelSize||e.relationParam||e.text)throw new i(V,"Unsupported query options",{query:e});return this._checkAttributesQuerySupport(e),this._checkStatisticsQuerySupport(e),Promise.all([q(e,this.geometryType,this.spatialReference),b(this.spatialReference,e.outSR)]).then((()=>e))}_checkAttributesQuerySupport(e){const{outFields:t,orderByFields:s,returnDistinctValues:r,outStatistics:a}=e,n=a?a.map((e=>e.outStatisticFieldName&&e.outStatisticFieldName.toLowerCase())).filter(Boolean):[];if(s&&s.length>0){const e=" asc",t=" desc",i=s.map((i=>{const s=i.toLowerCase();return s.includes(e)?s.split(e)[0]:s.includes(t)?s.split(t)[0]:i})).filter((e=>!n.includes(e)));I(this.fieldsIndex,i,"orderByFields contains missing fields")}if(t&&t.length>0)I(this.fieldsIndex,t,"outFields contains missing fields");else if(r)throw new i(V,"outFields should be specified for returnDistinctValues",{query:e});j(this.fieldsIndex,e.where)}_checkStatisticsQuerySupport(e){const{outStatistics:t,groupByFieldsForStatistics:s,having:r}=e,a=s&&s.length,n=t&&t.length;if(r){if(!a||!n)throw new i(V,"outStatistics and groupByFieldsForStatistics should be specified with having",{query:e});E(this.fieldsIndex,r,t)}if(n){if(!L(t))return;const r=t.map((e=>e.onStatisticField)).filter(Boolean);I(this.fieldsIndex,r,"onStatisticFields contains missing fields"),a&&I(this.fieldsIndex,s,"groupByFieldsForStatistics contains missing fields");for(const s of t){const{onStatisticField:t,statisticType:r}=s;if(("percentile_disc"===r||"percentile_cont"===r)&&"statisticParameters"in s){const{statisticParameters:t}=s;if(!t)throw new i(V,"statisticParamters should be set for percentile type",{definition:s,query:e})}else if("count"!==r&&t&&A(t,this.fieldsIndex))throw new i(V,"outStatistics contains non-numeric fields",{definition:s,query:e})}}}async _getQueryEngineResultForStats(e,t,i){e=s(e);try{e=await this._schedule((()=>U(e,this.definitionExpression,this.spatialReference)),i),e=await this._reschedule((()=>this._checkStatisticsSupport(e,t)),i);const s=await this._reschedule((()=>this._executeSceneFilterQuery(e,i)),i),r=await this._reschedule((()=>this._executeGeometryQuery(e,s,i)),i);return await this._reschedule((()=>this._executeAggregateIdsQuery(r)),i),await this._reschedule((()=>this._executeObjectIdsQuery(r)),i),await this._reschedule((()=>this._executeTimeQuery(r)),i),await this._reschedule((()=>this._executeAttributesQuery(r)),i),r}catch(r){if(r!==G)throw r;return new C([],e,this)}}}export{J as Feature,K as QueryEngine};
5
+ import{PositionHint as e,indexOf as t}from"../../../core/arrayUtils.js";import i from"../../../core/Error.js";import{clone as s}from"../../../core/lang.js";import{removeMaybe as r,destroyMaybe as a}from"../../../core/maybe.js";import{MemCacheStorage as n,MemCache as u}from"../../../core/MemCache.js";import{throwIfAborted as o}from"../../../core/promiseUtils.js";import{getMetersPerUnitForSR as l}from"../../../core/unitUtils.js";import{set as c,NEGATIVE_INFINITY as h,create as p,expandWithAABB as m}from"../../../geometry/support/aaBoundingBox.js";import{fromValues as f,create as d}from"../../../geometry/support/aaBoundingRect.js";import{getBoundsXY as y}from"../../../geometry/support/boundsUtils.js";import{fromJSON as g,isExtent as _,isPolygon as x}from"../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridian as w}from"../../../geometry/support/normalizeUtils.js";import{equals as S,isValid as F}from"../../../geometry/support/spatialReferenceUtils.js";import{convertFromGeometry as R}from"../featureConversionUtils.js";import{getWhereClause as Q,validateFields as I,validateFieldTypes as j,validateWhere as E,validateHaving as A,validNumericTypesKebabDict as b,validDateTypesKebabDict as C,hasInvalidFieldType as P}from"./attributeSupport.js";import{checkProjectionSupport as T,project as B,projectMany as k}from"./projectionSupport.js";import{queryCapabilities as q}from"./QueryEngineCapabilities.js";import{QueryEngineResult as v}from"./QueryEngineResult.js";import{getSpatialQueryOperator as z,canQueryWithRBush as O,checkSpatialQuerySupport as G}from"./spatialQuerySupport.js";import{getTimeExtent as M,getTimeOperator as U}from"./timeSupport.js";import{QUERY_ENGINE_EMPTY_RESULT as N,cleanFromGeometryEngine as Z,normalizeQuery as V,getGeometry as H}from"./utils.js";import L from"../../support/FieldsIndex.js";import{loadArcade as D}from"../../../support/arcadeOnDemand.js";import{noBudget as J}from"../../../views/support/Scheduler.js";function W(e){return null!=e&&e.every((e=>"exceedslimit"!==e.statisticType))}const $="feature-store:unsupported-query";class K{constructor(e,t=null,i,s,r){this.attributes=e,this.geometry=i,this.centroid=s,this.filterFlags=r,this.groupId=-1,this.displayId=t}}const X=new n(2e6);let Y=0;class ee{constructor(e){this._geometryQueryCache=null,this._changeHandle=null,this.capabilities={query:q},this.geometryType=e.geometryType,this.hasM=!!e.hasM,this.hasZ=!!e.hasZ,this.objectIdField=e.objectIdField,this.spatialReference=e.spatialReference,this.definitionExpression=e.definitionExpression,this.featureStore=e.featureStore,this.aggregateAdapter=e.aggregateAdapter,this._changeHandle=this.featureStore.events.on("changed",(()=>this.clearCache())),this.timeInfo=e.timeInfo,e.cacheSpatialQueries&&(this._geometryQueryCache=new u(Y+++"$$",X)),this.fieldsIndex=new L(e.fields),e.scheduler&&e.priority&&(this._frameTask=e.scheduler.registerTask(e.priority))}destroy(){this._frameTask=r(this._frameTask),this.clearCache(),a(this._geometryQueryCache),this._changeHandle=r(this._changeHandle),a(this.fieldsIndex)}get featureAdapter(){return this.featureStore.featureAdapter}clearCache(){this._geometryQueryCache?.clear(),this._allFeaturesPromise=null,this._timeExtentPromise=null}async executeQuery(e,t){try{return(await this._executeQuery(e,{},t)).createQueryResponse()}catch(i){if(i!==N)throw i;return new v([],e,this).createQueryResponse()}}async executeQueryForCount(e={},t){try{return(await this._executeQuery(e,{returnGeometry:!1,returnCentroid:!1,outSR:null},t)).createQueryResponseForCount()}catch(i){if(i!==N)throw i;return 0}}async executeQueryForExtent(e,t){const i=e.outSR;try{const s=await this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null},t),r=s.size;if(!r)return{count:0,extent:null};return{count:r,extent:await this._getBounds(s.items,s.spatialReference,i||this.spatialReference)}}catch(s){if(s===N)return{count:0,extent:null};throw s}}async executeQueryForIds(e,t){return this.executeQueryForIdSet(e,t).then((e=>Array.from(e)))}async executeQueryForIdSet(e,t){try{const i=await this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null},t),s=i.items,r=new Set;return await this._reschedule((()=>{for(const e of s)r.add(i.featureAdapter.getObjectId(e))}),t),r}catch(i){if(i===N)return new Set;throw i}}async executeQueryForSnapping(e,t){const{point:i,distance:s,returnEdge:r,returnVertex:a}=e;if(!r&&!a)return{candidates:[]};const n=await this._reschedule((()=>this._checkQuerySupport(e.query)),t),u=!S(i.spatialReference,this.spatialReference);u&&await T(i.spatialReference,this.spatialReference);const o="number"==typeof s?s:s.x,l="number"==typeof s?s:s.y,c={xmin:i.x-o,xmax:i.x+o,ymin:i.y-l,ymax:i.y+l,spatialReference:i.spatialReference},h=u?B(c,this.spatialReference):c;if(!h)return{candidates:[]};const p=(await w(g(i),null,{signal:t}))[0],m=(await w(g(h),null,{signal:t}))[0];if(null==p||null==m)return{candidates:[]};const f=new v(await this._reschedule((()=>this._searchFeatures(this._getQueryBBoxes(m.toJSON()))),t),n,this);await this._reschedule((()=>this._executeObjectIdsQuery(f)),t),await this._reschedule((()=>this._executeTimeQuery(f)),t),await this._reschedule((()=>this._executeAttributesQuery(f)),t);const d=p.toJSON(),y=u?B(d,this.spatialReference):d,_=u?Math.max(h.xmax-h.xmin,h.ymax-h.ymin)/2:s;return f.createSnappingResponse({...e,point:y,distance:_},i.spatialReference)}async executeQueryForLatestObservations(e,t){if(!this.timeInfo||!this.timeInfo.trackIdField)throw new i($,"Missing timeInfo or timeInfo.trackIdField",{query:e,timeInfo:this.timeInfo});try{const i=await this._executeQuery(e,{},t);return await this._reschedule((()=>this._filterLatest(i)),t),i.createQueryResponse()}catch(s){if(s!==N)throw s;return new v([],e,this).createQueryResponse()}}async executeQueryForSummaryStatistics(e={},t,i){const{field:s,normalizationField:r,valueExpression:a}=t;return(await this._getQueryEngineResultForStats(e,{field:s,normalizationField:r,valueExpression:a},i)).createSummaryStatisticsResponse(t)}async executeQueryForUniqueValues(e={},t,i){const{field:s,field2:r,field3:a,valueExpression:n}=t;return(await this._getQueryEngineResultForStats(e,{field:s,field2:r,field3:a,valueExpression:n},i)).createUniqueValuesResponse(t)}async executeQueryForClassBreaks(e={},t,i){const{field:s,normalizationField:r,valueExpression:a}=t;return(await this._getQueryEngineResultForStats(e,{field:s,normalizationField:r,valueExpression:a},i)).createClassBreaksResponse(t)}async executeQueryForHistogram(e={},t,i){const{field:s,normalizationField:r,valueExpression:a}=t;return(await this._getQueryEngineResultForStats(e,{field:s,normalizationField:r,valueExpression:a},i)).createHistogramResponse(t)}async fetchRecomputedExtents(e){const[t,i]=await Promise.all(["getFullExtent"in this.featureStore&&this.featureStore.getFullExtent?Promise.resolve(this.featureStore.getFullExtent(this.spatialReference)):this._getBounds(await this._getAllFeatures(),this.spatialReference,this.spatialReference),null!=this._timeExtentPromise?this._timeExtentPromise:this._timeExtentPromise=M(this.timeInfo,this.featureStore)]);return o(e),{fullExtent:t,timeExtent:i}}async _getBounds(e,t,i){const s=c(p(),h);await this.featureStore.forEachBounds(e,(e=>m(s,e)));const r={xmin:s[0],ymin:s[1],xmax:s[3],ymax:s[4],spatialReference:Z(this.spatialReference)};this.hasZ&&isFinite(s[2])&&isFinite(s[5])&&(r.zmin=s[2],r.zmax=s[5]);const a=B(r,t,i);if(a.spatialReference=Z(i),a.xmax-a.xmin==0){const e=l(a.spatialReference);a.xmin-=e,a.xmax+=e}if(a.ymax-a.ymin==0){const e=l(a.spatialReference);a.ymin-=e,a.ymax+=e}if(this.hasZ&&null!=a.zmin&&null!=a.zmax&&a.zmax-a.zmin==0){const e=l(a.spatialReference);a.zmin-=e,a.zmax+=e}return a}async _schedule(e,t){return null!=this._frameTask?this._frameTask.schedule(e,t):e(J)}async _reschedule(e,t){return null!=this._frameTask?this._frameTask.reschedule(e,t):e(J)}async _getAllFeaturesQueryEngineResult(e){return new v(await this._getAllFeatures(),e,this)}async _getAllFeatures(){if(null==this._allFeaturesPromise){const e=[];this._allFeaturesPromise=(async()=>{await this.featureStore.forEach((t=>e.push(t)))})().then((()=>e))}const e=this._allFeaturesPromise,t=await e;return e===this._allFeaturesPromise?t.slice():this._getAllFeatures()}async _executeQuery(e,t,i){e=s(e),e=await this._schedule((()=>V(e,this.definitionExpression,this.spatialReference)),i),e=await this._reschedule((()=>this._checkQuerySupport(e)),i),e={...e,...t};const r=await this._reschedule((()=>this._executeSceneFilterQuery(e,i)),i),a=await this._reschedule((()=>this._executeGeometryQuery(e,r,i)),i);return await this._reschedule((()=>this._executeAggregateIdsQuery(a)),i),await this._reschedule((()=>this._executeObjectIdsQuery(a)),i),await this._reschedule((()=>this._executeTimeQuery(a)),i),await this._reschedule((()=>this._executeAttributesQuery(a)),i),a}async _executeSceneFilterQuery(e,t){if(null==e.sceneFilter)return null;const{outSR:i,returnGeometry:s,returnCentroid:r}=e,a=this.featureStore.featureSpatialReference,n=e.sceneFilter.geometry,u=null==a||S(a,n.spatialReference)?n:B(n,a);if(!u)return null;const o=s||r,l=F(i)&&!S(this.spatialReference,i)&&o?async e=>this._project(e,i):e=>e,c=this.featureAdapter,h=await this._reschedule((()=>this._searchFeatures(this._getQueryBBoxes(u))),t);if("disjoint"===e.sceneFilter.spatialRelationship){if(!h.length)return null;const i=new Set;for(const e of h)i.add(c.getObjectId(e));const s=await this._reschedule((()=>this._getAllFeatures()),t),r=await this._reschedule((async()=>{const r=await z("esriSpatialRelDisjoint",u,this.geometryType,this.hasZ,this.hasM),a=e=>!i.has(c.getObjectId(e))||r(c.getGeometry(e)),n=await this._runSpatialFilter(s,a,t);return new v(n,e,this)}),t);return l(r)}if(!h.length)return new v([],e,this);if(this._canExecuteSinglePass(u,e))return l(new v(h,e,this));const p=await z("esriSpatialRelContains",u,this.geometryType,this.hasZ,this.hasM),m=await this._runSpatialFilter(h,(e=>p(c.getGeometry(e))),t);return l(new v(m,e,this))}async _executeGeometryQuery(i,s,r){if(null!=s&&0===s.items.length)return s;i=null!=s?s.query:i;const{geometry:a,outSR:n,spatialRel:u,returnGeometry:o,returnCentroid:l}=i,c=this.featureStore.featureSpatialReference,h=!a||null==c||S(c,a.spatialReference)?a:B(a,c),p=o||l,m=F(n)&&!S(this.spatialReference,n),f=this._geometryQueryCache&&null==s?m&&p?JSON.stringify({originalFilterGeometry:a,spatialRelationship:u,outSpatialReference:n}):JSON.stringify({originalFilterGeometry:a,spatialRelationship:u}):null,d=f?this._geometryQueryCache.get(f):null;if(null!=d)return new v(d,i,this);const y=async e=>(m&&p&&await this._project(e,n),f&&this._geometryQueryCache.put(f,e.items,e.items.length+1),e);if(!h)return y(null!=s?s:await this._getAllFeaturesQueryEngineResult(i));const g=this.featureAdapter;let _=await this._reschedule((()=>this._searchFeatures(this._getQueryBBoxes(a))),r);if("esriSpatialRelDisjoint"===u){if(!_.length)return y(null!=s?s:await this._getAllFeaturesQueryEngineResult(i));const e=new Set;for(const i of _)e.add(g.getObjectId(i));const t=null!=s?s.items:await this._reschedule((()=>this._getAllFeatures()),r),a=await this._reschedule((async()=>{const s=await z(u,h,this.geometryType,this.hasZ,this.hasM),a=t=>!e.has(g.getObjectId(t))||s(g.getGeometry(t)),n=await this._runSpatialFilter(t,a,r);return new v(n,i,this)}),r);return y(a)}if(null!=s){const i=new e;_=_.filter((e=>t(s.items,e,s.items.length,i)>=0))}if(!_.length){const e=new v([],i,this);return f&&this._geometryQueryCache.put(f,e.items,1),e}if(this._canExecuteSinglePass(h,i))return y(new v(_,i,this));const x=await z(u,h,this.geometryType,this.hasZ,this.hasM),w=await this._runSpatialFilter(_,(e=>x(g.getGeometry(e))),r);return y(new v(w,i,this))}_executeAggregateIdsQuery(e){if(0===e.items.length||!e.query.aggregateIds||!e.query.aggregateIds.length||null==this.aggregateAdapter)return;const t=new Set;for(const s of e.query.aggregateIds){this.aggregateAdapter.getFeatureObjectIds(s).forEach((e=>t.add(e)))}const i=this.featureAdapter.getObjectId;e.items=e.items.filter((e=>t.has(i(e))))}_executeObjectIdsQuery(e){if(0===e.items.length||!e.query.objectIds||!e.query.objectIds.length)return;const t=new Set(e.query.objectIds),i=this.featureAdapter.getObjectId;e.items=e.items.filter((e=>t.has(i(e))))}_executeTimeQuery(e){if(0===e.items.length)return;const t=U(this.timeInfo,e.query.timeExtent,this.featureAdapter);null!=t&&(e.items=e.items.filter(t))}_executeAttributesQuery(e){if(0===e.items.length)return;const t=Q(e.query.where,this.fieldsIndex);if(t){if(!t.isStandardized)throw new TypeError("Where clause is not standardized");e.items=e.items.filter((e=>t.testFeature(e,this.featureAdapter)))}}async _runSpatialFilter(e,t,i){if(!t)return e;if(null==this._frameTask)return e.filter((e=>t(e)));let s=0;const r=new Array,a=async n=>{for(;s<e.length;){const u=e[s++];t(u)&&(r.push(u),n.madeProgress()),n.done&&await this._reschedule((e=>a(e)),i)}};return this._reschedule((e=>a(e)),i).then((()=>r))}_filterLatest(e){const{trackIdField:t,startTimeField:i,endTimeField:s}=this.timeInfo,r=s||i,a=new Map,n=this.featureAdapter.getAttribute;for(const u of e.items){const e=n(u,t),i=n(u,r),s=a.get(e);(!s||i>n(s,r))&&a.set(e,u)}e.items=Array.from(a.values())}_canExecuteSinglePass(e,t){const{spatialRel:i}=t;return O(e)&&("esriSpatialRelEnvelopeIntersects"===i||"esriGeometryPoint"===this.geometryType&&("esriSpatialRelIntersects"===i||"esriSpatialRelContains"===i||"esriSpatialRelWithin"===i))}async _project(e,t){if(!t||S(this.spatialReference,t))return e;const i=this.featureAdapter,s=await k(e.items.map((e=>H(this.geometryType,this.hasZ,this.hasM,i.getGeometry(e)))),this.spatialReference,t);return e.items=s.map(((t,s)=>i.cloneWithGeometry(e.items[s],R(t,this.hasZ,this.hasM)))),e}_getQueryBBoxes(e){if(O(e)){if(_(e))return[f(e.xmin,e.ymin,e.xmax,e.ymax)];if(x(e))return e.rings.map((e=>f(Math.min(e[0][0],e[2][0]),Math.min(e[0][1],e[2][1]),Math.max(e[0][0],e[2][0]),Math.max(e[0][1],e[2][1]))))}return[y(d(),e)]}async _searchFeatures(e){const t=new Set;await Promise.all(e.map((e=>this.featureStore.forEachInBounds(e,(e=>t.add(e))))));const i=Array.from(t.values());return t.clear(),i}async _checkStatisticsSupport(e,t){if((e.distance??0)<0||null!=e.geometryPrecision||e.multipatchOption||e.pixelSize||e.relationParam||e.text||e.outStatistics||e.groupByFieldsForStatistics||e.having||e.orderByFields)throw new i($,"Unsupported query options",{query:e});return this._checkAttributesQuerySupport(e),Promise.all([this._checkStatisticsParamsSupport(t),G(e,this.geometryType,this.spatialReference),T(this.spatialReference,e.outSR)]).then((()=>e))}async _checkStatisticsParamsSupport(e){let t=[];if(e.valueExpression){const{arcadeUtils:i}=await D();t=i.extractFieldNames(e.valueExpression)}if(e.field&&t.push(e.field),e.field2&&t.push(e.field2),e.field3&&t.push(e.field3),e.normalizationField&&t.push(e.normalizationField),!t.length&&!e.valueExpression)throw new i($,"field or valueExpression is required",{params:e});I(this.fieldsIndex,t,{errorMessage:"Cannot calculate statistics for missing fields"}),j(this.fieldsIndex,t,{expressionName:"statistics"})}async _checkQuerySupport(e){if((e.distance??0)<0||null!=e.geometryPrecision||e.multipatchOption||e.pixelSize||e.relationParam||e.text)throw new i($,"Unsupported query options",{query:e});return this._checkAttributesQuerySupport(e),this._checkStatisticsQuerySupport(e),Promise.all([G(e,this.geometryType,this.spatialReference),T(this.spatialReference,e.outSR)]).then((()=>e))}_checkAttributesQuerySupport(e){const{outFields:t,orderByFields:s,returnDistinctValues:r,outStatistics:a}=e,n=a?a.map((e=>e.outStatisticFieldName&&e.outStatisticFieldName.toLowerCase())).filter(Boolean):[];if(s&&s.length>0){const e=" asc",t=" desc",i=s.map((i=>{const s=i.toLowerCase();return s.includes(e)?s.split(e)[0]:s.includes(t)?s.split(t)[0]:i})).filter((e=>!n.includes(e)));I(this.fieldsIndex,i,{expressionName:"orderByFields"})}if(t&&t.length>0)I(this.fieldsIndex,t,{expressionName:"outFields"});else if(r)throw new i($,"outFields should be specified for returnDistinctValues",{query:e});E(this.fieldsIndex,e.where)}_checkStatisticsQuerySupport(e){const{outStatistics:t,groupByFieldsForStatistics:s,having:r}=e,a=s&&s.length,n=t&&t.length;if(r){if(!a||!n)throw new i($,"outStatistics and groupByFieldsForStatistics should be specified with having",{query:e});A(this.fieldsIndex,r,t)}if(n){if(!W(t))return;const r=t.map((e=>e.onStatisticField)).filter(Boolean);I(this.fieldsIndex,r,{expressionName:"onStatisticFields"}),a&&I(this.fieldsIndex,s,{expressionName:"groupByFieldsForStatistics"});const n=new Set([...b.jsonValues,...C.jsonValues]),u=new Intl.ListFormat("en-US",{type:"conjunction"}).format([...b.apiValues,...C.apiValues]);for(const s of t){const{onStatisticField:t,statisticType:r}=s;if(("percentile_disc"===r||"percentile_cont"===r)&&"statisticParameters"in s){const{statisticParameters:t}=s;if(!t)throw new i($,"statisticParamters should be set for percentile type",{definition:s,query:e})}else if("count"!==r&&t&&P(t,this.fieldsIndex,n))throw new i($,`outStatistics only supports ${u} field types`,{definition:s,query:e})}}}async _getQueryEngineResultForStats(e,t,i){e=s(e);try{e=await this._schedule((()=>V(e,this.definitionExpression,this.spatialReference)),i),e=await this._reschedule((()=>this._checkStatisticsSupport(e,t)),i);const s=await this._reschedule((()=>this._executeSceneFilterQuery(e,i)),i),r=await this._reschedule((()=>this._executeGeometryQuery(e,s,i)),i);return await this._reschedule((()=>this._executeAggregateIdsQuery(r)),i),await this._reschedule((()=>this._executeObjectIdsQuery(r)),i),await this._reschedule((()=>this._executeTimeQuery(r)),i),await this._reschedule((()=>this._executeAttributesQuery(r)),i),r}catch(r){if(r!==N)throw r;return new v([],e,this)}}}export{K as Feature,ee as QueryEngine};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../core/Error.js";import{WhereClauseCache as i}from"../../../core/sql/WhereClauseCache.js";const n=new i(50,500),s="feature-store:unsupported-query",t=" as ",r=new Set(["esriFieldTypeOID","esriFieldTypeSmallInteger","esriFieldTypeInteger","esriFieldTypeSingle","esriFieldTypeDouble","esriFieldTypeLong","esriFieldTypeDate"]);function o(i,t){if(!t)return!0;const r=n.get(t,i);if(!r)throw new e(s,"invalid SQL expression",{where:t});if(!r.isStandardized)throw new e(s,"where clause is not standard",{where:t});return c(i,r.fieldNames,"where clause contains missing fields"),!0}function a(i,t,r){if(!t)return!0;const o=n.get(t,i);if(!o)throw new e(s,"invalid SQL expression",{having:t});if(!o.isAggregate)throw new e(s,"having does not contain a valid aggregate function",{having:t});const a=o.fieldNames;c(i,a,"having contains missing fields");if(!o.getExpressions().every((e=>{const{aggregateType:n,field:s}=e,t=i.get(s)?.name;return r.some((e=>{const{onStatisticField:s,statisticType:r}=e,o=i.get(s)?.name;return o===t&&r.toLowerCase().trim()===n}))})))throw new e(s,"expressions in having should also exist in outStatistics",{having:t});return!0}function l(e,i){return e?n.get(e,i):null}function c(i,n,t,r=!0){const o=[];for(const u of n)if("*"!==u&&!i.has(u))if(r){const n=d(u);try{const t=l(n,i);if(!t)throw new e(s,"invalid SQL expression",{where:n});if(!t.isStandardized)throw new e(s,"expression is not standard",{clause:t});c(i,t.fieldNames,"expression contains missing fields")}catch(a){const e=a?.details;if(e&&(e.clause||e.where))throw a;e?.missingFields?o.push(...e.missingFields):o.push(u)}}else o.push(u);if(o.length)throw new e(s,t,{missingFields:o})}function d(e){return e.split(t)[0]}function u(e){return e.split(t)[1]}function f(e,i){const n=i.get(e);return!!n&&!r.has(n.type)}export{u as getAliasFromFieldName,d as getExpressionFromFieldName,l as getWhereClause,f as hasInvalidFieldType,c as validateFields,a as validateHaving,o as validateWhere};
5
+ import e from"../../../core/Error.js";import{JSONMap as s}from"../../../core/jsonMap.js";import{WhereClauseCache as n}from"../../../core/sql/WhereClauseCache.js";const i=new n(50,500),r="feature-store:unsupported-query",t=" as ",o=new s({esriFieldTypeString:"string"}),a=new s({esriFieldTypeOID:"oid",esriFieldTypeSmallInteger:"small-integer",esriFieldTypeInteger:"integer",esriFieldTypeSingle:"single",esriFieldTypeDouble:"double",esriFieldTypeLong:"long"}),l=new s({esriFieldTypeDate:"date"}),p=new Set([...a.jsonValues,...l.jsonValues,...o.jsonValues]),d=new Intl.ListFormat("en-US",{type:"conjunction"}).format([...a.apiValues,...l.apiValues,...o.apiValues]);function u(s,n,i={}){const t=f(s,n);if(!t)throw new e(r,"invalid SQL expression",{expression:s});const o=i.expressionName||"expression";if(i.validateStandardized&&!t.isStandardized)throw new e(r,`${o} is not standard`,{expression:s});if(i.validateAggregate&&!t.isAggregate)throw new e(r,`${o} does not contain a valid aggregate function`,{expression:s});return t.fieldNames}function g(e,s){if(!s)return!0;const n="where clause",i=u(s,e,{validateStandardized:!0,expressionName:n});return m(e,i,{expressionName:n}),x(e,i,{expressionName:n}),!0}function c(s,n,t){if(!n)return!0;const o="having",a=u(n,s,{validateAggregate:!0,expressionName:o});m(s,a,{expressionName:o}),x(s,a,{expressionName:o});const l=i.get(n,s),p=l?.getExpressions().every((e=>{const{aggregateType:n,field:i}=e,r=s.get(i)?.name;return t.some((e=>{const{onStatisticField:i,statisticType:t}=e,o=s.get(i)?.name;return o===r&&t.toLowerCase().trim()===n}))}));if(!p)throw new e(r,"expressions in having should also exist in outStatistics",{having:n});return!0}function f(e,s){return e?i.get(e,s):null}function m(e,s,n={}){n.errorMessage||(n.errorMessage=n.expressionName?`${n.expressionName} contains invalid fields`:"Fields are invalid"),h(e,s,((e,s)=>s.has(e)),n)}function x(e,s,n={}){n.errorMessage||(n.errorMessage=n.expressionName?`${n.expressionName} only supports ${d} field types`:`Only ${d} field types are supported`),h(e,s,((e,s)=>!v(e,s)),n)}function h(s,n,i,t={}){const o=t.verifyExpression??!0,a=[];for(const e of n){const n=i(e,s);if("*"!==e&&!n)if(o){const n=y(e);try{h(s,u(n,s,{validateStandardized:!0}),i,t)}catch(l){const s=l?.details;if(s?.expression)throw l;s?.invalidFields?a.push(...s.invalidFields):a.push(e)}}else a.push(e)}if(a.length)throw new e(r,t.errorMessage,{invalidFields:a})}function y(e){return e.split(t)[0]}function w(e){return e.split(t)[1]}function v(e,s,n=p){const i=s.get(e);return!!i&&!n.has(i.type)}export{w as getAliasFromFieldName,y as getExpressionFromFieldName,f as getWhereClause,v as hasInvalidFieldType,l as validDateTypesKebabDict,a as validNumericTypesKebabDict,x as validateFieldTypes,m as validateFields,c as validateHaving,g as validateWhere};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import{rasterRendererTypes as r,websceneRasterRendererTypes as i,read as s}from"../../rasterRenderers.js";import n from"../../request.js";import{deprecatedProperty as o}from"../../core/deprecate.js";import a from"../../core/Error.js";import{strict as l}from"../../core/jsonMap.js";import{clone as u}from"../../core/lang.js";import p from"../../core/Logger.js";import{watch as c}from"../../core/reactiveUtils.js";import{urlToObject as m}from"../../core/urlUtils.js";import{property as d,ensureRange as h}from"../../core/accessorSupport/decorators/property.js";import{Integer as f,ensureClass as y,ensureNumber as g}from"../../core/accessorSupport/ensureType.js";import{reader as R}from"../../core/accessorSupport/decorators/reader.js";import{subclass as b}from"../../core/accessorSupport/decorators/subclass.js";import{writer as S}from"../../core/accessorSupport/decorators/writer.js";import{opacity as v,url as x}from"../support/commonProperties.js";import I from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as w}from"../support/ExportImageServiceParameters.js";import F from"../support/Field.js";import _ from"../support/FieldsIndex.js";import{createBitmap as D}from"../support/imageBitmapUtils.js";import{isSupportedRendererType as j}from"../support/imageryRendererUtils.js";import P from"../support/MosaicRule.js";import T from"../support/MultidimensionalSubset.js";import O from"../support/PixelBlock.js";import{interpolationKebab as N,noDataInterpretationKebab as C}from"../support/rasterEnums.js";import M from"../support/RasterFunction.js";import A from"../support/RasterInfo.js";import J from"../support/RasterJobHandler.js";import{intersectMultimensionalSubset as q,getSubsetVariablesFromMdInfo as E,getDefaultMultidimensionalDefinition as V}from"../support/rasterDatasets/multidimensionalUtils.js";import{decode as H,getFormat as Q}from"../support/rasterFormats/RasterCodec.js";import{uvComponentToVector as U}from"../support/rasterFunctions/vectorFieldUtils.js";import{getSupportedRendererTypes as L,getDefaultBandCombination as z,createDefaultRenderer as B,normalizeRendererJSON as k}from"../../renderers/support/rasterRendererHelper.js";import G from"../../renderers/support/RasterSymbolizer.js";import{computeAngles as W,computePixelSpaceLocations as $,computeHistograms as K,computeStatisticsHistograms as X,measureHeight as Y,measureAreaAndPerimeter as Z,measureDistanceAndAngle as ee,measurePointOrCentroid as te,getImageSpatialReferenceQueryParameter as re,getSamples as ie,identify as se}from"../../rest/imageService.js";import"../../core/has.js";import"../support/source/DataLayerSource.js";import{executeQueryJSON as ne}from"../../rest/query/executeQueryJSON.js";import"../../config.js";import"../../kernel.js";import"../../core/unitUtils.js";import"../../geometry/support/spatialReferenceUtils.js";import"../graphics/featureConversionUtils.js";import oe from"../../geometry/Extent.js";import"../../geometry/Geometry.js";import"../../geometry/Multipoint.js";import"../../geometry/Point.js";import ae from"../../geometry/Polygon.js";import"../../geometry/Polyline.js";import"../../geometry/support/normalizeUtils.js";import"../../core/pbf.js";import le from"../../rest/support/FeatureSet.js";import ue from"../../rest/support/Query.js";import"../../rest/query/support/AttachmentInfo.js";import"../../rest/support/AttachmentQuery.js";import{executeForCount as pe}from"../../rest/query/executeForCount.js";import{executeForIds as ce}from"../../rest/query/executeForIds.js";import"../../rest/support/RelationshipQuery.js";import"../../rest/support/TopFeaturesQuery.js";import{fetchServiceRasterInfo as me,generateRasterInfo as de}from"../../rest/imageService/fetchRasterInfo.js";import{getCatalogItemRasterInfo as he}from"../../rest/imageService/getCatalogItemRasterInfo.js";import fe from"../../rest/support/ImageAngleParameters.js";import ye from"../../rest/support/ImageAreaParameters.js";import ge from"../../rest/support/ImageDistanceParameters.js";import Re from"../../rest/support/ImageHeightParameters.js";import be from"../../rest/support/ImageHistogramParameters.js";import Se from"../../rest/support/ImageIdentifyParameters.js";import ve from"../../rest/support/ImagePixelLocationParameters.js";import xe from"../../rest/support/ImagePointParameters.js";import Ie from"../../rest/support/ImageSampleParameters.js";import{createFlowMesh as we}from"../../views/2d/engine/flow/dataUtils.js";import Fe from"../../geometry/SpatialReference.js";const _e=l()({U1:"u1",U2:"u2",U4:"u4",U8:"u8",S8:"s8",U16:"u16",S16:"s16",U32:"u32",S32:"s32",F32:"f32",F64:"f64",C64:"c64",C128:"c128",UNKNOWN:"unknown"}),De=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),je=h(g,{min:0,max:255});function Pe(e){if(!e)return null;const t=JSON.stringify(e).match(/"rasterFunction":"(.*?")/gi),r=t?.map((e=>e.replace('"rasterFunction":"',"").replace('"',"")));return r?r.join("/"):null}const Te=l=>{let h=class extends l{constructor(){super(...arguments),this._functionRasterInfos={},this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this._cachedRendererJson=null,this._serviceSupportsMosaicRule=null,this._rasterAttributeTableFieldPrefix="Raster.",this.adjustAspectRatio=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.defaultMosaicRule=null,this.definitionExpression=null,this.exportImageServiceParameters=null,this.rasterInfo=null,this.fields=null,this.fullExtent=null,this.hasMultidimensions=!1,this.imageMaxHeight=4100,this.imageMaxWidth=4100,this.interpolation=void 0,this.minScale=0,this.maxScale=0,this.multidimensionalInfo=null,this.multidimensionalSubset=null,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelFilter=null,this.raster=void 0,this.sourceType=null,this.viewId=void 0,this.symbolizer=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=void 0}initialize(){this._set("exportImageServiceParameters",new w({layer:this}))}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get _rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.length<1||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.forEach((t=>{e.set(t.name.toLowerCase().replaceAll(/ /gi,"_"),t.name)})),e}readBandIds(e,t){if(Array.isArray(e)&&e.length>0&&e.every((e=>"number"==typeof e)))return e}readCapabilities(e,t){return this._readCapabilities(t)}writeCompressionQuality(e,t,r){null!=e&&"lerc"!==this.format&&(t[r]=e)}writeCompressionTolerance(e,t,r){"lerc"===this.format&&null!=e&&(t[r]=e)}readDefaultMosaicRule(e,t){return this._serviceSupportsMosaicRule?P.fromJSON(t):null}get fieldsIndex(){return this.fields?new _(this.fields):null}set format(e){e&&De.has(e.toLowerCase())&&this._set("format",e.toLowerCase())}readFormat(e,t){return"esriImageServiceDataTypeVector-UV"===t.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===t.serviceDataType||null!=this.pixelFilter?"lerc":"jpgpng"}readMinScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}readMaxScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}set mosaicRule(e){let t=e;t&&t.mosaicMethod&&(t=P.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const r=e||t.mosaicRule;return r?P.fromJSON(r):this._isMosaicRuleSupported(t)?P.fromJSON(t):null}writeMosaicRule(e,t,r){let i=this.mosaicRule;const s=this.definitionExpression;i?s&&s!==i.where&&(i=i.clone(),i.where=s):s&&(i=new P({where:s})),this._isValidCustomizedMosaicRule(i)&&(t[r]=i.toJSON())}writeNoData(e,t,r){null!=e&&"number"==typeof e&&(t[r]=je(e))}readObjectIdField(e,t){if(!e){const r=t.fields.filter((e=>"esriFieldTypeOID"===e.type||"oid"===e.type));e=r&&r[0]&&r[0].name}return e}get parsedUrl(){return m(this.url)}readSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}set renderer(e){this.loaded&&(e=this._configRenderer(e)),this._set("renderer",e)}readRenderer(e,t,r){const i=t?.layerDefinition?.drawingInfo?.renderer,n=s(i,r);return null==n?null:("vector-field"===n.type&&t.symbolTileSize&&!i.symbolTileSize&&(n.symbolTileSize=t.symbolTileSize),j(n)||p.getLogger(this).warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),n)}writeRenderer(e,t,r){t.layerDefinition=t.layerDefinition||{},t.layerDefinition.drawingInfo=t.layerDefinition.drawingInfo||{},t.layerDefinition.drawingInfo.renderer=e.toJSON(),"vector-field"===e.type&&(t.symbolTileSize=e.symbolTileSize)}get rasterFields(){const e=this._rasterAttributeTableFieldPrefix||"Raster.",t=new F({name:"Raster.ItemPixelValue",alias:"Item Pixel Value",domain:null,editable:!1,length:50,type:"string"}),r=new F({name:"Raster.ServicePixelValue",alias:"Service Pixel Value",domain:null,editable:!1,length:50,type:"string"}),i=new F({name:"Raster.ServicePixelValue.Raw",alias:"Raw Service Pixel Value",domain:null,editable:!1,length:50,type:"string"});let s=this.fields?u(this.fields):[];s.push(r),this.capabilities?.operations.supportsQuery&&this.fields&&this.fields.length>0&&s.push(t),this.version>=10.4&&null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.some((e=>"none"===e.name.toLowerCase()))&&s.push(i),null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.filter((e=>"none"!==e.name.toLowerCase())).forEach((e=>{s.push(new F({name:"Raster.ServicePixelValue."+e.name,alias:e.name,domain:null,editable:!1,length:50,type:"string"}))})),this._isVectorDataSet()&&(s.push(new F({name:"Raster.Magnitude",alias:"Magnitude",domain:null,editable:!1,type:"double"})),s.push(new F({name:"Raster.Direction",alias:"Direction",domain:null,editable:!1,type:"double"})));const{attributeTable:n}=this.rasterInfo??{};if(null!=n){const t=n.fields.filter((e=>"esriFieldTypeOID"!==e.type&&"value"!==e.name.toLowerCase())).map((t=>{const r=u(t);return r.name=e+t.name,r}));s=s.concat(t)}return s}get renderingRule(){return o(p.getLogger(this),"renderingRule",{replacement:"rasterFunction",version:"4.27",warnOnce:!0}),this._get("rasterFunction")}set renderingRule(e){o(p.getLogger(this),"renderingRule",{replacement:"rasterFunction",version:"4.27",warnOnce:!0}),this._set("rasterFunction",e)}set rasterFunction(e){let t=e;t&&t.rasterFunction&&(t=M.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("rasterFunction",t)}readRasterFunction(e,t){const r=t.rasterFunctionInfos;return t.renderingRule||r&&r.length&&"None"!==r[0].name?this._isRFTJson(t.renderingRule)?M.fromJSON({rasterFunctionDefinition:t.renderingRule}):M.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}writeRasterFunction(e,t,r){const i=e.toJSON();i.rasterFunctionDefinition?t.renderingRule=i.rasterFunctionDefinition:t.renderingRule=i}readSpatialReference(e,t){const r=e||t.extent.spatialReference;return r?Fe.fromJSON(r):null}readPixelType(e){return _e.fromJSON(e)||e}writePixelType(e,t,r){null!=this.serviceRasterInfo&&this.pixelType===this.serviceRasterInfo.pixelType||(t[r]=_e.toJSON(e))}readVersion(e,t){let r=t.currentVersion;return r||(r=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),r}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let r=e;const{renderer:i,symbolizer:s,pixelFilter:n,bandIds:o}=this;if(!this._isPicture()&&i&&s&&!n){const n=JSON.stringify(this._cachedRendererJson)!==JSON.stringify(i.toJSON()),a=this._rasterJobHandler.instance;if(a){n&&(s.bind(),await a.updateSymbolizer(s,t),this._cachedRendererJson=i.toJSON());const l=await a.symbolize({bandIds:o,...e},t);r={extent:e.extent,pixelBlock:l}}else r={extent:e.extent,pixelBlock:s.symbolize({bandIds:o,...e})}}return r}destroy(){this._shutdownJobHandler()}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}async computeAngles(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeAngles)throw new a("imagery-layer:compute-angles","this operation is not supported on the input image service");return e=y(fe,e).clone(),W(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputePixelLocation)throw new a("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=y(ve,e).clone(),$(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeHistograms)throw new a("imagery-layer:compute-histograms","this operation is not supported on the input image service");return e=y(be,e).clone(),this._applyMosaicAndRenderingRules(e),K(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeStatisticsHistograms)throw new a("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");return e=y(be,e).clone(),this._applyMosaicAndRenderingRules(e),X(this.url,e,this._getRequestOptions(t))}async measureHeight(e,t){const r=await this._fetchCapabilities(t?.signal);if(!("base-and-top"===e.operationType?r.mensuration.supportsHeightFromBaseAndTop:"base-and-top-shadow"===e.operationType?r.mensuration.supportsHeightFromBaseAndTopShadow:r.mensuration.supportsHeightFromTopAndTopShadow))throw new a("imagery-layer:measure-height","this operation is not supported on the input image service");return e=y(Re,e).clone(),this._applyMosaicAndRenderingRules(e),Y(this.url,e,this._getRequestOptions(t))}async measureAreaAndPerimeter(e,t){const r=await this._fetchCapabilities(t?.signal);if(!(r.mensuration.supportsAreaAndPerimeter&&(!e.is3D||r.mensuration.supports3D)))throw new a("imagery-layer:measure-area-and-perimeter","this operation is not supported on the input image service");return e=y(ye,e).clone(),this._applyMosaicAndRenderingRules(e),Z(this.url,e,this._getRequestOptions(t))}async measureDistanceAndAngle(e,t){const r=await this._fetchCapabilities(t?.signal);if(!(r.mensuration.supportsDistanceAndAngle&&(!e.is3D||r.mensuration.supports3D)))throw new a("imagery-layer:measure-distance-and-angle","this operation is not supported on the input image service");return e=y(ge,e).clone(),this._applyMosaicAndRenderingRules(e),ee(this.url,e,this._getRequestOptions(t))}async measurePointOrCentroid(e,t){const r=await this._fetchCapabilities(t?.signal);if(!(r.mensuration.supportsPointOrCentroid&&(!e.is3D||r.mensuration.supports3D)))throw new a("imagery-layer:measure-point-or-centroid","this operation is not supported on the input image service");return e=y(xe,e).clone(),this._applyMosaicAndRenderingRules(e),te(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return null!=t?t.get(e):void 0}getFieldDomain(e,t){const r=this.getField(e);return r?r.domain:null}async fetchImage(e,t,r,i={}){if(null==e||null==t||null==r)throw new a("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required.");if(this.renderer||this.symbolizer){const e=await this.generateRasterInfo(this.rasterFunction,{signal:i.signal});e&&(this.rasterInfo=e)}const s=this.getExportImageServiceParameters(e,t,r,i.timeExtent);if(null==s){if(i.requestAsImageElement&&this._canRequestImageElement(this.format)){const e=document.createElement("canvas");if(e.width=t,e.height=r,i.returnImageBitmap){return{imageBitmap:await D(e,`${g(this.parsedUrl)}/exportImage`,i.signal)}}return{imageOrCanvasElement:e}}const{bandIds:s,rasterInfo:n}=this,o=(s?.length||n.bandCount)??0,a=t*r,l=n.pixelType,u=[];for(let e=0;e<o;e++)u.push(O.createEmptyBand(l,a));return{pixelData:{pixelBlock:new O({width:t,height:r,pixels:u,mask:new Uint8Array(a),pixelType:l}),extent:e}}}const n=!!i.requestAsImageElement&&!this.pixelFilter,o=n&&!!i.returnImageBitmap,l={imageServiceParameters:s,imageProps:{extent:e,width:t,height:r,format:this.format},requestAsImageElement:n,returnImageBitmap:o,signal:i.signal};return this._requestArrayBuffer(l)}fetchKeyProperties(e){return n(g(this.parsedUrl)+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then((e=>e.data))}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new a("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):n(g(this.parsedUrl)+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then((e=>le.fromJSON(e.data)))}getCatalogItemRasterInfo(e,t){const r={...t,query:this._getQueryParams()};return he(g(this.parsedUrl),e,r)}async getCatalogItemICSInfo(e,t){const{data:r}=await n(g(this.parsedUrl)+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),i=r&&r.ics;if(!i)return;let s=null;try{s=(await n(g(this.parsedUrl)+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!s||!s.spatialReference)return{ics:i,icsToPixelTransform:null,icsExtent:null,northDirection:null};const o=this.version>=10.7?n(g(this.parsedUrl)+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>({}))):{},a=s.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[s]}),inSR:a.wkid||JSON.stringify(a),outSR:"0:"+e},u=n(g(this.parsedUrl)+"/project",{query:this._getQueryParams(l),...t}).then((e=>e.data)).catch((()=>({}))),p=5,c=(s.xmin+s.xmax)/2,m=(s.ymax-s.ymin)/(p+1),d=s.ymin+m,h=[];for(let n=0;n<p;n++)h.push({x:c,y:d+m*n});const f={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:h}),inSR:a.wkid||JSON.stringify(a),outSR:"0:"+e},y=n(g(this.parsedUrl)+"/project",{query:this._getQueryParams(f),...t}).then((e=>e.data)).catch((()=>({}))),R=await Promise.all([o,u,y]);let b=R[0].ipxf;if(null==b){const e=i.geodataXform?.xf_0;"topup"===e?.name?.toLowerCase()&&6===e?.coefficients?.length&&(b={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const S=oe.fromJSON(R[1]&&R[1].geometries&&R[1].geometries[0]);S&&(S.spatialReference=new Fe({wkid:0,imageCoordinateSystem:i}));const v=R[2].geometries?R[2].geometries.filter((e=>null!=e&&null!=e.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y)):[],x=v.length;if(x<3)return{ics:i,icsToPixelTransform:b,icsExtent:S,northDirection:null};let I=0,w=0,F=0,_=0;for(let n=0;n<x;n++)I+=v[n].x,w+=v[n].y,F+=v[n].x*v[n].x,_+=v[n].x*v[n].y;const D=(x*_-I*w)/(x*F-I*I);let j=0;const P=v[p-1].x>v[0].x,T=v[p-1].y>v[0].y;return D===1/0?j=T?90:270:0===D?j=P?0:180:D>0?j=P?180*Math.atan(D)/Math.PI:180*Math.atan(D)/Math.PI+180:D<0&&(j=T?180+180*Math.atan(D)/Math.PI:360+180*Math.atan(D)/Math.PI),{ics:i,icsToPixelTransform:b,icsExtent:S,northDirection:j}}async generateRasterInfo(e,t){if(e=y(M,e),this.serviceRasterInfo&&(!e||"none"===e.functionName?.toLowerCase()||this._isVectorFieldResampleFunction(e)))return this.serviceRasterInfo;const r=Pe(e);if(!r)return null;if(this._functionRasterInfos[r])return this._functionRasterInfos[r];const i=this._generateRasterInfo(e,t);this._functionRasterInfos[r]=i;try{return await i}catch{return this._functionRasterInfos[r]=null,null}}getExportImageServiceParameters(e,t,r,i){e=e.clone().shiftCentralMeridian();const s=re(e.spatialReference,g(this.parsedUrl));this.pixelType!==this.serviceRasterInfo.pixelType&&(this.exportImageServiceParameters.pixelType=this.pixelType);const n=this.exportImageServiceParameters.toJSON(),{bandIds:o,noData:a}=n;let{renderingRule:l}=n;const u=this.rasterFunction?.rasterFunctionDefinition,p=!this.renderer||"raster-stretch"===this.renderer.type;if(o?.length&&this._hasRasterFunction(this.rasterFunction)&&!u&&p){const e={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:o}};if("Stretch"===l.rasterFunction)e.rasterFunctionArguments.Raster=l.rasterFunctionArguments.Raster,l.rasterFunctionArguments.Raster=e;else if("Colormap"===l.rasterFunction){const t=l.rasterFunctionArguments.Raster;"Stretch"===t?.rasterFunction?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,l.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=l,l=e;n.bandIds=void 0}else n.bandIds=o?.join(",");a instanceof Array&&a.length>0&&(n.noData=a.join(","));const c=this._processMultidimensionalIntersection(null,i,this.exportImageServiceParameters.mosaicRule);if(c.isOutSide)return null;n.mosaicRule=null!=c.mosaicRule?JSON.stringify(c.mosaicRule):null,i=c.timeExtent,n.renderingRule=this._getRenderingRuleString(M.fromJSON(l));const m={};if(null!=i){const{start:e,end:t}=i.toJSON();e&&t&&e===t?m.time=""+e:null==e&&null==t||(m.time=`${e??"null"},${t??"null"}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:s,imageSR:s,size:t+","+r,...n,...m}}async getSamples(e,t){const r=await this._fetchCapabilities(t?.signal);if(!r?.operations.supportsGetSamples)throw new a("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=y(Ie,e).clone();const{raster:i}=this;return i&&null==e.raster&&(e.raster=i),ie(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsIdentify)throw new a("imagery-layer:identify","identify operation is not supported on the input image service");e=y(Se,e).clone();const r=this._processMultidimensionalIntersection(e.geometry,e.timeExtent,e.mosaicRule||this.mosaicRule);if(r.isOutSide)throw new a("imagery-layer:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");e.timeExtent=r.timeExtent,e.mosaicRule=r.mosaicRule;const{raster:i,rasterFunction:s}=this;return s&&null==e.rasterFunction&&(e.rasterFunction=s),i&&null==e.raster&&(e.raster=i),se(this.url,e,this._getRequestOptions(t))}createQuery(){const e=new ue;return e.outFields=["*"],e.returnGeometry=!0,e.where=this.definitionExpression||"1=1",e}async queryRasters(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),ne(this.url,e,t)}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),ce(this.url,e,t)}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),pe(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new a("imagery-layer: query-visible-rasters","missing query parameter");await this.load();const{pixelSize:r,returnDomainValues:i,returnTopmostRaster:s,showNoDataRecords:n}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let o=!1,l=null,u=null;const p="raster.servicepixelvalue",c=this._rasterFunctionNamesIndex;if(null!=e.outFields&&(o=e.outFields.some((e=>!e.toLowerCase().includes(p))),this.version>=10.4)){const t=e.outFields.filter((e=>e.toLowerCase().includes(p)&&e.length>p.length)).map((e=>{const t=e.slice(p.length+1);return[this._updateRenderingRulesFunctionName(t,c),t]}));l=t.map((e=>new M({functionName:e[0]}))),u=t.map((e=>e[1]));const{rasterFunction:r}=this;0===l.length?r?.functionName?(l.push(r),u.push(r.functionName)):l=null:r?.functionName&&!l.some((e=>e.functionName===r.functionName))&&(l.push(r),u.push(r.functionName))}const m=null==e.outSpatialReference||e.outSpatialReference.equals(this.spatialReference),{multidimensionalSubset:d}=this;let h=e.timeExtent||this.timeExtent;if(d){const{isOutside:t,intersection:r}=q(d,{geometry:e.geometry,timeExtent:e.timeExtent,multidimensionalDefinition:this.exportImageServiceParameters.mosaicRule?.multidimensionalDefinition});if(t)throw new a("imagery-layer:query-visible-rasters","the request cannot be fulfilled when falling outside of the multidimensional subset");r&&null!=r.timeExtent&&(h=r.timeExtent)}const f=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,h),y=this._getQueryParams({geometry:e.geometry,timeExtent:h,mosaicRule:f,rasterFunction:this.version<10.4?this.rasterFunction:null,rasterFunctions:l,pixelSize:r,returnCatalogItems:o,returnGeometry:m,raster:this.raster,maxItemCount:s?1:null});delete y.f;const g=new Se(y);try{await this.generateRasterInfo(this.rasterFunction);const r=await se(this.url,g,{signal:t?.signal,query:{...this.customParameters}}),s=e.outFields,a=null!=r.value&&r.value.toLowerCase().includes("nodata");if(!(o&&!m&&r?.catalogItems?.features.length&&(n||!a)))return this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s});const l=this.objectIdField||"ObjectId",p=r.catalogItems?.features??[],c=p.map((e=>e.attributes?.[l])),d=new ue({objectIds:c,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[l]}),h=await this.queryRasters(d);return h?.features?.length&&h.features.forEach((t=>{p.forEach((r=>{r.attributes[l]===t.attributes[l]&&(r.geometry=new ae(t.geometry),null!=e.outSpatialReference&&(r.geometry.spatialReference=e.outSpatialReference))}))})),this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s})}catch{throw new a("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const r=n(g(this.parsedUrl)+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.statistics)),i=n(g(this.parsedUrl)+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.histograms)),s=await Promise.all([r,i]);return s[0]&&s[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:s[0]||null,histograms:s[1]||null}}async createFlowMesh(e,t){const r=this._rasterJobHandler.instance;return r?r.createFlowMesh(e,t):we(e.meshType,e.simulationSettings,e.flowData,null!=t.signal?t.signal:(new AbortController).signal)}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo.multidimensionalInfo;return E(this.multidimensionalSubset,t)}async _fetchService(e){await this._fetchServiceInfo(e),this.rasterInfo||(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,r=null!=this.serviceRasterInfo?Promise.resolve(this.serviceRasterInfo):me(g(this.parsedUrl),t,{signal:e,query:this._getQueryParams()}).then((e=>(this._set("serviceRasterInfo",e),this._set("multidimensionalInfo",e.multidimensionalInfo),e))),i=this._hasRasterFunction(this.rasterFunction)?this.generateRasterInfo(this.rasterFunction,{signal:e}):null,s=this._getRasterFunctionInfos();return Promise.all([r,i,s]).then((e=>{e[1]?this._set("rasterInfo",e[1]):this._set("rasterInfo",e[0]),e[2]&&this._set("rasterFunctionInfos",e[2]),this.renderer&&!this._isSupportedRenderer(this.renderer)&&(this._set("renderer",null),p.getLogger(this).warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._set("renderer",this._configRenderer(this.renderer)),this.addHandles([c((()=>this.rasterFunction),(e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this.generateRasterInfo(e).then((e=>{e&&(this.rasterInfo=e)}))}))]);const{serviceRasterInfo:t}=this;null!=t.multidimensionalInfo&&this._updateMultidimensionalDefinition(t)}))}_combineMosaicRuleWithTimeExtent(e,t){const r=this.timeInfo,{multidimensionalInfo:i}=this.serviceRasterInfo;if(null==e||null==i||null==t||null==r?.startField)return e;const{startField:s}=r,n=i.variables.some((e=>e.dimensions.some((e=>e.name===s))))?s:"StdTime";if(e=e.clone(),"mosaic-dataset"===this.sourceType)return e.multidimensionalDefinition=e.multidimensionalDefinition?.filter((e=>e.dimensionName!==n)),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const o=e.multidimensionalDefinition.filter((e=>e.dimensionName===n)),a=null!=t.start?t.start.getTime():null,l=null!=t.end?t.end.getTime():null,u=null==a||null==l||a===l,p=u?[a||l]:[[a,l]],c=this.version>=10.8;if(o.length)o.forEach((e=>{e.dimensionName===n&&(c?(e.dimensionName=null,e.isSlice=!1,e.values=[]):(e.isSlice=u,e.values=p))}));else if(!c){const t=e.multidimensionalDefinition.filter((e=>null!=e.variableName&&null==e.dimensionName));t.length?t.forEach((e=>{e.dimensionName=n,e.isSlice=u,e.values=p})):e.multidimensionalDefinition.push(new I({variableName:"",dimensionName:n,isSlice:u,values:p}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return null==e?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter((e=>!(!e.variableName&&!e.dimensionName))),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this.sourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQuery)throw new a("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=null!=e?y(ue,e):this.createQuery(),t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:e,requestOptions:t}}async _initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new J;this._rasterJobHandler.connectionPromise=e.initialize().then((()=>{this._rasterJobHandler.instance=e}),(()=>{})),await this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null}_isSupportedRenderer(e){const{rasterInfo:t,rasterFunction:r}=this;return"unique-value"===e.type&&this._hasRasterFunction(r)&&1===t?.bandCount&&["u8","s8"].includes(t.pixelType)||null!=t&&null!=e&&L(t).includes(e.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){let t=this.sourceJSON;if(!t){const{data:r,ssl:i}=await n(g(this.parsedUrl),{query:this._getQueryParams(),signal:e});t=r,this.sourceJSON=t,i&&(this.url=this.url.replace(/^http:/i,"https:"))}if(t.capabilities?.toLowerCase().split(",").map((e=>e.trim())).indexOf("tilesonly")>-1)throw new a("imagery-layer:fetch-service-info","use ImageryTileLayer to open tiles-only image services");this.read(t,{origin:"service",url:this.parsedUrl})}_isMosaicDataset(e){return e.serviceSourceType?"esriImageServiceSourceTypeMosaicDataset"===e.serviceSourceType:e.fields?.length>0}_isMosaicRuleSupported(e){if(!e)return!1;const t=this._isMosaicDataset(e),r=e.currentVersion>=10.71&&e.hasMultidimensions&&!(e.fields?.length>1);return t||r}_isVectorFieldResampleFunction(e){if(null==e)return!1;const{functionName:t,functionArguments:r}=e,i="resample"===t?.toLowerCase(),s=r?.ResampleType||r?.resampleType;return i&&(7===s||10===s)}_isPicture(){return!this.format||this.format.includes("jpg")||this.format.includes("png")}_configRenderer(e){const t=this._isPicture(),{rasterInfo:r}=this;if(!t&&!this.pixelFilter||this._isVectorDataSet()){if(!this.bandIds&&r.bandCount>=3){const e=z(r);!e||3===r.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}e||(e=B(r,{bandIds:this.bandIds,variableName:this.rasterFunction?null:this.mosaicRule?.multidimensionalDefinition?.[0].variableName}));const t=k(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=t,this.symbolizer.rasterInfo=r):this.symbolizer=new G({rendererJSON:t,rasterInfo:r}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:null!=e.pixelBlock?e.pixelBlock.clone():null}}_getQueryParams(e){e&&null!=e.renderingRule&&"string"!=typeof e.renderingRule&&(e.renderingRule=this._getRenderingRuleString(e.renderingRule));const{raster:t,viewId:r}=this;return{raster:t,viewId:r,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...e?.query,...this.customParameters}}}_decodePixelBlock(e,t,r){return this._rasterJobHandler.instance?this._rasterJobHandler.instance.decode({data:e,options:t}):H(e,t,r)}async _getRasterFunctionInfos(e){const t=this.sourceJSON.rasterFunctionInfos;if(this.loaded)return t;if(t&&this.version>=10.3){if(1===t.length&&"none"===t[0].name.toLowerCase())return t;const r=await n(g(this.parsedUrl)+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e});return r.data?.rasterFunctionInfos}return null}_canRequestImageElement(e){return!this.pixelFilter&&(!e||e.includes("png"))}async _requestArrayBuffer(e){const{imageProps:t,requestAsImageElement:r,returnImageBitmap:i,signal:s}=e;if(r&&this._canRequestImageElement(t.format)){const r=`${g(this.parsedUrl)}/exportImage`,{data:o}=await n(r,{responseType:i?"blob":"image",query:this._getQueryParams({f:"image",...this.refreshParameters,...e.imageServiceParameters}),signal:s});if(o instanceof Blob){return{imageBitmap:await D(o,r,s),params:t}}return{imageOrCanvasElement:o,params:t}}const o=this._initJobHandler(),l=n(g(this.parsedUrl)+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:s}),u=(await Promise.all([l,o]))[0].data,p=t.format||"jpgpng";let c=p;if("bsq"!==c&&"bip"!==c&&(c=Q(u)),!c)throw new a("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(u)));const m={signal:s},d="gif"===p||"bmp"===p||p.includes("png")&&("png"===c||"jpg"===c)?H(u,{useCanvas:!0,...t},m):this._decodePixelBlock(u,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:p},m);return{pixelData:{pixelBlock:await d,extent:t.extent},params:t}}_generateRasterInfo(e,t){const r={...t,query:this._getQueryParams()};return de(g(this.parsedUrl),e,r)}_isValidCustomizedMosaicRule(e){return e&&JSON.stringify(e.toJSON())!==JSON.stringify(this.defaultMosaicRule?.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;let t=V(e,{multidimensionalSubset:this.multidimensionalSubset});if(null!=t&&t.length>0){this.mosaicRule=this.mosaicRule||new P;const e=this.mosaicRule.multidimensionalDefinition;!this.sourceJSON.defaultVariableName&&this.rasterFunction&&"none"!==this.rasterFunction.functionName?.toLowerCase()&&t.forEach((e=>e.variableName="")),t=t.filter((({variableName:e,dimensionName:t})=>e&&"*"!==e||t)),!e?.length&&t.length&&(this.mosaicRule.multidimensionalDefinition=t)}}_processVisibleRastersResponse(e,r){r=r||{};const i=e.value,{templateRRFunctionNames:s,showNoDataRecords:n,returnDomainValues:o,templateFields:a}=r,l=e.processedValues;let u=e.catalogItems&&e.catalogItems.features,p=e.properties&&e.properties.Values&&e.properties.Values.map((e=>e.replaceAll(/ /gi,", ")))||[];const c=this.objectIdField||"ObjectId",m="string"==typeof i&&i.toLowerCase().includes("nodata"),d=[];if(i&&!u&&!m){const e={};e[c]=0;p=[i],u=[new t(this.fullExtent,null,e)]}if(!u)return[];let h,f,y;this._updateResponseFieldNames(u,a),m&&!n&&(u=[]);for(let t=0;t<u.length;t++){if(h=u[t],null!=i){if(f=p[t],y=this.rasterFunction&&l&&l.length>0&&s&&s.length>0&&s.includes(this.rasterFunction.functionName)?l[s.indexOf(this.rasterFunction.functionName)]:i,"nodata"===f.toLowerCase()&&!n)continue;const e="Raster.ItemPixelValue",r="Raster.ServicePixelValue";h.attributes[e]=f,h.attributes[r]=y,this._updateFeatureWithMagDirValues(h,f);const o=this.fields&&this.fields.length>0;let a=this.rasterFunction&&null!=this.serviceRasterInfo.attributeTable?o?f:i:y;this.rasterFunction||(a=o?f:i),this._updateFeatureWithRasterAttributeTableValues(h,a)}if(h.sourceLayer=h.layer=this,o&&this._updateFeatureWithDomainValues(h),s&&l&&s.length===l.length)for(let e=0;e<s.length;e++){const t="Raster.ServicePixelValue."+s[e];h.attributes[t]=l[e]}d.push(u[t])}return d}_processMultidimensionalIntersection(e,t,r){const{multidimensionalSubset:i}=this;if(!i)return{isOutSide:!1,timeExtent:t,mosaicRule:r=this._combineMosaicRuleWithTimeExtent(r,t)};if(i){const{isOutside:r,intersection:s}=q(i,{geometry:e,timeExtent:t});if(r)return{isOutSide:!0,timeExtent:null,mosaicRule:null};s&&null!=s.timeExtent&&(t=s.timeExtent)}if(null!=(r=this._combineMosaicRuleWithTimeExtent(r,t))&&r.multidimensionalDefinition){const{isOutside:e}=q(i,{multidimensionalDefinition:r.multidimensionalDefinition});if(e)return{isOutSide:!0,timeExtent:null,mosaicRule:null}}return{isOutSide:!1,timeExtent:t,mosaicRule:r}}_updateFeatureWithRasterAttributeTableValues(e,t){const r=this.rasterInfo.attributeTable||this.serviceRasterInfo.attributeTable;if(null==r)return;const{features:i,fields:s}=r,n=s.map((e=>e.name)).filter((e=>"value"===e.toLowerCase())),o=n&&n[0];if(!o)return;const a=i.filter((e=>e.attributes[o]===(null!=t?parseInt(t,10):null)));a&&a[0]&&s.forEach((t=>{const r=this._rasterAttributeTableFieldPrefix+t.name;e.attributes[r]=a[0].attributes[t.name]}))}_updateFeatureWithMagDirValues(e,t){if(!this._isVectorDataSet())return;const r=t.split(/,\s*/).map((e=>parseFloat(e))),i=r.map((e=>[e])),s=r.map((e=>({minValue:e,maxValue:e,noDataValue:null}))),n=new O({height:1,width:1,pixelType:"f32",pixels:i,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new oe(0,0,0,0,this.spatialReference)});const o="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:U([n.pixels[0][0],n.pixels[1][0]]);e.attributes["Raster.Magnitude"]=o[0],e.attributes["Raster.Direction"]=o[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter((e=>e.domain&&"coded-value"===e.domain.type));null!=t&&t.forEach((t=>{const r=e.attributes[t.name];if(null!=r){const i=t.domain.codedValues.find((e=>e.code===r));i&&(e.attributes[t.name]=i.name)}}))}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const r=this.fieldsIndex;null!=r&&e.forEach((e=>{if(e&&e.attributes)for(const i of t){const t=r.get(i)?.name;t&&t!==i&&(e.attributes[i]=e.attributes[t],delete e.attributes[t])}}))}_getRenderingRuleString(e){if(e){let t=e.toJSON();return t=t.rasterFunctionDefinition??t,(t.thumbnail||t.thumbnailEx)&&(t.thumbnail=t.thumbnailEx=null),JSON.stringify(t)}return null}_hasRasterFunction(e){return null!=e&&null!=e.functionName&&"none"!==e.functionName.toLowerCase()}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if("Raw"===e)return e.replace("Raw","None");const r=e.toLowerCase().replaceAll(/ /gi,"_");return t.has(r)?t.get(r):e}_isRFTJson(e){return e&&e.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_isVectorDataSet(){return"esriImageServiceDataTypeVector-UV"===this.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===this.serviceDataType}_applyMosaicAndRenderingRules(e){const{raster:t,mosaicRule:r,rasterFunction:i}=this;i&&null==e.rasterFunction&&(e.rasterFunction=i),r&&null==e.mosaicRule&&(e.mosaicRule=r),t&&null==e.raster&&(e.raster=t)}_readCapabilities(e){const t=e.capabilities?e.capabilities.toLowerCase().split(",").map((e=>e.trim())):["image","catalog"],{currentVersion:r,advancedQueryCapabilities:i,maxRecordCount:s}=e,n=t.includes("image"),o="esriImageServiceDataTypeElevation"===e.serviceDataType,a=!!(e.spatialReference||e.extent&&e.extent.spatialReference),l=t.includes("edit"),u=t.includes("mensuration")&&a,p=null==e.mensurationCapabilities?[]:e.mensurationCapabilities.toLowerCase().split(",").map((e=>e.trim())),c=u&&p.includes("basic");return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:n,supportsExportImage:n,supportsIdentify:n,supportsMeasure:u,supportsDownload:t.includes("download"),supportsQuery:t.includes("catalog")&&e.fields&&e.fields.length>0,supportsGetSamples:r>=10.2&&n,supportsProject:r>=10.3&&n,supportsComputeStatisticsHistograms:r>=10.4&&n,supportsQueryBoundary:r>=10.6&&n,supportsCalculateVolume:r>=10.7&&o,supportsComputePixelLocation:r>=10.7&&t.includes("catalog"),supportsComputeAngles:r>=10.91,supportsAdd:l,supportsDelete:l,supportsEditing:l,supportsUpdate:l,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1,supportsQueryAnalytics:!1,supportsQueryTopFeatures:!1},query:{maxRecordCount:s,maxRecordCountFactor:void 0,supportsStatistics:!!i?.supportsStatistics,supportsOrderBy:!!i?.supportsOrderBy,supportsDistinct:!!i?.supportsDistinct,supportsPagination:!!i?.supportsPagination,supportsStandardizedQueriesOnly:!!i?.useStandardizedQueries,supportsPercentileStatistics:!!i?.supportsPercentileStatistics,supportsCentroid:!!i?.supportsReturningGeometryCentroid,supportsDistance:!!i?.supportsQueryWithDistance,supportsExtent:!!i?.supportsReturningQueryExtent,supportsGeometryProperties:!!i?.supportsReturningGeometryProperties,supportsHavingClause:!!i?.supportsHavingClause,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:!1,supportsTopFeaturesQuery:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!i?.supportsDefaultSR,supportsFullTextSearch:!1,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0},mensuration:{supportsDistanceAndAngle:c,supportsAreaAndPerimeter:c,supportsPointOrCentroid:c,supportsHeightFromBaseAndTop:u&&p.includes("base-top height"),supportsHeightFromBaseAndTopShadow:u&&p.includes("base-top shadow height"),supportsHeightFromTopAndTopShadow:u&&p.includes("top-top shadow height"),supports3D:u&&p.includes("3d")}}}};function g(e){return e?.path??""}return e([d()],h.prototype,"_functionRasterInfos",void 0),e([d()],h.prototype,"_rasterJobHandler",void 0),e([d()],h.prototype,"_cachedRendererJson",void 0),e([d({readOnly:!0})],h.prototype,"_serviceSupportsMosaicRule",void 0),e([R("_serviceSupportsMosaicRule",["currentVersion","fields"])],h.prototype,"readServiceSupportsMosaicRule",null),e([d()],h.prototype,"_rasterAttributeTableFieldPrefix",void 0),e([d({readOnly:!0})],h.prototype,"_rasterFunctionNamesIndex",null),e([d()],h.prototype,"adjustAspectRatio",void 0),e([d({type:[f],json:{write:!0}})],h.prototype,"bandIds",void 0),e([R("bandIds")],h.prototype,"readBandIds",null),e([d({readOnly:!0,json:{read:!1}})],h.prototype,"capabilities",void 0),e([R("service","capabilities",["capabilities","currentVersion","serviceDataType"])],h.prototype,"readCapabilities",null),e([d({type:Number})],h.prototype,"compressionQuality",void 0),e([S("compressionQuality")],h.prototype,"writeCompressionQuality",null),e([d({type:Number})],h.prototype,"compressionTolerance",void 0),e([S("compressionTolerance")],h.prototype,"writeCompressionTolerance",null),e([d({json:{read:{source:"copyrightText"}}})],h.prototype,"copyright",void 0),e([d({readOnly:!0,dependsOn:["_serviceSupportsMosaicRule"]})],h.prototype,"defaultMosaicRule",void 0),e([R("defaultMosaicRule",["defaultMosaicMethod"])],h.prototype,"readDefaultMosaicRule",null),e([d({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],h.prototype,"definitionExpression",void 0),e([d({readOnly:!0,constructOnly:!0})],h.prototype,"exportImageServiceParameters",void 0),e([d()],h.prototype,"rasterInfo",void 0),e([d({readOnly:!0,type:[F]})],h.prototype,"fields",void 0),e([d({readOnly:!0})],h.prototype,"fieldsIndex",null),e([d({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"],json:{write:!0}})],h.prototype,"format",null),e([R("service","format",["serviceDataType"])],h.prototype,"readFormat",null),e([d({type:oe})],h.prototype,"fullExtent",void 0),e([d({readOnly:!0})],h.prototype,"hasMultidimensions",void 0),e([d({json:{read:{source:"maxImageHeight"}}})],h.prototype,"imageMaxHeight",void 0),e([d({json:{read:{source:"maxImageWidth"}}})],h.prototype,"imageMaxWidth",void 0),e([d({type:String,json:{type:N.jsonValues,read:N.read,write:N.write}})],h.prototype,"interpolation",void 0),e([d()],h.prototype,"minScale",void 0),e([R("service","minScale")],h.prototype,"readMinScale",null),e([d()],h.prototype,"maxScale",void 0),e([R("service","maxScale")],h.prototype,"readMaxScale",null),e([d({type:P})],h.prototype,"mosaicRule",null),e([R("mosaicRule",["mosaicRule","defaultMosaicMethod"])],h.prototype,"readMosaicRule",null),e([S("mosaicRule")],h.prototype,"writeMosaicRule",null),e([d()],h.prototype,"multidimensionalInfo",void 0),e([d({type:T,json:{write:!0}})],h.prototype,"multidimensionalSubset",void 0),e([d({json:{type:f}})],h.prototype,"noData",void 0),e([S("noData")],h.prototype,"writeNoData",null),e([d({type:String,json:{type:C.jsonValues,read:C.read,write:C.write}})],h.prototype,"noDataInterpretation",void 0),e([d({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],h.prototype,"objectIdField",void 0),e([R("objectIdField")],h.prototype,"readObjectIdField",null),e([d({})],h.prototype,"geometryType",void 0),e([d({})],h.prototype,"typeIdField",void 0),e([d({})],h.prototype,"types",void 0),e([d({readOnly:!0})],h.prototype,"parsedUrl",null),e([d({type:Function})],h.prototype,"pixelFilter",void 0),e([d()],h.prototype,"raster",void 0),e([d({readOnly:!0})],h.prototype,"sourceType",void 0),e([R("sourceType",["serviceSourceType","fields"])],h.prototype,"readSourceType",null),e([d()],h.prototype,"viewId",void 0),e([d({types:r,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:i,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],h.prototype,"renderer",null),e([R("renderer")],h.prototype,"readRenderer",null),e([S("renderer")],h.prototype,"writeRenderer",null),e([d()],h.prototype,"symbolizer",void 0),e([d(v)],h.prototype,"opacity",void 0),e([d({readOnly:!0})],h.prototype,"rasterFields",null),e([d({constructOnly:!0})],h.prototype,"rasterFunctionInfos",void 0),e([d({type:M})],h.prototype,"renderingRule",null),e([d({type:M,json:{name:"renderingRule"}})],h.prototype,"rasterFunction",null),e([R("rasterFunction",["renderingRule","rasterFunctionInfos"])],h.prototype,"readRasterFunction",null),e([S("rasterFunction")],h.prototype,"writeRasterFunction",null),e([d()],h.prototype,"serviceDataType",void 0),e([d({readOnly:!0,type:Fe})],h.prototype,"spatialReference",void 0),e([R("spatialReference",["spatialReference","extent"])],h.prototype,"readSpatialReference",null),e([d({json:{type:_e.jsonValues}})],h.prototype,"pixelType",void 0),e([R("pixelType")],h.prototype,"readPixelType",null),e([S("pixelType")],h.prototype,"writePixelType",null),e([d({constructOnly:!0,type:A})],h.prototype,"serviceRasterInfo",void 0),e([d()],h.prototype,"sourceJSON",void 0),e([d(x)],h.prototype,"url",void 0),e([d({readOnly:!0})],h.prototype,"version",void 0),e([R("version",["currentVersion","fields","timeInfo"])],h.prototype,"readVersion",null),h=e([b("esri.layers.mixins.ArcGISImageService")],h),h};export{Te as ArcGISImageService};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import{rasterRendererTypes as r,websceneRasterRendererTypes as i,read as s}from"../../rasterRenderers.js";import n from"../../request.js";import{deprecatedProperty as o}from"../../core/deprecate.js";import a from"../../core/Error.js";import{strict as l}from"../../core/jsonMap.js";import{clone as u}from"../../core/lang.js";import p from"../../core/Logger.js";import{watch as c}from"../../core/reactiveUtils.js";import{urlToObject as m}from"../../core/urlUtils.js";import{property as d,ensureRange as h}from"../../core/accessorSupport/decorators/property.js";import{Integer as f,ensureClass as y,ensureNumber as g}from"../../core/accessorSupport/ensureType.js";import{reader as R}from"../../core/accessorSupport/decorators/reader.js";import{subclass as b}from"../../core/accessorSupport/decorators/subclass.js";import{writer as S}from"../../core/accessorSupport/decorators/writer.js";import{opacity as v,url as w}from"../support/commonProperties.js";import x from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as I}from"../support/ExportImageServiceParameters.js";import _ from"../support/Field.js";import F from"../support/FieldsIndex.js";import{createBitmap as D}from"../support/imageBitmapUtils.js";import{isSupportedRendererType as j}from"../support/imageryRendererUtils.js";import P from"../support/MosaicRule.js";import T from"../support/MultidimensionalSubset.js";import O from"../support/PixelBlock.js";import{interpolationKebab as N,noDataInterpretationKebab as C}from"../support/rasterEnums.js";import M from"../support/RasterFunction.js";import A from"../support/RasterInfo.js";import J from"../support/RasterJobHandler.js";import{intersectMultimensionalSubset as q,getSubsetVariablesFromMdInfo as E,getDefaultMultidimensionalDefinition as V}from"../support/rasterDatasets/multidimensionalUtils.js";import{decode as H,getFormat as Q}from"../support/rasterFormats/RasterCodec.js";import{uvComponentToVector as U}from"../support/rasterFunctions/vectorFieldUtils.js";import{getSupportedRendererTypes as L,getDefaultBandCombination as z,createDefaultRenderer as B,normalizeRendererJSON as k}from"../../renderers/support/rasterRendererHelper.js";import G from"../../renderers/support/RasterSymbolizer.js";import{computeAngles as W,computePixelSpaceLocations as $,computeHistograms as K,computeStatisticsHistograms as X,measureHeight as Y,measureAreaAndPerimeter as Z,measureDistanceAndAngle as ee,measurePointOrCentroid as te,getImageSpatialReferenceQueryParameter as re,getSamples as ie,identify as se}from"../../rest/imageService.js";import"../../core/has.js";import"../support/source/DataLayerSource.js";import{executeQueryJSON as ne}from"../../rest/query/executeQueryJSON.js";import"../../config.js";import"../../kernel.js";import"../../core/unitUtils.js";import"../../geometry/support/spatialReferenceUtils.js";import"../graphics/featureConversionUtils.js";import oe from"../../geometry/Extent.js";import"../../geometry/Geometry.js";import"../../geometry/Multipoint.js";import"../../geometry/Point.js";import ae from"../../geometry/Polygon.js";import"../../geometry/Polyline.js";import"../../geometry/support/normalizeUtils.js";import"../../core/pbf.js";import le from"../../rest/support/FeatureSet.js";import ue from"../../rest/support/Query.js";import"../../rest/query/support/AttachmentInfo.js";import"../../rest/support/AttachmentQuery.js";import{executeForCount as pe}from"../../rest/query/executeForCount.js";import{executeForIds as ce}from"../../rest/query/executeForIds.js";import"../../rest/support/RelationshipQuery.js";import"../../rest/support/TopFeaturesQuery.js";import{generateRasterInfo as me,fetchServiceRasterInfo as de}from"../../rest/imageService/fetchRasterInfo.js";import{getCatalogItemRasterInfo as he}from"../../rest/imageService/getCatalogItemRasterInfo.js";import fe from"../../rest/support/ImageAngleParameters.js";import ye from"../../rest/support/ImageAreaParameters.js";import ge from"../../rest/support/ImageDistanceParameters.js";import Re from"../../rest/support/ImageHeightParameters.js";import be from"../../rest/support/ImageHistogramParameters.js";import Se from"../../rest/support/ImageIdentifyParameters.js";import ve from"../../rest/support/ImagePixelLocationParameters.js";import we from"../../rest/support/ImagePointParameters.js";import xe from"../../rest/support/ImageSampleParameters.js";import{createFlowMesh as Ie}from"../../views/2d/engine/flow/dataUtils.js";import _e from"../../geometry/SpatialReference.js";const Fe=l()({U1:"u1",U2:"u2",U4:"u4",U8:"u8",S8:"s8",U16:"u16",S16:"s16",U32:"u32",S32:"s32",F32:"f32",F64:"f64",C64:"c64",C128:"c128",UNKNOWN:"unknown"}),De=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),je=h(g,{min:0,max:255});function Pe(e){if(!e)return null;const t=JSON.stringify(e).match(/"rasterFunction":"(.*?")/gi),r=t?.map((e=>e.replace('"rasterFunction":"',"").replace('"',"")));return r?r.join("/"):null}const Te=l=>{let h=class extends l{constructor(){super(...arguments),this._functionRasterInfos={},this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this._cachedRendererJson=null,this._serviceSupportsMosaicRule=null,this._rasterAttributeTableFieldPrefix="Raster.",this.adjustAspectRatio=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.defaultMosaicRule=null,this.definitionExpression=null,this.exportImageServiceParameters=null,this.rasterInfo=null,this.fields=null,this.fullExtent=null,this.hasMultidimensions=!1,this.imageMaxHeight=4100,this.imageMaxWidth=4100,this.interpolation=void 0,this.minScale=0,this.maxScale=0,this.multidimensionalInfo=null,this.multidimensionalSubset=null,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelFilter=null,this.raster=void 0,this.sourceType=null,this.viewId=void 0,this.symbolizer=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=void 0}initialize(){this._set("exportImageServiceParameters",new I({layer:this}))}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get _rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.length<1||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.forEach((t=>{e.set(t.name.toLowerCase().replaceAll(/ /gi,"_"),t.name)})),e}readBandIds(e,t){if(Array.isArray(e)&&e.length>0&&e.every((e=>"number"==typeof e)))return e}readCapabilities(e,t){return this._readCapabilities(t)}writeCompressionQuality(e,t,r){null!=e&&"lerc"!==this.format&&(t[r]=e)}writeCompressionTolerance(e,t,r){"lerc"===this.format&&null!=e&&(t[r]=e)}readDefaultMosaicRule(e,t){return this._serviceSupportsMosaicRule?P.fromJSON(t):null}get fieldsIndex(){return this.fields?new F(this.fields):null}set format(e){e&&De.has(e.toLowerCase())&&this._set("format",e.toLowerCase())}readFormat(e,t){return"esriImageServiceDataTypeVector-UV"===t.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===t.serviceDataType||null!=this.pixelFilter?"lerc":"jpgpng"}readMinScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}readMaxScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}set mosaicRule(e){let t=e;t&&t.mosaicMethod&&(t=P.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const r=e||t.mosaicRule;return r?P.fromJSON(r):this._isMosaicRuleSupported(t)?P.fromJSON(t):null}writeMosaicRule(e,t,r){let i=this.mosaicRule;const s=this.definitionExpression;i?s&&s!==i.where&&(i=i.clone(),i.where=s):s&&(i=new P({where:s})),this._isValidCustomizedMosaicRule(i)&&(t[r]=i.toJSON())}writeNoData(e,t,r){null!=e&&"number"==typeof e&&(t[r]=je(e))}readObjectIdField(e,t){if(!e){const r=t.fields.filter((e=>"esriFieldTypeOID"===e.type||"oid"===e.type));e=r&&r[0]&&r[0].name}return e}get parsedUrl(){return m(this.url)}readSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}set renderer(e){this.loaded&&(e=this._configRenderer(e)),this._set("renderer",e)}readRenderer(e,t,r){const i=t?.layerDefinition?.drawingInfo?.renderer,n=s(i,r);return null==n?null:("vector-field"===n.type&&t.symbolTileSize&&!i.symbolTileSize&&(n.symbolTileSize=t.symbolTileSize),j(n)||p.getLogger(this).warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),n)}writeRenderer(e,t,r){t.layerDefinition=t.layerDefinition||{},t.layerDefinition.drawingInfo=t.layerDefinition.drawingInfo||{},t.layerDefinition.drawingInfo.renderer=e.toJSON(),"vector-field"===e.type&&(t.symbolTileSize=e.symbolTileSize)}get rasterFields(){const e=this._rasterAttributeTableFieldPrefix||"Raster.",t=new _({name:"Raster.ItemPixelValue",alias:"Item Pixel Value",domain:null,editable:!1,length:50,type:"string"}),r=new _({name:"Raster.ServicePixelValue",alias:"Service Pixel Value",domain:null,editable:!1,length:50,type:"string"}),i=new _({name:"Raster.ServicePixelValue.Raw",alias:"Raw Service Pixel Value",domain:null,editable:!1,length:50,type:"string"});let s=this.fields?u(this.fields):[];s.push(r),this.capabilities?.operations.supportsQuery&&this.fields&&this.fields.length>0&&s.push(t),this.version>=10.4&&null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.some((e=>"none"===e.name.toLowerCase()))&&s.push(i),null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.filter((e=>"none"!==e.name.toLowerCase())).forEach((e=>{s.push(new _({name:"Raster.ServicePixelValue."+e.name,alias:e.name,domain:null,editable:!1,length:50,type:"string"}))})),this._isVectorDataSet()&&(s.push(new _({name:"Raster.Magnitude",alias:"Magnitude",domain:null,editable:!1,type:"double"})),s.push(new _({name:"Raster.Direction",alias:"Direction",domain:null,editable:!1,type:"double"})));const{attributeTable:n}=this.rasterInfo??{};if(null!=n){const t=n.fields.filter((e=>"esriFieldTypeOID"!==e.type&&"value"!==e.name.toLowerCase())).map((t=>{const r=u(t);return r.name=e+t.name,r}));s=s.concat(t)}return s}get renderingRule(){return o(p.getLogger(this),"renderingRule",{replacement:"rasterFunction",version:"4.27",warnOnce:!0}),this._get("rasterFunction")}set renderingRule(e){o(p.getLogger(this),"renderingRule",{replacement:"rasterFunction",version:"4.27",warnOnce:!0}),this._set("rasterFunction",e)}set rasterFunction(e){let t=e;t&&t.rasterFunction&&(t=M.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("rasterFunction",t)}readRasterFunction(e,t){const r=t.rasterFunctionInfos;return t.renderingRule||r&&r.length&&"None"!==r[0].name?this._isRFTJson(t.renderingRule)?M.fromJSON({rasterFunctionDefinition:t.renderingRule}):M.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}writeRasterFunction(e,t,r){const i=e.toJSON();i.rasterFunctionDefinition?t.renderingRule=i.rasterFunctionDefinition:t.renderingRule=i}readSpatialReference(e,t){const r=e||t.extent.spatialReference;return r?_e.fromJSON(r):null}readPixelType(e){return Fe.fromJSON(e)||e}writePixelType(e,t,r){null!=this.serviceRasterInfo&&this.pixelType===this.serviceRasterInfo.pixelType||(t[r]=Fe.toJSON(e))}readVersion(e,t){let r=t.currentVersion;return r||(r=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),r}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let r=e;const{renderer:i,symbolizer:s,pixelFilter:n,bandIds:o}=this;if(!this._isPicture()&&i&&s&&!n){const n=JSON.stringify(this._cachedRendererJson)!==JSON.stringify(i.toJSON()),a=this._rasterJobHandler.instance;if(a){n&&(s.bind(),await a.updateSymbolizer(s,t),this._cachedRendererJson=i.toJSON());const l=await a.symbolize({bandIds:o,...e},t);r={extent:e.extent,pixelBlock:l}}else r={extent:e.extent,pixelBlock:s.symbolize({bandIds:o,...e})}}return r}destroy(){this._shutdownJobHandler()}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}async computeAngles(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeAngles)throw new a("imagery-layer:compute-angles","this operation is not supported on the input image service");return e=y(fe,e).clone(),W(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputePixelLocation)throw new a("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=y(ve,e).clone(),$(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeHistograms)throw new a("imagery-layer:compute-histograms","this operation is not supported on the input image service");return e=y(be,e).clone(),this._applyMosaicAndRenderingRules(e),K(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeStatisticsHistograms)throw new a("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");return e=y(be,e).clone(),this._applyMosaicAndRenderingRules(e),X(this.url,e,this._getRequestOptions(t))}async measureHeight(e,t){const r=await this._fetchCapabilities(t?.signal);if(!("base-and-top"===e.operationType?r.mensuration.supportsHeightFromBaseAndTop:"base-and-top-shadow"===e.operationType?r.mensuration.supportsHeightFromBaseAndTopShadow:r.mensuration.supportsHeightFromTopAndTopShadow))throw new a("imagery-layer:measure-height","this operation is not supported on the input image service");return e=y(Re,e).clone(),this._applyMosaicAndRenderingRules(e),Y(this.url,e,this._getRequestOptions(t))}async measureAreaAndPerimeter(e,t){const r=await this._fetchCapabilities(t?.signal);if(!(r.mensuration.supportsAreaAndPerimeter&&(!e.is3D||r.mensuration.supports3D)))throw new a("imagery-layer:measure-area-and-perimeter","this operation is not supported on the input image service");return e=y(ye,e).clone(),this._applyMosaicAndRenderingRules(e),Z(this.url,e,this._getRequestOptions(t))}async measureDistanceAndAngle(e,t){const r=await this._fetchCapabilities(t?.signal);if(!(r.mensuration.supportsDistanceAndAngle&&(!e.is3D||r.mensuration.supports3D)))throw new a("imagery-layer:measure-distance-and-angle","this operation is not supported on the input image service");return e=y(ge,e).clone(),this._applyMosaicAndRenderingRules(e),ee(this.url,e,this._getRequestOptions(t))}async measurePointOrCentroid(e,t){const r=await this._fetchCapabilities(t?.signal);if(!(r.mensuration.supportsPointOrCentroid&&(!e.is3D||r.mensuration.supports3D)))throw new a("imagery-layer:measure-point-or-centroid","this operation is not supported on the input image service");return e=y(we,e).clone(),this._applyMosaicAndRenderingRules(e),te(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return null!=t?t.get(e):void 0}getFieldDomain(e,t){const r=this.getField(e);return r?r.domain:null}async fetchImage(e,t,r,i={}){if(null==e||null==t||null==r)throw new a("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required.");if(this.renderer||this.symbolizer){const e=await this._generateRasterInfo(this.rasterFunction,{signal:i.signal});e&&(this.rasterInfo=e)}const s=this.getExportImageServiceParameters(e,t,r,i.timeExtent);if(null==s){if(i.requestAsImageElement&&this._canRequestImageElement(this.format)){const e=document.createElement("canvas");if(e.width=t,e.height=r,i.returnImageBitmap){return{imageBitmap:await D(e,`${g(this.parsedUrl)}/exportImage`,i.signal)}}return{imageOrCanvasElement:e}}const{bandIds:s,rasterInfo:n}=this,o=(s?.length||n.bandCount)??0,a=t*r,l=n.pixelType,u=[];for(let e=0;e<o;e++)u.push(O.createEmptyBand(l,a));return{pixelData:{pixelBlock:new O({width:t,height:r,pixels:u,mask:new Uint8Array(a),pixelType:l}),extent:e}}}const n=!!i.requestAsImageElement&&!this.pixelFilter,o=n&&!!i.returnImageBitmap,l={imageServiceParameters:s,imageProps:{extent:e,width:t,height:r,format:this.format},requestAsImageElement:n,returnImageBitmap:o,signal:i.signal};return this._requestArrayBuffer(l)}fetchKeyProperties(e){return n(g(this.parsedUrl)+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then((e=>e.data))}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new a("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):n(g(this.parsedUrl)+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then((e=>le.fromJSON(e.data)))}getCatalogItemRasterInfo(e,t){const r={...t,query:this._getQueryParams()};return he(g(this.parsedUrl),e,r)}async getCatalogItemICSInfo(e,t){const{data:r}=await n(g(this.parsedUrl)+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),i=r&&r.ics;if(!i)return;let s=null;try{s=(await n(g(this.parsedUrl)+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!s||!s.spatialReference)return{ics:i,icsToPixelTransform:null,icsExtent:null,northDirection:null};const o=this.version>=10.7?n(g(this.parsedUrl)+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>({}))):{},a=s.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[s]}),inSR:a.wkid||JSON.stringify(a),outSR:"0:"+e},u=n(g(this.parsedUrl)+"/project",{query:this._getQueryParams(l),...t}).then((e=>e.data)).catch((()=>({}))),p=5,c=(s.xmin+s.xmax)/2,m=(s.ymax-s.ymin)/(p+1),d=s.ymin+m,h=[];for(let n=0;n<p;n++)h.push({x:c,y:d+m*n});const f={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:h}),inSR:a.wkid||JSON.stringify(a),outSR:"0:"+e},y=n(g(this.parsedUrl)+"/project",{query:this._getQueryParams(f),...t}).then((e=>e.data)).catch((()=>({}))),R=await Promise.all([o,u,y]);let b=R[0].ipxf;if(null==b){const e=i.geodataXform?.xf_0;"topup"===e?.name?.toLowerCase()&&6===e?.coefficients?.length&&(b={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const S=oe.fromJSON(R[1]&&R[1].geometries&&R[1].geometries[0]);S&&(S.spatialReference=new _e({wkid:0,imageCoordinateSystem:i}));const v=R[2].geometries?R[2].geometries.filter((e=>null!=e&&null!=e.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y)):[],w=v.length;if(w<3)return{ics:i,icsToPixelTransform:b,icsExtent:S,northDirection:null};let x=0,I=0,_=0,F=0;for(let n=0;n<w;n++)x+=v[n].x,I+=v[n].y,_+=v[n].x*v[n].x,F+=v[n].x*v[n].y;const D=(w*F-x*I)/(w*_-x*x);let j=0;const P=v[p-1].x>v[0].x,T=v[p-1].y>v[0].y;return D===1/0?j=T?90:270:0===D?j=P?0:180:D>0?j=P?180*Math.atan(D)/Math.PI:180*Math.atan(D)/Math.PI+180:D<0&&(j=T?180+180*Math.atan(D)/Math.PI:360+180*Math.atan(D)/Math.PI),{ics:i,icsToPixelTransform:b,icsExtent:S,northDirection:j}}async generateRasterInfo(e,t){if(e=y(M,e),this.serviceRasterInfo&&(!e||"none"===e.functionName?.toLowerCase()||this._isVectorFieldResampleFunction(e)))return this.serviceRasterInfo;const r=Pe(e);if(!r)throw new a("imagery-layer:generate-raster-info","the rendering rule is not supported");if(this._functionRasterInfos[r])return this._functionRasterInfos[r];const i={...t,query:this._getQueryParams()},s=me(g(this.parsedUrl),e,i);this._functionRasterInfos[r]=s;try{return await s}catch(n){throw this._functionRasterInfos[r]=null,n}}getExportImageServiceParameters(e,t,r,i){e=e.clone().shiftCentralMeridian();const s=re(e.spatialReference,g(this.parsedUrl));this.pixelType!==this.serviceRasterInfo.pixelType&&(this.exportImageServiceParameters.pixelType=this.pixelType);const n=this.exportImageServiceParameters.toJSON(),{bandIds:o,noData:a}=n;let{renderingRule:l}=n;const u=this.rasterFunction?.rasterFunctionDefinition,p=!this.renderer||"raster-stretch"===this.renderer.type;if(o?.length&&this._hasRasterFunction(this.rasterFunction)&&!u&&p){const e={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:o}};if("Stretch"===l.rasterFunction)e.rasterFunctionArguments.Raster=l.rasterFunctionArguments.Raster,l.rasterFunctionArguments.Raster=e;else if("Colormap"===l.rasterFunction){const t=l.rasterFunctionArguments.Raster;"Stretch"===t?.rasterFunction?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,l.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=l,l=e;n.bandIds=void 0}else n.bandIds=o?.join(",");a instanceof Array&&a.length>0&&(n.noData=a.join(","));const c=this._processMultidimensionalIntersection(null,i,this.exportImageServiceParameters.mosaicRule);if(c.isOutSide)return null;n.mosaicRule=null!=c.mosaicRule?JSON.stringify(c.mosaicRule):null,i=c.timeExtent,n.renderingRule=this._getRenderingRuleString(M.fromJSON(l));const m={};if(null!=i){const{start:e,end:t}=i.toJSON();e&&t&&e===t?m.time=""+e:null==e&&null==t||(m.time=`${e??"null"},${t??"null"}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:s,imageSR:s,size:t+","+r,...n,...m}}async getSamples(e,t){const r=await this._fetchCapabilities(t?.signal);if(!r?.operations.supportsGetSamples)throw new a("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=y(xe,e).clone();const{raster:i}=this;return i&&null==e.raster&&(e.raster=i),ie(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsIdentify)throw new a("imagery-layer:identify","identify operation is not supported on the input image service");e=y(Se,e).clone();const r=this._processMultidimensionalIntersection(e.geometry,e.timeExtent,e.mosaicRule||this.mosaicRule);if(r.isOutSide)throw new a("imagery-layer:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");e.timeExtent=r.timeExtent,e.mosaicRule=r.mosaicRule;const{raster:i,rasterFunction:s}=this;return s&&null==e.rasterFunction&&(e.rasterFunction=s),i&&null==e.raster&&(e.raster=i),se(this.url,e,this._getRequestOptions(t))}createQuery(){const e=new ue;return e.outFields=["*"],e.returnGeometry=!0,e.where=this.definitionExpression||"1=1",e}async queryRasters(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),ne(this.url,e,t)}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),ce(this.url,e,t)}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),pe(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new a("imagery-layer: query-visible-rasters","missing query parameter");await this.load();const{pixelSize:r,returnDomainValues:i,returnTopmostRaster:s,showNoDataRecords:n}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let o=!1,l=null,u=null;const p="raster.servicepixelvalue",c=this._rasterFunctionNamesIndex;if(null!=e.outFields&&(o=e.outFields.some((e=>!e.toLowerCase().includes(p))),this.version>=10.4)){const t=e.outFields.filter((e=>e.toLowerCase().includes(p)&&e.length>p.length)).map((e=>{const t=e.slice(p.length+1);return[this._updateRenderingRulesFunctionName(t,c),t]}));l=t.map((e=>new M({functionName:e[0]}))),u=t.map((e=>e[1]));const{rasterFunction:r}=this;0===l.length?r?.functionName?(l.push(r),u.push(r.functionName)):l=null:r?.functionName&&!l.some((e=>e.functionName===r.functionName))&&(l.push(r),u.push(r.functionName))}const m=null==e.outSpatialReference||e.outSpatialReference.equals(this.spatialReference),{multidimensionalSubset:d}=this;let h=e.timeExtent||this.timeExtent;if(d){const{isOutside:t,intersection:r}=q(d,{geometry:e.geometry,timeExtent:e.timeExtent,multidimensionalDefinition:this.exportImageServiceParameters.mosaicRule?.multidimensionalDefinition});if(t)throw new a("imagery-layer:query-visible-rasters","the request cannot be fulfilled when falling outside of the multidimensional subset");r&&null!=r.timeExtent&&(h=r.timeExtent)}const f=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,h),y=this._getQueryParams({geometry:e.geometry,timeExtent:h,mosaicRule:f,rasterFunction:this.version<10.4?this.rasterFunction:null,rasterFunctions:l,pixelSize:r,returnCatalogItems:o,returnGeometry:m,raster:this.raster,maxItemCount:s?1:null});delete y.f;const g=new Se(y);try{await this._generateRasterInfo(this.rasterFunction);const r=await se(this.url,g,{signal:t?.signal,query:{...this.customParameters}}),s=e.outFields,a=null!=r.value&&r.value.toLowerCase().includes("nodata");if(!(o&&!m&&r?.catalogItems?.features.length&&(n||!a)))return this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s});const l=this.objectIdField||"ObjectId",p=r.catalogItems?.features??[],c=p.map((e=>e.attributes?.[l])),d=new ue({objectIds:c,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[l]}),h=await this.queryRasters(d);return h?.features?.length&&h.features.forEach((t=>{p.forEach((r=>{r.attributes[l]===t.attributes[l]&&(r.geometry=new ae(t.geometry),null!=e.outSpatialReference&&(r.geometry.spatialReference=e.outSpatialReference))}))})),this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s})}catch{throw new a("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const r=n(g(this.parsedUrl)+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.statistics)),i=n(g(this.parsedUrl)+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.histograms)),s=await Promise.all([r,i]);return s[0]&&s[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:s[0]||null,histograms:s[1]||null}}async createFlowMesh(e,t){const r=this._rasterJobHandler.instance;return r?r.createFlowMesh(e,t):Ie(e.meshType,e.simulationSettings,e.flowData,null!=t.signal?t.signal:(new AbortController).signal)}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo.multidimensionalInfo;return E(this.multidimensionalSubset,t)}async _fetchService(e){await this._fetchServiceInfo(e),this.rasterInfo||(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,r=null!=this.serviceRasterInfo?Promise.resolve(this.serviceRasterInfo):de(g(this.parsedUrl),t,{signal:e,query:this._getQueryParams()}).then((e=>(this._set("serviceRasterInfo",e),this._set("multidimensionalInfo",e.multidimensionalInfo),e))),i=this._hasRasterFunction(this.rasterFunction)?this._generateRasterInfo(this.rasterFunction,{signal:e}):null,s=this._getRasterFunctionInfos();return Promise.all([r,i,s]).then((e=>{e[1]?this._set("rasterInfo",e[1]):this._set("rasterInfo",e[0]),e[2]&&this._set("rasterFunctionInfos",e[2]),this.renderer&&!this._isSupportedRenderer(this.renderer)&&(this._set("renderer",null),p.getLogger(this).warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._set("renderer",this._configRenderer(this.renderer)),this.addHandles([c((()=>this.rasterFunction),(e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this._generateRasterInfo(e).then((e=>{e&&(this.rasterInfo=e)}))}))]);const{serviceRasterInfo:t}=this;null!=t.multidimensionalInfo&&this._updateMultidimensionalDefinition(t)}))}_combineMosaicRuleWithTimeExtent(e,t){const r=this.timeInfo,{multidimensionalInfo:i}=this.serviceRasterInfo;if(null==e||null==i||null==t||null==r?.startField)return e;const{startField:s}=r,n=i.variables.some((e=>e.dimensions.some((e=>e.name===s))))?s:"StdTime";if(e=e.clone(),"mosaic-dataset"===this.sourceType)return e.multidimensionalDefinition=e.multidimensionalDefinition?.filter((e=>e.dimensionName!==n)),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const o=e.multidimensionalDefinition.filter((e=>e.dimensionName===n)),a=null!=t.start?t.start.getTime():null,l=null!=t.end?t.end.getTime():null,u=null==a||null==l||a===l,p=u?[a||l]:[[a,l]],c=this.version>=10.8;if(o.length)o.forEach((e=>{e.dimensionName===n&&(c?(e.dimensionName=null,e.isSlice=!1,e.values=[]):(e.isSlice=u,e.values=p))}));else if(!c){const t=e.multidimensionalDefinition.filter((e=>null!=e.variableName&&null==e.dimensionName));t.length?t.forEach((e=>{e.dimensionName=n,e.isSlice=u,e.values=p})):e.multidimensionalDefinition.push(new x({variableName:"",dimensionName:n,isSlice:u,values:p}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return null==e?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter((e=>!(!e.variableName&&!e.dimensionName))),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this.sourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQuery)throw new a("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=null!=e?y(ue,e):this.createQuery(),t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:e,requestOptions:t}}async _initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new J;this._rasterJobHandler.connectionPromise=e.initialize().then((()=>{this._rasterJobHandler.instance=e}),(()=>{})),await this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null}_isSupportedRenderer(e){const{rasterInfo:t,rasterFunction:r}=this;return"unique-value"===e.type&&this._hasRasterFunction(r)&&1===t?.bandCount&&["u8","s8"].includes(t.pixelType)||null!=t&&null!=e&&L(t).includes(e.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){let t=this.sourceJSON;if(!t){const{data:r,ssl:i}=await n(g(this.parsedUrl),{query:this._getQueryParams(),signal:e});t=r,this.sourceJSON=t,i&&(this.url=this.url.replace(/^http:/i,"https:"))}if(t.capabilities?.toLowerCase().split(",").map((e=>e.trim())).indexOf("tilesonly")>-1)throw new a("imagery-layer:fetch-service-info","use ImageryTileLayer to open tiles-only image services");this.read(t,{origin:"service",url:this.parsedUrl})}_isMosaicDataset(e){return e.serviceSourceType?"esriImageServiceSourceTypeMosaicDataset"===e.serviceSourceType:e.fields?.length>0}_isMosaicRuleSupported(e){if(!e)return!1;const t=this._isMosaicDataset(e),r=e.currentVersion>=10.71&&e.hasMultidimensions&&!(e.fields?.length>1);return t||r}_isVectorFieldResampleFunction(e){if(null==e)return!1;const{functionName:t,functionArguments:r}=e,i="resample"===t?.toLowerCase(),s=r?.ResampleType||r?.resampleType;return i&&(7===s||10===s)}_isPicture(){return!this.format||this.format.includes("jpg")||this.format.includes("png")}_configRenderer(e){const t=this._isPicture(),{rasterInfo:r}=this;if(!t&&!this.pixelFilter||this._isVectorDataSet()){if(!this.bandIds&&r.bandCount>=3){const e=z(r);!e||3===r.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}e||(e=B(r,{bandIds:this.bandIds,variableName:this.rasterFunction?null:this.mosaicRule?.multidimensionalDefinition?.[0].variableName}));const t=k(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=t,this.symbolizer.rasterInfo=r):this.symbolizer=new G({rendererJSON:t,rasterInfo:r}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:null!=e.pixelBlock?e.pixelBlock.clone():null}}_getQueryParams(e){e&&null!=e.renderingRule&&"string"!=typeof e.renderingRule&&(e.renderingRule=this._getRenderingRuleString(e.renderingRule));const{raster:t,viewId:r}=this;return{raster:t,viewId:r,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...e?.query,...this.customParameters}}}_decodePixelBlock(e,t,r){return this._rasterJobHandler.instance?this._rasterJobHandler.instance.decode({data:e,options:t}):H(e,t,r)}async _getRasterFunctionInfos(e){const t=this.sourceJSON.rasterFunctionInfos;if(this.loaded)return t;if(t&&this.version>=10.3){if(1===t.length&&"none"===t[0].name.toLowerCase())return t;const r=await n(g(this.parsedUrl)+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e});return r.data?.rasterFunctionInfos}return null}_canRequestImageElement(e){return!this.pixelFilter&&(!e||e.includes("png"))}async _requestArrayBuffer(e){const{imageProps:t,requestAsImageElement:r,returnImageBitmap:i,signal:s}=e;if(r&&this._canRequestImageElement(t.format)){const r=`${g(this.parsedUrl)}/exportImage`,{data:o}=await n(r,{responseType:i?"blob":"image",query:this._getQueryParams({f:"image",...this.refreshParameters,...e.imageServiceParameters}),signal:s});if(o instanceof Blob){return{imageBitmap:await D(o,r,s),params:t}}return{imageOrCanvasElement:o,params:t}}const o=this._initJobHandler(),l=n(g(this.parsedUrl)+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:s}),u=(await Promise.all([l,o]))[0].data,p=t.format||"jpgpng";let c=p;if("bsq"!==c&&"bip"!==c&&(c=Q(u)),!c)throw new a("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(u)));const m={signal:s},d="gif"===p||"bmp"===p||p.includes("png")&&("png"===c||"jpg"===c)?H(u,{useCanvas:!0,...t},m):this._decodePixelBlock(u,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:p},m);return{pixelData:{pixelBlock:await d,extent:t.extent},params:t}}_generateRasterInfo(e,t){return this.generateRasterInfo(e,t).catch((()=>null))}_isValidCustomizedMosaicRule(e){return e&&JSON.stringify(e.toJSON())!==JSON.stringify(this.defaultMosaicRule?.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;let t=V(e,{multidimensionalSubset:this.multidimensionalSubset});if(null!=t&&t.length>0){this.mosaicRule=this.mosaicRule||new P;const e=this.mosaicRule.multidimensionalDefinition;!this.sourceJSON.defaultVariableName&&this.rasterFunction&&"none"!==this.rasterFunction.functionName?.toLowerCase()&&t.forEach((e=>e.variableName="")),t=t.filter((({variableName:e,dimensionName:t})=>e&&"*"!==e||t)),!e?.length&&t.length&&(this.mosaicRule.multidimensionalDefinition=t)}}_processVisibleRastersResponse(e,r){r=r||{};const i=e.value,{templateRRFunctionNames:s,showNoDataRecords:n,returnDomainValues:o,templateFields:a}=r,l=e.processedValues;let u=e.catalogItems&&e.catalogItems.features,p=e.properties&&e.properties.Values&&e.properties.Values.map((e=>e.replaceAll(/ /gi,", ")))||[];const c=this.objectIdField||"ObjectId",m="string"==typeof i&&i.toLowerCase().includes("nodata"),d=[];if(i&&!u&&!m){const e={};e[c]=0;p=[i],u=[new t(this.fullExtent,null,e)]}if(!u)return[];let h,f,y;this._updateResponseFieldNames(u,a),m&&!n&&(u=[]);for(let t=0;t<u.length;t++){if(h=u[t],null!=i){if(f=p[t],y=this.rasterFunction&&l&&l.length>0&&s&&s.length>0&&s.includes(this.rasterFunction.functionName)?l[s.indexOf(this.rasterFunction.functionName)]:i,"nodata"===f.toLowerCase()&&!n)continue;const e="Raster.ItemPixelValue",r="Raster.ServicePixelValue";h.attributes[e]=f,h.attributes[r]=y,this._updateFeatureWithMagDirValues(h,f);const o=this.fields&&this.fields.length>0;let a=this.rasterFunction&&null!=this.serviceRasterInfo.attributeTable?o?f:i:y;this.rasterFunction||(a=o?f:i),this._updateFeatureWithRasterAttributeTableValues(h,a)}if(h.sourceLayer=h.layer=this,o&&this._updateFeatureWithDomainValues(h),s&&l&&s.length===l.length)for(let e=0;e<s.length;e++){const t="Raster.ServicePixelValue."+s[e];h.attributes[t]=l[e]}d.push(u[t])}return d}_processMultidimensionalIntersection(e,t,r){const{multidimensionalSubset:i}=this;if(!i)return{isOutSide:!1,timeExtent:t,mosaicRule:r=this._combineMosaicRuleWithTimeExtent(r,t)};if(i){const{isOutside:r,intersection:s}=q(i,{geometry:e,timeExtent:t});if(r)return{isOutSide:!0,timeExtent:null,mosaicRule:null};s&&null!=s.timeExtent&&(t=s.timeExtent)}if(null!=(r=this._combineMosaicRuleWithTimeExtent(r,t))&&r.multidimensionalDefinition){const{isOutside:e}=q(i,{multidimensionalDefinition:r.multidimensionalDefinition});if(e)return{isOutSide:!0,timeExtent:null,mosaicRule:null}}return{isOutSide:!1,timeExtent:t,mosaicRule:r}}_updateFeatureWithRasterAttributeTableValues(e,t){const r=this.rasterInfo.attributeTable||this.serviceRasterInfo.attributeTable;if(null==r)return;const{features:i,fields:s}=r,n=s.map((e=>e.name)).filter((e=>"value"===e.toLowerCase())),o=n&&n[0];if(!o)return;const a=i.filter((e=>e.attributes[o]===(null!=t?parseInt(t,10):null)));a&&a[0]&&s.forEach((t=>{const r=this._rasterAttributeTableFieldPrefix+t.name;e.attributes[r]=a[0].attributes[t.name]}))}_updateFeatureWithMagDirValues(e,t){if(!this._isVectorDataSet())return;const r=t.split(/,\s*/).map((e=>parseFloat(e))),i=r.map((e=>[e])),s=r.map((e=>({minValue:e,maxValue:e,noDataValue:null}))),n=new O({height:1,width:1,pixelType:"f32",pixels:i,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new oe(0,0,0,0,this.spatialReference)});const o="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:U([n.pixels[0][0],n.pixels[1][0]]);e.attributes["Raster.Magnitude"]=o[0],e.attributes["Raster.Direction"]=o[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter((e=>e.domain&&"coded-value"===e.domain.type));null!=t&&t.forEach((t=>{const r=e.attributes[t.name];if(null!=r){const i=t.domain.codedValues.find((e=>e.code===r));i&&(e.attributes[t.name]=i.name)}}))}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const r=this.fieldsIndex;null!=r&&e.forEach((e=>{if(e&&e.attributes)for(const i of t){const t=r.get(i)?.name;t&&t!==i&&(e.attributes[i]=e.attributes[t],delete e.attributes[t])}}))}_getRenderingRuleString(e){if(e){let t=e.toJSON();return t=t.rasterFunctionDefinition??t,(t.thumbnail||t.thumbnailEx)&&(t.thumbnail=t.thumbnailEx=null),JSON.stringify(t)}return null}_hasRasterFunction(e){return null!=e&&null!=e.functionName&&"none"!==e.functionName.toLowerCase()}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if("Raw"===e)return e.replace("Raw","None");const r=e.toLowerCase().replaceAll(/ /gi,"_");return t.has(r)?t.get(r):e}_isRFTJson(e){return e&&e.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_isVectorDataSet(){return"esriImageServiceDataTypeVector-UV"===this.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===this.serviceDataType}_applyMosaicAndRenderingRules(e){const{raster:t,mosaicRule:r,rasterFunction:i}=this;i&&null==e.rasterFunction&&(e.rasterFunction=i),r&&null==e.mosaicRule&&(e.mosaicRule=r),t&&null==e.raster&&(e.raster=t)}_readCapabilities(e){const t=e.capabilities?e.capabilities.toLowerCase().split(",").map((e=>e.trim())):["image","catalog"],{currentVersion:r,advancedQueryCapabilities:i,maxRecordCount:s}=e,n=t.includes("image"),o="esriImageServiceDataTypeElevation"===e.serviceDataType,a=!!(e.spatialReference||e.extent&&e.extent.spatialReference),l=t.includes("edit"),u=t.includes("mensuration")&&a,p=null==e.mensurationCapabilities?[]:e.mensurationCapabilities.toLowerCase().split(",").map((e=>e.trim())),c=u&&p.includes("basic");return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:n,supportsExportImage:n,supportsIdentify:n,supportsMeasure:u,supportsDownload:t.includes("download"),supportsQuery:t.includes("catalog")&&e.fields&&e.fields.length>0,supportsGetSamples:r>=10.2&&n,supportsProject:r>=10.3&&n,supportsComputeStatisticsHistograms:r>=10.4&&n,supportsQueryBoundary:r>=10.6&&n,supportsCalculateVolume:r>=10.7&&o,supportsComputePixelLocation:r>=10.7&&t.includes("catalog"),supportsComputeAngles:r>=10.91,supportsAdd:l,supportsDelete:l,supportsEditing:l,supportsUpdate:l,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1,supportsQueryAnalytics:!1,supportsQueryTopFeatures:!1},query:{maxRecordCount:s,maxRecordCountFactor:void 0,supportsStatistics:!!i?.supportsStatistics,supportsOrderBy:!!i?.supportsOrderBy,supportsDistinct:!!i?.supportsDistinct,supportsPagination:!!i?.supportsPagination,supportsStandardizedQueriesOnly:!!i?.useStandardizedQueries,supportsPercentileStatistics:!!i?.supportsPercentileStatistics,supportsCentroid:!!i?.supportsReturningGeometryCentroid,supportsDistance:!!i?.supportsQueryWithDistance,supportsExtent:!!i?.supportsReturningQueryExtent,supportsGeometryProperties:!!i?.supportsReturningGeometryProperties,supportsHavingClause:!!i?.supportsHavingClause,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:!1,supportsTopFeaturesQuery:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!i?.supportsDefaultSR,supportsFullTextSearch:!1,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0},mensuration:{supportsDistanceAndAngle:c,supportsAreaAndPerimeter:c,supportsPointOrCentroid:c,supportsHeightFromBaseAndTop:u&&p.includes("base-top height"),supportsHeightFromBaseAndTopShadow:u&&p.includes("base-top shadow height"),supportsHeightFromTopAndTopShadow:u&&p.includes("top-top shadow height"),supports3D:u&&p.includes("3d")}}}};function g(e){return e?.path??""}return e([d()],h.prototype,"_functionRasterInfos",void 0),e([d()],h.prototype,"_rasterJobHandler",void 0),e([d()],h.prototype,"_cachedRendererJson",void 0),e([d({readOnly:!0})],h.prototype,"_serviceSupportsMosaicRule",void 0),e([R("_serviceSupportsMosaicRule",["currentVersion","fields"])],h.prototype,"readServiceSupportsMosaicRule",null),e([d()],h.prototype,"_rasterAttributeTableFieldPrefix",void 0),e([d({readOnly:!0})],h.prototype,"_rasterFunctionNamesIndex",null),e([d()],h.prototype,"adjustAspectRatio",void 0),e([d({type:[f],json:{write:!0}})],h.prototype,"bandIds",void 0),e([R("bandIds")],h.prototype,"readBandIds",null),e([d({readOnly:!0,json:{read:!1}})],h.prototype,"capabilities",void 0),e([R("service","capabilities",["capabilities","currentVersion","serviceDataType"])],h.prototype,"readCapabilities",null),e([d({type:Number})],h.prototype,"compressionQuality",void 0),e([S("compressionQuality")],h.prototype,"writeCompressionQuality",null),e([d({type:Number})],h.prototype,"compressionTolerance",void 0),e([S("compressionTolerance")],h.prototype,"writeCompressionTolerance",null),e([d({json:{read:{source:"copyrightText"}}})],h.prototype,"copyright",void 0),e([d({readOnly:!0,dependsOn:["_serviceSupportsMosaicRule"]})],h.prototype,"defaultMosaicRule",void 0),e([R("defaultMosaicRule",["defaultMosaicMethod"])],h.prototype,"readDefaultMosaicRule",null),e([d({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],h.prototype,"definitionExpression",void 0),e([d({readOnly:!0,constructOnly:!0})],h.prototype,"exportImageServiceParameters",void 0),e([d()],h.prototype,"rasterInfo",void 0),e([d({readOnly:!0,type:[_]})],h.prototype,"fields",void 0),e([d({readOnly:!0})],h.prototype,"fieldsIndex",null),e([d({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"],json:{write:!0}})],h.prototype,"format",null),e([R("service","format",["serviceDataType"])],h.prototype,"readFormat",null),e([d({type:oe})],h.prototype,"fullExtent",void 0),e([d({readOnly:!0})],h.prototype,"hasMultidimensions",void 0),e([d({json:{read:{source:"maxImageHeight"}}})],h.prototype,"imageMaxHeight",void 0),e([d({json:{read:{source:"maxImageWidth"}}})],h.prototype,"imageMaxWidth",void 0),e([d({type:String,json:{type:N.jsonValues,read:N.read,write:N.write}})],h.prototype,"interpolation",void 0),e([d()],h.prototype,"minScale",void 0),e([R("service","minScale")],h.prototype,"readMinScale",null),e([d()],h.prototype,"maxScale",void 0),e([R("service","maxScale")],h.prototype,"readMaxScale",null),e([d({type:P})],h.prototype,"mosaicRule",null),e([R("mosaicRule",["mosaicRule","defaultMosaicMethod"])],h.prototype,"readMosaicRule",null),e([S("mosaicRule")],h.prototype,"writeMosaicRule",null),e([d()],h.prototype,"multidimensionalInfo",void 0),e([d({type:T,json:{write:!0}})],h.prototype,"multidimensionalSubset",void 0),e([d({json:{type:f}})],h.prototype,"noData",void 0),e([S("noData")],h.prototype,"writeNoData",null),e([d({type:String,json:{type:C.jsonValues,read:C.read,write:C.write}})],h.prototype,"noDataInterpretation",void 0),e([d({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],h.prototype,"objectIdField",void 0),e([R("objectIdField")],h.prototype,"readObjectIdField",null),e([d({})],h.prototype,"geometryType",void 0),e([d({})],h.prototype,"typeIdField",void 0),e([d({})],h.prototype,"types",void 0),e([d({readOnly:!0})],h.prototype,"parsedUrl",null),e([d({type:Function})],h.prototype,"pixelFilter",void 0),e([d()],h.prototype,"raster",void 0),e([d({readOnly:!0})],h.prototype,"sourceType",void 0),e([R("sourceType",["serviceSourceType","fields"])],h.prototype,"readSourceType",null),e([d()],h.prototype,"viewId",void 0),e([d({types:r,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:i,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],h.prototype,"renderer",null),e([R("renderer")],h.prototype,"readRenderer",null),e([S("renderer")],h.prototype,"writeRenderer",null),e([d()],h.prototype,"symbolizer",void 0),e([d(v)],h.prototype,"opacity",void 0),e([d({readOnly:!0})],h.prototype,"rasterFields",null),e([d({constructOnly:!0})],h.prototype,"rasterFunctionInfos",void 0),e([d({type:M})],h.prototype,"renderingRule",null),e([d({type:M,json:{name:"renderingRule"}})],h.prototype,"rasterFunction",null),e([R("rasterFunction",["renderingRule","rasterFunctionInfos"])],h.prototype,"readRasterFunction",null),e([S("rasterFunction")],h.prototype,"writeRasterFunction",null),e([d()],h.prototype,"serviceDataType",void 0),e([d({readOnly:!0,type:_e})],h.prototype,"spatialReference",void 0),e([R("spatialReference",["spatialReference","extent"])],h.prototype,"readSpatialReference",null),e([d({json:{type:Fe.jsonValues}})],h.prototype,"pixelType",void 0),e([R("pixelType")],h.prototype,"readPixelType",null),e([S("pixelType")],h.prototype,"writePixelType",null),e([d({constructOnly:!0,type:A})],h.prototype,"serviceRasterInfo",void 0),e([d()],h.prototype,"sourceJSON",void 0),e([d(w)],h.prototype,"url",void 0),e([d({readOnly:!0})],h.prototype,"version",void 0),e([R("version",["currentVersion","fields","timeInfo"])],h.prototype,"readVersion",null),h=e([b("esri.layers.mixins.ArcGISImageService")],h),h};export{Te as ArcGISImageService};
@@ -0,0 +1,4 @@
1
+ import "../../interfaces";
2
+
3
+ import RasterBandInfo = __esri.RasterBandInfo;
4
+ export default RasterBandInfo;
@@ -0,0 +1,4 @@
1
+ import "../../interfaces";
2
+
3
+ import RasterSensorInfo = __esri.RasterSensorInfo;
4
+ export default RasterSensorInfo;
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- const n=[["binary","application/octet-stream","bin",""]];function t(n){return o(n?.supportedFormats??[]).flatMap(p).map((n=>`.${n}`))}function r(n,t){return s(f(n,t))}function u(n,t){return s(c(n,t))}function e(n,t){return a(i(n,t))}function o(t){return[...n,...t]}function i(n,t){return o(t).find((t=>s(t)===n))}function f(n,t){return o(t).find((t=>a(t)===n))}function c(n,t){const r=n.toLowerCase();return o(t).find((n=>p(n).some((n=>r.endsWith(n)))))}function s(n){return n?.[0]}function a(n){return n?.[1]}function p(n){return n?.[2].split(",")??[]}function d(n){return n?.[3]}function l(n){return n.tables?.find((n=>"assetMaps"===n.role))}export{l as getAssetMapTable,u as getFilenameFormatId,d as getFormatDescription,p as getFormatExtensions,s as getFormatId,e as getFormatIdMimeType,a as getFormatMimeType,r as getMimeTypeFormatId,t as getSupportedExtensions};
5
+ const n=[["binary","application/octet-stream","bin",""]];function t(n){return i(n?.supportedFormats??[]).flatMap(d).map((n=>`.${n}`))}function r(n){const t={};for(const r of i(n?.supportedFormats??[])){const n=p(r),o=d(r).map((n=>`.${n}`));t[n]??=[],t[n].push(...o)}return[{description:"3D Models",accept:t}]}function o(n,t){return a(f(n,t))}function u(n,t){return a(s(n,t))}function e(n,t){return p(c(n,t))}function i(t){return[...n,...t]}function c(n,t){return i(t).find((t=>a(t)===n))}function f(n,t){return i(t).find((t=>p(t)===n))}function s(n,t){const r=n.toLowerCase();return i(t).find((n=>d(n).some((n=>r.endsWith(n)))))}function a(n){return n?.[0]}function p(n){return n?.[1]}function d(n){return n?.[2].split(",")??[]}function l(n){return n?.[3]}function m(n){return n.tables?.find((n=>"assetMaps"===n.role))}export{m as getAssetMapTable,r as getFilePickerAcceptTypes,u as getFilenameFormatId,l as getFormatDescription,d as getFormatExtensions,a as getFormatId,e as getFormatIdMimeType,p as getFormatMimeType,o as getMimeTypeFormatId,t as getSupportedExtensions};