@arcgis/core 4.33.0-next.20250502 → 4.33.0-next.20250504

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 (69) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{0219c3f9408d3fa3c9a0.js → 03ee9d0407c230b885ed.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{84f972d7851d982701a0.js → 1ca7e0d519ecbfe6976f.js} +1 -1
  4. package/assets/esri/core/workers/chunks/3fb25912b274f264c84e.js +1 -0
  5. package/assets/esri/core/workers/chunks/{9652cfd4668b95036c87.js → 532088a72c3ddc50f3be.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{653ff3e631fea8ad393a.js → a0db1f3ca29e34dfa16f.js} +12 -12
  7. package/assets/esri/core/workers/chunks/{581180668e0229dcdc14.js → bf190d672dcbaedc1a41.js} +1 -1
  8. package/assets/esri/geometry/support/pe-wasm.wasm +0 -0
  9. package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +14 -1
  10. package/assets/esri/themes/base/widgets/_SelectionList.scss +34 -0
  11. package/assets/esri/themes/base/widgets/_SelectionToolbar.scss +6 -0
  12. package/assets/esri/themes/dark/main.css +1 -1
  13. package/assets/esri/themes/light/main.css +1 -1
  14. package/assets/esri/themes/light/view.css +1 -1
  15. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer.json +1 -1
  16. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_en.json +1 -1
  17. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList.json +1 -1
  18. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_en.json +1 -1
  19. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar.json +1 -1
  20. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_en.json +1 -1
  21. package/chunks/pe-wasm.js +1 -1
  22. package/chunks/pe.js +1 -1
  23. package/geometry/coordinateFormatter.js +1 -1
  24. package/geometry/support/WKIDUnitConversion.js +1 -1
  25. package/package.json +1 -1
  26. package/support/revision.js +1 -1
  27. package/views/3d/interactive/Manipulator3D.js +1 -1
  28. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  29. package/views/3d/layers/DrapedSubView3D.js +1 -1
  30. package/views/3d/layers/I3SMeshView3D.js +1 -1
  31. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  32. package/views/3d/layers/MediaLayerView3D.js +1 -1
  33. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  34. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  35. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  36. package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
  37. package/views/3d/layers/graphics/pipeline/rendering/LodRenderer.js +1 -1
  38. package/views/3d/support/StreamTextureCollection.js +1 -1
  39. package/views/3d/support/TextureCollection.js +1 -1
  40. package/views/3d/webgl-engine/Stage.js +1 -1
  41. package/views/3d/webgl-engine/lib/ModelDirtySet.js +1 -1
  42. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  43. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  44. package/views/3d/webgl-engine/lib/TextureRepository.js +1 -1
  45. package/views/3d/webgl-engine/lib/WebGLLayer.js +1 -1
  46. package/views/3d/webgl-engine/parts/Model.js +1 -1
  47. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  48. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  49. package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
  50. package/widgets/OrientedImageryViewer/adapters/sketch/TriangulatedMeasurementAdapter.js +5 -0
  51. package/widgets/OrientedImageryViewer/components/ImageMeasurementWidget.js +1 -1
  52. package/widgets/OrientedImageryViewer/css.js +1 -1
  53. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  54. package/widgets/OrientedImageryViewer/mixins/SketchHandlerMixin.js +1 -1
  55. package/widgets/OrientedImageryViewer/mixins/TriangulatedImageMeasurementMixin.js +5 -0
  56. package/widgets/OrientedImageryViewer/mixins/TriangulatedSketchHandlerMixin.js +5 -0
  57. package/widgets/OrientedImageryViewer.js +1 -1
  58. package/widgets/Sketch.js +1 -1
  59. package/widgets/support/SelectionList/LayerItem.js +1 -1
  60. package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
  61. package/widgets/support/SelectionList/VisibleElements.js +1 -1
  62. package/widgets/support/SelectionList.js +1 -1
  63. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
  64. package/widgets/support/SelectionToolbar/VisibleElements.js +5 -0
  65. package/widgets/support/SelectionToolbar.js +1 -1
  66. package/widgets/support/Selector2D/SelectionOperation.js +1 -1
  67. package/assets/esri/core/workers/chunks/e3ef0451dcdc2e966628.js +0 -1
  68. package/views/3d/webgl-engine/lib/ContentObject.js +0 -5
  69. package/views/3d/webgl-engine/lib/ContentObjectType.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import{createTask as t}from"../../../../core/asyncUtils.js";import a from"../../../../core/Promise.js";import{throwIfAborted as s}from"../../../../core/promiseUtils.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{load as o}from"../../../../geometry/projection.js";import{convertSphereVertexToPixelLocation as n}from"../../../../layers/orientedImagery/transformations/utils.js";import{SketchHandlerMixin as c}from"../../mixins/SketchHandlerMixin.js";let l=[],u=[],h=0,m=class extends(c(a)){constructor(e){super(e),this.type="measurement",this.measurementArray=[],this.pixelMeasurement=0,this.pixelAreaMeasurement=0,this.polygonVertices=[],this._calculationTask=null,this._distanceCalculation=0,this._areaCalculation=null}initialize(){this.addResolvingPromise(o())}async handleCreate(e){const t=e.toolEventInfo;switch(e.tool){case"polyline":this.handlePolylineEvents(e,t);break;case"polygon":this.handlePolygonEvents(e,t)}}handleDelete(e){this.resetDistanceMeasurements(),this.resetAreaMeasurements()}handleDestroy(){this.resetDistanceMeasurements(),this.resetAreaMeasurements()}cursorUpdatePolylineHandler(e){const{mode:t,activeViewer:a}=this.viewModel;if("none"===t||!a?.imageSize)return;if("default"===t)this.measurementArray.push(e.coordinates);else{const t={x:e.coordinates[0],y:e.coordinates[1],z:e.coordinates[2]},s=n(t,a.imageSize[0],a.imageSize[1]);this.measurementArray.push([s.x,s.y])}const s=u.reduce(((e,t)=>e+t),0)+this.pixelMeasurement;this.viewModel.distanceMeasurementResult=s}async cursorUpdatePolygonHandler(e){const{mode:t,activeViewer:a}=this.viewModel;if("none"===t||!a?.imageSize)return;const s=e.coordinates;if(l=[...this.polygonVertices],"default"===t)l.push(s);else{const e={x:s[0],y:s[1],z:s[2]},t=n(e,a?.imageSize[0],a?.imageSize[1]);l.push([t.x,t.y])}if(l.length<3||!this.viewModel.currentBestFeature||!this.viewModel.activeViewer?.imageSize)return;const i=l[0];l=l.filter(((e,t)=>0===t||t===l.length-1||JSON.stringify(e)!==JSON.stringify(i)));const r=await this._getAreaFromTask(l);r?.area&&r?.perimeter&&(h=r.area)}async handlePolylineEvents(e,t){const a=!this.viewModel.accuracyParametersMissing;if("cancel"===e.state)return this.resetDistanceMeasurements(),this.viewModel.distanceMeasurementResult=0,this.viewModel.distanceAccuracyArray=[],void(this.viewModel.displayNewMeasurementButton=!0);if("complete"===e.state&&e.graphic)return this.viewModel.activeViewer?.addGraphic(e.graphic),this.viewModel.measurementGraphic=e.graphic,void this.resetDistanceMeasurements();switch(t?.type){case"cursor-update":this.cursorUpdatePolylineHandler(t);break;case"vertex-add":if(this.measurementArray.length&&a){const e=await this._getAccuracyFromTask();e&&this.viewModel.distanceAccuracyArray.push(e)}this.vertexUpdatePolylineHandler()}const s=await this._getDistanceFromTask();this.pixelMeasurement=s??this.pixelMeasurement}async handlePolygonEvents(e,t){const a=!this.viewModel.accuracyParametersMissing;if("cancel"===e.state)return this.resetAreaMeasurements(),this.viewModel.areaMeasurementResult=0,this.viewModel.areaMeasurementAccuracy=0,void(this.viewModel.displayNewMeasurementButton=!0);if("complete"===e.state&&e.graphic){if(this.viewModel.activeViewer?.addGraphic(e.graphic),a){const e=await this._getAreaAccuracyFromTask(this.polygonVertices);this.viewModel.areaMeasurementAccuracy=e&&e>this.viewModel.areaMeasurementAccuracy?e:this.viewModel.areaMeasurementAccuracy}return this.viewModel.measurementGraphic=e.graphic,void this.resetAreaMeasurements()}switch(t?.type){case"vertex-add":await this.vertexAddPolygonHandler(t);break;case"cursor-update":await this.cursorUpdatePolygonHandler(t)}this.viewModel.areaMeasurementResult=h>0?h:this.pixelAreaMeasurement}async vertexAddPolygonHandler(e){const{mode:t,activeViewer:a}=this.viewModel,s=e.added,i=s[s.length-1];if(!Array.isArray(i)||"none"===t||!a?.imageSize)return;if("default"===t)this.polygonVertices.push(i);else{const e={x:i[0],y:i[1],z:i[2]},t=n(e,a?.imageSize[0],a?.imageSize[1]);this.polygonVertices.push([t.x,t.y])}if(this.polygonVertices.length<3||!this.viewModel.currentBestFeature||!this.viewModel.activeViewer?.imageSize)return;const r=this.polygonVertices[0];this.polygonVertices=this.polygonVertices.filter(((e,t)=>0===t||t===this.polygonVertices.length-1||JSON.stringify(e)!==JSON.stringify(r)));const o=await this._getAreaFromTask(this.polygonVertices);if(!o?.area||!o?.perimeter)return;const{area:c}=o;this.pixelAreaMeasurement=c}vertexUpdatePolylineHandler(){this.measurementArray=this.measurementArray.slice(-1);const e=u.reduce(((e,t)=>e+t),0)+this.pixelMeasurement;this.viewModel.distanceMeasurementResult=e,this.pixelMeasurement>0&&u.push(this.pixelMeasurement)}resetDistanceMeasurements(){this.measurementArray=[],this.pixelMeasurement=0,u=[]}resetAreaMeasurements(){this.polygonVertices=[],this.pixelAreaMeasurement=0,h=0}async _getAreaFromTask(e){const{mode:a}=this.viewModel;return this._calculationTask?.abort(),this._calculationTask=t((async t=>{this._areaCalculation=null;const i=await this.viewModel.calculateAreaMeasurement(e,a,t);s(t),this._areaCalculation=i})),await this._calculationTask.promise,this._areaCalculation}async _getDistanceFromTask(){const{mode:e}=this.viewModel;return this._calculationTask?.abort(),this._calculationTask=t((async t=>{this._distanceCalculation=0;const a=await this.viewModel.calculateDistanceMeasurement(this.measurementArray,e,t);s(t),this._distanceCalculation=a})),await this._calculationTask.promise,this._distanceCalculation}async _getAccuracyFromTask(){const{mode:e}=this.viewModel;return"none"===e?null:(this._calculationTask?.abort(),this._calculationTask=t((async t=>{this._distanceCalculation=0;const a="default"===e?await this.viewModel.calculateAccuracy(this.measurementArray,"distance",t):await this.viewModel.calculateAccuracyPanoramic(this.measurementArray,"distance",t);s(t),this._distanceCalculation=a})),await this._calculationTask.promise,this._distanceCalculation)}async _getAreaAccuracyFromTask(e){const{mode:a}=this.viewModel;return"none"===a?null:(this._calculationTask?.abort(),this._calculationTask=t((async t=>{this._distanceCalculation=0;const i="default"===a?await this.viewModel.calculateAccuracy(e,"area",t):await this.viewModel.calculateAccuracyPanoramic(e,"area",t);s(t),this._distanceCalculation=i})),await this._calculationTask.promise,this._distanceCalculation)}};e([i()],m.prototype,"type",void 0),e([i()],m.prototype,"measurementArray",void 0),e([i()],m.prototype,"pixelMeasurement",void 0),e([i()],m.prototype,"pixelAreaMeasurement",void 0),e([i()],m.prototype,"polygonVertices",void 0),m=e([r("esri.widgets.OrientedImageryViewer.adapters.sketch.MeasurementAdapter")],m);const d=m;export{d as default};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../Graphic.js";import{createTask as a}from"../../../../core/asyncUtils.js";import s from"../../../../core/Promise.js";import{throwIfAborted as i}from"../../../../core/promiseUtils.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import n from"../../../../geometry/Polygon.js";import c from"../../../../geometry/Polyline.js";import{load as l}from"../../../../geometry/projection.js";import{imageToWorld as m}from"../../../../layers/orientedImagery/transformations/imageToWorld.js";import{convertSphereVertexToPixelLocation as u}from"../../../../layers/orientedImagery/transformations/utils.js";import{worldToImage as h}from"../../../../layers/orientedImagery/transformations/worldToImage.js";import{formatPixels as d}from"../../imageMeasurementUtils.js";import{SketchHandlerMixin as p}from"../../mixins/SketchHandlerMixin.js";let y=[],M=[],g=0,w=class extends(p(s)){constructor(e){super(e),this.type="measurement",this.measurementArray=[],this.pixelMeasurement=0,this.pixelAreaMeasurement=0,this.polygonVertices=[],this._calculationTask=null,this._distanceCalculation=0,this._areaCalculation=null}initialize(){this.addResolvingPromise(l())}async handleCreate(e){const t=e.toolEventInfo;switch(e.tool){case"polyline":this.handlePolylineEvents(e,t);break;case"polygon":this.handlePolygonEvents(e,t)}}handleDelete(e){this.resetDistanceMeasurements(),this.resetAreaMeasurements()}handleDestroy(){this.resetDistanceMeasurements(),this.resetAreaMeasurements()}cursorUpdatePolylineHandler(e){const{mode:t,activeViewer:a}=this.viewModel;if("none"===t||!a?.imageSize)return;if("default"===t)this.measurementArray.push(e.coordinates);else{const t={x:e.coordinates[0],y:e.coordinates[1],z:e.coordinates[2]},s=u(t,a.imageSize[0],a.imageSize[1]);this.measurementArray.push([s.x,s.y])}const s=M.reduce(((e,t)=>e+t),0)+this.pixelMeasurement;this.viewModel.distanceMeasurementResult=s}async cursorUpdatePolygonHandler(e){const{mode:t,activeViewer:a}=this.viewModel;if("none"===t||!a?.imageSize)return;const s=e.coordinates;if(y=[...this.polygonVertices],"default"===t)y.push(s);else{const e={x:s[0],y:s[1],z:s[2]},t=u(e,a?.imageSize[0],a?.imageSize[1]);y.push([t.x,t.y])}if(y.length<3||!this.viewModel.currentBestFeature||!this.viewModel.activeViewer?.imageSize)return;const i=y[0];y=y.filter(((e,t)=>0===t||t===y.length-1||JSON.stringify(e)!==JSON.stringify(i)));const r=await this._getAreaFromTask(y);r?.area&&r?.perimeter&&(g=r.area)}async handlePolylineEvents(e,t){const a=!this.viewModel.accuracyParametersMissing;if("cancel"===e.state)return this.resetDistanceMeasurements(),this.viewModel.distanceMeasurementResult=0,this.viewModel.distanceAccuracyArray=[],void(this.viewModel.displayNewMeasurementButton=!0);if("complete"===e.state&&e.graphic){if(this.viewModel.activeViewer?.addGraphic(e.graphic),this.viewModel.triangularMeasurementActive){const t=e.graphic.geometry;await this.viewModel.processMeasurementVectors(t.paths[0]),await this._overlayFirstMeasurement(e.graphic,e.tool)}return this.viewModel.measurementGraphic=e.graphic,void this.resetDistanceMeasurements()}switch(t?.type){case"cursor-update":this.cursorUpdatePolylineHandler(t);break;case"vertex-add":if(this.measurementArray.length&&a){const e=await this._getAccuracyFromTask();e&&this.viewModel.distanceAccuracyArray.push(e)}this.vertexUpdatePolylineHandler()}const s=await this._getDistanceFromTask();this.pixelMeasurement=s??this.pixelMeasurement}async handlePolygonEvents(e,t){const a=!this.viewModel.accuracyParametersMissing;if("cancel"===e.state)return this.resetAreaMeasurements(),this.viewModel.areaMeasurementResult=0,this.viewModel.areaMeasurementAccuracy=0,void(this.viewModel.displayNewMeasurementButton=!0);if("complete"===e.state&&e.graphic){if(this.viewModel.activeViewer?.addGraphic(e.graphic),a){const e=await this._getAreaAccuracyFromTask(this.polygonVertices);this.viewModel.areaMeasurementAccuracy=e&&e>this.viewModel.areaMeasurementAccuracy?e:this.viewModel.areaMeasurementAccuracy}if(this.viewModel.triangularMeasurementActive){const t=e.graphic.geometry;await this.viewModel.processMeasurementVectors(t.rings[0]),await this._overlayFirstMeasurement(e.graphic,e.tool)}return this.viewModel.measurementGraphic=e.graphic,void this.resetAreaMeasurements()}switch(t?.type){case"vertex-add":await this.vertexAddPolygonHandler(t);break;case"cursor-update":await this.cursorUpdatePolygonHandler(t)}this.viewModel.areaMeasurementResult=g>0?g:this.pixelAreaMeasurement}async vertexAddPolygonHandler(e){const{mode:t,activeViewer:a}=this.viewModel,s=e.added,i=s[s.length-1];if(!Array.isArray(i)||"none"===t||!a?.imageSize)return;if("default"===t)this.polygonVertices.push(i);else{const e={x:i[0],y:i[1],z:i[2]},t=u(e,a?.imageSize[0],a?.imageSize[1]);this.polygonVertices.push([t.x,t.y])}if(this.polygonVertices.length<3||!this.viewModel.currentBestFeature||!this.viewModel.activeViewer?.imageSize)return;const r=this.polygonVertices[0];this.polygonVertices=this.polygonVertices.filter(((e,t)=>0===t||t===this.polygonVertices.length-1||JSON.stringify(e)!==JSON.stringify(r)));const o=await this._getAreaFromTask(this.polygonVertices);if(!o?.area||!o?.perimeter)return;const{area:n}=o;this.pixelAreaMeasurement=n}vertexUpdatePolylineHandler(){this.measurementArray=this.measurementArray.slice(-1);const e=M.reduce(((e,t)=>e+t),0)+this.pixelMeasurement;this.viewModel.distanceMeasurementResult=e,this.pixelMeasurement>0&&M.push(this.pixelMeasurement)}resetDistanceMeasurements(){this.measurementArray=[],this.pixelMeasurement=0,M=[]}resetAreaMeasurements(){this.polygonVertices=[],this.pixelAreaMeasurement=0,g=0}async _overlayFirstMeasurement(e,t){switch(t){case"polyline":this._overlayFirstDistanceMeasurement(e);break;case"polygon":this._overlayFirstAreaGeometry(e)}}async _overlayFirstDistanceMeasurement(e){const a=e.geometry?.clone(),s=e.symbol?.clone(),i=[...a.paths[0]],r=d(i,!0),o=await this.viewModel.getMeasurementProperties(),n=await this.viewModel.getMeasurementProperties(this.viewModel.currentBestFeatureMeasurementImage,this.viewModel.imageMeasurementViewer);if(r?.length&&o&&n){const{updateElevationProps:e,...a}=o,{updateElevationProps:i,...l}=n,u=await m(r,a,e),d=h(u,l).map((e=>[e.x-.5,-.5-e.y])),p=new c({paths:[d],spatialReference:this.viewModel.imageMeasurementViewer.imageRenderer.spatialReference}),y=new t({geometry:p,symbol:s});this.viewModel.editOverlayedGraphics(y)}}async _overlayFirstAreaGeometry(e){const a=e.geometry?.clone(),s=e.symbol?.clone(),i=[...a.rings[0]],r=d(i,!0),o=await this.viewModel.getMeasurementProperties(),c=await this.viewModel.getMeasurementProperties(this.viewModel.currentBestFeatureMeasurementImage,this.viewModel.imageMeasurementViewer);if(r?.length&&o&&c){const{updateElevationProps:e,...a}=o,{updateElevationProps:i,...l}=c,u=await m(r,a,e),d=h(u,l).map((e=>[e.x-.5,-.5-e.y])),p=new n({rings:[d],spatialReference:this.viewModel.imageMeasurementViewer.imageRenderer.spatialReference}),y=new t({geometry:p,symbol:s});this.viewModel.editOverlayedGraphics(y)}}async _getAreaFromTask(e){const{mode:t}=this.viewModel;return this._calculationTask?.abort(),this._calculationTask=a((async a=>{this._areaCalculation=null;const s=await this.viewModel.calculateAreaMeasurement(e,t,a);i(a),this._areaCalculation=s})),await this._calculationTask.promise,this._areaCalculation}async _getDistanceFromTask(){const{mode:e}=this.viewModel;return this._calculationTask?.abort(),this._calculationTask=a((async t=>{this._distanceCalculation=0;const a=await this.viewModel.calculateDistanceMeasurement(this.measurementArray,e,t);i(t),this._distanceCalculation=a})),await this._calculationTask.promise,this._distanceCalculation}async _getAccuracyFromTask(){const{mode:e}=this.viewModel;return"none"===e?null:(this._calculationTask?.abort(),this._calculationTask=a((async t=>{this._distanceCalculation=0;const a="default"===e?await this.viewModel.calculateAccuracy(this.measurementArray,"distance",t):await this.viewModel.calculateAccuracyPanoramic(this.measurementArray,"distance",t);i(t),this._distanceCalculation=a})),await this._calculationTask.promise,this._distanceCalculation)}async _getAreaAccuracyFromTask(e){const{mode:t}=this.viewModel;return"none"===t?null:(this._calculationTask?.abort(),this._calculationTask=a((async a=>{this._distanceCalculation=0;const s="default"===t?await this.viewModel.calculateAccuracy(e,"area",a):await this.viewModel.calculateAccuracyPanoramic(e,"area",a);i(a),this._distanceCalculation=s})),await this._calculationTask.promise,this._distanceCalculation)}};e([r()],w.prototype,"type",void 0),e([r()],w.prototype,"measurementArray",void 0),e([r()],w.prototype,"pixelMeasurement",void 0),e([r()],w.prototype,"pixelAreaMeasurement",void 0),e([r()],w.prototype,"polygonVertices",void 0),w=e([o("esri.widgets.OrientedImageryViewer.adapters.sketch.MeasurementAdapter")],w);const v=w;export{v as default};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Promise.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{projectWithZConversion as s}from"../../../../geometry/projection.js";import{computeTriangulatedVector as i,computeTriangulatedAreaMeasurement as c,computeTriangulatedDistanceMeasurement as o}from"../../imageMeasurementUtils.js";import{TriangulatedSketchHandlerMixin as n}from"../../mixins/TriangulatedSketchHandlerMixin.js";let u=[],m=class extends(n(t)){constructor(e){super(e),this.type="measurement"}async handleUpdate(e){const{measureType:t,updatingTriangularMeasurementState:a}=this.viewModel;if("distance"===t){const t=e.graphics[0].geometry;u=t.paths[0]}else if("area"===t){const t=e.graphics[0].geometry;u=t.rings[0]}"complete"===e.state&&(this.viewModel.triangulatedMeasurementGraphic=e.graphics.at(-1),a?this._updateTriangularMeasurements(u):await this.viewModel.processMeasurementVectors(u))}async _computeMeasurementVector(e,t){const{activeViewer:a,mode:r,view:c}=this.viewModel,o=a?.imageSize;if(!e||!t||!o)return;const n=e.map((e=>[e[0]-.5,-.5-e[1]])),u=c?.spatialReference,m=[];for(let i=0;i<n.length;i++){const e={x:n[i][0],y:n[i][1]};let a=await this.viewModel.getMapPoint(e,{feature:t,imageSize:o,mode:r});u&&!a.spatialReference.equals(u)&&(a=await s(a,u)),m.push(a)}return i(m,t)}async _updateTriangularMeasurements(e){const{measureType:t,triangularMeasurementActive:a,currentBestFeatureMeasurementImage:r,updatingTriangularMeasurementState:s}=this.viewModel;if(!a||!r||!s||2!==this.viewModel.measurementVectors?.length)return;this.viewModel.measurementVectors.splice(-1);const i=await this._computeMeasurementVector(e,r);if(i&&this.viewModel.measurementVectors.push(i),2===this.viewModel.measurementVectors.length){switch(t){case"distance":{this.viewModel.triangulatedDistanceMeasurement=await o(this.viewModel.measurementVectors);const t=await this.viewModel.calculateAccuracy(e,"distance");if(t&&this.viewModel.triangulatedDistanceMeasurement?.distance){const e=Math.atan(t/this.viewModel.triangulatedDistanceMeasurement.distance);this.viewModel.triangulatedDistanceAccuracy={distanceAccuracy:t,angleAccuracy:e}}break}case"area":if(r?.spatialReference){const t=await c(this.viewModel.measurementVectors,r.spatialReference);this.viewModel.triangulatedAreaMeasurement=t,this.viewModel.triangulatedAreaAccuracy=await this.viewModel.calculateAccuracy(e,"area")??this.viewModel.triangulatedAreaAccuracy}}this.viewModel.updatingTriangularMeasurementState=!1}}};e([a()],m.prototype,"type",void 0),m=e([r("esri.widgets.OrientedImageryViewer.adapters.sketch.TriangulatedMeasurementAdapter")],m);const l=m;export{l as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import{measurementLengthUnits as t,measurementAreaUnits as s}from"../../../core/unitUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../Widget.js";import{css as i}from"../css.js";import{ImageMeasurementMixin as c}from"../mixins/ImageMeasurementMixin.js";import{loadCalciteComponents as m}from"../../support/componentsUtils.js";import{tsx as o}from"../../support/jsxFactory.js";import{UnitSelect as l}from"../../support/UnitSelect.js";let u=class extends(c(a)){constructor(e){super(e)}loadDependencies(){return m({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),table:()=>import("@esri/calcite-components/dist/components/calcite-table"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),"table-row":()=>import("@esri/calcite-components/dist/components/calcite-table-row"),"table-header":()=>import("@esri/calcite-components/dist/components/calcite-table-header"),"table-cell":()=>import("@esri/calcite-components/dist/components/calcite-table-cell")})}get _measurementResult(){const{measurementType:e,oiViewModel:t}=this,{areaMeasurementResult:s,heightMeasurementResult:r,distanceMeasurementResult:n}=t;switch(e){case"area":return s;case"height":return r;case"distance":return n}}get _measurementAccuracy(){const{measurementType:e,oiViewModel:t}=this,{areaMeasurementAccuracy:s,heightMeasurementAccuracy:r,distanceAccuracyArray:n}=t;switch(e){case"area":return s;case"height":return r;case"distance":return n}}get _measurementUnit(){const{measurementType:e,pixelAreaMeasurementUnit:t,pixelMeasurementUnit:s}=this;return"area"===e?t:s}get _measurementUnitOptions(){const{measurementType:e}=this;return"area"===e?s:t}_convertedMeasurement(){const{measurementType:e}=this;switch(e){case"area":return this.getConvertedAreaString("measurement");case"height":return this.getConvertedHeightString("measurement");case"distance":return this.getConvertedDistanceString("measurement")}}_measurementUnitChangeHandler(e){const{measurementType:t}=this;if("area"===t)this.pixelAreaMeasurementUnit=e;else this.pixelMeasurementUnit=e}_renderUnitSelect(){const{_measurementUnit:e,_measurementResult:t,_measurementUnitOptions:s}=this;return t?o("div",{class:i.measurementsBar},o(l,{options:s,selectLabel:"",value:e,onChange:e=>this._measurementUnitChangeHandler(e)}),t?o("calcite-action",{bind:this,icon:"copy-to-clipboard",label:"copy",onclick:()=>this.copyMeasurementResult(this.measurementType),scale:"s",text:""}):null):null}_renderMeasurementResults(){const{_measurementResult:e,_measurementAccuracy:t,messages:s,measurementType:r}=this;return e?o("calcite-table",{bordered:!0,caption:s.measurementTable,class:i.measurementsTable,scale:"s"},o("calcite-table-row",{slot:"table-header"},o("calcite-table-header",{alignment:"center",heading:s.value}),o("calcite-table-header",{alignment:"center",heading:s.accuracy})),o("calcite-table-row",null,o("calcite-table-cell",{alignment:"center"},this._convertedMeasurement()),o("calcite-table-cell",{alignment:"center"},"distance"===r&&Array.isArray(t)&&t?.length||"area"===r&&t||"height"===r&&t?this.getAccuracy(this.measurementType):o("calcite-icon",{icon:"hourglass-active",scale:"s"})))):null}_renderNewMeasurementButton(){const{messages:e,measurementType:t}=this;return o("calcite-button",{class:i.measurementsButton,onclick:()=>this.oiViewModel.initializeMeasurement(t)},e.newMeasurement)}_renderStartMeasurementMessage(){const{oiViewModel:{displayNewMeasurementButton:e},messages:t,_measurementResult:s}=this;return!e&&!s&&o("div",{class:i.measurementDisplay,key:`start-measurement-${this.measurementType}`},t.startMeasurement)}render(){return o("calcite-panel",{class:i.measurementResults,key:`measurement-result-container-${this.measurementType}`},this._renderStartMeasurementMessage(),this._renderNewMeasurementButton(),this._renderUnitSelect(),this._renderMeasurementResults())}};e([r()],u.prototype,"_measurementResult",null),e([r()],u.prototype,"_measurementAccuracy",null),e([r()],u.prototype,"_measurementUnit",null),e([r()],u.prototype,"_measurementUnitOptions",null),u=e([n("esri.widgets.OrientedImageryViewer.components.ImageMeasurementWidget")],u);const p=u;export{p as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import{measurementLengthUnits as t,measurementAreaUnits as a}from"../../../core/unitUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import c from"../../Widget.js";import{css as s}from"../css.js";import{TriangulatedImageMeasurementMixin as i}from"../mixins/TriangulatedImageMeasurementMixin.js";import{loadCalciteComponents as l}from"../../support/componentsUtils.js";import{tsx as u}from"../../support/jsxFactory.js";import{UnitSelect as o}from"../../support/UnitSelect.js";let m=class extends(i(c)){constructor(e){super(e)}loadDependencies(){return l({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),table:()=>import("@esri/calcite-components/dist/components/calcite-table"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),"table-row":()=>import("@esri/calcite-components/dist/components/calcite-table-row"),"table-header":()=>import("@esri/calcite-components/dist/components/calcite-table-header"),"table-cell":()=>import("@esri/calcite-components/dist/components/calcite-table-cell")})}get _measurementResult(){const{measurementType:e,oiViewModel:t}=this,{areaMeasurementResult:a,heightMeasurementResult:r,distanceMeasurementResult:n}=t;switch(e){case"area":return a;case"height":return r;case"distance":return n}}get _measurementAccuracy(){const{measurementType:e,oiViewModel:t}=this,{areaMeasurementAccuracy:a,heightMeasurementAccuracy:r,distanceAccuracyArray:n}=t;switch(e){case"area":return a;case"height":return r;case"distance":return n}}get _measurementUnit(){const{measurementType:e,pixelAreaMeasurementUnit:t,pixelMeasurementUnit:a}=this;return"area"===e?t:a}get _measurementUnitOptions(){const{measurementType:e}=this;return"area"===e?a:t}_convertedMeasurement(){const{measurementType:e}=this;switch(e){case"area":return this.getConvertedAreaString("measurement");case"height":return this.getConvertedHeightString("measurement");case"distance":return this.getConvertedDistanceString("measurement")}}_measurementUnitChangeHandler(e){const{measurementType:t}=this;if("area"===t)this.pixelAreaMeasurementUnit=e;else this.pixelMeasurementUnit=e}_renderUnitSelect(){const{_measurementUnit:e,_measurementResult:t,_measurementUnitOptions:a,oiViewModel:r}=this,{triangularMeasurementActive:n}=r;return t?u("div",{class:s.measurementsBar},u(o,{options:a,selectLabel:"",value:e,onChange:e=>this._measurementUnitChangeHandler(e)}),t?u("calcite-action",{bind:this,icon:"copy-to-clipboard",label:"copy",onclick:()=>this.copyActiveMeasurementResults(this.measurementType,n),scale:"s",text:""}):null):null}_renderMeasurementResults(){const{_measurementResult:e,_measurementAccuracy:t,messages:a,measurementType:r}=this,{measurementTable:n,value:c,accuracy:i}=a;return e?u("calcite-table",{bordered:!0,caption:n,class:s.measurementsTable,scale:"s"},u("calcite-table-row",{slot:"table-header"},u("calcite-table-header",{alignment:"center",heading:c}),u("calcite-table-header",{alignment:"center",heading:i})),u("calcite-table-row",null,u("calcite-table-cell",{alignment:"center"},this._convertedMeasurement()),u("calcite-table-cell",{alignment:"center"},"distance"===r&&Array.isArray(t)&&t?.length||"area"===r&&t||"height"===r&&t?this.getAccuracy(this.measurementType):u("calcite-icon",{icon:"hourglass-active",scale:"s"})))):null}_renderActiveMeasurementResults(){const{oiViewModel:e}=this,{triangularMeasurementActive:t,measureType:a}=e;if(t)switch(a){case"area":return this._renderTriangularAreaMeasurementResults();case"distance":return this._renderTriangularDistanceMeasurementResults()}return this._renderMeasurementResults()}_renderNewMeasurementButton(){const{messages:e,measurementType:t}=this;return u("calcite-button",{class:s.measurementsButton,onclick:()=>this.oiViewModel.initializeMeasurement(t)},e.newMeasurement)}_renderStartMeasurementMessage(){const{oiViewModel:{displayNewMeasurementButton:e},messages:t,_measurementResult:a}=this;return!e&&!a&&u("div",{class:s.measurementDisplay,key:`start-measurement-${this.measurementType}`},t.startMeasurement)}_renderTriangularAreaMeasurementResults(){const{messages:e,oiViewModel:t}=this,{measurementTable:a,value:r,accuracy:n}=e,{triangulatedAreaMeasurement:c}=t;return c?u("calcite-table",{bordered:!0,caption:a,class:s.measurementsTable,scale:"s"},u("calcite-table-row",{slot:"table-header"},u("calcite-table-header",{alignment:"center",heading:r}),u("calcite-table-header",{alignment:"center",heading:n})),u("calcite-table-row",null,this._renderTriangularAreaCell("measurement"),this._renderTriangularAreaCell("accuracy"))):null}_renderTriangularDistanceAccuracyCell(){const{oiViewModel:e}=this,{triangulatedDistanceAccuracy:t}=e;return u("calcite-table-cell",{alignment:"center"},t?.distanceAccuracy?this.getConvertedTriangularDistanceMeasurementString(t.distanceAccuracy):u("calcite-icon",{icon:"hourglass-active",scale:"s"}))}_renderTriangularAreaCell(e){const{oiViewModel:t}=this,{triangulatedAreaMeasurement:a}=t;return u("calcite-table-cell",{alignment:"center"},a?this.getConvertedTriangularAreaString(e):u("calcite-icon",{icon:"hourglass-active",scale:"s"}))}_renderTriangularDistanceAngleAccuracyCell(){const{oiViewModel:e}=this,{triangulatedDistanceAccuracy:t}=e;return u("calcite-table-cell",{alignment:"center"},t?.angleAccuracy?this.getConvertedTriangularDistanceAngularResultsString(t.angleAccuracy):u("calcite-icon",{icon:"hourglass-active",scale:"s"}))}_renderTriangularDistanceMeasurementResults(){const{oiViewModel:e,messages:t}=this,{distance:a,horizontal:r,vertical:n,slope:c,aspect:i,measurementTable:l,value:o,accuracy:m}=t,{triangulatedDistanceMeasurement:g,triangularMeasurementActive:d,measureType:h}=e;return d&&"distance"===h&&g?u("calcite-table",{bordered:!0,caption:l,class:s.measurementsTable,scale:"s"},u("calcite-table-row",{slot:"table-header"},u("calcite-table-header",{alignment:"center",heading:"Type"}),u("calcite-table-header",{alignment:"center",heading:o}),u("calcite-table-header",{alignment:"center",heading:m})),u("calcite-table-row",null,u("calcite-table-cell",{alignment:"center"},a),u("calcite-table-cell",{alignment:"center"},g?.distance?this.getConvertedTriangularDistanceMeasurementString(g.distance):u("calcite-icon",{icon:"hourglass-active",scale:"s"})),this._renderTriangularDistanceAccuracyCell()),u("calcite-table-row",null,u("calcite-table-cell",{alignment:"center"},r),u("calcite-table-cell",{alignment:"center"},g?.horizontalDistance?this.getConvertedTriangularDistanceMeasurementString(g.horizontalDistance):u("calcite-icon",{icon:"hourglass-active",scale:"s"})),this._renderTriangularDistanceAccuracyCell()),u("calcite-table-row",null,u("calcite-table-cell",{alignment:"center"},n),u("calcite-table-cell",{alignment:"center"},g?.verticalDistance?this.getConvertedTriangularDistanceMeasurementString(g.verticalDistance):u("calcite-icon",{icon:"hourglass-active",scale:"s"})),this._renderTriangularDistanceAccuracyCell()),u("calcite-table-row",null,u("calcite-table-cell",{alignment:"center"},c),u("calcite-table-cell",{alignment:"center"},g?.slope?this.getConvertedTriangularDistanceAngularResultsString(g.slope):u("calcite-icon",{icon:"hourglass-active",scale:"s"})),this._renderTriangularDistanceAngleAccuracyCell()),u("calcite-table-row",null,u("calcite-table-cell",{alignment:"center"},i),u("calcite-table-cell",{alignment:"center"},g?.aspect?this.getConvertedTriangularDistanceAngularResultsString(g.aspect):u("calcite-icon",{icon:"hourglass-active",scale:"s"})),this._renderTriangularDistanceAngleAccuracyCell())):null}render(){return u("calcite-panel",{class:s.measurementResults,key:`measurement-result-container-${this.measurementType}`},this._renderStartMeasurementMessage(),this._renderNewMeasurementButton(),this._renderUnitSelect(),this._renderActiveMeasurementResults())}};e([r()],m.prototype,"_measurementResult",null),e([r()],m.prototype,"_measurementAccuracy",null),e([r()],m.prototype,"_measurementUnit",null),e([r()],m.prototype,"_measurementUnitOptions",null),m=e([n("esri.widgets.OrientedImageryViewer.components.ImageMeasurementWidget")],m);const g=m;export{g as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- const e="esri-oriented-imagery-viewer",t=`${e}__carousel`,a=`${e}__image-enhancement`,o=`${e}__navigation`,r="--oi-navigation-tool-rotation-from",n="--oi-navigation-tool-rotation-to",i=`${o}-ui`,s=`${i}__direction`,$=`${e}__image-overlays`,m={alert:`${e}__alert`,addCoverage:`${e}__body-additional-coverage`,addExpPoints:`${e}__body-additional-camera-locations`,body:`${e}__body`,carousel:`${e}__carousel`,carouselContainer:`${t}-container`,carouselContent:`${t}-content`,carouselItem:`${t}-item`,carouselItemWrapper:`${t}-item-wrapper`,close:`${e}__close`,currentCoverage:`${e}__body-current-coverage`,feature:`${o}-feature`,footprint:`${e}__body-footprint`,imageEnhancementToolContainer:`${a}-tool-container`,imageEnhancementTools:`${a}-tools`,imageEnhancementWrapper:`${a}-wrapper`,imageOverlays:$,imageOverlaysContainer:`${$}-container`,imageOverlaysNoResult:`${$}-no-result`,imageOverlaysIncreasedHeight:`${$}-increased-height`,imageOverlaysLayerList:`${$}-layer-list`,measurementResults:`${e}__measurement-results`,measurementsBar:`${e}__measurements-bar`,measurementsButton:`${e}__measurements-button`,measurementsTable:`${e}__measurements-table`,measurementDisplay:`${e}__measurement-display`,messageBox:`${e}__message-box`,navigationPathOffset0:`${o}-feature-path-stop-offset-0`,navigationPathOffset1:`${o}-feature-path-stop-offset-1`,navigationWrapper:`${o}-wrapper`,navigationZoomed:`${o}-wrapper--zoomed`,north:`${o}-pointer-north`,outerSector:`${o}-sector-outer`,overlaysSwitch:`${$}-switch`,pointer:`${o}-pointer`,rotateWithAnimation:`${o}-animate`,sector:`${o}-sector`,sectorCross:`${o}-sector-cross`,sectorDisabled:`${o}-sector-disabled`,sectorEnabled:`${o}-sector-enabled`,sectorSeparator:`${o}-sector-separator`,selectedFeaturePath:`${o}-feature-path`,sketchTools:`${e}__sketch-tools`,submenu:`${e}__submenu`,viewer:`${e}__viewer`,viewerHidden:`${e}__viewer--hidden`,viewerContainer:`${e}__viewer-container`,navigationUI:i,navigationDirection:s,navigationDirectionPad:`${s}-pad`,navigationTop:`${s}--top`,navigationBottom:`${s}--bottom`,navigationLeft:`${s}--left`,navigationRight:`${s}--right`};export{t as carousel,m as css,a as imageEnhancement,o as navigation,r as navigationToolRotationFrom,n as navigationToolRotationTo,e as root};
5
+ const e="esri-oriented-imagery-viewer",t=`${e}__carousel`,a=`${e}__image-enhancement`,o=`${e}__navigation`,r="--oi-navigation-tool-rotation-from",n="--oi-navigation-tool-rotation-to",i=`${o}-ui`,s=`${i}__direction`,$=`${e}__image-overlays`,m={alert:`${e}__alert`,addCoverage:`${e}__body-additional-coverage`,addExpPoints:`${e}__body-additional-camera-locations`,body:`${e}__body`,carousel:`${e}__carousel`,carouselContainer:`${t}-container`,carouselContent:`${t}-content`,carouselItem:`${t}-item`,carouselItemWrapper:`${t}-item-wrapper`,close:`${e}__close`,currentCoverage:`${e}__body-current-coverage`,feature:`${o}-feature`,footprint:`${e}__body-footprint`,imageEnhancementToolContainer:`${a}-tool-container`,imageEnhancementTools:`${a}-tools`,imageEnhancementWrapper:`${a}-wrapper`,imageOverlays:$,imageOverlaysContainer:`${$}-container`,imageOverlaysNoResult:`${$}-no-result`,imageOverlaysIncreasedHeight:`${$}-increased-height`,imageOverlaysLayerList:`${$}-layer-list`,measurementResults:`${e}__measurement-results`,measurementsBar:`${e}__measurements-bar`,measurementsButton:`${e}__measurements-button`,measurementsTable:`${e}__measurements-table`,measurementDisplay:`${e}__measurement-display`,messageBox:`${e}__message-box`,navigationPathOffset0:`${o}-feature-path-stop-offset-0`,navigationPathOffset1:`${o}-feature-path-stop-offset-1`,navigationWrapper:`${o}-wrapper`,navigationZoomed:`${o}-wrapper--zoomed`,north:`${o}-pointer-north`,outerSector:`${o}-sector-outer`,overlaysSwitch:`${$}-switch`,pointer:`${o}-pointer`,rotateWithAnimation:`${o}-animate`,sector:`${o}-sector`,sectorCross:`${o}-sector-cross`,sectorDisabled:`${o}-sector-disabled`,sectorEnabled:`${o}-sector-enabled`,sectorSeparator:`${o}-sector-separator`,selectedFeaturePath:`${o}-feature-path`,sketchTools:`${e}__sketch-tools`,submenu:`${e}__submenu`,viewer:`${e}__viewer`,viewerHidden:`${e}__viewer--hidden`,viewerContainer:`${e}__viewer-container`,viewerContainerMeasurement:`${e}__viewer-container-measurement`,navigationUI:i,navigationDirection:s,navigationDirectionPad:`${s}-pad`,navigationTop:`${s}--top`,navigationBottom:`${s}--bottom`,navigationLeft:`${s}--left`,navigationRight:`${s}--right`};export{t as carousel,m as css,a as imageEnhancement,o as navigation,r as navigationToolRotationFrom,n as navigationToolRotationTo,e as root};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{throwIfAborted as t}from"../../core/promiseUtils.js";import{formatLength as e,formatArea as r}from"../../core/quantityFormatUtils.js";import{createLength as n,createArea as a}from"../../core/quantityUtils.js";import{distance as o}from"../../core/libs/gl-matrix-2/math/vec2.js";import i from"../../geometry/Point.js";import s from"../../geometry/Polygon.js";import c from"../../geometry/Polyline.js";import{projectWithZConversion as u,project as l}from"../../geometry/projection.js";import f from"../../geometry/SpatialReference.js";import{e as m}from"../../chunks/areaOperator.js";import{l as p,e as y}from"../../chunks/geodeticAreaOperator.js";import{l as h,e as g}from"../../chunks/geodeticDensifyOperator.js";import{l as x,e as w}from"../../chunks/geodeticLengthOperator.js";import{e as d}from"../../chunks/lengthOperator.js";import{e as v}from"../../chunks/simplifyOperator.js";import{isSupported as R,geodesicLengths as z,geodesicAreas as M}from"../../geometry/support/geodesicUtils.js";import{imageToWorld as j,imageToWorldPanoramic as P}from"../../layers/orientedImagery/transformations/imageToWorld.js";import{convertSphereVertexToPixelLocation as E}from"../../layers/orientedImagery/transformations/utils.js";import{worldToImage as b,worldToImagePanoramic as I}from"../../layers/orientedImagery/transformations/worldToImage.js";const k=1e5;function L(t,e){let r=180*Math.atan2(-t.y+e.y,t.x-e.x)/Math.PI;return r<0&&(r+=180),r*Math.PI/180}function O(t,e){let r=180*Math.atan2(-t.y+e.y,t.x-e.x)/Math.PI;return r<0&&(r+=180),r*Math.PI/180}function W(t,e,r){if(!t?.length||!e?.length||!r)return;const[n,a]=t,[,o]=e,i=o-a;return[n+i*Math.cos(r),a+i*Math.sin(r)]}async function q(t,e,r){if(await h(),R(t)){const t=z([e],"meters")[0];return{area:M([r],"square-meters")[0],perimeter:t}}const n=f.WGS84,a=l(e,n),o=l(r,n);let i=g(o,k);if(i=v(i),!i)return null;const s=z([a],"meters")[0];return{area:M([i],"square-meters")[0],perimeter:s}}async function G(e,r,n,a,o=!1,i){if(r.length<2||!a||!n||!e)return null;const s=Z(n,e);if(!s)return null;const c=r.map((t=>[t.x,t.y])),u=c.at(0),l=c.at(-1);if(!u||!l)return null;const f=s.map((t=>nt([u,l],t,e,o,!1))),m=await Promise.all(f);t(i);let p=0;for(const t of m){if(!t)return null;const e=Math.abs(t-a);p=Math.max(e,p)}return p}async function D(e,r,n,a,o,i=!1,s){if(r.length<2||!a||!n||!e)throw new Error("Missing parameters");const c=$(n,e),u=r.map((t=>[t.x,t.y])),l=u.at(0),f=u.at(-1),m=c.map((t=>at([l,f],t,e,o,i,!1))),p=await Promise.all(m);t(s);let y=0;for(const t of p){if(!t)return 0;const e=Math.abs(t-a);y=Math.max(e,y)}return y}function U(t,e){const r=X(t,!1);if(!r?.length)return;return 20*o([r[0].x,r[0].y],[r.at(-1).x,r.at(-1).y])/e}async function F(t){await x();const e=t.spatialReference;if(e.isGeographic){if(R(e))return z([t],"meters")[0];const r=l(t,f.WGS84);return z([r],"meters")[0]}return e.isWebMercator?w(t):d(t)}function S(t){if(!t?.length)throw new Error("Invalid deviations array");const[e,r,n]=[0,1,2].map((e=>t.map((t=>t[e])).filter((t=>null!==t)))).map((t=>t.length?et(t):0));return[e,r,n]}function T(t,e){const r=v(e);if(!r)return null;const n=d(t);return{area:m(r),perimeter:n}}async function H(t,e){await Promise.all([p(),h(),x()]);let r=g(e,k);if(r=v(r),!r)return null;const n=w(t);return{area:y(r),perimeter:n}}async function V(e,r,n){if(!r||!e)throw new Error("Missing required parameters");const a=await j(e,r);t(n);const o=a.clone();o.z?o.z+=20:o.z=20;const{averageElevation:i,cameraPitch:s,cameraRoll:c,farDistance:u,...l}=r;return b(o,l)}async function A(e,r,n,a){const{attributes:o}=n,{location:i}=o,{updateElevationProps:s,...c}=r;if(!e||!r)throw new Error("Missing parameters");let l=i.clone();l.spatialReference.isGeographic&&(l=await u(l,f.WebMercator));const m=await P(e,{...c,cameraLocation:l},s);t(a);const p=m.clone();return p.z?p.z+=20:p.z=20,I(p,c)}function B(t,e,r,n,a=0,s=1,c){const{averageElevation:u,cameraPitch:l,cameraRoll:f,farDistance:m,...p}=n;if(a>=5||s<=.1)return{value:t};const y=new i({x:e.x,y:e.y,z:e.z?e.z+t:t,spatialReference:n.cameraLocation.spatialReference}),h=b(y,p),g=o([r[0].x,r[0].y],[h.x,h.y]),x=r.at(0),w=r.at(-1);if(!x||!w)return null;const d=o([x.x,x.y],[w.x,w.y])*t/g;return B(d,e,r,n,a+1,Math.abs(t-d))}function C(t,e,r,n,a=0,s=1,c){const{averageElevation:u,horizontalFieldOfView:l,verticalFieldOfView:f,farDistance:m,...p}=n;if(a>=5||s<=.1)return{value:t};const y=new i({x:e.x,y:e.y,z:e.z?e.z+t:t,spatialReference:n.cameraLocation.spatialReference}),h=I(y,p),g=o([r[0].x,r[0].y],[h.x,h.y]),x=r.at(0),w=r.at(-1);if(!x||!w)return null;const d=o([x.x,x.y],[w.x,w.y])*t/g;return C(d,e,r,n,a+1,Math.abs(t-d))}async function J(t,e){const{updateElevationProps:r,...n}=e;return await j(t,n,r)}async function K(t,e){const{updateElevationProps:r,...n}=e;return P(t,n,r)}function N(t){navigator.clipboard.writeText(t).catch((t=>{throw t}))}function Q(t){const e=t.map((t=>[t.x,t.y])),r=t[0].spatialReference;return new c({paths:[e],spatialReference:r})}function X(t,e){return t.map((t=>({x:e?.5+t[0]:t[0],y:e?.5-t[1]:t[1]})))}function Y(t,r,a,o,i){const s="measurement"===t?r:a;if(i&&s)return e(o,n(s,"meters"),i,3)||null}function Z(t,e){const{cameraPitch:r,cameraRoll:n,cameraLocation:a}=t,{x:o,y:s,z:c,spatialReference:u}=a;if(e.every((t=>0===t))||!e||!e.length)return null;const[l,f,,m,p]=e,y=[-m,0,m],h=[-p,0,p],g=[-l,0,l],x=[-f,0,f],w=[];for(const d of y)for(const e of h)for(const a of g)for(const l of g)for(const f of x){const m={...t};m.cameraPitch=r+d,m.cameraRoll=n+e,m.cameraLocation=new i({x:o+a,y:s+l,z:c?c+f:0,spatialReference:{wkid:u.wkid}}),w.push(m)}return w}function $(t,e){const{cameraHeading:r,cameraLocation:n}=t,{x:a,y:o,z:s,spatialReference:c}=n;if(e.every((t=>0===t))||!e||!e.length)throw new Error("Invalid parameters");const[u,l,f]=e,m=f>0?[-f,0,f]:[],p=u>0?[-u,0,u]:[],y=l>0?[-l,0,l]:[],h=[];for(const g of m)for(const e of p)for(const n of p)for(const u of y){const l={...t};l.cameraHeading=r+g,l.cameraLocation=new i({x:a+e,y:o+n,z:s?s+u:0,spatialReference:{wkid:c.wkid}}),h.push(l)}return h}function _(t,r,a,o,i){const s="measurement"===t?r:et(a);if(i&&s)return e(o,n(s,"meters"),i,3)||null}function tt(t,e,n,o,i){const s="measurement"===t?e:n;if(i&&s)return r(o,a(s,"square-meters"),i,3)||null}function et(t){return Math.sqrt(t.reduce(((t,e)=>t+e**2),0))}function rt(t,e,r){if("default"===e)return t;const n={x:t[0],y:t[1],z:t[2]},a=E(n,r[0],r[1]);return[a.x,a.y]}async function nt(e,r,n,a=!1,i=!1,s){if(!e||!r||e.length<2)return null;const c=X(e,a);if(!c||c.length<2)return null;const[u,l]=[c[0],c.at(-1)];if(!l)return null;const f=[u],m=await j(u,r);t(s);const p=m.clone();p.z?p.z+=20:p.z=20;const{averageElevation:y,cameraPitch:h,cameraRoll:g,farDistance:x,...w}=r,d=b(p,w),v=o([u.x,u.y],[d.x,d.y]),R=L(u,d);if(!R)return;const z=W([u.x,u.y],[l.x,l.y],R);if(!z?.length)return;f.push({x:z[0],y:z[1]});const M=20*o([f[0].x,f[0].y],[f[1].x,f[1].y])/v;if(!i)return M;const P=B(M,m,f,r,0,1);return P?.value}async function at(e,r,n,a,i=!1,s=!1,c){const{attributes:l}=a,{location:m}=l,{updateElevationProps:p,...y}=r;if(!e||!r||e.length<2)throw new Error("Invalid parameters");const h=X(e,i),[g,x]=[h[0],h.at(-1)],w=[g];let d=m.clone();d.spatialReference.isGeographic&&(d=await u(d,f.WebMercator));const v=await P(g,{...y,cameraLocation:d},p);t(c);const R=v.clone();R.z?R.z+=20:R.z=20;const z=I(R,y),M=o([g.x,g.y],[z.x,z.y]),j=L(g,z);if(!j)return;const E=W([g.x,g.y],[x.x,x.y],j);if(!E?.length)return;w.push({x:E[0],y:E[1]});const b=20*o([w[0].x,w[0].y],[w[1].x,w[1].y])/M;if(!s)return b;const k=C(b,v,w,r,0,1);return k?.value}async function ot(t,e,r=!1){if(t.length<3)return null;const n=X(t,r),a=await J(n,e),o=a.map((({x:t,y:e})=>[t,e]));t.push(t[0]),o.push(o[0]);const i=a[0].spatialReference,u=new c({paths:[o],spatialReference:i}),l=new s({rings:[o],spatialReference:i});return i.isGeographic?q(i,u,l):i.isWebMercator?H(u,l):T(u,l)}async function it(e,r,n=!1,a){if(e.length<3)return null;const o=X(e,n),i=await K(o,r);t(a);const u=i.map((({x:t,y:e})=>[t,e]));e.push(e[0]),u.push(u[0]);const l=i[0].spatialReference,f=new c({paths:[u],spatialReference:l}),m=new s({rings:[u],spatialReference:l});return l.isGeographic?q(l,f,m):l.isWebMercator?H(f,m):T(f,m)}async function st(t,e,r=!1){const n=X(t,r);return F(Q(await J(n,e)))}async function ct(e,r,n=!1,a){const o=X(e,n),i=await K(o,r);t(a);return F(Q(i))}export{L as calculateAngle,O as calculateAnglePano,W as calculateCorrectedPixel,G as calculateHeightAccuracy,D as calculateHeightAccuracyPanoramic,U as calculateHeightFromTemporaryDistance,S as calculateLocationAccuracyFromDeviations,A as calculateReferenceImagePointPanoramic,V as calculateTempImagePoint,B as computeHeightIteratively,C as computeHeightIterativelyPanoramic,N as copyToClipboard,X as formatPixels,Z as generateCombinations,$ as generateCombinationsPanoramic,tt as getConvertedArea,_ as getConvertedDistance,Y as getConvertedHeight,rt as getModeCorrectedPoint,et as getRootOfSumOfSquaredErrors,nt as heightMeasurement2D,at as heightMeasurementPanoramic,ot as pixelAreaMeasurement2D,it as pixelAreaMeasurementPanoramic,st as pixelDistanceMeasurement2D,ct as pixelDistanceMeasurementPanoramic};
5
+ import{rad2deg as t}from"../../core/mathUtils.js";import{throwIfAborted as e}from"../../core/promiseUtils.js";import{formatLength as n,formatArea as r}from"../../core/quantityFormatUtils.js";import{createLength as a,createArea as o}from"../../core/quantityUtils.js";import{set as s,determinant as i}from"../../core/libs/gl-matrix-2/math/mat3.js";import{create as c}from"../../core/libs/gl-matrix-2/factories/mat3f64.js";import{zeros as u,fromValues as l}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{distance as f}from"../../core/libs/gl-matrix-2/math/vec2.js";import{i as m,e as p,a as h}from"../../chunks/vec32.js";import y from"../../geometry/Point.js";import g from"../../geometry/Polygon.js";import x from"../../geometry/Polyline.js";import{projectWithZConversion as w,project as M}from"../../geometry/projection.js";import z from"../../geometry/SpatialReference.js";import{e as R}from"../../chunks/areaOperator.js";import{l as d,e as v}from"../../chunks/geodeticAreaOperator.js";import{l as P,e as j}from"../../chunks/geodeticDensifyOperator.js";import{l as b,e as O}from"../../chunks/geodeticLengthOperator.js";import{e as E}from"../../chunks/lengthOperator.js";import{execute as q}from"../../geometry/operators/projectOperator.js";import{e as W}from"../../chunks/simplifyOperator.js";import{isSupported as k,geodesicLengths as I,geodesicAreas as G}from"../../geometry/support/geodesicUtils.js";import{imageToWorld as L,imageToWorldPanoramic as A}from"../../layers/orientedImagery/transformations/imageToWorld.js";import{convertSphereVertexToPixelLocation as D,scaleWithFactor as S}from"../../layers/orientedImagery/transformations/utils.js";import{worldToImage as U,worldToImagePanoramic as B}from"../../layers/orientedImagery/transformations/worldToImage.js";const F=1e5;function T(t,e){let n=180*Math.atan2(-t.y+e.y,t.x-e.x)/Math.PI;return n<0&&(n+=180),n*Math.PI/180}function H(t,e){let n=180*Math.atan2(-t.y+e.y,t.x-e.x)/Math.PI;return n<0&&(n+=180),n*Math.PI/180}function V(t,e,n){if(!t?.length||!e?.length||!n)return;const[r,a]=t,[,o]=e,s=o-a;return[r+s*Math.cos(n),a+s*Math.sin(n)]}async function C(t,e,n){if(await P(),k(t)){const t=I([e],"meters")[0];return{area:G([n],"square-meters")[0],perimeter:t}}const r=z.WGS84,a=M(e,r),o=M(n,r);let s=j(o,F);if(s=W(s),!s)return null;const i=I([a],"meters")[0];return{area:G([s],"square-meters")[0],perimeter:i}}async function J(t,n,r,a,o=!1,s){if(n.length<2||!a||!r||!t)return null;const i=Rt(r,t);if(!i)return null;const c=n.map((t=>[t.x,t.y])),u=c.at(0),l=c.at(-1);if(!u||!l)return null;const f=i.map((e=>Ot([u,l],e,t,o,!1))),m=await Promise.all(f);e(s);let p=0;for(const e of m){if(!e)return null;const t=Math.abs(e-a);p=Math.max(t,p)}return p}async function K(t,n,r,a,o,s=!1,i){if(n.length<2||!a||!r||!t)throw new Error("Missing parameters");const c=dt(r,t),u=n.map((t=>[t.x,t.y])),l=u.at(0),f=u.at(-1),m=c.map((e=>Et([l,f],e,t,o,s,!1))),p=await Promise.all(m);e(i);let h=0;for(const e of p){if(!e)return 0;const t=Math.abs(e-a);h=Math.max(t,h)}return h}function N(t,e){const n=Mt(t,!1);if(!n?.length)return;return 20*f([n[0].x,n[0].y],[n.at(-1).x,n.at(-1).y])/e}async function Q(t){await b();const e=t.spatialReference;if(e.isGeographic){if(k(e))return I([t],"meters")[0];const n=M(t,z.WGS84);return I([n],"meters")[0]}return e.isWebMercator?O(t):E(t)}function X(t){if(!t?.length)throw new Error("Invalid deviations array");const[e,n,r]=[0,1,2].map((e=>t.map((t=>t[e])).filter((t=>null!==t)))).map((t=>t.length?jt(t):0));return[e,n,r]}function Y(t,e){const n=W(e);if(!n)return null;const r=E(t);return{area:R(n),perimeter:r}}function Z(t,e){return[(t[1][0]-t[0][0])/e,(t[1][1]-t[0][1])/e,(t[1][2]-t[0][2])/e]}async function $(t,e){await Promise.all([d(),P(),b()]);let n=j(e,F);if(n=W(n),!n)return null;const r=O(t);return{area:v(n),perimeter:r}}async function _(t,n,r){if(!n||!t)throw new Error("Missing required parameters");const a=await L(t,n);e(r);const o=a.clone();o.z?o.z+=20:o.z=20;const{averageElevation:s,cameraPitch:i,cameraRoll:c,farDistance:u,...l}=n;return U(o,l)}async function tt(t,n,r,a){const{attributes:o}=r,{location:s}=o,{updateElevationProps:i,...c}=n;if(!t||!n)throw new Error("Missing parameters");let u=s.clone();u.spatialReference.isGeographic&&(u=await w(u,z.WebMercator));const l=await A(t,{...c,cameraLocation:u},i);e(a);const f=l.clone();return f.z?f.z+=20:f.z=20,B(f,c)}function et(t,e,n,r,a=0,o=1,s){const{averageElevation:i,cameraPitch:c,cameraRoll:u,farDistance:l,...m}=r;if(a>=5||o<=.1)return{value:t};const p=new y({x:e.x,y:e.y,z:e.z?e.z+t:t,spatialReference:r.cameraLocation.spatialReference}),h=U(p,m),g=f([n[0].x,n[0].y],[h.x,h.y]),x=n.at(0),w=n.at(-1);if(!x||!w)return null;const M=f([x.x,x.y],[w.x,w.y])*t/g;return et(M,e,n,r,a+1,Math.abs(t-M))}function nt(t,e,n,r,a=0,o=1,s){const{averageElevation:i,horizontalFieldOfView:c,verticalFieldOfView:u,farDistance:l,...m}=r;if(a>=5||o<=.1)return{value:t};const p=new y({x:e.x,y:e.y,z:e.z?e.z+t:t,spatialReference:r.cameraLocation.spatialReference}),h=B(p,m),g=f([n[0].x,n[0].y],[h.x,h.y]),x=n.at(0),w=n.at(-1);if(!x||!w)return null;const M=f([x.x,x.y],[w.x,w.y])*t/g;return nt(M,e,n,r,a+1,Math.abs(t-M))}function rt(t,e,n){return new x({paths:[[[t.x,t.y,t.z??0],[e.x,e.y,e.z??0]]],spatialReference:n})}function at(t){return 1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*t/6378137)))}function ot(t,e){return Math.sqrt((Math.sqrt((t[0][0]-t[1][0])**2+(t[0][1]-t[1][1])**2)/e)**2+(t[0][2]-t[1][2])**2)}function st(t,e,n){return Math.sqrt((t.z??0-(e.z??0))**2+(Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)/n)**2)*n}function it(t,e,n,r){return St(Dt([t.x,t.y,t.z??0],[e.x,e.y,e.z??0]),1/n,1/r)}function ct(t,e){return Math.sqrt((t[0][0]-t[1][0])**2+(t[0][1]-t[1][1])**2)/e}function ut(e){return t(Math.atan((e[1][2]-e[0][2])/Math.sqrt((e[1][0]-e[0][0])**2+(e[1][1]-e[0][1])**2)))}function lt(e){let n=90-t(Math.atan2(e[1][1]-e[0][1],e[1][0]-e[0][0]));return n<0&&(n+=360),n}function ft(t,e){return new y({x:(t.pointOnA[0]+t.pointOnB[0])/2,y:(t.pointOnA[1]+t.pointOnB[1])/2,z:(t.pointOnA[2]+t.pointOnB[2])/2,spatialReference:e})}async function mt(t){if(2===t?.length){const e=[];let n=1;const[r,a]=t,o=r.camera.spatialReference,{measurePoints:s}=r;for(let t=0;t<s.length;t++){const s=rt(r.camera,r.measurePoints[t],o),i=rt(a.camera,a.measurePoints[t],o),c=await Gt(s,i);if(!c)return null;const u=ft(c,o);u.spatialReference.isWebMercator&&(n=at(u.y)),e.push([u.x,u.y,u.z??0])}if(e?.length>1){return{distance:ot(e,n),horizontalDistance:ct(e,n),verticalDistance:Math.abs(e[0][2]-e[1][2]),slope:ut(e),aspect:lt(e)}}}return null}async function pt(t,e){if(!t?.length)return null;const n=[],r=t[0],a=t[1],o=r.camera.spatialReference,{measurePoints:s}=r;for(let l=0;l<s.length;l++){const t=rt(r.camera,r.measurePoints[l],o),e=rt(a.camera,a.measurePoints[l],o),s=await Gt(t,e);if(!s)return null;const i=ft(s,o);n.push([i.x,i.y,i.z??0])}if(n?.length<2)return null;const i=new x({paths:[n],spatialReference:e}),c=new g({rings:[n],spatialReference:e});if(e.isGeographic){const t=await C(e,i,c);return t?.area??null}if(e.isWebMercator){const t=await $(i,c);return t?.area??null}const u=Y(i,c);return u?.area??null}function ht(t,e){if(!t)return null;const n=new y({x:e.geometry.x,y:e.geometry.y,z:e.geometry.z,spatialReference:e.spatialReference}),r=Array.isArray(t)?t:[t],a=[];return r.forEach((t=>{let e=!1;t.spatialReference.isWGS84&&(t=q(t,new z({wkid:3857})),e=!0);const r=t.spatialReference.isWebMercator?at(t.y):1,o=st(t,n,r),s=it(t,n,o,r),i=((t.z??0)-(n.z??0))/s[2]*r;let c=new y({spatialReference:t.spatialReference,x:n.x+i*s[0],y:n.y+i*s[1],z:(n.z??0)+i*s[2]/r});e&&(c=q(c,new z({wkid:4326}))),a.push(c)})),{camera:n,measurePoints:r,tempMeasurePoints:a}}async function yt(t,e){const{updateElevationProps:n,...r}=e;return await L(t,r,n)}async function gt(t,e){const{updateElevationProps:n,...r}=e;return A(t,r,n)}function xt(t){navigator.clipboard.writeText(t).catch((t=>{throw t}))}function wt(t){const e=t.map((t=>[t.x,t.y])),n=t[0].spatialReference;return new x({paths:[e],spatialReference:n})}function Mt(t,e){return t.map((t=>({x:e?.5+t[0]:t[0],y:e?.5-t[1]:t[1]})))}function zt(t,e,r,o,s){const i="measurement"===t?e:r;if(s&&i)return n(o,a(i,"meters"),s,3)||null}function Rt(t,e){const{cameraPitch:n,cameraRoll:r,cameraLocation:a}=t,{x:o,y:s,z:i,spatialReference:c}=a;if(e.every((t=>0===t))||!e||!e.length)return null;const[u,l,,f,m]=e,p=[-f,0,f],h=[-m,0,m],g=[-u,0,u],x=[-l,0,l],w=[];for(const M of p)for(const e of h)for(const a of g)for(const u of g)for(const l of x){const f={...t};f.cameraPitch=n+M,f.cameraRoll=r+e,f.cameraLocation=new y({x:o+a,y:s+u,z:i?i+l:0,spatialReference:{wkid:c.wkid}}),w.push(f)}return w}function dt(t,e){const{cameraHeading:n,cameraLocation:r}=t,{x:a,y:o,z:s,spatialReference:i}=r;if(e.every((t=>0===t))||!e||!e.length)throw new Error("Invalid parameters");const[c,u,l]=e,f=l>0?[-l,0,l]:[],m=c>0?[-c,0,c]:[],p=u>0?[-u,0,u]:[],h=[];for(const g of f)for(const e of m)for(const r of m)for(const c of p){const u={...t};u.cameraHeading=n+g,u.cameraLocation=new y({x:a+e,y:o+r,z:s?s+c:0,spatialReference:{wkid:i.wkid}}),h.push(u)}return h}function vt(t,e,r,o,s){const i="measurement"===t?e:jt(r);if(s&&i)return n(o,a(i,"meters"),s,3)||null}function Pt(t,e,n,a,s){const i="measurement"===t?e:n;if(s&&i)return r(a,o(i,"square-meters"),s,3)||null}function jt(t){return Math.sqrt(t.reduce(((t,e)=>t+e**2),0))}function bt(t,e,n){if("default"===e)return t;const r={x:t[0],y:t[1],z:t[2]},a=D(r,n[0],n[1]);return[a.x,a.y]}async function Ot(t,n,r,a=!1,o=!1,s){if(!t||!n||t.length<2)return null;const i=Mt(t,a);if(!i||i.length<2)return null;const[c,u]=[i[0],i.at(-1)];if(!u)return null;const l=[c],m=await L(c,n);e(s);const p=m.clone();p.z?p.z+=20:p.z=20;const{averageElevation:h,cameraPitch:y,cameraRoll:g,farDistance:x,...w}=n,M=U(p,w),z=f([c.x,c.y],[M.x,M.y]),R=T(c,M);if(!R)return;const d=V([c.x,c.y],[u.x,u.y],R);if(!d?.length)return;l.push({x:d[0],y:d[1]});const v=20*f([l[0].x,l[0].y],[l[1].x,l[1].y])/z;if(!o)return v;const P=et(v,m,l,n,0,1);return P?.value}async function Et(t,n,r,a,o=!1,s=!1,i){const{attributes:c}=a,{location:u}=c,{updateElevationProps:l,...m}=n;if(!t||!n||t.length<2)throw new Error("Invalid parameters");const p=Mt(t,o),[h,y]=[p[0],p.at(-1)],g=[h];let x=u.clone();x.spatialReference.isGeographic&&(x=await w(x,z.WebMercator));const M=await A(h,{...m,cameraLocation:x},l);e(i);const R=M.clone();R.z?R.z+=20:R.z=20;const d=B(R,m),v=f([h.x,h.y],[d.x,d.y]),P=T(h,d);if(!P)return;const j=V([h.x,h.y],[y.x,y.y],P);if(!j?.length)return;g.push({x:j[0],y:j[1]});const b=20*f([g[0].x,g[0].y],[g[1].x,g[1].y])/v;if(!s)return b;const O=nt(b,M,g,n,0,1);return O?.value}async function qt(t,e,n=!1){if(t.length<3)return null;const r=Mt(t,n),a=await yt(r,e),o=a.map((({x:t,y:e})=>[t,e]));t.push(t[0]),o.push(o[0]);const s=a[0].spatialReference,i=new x({paths:[o],spatialReference:s}),c=new g({rings:[o],spatialReference:s});return s.isGeographic?C(s,i,c):s.isWebMercator?$(i,c):Y(i,c)}async function Wt(t,n,r=!1,a){if(t.length<3)return null;const o=Mt(t,r),s=await gt(o,n);e(a);const i=s.map((({x:t,y:e})=>[t,e]));t.push(t[0]),i.push(i[0]);const c=s[0].spatialReference,u=new x({paths:[i],spatialReference:c}),l=new g({rings:[i],spatialReference:c});return c.isGeographic?C(c,u,l):c.isWebMercator?$(u,l):Y(u,l)}async function kt(t,e,n=!1){const r=Mt(t,n);return Q(wt(await yt(r,e)))}async function It(t,n,r=!1,a){const o=Mt(t,r),s=await gt(o,n);e(a);return Q(wt(s))}async function Gt(t,e){const n=c(),r=t.paths[0][0],a=e.paths[0][0];let o,u;t.spatialReference.isWGS84||t.spatialReference.isWebMercator?(await b(),o=O(t),u=O(e)):(o=E(t),u=E(e));const l=Z(t.paths[0],o),f=Z(e.paths[0],u),m=Lt(l,f),[p,h,y]=l,[g,x,w]=f.map((t=>-t)),[M,z,R]=m,[d,v,P]=[a[0]-r[0],a[1]-r[1],a[2]-r[2]];s(n,p,g,M,h,x,z,y,w,R);const j=i(n);if(0===j)return null;s(n,d,g,M,v,x,z,P,w,R);const q=i(n);s(n,p,d,M,h,v,z,y,P,R);const W=i(n);s(n,p,g,d,h,x,v,y,w,P);const k=q/j,I=W/j,G=i(n)/j;return{distance:Math.abs(G/Math.sqrt(m[0]*m[0]+m[1]*m[1]+m[2]*m[2])),pointOnA:At(r,k,l),pointOnB:At(a,I,f)}}function Lt(t,e){const n=u(),r=m(u(),t[0],t[1],t[2]),a=m(u(),e[0],e[1],e[2]),o=p(n,r,a);return[o[0],o[1],o[2]]}function At(t,e,n){return[t[0]+e*n[0],t[1]+e*n[1],t[2]+e*n[2]]}function Dt(t,e){const n=l(t[0],t[1],t[2]),r=l(e[0],e[1],e[2]);return h(u(),n,r)}function St(t,e,n){const r=S(t,e,n);return[r[0],r[1],r[2]]}export{T as calculateAngle,H as calculateAnglePano,V as calculateCorrectedPixel,J as calculateHeightAccuracy,K as calculateHeightAccuracyPanoramic,N as calculateHeightFromTemporaryDistance,X as calculateLocationAccuracyFromDeviations,tt as calculateReferenceImagePointPanoramic,_ as calculateTempImagePoint,et as computeHeightIteratively,nt as computeHeightIterativelyPanoramic,pt as computeTriangulatedAreaMeasurement,mt as computeTriangulatedDistanceMeasurement,ht as computeTriangulatedVector,xt as copyToClipboard,Mt as formatPixels,Rt as generateCombinations,dt as generateCombinationsPanoramic,Pt as getConvertedArea,vt as getConvertedDistance,zt as getConvertedHeight,bt as getModeCorrectedPoint,jt as getRootOfSumOfSquaredErrors,Ot as heightMeasurement2D,Et as heightMeasurementPanoramic,qt as pixelAreaMeasurement2D,Wt as pixelAreaMeasurementPanoramic,kt as pixelDistanceMeasurement2D,It as pixelDistanceMeasurementPanoramic,St as scale,Gt as solveSkewLinesIntersection,Dt as subtract};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import{watch as t,syncAndInitial as o}from"../../../core/reactiveUtils.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";const a={sketchHandles:"sketch-handles"},r=r=>{let n=class extends r{initialize(){this.addHandles(t((()=>this.viewModel?.sketch),(e=>{this.removeHandles(a.sketchHandles),e&&this.addHandles([e.on("create",(e=>this.handleCreate(e))),e.on("update",(e=>this.handleUpdate(e))),e.on("undo",(e=>this.handleUndo(e))),e.on("redo",(e=>this.handleRedo(e))),e.on("delete",(e=>this.handleDelete(e))),e.on("destroy",(()=>this.handleDestroy())),e.on("duplicate",(e=>this.handleDuplicate(e))),t((()=>e.activeComponent),(e=>{"draw-2d"!==e?.type&&"draw-3d"!==e?.type||(e.elevationLockOnVertexAddDisabled=!0)}),o)],a.sketchHandles)}),o))}handleCreate(e){}handleUpdate(e){}handleUndo(e){}handleRedo(e){}handleDelete(e){}handleDestroy(){}handleDuplicate(e){}};return e([s()],n.prototype,"type",void 0),e([s()],n.prototype,"viewModel",void 0),n=e([d("esri.widgets.OrientedImageryViewer.mixins.SketchHandlerMixin")],n),n};export{r as SketchHandlerMixin};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import{watch as t,syncAndInitial as o}from"../../../core/reactiveUtils.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";const r={sketchHandles:"sketch-handles"},a=a=>{let n=class extends a{initialize(){this.addHandles(t((()=>this.sketch),(e=>{this.removeHandles(r.sketchHandles),e&&this.addHandles([e.on("create",(e=>this.handleCreate(e))),e.on("update",(e=>this.handleUpdate(e))),e.on("undo",(e=>this.handleUndo(e))),e.on("redo",(e=>this.handleRedo(e))),e.on("delete",(e=>this.handleDelete(e))),e.on("destroy",(()=>this.handleDestroy())),e.on("duplicate",(e=>this.handleDuplicate(e))),t((()=>e.activeComponent),(e=>{"draw-2d"!==e?.type&&"draw-3d"!==e?.type||(e.elevationLockOnVertexAddDisabled=!0)}),o)],r.sketchHandles)}),o))}get sketch(){return this.viewModel?.sketch}handleCreate(e){}handleUpdate(e){}handleUndo(e){}handleRedo(e){}handleDelete(e){}handleDestroy(){}handleDuplicate(e){}};return e([s()],n.prototype,"sketch",null),e([s()],n.prototype,"type",void 0),e([s()],n.prototype,"viewModel",void 0),n=e([d("esri.widgets.OrientedImageryViewer.mixins.SketchHandlerMixin")],n),n};export{a as SketchHandlerMixin};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../intl.js";import{formatLength as t,formatAngle as r}from"../../../core/quantityFormatUtils.js";import{createLength as a,createAngle as s}from"../../../core/quantityUtils.js";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import"../../../core/Error.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{copyToClipboard as i,getConvertedArea as c}from"../imageMeasurementUtils.js";import{ImageMeasurementMixin as u}from"./ImageMeasurementMixin.js";import{substitute as o}from"../../../intl/substitute.js";const g=g=>{let m=class extends(u(g)){copyActiveMeasurementResults(e,t){t?this.copyTriangularMeasurementResult(e):this.copyGroundMeasurementResult(e)}copyGroundMeasurementResult(e){let t,r;switch(e){case"area":t={measurement:this.getConvertedAreaString("measurement"),accuracy:this.getConvertedAreaString("accuracy")},r="{measurement} ± {accuracy}";break;case"distance":t={measurement:this.getConvertedDistanceString("measurement"),accuracy:this.getConvertedDistanceString("accuracy")},r="{measurement} ± {accuracy}";break;case"height":t={measurement:this.getConvertedHeightString("measurement"),accuracy:this.getConvertedHeightString("accuracy")},r="{measurement} ± {accuracy}"}const a=o(r,t);i(a)}copyTriangularMeasurementResult(e){let t=null;switch(e){case"area":t=this.copyTriangularAreaMeasurements();break;case"distance":t=this.copyTriangularDistanceMeasurements()}t&&i(t)}copyTriangularAreaMeasurements(){const e={measurement:this.getConvertedTriangularAreaString("measurement"),accuracy:this.getConvertedTriangularAreaString("accuracy")};return o("{measurement} ± {accuracy}",e)}copyTriangularDistanceMeasurements(){const{oiViewModel:e}=this,{triangulatedDistanceMeasurement:t,triangulatedDistanceAccuracy:r}=e;if(!t)return;const{distance:a,horizontalDistance:s,verticalDistance:n,slope:i,aspect:c}=t,{distanceAccuracy:u=0,angleAccuracy:g=0}=r??{},m={distance:this.getConvertedTriangularDistanceMeasurementString(a),distanceAccuracy:this.getConvertedTriangularDistanceMeasurementString(u),horizontal:this.getConvertedTriangularDistanceMeasurementString(s),vertical:this.getConvertedTriangularDistanceMeasurementString(n),slope:this.getConvertedTriangularDistanceAngularResultsString(i),angleAccuracy:this.getConvertedTriangularDistanceAngularResultsString(g),aspect:this.getConvertedTriangularDistanceAngularResultsString(c)};return o(" Distance : {distance} ± {distanceAccuracy} , Horizontal : {horizontal} ± {distanceAccuracy}, Vertical : {vertical} ± {distanceAccuracy}, Slope : {slope} ± {angleAccuracy}, Aspect : {aspect} ± {angleAccuracy}",m)}getConvertedTriangularDistanceMeasurementString(e){const{measurementUnitMessages:r,pixelMeasurementUnit:s}=this;return t(r,a(e,"meters"),s,3)||null}getConvertedTriangularDistanceAngularResultsString(e){return r(s(e,"degrees"),"arithmetic",3)||null}getConvertedTriangularAreaString(e){const{oiViewModel:t,measurementUnitMessages:r,pixelAreaMeasurementUnit:a,messages:s}=this,{triangulatedAreaAccuracy:n,triangulatedAreaMeasurement:i}=t;return c(e,i,n,r,a)??s.startMeasurement}};return m=e([n("esri.widgets.OrientedImageryViewer.mixins.TriangulatedImageMeasurementMixin")],m),m};export{g as TriangulatedImageMeasurementMixin};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import{_ as r}from"../../../chunks/tslib.es6.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{SketchHandlerMixin as s}from"./SketchHandlerMixin.js";const t=t=>{let i=class extends(s(t)){get sketch(){return this.viewModel?.sketchTriangular}};return r([e()],i.prototype,"sketch",null),i=r([o("esri.widgets.OrientedImageryViewer.mixins.TriangulatedSketchHandlerMixin")],i),i};export{t as TriangulatedSketchHandlerMixin};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{prefersReducedMotion as t}from"../core/a11yUtils.js";import{createTask as i}from"../core/asyncUtils.js";import a from"../core/Collection.js";import{deprecatedProperty as s}from"../core/deprecate.js";import o from"../core/Logger.js";import{isAbortError as r}from"../core/promiseUtils.js";import{watch as l,initial as n,syncAndInitial as c,whenOnce as d}from"../core/reactiveUtils.js";import{property as g}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import{or as h}from"../layers/orientedImagery/transformations/utils.js";import p from"./Widget.js";import{getAllArcPath as u}from"./OrientedImageryViewer/arcUtils.js";import{defaultImageGeometryField as v,defaultOIObjectIDField as y,segmentArcs as w,sectorsRadii as _,featureCircleRadius as b,navigationToolDimensionLength as C,getDelegatedEvents as M}from"./OrientedImageryViewer/constants.js";import{css as T,navigation as I,navigationToolRotationFrom as f,navigationToolRotationTo as L,root as k}from"./OrientedImageryViewer/css.js";import{isFeatureAttachment as A,loadImageForAttachment as O,getThumbnailPixelBlock as F,renderImageWithRotation as S}from"./OrientedImageryViewer/galleryUtils.js";import E from"./OrientedImageryViewer/OrientedImageryViewerViewModel.js";import V from"./OrientedImageryViewer/OrientedImageryViewerVisibleElements.js";import P from"./OrientedImageryViewer/components/ImageLocationWidget.js";import x from"./OrientedImageryViewer/components/NavigationUI.js";import{loadCalciteComponents as G}from"./support/componentsUtils.js";import{globalCss as j}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as $}from"./support/decorators/messageBundle.js";import{vmEvent as D}from"./support/decorators/vmEvent.js";import{tsx as H}from"./support/jsxFactory.js";import{substitute as B}from"../intl/substitute.js";const N={overlayMapFeatures:"overlay-map-features",overlayed:"overlayed",overlaysActionHandles:"overlays-action-handles",directionsHandle:"directions-handle"};let U=class extends p{constructor(e,t){super(e,t),this.dataCaptureEnabled=!1,this.galleryOpened=!1,this.imageEnhancementToolActive=!1,this.directionToolsActive=!1,this.imageOverlaysOpened=!1,this.navigationToolActive=!1,this.viewModel=new E,this.messagesCommon=null,this.messagesSketch=null,this.pixelMeasurementUnit="meters",this.pixelAreaMeasurementUnit="square-meters",this.showCameraLocations=!1,this.showMapFeatures=!1,this.visibleElements=new V,this._imageOverlaysLoaderTask=null,this._imageMeasurementToolsLoaderTask=null,this._clearMeasurements=()=>{this.viewModel.measureType=null,this.viewModel.clearPreviousMeasurements()},this._clearImageLocation=()=>{this.imageLocationToolActive=!1},this._navigationToolExpanded=!1,this._navigationTool=null,this._warningTitleElement=null,this._galleryController=new AbortController,this._galleryObserver=new IntersectionObserver(this._lazyLoadImage.bind(this)),this._overlayedLayers=new a,this._previousAction=null,this._handleDataCaptureLayerChange=async e=>{if(this.dataCaptureLayer&&await this.stopDataCapture(!0),this.dataCaptureLayer=this.dataCaptureLayer===e?null:e,this.dataCaptureLayer)return this.startDataCapture(this.dataCaptureLayer)},this._handleOverlayLayerDeselect=e=>{const t=e.layer;t===this.dataCaptureLayer&&(this.stopDataCapture(),this.dataCaptureLayer=null),this.removeOverlayedGraphicsOnImage(`${t.id}`)},this._handleOverlayLayerSelect=e=>{const t=e.layer;this.viewModel.overlayMapFeatures(t,this.showMapFeatures),this.addHandles(l((()=>t.visible),(()=>{this.viewModel.toggleOverlayMapFeatures(t.id,t.visible)})),`${N.overlayed}-${t.id}`)},this._highlight=e=>{const t=e.target?.dataset.objectid;t&&this.viewModel.highlight(t)},this._onAction=e=>{const{target:t}=e,{dataset:{action:i}}=t,{_previousAction:a}=this,s=a?.dataset.action,o=s?.includes("draw")??!1,r="select-feature"===s,l=s!==i;switch(i){case"draw-point":case"draw-polygon":case"draw-polyline":{a&&h(r,o&&l)&&(a.active=!1),t.active=!t.active;const e=i.replace("draw-","");this.viewModel.digitizeCreate(e),this._previousAction=t.active?t:null;break}case"save":this.viewModel.saveDrawing();break;case"select-feature":o&&(this._previousAction.active=!1),t.active=!t.active,this.viewModel.toggleSelection(t.active),this._previousAction=t.active?t:null;break;case"delete-feature":this.viewModel.digitizeDelete()}},this._onImageOverlayClosed=()=>{this.imageOverlaysOpened=!1},this._onShowCameraLocationsChanged=e=>{this.showCameraLocations=e},this._onShowMapFeaturesChanged=e=>{this.showMapFeatures=e},this._removeHighlight=()=>this.viewModel.removeHighlight(),this._restoreOverlays=async()=>Promise.all(this._overlayedLayers.map((e=>this.viewModel.overlayMapFeatures(e,this.showMapFeatures)))),this._scaleNavigationTool=()=>{this._navigationToolExpanded=!this._navigationToolExpanded},this._sketchLoaderTask=null,this._toggleDirectionsTool=()=>{const e=this.directionToolsActive;this._closeAllImageTools(),this.directionToolsActive=!e},this._toggleImageAttributes=()=>{this.viewModel.toggleImageAttributes()},this._loadImageFromGallery=this._loadImageFromGallery.bind(this),this._registerGalleryItem=this._registerGalleryItem.bind(this),this._unregisterGalleryItem=this._unregisterGalleryItem.bind(this),this.loadImageFromSource=this.loadImageFromSource.bind(this),this.updateSuitabilities=this.updateSuitabilities.bind(this)}initialize(){this.addHandles([l((()=>[this.viewModel?.bestFeatureAngle,this._navigationTool]),(([e,t])=>{t&&this._updateNavigationTool(t)}),n),l((()=>this.currentCoverageVisible),(e=>this._onCurrentCoverageVisibilityChange(e))),l((()=>this.isAdditionalCoverageVisible),(e=>this._onAdditionalCoverageVisibilityChange(e))),l((()=>this.isAdditionalPointSourcesVisible),(e=>this._onAdditionalCameraLocationsVisibility(e))),l((()=>({features:this.currentBestFeature,showCameraLocations:this.showCameraLocations,state:this.viewModel.state})),(({showCameraLocations:e,state:t})=>{"image-loaded"===t&&this.viewModel.overlayCameraLocations(e)}),c),l((()=>({feature:this.currentBestFeature,showMapFeatures:this.showMapFeatures,state:this.viewModel.state})),(async(e,t)=>{if(e.showMapFeatures!==t?.showMapFeatures&&this.viewModel.toggleAllOverlayMapFeatures(e.showMapFeatures),null!=e.feature&&e.feature!==t?.feature){if(this.viewModel.removeAllOverlayMapFeatures(),await d((()=>"image-loaded"===this.viewModel.state)),this.dataCaptureLayer&&this.stopDataCapture(),await this._restoreOverlays(),!this.dataCaptureLayer)return;await this.startDataCapture(this.dataCaptureLayer),this._previousAction?.active&&(this._previousAction.active=!1,this._previousAction=null)}}),n)])}loadDependencies(){return G({"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group"),action:()=>import("@esri/calcite-components/dist/components/calcite-action"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),shell:()=>import("@esri/calcite-components/dist/components/calcite-shell"),dialog:()=>import("@esri/calcite-components/dist/components/calcite-dialog"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),slider:()=>import("@esri/calcite-components/dist/components/calcite-slider"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}destroy(){this._galleryController.abort(),this._galleryObserver.disconnect()}get accuracyParametersMissing(){return this.viewModel.accuracyParametersMissing}get activeLayer(){return s(o.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){s(o.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer=e}get currentBestFeature(){return this.viewModel.currentBestFeature}set currentBestFeature(e){this.viewModel.currentBestFeature=e}get currentCoverageVisible(){return this.viewModel.currentCoverageVisible}set currentCoverageVisible(e){this.viewModel.currentCoverageVisible=e}get dataCaptureLayer(){return this.viewModel.dataCaptureLayer}set dataCaptureLayer(e){this.viewModel.dataCaptureLayer=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get displayMessage(){return this.viewModel.displayMessage}get features(){return this.viewModel.features}get imagePointsInView(){return this.viewModel.imagePointsInView}get icon(){return"oriented-imagery-widget"}set icon(e){this._overrideIfSome("icon",e)}get imageGalleryEnabled(){return this.viewModel.imageGalleryEnabled}get imageLocationToolActive(){return this.viewModel.imageLocationToolState}set imageLocationToolActive(e){this.viewModel.imageLocationToolState=e}get invalidCameraHeading(){return this.viewModel.invalidCameraHeading}get isAdditionalCoverageVisible(){return this.viewModel.isAdditionalCoverageVisible}set isAdditionalCoverageVisible(e){this.viewModel.isAdditionalCoverageVisible=e}get isAdditionalPointSourcesVisible(){return this.viewModel.isAdditionalPointSourcesVisible}set isAdditionalPointSourcesVisible(e){this.viewModel.isAdditionalPointSourcesVisible=e}get mapImageConversionToolState(){return this.viewModel.mapImageConversionToolState}set mapImageConversionToolState(e){this.viewModel.mapImageConversionToolState=e}get measureType(){return this.viewModel.measureType}set measureType(e){this.viewModel.measureType=e}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get popupEnabled(){const{popupEnabled:e,state:t}=this.viewModel;return"image-loaded"===t&&e}get referencePoint(){return this.viewModel.referencePoint??null}get sketchViewModel(){return this.viewModel.sketch}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}set determineWorkflowForFeature(e){this.viewModel.determineWorkflowForFeature=e}get determineWorkflowForFeature(){return this.viewModel.determineWorkflowForFeature}set updateFootprint(e){this.viewModel.updateFootprint=e}get updateFootprint(){return this.viewModel.updateFootprint}_renderActionBar(){return H("calcite-action-bar",{expandDisabled:!0,layout:"horizontal",slot:"action-bar"},H("calcite-action-group",null,this._currentFootprintToggle(),this._additionalFootprintToggle(),this._additionalPointSourcesToggle()),H("calcite-action-group",null,this._mapImageConversionToggle(),this._navigationToolToggle(),this._directionToolToggle(),this._imageEnhancementsToggle()),H("calcite-action-group",null,this._measurementToolsToggle(),this._imageGalleryToggle(),this._imageOverlaysToggle(),this._openPopupAction()))}get _activeMeasurementIcon(){const{measureType:e,imageLocationToolActive:t}=this;if(t)return"pin-tear";switch(e){case"area":return"measure-area";case"height":return"measure-building-height-top-base";default:return"measure-line"}}get _activeMeasurementHeading(){const{measureType:e,messages:t}=this,{groundArea:i,heightAboveGround:a,groundDistance:s}=t;switch(e){case"area":return i;case"height":return a;default:return s}}_additionalFootprintToggle(){const{isAdditionalCoverageVisible:e,invalidCameraHeading:t,visibleElements:{additionalFootprintToggle:i}}=this;return i?H("calcite-action",{active:e,bind:this,class:T.addCoverage,disabled:t,icon:"trapezoid-area",onclick:this._toggleAdditionalCoverage,text:this.messages.additionalFootprints,title:this.messages.additionalFootprints}):null}_additionalPointSourcesToggle(){const{isAdditionalPointSourcesVisible:e,invalidCameraHeading:t,visibleElements:{additionalCameraLocationsToggle:i}}=this;return i?H("calcite-action",{active:e,bind:this,class:T.addExpPoints,disabled:t,icon:"circle-area",onclick:this._toggleAdditionalCameraLocations,text:this.messages.additionalCameraLocations,title:this.messages.additionalCameraLocations}):null}get _measurementToggle(){const{viewModel:{state:e,measureType:t},id:i}=this;if("image-loaded"!==e||!t)return;this._imageMeasurementToolsLoaderTask||this._loadImageMeasurementResources();const a=this._imageMeasurementToolsLoaderTask?.value;return a?H("calcite-dialog",{bind:this,dragEnabled:!0,escapeDisabled:!0,heading:this._activeMeasurementHeading,id:`${i}-${t}-measurement`,open:!0,placement:"bottom-start",resizable:!0,scale:"s",slot:"dialogs",width:"s",onCalciteDialogBeforeClose:this._clearMeasurements},H(a,{measurementType:t,measurementUnitMessages:this.measurementUnitMessages,messages:this.messages,oiViewModel:this.viewModel})):null}get _renderRoot(){const{viewModel:{state:e}}=this;return H("calcite-panel",null,H("calcite-shell",null,H("calcite-panel",{bind:this,class:T.viewerContainer,heading:this.visibleElements.title?this.messages.title:void 0,loading:e.includes("loading")},this.visibleElements.menu?this._renderActionBar():null,this._imageViewer,this._panoramicViewer,this._messageBox,this.invalidCameraHeading?[this._renderWarning(this.messages.invalidCameraHeadingWarningTitle),this._renderWarningTooltip(this.messages.invalidCameraHeadingWarningDescription)]:[this._imageGalleryPanel,this._renderNavigation,this._imageOverlaysPanel()],this._imageEnhancementTools,this._renderNavigationUI,this._renderSketch()),this._measurementToggle,this._locationToggle))}_currentFootprintToggle(){const{currentCoverageVisible:e,invalidCameraHeading:t}=this,{currentFootprintToggle:i}=this.visibleElements;return i?H("calcite-action",{active:e,bind:this,class:T.currentCoverage,disabled:t,icon:"trapezoid-area",onclick:this._toggleCurrentCoverage,text:this.messages.currentFootprint,title:this.messages.currentFootprint}):null}get _imageEnhancementTools(){const{imageEnhancementToolActive:e,viewModel:{brightness:t,contrast:i,sharpness:a,state:s}}=this;return e&&"image-loaded"===s?H("calcite-panel",{bind:this,class:T.imageEnhancementWrapper,closable:!0,closed:!e,heading:this.messages.imageEnhancement,key:this.messages.imageEnhancement,onCalcitePanelClose:this._toggleImageEnhancementToolState},H("div",{class:T.imageEnhancementTools},H("div",{class:T.imageEnhancementToolContainer},H("calcite-label",null,this.messages.brightness,H("calcite-slider",{bind:this,labelTicks:!0,max:10,min:-10,ticks:5,value:t,onCalciteSliderInput:this._handleBrightnessChange}))),H("div",{class:T.imageEnhancementToolContainer},H("calcite-label",null,this.messages.contrast,H("calcite-slider",{bind:this,labelTicks:!0,max:10,min:-10,ticks:5,value:i,onCalciteSliderInput:this._handleContrastChange}))),H("div",{class:T.imageEnhancementToolContainer},H("calcite-label",null,this.messages.sharpness,H("calcite-slider",{bind:this,labelTicks:!0,max:1,min:0,step:.1,ticks:.5,value:a,onCalciteSliderInput:this._handleSharpnessChange})))),H("calcite-action",{bind:this,icon:"reset",onclick:this._resetImageTools,slot:"header-actions-end",text:this.messagesCommon.reset,title:this.messagesCommon.reset})):null}_imageEnhancementsToggle(){const{state:e,mode:t}=this.viewModel,{imageEnhancement:i}=this.visibleElements;return i?H("calcite-action",{active:this.imageEnhancementToolActive,bind:this,disabled:"default"!==t||"image-loaded"!==e,icon:"sliders-horizontal",onclick:this._toggleImageEnhancementToolState,text:this.messages.imageEnhancement,title:this.messages.imageEnhancement}):null}get _imageGalleryPanel(){const{container:e,galleryOpened:t,imageGalleryEnabled:i}=this;return i&&t&&e?this._imageGalleryContext:null}get _imageGalleryContext(){const{galleryOpened:e,invalidCameraHeading:t}=this;return H("calcite-panel",{bind:this,class:T.carousel,closable:!0,closed:!e,disabled:t,heading:this.messages.imageGallery,key:this.messages.imageGallery,onCalcitePanelClose:this._toggleImageGallery},H("div",{class:T.carouselContainer},this._renderThumbnails))}_imageGalleryToggle(){const{imageGalleryEnabled:e,invalidCameraHeading:t,visibleElements:{imageGallery:i}}=this;return i?H("calcite-action",{active:this.galleryOpened,bind:this,disabled:!e||t,icon:"images",onclick:this._toggleImageGallery,text:this.messages.imageGallery,title:this.messages.imageGallery}):null}get _imageOverlaysComponent(){const{_imageOverlayMessages:e,_imageOverlaysLoaderTask:t,_overlayedLayers:a,dataCaptureEnabled:s,dataCaptureLayer:o,imageOverlaysOpened:r,showCameraLocations:l,showMapFeatures:n,view:c,layer:d}=this;if(!d)return null;const g=d.imageGeometryField?.length?d.imageGeometryField:v,m=d.imageReferenceField?.length?d.imageReferenceField:y;t||(this._imageOverlaysLoaderTask=i((async()=>(await import("./OrientedImageryViewer/components/ImageOverlays.js")).default)));const h=this._imageOverlaysLoaderTask?.value;return h?H(h,{closed:!r,dataCaptureEnabled:s,dataCaptureLayer:o,imageGeometryField:g,imageReferenceField:m,messages:e,overlayedLayers:a,showCameraLocations:l,showMapFeatures:n,view:c,onDataCaptureLayerChanged:this._handleDataCaptureLayerChange,onImageOverlaysClosed:this._onImageOverlayClosed,onLayerDeselected:this._handleOverlayLayerDeselect,onLayerSelected:this._handleOverlayLayerSelect,onShowCameraLocationsChanged:this._onShowCameraLocationsChanged,onShowMapFeaturesChanged:this._onShowMapFeaturesChanged}):null}get _imageOverlayMessages(){return{...this.messages,...this.messagesSketch}}get _imageSketchToolsMessages(){return{...this.messagesSketch,...this.messagesCommon}}_imageOverlaysPanel(){const{imageOverlaysOpened:e,viewModel:{state:t}}=this,i=this.classes({[T.imageOverlaysContainer]:!0,[j.hidden]:!e||"image-loaded"!==t});return H("div",{class:i,key:this.messages.imageOverlays},this._imageOverlaysComponent)}_imageOverlaysToggle(){const{viewModel:{state:e},imageOverlaysOpened:t,invalidCameraHeading:i,visibleElements:{imageOverlays:a}}=this;return a?H("calcite-action",{active:t,bind:this,disabled:"image-loaded"!==e||i,icon:"layers",onclick:this._toggleImageOverlays,text:this.messages.imageOverlays,title:this.messages.imageOverlays}):null}get _imageViewer(){const{displayMessage:e,loadImageViewer:t,mode:i}=this.viewModel,a=null!=e||"default"!==i,s=this.classes({[T.viewer]:!a,[T.viewerHidden]:a});return H("calcite-panel",{afterCreate:t,bind:this,class:s},this._renderSketch())}get _locationToggle(){const{viewModel:{state:e,groundCoordinates:t,groundCoordinatesAccuracy:i},imageLocationToolActive:a,messages:{groundLocation:s}}=this;if("image-loaded"===e&&t&&a)return H("calcite-dialog",{bind:this,dragEnabled:!0,escapeDisabled:!0,heading:s,id:s,open:!0,placement:"bottom-start",resizable:!0,scale:"s",slot:"dialogs",width:"s",onCalciteDialogBeforeClose:this._clearImageLocation},H(P,{accuracy:i,groundCoordinates:t,messages:this.messages}))}_mapImageConversionToggle(){const{mapImageConversionToolState:e,viewModel:{state:t},invalidCameraHeading:i,visibleElements:{mapImageConversionTool:a}}=this;return a?H("calcite-action",{active:e,bind:this,disabled:"image-loaded"!==t||i,icon:"image-pin",onclick:this._toggleMapImageConversionToolState,text:this.messages.mapImageConversionTool,title:this.messages.mapImageConversionTool}):null}_measurementToolsToggle(){const{_activeMeasurementIcon:e,measureType:t,viewModel:i,accuracyParametersMissing:a,messages:s,visibleElements:{measurementTools:o}}=this,{state:r}=i,{measurementTools:l,groundDistance:n,groundArea:c,heightAboveGround:d,groundLocation:g}=s;return o?H("calcite-dropdown",{disabled:a,key:"measurement-tools",title:l,width:"m"},H("calcite-action",{bind:this,disabled:"image-loaded"!==r||a,icon:e,slot:"trigger",text:l}),H("calcite-dropdown-group",null,H("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"measure-line",key:"distance-measurement",onclick:e=>this._toggleMeasurementSketch(e,"distance"),selected:"distance"===t},n),H("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"measure-area",key:"area-measurement",onclick:e=>this._toggleMeasurementSketch(e,"area"),selected:"area"===t},c),H("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"measure-building-height-top-base",key:"height-dropdown",onclick:e=>this._toggleMeasurementSketch(e,"height"),selected:"height"===t},d),H("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"pin-tear",key:"surface-location",onclick:e=>this._toggleLocationTool(e),selected:this.imageLocationToolActive},g))):null}get _messageBox(){const{messages:e,viewModel:{displayMessage:t}}=this;if(!t)return null;const{data:i,key:a,map:s}=t,o=`${s?B(e[a],s):e[a]}`;return H("span",{class:T.messageBox},i?`${o} ${i}`:o)}_navigationToolToggle(){const{state:e}=this.viewModel,{visibleElements:{navigationTool:t}}=this;return t?H("calcite-action",{active:this.navigationToolActive,bind:this,disabled:"image-loaded"!==e||this.invalidCameraHeading,icon:"explore",onclick:this._toggleNavigationTool,text:this.messages.navigationTool,title:this.messages.navigationTool}):null}_directionToolToggle(){const{state:e,mode:t}=this.viewModel,{visibleElements:{directions:i}}=this;return i?H("calcite-action",{active:this.directionToolsActive,bind:this,disabled:"image-loaded"!==e||this.invalidCameraHeading||"panoramic"!==t,icon:"tour",onclick:this._toggleDirectionsTool,text:this.messages.imageNavigation,title:this.messages.imageNavigation}):null}_openPopupAction(){const{showPopupsAction:e}=this.visibleElements;return e?H("calcite-action",{bind:this,disabled:!this.popupEnabled,icon:"popup",onclick:this._toggleImageAttributes,text:this.messages.showPopups,title:this.messages.showPopups}):null}get _panoramicViewer(){const{displayMessage:e,loadPanoramicViewer:t,mode:i}=this.viewModel,a=null!=e||"panoramic"!==i,s=this.classes({[T.viewer]:!a,[T.viewerHidden]:a});return H("calcite-panel",{afterCreate:t,bind:this,class:s})}get _renderNavigationUI(){const{visibleElements:{directions:e},directionToolsActive:t,viewModel:i}=this;return"image-loaded"===i.state&&e&&t&&"panoramic"===i.mode?H(x,{currentNode:this.viewModel.currentNode,navigate:this.viewModel.navigate,nodes:this.viewModel.navigationNodes}):null}_closeAllImageTools(){this.imageEnhancementToolActive=!1,this.navigationToolActive=!1,this.imageOverlaysOpened=!1,this.galleryOpened=!1,this.measureType=null,this.imageLocationToolActive=!1,this.directionToolsActive=!1}_handleBrightnessChange(e){this.viewModel.brightness=e.currentTarget.value??0}_handleContrastChange(e){this.viewModel.contrast=e.currentTarget.value??0}_handleSharpnessChange(e){this.viewModel.sharpness=e.currentTarget.value??0}_lazyLoadImage(e,t){e.forEach((async e=>{if(e.isIntersecting){const a=e.target,s=a.getAttribute("data-src"),l=a.getAttribute("data-rotation"),n=a.getAttribute("data-objectid"),c=l?parseFloat(l)%360:0,{layer:d,_galleryController:{signal:g}}=this;if(!s||!n)return;let m;try{m=A(s)?await O(d,n,{signal:g}):await F(s,{signal:g})}catch(i){r(i)||o.getLogger("esri.widgets.OrientedImageryViewer").error("#lazyLoadImage()",i)}finally{t.unobserve(a)}if(!m)return;S(m,a,c)}}))}_loadImageFromGallery(e){const{target:t}=e;if(!t)return;const i=t.getAttribute("data-objectid");i&&this.viewModel.currentBestFeature?.attributes.objectId!==Number(i)&&this.viewModel.selectBestFeature(i)}_loadImageMeasurementResources(){this._imageMeasurementToolsLoaderTask=i((async()=>{const{default:e}=await import("./OrientedImageryViewer/components/ImageMeasurementWidget.js");return e}))}_loadSketchResources(){this._sketchLoaderTask=i((async()=>(await import("./OrientedImageryViewer/components/SketchTools.js")).default))}_onAdditionalCoverageVisibilityChange(e){this.viewModel.setAdditionalCoverageVisibility(e)}_onAdditionalCameraLocationsVisibility(e){this.viewModel.setAdditionalCameraLocationsVisibility(e)}_onCurrentCoverageVisibilityChange(e){this.viewModel.setCurrentCoverageVisibility(e)}_registerGalleryItem(e){this._galleryObserver.observe(e)}_renderWarning(e){const{invalidCameraHeading:t,viewModel:{state:i}}=this;return t&&"image-loaded"===i?[H("calcite-notice",{class:T.alert,closable:!0,icon:"exclamation-mark-triangle-f",iconFlipRtl:!0,kind:"warning",open:!0,scale:"s"},H("div",{afterCreate:e=>this._storeWarningTitleElement(e),slot:"title"},e))]:null}_renderWarningTooltip(e){const{_warningTitleElement:t}=this;if(e?.length&&t)return H("calcite-tooltip",{closeOnClick:!0,referenceElement:t},e)}get _renderNavigation(){const{viewModel:{sectorData:e,navigatorCurrentBestFeature:i,currentBestFeature:a,state:s}}=this;if(!this.container||!a)return null;let o,r,l,n,c;if(i){const{x:e,y:t,direction:a}=i,[s,d,g,m]=w[a];o=`M ${e} ${t} L ${s} ${d} A ${_[2]} ${_[2]} 0 0 1 ${g} ${m} Z`,r=e,n=t,l=w[a][4],c=w[a][5]}const d=e=>{const t=e.target.dataset?.sector;t&&this.viewModel.handleSectorClick(+t)},g=e=>{const t=e.target.dataset;if(!t)return;const{featureIndexInSector:i,sector:a}=t;i&&a&&this.viewModel.handleFeatureClick({sector:a,featureIndexInSector:+i})},m=e=>{e.removeEventListener("click",g)},h=a.attributes.objectId,p=e?.map((e=>e?.items)).filter(Boolean).flatMap((e=>e?.map((({x:e,y:t,objectID:i,featureIndexInSector:a,sector:s})=>H("circle",{afterRemoved:m,class:this.classes(T.feature,{selected:h===i}),cx:e,cy:t,"data-feature-index-in-sector":a,"data-sector":s,key:`${T.feature}-${i}`,onclick:g,r:b}))))),v=e=>{e.removeEventListener("click",d)},y=this.classes({[T.navigationWrapper]:!0,[T.navigationZoomed]:this._navigationToolExpanded});return this.navigationToolActive&&"image-loaded"===s?H("div",{bind:this,class:y,key:this.messages.navigationTool},H("svg",{afterCreate:e=>this._storeNavigationToolReference(e),class:t()?I:T.rotateWithAnimation,focusable:"false",height:C,role:"img",width:C,xmlns:"http://www.w3.org/2000/svg"},H("defs",null,H("linearGradient",{gradientUnits:"userSpaceOnUse",id:`${this.id}-coverage-fill`,x1:r,x2:l,y1:n,y2:c},H("stop",{class:T.navigationPathOffset0,offset:0}),H("stop",{class:T.navigationPathOffset1,offset:1}))),H("g",null,H("circle",{class:this.classes(T.sector,T.outerSector),cx:_[3],cy:_[3],onclick:this._scaleNavigationTool,r:_[3]}),H("circle",{class:T.sector,cx:_[3],cy:_[3],r:_[2]}),H("circle",{class:T.sector,cx:_[3],cy:_[3],r:_[1]}),H("circle",{class:T.sector,cx:_[3],cy:_[3],r:_[0]}),H("path",{class:T.pointer,d:"M 56.5 6.06217782649107 L 60 0 L 63.5 6.06217782649107 Z",key:`${T.pointer}-west`}),H("path",{class:this.classes(T.pointer,T.north),d:"M 113.93782217350893 56.5 L 120 60 L 113.93782217350893 63.5 Z",key:`${T.pointer}-north`}),H("path",{class:T.pointer,d:"M 56.5 113.93782217350893 L 60 120 L 63.5 113.93782217350893 Z",key:`${T.pointer}-east`}),H("path",{class:T.pointer,d:"M 6.06217782649107 56.5 L 0 60 L 6.06217782649107 63.5 Z",key:`${T.pointer}-south`}),H("path",{class:this.classes(T.sector,T.sectorSeparator),d:"M 23.937554159486076 23.937554159486076 L 96.06244584051393 96.06244584051393 M 23.937554159486076 96.06244584051393 L 96.06244584051393 23.937554159486076",key:T.sectorSeparator}),u([_[2],_[1],_[0]],_[3],_[3]).map(((t,i)=>H("path",{afterRemoved:v,class:this.classes(T.sector,e?.[i]?.length?T.sectorEnabled:T.sectorDisabled),d:t,"data-sector":`${i}`,key:`${T.sector}-${i}`,onclick:d}))),H("path",{class:this.classes(T.sector,T.sectorCross),d:"M 56.4 56.4 L 63.53 63.53 M 63.53 56.4 L 56.4 63.53",key:T.sectorCross}),p,a.attributes.cameraPitch>=5&&o?H("path",{class:T.selectedFeaturePath,d:o,fill:`url(#${this.id}-coverage-fill)`,key:T.selectedFeaturePath}):null))):null}_renderSketch(){const{dataCaptureLayer:e,imageOverlaysOpened:t}=this;if(!e||t)return null;if(this._sketchLoaderTask||this._loadSketchResources(),!this._sketchLoaderTask?.value)return null;const{geometryType:i}=e,a="point"===i?"pin":"polyline"===i?"line":"polygon",s=this._sketchLoaderTask.value;return H("div",{class:T.sketchTools},H(s,{icon:a,messages:this._imageSketchToolsMessages,type:i,onAction:this._onAction}))}get _renderThumbnails(){const{currentBestFeature:e,thumbnails:t}=this.viewModel;return e?H("div",{class:T.carouselContent},t?.items.map((({url:t,objectId:i,rotation:a},s)=>H("div",{class:`${T.carouselItemWrapper}${e.attributes.objectId===i?"--selected":""}`,key:`${T.carouselItemWrapper}-${s}`},H("canvas",{afterCreate:this._registerGalleryItem,afterRemoved:this._unregisterGalleryItem,alt:`thumbnail-${i}`,class:T.carouselItem,"data-objectid":`${i}`,"data-rotation":`${a}`,"data-src":t,onclick:this._loadImageFromGallery,onmouseenter:this._highlight,onmouseleave:this._removeHighlight}))))):null}_resetImageTools(){this.viewModel.sharpness=this.viewModel.brightness=this.viewModel.contrast=0}_storeNavigationToolReference(e){this._navigationTool=e}_storeWarningTitleElement(e){this._warningTitleElement=e}_toggleAdditionalCameraLocations(){this.isAdditionalPointSourcesVisible=!this.isAdditionalPointSourcesVisible}_toggleAdditionalCoverage(){this.isAdditionalCoverageVisible=!this.isAdditionalCoverageVisible}_toggleCurrentCoverage(){this.currentCoverageVisible=!this.currentCoverageVisible}_toggleImageEnhancementToolState(e){e.stopPropagation();const t=this.imageEnhancementToolActive;this._closeAllImageTools(),this.imageEnhancementToolActive=!t}_toggleImageOverlays(e){e.stopPropagation();const t=this.imageOverlaysOpened;this._closeAllImageTools(),this.imageOverlaysOpened=!t}_toggleImageGallery(e){e.stopPropagation();const t=this.galleryOpened;this._closeAllImageTools(),this.galleryOpened=!!this.imageGalleryEnabled&&!t}_toggleLocationTool(e){const t=this.imageLocationToolActive;this._closeAllImageTools(),this.imageLocationToolActive=!t,e.stopPropagation()}_toggleMeasurementSketch(e,t){e.stopPropagation();const i=this.measureType;this._closeAllImageTools(),this.measureType=i===t?null:t,this.measureType===t&&(this.viewModel.displayNewMeasurementButton=!0)}_toggleNavigationTool(){const e=this.navigationToolActive;this._closeAllImageTools(),this.navigationToolActive=!e}_toggleMapImageConversionToolState(){this.mapImageConversionToolState=!this.mapImageConversionToolState}_unregisterGalleryItem(e){this._galleryObserver.unobserve(e)}_updateNavigationTool(e){const{previousFeatureAngle:t,bestFeatureAngle:i}=this.viewModel,a=(i-t+540)%360-180;e.style.setProperty(f,`${t}deg`),e.style.setProperty(L,`${t+a}deg`)}async loadBestImage(e){return this.viewModel.loadBestImage(e)}loadImageFromSource(e,t){return this.viewModel.loadImageFromSource(e,t)}async overlayMapFeatures(e,t){return this.removeHandles(`${N.overlayed}-${e.id}`),this.addHandles(l((()=>e.visible),(()=>{this.viewModel.toggleOverlayMapFeatures(e.id,e.visible)})),`${N.overlayed}-${e.id}`),this._overlayedLayers.add(e),this.viewModel.overlayMapFeatures(e,t&&this.showMapFeatures)}async plotMapPoint(e){return this.viewModel.plotMapPoint(e)}plotReferencePointOnGround(e){this.viewModel.plotReferencePointOnGround(e)}plotReferencePointOnImage(e){this.viewModel.plotReferencePointOnImage(e)}removeOverlayedGraphicsOnImage(e){this.removeHandles(`${N.overlayed}-${e}`),this._overlayedLayers.remove(this._overlayedLayers.find((t=>t.id===e))),this.viewModel.removeOverlayedGraphicsOnImage(e)}resetImage(){this.viewModel.resetImage()}render(){return H("div",{class:this.classes(j.widget,k)},this._renderRoot)}async startDataCapture(e){return this.viewModel.startDataCapture(e)}async stopDataCapture(e){return this.viewModel.stopDataCapture(e)}updateSuitabilities(e){this.viewModel.updateSuitabilities(e)}};e([g({readOnly:!0})],U.prototype,"accuracyParametersMissing",null),e([g()],U.prototype,"activeLayer",null),e([g()],U.prototype,"currentBestFeature",null),e([g()],U.prototype,"currentCoverageVisible",null),e([g()],U.prototype,"dataCaptureEnabled",void 0),e([g()],U.prototype,"dataCaptureLayer",null),e([g()],U.prototype,"disabled",null),e([g()],U.prototype,"features",null),e([g()],U.prototype,"imagePointsInView",null),e([g()],U.prototype,"galleryOpened",void 0),e([g()],U.prototype,"icon",null),e([g()],U.prototype,"imageEnhancementToolActive",void 0),e([g({readOnly:!0})],U.prototype,"imageGalleryEnabled",null),e([g()],U.prototype,"imageLocationToolActive",null),e([g()],U.prototype,"directionToolsActive",void 0),e([g()],U.prototype,"imageOverlaysOpened",void 0),e([g({readOnly:!0})],U.prototype,"invalidCameraHeading",null),e([g()],U.prototype,"isAdditionalCoverageVisible",null),e([g()],U.prototype,"isAdditionalPointSourcesVisible",null),e([g()],U.prototype,"mapImageConversionToolState",null),e([g()],U.prototype,"measureType",null),e([g()],U.prototype,"layer",null),e([g()],U.prototype,"navigationToolActive",void 0),e([D(M()),g({type:E})],U.prototype,"viewModel",void 0),e([g(),$("esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer")],U.prototype,"messages",void 0),e([g(),$("esri/core/t9n/Units")],U.prototype,"measurementUnitMessages",void 0),e([g(),$("esri/t9n/common")],U.prototype,"messagesCommon",void 0),e([g(),$("esri/widgets/Sketch/t9n/Sketch")],U.prototype,"messagesSketch",void 0),e([g()],U.prototype,"pixelMeasurementUnit",void 0),e([g()],U.prototype,"pixelAreaMeasurementUnit",void 0),e([g({readOnly:!0})],U.prototype,"popupEnabled",null),e([g()],U.prototype,"referencePoint",null),e([g()],U.prototype,"showCameraLocations",void 0),e([g()],U.prototype,"showMapFeatures",void 0),e([D(["create","delete","redo","undo","update"]),g({readOnly:!0})],U.prototype,"sketchViewModel",null),e([g()],U.prototype,"view",null),e([g({type:V,nonNullable:!0})],U.prototype,"visibleElements",void 0),e([g()],U.prototype,"determineWorkflowForFeature",null),e([g()],U.prototype,"updateFootprint",null),e([g()],U.prototype,"_activeMeasurementIcon",null),e([g()],U.prototype,"_activeMeasurementHeading",null),e([g()],U.prototype,"_imageOverlaysLoaderTask",void 0),e([g()],U.prototype,"_imageMeasurementToolsLoaderTask",void 0),e([g()],U.prototype,"_measurementToggle",null),e([g()],U.prototype,"_renderRoot",null),e([g()],U.prototype,"_imageEnhancementTools",null),e([g()],U.prototype,"_imageGalleryPanel",null),e([g()],U.prototype,"_imageGalleryContext",null),e([g()],U.prototype,"_imageOverlaysComponent",null),e([g()],U.prototype,"_imageOverlayMessages",null),e([g()],U.prototype,"_imageSketchToolsMessages",null),e([g()],U.prototype,"_imageViewer",null),e([g()],U.prototype,"_locationToggle",null),e([g()],U.prototype,"_messageBox",null),e([g()],U.prototype,"_navigationToolExpanded",void 0),e([g()],U.prototype,"_navigationTool",void 0),e([g()],U.prototype,"_panoramicViewer",null),e([g()],U.prototype,"_renderNavigationUI",null),e([g()],U.prototype,"_warningTitleElement",void 0),e([g()],U.prototype,"_renderNavigation",null),e([g()],U.prototype,"_renderThumbnails",null),e([g()],U.prototype,"_sketchLoaderTask",void 0),U=e([m("esri.widgets.OrientedImageryViewer")],U);const R=U;export{R as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{prefersReducedMotion as t}from"../core/a11yUtils.js";import{createTask as i}from"../core/asyncUtils.js";import a from"../core/Collection.js";import{deprecatedProperty as s}from"../core/deprecate.js";import o from"../core/Logger.js";import{isAbortError as r}from"../core/promiseUtils.js";import{watch as n,initial as l,syncAndInitial as c,whenOnce as d}from"../core/reactiveUtils.js";import{property as g}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import{or as h}from"../layers/orientedImagery/transformations/utils.js";import u from"./Widget.js";import{getAllArcPath as p}from"./OrientedImageryViewer/arcUtils.js";import{defaultImageGeometryField as v,defaultOIObjectIDField as y,segmentArcs as w,sectorsRadii as _,featureCircleRadius as b,navigationToolDimensionLength as M,getDelegatedEvents as T}from"./OrientedImageryViewer/constants.js";import{css as C,navigation as I,navigationToolRotationFrom as f,navigationToolRotationTo as A,root as L}from"./OrientedImageryViewer/css.js";import{isFeatureAttachment as k,loadImageForAttachment as O,getThumbnailPixelBlock as S,renderImageWithRotation as F}from"./OrientedImageryViewer/galleryUtils.js";import E from"./OrientedImageryViewer/OrientedImageryViewerViewModel.js";import V from"./OrientedImageryViewer/OrientedImageryViewerVisibleElements.js";import P from"./OrientedImageryViewer/components/ImageLocationWidget.js";import x from"./OrientedImageryViewer/components/ImageViewer.js";import G from"./OrientedImageryViewer/components/NavigationUI.js";import{loadCalciteComponents as j}from"./support/componentsUtils.js";import{globalCss as $}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as D}from"./support/decorators/messageBundle.js";import{vmEvent as H}from"./support/decorators/vmEvent.js";import{tsx as B,tsxFragment as N}from"./support/jsxFactory.js";import{substitute as U}from"../intl/substitute.js";const R={overlayMapFeatures:"overlay-map-features",overlayed:"overlayed",overlaysActionHandles:"overlays-action-handles",directionsHandle:"directions-handle"};let W=class extends u{constructor(e,t){super(e,t),this.dataCaptureEnabled=!1,this.galleryOpened=!1,this.imageEnhancementToolActive=!1,this.directionToolsActive=!1,this.imageOverlaysOpened=!1,this.navigationToolActive=!1,this.viewModel=new E,this.messagesCommon=null,this.messagesSketch=null,this.pixelMeasurementUnit="meters",this.pixelAreaMeasurementUnit="square-meters",this.showCameraLocations=!1,this.showMapFeatures=!1,this.visibleElements=new V,this._imageOverlaysLoaderTask=null,this._imageMeasurementToolsLoaderTask=null,this._clearMeasurements=()=>{this.viewModel.measureType=null,this.viewModel.clearPreviousMeasurements()},this._clearImageLocation=()=>{this.imageLocationToolActive=!1},this._navigationToolExpanded=!1,this._navigationTool=null,this._warningTitleElement=null,this._galleryController=new AbortController,this._galleryObserver=new IntersectionObserver(this._lazyLoadImage.bind(this)),this._overlayedLayers=new a,this._previousAction=null,this._handleDataCaptureLayerChange=async e=>{if(this.dataCaptureLayer&&await this.stopDataCapture(!0),this.dataCaptureLayer=this.dataCaptureLayer===e?null:e,this.dataCaptureLayer)return this.startDataCapture(this.dataCaptureLayer)},this._handleOverlayLayerDeselect=e=>{const t=e.layer;t===this.dataCaptureLayer&&(this.stopDataCapture(),this.dataCaptureLayer=null),this.removeOverlayedGraphicsOnImage(`${t.id}`)},this._handleOverlayLayerSelect=e=>{const t=e.layer;this.viewModel.overlayMapFeatures(t,this.showMapFeatures),this.addHandles(n((()=>t.visible),(()=>{this.viewModel.toggleOverlayMapFeatures(t.id,t.visible)})),`${R.overlayed}-${t.id}`)},this._highlight=e=>{const t=e.target?.dataset.objectid;t&&this.viewModel.highlight(t)},this._onAction=e=>{const{target:t}=e,{dataset:{action:i}}=t,{_previousAction:a}=this,s=a?.dataset.action,o=s?.includes("draw")??!1,r="select-feature"===s,n=s!==i;switch(i){case"draw-point":case"draw-polygon":case"draw-polyline":{a&&h(r,o&&n)&&(a.active=!1),t.active=!t.active;const e=i.replace("draw-","");this.viewModel.digitizeCreate(e),this._previousAction=t.active?t:null;break}case"save":this.viewModel.saveDrawing();break;case"select-feature":o&&(this._previousAction.active=!1),t.active=!t.active,this.viewModel.toggleSelection(t.active),this._previousAction=t.active?t:null;break;case"delete-feature":this.viewModel.digitizeDelete()}},this._onImageOverlayClosed=()=>{this.imageOverlaysOpened=!1},this._onShowCameraLocationsChanged=e=>{this.showCameraLocations=e},this._onShowMapFeaturesChanged=e=>{this.showMapFeatures=e},this._removeHighlight=()=>this.viewModel.removeHighlight(),this._restoreOverlays=async()=>Promise.all(this._overlayedLayers.map((e=>this.viewModel.overlayMapFeatures(e,this.showMapFeatures)))),this._scaleNavigationTool=()=>{this._navigationToolExpanded=!this._navigationToolExpanded},this._sketchLoaderTask=null,this._toggleDirectionsTool=()=>{const e=this.directionToolsActive;this._closeAllImageTools(),this.directionToolsActive=!e},this._toggleImageAttributes=()=>{this.viewModel.toggleImageAttributes()},this._loadImageFromGallery=this._loadImageFromGallery.bind(this),this._registerGalleryItem=this._registerGalleryItem.bind(this),this._unregisterGalleryItem=this._unregisterGalleryItem.bind(this),this.loadImageFromSource=this.loadImageFromSource.bind(this),this.updateSuitabilities=this.updateSuitabilities.bind(this)}initialize(){this.addHandles([n((()=>[this.viewModel?.bestFeatureAngle,this._navigationTool]),(([e,t])=>{t&&this._updateNavigationTool(t)}),l),n((()=>this.currentCoverageVisible),(e=>this._onCurrentCoverageVisibilityChange(e))),n((()=>this.isAdditionalCoverageVisible),(e=>this._onAdditionalCoverageVisibilityChange(e))),n((()=>this.isAdditionalPointSourcesVisible),(e=>this._onAdditionalCameraLocationsVisibility(e))),n((()=>({features:this.currentBestFeature,showCameraLocations:this.showCameraLocations,state:this.viewModel.state})),(({showCameraLocations:e,state:t})=>{"image-loaded"===t&&this.viewModel.overlayCameraLocations(e)}),c),n((()=>({feature:this.currentBestFeature,showMapFeatures:this.showMapFeatures,state:this.viewModel.state})),(async(e,t)=>{if(e.showMapFeatures!==t?.showMapFeatures&&this.viewModel.toggleAllOverlayMapFeatures(e.showMapFeatures),null!=e.feature&&e.feature!==t?.feature){if(this.viewModel.removeAllOverlayMapFeatures(),await d((()=>"image-loaded"===this.viewModel.state)),this.dataCaptureLayer&&this.stopDataCapture(),await this._restoreOverlays(),!this.dataCaptureLayer)return;await this.startDataCapture(this.dataCaptureLayer),this._previousAction?.active&&(this._previousAction.active=!1,this._previousAction=null)}}),l)])}loadDependencies(){return j({"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group"),action:()=>import("@esri/calcite-components/dist/components/calcite-action"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),shell:()=>import("@esri/calcite-components/dist/components/calcite-shell"),dialog:()=>import("@esri/calcite-components/dist/components/calcite-dialog"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),slider:()=>import("@esri/calcite-components/dist/components/calcite-slider"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}destroy(){this._galleryController.abort(),this._galleryObserver.disconnect()}get accuracyParametersMissing(){return this.viewModel.accuracyParametersMissing}get activeLayer(){return s(o.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){s(o.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer=e}get currentBestFeature(){return this.viewModel.currentBestFeature}set currentBestFeature(e){this.viewModel.currentBestFeature=e}get currentCoverageVisible(){return this.viewModel.currentCoverageVisible}set currentCoverageVisible(e){this.viewModel.currentCoverageVisible=e}get dataCaptureLayer(){return this.viewModel.dataCaptureLayer}set dataCaptureLayer(e){this.viewModel.dataCaptureLayer=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get displayMessage(){return this.viewModel.displayMessage}get features(){return this.viewModel.features}get imagePointsInView(){return this.viewModel.imagePointsInView}get icon(){return"oriented-imagery-widget"}set icon(e){this._overrideIfSome("icon",e)}get imageGalleryEnabled(){return this.viewModel.imageGalleryEnabled}get imageLocationToolActive(){return this.viewModel.imageLocationToolState}set imageLocationToolActive(e){this.viewModel.imageLocationToolState=e}get invalidCameraHeading(){return this.viewModel.invalidCameraHeading}get isAdditionalCoverageVisible(){return this.viewModel.isAdditionalCoverageVisible}set isAdditionalCoverageVisible(e){this.viewModel.isAdditionalCoverageVisible=e}get isAdditionalPointSourcesVisible(){return this.viewModel.isAdditionalPointSourcesVisible}set isAdditionalPointSourcesVisible(e){this.viewModel.isAdditionalPointSourcesVisible=e}get mapImageConversionToolState(){return this.viewModel.mapImageConversionToolState}set mapImageConversionToolState(e){this.viewModel.mapImageConversionToolState=e}get measureType(){return this.viewModel.measureType}set measureType(e){this.viewModel.measureType=e}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get popupEnabled(){const{popupEnabled:e,state:t}=this.viewModel;return"image-loaded"===t&&e}get referencePoint(){return this.viewModel.referencePoint??null}get sketchViewModel(){return this.viewModel.sketch}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}set determineWorkflowForFeature(e){this.viewModel.determineWorkflowForFeature=e}get determineWorkflowForFeature(){return this.viewModel.determineWorkflowForFeature}set updateFootprint(e){this.viewModel.updateFootprint=e}get updateFootprint(){return this.viewModel.updateFootprint}_renderActionBar(){return B("calcite-action-bar",{expandDisabled:!0,layout:"horizontal",slot:"action-bar"},B("calcite-action-group",null,this._currentFootprintToggle(),this._additionalFootprintToggle(),this._additionalPointSourcesToggle()),B("calcite-action-group",null,this._mapImageConversionToggle(),this._navigationToolToggle(),this._directionToolToggle(),this._imageEnhancementsToggle()),B("calcite-action-group",null,this._measurementToolsToggle(),this._imageGalleryToggle(),this._imageOverlaysToggle(),this._openPopupAction()))}get _activeMeasurementIcon(){const{measureType:e,imageLocationToolActive:t}=this;if(t)return"pin-tear";switch(e){case"area":return"measure-area";case"height":return"measure-building-height-top-base";default:return"measure-line"}}get _activeMeasurementHeading(){const{measureType:e,messages:t,viewModel:i}=this,{triangularMeasurementActive:a}=i,{groundArea:s,heightAboveGround:o,groundDistance:r,triangulatedAreaHeading:n,triangulatedDistanceHeading:l}=t;if(a)return"area"===e?n:l;switch(e){case"area":return s;case"height":return o;default:return r}}_additionalFootprintToggle(){const{isAdditionalCoverageVisible:e,invalidCameraHeading:t,visibleElements:{additionalFootprintToggle:i}}=this;return i?B("calcite-action",{active:e,bind:this,class:C.addCoverage,disabled:t,icon:"trapezoid-area",onclick:this._toggleAdditionalCoverage,text:this.messages.additionalFootprints,title:this.messages.additionalFootprints}):null}_additionalPointSourcesToggle(){const{isAdditionalPointSourcesVisible:e,invalidCameraHeading:t,visibleElements:{additionalCameraLocationsToggle:i}}=this;return i?B("calcite-action",{active:e,bind:this,class:C.addExpPoints,disabled:t,icon:"circle-area",onclick:this._toggleAdditionalCameraLocations,text:this.messages.additionalCameraLocations,title:this.messages.additionalCameraLocations}):null}get _measurementToggle(){const{viewModel:{state:e,measureType:t,triangularMeasurementActive:i,currentBestFeatureMeasurementImage:a},id:s}=this;if("image-loaded"!==e||!t||i&&!a)return;this._imageMeasurementToolsLoaderTask||this._loadImageMeasurementResources();const o=this._imageMeasurementToolsLoaderTask?.value;return o?B("calcite-dialog",{bind:this,dragEnabled:!0,escapeDisabled:!0,heading:this._activeMeasurementHeading,id:`${s}-${t}-measurement`,open:!0,placement:"bottom-start",resizable:!0,scale:"s",slot:"dialogs",width:"s",onCalciteDialogBeforeClose:this._clearMeasurements},B(o,{measurementType:t,measurementUnitMessages:this.measurementUnitMessages,messages:this.messages,oiViewModel:this.viewModel})):null}get _renderRoot(){const{viewModel:{state:e,triangularMeasurementActive:t}}=this;return B("calcite-panel",null,B("calcite-shell",null,B("calcite-panel",{bind:this,class:t?C.viewerContainerMeasurement:C.viewerContainer,heading:this.visibleElements.title?this.messages.title:void 0,loading:e.includes("loading")&&!t},this.visibleElements.menu?this._renderActionBar():null,this._imageViewer,this._panoramicViewer,this._messageBox,this.invalidCameraHeading?[this._renderWarning(this.messages.invalidCameraHeadingWarningTitle),this._renderWarningTooltip(this.messages.invalidCameraHeadingWarningDescription)]:[this._imageGalleryPanel,this._renderNavigation,this._imageOverlaysPanel()],this._imageEnhancementTools,this._renderNavigationUI,this._renderSketch()),this._imageViewerTriangular,this._measurementToggle,this._locationToggle))}_currentFootprintToggle(){const{currentCoverageVisible:e,invalidCameraHeading:t}=this,{currentFootprintToggle:i}=this.visibleElements;return i?B("calcite-action",{active:e,bind:this,class:C.currentCoverage,disabled:t,icon:"trapezoid-area",onclick:this._toggleCurrentCoverage,text:this.messages.currentFootprint,title:this.messages.currentFootprint}):null}get _imageEnhancementTools(){const{imageEnhancementToolActive:e,viewModel:{brightness:t,contrast:i,sharpness:a,state:s}}=this;return e&&"image-loaded"===s?B("calcite-panel",{bind:this,class:C.imageEnhancementWrapper,closable:!0,closed:!e,heading:this.messages.imageEnhancement,key:this.messages.imageEnhancement,onCalcitePanelClose:this._toggleImageEnhancementToolState},B("div",{class:C.imageEnhancementTools},B("div",{class:C.imageEnhancementToolContainer},B("calcite-label",null,this.messages.brightness,B("calcite-slider",{bind:this,labelTicks:!0,max:10,min:-10,ticks:5,value:t,onCalciteSliderInput:this._handleBrightnessChange}))),B("div",{class:C.imageEnhancementToolContainer},B("calcite-label",null,this.messages.contrast,B("calcite-slider",{bind:this,labelTicks:!0,max:10,min:-10,ticks:5,value:i,onCalciteSliderInput:this._handleContrastChange}))),B("div",{class:C.imageEnhancementToolContainer},B("calcite-label",null,this.messages.sharpness,B("calcite-slider",{bind:this,labelTicks:!0,max:1,min:0,step:.1,ticks:.5,value:a,onCalciteSliderInput:this._handleSharpnessChange})))),B("calcite-action",{bind:this,icon:"reset",onclick:this._resetImageTools,slot:"header-actions-end",text:this.messagesCommon.reset,title:this.messagesCommon.reset})):null}_imageEnhancementsToggle(){const{state:e,mode:t}=this.viewModel,{imageEnhancement:i}=this.visibleElements;return i?B("calcite-action",{active:this.imageEnhancementToolActive,bind:this,disabled:"default"!==t||"image-loaded"!==e,icon:"sliders-horizontal",onclick:this._toggleImageEnhancementToolState,text:this.messages.imageEnhancement,title:this.messages.imageEnhancement}):null}get _imageGalleryPanel(){const{container:e,galleryOpened:t,imageGalleryEnabled:i}=this;return i&&t&&e?this._imageGalleryContext:null}get _imageGalleryContext(){const{galleryOpened:e,invalidCameraHeading:t}=this;return B("calcite-panel",{bind:this,class:C.carousel,closable:!0,closed:!e,disabled:t,heading:this.messages.imageGallery,key:this.messages.imageGallery,onCalcitePanelClose:this._toggleImageGallery},B("div",{class:C.carouselContainer},this._renderThumbnails))}_imageGalleryToggle(){const{imageGalleryEnabled:e,invalidCameraHeading:t,visibleElements:{imageGallery:i}}=this;return i?B("calcite-action",{active:this.galleryOpened,bind:this,disabled:!e||t,icon:"images",onclick:this._toggleImageGallery,text:this.messages.imageGallery,title:this.messages.imageGallery}):null}get _imageOverlaysComponent(){const{_imageOverlayMessages:e,_imageOverlaysLoaderTask:t,_overlayedLayers:a,dataCaptureEnabled:s,dataCaptureLayer:o,imageOverlaysOpened:r,showCameraLocations:n,showMapFeatures:l,view:c,layer:d}=this;if(!d)return null;const g=d.imageGeometryField?.length?d.imageGeometryField:v,m=d.imageReferenceField?.length?d.imageReferenceField:y;t||(this._imageOverlaysLoaderTask=i((async()=>(await import("./OrientedImageryViewer/components/ImageOverlays.js")).default)));const h=this._imageOverlaysLoaderTask?.value;return h?B(h,{closed:!r,dataCaptureEnabled:s,dataCaptureLayer:o,imageGeometryField:g,imageReferenceField:m,messages:e,overlayedLayers:a,showCameraLocations:n,showMapFeatures:l,view:c,onDataCaptureLayerChanged:this._handleDataCaptureLayerChange,onImageOverlaysClosed:this._onImageOverlayClosed,onLayerDeselected:this._handleOverlayLayerDeselect,onLayerSelected:this._handleOverlayLayerSelect,onShowCameraLocationsChanged:this._onShowCameraLocationsChanged,onShowMapFeaturesChanged:this._onShowMapFeaturesChanged}):null}get _imageOverlayMessages(){return{...this.messages,...this.messagesSketch}}get _imageSketchToolsMessages(){return{...this.messagesSketch,...this.messagesCommon}}_imageOverlaysPanel(){const{imageOverlaysOpened:e,viewModel:{state:t}}=this,i=this.classes({[C.imageOverlaysContainer]:!0,[$.hidden]:!e||"image-loaded"!==t});return B("div",{class:i,key:this.messages.imageOverlays},this._imageOverlaysComponent)}_imageOverlaysToggle(){const{viewModel:{state:e},imageOverlaysOpened:t,invalidCameraHeading:i,visibleElements:{imageOverlays:a}}=this;return a?B("calcite-action",{active:t,bind:this,disabled:"image-loaded"!==e||i,icon:"layers",onclick:this._toggleImageOverlays,text:this.messages.imageOverlays,title:this.messages.imageOverlays}):null}get _imageViewer(){const{displayMessage:e,loadImageViewer:t,mode:i}=this.viewModel,a=null!=e||"default"!==i,s=this.classes({[C.viewer]:!a,[C.viewerHidden]:a});return B("calcite-panel",{afterCreate:t,bind:this,class:s},this._renderSketch())}get _imageViewerTriangular(){const{messages:e}=this,{displayMessage:t,storeImageMeasurementViewer:i,mode:a,state:s,triangularMeasurementActive:o}=this.viewModel,r=null!=t||"default"!==a,n=this.classes({[C.viewer]:!r,[C.viewerHidden]:r});return o?B("calcite-panel",{class:C.viewerContainerMeasurement,heading:e.measurementViewerHeading,loading:s.includes("loading")},B("calcite-panel",{bind:this,class:n},B(x,{afterCreate:i}))):null}get _locationToggle(){const{viewModel:{state:e,groundCoordinates:t,groundCoordinatesAccuracy:i},imageLocationToolActive:a,messages:{groundLocation:s}}=this;if("image-loaded"===e&&t&&a)return B("calcite-dialog",{bind:this,dragEnabled:!0,escapeDisabled:!0,heading:s,id:s,open:!0,placement:"bottom-start",resizable:!0,scale:"s",slot:"dialogs",width:"s",onCalciteDialogBeforeClose:this._clearImageLocation},B(P,{accuracy:i,groundCoordinates:t,messages:this.messages}))}_mapImageConversionToggle(){const{mapImageConversionToolState:e,viewModel:{state:t},invalidCameraHeading:i,visibleElements:{mapImageConversionTool:a}}=this;return a?B("calcite-action",{active:e,bind:this,disabled:"image-loaded"!==t||i,icon:"image-pin",onclick:this._toggleMapImageConversionToolState,text:this.messages.mapImageConversionTool,title:this.messages.mapImageConversionTool}):null}_measurementToolsToggle(){const{_activeMeasurementIcon:e,measureType:t,viewModel:i,accuracyParametersMissing:a,messages:s,visibleElements:{measurementTools:o}}=this,{state:r,triangularMeasurementActive:n,mode:l}=i,{measurementTools:c,groundDistance:d,groundArea:g,heightAboveGround:m,groundLocation:h,triangulatedDistanceHeading:u,triangulatedAreaHeading:p}=s;return o?B("calcite-dropdown",{disabled:a,key:"measurement-tools",maxItems:5,title:c,width:"m"},B("calcite-action",{bind:this,disabled:"image-loaded"!==r||a,icon:e,slot:"trigger",text:c}),B("calcite-dropdown-group",null,B("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"measure-line",key:"distance-measurement",onclick:e=>this._toggleMeasurementSketch(e,"distance"),selected:"distance"===t&&!n},d),B("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"measure-area",key:"area-measurement",onclick:e=>this._toggleMeasurementSketch(e,"area"),selected:"area"===t&&!n},g),B("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"measure-building-height-top-base",key:"height-dropdown",onclick:e=>this._toggleMeasurementSketch(e,"height"),selected:"height"===t},m),B("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"pin-tear",key:"surface-location",onclick:e=>this._toggleLocationTool(e),selected:this.imageLocationToolActive},h),"default"===l&&B(N,null,B("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"image-mensuration",key:"triangular-measurement-distance",selected:!!n&&"distance"===this.measureType,onCalciteDropdownItemSelect:this._toggleTriangularDistanceMeasurements},u),B("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"image-mensuration",key:"triangular-measurement-area",selected:!!n&&"area"===this.measureType,onCalciteDropdownItemSelect:this._toggleTriangularAreaMeasurements},p)))):null}get _messageBox(){const{messages:e,viewModel:{displayMessage:t}}=this;if(!t)return null;const{data:i,key:a,map:s}=t,o=`${s?U(e[a],s):e[a]}`;return B("span",{class:C.messageBox},i?`${o} ${i}`:o)}_navigationToolToggle(){const{state:e}=this.viewModel,{visibleElements:{navigationTool:t}}=this;return t?B("calcite-action",{active:this.navigationToolActive,bind:this,disabled:"image-loaded"!==e||this.invalidCameraHeading,icon:"explore",onclick:this._toggleNavigationTool,text:this.messages.navigationTool,title:this.messages.navigationTool}):null}_directionToolToggle(){const{state:e,mode:t}=this.viewModel,{visibleElements:{directions:i}}=this;return i?B("calcite-action",{active:this.directionToolsActive,bind:this,disabled:"image-loaded"!==e||this.invalidCameraHeading||"panoramic"!==t,icon:"tour",onclick:this._toggleDirectionsTool,text:this.messages.imageNavigation,title:this.messages.imageNavigation}):null}_openPopupAction(){const{showPopupsAction:e}=this.visibleElements;return e?B("calcite-action",{bind:this,disabled:!this.popupEnabled,icon:"popup",onclick:this._toggleImageAttributes,text:this.messages.showPopups,title:this.messages.showPopups}):null}get _panoramicViewer(){const{displayMessage:e,loadPanoramicViewer:t,mode:i}=this.viewModel,a=null!=e||"panoramic"!==i,s=this.classes({[C.viewer]:!a,[C.viewerHidden]:a});return B("calcite-panel",{afterCreate:t,bind:this,class:s})}get _renderNavigationUI(){const{visibleElements:{directions:e},directionToolsActive:t,viewModel:i}=this;return"image-loaded"===i.state&&e&&t&&"panoramic"===i.mode?B(G,{currentNode:this.viewModel.currentNode,navigate:this.viewModel.navigate,nodes:this.viewModel.navigationNodes}):null}_closeAllImageTools(){this.imageEnhancementToolActive=!1,this.navigationToolActive=!1,this.imageOverlaysOpened=!1,this.galleryOpened=!1,this.measureType=null,this.imageLocationToolActive=!1,this.directionToolsActive=!1}_handleBrightnessChange(e){this.viewModel.brightness=e.currentTarget.value??0}_handleContrastChange(e){this.viewModel.contrast=e.currentTarget.value??0}_handleSharpnessChange(e){this.viewModel.sharpness=e.currentTarget.value??0}_lazyLoadImage(e,t){e.forEach((async e=>{if(e.isIntersecting){const a=e.target,s=a.getAttribute("data-src"),n=a.getAttribute("data-rotation"),l=a.getAttribute("data-objectid"),c=n?parseFloat(n)%360:0,{layer:d,_galleryController:{signal:g}}=this;if(!s||!l)return;let m;try{m=k(s)?await O(d,l,{signal:g}):await S(s,{signal:g})}catch(i){r(i)||o.getLogger("esri.widgets.OrientedImageryViewer").error("#lazyLoadImage()",i)}finally{t.unobserve(a)}if(!m)return;F(m,a,c)}}))}_loadImageFromGallery(e){const{target:t}=e;if(!t)return;const i=t.getAttribute("data-objectid");i&&this.viewModel.currentBestFeature?.attributes.objectId!==Number(i)&&this.viewModel.selectBestFeature(i)}_loadImageMeasurementResources(){this._imageMeasurementToolsLoaderTask=i((async()=>{const{default:e}=await import("./OrientedImageryViewer/components/ImageMeasurementWidget.js");return e}))}_loadSketchResources(){this._sketchLoaderTask=i((async()=>(await import("./OrientedImageryViewer/components/SketchTools.js")).default))}_onAdditionalCoverageVisibilityChange(e){this.viewModel.setAdditionalCoverageVisibility(e)}_onAdditionalCameraLocationsVisibility(e){this.viewModel.setAdditionalCameraLocationsVisibility(e)}_onCurrentCoverageVisibilityChange(e){this.viewModel.setCurrentCoverageVisibility(e)}_registerGalleryItem(e){this._galleryObserver.observe(e)}_renderWarning(e){const{invalidCameraHeading:t,viewModel:{state:i}}=this;return t&&"image-loaded"===i?[B("calcite-notice",{class:C.alert,closable:!0,icon:"exclamation-mark-triangle-f",iconFlipRtl:!0,kind:"warning",open:!0,scale:"s"},B("div",{afterCreate:e=>this._storeWarningTitleElement(e),slot:"title"},e))]:null}_renderWarningTooltip(e){const{_warningTitleElement:t}=this;if(e?.length&&t)return B("calcite-tooltip",{closeOnClick:!0,referenceElement:t},e)}get _renderNavigation(){const{viewModel:{sectorData:e,navigatorCurrentBestFeature:i,currentBestFeature:a,state:s}}=this;if(!this.container||!a)return null;let o,r,n,l,c;if(i){const{x:e,y:t,direction:a}=i,[s,d,g,m]=w[a];o=`M ${e} ${t} L ${s} ${d} A ${_[2]} ${_[2]} 0 0 1 ${g} ${m} Z`,r=e,l=t,n=w[a][4],c=w[a][5]}const d=e=>{const t=e.target.dataset?.sector;t&&this.viewModel.handleSectorClick(+t)},g=e=>{const t=e.target.dataset;if(!t)return;const{featureIndexInSector:i,sector:a}=t;i&&a&&this.viewModel.handleFeatureClick({sector:a,featureIndexInSector:+i})},m=e=>{e.removeEventListener("click",g)},h=a.attributes.objectId,u=e?.map((e=>e?.items)).filter(Boolean).flatMap((e=>e?.map((({x:e,y:t,objectID:i,featureIndexInSector:a,sector:s})=>B("circle",{afterRemoved:m,class:this.classes(C.feature,{selected:h===i}),cx:e,cy:t,"data-feature-index-in-sector":a,"data-sector":s,key:`${C.feature}-${i}`,onclick:g,r:b}))))),v=e=>{e.removeEventListener("click",d)},y=this.classes({[C.navigationWrapper]:!0,[C.navigationZoomed]:this._navigationToolExpanded});return this.navigationToolActive&&"image-loaded"===s?B("div",{bind:this,class:y,key:this.messages.navigationTool},B("svg",{afterCreate:e=>this._storeNavigationToolReference(e),class:t()?I:C.rotateWithAnimation,focusable:"false",height:M,role:"img",width:M,xmlns:"http://www.w3.org/2000/svg"},B("defs",null,B("linearGradient",{gradientUnits:"userSpaceOnUse",id:`${this.id}-coverage-fill`,x1:r,x2:n,y1:l,y2:c},B("stop",{class:C.navigationPathOffset0,offset:0}),B("stop",{class:C.navigationPathOffset1,offset:1}))),B("g",null,B("circle",{class:this.classes(C.sector,C.outerSector),cx:_[3],cy:_[3],onclick:this._scaleNavigationTool,r:_[3]}),B("circle",{class:C.sector,cx:_[3],cy:_[3],r:_[2]}),B("circle",{class:C.sector,cx:_[3],cy:_[3],r:_[1]}),B("circle",{class:C.sector,cx:_[3],cy:_[3],r:_[0]}),B("path",{class:C.pointer,d:"M 56.5 6.06217782649107 L 60 0 L 63.5 6.06217782649107 Z",key:`${C.pointer}-west`}),B("path",{class:this.classes(C.pointer,C.north),d:"M 113.93782217350893 56.5 L 120 60 L 113.93782217350893 63.5 Z",key:`${C.pointer}-north`}),B("path",{class:C.pointer,d:"M 56.5 113.93782217350893 L 60 120 L 63.5 113.93782217350893 Z",key:`${C.pointer}-east`}),B("path",{class:C.pointer,d:"M 6.06217782649107 56.5 L 0 60 L 6.06217782649107 63.5 Z",key:`${C.pointer}-south`}),B("path",{class:this.classes(C.sector,C.sectorSeparator),d:"M 23.937554159486076 23.937554159486076 L 96.06244584051393 96.06244584051393 M 23.937554159486076 96.06244584051393 L 96.06244584051393 23.937554159486076",key:C.sectorSeparator}),p([_[2],_[1],_[0]],_[3],_[3]).map(((t,i)=>B("path",{afterRemoved:v,class:this.classes(C.sector,e?.[i]?.length?C.sectorEnabled:C.sectorDisabled),d:t,"data-sector":`${i}`,key:`${C.sector}-${i}`,onclick:d}))),B("path",{class:this.classes(C.sector,C.sectorCross),d:"M 56.4 56.4 L 63.53 63.53 M 63.53 56.4 L 56.4 63.53",key:C.sectorCross}),u,a.attributes.cameraPitch>=5&&o?B("path",{class:C.selectedFeaturePath,d:o,fill:`url(#${this.id}-coverage-fill)`,key:C.selectedFeaturePath}):null))):null}_renderSketch(){const{dataCaptureLayer:e,imageOverlaysOpened:t}=this;if(!e||t)return null;if(this._sketchLoaderTask||this._loadSketchResources(),!this._sketchLoaderTask?.value)return null;const{geometryType:i}=e,a="point"===i?"pin":"polyline"===i?"line":"polygon",s=this._sketchLoaderTask.value;return B("div",{class:C.sketchTools},B(s,{icon:a,messages:this._imageSketchToolsMessages,type:i,onAction:this._onAction}))}get _renderThumbnails(){const{currentBestFeature:e,thumbnails:t}=this.viewModel;return e?B("div",{class:C.carouselContent},t?.items.map((({url:t,objectId:i,rotation:a},s)=>B("div",{class:`${C.carouselItemWrapper}${e.attributes.objectId===i?"--selected":""}`,key:`${C.carouselItemWrapper}-${s}`},B("canvas",{afterCreate:this._registerGalleryItem,afterRemoved:this._unregisterGalleryItem,alt:`thumbnail-${i}`,class:C.carouselItem,"data-objectid":`${i}`,"data-rotation":`${a}`,"data-src":t,onclick:this._loadImageFromGallery,onmouseenter:this._highlight,onmouseleave:this._removeHighlight}))))):null}_resetImageTools(){this.viewModel.sharpness=this.viewModel.brightness=this.viewModel.contrast=0}_storeNavigationToolReference(e){this._navigationTool=e}_storeWarningTitleElement(e){this._warningTitleElement=e}_toggleAdditionalCameraLocations(){this.isAdditionalPointSourcesVisible=!this.isAdditionalPointSourcesVisible}_toggleAdditionalCoverage(){this.isAdditionalCoverageVisible=!this.isAdditionalCoverageVisible}_toggleCurrentCoverage(){this.currentCoverageVisible=!this.currentCoverageVisible}_toggleImageEnhancementToolState(e){e.stopPropagation();const t=this.imageEnhancementToolActive;this._closeAllImageTools(),this.imageEnhancementToolActive=!t}_toggleImageOverlays(e){e.stopPropagation();const t=this.imageOverlaysOpened;this._closeAllImageTools(),this.imageOverlaysOpened=!t}_toggleImageGallery(e){e.stopPropagation();const t=this.galleryOpened;this._closeAllImageTools(),this.galleryOpened=!!this.imageGalleryEnabled&&!t}_toggleLocationTool(e){const t=this.imageLocationToolActive;this._closeAllImageTools(),this.imageLocationToolActive=!t,e.stopPropagation()}_toggleMeasurementSketch(e,t){e.stopPropagation();const i=this.measureType;this._closeAllImageTools(),this.measureType=i===t?null:t,this.measureType===t&&(this.viewModel.displayNewMeasurementButton=!0)}_toggleNavigationTool(){const e=this.navigationToolActive;this._closeAllImageTools(),this.navigationToolActive=!e}_toggleMapImageConversionToolState(){this.mapImageConversionToolState=!this.mapImageConversionToolState}_toggleTriangularAreaMeasurements(){this._toggleTriangularMeasurements("area")}_toggleTriangularDistanceMeasurements(){this._toggleTriangularMeasurements("distance")}_toggleTriangularMeasurements(e){const t=this.viewModel.triangularMeasurementActive,i=this.viewModel.measureType,a=this.navigationToolActive;t?e===i?(this._closeAllImageTools(),this.viewModel.triangularMeasurementActive=!t,this.navigationToolActive=!a):(this.imageLocationToolActive=!1,this.measureType=e):(this._closeAllImageTools(),this.measureType=e,this.viewModel.triangularMeasurementActive=!t,this.navigationToolActive=!!a||!a)}_unregisterGalleryItem(e){this._galleryObserver.unobserve(e)}_updateNavigationTool(e){const{previousFeatureAngle:t,bestFeatureAngle:i}=this.viewModel,a=(i-t+540)%360-180;e.style.setProperty(f,`${t}deg`),e.style.setProperty(A,`${t+a}deg`)}async loadBestImage(e){return this.viewModel.loadBestImage(e)}loadImageFromSource(e,t){return this.viewModel.loadImageFromSource(e,t)}async overlayMapFeatures(e,t){return this.removeHandles(`${R.overlayed}-${e.id}`),this.addHandles(n((()=>e.visible),(()=>{this.viewModel.toggleOverlayMapFeatures(e.id,e.visible)})),`${R.overlayed}-${e.id}`),this._overlayedLayers.add(e),this.viewModel.overlayMapFeatures(e,t&&this.showMapFeatures)}async plotMapPoint(e){return this.viewModel.plotMapPoint(e)}plotReferencePointOnGround(e){this.viewModel.plotReferencePointOnGround(e)}plotReferencePointOnImage(e){this.viewModel.plotReferencePointOnImage(e)}removeOverlayedGraphicsOnImage(e){this.removeHandles(`${R.overlayed}-${e}`),this._overlayedLayers.remove(this._overlayedLayers.find((t=>t.id===e))),this.viewModel.removeOverlayedGraphicsOnImage(e)}resetImage(){this.viewModel.resetImage()}render(){return B("div",{class:this.classes($.widget,L)},this._renderRoot)}async startDataCapture(e){return this.viewModel.startDataCapture(e)}async stopDataCapture(e){return this.viewModel.stopDataCapture(e)}updateSuitabilities(e){this.viewModel.updateSuitabilities(e)}};e([g({readOnly:!0})],W.prototype,"accuracyParametersMissing",null),e([g()],W.prototype,"activeLayer",null),e([g()],W.prototype,"currentBestFeature",null),e([g()],W.prototype,"currentCoverageVisible",null),e([g()],W.prototype,"dataCaptureEnabled",void 0),e([g()],W.prototype,"dataCaptureLayer",null),e([g()],W.prototype,"disabled",null),e([g()],W.prototype,"features",null),e([g()],W.prototype,"imagePointsInView",null),e([g()],W.prototype,"galleryOpened",void 0),e([g()],W.prototype,"icon",null),e([g()],W.prototype,"imageEnhancementToolActive",void 0),e([g({readOnly:!0})],W.prototype,"imageGalleryEnabled",null),e([g()],W.prototype,"imageLocationToolActive",null),e([g()],W.prototype,"directionToolsActive",void 0),e([g()],W.prototype,"imageOverlaysOpened",void 0),e([g({readOnly:!0})],W.prototype,"invalidCameraHeading",null),e([g()],W.prototype,"isAdditionalCoverageVisible",null),e([g()],W.prototype,"isAdditionalPointSourcesVisible",null),e([g()],W.prototype,"mapImageConversionToolState",null),e([g()],W.prototype,"measureType",null),e([g()],W.prototype,"layer",null),e([g()],W.prototype,"navigationToolActive",void 0),e([H(T()),g({type:E})],W.prototype,"viewModel",void 0),e([g(),D("esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer")],W.prototype,"messages",void 0),e([g(),D("esri/core/t9n/Units")],W.prototype,"measurementUnitMessages",void 0),e([g(),D("esri/t9n/common")],W.prototype,"messagesCommon",void 0),e([g(),D("esri/widgets/Sketch/t9n/Sketch")],W.prototype,"messagesSketch",void 0),e([g()],W.prototype,"pixelMeasurementUnit",void 0),e([g()],W.prototype,"pixelAreaMeasurementUnit",void 0),e([g({readOnly:!0})],W.prototype,"popupEnabled",null),e([g()],W.prototype,"referencePoint",null),e([g()],W.prototype,"showCameraLocations",void 0),e([g()],W.prototype,"showMapFeatures",void 0),e([H(["create","delete","redo","undo","update"]),g({readOnly:!0})],W.prototype,"sketchViewModel",null),e([g()],W.prototype,"view",null),e([g({type:V,nonNullable:!0})],W.prototype,"visibleElements",void 0),e([g()],W.prototype,"determineWorkflowForFeature",null),e([g()],W.prototype,"updateFootprint",null),e([g()],W.prototype,"_activeMeasurementIcon",null),e([g()],W.prototype,"_activeMeasurementHeading",null),e([g()],W.prototype,"_imageOverlaysLoaderTask",void 0),e([g()],W.prototype,"_imageMeasurementToolsLoaderTask",void 0),e([g()],W.prototype,"_measurementToggle",null),e([g()],W.prototype,"_renderRoot",null),e([g()],W.prototype,"_imageEnhancementTools",null),e([g()],W.prototype,"_imageGalleryPanel",null),e([g()],W.prototype,"_imageGalleryContext",null),e([g()],W.prototype,"_imageOverlaysComponent",null),e([g()],W.prototype,"_imageOverlayMessages",null),e([g()],W.prototype,"_imageSketchToolsMessages",null),e([g()],W.prototype,"_imageViewer",null),e([g()],W.prototype,"_imageViewerTriangular",null),e([g()],W.prototype,"_locationToggle",null),e([g()],W.prototype,"_messageBox",null),e([g()],W.prototype,"_navigationToolExpanded",void 0),e([g()],W.prototype,"_navigationTool",void 0),e([g()],W.prototype,"_panoramicViewer",null),e([g()],W.prototype,"_renderNavigationUI",null),e([g()],W.prototype,"_warningTitleElement",void 0),e([g()],W.prototype,"_renderNavigation",null),e([g()],W.prototype,"_renderThumbnails",null),e([g()],W.prototype,"_sketchLoaderTask",void 0),W=e([m("esri.widgets.OrientedImageryViewer")],W);const z=W;export{z as default};
package/widgets/Sketch.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{isSome as t}from"../core/arrayUtils.js";import{handlesGroup as o}from"../core/handleUtils.js";import i from"../core/Logger.js";import{removeMaybe as s,destroyMaybe as l}from"../core/maybe.js";import{ignoreAbortErrors as r}from"../core/promiseUtils.js";import{watch as n,syncAndInitial as a,when as c}from"../core/reactiveUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import u from"../views/interactive/sketch/SketchValueOptions.js";import h from"./Widget.js";import v from"./Sketch/SketchViewModel.js";import{VisibleElements as m}from"./Sketch/VisibleElements.js";import{LayoutPriority as g}from"./Sketch/support/sketchUtils.js";import f from"./Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js";import{loadCalciteComponents as _}from"./support/componentsUtils.js";import y from"./support/SelectionToolbar.js";import b from"./support/SketchTooltipControls.js";import w from"./support/SnappingControls.js";import"./support/widgetUtils.js";import{messageBundle as T}from"./support/decorators/messageBundle.js";import{vmEvent as M}from"./support/decorators/vmEvent.js";import{tsx as C}from"./support/jsxFactory.js";import O from"./support/SketchTooltipControls/VisibleElements.js";import{substitute as k}from"../intl/substitute.js";const S="esri-sketch",P={base:S,vertical:`${S}--vertical`,docked:`${S}-bar`,floating:`${S}-pad`,chipHorizontal:`${S}__selection-count-chip--horizontal`,chipVertical:`${S}__selection-count-chip--vertical`,chipVerticalSmall:`${S}__selection-count-chip--vertical--s`,popoverWrapper:`${S}__popover-wrapper`},I={point:"pin",polyline:"line",polygon:"polygon",rectangle:"rectangle",circle:"circle",multipoint:"pins",mesh:"i3d-building",freehandPolygon:"freehand-area",freehandPolyline:"freehand"};let R=class extends h{constructor(e,t){super(e,t),this._activeCustomToolOptions=null,this._selectionToolbar=null,this._viewModelHandlesGroup=null,this.availableCreateTools=["point","polyline","polygon","rectangle","circle"],this.customToolOptions=null,this.customActions=null,this.toolbarKind="floating",this.contextualToolLocation="separate",this.groupCollapsePriorities=null,this.messages=null,this.messagesCommon=null,this.visibleElements=new m,this._defaultViewModel=null,this._calcitePopoverReferenceElement=null,this._relativeLocation="top",this._popoverOpen=!1,this._activateCreateTool=this._activateCreateTool.bind(this),this.viewModel=e?.viewModel||(this._defaultViewModel=new v({creationMode:e?.creationMode??"continuous"}))}initialize(){const{layer:e,view:t}=this,i=new y({view:"2d"===t?.type?t:null,sources:e?[e]:null,scale:this.scale});this.addHandles([n((()=>this.viewModel),(e=>{this._viewModelHandlesGroup=s(this._viewModelHandlesGroup),e&&(this._viewModelHandlesGroup=o([e.on("create",(()=>this.scheduleRender())),e.on("update",(()=>this.scheduleRender())),e.on("delete",(e=>this.emit("delete",e))),e.on("undo",(()=>this.scheduleRender())),e.on("redo",(()=>this.scheduleRender())),n((()=>e.layer),(e=>{this._selectionToolbar&&(this._selectionToolbar.sources=e?[e]:null)})),n((()=>e.view),(e=>{this._selectionToolbar&&(this._selectionToolbar.view="2d"===e?.type?e:null)})),n((()=>e.state),(()=>this.notifyChange("state")))]))}),a),c((()=>i.activeToolInfo),(()=>this.viewModel.cancel())),i.on("complete",(e=>this._onSelectionOperationComplete(e))),n((()=>{const{selectionTools:e}=this.visibleElements;return{lassoTool:!!e?.["lasso-selection"],rectangleTool:!!e?.["rectangle-selection"]}}),(e=>{Object.assign(i.visibleElements,e)}),a)]),this._selectionToolbar=i}loadDependencies(){return _({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover")})}destroy(){this._selectionToolbar?.destroy(),this._viewModelHandlesGroup=s(this._viewModelHandlesGroup)}get activeTool(){const e=this._selectionToolbar?.activeToolInfo;if(e)switch(e.toolName){case"lasso":return"lasso-selection";case"rectangle":return"rectangle-selection";case"default":return"custom-selection"}const t=this._effectiveAvailableCreateTools,{activeTool:o,activeCreateToolDrawMode:i}=this.viewModel;return"polygon"===o&&"freehand"===i&&t?.includes("freehandPolygon")?"freehandPolygon":"polyline"===o&&"freehand"===i&&t?.includes("freehandPolyline")?"freehandPolyline":this.viewModel.activeTool}get activeTooltip(){return this.viewModel.activeTooltip}get createGraphic(){return this.viewModel.createGraphic}get creationMode(){return this.viewModel.creationMode}set creationMode(e){this.viewModel.creationMode=e}get defaultCreateOptions(){return this.viewModel.defaultCreateOptions}set defaultCreateOptions(e){this.viewModel.defaultCreateOptions=e}get defaultUpdateOptions(){return this.viewModel.defaultUpdateOptions}set defaultUpdateOptions(e){this.viewModel.defaultUpdateOptions=e}get icon(){return"pencil"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}set layout(e){this._set("layout",e),this._selectionToolbar&&(this._selectionToolbar.layout=e)}set scale(e){this._set("scale",e),this._selectionToolbar&&(this._selectionToolbar.scale=e)}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get state(){return this._selectionToolbar?.activeToolInfo?"active":this.viewModel.state}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get updateGraphics(){return this.viewModel.updateGraphics}get valueOptions(){return this.viewModel.valueOptions}set valueOptions(e){this.viewModel.valueOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}set viewModel(e){const t=this._get("viewModel");e!==t&&(t&&t===this._defaultViewModel&&l(t),this._set("viewModel",e))}get _effectiveAvailableCreateTools(){const{availableCreateTools:e,view:t,visibleElements:o}=this,i=e?.filter((e=>!!o.createTools?.[e]));return"3d"===t?.type?i?.filter((e=>"multipoint"!==e)):i}create(e,t,o){const i=o?.createOptions??t;return this._activeCustomToolOptions=o,r(this.viewModel.create(e,i))}update(e,t){return r(this.viewModel.update(e,t))}complete(){this.viewModel.complete()}cancel(){this._selectionToolbar?.cancel(),this.viewModel.cancel(),this._activeCustomToolOptions=null}undo(){this.viewModel.undo(),this.view?.focus()}redo(){this.viewModel.redo(),this.view?.focus()}delete(){this.viewModel.delete()}duplicate(){return this.viewModel.duplicate()}dismissFloatingElements(){this._popoverOpen=!1}render(){const{toolbarKind:e,layout:t,scale:o}=this,i=this.customActions?.filter((e=>"selection-toolbar"===e.position));return C("div",null,C("div",{classes:{[P.base]:!0,[P.floating]:"floating"===e,[P.docked]:"docked"===e,[P.vertical]:"vertical"===t}},C(f,{barStyle:e,layout:t,scale:o},this._renderSelectionSetItemGroupInline(),C("div",{"group-kind":"split-button",key:"selection-split-button",priority:this.groupCollapsePriorities?.get("selectionTools")??g.Low},this._renderDefaultSelectionButton(),this._selectionToolbar?.render(),i?.map((e=>this._renderToolbarItem(e)))),this._renderCreateToolActionGroup(),this._renderUndoRedoMenuItemGroup(),this._renderSettingsMenuItemGroup()),this._renderSelectionSetToolbar(),this._renderSettingsMenuPopover()))}_renderSettingsMenuPopover(){const{messagesCommon:e,snappingOptions:t,view:o,viewModel:i,visibleElements:s}=this;if(!this._calcitePopoverReferenceElement)return;const l={directionModePicker:s.directionModePicker,labelsToggle:s.labelsToggle,tooltipsToggle:s.tooltipsToggle},r="horizontal"===this.layout?"top"===this._relativeLocation?"bottom-end":"top-end":"right-end";return C("calcite-popover",{closable:!0,focusTrapDisabled:!0,heading:e.settings,label:e.settings,open:this._popoverOpen,overlayPositioning:"fixed",placement:r,referenceElement:this._calcitePopoverReferenceElement,scale:this.scale,onCalcitePopoverBeforeClose:()=>this._popoverOpen=!1,onCalcitePopoverBeforeOpen:e=>this._remeasurePopoverSizes(e.currentTarget),onCalcitePopoverClose:()=>this._refocusOnView()},C("div",{class:P.popoverWrapper},Object.values(l).includes(!0)?C(b,{sketchOptions:i.sketchOptions,viewType:o?.type,visibleElements:new O(l)}):void 0,s.snappingControls&&o&&t?C(w,{snappingManager:this.viewModel.snappingManager,snappingOptions:t,view:o,visibleElements:s.snappingControlsElements}):void 0))}_renderSelectionSetToolbar(){if("separate"!==this.contextualToolLocation)return;const e=this._renderSelectionSetItemGroup();return e?.length?C(f,{barStyle:this.toolbarKind,layout:this.layout,scale:this.scale},e):void 0}_renderSelectionSetItemGroupInline(){return"separate"===this.contextualToolLocation?[]:this._renderSelectionSetItemGroup()}_renderUndoRedoMenuItemGroup(){return C("div",{"group-kind":"split-button",key:"undo-redo-menu",priority:this.groupCollapsePriorities?.get("undoRedo")??g.Medium,slot:"actions-end"},this._renderUndoButton(),this._renderRedoButton())}_renderSettingsMenuItemGroup(){const e=[],o=[];this.customActions?.forEach((t=>{"settings-before"===t.position?o.push(t):"settings-after"===t.position&&e.push(t)}));const i=[...o.map((e=>this._renderToolbarItem(e))),this._renderSettingsMenuButton(),...e.map((e=>this._renderToolbarItem(e)))].filter(t);if(i.length)return C("div",{"allow-collapse":!1,"group-kind":"overflow-group",key:"settings-menu",priority:this.groupCollapsePriorities?.get("settings")??g.Max,slot:"actions-end"},i)}_renderSelectionSetItemGroup(){if(!this.updateGraphics.length)return[];const e="inline-end"===this.contextualToolLocation?"actions-end":void 0,t=this.customActions?.filter((e=>"before-selection-set"===e.position)),o=this.customActions?.filter((e=>"after-selection-set"===e.position)),i=this.groupCollapsePriorities?.get("selectionSet")??g.High;return[C("div",{"group-kind":"measured-content",key:"selection-count-chip-group",priority:i,slot:e},this._renderFeatureCountChip()),C("div",{"allow-collapse":!1,"group-kind":"overflow-group",key:"selection-set-tool-group",priority:i,slot:e},t?.map((e=>this._renderToolbarItem(e))),this._renderDuplicateButton(),this._renderDeleteButton(),o?.map((e=>this._renderToolbarItem(e))))]}_renderDefaultSelectionButton(){if(!this.viewModel.updateOnGraphicClick)return[];const{messages:e,state:t}=this;return this._renderToolbarItem({id:"pointer-select",text:e.selectFeature,icon:"cursor",onclick:this._activateDefaultSelectTool,active:"ready"===t})}_renderCreateToolActionGroup(){const e=this._effectiveAvailableCreateTools?.flatMap((e=>this._renderBuiltInCreateToolItem(e)))??[],t=this.customToolOptions?.flatMap((e=>this._renderCustomToolItem(e)))??[];return C("div",{"group-kind":"overflow-group",key:"create-tools-group",priority:this.groupCollapsePriorities?.get("createTools")??g.High},e,t)}_renderBuiltInCreateToolItem(e){return this._renderToolbarItem({id:`${e}-button`,text:this.messages.draw[e],icon:I[e],onclick:()=>this._activateCreateTool(e),active:this.activeTool===e&&!this._activeCustomToolOptions})}_renderCustomToolItem(e){const{toolKey:t}=e;return this._renderToolbarItem({id:`custom-${e.toolKey}`,text:e.label,icon:e.icon,onclick:()=>this._activateCreateTool(e.toolName,null,e),active:this._activeCustomToolOptions?.toolKey===t})}_renderUndoButton(){return this.visibleElements.undoRedoMenu?this._renderToolbarItem({id:"undo-button",text:this.messages.undo,icon:"undo",disabled:!this.viewModel.canUndo(),onclick:this.undo,flipRTL:!0}):[]}_renderRedoButton(){return this.visibleElements.undoRedoMenu?this._renderToolbarItem({id:"redo-button",text:this.messages.redo,icon:"redo",disabled:!this.viewModel.canRedo(),onclick:this.redo,flipRTL:!0}):[]}_renderSettingsMenuButton(){return this.visibleElements.settingsMenu?this._renderToolbarItem({id:"settings-menu-action",text:this.messagesCommon.settings,icon:"gear",active:this._popoverOpen,onclick:()=>this._popoverOpen=!this._popoverOpen,afterCreate:e=>this._calcitePopoverReferenceElement=e,afterUpdate:e=>this._calcitePopoverReferenceElement=e,afterRemoved:()=>this._calcitePopoverReferenceElement=null}):[]}_renderFeatureCountChip(){if(!this.visibleElements.selectionCountLabel)return[];const{layout:e,messages:t,scale:o,id:i,updateGraphics:{length:s}}=this,l=k(t.selectedCount,{count:s}),r="s"===o?99:999,n=s>r?k(t.selectedCountTruncated,{truncated:r}):s,a="s"===o&&"vertical"===e,c=a?`${i}-selection-chip-small`:`${i}-selection-chip`;return[a?C("span",{classes:{[P.chipVertical]:!0,[P.chipVerticalSmall]:"s"===this.scale},id:c,tabIndex:0,title:l},n):C("calcite-chip",{appearance:"outline",class:"horizontal"===e?P.chipHorizontal:P.chipVertical,id:c,kind:"brand",label:l,scale:"l"===o?"m":"s",tabIndex:0,title:"vertical"===e?l:void 0},"vertical"===e?n:l)]}_renderDuplicateButton(){if(!this.visibleElements.duplicateButton)return[];const{messages:e}=this;return this._renderToolbarItem({id:"duplicate",text:this.updateGraphics.length>1?e.duplicateFeatures:e.duplicateFeature,icon:"copy",onclick:this._onDuplicateSelect})}_renderDeleteButton(){if(!this.visibleElements.deleteButton)return[];const{messages:e}=this,t=this.updateGraphics.length>1?e.deleteFeatures:e.deleteFeature;return this._renderToolbarItem({id:"delete",text:t,icon:"trash",onclick:this.delete})}_renderToolbarItem({id:e,text:t,icon:o,disabled:i,onclick:s,active:l,flipRTL:r,afterCreate:n,afterUpdate:a,afterRemoved:c}){const p=`${this.id}-${e}`;return[C("calcite-action",{active:l,afterCreate:n,afterRemoved:c,afterUpdate:a,bind:this,"data-testid":e,disabled:i||"disabled"===this.state,icon:o,iconFlipRtl:r??!1,id:p,key:e,onclick:s,scale:this.scale,text:t,title:t})]}_remeasurePopoverSizes(e){try{const t=e.parentElement,o=this?.view?.container?.getBoundingClientRect(),i=t?.style;if(!(t&&o&&i&&this.view?.container?.contains(t)))return;const s=this._calcitePopoverReferenceElement;if(!s)return;const{bottom:l,top:r}=s.getBoundingClientRect();if("horizontal"===this.layout){const e=l<o.height/2;e!==("top"===this._relativeLocation)&&(this._relativeLocation=e?"top":"bottom"),e?(i?.setProperty("--sketch-view-height-offset",l-o.top+"px"),i?.setProperty("--sketch-view-margin-offset","30px")):(i?.setProperty("--sketch-view-height-offset",o.bottom-r+"px"),i?.setProperty("--sketch-view-margin-offset","15px"))}else"vertical"===this.layout&&(i.setProperty("--sketch-view-height-offset","15px"),i.setProperty("--sketch-view-margin-offset","15px"));const n=e.shadowRoot?.querySelector("div.header")?.getBoundingClientRect().height;i.setProperty("--sketch-popover-header-offset",`${n}px`)}catch(t){i.getLogger(this.declaredClass).warnOnce("Sketch failed to lay out settings menu.",t)}}_activateCreateTool(e,t,o){const i=this._activeCustomToolOptions;if(o||i){if(o?.toolKey===i?.toolKey)return void this.cancel()}else if(this.activeTool===e)return void this.cancel();this._selectionToolbar?.cancel(),this.create(e,t,o)}_onDuplicateSelect(){const e=this.duplicate(),t=this.viewModel.activeTool;"transform"!==t&&"reshape"!==t||this.update(e,{tool:t})}_onSelectionOperationComplete(e){const{viewModel:{defaultUpdateOptions:t}}=this,{selection:o}=e;if(!e.aborted&&o.length){const e=t.tool,i=o.length>1&&"reshape"===e?"transform":e;this.update(o,{...t,tool:i})}this.notifyChange("state")}_activateDefaultSelectTool(){this.cancel(),this.view?.focus()}_refocusOnView(){this.activeTool&&this.view?.focus()}};e([p()],R.prototype,"_activeCustomToolOptions",void 0),e([p()],R.prototype,"activeTool",null),e([p({readOnly:!0})],R.prototype,"activeTooltip",null),e([p({cast:e=>{if(!e?.length)return null;const t=new Set(["point","polyline","polygon","rectangle","circle","multipoint","freehandPolyline","freehandPolygon","mesh"]);return e.filter((e=>t.has(e)))}})],R.prototype,"availableCreateTools",void 0),e([p({readOnly:!0})],R.prototype,"createGraphic",null),e([p()],R.prototype,"creationMode",null),e([p()],R.prototype,"customToolOptions",void 0),e([p()],R.prototype,"customActions",void 0),e([p()],R.prototype,"defaultCreateOptions",null),e([p()],R.prototype,"defaultUpdateOptions",null),e([p()],R.prototype,"icon",null),e([p()],R.prototype,"label",null),e([p()],R.prototype,"labelOptions",null),e([p()],R.prototype,"layer",null),e([p({type:["horizontal","vertical"],value:"horizontal"})],R.prototype,"layout",null),e([p({value:"m"})],R.prototype,"scale",null),e([p()],R.prototype,"toolbarKind",void 0),e([p()],R.prototype,"contextualToolLocation",void 0),e([p()],R.prototype,"groupCollapsePriorities",void 0),e([p(),T("esri/widgets/Sketch/t9n/Sketch")],R.prototype,"messages",void 0),e([p(),T("esri/t9n/common")],R.prototype,"messagesCommon",void 0),e([p()],R.prototype,"snappingOptions",null),e([p()],R.prototype,"state",null),e([p()],R.prototype,"tooltipOptions",null),e([p({readOnly:!0})],R.prototype,"updateGraphics",null),e([p({type:u,nonNullable:!0})],R.prototype,"valueOptions",null),e([p()],R.prototype,"view",null),e([p({type:v}),M(["create","update","undo","redo"])],R.prototype,"viewModel",null),e([p({type:m,nonNullable:!0})],R.prototype,"visibleElements",void 0),e([p()],R.prototype,"_effectiveAvailableCreateTools",null),e([p()],R.prototype,"_defaultViewModel",void 0),e([p()],R.prototype,"_calcitePopoverReferenceElement",void 0),e([p()],R.prototype,"_relativeLocation",void 0),e([p()],R.prototype,"_popoverOpen",void 0),R=e([d("esri.widgets.Sketch")],R);const j=R;export{j as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{isSome as t}from"../core/arrayUtils.js";import{handlesGroup as o}from"../core/handleUtils.js";import i from"../core/Logger.js";import{removeMaybe as s,destroyMaybe as l}from"../core/maybe.js";import{ignoreAbortErrors as r}from"../core/promiseUtils.js";import{watch as n,syncAndInitial as a,when as c}from"../core/reactiveUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import u from"../views/interactive/sketch/SketchValueOptions.js";import h from"./Widget.js";import v from"./Sketch/SketchViewModel.js";import{VisibleElements as m}from"./Sketch/VisibleElements.js";import{LayoutPriority as g}from"./Sketch/support/sketchUtils.js";import f from"./Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js";import{loadCalciteComponents as _}from"./support/componentsUtils.js";import y from"./support/SelectionToolbar.js";import b from"./support/SketchTooltipControls.js";import w from"./support/SnappingControls.js";import"./support/widgetUtils.js";import{messageBundle as T}from"./support/decorators/messageBundle.js";import{vmEvent as M}from"./support/decorators/vmEvent.js";import{tsx as C}from"./support/jsxFactory.js";import O from"./support/SelectionToolbar/VisibleElements.js";import S from"./support/SketchTooltipControls/VisibleElements.js";import{substitute as k}from"../intl/substitute.js";const P="esri-sketch",I={base:P,vertical:`${P}--vertical`,docked:`${P}-bar`,floating:`${P}-pad`,chipHorizontal:`${P}__selection-count-chip--horizontal`,chipVertical:`${P}__selection-count-chip--vertical`,chipVerticalSmall:`${P}__selection-count-chip--vertical--s`,popoverWrapper:`${P}__popover-wrapper`},R={point:"pin",polyline:"line",polygon:"polygon",rectangle:"rectangle",circle:"circle",multipoint:"pins",mesh:"i3d-building",freehandPolygon:"freehand-area",freehandPolyline:"freehand"};let E=class extends h{constructor(e,t){super(e,t),this._activeCustomToolOptions=null,this._selectionToolbar=null,this._viewModelHandlesGroup=null,this.availableCreateTools=["point","polyline","polygon","rectangle","circle"],this.customToolOptions=null,this.customActions=null,this.toolbarKind="floating",this.contextualToolLocation="separate",this.groupCollapsePriorities=null,this.messages=null,this.messagesCommon=null,this.visibleElements=new m,this._defaultViewModel=null,this._calcitePopoverReferenceElement=null,this._relativeLocation="top",this._popoverOpen=!1,this._activateCreateTool=this._activateCreateTool.bind(this),this.viewModel=e?.viewModel||(this._defaultViewModel=new v({creationMode:e?.creationMode??"continuous"}))}initialize(){const{layer:e,view:t}=this,i=new y({visibleElements:new O({chip:!1,pan:!1,pointTool:!1}),view:"2d"===t?.type?t:null,sources:e?[e]:null,scale:this.scale});this.addHandles([n((()=>this.viewModel),(e=>{this._viewModelHandlesGroup=s(this._viewModelHandlesGroup),e&&(this._viewModelHandlesGroup=o([e.on("create",(()=>this.scheduleRender())),e.on("update",(()=>this.scheduleRender())),e.on("delete",(e=>this.emit("delete",e))),e.on("undo",(()=>this.scheduleRender())),e.on("redo",(()=>this.scheduleRender())),n((()=>e.layer),(e=>{this._selectionToolbar&&(this._selectionToolbar.sources=e?[e]:null)})),n((()=>e.view),(e=>{this._selectionToolbar&&(this._selectionToolbar.view="2d"===e?.type?e:null)})),n((()=>e.state),(()=>this.notifyChange("state")))]))}),a),c((()=>i.activeToolInfo),(()=>this.viewModel.cancel())),i.on("complete",(e=>this._onSelectionOperationComplete(e))),n((()=>{const{selectionTools:e}=this.visibleElements;return{lassoTool:!!e?.["lasso-selection"],rectangleTool:!!e?.["rectangle-selection"]}}),(e=>{Object.assign(i.visibleElements,e)}),a)]),this._selectionToolbar=i}loadDependencies(){return _({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover")})}destroy(){this._selectionToolbar?.destroy(),this._viewModelHandlesGroup=s(this._viewModelHandlesGroup)}get activeTool(){const e=this._selectionToolbar?.activeToolInfo;if(e)switch(e.toolName){case"lasso":return"lasso-selection";case"rectangle":return"rectangle-selection";case"default":return"custom-selection"}const t=this._effectiveAvailableCreateTools,{activeTool:o,activeCreateToolDrawMode:i}=this.viewModel;return"polygon"===o&&"freehand"===i&&t?.includes("freehandPolygon")?"freehandPolygon":"polyline"===o&&"freehand"===i&&t?.includes("freehandPolyline")?"freehandPolyline":this.viewModel.activeTool}get activeTooltip(){return this.viewModel.activeTooltip}get createGraphic(){return this.viewModel.createGraphic}get creationMode(){return this.viewModel.creationMode}set creationMode(e){this.viewModel.creationMode=e}get defaultCreateOptions(){return this.viewModel.defaultCreateOptions}set defaultCreateOptions(e){this.viewModel.defaultCreateOptions=e}get defaultUpdateOptions(){return this.viewModel.defaultUpdateOptions}set defaultUpdateOptions(e){this.viewModel.defaultUpdateOptions=e}get icon(){return"pencil"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}set layout(e){this._set("layout",e),this._selectionToolbar&&(this._selectionToolbar.layout=e)}set scale(e){this._set("scale",e),this._selectionToolbar&&(this._selectionToolbar.scale=e)}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get state(){return this._selectionToolbar?.activeToolInfo?"active":this.viewModel.state}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get updateGraphics(){return this.viewModel.updateGraphics}get valueOptions(){return this.viewModel.valueOptions}set valueOptions(e){this.viewModel.valueOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}set viewModel(e){const t=this._get("viewModel");e!==t&&(t&&t===this._defaultViewModel&&l(t),this._set("viewModel",e))}get _effectiveAvailableCreateTools(){const{availableCreateTools:e,view:t,visibleElements:o}=this,i=e?.filter((e=>!!o.createTools?.[e]));return"3d"===t?.type?i?.filter((e=>"multipoint"!==e)):i}create(e,t,o){const i=o?.createOptions??t;return this._activeCustomToolOptions=o,r(this.viewModel.create(e,i))}update(e,t){return r(this.viewModel.update(e,t))}complete(){this.viewModel.complete()}cancel(){this._selectionToolbar?.cancel(),this.viewModel.cancel(),this._activeCustomToolOptions=null}undo(){this.viewModel.undo(),this.view?.focus()}redo(){this.viewModel.redo(),this.view?.focus()}delete(){this.viewModel.delete()}duplicate(){return this.viewModel.duplicate()}dismissFloatingElements(){this._popoverOpen=!1}render(){const{toolbarKind:e,layout:t,scale:o}=this,i=this.customActions?.filter((e=>"selection-toolbar"===e.position));return C("div",null,C("div",{classes:{[I.base]:!0,[I.floating]:"floating"===e,[I.docked]:"docked"===e,[I.vertical]:"vertical"===t}},C(f,{barStyle:e,layout:t,scale:o},this._renderSelectionSetItemGroupInline(),C("div",{"group-kind":"split-button",key:"selection-split-button",priority:this.groupCollapsePriorities?.get("selectionTools")??g.Low},this._renderDefaultSelectionButton(),this._selectionToolbar?.render(),i?.map((e=>this._renderToolbarItem(e)))),this._renderCreateToolActionGroup(),this._renderUndoRedoMenuItemGroup(),this._renderSettingsMenuItemGroup()),this._renderSelectionSetToolbar(),this._renderSettingsMenuPopover()))}_renderSettingsMenuPopover(){const{messagesCommon:e,snappingOptions:t,view:o,viewModel:i,visibleElements:s}=this;if(!this._calcitePopoverReferenceElement)return;const l={directionModePicker:s.directionModePicker,labelsToggle:s.labelsToggle,tooltipsToggle:s.tooltipsToggle},r="horizontal"===this.layout?"top"===this._relativeLocation?"bottom-end":"top-end":"right-end";return C("calcite-popover",{closable:!0,focusTrapDisabled:!0,heading:e.settings,label:e.settings,open:this._popoverOpen,overlayPositioning:"fixed",placement:r,referenceElement:this._calcitePopoverReferenceElement,scale:this.scale,onCalcitePopoverBeforeClose:()=>this._popoverOpen=!1,onCalcitePopoverBeforeOpen:e=>this._remeasurePopoverSizes(e.currentTarget),onCalcitePopoverClose:()=>this._refocusOnView()},C("div",{class:I.popoverWrapper},Object.values(l).includes(!0)?C(b,{sketchOptions:i.sketchOptions,viewType:o?.type,visibleElements:new S(l)}):void 0,s.snappingControls&&o&&t?C(w,{snappingManager:this.viewModel.snappingManager,snappingOptions:t,view:o,visibleElements:s.snappingControlsElements}):void 0))}_renderSelectionSetToolbar(){if("separate"!==this.contextualToolLocation)return;const e=this._renderSelectionSetItemGroup();return e?.length?C(f,{barStyle:this.toolbarKind,layout:this.layout,scale:this.scale},e):void 0}_renderSelectionSetItemGroupInline(){return"separate"===this.contextualToolLocation?[]:this._renderSelectionSetItemGroup()}_renderUndoRedoMenuItemGroup(){return C("div",{"group-kind":"split-button",key:"undo-redo-menu",priority:this.groupCollapsePriorities?.get("undoRedo")??g.Medium,slot:"actions-end"},this._renderUndoButton(),this._renderRedoButton())}_renderSettingsMenuItemGroup(){const e=[],o=[];this.customActions?.forEach((t=>{"settings-before"===t.position?o.push(t):"settings-after"===t.position&&e.push(t)}));const i=[...o.map((e=>this._renderToolbarItem(e))),this._renderSettingsMenuButton(),...e.map((e=>this._renderToolbarItem(e)))].filter(t);if(i.length)return C("div",{"allow-collapse":!1,"group-kind":"overflow-group",key:"settings-menu",priority:this.groupCollapsePriorities?.get("settings")??g.Max,slot:"actions-end"},i)}_renderSelectionSetItemGroup(){if(!this.updateGraphics.length)return[];const e="inline-end"===this.contextualToolLocation?"actions-end":void 0,t=this.customActions?.filter((e=>"before-selection-set"===e.position)),o=this.customActions?.filter((e=>"after-selection-set"===e.position)),i=this.groupCollapsePriorities?.get("selectionSet")??g.High;return[C("div",{"group-kind":"measured-content",key:"selection-count-chip-group",priority:i,slot:e},this._renderFeatureCountChip()),C("div",{"allow-collapse":!1,"group-kind":"overflow-group",key:"selection-set-tool-group",priority:i,slot:e},t?.map((e=>this._renderToolbarItem(e))),this._renderDuplicateButton(),this._renderDeleteButton(),o?.map((e=>this._renderToolbarItem(e))))]}_renderDefaultSelectionButton(){if(!this.viewModel.updateOnGraphicClick)return[];const{messages:e,state:t}=this;return this._renderToolbarItem({id:"pointer-select",text:e.selectFeature,icon:"cursor",onclick:this._activateDefaultSelectTool,active:"ready"===t})}_renderCreateToolActionGroup(){const e=this._effectiveAvailableCreateTools?.flatMap((e=>this._renderBuiltInCreateToolItem(e)))??[],t=this.customToolOptions?.flatMap((e=>this._renderCustomToolItem(e)))??[];return C("div",{"group-kind":"overflow-group",key:"create-tools-group",priority:this.groupCollapsePriorities?.get("createTools")??g.High},e,t)}_renderBuiltInCreateToolItem(e){return this._renderToolbarItem({id:`${e}-button`,text:this.messages.draw[e],icon:R[e],onclick:()=>this._activateCreateTool(e),active:this.activeTool===e&&!this._activeCustomToolOptions})}_renderCustomToolItem(e){const{toolKey:t}=e;return this._renderToolbarItem({id:`custom-${e.toolKey}`,text:e.label,icon:e.icon,onclick:()=>this._activateCreateTool(e.toolName,null,e),active:this._activeCustomToolOptions?.toolKey===t})}_renderUndoButton(){return this.visibleElements.undoRedoMenu?this._renderToolbarItem({id:"undo-button",text:this.messages.undo,icon:"undo",disabled:!this.viewModel.canUndo(),onclick:this.undo,flipRTL:!0}):[]}_renderRedoButton(){return this.visibleElements.undoRedoMenu?this._renderToolbarItem({id:"redo-button",text:this.messages.redo,icon:"redo",disabled:!this.viewModel.canRedo(),onclick:this.redo,flipRTL:!0}):[]}_renderSettingsMenuButton(){return this.visibleElements.settingsMenu?this._renderToolbarItem({id:"settings-menu-action",text:this.messagesCommon.settings,icon:"gear",active:this._popoverOpen,onclick:()=>this._popoverOpen=!this._popoverOpen,afterCreate:e=>this._calcitePopoverReferenceElement=e,afterUpdate:e=>this._calcitePopoverReferenceElement=e,afterRemoved:()=>this._calcitePopoverReferenceElement=null}):[]}_renderFeatureCountChip(){if(!this.visibleElements.selectionCountLabel)return[];const{layout:e,messages:t,scale:o,id:i,updateGraphics:{length:s}}=this,l=k(t.selectedCount,{count:s}),r="s"===o?99:999,n=s>r?k(t.selectedCountTruncated,{truncated:r}):s,a="s"===o&&"vertical"===e,c=a?`${i}-selection-chip-small`:`${i}-selection-chip`;return[a?C("span",{classes:{[I.chipVertical]:!0,[I.chipVerticalSmall]:"s"===this.scale},id:c,tabIndex:0,title:l},n):C("calcite-chip",{appearance:"outline",class:"horizontal"===e?I.chipHorizontal:I.chipVertical,id:c,kind:"brand",label:l,scale:"l"===o?"m":"s",tabIndex:0,title:"vertical"===e?l:void 0},"vertical"===e?n:l)]}_renderDuplicateButton(){if(!this.visibleElements.duplicateButton)return[];const{messages:e}=this;return this._renderToolbarItem({id:"duplicate",text:this.updateGraphics.length>1?e.duplicateFeatures:e.duplicateFeature,icon:"copy",onclick:this._onDuplicateSelect})}_renderDeleteButton(){if(!this.visibleElements.deleteButton)return[];const{messages:e}=this,t=this.updateGraphics.length>1?e.deleteFeatures:e.deleteFeature;return this._renderToolbarItem({id:"delete",text:t,icon:"trash",onclick:this.delete})}_renderToolbarItem({id:e,text:t,icon:o,disabled:i,onclick:s,active:l,flipRTL:r,afterCreate:n,afterUpdate:a,afterRemoved:c}){const p=`${this.id}-${e}`;return[C("calcite-action",{active:l,afterCreate:n,afterRemoved:c,afterUpdate:a,bind:this,"data-testid":e,disabled:i||"disabled"===this.state,icon:o,iconFlipRtl:r??!1,id:p,key:e,onclick:s,scale:this.scale,text:t,title:t})]}_remeasurePopoverSizes(e){try{const t=e.parentElement,o=this?.view?.container?.getBoundingClientRect(),i=t?.style;if(!(t&&o&&i&&this.view?.container?.contains(t)))return;const s=this._calcitePopoverReferenceElement;if(!s)return;const{bottom:l,top:r}=s.getBoundingClientRect();if("horizontal"===this.layout){const e=l<o.height/2;e!==("top"===this._relativeLocation)&&(this._relativeLocation=e?"top":"bottom"),e?(i?.setProperty("--sketch-view-height-offset",l-o.top+"px"),i?.setProperty("--sketch-view-margin-offset","30px")):(i?.setProperty("--sketch-view-height-offset",o.bottom-r+"px"),i?.setProperty("--sketch-view-margin-offset","15px"))}else"vertical"===this.layout&&(i.setProperty("--sketch-view-height-offset","15px"),i.setProperty("--sketch-view-margin-offset","15px"));const n=e.shadowRoot?.querySelector("div.header")?.getBoundingClientRect().height;i.setProperty("--sketch-popover-header-offset",`${n}px`)}catch(t){i.getLogger(this.declaredClass).warnOnce("Sketch failed to lay out settings menu.",t)}}_activateCreateTool(e,t,o){const i=this._activeCustomToolOptions;if(o||i){if(o?.toolKey===i?.toolKey)return void this.cancel()}else if(this.activeTool===e)return void this.cancel();this._selectionToolbar?.cancel(),this.create(e,t,o)}_onDuplicateSelect(){const e=this.duplicate(),t=this.viewModel.activeTool;"transform"!==t&&"reshape"!==t||this.update(e,{tool:t})}_onSelectionOperationComplete(e){const{viewModel:{defaultUpdateOptions:t}}=this,{selection:o}=e;if(!e.aborted&&o.length){const e=t.tool,i=o.length>1&&"reshape"===e?"transform":e;this.update(o,{...t,tool:i})}this.notifyChange("state")}_activateDefaultSelectTool(){this.cancel(),this.view?.focus()}_refocusOnView(){this.activeTool&&this.view?.focus()}};e([p()],E.prototype,"_activeCustomToolOptions",void 0),e([p()],E.prototype,"activeTool",null),e([p({readOnly:!0})],E.prototype,"activeTooltip",null),e([p({cast:e=>{if(!e?.length)return null;const t=new Set(["point","polyline","polygon","rectangle","circle","multipoint","freehandPolyline","freehandPolygon","mesh"]);return e.filter((e=>t.has(e)))}})],E.prototype,"availableCreateTools",void 0),e([p({readOnly:!0})],E.prototype,"createGraphic",null),e([p()],E.prototype,"creationMode",null),e([p()],E.prototype,"customToolOptions",void 0),e([p()],E.prototype,"customActions",void 0),e([p()],E.prototype,"defaultCreateOptions",null),e([p()],E.prototype,"defaultUpdateOptions",null),e([p()],E.prototype,"icon",null),e([p()],E.prototype,"label",null),e([p()],E.prototype,"labelOptions",null),e([p()],E.prototype,"layer",null),e([p({type:["horizontal","vertical"],value:"horizontal"})],E.prototype,"layout",null),e([p({value:"m"})],E.prototype,"scale",null),e([p()],E.prototype,"toolbarKind",void 0),e([p()],E.prototype,"contextualToolLocation",void 0),e([p()],E.prototype,"groupCollapsePriorities",void 0),e([p(),T("esri/widgets/Sketch/t9n/Sketch")],E.prototype,"messages",void 0),e([p(),T("esri/t9n/common")],E.prototype,"messagesCommon",void 0),e([p()],E.prototype,"snappingOptions",null),e([p()],E.prototype,"state",null),e([p()],E.prototype,"tooltipOptions",null),e([p({readOnly:!0})],E.prototype,"updateGraphics",null),e([p({type:u,nonNullable:!0})],E.prototype,"valueOptions",null),e([p()],E.prototype,"view",null),e([p({type:v}),M(["create","update","undo","redo"])],E.prototype,"viewModel",null),e([p({type:m,nonNullable:!0})],E.prototype,"visibleElements",void 0),e([p()],E.prototype,"_effectiveAvailableCreateTools",null),e([p()],E.prototype,"_defaultViewModel",void 0),e([p()],E.prototype,"_calcitePopoverReferenceElement",void 0),e([p()],E.prototype,"_relativeLocation",void 0),e([p()],E.prototype,"_popoverOpen",void 0),E=e([d("esri.widgets.Sketch")],E);const j=E;export{j as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import o from"./FeatureItem.js";import s from"./ItemBase.js";let i=class extends s{constructor(e){super(e),this._onChangeController=null,this.layer=null,this.selection=[]}get effectiveObjectIds(){return this.objectIds.slice(0,this.maxVisibleFeatureCountPerLayer)}get maxVisibleFeatureCountExceeded(){return this.objectIds.length>this.viewModel.maxVisibleFeatureCountPerLayer}get maxVisibleFeatureCountPerLayer(){return this.viewModel.maxVisibleFeatureCountPerLayer}get objectIds(){return this.viewModel.selectionsByLayerMap.get(this.layer)??[]}get total(){return this.objectIds.length}cancel(){this._onChangeController?.abort()}async sync({controller:e,promises:t}){this.cancel();const r=this.selection.slice(),o=new Map(r.map((e=>[e.objectId,e]))),s=this.effectiveObjectIds.slice(),i=[],a=[];for(const n of s){const e=o.get(n);e?(i.push(e),t.push(e.sync(t))):a.push(n)}if(this._onChangeController=e,a.length>0){const r=await this._createFeatureItems(a,e);for(const e of r)i.push(e),t.push(e.sync(t))}e.signal.aborted||(this.selection=i)}async _createFeatureItems(e,t){const{layer:r,layerView:s,viewModel:i}=this,a=new Map;if(s){const o=s.createQuery();o.objectIds=e,o.outFields=["*"],o.returnGeometry=!0;const i=await s.queryFeatures(o,t),{objectIdField:n}=r;for(const e of i?.features??[])a.set(e.attributes[n],e)}if(t.signal.aborted)return[];const n=e.filter((e=>!a.has(e)));if(n.length){const e=r.createQuery();e.objectIds=n,e.outSpatialReference=this.view?.spatialReference,e.outFields=["*"],e.returnGeometry=!0;const o=await r.queryFeatures(e,t);for(const t of o.features??[])a.set(t.attributes[r.objectIdField],t)}return Array.from(a.values()).map((e=>new o({layer:r,graphic:e,viewModel:i})))}};e([t()],i.prototype,"_onChangeController",void 0),e([t()],i.prototype,"effectiveObjectIds",null),e([t()],i.prototype,"layer",void 0),e([t()],i.prototype,"maxVisibleFeatureCountExceeded",null),e([t()],i.prototype,"maxVisibleFeatureCountPerLayer",null),e([t()],i.prototype,"objectIds",null),e([t()],i.prototype,"selection",void 0),e([t()],i.prototype,"total",null),i=e([r("esri.widgets.support.SelectionList.LayerItem")],i);const a=i;export{a as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import o from"./FeatureItem.js";import s from"./ItemBase.js";let i=class extends s{constructor(e){super(e),this._onChangeController=null,this.layer=null,this.selection=[]}get effectiveObjectIds(){return this.objectIds.slice(0,this.maxVisibleFeatureCountPerLayer)}get maxVisibleFeatureCountExceeded(){return this.objectIds.length>this.viewModel.maxVisibleFeatureCountPerLayer}get maxVisibleFeatureCountPerLayer(){return this.viewModel.maxVisibleFeatureCountPerLayer}get objectIds(){return this.viewModel.effectiveSelectionManager?.getSelection(this.layer)??[]}get total(){return this.objectIds.length}cancel(){this._onChangeController?.abort()}async sync({controller:e,promises:t}){this.cancel();const r=this.selection.slice(),o=new Map(r.map((e=>[e.objectId,e]))),s=this.effectiveObjectIds.slice(),i=[],a=[];for(const n of s){const e=o.get(n);e?(i.push(e),t.push(e.sync(t))):a.push(n)}if(this._onChangeController=e,a.length>0){const r=await this._createFeatureItems(a,e);for(const e of r)i.push(e),t.push(e.sync(t))}e.signal.aborted||(this.selection=i)}async _createFeatureItems(e,t){const{layer:r,layerView:s,viewModel:i}=this,a=new Map;if(s){const o=s.createQuery();o.objectIds=e,o.outFields=["*"],o.returnGeometry=!0;const i=await s.queryFeatures(o,t),{objectIdField:n}=r;for(const e of i?.features??[])a.set(e.attributes[n],e)}if(t.signal.aborted)return[];const n=e.filter((e=>!a.has(e)));if(n.length){const e=r.createQuery();e.objectIds=n,e.outSpatialReference=this.view?.spatialReference,e.outFields=["*"],e.returnGeometry=!0;const o=await r.queryFeatures(e,t);for(const t of o.features??[])a.set(t.attributes[r.objectIdField],t)}return Array.from(a.values()).map((e=>new o({layer:r,graphic:e,viewModel:i})))}};e([t()],i.prototype,"_onChangeController",void 0),e([t()],i.prototype,"effectiveObjectIds",null),e([t()],i.prototype,"layer",void 0),e([t()],i.prototype,"maxVisibleFeatureCountExceeded",null),e([t()],i.prototype,"maxVisibleFeatureCountPerLayer",null),e([t()],i.prototype,"objectIds",null),e([t()],i.prototype,"selection",void 0),e([t()],i.prototype,"total",null),i=e([r("esri.widgets.support.SelectionList.LayerItem")],i);const a=i;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/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import o from"../../../core/Logger.js";import{removeMaybe as r}from"../../../core/maybe.js";import{ignoreAbortErrors as i,debounce as s}from"../../../core/promiseUtils.js";import{watch as n,on as a}from"../../../core/reactiveUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as h}from"../../../core/support/UpdatingHandles.js";import{isSubtypeGroupLayer as p,isSubtypeSublayer as g}from"../../../layers/support/layerUtils.js";import{isSelectableLayer as m}from"../../../views/support/selectionUtils.js";import{goTo as y}from"../goToUtils.js";import u from"./GroupLayerItem.js";import f from"./LayerItem.js";import{computeEffectiveCount as d,isLayerItem as v,isGroupLayerItem as S,getNestedFeatureItems as C}from"./selectionListUtils.js";const I=100;let _=class extends t{constructor(e){super(e),this._groupItemCache=new Map,this._hoverHighlightHandle=null,this._layerItemCache=new Map,this._layerItems=null,this._onChangeAbortController=null,this._updatingHandles=new h,this.featureTitleMap=new Map,this.maxVisibleFeatureCountPerLayer=500,this.selectionManager=null,this._onSelectionChangeController=async()=>{this._cancelOnSelectionChange();const e=new AbortController;this._onChangeAbortController=e,await this._updatingHandles.addPromise(i(this._onSelectionChange(e))),this._onChangeAbortController===e&&(this._onChangeAbortController=null)},this._cancelOnSelectionChange=()=>this._onChangeAbortController?.abort(),this._onSelectionChangeDebounced=s(this._onSelectionChangeController,I)}initialize(){this.addHandles([n((()=>[this.view,this.effectiveSelectionManager]),(()=>this._onSelectionChangeDebounced())),a((()=>this.effectiveSelectionManager?.sources),"change",(()=>this._onSelectionChangeDebounced())),a((()=>this.effectiveSelectionManager),"selection-change",(()=>this._onSelectionChangeDebounced()))])}destroy(){this.removeTemporaryHighlight(),this._updatingHandles.destroy()}get effectiveCount(){return d(this.layerItems)}get effectiveSelectionManager(){return this.selectionManager??this.view?.selectionManager}get isUpdating(){return!(!this._onChangeAbortController&&!this._updatingHandles.updating)}get layerItems(){return this._layerItems??[]}get layerViewMap(){const e=new Map,{view:t}=this;if(!t)return e;for(const o of t.allLayerViews)if(e.set(o.layer.id,o),p(o.layer))for(const t of o.layer.sublayers)e.set(t.id,o);return e}get maxVisibleFeatureCountExceeded(){return this.layerItems.some((e=>e.maxVisibleFeatureCountExceeded))}get selectionSources(){const e=this.effectiveSelectionManager,t=new Set;if(e?.sources)for(const o of e.sources)t.add(o);return t}get selectionsByLayerMap(){const e=this.effectiveSelectionManager,t=new Map;if(!e||"ready"!==this.state)return t;for(const{layer:o,selection:r}of e.selections)t.set(o,r);return t}get state(){const{view:e}=this;return e?e.ready?this.effectiveSelectionManager?"ready":"error":"loading":"disabled"}get totalCount(){return this.effectiveSelectionManager?.count??0}get viewLayersAndTables(){const{view:e}=this;return e?.map?[...e.map.layers.toArray().reverse(),...e.map.tables.toArray().reverse()]:[]}addTemporaryHighlight({graphic:e,layerView:t}){this.removeTemporaryHighlight(),t&&e&&(this._hoverHighlightHandle=t.highlight(e,{name:"temporary"}))}clear(){this.effectiveSelectionManager?.clear()}deselectFeatureItem(e){const t=e.graphic.getObjectId();null!=t&&this.effectiveSelectionManager?.removeFromSelection(e.layer,[t])}deselectGroupItem(e){e.children.forEach((e=>{v(e)?this.deselectLayerItem(e):this.deselectGroupItem(e)}))}deselectLayerItem(e){this.effectiveSelectionManager?.setSelection(e.layer,[])}deselectItem(e){S(e)?this.deselectGroupItem(e):v(e)?this.deselectLayerItem(e):this.deselectFeatureItem(e)}goToItem(e){v(e)||S(e)?this._goTo(C([e]).map((e=>e.graphic))):this._goTo(e.graphic)}layersToItems(e){const{controller:t,layers:o,promises:r}=e,{_groupItemCache:i,_layerItemCache:s,effectiveSelectionManager:n,viewLayersAndTables:a}=this,l=o??a;if(!n)return[];const c=[];for(const h of l)switch(h.type){case"subtype-group":case"group":{const e=i.get(h),o=e??new u({layer:h,viewModel:this});e||i.set(h,o),r.push(o.sync({controller:t,promises:r})),c.push(o)}break;default:if(m(h)||g(h)){const e=h,o=n.getSelection(e);if(!o?.length)continue;const i=s.get(e),a=i??new f({layer:e,viewModel:this});i||s.set(e,a),r.push(a.sync({controller:t,promises:r})),c.push(a)}}return c}removeFromSelection(e){this.effectiveSelectionManager?.removeFromSelection(e.layer,e.objectIds)}removeTemporaryHighlight(){this._hoverHighlightHandle=r(this._hoverHighlightHandle)}selectSingleFeatureItem(e){const t=e.objectId;if(null!=t&&this.effectiveSelectionManager)for(const{layer:o}of this.effectiveSelectionManager.selections)this.setSelection({layer:o,objectIds:o===e.layer?[t]:[]})}selectSingleGroupItem(e){if(this.effectiveSelectionManager)for(const{layer:t,selection:o}of this.effectiveSelectionManager.selections)this.setSelection({layer:t,objectIds:t.parent===e.layer?o:[]})}selectSingleItem(e){S(e)?this.selectSingleGroupItem(e):v(e)?this.selectSingleLayerItem(e):this.selectSingleFeatureItem(e)}selectSingleLayerItem(e){if(this.effectiveSelectionManager)for(const{layer:t,selection:o}of this.effectiveSelectionManager.selections)this.setSelection({layer:t,objectIds:t===e.layer?o:[]})}setSelection(e){this.effectiveSelectionManager?.setSelection(e.layer,e.objectIds)}async _goTo(e){const{view:t}=this;if(t)try{await y(t,e)}catch(r){"AbortError"!==r.name&&o.getLogger(this).warn("Failed to go to feature(s)",r)}}async _onSelectionChange(e){try{this.removeTemporaryHighlight();const t=[],o=this.layersToItems({controller:e,promises:t});t.length>0&&await Promise.all(t),this._onChangeAbortController===e&&(this._layerItems=o)}catch(t){o.getLogger(this).warn("Failed updating selection",t)}}};e([l()],_.prototype,"_groupItemCache",void 0),e([l()],_.prototype,"_hoverHighlightHandle",void 0),e([l()],_.prototype,"_layerItemCache",void 0),e([l()],_.prototype,"_layerItems",void 0),e([l()],_.prototype,"_onChangeAbortController",void 0),e([l()],_.prototype,"effectiveCount",null),e([l()],_.prototype,"effectiveSelectionManager",null),e([l()],_.prototype,"featureTitleMap",void 0),e([l()],_.prototype,"isUpdating",null),e([l()],_.prototype,"layerItems",null),e([l()],_.prototype,"layerViewMap",null),e([l()],_.prototype,"maxVisibleFeatureCountExceeded",null),e([l()],_.prototype,"maxVisibleFeatureCountPerLayer",void 0),e([l()],_.prototype,"selectionManager",void 0),e([l()],_.prototype,"selectionSources",null),e([l()],_.prototype,"selectionsByLayerMap",null),e([l()],_.prototype,"state",null),e([l()],_.prototype,"totalCount",null),e([l()],_.prototype,"view",void 0),e([l()],_.prototype,"viewLayersAndTables",null),_=e([c("esri.widgets.support.SelectionList.SelectionListViewModel")],_);const M=_;export{M as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import o from"../../../core/Logger.js";import{removeMaybe as r}from"../../../core/maybe.js";import{ignoreAbortErrors as i,debounce as s}from"../../../core/promiseUtils.js";import{watch as l,on as n}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as h}from"../../../core/support/UpdatingHandles.js";import{isSubtypeGroupLayer as p,isSubtypeSublayer as g}from"../../../layers/support/layerUtils.js";import{isSelectableLayer as u}from"../../../views/support/selectionUtils.js";import{goTo as m}from"../goToUtils.js";import y from"./GroupLayerItem.js";import f from"./LayerItem.js";import{computeEffectiveCount as d,getNestedLayerItems as v,isLayerItem as S,isGroupLayerItem as C,getNestedFeatureItems as I}from"./selectionListUtils.js";const b=100;let _=class extends t{constructor(e){super(e),this._groupItemCache=new Map,this._hoverHighlightHandle=null,this._layerItemCache=new Map,this._allLayerItems=null,this._onChangeAbortController=null,this._updatingHandles=new h,this.featureTitleMap=new Map,this.layer=null,this.maxVisibleFeatureCountPerLayer=500,this.selectionManager=null,this._onSelectionChangeController=async()=>{this._cancelOnSelectionChange();const e=new AbortController;this._onChangeAbortController=e,await this._updatingHandles.addPromise(i(this._onSelectionChange(e))),this._onChangeAbortController===e&&(this._onChangeAbortController=null);const t=this.layer&&this.effectiveSelectionManager?.getSelection(this.layer);t?.length||(this.layer=null)},this._cancelOnSelectionChange=()=>this._onChangeAbortController?.abort(),this._onSelectionChangeDebounced=s(this._onSelectionChangeController,b)}initialize(){this.addHandles([l((()=>[this.view,this.effectiveSelectionManager]),(()=>this._onSelectionChangeDebounced())),n((()=>this.effectiveSelectionManager?.sources),"change",(()=>this._onSelectionChangeDebounced())),n((()=>this.effectiveSelectionManager),"selection-change",(()=>this._onSelectionChangeDebounced()))])}destroy(){this.removeTemporaryHighlight(),this._updatingHandles.destroy()}get allLayerItems(){return this._allLayerItems??[]}get effectiveCount(){return d(this.allLayerItems)}get effectiveSelectionManager(){return this.selectionManager??this.view?.selectionManager}get isUpdating(){return!(!this._onChangeAbortController&&!this._updatingHandles.updating)}get layerItems(){return v(this.allLayerItems)}get layerViewMap(){const e=new Map,{view:t}=this;if(!t)return e;for(const o of t.allLayerViews)if(e.set(o.layer.id,o),p(o.layer))for(const t of o.layer.sublayers)e.set(t.id,o);return e}get maxVisibleFeatureCountExceeded(){return this.allLayerItems.some((e=>e.maxVisibleFeatureCountExceeded))}get selectionSources(){const e=this.effectiveSelectionManager,t=new Set;if(e?.sources)for(const o of e.sources)t.add(o);return t}get state(){const{view:e}=this;return e?e.ready?this.effectiveSelectionManager?"ready":"error":"loading":"disabled"}get totalCount(){return this.effectiveSelectionManager?.count??0}get viewLayersAndTables(){const{view:e}=this;return e?.map?[...e.map.layers.toArray().reverse(),...e.map.tables.toArray().reverse()]:[]}get visibleFeatureCount(){let e=0;for(const t of this.layerItems)e+=t.maxVisibleFeatureCountExceeded?t.maxVisibleFeatureCountPerLayer:t.total;return e}addTemporaryHighlight({graphic:e,layerView:t}){this.removeTemporaryHighlight(),t&&e&&(this._hoverHighlightHandle=t.highlight(e,{name:"temporary"}))}clear(){this.effectiveSelectionManager?.clear()}deselectFeatureItem(e){const t=e.graphic.getObjectId();null!=t&&this.effectiveSelectionManager?.removeFromSelection(e.layer,[t])}deselectGroupItem(e){e.children.forEach((e=>{S(e)?this.deselectLayerItem(e):this.deselectGroupItem(e)}))}deselectLayerItem(e){this.effectiveSelectionManager?.setSelection(e.layer,[])}deselectItem(e){C(e)?this.deselectGroupItem(e):S(e)?this.deselectLayerItem(e):this.deselectFeatureItem(e)}goToItem(e){S(e)||C(e)?this._goTo(I([e]).map((e=>e.graphic))):this._goTo(e.graphic)}layersToItems(e){const{controller:t,layers:o,promises:r}=e,{_groupItemCache:i,_layerItemCache:s,effectiveSelectionManager:l,viewLayersAndTables:n}=this,a=o??n;if(!l)return[];const c=[];for(const h of a)switch(h.type){case"subtype-group":case"group":{const e=i.get(h),o=e??new y({layer:h,viewModel:this});e||i.set(h,o),r.push(o.sync({controller:t,promises:r})),c.push(o)}break;default:if(u(h)||g(h)){const e=h,o=l.getSelection(e);if(!o?.length)continue;const i=s.get(e),n=i??new f({layer:e,viewModel:this});i||s.set(e,n),r.push(n.sync({controller:t,promises:r})),c.push(n)}}return c}removeFromSelection(e){this.effectiveSelectionManager?.removeFromSelection(e.layer,e.objectIds)}removeTemporaryHighlight(){this._hoverHighlightHandle=r(this._hoverHighlightHandle)}selectSingleFeatureItem(e){const t=e.objectId;if(null!=t&&this.effectiveSelectionManager)for(const{layer:o}of this.effectiveSelectionManager.selections)this.setSelection({layer:o,objectIds:o===e.layer?[t]:[]})}selectSingleGroupItem(e){if(this.effectiveSelectionManager)for(const{layer:t,selection:o}of this.effectiveSelectionManager.selections)this.setSelection({layer:t,objectIds:t.parent===e.layer?o:[]})}selectSingleItem(e){C(e)?this.selectSingleGroupItem(e):S(e)?this.selectSingleLayerItem(e):this.selectSingleFeatureItem(e)}selectSingleLayerItem(e){if(this.effectiveSelectionManager)for(const{layer:t,selection:o}of this.effectiveSelectionManager.selections)this.setSelection({layer:t,objectIds:t===e.layer?o:[]})}setSelection(e){this.effectiveSelectionManager?.setSelection(e.layer,e.objectIds)}async _goTo(e){const{view:t}=this;if(t)try{await m(t,e)}catch(r){"AbortError"!==r.name&&o.getLogger(this).warn("Failed to go to feature(s)",r)}}async _onSelectionChange(e){try{this.removeTemporaryHighlight();const t=[],o=this.layersToItems({controller:e,promises:t});t.length>0&&await Promise.all(t),this._onChangeAbortController===e&&(this._allLayerItems=o)}catch(t){o.getLogger(this).warn("Failed updating selection",t)}}};e([a()],_.prototype,"_groupItemCache",void 0),e([a()],_.prototype,"_hoverHighlightHandle",void 0),e([a()],_.prototype,"_layerItemCache",void 0),e([a()],_.prototype,"_allLayerItems",void 0),e([a()],_.prototype,"_onChangeAbortController",void 0),e([a()],_.prototype,"allLayerItems",null),e([a()],_.prototype,"effectiveCount",null),e([a()],_.prototype,"effectiveSelectionManager",null),e([a()],_.prototype,"featureTitleMap",void 0),e([a()],_.prototype,"isUpdating",null),e([a()],_.prototype,"layer",void 0),e([a()],_.prototype,"layerItems",null),e([a()],_.prototype,"layerViewMap",null),e([a()],_.prototype,"maxVisibleFeatureCountExceeded",null),e([a()],_.prototype,"maxVisibleFeatureCountPerLayer",void 0),e([a()],_.prototype,"selectionManager",void 0),e([a()],_.prototype,"selectionSources",null),e([a()],_.prototype,"state",null),e([a()],_.prototype,"totalCount",null),e([a()],_.prototype,"view",void 0),e([a()],_.prototype,"viewLayersAndTables",null),e([a()],_.prototype,"visibleFeatureCount",null),_=e([c("esri.widgets.support.SelectionList.SelectionListViewModel")],_);const M=_;export{M as default};