@arcgis/core 4.32.0-next.20250219 → 4.32.0-next.20250221

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 (198) hide show
  1. package/applications/ExperienceBuilder/sketchUtils.d.ts +1 -0
  2. package/applications/ExperienceBuilder/sketchUtils.js +1 -1
  3. package/arcade/featureSetUtils.js +1 -1
  4. package/arcade/functions/featuresetbase.js +1 -1
  5. package/assets/esri/core/workers/RemoteClient.js +1 -1
  6. package/assets/esri/core/workers/chunks/0c3930e40fc9f8a84599.js +2 -0
  7. package/assets/esri/core/workers/chunks/{ccee343fb8c415b59ce3.js.LICENSE.txt → 0c3930e40fc9f8a84599.js.LICENSE.txt} +1 -1
  8. package/assets/esri/core/workers/chunks/37323e58dbec303f5054.js +1 -0
  9. package/assets/esri/core/workers/chunks/486df1e042204b90b0dd.js.LICENSE.txt +1 -1
  10. package/assets/esri/core/workers/chunks/{c2d539359f321bba3432.js → 52c13b3c074c9f6dadde.js} +2 -2
  11. package/assets/esri/core/workers/chunks/{c2d539359f321bba3432.js.LICENSE.txt → 52c13b3c074c9f6dadde.js.LICENSE.txt} +1 -1
  12. package/assets/esri/core/workers/chunks/{f1c9595096c047e93145.js → 5341b86c2fb5347393c5.js} +1 -1
  13. package/assets/esri/core/workers/chunks/5693d9ce4472a4c5959f.js.LICENSE.txt +1 -1
  14. package/assets/esri/core/workers/chunks/5b56b271afb0fadf48b4.js.LICENSE.txt +1 -1
  15. package/assets/esri/core/workers/chunks/60d5cbfa9e1c6b3c98df.js +1 -0
  16. package/assets/esri/core/workers/chunks/{a5acbdb8347a809a26c0.js → 610c3249fe81e370af8c.js} +1 -1
  17. package/assets/esri/core/workers/chunks/6518954889df2e781c47.js.LICENSE.txt +1 -1
  18. package/assets/esri/core/workers/chunks/{d98c78e89d70ad0b8628.js → 6ab476f696290d190c6c.js} +1 -1
  19. package/assets/esri/core/workers/chunks/7292bb19b73f601d891b.js +1 -0
  20. package/assets/esri/core/workers/chunks/78c066e8fe167d4ab817.js +1 -0
  21. package/assets/esri/core/workers/chunks/80744ad7f7656ef918db.js +1 -0
  22. package/assets/esri/core/workers/chunks/8bbe8df40df2b8e54562.js +1 -0
  23. package/assets/esri/core/workers/chunks/b0952b81d5be214262dd.js.LICENSE.txt +1 -1
  24. package/assets/esri/core/workers/chunks/caf410ed75c40b3703eb.js +1 -0
  25. package/assets/esri/core/workers/chunks/df506c4f81affce248c4.js +1 -0
  26. package/assets/esri/core/workers/chunks/{4be39bc2d2edd94bdb75.js → e481e7d508274bc83c70.js} +1 -1
  27. package/assets/esri/core/workers/chunks/eefa1dfeb63ce965bb40.js +1 -0
  28. package/assets/esri/core/workers/chunks/fd8790291348fb7ead55.js +1 -0
  29. package/assets/esri/themes/base/widgets/_Editor.scss +7 -0
  30. package/assets/esri/themes/base/widgets/_ItemList.scss +14 -0
  31. package/assets/esri/themes/base/widgets/_ResponsiveToolbar.scss +9 -3
  32. package/assets/esri/themes/base/widgets/_Sketch.scss +32 -24
  33. package/assets/esri/themes/dark/main.css +1 -1
  34. package/assets/esri/themes/light/main.css +1 -1
  35. package/assets/esri/themes/light/view.css +1 -1
  36. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ar.json +1 -1
  37. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bg.json +1 -1
  38. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bs.json +1 -1
  39. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ca.json +1 -1
  40. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_cs.json +1 -1
  41. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_da.json +1 -1
  42. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_de.json +1 -1
  43. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_el.json +1 -1
  44. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_es.json +1 -1
  45. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_et.json +1 -1
  46. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fi.json +1 -1
  47. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fr.json +1 -1
  48. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_he.json +1 -1
  49. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hr.json +1 -1
  50. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hu.json +1 -1
  51. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_id.json +1 -1
  52. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_it.json +1 -1
  53. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ja.json +1 -1
  54. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ko.json +1 -1
  55. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lt.json +1 -1
  56. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lv.json +1 -1
  57. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_nl.json +1 -1
  58. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_no.json +1 -1
  59. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pl.json +1 -1
  60. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-BR.json +1 -1
  61. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-PT.json +1 -1
  62. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ro.json +1 -1
  63. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ru.json +1 -1
  64. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sk.json +1 -1
  65. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sl.json +1 -1
  66. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sr.json +1 -1
  67. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sv.json +1 -1
  68. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_th.json +1 -1
  69. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_tr.json +1 -1
  70. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_uk.json +1 -1
  71. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_vi.json +1 -1
  72. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-CN.json +1 -1
  73. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-HK.json +1 -1
  74. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-TW.json +1 -1
  75. package/copyright.txt +1 -1
  76. package/core/sql/AggregateFunctions.js +1 -1
  77. package/core/sql/DateOnly.js +1 -1
  78. package/core/sql/SqlInterval.js +1 -1
  79. package/core/sql/SqlTimestampOffset.js +1 -1
  80. package/core/sql/TimeOnly.js +1 -1
  81. package/core/sql/WhereClause.js +1 -1
  82. package/core/sql/WhereGrammar.js +1 -1
  83. package/core/sql/sqlCompareUtils.js +1 -1
  84. package/core/sql/sqlDateParsingUtils.js +1 -1
  85. package/editing/sharedTemplates/SharedTemplate.js +1 -1
  86. package/editing/sharedTemplates/SharedTemplateMetadata.js +1 -1
  87. package/editing/sharedTemplates/SharedTemplateProvider.js +1 -1
  88. package/editing/sharedTemplates/executor/support/createServiceEdit.js +1 -1
  89. package/editing/sharedTemplates/support/sharedTemplateErrors.js +1 -1
  90. package/editing/sharedTemplates/templateDefinitions/FeatureTemplateDefinition.js +1 -1
  91. package/editing/sharedTemplates/templateDefinitions/GroupTemplateDefinition.js +1 -1
  92. package/editing/sharedTemplates/templateDefinitions/PresetTemplateDefinition.js +1 -1
  93. package/editing/sharedTemplates/templateDefinitions/TemplateDefinitionBase.js +1 -1
  94. package/editing/sharedTemplates/templateDefinitions/parts/FeatureTemplateRelationshipPart.js +1 -1
  95. package/editing/sharedTemplates/templateDefinitions/parts/GroupTemplatePart.js +1 -1
  96. package/editing/sharedTemplates/templateDefinitions/parts/TemplatePartBase.js +1 -1
  97. package/interfaces.d.ts +480 -65
  98. package/layers/RouteLayer.js +1 -1
  99. package/layers/orientedImagery/core/coverageUtils.js +1 -1
  100. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  101. package/layers/orientedImagery/transformations/rectifyMapPoint.js +1 -1
  102. package/layers/orientedImagery/transformations/utils.js +1 -1
  103. package/layers/orientedImagery/transformations/worldToImage.js +1 -1
  104. package/layers/support/Relationship.js +1 -1
  105. package/networks/RulesTable.js +1 -1
  106. package/networks/UtilityNetwork.js +1 -1
  107. package/package.json +2 -2
  108. package/rest/route.js +1 -1
  109. package/rest/support/PointBarrier.js +1 -1
  110. package/rest/support/RouteParameters.js +1 -1
  111. package/rest/support/RouteSolveResult.js +1 -1
  112. package/support/revision.js +1 -1
  113. package/symbols/cim/fitVectorMarker.js +1 -1
  114. package/undoredo/support/Services.js +1 -1
  115. package/views/2d/AnimationManager.js +1 -1
  116. package/views/2d/engine/webgl/TextureManager.js +1 -1
  117. package/views/2d/engine/webgl/Utils.js +1 -1
  118. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelTechnique.js +1 -1
  119. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  120. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  121. package/views/2d/layers/RouteLayerView2D.js +1 -1
  122. package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
  123. package/views/2d/layers/features/sources/FeatureCache.js +1 -1
  124. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  125. package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
  126. package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
  127. package/views/2d/layers/features/sources/strategies/support/snapshotUtils.js +5 -0
  128. package/views/2d/layers/features/support/whereUtils.js +1 -1
  129. package/views/3d/layers/I3SMeshView3D.js +1 -1
  130. package/views/View.js +1 -1
  131. package/views/animation/easing.js +1 -1
  132. package/webmap/utils.js +1 -1
  133. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  134. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  135. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  136. package/widgets/BatchAttributeForm.js +1 -1
  137. package/widgets/Directions/DirectionsViewModel.js +1 -1
  138. package/widgets/Directions.js +1 -1
  139. package/widgets/Editor/AddAssociationWorkflow.js +1 -1
  140. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  141. package/widgets/Editor/CreateFeaturesWorkflowData.js +1 -1
  142. package/widgets/Editor/Edits.js +1 -1
  143. package/widgets/Editor/UpdateWorkflow.js +1 -1
  144. package/widgets/Editor/components/PendingFeatureList.js +1 -1
  145. package/widgets/Editor/components/Prompt.js +1 -1
  146. package/widgets/Editor/workflowUtils.js +1 -1
  147. package/widgets/Editor.js +1 -1
  148. package/widgets/ElevationProfile/components/LegendItem.js +1 -1
  149. package/widgets/ElevationProfile/components/SettingsButton.js +1 -1
  150. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/AssociationDetails.js +1 -1
  151. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js +1 -1
  152. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  153. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js +1 -1
  154. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/VisibleElements.js +5 -0
  155. package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +1 -1
  156. package/widgets/FeatureForm/UtilityNetworkAssociationInput.js +1 -1
  157. package/widgets/FeatureForm/VisibleElements.js +5 -0
  158. package/widgets/FeatureForm/featureFormUtils.js +1 -1
  159. package/widgets/FeatureForm.js +1 -1
  160. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  161. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  162. package/widgets/Legend/styles/support/utils.js +1 -1
  163. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  164. package/widgets/OrientedImageryViewer/adapters/sketch/DataCaptureAdapter.js +5 -0
  165. package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
  166. package/widgets/OrientedImageryViewer/components/ImageOverlays.js +1 -1
  167. package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
  168. package/widgets/OrientedImageryViewer/components/OverlayLayersListViewModel.js +1 -1
  169. package/widgets/OrientedImageryViewer/constants.js +1 -1
  170. package/widgets/OrientedImageryViewer/dataCaptureUtils.js +5 -0
  171. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  172. package/widgets/OrientedImageryViewer/symbols.js +1 -1
  173. package/widgets/OrientedImageryViewer.js +1 -1
  174. package/widgets/Sketch/SketchViewModel.js +1 -1
  175. package/widgets/Sketch/support/ResponsiveToolbar/OverflowGroup.js +1 -1
  176. package/widgets/Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js +1 -1
  177. package/widgets/Sketch/support/ResponsiveToolbar/SplitButton.js +1 -1
  178. package/widgets/Sketch/support/sketchUtils.js +1 -1
  179. package/widgets/Sketch.js +1 -1
  180. package/widgets/support/FilterCondition.js +1 -1
  181. package/widgets/support/GoTo.js +1 -1
  182. package/widgets/support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js +1 -1
  183. package/widgets/support/UtilityNetworkAssociations/utilityNetworkUtils.js +1 -1
  184. package/widgets/support/goToUtils.js +1 -1
  185. package/widgets/support/symbolPreviewUtils.js +1 -1
  186. package/assets/esri/core/workers/chunks/10ca2107c99fab6bcc3b.js +0 -1
  187. package/assets/esri/core/workers/chunks/122ed10cac9f192e1eec.js +0 -1
  188. package/assets/esri/core/workers/chunks/1b3a52ce3e8e5be4d196.js +0 -1
  189. package/assets/esri/core/workers/chunks/1bf646c9fc352f98d1ca.js +0 -1
  190. package/assets/esri/core/workers/chunks/35e4af82a08b4eadbfab.js +0 -1
  191. package/assets/esri/core/workers/chunks/6f007703662e714b2f0a.js +0 -1
  192. package/assets/esri/core/workers/chunks/8232a2c4bdc3011bb9e3.js +0 -1
  193. package/assets/esri/core/workers/chunks/8b8579d81728cb35bb29.js +0 -1
  194. package/assets/esri/core/workers/chunks/934857de20f6f5c15188.js +0 -1
  195. package/assets/esri/core/workers/chunks/b8fae500c69ca2cff62a.js +0 -1
  196. package/assets/esri/core/workers/chunks/ccee343fb8c415b59ce3.js +0 -2
  197. package/widgets/OrientedImageryViewer/adapters/sketch/DigitizationAdapter.js +0 -5
  198. package/widgets/OrientedImageryViewer/digitizationUtils.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../config.js";import r from"../Graphic.js";import o from"../PopupTemplate.js";import i from"../core/Collection.js";import s from"../core/Error.js";import n from"../core/Logger.js";import{MultiOriginJSONMixin as l}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as a}from"../core/object.js";import{isAbortError as u}from"../core/promiseUtils.js";import{on as p}from"../core/reactiveUtils.js";import{convertUnit as c}from"../core/unitUtils.js";import{urlToObject as m}from"../core/urlUtils.js";import{property as y}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{reader as f}from"../core/accessorSupport/decorators/reader.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import{writer as h}from"../core/accessorSupport/decorators/writer.js";import{updateOrigins as w}from"../core/accessorSupport/originUtils.js";import S from"../geometry/Extent.js";import g from"../geometry/Multipoint.js";import{initializeProjection as b,project as v}from"../geometry/projection.js";import B from"../geometry/SpatialReference.js";import{wgs84 as P}from"../geometry/support/spatialReferenceUtils.js";import N from"./Layer.js";import{BlendLayer as _}from"./mixins/BlendLayer.js";import{OperationalLayer as j}from"./mixins/OperationalLayer.js";import{PortalLayer as L}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as I}from"./mixins/ScaleRangeLayer.js";import{sanitizeUrl as C}from"./support/arcgisLayerUrl.js";import R from"./support/RouteSymbols.js";import D from"../portal/Portal.js";import O from"../portal/PortalItem.js";import{typeKeyword as F}from"../portal/support/portalItemUtils.js";import{read as x}from"../renderers/support/jsonUtils.js";import{fetchServiceDescription as T}from"../rest/networkService.js";import{solve as k}from"../rest/route.js";import A from"../rest/support/DirectionLine.js";import G from"../rest/support/DirectionPoint.js";import J from"../rest/support/PointBarrier.js";import M from"../rest/support/PolygonBarrier.js";import U from"../rest/support/PolylineBarrier.js";import q from"../rest/support/RouteInfo.js";import E from"../rest/support/RouteParameters.js";import W from"../rest/support/RouteSettings.js";import V from"../rest/support/Stop.js";function z(e){return e.length?e:null}function K(e){switch(e){case"esriGeometryPoint":return{type:"esriSMS",style:"esriSMSCircle",size:12,color:[0,0,0,0],outline:K("esriGeometryPolyline")};case"esriGeometryPolyline":return{type:"esriSLS",style:"esriSLSSolid",width:1,color:[0,0,0,0]};case"esriGeometryPolygon":return{type:"esriSFS",style:"esriSFSNull",outline:K("esriGeometryPolyline")}}}function H(e){return"layers"in e}function Q(e){return"esri.rest.support.FeatureSet"===e.declaredClass}function Y(e){return"esri.rest.support.NetworkFeatureSet"===e.declaredClass}function Z(e,t,r){const o=t.networkDataset?.networkAttributes,i=o?.filter((({usageType:e})=>"cost"===e))??[],n=r.travelMode??t.defaultTravelMode;if(null==n)return void ue().warn("route-layer:missing-travel-mode","The routing service must have a default travel mode or one must be specified in the route parameter.");const{timeAttributeName:l,distanceAttributeName:a}=n,u=i.find((({name:e})=>e===l)),p=i.find((({name:e})=>e===a)),c=r.travelMode?.impedanceAttributeName??r.impedanceAttribute??t.impedance,m=u?.units,y=p?.units;if(!m||!y)throw new s("routelayer:unknown-impedance-units","the units of either the distance or time impedance are unknown");const f=r.directionsLanguage??t.directionsLanguage,d=r.accumulateAttributes??t.accumulateAttributeNames??[],h=new Set(i.filter((({name:e})=>e===l||e===a||e===c||null!=e&&d.includes(e))).map((({name:e})=>e))),w=e=>{for(const t in e)h.has(t)||delete e[t]};for(const s of e.pointBarriers)null!=s.costs&&(s.addedCost=s.costs[c]??0,w(s.costs));for(const s of e.polygonBarriers)null!=s.costs&&(s.scaleFactor=s.costs[c]??1,w(s.costs));for(const s of e.polylineBarriers)null!=s.costs&&(s.scaleFactor=s.costs[c]??1,w(s.costs));const{routeInfo:S}=e,{findBestSequence:g,preserveFirstStop:b,preserveLastStop:v,startTimeIsUTC:B,timeWindowsAreUTC:P}=r;S.analysisSettings=new W({accumulateAttributes:d,directionsLanguage:f,findBestSequence:g,preserveFirstStop:b,preserveLastStop:v,startTimeIsUTC:B,timeWindowsAreUTC:P,travelMode:n}),S.totalDuration=X(S.totalCosts?.[l]??0,m),S.totalDistance=ee(S.totalCosts?.[a]??0,y),S.totalLateDuration=X(S.totalViolations?.[l]??0,m),S.totalWaitDuration=X(S.totalWait?.[l]??0,m),null!=S.totalCosts&&w(S.totalCosts),null!=S.totalViolations&&w(S.totalViolations),null!=S.totalWait&&w(S.totalWait);for(const s of e.stops)null!=s.serviceCosts&&(s.serviceDuration=X(s.serviceCosts[l]??0,m),s.serviceDistance=ee(s.serviceCosts[a]??0,y),w(s.serviceCosts)),null!=s.cumulativeCosts&&(s.cumulativeDuration=X(s.cumulativeCosts[l]??0,m),s.cumulativeDistance=ee(s.cumulativeCosts[a]??0,y),w(s.cumulativeCosts)),null!=s.violations&&(s.lateDuration=X(s.violations[l]??0,m),w(s.violations)),null!=s.wait&&(s.waitDuration=X(s.wait[l]??0,m),w(s.wait))}async function $(e){const t=B.WGS84;return await b(e.spatialReference,t),v(e,t)}function X(e,t){switch(t){case"seconds":return e/60;case"hours":return 60*e;case"days":return 60*e*24;default:return e}}function ee(e,t){return"decimal-degrees"===t||"points"===t||"unknown"===t?e:c(e,t,"meters")}function te(e){const{attributes:t,geometry:r,popupTemplate:o,symbol:i}=e.toGraphic().toJSON();return{attributes:t,geometry:r,popupInfo:o,symbol:i}}const re=i.ofType(A),oe=i.ofType(G),ie=i.ofType(J),se=i.ofType(M),ne=i.ofType(U),le=i.ofType(V),ae="esri.layers.RouteLayer",ue=()=>n.getLogger(ae);let pe=class extends(_(I(j(L(l(N)))))){constructor(e){super(e),this._cachedServiceDescription=null,this._featureCollection=null,this._type="Feature Collection",this.defaultSymbols=new R,this.directionLines=null,this.directionPoints=null,this.featureCollectionType="route",this.legendEnabled=!1,this.maxScale=0,this.minScale=0,this.pointBarriers=new ie,this.polygonBarriers=new se,this.polylineBarriers=new ne,this.routeInfo=null,this.spatialReference=B.WGS84,this.stops=new le,this.type="route";const t=()=>{this._setStopSymbol(this.stops)};this.addHandles(p((()=>this.stops),"change",t,{sync:!0,onListenerAdd:t}))}writeFeatureCollectionWebmap(e,t,r,o){const i=[this._writePolygonBarriers(),this._writePolylineBarriers(),this._writePointBarriers(),this._writeRouteInfo(),this._writeDirectionLines(),this._writeDirectionPoints(),this._writeStops()].filter((e=>!!e)),s=i.map(((e,t)=>t)),n="web-map"===o.origin?"featureCollection.layers":"layers";a(n,i,t),t.opacity=this.opacity,t.visibility=this.visible,t.visibleLayers=s}readDirectionLines(e,t){return this._getNetworkFeatures(t,"DirectionLines",(e=>A.fromGraphic(e)))}readDirectionPoints(e,t){return this._getNetworkFeatures(t,"DirectionPoints",(e=>G.fromGraphic(e)))}get fullExtent(){const e=new S({xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:B.WGS84});if(null!=this.routeInfo?.geometry)return this.routeInfo.geometry.extent??e;if(null==this.stops)return e;const t=this.stops.filter((e=>null!=e.geometry));if(t.length<2)return e;const{spatialReference:r}=t.at(0).geometry;if(null==r)return e;const o=t.toArray().map((e=>{const t=e.geometry;return[t.x,t.y]}));return new g({points:o,spatialReference:r}).extent}readMaxScale(e,t){const r=H(t)?t.layers:t.featureCollection?.layers,o=r?.find((e=>null!=e.layerDefinition.maxScale));return o?.layerDefinition.maxScale??0}readMinScale(e,t){const r=H(t)?t.layers:t.featureCollection?.layers,o=r?.find((e=>null!=e.layerDefinition.minScale));return o?.layerDefinition.minScale??0}readPointBarriers(e,t){return this._getNetworkFeatures(t,"Barriers",(e=>J.fromGraphic(e)))}readPolygonBarriers(e,t){return this._getNetworkFeatures(t,"PolygonBarriers",(e=>M.fromGraphic(e)))}readPolylineBarriers(e,t){return this._getNetworkFeatures(t,"PolylineBarriers",(e=>U.fromGraphic(e)))}readRouteInfo(e,t){return this._getNetworkFeatures(t,"RouteInfo",(e=>q.fromGraphic(e))).at(0)??null}readSpatialReference(e,t){const r=H(t)?t.layers:t.featureCollection?.layers;if(!r?.length)return B.WGS84;const{layerDefinition:o,featureSet:i}=r[0],s=i.features[0],n=s?.geometry?.spatialReference??i.spatialReference??o.spatialReference??o.extent.spatialReference??P;return B.fromJSON(n)}readStops(e,t){return this._getNetworkFeatures(t,"Stops",(e=>V.fromGraphic(e)),(e=>this._setStopSymbol(e)))}get title(){return this.routeInfo?.name??"Route"}set title(e){this._overrideIfSome("title",e)}get url(){return t.routeServiceUrl}set url(e){null!=e?this._set("url",C(e,ue())):this._set("url",t.routeServiceUrl)}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Feature Collection"]},e)),Promise.resolve(this)}removeAll(){this.removeResult(),this.pointBarriers.removeAll(),this.polygonBarriers.removeAll(),this.polylineBarriers.removeAll(),this.stops.removeAll()}removeResult(){null!=this.directionLines&&(this.directionLines.removeAll(),this._set("directionLines",null)),null!=this.directionPoints&&(this.directionPoints.removeAll(),this._set("directionPoints",null)),null!=this.routeInfo&&this._set("routeInfo",null)}async save(){await this.load();const{fullExtent:e,portalItem:t}=this;if(!t)throw new s("routelayer:portal-item-not-set","save() requires to the layer to have a portal item");if(!t.id)throw new s("routelayer:portal-item-not-saved","Please use saveAs() first to save the routelayer");if("Feature Collection"!==t.type)throw new s("routelayer:portal-item-wrong-type",'Portal item needs to have type "Feature Collection"');if(null==this.routeInfo)throw new s("routelayer:route-unsolved","save() requires a solved route");const{portal:r}=t;await r.signIn(),r.user||await t.reload();const{itemUrl:o,itemControl:i}=t;if("admin"!==i&&"update"!==i)throw new s("routelayer:insufficient-permissions","To save this layer, you need to be the owner or an administrator of your organization");const n={messages:[],origin:"portal-item",portal:r,url:o?m(o):void 0,writtenProperties:[]},l=this.write(void 0,n);return t.extent=await $(e),t.title=this.title,await t.update({data:l}),t}async saveAs(e,t={}){if(await this.load(),null==this.routeInfo)throw new s("routelayer:route-unsolved","saveAs() requires a solved route");const r=O.from(e).clone();r.extent??=await $(this.fullExtent),r.id=null,r.portal??=D.getDefault(),r.title??=this.title,r.type="Feature Collection",r.typeKeywords=["Data","Feature Collection",F.MULTI_LAYER,"Route Layer"];const{portal:o}=r,i={messages:[],origin:"portal-item",portal:o,url:null,writtenProperties:[]};await o.signIn();const n=t?.folder,l=this.write(void 0,i);return await o.user.addItem({item:r,folder:n,data:l}),this.portalItem=r,w(i),i.portalItem=r,r}async solve(e,t){const r=e?.stops??this.stops,o=e?.pointBarriers??z(this.pointBarriers),n=e?.polylineBarriers??z(this.polylineBarriers),l=e?.polygonBarriers??z(this.polygonBarriers);if(null==r)throw new s("routelayer:undefined-stops","the route layer must have stops defined in the route parameters.");if((Q(r)||Y(r))&&r.features.length<2||i.isCollection(r)&&r.length<2)throw new s("routelayer:insufficent-stops","the route layer must have two or more stops to solve a route.");if(i.isCollection(r))for(const i of r)i.routeName=null;const a=e?.apiKey,p=this.url,c=await this._getServiceDescription(p,a,t),m=e?.travelMode??c.defaultTravelMode,y=e?.accumulateAttributes??[];null!=m&&(y.push(m.distanceAttributeName),m.timeAttributeName&&y.push(m.timeAttributeName));const f={accumulateAttributes:y,directionsOutputType:"featuresets",ignoreInvalidLocations:!0,pointBarriers:o,polylineBarriers:n,polygonBarriers:l,returnBarriers:!!o,returnDirections:!0,returnPolygonBarriers:!!l,returnPolylineBarriers:!!n,returnRoutes:!0,returnStops:!0,stops:r},d=E.from(e??{});let h;d.set(f);try{h=await k(p,d,t)}catch(S){throw u(S)?S:new s("routelayer:failed-route-request","the routing request failed",{error:S})}const w=this._toRouteLayerSolution(h);return this._isOverridden("title")||(this.title=w.routeInfo.name??"Route"),Z(w,c,d),w}update(e){const{stops:t,directionLines:r,directionPoints:o,pointBarriers:i,polylineBarriers:s,polygonBarriers:n,routeInfo:l}=e;this.set({stops:t,pointBarriers:i,polylineBarriers:s,polygonBarriers:n}),this._set("directionLines",r),this._set("directionPoints",o),this._set("routeInfo",l),null!=l.geometry&&(this.spatialReference=l.geometry.spatialReference)}_getNetworkFeatures(e,t,s,n){const l=H(e)?e.layers:e.featureCollection?.layers,a=l?.find((e=>e.layerDefinition.name===t));if(null==a)return new i;const{layerDefinition:u,popupInfo:p,featureSet:c}=a,m=u.drawingInfo.renderer,{features:y}=c,f=c.spatialReference??u.spatialReference??u.extent.spatialReference??P,d=m&&x(m),h=B.fromJSON(f),w=y.map((e=>{const i=r.fromJSON(e);null!=i.geometry&&null!=e.geometry&&null==e.geometry.spatialReference&&(i.geometry.spatialReference=h);const n=s(i);return n.symbol??=d?.getSymbol(i)??this._getNetworkSymbol(t),n.popupTemplate??=p&&o.fromJSON(p),n}));return n&&w.some((({symbol:e})=>!e))&&n(w),new i(w)}_getNetworkSymbol(e){switch(e){case"Barriers":return this.defaultSymbols.pointBarriers;case"DirectionPoints":return this.defaultSymbols.directionPoints;case"DirectionLines":return this.defaultSymbols.directionLines;case"PolylineBarriers":return this.defaultSymbols.polylineBarriers;case"PolygonBarriers":return this.defaultSymbols.polygonBarriers;case"RouteInfo":return this.defaultSymbols.routeInfo;case"Stops":return null}}async _getServiceDescription(e,t,r){if(null!=this._cachedServiceDescription&&this._cachedServiceDescription.url===e)return this._cachedServiceDescription.serviceDescription;const o=await T(e,t,r);return this._cachedServiceDescription={serviceDescription:o,url:e},o}_setStopSymbol(e){if(!e||0===e.length)return;if(null==this.defaultSymbols.stops)return;if(e.every((({symbol:e})=>null!=e)))return;const{first:t,last:r,middle:o,unlocated:i,waypoint:s,break:n}=this.defaultSymbols.stops;if(null==this.routeInfo||1===e.length)return void e.forEach(((i,s)=>{switch(s){case 0:i.symbol=t;break;case e.length-1:i.symbol=r;break;default:i.symbol=o}}));const l=e.map((({sequence:e})=>e)).filter((e=>null!=e)),a=Math.min(...l),u=Math.max(...l);for(const p of e)p.sequence!==a?p.sequence!==u?"ok"===p.status||"not-located-on-closest"===p.status?"waypoint"!==p.locationType?"break"!==p.locationType?p.symbol=o:p.symbol=n:p.symbol=s:p.symbol=i:p.symbol=r:p.symbol=t}_toRouteLayerSolution(e){const t=e.routeResults[0].stops?.map((e=>V.fromJSON(e.toJSON())));this._setStopSymbol(t);const r=new le(t),o=new se(e.polygonBarriers?.map((e=>{const t=M.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.polygonBarriers,t}))),i=new ne(e.polylineBarriers?.map((e=>{const t=U.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.polylineBarriers,t}))),s=new ie(e.pointBarriers?.map((e=>{const t=J.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.pointBarriers,t}))),n=e.routeResults[0].route?.toJSON(),l=q.fromJSON(n);l.symbol=this.defaultSymbols.routeInfo;const a=new oe(e.routeResults[0].directionPoints?.features.map((e=>{const t=G.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.directionPoints,t})));return{directionLines:new re(e.routeResults[0].directionLines?.features.map((e=>{const t=A.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.directionLines,t}))),directionPoints:a,pointBarriers:s,polygonBarriers:o,polylineBarriers:i,routeInfo:l,stops:r}}_writeDirectionLines(){return this._writeNetworkFeatures(this.directionLines,this.defaultSymbols.directionLines,"esriGeometryPolyline",A.fields,"DirectionLines","Direction Lines")}_writeDirectionPoints(){return this._writeNetworkFeatures(this.directionPoints,this.defaultSymbols.directionPoints,"esriGeometryPoint",G.fields,"DirectionPoints","Direction Points")}_writeNetworkFeatures(e,t,r,o,i,s){if(!e?.length)return null;const n=this.spatialReference.toJSON(),{fullExtent:l,maxScale:a,minScale:u}=this;return{featureSet:{features:e.toArray().map((e=>te(e))),geometryType:r,spatialReference:n},layerDefinition:{capabilities:"Query,Update,Editing",drawingInfo:{renderer:{type:"simple",symbol:null!=t?t.toJSON():K(r)}},extent:l.toJSON(),fields:o,geometryType:r,hasM:!1,hasZ:!1,maxScale:a,minScale:u,name:i,objectIdField:"ObjectID",spatialReference:n,title:s,type:"Feature Layer",typeIdField:""}}}_writePointBarriers(){return this._writeNetworkFeatures(this.pointBarriers,this.defaultSymbols.pointBarriers,"esriGeometryPoint",J.fields,"Barriers","Point Barriers")}_writePolygonBarriers(){return this._writeNetworkFeatures(this.polygonBarriers,this.defaultSymbols.polygonBarriers,"esriGeometryPolygon",M.fields,"PolygonBarriers","Polygon Barriers")}_writePolylineBarriers(){return this._writeNetworkFeatures(this.polylineBarriers,this.defaultSymbols.polylineBarriers,"esriGeometryPolyline",U.fields,"PolylineBarriers","Line Barriers")}_writeRouteInfo(){return this._writeNetworkFeatures(null!=this.routeInfo?new i([this.routeInfo]):null,this.defaultSymbols.routeInfo,"esriGeometryPolyline",q.fields,"RouteInfo","Route Details")}_writeStops(){const e=this._writeNetworkFeatures(this.stops,null,"esriGeometryPoint",V.fields,"Stops","Stops");if(null==e)return null;const{stops:t}=this.defaultSymbols,r=t?.first?.toJSON(),o=t?.middle?.toJSON(),i=t?.last?.toJSON();return e.layerDefinition.drawingInfo.renderer={type:"uniqueValue",field1:"Sequence",defaultSymbol:o,uniqueValueInfos:[{value:"1",symbol:r,label:"First Stop"},{value:`${this.stops.length}`,symbol:i,label:"Last Stop"}]},e}};e([y({readOnly:!0,json:{read:!1,origins:{"portal-item":{write:{allowNull:!0,ignoreOrigin:!0}},"web-map":{write:{overridePolicy(){return{allowNull:!0,ignoreOrigin:null==this.portalItem}}}}}}})],pe.prototype,"_featureCollection",void 0),e([h(["web-map","portal-item"],"_featureCollection")],pe.prototype,"writeFeatureCollectionWebmap",null),e([y({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{target:"type",overridePolicy(){return{ignoreOrigin:null!=this.portalItem}}}}}}})],pe.prototype,"_type",void 0),e([y({nonNullable:!0,type:R})],pe.prototype,"defaultSymbols",void 0),e([y({readOnly:!0})],pe.prototype,"directionLines",void 0),e([f(["web-map","portal-item"],"directionLines",["layers","featureCollection.layers"])],pe.prototype,"readDirectionLines",null),e([y({readOnly:!0})],pe.prototype,"directionPoints",void 0),e([f(["web-map","portal-item"],"directionPoints",["layers","featureCollection.layers"])],pe.prototype,"readDirectionPoints",null),e([y({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{ignoreOrigin:!0}}}}})],pe.prototype,"featureCollectionType",void 0),e([y({readOnly:!0})],pe.prototype,"fullExtent",null),e([y({json:{origins:{"web-map":{name:"featureCollection.showLegend"}},write:!0}})],pe.prototype,"legendEnabled",void 0),e([y({type:["show","hide"]})],pe.prototype,"listMode",void 0),e([y({type:Number,nonNullable:!0,json:{write:!1}})],pe.prototype,"maxScale",void 0),e([f(["web-map","portal-item"],"maxScale",["layers","featureCollection.layers"])],pe.prototype,"readMaxScale",null),e([y({type:Number,nonNullable:!0,json:{write:!1}})],pe.prototype,"minScale",void 0),e([f(["web-map","portal-item"],"minScale",["layers","featureCollection.layers"])],pe.prototype,"readMinScale",null),e([y({type:["ArcGISFeatureLayer"],value:"ArcGISFeatureLayer"})],pe.prototype,"operationalLayerType",void 0),e([y({nonNullable:!0,type:i.ofType(J)})],pe.prototype,"pointBarriers",void 0),e([f(["web-map","portal-item"],"pointBarriers",["layers","featureCollection.layers"])],pe.prototype,"readPointBarriers",null),e([y({nonNullable:!0,type:i.ofType(M)})],pe.prototype,"polygonBarriers",void 0),e([f(["web-map","portal-item"],"polygonBarriers",["layers","featureCollection.layers"])],pe.prototype,"readPolygonBarriers",null),e([y({nonNullable:!0,type:i.ofType(U)})],pe.prototype,"polylineBarriers",void 0),e([f(["web-map","portal-item"],"polylineBarriers",["layers","featureCollection.layers"])],pe.prototype,"readPolylineBarriers",null),e([y({readOnly:!0})],pe.prototype,"routeInfo",void 0),e([f(["web-map","portal-item"],"routeInfo",["layers","featureCollection.layers"])],pe.prototype,"readRouteInfo",null),e([y({type:B})],pe.prototype,"spatialReference",void 0),e([f(["web-map","portal-item"],"spatialReference",["layers","featureCollection.layers"])],pe.prototype,"readSpatialReference",null),e([y({nonNullable:!0,type:i.ofType(V)})],pe.prototype,"stops",void 0),e([f(["web-map","portal-item"],"stops",["layers","featureCollection.layers"])],pe.prototype,"readStops",null),e([y()],pe.prototype,"title",null),e([y({readOnly:!0,json:{read:!1}})],pe.prototype,"type",void 0),e([y()],pe.prototype,"url",null),pe=e([d(ae)],pe);const ce=pe;export{ce as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../config.js";import r from"../Graphic.js";import o from"../PopupTemplate.js";import i from"../core/Collection.js";import s from"../core/Error.js";import n from"../core/Logger.js";import{MultiOriginJSONMixin as a}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as l}from"../core/object.js";import{isAbortError as u}from"../core/promiseUtils.js";import{on as p}from"../core/reactiveUtils.js";import{convertUnit as c}from"../core/unitUtils.js";import{urlToObject as m}from"../core/urlUtils.js";import{property as y}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{reader as f}from"../core/accessorSupport/decorators/reader.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import{writer as h}from"../core/accessorSupport/decorators/writer.js";import{updateOrigins as w}from"../core/accessorSupport/originUtils.js";import g from"../geometry/Extent.js";import S from"../geometry/Multipoint.js";import{initializeProjection as b,project as v}from"../geometry/projection.js";import B from"../geometry/SpatialReference.js";import{wgs84 as I}from"../geometry/support/spatialReferenceUtils.js";import P from"./Layer.js";import{BlendLayer as j}from"./mixins/BlendLayer.js";import{OperationalLayer as N}from"./mixins/OperationalLayer.js";import{PortalLayer as D}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as C}from"./mixins/ScaleRangeLayer.js";import{sanitizeUrl as _}from"./support/arcgisLayerUrl.js";import L from"./support/RouteSymbols.js";import O from"../portal/Portal.js";import R from"../portal/PortalItem.js";import{typeKeyword as T}from"../portal/support/portalItemUtils.js";import{read as F}from"../renderers/support/jsonUtils.js";import{fetchServiceDescription as A}from"../rest/networkService.js";import{solve as k}from"../rest/route.js";import x from"../rest/support/DirectionLine.js";import G from"../rest/support/DirectionPoint.js";import J from"../rest/support/PointBarrier.js";import M from"../rest/support/PolygonBarrier.js";import E from"../rest/support/PolylineBarrier.js";import U from"../rest/support/RouteInfo.js";import W from"../rest/support/RouteParameters.js";import q from"../rest/support/RouteSettings.js";import V from"../rest/support/Stop.js";function Y(e){if(!e.length)return;const t=e.toArray(),r=t.map((({objectId:e})=>e)).filter((e=>null!=e));let o=Math.max(...r,0);for(const i of t)null==i.objectId&&(i.objectId=++o)}function Z(e,t){return!!e.length&&e.length===t.length&&z(e)&&z(t)}function z(e){return e.every((({objectId:e})=>null!=e))}function K(e){return e.length?e:null}function X(e){switch(e){case"esriGeometryPoint":return{type:"esriSMS",style:"esriSMSCircle",size:12,color:[0,0,0,0],outline:X("esriGeometryPolyline")};case"esriGeometryPolyline":return{type:"esriSLS",style:"esriSLSSolid",width:1,color:[0,0,0,0]};case"esriGeometryPolygon":return{type:"esriSFS",style:"esriSFSNull",outline:X("esriGeometryPolyline")}}}function H(e){return"layers"in e}function Q(e){return"esri.rest.support.FeatureSet"===e.declaredClass}function $(e){return"esri.rest.support.NetworkFeatureSet"===e.declaredClass}function ee(e,t,r){const o=t.networkDataset?.networkAttributes,i=o?.filter((({usageType:e})=>"cost"===e))??[],n=r.travelMode??t.defaultTravelMode;if(null==n)return void he().warn("route-layer:missing-travel-mode","The routing service must have a default travel mode or one must be specified in the route parameter.");const{timeAttributeName:a,distanceAttributeName:l}=n,u=i.find((({name:e})=>e===a)),p=i.find((({name:e})=>e===l)),c=r.travelMode?.impedanceAttributeName??r.impedanceAttribute??t.impedance,m=u?.units,y=p?.units;if(!m||!y)throw new s("routelayer:unknown-impedance-units","the units of either the distance or time impedance are unknown");const f=r.directionsLanguage??t.directionsLanguage,d=r.accumulateAttributes??t.accumulateAttributeNames??[],h=new Set(i.filter((({name:e})=>e===a||e===l||e===c||null!=e&&d.includes(e))).map((({name:e})=>e))),w=e=>{for(const t in e)h.has(t)||delete e[t]};for(const s of e.pointBarriers)null!=s.costs&&(s.addedCost=s.costs[c]??0,w(s.costs));for(const s of e.polygonBarriers)null!=s.costs&&(s.scaleFactor=s.costs[c]??1,w(s.costs));for(const s of e.polylineBarriers)null!=s.costs&&(s.scaleFactor=s.costs[c]??1,w(s.costs));const{routeInfo:g}=e,{findBestSequence:S,preserveFirstStop:b,preserveLastStop:v,startTimeIsUTC:B,timeWindowsAreUTC:I}=r;g.analysisSettings=new q({accumulateAttributes:d,directionsLanguage:f,findBestSequence:S,preserveFirstStop:b,preserveLastStop:v,startTimeIsUTC:B,timeWindowsAreUTC:I,travelMode:n}),g.totalDuration=ne(g.totalCosts?.[a]??0,m),g.totalDistance=ae(g.totalCosts?.[l]??0,y),g.totalLateDuration=ne(g.totalViolations?.[a]??0,m),g.totalWaitDuration=ne(g.totalWait?.[a]??0,m),null!=g.totalCosts&&w(g.totalCosts),null!=g.totalViolations&&w(g.totalViolations),null!=g.totalWait&&w(g.totalWait);for(const s of e.stops)null!=s.serviceCosts&&(s.serviceDuration=ne(s.serviceCosts[a]??0,m),s.serviceDistance=ae(s.serviceCosts[l]??0,y),w(s.serviceCosts)),null!=s.cumulativeCosts&&(s.cumulativeDuration=ne(s.cumulativeCosts[a]??0,m),s.cumulativeDistance=ae(s.cumulativeCosts[l]??0,y),w(s.cumulativeCosts)),null!=s.violations&&(s.lateDuration=ne(s.violations[a]??0,m),w(s.violations)),null!=s.wait&&(s.waitDuration=ne(s.wait[a]??0,m),w(s.wait))}function te(e,t){for(const r of e){const e=t.find((e=>e.objectId===r.objectId));e&&(e.addedCost=r.addedCost,e.barrierType=r.barrierType,e.costs=r.costs,e.curbApproach=r.curbApproach,e.fullEdge=r.fullEdge,e.geometry=r.geometry,e.name=r.name,e.sideOfEdge=r.sideOfEdge,e.sourceId=r.sourceId,e.sourceOid=r.sourceOid,e.status=r.status,e.symbol=r.symbol)}}function re(e,t){for(const r of e){const e=t.find((e=>e.objectId===r.objectId));e&&(e.barrierType=r.barrierType,e.costs=r.costs,e.geometry=r.geometry,e.name=r.name,e.scaleFactor=r.scaleFactor,e.symbol=r.symbol)}}function oe(e,t){for(const r of e){const e=t.find((e=>e.objectId===r.objectId));e&&(e.barrierType=r.barrierType,e.costs=r.costs,e.geometry=r.geometry,e.name=r.name,e.scaleFactor=r.scaleFactor,e.symbol=r.symbol)}}function ie(e,t){for(const r of e){const e=t.find((e=>e.objectId===r.objectId));e&&(e.arriveCurbApproach=r.arriveCurbApproach,e.arriveTime=r.arriveTime,e.arriveTimeOffset=r.arriveTimeOffset,e.cumulativeCosts=r.cumulativeCosts,e.cumulativeDistance=r.cumulativeDistance,e.cumulativeDuration=r.cumulativeDuration,e.curbApproach=r.curbApproach,e.departCurbApproach=r.departCurbApproach,e.departTime=r.departTime,e.departTimeOffset=r.departTimeOffset,e.distanceToNetworkInMeters=r.distanceToNetworkInMeters,e.geometry=r.geometry,e.lateDuration=r.lateDuration,e.name=r.name,e.navLatency=r.navLatency,e.posAlong=r.posAlong,e.routeName=r.routeName,e.serviceCosts=r.serviceCosts,e.serviceDistance=r.serviceDistance,e.serviceDuration=r.serviceDuration,e.sequence=r.sequence,e.sideOfEdge=r.sideOfEdge,e.snapX=r.snapX,e.snapY=r.snapY,e.snapZ=r.snapZ,e.sourceId=r.sourceId,e.sourceOid=r.sourceOid,e.status=r.status,e.symbol=r.symbol,e.timeWindowEnd=r.timeWindowEnd,e.timeWindowStart=r.timeWindowStart,e.violations=r.violations,e.waitDuration=r.waitDuration,e.wait=r.wait)}}async function se(e){const t=B.WGS84;return await b(e.spatialReference,t),v(e,t)}function ne(e,t){switch(t){case"seconds":return e/60;case"hours":return 60*e;case"days":return 60*e*24;default:return e}}function ae(e,t){return"decimal-degrees"===t||"points"===t||"unknown"===t?e:c(e,t,"meters")}function le(e){const{attributes:t,geometry:r,popupTemplate:o,symbol:i}=e.toGraphic().toJSON();return{attributes:t,geometry:r,popupInfo:o,symbol:i}}const ue=i.ofType(x),pe=i.ofType(G),ce=i.ofType(J),me=i.ofType(M),ye=i.ofType(E),fe=i.ofType(V),de="esri.layers.RouteLayer",he=()=>n.getLogger(de);let we=class extends(j(C(N(D(a(P)))))){constructor(e){super(e),this._cachedServiceDescription=null,this._featureCollection=null,this._type="Feature Collection",this.checksum=null,this.defaultSymbols=new L,this.directionLines=null,this.directionPoints=null,this.featureCollectionType="route",this.legendEnabled=!1,this.maxScale=0,this.minScale=0,this.pointBarriers=new ce,this.polygonBarriers=new me,this.polylineBarriers=new ye,this.routeInfo=null,this.spatialReference=B.WGS84,this.stops=new fe,this.type="route";const t=()=>{this._setStopSymbol(this.stops)};this.addHandles(p((()=>this.stops),"change",t,{sync:!0,onListenerAdd:t}))}writeFeatureCollectionWebmap(e,t,r,o){const i=[this._writePolygonBarriers(),this._writePolylineBarriers(),this._writePointBarriers(),this._writeRouteInfo(),this._writeDirectionLines(),this._writeDirectionPoints(),this._writeStops()].filter((e=>!!e)),s=i.map(((e,t)=>t)),n="web-map"===o.origin?"featureCollection.layers":"layers";l(n,i,t),t.opacity=this.opacity,t.visibility=this.visible,t.visibleLayers=s}readDirectionLines(e,t){return this._getNetworkFeatures(t,"DirectionLines",(e=>x.fromGraphic(e)))}readDirectionPoints(e,t){return this._getNetworkFeatures(t,"DirectionPoints",(e=>G.fromGraphic(e)))}get fullExtent(){const e=new g({xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:B.WGS84});if(null!=this.routeInfo?.geometry)return this.routeInfo.geometry.extent??e;if(null==this.stops)return e;const t=this.stops.filter((e=>null!=e.geometry));if(t.length<2)return e;const{spatialReference:r}=t.at(0).geometry;if(null==r)return e;const o=t.toArray().map((e=>{const t=e.geometry;return[t.x,t.y]}));return new S({points:o,spatialReference:r}).extent}readMaxScale(e,t){const r=H(t)?t.layers:t.featureCollection?.layers,o=r?.find((e=>null!=e.layerDefinition.maxScale));return o?.layerDefinition.maxScale??0}readMinScale(e,t){const r=H(t)?t.layers:t.featureCollection?.layers,o=r?.find((e=>null!=e.layerDefinition.minScale));return o?.layerDefinition.minScale??0}readPointBarriers(e,t){return this._getNetworkFeatures(t,"Barriers",(e=>J.fromGraphic(e)))}readPolygonBarriers(e,t){return this._getNetworkFeatures(t,"PolygonBarriers",(e=>M.fromGraphic(e)))}readPolylineBarriers(e,t){return this._getNetworkFeatures(t,"PolylineBarriers",(e=>E.fromGraphic(e)))}readRouteInfo(e,t){return this._getNetworkFeatures(t,"RouteInfo",(e=>U.fromGraphic(e))).at(0)??null}readSpatialReference(e,t){const r=H(t)?t.layers:t.featureCollection?.layers;if(!r?.length)return B.WGS84;const{layerDefinition:o,featureSet:i}=r[0],s=i.features[0],n=s?.geometry?.spatialReference??i.spatialReference??o.spatialReference??o.extent.spatialReference??I;return B.fromJSON(n)}readStops(e,t){return this._getNetworkFeatures(t,"Stops",(e=>V.fromGraphic(e)),(e=>this._setStopSymbol(e)))}get title(){return this.routeInfo?.name??"Route"}set title(e){this._overrideIfSome("title",e)}get url(){return t.routeServiceUrl}set url(e){null!=e?this._set("url",_(e,he())):this._set("url",t.routeServiceUrl)}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Feature Collection"]},e)),Promise.resolve(this)}removeAll(){this.removeResult(),this.pointBarriers.removeAll(),this.polygonBarriers.removeAll(),this.polylineBarriers.removeAll(),this.stops.removeAll()}removeResult(){null!=this.directionLines&&(this.directionLines.removeAll(),this._set("directionLines",null)),null!=this.directionPoints&&(this.directionPoints.removeAll(),this._set("directionPoints",null)),null!=this.routeInfo&&this._set("routeInfo",null)}async save(){await this.load();const{fullExtent:e,portalItem:t}=this;if(!t)throw new s("routelayer:portal-item-not-set","save() requires to the layer to have a portal item");if(!t.id)throw new s("routelayer:portal-item-not-saved","Please use saveAs() first to save the routelayer");if("Feature Collection"!==t.type)throw new s("routelayer:portal-item-wrong-type",'Portal item needs to have type "Feature Collection"');if(null==this.routeInfo)throw new s("routelayer:route-unsolved","save() requires a solved route");const{portal:r}=t;await r.signIn(),r.user||await t.reload();const{itemUrl:o,itemControl:i}=t;if("admin"!==i&&"update"!==i)throw new s("routelayer:insufficient-permissions","To save this layer, you need to be the owner or an administrator of your organization");const n={messages:[],origin:"portal-item",portal:r,url:o?m(o):void 0,writtenProperties:[]},a=this.write(void 0,n);return t.extent=await se(e),t.title=this.title,await t.update({data:a}),t}async saveAs(e,t={}){if(await this.load(),null==this.routeInfo)throw new s("routelayer:route-unsolved","saveAs() requires a solved route");const r=R.from(e).clone();r.extent??=await se(this.fullExtent),r.id=null,r.portal??=O.getDefault(),r.title??=this.title,r.type="Feature Collection",r.typeKeywords=["Data","Feature Collection",T.MULTI_LAYER,"Route Layer"];const{portal:o}=r,i={messages:[],origin:"portal-item",portal:o,url:null,writtenProperties:[]};await o.signIn();const n=t?.folder,a=this.write(void 0,i);return await o.user.addItem({item:r,folder:n,data:a}),this.portalItem=r,w(i),i.portalItem=r,r}async solve(e,t){Y(this.stops),Y(this.pointBarriers),Y(this.polylineBarriers),Y(this.polygonBarriers);const r=e?.stops??this.stops,o=e?.pointBarriers??K(this.pointBarriers),n=e?.polylineBarriers??K(this.polylineBarriers),a=e?.polygonBarriers??K(this.polygonBarriers);if(null==r)throw new s("routelayer:undefined-stops","the route layer must have stops defined in the route parameters.");if((Q(r)||$(r))&&r.features.length<2||i.isCollection(r)&&r.length<2)throw new s("routelayer:insufficent-stops","the route layer must have two or more stops to solve a route.");if(i.isCollection(r))for(const i of r)i.routeName=null;const l=e?.apiKey,{checksum:p,url:c}=this,m=await this._getServiceDescription(c,l,t),y=e?.travelMode??m.defaultTravelMode,f=e?.accumulateAttributes??[];y&&(f.push(y.distanceAttributeName),y.timeAttributeName&&f.push(y.timeAttributeName));const d={accumulateAttributes:f,checksum:p,directionsOutputType:"featuresets",ignoreInvalidLocations:!0,pointBarriers:o,polylineBarriers:n,polygonBarriers:a,preserveObjectID:!0,returnBarriers:!!o,returnDirections:!0,returnPolygonBarriers:!!a,returnPolylineBarriers:!!n,returnRoutes:!0,returnStops:!0,stops:r},h=W.from(e??{});let w;h.set(d);try{w=await k(c,h,t)}catch(S){throw u(S)?S:new s("routelayer:failed-route-request","the routing request failed",{error:S})}const g=this._toRouteLayerSolution(w);return this._isOverridden("title")||(this.title=g.routeInfo.name??"Route"),ee(g,m,h),g}update(e){const{checksum:t,directionLines:r,directionPoints:o,pointBarriers:i,polygonBarriers:s,polylineBarriers:n,routeInfo:a,stops:l}=e;Z(l,this.stops)?ie(l,this.stops):this.set({stops:l}),Z(i,this.pointBarriers)?te(i,this.pointBarriers):this.set({pointBarriers:i}),Z(n,this.polylineBarriers)?re(n,this.polylineBarriers):this.set({polylineBarriers:n}),Z(s,this.polygonBarriers)?oe(s,this.polygonBarriers):this.set({polygonBarriers:s}),this.set({checksum:t}),this._set("directionLines",r),this._set("directionPoints",o),this._set("routeInfo",a),null!=a.geometry&&(this.spatialReference=a.geometry.spatialReference)}_getNetworkFeatures(e,t,s,n){const a=H(e)?e.layers:e.featureCollection?.layers,l=a?.find((e=>e.layerDefinition.name===t));if(null==l)return new i;const{layerDefinition:u,popupInfo:p,featureSet:c}=l,m=u.drawingInfo.renderer,{features:y}=c,f=c.spatialReference??u.spatialReference??u.extent.spatialReference??I,d=m&&F(m),h=B.fromJSON(f),w=y.map((e=>{const i=r.fromJSON(e);null!=i.geometry&&null!=e.geometry&&null==e.geometry.spatialReference&&(i.geometry.spatialReference=h);const n=s(i);return n.symbol??=d?.getSymbol(i)??this._getNetworkSymbol(t),n.popupTemplate??=p&&o.fromJSON(p),n}));return n&&w.some((({symbol:e})=>!e))&&n(w),new i(w)}_getNetworkSymbol(e){switch(e){case"Barriers":return this.defaultSymbols.pointBarriers;case"DirectionPoints":return this.defaultSymbols.directionPoints;case"DirectionLines":return this.defaultSymbols.directionLines;case"PolylineBarriers":return this.defaultSymbols.polylineBarriers;case"PolygonBarriers":return this.defaultSymbols.polygonBarriers;case"RouteInfo":return this.defaultSymbols.routeInfo;case"Stops":return null}}async _getServiceDescription(e,t,r){if(null!=this._cachedServiceDescription&&this._cachedServiceDescription.url===e)return this._cachedServiceDescription.serviceDescription;const o=await A(e,t,r);return this._cachedServiceDescription={serviceDescription:o,url:e},o}_setStopSymbol(e){if(!e||!e.length||!this.defaultSymbols.stops||e.every((({symbol:e})=>!!e)))return;const{first:t,last:r,middle:o,unlocated:i,waypoint:s,break:n}=this.defaultSymbols.stops;if(null==this.routeInfo||1===e.length)return void e.forEach(((i,s)=>{switch(s){case 0:i.symbol=t;break;case e.length-1:i.symbol=r;break;default:i.symbol=o}}));const a=e.map((({sequence:e})=>e)).filter((e=>null!=e)),l=Math.min(...a),u=Math.max(...a);for(const p of e)p.sequence!==l?p.sequence!==u?"ok"===p.status||"not-located-on-closest"===p.status?"waypoint"!==p.locationType?"break"!==p.locationType?p.symbol=o:p.symbol=n:p.symbol=s:p.symbol=i:p.symbol=r:p.symbol=t}_toRouteLayerSolution(e){const{checksum:t,routeResults:r}=e,o=r[0].stops?.map((e=>V.fromJSON(e.toJSON())));this._setStopSymbol(o);const i=new fe(o),s=new me(e.polygonBarriers?.map((e=>{const t=M.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.polygonBarriers,t}))),n=new ye(e.polylineBarriers?.map((e=>{const t=E.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.polylineBarriers,t}))),a=new ce(e.pointBarriers?.map((e=>{const t=J.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.pointBarriers,t}))),l=r[0].route?.toJSON(),u=U.fromJSON(l);u.symbol=this.defaultSymbols.routeInfo;const p=new pe(r[0].directionPoints?.features.map((e=>{const t=G.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.directionPoints,t})));return{checksum:t,directionLines:new ue(r[0].directionLines?.features.map((e=>{const t=x.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.directionLines,t}))),directionPoints:p,pointBarriers:a,polygonBarriers:s,polylineBarriers:n,routeInfo:u,stops:i}}_writeDirectionLines(){return this._writeNetworkFeatures(this.directionLines,this.defaultSymbols.directionLines,"esriGeometryPolyline",x.fields,"DirectionLines","Direction Lines")}_writeDirectionPoints(){return this._writeNetworkFeatures(this.directionPoints,this.defaultSymbols.directionPoints,"esriGeometryPoint",G.fields,"DirectionPoints","Direction Points")}_writeNetworkFeatures(e,t,r,o,i,s){if(!e?.length)return null;const n=this.spatialReference.toJSON(),{fullExtent:a,maxScale:l,minScale:u}=this;return{featureSet:{features:e.toArray().map((e=>le(e))),geometryType:r,spatialReference:n},layerDefinition:{capabilities:"Query,Update,Editing",drawingInfo:{renderer:{type:"simple",symbol:null!=t?t.toJSON():X(r)}},extent:a.toJSON(),fields:o,geometryType:r,hasM:!1,hasZ:!1,maxScale:l,minScale:u,name:i,objectIdField:"ObjectID",spatialReference:n,title:s,type:"Feature Layer",typeIdField:""}}}_writePointBarriers(){return this._writeNetworkFeatures(this.pointBarriers,this.defaultSymbols.pointBarriers,"esriGeometryPoint",J.fields,"Barriers","Point Barriers")}_writePolygonBarriers(){return this._writeNetworkFeatures(this.polygonBarriers,this.defaultSymbols.polygonBarriers,"esriGeometryPolygon",M.fields,"PolygonBarriers","Polygon Barriers")}_writePolylineBarriers(){return this._writeNetworkFeatures(this.polylineBarriers,this.defaultSymbols.polylineBarriers,"esriGeometryPolyline",E.fields,"PolylineBarriers","Line Barriers")}_writeRouteInfo(){return this._writeNetworkFeatures(null!=this.routeInfo?new i([this.routeInfo]):null,this.defaultSymbols.routeInfo,"esriGeometryPolyline",U.fields,"RouteInfo","Route Details")}_writeStops(){const e=this._writeNetworkFeatures(this.stops,null,"esriGeometryPoint",V.fields,"Stops","Stops");if(null==e)return null;const{stops:t}=this.defaultSymbols,r=t?.first?.toJSON(),o=t?.middle?.toJSON(),i=t?.last?.toJSON();return e.layerDefinition.drawingInfo.renderer={type:"uniqueValue",field1:"Sequence",defaultSymbol:o,uniqueValueInfos:[{value:"1",symbol:r,label:"First Stop"},{value:`${this.stops.length}`,symbol:i,label:"Last Stop"}]},e}};e([y({readOnly:!0,json:{read:!1,origins:{"portal-item":{write:{allowNull:!0,ignoreOrigin:!0}},"web-map":{write:{overridePolicy(){return{allowNull:!0,ignoreOrigin:null==this.portalItem}}}}}}})],we.prototype,"_featureCollection",void 0),e([h(["web-map","portal-item"],"_featureCollection")],we.prototype,"writeFeatureCollectionWebmap",null),e([y({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{target:"type",overridePolicy(){return{ignoreOrigin:null!=this.portalItem}}}}}}})],we.prototype,"_type",void 0),e([y({type:String})],we.prototype,"checksum",void 0),e([y({nonNullable:!0,type:L})],we.prototype,"defaultSymbols",void 0),e([y({readOnly:!0})],we.prototype,"directionLines",void 0),e([f(["web-map","portal-item"],"directionLines",["layers","featureCollection.layers"])],we.prototype,"readDirectionLines",null),e([y({readOnly:!0})],we.prototype,"directionPoints",void 0),e([f(["web-map","portal-item"],"directionPoints",["layers","featureCollection.layers"])],we.prototype,"readDirectionPoints",null),e([y({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{ignoreOrigin:!0}}}}})],we.prototype,"featureCollectionType",void 0),e([y({readOnly:!0})],we.prototype,"fullExtent",null),e([y({json:{origins:{"web-map":{name:"featureCollection.showLegend"}},write:!0}})],we.prototype,"legendEnabled",void 0),e([y({type:["show","hide"]})],we.prototype,"listMode",void 0),e([y({type:Number,nonNullable:!0,json:{write:!1}})],we.prototype,"maxScale",void 0),e([f(["web-map","portal-item"],"maxScale",["layers","featureCollection.layers"])],we.prototype,"readMaxScale",null),e([y({type:Number,nonNullable:!0,json:{write:!1}})],we.prototype,"minScale",void 0),e([f(["web-map","portal-item"],"minScale",["layers","featureCollection.layers"])],we.prototype,"readMinScale",null),e([y({type:["ArcGISFeatureLayer"],value:"ArcGISFeatureLayer"})],we.prototype,"operationalLayerType",void 0),e([y({nonNullable:!0,type:i.ofType(J)})],we.prototype,"pointBarriers",void 0),e([f(["web-map","portal-item"],"pointBarriers",["layers","featureCollection.layers"])],we.prototype,"readPointBarriers",null),e([y({nonNullable:!0,type:i.ofType(M)})],we.prototype,"polygonBarriers",void 0),e([f(["web-map","portal-item"],"polygonBarriers",["layers","featureCollection.layers"])],we.prototype,"readPolygonBarriers",null),e([y({nonNullable:!0,type:i.ofType(E)})],we.prototype,"polylineBarriers",void 0),e([f(["web-map","portal-item"],"polylineBarriers",["layers","featureCollection.layers"])],we.prototype,"readPolylineBarriers",null),e([y({readOnly:!0})],we.prototype,"routeInfo",void 0),e([f(["web-map","portal-item"],"routeInfo",["layers","featureCollection.layers"])],we.prototype,"readRouteInfo",null),e([y({type:B})],we.prototype,"spatialReference",void 0),e([f(["web-map","portal-item"],"spatialReference",["layers","featureCollection.layers"])],we.prototype,"readSpatialReference",null),e([y({nonNullable:!0,type:i.ofType(V)})],we.prototype,"stops",void 0),e([f(["web-map","portal-item"],"stops",["layers","featureCollection.layers"])],we.prototype,"readStops",null),e([y()],we.prototype,"title",null),e([y({readOnly:!0,json:{read:!1}})],we.prototype,"type",void 0),e([y()],we.prototype,"url",null),we=e([d(de)],we);const ge=we;export{ge 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.32/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,g 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/projection.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{intersectRay as y,create as g,fromArray 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();y(o,{origin:e,direction:t},c)&&i.splice(3*n,3,...c)}function J(e,t,n,a){if(!a)return;const o=r();y(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=g();let n;switch(t){case"far":if(n=Array.from(15===e.length?e.slice(3):e.slice(12)),x(r,n,!0))return{coefficients:r,vertexPositions:n};break;case"near":if(n=Array.from(e.slice(0,12)),15===e.length||!x(r,n,!0))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,g 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/projection.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{intersectRay as y,create as g,fromArray 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();y(o,{origin:e,direction:t},c)&&i.splice(3*n,3,...c)}function J(e,t,n,a){if(!a)return;const o=r();y(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=g();let n;switch(t){case"far":if(n=Array.from(15===e.length?e.slice(3):e.slice(12)),x(r,n,!1))return{coefficients:r,vertexPositions:n};break;case"near":if(n=Array.from(e.slice(0,12)),15===e.length||!x(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};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{isArrayLike as e}from"../../../core/arrayUtils.js";import{clone as r,zeros as a}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as t}from"../../../chunks/vec32.js";import i from"../../../geometry/Point.js";import{fromPoints as o,fromValues as n}from"../../../geometry/support/ray.js";import{l as c,j as s}from"../../../chunks/sphere.js";import{isElevationSource as f}from"../core/ElevationSourceDefinitions.js";import{rectifyMapPoint as m,rectifyMapPointPanoramic as l}from"./rectifyMapPoint.js";import{or as p,isUpdateElevationWithElevationSource as y,isElevationSampler as u,scaleWithFactor as h,scaleAndAddWithFactor as d,computeNewReferenceCoordinates as g,projectiveTransform as w,validatePixelsToTransform as v,validateRotationMatrix as x,getWebMercatorScalingFactor as j,computeFarplaneVertices as A,computeHFOVAndVFOV as P,vecToPoint as R,hasAngles as V,convertPixelToHeadingPitch as F,convertHeadingPitchToSphereVertex as M,reducerFn as T}from"./utils.js";import{worldToImage as b}from"./worldToImage.js";import{defaultImageSphereCenter as L}from"../../../widgets/PanoramicViewer/constants.js";async function O(e,r,a){const{verticalFieldOfView:t,imageBoundaries:i,scalingFactor:o,farPlaneVertices:n,cameraLocation:c,pixelsToTransform:s,vecToPoint:f}=z(e,r),m=new Array;return await E(s,n,i,f,r,m,c,o,t,a),Array.isArray(e)?m:m[0]}async function E(e,r,a,t,i,o,n,c,s,f){for(const l of e){let e=q(r,a,l,t,i);f&&p(u(f.elevationSample),y(f))&&(e=await m(t(e),{x:l[0],y:l[1]},{...i,...f,farPlaneVertices:r.map(t)})),o.push(t(k(e,n,c,i.averageElevation,i.cameraPitch,s)))}}function k(e,i,o,n,c,s){let f=r(e);const m=Math.sqrt((e[2]-i[2])**2+(Math.sqrt((e[0]-i[0])**2+(e[1]-i[1])**2)/o)**2)*o,l=h(t(a(),e,i),1/m,1/o);if(S(e[2],n,c,s)){const e=Math.abs((i[2]-n)/-l[2])*o;f=d(i,l,e,o)}else f[2]=n;return f}function S(e,r,a,t){return e<r||a+t/2<90}function q(e,r,a,t,i){let o=null;const n=9;let c,s=0,f=e,m=r;for(;s<=n;){const e=D(a,m,f,i);if(c=e.error,o=e.transformedPoint,p(c<=1,s===n))break;f=g(f,c,a,r),m=B(f,t,i),s++}return o}function B(e,r,a){return b(e.map(r),a).map((({x:e,y:r})=>[e,r,1]))}function D(e,r,a,t){const{cameraLocation:o}=t,n=w(e,r,a),{x:c,y:s}=b(new i(n,o.spatialReference),t);return{transformedPoint:n,error:H(e,[c,s,1])}}function H(e,r){return Math.abs(e[0]-r[0])+Math.abs(e[1]-r[1])}function z(r,a){const t=e(r)||"items"in r?r:[r],{cameraLocation:o,rotationMatrix:n}=a;if(v(t,o),x(n),9!==n?.length)throw new Error("Rotation matrix is not provided or is not a valid 3x3 matrix");const c=j(o.y,o.spatialReference),s=A({...a,scalingFactor:c}),f=b(s.map((e=>new i(e,o.spatialReference))),a),{vfov:m}=P(a.horizontalFieldOfView,a.verticalFieldOfView,a.cameraRoll);return{cameraLocation:o.toArray(),imageBoundaries:f.map((({x:e,y:r})=>[e,r,1])),verticalFieldOfView:m,farPlaneVertices:s,scalingFactor:c,pixelsToTransform:t.map((e=>[e.x,e.y,1])),vecToPoint:R(o.spatialReference)}}async function I(e,r,t){const{averageElevation:m,cameraHeading:p,cameraLocation:y,farDistance:h,imageHeight:d,imageWidth:g,verticalFieldOfView:w}=r,v=j(y.y,y.spatialReference),x=new Array,[A,P,R]=y.toArray(),b=c([A,P,R??0],h*v),O=L.toArray(),E=Array.isArray(e)?e:[e];for(const c of E){let e,j;if(V(c))e=c.heading,j=c.pitch;else{const r=F({x:c.x,y:c.y},g,d);e=r.heading,j=r.pitch}e=(e+p)%360;const L=o([O[0],O[1],O[2]],M(e,j)),E=n([A,P,R??0],L.direction);let S=a();s(b,E,S),t&&(f(t)||u(t.elevationSample))&&j+w/2<90&&(S=await l(new i(S,y.spatialReference),{heading:e,pitch:j},{...r,...t,farPlaneVertices:T(h,h).map((([e,r])=>new i([y.x+e,y.y+r],y.spatialReference)))})),S=k(S,y.toArray(),v,m,j,w),x.push(new i(S,y.spatialReference))}return Array.isArray(e)?x:x[0]}export{O as imageToWorld,I as imageToWorldPanoramic};
5
+ import{isArrayLike as e}from"../../../core/arrayUtils.js";import{clone as r,zeros as a}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as t}from"../../../chunks/vec32.js";import i from"../../../geometry/Point.js";import{fromPoints as o,fromValues as n}from"../../../geometry/support/ray.js";import{l as c,j as s}from"../../../chunks/sphere.js";import{isElevationSource as f}from"../core/ElevationSourceDefinitions.js";import{rectifyMapPoint as m,rectifyMapPointPanoramic as l}from"./rectifyMapPoint.js";import{or as p,isUpdateElevationWithElevationSource as y,isElevationSampler as u,scaleWithFactor as h,scaleAndAddWithFactor as d,computeNewReferenceCoordinates as g,projectiveTransform as w,validatePixelsToTransform as v,validateRotationMatrix as x,getWebMercatorScalingFactor as j,computeFarplaneVertices as A,computeHFOVAndVFOV as P,vecToPoint as R,hasAngles as V,convertPixelToHeadingPitch as F,convertHeadingPitchToSphereVertex as M,reducerFn as T}from"./utils.js";import{worldToImage as b}from"./worldToImage.js";import{defaultImageSphereCenter as L}from"../../../widgets/PanoramicViewer/constants.js";async function O(e,r,a){const{verticalFieldOfView:t,imageBoundaries:i,scalingFactor:o,farPlaneVertices:n,cameraLocation:c,pixelsToTransform:s,vecToPoint:f}=z(e,r),m=new Array;return await E(s,n,i,f,r,m,c,o,t,a),Array.isArray(e)?m:m[0]}async function E(e,a,t,i,o,n,c,s,f,l){for(const h of e){const e=q(a,t,h,i,o);let d=r(e);l&&p(u(l.elevationSample),y(l))&&(d=await m(i(e),{x:h[0],y:h[1]},{...o,...l,farPlaneVertices:a.map(i)})),n.push(i(k(d,c,s,o.averageElevation,o.cameraPitch,f)))}}function k(e,i,o,n,c,s){let f=r(e);const m=Math.sqrt((e[2]-i[2])**2+(Math.sqrt((e[0]-i[0])**2+(e[1]-i[1])**2)/o)**2)*o,l=h(t(a(),e,i),1/m,1/o);if(S(e[2],n,c,s)){const e=Math.abs((i[2]-n)/-l[2])*o;f=d(i,l,e,o)}else f[2]=n;return f}function S(e,r,a,t){return e<r||a+t/2<90}function q(e,r,a,t,i){let o=null;const n=9;let c,s=0,f=e,m=r;for(;s<=n;){const e=D(a,m,f,i);if(c=e.error,o=e.transformedPoint,p(c<=1,s===n))break;f=g(f,c,a,r),m=B(f,t,i),s++}return o}function B(e,r,a){return b(e.map(r),a).map((({x:e,y:r})=>[e,r,1]))}function D(e,r,a,t){const{cameraLocation:o}=t,n=w(e,r,a),{x:c,y:s}=b(new i(n,o.spatialReference),t);return{transformedPoint:n,error:H(e,[c,s,1])}}function H(e,r){return Math.abs(e[0]-r[0])+Math.abs(e[1]-r[1])}function z(r,a){const t=e(r)||"items"in r?r:[r],{cameraLocation:o,rotationMatrix:n}=a;if(v(t,o),x(n),9!==n?.length)throw new Error("Rotation matrix is not provided or is not a valid 3x3 matrix");const c=j(o.y,o.spatialReference),s=A({...a,scalingFactor:c}),f=b(s.map((e=>new i(e,o.spatialReference))),a),{vfov:m}=P(a.horizontalFieldOfView,a.verticalFieldOfView,a.cameraRoll);return{cameraLocation:o.toArray(),imageBoundaries:f.map((({x:e,y:r})=>[e,r,1])),verticalFieldOfView:m,farPlaneVertices:s,scalingFactor:c,pixelsToTransform:t.map((e=>[e.x,e.y,1])),vecToPoint:R(o.spatialReference)}}async function I(e,r,t){const{averageElevation:m,cameraHeading:p,cameraLocation:y,farDistance:h,imageHeight:d,imageWidth:g,verticalFieldOfView:w}=r,v=j(y.y,y.spatialReference),x=new Array,[A,P,R]=y.toArray(),b=c([A,P,R??0],h*v),O=L.toArray(),E=Array.isArray(e)?e:[e];for(const c of E){let e,j;if(V(c))e=c.heading,j=c.pitch;else{const r=F({x:c.x,y:c.y},g,d);e=r.heading,j=r.pitch}e=(e+p)%360;const L=o([O[0],O[1],O[2]],M(e,j)),E=n([A,P,R??0],L.direction);let S=a();s(b,E,S),t&&(f(t)||u(t.elevationSample))&&j+w/2<90&&(S=await l(new i(S,y.spatialReference),{heading:e,pitch:j},{...r,...t,farPlaneVertices:T(h,h).map((([e,r])=>new i([y.x+e,y.y+r],y.spatialReference)))})),S=k(S,y.toArray(),v,m,j,w),x.push(new i(S,y.spatialReference))}return Array.isArray(e)?x:x[0]}export{O as imageToWorld,I as imageToWorldPanoramic};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{deepClone as e}from"../../../arcade/deepClone.js";import"../../../core/Error.js";import"../../../core/has.js";import"../../../core/Logger.js";import{create as t}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import r from"../../../geometry/Point.js";import a from"../../../geometry/Polygon.js";import{fromPoints as n,intersectLine as o}from"../../../geometry/support/plane.js";import i from"./updateElevation.js";import{pointToArray as c,or as s}from"./utils.js";import{worldToImage as p,worldToImagePanoramic as f}from"./worldToImage.js";async function m(e,a,i,p=h){const{cameraLocation:f,farPlaneVertices:m}=i,l=c(f),w=new Array;await u(m,i,w);let b=n(w[0],w[1],w[2]),j=e.clone();for(let h=0;h<p;h++){const e=t();if(!o(b,l,c(j),e))break;let p=0,m=null;if(({error:p,imagePoint:m,pointWithZ:j}=await y(a,new r(e,f.spatialReference),i)),p<=1)break;const[h,u]=g(f.spatialReference,w);if(s(h<=1,u<=1))break;w.splice(0,w.length,...await x(h,u,new r(e,f.spatialReference),i)),b=n(w[0],w[1],w[2])}return c(j)}async function l(e,a,i,p=h){const{cameraLocation:f,farPlaneVertices:m}=i,l=c(f),w=new Array;await u(m,i,w);let y=n(w[0],w[1],w[2]),j=e.clone();for(let h=0;h<p;h++){const e=t();if(!o(y,l,c(j),e))break;let p,m=0;if(({error:m,imagePoint:p,pointWithZ:j}=await b(a,new r(e,f.spatialReference),i)),m<=1)break;const[h,u]=g(f.spatialReference,w);if(s(h<=1,u<=1))break;w.splice(0,w.length,...await x(h,u,new r(e,f.spatialReference),i)),y=n(w[0],w[1],w[2])}return c(j)}const h=10,w=10;function g(e,t){const r=new a({spatialReference:e});r.addRing(t);return[r.extent?.width?r.extent.width/w:1,r.extent?.height?r.extent.height/w:1]}async function u(t,r,a){const n=e(t),o=await i(n,r);a.push(...o.map(c))}async function y(e,t,r){const a=await i(t,r),n=p(a,r);return{error:j(n,e),imagePoint:n,pointWithZ:a}}async function b(e,t,r){const a=await i(t,r),n=f(a,r);return{error:d(n,e),imagePoint:n,pointWithZ:a}}const j=(e,t)=>Math.abs(e.x-t.x)+Math.abs(e.y-t.y),d=(e,t)=>Math.abs(e.heading-t.heading)+Math.abs(e.pitch-t.pitch);async function x(e,t,a,n){const o=[[-e,-t],[e,-t],[e,t],[-e,t]].map((([e,t])=>new r([a.x+e,a.y+t],a.spatialReference)));return i(o,n).then((e=>e.map((e=>e.toArray()))))}export{m as rectifyMapPoint,l as rectifyMapPointPanoramic};
5
+ import{deepClone as e}from"../../../arcade/deepClone.js";import"../../../core/Error.js";import"../../../core/has.js";import"../../../core/Logger.js";import{create as t}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import r from"../../../geometry/Point.js";import a from"../../../geometry/Polygon.js";import{fromPoints as n,intersectLine as o}from"../../../geometry/support/plane.js";import i from"./updateElevation.js";import{pointToArray as c,or as s}from"./utils.js";import{worldToImage as p,worldToImagePanoramic as f}from"./worldToImage.js";async function m(e,a,i,p=h){const{cameraLocation:f,farPlaneVertices:m}=i,l=c(f),w=new Array;await u(m,i,w);let b=n(w[0],w[1],w[2]),j=e.clone();for(let h=0;h<p;h++){const p=t();if(!o(b,l,c(e),p))break;let m=0,h=null;if(({error:m,imagePoint:h,pointWithZ:j}=await y(a,new r(p,f.spatialReference),i)),m<=1)break;const[u,d]=g(f.spatialReference,w);if(s(u<=1,d<=1))break;w.splice(0,w.length,...await x(u,d,new r(p,f.spatialReference),i)),b=n(w[0],w[1],w[2])}return c(j)}async function l(e,a,i,p=h){const{cameraLocation:f,farPlaneVertices:m}=i,l=c(f),w=new Array;await u(m,i,w);let y=n(w[0],w[1],w[2]),j=e.clone();for(let h=0;h<p;h++){const p=t();if(!o(y,l,c(e),p))break;let m,h=0;if(({error:h,imagePoint:m,pointWithZ:j}=await b(a,new r(p,f.spatialReference),i)),h<=1)break;const[u,d]=g(f.spatialReference,w);if(s(u<=1,d<=1))break;w.splice(0,w.length,...await x(u,d,new r(p,f.spatialReference),i)),y=n(w[0],w[1],w[2])}return c(j)}const h=10,w=10;function g(e,t){const r=new a({spatialReference:e});r.addRing(t);return[r.extent?.width?r.extent.width/w:1,r.extent?.height?r.extent.height/w:1]}async function u(t,r,a){const n=e(t),o=await i(n,r);a.push(...o.map(c))}async function y(e,t,r){const a=await i(t,r),n=p(a,r);return{error:j(n,e),imagePoint:n,pointWithZ:a}}async function b(e,t,r){const a=await i(t,r),n=f(a,r);return{error:d(n,e),imagePoint:n,pointWithZ:a}}const j=(e,t)=>Math.abs(e.x-t.x)+Math.abs(e.y-t.y),d=(e,t)=>Math.abs(e.heading-t.heading)+Math.abs(e.pitch-t.pitch);async function x(e,t,a,n){const o=[[-e,-t],[e,-t],[e,t],[-e,t]].map((([e,t])=>new r([a.x+e,a.y+t],a.spatialReference)));return i(o,n).then((e=>e.map((e=>e.toArray()))))}export{m as rectifyMapPoint,l as rectifyMapPointPanoramic};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../core/Error.js";import n from"../../../core/JSONSupport.js";import{deg2rad as a,rad2deg as i}from"../../../core/mathUtils.js";import{create as e}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as o,fromValues as r}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromArray as c}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{zeros as s}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{multiply as l,transpose as f}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{invertOrIdentity as h,mul as u}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{a as m,g as p}from"../../../chunks/vec32.js";import M from"../../../geometry/Point.js";import{projectWithZConversion as g}from"../../../geometry/projection.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{isElevationSource as w,isConstantElevation 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 S(t,n,a){const[i,e,r,c]=n,[s,l,f,m]=a;z(i,e,r,c);const p=z(s,l,f,m),M=V(i,e,r,c),g=V(s,l,f,m),v=h(o(),M),d=u(o(),v,g),[x,w,y,O]=P(t,d);return[x/O,w/O,p?0:y/O]}function z(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 F(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]=F(a*n[12]+i*n[13]+e*n[14]+n[15]),o}function V(t,n,a,i){const e=D(c([...i,1]),h(new Array(16),r(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=e[0],l=e[1],f=e[2],u=o();return u[0]=s*t[0],u[1]=l*n[0],u[2]=f*a[0],u[3]=0,u[4]=s*t[1],u[5]=l*n[1],u[6]=f*a[1],u[7]=0,u[8]=s*t[2],u[9]=l*n[2],u[10]=f*a[2],u[11]=0,u[12]=s,u[13]=l,u[14]=f,u[15]=1,u}function C(t,n,a,i,e=s()){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=s();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=s();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,i,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=e();switch(i){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 H(n,a,i=!0){if(3!==n?.length||3!==a?.length)throw new t("InvalidRotationAngles","Please specify three angles with config for rotation");const o=e();for(let t=0;t<3;t++){const[e,r]=a[t],c=I(n[t],e,r,i);l(o,c,o)}return o}function q(t,n=!0){return H(t,N.OPK,n)}function k(t,n=!0){return H(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),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 W(t,n){const e=Number(t[0]),o=Number(t[1]),r=Number(t[2]),[c,s,l,f]=n,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=i(O);return[i(b),j,e/(Math.cos(O)*Math.sin(b-u))-l/Math.sqrt(1-f*Math.sin(O)**2)]}function U(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}=X(t,i);return J(e,o,n,a)}function J(t,n,a,i){return{x:a/2+t/(360/a),y:i-n/(180/i),heading:t,pitch:n}}function X(t,n){const a=i(Math.acos(-t.z/n));return{heading:i(Math.atan2(t.x,t.y)),pitch:a}}function Y(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))]}async function Z(t,n,a){const e=await g(n,t.spatialReference,a);let o=i(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 $(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 B=t=>t.toArray(),G=(...t)=>t.some((t=>t));function Q(t,n){if(G(0===t.length,t.some((({x:t,y:n})=>G(null==t,null==n))),!n.hasZ))throw new Error("Input pixels must have x, y and camera location must have z value")}function _(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 tt(t){if(9!==t?.length)throw new Error("Rotation matrix is not provided or is not a valid 3x3 matrix")}function nt(t,n){return d(n)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*t/v.radius))):1}const at=t=>n=>new M(n,t),it=t=>null!=t&&"queryExtent"in t;function et(t,n,a,i){return[[-n,-n],[+n,-n],[+n,+n],[-n,+n]].map((([n,e])=>S(x(s(),a,[n,e,0]),i,t)))}function ot({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(rt);return null!=s&&ct(l)?{affines:l,focalLength:s}:{affines:[r/2-.5,1,0,c/2-.5,0,-1]}}function rt(t,n){if(null==t)return null;const a=parseFloat(`${t}`);return isNaN(a)?null:a}function ct(t){return null!=t[1]&&null!=t[5]}function st(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{...ht(t,n,a),averageElevation:h,cameraPitch:e,cameraRoll:o??0,farDistance:c,horizontalFieldOfView:s,verticalFieldOfView:f}}function lt(t,n,a,i){return xt(i)?q([i.omega,i.phi,i.kappa]):wt(i)?k([i.heading,i.pitch,i.roll]):k([t,n,a??0])}function ft(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 ht(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}=ot({a0:i,a1:e,a2:o,b0:r,b1:c,b2:s},n,a,m),j=g??lt(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 ut=t=>null!=t&&"elevationSample"in t&&null!=t.elevationSample,mt=t=>w(t?.elevationSource)&&null!=t?.extent,pt=t=>y(t?.elevationSource),Mt=async(t,a)=>null!=a&&(ut(a)||pt(a))?a:mt(a)?{elevationSample:await b({...n.isSerializable(a.elevationSource)?a.elevationSource.toJSON():a.elevationSource,extent:a.extent}),elevationSource:new O({constantElevation:t})}:{elevationSource:new O({constantElevation:t})},gt=t=>j(t?.heading)&&j(t?.pitch),vt=(t,n)=>[[-t,-n],[t,-n],[t,n],[-t,n]];function dt(t){const{cameraLocation:n,farDistance:i,horizontalFieldOfView:o,rotationMatrix:r,scalingFactor:c,verticalFieldOfView:l}=t,h=e();f(h,r);const u=2*Math.tan(a(l)/2)*i*c,M=2*Math.tan(a(o)/2)*i*c,g=L([0,0,-1],h),v=C([n.x,n.y,n.z],g,t.farDistance*c,c),d=L([0,1,0],h),x=L([1,0,0],h),w=R(d,u/2,c),y=R(x,M/2,c),O=m(s(),w,y),b=p(s(),w,y);return[p(s(),v,O),p(s(),v,b),m(s(),v,O),m(s(),v,b)]}const xt=t=>2===t?.type,wt=t=>1===t?.type;function yt(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 Ot;!function(t){t[t.CLOCKWISE=-1]="CLOCKWISE",t[t.COUNTERCLOCKWISE=1]="COUNTERCLOCKWISE"}(Ot||(Ot={}));export{dt as computeFarplaneVertices,A as computeHFOVAndVFOV,et as computeNewReferenceCoordinates,Y as convertHeadingPitchToSphereVertex,J as convertOrientationToPixelLocation,U as convertPixelToHeadingPitch,X as convertSphereVertexToOrientation,T as convertSphereVertexToPixelLocation,H as createRotationMatrix,k as createRotationMatrixFromHPR,q as createRotationMatrixFromOPK,K as geographicToLTP,ot as getAffinesAndFocalLength,ft as getImageToWorldPanoramicProperties,st as getImageToWorldProperties,Z as getInitialAngle,Mt as getUpdateElevationProps,nt as getWebMercatorScalingFactor,ht as getWorldToImageProperties,gt as hasAngles,wt as hasHeadingPitchRoll,xt as hasOmegaPhiKappa,it as isElevationSampler,ut as isUpdateElevationWithElevationSampler,mt as isUpdateElevationWithElevationSource,pt as isUpdateUsingConstantElevation,ct as isValidAffines,V as linearEquationSolve,W as ltpToGeographic,G as or,B as pointToArray,S as projectiveTransform,vt as reducerFn,$ as rotatePixel,C as scaleAndAddWithFactor,R as scaleWithFactor,yt as transformGraphicCoordinatesToPixel,L as transformMat3,D as transformMat4,Q as validatePixelsToTransform,_ as validatePointsToTransform,tt as validateRotationMatrix,at as vecToPoint};
5
+ import t from"../../../core/Error.js";import n from"../../../core/JSONSupport.js";import{deg2rad as a,rad2deg as i}from"../../../core/mathUtils.js";import{create as e}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as o,fromValues as r}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromArray as c}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{zeros as s}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{multiply as l,transpose as f}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{invertOrIdentity as h,mul as u}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{a as m,g as p}from"../../../chunks/vec32.js";import M from"../../../geometry/Point.js";import{projectWithZConversion as g}from"../../../geometry/projection.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{isElevationSource as w,isConstantElevation 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 S(t,n,a){const[i,e,r,c]=n,[s,l,f,m]=a;z(i,e,r,c);const p=z(s,l,f,m),M=V(i,e,r,c),g=V(s,l,f,m),v=h(o(),M),d=u(o(),v,g),[x,w,y,O]=P(t,d);return[x/O,w/O,p?0:y/O]}function z(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 F(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]=F(a*n[12]+i*n[13]+e*n[14]+n[15]),o}function V(t,n,a,i){const e=D(c([...i,1]),h(new Array(16),r(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=e[0],l=e[1],f=e[2],u=o();return u[0]=s*t[0],u[1]=l*n[0],u[2]=f*a[0],u[3]=0,u[4]=s*t[1],u[5]=l*n[1],u[6]=f*a[1],u[7]=0,u[8]=s*t[2],u[9]=l*n[2],u[10]=f*a[2],u[11]=0,u[12]=s,u[13]=l,u[14]=f,u[15]=1,u}function C(t,n,a,i,e=s()){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=s();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=s();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,i,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=e();switch(i){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 H(n,a,i=!0){if(3!==n?.length||3!==a?.length)throw new t("InvalidRotationAngles","Please specify three angles with config for rotation");const o=e();for(let t=0;t<3;t++){const[e,r]=a[t],c=I(n[t],e,r,i);l(o,c,o)}return o}function q(t,n=!0){return H(t,N.OPK,n)}function k(t,n=!0){return H(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),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 W(t,n){const e=Number(t[0]),o=Number(t[1]),r=Number(t[2]),[c,s,l,f]=n,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=i(O);return[i(b),j,e/(Math.cos(O)*Math.sin(b-u))-l/Math.sqrt(1-f*Math.sin(O)**2)]}function U(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}=X(t,i);return J(e,o,n,a)}function J(t,n,a,i){return{x:a/2+t/(360/a),y:i-n/(180/i),heading:t,pitch:n}}function X(t,n){const a=i(Math.acos(-t.z/n));return{heading:i(Math.atan2(t.x,t.y)),pitch:a}}function Y(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))]}async function Z(t,n,a){const e=await g(n,t.spatialReference,a);let o=i(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 $(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 B=t=>t.toArray(),G=(...t)=>t.some((t=>t));function Q(t,n){if(G(0===t.length,t.some((({x:t,y:n})=>G(null==t,null==n))),!n.hasZ))throw new Error("Input pixels must have x, y and camera location must have z value")}function _(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 tt(t){if(9!==t?.length)throw new Error("Rotation matrix is not provided or is not a valid 3x3 matrix")}function nt(t,n){return d(n)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*t/v.radius))):1}const at=t=>n=>new M(n,t),it=t=>null!=t&&"queryExtent"in t;function et(t,n,a,i){return[[-n,-n],[+n,-n],[+n,+n],[-n,+n]].map((([n,e])=>S(x(s(),a,[n,e,0]),i,t)))}function ot({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(rt);return null!=s&&ct(l)?{affines:l,focalLength:s}:{affines:[r/2-.5,1,0,c/2-.5,0,-1]}}function rt(t,n){if(null==t)return null;const a=parseFloat(`${t}`);return isNaN(a)?null:a}function ct(t){return null!=t[1]&&null!=t[5]}function st(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{...ht(t,n,a),averageElevation:h,cameraPitch:e,cameraRoll:o??0,farDistance:c,horizontalFieldOfView:s,verticalFieldOfView:f}}function lt(t,n,a,i){return xt(i)?q([i.omega,i.phi,i.kappa]):wt(i)?k([i.heading,i.pitch,i.roll]):k([t,n,a??0])}function ft(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 ht(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}=ot({a0:i,a1:e,a2:o,b0:r,b1:c,b2:s},n,a,m),j=g??lt(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 ut=t=>null!=t&&"elevationSample"in t&&null!=t.elevationSample,mt=t=>w(t?.elevationSource)&&null!=t?.extent,pt=t=>y(t?.elevationSource),Mt=async(t,a)=>null!=a&&(ut(a)||pt(a))?a:mt(a)?{elevationSample:await b({...n.isSerializable(a.elevationSource)?a.elevationSource.toJSON():a.elevationSource,extent:a.extent}),elevationSource:new O({constantElevation:t})}:{elevationSource:new O({constantElevation:t})},gt=t=>j(t?.heading)&&j(t?.pitch),vt=(t,n)=>[[-t,-n],[t,-n],[t,n],[-t,n]];function dt(t){const{cameraLocation:n,farDistance:i,horizontalFieldOfView:o,rotationMatrix:r,scalingFactor:c,verticalFieldOfView:l}=t,h=e();f(h,r);const u=2*Math.tan(a(l)/2)*i*c,M=2*Math.tan(a(o)/2)*i*c,g=L([0,0,-1],h),v=C([n.x,n.y,n.z],g,t.farDistance*c,c),d=L([0,1,0],h),x=L([1,0,0],h),w=R(d,u/2,c),y=R(x,M/2,c),O=m(s(),w,y),b=p(s(),w,y);return[p(s(),v,O),p(s(),v,b),m(s(),v,O),m(s(),v,b)]}const xt=t=>2===t?.type,wt=t=>1===t?.type;function yt(t){return(t+360)%360}function Ot(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 bt;!function(t){t[t.CLOCKWISE=-1]="CLOCKWISE",t[t.COUNTERCLOCKWISE=1]="COUNTERCLOCKWISE"}(bt||(bt={}));export{dt as computeFarplaneVertices,A as computeHFOVAndVFOV,et as computeNewReferenceCoordinates,Y as convertHeadingPitchToSphereVertex,J as convertOrientationToPixelLocation,U as convertPixelToHeadingPitch,X as convertSphereVertexToOrientation,T as convertSphereVertexToPixelLocation,H as createRotationMatrix,k as createRotationMatrixFromHPR,q as createRotationMatrixFromOPK,K as geographicToLTP,ot as getAffinesAndFocalLength,ft as getImageToWorldPanoramicProperties,st as getImageToWorldProperties,Z as getInitialAngle,Mt as getUpdateElevationProps,nt as getWebMercatorScalingFactor,ht as getWorldToImageProperties,gt as hasAngles,wt as hasHeadingPitchRoll,xt as hasOmegaPhiKappa,it as isElevationSampler,ut as isUpdateElevationWithElevationSampler,mt as isUpdateElevationWithElevationSource,pt as isUpdateUsingConstantElevation,ct as isValidAffines,V as linearEquationSolve,W as ltpToGeographic,yt as normalizeHeading,G as or,B as pointToArray,S as projectiveTransform,vt as reducerFn,$ as rotatePixel,C as scaleAndAddWithFactor,R as scaleWithFactor,Ot as transformGraphicCoordinatesToPixel,L as transformMat3,D as transformMat4,Q as validatePixelsToTransform,_ as validatePointsToTransform,tt as validateRotationMatrix,at 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.32/esri/copyright.txt for details.
4
4
  */
5
- import{rad2deg as t,deg2rad as a}from"../../../core/mathUtils.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as o,j as n}from"../../../chunks/vec32.js";import{webMercatorToGeographic as e}from"../../../geometry/support/webMercatorUtils.js";import{convertOrientationToPixelLocation as i,validatePointsToTransform as c,validateRotationMatrix as s,getWebMercatorScalingFactor as f}from"./utils.js";function m(t,a){const{cameraLocation:r,pointsToTransform:o,scalingFactor:n}=h(t,a.cameraLocation,a.rotationMatrix),e=new Array;return u(o,e,{...a,cameraLocation:r,scalingFactor:n,...A(a)}),Array.isArray(t)?e:e[0]}function l(t,a,r){return m(t?a.map((t=>e(t))):a,r).map((t=>({...t,z:1})))}function u(t,a,n){const{affineTransformations:e,cameraLocation:i,focalLengthX:c,focalLengthY:s,principalOffsetPoint:f,radialDistortionCoefficients:m,rotationMatrix:l,scalingFactor:u,tangentialDistortionCoefficients:p}=n;for(const h of t){const t=r();o(t,h,i),t[0]=t[0]/u,t[1]=t[1]/u;const n=-c*((l[0]*t[0]+l[3]*t[1]+l[6]*t[2])/(l[2]*t[0]+l[5]*t[1]+l[8]*t[2])),g=-s*((l[1]*t[0]+l[4]*t[1]+l[7]*t[2])/(l[2]*t[0]+l[5]*t[1]+l[8]*t[2])),y=n*n+g*g;let L=0,A=0,T=0,b=0,d=0,w=0,M=0;m&&(L=m[0]??0,A=m[1]??0,T=m[2]??0),p&&(b=p[0],d=p[1]),f&&(w=f[0]??0,M=f[1]??0);const j=1+L*y+A*y*y+T*y*y*y;let F=n*j+b*(y+2*n**2)+2*d*n*g,N=g*j+d*(y+2*g**2)+2*b*n*g;F+=w,N+=M;const x=Number(e[0])+Number(e[1])*F+Number(e[2])*N,v=Number(e[3])+Number(e[4])*F+Number(e[5])*N;a.push({x,y:v})}}function p(a,r){const{cameraHeading:o,imageHeight:e,imageWidth:c}=r,{cameraLocation:s,pointsToTransform:f}=g(a,r.cameraLocation),m=new Array;for(const l of f){const a=n(s,l),r=(t(Math.atan2(l[0]-s[0],l[1]-s[1]))-o)%360,f=t(Math.acos((s[2]-l[2])/a));m.push(i(r,f,c,e))}return Array.isArray(a)?m:m[0]}function h(t,a,r){const o=Array.isArray(t)||"items"in t?t:[t];c(o,a),y(o,a),s(r);const n=f(a.y,a.spatialReference);return{pointsToTransform:o.map((t=>t.toArray())),scalingFactor:n,cameraLocation:a.toArray()}}function g(t,a){const r=Array.isArray(t)||"items"in t?t:[t];return c(r,a),y(r,a),{pointsToTransform:r.map((t=>t.toArray())),cameraLocation:a.toArray()}}function y(t,a){if(t.some((t=>!t.spatialReference.equals(a.spatialReference))))throw new Error("Input points and camera location must have the same spatial reference")}function L(t){return null!=t?.focalLength}function A(t){if(L(t))return{focalLengthX:t.focalLength,focalLengthY:t.focalLength};const{imageWidth:r,imageHeight:o,horizontalFieldOfView:n,verticalFieldOfView:e}=t;return{focalLengthX:r/(2*Math.tan(a(n)/2)),focalLengthY:o/(2*Math.tan(a(e)/2))}}export{m as worldToImage,p as worldToImagePanoramic,l as worldToImageWithLTPFlag};
5
+ import{rad2deg as t,deg2rad as a}from"../../../core/mathUtils.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as o,j as n}from"../../../chunks/vec32.js";import{webMercatorToGeographic as e}from"../../../geometry/support/webMercatorUtils.js";import{normalizeHeading as i,convertOrientationToPixelLocation as c,validatePointsToTransform as s,validateRotationMatrix as f,getWebMercatorScalingFactor as m}from"./utils.js";function l(t,a){const{cameraLocation:r,pointsToTransform:o,scalingFactor:n}=g(t,a.cameraLocation,a.rotationMatrix),e=new Array;return p(o,e,{...a,cameraLocation:r,scalingFactor:n,...T(a)}),Array.isArray(t)?e:e[0]}function u(t,a,r){return l(t?a.map((t=>e(t))):a,r).map((t=>({...t,z:1})))}function p(t,a,n){const{affineTransformations:e,cameraLocation:i,focalLengthX:c,focalLengthY:s,principalOffsetPoint:f,radialDistortionCoefficients:m,rotationMatrix:l,scalingFactor:u,tangentialDistortionCoefficients:p}=n;for(const h of t){const t=r();o(t,h,i),t[0]=t[0]/u,t[1]=t[1]/u;const n=-c*((l[0]*t[0]+l[3]*t[1]+l[6]*t[2])/(l[2]*t[0]+l[5]*t[1]+l[8]*t[2])),g=-s*((l[1]*t[0]+l[4]*t[1]+l[7]*t[2])/(l[2]*t[0]+l[5]*t[1]+l[8]*t[2])),y=n*n+g*g;let L=0,A=0,T=0,b=0,d=0,w=0,M=0;m&&(L=m[0]??0,A=m[1]??0,T=m[2]??0),p&&(b=p[0],d=p[1]),f&&(w=f[0]??0,M=f[1]??0);const j=1+L*y+A*y*y+T*y*y*y;let F=n*j+b*(y+2*n**2)+2*d*n*g,N=g*j+d*(y+2*g**2)+2*b*n*g;F+=w,N+=M;const x=Number(e[0])+Number(e[1])*F+Number(e[2])*N,v=Number(e[3])+Number(e[4])*F+Number(e[5])*N;a.push({x,y:v})}}function h(a,r){const{cameraHeading:o,imageHeight:e,imageWidth:s}=r,{cameraLocation:f,pointsToTransform:m}=y(a,r.cameraLocation),l=new Array;for(const u of m){const a=n(f,u),r=i(t(Math.atan2(u[0]-f[0],u[1]-f[1]))-o),m=t(Math.acos((f[2]-u[2])/a));l.push(c(r,m,s,e))}return Array.isArray(a)?l:l[0]}function g(t,a,r){const o=Array.isArray(t)||"items"in t?t:[t];s(o,a),L(o,a),f(r);const n=m(a.y,a.spatialReference);return{pointsToTransform:o.map((t=>t.toArray())),scalingFactor:n,cameraLocation:a.toArray()}}function y(t,a){const r=Array.isArray(t)||"items"in t?t:[t];return s(r,a),L(r,a),{pointsToTransform:r.map((t=>t.toArray())),cameraLocation:a.toArray()}}function L(t,a){if(t.some((t=>!t.spatialReference.equals(a.spatialReference))))throw new Error("Input points and camera location must have the same spatial reference")}function A(t){return null!=t?.focalLength}function T(t){if(A(t))return{focalLengthX:t.focalLength,focalLengthY:t.focalLength};const{imageWidth:r,imageHeight:o,horizontalFieldOfView:n,verticalFieldOfView:e}=t;return{focalLengthX:r/(2*Math.tan(a(n)/2)),focalLengthY:o/(2*Math.tan(a(e)/2))}}export{l as worldToImage,h as worldToImagePanoramic,u as worldToImageWithLTPFlag};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import o from"../../core/Clonable.js";import{JSONMap as r}from"../../core/jsonMap.js";import t from"../../core/JSONSupport.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";const n=new r({esriRelCardinalityOneToOne:"one-to-one",esriRelCardinalityOneToMany:"one-to-many",esriRelCardinalityManyToMany:"many-to-many"}),a=new r({esriRelRoleOrigin:"origin",esriRelRoleDestination:"destination"});let l=class extends(o.ClonableMixin(t)){constructor(e){super(e),this.cardinality=null,this.composite=null,this.id=null,this.keyField=null,this.keyFieldInRelationshipTable=null,this.name=null,this.relatedTableId=null,this.relationshipTableId=null,this.role=null}};e([i({json:{read:n.read,write:n.write}})],l.prototype,"cardinality",void 0),e([i({json:{read:!0,write:!0}})],l.prototype,"composite",void 0),e([i({json:{read:!0,write:!0}})],l.prototype,"id",void 0),e([i({json:{read:!0,write:!0}})],l.prototype,"keyField",void 0),e([i({json:{read:!0,write:!0}})],l.prototype,"keyFieldInRelationshipTable",void 0),e([i({json:{read:!0,write:!0}})],l.prototype,"name",void 0),e([i({json:{read:!0,write:!0}})],l.prototype,"relatedTableId",void 0),e([i({json:{read:!0,write:!0}})],l.prototype,"relationshipTableId",void 0),e([i({json:{read:a.read,write:a.write}})],l.prototype,"role",void 0),l=e([s("esri.layers.support.Relationship")],l);const p=l;export{p as default};
5
+ import{_ as o}from"../../chunks/tslib.es6.js";import e from"../../core/Clonable.js";import{JSONMap as r}from"../../core/jsonMap.js";import t from"../../core/JSONSupport.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";const a=new r({esriRelCardinalityOneToOne:"one-to-one",esriRelCardinalityOneToMany:"one-to-many",esriRelCardinalityManyToMany:"many-to-many"}),n=new r({esriRelRoleOrigin:"origin",esriRelRoleDestination:"destination"});let l=class extends(e.ClonableMixin(t)){constructor(o){super(o),this.cardinality=null,this.catalogId=null,this.composite=null,this.id=null,this.keyField=null,this.keyFieldInRelationshipTable=null,this.name=null,this.relatedTableId=null,this.relationshipTableId=null,this.role=null}};o([i({json:{read:a.read,write:a.write}})],l.prototype,"cardinality",void 0),o([i({json:{name:"catalogID"}})],l.prototype,"catalogId",void 0),o([i({json:{read:!0,write:!0}})],l.prototype,"composite",void 0),o([i({json:{read:!0,write:!0}})],l.prototype,"id",void 0),o([i({json:{read:!0,write:!0}})],l.prototype,"keyField",void 0),o([i({json:{read:!0,write:!0}})],l.prototype,"keyFieldInRelationshipTable",void 0),o([i({json:{read:!0,write:!0}})],l.prototype,"name",void 0),o([i({json:{read:!0,write:!0}})],l.prototype,"relatedTableId",void 0),o([i({json:{read:!0,write:!0}})],l.prototype,"relationshipTableId",void 0),o([i({json:{read:n.read,write:n.write}})],l.prototype,"role",void 0),l=o([s("esri.layers.support.Relationship")],l);const p=l;export{p 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.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import r from"../request.js";import t from"../core/JSONSupport.js";import o from"../core/Loadable.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import{isSubtypeSublayer as a,isFeatureLayer as n}from"../layers/support/layerUtils.js";import{RuleType as i}from"./support/typeUtils.js";let c=class extends(t.JSONSupportMixin(o)){constructor(e){super(e),this.rulesCategorized={attachment:[],containment:[],connectivity:[]},this.request=r}initialize(){}async load(e){const r=this.rulesLayer.load(e).then((()=>this._initializeRulesTable()));return this.addResolvingPromise(r),this}getFeaturesCanAssociateWithClause(e,r,t){return this._getWhereClauseForCompatibleFeatures(e,r,t)}getFeaturesCanAssociateWith(e,r,t){return null==this._getFeatureSourceLayerId(e)?[]:r.filter((r=>this.canAssociateFeatures(e,r,t)))}canAssociateFeatures(e,r,t){const[o,s]=this._getFeatureAssetCodes(e),u=this._getFeatureSourceLayerId(e),[a,n]=this._getFeatureAssetCodes(r),i=this._getFeatureSourceLayerId(r);return null!=u&&null!=i&&t.some((e=>{const{type:r,direction:t}=e;return this._getRulesForAssociationType(r).some((e=>{const c=this._getRuleFieldValuesForAssociation(e,r,t);return c?.some((e=>u===e?.ruleLayerIdForSource&&o===e?.ruleAssetGroupCodeForSource&&s===e?.ruleAssetTypeCodeForSource&&i===e?.ruleLayerIdForTarget&&a===e?.ruleAssetGroupCodeForTarget&&n===e?.ruleAssetTypeCodeForTarget))}))}))}getLayersCanAssociateWith(e,r,t){return null==this._getFeatureSourceLayerId(e)?[]:r.filter((r=>this.canAssociateFeatureToLayer(e,r,t)))}canAssociateFeatureToLayer(e,r,t){const o=a(r)?r.parent:r;if(!o)return!1;const s=o.layerId,u=a(r)?r.subtypeCode:null,[n,i]=this._getFeatureAssetCodes(e),c=this._getFeatureSourceLayerId(e);return null!=c&&t.some((e=>{const{type:r,direction:t}=e;return this._getRulesForAssociationType(r).some((e=>{const o=this._getRuleFieldValuesForAssociation(e,r,t);return o?.some((e=>c===e?.ruleLayerIdForSource&&n===e?.ruleAssetGroupCodeForSource&&i===e?.ruleAssetTypeCodeForSource&&s===e?.ruleLayerIdForTarget&&(null==u||u===e?.ruleAssetGroupCodeForTarget)))}))}))}getFeatureSQL(e,r){const t=e.layerId.toString(),o=e.fieldsIndex?.normalizeFieldName("assetGroup"),s=e.fieldsIndex?.normalizeFieldName("assetType"),u=o?r.attributes[o]:null,a=s?r.attributes[s]:null,n=this.rulesHash[t];if(n){const e=n.assetGroupHash[u];if(e){return e.assetTypeHash[a]||null}}return null}async _initializeRulesTable(){const e={};let r;!function(e){e[e.from=0]="from",e[e.to=1]="to",e[e.via=2]="via"}(r||(r={}));const t=[{networkSourceId:"fromNetworkSource",assetGroupId:"fromAssetGroup",assetTypeId:"fromAssetType"},{networkSourceId:"toNetworkSource",assetGroupId:"toAssetGroup",assetTypeId:"toAssetType"},{networkSourceId:"viaNetworkSource",assetGroupId:"viaAssetGroup",assetTypeId:"viaAssetType"}];this.rulesCategorized={attachment:[],containment:[],connectivity:[]};for(const o of this.rules){if(o.ruleType===i.RTAttachment){this.rulesCategorized.attachment.push(o);continue}if(o.ruleType===i.RTContainment){this.rulesCategorized.containment.push(o);continue}if(o.ruleType===i.RTJunctionJunctionConnectivity){this.rulesCategorized.connectivity.push(o);continue}this.rulesCategorized.connectivity.push(o);let s=[[r.from,r.to],[r.to,r.from]];o.ruleType===i.RTEdgeJunctionEdgeConnectivity&&(s=[[r.from,r.via],[r.via,r.from],[r.to,r.via],[r.via,r.to]]);for(const u of s){const s=u.shift(),a=u.shift();let n=!1;switch(o.ruleType){case i.RTEdgeJunctionEdgeConnectivity:n=s===r.from||s===r.to;break;case i.RTJunctionEdgeConnectivity:n=s===r.to}const c=t[s],d=o[c.networkSourceId]?.layerId.toString()??"",l=o[c.assetGroupId]?.assetGroupCode?.toString(),p=o[c.assetTypeId],y=p?.assetTypeCode?.toString(),T=t[a],C=o[T.networkSourceId]?.layerId.toString()??"",A=o[T.assetGroupId]?.assetGroupCode?.toString(),F=o[T.assetTypeId],g=F?.assetTypeCode?.toString(),m=e[d]??{assetGroupHash:{}};if(!(l&&y&&A&&g))continue;const S=m.assetGroupHash[l]??{assetTypeHash:{}},f=S.assetTypeHash[y]??{};if(f[C]=f[C]??{},n){f[d]=f[d]??{};const e=`(assetgroup = ${l} AND assettype = ${y})`;"esriNECPEndVertex"===F?.connectivityPolicy?f[d].endVertex=f[d]?.endVertex?`${f[d].endVertex}`:`${e}`:f[d].anyVertex=f[d].anyVertex?`${f[d].anyVertex}`:`${e}`}const G=`(assetgroup = ${A} AND assettype = ${g})`;"esriNECPEndVertex"===F?.connectivityPolicy?f[C].endVertex=f[C]?.endVertex?`${f[C].endVertex} OR ${G}`:`${G}`:f[C].anyVertex=f[C]?.anyVertex?`${f[C].anyVertex} OR ${G}`:`${G}`,S.assetTypeHash[y]=f,m.assetGroupHash[l]=S,e[d]=m}}this._set("rulesHash",e)}_getRuleFieldValuesForAssociation(e,r,t="from"){switch(r){case"attachment":case"containment":return"from"===t?[{ruleLayerIdForSource:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.fromAssetType?.assetTypeCode,ruleLayerIdForTarget:e.toNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.toAssetType?.assetTypeCode}]:[{ruleLayerIdForSource:e.toNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.toAssetType?.assetTypeCode,ruleLayerIdForTarget:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.fromAssetType?.assetTypeCode}];case"connectivity":case"junction-junction-connectivity":return[{ruleLayerIdForSource:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.fromAssetType?.assetTypeCode,ruleLayerIdForTarget:e.toNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.toAssetType?.assetTypeCode},{ruleLayerIdForSource:e.toNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.toAssetType?.assetTypeCode,ruleLayerIdForTarget:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.fromAssetType?.assetTypeCode}];case"junction-edge-from-connectivity":case"junction-edge-midspan-connectivity":case"junction-edge-to-connectivity":return e.ruleType===i.RTEdgeJunctionEdgeConnectivity?[{ruleLayerIdForSource:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.fromAssetType?.assetTypeCode,ruleLayerIdForTarget:e.viaNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.viaAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.viaAssetType?.assetTypeCode},{ruleLayerIdForSource:e.viaNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.viaAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.viaAssetType?.assetTypeCode,ruleLayerIdForTarget:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.fromAssetType?.assetTypeCode},{ruleLayerIdForSource:e.toNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.toAssetType?.assetTypeCode,ruleLayerIdForTarget:e.viaNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.viaAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.viaAssetType?.assetTypeCode},{ruleLayerIdForSource:e.viaNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.viaAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.viaAssetType?.assetTypeCode,ruleLayerIdForTarget:e.toNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.toAssetType?.assetTypeCode}]:[{ruleLayerIdForSource:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.fromAssetType?.assetTypeCode,ruleLayerIdForTarget:e.toNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.toAssetType?.assetTypeCode},{ruleLayerIdForSource:e.toNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.toAssetType?.assetTypeCode,ruleLayerIdForTarget:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.fromAssetType?.assetTypeCode}];default:return[]}}_getWhereClauseForCompatibleFeatures(e,r,t){const o=new Map,[s,u]=this._getAssetFieldNames(e.sourceLayer),[n,i]=this._getFeatureAssetCodes(e),c=this._getFeatureSourceLayerId(e),d=a(r)?r.parent:r;t.forEach((e=>{const{type:r,direction:t}=e;this._getRulesForAssociationType(r).forEach((e=>{this._getRuleFieldValuesForAssociation(e,r,t).forEach((e=>{if(null!=e.ruleAssetGroupCodeForTarget&&null!=e.ruleAssetTypeCodeForTarget&&c===e?.ruleLayerIdForSource&&n===e?.ruleAssetGroupCodeForSource&&i===e?.ruleAssetTypeCodeForSource&&d.layerId===e?.ruleLayerIdForTarget){const r=o.get(e.ruleAssetGroupCodeForTarget)??new Set;r.add(e.ruleAssetTypeCodeForTarget),o.set(e.ruleAssetGroupCodeForTarget,r)}}))}))}));let l=[];return this._mergeAssetCodes(o).forEach(((e,r)=>l.push(`${s} IN (${r}) AND ${u} IN (${Array.from(e).sort().join(", ")})`))),l.length>1&&(l=l.map((e=>`(${e})`))),l.join(" OR ")}_getRulesForAssociationType(e){const{rulesCategorized:r}=this;switch(e){case"attachment":return r.attachment;case"containment":return r.containment;case"connectivity":case"junction-junction-connectivity":return r.connectivity.filter((e=>e.ruleType===i.RTJunctionJunctionConnectivity));case"junction-edge-from-connectivity":case"junction-edge-midspan-connectivity":case"junction-edge-to-connectivity":return r.connectivity.filter((e=>e.ruleType===i.RTJunctionEdgeConnectivity||e.ruleType===i.RTEdgeJunctionEdgeConnectivity));default:return[]}}_getFeatureSourceLayerId(e){const{sourceLayer:r}=e;let t;return n(r)?t=r.layerId:a(r)&&(t=r.parent?.layerId),t??null}_getAssetFieldNames(e){if(!e||!("fieldsIndex"in e))return[null,null];return[e.fieldsIndex.normalizeFieldName("assetGroup")??null,e.fieldsIndex.normalizeFieldName("assetType")??null]}_getFeatureAssetCodes(e){const[r,t]=this._getAssetFieldNames(e.sourceLayer);return[r?e.attributes[r]:null,t?e.attributes[t]:null]}_areSetsEqual(e,r){if(e.size!==r.size)return!1;for(const t of e)if(!r.has(t))return!1;return!0}_mergeAssetCodes(e){const r=new Map,t=new Set;for(const[o,s]of e){const u=new Set([o]);for(const[r,n]of e)o!==r&&!t.has(r)&&this._areSetsEqual(s,n)&&(u.add(r),t.add(r));const a=Array.from(u).sort().join(", ");r.set(a,s)}return r}};e([s({constructOnly:!0})],c.prototype,"rulesLayer",void 0),e([s({constructOnly:!0})],c.prototype,"rules",void 0),e([s({readOnly:!0})],c.prototype,"rulesHash",void 0),e([s()],c.prototype,"rulesCategorized",void 0),e([s({constructOnly:!0})],c.prototype,"request",void 0),c=e([u("esri.networks.RulesTable")],c);const d=c;export{d as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import r from"../request.js";import t from"../core/JSONSupport.js";import o from"../core/Loadable.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import{isSubtypeSublayer as a,isFeatureLayer as n}from"../layers/support/layerUtils.js";import{RuleType as i}from"./support/typeUtils.js";let d=class extends(t.JSONSupportMixin(o)){constructor(e){super(e),this.rulesCategorized={attachment:[],containment:[],connectivity:[]},this.request=r}initialize(){}async load(e){const r=this.rulesLayer.load(e).then((()=>this._initializeRulesTable()));return this.addResolvingPromise(r),this}getFeaturesCanAssociateWithClause(e,r,t){return this._getWhereClauseForCompatibleFeatures(e,r,t)}getFeaturesCanAssociateWith(e,r,t){return null==this._getFeatureSourceLayerId(e)?[]:r.filter((r=>this.canAssociateFeatures(e,r,t)))}canAssociateFeatures(e,r,t){const[o,s]=this._getFeatureAssetCodes(e),u=this._getFeatureSourceLayerId(e),[a,n]=this._getFeatureAssetCodes(r),i=this._getFeatureSourceLayerId(r);return null!=u&&null!=i&&t.some((e=>{const{type:r,direction:t}=e;return this._getRulesForAssociationType(r).some((e=>{const d=this._getRuleFieldValuesForAssociation(e,r,t);return d?.some((e=>u===e?.ruleLayerIdForSource&&o===e?.ruleAssetGroupCodeForSource&&s===e?.ruleAssetTypeCodeForSource&&i===e?.ruleLayerIdForTarget&&a===e?.ruleAssetGroupCodeForTarget&&n===e?.ruleAssetTypeCodeForTarget))}))}))}getLayersCanAssociateWith(e,r,t){return null==this._getFeatureSourceLayerId(e)?[]:r.filter((r=>this.canAssociateFeatureToLayer(e,r,t)))}canAssociateFeatureToLayer(e,r,t){const o=a(r)?r.parent:r;if(!o)return!1;const s=o.layerId,u=a(r)?r.subtypeCode:null,[n,i]=this._getFeatureAssetCodes(e),d=this._getFeatureSourceLayerId(e);return null!=d&&t.some((e=>{const{type:r,direction:t}=e;return this._getRulesForAssociationType(r).some((e=>{const o=this._getRuleFieldValuesForAssociation(e,r,t);return o?.some((e=>d===e?.ruleLayerIdForSource&&n===e?.ruleAssetGroupCodeForSource&&i===e?.ruleAssetTypeCodeForSource&&s===e?.ruleLayerIdForTarget&&(null==u||u===e?.ruleAssetGroupCodeForTarget)))}))}))}getFeatureSQL(e,r){const t=e.layerId.toString(),o=e.fieldsIndex?.normalizeFieldName("assetGroup"),s=e.fieldsIndex?.normalizeFieldName("assetType"),u=o?r.attributes[o]:null,a=s?r.attributes[s]:null,n=this.rulesHash[t];if(n){const e=n.assetGroupHash[u];if(e){return e.assetTypeHash[a]||null}}return null}async _initializeRulesTable(){const e={};let r;!function(e){e[e.from=0]="from",e[e.to=1]="to",e[e.via=2]="via"}(r||(r={}));const t=[{networkSourceId:"fromNetworkSource",assetGroupId:"fromAssetGroup",assetTypeId:"fromAssetType"},{networkSourceId:"toNetworkSource",assetGroupId:"toAssetGroup",assetTypeId:"toAssetType"},{networkSourceId:"viaNetworkSource",assetGroupId:"viaAssetGroup",assetTypeId:"viaAssetType"}];this.rulesCategorized={attachment:[],containment:[],connectivity:[]};for(const o of this.rules){if(o.ruleType===i.RTAttachment){this.rulesCategorized.attachment.push(o);continue}if(o.ruleType===i.RTContainment){this.rulesCategorized.containment.push(o);continue}if(o.ruleType===i.RTJunctionJunctionConnectivity){this.rulesCategorized.connectivity.push(o);continue}this.rulesCategorized.connectivity.push(o);let s=[[r.from,r.to],[r.to,r.from]];o.ruleType===i.RTEdgeJunctionEdgeConnectivity&&(s=[[r.from,r.via],[r.via,r.from],[r.to,r.via],[r.via,r.to]]);for(const u of s){const s=u.shift(),a=u.shift();let n=!1;switch(o.ruleType){case i.RTEdgeJunctionEdgeConnectivity:n=s===r.from||s===r.to;break;case i.RTJunctionEdgeConnectivity:n=s===r.to}const d=t[s],c=o[d.networkSourceId]?.layerId.toString()??"",l=o[d.assetGroupId]?.assetGroupCode?.toString(),p=o[d.assetTypeId],y=p?.assetTypeCode?.toString(),T=t[a],C=o[T.networkSourceId]?.layerId.toString()??"",A=o[T.assetGroupId]?.assetGroupCode?.toString(),F=o[T.assetTypeId],g=F?.assetTypeCode?.toString(),m=e[c]??{assetGroupHash:{}};if(!(l&&y&&A&&g))continue;const S=m.assetGroupHash[l]??{assetTypeHash:{}},f=S.assetTypeHash[y]??{};if(f[C]=f[C]??{},n){f[c]=f[c]??{};const e=`(assetgroup = ${l} AND assettype = ${y})`;"esriNECPEndVertex"===F?.connectivityPolicy?f[c].endVertex=f[c]?.endVertex?`${f[c].endVertex}`:`${e}`:f[c].anyVertex=f[c].anyVertex?`${f[c].anyVertex}`:`${e}`}const G=`(assetgroup = ${A} AND assettype = ${g})`;"esriNECPEndVertex"===F?.connectivityPolicy?f[C].endVertex=f[C]?.endVertex?`${f[C].endVertex} OR ${G}`:`${G}`:f[C].anyVertex=f[C]?.anyVertex?`${f[C].anyVertex} OR ${G}`:`${G}`,S.assetTypeHash[y]=f,m.assetGroupHash[l]=S,e[c]=m}}this._set("rulesHash",e)}_getRuleFieldValuesForAssociation(e,r,t="from"){switch(r){case"attachment":case"containment":return"from"===t?[{ruleLayerIdForSource:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.fromAssetType?.assetTypeCode,ruleLayerIdForTarget:e.toNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.toAssetType?.assetTypeCode}]:[{ruleLayerIdForSource:e.toNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.toAssetType?.assetTypeCode,ruleLayerIdForTarget:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.fromAssetType?.assetTypeCode}];case"connectivity":case"junction-junction-connectivity":return[{ruleLayerIdForSource:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.fromAssetType?.assetTypeCode,ruleLayerIdForTarget:e.toNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.toAssetType?.assetTypeCode},{ruleLayerIdForSource:e.toNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.toAssetType?.assetTypeCode,ruleLayerIdForTarget:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.fromAssetType?.assetTypeCode}];case"junction-edge-from-connectivity":case"junction-edge-midspan-connectivity":case"junction-edge-to-connectivity":return e.ruleType===i.RTEdgeJunctionEdgeConnectivity?[{ruleLayerIdForSource:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.fromAssetType?.assetTypeCode,ruleLayerIdForTarget:e.viaNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.viaAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.viaAssetType?.assetTypeCode},{ruleLayerIdForSource:e.viaNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.viaAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.viaAssetType?.assetTypeCode,ruleLayerIdForTarget:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.fromAssetType?.assetTypeCode},{ruleLayerIdForSource:e.toNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.toAssetType?.assetTypeCode,ruleLayerIdForTarget:e.viaNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.viaAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.viaAssetType?.assetTypeCode},{ruleLayerIdForSource:e.viaNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.viaAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.viaAssetType?.assetTypeCode,ruleLayerIdForTarget:e.toNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.toAssetType?.assetTypeCode}]:[{ruleLayerIdForSource:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.fromAssetType?.assetTypeCode,ruleLayerIdForTarget:e.toNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.toAssetType?.assetTypeCode},{ruleLayerIdForSource:e.toNetworkSource?.layerId,ruleAssetGroupCodeForSource:e.toAssetGroup?.assetGroupCode,ruleAssetTypeCodeForSource:e.toAssetType?.assetTypeCode,ruleLayerIdForTarget:e.fromNetworkSource?.layerId,ruleAssetGroupCodeForTarget:e.fromAssetGroup?.assetGroupCode,ruleAssetTypeCodeForTarget:e.fromAssetType?.assetTypeCode}];default:return[]}}_getWhereClauseForCompatibleFeatures(e,r,t){const o=new Map,[s,u]=this._getAssetFieldNames(e.sourceLayer),[n,i]=this._getFeatureAssetCodes(e),d=this._getFeatureSourceLayerId(e),c=a(r)?r.parent:r,l=a(r)?r.subtypeCode:null;t.forEach((e=>{const{type:r,direction:t}=e;this._getRulesForAssociationType(r).forEach((e=>{this._getRuleFieldValuesForAssociation(e,r,t).forEach((e=>{if(null!=e.ruleAssetGroupCodeForTarget&&null!=e.ruleAssetTypeCodeForTarget&&d===e?.ruleLayerIdForSource&&n===e?.ruleAssetGroupCodeForSource&&i===e?.ruleAssetTypeCodeForSource&&c.layerId===e?.ruleLayerIdForTarget&&(null==l||l===e?.ruleAssetGroupCodeForTarget)){const r=o.get(e.ruleAssetGroupCodeForTarget)??new Set;r.add(e.ruleAssetTypeCodeForTarget),o.set(e.ruleAssetGroupCodeForTarget,r)}}))}))}));let p=[];return this._mergeAssetCodes(o).forEach(((e,r)=>p.push(`${s} IN (${r}) AND ${u} IN (${Array.from(e).sort().join(", ")})`))),p.length>1&&(p=p.map((e=>`(${e})`))),p.join(" OR ")}_getRulesForAssociationType(e){const{rulesCategorized:r}=this;switch(e){case"attachment":return r.attachment;case"containment":return r.containment;case"connectivity":case"junction-junction-connectivity":return r.connectivity.filter((e=>e.ruleType===i.RTJunctionJunctionConnectivity));case"junction-edge-from-connectivity":case"junction-edge-midspan-connectivity":case"junction-edge-to-connectivity":return r.connectivity.filter((e=>e.ruleType===i.RTJunctionEdgeConnectivity||e.ruleType===i.RTEdgeJunctionEdgeConnectivity));default:return[]}}_getFeatureSourceLayerId(e){const{sourceLayer:r}=e;let t;return n(r)?t=r.layerId:a(r)&&(t=r.parent?.layerId),t??null}_getAssetFieldNames(e){if(!e||!("fieldsIndex"in e))return[null,null];return[e.fieldsIndex.normalizeFieldName("assetGroup")??null,e.fieldsIndex.normalizeFieldName("assetType")??null]}_getFeatureAssetCodes(e){const[r,t]=this._getAssetFieldNames(e.sourceLayer);return[r?e.attributes[r]:null,t?e.attributes[t]:null]}_areSetsEqual(e,r){if(e.size!==r.size)return!1;for(const t of e)if(!r.has(t))return!1;return!0}_mergeAssetCodes(e){const r=new Map,t=new Set;for(const[o,s]of e){const u=new Set([o]);for(const[r,n]of e)o!==r&&!t.has(r)&&this._areSetsEqual(s,n)&&(u.add(r),t.add(r));const a=Array.from(u).sort().join(", ");r.set(a,s)}return r}};e([s({constructOnly:!0})],d.prototype,"rulesLayer",void 0),e([s({constructOnly:!0})],d.prototype,"rules",void 0),e([s({readOnly:!0})],d.prototype,"rulesHash",void 0),e([s()],d.prototype,"rulesCategorized",void 0),e([s({constructOnly:!0})],d.prototype,"request",void 0),d=e([u("esri.networks.RulesTable")],d);const c=d;export{c 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.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.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 s}from"../core/accessorSupport/decorators/subclass.js";import o from"../layers/FeatureLayer.js";import{queryAllJSON as a}from"../layers/support/featureQueryAll.js";import i from"./Network.js";import n from"./RulesTable.js";import l from"./support/NamedTraceConfiguration.js";import u from"./support/NetworkSystemLayers.js";import d from"./support/TerminalConfiguration.js";import m from"./support/TraceJobInfo.js";import{AssociationTypeEnum as c,RuleType as p}from"./support/typeUtils.js";import y from"../rest/support/Query.js";let f=class extends i{constructor(e){super(e),this.sharedNamedTraceConfigurations=[],this.type="utility",this._terminalById=new Map}get serviceTerritoryFeatureLayerId(){return this.dataElement?.serviceTerritoryFeatureLayerId??null}get networkSystemLayers(){return new u({rulesTableId:this.sourceJSON?.systemLayers.rulesTableId,rulesTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.rulesTableId}`:null,subnetworksTableId:this.sourceJSON?.systemLayers.subnetworksTableId,subnetworksTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.subnetworksTableId}`:null,dirtyAreasLayerId:this.sourceJSON?.systemLayers.dirtyAreasLayerId,dirtyAreasLayerUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.dirtyAreasLayerId}`:null,associationsTableId:this.sourceJSON?.systemLayers.associationsTableId,associationsTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.associationsTableId}`:null})}get terminalConfigurations(){return this.dataElement?.terminalConfigurations.map((e=>d.fromJSON(e)))||[]}get domainNetworkNames(){return this.dataElement?.domainNetworks.map((e=>e.domainNetworkName))||[]}get _utilityLayerList(){const e=new Set;return this.dataElement?.domainNetworks?.map((t=>{t?.edgeSources?.map((({layerId:t,sourceId:r})=>{this._layerIdBySourceId.set(r,t),this._sourceIdByLayerId.set(t,r),e.add(t)})),t?.junctionSources?.map((({layerId:t,sourceId:r})=>{this._layerIdBySourceId.set(r,t),this._sourceIdByLayerId.set(t,r),e.add(t)}))})),e}async load(e){return this.addResolvingPromise(super.load(e)),this.addResolvingPromise(this._loadNamedTraceConfigurationsFromNetwork(e)),this}getTerminalConfiguration(e){let t=null,r=null;const s=e.layer;let o=null;if("feature"===s?.type){if(o=s.layerId,null===o)return null}else{if("subtype-sublayer"!==s?.type)return null;if(o=s?.parent?.layerId??null,null===o)return null}const a=e.attributes;if(null==a)return null;for(const l of Object.keys(a))"ASSETGROUP"===l.toUpperCase()&&(t=e.getAttribute(l)),"ASSETTYPE"===l.toUpperCase()&&(r=e.getAttribute(l));if(!this.dataElement)return null;let i=null;const n=this.dataElement.domainNetworks;for(const l of n){const e=l.junctionSources?.find((e=>e.layerId===o));if(e){const s=e.assetGroups?.find((e=>e.assetGroupCode===t));if(s){const e=s.assetTypes?.find((e=>e.assetTypeCode===r));if(e?.isTerminalConfigurationSupported){i=e.terminalConfigurationId;break}}}}if(null!=i){const e=this.dataElement.terminalConfigurations,t=e?.find((e=>e.terminalConfigurationId===i));return t?d.fromJSON(t):null}return null}getTierNames(e){const t=this.dataElement?.domainNetworks.find((t=>t.domainNetworkName===e));return t?.tiers.map((e=>e.name))||[]}async getRulesTable(){return this._sharedRulesTable||(this._sharedRulesTable=this._createRulesTable()),await this._sharedRulesTable}getTerminalById(e){if(!this.dataElement||null==e)return null;const t=this._terminalById.get(e);return null!=t?t:(this.terminalConfigurations.forEach((e=>{e.terminals.forEach((e=>{this._terminalById.set(e.id,e)}))})),this._terminalById.get(e))}isUtilityLayer(e){return"layerId"in e?this._utilityLayerList.has(e?.layerId)&&(e.url?.startsWith(this.featureServiceUrl)??!1):!("subtype-sublayer"!==e.type||!e.parent)&&(this._utilityLayerList.has(e.parent.layerId)&&(e.parent.url?.startsWith(this.featureServiceUrl)??!1))}async queryAssociations(e,t){const[{queryAssociations:r},{default:s}]=await Promise.all([import("../rest/networks/queryAssociations.js"),import("../rest/networks/support/QueryAssociationsParameters.js")]),o=s.from(e);o.gdbVersion=this.gdbVersion,o.moment=this.historicMoment;return(await r(this.networkServiceUrl,o,t)).associations}async synthesizeAssociationGeometries(e){const[{synthesizeAssociationGeometries:t},{default:r}]=await Promise.all([import("../rest/networks/synthesizeAssociationGeometries.js"),import("../rest/networks/support/SynthesizeAssociationGeometriesParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async trace(e){const[{trace:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async submitTraceJob(e){const[{submitTraceJob:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment;const o=await t(this.networkServiceUrl,s);return new m({statusUrl:o})}async canAddAssociation(e){const t=await this.getRulesTable();if(!t)return!1;await t.load();const r=(e,t)=>e?1===e.terminalId?!t?.terminalId||t?.terminalId===e.terminalId:e.terminalId===t?.terminalId:!t?.terminalId,s=(e,t)=>e.fromNetworkSource?.sourceId===t.fromNetworkElement?.networkSourceId&&e.toNetworkSource?.sourceId===t.toNetworkElement?.networkSourceId&&e.fromAssetGroup?.assetGroupCode===t.fromNetworkElement?.assetGroupCode&&e.fromAssetType?.assetTypeCode===t.fromNetworkElement?.assetTypeCode&&e.toAssetGroup?.assetGroupCode===t.toNetworkElement?.assetGroupCode&&e.toAssetType?.assetTypeCode===t.toNetworkElement?.assetTypeCode&&r(e.fromTerminal,t.fromNetworkElement)&&r(e.toTerminal,t.toNetworkElement);if("containment"===e.associationType){return t.rulesCategorized.containment.some((t=>s(t,e)))}if("attachment"===e.associationType){return t.rulesCategorized.attachment.some((t=>s(t,e)))}return t.rulesCategorized.connectivity.some((t=>t.viaNetworkSource?t.fromNetworkSource?.sourceId===e.fromNetworkElement?.networkSourceId&&t.viaNetworkSource?.sourceId===e.toNetworkElement?.networkSourceId&&t.fromAssetGroup?.assetGroupCode===e.fromNetworkElement?.assetGroupCode&&t.fromAssetType?.assetTypeCode===e.fromNetworkElement?.assetTypeCode&&t.viaAssetGroup?.assetGroupCode===e.toNetworkElement?.assetGroupCode&&t.viaAssetType?.assetTypeCode===e.toNetworkElement?.assetTypeCode&&r(t.fromTerminal,e.fromNetworkElement)&&r(t.viaTerminal,e.toNetworkElement)||t.viaNetworkSource?.sourceId===e.fromNetworkElement?.networkSourceId&&t.toNetworkSource?.sourceId===e.toNetworkElement?.networkSourceId&&t.viaAssetGroup?.assetGroupCode===e.fromNetworkElement?.assetGroupCode&&t.viaAssetType?.assetTypeCode===e.fromNetworkElement?.assetTypeCode&&t.toAssetGroup?.assetGroupCode===e.toNetworkElement?.assetGroupCode&&t.toAssetType?.assetTypeCode===e.toNetworkElement?.assetTypeCode&&r(t.viaTerminal,e.fromNetworkElement)&&r(t.toTerminal,e.toNetworkElement):s(t,e)))}generateAddAssociations(e){return{addFeatures:e.map((e=>new t({attributes:{fromnetworksourceid:e.fromNetworkElement?.networkSourceId,fromglobalid:e.fromNetworkElement?.globalId,fromterminalid:e.fromNetworkElement?.terminalId,tonetworksourceid:e.toNetworkElement?.networkSourceId,toglobalid:e.toNetworkElement?.globalId,toterminalid:e.toNetworkElement?.terminalId,associationtype:c[e.associationType],iscontentvisible:null==e.isContentVisible?void 0:e.isContentVisible?1:0,percentalong:e.percentAlong,globalid:e.globalId}}))),id:this.networkSystemLayers.associationsTableId,identifierFields:{globalIdField:"globalid",objectIdField:"objectid"}}}generateDeleteAssociations(e){return{deleteFeatures:e.map((e=>({globalId:e.globalId}))),id:this.networkSystemLayers.associationsTableId,identifierFields:{globalIdField:"globalid",objectIdField:"objectid"}}}async _loadNamedTraceConfigurationsFromNetwork(e){if(0===this.sharedNamedTraceConfigurations?.length)return;const t=this.sharedNamedTraceConfigurations.map((e=>e.globalId)),r=await this.queryNamedTraceConfigurations({globalIds:t},e);for(const s of this.sharedNamedTraceConfigurations){const e=r?.find((e=>e.globalId===s.globalId));if(e){const t=e.write({},{origin:"service"});s.read(t,{origin:"service"})}}}async _createRulesTable(){const e=this.networkSystemLayers.rulesTableUrl,t=new o({url:e});await t.load();const r=this.dataElement?.domainNetworks;if(!r)return null;const s=r.flatMap((e=>[...e.edgeSources||[],...e.junctionSources||[]])),a=(await w(t)).map((e=>this._hydrateRuleInfo(t,s,e)));return new n({rulesLayer:t,rules:a})}_hydrateRuleInfo(e,t,r){const s=e.fieldsIndex,o=s.get("RULETYPE"),a=s.get("CREATIONDATE"),i=s.get("FROMNETWORKSOURCEID"),n=s.get("FROMASSETGROUP"),l=s.get("FROMASSETTYPE"),u=s.get("FROMTERMINALID"),d=s.get("TONETWORKSOURCEID"),m=s.get("TOASSETGROUP"),c=s.get("TOASSETTYPE"),y=s.get("TOTERMINALID"),f=s.get("VIANETWORKSOURCEID"),w=s.get("VIAASSETGROUP"),I=s.get("VIAASSETTYPE"),T=s.get("VIATERMINALID"),h=r.attributes[o.name],g=new Date(r.attributes[a.name]),k=[{networkSourceId:r.attributes[i.name],assetGroupId:r.attributes[n.name],assetTypeId:r.attributes[l.name],terminalId:r.attributes[u.name]},{networkSourceId:r.attributes[d.name],assetGroupId:r.attributes[m.name],assetTypeId:r.attributes[c.name],terminalId:r.attributes[y.name]},{networkSourceId:r.attributes[f.name],assetGroupId:r.attributes[w.name],assetTypeId:r.attributes[I.name],terminalId:r.attributes[T.name]}];let b;!function(e){e[e.from=0]="from",e[e.to=1]="to",e[e.via=2]="via"}(b||(b={}));const N={ruleType:h,creationDate:g};for(const S of[b.from,b.to,b.via]){if(h!==p.RTEdgeJunctionEdgeConnectivity&&S===b.via)continue;const e=k[S],r=t.find((t=>t.sourceId===e.networkSourceId)),s=r?.assetGroups.find((t=>t.assetGroupCode===e.assetGroupId)),o=s?.assetTypes.find((t=>t.assetTypeCode===e.assetTypeId)),a=this._getTerminal(o,e);let i="";switch(S){case b.from:i="from";break;case b.to:i="to";break;case b.via:i="via"}N[`${i}NetworkSource`]=r,N[`${i}AssetGroup`]=s,N[`${i}AssetType`]=o,N[`${i}Terminal`]=a?.toJSON()}return N}_getTerminal(e,t){const r=e?.terminalConfigurationId,s=this.terminalConfigurations?.find((e=>e.id===r));return s?.terminals?.find((e=>e.id===t.terminalId))??null}};async function w(e){const t=new y({where:"1=1",outFields:["*"]});return(await a(e,t)).features}e([r({type:[l],json:{origins:{"web-map":{read:{source:"traceConfigurations"},write:{target:"traceConfigurations"}},service:{read:{source:"traceConfigurations"}}},read:!1}})],f.prototype,"sharedNamedTraceConfigurations",void 0),e([r({type:["utility"],readOnly:!0,json:{read:!1,write:!1}})],f.prototype,"type",void 0),e([r({readOnly:!0})],f.prototype,"serviceTerritoryFeatureLayerId",null),e([r({readOnly:!0})],f.prototype,"networkSystemLayers",null),e([r({readOnly:!0})],f.prototype,"terminalConfigurations",null),e([r({readOnly:!0})],f.prototype,"domainNetworkNames",null),f=e([s("esri.networks.UtilityNetwork")],f);const I=f;export{I as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.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 s}from"../core/accessorSupport/decorators/subclass.js";import o from"../layers/FeatureLayer.js";import{queryAllJSON as a}from"../layers/support/featureQueryAll.js";import i from"./Network.js";import n from"./RulesTable.js";import l from"./support/NamedTraceConfiguration.js";import u from"./support/NetworkSystemLayers.js";import m from"./support/TerminalConfiguration.js";import d from"./support/TraceJobInfo.js";import{RuleType as c,AssociationTypeEnum as y}from"./support/typeUtils.js";import p from"../rest/support/Query.js";let f=class extends i{constructor(e){super(e),this.sharedNamedTraceConfigurations=[],this.type="utility",this._terminalById=new Map}get serviceTerritoryFeatureLayerId(){return this.dataElement?.serviceTerritoryFeatureLayerId??null}get networkSystemLayers(){return new u({rulesTableId:this.sourceJSON?.systemLayers.rulesTableId,rulesTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.rulesTableId}`:null,subnetworksTableId:this.sourceJSON?.systemLayers.subnetworksTableId,subnetworksTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.subnetworksTableId}`:null,dirtyAreasLayerId:this.sourceJSON?.systemLayers.dirtyAreasLayerId,dirtyAreasLayerUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.dirtyAreasLayerId}`:null,associationsTableId:this.sourceJSON?.systemLayers.associationsTableId,associationsTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.associationsTableId}`:null})}get terminalConfigurations(){return this.dataElement?.terminalConfigurations.map((e=>m.fromJSON(e)))||[]}get domainNetworkNames(){return this.dataElement?.domainNetworks.map((e=>e.domainNetworkName))||[]}get _utilityLayerList(){const e=new Set;return this.dataElement?.domainNetworks?.map((t=>{t?.edgeSources?.map((({layerId:t,sourceId:r})=>{this._layerIdBySourceId.set(r,t),this._sourceIdByLayerId.set(t,r),e.add(t)})),t?.junctionSources?.map((({layerId:t,sourceId:r})=>{this._layerIdBySourceId.set(r,t),this._sourceIdByLayerId.set(t,r),e.add(t)}))})),e}async load(e){return this.addResolvingPromise(super.load(e)),this.addResolvingPromise(this._loadNamedTraceConfigurationsFromNetwork(e)),this}getTerminalConfiguration(e){let t=null,r=null;const s=e.layer;let o=null;if("feature"===s?.type){if(o=s.layerId,null===o)return null}else{if("subtype-sublayer"!==s?.type)return null;if(o=s?.parent?.layerId??null,null===o)return null}const a=e.attributes;if(null==a)return null;for(const l of Object.keys(a))"ASSETGROUP"===l.toUpperCase()&&(t=e.getAttribute(l)),"ASSETTYPE"===l.toUpperCase()&&(r=e.getAttribute(l));if(!this.dataElement)return null;let i=null;const n=this.dataElement.domainNetworks;for(const l of n){const e=l.junctionSources?.find((e=>e.layerId===o));if(e){const s=e.assetGroups?.find((e=>e.assetGroupCode===t));if(s){const e=s.assetTypes?.find((e=>e.assetTypeCode===r));if(e?.isTerminalConfigurationSupported){i=e.terminalConfigurationId;break}}}}if(null!=i){const e=this.dataElement.terminalConfigurations,t=e?.find((e=>e.terminalConfigurationId===i));return t?m.fromJSON(t):null}return null}getTierNames(e){const t=this.dataElement?.domainNetworks.find((t=>t.domainNetworkName===e));return t?.tiers.map((e=>e.name))||[]}async getRulesTable(){return this._sharedRulesTable||(this._sharedRulesTable=this._createRulesTable()),await this._sharedRulesTable}getTerminalById(e){if(!this.dataElement||null==e)return null;const t=this._terminalById.get(e);return null!=t?t:(this.terminalConfigurations.forEach((e=>{e.terminals.forEach((e=>{this._terminalById.set(e.id,e)}))})),this._terminalById.get(e))}isUtilityLayer(e){return"layerId"in e?this._utilityLayerList.has(e?.layerId)&&(e.url?.startsWith(this.featureServiceUrl)??!1):!("subtype-sublayer"!==e.type||!e.parent)&&(this._utilityLayerList.has(e.parent.layerId)&&(e.parent.url?.startsWith(this.featureServiceUrl)??!1))}async queryAssociations(e,t){const[{queryAssociations:r},{default:s}]=await Promise.all([import("../rest/networks/queryAssociations.js"),import("../rest/networks/support/QueryAssociationsParameters.js")]),o=s.from(e);o.gdbVersion=this.gdbVersion,o.moment=this.historicMoment;return(await r(this.networkServiceUrl,o,t)).associations}async synthesizeAssociationGeometries(e){const[{synthesizeAssociationGeometries:t},{default:r}]=await Promise.all([import("../rest/networks/synthesizeAssociationGeometries.js"),import("../rest/networks/support/SynthesizeAssociationGeometriesParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async trace(e){const[{trace:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async submitTraceJob(e){const[{submitTraceJob:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment;const o=await t(this.networkServiceUrl,s);return new d({statusUrl:o})}async canAddAssociation(e){const t=await this.getRulesTable();if(!t)return!1;await t.load();const r=(e,t)=>e?1===e.terminalId?!t?.terminalId||t?.terminalId===e.terminalId:e.terminalId===t?.terminalId:!t?.terminalId,s=e=>({fromRuleElement:{networkSource:e.fromNetworkSource,assetGroup:e.fromAssetGroup,assetType:e.fromAssetType,terminal:e.fromTerminal},viaRuleElement:e.viaNetworkSource?{networkSource:e.viaNetworkSource,assetGroup:e.viaAssetGroup,assetType:e.viaAssetType,terminal:e.viaTerminal}:void 0,toRuleElement:{networkSource:e.toNetworkSource,assetGroup:e.toAssetGroup,assetType:e.toAssetType,terminal:e.toTerminal}}),o=(e,t,s=!0)=>e.networkSource?.sourceId===t.networkSourceId&&e.assetGroup?.assetGroupCode===t.assetGroupCode&&e.assetType?.assetTypeCode===t.assetTypeCode&&(!s||r(e.terminal,t)),a=(e,t)=>{const{fromRuleElement:r,toRuleElement:a}=s(e);return o(r,t.fromNetworkElement,!1)&&o(a,t.toNetworkElement,!1)},i=(e,t)=>{const{fromRuleElement:r,toRuleElement:a}=s(e);return o(r,t.fromNetworkElement)&&o(a,t.toNetworkElement)||o(r,t.toNetworkElement)&&o(a,t.fromNetworkElement)},n=(e,t)=>{const{fromRuleElement:r,toRuleElement:a,viaRuleElement:i}=s(e);return o(r,t.fromNetworkElement)&&o(i,t.toNetworkElement)||o(r,t.toNetworkElement)&&o(i,t.fromNetworkElement)||o(i,t.fromNetworkElement)&&o(a,t.toNetworkElement)||o(i,t.toNetworkElement)&&o(a,t.fromNetworkElement)};if("containment"===e.associationType){return t.rulesCategorized.containment.some((t=>a(t,e)))}if("attachment"===e.associationType){return t.rulesCategorized.attachment.some((t=>a(t,e)))}return t.rulesCategorized.connectivity.some((t=>t.ruleType===c.RTEdgeJunctionEdgeConnectivity?n(t,e):i(t,e)))}generateAddAssociations(e){return{addFeatures:e.map((e=>new t({attributes:{fromnetworksourceid:e.fromNetworkElement?.networkSourceId,fromglobalid:e.fromNetworkElement?.globalId,fromterminalid:e.fromNetworkElement?.terminalId,tonetworksourceid:e.toNetworkElement?.networkSourceId,toglobalid:e.toNetworkElement?.globalId,toterminalid:e.toNetworkElement?.terminalId,associationtype:y[e.associationType],iscontentvisible:null==e.isContentVisible?void 0:e.isContentVisible?1:0,percentalong:e.percentAlong,globalid:e.globalId}}))),id:this.networkSystemLayers.associationsTableId,identifierFields:{globalIdField:"globalid",objectIdField:"objectid"}}}generateDeleteAssociations(e){return{deleteFeatures:e.map((e=>({globalId:e.globalId}))),id:this.networkSystemLayers.associationsTableId,identifierFields:{globalIdField:"globalid",objectIdField:"objectid"}}}async _loadNamedTraceConfigurationsFromNetwork(e){if(0===this.sharedNamedTraceConfigurations?.length)return;const t=this.sharedNamedTraceConfigurations.map((e=>e.globalId)),r=await this.queryNamedTraceConfigurations({globalIds:t},e);for(const s of this.sharedNamedTraceConfigurations){const e=r?.find((e=>e.globalId===s.globalId));if(e){const t=e.write({},{origin:"service"});s.read(t,{origin:"service"})}}}async _createRulesTable(){const e=this.networkSystemLayers.rulesTableUrl,t=new o({url:e});await t.load();const r=this.dataElement?.domainNetworks;if(!r)return null;const s=r.flatMap((e=>[...e.edgeSources||[],...e.junctionSources||[]])),a=(await h(t)).map((e=>this._hydrateRuleInfo(t,s,e)));return new n({rulesLayer:t,rules:a})}_hydrateRuleInfo(e,t,r){const s=e.fieldsIndex,o=s.get("RULETYPE"),a=s.get("CREATIONDATE"),i=s.get("FROMNETWORKSOURCEID"),n=s.get("FROMASSETGROUP"),l=s.get("FROMASSETTYPE"),u=s.get("FROMTERMINALID"),m=s.get("TONETWORKSOURCEID"),d=s.get("TOASSETGROUP"),y=s.get("TOASSETTYPE"),p=s.get("TOTERMINALID"),f=s.get("VIANETWORKSOURCEID"),h=s.get("VIAASSETGROUP"),I=s.get("VIAASSETTYPE"),w=s.get("VIATERMINALID"),T=r.attributes[o.name],g=new Date(r.attributes[a.name]),b=[{networkSourceId:r.attributes[i.name],assetGroupId:r.attributes[n.name],assetTypeId:r.attributes[l.name],terminalId:r.attributes[u.name]},{networkSourceId:r.attributes[m.name],assetGroupId:r.attributes[d.name],assetTypeId:r.attributes[y.name],terminalId:r.attributes[p.name]},{networkSourceId:r.attributes[f.name],assetGroupId:r.attributes[h.name],assetTypeId:r.attributes[I.name],terminalId:r.attributes[w.name]}];let k;!function(e){e[e.from=0]="from",e[e.to=1]="to",e[e.via=2]="via"}(k||(k={}));const S={ruleType:T,creationDate:g};for(const N of[k.from,k.to,k.via]){if(T!==c.RTEdgeJunctionEdgeConnectivity&&N===k.via)continue;const e=b[N],r=t.find((t=>t.sourceId===e.networkSourceId)),s=r?.assetGroups.find((t=>t.assetGroupCode===e.assetGroupId)),o=s?.assetTypes.find((t=>t.assetTypeCode===e.assetTypeId)),a=this._getTerminal(o,e);let i="";switch(N){case k.from:i="from";break;case k.to:i="to";break;case k.via:i="via"}S[`${i}NetworkSource`]=r,S[`${i}AssetGroup`]=s,S[`${i}AssetType`]=o,S[`${i}Terminal`]=a?.toJSON()}return S}_getTerminal(e,t){const r=e?.terminalConfigurationId,s=this.terminalConfigurations?.find((e=>e.id===r));return s?.terminals?.find((e=>e.id===t.terminalId))??null}};async function h(e){const t=new p({where:"1=1",outFields:["*"]});return(await a(e,t)).features}e([r({type:[l],json:{origins:{"web-map":{read:{source:"traceConfigurations"},write:{target:"traceConfigurations"}},service:{read:{source:"traceConfigurations"}}},read:!1}})],f.prototype,"sharedNamedTraceConfigurations",void 0),e([r({type:["utility"],readOnly:!0,json:{read:!1,write:!1}})],f.prototype,"type",void 0),e([r({readOnly:!0})],f.prototype,"serviceTerritoryFeatureLayerId",null),e([r({readOnly:!0})],f.prototype,"networkSystemLayers",null),e([r({readOnly:!0})],f.prototype,"terminalConfigurations",null),e([r({readOnly:!0})],f.prototype,"domainNetworkNames",null),f=e([s("esri.networks.UtilityNetwork")],f);const I=f;export{I as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.32.0-next.20250219",
3
+ "version": "4.32.0-next.20250221",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@esri/arcgis-html-sanitizer": "~4.1.0",
29
- "@esri/calcite-components": "^3.0.2",
29
+ "@esri/calcite-components": "^3.0.3",
30
30
  "@vaadin/grid": "~24.6.4",
31
31
  "@zip.js/zip.js": "~2.7.57",
32
32
  "luxon": "~3.5.0",
package/rest/route.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import e from"../request.js";import{get as r}from"../core/accessorSupport/get.js";import{normalizeCentralMeridian as t}from"../geometry/support/normalizeUtils.js";import{collectGeometries as s,isInputGeometryZAware as o,fetchServiceDescription as a,dropZValuesOffInputGeometry as i}from"./networkService.js";import{parseUrl as n}from"./utils.js";import{routeParametersToQueryParameters as u}from"./route/utils.js";import f from"./support/FeatureSet.js";import p from"./support/RouteSolveResult.js";function c(e){return e instanceof f}async function l(f,p,l){const y=[],d=[],g={},h={},R=n(f),{path:v}=R;c(p.stops)&&s(p.stops.features,d,"stops.features",g),c(p.pointBarriers)&&s(p.pointBarriers.features,d,"pointBarriers.features",g),c(p.polylineBarriers)&&s(p.polylineBarriers.features,d,"polylineBarriers.features",g),c(p.polygonBarriers)&&s(p.polygonBarriers.features,d,"polygonBarriers.features",g);const B=await t(d);for(const e in g){const r=g[e];y.push(e),h[e]=B.slice(r[0],r[1])}if(o(h,y)){let e=null;try{e=await a(v,p.apiKey,l)}catch{}e&&!e.hasZ&&i(h,y)}for(const e in h)h[e].forEach(((t,s)=>{r(p,e)[s].geometry=t}));const E={...l,query:{...R.query,...u(p),f:"json"}},T=v.endsWith("/solve")?v:`${v}/solve`,{data:b}=await e(T,E);return m(b)}function m(e){const{barriers:r,directionLines:t,directionPoints:s,directions:o,messages:a,polygonBarriers:i,polylineBarriers:n,routes:u,stops:f,traversedEdges:c,traversedJunctions:l,traversedTurns:m}=e,y=e=>{const r=g.find((r=>r.routeName===e));if(null!=r)return r;const t={routeId:g.length+1,routeName:e};return g.push(t),t},d=e=>{const r=g.find((r=>r.routeId===e));if(null!=r)return r;const t={routeId:e,routeName:null};return g.push(t),t},g=[];u?.features.forEach(((e,r)=>{e.geometry.spatialReference=u.spatialReference??void 0;const t=e.attributes.Name,s=r+1;g.push({routeId:s,routeName:t,route:e})})),o?.forEach((e=>{const{routeName:r}=e;y(r).directions=e}));const h=(f?.features.every((e=>null==e.attributes.RouteName))??!1)&&g.length>0?g[0].routeName:null;return f?.features.forEach((e=>{e.geometry&&(e.geometry.spatialReference??=f.spatialReference??void 0);const r=h??e.attributes.RouteName,t=y(r);t.stops??=[],t.stops.push(e)})),t?.features.forEach((e=>{const r=e.attributes.RouteID,s=d(r),{geometryType:o,spatialReference:a}=t;s.directionLines??={features:[],geometryType:o,spatialReference:a},s.directionLines.features.push(e)})),s?.features.forEach((e=>{const r=e.attributes.RouteID,t=d(r),{geometryType:o,spatialReference:a}=s;t.directionPoints??={features:[],geometryType:o,spatialReference:a},t.directionPoints.features.push(e)})),c?.features.forEach((e=>{const r=e.attributes.RouteID,t=d(r),{geometryType:s,spatialReference:o}=c;t.traversedEdges??={features:[],geometryType:s,spatialReference:o},t.traversedEdges.features.push(e)})),l?.features.forEach((e=>{const r=e.attributes.RouteID,t=d(r),{geometryType:s,spatialReference:o}=l;t.traversedJunctions??={features:[],geometryType:s,spatialReference:o},t.traversedJunctions.features.push(e)})),m?.features.forEach((e=>{const r=e.attributes.RouteID,t=d(r);t.traversedTurns??={features:[]},t.traversedTurns.features.push(e)})),p.fromJSON({routeResults:g,barriers:r,polygonBarriers:i,polylineBarriers:n,messages:a})}export{l as solve};
5
+ import e from"../request.js";import{get as r}from"../core/accessorSupport/get.js";import{normalizeCentralMeridian as t}from"../geometry/support/normalizeUtils.js";import{collectGeometries as s,isInputGeometryZAware as o,fetchServiceDescription as a,dropZValuesOffInputGeometry as u}from"./networkService.js";import{parseUrl as i}from"./utils.js";import{routeParametersToQueryParameters as n}from"./route/utils.js";import c from"./support/FeatureSet.js";import f from"./support/RouteSolveResult.js";function p(e){return e instanceof c}async function l(c,f,l){const y=[],d=[],h={},g={},R=i(c),{path:v}=R;p(f.stops)&&s(f.stops.features,d,"stops.features",h),p(f.pointBarriers)&&s(f.pointBarriers.features,d,"pointBarriers.features",h),p(f.polylineBarriers)&&s(f.polylineBarriers.features,d,"polylineBarriers.features",h),p(f.polygonBarriers)&&s(f.polygonBarriers.features,d,"polygonBarriers.features",h);const B=await t(d);for(const e in h){const r=h[e];y.push(e),g[e]=B.slice(r[0],r[1])}if(o(g,y)){let e=null;try{e=await a(v,f.apiKey,l)}catch{}e&&!e.hasZ&&u(g,y)}for(const e in g)g[e].forEach(((t,s)=>{r(f,e)[s].geometry=t}));const E={...l,query:{...R.query,...n(f),f:"json"}},T=v.endsWith("/solve")?v:`${v}/solve`,{data:b}=await e(T,E);return m(b)}function m(e){const{barriers:r,checksum:t,directionLines:s,directionPoints:o,directions:a,messages:u,polygonBarriers:i,polylineBarriers:n,routes:c,stops:p,traversedEdges:l,traversedJunctions:m,traversedTurns:y}=e,d=e=>{const r=g.find((r=>r.routeName===e));if(null!=r)return r;const t={routeId:g.length+1,routeName:e};return g.push(t),t},h=e=>{const r=g.find((r=>r.routeId===e));if(null!=r)return r;const t={routeId:e,routeName:null};return g.push(t),t},g=[];c?.features.forEach(((e,r)=>{e.geometry.spatialReference=c.spatialReference??void 0;const t=e.attributes.Name,s=r+1;g.push({routeId:s,routeName:t,route:e})})),a?.forEach((e=>{const{routeName:r}=e;d(r).directions=e}));const R=(p?.features.every((e=>null==e.attributes.RouteName))??!1)&&g.length>0?g[0].routeName:null;return p?.features.forEach((e=>{e.geometry&&(e.geometry.spatialReference??=p.spatialReference??void 0);const r=R??e.attributes.RouteName,t=d(r);t.stops??=[],t.stops.push(e)})),s?.features.forEach((e=>{const r=e.attributes.RouteID,t=h(r),{geometryType:o,spatialReference:a}=s;t.directionLines??={features:[],geometryType:o,spatialReference:a},t.directionLines.features.push(e)})),o?.features.forEach((e=>{const r=e.attributes.RouteID,t=h(r),{geometryType:s,spatialReference:a}=o;t.directionPoints??={features:[],geometryType:s,spatialReference:a},t.directionPoints.features.push(e)})),l?.features.forEach((e=>{const r=e.attributes.RouteID,t=h(r),{geometryType:s,spatialReference:o}=l;t.traversedEdges??={features:[],geometryType:s,spatialReference:o},t.traversedEdges.features.push(e)})),m?.features.forEach((e=>{const r=e.attributes.RouteID,t=h(r),{geometryType:s,spatialReference:o}=m;t.traversedJunctions??={features:[],geometryType:s,spatialReference:o},t.traversedJunctions.features.push(e)})),y?.features.forEach((e=>{const r=e.attributes.RouteID,t=h(r);t.traversedTurns??={features:[]},t.traversedTurns.features.push(e)})),f.fromJSON({barriers:r,checksum:t,messages:u,polygonBarriers:i,polylineBarriers:n,routeResults:g})}export{l as solve};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../Graphic.js";import r from"../../PopupTemplate.js";import s from"../../core/Clonable.js";import o from"../../core/JSONSupport.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{reader as a}from"../../core/accessorSupport/decorators/reader.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../../core/accessorSupport/decorators/writer.js";import u from"../../geometry/Point.js";import{getPrefixedProperties as d,setPrefixedProperties as n,toKebabImpedanceAttributes as m,fromKebabImpedanceAttributes as c}from"../route/utils.js";import{barrierTypeJsonMap as y,curbApproachJsonMap as b,fullEdgeJsonMap as h,statusJsonMap as j,sideOfEdgeJsonMap as g}from"./networkEnums.js";import{symbolTypes as f}from"../../symbols/support/typeUtils.js";var C;let S=C=class extends(s.ClonableMixin(o)){constructor(t){super(t),this.addedCost=null,this.barrierType=null,this.costs=null,this.curbApproach=null,this.fullEdge=null,this.geometry=null,this.name=null,this.objectId=null,this.popupTemplate=null,this.sideOfEdge=null,this.sourceId=null,this.sourceOid=null,this.status=null,this.symbol=null,this.type="point-barrier"}readCosts(t,e){return d(e.attributes,"Attr_")}writeCosts(t,e){n(t,e,"Attr_")}static fromGraphic(t){return new C({addedCost:t.attributes.AddedCost??null,barrierType:null!=t.attributes.BarrierType?y.fromJSON(t.attributes.BarrierType):null,costs:null!=t.attributes.Costs?m(JSON.parse(t.attributes.Costs)):null,curbApproach:null!=t.attributes.CurbApproach?b.fromJSON(t.attributes.CurbApproach):null,fullEdge:null!=t.attributes.FullEdge?h.fromJSON(t.attributes.FullEdge):null,geometry:t.geometry,name:t.attributes.Name??null,objectId:t.attributes.ObjectID??t.attributes.__OBJECTID,popupTemplate:t.popupTemplate,status:null!=t.attributes.Status?j.fromJSON(t.attributes.Status):null,symbol:t.symbol})}toGraphic(){const t={ObjectID:this.objectId,AddedCost:this.addedCost,BarrierType:null!=this.barrierType?y.toJSON(this.barrierType):null,Costs:null!=this.costs?JSON.stringify(c(this.costs)):null,CurbApproach:null!=this.curbApproach?b.toJSON(this.curbApproach):null,FullEdge:null!=this.fullEdge?h.toJSON(this.fullEdge):null,Name:this.name,Status:null!=this.status?j.toJSON(this.status):null};return new e({geometry:this.geometry,attributes:t,symbol:this.symbol,popupTemplate:this.popupTemplate})}};S.fields=[{name:"ObjectID",alias:"ObjectID",type:"esriFieldTypeOID"},{name:"AddedCost",alias:"Added Cost",type:"esriFieldTypeDouble"},{name:"BarrierType",alias:"Barrier Type",type:"esriFieldTypeInteger"},{name:"Costs",alias:"Costs",type:"esriFieldTypeString"},{name:"CurbApproach",alias:"Curb Approach",type:"esriFieldTypeInteger"},{name:"FullEdge",alias:"Full Edge",type:"esriFieldTypeInteger"},{name:"Name",alias:"Name",type:"esriFieldTypeString"},{name:"Status",alias:"Status",type:"esriFieldTypeInteger"}],t([p()],S.prototype,"addedCost",void 0),t([p({type:y.apiValues,json:{name:"attributes.BarrierType",read:{reader:y.read},write:{writer:y.write}}})],S.prototype,"barrierType",void 0),t([p()],S.prototype,"costs",void 0),t([a("costs",["attributes"])],S.prototype,"readCosts",null),t([l("costs")],S.prototype,"writeCosts",null),t([p({constructOnly:!0,type:b.apiValues,json:{read:{source:"attributes.CurbApproach",reader:b.read}}})],S.prototype,"curbApproach",void 0),t([p({type:h.apiValues,json:{name:"attributes.FullEdge",read:{reader:h.read},write:{writer:h.write}}})],S.prototype,"fullEdge",void 0),t([p({type:u,json:{write:!0}})],S.prototype,"geometry",void 0),t([p({json:{name:"attributes.Name"}})],S.prototype,"name",void 0),t([p({json:{name:"attributes.ObjectID"}})],S.prototype,"objectId",void 0),t([p({type:r})],S.prototype,"popupTemplate",void 0),t([p({type:g.apiValues,json:{read:{source:"attributes.SideOfEdge",reader:g.read}}})],S.prototype,"sideOfEdge",void 0),t([p({json:{read:{source:"attributes.SourceID"}}})],S.prototype,"sourceId",void 0),t([p({json:{read:{source:"attributes.SourceOID"}}})],S.prototype,"sourceOid",void 0),t([p({type:j.apiValues,json:{read:{source:"attributes.Status",reader:j.read}}})],S.prototype,"status",void 0),t([p({types:f})],S.prototype,"symbol",void 0),t([p({readOnly:!0,json:{read:!1}})],S.prototype,"type",void 0),S=C=t([i("esri.rest.support.PointBarrier")],S);const T=S;export{T as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../Graphic.js";import r from"../../PopupTemplate.js";import s from"../../core/Clonable.js";import o from"../../core/JSONSupport.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{reader as a}from"../../core/accessorSupport/decorators/reader.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../../core/accessorSupport/decorators/writer.js";import u from"../../geometry/Point.js";import{getPrefixedProperties as d,setPrefixedProperties as n,toKebabImpedanceAttributes as m,fromKebabImpedanceAttributes as c}from"../route/utils.js";import{barrierTypeJsonMap as y,curbApproachJsonMap as b,fullEdgeJsonMap as h,statusJsonMap as j,sideOfEdgeJsonMap as g}from"./networkEnums.js";import{symbolTypes as f}from"../../symbols/support/typeUtils.js";var C;let S=C=class extends(s.ClonableMixin(o)){constructor(t){super(t),this.addedCost=null,this.barrierType=null,this.costs=null,this.curbApproach=null,this.fullEdge=null,this.geometry=null,this.name=null,this.objectId=null,this.popupTemplate=null,this.sideOfEdge=null,this.sourceId=null,this.sourceOid=null,this.status=null,this.symbol=null,this.type="point-barrier"}readCosts(t,e){return d(e.attributes,"Attr_")}writeCosts(t,e){n(t,e,"Attr_")}static fromGraphic(t){return new C({addedCost:t.attributes.AddedCost??null,barrierType:null!=t.attributes.BarrierType?y.fromJSON(t.attributes.BarrierType):null,costs:null!=t.attributes.Costs?m(JSON.parse(t.attributes.Costs)):null,curbApproach:null!=t.attributes.CurbApproach?b.fromJSON(t.attributes.CurbApproach):null,fullEdge:null!=t.attributes.FullEdge?h.fromJSON(t.attributes.FullEdge):null,geometry:t.geometry,name:t.attributes.Name??null,objectId:t.attributes.ObjectID??t.attributes.__OBJECTID,popupTemplate:t.popupTemplate,status:null!=t.attributes.Status?j.fromJSON(t.attributes.Status):null,symbol:t.symbol})}toGraphic(){const t={ObjectID:this.objectId,AddedCost:this.addedCost,BarrierType:null!=this.barrierType?y.toJSON(this.barrierType):null,Costs:null!=this.costs?JSON.stringify(c(this.costs)):null,CurbApproach:null!=this.curbApproach?b.toJSON(this.curbApproach):null,FullEdge:null!=this.fullEdge?h.toJSON(this.fullEdge):null,Name:this.name,Status:null!=this.status?j.toJSON(this.status):null};return new e({geometry:this.geometry,attributes:t,symbol:this.symbol,popupTemplate:this.popupTemplate})}};S.fields=[{name:"ObjectID",alias:"ObjectID",type:"esriFieldTypeOID"},{name:"AddedCost",alias:"Added Cost",type:"esriFieldTypeDouble"},{name:"BarrierType",alias:"Barrier Type",type:"esriFieldTypeInteger"},{name:"Costs",alias:"Costs",type:"esriFieldTypeString"},{name:"CurbApproach",alias:"Curb Approach",type:"esriFieldTypeInteger"},{name:"FullEdge",alias:"Full Edge",type:"esriFieldTypeInteger"},{name:"Name",alias:"Name",type:"esriFieldTypeString"},{name:"Status",alias:"Status",type:"esriFieldTypeInteger"}],t([p()],S.prototype,"addedCost",void 0),t([p({type:y.apiValues,json:{name:"attributes.BarrierType",read:{reader:y.read},write:{writer:y.write}}})],S.prototype,"barrierType",void 0),t([p()],S.prototype,"costs",void 0),t([a("costs",["attributes"])],S.prototype,"readCosts",null),t([l("costs")],S.prototype,"writeCosts",null),t([p({type:b.apiValues,json:{read:{source:"attributes.CurbApproach",reader:b.read}}})],S.prototype,"curbApproach",void 0),t([p({type:h.apiValues,json:{name:"attributes.FullEdge",read:{reader:h.read},write:{writer:h.write}}})],S.prototype,"fullEdge",void 0),t([p({type:u,json:{write:!0}})],S.prototype,"geometry",void 0),t([p({json:{name:"attributes.Name"}})],S.prototype,"name",void 0),t([p({json:{name:"attributes.ObjectID"}})],S.prototype,"objectId",void 0),t([p({type:r})],S.prototype,"popupTemplate",void 0),t([p({type:g.apiValues,json:{read:{source:"attributes.SideOfEdge",reader:g.read}}})],S.prototype,"sideOfEdge",void 0),t([p({json:{read:{source:"attributes.SourceID"}}})],S.prototype,"sourceId",void 0),t([p({json:{read:{source:"attributes.SourceOID"}}})],S.prototype,"sourceOid",void 0),t([p({type:j.apiValues,json:{read:{source:"attributes.Status",reader:j.read}}})],S.prototype,"status",void 0),t([p({types:f})],S.prototype,"symbol",void 0),t([p({readOnly:!0,json:{read:!1}})],S.prototype,"type",void 0),S=C=t([i("esri.rest.support.PointBarrier")],S);const T=S;export{T 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.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Clonable.js";import r from"../../core/Collection.js";import o from"../../core/JSONSupport.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import{ensureClass as s}from"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{enumeration as n}from"../../core/accessorSupport/decorators/enumeration.js";import{reader as p}from"../../core/accessorSupport/decorators/reader.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../../core/accessorSupport/decorators/writer.js";import a from"../../geometry/SpatialReference.js";import{apiKey as y}from"./commonProperties.js";import m from"./DataLayer.js";import c from"./FeatureSet.js";import{impedanceAttributeNameJsonMap as d,restrictionAttributeNameJsonMap as v,directionsLengthUnitJsonMap as w,directionsOutputTypeJsonMap as j,directionsStyleNameJsonMap as h,durationImpedanceAttributeNameJsonMap as S,lengthUnitJsonMap as B,outputLineJsonMap as f,restrictUTurnJsonMap as b}from"./networkEnums.js";import T from"./NetworkFeatureSet.js";import g from"./NetworkUrl.js";import A from"./TravelMode.js";var N;let P=N=class extends(e.ClonableMixin(o)){constructor(t){super(t),this.accumulateAttributes=null,this.apiKey=null,this.attributeParameterValues=null,this.directionsLanguage=null,this.directionsLengthUnits=null,this.directionsOutputType=null,this.directionsStyleName=null,this.directionsTimeAttribute=null,this.findBestSequence=null,this.geometryPrecision=null,this.geometryPrecisionM=null,this.geometryPrecisionZ=null,this.ignoreInvalidLocations=null,this.impedanceAttribute=null,this.outputGeometryPrecision=null,this.outputGeometryPrecisionUnits=null,this.outputLines="true-shape",this.outSpatialReference=null,this.overrides=null,this.pointBarriers=null,this.polygonBarriers=null,this.polylineBarriers=null,this.preserveFirstStop=null,this.preserveLastStop=null,this.preserveObjectID=null,this.restrictionAttributes=null,this.restrictUTurns=null,this.returnBarriers=!1,this.returnDirections=!1,this.returnPolygonBarriers=!1,this.returnPolylineBarriers=!1,this.returnRoutes=!0,this.returnStops=!1,this.returnTraversedEdges=null,this.returnTraversedJunctions=null,this.returnTraversedTurns=null,this.returnZ=!0,this.startTime=null,this.startTimeIsUTC=!0,this.stops=null,this.timeWindowsAreUTC=null,this.travelMode=null,this.useHierarchy=null,this.useTimeWindows=null}static from(t){return s(N,t)}readAccumulateAttributes(t){return null==t?null:t.map((t=>d.fromJSON(t)))}writeAccumulateAttributes(t,e,r){t?.length&&(e[r]=t.map((t=>d.toJSON(t))))}writePointBarriers(t,e,r){k(t,e,r)}writePolygonBarrier(t,e,r){k(t,e,r)}writePolylineBarrier(t,e,r){k(t,e,r)}readRestrictionAttributes(t){return null==t?null:t.map((t=>v.fromJSON(t)))}writeRestrictionAttributes(t,e,r){t?.length&&(e[r]=t.map((t=>v.toJSON(t))))}readStartTime(t,e){const{startTime:r}=e;return null==r?null:"now"===r?"now":new Date(r)}writeStartTime(t,e){null!=t&&(e.startTime="now"===t?"now":t.getTime())}readStops(t,e){return C(e.stops)}writeStops(t,e,r){k(t,e,r)}};t([i({type:[String],json:{name:"accumulateAttributeNames",write:!0}})],P.prototype,"accumulateAttributes",void 0),t([p("accumulateAttributes")],P.prototype,"readAccumulateAttributes",null),t([l("accumulateAttributes")],P.prototype,"writeAccumulateAttributes",null),t([i(y)],P.prototype,"apiKey",void 0),t([i({json:{write:!0}})],P.prototype,"attributeParameterValues",void 0),t([i({type:String,json:{write:!0}})],P.prototype,"directionsLanguage",void 0),t([n(w)],P.prototype,"directionsLengthUnits",void 0),t([n(j)],P.prototype,"directionsOutputType",void 0),t([n(h)],P.prototype,"directionsStyleName",void 0),t([n(S,{name:"directionsTimeAttributeName",ignoreUnknown:!1})],P.prototype,"directionsTimeAttribute",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"findBestSequence",void 0),t([i({type:Number,json:{write:!0}})],P.prototype,"geometryPrecision",void 0),t([i({type:Number,json:{write:!0}})],P.prototype,"geometryPrecisionM",void 0),t([i({type:Number,json:{write:!0}})],P.prototype,"geometryPrecisionZ",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"ignoreInvalidLocations",void 0),t([n(d,{name:"impedanceAttributeName",ignoreUnknown:!1})],P.prototype,"impedanceAttribute",void 0),t([i({type:Number,json:{write:!0}})],P.prototype,"outputGeometryPrecision",void 0),t([n(B)],P.prototype,"outputGeometryPrecisionUnits",void 0),t([n(f)],P.prototype,"outputLines",void 0),t([i({type:a,json:{name:"outSR",write:!0}})],P.prototype,"outSpatialReference",void 0),t([i({json:{write:!0}})],P.prototype,"overrides",void 0),t([i({json:{name:"barriers",write:!0}})],P.prototype,"pointBarriers",void 0),t([l("pointBarriers")],P.prototype,"writePointBarriers",null),t([i({json:{write:!0}})],P.prototype,"polygonBarriers",void 0),t([l("polygonBarriers")],P.prototype,"writePolygonBarrier",null),t([i({json:{write:!0}})],P.prototype,"polylineBarriers",void 0),t([l("polylineBarriers")],P.prototype,"writePolylineBarrier",null),t([i({type:Boolean,json:{write:!0}})],P.prototype,"preserveFirstStop",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"preserveLastStop",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"preserveObjectID",void 0),t([i({type:[String],json:{name:"restrictionAttributeNames",write:!0}})],P.prototype,"restrictionAttributes",void 0),t([p("restrictionAttributes")],P.prototype,"readRestrictionAttributes",null),t([l("restrictionAttributes")],P.prototype,"writeRestrictionAttributes",null),t([n(b)],P.prototype,"restrictUTurns",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnBarriers",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnDirections",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnPolygonBarriers",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnPolylineBarriers",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnRoutes",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnStops",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnTraversedEdges",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnTraversedJunctions",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnTraversedTurns",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnZ",void 0),t([i({json:{write:!0}})],P.prototype,"startTime",void 0),t([p("startTime")],P.prototype,"readStartTime",null),t([l("startTime")],P.prototype,"writeStartTime",null),t([i({type:Boolean,json:{write:!0}})],P.prototype,"startTimeIsUTC",void 0),t([i({json:{write:!0}})],P.prototype,"stops",void 0),t([p("stops")],P.prototype,"readStops",null),t([l("stops")],P.prototype,"writeStops",null),t([i({type:Boolean,json:{write:!0}})],P.prototype,"timeWindowsAreUTC",void 0),t([i({type:A,json:{write:!0}})],P.prototype,"travelMode",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"useHierarchy",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"useTimeWindows",void 0),P=N=t([u("esri.rest.support.RouteParameters")],P);const O=P;function J(t){return t&&"type"in t}function L(t){return t&&"features"in t&&"doNotLocateOnRestrictedElements"in t}function R(t){return t&&"url"in t}function U(t){return t&&"features"in t}function C(t){return J(t)?m.fromJSON(t):R(t)?g.fromJSON(t):L(t)?T.fromJSON(t):U(t)?c.fromJSON(t):null}function k(t,e,o){null!=t&&(e[o]=r.isCollection(t)?{features:t.toArray().map((t=>t.toJSON()))}:t.toJSON())}export{O as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Clonable.js";import r from"../../core/Collection.js";import o from"../../core/JSONSupport.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import{ensureClass as s}from"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{enumeration as n}from"../../core/accessorSupport/decorators/enumeration.js";import{reader as p}from"../../core/accessorSupport/decorators/reader.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../../core/accessorSupport/decorators/writer.js";import a from"../../geometry/SpatialReference.js";import{apiKey as y}from"./commonProperties.js";import m from"./DataLayer.js";import c from"./FeatureSet.js";import{impedanceAttributeNameJsonMap as d,restrictionAttributeNameJsonMap as v,directionsLengthUnitJsonMap as w,directionsOutputTypeJsonMap as j,directionsStyleNameJsonMap as h,durationImpedanceAttributeNameJsonMap as S,lengthUnitJsonMap as B,outputLineJsonMap as f,restrictUTurnJsonMap as b}from"./networkEnums.js";import T from"./NetworkFeatureSet.js";import g from"./NetworkUrl.js";import A from"./TravelMode.js";var N;let P=N=class extends(e.ClonableMixin(o)){constructor(t){super(t),this.accumulateAttributes=null,this.apiKey=null,this.attributeParameterValues=null,this.checksum=null,this.directionsLanguage=null,this.directionsLengthUnits=null,this.directionsOutputType=null,this.directionsStyleName=null,this.directionsTimeAttribute=null,this.findBestSequence=null,this.geometryPrecision=null,this.geometryPrecisionM=null,this.geometryPrecisionZ=null,this.ignoreInvalidLocations=null,this.impedanceAttribute=null,this.outputGeometryPrecision=null,this.outputGeometryPrecisionUnits=null,this.outputLines="true-shape",this.outSpatialReference=null,this.overrides=null,this.pointBarriers=null,this.polygonBarriers=null,this.polylineBarriers=null,this.preserveFirstStop=null,this.preserveLastStop=null,this.preserveObjectID=null,this.restrictionAttributes=null,this.restrictUTurns=null,this.returnBarriers=!1,this.returnDirections=!1,this.returnPolygonBarriers=!1,this.returnPolylineBarriers=!1,this.returnRoutes=!0,this.returnStops=!1,this.returnTraversedEdges=null,this.returnTraversedJunctions=null,this.returnTraversedTurns=null,this.returnZ=!0,this.startTime=null,this.startTimeIsUTC=!0,this.stops=null,this.timeWindowsAreUTC=null,this.travelMode=null,this.useHierarchy=null,this.useTimeWindows=null}static from(t){return s(N,t)}readAccumulateAttributes(t){return null==t?null:t.map((t=>d.fromJSON(t)))}writeAccumulateAttributes(t,e,r){t?.length&&(e[r]=t.map((t=>d.toJSON(t))))}writePointBarriers(t,e,r){k(t,e,r)}writePolygonBarrier(t,e,r){k(t,e,r)}writePolylineBarrier(t,e,r){k(t,e,r)}readRestrictionAttributes(t){return null==t?null:t.map((t=>v.fromJSON(t)))}writeRestrictionAttributes(t,e,r){t?.length&&(e[r]=t.map((t=>v.toJSON(t))))}readStartTime(t,e){const{startTime:r}=e;return null==r?null:"now"===r?"now":new Date(r)}writeStartTime(t,e){null!=t&&(e.startTime="now"===t?"now":t.getTime())}readStops(t,e){return C(e.stops)}writeStops(t,e,r){k(t,e,r)}};t([i({type:[String],json:{name:"accumulateAttributeNames",write:!0}})],P.prototype,"accumulateAttributes",void 0),t([p("accumulateAttributes")],P.prototype,"readAccumulateAttributes",null),t([l("accumulateAttributes")],P.prototype,"writeAccumulateAttributes",null),t([i(y)],P.prototype,"apiKey",void 0),t([i({json:{write:!0}})],P.prototype,"attributeParameterValues",void 0),t([i({type:String,json:{write:!0}})],P.prototype,"checksum",void 0),t([i({type:String,json:{write:!0}})],P.prototype,"directionsLanguage",void 0),t([n(w)],P.prototype,"directionsLengthUnits",void 0),t([n(j)],P.prototype,"directionsOutputType",void 0),t([n(h)],P.prototype,"directionsStyleName",void 0),t([n(S,{name:"directionsTimeAttributeName",ignoreUnknown:!1})],P.prototype,"directionsTimeAttribute",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"findBestSequence",void 0),t([i({type:Number,json:{write:!0}})],P.prototype,"geometryPrecision",void 0),t([i({type:Number,json:{write:!0}})],P.prototype,"geometryPrecisionM",void 0),t([i({type:Number,json:{write:!0}})],P.prototype,"geometryPrecisionZ",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"ignoreInvalidLocations",void 0),t([n(d,{name:"impedanceAttributeName",ignoreUnknown:!1})],P.prototype,"impedanceAttribute",void 0),t([i({type:Number,json:{write:!0}})],P.prototype,"outputGeometryPrecision",void 0),t([n(B)],P.prototype,"outputGeometryPrecisionUnits",void 0),t([n(f)],P.prototype,"outputLines",void 0),t([i({type:a,json:{name:"outSR",write:!0}})],P.prototype,"outSpatialReference",void 0),t([i({json:{write:!0}})],P.prototype,"overrides",void 0),t([i({json:{name:"barriers",write:!0}})],P.prototype,"pointBarriers",void 0),t([l("pointBarriers")],P.prototype,"writePointBarriers",null),t([i({json:{write:!0}})],P.prototype,"polygonBarriers",void 0),t([l("polygonBarriers")],P.prototype,"writePolygonBarrier",null),t([i({json:{write:!0}})],P.prototype,"polylineBarriers",void 0),t([l("polylineBarriers")],P.prototype,"writePolylineBarrier",null),t([i({type:Boolean,json:{write:!0}})],P.prototype,"preserveFirstStop",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"preserveLastStop",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"preserveObjectID",void 0),t([i({type:[String],json:{name:"restrictionAttributeNames",write:!0}})],P.prototype,"restrictionAttributes",void 0),t([p("restrictionAttributes")],P.prototype,"readRestrictionAttributes",null),t([l("restrictionAttributes")],P.prototype,"writeRestrictionAttributes",null),t([n(b)],P.prototype,"restrictUTurns",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnBarriers",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnDirections",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnPolygonBarriers",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnPolylineBarriers",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnRoutes",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnStops",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnTraversedEdges",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnTraversedJunctions",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnTraversedTurns",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnZ",void 0),t([i({json:{write:!0}})],P.prototype,"startTime",void 0),t([p("startTime")],P.prototype,"readStartTime",null),t([l("startTime")],P.prototype,"writeStartTime",null),t([i({type:Boolean,json:{write:!0}})],P.prototype,"startTimeIsUTC",void 0),t([i({json:{write:!0}})],P.prototype,"stops",void 0),t([p("stops")],P.prototype,"readStops",null),t([l("stops")],P.prototype,"writeStops",null),t([i({type:Boolean,json:{write:!0}})],P.prototype,"timeWindowsAreUTC",void 0),t([i({type:A,json:{write:!0}})],P.prototype,"travelMode",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"useHierarchy",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"useTimeWindows",void 0),P=N=t([u("esri.rest.support.RouteParameters")],P);const O=P;function J(t){return t&&"type"in t}function L(t){return t&&"features"in t&&"doNotLocateOnRestrictedElements"in t}function R(t){return t&&"url"in t}function U(t){return t&&"features"in t}function C(t){return J(t)?m.fromJSON(t):R(t)?g.fromJSON(t):L(t)?T.fromJSON(t):U(t)?c.fromJSON(t):null}function k(t,e,o){null!=t&&(e[o]=r.isCollection(t)?{features:t.toArray().map((t=>t.toJSON()))}:t.toJSON())}export{O as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as r}from"../../chunks/tslib.es6.js";import o from"../../Graphic.js";import{isSome as e}from"../../core/arrayUtils.js";import t from"../../core/JSONSupport.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{reader as p}from"../../core/accessorSupport/decorators/reader.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import a from"./FeatureSet.js";import l from"./NAMessage.js";import n from"./RouteResult.js";function u(r){return r?a.fromJSON(r).features.filter(e):[]}let m=class extends t{constructor(r){super(r),this.messages=null,this.pointBarriers=null,this.polylineBarriers=null,this.polygonBarriers=null,this.routeResults=null}readPointBarriers(r,o){return u(o.barriers)}readPolylineBarriers(r){return u(r)}readPolygonBarriers(r){return u(r)}};r([s({type:[l]})],m.prototype,"messages",void 0),r([s({type:[o]})],m.prototype,"pointBarriers",void 0),r([p("pointBarriers",["barriers"])],m.prototype,"readPointBarriers",null),r([s({type:[o]})],m.prototype,"polylineBarriers",void 0),r([p("polylineBarriers")],m.prototype,"readPolylineBarriers",null),r([s({type:[o]})],m.prototype,"polygonBarriers",void 0),r([p("polygonBarriers")],m.prototype,"readPolygonBarriers",null),r([s({type:[n]})],m.prototype,"routeResults",void 0),m=r([i("esri.rest.support.RouteSolveResult")],m);const y=m;export{y as default};
5
+ import{_ as r}from"../../chunks/tslib.es6.js";import o from"../../Graphic.js";import{isSome as e}from"../../core/arrayUtils.js";import t from"../../core/JSONSupport.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{reader as p}from"../../core/accessorSupport/decorators/reader.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import l from"./FeatureSet.js";import a from"./NAMessage.js";import u from"./RouteResult.js";function n(r){return r?l.fromJSON(r).features.filter(e):[]}let c=class extends t{constructor(r){super(r),this.checksum=null,this.messages=null,this.pointBarriers=null,this.polylineBarriers=null,this.polygonBarriers=null,this.routeResults=null}readPointBarriers(r,o){return n(o.barriers)}readPolylineBarriers(r){return n(r)}readPolygonBarriers(r){return n(r)}};r([s({type:String})],c.prototype,"checksum",void 0),r([s({type:[a]})],c.prototype,"messages",void 0),r([s({type:[o]})],c.prototype,"pointBarriers",void 0),r([p("pointBarriers",["barriers"])],c.prototype,"readPointBarriers",null),r([s({type:[o]})],c.prototype,"polylineBarriers",void 0),r([p("polylineBarriers")],c.prototype,"readPolylineBarriers",null),r([s({type:[o]})],c.prototype,"polygonBarriers",void 0),r([p("polygonBarriers")],c.prototype,"readPolygonBarriers",null),r([s({type:[u]})],c.prototype,"routeResults",void 0),c=r([i("esri.rest.support.RouteSolveResult")],c);const m=c;export{m 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.32/esri/copyright.txt for details.
4
4
  */
5
- const a="20250219",d="2e738e0a49916a3b85a3ac4dd8a4db32c20d3379";export{a as buildDate,d as commitHash};
5
+ const a="20250221",e="3ca577b0e78f3664d7834460a4a93251216fed70";export{a as buildDate,e as commitHash};