@arcgis/core 4.31.0-next.20240708 → 4.31.0-next.20240709

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 (159) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{0975e54c50383375cc09.js → 14cf7411e8318a1bccb9.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{71852b8437ec66b9ef06.js → 2123ab24163a532ebc8d.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{c91b3800cf3891bf2d59.js → 252ff37bf5e12dae0b18.js} +1 -1
  5. package/assets/esri/core/workers/chunks/2799007b5f3f4a2e364c.js +51 -0
  6. package/assets/esri/core/workers/chunks/{ff5e6d823d512f87a527.js → 2dddb8a989b9c96572fe.js} +1 -1
  7. package/assets/esri/core/workers/chunks/3375de864347a847393d.js +1042 -0
  8. package/assets/esri/core/workers/chunks/543f9db420c99d429637.js +1 -0
  9. package/assets/esri/core/workers/chunks/{812e18c65aa6e398c338.js → 5b6c89dc41067d81c952.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{5089a12084a8a8fb93d8.js → 61e5179fb49866241128.js} +1 -1
  11. package/assets/esri/core/workers/chunks/632e3ba2b8a881df29a0.js +1 -0
  12. package/assets/esri/core/workers/chunks/{1cc4a89c96a36d6b3d52.js → 7767559d56d16b644655.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{43e83f4d827f59ff556a.js → 8087288f00dfdcc479b9.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{a5fbe1c95e49093e5af4.js → 8cce4b218568638e6e64.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{c7e2a97cb7bcd153bcef.js → 8e326def543268f8a08e.js} +1 -1
  16. package/assets/esri/core/workers/chunks/92cb45b18e151db007dc.js +1 -0
  17. package/assets/esri/core/workers/chunks/b2e8cc76381077b78d4c.js +1 -0
  18. package/assets/esri/core/workers/chunks/b6a8132708afcd988fa9.js +1 -0
  19. package/assets/esri/core/workers/chunks/{b4d850e82a8ae902d684.js → c44cc686774ff53c0a94.js} +1 -1
  20. package/assets/esri/core/workers/chunks/c52701477405c1fb2072.js +1 -0
  21. package/assets/esri/core/workers/chunks/{9ed11b9202013ca001ee.js → cfc2a1858a8bbb284979.js} +2 -2
  22. package/assets/esri/core/workers/chunks/{9ed11b9202013ca001ee.js.LICENSE.txt → cfc2a1858a8bbb284979.js.LICENSE.txt} +1 -1
  23. package/assets/esri/core/workers/chunks/d9863289c69d2550cd49.js +1 -0
  24. package/assets/esri/core/workers/chunks/e1f4df3a5b0b31521b3c.js +1 -0
  25. package/assets/esri/core/workers/chunks/{61505947371cebab9cbe.js → fdebfe55cd097714ec11.js} +1 -1
  26. package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +13 -18
  27. package/assets/esri/themes/dark/main.css +1 -1
  28. package/assets/esri/themes/light/main.css +1 -1
  29. package/assets/esri/themes/light/view.css +1 -1
  30. package/chunks/AtmosphereCompositing.glsl.js +6 -9
  31. package/chunks/BlendLayers.glsl.js +1 -7
  32. package/chunks/BlendWeights.glsl.js +45 -51
  33. package/chunks/Blur.glsl.js +1 -3
  34. package/chunks/ChapmanAtmosphere.glsl.js +3 -8
  35. package/chunks/CheckerBoard.glsl.js +3 -9
  36. package/chunks/Clouds.glsl.js +21 -10
  37. package/chunks/CloudsComposition.glsl.js +3 -7
  38. package/chunks/ColorMaterial.glsl.js +3 -9
  39. package/chunks/ComponentShader.glsl.js +35 -50
  40. package/chunks/Compositing.glsl.js +5 -7
  41. package/chunks/DefaultMaterial.glsl.js +68 -73
  42. package/chunks/EdgeDetect.glsl.js +5 -10
  43. package/chunks/EdgeShader.glsl.js +37 -60
  44. package/chunks/Fog.glsl.js +4 -9
  45. package/chunks/HUDCompositing.glsl.js +1 -3
  46. package/chunks/HUDMaterial.glsl.js +8 -14
  47. package/chunks/Heatmap.glsl.js +4 -7
  48. package/chunks/HeatmapDensity.glsl.js +5 -11
  49. package/chunks/HighlightApply.glsl.js +133 -152
  50. package/chunks/HighlightDownsample.glsl.js +29 -32
  51. package/chunks/ImageMaterial.glsl.js +11 -21
  52. package/chunks/LaserlinePath.glsl.js +4 -9
  53. package/chunks/LineCallout.glsl.js +91 -108
  54. package/chunks/LineMarker.glsl.js +2 -8
  55. package/chunks/Magnifier.glsl.js +4 -9
  56. package/chunks/MeasurementArrow.glsl.js +9 -15
  57. package/chunks/NativeLine.glsl.js +8 -12
  58. package/chunks/NoiseTextureAtlas.glsl.js +89 -86
  59. package/chunks/OITCompositing.glsl.js +2 -3
  60. package/chunks/OverlayCompositing.glsl.js +2 -4
  61. package/chunks/Path.glsl.js +31 -55
  62. package/chunks/Pattern.glsl.js +16 -20
  63. package/chunks/PointRenderer.glsl.js +39 -48
  64. package/chunks/Precipitation.glsl.js +15 -27
  65. package/chunks/RasterColorizer.glsl.js +25 -33
  66. package/chunks/RealisticTree.glsl.js +53 -65
  67. package/chunks/SSAO.glsl.js +7 -10
  68. package/chunks/SSAOBlur.glsl.js +10 -14
  69. package/chunks/ShadedColorMaterial.glsl.js +12 -15
  70. package/chunks/ShadowCastAccumulate.glsl.js +2 -4
  71. package/chunks/ShadowCastVisualize.glsl.js +12 -19
  72. package/chunks/ShadowHighlight.glsl.js +46 -50
  73. package/chunks/SimpleAtmosphere.glsl.js +4 -13
  74. package/chunks/SlicePlaneMaterial.glsl.js +3 -7
  75. package/chunks/Stars.glsl.js +3 -7
  76. package/chunks/Terrain.glsl.js +20 -61
  77. package/chunks/TextureOnly.glsl.js +2 -4
  78. package/chunks/Viewshed.glsl.js +20 -38
  79. package/chunks/WaterSurface.glsl.js +34 -60
  80. package/core/workers/registry.js +1 -1
  81. package/interfaces.d.ts +34 -4
  82. package/layers/WCSLayer.js +1 -1
  83. package/layers/support/SubtypeSublayer.js +1 -1
  84. package/layers/support/rasterDatasets/WCSRaster.js +1 -1
  85. package/layers/support/rasterDatasets/multidimensionalUtils.js +1 -1
  86. package/layers/support/rasterDatasets/wcsCoverageParser.js +1 -1
  87. package/package.json +3 -3
  88. package/support/revision.js +1 -1
  89. package/views/2d/engine/webgl/shaderGraph/ShaderBuilder2D.js +1 -1
  90. package/views/2d/engine/webgl/shaderGraph/techniques/FeatureInstanceStore.js +1 -1
  91. package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityTechnique.js +1 -1
  92. package/views/2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapTechnique.js +1 -1
  93. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  94. package/views/3d/interactive/editingTools/transform/extentTransform/extentUtils.js +1 -1
  95. package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
  96. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  97. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  98. package/views/3d/layers/StreamLayerView3D.js +1 -1
  99. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  100. package/views/3d/layers/graphics/Graphics3DGraphicsPipeline.js +1 -1
  101. package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +5 -0
  102. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +5 -0
  103. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +5 -0
  104. package/views/3d/layers/graphics/pipeline/PBFPointFeaturesView.js +5 -0
  105. package/views/3d/layers/graphics/pipeline/TestSymbol.js +5 -0
  106. package/views/3d/layers/graphics/pipeline/Tile.js +5 -0
  107. package/views/3d/layers/graphics/pipeline/Tile3DFetcher.js +5 -0
  108. package/views/3d/layers/graphics/pipeline/Tile3DProcessor.js +5 -0
  109. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  110. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  111. package/views/3d/layers/support/projectExtentUtils.js +1 -1
  112. package/views/3d/terrain/OverlayRenderer.js +1 -1
  113. package/views/3d/terrain/TerrainRenderer.js +1 -1
  114. package/views/3d/terrain/TileCompositor.js +1 -1
  115. package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
  116. package/views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js +3 -5
  117. package/views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js +3 -3
  118. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +29 -59
  119. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUDOcclusionPass.glsl.js +6 -12
  120. package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceReflections.glsl.js +1 -1
  121. package/views/3d/webgl-engine/core/shaderLibrary/shading/TextureTransformUV.glsl.js +6 -6
  122. package/views/3d/webgl-engine/core/shaderLibrary/shading/Water.glsl.js +2 -2
  123. package/views/3d/webgl-engine/core/shaderLibrary/terrain/TileComposite.glsl.js +2 -4
  124. package/views/3d/webgl-engine/core/shaderLibrary/util/LocalFromScreenSpace.glsl.js +2 -2
  125. package/views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js +1 -1
  126. package/views/3d/webgl-engine/effects/blit/Blit.js +1 -1
  127. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  128. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  129. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  130. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  131. package/views/3d/webgl-engine/lib/DrapedHeatmapRenderer.js +1 -1
  132. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  133. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  134. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  135. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  136. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  137. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  138. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  139. package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
  140. package/views/3d/webgl-engine/materials/DrawParameters.js +1 -1
  141. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  142. package/views/SceneView.js +1 -1
  143. package/views/webgl/RenderingContext.js +1 -1
  144. package/views/webgl/enums.js +1 -1
  145. package/views/webgl/heatmapTextureUtils.js +1 -1
  146. package/views/webgl/testSVGPremultipliedAlpha.js +1 -1
  147. package/widgets/ElevationProfile/ElevationProfileController.js +1 -1
  148. package/widgets/FeatureForm.js +1 -1
  149. package/widgets/OrientedImageryViewer/constants.js +1 -1
  150. package/widgets/OrientedImageryViewer.js +1 -1
  151. package/assets/esri/core/workers/chunks/0cb2eb96ffb1dbed00eb.js +0 -1
  152. package/assets/esri/core/workers/chunks/0d6ed27fc9948f4ea061.js +0 -1
  153. package/assets/esri/core/workers/chunks/225b947ba4b2fcfd5630.js +0 -1
  154. package/assets/esri/core/workers/chunks/7c7c3068da3bf7467685.js +0 -1
  155. package/assets/esri/core/workers/chunks/85e5cdd723f68dec8c25.js +0 -1
  156. package/assets/esri/core/workers/chunks/aed0db145187d9eb52f2.js +0 -51
  157. package/assets/esri/core/workers/chunks/cf9a32a03b3d3b66effb.js +0 -1
  158. package/assets/esri/core/workers/chunks/e840e54455eb500b501d.js +0 -1098
  159. package/assets/esri/core/workers/chunks/fec53ce15ae52f8cb802.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{createTask as o}from"../../core/asyncUtils.js";import{handlesGroup as s}from"../../core/handleUtils.js";import{abortMaybe as r}from"../../core/maybe.js";import{memoize as i}from"../../core/memoize.js";import{ignoreAbortErrors as a,throwIfAborted as l,throwIfAbortError as n}from"../../core/promiseUtils.js";import{watch as p,syncAndInitial as m}from"../../core/reactiveUtils.js";import{throttle as d}from"../../core/throttle.js";import{property as h}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import{hasGraphicFeatureExpressionInfo as c,getGraphicEffectiveElevationInfo as f}from"../../support/elevationInfoUtils.js";import{getConfig as _}from"./support/constants.js";import{isPolyline as P,isValidInputPath as v}from"./support/geometryUtils.js";import{generateProfiles as g}from"./support/profileUtils.js";const M="line-change";let y=class extends t{constructor(e){super(e),this._updateTask=null,this._paramsPerProfile=new Map,this._getUpdateParametersMemoized=i(((e,t,o)=>({stationary:e,visibleProfiles:t,generationParameters:o}))),this._getGenerationParametersMemoized=i(((e,t,o,s,r,i,a)=>P(t)&&v(t)&&null!=s?{view:e,geometry:t,elevationInfo:o,options:i,queue:s,cache:r,slicePlane:a}:null)),this._getElevationInfoMemoized=i(((e,t)=>({mode:e,offset:t}))),this._getOptionsMemoized=i(((e,t,o)=>{const{densificationMaxSamples:s,maxTotalSamples:r}=_();return{geodesicDistanceThreshold:e,samplingDistance:t,densificationMaxSamples:Math.round(s/o),maxTotalSamples:r}})),this._updateThrottled=d((e=>a(this._update(e))),_().updateThrottleMillis)}initialize(){const e=this.viewModel;this.addHandles([p((()=>e.profiles.toArray()),(e=>{this._abortUpdate(),this._paramsPerProfile.clear(),this.removeHandles(M),this.addHandles(e.map((e=>s([e.attach(this.viewModel),e.on("change",(()=>{this._invalidateProfile(e)}))]))),M)}),m),this._updateThrottled,p((()=>this._updateParameters),this._updateThrottled,m)])}destroy(){this._paramsPerProfile.clear()}get _updateParameters(){const{viewModel:e}=this,t=e.view;return this._getUpdateParametersMemoized(null==t||t.stationary,this.viewModel.visibleProfiles,this._generationParameters)}get _generationParameters(){const{view:e,input:t,queue:o,tileCache:s}=this.viewModel;return null!=e&&e.ready?this._getGenerationParametersMemoized(e,t?.geometry,this._elevationInfo,o,s,this._options,"3d"===e.type?e.slicePlane:null):null}get _elevationInfo(){const e=this.viewModel.input,t=e?c(e)?null:f(e):null;return null!=t?this._getElevationInfoMemoized(t.mode,t.offset):null}get _options(){const e=this.viewModel,t=e.visibleProfiles.length;let o=e.minDemResolution??_().defaultDemResolution;return o=parseFloat(o.toFixed(2)),this._getOptionsMemoized(e.geodesicDistanceThreshold,o,t)}async _update({stationary:e,visibleProfiles:t,generationParameters:s}){this._abortUpdate(),e&&(null!=s?this._updateTask=o((async e=>{this.viewModel.error=null;const o=t.filter((e=>!this._isProfileValid(e,s))),r=g({...s,providers:o},{signal:e});try{for await(const t of r){l(e),this._clearInvalidResults(s);for(let e=0;e<o.length;e++)o[e].result=t[e]}for(const e of o)this._paramsPerProfile.set(e,s)}catch(i){n(i),this._abortUpdate(),this.viewModel.error=i,o.forEach((e=>{e.result=null}))}})):this._clearResults())}_abortUpdate(){this._updateTask=r(this._updateTask)}_isProfileValid(e,t){return this._paramsPerProfile.has(e)&&this._paramsPerProfile.get(e)===t}_invalidateProfile(e){this._paramsPerProfile.delete(e),this._updateThrottled(this._updateParameters)}_clearInvalidResults(e){for(const t of this.viewModel.profiles.items)this._isProfileValid(t,e)||(t.result=null,this._paramsPerProfile.delete(t))}_clearResults(){for(const e of this.viewModel.profiles.items)e.result=null,this._paramsPerProfile.delete(e)}};e([h({nonNullable:!0})],y.prototype,"viewModel",void 0),e([h()],y.prototype,"_updateParameters",null),e([h()],y.prototype,"_generationParameters",null),e([h()],y.prototype,"_elevationInfo",null),e([h()],y.prototype,"_options",null),y=e([u("esri.widgets.ElevationProfile.ElevationProfileController")],y);export{y as ElevationProfileController};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{createTask as o}from"../../core/asyncUtils.js";import{handlesGroup as s}from"../../core/handleUtils.js";import{abortMaybe as i}from"../../core/maybe.js";import{memoize as r}from"../../core/memoize.js";import{ignoreAbortErrors as l,throwIfAborted as a,throwIfAbortError as n}from"../../core/promiseUtils.js";import{watch as p,syncAndInitial as m}from"../../core/reactiveUtils.js";import{throttle as d}from"../../core/throttle.js";import{property as h}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import{hasGraphicFeatureExpressionInfo as c,getGraphicEffectiveElevationInfo as f}from"../../support/elevationInfoUtils.js";import{getConfig as _}from"./support/constants.js";import{isPolyline as P,isValidInputPath as v}from"./support/geometryUtils.js";import{generateProfiles as g}from"./support/profileUtils.js";const M=Symbol("line-change");let y=class extends t{constructor(e){super(e),this._updateTask=null,this._paramsPerProfile=new Map,this._getUpdateParametersMemoized=r(((e,t,o)=>({stationary:e,visibleProfiles:t,generationParameters:o}))),this._getGenerationParametersMemoized=r(((e,t,o,s,i,r,l)=>P(t)&&v(t)&&null!=s?{view:e,geometry:t,elevationInfo:o,options:r,queue:s,cache:i,slicePlane:l}:null)),this._getElevationInfoMemoized=r(((e,t)=>({mode:e,offset:t}))),this._getOptionsMemoized=r(((e,t,o)=>{const{densificationMaxSamples:s,maxTotalSamples:i}=_();return{geodesicDistanceThreshold:e,samplingDistance:t,densificationMaxSamples:Math.round(s/o),maxTotalSamples:i}})),this._updateThrottled=d((e=>l(this._update(e))),_().updateThrottleMillis)}initialize(){const e=this.viewModel;this.addHandles([p((()=>({visible:e.visible,profiles:e.profiles.toArray()})),(({visible:e,profiles:t})=>{this._abortUpdate(),this._paramsPerProfile.clear(),this.removeHandles(M),e&&0!==t.length&&this.addHandles([...t.map((e=>s([e.attach(this.viewModel),e.on("change",(()=>{this._invalidateProfile(e)}))]))),p((()=>this._updateParameters),this._updateThrottled,m),this._updateThrottled],M)}),m)])}destroy(){this._paramsPerProfile.clear()}get _updateParameters(){const{viewModel:e}=this,t=e.view;return this._getUpdateParametersMemoized(null==t||t.stationary,this.viewModel.visibleProfiles,this._generationParameters)}get _generationParameters(){const{view:e,input:t,queue:o,tileCache:s}=this.viewModel;return null!=e&&e.ready?this._getGenerationParametersMemoized(e,t?.geometry,this._elevationInfo,o,s,this._options,"3d"===e.type?e.slicePlane:null):null}get _elevationInfo(){const e=this.viewModel.input,t=e?c(e)?null:f(e):null;return null!=t?this._getElevationInfoMemoized(t.mode,t.offset):null}get _options(){const e=this.viewModel,t=e.visibleProfiles.length;let o=e.minDemResolution??_().defaultDemResolution;return o=parseFloat(o.toFixed(2)),this._getOptionsMemoized(e.geodesicDistanceThreshold,o,t)}async _update({stationary:e,visibleProfiles:t,generationParameters:s}){this._abortUpdate(),e&&(null!=s?this._updateTask=o((async e=>{this.viewModel.error=null;const o=t.filter((e=>!this._isProfileValid(e,s))),i=g({...s,providers:o},{signal:e});try{for await(const t of i){a(e),this._clearInvalidResults(s);for(let e=0;e<o.length;e++)o[e].result=t[e]}for(const e of o)this._paramsPerProfile.set(e,s)}catch(r){n(r),this._abortUpdate(),this.viewModel.error=r,o.forEach((e=>{e.result=null}))}})):this._clearResults())}_abortUpdate(){this._updateTask=i(this._updateTask)}_isProfileValid(e,t){return this._paramsPerProfile.has(e)&&this._paramsPerProfile.get(e)===t}_invalidateProfile(e){this._paramsPerProfile.delete(e),this._updateThrottled(this._updateParameters)}_clearInvalidResults(e){for(const t of this.viewModel.profiles.items)this._isProfileValid(t,e)||(t.result=null,this._paramsPerProfile.delete(t))}_clearResults(){for(const e of this.viewModel.profiles.items)e.result=null,this._paramsPerProfile.delete(e)}};e([h({nonNullable:!0})],y.prototype,"viewModel",void 0),e([h()],y.prototype,"_updateParameters",null),e([h()],y.prototype,"_generationParameters",null),e([h()],y.prototype,"_elevationInfo",null),e([h()],y.prototype,"_options",null),y=e([u("esri.widgets.ElevationProfile.ElevationProfileController")],y);export{y as ElevationProfileController};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{isSome as t}from"../core/arrayUtils.js";import"../core/has.js";import i from"../core/Logger.js";import{createResolver as o}from"../core/promiseUtils.js";import{watch as n,whenOnce as a}from"../core/reactiveUtils.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import{isIntegerField as l}from"../layers/support/fieldUtils.js";import d from"./Widget.js";import{Prompt as p}from"./Editor/components/Prompt.js";import{css as u}from"./FeatureForm/css.js";import{isGroupInput as c,isFieldInput as m,isRelationshipInput as h,isTextElementInput as v,flattenInputs as g,isInputInGroupInput as _,isFieldElementWithInputType as b,getErrorMessageForFieldInput as C,getIconForFeature as f,isNumberFieldInput as y,subtypeChangeShouldPrompt as F}from"./FeatureForm/featureFormUtils.js";import w from"./FeatureForm/FeatureFormViewModel.js";import{loadCalciteComponents as R}from"./support/componentsUtils.js";import{isString as O}from"./support/dataUtils.js";import{getLabelForDateFieldValue as k,getIntlOptionsForField as I,numberingSystem as x,prepareISOFieldValueForDateComponents as M,prepareUnixFieldValueForDateComponents as D,normalizeTimeOnlyString as N,getISOFieldValueFromDateComponents as V,getUnixFieldValueFromDateComponents as T}from"./support/dateUtils.js";import{globalCss as L}from"./support/globalCss.js";import{Heading as S,incrementHeadingLevel as j}from"./support/Heading.js";import"./support/widgetUtils.js";import{messageBundle as E}from"./support/decorators/messageBundle.js";import{vmEvent as U}from"./support/decorators/vmEvent.js";import{tsx as P}from"./support/jsxFactory.js";import{substitute as A}from"../intl/substitute.js";const $="data-field-name";let H=class extends d{constructor(e,t){super(e,t),this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._inputsWithChanges=new Set,this._focusedFieldName=null,this._pendingSubtypeChoice=null,this._listObserverNode=null,this._listObserver=new IntersectionObserver((e=>{e.length&&e[0].isIntersecting&&this._incrementRelatedRecordPage()}),{root:window.document}),this._prompt=null,this.groupDisplay="all",this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.messagesFeature=null,this.messagesTemplates=null,this.viewModel=new w,this._onShowAllRelatedRecordsClick=e=>{const{feature:t,relatedRecordCallbacks:i}=this;t&&i?.showAllRelatedRecords&&i.showAllRelatedRecords({parentFeature:t,relationshipId:e})},this._onAddRelatedRecordsClick=(e,t)=>{const{feature:i,relatedRecordCallbacks:o}=this;i&&o?.addRelatedRecord&&o.addRelatedRecord({parentFeature:i,relatedLayer:t,relationshipId:e})},this._onFormKeyDown=this._onFormKeyDown.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onGroupToggle=this._onGroupToggle.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentKeyDown=this._onComponentKeyDown.bind(this),this._afterComponentCreate=this._afterComponentCreate.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterDateComponentCreateOrUpdate=this._afterDateComponentCreateOrUpdate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this)}initialize(){this.addHandles([n((()=>this.feature),(()=>{this._inputsWithChanges.clear(),this._dateComponentMap.clear(),a((()=>!this.viewModel.updating)).then((()=>{const e=this._getFocusableInput("forward");this._syncGroupInputStates(),this._focusedFieldName=e?.name||null,this._attemptFocusOnNextRender=!0}))})),n((()=>this.groupDisplay),(()=>this._syncGroupInputStates())),this.on("submit",(e=>{if(e.invalid.length>0){const[t]=e.invalid;e.invalid.forEach((e=>this._inputsWithChanges.add(e))),this._focusedFieldName=t,this._attemptFocusOnNextRender=!0,this.scheduleRender()}})),n((()=>[this.viewModel.activeRelationshipInput,this._listObserverNode]),(()=>this._onObserverChange()))])}loadDependencies(){return R({block:()=>import("@esri/calcite-components/dist/components/calcite-block.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox.js"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item.js"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),input:()=>import("@esri/calcite-components/dist/components/calcite-input.js"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker.js"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message.js"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number.js"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker.js"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button.js"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group.js"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch.js"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area.js")})}destroy(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode)}get _relatedRecordsEnabled(){const e=this.relatedRecordCallbacks;return!(!e||!(e.addRelatedRecord||e.editRelatedRecord||e.showAllRelatedRecords))}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get feature(){return this.viewModel.feature}set feature(e){this.viewModel.feature=e}get formTemplate(){return this.viewModel.formTemplate}set formTemplate(e){this.viewModel.formTemplate=e}get icon(){return"form-field"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get relatedRecordCallbacks(){return this.viewModel.relatedRecordCallbacks}set relatedRecordCallbacks(e){this.viewModel.relatedRecordCallbacks=e}get relationshipId(){return this.viewModel.relationshipId}set relationshipId(e){this.viewModel.relationshipId=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get strict(){return this.viewModel.strict}set strict(e){this.viewModel.strict=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get showPrompt(){return e=>{this._prompt?.cancel?.(),this._prompt=e}}set showPrompt(e){this._overrideIfSome("showPrompt",e)}get clearPrompt(){return()=>this._prompt=null}set clearPrompt(e){this._overrideIfSome("clearPrompt",e)}getValues(){return this.viewModel.getValues()}submit(){return this.viewModel.submit()}render(){const{state:e}=this.viewModel;return P("div",{class:this.classes(u.base,L.widget,L.panel)},"ready"===e?this._renderForm():null)}_renderForm(){return P("div",null,P("form",{class:u.form,novalidate:!0,onkeydown:this._onFormKeyDown,onsubmit:this._onFormSubmit},this._renderHeader(),this._renderContent()),this._prompt?P(p,{...this._prompt,headingLevel:this.headingLevel}):void 0)}_renderHeader(){const e=this.viewModel;if(!e.formHeaderVisible)return;const t=null!=e.formTitle&&P(S,{key:"title",level:this.headingLevel},e.formTitle),i=null!=e.formDescription&&P("p",{class:u.description,key:"description"},e.formDescription);return P("div",{class:u.formHeader},t,i)}_renderContent(){const{viewModel:e}=this;return e.activeRelationshipInput?this._renderRelationshipInput(e.activeRelationshipInput):e.inputs.filter(t).filter((e=>e.visible)).map((e=>this._renderInput(e)))}_renderInput(e){return c(e)?this._renderGroup(e):m(e)?this._renderLabeledField(e):h(e)?this._renderRelationshipInput(e):v(e)?this._renderTextElementInput(e):void 0}_renderDescriptionOrEmpty(e,t){return null==e?null:P("div",{class:this.classes(u.description),id:t},e)}_renderGroup(e){const{disabled:t,formTemplate:i,headingLevel:o}=this,{description:n,id:a,inputs:s,label:r,open:l}=e,d=s.filter((e=>e.visible)),p=this.viewModel.findField(this._focusedFieldName),c=p?.group===e,m="sequential"===this.groupDisplay;return P("calcite-block",{class:this.classes(u.group,m?u.groupSequential:null,c?u.groupActive:null,t?u.inputDisabled:null),collapsible:!0,"data-group":e,description:n||void 0,disabled:t,heading:`${r}`,headingLevel:i?.title?j(o):o,id:a,key:a,open:l,onCalciteBlockToggle:({target:t})=>this._onGroupToggle(t,e)},d.map((e=>this._renderInput(e))))}_getFocusableInput(e,t){const i=g(this.viewModel.inputs);let o;if("backward"===e&&i.reverse(),t)if(c(t)){const e=t.inputs.find((e=>e.visible));o=e?i.indexOf(e):0}else{let n;if(_(t)&&!t.group.open){const i=t.group.inputs.filter(m);n="forward"===e?i[i.length-1]:i[0]}else n=t;o=i.indexOf(n)+1}else o=0;for(let n=o;n<i.length;n++){const e=i[n];if(e.visible&&m(e))return e}return null}_renderLabeledField(e){const{dataType:t,feature:i,label:o,layer:n,required:a}=e,s={"aria-label":a?A(this.messages.requiredFieldLabel,{name:o}):o,class:u.label,key:`${n.id}-${i.uid}-${e.name}`},r=[P("div",{class:u.labelTextContent,key:"labelTextContainer"},o,a?P("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==t?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e)];return"date"===t&&"coded-value"!==e.domain?.type?P("label",{...s},r):P("calcite-label",{...s},r)}_renderFieldInput(e){const{dataType:t,domain:i,inputType:o,name:n}=e,a=this.getCommonInputProps(e);if("coded-value"===i?.type){const t=this.viewModel.getFieldValueOptionsForField(n,this.messages.empty);return"switch"!==o||e.hasInvalidSwitchValue?"radio-buttons"===o?this._renderRadioButtonComponents(e,t.flat(),a):this._renderComboBoxComponent(e,t,a):this._renderSwitchComponent(e,a)}return"datetime-picker"===o||"date"===t?this._renderDateComponents(e,a):"number"===t?this._renderNumberComponent(e,a):this._renderStringComponent(e,a)}_renderStringComponent(e,t){return"text-area"===e.inputType?t.readOnly?P("calcite-input",{...t,loading:e.updating,type:"textarea",onCalciteInputInput:e=>this._saveValueFromComponent(e.target)}):P("calcite-text-area",{...t,resize:"vertical",onCalciteTextAreaInput:e=>this._saveValueFromComponent(e.target)}):P("calcite-input",{...t,loading:e.updating,type:"text",onCalciteInputInput:e=>this._saveValueFromComponent(e.target)})}_renderNumberComponent(e,t){return P("calcite-input-number",{...t,integer:l(e.field),loading:e.updating,type:"number",onCalciteInputNumberInput:e=>this._saveValueFromComponent(e.target)})}_renderDateComponents(e,t){const{field:i}=e;switch(i.type){case"date":return this._renderDateFieldComponents(e,t);case"date-only":return this._renderDateOnlyFieldComponent(e,t);case"time-only":return this._renderTimeOnlyFieldComponent(e,t);case"timestamp-offset":return this._renderTimestampOffsetFieldComponents(e,t);default:return this._renderReadOnlyComponent(e,k(i,t.value,{timeZone:this.timeZone,...I(i)}))}}_renderDateOnlyFieldComponent(e,t){const{range:i,valid:o,value:n}=e,{class:a,key:s,readOnly:r}=t,{rawMax:l,rawMin:d}=i;return P("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!o,class:a,"data-date-part":"date","data-field-name":t[$],key:`${s}-date-input`,max:O(l)?l:void 0,min:O(d)?d:void 0,numberingSystem:x,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:r,value:null!=n?`${n}`:void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.target)})}_renderTimeOnlyFieldComponent(e,t){const{valid:i,value:o}=e,{class:n,key:a,readOnly:s}=t;return P("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!i,class:n,"data-date-part":"time","data-field-name":t[$],key:`${a}-time-input`,numberingSystem:x,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:s,step:e.timeStep,value:null!=o?`${o}`:void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.target)})}_renderTimestampOffsetFieldComponents(e,t){const{name:i,range:o,timeZone:n,valid:a,value:s}=e,{class:r,key:l,readOnly:d}=t,{rawMax:p,rawMin:c}=o,m={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!a,numberingSystem:x,overlayPositioning:"fixed",readOnly:d,[$]:i,onfocus:this._onComponentFocus},h=M(p,n),v=M(c,n),g=M(s,n);return P("div",{class:u.dateInputContainer,key:`${l}-date-time-container`},P("calcite-input-date-picker",{...m,class:r,"data-date-part":"date",key:`${l}-date-input`,max:h?.date??void 0,min:v?.date??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:g.date??void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.target)}),P("calcite-input-time-picker",{...m,class:r,"data-date-part":"time",key:`${l}-time-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},step:e.timeStep,value:g.time??void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.target)}),e.includeTimeOffset?P("calcite-input-time-zone",{...m,class:r,"data-date-part":"timeZone",disabled:d,key:`${l}-timezone-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:g.timeZoneOffset??"0",onCalciteInputTimeZoneChange:e=>this._saveValueFromDateComponent(e.target)}):null)}_renderDateFieldComponents(e,t){const{includeTime:i,name:o,valid:n,value:a}=e,{class:s,key:r,max:l,min:d,readOnly:p}=t,{timeZone:c}=this,m={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!n,numberingSystem:x,overlayPositioning:"fixed",readOnly:p,[$]:o,onfocus:this._onComponentFocus},h=D(a,c),v=D(l,c),g=D(d,c);return P("div",{class:u.dateInputContainer,key:`${r}-date-time-container`},P("calcite-input-date-picker",{...m,class:s,"data-date-part":"date",key:`${r}-date-input`,max:v?.date??void 0,min:g?.date??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:h.date??void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.target)}),i?P("calcite-input-time-picker",{...m,class:s,"data-date-part":"time",key:`${r}-time-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},step:1,value:h.time??void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.target)}):null)}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return P("calcite-input",{...i,class:this.classes(u.fieldInput,u.inputDisabled),readOnly:!0,type:"text",value:null!=t?`${t}`:i.value})}_renderComboBoxComponent(e,t,i){const{value:o,name:n}=e,{viewModel:a,_inputsWithChanges:s}=this,r="INSERT"===a.arcadeEditType,l=s.has(n),d=null==o&&(!r||l),p=r&&e.showNoValueOptionEnabled&&!l?()=>{}:i.onblur;return P("calcite-combobox",{...i,allowCustomValues:!1,clearDisabled:!0,disabled:i.readOnly,onblur:p,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:({target:t})=>{d&&0===t.selectedItems.length?this._ignoreDeselectionOfNoValueOption(t):e.isSubtypeField&&0===t.selectedItems.length?t.value=`${e.value}`:this._saveValueFromComponent(t)}},this.renderComboboxOptionsList(e,t))}renderComboboxOptionsList(e,t){const{value:i,name:o}=e,{messages:n,messagesTemplates:a,viewModel:s,_inputsWithChanges:r}=this,[l,d,p]=t.map((e=>e.map((({name:e,value:t})=>P("calcite-combobox-item",{key:`#${t}`,selected:i===t,textLabel:e,value:`${t}`}))))),u=[];d.length>0&&u.push(P("calcite-combobox-item-group",{key:"other",label:a.other},d)),p.length>0&&u.push(P("calcite-combobox-item-group",{key:"unsupported",label:n.subtypes.unsupportedDomainGroupTitle},p)),u.length>0?u.unshift(P("calcite-combobox-item-group",{key:"recommended",label:n.recommended},l)):u.push(...l);const c="INSERT"===s.arcadeEditType,m=r.has(o),h=null==i&&(!c||m);return e.showNoValueOptionEnabled&&u.unshift(P("calcite-combobox-item",{key:"empty-option",selected:h,textLabel:e.showNoValueLabel||n.empty,value:""})),u}_renderRadioButtonComponents(e,t,i){const{name:o,value:n}=e,a=t.map((({name:e,value:t})=>this._renderRadioButtonComponent({key:e,label:e,name:o,value:t,selected:t===n,props:i})));if(e.showNoValueOptionEnabled){const t="",s=e.showNoValueLabel||this.messages.empty,r=n===t||null===n;a.unshift(this._renderRadioButtonComponent({key:"empty-option",label:s,name:o,value:t,selected:r,props:i}))}return P("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:u.inputRadioGroup,"data-field-name":i[$],key:`${i.key}-radio-group`,layout:"vertical",name:i.key,required:i.required},a)}_renderSwitchComponent(e,t){const{value:i}=e,o=!!b(e.element,"switch")&&i===e.element.input.onValue;return P("calcite-switch",{...t,checked:o,class:u.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldName=null},onCalciteSwitchChange:e=>this._saveValueFromComponent(e.target)})}_renderRadioButtonComponent({key:e,name:t,value:i,selected:o,label:n,props:a}){return P("calcite-label",{class:u.inputRadioLabel,key:e,layout:"inline"},P("calcite-radio-button",{...a,afterCreate:void 0,afterUpdate:void 0,checked:o,class:u.inputRadio,disabled:a.readOnly,name:t,onblur:()=>{this._focusedFieldName=null},value:i,onCalciteRadioButtonChange:({target:e})=>{e.checked&&this._saveValueFromComponent(e)}}),n)}_renderAuxiliaryText(e){const t=e.name,i=this._inputsWithChanges.has(t)&&!e.valid?C(e,this.messages,this.timeZone):null!=this.viewModel.contingencyConstraintViolations.get(t)?this.messages.validationErrors.valuesIncompatible:null!=e.valueExpressionExecutor&&e.valueExpressionExecutor.stale?this.messages.valueExpressionError:null;return null!=i?P("calcite-input-message",{icon:!0,status:"invalid"},i):this._inputsWithChanges.has(t)&&e.valueIsOutOfDomain?P("calcite-input-message",{icon:!0,status:"idle"},this.messages.subtypes.fieldOutOfSubtypeDomainWarning):this._renderDescriptionOrEmpty(e.description)}_renderShowAllRelatedRecordsListItem(e){const{featureCount:t,relationshipId:i,showAllActionVisible:o}=e,{relatedRecordCallbacks:n}=this;if(!o||!n?.showAllRelatedRecords)return;const a=this.messages;return P("calcite-list-item",{description:A(a.totalCount,{count:t}),label:a.showAll,value:!0,onCalciteListItemSelect:()=>this._onShowAllRelatedRecordsClick(i)},P("calcite-icon",{icon:"list",scale:"s",slot:"content-end"}))}_renderAddRelatedRecordButton(e){const{canAddRelatedFeature:t,relationshipId:i,relatedLayer:o}=e,{messages:n,relatedRecordCallbacks:a}=this;if(t&&a?.addRelatedRecord&&o)return P("calcite-button",{alignment:"center",appearance:"outline-fill",class:u.centeredButton,disabled:e.updating||!e.originHasValidKey,iconStart:"plus",key:`${i}-add-button`,onclick:()=>{!e.updating&&e.originHasValidKey&&this._onAddRelatedRecordsClick(i,o)},round:!0,scale:"s",width:"half"},e.relatedLayerIsTable?n.addRecord:n.addFeature)}_renderRelatedRecordListItem(e,t){const{feature:i,description:o,title:n}=e,{feature:a,relatedRecordCallbacks:s}=this,{highlightHelper:r}=this.viewModel,l=()=>{r?.removeAll(),s?.editRelatedRecord&&a&&s.editRelatedRecord({parentFeature:a,relationshipId:t,relatedFeature:i})},d=r?()=>r.add(i):void 0,p=r?()=>r.remove(i):void 0;return P("calcite-list-item",{bind:this,description:o,key:`${t}-${i.uid}`,label:n,onclick:l,onmouseenter:d,onmouseleave:p,value:n},P("calcite-icon",{icon:f(i),slot:"content-start"}),P("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderRelationshipInput(e){if(!this._relatedRecordsEnabled||!e.editable)return;const{featureCount:t,relationshipId:i,showAllEnabled:o}=e,n=o?null:this._renderDescriptionOrEmpty(e.description),a=t>0?this._renderRelatedRecordsList(e):e.loaded?e.originHasValidKey?this._renderNoRelatedRecordsNotice():this._renderNoValidOriginKeyNotice(e):void 0;return P("calcite-label",{class:this.classes(u.label,u.relatedRecordsLabel),key:`relationship-${i}-container`},P("div",null,this._renderRelatedRecordsHeaderContainer(e),n,a),this._renderAddRelatedRecordButton(e))}_renderRelatedRecordsHeaderContainer(e){const t=e.updating||!e.loaded;return P("div",{class:u.relatedRecordsHeader,key:`relationship-${e.relationshipId}-header`},P("span",null,e.label),t?P("calcite-loader",{inline:!0,key:"loader",label:this.messagesCommon?.loading,scale:"s",type:"indeterminate"}):void 0)}_renderRelatedRecordsList(e){const{relationshipId:t}=e;return P("calcite-list",{class:u.relatedRecordsList},e.relatedFeatureInfos.map((e=>this._renderRelatedRecordListItem(e,t))),this._renderShowAllRelatedRecordsListItem(e),this._renderObserverNode())}_renderNoValidOriginKeyNotice(e){const{messages:t}=this,i=e.relatedLayerIsTable?t.noOriginKeyRecord:t.noOriginKeyFeature,o=e.relationship?.keyField,n=this.viewModel.findField(o),a=e.layer?.fieldsIndex.get(o),s=n?.label||a?.alias||o,r=A(i,{relatedLayerName:e.relatedLayer?.title,originKeyField:s});return P("calcite-notice",{icon:"information",kind:"brand",open:!0,scale:"s",width:"full"},P("div",{slot:"message"},r))}_renderNoRelatedRecordsNotice(){return P("calcite-notice",{icon:"information",kind:"brand",open:!0,scale:"s",width:"full"},P("div",{slot:"message"},this.messagesFeature.noRelatedFeatures))}_renderObserverNode(){if(this.viewModel.activeRelationshipInput?.showAllEnabled)return P("div",{afterCreate:this._afterListObserverCreated,afterRemoved:this._afterListObserverRemoved,bind:this,class:u.listObserver,key:"feature-observer"})}_renderTextElementInput(e){return P("div",{class:u.textElement,innerHTML:e.text,key:e.id})}getCommonInputProps(e){const{disabled:t}=this,{editable:i,hint:o,label:n,maxLength:a,minLength:s,name:r,range:{max:l,min:d},required:p,valid:c,value:m}=e,h=this._inputsWithChanges.has(r),v=!i||t;return{afterCreate:this._afterComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":c?"false":"true",class:this.classes(u.fieldInput,v?u.inputDisabled:null),status:h&&!c?"invalid":"idle",key:r,label:n,max:null!=l?l:void 0,min:null!=d?d:void 0,maxLength:a>-1?a:void 0,minLength:s>-1?s:void 0,placeholder:o??void 0,readOnly:v,required:p,value:null==m?"":`${m}`,onblur:this._onComponentBlur,onfocus:this._onComponentFocus,onkeydown:this._onComponentKeyDown,[$]:r}}_getFieldInputFromHTMLElement(e){return this.viewModel.findField(e.getAttribute($))}_afterDateComponentCreate(e){const t=this._getFieldInputFromHTMLElement(e),i=e.dataset.datePart,o=this._dateComponentMap.get(t.name);if("valueAsDate"in e&&null!=e.value){const i=new ResizeObserver((()=>{e.value=void 0,e.value=D(t.value).date??"",i.unobserve(e)}));i.observe(e)}if(null!=o)switch(i){case"date":o.date=e;break;case"time":o.time=e;break;case"timeZone":o.timeZone=e}else this._dateComponentMap.set(t.name,{[i]:e});this._afterDateComponentCreateOrUpdate(e)}_afterDateComponentCreateOrUpdate(e){this._afterComponentCreateOrUpdate(e)}_afterComponentCreate(e){const t=this._getFieldInputFromHTMLElement(e);y(t)&&null!=e.value&&"setNumberValue"in e&&e.setNumberValue({committing:!1,value:e.value,origin:"direct"}),this._afterComponentCreateOrUpdate(e)}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,i=e.querySelector("calcite-radio-button"),o=t||i;o&&this._afterComponentCreateOrUpdate(o)}_afterComponentCreateOrUpdate(e){const{viewModel:t}=this,i=this._getFieldInputFromHTMLElement(e),o=t.findField(this._focusedFieldName);this._attemptFocusOnNextRender&&o===i&&(this._attemptFocusOnNextRender=!1,_(i)&&(i.group.open=!0),e.setFocus())}_onComponentFocus(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);this._focusedFieldName=i.name}_onComponentBlur(e){const t=e.target;this._focusedFieldName=null,this._saveValueFromComponent(t)}_saveValueFromDateComponent(e){const{timeZone:t}=this,i=this._getFieldInputFromHTMLElement(e),o=i.field.type,{name:n,range:a}=i,s=this._dateComponentMap.get(n);if(!s)return;let r=this.viewModel.getValue(n),l=null;"date-only"===o?l=Array.isArray(e.value)?e.value[0]:e.value:"time-only"===o?(r=N(r),l=N(e.value)):l="timestamp-offset"===o?null!=e.value?V({dateComponent:s.date,timeComponent:s.time,timeZoneComponent:s.timeZone,oldValue:r,defaultTimeZone:t}):null:null!=e.value?T({oldValue:r,dateComponent:s.date,timeComponent:s.time,timeZone:t,max:a.max,min:a.min}):null,null!==l&&e.value?r!==l&&this._updateFieldValue(n,l):this._updateFieldValue(n,null)}_saveValueFromComponent(e){const t=this._getFieldInputFromHTMLElement(e),i=this._parseValue(e),o=t.value;t.isSubtypeField&&F(this.layer,o,i)?this._pendingSubtypeChoice||i===o||(this._pendingSubtypeChoice=this._handleSubtypeChoice(t,i)):this._updateFieldValue(t.name,i)}async _handleSubtypeChoice(e,t){const{value:i,name:n}=e,{layer:a,messages:s,viewModel:r,messagesCommon:l}=this;if(this._updateFieldValue(n,t),!a||!("subtypes"in a)||!a.subtypes?.length)return;const d=a.subtypes.find((e=>e.code===t)),p=a.subtypes.find((e=>e.code===i))?.name??`${i}`;if(!d)return;r.hasPendingSubtypeChoice=!0;const u=o();let c="update-fields";const m=[{label:s.subtypes.useDefaultValuesOption,value:"update-fields"},{label:s.subtypes.keepCurrentValuesOption,value:"keep-existing"}],h={context:"info",title:s.subtypes.changeWarningTitle,message:A(s.subtypes.changeWarning,{originalType:p,newType:d.name}),radios:m,defaultRadioSelection:"update-fields",onRadioSelection:e=>c=e,actions:{primary:{label:l.apply,action:()=>u.resolve(c),type:"positive"},secondary:{label:l.cancel,type:"neutral",action:()=>u.resolve("undo")}},cancel:()=>u.reject()};try{this.showPrompt(h);switch(await u.promise){case"update-fields":r.applySubtypeDefaults(d),this._validateContingenciesForNonNullFields();break;case"keep-existing":this._validateContingenciesForNonNullFields();break;case"undo":this._updateFieldValue(e.name,i)}}finally{r.hasPendingSubtypeChoice=!1,this.clearPrompt(),this._pendingSubtypeChoice=null}}_onComponentKeyDown({key:e,target:t}){const i=this._getFieldInputFromHTMLElement(t);"Enter"===e&&_(i)&&!i.group.open&&(i.group.open=!0)}_updateFieldValue(e,t){const i=this.viewModel.getValue(e);this.viewModel.setValue(e,t),this._inputsWithChanges.add(e);i!==t&&this.viewModel.fieldsWithContingentValues.has(e)&&this._validateContingenciesForNonNullFields()}_validateContingenciesForNonNullFields(){const e=Object.fromEntries(Object.entries(this.getValues()).filter((([e,t])=>null!=t)));this.viewModel.validateContingencyConstraints(e)}_parseValue(e){const t=this._getFieldInputFromHTMLElement(e),i=e.value;return b(t.element,"switch")?e.checked?t.element.input.onValue:t.element.input.offValue:null==i||""===i?null:"number"===t.dataType?"-0"===i||"-0."===i||"-0,"===i?i:parseFloat(i):"date"===t.field.type?parseFloat(i):i}_ignoreDeselectionOfNoValueOption(e){const{firstChild:t,selectedItems:o}=e;0===o.length&&t&&"selected"in t?t.selected=!0:i.getLogger(this).warnOnce("Failed to override user attempt to deselect 'No value' option.")}_onGroupToggle(e,t){e.open?(t.open=!0,this._focusedFieldName=this._getFocusableInput("forward",t)?.name||null,this._attemptFocusOnNextRender=!0,"sequential"===this.groupDisplay&&this.viewModel.allGroupInputs.forEach((e=>{e!==t&&(e.open=!1)}))):t.open=!1,this.scheduleRender()}_onFormSubmit(e){e.preventDefault()}_onFormKeyDown(e){"Enter"===e.key&&this.viewModel.submit()}_afterListObserverCreated(e){this.viewModel.activeRelationshipInput&&(this._listObserverNode=e)}_afterListObserverRemoved(){this._listObserverNode=null}_onObserverChange(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode);const e=this.viewModel.activeRelationshipInput;e&&this._listObserverNode&&e.showAllEnabled&&this._listObserver.observe(this._listObserverNode)}_incrementRelatedRecordPage(){const e=this.viewModel.activeRelationshipInput;e?.incrementPage()}_syncGroupInputStates(){if("sequential"!==this.groupDisplay)return;const e=this.viewModel.allGroupInputs;if(!e.length)return;const t=e.filter((e=>e.open));0===t.length?e[0].open=!0:t.length>1&&t.slice(1).forEach((e=>e.open=!1))}get test(){return{inputsWithChanges:this._inputsWithChanges}}};e([s()],H.prototype,"_listObserverNode",void 0),e([s()],H.prototype,"_relatedRecordsEnabled",null),e([s()],H.prototype,"_prompt",void 0),e([s()],H.prototype,"disabled",null),e([s()],H.prototype,"feature",null),e([s()],H.prototype,"formTemplate",null),e([s()],H.prototype,"groupDisplay",void 0),e([s()],H.prototype,"headingLevel",void 0),e([s()],H.prototype,"icon",null),e([s()],H.prototype,"label",null),e([s()],H.prototype,"layer",null),e([s()],H.prototype,"map",null),e([s(),E("esri/widgets/FeatureForm/t9n/FeatureForm")],H.prototype,"messages",void 0),e([s(),E("esri/t9n/common")],H.prototype,"messagesCommon",void 0),e([s(),E("esri/widgets/Feature/t9n/Feature")],H.prototype,"messagesFeature",void 0),e([s(),E("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],H.prototype,"messagesTemplates",void 0),e([s()],H.prototype,"relatedRecordCallbacks",null),e([s()],H.prototype,"relationshipId",null),e([s()],H.prototype,"spatialReference",null),e([s()],H.prototype,"strict",null),e([s()],H.prototype,"timeZone",null),e([s()],H.prototype,"showPrompt",null),e([s()],H.prototype,"clearPrompt",null),e([s(),U(["value-change","submit"])],H.prototype,"viewModel",void 0),e([s()],H.prototype,"test",null),H=e([r("esri.widgets.FeatureForm")],H);const Z=H;export{Z as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{isSome as t}from"../core/arrayUtils.js";import"../core/has.js";import i from"../core/Logger.js";import{createResolver as o}from"../core/promiseUtils.js";import{watch as n,whenOnce as a}from"../core/reactiveUtils.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import{isIntegerField as l}from"../layers/support/fieldUtils.js";import d from"./Widget.js";import{Prompt as p}from"./Editor/components/Prompt.js";import{css as u}from"./FeatureForm/css.js";import{isGroupInput as c,isFieldInput as m,isRelationshipInput as h,isTextElementInput as v,flattenInputs as g,isInputInGroupInput as _,isFieldElementWithInputType as b,getErrorMessageForFieldInput as f,getIconForFeature as C,isNumberFieldInput as y,subtypeChangeShouldPrompt as F}from"./FeatureForm/featureFormUtils.js";import w from"./FeatureForm/FeatureFormViewModel.js";import{loadCalciteComponents as R}from"./support/componentsUtils.js";import{isString as O}from"./support/dataUtils.js";import{getLabelForDateFieldValue as k,getIntlOptionsForField as I,numberingSystem as x,prepareISOFieldValueForDateComponents as M,prepareUnixFieldValueForDateComponents as D,normalizeTimeOnlyString as N,getISOFieldValueFromDateComponents as V,getUnixFieldValueFromDateComponents as T}from"./support/dateUtils.js";import{globalCss as L}from"./support/globalCss.js";import{Heading as S,incrementHeadingLevel as j}from"./support/Heading.js";import"./support/widgetUtils.js";import{messageBundle as E}from"./support/decorators/messageBundle.js";import{vmEvent as U}from"./support/decorators/vmEvent.js";import{tsx as P}from"./support/jsxFactory.js";import{substitute as A}from"../intl/substitute.js";const $="data-field-name";let H=class extends d{constructor(e,t){super(e,t),this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._inputsWithChanges=new Set,this._focusedFieldName=null,this._pendingSubtypeChoice=null,this._listObserverNode=null,this._listObserver=new IntersectionObserver((e=>{e.length&&e[0].isIntersecting&&this._incrementRelatedRecordPage()}),{root:window.document}),this._prompt=null,this.groupDisplay="all",this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.messagesFeature=null,this.messagesTemplates=null,this.viewModel=new w,this._onShowAllRelatedRecordsClick=e=>{const{feature:t,relatedRecordCallbacks:i}=this;t&&i?.showAllRelatedRecords&&i.showAllRelatedRecords({parentFeature:t,relationshipId:e})},this._onAddRelatedRecordsClick=(e,t)=>{const{feature:i,relatedRecordCallbacks:o}=this;i&&o?.addRelatedRecord&&o.addRelatedRecord({parentFeature:i,relatedLayer:t,relationshipId:e})},this._onFormKeyDown=this._onFormKeyDown.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onGroupToggle=this._onGroupToggle.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentKeyDown=this._onComponentKeyDown.bind(this),this._afterComponentCreate=this._afterComponentCreate.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterDateComponentCreateOrUpdate=this._afterDateComponentCreateOrUpdate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this)}initialize(){this.addHandles([n((()=>this.feature),(()=>{this._inputsWithChanges.clear(),this._dateComponentMap.clear(),a((()=>!this.viewModel.updating)).then((()=>{const e=this._getFocusableInput("forward");this._syncGroupInputStates(),this._focusedFieldName=e?.name||null,this._attemptFocusOnNextRender=!0}))})),n((()=>this.groupDisplay),(()=>this._syncGroupInputStates())),this.on("submit",(e=>{if(e.invalid.length>0){const[t]=e.invalid;e.invalid.forEach((e=>this._inputsWithChanges.add(e))),this._focusedFieldName=t,this._attemptFocusOnNextRender=!0,this.scheduleRender()}})),n((()=>[this.viewModel.activeRelationshipInput,this._listObserverNode]),(()=>this._onObserverChange()))])}loadDependencies(){return R({block:()=>import("@esri/calcite-components/dist/components/calcite-block.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox.js"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item.js"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),input:()=>import("@esri/calcite-components/dist/components/calcite-input.js"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker.js"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message.js"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number.js"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker.js"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button.js"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group.js"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch.js"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area.js")})}destroy(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode)}get _relatedRecordsEnabled(){const e=this.relatedRecordCallbacks;return!(!e||!(e.addRelatedRecord||e.editRelatedRecord||e.showAllRelatedRecords))}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get feature(){return this.viewModel.feature}set feature(e){this.viewModel.feature=e}get formTemplate(){return this.viewModel.formTemplate}set formTemplate(e){this.viewModel.formTemplate=e}get icon(){return"form-field"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get relatedRecordCallbacks(){return this.viewModel.relatedRecordCallbacks}set relatedRecordCallbacks(e){this.viewModel.relatedRecordCallbacks=e}get relationshipId(){return this.viewModel.relationshipId}set relationshipId(e){this.viewModel.relationshipId=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get strict(){return this.viewModel.strict}set strict(e){this.viewModel.strict=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get showPrompt(){return e=>{this._prompt?.cancel?.(),this._prompt=e}}set showPrompt(e){this._overrideIfSome("showPrompt",e)}get clearPrompt(){return()=>this._prompt=null}set clearPrompt(e){this._overrideIfSome("clearPrompt",e)}getValues(){return this.viewModel.getValues()}submit(){return this.viewModel.submit()}render(){const{state:e}=this.viewModel;return P("div",{class:this.classes(u.base,L.widget,L.panel)},"ready"===e?this._renderForm():null)}_renderForm(){return P("div",null,P("form",{class:u.form,novalidate:!0,onkeydown:this._onFormKeyDown,onsubmit:this._onFormSubmit},this._renderHeader(),this._renderContent()),this._prompt?P(p,{...this._prompt,headingLevel:this.headingLevel}):void 0)}_renderHeader(){const e=this.viewModel;if(!e.formHeaderVisible)return;const t=null!=e.formTitle&&P(S,{key:"title",level:this.headingLevel},e.formTitle),i=null!=e.formDescription&&P("p",{class:u.description,key:"description"},e.formDescription);return P("div",{class:u.formHeader},t,i)}_renderContent(){const{viewModel:e}=this;return e.activeRelationshipInput?this._renderRelationshipInput(e.activeRelationshipInput):e.inputs.filter(t).filter((e=>e.visible)).map((e=>this._renderInput(e)))}_renderInput(e){return c(e)?this._renderGroup(e):m(e)?this._renderLabeledField(e):h(e)?this._renderRelationshipInput(e):v(e)?this._renderTextElementInput(e):void 0}_renderDescriptionOrEmpty(e,t){return null==e?null:P("div",{class:this.classes(u.description),id:t},e)}_renderGroup(e){const{disabled:t,formTemplate:i,headingLevel:o}=this,{description:n,id:a,inputs:s,label:r,open:l}=e,d=s.filter((e=>e.visible)),p=this.viewModel.findField(this._focusedFieldName),c=p?.group===e,m="sequential"===this.groupDisplay;return P("calcite-block",{class:this.classes(u.group,m?u.groupSequential:null,c?u.groupActive:null,t?u.inputDisabled:null),collapsible:!0,"data-group":e,description:n||void 0,disabled:t,heading:`${r}`,headingLevel:i?.title?j(o):o,id:a,key:a,open:l,onCalciteBlockToggle:({target:t})=>this._onGroupToggle(t,e)},d.map((e=>this._renderInput(e))))}_getFocusableInput(e,t){const i=g(this.viewModel.inputs);let o;if("backward"===e&&i.reverse(),t)if(c(t)){const e=t.inputs.find((e=>e.visible));o=e?i.indexOf(e):0}else{let n;if(_(t)&&!t.group.open){const i=t.group.inputs.filter(m);n="forward"===e?i[i.length-1]:i[0]}else n=t;o=i.indexOf(n)+1}else o=0;for(let n=o;n<i.length;n++){const e=i[n];if(e.visible&&m(e))return e}return null}_renderLabeledField(e){const{dataType:t,feature:i,label:o,layer:n,required:a}=e,s={"aria-label":a?A(this.messages.requiredFieldLabel,{name:o}):o,class:u.label,key:`${n.id}-${i.uid}-${e.name}`},r=[P("div",{class:u.labelTextContent,key:"labelTextContainer"},o,a?P("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==t?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e)];return"date"===t&&"coded-value"!==e.domain?.type?P("label",{...s},r):P("calcite-label",{...s},r)}_renderFieldInput(e){const{dataType:t,domain:i,inputType:o,name:n}=e,a=this.getCommonInputProps(e);if("coded-value"===i?.type){const t=this.viewModel.getFieldValueOptionsForField(n,this.messages.empty);return"switch"!==o||e.hasInvalidSwitchValue?"radio-buttons"===o?this._renderRadioButtonComponents(e,t.flat(),a):this._renderComboBoxComponent(e,t,a):this._renderSwitchComponent(e,a)}return"datetime-picker"===o||"date"===t?this._renderDateComponents(e,a):"number"===t?this._renderNumberComponent(e,a):this._renderStringComponent(e,a)}_renderStringComponent(e,t){return"text-area"===e.inputType?t.readOnly?P("calcite-input",{...t,loading:e.updating,type:"textarea",onCalciteInputInput:e=>this._saveValueFromComponent(e.target)}):P("calcite-text-area",{...t,resize:"vertical",onCalciteTextAreaInput:e=>this._saveValueFromComponent(e.target)}):P("calcite-input",{...t,loading:e.updating,type:"text",onCalciteInputInput:e=>this._saveValueFromComponent(e.target)})}_renderNumberComponent(e,t){return P("calcite-input-number",{...t,integer:l(e.field),loading:e.updating,type:"number",onCalciteInputNumberInput:e=>this._saveValueFromComponent(e.target)})}_renderDateComponents(e,t){const{field:i}=e;switch(i.type){case"date":return this._renderDateFieldComponents(e,t);case"date-only":return this._renderDateOnlyFieldComponent(e,t);case"time-only":return this._renderTimeOnlyFieldComponent(e,t);case"timestamp-offset":return this._renderTimestampOffsetFieldComponents(e,t);default:return this._renderReadOnlyComponent(e,k(i,t.value,{timeZone:this.timeZone,...I(i)}))}}_renderDateOnlyFieldComponent(e,t){const{range:i,valid:o,value:n}=e,{class:a,key:s,readOnly:r}=t,{rawMax:l,rawMin:d}=i;return P("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!o,class:a,"data-date-part":"date","data-field-name":t[$],key:`${s}-date-input`,max:O(l)?l:void 0,min:O(d)?d:void 0,numberingSystem:x,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:r,value:null!=n?`${n}`:void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.target)})}_renderTimeOnlyFieldComponent(e,t){const{valid:i,value:o}=e,{class:n,key:a,readOnly:s}=t;return P("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!i,class:n,"data-date-part":"time","data-field-name":t[$],key:`${a}-time-input`,numberingSystem:x,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:s,step:e.timeStep,value:null!=o?`${o}`:void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.target)})}_renderTimestampOffsetFieldComponents(e,t){const{name:i,range:o,timeZone:n,valid:a,value:s}=e,{class:r,key:l,readOnly:d}=t,{rawMax:p,rawMin:c}=o,m={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!a,numberingSystem:x,overlayPositioning:"fixed",readOnly:d,[$]:i,onfocus:this._onComponentFocus},h=M(p,n),v=M(c,n),g=M(s,n);return P("div",{class:u.dateInputContainer,key:`${l}-date-time-container`},P("calcite-input-date-picker",{...m,class:r,"data-date-part":"date",key:`${l}-date-input`,max:h?.date??void 0,min:v?.date??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:g.date??void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.target)}),P("calcite-input-time-picker",{...m,class:r,"data-date-part":"time",key:`${l}-time-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},step:e.timeStep,value:g.time??void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.target)}),e.includeTimeOffset?P("calcite-input-time-zone",{...m,class:r,"data-date-part":"timeZone",disabled:d,key:`${l}-timezone-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:g.timeZoneOffset??"0",onCalciteInputTimeZoneChange:e=>this._saveValueFromDateComponent(e.target)}):null)}_renderDateFieldComponents(e,t){const{includeTime:i,name:o,valid:n,value:a}=e,{class:s,key:r,max:l,min:d,readOnly:p}=t,{timeZone:c}=this,m={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!n,numberingSystem:x,overlayPositioning:"fixed",readOnly:p,[$]:o,onfocus:this._onComponentFocus},h=D(a,c),v=D(l,c),g=D(d,c);return P("div",{class:u.dateInputContainer,key:`${r}-date-time-container`},P("calcite-input-date-picker",{...m,class:s,"data-date-part":"date",key:`${r}-date-input`,max:v?.date??void 0,min:g?.date??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:h.date??void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.target)}),i?P("calcite-input-time-picker",{...m,class:s,"data-date-part":"time",key:`${r}-time-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},step:1,value:h.time??void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.target)}):null)}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return P("calcite-input",{...i,class:this.classes(u.fieldInput,u.inputDisabled),readOnly:!0,type:"text",value:null!=t?`${t}`:i.value})}_renderComboBoxComponent(e,t,i){const{value:o,name:n}=e,{viewModel:a,_inputsWithChanges:s}=this,r="INSERT"===a.arcadeEditType,l=s.has(n),d=null==o&&(!r||l),p=r&&e.showNoValueOptionEnabled&&!l?()=>{}:i.onblur;return P("calcite-combobox",{...i,allowCustomValues:!1,clearDisabled:!0,disabled:i.readOnly,onblur:p,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:({target:t})=>{d&&0===t.selectedItems.length?this._ignoreDeselectionOfNoValueOption(t):e.isSubtypeField&&0===t.selectedItems.length?t.value=`${e.value}`:this._saveValueFromComponent(t)}},this.renderComboboxOptionsList(e,t))}renderComboboxOptionsList(e,t){const{value:i,name:o}=e,{messages:n,messagesTemplates:a,viewModel:s,_inputsWithChanges:r}=this,[l,d,p]=t.map((e=>e.map((({name:e,value:t})=>P("calcite-combobox-item",{key:`#${t}`,selected:i===t,textLabel:e,value:`${t}`}))))),u=[];d.length>0&&u.push(P("calcite-combobox-item-group",{key:"other",label:a.other},d)),p.length>0&&u.push(P("calcite-combobox-item-group",{key:"unsupported",label:n.subtypes.unsupportedDomainGroupTitle},p)),u.length>0?u.unshift(P("calcite-combobox-item-group",{key:"recommended",label:n.recommended},l)):u.push(...l);const c="INSERT"===s.arcadeEditType,m=r.has(o),h=null==i&&(!c||m);return e.showNoValueOptionEnabled&&u.unshift(P("calcite-combobox-item",{key:"empty-option",selected:h,textLabel:e.showNoValueLabel||n.empty,value:""})),u}_renderRadioButtonComponents(e,t,i){const{name:o,value:n}=e,a=t.map((({name:e,value:t})=>this._renderRadioButtonComponent({key:e,label:e,name:o,value:t,selected:t===n,props:i})));if(e.showNoValueOptionEnabled){const t="",s=e.showNoValueLabel||this.messages.empty,r=n===t||null===n;a.unshift(this._renderRadioButtonComponent({key:"empty-option",label:s,name:o,value:t,selected:r,props:i}))}return P("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:u.inputRadioGroup,"data-field-name":i[$],key:`${i.key}-radio-group`,layout:"vertical",name:i.key,required:i.required},a)}_renderSwitchComponent(e,t){const{value:i}=e,o=!!b(e.element,"switch")&&i===e.element.input.onValue;return P("calcite-switch",{...t,checked:o,class:u.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldName=null},onCalciteSwitchChange:e=>this._saveValueFromComponent(e.target)})}_renderRadioButtonComponent({key:e,name:t,value:i,selected:o,label:n,props:a}){return P("calcite-label",{class:u.inputRadioLabel,key:e,layout:"inline"},P("calcite-radio-button",{...a,afterCreate:void 0,afterUpdate:void 0,checked:o,class:u.inputRadio,disabled:a.readOnly,name:t,onblur:()=>{this._focusedFieldName=null},value:i,onCalciteRadioButtonChange:({target:e})=>{e.checked&&this._saveValueFromComponent(e)}}),n)}_renderAuxiliaryText(e){const t=e.name,i=this._inputsWithChanges.has(t)&&!e.valid?f(e,this.messages,this.timeZone):null!=this.viewModel.contingencyConstraintViolations.get(t)?this.messages.validationErrors.valuesIncompatible:null!=e.valueExpressionExecutor&&e.valueExpressionExecutor.stale?this.messages.valueExpressionError:null;return null!=i?P("calcite-input-message",{icon:!0,status:"invalid"},i):this._inputsWithChanges.has(t)&&e.valueIsOutOfDomain?P("calcite-input-message",{icon:!0,status:"idle"},this.messages.subtypes.fieldOutOfSubtypeDomainWarning):this._renderDescriptionOrEmpty(e.description)}_renderShowAllRelatedRecordsListItem(e){const{featureCount:t,relationshipId:i,showAllActionVisible:o}=e,{relatedRecordCallbacks:n}=this;if(!o||!n?.showAllRelatedRecords)return;const a=this.messages;return P("calcite-list-item",{description:A(a.totalCount,{count:t}),label:a.showAll,value:!0,onCalciteListItemSelect:()=>this._onShowAllRelatedRecordsClick(i)},P("calcite-icon",{icon:"list",scale:"s",slot:"content-end"}))}_renderAddRelatedRecordButton(e){const{canAddRelatedFeature:t,relationshipId:i,relatedLayer:o}=e,{messages:n,relatedRecordCallbacks:a}=this;if(t&&a?.addRelatedRecord&&o)return P("calcite-button",{alignment:"center",appearance:"outline-fill",class:u.centeredButton,disabled:e.updating||!e.originHasValidKey,iconStart:"plus",key:`${i}-add-button`,onclick:()=>{!e.updating&&e.originHasValidKey&&this._onAddRelatedRecordsClick(i,o)},round:!0,scale:"s",width:"half"},e.relatedLayerIsTable?n.addRecord:n.addFeature)}_renderRelatedRecordListItem(e,t){const{feature:i,description:o,title:n}=e,{feature:a,relatedRecordCallbacks:s}=this,{highlightHelper:r}=this.viewModel,l=()=>{r?.removeAll(),s?.editRelatedRecord&&a&&s.editRelatedRecord({parentFeature:a,relationshipId:t,relatedFeature:i})},d=r?()=>r.add(i):void 0,p=r?()=>r.remove(i):void 0;return P("calcite-list-item",{bind:this,description:o,key:`${t}-${i.uid}`,label:n,onclick:l,onmouseenter:d,onmouseleave:p,value:n},P("calcite-icon",{icon:C(i),slot:"content-start"}),P("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderRelationshipInput(e){if(!this._relatedRecordsEnabled||!e.editable)return;const{featureCount:t,relationshipId:i,showAllEnabled:o}=e,n=o?null:this._renderDescriptionOrEmpty(e.description),a=t>0?this._renderRelatedRecordsList(e):e.loaded?e.originHasValidKey?this._renderNoRelatedRecordsNotice():this._renderNoValidOriginKeyNotice(e):void 0;return P("calcite-label",{class:this.classes(u.label,u.relatedRecordsLabel),key:`relationship-${i}-container`},P("div",null,this._renderRelatedRecordsHeaderContainer(e),n,a),this._renderAddRelatedRecordButton(e))}_renderRelatedRecordsHeaderContainer(e){const t=e.updating||!e.loaded;return P("div",{class:u.relatedRecordsHeader,key:`relationship-${e.relationshipId}-header`},P("span",null,e.label),t?P("calcite-loader",{inline:!0,key:"loader",label:this.messagesCommon?.loading,scale:"s",type:"indeterminate"}):void 0)}_renderRelatedRecordsList(e){const{relationshipId:t}=e;return P("calcite-list",{class:u.relatedRecordsList},e.relatedFeatureInfos.map((e=>this._renderRelatedRecordListItem(e,t))),this._renderShowAllRelatedRecordsListItem(e),this._renderObserverNode())}_renderNoValidOriginKeyNotice(e){const{messages:t}=this,i=e.relatedLayerIsTable?t.noOriginKeyRecord:t.noOriginKeyFeature,o=e.relationship?.keyField,n=this.viewModel.findField(o),a=e.layer?.fieldsIndex.get(o),s=n?.label||a?.alias||o,r=A(i,{relatedLayerName:e.relatedLayer?.title,originKeyField:s});return P("calcite-notice",{icon:"information",kind:"brand",open:!0,scale:"s",width:"full"},P("div",{slot:"message"},r))}_renderNoRelatedRecordsNotice(){return P("calcite-notice",{icon:"information",kind:"brand",open:!0,scale:"s",width:"full"},P("div",{slot:"message"},this.messagesFeature.noRelatedFeatures))}_renderObserverNode(){if(this.viewModel.activeRelationshipInput?.showAllEnabled)return P("div",{afterCreate:this._afterListObserverCreated,afterRemoved:this._afterListObserverRemoved,bind:this,class:u.listObserver,key:"feature-observer"})}_renderTextElementInput(e){return P("div",{class:u.textElement,innerHTML:e.text,key:e.id})}getCommonInputProps(e){const{disabled:t}=this,{editable:i,hint:o,label:n,maxLength:a,minLength:s,name:r,range:{max:l,min:d},required:p,valid:c,value:m}=e,h=this._inputsWithChanges.has(r),v=!i||t;return{afterCreate:this._afterComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":c?"false":"true",class:this.classes(u.fieldInput,v?u.inputDisabled:null),status:h&&!c?"invalid":"idle",key:r,label:n,max:null!=l?l:void 0,min:null!=d?d:void 0,maxLength:a>-1?a:void 0,minLength:s>-1?s:void 0,placeholder:o??void 0,readOnly:v,required:p,value:null==m?"":`${m}`,onblur:this._onComponentBlur,onfocus:this._onComponentFocus,onkeydown:this._onComponentKeyDown,[$]:r}}_getFieldInputFromHTMLElement(e){return this.viewModel.findField(e.getAttribute($))}_afterDateComponentCreate(e){const t=this._getFieldInputFromHTMLElement(e),i=e.dataset.datePart,o=this._dateComponentMap.get(t.name);if("valueAsDate"in e&&null!=e.value){const i=new ResizeObserver((()=>{switch(e.value=void 0,t.field.type){case"date":e.value=D(t.value,this.timeZone).date??"";break;case"timestamp-offset":e.value=M(t.value,this.timeZone).date??"";break;default:e.value=`${t.value}`}i.unobserve(e)}));i.observe(e)}if(null!=o)switch(i){case"date":o.date=e;break;case"time":o.time=e;break;case"timeZone":o.timeZone=e}else this._dateComponentMap.set(t.name,{[i]:e});this._afterDateComponentCreateOrUpdate(e)}_afterDateComponentCreateOrUpdate(e){this._afterComponentCreateOrUpdate(e)}_afterComponentCreate(e){const t=this._getFieldInputFromHTMLElement(e);y(t)&&null!=e.value&&"setNumberValue"in e&&e.setNumberValue({committing:!1,value:e.value,origin:"direct"}),this._afterComponentCreateOrUpdate(e)}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,i=e.querySelector("calcite-radio-button"),o=t||i;o&&this._afterComponentCreateOrUpdate(o)}_afterComponentCreateOrUpdate(e){const{viewModel:t}=this,i=this._getFieldInputFromHTMLElement(e),o=t.findField(this._focusedFieldName);this._attemptFocusOnNextRender&&o===i&&(this._attemptFocusOnNextRender=!1,_(i)&&(i.group.open=!0),e.setFocus())}_onComponentFocus(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);this._focusedFieldName=i.name}_onComponentBlur(e){const t=e.target;this._focusedFieldName=null,this._saveValueFromComponent(t)}_saveValueFromDateComponent(e){const{timeZone:t}=this,i=this._getFieldInputFromHTMLElement(e),o=i.field.type,{name:n,range:a}=i,s=this._dateComponentMap.get(n);if(!s)return;let r=this.viewModel.getValue(n),l=null;"date-only"===o?l=Array.isArray(e.value)?e.value[0]:e.value:"time-only"===o?(r=N(r),l=N(e.value)):l="timestamp-offset"===o?null!=e.value?V({dateComponent:s.date,timeComponent:s.time,timeZoneComponent:s.timeZone,oldValue:r,defaultTimeZone:t}):null:null!=e.value?T({oldValue:r,dateComponent:s.date,timeComponent:s.time,timeZone:t,max:a.max,min:a.min}):null,null!==l&&e.value?r!==l&&this._updateFieldValue(n,l):this._updateFieldValue(n,null)}_saveValueFromComponent(e){const t=this._getFieldInputFromHTMLElement(e),i=this._parseValue(e),o=t.value;t.isSubtypeField&&F(this.layer,o,i)?this._pendingSubtypeChoice||i===o||(this._pendingSubtypeChoice=this._handleSubtypeChoice(t,i)):this._updateFieldValue(t.name,i)}async _handleSubtypeChoice(e,t){const{value:i,name:n}=e,{layer:a,messages:s,viewModel:r,messagesCommon:l}=this;if(this._updateFieldValue(n,t),!a||!("subtypes"in a)||!a.subtypes?.length)return;const d=a.subtypes.find((e=>e.code===t)),p=a.subtypes.find((e=>e.code===i))?.name??`${i}`;if(!d)return;r.hasPendingSubtypeChoice=!0;const u=o();let c="update-fields";const m=[{label:s.subtypes.useDefaultValuesOption,value:"update-fields"},{label:s.subtypes.keepCurrentValuesOption,value:"keep-existing"}],h={context:"info",title:s.subtypes.changeWarningTitle,message:A(s.subtypes.changeWarning,{originalType:p,newType:d.name}),radios:m,defaultRadioSelection:"update-fields",onRadioSelection:e=>c=e,actions:{primary:{label:l.apply,action:()=>u.resolve(c),type:"positive"},secondary:{label:l.cancel,type:"neutral",action:()=>u.resolve("undo")}},cancel:()=>u.reject()};try{this.showPrompt(h);switch(await u.promise){case"update-fields":r.applySubtypeDefaults(d),this._validateContingenciesForNonNullFields();break;case"keep-existing":this._validateContingenciesForNonNullFields();break;case"undo":this._updateFieldValue(e.name,i)}}finally{r.hasPendingSubtypeChoice=!1,this.clearPrompt(),this._pendingSubtypeChoice=null}}_onComponentKeyDown({key:e,target:t}){const i=this._getFieldInputFromHTMLElement(t);"Enter"===e&&_(i)&&!i.group.open&&(i.group.open=!0)}_updateFieldValue(e,t){const i=this.viewModel.getValue(e);this.viewModel.setValue(e,t),this._inputsWithChanges.add(e);i!==t&&this.viewModel.fieldsWithContingentValues.has(e)&&this._validateContingenciesForNonNullFields()}_validateContingenciesForNonNullFields(){const e=Object.fromEntries(Object.entries(this.getValues()).filter((([e,t])=>null!=t)));this.viewModel.validateContingencyConstraints(e)}_parseValue(e){const t=this._getFieldInputFromHTMLElement(e),i=e.value;return b(t.element,"switch")?e.checked?t.element.input.onValue:t.element.input.offValue:null==i||""===i?null:"number"===t.dataType?"-0"===i||"-0."===i||"-0,"===i?i:parseFloat(i):"date"===t.field.type?parseFloat(i):i}_ignoreDeselectionOfNoValueOption(e){const{firstChild:t,selectedItems:o}=e;0===o.length&&t&&"selected"in t?t.selected=!0:i.getLogger(this).warnOnce("Failed to override user attempt to deselect 'No value' option.")}_onGroupToggle(e,t){e.open?(t.open=!0,this._focusedFieldName=this._getFocusableInput("forward",t)?.name||null,this._attemptFocusOnNextRender=!0,"sequential"===this.groupDisplay&&this.viewModel.allGroupInputs.forEach((e=>{e!==t&&(e.open=!1)}))):t.open=!1,this.scheduleRender()}_onFormSubmit(e){e.preventDefault()}_onFormKeyDown(e){"Enter"===e.key&&this.viewModel.submit()}_afterListObserverCreated(e){this.viewModel.activeRelationshipInput&&(this._listObserverNode=e)}_afterListObserverRemoved(){this._listObserverNode=null}_onObserverChange(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode);const e=this.viewModel.activeRelationshipInput;e&&this._listObserverNode&&e.showAllEnabled&&this._listObserver.observe(this._listObserverNode)}_incrementRelatedRecordPage(){const e=this.viewModel.activeRelationshipInput;e?.incrementPage()}_syncGroupInputStates(){if("sequential"!==this.groupDisplay)return;const e=this.viewModel.allGroupInputs;if(!e.length)return;const t=e.filter((e=>e.open));0===t.length?e[0].open=!0:t.length>1&&t.slice(1).forEach((e=>e.open=!1))}get test(){return{inputsWithChanges:this._inputsWithChanges}}};e([s()],H.prototype,"_listObserverNode",void 0),e([s()],H.prototype,"_relatedRecordsEnabled",null),e([s()],H.prototype,"_prompt",void 0),e([s()],H.prototype,"disabled",null),e([s()],H.prototype,"feature",null),e([s()],H.prototype,"formTemplate",null),e([s()],H.prototype,"groupDisplay",void 0),e([s()],H.prototype,"headingLevel",void 0),e([s()],H.prototype,"icon",null),e([s()],H.prototype,"label",null),e([s()],H.prototype,"layer",null),e([s()],H.prototype,"map",null),e([s(),E("esri/widgets/FeatureForm/t9n/FeatureForm")],H.prototype,"messages",void 0),e([s(),E("esri/t9n/common")],H.prototype,"messagesCommon",void 0),e([s(),E("esri/widgets/Feature/t9n/Feature")],H.prototype,"messagesFeature",void 0),e([s(),E("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],H.prototype,"messagesTemplates",void 0),e([s()],H.prototype,"relatedRecordCallbacks",null),e([s()],H.prototype,"relationshipId",null),e([s()],H.prototype,"spatialReference",null),e([s()],H.prototype,"strict",null),e([s()],H.prototype,"timeZone",null),e([s()],H.prototype,"showPrompt",null),e([s()],H.prototype,"clearPrompt",null),e([s(),U(["value-change","submit"])],H.prototype,"viewModel",void 0),e([s()],H.prototype,"test",null),H=e([r("esri.widgets.FeatureForm")],H);const Z=H;export{Z 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.31/esri/copyright.txt for details.
4
4
  */
5
- const e="esri-oriented-imagery-viewer",o=`${e}__carousel`,t=`${e}__image-enhancement`,a=`${e}__navigation`,r="--oi-navigation-tool-rotation-from",n="--oi-navigation-tool-rotation-to",i={addCoverage:`${e}__body-additional-coverage`,addExpPoints:`${e}__body-additional-camera-locations`,body:`${e}__body`,carousel:`${e}__carousel`,carouselContainer:`${o}-container`,carouselContent:`${o}-content`,carouselItem:`${o}-item`,carouselItemWrapper:`${o}-item-wrapper`,close:`${e}__close`,currentCoverage:`${e}__body-current-coverage`,dock:`${e}--docked`,feature:`${a}-feature`,float:`${e}--floating`,footprint:`${e}__body-footprint`,imageEnhancementWrapper:`${t}-wrapper`,imageEnhancementTools:`${t}-tools`,imageEnhancementToolContainer:`${t}-tool-container`,messageBox:`${e}__message-box`,navigationPathOffset0:`${a}-feature-path-stop-offset-0`,navigationPathOffset1:`${a}-feature-path-stop-offset-1`,navigationWrapper:`${a}-wrapper`,navigationZoomed:`${a}-wrapper--zoomed`,north:`${a}-pointer-north`,outerSector:`${a}-sector-outer`,pointer:`${a}-pointer`,rotateWithAnimation:`${a}-animate`,selectedFeaturePath:`${a}-feature-path`,sector:`${a}-sector`,sectorCross:`${a}-sector-cross`,sectorDisabled:`${a}-sector-disabled`,sectorEnabled:`${a}-sector-enabled`,sectorSeparator:`${a}-sector-separator`,submenu:`${e}__submenu`,viewer:`${e}__viewer`,viewerContainer:`${e}__viewer-container`},s=120,c=[21,36,51,60],$=3.5,_=["FAR_WEST","FAR_NORTH","FAR_EAST","FAR_SOUTH","WEST","NORTH","EAST","SOUTH","NEAR_WEST","NEAR_NORTH","NEAR_EAST","NEAR_SOUTH"],p=23.937554159486076,d=96.06244584051393,l={EAST:[p,p,d,p,60,p],NORTH:[p,d,p,p,p,60],SOUTH:[d,p,d,d,d,60],WEST:[d,d,p,d,60,d]};export{o as carousel,i as css,$ as featureCircleRadius,t as imageEnhancement,a as navigation,s as navigationToolDimensionLength,r as navigationToolRotationFrom,n as navigationToolRotationTo,e as root,_ as sectorsInOrder,c as sectorsRadii,l as segmentArcs};
5
+ const e="esri-oriented-imagery-viewer",o=`${e}__carousel`,t=`${e}__image-enhancement`,a=`${e}__navigation`,r="--oi-navigation-tool-rotation-from",n="--oi-navigation-tool-rotation-to",i={addCoverage:`${e}__body-additional-coverage`,addExpPoints:`${e}__body-additional-camera-locations`,body:`${e}__body`,carousel:`${e}__carousel`,carouselContainer:`${o}-container`,carouselContent:`${o}-content`,carouselItem:`${o}-item`,carouselItemWrapper:`${o}-item-wrapper`,close:`${e}__close`,currentCoverage:`${e}__body-current-coverage`,feature:`${a}-feature`,footprint:`${e}__body-footprint`,imageEnhancementWrapper:`${t}-wrapper`,imageEnhancementTools:`${t}-tools`,imageEnhancementToolContainer:`${t}-tool-container`,messageBox:`${e}__message-box`,navigationPathOffset0:`${a}-feature-path-stop-offset-0`,navigationPathOffset1:`${a}-feature-path-stop-offset-1`,navigationWrapper:`${a}-wrapper`,navigationZoomed:`${a}-wrapper--zoomed`,north:`${a}-pointer-north`,outerSector:`${a}-sector-outer`,pointer:`${a}-pointer`,rotateWithAnimation:`${a}-animate`,selectedFeaturePath:`${a}-feature-path`,sector:`${a}-sector`,sectorCross:`${a}-sector-cross`,sectorDisabled:`${a}-sector-disabled`,sectorEnabled:`${a}-sector-enabled`,sectorSeparator:`${a}-sector-separator`,submenu:`${e}__submenu`,viewer:`${e}__viewer`,viewerContainer:`${e}__viewer-container`},s=120,c=[21,36,51,60],$=3.5,_=["FAR_WEST","FAR_NORTH","FAR_EAST","FAR_SOUTH","WEST","NORTH","EAST","SOUTH","NEAR_WEST","NEAR_NORTH","NEAR_EAST","NEAR_SOUTH"],p=23.937554159486076,d=96.06244584051393,l={EAST:[p,p,d,p,60,p],NORTH:[p,d,p,p,p,60],SOUTH:[d,p,d,d,d,60],WEST:[d,d,p,d,60,d]};export{o as carousel,i as css,$ as featureCircleRadius,t as imageEnhancement,a as navigation,s as navigationToolDimensionLength,r as navigationToolRotationFrom,n as navigationToolRotationTo,e as root,_ as sectorsInOrder,c as sectorsRadii,l as segmentArcs};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{prefersReducedMotion as t}from"../core/a11yUtils.js";import{deprecatedProperty as i}from"../core/deprecate.js";import o from"../core/Logger.js";import{deg2rad as a}from"../core/mathUtils.js";import{watch as s,initial as r}from"../core/reactiveUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{rotatePixel as c}from"../layers/orientedImagery/transformations/utils.js";import d from"../layers/support/rasterDatasets/RasterFactory.js";import h from"./Widget.js";import{getAllArcPath as g}from"./OrientedImageryViewer/arcUtils.js";import{css as m,segmentArcs as p,sectorsRadii as u,featureCircleRadius as v,navigation as b,navigationToolDimensionLength as y,navigationToolRotationFrom as w,navigationToolRotationTo as _,root as C}from"./OrientedImageryViewer/constants.js";import f from"./OrientedImageryViewer/OrientedImageryViewerViewModel.js";import M from"./OrientedImageryViewer/OrientedImageryViewerVisibleElements.js";import{loadCalciteComponents as I}from"./support/componentsUtils.js";import{globalCss as T}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as A}from"./support/decorators/messageBundle.js";import{tsx as E}from"./support/jsxFactory.js";import{substitute as k}from"../intl/substitute.js";let V=class extends h{constructor(e,t){super(e,t),this.dockEnabled=!1,this.galleryOpened=!1,this.imageEnhancementToolActive=!1,this.navigationToolActive=!1,this.viewModel=new f,this.messagesCommon=null,this.visibleElements=new M,this._navigationToolExpanded=!1,this._navigationTool=null,this._actionItems=new Map,this._galleryController=new AbortController,this._galleryObserver=new IntersectionObserver(this._lazyLoadImage.bind(this)),this._highlight=e=>{const t=e.target?.dataset.objectid;t&&this.viewModel.highlight(t)},this._removeHighlight=()=>this.viewModel.removeHighlight(),this._scaleNavigationTool=()=>{this._navigationToolExpanded=!this._navigationToolExpanded},this._toggleImageAttributes=()=>{this.viewModel.toggleImageAttributes()},this._loadImageFromGallery=this._loadImageFromGallery.bind(this),this._registerGalleryItem=this._registerGalleryItem.bind(this),this._unregisterGalleryItem=this._unregisterGalleryItem.bind(this),this._renderViewerContainer=this._renderViewerContainer.bind(this),this.loadImageFromSource=this.loadImageFromSource.bind(this),this.updateSuitabilities=this.updateSuitabilities.bind(this)}initialize(){this.addHandles([s((()=>[this.viewModel?.bestFeatureAngle,this._navigationTool]),(([e,t])=>{t&&this._updateNavigationTool(t)}),r),s((()=>this.currentCoverageVisible),(e=>this._onCurrentCoverageVisibilityChange(e))),s((()=>this.isAdditionalCoverageVisible),(e=>this._onAdditionalCoverageVisibilityChange(e))),s((()=>this.isAdditionalPointSourcesVisible),(e=>this._onAdditionalCameraLocationsVisibility(e)))])}loadDependencies(){return I({tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js"),action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group.js"),"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel.js"),slider:()=>import("@esri/calcite-components/dist/components/calcite-slider.js")})}destroy(){this._galleryController.abort(),this._galleryObserver.disconnect()}get activeLayer(){return i(o.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){i(o.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer=e}get currentBestFeature(){return this.viewModel.currentBestFeature}set currentBestFeature(e){this.viewModel.currentBestFeature=e}get currentCoverageVisible(){return this.viewModel.currentCoverageVisible}set currentCoverageVisible(e){this.viewModel.currentCoverageVisible=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get displayMessage(){return this.viewModel.displayMessage}set drawFootprint(e){this.viewModel.drawFootprint=e}get drawFootprint(){return this.viewModel.drawFootprint}get features(){return this.viewModel.features}get imagePointsInView(){return this.viewModel.imagePointsInView}get isDocked(){return i(o.getLogger(this),"isDocked",{replacement:"dockEnabled"}),this.dockEnabled}set isDocked(e){i(o.getLogger(this),"isDocked",{replacement:"dockEnabled"}),this.dockEnabled=e}get icon(){return"oriented-imagery-widget"}set icon(e){this._overrideIfSome("icon",e)}get imageGalleryEnabled(){return this.viewModel.imageGalleryEnabled}get isAdditionalCoverageVisible(){return this.viewModel.isAdditionalCoverageVisible}set isAdditionalCoverageVisible(e){this.viewModel.isAdditionalCoverageVisible=e}get isAdditionalPointSourcesVisible(){return this.viewModel.isAdditionalPointSourcesVisible}set isAdditionalPointSourcesVisible(e){this.viewModel.isAdditionalPointSourcesVisible=e}get mapImageConversionToolState(){return this.viewModel.mapImageConversionToolState}set mapImageConversionToolState(e){this.viewModel.mapImageConversionToolState=e}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get popupEnabled(){const{popupEnabled:e,state:t}=this.viewModel;return"image-loaded"===t&&e}get referencePoint(){return this.viewModel.referencePoint??null}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}set determineWorkflowForFeature(e){this.viewModel.determineWorkflowForFeature=e}get determineWorkflowForFeature(){return this.viewModel.determineWorkflowForFeature}set updateFootprint(e){this.viewModel.updateFootprint=e}get updateFootprint(){return this.viewModel.updateFootprint}async _getThumbnailPixelBlockInternal(e,t){const{level:i,offset:a,size:s}=this._getMaxLevelRasterParameters(e);try{const{pixelBlock:o}=await e.fetchRawPixels(i,a,s,t);return o}catch(r){o.getLogger(this).warn("failed to create canvas with pixel data",r)}return null}_getMaxLevelRasterParameters(e){const{storageInfo:t,width:i,height:o}=e.rasterInfo,{maximumPyramidLevel:a,pyramidScalingFactor:s}=t,r=s??2;return{level:a,offset:{x:0,y:0},size:{width:Math.ceil(i/r**a),height:Math.ceil(o/r**a)}}}async _getThumbnailPixelBlock(e){const{signal:t}=this._galleryController;try{const i=await d.open({url:e,signal:t});return i?await this._getThumbnailPixelBlockInternal(i,{signal:t}):null}catch(i){o.getLogger(this).error("failed to create thumbnail",i)}return null}_handleBrightnessChange(e){this.viewModel.brightness=e.target.value??0}_handleContrastChange(e){this.viewModel.contrast=e.target.value??0}_handleSharpnessChange(e){this.viewModel.sharpness=e.target.value??0}_lazyLoadImage(e,t){e.forEach((async e=>{if(e.isIntersecting){const i=e.target,s=i.getAttribute("data-src"),r=i.getAttribute("data-rotation"),n=r?parseFloat(r)%360:null;if(!s)return;const l=await this._getThumbnailPixelBlock(s);if(!l)return;i.width=l.width,i.height=l.height;const d=i.getContext("2d");if(!d)return;const h=d.createImageData(i.width,i.height);if(h.data.set(l.getAsRGBA()),"number"==typeof n&&0!==n){const e=a(n),s=document.createElement("canvas"),r=s.getContext("2d");if(r){s.width=h.width,s.height=h.height,r.putImageData(h,0,0);const o=c(0,0,e),a=c(h.width,0,e),n=c(h.width,h.height,e),l=c(0,h.height,e),g=Math.max(o[0],a[0],n[0],l[0])-Math.min(o[0],a[0],n[0],l[0]),m=Math.max(o[1],a[1],n[1],l[1])-Math.min(o[1],a[1],n[1],l[1]),p=Math.min(i.width/g,i.height/m);return d.save(),d.clearRect(0,0,i.width,i.height),d.translate(i.width/2,i.height/2),d.rotate(e),d.scale(p,p),d.drawImage(s,-h.width/2,-h.height/2,h.width,h.height),d.restore(),t.unobserve(i)}o.getLogger(this).warn("oriented-imagery-viewer:image-gallery","failed to apply rotation on thumbnail")}d.putImageData(h,0,0),t.unobserve(i)}}))}_loadImageFromGallery(e){const{target:t}=e;if(!t)return;const i=t.getAttribute("data-objectid");i&&this.viewModel.currentBestFeature?.attributes.objectId!==Number(i)&&this.viewModel.selectBestFeature(i)}_onAdditionalCoverageVisibilityChange(e){this.viewModel.setAdditionalCoverageVisibility(e)}_onAdditionalCameraLocationsVisibility(e){this.viewModel.setAdditionalCameraLocationsVisibility(e)}_onCurrentCoverageVisibilityChange(e){this.viewModel.setCurrentCoverageVisibility(e)}_registerGalleryItem(e){this._galleryObserver.observe(e)}_renderActionTooltips(){return[...this._actionItems].map((([e,t])=>E("calcite-tooltip",{key:e,referenceElement:t},E("span",null,e))))}_renderBody(){return E("div",{class:m.body},this._renderViewerContainer(),this._renderImageGallery(),this._renderImageEnhancementTools(),this._renderNavigation())}_renderImageEnhancementTools(){const{imageEnhancementToolActive:e,viewModel:{brightness:t,contrast:i,sharpness:o}}=this;return e&&E("calcite-panel",{bind:this,class:m.imageEnhancementWrapper,closable:!0,closed:!e,heading:this.messages.imageEnhancement,key:this.messages.imageEnhancement,onCalcitePanelClose:this._toggleImageEnhancementToolState},E("div",{class:m.imageEnhancementTools},E("div",{class:m.imageEnhancementToolContainer},E("calcite-label",null,this.messages.brightness,E("calcite-slider",{bind:this,labelTicks:!0,max:10,min:-10,ticks:5,value:t,onCalciteSliderInput:this._handleBrightnessChange}))),E("div",{class:m.imageEnhancementToolContainer},E("calcite-label",null,this.messages.contrast,E("calcite-slider",{bind:this,labelTicks:!0,max:10,min:-10,ticks:5,value:i,onCalciteSliderInput:this._handleContrastChange}))),E("div",{class:m.imageEnhancementToolContainer},E("calcite-label",null,this.messages.sharpness,E("calcite-slider",{bind:this,labelTicks:!0,max:1,min:0,step:.1,ticks:.5,value:o,onCalciteSliderInput:this._handleSharpnessChange})))),E("calcite-action",{bind:this,icon:"reset",onclick:this._resetImageTools,slot:"header-actions-end",text:this.messagesCommon.reset}))}_renderImageGallery(){const{container:e,galleryOpened:t,imageGalleryEnabled:i,viewModel:{thumbnails:o}}=this;return i&&t&&(e&&o)?E("calcite-panel",{bind:this,class:m.carousel,closable:!0,closed:!t,heading:this.messages.imageGallery,key:this.messages.imageGallery,onCalcitePanelClose:this._toggleImageGallery},E("div",{class:m.carouselContainer},this._renderThumbnails(o))):null}_renderMapImageConversionTool(){const{mapImageConversionToolState:e,viewModel:{state:t}}=this;return E("calcite-action",{active:e,afterCreate:this._storeActionElement,bind:this,disabled:"image-loaded"!==t,icon:"image-pin",onclick:this._toggleMapImageConversionToolState,text:this.messages.mapImageConversionTool})}_renderNavigation(){const{viewModel:{sectorData:e,navigatorCurrentBestFeature:i,currentBestFeature:o,state:a}}=this;if(!this.container||!o)return null;let s,r,n,l,c;if(i){const{x:e,y:t,direction:o}=i,[a,d,h,g]=p[o];s=`M ${e} ${t} L ${a} ${d} A ${u[2]} ${u[2]} 0 0 1 ${h} ${g} Z`,r=e,l=t,n=p[o][4],c=p[o][5]}const d=e=>{const t=e.target.dataset?.sector;t&&this.viewModel.handleSectorClick(+t)},h=e=>{const t=e.target.dataset;if(!t)return;const{featureIndexInSector:i,sector:o}=t;i&&o&&this.viewModel.handleFeatureClick({sector:o,featureIndexInSector:+i})},w=e=>{e.removeEventListener("click",h)},_=o.attributes.objectId,C=e?.map((e=>e?.items)).filter(Boolean).flatMap((e=>e?.map((({x:e,y:t,objectID:i,featureIndexInSector:o,sector:a})=>E("circle",{afterRemoved:w,class:this.classes(m.feature,{selected:_===i}),cx:e,cy:t,"data-feature-index-in-sector":o,"data-sector":a,key:`${m.feature}-${i}`,onclick:h,r:v}))))),f=e=>{e.removeEventListener("click",d)},M=this.classes({[m.navigationWrapper]:!0,[m.navigationZoomed]:this._navigationToolExpanded});return this.navigationToolActive&&"image-loaded"===a?E("div",{bind:this,class:M,key:this.messages.navigationTool},E("svg",{afterCreate:e=>this._storeNavigationToolReference(e),class:t()?b:m.rotateWithAnimation,focusable:"false",height:y,role:"img",width:y,xmlns:"http://www.w3.org/2000/svg"},E("defs",null,E("linearGradient",{gradientUnits:"userSpaceOnUse",id:`${this.id}-coverage-fill`,x1:r,x2:n,y1:l,y2:c},E("stop",{class:m.navigationPathOffset0,offset:0}),E("stop",{class:m.navigationPathOffset1,offset:1}))),E("g",null,E("circle",{class:this.classes(m.sector,m.outerSector),cx:u[3],cy:u[3],onclick:this._scaleNavigationTool,r:u[3]}),E("circle",{class:m.sector,cx:u[3],cy:u[3],r:u[2]}),E("circle",{class:m.sector,cx:u[3],cy:u[3],r:u[1]}),E("circle",{class:m.sector,cx:u[3],cy:u[3],r:u[0]}),E("path",{class:m.pointer,d:"M 56.5 6.06217782649107 L 60 0 L 63.5 6.06217782649107 Z",key:`${m.pointer}-west`}),E("path",{class:this.classes(m.pointer,m.north),d:"M 113.93782217350893 56.5 L 120 60 L 113.93782217350893 63.5 Z",key:`${m.pointer}-north`}),E("path",{class:m.pointer,d:"M 56.5 113.93782217350893 L 60 120 L 63.5 113.93782217350893 Z",key:`${m.pointer}-east`}),E("path",{class:m.pointer,d:"M 6.06217782649107 56.5 L 0 60 L 6.06217782649107 63.5 Z",key:`${m.pointer}-south`}),E("path",{class:this.classes(m.sector,m.sectorSeparator),d:"M 23.937554159486076 23.937554159486076 L 96.06244584051393 96.06244584051393 M 23.937554159486076 96.06244584051393 L 96.06244584051393 23.937554159486076",key:m.sectorSeparator}),g([u[2],u[1],u[0]],u[3],u[3]).map(((t,i)=>E("path",{afterRemoved:f,class:this.classes(m.sector,e?.[i]?.length?m.sectorEnabled:m.sectorDisabled),d:t,"data-sector":`${i}`,key:`${m.sector}-${i}`,onclick:d}))),E("path",{class:this.classes(m.sector,m.sectorCross),d:"M 56.4 56.4 L 63.53 63.53 M 63.53 56.4 L 56.4 63.53",key:m.sectorCross}),C,o.attributes.cameraPitch>=5&&s?E("path",{class:m.selectedFeaturePath,d:s,fill:`url(#${this.id}-coverage-fill)`,key:m.selectedFeaturePath}):null))):null}_renderNavigationTool(){const{state:e}=this.viewModel;return E("calcite-action",{active:this.navigationToolActive,afterCreate:this._storeActionElement,bind:this,disabled:"image-loaded"!==e,icon:"explore",onclick:this._toggleNavigationTool,text:this.messages.navigationTool})}_renderImageEnhancementTool(){const{state:e,mode:t}=this.viewModel;return E("calcite-action",{active:this.imageEnhancementToolActive,afterCreate:this._storeActionElement,bind:this,disabled:"default"!==t||"image-loaded"!==e,icon:"sliders-horizontal",onclick:this._toggleImageEnhancementToolState,text:this.messages.imageEnhancement})}_renderMenuBarContainer(){const{currentCoverageVisible:e,isAdditionalCoverageVisible:t,isAdditionalPointSourcesVisible:i,imageGalleryEnabled:o}=this;return E("calcite-action-bar",{expandDisabled:!0,layout:"horizontal",slot:"action-bar"},E("calcite-action-group",{expanded:!0},E("calcite-action",{active:e,afterCreate:this._storeActionElement,bind:this,class:m.currentCoverage,icon:"trapezoid-area",onclick:this._toggleCurrentCoverage,text:this.messages.currentFootprint}),E("calcite-action",{active:t,afterCreate:this._storeActionElement,bind:this,class:m.addCoverage,icon:"trapezoid-area",onclick:this._toggleAdditionalCoverage,text:this.messages.additionalFootprints}),E("calcite-action",{active:i,afterCreate:this._storeActionElement,bind:this,class:m.addExpPoints,icon:"circle-area",onclick:this._toggleAdditionalCameraLocations,text:this.messages.additionalCameraLocations})),E("calcite-action-group",{layout:"horizontal"},this.visibleElements.mapImageConversionTool?this._renderMapImageConversionTool():null,this.visibleElements.navigationTool?this._renderNavigationTool():null,this.visibleElements.imageEnhancement?this._renderImageEnhancementTool():null),E("calcite-action-group",null,E("calcite-action",{active:this.galleryOpened,afterCreate:this._storeActionElement,bind:this,disabled:!o,icon:"images",onclick:this._toggleImageGallery,text:this.messages.imageGallery,textEnabled:!0}),this.visibleElements.showPopupsAction?this._renderPopupAction():null),this._renderActionTooltips())}_renderMessageBox(){const{messages:e,viewModel:{displayMessage:t}}=this;if(!t)return null;const{data:i,key:o,map:a}=t,s=`${a?k(e[o],a):e[o]}`;return E("span",{class:m.messageBox},i?`${s} ${i}`:s)}_renderPopupAction(){return E("calcite-action",{afterCreate:this._storeActionElement,bind:this,disabled:!this.popupEnabled,icon:"popup",onclick:this._toggleImageAttributes,text:this.messages.showPopups,textEnabled:!0})}_renderThumbnails(e){const{currentBestFeature:t}=this.viewModel;return t?E("div",{class:m.carouselContent},e.items.map((({url:e,objectId:i,rotation:o},a)=>E("div",{class:`${m.carouselItemWrapper}${t.attributes.objectId===i?"--selected":""}`,key:`${m.carouselItemWrapper}-${a}`},E("canvas",{afterCreate:this._registerGalleryItem,afterRemoved:this._unregisterGalleryItem,alt:`thumbnail-${i}`,class:m.carouselItem,"data-objectid":`${i}`,"data-rotation":`${o}`,"data-src":e,onclick:this._loadImageFromGallery,onmouseenter:this._highlight,onmouseleave:this._removeHighlight}))))):null}_renderViewerContainer(){return E("div",{class:m.viewerContainer},this._renderImageViewer(),this._renderPanoramicViewer(),this._renderMessageBox())}_renderImageViewer(){const{displayMessage:e,loadImageViewer:t,mode:i}=this.viewModel,o=`${m.viewer}${e||"default"!==i?"--hide":""}`;return E("calcite-panel",{afterCreate:t,bind:this,class:o})}_renderPanoramicViewer(){const{displayMessage:e,loadPanoramicViewer:t,mode:i}=this.viewModel,o=`${m.viewer}${e||"panoramic"!==i?"--hide":""}`;return E("calcite-panel",{afterCreate:t,bind:this,class:o})}_resetImageTools(){this.viewModel.sharpness=this.viewModel.brightness=this.viewModel.contrast=0}_storeActionElement(e){this._actionItems.set(e.text,e)}_storeNavigationToolReference(e){this._navigationTool=e}_toggleAdditionalCameraLocations(){this.isAdditionalPointSourcesVisible=!this.isAdditionalPointSourcesVisible}_toggleAdditionalCoverage(){this.isAdditionalCoverageVisible=!this.isAdditionalCoverageVisible}_toggleCurrentCoverage(){this.currentCoverageVisible=!this.currentCoverageVisible}_toggleImageEnhancementToolState(e){e.stopPropagation(),this.imageEnhancementToolActive=!this.imageEnhancementToolActive,this.imageEnhancementToolActive&&(this.galleryOpened&&(this.galleryOpened=!1),this.navigationToolActive&&(this.navigationToolActive=!1))}_toggleImageGallery(e){e.stopPropagation(),this.galleryOpened=!!this.imageGalleryEnabled&&!this.galleryOpened,this.galleryOpened&&(this.imageEnhancementToolActive&&(this.imageEnhancementToolActive=!1),this.navigationToolActive&&(this.navigationToolActive=!1))}_toggleNavigationTool(){this.navigationToolActive=!this.navigationToolActive,this.navigationToolActive&&(this.galleryOpened&&(this.galleryOpened=!1),this.imageEnhancementToolActive&&(this.imageEnhancementToolActive=!1))}_toggleMapImageConversionToolState(){this.mapImageConversionToolState=!this.mapImageConversionToolState}_unregisterGalleryItem(e){this._galleryObserver.unobserve(e)}_updateNavigationTool(e){const{previousFeatureAngle:t,bestFeatureAngle:i}=this.viewModel,o=(i-t+540)%360-180;e.style.setProperty(w,`${t}deg`),e.style.setProperty(_,`${t+o}deg`)}async loadBestImage(e){return this.viewModel.loadBestImage(e)}loadImageFromSource(e,t){return this.viewModel.loadImageFromSource(e,t)}async plotMapPoint(e){return this.viewModel.plotMapPoint(e)}plotReferencePointOnGround(e){this.viewModel.plotReferencePointOnGround(e)}plotReferencePointOnImage(e){this.viewModel.plotReferencePointOnImage(e)}resetImage(){this.viewModel.resetImage()}render(){const{dockEnabled:e,viewModel:{state:t}}=this;return E("div",{class:this.classes(T.widget,C)},E("calcite-panel",{bind:this,class:e?m.dock:m.float,heading:this.visibleElements.title?this.messages.title:void 0,loading:"image-loading"===t},this.visibleElements.coverageMenu?this._renderMenuBarContainer():null,this._renderBody()))}updateSuitabilities(e){this.viewModel.updateSuitabilities(e)}};e([n()],V.prototype,"activeLayer",null),e([n()],V.prototype,"currentBestFeature",null),e([n()],V.prototype,"currentCoverageVisible",null),e([n()],V.prototype,"disabled",null),e([n()],V.prototype,"dockEnabled",void 0),e([n()],V.prototype,"drawFootprint",null),e([n()],V.prototype,"features",null),e([n()],V.prototype,"imagePointsInView",null),e([n()],V.prototype,"isDocked",null),e([n()],V.prototype,"galleryOpened",void 0),e([n()],V.prototype,"icon",null),e([n()],V.prototype,"imageEnhancementToolActive",void 0),e([n({readOnly:!0})],V.prototype,"imageGalleryEnabled",null),e([n()],V.prototype,"isAdditionalCoverageVisible",null),e([n()],V.prototype,"isAdditionalPointSourcesVisible",null),e([n()],V.prototype,"mapImageConversionToolState",null),e([n()],V.prototype,"layer",null),e([n()],V.prototype,"navigationToolActive",void 0),e([n({type:f})],V.prototype,"viewModel",void 0),e([n(),A("esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer")],V.prototype,"messages",void 0),e([n(),A("esri/t9n/common")],V.prototype,"messagesCommon",void 0),e([n({readOnly:!0})],V.prototype,"popupEnabled",null),e([n()],V.prototype,"referencePoint",null),e([n()],V.prototype,"view",null),e([n({type:M,nonNullable:!0})],V.prototype,"visibleElements",void 0),e([n()],V.prototype,"determineWorkflowForFeature",null),e([n()],V.prototype,"updateFootprint",null),e([n()],V.prototype,"_navigationToolExpanded",void 0),e([n()],V.prototype,"_navigationTool",void 0),V=e([l("esri.widgets.OrientedImageryViewer")],V);const x=V;export{x as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{prefersReducedMotion as t}from"../core/a11yUtils.js";import{deprecatedProperty as i}from"../core/deprecate.js";import o from"../core/Logger.js";import{deg2rad as a}from"../core/mathUtils.js";import{watch as s,initial as r}from"../core/reactiveUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{rotatePixel as c}from"../layers/orientedImagery/transformations/utils.js";import d from"../layers/support/rasterDatasets/RasterFactory.js";import h from"./Widget.js";import{getAllArcPath as g}from"./OrientedImageryViewer/arcUtils.js";import{css as m,segmentArcs as p,sectorsRadii as u,featureCircleRadius as v,navigation as y,navigationToolDimensionLength as b,navigationToolRotationFrom as w,navigationToolRotationTo as _,root as C}from"./OrientedImageryViewer/constants.js";import f from"./OrientedImageryViewer/OrientedImageryViewerViewModel.js";import M from"./OrientedImageryViewer/OrientedImageryViewerVisibleElements.js";import{loadCalciteComponents as I}from"./support/componentsUtils.js";import{globalCss as T}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as A}from"./support/decorators/messageBundle.js";import{tsx as E}from"./support/jsxFactory.js";import{substitute as V}from"../intl/substitute.js";let x=class extends h{constructor(e,t){super(e,t),this.galleryOpened=!1,this.imageEnhancementToolActive=!1,this.navigationToolActive=!1,this.viewModel=new f,this.messagesCommon=null,this.visibleElements=new M,this._navigationToolExpanded=!1,this._navigationTool=null,this._actionItems=new Map,this._galleryController=new AbortController,this._galleryObserver=new IntersectionObserver(this._lazyLoadImage.bind(this)),this._highlight=e=>{const t=e.target?.dataset.objectid;t&&this.viewModel.highlight(t)},this._removeHighlight=()=>this.viewModel.removeHighlight(),this._scaleNavigationTool=()=>{this._navigationToolExpanded=!this._navigationToolExpanded},this._toggleImageAttributes=()=>{this.viewModel.toggleImageAttributes()},this._loadImageFromGallery=this._loadImageFromGallery.bind(this),this._registerGalleryItem=this._registerGalleryItem.bind(this),this._unregisterGalleryItem=this._unregisterGalleryItem.bind(this),this._renderViewerContainer=this._renderViewerContainer.bind(this),this.loadImageFromSource=this.loadImageFromSource.bind(this),this.updateSuitabilities=this.updateSuitabilities.bind(this)}initialize(){this.addHandles([s((()=>[this.viewModel?.bestFeatureAngle,this._navigationTool]),(([e,t])=>{t&&this._updateNavigationTool(t)}),r),s((()=>this.currentCoverageVisible),(e=>this._onCurrentCoverageVisibilityChange(e))),s((()=>this.isAdditionalCoverageVisible),(e=>this._onAdditionalCoverageVisibilityChange(e))),s((()=>this.isAdditionalPointSourcesVisible),(e=>this._onAdditionalCameraLocationsVisibility(e)))])}loadDependencies(){return I({tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js"),action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group.js"),"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel.js"),slider:()=>import("@esri/calcite-components/dist/components/calcite-slider.js")})}destroy(){this._galleryController.abort(),this._galleryObserver.disconnect()}get activeLayer(){return i(o.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){i(o.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer=e}get currentBestFeature(){return this.viewModel.currentBestFeature}set currentBestFeature(e){this.viewModel.currentBestFeature=e}get currentCoverageVisible(){return this.viewModel.currentCoverageVisible}set currentCoverageVisible(e){this.viewModel.currentCoverageVisible=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get displayMessage(){return this.viewModel.displayMessage}set drawFootprint(e){this.viewModel.drawFootprint=e}get drawFootprint(){return this.viewModel.drawFootprint}get features(){return this.viewModel.features}get imagePointsInView(){return this.viewModel.imagePointsInView}get icon(){return"oriented-imagery-widget"}set icon(e){this._overrideIfSome("icon",e)}get imageGalleryEnabled(){return this.viewModel.imageGalleryEnabled}get isAdditionalCoverageVisible(){return this.viewModel.isAdditionalCoverageVisible}set isAdditionalCoverageVisible(e){this.viewModel.isAdditionalCoverageVisible=e}get isAdditionalPointSourcesVisible(){return this.viewModel.isAdditionalPointSourcesVisible}set isAdditionalPointSourcesVisible(e){this.viewModel.isAdditionalPointSourcesVisible=e}get mapImageConversionToolState(){return this.viewModel.mapImageConversionToolState}set mapImageConversionToolState(e){this.viewModel.mapImageConversionToolState=e}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get popupEnabled(){const{popupEnabled:e,state:t}=this.viewModel;return"image-loaded"===t&&e}get referencePoint(){return this.viewModel.referencePoint??null}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}set determineWorkflowForFeature(e){this.viewModel.determineWorkflowForFeature=e}get determineWorkflowForFeature(){return this.viewModel.determineWorkflowForFeature}set updateFootprint(e){this.viewModel.updateFootprint=e}get updateFootprint(){return this.viewModel.updateFootprint}async _getThumbnailPixelBlockInternal(e,t){const{level:i,offset:a,size:s}=this._getMaxLevelRasterParameters(e);try{const{pixelBlock:o}=await e.fetchRawPixels(i,a,s,t);return o}catch(r){o.getLogger(this).warn("failed to create canvas with pixel data",r)}return null}_getMaxLevelRasterParameters(e){const{storageInfo:t,width:i,height:o}=e.rasterInfo,{maximumPyramidLevel:a,pyramidScalingFactor:s}=t,r=s??2;return{level:a,offset:{x:0,y:0},size:{width:Math.ceil(i/r**a),height:Math.ceil(o/r**a)}}}async _getThumbnailPixelBlock(e){const{signal:t}=this._galleryController;try{const i=await d.open({url:e,signal:t});return i?await this._getThumbnailPixelBlockInternal(i,{signal:t}):null}catch(i){o.getLogger(this).error("failed to create thumbnail",i)}return null}_handleBrightnessChange(e){this.viewModel.brightness=e.target.value??0}_handleContrastChange(e){this.viewModel.contrast=e.target.value??0}_handleSharpnessChange(e){this.viewModel.sharpness=e.target.value??0}_lazyLoadImage(e,t){e.forEach((async e=>{if(e.isIntersecting){const i=e.target,s=i.getAttribute("data-src"),r=i.getAttribute("data-rotation"),n=r?parseFloat(r)%360:null;if(!s)return;const l=await this._getThumbnailPixelBlock(s);if(!l)return;i.width=l.width,i.height=l.height;const d=i.getContext("2d");if(!d)return;const h=d.createImageData(i.width,i.height);if(h.data.set(l.getAsRGBA()),"number"==typeof n&&0!==n){const e=a(n),s=document.createElement("canvas"),r=s.getContext("2d");if(r){s.width=h.width,s.height=h.height,r.putImageData(h,0,0);const o=c(0,0,e),a=c(h.width,0,e),n=c(h.width,h.height,e),l=c(0,h.height,e),g=Math.max(o[0],a[0],n[0],l[0])-Math.min(o[0],a[0],n[0],l[0]),m=Math.max(o[1],a[1],n[1],l[1])-Math.min(o[1],a[1],n[1],l[1]),p=Math.min(i.width/g,i.height/m);return d.save(),d.clearRect(0,0,i.width,i.height),d.translate(i.width/2,i.height/2),d.rotate(e),d.scale(p,p),d.drawImage(s,-h.width/2,-h.height/2,h.width,h.height),d.restore(),t.unobserve(i)}o.getLogger(this).warn("oriented-imagery-viewer:image-gallery","failed to apply rotation on thumbnail")}d.putImageData(h,0,0),t.unobserve(i)}}))}_loadImageFromGallery(e){const{target:t}=e;if(!t)return;const i=t.getAttribute("data-objectid");i&&this.viewModel.currentBestFeature?.attributes.objectId!==Number(i)&&this.viewModel.selectBestFeature(i)}_onAdditionalCoverageVisibilityChange(e){this.viewModel.setAdditionalCoverageVisibility(e)}_onAdditionalCameraLocationsVisibility(e){this.viewModel.setAdditionalCameraLocationsVisibility(e)}_onCurrentCoverageVisibilityChange(e){this.viewModel.setCurrentCoverageVisibility(e)}_registerGalleryItem(e){this._galleryObserver.observe(e)}_renderActionTooltips(){return[...this._actionItems].map((([e,t])=>E("calcite-tooltip",{key:e,referenceElement:t},E("span",null,e))))}_renderBody(){return E("div",{class:m.body},this._renderViewerContainer(),this._renderImageGallery(),this._renderImageEnhancementTools(),this._renderNavigation())}_renderImageEnhancementTools(){const{imageEnhancementToolActive:e,viewModel:{brightness:t,contrast:i,sharpness:o}}=this;return e&&E("calcite-panel",{bind:this,class:m.imageEnhancementWrapper,closable:!0,closed:!e,heading:this.messages.imageEnhancement,key:this.messages.imageEnhancement,onCalcitePanelClose:this._toggleImageEnhancementToolState},E("div",{class:m.imageEnhancementTools},E("div",{class:m.imageEnhancementToolContainer},E("calcite-label",null,this.messages.brightness,E("calcite-slider",{bind:this,labelTicks:!0,max:10,min:-10,ticks:5,value:t,onCalciteSliderInput:this._handleBrightnessChange}))),E("div",{class:m.imageEnhancementToolContainer},E("calcite-label",null,this.messages.contrast,E("calcite-slider",{bind:this,labelTicks:!0,max:10,min:-10,ticks:5,value:i,onCalciteSliderInput:this._handleContrastChange}))),E("div",{class:m.imageEnhancementToolContainer},E("calcite-label",null,this.messages.sharpness,E("calcite-slider",{bind:this,labelTicks:!0,max:1,min:0,step:.1,ticks:.5,value:o,onCalciteSliderInput:this._handleSharpnessChange})))),E("calcite-action",{bind:this,icon:"reset",onclick:this._resetImageTools,slot:"header-actions-end",text:this.messagesCommon.reset}))}_renderImageGallery(){const{container:e,galleryOpened:t,imageGalleryEnabled:i,viewModel:{thumbnails:o}}=this;return i&&t&&(e&&o)?E("calcite-panel",{bind:this,class:m.carousel,closable:!0,closed:!t,heading:this.messages.imageGallery,key:this.messages.imageGallery,onCalcitePanelClose:this._toggleImageGallery},E("div",{class:m.carouselContainer},this._renderThumbnails(o))):null}_renderMapImageConversionTool(){const{mapImageConversionToolState:e,viewModel:{state:t}}=this;return E("calcite-action",{active:e,afterCreate:this._storeActionElement,bind:this,disabled:"image-loaded"!==t,icon:"image-pin",onclick:this._toggleMapImageConversionToolState,text:this.messages.mapImageConversionTool})}_renderNavigation(){const{viewModel:{sectorData:e,navigatorCurrentBestFeature:i,currentBestFeature:o,state:a}}=this;if(!this.container||!o)return null;let s,r,n,l,c;if(i){const{x:e,y:t,direction:o}=i,[a,d,h,g]=p[o];s=`M ${e} ${t} L ${a} ${d} A ${u[2]} ${u[2]} 0 0 1 ${h} ${g} Z`,r=e,l=t,n=p[o][4],c=p[o][5]}const d=e=>{const t=e.target.dataset?.sector;t&&this.viewModel.handleSectorClick(+t)},h=e=>{const t=e.target.dataset;if(!t)return;const{featureIndexInSector:i,sector:o}=t;i&&o&&this.viewModel.handleFeatureClick({sector:o,featureIndexInSector:+i})},w=e=>{e.removeEventListener("click",h)},_=o.attributes.objectId,C=e?.map((e=>e?.items)).filter(Boolean).flatMap((e=>e?.map((({x:e,y:t,objectID:i,featureIndexInSector:o,sector:a})=>E("circle",{afterRemoved:w,class:this.classes(m.feature,{selected:_===i}),cx:e,cy:t,"data-feature-index-in-sector":o,"data-sector":a,key:`${m.feature}-${i}`,onclick:h,r:v}))))),f=e=>{e.removeEventListener("click",d)},M=this.classes({[m.navigationWrapper]:!0,[m.navigationZoomed]:this._navigationToolExpanded});return this.navigationToolActive&&"image-loaded"===a?E("div",{bind:this,class:M,key:this.messages.navigationTool},E("svg",{afterCreate:e=>this._storeNavigationToolReference(e),class:t()?y:m.rotateWithAnimation,focusable:"false",height:b,role:"img",width:b,xmlns:"http://www.w3.org/2000/svg"},E("defs",null,E("linearGradient",{gradientUnits:"userSpaceOnUse",id:`${this.id}-coverage-fill`,x1:r,x2:n,y1:l,y2:c},E("stop",{class:m.navigationPathOffset0,offset:0}),E("stop",{class:m.navigationPathOffset1,offset:1}))),E("g",null,E("circle",{class:this.classes(m.sector,m.outerSector),cx:u[3],cy:u[3],onclick:this._scaleNavigationTool,r:u[3]}),E("circle",{class:m.sector,cx:u[3],cy:u[3],r:u[2]}),E("circle",{class:m.sector,cx:u[3],cy:u[3],r:u[1]}),E("circle",{class:m.sector,cx:u[3],cy:u[3],r:u[0]}),E("path",{class:m.pointer,d:"M 56.5 6.06217782649107 L 60 0 L 63.5 6.06217782649107 Z",key:`${m.pointer}-west`}),E("path",{class:this.classes(m.pointer,m.north),d:"M 113.93782217350893 56.5 L 120 60 L 113.93782217350893 63.5 Z",key:`${m.pointer}-north`}),E("path",{class:m.pointer,d:"M 56.5 113.93782217350893 L 60 120 L 63.5 113.93782217350893 Z",key:`${m.pointer}-east`}),E("path",{class:m.pointer,d:"M 6.06217782649107 56.5 L 0 60 L 6.06217782649107 63.5 Z",key:`${m.pointer}-south`}),E("path",{class:this.classes(m.sector,m.sectorSeparator),d:"M 23.937554159486076 23.937554159486076 L 96.06244584051393 96.06244584051393 M 23.937554159486076 96.06244584051393 L 96.06244584051393 23.937554159486076",key:m.sectorSeparator}),g([u[2],u[1],u[0]],u[3],u[3]).map(((t,i)=>E("path",{afterRemoved:f,class:this.classes(m.sector,e?.[i]?.length?m.sectorEnabled:m.sectorDisabled),d:t,"data-sector":`${i}`,key:`${m.sector}-${i}`,onclick:d}))),E("path",{class:this.classes(m.sector,m.sectorCross),d:"M 56.4 56.4 L 63.53 63.53 M 63.53 56.4 L 56.4 63.53",key:m.sectorCross}),C,o.attributes.cameraPitch>=5&&s?E("path",{class:m.selectedFeaturePath,d:s,fill:`url(#${this.id}-coverage-fill)`,key:m.selectedFeaturePath}):null))):null}_renderNavigationTool(){const{state:e}=this.viewModel;return E("calcite-action",{active:this.navigationToolActive,afterCreate:this._storeActionElement,bind:this,disabled:"image-loaded"!==e,icon:"explore",onclick:this._toggleNavigationTool,text:this.messages.navigationTool})}_renderImageEnhancementTool(){const{state:e,mode:t}=this.viewModel;return E("calcite-action",{active:this.imageEnhancementToolActive,afterCreate:this._storeActionElement,bind:this,disabled:"default"!==t||"image-loaded"!==e,icon:"sliders-horizontal",onclick:this._toggleImageEnhancementToolState,text:this.messages.imageEnhancement})}_renderMenuBarContainer(){const{currentCoverageVisible:e,isAdditionalCoverageVisible:t,isAdditionalPointSourcesVisible:i,imageGalleryEnabled:o}=this;return E("calcite-action-bar",{expandDisabled:!0,layout:"horizontal",slot:"action-bar"},E("calcite-action-group",{expanded:!0},E("calcite-action",{active:e,afterCreate:this._storeActionElement,bind:this,class:m.currentCoverage,icon:"trapezoid-area",onclick:this._toggleCurrentCoverage,text:this.messages.currentFootprint}),E("calcite-action",{active:t,afterCreate:this._storeActionElement,bind:this,class:m.addCoverage,icon:"trapezoid-area",onclick:this._toggleAdditionalCoverage,text:this.messages.additionalFootprints}),E("calcite-action",{active:i,afterCreate:this._storeActionElement,bind:this,class:m.addExpPoints,icon:"circle-area",onclick:this._toggleAdditionalCameraLocations,text:this.messages.additionalCameraLocations})),E("calcite-action-group",{layout:"horizontal"},this.visibleElements.mapImageConversionTool?this._renderMapImageConversionTool():null,this.visibleElements.navigationTool?this._renderNavigationTool():null,this.visibleElements.imageEnhancement?this._renderImageEnhancementTool():null),E("calcite-action-group",null,E("calcite-action",{active:this.galleryOpened,afterCreate:this._storeActionElement,bind:this,disabled:!o,icon:"images",onclick:this._toggleImageGallery,text:this.messages.imageGallery,textEnabled:!0}),this.visibleElements.showPopupsAction?this._renderPopupAction():null),this._renderActionTooltips())}_renderMessageBox(){const{messages:e,viewModel:{displayMessage:t}}=this;if(!t)return null;const{data:i,key:o,map:a}=t,s=`${a?V(e[o],a):e[o]}`;return E("span",{class:m.messageBox},i?`${s} ${i}`:s)}_renderPopupAction(){return E("calcite-action",{afterCreate:this._storeActionElement,bind:this,disabled:!this.popupEnabled,icon:"popup",onclick:this._toggleImageAttributes,text:this.messages.showPopups,textEnabled:!0})}_renderThumbnails(e){const{currentBestFeature:t}=this.viewModel;return t?E("div",{class:m.carouselContent},e.items.map((({url:e,objectId:i,rotation:o},a)=>E("div",{class:`${m.carouselItemWrapper}${t.attributes.objectId===i?"--selected":""}`,key:`${m.carouselItemWrapper}-${a}`},E("canvas",{afterCreate:this._registerGalleryItem,afterRemoved:this._unregisterGalleryItem,alt:`thumbnail-${i}`,class:m.carouselItem,"data-objectid":`${i}`,"data-rotation":`${o}`,"data-src":e,onclick:this._loadImageFromGallery,onmouseenter:this._highlight,onmouseleave:this._removeHighlight}))))):null}_renderViewerContainer(){return E("div",{class:m.viewerContainer},this._renderImageViewer(),this._renderPanoramicViewer(),this._renderMessageBox())}_renderImageViewer(){const{displayMessage:e,loadImageViewer:t,mode:i}=this.viewModel,o=`${m.viewer}${e||"default"!==i?"--hide":""}`;return E("calcite-panel",{afterCreate:t,bind:this,class:o})}_renderPanoramicViewer(){const{displayMessage:e,loadPanoramicViewer:t,mode:i}=this.viewModel,o=`${m.viewer}${e||"panoramic"!==i?"--hide":""}`;return E("calcite-panel",{afterCreate:t,bind:this,class:o})}_resetImageTools(){this.viewModel.sharpness=this.viewModel.brightness=this.viewModel.contrast=0}_storeActionElement(e){this._actionItems.set(e.text,e)}_storeNavigationToolReference(e){this._navigationTool=e}_toggleAdditionalCameraLocations(){this.isAdditionalPointSourcesVisible=!this.isAdditionalPointSourcesVisible}_toggleAdditionalCoverage(){this.isAdditionalCoverageVisible=!this.isAdditionalCoverageVisible}_toggleCurrentCoverage(){this.currentCoverageVisible=!this.currentCoverageVisible}_toggleImageEnhancementToolState(e){e.stopPropagation(),this.imageEnhancementToolActive=!this.imageEnhancementToolActive,this.imageEnhancementToolActive&&(this.galleryOpened&&(this.galleryOpened=!1),this.navigationToolActive&&(this.navigationToolActive=!1))}_toggleImageGallery(e){e.stopPropagation(),this.galleryOpened=!!this.imageGalleryEnabled&&!this.galleryOpened,this.galleryOpened&&(this.imageEnhancementToolActive&&(this.imageEnhancementToolActive=!1),this.navigationToolActive&&(this.navigationToolActive=!1))}_toggleNavigationTool(){this.navigationToolActive=!this.navigationToolActive,this.navigationToolActive&&(this.galleryOpened&&(this.galleryOpened=!1),this.imageEnhancementToolActive&&(this.imageEnhancementToolActive=!1))}_toggleMapImageConversionToolState(){this.mapImageConversionToolState=!this.mapImageConversionToolState}_unregisterGalleryItem(e){this._galleryObserver.unobserve(e)}_updateNavigationTool(e){const{previousFeatureAngle:t,bestFeatureAngle:i}=this.viewModel,o=(i-t+540)%360-180;e.style.setProperty(w,`${t}deg`),e.style.setProperty(_,`${t+o}deg`)}async loadBestImage(e){return this.viewModel.loadBestImage(e)}loadImageFromSource(e,t){return this.viewModel.loadImageFromSource(e,t)}async plotMapPoint(e){return this.viewModel.plotMapPoint(e)}plotReferencePointOnGround(e){this.viewModel.plotReferencePointOnGround(e)}plotReferencePointOnImage(e){this.viewModel.plotReferencePointOnImage(e)}resetImage(){this.viewModel.resetImage()}render(){const{viewModel:{state:e}}=this;return E("div",{class:this.classes(T.widget,C)},E("calcite-panel",{bind:this,heading:this.visibleElements.title?this.messages.title:void 0,loading:"image-loading"===e},this.visibleElements.coverageMenu?this._renderMenuBarContainer():null,this._renderBody()))}updateSuitabilities(e){this.viewModel.updateSuitabilities(e)}};e([n()],x.prototype,"activeLayer",null),e([n()],x.prototype,"currentBestFeature",null),e([n()],x.prototype,"currentCoverageVisible",null),e([n()],x.prototype,"disabled",null),e([n()],x.prototype,"drawFootprint",null),e([n()],x.prototype,"features",null),e([n()],x.prototype,"imagePointsInView",null),e([n()],x.prototype,"galleryOpened",void 0),e([n()],x.prototype,"icon",null),e([n()],x.prototype,"imageEnhancementToolActive",void 0),e([n({readOnly:!0})],x.prototype,"imageGalleryEnabled",null),e([n()],x.prototype,"isAdditionalCoverageVisible",null),e([n()],x.prototype,"isAdditionalPointSourcesVisible",null),e([n()],x.prototype,"mapImageConversionToolState",null),e([n()],x.prototype,"layer",null),e([n()],x.prototype,"navigationToolActive",void 0),e([n({type:f})],x.prototype,"viewModel",void 0),e([n(),A("esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer")],x.prototype,"messages",void 0),e([n(),A("esri/t9n/common")],x.prototype,"messagesCommon",void 0),e([n({readOnly:!0})],x.prototype,"popupEnabled",null),e([n()],x.prototype,"referencePoint",null),e([n()],x.prototype,"view",null),e([n({type:M,nonNullable:!0})],x.prototype,"visibleElements",void 0),e([n()],x.prototype,"determineWorkflowForFeature",null),e([n()],x.prototype,"updateFootprint",null),e([n()],x.prototype,"_navigationToolExpanded",void 0),e([n()],x.prototype,"_navigationTool",void 0),x=e([l("esri.widgets.OrientedImageryViewer")],x);const F=x;export{F as default};
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[4543],{43609:(e,_,E)=>{E.d(_,{a:()=>R,f:()=>n,n:()=>T});var t=E(34275);function T(e,_){R(e.typedBuffer,_.typedBuffer,e.typedBufferStride,_.typedBufferStride)}function R(e,_,E=2,T=E){const R=_.length/2;let n=0,A=0;if((0,t.cy)(_)||(0,t.dk)(_)){for(let t=0;t<R;++t)e[n]=_[A],e[n+1]=_[A+1],n+=E,A+=T;return}const r=(0,t.a3)(_);if((0,t.JI)(_))for(let t=0;t<R;++t)e[n]=Math.max(_[A]/r,-1),e[n+1]=Math.max(_[A+1]/r,-1),n+=E,A+=T;else for(let t=0;t<R;++t)e[n]=_[A]/r,e[n+1]=_[A+1]/r,n+=E,A+=T}function n(e,_,E,t){const T=e.typedBuffer,R=e.typedBufferStride,n=t?.count??e.count;let A=(t?.dstIndex??0)*R;for(let e=0;e<n;++e)T[A]=_,T[A+1]=E,A+=R}Object.freeze(Object.defineProperty({__proto__:null,fill:n,normalizeIntegerBuffer:R,normalizeIntegerBufferView:T},Symbol.toStringTag,{value:"Module"}))},51737:(e,_,E)=>{function t(e,_){T(e.typedBuffer,_.typedBuffer,e.typedBufferStride,_.typedBufferStride)}function T(e,_,E=3,t=E){const T=_.length/t;let R=0,n=0;for(let A=0;A<T;++A)e[R]=_[n],e[R+1]=_[n+1],e[R+2]=_[n+2],R+=E,n+=t}function R(e,_,E,t,T){const R=e.typedBuffer,n=e.typedBufferStride,A=T?.count??e.count;let r=(T?.dstIndex??0)*n;for(let e=0;e<A;++e)R[r]=_,R[r+1]=E,R[r+2]=t,r+=n}E.d(_,{a:()=>t,c:()=>T,f:()=>R}),Object.freeze(Object.defineProperty({__proto__:null,copy:T,copyView:t,fill:R},Symbol.toStringTag,{value:"Module"}))},78358:(e,_,E)=>{function t(e,_){T(e.typedBuffer,_,e.typedBufferStride)}function T(e,_,E=4){const t=_.typedBuffer,T=_.typedBufferStride,R=_.count;let n=0,A=0;for(let _=0;_<R;++_)e[n]=t[A],e[n+1]=t[A+1],e[n+2]=t[A+2],e[n+3]=t[A+3],n+=E,A+=T}function R(e,_,E,t,T,R){const n=e.typedBuffer,A=e.typedBufferStride,r=R?.count??e.count;let o=(R?.dstIndex??0)*A;for(let e=0;e<r;++e)n[o]=_,n[o+1]=E,n[o+2]=t,n[o+3]=T,o+=A}E.d(_,{a:()=>T,c:()=>t,f:()=>R}),Object.freeze(Object.defineProperty({__proto__:null,copy:T,copyView:t,fill:R},Symbol.toStringTag,{value:"Module"}))},90239:(e,_,E)=>{function t(e){switch(e){case"u8":case"i8":return 1;case"u16":case"i16":return 2;case"u32":case"i32":case"f32":return 4;case"f64":return 8}}E.d(_,{GJ:()=>t})},94543:(e,_,E)=>{E.r(_),E.d(_,{loadGLTFMesh:()=>m});var t=E(68197),T=E(78888),R=E(49186),n=E(91869),A=E(34727),r=E(77690),o=E(29242),N=E(51850),S=E(91829),O=E(16939),C=E(80882),I=E(35063),u=E(51147),c=E(1193),a=E(27615),s=E(13030),f=E(73354),i=E(65686),l=E(90239);Object.freeze(Object.defineProperty({__proto__:null,copy:function(e,_,E){const t=e.typedBuffer,T=e.typedBufferStride,R=_.typedBuffer,n=_.typedBufferStride,A=E?E.count:_.count;let r=(E?.dstIndex??0)*T,o=(E?.srcIndex??0)*n;for(let e=0;e<A;++e){for(let e=0;e<9;++e)t[r+e]=R[o+e];r+=T,o+=n}}},Symbol.toStringTag,{value:"Module"})),Object.freeze(Object.defineProperty({__proto__:null,copy:function(e,_,E){const t=e.typedBuffer,T=e.typedBufferStride,R=_.typedBuffer,n=_.typedBufferStride,A=E?E.count:_.count;let r=(E?.dstIndex??0)*T,o=(E?.srcIndex??0)*n;for(let e=0;e<A;++e){for(let e=0;e<16;++e)t[r+e]=R[o+e];r+=T,o+=n}}},Symbol.toStringTag,{value:"Module"})),E(24045);var L=E(43609),M=E(51737),D=E(78358);function B(e,_){return new e(new ArrayBuffer(_*e.ElementCount*(0,l.GJ)(e.ElementType)))}var U=E(72258),G=E(21015),P=E(4399),F=E(84498),d=E(51530),H=E(61765),p=E(63907);async function m(e,_,E){const r=new G.R(function(e){const _=e?.resolveFile;return _?{busy:!1,request:async(e,E,t)=>{const R=_?.(e)??e,n="image"===E?"image":"binary"===E||"image+type"===E?"array-buffer":"json";return(await(0,T.A)(R,{responseType:n,signal:t?.signal,timeout:0})).data}}:null}(E)),o=(await(0,P.loadGLTF)(r,_,E,!0)).model,O=o.lods.shift(),f=new Map,i=new Map;o.textures.forEach(((e,_)=>f.set(_,function(e){return new I.A({data:((0,d.x3)(e.data),e.data),wrap:h(e.parameters.wrap)})}(e)))),o.materials.forEach(((e,_)=>i.set(_,function(e,_){const E=new t.A(function(e,_){return(0,S.fA)(X(e[0]),X(e[1]),X(e[2]),_)}(e.color,e.opacity)),T=e.emissiveFactor?new t.A(function(e){return(0,N.fA)(X(e[0]),X(e[1]),X(e[2]))}(e.emissiveFactor)):null,R=e=>e?new u.A({scale:e.scale?[e.scale[0],e.scale[1]]:[1,1],rotation:(0,A.KJ)(e.rotation??0),offset:e.offset?[e.offset[0],e.offset[1]]:[0,0]}):null;return new C.A({color:E,colorTexture:_.get(e.textureColor),normalTexture:_.get(e.textureNormal),emissiveColor:T,emissiveTexture:_.get(e.textureEmissive),occlusionTexture:_.get(e.textureOcclusion),alphaMode:b(e.alphaMode),alphaCutoff:e.alphaCutoff,doubleSided:e.doubleSided,metallic:e.metallicFactor,roughness:e.roughnessFactor,metallicRoughnessTexture:_.get(e.textureMetallicRoughness),colorTextureTransform:R(e.colorTextureTransform),normalTextureTransform:R(e.normalTextureTransform),occlusionTextureTransform:R(e.occlusionTextureTransform),emissiveTextureTransform:R(e.emissiveTextureTransform),metallicRoughnessTextureTransform:R(e.metallicRoughnessTextureTransform)})}(e,f))));const l=function(e){let _=0;const E={color:!1,tangent:!1,normal:!1,texCoord0:!1},t=new Map,T=new Map,R=[];for(const A of e.parts){const{attributes:{position:e,normal:r,color:o,tangent:N,texCoord0:S}}=A,O=`\n ${y(e,t)}/\n ${y(r,t)}/\n ${y(o,t)}/\n ${y(N,t)}/\n ${y(S,t)}/\n ${g(A.transform)}\n `;let C=!1;const I=(0,n.tE)(T,O,(()=>(C=!0,{start:_,length:e.count})));C&&(_+=e.count),r&&(E.normal=!0),o&&(E.color=!0),N&&(E.tangent=!0),S&&(E.texCoord0=!0),R.push({gltf:A,writeVertices:C,region:I})}return{vertexAttributes:{position:B(s.Xm,_),normal:E.normal?B(s.xs,_):null,tangent:E.tangent?B(s.Eq,_):null,color:E.color?B(s.XP,_):null,texCoord0:E.texCoord0?B(s.gH,_):null},parts:R,components:[]}}(O);for(const e of l.parts)x(l,e,i);const{position:L,normal:M,tangent:D,color:F,texCoord0:H}=l.vertexAttributes,p=(0,a.TE)(e,E),m=e.spatialReference.isGeographic?(0,a.TE)(e):p,V=(0,U.UR)({vertexAttributes:{position:L.typedBuffer,normal:M?.typedBuffer,tangent:D?.typedBuffer},vertexSpace:m,spatialReference:e.spatialReference},p,{allowBufferReuse:!0,sourceUnit:"meters"});if(!V)throw new R.A("loadGLTFMesh()","Failed to load mesh from glTF due to projection errors");return{transform:null,vertexSpace:p,components:l.components,spatialReference:e.spatialReference,vertexAttributes:new c.H({...V,color:F?.typedBuffer,uv:H?.typedBuffer})}}function y(e,_){if(null==e)return"-";const E=e.typedBuffer;return`${(0,n.tE)(_,E.buffer,(()=>_.size))}/${E.byteOffset}/${E.byteLength}`}function g(e){return null!=e?e.toString():"-"}function x(e,_,E){_.writeVertices&&function(e,_){const{position:E,normal:t,tangent:T,color:R,texCoord0:n}=e.vertexAttributes,N=_.region.start,{attributes:S,transform:O}=_.gltf,C=S.position.count;if((0,f.d)(E.slice(N,C),S.position,O),null!=S.normal&&null!=t){const e=(0,r.Ge)((0,o.vt)(),O),_=t.slice(N,C);(0,f.c)(_,S.normal,e),(0,A.or)(e)&&(0,f.e)(_,_)}else null!=t&&(0,M.f)(t,0,0,1,{dstIndex:N,count:C});if(null!=S.tangent&&null!=T){const e=(0,r.z0)((0,o.vt)(),O),_=T.slice(N,C);(0,i.a)(_,S.tangent,e),(0,A.or)(e)&&(0,i.n)(_,_)}else null!=T&&(0,D.f)(T,0,0,1,1,{dstIndex:N,count:C});if(null!=S.texCoord0&&null!=n?(0,L.n)(n.slice(N,C),S.texCoord0):null!=n&&(0,L.f)(n,0,0,{dstIndex:N,count:C}),null!=S.color&&null!=R){const e=S.color,_=R.slice(N,C);if(4===e.elementCount)e instanceof s.Eq?(0,i.s)(_,e,255):e instanceof s.XP?(0,D.c)(_,e):e instanceof s.Uz&&(0,i.s)(_,e,1/256);else{(0,D.f)(_,255,255,255,255);const E=s.eI.fromTypedArray(_.typedBuffer,_.typedBufferStride);e instanceof s.xs?(0,f.s)(E,e,255):e instanceof s.eI?(0,M.a)(E,e):e instanceof s.nS&&(0,f.s)(E,e,1/256)}}else null!=R&&(0,D.f)(R.slice(N,C),255,255,255,255)}(e,_);const{indices:t,attributes:T,primitiveType:R,material:n}=_.gltf;let N=(0,F.x)(t||T.position.count,R);const S=_.region.start;if(S){const e=new Uint32Array(N);for(let _=0;_<N.length;_++)e[_]+=S;N=e}e.components.push(new O.A({name:_.gltf.name,faces:N,material:E.get(n),shading:T.normal?"source":"flat",trustSourceNormals:!0}))}function b(e){switch(e){case"OPAQUE":return"opaque";case"MASK":return"mask";case"BLEND":return"blend"}}function h(e){return{horizontal:V(e.s),vertical:V(e.t)}}function V(e){switch(e){case p.pF.CLAMP_TO_EDGE:return"clamp";case p.pF.MIRRORED_REPEAT:return"mirror";case p.pF.REPEAT:return"repeat"}}function X(e){return e**(1/H.T)*255}},21015:(e,_,E)=>{E.d(_,{R:()=>r});var t=E(78888),T=E(60999),R=E(49186),n=E(74887),A=E(84952);class r{constructor(e){this._streamDataRequester=e}async loadJSON(e,_){return this._load("json",e,_)}async loadBinary(e,_){return(0,A.DB)(e)?((0,n.Te)(_),(0,A.lJ)(e)):this._load("binary",e,_)}async loadImage(e,_){return this._load("image",e,_)}async _load(e,_,E){if(null==this._streamDataRequester)return(await(0,t.A)(_,{responseType:o[e]})).data;const A=await(0,T.Ke)(this._streamDataRequester.request(_,e,E));if(!0===A.ok)return A.value;throw(0,n.QP)(A.error),new R.A("",`Request for resource failed: ${A.error}`)}}const o={image:"image",binary:"array-buffer",json:"json","image+type":void 0}},84498:(e,_,E)=>{E.d(_,{x:()=>n});var t=E(34275),T=E(97146),R=E(63907);function n(e,_){switch(_){case R.WR.TRIANGLES:return"number"==typeof(E=e)?(0,T.tM)(E):(0,t.mg)(E)?new Uint16Array(E):E;case R.WR.TRIANGLE_STRIP:return function(e){const _="number"==typeof e?e:e.length;if(_<3)return[];const E=_-2,t=(0,T.my)(3*E);if("number"==typeof e){let e=0;for(let _=0;_<E;_+=1)_%2==0?(t[e++]=_,t[e++]=_+1,t[e++]=_+2):(t[e++]=_+1,t[e++]=_,t[e++]=_+2)}else{let _=0;for(let T=0;T<E;T+=1)T%2==0?(t[_++]=e[T],t[_++]=e[T+1],t[_++]=e[T+2]):(t[_++]=e[T+1],t[_++]=e[T],t[_++]=e[T+2])}return t}(e);case R.WR.TRIANGLE_FAN:return function(e){const _="number"==typeof e?e:e.length;if(_<3)return new Uint16Array(0);const E=_-2,t=E<=65536?new Uint16Array(3*E):new Uint32Array(3*E);if("number"==typeof e){let e=0;for(let _=0;_<E;++_)t[e++]=0,t[e++]=_+1,t[e++]=_+2;return t}const T=e[0];let R=e[1],n=0;for(let _=0;_<E;++_){const E=e[_+2];t[n++]=T,t[n++]=R,t[n++]=E,R=E}return t}(e)}var E}},51530:(e,_,E)=>{E.d(_,{KB:()=>A,Xi:()=>R,pn:()=>r,x3:()=>n});var t=E(44208),T=E(89192);class R{constructor(e){this.data=e,this.type="encoded-mesh-texture",this.encoding=T.JS.KTX2_ENCODING}}function n(e){return"encoded-mesh-texture"===e?.type}async function A(e){const _=new Blob([e]),E=await _.text();return JSON.parse(E)}async function r(e,_){if(_===T.JS.KTX2_ENCODING)return new R(e);const E=new Blob([e],{type:_}),n=URL.createObjectURL(E),A=new Image;if((0,t.A)("esri-iPhone"))return new Promise(((e,_)=>{const E=()=>{T(),e(A)},t=e=>{T(),_(e)},T=()=>{URL.revokeObjectURL(n),A.removeEventListener("load",E),A.removeEventListener("error",t)};A.addEventListener("load",E),A.addEventListener("error",t),A.src=n}));try{A.src=n,await A.decode()}catch(e){console.warn("Failed decoding HTMLImageElement")}return URL.revokeObjectURL(n),A}},89192:(e,_,E)=>{var t,T,R,n,A,r,o,N,S;E.d(_,{Am:()=>n,C7:()=>R,ID:()=>N,JS:()=>S,Mg:()=>r,dd:()=>A,it:()=>T,s2:()=>t,sf:()=>o}),function(e){e[e.None=0]="None",e[e.Front=1]="Front",e[e.Back=2]="Back",e[e.COUNT=3]="COUNT"}(t||(t={})),function(e){e[e.Less=0]="Less",e[e.Lequal=1]="Lequal",e[e.COUNT=2]="COUNT"}(T||(T={})),function(e){e[e.BACKGROUND=0]="BACKGROUND",e[e.UPDATE=1]="UPDATE"}(R||(R={})),function(e){e[e.NOT_LOADED=0]="NOT_LOADED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"}(n||(n={})),function(e){e[e.IntegratedMeshMaskExcluded=1]="IntegratedMeshMaskExcluded",e[e.OutlineVisualElementMask=2]="OutlineVisualElementMask"}(A||(A={})),function(e){e[e.Highlight=0]="Highlight",e[e.MaskOccludee=1]="MaskOccludee",e[e.COUNT=2]="COUNT"}(r||(r={})),function(e){e[e.Blend=0]="Blend",e[e.Opaque=1]="Opaque",e[e.Mask=2]="Mask",e[e.MaskBlend=3]="MaskBlend",e[e.COUNT=4]="COUNT"}(o||(o={})),function(e){e[e.OFF=0]="OFF",e[e.ON=1]="ON"}(N||(N={})),function(e){e.DDS_ENCODING="image/vnd-ms.dds",e.KTX2_ENCODING="image/ktx2",e.BASIS_ENCODING="image/x.basis"}(S||(S={}))},61765:(e,_,E)=>{E.d(_,{T:()=>t});const t=2.1},63907:(e,_,E)=>{var t,T,R,n,A,r,o,N,S,O,C,I,u,c,a,s,f,i,l,L,M,D,B;E.d(_,{Ab:()=>c,Ac:()=>o,Ap:()=>u,CQ:()=>G,Cj:()=>C,Co:()=>l,H0:()=>a,Hr:()=>B,MT:()=>S,NZ:()=>A,Nm:()=>D,R:()=>L,Tb:()=>n,WR:()=>T,Y7:()=>r,_U:()=>i,dn:()=>R,eA:()=>O,hn:()=>t,ld:()=>s,nI:()=>U,pF:()=>I,pe:()=>N,vt:()=>M,yQ:()=>f}),function(e){e[e.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",e[e.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",e[e.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT"}(t||(t={})),function(e){e[e.POINTS=0]="POINTS",e[e.LINES=1]="LINES",e[e.LINE_LOOP=2]="LINE_LOOP",e[e.LINE_STRIP=3]="LINE_STRIP",e[e.TRIANGLES=4]="TRIANGLES",e[e.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",e[e.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(T||(T={})),function(e){e[e.ZERO=0]="ZERO",e[e.ONE=1]="ONE",e[e.SRC_COLOR=768]="SRC_COLOR",e[e.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.DST_ALPHA=772]="DST_ALPHA",e[e.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",e[e.DST_COLOR=774]="DST_COLOR",e[e.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",e[e.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",e[e.CONSTANT_COLOR=32769]="CONSTANT_COLOR",e[e.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",e[e.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",e[e.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA"}(R||(R={})),function(e){e[e.ADD=32774]="ADD",e[e.MIN=32775]="MIN",e[e.MAX=32776]="MAX",e[e.SUBTRACT=32778]="SUBTRACT",e[e.REVERSE_SUBTRACT=32779]="REVERSE_SUBTRACT"}(n||(n={})),function(e){e[e.ARRAY_BUFFER=34962]="ARRAY_BUFFER",e[e.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",e[e.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",e[e.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",e[e.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",e[e.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",e[e.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",e[e.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER"}(A||(A={})),function(e){e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK",e[e.FRONT_AND_BACK=1032]="FRONT_AND_BACK"}(r||(r={})),function(e){e[e.CW=2304]="CW",e[e.CCW=2305]="CCW"}(o||(o={})),function(e){e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.INT=5124]="INT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.FLOAT=5126]="FLOAT",e[e.HALF_FLOAT=5131]="HALF_FLOAT"}(N||(N={})),function(e){e[e.NEVER=512]="NEVER",e[e.LESS=513]="LESS",e[e.EQUAL=514]="EQUAL",e[e.LEQUAL=515]="LEQUAL",e[e.GREATER=516]="GREATER",e[e.NOTEQUAL=517]="NOTEQUAL",e[e.GEQUAL=518]="GEQUAL",e[e.ALWAYS=519]="ALWAYS"}(S||(S={})),function(e){e[e.ZERO=0]="ZERO",e[e.KEEP=7680]="KEEP",e[e.REPLACE=7681]="REPLACE",e[e.INCR=7682]="INCR",e[e.DECR=7683]="DECR",e[e.INVERT=5386]="INVERT",e[e.INCR_WRAP=34055]="INCR_WRAP",e[e.DECR_WRAP=34056]="DECR_WRAP"}(O||(O={})),function(e){e[e.NEAREST=9728]="NEAREST",e[e.LINEAR=9729]="LINEAR",e[e.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",e[e.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR"}(C||(C={})),function(e){e[e.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",e[e.REPEAT=10497]="REPEAT",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(I||(I={})),function(e){e[e.TEXTURE_2D=3553]="TEXTURE_2D",e[e.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",e[e.TEXTURE_3D=32879]="TEXTURE_3D",e[e.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",e[e.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",e[e.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",e[e.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",e[e.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY"}(u||(u={})),function(e){e[e.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL",e[e.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",e[e.ALPHA=6406]="ALPHA",e[e.RGB=6407]="RGB",e[e.RGBA=6408]="RGBA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",e[e.RED=6403]="RED",e[e.RG=33319]="RG",e[e.RED_INTEGER=36244]="RED_INTEGER",e[e.RG_INTEGER=33320]="RG_INTEGER",e[e.RGB_INTEGER=36248]="RGB_INTEGER",e[e.RGBA_INTEGER=36249]="RGBA_INTEGER"}(c||(c={})),function(e){e[e.RGBA4=32854]="RGBA4",e[e.R16F=33325]="R16F",e[e.RG16F=33327]="RG16F",e[e.RGB32F=34837]="RGB32F",e[e.RGBA16F=34842]="RGBA16F",e[e.R32F=33326]="R32F",e[e.RG32F=33328]="RG32F",e[e.RGBA32F=34836]="RGBA32F",e[e.R11F_G11F_B10F=35898]="R11F_G11F_B10F",e[e.RGB8=32849]="RGB8",e[e.RGBA8=32856]="RGBA8",e[e.RGB5_A1=32855]="RGB5_A1",e[e.R8=33321]="R8",e[e.RG8=33323]="RG8",e[e.R8I=33329]="R8I",e[e.R8UI=33330]="R8UI",e[e.R16I=33331]="R16I",e[e.R16UI=33332]="R16UI",e[e.R32I=33333]="R32I",e[e.R32UI=33334]="R32UI",e[e.RG8I=33335]="RG8I",e[e.RG8UI=33336]="RG8UI",e[e.RG16I=33337]="RG16I",e[e.RG16UI=33338]="RG16UI",e[e.RG32I=33339]="RG32I",e[e.RG32UI=33340]="RG32UI",e[e.RGB16F=34843]="RGB16F",e[e.RGB9_E5=35901]="RGB9_E5",e[e.SRGB8=35905]="SRGB8",e[e.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",e[e.RGB565=36194]="RGB565",e[e.RGBA32UI=36208]="RGBA32UI",e[e.RGB32UI=36209]="RGB32UI",e[e.RGBA16UI=36214]="RGBA16UI",e[e.RGB16UI=36215]="RGB16UI",e[e.RGBA8UI=36220]="RGBA8UI",e[e.RGB8UI=36221]="RGB8UI",e[e.RGBA32I=36226]="RGBA32I",e[e.RGB32I=36227]="RGB32I",e[e.RGBA16I=36232]="RGBA16I",e[e.RGB16I=36233]="RGB16I",e[e.RGBA8I=36238]="RGBA8I",e[e.RGB8I=36239]="RGB8I",e[e.R8_SNORM=36756]="R8_SNORM",e[e.RG8_SNORM=36757]="RG8_SNORM",e[e.RGB8_SNORM=36758]="RGB8_SNORM",e[e.RGBA8_SNORM=36759]="RGBA8_SNORM",e[e.RGB10_A2=32857]="RGB10_A2",e[e.RGB10_A2UI=36975]="RGB10_A2UI"}(a||(a={})),function(e){e[e.FLOAT=5126]="FLOAT",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",e[e.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",e[e.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",e[e.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.INT=5124]="INT",e[e.HALF_FLOAT=5131]="HALF_FLOAT",e[e.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",e[e.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",e[e.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",e[e.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV"}(s||(s={})),function(e){e[e.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",e[e.STENCIL_INDEX8=36168]="STENCIL_INDEX8",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL",e[e.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",e[e.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",e[e.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",e[e.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8"}(f||(f={})),function(e){e[e.STATIC_DRAW=35044]="STATIC_DRAW",e[e.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",e[e.STREAM_DRAW=35040]="STREAM_DRAW",e[e.STATIC_READ=35045]="STATIC_READ",e[e.DYNAMIC_READ=35049]="DYNAMIC_READ",e[e.STREAM_READ=35041]="STREAM_READ",e[e.STATIC_COPY=35046]="STATIC_COPY",e[e.DYNAMIC_COPY=35050]="DYNAMIC_COPY",e[e.STREAM_COPY=35042]="STREAM_COPY"}(i||(i={})),function(e){e[e.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",e[e.VERTEX_SHADER=35633]="VERTEX_SHADER"}(l||(l={})),function(e){e[e.FRAMEBUFFER=36160]="FRAMEBUFFER",e[e.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",e[e.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER"}(L||(L={})),function(e){e[e.Texture=0]="Texture",e[e.BufferObject=1]="BufferObject",e[e.VertexArrayObject=2]="VertexArrayObject",e[e.Shader=3]="Shader",e[e.Program=4]="Program",e[e.FramebufferObject=5]="FramebufferObject",e[e.Renderbuffer=6]="Renderbuffer",e[e.TransformFeedback=7]="TransformFeedback",e[e.Sync=8]="Sync",e[e.UNCOUNTED=9]="UNCOUNTED",e[e.LinesOfCode=9]="LinesOfCode",e[e.Uniform=10]="Uniform",e[e.COUNT=11]="COUNT"}(M||(M={})),function(e){e[e.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",e[e.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",e[e.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",e[e.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",e[e.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",e[e.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",e[e.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",e[e.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",e[e.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",e[e.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",e[e.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",e[e.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",e[e.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",e[e.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",e[e.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",e[e.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15"}(D||(D={})),function(e){e[e.NONE=0]="NONE",e[e.BACK=1029]="BACK"}(B||(B={}));const U=33306;var G,P,F,d,H,p,m;!function(e){e[e.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",e[e.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",e[e.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",e[e.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",e[e.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",e[e.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",e[e.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",e[e.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",e[e.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC"}(G||(G={})),function(e){e[e.FLOAT=5126]="FLOAT",e[e.FLOAT_VEC2=35664]="FLOAT_VEC2",e[e.FLOAT_VEC3=35665]="FLOAT_VEC3",e[e.FLOAT_VEC4=35666]="FLOAT_VEC4",e[e.INT=5124]="INT",e[e.INT_VEC2=35667]="INT_VEC2",e[e.INT_VEC3=35668]="INT_VEC3",e[e.INT_VEC4=35669]="INT_VEC4",e[e.BOOL=35670]="BOOL",e[e.BOOL_VEC2=35671]="BOOL_VEC2",e[e.BOOL_VEC3=35672]="BOOL_VEC3",e[e.BOOL_VEC4=35673]="BOOL_VEC4",e[e.FLOAT_MAT2=35674]="FLOAT_MAT2",e[e.FLOAT_MAT3=35675]="FLOAT_MAT3",e[e.FLOAT_MAT4=35676]="FLOAT_MAT4",e[e.SAMPLER_2D=35678]="SAMPLER_2D",e[e.SAMPLER_CUBE=35680]="SAMPLER_CUBE",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",e[e.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",e[e.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",e[e.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",e[e.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",e[e.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",e[e.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",e[e.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",e[e.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",e[e.SAMPLER_3D=35679]="SAMPLER_3D",e[e.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",e[e.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",e[e.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",e[e.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",e[e.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",e[e.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",e[e.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",e[e.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",e[e.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",e[e.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",e[e.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",e[e.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY"}(P||(P={})),function(e){e[e.OBJECT_TYPE=37138]="OBJECT_TYPE",e[e.SYNC_CONDITION=37139]="SYNC_CONDITION",e[e.SYNC_STATUS=37140]="SYNC_STATUS",e[e.SYNC_FLAGS=37141]="SYNC_FLAGS"}(F||(F={})),function(e){e[e.UNSIGNALED=37144]="UNSIGNALED",e[e.SIGNALED=37145]="SIGNALED"}(d||(d={})),function(e){e[e.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",e[e.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",e[e.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",e[e.WAIT_FAILED=37149]="WAIT_FAILED"}(H||(H={})),function(e){e[e.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE"}(p||(p={})),function(e){e[e.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT"}(m||(m={}))}}]);