@arcgis/core 4.31.0-next.20240604 → 4.31.0-next.20240606

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 (154) hide show
  1. package/Graphic.js +1 -1
  2. package/applications/WebEditor/sketchUtils.js +1 -1
  3. package/arcade/featureSetUtils.js +1 -1
  4. package/arcade/featureset/support/RecentlyUsedCache.js +1 -1
  5. package/arcade/functions/centroid.js +1 -1
  6. package/arcade/functions/geomasync.js +1 -1
  7. package/arcade/functions/geomsync.js +1 -1
  8. package/assets/esri/core/workers/RemoteClient.js +1 -1
  9. package/assets/esri/core/workers/chunks/04d84f7c9c5b5a6bdf47.js +1 -0
  10. package/assets/esri/core/workers/chunks/164debfd5eac01ce3121.js +1 -0
  11. package/assets/esri/core/workers/chunks/17e4d9be754e9ce2cec4.js +1 -0
  12. package/assets/esri/core/workers/chunks/17e8791bad1e2c3a0bb1.js +1 -0
  13. package/assets/esri/core/workers/chunks/1a64e0020d12c251ad4b.js +1 -0
  14. package/assets/esri/core/workers/chunks/{10262c0776dc61ebe920.js → 1ea3e4afb8ac0a515688.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{3ec2ed6b4d2f373ed0dc.js → 1ece003ccf1c03fb42d9.js} +1 -1
  16. package/assets/esri/core/workers/chunks/2ee7d91cc6c1ae7f3698.js +1 -0
  17. package/assets/esri/core/workers/chunks/342426c8a8c9f5f84811.js +1 -0
  18. package/assets/esri/core/workers/chunks/423abec9211aa6ab6502.js +1 -0
  19. package/assets/esri/core/workers/chunks/441f3eaef3b703dd1026.js +1 -0
  20. package/assets/esri/core/workers/chunks/493851fc4b07de3fe924.js +1 -0
  21. package/assets/esri/core/workers/chunks/51e3a5efcce2ad780ab1.js +1 -0
  22. package/assets/esri/core/workers/chunks/66b835a5edfcdcf21c06.js +1 -0
  23. package/assets/esri/core/workers/chunks/82f982d9dde0ab137403.js +1 -0
  24. package/assets/esri/core/workers/chunks/{d1c4d0d53614055bc173.js → c406e673d2dd7e702af0.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{a5f467805178686b7240.js → c70683b7183458b338f8.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{c8e2654c637da6add9ab.js → cab1438113f204ce70ea.js} +1 -1
  27. package/assets/esri/core/workers/chunks/dcca17cf0c48a97a5fa1.js +1 -0
  28. package/assets/esri/core/workers/chunks/fa5e171c8ce844363b6c.js +1 -0
  29. package/assets/esri/core/workers/chunks/{6c1ded9acf5c8be493ea.js → fc1c4b26d2bce0624566.js} +1 -1
  30. package/assets/esri/themes/base/widgets/_BuildingDisciplinesTree.scss +5 -138
  31. package/assets/esri/themes/base/widgets/_BuildingExplorer.scss +1 -9
  32. package/assets/esri/themes/base/widgets/_BuildingLevelPicker.scss +5 -39
  33. package/assets/esri/themes/base/widgets/_BuildingPhasePicker.scss +2 -17
  34. package/assets/esri/themes/base/widgets/_Editor.scss +8 -0
  35. package/assets/esri/themes/base/widgets/_Expand.scss +7 -1
  36. package/assets/esri/themes/base/widgets/_Grid.scss +10 -1
  37. package/assets/esri/themes/base/widgets/_Print.scss +1 -0
  38. package/assets/esri/themes/base/widgets/_Sketch.scss +8 -0
  39. package/assets/esri/themes/base/widgets/_SketchTooltipControls.scss +1 -0
  40. package/assets/esri/themes/base/widgets/_SnappingControls.scss +4 -0
  41. package/assets/esri/themes/dark/main.css +1 -1
  42. package/assets/esri/themes/light/main.css +1 -1
  43. package/assets/esri/themes/light/view.css +1 -1
  44. package/chunks/CypherLexer.js +5 -0
  45. package/chunks/CypherListener.js +5 -0
  46. package/chunks/CypherParser.js +5 -0
  47. package/chunks/antlr4.web.js +5 -0
  48. package/copyright.txt +38 -3
  49. package/core/MapUtils.js +1 -1
  50. package/core/deprecate.js +1 -1
  51. package/geometry/support/meshUtils/geographicUtils.js +1 -1
  52. package/geometry/support/meshVertexSpaceUtils.js +1 -1
  53. package/interfaces.d.ts +155 -112
  54. package/layers/LinkChartLayer.js +1 -1
  55. package/layers/VectorTileLayer.js +1 -1
  56. package/layers/catalog/CatalogDynamicGroupLayer.js +1 -1
  57. package/layers/knowledgeGraph/antlr/BindParamsListener.js +5 -0
  58. package/layers/knowledgeGraph/antlr/SimpleErrorListener.js +5 -0
  59. package/layers/knowledgeGraph/cypherUtils.js +5 -0
  60. package/layers/knowledgeGraph/supportUtils.js +1 -1
  61. package/layers/support/rasterFunctions/AspectFunction.js +1 -1
  62. package/layers/support/rasterFunctions/BaseRasterFunction.js +1 -1
  63. package/layers/support/rasterFunctions/NDVIFunction.js +1 -1
  64. package/layers/support/rasterFunctions/RemapFunction.js +1 -1
  65. package/layers/support/rasterFunctions/SlopeFunction.js +1 -1
  66. package/libs/linkchartlayout/LinkChartLayout.js +1 -1
  67. package/package.json +1 -1
  68. package/support/revision.js +1 -1
  69. package/versionManagement/utils.d.ts +4 -0
  70. package/versionManagement/versionAdapters/utils.d.ts +4 -0
  71. package/views/2d/engine/AFeatureContainer.js +1 -1
  72. package/views/2d/engine/vectorTiles/RenderBucket.js +1 -1
  73. package/views/2d/engine/vectorTiles/TileManager.js +1 -1
  74. package/views/2d/engine/vectorTiles/VectorTile.js +1 -1
  75. package/views/2d/engine/vectorTiles/decluttering/SymbolDeclutterer.js +1 -1
  76. package/views/2d/engine/webgl/FeatureTile.js +1 -1
  77. package/views/2d/layers/GraphicsLayerView2D.js +1 -1
  78. package/views/2d/layers/KMLLayerView2D.js +1 -1
  79. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  80. package/views/2d/layers/support/ExportStrategy.js +1 -1
  81. package/views/2d/layers/support/vectorTileDebugUtils.js +1 -1
  82. package/views/2d/support/HighlightOptions.js +1 -1
  83. package/views/3d/analysis/Viewshed/FieldOfViewManipulation.js +1 -1
  84. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  85. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  86. package/views/3d/analysis/Viewshed/viewshedToolConfig.js +1 -1
  87. package/views/3d/layers/I3SMeshView3D.js +1 -1
  88. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  89. package/views/3d/layers/graphics/GraphicsDeconflictor.js +1 -1
  90. package/views/3d/layers/graphics/Labeler.js +1 -1
  91. package/views/3d/layers/i3s/I3SGraphicsMap.js +1 -1
  92. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  93. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  94. package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
  95. package/views/3d/layers/support/FeatureTileTree3D.js +1 -1
  96. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  97. package/views/3d/support/GraphicsMap.js +1 -1
  98. package/views/3d/support/HighlightOptions.js +1 -1
  99. package/views/3d/support/LimitGraphicsMap.js +1 -1
  100. package/views/3d/support/viewpointUtils.js +1 -1
  101. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  102. package/views/3d/webgl-engine/collections/Component/ElevationAgnosticBVH.js +1 -1
  103. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  104. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  105. package/views/3d/webgl-engine/lib/ObjectAndLayerIdRenderHelper.js +1 -1
  106. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  107. package/views/3d/webgl-engine/materials/ProceduralTextureRepository.js +1 -1
  108. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  109. package/views/input/recognizers/DoubleTapDrag.js +1 -1
  110. package/views/input/recognizers/SingleAndDoubleClick.js +1 -1
  111. package/views/interactive/SegmentLabels.js +1 -1
  112. package/views/interactive/ToolViewManagerManipulatorState.js +1 -1
  113. package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
  114. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileStore.js +1 -1
  115. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
  116. package/views/interactive/tooltip/Tooltip.js +1 -1
  117. package/views/interactive/tooltip/content/TooltipContent.js +1 -1
  118. package/views/support/HighlightDefaults.js +5 -0
  119. package/views/support/HighlightOptions.js +5 -0
  120. package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesNode.js +1 -1
  121. package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesTree.js +1 -1
  122. package/widgets/BuildingExplorer/BuildingDisciplinesViewModel.js +1 -1
  123. package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
  124. package/widgets/BuildingExplorer/BuildingLevelPicker/Label.js +1 -1
  125. package/widgets/BuildingExplorer/BuildingLevelPicker/LevelItem.js +1 -1
  126. package/widgets/BuildingExplorer/BuildingLevelPicker/css.js +1 -1
  127. package/widgets/BuildingExplorer/BuildingPhasePicker/BuildingPhasePicker.js +1 -1
  128. package/widgets/BuildingExplorer/BuildingPhasePicker/css.js +5 -0
  129. package/widgets/BuildingExplorer/support/LayerTreeNode.js +1 -1
  130. package/widgets/BuildingExplorer.js +1 -1
  131. package/widgets/Expand.js +1 -1
  132. package/widgets/FeatureForm.js +1 -1
  133. package/widgets/FeatureTable/Grid/Column.js +1 -1
  134. package/widgets/FeatureTable/RelationshipColumn.js +1 -1
  135. package/widgets/FeatureTable/support/tableUtils.js +1 -1
  136. package/widgets/FeatureTable.js +1 -1
  137. package/widgets/Print/PrintViewModel.js +1 -1
  138. package/widgets/VersionManagement/VersionManagementViewModel.js +1 -1
  139. package/widgets/support/legacyIcon.js +1 -1
  140. package/assets/esri/core/workers/chunks/0776d3a116fbdc826f18.js +0 -1
  141. package/assets/esri/core/workers/chunks/270f8956ffdeafde9c8b.js +0 -1
  142. package/assets/esri/core/workers/chunks/3841ef7007eda2f3a7a4.js +0 -1
  143. package/assets/esri/core/workers/chunks/4ccf7a2b36e0b8b26736.js +0 -1
  144. package/assets/esri/core/workers/chunks/7bdbe784b3ff709aa6c1.js +0 -1
  145. package/assets/esri/core/workers/chunks/9f2d8940da48c864b2ca.js +0 -1
  146. package/assets/esri/core/workers/chunks/a111eb0ae78a9f5be981.js +0 -1
  147. package/assets/esri/core/workers/chunks/b57a5055b9956433dac2.js +0 -1
  148. package/assets/esri/core/workers/chunks/d0f5d50298011db28c8d.js +0 -1
  149. package/assets/esri/core/workers/chunks/d8140b5316e80d734155.js +0 -1
  150. package/assets/esri/core/workers/chunks/e997dd783a3cb06303ea.js +0 -1
  151. package/assets/esri/core/workers/chunks/eb6c76bbd4169c071151.js +0 -1
  152. package/assets/esri/core/workers/chunks/f9774ba48f3aa3b8fac4.js +0 -1
  153. package/assets/esri/core/workers/chunks/fa8b00135363c450de16.js +0 -1
  154. package/views/3d/webgl-engine/effects/highlight/HighlightDefaults.js +0 -5
package/Graphic.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.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"./chunks/tslib.es6.js";import{geometryTypes as e}from"./geometry.js";import r from"./PopupTemplate.js";import{symbolTypes as s}from"./symbols.js";import{ClonableMixin as i}from"./core/Clonable.js";import{isSerializable as o,JSONSupport as a}from"./core/JSONSupport.js";import{when as l}from"./core/reactiveUtils.js";import{generateUID as n}from"./core/uid.js";import{property as p}from"./core/accessorSupport/decorators/property.js";import"./core/has.js";import"./core/Logger.js";import"./core/RandomLCG.js";import{subclass as h}from"./core/accessorSupport/decorators/subclass.js";import{fromJSON as u}from"./geometry/support/jsonUtils.js";var m;function g(t){if(!t)return null;const e={};for(const r in t){const s=u(t[r]);s&&(e[r]=s)}return 0!==Object.keys(e).length?e:null}function y(t){if(null==t)return null;const e={};for(const r in t){const s=t[r];s&&(e[r]=s.toJSON())}return 0!==Object.keys(e).length?e:null}let c=m=class extends(i(a)){constructor(t){super(t),this.isAggregate=!1,this.layer=null,this.origin=null,this.popupTemplate=null,this.sourceLayer=null,Object.defineProperty(this,"uid",{value:n(),configurable:!0}),Object.defineProperty(this,"_lastMeshTransform",{value:{},configurable:!0,writable:!0,enumerable:!1})}initialize(){this._watchMeshGeometryChanges()}set aggregateGeometries(t){const e=this._get("aggregateGeometries");JSON.stringify(e)!==JSON.stringify(t)&&this._set("aggregateGeometries",t)}set attributes(t){const e=this._get("attributes");e!==t&&(this._set("attributes",t),this._notifyLayer("attributes",e,t))}set geometry(t){const e=this._get("geometry");e!==t&&(this._set("geometry",t),"mesh"!==t?.type&&this._notifyLayer("geometry",e,t))}set symbol(t){const e=this._get("symbol");e!==t&&(this._set("symbol",t),this._notifyLayer("symbol",e,t))}set visible(t){const e=this._get("visible");e!==t&&(this._set("visible",t),this._notifyLayer("visible",e,t))}cloneShallow(){return new m({aggregateGeometries:this.aggregateGeometries,attributes:this.attributes,geometry:this.geometry,isAggregate:this.isAggregate,layer:this.layer,popupTemplate:this.popupTemplate,sourceLayer:this.sourceLayer,symbol:this.symbol,visible:this.visible,origin:this.origin})}getEffectivePopupTemplate(t=!1){if(this.popupTemplate)return this.popupTemplate;const e=this.origin&&"layer"in this.origin?this.origin.layer:null;for(const r of[e,this.sourceLayer,this.layer])if(r){if("popupTemplate"in r&&r.popupTemplate)return r.popupTemplate;if(t&&"defaultPopupTemplate"in r&&null!=r.defaultPopupTemplate)return r.defaultPopupTemplate}return null}getAttribute(t){return this.attributes?.[t]}setAttribute(t,e){if(this.attributes){const r=this.getAttribute(t);this.attributes[t]=e,this._notifyLayer("attributes",r,e,t)}else this.attributes={[t]:e},this._notifyLayer("attributes",void 0,e,t)}getObjectId(){return this.sourceLayer&&"objectIdField"in this.sourceLayer&&this.sourceLayer.objectIdField?this.getAttribute(this.sourceLayer.objectIdField):null}toJSON(){return{aggregateGeometries:y(this.aggregateGeometries),geometry:null!=this.geometry?this.geometry.toJSON():null,symbol:null!=this.symbol?this.symbol.toJSON():null,attributes:o(this.attributes)?this.attributes.toJSON():{...this.attributes},popupTemplate:this.popupTemplate?.toJSON()??null}}notifyMeshTransformChanged(t={}){const{geometry:e}=this;if("mesh"===e?.type){const r={origin:e.origin,transform:e.transform};this._notifyLayer("origin-transform",r,r,t.action)}}_notifyLayer(t,e,r,s){if(!this.layer||!("graphicChanged"in this.layer))return;const i={graphic:this,property:t,oldValue:e,newValue:r};"origin-transform"===t&&(i.action=s),"attributes"===t&&(i.attributeName=s),this.layer.graphicChanged(i)}_watchMeshGeometryChanges(){this.addHandles([l((()=>"mesh"===this.geometry?.type&&this.geometry.vertexSpace.origin?{localMatrix:this.geometry.transform?.localMatrix,origin:this.geometry.vertexSpace.origin}:void 0),(({localMatrix:t,origin:e})=>{this._lastMeshTransform.localMatrix===t&&this._lastMeshTransform.origin===e||(this._lastMeshTransform.localMatrix=t,this._lastMeshTransform.origin=e,this.notifyMeshTransformChanged())})),l((()=>"mesh"===this.geometry?.type?{vertexAttributes:this.geometry.vertexAttributes}:void 0),(()=>{const t=this.geometry;"mesh"===t?.type&&t.vertexSpace.origin?(this._lastMeshTransform.localMatrix=t.transform?.localMatrix,this._lastMeshTransform.origin=t.vertexSpace.origin):(this._lastMeshTransform.localMatrix=void 0,this._lastMeshTransform.origin=void 0),this._notifyLayer("geometry",this.geometry,this.geometry)}),{equals:(t,e)=>t===e,sync:!0})])}};t([p({value:null,json:{read:g}})],c.prototype,"aggregateGeometries",null),t([p({value:null})],c.prototype,"attributes",null),t([p({value:null,types:e,json:{read:u}})],c.prototype,"geometry",null),t([p({type:Boolean})],c.prototype,"isAggregate",void 0),t([p({clonable:"reference"})],c.prototype,"layer",void 0),t([p({clonable:"reference"})],c.prototype,"origin",void 0),t([p({type:r})],c.prototype,"popupTemplate",void 0),t([p({clonable:"reference"})],c.prototype,"sourceLayer",void 0),t([p({value:null,types:s})],c.prototype,"symbol",null),t([p({type:Boolean,value:!0})],c.prototype,"visible",null),c=m=t([h("esri.Graphic")],c),function(t){t.generateUID=n}(c||(c={}));const f=c;export{f as default};
5
+ import{_ as t}from"./chunks/tslib.es6.js";import{geometryTypes as e}from"./geometry.js";import r from"./PopupTemplate.js";import{symbolTypes as s}from"./symbols.js";import{ClonableMixin as i}from"./core/Clonable.js";import{deprecatedConstructorSignature as o}from"./core/deprecate.js";import{isSerializable as a,JSONSupport as l}from"./core/JSONSupport.js";import n from"./core/Logger.js";import{when as p}from"./core/reactiveUtils.js";import{generateUID as h}from"./core/uid.js";import{property as u}from"./core/accessorSupport/decorators/property.js";import"./core/has.js";import"./core/RandomLCG.js";import{subclass as m}from"./core/accessorSupport/decorators/subclass.js";import{fromJSON as g}from"./geometry/support/jsonUtils.js";var y;function c(t){if(!t)return null;const e={};for(const r in t){const s=g(t[r]);s&&(e[r]=s)}return 0!==Object.keys(e).length?e:null}function f(t){if(null==t)return null;const e={};for(const r in t){const s=t[r];s&&(e[r]=s.toJSON())}return 0!==Object.keys(e).length?e:null}let b=y=class extends(i(l)){constructor(t){super(t),this.isAggregate=!1,this.layer=null,this.origin=null,this.popupTemplate=null,this.sourceLayer=null,Object.defineProperty(this,"uid",{value:h(),configurable:!0}),Object.defineProperty(this,"_lastMeshTransform",{value:{},configurable:!0,writable:!0,enumerable:!1}),arguments.length>1&&o(n.getLogger(this),"Graphic",{version:"4.30"})}initialize(){this._watchMeshGeometryChanges()}set aggregateGeometries(t){const e=this._get("aggregateGeometries");JSON.stringify(e)!==JSON.stringify(t)&&this._set("aggregateGeometries",t)}set attributes(t){const e=this._get("attributes");e!==t&&(this._set("attributes",t),this._notifyLayer("attributes",e,t))}set geometry(t){const e=this._get("geometry");e!==t&&(this._set("geometry",t),"mesh"!==t?.type&&this._notifyLayer("geometry",e,t))}set symbol(t){const e=this._get("symbol");e!==t&&(this._set("symbol",t),this._notifyLayer("symbol",e,t))}set visible(t){const e=this._get("visible");e!==t&&(this._set("visible",t),this._notifyLayer("visible",e,t))}cloneShallow(){return new y({aggregateGeometries:this.aggregateGeometries,attributes:this.attributes,geometry:this.geometry,isAggregate:this.isAggregate,layer:this.layer,popupTemplate:this.popupTemplate,sourceLayer:this.sourceLayer,symbol:this.symbol,visible:this.visible,origin:this.origin})}getEffectivePopupTemplate(t=!1){if(this.popupTemplate)return this.popupTemplate;const e=this.origin&&"layer"in this.origin?this.origin.layer:null;for(const r of[e,this.sourceLayer,this.layer])if(r){if("popupTemplate"in r&&r.popupTemplate)return r.popupTemplate;if(t&&"defaultPopupTemplate"in r&&null!=r.defaultPopupTemplate)return r.defaultPopupTemplate}return null}getAttribute(t){return this.attributes?.[t]}setAttribute(t,e){if(this.attributes){const r=this.getAttribute(t);this.attributes[t]=e,this._notifyLayer("attributes",r,e,t)}else this.attributes={[t]:e},this._notifyLayer("attributes",void 0,e,t)}getObjectId(){return this.sourceLayer&&"objectIdField"in this.sourceLayer&&this.sourceLayer.objectIdField?this.getAttribute(this.sourceLayer.objectIdField):null}toJSON(){return{aggregateGeometries:f(this.aggregateGeometries),geometry:null!=this.geometry?this.geometry.toJSON():null,symbol:null!=this.symbol?this.symbol.toJSON():null,attributes:a(this.attributes)?this.attributes.toJSON():{...this.attributes},popupTemplate:this.popupTemplate?.toJSON()??null}}notifyMeshTransformChanged(t={}){const{geometry:e}=this;if("mesh"===e?.type){const r={origin:e.origin,transform:e.transform};this._notifyLayer("origin-transform",r,r,t.action)}}_notifyLayer(t,e,r,s){if(!this.layer||!("graphicChanged"in this.layer))return;const i={graphic:this,property:t,oldValue:e,newValue:r};"origin-transform"===t&&(i.action=s),"attributes"===t&&(i.attributeName=s),this.layer.graphicChanged(i)}_watchMeshGeometryChanges(){this.addHandles([p((()=>"mesh"===this.geometry?.type&&this.geometry.vertexSpace.origin?{localMatrix:this.geometry.transform?.localMatrix,origin:this.geometry.vertexSpace.origin}:void 0),(({localMatrix:t,origin:e})=>{this._lastMeshTransform.localMatrix===t&&this._lastMeshTransform.origin===e||(this._lastMeshTransform.localMatrix=t,this._lastMeshTransform.origin=e,this.notifyMeshTransformChanged())})),p((()=>"mesh"===this.geometry?.type?{vertexAttributes:this.geometry.vertexAttributes}:void 0),(()=>{const t=this.geometry;"mesh"===t?.type&&t.vertexSpace.origin?(this._lastMeshTransform.localMatrix=t.transform?.localMatrix,this._lastMeshTransform.origin=t.vertexSpace.origin):(this._lastMeshTransform.localMatrix=void 0,this._lastMeshTransform.origin=void 0),this._notifyLayer("geometry",this.geometry,this.geometry)}),{equals:(t,e)=>t===e,sync:!0})])}};t([u({value:null,json:{read:c}})],b.prototype,"aggregateGeometries",null),t([u({value:null})],b.prototype,"attributes",null),t([u({value:null,types:e,json:{read:g}})],b.prototype,"geometry",null),t([u({type:Boolean})],b.prototype,"isAggregate",void 0),t([u({clonable:"reference"})],b.prototype,"layer",void 0),t([u({clonable:"reference"})],b.prototype,"origin",void 0),t([u({type:r})],b.prototype,"popupTemplate",void 0),t([u({clonable:"reference"})],b.prototype,"sourceLayer",void 0),t([u({value:null,types:s})],b.prototype,"symbol",null),t([u({type:Boolean,value:!0})],b.prototype,"visible",null),b=y=t([m("esri.Graphic")],b),function(t){t.generateUID=h}(b||(b={}));const d=b;export{d 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.31/esri/copyright.txt for details.
4
4
  */
5
- import{createTask as o}from"../../core/asyncUtils.js";import{on as e}from"../../core/events.js";import{makeHandle as t}from"../../core/handleUtils.js";import{ignoreAbortErrors as i,isAborted as n,createResolver as r,onAbort as s}from"../../core/promiseUtils.js";import{whenOnce as a}from"../../core/reactiveUtils.js";import{waitAnimationFrame as c}from"../../core/scheduling.js";import{createScreenPoint as l}from"../../core/screenUtils.js";import p from"../../views/interactive/sketch/SketchTooltipVisibleElements.js";async function d(e,t,p={}){async function d(o){const i=h(e);if("coordinates"===t?(t="x",e.tooltipOptions.xyMode="coordinates"):"direction"!==t&&"distance"!==t||(e.tooltipOptions.xyMode="direction-distance"),await c(),n(p)||n(o))return;const d=i?.tooltip;if(!d||!i.activeTooltipInfo?.editableFields?.find((o=>o.name===t)))return;const{handle:m,promise:f}=v(d,p),u=r(),y=s(p.signal,u.resolve),b=s(o,u.resolve),j=d.position;try{if(e.tooltipOptions.forceEnabled=!0,p.position&&(d.position=l(p.position[0],p.position[1])),await d.enterInputMode(t),n(p)||n(o))return;p.onOpen?.(),await Promise.race([a((()=>i.destroyed||"feedback"===d.content?.mode),p),f,u.promise])}finally{y?.remove(),b?.remove(),m.remove(),e.tooltipOptions.enabled&&await d.exitInputMode(),p.onClose?.(),d.position=j,e.tooltipOptions.forceEnabled=!1}}const f=m.get(e);f&&(f.abort(),await f.promise);const u=o(d);return m.set(e,u),u.promise.catch(i).finally((()=>{m.get(e)===u&&m.delete(e)}))}const m=new Map,f={area:!1,distance:!1,direction:!1,elevation:!1,orientation:!1,radius:!1,rotation:!1,scale:!1,size:!1,totalLength:!1,coordinates:!1,helpMessage:!1,header:!1};function u(o){o.tooltipOptions.visibleElements=new p(f)}function v(o,{hideOnBlur:i=!0}){const n=r();if(!i)return{promise:n.promise,handle:t()};const s=o.contentContainer,a=e(s,"focusout",(({relatedTarget:o})=>{o instanceof HTMLElement&&s.contains(o)||n.resolve()}));return{promise:n.promise,handle:a}}function h(o){const{activeComponent:e}=o;return e&&"tooltip"in e&&"activeTooltipInfo"in e&&"destroyed"in e?e:null}export{u as hideAllVisibleElements,d as showTooltipAndFocusField};
5
+ import{createTask as o}from"../../core/asyncUtils.js";import{on as e}from"../../core/events.js";import{makeHandle as t}from"../../core/handleUtils.js";import{ignoreAbortErrors as i,isAborted as n,createResolver as s,onAbort as r}from"../../core/promiseUtils.js";import{whenOnce as c}from"../../core/reactiveUtils.js";import{waitAnimationFrame as a}from"../../core/scheduling.js";import{createScreenPoint as l}from"../../core/screenUtils.js";import p from"../../views/interactive/sketch/SketchTooltipVisibleElements.js";async function m(e,t,p={}){async function m(o){const i=h(e);if("coordinates"===t?(t="x",e.tooltipOptions.xyMode="coordinates"):"direction"!==t&&"distance"!==t||(e.tooltipOptions.xyMode="direction-distance"),await a(),n(p)||n(o))return;const m=i?.tooltip;if(!m||!i.activeTooltipInfo?.editableFields?.find((o=>o.name===t)))return;const{handle:d,promise:f}=v(m,p),u=s(),w=r(p.signal,u.resolve),y=r(o,u.resolve),O=m.position;try{if(e.tooltipOptions.forceEnabled=!0,p.position&&(m.position=l(p.position[0],p.position[1])),await m.enterInputMode(t),n(p)||n(o))return;p.onOpen?.(),await Promise.race([c((()=>i.destroyed||"feedback"===m.content?.mode),p),f,u.promise])}finally{w?.remove(),y?.remove(),d.remove();const o=m.contentContainer.contains(document.activeElement);e.tooltipOptions.enabled?await m.exitInputMode({focusOnView:o}):o&&e.view?.focus(),p.onClose?.(),m.position=O,e.tooltipOptions.forceEnabled=!1}}const f=d.get(e);f&&(f.abort(),await f.promise);const u=o(m);return d.set(e,u),u.promise.catch(i).finally((()=>{d.get(e)===u&&d.delete(e)}))}const d=new Map,f={area:!1,distance:!1,direction:!1,elevation:!1,orientation:!1,radius:!1,rotation:!1,scale:!1,size:!1,totalLength:!1,coordinates:!1,helpMessage:!1,header:!1};function u(o){o.tooltipOptions.visibleElements=new p(f)}function v(o,{hideOnBlur:i=!0}){const n=s();if(!i)return{promise:n.promise,handle:t()};const r=o.contentContainer,c=e(r,"focusout",(({relatedTarget:o})=>{o instanceof HTMLElement&&r.contains(o)||n.resolve()}));return{promise:n.promise,handle:c}}function h(o){const{activeComponent:e}=o;return e&&"tooltip"in e&&"activeTooltipInfo"in e&&"destroyed"in e?e:null}export{u as hideAllVisibleElements,m as showTooltipAndFocusField};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import e from"../request.js";import t from"./featureSetCollection.js";import{u as a,$ as r}from"../chunks/languageUtils.js";import n from"./featureset/actions/AttributeFilter.js";import i from"./featureset/actions/GroupBy.js";import s from"./featureset/actions/OrderBy.js";import l from"./featureset/actions/SpatialFilter.js";import o from"./featureset/actions/Top.js";import u from"./featureset/sources/FeatureLayerDynamic.js";import c from"./featureset/sources/FeatureLayerMemory.js";import d from"./featureset/sources/FeatureLayerRelated.js";import f from"./featureset/support/cache.js";import{FeatureSetError as p,FeatureSetErrorCodes as m}from"./featureset/support/errorsupport.js";import{isSupportedSourceLayer as y,extractServiceUrl as h,isSupportedLayer as _}from"./featureset/support/shared.js";import L from"../core/Loadable.js";import{WhereClause as w}from"../core/sql/WhereClause.js";import I from"../layers/FeatureLayer.js";import S from"../layers/Layer.js";import F from"../portal/PortalItem.js";function g(){null===f.applicationCache&&(f.applicationCache=new f)}async function N(e,t){if(f.applicationCache){const r=f.applicationCache.getLayerInfo(e);if(r){const a=await r;return new I({url:e,outFields:t,sourceJSON:a})}const n=new I({url:e,outFields:t}),i=(async()=>(await n.load(),n.sourceJSON))();if(f.applicationCache){f.applicationCache.setLayerInfo(e,i);try{return await i,n}catch(a){throw f.applicationCache.clearLayerInfo(e),a}}return await i,n}return new I({url:e,outFields:t})}async function C(e,t,a,r,n,i=null){return T(await N(e,["*"]),t,a,r,n,i)}function T(e,t=null,a=null,r=!0,n=null,i=null){if("catalog-footprint"===e.type)return T(e.parent,t,a,r,n,i);if("subtype-sublayer"===e.type){const s=T(e.parent,t,a,r,n,i);return s.filter(w.create(e.parent.subtypeField+"="+e.subtypeCode.toString(),e.parent.fieldsIndex,s.dateFieldsTimeZoneDefaultUTC))}if(y(e)){const s={layer:e,spatialReference:t,outFields:a,includeGeometry:r,lrucache:n,interceptor:i};return!0==!(e.url||!e.source)?new c(s):new u(s)}throw new Error(`Unsupported layer type: ${e.type}`)}async function A(t){if(null!==f.applicationCache){const e=f.applicationCache.getLayerInfo(t);if(null!==e)return e}const a=(async()=>{const a=await e(t,{responseType:"json",query:{f:"json"}});return a.data?a.data:null})();if(null!==f.applicationCache){f.applicationCache.setLayerInfo(t,a);try{return await a}catch(r){throw f.applicationCache.clearLayerInfo(t),r}}return a}async function b(t,a){const r="QUERYDATAELEMTS:"+a.toString()+":"+t;if(null!==f.applicationCache){const e=f.applicationCache.getLayerInfo(r);if(null!==e)return e}const n=(async()=>{const r=await e(t+"/queryDataElements",{method:"post",responseType:"json",query:{layers:JSON.stringify([a.toString()]),f:"json"}});if(r.data){const e=r.data;if(e.layerDataElements?.[0])return e.layerDataElements[0]}throw new p(m.DataElementsNotFound)})();if(null!==f.applicationCache){f.applicationCache.setLayerInfo(r,n);try{return await n}catch(i){throw f.applicationCache.clearLayerInfo(r),i}}return n}async function k(t){if(null!==f.applicationCache){const e=f.applicationCache.getLayerInfo(t);if(null!==e)return e}const a=(async()=>{const a=await e(t,{responseType:"json",query:{f:"json"}});if(a.data){const e=a.data;return e.layers||(e.layers=[]),e.tables||(e.tables=[]),e}return{layers:[],tables:[]}})();if(null!==f.applicationCache){f.applicationCache.setLayerInfo(t,a);try{return await a}catch(r){throw f.applicationCache.clearLayerInfo(t),r}}return a}async function O(e,t){const a={metadata:null,networkId:-1,unVersion:3,terminals:[],queryelem:null,layerNameLkp:{},lkp:null},r=await k(e);if(a.metadata=r,void 0!==r.controllerDatasetLayers?.utilityNetworkLayerId&&null!==r.controllerDatasetLayers.utilityNetworkLayerId){if(r.layers)for(const e of r.layers)a.layerNameLkp[e.id]=e.name;if(r.tables)for(const e of r.tables)a.layerNameLkp[e.id]=e.name;const n=r.controllerDatasetLayers.utilityNetworkLayerId;a.networkId=n;const i=await b(e,n);if(i){a.queryelem=i,a.queryelem?.dataElement&&void 0!==a.queryelem.dataElement.schemaGeneration&&(a.unVersion=a.queryelem.dataElement.schemaGeneration),a.lkp={},a.queryelem.dataElement.domainNetworks||(a.queryelem.dataElement.domainNetworks=[]);for(const e of a.queryelem.dataElement.domainNetworks){for(const t of e.edgeSources??[]){const e={layerId:t.layerId,sourceId:t.sourceId,className:a.layerNameLkp[t.layerId]??null};e.className&&(a.lkp[e.className]=e)}for(const t of e.junctionSources??[]){const e={layerId:t.layerId,sourceId:t.sourceId,className:a.layerNameLkp[t.layerId]??null};e.className&&(a.lkp[e.className]=e)}}if(a.queryelem.dataElement.terminalConfigurations)for(const e of a.queryelem.dataElement.terminalConfigurations)for(const t of e.terminals)a.terminals.push({terminalId:t.terminalId,terminalName:t.terminalName});const r=await A(e+"/"+n);if(void 0!==r.systemLayers?.associationsTableId&&null!==r.systemLayers.associationsTableId){const n=[];a.unVersion>=4&&(n.push("STATUS"),n.push("PERCENTALONG"));let i=await C(e+"/"+r.systemLayers.associationsTableId.toString(),t,["OBJECTID","FROMNETWORKSOURCEID","TONETWORKSOURCEID","FROMGLOBALID","TOGLOBALID","TOTERMINALID","FROMTERMINALID","ASSOCIATIONTYPE","ISCONTENTVISIBLE","GLOBALID",...n],!1,null,null);return await i.load(),a.unVersion>=4&&(i=i.filter(w.create("STATUS NOT IN (1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62, 63)",i.getFieldsIndex(),i.dateFieldsTimeZoneDefaultUTC)),await i.load()),{lkp:a.lkp,associations:i,unVersion:a.unVersion,terminals:a.terminals}}return{associations:null,unVersion:a.unVersion,lkp:null,terminals:[]}}return{associations:null,unVersion:a.unVersion,lkp:null,terminals:[]}}return{associations:null,unVersion:a.unVersion,lkp:null,terminals:[]}}async function E(e,t,a,r=null,n=null,i=!0,s=null,l=null){let o=e.serviceUrl();if(!o)return null;o="/"===o.charAt(o.length-1)?o+t.relatedTableId.toString():o+"/"+t.relatedTableId.toString();const u=await C(o,r,n,i,s,l);return new d({layer:e,relatedLayer:u,relationship:t,objectId:a,spatialReference:r,outFields:n,includeGeometry:i,lrucache:s,interceptor:l})}n.registerAction(),i.registerAction(),s.registerAction(),l.registerAction(),o.registerAction();class j extends t{constructor(e,t=null,a=null,r=null){super(),this._map=e,this._overridespref=t,this._lrucache=a,this._interceptor=r,this._instantLayers=[]}_makeAndAddFeatureSet(e,t=!0,a=null){const r=T(e,this._overridespref,null===a?["*"]:a,t,this._lrucache,this._interceptor);return this._instantLayers.push({featureset:r,opitem:e,includeGeometry:t,outFields:JSON.stringify(a)}),r}async featureSetByName(e,t=!0,a=null){if(L.isLoadable(this._map)&&!this._map.loaded)return await this._map.load(),this.featureSetByName(e,t,a);null===a&&(a=["*"]),a=(a=a.slice(0)).sort();const r=JSON.stringify(a);for(let i=0;i<this._instantLayers.length;i++){const a=this._instantLayers[i];if(a.opitem.title===e&&a.includeGeometry===t&&a.outFields===r)return this._instantLayers[i].featureset}const n=this._map.allLayers.find((t=>_(t)&&t.title===e));if(null!=n)return this._makeAndAddFeatureSet(n,t,a);if(this._map.tables){const r=this._map.tables.find((t=>t.title===e));if(null!=r){if(r instanceof I)return this._makeAndAddFeatureSet(r,t,a);if(null==r._materializedTable){const e=r.outFields?r:{...r,outFields:["*"]};r._materializedTable=new I(e)}return await r._materializedTable.load(),this._makeAndAddFeatureSet(r._materializedTable,t,a)}}return null}async featureSetById(e,t=!0,a=["*"]){if(L.isLoadable(this._map)&&!this._map.loaded)return await this._map.load(),this.featureSetById(e,t,a);null===a&&(a=["*"]),a=(a=a.slice(0)).sort();const r=JSON.stringify(a);for(let i=0;i<this._instantLayers.length;i++){const a=this._instantLayers[i];if(a.opitem.id===e&&a.includeGeometry===t&&a.outFields===r)return this._instantLayers[i].featureset}const n=this._map.allLayers.find((t=>_(t)&&t.id===e));if(n)return this._makeAndAddFeatureSet(n,t,a);if(this._map.tables){const r=this._map.tables.find((t=>t.id===e));if(null!=r){if(r instanceof I)return this._makeAndAddFeatureSet(r,t,a);if(null==r._materializedTable){const e={...r,outFields:["*"]};r._materializedTable=new I(e)}return await r._materializedTable.load(),this._makeAndAddFeatureSet(r._materializedTable,t,a)}}return null}}class D extends t{constructor(e,t=null,a=null,r=null){super(),this._url=e,this._overridespref=t,this._lrucache=a,this._interceptor=r,this.metadata=null,this._instantLayers=[]}get url(){return this._url}_makeAndAddFeatureSet(e,t=!0,a=null){const r=T(e,this._overridespref,null===a?["*"]:a,t,this._lrucache);return this._instantLayers.push({featureset:r,opitem:e,includeGeometry:t,outFields:JSON.stringify(a)}),r}async _loadMetaData(){const e=await k(this._url);return this.metadata=e,e}load(){return this._loadMetaData()}clone(){return new D(this._url,this._overridespref,this._lrucache,this._interceptor)}async featureSetByName(e,t=!0,a=null){null===a&&(a=["*"]),a=(a=a.slice(0)).sort();const r=JSON.stringify(a);for(let s=0;s<this._instantLayers.length;s++){const a=this._instantLayers[s];if(a.opitem.title===e&&a.includeGeometry===t&&a.outFields===r)return this._instantLayers[s].featureset}const n=await this._loadMetaData();let i=null;for(const s of n.layers??[])s.name===e&&(i=s);if(!i)for(const s of n.tables??[])s.name===e&&(i=s);if(i){const e=await N(this._url+"/"+i.id,["*"]);return this._makeAndAddFeatureSet(e,t,a)}return null}async featureSetById(e,t=!0,a=["*"]){null===a&&(a=["*"]),a=(a=a.slice(0)).sort();const r=JSON.stringify(a);e=null!=e?e.toString():"";for(let s=0;s<this._instantLayers.length;s++){const a=this._instantLayers[s];if(a.opitem.id===e&&a.includeGeometry===t&&a.outFields===r)return this._instantLayers[s].featureset}const n=await this._loadMetaData();let i=null;for(const s of n.layers??[])null!==s.id&&void 0!==s.id&&s.id.toString()===e&&(i=s);if(!i)for(const s of n.tables??[])null!==s.id&&void 0!==s.id&&s.id.toString()===e&&(i=s);if(i){const e=await N(this._url+"/"+i.id,["*"]);return this._makeAndAddFeatureSet(e,t,a)}return null}}function q(e,t,a=null,r=null){return new j(e,t,a,r)}function G(e,t,a=null,r=null){return new D(e,t,a,r)}function R(e,t,n,i,s){if(null===e)return null;if(a(e)){switch(t){case"datasource":return e.getDataSourceFeatureSet();case"parent":return e;case"root":return e.getRootFeatureSet()}return null}if(e instanceof S&&y(e)){const a=e;switch(t){case"datasource":return T(a,s,a.outFields,!0,n,i).getDataSourceFeatureSet();case"parent":case"root":return T(a,s,a.outFields,!0,n,i)}return null}if(r(e)){switch(t){case"datasource":return T(e.parent,s,e.parent.outFields,!0,n,i).getDataSourceFeatureSet();case"parent":case"root":return T(e,s,e.parent.outFields,!0,n,i)}return null}return null}async function B(e,t,a,r,n,i,s,l=null){if(f.applicationCache){const o=f.applicationCache.getLayerInfo(e+":"+i.url);if(o){const e=await o;return T(new I({url:h(e.url)+"/"+t,outFields:["*"]}),a,r,n,s,l)}}const o=new F({id:e,portal:i}).load();f.applicationCache&&f.applicationCache.setLayerInfo(e+":"+i.url,o);try{const e=await o;return T(new I({url:h(e.url??"")+"/"+t,outFields:["*"]}),a,r,n,s,l)}catch(u){throw f.applicationCache&&f.applicationCache.clearLayerInfo(e+":"+i.url),u}}export{O as constructAssociationMetaDataFeatureSetFromUrl,T as constructFeatureSet,B as constructFeatureSetFromPortalItem,E as constructFeatureSetFromRelationship,C as constructFeatureSetFromUrl,R as convertToFeatureSet,q as createFeatureSetCollectionFromMap,G as createFeatureSetCollectionFromService,g as initialiseMetaDataCache};
5
+ import e from"../request.js";import t from"./featureSetCollection.js";import{u as a,$ as r}from"../chunks/languageUtils.js";import n from"./featureset/actions/AttributeFilter.js";import i from"./featureset/actions/GroupBy.js";import s from"./featureset/actions/OrderBy.js";import l from"./featureset/actions/SpatialFilter.js";import o from"./featureset/actions/Top.js";import u from"./featureset/sources/FeatureLayerDynamic.js";import c from"./featureset/sources/FeatureLayerMemory.js";import d from"./featureset/sources/FeatureLayerRelated.js";import f from"./featureset/support/cache.js";import{FeatureSetError as p,FeatureSetErrorCodes as m}from"./featureset/support/errorsupport.js";import{isSupportedSourceLayer as y,extractServiceUrl as h,isSupportedLayer as w}from"./featureset/support/shared.js";import _ from"../core/Loadable.js";import{WhereClause as L}from"../core/sql/WhereClause.js";import I from"../layers/FeatureLayer.js";import S from"../layers/Layer.js";import C from"../portal/PortalItem.js";function F(){null===f.applicationCache&&(f.applicationCache=new f)}async function g(e,t,a){if(f.applicationCache){const a=f.applicationCache.getLayerInfo(e);if(a){const r=await a;return new I({url:e,outFields:t,sourceJSON:r})}const n=new I({url:e,outFields:t}),i=(async()=>(await n.load(),n.sourceJSON))();if(f.applicationCache){f.applicationCache.setLayerInfo(e,i);try{return await i,n}catch(r){throw f.applicationCache.clearLayerInfo(e),r}}return await i,n}if(null!=a){const r=a.getCachedLayerMetadata(e);if(r){const a=await r;return new I({url:e,outFields:t,sourceJSON:a})}const i=new I({url:e,outFields:t}),s=(async()=>(await i.load(),i.sourceJSON))();a.setCachedLayerMetadata(e,s);try{return await s,i}catch(n){throw a.removeCachedLayerMetadata(e,s),n}}return new I({url:e,outFields:t})}async function N(e,t,a,r,n,i=null){return T(await g(e,["*"],n),t,a,r,n,i)}function T(e,t=null,a=null,r=!0,n=null,i=null){if("catalog-footprint"===e.type)return T(e.parent,t,a,r,n,i);if("subtype-sublayer"===e.type){const s=T(e.parent,t,a,r,n,i);return s.filter(L.create(e.parent.subtypeField+"="+e.subtypeCode.toString(),e.parent.fieldsIndex,s.dateFieldsTimeZoneDefaultUTC))}if(y(e)){const s={layer:e,spatialReference:t,outFields:a,includeGeometry:r,lrucache:n,interceptor:i};return!0==!(e.url||!e.source)?new c(s):new u(s)}throw new Error(`Unsupported layer type: ${e.type}`)}async function A(t){if(null!==f.applicationCache){const e=f.applicationCache.getLayerInfo(t);if(null!==e)return e}const a=(async()=>{const a=await e(t,{responseType:"json",query:{f:"json"}});return a.data?a.data:null})();if(null!==f.applicationCache){f.applicationCache.setLayerInfo(t,a);try{return await a}catch(r){throw f.applicationCache.clearLayerInfo(t),r}}return a}async function b(t,a){const r="QUERYDATAELEMTS:"+a.toString()+":"+t;if(null!==f.applicationCache){const e=f.applicationCache.getLayerInfo(r);if(null!==e)return e}const n=(async()=>{const r=await e(t+"/queryDataElements",{method:"post",responseType:"json",query:{layers:JSON.stringify([a.toString()]),f:"json"}});if(r.data){const e=r.data;if(e.layerDataElements?.[0])return e.layerDataElements[0]}throw new p(m.DataElementsNotFound)})();if(null!==f.applicationCache){f.applicationCache.setLayerInfo(r,n);try{return await n}catch(i){throw f.applicationCache.clearLayerInfo(r),i}}return n}async function k(t,a){if(null!==f.applicationCache){const e=f.applicationCache.getLayerInfo(t);if(null!==e)return e}if(null!=a){const e=a.getCachedServiceMetadata(t);if(null!=e)return e}const r=(async()=>{const a=await e(t,{responseType:"json",query:{f:"json"}});if(a.data){const e=a.data;return e.layers||(e.layers=[]),e.tables||(e.tables=[]),e}return{layers:[],tables:[]}})();if(null!==f.applicationCache){f.applicationCache.setLayerInfo(t,r);try{return await r}catch(n){throw f.applicationCache.clearLayerInfo(t),n}}if(null!=a){a.setCachedServiceMetadata(t,r);try{return await r}catch(i){throw a.removeCachedServiceMetadata(t,r),i}}return r}async function O(e,t){const a={metadata:null,networkId:-1,unVersion:3,terminals:[],queryelem:null,layerNameLkp:{},lkp:null},r=await k(e,null);if(a.metadata=r,void 0!==r.controllerDatasetLayers?.utilityNetworkLayerId&&null!==r.controllerDatasetLayers.utilityNetworkLayerId){if(r.layers)for(const e of r.layers)a.layerNameLkp[e.id]=e.name;if(r.tables)for(const e of r.tables)a.layerNameLkp[e.id]=e.name;const n=r.controllerDatasetLayers.utilityNetworkLayerId;a.networkId=n;const i=await b(e,n);if(i){a.queryelem=i,a.queryelem?.dataElement&&void 0!==a.queryelem.dataElement.schemaGeneration&&(a.unVersion=a.queryelem.dataElement.schemaGeneration),a.lkp={},a.queryelem.dataElement.domainNetworks||(a.queryelem.dataElement.domainNetworks=[]);for(const e of a.queryelem.dataElement.domainNetworks){for(const t of e.edgeSources??[]){const e={layerId:t.layerId,sourceId:t.sourceId,className:a.layerNameLkp[t.layerId]??null};e.className&&(a.lkp[e.className]=e)}for(const t of e.junctionSources??[]){const e={layerId:t.layerId,sourceId:t.sourceId,className:a.layerNameLkp[t.layerId]??null};e.className&&(a.lkp[e.className]=e)}}if(a.queryelem.dataElement.terminalConfigurations)for(const e of a.queryelem.dataElement.terminalConfigurations)for(const t of e.terminals)a.terminals.push({terminalId:t.terminalId,terminalName:t.terminalName});const r=await A(e+"/"+n);if(void 0!==r.systemLayers?.associationsTableId&&null!==r.systemLayers.associationsTableId){const n=[];a.unVersion>=4&&(n.push("STATUS"),n.push("PERCENTALONG"));let i=await N(e+"/"+r.systemLayers.associationsTableId.toString(),t,["OBJECTID","FROMNETWORKSOURCEID","TONETWORKSOURCEID","FROMGLOBALID","TOGLOBALID","TOTERMINALID","FROMTERMINALID","ASSOCIATIONTYPE","ISCONTENTVISIBLE","GLOBALID",...n],!1,null,null);return await i.load(),a.unVersion>=4&&(i=i.filter(L.create("STATUS NOT IN (1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62, 63)",i.getFieldsIndex(),i.dateFieldsTimeZoneDefaultUTC)),await i.load()),{lkp:a.lkp,associations:i,unVersion:a.unVersion,terminals:a.terminals}}return{associations:null,unVersion:a.unVersion,lkp:null,terminals:[]}}return{associations:null,unVersion:a.unVersion,lkp:null,terminals:[]}}return{associations:null,unVersion:a.unVersion,lkp:null,terminals:[]}}async function E(e,t,a,r=null,n=null,i=!0,s=null,l=null){let o=e.serviceUrl();if(!o)return null;o="/"===o.charAt(o.length-1)?o+t.relatedTableId.toString():o+"/"+t.relatedTableId.toString();const u=await N(o,r,n,i,s,l);return new d({layer:e,relatedLayer:u,relationship:t,objectId:a,spatialReference:r,outFields:n,includeGeometry:i,lrucache:s,interceptor:l})}n.registerAction(),i.registerAction(),s.registerAction(),l.registerAction(),o.registerAction();class j extends t{constructor(e,t=null,a=null,r=null){super(),this._map=e,this._overridespref=t,this._lrucache=a,this._interceptor=r,this._instantLayers=[]}_makeAndAddFeatureSet(e,t=!0,a=null){const r=T(e,this._overridespref,null===a?["*"]:a,t,this._lrucache,this._interceptor);return this._instantLayers.push({featureset:r,opitem:e,includeGeometry:t,outFields:JSON.stringify(a)}),r}async featureSetByName(e,t=!0,a=null){if(_.isLoadable(this._map)&&!this._map.loaded)return await this._map.load(),this.featureSetByName(e,t,a);null===a&&(a=["*"]),a=(a=a.slice(0)).sort();const r=JSON.stringify(a);for(let i=0;i<this._instantLayers.length;i++){const a=this._instantLayers[i];if(a.opitem.title===e&&a.includeGeometry===t&&a.outFields===r)return this._instantLayers[i].featureset}const n=this._map.allLayers.find((t=>w(t)&&t.title===e));if(null!=n)return this._makeAndAddFeatureSet(n,t,a);if(this._map.tables){const r=this._map.tables.find((t=>t.title===e));if(null!=r){if(r instanceof I)return this._makeAndAddFeatureSet(r,t,a);if(null==r._materializedTable){const e=r.outFields?r:{...r,outFields:["*"]};r._materializedTable=new I(e)}return await r._materializedTable.load(),this._makeAndAddFeatureSet(r._materializedTable,t,a)}}return null}async featureSetById(e,t=!0,a=["*"]){if(_.isLoadable(this._map)&&!this._map.loaded)return await this._map.load(),this.featureSetById(e,t,a);null===a&&(a=["*"]),a=(a=a.slice(0)).sort();const r=JSON.stringify(a);for(let i=0;i<this._instantLayers.length;i++){const a=this._instantLayers[i];if(a.opitem.id===e&&a.includeGeometry===t&&a.outFields===r)return this._instantLayers[i].featureset}const n=this._map.allLayers.find((t=>w(t)&&t.id===e));if(n)return this._makeAndAddFeatureSet(n,t,a);if(this._map.tables){const r=this._map.tables.find((t=>t.id===e));if(null!=r){if(r instanceof I)return this._makeAndAddFeatureSet(r,t,a);if(null==r._materializedTable){const e={...r,outFields:["*"]};r._materializedTable=new I(e)}return await r._materializedTable.load(),this._makeAndAddFeatureSet(r._materializedTable,t,a)}}return null}}class D extends t{constructor(e,t=null,a=null,r=null){super(),this._url=e,this._overridespref=t,this._lrucache=a,this._interceptor=r,this.metadata=null,this._instantLayers=[]}get url(){return this._url}_makeAndAddFeatureSet(e,t=!0,a=null){const r=T(e,this._overridespref,null===a?["*"]:a,t,this._lrucache);return this._instantLayers.push({featureset:r,opitem:e,includeGeometry:t,outFields:JSON.stringify(a)}),r}async _loadMetaData(){const e=await k(this._url,this._lrucache);return this.metadata=e,e}load(){return this._loadMetaData()}clone(){return new D(this._url,this._overridespref,this._lrucache,this._interceptor)}async featureSetByName(e,t=!0,a=null){null===a&&(a=["*"]),a=(a=a.slice(0)).sort();const r=JSON.stringify(a);for(let s=0;s<this._instantLayers.length;s++){const a=this._instantLayers[s];if(a.opitem.title===e&&a.includeGeometry===t&&a.outFields===r)return this._instantLayers[s].featureset}const n=await this._loadMetaData();let i=null;for(const s of n.layers??[])s.name===e&&(i=s);if(!i)for(const s of n.tables??[])s.name===e&&(i=s);if(i){const e=await g(this._url+"/"+i.id,["*"],this._lrucache);return this._makeAndAddFeatureSet(e,t,a)}return null}async featureSetById(e,t=!0,a=["*"]){null===a&&(a=["*"]),a=(a=a.slice(0)).sort();const r=JSON.stringify(a);e=null!=e?e.toString():"";for(let s=0;s<this._instantLayers.length;s++){const a=this._instantLayers[s];if(a.opitem.id===e&&a.includeGeometry===t&&a.outFields===r)return this._instantLayers[s].featureset}const n=await this._loadMetaData();let i=null;for(const s of n.layers??[])null!==s.id&&void 0!==s.id&&s.id.toString()===e&&(i=s);if(!i)for(const s of n.tables??[])null!==s.id&&void 0!==s.id&&s.id.toString()===e&&(i=s);if(i){const e=await g(this._url+"/"+i.id,["*"],this._lrucache);return this._makeAndAddFeatureSet(e,t,a)}return null}}function v(e,t,a=null,r=null){return new j(e,t,a,r)}function M(e,t,a=null,r=null){return new D(e,t,a,r)}function q(e,t,n,i,s){if(null===e)return null;if(a(e)){switch(t){case"datasource":return e.getDataSourceFeatureSet();case"parent":return e;case"root":return e.getRootFeatureSet()}return null}if(e instanceof S&&y(e)){const a=e;switch(t){case"datasource":return T(a,s,a.outFields,!0,n,i).getDataSourceFeatureSet();case"parent":case"root":return T(a,s,a.outFields,!0,n,i)}return null}if(r(e)){switch(t){case"datasource":return T(e.parent,s,e.parent.outFields,!0,n,i).getDataSourceFeatureSet();case"parent":case"root":return T(e,s,e.parent.outFields,!0,n,i)}return null}return null}async function G(e,t,a,r,n,i,s,l=null){if(f.applicationCache){const o=f.applicationCache.getLayerInfo(e+":"+i.url);if(o){const e=await o;return T(await g(h(e.url??"")+"/"+t,["*"],s),a,r,n,s,l)}}if(null!=s){const o=s.getCachedPortalItem(i.url,e);if(null!=o){const e=await o;return T(await g(h(e.url??"")+"/"+t,["*"],s),a,r,n,s,l)}}const o=new C({id:e,portal:i}).load();f.applicationCache?f.applicationCache.setLayerInfo(e+":"+i.url,o):null!=s&&s.setCachedPortalItem(i.url,e,o);try{const e=await o;return T(await g(h(e.url??"")+"/"+t,["*"],s),a,r,n,s,l)}catch(u){throw f.applicationCache&&f.applicationCache.clearLayerInfo(e+":"+i.url),null!=s&&s.removeCachedPortalItem(i.url,e,o),u}}export{O as constructAssociationMetaDataFeatureSetFromUrl,T as constructFeatureSet,G as constructFeatureSetFromPortalItem,E as constructFeatureSetFromRelationship,N as constructFeatureSetFromUrl,q as convertToFeatureSet,v as createFeatureSetCollectionFromMap,M as createFeatureSetCollectionFromService,F as initialiseMetaDataCache};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- class e{constructor(e){const s=this;s._keys=[],s._values=[],s.length=0,e&&e.forEach((e=>{s.set(e[0],e[1])}))}entries(){return[].slice.call(this.keys().map(((e,s)=>[e,this._values[s]])))}keys(){return[].slice.call(this._keys)}values(){return[].slice.call(this._values)}has(e){return this._keys.includes(e)}get(e){const s=this._keys.indexOf(e);return s>-1?this._values[s]:null}deepGet(s){if(!s?.length)return null;const t=(s,i)=>null==s?null:i.length?t(s instanceof e?s.get(i[0]):s[i[0]],i.slice(1)):s;return t(this.get(s[0]),s.slice(1))}set(e,s){const t=this,i=this._keys.indexOf(e);return i>-1?t._values[i]=s:(t._keys.push(e),t._values.push(s),t.length=t._values.length),this}sortedSet(e,s,t,i){const h=this,l=this._keys.length,r=t||0,n=void 0!==i?i:l-1;if(0===l)return h._keys.push(e),h._values.push(s),h;if(e===this._keys[r])return this._values.splice(r,0,s),this;if(e===this._keys[n])return this._values.splice(n,0,s),this;if(e>this._keys[n])return this._keys.splice(n+1,0,e),this._values.splice(n+1,0,s),this;if(e<this._keys[r])return this._values.splice(r,0,s),this._keys.splice(r,0,e),this;if(r>=n)return this;const u=r+Math.floor((n-r)/2);return e<this._keys[u]?this.sortedSet(e,s,r,u-1):e>this._keys[u]?this.sortedSet(e,s,u+1,n):this}size(){return this.length}clear(){const e=this;return e._keys.length=e.length=e._values.length=0,this}delete(e){const s=this,t=s._keys.indexOf(e);return t>-1&&(s._keys.splice(t,1),s._values.splice(t,1),s.length=s._keys.length,!0)}forEach(e){this._keys.forEach(((s,t)=>{e(this._values[t],s,t)}))}map(e){return this.keys().map(((s,t)=>e(this._values[t],s,t)))}filter(e){const s=this;return s._keys.forEach(((t,i)=>{!1===e(s._values[i],t,i)&&s.delete(t)})),this}clone(){return new e(this.entries())}}class s{constructor(s=20){this._maxEntries=s,this._values=new e}delete(e){this._values.has(e)&&this._values.delete(e)}get(e){let s=null;return this._values.has(e)&&(s=this._values.get(e),this._values.delete(e),this._values.set(e,s)),s}put(e,s){if(this._values.size()>=this._maxEntries){const e=this._values.keys()[0];this._values.delete(e)}this._values.set(e,s)}}class t{constructor(e=20){this._maxEntries=e,this._cache=new s(this._maxEntries)}clear(){this._cache=new s(this._maxEntries)}addToCache(e,s){this._cache.put(e,s)}removeFromCache(e){this._cache.delete(e)}getFromCache(e){return this._cache.get(e)}}export{t as default};
5
+ class e{constructor(e){const t=this;t._keys=[],t._values=[],t.length=0,e&&e.forEach((e=>{t.set(e[0],e[1])}))}entries(){return[].slice.call(this.keys().map(((e,t)=>[e,this._values[t]])))}keys(){return[].slice.call(this._keys)}values(){return[].slice.call(this._values)}has(e){return this._keys.includes(e)}get(e){const t=this._keys.indexOf(e);return t>-1?this._values[t]:null}deepGet(t){if(!t?.length)return null;const s=(t,a)=>null==t?null:a.length?s(t instanceof e?t.get(a[0]):t[a[0]],a.slice(1)):t;return s(this.get(t[0]),t.slice(1))}set(e,t){const s=this,a=this._keys.indexOf(e);return a>-1?s._values[a]=t:(s._keys.push(e),s._values.push(t),s.length=s._values.length),this}sortedSet(e,t,s,a){const i=this,h=this._keys.length,r=s||0,l=void 0!==a?a:h-1;if(0===h)return i._keys.push(e),i._values.push(t),i;if(e===this._keys[r])return this._values.splice(r,0,t),this;if(e===this._keys[l])return this._values.splice(l,0,t),this;if(e>this._keys[l])return this._keys.splice(l+1,0,e),this._values.splice(l+1,0,t),this;if(e<this._keys[r])return this._values.splice(r,0,t),this._keys.splice(r,0,e),this;if(r>=l)return this;const n=r+Math.floor((l-r)/2);return e<this._keys[n]?this.sortedSet(e,t,r,n-1):e>this._keys[n]?this.sortedSet(e,t,n+1,l):this}size(){return this.length}clear(){const e=this;return e._keys.length=e.length=e._values.length=0,this}delete(e){const t=this,s=t._keys.indexOf(e);return s>-1&&(t._keys.splice(s,1),t._values.splice(s,1),t.length=t._keys.length,!0)}forEach(e){this._keys.forEach(((t,s)=>{e(this._values[s],t,s)}))}map(e){return this.keys().map(((t,s)=>e(this._values[s],t,s)))}filter(e){const t=this;return t._keys.forEach(((s,a)=>{!1===e(t._values[a],s,a)&&t.delete(s)})),this}clone(){return new e(this.entries())}}class t{constructor(t=20){this._maxEntries=t,this._values=new e}delete(e){this._values.has(e)&&this._values.delete(e)}get(e){let t=null;return this._values.has(e)&&(t=this._values.get(e),this._values.delete(e),this._values.set(e,t)),t}put(e,t){if(this._values.size()>=this._maxEntries){const e=this._values.keys()[0];this._values.delete(e)}this._values.set(e,t)}}class s{constructor(e=20){this._maxEntries=e,this._cache=new t(this._maxEntries),this._layerMetadata=new t(this._maxEntries),this._serviceMetadata=new t(this._maxEntries),this._portalItems=new t(this._maxEntries)}clear(){this._cache=new t(this._maxEntries),this._layerMetadata=new t(this._maxEntries),this._serviceMetadata=new t(this._maxEntries),this._portalItems=new t(this._maxEntries)}addToCache(e,t){this._cache.put(e,t)}removeFromCache(e){this._cache.delete(e)}getFromCache(e){return this._cache.get(e)}getCachedLayerMetadata(e){return this._layerMetadata.get(e)}setCachedLayerMetadata(e,t){this._layerMetadata.put(e,t)}removeCachedLayerMetadata(e,t){this._layerMetadata.get(e)===t&&this._layerMetadata.delete(e)}getCachedServiceMetadata(e){return this._serviceMetadata.get(e)}setCachedServiceMetadata(e,t){this._serviceMetadata.put(e,t)}removeCachedServiceMetadata(e,t){this._serviceMetadata.get(e)===t&&this._serviceMetadata.delete(e)}getCachedPortalItem(e,t){return this._portalItems.get(`${t}:${e}`)}setCachedPortalItem(e,t,s){this._portalItems.put(`${t}:${e}`,s)}removeCachedPortalItem(e,t,s){const a=`${t}:${e}`;this._portalItems.get(a)===s&&this._portalItems.delete(a)}}export{s 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.31/esri/copyright.txt for details.
4
4
  */
5
- import{rad2deg as t}from"../../core/mathUtils.js";import n from"../../geometry/Point.js";import{segmentIntersects as e}from"../../geometry/support/intersectsBase.js";function r(t,n,e){return Math.sqrt((t[0]-n[0])**2+(t[1]-n[1])**2+(void 0!==t[2]&&void 0!==n[2]?(t[2]*e-n[2]*e)**2:0))}function o(t,n,e){return Math.sqrt((t[0]-n[0])**2+(t[1]-n[1])**2+(void 0!==t[2]&&void 0!==n[2]?(t[2]*e-n[2]*e)**2:0))}const s=[];for(const N of[[9002,56146130,6131,6132,8050,8051,8228],[9003,5702,6358,6359,6360,8052,8053],[9095,5754]]){const t=N[0];for(let n=1;n<N.length;n++)s[N[n]]=t}const i=[];function c(t){return t.vcsWkid&&void 0!==s[t.vcsWkid]?i[s[t.vcsWkid]]:t.latestVcsWkid&&void 0!==s[t.latestVcsWkid]?i[s[t.latestVcsWkid]]:1}function f(t,n,e){const r={x:0,y:0};n&&(r.z=0),e&&(r.m=0);let o=0,s=t[0];for(let i=0;i<t.length;i++){const c=t[i];if(!1===x(c,s)){const t=h(s,c,n),i=u(s,c,n,e);i.x*=t,i.y*=t,r.x+=i.x,r.y+=i.y,n&&(i.z*=t,r.z+=i.z),e&&(i.m*=t,r.m+=i.m),o+=t,s=c}}return o>0?(r.x/=o,r.y/=o,n&&(r.z/=o),e&&(r.m/=o)):(r.x=t[0][0],r.y=t[0][1],n&&(r.z=t[0][2]),e&&n?r.m=t[0][3]:e&&(r.m=t[0][2])),r}function u(t,n,e,r){const o={x:(t[0]+n[0])/2,y:(t[1]+n[1])/2};return e&&(o.z=(t[2]+n[2])/2),e&&r?o.m=(t[3]+n[3])/2:r&&(o.m=(t[2]+n[2])/2),o}function a(t,n){if(t.length<=1)return 0;let e=0;for(let r=1;r<t.length;r++)e+=h(t[r-1],t[r],n);return e}function h(t,n,e){const r=n[0]-t[0],o=n[1]-t[1];if(e){const t=n[2]-n[2];return Math.sqrt(r*r+o*o+t*t)}return Math.sqrt(r*r+o*o)}function l(t,n,e){const r=n[0]-t[0],o=n[1]-t[1];if(e){const t=n[2]-n[2];return r*r+o*o+t*t}return r*r+o*o}function x(t,n){if(t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e]!==n[e])return!1;return!0}function y(t){const e={x:0,y:0,spatialReference:t.spatialReference.toJSON()},r={x:0,y:0,spatialReference:t.spatialReference.toJSON()};let o=0,s=0;for(let n=0;n<t.paths.length;n++){if(0===t.paths[n].length)continue;const i=a(t.paths[n],!0===t.hasZ);if(0===i){const r=f(t.paths[n],!0===t.hasZ,!0===t.hasM);e.x+=r.x,e.y+=r.y,!0===t.hasZ&&(e.z+=r.z),!0===t.hasM&&(e.m+=r.m),++o}else{const e=f(t.paths[n],!0===t.hasZ,!0===t.hasM);r.x+=e.x*i,r.y+=e.y*i,!0===t.hasZ&&(r.z+=e.z*i),!0===t.hasM&&(r.m+=e.m*i),s+=i}}return s>0?(r.x/=s,r.y/=s,!0===t.hasZ&&(r.z/=s),!0===t.hasM&&(r.m/=s),new n(r)):o>0?(e.x/=o,e.y/=o,!0===t.hasZ&&(r.z/=o),!0===t.hasM&&(e.m/=o),new n(e)):null}function m(t){if(0===t.points.length)return null;let e=0,r=0,o=0,s=0;for(let n=0;n<t.points.length;n++){const i=t.getPoint(n);!0===i.hasZ&&(o+=i.z),!0===i.hasM&&(s+=i.m),e+=i.x,r+=i.y,s+=i.m}const i={x:e/t.points.length,y:r/t.points.length,spatialReference:null};return i.spatialReference=t.spatialReference.toJSON(),!0===t.hasZ&&(i.z=o/t.points.length),!0===t.hasM&&(i.m=s/t.points.length),new n(i)}function p(t,n){return t.x*n.x+t.y*n.y}function g(t,n){return t.x*n.y-n.x*t.y}function M(t,n,e=0){for(;t<e;)t+=n;const r=e+n;for(;t>=r;)t-=n;return t}function z(t,n){return Math.atan2(n.y-t.y,n.x-t.x)}function d(t,n){return M(z(t,n),2*Math.PI)*(180/Math.PI)}function v(t,n){return M(Math.PI/2-z(t,n),2*Math.PI)*(180/Math.PI)}function P(t,n,e){const r={x:t.x-n.x,y:t.y-n.y},o={x:e.x-n.x,y:e.y-n.y};return Math.atan2(g(r,o),p(r,o))}function Z(n,e,r){return t(M(P(n,e,r),2*Math.PI))}function I(n,e,r){return t(M(-1*P(n,e,r),2*Math.PI))}i[9002]=.3048,i[9003]=.3048006096012192,i[9095]=.3048007491;const R=[0,0];function k(t){for(let n=0;n<t.length;n++){const r=t[n];for(let s=0;s<r.length-1;s++){const o=r[s],i=r[s+1];for(let r=n+1;r<t.length;r++)for(let n=0;n<t[r].length-1;n++){const s=t[r][n],c=t[r][n+1];if(e(o,i,s,c,R)&&!(R[0]===o[0]&&R[1]===o[1]||R[0]===s[0]&&R[1]===s[1]||R[0]===i[0]&&R[1]===i[1]||R[0]===c[0]&&R[1]===c[1]))return!0}}const o=r.length;if(!(o<3))for(let t=0;t<=o-2;t++){const n=r[t],s=r[t+1];for(let i=t+2;i<=o-2;i++){const t=r[i],o=r[i+1];if(e(n,s,t,o,R)&&!(R[0]===n[0]&&R[1]===n[1]||R[0]===t[0]&&R[1]===t[1]||R[0]===s[0]&&R[1]===s[1]||R[0]===o[0]&&R[1]===o[1]))return!0}}}return!1}function W(t,n,e){return Math.max(n,Math.min(e,t))}function q(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function j(t){return t[0]*t[0]+t[1]*t[1]+t[2]*t[2]}function w(t,n,e){const r=[e[0]-n[0],e[1]-n[1],e[2]-n[2]],o=W(q(r,[t[0]-n[0],t[1]-n[1],t[2]-n[2]])/j(r),0,1);return[n[0]+(e[0]-n[0])*o,n[1]+(e[1]-n[1])*o,n[2]+(e[2]-n[2])*o]}function J(t,n,e){let r=0;const o=e[0]-n[0],s=e[1]-n[1],i=o*o+s*s;if(0===i)r=.5;else{r=((t[0]-n[0])*o+(t[1]-n[1])*s)/i,r<0?r=0:r>1&&(r=1)}return r<=.5?[n[0]+(e[0]-n[0])*r,n[1]+(e[1]-n[1])*r]:[e[0]-(e[0]-n[0])*(1-r),e[1]-(e[1]-n[1])*(1-r)]}export{d as angle2D,Z as angleBetween2D,P as angleBetweenRad,z as angleRad,v as bearing2D,I as bearingBetween2D,m as centroidMultiPoint,y as centroidPolyline,J as closestPointOnLineSegment,w as closestPointOnLineSegmentWithZ,c as getMetersPerVerticalUnitForSR,k as pathsSelfIntersecting,h as segmentLength,r as segmentLength3d,o as segmentLength3dSqr,l as segmentLengthSqr};
5
+ import{rad2deg as t}from"../../core/mathUtils.js";import n from"../../geometry/Point.js";import{segmentIntersects as e}from"../../geometry/support/intersectsBase.js";function r(t,n,e){return Math.sqrt((t[0]-n[0])**2+(t[1]-n[1])**2+(void 0!==t[2]&&void 0!==n[2]?(t[2]*e-n[2]*e)**2:0))}function o(t,n,e){return(t[0]-n[0])**2+(t[1]-n[1])**2+(void 0!==t[2]&&void 0!==n[2]?(t[2]*e-n[2]*e)**2:0)}const s=[];for(const N of[[9002,56146130,6131,6132,8050,8051,8228],[9003,5702,6358,6359,6360,8052,8053],[9095,5754]]){const t=N[0];for(let n=1;n<N.length;n++)s[N[n]]=t}const i=[];function c(t){return t.vcsWkid&&void 0!==s[t.vcsWkid]?i[s[t.vcsWkid]]:t.latestVcsWkid&&void 0!==s[t.latestVcsWkid]?i[s[t.latestVcsWkid]]:1}function f(t,n,e){const r={x:0,y:0};n&&(r.z=0),e&&(r.m=0);let o=0,s=t[0];for(let i=0;i<t.length;i++){const c=t[i];if(!1===x(c,s)){const t=h(s,c,n),i=u(s,c,n,e);i.x*=t,i.y*=t,r.x+=i.x,r.y+=i.y,n&&(i.z*=t,r.z+=i.z),e&&(i.m*=t,r.m+=i.m),o+=t,s=c}}return o>0?(r.x/=o,r.y/=o,n&&(r.z/=o),e&&(r.m/=o)):(r.x=t[0][0],r.y=t[0][1],n&&(r.z=t[0][2]),e&&n?r.m=t[0][3]:e&&(r.m=t[0][2])),r}function u(t,n,e,r){const o={x:(t[0]+n[0])/2,y:(t[1]+n[1])/2};return e&&(o.z=(t[2]+n[2])/2),e&&r?o.m=(t[3]+n[3])/2:r&&(o.m=(t[2]+n[2])/2),o}function a(t,n){if(t.length<=1)return 0;let e=0;for(let r=1;r<t.length;r++)e+=h(t[r-1],t[r],n);return e}function h(t,n,e){const r=n[0]-t[0],o=n[1]-t[1];if(e){const t=n[2]-n[2];return Math.sqrt(r*r+o*o+t*t)}return Math.sqrt(r*r+o*o)}function l(t,n,e){const r=n[0]-t[0],o=n[1]-t[1];if(e){const t=n[2]-n[2];return r*r+o*o+t*t}return r*r+o*o}function x(t,n){if(t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e]!==n[e])return!1;return!0}function y(t){const e={x:0,y:0,spatialReference:t.spatialReference.toJSON()},r={x:0,y:0,spatialReference:t.spatialReference.toJSON()};let o=0,s=0;for(let n=0;n<t.paths.length;n++){if(0===t.paths[n].length)continue;const i=a(t.paths[n],!0===t.hasZ);if(0===i){const r=f(t.paths[n],!0===t.hasZ,!0===t.hasM);e.x+=r.x,e.y+=r.y,!0===t.hasZ&&(e.z+=r.z),!0===t.hasM&&(e.m+=r.m),++o}else{const e=f(t.paths[n],!0===t.hasZ,!0===t.hasM);r.x+=e.x*i,r.y+=e.y*i,!0===t.hasZ&&(r.z+=e.z*i),!0===t.hasM&&(r.m+=e.m*i),s+=i}}return s>0?(r.x/=s,r.y/=s,!0===t.hasZ&&(r.z/=s),!0===t.hasM&&(r.m/=s),new n(r)):o>0?(e.x/=o,e.y/=o,!0===t.hasZ&&(r.z/=o),!0===t.hasM&&(e.m/=o),new n(e)):null}function m(t){if(0===t.points.length)return null;let e=0,r=0,o=0,s=0;for(let n=0;n<t.points.length;n++){const i=t.getPoint(n);!0===i.hasZ&&(o+=i.z),!0===i.hasM&&(s+=i.m),e+=i.x,r+=i.y,s+=i.m}const i={x:e/t.points.length,y:r/t.points.length,spatialReference:null};return i.spatialReference=t.spatialReference.toJSON(),!0===t.hasZ&&(i.z=o/t.points.length),!0===t.hasM&&(i.m=s/t.points.length),new n(i)}function p(t,n){return t.x*n.x+t.y*n.y}function g(t,n){return t.x*n.y-n.x*t.y}function M(t,n,e=0){for(;t<e;)t+=n;const r=e+n;for(;t>=r;)t-=n;return t}function z(t,n){return Math.atan2(n.y-t.y,n.x-t.x)}function d(t,n){return M(z(t,n),2*Math.PI)*(180/Math.PI)}function v(t,n){return M(Math.PI/2-z(t,n),2*Math.PI)*(180/Math.PI)}function P(t,n,e){const r={x:t.x-n.x,y:t.y-n.y},o={x:e.x-n.x,y:e.y-n.y};return Math.atan2(g(r,o),p(r,o))}function Z(n,e,r){return t(M(P(n,e,r),2*Math.PI))}function I(n,e,r){return t(M(-1*P(n,e,r),2*Math.PI))}i[9002]=.3048,i[9003]=.3048006096012192,i[9095]=.3048007491;const R=[0,0];function k(t){for(let n=0;n<t.length;n++){const r=t[n];for(let s=0;s<r.length-1;s++){const o=r[s],i=r[s+1];for(let r=n+1;r<t.length;r++)for(let n=0;n<t[r].length-1;n++){const s=t[r][n],c=t[r][n+1];if(e(o,i,s,c,R)&&!(R[0]===o[0]&&R[1]===o[1]||R[0]===s[0]&&R[1]===s[1]||R[0]===i[0]&&R[1]===i[1]||R[0]===c[0]&&R[1]===c[1]))return!0}}const o=r.length;if(!(o<3))for(let t=0;t<=o-2;t++){const n=r[t],s=r[t+1];for(let i=t+2;i<=o-2;i++){const t=r[i],o=r[i+1];if(e(n,s,t,o,R)&&!(R[0]===n[0]&&R[1]===n[1]||R[0]===t[0]&&R[1]===t[1]||R[0]===s[0]&&R[1]===s[1]||R[0]===o[0]&&R[1]===o[1]))return!0}}}return!1}function W(t,n,e){return Math.max(n,Math.min(e,t))}function j(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function q(t){return t[0]*t[0]+t[1]*t[1]+t[2]*t[2]}function w(t,n,e){const r=[e[0]-n[0],e[1]-n[1],e[2]-n[2]],o=W(j(r,[t[0]-n[0],t[1]-n[1],t[2]-n[2]])/q(r),0,1);return[n[0]+(e[0]-n[0])*o,n[1]+(e[1]-n[1])*o,n[2]+(e[2]-n[2])*o]}function J(t,n,e){let r=0;const o=e[0]-n[0],s=e[1]-n[1],i=o*o+s*s;if(0===i)r=.5;else{r=((t[0]-n[0])*o+(t[1]-n[1])*s)/i,r<0?r=0:r>1&&(r=1)}return r<=.5?[n[0]+(e[0]-n[0])*r,n[1]+(e[1]-n[1])*r]:[e[0]-(e[0]-n[0])*(1-r),e[1]-(e[1]-n[1])*(1-r)]}export{d as angle2D,Z as angleBetween2D,P as angleBetweenRad,z as angleRad,v as bearing2D,I as bearingBetween2D,m as centroidMultiPoint,y as centroidPolyline,J as closestPointOnLineSegment,w as closestPointOnLineSegmentWithZ,c as getMetersPerVerticalUnitForSR,k as pathsSelfIntersecting,h as segmentLength,r as segmentLength3d,o as segmentLength3dSqr,l as segmentLengthSqr};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{version as n}from"../../kernel.js";import t from"../ArcadePortal.js";import e from"../Dictionary.js";import{ArcadeExecutionError as r,ExecutionErrorCodes as i}from"../executionError.js";import{cloneGeometry as a,convertSquareUnitsToCode as o,convertLinearUnitsToCode as l}from"../kernel.js";import{I as s,H as u,k as c,n as f,m as d,j as m,o as w,q as h,x as y,u as p,K as g,J as v,L as P,M as I,g as A,h as F,b as R,N as j}from"../../chunks/languageUtils.js";import{getPortal as x}from"../portalUtils.js";import{centroidPolyline as b,centroidMultiPoint as N,getMetersPerVerticalUnitForSR as O,segmentLength3d as S}from"./centroid.js";import{measureToCoordinate as D,pointToCoordinate as k,distanceToCoordinate as L}from"./measures.js";import{getMetersPerUnitForSR as M}from"../../core/unitUtils.js";import T from"../../geometry/Extent.js";import J from"../../geometry/Geometry.js";import{disjoint as Z,intersects as C,touches as U,crosses as E,within as q,contains as z,overlaps as W,equals as G,relate as H,intersect as K,union as V,difference as B,symmetricDifference as Q,clip as X,cut as Y,planarArea as $,geodesicArea as _,planarLength as nn,geodesicLength as tn,distance as en,densify as rn,geodesicDensify as an,generalize as on,buffer as ln,geodesicBuffer as sn,offset as un,rotate as cn,simplify as fn,isSimple as dn,convexHull as mn,nearestCoordinate as wn,nearestVertex as hn}from"../../geometry/geometryEngineAsync.js";import yn from"../../geometry/Multipoint.js";import pn from"../../geometry/Point.js";import gn from"../../geometry/Polygon.js";import vn from"../../geometry/Polyline.js";import{fromJSON as Pn}from"../../geometry/support/jsonUtils.js";import In from"../../portal/Portal.js";import{lookupUser as An}from"../../portal/support/utils.js";function Fn(t){return 0===n.indexOf("4.")?gn.fromExtent(t):new gn({spatialReference:t.spatialReference,rings:[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]]})}function Rn(n,t,e){if(u(n,2,2,t,e),n[0]instanceof J&&n[1]instanceof J);else if(n[0]instanceof J&&null===n[1]);else if(n[1]instanceof J&&null===n[0]);else if(null!==n[0]||null!==n[1])throw new r(t,i.InvalidParameter,e)}async function jn(n,t){if("polygon"!==n.type&&"polyline"!==n.type&&"extent"!==n.type)return 0;let e=1;if(n.spatialReference.vcsWkid||n.spatialReference.latestVcsWkid){e=O(n.spatialReference)/M(n.spatialReference)}let r=0;if("polyline"===n.type)for(const a of n.paths)for(let n=1;n<a.length;n++)r+=S(a[n],a[n-1],e);else if("polygon"===n.type)for(const a of n.rings){for(let n=1;n<a.length;n++)r+=S(a[n],a[n-1],e);(a[0][0]!==a[a.length-1][0]||a[0][1]!==a[a.length-1][1]||void 0!==a[0][2]&&a[0][2]!==a[a.length-1][2])&&(r+=S(a[0],a[a.length-1],e))}else"extent"===n.type&&(r+=2*S([n.xmin,n.ymin,0],[n.xmax,n.ymin,0],e),r+=2*S([n.xmin,n.ymin,0],[n.xmin,n.ymax,0],e),r*=2,r+=4*Math.abs(g(n.zmax,0)*e-g(n.zmin,0)*e));const i=new vn({hasZ:!1,hasM:!1,spatialReference:n.spatialReference,paths:[[0,0],[0,r]]});return nn(i,t)}function xn(n){"async"===n.mode&&(n.functions.disjoint=function(t,e){return n.standardFunctionAsync(t,e,((n,r,i)=>(Rn(i=s(i),t,e),null===i[0]||null===i[1]||Z(i[0],i[1]))))},n.functions.intersects=function(t,e){return n.standardFunctionAsync(t,e,((n,r,i)=>(Rn(i=s(i),t,e),null!==i[0]&&null!==i[1]&&C(i[0],i[1]))))},n.functions.touches=function(t,e){return n.standardFunctionAsync(t,e,((n,r,i)=>(Rn(i=s(i),t,e),null!==i[0]&&null!==i[1]&&U(i[0],i[1]))))},n.functions.crosses=function(t,e){return n.standardFunctionAsync(t,e,((n,r,i)=>(Rn(i=s(i),t,e),null!==i[0]&&null!==i[1]&&E(i[0],i[1]))))},n.functions.within=function(t,e){return n.standardFunctionAsync(t,e,((n,r,i)=>(Rn(i=s(i),t,e),null!==i[0]&&null!==i[1]&&q(i[0],i[1]))))},n.functions.contains=function(t,e){return n.standardFunctionAsync(t,e,((n,r,i)=>(Rn(i=s(i),t,e),null!==i[0]&&null!==i[1]&&z(i[0],i[1]))))},n.functions.overlaps=function(t,e){return n.standardFunctionAsync(t,e,((n,r,i)=>(Rn(i=s(i),t,e),null!==i[0]&&null!==i[1]&&W(i[0],i[1]))))},n.functions.equals=function(t,e){return n.standardFunctionAsync(t,e,((n,r,i)=>(u(i,2,2,t,e),i[0]===i[1]||(i[0]instanceof J&&i[1]instanceof J?G(i[0],i[1]):(c(i[0])&&c(i[1])||!!(f(i[0])&&f(i[1])||d(i[0])&&d(i[1])))&&i[0].equals(i[1])))))},n.functions.relate=function(t,e){return n.standardFunctionAsync(t,e,((n,a,o)=>{if(o=s(o),u(o,3,3,t,e),o[0]instanceof J&&o[1]instanceof J)return H(o[0],o[1],m(o[2]));if(o[0]instanceof J&&null===o[1])return!1;if(o[1]instanceof J&&null===o[0])return!1;if(null===o[0]&&null===o[1])return!1;throw new r(t,i.InvalidParameter,e)}))},n.functions.intersection=function(t,e){return n.standardFunctionAsync(t,e,((n,r,i)=>(Rn(i=s(i),t,e),null===i[0]||null===i[1]?null:K(i[0],i[1]))))},n.functions.union=function(t,e){return n.standardFunctionAsync(t,e,((n,o,l)=>{const u=[];if(0===(l=s(l)).length)throw new r(t,i.WrongNumberOfParameters,e);if(1===l.length)if(w(l[0])){const n=s(l[0]);for(let a=0;a<n.length;a++)if(null!==n[a]){if(!(n[a]instanceof J))throw new r(t,i.InvalidParameter,e);u.push(n[a])}}else{if(!h(l[0])){if(l[0]instanceof J)return y(a(l[0]),t.spatialReference);if(null===l[0])return null;throw new r(t,i.InvalidParameter,e)}{const n=s(l[0].toArray());for(let a=0;a<n.length;a++)if(null!==n[a]){if(!(n[a]instanceof J))throw new r(t,i.InvalidParameter,e);u.push(n[a])}}}else for(let a=0;a<l.length;a++)if(null!==l[a]){if(!(l[a]instanceof J))throw new r(t,i.InvalidParameter,e);u.push(l[a])}return 0===u.length?null:V(u)}))},n.functions.difference=function(t,e){return n.standardFunctionAsync(t,e,((n,r,i)=>(Rn(i=s(i),t,e),null===i[0]?null:null===i[1]?a(i[0]):B(i[0],i[1]))))},n.functions.symmetricdifference=function(t,e){return n.standardFunctionAsync(t,e,((n,r,i)=>(Rn(i=s(i),t,e),null===i[0]&&null===i[1]?null:null===i[0]?a(i[1]):null===i[1]?a(i[0]):Q(i[0],i[1]))))},n.functions.clip=function(t,e){return n.standardFunctionAsync(t,e,((n,a,o)=>{if(o=s(o),u(o,2,2,t,e),!(o[1]instanceof T)&&null!==o[1])throw new r(t,i.InvalidParameter,e);if(null===o[0])return null;if(!(o[0]instanceof J))throw new r(t,i.InvalidParameter,e);return null===o[1]?null:X(o[0],o[1])}))},n.functions.cut=function(t,e){return n.standardFunctionAsync(t,e,((n,o,l)=>{if(l=s(l),u(l,2,2,t,e),!(l[1]instanceof vn)&&null!==l[1])throw new r(t,i.InvalidParameter,e);if(null===l[0])return[];if(!(l[0]instanceof J))throw new r(t,i.InvalidParameter,e);return null===l[1]?[a(l[0])]:Y(l[0],l[1])}))},n.functions.area=function(t,e){return n.standardFunctionAsync(t,e,(async(n,a,l)=>{if(u(l,1,2,t,e),null===(l=s(l))[0])return 0;if(p(l[0])){const n=await l[0].sumArea(o(g(l[1],-1)),!1,t.abortSignal);if(t.abortSignal.aborted)throw new r(t,i.Cancelled,e);return n}if(w(l[0])||h(l[0])){const n=v(l[0],t.spatialReference);return null===n?0:$(n,o(g(l[1],-1)))}if(!(l[0]instanceof J))throw new r(t,i.InvalidParameter,e);return $(l[0],o(g(l[1],-1)))}))},n.functions.areageodetic=function(t,e){return n.standardFunctionAsync(t,e,(async(n,a,l)=>{if(u(l,1,2,t,e),null===(l=s(l))[0])return 0;if(p(l[0])){const n=await l[0].sumArea(o(g(l[1],-1)),!0,t.abortSignal);if(t.abortSignal.aborted)throw new r(t,i.Cancelled,e);return n}if(w(l[0])||h(l[0])){const n=v(l[0],t.spatialReference);return null===n?0:_(n,o(g(l[1],-1)))}if(!(l[0]instanceof J))throw new r(t,i.InvalidParameter,e);return _(l[0],o(g(l[1],-1)))}))},n.functions.length=function(t,e){return n.standardFunctionAsync(t,e,(async(n,a,o)=>{if(u(o,1,2,t,e),null===(o=s(o))[0])return 0;if(p(o[0])){const n=await o[0].sumLength(l(g(o[1],-1)),!1,t.abortSignal);if(t.abortSignal.aborted)throw new r(t,i.Cancelled,e);return n}if(w(o[0])||h(o[0])){const n=P(o[0],t.spatialReference);return null===n?0:nn(n,l(g(o[1],-1)))}if(!(o[0]instanceof J))throw new r(t,i.InvalidParameter,e);return nn(o[0],l(g(o[1],-1)))}))},n.functions.length3d=function(t,e){return n.standardFunctionAsync(t,e,((n,a,o)=>{if(u(o,1,2,t,e),null===(o=s(o))[0])return 0;if(w(o[0])||h(o[0])){const n=P(o[0],t.spatialReference);return null===n?0:!0===n.hasZ?jn(n,l(g(o[1],-1))):nn(n,l(g(o[1],-1)))}if(!(o[0]instanceof J))throw new r(t,i.InvalidParameter,e);return!0===o[0].hasZ?jn(o[0],l(g(o[1],-1))):nn(o[0],l(g(o[1],-1)))}))},n.functions.lengthgeodetic=function(t,e){return n.standardFunctionAsync(t,e,(async(n,a,o)=>{if(u(o,1,2,t,e),null===(o=s(o))[0])return 0;if(p(o[0])){const n=await o[0].sumLength(l(g(o[1],-1)),!0,t.abortSignal);if(t.abortSignal.aborted)throw new r(t,i.Cancelled,e);return n}if(w(o[0])||h(o[0])){const n=P(o[0],t.spatialReference);return null===n?0:tn(n,l(g(o[1],-1)))}if(!(o[0]instanceof J))throw new r(t,i.InvalidParameter,e);return tn(o[0],l(g(o[1],-1)))}))},n.functions.distance=function(t,e){return n.standardFunctionAsync(t,e,((n,a,o)=>{o=s(o),u(o,2,3,t,e);let c=o[0];(w(o[0])||h(o[0]))&&(c=I(o[0],t.spatialReference));let f=o[1];if((w(o[1])||h(o[1]))&&(f=I(o[1],t.spatialReference)),!(c instanceof J))throw new r(t,i.InvalidParameter,e);if(!(f instanceof J))throw new r(t,i.InvalidParameter,e);return en(c,f,l(g(o[2],-1)))}))},n.functions.distancegeodetic=function(t,e){return n.standardFunctionAsync(t,e,((n,a,o)=>{o=s(o),u(o,2,3,t,e);const c=o[0],f=o[1];if(!(c instanceof pn))throw new r(t,i.InvalidParameter,e);if(!(f instanceof pn))throw new r(t,i.InvalidParameter,e);const d=new vn({paths:[],spatialReference:c.spatialReference});return d.addPath([c,f]),tn(d,l(g(o[2],-1)))}))},n.functions.densify=function(t,e){return n.standardFunctionAsync(t,e,((n,a,o)=>{if(o=s(o),u(o,2,3,t,e),null===o[0])return null;if(!(o[0]instanceof J))throw new r(t,i.InvalidParameter,e);const c=A(o[1]);if(isNaN(c))throw new r(t,i.InvalidParameter,e);if(c<=0)throw new r(t,i.InvalidParameter,e);return o[0]instanceof gn||o[0]instanceof vn?rn(o[0],c,l(g(o[2],-1))):o[0]instanceof T?rn(Fn(o[0]),c,l(g(o[2],-1))):o[0]}))},n.functions.densifygeodetic=function(t,e){return n.standardFunctionAsync(t,e,((n,a,o)=>{if(o=s(o),u(o,2,3,t,e),null===o[0])return null;if(!(o[0]instanceof J))throw new r(t,i.InvalidParameter,e);const c=A(o[1]);if(isNaN(c))throw new r(t,i.InvalidParameter,e);if(c<=0)throw new r(t,i.InvalidParameter,e);return o[0]instanceof gn||o[0]instanceof vn?an(o[0],c,l(g(o[2],-1))):o[0]instanceof T?an(Fn(o[0]),c,l(g(o[2],-1))):o[0]}))},n.functions.generalize=function(t,e){return n.standardFunctionAsync(t,e,((n,a,o)=>{if(o=s(o),u(o,2,4,t,e),null===o[0])return null;if(!(o[0]instanceof J))throw new r(t,i.InvalidParameter,e);const c=A(o[1]);if(isNaN(c))throw new r(t,i.InvalidParameter,e);return on(o[0],c,F(g(o[2],!0)),l(g(o[3],-1)))}))},n.functions.buffer=function(t,e){return n.standardFunctionAsync(t,e,((n,o,c)=>{if(c=s(c),u(c,2,3,t,e),null===c[0])return null;if(!(c[0]instanceof J))throw new r(t,i.InvalidParameter,e);const f=A(c[1]);if(isNaN(f))throw new r(t,i.InvalidParameter,e);return 0===f?a(c[0]):ln(c[0],f,l(g(c[2],-1)))}))},n.functions.buffergeodetic=function(t,e){return n.standardFunctionAsync(t,e,((n,o,c)=>{if(c=s(c),u(c,2,3,t,e),null===c[0])return null;if(!(c[0]instanceof J))throw new r(t,i.InvalidParameter,e);const f=A(c[1]);if(isNaN(f))throw new r(t,i.InvalidParameter,e);return 0===f?a(c[0]):sn(c[0],f,l(g(c[2],-1)))}))},n.functions.offset=function(t,e){return n.standardFunctionAsync(t,e,((n,a,o)=>{if(o=s(o),u(o,2,6,t,e),null===o[0])return null;if(!(o[0]instanceof gn||o[0]instanceof vn))throw new r(t,i.InvalidParameter,e);const c=A(o[1]);if(isNaN(c))throw new r(t,i.InvalidParameter,e);const f=A(g(o[4],10));if(isNaN(f))throw new r(t,i.InvalidParameter,e);const d=A(g(o[5],0));if(isNaN(d))throw new r(t,i.InvalidParameter,e);return un(o[0],c,l(g(o[2],-1)),m(g(o[3],"round")).toLowerCase(),f,d)}))},n.functions.rotate=function(t,e){return n.standardFunctionAsync(t,e,((n,a,o)=>{if(o=s(o),u(o,2,3,t,e),null===o[0])return null;if(!(o[0]instanceof J))throw new r(t,i.InvalidParameter,e);const l=o[0]instanceof T?gn.fromExtent(o[0]):o[0],c=A(o[1]);if(isNaN(c))throw new r(t,i.InvalidParameter,e);const f=g(o[2],null);if(null===f)return cn(l,c);if(f instanceof pn)return cn(l,c,f);throw new r(t,i.InvalidParameter,e)}))},n.functions.centroid=function(t,e){return n.standardFunctionAsync(t,e,((n,o,l)=>{if(l=s(l),u(l,1,1,t,e),null===l[0])return null;let c=l[0];if((w(l[0])||h(l[0]))&&(c=I(l[0],t.spatialReference)),null===c)return null;if(!(c instanceof J))throw new r(t,i.InvalidParameter,e);return c instanceof pn?y(a(c),t.spatialReference):c instanceof gn?c.centroid:c instanceof vn?b(c):c instanceof yn?N(c):c instanceof T?c.center:null}))},n.functions.measuretocoordinate=function(t,a){return n.standardFunctionAsync(t,a,((n,o,l)=>{if(l=s(l),u(l,2,2,t,a),null===l[0])return null;let c=l[0];if((w(l[0])||h(l[0]))&&(c=P(l[0],t.spatialReference)),null===c)return null;if(!(c instanceof J))throw new r(t,i.InvalidParameter,a);if(!(c instanceof vn))throw new r(t,i.InvalidParameter,a);if(R(!1===l[1]))throw new r(t,i.InvalidParameter,a);const f=D(c,l[1]);return f?e.convertObjectToArcadeDictionary(f,j(t),!1,!0):null}))},n.functions.pointtocoordinate=function(t,a){return n.standardFunctionAsync(t,a,((n,o,l)=>{if(l=s(l),u(l,2,2,t,a),null===l[0])return null;let c=l[0];if((w(l[0])||h(l[0]))&&(c=P(l[0],t.spatialReference)),null===c)return null;if(!(c instanceof J))throw new r(t,i.InvalidParameter,a);if(!(c instanceof vn))throw new r(t,i.InvalidParameter,a);const f=l[1];if(null===f)return null;if(!(f instanceof pn))throw new r(t,i.InvalidParameter,a);if(R(!1===l[1]))throw new r(t,i.InvalidParameter,a);const d=k(c,f);return d?e.convertObjectToArcadeDictionary(d,j(t),!1,!0):null}))},n.functions.distancetocoordinate=function(t,a){return n.standardFunctionAsync(t,a,((n,o,l)=>{if(l=s(l),u(l,2,2,t,a),null===l[0])return null;let c=l[0];if((w(l[0])||h(l[0]))&&(c=P(l[0],t.spatialReference)),null===c)return null;if(!(c instanceof J))throw new r(t,i.InvalidParameter,a);if(!(c instanceof vn))throw new r(t,i.InvalidParameter,a);if(R(!1===l[1]))throw new r(t,i.InvalidParameter,a);const f=L(c,l[1]);return f?e.convertObjectToArcadeDictionary(f,j(t),!1,!0):null}))},n.functions.multiparttosinglepart=function(t,e){return n.standardFunctionAsync(t,e,(async(n,o,l)=>{if(l=s(l),u(l,1,1,t,e),null===l[0])return null;if(!(l[0]instanceof J))throw new r(t,i.InvalidParameter,e);if(l[0]instanceof pn)return[y(a(l[0]),t.spatialReference)];if(l[0]instanceof T)return[y(a(l[0]),t.spatialReference)];const c=await fn(l[0]);if(c instanceof gn){const n=[],t=[];for(let e=0;e<c.rings.length;e++)if(c.isClockwise(c.rings[e])){const t=Pn({rings:[c.rings[e]],hasZ:!0===c.hasZ,hasM:!0===c.hasM,spatialReference:c.spatialReference.toJSON()});n.push(t)}else t.push({ring:c.rings[e],pt:c.getPoint(e,0)});for(let e=0;e<t.length;e++)for(let r=0;r<n.length;r++)if(n[r].contains(t[e].pt)){n[r].addRing(t[e].ring);break}return n}if(c instanceof vn){const n=[];for(let t=0;t<c.paths.length;t++){const e=Pn({paths:[c.paths[t]],hasZ:!0===c.hasZ,hasM:!0===c.hasM,spatialReference:c.spatialReference.toJSON()});n.push(e)}return n}if(l[0]instanceof yn){const n=[],e=y(a(l[0]),t.spatialReference);for(let t=0;t<e.points.length;t++)n.push(e.getPoint(t));return n}return null}))},n.functions.issimple=function(t,e){return n.standardFunctionAsync(t,e,((n,a,o)=>{if(o=s(o),u(o,1,1,t,e),null===o[0])return!0;if(!(o[0]instanceof J))throw new r(t,i.InvalidParameter,e);return dn(o[0])}))},n.functions.simplify=function(t,e){return n.standardFunctionAsync(t,e,((n,a,o)=>{if(o=s(o),u(o,1,1,t,e),null===o[0])return null;if(!(o[0]instanceof J))throw new r(t,i.InvalidParameter,e);return fn(o[0])}))},n.functions.convexhull=function(t,e){return n.standardFunctionAsync(t,e,((n,a,o)=>{if(o=s(o),u(o,1,1,t,e),null===o[0])return null;if(!(o[0]instanceof J))throw new r(t,i.InvalidParameter,e);return mn(o[0])}))},n.functions.getuser=function(a,o){return n.standardFunctionAsync(a,o,(async(n,l,s)=>{u(s,0,2,a,o);let c=g(s[1],""),f=!0===c;if(c=!0===c||!1===c?"":m(c),0===s.length||s[0]instanceof t){let n;n=a.services?.portal?a.services.portal:In.getDefault(),s.length>0&&(n=x(s[0],n));const t=await An(n,c,f);if(t){const n=JSON.parse(JSON.stringify(t));for(const t of["lastLogin","created","modified"])void 0!==n[t]&&null!==n[t]&&(n[t]=new Date(n[t]));return e.convertObjectToArcadeDictionary(n,j(a))}return null}let d=null;if(p(s[0])&&(d=s[0]),d){if(f=!1,c)return null;await d.load();const n=await d.getOwningSystemUrl();if(!n){if(!c){const n=await d.getIdentityUser();return n?e.convertObjectToArcadeDictionary({username:n},j(a)):null}return null}let r;r=a.services?.portal?a.services.portal:In.getDefault(),r=x(new t(n),r);const i=await An(r,c,f);if(i){const n=JSON.parse(JSON.stringify(i));for(const t of["lastLogin","created","modified"])void 0!==n[t]&&null!==n[t]&&(n[t]=new Date(n[t]));return e.convertObjectToArcadeDictionary(n,j(a))}return null}throw new r(a,i.InvalidParameter,o)}))},n.functions.nearestcoordinate=function(t,a){return n.standardFunctionAsync(t,a,(async(n,o,l)=>{if(l=s(l),u(l,2,2,t,a),!(l[0]instanceof J||null===l[0]))throw new r(t,i.InvalidParameter,a);if(!(l[1]instanceof pn||null===l[1]))throw new r(t,i.InvalidParameter,a);if(null===l[0]||null===l[1])return null;const c=await wn(l[0],l[1]);return null===c?null:e.convertObjectToArcadeDictionary({coordinate:c.coordinate,distance:c.distance,sideOfLine:0===c.distance?"straddle":c.isRightSide?"right":"left"},j(t),!1,!0)}))},n.functions.nearestvertex=function(t,a){return n.standardFunctionAsync(t,a,(async(n,o,l)=>{if(l=s(l),u(l,2,2,t,a),!(l[0]instanceof J||null===l[0]))throw new r(t,i.InvalidParameter,a);if(!(l[1]instanceof pn||null===l[1]))throw new r(t,i.InvalidParameter,a);if(null===l[0]||null===l[1])return null;const c=await hn(l[0],l[1]);return null===c?null:e.convertObjectToArcadeDictionary({coordinate:c.coordinate,distance:c.distance,sideOfLine:0===c.distance?"straddle":c.isRightSide?"right":"left"},j(t),!1,!0)}))})}export{xn as registerFunctions};
5
+ import n from"../ArcadePortal.js";import t from"../Dictionary.js";import{ArcadeExecutionError as e,ExecutionErrorCodes as r}from"../executionError.js";import{cloneGeometry as i,convertSquareUnitsToCode as a,convertLinearUnitsToCode as o}from"../kernel.js";import{I as l,H as s,k as u,n as c,m as f,j as d,o as w,q as m,x as h,u as p,K as y,J as g,L as v,M as P,g as I,h as A,b as F,N as R}from"../../chunks/languageUtils.js";import{getPortal as j}from"../portalUtils.js";import{centroidPolyline as b,centroidMultiPoint as N,getMetersPerVerticalUnitForSR as x,segmentLength3d as O}from"./centroid.js";import{measureToCoordinate as S,pointToCoordinate as D,distanceToCoordinate as L}from"./measures.js";import{getMetersPerUnitForSR as M}from"../../core/unitUtils.js";import T from"../../geometry/Extent.js";import k from"../../geometry/Geometry.js";import{disjoint as J,intersects as Z,touches as C,crosses as E,within as U,contains as q,overlaps as z,equals as W,relate as G,intersect as H,union as K,difference as V,symmetricDifference as B,clip as Q,cut as X,planarArea as Y,geodesicArea as $,planarLength as _,geodesicLength as nn,distance as tn,densify as en,geodesicDensify as rn,generalize as an,buffer as on,geodesicBuffer as ln,offset as sn,rotate as un,simplify as cn,isSimple as fn,convexHull as dn,nearestCoordinate as wn,nearestVertex as mn}from"../../geometry/geometryEngineAsync.js";import hn from"../../geometry/Multipoint.js";import pn from"../../geometry/Point.js";import yn from"../../geometry/Polygon.js";import gn from"../../geometry/Polyline.js";import{fromJSON as vn}from"../../geometry/support/jsonUtils.js";import Pn from"../../portal/Portal.js";import{lookupUser as In}from"../../portal/support/utils.js";function An(n,t,i){if(s(n,2,2,t,i),n[0]instanceof k&&n[1]instanceof k);else if(n[0]instanceof k&&null===n[1]);else if(n[1]instanceof k&&null===n[0]);else if(null!==n[0]||null!==n[1])throw new e(t,r.InvalidParameter,i)}async function Fn(n,t){if("polygon"!==n.type&&"polyline"!==n.type&&"extent"!==n.type)return 0;let e=1;if(n.spatialReference.vcsWkid||n.spatialReference.latestVcsWkid){e=x(n.spatialReference)/M(n.spatialReference)}let r=0;if("polyline"===n.type)for(const a of n.paths)for(let n=1;n<a.length;n++)r+=O(a[n],a[n-1],e);else if("polygon"===n.type)for(const a of n.rings){for(let n=1;n<a.length;n++)r+=O(a[n],a[n-1],e);(a[0][0]!==a[a.length-1][0]||a[0][1]!==a[a.length-1][1]||void 0!==a[0][2]&&a[0][2]!==a[a.length-1][2])&&(r+=O(a[0],a[a.length-1],e))}else"extent"===n.type&&(r+=2*O([n.xmin,n.ymin,0],[n.xmax,n.ymin,0],e),r+=2*O([n.xmin,n.ymin,0],[n.xmin,n.ymax,0],e),r*=2,r+=4*Math.abs(y(n.zmax,0)*e-y(n.zmin,0)*e));const i=new gn({hasZ:!1,hasM:!1,spatialReference:n.spatialReference,paths:[[0,0],[0,r]]});return _(i,t)}function Rn(x){"async"===x.mode&&(x.functions.disjoint=function(n,t){return x.standardFunctionAsync(n,t,((e,r,i)=>(An(i=l(i),n,t),null===i[0]||null===i[1]||J(i[0],i[1]))))},x.functions.intersects=function(n,t){return x.standardFunctionAsync(n,t,((e,r,i)=>(An(i=l(i),n,t),null!==i[0]&&null!==i[1]&&Z(i[0],i[1]))))},x.functions.touches=function(n,t){return x.standardFunctionAsync(n,t,((e,r,i)=>(An(i=l(i),n,t),null!==i[0]&&null!==i[1]&&C(i[0],i[1]))))},x.functions.crosses=function(n,t){return x.standardFunctionAsync(n,t,((e,r,i)=>(An(i=l(i),n,t),null!==i[0]&&null!==i[1]&&E(i[0],i[1]))))},x.functions.within=function(n,t){return x.standardFunctionAsync(n,t,((e,r,i)=>(An(i=l(i),n,t),null!==i[0]&&null!==i[1]&&U(i[0],i[1]))))},x.functions.contains=function(n,t){return x.standardFunctionAsync(n,t,((e,r,i)=>(An(i=l(i),n,t),null!==i[0]&&null!==i[1]&&q(i[0],i[1]))))},x.functions.overlaps=function(n,t){return x.standardFunctionAsync(n,t,((e,r,i)=>(An(i=l(i),n,t),null!==i[0]&&null!==i[1]&&z(i[0],i[1]))))},x.functions.equals=function(n,t){return x.standardFunctionAsync(n,t,((e,r,i)=>(s(i,2,2,n,t),i[0]===i[1]||(i[0]instanceof k&&i[1]instanceof k?W(i[0],i[1]):(u(i[0])&&u(i[1])||!!(c(i[0])&&c(i[1])||f(i[0])&&f(i[1])))&&i[0].equals(i[1])))))},x.functions.relate=function(n,t){return x.standardFunctionAsync(n,t,((i,a,o)=>{if(o=l(o),s(o,3,3,n,t),o[0]instanceof k&&o[1]instanceof k)return G(o[0],o[1],d(o[2]));if(o[0]instanceof k&&null===o[1])return!1;if(o[1]instanceof k&&null===o[0])return!1;if(null===o[0]&&null===o[1])return!1;throw new e(n,r.InvalidParameter,t)}))},x.functions.intersection=function(n,t){return x.standardFunctionAsync(n,t,((e,r,i)=>(An(i=l(i),n,t),null===i[0]||null===i[1]?null:H(i[0],i[1]))))},x.functions.union=function(n,t){return x.standardFunctionAsync(n,t,((a,o,s)=>{const u=[];if(0===(s=l(s)).length)throw new e(n,r.WrongNumberOfParameters,t);if(1===s.length)if(w(s[0])){const i=l(s[0]);for(let a=0;a<i.length;a++)if(null!==i[a]){if(!(i[a]instanceof k))throw new e(n,r.InvalidParameter,t);u.push(i[a])}}else{if(!m(s[0])){if(s[0]instanceof k)return h(i(s[0]),n.spatialReference);if(null===s[0])return null;throw new e(n,r.InvalidParameter,t)}{const i=l(s[0].toArray());for(let a=0;a<i.length;a++)if(null!==i[a]){if(!(i[a]instanceof k))throw new e(n,r.InvalidParameter,t);u.push(i[a])}}}else for(let i=0;i<s.length;i++)if(null!==s[i]){if(!(s[i]instanceof k))throw new e(n,r.InvalidParameter,t);u.push(s[i])}return 0===u.length?null:K(u)}))},x.functions.difference=function(n,t){return x.standardFunctionAsync(n,t,((e,r,a)=>(An(a=l(a),n,t),null===a[0]?null:null===a[1]?i(a[0]):V(a[0],a[1]))))},x.functions.symmetricdifference=function(n,t){return x.standardFunctionAsync(n,t,((e,r,a)=>(An(a=l(a),n,t),null===a[0]&&null===a[1]?null:null===a[0]?i(a[1]):null===a[1]?i(a[0]):B(a[0],a[1]))))},x.functions.clip=function(n,t){return x.standardFunctionAsync(n,t,((i,a,o)=>{if(o=l(o),s(o,2,2,n,t),!(o[1]instanceof T)&&null!==o[1])throw new e(n,r.InvalidParameter,t);if(null===o[0])return null;if(!(o[0]instanceof k))throw new e(n,r.InvalidParameter,t);return null===o[1]?null:Q(o[0],o[1])}))},x.functions.cut=function(n,t){return x.standardFunctionAsync(n,t,((a,o,u)=>{if(u=l(u),s(u,2,2,n,t),!(u[1]instanceof gn)&&null!==u[1])throw new e(n,r.InvalidParameter,t);if(null===u[0])return[];if(!(u[0]instanceof k))throw new e(n,r.InvalidParameter,t);return null===u[1]?[i(u[0])]:X(u[0],u[1])}))},x.functions.area=function(n,t){return x.standardFunctionAsync(n,t,(async(i,o,u)=>{if(s(u,1,2,n,t),null===(u=l(u))[0])return 0;if(p(u[0])){const i=await u[0].sumArea(a(y(u[1],-1)),!1,n.abortSignal);if(n.abortSignal.aborted)throw new e(n,r.Cancelled,t);return i}if(w(u[0])||m(u[0])){const t=g(u[0],n.spatialReference);return null===t?0:Y(t,a(y(u[1],-1)))}if(!(u[0]instanceof k))throw new e(n,r.InvalidParameter,t);return Y(u[0],a(y(u[1],-1)))}))},x.functions.areageodetic=function(n,t){return x.standardFunctionAsync(n,t,(async(i,o,u)=>{if(s(u,1,2,n,t),null===(u=l(u))[0])return 0;if(p(u[0])){const i=await u[0].sumArea(a(y(u[1],-1)),!0,n.abortSignal);if(n.abortSignal.aborted)throw new e(n,r.Cancelled,t);return i}if(w(u[0])||m(u[0])){const t=g(u[0],n.spatialReference);return null===t?0:$(t,a(y(u[1],-1)))}if(!(u[0]instanceof k))throw new e(n,r.InvalidParameter,t);return $(u[0],a(y(u[1],-1)))}))},x.functions.length=function(n,t){return x.standardFunctionAsync(n,t,(async(i,a,u)=>{if(s(u,1,2,n,t),null===(u=l(u))[0])return 0;if(p(u[0])){const i=await u[0].sumLength(o(y(u[1],-1)),!1,n.abortSignal);if(n.abortSignal.aborted)throw new e(n,r.Cancelled,t);return i}if(w(u[0])||m(u[0])){const t=v(u[0],n.spatialReference);return null===t?0:_(t,o(y(u[1],-1)))}if(!(u[0]instanceof k))throw new e(n,r.InvalidParameter,t);return _(u[0],o(y(u[1],-1)))}))},x.functions.length3d=function(n,t){return x.standardFunctionAsync(n,t,((i,a,u)=>{if(s(u,1,2,n,t),null===(u=l(u))[0])return 0;if(w(u[0])||m(u[0])){const t=v(u[0],n.spatialReference);return null===t?0:!0===t.hasZ?Fn(t,o(y(u[1],-1))):_(t,o(y(u[1],-1)))}if(!(u[0]instanceof k))throw new e(n,r.InvalidParameter,t);return!0===u[0].hasZ?Fn(u[0],o(y(u[1],-1))):_(u[0],o(y(u[1],-1)))}))},x.functions.lengthgeodetic=function(n,t){return x.standardFunctionAsync(n,t,(async(i,a,u)=>{if(s(u,1,2,n,t),null===(u=l(u))[0])return 0;if(p(u[0])){const i=await u[0].sumLength(o(y(u[1],-1)),!0,n.abortSignal);if(n.abortSignal.aborted)throw new e(n,r.Cancelled,t);return i}if(w(u[0])||m(u[0])){const t=v(u[0],n.spatialReference);return null===t?0:nn(t,o(y(u[1],-1)))}if(!(u[0]instanceof k))throw new e(n,r.InvalidParameter,t);return nn(u[0],o(y(u[1],-1)))}))},x.functions.distance=function(n,t){return x.standardFunctionAsync(n,t,((i,a,u)=>{u=l(u),s(u,2,3,n,t);let c=u[0];(w(u[0])||m(u[0]))&&(c=P(u[0],n.spatialReference));let f=u[1];if((w(u[1])||m(u[1]))&&(f=P(u[1],n.spatialReference)),!(c instanceof k))throw new e(n,r.InvalidParameter,t);if(!(f instanceof k))throw new e(n,r.InvalidParameter,t);return tn(c,f,o(y(u[2],-1)))}))},x.functions.distancegeodetic=function(n,t){return x.standardFunctionAsync(n,t,((i,a,u)=>{u=l(u),s(u,2,3,n,t);const c=u[0],f=u[1];if(!(c instanceof pn))throw new e(n,r.InvalidParameter,t);if(!(f instanceof pn))throw new e(n,r.InvalidParameter,t);const d=new gn({paths:[],spatialReference:c.spatialReference});return d.addPath([c,f]),nn(d,o(y(u[2],-1)))}))},x.functions.densify=function(n,t){return x.standardFunctionAsync(n,t,((i,a,u)=>{if(u=l(u),s(u,2,3,n,t),null===u[0])return null;if(!(u[0]instanceof k))throw new e(n,r.InvalidParameter,t);const c=I(u[1]);if(isNaN(c))throw new e(n,r.InvalidParameter,t);if(c<=0)throw new e(n,r.InvalidParameter,t);return u[0]instanceof yn||u[0]instanceof gn?en(u[0],c,o(y(u[2],-1))):u[0]instanceof T?en(yn.fromExtent(u[0]),c,o(y(u[2],-1))):u[0]}))},x.functions.densifygeodetic=function(n,t){return x.standardFunctionAsync(n,t,((i,a,u)=>{if(u=l(u),s(u,2,3,n,t),null===u[0])return null;if(!(u[0]instanceof k))throw new e(n,r.InvalidParameter,t);const c=I(u[1]);if(isNaN(c))throw new e(n,r.InvalidParameter,t);if(c<=0)throw new e(n,r.InvalidParameter,t);return u[0]instanceof yn||u[0]instanceof gn?rn(u[0],c,o(y(u[2],-1))):u[0]instanceof T?rn(yn.fromExtent(u[0]),c,o(y(u[2],-1))):u[0]}))},x.functions.generalize=function(n,t){return x.standardFunctionAsync(n,t,((i,a,u)=>{if(u=l(u),s(u,2,4,n,t),null===u[0])return null;if(!(u[0]instanceof k))throw new e(n,r.InvalidParameter,t);const c=I(u[1]);if(isNaN(c))throw new e(n,r.InvalidParameter,t);return an(u[0],c,A(y(u[2],!0)),o(y(u[3],-1)))}))},x.functions.buffer=function(n,t){return x.standardFunctionAsync(n,t,((a,u,c)=>{if(c=l(c),s(c,2,3,n,t),null===c[0])return null;if(!(c[0]instanceof k))throw new e(n,r.InvalidParameter,t);const f=I(c[1]);if(isNaN(f))throw new e(n,r.InvalidParameter,t);return 0===f?i(c[0]):on(c[0],f,o(y(c[2],-1)))}))},x.functions.buffergeodetic=function(n,t){return x.standardFunctionAsync(n,t,((a,u,c)=>{if(c=l(c),s(c,2,3,n,t),null===c[0])return null;if(!(c[0]instanceof k))throw new e(n,r.InvalidParameter,t);const f=I(c[1]);if(isNaN(f))throw new e(n,r.InvalidParameter,t);return 0===f?i(c[0]):ln(c[0],f,o(y(c[2],-1)))}))},x.functions.offset=function(n,t){return x.standardFunctionAsync(n,t,((i,a,u)=>{if(u=l(u),s(u,2,6,n,t),null===u[0])return null;if(!(u[0]instanceof yn||u[0]instanceof gn))throw new e(n,r.InvalidParameter,t);const c=I(u[1]);if(isNaN(c))throw new e(n,r.InvalidParameter,t);const f=I(y(u[4],10));if(isNaN(f))throw new e(n,r.InvalidParameter,t);const w=I(y(u[5],0));if(isNaN(w))throw new e(n,r.InvalidParameter,t);return sn(u[0],c,o(y(u[2],-1)),d(y(u[3],"round")).toLowerCase(),f,w)}))},x.functions.rotate=function(n,t){return x.standardFunctionAsync(n,t,((i,a,o)=>{if(o=l(o),s(o,2,3,n,t),null===o[0])return null;if(!(o[0]instanceof k))throw new e(n,r.InvalidParameter,t);const u=o[0]instanceof T?yn.fromExtent(o[0]):o[0],c=I(o[1]);if(isNaN(c))throw new e(n,r.InvalidParameter,t);const f=y(o[2],null);if(null===f)return un(u,c);if(f instanceof pn)return un(u,c,f);throw new e(n,r.InvalidParameter,t)}))},x.functions.centroid=function(n,t){return x.standardFunctionAsync(n,t,((a,o,u)=>{if(u=l(u),s(u,1,1,n,t),null===u[0])return null;let c=u[0];if((w(u[0])||m(u[0]))&&(c=P(u[0],n.spatialReference)),null===c)return null;if(!(c instanceof k))throw new e(n,r.InvalidParameter,t);return c instanceof pn?h(i(c),n.spatialReference):c instanceof yn?c.centroid:c instanceof gn?b(c):c instanceof hn?N(c):c instanceof T?c.center:null}))},x.functions.measuretocoordinate=function(n,i){return x.standardFunctionAsync(n,i,((a,o,u)=>{if(u=l(u),s(u,2,2,n,i),null===u[0])return null;let c=u[0];if((w(u[0])||m(u[0]))&&(c=v(u[0],n.spatialReference)),null===c)return null;if(!(c instanceof k))throw new e(n,r.InvalidParameter,i);if(!(c instanceof gn))throw new e(n,r.InvalidParameter,i);if(F(!1===u[1]))throw new e(n,r.InvalidParameter,i);const f=S(c,u[1]);return f?t.convertObjectToArcadeDictionary(f,R(n),!1,!0):null}))},x.functions.pointtocoordinate=function(n,i){return x.standardFunctionAsync(n,i,((a,o,u)=>{if(u=l(u),s(u,2,2,n,i),null===u[0])return null;let c=u[0];if((w(u[0])||m(u[0]))&&(c=v(u[0],n.spatialReference)),null===c)return null;if(!(c instanceof k))throw new e(n,r.InvalidParameter,i);if(!(c instanceof gn))throw new e(n,r.InvalidParameter,i);const f=u[1];if(null===f)return null;if(!(f instanceof pn))throw new e(n,r.InvalidParameter,i);if(F(!1===u[1]))throw new e(n,r.InvalidParameter,i);const d=D(c,f);return d?t.convertObjectToArcadeDictionary(d,R(n),!1,!0):null}))},x.functions.distancetocoordinate=function(n,i){return x.standardFunctionAsync(n,i,((a,o,u)=>{if(u=l(u),s(u,2,2,n,i),null===u[0])return null;let c=u[0];if((w(u[0])||m(u[0]))&&(c=v(u[0],n.spatialReference)),null===c)return null;if(!(c instanceof k))throw new e(n,r.InvalidParameter,i);if(!(c instanceof gn))throw new e(n,r.InvalidParameter,i);if(F(!1===u[1]))throw new e(n,r.InvalidParameter,i);const f=L(c,u[1]);return f?t.convertObjectToArcadeDictionary(f,R(n),!1,!0):null}))},x.functions.multiparttosinglepart=function(n,t){return x.standardFunctionAsync(n,t,(async(a,o,u)=>{if(u=l(u),s(u,1,1,n,t),null===u[0])return null;if(!(u[0]instanceof k))throw new e(n,r.InvalidParameter,t);if(u[0]instanceof pn)return[h(i(u[0]),n.spatialReference)];if(u[0]instanceof T)return[h(i(u[0]),n.spatialReference)];const c=await cn(u[0]);if(c instanceof yn){const n=[],t=[];for(let e=0;e<c.rings.length;e++)if(c.isClockwise(c.rings[e])){const t=vn({rings:[c.rings[e]],hasZ:!0===c.hasZ,hasM:!0===c.hasM,spatialReference:c.spatialReference.toJSON()});n.push(t)}else t.push({ring:c.rings[e],pt:c.getPoint(e,0)});for(let e=0;e<t.length;e++)for(let r=0;r<n.length;r++)if(n[r].contains(t[e].pt)){n[r].addRing(t[e].ring);break}return n}if(c instanceof gn){const n=[];for(let t=0;t<c.paths.length;t++){const e=vn({paths:[c.paths[t]],hasZ:!0===c.hasZ,hasM:!0===c.hasM,spatialReference:c.spatialReference.toJSON()});n.push(e)}return n}if(u[0]instanceof hn){const t=[],e=h(i(u[0]),n.spatialReference);for(let n=0;n<e.points.length;n++)t.push(e.getPoint(n));return t}return null}))},x.functions.issimple=function(n,t){return x.standardFunctionAsync(n,t,((i,a,o)=>{if(o=l(o),s(o,1,1,n,t),null===o[0])return!0;if(!(o[0]instanceof k))throw new e(n,r.InvalidParameter,t);return fn(o[0])}))},x.functions.simplify=function(n,t){return x.standardFunctionAsync(n,t,((i,a,o)=>{if(o=l(o),s(o,1,1,n,t),null===o[0])return null;if(!(o[0]instanceof k))throw new e(n,r.InvalidParameter,t);return cn(o[0])}))},x.functions.convexhull=function(n,t){return x.standardFunctionAsync(n,t,((i,a,o)=>{if(o=l(o),s(o,1,1,n,t),null===o[0])return null;if(!(o[0]instanceof k))throw new e(n,r.InvalidParameter,t);return dn(o[0])}))},x.functions.getuser=function(i,a){return x.standardFunctionAsync(i,a,(async(o,l,u)=>{s(u,0,2,i,a);let c=y(u[1],""),f=!0===c;if(c=!0===c||!1===c?"":d(c),0===u.length||u[0]instanceof n){let n;n=i.services?.portal?i.services.portal:Pn.getDefault(),u.length>0&&(n=j(u[0],n));const e=await In(n,c,f);if(e){const n=JSON.parse(JSON.stringify(e));for(const t of["lastLogin","created","modified"])void 0!==n[t]&&null!==n[t]&&(n[t]=new Date(n[t]));return t.convertObjectToArcadeDictionary(n,R(i))}return null}let w=null;if(p(u[0])&&(w=u[0]),w){if(f=!1,c)return null;await w.load();const e=await w.getOwningSystemUrl();if(!e){if(!c){const n=await w.getIdentityUser();return n?t.convertObjectToArcadeDictionary({username:n},R(i)):null}return null}let r;r=i.services?.portal?i.services.portal:Pn.getDefault(),r=j(new n(e),r);const a=await In(r,c,f);if(a){const n=JSON.parse(JSON.stringify(a));for(const t of["lastLogin","created","modified"])void 0!==n[t]&&null!==n[t]&&(n[t]=new Date(n[t]));return t.convertObjectToArcadeDictionary(n,R(i))}return null}throw new e(i,r.InvalidParameter,a)}))},x.functions.nearestcoordinate=function(n,i){return x.standardFunctionAsync(n,i,(async(a,o,u)=>{if(u=l(u),s(u,2,2,n,i),!(u[0]instanceof k||null===u[0]))throw new e(n,r.InvalidParameter,i);if(!(u[1]instanceof pn||null===u[1]))throw new e(n,r.InvalidParameter,i);if(null===u[0]||null===u[1])return null;const c=await wn(u[0],u[1]);return null===c?null:t.convertObjectToArcadeDictionary({coordinate:c.coordinate,distance:c.distance,sideOfLine:0===c.distance?"straddle":c.isRightSide?"right":"left"},R(n),!1,!0)}))},x.functions.nearestvertex=function(n,i){return x.standardFunctionAsync(n,i,(async(a,o,u)=>{if(u=l(u),s(u,2,2,n,i),!(u[0]instanceof k||null===u[0]))throw new e(n,r.InvalidParameter,i);if(!(u[1]instanceof pn||null===u[1]))throw new e(n,r.InvalidParameter,i);if(null===u[0]||null===u[1])return null;const c=await mn(u[0],u[1]);return null===c?null:t.convertObjectToArcadeDictionary({coordinate:c.coordinate,distance:c.distance,sideOfLine:0===c.distance?"straddle":c.isRightSide?"right":"left"},R(n),!1,!0)}))})}export{Rn as registerFunctions};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{version as n}from"../../kernel.js";import e from"../Dictionary.js";import{ArcadeExecutionError as t,ExecutionErrorCodes as r}from"../executionError.js";import{cloneGeometry as i,convertSquareUnitsToCode as a,convertLinearUnitsToCode as l}from"../kernel.js";import{I as o,H as f,k as u,n as s,m as c,j as m,o as d,q as h,x as w,J as p,K as g,L as v,M as P,g as I,h as y,b as R,N as x}from"../../chunks/languageUtils.js";import{centroidPolyline as j,centroidMultiPoint as N,getMetersPerVerticalUnitForSR as b,segmentLength3d as L}from"./centroid.js";import{measureToCoordinate as O,pointToCoordinate as A,distanceToCoordinate as D}from"./measures.js";import{getMetersPerUnitForSR as k}from"../../core/unitUtils.js";import M from"../../geometry/Extent.js";import Z from"../../geometry/Geometry.js";import E from"../../geometry/Multipoint.js";import S from"../../geometry/Point.js";import T from"../../geometry/Polygon.js";import q from"../../geometry/Polyline.js";import{fromJSON as z}from"../../geometry/support/jsonUtils.js";let C=null;function J(e){return 0===n.indexOf("4.")?T.fromExtent(e):new T({spatialReference:e.spatialReference,rings:[[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]]})}function U(n){C=n}function W(n,e){if("polygon"!==n.type&&"polyline"!==n.type&&"extent"!==n.type)return 0;let t=1;if(n.spatialReference.vcsWkid||n.spatialReference.latestVcsWkid){t=b(n.spatialReference)/k(n.spatialReference)}let r=0;if("polyline"===n.type)for(const a of n.paths)for(let n=1;n<a.length;n++)r+=L(a[n],a[n-1],t);else if("polygon"===n.type)for(const a of n.rings){for(let n=1;n<a.length;n++)r+=L(a[n],a[n-1],t);(a[0][0]!==a[a.length-1][0]||a[0][1]!==a[a.length-1][1]||void 0!==a[0][2]&&a[0][2]!==a[a.length-1][2])&&(r+=L(a[0],a[a.length-1],t))}else"extent"===n.type&&(r+=2*L([n.xmin,n.ymin,0],[n.xmax,n.ymin,0],t),r+=2*L([n.xmin,n.ymin,0],[n.xmin,n.ymax,0],t),r*=2,r+=4*Math.abs(g(n.zmax,0)*t-g(n.zmin,0)*t));const i=new q({hasZ:!1,hasM:!1,spatialReference:n.spatialReference,paths:[[0,0],[0,r]]});return C.planarLength(i,e)}function H(n,b){function L(n,e,i){if(f(i,2,2,n,e),i[0]instanceof Z&&i[1]instanceof Z);else if(i[0]instanceof Z&&null===i[1]);else if(i[1]instanceof Z&&null===i[0]);else if(null!==i[0]||null!==i[1])throw new t(n,r.InvalidParameter,e)}n.disjoint=function(n,e){return b(n,e,((t,r,i)=>(i=o(i),L(n,e,i),null===i[0]||null===i[1]||C.disjoint(i[0],i[1]))))},n.intersects=function(n,e){return b(n,e,((t,r,i)=>(i=o(i),L(n,e,i),null!==i[0]&&null!==i[1]&&C.intersects(i[0],i[1]))))},n.touches=function(n,e){return b(n,e,((t,r,i)=>(i=o(i),L(n,e,i),null!==i[0]&&null!==i[1]&&C.touches(i[0],i[1]))))},n.crosses=function(n,e){return b(n,e,((t,r,i)=>(i=o(i),L(n,e,i),null!==i[0]&&null!==i[1]&&C.crosses(i[0],i[1]))))},n.within=function(n,e){return b(n,e,((t,r,i)=>(i=o(i),L(n,e,i),null!==i[0]&&null!==i[1]&&C.within(i[0],i[1]))))},n.contains=function(n,e){return b(n,e,((t,r,i)=>(i=o(i),L(n,e,i),null!==i[0]&&null!==i[1]&&C.contains(i[0],i[1]))))},n.overlaps=function(n,e){return b(n,e,((t,r,i)=>(i=o(i),L(n,e,i),null!==i[0]&&null!==i[1]&&C.overlaps(i[0],i[1]))))},n.equals=function(n,e){return b(n,e,((t,r,i)=>(f(i,2,2,n,e),i[0]===i[1]||(i[0]instanceof Z&&i[1]instanceof Z?C.equals(i[0],i[1]):(u(i[0])&&u(i[1])||s(i[0])&&s(i[1])||!(!c(i[0])||!c(i[1])))&&i[0].equals(i[1])))))},n.relate=function(n,e){return b(n,e,((i,a,l)=>{if(l=o(l),f(l,3,3,n,e),l[0]instanceof Z&&l[1]instanceof Z)return C.relate(l[0],l[1],m(l[2]));if(l[0]instanceof Z&&null===l[1])return!1;if(l[1]instanceof Z&&null===l[0])return!1;if(null===l[0]&&null===l[1])return!1;throw new t(n,r.InvalidParameter,e)}))},n.intersection=function(n,e){return b(n,e,((t,r,i)=>(i=o(i),L(n,e,i),null===i[0]||null===i[1]?null:C.intersect(i[0],i[1]))))},n.union=function(n,e){return b(n,e,((a,l,f)=>{const u=[];if(0===(f=o(f)).length)throw new t(n,r.WrongNumberOfParameters,e);if(1===f.length)if(d(f[0])){const i=o(f[0]);for(let a=0;a<i.length;a++)if(null!==i[a]){if(!(i[a]instanceof Z))throw new t(n,r.InvalidParameter,e);u.push(i[a])}}else{if(!h(f[0])){if(f[0]instanceof Z)return w(i(f[0]),n.spatialReference);if(null===f[0])return null;throw new t(n,r.InvalidParameter,e)}{const i=o(f[0].toArray());for(let a=0;a<i.length;a++)if(null!==i[a]){if(!(i[a]instanceof Z))throw new t(n,r.InvalidParameter,e);u.push(i[a])}}}else for(let i=0;i<f.length;i++)if(null!==f[i]){if(!(f[i]instanceof Z))throw new t(n,r.InvalidParameter,e);u.push(f[i])}return 0===u.length?null:C.union(u)}))},n.difference=function(n,e){return b(n,e,((t,r,a)=>(a=o(a),L(n,e,a),null===a[0]?null:null===a[1]?i(a[0]):C.difference(a[0],a[1]))))},n.symmetricdifference=function(n,e){return b(n,e,((t,r,a)=>(a=o(a),L(n,e,a),null===a[0]&&null===a[1]?null:null===a[0]?i(a[1]):null===a[1]?i(a[0]):C.symmetricDifference(a[0],a[1]))))},n.clip=function(n,e){return b(n,e,((i,a,l)=>{if(l=o(l),f(l,2,2,n,e),!(l[1]instanceof M)&&null!==l[1])throw new t(n,r.InvalidParameter,e);if(null===l[0])return null;if(!(l[0]instanceof Z))throw new t(n,r.InvalidParameter,e);return null===l[1]?null:C.clip(l[0],l[1])}))},n.cut=function(n,e){return b(n,e,((a,l,u)=>{if(u=o(u),f(u,2,2,n,e),!(u[1]instanceof q)&&null!==u[1])throw new t(n,r.InvalidParameter,e);if(null===u[0])return[];if(!(u[0]instanceof Z))throw new t(n,r.InvalidParameter,e);return null===u[1]?[i(u[0])]:C.cut(u[0],u[1])}))},n.area=function(n,e){return b(n,e,((i,l,u)=>{if(f(u,1,2,n,e),null===(u=o(u))[0])return 0;if(d(u[0])||h(u[0])){const e=p(u[0],n.spatialReference);return null===e?0:C.planarArea(e,a(g(u[1],-1)))}if(!(u[0]instanceof Z))throw new t(n,r.InvalidParameter,e);return C.planarArea(u[0],a(g(u[1],-1)))}))},n.areageodetic=function(n,e){return b(n,e,((i,l,u)=>{if(f(u,1,2,n,e),null===(u=o(u))[0])return 0;if(d(u[0])||h(u[0])){const e=p(u[0],n.spatialReference);return null===e?0:C.geodesicArea(e,a(g(u[1],-1)))}if(!(u[0]instanceof Z))throw new t(n,r.InvalidParameter,e);return C.geodesicArea(u[0],a(g(u[1],-1)))}))},n.length=function(n,e){return b(n,e,((i,a,u)=>{if(f(u,1,2,n,e),null===(u=o(u))[0])return 0;if(d(u[0])||h(u[0])){const e=v(u[0],n.spatialReference);return null===e?0:C.planarLength(e,l(g(u[1],-1)))}if(!(u[0]instanceof Z))throw new t(n,r.InvalidParameter,e);return C.planarLength(u[0],l(g(u[1],-1)))}))},n.length3d=function(n,e){return b(n,e,((i,a,u)=>{if(f(u,1,2,n,e),null===(u=o(u))[0])return 0;if(d(u[0])||h(u[0])){const e=v(u[0],n.spatialReference);return null===e?0:!0===e.hasZ?W(e,l(g(u[1],-1))):C.planarLength(e,l(g(u[1],-1)))}if(!(u[0]instanceof Z))throw new t(n,r.InvalidParameter,e);return!0===u[0].hasZ?W(u[0],l(g(u[1],-1))):C.planarLength(u[0],l(g(u[1],-1)))}))},n.lengthgeodetic=function(n,e){return b(n,e,((i,a,u)=>{if(f(u,1,2,n,e),null===(u=o(u))[0])return 0;if(d(u[0])||h(u[0])){const e=v(u[0],n.spatialReference);return null===e?0:C.geodesicLength(e,l(g(u[1],-1)))}if(!(u[0]instanceof Z))throw new t(n,r.InvalidParameter,e);return C.geodesicLength(u[0],l(g(u[1],-1)))}))},n.distance=function(n,e){return b(n,e,((i,a,u)=>{u=o(u),f(u,2,3,n,e);let s=u[0];(d(u[0])||h(u[0]))&&(s=P(u[0],n.spatialReference));let c=u[1];if((d(u[1])||h(u[1]))&&(c=P(u[1],n.spatialReference)),!(s instanceof Z))throw new t(n,r.InvalidParameter,e);if(!(c instanceof Z))throw new t(n,r.InvalidParameter,e);return C.distance(s,c,l(g(u[2],-1)))}))},n.distancegeodetic=function(n,e){return b(n,e,((i,a,u)=>{u=o(u),f(u,2,3,n,e);const s=u[0],c=u[1];if(!(s instanceof S))throw new t(n,r.InvalidParameter,e);if(!(c instanceof S))throw new t(n,r.InvalidParameter,e);const m=new q({paths:[],spatialReference:s.spatialReference});return m.addPath([s,c]),C.geodesicLength(m,l(g(u[2],-1)))}))},n.densify=function(n,e){return b(n,e,((i,a,u)=>{if(u=o(u),f(u,2,3,n,e),null===u[0])return null;if(!(u[0]instanceof Z))throw new t(n,r.InvalidParameter,e);const s=I(u[1]);if(isNaN(s))throw new t(n,r.InvalidParameter,e);if(s<=0)throw new t(n,r.InvalidParameter,e);return u[0]instanceof T||u[0]instanceof q?C.densify(u[0],s,l(g(u[2],-1))):u[0]instanceof M?C.densify(J(u[0]),s,l(g(u[2],-1))):u[0]}))},n.densifygeodetic=function(n,e){return b(n,e,((i,a,u)=>{if(u=o(u),f(u,2,3,n,e),null===u[0])return null;if(!(u[0]instanceof Z))throw new t(n,r.InvalidParameter,e);const s=I(u[1]);if(isNaN(s))throw new t(n,r.InvalidParameter,e);if(s<=0)throw new t(n,r.InvalidParameter,e);return u[0]instanceof T||u[0]instanceof q?C.geodesicDensify(u[0],s,l(g(u[2],-1))):u[0]instanceof M?C.geodesicDensify(J(u[0]),s,l(g(u[2],-1))):u[0]}))},n.generalize=function(n,e){return b(n,e,((i,a,u)=>{if(u=o(u),f(u,2,4,n,e),null===u[0])return null;if(!(u[0]instanceof Z))throw new t(n,r.InvalidParameter,e);const s=I(u[1]);if(isNaN(s))throw new t(n,r.InvalidParameter,e);return C.generalize(u[0],s,y(g(u[2],!0)),l(g(u[3],-1)))}))},n.buffer=function(n,e){return b(n,e,((a,u,s)=>{if(s=o(s),f(s,2,3,n,e),null===s[0])return null;if(!(s[0]instanceof Z))throw new t(n,r.InvalidParameter,e);const c=I(s[1]);if(isNaN(c))throw new t(n,r.InvalidParameter,e);return 0===c?i(s[0]):C.buffer(s[0],c,l(g(s[2],-1)))}))},n.buffergeodetic=function(n,e){return b(n,e,((a,u,s)=>{if(s=o(s),f(s,2,3,n,e),null===s[0])return null;if(!(s[0]instanceof Z))throw new t(n,r.InvalidParameter,e);const c=I(s[1]);if(isNaN(c))throw new t(n,r.InvalidParameter,e);return 0===c?i(s[0]):C.geodesicBuffer(s[0],c,l(g(s[2],-1)))}))},n.offset=function(n,e){return b(n,e,((i,a,u)=>{if(u=o(u),f(u,2,6,n,e),null===u[0])return null;if(!(u[0]instanceof T||u[0]instanceof q))throw new t(n,r.InvalidParameter,e);const s=I(u[1]);if(isNaN(s))throw new t(n,r.InvalidParameter,e);const c=I(g(u[4],10));if(isNaN(c))throw new t(n,r.InvalidParameter,e);const d=I(g(u[5],0));if(isNaN(d))throw new t(n,r.InvalidParameter,e);return C.offset(u[0],s,l(g(u[2],-1)),m(g(u[3],"round")).toLowerCase(),c,d)}))},n.rotate=function(n,e){return b(n,e,((i,a,l)=>{if(l=o(l),f(l,2,3,n,e),null===l[0])return null;if(!(l[0]instanceof Z))throw new t(n,r.InvalidParameter,e);const u=l[0]instanceof M?T.fromExtent(l[0]):l[0],s=I(l[1]);if(isNaN(s))throw new t(n,r.InvalidParameter,e);const c=g(l[2],null);if(null===c)return C.rotate(u,s);if(c instanceof S)return C.rotate(u,s,c);throw new t(n,r.InvalidParameter,e)}))},n.centroid=function(n,e){return b(n,e,((a,l,u)=>{if(u=o(u),f(u,1,1,n,e),null===u[0])return null;let s=u[0];if((d(u[0])||h(u[0]))&&(s=P(u[0],n.spatialReference)),null===s)return null;if(!(s instanceof Z))throw new t(n,r.InvalidParameter,e);return s instanceof S?w(i(s),n.spatialReference):s instanceof T?s.centroid:s instanceof q?j(s):s instanceof E?N(s):s instanceof M?s.center:null}))},n.measuretocoordinate=function(n,i){return b(n,i,((a,l,u)=>{if(u=o(u),f(u,2,2,n,i),null===u[0])return null;let s=u[0];if((d(u[0])||h(u[0]))&&(s=v(u[0],n.spatialReference)),null===s)return null;if(!(s instanceof Z))throw new t(n,r.InvalidParameter,i);if(!(s instanceof q))throw new t(n,r.InvalidParameter,i);if(R(!1===u[1]))throw new t(n,r.InvalidParameter,i);const c=O(s,u[1]);return c?e.convertObjectToArcadeDictionary(c,x(n),!1,!0):null}))},n.pointtocoordinate=function(n,i){return b(n,i,((a,l,u)=>{if(u=o(u),f(u,2,2,n,i),null===u[0])return null;let s=u[0];if((d(u[0])||h(u[0]))&&(s=v(u[0],n.spatialReference)),null===s)return null;if(!(s instanceof Z))throw new t(n,r.InvalidParameter,i);if(!(s instanceof q))throw new t(n,r.InvalidParameter,i);const c=u[1];if(null===c)return null;if(!(c instanceof S))throw new t(n,r.InvalidParameter,i);if(R(!1===u[1]))throw new t(n,r.InvalidParameter,i);const m=A(s,c);return m?e.convertObjectToArcadeDictionary(m,x(n),!1,!0):null}))},n.distancetocoordinate=function(n,i){return b(n,i,((a,l,u)=>{if(u=o(u),f(u,2,2,n,i),null===u[0])return null;let s=u[0];if((d(u[0])||h(u[0]))&&(s=v(u[0],n.spatialReference)),null===s)return null;if(!(s instanceof Z))throw new t(n,r.InvalidParameter,i);if(!(s instanceof q))throw new t(n,r.InvalidParameter,i);if(R(!1===u[1]))throw new t(n,r.InvalidParameter,i);const c=D(s,u[1]);return c?e.convertObjectToArcadeDictionary(c,x(n),!1,!0):null}))},n.multiparttosinglepart=function(n,e){return b(n,e,((a,l,u)=>{if(u=o(u),f(u,1,1,n,e),null===u[0])return null;if(!(u[0]instanceof Z))throw new t(n,r.InvalidParameter,e);if(u[0]instanceof S)return[w(i(u[0]),n.spatialReference)];if(u[0]instanceof M)return[w(i(u[0]),n.spatialReference)];const s=C.simplify(u[0]);if(s instanceof T){const n=[],e=[];for(let t=0;t<s.rings.length;t++)if(s.isClockwise(s.rings[t])){const e=z({rings:[s.rings[t]],hasZ:!0===s.hasZ,hasM:!0===s.hasM,spatialReference:s.spatialReference.toJSON()});n.push(e)}else e.push({ring:s.rings[t],pt:s.getPoint(t,0)});for(let t=0;t<e.length;t++)for(let r=0;r<n.length;r++)if(n[r].contains(e[t].pt)){n[r].addRing(e[t].ring);break}return n}if(s instanceof q){const n=[];for(let e=0;e<s.paths.length;e++){const t=z({paths:[s.paths[e]],hasZ:!0===s.hasZ,hasM:!0===s.hasM,spatialReference:s.spatialReference.toJSON()});n.push(t)}return n}if(u[0]instanceof E){const e=[],t=w(i(u[0]),n.spatialReference);for(let n=0;n<t.points.length;n++)e.push(t.getPoint(n));return e}return null}))},n.issimple=function(n,e){return b(n,e,((i,a,l)=>{if(l=o(l),f(l,1,1,n,e),null===l[0])return!0;if(!(l[0]instanceof Z))throw new t(n,r.InvalidParameter,e);return C.isSimple(l[0])}))},n.simplify=function(n,e){return b(n,e,((i,a,l)=>{if(l=o(l),f(l,1,1,n,e),null===l[0])return null;if(!(l[0]instanceof Z))throw new t(n,r.InvalidParameter,e);return C.simplify(l[0])}))},n.convexhull=function(n,e){return b(n,e,((i,a,l)=>{if(l=o(l),f(l,1,1,n,e),null===l[0])return null;if(!(l[0]instanceof Z))throw new t(n,r.InvalidParameter,e);return C.convexHull(l[0])}))},n.nearestcoordinate=function(n,i){return b(n,i,((a,l,u)=>{if(u=o(u),f(u,2,2,n,i),!(u[0]instanceof Z||null===u[0]))throw new t(n,r.InvalidParameter,i);if(!(u[1]instanceof S||null===u[1]))throw new t(n,r.InvalidParameter,i);if(null===u[0]||null===u[1])return null;const s=C.nearestCoordinate(u[0],u[1]);return null===s||s.isEmpty?null:e.convertObjectToArcadeDictionary({coordinate:s.coordinate,distance:s.distance,sideOfLine:0===s.distance?"straddle":s.isRightSide?"right":"left"},x(n),!1,!0)}))},n.nearestvertex=function(n,i){return b(n,i,((a,l,u)=>{if(u=o(u),f(u,2,2,n,i),!(u[0]instanceof Z||null===u[0]))throw new t(n,r.InvalidParameter,i);if(!(u[1]instanceof S||null===u[1]))throw new t(n,r.InvalidParameter,i);if(null===u[0]||null===u[1])return null;const s=C.nearestVertex(u[0],u[1]);return null===s||s.isEmpty?null:e.convertObjectToArcadeDictionary({coordinate:s.coordinate,distance:s.distance,sideOfLine:0===s.distance?"straddle":s.isRightSide?"right":"left"},x(n),!1,!0)}))}}export{H as registerFunctions,U as setGeometryEngine};
5
+ import n from"../Dictionary.js";import{ArcadeExecutionError as e,ExecutionErrorCodes as t}from"../executionError.js";import{cloneGeometry as r,convertSquareUnitsToCode as i,convertLinearUnitsToCode as a}from"../kernel.js";import{I as l,H as o,k as f,n as u,m as s,j as c,o as h,q as d,x as m,J as w,K as p,L as g,M as v,g as P,h as I,b as y,N as R}from"../../chunks/languageUtils.js";import{centroidPolyline as j,centroidMultiPoint as N,getMetersPerVerticalUnitForSR as x,segmentLength3d as b}from"./centroid.js";import{measureToCoordinate as L,pointToCoordinate as A,distanceToCoordinate as O}from"./measures.js";import{getMetersPerUnitForSR as D}from"../../core/unitUtils.js";import M from"../../geometry/Extent.js";import k from"../../geometry/Geometry.js";import E from"../../geometry/Multipoint.js";import Z from"../../geometry/Point.js";import S from"../../geometry/Polygon.js";import T from"../../geometry/Polyline.js";import{fromJSON as q}from"../../geometry/support/jsonUtils.js";let z=null;function C(n){z=n}function J(n,e){if("polygon"!==n.type&&"polyline"!==n.type&&"extent"!==n.type)return 0;let t=1;if(n.spatialReference.vcsWkid||n.spatialReference.latestVcsWkid){t=x(n.spatialReference)/D(n.spatialReference)}let r=0;if("polyline"===n.type)for(const a of n.paths)for(let n=1;n<a.length;n++)r+=b(a[n],a[n-1],t);else if("polygon"===n.type)for(const a of n.rings){for(let n=1;n<a.length;n++)r+=b(a[n],a[n-1],t);(a[0][0]!==a[a.length-1][0]||a[0][1]!==a[a.length-1][1]||void 0!==a[0][2]&&a[0][2]!==a[a.length-1][2])&&(r+=b(a[0],a[a.length-1],t))}else"extent"===n.type&&(r+=2*b([n.xmin,n.ymin,0],[n.xmax,n.ymin,0],t),r+=2*b([n.xmin,n.ymin,0],[n.xmin,n.ymax,0],t),r*=2,r+=4*Math.abs(p(n.zmax,0)*t-p(n.zmin,0)*t));const i=new T({hasZ:!1,hasM:!1,spatialReference:n.spatialReference,paths:[[0,0],[0,r]]});return z.planarLength(i,e)}function U(x,b){function D(n,r,i){if(o(i,2,2,n,r),i[0]instanceof k&&i[1]instanceof k);else if(i[0]instanceof k&&null===i[1]);else if(i[1]instanceof k&&null===i[0]);else if(null!==i[0]||null!==i[1])throw new e(n,t.InvalidParameter,r)}x.disjoint=function(n,e){return b(n,e,((t,r,i)=>(i=l(i),D(n,e,i),null===i[0]||null===i[1]||z.disjoint(i[0],i[1]))))},x.intersects=function(n,e){return b(n,e,((t,r,i)=>(i=l(i),D(n,e,i),null!==i[0]&&null!==i[1]&&z.intersects(i[0],i[1]))))},x.touches=function(n,e){return b(n,e,((t,r,i)=>(i=l(i),D(n,e,i),null!==i[0]&&null!==i[1]&&z.touches(i[0],i[1]))))},x.crosses=function(n,e){return b(n,e,((t,r,i)=>(i=l(i),D(n,e,i),null!==i[0]&&null!==i[1]&&z.crosses(i[0],i[1]))))},x.within=function(n,e){return b(n,e,((t,r,i)=>(i=l(i),D(n,e,i),null!==i[0]&&null!==i[1]&&z.within(i[0],i[1]))))},x.contains=function(n,e){return b(n,e,((t,r,i)=>(i=l(i),D(n,e,i),null!==i[0]&&null!==i[1]&&z.contains(i[0],i[1]))))},x.overlaps=function(n,e){return b(n,e,((t,r,i)=>(i=l(i),D(n,e,i),null!==i[0]&&null!==i[1]&&z.overlaps(i[0],i[1]))))},x.equals=function(n,e){return b(n,e,((t,r,i)=>(o(i,2,2,n,e),i[0]===i[1]||(i[0]instanceof k&&i[1]instanceof k?z.equals(i[0],i[1]):(f(i[0])&&f(i[1])||u(i[0])&&u(i[1])||!(!s(i[0])||!s(i[1])))&&i[0].equals(i[1])))))},x.relate=function(n,r){return b(n,r,((i,a,f)=>{if(f=l(f),o(f,3,3,n,r),f[0]instanceof k&&f[1]instanceof k)return z.relate(f[0],f[1],c(f[2]));if(f[0]instanceof k&&null===f[1])return!1;if(f[1]instanceof k&&null===f[0])return!1;if(null===f[0]&&null===f[1])return!1;throw new e(n,t.InvalidParameter,r)}))},x.intersection=function(n,e){return b(n,e,((t,r,i)=>(i=l(i),D(n,e,i),null===i[0]||null===i[1]?null:z.intersect(i[0],i[1]))))},x.union=function(n,i){return b(n,i,((a,o,f)=>{const u=[];if(0===(f=l(f)).length)throw new e(n,t.WrongNumberOfParameters,i);if(1===f.length)if(h(f[0])){const r=l(f[0]);for(let a=0;a<r.length;a++)if(null!==r[a]){if(!(r[a]instanceof k))throw new e(n,t.InvalidParameter,i);u.push(r[a])}}else{if(!d(f[0])){if(f[0]instanceof k)return m(r(f[0]),n.spatialReference);if(null===f[0])return null;throw new e(n,t.InvalidParameter,i)}{const r=l(f[0].toArray());for(let a=0;a<r.length;a++)if(null!==r[a]){if(!(r[a]instanceof k))throw new e(n,t.InvalidParameter,i);u.push(r[a])}}}else for(let r=0;r<f.length;r++)if(null!==f[r]){if(!(f[r]instanceof k))throw new e(n,t.InvalidParameter,i);u.push(f[r])}return 0===u.length?null:z.union(u)}))},x.difference=function(n,e){return b(n,e,((t,i,a)=>(a=l(a),D(n,e,a),null===a[0]?null:null===a[1]?r(a[0]):z.difference(a[0],a[1]))))},x.symmetricdifference=function(n,e){return b(n,e,((t,i,a)=>(a=l(a),D(n,e,a),null===a[0]&&null===a[1]?null:null===a[0]?r(a[1]):null===a[1]?r(a[0]):z.symmetricDifference(a[0],a[1]))))},x.clip=function(n,r){return b(n,r,((i,a,f)=>{if(f=l(f),o(f,2,2,n,r),!(f[1]instanceof M)&&null!==f[1])throw new e(n,t.InvalidParameter,r);if(null===f[0])return null;if(!(f[0]instanceof k))throw new e(n,t.InvalidParameter,r);return null===f[1]?null:z.clip(f[0],f[1])}))},x.cut=function(n,i){return b(n,i,((a,f,u)=>{if(u=l(u),o(u,2,2,n,i),!(u[1]instanceof T)&&null!==u[1])throw new e(n,t.InvalidParameter,i);if(null===u[0])return[];if(!(u[0]instanceof k))throw new e(n,t.InvalidParameter,i);return null===u[1]?[r(u[0])]:z.cut(u[0],u[1])}))},x.area=function(n,r){return b(n,r,((a,f,u)=>{if(o(u,1,2,n,r),null===(u=l(u))[0])return 0;if(h(u[0])||d(u[0])){const e=w(u[0],n.spatialReference);return null===e?0:z.planarArea(e,i(p(u[1],-1)))}if(!(u[0]instanceof k))throw new e(n,t.InvalidParameter,r);return z.planarArea(u[0],i(p(u[1],-1)))}))},x.areageodetic=function(n,r){return b(n,r,((a,f,u)=>{if(o(u,1,2,n,r),null===(u=l(u))[0])return 0;if(h(u[0])||d(u[0])){const e=w(u[0],n.spatialReference);return null===e?0:z.geodesicArea(e,i(p(u[1],-1)))}if(!(u[0]instanceof k))throw new e(n,t.InvalidParameter,r);return z.geodesicArea(u[0],i(p(u[1],-1)))}))},x.length=function(n,r){return b(n,r,((i,f,u)=>{if(o(u,1,2,n,r),null===(u=l(u))[0])return 0;if(h(u[0])||d(u[0])){const e=g(u[0],n.spatialReference);return null===e?0:z.planarLength(e,a(p(u[1],-1)))}if(!(u[0]instanceof k))throw new e(n,t.InvalidParameter,r);return z.planarLength(u[0],a(p(u[1],-1)))}))},x.length3d=function(n,r){return b(n,r,((i,f,u)=>{if(o(u,1,2,n,r),null===(u=l(u))[0])return 0;if(h(u[0])||d(u[0])){const e=g(u[0],n.spatialReference);return null===e?0:!0===e.hasZ?J(e,a(p(u[1],-1))):z.planarLength(e,a(p(u[1],-1)))}if(!(u[0]instanceof k))throw new e(n,t.InvalidParameter,r);return!0===u[0].hasZ?J(u[0],a(p(u[1],-1))):z.planarLength(u[0],a(p(u[1],-1)))}))},x.lengthgeodetic=function(n,r){return b(n,r,((i,f,u)=>{if(o(u,1,2,n,r),null===(u=l(u))[0])return 0;if(h(u[0])||d(u[0])){const e=g(u[0],n.spatialReference);return null===e?0:z.geodesicLength(e,a(p(u[1],-1)))}if(!(u[0]instanceof k))throw new e(n,t.InvalidParameter,r);return z.geodesicLength(u[0],a(p(u[1],-1)))}))},x.distance=function(n,r){return b(n,r,((i,f,u)=>{u=l(u),o(u,2,3,n,r);let s=u[0];(h(u[0])||d(u[0]))&&(s=v(u[0],n.spatialReference));let c=u[1];if((h(u[1])||d(u[1]))&&(c=v(u[1],n.spatialReference)),!(s instanceof k))throw new e(n,t.InvalidParameter,r);if(!(c instanceof k))throw new e(n,t.InvalidParameter,r);return z.distance(s,c,a(p(u[2],-1)))}))},x.distancegeodetic=function(n,r){return b(n,r,((i,f,u)=>{u=l(u),o(u,2,3,n,r);const s=u[0],c=u[1];if(!(s instanceof Z))throw new e(n,t.InvalidParameter,r);if(!(c instanceof Z))throw new e(n,t.InvalidParameter,r);const h=new T({paths:[],spatialReference:s.spatialReference});return h.addPath([s,c]),z.geodesicLength(h,a(p(u[2],-1)))}))},x.densify=function(n,r){return b(n,r,((i,f,u)=>{if(u=l(u),o(u,2,3,n,r),null===u[0])return null;if(!(u[0]instanceof k))throw new e(n,t.InvalidParameter,r);const s=P(u[1]);if(isNaN(s))throw new e(n,t.InvalidParameter,r);if(s<=0)throw new e(n,t.InvalidParameter,r);return u[0]instanceof S||u[0]instanceof T?z.densify(u[0],s,a(p(u[2],-1))):u[0]instanceof M?z.densify(S.fromExtent(u[0]),s,a(p(u[2],-1))):u[0]}))},x.densifygeodetic=function(n,r){return b(n,r,((i,f,u)=>{if(u=l(u),o(u,2,3,n,r),null===u[0])return null;if(!(u[0]instanceof k))throw new e(n,t.InvalidParameter,r);const s=P(u[1]);if(isNaN(s))throw new e(n,t.InvalidParameter,r);if(s<=0)throw new e(n,t.InvalidParameter,r);return u[0]instanceof S||u[0]instanceof T?z.geodesicDensify(u[0],s,a(p(u[2],-1))):u[0]instanceof M?z.geodesicDensify(S.fromExtent(u[0]),s,a(p(u[2],-1))):u[0]}))},x.generalize=function(n,r){return b(n,r,((i,f,u)=>{if(u=l(u),o(u,2,4,n,r),null===u[0])return null;if(!(u[0]instanceof k))throw new e(n,t.InvalidParameter,r);const s=P(u[1]);if(isNaN(s))throw new e(n,t.InvalidParameter,r);return z.generalize(u[0],s,I(p(u[2],!0)),a(p(u[3],-1)))}))},x.buffer=function(n,i){return b(n,i,((f,u,s)=>{if(s=l(s),o(s,2,3,n,i),null===s[0])return null;if(!(s[0]instanceof k))throw new e(n,t.InvalidParameter,i);const c=P(s[1]);if(isNaN(c))throw new e(n,t.InvalidParameter,i);return 0===c?r(s[0]):z.buffer(s[0],c,a(p(s[2],-1)))}))},x.buffergeodetic=function(n,i){return b(n,i,((f,u,s)=>{if(s=l(s),o(s,2,3,n,i),null===s[0])return null;if(!(s[0]instanceof k))throw new e(n,t.InvalidParameter,i);const c=P(s[1]);if(isNaN(c))throw new e(n,t.InvalidParameter,i);return 0===c?r(s[0]):z.geodesicBuffer(s[0],c,a(p(s[2],-1)))}))},x.offset=function(n,r){return b(n,r,((i,f,u)=>{if(u=l(u),o(u,2,6,n,r),null===u[0])return null;if(!(u[0]instanceof S||u[0]instanceof T))throw new e(n,t.InvalidParameter,r);const s=P(u[1]);if(isNaN(s))throw new e(n,t.InvalidParameter,r);const h=P(p(u[4],10));if(isNaN(h))throw new e(n,t.InvalidParameter,r);const d=P(p(u[5],0));if(isNaN(d))throw new e(n,t.InvalidParameter,r);return z.offset(u[0],s,a(p(u[2],-1)),c(p(u[3],"round")).toLowerCase(),h,d)}))},x.rotate=function(n,r){return b(n,r,((i,a,f)=>{if(f=l(f),o(f,2,3,n,r),null===f[0])return null;if(!(f[0]instanceof k))throw new e(n,t.InvalidParameter,r);const u=f[0]instanceof M?S.fromExtent(f[0]):f[0],s=P(f[1]);if(isNaN(s))throw new e(n,t.InvalidParameter,r);const c=p(f[2],null);if(null===c)return z.rotate(u,s);if(c instanceof Z)return z.rotate(u,s,c);throw new e(n,t.InvalidParameter,r)}))},x.centroid=function(n,i){return b(n,i,((a,f,u)=>{if(u=l(u),o(u,1,1,n,i),null===u[0])return null;let s=u[0];if((h(u[0])||d(u[0]))&&(s=v(u[0],n.spatialReference)),null===s)return null;if(!(s instanceof k))throw new e(n,t.InvalidParameter,i);return s instanceof Z?m(r(s),n.spatialReference):s instanceof S?s.centroid:s instanceof T?j(s):s instanceof E?N(s):s instanceof M?s.center:null}))},x.measuretocoordinate=function(r,i){return b(r,i,((a,f,u)=>{if(u=l(u),o(u,2,2,r,i),null===u[0])return null;let s=u[0];if((h(u[0])||d(u[0]))&&(s=g(u[0],r.spatialReference)),null===s)return null;if(!(s instanceof k))throw new e(r,t.InvalidParameter,i);if(!(s instanceof T))throw new e(r,t.InvalidParameter,i);if(y(!1===u[1]))throw new e(r,t.InvalidParameter,i);const c=L(s,u[1]);return c?n.convertObjectToArcadeDictionary(c,R(r),!1,!0):null}))},x.pointtocoordinate=function(r,i){return b(r,i,((a,f,u)=>{if(u=l(u),o(u,2,2,r,i),null===u[0])return null;let s=u[0];if((h(u[0])||d(u[0]))&&(s=g(u[0],r.spatialReference)),null===s)return null;if(!(s instanceof k))throw new e(r,t.InvalidParameter,i);if(!(s instanceof T))throw new e(r,t.InvalidParameter,i);const c=u[1];if(null===c)return null;if(!(c instanceof Z))throw new e(r,t.InvalidParameter,i);if(y(!1===u[1]))throw new e(r,t.InvalidParameter,i);const m=A(s,c);return m?n.convertObjectToArcadeDictionary(m,R(r),!1,!0):null}))},x.distancetocoordinate=function(r,i){return b(r,i,((a,f,u)=>{if(u=l(u),o(u,2,2,r,i),null===u[0])return null;let s=u[0];if((h(u[0])||d(u[0]))&&(s=g(u[0],r.spatialReference)),null===s)return null;if(!(s instanceof k))throw new e(r,t.InvalidParameter,i);if(!(s instanceof T))throw new e(r,t.InvalidParameter,i);if(y(!1===u[1]))throw new e(r,t.InvalidParameter,i);const c=O(s,u[1]);return c?n.convertObjectToArcadeDictionary(c,R(r),!1,!0):null}))},x.multiparttosinglepart=function(n,i){return b(n,i,((a,f,u)=>{if(u=l(u),o(u,1,1,n,i),null===u[0])return null;if(!(u[0]instanceof k))throw new e(n,t.InvalidParameter,i);if(u[0]instanceof Z)return[m(r(u[0]),n.spatialReference)];if(u[0]instanceof M)return[m(r(u[0]),n.spatialReference)];const s=z.simplify(u[0]);if(s instanceof S){const n=[],e=[];for(let t=0;t<s.rings.length;t++)if(s.isClockwise(s.rings[t])){const e=q({rings:[s.rings[t]],hasZ:!0===s.hasZ,hasM:!0===s.hasM,spatialReference:s.spatialReference.toJSON()});n.push(e)}else e.push({ring:s.rings[t],pt:s.getPoint(t,0)});for(let t=0;t<e.length;t++)for(let r=0;r<n.length;r++)if(n[r].contains(e[t].pt)){n[r].addRing(e[t].ring);break}return n}if(s instanceof T){const n=[];for(let e=0;e<s.paths.length;e++){const t=q({paths:[s.paths[e]],hasZ:!0===s.hasZ,hasM:!0===s.hasM,spatialReference:s.spatialReference.toJSON()});n.push(t)}return n}if(u[0]instanceof E){const e=[],t=m(r(u[0]),n.spatialReference);for(let n=0;n<t.points.length;n++)e.push(t.getPoint(n));return e}return null}))},x.issimple=function(n,r){return b(n,r,((i,a,f)=>{if(f=l(f),o(f,1,1,n,r),null===f[0])return!0;if(!(f[0]instanceof k))throw new e(n,t.InvalidParameter,r);return z.isSimple(f[0])}))},x.simplify=function(n,r){return b(n,r,((i,a,f)=>{if(f=l(f),o(f,1,1,n,r),null===f[0])return null;if(!(f[0]instanceof k))throw new e(n,t.InvalidParameter,r);return z.simplify(f[0])}))},x.convexhull=function(n,r){return b(n,r,((i,a,f)=>{if(f=l(f),o(f,1,1,n,r),null===f[0])return null;if(!(f[0]instanceof k))throw new e(n,t.InvalidParameter,r);return z.convexHull(f[0])}))},x.nearestcoordinate=function(r,i){return b(r,i,((a,f,u)=>{if(u=l(u),o(u,2,2,r,i),!(u[0]instanceof k||null===u[0]))throw new e(r,t.InvalidParameter,i);if(!(u[1]instanceof Z||null===u[1]))throw new e(r,t.InvalidParameter,i);if(null===u[0]||null===u[1])return null;const s=z.nearestCoordinate(u[0],u[1]);return null===s||s.isEmpty?null:n.convertObjectToArcadeDictionary({coordinate:s.coordinate,distance:s.distance,sideOfLine:0===s.distance?"straddle":s.isRightSide?"right":"left"},R(r),!1,!0)}))},x.nearestvertex=function(r,i){return b(r,i,((a,f,u)=>{if(u=l(u),o(u,2,2,r,i),!(u[0]instanceof k||null===u[0]))throw new e(r,t.InvalidParameter,i);if(!(u[1]instanceof Z||null===u[1]))throw new e(r,t.InvalidParameter,i);if(null===u[0]||null===u[1])return null;const s=z.nearestVertex(u[0],u[1]);return null===s||s.isEmpty?null:n.convertObjectToArcadeDictionary({coordinate:s.coordinate,distance:s.distance,sideOfLine:0===s.distance?"straddle":s.isRightSide?"right":"left"},R(r),!1,!0)}))}}export{U as registerFunctions,C as setGeometryEngine};