@arcgis/core 4.34.0-next.17 → 4.34.0-next.19

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 (209) hide show
  1. package/EULA.pdf +0 -0
  2. package/applications/MapViewer/templateUtils.js +1 -1
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/{fa894be8cfb6ed485df9.js → 025891f445869e33252b.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{827919fe23e06e40a330.js → 1a82f903b442a3856bfa.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{400a4c9fa62964f8fa1d.js → 1f48d6c76f0014064eca.js} +1 -1
  7. package/assets/esri/core/workers/chunks/22206d13a75d61d77023.js +1 -0
  8. package/assets/esri/core/workers/chunks/227d25fcbb5f590c4581.js +1 -0
  9. package/assets/esri/core/workers/chunks/{2ad538440cfb3ab94787.js → 2c0c97acb7714b1e0e01.js} +1 -1
  10. package/assets/esri/core/workers/chunks/3cf31e51266f40072f71.js +1 -0
  11. package/assets/esri/core/workers/chunks/3e07de009d5febd62b19.js +1 -0
  12. package/assets/esri/core/workers/chunks/4072ab8378c235a268ca.js +1 -0
  13. package/assets/esri/core/workers/chunks/52410198c4b2eccfeadd.js +1 -0
  14. package/assets/esri/core/workers/chunks/{04e558a970c6a77f243e.js → 5cbaf4ff688aafa6643e.js} +1 -1
  15. package/assets/esri/core/workers/chunks/5e53c7e29bb6d43d08be.js +1 -0
  16. package/assets/esri/core/workers/chunks/606782a94adcce6975af.js +1 -0
  17. package/assets/esri/core/workers/chunks/6f8de923519bb16af8ba.js +1 -0
  18. package/assets/esri/core/workers/chunks/{53e43798d08ad2075c1f.js → 758776e841fd370e3353.js} +1 -1
  19. package/assets/esri/core/workers/chunks/764e505f2bafdf5afaf9.js +1 -0
  20. package/assets/esri/core/workers/chunks/8637b9cb30170ac4eae2.js +1 -0
  21. package/assets/esri/core/workers/chunks/8656c145ff0ca2e51ea6.js +1 -0
  22. package/assets/esri/core/workers/chunks/8b4a35e3ed39d8be3394.js +1 -0
  23. package/assets/esri/core/workers/chunks/903c7a0a47c14442d3c1.js +1 -0
  24. package/assets/esri/core/workers/chunks/933d4a3b0cee82cc80fe.js +1 -0
  25. package/assets/esri/core/workers/chunks/{d33a5d79f2163ad62b1d.js → 9965961bad09910f577b.js} +1 -1
  26. package/assets/esri/core/workers/chunks/9d499a37b960273c3f84.js +1 -0
  27. package/assets/esri/core/workers/chunks/a507192771e5f4f82973.js +1 -0
  28. package/assets/esri/core/workers/chunks/{66c8816e91e3f9e214d4.js → a92a344763fbc3cec71e.js} +1 -1
  29. package/assets/esri/core/workers/chunks/a9e1caf05c81055ae194.js +1 -0
  30. package/assets/esri/core/workers/chunks/{1415d4e2f5f3193be004.js → aa4ae0e54a0507e8dd0f.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{2d89e354eeadadca4f7f.js → b421986cb4e45c632f7c.js} +1 -1
  32. package/assets/esri/core/workers/chunks/c1822b03302c3db71b1f.js +1 -0
  33. package/assets/esri/core/workers/chunks/d3bfd0c382c2f39a787b.js +1 -0
  34. package/assets/esri/core/workers/chunks/d568070513f2b98fd9b5.js +1 -0
  35. package/assets/esri/core/workers/chunks/d6df12bed626d56cd6b2.js +1 -0
  36. package/assets/esri/core/workers/chunks/{5bfccd5dffda74740aa4.js → df811b31e0446de5d322.js} +1 -1
  37. package/assets/esri/core/workers/chunks/e0146db608959ead9c97.js +1 -0
  38. package/assets/esri/core/workers/chunks/ec339075bb4faeec1413.js +1 -0
  39. package/assets/esri/core/workers/chunks/f4442a2b40e44f90b461.js +1 -0
  40. package/assets/esri/core/workers/chunks/{fa5715ca3ce95d005b0a.js → faa892ad4cc8a90b6c79.js} +1 -1
  41. package/assets/esri/themes/base/widgets/_Legend.scss +3 -1
  42. package/assets/esri/themes/dark/main.css +1 -1
  43. package/assets/esri/themes/light/main.css +1 -1
  44. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ar.json +1 -1
  45. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bg.json +1 -1
  46. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bs.json +1 -1
  47. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ca.json +1 -1
  48. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_cs.json +1 -1
  49. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_da.json +1 -1
  50. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_de.json +1 -1
  51. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_el.json +1 -1
  52. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_es.json +1 -1
  53. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_et.json +1 -1
  54. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fi.json +1 -1
  55. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fr.json +1 -1
  56. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_he.json +1 -1
  57. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hr.json +1 -1
  58. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hu.json +1 -1
  59. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_id.json +1 -1
  60. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_it.json +1 -1
  61. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ja.json +1 -1
  62. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ko.json +1 -1
  63. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lt.json +1 -1
  64. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lv.json +1 -1
  65. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_nl.json +1 -1
  66. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_no.json +1 -1
  67. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pl.json +1 -1
  68. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-BR.json +1 -1
  69. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-PT.json +1 -1
  70. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ro.json +1 -1
  71. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ru.json +1 -1
  72. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sk.json +1 -1
  73. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sl.json +1 -1
  74. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sr.json +1 -1
  75. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sv.json +1 -1
  76. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_th.json +1 -1
  77. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_tr.json +1 -1
  78. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_uk.json +1 -1
  79. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_vi.json +1 -1
  80. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-CN.json +1 -1
  81. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-HK.json +1 -1
  82. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-TW.json +1 -1
  83. package/chunks/sphere.js +1 -1
  84. package/config.js +1 -1
  85. package/core/accessorSupport/trackingUtils.js +1 -1
  86. package/core/sql.js +1 -1
  87. package/geometry/spatialReferenceEllipsoidUtils.js +1 -1
  88. package/geometry/support/coordsUtils.js +1 -1
  89. package/geometry/support/sphere.js +1 -1
  90. package/interfaces.d.ts +101 -49
  91. package/kernel.js +1 -1
  92. package/layers/FeatureLayer.js +1 -1
  93. package/layers/OrientedImageryLayer.js +1 -1
  94. package/layers/SubtypeGroupLayer.js +1 -1
  95. package/layers/VectorTileLayer.js +1 -1
  96. package/layers/VideoLayer.js +1 -1
  97. package/layers/graphics/data/QueryEngineResult.js +1 -1
  98. package/layers/mixins/FeatureLayerBase.js +1 -1
  99. package/layers/orientedImagery/core/ExposurePoint.js +1 -1
  100. package/layers/orientedImagery/core/coverageUtils.js +1 -1
  101. package/layers/orientedImagery/core/utils.js +1 -1
  102. package/layers/orientedImagery/transformations/updateElevation.js +1 -1
  103. package/layers/orientedImagery/transformations/updateElevationUtils.js +1 -1
  104. package/layers/orientedImagery/transformations/utils.js +1 -1
  105. package/layers/support/SubtypeSublayer.js +1 -1
  106. package/layers/support/TitleCreator.js +1 -1
  107. package/layers/support/arcgisLayers.js +1 -1
  108. package/layers/support/fetchService.js +1 -1
  109. package/layers/support/fieldUtils.js +1 -1
  110. package/layers/support/layerUtils.js +1 -1
  111. package/layers/video/VideoCameraSensorModel.js +1 -1
  112. package/layers/video/VideoController.js +1 -1
  113. package/networks/UtilityNetwork.js +1 -1
  114. package/package.json +1 -1
  115. package/portal/support/layersLoader.js +1 -1
  116. package/portal/support/loadUtils.js +1 -1
  117. package/portal/support/portalLayers.js +1 -1
  118. package/request.js +1 -1
  119. package/rest/knowledgeGraphService.js +1 -1
  120. package/rest/support/DateBinParameters.js +1 -1
  121. package/smartMapping/renderers/size.js +1 -1
  122. package/smartMapping/renderers/support/spikeUtils.js +1 -1
  123. package/support/requestUtils.js +1 -1
  124. package/support/revision.js +1 -1
  125. package/symbols/cim/effects/EffectRadial.js +1 -1
  126. package/symbols/cim/utils.js +1 -1
  127. package/symbols/support/previewCIMSymbol.js +1 -1
  128. package/symbols/support/previewSymbol2D.js +1 -1
  129. package/symbols/support/svgUtils.js +1 -1
  130. package/views/2d/engine/vectorTiles/style/StyleRepository.js +1 -1
  131. package/views/3d/analysis/DimensionAnalysisView3D.js +1 -1
  132. package/views/3d/analysis/LineOfSightAnalysisView3D.js +1 -1
  133. package/views/3d/analysis/SliceAnalysisView3D.js +1 -1
  134. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  135. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  136. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  137. package/views/3d/camera/intersectionUtils.js +1 -1
  138. package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
  139. package/views/3d/layers/I3SMeshView3D.js +1 -1
  140. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  141. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  142. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  143. package/views/3d/state/ViewState.js +1 -1
  144. package/views/3d/state/ViewStateManager.js +1 -1
  145. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  146. package/views/3d/state/controllers/PointToPointAnimationController.js +1 -1
  147. package/views/3d/state/utils/navigationUtils.js +1 -1
  148. package/views/3d/support/popupHitTest.js +1 -1
  149. package/views/3d/terrain/OverlayManager.js +1 -1
  150. package/views/3d/terrain/TerrainSurface.js +1 -1
  151. package/views/3d/terrain/TileRenderer.js +1 -1
  152. package/views/3d/webgl-engine/collections/Component/SourceGeometry.js +1 -1
  153. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  154. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  155. package/views/3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js +1 -1
  156. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  157. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  158. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  159. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  160. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  161. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  162. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  163. package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
  164. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  165. package/views/SceneView.js +1 -1
  166. package/views/analysis/analysisViewUtils.js +1 -1
  167. package/views/layers/DimensionLayerView.js +1 -1
  168. package/views/layers/LineOfSightLayerView.js +1 -1
  169. package/views/layers/ViewshedLayerView.js +1 -1
  170. package/views/support/drapedUtils.js +1 -1
  171. package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
  172. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
  173. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  174. package/widgets/Expand.js +1 -1
  175. package/widgets/FeatureTable/support/templateUtils.js +1 -1
  176. package/widgets/Legend/styles/support/sizeRampUtils.js +1 -1
  177. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  178. package/widgets/Legend/support/sizeRampUtils.js +1 -1
  179. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  180. package/widgets/OrientedImageryViewer/components/OrientedImageryVideoViewModel.js +1 -1
  181. package/widgets/OrientedImageryViewer.js +1 -1
  182. package/widgets/Print/PrintViewModel.js +1 -1
  183. package/widgets/Print.js +1 -1
  184. package/widgets/support/GridControls.js +1 -1
  185. package/assets/esri/core/workers/chunks/1443520c9fb23381f8d5.js +0 -1
  186. package/assets/esri/core/workers/chunks/254c4f7e277ae9915dce.js +0 -1
  187. package/assets/esri/core/workers/chunks/273beed633cc37416ad7.js +0 -1
  188. package/assets/esri/core/workers/chunks/3f8cc157b65a9d570921.js +0 -1
  189. package/assets/esri/core/workers/chunks/49a57dc1e6d1048fa949.js +0 -1
  190. package/assets/esri/core/workers/chunks/500fb5f615f0c1db1b66.js +0 -1
  191. package/assets/esri/core/workers/chunks/513dc2467e9b8b8c6df4.js +0 -1
  192. package/assets/esri/core/workers/chunks/52239e958a82ebcd2e7a.js +0 -1
  193. package/assets/esri/core/workers/chunks/5ef1095842e21090f1f4.js +0 -1
  194. package/assets/esri/core/workers/chunks/7716a9fb380d66ba7292.js +0 -1
  195. package/assets/esri/core/workers/chunks/78a57f5aeb277b84b3da.js +0 -1
  196. package/assets/esri/core/workers/chunks/7c56740cac444419e5b4.js +0 -1
  197. package/assets/esri/core/workers/chunks/802c6b1a6cb9264b8e4f.js +0 -1
  198. package/assets/esri/core/workers/chunks/8855f1a6224ffbd0bb66.js +0 -1
  199. package/assets/esri/core/workers/chunks/885e8e90dfe5dbd5053d.js +0 -1
  200. package/assets/esri/core/workers/chunks/88b1214c284c2ec7d51b.js +0 -1
  201. package/assets/esri/core/workers/chunks/932808e485f305b6a26a.js +0 -1
  202. package/assets/esri/core/workers/chunks/beb01d400f1aa089d2dc.js +0 -1
  203. package/assets/esri/core/workers/chunks/cc1328cacc4ac07eb548.js +0 -1
  204. package/assets/esri/core/workers/chunks/cfc5e0ec9b0290407383.js +0 -1
  205. package/assets/esri/core/workers/chunks/d2139307f62ea8bf999a.js +0 -1
  206. package/assets/esri/core/workers/chunks/ddb66fe6fcd0764daa7a.js +0 -1
  207. package/assets/esri/core/workers/chunks/eac7af86166c09c6a9be.js +0 -1
  208. package/assets/esri/core/workers/chunks/ec49e2849766402ad5c7.js +0 -1
  209. package/assets/esri/core/workers/chunks/f3e179b48bca50c94538.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Clonable.js";import r from"../../../core/Error.js";import o from"../../../core/JSONSupport.js";import a from"../../../core/Logger.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import{cast as n}from"../../../core/accessorSupport/decorators/cast.js";import{enumeration as s}from"../../../core/accessorSupport/decorators/enumeration.js";import{reader as p}from"../../../core/accessorSupport/decorators/reader.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../../../core/accessorSupport/decorators/writer.js";import m from"../../../geometry/Point.js";import{getGeometryZScaler as u}from"../../../geometry/support/zscale.js";import d from"./CameraOrientation.js";import y from"./cameraOrientationFactory.js";import{appendPrefixAndSuffix as f,getEffectiveElevationSource as g,orientedImageryTypeMap as h}from"./utils.js";import{CameraOrientationType as v}from"../enums/CameraOrientationType.js";import{ltpToGeographic as w}from"../transformations/utils.js";function O(e){throw new r("exposure-point:missing-default-value",`a value for ${e} is missing in default properties`)}function j(e,t){throw new r("exposure-point:missing-attribute-value",`a value for ${e} is missing in attribute table`,{exposurePoint:t})}const b=e=>({cast:e=>{const t=parseFloat(e);return Number.isFinite(t)?t:void 0},json:{name:e,write:{writer:(e,t,r)=>{t[r]=Number.isFinite(e)?e:void 0}}}}),S=e=>({cast:e=>"string"==typeof e?e.split(";").map(Number):e,json:{default:e,write:{writer:(e,t,r)=>{t[r]=e?.join(";")}}}});let I=class extends(t.ClonableMixin(o)){constructor(e){super(e),this._geometry=null,this.cameraOrientation=null,this.elevation=null,this.elevationSource=null,this.name=null,this.sourceMap=null}read(e,t){const r={},{attributes:o,geometry:a}=e,i={};for(const s in o)r[s.toLowerCase()]=o[s],i[s.toLowerCase()]=s;const n=e.layer??{};n.sequenceOrderField?.length&&(r.sequenceorder=o[n.sequenceOrderField],i.sequenceorder=n.sequenceOrderField),super.read({geometry:a,layer:n,sourceMap:i,...r},t)}write(e,t){const r=super.write(e,t),{sourceMap:o}=this;if(!o||!r)return r;const a={};for(const i in r){const e=o[i.toLowerCase()];e&&(a[e]=r[i])}return a}readCameraHeading(e,t){const{cameraheading:r,camheading:o,layer:a}=t;return r??o??a.cameraHeading}readCameraHeight(e,t){const{cameraheight:r,avghtag:o,layer:a}=t;return r??o??a.cameraHeight}readCamOffset(e,t){const{cameraoffset:r,camoffset:o}=t;return r?.split(";").map(Number)??o?.split(";").map(Number)??null}writeCameraOffset(e,t){e&&(t.cameraOffset=e.join(";"))}readCameraOrientation(e,t){const{cameraorientation:r,camori:o}=t;return r??o}readCameraPitch(e,t){const{camerapitch:r,campitch:o,layer:a}=t;return r??o??a.cameraPitch}readCameraRoll(e,t){const{cameraroll:r,camroll:o,layer:a}=t;return r??o??a.cameraRoll}readDepthImage(e,t){const{depthimage:r,depthimg:o,layer:a}=t,i=r??o??null,{depthImagePathPrefix:n,depthImagePathSuffix:s}=a??{};return f(i,n,s)}readElevationSource(e,t){const{elevationsource:r,layer:o}=t,{demPathSuffix:a,demPathPrefix:i}=o;if(r){const e=this._parseIfJSON(r);return g(e,i,a)}return o.effectiveElevationSource}readFarDistance(e,t){const{fardistance:r,fardist:o,layer:a}=t;return r??o??a.farDistance}get geometry(){const e=this._geometry.clone();if(!e)return null;const{cameraOffset:t}=this;if(t){const[r,o,a]=t;e.x+=r,e.y+=o,null!=e.z&&null!=a&&(e.z+=a)}return e}set geometry(e){this._geometry=e}readHFOV(e,t){const{horizontalfieldofview:r,hfov:o,layer:a}=t;return r??o??a.horizontalFieldOfView}readImageURL(e,t){const{imagepath:r,layer:o}=t;r||j("imagePath",this);const{imagePathPrefix:a,imagePathSuffix:i}=o;return f(r,a,i)}readImageRotation(e,t){const{imagerotation:r,imgrot:o,layer:a}=t;return r??o??a.imageRotation}get isHorizontal(){return"horizontal"===this.orientedImageryType}get isInspection(){return"inspection"===this.orientedImageryType}get isNadir(){return"nadir"===this.orientedImageryType}get isOblique(){return"oblique"===this.orientedImageryType}get isSpherical(){return"360"===this.orientedImageryType}get location(){const{cameraOrientation:e,cameraHeight:t,elevation:r}=this;if(e){const{type:t,x:r,y:o,z:a,horizontalWKID:i,verticalWKID:n}=e,s="number"==typeof i?{wkid:i}:{wkt:i};if(t===v.LTP){const{latitude:t,longitude:r,ellipsoidRadius:o,squaredEccentricity:a,properties:i}=e,{x:n,y:s,z:p}=i;return new m(w([n,s,p],[t,r,o,a]))}const p=new m({x:r,y:o,z:a,spatialReference:s}),c=n?u("point",{wkid:n},s):null;return c&&c(p),p}if("number"!=typeof t)throw O("cameraHeight");const o=this.geometry.clone();return o.z=o.hasZ?o.z:(r??0)+t,o}set matrix(e){if(!e||9!==e.length)return a.getLogger(this).warn("Ignoring rotation matrix because it doesn't have 9 values",{value:e}),void this._set("matrix",null);this._set("matrix",e)}readNearDistance(e,t){const{neardistance:r,neardist:o,layer:a}=t;return r??o??a.nearDistance}readOffsetFromStart(e,t){return t.offsetfromstart??null}readOrientationAccuracy(e,t){const{accuracy:r,orientationaccuracy:o}=t;return o?.split(";").map(Number)??r?.split(";").map(Number)??null}writeOrientationAccuracy(e,t){e&&(t.orientationAccuracy=e.join(";"))}readOIType(e,t){const{orientedimagerytype:r,oitype:o,camerapitch:a,campitch:i,layer:n}=t,s=h.read(r??o??n.orientedImageryType),p=a??i??n.cameraPitch;return"oblique"===s?p<10?"nadir":"oblique":s}set radial(e){if(e)if("string"!=typeof e)this._set("radial",e);else{const[t,r,o]=e.split(";").map(Number);this._set("radial",[t??0,r??0,o??0])}else this._set("radial",[0,0,0])}readSequenceOrder(e,t){const{layer:r}=t;return t[r.sequenceOrderField.toLowerCase()]}writeSequenceOrder(e,t){if(!e)return;const{sourceMap:r}=this;if(r){t[r.sequenceorder]=e}}set tangential(e){if(e)if("string"!=typeof e)this._set("tangential",e);else{const[t,r]=e.split(";").map(Number);this._set("tangential",[t??0,r??0])}else this._set("tangential",[0,0])}readVFOV(e,t){const{verticalfieldofview:r,vfov:o,layer:a}=t;return r??o??a.verticalFieldOfView}_parseIfJSON(e){let t=null;try{t=JSON.parse(e)}catch(r){a.getLogger(this).error("couldn't parse the given elevation source JSON",e,r)}return t}};e([i()],I.prototype,"_geometry",void 0),e([i(b())],I.prototype,"a0",void 0),e([i(b())],I.prototype,"a1",void 0),e([i(b())],I.prototype,"a2",void 0),e([i({type:Date,json:{write:{enabled:!0,target:"acquisitionDate"},name:"acquisitiondate"}})],I.prototype,"acquisitionDate",void 0),e([i(b())],I.prototype,"b0",void 0),e([i(b())],I.prototype,"b1",void 0),e([i(b())],I.prototype,"b2",void 0),e([i({type:Number,json:{write:!0,read:{source:["cameraheading","camheading","layer.cameraHeading"]}}})],I.prototype,"cameraHeading",void 0),e([p("cameraHeading")],I.prototype,"readCameraHeading",null),e([i({type:Number,json:{write:!0}})],I.prototype,"cameraHeight",void 0),e([p("cameraHeight",["cameraheight","avghtag","layer.cameraHeight"])],I.prototype,"readCameraHeight",null),e([i()],I.prototype,"cameraOffset",void 0),e([p("cameraOffset",["cameraoffset","camoffset"])],I.prototype,"readCamOffset",null),e([l("cameraOffset")],I.prototype,"writeCameraOffset",null),e([i({json:{write:{writer:(e,t,r)=>{t[r]=e.toString()}}},type:d}),n((e=>e?y.getCameraOrientation(e):null))],I.prototype,"cameraOrientation",void 0),e([p("cameraOrientation",["cameraorientation","camori"])],I.prototype,"readCameraOrientation",null),e([i({type:Number,json:{write:!0}})],I.prototype,"cameraPitch",void 0),e([p("cameraPitch",["camerapitch","campitch","layer.cameraPitch"])],I.prototype,"readCameraPitch",null),e([i({type:Number,json:{write:!0}})],I.prototype,"cameraRoll",void 0),e([p("cameraRoll",["cameraroll","camroll","layer.cameraRoll"])],I.prototype,"readCameraRoll",null),e([i({json:{write:!0},type:String})],I.prototype,"depthImage",void 0),e([p("depthImage",["depthimage","depthimg"])],I.prototype,"readDepthImage",null),e([i({type:Number,json:{write:!0}})],I.prototype,"elevation",void 0),e([i({json:{write:!0},clonable:"reference"})],I.prototype,"elevationSource",void 0),e([p("elevationSource",["elevationsource","layer.effectiveElevationSource"])],I.prototype,"readElevationSource",null),e([i({json:{name:"exposurestationid",write:{target:"exposureStationId"}},type:String})],I.prototype,"exposureStationId",void 0),e([i({type:Number,json:{write:!0}})],I.prototype,"farDistance",void 0),e([p("farDistance",["fardistance","fardist","layer.farDistance"])],I.prototype,"readFarDistance",null),e([i(b("focallength"))],I.prototype,"focalLength",void 0),e([i({type:m,json:{name:"geometry"}})],I.prototype,"geometry",null),e([i({type:Number,json:{write:!0}})],I.prototype,"horizontalFieldOfView",void 0),e([p("horizontalFieldOfView",["horizontalfieldofview","hfov","layer.horizontalFieldOfView"])],I.prototype,"readHFOV",null),e([i({json:{write:!0},type:String})],I.prototype,"imagePath",void 0),e([p("imagePath",["imagepath"])],I.prototype,"readImageURL",null),e([i({type:Number,json:{write:!0}})],I.prototype,"imageRotation",void 0),e([p("imageRotation",["imagerotation","imgrot","layer.imageRotation"])],I.prototype,"readImageRotation",null),e([i()],I.prototype,"isHorizontal",null),e([i()],I.prototype,"isInspection",null),e([i()],I.prototype,"isNadir",null),e([i()],I.prototype,"isOblique",null),e([i()],I.prototype,"isSpherical",null),e([i()],I.prototype,"location",null),e([i(S())],I.prototype,"matrix",null),e([i({json:{write:!0},type:String})],I.prototype,"name",void 0),e([i({type:Number,json:{write:!0}})],I.prototype,"nearDistance",void 0),e([p("nearDistance",["neardistance","neardist","layer.nearDistance"])],I.prototype,"readNearDistance",null),e([i({json:{write:!0,name:"objectid"},type:Number})],I.prototype,"objectId",void 0),e([i({type:Number,json:{write:!0}})],I.prototype,"offsetFromStart",void 0),e([p("offsetFromStart",["offsetfromstart"])],I.prototype,"readOffsetFromStart",null),e([i()],I.prototype,"orientationAccuracy",void 0),e([p("orientationAccuracy",["accuracy","orientationaccuracy"])],I.prototype,"readOrientationAccuracy",null),e([l("orientationAccuracy")],I.prototype,"writeOrientationAccuracy",null),e([s(h)],I.prototype,"orientedImageryType",void 0),e([p("orientedImageryType",["orientedimagerytype","oitype","layer.orientedImageryType"])],I.prototype,"readOIType",null),e([i({type:Number,json:{write:!0,read:{source:"principalx"}}})],I.prototype,"principalX",void 0),e([i({type:Number,json:{write:!0,read:{source:"principaly"}}})],I.prototype,"principalY",void 0),e([i(S([0,0,0]))],I.prototype,"radial",null),e([i({type:String})],I.prototype,"sequenceOrder",void 0),e([p("sequenceOrder",["sequenceorder","layer.sequenceOrderField"])],I.prototype,"readSequenceOrder",null),e([l("sequenceOrder")],I.prototype,"writeSequenceOrder",null),e([i({type:Object})],I.prototype,"sourceMap",void 0),e([i(S([0,0]))],I.prototype,"tangential",null),e([i({type:Number,json:{write:!0}})],I.prototype,"verticalFieldOfView",void 0),e([p("verticalFieldOfView",["verticalfieldofview","vfov","layer.verticalFieldOfView"])],I.prototype,"readVFOV",null),I=e([c("esri.layers.orientedImagery.core.ExposurePoint")],I);export{I as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Clonable.js";import r from"../../../core/Error.js";import o from"../../../core/JSONSupport.js";import a from"../../../core/Logger.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import{cast as n}from"../../../core/accessorSupport/decorators/cast.js";import{enumeration as s}from"../../../core/accessorSupport/decorators/enumeration.js";import{reader as p}from"../../../core/accessorSupport/decorators/reader.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../../../core/accessorSupport/decorators/writer.js";import m from"../../../geometry/Point.js";import{getGeometryZScaler as u}from"../../../geometry/support/zscale.js";import y from"./CameraOrientation.js";import d from"./cameraOrientationFactory.js";import{appendPrefixAndSuffix as f,getEffectiveElevationSource as g,getMetersPerUnitOfSR as h,orientedImageryTypeMap as v}from"./utils.js";import{CameraOrientationType as w}from"../enums/CameraOrientationType.js";import{ltpToGeographic as O}from"../transformations/utils.js";function j(e){throw new r("exposure-point:missing-default-value",`a value for ${e} is missing in default properties`)}function b(e,t){throw new r("exposure-point:missing-attribute-value",`a value for ${e} is missing in attribute table`,{exposurePoint:t})}const S=e=>({cast:e=>{const t=parseFloat(e);return Number.isFinite(t)?t:void 0},json:{name:e,write:{writer:(e,t,r)=>{t[r]=Number.isFinite(e)?e:void 0}}}}),N=e=>({cast:e=>"string"==typeof e?e.split(";").map(Number):e,json:{default:e,write:{writer:(e,t,r)=>{t[r]=e?.join(";")}}}});let I=class extends(t.ClonableMixin(o)){constructor(e){super(e),this._geometry=null,this.cameraOrientation=null,this.elevation=null,this.elevationSource=null,this.name=null,this.sourceMap=null}read(e,t){const r={},{attributes:o,geometry:a}=e,i={};for(const s in o)r[s.toLowerCase()]=o[s],i[s.toLowerCase()]=s;const n=e.layer??{};n.sequenceOrderField?.length&&(r.sequenceorder=o[n.sequenceOrderField],i.sequenceorder=n.sequenceOrderField),super.read({geometry:a,layer:n,sourceMap:i,...r},t)}write(e,t){const r=super.write(e,t),{sourceMap:o}=this;if(!o||!r)return r;const a={};for(const i in r){const e=o[i.toLowerCase()];e&&(a[e]=r[i])}return a}readCameraHeading(e,t){const{cameraheading:r,camheading:o,layer:a}=t;return r??o??a.cameraHeading}readCameraHeight(e,t){const{cameraheight:r,avghtag:o,layer:a}=t;return r??o??a.cameraHeight}readCamOffset(e,t){const{cameraoffset:r,camoffset:o}=t;return r?.split(";").map(Number)??o?.split(";").map(Number)??null}writeCameraOffset(e,t){e&&(t.cameraOffset=e.join(";"))}readCameraOrientation(e,t){const{cameraorientation:r,camori:o}=t;return r??o}readCameraPitch(e,t){const{camerapitch:r,campitch:o,layer:a}=t;return r??o??a.cameraPitch}readCameraRoll(e,t){const{cameraroll:r,camroll:o,layer:a}=t;return r??o??a.cameraRoll}readDepthImage(e,t){const{depthimage:r,depthimg:o,layer:a}=t,i=r??o??null,{depthImagePathPrefix:n,depthImagePathSuffix:s}=a??{};return f(i,n,s)}readElevationSource(e,t){const{elevationsource:r,layer:o}=t,{demPathSuffix:a,demPathPrefix:i}=o;if(r){const e=this._parseIfJSON(r);return g(e,i,a)}return o.effectiveElevationSource}readFarDistance(e,t){const{fardistance:r,fardist:o,layer:a}=t;return r??o??a.farDistance}get geometry(){const e=this._geometry.clone();if(!e)return null;const{cameraOffset:t}=this;if(t){const[r,o,a]=t;e.x+=r,e.y+=o,null!=e.z&&null!=a&&(e.z+=a)}return e}set geometry(e){this._geometry=e}writeGeometry(e,t){t.geometry=this._geometry.toJSON()}readHFOV(e,t){const{horizontalfieldofview:r,hfov:o,layer:a}=t;return r??o??a.horizontalFieldOfView}readImageURL(e,t){const{imagepath:r,layer:o}=t;r||b("imagePath",this);const{imagePathPrefix:a,imagePathSuffix:i}=o;return f(r,a,i)}readImageRotation(e,t){const{imagerotation:r,imgrot:o,layer:a}=t;return r??o??a.imageRotation}get isHorizontal(){return"horizontal"===this.orientedImageryType}get isInspection(){return"inspection"===this.orientedImageryType}get isNadir(){return"nadir"===this.orientedImageryType}get isOblique(){return"oblique"===this.orientedImageryType}get isSpherical(){return"360"===this.orientedImageryType}get location(){const{cameraOrientation:e,cameraHeight:t,elevation:r}=this;if(e){const{type:t,x:r,y:o,z:a,horizontalWKID:i,verticalWKID:n}=e,s="number"==typeof i?{wkid:i}:{wkt:i};if(t===w.LTP){const{latitude:t,longitude:r,ellipsoidRadius:o,squaredEccentricity:a,properties:i}=e,{x:n,y:s,z:p}=i;return new m(O([n,s,p],[t,r,o,a]))}const p=new m({x:r,y:o,z:a,spatialReference:s}),c=n?u("point",{wkid:n},s):null;return c&&c(p),p}if("number"!=typeof t)throw j("cameraHeight");const o=this.geometry.clone();return o.z=o.hasZ?o.z:(r??0)+t/h(o.spatialReference),o}set matrix(e){if(!e||9!==e.length)return a.getLogger(this).warn("Ignoring rotation matrix because it doesn't have 9 values",{value:e}),void this._set("matrix",null);this._set("matrix",e)}readNearDistance(e,t){const{neardistance:r,neardist:o,layer:a}=t;return r??o??a.nearDistance}readOffsetFromStart(e,t){return t.offsetfromstart??null}readOrientationAccuracy(e,t){const{accuracy:r,orientationaccuracy:o}=t;return o?.split(";").map(Number)??r?.split(";").map(Number)??null}writeOrientationAccuracy(e,t){e&&(t.orientationAccuracy=e.join(";"))}readOIType(e,t){const{orientedimagerytype:r,oitype:o,camerapitch:a,campitch:i,layer:n}=t,s=v.read(r??o??n.orientedImageryType),p=a??i??n.cameraPitch;return"oblique"===s?p<10?"nadir":"oblique":s}set radial(e){if(e)if("string"!=typeof e)this._set("radial",e);else{const[t,r,o]=e.split(";").map(Number);this._set("radial",[t??0,r??0,o??0])}else this._set("radial",[0,0,0])}readSequenceOrder(e,t){const{layer:r}=t;return t[r.sequenceOrderField.toLowerCase()]}writeSequenceOrder(e,t){if(!e)return;const{sourceMap:r}=this;if(r){t[r.sequenceorder]=e}}set tangential(e){if(e)if("string"!=typeof e)this._set("tangential",e);else{const[t,r]=e.split(";").map(Number);this._set("tangential",[t??0,r??0])}else this._set("tangential",[0,0])}readVFOV(e,t){const{verticalfieldofview:r,vfov:o,layer:a}=t;return r??o??a.verticalFieldOfView}_parseIfJSON(e){let t=null;try{t=JSON.parse(e)}catch(r){a.getLogger(this).error("couldn't parse the given elevation source JSON",e,r)}return t}clone(){const e=super.clone();return e._geometry=this._geometry.clone(),e}};e([i()],I.prototype,"_geometry",void 0),e([i(S())],I.prototype,"a0",void 0),e([i(S())],I.prototype,"a1",void 0),e([i(S())],I.prototype,"a2",void 0),e([i({type:Date,json:{write:{enabled:!0,target:"acquisitionDate"},name:"acquisitiondate"}})],I.prototype,"acquisitionDate",void 0),e([i(S())],I.prototype,"b0",void 0),e([i(S())],I.prototype,"b1",void 0),e([i(S())],I.prototype,"b2",void 0),e([i({type:Number,json:{write:!0,read:{source:["cameraheading","camheading","layer.cameraHeading"]}}})],I.prototype,"cameraHeading",void 0),e([p("cameraHeading")],I.prototype,"readCameraHeading",null),e([i({type:Number,json:{write:!0}})],I.prototype,"cameraHeight",void 0),e([p("cameraHeight",["cameraheight","avghtag","layer.cameraHeight"])],I.prototype,"readCameraHeight",null),e([i()],I.prototype,"cameraOffset",void 0),e([p("cameraOffset",["cameraoffset","camoffset"])],I.prototype,"readCamOffset",null),e([l("cameraOffset")],I.prototype,"writeCameraOffset",null),e([i({json:{write:{writer:(e,t,r)=>{t[r]=e.toString()}}},type:y}),n((e=>e?d.getCameraOrientation(e):null))],I.prototype,"cameraOrientation",void 0),e([p("cameraOrientation",["cameraorientation","camori"])],I.prototype,"readCameraOrientation",null),e([i({type:Number,json:{write:!0}})],I.prototype,"cameraPitch",void 0),e([p("cameraPitch",["camerapitch","campitch","layer.cameraPitch"])],I.prototype,"readCameraPitch",null),e([i({type:Number,json:{write:!0}})],I.prototype,"cameraRoll",void 0),e([p("cameraRoll",["cameraroll","camroll","layer.cameraRoll"])],I.prototype,"readCameraRoll",null),e([i({json:{write:!0},type:String})],I.prototype,"depthImage",void 0),e([p("depthImage",["depthimage","depthimg"])],I.prototype,"readDepthImage",null),e([i({type:Number,json:{write:!0}})],I.prototype,"elevation",void 0),e([i({json:{write:!0},clonable:"reference"})],I.prototype,"elevationSource",void 0),e([p("elevationSource",["elevationsource","layer.effectiveElevationSource"])],I.prototype,"readElevationSource",null),e([i({json:{name:"exposurestationid",write:{target:"exposureStationId"}},type:String})],I.prototype,"exposureStationId",void 0),e([i({type:Number,json:{write:!0}})],I.prototype,"farDistance",void 0),e([p("farDistance",["fardistance","fardist","layer.farDistance"])],I.prototype,"readFarDistance",null),e([i(S("focallength"))],I.prototype,"focalLength",void 0),e([i({type:m,json:{name:"geometry"}})],I.prototype,"geometry",null),e([l("geometry")],I.prototype,"writeGeometry",null),e([i({type:Number,json:{write:!0}})],I.prototype,"horizontalFieldOfView",void 0),e([p("horizontalFieldOfView",["horizontalfieldofview","hfov","layer.horizontalFieldOfView"])],I.prototype,"readHFOV",null),e([i({json:{write:!0},type:String})],I.prototype,"imagePath",void 0),e([p("imagePath",["imagepath"])],I.prototype,"readImageURL",null),e([i({type:Number,json:{write:!0}})],I.prototype,"imageRotation",void 0),e([p("imageRotation",["imagerotation","imgrot","layer.imageRotation"])],I.prototype,"readImageRotation",null),e([i()],I.prototype,"isHorizontal",null),e([i()],I.prototype,"isInspection",null),e([i()],I.prototype,"isNadir",null),e([i()],I.prototype,"isOblique",null),e([i()],I.prototype,"isSpherical",null),e([i()],I.prototype,"location",null),e([i(N())],I.prototype,"matrix",null),e([i({json:{write:!0},type:String})],I.prototype,"name",void 0),e([i({type:Number,json:{write:!0}})],I.prototype,"nearDistance",void 0),e([p("nearDistance",["neardistance","neardist","layer.nearDistance"])],I.prototype,"readNearDistance",null),e([i({json:{write:!0,name:"objectid"},type:Number})],I.prototype,"objectId",void 0),e([i({type:Number,json:{write:!0}})],I.prototype,"offsetFromStart",void 0),e([p("offsetFromStart",["offsetfromstart"])],I.prototype,"readOffsetFromStart",null),e([i()],I.prototype,"orientationAccuracy",void 0),e([p("orientationAccuracy",["accuracy","orientationaccuracy"])],I.prototype,"readOrientationAccuracy",null),e([l("orientationAccuracy")],I.prototype,"writeOrientationAccuracy",null),e([s(v)],I.prototype,"orientedImageryType",void 0),e([p("orientedImageryType",["orientedimagerytype","oitype","layer.orientedImageryType"])],I.prototype,"readOIType",null),e([i({type:Number,json:{write:!0,read:{source:"principalx"}}})],I.prototype,"principalX",void 0),e([i({type:Number,json:{write:!0,read:{source:"principaly"}}})],I.prototype,"principalY",void 0),e([i(N([0,0,0]))],I.prototype,"radial",null),e([i({type:String})],I.prototype,"sequenceOrder",void 0),e([p("sequenceOrder",["sequenceorder","layer.sequenceOrderField"])],I.prototype,"readSequenceOrder",null),e([l("sequenceOrder")],I.prototype,"writeSequenceOrder",null),e([i({type:Object})],I.prototype,"sourceMap",void 0),e([i(N([0,0]))],I.prototype,"tangential",null),e([i({type:Number,json:{write:!0}})],I.prototype,"verticalFieldOfView",void 0),e([p("verticalFieldOfView",["verticalfieldofview","vfov","layer.verticalFieldOfView"])],I.prototype,"readVFOV",null),I=e([c("esri.layers.orientedImagery.core.ExposurePoint")],I);export{I as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{throwIfAborted as e}from"../../../core/promiseUtils.js";import{create as t}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{zeros as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transpose as n}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{a,f as o}from"../../../chunks/vec32.js";import i from"../../../geometry/Circle.js";import c from"../../../geometry/Mesh.js";import s from"../../../geometry/Multipoint.js";import f from"../../../geometry/Polygon.js";import{projectWithZConversion as l}from"../../../geometry/projectionUtils.js";import m from"../../../geometry/SpatialReference.js";import{earth as u}from"../../../geometry/support/Ellipsoid.js";import h from"../../../geometry/support/MeshComponent.js";import{MeshVertexAttributes as p}from"../../../geometry/support/MeshVertexAttributes.js";import{create as y,fromArray as g,intersectRay as x}from"../../../geometry/support/plane.js";import{isWebMercator as d}from"../../../geometry/support/spatialReferenceUtils.js";import{getWebMercatorScalingFactor as w,createRotationMatrixFromHPR as M,transformMat3 as R,scaleAndAddWithFactor as j,scaleWithFactor as v,computeHFOVAndVFOV as P,projectiveTransform as D}from"../transformations/utils.js";const b=Math.PI/180;function A(e){return e.isSpherical?H(e):I(e)}function I(e){const{horizontalFieldOfView:t,verticalFieldOfView:r,geometry:n,cameraHeading:a}=e,o=w(n.y,n.spatialReference);let i=e.cameraPitch,c=e.cameraRoll??0,s=150;t>150&&(i=90,c=0,s=5);const l=Math.ceil(t/s),m=z(l,a,t);let u=e.farDistance?e.farDistance*o:e.cameraHeight*o/Math.cos(i*b);e.cameraPitch+r/2>=90&&(u=(e.farDistance||20)*o);const h=new f({spatialReference:n?.spatialReference});h.imageID=e.objectId;let p=null;for(const f of m)p=V(f,i,e.cameraHeight,n,u,o,r,t,l,h,c,e.nearDistance);return p.imageID=e.objectId,{polygon:h,frustum:p}}function z(e,t,r){const n=[];if(e%2==0)for(let a=0;a<e/2;a++)n.push(t-r/e*(a+.5),t+r/e*(a+.5));else{n.push(t);for(let a=1;a<e/2;a++)n.push(t-r/e*a,t+r/e*a)}return n.sort(),n}function V(e,i,c,s,f,l,m,u,h,p,y=0,g=0){const x=n(t(),M([e,i,y??0])),d=q({cameraHeight:c,cameraPitch:i,farDistance:f,location:s,horizontalFieldOfView:u,nearDistance:g,verticalFieldOfView:m},x),w=R([0,0,-1],x),{x:P,y:D}=s,A=j([P,D,c],w,f,l),I=2*Math.tan(m*b/2)*f,z=2*Math.tan(u/h*b/2)*f,V=R([0,1,0],x),H=R([1,0,0],x),O=v(V,I/2,l),S=v(H,z/2,l),C=a(r(),O,S),U=o(r(),O,S),E=F([o(r(),A,C),o(r(),A,U),a(r(),A,C),a(r(),A,U)],c,s,l);return E.push(E[0]),p.addRing(E),d}function F(e,t,r,n){return e.map((e=>C(e,t,r,n)))}function H(e){const{geometry:t,farDistance:r,objectId:n,nearDistance:a,cameraHeight:o}=e,s=w(t.y,t.spatialReference),f=new i({center:t.clone(),radius:r*s});if(f.imageID=n,a){const e=new i({center:t.clone(),radius:a*s});f.addRing(e.rings[0])}const l=t.clone();l.z=o-r*s;const m=c.createSphere(l,{size:2*r*s});return m.imageID=n,{polygon:f,frustum:m}}function O(e,t){return e.contains(t)}function S(e,t){return Math.sign(e)!==Math.sign(t)}function q(e,t,n){const{cameraHeight:i,cameraPitch:s,farDistance:f,location:l,horizontalFieldOfView:m,nearDistance:u,verticalFieldOfView:h}=e,y=E(l),g=s+h/2>=90==!1,x=2*Math.tan(h*b/2)*u,d=2*Math.tan(m*b/2)*u,w=2*Math.tan(h*b/2)*f,M=2*Math.tan(m*b/2)*f;let P,D;D=[0,0,-1],D=R(D,t),P=j([l.x,l.y,i],D,f,y),g&&(P[2]=0);const A=j([l.x,l.y,i],D,u,y);let I=[0,1,0];I=R(I,t);let z=[1,0,0];z=R(z,t);let V=[],F=[];u?(F=[{faces:[4,0,3,4,7,3]},{faces:[5,1,2,5,6,2]},{faces:[4,0,1,4,5,1]},{faces:[6,2,3,6,7,3]}],V=V.concat(o(r(),A,a(r(),v(I,x/2,y),v(z,d/2,y)))),V=V.concat(o(r(),A,o(r(),v(I,x/2,y),v(z,d/2,y)))),V=V.concat(a(r(),A,a(r(),v(I,x/2,y),v(z,d/2,y)))),V=V.concat(a(r(),A,o(r(),v(I,x/2,y),v(z,d/2,y))))):(V=[l.x,l.y,i],F=[{faces:[0,1,2,0,2,3,0,3,4,0,4,1]}]),V=V.concat(o(r(),P,a(r(),v(I,w/2,y),v(z,M/2,y)))),V=V.concat(o(r(),P,o(r(),v(I,w/2,y),v(z,M/2,y)))),V=V.concat(a(r(),P,a(r(),v(I,w/2,y),v(z,M/2,y)))),V=V.concat(a(r(),P,o(r(),v(I,w/2,y),v(z,M/2,y))));const H=new p({position:Float64Array.from(V)});return new c({vertexAttributes:H,components:F,spatialReference:l.spatialReference})}function C(e,t,n,o){{const i=Math.sqrt((e[2]-t)**2+(Math.sqrt((e[0]-n.x)**2+(e[1]-n.y)**2)/o)**2)*o,c=v(a(r(),[e[0],e[1],e[2]],[n.x,n.y,t]),1/i,1/o),s=t/(t-e[2]),f={x:(1-s)*n.x+s*e[0],y:(1-s)*n.y+s*e[1],z:(1-s)*t+s*e[2]},l=Math.sqrt((f.z-t)**2+(Math.sqrt((f.x-n.x)**2+(f.y-n.y)**2)/o)**2)*o,m=v(a(r(),[f.x,f.y,f.z],[n.x,n.y,t]),1/l,1/o);return S(c[0],m[0])&&S(c[1],m[1])&&S(c[2],m[2])||e[2]>=0?[e[0],e[1],0]:[f.x,f.y,f.z]}}function U(e){const{spatialReference:t,x:r,y:n}=e.geometry,{cameraHeading:a,cameraPitch:o,farDistance:i,nearDistance:c}=e,s=E(e.geometry),l=new f({spatialReference:t}),m=Math.abs(1.44*i*s);let u=Math.abs(1.44*c*s);(o<20||null==a)&&(u=m);const h=[];return h[0]={x:r+m*Math.sin((a-45)*b),y:n+m*Math.cos((a-45)*b)},h[1]={x:r+m*Math.sin((a+45)*b),y:n+m*Math.cos((a+45)*b)},h[2]={x:r+u*Math.sin((a+135)*b),y:n+u*Math.cos((a+135)*b)},h[3]={x:r+u*Math.sin((a+225)*b),y:n+u*Math.cos((a+225)*b)},l.addRing([[h[0].x,h[0].y,0],[h[1].x,h[1].y,0],[h[2].x,h[2].y,0],[h[3].x,h[3].y,0],[h[0].x,h[0].y,0]]),l}function E(e){return e&&d(e?.spatialReference)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*e.y/u.radius))):1}function k(e,t){const n=1+t/100;if("esri.geometry.Circle"===e.declaredClass){const{radius:t,center:r}=e,a=new i({radius:t*n,center:r});return e.rings.length>1&&a.addRing(e.rings[1]),a}if("esri.geometry.Polygon"===e.declaredClass){const t=new f({spatialReference:e.spatialReference}),o=e.centroid;if(o){const i=[];for(let t=0;t<e.rings[0].length;t++){const c=Math.sqrt((o.x-e.rings[0][t][0])**2+(o.y-e.rings[0][t][1])**2),s=v(a(r(),[e.rings[0][t][0],e.rings[0][t][1],0],[o.x,o.y,0]),1/c,1),f=j([o.x,o.y,0],s,c*n,1);i.push({x:f[0],y:f[1]})}t.addRing([[i[0].x,i[0].y,0],[i[1].x,i[1].y,0],[i[2].x,i[2].y,0],[i[3].x,i[3].y,0],[i[0].x,i[0].y,0]])}return t}return e}async function L(e,t,r){const{cameraHeight:n,cameraLocation:a,cameraPitch:o,frustumVertices:i,horizontalFieldOfView:c,imageHeight:s,imageWidth:f,inSRS:l,outSRS:u,verticalFieldOfView:h,cameraRoll:p,options:y}=r,g=new m(l),x=new m(u),d=P(c,h,p??0),w=i.length>15;return o+d.vfov/2>=90?await K(i,e,f,s,g,x,w,y):await W(i,e,t,a,n,w,g,x,y)}async function W(e,t,r,n,a,o,i,s,f){const l=B(e,t,r,n,a);if(!l)return;const{farPlane:m,nearPlane:u}=l,h=await N([...u?.vertexPositions??e.slice(0,3),...m.vertexPositions],i,s,f),y=Z(h);return new c({vertexAttributes:new p({position:h}),components:Y(o?T(y,!0):X(y,!0)),spatialReference:s})}function B(e,t,r,n,a){const o=Q(e),i=Q(e,"near");if(!o)return;const c=t.length;for(let s=0;s<c;s++){const e=Array.from(r[s]),t=[e[0]-n[0],e[1]-n[1],e[2]-(n[2]??a)];J(n,t,s,i),G(n,t,s,o)}return{farPlane:o,nearPlane:i}}function G(e,t,n,a){const{coefficients:o,vertexPositions:i}=a,c=r();x(o,{origin:e,direction:t},c)&&i.splice(3*n,3,...c)}function J(e,t,n,a){if(!a)return;const o=r();x(a.coefficients,{origin:e,direction:t},o)&&a.vertexPositions.splice(3*n,3,...o)}async function K(e,t,r,n,a,o,i,s){let f,l=i?new Array:[e[0],e[1],e[2]],m=new Array;for(const c of t)i?(f=D([c[0],c[1],1],[[0,0,1],[r,0,1],[r,n,1],[0,n,1]],[[e[0],e[1],e[2]],[e[3],e[4],e[5]],[e[6],e[7],e[8]],[e[9],e[10],e[11]]]),l=l.concat(...f),f=D([c[0],c[1],1],[[0,0,1],[r,0,1],[r,n,1],[0,n,1]],[[e[12],e[13],e[14]],[e[15],e[16],e[17]],[e[18],e[19],e[20]],[e[21],e[22],e[23]]]),m=m.concat(...f)):(f=D([c[0],c[1],1],[[0,0,1],[r,0,1],[r,n,1],[0,n,1]],[[e[3],e[4],e[5]],[e[6],e[7],e[8]],[e[9],e[10],e[11]],[e[12],e[13],e[14]]]),l=l.concat(...f));l=l.concat(m);const u=await N(l,a,o,s),h=Z(u);return new c({vertexAttributes:new p({position:u}),components:Y(i?T(h,!0):X(h,!0)),spatialReference:o})}async function N(t,r,n,a){if(r.equals(n))return t;const o=t.reduce(((e,t,r)=>{const n=Math.floor(r/3);return e[n]||(e[n]=new Array),e[n].push(t),e}),new Array),{points:i}=await l(new s(o,r),n,a);return e(a),i.flat()}function Q(e,t="far"){const r=y();let n;switch(t){case"far":if(n=Array.from(15===e.length?e.slice(3):e.slice(12)),g(r,n,!1))return{coefficients:r,vertexPositions:n};break;case"near":if(n=Array.from(e.slice(0,12)),15===e.length||!g(r,n,!1))return;return{coefficients:r,vertexPositions:n}}}const T=(e,t=!1)=>{if(t&&e-2<=4||e<=4||e%2!=0)throw new Error("Invalid number of vertices");const r=[],n=e/2,a=Math.round((t?e-2:e)/2);for(let o=0;o<a;o++){const a=o+n,i=t?a+1:a,c=i%e,s=(t?a:i+1)%e;r.push({faces:new Uint32Array([o,s,c,o,o+1,c])})}return r};function X(e,t=!1){if(e<3||t&&e-1<3)throw new Error("Invalid number of vertices");const r=[],n=t?e-2:e-1;for(let a=0;a<n;a++)r.push({faces:new Uint32Array([0,a+1,a+2])});return r}const Y=e=>e.map((e=>new h(e))),Z=e=>e.length/3;export{O as checkIfPolygonContainsSelectedPoint,U as computePolygonForInspection,A as createCoveragePolygon,F as limitZToGround,N as projectVertices,k as resizePolygon,L as updateFrustum};
5
+ import{throwIfAborted as e}from"../../../core/promiseUtils.js";import{create as t}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{zeros as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transpose as n}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{a,f as o}from"../../../chunks/vec32.js";import i from"../../../geometry/Circle.js";import c from"../../../geometry/Mesh.js";import s from"../../../geometry/Multipoint.js";import f from"../../../geometry/Polygon.js";import{projectWithZConversion as l}from"../../../geometry/projectionUtils.js";import m from"../../../geometry/SpatialReference.js";import{earth as u}from"../../../geometry/support/Ellipsoid.js";import h from"../../../geometry/support/MeshComponent.js";import{MeshVertexAttributes as p}from"../../../geometry/support/MeshVertexAttributes.js";import{create as y,fromArray as g,intersectRay as x}from"../../../geometry/support/plane.js";import{isWebMercator as d}from"../../../geometry/support/spatialReferenceUtils.js";import{convertToSRUnits as w,getWebMercatorScalingFactor as M,createRotationMatrixFromHPR as R,transformMat3 as j,scaleAndAddWithFactor as v,scaleWithFactor as P,computeHFOVAndVFOV as D,projectiveTransform as b}from"../transformations/utils.js";const A=Math.PI/180;function I(e){const t=w(e,e.geometry.spatialReference);return e.isSpherical?O(t):z(t)}function z(e){const{horizontalFieldOfView:t,verticalFieldOfView:r,geometry:n,cameraHeading:a}=e,o=M(n.y,n.spatialReference);let i=e.cameraPitch,c=e.cameraRoll??0,s=150;t>150&&(i=90,c=0,s=5);const l=Math.ceil(t/s),m=V(l,a,t);let u=e.farDistance?e.farDistance*o:e.cameraHeight*o/Math.cos(i*A);e.cameraPitch+r/2>=90&&(u=(e.farDistance||20)*o);const h=new f({spatialReference:n?.spatialReference});h.imageID=e.objectId;let p=null;for(const f of m)p=F(f,i,e.cameraHeight,n,u,o,r,t,l,h,c,e.nearDistance);return p.imageID=e.objectId,{polygon:h,frustum:p}}function V(e,t,r){const n=[];if(e%2==0)for(let a=0;a<e/2;a++)n.push(t-r/e*(a+.5),t+r/e*(a+.5));else{n.push(t);for(let a=1;a<e/2;a++)n.push(t-r/e*a,t+r/e*a)}return n.sort(),n}function F(e,i,c,s,f,l,m,u,h,p,y=0,g=0){const x=n(t(),R([e,i,y??0])),d=C({cameraHeight:c,cameraPitch:i,farDistance:f,location:s,horizontalFieldOfView:u,nearDistance:g,verticalFieldOfView:m},x),w=j([0,0,-1],x),{x:M,y:D}=s,b=v([M,D,c],w,f,l),I=2*Math.tan(m*A/2)*f,z=2*Math.tan(u/h*A/2)*f,V=j([0,1,0],x),F=j([1,0,0],x),O=P(V,I/2,l),S=P(F,z/2,l),q=a(r(),O,S),U=o(r(),O,S),E=H([o(r(),b,q),o(r(),b,U),a(r(),b,q),a(r(),b,U)],c,s,l);return E.push(E[0]),p.addRing(E),d}function H(e,t,r,n){return e.map((e=>U(e,t,r,n)))}function O(e){const{geometry:t,farDistance:r,objectId:n,nearDistance:a,cameraHeight:o}=e,s=M(t.y,t.spatialReference),f=new i({center:t.clone(),radius:r*s});if(f.imageID=n,a){const e=new i({center:t.clone(),radius:a*s});f.addRing(e.rings[0])}const l=t.clone();l.z=o-r*s;const m=c.createSphere(l,{size:2*r*s});return m.imageID=n,{polygon:f,frustum:m}}function S(e,t){return e.contains(t)}function q(e,t){return Math.sign(e)!==Math.sign(t)}function C(e,t,n){const{cameraHeight:i,cameraPitch:s,farDistance:f,location:l,horizontalFieldOfView:m,nearDistance:u,verticalFieldOfView:h}=e,y=k(l),g=s+h/2>=90==!1,x=2*Math.tan(h*A/2)*u,d=2*Math.tan(m*A/2)*u,w=2*Math.tan(h*A/2)*f,M=2*Math.tan(m*A/2)*f;let R,D;D=[0,0,-1],D=j(D,t),R=v([l.x,l.y,i],D,f,y),g&&(R[2]=0);const b=v([l.x,l.y,i],D,u,y);let I=[0,1,0];I=j(I,t);let z=[1,0,0];z=j(z,t);let V=[],F=[];u?(F=[{faces:[4,0,3,4,7,3]},{faces:[5,1,2,5,6,2]},{faces:[4,0,1,4,5,1]},{faces:[6,2,3,6,7,3]}],V=V.concat(o(r(),b,a(r(),P(I,x/2,y),P(z,d/2,y)))),V=V.concat(o(r(),b,o(r(),P(I,x/2,y),P(z,d/2,y)))),V=V.concat(a(r(),b,a(r(),P(I,x/2,y),P(z,d/2,y)))),V=V.concat(a(r(),b,o(r(),P(I,x/2,y),P(z,d/2,y))))):(V=[l.x,l.y,i],F=[{faces:[0,1,2,0,2,3,0,3,4,0,4,1]}]),V=V.concat(o(r(),R,a(r(),P(I,w/2,y),P(z,M/2,y)))),V=V.concat(o(r(),R,o(r(),P(I,w/2,y),P(z,M/2,y)))),V=V.concat(a(r(),R,a(r(),P(I,w/2,y),P(z,M/2,y)))),V=V.concat(a(r(),R,o(r(),P(I,w/2,y),P(z,M/2,y))));const H=new p({position:Float64Array.from(V)});return new c({vertexAttributes:H,components:F,spatialReference:l.spatialReference})}function U(e,t,n,o){{const i=Math.sqrt((e[2]-t)**2+(Math.sqrt((e[0]-n.x)**2+(e[1]-n.y)**2)/o)**2)*o,c=P(a(r(),[e[0],e[1],e[2]],[n.x,n.y,t]),1/i,1/o),s=t/(t-e[2]),f={x:(1-s)*n.x+s*e[0],y:(1-s)*n.y+s*e[1],z:(1-s)*t+s*e[2]},l=Math.sqrt((f.z-t)**2+(Math.sqrt((f.x-n.x)**2+(f.y-n.y)**2)/o)**2)*o,m=P(a(r(),[f.x,f.y,f.z],[n.x,n.y,t]),1/l,1/o);return q(c[0],m[0])&&q(c[1],m[1])&&q(c[2],m[2])||e[2]>=0?[e[0],e[1],0]:[f.x,f.y,f.z]}}function E(e){const{spatialReference:t,x:r,y:n}=e.geometry,{cameraHeading:a,cameraPitch:o,farDistance:i,nearDistance:c}=e,s=k(e.geometry),l=new f({spatialReference:t}),m=Math.abs(1.44*i*s);let u=Math.abs(1.44*c*s);(o<20||null==a)&&(u=m);const h=[];return h[0]={x:r+m*Math.sin((a-45)*A),y:n+m*Math.cos((a-45)*A)},h[1]={x:r+m*Math.sin((a+45)*A),y:n+m*Math.cos((a+45)*A)},h[2]={x:r+u*Math.sin((a+135)*A),y:n+u*Math.cos((a+135)*A)},h[3]={x:r+u*Math.sin((a+225)*A),y:n+u*Math.cos((a+225)*A)},l.addRing([[h[0].x,h[0].y,0],[h[1].x,h[1].y,0],[h[2].x,h[2].y,0],[h[3].x,h[3].y,0],[h[0].x,h[0].y,0]]),l}function k(e){return e&&d(e?.spatialReference)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*e.y/u.radius))):1}function L(e,t){const n=1+t/100;if("esri.geometry.Circle"===e.declaredClass){const{radius:t,center:r}=e,a=new i({radius:t*n,center:r});return e.rings.length>1&&a.addRing(e.rings[1]),a}if("esri.geometry.Polygon"===e.declaredClass){const t=new f({spatialReference:e.spatialReference}),o=e.centroid;if(o){const i=[];for(let t=0;t<e.rings[0].length;t++){const c=Math.sqrt((o.x-e.rings[0][t][0])**2+(o.y-e.rings[0][t][1])**2),s=P(a(r(),[e.rings[0][t][0],e.rings[0][t][1],0],[o.x,o.y,0]),1/c,1),f=v([o.x,o.y,0],s,c*n,1);i.push({x:f[0],y:f[1]})}t.addRing([[i[0].x,i[0].y,0],[i[1].x,i[1].y,0],[i[2].x,i[2].y,0],[i[3].x,i[3].y,0],[i[0].x,i[0].y,0]])}return t}return e}async function W(e,t,r){const{cameraHeight:n,cameraLocation:a,cameraPitch:o,frustumVertices:i,horizontalFieldOfView:c,imageHeight:s,imageWidth:f,inSRS:l,outSRS:u,verticalFieldOfView:h,cameraRoll:p,options:y}=r,g=new m(l),x=new m(u),d=D(c,h,p??0),w=i.length>15;return o+d.vfov/2>=90?await N(i,e,f,s,g,x,w,y):await B(i,e,t,a,n,w,g,x,y)}async function B(e,t,r,n,a,o,i,s,f){const l=G(e,t,r,n,a);if(!l)return;const{farPlane:m,nearPlane:u}=l,h=await Q([...u?.vertexPositions??e.slice(0,3),...m.vertexPositions],i,s,f),y=$(h);return new c({vertexAttributes:new p({position:h}),components:Z(o?X(y,!0):Y(y,!0)),spatialReference:s})}function G(e,t,r,n,a){const o=T(e),i=T(e,"near");if(!o)return;const c=t.length;for(let s=0;s<c;s++){const e=Array.from(r[s]),t=[e[0]-n[0],e[1]-n[1],e[2]-(n[2]??a)];K(n,t,s,i),J(n,t,s,o)}return{farPlane:o,nearPlane:i}}function J(e,t,n,a){const{coefficients:o,vertexPositions:i}=a,c=r();x(o,{origin:e,direction:t},c)&&i.splice(3*n,3,...c)}function K(e,t,n,a){if(!a)return;const o=r();x(a.coefficients,{origin:e,direction:t},o)&&a.vertexPositions.splice(3*n,3,...o)}async function N(e,t,r,n,a,o,i,s){let f,l=i?new Array:[e[0],e[1],e[2]],m=new Array;for(const c of t)i?(f=b([c[0],c[1],1],[[0,0,1],[r,0,1],[r,n,1],[0,n,1]],[[e[0],e[1],e[2]],[e[3],e[4],e[5]],[e[6],e[7],e[8]],[e[9],e[10],e[11]]]),l=l.concat(...f),f=b([c[0],c[1],1],[[0,0,1],[r,0,1],[r,n,1],[0,n,1]],[[e[12],e[13],e[14]],[e[15],e[16],e[17]],[e[18],e[19],e[20]],[e[21],e[22],e[23]]]),m=m.concat(...f)):(f=b([c[0],c[1],1],[[0,0,1],[r,0,1],[r,n,1],[0,n,1]],[[e[3],e[4],e[5]],[e[6],e[7],e[8]],[e[9],e[10],e[11]],[e[12],e[13],e[14]]]),l=l.concat(...f));l=l.concat(m);const u=await Q(l,a,o,s),h=$(u);return new c({vertexAttributes:new p({position:u}),components:Z(i?X(h,!0):Y(h,!0)),spatialReference:o})}async function Q(t,r,n,a){if(r.equals(n))return t;const o=t.reduce(((e,t,r)=>{const n=Math.floor(r/3);return e[n]||(e[n]=new Array),e[n].push(t),e}),new Array),{points:i}=await l(new s(o,r),n,a);return e(a),i.flat()}function T(e,t="far"){const r=y();let n;switch(t){case"far":if(n=Array.from(15===e.length?e.slice(3):e.slice(12)),g(r,n,!1))return{coefficients:r,vertexPositions:n};break;case"near":if(n=Array.from(e.slice(0,12)),15===e.length||!g(r,n,!1))return;return{coefficients:r,vertexPositions:n}}}const X=(e,t=!1)=>{if(t&&e-2<=4||e<=4||e%2!=0)throw new Error("Invalid number of vertices");const r=[],n=e/2,a=Math.round((t?e-2:e)/2);for(let o=0;o<a;o++){const a=o+n,i=t?a+1:a,c=i%e,s=(t?a:i+1)%e;r.push({faces:new Uint32Array([o,s,c,o,o+1,c])})}return r};function Y(e,t=!1){if(e<3||t&&e-1<3)throw new Error("Invalid number of vertices");const r=[],n=t?e-2:e-1;for(let a=0;a<n;a++)r.push({faces:new Uint32Array([0,a+1,a+2])});return r}const Z=e=>e.map((e=>new h(e))),$=e=>e.length/3;export{S as checkIfPolygonContainsSelectedPoint,E as computePolygonForInspection,I as createCoveragePolygon,H as limitZToGround,Q as projectVertices,L as resizePolygon,W as updateFrustum};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{JSONMap as e}from"../../../core/jsonMap.js";import{geographicToWebMercator as t}from"../../../geometry/support/webMercatorUtils.js";import r from"./cameraOrientationRegistry.js";import{isConstantElevation as n,ConstantElevation as i,ElevationSource as o}from"./ElevationSourceDefinitions.js";import{CameraOrientationType as s}from"../enums/CameraOrientationType.js";function l(e,t,r){return t&&(e=`${t}${e}`),r&&(e+=`${r}`),e}function a(e,t,r){let{url:n}=e;return n?(n=l(n,t,r),new o({...e,url:n})):null}function u(e,t,r){return e?n(e)?new i(e):a(e,t,r):e}const c=new e({Minutes:"minutes",Hours:"hours",Days:"days",Weeks:"weeks",Months:"months",Years:"years"}),f=new e({Feet:"feet",Meter:"meter"}),p=new e({360:"360",Horizontal:"horizontal",Inspection:"inspection",Nadir:"nadir",Oblique:"oblique",Terrestrial360Video:"terrestrial-360-video",TerrestrialFrameVideo:"terrestrial-frame-video",Aerial360Video:"aerial-360-video",AerialFrameVideo:"aerial-frame-video","":null}),m=new Map;function h(e){const[t,r,n,i,o,s,l,a,u,c,f,p,m,h,g,y,w,v,D,z,$,I]=e.slice(1);return{horizontalWKID:t,verticalWKID:r,x:n,y:i,z:o,omega:s,phi:l,kappa:a,...d([u,c,f,p,m,h],[y,w],[v,D,z],[$,I],g)}}m.set(`${s.HPR}`,y),m.set(`${s.YPR}`,w),m.set(`${s.OPK}`,h),m.set(`${s.LTP}`,v);const g=e=>{const t=e.map((e=>parseFloat(e))).filter((e=>!isNaN(e)));if(t.length===e.length)return t};function d(e,t,r,n,i){const o=g(e),s=g(t),l=g(r),a=g(n);return{affineTransformations:6===o?.length?o:void 0,focalLength:6===o?.length?parseFloat(i):void 0,principalOffsetPoint:2!==s?.length?[0,0]:s,radialDistortionCoefficients:3!==l?.length?[0,0,0]:l,tangentialDistortionCoefficients:2!==a?.length?[0,0]:a}}function y(e){const[t,r,n,i,o,s,l,a,u,c,f,p,m,h,g,y,w,v,D,z,$,I]=e.slice(1);return{horizontalWKID:t,verticalWKID:r,x:n,y:i,z:o,heading:s,pitch:l,roll:a,...d([u,c,f,p,m,h],[y,w],[v,D,z],[$,I],g)}}function w(e){const[t,r,n,i,o,s,l,a,u,c,f,p,m,h,g,y,w,v,D,z,$,I]=e.slice(1);return{horizontalWKID:t,verticalWKID:r,x:n,y:i,z:o,yaw:s,pitch:l,roll:a,...d([u,c,f,p,m,h],[y,w],[v,D,z],[$,I],g)}}function v(e){const[t,n,i,o,s,...l]=e.slice(1),a=m.get(s),u=r.get(s)?.constructor;if(!a||!u)return null;return{latitude:t,longitude:n,ellipsoidRadius:i,squaredEccentricity:o,properties:new u(a([s,"",...l]))}}function D(e){if(!e)return null;const t=`${e}`.split("|");if(0===t.length)return null;const n=r.get(t[0]);if(!n)return null;const i=m.get(t[0]);if(!i)return null;return new(0,n.constructor)(i(t))}function z(e){return Array.isArray(e)&&9===e?.length&&!e.some(isNaN)}function $(e){return e.spatialReference.isGeographic?t(e):e.clone()}export{l as appendPrefixAndSuffix,$ as convertGeographicToWebMercator,D as createCameraOrientation,u as getEffectiveElevationSource,z as isOrientationAccuracy,p as orientedImageryTypeMap,a as processElevationSource,c as timeIntervalUnitTypeMap,m as transformersRegistry,f as verticalMeasurementTypeMap};
5
+ import{JSONMap as e}from"../../../core/jsonMap.js";import{getMetersPerUnitForSR as t}from"../../../core/unitUtils.js";import{geographicToWebMercator as r}from"../../../geometry/support/webMercatorUtils.js";import n from"./cameraOrientationRegistry.js";import{isConstantElevation as i,ConstantElevation as o,ElevationSource as s}from"./ElevationSourceDefinitions.js";import{CameraOrientationType as l}from"../enums/CameraOrientationType.js";function a(e,t,r){return t&&(e=`${t}${e}`),r&&(e+=`${r}`),e}function u(e,t,r){let{url:n}=e;return n?(n=a(n,t,r),new s({...e,url:n})):null}function c(e,t,r){return e?i(e)?new o(e):u(e,t,r):e}const f=new e({Minutes:"minutes",Hours:"hours",Days:"days",Weeks:"weeks",Months:"months",Years:"years"}),p=new e({Feet:"feet",Meter:"meter"}),m=new e({360:"360",Horizontal:"horizontal",Inspection:"inspection",Nadir:"nadir",Oblique:"oblique",Terrestrial360Video:"terrestrial-360-video",TerrestrialFrameVideo:"terrestrial-frame-video",Aerial360Video:"aerial-360-video",AerialFrameVideo:"aerial-frame-video","":null}),h=new Map;function g(e){const[t,r,n,i,o,s,l,a,u,c,f,p,m,h,g,d,w,v,D,z,$,j]=e.slice(1);return{horizontalWKID:t,verticalWKID:r,x:n,y:i,z:o,omega:s,phi:l,kappa:a,...y([u,c,f,p,m,h],[d,w],[v,D,z],[$,j],g)}}h.set(`${l.HPR}`,w),h.set(`${l.YPR}`,v),h.set(`${l.OPK}`,g),h.set(`${l.LTP}`,D);const d=e=>{const t=e.map((e=>parseFloat(e))).filter((e=>!isNaN(e)));if(t.length===e.length)return t};function y(e,t,r,n,i){const o=d(e),s=d(t),l=d(r),a=d(n);return{affineTransformations:6===o?.length?o:void 0,focalLength:6===o?.length?parseFloat(i):void 0,principalOffsetPoint:2!==s?.length?[0,0]:s,radialDistortionCoefficients:3!==l?.length?[0,0,0]:l,tangentialDistortionCoefficients:2!==a?.length?[0,0]:a}}function w(e){const[t,r,n,i,o,s,l,a,u,c,f,p,m,h,g,d,w,v,D,z,$,j]=e.slice(1);return{horizontalWKID:t,verticalWKID:r,x:n,y:i,z:o,heading:s,pitch:l,roll:a,...y([u,c,f,p,m,h],[d,w],[v,D,z],[$,j],g)}}function v(e){const[t,r,n,i,o,s,l,a,u,c,f,p,m,h,g,d,w,v,D,z,$,j]=e.slice(1);return{horizontalWKID:t,verticalWKID:r,x:n,y:i,z:o,yaw:s,pitch:l,roll:a,...y([u,c,f,p,m,h],[d,w],[v,D,z],[$,j],g)}}function D(e){const[t,r,i,o,s,...l]=e.slice(1),a=h.get(s),u=n.get(s)?.constructor;if(!a||!u)return null;return{latitude:t,longitude:r,ellipsoidRadius:i,squaredEccentricity:o,properties:new u(a([s,"",...l]))}}function z(e){if(!e)return null;const t=`${e}`.split("|");if(0===t.length)return null;const r=n.get(t[0]);if(!r)return null;const i=h.get(t[0]);if(!i)return null;return new(0,r.constructor)(i(t))}function $(e){return Array.isArray(e)&&e?.length>5&&!e.some(isNaN)}function j(e){for(e=e.slice(0,8);e.length<8;)e.push(0);return e}function I(e){return e.spatialReference.isGeographic?r(e):e.clone()}function K(e){return e.isGeographic?1:t(e)}export{a as appendPrefixAndSuffix,I as convertGeographicToWebMercator,z as createCameraOrientation,c as getEffectiveElevationSource,K as getMetersPerUnitOfSR,$ as isOrientationAccuracy,m as orientedImageryTypeMap,j as padAccuracyArray,u as processElevationSource,f as timeIntervalUnitTypeMap,h as transformersRegistry,p as verticalMeasurementTypeMap};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{updateUsingElevationSampler as t,updateUsingElevationSource as e,updateUsingConstant as a}from"./updateElevationUtils.js";import{isUpdateElevationWithElevationSampler as r,isUpdateElevationWithElevationSource as o}from"./utils.js";async function i(i,n,l){const s=Array.isArray(i)?i:[i];let u;if(r(n))u=await t(s,n.elevationSample,l);else if(o(n)){const{elevationSource:t,extent:a}=n,{url:r,lod:o,rasterFunction:i}=t;u=await e(s,{url:r,lod:o,rasterFunction:i,extent:a},l)}else u=await a(s,n.elevationSource.constantElevation,l);return Array.isArray(i)?u:u[0]}export{i as default};
5
+ import{updateUsingElevationSampler as t,updateUsingElevationSource as e,updateUsingAverageGroundElevation as a,updateUsingConstant as r}from"./updateElevationUtils.js";import{isUpdateElevationWithElevationSampler as n,isUpdateElevationWithElevationSource as o}from"./utils.js";async function i(i,l,s){const u=Array.isArray(i)?i:[i];let c;if(n(l))c=await t(u,l.elevationSample,s);else if(o(l)){const{elevationSource:t,extent:a}=l,{url:r,lod:n,rasterFunction:o}=t;c=await e(u,{url:r,lod:n,rasterFunction:o,extent:a},s)}else c="averageGroundElevation"in l?a(u,l):await r(u,l.elevationSource.constantElevation,s);return Array.isArray(i)?c:c[0]}export{i as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../core/Error.js";import t from"../../../core/Logger.js";import{isAbortError as r,waitTick as a}from"../../../core/promiseUtils.js";import{projectWithZConversion as o}from"../../../geometry/projectionUtils.js";import{fromExtent as n}from"../../../geometry/support/aaBoundingRect.js";import i from"../../ElevationLayer.js";import s from"../../ImageryLayer.js";import c from"../../ImageryTileLayer.js";import{TileElevationSampler as l}from"../../support/ElevationSampler.js";import{ElevationTile as u}from"../../support/ElevationTile.js";import{ElevationTileData as m}from"../../support/ElevationTileData.js";import p from"../../support/RasterFunction.js";import f from"../../support/TileInfo.js";import{TileKey as w}from"../../support/TileKey.js";import{identify as y}from"../../../rest/imageService.js";import g from"../../../rest/support/ImageIdentifyParameters.js";import{fetchArcGISServiceJSON as d}from"../../../support/requestPresets.js";import{logAndThrow as v}from"../../../widgets/OrientedImageryViewer/utils.js";async function I(t,r,a){if(!r.extent||!r.url)throw v("esri.layer.orientedImagery.transformations",new e("update-elevation:missing-property","both extent and url are required to create a sampler",r));const o=await j(r);if(!o)throw v("esri.layers.orientedImagery.transformations",new e("update-elevation:elevation-source","could not create a sampler using provided elevation source",r));return E(t,o,a)}async function E(e,t,r){await a(r);const o=N(t,r),n=Array.isArray(e)?e:[e];return await Promise.all(n.map(o))}var h;!function(e){e[e.DYNAMIC=0]="DYNAMIC",e[e.ELEVATION=1]="ELEVATION",e[e.IMAGE=2]="IMAGE"}(h||(h={}));const j=async(e,a)=>{let o;const{extent:n,rasterFunction:i,url:s,lod:c}=e;try{o=await R(s)}catch(l){if(r(l))return;t.getLogger("esri.layers.orientedImagery.transformations").error("updateElevationUsingElevationSource",l)}switch(o){case h.DYNAMIC:return await L(s,n,i,a);case h.ELEVATION:return await A(s,n,c,a);default:return}};async function A(e,a,o,n){const s=new i(e);let c;try{const{tileInfo:e}=await s.load(),t=(o&&e.lodAt(Math.min(e.lods.length-1,o))?.resolution)??"finest-contiguous";c=await s.createElevationSampler(a,{...n,demResolution:t})}catch(l){if(r(l))return;t.getLogger(s).error(l)}finally{s.destroy()}return c}async function L(e,t,r,a){const o=r?new p({functionName:r}):void 0,i=new s({url:e,rasterFunction:o,format:"lerc"});await i.load(a);let c,y=512,g=512;const d=t.width/t.height;d>1?(g/=d,c=t.height/g):(y*=d,c=t.width/y);const v=await i.internalFetchImage(t,y,g,a),I=f.create({scales:[c],size:512,spatialReference:t.spatialReference}),E=new w(null,0,0,0,n(t)),h=new m(v.pixelData.pixelBlock.pixels[0],y,g,0),j=new u(E,h);return new l(j,I,void 0)}async function R(t,r){await a(r);const o=await d(t),{tileInfo:n,cacheType:i}=o;if(!o.hasOwnProperty("bandCount")||!o.hasOwnProperty("pixelSizeX"))throw new e("elevation-source:invalid-service-url",`ElevationSource URL expects an elevation 3D image service but given ${t}`);return n?"LERC"!==n?.format?.toUpperCase()||i&&"elevation"!==i.toLowerCase()?h.IMAGE:h.ELEVATION:h.DYNAMIC}function N(e,t){return async r=>{let a=r.clone();const n=r.spatialReference.equals(e.spatialReference)?a:await o(r,e.spatialReference,t),i=e.queryElevation(n);if(i){a=r.spatialReference.equals(e.spatialReference)?i.clone():await o(i,r.spatialReference,t)}return a.z=a.z??1,a}}async function T(e,t,r){return await a(r),e.map((e=>(e.z=t,e)))}async function M(e,a,o){const{url:n,rasterFunction:i}=a;let s;try{s=await R(n,o)}catch(l){r(l)||t.getLogger("esri.layers.orientedImagery.transformations").error(l)}switch(s){case h.ELEVATION:case h.DYNAMIC:{const t=await y(n,new g({geometry:e,rasterFunction:i?new p({functionName:i}):void 0}));if(t.value?.[0]){const r=e.clone();return r.z=+t.value[0],r}break}case h.IMAGE:{const t=new c(n,o);await t.load();const r=await t.identify(e,o);if(r.value?.[0]){const t=e.clone();return t.z=+r.value[0],t}break}}return e}export{j as getElevationSampler,L as getElevationSamplerFromDynamicImageService,A as getElevationSamplerFromElevationLayer,T as updateUsingConstant,E as updateUsingElevationSampler,I as updateUsingElevationSource,M as updateZfromService,R as validateElevationSourceURL};
5
+ import e from"../../../core/Error.js";import t from"../../../core/Logger.js";import{isAbortError as r,waitTick as a}from"../../../core/promiseUtils.js";import o from"../../../geometry/Extent.js";import{projectWithZConversion as n}from"../../../geometry/projectionUtils.js";import{load as i,execute as s}from"../../../geometry/operators/projectOperator.js";import{fromExtent as c}from"../../../geometry/support/aaBoundingRect.js";import l from"../../ElevationLayer.js";import m from"../../ImageryLayer.js";import p from"../../ImageryTileLayer.js";import{getMetersPerUnitOfSR as u}from"../core/utils.js";import{TileElevationSampler as f}from"../../support/ElevationSampler.js";import{ElevationTile as y}from"../../support/ElevationTile.js";import{ElevationTileData as w}from"../../support/ElevationTileData.js";import g from"../../support/RasterFunction.js";import d from"../../support/TileInfo.js";import{TileKey as v}from"../../support/TileKey.js";import{identify as E}from"../../../rest/imageService.js";import I from"../../../rest/support/ImageIdentifyParameters.js";import{fetchArcGISServiceJSON as j}from"../../../support/requestPresets.js";import{logAndThrow as R}from"../../../widgets/OrientedImageryViewer/utils.js";async function h(t,r,a){if(!r.extent||!r.url)throw R("esri.layer.orientedImagery.transformations",new e("update-elevation:missing-property","both extent and url are required to create a sampler",r));const o=await L(r);if(!o)throw R("esri.layers.orientedImagery.transformations",new e("update-elevation:elevation-source","could not create a sampler using provided elevation source",r));return x(t,o,a)}async function x(e,t,r){await a(r);const o=C(t,r),n=Array.isArray(e)?e:[e];return await Promise.all(n.map(o))}var A;!function(e){e[e.DYNAMIC=0]="DYNAMIC",e[e.ELEVATION=1]="ELEVATION",e[e.IMAGE=2]="IMAGE"}(A||(A={}));const L=async(e,a)=>{let o;const{extent:n,rasterFunction:i,url:s,lod:c}=e;try{o=await T(s)}catch(l){if(r(l))return;t.getLogger("esri.layers.orientedImagery.transformations").error("updateElevationUsingElevationSource",l)}switch(o){case A.DYNAMIC:return await M(s,n,i,a);case A.ELEVATION:return await N(s,n,c,a);default:return}};async function N(e,a,o,n){const i=new l(e);let s;try{const{tileInfo:e}=await i.load(),t=(o&&e.lodAt(Math.min(e.lods.length-1,o))?.resolution)??"finest-contiguous";s=await i.createElevationSampler(a,{...n,demResolution:t})}catch(c){if(r(c))return;t.getLogger(i).error(c)}finally{i.destroy()}return s}async function M(e,t,r,a){const n=r?new g({functionName:r}):void 0,l=new m({url:e,rasterFunction:n,format:"lerc"});await l.load(a);const p=512,u=t.center,E=Math.max(t.width,t.height);let I=new o({xmin:u.x-E/2,ymin:u.y-E/2,xmax:u.x+E/2,ymax:u.y+E/2,spatialReference:t.spatialReference});l.spatialReference.equals(I.spatialReference)||(await i(),I=s(I,l.spatialReference));const j=await l.fetchPixels(I,p,p,a),R=d.create({scales:[E/p],size:p,spatialReference:I.spatialReference}),h=new v(null,0,0,0,c(I)),x=new w(j.pixelBlock.pixels[0],p,p,0),A=new y(h,x);return new f(A,R,void 0)}async function T(t,r){await a(r);const o=await j(t),{tileInfo:n,cacheType:i}=o;if(!o.hasOwnProperty("bandCount")||!o.hasOwnProperty("pixelSizeX"))throw new e("elevation-source:invalid-service-url",`ElevationSource URL expects an elevation 3D image service but given ${t}`);return n?"LERC"!==n?.format?.toUpperCase()||i&&"elevation"!==i.toLowerCase()?A.IMAGE:A.ELEVATION:A.DYNAMIC}function C(e,t){return async r=>{let a=r.clone();const o=r.spatialReference.equals(e.spatialReference)?a:await n(r,e.spatialReference,t),i=e.queryElevation(o);if(i){a=r.spatialReference.equals(e.spatialReference)?i.clone():await n(i,r.spatialReference,t)}return a.z=a.z??1,a}}async function O(e,t,r){return await a(r),e.map((e=>(e.z=t,e)))}async function z(e,a,o){const{url:n,rasterFunction:i}=a;let s;try{s=await T(n,o)}catch(c){r(c)||t.getLogger("esri.layers.orientedImagery.transformations").error(c)}switch(s){case A.ELEVATION:case A.DYNAMIC:{const t=await E(n,new I({geometry:e,rasterFunction:i?new g({functionName:i}):void 0}));if(t.value?.[0]){const r=e.clone();return r.z=+t.value[0],r}break}case A.IMAGE:{const t=new p(n,o);await t.load();const r=await t.identify(e,o);if(r.value?.[0]){const t=e.clone();return t.z=+r.value[0],t}break}}return e}function D(e,t){const{averageGroundElevation:r,spatialReference:a}=t,o=u(a);return e.map((e=>{const t=e.clone();return t.z=r*o/e.spatialReference.metersPerUnit,t}))}export{L as getElevationSampler,M as getElevationSamplerFromDynamicImageService,N as getElevationSamplerFromElevationLayer,D as updateUsingAverageGroundElevation,O as updateUsingConstant,x as updateUsingElevationSampler,h as updateUsingElevationSource,z as updateZfromService,T as validateElevationSourceURL};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../core/Error.js";import{rad2deg as n,deg2rad as a}from"../../../core/mathUtils.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as e,fromValues as o}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromArray as r}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{zeros as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{multiply as s,transpose as l}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{invertOrIdentity as f,mul as h}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{a as u,f as m}from"../../../chunks/vec32.js";import{isSerializable as p}from"../../../core/support/jsonUtils.js";import M from"../../../geometry/Point.js";import{projectWithZConversion as g}from"../../../geometry/projectionUtils.js";import{earth as v}from"../../../geometry/support/Ellipsoid.js";import{isWebMercator as d}from"../../../geometry/support/spatialReferenceUtils.js";import{a as x}from"../../../chunks/vec3.js";import{isConstantElevation as w,isElevationSource as y,ConstantElevation as O}from"../core/ElevationSourceDefinitions.js";import{getElevationSampler as b}from"./updateElevationUtils.js";import{isNumber as j}from"../../../support/guards.js";import{defaultImageSphereSize as E}from"../../../widgets/PanoramicViewer/constants.js";function z(t,n,a){const[i,o,r,c]=n,[s,l,u,m]=a;F(i,o,r,c);const p=F(s,l,u,m),M=V(i,o,r,c),g=V(s,l,u,m),v=f(e(),M),d=h(e(),v,g),[x,w,y,O]=P(t,d);return[x/O,w/O,p?0:y/O]}function F(t,n,a,i){return 0===t[2]&&0===n[2]&&0===a[2]&&0===i[2]&&(t[2]=n[2]=a[2]=i[2]=1,!0)}function S(t){return 0===t?1:t}function P(t,n){const[a,i,e]=t,o=[0,0,0,0];return o[0]=a*n[0]+i*n[1]+e*n[2]+n[3],o[1]=a*n[4]+i*n[5]+e*n[6]+n[7],o[2]=a*n[8]+i*n[9]+e*n[10]+n[11],o[3]=S(a*n[12]+i*n[13]+e*n[14]+n[15]),o}function V(t,n,a,i){const c=D(r([...i,1]),f(new Array(16),o(t[0],n[0],a[0],0,t[1],n[1],a[1],0,t[2],n[2],a[2],0,1,1,1,1))),s=c[0],l=c[1],h=c[2],u=e();return u[0]=s*t[0],u[1]=l*n[0],u[2]=h*a[0],u[3]=0,u[4]=s*t[1],u[5]=l*n[1],u[6]=h*a[1],u[7]=0,u[8]=s*t[2],u[9]=l*n[2],u[10]=h*a[2],u[11]=0,u[12]=s,u[13]=l,u[14]=h,u[15]=1,u}function C(t,n,a,i,e=c()){return e[0]=t[0]+n[0]*a,e[1]=t[1]+n[1]*a,e[2]=t[2]+n[2]*(a/i),e}function R(t,n,a){const i=c();return i[0]=t[0]*n,i[1]=t[1]*n,i[2]=t[2]*(n/a),i}function L(t,n){const[a,i,e]=t,o=c();return o[0]=a*n[0]+i*n[3]+e*n[6],o[1]=a*n[1]+i*n[4]+e*n[7],o[2]=a*n[2]+i*n[5]+e*n[8],o}function D(t,n){const[a,i,e,o]=t,r=new Array(4);return r[0]=a*n[0]+i*n[1]+e*n[2]+o*n[3],r[1]=a*n[4]+i*n[5]+e*n[6]+o*n[7],r[2]=a*n[8]+i*n[9]+e*n[10]+o*n[11],r[3]=a*n[12]+i*n[13]+e*n[14]+o*n[15],r}function I(n,e,o,r=!0){if(!Number.isFinite(n))throw new t("InvalidRotationAngle","Please specify a valid angle for rotation");const c=o*(r?a(n):n),s=Math.cos(c),l=Math.sin(c),f=i();switch(e){case 0:f[4]=s,f[5]=-l,f[7]=l,f[8]=s;break;case 1:f[0]=s,f[2]=l,f[6]=-l,f[8]=s;break;case 2:f[0]=s,f[1]=-l,f[3]=l,f[4]=s;break;default:throw new t("InvalidRotationAxis","Please specify either 0, 1 or 2 for X, Y or Z axis respectively")}return f}const H={HPR:[[2,-1],[0,1],[2,-1]],OPK:[[0,1],[1,1],[2,1]]};function N(n,a,e=!0){if(3!==n?.length||3!==a?.length)throw new t("InvalidRotationAngles","Please specify three angles with config for rotation");const o=i();for(let t=0;t<3;t++){const[i,r]=a[t],c=I(n[t],i,r,e);s(o,c,o)}return o}function q(t,n=!0){return N(t,H.OPK,n)}function U(t,n=!0){return N(t,H.HPR,n)}function k(t,n,i){const e=Math.sin(a(i)),o=Math.cos(a(i)),r=[[t,0],[t,n],[0,n]];r.forEach(((t,n)=>{r[n]=[o*t[0]-e*t[1],e*t[0]+o*t[1]]}));const c={xmin:Math.min(0,r[0][0],r[1][0],r[2][0]),xmax:Math.max(0,r[0][0],r[1][0],r[2][0]),ymin:Math.min(0,r[0][1],r[1][1],r[2][1]),ymax:Math.max(0,r[0][1],r[1][1],r[2][1])};return{hfov:Math.abs(c.xmax-c.xmin),vfov:Math.abs(c.ymax-c.ymin)}}function A(t,n){const i=a(t[1]),e=a(t[0]),o=t[2],[r,c,s,l]=n,f=a(r),h=a(c),u=s/Math.sqrt(1-l*Math.sin(f)**2),m=e-h,p=s/Math.sqrt(1-l*Math.sin(f)**2),M=l*(u*Math.sin(f)-p*Math.sin(i));return[(p+o)*Math.cos(i)*Math.sin(m),(p+o)*(Math.sin(i)*Math.cos(f)-Math.sin(f)*Math.cos(f)*Math.cos(m))+M*Math.cos(f),(p+o)*(Math.sin(i)*Math.sin(f)+Math.cos(f)*Math.cos(i)*Math.cos(m))-u+M*Math.sin(f)]}function K(t,i){const e=Number(t[0]),o=Number(t[1]),r=Number(t[2]),[c,s,l,f]=i,h=a(c),u=a(s),m=l/Math.sqrt(1-f*Math.sin(h)**2),p=e/m,M=o/m,g=r/m,v=Math.cos(h)-Math.sin(h)*M+Math.cos(h)*g,d=Math.sin(h)+Math.cos(h)*M+Math.sin(h)*g,x=Math.sqrt(v**2+p**2),w=f*m*Math.sin(h),y=(t,n=5)=>{if(0===n)return t;const a=y(t,n-1);return Math.atan(d/x-(w-f*(l/Math.sqrt(1-f*Math.sin(a)**2))*Math.sin(a))/(m*x))},O=y(h),b=Math.atan(e/(m*v))+u,j=n(O);return[n(b),j,e/(Math.cos(O)*Math.sin(b-u))-l/Math.sqrt(1-f*Math.sin(O)**2)]}function W(t,n,a){const i=360/n,e=180/a;return{heading:(t.x-n/2)*i,pitch:90-(t.y-a/2)*e}}function T(t,n,a,i=E/2){const{heading:e,pitch:o}=Y(t,i);return X(e,o,n,a)}function X(t,n,a,i){return{x:a/2+t/(360/a),y:i-n/(180/i),heading:t,pitch:n}}function Y(t,a){const i=n(Math.acos(-t.z/a));return{heading:n(Math.atan2(t.x,t.y)),pitch:i}}function Z(t,n,i=E/2){return[i*(Math.sin(a(t))*Math.sin(a(n))),i*(Math.cos(a(t))*Math.sin(a(n))),i*Math.cos(a(180-n))]}function J(t,n,a,i=E/2){const{heading:e,pitch:o}=W(t,n,a);return Z(e,o,i)}async function $(t,a,i){const e=await g(a,t.spatialReference,i);let o=n(Math.atan2(e.y-t.y,e.x-t.x));return o=o>=0&&o<=90?90-o:o>90&&o<=180?360-o+90:90+Math.abs(o),o}function B(t,n,a){const i=Math.cos(a),e=Math.sin(a),o=[1,0,0,1,0,0],r=o[0]*i+o[2]*e,c=o[1]*i+o[3]*e,s=-o[0]*e+o[2]*i,l=-o[1]*e+o[3]*i;o[0]=r,o[1]=c,o[2]=s,o[3]=l;return[t*o[0]+n*o[2]+o[4],t*o[1]+n*o[3]+o[5]]}const G=t=>t.toArray(),Q=(...t)=>t.some((t=>t));function _(t,n){if(Q(0===t.length,t.some((({x:t,y:n})=>Q(null==t,null==n))),!n.hasZ))throw new Error("Input pixels must have x, y and camera location must have z value")}function tt(t,n){if(t.some((t=>null==t.z))||null==n.z)throw new Error("Input points and camera location must have z value")}function nt(t){if(9!==t?.length)throw new Error("Rotation matrix is not provided or is not a valid 3x3 matrix")}function at(t,n){return d(n)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*t/v.radius))):1}const it=t=>n=>new M(n,t),et=t=>null!=t&&"queryExtent"in t;function ot(t,n,a,i){return[[-n,-n],[+n,-n],[+n,+n],[-n,+n]].map((([n,e])=>z(x(c(),a,[n,e,0]),i,t)))}function rt({a0:t,a1:n,a2:a,b0:i,b1:e,b2:o},r,c,s){const l=[t??r/2-.5,n,a??0,i??c/2-.5,e??0,o].map(ct);return null!=s&&st(l)?{affines:l,focalLength:s}:{affines:[r/2-.5,1,0,c/2-.5,0,-1]}}function ct(t,n){if(null==t)return null;const a=parseFloat(`${t}`);return isNaN(a)?null:a}function st(t){return null!=t[1]&&null!=t[5]}function lt(t,n,a){const{cameraHeight:i,cameraPitch:e,cameraRoll:o,elevation:r,farDistance:c,horizontalFieldOfView:s,location:l,verticalFieldOfView:f}=t,h=r??(l.z??0)-i;return{...ut(t,n,a),averageElevation:h,cameraPitch:e,cameraRoll:o??0,farDistance:c,horizontalFieldOfView:s,verticalFieldOfView:f}}function ft(t,n,a,i){return wt(i)?q([i.omega,i.phi,i.kappa]):yt(i)?U([i.heading,i.pitch,i.roll]):U([t,n,a??0])}function ht(t,n,a){const{cameraHeading:i,cameraHeight:e,elevation:o,farDistance:r,horizontalFieldOfView:c,location:s,verticalFieldOfView:l}=t;return{averageElevation:o??(s.z??0)-e,cameraLocation:s,cameraHeading:i,farDistance:r,horizontalFieldOfView:c,imageHeight:a,imageWidth:n,verticalFieldOfView:l}}function ut(t,n,a){const{a0:i,a1:e,a2:o,b0:r,b1:c,b2:s,cameraHeading:l,cameraOrientation:f,cameraPitch:h,cameraRoll:u,focalLength:m,horizontalFieldOfView:p,location:M,matrix:g,principalX:v,principalY:d,radial:x,tangential:w,verticalFieldOfView:y}=t,{affines:O,focalLength:b}=rt({a0:i,a1:e,a2:o,b0:r,b1:c,b2:s},n,a,m),j=g??ft(l,h,u,f),E=null!=v&&null!=d?[v,d]:void 0;return{affineTransformations:f?.affineTransformations??O,cameraLocation:M.clone(),focalLength:f?.focalLength??b,horizontalFieldOfView:p,imageHeight:a,imageWidth:n,principalOffsetPoint:f?.principalOffsetPoint??E,radialDistortionCoefficients:f?.radialDistortionCoefficients??x,rotationMatrix:j,tangentialDistortionCoefficients:f?.tangentialDistortionCoefficients??w,verticalFieldOfView:y}}const mt=t=>null!=t&&"elevationSample"in t&&null!=t.elevationSample,pt=t=>y(t?.elevationSource)&&null!=t?.extent,Mt=t=>w(t?.elevationSource),gt=async(t,n,a)=>null!=n&&(mt(n)||Mt(n))?n:pt(n)?{elevationSample:await b({...p(n.elevationSource)?n.elevationSource.toJSON():n.elevationSource,extent:n.extent},a),elevationSource:new O({constantElevation:t})}:{elevationSource:new O({constantElevation:t})},vt=t=>j(t?.heading)&&j(t?.pitch),dt=(t,n)=>[[-t,-n],[t,-n],[t,n],[-t,n]];function xt(t){const{cameraLocation:n,farDistance:e,horizontalFieldOfView:o,rotationMatrix:r,scalingFactor:s,verticalFieldOfView:f}=t,h=i();l(h,r);const p=2*Math.tan(a(f)/2)*e*s,M=2*Math.tan(a(o)/2)*e*s,g=L([0,0,-1],h),v=C([n.x,n.y,n.z],g,t.farDistance*s,s),d=L([0,1,0],h),x=L([1,0,0],h),w=R(d,p/2,s),y=R(x,M/2,s),O=u(c(),w,y),b=m(c(),w,y);return[m(c(),v,O),m(c(),v,b),u(c(),v,O),u(c(),v,b)]}const wt=t=>2===t?.type,yt=t=>1===t?.type;function Ot(t){const n=t%360;return n<-180?n+360:n}function bt(t,n,a){if("panoramic"===t){const[t,i]=a;return T({x:n.x,y:n.y,z:n.z},t,i)}return{x:n.x+.5,y:.5-n.y}}var jt;!function(t){t[t.CLOCKWISE=-1]="CLOCKWISE",t[t.COUNTERCLOCKWISE=1]="COUNTERCLOCKWISE"}(jt||(jt={}));export{xt as computeFarplaneVertices,k as computeHFOVAndVFOV,ot as computeNewReferenceCoordinates,Z as convertHeadingPitchToSphereVertex,X as convertOrientationToPixelLocation,J as convertPixelLocationToSphereVertex,W as convertPixelToHeadingPitch,Y as convertSphereVertexToOrientation,T as convertSphereVertexToPixelLocation,N as createRotationMatrix,U as createRotationMatrixFromHPR,q as createRotationMatrixFromOPK,A as geographicToLTP,rt as getAffinesAndFocalLength,ht as getImageToWorldPanoramicProperties,lt as getImageToWorldProperties,$ as getInitialAngle,gt as getUpdateElevationProps,at as getWebMercatorScalingFactor,ut as getWorldToImageProperties,vt as hasAngles,yt as hasHeadingPitchRoll,wt as hasOmegaPhiKappa,et as isElevationSampler,mt as isUpdateElevationWithElevationSampler,pt as isUpdateElevationWithElevationSource,Mt as isUpdateUsingConstantElevation,st as isValidAffines,V as linearEquationSolve,K as ltpToGeographic,Ot as normalizeHeading,Q as or,G as pointToArray,z as projectiveTransform,dt as reducerFn,B as rotatePixel,C as scaleAndAddWithFactor,R as scaleWithFactor,bt as transformGraphicCoordinatesToPixel,L as transformMat3,D as transformMat4,_ as validatePixelsToTransform,tt as validatePointsToTransform,nt as validateRotationMatrix,it as vecToPoint};
5
+ import t from"../../../core/Error.js";import{rad2deg as n,deg2rad as a}from"../../../core/mathUtils.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as e,fromValues as o}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromArray as r}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{zeros as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{multiply as s,transpose as l}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{invertOrIdentity as f,mul as u}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{a as h,f as m}from"../../../chunks/vec32.js";import{isSerializable as p}from"../../../core/support/jsonUtils.js";import M from"../../../geometry/Point.js";import{projectWithZConversion as v}from"../../../geometry/projectionUtils.js";import{earth as g}from"../../../geometry/support/Ellipsoid.js";import{isWebMercator as d}from"../../../geometry/support/spatialReferenceUtils.js";import{a as x}from"../../../chunks/vec3.js";import{isConstantElevation as w,ConstantElevation as y,isElevationSource as O}from"../core/ElevationSourceDefinitions.js";import{getMetersPerUnitOfSR as b}from"../core/utils.js";import{getElevationSampler as j}from"./updateElevationUtils.js";import{isNumber as E}from"../../../support/guards.js";import{defaultImageSphereSize as S}from"../../../widgets/PanoramicViewer/constants.js";function z(t,n,a){const[i,o,r,c]=n,[s,l,h,m]=a;F(i,o,r,c);const p=F(s,l,h,m),M=V(i,o,r,c),v=V(s,l,h,m),g=f(e(),M),d=u(e(),g,v),[x,w,y,O]=P(t,d);return[x/O,w/O,p?0:y/O]}function F(t,n,a,i){return 0===t[2]&&0===n[2]&&0===a[2]&&0===i[2]&&(t[2]=n[2]=a[2]=i[2]=1,!0)}function R(t){return 0===t?1:t}function P(t,n){const[a,i,e]=t,o=[0,0,0,0];return o[0]=a*n[0]+i*n[1]+e*n[2]+n[3],o[1]=a*n[4]+i*n[5]+e*n[6]+n[7],o[2]=a*n[8]+i*n[9]+e*n[10]+n[11],o[3]=R(a*n[12]+i*n[13]+e*n[14]+n[15]),o}function V(t,n,a,i){const c=H(r([...i,1]),f(new Array(16),o(t[0],n[0],a[0],0,t[1],n[1],a[1],0,t[2],n[2],a[2],0,1,1,1,1))),s=c[0],l=c[1],u=c[2],h=e();return h[0]=s*t[0],h[1]=l*n[0],h[2]=u*a[0],h[3]=0,h[4]=s*t[1],h[5]=l*n[1],h[6]=u*a[1],h[7]=0,h[8]=s*t[2],h[9]=l*n[2],h[10]=u*a[2],h[11]=0,h[12]=s,h[13]=l,h[14]=u,h[15]=1,h}function C(t,n,a,i,e=c()){return e[0]=t[0]+n[0]*a,e[1]=t[1]+n[1]*a,e[2]=t[2]+n[2]*(a/i),e}function D(t,n,a){const i=c();return i[0]=t[0]*n,i[1]=t[1]*n,i[2]=t[2]*(n/a),i}function L(t,n){const[a,i,e]=t,o=c();return o[0]=a*n[0]+i*n[3]+e*n[6],o[1]=a*n[1]+i*n[4]+e*n[7],o[2]=a*n[2]+i*n[5]+e*n[8],o}function H(t,n){const[a,i,e,o]=t,r=new Array(4);return r[0]=a*n[0]+i*n[1]+e*n[2]+o*n[3],r[1]=a*n[4]+i*n[5]+e*n[6]+o*n[7],r[2]=a*n[8]+i*n[9]+e*n[10]+o*n[11],r[3]=a*n[12]+i*n[13]+e*n[14]+o*n[15],r}function I(n,e,o,r=!0){if(!Number.isFinite(n))throw new t("InvalidRotationAngle","Please specify a valid angle for rotation");const c=o*(r?a(n):n),s=Math.cos(c),l=Math.sin(c),f=i();switch(e){case 0:f[4]=s,f[5]=-l,f[7]=l,f[8]=s;break;case 1:f[0]=s,f[2]=l,f[6]=-l,f[8]=s;break;case 2:f[0]=s,f[1]=-l,f[3]=l,f[4]=s;break;default:throw new t("InvalidRotationAxis","Please specify either 0, 1 or 2 for X, Y or Z axis respectively")}return f}const N={HPR:[[2,-1],[0,1],[2,-1]],OPK:[[0,1],[1,1],[2,1]]};function q(n,a,e=!0){if(3!==n?.length||3!==a?.length)throw new t("InvalidRotationAngles","Please specify three angles with config for rotation");const o=i();for(let t=0;t<3;t++){const[i,r]=a[t],c=I(n[t],i,r,e);s(o,c,o)}return o}function U(t,n=!0){return q(t,N.OPK,n)}function k(t,n=!0){return q(t,N.HPR,n)}function A(t,n,i){const e=Math.sin(a(i)),o=Math.cos(a(i)),r=[[t,0],[t,n],[0,n]];r.forEach(((t,n)=>{r[n]=[o*t[0]-e*t[1],e*t[0]+o*t[1]]}));const c={xmin:Math.min(0,r[0][0],r[1][0],r[2][0]),xmax:Math.max(0,r[0][0],r[1][0],r[2][0]),ymin:Math.min(0,r[0][1],r[1][1],r[2][1]),ymax:Math.max(0,r[0][1],r[1][1],r[2][1])};return{hfov:Math.abs(c.xmax-c.xmin),vfov:Math.abs(c.ymax-c.ymin)}}function K(t,n){const i=a(t[1]),e=a(t[0]),o=t[2],[r,c,s,l]=n,f=a(r),u=a(c),h=s/Math.sqrt(1-l*Math.sin(f)**2),m=e-u,p=s/Math.sqrt(1-l*Math.sin(f)**2),M=l*(h*Math.sin(f)-p*Math.sin(i));return[(p+o)*Math.cos(i)*Math.sin(m),(p+o)*(Math.sin(i)*Math.cos(f)-Math.sin(f)*Math.cos(f)*Math.cos(m))+M*Math.cos(f),(p+o)*(Math.sin(i)*Math.sin(f)+Math.cos(f)*Math.cos(i)*Math.cos(m))-h+M*Math.sin(f)]}function W(t,i){const e=Number(t[0]),o=Number(t[1]),r=Number(t[2]),[c,s,l,f]=i,u=a(c),h=a(s),m=l/Math.sqrt(1-f*Math.sin(u)**2),p=e/m,M=o/m,v=r/m,g=Math.cos(u)-Math.sin(u)*M+Math.cos(u)*v,d=Math.sin(u)+Math.cos(u)*M+Math.sin(u)*v,x=Math.sqrt(g**2+p**2),w=f*m*Math.sin(u),y=(t,n=5)=>{if(0===n)return t;const a=y(t,n-1);return Math.atan(d/x-(w-f*(l/Math.sqrt(1-f*Math.sin(a)**2))*Math.sin(a))/(m*x))},O=y(u),b=Math.atan(e/(m*g))+h,j=n(O);return[n(b),j,e/(Math.cos(O)*Math.sin(b-h))-l/Math.sqrt(1-f*Math.sin(O)**2)]}function T(t,n,a){const i=360/n,e=180/a;return{heading:(t.x-n/2)*i,pitch:90-(t.y-a/2)*e}}function X(t,n,a,i=S/2){const{heading:e,pitch:o}=Z(t,i);return Y(e,o,n,a)}function Y(t,n,a,i){return{x:a/2+t/(360/a),y:i-n/(180/i),heading:t,pitch:n}}function Z(t,a){const i=n(Math.acos(-t.z/a));return{heading:n(Math.atan2(t.x,t.y)),pitch:i}}function G(t,n,i=S/2){return[i*(Math.sin(a(t))*Math.sin(a(n))),i*(Math.cos(a(t))*Math.sin(a(n))),i*Math.cos(a(180-n))]}function J(t,n,a,i=S/2){const{heading:e,pitch:o}=T(t,n,a);return G(e,o,i)}async function $(t,a,i){const e=await v(a,t.spatialReference,i);let o=n(Math.atan2(e.y-t.y,e.x-t.x));return o=o>=0&&o<=90?90-o:o>90&&o<=180?360-o+90:90+Math.abs(o),o}function B(t,n,a){const i=Math.cos(a),e=Math.sin(a),o=[1,0,0,1,0,0],r=o[0]*i+o[2]*e,c=o[1]*i+o[3]*e,s=-o[0]*e+o[2]*i,l=-o[1]*e+o[3]*i;o[0]=r,o[1]=c,o[2]=s,o[3]=l;return[t*o[0]+n*o[2]+o[4],t*o[1]+n*o[3]+o[5]]}const Q=t=>t.toArray(),_=(...t)=>t.some((t=>t));function tt(t,n){if(_(0===t.length,t.some((({x:t,y:n})=>_(null==t,null==n))),!n.hasZ))throw new Error("Input pixels must have x, y and camera location must have z value")}function nt(t,n){if(t.some((t=>null==t.z))||null==n.z)throw new Error("Input points and camera location must have z value")}function at(t){if(9!==t?.length)throw new Error("Rotation matrix is not provided or is not a valid 3x3 matrix")}function it(t,n){return d(n)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*t/g.radius))):1}const et=t=>n=>new M(n,t),ot=t=>null!=t&&"queryExtent"in t;function rt(t,n,a,i){return[[-n,-n],[+n,-n],[+n,+n],[-n,+n]].map((([n,e])=>z(x(c(),a,[n,e,0]),i,t)))}function ct({a0:t,a1:n,a2:a,b0:i,b1:e,b2:o},r,c,s){const l=[t??r/2-.5,n,a??0,i??c/2-.5,e??0,o].map(st);return null!=s&&lt(l)?{affines:l,focalLength:s}:{affines:[r/2-.5,1,0,c/2-.5,0,-1]}}function st(t,n){if(null==t)return null;const a=parseFloat(`${t}`);return isNaN(a)?null:a}function lt(t){return null!=t[1]&&null!=t[5]}function ft(t,n,a){const{cameraHeight:i,cameraPitch:e,cameraRoll:o,elevation:r,farDistance:c,horizontalFieldOfView:s,location:l,verticalFieldOfView:f}=St(t,t.location.spatialReference),u=r??(l.z??0)-i;return{...mt(t,n,a),averageElevation:u,cameraPitch:e,cameraRoll:o??0,farDistance:c,horizontalFieldOfView:s,verticalFieldOfView:f}}function ut(t,n,a,i){return yt(i)?U([i.omega,i.phi,i.kappa]):Ot(i)?k([i.heading,i.pitch,i.roll]):k([t,n,a??0])}function ht(t,n,a){const{cameraHeading:i,cameraHeight:e,elevation:o,farDistance:r,horizontalFieldOfView:c,location:s,verticalFieldOfView:l}=St(t,t.location.spatialReference);return{averageElevation:o??(s.z??0)-e,cameraLocation:s,cameraHeading:i,farDistance:r,horizontalFieldOfView:c,imageHeight:a,imageWidth:n,verticalFieldOfView:l}}function mt(t,n,a){const{a0:i,a1:e,a2:o,b0:r,b1:c,b2:s,cameraHeading:l,cameraOrientation:f,cameraPitch:u,cameraRoll:h,focalLength:m,horizontalFieldOfView:p,location:M,matrix:v,principalX:g,principalY:d,radial:x,tangential:w,verticalFieldOfView:y}=t,{affines:O,focalLength:b}=ct({a0:i,a1:e,a2:o,b0:r,b1:c,b2:s},n,a,m),j=v??ut(l,u,h,f),E=null!=g&&null!=d?[g,d]:void 0;return{affineTransformations:f?.affineTransformations??O,cameraLocation:M.clone(),focalLength:f?.focalLength??b,horizontalFieldOfView:p,imageHeight:a,imageWidth:n,principalOffsetPoint:f?.principalOffsetPoint??E,radialDistortionCoefficients:f?.radialDistortionCoefficients??x,rotationMatrix:j,tangentialDistortionCoefficients:f?.tangentialDistortionCoefficients??w,verticalFieldOfView:y}}const pt=t=>null!=t&&"elevationSample"in t&&null!=t.elevationSample,Mt=t=>O(t?.elevationSource)&&null!=t?.extent,vt=t=>w(t?.elevationSource),gt=async(t,n,a,i,e)=>{const o=b(t),r=n-a/o;return vt(i)?(i.elevationSource=new y({constantElevation:i.elevationSource.constantElevation/o}),i):pt(i)?i:Mt(i)?{elevationSample:await j({...p(i.elevationSource)?i.elevationSource.toJSON():i.elevationSource,extent:i.extent},e),elevationSource:new y({constantElevation:r})}:{averageGroundElevation:r,spatialReference:t}},dt=t=>E(t?.heading)&&E(t?.pitch),xt=(t,n)=>[[-t,-n],[t,-n],[t,n],[-t,n]];function wt(t){const{cameraLocation:n,farDistance:e,horizontalFieldOfView:o,rotationMatrix:r,scalingFactor:s,verticalFieldOfView:f}=t,u=i();l(u,r);const p=2*Math.tan(a(f)/2)*e*s,M=2*Math.tan(a(o)/2)*e*s,v=L([0,0,-1],u),g=C([n.x,n.y,n.z],v,t.farDistance*s,s),d=L([0,1,0],u),x=L([1,0,0],u),w=D(d,p/2,s),y=D(x,M/2,s),O=h(c(),w,y),b=m(c(),w,y);return[m(c(),g,O),m(c(),g,b),h(c(),g,O),h(c(),g,b)]}const yt=t=>2===t?.type,Ot=t=>1===t?.type;function bt(t){const n=t%360;return n<-180?n+360:n}function jt(t,n,a){if("panoramic"===t){const[t,i]=a;return X({x:n.x,y:n.y,z:n.z},t,i)}return{x:n.x+.5,y:.5-n.y}}var Et;function St(t,n,a=!0){const i=b(n),e=a?t.clone():t;return e.cameraHeight/=i,e.farDistance/=i,e.nearDistance/=i,w(e.elevationSource)&&(e.elevationSource.constantElevation/=i),e}!function(t){t[t.CLOCKWISE=-1]="CLOCKWISE",t[t.COUNTERCLOCKWISE=1]="COUNTERCLOCKWISE"}(Et||(Et={}));export{wt as computeFarplaneVertices,A as computeHFOVAndVFOV,rt as computeNewReferenceCoordinates,G as convertHeadingPitchToSphereVertex,Y as convertOrientationToPixelLocation,J as convertPixelLocationToSphereVertex,T as convertPixelToHeadingPitch,Z as convertSphereVertexToOrientation,X as convertSphereVertexToPixelLocation,St as convertToSRUnits,q as createRotationMatrix,k as createRotationMatrixFromHPR,U as createRotationMatrixFromOPK,K as geographicToLTP,ct as getAffinesAndFocalLength,ht as getImageToWorldPanoramicProperties,ft as getImageToWorldProperties,$ as getInitialAngle,gt as getUpdateElevationProps,it as getWebMercatorScalingFactor,mt as getWorldToImageProperties,dt as hasAngles,Ot as hasHeadingPitchRoll,yt as hasOmegaPhiKappa,ot as isElevationSampler,pt as isUpdateElevationWithElevationSampler,Mt as isUpdateElevationWithElevationSource,vt as isUpdateUsingConstantElevation,lt as isValidAffines,V as linearEquationSolve,W as ltpToGeographic,bt as normalizeHeading,_ as or,Q as pointToArray,z as projectiveTransform,xt as reducerFn,B as rotatePixel,C as scaleAndAddWithFactor,D as scaleWithFactor,jt as transformGraphicCoordinatesToPixel,L as transformMat3,H as transformMat4,tt as validatePixelsToTransform,nt as validatePointsToTransform,at as validateRotationMatrix,et as vecToPoint};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../PopupTemplate.js";import r from"../../core/Clonable.js";import"../../core/has.js";import i from"../../core/Error.js";import o from"../../core/Identifiable.js";import{clone as n}from"../../core/lang.js";import l from"../../core/Loadable.js";import s from"../../core/Logger.js";import{destroyMaybe as a}from"../../core/maybe.js";import{MultiOriginJSONMixin as p}from"../../core/MultiOriginJSONSupport.js";import{setDeepValue as d}from"../../core/object.js";import{sqlAnd as u}from"../../core/sql.js";import{property as y}from"../../core/accessorSupport/decorators/property.js";import{reader as c}from"../../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import{writer as f}from"../../core/accessorSupport/decorators/writer.js";import{excludeTables as h}from"../../core/accessorSupport/layerContainerType.js";import b from"../../form/FormTemplate.js";import g from"../../geometry/SpatialReference.js";import{labelsVisible as j,legendEnabled as v,minScale as w,maxScale as F,popupEnabled as I}from"./commonProperties.js";import{createQuery as T,computeDomainFromSubtypes as O}from"./featureLayerUtils.js";import S from"./FeatureTemplate.js";import{defineFieldProperties as C}from"./fieldProperties.js";import{fixRendererFields as E}from"./fieldUtils.js";import q from"./LabelClass.js";import{reader as x}from"./labelingInfo.js";import{rendererReader as A,supportedRendererTypes as R}from"./subtypeGroupLayerUtils.js";import P from"./TitleCreator.js";import L from"../../renderers/SimpleRenderer.js";import _ from"../../rest/support/Query.js";import{createPopupTemplate as D}from"../../support/popupUtils.js";import{defaultPolygonSymbol2D as G,defaultPolylineSymbol2D as M,defaultPointSymbol2D as N}from"../../symbols/support/defaults.js";import V from"../../tables/AttributeTableTemplate.js";const $=C();let U=0;function k(e,t){let r=e.json.write;return"object"!=typeof r&&(r=e.json.write={}),r.ignoreOrigin=!0,t?.spatialOnly&&(r.layerContainerTypes=h),e}function Q(e){const t={write:{ignoreOrigin:!0}};return e?.name&&(t.name=e.name),"object"==typeof t.write&&(e?.spatialOnly&&(t.write.layerContainerTypes=h),e?.target&&(t.write.target=e.target)),t}function B(e){return new L({symbol:H(e)})}function H(e){switch(e){case"point":case"multipoint":return N.clone();case"polyline":return M.clone();case"polygon":case"multipatch":return G.clone();default:return null}}function J(e,t){return!!t&&("unique-value"===e?.type&&null!=e.field&&e.field.toLowerCase()===t.toLowerCase()&&!e.field2&&!e.field3&&!e.valueExpression)}function W(e,t){return null==e?null:t.subtypes?.find((t=>t.code===e))}function Z(e,t){let r=null;switch(t.geometryType){case"esriGeometryPoint":case"esriGeometryMultipoint":r="point";break;case"esriGeometryPolyline":r="line";break;case"esriGeometryPolygon":case"esriGeometryMultiPatch":r="polygon";break;default:t.type,r=null}const i={},o=W(e,t);if(null!=o){const{defaultValues:e}=o;for(const t in e)i[t]=e[t]}return i[t.subtypeField]=e,new S({name:"New Feature",drawingTool:r,prototype:{attributes:i}})}let z=class extends(p(r.ClonableMixin(o.IdentifiableMixin(l)))){constructor(e){super(e),this.attributeTableTemplate=null,this.charts=null,this.editingEnabled=!0,this.fieldOverrides=null,this.fieldsIndex=null,this.formTemplate=null,this.id=`${Date.now().toString(16)}-subtype-sublayer-${U++}`,this.type="subtype-sublayer",this.labelsVisible=!0,this.labelingInfo=null,this.layerType="ArcGISFeatureLayer",this.legendEnabled=!0,this.listMode="show",this.minScale=0,this.maxScale=0,this.opacity=1,this.parent=null,this.popupEnabled=!0,this.popupTemplate=null,this.subtypeCode=null,this.templates=null,this.title=null,this.visible=!0}load(e){return E(this.renderer,this.fieldsIndex),Promise.resolve(this)}get _titleCreator(){const e=this._get("_titleCreator");return a(e),new P({fieldsIndex:this.fieldsIndex,objectIdField:this.objectIdField,displayField:this.parent?.displayField??"",fields:this.fields,effectivePopupTemplate:this.popupTemplate??this.defaultPopupTemplate})}get capabilities(){return this.parent?.capabilities}get effectiveCapabilities(){return this.parent?.effectiveCapabilities}get effectiveEditingEnabled(){const{parent:e}=this;return e?e.effectiveEditingEnabled&&this.editingEnabled:this.editingEnabled}get elevationInfo(){return this.parent?.elevationInfo}get featureTitleFields(){return[...this._titleCreator.requiredFields]}writeFieldOverrides(e,t,r){const{fields:i,parent:o}=this;let l;if(i){l=[];let e=0;i.forEach((({name:t,alias:r,editable:i,visible:n})=>{if(!n)return;const s=o?.fields?.find((e=>e.name===t));if(!s)return;const a={name:t};let p=!1;r!==s.alias&&(a.alias=r,p=!0),i!==s.editable&&(a.editable=i,p=!0),l.push(a),p&&e++})),0===e&&l.length===i.length&&(l=null)}else l=n(e);l?.length&&d(r,l,t)}get fields(){const{parent:e,fieldOverrides:t,subtypeCode:r}=this,i=e?.fields;if(!e||!i?.length)return null;const{subtypes:o,subtypeField:n}=e,l=o?.find((e=>e.code===r)),s=l?.defaultValues,a=l?.domains,p=[];for(const d of i){const e=d.clone(),{name:i}=e,o=t?.find((e=>e.name===i));if(e.visible=!t?.length||!!o,o){const{alias:t,editable:r}=o;t&&(e.alias=t),!1===r&&(e.editable=!1)}const l=s?.[i]??null;e.defaultValue=i===n?r:l;const u=a?.[i]??null;e.domain=i===n?null:u?"inherited"===u.type?e.domain:u.clone():null,p.push(e)}return p}get floorInfo(){return this.parent?.floorInfo}get isTable(){return!!this.parent?.isTable}get geometryType(){return this.parent?.geometryType}get globalIdField(){return this.parent?this.parent.globalIdField:(s.getLogger(this).error(Y("globalIdField")),null)}get effectiveScaleRange(){const{minScale:e,maxScale:t}=this;return{minScale:e,maxScale:t}}get objectIdField(){return this.parent||s.getLogger(this).error(Y("objectIdField")),this.parent?.objectIdField}get defaultPopupTemplate(){return this.createPopupTemplate()}get relationships(){return this.parent?.relationships}set renderer(e){E(e,this.fieldsIndex),this._override("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const{parent:e}=this;return e&&!e.isTable&&"mesh"!==e.geometryType?B(e.geometryType):null}readRendererFromService(e,t,r){if("Table"===t.type)return null;const i=t.drawingInfo?.renderer,o=A(i,t,r);let n;const{subtypeCode:l}=this;if(null!=l&&J(o,t.subtypeField)){const e=o.uniqueValueInfos?.find((({value:e})=>(e="number"==typeof e?String(e):e)===String(l)));e&&(n=new L({symbol:e.symbol}))}else"simple"!==o?.type||o.visualVariables?.length||(n=o);return n}readRenderer(e,t,r){const i=t?.layerDefinition?.drawingInfo?.renderer;if(!i)return;const o=i.visualVariables?.some((e=>"rotationInfo"!==e.type));return o?void 0:A(i,t,r)||void 0}get spatialReference(){return this.parent?.spatialReference??g.WGS84}get subtypeField(){return this.parent?.subtypeField}readTemplatesFromService(e,t){return[Z(this.subtypeCode,t)]}readTitleFromService(e,t){const r=W(this.subtypeCode,t);return null!=r?r.name:null}get url(){return this.parent?.url}get userHasUpdateItemPrivileges(){return!!this.parent?.userHasUpdateItemPrivileges}async addAttachment(e,t){const{parent:r}=this;if(!r)throw Y("addAttachment");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new i("subtype-sublayer:addAttachment","The feature provided does not belong to this SubtypeSublayer");return r.addAttachment(e,t)}async updateAttachment(e,t,r){const{parent:o}=this;if(!o)throw Y("updateAttachment");if(e.getAttribute(o.subtypeField)!==this.subtypeCode)throw new i("subtype-sublayer:updateAttachment","The feature provided does not belong to this SubtypeSublayer");return o.updateAttachment(e,t,r)}async deleteAttachments(e,t){const{parent:r}=this;if(!r)throw Y("deleteAttachments");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new i("subtype-sublayer:deleteAttachments","The feature provided does not belong to this SubtypeSublayer");return r.deleteAttachments(e,t)}async applyEdits(e,t){if(!this.parent)throw Y("applyEdits");return this.parent.applyEdits(e,t)}createPopupTemplate(e){let t=this;const{parent:r,fields:i,title:o}=this;if(r){const{displayField:e,editFieldsInfo:n,objectIdField:l}=r;t={displayField:e,editFieldsInfo:n,fields:i,objectIdField:l,title:o}}return D(t,e)}createQuery(){if(!this.parent)throw Y("createQuery");const e=T(this.parent),t=`${this.parent.subtypeField}=${this.subtypeCode}`;return e.where=u(t,this.parent.definitionExpression),e}getFeatureTitle(e,t={timeZone:"system",fetchMissingFields:!1}){return this._titleCreator.getTitle(this,e,t)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){if(!t?.excludeImpliedDomains&&this.parent){const t=O(this.parent,e);if(t)return t}return this._getLayerDomain(e)}async queryAttachments(e,t){const r=await this.load();if(!r.parent)throw Y("queryAttachments");const i=e.clone();return i.where=X(i.where,r.parent.subtypeField,r.subtypeCode),r.parent.queryAttachments(e,t)}async queryFeatureCount(e,t){const r=await this.load();if(!r.parent)throw Y("queryFeatureCount");return r.parent.queryFeatureCount(K(r.parent,r,e),t)}async queryFeatures(e,t){const r=await this.load();if(!r.parent)throw Y("queryFeatures");return r.parent.queryFeatures(K(r.parent,r,e),t)}async queryObjectIds(e,t){const r=await this.load();if(!r.parent)throw Y("queryObjectIds");return r.parent.queryObjectIds(K(r.parent,r,e),t)}async queryRelatedFeatures(e,t){const r=await this.load();if(!r.parent)throw Y("queryRelatedFeatures");return r.parent.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){const r=await this.load();if(!r.parent)throw Y("queryRelatedFeaturesCount");return r.parent.queryRelatedFeaturesCount(e,t)}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}};e([y({clonable:!1,readOnly:!0})],z.prototype,"_titleCreator",null),e([y({type:V,json:Q({name:"attributeTableInfo"})})],z.prototype,"attributeTableTemplate",void 0),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"capabilities",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"effectiveCapabilities",null),e([y({json:Q()})],z.prototype,"charts",void 0),e([y({type:Boolean,nonNullable:!0,json:Q({name:"enableEditing"})})],z.prototype,"editingEnabled",void 0),e([y({type:Boolean,readOnly:!0})],z.prototype,"effectiveEditingEnabled",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"elevationInfo",null),e([y({clonable:!1,readOnly:!0})],z.prototype,"featureTitleFields",null),e([y({json:{name:"layerDefinition.fieldOverrides",origins:{service:{read:!1}},write:{ignoreOrigin:!0,allowNull:!0}}})],z.prototype,"fieldOverrides",void 0),e([f("fieldOverrides")],z.prototype,"writeFieldOverrides",null),e([y({...$.fields,readOnly:!0,json:{read:!1}})],z.prototype,"fields",null),e([y($.fieldsIndex)],z.prototype,"fieldsIndex",void 0),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"floorInfo",null),e([y({type:b,json:Q({name:"formInfo"})})],z.prototype,"formTemplate",void 0),e([y({type:String,clonable:!1,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],z.prototype,"id",void 0),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"isTable",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"geometryType",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"globalIdField",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"type",void 0),e([y(k(n(j)))],z.prototype,"labelsVisible",void 0),e([y({type:[q],json:{name:"layerDefinition.drawingInfo.labelingInfo",origins:{service:{read:!1}},read:{reader:x},write:{ignoreOrigin:!0,layerContainerTypes:h}}})],z.prototype,"labelingInfo",void 0),e([y({type:["ArcGISFeatureLayer"],readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0,layerContainerTypes:h}}})],z.prototype,"layerType",void 0),e([y(k(n(v)))],z.prototype,"legendEnabled",void 0),e([y({type:["show","hide"]})],z.prototype,"listMode",void 0),e([y((()=>{const e=n(w);return e.json.origins.service.read=!1,k(e,{spatialOnly:!0})})())],z.prototype,"minScale",void 0),e([y((()=>{const e=n(F);return e.json.origins.service.read=!1,k(e,{spatialOnly:!0})})())],z.prototype,"maxScale",void 0),e([y({readOnly:!0})],z.prototype,"effectiveScaleRange",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"objectIdField",null),e([y({type:Number,range:{min:0,max:1},nonNullable:!0,json:Q({spatialOnly:!0})})],z.prototype,"opacity",void 0),e([y({clonable:!1})],z.prototype,"parent",void 0),e([y(k(n(I)))],z.prototype,"popupEnabled",void 0),e([y({type:t,json:Q({name:"popupInfo"})})],z.prototype,"popupTemplate",void 0),e([y({readOnly:!0})],z.prototype,"defaultPopupTemplate",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"relationships",null),e([y({types:R,json:Q({target:"layerDefinition.drawingInfo.renderer",spatialOnly:!0})})],z.prototype,"renderer",null),e([c("service","renderer",["drawingInfo.renderer","subtypeField","type"])],z.prototype,"readRendererFromService",null),e([c("renderer",["layerDefinition.drawingInfo.renderer"])],z.prototype,"readRenderer",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"spatialReference",null),e([y({type:Number,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],z.prototype,"subtypeCode",void 0),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"subtypeField",null),e([y({type:[S],json:Q({name:"layerDefinition.templates"})})],z.prototype,"templates",void 0),e([c("service","templates",["geometryType","subtypeField","subtypes","type"])],z.prototype,"readTemplatesFromService",null),e([y({type:String,json:Q()})],z.prototype,"title",void 0),e([c("service","title",["subtypes"])],z.prototype,"readTitleFromService",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"url",null),e([y({readOnly:!0})],z.prototype,"userHasUpdateItemPrivileges",null),e([y({type:Boolean,nonNullable:!0,json:Q({name:"visibility",spatialOnly:!0})})],z.prototype,"visible",void 0),z=e([m("esri.layers.support.SubtypeSublayer")],z);const K=(e,t,r)=>{if(!r)return t.createQuery();const i=_.from(r);return i.where=X(i.where,e.subtypeField,t.subtypeCode),i},X=(e,t,r)=>{const i=new RegExp(`${t}\\s*=\\s*\\d+`),o=`${t}=${r}`,n=e??"";return i.test(n)?n.replace(i,o):u(o,n)},Y=e=>new i("subtype-sublayer:parent-missing",`This sublayer must have a parent SubtypeGroupLayer in order to use ${e}`);export{z as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../PopupTemplate.js";import r from"../../core/Clonable.js";import"../../core/has.js";import i from"../../core/Error.js";import o from"../../core/Identifiable.js";import{clone as n}from"../../core/lang.js";import l from"../../core/Loadable.js";import s from"../../core/Logger.js";import{destroyMaybe as a}from"../../core/maybe.js";import{MultiOriginJSONMixin as p}from"../../core/MultiOriginJSONSupport.js";import{setDeepValue as d}from"../../core/object.js";import{sqlAnd as u}from"../../core/sql.js";import{property as y}from"../../core/accessorSupport/decorators/property.js";import{reader as c}from"../../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import{writer as f}from"../../core/accessorSupport/decorators/writer.js";import{excludeTables as h}from"../../core/accessorSupport/layerContainerType.js";import b from"../../form/FormTemplate.js";import g from"../../geometry/SpatialReference.js";import{labelsVisible as j,legendEnabled as v,minScale as w,maxScale as F,popupEnabled as T}from"./commonProperties.js";import{createQuery as I,computeDomainFromSubtypes as O}from"./featureLayerUtils.js";import S from"./FeatureTemplate.js";import{defineFieldProperties as C}from"./fieldProperties.js";import{fixRendererFields as E}from"./fieldUtils.js";import q from"./LabelClass.js";import{reader as x}from"./labelingInfo.js";import{rendererReader as A,supportedRendererTypes as R}from"./subtypeGroupLayerUtils.js";import P from"./TitleCreator.js";import L from"../../renderers/SimpleRenderer.js";import _ from"../../rest/support/Query.js";import{createPopupTemplate as D}from"../../support/popupUtils.js";import{defaultPolygonSymbol2D as G,defaultPolylineSymbol2D as N,defaultPointSymbol2D as V}from"../../symbols/support/defaults.js";import $ from"../../tables/AttributeTableTemplate.js";const M=C();let U=0;function k(e,t){let r=e.json.write;return"object"!=typeof r&&(r=e.json.write={}),r.ignoreOrigin=!0,t?.spatialOnly&&(r.layerContainerTypes=h),e}function Q(e){const t={write:{ignoreOrigin:!0}};return e?.name&&(t.name=e.name),"object"==typeof t.write&&(e?.spatialOnly&&(t.write.layerContainerTypes=h),e?.target&&(t.write.target=e.target)),t}function B(e){return new L({symbol:H(e)})}function H(e){switch(e){case"point":case"multipoint":return V.clone();case"polyline":return N.clone();case"polygon":case"multipatch":return G.clone();default:return null}}function J(e,t){return!!t&&("unique-value"===e?.type&&null!=e.field&&e.field.toLowerCase()===t.toLowerCase()&&!e.field2&&!e.field3&&!e.valueExpression)}function W(e,t){return null==e?null:t.subtypes?.find((t=>t.code===e))}function z(e,t){let r=null;switch(t.geometryType){case"esriGeometryPoint":case"esriGeometryMultipoint":r="point";break;case"esriGeometryPolyline":r="line";break;case"esriGeometryPolygon":case"esriGeometryMultiPatch":r="polygon";break;default:t.type,r=null}const i={},o=W(e,t);if(null!=o){const{defaultValues:e}=o;for(const t in e)i[t]=e[t]}return i[t.subtypeField]=e,new S({name:"New Feature",drawingTool:r,prototype:{attributes:i}})}let K=class extends(p(r.ClonableMixin(o.IdentifiableMixin(l)))){constructor(e){super(e),this.attributeTableTemplate=null,this.charts=null,this.editingEnabled=!0,this.fieldOverrides=null,this.fieldsIndex=null,this.formTemplate=null,this.id=`${Date.now().toString(16)}-subtype-sublayer-${U++}`,this.type="subtype-sublayer",this.labelsVisible=!0,this.labelingInfo=null,this.layerType="ArcGISFeatureLayer",this.legendEnabled=!0,this.listMode="show",this.minScale=0,this.maxScale=0,this.opacity=1,this.parent=null,this.popupEnabled=!0,this.popupTemplate=null,this.subtypeCode=null,this.templates=null,this.title=null,this.visible=!0}load(e){return E(this.renderer,this.fieldsIndex),Promise.resolve(this)}get _titleCreator(){const e=this._get("_titleCreator");return a(e),new P({fieldsIndex:this.fieldsIndex,objectIdField:this.objectIdField,displayField:this.parent?.displayField??"",fields:this.fields,effectivePopupTemplate:this.popupTemplate??this.defaultPopupTemplate})}get capabilities(){return this.parent?.capabilities}get effectiveCapabilities(){return this.parent?.effectiveCapabilities}get effectiveEditingEnabled(){const{parent:e}=this;return e?e.effectiveEditingEnabled&&this.editingEnabled:this.editingEnabled}get elevationInfo(){return this.parent?.elevationInfo}get featureTitleFields(){return[...this._titleCreator.requiredFields]}writeFieldOverrides(e,t,r){const{fields:i,parent:o}=this;let l;if(i){l=[];let e=0;i.forEach((({name:t,alias:r,editable:i,visible:n})=>{if(!n)return;const s=o?.fields?.find((e=>e.name===t));if(!s)return;const a={name:t};let p=!1;r!==s.alias&&(a.alias=r,p=!0),i!==s.editable&&(a.editable=i,p=!0),l.push(a),p&&e++})),0===e&&l.length===i.length&&(l=null)}else l=n(e);l?.length&&d(r,l,t)}get fields(){const{parent:e,fieldOverrides:t,subtypeCode:r}=this,i=e?.fields;if(!e||!i?.length)return null;const{subtypes:o,subtypeField:n}=e,l=o?.find((e=>e.code===r)),s=l?.defaultValues,a=l?.domains,p=[];for(const d of i){const e=d.clone(),{name:i}=e,o=t?.find((e=>e.name===i));if(e.visible=!t?.length||!!o,o){const{alias:t,editable:r}=o;t&&(e.alias=t),!1===r&&(e.editable=!1)}const l=s?.[i]??null;e.defaultValue=i===n?r:l;const u=a?.[i]??null;e.domain=i===n?null:u?"inherited"===u.type?e.domain:u.clone():null,p.push(e)}return p}get floorInfo(){return this.parent?.floorInfo}get isTable(){return!!this.parent?.isTable}get geometryType(){return this.parent?.geometryType}get globalIdField(){return this.parent?this.parent.globalIdField:(s.getLogger(this).error(Z("globalIdField")),null)}get effectiveScaleRange(){const{minScale:e,maxScale:t}=this;return{minScale:e,maxScale:t}}get objectIdField(){return this.parent||s.getLogger(this).error(Z("objectIdField")),this.parent?.objectIdField}get defaultPopupTemplate(){return this.createPopupTemplate()}get relationships(){return this.parent?.relationships}set renderer(e){E(e,this.fieldsIndex),this._override("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const{parent:e}=this;return e&&!e.isTable&&"mesh"!==e.geometryType?B(e.geometryType):null}readRendererFromService(e,t,r){if("Table"===t.type)return null;const i=t.drawingInfo?.renderer,o=A(i,t,r);let n;const{subtypeCode:l}=this;if(null!=l&&J(o,t.subtypeField)){const e=o.uniqueValueInfos?.find((({value:e})=>(e="number"==typeof e?String(e):e)===String(l)));e&&(n=new L({symbol:e.symbol}))}else"simple"!==o?.type||o.visualVariables?.length||(n=o);return n}readRenderer(e,t,r){const i=t?.layerDefinition?.drawingInfo?.renderer;if(!i)return;const o=i.visualVariables?.some((e=>"rotationInfo"!==e.type));return o?void 0:A(i,t,r)||void 0}get spatialReference(){return this.parent?.spatialReference??g.WGS84}get subtypeField(){return this.parent?.subtypeField}readTemplatesFromService(e,t){return[z(this.subtypeCode,t)]}readTitleFromService(e,t){const r=W(this.subtypeCode,t);return null!=r?r.name:null}get url(){return this.parent?.url}get userHasUpdateItemPrivileges(){return!!this.parent?.userHasUpdateItemPrivileges}async addAttachment(e,t){const{parent:r}=this;if(!r)throw Z("addAttachment");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new i("subtype-sublayer:addAttachment","The feature provided does not belong to this SubtypeSublayer");return r.addAttachment(e,t)}async updateAttachment(e,t,r){const{parent:o}=this;if(!o)throw Z("updateAttachment");if(e.getAttribute(o.subtypeField)!==this.subtypeCode)throw new i("subtype-sublayer:updateAttachment","The feature provided does not belong to this SubtypeSublayer");return o.updateAttachment(e,t,r)}async deleteAttachments(e,t){const{parent:r}=this;if(!r)throw Z("deleteAttachments");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new i("subtype-sublayer:deleteAttachments","The feature provided does not belong to this SubtypeSublayer");return r.deleteAttachments(e,t)}async applyEdits(e,t){if(!this.parent)throw Z("applyEdits");return this.parent.applyEdits(e,t)}createPopupTemplate(e){let t=this;const{parent:r,fields:i,title:o}=this;if(r){const{displayField:e,editFieldsInfo:n,objectIdField:l}=r;t={displayField:e,editFieldsInfo:n,fields:i,objectIdField:l,title:o}}return D(t,e)}createQuery(){if(!this.parent)throw Z("createQuery");const e=I(this.parent),t=`${this.parent.subtypeField}=${this.subtypeCode}`;return e.where=u(t,this.parent.definitionExpression),e}getFeatureTitle(e,t){return this._titleCreator.getTitle(this,e,t)}getFeatureTitles(e,t){return this._titleCreator.getTitles(this,e,t)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){if(!t?.excludeImpliedDomains&&this.parent){const t=O(this.parent,e);if(t)return t}return this._getLayerDomain(e)}async queryAttachments(e,t){const r=await this.load();if(!r.parent)throw Z("queryAttachments");const i=e.clone();return i.where=Y(i.where,r.parent.subtypeField,r.subtypeCode),r.parent.queryAttachments(e,t)}async queryFeatureCount(e,t){const r=await this.load();if(!r.parent)throw Z("queryFeatureCount");return r.parent.queryFeatureCount(X(r.parent,r,e),t)}async queryFeatures(e,t){const r=await this.load();if(!r.parent)throw Z("queryFeatures");return r.parent.queryFeatures(X(r.parent,r,e),t)}async queryObjectIds(e,t){const r=await this.load();if(!r.parent)throw Z("queryObjectIds");return r.parent.queryObjectIds(X(r.parent,r,e),t)}async queryRelatedFeatures(e,t){const r=await this.load();if(!r.parent)throw Z("queryRelatedFeatures");return r.parent.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){const r=await this.load();if(!r.parent)throw Z("queryRelatedFeaturesCount");return r.parent.queryRelatedFeaturesCount(e,t)}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}};e([y({clonable:!1,readOnly:!0})],K.prototype,"_titleCreator",null),e([y({type:$,json:Q({name:"attributeTableInfo"})})],K.prototype,"attributeTableTemplate",void 0),e([y({readOnly:!0,json:{read:!1}})],K.prototype,"capabilities",null),e([y({readOnly:!0,json:{read:!1}})],K.prototype,"effectiveCapabilities",null),e([y({json:Q()})],K.prototype,"charts",void 0),e([y({type:Boolean,nonNullable:!0,json:Q({name:"enableEditing"})})],K.prototype,"editingEnabled",void 0),e([y({type:Boolean,readOnly:!0})],K.prototype,"effectiveEditingEnabled",null),e([y({readOnly:!0,json:{read:!1}})],K.prototype,"elevationInfo",null),e([y({clonable:!1,readOnly:!0})],K.prototype,"featureTitleFields",null),e([y({json:{name:"layerDefinition.fieldOverrides",origins:{service:{read:!1}},write:{ignoreOrigin:!0,allowNull:!0}}})],K.prototype,"fieldOverrides",void 0),e([f("fieldOverrides")],K.prototype,"writeFieldOverrides",null),e([y({...M.fields,readOnly:!0,json:{read:!1}})],K.prototype,"fields",null),e([y(M.fieldsIndex)],K.prototype,"fieldsIndex",void 0),e([y({readOnly:!0,json:{read:!1}})],K.prototype,"floorInfo",null),e([y({type:b,json:Q({name:"formInfo"})})],K.prototype,"formTemplate",void 0),e([y({type:String,clonable:!1,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],K.prototype,"id",void 0),e([y({readOnly:!0,json:{read:!1}})],K.prototype,"isTable",null),e([y({readOnly:!0,json:{read:!1}})],K.prototype,"geometryType",null),e([y({readOnly:!0,json:{read:!1}})],K.prototype,"globalIdField",null),e([y({readOnly:!0,json:{read:!1}})],K.prototype,"type",void 0),e([y(k(n(j)))],K.prototype,"labelsVisible",void 0),e([y({type:[q],json:{name:"layerDefinition.drawingInfo.labelingInfo",origins:{service:{read:!1}},read:{reader:x},write:{ignoreOrigin:!0,layerContainerTypes:h}}})],K.prototype,"labelingInfo",void 0),e([y({type:["ArcGISFeatureLayer"],readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0,layerContainerTypes:h}}})],K.prototype,"layerType",void 0),e([y(k(n(v)))],K.prototype,"legendEnabled",void 0),e([y({type:["show","hide"]})],K.prototype,"listMode",void 0),e([y((()=>{const e=n(w);return e.json.origins.service.read=!1,k(e,{spatialOnly:!0})})())],K.prototype,"minScale",void 0),e([y((()=>{const e=n(F);return e.json.origins.service.read=!1,k(e,{spatialOnly:!0})})())],K.prototype,"maxScale",void 0),e([y({readOnly:!0})],K.prototype,"effectiveScaleRange",null),e([y({readOnly:!0,json:{read:!1}})],K.prototype,"objectIdField",null),e([y({type:Number,range:{min:0,max:1},nonNullable:!0,json:Q({spatialOnly:!0})})],K.prototype,"opacity",void 0),e([y({clonable:!1})],K.prototype,"parent",void 0),e([y(k(n(T)))],K.prototype,"popupEnabled",void 0),e([y({type:t,json:Q({name:"popupInfo"})})],K.prototype,"popupTemplate",void 0),e([y({readOnly:!0})],K.prototype,"defaultPopupTemplate",null),e([y({readOnly:!0,json:{read:!1}})],K.prototype,"relationships",null),e([y({types:R,json:Q({target:"layerDefinition.drawingInfo.renderer",spatialOnly:!0})})],K.prototype,"renderer",null),e([c("service","renderer",["drawingInfo.renderer","subtypeField","type"])],K.prototype,"readRendererFromService",null),e([c("renderer",["layerDefinition.drawingInfo.renderer"])],K.prototype,"readRenderer",null),e([y({readOnly:!0,json:{read:!1}})],K.prototype,"spatialReference",null),e([y({type:Number,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],K.prototype,"subtypeCode",void 0),e([y({readOnly:!0,json:{read:!1}})],K.prototype,"subtypeField",null),e([y({type:[S],json:Q({name:"layerDefinition.templates"})})],K.prototype,"templates",void 0),e([c("service","templates",["geometryType","subtypeField","subtypes","type"])],K.prototype,"readTemplatesFromService",null),e([y({type:String,json:Q()})],K.prototype,"title",void 0),e([c("service","title",["subtypes"])],K.prototype,"readTitleFromService",null),e([y({readOnly:!0,json:{read:!1}})],K.prototype,"url",null),e([y({readOnly:!0})],K.prototype,"userHasUpdateItemPrivileges",null),e([y({type:Boolean,nonNullable:!0,json:Q({name:"visibility",spatialOnly:!0})})],K.prototype,"visible",void 0),K=e([m("esri.layers.support.SubtypeSublayer")],K);const X=(e,t,r)=>{if(!r)return t.createQuery();const i=_.from(r);return i.where=Y(i.where,e.subtypeField,t.subtypeCode),i},Y=(e,t,r)=>{const i=new RegExp(`${t}\\s*=\\s*\\d+`),o=`${t}=${r}`,n=e??"";return i.test(n)?n.replace(i,o):u(o,n)},Z=e=>new i("subtype-sublayer:parent-missing",`This sublayer must have a parent SubtypeGroupLayer in order to use ${e}`);export{K as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{createTask as s}from"../../core/asyncUtils.js";import i from"../../core/Collection.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{featureHasFields as o,extractSubstitutionTemplatesFromString as n}from"./fieldUtils.js";import{loadArcade as l}from"../../support/loadArcade.js";const p="relationships/",c="expression/";let d=class extends t{constructor(e){super(e),this._featureUtils=null,this.effectivePopupTemplate=null}get _arcadeTask(){if(this.expressionsUsedInTitle.length>0){return this._get("_arcadeTask")||s((()=>l()))}return null}get featureUtilsPromise(){return this._get("featureUtilsPromise")??import("../../widgets/Feature/support/featureUtils.js").then((e=>this._featureUtils=e))}get calculatedExpressions(){const e=new i;if(!this.expressionsUsedInTitle.length)return e;if(!this._arcadeTask?.value){for(const t of this.expressionsUsedInTitle??[])e.push({name:t.name,invalid:!0});return e}for(const t of this.expressionsUsedInTitle)try{const s=this._arcadeTask.value.arcade.parseScript(t.expression,["$layer","$map","$datastore"]);if(s.isAsync){e.push({name:t.name,invalid:!0});break}e.push({name:t.name,syntax:s,invalid:!1,func:this._arcadeTask.value.arcade.compileScript(s,{vars:{$feature:"any"}})})}catch{e.push({name:t.name,invalid:!0});break}return e}get expressionsUsedInTitle(){let e=this.effectivePopupTemplate?.title??"";return"string"!=typeof e?[]:(e=e.toLowerCase(),this.effectivePopupTemplate?.expressionInfos?.filter((t=>e.includes(`{expression/${t.name.toLowerCase()}}`)))??[])}get fieldInfoMap(){return this._featureUtils?this._createFieldInfoMap(this._featureUtils.getAllFieldInfos(this.effectivePopupTemplate)):null}get hasBadExpressions(){return this.calculatedExpressions.some((e=>!0===e.invalid))}get requiredFields(){const e=new Set;if(this._arcadeTask?.value&&!this.hasBadExpressions)for(const s of this.calculatedExpressions?.toArray()??[])try{const t=this._arcadeTask.value.arcade.extractFieldLiterals(s.syntax);for(const s of t){const t=s.split("."),i=this.fieldsIndex.get(t.at(-1)??"");i&&e.add(i.name)}}catch{}const t=this._extractFieldNames(this.workingTitle);for(const s of t){const t=this.fieldsIndex.get(s);t&&e.add(t.name)}return e}get titleFromDisplayField(){let e="";return this.displayField&&(e=this.fieldsIndex.get(this.displayField)?.name??""),e||(e=this.fieldsIndex.get(this.objectIdField)?.name??""),e?`{${e}}`:""}get workingTitle(){const e=this.effectivePopupTemplate?this.effectivePopupTemplate.title:"";return""===e||null==e||this.hasBadExpressions||"string"!=typeof e?this.titleFromDisplayField:e}async getTitle(e,t,s){try{const{attributes:i}=t,r=s?.timeZone??"system",[{substituteFieldsInLinksAndAttributes:a}]=await Promise.all([this.featureUtilsPromise,this._arcadeTask?.promise]);if(s.fetchMissingFields&&(t=await this._checkAndReQueryGraphic(e,t)),this.workingTitle&&this.fieldInfoMap){const s=this._createFormattedAttributes(e,t,r).global;return a({attributes:i,expressionAttributes:null,fieldInfoMap:this.fieldInfoMap,globalAttributes:s,layer:e,text:this.workingTitle})}return""}catch{}return""}async _checkAndReQueryGraphic(e,t){const s=t.getObjectId();if(null==s)return t;if(!o(t,this.requiredFields)){const t=e.createQuery();t.where="1=1",t.outFields=[...this.requiredFields],t.objectIds=[s];const i=await e.queryFeatures(t);if(1===i?.features.length)return i.features[0]}return t}_createFieldInfoMap(e){const t=new Map;if(!e)return t;for(const s of e){if(!s.fieldName)continue;const e=this.fieldsIndex.get(s.fieldName),i=e?.name??s.fieldName;s.fieldName=i,t.set(i.toLowerCase(),s)}return t}_createFormattedAttributes(e,t,s="system"){const i=this.effectivePopupTemplate?.fieldInfos??[],r={};if(!this._featureUtils)return{};if(!this.hasBadExpressions&&this.calculatedExpressions.length>0&&this._arcadeTask?.value){const s=this._arcadeTask.value.Feature.createFromGraphicLikeObject(t.geometry,t.attributes,e,null);for(const e of this.calculatedExpressions)try{r[`expression/${e.name}`]=e.func({vars:{$feature:s}})}catch{}}const a={...t.attributes,...r};return{global:this._featureUtils.formatAttributes({fieldInfos:i,attributes:a,graphic:t,timeZone:s,layer:e,fieldInfoMap:this.fieldInfoMap}),content:[]}}_extractFieldNames(e){return n(e).filter((e=>!(0===e.indexOf(p)||0===e.indexOf(c))))}};e([r({readOnly:!0})],d.prototype,"_arcadeTask",null),e([r()],d.prototype,"_featureUtils",void 0),e([r({readOnly:!0})],d.prototype,"featureUtilsPromise",null),e([r({readOnly:!0})],d.prototype,"calculatedExpressions",null),e([r()],d.prototype,"displayField",void 0),e([r()],d.prototype,"effectivePopupTemplate",void 0),e([r()],d.prototype,"expressionsUsedInTitle",null),e([r()],d.prototype,"fieldsIndex",void 0),e([r()],d.prototype,"fieldInfoMap",null),e([r()],d.prototype,"fields",void 0),e([r()],d.prototype,"objectIdField",void 0),e([r()],d.prototype,"requiredFields",null),d=e([a("esri.layers.support.TitleCreator")],d);export{d as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{isSome as s}from"../../core/arrayUtils.js";import{createTask as i}from"../../core/asyncUtils.js";import r from"../../core/Collection.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{featureHasFields as n,extractSubstitutionTemplatesFromString as l}from"./fieldUtils.js";import{loadArcade as c}from"../../support/loadArcade.js";const p="relationships/",d="expression/";let u=class extends t{constructor(e){super(e),this._featureUtils=null,this.effectivePopupTemplate=null}get _arcadeTask(){if(this.expressionsUsedInTitle.length>0){return this._get("_arcadeTask")||i((()=>c()))}return null}get featureUtilsPromise(){return this._get("featureUtilsPromise")??import("../../widgets/Feature/support/featureUtils.js").then((e=>this._featureUtils=e))}get calculatedExpressions(){const e=new r;if(!this.expressionsUsedInTitle.length)return e;if(!this._arcadeTask?.value){for(const t of this.expressionsUsedInTitle??[])e.push({name:t.name,invalid:!0});return e}for(const t of this.expressionsUsedInTitle)try{const s=this._arcadeTask.value.arcade.parseScript(t.expression,["$layer","$map","$datastore"]);if(s.isAsync){e.push({name:t.name,invalid:!0});break}e.push({name:t.name,syntax:s,invalid:!1,func:this._arcadeTask.value.arcade.compileScript(s,{vars:{$feature:"any"}})})}catch{e.push({name:t.name,invalid:!0});break}return e}get expressionsUsedInTitle(){let e=this.effectivePopupTemplate?.title??"";return"string"!=typeof e?[]:(e=e.toLowerCase(),this.effectivePopupTemplate?.expressionInfos?.filter((t=>e.includes(`{expression/${t.name.toLowerCase()}}`)))??[])}get fieldInfoMap(){return this._featureUtils?this._createFieldInfoMap(this._featureUtils.getAllFieldInfos(this.effectivePopupTemplate)):null}get hasBadExpressions(){return this.calculatedExpressions.some((e=>!0===e.invalid))}get requiredFields(){const e=new Set;if(this._arcadeTask?.value&&!this.hasBadExpressions)for(const s of this.calculatedExpressions?.toArray()??[])try{const t=this._arcadeTask.value.arcade.extractFieldLiterals(s.syntax);for(const s of t){const t=s.split("."),i=this.fieldsIndex.get(t.at(-1)??"");i&&e.add(i.name)}}catch{}const t=this._extractFieldNames(this.workingTitle);for(const s of t){const t=this.fieldsIndex.get(s);t&&e.add(t.name)}return e}get titleFromDisplayField(){let e="";return this.displayField&&(e=this.fieldsIndex.get(this.displayField)?.name??""),e||(e=this.fieldsIndex.get(this.objectIdField)?.name??""),e?`{${e}}`:""}get workingTitle(){const e=this.effectivePopupTemplate?this.effectivePopupTemplate.title:"";return""===e||null==e||this.hasBadExpressions||"string"!=typeof e?this.titleFromDisplayField:e}async getTitle(e,t,s){return(await this.getTitles(e,[t],s)).get(t)??""}async getTitles(e,t,s){const i=new Map,r=s?.timeZone??"system";try{const[{substituteFieldsInLinksAndAttributes:a}]=await Promise.all([this.featureUtilsPromise,this._arcadeTask?.promise]);s?.fetchMissingFields&&(t=await this._checkAndReQueryGraphics(e,t));const{fieldInfoMap:o,workingTitle:n}=this,l=n&&o;t.forEach((t=>{const s=l?a({attributes:t.attributes,expressionAttributes:null,fieldInfoMap:o,globalAttributes:this._createFormattedAttributes(e,t,r).global,layer:e,text:n}):"";i.set(t,s)}))}catch{}return i}async _checkAndReQueryGraphics(e,t){const i=t.map((t=>t.getObjectId()??t.attributes[e.objectIdField])).filter(s);if(i.length!==t.length)return t;if(t.some((e=>!n(e,this.requiredFields)))){const s=e.createQuery();s.where="1=1",s.outFields=[...this.requiredFields],s.objectIds=i;const r=await e.queryFeatures(s);if(r?.features.length===t.length)return r.features}return t}_createFieldInfoMap(e){const t=new Map;if(!e)return t;for(const s of e){if(!s.fieldName)continue;const e=this.fieldsIndex.get(s.fieldName),i=e?.name??s.fieldName;s.fieldName=i,t.set(i.toLowerCase(),s)}return t}_createFormattedAttributes(e,t,s="system"){const i=this.effectivePopupTemplate?.fieldInfos??[],r={};if(!this._featureUtils)return{};if(!this.hasBadExpressions&&this.calculatedExpressions.length>0&&this._arcadeTask?.value){const s=this._arcadeTask.value.Feature.createFromGraphicLikeObject(t.geometry,t.attributes,e,null);for(const e of this.calculatedExpressions)try{r[`expression/${e.name}`]=e.func({vars:{$feature:s}})}catch{}}const a={...t.attributes,...r};return{global:this._featureUtils.formatAttributes({fieldInfos:i,attributes:a,graphic:t,timeZone:s,layer:e,fieldInfoMap:this.fieldInfoMap}),content:[]}}_extractFieldNames(e){return l(e).filter((e=>!(0===e.indexOf(p)||0===e.indexOf(d))))}};e([a({readOnly:!0})],u.prototype,"_arcadeTask",null),e([a()],u.prototype,"_featureUtils",void 0),e([a({readOnly:!0})],u.prototype,"featureUtilsPromise",null),e([a({readOnly:!0})],u.prototype,"calculatedExpressions",null),e([a()],u.prototype,"displayField",void 0),e([a()],u.prototype,"effectivePopupTemplate",void 0),e([a()],u.prototype,"expressionsUsedInTitle",null),e([a()],u.prototype,"fieldsIndex",void 0),e([a()],u.prototype,"fieldInfoMap",null),e([a()],u.prototype,"fields",void 0),e([a()],u.prototype,"objectIdField",void 0),e([a()],u.prototype,"requiredFields",null),u=e([o("esri.layers.support.TitleCreator")],u);export{u as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../core/Error.js";import{urlToObject as r,getFilename as a}from"../../core/urlUtils.js";import{parse as t,parseNonStandardSublayerUrl as s}from"./arcgisLayerUrl.js";import{findAssociatedFeatureService as l}from"./associatedFeatureServiceUtils.js";import{getLayerModuleType as o,fetchFeatureService as n}from"./fetchService.js";import{getPreferredUrl as c,sceneServiceLayerTypeToClassName as i}from"./layerUtils.js";import{layerLookupMap as u}from"./lazyLayerLoader.js";import{fetchArcGISServiceJSON as y}from"../../support/requestPresets.js";const f={FeatureLayer:!0,SceneLayer:!0,VideoLayer:!0};async function p(e){const{properties:r,url:a}=e,t={...r,url:a},s=await v(a,r?.customParameters),{Constructor:l,layerId:o,sourceJSON:n,parsedUrl:c,preferredUrl:i,layers:u,tables:y}=s;if(i&&(t.url=i),u.length+y.length===0)return null!=o&&(t.layerId=o),null!=n&&(t.sourceJSON=n),new l(t);const f=new(0,(await import("../GroupLayer.js")).default)({title:c.title});return await w(f,s,t),f}function m(e,r){return e?e.find((({id:e})=>e===r)):null}function d(e,r,a,t,s){const l={...s,layerId:r};return null!=e&&(l.url=e),null!=a&&(l.sourceJSON=a),"sublayerTitleMode"in t.prototype&&(l.sublayerTitleMode="service-name"),new t(l)}async function w(e,r,a){const t=r.sublayerConstructorProvider;for(const{id:s,serverUrl:l}of r.layers){const o=m(r.sublayerInfos,s),n=d(l,s,o,(o&&t?.(o))??r.Constructor,a);e.add(n)}if(r.tables.length){const t=await L("FeatureLayer");r.tables.forEach((({id:s,serverUrl:l})=>{const o=d(l,s,m(r.tableInfos,s),t,a);e.tables.add(o)}))}}async function v(r,a){let s=t(r);if(null==s&&(s=await S(r,a)),null==s)throw new e("arcgis-layers:url-mismatch","The url '${url}' is not a valid arcgis resource",{url:r});const{serverType:l,sublayer:n}=s;let u;const p={FeatureServer:"FeatureLayer",KnowledgeGraphServer:"KnowledgeGraphLayer",StreamServer:"StreamLayer",VectorTileServer:"VectorTileLayer",VideoServer:"VideoLayer"},m="FeatureServer"===l,d="SceneServer"===l,w={parsedUrl:s,Constructor:null,layerId:m||d?n??void 0:void 0,layers:[],tables:[]};switch(l){case"MapServer":if(null!=n){const{type:t}=await y(r,{customParameters:a});switch(u="FeatureLayer",t){case"Catalog Layer":u="CatalogLayer";break;case"Catalog Dynamic Group Layer":throw new e("arcgis-layers:unsupported",`fromUrl() not supported for "${t}" layers`)}}else{u=await g(r,a)?"TileLayer":"MapImageLayer"}break;case"ImageServer":{const e=await y(r,{customParameters:a}),{tileInfo:t,cacheType:s}=e;u=t?"LERC"!==t?.format?.toUpperCase()||s&&"elevation"!==s.toLowerCase()?"ImageryTileLayer":"ElevationLayer":"ImageryLayer";break}case"SceneServer":{const e=await y(s.url.path,{customParameters:a});if(u="SceneLayer",e){const r=e?.layers;if("Voxel"===e?.layerType)u="VoxelLayer";else if(r?.length){const e=r[0]?.layerType;null!=e&&null!=i[e]&&(u=i[e])}}break}case"3DTilesServer":throw new e("arcgis-layers:unsupported","fromUrl() not supported for 3DTiles layers");case"FeatureServer":if(u="FeatureLayer",null!=n){const e=await y(r,{customParameters:a});w.sourceJSON=e,w.preferredUrl=c(r,e),u=o(e.type)}break;default:u=p[l]}if(f[u]&&null==n){const e=await h(r,l,a);m&&(w.preferredUrl=e.preferredUrl,w.sublayerInfos=e.layerInfos,w.tableInfos=e.tableInfos);if(1!==e.layers.length+e.tables.length)w.layers=e.layers,w.tables=e.tables,m&&e.layerInfos?.length&&(w.sublayerConstructorProvider=await P(e.layerInfos));else if(m||d){const r=e.layerInfos?.[0]??e.tableInfos?.[0];if(w.layerId=e.layers[0]?.id??e.tables[0]?.id,w.sourceJSON=r,m){const e=r?.type;u=o(e)}}}return w.Constructor=await L(u),w}async function S(e,t){const l=await y(e,{customParameters:t});let o=null,n=null;const c=l.type;if("Feature Layer"===c||"Table"===c?(o="FeatureServer",n=l.id??null):"indexedVector"===c?o="VectorTileServer":l.hasOwnProperty("mapName")?o="MapServer":l.hasOwnProperty("bandCount")&&l.hasOwnProperty("pixelSizeX")?o="ImageServer":l.hasOwnProperty("maxRecordCount")&&l.hasOwnProperty("allowGeometryUpdates")?o="FeatureServer":l.hasOwnProperty("streamUrls")?o="StreamServer":b(l)?(o="SceneServer",n=l.id):l.hasOwnProperty("layers")&&b(l.layers?.[0])&&(o="SceneServer"),!o)return null;const i=null!=n?s(e):null;return{title:null!=i&&l.name||a(e),serverType:o,sublayer:n,url:{path:null!=i?i.serviceUrl:r(e).path}}}function b(e){return null!=e&&e.hasOwnProperty("store")&&e.hasOwnProperty("id")&&"number"==typeof e.id}async function h(e,r,a){let t,s,l,o=!1;switch(r){case"FeatureServer":{const r=await n(e,{customParameters:a});l=c(e,{preferredHost:r.preferredHost}),o=!!r.layersJSON,t=r.layersJSON||r.serviceJSON;break}case"SceneServer":{const r=await I(e,a);t=r.serviceInfo,s=r.tableServerUrl;break}default:t=await y(e,{customParameters:a})}const i=t?.layers,u=t?.tables;return{preferredUrl:l,layers:i?.map((e=>({id:e.id}))).reverse()||[],tables:u?.map((e=>({serverUrl:s,id:e.id}))).reverse()||[],layerInfos:o?i:[],tableInfos:o?u:[]}}async function I(e,r){const a=await y(e,{customParameters:r}),t=a.layers?.[0];if(!t)return{serviceInfo:a};try{const{serverUrl:t}=await l(e),s=await y(t,{customParameters:r}).catch((()=>null));return s&&(a.tables=s.tables),{serviceInfo:a,tableServerUrl:t}}catch{return{serviceInfo:a}}}async function L(e){return(0,u[e])()}async function g(e,r){return(await y(e,{customParameters:r})).tileInfo}async function P(e){if(!e.length)return;const r=new Set,a=[];for(const{type:l}of e)r.has(l)||(r.add(l),a.push(L(o(l))));const t=await Promise.all(a),s=new Map;return Array.from(r).forEach(((e,r)=>{s.set(e,t[r])})),e=>s.get(e.type)}export{p as fromUrl};
5
+ import e from"../../core/Error.js";import{urlToObject as r,getFilename as a}from"../../core/urlUtils.js";import{parse as t,parseNonStandardSublayerUrl as s}from"./arcgisLayerUrl.js";import{findAssociatedFeatureService as l}from"./associatedFeatureServiceUtils.js";import{getLayerModuleType as o,fetchFeatureService as n}from"./fetchService.js";import{getPreferredUrl as c,sceneServiceLayerTypeToClassName as i}from"./layerUtils.js";import{layerLookupMap as u}from"./lazyLayerLoader.js";import{fetchArcGISServiceJSON as y}from"../../support/requestPresets.js";const f={FeatureLayer:!0,SceneLayer:!0,VideoLayer:!0};async function p(e){const{properties:r,url:a}=e,t={...r,url:a},s=await v(a,r?.customParameters),{Constructor:l,layerId:o,sourceJSON:n,parsedUrl:c,layers:i,tables:u}=s;if(i.length+u.length===0)return null!=o&&(t.layerId=o),null!=n&&(t.sourceJSON=n),new l(t);const y=new(0,(await import("../GroupLayer.js")).default)({title:c.title});return await w(y,s,t),y}function m(e,r){return e?e.find((({id:e})=>e===r)):null}function d(e,r,a,t,s){const l={...s,layerId:r};return null!=e&&(l.url=e),null!=a&&(l.sourceJSON=a),"sublayerTitleMode"in t.prototype&&(l.sublayerTitleMode="service-name"),new t(l)}async function w(e,r,a){const t=r.sublayerConstructorProvider;for(const{id:s,serverUrl:l}of r.layers){const o=m(r.sublayerInfos,s),n=d(l,s,o,(o&&t?.(o))??r.Constructor,a);e.add(n)}if(r.tables.length){const t=await L("FeatureLayer");r.tables.forEach((({id:s,serverUrl:l})=>{const o=d(l,s,m(r.tableInfos,s),t,a);e.tables.add(o)}))}}async function v(r,a){let s=t(r);if(null==s&&(s=await S(r,a)),null==s)throw new e("arcgis-layers:url-mismatch","The url '${url}' is not a valid arcgis resource",{url:r});const{serverType:l,sublayer:n}=s;let u;const p={FeatureServer:"FeatureLayer",KnowledgeGraphServer:"KnowledgeGraphLayer",StreamServer:"StreamLayer",VectorTileServer:"VectorTileLayer",VideoServer:"VideoLayer"},m="FeatureServer"===l,d="SceneServer"===l,w={parsedUrl:s,Constructor:null,layerId:m||d?n??void 0:void 0,layers:[],tables:[]};switch(l){case"MapServer":if(null!=n){const{type:t}=await y(r,{customParameters:a});switch(u="FeatureLayer",t){case"Catalog Layer":u="CatalogLayer";break;case"Catalog Dynamic Group Layer":throw new e("arcgis-layers:unsupported",`fromUrl() not supported for "${t}" layers`)}}else{u=await g(r,a)?"TileLayer":"MapImageLayer"}break;case"ImageServer":{const e=await y(r,{customParameters:a}),{tileInfo:t,cacheType:s}=e;u=t?"LERC"!==t?.format?.toUpperCase()||s&&"elevation"!==s.toLowerCase()?"ImageryTileLayer":"ElevationLayer":"ImageryLayer";break}case"SceneServer":{const e=await y(s.url.path,{customParameters:a});if(u="SceneLayer",e){const r=e?.layers;if("Voxel"===e?.layerType)u="VoxelLayer";else if(r?.length){const e=r[0]?.layerType;null!=e&&null!=i[e]&&(u=i[e])}}break}case"3DTilesServer":throw new e("arcgis-layers:unsupported","fromUrl() not supported for 3DTiles layers");case"FeatureServer":if(u="FeatureLayer",null!=n){const e=await y(r,{customParameters:a});w.sourceJSON=e,w.preferredUrl=c(),u=o(e.type)}break;default:u=p[l]}if(f[u]&&null==n){const e=await h(r,l,a);m&&(w.preferredUrl=e.preferredUrl,w.sublayerInfos=e.layerInfos,w.tableInfos=e.tableInfos);if(1!==e.layers.length+e.tables.length)w.layers=e.layers,w.tables=e.tables,m&&e.layerInfos?.length&&(w.sublayerConstructorProvider=await P(e.layerInfos));else if(m||d){const r=e.layerInfos?.[0]??e.tableInfos?.[0];if(w.layerId=e.layers[0]?.id??e.tables[0]?.id,w.sourceJSON=r,m){const e=r?.type;u=o(e)}}}return w.Constructor=await L(u),w}async function S(e,t){const l=await y(e,{customParameters:t});let o=null,n=null;const c=l.type;if("Feature Layer"===c||"Table"===c?(o="FeatureServer",n=l.id??null):"indexedVector"===c?o="VectorTileServer":l.hasOwnProperty("mapName")?o="MapServer":l.hasOwnProperty("bandCount")&&l.hasOwnProperty("pixelSizeX")?o="ImageServer":l.hasOwnProperty("maxRecordCount")&&l.hasOwnProperty("allowGeometryUpdates")?o="FeatureServer":l.hasOwnProperty("streamUrls")?o="StreamServer":b(l)?(o="SceneServer",n=l.id):l.hasOwnProperty("layers")&&b(l.layers?.[0])&&(o="SceneServer"),!o)return null;const i=null!=n?s(e):null;return{title:null!=i&&l.name||a(e),serverType:o,sublayer:n,url:{path:null!=i?i.serviceUrl:r(e).path}}}function b(e){return null!=e&&e.hasOwnProperty("store")&&e.hasOwnProperty("id")&&"number"==typeof e.id}async function h(e,r,a){let t,s,l,o=!1;switch(r){case"FeatureServer":{const r=await n(e,{customParameters:a});l=c(e,{preferredHost:r.preferredHost}),o=!!r.layersJSON,t=r.layersJSON||r.serviceJSON;break}case"SceneServer":{const r=await I(e,a);t=r.serviceInfo,s=r.tableServerUrl;break}default:t=await y(e,{customParameters:a})}const i=t?.layers,u=t?.tables;return{preferredUrl:l,layers:i?.map((e=>({id:e.id}))).reverse()||[],tables:u?.map((e=>({serverUrl:s,id:e.id}))).reverse()||[],layerInfos:o?i:[],tableInfos:o?u:[]}}async function I(e,r){const a=await y(e,{customParameters:r}),t=a.layers?.[0];if(!t)return{serviceInfo:a};try{const{serverUrl:t}=await l(e),s=await y(t,{customParameters:r}).catch((()=>null));return s&&(a.tables=s.tables),{serviceInfo:a,tableServerUrl:t}}catch{return{serviceInfo:a}}}async function L(e){return(0,u[e])()}async function g(e,r){return(await y(e,{customParameters:r})).tileInfo}async function P(e){if(!e.length)return;const r=new Set,a=[];for(const{type:l}of e)r.has(l)||(r.add(l),a.push(L(o(l))));const t=await Promise.all(a),s=new Map;return Array.from(r).forEach(((e,r)=>{s.set(e,t[r])})),e=>s.get(e.type)}export{p as fromUrl};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{getPreferredHost as e,getPreferredUrl as r}from"./layerUtils.js";import{fetchArcGISServiceJSON as t}from"../../support/requestPresets.js";const a=new Set(["Catalog Layer","Feature Layer","Oriented Imagery Layer"]);async function n(a,n){const{loadContext:s,...o}=n||{},y=s?await s.fetchServiceMetadata(a,o):await t(a,o),i=e(y);u(y),c(y);const l={serviceJSON:y,preferredHost:i};if((y.currentVersion??0)<10.5)return l;const f=`${r(a,y)??a}/layers`,L=s?await s.fetchServiceMetadata(f,o):await t(f,o);return u(L),c(L),l.layersJSON={layers:L.layers,tables:L.tables},l}function s(e){const{type:r}=e;return!!r&&a.has(r)}function o(e){return"Table"===e.type}function c(e){e.layers=e.layers?.filter(s),e.tables=e.tables?.filter(o)}function y(e){e.type||="Feature Layer"}function i(e){e.type||="Table"}function u(e){e.layers?.forEach(y),e.tables?.forEach(i)}function l(e){switch(e){case"Feature Layer":case"Table":return"FeatureLayer";case"Oriented Imagery Layer":return"OrientedImageryLayer";case"Catalog Layer":return"CatalogLayer"}return"FeatureLayer"}export{n as fetchFeatureService,l as getLayerModuleType};
5
+ import{getPreferredHost as e,getPreferredUrl as r}from"./layerUtils.js";import{fetchArcGISServiceJSON as t}from"../../support/requestPresets.js";const a=new Set(["Catalog Layer","Feature Layer","Oriented Imagery Layer"]);async function n(a,n){const{loadContext:s,...o}=n||{},y=s?await s.fetchServiceMetadata(a,o):await t(a,o),i=e();u(y),c(y);const l={serviceJSON:y,preferredHost:i};if((y.currentVersion??0)<10.5)return l;const f=`${r()??a}/layers`,L=s?await s.fetchServiceMetadata(f,o):await t(f,o);return u(L),c(L),l.layersJSON={layers:L.layers,tables:L.tables},l}function s(e){const{type:r}=e;return!!r&&a.has(r)}function o(e){return"Table"===e.type}function c(e){e.layers=e.layers?.filter(s),e.tables=e.tables?.filter(o)}function y(e){e.type||="Feature Layer"}function i(e){e.type||="Table"}function u(e){e.layers?.forEach(y),e.tables?.forEach(i)}function l(e){switch(e){case"Feature Layer":case"Table":return"FeatureLayer";case"Oriented Imagery Layer":return"OrientedImageryLayer";case"Catalog Layer":return"CatalogLayer"}return"FeatureLayer"}export{n as fetchFeatureService,l as getLayerModuleType};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../core/Error.js";import{getDeepValue as n,setDeepValue as i}from"../../core/object.js";import{union as t}from"../../core/SetUtils.js";import{parseWhereClause as r}from"../../core/sql.js";import{DomainValidationError as l,getDomainRange as o}from"./domainUtils.js";import{getFieldNameFromSimpleExpression as s}from"../../support/arcadeExpressionUtils.js";import{isStringOrNull as a,isString as u}from"../../support/guards.js";import{loadArcade as f}from"../../support/loadArcade.js";const c=/^([0-9_])/,d=/[^a-z0-9_\u0080-\uffff]+/gi;function p(e){if(null==e)return null;return e.trim().replaceAll(d,"_").replace(c,"F$1")||null}const m=["field","field2","field3","normalizationField","rotationInfo.field","proportionalSymbolInfo.field","proportionalSymbolInfo.normalizationField","colorInfo.field","colorInfo.normalizationField"],y=["field","normalizationField"];function g(e,n){if(null!=e&&null!=n)for(const i of Array.isArray(e)?e:[e])if(F(m,i,n),"visualVariables"in i&&i.visualVariables)for(const e of i.visualVariables)F(y,e,n)}function F(e,t,r){if(e)for(const l of e){const e=n(l,t),o=e&&"function"!=typeof e&&r.get(e);o&&i(l,o.name,t)}}function I(e,n){if(null!=e&&n?.fields?.length)if("startField"in e){const i=n.get(e.startField),t=n.get(e.endField);e.startField=i?.name??null,e.endField=t?.name??null}else{const i=n.get(e.startTimeField),t=n.get(e.endTimeField);e.startTimeField=i?.name??null,e.endTimeField=t?.name??null}}const b=new Set;function w(e,n){return e&&n?(b.clear(),T(b,e,n),Array.from(b).sort()):[]}function T(e,n,i){if(i)if(n?.fields?.length)if(i.includes("*"))for(const{name:t}of n.fields)e.add(t);else for(const t of i)x(e,n,t);else{if(i.includes("*"))return e.clear(),void e.add("*");for(const n of i)null!=n&&e.add(n)}}function x(e,n,i){if("string"==typeof i)if(n){const t=n.get(i);t&&e.add(t.name)}else e.add(i)}function h(e,n){return null==n||null==e?[]:n.includes("*")?(e.fields??[]).map((e=>e.name)):n}function E(e,n,i=1){if(!n||!e)return[];if(n.includes("*"))return["*"];const t=w(e,n);return t.length/e.fields.length>=i?["*"]:t}async function A(e,n,i){if(!i)return;let t;const r=s(i);if(r)t=[r];else{const{arcadeUtils:e}=await f();t=e.extractFieldNames(i,n?.fields?.map((e=>e.name)))}for(const l of t)x(e,n,l)}async function _(n,i,t){if(t&&"1=1"!==t){const l=await r(t,i);if(!l.isStandardized)throw new e("fieldUtils:collectFilterFields","Where clause is not standardized",{where:t});T(n,i,l.fieldNames)}}function v({displayField:e,fields:n}){return e||(n?.length?N(n,"name-or-title")||N(n,"unique-identifier")||N(n,"type-or-category")||S(n):null)}function S(e){for(const n of e){if(!n?.name)continue;const e=n.name.toLowerCase();if(e.includes("name")||e.includes("title"))return n.name}return null}function N(e,n){for(const i of e)if(i?.valueType&&i.valueType===n)return i.name;return null}async function $(e){if(!e)return[];const n=new Set;return await L(n,e),Array.from(n).sort()}async function L(e,n){if(!n)return;const i=n.elevationInfo?.featureExpressionInfo;return i?i.collectRequiredFields(e,n.fieldsIndex):void 0}function O(e,n,i){i.onStatisticExpression?A(e,n,i.onStatisticExpression.expression):e.add(i.onStatisticField)}async function D(e,n,i){if(!n||!i||!("fields"in i))return;const t=[],r=i.popupTemplate;t.push(V(e,n,r)),i.fields&&t.push(...i.fields.map((async i=>O(e,n.fieldsIndex,i)))),await Promise.all(t)}async function M(e,n){const{fieldsIndex:i,trackInfo:t}=n;if(!n||!t||!i)return;const r=[t.latestObservations.renderer?.collectRequiredFields(e,i),t.previousObservations.renderer?.collectRequiredFields(e,i),t.trackLines.renderer?.collectRequiredFields(e,i)];t.popupTemplate&&r.push(V(e,n,t.popupTemplate));for(const l of[t.latestObservations.labelingInfo,t.previousObservations.labelingInfo,t.trackLines.labelingInfo])if(l)for(const n of l)r.push(Z(e,i,n));await Promise.all(r)}async function V(e,n,i){const t=[];i?.expressionInfos&&t.push(...i.expressionInfos.map((i=>A(e,n.fieldsIndex,i.expression))));const r=i?.content;if(Array.isArray(r))for(const l of r)"expression"===l.type&&l.expressionInfo&&t.push(A(e,n.fieldsIndex,l.expressionInfo.expression));await Promise.all(t)}async function R(e,n,i){n&&(n.timeInfo&&i?.timeExtent&&T(e,n.fieldsIndex,[n.timeInfo.startField,n.timeInfo.endField]),n.floorInfo&&T(e,n.fieldsIndex,[n.floorInfo.floorField]),null!=i?.where&&await _(e,n.fieldsIndex,i.where))}async function j(e,n,i){n&&i&&await Promise.all(i.map((i=>U(e,n,i))))}async function U(e,n,i){n&&i&&(i.valueExpression?await A(e,n.fieldsIndex,i.valueExpression):i.field&&x(e,n.fieldsIndex,i.field))}async function k(e){if(!e)return[];const n="timeInfo"in e&&e.timeInfo;return n?w(e.fieldsIndex,[e.trackIdField,n.startField,n.endField]):[]}function C(e){return e?w(e.fieldsIndex,Y(e)):[]}function G(e){if(!e)return[];const n=e.geometryFieldsInfo;return n?w(e.fieldsIndex,[n.shapeAreaField,n.shapeLengthField]):[]}async function P(e,n,i){if(!n||!i)return;const t=n.fieldsIndex;await Promise.all(i.filters.map((n=>_(e,t,n.where))))}const q=new Set(["oid","global-id","guid"]),X=new Set(["oid","global-id"]),z=[/^fnode_$/i,/^tnode_$/i,/^lpoly_$/i,/^rpoly_$/i,/^poly_$/i,/^shape$/i,/^shape_$/i,/^subclass$/i,/^subclass_$/i,/^rings_ok$/i,/^rings_nok$/i,/perimeter/i,/objectid/i,/_i$/i];function B(e){const n=new Set;J(e).forEach((e=>n.add(e))),G(e).forEach((e=>n.add(e.toLowerCase())));const i=e&&"infoFor3D"in e?e.infoFor3D:void 0;return i&&(Object.values(i.assetMapFieldRoles).forEach((e=>n.add(e.toLowerCase()))),Object.values(i.transformFieldRoles).forEach((e=>n.add(e.toLowerCase())))),Array.from(n)}function Y(e){if(!e)return[];const n="editFieldsInfo"in e&&e.editFieldsInfo;if(!n)return[];const{creationDateField:i,creatorField:t,editDateField:r,editorField:l}=n;return[i,t,r,l].filter(Boolean)}function J(e){return Y(e).map((e=>e.toLowerCase()))}function W(e,n){return e.editable&&!q.has(e.type)&&!J(n).includes(e.name?.toLowerCase()??"")}function H(e,n){const i=e.name?.toLowerCase()??"";return!(null!=n?.objectIdField&&i===n.objectIdField.toLowerCase()||null!=n?.globalIdField&&i===n.globalIdField.toLowerCase()||B(n).includes(i)||X.has(e.type)||z.some((e=>e.test(i))))}async function K(e){if(!e)return[];const n=new Set;return await Q(n,e),Array.from(n).sort()}async function Q(e,n){const{labelingInfo:i,fieldsIndex:t}=n;i?.length&&await Promise.all(i.map((n=>Z(e,t,n))))}async function Z(e,n,i){if(!i)return;const t=i.getLabelExpression(),r=i.where;if("arcade"===t.type)await A(e,n,t.expression);else{const i=t.expression.match(/{[^}]*}/g);i&&i.forEach((i=>{x(e,n,i.slice(1,-1))}))}await _(e,n,r)}function ee(e){const n=e.defaultValue;return void 0!==n&&oe(e,n)?n:e.nullable?null:void 0}function ne(e){const n="string"==typeof e?{type:e}:e;return Fe(n)?255:"esriFieldTypeDate"===n.type||"date"===n.type?8:void 0}function ie(e){return"number"==typeof e&&!isNaN(e)&&isFinite(e)}function te(e){return null===e||ie(e)}function re(e){return null===e||Number.isInteger(e)}function le(){return!0}function oe(e,n){let i;switch(e.type){case"date":case"integer":case"long":case"small-integer":case"big-integer":case"esriFieldTypeDate":case"esriFieldTypeInteger":case"esriFieldTypeLong":case"esriFieldTypeSmallInteger":case"esriFieldTypeBigInteger":i=e.nullable?re:Number.isInteger;break;case"double":case"single":case"esriFieldTypeSingle":case"esriFieldTypeDouble":i=e.nullable?te:ie;break;case"string":case"esriFieldTypeString":i=e.nullable?a:u;break;default:i=le}return 1===arguments.length?i:i(n)}const se=["integer","small-integer","big-integer","long"],ae=["single","double"],ue=[...se,...ae],fe=["esriFieldTypeInteger","esriFieldTypeSmallInteger","esriFieldTypeLong","esriFieldTypeBigInteger"],ce=["esriFieldTypeSingle","esriFieldTypeDouble"],de=new Set([...se,...fe]),pe=new Set([...ae,...ce]),me=t(de,pe);function ye(e){return null!=e&&de.has(e.type)}function ge(e){return null!=e&&me.has(e.type)}function Fe(e){return null!=e&&("string"===e.type||"esriFieldTypeString"===e.type)}function Ie(e){return null!=e&&("date"===e.type||"esriFieldTypeDate"===e.type)}function be(e){return null!=e&&("date-only"===e.type||"esriFieldTypeDateOnly"===e.type)}function we(e){return null!=e&&("timestamp-offset"===e.type||"esriFieldTypeTimestampOffset"===e.type)}function Te(e){return null!=e&&("time-only"===e.type||"esriFieldTypeTimeOnly"===e.type)}function xe(e){return null!=e&&("oid"===e.type||"esriFieldTypeOID"===e.type)}function he(e){return null!=e&&("global-id"===e.type||"esriFieldTypeGlobalID"===e.type)}function Ee(e,n){return null===Se(e,n)}var Ae,_e;function ve(e){return null==e||"number"==typeof e&&isNaN(e)?null:e}function Se(e,n){return null==e||e.nullable&&null===n?null:oe(e,n)?ge(e)&&!Ne(e.type,Number(n))?Ae.OUT_OF_RANGE:null:_e.INVALID_TYPE}function Ne(e,n){const i="string"==typeof e?Le(e):e;if(!i)return!1;const t=i.min,r=i.max;return i.isInteger?Number.isInteger(n)&&n>=t&&n<=r:n>=t&&n<=r}function $e(e,n){const i=o(e,n);return i||(ge(e)?Le(e.type):void 0)}function Le(e){switch(e){case"esriFieldTypeSmallInteger":case"small-integer":return De;case"esriFieldTypeInteger":case"esriFieldTypeLong":case"integer":case"long":return Me;case"esriFieldTypeBigInteger":case"big-integer":return Ve;case"esriFieldTypeSingle":case"single":return Re;case"esriFieldTypeDouble":case"double":return je}}function Oe(e){if(!ie(e))return null;if(Number.isInteger(e)){if(e>=De.min&&e<=De.max)return"esriFieldTypeSmallInteger";if(e>=Me.min&&e<=Me.max)return"esriFieldTypeInteger";if(e>=Ve.min&&e<=Ve.max)return"esriFieldTypeBigInteger"}return e>=Re.min&&e<=Re.max?"esriFieldTypeSingle":"esriFieldTypeDouble"}!function(e){e.OUT_OF_RANGE="numeric-range-validation-error::out-of-range"}(Ae||(Ae={})),function(e){e.INVALID_TYPE="type-validation-error::invalid-type"}(_e||(_e={}));const De={min:-32768,max:32767,isInteger:!0,rawMin:-32768,rawMax:32767},Me={min:-2147483648,max:2147483647,isInteger:!0,rawMin:-2147483648,rawMax:2147483647},Ve={min:-Number.MAX_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,isInteger:!0,rawMin:-Number.MAX_SAFE_INTEGER,rawMax:Number.MAX_SAFE_INTEGER},Re={min:-34e37,max:12e37,isInteger:!1,rawMin:-34e37,rawMax:12e37},je={min:-Number.MAX_VALUE,max:Number.MAX_VALUE,isInteger:!1,rawMin:-Number.MAX_VALUE,rawMax:Number.MAX_VALUE};function Ue(e,n,i){switch(e){case l.INVALID_CODED_VALUE:return`Value ${i} is not in the coded domain - field: ${n.name}, domain: ${JSON.stringify(n.domain)}`;case l.VALUE_OUT_OF_RANGE:return`Value ${i} is out of the range of valid values - field: ${n.name}, domain: ${JSON.stringify(n.domain)}`;case _e.INVALID_TYPE:return`Value ${i} is not a valid value for the field type - field: ${n.name}, type: ${n.type}, nullable: ${n.nullable}`;case Ae.OUT_OF_RANGE:{const{min:e,max:t}=Le(n.type);return`Value ${i} is out of range for the number type - field: ${n.name}, type: ${n.type}, value range is ${e} to ${t}`}}}function ke(e,n){return!Ce(e,n,null)}function Ce(e,n,i){if(!e?.attributes||!n){if(null!=i)for(const e of n??[])i.add(e);return!0}const t=new Set(Object.keys(e.attributes));let r=!1;for(const l of n)if(!t.has(l)){if(r=!0,null==i)break;i.add(l)}return r}async function Ge(e,n){const i=new Set;for(const t of n)await A(i,e.fieldsIndex,t);return Array.from(i).sort()}function Pe(e){return!!e&&["raster.itempixelvalue","raster.servicepixelvalue"].some((n=>e.toLowerCase().startsWith(n)))}async function qe(e,n){const i=new Set;return e?.collectRequiredFields&&await e.collectRequiredFields(i,n),Array.from(i).sort()}function Xe(e){const n=e?.match(/{[^}]+}/g);return n?n.map((e=>e.slice(1,-1).split(":")[0].trim())):[]}export{Ae as NumericRangeValidationError,_e as TypeValidationError,Ve as bigIntegerRange,A as collectArcadeFieldNames,P as collectDisplayFilterFields,L as collectElevationFields,D as collectFeatureReductionFields,x as collectField,T as collectFields,R as collectFilterFields,Q as collectLabelingFields,j as collectOrderByInfos,V as collectPopupTemplateFields,M as collectTrackInfoFields,je as doubleRange,Xe as extractSubstitutionTemplatesFromString,ke as featureHasFields,w as fixFields,g as fixRendererFields,I as fixTimeInfoFields,ce as floatJSONTypes,ae as floatTypes,v as getDisplayFieldName,Y as getEditTrackingFields,$ as getElevationFields,Ge as getExpressionFields,C as getFeatureEditFields,G as getFeatureGeometryFields,ne as getFieldDefaultLength,ee as getFieldDefaultValue,$e as getFieldRange,K as getLabelingFields,B as getLowerCaseDefaultHiddenFields,J as getLowerCaseEditTrackingFields,Oe as getNumericTypeForValue,qe as getRendererFields,k as getTimeFields,fe as integerJSONTypes,Me as integerRange,se as integerTypes,Ie as isDateField,be as isDateOnlyField,W as isFieldEditable,H as isFieldVisibleByDefault,he as isGlobalIDField,ye as isIntegerField,Ne as isNumberInRange,ge as isNumericField,xe as isObjectIDField,Pe as isRasterPixelValueField,Fe as isStringField,Te as isTimeOnlyField,we as isTimestampOffsetField,Ee as isValidFieldValue,oe as isValueMatchingFieldType,p as normalizeFieldName,ue as numericTypes,E as packFields,Ce as populateMissingFields,m as rendererFields,ve as sanitizeNullFieldValue,Re as singleRange,De as smallIntegerRange,h as unpackFieldNames,Se as validateFieldValue,Ue as validationErrorToString,y as visualVariableFields};
5
+ import e from"../../core/Error.js";import{getDeepValue as n,setDeepValue as i}from"../../core/object.js";import{union as t}from"../../core/SetUtils.js";import{parseWhereClause as r}from"../../core/sql.js";import{DomainValidationError as l,getDomainRange as o}from"./domainUtils.js";import{getFieldNameFromSimpleExpression as s}from"../../support/arcadeExpressionUtils.js";import{isStringOrNull as a,isString as u}from"../../support/guards.js";import{loadArcade as f}from"../../support/loadArcade.js";const c=/^([0-9_])/,d=/[^a-z0-9_\u0080-\uffff]+/gi;function p(e){if(null==e)return null;return e.trim().replaceAll(d,"_").replace(c,"F$1")||null}const m=["field","field2","field3","normalizationField","rotationInfo.field","proportionalSymbolInfo.field","proportionalSymbolInfo.normalizationField","colorInfo.field","colorInfo.normalizationField"],y=["field","normalizationField"];function g(e,n){if(null!=e&&null!=n)for(const i of Array.isArray(e)?e:[e])if(F(m,i,n),"visualVariables"in i&&i.visualVariables)for(const e of i.visualVariables)F(y,e,n)}function F(e,t,r){if(e)for(const l of e){const e=n(l,t),o=e&&"function"!=typeof e&&r.get(e);o&&i(l,o.name,t)}}function I(e,n){if(null!=e&&n?.fields?.length)if("startField"in e){const i=n.get(e.startField),t=n.get(e.endField);e.startField=i?.name??null,e.endField=t?.name??null}else{const i=n.get(e.startTimeField),t=n.get(e.endTimeField);e.startTimeField=i?.name??null,e.endTimeField=t?.name??null}}const b=new Set;function w(e,n){return e&&n?(b.clear(),T(b,e,n),Array.from(b).sort()):[]}function T(e,n,i){if(i)if(n?.fields?.length)if(i.includes("*"))for(const{name:t}of n.fields)e.add(t);else for(const t of i)x(e,n,t);else{if(i.includes("*"))return e.clear(),void e.add("*");for(const n of i)null!=n&&e.add(n)}}function x(e,n,i){if("string"==typeof i)if(n){const t=n.get(i);t&&e.add(t.name)}else e.add(i)}function h(e,n){return null==n||null==e?[]:n.includes("*")?(e.fields??[]).map((e=>e.name)):n}function _(e,n,i=1){if(!n||!e)return[];if(n.includes("*"))return["*"];const t=w(e,n);return t.length/e.fields.length>=i?["*"]:t}async function E(e,n,i){if(!i)return;let t;const r=s(i);if(r)t=[r];else{const{arcadeUtils:e}=await f();t=e.extractFieldNames(i,n?.fields?.map((e=>e.name)))}for(const l of t)x(e,n,l)}async function A(n,i,t){if(t&&"1=1"!==t){const l=await r(t,i);if(!l.isStandardized)throw new e("fieldUtils:collectFilterFields","Where clause is not standardized",{where:t});T(n,i,l.fieldNames)}}function v({displayField:e,fields:n}){return e||(n?.length?N(n,"name-or-title")||N(n,"unique-identifier")||N(n,"type-or-category")||S(n):null)}function S(e){for(const n of e){if(!n?.name)continue;const e=n.name.toLowerCase();if(e.includes("name")||e.includes("title"))return n.name}return null}function N(e,n){for(const i of e)if(i?.valueType&&i.valueType===n)return i.name;return null}async function $(e){if(!e)return[];const n=new Set;return await L(n,e),Array.from(n).sort()}async function L(e,n){if(!n)return;const i=n.elevationInfo?.featureExpressionInfo;return i?i.collectRequiredFields(e,n.fieldsIndex):void 0}function O(e,n,i){i.onStatisticExpression?E(e,n,i.onStatisticExpression.expression):e.add(i.onStatisticField)}async function D(e,n,i){if(!n||!i||!("fields"in i))return;const t=[],r=i.popupTemplate;t.push(V(e,n,r)),i.fields&&t.push(...i.fields.map((async i=>O(e,n.fieldsIndex,i)))),await Promise.all(t)}async function M(e,n){const{fieldsIndex:i,trackInfo:t}=n;if(!n||!t||!i)return;const r=[t.latestObservations.renderer?.collectRequiredFields(e,i),t.previousObservations.renderer?.collectRequiredFields(e,i),t.trackLines.renderer?.collectRequiredFields(e,i)];t.popupTemplate&&r.push(V(e,n,t.popupTemplate));for(const l of[t.latestObservations.labelingInfo,t.previousObservations.labelingInfo,t.trackLines.labelingInfo])if(l)for(const n of l)r.push(Z(e,i,n));await Promise.all(r)}async function V(e,n,i){const t=[];i?.expressionInfos&&t.push(...i.expressionInfos.map((i=>E(e,n.fieldsIndex,i.expression))));const r=i?.content;if(Array.isArray(r))for(const l of r)"expression"===l.type&&l.expressionInfo&&t.push(E(e,n.fieldsIndex,l.expressionInfo.expression));await Promise.all(t)}async function R(e,n,i){n&&(n.timeInfo&&i?.timeExtent&&T(e,n.fieldsIndex,[n.timeInfo.startField,n.timeInfo.endField]),n.floorInfo&&T(e,n.fieldsIndex,[n.floorInfo.floorField]),null!=i?.where&&await A(e,n.fieldsIndex,i.where))}async function j(e,n,i){n&&i&&await Promise.all(i.map((i=>U(e,n,i))))}async function U(e,n,i){n&&i&&(i.valueExpression?await E(e,n.fieldsIndex,i.valueExpression):i.field&&x(e,n.fieldsIndex,i.field))}async function k(e){if(!e)return[];const n="timeInfo"in e&&e.timeInfo;return n?w(e.fieldsIndex,[e.trackIdField,n.startField,n.endField]):[]}function C(e){return e?w(e.fieldsIndex,Y(e)):[]}function G(e){if(!e)return[];const n=e.geometryFieldsInfo;return n?w(e.fieldsIndex,[n.shapeAreaField,n.shapeLengthField]):[]}async function P(e,n,i){if(!n||!i)return;const t=n.fieldsIndex;await Promise.all(i.filters.map((n=>A(e,t,n.where))))}const q=new Set(["oid","global-id","guid"]),X=new Set(["oid","global-id"]),z=[/^fnode_$/i,/^tnode_$/i,/^lpoly_$/i,/^rpoly_$/i,/^poly_$/i,/^shape$/i,/^shape_$/i,/^subclass$/i,/^subclass_$/i,/^rings_ok$/i,/^rings_nok$/i,/objectid/i,/^perimeter_/i,/_perimeter$/i,/_i$/i];function B(e){const n=new Set;J(e).forEach((e=>n.add(e))),G(e).forEach((e=>n.add(e.toLowerCase())));const i=e&&"infoFor3D"in e?e.infoFor3D:void 0;return i&&(Object.values(i.assetMapFieldRoles).forEach((e=>n.add(e.toLowerCase()))),Object.values(i.transformFieldRoles).forEach((e=>n.add(e.toLowerCase())))),Array.from(n)}function Y(e){if(!e)return[];const n="editFieldsInfo"in e&&e.editFieldsInfo;if(!n)return[];const{creationDateField:i,creatorField:t,editDateField:r,editorField:l}=n;return[i,t,r,l].filter(Boolean)}function J(e){return Y(e).map((e=>e.toLowerCase()))}function W(e,n){return e.editable&&!q.has(e.type)&&!J(n).includes(e.name?.toLowerCase()??"")}function H(e,n){const i=e.name?.toLowerCase()??"";return!(null!=n?.objectIdField&&i===n.objectIdField.toLowerCase()||null!=n?.globalIdField&&i===n.globalIdField.toLowerCase()||B(n).includes(i)||X.has(e.type)||z.some((e=>e.test(i))))}async function K(e){if(!e)return[];const n=new Set;return await Q(n,e),Array.from(n).sort()}async function Q(e,n){const{labelingInfo:i,fieldsIndex:t}=n;i?.length&&await Promise.all(i.map((n=>Z(e,t,n))))}async function Z(e,n,i){if(!i)return;const t=i.getLabelExpression(),r=i.where;if("arcade"===t.type)await E(e,n,t.expression);else{const i=t.expression.match(/{[^}]*}/g);i&&i.forEach((i=>{x(e,n,i.slice(1,-1))}))}await A(e,n,r)}function ee(e){const n=e.defaultValue;return void 0!==n&&oe(e,n)?n:e.nullable?null:void 0}function ne(e){const n="string"==typeof e?{type:e}:e;return Fe(n)?255:"esriFieldTypeDate"===n.type||"date"===n.type?8:void 0}function ie(e){return"number"==typeof e&&!isNaN(e)&&isFinite(e)}function te(e){return null===e||ie(e)}function re(e){return null===e||Number.isInteger(e)}function le(){return!0}function oe(e,n){let i;switch(e.type){case"date":case"integer":case"long":case"small-integer":case"big-integer":case"esriFieldTypeDate":case"esriFieldTypeInteger":case"esriFieldTypeLong":case"esriFieldTypeSmallInteger":case"esriFieldTypeBigInteger":i=e.nullable?re:Number.isInteger;break;case"double":case"single":case"esriFieldTypeSingle":case"esriFieldTypeDouble":i=e.nullable?te:ie;break;case"string":case"esriFieldTypeString":i=e.nullable?a:u;break;default:i=le}return 1===arguments.length?i:i(n)}const se=["integer","small-integer","big-integer","long"],ae=["single","double"],ue=[...se,...ae],fe=["esriFieldTypeInteger","esriFieldTypeSmallInteger","esriFieldTypeLong","esriFieldTypeBigInteger"],ce=["esriFieldTypeSingle","esriFieldTypeDouble"],de=new Set([...se,...fe]),pe=new Set([...ae,...ce]),me=t(de,pe);function ye(e){return null!=e&&de.has(e.type)}function ge(e){return null!=e&&me.has(e.type)}function Fe(e){return null!=e&&("string"===e.type||"esriFieldTypeString"===e.type)}function Ie(e){return null!=e&&("date"===e.type||"esriFieldTypeDate"===e.type)}function be(e){return null!=e&&("date-only"===e.type||"esriFieldTypeDateOnly"===e.type)}function we(e){return null!=e&&("timestamp-offset"===e.type||"esriFieldTypeTimestampOffset"===e.type)}function Te(e){return null!=e&&("time-only"===e.type||"esriFieldTypeTimeOnly"===e.type)}function xe(e){return null!=e&&("oid"===e.type||"esriFieldTypeOID"===e.type)}function he(e){return null!=e&&("global-id"===e.type||"esriFieldTypeGlobalID"===e.type)}function _e(e,n){return null===Se(e,n)}var Ee,Ae;function ve(e){return null==e||"number"==typeof e&&isNaN(e)?null:e}function Se(e,n){return null==e||e.nullable&&null===n?null:oe(e,n)?ge(e)&&!Ne(e.type,Number(n))?Ee.OUT_OF_RANGE:null:Ae.INVALID_TYPE}function Ne(e,n){const i="string"==typeof e?Le(e):e;if(!i)return!1;const t=i.min,r=i.max;return i.isInteger?Number.isInteger(n)&&n>=t&&n<=r:n>=t&&n<=r}function $e(e,n){const i=o(e,n);return i||(ge(e)?Le(e.type):void 0)}function Le(e){switch(e){case"esriFieldTypeSmallInteger":case"small-integer":return De;case"esriFieldTypeInteger":case"esriFieldTypeLong":case"integer":case"long":return Me;case"esriFieldTypeBigInteger":case"big-integer":return Ve;case"esriFieldTypeSingle":case"single":return Re;case"esriFieldTypeDouble":case"double":return je}}function Oe(e){if(!ie(e))return null;if(Number.isInteger(e)){if(e>=De.min&&e<=De.max)return"esriFieldTypeSmallInteger";if(e>=Me.min&&e<=Me.max)return"esriFieldTypeInteger";if(e>=Ve.min&&e<=Ve.max)return"esriFieldTypeBigInteger"}return e>=Re.min&&e<=Re.max?"esriFieldTypeSingle":"esriFieldTypeDouble"}!function(e){e.OUT_OF_RANGE="numeric-range-validation-error::out-of-range"}(Ee||(Ee={})),function(e){e.INVALID_TYPE="type-validation-error::invalid-type"}(Ae||(Ae={}));const De={min:-32768,max:32767,isInteger:!0,rawMin:-32768,rawMax:32767},Me={min:-2147483648,max:2147483647,isInteger:!0,rawMin:-2147483648,rawMax:2147483647},Ve={min:-Number.MAX_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,isInteger:!0,rawMin:-Number.MAX_SAFE_INTEGER,rawMax:Number.MAX_SAFE_INTEGER},Re={min:-34e37,max:12e37,isInteger:!1,rawMin:-34e37,rawMax:12e37},je={min:-Number.MAX_VALUE,max:Number.MAX_VALUE,isInteger:!1,rawMin:-Number.MAX_VALUE,rawMax:Number.MAX_VALUE};function Ue(e,n,i){switch(e){case l.INVALID_CODED_VALUE:return`Value ${i} is not in the coded domain - field: ${n.name}, domain: ${JSON.stringify(n.domain)}`;case l.VALUE_OUT_OF_RANGE:return`Value ${i} is out of the range of valid values - field: ${n.name}, domain: ${JSON.stringify(n.domain)}`;case Ae.INVALID_TYPE:return`Value ${i} is not a valid value for the field type - field: ${n.name}, type: ${n.type}, nullable: ${n.nullable}`;case Ee.OUT_OF_RANGE:{const{min:e,max:t}=Le(n.type);return`Value ${i} is out of range for the number type - field: ${n.name}, type: ${n.type}, value range is ${e} to ${t}`}}}function ke(e,n){return!Ce(e,n,null)}function Ce(e,n,i){if(!e?.attributes||!n){if(null!=i)for(const e of n??[])i.add(e);return!0}const t=new Set(Object.keys(e.attributes));let r=!1;for(const l of n)if(!t.has(l)){if(r=!0,null==i)break;i.add(l)}return r}async function Ge(e,n){const i=new Set;for(const t of n)await E(i,e.fieldsIndex,t);return Array.from(i).sort()}function Pe(e){return!!e&&["raster.itempixelvalue","raster.servicepixelvalue"].some((n=>e.toLowerCase().startsWith(n)))}async function qe(e,n){const i=new Set;return e?.collectRequiredFields&&await e.collectRequiredFields(i,n),Array.from(i).sort()}function Xe(e){const n=e?.match(/{[^}]+}/g);return n?n.map((e=>e.slice(1,-1).split(":")[0].trim())):[]}export{Ee as NumericRangeValidationError,Ae as TypeValidationError,Ve as bigIntegerRange,E as collectArcadeFieldNames,P as collectDisplayFilterFields,L as collectElevationFields,D as collectFeatureReductionFields,x as collectField,T as collectFields,R as collectFilterFields,Q as collectLabelingFields,j as collectOrderByInfos,V as collectPopupTemplateFields,M as collectTrackInfoFields,je as doubleRange,Xe as extractSubstitutionTemplatesFromString,ke as featureHasFields,w as fixFields,g as fixRendererFields,I as fixTimeInfoFields,ce as floatJSONTypes,ae as floatTypes,v as getDisplayFieldName,Y as getEditTrackingFields,$ as getElevationFields,Ge as getExpressionFields,C as getFeatureEditFields,G as getFeatureGeometryFields,ne as getFieldDefaultLength,ee as getFieldDefaultValue,$e as getFieldRange,K as getLabelingFields,B as getLowerCaseDefaultHiddenFields,J as getLowerCaseEditTrackingFields,Oe as getNumericTypeForValue,qe as getRendererFields,k as getTimeFields,fe as integerJSONTypes,Me as integerRange,se as integerTypes,Ie as isDateField,be as isDateOnlyField,W as isFieldEditable,H as isFieldVisibleByDefault,he as isGlobalIDField,ye as isIntegerField,Ne as isNumberInRange,ge as isNumericField,xe as isObjectIDField,Pe as isRasterPixelValueField,Fe as isStringField,Te as isTimeOnlyField,we as isTimestampOffsetField,_e as isValidFieldValue,oe as isValueMatchingFieldType,p as normalizeFieldName,ue as numericTypes,_ as packFields,Ce as populateMissingFields,m as rendererFields,ve as sanitizeNullFieldValue,Re as singleRange,De as smallIntegerRange,h as unpackFieldNames,Se as validateFieldValue,Ue as validationErrorToString,y as visualVariableFields};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{id as e}from"../../kernel.js";import t from"../../request.js";import n from"../../core/Collection.js";import{hasSameOrigin as r,changeHost as i}from"../../core/urlUtils.js";import{isLayerFromCatalog as u}from"../catalog/catalogUtils.js";function s(e){return d(e)||y(e)}function o(e){return null!=e&&"object"==typeof e&&"type"in e&&"feature"===e.type}function a(e){return null!=e&&"object"==typeof e&&"type"in e&&"graphics"===e.type}function c(e){return null!=e&&"object"==typeof e&&"type"in e&&"map-image"===e.type}function l(e){return null!=e&&"object"==typeof e&&"type"in e&&"map-notes"===e.type&&"sublayers"in e}function f(e){return null!=e&&"object"==typeof e&&"type"in e&&"knowledge-graph"===e.type&&"layers"in e}function p(e){return null!=e&&"object"==typeof e&&"type"in e&&"link-chart"===e.type&&"layers"in e}function y(e){return"scene"===e?.type}function g(e){return null!=e&&"object"==typeof e&&"type"in e&&"subtype-group"===e.type&&"sublayers"in e}function b(e){return"subtype-sublayer"===e?.type}function d(e){const t=e?.type;return"imagery-tile"===t||"tile"===t||"open-street-map"===t||"vector-tile"===t||"web-tile"===t||"wmts"===t}function m(e){const t=e?.type;return"base-tile"===t||"tile"===t||"elevation"===t||"imagery-tile"===t||"base-elevation"===t||"open-street-map"===t||"wcs"===t||"web-tile"===t||"wmts"===t||"vector-tile"===t}function h(e){return null!=e&&"type"in e&&"group"===e.type}const j={Point:"SceneLayer","3DObject":"SceneLayer",IntegratedMesh:"IntegratedMeshLayer",PointCloud:"PointCloudLayer",Building:"BuildingSceneLayer"};function v(e){const t=e?.type;return"building-scene"===t||"integrated-mesh"===t||"point-cloud"===t||"scene"===t}function w(e){return"IntegratedMeshLayer"===e||"IntegratedMesh3DTilesLayer"===e}function L(e){return"integrated-mesh"===e||"integrated-mesh-3dtiles"===e}function S(e){return"voxel"===e?.type}function E(e){return"imagery-tile"===e?.type}function C(e,t){return null!=e?.parent&&"declaredClass"in e.parent&&"esri.Basemap"===e.parent.declaredClass&&e.parent[t].includes(e)}function M(e){return C(e,"baseLayers")}function x(e){return C(e,"referenceLayers")}function I(e){return"feature"===e?.type&&!e.url&&"memory"===e.source?.type}function T(e){const t=e?.type;return("feature"===t||"subtype-group"===t||"oriented-imagery"===t)&&"feature-layer"===e?.source?.type}function U(e){return"feature"===e?.type&&"feature-layer"===e.source?.type}function k(e){const t=/[:;]/,n=[];let r=!1;if(e&&(e.forEach(((e,i)=>{n.push([i,e]),!r&&t.test(e)&&(r=!0)})),n.length>0)){let e;if(r){const t={};n.forEach((e=>{t[e[0]]=e[1]})),e=JSON.stringify(t)}else{const t=[];n.forEach((e=>{t.push(e[0]+":"+e[1])})),e=t.join(";")}return e}return null}function O(e){if(!e)return;const t=[];return e.forEach(((e,n)=>{t.push('"'+n+'":'+JSON.stringify(e))})),t.length?"{"+t.join(",")+"}":void 0}function B(e){if(e.activeLayer){const t=e.activeLayer.tileMatrixSet;if(t)return t;const n=e.activeLayer.tileMatrixSets;if(n)return n}return null}async function P(n,r){const i=e?.findServerInfo(n);if(null!=i?.currentVersion)return i.owningSystemUrl||null;const u=n.toLowerCase().indexOf("/rest/services");if(-1===u)return null;const s=`${n.slice(0,u)}/rest/info`,o=null!=r?r.signal:null,{data:a}=await t(s,{query:{f:"json"},responseType:"json",signal:o});return a?.owningSystemUrl||null}function q(e){if(!("capabilities"in e))return!1;switch(e.type){case"catalog":case"catalog-footprint":case"csv":case"feature":case"geojson":case"imagery":case"knowledge-graph-sublayer":case"ogc-feature":case"oriented-imagery":case"scene":case"sublayer":case"subtype-group":case"subtype-sublayer":case"wfs":return!0;default:return!1}}function D(e){return null!=e&&"object"==typeof e&&"isTable"in e&&!!e.isTable}function H(e){return q(e)?"effectiveCapabilities"in e?e.effectiveCapabilities:e.capabilities:null}function J(e){if(!("editingEnabled"in e))return!1;switch(e.type){case"csv":case"feature":case"geojson":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":return!0;default:return!1}}function N(e){return!!J(e)&&("effectiveEditingEnabled"in e?e.effectiveEditingEnabled:e.editingEnabled)}function $(e){if(!e)return[];return("subtypes"in e?e.subtypes:g(e.parent)?e.parent.subtypes:[])??[]}function F(e){return("imagery"===e.type||"imagery-tile"===e.type)&&"flow"===e.renderer?.type}function V(e){const t=new n;for(const n of e.allLayers.concat(e.allTables))"csv"===n.type||u(n)||("charts"in n&&t.push(n),"subtype-group"===n.type&&t.push(...n.sublayers));return t}function z(e,t){const n=A(t);return!n||r(e,`https://${n}`,!0)?null:i(e,n)}function A(e){return e?.preferredHost}function G(e){return!e||"Feature Service"===e.type&&!e.sourceUrl}function K(e,t){if(!t||!G(e))return;const n=z(e.url,{preferredHost:t});n&&(e.url=n)}export{K as applyPreferredHostToPortalItem,N as getEffectiveEditingEnabled,H as getEffectiveLayerCapabilities,V as getLayersWithChartSupport,P as getOwningPortalUrl,A as getPreferredHost,z as getPreferredUrl,$ as getSubtypesFromLayer,B as getTileMaxtrixSetFromActiveLayer,M as isBaseLayer,s as isBasemap3DSupportedLayer,d as isBasemapSupportedTiledLayer,I as isFeatureCollectionLayer,o as isFeatureLayer,U as isFeatureServiceLayer,a as isGraphicsLayer,h as isGroupLayer,E as isImageryTileLayer,L as isIntegratedMeshLayer,w as isIntegratedMeshOperationalLayer,f as isKnowledgeGraphLayer,q as isLayerWithFeatureCapabilities,T as isLayerWithFeatureLayerSource,F as isLayerWithFlowRenderer,p as isLinkChartLayer,c as isMapImageLayer,l as isMapNotesLayer,G as isPreferredUrlApplicable,x as isReferenceLayer,y as isSceneLayer,v as isSceneServiceLayer,g as isSubtypeGroupLayer,b as isSubtypeSublayer,D as isTable,m as isTiledLayer,S as isVoxelLayer,j as sceneServiceLayerTypeToClassName,k as serializeLayerDefinitions,O as serializeTimeOptions};
5
+ import{id as e}from"../../kernel.js";import t from"../../request.js";import n from"../../core/Collection.js";import"../../core/urlUtils.js";import{isLayerFromCatalog as r}from"../catalog/catalogUtils.js";function i(e){return g(e)||f(e)}function u(e){return null!=e&&"object"==typeof e&&"type"in e&&"feature"===e.type}function s(e){return null!=e&&"object"==typeof e&&"type"in e&&"graphics"===e.type}function o(e){return null!=e&&"object"==typeof e&&"type"in e&&"map-image"===e.type}function a(e){return null!=e&&"object"==typeof e&&"type"in e&&"map-notes"===e.type&&"sublayers"in e}function c(e){return null!=e&&"object"==typeof e&&"type"in e&&"knowledge-graph"===e.type&&"layers"in e}function l(e){return null!=e&&"object"==typeof e&&"type"in e&&"link-chart"===e.type&&"layers"in e}function f(e){return"scene"===e?.type}function y(e){return null!=e&&"object"==typeof e&&"type"in e&&"subtype-group"===e.type&&"sublayers"in e}function p(e){return"subtype-sublayer"===e?.type}function g(e){const t=e?.type;return"imagery-tile"===t||"tile"===t||"open-street-map"===t||"vector-tile"===t||"web-tile"===t||"wmts"===t}function b(e){const t=e?.type;return"base-tile"===t||"tile"===t||"elevation"===t||"imagery-tile"===t||"base-elevation"===t||"open-street-map"===t||"wcs"===t||"web-tile"===t||"wmts"===t||"vector-tile"===t}function d(e){return null!=e&&"type"in e&&"group"===e.type}const m={Point:"SceneLayer","3DObject":"SceneLayer",IntegratedMesh:"IntegratedMeshLayer",PointCloud:"PointCloudLayer",Building:"BuildingSceneLayer"};function h(e){const t=e?.type;return"building-scene"===t||"integrated-mesh"===t||"point-cloud"===t||"scene"===t}function j(e){return"IntegratedMeshLayer"===e||"IntegratedMesh3DTilesLayer"===e}function v(e){return"integrated-mesh"===e||"integrated-mesh-3dtiles"===e}function w(e){return"voxel"===e?.type}function L(e){return"imagery-tile"===e?.type}function S(e,t){return null!=e?.parent&&"declaredClass"in e.parent&&"esri.Basemap"===e.parent.declaredClass&&e.parent[t].includes(e)}function E(e){return S(e,"baseLayers")}function C(e){return S(e,"referenceLayers")}function M(e){return"feature"===e?.type&&!e.url&&"memory"===e.source?.type}function x(e){const t=e?.type;return("feature"===t||"subtype-group"===t||"oriented-imagery"===t)&&"feature-layer"===e?.source?.type}function I(e){return"feature"===e?.type&&"feature-layer"===e.source?.type}function T(e){const t=/[:;]/,n=[];let r=!1;if(e&&(e.forEach(((e,i)=>{n.push([i,e]),!r&&t.test(e)&&(r=!0)})),n.length>0)){let e;if(r){const t={};n.forEach((e=>{t[e[0]]=e[1]})),e=JSON.stringify(t)}else{const t=[];n.forEach((e=>{t.push(e[0]+":"+e[1])})),e=t.join(";")}return e}return null}function U(e){if(!e)return;const t=[];return e.forEach(((e,n)=>{t.push('"'+n+'":'+JSON.stringify(e))})),t.length?"{"+t.join(",")+"}":void 0}function k(e){if(e.activeLayer){const t=e.activeLayer.tileMatrixSet;if(t)return t;const n=e.activeLayer.tileMatrixSets;if(n)return n}return null}async function O(n,r){const i=e?.findServerInfo(n);if(null!=i?.currentVersion)return i.owningSystemUrl||null;const u=n.toLowerCase().indexOf("/rest/services");if(-1===u)return null;const s=`${n.slice(0,u)}/rest/info`,o=null!=r?r.signal:null,{data:a}=await t(s,{query:{f:"json"},responseType:"json",signal:o});return a?.owningSystemUrl||null}function B(e){if(!("capabilities"in e))return!1;switch(e.type){case"catalog":case"catalog-footprint":case"csv":case"feature":case"geojson":case"imagery":case"knowledge-graph-sublayer":case"ogc-feature":case"oriented-imagery":case"scene":case"sublayer":case"subtype-group":case"subtype-sublayer":case"wfs":return!0;default:return!1}}function P(e){return null!=e&&"object"==typeof e&&"isTable"in e&&!!e.isTable}function q(e){return B(e)?"effectiveCapabilities"in e?e.effectiveCapabilities:e.capabilities:null}function D(e){if(!("editingEnabled"in e))return!1;switch(e.type){case"csv":case"feature":case"geojson":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":return!0;default:return!1}}function J(e){return!!D(e)&&("effectiveEditingEnabled"in e?e.effectiveEditingEnabled:e.editingEnabled)}function N(e){if(!e)return[];return("subtypes"in e?e.subtypes:y(e.parent)?e.parent.subtypes:[])??[]}function F(e){return("imagery"===e.type||"imagery-tile"===e.type)&&"flow"===e.renderer?.type}function V(e){const t=new n;for(const n of e.allLayers.concat(e.allTables))"csv"===n.type||r(n)||("charts"in n&&t.push(n),"subtype-group"===n.type&&t.push(...n.sublayers));return t}function $(e,t){return null}function z(e){return null}function A(e){return!e||"Feature Service"===e.type&&!e.sourceUrl}function G(e,t){if(!t||!A(e))return;const n=$(e.url);n&&(e.url=n)}export{G as applyPreferredHostToPortalItem,J as getEffectiveEditingEnabled,q as getEffectiveLayerCapabilities,V as getLayersWithChartSupport,O as getOwningPortalUrl,z as getPreferredHost,$ as getPreferredUrl,N as getSubtypesFromLayer,k as getTileMaxtrixSetFromActiveLayer,E as isBaseLayer,i as isBasemap3DSupportedLayer,g as isBasemapSupportedTiledLayer,M as isFeatureCollectionLayer,u as isFeatureLayer,I as isFeatureServiceLayer,s as isGraphicsLayer,d as isGroupLayer,L as isImageryTileLayer,v as isIntegratedMeshLayer,j as isIntegratedMeshOperationalLayer,c as isKnowledgeGraphLayer,B as isLayerWithFeatureCapabilities,x as isLayerWithFeatureLayerSource,F as isLayerWithFlowRenderer,l as isLinkChartLayer,o as isMapImageLayer,a as isMapNotesLayer,A as isPreferredUrlApplicable,C as isReferenceLayer,f as isSceneLayer,h as isSceneServiceLayer,y as isSubtypeGroupLayer,p as isSubtypeSublayer,P as isTable,b as isTiledLayer,w as isVoxelLayer,m as sceneServiceLayerTypeToClassName,T as serializeLayerDefinitions,U as serializeTimeOptions};