@arcgis/core 5.0.0-next.30 → 5.0.0-next.32

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 (182) hide show
  1. package/Basemap.js +1 -1
  2. package/applications/SceneViewer/sceneViewerUtils.d.ts +3 -0
  3. package/applications/SceneViewer/sceneViewerUtils.js +1 -1
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/{406d270ae2b3cf9e1f1b.js → 05e55118dc0023d500fc.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{93fe46be3c7fe34b5361.js → 1432e789aa4cba627337.js} +1 -1
  7. package/assets/esri/core/workers/chunks/1dd867fa7c58c06b79ea.js +1 -0
  8. package/assets/esri/core/workers/chunks/{6e9d731cb20307b83ab0.js → 1e55f152b60145f33b61.js} +1 -1
  9. package/assets/esri/core/workers/chunks/22d66d1c8dfccdbbcf30.js +1 -0
  10. package/assets/esri/core/workers/chunks/27bd88e1101873d4ce12.js +1 -0
  11. package/assets/esri/core/workers/chunks/{5f2cf73fb2944f82661d.js → 433d249c35c56bf15806.js} +34 -34
  12. package/assets/esri/core/workers/chunks/444026d1938c1078ca97.js +1 -0
  13. package/assets/esri/core/workers/chunks/{a425ffec91d07bbfeb80.js → 565358ea8d1bdc4d1ebc.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{b2fbb44e219232e61cbd.js → 794960ec36e11f4416c2.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{0bfb7db0a151a5e85dd1.js → 8ad6595ad44c2d60c1ce.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{11bb437437272d8f3e2c.js → 9252854b512237b6a0ef.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{e615983fab688d515205.js → 944dfa9309da8f49a616.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{f2f4e34247882eceb50d.js → a2cee5ac0d4df0108425.js} +3 -3
  19. package/assets/esri/core/workers/chunks/a4b7ba8aec109beb5b4d.js +1 -0
  20. package/assets/esri/core/workers/chunks/{d769c1b18e2710e0388b.js → a6324f5f560ffadc6e5d.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{a091623bbfb3d771c8d8.js → d8db2c51b2fb42f37b2a.js} +1 -1
  22. package/assets/esri/core/workers/chunks/da517b4b07d4d27ce94c.js +1 -0
  23. package/assets/esri/core/workers/chunks/{984bb0943d07c86b7e77.js → ded3ef385d5a3a2ec8ca.js} +1 -1
  24. package/assets/esri/core/workers/chunks/defc6b50df5018bd9e86.js +1 -0
  25. package/assets/esri/core/workers/chunks/ed1dabed10ff9f4e0369.js +1 -0
  26. package/assets/esri/core/workers/chunks/{14dc21fe66c7b98fb456.js → f3127bdf28a1d9b8db27.js} +1 -1
  27. package/assets/esri/core/workers/chunks/fee942ef802a162e0248.js +1 -0
  28. package/assets/esri/themes/base/widgets/_Attribution.scss +8 -0
  29. package/assets/esri/themes/dark/main.css +1 -1
  30. package/assets/esri/themes/light/main.css +1 -1
  31. package/assets/esri/themes/light/view.css +1 -1
  32. package/chunks/BlendLayers.glsl.js +1 -1
  33. package/config.js +1 -1
  34. package/core/Message.js +1 -1
  35. package/core/deprecate.js +1 -1
  36. package/core/keyboard.js +5 -0
  37. package/geometry/Circle.js +1 -1
  38. package/geometry/Extent.js +1 -1
  39. package/geometry/geodesicUtils.js +5 -0
  40. package/geometry/support/geodesicUtils.js +1 -1
  41. package/interfaces.d.ts +482 -190
  42. package/kernel.js +1 -1
  43. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  44. package/layers/graphics/OptimizedGeometry.js +1 -1
  45. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  46. package/layers/knowledgeGraph/SessionMemoryStorage.js +1 -1
  47. package/layers/support/BuildingFilterBlock.js +1 -1
  48. package/package.json +2 -2
  49. package/rest/support/QueryMixin.js +1 -1
  50. package/support/revision.js +1 -1
  51. package/views/2d/analysis/AreaMeasurement/AreaMeasurementController.js +1 -1
  52. package/views/2d/analysis/DistanceMeasurement/DistanceMeasurementController.js +1 -1
  53. package/views/2d/engine/vectorTiles/decluttering/SymbolRepository.js +1 -1
  54. package/views/2d/engine/vectorTiles/shaders/sources/shaderRepository.js +1 -1
  55. package/views/2d/grid/gridUtils.js +1 -1
  56. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  57. package/views/2d/layers/ImageryLayerView2D.js +1 -1
  58. package/views/2d/layers/MediaLayerView2D.js +1 -1
  59. package/views/2d/layers/OGCFeatureLayerView2D.js +1 -1
  60. package/views/2d/layers/StreamLayerView2D.js +1 -1
  61. package/views/3d/GroundView3D.js +1 -1
  62. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  63. package/views/3d/environment/SceneViewEnvironment.js +1 -1
  64. package/views/3d/interactive/editingTools/reshape/edgeOffsetUtils.js +1 -1
  65. package/views/3d/layers/DimensionLayerView3D.js +1 -1
  66. package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
  67. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  68. package/views/3d/layers/I3SMeshView3D.js +1 -1
  69. package/views/3d/layers/ImageryLayerView3D.js +1 -1
  70. package/views/3d/layers/LineOfSightLayerView3D.js +1 -1
  71. package/views/3d/layers/MediaLayerView3D.js +1 -1
  72. package/views/3d/layers/OGCFeatureLayerView3D.js +1 -1
  73. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  74. package/views/3d/layers/StreamLayerView3D.js +1 -1
  75. package/views/3d/layers/ViewshedLayerView3D.js +1 -1
  76. package/views/3d/layers/graphics/Graphics3DElevationAlignment.js +1 -1
  77. package/views/3d/layers/graphics/LabelDeconflictor.js +1 -1
  78. package/views/3d/layers/i3s/I3SOverrides.js +1 -1
  79. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  80. package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
  81. package/views/3d/support/Attribution3D.js +5 -0
  82. package/views/3d/terrain/TileBlendTechniqueConfiguration.js +1 -1
  83. package/views/3d/terrain/TileCompositor.js +1 -1
  84. package/views/3d/terrain/TileRenderer.js +1 -1
  85. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  86. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
  87. package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
  88. package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
  89. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  90. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +6 -6
  91. package/views/3d/webgl-engine/core/shaderLibrary/terrain/TileBackground.glsl.js +4 -4
  92. package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
  93. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  94. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  95. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  96. package/views/3d/webgl-engine/shaders/CheckerBoardTechnique.js +1 -1
  97. package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
  98. package/views/3d/webgl-engine/shaders/CompositingTechnique.js +1 -1
  99. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  100. package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
  101. package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
  102. package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
  103. package/views/3d/webgl-engine/shaders/NativeLineTechnique.js +1 -1
  104. package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
  105. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  106. package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechnique.js +1 -1
  107. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/AdjustProjectedPosition.glsl.js +4 -4
  108. package/views/Attribution.js +5 -0
  109. package/views/DOMContainer.js +1 -1
  110. package/views/SceneView.js +1 -1
  111. package/views/View.js +1 -1
  112. package/views/analysis/ElevationProfile/elevationProfileGeometryUtils.js +1 -1
  113. package/views/draw/support/managers/DrawTooltipManager.js +5 -0
  114. package/views/interactive/sketch/constraintUtils.js +1 -1
  115. package/views/interactive/sketch/constraints.js +1 -1
  116. package/views/interactive/tooltip/content/TooltipContentDynamic.js +5 -0
  117. package/views/interactive/tooltip/content/tooltipContentFactory.js +1 -1
  118. package/views/interactive/tooltip/fields/TooltipField.js +1 -1
  119. package/views/interactive/tooltip/infos/DynamicTooltipInfo.js +5 -0
  120. package/views/layers/DimensionLayerView.js +1 -1
  121. package/views/layers/DimensionLayerViewMixin.js +5 -0
  122. package/views/layers/FeatureLayerView.js +1 -1
  123. package/views/layers/FeatureLayerViewMixin.d.ts +2 -2
  124. package/views/layers/FeatureLayerViewMixin.js +5 -0
  125. package/views/layers/ImageryLayerView.js +1 -1
  126. package/views/layers/ImageryLayerViewMixin.js +5 -0
  127. package/views/layers/LayerView.js +1 -1
  128. package/views/layers/LineOfSightLayerView.js +1 -1
  129. package/views/layers/LineOfSightLayerViewMixin.js +5 -0
  130. package/views/layers/MediaLayerView.js +1 -1
  131. package/views/layers/MediaLayerViewMixin.js +5 -0
  132. package/views/layers/OGCFeatureLayerView.js +1 -1
  133. package/views/layers/PointCloudLayerView.js +1 -1
  134. package/views/layers/StreamLayerView.js +1 -1
  135. package/views/layers/ViewshedLayerView.js +1 -1
  136. package/views/layers/ViewshedLayerViewMixin.js +5 -0
  137. package/views/support/AttributionItem.d.ts +4 -0
  138. package/views/support/AttributionItem.js +5 -0
  139. package/views/support/LayerLayerViewInfo.js +1 -1
  140. package/views/support/LayerViewManager.js +1 -1
  141. package/views/support/PromiseQueue.js +1 -1
  142. package/views/support/angularMeasurementUtils.js +1 -1
  143. package/views/support/attributionUtils.js +5 -0
  144. package/views/support/drapedUtils.js +1 -1
  145. package/views/support/geodesicAreaMeasurementUtils.js +1 -1
  146. package/views/support/geodesicLengthMeasurementUtils.js +1 -1
  147. package/views/support/geodesicMeasurementUtils.js +1 -1
  148. package/views/ui/2d/DefaultUI2D.js +1 -1
  149. package/views/ui/3d/DefaultUI3D.js +1 -1
  150. package/webscene/Environment.js +1 -1
  151. package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
  152. package/widgets/Attribution/AttributionViewModel.js +1 -1
  153. package/widgets/Attribution.js +1 -1
  154. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
  155. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  156. package/widgets/ElevationProfile/ElevationProfileLine.js +1 -1
  157. package/widgets/ElevationProfile/ElevationProfileViewModel.js +1 -1
  158. package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
  159. package/widgets/ElevationProfile.js +1 -1
  160. package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
  161. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  162. package/widgets/PanoramicViewer/PanoramicVideoViewerViewModel.js +1 -1
  163. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  164. package/widgets/Popup.js +1 -1
  165. package/widgets/ScaleBar/ScaleBarViewModel.js +1 -1
  166. package/widgets/Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js +1 -1
  167. package/widgets/Widget.js +1 -1
  168. package/widgets/support/decorators/accessibleHandler.js +1 -1
  169. package/widgets/support/forms/expressions/FormExpressionArcadeExecutor.js +1 -1
  170. package/widgets/support/jsxWidgetSupport.js +1 -1
  171. package/widgets/support/widget.js +1 -1
  172. package/widgets/support/widgetUtils.js +1 -1
  173. package/assets/esri/core/workers/chunks/25143b919e75d5d2da05.js +0 -1
  174. package/assets/esri/core/workers/chunks/2d17ed5321ca05acb8e3.js +0 -1
  175. package/assets/esri/core/workers/chunks/447b53a9280b2b19b7a6.js +0 -1
  176. package/assets/esri/core/workers/chunks/6ce7ca6bebdc61d8eada.js +0 -1
  177. package/assets/esri/core/workers/chunks/8fbda0b85731ac77e1d8.js +0 -1
  178. package/assets/esri/core/workers/chunks/98c32d10a2344cd7a50b.js +0 -1
  179. package/assets/esri/core/workers/chunks/b66e41d626a7d1b81d48.js +0 -1
  180. package/assets/esri/core/workers/chunks/d5b464ff83ce29b51968.js +0 -1
  181. package/assets/esri/core/workers/chunks/d777d7cb8df3f21ac97e.js +0 -1
  182. package/layers/support/attributionUtils.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import i from"../../Camera.js";import t from"../../Ground.js";import a from"../../Map.js";import r from"../../request.js";import{createTask as o}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import n from"../../core/Error.js";import{EventedAccessor as h}from"../../core/Evented.js";import{JSONMap as m}from"../../core/jsonMap.js";import{rad2deg as d,deg2rad as l}from"../../core/mathUtils.js";import{throwIfAborted as c,isAbortError as p,waitTick as g}from"../../core/promiseUtils.js";import{watch as u,syncAndInitial as y,when as _,whenOnce as v}from"../../core/reactiveUtils.js";import{property as f,subclass as w}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as M}from"../../core/support/UpdatingHandles.js";import P from"../../geometry/SpatialReference.js";import R from"../../layers/GraphicsLayer.js";import{convertSphereVertexToPixelLocation as V}from"../../layers/orientedImagery/transformations/utils.js";import{isGraphic as z}from"../../support/guards.js";import C from"../../views/SceneView.js";import{logAndThrow as H,getMissingPropertyErrorName as k,getMissingPropertyErrorMessage as G}from"../OrientedImageryViewer/utils.js";import{defaultImageSphereCenter as S,defaultImageSphereSize as I,maxPanoramicViewerHFOV as O,minPanoramicViewerHFOV as b,humanBinocularHFOV as j}from"./constants.js";import x from"./PanoramicZoomConditions.js";import A from"./PanoramicZoomViewModel.js";import{meshToGraphic as F,findDiagonalFOV as T,loadRaster as L,loadPyramid as N,loadMeshes as E,createImageSphere as W}from"./utils.js";import{enumeration as D}from"../../core/accessorSupport/decorators/enumeration.js";const Z={default:"default",navigation:"navigation",fovConstraint:"fov-constraint",clickAction:"image-click-action"};let U=class extends h{constructor(e){super(e),this._panTask=null,this._startPosition=null,this._targetPosition=null,this.tileCache=[],this._graphics=new R({elevationInfo:{mode:"relative-to-ground"}}),this._imageGraphic=null,this.currentGraphics=new s,this.imagePyramid=null,this.imagePyramidLevel=-1,this._map=new a({ground:new t({opacity:0,navigationConstraint:null}),layers:new s([this._graphics])}),this._imageRenderer=new C({map:this._map,viewingMode:"local",camera:{position:S},environment:{atmosphereEnabled:!1,starsEnabled:!1,lighting:{type:"virtual"}},popupEnabled:!1,spatialReference:P.WebMercator,ui:{components:["zoom"]}}),this._loadController=null,this.zoomViewModel=new A({panoramicViewerViewModel:this,view:this._imageRenderer,panoramicZoomConditions:new x({})}),this.autoLoad=!1,this.clickAction="none",this.imageMeshDistance=I/2,this.imageSize=null,this.imageSource=null,this.navigationManager=null,this.navigationViewModel=null,this.pitch=90,this.state="ready",this.updatingHandles=new M,this.yaw=0,this._addNavigationHandles=(e=!0)=>{this.imageRenderer.basemapTerrain.suspended=!0,this.removeHandles(Z.navigation);const i=[this.imageRenderer.on("mouse-wheel",this._handleWheel),this.imageRenderer.on("drag",this._handleDrag),this.imageRenderer.on("key-down",e=>{const i=["+","-","Shift","_","=","ArrowUp","ArrowDown","ArrowRight","ArrowLeft"],t=e.key;i.includes(t)&&e.stopPropagation()})];e&&i.push(this.imageRenderer.on("double-click",this._handleDoubleClick)),this.addHandles(i,Z.navigation)},this._addHFOVHandles=()=>{this.removeHandles(Z.fovConstraint),this.addHandles(u(()=>[this.maxHFOV,this.minHFOV],()=>{this.zoomViewModel&&(this.zoomViewModel.panoramicZoomConditions=new x({view:this.imageRenderer,maxFOV:this.maxHFOV,minFOV:this.minHFOV}))},y),Z.fovConstraint)},this._addZoomHandles=()=>{this.zoomViewModel=new A({view:this.imageRenderer,panoramicZoomConditions:new x({maxFOV:this.maxHFOV,minFOV:this.minHFOV}),panoramicViewerViewModel:this});const e=this.imageRenderer.ui.find("zoom");e&&(e.viewModel=this.zoomViewModel),this._addHFOVHandles()},this._cancelLoadWithController=()=>{this._loadController?.abort(),this._loadController=null},this._createPanTask=()=>{this._panTask?.abort(),this._panTask=o(async e=>{if(!this.imagePyramid)return;const{hfov:i,vfov:t,yaw:a,pitch:r}=this,o=this.imagePyramid.getTiles(this.imagePyramidLevel,a,r,i,t).filter(e=>!this.tileCache.includes(`${e.level}/${e.row}/${e.column}`));if(!o?.length)return;const s=await Promise.all(o.map(async i=>await i.loadMesh({signal:e})));c(e);const n=s.map(F);n.forEach((e,i)=>{const t=o[i].key;e.attributes={key:t},this.tileCache.push(t)}),this.addManyGraphics(n),this.currentGraphics.addMany(n),this._panTask=null})},this._handleDoubleClick=e=>{e.stopPropagation(),e.native.ctrlKey?this._zoomOut():this._zoomIn()},this._handleDrag=e=>{e.stopPropagation();const{action:i,x:t,y:a}=e;switch(i){case"start":this._startPosition=this._targetPosition={x:t,y:a};break;case"update":this._targetPosition={x:t,y:a},this._updateCameraHeadingAndTilt()}},this._handleImageClick=e=>{if("image-loaded"===this.state&&this.imageRenderer.ready)switch(this.clickAction){case"emit":e.stopPropagation(),this.emit("click",e);break;case"hittest":e.stopPropagation(),e.defer(async()=>{const i=await this.imageRenderer.hitTest(e.screenPoint,{include:this._graphics}),t=Array.isArray(this._imageGraphic)?this._imageGraphic:[this._imageGraphic].filter(z);i.results=i.results.filter(e=>"graphic"===e.type&&!t.includes(e.graphic)),this.emit("hittest-response",i)});break;case"pixel-location":{if(e.stopPropagation(),!this.imageSize||!e.mapPoint)return void this.emit("pixel-location",null);const i=V(e.mapPoint,this.imageSize[0],this.imageSize[1]);this.emit("pixel-location",{...i,spatialReference:P.WebMercator});break}}},this._handleWheel=e=>{const i=e.deltaX??e.native.deltaX;e.stopPropagation(),i>0||e.deltaY>0?this._zoomOut():this._zoomIn()},this._loadNavigationManager=async()=>{if(!this.navigationManager||this.navigationManager?.destroyed){const e=await import("../OrientedImageryViewer/navigation/NavigationManagerPanoramic.js").then(e=>e.default);this.navigationManager=new e({viewModel:this.navigationViewModel})}return this.navigationManager},this._loadWithController=()=>{this._cancelLoadWithController(),this._loadController=new AbortController,this.loadImage(this._loadController)},this._zoomIn=()=>{this.zoomViewModel?.zoomIn()},this._zoomOut=()=>{this.zoomViewModel?.zoomOut()},this.addGraphic=(e,i)=>"image-loaded"===this.state&&!this._graphics.graphics.includes(e)&&(this._graphics.graphics.add(e,i),!0),this.addManyGraphics=e=>{if("image-loaded"!==this.state)return!1;const i=e.filter(e=>!this._graphics.graphics.includes(e));return this._graphics.graphics.addMany(i),!0},this.clearGraphics=()=>{this._graphics.graphics.removeAll()},this.clearImage=()=>{this.imageSize=null,this._removeImageSphere()},this.navigate=async(e,i)=>this.updatingHandles.addPromise(this.navigateInternal(e,i)),this.navigateInternal=async(e,i)=>{const t=await this._loadNavigationManager();return await t.navigate(e,i)},this.removeGraphic=e=>!("image-loaded"!==this.state||!this._graphics.graphics.includes(e))&&(this._graphics.remove(e),!0),this.removeManyGraphics=e=>{if("image-loaded"!==this.state)return!1;const i=e.filter(e=>this._graphics.graphics.includes(e));return this._graphics.removeMany(i),!0},this.restoreNavigationHandles=()=>{this._addNavigationHandles(!1)}}destroy(){this._imageRenderer.destroy()}initialize(){this.state="initialized",this.addHandles([u(()=>this.imageSource,()=>{this.imageSource&&this.autoLoad&&this._loadWithController()},y),u(()=>this.fov,()=>{this._reloadCamera()},y),u(()=>this.yaw,e=>{this.camera&&(this.camera.heading=e,this._reloadCamera())},y),u(()=>this.pitch,e=>{this.camera&&(this.camera.tilt=e,this._reloadCamera())},y),_(()=>this.imageRenderer.ready,()=>{this._addNavigationHandles(),this._addZoomHandles()},y),u(()=>this.clickAction,e=>{this.removeHandles(Z.clickAction),"none"!==e&&this.addHandles(this.imageRenderer.on("click",this._handleImageClick))},y),u(()=>this.camera,(e,i)=>{this._panTask?.abort(),e?i?.tilt===e.tilt&&i.heading===e.heading||this._createPanTask():this._panTask=null}),this.currentGraphics.on("change",()=>{const e=Array.isArray(this._imageGraphic)?this._imageGraphic:[this._imageGraphic].filter(z),i=this.currentGraphics.map(e=>e.geometry.extent);e.forEach(e=>{e.visible=!0!==i.some(i=>i.intersects(e.geometry.extent))})})],Z.default)}get camera(){return this.imageRenderer.destroying||this.imageRenderer.destroyed?null:this.imageRenderer.camera}set camera(e){!e||this.imageRenderer.destroying||this.imageRenderer.destroyed||(this.imageRenderer.camera=e.clone())}get distanceFactor(){return this.fov?1-5/this.fov:null}get fov(){return this.camera?.fov}set fov(e){Number.isFinite(e)&&this.zoomViewModel?.zoomTo(e)}get hfov(){if(!this.camera||!this.imageRenderer?.ready)return 0;const{fov:e}=this.camera,{size:[i,t]}=this.imageRenderer,a=i/t;return 2*d(Math.atan(Math.tan(l(e/2))*a/Math.sqrt(1+a**2)))}get imageRenderer(){return this._imageRenderer}get maxHFOV(){const{size:[e,i]}=this.imageRenderer;return this.imageRenderer.ready?T(O,e/i):O}get minHFOV(){const{size:[e,i]}=this.imageRenderer;return this.imageRenderer.ready?T(b,e/i):b}get updating(){return this.updatingHandles.updating}get vfov(){if(!this.camera||!this.imageRenderer?.ready)return 0;const{fov:e}=this.camera,{size:[i,t]}=this.imageRenderer,a=i/t;return 2*d(Math.atan(Math.tan(l(e/2))*(1/Math.sqrt(1+a**2))))}_clearImageSphere(){if(!this._imageGraphic)return;const e=Array.isArray(this._imageGraphic)?this._imageGraphic:[this._imageGraphic];this._graphics.removeMany(e),this._imageGraphic=null,e.forEach(e=>e.destroy()),this._graphics.removeMany(this.currentGraphics.toArray()),this.imagePyramid=null,this.imagePyramidLevel=-1,this.tileCache=[]}async _loadImageInternal(e,i){let t;this.state="image-loading";try{t=(await r(e,{responseType:"image",...i})).data}catch(a){throw p(a)?this.state="image-load-aborted":this.state="image-load-error",a}return this._updateImageSphere(t,i)}async loadImageTiled(e,i){this._removeImageSphere(),this.state="image-loading";try{const t=await L(e,i),a=await N(t,i),r=a.getLowResolutionTiles(),o=await E(r,i),{imageSize:s}=a;if(c(i),!r?.length)throw new n("panoramic-viewer:missing-tiles","No tiles were found in the pyramid",{imageSource:e});this.imagePyramid=a,this.imagePyramidLevel=a.maximumPyramidLevel;const h=o.map(F);h.forEach((e,i)=>{const t=r[i].key;e.attributes={key:t},this.tileCache.push(t)}),this._imageGraphic=h,this._graphics.addMany(this._imageGraphic),this.state="image-loaded",v(()=>this.imageRenderer.ready,i).then(()=>{const{size:[e,i]}=this.imageRenderer;this.fov=T(j,e/i)}),this.imageSize=s}catch(t){throw this.state=p(t)?"image-load-aborted":"image-load-error",t}}_reloadCamera(){this.camera=this.camera?.clone()}_removeImageSphere(){this._clearImageSphere(),this.state="ready",this.imageSize=null}_updateCameraHeadingAndTilt(){if(!this._startPosition||!this._targetPosition||!this.camera)return;const e=this.camera.heading+(this._startPosition.x-this._targetPosition.x)/this.imageRenderer.width*this.camera.fov;this.yaw=(e+360)%360;const i=this.camera.tilt-(this._startPosition.y-this._targetPosition.y)/this.imageRenderer.height*this.imageRenderer.camera.tilt;this.pitch=Math.min(179.5,Math.max(.5,i)),this._startPosition=this._targetPosition}async _updateImageSphere(e,i){return await g(i),this._imageGraphic=F(W(e)),this._graphics.add(this._imageGraphic),this.state="image-loaded",v(()=>this.imageRenderer.ready,i).then(()=>{const{size:[e,i]}=this.imageRenderer;this.fov=T(j,e/i)}),this.imageSize=[e.width,e.height],this._imageGraphic.geometry}async loadImage(e){return this._removeImageSphere(),this.imageSource?this._loadImageInternal(this.imageSource,e):H(this.declaredClass,new n(k("panoramic-viewer"),G("PanoramicViewerViewModel","imageSource")))}};e([f()],U.prototype,"_graphics",void 0),e([f()],U.prototype,"_imageGraphic",void 0),e([f({constructOnly:!0})],U.prototype,"currentGraphics",void 0),e([f()],U.prototype,"imagePyramid",void 0),e([f()],U.prototype,"imagePyramidLevel",void 0),e([f()],U.prototype,"_map",void 0),e([f()],U.prototype,"_imageRenderer",void 0),e([f()],U.prototype,"_loadController",void 0),e([f()],U.prototype,"zoomViewModel",void 0),e([f({type:Boolean})],U.prototype,"autoLoad",void 0),e([f({type:i})],U.prototype,"camera",null),e([D(new m({emit:"emit",hittest:"hittest",none:"none","pixel-location":"pixel-location"}))],U.prototype,"clickAction",void 0),e([f()],U.prototype,"distanceFactor",null),e([f({type:Number})],U.prototype,"fov",null),e([f({readOnly:!0})],U.prototype,"hfov",null),e([f()],U.prototype,"imageMeshDistance",void 0),e([f({readOnly:!0})],U.prototype,"imageRenderer",null),e([f()],U.prototype,"imageSize",void 0),e([f()],U.prototype,"imageSource",void 0),e([f({readOnly:!0})],U.prototype,"maxHFOV",null),e([f({readOnly:!0})],U.prototype,"minHFOV",null),e([f()],U.prototype,"navigationViewModel",void 0),e([f({type:Number})],U.prototype,"pitch",void 0),e([f()],U.prototype,"state",void 0),e([f()],U.prototype,"updatingHandles",void 0),e([f()],U.prototype,"updating",null),e([f({readOnly:!0})],U.prototype,"vfov",null),e([f({type:Number})],U.prototype,"yaw",void 0),U=e([w("esri.widgets.PanoramicViewer.PanoramicViewerViewModel")],U);const q=U;export{q as default};
5
+ import{__decorate as e}from"tslib";import i from"../../Camera.js";import t from"../../Ground.js";import a from"../../Map.js";import r from"../../request.js";import{createTask as o}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import n from"../../core/Error.js";import{EventedAccessor as h}from"../../core/Evented.js";import{JSONMap as m}from"../../core/jsonMap.js";import{rad2deg as d,deg2rad as l}from"../../core/mathUtils.js";import{throwIfAborted as c,isAbortError as p,waitTick as g}from"../../core/promiseUtils.js";import{watch as u,syncAndInitial as y,when as _,whenOnce as v}from"../../core/reactiveUtils.js";import{property as f,subclass as w}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as M}from"../../core/support/UpdatingHandles.js";import P from"../../geometry/SpatialReference.js";import R from"../../layers/GraphicsLayer.js";import{convertSphereVertexToPixelLocation as V}from"../../layers/orientedImagery/transformations/utils.js";import{isGraphic as z}from"../../support/guards.js";import C from"../../views/SceneView.js";import{logAndThrow as H,getMissingPropertyErrorName as k,getMissingPropertyErrorMessage as G}from"../OrientedImageryViewer/utils.js";import{defaultImageSphereCenter as S,defaultImageSphereSize as b,maxPanoramicViewerHFOV as I,minPanoramicViewerHFOV as O,humanBinocularHFOV as j}from"./constants.js";import x from"./PanoramicZoomConditions.js";import A from"./PanoramicZoomViewModel.js";import{meshToGraphic as F,findDiagonalFOV as T,loadRaster as L,loadPyramid as N,loadMeshes as E,createImageSphere as W}from"./utils.js";import{enumeration as D}from"../../core/accessorSupport/decorators/enumeration.js";const Z={default:"default",navigation:"navigation",fovConstraint:"fov-constraint",clickAction:"image-click-action"};let U=class extends h{constructor(e){super(e),this._panTask=null,this._startPosition=null,this._targetPosition=null,this.tileCache=[],this._graphics=new R({elevationInfo:{mode:"relative-to-ground"}}),this._imageGraphic=null,this.currentGraphics=new s,this.imagePyramid=null,this.imagePyramidLevel=-1,this._map=new a({ground:new t({opacity:0,navigationConstraint:null}),layers:new s([this._graphics])}),this._imageRenderer=new C({map:this._map,viewingMode:"local",camera:{position:S},environment:{atmosphereEnabled:!1,starsEnabled:!1,lighting:{type:"virtual"}},popupEnabled:!1,spatialReference:P.WebMercator,attributionVisible:!1,ui:{components:["zoom"]}}),this._loadController=null,this.zoomViewModel=new A({panoramicViewerViewModel:this,view:this._imageRenderer,panoramicZoomConditions:new x({})}),this.autoLoad=!1,this.clickAction="none",this.imageMeshDistance=b/2,this.imageSize=null,this.imageSource=null,this.navigationManager=null,this.navigationViewModel=null,this.pitch=90,this.state="ready",this.updatingHandles=new M,this.yaw=0,this._addNavigationHandles=(e=!0)=>{this.imageRenderer.basemapTerrain.suspended=!0,this.removeHandles(Z.navigation);const i=[this.imageRenderer.on("mouse-wheel",this._handleWheel),this.imageRenderer.on("drag",this._handleDrag),this.imageRenderer.on("key-down",e=>{const i=["+","-","Shift","_","=","ArrowUp","ArrowDown","ArrowRight","ArrowLeft"],t=e.key;i.includes(t)&&e.stopPropagation()})];e&&i.push(this.imageRenderer.on("double-click",this._handleDoubleClick)),this.addHandles(i,Z.navigation)},this._addHFOVHandles=()=>{this.removeHandles(Z.fovConstraint),this.addHandles(u(()=>[this.maxHFOV,this.minHFOV],()=>{this.zoomViewModel&&(this.zoomViewModel.panoramicZoomConditions=new x({view:this.imageRenderer,maxFOV:this.maxHFOV,minFOV:this.minHFOV}))},y),Z.fovConstraint)},this._addZoomHandles=()=>{this.zoomViewModel=new A({view:this.imageRenderer,panoramicZoomConditions:new x({maxFOV:this.maxHFOV,minFOV:this.minHFOV}),panoramicViewerViewModel:this});const e=this.imageRenderer.ui.find("zoom");e&&(e.viewModel=this.zoomViewModel),this._addHFOVHandles()},this._cancelLoadWithController=()=>{this._loadController?.abort(),this._loadController=null},this._createPanTask=()=>{this._panTask?.abort(),this._panTask=o(async e=>{if(!this.imagePyramid)return;const{hfov:i,vfov:t,yaw:a,pitch:r}=this,o=this.imagePyramid.getTiles(this.imagePyramidLevel,a,r,i,t).filter(e=>!this.tileCache.includes(`${e.level}/${e.row}/${e.column}`));if(!o?.length)return;const s=await Promise.all(o.map(async i=>await i.loadMesh({signal:e})));c(e);const n=s.map(F);n.forEach((e,i)=>{const t=o[i].key;e.attributes={key:t},this.tileCache.push(t)}),this.addManyGraphics(n),this.currentGraphics.addMany(n),this._panTask=null})},this._handleDoubleClick=e=>{e.stopPropagation(),e.native.ctrlKey?this._zoomOut():this._zoomIn()},this._handleDrag=e=>{e.stopPropagation();const{action:i,x:t,y:a}=e;switch(i){case"start":this._startPosition=this._targetPosition={x:t,y:a};break;case"update":this._targetPosition={x:t,y:a},this._updateCameraHeadingAndTilt()}},this._handleImageClick=e=>{if("image-loaded"===this.state&&this.imageRenderer.ready)switch(this.clickAction){case"emit":e.stopPropagation(),this.emit("click",e);break;case"hittest":e.stopPropagation(),e.defer(async()=>{const i=await this.imageRenderer.hitTest(e.screenPoint,{include:this._graphics}),t=Array.isArray(this._imageGraphic)?this._imageGraphic:[this._imageGraphic].filter(z);i.results=i.results.filter(e=>"graphic"===e.type&&!t.includes(e.graphic)),this.emit("hittest-response",i)});break;case"pixel-location":{if(e.stopPropagation(),!this.imageSize||!e.mapPoint)return void this.emit("pixel-location",null);const i=V(e.mapPoint,this.imageSize[0],this.imageSize[1]);this.emit("pixel-location",{...i,spatialReference:P.WebMercator});break}}},this._handleWheel=e=>{const i=e.deltaX??e.native.deltaX;e.stopPropagation(),i>0||e.deltaY>0?this._zoomOut():this._zoomIn()},this._loadNavigationManager=async()=>{if(!this.navigationManager||this.navigationManager?.destroyed){const e=await import("../OrientedImageryViewer/navigation/NavigationManagerPanoramic.js").then(e=>e.default);this.navigationManager=new e({viewModel:this.navigationViewModel})}return this.navigationManager},this._loadWithController=()=>{this._cancelLoadWithController(),this._loadController=new AbortController,this.loadImage(this._loadController)},this._zoomIn=()=>{this.zoomViewModel?.zoomIn()},this._zoomOut=()=>{this.zoomViewModel?.zoomOut()},this.addGraphic=(e,i)=>"image-loaded"===this.state&&!this._graphics.graphics.includes(e)&&(this._graphics.graphics.add(e,i),!0),this.addManyGraphics=e=>{if("image-loaded"!==this.state)return!1;const i=e.filter(e=>!this._graphics.graphics.includes(e));return this._graphics.graphics.addMany(i),!0},this.clearGraphics=()=>{this._graphics.graphics.removeAll()},this.clearImage=()=>{this.imageSize=null,this._removeImageSphere()},this.navigate=async(e,i)=>this.updatingHandles.addPromise(this.navigateInternal(e,i)),this.navigateInternal=async(e,i)=>{const t=await this._loadNavigationManager();return await t.navigate(e,i)},this.removeGraphic=e=>!("image-loaded"!==this.state||!this._graphics.graphics.includes(e))&&(this._graphics.remove(e),!0),this.removeManyGraphics=e=>{if("image-loaded"!==this.state)return!1;const i=e.filter(e=>this._graphics.graphics.includes(e));return this._graphics.removeMany(i),!0},this.restoreNavigationHandles=()=>{this._addNavigationHandles(!1)}}destroy(){this._imageRenderer.destroy()}initialize(){this.state="initialized",this.addHandles([u(()=>this.imageSource,()=>{this.imageSource&&this.autoLoad&&this._loadWithController()},y),u(()=>this.fov,()=>{this._reloadCamera()},y),u(()=>this.yaw,e=>{this.camera&&(this.camera.heading=e,this._reloadCamera())},y),u(()=>this.pitch,e=>{this.camera&&(this.camera.tilt=e,this._reloadCamera())},y),_(()=>this.imageRenderer.ready,()=>{this._addNavigationHandles(),this._addZoomHandles()},y),u(()=>this.clickAction,e=>{this.removeHandles(Z.clickAction),"none"!==e&&this.addHandles(this.imageRenderer.on("click",this._handleImageClick))},y),u(()=>this.camera,(e,i)=>{this._panTask?.abort(),e?i?.tilt===e.tilt&&i.heading===e.heading||this._createPanTask():this._panTask=null}),this.currentGraphics.on("change",()=>{const e=Array.isArray(this._imageGraphic)?this._imageGraphic:[this._imageGraphic].filter(z),i=this.currentGraphics.map(e=>e.geometry.extent);e.forEach(e=>{e.visible=!0!==i.some(i=>i.intersects(e.geometry.extent))})})],Z.default)}get camera(){return this.imageRenderer.destroying||this.imageRenderer.destroyed?null:this.imageRenderer.camera}set camera(e){!e||this.imageRenderer.destroying||this.imageRenderer.destroyed||(this.imageRenderer.camera=e.clone())}get distanceFactor(){return this.fov?1-5/this.fov:null}get fov(){return this.camera?.fov}set fov(e){Number.isFinite(e)&&this.zoomViewModel?.zoomTo(e)}get hfov(){if(!this.camera||!this.imageRenderer?.ready)return 0;const{fov:e}=this.camera,{size:[i,t]}=this.imageRenderer,a=i/t;return 2*d(Math.atan(Math.tan(l(e/2))*a/Math.sqrt(1+a**2)))}get imageRenderer(){return this._imageRenderer}get maxHFOV(){const{size:[e,i]}=this.imageRenderer;return this.imageRenderer.ready?T(I,e/i):I}get minHFOV(){const{size:[e,i]}=this.imageRenderer;return this.imageRenderer.ready?T(O,e/i):O}get updating(){return this.updatingHandles.updating}get vfov(){if(!this.camera||!this.imageRenderer?.ready)return 0;const{fov:e}=this.camera,{size:[i,t]}=this.imageRenderer,a=i/t;return 2*d(Math.atan(Math.tan(l(e/2))*(1/Math.sqrt(1+a**2))))}_clearImageSphere(){if(!this._imageGraphic)return;const e=Array.isArray(this._imageGraphic)?this._imageGraphic:[this._imageGraphic];this._graphics.removeMany(e),this._imageGraphic=null,e.forEach(e=>e.destroy()),this._graphics.removeMany(this.currentGraphics.toArray()),this.imagePyramid=null,this.imagePyramidLevel=-1,this.tileCache=[]}async _loadImageInternal(e,i){let t;this.state="image-loading";try{t=(await r(e,{responseType:"image",...i})).data}catch(a){throw p(a)?this.state="image-load-aborted":this.state="image-load-error",a}return this._updateImageSphere(t,i)}async loadImageTiled(e,i){this._removeImageSphere(),this.state="image-loading";try{const t=await L(e,i),a=await N(t,i),r=a.getLowResolutionTiles(),o=await E(r,i),{imageSize:s}=a;if(c(i),!r?.length)throw new n("panoramic-viewer:missing-tiles","No tiles were found in the pyramid",{imageSource:e});this.imagePyramid=a,this.imagePyramidLevel=a.maximumPyramidLevel;const h=o.map(F);h.forEach((e,i)=>{const t=r[i].key;e.attributes={key:t},this.tileCache.push(t)}),this._imageGraphic=h,this._graphics.addMany(this._imageGraphic),this.state="image-loaded",v(()=>this.imageRenderer.ready,i).then(()=>{const{size:[e,i]}=this.imageRenderer;this.fov=T(j,e/i)}),this.imageSize=s}catch(t){throw this.state=p(t)?"image-load-aborted":"image-load-error",t}}_reloadCamera(){this.camera=this.camera?.clone()}_removeImageSphere(){this._clearImageSphere(),this.state="ready",this.imageSize=null}_updateCameraHeadingAndTilt(){if(!this._startPosition||!this._targetPosition||!this.camera)return;const e=this.camera.heading+(this._startPosition.x-this._targetPosition.x)/this.imageRenderer.width*this.camera.fov;this.yaw=(e+360)%360;const i=this.camera.tilt-(this._startPosition.y-this._targetPosition.y)/this.imageRenderer.height*this.imageRenderer.camera.tilt;this.pitch=Math.min(179.5,Math.max(.5,i)),this._startPosition=this._targetPosition}async _updateImageSphere(e,i){return await g(i),this._imageGraphic=F(W(e)),this._graphics.add(this._imageGraphic),this.state="image-loaded",v(()=>this.imageRenderer.ready,i).then(()=>{const{size:[e,i]}=this.imageRenderer;this.fov=T(j,e/i)}),this.imageSize=[e.width,e.height],this._imageGraphic.geometry}async loadImage(e){return this._removeImageSphere(),this.imageSource?this._loadImageInternal(this.imageSource,e):H(this.declaredClass,new n(k("panoramic-viewer"),G("PanoramicViewerViewModel","imageSource")))}};e([f()],U.prototype,"_graphics",void 0),e([f()],U.prototype,"_imageGraphic",void 0),e([f({constructOnly:!0})],U.prototype,"currentGraphics",void 0),e([f()],U.prototype,"imagePyramid",void 0),e([f()],U.prototype,"imagePyramidLevel",void 0),e([f()],U.prototype,"_map",void 0),e([f()],U.prototype,"_imageRenderer",void 0),e([f()],U.prototype,"_loadController",void 0),e([f()],U.prototype,"zoomViewModel",void 0),e([f({type:Boolean})],U.prototype,"autoLoad",void 0),e([f({type:i})],U.prototype,"camera",null),e([D(new m({emit:"emit",hittest:"hittest",none:"none","pixel-location":"pixel-location"}))],U.prototype,"clickAction",void 0),e([f()],U.prototype,"distanceFactor",null),e([f({type:Number})],U.prototype,"fov",null),e([f({readOnly:!0})],U.prototype,"hfov",null),e([f()],U.prototype,"imageMeshDistance",void 0),e([f({readOnly:!0})],U.prototype,"imageRenderer",null),e([f()],U.prototype,"imageSize",void 0),e([f()],U.prototype,"imageSource",void 0),e([f({readOnly:!0})],U.prototype,"maxHFOV",null),e([f({readOnly:!0})],U.prototype,"minHFOV",null),e([f()],U.prototype,"navigationViewModel",void 0),e([f({type:Number})],U.prototype,"pitch",void 0),e([f()],U.prototype,"state",void 0),e([f()],U.prototype,"updatingHandles",void 0),e([f()],U.prototype,"updating",null),e([f({readOnly:!0})],U.prototype,"vfov",null),e([f({type:Number})],U.prototype,"yaw",void 0),U=e([w("esri.widgets.PanoramicViewer.PanoramicViewerViewModel")],U);const q=U;export{q as default};
package/widgets/Popup.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../core/Logger.js";import{ignoreAbortErrors as i,after as o}from"../core/promiseUtils.js";import{watch as n,on as s,initial as r,whenOnce as l}from"../core/reactiveUtils.js";import{waitAnimationFrame as a}from"../core/scheduling.js";import{stripHTML as d}from"../core/string.js";import{property as c,subclass as h}from"../core/accessorSupport/decorators.js";import u from"../support/actions/ActionButton.js";import p from"./Features.js";import g from"./Widget.js";import v from"./Features/FeaturesViewModel.js";import{css as f}from"./Popup/css.js";import m from"./Popup/PopupViewModel.js";import w from"./Popup/PopupVisibleElements.js";import{globalCss as b}from"./support/globalCss.js";import{tsx as _,messageBundle as M,vmEvent as k}from"./support/widget.js";import{isRTL as y}from"./support/widgetUtils.js";const E=200,C={buttonEnabled:!0,position:"auto",breakpoint:{width:544}};let D=class extends g{constructor(e,t){super(e,t),this._dockAction=new u({id:"popup-dock-action"}),this._featuresWidget=new p({responsiveActionsEnabled:!0}),this._containerNode=null,this._mainContainerNode=null,this._pointerOffsetInPx=16,this._focusAbortController=null,this.alignment="auto",this.dockEnabled=!1,this.headingLevel=2,this.messages=null,this.viewModel=new m,this.visibleElements=new w}initialize(){this.addHandles([n(()=>[this.viewModel?.view?.widthBreakpoint,this.dockEnabled],()=>this._handleDockIcon(),r),n(()=>[this.dockEnabled,this.messages?.undock,this.messages?.dock],()=>this._handleDockEnabled(),r),n(()=>this.dockOptions,e=>{const{_dockAction:t}=this,i=this._featuresWidget.headerActions;i.remove(t),e.buttonEnabled&&i.add(t)},r),n(()=>this.viewModel?.screenLocation,()=>this._positionContainer()),n(()=>[this.viewModel?.active,this.dockEnabled],()=>this._toggleScreenLocationEnabled()),n(()=>[this.viewModel?.screenLocation,this.viewModel?.view?.padding,this.viewModel?.view?.size,this.viewModel?.active,this.viewModel?.location,this.alignment],()=>this.reposition()),n(()=>this.viewModel?.view?.size,(e,t)=>this._updateDockEnabledForViewSize(e,t)),n(()=>this.viewModel?.view,(e,t)=>this._viewChange(e,t)),n(()=>this.viewModel?.view?.ready,(e,t)=>this._viewReadyChange(e??!1,t??!1)),n(()=>this.viewModel,()=>this._featuresWidget.viewModel=this.viewModel,r),n(()=>this._featureNavigationTop,e=>this._featuresWidget.featureNavigationTop=e,r),n(()=>this.headingLevel,e=>this._featuresWidget.headingLevel=e,r),n(()=>this.visibleElements.actionBar,e=>this._featuresWidget.visibleElements.actionBar=!!e,r),n(()=>this.visibleElements.closeButton,e=>this._featuresWidget.visibleElements.closeButton=!!e,r),n(()=>this.visibleElements.collapseButton,e=>this._featuresWidget.visibleElements.collapseButton=!!e,r),n(()=>this.visibleElements.heading,e=>this._featuresWidget.visibleElements.heading=!!e,r),n(()=>this.visibleElements.spinner,e=>this._featuresWidget.visibleElements.spinner=!!e,r),n(()=>this.visibleElements.featureNavigation,e=>this._featuresWidget.visibleElements.featureNavigation=!!e,r),n(()=>this.visibleElements.featureMenuHeading,e=>this._featuresWidget.visibleElements.featureMenuHeading=!!e,r),n(()=>this.visibleElements.featureListLayerTitle,e=>this._featuresWidget.visibleElements.featureListLayerTitle=!!e,r),s(()=>this._featuresWidget,"trigger-header-action",e=>{e.action===this._dockAction&&(this.dockEnabled=!this.dockEnabled)})])}destroy(){this._dockAction.destroy(),this._featuresWidget&&(this._featuresWidget.viewModel=new v,this._featuresWidget.destroy()),this._focusAbortController?.abort()}get _featureNavigationTop(){const{currentAlignment:e,currentDockPosition:t}=this;return"bottom-left"===e||"bottom-center"===e||"bottom-right"===e||"top-left"===t||"top-center"===t||"top-right"===t}get actions(){return this.viewModel.actions}set actions(e){this.viewModel.actions=e}get active(){return this.viewModel.active}get autoCloseEnabled(){return this.viewModel.autoCloseEnabled}set autoCloseEnabled(e){this.viewModel.autoCloseEnabled=e}get defaultPopupTemplateEnabled(){return this.viewModel.defaultPopupTemplateEnabled}set defaultPopupTemplateEnabled(e){this.viewModel.defaultPopupTemplateEnabled=e}get content(){return this.viewModel.content}set content(e){this.viewModel.content=e}get collapsed(){return this._featuresWidget.collapsed}set collapsed(e){this._featuresWidget.collapsed=e}get currentAlignment(){return this._getCurrentAlignment()}get currentDockPosition(){return this._getCurrentDockPosition()}get dockOptions(){return this._get("dockOptions")||C}set dockOptions(e){const t={...C},i=this.viewModel?.view?.breakpoints,o={};i&&(o.width=i.xsmall,o.height=i.xsmall);const n={...t,...e},s={...t.breakpoint,...o},{breakpoint:r}=n;"object"==typeof r?n.breakpoint={...s,...r}:r&&(n.breakpoint=s),this._set("dockOptions",n),this._setCurrentDockPosition(),this.reposition()}get featureCount(){return this.viewModel.featureCount}get featureMenuOpen(){return this.viewModel.featureMenuOpen}set featureMenuOpen(e){this.viewModel.featureMenuOpen=e}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get highlightEnabled(){return this.viewModel.highlightEnabled}set highlightEnabled(e){this.viewModel.highlightEnabled=e}get icon(){return"popup"}set icon(e){this._overrideIfSome("icon",e)}get initialDisplayMode(){return this.viewModel.initialDisplayMode}set initialDisplayMode(e){this.viewModel.initialDisplayMode=e}get location(){return this.viewModel.location}set location(e){this.viewModel.location=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get promises(){return this.viewModel.promises}set promises(e){this.viewModel.promises=e}get selectedFeature(){return this.viewModel.selectedFeature}get selectedDrillInFeature(){return this._featuresWidget.selectedDrillInFeature??null}get selectedFeatureIndex(){return this.viewModel.selectedFeatureIndex}set selectedFeatureIndex(e){this.viewModel.selectedFeatureIndex=e}get selectedFeatureWidget(){return this._featuresWidget.selectedFeatureWidget}get title(){return this.viewModel.title}set title(e){this.viewModel.title=e}get updateLocationEnabled(){return this.viewModel.updateLocationEnabled}set updateLocationEnabled(e){this.viewModel.updateLocationEnabled=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}blur(){const{active:e}=this.viewModel;e||t.getLogger(this).warn("Popup can only be blurred when currently active."),this._featuresWidget.blur()}clear(){return this.viewModel.clear()}close(){this.visible=!1}fetchFeatures(e,t){return this.viewModel.fetchFeatures(e,t)}focus(){const{active:e}=this.viewModel;e||t.getLogger(this).warn("Popup can only be focused when currently active."),this._handleFocus()}next(){return this.viewModel.next()}open(e){const t=!!e&&!!e.featureMenuOpen,i={collapsed:!!e&&!!e.collapsed,featureMenuOpen:t};this.set(i),this.viewModel.open(e),e?.shouldFocus&&this._handleFocus(!0)}previous(){return this.viewModel.previous()}reposition(){this.renderNow(),this._positionContainer(),this._setCurrentAlignment()}triggerAction(e){return this.viewModel.triggerAction(e)}render(){const{dockEnabled:e,currentAlignment:t,currentDockPosition:i}=this,{active:o,screenLocation:n}=this.viewModel,s=o&&e,r=o&&!e,l=this.selectedFeature?.layer?.title,a=this.selectedFeature?.layer?.id,c={[f.alignTopCenter]:"top-center"===t,[f.alignBottomCenter]:"bottom-center"===t,[f.alignTopLeft]:"top-left"===t,[f.alignBottomLeft]:"bottom-left"===t,[f.alignTopRight]:"top-right"===t,[f.alignBottomRight]:"bottom-right"===t,[f.isDocked]:s,[f.shadow]:r,[f.isDockedTopLeft]:"top-left"===i,[f.isDockedTopCenter]:"top-center"===i,[f.isDockedTopRight]:"top-right"===i,[f.isDockedBottomLeft]:"bottom-left"===i,[f.isDockedBottomCenter]:"bottom-center"===i,[f.isDockedBottomRight]:"bottom-right"===i};return _("div",{afterCreate:this._positionContainer,afterUpdate:this._positionContainer,"aria-hidden":(!o).toString(),"aria-label":d(this.title??""),"aria-modal":"false",bind:this,class:this.classes(f.base,c,{[f.baseHidden]:!n&&!e}),"data-layer-id":a,"data-layer-title":l,role:"dialog"},o?[this._renderMainContainer(),this._renderPointer()]:null)}_renderPointer(){return this.dockEnabled?null:_("div",{class:f.pointer,key:"popup-pointer",role:"presentation"},_("div",{class:this.classes(f.pointerDirection,f.shadow)}))}_renderMainContainer(){const{dockEnabled:e}=this,t={[f.shadow]:e};return _("div",{afterCreate:this._setMainContainerNode,afterUpdate:this._setMainContainerNode,bind:this,class:this.classes(f.main,b.widget,t)},this._featuresWidget.render())}_getAnimationDurationMS(){const{_containerNode:e}=this;return e?1e3*parseFloat(window.getComputedStyle(e).animationDuration):E}async _handleFocus(e=!1){this._focusAbortController?.abort(),this._focusAbortController=new AbortController;const t=this._focusAbortController.signal;e&&await l(()=>!0===this.viewModel?.active,{signal:t}),await i(a(t)),await i(o(this._getAnimationDurationMS(),t)),this._featuresWidget.focus()}_isOutsideView(e){const{popupHeight:t,popupWidth:i,screenLocation:o,side:n,view:s}=e;if(isNaN(i)||isNaN(t)||!s||!o)return!1;const r=s.padding;return"right"===n&&o.x+i/2>s.width-r.right||("left"===n&&o.x-i/2<r.left||("top"===n&&o.y-t<r.top||"bottom"===n&&o.y+t>s.height-r.bottom))}_calculateAutoAlignment(e){if("auto"!==e)return e;const{_pointerOffsetInPx:t,_containerNode:i,_mainContainerNode:o,viewModel:n}=this,{screenLocation:s,view:r}=n;if(null==s||!r||!i)return"top-center";function l(e){return parseInt(e.replaceAll(/[^-\d.]/g,""),10)}const a=o?window.getComputedStyle(o,null):null,d=a?l(a.getPropertyValue("max-height")):0,c=a?l(a.getPropertyValue("height")):0,{height:h,width:u}=i.getBoundingClientRect(),p=u+t,g=Math.max(h,d,c)+t,v=this._isOutsideView({popupHeight:g,popupWidth:p,screenLocation:s,side:"right",view:r}),f=this._isOutsideView({popupHeight:g,popupWidth:p,screenLocation:s,side:"left",view:r}),m=this._isOutsideView({popupHeight:g,popupWidth:p,screenLocation:s,side:"top",view:r}),w=this._isOutsideView({popupHeight:g,popupWidth:p,screenLocation:s,side:"bottom",view:r});return f?m?"bottom-right":"top-right":v?m?"bottom-left":"top-left":m?w?"top-center":"bottom-center":"top-center"}_callCurrentAlignment(e){return"function"==typeof e?e.call(this):e}_getCurrentAlignment(){const{alignment:e,dockEnabled:t,_containerNode:i}=this;return!t&&this.viewModel.active&&i?this._calculatePositionResult(this._calculateAutoAlignment(this._callCurrentAlignment(e))):null}_setCurrentAlignment(){this._set("currentAlignment",this._getCurrentAlignment())}_setCurrentDockPosition(){this._set("currentDockPosition",this._getCurrentDockPosition())}_calculatePositionResult(e){const t=["left","right"];return y(this.container)&&t.reverse(),e?.replaceAll(/leading/gi,t[0]).replaceAll(/trailing/gi,t[1])}_callDockPosition(e){return"function"==typeof e?e.call(this):e}_getDockPosition(){return this._calculatePositionResult(this._calculateAutoDockPosition(this._callDockPosition(this.dockOptions?.position)))}_getCurrentDockPosition(){return this.dockEnabled&&this.viewModel.active?this._getDockPosition():null}_calculateAutoDockPosition(e){if("auto"!==e)return e;const t=this.viewModel?.view,i=y(this.container)?"top-left":"top-right";if(!t)return i;const o=t.padding||{left:0,right:0},n=t.width-o.left-o.right,{breakpoints:s}=t;return s&&n<=s.xsmall?"bottom-center":i}_getDockIcon(){const e=this._getDockPosition();if(this.dockEnabled)return"minimize";switch(e){case"top-left":case"bottom-left":return"dock-left";case"top-center":return"maximize";case"bottom-center":return"dock-bottom";default:return"dock-right"}}_handleDockIcon(){this._dockAction.icon=this._getDockIcon()}_handleDockEnabled(){this._dockAction.title=this.dockEnabled?this.messages?.undock:this.messages?.dock}_setMainContainerNode(e){this._mainContainerNode=e}_positionContainer(e=this._containerNode){if(e&&(this._containerNode=e),!this._containerNode)return;const{screenLocation:t}=this.viewModel,{width:i}=this._containerNode.getBoundingClientRect(),o=this._calculatePositionStyle(t,i);o&&Object.assign(this._containerNode.style,o)}_calculateFullWidth(e){const{currentAlignment:t,_pointerOffsetInPx:i}=this;return"top-left"===t||"bottom-left"===t||"top-right"===t||"bottom-right"===t?e+i:e}_calculateAlignmentPosition(e,t,i,o){const{currentAlignment:n,_pointerOffsetInPx:s}=this;if(!i)return;const{padding:r}=i,l=o/2,a=i.height-t,d=i.width-e;return"bottom-center"===n?{top:t+s-r.top,left:e-l-r.left}:"top-left"===n?{bottom:a+s-r.bottom,right:d+s-r.right}:"bottom-left"===n?{top:t+s-r.top,right:d+s-r.right}:"top-right"===n?{bottom:a+s-r.bottom,left:e+s-r.left}:"bottom-right"===n?{top:t+s-r.top,left:e+s-r.left}:"top-center"===n?{bottom:a+s-r.bottom,left:e-l-r.left}:void 0}_calculatePositionStyle(e,t){const{dockEnabled:i,view:o}=this;if(!o)return;if(i)return{left:"",top:"",right:"",bottom:""};if(null==e||!t)return;const n=this._calculateFullWidth(t),s=this._calculateAlignmentPosition(e.x,e.y,o,n);return s?{top:void 0!==s.top?`${s.top}px`:"auto",left:void 0!==s.left?`${s.left}px`:"auto",bottom:void 0!==s.bottom?`${s.bottom}px`:"auto",right:void 0!==s.right?`${s.right}px`:"auto"}:void 0}_viewChange(e,t){e&&t&&(this.close(),this.clear())}_viewReadyChange(e,t){e?this._wireUpView():t&&(this.close(),this.clear())}_wireUpView(){this._setDockEnabledForViewSize(this.dockOptions)}_dockingThresholdCrossed(e,t,i){const[o,n]=e,[s,r]=t,{width:l=0,height:a=0}=i??{};return o<=l&&s>l||o>l&&s<=l||n<=a&&r>a||n>a&&r<=a}_updateDockEnabledForViewSize(e,t){if(!e||!t)return;const i=this.viewModel?.view?.padding||{left:0,right:0,top:0,bottom:0},o=i.left+i.right,n=i.top+i.bottom,s=[],r=[];s[0]=e[0]-o,s[1]=e[1]-n,r[0]=t[0]-o,r[1]=t[1]-n;const{dockOptions:l}=this,a=l.breakpoint;this._dockingThresholdCrossed(s,r,a)&&this._setDockEnabledForViewSize(l),this._setCurrentDockPosition()}_toggleScreenLocationEnabled(){const{dockEnabled:e,viewModel:t}=this;if(!t)return;const i=t.active&&!e;t.screenLocationEnabled=i}_shouldDockAtCurrentViewSize(e){const t=e.breakpoint,i=this.viewModel?.view?.ui;if(!i)return!1;const{width:o,height:n}=i;if(isNaN(o)||isNaN(n))return!1;if(!t)return!1;const s=t.hasOwnProperty("width")&&o<=(t.width??0),r=t.hasOwnProperty("height")&&n<=(t.height??0);return s||r}_setDockEnabledForViewSize(e){e.breakpoint&&(this.dockEnabled=this._shouldDockAtCurrentViewSize(e))}};e([c()],D.prototype,"_containerNode",void 0),e([c({readOnly:!0})],D.prototype,"_featureNavigationTop",null),e([c()],D.prototype,"actions",null),e([c({readOnly:!0})],D.prototype,"active",null),e([c()],D.prototype,"alignment",void 0),e([c()],D.prototype,"autoCloseEnabled",null),e([c()],D.prototype,"defaultPopupTemplateEnabled",null),e([c()],D.prototype,"content",null),e([c()],D.prototype,"collapsed",null),e([c({readOnly:!0})],D.prototype,"currentAlignment",null),e([c({readOnly:!0})],D.prototype,"currentDockPosition",null),e([c()],D.prototype,"dockOptions",null),e([c()],D.prototype,"dockEnabled",void 0),e([c({readOnly:!0})],D.prototype,"featureCount",null),e([c()],D.prototype,"featureMenuOpen",null),e([c()],D.prototype,"features",null),e([c()],D.prototype,"goToOverride",null),e([c()],D.prototype,"headingLevel",void 0),e([c()],D.prototype,"highlightEnabled",null),e([c()],D.prototype,"icon",null),e([c()],D.prototype,"initialDisplayMode",null),e([c()],D.prototype,"location",null),e([c()],D.prototype,"label",null),e([c(),M("esri/widgets/Popup/t9n/Popup")],D.prototype,"messages",void 0),e([c()],D.prototype,"promises",null),e([c({readOnly:!0})],D.prototype,"selectedFeature",null),e([c({readOnly:!0})],D.prototype,"selectedDrillInFeature",null),e([c()],D.prototype,"selectedFeatureIndex",null),e([c({readOnly:!0})],D.prototype,"selectedFeatureWidget",null),e([c()],D.prototype,"title",null),e([c()],D.prototype,"updateLocationEnabled",null),e([c()],D.prototype,"view",null),e([c({type:m}),k(["triggerAction","trigger-action"])],D.prototype,"viewModel",void 0),e([c()],D.prototype,"visible",null),e([c({type:w,nonNullable:!0})],D.prototype,"visibleElements",void 0),D=e([h("esri.widgets.Popup")],D);const P=D;export{P as default};
5
+ import{__decorate as e}from"tslib";import t from"../core/Logger.js";import{ignoreAbortErrors as i,after as o}from"../core/promiseUtils.js";import{watch as n,on as s,initial as r,whenOnce as l}from"../core/reactiveUtils.js";import{waitAnimationFrame as a}from"../core/scheduling.js";import{stripHTML as d}from"../core/string.js";import{property as c,subclass as h}from"../core/accessorSupport/decorators.js";import u from"../geometry/Point.js";import p from"../support/actions/ActionButton.js";import g from"./Features.js";import v from"./Widget.js";import f from"./Features/FeaturesViewModel.js";import{ActionsCollection as m}from"./Popup/actions.js";import{css as w}from"./Popup/css.js";import b from"./Popup/PopupViewModel.js";import _ from"./Popup/PopupVisibleElements.js";import{globalCss as M}from"./support/globalCss.js";import{tsx as k,messageBundle as y,vmEvent as E}from"./support/widget.js";import{isRTL as C}from"./support/widgetUtils.js";const P=200,D={buttonEnabled:!0,position:"auto",breakpoint:{width:544}};let A=class extends v{constructor(e,t){super(e,t),this._dockAction=new p({id:"popup-dock-action"}),this._featuresWidget=new g({responsiveActionsEnabled:!0}),this._containerNode=null,this._mainContainerNode=null,this._pointerOffsetInPx=16,this._focusAbortController=null,this.alignment="auto",this.dockEnabled=!1,this.headingLevel=2,this.messages=null,this.viewModel=new b,this.visibleElements=new _}initialize(){this.addHandles([n(()=>[this.viewModel?.view?.widthBreakpoint,this.dockEnabled],()=>this._handleDockIcon(),r),n(()=>[this.dockEnabled,this.messages?.undock,this.messages?.dock],()=>this._handleDockEnabled(),r),n(()=>this.dockOptions,e=>{const{_dockAction:t}=this,i=this._featuresWidget.headerActions;i.remove(t),e.buttonEnabled&&i.add(t)},r),n(()=>this.viewModel?.screenLocation,()=>this._positionContainer()),n(()=>[this.viewModel?.active,this.dockEnabled],()=>this._toggleScreenLocationEnabled()),n(()=>[this.viewModel?.screenLocation,this.viewModel?.view?.padding,this.viewModel?.view?.size,this.viewModel?.active,this.viewModel?.location,this.alignment],()=>this.reposition()),n(()=>this.viewModel?.view?.size,(e,t)=>this._updateDockEnabledForViewSize(e,t)),n(()=>this.viewModel?.view,(e,t)=>this._viewChange(e,t)),n(()=>this.viewModel?.view?.ready,(e,t)=>this._viewReadyChange(e??!1,t??!1)),n(()=>this.viewModel,()=>this._featuresWidget.viewModel=this.viewModel,r),n(()=>this._featureNavigationTop,e=>this._featuresWidget.featureNavigationTop=e,r),n(()=>this.headingLevel,e=>this._featuresWidget.headingLevel=e,r),n(()=>this.visibleElements.actionBar,e=>this._featuresWidget.visibleElements.actionBar=!!e,r),n(()=>this.visibleElements.closeButton,e=>this._featuresWidget.visibleElements.closeButton=!!e,r),n(()=>this.visibleElements.collapseButton,e=>this._featuresWidget.visibleElements.collapseButton=!!e,r),n(()=>this.visibleElements.heading,e=>this._featuresWidget.visibleElements.heading=!!e,r),n(()=>this.visibleElements.spinner,e=>this._featuresWidget.visibleElements.spinner=!!e,r),n(()=>this.visibleElements.featureNavigation,e=>this._featuresWidget.visibleElements.featureNavigation=!!e,r),n(()=>this.visibleElements.featureMenuHeading,e=>this._featuresWidget.visibleElements.featureMenuHeading=!!e,r),n(()=>this.visibleElements.featureListLayerTitle,e=>this._featuresWidget.visibleElements.featureListLayerTitle=!!e,r),s(()=>this._featuresWidget,"trigger-header-action",e=>{e.action===this._dockAction&&(this.dockEnabled=!this.dockEnabled)})])}destroy(){this._dockAction.destroy(),this._featuresWidget&&(this._featuresWidget.viewModel=new f,this._featuresWidget.destroy()),this._focusAbortController?.abort()}get _featureNavigationTop(){const{currentAlignment:e,currentDockPosition:t}=this;return"bottom-left"===e||"bottom-center"===e||"bottom-right"===e||"top-left"===t||"top-center"===t||"top-right"===t}get actions(){return this.viewModel.actions}set actions(e){this.viewModel.actions=e}get active(){return this.viewModel.active}get autoCloseEnabled(){return this.viewModel.autoCloseEnabled}set autoCloseEnabled(e){this.viewModel.autoCloseEnabled=e}get defaultPopupTemplateEnabled(){return this.viewModel.defaultPopupTemplateEnabled}set defaultPopupTemplateEnabled(e){this.viewModel.defaultPopupTemplateEnabled=e}get content(){return this.viewModel.content}set content(e){this.viewModel.content=e}get collapsed(){return this._featuresWidget.collapsed}set collapsed(e){this._featuresWidget.collapsed=e}get currentAlignment(){return this._getCurrentAlignment()}get currentDockPosition(){return this._getCurrentDockPosition()}get dockOptions(){return this._get("dockOptions")||D}set dockOptions(e){const t={...D},i=this.viewModel?.view?.breakpoints,o={};i&&(o.width=i.xsmall,o.height=i.xsmall);const n={...t,...e},s={...t.breakpoint,...o},{breakpoint:r}=n;"object"==typeof r?n.breakpoint={...s,...r}:r&&(n.breakpoint=s),this._set("dockOptions",n),this._setCurrentDockPosition(),this.reposition()}get featureCount(){return this.viewModel.featureCount}get featureMenuOpen(){return this.viewModel.featureMenuOpen}set featureMenuOpen(e){this.viewModel.featureMenuOpen=e}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get highlightEnabled(){return this.viewModel.highlightEnabled}set highlightEnabled(e){this.viewModel.highlightEnabled=e}get icon(){return"popup"}set icon(e){this._overrideIfSome("icon",e)}get initialDisplayMode(){return this.viewModel.initialDisplayMode}set initialDisplayMode(e){this.viewModel.initialDisplayMode=e}get location(){return this.viewModel.location}set location(e){this.viewModel.location=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get promises(){return this.viewModel.promises}set promises(e){this.viewModel.promises=e}get selectedFeature(){return this.viewModel.selectedFeature}get selectedDrillInFeature(){return this._featuresWidget.selectedDrillInFeature??null}get selectedFeatureIndex(){return this.viewModel.selectedFeatureIndex}set selectedFeatureIndex(e){this.viewModel.selectedFeatureIndex=e}get selectedFeatureWidget(){return this._featuresWidget.selectedFeatureWidget}get title(){return this.viewModel.title}set title(e){this.viewModel.title=e}get updateLocationEnabled(){return this.viewModel.updateLocationEnabled}set updateLocationEnabled(e){this.viewModel.updateLocationEnabled=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}blur(){const{active:e}=this.viewModel;e||t.getLogger(this).warn("Popup can only be blurred when currently active."),this._featuresWidget.blur()}clear(){return this.viewModel.clear()}close(){this.visible=!1}fetchFeatures(e,t){return this.viewModel.fetchFeatures(e,t)}focus(){const{active:e}=this.viewModel;e||t.getLogger(this).warn("Popup can only be focused when currently active."),this._handleFocus()}next(){return this.viewModel.next()}open(e){const t=!!e&&!!e.featureMenuOpen,i={collapsed:!!e&&!!e.collapsed,featureMenuOpen:t};this.set(i),this.viewModel.open(e),e?.shouldFocus&&this._handleFocus(!0)}previous(){return this.viewModel.previous()}reposition(){this.renderNow(),this._positionContainer(),this._setCurrentAlignment()}triggerAction(e){return this.viewModel.triggerAction(e)}render(){const{dockEnabled:e,currentAlignment:t,currentDockPosition:i}=this,{active:o,screenLocation:n}=this.viewModel,s=o&&e,r=o&&!e,l=this.selectedFeature?.layer?.title,a=this.selectedFeature?.layer?.id,c={[w.alignTopCenter]:"top-center"===t,[w.alignBottomCenter]:"bottom-center"===t,[w.alignTopLeft]:"top-left"===t,[w.alignBottomLeft]:"bottom-left"===t,[w.alignTopRight]:"top-right"===t,[w.alignBottomRight]:"bottom-right"===t,[w.isDocked]:s,[w.shadow]:r,[w.isDockedTopLeft]:"top-left"===i,[w.isDockedTopCenter]:"top-center"===i,[w.isDockedTopRight]:"top-right"===i,[w.isDockedBottomLeft]:"bottom-left"===i,[w.isDockedBottomCenter]:"bottom-center"===i,[w.isDockedBottomRight]:"bottom-right"===i};return k("div",{afterCreate:this._positionContainer,afterUpdate:this._positionContainer,"aria-hidden":(!o).toString(),"aria-label":d(this.title??""),"aria-modal":"false",bind:this,class:this.classes(w.base,c,{[w.baseHidden]:!n&&!e}),"data-layer-id":a,"data-layer-title":l,role:"dialog"},o?[this._renderMainContainer(),this._renderPointer()]:null)}_renderPointer(){return this.dockEnabled?null:k("div",{class:w.pointer,key:"popup-pointer",role:"presentation"},k("div",{class:this.classes(w.pointerDirection,w.shadow)}))}_renderMainContainer(){const{dockEnabled:e}=this,t={[w.shadow]:e};return k("div",{afterCreate:this._setMainContainerNode,afterUpdate:this._setMainContainerNode,bind:this,class:this.classes(w.main,M.widget,t)},this._featuresWidget.render())}_getAnimationDurationMS(){const{_containerNode:e}=this;return e?1e3*parseFloat(window.getComputedStyle(e).animationDuration):P}async _handleFocus(e=!1){this._focusAbortController?.abort(),this._focusAbortController=new AbortController;const t=this._focusAbortController.signal;e&&await l(()=>!0===this.viewModel?.active,{signal:t}),await i(a(t)),await i(o(this._getAnimationDurationMS(),t)),this._featuresWidget.focus()}_isOutsideView(e){const{popupHeight:t,popupWidth:i,screenLocation:o,side:n,view:s}=e;if(isNaN(i)||isNaN(t)||!s||!o)return!1;const r=s.padding;return"right"===n&&o.x+i/2>s.width-r.right||("left"===n&&o.x-i/2<r.left||("top"===n&&o.y-t<r.top||"bottom"===n&&o.y+t>s.height-r.bottom))}_calculateAutoAlignment(e){if("auto"!==e)return e;const{_pointerOffsetInPx:t,_containerNode:i,_mainContainerNode:o,viewModel:n}=this,{screenLocation:s,view:r}=n;if(null==s||!r||!i)return"top-center";function l(e){return parseInt(e.replaceAll(/[^-\d.]/g,""),10)}const a=o?window.getComputedStyle(o,null):null,d=a?l(a.getPropertyValue("max-height")):0,c=a?l(a.getPropertyValue("height")):0,{height:h,width:u}=i.getBoundingClientRect(),p=u+t,g=Math.max(h,d,c)+t,v=this._isOutsideView({popupHeight:g,popupWidth:p,screenLocation:s,side:"right",view:r}),f=this._isOutsideView({popupHeight:g,popupWidth:p,screenLocation:s,side:"left",view:r}),m=this._isOutsideView({popupHeight:g,popupWidth:p,screenLocation:s,side:"top",view:r}),w=this._isOutsideView({popupHeight:g,popupWidth:p,screenLocation:s,side:"bottom",view:r});return f?m?"bottom-right":"top-right":v?m?"bottom-left":"top-left":m?w?"top-center":"bottom-center":"top-center"}_callCurrentAlignment(e){return"function"==typeof e?e.call(this):e}_getCurrentAlignment(){const{alignment:e,dockEnabled:t,_containerNode:i}=this;return!t&&this.viewModel.active&&i?this._calculatePositionResult(this._calculateAutoAlignment(this._callCurrentAlignment(e))):null}_setCurrentAlignment(){this._set("currentAlignment",this._getCurrentAlignment())}_setCurrentDockPosition(){this._set("currentDockPosition",this._getCurrentDockPosition())}_calculatePositionResult(e){const t=["left","right"];return C(this.container)&&t.reverse(),e?.replaceAll(/leading/gi,t[0]).replaceAll(/trailing/gi,t[1])}_callDockPosition(e){return"function"==typeof e?e.call(this):e}_getDockPosition(){return this._calculatePositionResult(this._calculateAutoDockPosition(this._callDockPosition(this.dockOptions?.position)))}_getCurrentDockPosition(){return this.dockEnabled&&this.viewModel.active?this._getDockPosition():null}_calculateAutoDockPosition(e){if("auto"!==e)return e;const t=this.viewModel?.view,i=C(this.container)?"top-left":"top-right";if(!t)return i;const o=t.padding||{left:0,right:0},n=t.width-o.left-o.right,{breakpoints:s}=t;return s&&n<=s.xsmall?"bottom-center":i}_getDockIcon(){const e=this._getDockPosition();if(this.dockEnabled)return"minimize";switch(e){case"top-left":case"bottom-left":return"dock-left";case"top-center":return"maximize";case"bottom-center":return"dock-bottom";default:return"dock-right"}}_handleDockIcon(){this._dockAction.icon=this._getDockIcon()}_handleDockEnabled(){this._dockAction.title=this.dockEnabled?this.messages?.undock:this.messages?.dock}_setMainContainerNode(e){this._mainContainerNode=e}_positionContainer(e=this._containerNode){if(e&&(this._containerNode=e),!this._containerNode)return;const{screenLocation:t}=this.viewModel,{width:i}=this._containerNode.getBoundingClientRect(),o=this._calculatePositionStyle(t,i);o&&Object.assign(this._containerNode.style,o)}_calculateFullWidth(e){const{currentAlignment:t,_pointerOffsetInPx:i}=this;return"top-left"===t||"bottom-left"===t||"top-right"===t||"bottom-right"===t?e+i:e}_calculateAlignmentPosition(e,t,i,o){const{currentAlignment:n,_pointerOffsetInPx:s}=this;if(!i)return;const{padding:r}=i,l=o/2,a=i.height-t,d=i.width-e;return"bottom-center"===n?{top:t+s-r.top,left:e-l-r.left}:"top-left"===n?{bottom:a+s-r.bottom,right:d+s-r.right}:"bottom-left"===n?{top:t+s-r.top,right:d+s-r.right}:"top-right"===n?{bottom:a+s-r.bottom,left:e+s-r.left}:"bottom-right"===n?{top:t+s-r.top,left:e+s-r.left}:"top-center"===n?{bottom:a+s-r.bottom,left:e-l-r.left}:void 0}_calculatePositionStyle(e,t){const{dockEnabled:i,view:o}=this;if(!o)return;if(i)return{left:"",top:"",right:"",bottom:""};if(null==e||!t)return;const n=this._calculateFullWidth(t),s=this._calculateAlignmentPosition(e.x,e.y,o,n);return s?{top:void 0!==s.top?`${s.top}px`:"auto",left:void 0!==s.left?`${s.left}px`:"auto",bottom:void 0!==s.bottom?`${s.bottom}px`:"auto",right:void 0!==s.right?`${s.right}px`:"auto"}:void 0}_viewChange(e,t){e&&t&&(this.close(),this.clear())}_viewReadyChange(e,t){e?this._wireUpView():t&&(this.close(),this.clear())}_wireUpView(){this._setDockEnabledForViewSize(this.dockOptions)}_dockingThresholdCrossed(e,t,i){const[o,n]=e,[s,r]=t,{width:l=0,height:a=0}=i??{};return o<=l&&s>l||o>l&&s<=l||n<=a&&r>a||n>a&&r<=a}_updateDockEnabledForViewSize(e,t){if(!e||!t)return;const i=this.viewModel?.view?.padding||{left:0,right:0,top:0,bottom:0},o=i.left+i.right,n=i.top+i.bottom,s=[],r=[];s[0]=e[0]-o,s[1]=e[1]-n,r[0]=t[0]-o,r[1]=t[1]-n;const{dockOptions:l}=this,a=l.breakpoint;this._dockingThresholdCrossed(s,r,a)&&this._setDockEnabledForViewSize(l),this._setCurrentDockPosition()}_toggleScreenLocationEnabled(){const{dockEnabled:e,viewModel:t}=this;if(!t)return;const i=t.active&&!e;t.screenLocationEnabled=i}_shouldDockAtCurrentViewSize(e){const t=e.breakpoint,i=this.viewModel?.view?.ui;if(!i)return!1;const{width:o,height:n}=i;if(isNaN(o)||isNaN(n))return!1;if(!t)return!1;const s=t.hasOwnProperty("width")&&o<=(t.width??0),r=t.hasOwnProperty("height")&&n<=(t.height??0);return s||r}_setDockEnabledForViewSize(e){e.breakpoint&&(this.dockEnabled=this._shouldDockAtCurrentViewSize(e))}};e([c()],A.prototype,"_containerNode",void 0),e([c({readOnly:!0})],A.prototype,"_featureNavigationTop",null),e([c({type:m})],A.prototype,"actions",null),e([c({readOnly:!0})],A.prototype,"active",null),e([c()],A.prototype,"alignment",void 0),e([c()],A.prototype,"autoCloseEnabled",null),e([c()],A.prototype,"defaultPopupTemplateEnabled",null),e([c()],A.prototype,"content",null),e([c()],A.prototype,"collapsed",null),e([c({readOnly:!0})],A.prototype,"currentAlignment",null),e([c({readOnly:!0})],A.prototype,"currentDockPosition",null),e([c()],A.prototype,"dockOptions",null),e([c()],A.prototype,"dockEnabled",void 0),e([c({readOnly:!0})],A.prototype,"featureCount",null),e([c()],A.prototype,"featureMenuOpen",null),e([c()],A.prototype,"features",null),e([c()],A.prototype,"goToOverride",null),e([c()],A.prototype,"headingLevel",void 0),e([c()],A.prototype,"highlightEnabled",null),e([c()],A.prototype,"icon",null),e([c()],A.prototype,"initialDisplayMode",null),e([c({type:u})],A.prototype,"location",null),e([c()],A.prototype,"label",null),e([c(),y("esri/widgets/Popup/t9n/Popup")],A.prototype,"messages",void 0),e([c()],A.prototype,"promises",null),e([c({readOnly:!0})],A.prototype,"selectedFeature",null),e([c({readOnly:!0})],A.prototype,"selectedDrillInFeature",null),e([c()],A.prototype,"selectedFeatureIndex",null),e([c({readOnly:!0})],A.prototype,"selectedFeatureWidget",null),e([c()],A.prototype,"title",null),e([c()],A.prototype,"updateLocationEnabled",null),e([c()],A.prototype,"view",null),e([c({type:b}),E(["triggerAction","trigger-action"])],A.prototype,"viewModel",void 0),e([c()],A.prototype,"visible",null),e([c({type:_,nonNullable:!0})],A.prototype,"visibleElements",void 0),A=e([h("esri.widgets.Popup")],A);const O=A;export{O 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import{createScreenPoint as r}from"../../core/screenUtils.js";import{getMetersPerUnit as i,convertUnit as s}from"../../core/units.js";import{property as o,subclass as n}from"../../core/accessorSupport/decorators.js";import a from"../../geometry/Point.js";import c from"../../geometry/Polyline.js";import l from"../../geometry/SpatialReference.js";import{isSupported as m,geodesicLengths as u}from"../../geometry/support/geodesicUtils.js";import{straightLineDensify as p}from"../../geometry/support/normalizeUtils.js";import{isValid as d,getInfo as f}from"../../geometry/support/spatialReferenceUtils.js";import{webMercatorToGeographic as h}from"../../geometry/support/webMercatorUtils.js";import{isLinkChartView as w}from"../../linkChart/utils.js";function g(e){return e>.5?{min:.5,max:1}:e>.2?{min:.2,max:.5}:{min:.1,max:.2}}function y(e,t){switch(t){case"metric":return e>1e3?{distance:s(e,"meters","kilometers"),unit:"kilometer"}:e>1?{distance:e,unit:"meter"}:e>.01?{distance:s(e,"meters","centimeters"),unit:"centimeter"}:{distance:s(e,"meters","millimeters"),unit:"millimeter"};case"imperial":return e>1609.344?{distance:s(e,"meters","miles"),unit:"mile"}:e>.3048?{distance:s(e,"meters","feet"),unit:"foot"}:{distance:s(e,"meters","inches"),unit:"inch"}}}function S(e){const{isWebMercator:t,wkt:r,wkt2:i}=e;return t||((i||r)?.includes("WGS_1984_Web_Mercator")??!1)}function v({state:{paddedViewState:e},spatialReference:t,width:r}){return t.isWrappable&&e.worldScreenWidth<r}function j(e,t){const{x:r,y:i}=e?h(t,!0):t;return[r,i]}let M=class extends t{constructor(e){super(e),this.scaleComputedFrom=r(),this.view=null}get state(){return this.view?.ready&&"2d"===this.view.type?w(this.view)&&!this.view.inGeographicLayout?"disabled":"ready":"disabled"}getScaleBarProperties(e,t){if("disabled"===this.state||isNaN(e)||!t||!this.view)return null;const r=this._getDistanceInMeters();return null==r?null:this._getScaleBarProps(e,r,t)}_getDistanceInMeters(){const{state:e,spatialReference:t}=this.view;if(!d(t))return null;const{isGeographic:r}=t,s=S(t);if(!r&&!s){return e.extent.width*(i(t)??1)}const[o,n]=this._getScaleMeasuringPoints(),a=s||r&&!m(t)?l.WGS84:t,f=new c({paths:[[j(s,o),j(s,n)]],spatialReference:a}),h=p(f,10);let w;try{[w]=u([h],"meters")}catch{return null}return w}_getScaleMeasuringPoints(){const e=this.view,{width:t,height:i,position:s,spatialReference:o}=e;if(v(e)){const e=f(o),{valid:t}=e;return[new a(t[0],0,o),new a(t[1],0,o)]}let n=this.scaleComputedFrom.y-s[1];n>i?n=i:n<0&&(n=0);const c=r(0,n),l=r(t,n);return[e.toMap(c),e.toMap(l)]}_getScaleBarProps(e,t,r){const i=this.view,s=e*t/(v(i)?i.state.paddedViewState.worldScreenWidth:i.width);if(s<.001)return null;const o=y(s,r),{distance:n,unit:a}=o;let c=n,l=0;for(;c>=1;)c/=10,l++;const{min:m,max:u}=g(c),p=u/c>=c/m?m:u;return{length:e*(p/c),value:10**l*p,unit:a}}};e([o()],M.prototype,"scaleComputedFrom",void 0),e([o({readOnly:!0})],M.prototype,"state",null),e([o()],M.prototype,"view",void 0),M=e([n("esri.widgets.ScaleBar.ScaleBarViewModel")],M);const _=M;export{_ as default};
5
+ import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import{createScreenPoint as r}from"../../core/screenUtils.js";import{getMetersPerUnit as i,convertUnit as s}from"../../core/units.js";import{property as o,subclass as n}from"../../core/accessorSupport/decorators.js";import{isSupported as a,geodesicLengths as c}from"../../geometry/geodesicUtils.js";import l from"../../geometry/Point.js";import m from"../../geometry/Polyline.js";import u from"../../geometry/SpatialReference.js";import{straightLineDensify as p}from"../../geometry/support/normalizeUtils.js";import{isValid as d,getInfo as f}from"../../geometry/support/spatialReferenceUtils.js";import{webMercatorToGeographic as h}from"../../geometry/support/webMercatorUtils.js";import{isLinkChartView as w}from"../../linkChart/utils.js";function g(e){return e>.5?{min:.5,max:1}:e>.2?{min:.2,max:.5}:{min:.1,max:.2}}function y(e,t){switch(t){case"metric":return e>1e3?{distance:s(e,"meters","kilometers"),unit:"kilometer"}:e>1?{distance:e,unit:"meter"}:e>.01?{distance:s(e,"meters","centimeters"),unit:"centimeter"}:{distance:s(e,"meters","millimeters"),unit:"millimeter"};case"imperial":return e>1609.344?{distance:s(e,"meters","miles"),unit:"mile"}:e>.3048?{distance:s(e,"meters","feet"),unit:"foot"}:{distance:s(e,"meters","inches"),unit:"inch"}}}function S(e){const{isWebMercator:t,wkt:r,wkt2:i}=e;return t||((i||r)?.includes("WGS_1984_Web_Mercator")??!1)}function v({state:{paddedViewState:e},spatialReference:t,width:r}){return t.isWrappable&&e.worldScreenWidth<r}function j(e,t){const{x:r,y:i}=e?h(t,!0):t;return[r,i]}let M=class extends t{constructor(e){super(e),this.scaleComputedFrom=r(),this.view=null}get state(){return this.view?.ready&&"2d"===this.view.type?w(this.view)&&!this.view.inGeographicLayout?"disabled":"ready":"disabled"}getScaleBarProperties(e,t){if("disabled"===this.state||isNaN(e)||!t||!this.view)return null;const r=this._getDistanceInMeters();return null==r?null:this._getScaleBarProps(e,r,t)}_getDistanceInMeters(){const{state:e,spatialReference:t}=this.view;if(!d(t))return null;const{isGeographic:r}=t,s=S(t);if(!r&&!s){return e.extent.width*(i(t)??1)}const[o,n]=this._getScaleMeasuringPoints(),l=s||r&&!a(t)?u.WGS84:t,f=new m({paths:[[j(s,o),j(s,n)]],spatialReference:l}),h=p(f,10);let w;try{[w]=c([h],"meters")}catch{return null}return w}_getScaleMeasuringPoints(){const e=this.view,{width:t,height:i,position:s,spatialReference:o}=e;if(v(e)){const e=f(o),{valid:t}=e;return[new l(t[0],0,o),new l(t[1],0,o)]}let n=this.scaleComputedFrom.y-s[1];n>i?n=i:n<0&&(n=0);const a=r(0,n),c=r(t,n);return[e.toMap(a),e.toMap(c)]}_getScaleBarProps(e,t,r){const i=this.view,s=e*t/(v(i)?i.state.paddedViewState.worldScreenWidth:i.width);if(s<.001)return null;const o=y(s,r),{distance:n,unit:a}=o;let c=n,l=0;for(;c>=1;)c/=10,l++;const{min:m,max:u}=g(c),p=u/c>=c/m?m:u;return{length:e*(p/c),value:10**l*p,unit:a}}};e([o()],M.prototype,"scaleComputedFrom",void 0),e([o({readOnly:!0})],M.prototype,"state",null),e([o()],M.prototype,"view",void 0),M=e([n("esri.widgets.ScaleBar.ScaleBarViewModel")],M);const _=M;export{_ as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{isSome as r}from"../../../../core/arrayUtils.js";import{destroyMaybe as t}from"../../../../core/maybe.js";import{property as a,subclass as o}from"../../../../core/accessorSupport/decorators.js";import s from"../../../Widget.js";import i from"./MeasuredContentGroup.js";import l from"./OverflowGroup.js";import n from"./ResponsiveToolbarManager.js";import{SplitButton as d}from"./SplitButton.js";import{loadCalciteComponents as c}from"../../../support/componentsUtils.js";import{tsx as p}from"../../../support/widget.js";const u="esri-responsive-toolbar",m={rulerBase:`${u}__ruler`,rulerBarHorizontal:`${u}__ruler--bar`,rulerBarVertical:`${u}__ruler--bar--vertical`,rulerPadVertical:`${u}__ruler--pad--vertical`,rulerPadHorizontal:`${u}__ruler--pad--horizontal`,bar:`${u}__bar`,barHorizontal:`${u}__bar--horizontal`,barVertical:`${u}__bar--vertical`,pad:`${u}__pad`,padVertical:`${u}__pad--vertical`,padHorizontal:`${u}__pad--horizontal`};let h=class extends s{constructor(e){super(e),this.scale="m",this.barStyle="floating",this._measurementManager=new n,this._managedWidgets=new Map}loadDependencies(){return c({"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar")})}destroy(){this._measurementManager=t(this._measurementManager),this._managedWidgets.forEach(e=>e.destroy()),this._managedWidgets.clear()}set layout(e){const r=this._get("layout");this._set("layout",e),this._measurementManager&&(this._measurementManager.layout=e),r!==e&&this.scheduleRender()}get _barClasses(){const e="docked"===this.barStyle,r="vertical"===this.layout;return{[m.barHorizontal]:e&&!r,[m.barVertical]:e&&r,[m.bar]:e,[m.padHorizontal]:!e&&!r,[m.padVertical]:!e&&r,[m.pad]:!e}}render(){const{layout:e,scale:r,barStyle:t}=this,a={layout:e,scale:r,expandDisabled:!0,key:"measured-toolbar"},o="docked"===t?"vertical"===e?m.rulerBarVertical:m.rulerBarHorizontal:"horizontal"===e?m.rulerPadHorizontal:m.rulerPadVertical,s=this._renderChildren();return s.length?p("div",{key:"toolbar-wrapper"},p("div",{afterCreate:e=>{this._measurementManager?.connect(e)},class:this.classes(m.rulerBase,o),key:"ruler-element"}),p("calcite-action-bar",{...a,classes:this._barClasses,floating:"docked"!==t,overflowActionsDisabled:!0},s)):p("div",{key:"toolbar-wrapper"})}_renderChildren(){if(!this.children)return[];const e=new Set,t=[];for(const r of this.children){if(!r.properties?.key||!("group-kind"in r.properties)||!r.children?.length)continue;const a=r.properties,o=a.key;e.add(o);const s="docked"===this.barStyle?a.slot??void 0:void 0,n=a.priority??0,c=a["group-kind"]??"overflow-group",p=a["allow-collapse"]??!0,u=this._managedWidgets.get(o);if(u)u.children=r.children,u.priority=n,"allowCollapse"in u&&(u.allowCollapse=p),u.slot=s,u.layout=this.layout,u.scale=this.scale,u.measurementManager=this._measurementManager,t.push(u);else{const e={scale:this.scale,priority:n,measurementManager:this._measurementManager,children:r.children,slot:s,layout:this.layout};switch(c){case"split-button":{const r=new d({...e,allowCollapse:p});this._managedWidgets.set(o,r),t.push(r);break}case"overflow-group":{const r=new l({...e,allowCollapse:p});this._managedWidgets.set(o,r),t.push(r);break}case"measured-content":{const r=new i({...e});this._managedWidgets.set(o,r),t.push(r);break}}}}for(const[r]of this._managedWidgets.entries())e.has(r)||(this._managedWidgets.get(r)?.destroy(),this._managedWidgets.delete(r));return this._measurementManager?.allocate(),t.map(e=>e.render()).filter(r)}};e([a()],h.prototype,"scale",void 0),e([a({value:"horizontal"})],h.prototype,"layout",null),e([a()],h.prototype,"barStyle",void 0),e([a()],h.prototype,"_measurementManager",void 0),e([a()],h.prototype,"_managedWidgets",void 0),e([a()],h.prototype,"_barClasses",null),h=e([o("esri.widgets.Sketch.support.ResponsiveToolbar.ResponsiveToolbar")],h);export{h as default};
5
+ import{__decorate as e}from"tslib";import{isSome as r}from"../../../../core/arrayUtils.js";import{destroyMaybe as t}from"../../../../core/maybe.js";import{property as a,subclass as o}from"../../../../core/accessorSupport/decorators.js";import s from"../../../Widget.js";import i from"./MeasuredContentGroup.js";import l from"./OverflowGroup.js";import n from"./ResponsiveToolbarManager.js";import{SplitButton as d}from"./SplitButton.js";import{loadCalciteComponents as c}from"../../../support/componentsUtils.js";import{tsx as p}from"../../../support/widget.js";const u="esri-responsive-toolbar",m={rulerBase:`${u}__ruler`,rulerBarHorizontal:`${u}__ruler--bar`,rulerBarVertical:`${u}__ruler--bar--vertical`,rulerPadVertical:`${u}__ruler--pad--vertical`,rulerPadHorizontal:`${u}__ruler--pad--horizontal`,bar:`${u}__bar`,barHorizontal:`${u}__bar--horizontal`,barVertical:`${u}__bar--vertical`,pad:`${u}__pad`,padVertical:`${u}__pad--vertical`,padHorizontal:`${u}__pad--horizontal`};let h=class extends s{constructor(e){super(e),this.scale="m",this.barStyle="floating",this._measurementManager=new n,this._managedWidgets=new Map}loadDependencies(){return c({"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar")})}destroy(){this._measurementManager=t(this._measurementManager),this._managedWidgets.forEach(e=>e.destroy()),this._managedWidgets.clear()}set layout(e){const r=this._get("layout");this._set("layout",e),this._measurementManager&&(this._measurementManager.layout=e),r!==e&&this.scheduleRender()}get _barClasses(){const e="docked"===this.barStyle,r="vertical"===this.layout;return{[m.barHorizontal]:e&&!r,[m.barVertical]:e&&r,[m.bar]:e,[m.padHorizontal]:!e&&!r,[m.padVertical]:!e&&r,[m.pad]:!e}}render(){const{layout:e,scale:r,barStyle:t}=this,a={layout:e,scale:r,expandDisabled:!0,key:"measured-toolbar"},o="docked"===t?"vertical"===e?m.rulerBarVertical:m.rulerBarHorizontal:"horizontal"===e?m.rulerPadHorizontal:m.rulerPadVertical,s=this._renderChildren();return s.length?p("div",{key:"toolbar-wrapper"},p("div",{afterCreate:e=>{this._measurementManager?.connect(e)},class:this.classes(m.rulerBase,o),key:"ruler-element"}),p("calcite-action-bar",{...a,classes:this._barClasses,floating:"docked"!==t,overflowActionsDisabled:!0},s)):null}_renderChildren(){if(!this.children)return[];const e=new Set,t=[];for(const r of this.children){if(!r.properties?.key||!("group-kind"in r.properties)||!r.children?.length)continue;const a=r.properties,o=a.key;e.add(o);const s="docked"===this.barStyle?a.slot??void 0:void 0,n=a.priority??0,c=a["group-kind"]??"overflow-group",p=a["allow-collapse"]??!0,u=this._managedWidgets.get(o);if(u)u.children=r.children,u.priority=n,"allowCollapse"in u&&(u.allowCollapse=p),u.slot=s,u.layout=this.layout,u.scale=this.scale,u.measurementManager=this._measurementManager,t.push(u);else{const e={scale:this.scale,priority:n,measurementManager:this._measurementManager,children:r.children,slot:s,layout:this.layout};switch(c){case"split-button":{const r=new d({...e,allowCollapse:p});this._managedWidgets.set(o,r),t.push(r);break}case"overflow-group":{const r=new l({...e,allowCollapse:p});this._managedWidgets.set(o,r),t.push(r);break}case"measured-content":{const r=new i({...e});this._managedWidgets.set(o,r),t.push(r);break}}}}for(const[r]of this._managedWidgets.entries())e.has(r)||(this._managedWidgets.get(r)?.destroy(),this._managedWidgets.delete(r));return this._measurementManager?.allocate(),t.map(e=>e.render()).filter(r)}};e([a()],h.prototype,"scale",void 0),e([a({value:"horizontal"})],h.prototype,"layout",null),e([a()],h.prototype,"barStyle",void 0),e([a()],h.prototype,"_measurementManager",void 0),e([a()],h.prototype,"_managedWidgets",void 0),e([a()],h.prototype,"_barClasses",null),h=e([o("esri.widgets.Sketch.support.ResponsiveToolbar.ResponsiveToolbar")],h);export{h as default};
package/widgets/Widget.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{fetchMessageBundle as t,onLocaleChange as r}from"../intl.js";import{byId as s}from"../core/domUtils.js";import{EventedAccessor as o}from"../core/Evented.js";import{isEventedOrEventTarget as i,on as n}from"../core/events.js";import"../core/has.js";import{clone as d}from"../core/lang.js";import a from"../core/Logger.js";import{destroyMaybe as l}from"../core/maybe.js";import{EsriPromiseMixin as c}from"../core/Promise.js";import{debounce as h,throwIfNotAbortError as p}from"../core/promiseUtils.js";import{watch as u,syncAndInitial as m,when as g}from"../core/reactiveUtils.js";import{generateUUID as y}from"../core/uuid.js";import{property as v,subclass as _}from"../core/accessorSupport/decorators.js";import{runTracked as f}from"../core/accessorSupport/tracking.js";import{SimpleTrackingTarget as j}from"../core/accessorSupport/tracking/SimpleTrackingTarget.js";import{createAdvancedProjector as b}from"../libs/maquette-advanced-projector/projector.js";import{commitAssetPath as w}from"./support/componentsUtils.js";import{isWidgetConstructor as R,processWidgets as S}from"./support/jsxWidgetSupport.js";import{widgetSymbol as P,widgetTestDataSymbol as k}from"./support/symbols.js";import{registerAlive as E,registerLoading as F}from"./support/tests.js";import{getVNodeCache as L,setVNodeCache as T,deleteVNodeCache as C,clearVNodeCache as I}from"./support/vnodeCache.js";import{classes as N}from"./support/widget.js";var H;let $=0;function U(e,t){const r=Object.prototype.hasOwnProperty;for(const s in t)r.call(t,s)&&r.call(e,s)&&(null!=e[s]&&null!=t[s]&&"object"==typeof e[s]&&"object"==typeof t[s]?U(e[s],t[s]):e[s]=t[s]);return e}const z=b({postProcessProjectionOptions(e){const t=e.eventHandlerInterceptor,r=/capture$/i;e.eventHandlerInterceptor=(e,s,o,i)=>{const n=t?.(e,s,o,i),d=r.test(e);if(!((e=e.replace(r,"")).toLowerCase()in o)||d){const t=e[2].toLowerCase()+e.slice(3),r=e=>n?.call(o,e);o.addEventListener(t,r,d);const s=()=>o.removeEventListener(t,r,d),a=i.afterRemoved;i.afterRemoved=e=>{a?.(e),s()}}return n}},handleInterceptedEvent(e,t,r,s){const{eventPhase:o,type:i}=s,n=o===Event.CAPTURING_PHASE;let d=`on${i}${n?"capture":""}`;const a=t.properties;(a&&d in a||(d=`on${i[0].toUpperCase()}${i.slice(1)}${n?"Capture":""}`,a&&d in a))&&(I(),e.scheduleRender(),a[d].call(a.bind||r,s))}});let x=!1,O=class extends(c(o)){static{this[H]=!0}constructor(e,r){super(e,r),this._attached=!1,this._projector=z,this._readyForTrueRender=!1,this.key=this,this.autoRenderingEnabled=!0,this._loadLocale=h(async()=>{if(this._messageBundleProps?.length){const e=await Promise.allSettled(this._messageBundleProps.map(async({bundlePath:e,propertyName:r})=>{if(this.destroyed)return;let s=await t(e);this.destroyed||(this.uiStrings&&Object.keys(this.uiStrings)&&(s=U(d(s),this.uiStrings)),this[r]=s)}));if(this.destroyed)return;for(const t of e)"rejected"===t.status&&a.getLogger(this).error("widget-intl:locale-error",this.declaredClass,t.reason)}await this.loadLocale()}),this.addHandles(E()),w();const s="esri-widget-uid-"+y(),o=this.render.bind(this);this._trackingTarget=new j(()=>{this.autoRenderingEnabled&&this.scheduleRender()});const i=()=>({vnodeSelector:"div",properties:{key:`${s}-hidden`,class:"",styles:{display:"none"}},domNode:null,children:void 0,text:void 0}),n=()=>{if(!this._readyForTrueRender||this.destroyed)return null;const e=o()??i(),t=e.properties??={};if(t.key??=s,R(e.vnodeSelector)){if(!this.visible)return i()}else this.visible?t.styles||(t.styles={}):(t.class="",t.styles={display:"none"}),t.styles.display??="";let r=0;return e.children?.forEach(e=>{R(e.vnodeSelector)||(e.properties??={},e.properties.key??=`${this.id}--${r++}`)}),S(this,e)};this.render=()=>{if(x)return n();let e=L(this)??null;if(e)return e;this._trackingTarget.clear(),x=!0;try{e=f(this._trackingTarget,n)}catch(t){throw a.getLogger(this).error(t),t}finally{x=!1}return e&&T(this,e),e};const l=this.beforeFirstRender();l?this._resourcesFetch=l.then(()=>{this.destroyed||(this._readyForTrueRender=!0,this._postInitialize())}):(this._resourcesFetch=Promise.resolve().then(()=>{this.destroyed||this._postInitialize()}),this._readyForTrueRender=!0),this.addResolvingPromise(this._resourcesFetch),F(this._resourcesFetch)}normalizeCtorArgs(e,t){const r={...e};return t&&(r.container=t),r}postInitialize(){}beforeFirstRender(){const e=this.loadDependencies();return this._messageBundleProps?.length||e?Promise.all([e,this._loadLocale()]).then(()=>{}).catch(p):null}loadDependencies(){return null}loadLocale(){return null}destroy(){this.destroyed||(l(this._trackingTarget),l(this.viewModel),this._detach(this.container),this._set("container",null),this.render=()=>null,this._projector=null,C(this))}get container(){return this._get("container")}set container(e){this._get("container")||this._set("container",s(e))}get destroyed(){return super.destroyed}get domNode(){return this.container}set domNode(e){this.container=e}get icon(){return null}set icon(e){this._overrideIfSome("icon",e)}get id(){return this._get("id")||this.container?.id||Date.now().toString(16)+"-widget-"+$++}set id(e){e&&this._set("id",e)}get label(){return this.declaredClass.split(".").pop()}set label(e){this._overrideIfSome("label",e)}get renderable(){return this._resourcesFetch}get visible(){return this._get("visible")}set visible(e){this._set("visible",e)}get[(H=P,k)](){return{projector:this._projector}}static{this.vnodeSelector="div"}render(){throw new Error("not implemented")}scheduleRender(){this.destroyed||(C(this),this._projector.scheduleRender())}classes(...e){return N.apply(this,e)}renderNow(){C(this),this._projector.renderNow()}_postInitialize(){if(this.destroyed)return;this.scheduleRender(),this._delegatedEventNames?.length&&this.addHandles(u(()=>this.viewModel,(e,t)=>{t&&this.removeHandles("delegated-events"),e&&i(e)&&this.addHandles(this._delegatedEventNames.map(t=>n(e,t,e=>{this.emit(t,e)})),"delegated-events")},m)),this.postInitialize();const e=async()=>{await this._loadLocale().catch(p),this.scheduleRender()};this.addHandles([r(e),u(()=>this.uiStrings,e)]),this.addHandles(g(()=>this.container,e=>{this.destroyed||this._attach(e)},{initial:!0,once:!0}))}_attach(e){e&&(this._projector.merge(e,this.render),this._attached=!0)}_detach(e){this._attached&&(this._projector.detach(this.render),this._attached=!1),e?.parentNode?.removeChild(e)}};e([v()],O.prototype,"_readyForTrueRender",void 0),e([v({value:null})],O.prototype,"container",null),e([v()],O.prototype,"icon",null),e([v()],O.prototype,"id",null),e([v()],O.prototype,"label",null),e([v()],O.prototype,"renderable",null),e([v()],O.prototype,"uiStrings",void 0),e([v()],O.prototype,"viewModel",void 0),e([v({value:!0})],O.prototype,"visible",null),e([v()],O.prototype,"key",void 0),e([v()],O.prototype,"children",void 0),e([v()],O.prototype,"afterCreate",void 0),e([v()],O.prototype,"afterUpdate",void 0),e([v()],O.prototype,"afterRemoved",void 0),O=e([_("esri.widgets.Widget")],O);const A=O;export{A as default};
5
+ import{__decorate as e}from"tslib";import{fetchMessageBundle as t,onLocaleChange as r}from"../intl.js";import{byId as s}from"../core/domUtils.js";import{EventedAccessor as o}from"../core/Evented.js";import{isEventedOrEventTarget as i,on as n}from"../core/events.js";import"../core/has.js";import{clone as d}from"../core/lang.js";import a from"../core/Logger.js";import{destroyMaybe as l}from"../core/maybe.js";import{EsriPromiseMixin as c}from"../core/Promise.js";import{debounce as h,throwIfNotAbortError as p}from"../core/promiseUtils.js";import{watch as u,syncAndInitial as m,when as g}from"../core/reactiveUtils.js";import{generateUUID as y}from"../core/uuid.js";import{property as v,subclass as _}from"../core/accessorSupport/decorators.js";import{runTracked as f}from"../core/accessorSupport/tracking.js";import{SimpleTrackingTarget as j}from"../core/accessorSupport/tracking/SimpleTrackingTarget.js";import{createAdvancedProjector as b}from"../libs/maquette-advanced-projector/projector.js";import{commitAssetPath as w}from"./support/componentsUtils.js";import{isWidgetConstructor as R,processWidgets as S}from"./support/jsxWidgetSupport.js";import{widgetSymbol as P,widgetTestDataSymbol as k}from"./support/symbols.js";import{registerAlive as C,registerLoading as E}from"./support/tests.js";import{getVNodeCache as F,setVNodeCache as L,deleteVNodeCache as T,clearVNodeCache as I}from"./support/vnodeCache.js";import{classes as N}from"./support/widget.js";var H;let $=0;function U(e,t){const r=Object.prototype.hasOwnProperty;for(const s in t)r.call(t,s)&&r.call(e,s)&&(null!=e[s]&&null!=t[s]&&"object"==typeof e[s]&&"object"==typeof t[s]?U(e[s],t[s]):e[s]=t[s]);return e}const z=b({postProcessProjectionOptions(e){const t=e.eventHandlerInterceptor,r=/capture$/i;e.eventHandlerInterceptor=(e,s,o,i)=>{const n=t?.(e,s,o,i),d=r.test(e);if(!((e=e.replace(r,"")).toLowerCase()in o)||d){const t=e[2].toLowerCase()+e.slice(3),r=e=>n?.call(o,e);o.addEventListener(t,r,d);const s=()=>o.removeEventListener(t,r,d),a=i.afterRemoved;i.afterRemoved=e=>{a?.(e),s()}}return n}},handleInterceptedEvent(e,t,r,s){const{eventPhase:o,type:i}=s,n=o===Event.CAPTURING_PHASE;let d=`on${i}${n?"capture":""}`;const a=t.properties;(a&&d in a||(d=`on${i[0].toUpperCase()}${i.slice(1)}${n?"Capture":""}`,a&&d in a))&&(I(),e.scheduleRender(),a[d].call(a.bind||r,s))}});let x=!1,O=class extends(c(o)){static{this[H]=!0}constructor(e,r){super(e,r),this._attached=!1,this._projector=z,this._readyForTrueRender=!1,this.key=this,this.autoRenderingEnabled=!0,this._loadLocale=h(async()=>{if(this._messageBundleProps?.length){const e=await Promise.allSettled(this._messageBundleProps.map(async({bundlePath:e,propertyName:r})=>{if(this.destroyed)return;let s=await t(e);this.destroyed||(this.uiStrings&&Object.keys(this.uiStrings)&&(s=U(d(s),this.uiStrings)),this[r]=s)}));if(this.destroyed)return;for(const t of e)"rejected"===t.status&&a.getLogger(this).error("widget-intl:locale-error",this.declaredClass,t.reason)}await this.loadLocale()}),this.addHandles(C()),w();const s="esri-widget-uid-"+y(),o=this.render.bind(this);this._trackingTarget=new j(()=>{this.autoRenderingEnabled&&this.scheduleRender()});const i=()=>({vnodeSelector:"div",properties:{key:`${s}-hidden`,class:"",styles:{display:"none"}},domNode:null,children:void 0,text:void 0}),n=()=>{if(!this._readyForTrueRender||this.destroyed)return null;const e=o()??i(),t=e.properties??={};if(t.key??=s,R(e.vnodeSelector)){if(!this.visible)return i()}else this.visible?t.styles||(t.styles={}):(t.class="",t.styles={display:"none"}),t.styles.display??="";let r=0;return e.children?.forEach(e=>{R(e.vnodeSelector)||(e.properties??={},e.properties.key??=`${this.id}--${r++}`)}),S(this,e)};this.render=()=>{if(x)return n();let e=F(this)??null;if(e)return e;this._trackingTarget.clear(),x=!0;try{e=f(this._trackingTarget,n)}catch(t){throw a.getLogger(this).error(t),t}finally{x=!1}return e&&L(this,e),e};const l=this.beforeFirstRender();l?this._resourcesFetch=l.then(()=>{this.destroyed||(this._readyForTrueRender=!0,this._postInitialize())}):(this._resourcesFetch=Promise.resolve().then(()=>{this.destroyed||this._postInitialize()}),this._readyForTrueRender=!0),this.addResolvingPromise(this._resourcesFetch),E(this._resourcesFetch)}normalizeCtorArgs(e,t){const r={...e};return t&&(r.container=t),r}postInitialize(){}beforeFirstRender(){const e=this.loadDependencies();return this._messageBundleProps?.length||e?Promise.all([e,this._loadLocale()]).then(()=>{}).catch(p):null}loadDependencies(){return null}loadLocale(){return null}destroy(){this.destroyed||(l(this._trackingTarget),l(this.viewModel),this._detach(this.container),this._set("container",null),this.render=()=>null,this._projector=null,T(this))}get container(){return this._get("container")}set container(e){this._get("container")||this._set("container",s(e))}get destroyed(){return super.destroyed}get domNode(){return this.container}set domNode(e){this.container=e}get icon(){return null}set icon(e){this._overrideIfSome("icon",e)}get id(){return this._get("id")||this.container?.id||Date.now().toString(16)+"-widget-"+$++}set id(e){e&&this._set("id",e)}get label(){return this.declaredClass.split(".").pop()}set label(e){this._overrideIfSome("label",e)}get renderable(){return this._resourcesFetch}get visible(){return this._get("visible")}set visible(e){this._set("visible",e)}get[(H=P,k)](){return{projector:this._projector}}static{this.vnodeSelector="div"}render(){throw new Error("not implemented")}removeContainer(){this._set("container",null)}scheduleRender(){this.destroyed||(T(this),this._projector.scheduleRender())}classes(...e){return N.apply(this,e)}renderNow(){T(this),this._projector.renderNow()}_postInitialize(){if(this.destroyed)return;this.scheduleRender(),this._delegatedEventNames?.length&&this.addHandles(u(()=>this.viewModel,(e,t)=>{t&&this.removeHandles("delegated-events"),e&&i(e)&&this.addHandles(this._delegatedEventNames.map(t=>n(e,t,e=>{this.emit(t,e)})),"delegated-events")},m)),this.postInitialize();const e=async()=>{await this._loadLocale().catch(p),this.scheduleRender()};this.addHandles([r(e),u(()=>this.uiStrings,e)]),this.addHandles(g(()=>this.container,e=>{this.destroyed||this._attach(e)},{initial:!0,once:!0}))}_attach(e){e&&(this._projector.merge(e,this.render),this._attached=!0)}_detach(e){this._attached&&(this._projector.detach(this.render),this._attached=!1),e?.parentNode?.removeChild(e)}};e([v()],O.prototype,"_readyForTrueRender",void 0),e([v({value:null})],O.prototype,"container",null),e([v()],O.prototype,"icon",null),e([v()],O.prototype,"id",null),e([v()],O.prototype,"label",null),e([v()],O.prototype,"renderable",null),e([v()],O.prototype,"uiStrings",void 0),e([v()],O.prototype,"viewModel",void 0),e([v({value:!0})],O.prototype,"visible",null),e([v()],O.prototype,"key",void 0),e([v()],O.prototype,"children",void 0),e([v()],O.prototype,"afterCreate",void 0),e([v()],O.prototype,"afterUpdate",void 0),e([v()],O.prototype,"afterRemoved",void 0),O=e([_("esri.widgets.Widget")],O);const A=O;export{A 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{isActivationKey as n}from"../widgetUtils.js";function t(){return function(n,t){if(!n[t])throw new TypeError(`Cannot auto bind undefined function '${String(t)}'`);return{value:r(n[t])}}}function e(n){const t=n?.type;return n instanceof KeyboardEvent||"keyup"===t||"keydown"===t||"keypress"===t}function r(t){return function(r,...o){e(r)?n(r.key)&&(r.preventDefault(),r.stopPropagation(),r.target.click()):t.call(this,r,...o)}}export{t as accessibleHandler};
5
+ import{isActivationKey as n}from"../../../core/keyboard.js";function t(){return function(n,t){if(!n[t])throw new TypeError(`Cannot auto bind undefined function '${String(t)}'`);return{value:r(n[t])}}}function e(n){const t=n?.type;return n instanceof KeyboardEvent||"keyup"===t||"keydown"===t||"keypress"===t}function r(t){return function(r,...o){e(r)?n(r.key)&&(r.preventDefault(),r.stopPropagation(),r.target.click()):t.call(this,r,...o)}}export{t as accessibleHandler};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{createArcadeProfile as e,createArcadeExecutor as r}from"../../../../arcade.js";import o from"../../../../core/Accessor.js";import{debounce as s}from"../../../../core/promiseUtils.js";import{property as i,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as a}from"../../../../core/support/UpdatingHandles.js";import{fixFields as n}from"../../../../layers/support/fieldUtils.js";var u;const c=Symbol("FormExpressionArcadeExecutor");let p=class extends o{static{u=c}constructor(t){super(t),this[u]=!0,this._lastEvaluatedValue=null,this._abortController=new AbortController,this._initialExecutionComplete=!1,this._stale=!1,this._updatingTracking=new a,this._executeAsyncDebounced=s(async(t,e,r)=>{const o=await this.executor.executeAsync(t,{...e,abortSignal:r});return r.aborted?this._lastEvaluatedValue:(this._lastEvaluatedValue=o,this._stale=!1,o)})}get initialExecutionComplete(){return this._initialExecutionComplete}get isAsync(){return this.executor.isAsync}get fieldsUsed(){return this.executor.fieldsUsed}get syntaxTree(){return this.executor.syntaxTree}get updating(){return this._updatingTracking.updating}get stale(){return this._stale}get geometryUsed(){return this.executor.geometryUsed}get variablesUsed(){return this.executor.variablesUsed}get lastEvaluatedValue(){return this._lastEvaluatedValue}abort(){this._abortController.abort()}execute(t,e){this._abortController=new AbortController;const r=this.executor.execute(t,{...e,abortSignal:this._abortController.signal});return this._lastEvaluatedValue=r,this._initialExecutionComplete=!0,r}async executeAsync(t,e){return this._abortController=new AbortController,this._updatingTracking.addPromise(this._executeAsyncDebounced(t,e??{},this._abortController.signal).then(()=>{this._initialExecutionComplete=!0}))}markStale(){this._stale=!0}reset(){this.abort(),this._lastEvaluatedValue=null,this._stale=!1}};t([i()],p.prototype,"_lastEvaluatedValue",void 0),t([i()],p.prototype,"_initialExecutionComplete",void 0),t([i()],p.prototype,"_stale",void 0),t([i()],p.prototype,"_updatingTracking",void 0),t([i({constructOnly:!0})],p.prototype,"executor",void 0),t([i()],p.prototype,"initialExecutionComplete",null),t([i()],p.prototype,"isAsync",null),t([i()],p.prototype,"fieldsUsed",null),t([i()],p.prototype,"syntaxTree",null),t([i()],p.prototype,"updating",null),t([i()],p.prototype,"stale",null),t([i()],p.prototype,"geometryUsed",null),t([i()],p.prototype,"variablesUsed",null),t([i()],p.prototype,"lastEvaluatedValue",null),p=t([l("esri.widgets.support.forms.expressions.FormExpressionArcadeExecutor")],p);const d=async(t,o)=>{const s=e("form-calculation"),i=await r(t,s,{});return o?.fieldsIndex&&(i.fieldsUsed=n(o.fieldsIndex,i.fieldsUsed)),new p({executor:i})};export{p as FormExpressionArcadeExecutor,d as createFormExpressionArcadeExecutor};
5
+ import{__decorate as t}from"tslib";import{createArcadeProfile as e,createArcadeExecutor as r}from"../../../../arcade.js";import o from"../../../../core/Accessor.js";import{debounce as s}from"../../../../core/promiseUtils.js";import{property as i,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as a}from"../../../../core/support/UpdatingHandles.js";import{fixFields as n}from"../../../../layers/support/fieldUtils.js";var u;const c=Symbol("FormExpressionArcadeExecutor");let p=class extends o{static{u=c}constructor(t){super(t),this[u]=!0,this._lastEvaluatedValue=null,this._abortController=new AbortController,this._initialExecutionComplete=!1,this._stale=!1,this._updatingTracking=new a,this._executeAsyncDebounced=s(async(t,e,r)=>{const o=await this.executor.executeAsync(t,{...e,abortSignal:r});return r.aborted?this._lastEvaluatedValue:(this._lastEvaluatedValue=o,this._initialExecutionComplete=!0,this._stale=!1,o)})}get initialExecutionComplete(){return this._initialExecutionComplete}get isAsync(){return this.executor.isAsync}get fieldsUsed(){return this.executor.fieldsUsed}get syntaxTree(){return this.executor.syntaxTree}get updating(){return this._updatingTracking.updating}get stale(){return this._stale}get geometryUsed(){return this.executor.geometryUsed}get variablesUsed(){return this.executor.variablesUsed}get lastEvaluatedValue(){return this._lastEvaluatedValue}abort(){this._abortController.abort()}execute(t,e){this._abortController=new AbortController;const r=this.executor.execute(t,{...e,abortSignal:this._abortController.signal});return this._lastEvaluatedValue=r,this._initialExecutionComplete=!0,r}async executeAsync(t,e){return this._abortController=new AbortController,this._updatingTracking.addPromise(this._executeAsyncDebounced(t,e??{},this._abortController.signal))}markStale(){this._stale=!0}reset(){this.abort(),this._lastEvaluatedValue=null,this._stale=!1}};t([i()],p.prototype,"_lastEvaluatedValue",void 0),t([i()],p.prototype,"_initialExecutionComplete",void 0),t([i()],p.prototype,"_stale",void 0),t([i()],p.prototype,"_updatingTracking",void 0),t([i({constructOnly:!0})],p.prototype,"executor",void 0),t([i()],p.prototype,"initialExecutionComplete",null),t([i()],p.prototype,"isAsync",null),t([i()],p.prototype,"fieldsUsed",null),t([i()],p.prototype,"syntaxTree",null),t([i()],p.prototype,"updating",null),t([i()],p.prototype,"stale",null),t([i()],p.prototype,"geometryUsed",null),t([i()],p.prototype,"variablesUsed",null),t([i()],p.prototype,"lastEvaluatedValue",null),p=t([l("esri.widgets.support.forms.expressions.FormExpressionArcadeExecutor")],p);const d=async(t,o)=>{const s=e("form-calculation"),i=await r(t,s,{});return o?.fieldsIndex&&(i.fieldsUsed=n(o.fieldsIndex,i.fieldsUsed)),new p({executor:i})};export{p as FormExpressionArcadeExecutor,d as createFormExpressionArcadeExecutor};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{makeHandle as e}from"../../core/handleUtils.js";import{widgetSymbol as t,widgetTestDataSymbol as r}from"./symbols.js";const o=[],n={},i=new WeakMap;function d(e,t){let r=t.children;if(r?.length)for(let o=0;o<r.length;++o)r[o]=d(e,r[o]);else r=o;const i=t.vnodeSelector;if(f(i)){const o=t.properties||n,d=o.key||i,f={key:d,afterCreate:c,afterUpdate:s,afterRemoved:a,parentWidget:e,widgetConstructor:i,widgetProperties:{...o,key:d,children:r}};return{vnodeSelector:i.vnodeSelector,properties:f,children:void 0,text:void 0,domNode:null}}return t}function c(t,o,n,{parentWidget:d,widgetConstructor:c,widgetProperties:s}){const f=new c(s);f.container=t,i.set(t,f),f.afterCreate?.(f,t),d.addHandles(e(()=>a(t))),queueMicrotask(()=>{f[r].projector?.renderNow()})}function s(e,t,r,{widgetProperties:o}){const n=i.get(e);n&&(n.set(o),n.afterUpdate?.(n,e))}function a(e){const t=i.get(e);t&&(t.afterRemoved?.(t,e),t.destroy(),i.delete(e))}function f(e){return"function"==typeof e&&e[t]}export{f as isWidgetConstructor,d as processWidgets};
5
+ import{makeHandle as e}from"../../core/handleUtils.js";import{widgetSymbol as t,widgetTestDataSymbol as r}from"./symbols.js";const o=[],n={},i=new Map;function d(e,t){let r=t.children;if(r?.length)for(let o=0;o<r.length;++o)r[o]=d(e,r[o]);else r=o;const i=t.vnodeSelector;if(f(i)){const o=t.properties||n,d=o.key||i,f={key:d,afterCreate:c,afterUpdate:s,afterRemoved:a,parentWidget:e,widgetConstructor:i,widgetProperties:{...o,key:d,children:r}};return{vnodeSelector:i.vnodeSelector,properties:f,children:void 0,text:void 0,domNode:null}}return t}function c(t,o,n,{parentWidget:d,widgetConstructor:c,widgetProperties:s}){const f=new c(s);f.container=t,i.set(t,f),f.afterCreate?.(f,t),d.addHandles(e(()=>a(t))),queueMicrotask(()=>{f[r].projector?.renderNow()})}function s(e,t,r,{widgetProperties:o}){const n=i.get(e);n&&(n.set(o),n.afterUpdate?.(n,e))}function a(e){const t=i.get(e);t&&(t.afterRemoved?.(t,e),t.destroy(),i.delete(e))}function f(e){return"function"==typeof e&&e[t]}export{f as isWidgetConstructor,d as processWidgets,i as widgetMap};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{isWidgetConstructor as e}from"./jsxWidgetSupport.js";import{classes as o,isRTL as t,isActivationKey as r,cssTransition as n,storeNode as i}from"./widgetUtils.js";import{accessibleHandler as s}from"./decorators/accessibleHandler.js";import{messageBundle as d}from"./decorators/messageBundle.js";import{vmEvent as c}from"./decorators/vmEvent.js";var u=function(e){return{vnodeSelector:"",properties:void 0,children:void 0,text:e.toString(),domNode:null}},a=function(e,o){for(var t=0,r=e.length;t<r;t++){var n=e[t];Array.isArray(n)?a(n,o):null!=n&&!1!==n&&(n.hasOwnProperty("vnodeSelector")||(n=u(n)),o.push(n))}},l=function(e,o){for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];if(1===t.length&&"string"==typeof t[0])return{vnodeSelector:e,properties:o||void 0,children:void 0,text:t[0],domNode:null};var n=[];return a(t,n),{vnodeSelector:e,properties:o||void 0,children:n,text:void 0,domNode:null}};const f=s,p=o,v=d,m=c,y=t,g=n,h=r,j=i;function x(o,t,...r){return"function"!=typeof o||e(o)?l(o,t??null,...r):o(t,...r)}function S(...e){return e}function N(e){return e&&"function"==typeof e.render}function b(e){return e&&"function"==typeof e.postMixInProperties&&"function"==typeof e.buildRendering&&"function"==typeof e.postCreate&&"function"==typeof e.startup}export{f as accessibleHandler,p as classes,g as cssTransition,b as hasDomNode,h as isActivationKey,y as isRTL,N as isWidget,v as messageBundle,j as storeNode,x as tsx,S as tsxFragment,m as vmEvent};
5
+ import{isActivationKey as e}from"../../core/keyboard.js";import{isWidgetConstructor as o}from"./jsxWidgetSupport.js";import{classes as r,isRTL as t,cssTransition as n,storeNode as i}from"./widgetUtils.js";import{accessibleHandler as s}from"./decorators/accessibleHandler.js";import{messageBundle as d}from"./decorators/messageBundle.js";import{vmEvent as c}from"./decorators/vmEvent.js";var a=function(e){return{vnodeSelector:"",properties:void 0,children:void 0,text:e.toString(),domNode:null}},u=function(e,o){for(var r=0,t=e.length;r<t;r++){var n=e[r];Array.isArray(n)?u(n,o):null!=n&&!1!==n&&(n.hasOwnProperty("vnodeSelector")||(n=a(n)),o.push(n))}},f=function(e,o){for(var r=[],t=2;t<arguments.length;t++)r[t-2]=arguments[t];if(1===r.length&&"string"==typeof r[0])return{vnodeSelector:e,properties:o||void 0,children:void 0,text:r[0],domNode:null};var n=[];return u(r,n),{vnodeSelector:e,properties:o||void 0,children:n,text:void 0,domNode:null}};const l=s,p=r,v=d,m=c,y=t,g=n,h=e,j=i;function x(e,r,...t){return"function"!=typeof e||o(e)?f(e,r??null,...t):e(r,...t)}function S(...e){return e}function b(e){return e&&"function"==typeof e.render}function N(e){return e&&"function"==typeof e.postMixInProperties&&"function"==typeof e.buildRendering&&"function"==typeof e.postCreate&&"function"==typeof e.startup}export{l as accessibleHandler,p as classes,g as cssTransition,N as hasDomNode,h as isActivationKey,y as isRTL,b as isWidget,v as messageBundle,j as storeNode,x as tsx,S as tsxFragment,m as vmEvent};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../core/ArrayPool.js";import{handlesGroup as t,makeHandle as n}from"../../core/handleUtils.js";import"../../core/has.js";import"../../core/Logger.js";import{signalFromSignalOrOptions as o}from"../../core/promiseUtils.js";import{watch as r,syncAndInitial as i}from"../../core/reactiveUtils.js";import{waitAnimationFrame as s}from"../../core/scheduling.js";import{clearVNodeCache as c}from"./vnodeCache.js";var a,u,f=function(e){if("WebkitTransition"in e.style)a="webkitTransitionEnd",u="webkitAnimationEnd";else{if(!("transition"in e.style))throw new Error("Your browser is not supported!");a="transitionend",u="animationend"}},d=function(e){a||f(e)},l=function(e,t){return void 0===t&&(t=e+"-active"),function(n){d(n);var o=!1,r=function(i){o||(o=!0,n.removeEventListener(a,r),n.removeEventListener(u,r),n.classList.remove(e),n.classList.remove(t))};n.classList.add(e),n.addEventListener(a,r),n.addEventListener(u,r),requestAnimationFrame(function(){n.classList.add(t)})}},m=function(e,t){return void 0===t&&(t=e+"-active"),function(n,o){d(n);var r=!1,i=function(e){r||(r=!0,n.removeEventListener(a,i),n.removeEventListener(u,i),o())};n.classList.add(e),n.addEventListener(a,i),n.addEventListener(u,i),requestAnimationFrame(function(){n.classList.add(t)})}};function v(...t){const n=e.acquire();for(let e=0;e<t.length;e++){const o=t[e],r=typeof o;if("string"===r)n.push(o);else if(Array.isArray(o))n.push.apply(n,o);else if("object"===r)for(const e in o)o[e]&&n.push(e)}const o=n.join(" ");return e.release(n),o}const p=(()=>{const e=new Map,o=new ResizeObserver(t=>{c();for(const n of t)e.get(n.target)?.(n)}),s=(t,r,i)=>(e.set(t,r),o.observe(t,i),n(()=>{o.unobserve(t),e.delete(t)}));return(e,o,c)=>{let a=null;return t([r(()=>"function"==typeof e?e():e,e=>{a?.remove(),e&&(a=s(e,o,c))},i),n(()=>a?.remove())])}})();function L(e){const t=e?.closest("[dir]");return null!==t&&t instanceof HTMLElement&&"rtl"===t.dir||"rtl"===document.dir}function E(e,t){return("enter"===e?l:m)(t)}function h(e){const t="data-node-ref";this[e.getAttribute(t)]=null}function y(e){const t="data-node-ref";this[e.getAttribute(t)]=e}function b(e){return"Enter"===e||" "===e}async function j(e,t){await s(o(t));const n="function"==typeof e?e():e;n&&("setFocus"in n&&"function"==typeof n.setFocus?await n.setFocus():n instanceof HTMLElement&&n.focus())}export{v as classes,E as cssTransition,h as discardNode,b as isActivationKey,L as isRTL,p as onResize,j as setFocus,y as storeNode};
5
+ import e from"../../core/ArrayPool.js";import{handlesGroup as t,makeHandle as n}from"../../core/handleUtils.js";import"../../core/has.js";import"../../core/Logger.js";import{signalFromSignalOrOptions as o}from"../../core/promiseUtils.js";import{watch as r,syncAndInitial as i}from"../../core/reactiveUtils.js";import{waitAnimationFrame as s}from"../../core/scheduling.js";import{clearVNodeCache as c}from"./vnodeCache.js";var a,u,f=function(e){if("WebkitTransition"in e.style)a="webkitTransitionEnd",u="webkitAnimationEnd";else{if(!("transition"in e.style))throw new Error("Your browser is not supported!");a="transitionend",u="animationend"}},d=function(e){a||f(e)},l=function(e,t){return void 0===t&&(t=e+"-active"),function(n){d(n);var o=!1,r=function(i){o||(o=!0,n.removeEventListener(a,r),n.removeEventListener(u,r),n.classList.remove(e),n.classList.remove(t))};n.classList.add(e),n.addEventListener(a,r),n.addEventListener(u,r),requestAnimationFrame(function(){n.classList.add(t)})}},m=function(e,t){return void 0===t&&(t=e+"-active"),function(n,o){d(n);var r=!1,i=function(e){r||(r=!0,n.removeEventListener(a,i),n.removeEventListener(u,i),o())};n.classList.add(e),n.addEventListener(a,i),n.addEventListener(u,i),requestAnimationFrame(function(){n.classList.add(t)})}};function v(...t){const n=e.acquire();for(let e=0;e<t.length;e++){const o=t[e],r=typeof o;if("string"===r)n.push(o);else if(Array.isArray(o))n.push.apply(n,o);else if("object"===r)for(const e in o)o[e]&&n.push(e)}const o=n.join(" ");return e.release(n),o}const p=(()=>{const e=new Map,o=new ResizeObserver(t=>{c();for(const n of t)e.get(n.target)?.(n)}),s=(t,r,i)=>(e.set(t,r),o.observe(t,i),n(()=>{o.unobserve(t),e.delete(t)}));return(e,o,c)=>{let a=null;return t([r(()=>"function"==typeof e?e():e,e=>{a?.remove(),e&&(a=s(e,o,c))},i),n(()=>a?.remove())])}})();function L(e){const t=e?.closest("[dir]");return null!==t&&t instanceof HTMLElement&&"rtl"===t.dir||"rtl"===document.dir}function E(e,t){return("enter"===e?l:m)(t)}function h(e){const t="data-node-ref";this[e.getAttribute(t)]=null}function y(e){const t="data-node-ref";this[e.getAttribute(t)]=e}async function b(e,t){await s(o(t));const n="function"==typeof e?e():e;n&&("setFocus"in n&&"function"==typeof n.setFocus?await n.setFocus():n instanceof HTMLElement&&n.focus())}export{v as classes,E as cssTransition,h as discardNode,L as isRTL,p as onResize,b as setFocus,y as storeNode};