@arcgis/core 5.0.0-next.22 → 5.0.0-next.23

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 (178) hide show
  1. package/analysis/DistanceMeasurementAnalysis.d.ts +4 -0
  2. package/applications/SceneViewer/sceneViewerUtils.d.ts +1 -0
  3. package/applications/SceneViewer/sceneViewerUtils.js +1 -1
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/024104997daea0d74b38.js +1 -0
  6. package/assets/esri/core/workers/chunks/052ded41dc06c93ec0a7.js +1 -0
  7. package/assets/esri/core/workers/chunks/05b7720ab6bf0874f27c.js +1 -0
  8. package/assets/esri/core/workers/chunks/06d52a570d5d44f8c86e.js +1 -0
  9. package/assets/esri/core/workers/chunks/13b47c217d1e9b61bcbf.js +1 -0
  10. package/assets/esri/core/workers/chunks/174972870db79189200b.js +1 -0
  11. package/assets/esri/core/workers/chunks/219876879bc543568bcd.js +1 -0
  12. package/assets/esri/core/workers/chunks/221691ad0b2912827e14.js +1 -0
  13. package/assets/esri/core/workers/chunks/231c0b583fa97f2ca675.js +1 -0
  14. package/assets/esri/core/workers/chunks/274f2b5e6dbc58505142.js +1 -0
  15. package/assets/esri/core/workers/chunks/2a41283bba2361afa1fd.js +1 -0
  16. package/assets/esri/core/workers/chunks/2c4218306747f5d15575.js +1 -0
  17. package/assets/esri/core/workers/chunks/2c7038a7ffaf75344b02.js +1 -0
  18. package/assets/esri/core/workers/chunks/2de32649f8b0c6404d7c.js +1 -0
  19. package/assets/esri/core/workers/chunks/{f651c05604eab83aef5f.js → 3266c3392c24ce6cdd83.js} +2 -2
  20. package/assets/esri/core/workers/chunks/42747a028fc404ac55f4.js +1 -0
  21. package/assets/esri/core/workers/chunks/443931ac4b4ee5ccb932.js +1 -0
  22. package/assets/esri/core/workers/chunks/4ab89c990a82c745c0fd.js +1 -0
  23. package/assets/esri/core/workers/chunks/4b14ee37b5ac50a734f9.js +1 -0
  24. package/assets/esri/core/workers/chunks/4cda42b94e9cb58dd372.js +1 -0
  25. package/assets/esri/core/workers/chunks/4ce28c936eaffe57c448.js +1 -0
  26. package/assets/esri/core/workers/chunks/538ddb267aa328814865.js +1 -0
  27. package/assets/esri/core/workers/chunks/5b290d18de61789417f9.js +1 -0
  28. package/assets/esri/core/workers/chunks/5b73c77587772120b209.js +1 -0
  29. package/assets/esri/core/workers/chunks/60eeeea671a523bb6b15.js +1 -0
  30. package/assets/esri/core/workers/chunks/6428e2f4fc0a6739cc9e.js +1 -0
  31. package/assets/esri/core/workers/chunks/69278d08a7d64917f826.js +2 -0
  32. package/assets/esri/core/workers/chunks/{c1e4e9ab4a543e8b350d.js → 6b8a923fe5f800f703e3.js} +1 -1
  33. package/assets/esri/core/workers/chunks/6e5d41f51572e3e7cf92.js +1 -0
  34. package/assets/esri/core/workers/chunks/{7565b382f6b3d2cb46a3.js → 6f3ffc04086bca30e55d.js} +2 -2
  35. package/assets/esri/core/workers/chunks/70e2804d3710c6af468e.js +2 -0
  36. package/assets/esri/core/workers/chunks/7749801f30a99b60753e.js +1 -0
  37. package/assets/esri/core/workers/chunks/{aa78b69219d9a0ef1c54.js → 78fc9a55e620602db1ff.js} +2 -2
  38. package/assets/esri/core/workers/chunks/800c282a7335b2e6c7cd.js +1 -0
  39. package/assets/esri/core/workers/chunks/{867a181969eeeb5f1856.js → 838b3ec88785ac7aa31b.js} +1 -1
  40. package/assets/esri/core/workers/chunks/88aa71f02f43bb069345.js +1 -0
  41. package/assets/esri/core/workers/chunks/8a8192e6a9fd7a6d8060.js +1 -0
  42. package/assets/esri/core/workers/chunks/{74a251e7f5be72ca2a5a.js → 8b336a63737e917e50e2.js} +1 -1
  43. package/assets/esri/core/workers/chunks/8d4cc5f1d07b4aa3aea0.js +1 -0
  44. package/assets/esri/core/workers/chunks/8f0c53feead87457b7eb.js +1 -0
  45. package/assets/esri/core/workers/chunks/{4f7b7587d7902355f2a1.js → 93fe46be3c7fe34b5361.js} +1 -1
  46. package/assets/esri/core/workers/chunks/9461cc37ab3397265270.js +1 -0
  47. package/assets/esri/core/workers/chunks/9527f1a611557a7af237.js +1 -0
  48. package/assets/esri/core/workers/chunks/97b01803d0c38541aa08.js +1 -0
  49. package/assets/esri/core/workers/chunks/9921c8d4487a0f580b93.js +1 -0
  50. package/assets/esri/core/workers/chunks/9d0f0d055ec25af037e0.js +1 -0
  51. package/assets/esri/core/workers/chunks/9f0172b83f25ef5f8d40.js +1 -0
  52. package/assets/esri/core/workers/chunks/9f6d82ce8f680abb79bb.js +1 -0
  53. package/assets/esri/core/workers/chunks/a4f492aa5444e6381063.js +1 -0
  54. package/assets/esri/core/workers/chunks/{d6e0528eacee7ea4c1ce.js → a67c3958d76d10c04fa6.js} +2 -2
  55. package/assets/esri/core/workers/chunks/a7dc1928d46dd6b69868.js +1 -0
  56. package/assets/esri/core/workers/chunks/b6d21a2b5c1be8bee57c.js +1 -0
  57. package/assets/esri/core/workers/chunks/{ce16489cf7eb0d78c741.js → be631029691d9a320cb5.js} +2 -2
  58. package/assets/esri/core/workers/chunks/c35a22becf5c470ff6a2.js +1 -0
  59. package/assets/esri/core/workers/chunks/c5d6b416baf24e74b9ba.js +1 -0
  60. package/assets/esri/core/workers/chunks/cade149fa19b4d06dd24.js +1 -0
  61. package/assets/esri/core/workers/chunks/cd1d9f638af5b63a1292.js +1 -0
  62. package/assets/esri/core/workers/chunks/d21ae4980741be98f948.js +1 -0
  63. package/assets/esri/core/workers/chunks/d32aad968798948946e4.js +1 -0
  64. package/assets/esri/core/workers/chunks/{0f735b0dec173142f3b6.js → d9251c3c85c3ddd242c8.js} +2 -2
  65. package/assets/esri/core/workers/chunks/e0369ce0d729c9656488.js +1 -0
  66. package/assets/esri/core/workers/chunks/e2d2a55aedd3ce9cb47b.js +1 -0
  67. package/assets/esri/core/workers/chunks/e3c8fac5fe638d548e34.js +1 -0
  68. package/assets/esri/core/workers/chunks/e45940d342b18983a5ef.js +1 -0
  69. package/assets/esri/core/workers/chunks/{16f841f12b32d8a500a9.js → fa4f788abfbfd3dee882.js} +1 -1
  70. package/assets/esri/core/workers/chunks/fbbf25629e0dab486887.js +1 -0
  71. package/config.js +1 -1
  72. package/interfaces.d.ts +355 -73
  73. package/kernel.js +1 -1
  74. package/layers/VideoLayer.js +1 -1
  75. package/layers/mixins/ArcGISImageService.js +1 -1
  76. package/layers/support/SubtypeSublayer.js +1 -1
  77. package/package.json +6 -6
  78. package/support/revision.js +1 -1
  79. package/unionTypes.d.ts +0 -1
  80. package/views/2d/analysis/AreaMeasurement/AreaMeasurementAreaVisualization.js +1 -1
  81. package/views/2d/analysis/AreaMeasurement/AreaMeasurementController.js +1 -1
  82. package/views/2d/analysis/AreaMeasurement/utils.js +5 -0
  83. package/views/2d/analysis/AreaMeasurementAnalysisView2D.d.ts +4 -0
  84. package/views/2d/analysis/AreaMeasurementAnalysisView2D.js +1 -1
  85. package/views/2d/analysis/DistanceMeasurementAnalysisView2D.d.ts +4 -0
  86. package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
  87. package/views/3d/analysis/AreaMeasurementAnalysisView3D.js +1 -1
  88. package/views/3d/analysis/Dimension/types.d.ts +3 -0
  89. package/views/3d/analysis/Dimension/types.js +5 -0
  90. package/views/3d/analysis/DirectLineMeasurement/types.d.ts +4 -0
  91. package/views/3d/analysis/DirectLineMeasurement/types.js +5 -0
  92. package/views/3d/analysis/LineOfSight/types.d.ts +3 -0
  93. package/views/3d/analysis/LineOfSight/types.js +5 -0
  94. package/views/3d/analysis/Slice/types.d.ts +3 -0
  95. package/views/3d/analysis/Slice/types.js +5 -0
  96. package/views/3d/analysis/Viewshed/types.d.ts +3 -0
  97. package/views/3d/analysis/Viewshed/types.js +5 -0
  98. package/views/3d/analysis/VolumeMeasurement/types.d.ts +3 -0
  99. package/views/3d/analysis/VolumeMeasurement/types.js +5 -0
  100. package/views/3d/support/popupHitTest.js +1 -1
  101. package/views/3d/terrain/TerrainSurface.js +1 -1
  102. package/views/3d/terrain/Tile.js +1 -1
  103. package/views/VideoView.js +1 -1
  104. package/views/analysis/AreaMeasurement/types.d.ts +4 -0
  105. package/views/analysis/AreaMeasurement/types.js +5 -0
  106. package/views/analysis/DistanceMeasurement/types.d.ts +4 -0
  107. package/views/analysis/DistanceMeasurement/types.js +5 -0
  108. package/views/analysis/types.d.ts +3 -0
  109. package/views/analysis/types.js +5 -0
  110. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  111. package/widgets/Editor/workflowUtils.js +1 -1
  112. package/widgets/FeatureTable/FieldColumn.js +1 -1
  113. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  114. package/widgets/VideoPlayer/VideoPlayerViewModel.js +1 -1
  115. package/assets/esri/core/workers/chunks/03ed15ba64f1679b3d48.js +0 -1
  116. package/assets/esri/core/workers/chunks/04bac7bb3f794b33e2e4.js +0 -1
  117. package/assets/esri/core/workers/chunks/092d72caf3269e696d1c.js +0 -1
  118. package/assets/esri/core/workers/chunks/1466ab7bd500ba7a4025.js +0 -1
  119. package/assets/esri/core/workers/chunks/1beee2932154db83f79d.js +0 -1
  120. package/assets/esri/core/workers/chunks/1cae81089b50b7e43d70.js +0 -1
  121. package/assets/esri/core/workers/chunks/1fcd4d90a99e85d35dd2.js +0 -1
  122. package/assets/esri/core/workers/chunks/21d7f42c2033de987b97.js +0 -1
  123. package/assets/esri/core/workers/chunks/24ff9dad3fb64ab54970.js +0 -1
  124. package/assets/esri/core/workers/chunks/26282c67d2b066a76881.js +0 -1
  125. package/assets/esri/core/workers/chunks/2d3e7b41b225d905c7f4.js +0 -1
  126. package/assets/esri/core/workers/chunks/30a631c39c9372797b92.js +0 -1
  127. package/assets/esri/core/workers/chunks/388873be1dca91ccbc9d.js +0 -1
  128. package/assets/esri/core/workers/chunks/3a457e718a901a45902e.js +0 -2
  129. package/assets/esri/core/workers/chunks/44e08b49898a8fcbe031.js +0 -1
  130. package/assets/esri/core/workers/chunks/4731f507149940dde534.js +0 -1
  131. package/assets/esri/core/workers/chunks/4d0e099f34639cda3a9b.js +0 -1
  132. package/assets/esri/core/workers/chunks/5a6b487b70ca85a45f57.js +0 -1
  133. package/assets/esri/core/workers/chunks/5b5f1f22de985dc6bbc0.js +0 -1
  134. package/assets/esri/core/workers/chunks/5c82b17f9990e6cd7d0b.js +0 -1
  135. package/assets/esri/core/workers/chunks/61bb39597ccf89f99a72.js +0 -1
  136. package/assets/esri/core/workers/chunks/67bc5b87fd61095689d4.js +0 -1
  137. package/assets/esri/core/workers/chunks/6bf5b3c7129aa14b4fc6.js +0 -1
  138. package/assets/esri/core/workers/chunks/755e2ecd20b6bd1909be.js +0 -1
  139. package/assets/esri/core/workers/chunks/768e1ad2f06fdc9d5ef8.js +0 -1
  140. package/assets/esri/core/workers/chunks/7a957f2bca1438732338.js +0 -1
  141. package/assets/esri/core/workers/chunks/809a9055da28c8fa58b0.js +0 -1
  142. package/assets/esri/core/workers/chunks/8bbae8ac586e5c0819d2.js +0 -1
  143. package/assets/esri/core/workers/chunks/8cd03b54b2859b52fb81.js +0 -1
  144. package/assets/esri/core/workers/chunks/8f85039d76f03fbdd27a.js +0 -1
  145. package/assets/esri/core/workers/chunks/93f706acaa812bb3ac70.js +0 -1
  146. package/assets/esri/core/workers/chunks/976dd80e318266ab4c2c.js +0 -1
  147. package/assets/esri/core/workers/chunks/9a20be3b02c9d6349b8d.js +0 -1
  148. package/assets/esri/core/workers/chunks/9dae3e4e34096b3d82d7.js +0 -1
  149. package/assets/esri/core/workers/chunks/9e5e05d6430712b0b1bc.js +0 -1
  150. package/assets/esri/core/workers/chunks/a0b0fe0d99df20fa9076.js +0 -1
  151. package/assets/esri/core/workers/chunks/a987731d1b5449d8fb0c.js +0 -1
  152. package/assets/esri/core/workers/chunks/ad9606164c694af0c61f.js +0 -1
  153. package/assets/esri/core/workers/chunks/b0e52c3775f05aaf7ff6.js +0 -1
  154. package/assets/esri/core/workers/chunks/bfd3d81e8e148be99686.js +0 -1
  155. package/assets/esri/core/workers/chunks/cbc5131723cbe29cb88f.js +0 -1
  156. package/assets/esri/core/workers/chunks/ce00509970e7e6eacbdf.js +0 -1
  157. package/assets/esri/core/workers/chunks/cec95ed69c86758d95ec.js +0 -1
  158. package/assets/esri/core/workers/chunks/d391bfbaf0e790cd10d6.js +0 -2
  159. package/assets/esri/core/workers/chunks/d622fb553babd515a21f.js +0 -1
  160. package/assets/esri/core/workers/chunks/ddb55435adeda1e2a1bf.js +0 -1
  161. package/assets/esri/core/workers/chunks/e5a9c37de44508e9733b.js +0 -1
  162. package/assets/esri/core/workers/chunks/e5b42ddec8e424602e03.js +0 -1
  163. package/assets/esri/core/workers/chunks/eaabb5b010b7bb850b0a.js +0 -1
  164. package/assets/esri/core/workers/chunks/eafc4da265469e9e5e0b.js +0 -1
  165. package/assets/esri/core/workers/chunks/eb1b582a73111c8556c1.js +0 -1
  166. package/assets/esri/core/workers/chunks/f594df2f5ce6ca41a254.js +0 -1
  167. package/assets/esri/core/workers/chunks/f64037a88ab03662dc2a.js +0 -1
  168. package/assets/esri/core/workers/chunks/f888849b0236cc0d6f50.js +0 -1
  169. package/assets/esri/core/workers/chunks/fbcc4cbb221c0fbb90d4.js +0 -1
  170. package/views/2d/analysis/AreaMeasurement/AreaMeasurementLabelVisualization.js +0 -5
  171. /package/assets/esri/core/workers/chunks/{0f735b0dec173142f3b6.js.LICENSE.txt → 3266c3392c24ce6cdd83.js.LICENSE.txt} +0 -0
  172. /package/assets/esri/core/workers/chunks/{d391bfbaf0e790cd10d6.js.LICENSE.txt → 69278d08a7d64917f826.js.LICENSE.txt} +0 -0
  173. /package/assets/esri/core/workers/chunks/{7565b382f6b3d2cb46a3.js.LICENSE.txt → 6f3ffc04086bca30e55d.js.LICENSE.txt} +0 -0
  174. /package/assets/esri/core/workers/chunks/{3a457e718a901a45902e.js.LICENSE.txt → 70e2804d3710c6af468e.js.LICENSE.txt} +0 -0
  175. /package/assets/esri/core/workers/chunks/{aa78b69219d9a0ef1c54.js.LICENSE.txt → 78fc9a55e620602db1ff.js.LICENSE.txt} +0 -0
  176. /package/assets/esri/core/workers/chunks/{d6e0528eacee7ea4c1ce.js.LICENSE.txt → a67c3958d76d10c04fa6.js.LICENSE.txt} +0 -0
  177. /package/assets/esri/core/workers/chunks/{ce16489cf7eb0d78c741.js.LICENSE.txt → be631029691d9a320cb5.js.LICENSE.txt} +0 -0
  178. /package/assets/esri/core/workers/chunks/{f651c05604eab83aef5f.js.LICENSE.txt → d9251c3c85c3ddd242c8.js.LICENSE.txt} +0 -0
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{equals as a,isSome as i}from"../../core/arrayUtils.js";import{createTask as r}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import{deprecatedProperty as o}from"../../core/deprecate.js";import n from"../../core/Error.js";import{EventedMixin as c}from"../../core/Evented.js";import{makeHandle as l}from"../../core/handleUtils.js";import{equalsShallow as h}from"../../core/lang.js";import u from"../../core/Logger.js";import{clamp as d}from"../../core/mathUtils.js";import{abortMaybe as m,destroyMaybe as p}from"../../core/maybe.js";import{EsriPromise as g}from"../../core/Promise.js";import{isAbortError as y,throwIfAborted as v,waitTick as w}from"../../core/promiseUtils.js";import f from"../../core/ReactiveMap.js";import{whenOnce as F,on as _,watch as b,syncAndInitial as M,initial as I}from"../../core/reactiveUtils.js";import{sqlAnd as P}from"../../core/sql.js";import{getMetersPerUnitForSR as V}from"../../core/units.js";import{property as S,subclass as k}from"../../core/accessorSupport/decorators.js";import{isSerializable as A}from"../../core/support/jsonUtils.js";import{UpdatingHandles as C}from"../../core/support/UpdatingHandles.js";import L from"../../geometry/Extent.js";import{union as G}from"../../geometry/geometryEngineAsync.js";import T from"../../geometry/Multipoint.js";import O from"../../geometry/Point.js";import R from"../../geometry/Polygon.js";import j from"../../geometry/Polyline.js";import{projectWithZConversion as B}from"../../geometry/projectionUtils.js";import x from"../../geometry/SpatialReference.js";import{polygonCentroidPoint as H}from"../../geometry/support/centroid.js";import{isClockwise as E}from"../../geometry/support/coordsUtils.js";import{normalizeMapX as D}from"../../geometry/support/normalizeUtils.js";import{geographicToWebMercator as z}from"../../geometry/support/webMercatorUtils.js";import U from"../../layers/GraphicsLayer.js";import N from"../../layers/MediaLayer.js";import{searchImages as W,getSortedLayerFeatures as q}from"../../layers/orientedImagery/queries.js";import{calculateSuitabilities as $}from"../../layers/orientedImagery/core/bestImageUtils.js";import{createCoveragePolygon as J,computePolygonForInspection as Z,resizePolygon as K,checkIfPolygonContainsSelectedPoint as Q}from"../../layers/orientedImagery/core/coverageUtils.js";import{isElevationSource as X}from"../../layers/orientedImagery/core/ElevationSourceDefinitions.js";import{convertGeographicToWebMercator as Y}from"../../layers/orientedImagery/core/utils.js";import{imageToWorld as ee,imageToWorldPanoramic as te}from"../../layers/orientedImagery/transformations/imageToWorld.js";import ae from"../../layers/orientedImagery/transformations/updateElevation.js";import{getElevationSampler as ie}from"../../layers/orientedImagery/transformations/updateElevationUtils.js";import{or as re,getInitialAngle as se,convertPixelToHeadingPitch as oe,convertHeadingPitchToSphereVertex as ne,getImageToWorldProperties as ce,getUpdateElevationProps as le,isElevationSampler as he,getImageToWorldPanoramicProperties as ue,pointToArray as de,transformGraphicCoordinatesToPixel as me,getWorldToImageProperties as pe}from"../../layers/orientedImagery/transformations/utils.js";import{worldToImage as ge,worldToImagePanoramic as ye}from"../../layers/orientedImagery/transformations/worldToImage.js";import ve from"../../layers/support/ExtentAndRotationGeoreference.js";import{getFloorFilterClause as we}from"../../layers/support/floorFilterUtils.js";import fe from"../../layers/support/VideoElement.js";import Fe from"../../views/MapView.js";import _e from"../../views/draw/Draw.js";import{scale as be}from"../../views/draw/support/drawUtils.js";import{ViewEventPriorities as Me}from"../../views/input/InputManager.js";import Ie from"../PanoramicVideoViewer.js";import Pe from"../PanoramicViewer.js";import{defaultAngleThresholdInDegrees as Ve,videoExtent as Se,invalidCameraHeading as ke,sectorsInOrder as Ae,sampleExtent as Ce,sectorsRadii as Le}from"./constants.js";import{configureSketchTool as Ge,extractFieldsFromDataCaptureLayer as Te,isValidDataCaptureLayer as Oe,constructGraphicFromImageGeometry as Re}from"./dataCaptureUtils.js";import{isFeatureAttachment as je,getImageSourceFromAttachment as Be}from"./galleryUtils.js";import{getModeCorrectedPoint as xe,calculateCorrectedPixel as He,getUnitRateFromSpatialReference as Ee,calculateHeightFromTemporaryDistance as De,getModeCorrectedPoints as ze,computeTriangulatedVector as Ue,computeTriangulatedPoint as Ne}from"./imageMeasurementUtils.js";import{crossSymbol as We,crossSymbol3D as qe,measurementPolygonSymbol as $e,polylineSymbolPanoramic as Je,measurementPolylineSymbol as Ze,cameraOverlaySymbol3D as Ke,cameraOverlaySymbol as Qe,diamondSymbol as Xe,diamondSymbol3D as Ye,locationSymbol as et,locationSymbol3D as tt,activeSourcePointSymbol as at,sourcePointSymbol as it}from"./symbols.js";import{isNoAttachmentError as rt,getContentType as st,isTifOrMrf as ot,filterOILLayerView as nt,assignElevationSampleToFeatures as ct,calculateDirection as lt,calculateSegment as ht,isSceneView as ut,isGraphic as dt}from"./utils.js";import{disableVideoZoomAndPan as mt}from"./videoViewerUtils.js";import pt from"./components/ImageViewer.js";import gt from"./components/NavigationNode.js";import yt from"./components/OrientedImageryVideoViewModel.js";import{NoActiveViewerError as vt,NoFeatureFoundWithObjectIdError as wt}from"./navigation/errors.js";import{queryFeatureByObjectIds as ft}from"./navigation/queries.js";import{ImageMeasurementService as Ft}from"./services/ImageMeasurementService.js";import _t from"../Sketch/SketchViewModel.js";const bt={click:"view-click",imageClick:"image-click",triangularImageClick:"triangular-click",interactionHandles:"interaction-handles",hittestHandles:"hittest-handles",videoPlayerHandles:"video-handles",activeViewerCursorHandles:"active-viewer-cursor-handles",imageViewerCursorHandles:"image-viewer-cursor-handles"},Mt=new Set(["JPG","JPEG","TIFF","TIF","MRF"]),It=new Set(["MRF","TIFF","TIF"]),Pt=/\.(\w+)$/,Vt=()=>new n("orientedimageryviewer:sketch-not-initialized","Sketch property is not initialized, call loadSketch first");let St=class extends(c(g)){constructor(e){super(e),this.additionalFeatures=new s,this.additionalCameraLocations=new s,this.additionalFootprints=new s,this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.bestFeatureAngle=0,this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null,this.cameraHeadingThreshold=Ve,this.cameraPitchThreshold=Ve,this.clickAction="hittest",this.videoViewModel=null,this.collectionId=null,this.conversionProps=null,this.coverageFrustums=new s,this.coveragePolygons=new s,this.currentBestFeature=null,this.currentBestFeatureMeasurementImage=null,this.currentBestFeatureLocation=null,this.currentCoverageVisible=!0,this.depthImage=null,this.directionMode="Relative",this.featureCache=[],this.navigationNodes=new s,this.determineWorkflowForFeature=async(e,t,a)=>{const{currentBestFeature:i,selectedPoint:r,view:s}=this;if(s?.closePopup(),i&&r){this._initialCurrentCoverageUpdate=!0,this._updateGroundElevation=!0;try{await this._updatePointsAndPolygons(a),await this._loadDepthImage(a),await this._loadImage(a)}catch(o){y(o)||(this.loadImageError(o),u.getLogger(this).error("#loadIImage()","error occured while loading image",o))}}},this.determineWorkflowForTriangularMeasurement=async(e,t,a)=>{if(this.view?.closePopup(),this.currentBestFeatureMeasurementImage&&this.selectedPoint)try{await this._loadMeasurementViewerImage(a)}catch(i){y(i)||(this.loadImageError(i),u.getLogger(this).error("#loadIImage()","error occured while loading image",i))}},this.disabled=!1,this.displayMessage={key:"onLoadMessage",type:"info"},this.displayNewMeasurementButton=!0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.dataCaptureLayer=null,this.features=new s,this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.heightMeasurementPixels=[],this.heightGraphic=null,this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.measurementAngle=null,this.tempDistance=null,this.imageGeometryField=null,this.imageLocationToolState=!1,this.imageMeasurementViewer=new pt,this.isAdditionalCoverageVisible=!1,this.isAdditionalPointSourcesVisible=!1,this.measurementVectors=[],this.layer=null,this.localPort=null,this.mapImageConversionToolState=!1,this.measureType=null,this.measurementGraphic=null,this.navigatorCurrentBestFeature=null,this.oiObjectIdField=null,this.overlayedCameraLocations=new s,this.overlayedMapFeatures=new f,this.pixelCoordinates=null,this.preserveAngle="none",this.pointSources=new s,this.previousFeatureAngle=0,this.selectedPoint=null,this.shouldShowSelectedImage=!1,this.sketch=null,this.sketchTriangular=null,this.sketchTriangularGraphicsLayer=null,this.draw=null,this.sketchAdapter=null,this.triangularMeasurementActive=!1,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedAreaAccuracy=0,this.triangulatedMeasurementGraphic=null,this.triangulatedPoint=null,this.triangulatedMeasurementAdapter=null,this.updateFootprint=async(e,t,a)=>{"default"===this.mode&&"image-loaded"!==this.state||this.mode.includes("video")&&!this.videoElement?.content||await(this._adapter?.updateFootprint(e,t,a))},this.updateFootprintPanorama=async(e,t)=>{await(this._adapter?.updateFootprintPanorama(e,t))},this.updatingTriangularMeasurementState=!1,this.videoElement=null,this.videoLayer=null,this.videoMapView=new Fe({map:new Map}),this._adapter=null,this._highlightedFeatureHandle=null,this._imageViewer=new pt,this._initialCurrentCoverageUpdate=!0,this._locationPointOnImage=null,this._measurementService=null,this._correctedLocationPointOnImage=null,this._overlays=new U({listMode:"hide",internal:!0,elevationInfo:{mode:"absolute-height"},title:"OrentedImageryViewerViewModel overlays layer"}),this._panoramicVideoViewer=new Ie,this._panoramicViewer=new Pe,this._panoramicMeasurementViewer=new Pe,this._referencePointOnGround=null,this._referencePointOnImage=null,this._sectorData=null,this._featureToSector=null,this._updatingHandles=new C,this._clickTask=null,this._crossSymbol=null,this.footprintExtent=null,this._featureChangedTask=null,this._openPopupTask=null,this._suitabilities=null,this._transformController=new AbortController,this._updateFootprintTask=null,this._updateGroundElevation=!1,this.addUpdatingPromise=e=>this._updatingHandles.addPromise(e),this.filterCapturedFeatures=e=>{const t=this.currentBestFeature?.attributes.objectId,a=this.layer?.imageReferenceField;if(!t||!e||!a)return;const i=this.overlayedMapFeatures.get(e);i?.forEach(e=>{const i=e.attributes??{},r=Object.keys(i).find(e=>e.toLowerCase()===a.toLowerCase());(r?i[r]:null)!==t&&(e.visible=!e.visible)})},this.hideImageGeometry=e=>{},this.highlight=e=>{if(!this._overlaysView)return;this.removeHighlight();const t=this.additionalFootprints.find(({attributes:{imageID:t}})=>t===Number(e));this._highlightedFeatureHandle=t?this._overlaysView?.highlight(t):null},this.loadDataCaptureAdapter=async e=>{await this.loadSketch(e);const t=import("./adapters/sketch/DataCaptureAdapter.js"),{default:a}=await t;return v(e),this.sketchAdapter=new a({viewModel:this}),this.sketchAdapter},this.loadImageFromSource=async(e,t)=>this._updatingHandles.addPromise(this._loadImageFromSourceInternal(e,t)),this.storeImageMeasurementViewer=e=>{this.imageMeasurementViewer=e},this.storePanoramicMeasurementViewer=e=>{this._panoramicMeasurementViewer=e},this.loadImageViewer=e=>{this._imageViewer?.destroy(),this._imageViewer=e},this.loadPanoramicViewer=e=>{this._panoramicViewer?.destroy(),this._panoramicViewer=e},this.loadPanoramicVideoViewer=e=>{this._panoramicVideoViewer?.destroy(),this._panoramicVideoViewer=e},this.loadVideoViewer=e=>{this.videoMapView.container=e},this.showImageByObjectId=async(e,t)=>{const a=this.additionalFeatures.find(({attributes:t})=>t.objectId===e);if(a)this.currentBestFeature=a;else{const{layer:a,layerFloorFilterClause:r}=this;if(!a)return void this.setMessage("noLayerSelected","info");this.beforeLoad();const s=this._updatingHandles.addPromise(this._queryAndLoadByObjectId(a,e,r,t));try{await s,await this.selectBestFeature(e,t)}catch(i){y(i)||(u.getLogger(this).error("oriented-imagery-viewer:show-image",i),"NoFeatureFoundWithObjectIdError"===i.name?this.setMessage("noFeatureFoundWithObjectId","error","",{objectId:e}):this.setMessage("imageLoadError","error",i.message))}}},this.imageToImageTransform=async(e,t,a)=>{const{updateElevationProps:i,...r}=t,{updateElevationProps:s,...o}=a,n=await ee(e,r,i);return ge(n,o)},this.imageToImageTransformPanoramic=async(e,t,a)=>{const{updateElevationProps:i,...r}=t,{updateElevationProps:s,...o}=a,n=await te(e,r,i);return ye(n,o)},this.getSectorFeatureById=e=>this._suitabilities?.find(({feature:{attributes:{objectId:t}}})=>t===e),this.getFeatureSectorById=e=>this._featureToSector?.[`${e}`],this.navigate=async(e,t)=>{const{activeViewer:a}=this;if(!a)throw new vt;return await a.navigate(e,t)},this.removeHighlight=()=>this._highlightedFeatureHandle?.remove(),this.revealImageGeometry=e=>{},this.selectBestFeature=async(e,t)=>(v(t),this.currentBestFeature=this.features?.find(({attributes:t})=>`${t.objectId}`==`${e}`),F(()=>"image-loaded"===this.state,t)),this.toggleImageAttributes=()=>{m(this._openPopupTask),this._openPopupTask=r(async e=>{const{currentBestFeature:a,popupEnabled:i,layer:r,view:s}=this;if(s?.closePopup(),!(s&&a&&i&&r))return;const{attributes:o,geometry:n}=a,c=new t({geometry:n,attributes:o.toJSON(),layer:r,sourceLayer:r});v(e),await s.openPopup({features:[c],location:o.location.clone()})})},this.updateSuitabilities=(e,t=!0)=>{e.sort((e,t)=>e.suitability-t.suitability),this._suitabilities=e;const a=this._suitabilities.map(({feature:e})=>e);this._initialCurrentCoverageUpdate=!0,this._updateFeatures(a,t),this._groupFeaturesBySectors()},this._createViewClickHandle=()=>{if(this.removeHandles(bt.click),this.disabled||null==this.view)return;const e=this.mapImageConversionToolState&&"image-loaded"===this.state?this._mapImageConversionToolViewClickHandler:this._viewClickHandler;this.addHandles(this.view.on("click",e,Me.WIDGET),bt.click)},this._createImageClickHandle=()=>{this.removeHandles(bt.imageClick);const{mapImageConversionToolState:e,mode:t,activeViewer:a,currentBestFeature:i,footprintExtent:s}=this,o=a?.imageSize;if(!(e&&"none"!==t&&o&&s&&i))return;const n=a.clickAction;this.clickAction="pixel-location";const c=l(()=>{this.clickAction=n});let h=null;const u=_(()=>a,"pixel-location",e=>{this.plotReferencePointOnImage(e),h?.abort(),h=r(async a=>{if(!e)return;const r=await this.getMapPoint(e,{feature:i,imageSize:o,mode:t}).then(e=>{const t=this.view?.spatialReference;return re(!t,e.spatialReference.equals(t))?e:B(e,t)});v(a),this.plotReferencePointOnGround(r)})});this.addHandles([u,c],bt.imageClick)},this._createTriangularImageClickHandle=()=>{this.removeHandles(bt.triangularImageClick),this.triangularMeasurementActive&&"none"!==this.mode&&this.currentBestFeature&&this.currentBestFeatureMeasurementImage&&this.activeTriangulatedViewer&&this.addHandles(this.activeTriangulatedViewer.imageRenderer.on("double-click",this._measurementImageClickHandler),bt.triangularImageClick)},this._createTriangularImageLocationHandle=()=>{this.removeHandles(bt.triangularImageClick);const{imageLocationToolState:e,mode:t,activeTriangulatedViewer:a}=this,i=a?.imageSize;if(!e||"none"===t||!i)return;this.clickAction="pixel-location";let s=null;const o=_(()=>a,"pixel-location",e=>{1===this.measurementVectors.length&&(this.plotLocationPointOnImage(e,!0),s?.abort(),s=r(async a=>{if(!e||this.triangulatedPoint||2===this.measurementVectors?.length||!this.currentBestFeatureMeasurementImage)return;let r=await this.getMapPoint(e,{feature:this.currentBestFeatureMeasurementImage,imageSize:i,mode:t});v(a);const s=this.view?.spatialReference;s&&!r.spatialReference.equals(s)&&(r=await B(r,s),v(a)),await this._calculateTriangulatedPointFromGroundPoint(r,{signal:a}),v(a)}))});this.addHandles(o,bt.triangularImageClick)},this._createImageLocationHandle=()=>{this.removeHandles(bt.imageClick);const{imageLocationToolState:e,mode:t,activeViewer:a,currentBestFeature:i,footprintExtent:s}=this,o=a?.imageSize;if(!(e&&"none"!==t&&o&&s&&i))return;this.clickAction="pixel-location";let n=null;const c=_(()=>a,"pixel-location",e=>{const{currentBestFeatureMeasurementImage:a,triangularMeasurementActive:s,activeTriangulatedViewer:c}=this;this.pixelCoordinates=e;const l=null!=a&&!c?.state.includes("loading");re(!s,l)&&this.plotLocationPointOnImage(e),n?.abort(),n=r(async a=>{if(!e)return;let r=await this.getMapPoint(e,{feature:i,imageSize:o,mode:t});v(a);const n=this.view?.spatialReference;n&&!r.spatialReference.equals(n)&&(r=await B(r,n),v(a)),this.groundCoordinates=r,s&&r&&l&&await this.triangulatedLocationWorkflow(r,a);const c=await this.calculateLocationAccuracy(e,r,t,a);v(a),c&&(this.groundCoordinatesAccuracy=c)})});this.addHandles(c,bt.imageClick)},this._handleImageHitTestResponse=async e=>{const{layer:t,overlayedCameraLocations:a}=this;if(!t)return;const i=e.results.find(({graphic:e,graphic:{attributes:i}})=>a.includes(e)&&i&&!i[t.imageReferenceField]&&!i[t.imageGeometryField]);if(!i)return;const r=i.graphic.attributes[t.objectIdField];await this.showImageByObjectId(r)},this._loadDepthImage=async e=>{const{currentBestFeature:t,layer:a,depthImageNotSupported:i}=this;if(this.depthImage?.destroy(),this.depthImage=null,!a||!t||i)return;const{depthImage:r}=t.attributes;if(!r)return;const s=(await import("./services/DepthImageService.js")).default;v(e),this.depthImage=new s({url:r});try{await this.depthImage.load(e)}catch(o){y(o)||(u.getLogger(this).error("error occurred while loading depth image",o),this.depthImage?.destroy(),this.depthImage=null)}},this._loadImage=async e=>{const{currentBestFeature:t,layer:a,mode:i}=this;if(this.clearGraphics(),!a||!t||"none"===i||"video"===i||"panoramic-video"===i)return;const{attributes:r}=t,{imagePath:s,imageRotation:o,cameraHeading:n,cameraRoll:c,cameraPitch:l,objectId:h,cameraOrientation:d,location:m}=r,p=(c??0)+(o??0),g=m.spatialReference.isWGS84&&4!==d?.type?z(m):new O(m);let w=s;if(je(s))try{w=await Be(a,h,e)}catch(f){if(y(f))return;return rt(f)?(u.getLogger(this).error(f),void this.setMessage("noAttachment","error",`${a.objectIdField}: ${h}`)):(u.getLogger(this).error(f,{[a.objectIdField]:h,layer:a}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${a.objectIdField} ${h}`))}try{await this.loadImageFromSource(w,{imageRotation:p,options:e,pitch:l,yaw:n,mode:i,cameraLocation:g}),v(e),await this.transformAndPlotSelectedLocation(e)}catch(f){y(f)||this.loadImageError(f)}},this._loadVideo=async e=>{const{currentBestFeature:t,layer:a,mode:i,selectedPoint:r}=this,s=t?.attributes.imagePath;if(!a||!t||"panoramic-video"!==i||!s)return;const{attributes:o}=t,{cameraHeading:n,cameraPitch:c,cameraOrientation:l,location:h}=o,u=h.spatialReference.isWGS84&&4!==l?.type?z(h):new O(h);try{this._panoramicVideoViewer.viewModel.video&&this._panoramicVideoViewer.viewModel.video.pause(),this._panoramicVideoViewer.videoSource=s;let t=n??0;u&&r&&(t=await se(u,r)-t),this._panoramicVideoViewer.pitch=c??0,this._panoramicVideoViewer.yaw=t,await this._panoramicVideoViewer.loadVideo(e),v(e)}catch(d){y(d)||this.loadImageError(d)}},this._loadImageFromSourceInternal=async(e,t)=>{const{mode:a,imageRotation:i,options:r}=t,s="string"==typeof e,o=s?e:e.url,{pathname:n,searchParams:c}=new URL(o);let l=s?n.match(Pt)?.[1]:e.datasetFormat;if(!l)try{l=await st(o,{...t.options})}catch(h){y(h)||u.getLogger(this).error("#getContentType()",h)}switch(l??="UNKNOWN FORMAT",a){case"default":this.triangularMeasurementActive?await this._setImageSource(this.imageMeasurementViewer,l,o,c,i,r):await this._setImageSource(this._imageViewer,l,o,c,i,r);break;case"panoramic":if(Mt.has(l.toUpperCase())){const{selectedPoint:e}=this,{pitch:a,yaw:i,cameraLocation:s,viewAngle:n}=t,c=this.triangularMeasurementActive?this._panoramicMeasurementViewer:this._panoramicViewer;let h=i??0;"number"==typeof n?h=n-h:s&&e&&(h=await se(s,e)-h),c.imageSource=o,c.pitch=a??0,c.yaw=h,It.has(l.toUpperCase())?await c.loadImageTiled(o,r):await c.loadImage(r)}else this.setMessage("unsupportedPanoramicImageryError","error",void 0,{datasetFormat:l});break}},this._loadMeasurementViewerImage=async e=>{const{currentBestFeatureMeasurementImage:t,layer:a,mode:i}=this;if(this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearGraphics(),!a||!t||"none"===i||"video"===i||"panoramic-video"===i)return;const{attributes:r}=t,{imagePath:s,imageRotation:o,cameraHeading:n,cameraRoll:c,cameraPitch:l,objectId:h,cameraOrientation:d,location:m}=r,p=(c??0)+(o??0),g=m.spatialReference.isWGS84&&4!==d?.type?z(m):new O(m);let w=s;if(je(s))try{w=await Be(a,h,e)}catch(f){if(y(f))return;return rt(f)?(u.getLogger(this).error(f),void this.setMessage("noAttachment","error",`${a.objectIdField}: ${h}`)):(u.getLogger(this).error(f,{[a.objectIdField]:h,layer:a}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${a.objectIdField} ${h}`))}try{await this.loadImageFromSource(w,{imageRotation:p,options:e,pitch:l,yaw:n,mode:i,cameraLocation:g}),v(e)}catch(f){y(f)||this.loadImageError(f)}},this._loadViewAdapter=async e=>{const{view:t}=this;if(t)switch(t.type){case"2d":{const{default:t}=await import("./adapters/view/MapViewAdapter.js");v(e),this._adapter=new t(this);break}case"3d":{const{default:t}=await import("./adapters/view/SceneViewAdapter.js");v(e),this._adapter=new t(this);break}}else this._adapter=null},this._mapImageConversionToolViewClickHandler=e=>{if(e.stopPropagation(),e.preventDefault(),e.mapPoint){const t=e.mapPoint;t.x=D(t.x,t.spatialReference),this.plotMapPoint(e.mapPoint)}},this._measurementImageClickHandler=e=>{e.stopPropagation(),e.preventDefault();const{sketchTriangular:t,triangularMeasurementActive:a,currentBestFeatureMeasurementImage:i,triangulatedMeasurementGraphic:r}=this;t&&a&&i&&r&&"active"!==t.state&&(t.update([r],{tool:"reshape"}),this.updatingTriangularMeasurementState=!0)},this._viewClickHandler=e=>{this._clickTask?.abort(),this._clickTask=r(async t=>{const{pointerType:a,button:i,mapPoint:r}=e;if(("mouse"!==a||0===i)&&r)return e.stopPropagation(),e.preventDefault(),this._updatingHandles.addPromise(this.loadBestImage(r,{signal:t}))})},this.plotSelectedPointOnImage=async(e,a)=>{if(await w(a),!e)return;const i=new O({...A(e)?e.toJSON():e});if("default"===this.mode)i.x-=.5,i.y=.5-i.y,i.spatialReference=this._imageViewer.imageRenderer.spatialReference.clone(),this._crossSymbol=new t({geometry:i,symbol:We}),this._imageViewer.addGraphic(this._crossSymbol,0);else if("panoramic"===this.mode){const{imageSize:a}=this._panoramicViewer;if(!a)return;const[i,r]=a,{heading:s,pitch:o}=oe(e,i,r),n=ne(s,o);this._crossSymbol=new t({geometry:new O(n,x.WebMercator),symbol:qe}),this._panoramicViewer.addGraphic(this._crossSymbol,0)}},this.handleSectorClick=this.handleSectorClick.bind(this),this.searchBestImage=this.searchBestImage.bind(this),this.transformAndPlotReferencePointOnImage=this.transformAndPlotReferencePointOnImage.bind(this)}initialize(){this.addHandles([b(()=>this.view,()=>this.load(),M),b(()=>this.view?.map,(e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)},I),b(()=>this.view?.map?.allLayers?.length,e=>{e&&this.view?.map?.layers.reorder(this._overlays,e-1)},I),b(()=>[this.state,this.mapImageConversionToolState,this.view],()=>{this._createViewClickHandle(),this._createImageClickHandle()},M),b(()=>[this.triangularMeasurementActive,this.currentBestFeatureMeasurementImage],()=>{this._createTriangularImageClickHandle()},M),b(()=>[this.state,this.imageLocationToolState,this.view],(e,t)=>{if(this._initializeMeasurementService(),this._createImageLocationHandle(),!this.imageLocationToolState)return this.clearPreviousGroundLocation(),void this._resetCursor();e[1]!==t?.[1]&&this._setMeasurementCursor()},M),b(()=>this.measureType,()=>{this.clearPreviousMeasurements(),this._initializeMeasurementService()},M),b(()=>this.bestFeatureAngle,(e,t)=>{this.previousFeatureAngle=t??0},M),b(()=>this.currentBestFeature,async(e,t)=>{m(this._featureChangedTask),this._featureChangedTask=r(async a=>this.determineWorkflowForFeature.apply(this,[e,t,{signal:a}])),await this._featureChangedTask.promise},{sync:!0}),b(()=>this.currentBestFeatureMeasurementImage,(e,t)=>{m(this._featureChangedTask),t&&e!==t&&(this.measurementVectors=[],this.triangulatedPoint=null,this.sketchTriangularGraphicsLayer?.graphics.destroyAll()),this._featureChangedTask=r(async a=>{await this.determineWorkflowForTriangularMeasurement(e,t,{signal:a}),v(a),this._reorderTriangularSketchLayer()})},M),b(()=>this.triangularMeasurementActive,(e,t)=>{t&&!e&&(this.measurementVectors=[],this.currentBestFeatureMeasurementImage=null,this.triangulatedDistanceMeasurement=null,this.triangulatedMeasurementGraphic=null,this.triangulatedPoint=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaAccuracy=0,this.sketchTriangularGraphicsLayer?.graphics.destroyAll(),this.clearReferencePointOnImage(),this.imageMeasurementViewer.clearImage(),this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearImage(),this._panoramicMeasurementViewer.clearGraphics())}),b(()=>this.mode,e=>{switch(this.removeHandles(bt.interactionHandles),e){case"default":this.addHandles(b(()=>{const{state:e}=this;return"image-loaded"===e?this._imageViewer.imagePointsInView:null},e=>{e&&(m(this._updateFootprintTask),this._updateFootprintTask=r(async t=>{await this.updateFootprint(e,void 0,{signal:t})}))},{...M,equals:(e,t)=>a(e,t,h)}),bt.interactionHandles);break;case"video":this.addHandles(b(()=>{const{footprintExtent:e,videoElement:t,bestFeatureFootprint:a}=this;if(e&&t?.loaded&&a)return{videoExtent:Se,bestFeatureFootprint:a}},e=>{e?.videoExtent&&e?.bestFeatureFootprint&&(m(this._updateFootprintTask),this._updateFootprintTask=r(async t=>{await this.updateFootprint(e.videoExtent,void 0,{signal:t})}))},{...M,equals:(e,t)=>a(e?.videoExtent,t?.videoExtent,h)&&e?.bestFeatureFootprint===t?.bestFeatureFootprint}),bt.interactionHandles);break;case"panoramic":this.addHandles(b(()=>{const{currentBestFeature:e,state:t,_panoramicViewer:a}=this,{imageSize:i,vfov:r,hfov:s,pitch:o,yaw:n}=a;return e&&i&&!t.includes("loading")&&null!=r&&null!=s&&null!=o&&null!=n?[r,s,n,o]:null},e=>{if(!e||this.state.includes("loading"))return;const[t,a,i,s]=e;this.currentNode&&(this.currentNode.currentHeading=i+(this.currentNode.heading??0),this.currentNode.currentPitch=s+(this.currentNode.pitch??0)),m(this._updateFootprintTask),this._updateFootprintTask=r(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:a,yaw:i,pitch:s},{signal:e}),this._updateFootprintTask=null})},{equals:(e,t)=>a(e,t,h)}),bt.interactionHandles);break;case"panoramic-video":this.addHandles(b(()=>{const{currentBestFeature:e,state:t,_panoramicVideoViewer:a}=this,{imageSize:i,vfov:r,hfov:s,pitch:o,yaw:n,viewModel:c}=a,l=c.closestFeature??e;return l&&i&&!t.includes("loading")&&null!=r&&null!=s&&null!=o&&null!=n?[r,s,n,o,l]:null},e=>{if(!e)return;const[t,a,i,s,o]=e;m(this._updateFootprintTask),this._updateFootprintTask=r(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:a,yaw:i,pitch:s,feature:o},{signal:e}),v(e),this._updateFootprintTask=null})},{equals:(e,t)=>a(e,t,h)}),bt.interactionHandles)}},M),b(()=>[this.brightness,this.contrast,this.sharpness],()=>{const{_imageViewer:e,brightness:t,contrast:a,mode:i,sharpness:r}=this;"default"===i&&(e.brightness=t,e.contrast=a,e.sharpness=r)},M),b(()=>this.activeViewer?.imageRenderer,()=>{this.sketch&&(this.sketch.view=this.activeViewer?.imageRenderer)}),b(()=>this.activeViewer,e=>{this.removeHandles(bt.hittestHandles),e&&this.addHandles(_(()=>e,"hittest-response",this._handleImageHitTestResponse),bt.hittestHandles)})]),this.when().finally(()=>{this.notifyChange("state")})}destroy(){this.currentBestFeature=null,this._updateFootprintTask=m(this._updateFootprintTask),this._clickTask=m(this._clickTask),this.coverageFrustums.destroy(),this.coveragePolygons.destroy(),this.pointSources.destroy(),this.additionalFootprints.destroy(),this.additionalCameraLocations.destroy(),this.bestFeatureFootprint=p(this.bestFeatureFootprint),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),this.videoViewModel=p(this.videoViewModel),this._crossSymbol=p(this._crossSymbol),this._referencePointOnGround=p(this._referencePointOnGround),this._referencePointOnImage=p(this._referencePointOnImage),this._locationPointOnImage=p(this._locationPointOnImage),this._overlays&&this.view?.map?.remove(this._overlays),this._overlays.destroy(),this._imageViewer.destroy(),this.imageMeasurementViewer.destroy(),this._panoramicViewer.destroy(),this._panoramicMeasurementViewer.destroy()}get activeLayer(){return o(u.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){o(u.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer=e}get activeViewer(){const{_imageViewer:e,_panoramicViewer:t,mode:a}=this;switch(a){case"default":return e;case"panoramic":return t;default:return null}}get activeTriangulatedViewer(){switch(this.mode){case"default":return this.imageMeasurementViewer;case"panoramic":return this._panoramicMeasurementViewer;default:return null}}get accuracyParametersMissing(){return this.layer?.orientationAccuracy?.every(e=>0===e)??!0}get brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",d(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",d(e,-10,10))}get currentNode(){const{currentBestFeature:e,navigationNodes:t}=this;return t.find(t=>t.id===e?.attributes.objectId)}get depthImageNotSupported(){if(this.currentBestFeature?.attributes.depthImage)return!ot(this.currentBestFeature.attributes.depthImage)}get featureCount(){return this.features?.length??0}get imageGalleryEnabled(){const{currentBestFeature:e}=this;if(!e)return!1;const t=e.attributes.imagePath?.trim();return ot(t)||je(t)}get imageLoaded(){return o(u.getLogger(this),"imageLoaded",{replacement:'Use OrientedImageryViewer.state === "image-loaded"',version:"4.29",warnOnce:!0}),"image-loaded"===this.state}get invalidCameraHeading(){return this.currentBestFeature?.attributes?.cameraHeading===ke}get imagePointsInView(){const{mode:e,_imageViewer:t}=this;return"default"===e?t.imagePointsInView:null}get layerView(){const{layer:e,view:t}=this;if(e&&t)return t.allLayerViews.find(nt(e))}get layerFloorFilterClause(){const{layerView:e}=this;return e?we(e):null}get mode(){const e=this.currentBestFeature?.attributes;if(!e)return"none";const t=e.orientedImageryType;if(t?.includes("video"))return t.includes("360")?"panoramic-video":"video";const{horizontalFieldOfView:a,isSpherical:i}=e;return 360===a||i?"panoramic":"default"}get panoramicVideoLoaded(){const{mode:e,_panoramicVideoViewer:t}=this,{videoLoaded:a}=t.viewModel;return("panoramic-video"===e&&!0===a)??!1}get popupEnabled(){return!0===this.layer?.popupEnabled}get referencePoint(){return this._referencePointOnGround?.geometry}get sectorData(){const{_sectorData:e}=this;return e?Ae.map(t=>e[t]):null}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",d(e,0,1))}get sketchGraphicsLayer(){const{sketch:e}=this;return"graphics"===e?.layer?.type?e.layer:void 0}get state(){const{mode:e,_updatingHandles:{updating:t},_featureChangedTask:a}=this;if(!this.isFulfilled()||t||!1===a?.finished)return"loading";if(this.isRejected())return"error";if("error"===this.displayMessage?.type)return"image-load-error";switch(e){case"default":return this._imageViewer.state;case"panoramic":return this._panoramicViewer.state;case"video":return this.videoElement?.loaded?"video-loaded":"video-not-loaded"}return"ready"}get thumbnails(){const{features:e}=this;return e?new s(e.map(({attributes:{imagePath:e,objectId:t,cameraRoll:a,imageRotation:i}})=>{const r=e?.trim();return ot(r)||je(r)?{url:r,objectId:t,rotation:(a??0)+(i??0)}:null}).filter(i)):null}set view(e){this._set("view",e)}get _defaultGraphicsLayer(){const e={blendMode:"source-atop"};switch(this.mode){case"panoramic":return new U({...e,elevationInfo:{mode:"absolute-height"}});case"default":return new U({...e});default:return}}get _overlaysView(){return this.view?.layerViews.find(({layer:e})=>e===this._overlays)}beforeLoad(e=!0){this.view?.closePopup(),e&&(this.displayMessage=null),this.clearPreviousGroundLocation(),this.triangularMeasurementActive=!1,this.currentBestFeatureMeasurementImage=null,this.measureType=null,this.imageLocationToolState=!1,this.features.removeAll(),this.currentBestFeature=null,this.additionalFeatures.removeAll(),this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),this._overlays?.removeAll()}async computeHeight(e,t,a=!0){return this._measurementService?.computeHeight(e,t,a)}async calculateAreaMeasurement(e,t,a){return this._measurementService?.calculateAreaMeasurement(e,t,a)}async calculateDistanceMeasurement(e,t,a){return this._measurementService?.calculateDistanceMeasurement(e,t,a)}async calculateAccuracy(e,t,a){return this._measurementService?.calculateAccuracy(e,t,a)}async calculateLocationAccuracy(e,t,a="default",i){return this._measurementService?.calculateLocationAccuracy(e,t,a,i)}async calculateAccuracyPanoramic(e,t,a=!1,i){return this._measurementService?.calculateAccuracyPanoramic(e,t,a,i)}async calculateHeightMeasurementInfo(e,t,a){return this._measurementService?.calculateHeightMeasurementInfo(e,t,a)}async calculateTriangulatedMeasurements(e){await(this._measurementService?.calculateTriangulatedMeasurements(e))}clearPreviousMeasurements(){this.clearMeasurementGraphics(),this.resetMeasurementData(),this.stopMeasurement()}clearPreviousGroundLocation(){this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.pixelCoordinates=null,this.clearLocationPointOnImage()}clearMeasurementGraphics(){this.measurementGraphic&&(this.activeViewer?.removeGraphic(this.measurementGraphic),this.measurementGraphic=null),this.heightGraphic&&(this.activeViewer?.removeGraphic(this.heightGraphic),this.heightGraphic=null),this.triangularMeasurementActive&&this.sketchTriangularGraphicsLayer?.graphics.destroyAll()}digitizeCancel(){return this.sketch?.cancel()}digitizeCanRedo(){return this.sketch?.canRedo()??!1}digitizeCanUndo(){return this.sketch?.canUndo()??!1}digitizeComplete(){return this.sketch?.complete()}async digitizeCreate(e,t){const{sketch:a,dataCaptureLayer:i}=this;if(!a)throw Vt();Ge(i,e,a),await a.create(e,{...t,defaultZ:0})}digitizeDelete(){if(!this.sketch)throw Vt();return this.sketch.delete()}digitizeDuplicate(){if(!this.sketch)throw Vt();return this.sketch.duplicate()}digitizePlace(e,t){if(!this.sketch)throw Vt();return this.sketch.place(e,t)}digitizeRedo(){if(!this.sketch)throw Vt();return this.sketch.redo()}digitizeUndo(){if(!this.sketch)throw Vt();return this.sketch.undo()}digitizeUpdate(e,t){if(!this.sketch)throw Vt();return this.sketch.update(e,t)}async displayHeightResults(){const{currentBestFeature:e,activeViewer:t,heightMeasurementPixels:a,mode:i}=this,r=t?.imageSize,s=e?.attributes;if(!s||!r)return;const o=await this.computeHeight(a,i);o?.value&&o?.accuracy&&(this.heightMeasurementResult=o.value,this.heightMeasurementAccuracy=o.accuracy)}filterByFootprints(e,t,a=!1){const i=[],r=[],s=[];return e.forEach(e=>{const{layer:{coveragePercent:o},attributes:n}=e;let c;const{polygon:l,frustum:h}=J(n);if(c=l.clone(),n.isInspection&&(c=Z(n)),o&&(c=K(c,o)),a||!t||Q(c,t)){s.push(e);const{geometry:t,objectId:a,cameraHeight:o,cameraHeading:c}=n,u=t.clone();u.z=o,u.imageID=a,this.pointSources.push(u),c!==ke&&(i.push(l),h&&r.push(h))}}),{features:s,polygons:i,frustums:r}}getMeasurementProperties(e=this.currentBestFeature,t=this.activeViewer){if(!e||!t?.imageSize)return;const{elevationSample:a,attributes:i}=e,{elevationSource:r,cameraHeight:s}=i,o=ce(i,t.imageSize[0],t.imageSize[1]);let n=o.cameraLocation;return(n.spatialReference.isGeographic?B(n,x.WebMercator):Promise.resolve(n)).then(e=>(n=e,le(n.spatialReference,n.z??0,s,{elevationSample:a,elevationSource:r,extent:this.footprintExtent}))).then(t=>("elevationSample"in t&&he(t.elevationSample)&&(e.elevationSample=t.elevationSample),{...o,cameraLocation:n,updateElevationProps:t}))}getMeasurementPropertiesPanoramic(e=this.currentBestFeature,t=this.activeViewer){if(!e||!t?.imageSize)return;const{elevationSample:a,attributes:i}=e,{elevationSource:r,cameraHeight:s}=i,o=ue(i,t.imageSize[0],t.imageSize[1]);let n=o.cameraLocation;return(n.spatialReference.isGeographic?B(n,x.WebMercator):Promise.resolve(n)).then(e=>(n=e,le(n.spatialReference,n.z??0,s,{elevationSample:a,elevationSource:r,extent:this.footprintExtent}))).then(t=>("elevationSample"in t&&he(t.elevationSample)&&(e.elevationSample=t.elevationSample),{...o,cameraLocation:n,updateElevationProps:t}))}async deleteDataCaptureFeatures(e){const{dataCaptureLayer:t}=this;if(!t)throw new n("orientedimageryviewer:missing-featurelayer","Data capture layer is not available");return t.queryFeatures({objectIds:e}).then(({features:e})=>t.applyEdits({deleteFeatures:e}))}handleSectorClick(e){if(isNaN(e))return;const t=this._sectorData?.[Ae[e]],a=t?.at(0);a&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(a):this._updateCurrentBestFeature(a))}handleFeatureClick(e){const{sector:t,featureIndexInSector:a}=e;if(isNaN(a))return;const i=this._sectorData?.[t],r=i?.at(a);r&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(r):this._updateCurrentBestFeature(r))}handleDrawCursorUpdateEvents(e){const{measurementAngle:t,tempDistance:a,heightMeasurementPixels:i,mode:r,activeViewer:s,currentBestFeature:o}=this,n=s?.imageSize;if(!e.vertices||!n||!o)return;const c=xe(e.vertices.at(-1),r,n);if(i.length<1||!c||!a||!t||"none"===r)return;const l=He(i[0],c,t);if(!l?.length)return;this.heightMeasurementPixels.push(l),"panoramic"===r?this.createPolylineGraphicPano():this.createPolylineGraphic();const h=Ee(o.attributes.location.spatialReference),u=De(this.heightMeasurementPixels,a,h);u&&(this.heightMeasurementResult=u)}async handleDrawVertexAddEvents(e,t){const{currentBestFeature:a,activeViewer:i,heightMeasurementPixels:r,mode:s}=this;if(!a||!i||!e.vertices?.length||"none"===s)return;const o=i?.imageSize;if(!r.length&&o){const a=xe(e.vertices.at(-1),s,o);this.heightMeasurementPixels.push(a);const i=await this.calculateHeightMeasurementInfo(a,s,t);if(!i?.measurementAngle||!i?.tempDistance)return;this.measurementAngle=i.measurementAngle,this.tempDistance=i.tempDistance}}load(e){return this.addResolvingPromise(this._loadViewAdapter(e).catch(e=>{if(!y(e))throw e})),this}async loadBestImage(e,t){return this.selectedPoint=Y(e),this.beforeLoad(),this._fetchFeaturesWithController(e,t)}loadImageError(e){u.getLogger(this).error("oriented-imagery-viewer:load-image",e),this.setMessage("imageLoadError","error",e.message)}async loadSketch(e){if(!this.sketch){const t=import("../Sketch/SketchViewModel.js"),{default:a}=await t;v(e),this.sketch=new a({layer:this._defaultGraphicsLayer,view:this.activeViewer?.imageRenderer,updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{edgeOperation:"none",shapeOperation:"none",vertexOperation:void 0},enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:"transform"}})}return this.sketch}async loadMeasurementAdapter(e){if(!this.sketchAdapter){const t=import("./adapters/sketch/MeasurementAdapter.js"),{default:a}=await t;if(v(e),this.sketchAdapter=new a({viewModel:this}),!this.sketchAdapter.viewModel.isResolved())return}return this.sketchAdapter}async loadTriangulatedMeasurementAdapter(e){if(!this.triangulatedMeasurementAdapter){const t=import("./adapters/sketch/TriangulatedMeasurementAdapter.js"),{default:a}=await t;if(v(e),this.triangulatedMeasurementAdapter=new a({viewModel:this}),!this.triangulatedMeasurementAdapter.viewModel.isResolved())return}return this.triangulatedMeasurementAdapter}async processFeatureResponse(e,t,a){const{features:i}=e;if(this._clearFeatureGeometries(),!this._checkFeatures(i))return;const{features:r,polygons:s,frustums:o}=this.filterByFootprints(i,t,a?.skipFilter);if(!this._checkFeatures(r))return;this.coveragePolygons.addMany(s),this.coverageFrustums.addMany(o);const n=await this.processElevationSample(s,r,a);v(a),await this._updateElevationOfSelectedPointAndLocations(r,t,n),v(a),ct(r,n);const c=this._processSuitableFeatures(r,t);this.updateSuitabilities(c,a?.loadBestImage)}async processFeatureElevation(e,t,a){if(!t)return;const{features:i,polygons:r}=this.filterByFootprints(e,t,!0);if(!i?.length)return;const s=await this.processElevationSample(r,i,a);return v(a),s}async startMeasurement(e,t){this.sketch||await this.loadSketch(t),await this.loadMeasurementAdapter(t);const{sketch:a,sketchAdapter:i,activeViewer:r,mode:s}=this;if(!a||!i||!r||"none"===s)return;if(this.displayNewMeasurementButton=!1,"panoramic"===s&&(a.defaultCreateOptions.defaultZ=0),await a.create(e),"panoramic"===s){const{drawOperation:e}=a.view.activeTool;e.constraintsEnabled=!1,e._set("elevationDrawSurface",null)}const o=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;o&&this.sketch&&(this.sketch.polygonSymbol=$e(o),this.sketch.polylineSymbol="panoramic"===s?Je:Ze(o,2.5))}startHeightMeasurement(){this.heightMeasurementPixels=[],this.displayNewMeasurementButton=!1,this.draw??=new _e({view:this.activeViewer?.imageRenderer});this.draw.create("polyline").on(["cursor-update","vertex-add","draw-complete"],e=>this.handleDrawEvents(e))}createPolylineGraphic(){const e=[this.heightMeasurementPixels[0],this.heightMeasurementPixels.at(-1)],a=this.activeViewer?.imageRenderer.spatialReference;if(this.heightGraphic)this.heightGraphic.geometry=new j({paths:[e],spatialReference:a});else{const i=new j({paths:[e],spatialReference:a}),r=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;this.heightGraphic=new t({geometry:i,symbol:Ze(r,2.5)}),this.activeViewer?.addGraphic(this.heightGraphic)}}createPolylineGraphicPano(){const e=this.activeViewer?.imageRenderer.spatialReference,a=this.activeViewer?.imageSize;if(!a)return;const i={x:this.heightMeasurementPixels[0][0],y:this.heightMeasurementPixels[0][1]},r={x:this.heightMeasurementPixels.at(-1)[0],y:this.heightMeasurementPixels.at(-1)[1]},{heading:s,pitch:o}=oe(i,a[0],a[1]),{heading:n,pitch:c}=oe(r,a[0],a[1]),l=[[...ne(s,o)],[...ne(n,c)]];if(this.heightGraphic)this.heightGraphic.geometry=new j({paths:[l],spatialReference:e});else{const a=new j({paths:[l],spatialReference:e});this.heightGraphic=new t({geometry:a,symbol:Je}),this._panoramicViewer.addGraphic(this.heightGraphic,0)}}async editOverlayedGraphics(e){this.sketchTriangularGraphicsLayer||this._initializeSketchTriangularGraphicsLayer(),this.sketchTriangularGraphicsLayer?.destroyed&&this._handleDestroyedTriangularSketchLayer(),this.sketchTriangularGraphicsLayer.add(e),this.sketchTriangular||(this._initializeSketchTriangular(),await this.loadTriangulatedMeasurementAdapter()),this.updateOverlayedGeometry(e)}updateOverlayedGeometry(e){this.sketchTriangular?.update([e],{tool:"reshape"})}async processMeasurementVectors(e){this.triangularMeasurementActive&&this.currentBestFeature&&(this.measurementVectors?.length<2&&await this.updateMeasurementVectorsArray(e),2===this.measurementVectors.length&&await this.calculateTriangulatedMeasurements(e))}async updateMeasurementVectorsArray(e){const t=this.measurementVectors.length?this.currentBestFeatureMeasurementImage:this.currentBestFeature;if(t){const a=await this.computeMeasurementVector(e,t);a&&this.measurementVectors.push(a)}}async computeMeasurementVector(e,t){const{activeViewer:a,mode:i}=this,r=a?.imageSize;if(!e||!t||!r)return;const s=ze(e,i,r),o=this.view?.spatialReference,n=[];for(let c=0;c<s.length;c++){const e={x:s[c][0],y:s[c][1]};let a=await this.getMapPoint(e,{feature:t,imageSize:r,mode:i});o&&!a.spatialReference.equals(o)&&(a=await B(a,o)),n.push(a)}return Ue(n,t)}async handleDrawEvents(e,t){if(this.draw)switch(e.type){case"cursor-update":this.handleDrawCursorUpdateEvents(e);break;case"vertex-add":await this.handleDrawVertexAddEvents(e,t);break;case"draw-complete":await this.displayHeightResults()}}initializeMeasurement(e){switch(this.clearMeasurementGraphics(),this.resetMeasurementData(),e){case"distance":this.startMeasurement("polyline");break;case"area":this.startMeasurement("polygon");break;case"height":this.startHeightMeasurement()}}async overlayCameraLocations(e){const{activeViewer:a,currentBestFeature:i,overlayedCameraLocations:r,layer:s,mode:o,state:n,layerFloorFilterClause:c}=this,l=a?.imageSize;if(!l||!i||!s||"none"===o||n.includes("loading"))return;const{polygon:h}=J(i.attributes);if(a.removeManyGraphics(r.toArray()),r.removeAll(),e){const{features:e}=await s.queryFeatures({where:P(`${s.objectIdField} <> ${i.attributes.objectId}`,P(s.definitionExpression,c)),geometry:h,returnGeometry:!0,outFields:[s.objectIdField]}),n=await Promise.all(e.map(async e=>{const{attributes:a,geometry:r}=e,s=await this.getPixels(r,{feature:i,imageSize:l,mode:o}),n="panoramic"===o?Ke():Qe();return new t({attributes:a,symbol:n,geometry:s})}));r.addMany(n),a.addManyGraphics(r.toArray())}}overlayGraphicsOnImage(e,t){this.removeOverlayedGraphicsOnImage(e),this.overlayedMapFeatures.set(e,t),this.activeViewer?.addManyGraphics(t.toArray())}async overlayMapFeatures(e,a=!1){const{activeViewer:r,currentBestFeature:o,mode:n,state:c,layer:l}=this,h=r?.imageSize;if(!h||!o||"none"===n||"video"===n||"panoramic-video"===n||c.includes("loading")||!l)return;const{polygon:d}=J(o.attributes);try{const{imageGeometryField:t,oiObjectIdField:a}=Te(e,l.imageGeometryField,l.imageReferenceField);this.imageGeometryField=t.name,this.oiObjectIdField=a.name}catch(g){u.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features",g)}const{features:m}=await e.queryFeatures({geometry:d,returnGeometry:!0,outFields:["*"]}),p=new s((await Promise.all(m.map(async i=>{const r=i.symbol?.clone()??e.renderer?.getSymbol(i)?.clone(),{attributes:s,geometry:c}=i,l=c,{imageGeometryField:d,oiObjectIdField:m}=this;if(d&&m&&Oe(e,d,m)&&`${s[m]}`==`${o.attributes.objectId}`)try{return Re(s,d,e,a,h,n,r)}catch(g){u.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features","couldn't create graphic from attributes, geometry will be used",{error:g,feature:i,layer:e,imageGeometryField:this.imageGeometryField,imageReferenceField:this.oiObjectIdField})}switch(l?.type){case"point":{const i=await this.getPixels(l,{feature:o,imageSize:h,mode:n});return new t({attributes:s,layer:e,symbol:r,geometry:i,visible:e.visible&&a})}case"polygon":{const{rings:i,spatialReference:c}=l,u=i.map(e=>e.map(([e,t,a])=>new O({x:e,y:t,z:a,spatialReference:c}))),d=await Promise.all(u.map(async e=>this.getPixels(e,{feature:o,imageSize:h,mode:n}).then(e=>e.map(de))));return new t({attributes:s,layer:e,symbol:r,geometry:new R({rings:d,spatialReference:x.WebMercator}),visible:e.visible&&a})}case"polyline":{const{paths:i,spatialReference:c}=l,u=i.map(e=>e.map(([e,t,a])=>new O({x:e,y:t,z:a,spatialReference:c}))),d=await Promise.all(u.map(async e=>this.getPixels(e,{feature:o,imageSize:h,mode:n}).then(e=>e.map(de))));return new t({attributes:s,layer:e,symbol:r,geometry:new j({paths:d,spatialReference:x.WebMercator}),visible:e.visible&&a})}case"multipoint":{const{points:i,spatialReference:c}=l,u=i.map(([e,t,a])=>new O({x:e,y:t,z:a,spatialReference:c})),d=await this.getPixels(u,{feature:o,imageSize:h,mode:n}).then(e=>e.map(de));return new t({attributes:s,layer:e,symbol:r,geometry:new T({points:d,spatialReference:x.WebMercator}),visible:e.visible&&a})}}return null}))).filter(i));this.overlayGraphicsOnImage(`${e.id}`,p)}getDepthAt(e){const{activeViewer:t,currentBestFeature:a,mode:i,state:r,depthImage:s}=this,o=t?.imageSize;if(!o||!a||"none"===i||r.includes("loading"))return u.getLogger(this).warnOnce("oriented-imagery-viewer:get-depth-at","Load an image to use depth"),null;if(!s?.loaded)return u.getLogger(this).error("oriented-imagery-viewer:get-depth-at","Depth image is not loaded"),this.emit("depth-image-service:not-loaded"),null;const n=(Array.isArray(e)?e:[e]).map(e=>s.depthAt(e,{width:o[0],height:o[1]})??null);return Array.isArray(e)?n:n[0]}async getPixels(e,t){const{imageSize:a,mode:i,feature:r}=t,s=(await this.worldToImage(Array.isArray(e)?e:[e],r)).map(e=>{if("default"===i)return new O({x:e.x-.5,y:.5-e.y,spatialReference:x.WebMercator});const[t,r]=a,{heading:s,pitch:o}=oe(e,t,r),n=ne(s,o);return new O(n,x.WebMercator)});return Array.isArray(e)?s:s[0]}async getMapPoint(e,t){const{feature:a,mode:i,imageSize:r}=t,{elevationSample:s,attributes:o}=a,{elevationSource:n,location:c,cameraHeight:l}=o;let h=c.clone();h.spatialReference.isGeographic&&(h=await B(h,x.WebMercator));const u=await le(c.spatialReference,c.z??0,l,{elevationSample:s,elevationSource:n,extent:this.footprintExtent});let d;"elevationSample"in u&&he(u.elevationSample)&&(a.elevationSample=u.elevationSample);const m=Array.isArray(e)?e:[e];if(this.depthImage?.loaded)for(const p of m){const e=this.getDepthAt(p);null!=e&&(p.depth=e)}if("default"===i){const e=ce(o,r[0],r[1]);d=await ee(m,{...e,cameraLocation:h},u)}else{const e=ue(o,r[0],r[1]);d=await te(m,{...e,cameraLocation:h},u)}return Array.isArray(e)?d:d[0]}getActiveSectors(){return Ae.filter(e=>this._sectorData?.[e]?.length)}async plotMapPoint(e){return this.plotReferencePoint(e),this.transformAndPlotReferencePointOnImage({feature:this.currentBestFeature,selectedLocation:e,options:{signal:this._transformController?.signal}})}plotReferencePointOnGround(e){this._referencePointOnGround&&(this._overlays?.remove(this._referencePointOnGround),this._referencePointOnGround.destroy()),null!=e&&(this._referencePointOnGround=new t({geometry:new O({...e.toJSON()}),symbol:Xe}),this.view?this._overlays?.add(this._referencePointOnGround):this.emit("plot-ground-point",{data:{point:this._referencePointOnGround?.geometry}}))}plotReferencePointOnImage(e){if("image-loaded"===this.state)switch(this.clearReferencePointOnImage(),this.mode){case"default":{const a=A(e)?e.toJSON():e;a.x-=.5,a.y=.5-a.y,this._referencePointOnImage=new t({geometry:new O({spatialReference:this._imageViewer.imageRenderer.spatialReference,...a}),symbol:Xe}),this._imageViewer.addGraphic(this._referencePointOnImage,0);break}case"panoramic":{const{imageSize:a}=this._panoramicViewer;if(!a)return;const[i,r]=a,{heading:s,pitch:o}=oe(e,i,r),n=ne(s,o);this._referencePointOnImage=new t({geometry:new O(n,x.WebMercator),symbol:Ye}),this._panoramicViewer.addGraphic(this._referencePointOnImage,0);break}}}plotLocationPointOnImage(e,t=!1){if("image-loaded"===this.state)switch(this.clearLocationPointOnImage(t),this.mode){case"default":this._plotLocationPointOnDefaultImage(e,t);break;case"panoramic":this._plotLocationPointOnPanoramicImage(e,t)}}removeAllOverlayMapFeatures(){this.overlayedMapFeatures.forEach(e=>{this._imageViewer.removeManyGraphics(e.toArray())}),this.overlayedMapFeatures.clear()}removeOverlayedGraphicsOnImage(e){const t=this.overlayedMapFeatures.get(e);t?.length&&(this.activeViewer?.removeManyGraphics(t.toArray()),this.overlayedMapFeatures.delete(e))}reset(){const{mode:e}=this;"default"===e||"panoramic"===e?this.resetImage():"video"===e?this.resetVideo():"panoramic-video"===e&&this.resetVideoPanoramic(),this.beforeLoad(!1)}resetImage(){switch(this.setMessage("onLoadMessage","info"),this.mode){case"default":this._imageViewer.clearImage(),this._imageViewer.clearGraphics();break;case"panoramic":this._panoramicViewer.clearGraphics()}this._clickTask=m(this._clickTask)}resetVideo(){this.setMessage("onLoadMessage","info"),this.videoViewModel?.resetVideoHandler(),this._overlays?.removeAll(),this.videoViewModel=null,this.featureCache=[],this.currentBestFeature=null}resetVideoPanoramic(){this.setMessage("onLoadMessage","info"),this._overlays?.removeAll(),this.currentBestFeature=null}resetMeasurementData(){this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.heightMeasurementPixels=[],this.measurementVectors=[],this.heightMeasurementResult=0,this.tempDistance=null,this.measurementAngle=null,this.heightMeasurementAccuracy=0,this.heightGraphic=null,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedMeasurementGraphic=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaAccuracy=0}async saveDrawing(){const{dataCaptureLayer:e,sketchAdapter:t}=this;if(!e||"data-capture"!==t?.type)return;const{pendingGraphics:a,savedGraphics:i}=t,r=a.get(e.id),s=r?.toArray();if(!r||!s?.length)return;const{addFeatureResults:o}=await this.saveDataCaptureFeatures(s),n=o.reduce((t,{objectId:a,globalId:i,error:r},o)=>{const n=s[o],{attributes:c}=n;return r?t.error.push(n):(a&&(c[e.objectIdField]=a),i&&e.globalIdField&&(c[e.globalIdField]=i),t.success.push(n)),t},{success:[],error:[]});i.addMany(n.success),r.removeAll(),r.addMany(n.error)}async saveDataCaptureFeatures(e){const{activeViewer:t,currentBestFeature:a,dataCaptureLayer:r,mode:s}=this,o=t?.imageSize;if(!o||!a||"none"===s||"video"===s||"panoramic-video"===s)throw new n("orientedimageryviewer:missing-input","Image size, current best feature and mode are required to save data capture features");if(!r)throw new n("orientedimageryviewer:missing-featurelayer","Data capture layer is not available");const c=await Promise.all(e.map(async e=>{const t=e.clone(),{geometry:i}=t;if(!i)return;const n=i.type,c=r.hasZ,l=r.geometryType,h=n!==l,u=h?await import("./transformers.js"):null,d=u?.default[l],m=h?d?.(i):i;if(m)switch(m.type){case"point":return t.geometry=await this.getMapPoint(me(s,m,o),{feature:a,imageSize:o,mode:s}),c||(delete t.geometry.z,t.geometry.hasZ=!1),t.geometry.hasM=!1,t;case"polygon":{const e=await Promise.all(m.rings.map(async e=>this.getMapPoint(e.map(([e,t,a])=>me(s,{x:e,y:t,z:a},o)),{feature:a,imageSize:o,mode:s})));return t.geometry=new R({spatialReference:e[0][0].spatialReference,hasZ:c,hasM:!1,rings:e.map(e=>e.map(de))}),t}case"polyline":{const e=await Promise.all(m.paths.map(async e=>this.getMapPoint(e.map(([e,t,a])=>me(s,{x:e,y:t,z:a},o)),{feature:a,imageSize:o,mode:s})));return t.geometry=new j({spatialReference:e[0][0].spatialReference,hasZ:c,hasM:!1,paths:e.map(e=>e.map(de))}),t}}})),l=c.filter(i);return r.applyEdits({addFeatures:l}).then(e=>{const{addFeatureResults:t}=e;let a=0;const i=c.map(e=>{const i=t[a++];return e?i:{error:new n("orientedimageryviewer:save-unsucccessful","Error in saving data capture features"),objectId:null,globalId:null}});return{...e,addFeatureResults:i}})}async searchBestImage(e,t){try{const a=await W(e,t);a&&await this.processFeatureResponse(a,e.point,t)}catch(a){y(a)||(this.setMessage("imageLoadError","error",a.message),u.getLogger(this).error("error occurred while finding best image",a))}}selectTriangularMeasurementFeature(e){this.currentBestFeatureMeasurementImage=this.features?.find(({attributes:t})=>t.objectId===Number(e))}setAdditionalCameraLocationsVisibility(e){this.additionalCameraLocations.forEach(t=>{t.visible=e})}setAdditionalCoverageVisibility(e){this.additionalFootprints.forEach(t=>{t.visible=e})}setCurrentCoverageVisibility(e){this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.visible=e),this.currentBestFeatureLocation&&(this.currentBestFeatureLocation.visible=e)}setMapImageConversionToolState(e){this.mapImageConversionToolState=e}setCurrentPanoramaView(e,t){this._panoramicViewer?.set({yaw:e,pitch:t})}async startDataCapture(e,t){const a=this.activeViewer?.imageRenderer,{oiObjectIdField:i,currentBestFeature:r}=this;if(!a||!r||!i)return;const{attributes:{objectId:o}}=r,n=this.overlayedMapFeatures.get(e.id)?.toArray()??[],c=[],l=[];for(const s of n)`${s.getAttribute(i)}`==`${o}`?c.push(s):l.push(s);this.overlayGraphicsOnImage(e.id,new s(l)),this.collectionId=e.id;const h=await this.loadSketch(t),u=await this.loadDataCaptureAdapter(t);v(t),h.addGraphics(c),u.savedGraphics.addMany(c);a.ui.find("zoom").visible=!1,a.map.layers.add(this.sketchGraphicsLayer)}async stopDataCapture(e=!1){this.sketch?.cancel(),this.sketchGraphicsLayer?.removeAll(),this.sketchAdapter=p(this.sketchAdapter),this.sketch=p(this.sketch),this.collectionId=null;const{dataCaptureLayer:t}=this,a=this.activeViewer?.imageRenderer;if(!a||a.destroyed)return;a.map.layers.remove(this.sketchGraphicsLayer),e&&t&&await this.overlayMapFeatures(t,!0);const i=a.ui.find("zoom");i&&(i.visible=!0)}stopMeasurement(){this.heightMeasurementPixels=[],this.draw?.reset(),this.sketch?.cancel()}toggleAllOverlayMapFeatures(e){this.overlayedMapFeatures.forEach(t=>{this._toggleVisiblity(t,e)})}toggleOverlayMapFeatures(e,t,a){const i=this.overlayedMapFeatures.get(e);i&&a&&this._toggleVisiblity(i,t)}toggleSelection(e){const{sketch:t}=this;t&&(t.updateOnGraphicClick=e,t.cancel())}async transformAndPlotReferencePointOnImage(e){const{feature:t,selectedLocation:a,options:i}=e;let r=!1,s=!1;const o=this.bestFeatureFootprint?.geometry;switch(o?.type){case"polygon":{const e=a.spatialReference.equals(o.spatialReference)?a:await B(a,o.spatialReference);r=o.contains(e);break}case"mesh":{const e=a.spatialReference.equals(o.spatialReference)?a:await B(a,o.spatialReference);s=o.extent.contains(e);break}}if(!r&&!s)return void this.clearReferencePointOnImage();const n=await this.worldToImage(a,t,i);if(n)return v(i),this.plotReferencePointOnImage(n),{x:n.x,y:n.y};this.clearReferencePointOnImage()}async triangulatedLocationWorkflow(e,t){if(this.currentBestFeature&&e){const{currentBestFeature:a}=this;this.triangulatedPoint&&(this.measurementVectors=[],this.triangulatedPoint=null,this.clearLocationPointOnImage(!0));const i=Ue(e,a);if(!i)return;this.measurementVectors.push(i),await this.plotReferenceLocationPoint(e,t),v(t),this._createTriangularImageLocationHandle()}}async updateFeatureCache(e,t){const a=await q(e,t);a.features?.length&&(this.featureCache=a.features)}async _calculateTriangulatedPointFromGroundPoint(e,t){if(this.currentBestFeatureMeasurementImage&&e){const{currentBestFeatureMeasurementImage:a}=this,i=Ue(e,a);i&&this.measurementVectors.push(i);const r=await Ne(this.measurementVectors);v(t),this.triangulatedPoint=r??this.triangulatedPoint}}async _fetchFeatures(e,t){if(!this.view)return;const a=this.layer;if(a){const i={include:a},r=this.view.toScreen(e);if(!r)return;const s=await this.view.hitTest(r,i);return this._processHitTestResults(a,s,t)}}async _fetchFeaturesWithController(e,t){try{await this._fetchFeatures(e,t)}catch(a){if(y(a))return;this.setMessage("imageLoadError","error"),u.getLogger(this).error("error occurred while fetching features",a)}}_groupFeaturesBySectors(){const{_suitabilities:e,additionalFeatures:t,features:a,invalidCameraHeading:i}=this,r=a.at(0);if(!e||!t||!r||!a||i)return void(this._sectorData=null);this._sectorData={};const o={};this._featureToSector=o;for(const h of Ae)this._sectorData[h]=new s;const n=e.map((e,t)=>({...e,featureIndex:t}));n.sort((e,t)=>e.trueSuitability-t.trueSuitability);const c=n.map(({distance:e})=>e),l=Math.max(...c);n.forEach(e=>{const{distance:t,angle:i,featureIndex:s}=e,n=t/l*Le[2],c=ht(t,l),h=lt(i);if(!this._sectorData)return;const u=Le[3]+n*Math.sin(i*Math.PI/180),d=Le[3]+n*Math.cos(i*Math.PI/180);let m;const p=a.at(s),g=p===r,{cameraPitch:y}=p.attributes,v=y<5;if(g&&v)m=-90;else{const e=u-Le[3],t=d-Le[3],a=t/Math.sqrt(e**2+t**2);let i=180*Math.acos(a)/Math.PI;(e<0&&t<0||e<0&&t>0)&&(i*=-1),m=i}const w=""===c?h:`${c}_${h}`;g&&(m===this.bestFeatureAngle?this.previousFeatureAngle=m:this.bestFeatureAngle=m,this.navigatorCurrentBestFeature=v?null:{x:u,y:d,direction:h}),o[`${p.attributes.objectId}`]=w;const f=this._sectorData[w];f.add({angle:i,featureIndex:s,x:u,y:d,objectID:p.attributes.objectId,sector:w,featureIndexInSector:f.length})})}_handleDestroyedTriangularSketchLayer(){this.sketchTriangularGraphicsLayer&&this.activeTriangulatedViewer&&(this.activeTriangulatedViewer.imageRenderer.map.layers.remove(this.sketchTriangularGraphicsLayer),this.sketchTriangularGraphicsLayer=new U,this.activeTriangulatedViewer.imageRenderer.map.layers.add(this.sketchTriangularGraphicsLayer),this.sketchTriangular&&(this.sketchTriangular.layer=this.sketchTriangularGraphicsLayer,this.sketchTriangular.view=this.activeTriangulatedViewer.imageRenderer))}_initializeMeasurementService(){this._measurementService||(this._measurementService=new Ft(this))}_initializeSketchTriangular(){if(!this.activeTriangulatedViewer)return;const e="panoramic"===this.mode;this.sketchTriangular=new _t({view:this.activeTriangulatedViewer.imageRenderer,layer:this.sketchTriangularGraphicsLayer,updateOnGraphicClick:!1,defaultUpdateOptions:{toggleToolOnClick:!1,enableZ:!e}}),e&&(this.sketchTriangular.defaultUpdateOptions.reshapeOptions={edgeOperation:"offset",shapeOperation:"move-xy",vertexOperation:"move-xy"})}_initializeSketchTriangularGraphicsLayer(){this.activeTriangulatedViewer&&(this.sketchTriangularGraphicsLayer=new U,this.activeTriangulatedViewer.imageRenderer.map.layers.add(this.sketchTriangularGraphicsLayer))}_initializeVideo(){if(this.videoElement||!this.currentBestFeature)return;this.removeHandles(bt.videoPlayerHandles),this.videoElement=new fe({video:this.currentBestFeature.attributes.imagePath,georeference:new ve({extent:new L(Ce)}),autoplay:!1}),this.videoElement.content?.loop&&(this.videoElement.content.loop=!1);const e=new N({source:this.videoElement,title:this.layer?.title,copyright:this.layer?.copyright});this.videoLayer=e,e&&this.videoMapView.map.layers.add(e),this.addHandles(mt(this.videoMapView),bt.videoPlayerHandles),this.videoViewModel=new yt({oiViewModel:this})}_plotLocationPointOnDefaultImage(e,a=!1){const i=A(e)?e.toJSON():e;i.x-=.5,i.y=.5-i.y,a?(this._correctedLocationPointOnImage=new t({geometry:new O({spatialReference:x.WebMercator,...i}),symbol:et}),this.imageMeasurementViewer.addGraphic(this._correctedLocationPointOnImage,0)):(this._locationPointOnImage=new t({geometry:new O({spatialReference:x.WebMercator,...i}),symbol:et}),this._imageViewer.addGraphic(this._locationPointOnImage,0))}_plotLocationPointOnPanoramicImage(e,a=!1){const i=a?this._panoramicMeasurementViewer:this._panoramicViewer,{imageSize:r}=i;if(!r)return;const[s,o]=r,{heading:n,pitch:c}=oe(e,s,o),l=ne(n,c),h=new t({geometry:new O(l,x.WebMercator),symbol:tt});a?this._correctedLocationPointOnImage=h:this._locationPointOnImage=h,i.addGraphic(h,0)}_clearFeatureGeometries(){this.coveragePolygons.removeAll(),this.coverageFrustums.removeAll(),this.pointSources.removeAll()}_checkFeatures(e){return!!e?.length||(this.setMessage("noImageError","error"),this.videoElement?.content?.pause(),this.currentBestFeature=null,!1)}async _getElevationSampleFromGround(e,t,a){if(!e[0])return;const i=await G(e);if(this._updateFootprintWithFeatures(t,i),"3d"===this.view?.type)try{return await this.view.map.ground.createElevationSampler(this.footprintExtent,a)}catch(r){y(r)||u.getLogger(this).error(r)}}async processElevationSample(e,t,a){const{elevationSource:i}=t[0].attributes,r=await this._getElevationSampleFromGround(e,t,a);return r||(i&&this.footprintExtent&&X(i)?await ie({extent:this.footprintExtent,lod:i.lod,url:i.url,rasterFunction:i.rasterFunction}):void 0)}_processSuitableFeatures(e,t){return $({features:e,selectedPoint:t,camera:ut(this.view)?this.view.camera:null,currentImage:this.currentBestFeature})}async _processHitTestResults(e,t,a){const{screenPoint:i,results:[r]}=t,s="graphic"===r?.type&&this.shouldShowSelectedImage,o=r?.mapPoint??this.view?.toMap(i);if(!o)return;o.x=D(o.x,o.spatialReference);const{layerFloorFilterClause:n}=this,c=e.spatialReference.equals(o.spatialReference)?o:await B(o,e.spatialReference),l=c.spatialReference.isGeographic?z(c):c,h=P("1=1",P(e.definitionExpression,n)),u=l.spatialReference.isGeographic?1:V(l.spatialReference),d={layerInstanceOrURL:e,point:l,queryParams:{where:h,maximumDistance:e.maximumDistance?e.maximumDistance/u:void 0,objectIds:s?[r.graphic.getAttribute(e.objectIdField)]:void 0}};await this.searchBestImage(d,a)}async _queryAndLoadByObjectId(e,t,a,i){this.displayMessage=null;const{response:r}=await ft(e,t,a,i);if(v(i),!r?.features?.length)throw new wt(t);const s=J(r.features[0].attributes).polygon,o=O.fromJSON(H(s)),n=Y(o),c=V(n.spatialReference);this.selectedPoint=n;const l={layerInstanceOrURL:e,point:n,queryParams:{where:P(P("1=1",P(e.definitionExpression,a)),`${e.objectIdField} <> ${t}`),maximumDistance:e.maximumDistance?e.maximumDistance/c:void 0}},h=await W(l,i);v(i);const{features:u}=h;return u.push(r.features[0]),await this.processFeatureResponse(h,n,{...i,loadBestImage:!1})}_reorderTriangularSketchLayer(){const e=this.imageMeasurementViewer.imageRenderer.map.layers?.length;this.sketchTriangularGraphicsLayer&&e&&this.imageMeasurementViewer.imageRenderer.map.layers.reorder(this.sketchTriangularGraphicsLayer,e-1)}_resetCursor(){const{activeViewer:e,imageMeasurementViewer:t}=this;e&&this.removeHandles(bt.activeViewerCursorHandles),t&&this.removeHandles(bt.imageViewerCursorHandles)}async _setImageSource(e,t,a,i,r,s){e.imageSource={datasetFormat:t.toUpperCase(),url:a.split("?")[0]},e.customParameters=Object.fromEntries(i),e.imageRotation=r??0,await e.loadImage(s)}_setMeasurementCursor(){const{activeViewer:e,imageMeasurementViewer:t,triangularMeasurementActive:a}=this;e&&this.addHandles(e.imageRenderer.acquireCursor("crosshair","high"),bt.activeViewerCursorHandles),t&&a&&this.addHandles(t.imageRenderer.acquireCursor("crosshair","high"),bt.activeViewerCursorHandles)}_toggleVisiblity(e,t){e.forEach(e=>{e.visible=t})}async _updateElevationOfSelectedPointAndLocations(e,t,a,i){const r=he(a),{location:s,cameraHeight:o}=e[0].attributes,n=await le(s.spatialReference,s.z,o,{elevationSample:r?a:void 0,elevationSource:r?void 0:e[0].attributes.elevationSource,extent:this.footprintExtent},i);v(i);const[c,...l]=await ae([t,...e.map(e=>e.attributes.geometry.clone())],n);v(i),t.elevation=c.z,e.forEach((e,t)=>{e.attributes.elevation=l[t].z})}_updateFeatures(e,t=!0){if(!e.length)return this.currentBestFeature=null,void this.additionalFeatures.removeAll();this.features.removeAll(),this.features.addMany(e),this.navigationNodes.removeAll(),this.navigationNodes.addMany(e.map(e=>{const{geometry:t,attributes:a}=e,{isSpherical:i,cameraHeading:r,cameraPitch:s}=a;return new gt({geometry:t,attributes:a,currentHeading:i?0:r,currentPitch:i?0:s})})),e.length>1?this.additionalFeatures.addMany(e.slice(1)):this.additionalFeatures.removeAll(),this._updateGroundElevation=!0,t&&(this.currentBestFeature=e[0]),"video"===this.mode&&(this._initializeVideo(),this.videoElement?.loaded&&this.videoViewModel?.playVideoFromSelectedLocation(e[0])),"panoramic-video"===this.mode&&this._loadVideo()}_updateFootprintWithFeatures(e,t){const a=[];for(const{attributes:{geometry:i}}of e)t.contains(i)||a.push([i.x,i.y]);a.sort((e,t)=>+E([e,t])),t.addRing(a),this.footprintExtent=be(t.extent,2,2)}async _updatePointsAndPolygons(e){const{pointSources:a,currentBestFeature:i,currentCoverageVisible:r,isAdditionalPointSourcesVisible:s,mode:o,layer:n}=this;if(i&&(this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.destroy(),this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null),!this.invalidCameraHeading)){await(this._adapter?.createFootprints(e)),v(e);for(const e of a)e.imageID===i.attributes.objectId?this.currentBestFeatureLocation=new t({attributes:{imageID:e.imageID},geometry:e.clone(),symbol:at,visible:r}):this.additionalCameraLocations.push(new t({attributes:{imageID:e.imageID},geometry:e.clone(),symbol:it,visible:s}));"video"!==o&&"panoramic-video"!==o||!n||this.featureCache.length||await this.updateFeatureCache(n,i.geometry.spatialReference)}}_updateCurrentBestFeature(e){if(!e)return;if(this.currentBestFeature=this.features?.at(e.featureIndex),"video"===this.mode)return void(this.currentBestFeature&&this.videoViewModel?.playVideoFromSelectedLocation(this.currentBestFeature));if("panoramic-video"===this.mode)return void(this.currentBestFeature&&this._panoramicVideoViewer.viewModel.playPanoramicVideoFromSelectedLocation(this.currentBestFeature));const t=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;let a;if(t)a=-90;else{const t=e.x-Le[3],i=e.y-Le[3],r=i/Math.sqrt(t**2+i**2);let s=180*Math.acos(r)/Math.PI;(t<0&&i<0||t<0&&i>0)&&(s*=-1),a=s}a===this.bestFeatureAngle?this.previousFeatureAngle=a:this.bestFeatureAngle=a,this.navigatorCurrentBestFeature=t?null:{x:e.x,y:e.y,direction:e.sector.includes("_")?e.sector.split("_")[1]:e.sector}}_updateImageMeasurementBestFeature(e){e&&(this.currentBestFeatureMeasurementImage=this.features?.at(e.featureIndex))}clearGraphics(){this._imageViewer.clearGraphics(),this._panoramicViewer.clearGraphics(),this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearGraphics()}clearReferencePointOnImage(){this._referencePointOnImage&&(this._imageViewer.removeGraphic(this._referencePointOnImage),this._panoramicViewer.removeGraphic(this._referencePointOnImage),this._referencePointOnImage=p(this._referencePointOnImage))}clearLocationPointOnImage(e=!1){this._locationPointOnImage&&!e&&(this._imageViewer.removeGraphic(this._locationPointOnImage),this._panoramicViewer.removeGraphic(this._locationPointOnImage),this._locationPointOnImage=p(this._locationPointOnImage)),this._correctedLocationPointOnImage&&(this.imageMeasurementViewer.removeGraphic(this._correctedLocationPointOnImage),this._panoramicMeasurementViewer.removeGraphic(this._correctedLocationPointOnImage),this._correctedLocationPointOnImage=p(this._correctedLocationPointOnImage))}plotReferencePoint(e){"mapPoint"in e?this.plotReferencePointOnGround(e.mapPoint):this.plotReferencePointOnGround(e)}async plotReferenceLocationPoint(e,t){if(this.currentBestFeatureMeasurementImage){const a=await this.worldToImage(e,this.currentBestFeatureMeasurementImage,{signal:t});v(t),a&&this.plotLocationPointOnImage(a,!0)}}setMessage(e,t,a,i){this.displayMessage={key:e,type:t,data:a,map:i}}async transformAndPlotSelectedLocation(e){const{currentBestFeature:t,invalidCameraHeading:a,selectedPoint:i,activeViewer:r}=this;if(this._crossSymbol&&(this._panoramicViewer.removeGraphic(this._crossSymbol),this._imageViewer.removeGraphic(this._crossSymbol),this._crossSymbol=p(this._crossSymbol)),!i||!t||"image-loaded"!==r?.state||a)return;let s;try{s=await this.worldToImage(i,t,e),v(e),await this.plotSelectedPointOnImage(s,e)}catch(o){y(o)||u.getLogger(this).error("failed to transform map point to pixel, cross symbol will not be plotted on image",{error:o,selectedPoint:i,feature:t})}}async worldToImage(e,t,a){const{footprintExtent:i}=this,{imageSize:r}=this.activeViewer;if("none"===this.mode||!t||!r||!i)return;const{attributes:{location:s,elevationSource:o,cameraHeading:n,cameraHeight:c},elevationSample:l}=t;let h=s.clone();const u=await le(s.spatialReference,s.z??0,c,{elevationSample:l,elevationSource:o});t.elevationSample=u.elevationSample;const d=Array.isArray(e)?e:[e];let m,p=await Promise.all(d.map(e=>new Promise(t=>{if(!e.hasZ)return t(ae(e,u));t(e)})));if(s.spatialReference.isGeographic&&(h=await B(h,x.WebMercator,a)),p=await Promise.all(p.map(async e=>h.spatialReference.equals(e.spatialReference)?e:await B(e,h.spatialReference,a))),v(a),"panoramic"===this.mode)m=ye(p,{imageHeight:r[1],imageWidth:r[0],cameraHeading:n,cameraLocation:h});else{const e=pe(t.attributes,r[0],r[1]);m=ge(p,{...e,cameraLocation:h})}return Array.isArray(e)?m:m[0]}updateCurrentCoveragePolygon(e){const{additionalFootprints:a,additionalCameraLocations:i,currentBestFeature:r,currentBestFeatureLocation:s,currentCoverageVisible:o,selectedPoint:n,view:c,_adapter:l,mode:h}=this;if(!r)return;const{attributes:{objectId:u},elevationSample:d}=r;if(this._initialCurrentCoverageUpdate){if(this._overlays?.removeAll(),this._initialCurrentCoverageUpdate=!1,this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),e&&!this.invalidCameraHeading&&(e.visible=o,this.bestFeatureCurrentFootprint=e),c){const e=[...a,...i,s].filter(dt);"3d"===c?.type&&d&&l?.updateGroundElevation&&(this._updateGroundElevation&&l.updateGroundElevation(e,d),"panoramic"===h&&l.updateGroundElevation([this.bestFeatureCurrentFootprint],d)),this._updateGroundElevation=!1,n&&(e.splice(-2,0,this.bestFeatureCurrentFootprint),e.push(new t({geometry:n.clone(),symbol:We.clone(),attributes:{imageID:u}}))),this._overlays.graphics.addMany(e)}}else if(c){if(this.invalidCameraHeading)return;this.bestFeatureCurrentFootprint&&(this._overlays?.remove(this.bestFeatureCurrentFootprint),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint));const t=this.bestFeatureCurrentFootprint&&this._overlays?this._overlays.graphics.indexOf(this.bestFeatureCurrentFootprint):-1;e&&(this.bestFeatureCurrentFootprint=e,"3d"===c?.type&&d&&l?.updateGroundElevation&&"panoramic"===h&&l.updateGroundElevation([e],d),e.visible=this.currentCoverageVisible,this._overlays?.graphics.add(this.bestFeatureCurrentFootprint,t>=0?t:this._overlays.graphics.length-1))}}};e([S()],St.prototype,"activeLayer",null),e([S({readOnly:!0})],St.prototype,"activeViewer",null),e([S()],St.prototype,"activeTriangulatedViewer",null),e([S()],St.prototype,"accuracyParametersMissing",null),e([S()],St.prototype,"additionalFeatures",void 0),e([S({type:s.ofType(t)})],St.prototype,"additionalCameraLocations",void 0),e([S({type:s.ofType(t)})],St.prototype,"additionalFootprints",void 0),e([S()],St.prototype,"areaMeasurementResult",void 0),e([S()],St.prototype,"areaMeasurementAccuracy",void 0),e([S()],St.prototype,"bestFeatureAngle",void 0),e([S()],St.prototype,"bestFeatureCurrentFootprint",void 0),e([S({type:t})],St.prototype,"bestFeatureFootprint",void 0),e([S({type:Number})],St.prototype,"brightness",null),e([S()],St.prototype,"cameraHeadingThreshold",void 0),e([S()],St.prototype,"cameraPitchThreshold",void 0),e([S()],St.prototype,"clickAction",void 0),e([S()],St.prototype,"videoViewModel",void 0),e([S()],St.prototype,"collectionId",void 0),e([S({type:Number})],St.prototype,"contrast",null),e([S()],St.prototype,"conversionProps",void 0),e([S()],St.prototype,"coverageFrustums",void 0),e([S()],St.prototype,"coveragePolygons",void 0),e([S()],St.prototype,"currentBestFeature",void 0),e([S()],St.prototype,"currentBestFeatureMeasurementImage",void 0),e([S()],St.prototype,"currentBestFeatureLocation",void 0),e([S()],St.prototype,"currentCoverageVisible",void 0),e([S()],St.prototype,"currentNode",null),e([S()],St.prototype,"depthImage",void 0),e([S()],St.prototype,"depthImageNotSupported",null),e([S()],St.prototype,"directionMode",void 0),e([S()],St.prototype,"featureCache",void 0),e([S()],St.prototype,"navigationNodes",void 0),e([S({json:{write:!1}})],St.prototype,"determineWorkflowForFeature",void 0),e([S({json:{write:!1}})],St.prototype,"determineWorkflowForTriangularMeasurement",void 0),e([S()],St.prototype,"disabled",void 0),e([S()],St.prototype,"displayMessage",void 0),e([S()],St.prototype,"displayNewMeasurementButton",void 0),e([S()],St.prototype,"distanceMeasurementResult",void 0),e([S()],St.prototype,"distanceAccuracyArray",void 0),e([S()],St.prototype,"dataCaptureLayer",void 0),e([S({readOnly:!0})],St.prototype,"featureCount",null),e([S()],St.prototype,"features",void 0),e([S()],St.prototype,"groundCoordinates",void 0),e([S()],St.prototype,"groundCoordinatesAccuracy",void 0),e([S()],St.prototype,"heightMeasurementPixels",void 0),e([S()],St.prototype,"heightGraphic",void 0),e([S()],St.prototype,"heightMeasurementResult",void 0),e([S()],St.prototype,"heightMeasurementAccuracy",void 0),e([S()],St.prototype,"measurementAngle",void 0),e([S()],St.prototype,"tempDistance",void 0),e([S({readOnly:!0})],St.prototype,"imageGalleryEnabled",null),e([S()],St.prototype,"imageGeometryField",void 0),e([S({readOnly:!0})],St.prototype,"imageLoaded",null),e([S()],St.prototype,"imageLocationToolState",void 0),e([S({readOnly:!0})],St.prototype,"invalidCameraHeading",null),e([S()],St.prototype,"imagePointsInView",null),e([S()],St.prototype,"imageMeasurementViewer",void 0),e([S()],St.prototype,"isAdditionalCoverageVisible",void 0),e([S()],St.prototype,"isAdditionalPointSourcesVisible",void 0),e([S()],St.prototype,"measurementVectors",void 0),e([S()],St.prototype,"layer",void 0),e([S()],St.prototype,"layerView",null),e([S({readOnly:!0})],St.prototype,"layerFloorFilterClause",null),e([S({type:Number})],St.prototype,"localPort",void 0),e([S()],St.prototype,"mapImageConversionToolState",void 0),e([S()],St.prototype,"measureType",void 0),e([S()],St.prototype,"measurementGraphic",void 0),e([S({readOnly:!0,value:"none"})],St.prototype,"mode",null),e([S()],St.prototype,"navigationMode",void 0),e([S()],St.prototype,"navigatorCurrentBestFeature",void 0),e([S()],St.prototype,"oiObjectIdField",void 0),e([S({type:s.ofType(t)})],St.prototype,"overlayedCameraLocations",void 0),e([S()],St.prototype,"overlayedMapFeatures",void 0),e([S()],St.prototype,"panoramicVideoLoaded",null),e([S()],St.prototype,"pixelCoordinates",void 0),e([S()],St.prototype,"preserveAngle",void 0),e([S()],St.prototype,"pointSources",void 0),e([S({readOnly:!0})],St.prototype,"popupEnabled",null),e([S()],St.prototype,"previousFeatureAngle",void 0),e([S()],St.prototype,"referencePoint",null),e([S({readOnly:!0})],St.prototype,"sectorData",null),e([S()],St.prototype,"selectedPoint",void 0),e([S({type:Number})],St.prototype,"sharpness",null),e([S()],St.prototype,"shouldShowSelectedImage",void 0),e([S()],St.prototype,"sketch",void 0),e([S()],St.prototype,"sketchTriangular",void 0),e([S()],St.prototype,"sketchTriangularGraphicsLayer",void 0),e([S()],St.prototype,"draw",void 0),e([S()],St.prototype,"sketchAdapter",void 0),e([S({readOnly:!0})],St.prototype,"sketchGraphicsLayer",null),e([S({readOnly:!0})],St.prototype,"state",null),e([S({readOnly:!0})],St.prototype,"thumbnails",null),e([S()],St.prototype,"triangularMeasurementActive",void 0),e([S()],St.prototype,"triangulatedDistanceMeasurement",void 0),e([S()],St.prototype,"triangulatedDistanceAccuracy",void 0),e([S()],St.prototype,"triangulatedAreaMeasurement",void 0),e([S()],St.prototype,"triangulatedAreaAccuracy",void 0),e([S()],St.prototype,"triangulatedMeasurementGraphic",void 0),e([S()],St.prototype,"triangulatedPoint",void 0),e([S()],St.prototype,"triangulatedMeasurementAdapter",void 0),e([S()],St.prototype,"updateFootprint",void 0),e([S()],St.prototype,"updateFootprintPanorama",void 0),e([S()],St.prototype,"updatingTriangularMeasurementState",void 0),e([S({value:null})],St.prototype,"view",null),e([S()],St.prototype,"videoElement",void 0),e([S()],St.prototype,"videoLayer",void 0),e([S()],St.prototype,"videoMapView",void 0),e([S()],St.prototype,"_adapter",void 0),e([S()],St.prototype,"_defaultGraphicsLayer",null),e([S()],St.prototype,"_highlightedFeatureHandle",void 0),e([S()],St.prototype,"_imageViewer",void 0),e([S()],St.prototype,"_initialCurrentCoverageUpdate",void 0),e([S()],St.prototype,"_locationPointOnImage",void 0),e([S()],St.prototype,"_measurementService",void 0),e([S()],St.prototype,"_correctedLocationPointOnImage",void 0),e([S()],St.prototype,"_overlays",void 0),e([S({readOnly:!0})],St.prototype,"_overlaysView",null),e([S()],St.prototype,"_panoramicVideoViewer",void 0),e([S()],St.prototype,"_panoramicViewer",void 0),e([S()],St.prototype,"_panoramicMeasurementViewer",void 0),e([S()],St.prototype,"_referencePointOnGround",void 0),e([S()],St.prototype,"_referencePointOnImage",void 0),e([S()],St.prototype,"_sectorData",void 0),e([S()],St.prototype,"_featureToSector",void 0),e([S({readOnly:!0})],St.prototype,"_updatingHandles",void 0),e([S()],St.prototype,"footprintExtent",void 0),e([S()],St.prototype,"_featureChangedTask",void 0),St=e([k("esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel")],St);const kt=St;export{kt as default};
5
+ import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{equals as a,isSome as i}from"../../core/arrayUtils.js";import{createTask as r}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import{deprecatedProperty as o}from"../../core/deprecate.js";import n from"../../core/Error.js";import{EventedMixin as c}from"../../core/Evented.js";import{makeHandle as l}from"../../core/handleUtils.js";import{equalsShallow as h}from"../../core/lang.js";import u from"../../core/Logger.js";import{clamp as d}from"../../core/mathUtils.js";import{abortMaybe as m,destroyMaybe as p}from"../../core/maybe.js";import{EsriPromise as g}from"../../core/Promise.js";import{isAbortError as y,throwIfAborted as v,waitTick as w}from"../../core/promiseUtils.js";import f from"../../core/ReactiveMap.js";import{whenOnce as F,on as _,watch as b,syncAndInitial as M,initial as I}from"../../core/reactiveUtils.js";import{sqlAnd as P}from"../../core/sql.js";import{getMetersPerUnitForSR as V}from"../../core/units.js";import{property as S,subclass as k}from"../../core/accessorSupport/decorators.js";import{isSerializable as A}from"../../core/support/jsonUtils.js";import{UpdatingHandles as C}from"../../core/support/UpdatingHandles.js";import L from"../../geometry/Extent.js";import{union as G}from"../../geometry/geometryEngineAsync.js";import T from"../../geometry/Multipoint.js";import O from"../../geometry/Point.js";import R from"../../geometry/Polygon.js";import j from"../../geometry/Polyline.js";import{projectWithZConversion as B}from"../../geometry/projectionUtils.js";import x from"../../geometry/SpatialReference.js";import{polygonCentroidPoint as H}from"../../geometry/support/centroid.js";import{isClockwise as E}from"../../geometry/support/coordsUtils.js";import{normalizeMapX as D}from"../../geometry/support/normalizeUtils.js";import{geographicToWebMercator as z}from"../../geometry/support/webMercatorUtils.js";import U from"../../layers/GraphicsLayer.js";import N from"../../layers/MediaLayer.js";import{searchImages as W,getSortedLayerFeatures as q}from"../../layers/orientedImagery/queries.js";import{calculateSuitabilities as $}from"../../layers/orientedImagery/core/bestImageUtils.js";import{createCoveragePolygon as J,computePolygonForInspection as Z,resizePolygon as K,checkIfPolygonContainsSelectedPoint as Q}from"../../layers/orientedImagery/core/coverageUtils.js";import{isElevationSource as X}from"../../layers/orientedImagery/core/ElevationSourceDefinitions.js";import{convertGeographicToWebMercator as Y}from"../../layers/orientedImagery/core/utils.js";import{imageToWorld as ee,imageToWorldPanoramic as te}from"../../layers/orientedImagery/transformations/imageToWorld.js";import ae from"../../layers/orientedImagery/transformations/updateElevation.js";import{getElevationSampler as ie}from"../../layers/orientedImagery/transformations/updateElevationUtils.js";import{or as re,getInitialAngle as se,convertPixelToHeadingPitch as oe,convertHeadingPitchToSphereVertex as ne,getImageToWorldProperties as ce,getUpdateElevationProps as le,isElevationSampler as he,getImageToWorldPanoramicProperties as ue,pointToArray as de,transformGraphicCoordinatesToPixel as me,getWorldToImageProperties as pe}from"../../layers/orientedImagery/transformations/utils.js";import{worldToImage as ge,worldToImagePanoramic as ye}from"../../layers/orientedImagery/transformations/worldToImage.js";import ve from"../../layers/support/ExtentAndRotationGeoreference.js";import{getFloorFilterClause as we}from"../../layers/support/floorFilterUtils.js";import fe from"../../layers/support/VideoElement.js";import Fe from"../../views/MapView.js";import _e from"../../views/draw/Draw.js";import{scale as be}from"../../views/draw/support/drawUtils.js";import{ViewEventPriorities as Me}from"../../views/input/InputManager.js";import Ie from"../PanoramicVideoViewer.js";import Pe from"../PanoramicViewer.js";import{defaultAngleThresholdInDegrees as Ve,videoExtent as Se,invalidCameraHeading as ke,sectorsInOrder as Ae,sampleExtent as Ce,sectorsRadii as Le}from"./constants.js";import{configureSketchTool as Ge,extractFieldsFromDataCaptureLayer as Te,isValidDataCaptureLayer as Oe,constructGraphicFromImageGeometry as Re}from"./dataCaptureUtils.js";import{isFeatureAttachment as je,getImageSourceFromAttachment as Be}from"./galleryUtils.js";import{getModeCorrectedPoint as xe,calculateCorrectedPixel as He,getUnitRateFromSpatialReference as Ee,calculateHeightFromTemporaryDistance as De,getModeCorrectedPoints as ze,computeTriangulatedVector as Ue,computeTriangulatedPoint as Ne}from"./imageMeasurementUtils.js";import{crossSymbol as We,crossSymbol3D as qe,measurementPolygonSymbol as $e,polylineSymbolPanoramic as Je,measurementPolylineSymbol as Ze,cameraOverlaySymbol3D as Ke,cameraOverlaySymbol as Qe,diamondSymbol as Xe,diamondSymbol3D as Ye,locationSymbol as et,locationSymbol3D as tt,activeSourcePointSymbol as at,sourcePointSymbol as it}from"./symbols.js";import{isNoAttachmentError as rt,getContentType as st,isTifOrMrf as ot,filterOILLayerView as nt,assignElevationSampleToFeatures as ct,calculateDirection as lt,calculateSegment as ht,isSceneView as ut,isGraphic as dt}from"./utils.js";import{disableVideoZoomAndPan as mt}from"./videoViewerUtils.js";import pt from"./components/ImageViewer.js";import gt from"./components/NavigationNode.js";import yt from"./components/OrientedImageryVideoViewModel.js";import{NoActiveViewerError as vt,NoFeatureFoundWithObjectIdError as wt}from"./navigation/errors.js";import{queryFeatureByObjectIds as ft}from"./navigation/queries.js";import{ImageMeasurementService as Ft}from"./services/ImageMeasurementService.js";import _t from"../Sketch/SketchViewModel.js";const bt={click:"view-click",imageClick:"image-click",triangularImageClick:"triangular-click",interactionHandles:"interaction-handles",hittestHandles:"hittest-handles",videoPlayerHandles:"video-handles",activeViewerCursorHandles:"active-viewer-cursor-handles",imageViewerCursorHandles:"image-viewer-cursor-handles"},Mt=new Set(["JPG","JPEG","TIFF","TIF","MRF"]),It=new Set(["MRF","TIFF","TIF"]),Pt=/\.(\w+)$/,Vt=()=>new n("orientedimageryviewer:sketch-not-initialized","Sketch property is not initialized, call loadSketch first");let St=class extends(c(g)){constructor(e){super(e),this.additionalFeatures=new s,this.additionalCameraLocations=new s,this.additionalFootprints=new s,this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.bestFeatureAngle=0,this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null,this.cameraHeadingThreshold=Ve,this.cameraPitchThreshold=Ve,this.clickAction="hittest",this.videoViewModel=null,this.collectionId=null,this.conversionProps=null,this.coverageFrustums=new s,this.coveragePolygons=new s,this.currentBestFeature=null,this.currentBestFeatureMeasurementImage=null,this.currentBestFeatureLocation=null,this.currentCoverageVisible=!0,this.depthImage=null,this.directionMode="Relative",this.featureCache=[],this.navigationNodes=new s,this.determineWorkflowForFeature=async(e,t,a)=>{const{currentBestFeature:i,selectedPoint:r,view:s}=this;if(s?.closePopup(),i&&r){this._initialCurrentCoverageUpdate=!0,this._updateGroundElevation=!0;try{await this._updatePointsAndPolygons(a),await this._loadDepthImage(a),await this._loadImage(a)}catch(o){y(o)||(this.loadImageError(o),u.getLogger(this).error("#loadIImage()","error occured while loading image",o))}}},this.determineWorkflowForTriangularMeasurement=async(e,t,a)=>{if(this.view?.closePopup(),this.currentBestFeatureMeasurementImage&&this.selectedPoint)try{await this._loadMeasurementViewerImage(a)}catch(i){y(i)||(this.loadImageError(i),u.getLogger(this).error("#loadIImage()","error occured while loading image",i))}},this.disabled=!1,this.displayMessage={key:"onLoadMessage",type:"info"},this.displayNewMeasurementButton=!0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.dataCaptureLayer=null,this.features=new s,this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.heightMeasurementPixels=[],this.heightGraphic=null,this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.measurementAngle=null,this.tempDistance=null,this.imageGeometryField=null,this.imageLocationToolState=!1,this.imageMeasurementViewer=new pt,this.isAdditionalCoverageVisible=!1,this.isAdditionalPointSourcesVisible=!1,this.measurementVectors=[],this.layer=null,this.localPort=null,this.mapImageConversionToolState=!1,this.measureType=null,this.measurementGraphic=null,this.navigatorCurrentBestFeature=null,this.oiObjectIdField=null,this.overlayedCameraLocations=new s,this.overlayedMapFeatures=new f,this.pixelCoordinates=null,this.preserveAngle="none",this.pointSources=new s,this.previousFeatureAngle=0,this.selectedPoint=null,this.shouldShowSelectedImage=!1,this.sketch=null,this.sketchTriangular=null,this.sketchTriangularGraphicsLayer=null,this.draw=null,this.sketchAdapter=null,this.triangularMeasurementActive=!1,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedAreaAccuracy=0,this.triangulatedMeasurementGraphic=null,this.triangulatedPoint=null,this.triangulatedMeasurementAdapter=null,this.updateFootprint=async(e,t,a)=>{"default"===this.mode&&"image-loaded"!==this.state||this.mode.includes("video")&&!this.videoElement?.content||await(this._adapter?.updateFootprint(e,t,a))},this.updateFootprintPanorama=async(e,t)=>{await(this._adapter?.updateFootprintPanorama(e,t))},this.updatingTriangularMeasurementState=!1,this.videoElement=null,this.videoLayer=null,this.videoMapView=new Fe({map:new Map}),this._adapter=null,this._highlightedFeatureHandle=null,this._imageViewer=new pt,this._initialCurrentCoverageUpdate=!0,this._locationPointOnImage=null,this._measurementService=null,this._correctedLocationPointOnImage=null,this._overlays=new U({listMode:"hide",internal:!0,elevationInfo:{mode:"absolute-height"},title:"OrentedImageryViewerViewModel overlays layer"}),this._panoramicVideoViewer=new Ie,this._panoramicViewer=new Pe,this._panoramicMeasurementViewer=new Pe,this._referencePointOnGround=null,this._referencePointOnImage=null,this._sectorData=null,this._featureToSector=null,this._updatingHandles=new C,this._clickTask=null,this._crossSymbol=null,this.footprintExtent=null,this._featureChangedTask=null,this._openPopupTask=null,this._suitabilities=null,this._transformController=new AbortController,this._updateFootprintTask=null,this._updateGroundElevation=!1,this.addUpdatingPromise=e=>this._updatingHandles.addPromise(e),this.filterCapturedFeatures=e=>{const t=this.currentBestFeature?.attributes.objectId,a=this.layer?.imageReferenceField;if(!t||!e||!a)return;const i=this.overlayedMapFeatures.get(e);i?.forEach(e=>{const i=e.attributes??{},r=Object.keys(i).find(e=>e.toLowerCase()===a.toLowerCase());(r?i[r]:null)!==t&&(e.visible=!e.visible)})},this.hideImageGeometry=e=>{},this.highlight=e=>{if(!this._overlaysView)return;this.removeHighlight();const t=this.additionalFootprints.find(({attributes:{imageID:t}})=>t===Number(e));this._highlightedFeatureHandle=t?this._overlaysView?.highlight(t):null},this.loadDataCaptureAdapter=async e=>{await this.loadSketch(e);const t=import("./adapters/sketch/DataCaptureAdapter.js"),{default:a}=await t;return v(e),this.sketchAdapter=new a({viewModel:this}),this.sketchAdapter},this.loadImageFromSource=async(e,t)=>this._updatingHandles.addPromise(this._loadImageFromSourceInternal(e,t)),this.storeImageMeasurementViewer=e=>{this.imageMeasurementViewer=e},this.storePanoramicMeasurementViewer=e=>{this._panoramicMeasurementViewer=e},this.loadImageViewer=e=>{this._imageViewer?.destroy(),this._imageViewer=e},this.loadPanoramicViewer=e=>{this._panoramicViewer?.destroy(),this._panoramicViewer=e},this.loadPanoramicVideoViewer=e=>{this._panoramicVideoViewer?.destroy(),this._panoramicVideoViewer=e},this.loadVideoViewer=e=>{this.videoMapView.container=e},this.showImageByObjectId=async(e,t)=>{const a=this.additionalFeatures.find(({attributes:t})=>t.objectId===e);if(a)this.currentBestFeature=a;else{const{layer:a,layerFloorFilterClause:r}=this;if(!a)return void this.setMessage("noLayerSelected","info");this.beforeLoad();const s=this._updatingHandles.addPromise(this._queryAndLoadByObjectId(a,e,r,t));try{await s,await this.selectBestFeature(e,t)}catch(i){y(i)||(u.getLogger(this).error("oriented-imagery-viewer:show-image",i),"NoFeatureFoundWithObjectIdError"===i.name?this.setMessage("noFeatureFoundWithObjectId","error","",{objectId:e}):this.setMessage("imageLoadError","error",i.message))}}},this.imageToImageTransform=async(e,t,a)=>{const{updateElevationProps:i,...r}=t,{updateElevationProps:s,...o}=a,n=await ee(e,r,i);return ge(n,o)},this.imageToImageTransformPanoramic=async(e,t,a)=>{const{updateElevationProps:i,...r}=t,{updateElevationProps:s,...o}=a,n=await te(e,r,i);return ye(n,o)},this.getSectorFeatureById=e=>this._suitabilities?.find(({feature:{attributes:{objectId:t}}})=>t===e),this.getFeatureSectorById=e=>this._featureToSector?.[`${e}`],this.navigate=async(e,t)=>{const{activeViewer:a}=this;if(!a)throw new vt;return await a.navigate(e,t)},this.removeHighlight=()=>this._highlightedFeatureHandle?.remove(),this.revealImageGeometry=e=>{},this.selectBestFeature=async(e,t)=>(v(t),this.currentBestFeature=this.features?.find(({attributes:t})=>`${t.objectId}`==`${e}`),F(()=>"image-loaded"===this.state,t)),this.toggleImageAttributes=()=>{m(this._openPopupTask),this._openPopupTask=r(async e=>{const{currentBestFeature:a,popupEnabled:i,layer:r,view:s}=this;if(s?.closePopup(),!(s&&a&&i&&r))return;const{attributes:o,geometry:n}=a,c=new t({geometry:n,attributes:o.toJSON(),layer:r,sourceLayer:r});v(e),await s.openPopup({features:[c],location:o.location.clone()})})},this.updateSuitabilities=(e,t=!0)=>{e.sort((e,t)=>e.suitability-t.suitability),this._suitabilities=e;const a=this._suitabilities.map(({feature:e})=>e);this._initialCurrentCoverageUpdate=!0,this._updateFeatures(a,t),this._groupFeaturesBySectors()},this._createViewClickHandle=()=>{if(this.removeHandles(bt.click),this.disabled||null==this.view)return;const e=this.mapImageConversionToolState&&"image-loaded"===this.state?this._mapImageConversionToolViewClickHandler:this._viewClickHandler;this.addHandles(this.view.on("click",e,Me.WIDGET),bt.click)},this._createImageClickHandle=()=>{this.removeHandles(bt.imageClick);const{mapImageConversionToolState:e,mode:t,activeViewer:a,currentBestFeature:i,footprintExtent:s}=this,o=a?.imageSize;if(!(e&&"none"!==t&&o&&s&&i))return;const n=a.clickAction;this.clickAction="pixel-location";const c=l(()=>{this.clickAction=n});let h=null;const u=_(()=>a,"pixel-location",e=>{this.plotReferencePointOnImage(e),h?.abort(),h=r(async a=>{if(!e)return;const r=await this.getMapPoint(e,{feature:i,imageSize:o,mode:t}).then(e=>{const t=this.view?.spatialReference;return re(!t,e.spatialReference.equals(t))?e:B(e,t)});v(a),this.plotReferencePointOnGround(r)})});this.addHandles([u,c],bt.imageClick)},this._createTriangularImageClickHandle=()=>{this.removeHandles(bt.triangularImageClick),this.triangularMeasurementActive&&"none"!==this.mode&&this.currentBestFeature&&this.currentBestFeatureMeasurementImage&&this.activeTriangulatedViewer&&this.addHandles(this.activeTriangulatedViewer.imageRenderer.on("double-click",this._measurementImageClickHandler),bt.triangularImageClick)},this._createTriangularImageLocationHandle=()=>{this.removeHandles(bt.triangularImageClick);const{imageLocationToolState:e,mode:t,activeTriangulatedViewer:a}=this,i=a?.imageSize;if(!e||"none"===t||!i)return;this.clickAction="pixel-location";let s=null;const o=_(()=>a,"pixel-location",e=>{1===this.measurementVectors.length&&(this.plotLocationPointOnImage(e,!0),s?.abort(),s=r(async a=>{if(!e||this.triangulatedPoint||2===this.measurementVectors?.length||!this.currentBestFeatureMeasurementImage)return;let r=await this.getMapPoint(e,{feature:this.currentBestFeatureMeasurementImage,imageSize:i,mode:t});v(a);const s=this.view?.spatialReference;s&&!r.spatialReference.equals(s)&&(r=await B(r,s),v(a)),await this._calculateTriangulatedPointFromGroundPoint(r,{signal:a}),v(a)}))});this.addHandles(o,bt.triangularImageClick)},this._createImageLocationHandle=()=>{this.removeHandles(bt.imageClick);const{imageLocationToolState:e,mode:t,activeViewer:a,currentBestFeature:i,footprintExtent:s}=this,o=a?.imageSize;if(!(e&&"none"!==t&&o&&s&&i))return;this.clickAction="pixel-location";let n=null;const c=_(()=>a,"pixel-location",e=>{const{currentBestFeatureMeasurementImage:a,triangularMeasurementActive:s,activeTriangulatedViewer:c}=this;this.pixelCoordinates=e;const l=null!=a&&!c?.state.includes("loading");re(!s,l)&&this.plotLocationPointOnImage(e),n?.abort(),n=r(async a=>{if(!e)return;let r=await this.getMapPoint(e,{feature:i,imageSize:o,mode:t});v(a);const n=this.view?.spatialReference;n&&!r.spatialReference.equals(n)&&(r=await B(r,n),v(a)),this.groundCoordinates=r,s&&r&&l&&await this.triangulatedLocationWorkflow(r,a);const c=await this.calculateLocationAccuracy(e,r,t,a);v(a),c&&(this.groundCoordinatesAccuracy=c)})});this.addHandles(c,bt.imageClick)},this._handleImageHitTestResponse=async e=>{const{layer:t,overlayedCameraLocations:a}=this;if(!t)return;const i=e.results.find(({graphic:e,graphic:{attributes:i}})=>a.includes(e)&&i&&!i[t.imageReferenceField]&&!i[t.imageGeometryField]);if(!i)return;const r=i.graphic.attributes[t.objectIdField];await this.showImageByObjectId(r)},this._loadDepthImage=async e=>{const{currentBestFeature:t,layer:a,depthImageNotSupported:i}=this;if(this.depthImage?.destroy(),this.depthImage=null,!a||!t||i)return;const{depthImage:r}=t.attributes;if(!r)return;const s=(await import("./services/DepthImageService.js")).default;v(e),this.depthImage=new s({url:r});try{await this.depthImage.load(e)}catch(o){y(o)||(u.getLogger(this).error("error occurred while loading depth image",o),this.depthImage?.destroy(),this.depthImage=null)}},this._loadImage=async e=>{const{currentBestFeature:t,layer:a,mode:i}=this;if(this.clearGraphics(),!a||!t||"none"===i||"video"===i||"panoramic-video"===i)return;const{attributes:r}=t,{imagePath:s,imageRotation:o,cameraHeading:n,cameraRoll:c,cameraPitch:l,objectId:h,cameraOrientation:d,location:m}=r,p=(c??0)+(o??0),g=m.spatialReference.isWGS84&&4!==d?.type?z(m):new O(m);let w=s;if(je(s))try{w=await Be(a,h,e)}catch(f){if(y(f))return;return rt(f)?(u.getLogger(this).error(f),void this.setMessage("noAttachment","error",`${a.objectIdField}: ${h}`)):(u.getLogger(this).error(f,{[a.objectIdField]:h,layer:a}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${a.objectIdField} ${h}`))}try{await this.loadImageFromSource(w,{imageRotation:p,options:e,pitch:l,yaw:n,mode:i,cameraLocation:g}),v(e),await this.transformAndPlotSelectedLocation(e)}catch(f){y(f)||this.loadImageError(f)}},this._loadVideo=async e=>{const{currentBestFeature:t,layer:a,mode:i,selectedPoint:r}=this,s=t?.attributes.imagePath;if(!a||!t||"panoramic-video"!==i||!s)return;const{attributes:o}=t,{cameraHeading:n,cameraPitch:c,cameraOrientation:l,location:h}=o,u=h.spatialReference.isWGS84&&4!==l?.type?z(h):new O(h);try{this._panoramicVideoViewer.viewModel.video&&this._panoramicVideoViewer.viewModel.video.pause(),this._panoramicVideoViewer.videoSource=s;let t=n??0;u&&r&&(t=await se(u,r)-t),this._panoramicVideoViewer.pitch=c??0,this._panoramicVideoViewer.yaw=t,await this._panoramicVideoViewer.loadVideo(e),v(e)}catch(d){y(d)||this.loadImageError(d)}},this._loadImageFromSourceInternal=async(e,t)=>{const{mode:a,imageRotation:i,options:r}=t,s="string"==typeof e,o=s?e:e.url,{pathname:n,searchParams:c}=new URL(o);let l=s?n.match(Pt)?.[1]:e.datasetFormat;if(!l)try{l=await st(o,{...t.options})}catch(h){y(h)||u.getLogger(this).error("#getContentType()",h)}switch(l??="UNKNOWN FORMAT",a){case"default":this.triangularMeasurementActive?await this._setImageSource(this.imageMeasurementViewer,l,o,c,i,r):await this._setImageSource(this._imageViewer,l,o,c,i,r);break;case"panoramic":if(Mt.has(l.toUpperCase())){const{selectedPoint:e}=this,{pitch:a,yaw:i,cameraLocation:s,viewAngle:n}=t,c=this.triangularMeasurementActive?this._panoramicMeasurementViewer:this._panoramicViewer;let h=i??0;"number"==typeof n?h=n-h:s&&e&&(h=await se(s,e)-h),c.imageSource=o,c.pitch=a??0,c.yaw=h,It.has(l.toUpperCase())?await c.loadImageTiled(o,r):await c.loadImage(r)}else this.setMessage("unsupportedPanoramicImageryError","error",void 0,{datasetFormat:l});break}},this._loadMeasurementViewerImage=async e=>{const{currentBestFeatureMeasurementImage:t,layer:a,mode:i}=this;if(this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearGraphics(),!a||!t||"none"===i||"video"===i||"panoramic-video"===i)return;const{attributes:r}=t,{imagePath:s,imageRotation:o,cameraHeading:n,cameraRoll:c,cameraPitch:l,objectId:h,cameraOrientation:d,location:m}=r,p=(c??0)+(o??0),g=m.spatialReference.isWGS84&&4!==d?.type?z(m):new O(m);let w=s;if(je(s))try{w=await Be(a,h,e)}catch(f){if(y(f))return;return rt(f)?(u.getLogger(this).error(f),void this.setMessage("noAttachment","error",`${a.objectIdField}: ${h}`)):(u.getLogger(this).error(f,{[a.objectIdField]:h,layer:a}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${a.objectIdField} ${h}`))}try{await this.loadImageFromSource(w,{imageRotation:p,options:e,pitch:l,yaw:n,mode:i,cameraLocation:g}),v(e)}catch(f){y(f)||this.loadImageError(f)}},this._loadViewAdapter=async e=>{const{view:t}=this;if(t)switch(t.type){case"2d":{const{default:t}=await import("./adapters/view/MapViewAdapter.js");v(e),this._adapter=new t(this);break}case"3d":{const{default:t}=await import("./adapters/view/SceneViewAdapter.js");v(e),this._adapter=new t(this);break}}else this._adapter=null},this._mapImageConversionToolViewClickHandler=e=>{if(e.stopPropagation(),e.preventDefault(),e.mapPoint){const t=e.mapPoint;t.x=D(t.x,t.spatialReference),this.plotMapPoint(e.mapPoint)}},this._measurementImageClickHandler=e=>{e.stopPropagation(),e.preventDefault();const{sketchTriangular:t,triangularMeasurementActive:a,currentBestFeatureMeasurementImage:i,triangulatedMeasurementGraphic:r}=this;t&&a&&i&&r&&"active"!==t.state&&(t.update([r],{tool:"reshape"}),this.updatingTriangularMeasurementState=!0)},this._viewClickHandler=e=>{this._clickTask?.abort(),this._clickTask=r(async t=>{const{pointerType:a,button:i,mapPoint:r}=e;if(("mouse"!==a||0===i)&&r)return e.stopPropagation(),e.preventDefault(),this._updatingHandles.addPromise(this.loadBestImage(r,{signal:t}))})},this.plotSelectedPointOnImage=async(e,a)=>{if(await w(a),!e)return;const i=new O({...A(e)?e.toJSON():e});if("default"===this.mode)i.x-=.5,i.y=.5-i.y,i.spatialReference=this._imageViewer.imageRenderer.spatialReference.clone(),this._crossSymbol=new t({geometry:i,symbol:We}),this._imageViewer.addGraphic(this._crossSymbol,0);else if("panoramic"===this.mode){const{imageSize:a}=this._panoramicViewer;if(!a)return;const[i,r]=a,{heading:s,pitch:o}=oe(e,i,r),n=ne(s,o);this._crossSymbol=new t({geometry:new O(n,x.WebMercator),symbol:qe}),this._panoramicViewer.addGraphic(this._crossSymbol,0)}},this.handleSectorClick=this.handleSectorClick.bind(this),this.searchBestImage=this.searchBestImage.bind(this),this.transformAndPlotReferencePointOnImage=this.transformAndPlotReferencePointOnImage.bind(this)}initialize(){this.addHandles([b(()=>this.view,()=>this.load(),M),b(()=>this.view?.map,(e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)},I),b(()=>this.view?.map?.allLayers?.length,e=>{e&&this.view?.map?.layers.reorder(this._overlays,e-1)},I),b(()=>[this.state,this.mapImageConversionToolState,this.view,this.disabled],()=>{this._createViewClickHandle(),this._createImageClickHandle()},M),b(()=>[this.triangularMeasurementActive,this.currentBestFeatureMeasurementImage],()=>{this._createTriangularImageClickHandle()},M),b(()=>[this.state,this.imageLocationToolState,this.view],(e,t)=>{if(this._initializeMeasurementService(),this._createImageLocationHandle(),!this.imageLocationToolState)return this.clearPreviousGroundLocation(),void this._resetCursor();e[1]!==t?.[1]&&this._setMeasurementCursor()},M),b(()=>this.measureType,()=>{this.clearPreviousMeasurements(),this._initializeMeasurementService()},M),b(()=>this.bestFeatureAngle,(e,t)=>{this.previousFeatureAngle=t??0},M),b(()=>this.currentBestFeature,async(e,t)=>{m(this._featureChangedTask),this._featureChangedTask=r(async a=>this.determineWorkflowForFeature.apply(this,[e,t,{signal:a}])),await this._featureChangedTask.promise},{sync:!0}),b(()=>this.currentBestFeatureMeasurementImage,(e,t)=>{m(this._featureChangedTask),t&&e!==t&&(this.measurementVectors=[],this.triangulatedPoint=null,this.sketchTriangularGraphicsLayer?.graphics.destroyAll()),this._featureChangedTask=r(async a=>{await this.determineWorkflowForTriangularMeasurement(e,t,{signal:a}),v(a),this._reorderTriangularSketchLayer()})},M),b(()=>this.triangularMeasurementActive,(e,t)=>{t&&!e&&(this.measurementVectors=[],this.currentBestFeatureMeasurementImage=null,this.triangulatedDistanceMeasurement=null,this.triangulatedMeasurementGraphic=null,this.triangulatedPoint=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaAccuracy=0,this.sketchTriangularGraphicsLayer?.graphics.destroyAll(),this.clearReferencePointOnImage(),this.imageMeasurementViewer.clearImage(),this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearImage(),this._panoramicMeasurementViewer.clearGraphics())}),b(()=>this.mode,e=>{switch(this.removeHandles(bt.interactionHandles),e){case"default":this.addHandles(b(()=>{const{state:e}=this;return"image-loaded"===e?this._imageViewer.imagePointsInView:null},e=>{e&&(m(this._updateFootprintTask),this._updateFootprintTask=r(async t=>{await this.updateFootprint(e,void 0,{signal:t})}))},{...M,equals:(e,t)=>a(e,t,h)}),bt.interactionHandles);break;case"video":this.addHandles(b(()=>{const{footprintExtent:e,videoElement:t,bestFeatureFootprint:a}=this;if(e&&t?.loaded&&a)return{videoExtent:Se,bestFeatureFootprint:a}},e=>{e?.videoExtent&&e?.bestFeatureFootprint&&(m(this._updateFootprintTask),this._updateFootprintTask=r(async t=>{await this.updateFootprint(e.videoExtent,void 0,{signal:t})}))},{...M,equals:(e,t)=>a(e?.videoExtent,t?.videoExtent,h)&&e?.bestFeatureFootprint===t?.bestFeatureFootprint}),bt.interactionHandles);break;case"panoramic":this.addHandles(b(()=>{const{currentBestFeature:e,state:t,_panoramicViewer:a}=this,{imageSize:i,vfov:r,hfov:s,pitch:o,yaw:n}=a;return e&&i&&!t.includes("loading")&&null!=r&&null!=s&&null!=o&&null!=n?[r,s,n,o]:null},e=>{if(!e||this.state.includes("loading"))return;const[t,a,i,s]=e;this.currentNode&&(this.currentNode.currentHeading=i+(this.currentNode.heading??0),this.currentNode.currentPitch=s+(this.currentNode.pitch??0)),m(this._updateFootprintTask),this._updateFootprintTask=r(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:a,yaw:i,pitch:s},{signal:e}),this._updateFootprintTask=null})},{equals:(e,t)=>a(e,t,h)}),bt.interactionHandles);break;case"panoramic-video":this.addHandles(b(()=>{const{currentBestFeature:e,state:t,_panoramicVideoViewer:a}=this,{imageSize:i,vfov:r,hfov:s,pitch:o,yaw:n,viewModel:c}=a,l=c.closestFeature??e;return l&&i&&!t.includes("loading")&&null!=r&&null!=s&&null!=o&&null!=n?[r,s,n,o,l]:null},e=>{if(!e)return;const[t,a,i,s,o]=e;m(this._updateFootprintTask),this._updateFootprintTask=r(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:a,yaw:i,pitch:s,feature:o},{signal:e}),v(e),this._updateFootprintTask=null})},{equals:(e,t)=>a(e,t,h)}),bt.interactionHandles)}},M),b(()=>[this.brightness,this.contrast,this.sharpness],()=>{const{_imageViewer:e,brightness:t,contrast:a,mode:i,sharpness:r}=this;"default"===i&&(e.brightness=t,e.contrast=a,e.sharpness=r)},M),b(()=>this.activeViewer?.imageRenderer,()=>{this.sketch&&(this.sketch.view=this.activeViewer?.imageRenderer)}),b(()=>this.activeViewer,e=>{this.removeHandles(bt.hittestHandles),e&&this.addHandles(_(()=>e,"hittest-response",this._handleImageHitTestResponse),bt.hittestHandles)})]),this.when().finally(()=>{this.notifyChange("state")})}destroy(){this.currentBestFeature=null,this._updateFootprintTask=m(this._updateFootprintTask),this._clickTask=m(this._clickTask),this.coverageFrustums.destroy(),this.coveragePolygons.destroy(),this.pointSources.destroy(),this.additionalFootprints.destroy(),this.additionalCameraLocations.destroy(),this.bestFeatureFootprint=p(this.bestFeatureFootprint),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),this.videoViewModel=p(this.videoViewModel),this._crossSymbol=p(this._crossSymbol),this._referencePointOnGround=p(this._referencePointOnGround),this._referencePointOnImage=p(this._referencePointOnImage),this._locationPointOnImage=p(this._locationPointOnImage),this._overlays&&this.view?.map?.remove(this._overlays),this._overlays.destroy(),this._imageViewer.destroy(),this.imageMeasurementViewer.destroy(),this._panoramicViewer.destroy(),this._panoramicMeasurementViewer.destroy()}get activeLayer(){return o(u.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){o(u.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer=e}get activeViewer(){const{_imageViewer:e,_panoramicViewer:t,mode:a}=this;switch(a){case"default":return e;case"panoramic":return t;default:return null}}get activeTriangulatedViewer(){switch(this.mode){case"default":return this.imageMeasurementViewer;case"panoramic":return this._panoramicMeasurementViewer;default:return null}}get accuracyParametersMissing(){return this.layer?.orientationAccuracy?.every(e=>0===e)??!0}get brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",d(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",d(e,-10,10))}get currentNode(){const{currentBestFeature:e,navigationNodes:t}=this;return t.find(t=>t.id===e?.attributes.objectId)}get depthImageNotSupported(){if(this.currentBestFeature?.attributes.depthImage)return!ot(this.currentBestFeature.attributes.depthImage)}get featureCount(){return this.features?.length??0}get imageGalleryEnabled(){const{currentBestFeature:e}=this;if(!e)return!1;const t=e.attributes.imagePath?.trim();return ot(t)||je(t)}get imageLoaded(){return o(u.getLogger(this),"imageLoaded",{replacement:'Use OrientedImageryViewer.state === "image-loaded"',version:"4.29",warnOnce:!0}),"image-loaded"===this.state}get invalidCameraHeading(){return this.currentBestFeature?.attributes?.cameraHeading===ke}get imagePointsInView(){const{mode:e,_imageViewer:t}=this;return"default"===e?t.imagePointsInView:null}get layerView(){const{layer:e,view:t}=this;if(e&&t)return t.allLayerViews.find(nt(e))}get layerFloorFilterClause(){const{layerView:e}=this;return e?we(e):null}get mode(){const e=this.currentBestFeature?.attributes;if(!e)return"none";const t=e.orientedImageryType;if(t?.includes("video"))return t.includes("360")?"panoramic-video":"video";const{horizontalFieldOfView:a,isSpherical:i}=e;return 360===a||i?"panoramic":"default"}get panoramicVideoLoaded(){const{mode:e,_panoramicVideoViewer:t}=this,{videoLoaded:a}=t.viewModel;return("panoramic-video"===e&&!0===a)??!1}get popupEnabled(){return!0===this.layer?.popupEnabled}get referencePoint(){return this._referencePointOnGround?.geometry}get sectorData(){const{_sectorData:e}=this;return e?Ae.map(t=>e[t]):null}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",d(e,0,1))}get sketchGraphicsLayer(){const{sketch:e}=this;return"graphics"===e?.layer?.type?e.layer:void 0}get state(){const{mode:e,_updatingHandles:{updating:t},_featureChangedTask:a}=this;if(!this.isFulfilled()||t||!1===a?.finished)return"loading";if(this.isRejected())return"error";if("error"===this.displayMessage?.type)return"image-load-error";switch(e){case"default":return this._imageViewer.state;case"panoramic":return this._panoramicViewer.state;case"video":return this.videoElement?.loaded?"video-loaded":"video-not-loaded"}return"ready"}get thumbnails(){const{features:e}=this;return e?new s(e.map(({attributes:{imagePath:e,objectId:t,cameraRoll:a,imageRotation:i}})=>{const r=e?.trim();return ot(r)||je(r)?{url:r,objectId:t,rotation:(a??0)+(i??0)}:null}).filter(i)):null}set view(e){this._set("view",e)}get _defaultGraphicsLayer(){const e={blendMode:"source-atop"};switch(this.mode){case"panoramic":return new U({...e,elevationInfo:{mode:"absolute-height"}});case"default":return new U({...e});default:return}}get _overlaysView(){return this.view?.layerViews.find(({layer:e})=>e===this._overlays)}beforeLoad(e=!0){this.view?.closePopup(),e&&(this.displayMessage=null),this.clearPreviousGroundLocation(),this.triangularMeasurementActive=!1,this.currentBestFeatureMeasurementImage=null,this.measureType=null,this.imageLocationToolState=!1,this.features.removeAll(),this.currentBestFeature=null,this.additionalFeatures.removeAll(),this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),this._overlays?.removeAll()}async computeHeight(e,t,a=!0){return this._measurementService?.computeHeight(e,t,a)}async calculateAreaMeasurement(e,t,a){return this._measurementService?.calculateAreaMeasurement(e,t,a)}async calculateDistanceMeasurement(e,t,a){return this._measurementService?.calculateDistanceMeasurement(e,t,a)}async calculateAccuracy(e,t,a){return this._measurementService?.calculateAccuracy(e,t,a)}async calculateLocationAccuracy(e,t,a="default",i){return this._measurementService?.calculateLocationAccuracy(e,t,a,i)}async calculateAccuracyPanoramic(e,t,a=!1,i){return this._measurementService?.calculateAccuracyPanoramic(e,t,a,i)}async calculateHeightMeasurementInfo(e,t,a){return this._measurementService?.calculateHeightMeasurementInfo(e,t,a)}async calculateTriangulatedMeasurements(e){await(this._measurementService?.calculateTriangulatedMeasurements(e))}clearPreviousMeasurements(){this.clearMeasurementGraphics(),this.resetMeasurementData(),this.stopMeasurement()}clearPreviousGroundLocation(){this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.pixelCoordinates=null,this.clearLocationPointOnImage()}clearMeasurementGraphics(){this.measurementGraphic&&(this.activeViewer?.removeGraphic(this.measurementGraphic),this.measurementGraphic=null),this.heightGraphic&&(this.activeViewer?.removeGraphic(this.heightGraphic),this.heightGraphic=null),this.triangularMeasurementActive&&this.sketchTriangularGraphicsLayer?.graphics.destroyAll()}digitizeCancel(){return this.sketch?.cancel()}digitizeCanRedo(){return this.sketch?.canRedo()??!1}digitizeCanUndo(){return this.sketch?.canUndo()??!1}digitizeComplete(){return this.sketch?.complete()}async digitizeCreate(e,t){const{sketch:a,dataCaptureLayer:i}=this;if(!a)throw Vt();Ge(i,e,a),await a.create(e,{...t,defaultZ:0})}digitizeDelete(){if(!this.sketch)throw Vt();return this.sketch.delete()}digitizeDuplicate(){if(!this.sketch)throw Vt();return this.sketch.duplicate()}digitizePlace(e,t){if(!this.sketch)throw Vt();return this.sketch.place(e,t)}digitizeRedo(){if(!this.sketch)throw Vt();return this.sketch.redo()}digitizeUndo(){if(!this.sketch)throw Vt();return this.sketch.undo()}digitizeUpdate(e,t){if(!this.sketch)throw Vt();return this.sketch.update(e,t)}async displayHeightResults(){const{currentBestFeature:e,activeViewer:t,heightMeasurementPixels:a,mode:i}=this,r=t?.imageSize,s=e?.attributes;if(!s||!r)return;const o=await this.computeHeight(a,i);o?.value&&o?.accuracy&&(this.heightMeasurementResult=o.value,this.heightMeasurementAccuracy=o.accuracy)}filterByFootprints(e,t,a=!1){const i=[],r=[],s=[];return e.forEach(e=>{const{layer:{coveragePercent:o},attributes:n}=e;let c;const{polygon:l,frustum:h}=J(n);if(c=l.clone(),n.isInspection&&(c=Z(n)),o&&(c=K(c,o)),a||!t||Q(c,t)){s.push(e);const{geometry:t,objectId:a,cameraHeight:o,cameraHeading:c}=n,u=t.clone();u.z=o,u.imageID=a,this.pointSources.push(u),c!==ke&&(i.push(l),h&&r.push(h))}}),{features:s,polygons:i,frustums:r}}getMeasurementProperties(e=this.currentBestFeature,t=this.activeViewer){if(!e||!t?.imageSize)return;const{elevationSample:a,attributes:i}=e,{elevationSource:r,cameraHeight:s}=i,o=ce(i,t.imageSize[0],t.imageSize[1]);let n=o.cameraLocation;return(n.spatialReference.isGeographic?B(n,x.WebMercator):Promise.resolve(n)).then(e=>(n=e,le(n.spatialReference,n.z??0,s,{elevationSample:a,elevationSource:r,extent:this.footprintExtent}))).then(t=>("elevationSample"in t&&he(t.elevationSample)&&(e.elevationSample=t.elevationSample),{...o,cameraLocation:n,updateElevationProps:t}))}getMeasurementPropertiesPanoramic(e=this.currentBestFeature,t=this.activeViewer){if(!e||!t?.imageSize)return;const{elevationSample:a,attributes:i}=e,{elevationSource:r,cameraHeight:s}=i,o=ue(i,t.imageSize[0],t.imageSize[1]);let n=o.cameraLocation;return(n.spatialReference.isGeographic?B(n,x.WebMercator):Promise.resolve(n)).then(e=>(n=e,le(n.spatialReference,n.z??0,s,{elevationSample:a,elevationSource:r,extent:this.footprintExtent}))).then(t=>("elevationSample"in t&&he(t.elevationSample)&&(e.elevationSample=t.elevationSample),{...o,cameraLocation:n,updateElevationProps:t}))}async deleteDataCaptureFeatures(e){const{dataCaptureLayer:t}=this;if(!t)throw new n("orientedimageryviewer:missing-featurelayer","Data capture layer is not available");return t.queryFeatures({objectIds:e}).then(({features:e})=>t.applyEdits({deleteFeatures:e}))}handleSectorClick(e){if(isNaN(e))return;const t=this._sectorData?.[Ae[e]],a=t?.at(0);a&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(a):this._updateCurrentBestFeature(a))}handleFeatureClick(e){const{sector:t,featureIndexInSector:a}=e;if(isNaN(a))return;const i=this._sectorData?.[t],r=i?.at(a);r&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(r):this._updateCurrentBestFeature(r))}handleDrawCursorUpdateEvents(e){const{measurementAngle:t,tempDistance:a,heightMeasurementPixels:i,mode:r,activeViewer:s,currentBestFeature:o}=this,n=s?.imageSize;if(!e.vertices||!n||!o)return;const c=xe(e.vertices.at(-1),r,n);if(i.length<1||!c||!a||!t||"none"===r)return;const l=He(i[0],c,t);if(!l?.length)return;this.heightMeasurementPixels.push(l),"panoramic"===r?this.createPolylineGraphicPano():this.createPolylineGraphic();const h=Ee(o.attributes.location.spatialReference),u=De(this.heightMeasurementPixels,a,h);u&&(this.heightMeasurementResult=u)}async handleDrawVertexAddEvents(e,t){const{currentBestFeature:a,activeViewer:i,heightMeasurementPixels:r,mode:s}=this;if(!a||!i||!e.vertices?.length||"none"===s)return;const o=i?.imageSize;if(!r.length&&o){const a=xe(e.vertices.at(-1),s,o);this.heightMeasurementPixels.push(a);const i=await this.calculateHeightMeasurementInfo(a,s,t);if(!i?.measurementAngle||!i?.tempDistance)return;this.measurementAngle=i.measurementAngle,this.tempDistance=i.tempDistance}}load(e){return this.addResolvingPromise(this._loadViewAdapter(e).catch(e=>{if(!y(e))throw e})),this}async loadBestImage(e,t){return this.selectedPoint=Y(e),this.beforeLoad(),this._fetchFeaturesWithController(e,t)}loadImageError(e){u.getLogger(this).error("oriented-imagery-viewer:load-image",e),this.setMessage("imageLoadError","error",e.message)}async loadSketch(e){if(!this.sketch){const t=import("../Sketch/SketchViewModel.js"),{default:a}=await t;v(e),this.sketch=new a({layer:this._defaultGraphicsLayer,view:this.activeViewer?.imageRenderer,updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{edgeOperation:"none",shapeOperation:"none",vertexOperation:void 0},enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:"transform"}})}return this.sketch}async loadMeasurementAdapter(e){if(!this.sketchAdapter){const t=import("./adapters/sketch/MeasurementAdapter.js"),{default:a}=await t;if(v(e),this.sketchAdapter=new a({viewModel:this}),!this.sketchAdapter.viewModel.isResolved())return}return this.sketchAdapter}async loadTriangulatedMeasurementAdapter(e){if(!this.triangulatedMeasurementAdapter){const t=import("./adapters/sketch/TriangulatedMeasurementAdapter.js"),{default:a}=await t;if(v(e),this.triangulatedMeasurementAdapter=new a({viewModel:this}),!this.triangulatedMeasurementAdapter.viewModel.isResolved())return}return this.triangulatedMeasurementAdapter}async processFeatureResponse(e,t,a){const{features:i}=e;if(this._clearFeatureGeometries(),!this._checkFeatures(i))return;const{features:r,polygons:s,frustums:o}=this.filterByFootprints(i,t,a?.skipFilter);if(!this._checkFeatures(r))return;this.coveragePolygons.addMany(s),this.coverageFrustums.addMany(o);const n=await this.processElevationSample(s,r,a);v(a),await this._updateElevationOfSelectedPointAndLocations(r,t,n),v(a),ct(r,n);const c=this._processSuitableFeatures(r,t);this.updateSuitabilities(c,a?.loadBestImage)}async processFeatureElevation(e,t,a){if(!t)return;const{features:i,polygons:r}=this.filterByFootprints(e,t,!0);if(!i?.length)return;const s=await this.processElevationSample(r,i,a);return v(a),s}async startMeasurement(e,t){this.sketch||await this.loadSketch(t),await this.loadMeasurementAdapter(t);const{sketch:a,sketchAdapter:i,activeViewer:r,mode:s}=this;if(!a||!i||!r||"none"===s)return;if(this.displayNewMeasurementButton=!1,"panoramic"===s&&(a.defaultCreateOptions.defaultZ=0),await a.create(e),"panoramic"===s){const{drawOperation:e}=a.view.activeTool;e.constraintsEnabled=!1,e._set("elevationDrawSurface",null)}const o=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;o&&this.sketch&&(this.sketch.polygonSymbol=$e(o),this.sketch.polylineSymbol="panoramic"===s?Je:Ze(o,2.5))}startHeightMeasurement(){this.heightMeasurementPixels=[],this.displayNewMeasurementButton=!1,this.draw??=new _e({view:this.activeViewer?.imageRenderer});this.draw.create("polyline").on(["cursor-update","vertex-add","draw-complete"],e=>this.handleDrawEvents(e))}createPolylineGraphic(){const e=[this.heightMeasurementPixels[0],this.heightMeasurementPixels.at(-1)],a=this.activeViewer?.imageRenderer.spatialReference;if(this.heightGraphic)this.heightGraphic.geometry=new j({paths:[e],spatialReference:a});else{const i=new j({paths:[e],spatialReference:a}),r=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;this.heightGraphic=new t({geometry:i,symbol:Ze(r,2.5)}),this.activeViewer?.addGraphic(this.heightGraphic)}}createPolylineGraphicPano(){const e=this.activeViewer?.imageRenderer.spatialReference,a=this.activeViewer?.imageSize;if(!a)return;const i={x:this.heightMeasurementPixels[0][0],y:this.heightMeasurementPixels[0][1]},r={x:this.heightMeasurementPixels.at(-1)[0],y:this.heightMeasurementPixels.at(-1)[1]},{heading:s,pitch:o}=oe(i,a[0],a[1]),{heading:n,pitch:c}=oe(r,a[0],a[1]),l=[[...ne(s,o)],[...ne(n,c)]];if(this.heightGraphic)this.heightGraphic.geometry=new j({paths:[l],spatialReference:e});else{const a=new j({paths:[l],spatialReference:e});this.heightGraphic=new t({geometry:a,symbol:Je}),this._panoramicViewer.addGraphic(this.heightGraphic,0)}}async editOverlayedGraphics(e){this.sketchTriangularGraphicsLayer||this._initializeSketchTriangularGraphicsLayer(),this.sketchTriangularGraphicsLayer?.destroyed&&this._handleDestroyedTriangularSketchLayer(),this.sketchTriangularGraphicsLayer.add(e),this.sketchTriangular||(this._initializeSketchTriangular(),await this.loadTriangulatedMeasurementAdapter()),this.updateOverlayedGeometry(e)}updateOverlayedGeometry(e){this.sketchTriangular?.update([e],{tool:"reshape"})}async processMeasurementVectors(e){this.triangularMeasurementActive&&this.currentBestFeature&&(this.measurementVectors?.length<2&&await this.updateMeasurementVectorsArray(e),2===this.measurementVectors.length&&await this.calculateTriangulatedMeasurements(e))}async updateMeasurementVectorsArray(e){const t=this.measurementVectors.length?this.currentBestFeatureMeasurementImage:this.currentBestFeature;if(t){const a=await this.computeMeasurementVector(e,t);a&&this.measurementVectors.push(a)}}async computeMeasurementVector(e,t){const{activeViewer:a,mode:i}=this,r=a?.imageSize;if(!e||!t||!r)return;const s=ze(e,i,r),o=this.view?.spatialReference,n=[];for(let c=0;c<s.length;c++){const e={x:s[c][0],y:s[c][1]};let a=await this.getMapPoint(e,{feature:t,imageSize:r,mode:i});o&&!a.spatialReference.equals(o)&&(a=await B(a,o)),n.push(a)}return Ue(n,t)}async handleDrawEvents(e,t){if(this.draw)switch(e.type){case"cursor-update":this.handleDrawCursorUpdateEvents(e);break;case"vertex-add":await this.handleDrawVertexAddEvents(e,t);break;case"draw-complete":await this.displayHeightResults()}}initializeMeasurement(e){switch(this.clearMeasurementGraphics(),this.resetMeasurementData(),e){case"distance":this.startMeasurement("polyline");break;case"area":this.startMeasurement("polygon");break;case"height":this.startHeightMeasurement()}}async overlayCameraLocations(e){const{activeViewer:a,currentBestFeature:i,overlayedCameraLocations:r,layer:s,mode:o,state:n,layerFloorFilterClause:c}=this,l=a?.imageSize;if(!l||!i||!s||"none"===o||n.includes("loading"))return;const{polygon:h}=J(i.attributes);if(a.removeManyGraphics(r.toArray()),r.removeAll(),e){const{features:e}=await s.queryFeatures({where:P(`${s.objectIdField} <> ${i.attributes.objectId}`,P(s.definitionExpression,c)),geometry:h,returnGeometry:!0,outFields:[s.objectIdField]}),n=await Promise.all(e.map(async e=>{const{attributes:a,geometry:r}=e,s=await this.getPixels(r,{feature:i,imageSize:l,mode:o}),n="panoramic"===o?Ke():Qe();return new t({attributes:a,symbol:n,geometry:s})}));r.addMany(n),a.addManyGraphics(r.toArray())}}overlayGraphicsOnImage(e,t){this.removeOverlayedGraphicsOnImage(e),this.overlayedMapFeatures.set(e,t),this.activeViewer?.addManyGraphics(t.toArray())}async overlayMapFeatures(e,a=!1){const{activeViewer:r,currentBestFeature:o,mode:n,state:c,layer:l}=this,h=r?.imageSize;if(!h||!o||"none"===n||"video"===n||"panoramic-video"===n||c.includes("loading")||!l)return;const{polygon:d}=J(o.attributes);try{const{imageGeometryField:t,oiObjectIdField:a}=Te(e,l.imageGeometryField,l.imageReferenceField);this.imageGeometryField=t.name,this.oiObjectIdField=a.name}catch(g){u.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features",g)}const{features:m}=await e.queryFeatures({geometry:d,returnGeometry:!0,outFields:["*"]}),p=new s((await Promise.all(m.map(async i=>{const r=i.symbol?.clone()??e.renderer?.getSymbol(i)?.clone(),{attributes:s,geometry:c}=i,l=c,{imageGeometryField:d,oiObjectIdField:m}=this;if(d&&m&&Oe(e,d,m)&&`${s[m]}`==`${o.attributes.objectId}`)try{return Re(s,d,e,a,h,n,r)}catch(g){u.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features","couldn't create graphic from attributes, geometry will be used",{error:g,feature:i,layer:e,imageGeometryField:this.imageGeometryField,imageReferenceField:this.oiObjectIdField})}switch(l?.type){case"point":{const i=await this.getPixels(l,{feature:o,imageSize:h,mode:n});return new t({attributes:s,layer:e,symbol:r,geometry:i,visible:e.visible&&a})}case"polygon":{const{rings:i,spatialReference:c}=l,u=i.map(e=>e.map(([e,t,a])=>new O({x:e,y:t,z:a,spatialReference:c}))),d=await Promise.all(u.map(async e=>this.getPixels(e,{feature:o,imageSize:h,mode:n}).then(e=>e.map(de))));return new t({attributes:s,layer:e,symbol:r,geometry:new R({rings:d,spatialReference:x.WebMercator}),visible:e.visible&&a})}case"polyline":{const{paths:i,spatialReference:c}=l,u=i.map(e=>e.map(([e,t,a])=>new O({x:e,y:t,z:a,spatialReference:c}))),d=await Promise.all(u.map(async e=>this.getPixels(e,{feature:o,imageSize:h,mode:n}).then(e=>e.map(de))));return new t({attributes:s,layer:e,symbol:r,geometry:new j({paths:d,spatialReference:x.WebMercator}),visible:e.visible&&a})}case"multipoint":{const{points:i,spatialReference:c}=l,u=i.map(([e,t,a])=>new O({x:e,y:t,z:a,spatialReference:c})),d=await this.getPixels(u,{feature:o,imageSize:h,mode:n}).then(e=>e.map(de));return new t({attributes:s,layer:e,symbol:r,geometry:new T({points:d,spatialReference:x.WebMercator}),visible:e.visible&&a})}}return null}))).filter(i));this.overlayGraphicsOnImage(`${e.id}`,p)}getDepthAt(e){const{activeViewer:t,currentBestFeature:a,mode:i,state:r,depthImage:s}=this,o=t?.imageSize;if(!o||!a||"none"===i||r.includes("loading"))return u.getLogger(this).warnOnce("oriented-imagery-viewer:get-depth-at","Load an image to use depth"),null;if(!s?.loaded)return u.getLogger(this).error("oriented-imagery-viewer:get-depth-at","Depth image is not loaded"),this.emit("depth-image-service:not-loaded"),null;const n=(Array.isArray(e)?e:[e]).map(e=>s.depthAt(e,{width:o[0],height:o[1]})??null);return Array.isArray(e)?n:n[0]}async getPixels(e,t){const{imageSize:a,mode:i,feature:r}=t,s=(await this.worldToImage(Array.isArray(e)?e:[e],r)).map(e=>{if("default"===i)return new O({x:e.x-.5,y:.5-e.y,spatialReference:x.WebMercator});const[t,r]=a,{heading:s,pitch:o}=oe(e,t,r),n=ne(s,o);return new O(n,x.WebMercator)});return Array.isArray(e)?s:s[0]}async getMapPoint(e,t){const{feature:a,mode:i,imageSize:r}=t,{elevationSample:s,attributes:o}=a,{elevationSource:n,location:c,cameraHeight:l}=o;let h=c.clone();h.spatialReference.isGeographic&&(h=await B(h,x.WebMercator));const u=await le(c.spatialReference,c.z??0,l,{elevationSample:s,elevationSource:n,extent:this.footprintExtent});let d;"elevationSample"in u&&he(u.elevationSample)&&(a.elevationSample=u.elevationSample);const m=Array.isArray(e)?e:[e];if(this.depthImage?.loaded)for(const p of m){const e=this.getDepthAt(p);null!=e&&(p.depth=e)}if("default"===i){const e=ce(o,r[0],r[1]);d=await ee(m,{...e,cameraLocation:h},u)}else{const e=ue(o,r[0],r[1]);d=await te(m,{...e,cameraLocation:h},u)}return Array.isArray(e)?d:d[0]}getActiveSectors(){return Ae.filter(e=>this._sectorData?.[e]?.length)}async plotMapPoint(e){return this.plotReferencePoint(e),this.transformAndPlotReferencePointOnImage({feature:this.currentBestFeature,selectedLocation:e,options:{signal:this._transformController?.signal}})}plotReferencePointOnGround(e){this._referencePointOnGround&&(this._overlays?.remove(this._referencePointOnGround),this._referencePointOnGround.destroy()),null!=e&&(this._referencePointOnGround=new t({geometry:new O({...e.toJSON()}),symbol:Xe}),this.view?this._overlays?.add(this._referencePointOnGround):this.emit("plot-ground-point",{data:{point:this._referencePointOnGround?.geometry}}))}plotReferencePointOnImage(e){if("image-loaded"===this.state)switch(this.clearReferencePointOnImage(),this.mode){case"default":{const a=A(e)?e.toJSON():e;a.x-=.5,a.y=.5-a.y,this._referencePointOnImage=new t({geometry:new O({spatialReference:this._imageViewer.imageRenderer.spatialReference,...a}),symbol:Xe}),this._imageViewer.addGraphic(this._referencePointOnImage,0);break}case"panoramic":{const{imageSize:a}=this._panoramicViewer;if(!a)return;const[i,r]=a,{heading:s,pitch:o}=oe(e,i,r),n=ne(s,o);this._referencePointOnImage=new t({geometry:new O(n,x.WebMercator),symbol:Ye}),this._panoramicViewer.addGraphic(this._referencePointOnImage,0);break}}}plotLocationPointOnImage(e,t=!1){if("image-loaded"===this.state)switch(this.clearLocationPointOnImage(t),this.mode){case"default":this._plotLocationPointOnDefaultImage(e,t);break;case"panoramic":this._plotLocationPointOnPanoramicImage(e,t)}}removeAllOverlayMapFeatures(){this.overlayedMapFeatures.forEach(e=>{this._imageViewer.removeManyGraphics(e.toArray())}),this.overlayedMapFeatures.clear()}removeOverlayedGraphicsOnImage(e){const t=this.overlayedMapFeatures.get(e);t?.length&&(this.activeViewer?.removeManyGraphics(t.toArray()),this.overlayedMapFeatures.delete(e))}reset(){const{mode:e}=this;"default"===e||"panoramic"===e?this.resetImage():"video"===e?this.resetVideo():"panoramic-video"===e&&this.resetVideoPanoramic(),this.beforeLoad(!1)}resetImage(){switch(this.setMessage("onLoadMessage","info"),this.mode){case"default":this._imageViewer.clearImage(),this._imageViewer.clearGraphics();break;case"panoramic":this._panoramicViewer.clearGraphics()}this._clickTask=m(this._clickTask)}resetVideo(){this.setMessage("onLoadMessage","info"),this.videoViewModel?.resetVideoHandler(),this._overlays?.removeAll(),this.videoViewModel=null,this.featureCache=[],this.currentBestFeature=null}resetVideoPanoramic(){this.setMessage("onLoadMessage","info"),this._overlays?.removeAll(),this.currentBestFeature=null}resetMeasurementData(){this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.heightMeasurementPixels=[],this.measurementVectors=[],this.heightMeasurementResult=0,this.tempDistance=null,this.measurementAngle=null,this.heightMeasurementAccuracy=0,this.heightGraphic=null,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedMeasurementGraphic=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaAccuracy=0}async saveDrawing(){const{dataCaptureLayer:e,sketchAdapter:t}=this;if(!e||"data-capture"!==t?.type)return;const{pendingGraphics:a,savedGraphics:i}=t,r=a.get(e.id),s=r?.toArray();if(!r||!s?.length)return;const{addFeatureResults:o}=await this.saveDataCaptureFeatures(s),n=o.reduce((t,{objectId:a,globalId:i,error:r},o)=>{const n=s[o],{attributes:c}=n;return r?t.error.push(n):(a&&(c[e.objectIdField]=a),i&&e.globalIdField&&(c[e.globalIdField]=i),t.success.push(n)),t},{success:[],error:[]});i.addMany(n.success),r.removeAll(),r.addMany(n.error)}async saveDataCaptureFeatures(e){const{activeViewer:t,currentBestFeature:a,dataCaptureLayer:r,mode:s}=this,o=t?.imageSize;if(!o||!a||"none"===s||"video"===s||"panoramic-video"===s)throw new n("orientedimageryviewer:missing-input","Image size, current best feature and mode are required to save data capture features");if(!r)throw new n("orientedimageryviewer:missing-featurelayer","Data capture layer is not available");const c=await Promise.all(e.map(async e=>{const t=e.clone(),{geometry:i}=t;if(!i)return;const n=i.type,c=r.hasZ,l=r.geometryType,h=n!==l,u=h?await import("./transformers.js"):null,d=u?.default[l],m=h?d?.(i):i;if(m)switch(m.type){case"point":return t.geometry=await this.getMapPoint(me(s,m,o),{feature:a,imageSize:o,mode:s}),c||(delete t.geometry.z,t.geometry.hasZ=!1),t.geometry.hasM=!1,t;case"polygon":{const e=await Promise.all(m.rings.map(async e=>this.getMapPoint(e.map(([e,t,a])=>me(s,{x:e,y:t,z:a},o)),{feature:a,imageSize:o,mode:s})));return t.geometry=new R({spatialReference:e[0][0].spatialReference,hasZ:c,hasM:!1,rings:e.map(e=>e.map(de))}),t}case"polyline":{const e=await Promise.all(m.paths.map(async e=>this.getMapPoint(e.map(([e,t,a])=>me(s,{x:e,y:t,z:a},o)),{feature:a,imageSize:o,mode:s})));return t.geometry=new j({spatialReference:e[0][0].spatialReference,hasZ:c,hasM:!1,paths:e.map(e=>e.map(de))}),t}}})),l=c.filter(i);return r.applyEdits({addFeatures:l}).then(e=>{const{addFeatureResults:t}=e;let a=0;const i=c.map(e=>{const i=t[a++];return e?i:{error:new n("orientedimageryviewer:save-unsucccessful","Error in saving data capture features"),objectId:null,globalId:null}});return{...e,addFeatureResults:i}})}async searchBestImage(e,t){try{const a=await W(e,t);a&&await this.processFeatureResponse(a,e.point,t)}catch(a){y(a)||(this.setMessage("imageLoadError","error",a.message),u.getLogger(this).error("error occurred while finding best image",a))}}selectTriangularMeasurementFeature(e){this.currentBestFeatureMeasurementImage=this.features?.find(({attributes:t})=>t.objectId===Number(e))}setAdditionalCameraLocationsVisibility(e){this.additionalCameraLocations.forEach(t=>{t.visible=e})}setAdditionalCoverageVisibility(e){this.additionalFootprints.forEach(t=>{t.visible=e})}setCurrentCoverageVisibility(e){this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.visible=e),this.currentBestFeatureLocation&&(this.currentBestFeatureLocation.visible=e)}setMapImageConversionToolState(e){this.mapImageConversionToolState=e}setCurrentPanoramaView(e,t){this._panoramicViewer?.set({yaw:e,pitch:t})}async startDataCapture(e,t){const a=this.activeViewer?.imageRenderer,{oiObjectIdField:i,currentBestFeature:r}=this;if(!a||!r||!i)return;const{attributes:{objectId:o}}=r,n=this.overlayedMapFeatures.get(e.id)?.toArray()??[],c=[],l=[];for(const s of n)`${s.getAttribute(i)}`==`${o}`?c.push(s):l.push(s);this.overlayGraphicsOnImage(e.id,new s(l)),this.collectionId=e.id;const h=await this.loadSketch(t),u=await this.loadDataCaptureAdapter(t);v(t),h.addGraphics(c),u.savedGraphics.addMany(c);a.ui.find("zoom").visible=!1,a.map.layers.add(this.sketchGraphicsLayer)}async stopDataCapture(e=!1){this.sketch?.cancel(),this.sketchGraphicsLayer?.removeAll(),this.sketchAdapter=p(this.sketchAdapter),this.sketch=p(this.sketch),this.collectionId=null;const{dataCaptureLayer:t}=this,a=this.activeViewer?.imageRenderer;if(!a||a.destroyed)return;a.map.layers.remove(this.sketchGraphicsLayer),e&&t&&await this.overlayMapFeatures(t,!0);const i=a.ui.find("zoom");i&&(i.visible=!0)}stopMeasurement(){this.heightMeasurementPixels=[],this.draw?.reset(),this.sketch?.cancel()}toggleAllOverlayMapFeatures(e){this.overlayedMapFeatures.forEach(t=>{this._toggleVisiblity(t,e)})}toggleOverlayMapFeatures(e,t,a){const i=this.overlayedMapFeatures.get(e);i&&a&&this._toggleVisiblity(i,t)}toggleSelection(e){const{sketch:t}=this;t&&(t.updateOnGraphicClick=e,t.cancel())}async transformAndPlotReferencePointOnImage(e){const{feature:t,selectedLocation:a,options:i}=e;let r=!1,s=!1;const o=this.bestFeatureFootprint?.geometry;switch(o?.type){case"polygon":{const e=a.spatialReference.equals(o.spatialReference)?a:await B(a,o.spatialReference);r=o.contains(e);break}case"mesh":{const e=a.spatialReference.equals(o.spatialReference)?a:await B(a,o.spatialReference);s=o.extent.contains(e);break}}if(!r&&!s)return void this.clearReferencePointOnImage();const n=await this.worldToImage(a,t,i);if(n)return v(i),this.plotReferencePointOnImage(n),{x:n.x,y:n.y};this.clearReferencePointOnImage()}async triangulatedLocationWorkflow(e,t){if(this.currentBestFeature&&e){const{currentBestFeature:a}=this;this.triangulatedPoint&&(this.measurementVectors=[],this.triangulatedPoint=null,this.clearLocationPointOnImage(!0));const i=Ue(e,a);if(!i)return;this.measurementVectors.push(i),await this.plotReferenceLocationPoint(e,t),v(t),this._createTriangularImageLocationHandle()}}async updateFeatureCache(e,t){const a=await q(e,t);a.features?.length&&(this.featureCache=a.features)}async _calculateTriangulatedPointFromGroundPoint(e,t){if(this.currentBestFeatureMeasurementImage&&e){const{currentBestFeatureMeasurementImage:a}=this,i=Ue(e,a);i&&this.measurementVectors.push(i);const r=await Ne(this.measurementVectors);v(t),this.triangulatedPoint=r??this.triangulatedPoint}}async _fetchFeatures(e,t){if(!this.view)return;const a=this.layer;if(a){const i={include:a},r=this.view.toScreen(e);if(!r)return;const s=await this.view.hitTest(r,i);return this._processHitTestResults(a,s,t)}}async _fetchFeaturesWithController(e,t){try{await this._fetchFeatures(e,t)}catch(a){if(y(a))return;this.setMessage("imageLoadError","error"),u.getLogger(this).error("error occurred while fetching features",a)}}_groupFeaturesBySectors(){const{_suitabilities:e,additionalFeatures:t,features:a,invalidCameraHeading:i}=this,r=a.at(0);if(!e||!t||!r||!a||i)return void(this._sectorData=null);this._sectorData={};const o={};this._featureToSector=o;for(const h of Ae)this._sectorData[h]=new s;const n=e.map((e,t)=>({...e,featureIndex:t}));n.sort((e,t)=>e.trueSuitability-t.trueSuitability);const c=n.map(({distance:e})=>e),l=Math.max(...c);n.forEach(e=>{const{distance:t,angle:i,featureIndex:s}=e,n=t/l*Le[2],c=ht(t,l),h=lt(i);if(!this._sectorData)return;const u=Le[3]+n*Math.sin(i*Math.PI/180),d=Le[3]+n*Math.cos(i*Math.PI/180);let m;const p=a.at(s),g=p===r,{cameraPitch:y}=p.attributes,v=y<5;if(g&&v)m=-90;else{const e=u-Le[3],t=d-Le[3],a=t/Math.sqrt(e**2+t**2);let i=180*Math.acos(a)/Math.PI;(e<0&&t<0||e<0&&t>0)&&(i*=-1),m=i}const w=""===c?h:`${c}_${h}`;g&&(m===this.bestFeatureAngle?this.previousFeatureAngle=m:this.bestFeatureAngle=m,this.navigatorCurrentBestFeature=v?null:{x:u,y:d,direction:h}),o[`${p.attributes.objectId}`]=w;const f=this._sectorData[w];f.add({angle:i,featureIndex:s,x:u,y:d,objectID:p.attributes.objectId,sector:w,featureIndexInSector:f.length})})}_handleDestroyedTriangularSketchLayer(){this.sketchTriangularGraphicsLayer&&this.activeTriangulatedViewer&&(this.activeTriangulatedViewer.imageRenderer.map.layers.remove(this.sketchTriangularGraphicsLayer),this.sketchTriangularGraphicsLayer=new U,this.activeTriangulatedViewer.imageRenderer.map.layers.add(this.sketchTriangularGraphicsLayer),this.sketchTriangular&&(this.sketchTriangular.layer=this.sketchTriangularGraphicsLayer,this.sketchTriangular.view=this.activeTriangulatedViewer.imageRenderer))}_initializeMeasurementService(){this._measurementService||(this._measurementService=new Ft(this))}_initializeSketchTriangular(){if(!this.activeTriangulatedViewer)return;const e="panoramic"===this.mode;this.sketchTriangular=new _t({view:this.activeTriangulatedViewer.imageRenderer,layer:this.sketchTriangularGraphicsLayer,updateOnGraphicClick:!1,defaultUpdateOptions:{toggleToolOnClick:!1,enableZ:!e}}),e&&(this.sketchTriangular.defaultUpdateOptions.reshapeOptions={edgeOperation:"offset",shapeOperation:"move-xy",vertexOperation:"move-xy"})}_initializeSketchTriangularGraphicsLayer(){this.activeTriangulatedViewer&&(this.sketchTriangularGraphicsLayer=new U,this.activeTriangulatedViewer.imageRenderer.map.layers.add(this.sketchTriangularGraphicsLayer))}_initializeVideo(){if(this.videoElement||!this.currentBestFeature)return;this.removeHandles(bt.videoPlayerHandles),this.videoElement=new fe({video:this.currentBestFeature.attributes.imagePath,georeference:new ve({extent:new L(Ce)}),autoplay:!1}),this.videoElement.content?.loop&&(this.videoElement.content.loop=!1);const e=new N({source:this.videoElement,title:this.layer?.title,copyright:this.layer?.copyright});this.videoLayer=e,e&&this.videoMapView.map.layers.add(e),this.addHandles(mt(this.videoMapView),bt.videoPlayerHandles),this.videoViewModel=new yt({oiViewModel:this})}_plotLocationPointOnDefaultImage(e,a=!1){const i=A(e)?e.toJSON():e;i.x-=.5,i.y=.5-i.y,a?(this._correctedLocationPointOnImage=new t({geometry:new O({spatialReference:x.WebMercator,...i}),symbol:et}),this.imageMeasurementViewer.addGraphic(this._correctedLocationPointOnImage,0)):(this._locationPointOnImage=new t({geometry:new O({spatialReference:x.WebMercator,...i}),symbol:et}),this._imageViewer.addGraphic(this._locationPointOnImage,0))}_plotLocationPointOnPanoramicImage(e,a=!1){const i=a?this._panoramicMeasurementViewer:this._panoramicViewer,{imageSize:r}=i;if(!r)return;const[s,o]=r,{heading:n,pitch:c}=oe(e,s,o),l=ne(n,c),h=new t({geometry:new O(l,x.WebMercator),symbol:tt});a?this._correctedLocationPointOnImage=h:this._locationPointOnImage=h,i.addGraphic(h,0)}_clearFeatureGeometries(){this.coveragePolygons.removeAll(),this.coverageFrustums.removeAll(),this.pointSources.removeAll()}_checkFeatures(e){return!!e?.length||(this.setMessage("noImageError","error"),this.videoElement?.content?.pause(),this.currentBestFeature=null,!1)}async _getElevationSampleFromGround(e,t,a){if(!e[0])return;const i=await G(e);if(this._updateFootprintWithFeatures(t,i),"3d"===this.view?.type)try{return await this.view.map.ground.createElevationSampler(this.footprintExtent,a)}catch(r){y(r)||u.getLogger(this).error(r)}}async processElevationSample(e,t,a){const{elevationSource:i}=t[0].attributes,r=await this._getElevationSampleFromGround(e,t,a);return r||(i&&this.footprintExtent&&X(i)?await ie({extent:this.footprintExtent,lod:i.lod,url:i.url,rasterFunction:i.rasterFunction}):void 0)}_processSuitableFeatures(e,t){return $({features:e,selectedPoint:t,camera:ut(this.view)?this.view.camera:null,currentImage:this.currentBestFeature})}async _processHitTestResults(e,t,a){const{screenPoint:i,results:[r]}=t,s="graphic"===r?.type&&this.shouldShowSelectedImage,o=r?.mapPoint??this.view?.toMap(i);if(!o)return;o.x=D(o.x,o.spatialReference);const{layerFloorFilterClause:n}=this,c=e.spatialReference.equals(o.spatialReference)?o:await B(o,e.spatialReference),l=c.spatialReference.isGeographic?z(c):c,h=P("1=1",P(e.definitionExpression,n)),u=l.spatialReference.isGeographic?1:V(l.spatialReference),d={layerInstanceOrURL:e,point:l,queryParams:{where:h,maximumDistance:e.maximumDistance?e.maximumDistance/u:void 0,objectIds:s?[r.graphic.getAttribute(e.objectIdField)]:void 0}};await this.searchBestImage(d,a)}async _queryAndLoadByObjectId(e,t,a,i){this.displayMessage=null;const{response:r}=await ft(e,t,a,i);if(v(i),!r?.features?.length)throw new wt(t);const s=J(r.features[0].attributes).polygon,o=O.fromJSON(H(s)),n=Y(o),c=V(n.spatialReference);this.selectedPoint=n;const l={layerInstanceOrURL:e,point:n,queryParams:{where:P(P("1=1",P(e.definitionExpression,a)),`${e.objectIdField} <> ${t}`),maximumDistance:e.maximumDistance?e.maximumDistance/c:void 0}},h=await W(l,i);v(i);const{features:u}=h;return u.push(r.features[0]),await this.processFeatureResponse(h,n,{...i,loadBestImage:!1})}_reorderTriangularSketchLayer(){const e=this.imageMeasurementViewer.imageRenderer.map.layers?.length;this.sketchTriangularGraphicsLayer&&e&&this.imageMeasurementViewer.imageRenderer.map.layers.reorder(this.sketchTriangularGraphicsLayer,e-1)}_resetCursor(){const{activeViewer:e,imageMeasurementViewer:t}=this;e&&this.removeHandles(bt.activeViewerCursorHandles),t&&this.removeHandles(bt.imageViewerCursorHandles)}async _setImageSource(e,t,a,i,r,s){e.imageSource={datasetFormat:t.toUpperCase(),url:a.split("?")[0]},e.customParameters=Object.fromEntries(i),e.imageRotation=r??0,await e.loadImage(s)}_setMeasurementCursor(){const{activeViewer:e,imageMeasurementViewer:t,triangularMeasurementActive:a}=this;e&&this.addHandles(e.imageRenderer.acquireCursor("crosshair","high"),bt.activeViewerCursorHandles),t&&a&&this.addHandles(t.imageRenderer.acquireCursor("crosshair","high"),bt.activeViewerCursorHandles)}_toggleVisiblity(e,t){e.forEach(e=>{e.visible=t})}async _updateElevationOfSelectedPointAndLocations(e,t,a,i){const r=he(a),{location:s,cameraHeight:o}=e[0].attributes,n=await le(s.spatialReference,s.z,o,{elevationSample:r?a:void 0,elevationSource:r?void 0:e[0].attributes.elevationSource,extent:this.footprintExtent},i);v(i);const[c,...l]=await ae([t,...e.map(e=>e.attributes.geometry.clone())],n);v(i),t.elevation=c.z,e.forEach((e,t)=>{e.attributes.elevation=l[t].z})}_updateFeatures(e,t=!0){if(!e.length)return this.currentBestFeature=null,void this.additionalFeatures.removeAll();this.features.removeAll(),this.features.addMany(e),this.navigationNodes.removeAll(),this.navigationNodes.addMany(e.map(e=>{const{geometry:t,attributes:a}=e,{isSpherical:i,cameraHeading:r,cameraPitch:s}=a;return new gt({geometry:t,attributes:a,currentHeading:i?0:r,currentPitch:i?0:s})})),e.length>1?this.additionalFeatures.addMany(e.slice(1)):this.additionalFeatures.removeAll(),this._updateGroundElevation=!0,t&&(this.currentBestFeature=e[0]),"video"===this.mode&&(this._initializeVideo(),this.videoElement?.loaded&&this.videoViewModel?.playVideoFromSelectedLocation(e[0])),"panoramic-video"===this.mode&&this._loadVideo()}_updateFootprintWithFeatures(e,t){const a=[];for(const{attributes:{geometry:i}}of e)t.contains(i)||a.push([i.x,i.y]);a.sort((e,t)=>+E([e,t])),t.addRing(a),this.footprintExtent=be(t.extent,2,2)}async _updatePointsAndPolygons(e){const{pointSources:a,currentBestFeature:i,currentCoverageVisible:r,isAdditionalPointSourcesVisible:s,mode:o,layer:n}=this;if(i&&(this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.destroy(),this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null),!this.invalidCameraHeading)){await(this._adapter?.createFootprints(e)),v(e);for(const e of a)e.imageID===i.attributes.objectId?this.currentBestFeatureLocation=new t({attributes:{imageID:e.imageID},geometry:e.clone(),symbol:at,visible:r}):this.additionalCameraLocations.push(new t({attributes:{imageID:e.imageID},geometry:e.clone(),symbol:it,visible:s}));"video"!==o&&"panoramic-video"!==o||!n||this.featureCache.length||await this.updateFeatureCache(n,i.geometry.spatialReference)}}_updateCurrentBestFeature(e){if(!e)return;if(this.currentBestFeature=this.features?.at(e.featureIndex),"video"===this.mode)return void(this.currentBestFeature&&this.videoViewModel?.playVideoFromSelectedLocation(this.currentBestFeature));if("panoramic-video"===this.mode)return void(this.currentBestFeature&&this._panoramicVideoViewer.viewModel.playPanoramicVideoFromSelectedLocation(this.currentBestFeature));const t=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;let a;if(t)a=-90;else{const t=e.x-Le[3],i=e.y-Le[3],r=i/Math.sqrt(t**2+i**2);let s=180*Math.acos(r)/Math.PI;(t<0&&i<0||t<0&&i>0)&&(s*=-1),a=s}a===this.bestFeatureAngle?this.previousFeatureAngle=a:this.bestFeatureAngle=a,this.navigatorCurrentBestFeature=t?null:{x:e.x,y:e.y,direction:e.sector.includes("_")?e.sector.split("_")[1]:e.sector}}_updateImageMeasurementBestFeature(e){e&&(this.currentBestFeatureMeasurementImage=this.features?.at(e.featureIndex))}clearGraphics(){this._imageViewer.clearGraphics(),this._panoramicViewer.clearGraphics(),this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearGraphics()}clearReferencePointOnImage(){this._referencePointOnImage&&(this._imageViewer.removeGraphic(this._referencePointOnImage),this._panoramicViewer.removeGraphic(this._referencePointOnImage),this._referencePointOnImage=p(this._referencePointOnImage))}clearLocationPointOnImage(e=!1){this._locationPointOnImage&&!e&&(this._imageViewer.removeGraphic(this._locationPointOnImage),this._panoramicViewer.removeGraphic(this._locationPointOnImage),this._locationPointOnImage=p(this._locationPointOnImage)),this._correctedLocationPointOnImage&&(this.imageMeasurementViewer.removeGraphic(this._correctedLocationPointOnImage),this._panoramicMeasurementViewer.removeGraphic(this._correctedLocationPointOnImage),this._correctedLocationPointOnImage=p(this._correctedLocationPointOnImage))}plotReferencePoint(e){"mapPoint"in e?this.plotReferencePointOnGround(e.mapPoint):this.plotReferencePointOnGround(e)}async plotReferenceLocationPoint(e,t){if(this.currentBestFeatureMeasurementImage){const a=await this.worldToImage(e,this.currentBestFeatureMeasurementImage,{signal:t});v(t),a&&this.plotLocationPointOnImage(a,!0)}}setMessage(e,t,a,i){this.displayMessage={key:e,type:t,data:a,map:i}}async transformAndPlotSelectedLocation(e){const{currentBestFeature:t,invalidCameraHeading:a,selectedPoint:i,activeViewer:r}=this;if(this._crossSymbol&&(this._panoramicViewer.removeGraphic(this._crossSymbol),this._imageViewer.removeGraphic(this._crossSymbol),this._crossSymbol=p(this._crossSymbol)),!i||!t||"image-loaded"!==r?.state||a)return;let s;try{s=await this.worldToImage(i,t,e),v(e),await this.plotSelectedPointOnImage(s,e)}catch(o){y(o)||u.getLogger(this).error("failed to transform map point to pixel, cross symbol will not be plotted on image",{error:o,selectedPoint:i,feature:t})}}async worldToImage(e,t,a){const{footprintExtent:i}=this,{imageSize:r}=this.activeViewer;if("none"===this.mode||!t||!r||!i)return;const{attributes:{location:s,elevationSource:o,cameraHeading:n,cameraHeight:c},elevationSample:l}=t;let h=s.clone();const u=await le(s.spatialReference,s.z??0,c,{elevationSample:l,elevationSource:o});t.elevationSample=u.elevationSample;const d=Array.isArray(e)?e:[e];let m,p=await Promise.all(d.map(e=>new Promise(t=>{if(!e.hasZ)return t(ae(e,u));t(e)})));if(s.spatialReference.isGeographic&&(h=await B(h,x.WebMercator,a)),p=await Promise.all(p.map(async e=>h.spatialReference.equals(e.spatialReference)?e:await B(e,h.spatialReference,a))),v(a),"panoramic"===this.mode)m=ye(p,{imageHeight:r[1],imageWidth:r[0],cameraHeading:n,cameraLocation:h});else{const e=pe(t.attributes,r[0],r[1]);m=ge(p,{...e,cameraLocation:h})}return Array.isArray(e)?m:m[0]}updateCurrentCoveragePolygon(e){const{additionalFootprints:a,additionalCameraLocations:i,currentBestFeature:r,currentBestFeatureLocation:s,currentCoverageVisible:o,selectedPoint:n,view:c,_adapter:l,mode:h}=this;if(!r)return;const{attributes:{objectId:u},elevationSample:d}=r;if(this._initialCurrentCoverageUpdate){if(this._overlays?.removeAll(),this._initialCurrentCoverageUpdate=!1,this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),e&&!this.invalidCameraHeading&&(e.visible=o,this.bestFeatureCurrentFootprint=e),c){const e=[...a,...i,s].filter(dt);"3d"===c?.type&&d&&l?.updateGroundElevation&&(this._updateGroundElevation&&l.updateGroundElevation(e,d),"panoramic"===h&&l.updateGroundElevation([this.bestFeatureCurrentFootprint],d)),this._updateGroundElevation=!1,n&&(e.splice(-2,0,this.bestFeatureCurrentFootprint),e.push(new t({geometry:n.clone(),symbol:We.clone(),attributes:{imageID:u}}))),this._overlays.graphics.addMany(e)}}else if(c){if(this.invalidCameraHeading)return;this.bestFeatureCurrentFootprint&&(this._overlays?.remove(this.bestFeatureCurrentFootprint),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint));const t=this.bestFeatureCurrentFootprint&&this._overlays?this._overlays.graphics.indexOf(this.bestFeatureCurrentFootprint):-1;e&&(this.bestFeatureCurrentFootprint=e,"3d"===c?.type&&d&&l?.updateGroundElevation&&"panoramic"===h&&l.updateGroundElevation([e],d),e.visible=this.currentCoverageVisible,this._overlays?.graphics.add(this.bestFeatureCurrentFootprint,t>=0?t:this._overlays.graphics.length-1))}}};e([S()],St.prototype,"activeLayer",null),e([S({readOnly:!0})],St.prototype,"activeViewer",null),e([S()],St.prototype,"activeTriangulatedViewer",null),e([S()],St.prototype,"accuracyParametersMissing",null),e([S()],St.prototype,"additionalFeatures",void 0),e([S({type:s.ofType(t)})],St.prototype,"additionalCameraLocations",void 0),e([S({type:s.ofType(t)})],St.prototype,"additionalFootprints",void 0),e([S()],St.prototype,"areaMeasurementResult",void 0),e([S()],St.prototype,"areaMeasurementAccuracy",void 0),e([S()],St.prototype,"bestFeatureAngle",void 0),e([S()],St.prototype,"bestFeatureCurrentFootprint",void 0),e([S({type:t})],St.prototype,"bestFeatureFootprint",void 0),e([S({type:Number})],St.prototype,"brightness",null),e([S()],St.prototype,"cameraHeadingThreshold",void 0),e([S()],St.prototype,"cameraPitchThreshold",void 0),e([S()],St.prototype,"clickAction",void 0),e([S()],St.prototype,"videoViewModel",void 0),e([S()],St.prototype,"collectionId",void 0),e([S({type:Number})],St.prototype,"contrast",null),e([S()],St.prototype,"conversionProps",void 0),e([S()],St.prototype,"coverageFrustums",void 0),e([S()],St.prototype,"coveragePolygons",void 0),e([S()],St.prototype,"currentBestFeature",void 0),e([S()],St.prototype,"currentBestFeatureMeasurementImage",void 0),e([S()],St.prototype,"currentBestFeatureLocation",void 0),e([S()],St.prototype,"currentCoverageVisible",void 0),e([S()],St.prototype,"currentNode",null),e([S()],St.prototype,"depthImage",void 0),e([S()],St.prototype,"depthImageNotSupported",null),e([S()],St.prototype,"directionMode",void 0),e([S()],St.prototype,"featureCache",void 0),e([S()],St.prototype,"navigationNodes",void 0),e([S({json:{write:!1}})],St.prototype,"determineWorkflowForFeature",void 0),e([S({json:{write:!1}})],St.prototype,"determineWorkflowForTriangularMeasurement",void 0),e([S()],St.prototype,"disabled",void 0),e([S()],St.prototype,"displayMessage",void 0),e([S()],St.prototype,"displayNewMeasurementButton",void 0),e([S()],St.prototype,"distanceMeasurementResult",void 0),e([S()],St.prototype,"distanceAccuracyArray",void 0),e([S()],St.prototype,"dataCaptureLayer",void 0),e([S({readOnly:!0})],St.prototype,"featureCount",null),e([S()],St.prototype,"features",void 0),e([S()],St.prototype,"groundCoordinates",void 0),e([S()],St.prototype,"groundCoordinatesAccuracy",void 0),e([S()],St.prototype,"heightMeasurementPixels",void 0),e([S()],St.prototype,"heightGraphic",void 0),e([S()],St.prototype,"heightMeasurementResult",void 0),e([S()],St.prototype,"heightMeasurementAccuracy",void 0),e([S()],St.prototype,"measurementAngle",void 0),e([S()],St.prototype,"tempDistance",void 0),e([S({readOnly:!0})],St.prototype,"imageGalleryEnabled",null),e([S()],St.prototype,"imageGeometryField",void 0),e([S({readOnly:!0})],St.prototype,"imageLoaded",null),e([S()],St.prototype,"imageLocationToolState",void 0),e([S({readOnly:!0})],St.prototype,"invalidCameraHeading",null),e([S()],St.prototype,"imagePointsInView",null),e([S()],St.prototype,"imageMeasurementViewer",void 0),e([S()],St.prototype,"isAdditionalCoverageVisible",void 0),e([S()],St.prototype,"isAdditionalPointSourcesVisible",void 0),e([S()],St.prototype,"measurementVectors",void 0),e([S()],St.prototype,"layer",void 0),e([S()],St.prototype,"layerView",null),e([S({readOnly:!0})],St.prototype,"layerFloorFilterClause",null),e([S({type:Number})],St.prototype,"localPort",void 0),e([S()],St.prototype,"mapImageConversionToolState",void 0),e([S()],St.prototype,"measureType",void 0),e([S()],St.prototype,"measurementGraphic",void 0),e([S({readOnly:!0,value:"none"})],St.prototype,"mode",null),e([S()],St.prototype,"navigationMode",void 0),e([S()],St.prototype,"navigatorCurrentBestFeature",void 0),e([S()],St.prototype,"oiObjectIdField",void 0),e([S({type:s.ofType(t)})],St.prototype,"overlayedCameraLocations",void 0),e([S()],St.prototype,"overlayedMapFeatures",void 0),e([S()],St.prototype,"panoramicVideoLoaded",null),e([S()],St.prototype,"pixelCoordinates",void 0),e([S()],St.prototype,"preserveAngle",void 0),e([S()],St.prototype,"pointSources",void 0),e([S({readOnly:!0})],St.prototype,"popupEnabled",null),e([S()],St.prototype,"previousFeatureAngle",void 0),e([S()],St.prototype,"referencePoint",null),e([S({readOnly:!0})],St.prototype,"sectorData",null),e([S()],St.prototype,"selectedPoint",void 0),e([S({type:Number})],St.prototype,"sharpness",null),e([S()],St.prototype,"shouldShowSelectedImage",void 0),e([S()],St.prototype,"sketch",void 0),e([S()],St.prototype,"sketchTriangular",void 0),e([S()],St.prototype,"sketchTriangularGraphicsLayer",void 0),e([S()],St.prototype,"draw",void 0),e([S()],St.prototype,"sketchAdapter",void 0),e([S({readOnly:!0})],St.prototype,"sketchGraphicsLayer",null),e([S({readOnly:!0})],St.prototype,"state",null),e([S({readOnly:!0})],St.prototype,"thumbnails",null),e([S()],St.prototype,"triangularMeasurementActive",void 0),e([S()],St.prototype,"triangulatedDistanceMeasurement",void 0),e([S()],St.prototype,"triangulatedDistanceAccuracy",void 0),e([S()],St.prototype,"triangulatedAreaMeasurement",void 0),e([S()],St.prototype,"triangulatedAreaAccuracy",void 0),e([S()],St.prototype,"triangulatedMeasurementGraphic",void 0),e([S()],St.prototype,"triangulatedPoint",void 0),e([S()],St.prototype,"triangulatedMeasurementAdapter",void 0),e([S()],St.prototype,"updateFootprint",void 0),e([S()],St.prototype,"updateFootprintPanorama",void 0),e([S()],St.prototype,"updatingTriangularMeasurementState",void 0),e([S({value:null})],St.prototype,"view",null),e([S()],St.prototype,"videoElement",void 0),e([S()],St.prototype,"videoLayer",void 0),e([S()],St.prototype,"videoMapView",void 0),e([S()],St.prototype,"_adapter",void 0),e([S()],St.prototype,"_defaultGraphicsLayer",null),e([S()],St.prototype,"_highlightedFeatureHandle",void 0),e([S()],St.prototype,"_imageViewer",void 0),e([S()],St.prototype,"_initialCurrentCoverageUpdate",void 0),e([S()],St.prototype,"_locationPointOnImage",void 0),e([S()],St.prototype,"_measurementService",void 0),e([S()],St.prototype,"_correctedLocationPointOnImage",void 0),e([S()],St.prototype,"_overlays",void 0),e([S({readOnly:!0})],St.prototype,"_overlaysView",null),e([S()],St.prototype,"_panoramicVideoViewer",void 0),e([S()],St.prototype,"_panoramicViewer",void 0),e([S()],St.prototype,"_panoramicMeasurementViewer",void 0),e([S()],St.prototype,"_referencePointOnGround",void 0),e([S()],St.prototype,"_referencePointOnImage",void 0),e([S()],St.prototype,"_sectorData",void 0),e([S()],St.prototype,"_featureToSector",void 0),e([S({readOnly:!0})],St.prototype,"_updatingHandles",void 0),e([S()],St.prototype,"footprintExtent",void 0),e([S()],St.prototype,"_featureChangedTask",void 0),St=e([k("esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel")],St);const kt=St;export{kt as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import{watch as r,initial as l}from"../../core/reactiveUtils.js";import{property as i,subclass as a}from"../../core/accessorSupport/decorators.js";import{videoMetadataEntryId as s}from"../../layers/video/videoUtils.js";function o(e,t){const r={};for(const l of t){const t=e.get(l);t&&(r[t.name]=t.value)}return r}let y=class extends t{constructor(e){super(e),this.followingMode="follow-both",this.layer=null,this.seekLength=10,this.view=null}initialize(){this.addHandles([r(()=>this.layer,e=>{e&&e.load().then(()=>this._followTelemetry()).catch(()=>{})},l),r(()=>[this.followingMode],()=>this._followTelemetry(),l)])}get buffered(){return this.layer?.buffered||0}get currentTime(){return this.layer?.currentTime||0}get duration(){return this.layer?.duration||0}get ended(){return this.layer?.ended??!0}get metadata(){const e=this.layer?.metadata;return e?{missionInfo:o(e,[s.MissionId,s.PrecisionTimeStamp]),platformInfo:o(e,[s.PlatformTailNumber,s.PlatformTrueAirspeed,s.PlatformCallSign,s.PlatformDesignation,s.PlatformGroundRange]),frameInfo:o(e,[s.FrameCenterElevation,s.FrameCenterLatitude,s.FrameCenterLongitude])}:null}get playing(){return this.layer?.playing??!1}get state(){return this.layer?.loadError?"error":this.layer?.state??"not-ready"}play(){this.layer?.play()}pause(){this.layer?.pause()}seekBackward(){if(this.layer){const e=this.layer.currentTime-this.seekLength;e<=0?this.layer.reset():this.layer.setCurrentTime(e)}}seekForward(){if(this.layer){const e=this.layer.currentTime+this.seekLength;e>=this.layer.duration?this.layer.reset():this.layer.setCurrentTime(e)}}seekToBeginning(){this.layer?.setCurrentTime(0)}seekToEnding(){this.layer?.setCurrentTime(this.layer.duration)}seekTo(e){this.layer?.setCurrentTime(e)}toggleSensorDisplay(){this.layer?.telemetryDisplay&&(this.layer.telemetryDisplay.sensorLocation=!this.layer.telemetryDisplay.sensorLocation)}toggleSensorSightLineDisplay(){this.layer?.telemetryDisplay&&(this.layer.telemetryDisplay.lineOfSight=!this.layer.telemetryDisplay.lineOfSight)}toggleFrameDisplay(){this.layer?.telemetryDisplay&&(this.layer.telemetryDisplay.frame=!this.layer.telemetryDisplay.frame)}toggleSensorTrailDisplay(){this.layer?.telemetryDisplay&&(this.layer.telemetryDisplay.sensorTrail=!this.layer.telemetryDisplay.sensorTrail)}toggleFrameCenterDisplay(){this.layer?.telemetryDisplay&&(this.layer.telemetryDisplay.frameCenter=!this.layer.telemetryDisplay.frameCenter)}toggleFrameOutlineDisplay(){this.layer?.telemetryDisplay&&(this.layer.telemetryDisplay.frameOutline=!this.layer.telemetryDisplay.frameOutline)}changePlaybackSpeed(e){this.layer&&(this.layer.playbackRate=e)}changeGraphicsColor(e){e&&this.layer.updateTelemetryColor(e)}_followTelemetry(){this.removeHandles("follow"),this.view&&this.layer&&this.addHandles(r(()=>this.layer?.telemetry,()=>{const e=[],t="follow-sensor"===this.followingMode||"follow-both"===this.followingMode,r="follow-frame"===this.followingMode||"follow-both"===this.followingMode;t&&this.layer?.telemetry.sensorLocation&&e.push(this.layer.telemetry.sensorLocation),r&&this.layer?.telemetry.frameCenter&&e.push(this.layer.telemetry.frameCenter),e.length&&this.view?.goTo(e).catch(()=>{})},l),"follow")}};e([i({readOnly:!0})],y.prototype,"buffered",null),e([i({readOnly:!0})],y.prototype,"currentTime",null),e([i({readOnly:!0})],y.prototype,"duration",null),e([i({readOnly:!0})],y.prototype,"ended",null),e([i()],y.prototype,"followingMode",void 0),e([i()],y.prototype,"layer",void 0),e([i({readOnly:!0})],y.prototype,"metadata",null),e([i({readOnly:!0})],y.prototype,"playing",null),e([i()],y.prototype,"seekLength",void 0),e([i({readOnly:!0})],y.prototype,"state",null),e([i()],y.prototype,"view",void 0),y=e([a("esri.widgets.VideoPlayer.VideoPlayerViewModel")],y);const n=y;export{n as default};
5
+ import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import{watch as r,initial as l}from"../../core/reactiveUtils.js";import{property as i,subclass as a}from"../../core/accessorSupport/decorators.js";import{videoMetadataEntryId as s}from"../../layers/video/videoUtils.js";function o(e,t){const r={};for(const l of t){const t=e.get(l);t&&(r[t.name]=t.value)}return r}let y=class extends t{constructor(e){super(e),this.followingMode="follow-both",this.layer=null,this.seekLength=10,this.view=null}initialize(){this.addHandles([r(()=>this.layer,(e,t)=>{t&&t.pause(),e&&e.load().then(()=>this._followTelemetry()).catch(()=>{})},l),r(()=>[this.followingMode],()=>this._followTelemetry(),l)])}get buffered(){return this.layer?.buffered||0}get currentTime(){return this.layer?.currentTime||0}get duration(){return this.layer?.duration||0}get ended(){return this.layer?.ended??!0}get metadata(){const e=this.layer?.metadata;return e?{missionInfo:o(e,[s.MissionId,s.PrecisionTimeStamp]),platformInfo:o(e,[s.PlatformTailNumber,s.PlatformTrueAirspeed,s.PlatformCallSign,s.PlatformDesignation,s.PlatformGroundRange]),frameInfo:o(e,[s.FrameCenterElevation,s.FrameCenterLatitude,s.FrameCenterLongitude])}:null}get playing(){return this.layer?.playing??!1}get state(){return this.layer?.loadError?"error":this.layer?.state??"not-ready"}play(){this.layer?.play()}pause(){this.layer?.pause()}seekBackward(){if(this.layer){const e=this.layer.currentTime-this.seekLength;e<=0?this.layer.reset():this.layer.setCurrentTime(e)}}seekForward(){if(this.layer){const e=this.layer.currentTime+this.seekLength;e>=this.layer.duration?this.layer.reset():this.layer.setCurrentTime(e)}}seekToBeginning(){this.layer?.setCurrentTime(0)}seekToEnding(){this.layer?.setCurrentTime(this.layer.duration)}seekTo(e){this.layer?.setCurrentTime(e)}toggleSensorDisplay(){this.layer?.telemetryDisplay&&(this.layer.telemetryDisplay.sensorLocation=!this.layer.telemetryDisplay.sensorLocation)}toggleSensorSightLineDisplay(){this.layer?.telemetryDisplay&&(this.layer.telemetryDisplay.lineOfSight=!this.layer.telemetryDisplay.lineOfSight)}toggleFrameDisplay(){this.layer?.telemetryDisplay&&(this.layer.telemetryDisplay.frame=!this.layer.telemetryDisplay.frame)}toggleSensorTrailDisplay(){this.layer?.telemetryDisplay&&(this.layer.telemetryDisplay.sensorTrail=!this.layer.telemetryDisplay.sensorTrail)}toggleFrameCenterDisplay(){this.layer?.telemetryDisplay&&(this.layer.telemetryDisplay.frameCenter=!this.layer.telemetryDisplay.frameCenter)}toggleFrameOutlineDisplay(){this.layer?.telemetryDisplay&&(this.layer.telemetryDisplay.frameOutline=!this.layer.telemetryDisplay.frameOutline)}changePlaybackSpeed(e){this.layer&&(this.layer.playbackRate=e)}changeGraphicsColor(e){e&&this.layer.updateTelemetryColor(e)}_followTelemetry(){this.removeHandles("follow"),this.view&&this.layer&&this.addHandles(r(()=>this.layer?.telemetry,()=>{const e=[],t="follow-sensor"===this.followingMode||"follow-both"===this.followingMode,r="follow-frame"===this.followingMode||"follow-both"===this.followingMode;t&&this.layer?.telemetry.sensorLocation&&e.push(this.layer.telemetry.sensorLocation),r&&this.layer?.telemetry.frameCenter&&e.push(this.layer.telemetry.frameCenter),e.length?this.view?.goTo(e).catch(()=>{}):this.layer?.initialExtent&&this.view?.goTo(this.layer.initialExtent).catch(()=>{})},l),"follow")}};e([i({readOnly:!0})],y.prototype,"buffered",null),e([i({readOnly:!0})],y.prototype,"currentTime",null),e([i({readOnly:!0})],y.prototype,"duration",null),e([i({readOnly:!0})],y.prototype,"ended",null),e([i()],y.prototype,"followingMode",void 0),e([i()],y.prototype,"layer",void 0),e([i({readOnly:!0})],y.prototype,"metadata",null),e([i({readOnly:!0})],y.prototype,"playing",null),e([i()],y.prototype,"seekLength",void 0),e([i({readOnly:!0})],y.prototype,"state",null),e([i()],y.prototype,"view",void 0),y=e([a("esri.widgets.VideoPlayer.VideoPlayerViewModel")],y);const n=y;export{n as default};
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[506,647,3169,8125],{50647:(e,t,n)=>{n.r(t),n.d(t,{execute:()=>m,executeMany:()=>l,supportsCurves:()=>h});var r=n(4576),s=n(76061),o=n(55537);class a extends s.G{constructor(e,t,n){super(),this.m_index=-1,this.m_transformation=t.clone(),this.m_inputGeometryCursor=e}next(){let e;if(e=this.m_inputGeometryCursor.next()){(0,o.c)(e),this.m_index=this.m_inputGeometryCursor.getGeometryID();const t=e.clone();return t.applyTransformation(this.m_transformation),t}return null}getGeometryID(){return this.m_index}tock(){return!0}getRank(){return 1}}const u=new class{getOperatorType(){return 10303}supportsCurves(){return!0}accelerateGeometry(e,t,n){return!1}canAccelerateGeometry(e){return!1}executeMany(e,t,n){return new a(e,t,n)}execute(e,t,n){const r=e.clone();return r.applyTransformation(t),r}};function i(e,t){return u.execute(e,t,null)}var c=n(78125);function m(e,t){const n=(0,c.getSpatialReference)(e);return(0,c.toGeometry)(i((0,c.fromGeometry)(e),t.transform),n)}function l(e,t){const n=e.map(c.fromGeometry),o=(0,c.getSpatialReference)(e);return function(e,t){const n=u.executeMany(new s.S(e),t,null);return Array.from(n)}(n,t.transform).map(e=>(0,c.toGeometry)(e,o)).filter(r.Ru)}const h=u.supportsCurves()},76061:(e,t,n)=>{n.d(t,{G:()=>r,S:()=>s});class r{*[Symbol.iterator](){let e=this.next();for(;e;)yield e,e=this.next()}}class s extends r{constructor(e){super(),this.m_iGeom=-1,this.m_aGeoms=e?e.slice():[]}next(){if(this.m_iGeom<this.m_aGeoms.length-1){const e=this.m_aGeoms[++this.m_iGeom];return this.m_aGeoms[this.m_iGeom]=null,e}return null}tock(){return!1}getGeometryID(){return this.m_iGeom}getRank(){return 1}}},78125:(e,t,n)=>{n.r(t),n.d(t,{fromExtent:()=>C,fromGeometry:()=>G,fromMultipoint:()=>M,fromPoint:()=>w,fromPolygon:()=>V,fromPolyline:()=>v,fromSpatialReference:()=>R,getSpatialReference:()=>x,toExtent:()=>P,toGeometry:()=>d,toMultipoint:()=>_,toPoint:()=>Z,toPolygon:()=>k,toPolyline:()=>A});var r=n(83661),s=(n(79187),n(55537)),o=n(95213),a=n(88885),u=n(39117),i=n(5443),c=n(48526),m=n(86738),l=n(39829),h=n(82799),f=(n(90293),n(83299));const p="_gxVersion",y=2,g=1;function x(e){return Array.isArray(e)?e[0].spatialReference:e.spatialReference}function G(e){switch(e.type){case"point":return w(e);case"multipoint":return M(e);case"polyline":return v(e);case"polygon":return V(e);case"extent":return C(e);default:throw new Error(`Unsupported geometry type: ${e.type}`)}}function C(e){if(!e.getCacheValue(p)){const t=new o.E;t.setCoords(e.xmin,e.ymin,e.xmax,e.ymax),e.hasM&&t.setInterval(y,0,e.mmin,e.mmax),e.hasZ&&t.setInterval(g,0,e.zmin,e.zmax),e.setCacheValue(p,t)}return e.getCacheValue(p)}function M(e){if(!e.getCacheValue(p)){const t=new a.M,n=new o.P,r=e.points,s=e.hasM,u=e.hasZ,i=u?3:2;for(let e=0,o=r.length;e<o;e++){const o=r[e];n.setXYCoords(o[0],o[1]),u&&n.setZ(o[2]??0),s&&n.setM(o[i]??NaN),t.add(n)}e.setCacheValue(p,t)}return e.getCacheValue(p)}function w(e){if(!e.getCacheValue(p)){const t=new o.P;t.setXYCoords(e.x,e.y),e.hasM&&t.setM(e.m),e.hasZ&&t.setZ(e.z),e.setCacheValue(p,t)}return e.getCacheValue(p)}function V(e){if(!e.getCacheValue(p)){const{curveRings:t,hasM:n,hasZ:r,rings:s}=e,o=(0,f.fromGeometryToGXGeometry)({curveRings:t,hasM:n,hasZ:r,rings:s});e.setCacheValue(p,o)}return e.getCacheValue(p)}function v(e){if(!e.getCacheValue(p)){const{curvePaths:t,hasM:n,hasZ:r,paths:s}=e,o=(0,f.fromGeometryToGXGeometry)({curvePaths:t,hasM:n,hasZ:r,paths:s});e.setCacheValue(p,o)}return e.getCacheValue(p)}function R(e){if(e.wkid)return(0,u.c)(e.wkid);const t=e.wkt2||e.wkt;return t?(0,u.b)(t):null}function d(e,t){if(e)switch(e.getGeometryType()){case s.G.enumPoint:return Z(e,t);case s.G.enumEnvelope:return P(e,t);case s.G.enumMultiPoint:return _(e,t);case s.G.enumPolyline:return A(e,t);case s.G.enumPolygon:return k(e,t)}return null}function P(e,t){if(e.isEmpty())return null;const n=new i.A({xmin:e.getXMin(),ymin:e.getYMin(),xmax:e.getXMax(),ymax:e.getYMax(),spatialReference:t}),r=e.getDescription();if(r.hasM()){const t=e.queryInterval(y,0);n.mmin=t.vmin,n.mmax=t.vmax}if(r.hasZ()){const t=e.queryInterval(g,0);n.zmin=t.vmin,n.zmax=t.vmax}return n.setCacheValue(p,e),n}function _(e,t){if(e.isEmpty())return null;const n=e.getDescription(),r=n.hasM(),s=n.hasZ(),a=[],u=new o.P;for(let t=0,n=e.getPointCount();t<n;t++){e.getPointByVal(t,u);const n=[u.getX(),u.getY()];s&&n.push(u.getZ()),r&&n.push(u.getM()),a.push(n)}const i=new c.A({hasM:r,hasZ:s,points:a,spatialReference:t});return i.setCacheValue(p,e),i}function Z(e,t){if(e instanceof r.P)return new m.A({x:e.x,y:e.y,spatialReference:t});if(e.isEmpty())return null;const n=new m.A({x:e.getX(),y:e.getY(),spatialReference:t}),s=e.getDescription();return s.hasM()&&(n.m=e.getM()),s.hasZ()&&(n.z=e.getZ()),n.setCacheValue(p,e),n}function k(e,t){if(e.isEmpty())return null;const n=l.A.fromJSON({spatialReference:t,...(0,f.toGeometry)(e,null)});return n.setCacheValue(p,e),n}function A(e,t){if(e.isEmpty())return null;const n=h.A.fromJSON({spatialReference:t,...(0,f.toGeometry)(e,null)});return n.setCacheValue(p,e),n}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[353],{12189:(e,t,r)=>{r.r(t),r.d(t,{ProjectionTransformation:()=>s.P,create:()=>s.v,createEx:()=>s.x,createFromAoi:()=>s.y,createImplEx:()=>s.z,makeExtendedParams:()=>s.A,makeExtendedParamsInternal:()=>s.B,queryTransformationList:()=>s.C}),r(79187),r(55537);var s=r(39117);r(83661)},76061:(e,t,r)=>{r.d(t,{G:()=>s,S:()=>m});class s{*[Symbol.iterator](){let e=this.next();for(;e;)yield e,e=this.next()}}class m extends s{constructor(e){super(),this.m_iGeom=-1,this.m_aGeoms=e?e.slice():[]}next(){if(this.m_iGeom<this.m_aGeoms.length-1){const e=this.m_aGeoms[++this.m_iGeom];return this.m_aGeoms[this.m_iGeom]=null,e}return null}tock(){return!1}getGeometryID(){return this.m_iGeom}getRank(){return 1}}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[5367],{11053:(a,r,t)=>{t.d(r,{c:()=>e,g:()=>n});var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}},15367:(a,r,t)=>{t.r(r),t.d(r,{a:()=>s});var e,n=t(11053),o={exports:{}};const i=(0,n.g)(function(){return e||(e=1,a=o,r="undefined"!=typeof document?document.currentScript?.src:void 0,t=async function(a={}){var t,e=a,n="./this.program",o="";try{o=new URL(".",r).href}catch{}t=async a=>{if((a=await fetch(a,{credentials:"same-origin"})).ok)return a.arrayBuffer();throw Error(a.status+" : "+a.url)};var i,s,u,f,l,h,c,w,d,p,v,m,b,y,g,$,A=console.log.bind(console),C=console.error.bind(console),k=!1,E=!1;function x(){var a=l.buffer;h=new Int8Array(a),w=new Int16Array(a),c=new Uint8Array(a),d=new Uint16Array(a),p=new Int32Array(a),v=new Uint32Array(a),m=new Float32Array(a),b=new Float64Array(a),y=new BigInt64Array(a),g=new BigUint64Array(a)}function O(a){throw e.onAbort?.(a),C(a="Aborted("+a+")"),k=!0,a=new WebAssembly.RuntimeError(a+". Build with -sASSERTIONS for more info."),f?.(a),a}async function S(a){if(!i)try{var r=await t(a);return new Uint8Array(r)}catch{}if(a!=$||!i)throw"both async and sync fetching of the wasm failed";return new Uint8Array(i)}class P{name="ExitStatus";constructor(a){this.message=`Program terminated with exit(${a})`,this.status=a}}var j=a=>{for(;0<a.length;)a.shift()(e)},D=[],R=[],T=()=>{var a=e.preRun.shift();R.push(a)},q=!0;class I{constructor(a){this.ra=a-24}}var B={},M=a=>{for(;a.length;){var r=a.pop();a.pop()(r)}};function z(a){return this.sa(v[a>>2])}var U={},N={},F={},L=class extends Error{constructor(a){super(a),this.name="InternalError"}},W=(a,r,t)=>{function e(r){if((r=t(r)).length!==a.length)throw new L("Mismatched type converter count");for(var e=0;e<a.length;++e)G(a[e],r[e])}a.forEach(a=>F[a]=r);var n=Array(r.length),o=[],i=0;r.forEach((a,r)=>{N.hasOwnProperty(a)?n[r]=N[a]:(o.push(a),U.hasOwnProperty(a)||(U[a]=[]),U[a].push(()=>{n[r]=N[a],++i===o.length&&e(n)}))}),0===o.length&&e(n)},_=a=>{for(var r="";;){var t=c[a++];if(!t)return r;r+=String.fromCharCode(t)}},H=class extends Error{constructor(a){super(a),this.name="BindingError"}};function G(a,r,t={}){return function(a,r,t={}){var e=r.name;if(!a)throw new H(`type "${e}" must have a positive integer typeid pointer`);if(N.hasOwnProperty(a)){if(t.Mb)return;throw new H(`Cannot register type '${e}' twice`)}N[a]=r,delete F[a],U.hasOwnProperty(a)&&(r=U[a],delete U[a],r.forEach(a=>a()))}(a,r,t)}var J=(a,r,t)=>{switch(r){case 1:return t?a=>h[a]:a=>c[a];case 2:return t?a=>w[a>>1]:a=>d[a>>1];case 4:return t?a=>p[a>>2]:a=>v[a>>2];case 8:return t?a=>y[a>>3]:a=>g[a>>3];default:throw new TypeError(`invalid integer width (${r}): ${a}`)}},K=a=>{throw new H(a.ma.ta.na.name+" instance already deleted")},V=!1,Q=()=>{},Y=a=>"undefined"==typeof FinalizationRegistry?(Y=a=>a,a):(V=new FinalizationRegistry(a=>{--(a=a.ma).count.value,0===a.count.value&&(a.xa?a.Ba.Ha(a.xa):a.ta.na.Ha(a.ra))}),Q=a=>{V.unregister(a)},(Y=a=>{var r=a.ma;return r.xa&&V.register(a,{ma:r},a),a})(a));function X(){}var Z=(a,r)=>Object.defineProperty(r,"name",{value:a}),aa={},ra=(a,r,t)=>{if(void 0===a[r].ua){var e=a[r];a[r]=function(...e){if(!a[r].ua.hasOwnProperty(e.length))throw new H(`Function '${t}' called with an invalid number of arguments (${e.length}) - expects one of (${a[r].ua})!`);return a[r].ua[e.length].apply(this,e)},a[r].ua=[],a[r].ua[e.Ma]=e}},ta=(a,r,t)=>{if(e.hasOwnProperty(a)){if(void 0===t||void 0!==e[a].ua&&void 0!==e[a].ua[t])throw new H(`Cannot register public name '${a}' twice`);if(ra(e,a,a),e[a].ua.hasOwnProperty(t))throw new H(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`);e[a].ua[t]=r}else e[a]=r,e[a].Ma=t};function ea(a,r,t,e,n,o,i,s){this.name=a,this.constructor=r,this.La=t,this.Ha=e,this.ya=n,this.Hb=o,this.Xa=i,this.Fb=s,this.Sb=[]}var na=(a,r,t)=>{for(;r!==t;){if(!r.Xa)throw new H(`Expected null or instance of ${t.name}, got an instance of ${r.name}`);a=r.Xa(a),r=r.ya}return a},oa=a=>{if(null===a)return"null";var r=typeof a;return"object"===r||"array"===r||"function"===r?a.toString():""+a};function ia(a,r){if(null===r){if(this.lb)throw new H(`null is not a valid ${this.name}`);return 0}if(!r.ma)throw new H(`Cannot pass "${oa(r)}" as a ${this.name}`);if(!r.ma.ra)throw new H(`Cannot pass deleted object as a pointer of type ${this.name}`);return na(r.ma.ra,r.ma.ta.na,this.na)}function sa(a,r){if(null===r){if(this.lb)throw new H(`null is not a valid ${this.name}`);if(this.ab){var t=this.nb();return null!==a&&a.push(this.Ha,t),t}return 0}if(!r||!r.ma)throw new H(`Cannot pass "${oa(r)}" as a ${this.name}`);if(!r.ma.ra)throw new H(`Cannot pass deleted object as a pointer of type ${this.name}`);if(!this.$a&&r.ma.ta.$a)throw new H(`Cannot convert argument of type ${r.ma.Ba?r.ma.Ba.name:r.ma.ta.name} to parameter type ${this.name}`);if(t=na(r.ma.ra,r.ma.ta.na,this.na),this.ab){if(void 0===r.ma.xa)throw new H("Passing raw pointer to smart pointer is illegal");switch(this.Xb){case 0:if(r.ma.Ba!==this)throw new H(`Cannot convert argument of type ${r.ma.Ba?r.ma.Ba.name:r.ma.ta.name} to parameter type ${this.name}`);t=r.ma.xa;break;case 1:t=r.ma.xa;break;case 2:if(r.ma.Ba===this)t=r.ma.xa;else{var e=r.clone();t=this.Tb(t,Sa(()=>e.delete())),null!==a&&a.push(this.Ha,t)}break;default:throw new H("Unsupporting sharing policy")}}return t}function ua(a,r){if(null===r){if(this.lb)throw new H(`null is not a valid ${this.name}`);return 0}if(!r.ma)throw new H(`Cannot pass "${oa(r)}" as a ${this.name}`);if(!r.ma.ra)throw new H(`Cannot pass deleted object as a pointer of type ${this.name}`);if(r.ma.ta.$a)throw new H(`Cannot convert argument of type ${r.ma.ta.name} to parameter type ${this.name}`);return na(r.ma.ra,r.ma.ta.na,this.na)}var fa=(a,r,t)=>r===t?a:void 0===t.ya||null===(a=fa(a,r,t.ya))?null:t.Fb(a),la={},ha=(a,r)=>{if(!r.ta||!r.ra)throw new L("makeClassHandle requires ptr and ptrType");if(!!r.Ba!=!!r.xa)throw new L("Both smartPtrType and smartPtr must be specified");return r.count={value:1},Y(Object.create(a,{ma:{value:r,writable:!0}}))};function ca(a,r,t,e,n,o,i,s,u,f,l){this.name=a,this.na=r,this.lb=t,this.$a=e,this.ab=n,this.Rb=o,this.Xb=i,this.yb=s,this.nb=u,this.Tb=f,this.Ha=l,n||void 0!==r.ya?this.wa=sa:(this.wa=e?ia:ua,this.Aa=null)}var wa,da=(a,r,t)=>{if(!e.hasOwnProperty(a))throw new L("Replacing nonexistent public symbol");void 0!==e[a].ua&&void 0!==t?e[a].ua[t]=r:(e[a]=r,e[a].Ma=t)},pa=[],va=(a,r)=>{var t;if(a=_(a),(t=pa[r])||(pa[r]=t=wa.get(r)),"function"!=typeof t)throw new H(`unknown function pointer with signature ${a}: ${r}`);return t};class ma extends Error{}var ba=a=>{a=Yr(a);var r=_(a);return Zr(a),r},ya=(a,r)=>{var t=[],e={};throw r.forEach(function a(r){e[r]||N[r]||(F[r]?F[r].forEach(a):(t.push(r),e[r]=!0))}),new ma(`${a}: `+t.map(ba).join([", "]))};function ga(a,r,t,e,n){var o=r.length;if(2>o)throw new H("argTypes array size mismatch! Must at least get return value and 'this' types!");var i=null!==r[1]&&null!==t,s=function(a){for(var r=1;r<a.length;++r)if(null!==a[r]&&void 0===a[r].Aa)return!0;return!1}(r),u=!r[0].Nb,f=o-2,l=Array(f),h=[],c=[];return Z(a,function(...a){if(c.length=0,h.length=i?2:1,h[0]=n,i){var t=r[1].wa(c,this);h[1]=t}for(var o=0;o<f;++o)l[o]=r[o+2].wa(c,a[o]),h.push(l[o]);if(a=e(...h),s)M(c);else for(o=i?1:2;o<r.length;o++){var w=1===o?t:l[o-2];null!==r[o].Aa&&r[o].Aa(w)}return u?r[0].sa(a):void 0})}var $a=(a,r)=>{for(var t=[],e=0;e<a;e++)t.push(v[r+4*e>>2]);return t},Aa=a=>{const r=(a=a.trim()).indexOf("(");return-1===r?a:a.slice(0,r)},Ca=(a,r,t)=>{if(!(a instanceof Object))throw new H(`${t} with invalid "this": ${a}`);if(!(a instanceof r.na.constructor))throw new H(`${t} incompatible with "this" of type ${a.constructor.name}`);if(!a.ma.ra)throw new H(`cannot call emscripten binding method ${t} on deleted object`);return na(a.ma.ra,a.ma.ta.na,r.na)},ka=[],Ea=[0,1,,1,null,1,!0,1,!1,1],xa=a=>{9<a&&0===--Ea[a+1]&&(Ea[a]=void 0,ka.push(a))},Oa=a=>{if(!a)throw new H(`Cannot use deleted val. handle = ${a}`);return Ea[a]},Sa=a=>{switch(a){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:const r=ka.pop()||Ea.length;return Ea[r]=a,Ea[r+1]=1,r}},Pa={name:"emscripten::val",sa:a=>{var r=Oa(a);return xa(a),r},wa:(a,r)=>Sa(r),Ea:z,Aa:null},ja=(a,r,t)=>{switch(r){case 1:return t?function(a){return this.sa(h[a])}:function(a){return this.sa(c[a])};case 2:return t?function(a){return this.sa(w[a>>1])}:function(a){return this.sa(d[a>>1])};case 4:return t?function(a){return this.sa(p[a>>2])}:function(a){return this.sa(v[a>>2])};default:throw new TypeError(`invalid integer width (${r}): ${a}`)}},Da=(a,r)=>{var t=N[a];if(void 0===t)throw a=`${r} has unknown type ${ba(a)}`,new H(a);return t},Ra=(a,r)=>{switch(r){case 4:return function(a){return this.sa(m[a>>2])};case 8:return function(a){return this.sa(b[a>>3])};default:throw new TypeError(`invalid float width (${r}): ${a}`)}},Ta=Object.assign({optional:!0},Pa),qa=(a,r,t,e)=>{if(!(0<e))return 0;var n=t;e=t+e-1;for(var o=0;o<a.length;++o){var i=a.codePointAt(o);if(127>=i){if(t>=e)break;r[t++]=i}else if(2047>=i){if(t+1>=e)break;r[t++]=192|i>>6,r[t++]=128|63&i}else if(65535>=i){if(t+2>=e)break;r[t++]=224|i>>12,r[t++]=128|i>>6&63,r[t++]=128|63&i}else{if(t+3>=e)break;r[t++]=240|i>>18,r[t++]=128|i>>12&63,r[t++]=128|i>>6&63,r[t++]=128|63&i,o++}}return r[t]=0,t-n},Ia=a=>{for(var r=0,t=0;t<a.length;++t){var e=a.charCodeAt(t);127>=e?r++:2047>=e?r+=2:55296<=e&&57343>=e?(r+=4,++t):r+=3}return r},Ba="undefined"!=typeof TextDecoder?new TextDecoder:void 0,Ma=(a,r,t,e)=>{if(t=r+t,e)return t;for(;a[r]&&!(r>=t);)++r;return r},za=(a,r=0,t,e)=>{if(16<(t=Ma(a,r,t,e))-r&&a.buffer&&Ba)return Ba.decode(a.subarray(r,t));for(e="";r<t;){var n=a[r++];if(128&n){var o=63&a[r++];if(192==(224&n))e+=String.fromCharCode((31&n)<<6|o);else{var i=63&a[r++];65536>(n=224==(240&n)?(15&n)<<12|o<<6|i:(7&n)<<18|o<<12|i<<6|63&a[r++])?e+=String.fromCharCode(n):(n-=65536,e+=String.fromCharCode(55296|n>>10,56320|1023&n))}}else e+=String.fromCharCode(n)}return e},Ua="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,Na=(a,r,t)=>{if(16<(r=Ma(d,a>>=1,r/2,t))-a&&Ua)return Ua.decode(d.subarray(a,r));for(t="";a<r;++a)t+=String.fromCharCode(d[a]);return t},Fa=(a,r,t)=>{if(t??=2147483647,2>t)return 0;var e=r;t=(t-=2)<2*a.length?t/2:a.length;for(var n=0;n<t;++n)w[r>>1]=a.charCodeAt(n),r+=2;return w[r>>1]=0,r-e},La=a=>2*a.length,Wa=(a,r,t)=>{var e="";a>>=2;for(var n=0;!(n>=r/4);n++){var o=v[a+n];if(!o&&!t)break;e+=String.fromCodePoint(o)}return e},_a=(a,r,t)=>{if(t??=2147483647,4>t)return 0;var e=r;t=e+t-4;for(var n=0;n<a.length;++n){var o=a.codePointAt(n);if(65535<o&&n++,p[r>>2]=o,(r+=4)+4>t)break}return p[r>>2]=0,r-e},Ha=a=>{for(var r=0,t=0;t<a.length;++t)65535<a.codePointAt(t)&&t++,r+=4;return r},Ga=0,Ja=[],Ka={},Va=a=>{var r=Ka[a];return void 0===r?_(a):r},Qa=globalThis,Ya=(a,r,t,e,n)=>Ja[a](r,t,e,n),Xa=(a,r)=>{for(var t=0,e=a.length-1;0<=e;e--){var n=a[e];"."===n?a.splice(e,1):".."===n?(a.splice(e,1),t++):t&&(a.splice(e,1),t--)}if(r)for(;t;t--)a.unshift("..");return a},Za=a=>{var r="/"===a.charAt(0),t="/"===a.slice(-1);return(a=Xa(a.split("/").filter(a=>!!a),!r).join("/"))||r||(a="."),a&&t&&(a+="/"),(r?"/":"")+a},ar=a=>{var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);return a=r[0],r=r[1],a||r?(r&&=r.slice(0,-1),a+r):"."},rr=a=>{(rr=a=>crypto.getRandomValues(a))(a)},tr=[],er=[];function nr(a,r){er[a]={input:[],output:[],Ra:r},jr(a,or)}var or={open(a){var r=er[a.node.fb];if(!r)throw new mr(43);a.Ca=r,a.seekable=!1},close(a){a.Ca.Ra.Za(a.Ca)},Za(a){a.Ca.Ra.Za(a.Ca)},read(a,r,t,e){if(!a.Ca||!a.Ca.Ra.sb)throw new mr(60);for(var n=0,o=0;o<e;o++){try{var i=a.Ca.Ra.sb(a.Ca)}catch(a){throw new mr(29)}if(void 0===i&&0===n)throw new mr(6);if(null==i)break;n++,r[t+o]=i}return n&&(a.node.Na=Date.now()),n},write(a,r,t,e){if(!a.Ca||!a.Ca.Ra.mb)throw new mr(60);try{for(var n=0;n<e;n++)a.Ca.Ra.mb(a.Ca,r[t+n])}catch(a){throw new mr(29)}return e&&(a.node.Da=a.node.za=Date.now()),n}},ir={sb(){a:{if(!tr.length){var a=null;if("undefined"!=typeof window&&"function"==typeof window.prompt&&null!==(a=window.prompt("Input: "))&&(a+="\n"),!a){var r=null;break a}r=Array(Ia(a)+1),a=qa(a,r,0,r.length),r.length=a,tr=r}r=tr.shift()}return r},mb(a,r){null===r||10===r?(A(za(a.output)),a.output=[]):0!=r&&a.output.push(r)},Za(a){0<a.output?.length&&(A(za(a.output)),a.output=[])},lc:()=>({cc:25856,ec:5,bc:191,dc:35387,ac:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),mc:()=>0,nc:()=>[24,80]},sr={mb(a,r){null===r||10===r?(C(za(a.output)),a.output=[]):0!=r&&a.output.push(r)},Za(a){0<a.output?.length&&(C(za(a.output)),a.output=[])}},ur={Ga:null,Ja:()=>ur.createNode(null,"/",16895,0),createNode(a,r,t,e){if(24576==(61440&t)||4096==(61440&t))throw new mr(63);return ur.Ga||(ur.Ga={dir:{node:{Ka:ur.pa.Ka,Ia:ur.pa.Ia,Ua:ur.pa.Ua,cb:ur.pa.cb,zb:ur.pa.zb,Cb:ur.pa.Cb,Bb:ur.pa.Bb,ob:ur.pa.ob,gb:ur.pa.gb},stream:{Fa:ur.qa.Fa}},file:{node:{Ka:ur.pa.Ka,Ia:ur.pa.Ia},stream:{Fa:ur.qa.Fa,read:ur.qa.read,write:ur.qa.write,vb:ur.qa.vb,xb:ur.qa.xb}},link:{node:{Ka:ur.pa.Ka,Ia:ur.pa.Ia,Wa:ur.pa.Wa},stream:{}},pb:{node:{Ka:ur.pa.Ka,Ia:ur.pa.Ia},stream:Pr}}),16384==(61440&(t=Cr(a,r,t,e)).mode)?(t.pa=ur.Ga.dir.node,t.qa=ur.Ga.dir.stream,t.oa={}):32768==(61440&t.mode)?(t.pa=ur.Ga.file.node,t.qa=ur.Ga.file.stream,t.va=0,t.oa=null):40960==(61440&t.mode)?(t.pa=ur.Ga.link.node,t.qa=ur.Ga.link.stream):8192==(61440&t.mode)&&(t.pa=ur.Ga.pb.node,t.qa=ur.Ga.pb.stream),t.Na=t.Da=t.za=Date.now(),a&&(a.oa[r]=t,a.Na=a.Da=a.za=t.Na),t},ic:a=>a.oa?a.oa.subarray?a.oa.subarray(0,a.va):new Uint8Array(a.oa):new Uint8Array(0),pa:{Ka(a){var r={};return r.fc=8192==(61440&a.mode)?a.id:1,r.kc=a.id,r.mode=a.mode,r.oc=1,r.uid=0,r.jc=0,r.fb=a.fb,16384==(61440&a.mode)?r.size=4096:32768==(61440&a.mode)?r.size=a.va:40960==(61440&a.mode)?r.size=a.link.length:r.size=0,r.Na=new Date(a.Na),r.Da=new Date(a.Da),r.za=new Date(a.za),r.Db=4096,r.$b=Math.ceil(r.size/r.Db),r},Ia(a,r){for(var t of["mode","atime","mtime","ctime"])null!=r[t]&&(a[t]=r[t]);void 0!==r.size&&(r=r.size,a.va!=r&&(0==r?(a.oa=null,a.va=0):(t=a.oa,a.oa=new Uint8Array(r),t&&a.oa.set(t.subarray(0,Math.min(r,a.va))),a.va=r)))},Ua(){throw ur.hb||(ur.hb=new mr(44),ur.hb.stack="<generic error, no stack>"),ur.hb},cb:(a,r,t,e)=>ur.createNode(a,r,t,e),zb(a,r,t){try{var e=Ar(r,t)}catch(a){}if(e){if(16384==(61440&a.mode))for(var n in e.oa)throw new mr(55);if(n=$r(e.parent.id,e.name),wr[n]===e)wr[n]=e.Qa;else for(n=wr[n];n;){if(n.Qa===e){n.Qa=e.Qa;break}n=n.Qa}}delete a.parent.oa[a.name],r.oa[t]=a,a.name=t,r.za=r.Da=a.parent.za=a.parent.Da=Date.now()},Cb(a,r){delete a.oa[r],a.za=a.Da=Date.now()},Bb(a,r){var t,e=Ar(a,r);for(t in e.oa)throw new mr(55);delete a.oa[r],a.za=a.Da=Date.now()},ob:a=>[".","..",...Object.keys(a.oa)],gb:(a,r,t)=>((a=ur.createNode(a,r,41471,0)).link=t,a),Wa(a){if(40960!=(61440&a.mode))throw new mr(28);return a.link}},qa:{read(a,r,t,e,n){var o=a.node.oa;if(n>=a.node.va)return 0;if(8<(a=Math.min(a.node.va-n,e))&&o.subarray)r.set(o.subarray(n,n+a),t);else for(e=0;e<a;e++)r[t+e]=o[n+e];return a},write(a,r,t,e,n,o){if(r.buffer===h.buffer&&(o=!1),!e)return 0;if((a=a.node).Da=a.za=Date.now(),r.subarray&&(!a.oa||a.oa.subarray)){if(o)return a.oa=r.subarray(t,t+e),a.va=e;if(0===a.va&&0===n)return a.oa=r.slice(t,t+e),a.va=e;if(n+e<=a.va)return a.oa.set(r.subarray(t,t+e),n),e}o=n+e;var i=a.oa?a.oa.length:0;if(i>=o||(o=Math.max(o,i*(1048576>i?2:1.125)>>>0),0!=i&&(o=Math.max(o,256)),i=a.oa,a.oa=new Uint8Array(o),0<a.va&&a.oa.set(i.subarray(0,a.va),0)),a.oa.subarray&&r.subarray)a.oa.set(r.subarray(t,t+e),n);else for(o=0;o<e;o++)a.oa[n+o]=r[t+o];return a.va=Math.max(a.va,n+e),e},Fa(a,r,t){if(1===t?r+=a.position:2===t&&32768==(61440&a.node.mode)&&(r+=a.node.va),0>r)throw new mr(28);return r},vb(a,r,t,e,n){if(32768!=(61440&a.node.mode))throw new mr(43);if(a=a.node.oa,2&n||!a||a.buffer!==h.buffer){n=!0,e=65536*Math.ceil(r/65536);var o=at(65536,e);if(o&&c.fill(0,o,o+e),!(e=o))throw new mr(48);a&&((0<t||t+r<a.length)&&(a=a.subarray?a.subarray(t,t+r):Array.prototype.slice.call(a,t,t+r)),h.set(a,e))}else n=!1,e=a.byteOffset;return{ra:e,Zb:n}},xb:(a,r,t,e)=>(ur.qa.write(a,r,0,e,t,!1),0)}},fr=null,lr={},hr=[],cr=1,wr=null,dr=!1,pr=!0,vr={},mr=class{name="ErrnoError";constructor(a){this.Ta=a}},br=class{bb={};node=null;get flags(){return this.bb.flags}set flags(a){this.bb.flags=a}get position(){return this.bb.position}set position(a){this.bb.position=a}},yr=class{pa={};qa={};eb=null;constructor(a,r,t,e){a||=this,this.parent=a,this.Ja=a.Ja,this.id=cr++,this.name=r,this.mode=t,this.fb=e,this.Na=this.Da=this.za=Date.now()}get read(){return!(365&~this.mode)}set read(a){a?this.mode|=365:this.mode&=-366}get write(){return!(146&~this.mode)}set write(a){a?this.mode|=146:this.mode&=-147}};function gr(a,r={}){if(!a)throw new mr(44);r.jb??(r.jb=!0),"/"===a.charAt(0)||(a="//"+a);var t=0;a:for(;40>t;t++){a=a.split("/").filter(a=>!!a);for(var e=fr,n="/",o=0;o<a.length;o++){var i=o===a.length-1;if(i&&r.parent)break;if("."!==a[o])if(".."===a[o]){if(n=ar(n),e===e.parent){a=n+"/"+a.slice(o+1).join("/"),t--;continue a}e=e.parent}else{n=Za(n+"/"+a[o]);try{e=Ar(e,a[o])}catch(a){if(44===a?.Ta&&i&&r.Qb)return{path:n};throw a}if(!e.eb||i&&!r.jb||(e=e.eb.root),40960==(61440&e.mode)&&(!i||r.ib)){if(!e.pa.Wa)throw new mr(52);"/"===(e=e.pa.Wa(e)).charAt(0)||(e=ar(n)+"/"+e),a=e+"/"+a.slice(o+1).join("/");continue a}}}return{path:n,node:e}}throw new mr(32)}function $r(a,r){for(var t=0,e=0;e<r.length;e++)t=(t<<5)-t+r.charCodeAt(e)|0;return(a+t>>>0)%wr.length}function Ar(a,r){var t=16384==(61440&a.mode)?(t=Er(a,"x"))?t:a.pa.Ua?0:2:54;if(t)throw new mr(t);for(t=wr[$r(a.id,r)];t;t=t.Qa){var e=t.name;if(t.parent.id===a.id&&e===r)return t}return a.pa.Ua(a,r)}function Cr(a,r,t,e){return r=$r((a=new yr(a,r,t,e)).parent.id,a.name),a.Qa=wr[r],wr[r]=a}function kr(a){var r=["r","w","rw"][3&a];return 512&a&&(r+="w"),r}function Er(a,r){return pr?0:!r.includes("r")||292&a.mode?r.includes("w")&&!(146&a.mode)||r.includes("x")&&!(73&a.mode)?2:0:2}function xr(a,r){if(16384!=(61440&a.mode))return 54;try{return Ar(a,r),20}catch(a){}return Er(a,"wx")}function Or(a){if(!(a=hr[a]))throw new mr(8);return a}function Sr(a,r){var t=void 0,e=t?null:a;if(t??=a.pa.Ia,!t)throw new mr(63);t(e,r)}var Pr={open(a){a.qa=lr[a.node.fb].qa,a.qa.open?.(a)},Fa(){throw new mr(70)}};function jr(a,r){lr[a]={qa:r}}function Dr(a,r){var t="/"===r;if(t&&fr)throw new mr(10);if(!t&&r){var e=gr(r,{jb:!1});if(r=e.path,(e=e.node).eb)throw new mr(10);if(16384!=(61440&e.mode))throw new mr(54)}r={type:a,pc:{},wb:r,Pb:[]},(a=a.Ja(r)).Ja=r,r.root=a,t?fr=a:e&&(e.eb=r,e.Ja&&e.Ja.Pb.push(r))}function Rr(a,r,t){var e=gr(a,{parent:!0}).node;if(!(a=a&&a.match(/([^\/]+|\/)\/*$/)[1]))throw new mr(28);if("."===a||".."===a)throw new mr(20);var n=xr(e,a);if(n)throw new mr(n);if(!e.pa.cb)throw new mr(63);return e.pa.cb(e,a,r,t)}function Tr(a){return Rr(a,16895,0)}function qr(a,r,t){void 0===t&&(t=r,r=438),Rr(a,8192|r,t)}function Ir(a,r){if(!((...a)=>{for(var r="",t=!1,e=a.length-1;-1<=e&&!t;e--){if("string"!=typeof(t=0<=e?a[e]:"/"))throw new TypeError("Arguments to path.resolve must be strings");if(!t)return"";r=t+"/"+r,t="/"===t.charAt(0)}return(t?"/":"")+(r=Xa(r.split("/").filter(a=>!!a),!t).join("/"))||"."})(a))throw new mr(44);var t=gr(r,{parent:!0}).node;if(!t)throw new mr(44);var e=xr(t,r=r&&r.match(/([^\/]+|\/)\/*$/)[1]);if(e)throw new mr(e);if(!t.pa.gb)throw new mr(63);t.pa.gb(t,r,a)}function Br(a,r){if(""===a)throw new mr(44);if("string"==typeof r){var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[r];if(void 0===t)throw Error(`Unknown file open mode: ${r}`);r=t}if(t=64&r?33206:0,"object"==typeof a)var n=a;else{var o=a.endsWith("/");n=(a=gr(a,{ib:!(131072&r),Qb:!0})).node,a=a.path}var i=!1;if(64&r)if(n){if(128&r)throw new mr(20)}else{if(o)throw new mr(31);n=Rr(a,511|t,0),i=!0}if(!n)throw new mr(44);if(8192==(61440&n.mode)&&(r&=-513),65536&r&&16384!=(61440&n.mode))throw new mr(54);if(!i&&(o=n?40960==(61440&n.mode)?32:16384==(61440&n.mode)&&("r"!==kr(r)||576&r)?31:Er(n,kr(r)):44))throw new mr(o);if(512&r&&!i){if(16384==(61440&(o="string"==typeof(o=n)?gr(o,{ib:!0}).node:o).mode))throw new mr(31);if(32768!=(61440&o.mode))throw new mr(28);var s=Er(o,"w");if(s)throw new mr(s);Sr(o,{size:0,timestamp:Date.now()})}r&=-131713;a:for(o=n;;){if(o===o.parent){o=o.Ja.wb;var u=u?"/"!==o[o.length-1]?`${o}/${u}`:o+u:o;break a}u=u?`${o.name}/${u}`:o.name,o=o.parent}if(u={node:n,path:u,flags:r,seekable:!0,position:0,qa:n.qa,Yb:[],error:!1},o=-1,u=Object.assign(new br,u),-1==o)a:{for(o=0;4096>=o;o++)if(!hr[o])break a;throw new mr(33)}u.Pa=o,hr[o]=u,u.qa.open&&u.qa.open(u),i&&(t&=511,Sr(n="string"==typeof n?gr(n,{ib:!0}).node:n,{mode:4095&t|-4096&n.mode,za:Date.now(),hc:void 0})),!e.logReadFiles||1&r||a in vr||(vr[a]=1)}function Mr(a,r,t){if(null===a.Pa)throw new mr(8);if(!a.seekable||!a.qa.Fa)throw new mr(70);if(0!=t&&1!=t&&2!=t)throw new mr(28);a.position=a.qa.Fa(a,r,t),a.Yb=[]}function zr(a,r,t){a=Za("/dev/"+a);var e=((a,r)=>{var t=0;return a&&(t|=365),r&&(t|=146),t})(!!r,!!t);zr.ub??(zr.ub=64);var n=zr.ub++<<8;jr(n,{open(a){a.seekable=!1},close(){t?.buffer?.length&&t(10)},read(a,t,e,n){for(var o=0,i=0;i<n;i++){try{var s=r()}catch(a){throw new mr(29)}if(void 0===s&&0===o)throw new mr(6);if(null==s)break;o++,t[e+i]=s}return o&&(a.node.Na=Date.now()),o},write(a,r,e,n){for(var o=0;o<n;o++)try{t(r[e+o])}catch(a){throw new mr(29)}return n&&(a.node.Da=a.node.za=Date.now()),o}}),qr(a,e,n)}var Ur,Nr={},Fr={},Lr=a=>{if(!(a instanceof P||"unwind"==a))throw a},Wr=a=>{throw s=a,q||0<Ga||(e.onExit?.(a),k=!0),new P(a)},_r=[],Hr={},Gr=a=>{var r;return(r=/\bwasm-function\[\d+\]:(0x[0-9a-f]+)/.exec(a))?+r[1]:(r=/:(\d+):\d+(?:\)|$)/.exec(a))?2147483648|+r[1]:0},Jr=a=>{for(var r of a)(a=Gr(r))&&(Hr[a]=r)},Kr=a=>{if(!(a=Hr[a]))return 0;var r;if(r=/^\s+at .*\.wasm\.(.*) \(.*\)$/.exec(a))r=r[1];else if(r=/^\s+at (.*) \(.*\)$/.exec(a))r=r[1];else{if(!(r=/^(.+?)@/.exec(a)))return 0;r=r[1]}Zr(Kr.Ab??0),a=Kr;var t=Ia(r)+1,e=Xr(t);return e&&qa(r,c,e,t),a.Ab=e,Kr.Ab},Vr={},Qr=()=>{if(!Ur){var a,r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.language||"C").replace("-","_")+".UTF-8",_:n||"./this.program"};for(a in Vr)void 0===Vr[a]?delete r[a]:r[a]=Vr[a];var t=[];for(a in r)t.push(`${a}=${r[a]}`);Ur=t}return Ur};if((()=>{let a=X.prototype;Object.assign(a,{isAliasOf:function(a){if(!(this instanceof X&&a instanceof X))return!1;var r=this.ma.ta.na,t=this.ma.ra;a.ma=a.ma;var e=a.ma.ta.na;for(a=a.ma.ra;r.ya;)t=r.Xa(t),r=r.ya;for(;e.ya;)a=e.Xa(a),e=e.ya;return r===e&&t===a},clone:function(){if(this.ma.ra||K(this),this.ma.Va)return this.ma.count.value+=1,this;var a=Y,r=Object,t=r.create,e=Object.getPrototypeOf(this),n=this.ma;return(a=a(t.call(r,e,{ma:{value:{count:n.count,Sa:n.Sa,Va:n.Va,ra:n.ra,ta:n.ta,xa:n.xa,Ba:n.Ba}}}))).ma.count.value+=1,a.ma.Sa=!1,a},delete(){if(this.ma.ra||K(this),this.ma.Sa&&!this.ma.Va)throw new H("Object already scheduled for deletion");Q(this);var a=this.ma;--a.count.value,0===a.count.value&&(a.xa?a.Ba.Ha(a.xa):a.ta.na.Ha(a.ra)),this.ma.Va||(this.ma.xa=void 0,this.ma.ra=void 0)},isDeleted:function(){return!this.ma.ra},deleteLater:function(){if(this.ma.ra||K(this),this.ma.Sa&&!this.ma.Va)throw new H("Object already scheduled for deletion");return this.ma.Sa=!0,this}});const r=Symbol.dispose;r&&(a[r]=a.delete)})(),Object.assign(ca.prototype,{Ib(a){return this.yb&&(a=this.yb(a)),a},qb(a){this.Ha?.(a)},Ea:z,sa:function(a){function r(){return this.ab?ha(this.na.La,{ta:this.Rb,ra:t,Ba:this,xa:a}):ha(this.na.La,{ta:this,ra:a})}var t=this.Ib(a);if(!t)return this.qb(a),null;var e=((a,r)=>{if(void 0===r)throw new H("ptr should not be undefined");for(;a.ya;)r=a.Xa(r),a=a.ya;return la[r]})(this.na,t);if(void 0!==e)return 0===e.ma.count.value?(e.ma.ra=t,e.ma.xa=a,e.clone()):(e=e.clone(),this.qb(a),e);if(e=this.na.Hb(t),!(e=aa[e]))return r.call(this);e=this.$a?e.Eb:e.pointerType;var n=fa(t,this.na,e.na);return null===n?r.call(this):this.ab?ha(e.na.La,{ta:e,ra:n,Ba:this,xa:a}):ha(e.na.La,{ta:e,ra:n})}}),wr=Array(4096),Dr(ur,"/"),Tr("/tmp"),Tr("/home"),Tr("/home/web_user"),function(){Tr("/dev"),jr(259,{read:()=>0,write:(a,r,t,e)=>e,Fa:()=>0}),qr("/dev/null",259),nr(1280,ir),nr(1536,sr),qr("/dev/tty",1280),qr("/dev/tty1",1536);var a=new Uint8Array(1024),r=0,t=()=>(0===r&&(rr(a),r=a.byteLength),a[--r]);zr("random",t),zr("urandom",t),Tr("/dev/shm"),Tr("/dev/shm/tmp")}(),function(){Tr("/proc");var a=Tr("/proc/self");Tr("/proc/self/fd"),Dr({Ja(){var r=Cr(a,"fd",16895,73);return r.qa={Fa:ur.qa.Fa},r.pa={Ua(a,r){var t=Or(a=+r);return(a={parent:null,Ja:{wb:"fake"},pa:{Wa:()=>t.path},id:a+1}).parent=a},ob:()=>Array.from(hr.entries()).filter(([,a])=>a).map(([a])=>a.toString())},r}},"/proc/self/fd")}(),e.noExitRuntime&&(q=e.noExitRuntime),e.print&&(A=e.print),e.printErr&&(C=e.printErr),e.wasmBinary&&(i=e.wasmBinary),e.thisProgram&&(n=e.thisProgram),e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);0<e.preInit.length;)e.preInit.shift()();var Yr,Xr,Zr,at,rt,tt,et={208668:()=>"undefined"!=typeof wasmOffsetConverter},nt={U:function(){return"undefined"!=typeof wasmOffsetConverter},n:(a,r,t)=>{var e=new I(a);throw v[e.ra+16>>2]=0,v[e.ra+4>>2]=r,v[e.ra+8>>2]=t,a},Q:()=>O(""),r:a=>{var r=B[a];delete B[a];var t=r.nb,e=r.Ha,n=r.rb,o=n.map(a=>a.Lb).concat(n.map(a=>a.Vb));W([a],o,a=>{var o={};return n.forEach((r,t)=>{var e=a[t],i=r.Jb,s=r.Kb,u=a[t+n.length],f=r.Ub,l=r.Wb;o[r.Gb]={read:a=>e.sa(i(s,a)),write:(a,r)=>{var t=[];f(l,a,u.wa(t,r)),M(t)},optional:a[t].optional}}),[{name:r.name,sa:a=>{var r,t={};for(r in o)t[r]=o[r].read(a);return e(a),t},wa:(a,r)=>{for(var n in o)if(!(n in r)&&!o[n].optional)throw new TypeError(`Missing field: "${n}"`);var i=t();for(n in o)o[n].write(i,r[n]);return null!==a&&a.push(e,i),i},Ea:z,Aa:e}]})},E:(a,r,t,e,n)=>{r=_(r);let o=a=>a;if(e=0n===e){const a=8*t;o=r=>BigInt.asUintN(a,r),n=o(n)}G(a,{name:r,sa:o,wa:(a,r)=>("number"==typeof r&&(r=BigInt(r)),r),Ea:J(r,t,!e),Aa:null})},ba:(a,r,t,e)=>{G(a,{name:r=_(r),sa:function(a){return!!a},wa:function(a,r){return r?t:e},Ea:function(a){return this.sa(c[a])},Aa:null})},e:(a,r,t,e,n,o,i,s,u,f,l,h,c)=>{l=_(l),o=va(n,o),s&&=va(i,s),f&&=va(u,f),c=va(h,c);var w=(a=>{var r=(a=a.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return 48<=r&&57>=r?`_${a}`:a})(l);ta(w,function(){ya(`Cannot construct ${l} due to unbound types`,[e])}),W([a,r,t],e?[e]:[],r=>{if(r=r[0],e)var t=r.na,n=t.La;else n=X.prototype;r=Z(l,function(...a){if(Object.getPrototypeOf(this)!==i)throw new H(`Use 'new' to construct ${l}`);if(void 0===h.Oa)throw new H(`${l} has no accessible constructor`);var r=h.Oa[a.length];if(void 0===r)throw new H(`Tried to invoke ctor of ${l} with invalid number of parameters (${a.length}) - expected (${Object.keys(h.Oa).toString()}) parameters instead!`);return r.apply(this,a)});var i=Object.create(n,{constructor:{value:r}});r.prototype=i;var u,h=new ea(l,r,i,c,t,o,s,f);return h.ya&&((u=h.ya).Ya??(u.Ya=[]),h.ya.Ya.push(h)),t=new ca(l,h,!0,!1,!1),u=new ca(l+"*",h,!1,!1,!1),n=new ca(l+" const*",h,!1,!0,!1),aa[a]={pointerType:u,Eb:n},da(w,r),[t,u,n]})},v:(a,r,t,e,n,o,i)=>{var s=$a(t,e);r=_(r),r=Aa(r),o=va(n,o),W([],[a],a=>{function e(){ya(`Cannot call ${n} due to unbound types`,s)}var n=`${(a=a[0]).name}.${r}`;r.startsWith("@@")&&(r=Symbol[r.substring(2)]);var u=a.na.constructor;return void 0===u[r]?(e.Ma=t-1,u[r]=e):(ra(u,r,n),u[r].ua[t-1]=e),W([],s,e=>{if(e=ga(n,[e[0],null].concat(e.slice(1)),null,o,i),void 0===u[r].ua?(e.Ma=t-1,u[r]=e):u[r].ua[t-1]=e,a.na.Ya)for(const t of a.na.Ya)t.constructor.hasOwnProperty(r)||(t.constructor[r]=e);return[]}),[]})},j:(a,r,t,e,n,o)=>{var i=$a(r,t);n=va(e,n),W([],[a],a=>{var t=`constructor ${(a=a[0]).name}`;if(void 0===a.na.Oa&&(a.na.Oa=[]),void 0!==a.na.Oa[r-1])throw new H(`Cannot register multiple constructors with identical number of parameters (${r-1}) for class '${a.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return a.na.Oa[r-1]=()=>{ya(`Cannot construct ${a.name} due to unbound types`,i)},W([],i,e=>(e.splice(1,0,null),a.na.Oa[r-1]=ga(t,e,null,n,o),[])),[]})},a:(a,r,t,e,n,o,i,s)=>{var u=$a(t,e);r=_(r),r=Aa(r),o=va(n,o),W([],[a],a=>{function e(){ya(`Cannot call ${n} due to unbound types`,u)}var n=`${(a=a[0]).name}.${r}`;r.startsWith("@@")&&(r=Symbol[r.substring(2)]),s&&a.na.Sb.push(r);var f=a.na.La,l=f[r];return void 0===l||void 0===l.ua&&l.className!==a.name&&l.Ma===t-2?(e.Ma=t-2,e.className=a.name,f[r]=e):(ra(f,r,n),f[r].ua[t-2]=e),W([],u,e=>(e=ga(n,e,a,o,i),void 0===f[r].ua?(e.Ma=t-2,f[r]=e):f[r].ua[t-2]=e,[])),[]})},c:(a,r,t,e,n,o,i,s,u,f)=>{r=_(r),n=va(e,n),W([],[a],a=>{var e=`${(a=a[0]).name}.${r}`,l={get(){ya(`Cannot access ${e} due to unbound types`,[t,i])},enumerable:!0,configurable:!0};return l.set=u?()=>ya(`Cannot access ${e} due to unbound types`,[t,i]):()=>{throw new H(e+" is a read-only property")},Object.defineProperty(a.na.La,r,l),W([],u?[t,i]:[t],t=>{var i=t[0],l={get(){var r=Ca(this,a,e+" getter");return i.sa(n(o,r))},enumerable:!0};if(u){u=va(s,u);var h=t[1];l.set=function(r){var t=Ca(this,a,e+" setter"),n=[];u(f,t,h.wa(n,r)),M(n)}}return Object.defineProperty(a.na.La,r,l),[]}),[]})},_:a=>G(a,Pa),m:(a,r,t,e)=>{function n(){}r=_(r),n.values={},G(a,{name:r,constructor:n,sa:function(a){return this.constructor.values[a]},wa:(a,r)=>r.value,Ea:ja(r,t,e),Aa:null}),ta(r,n)},d:(a,r,t)=>{var e=Da(a,"enum");r=_(r),a=e.constructor,e=Object.create(e.constructor.prototype,{value:{value:t},constructor:{value:Z(`${e.name}_${r}`,function(){})}}),a.values[t]=e,a[r]=e},D:(a,r,t)=>{G(a,{name:r=_(r),sa:a=>a,wa:(a,r)=>r,Ea:Ra(r,t),Aa:null})},da:(a,r,t,e,n,o)=>{var i=$a(r,t);a=_(a),a=Aa(a),n=va(e,n),ta(a,function(){ya(`Cannot call ${a} due to unbound types`,i)},r-1),W([],i,t=>(da(a,ga(a,[t[0],null].concat(t.slice(1)),null,n,o),r-1),[]))},w:(a,r,t,e,n)=>{r=_(r);let o=a=>a;if(0===e){var i=32-8*t;o=a=>a<<i>>>i,n=o(n)}G(a,{name:r,sa:o,wa:(a,r)=>r,Ea:J(r,t,0!==e),Aa:null})},o:(a,r,t)=>{function e(a){return new n(h.buffer,v[a+4>>2],v[a>>2])}var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][r];G(a,{name:t=_(t),sa:e,Ea:e},{Mb:!0})},t:a=>{G(a,Ta)},k:(a,r,t,e,n,o,i,s,u,f,l,h)=>{t=_(t),o=va(n,o),s=va(i,s),f=va(u,f),h=va(l,h),W([a],[r],a=>(a=a[0],[new ca(t,a.na,!1,!1,!0,a,e,o,s,f,h)]))},aa:(a,r)=>{G(a,{name:r=_(r),sa(a){var r=(r=a+4)?za(c,r,v[a>>2],!0):"";return Zr(a),r},wa(a,r){r instanceof ArrayBuffer&&(r=new Uint8Array(r));var t="string"==typeof r;if(!(t||ArrayBuffer.isView(r)&&1==r.BYTES_PER_ELEMENT))throw new H("Cannot pass non-string to std::string");var e=t?Ia(r):r.length,n=Xr(4+e+1),o=n+4;return v[n>>2]=e,t?qa(r,c,o,e+1):c.set(r,o),null!==a&&a.push(Zr,n),n},Ea:z,Aa(a){Zr(a)}})},A:(a,r,t)=>{if(t=_(t),2===r)var e=Na,n=Fa,o=La;else e=Wa,n=_a,o=Ha;G(a,{name:t,sa:a=>{var t=e(a+4,v[a>>2]*r,!0);return Zr(a),t},wa:(a,e)=>{if("string"!=typeof e)throw new H(`Cannot pass non-string to C++ string type ${t}`);var i=o(e),s=Xr(4+i+r);return v[s>>2]=i/r,n(e,s+4,i+r),null!==a&&a.push(Zr,s),s},Ea:z,Aa(a){Zr(a)}})},s:(a,r,t,e,n,o)=>{B[a]={name:_(r),nb:va(t,e),Ha:va(n,o),rb:[]}},l:(a,r,t,e,n,o,i,s,u,f)=>{B[a].rb.push({Gb:_(r),Lb:t,Jb:va(e,n),Kb:o,Vb:i,Ub:va(s,u),Wb:f})},ca:(a,r)=>{G(a,{Nb:!0,name:r=_(r),sa:()=>{},wa:()=>{}})},I:()=>{q=!1,Ga=0},h:(a,r,t)=>{var[e,...n]=((a,r)=>{for(var t=Array(a),e=0;e<a;++e)t[e]=Da(v[r+4*e>>2],`parameter ${e}`);return t})(a,r),o=e.wa.bind(e),i=n.map(a=>a.Ea.bind(a));a--;var s=Array(a);return r=`methodCaller<(${n.map(a=>a.name)}) => ${e.name}>`,(a=>{var r=Ja.length;return Ja.push(a),r})(Z(r,(r,e,n,u)=>{for(var f=0,l=0;l<a;++l)s[l]=i[l](u+f),f+=8;switch(t){case 0:var h=Oa(r).apply(null,s);break;case 2:h=Reflect.construct(Oa(r),s);break;case 3:h=s[0];break;case 1:h=Oa(r)[Va(e)](...s)}return h=o(r=[],h),r.length&&(v[n>>2]=Sa(r)),h}))},b:xa,W:a=>a?(a=Va(a),Sa(Qa[a])):Sa(Qa),q:(a,r)=>(a=Oa(a),r=Oa(r),Sa(a[r])),f:a=>{9<a&&(Ea[a+1]+=1)},$:(a,r)=>(a=Oa(a))instanceof Oa(r),i:Ya,Z:Ya,u:a=>"number"==typeof(a=Oa(a)),x:a=>"string"==typeof(a=Oa(a)),F:()=>Sa([]),p:a=>Sa(Va(a)),g:a=>{var r=Oa(a);M(r),xa(a)},z:a=>(a=Oa(a),Sa(typeof a)),G:(a,r)=>{if(Fr[a]&&(clearTimeout(Fr[a].id),delete Fr[a]),!r)return 0;var t=setTimeout(()=>{delete Fr[a],(a=>{if(!k)try{if(a(),!(q||0<Ga))try{s=a=s,Wr(a)}catch(a){Lr(a)}}catch(a){Lr(a)}})(()=>rt(a,performance.now()))},r);return Fr[a]={id:t,qc:r},0},S:(a,r,t,e)=>{var n=(new Date).getFullYear(),o=new Date(n,0,1).getTimezoneOffset();n=new Date(n,6,1).getTimezoneOffset(),v[a>>2]=60*Math.max(o,n),p[r>>2]=Number(o!=n),a=(r=a=>{var r=Math.abs(a);return`UTC${0<=a?"-":"+"}${String(Math.floor(r/60)).padStart(2,"0")}${String(r%60).padStart(2,"0")}`})(o),r=r(n),n<o?(qa(a,c,t,17),qa(r,c,e,17)):(qa(a,c,e,17),qa(r,c,t,17))},P:function(a,r,t){return 0<=a&&3>=a?(y[t>>3]=BigInt(Math.round(1e6*(0===a?Date.now():performance.now()))),0):28},Y:(a,r,t)=>{_r.length=0;for(var e;e=c[r++];){var n=105!=e;t+=(n&=112!=e)&&t%8?4:0,_r.push(112==e?v[t>>2]:106==e?y[t>>3]:105==e?p[t>>2]:b[t>>3]),t+=n?8:4}return et[a](..._r)},C:(a,r)=>C(a?za(c,a,r):""),y:()=>performance.now(),T:Kr,H:a=>{var r=c.length;if(2147483648<(a>>>=0))return!1;for(var t=1;4>=t;t*=2){var e=r*(1+.2/t);e=Math.min(e,a+100663296);a:{e=(Math.min(2147483648,65536*Math.ceil(Math.max(a,e)/65536))-l.buffer.byteLength+65535)/65536|0;try{l.grow(e),x();var n=1;break a}catch(a){}n=void 0}if(n)return!0}return!1},X:()=>{var a=Error().stack.toString().split("\n");return"Error"==a[0]&&a.shift(),Jr(a),Hr.tb=Gr(a[3]),Hr.Ob=a,Hr.tb},V:(a,r,t)=>{if(Hr.tb==a)var e=Hr.Ob;else"Error"==(e=Error().stack.toString().split("\n"))[0]&&e.shift(),Jr(e);for(var n=3;e[n]&&Gr(e[n])!=a;)++n;for(a=0;a<t&&e[a+n];++a)p[r+4*a>>2]=Gr(e[a+n]);return a},K:(a,r)=>{var t,e=0,n=0;for(t of Qr()){var o=r+e;v[a+n>>2]=o,e+=qa(t,c,o,1/0)+1,n+=4}return 0},L:(a,r)=>{var t=Qr();for(var e of(v[a>>2]=t.length,a=0,t))a+=Ia(e)+1;return v[r>>2]=a,0},B:a=>{s=a,Wr(a)},O:function(a){try{var r=Or(a);if(null===r.Pa)throw new mr(8);r.kb&&(r.kb=null);try{r.qa.close&&r.qa.close(r)}catch(a){throw a}finally{hr[r.Pa]=null}return r.Pa=null,0}catch(a){if(void 0===Nr||"ErrnoError"!==a.name)throw a;return a.Ta}},N:function(a,r,t,e){try{a:{var n=Or(a);a=r;for(var o,i=r=0;i<t;i++){var s=v[a>>2],u=v[a+4>>2];a+=8;var f=n,l=s,c=u,w=o,d=h;if(0>c||0>w)throw new mr(28);if(null===f.Pa)throw new mr(8);if(1==(2097155&f.flags))throw new mr(8);if(16384==(61440&f.node.mode))throw new mr(31);if(!f.qa.read)throw new mr(28);var p=void 0!==w;if(p){if(!f.seekable)throw new mr(70)}else w=f.position;var m=f.qa.read(f,d,l,c,w);p||(f.position+=m);var b=m;if(0>b){var y=-1;break a}if(r+=b,b<u)break;void 0!==o&&(o+=b)}y=r}return v[e>>2]=y,0}catch(a){if(void 0===Nr||"ErrnoError"!==a.name)throw a;return a.Ta}},J:function(a,r,t,e){r=-9007199254740992>r||9007199254740992<r?NaN:Number(r);try{if(isNaN(r))return 61;var n=Or(a);return Mr(n,r,t),y[e>>3]=BigInt(n.position),n.kb&&0===r&&0===t&&(n.kb=null),0}catch(a){if(void 0===Nr||"ErrnoError"!==a.name)throw a;return a.Ta}},M:function(a,r,t,e){try{a:{var n=Or(a);a=r;for(var o,i=r=0;i<t;i++){var s=v[a>>2],u=v[a+4>>2];a+=8;var f=n,l=s,c=u,w=o,d=h;if(0>c||0>w)throw new mr(28);if(null===f.Pa)throw new mr(8);if(!(2097155&f.flags))throw new mr(8);if(16384==(61440&f.node.mode))throw new mr(31);if(!f.qa.write)throw new mr(28);f.seekable&&1024&f.flags&&Mr(f,0,2);var p=void 0!==w;if(p){if(!f.seekable)throw new mr(70)}else w=f.position;var m=f.qa.write(f,d,l,c,w,void 0);p||(f.position+=m);var b=m;if(0>b){var y=-1;break a}if(r+=b,b<u)break;void 0!==o&&(o+=b)}y=r}return v[e>>2]=y,0}catch(a){if(void 0===Nr||"ErrnoError"!==a.name)throw a;return a.Ta}},R:Wr};return tt=await async function(){function a(a){return tt=a.exports,l=tt.ea,x(),wa=tt.ja,Yr=(a=tt).ga,Xr=a.ha,Zr=a.ia,at=a.ka,rt=a.la,tt}var r={a:nt};return e.instantiateWasm?new Promise(t=>{e.instantiateWasm(r,(r,e)=>{t(a(r))})}):($??=e.locateFile?e.locateFile("arcgis-knowledge-client-core-simd.wasm",o):o+"arcgis-knowledge-client-core-simd.wasm",a((await async function(a){var r=$;if(!i)try{var t=fetch(r,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(t,a)}catch(a){C(`wasm streaming compile failed: ${a}`),C("falling back to ArrayBuffer instantiation")}return async function(a,r){try{var t=await S(a);return await WebAssembly.instantiate(t,r)}catch(a){C(`failed to asynchronously prepare wasm: ${a}`),O(a)}}(r,a)}(r)).instance))}(),function(){function a(){if(e.calledRun=!0,!k){var a,r;if(E=!0,e.noFSInit||dr||(dr=!0,a??=e.stdin,r??=e.stdout,t??=e.stderr,a?zr("stdin",a):Ir("/dev/tty","/dev/stdin"),r?zr("stdout",null,r):Ir("/dev/tty","/dev/stdout"),t?zr("stderr",null,t):Ir("/dev/tty1","/dev/stderr"),Br("/dev/stdin",0),Br("/dev/stdout",1),Br("/dev/stderr",1)),tt.fa(),pr=!1,u?.(e),e.onRuntimeInitialized?.(),e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var t=e.postRun.shift();D.push(t)}j(D)}}if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)T();j(R),e.setStatus?(e.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>e.setStatus(""),1),a()},1)):a()}(),E?e:new Promise((a,r)=>{u=a,f=r})},a.exports=t,a.exports.default=t),o.exports;var a,r,t}()),s=Object.freeze(Object.defineProperty({__proto__:null,default:i},Symbol.toStringTag,{value:"Module"}))}}]);