@arcgis/core 4.34.0-next.35 → 4.34.0-next.36
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.
- package/analysis/ElevationProfileAnalysis.d.ts +4 -0
- package/analysis/ElevationProfileAnalysis.js +5 -0
- package/analysis/ElevationProfileLine.d.ts +4 -0
- package/analysis/ElevationProfileLine.js +5 -0
- package/analysis/ElevationProfileLineChartOptions.d.ts +4 -0
- package/analysis/ElevationProfileLineChartOptions.js +5 -0
- package/analysis/ElevationProfileLineGround.d.ts +4 -0
- package/analysis/ElevationProfileLineGround.js +5 -0
- package/analysis/ElevationProfileLineInput.d.ts +4 -0
- package/analysis/ElevationProfileLineInput.js +5 -0
- package/analysis/ElevationProfileLineQuery.d.ts +4 -0
- package/analysis/ElevationProfileLineQuery.js +5 -0
- package/analysis/ElevationProfileLineScene.d.ts +4 -0
- package/analysis/ElevationProfileLineScene.js +5 -0
- package/analysis/ElevationProfileLineViewOptions.d.ts +4 -0
- package/analysis/ElevationProfileLineViewOptions.js +5 -0
- package/analysis/ElevationProfileUnits.d.ts +4 -0
- package/analysis/ElevationProfileUnits.js +5 -0
- package/analysis/support/elevationProfileLineTypes.js +5 -0
- package/arcade/arcadeAsyncRuntime.js +1 -1
- package/arcade/arcadeCompiler.js +1 -1
- package/arcade/arcadeRuntime.js +1 -1
- package/arcade/compilerUtils.js +5 -0
- package/arcade/containerUtils.js +1 -1
- package/arcade/functions/convertdirection.js +1 -1
- package/arcade/functions/date.js +1 -1
- package/arcade/functions/feature.js +1 -1
- package/arcade/functions/featuresetbase.js +1 -1
- package/arcade/functions/featuresetgeom.js +1 -1
- package/arcade/functions/featuresetstring.js +1 -1
- package/arcade/functions/fieldStats.js +1 -1
- package/arcade/functions/geomasync.js +1 -1
- package/arcade/functions/geometry.js +1 -1
- package/arcade/functions/geomsync.js +1 -1
- package/arcade/functions/knowledgegraph.js +1 -1
- package/arcade/functions/maths.js +1 -1
- package/arcade/functions/string.js +1 -1
- package/arcade/functions/track.js +1 -1
- package/arcade/geometry/functions.js +1 -1
- package/arcade/languageUtils.js +1 -1
- package/arcade.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{7b1d14a921d30c95d68b.js → 0550e775677597f3752c.js} +1 -1
- package/assets/esri/core/workers/chunks/0c0080b652cf8afc4e6b.js +1 -0
- package/assets/esri/core/workers/chunks/152128775b4740e779ab.js +1 -0
- package/assets/esri/core/workers/chunks/1e58b1e191498417c21d.js +1 -0
- package/assets/esri/core/workers/chunks/2032b649350a75ba294f.js +1 -0
- package/assets/esri/core/workers/chunks/{55a763662bad03ae6bae.js → 209c70ba2925171ef742.js} +1 -1
- package/assets/esri/core/workers/chunks/2105d2cc75e75bf8f1c0.js +1 -0
- package/assets/esri/core/workers/chunks/236fc659747e812f6424.js +1 -0
- package/assets/esri/core/workers/chunks/2c29f8a708a03cb703ab.js +1 -0
- package/assets/esri/core/workers/chunks/{ddaaff5d6036a5eed50f.js → 44116cf0bd4d6a127c96.js} +1 -1
- package/assets/esri/core/workers/chunks/4c54239974a5847b8fdd.js +1 -0
- package/assets/esri/core/workers/chunks/4fb13252a985131d3dae.js +1 -0
- package/assets/esri/core/workers/chunks/{b89aacec211c66e3a011.js → 5d8c64693830506c8776.js} +1 -1
- package/assets/esri/core/workers/chunks/5f995450f720483fcffa.js +1 -0
- package/assets/esri/core/workers/chunks/81be8d23b8dfa4937eaf.js +1 -0
- package/assets/esri/core/workers/chunks/{0ec7b5f1a614a86ad3db.js → 948ecf0bfbc886ec3b52.js} +1 -1
- package/assets/esri/core/workers/chunks/9f43736d6d80c8e858b2.js +1 -0
- package/assets/esri/core/workers/chunks/a44f17397d8589433dae.js +1 -0
- package/assets/esri/core/workers/chunks/a53f2529b7067c28f320.js +1 -0
- package/assets/esri/core/workers/chunks/a6b6915b7321f77f765f.js +1 -0
- package/assets/esri/core/workers/chunks/ab73df4f809430db6249.js +1 -0
- package/assets/esri/core/workers/chunks/ae7f1499912c86973921.js +1 -0
- package/assets/esri/core/workers/chunks/b98a049561b12a0555b7.js +1 -0
- package/assets/esri/core/workers/chunks/{4784af2b04fafacfcc1b.js → c6077a893d5b5c34a46c.js} +1 -1
- package/assets/esri/core/workers/chunks/cd150c7e1516134c7437.js +1 -0
- package/assets/esri/core/workers/chunks/d4cadde4a9cbfe2c51d8.js +1 -0
- package/assets/esri/core/workers/chunks/dab82564928265b9f22d.js +1 -0
- package/assets/esri/core/workers/chunks/e897c5ce83db8a71b0a2.js +1 -0
- package/assets/esri/core/workers/chunks/{41071e672dcddec47492.js → f4e9640306f64b1af7a3.js} +1 -1
- package/assets/esri/core/workers/chunks/fa01d418237d7fa67efc.js +1 -0
- package/assets/esri/core/workers/chunks/ff736cb5a9fd18368244.js +1 -0
- package/chunks/arcade.js +1 -1
- package/chunks/array.js +1 -1
- package/chunks/languageUtils.js +1 -1
- package/config.js +1 -1
- package/copyright.txt +27 -0
- package/core/accessorSupport/ensureType.js +1 -1
- package/geometry/support/DoubleArray.js +1 -1
- package/interfaces.d.ts +671 -50
- package/kernel.js +1 -1
- package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
- package/layers/support/PromiseQueue.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/3d/FocusAreasView.js +1 -1
- package/views/3d/analysis/AnalysisViewManager3D.js +1 -1
- package/views/3d/analysis/ElevationProfileAnalysisView3D.d.ts +4 -0
- package/views/3d/analysis/ElevationProfileAnalysisView3D.js +5 -0
- package/views/3d/analysis/Slice/SliceController.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/environment/Clouds.js +1 -1
- package/views/3d/environment/CloudsRenderer.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
- package/views/3d/layers/GraphicsView3D.js +1 -1
- package/views/3d/layers/GraphicsView3DDummyLayer.js +5 -0
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerWorker.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/ElevationQuery.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DElevationAlignment.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFrustumVisibility.js +1 -1
- package/views/3d/layers/graphics/Graphics3DScaleVisibility.js +1 -1
- package/views/3d/layers/graphics/GraphicsDeconflictor.js +1 -1
- package/views/3d/layers/graphics/LabelDeconflictor.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/graphics/StreamController.js +1 -1
- package/views/3d/layers/i3s/I3SAsyncElevationUpdater.js +1 -1
- package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
- package/views/3d/layers/i3s/I3SFrameTask.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/FeatureTileTree3D.js +1 -1
- package/views/3d/layers/support/FeatureVisibilityFilter.js +1 -1
- package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
- package/views/3d/support/StreamDataLoader.js +1 -1
- package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/Focus.js +1 -1
- package/views/3d/support/pointsOfInterest/SurfaceGeometryUpdates.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/Stage.js +1 -1
- package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
- package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
- package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/GPUPointOcclusionQuery.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/analysis/ElevationProfileResult.d.ts +4 -0
- package/views/analysis/ElevationProfileResult.js +5 -0
- package/views/support/ScheduledQueueProcessor.js +1 -1
- package/views/support/Scheduler.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileLine.d.ts +2 -2
- package/widgets/ElevationProfile/ElevationProfileLine.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileLineGround.d.ts +2 -2
- package/widgets/ElevationProfile/ElevationProfileLineInput.d.ts +2 -2
- package/widgets/ElevationProfile/ElevationProfileLineQuery.d.ts +2 -2
- package/assets/esri/core/workers/chunks/00870a35b254295bc408.js +0 -1
- package/assets/esri/core/workers/chunks/017adbbb77c9c9b4d49f.js +0 -1
- package/assets/esri/core/workers/chunks/086f3bc5938bf9a37274.js +0 -1
- package/assets/esri/core/workers/chunks/15a5a89cd228a9364332.js +0 -1
- package/assets/esri/core/workers/chunks/20aed6e1d9b6bf06a398.js +0 -1
- package/assets/esri/core/workers/chunks/2de11a8e5d426c381991.js +0 -1
- package/assets/esri/core/workers/chunks/3a7e43675163f7bed6ac.js +0 -1
- package/assets/esri/core/workers/chunks/3cd1ab26396052f17832.js +0 -1
- package/assets/esri/core/workers/chunks/50f58b2a933b56effd70.js +0 -1
- package/assets/esri/core/workers/chunks/6000a302369799ea42a6.js +0 -1
- package/assets/esri/core/workers/chunks/646227b500b92999f2c8.js +0 -1
- package/assets/esri/core/workers/chunks/674970c539d336a93ba1.js +0 -1
- package/assets/esri/core/workers/chunks/773feb0e0fad26df57ef.js +0 -1
- package/assets/esri/core/workers/chunks/91d48c32bf11ad1405c8.js +0 -1
- package/assets/esri/core/workers/chunks/9228f760129e48585b54.js +0 -1
- package/assets/esri/core/workers/chunks/aaf696a1026de569c82d.js +0 -1
- package/assets/esri/core/workers/chunks/ba29c535128c4e8ae2d3.js +0 -1
- package/assets/esri/core/workers/chunks/c038472cb7f60af9426e.js +0 -1
- package/assets/esri/core/workers/chunks/c1e5e2a6e7e2d7a1d63c.js +0 -1
- package/assets/esri/core/workers/chunks/c30adbead0ba4722acf9.js +0 -1
- package/assets/esri/core/workers/chunks/d9045b964f536695840b.js +0 -1
- package/assets/esri/core/workers/chunks/dde6000aa2f69f6ecad0.js +0 -1
- package/assets/esri/core/workers/chunks/e18bb372457cedbf4f8c.js +0 -1
- package/assets/esri/core/workers/chunks/ed05399f9a07fea66685.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../Dictionary.js";import{ArcadeExecutionError as n}from"../executionError.js";import{cloneGeometry as t}from"../kernel.js";import{C as r,B as i,e as a,g as l,f as o,w as u,j as f,D as s,E as c,h as m,F as d,G as w,u as h,H as p,J as g,K as v}from"../../chunks/languageUtils.js";import{commonRelationsCheck as P,toCurveType as x,planarLength3D as y,toOffsetJoinType as I,toCentroidAlgorithm as R,measureToCoordinateFunc as j,pointToCoordinateFunc as N,distanceToCoordinateFunc as E}from"../geometry/functions.js";import{convertFromSpatialReferenceUnit as b,toAreaUnit as D,convert as O,toLengthUnit as S,convertToSpatialReferenceUnit as T}from"../geometry/unitConversion.js";import{equals as L}from"../../core/arrayUtils.js";import M from"../../geometry/Extent.js";import A from"../../geometry/Geometry.js";import Z from"../../geometry/Multipoint.js";import k from"../../geometry/Point.js";import C from"../../geometry/Polygon.js";import U from"../../geometry/Polyline.js";import{fromJSON as q}from"../../geometry/support/jsonUtils.js";import{squareMeters as J,meters as z}from"../geometry/extendedUnitData.js";import{isArray as B}from"../../support/guards.js";let G;async function H(){null==G&&(G=await import("../geometry/operators.js"),await G.loadAll())}function F(H,F){H.disjoint=function(e,n){return F(e,n,(t,i,a)=>(a=r(a),P(a,e,n),null===a[0]||null===a[1]||G.disjoint.execute(a[0],a[1])))},H.intersects=function(e,n){return F(e,n,(t,i,a)=>(a=r(a),P(a,e,n),null!==a[0]&&null!==a[1]&&G.intersects.execute(a[0],a[1])))},H.touches=function(e,n){return F(e,n,(t,i,a)=>(a=r(a),P(a,e,n),null!==a[0]&&null!==a[1]&&G.touches.execute(a[0],a[1])))},H.crosses=function(e,n){return F(e,n,(t,i,a)=>(a=r(a),P(a,e,n),null!==a[0]&&null!==a[1]&&G.crosses.execute(a[0],a[1])))},H.within=function(e,n){return F(e,n,(t,i,a)=>(a=r(a),P(a,e,n),null!==a[0]&&null!==a[1]&&G.within.execute(a[0],a[1])))},H.contains=function(e,n){return F(e,n,(t,i,a)=>(a=r(a),P(a,e,n),null!==a[0]&&null!==a[1]&&G.contains.execute(a[0],a[1])))},H.overlaps=function(e,n){return F(e,n,(t,i,a)=>(a=r(a),P(a,e,n),null!==a[0]&&null!==a[1]&&G.overlaps.execute(a[0],a[1])))},H.equals=function(e,n){return F(e,n,(t,r,u)=>(i(u,2,2,e,n),u[0]===u[1]||(u[0]instanceof A&&u[1]instanceof A?G.equals.execute(u[0],u[1]):(a(u[0])&&a(u[1])||l(u[0])&&l(u[1])||!(!o(u[0])||!o(u[1])))&&u[0].equals(u[1]))))},H.relate=function(e,t){return F(e,t,(a,l,o)=>{if(o=r(o),i(o,3,3,e,t),o[0]instanceof A&&o[1]instanceof A)return G.relate.execute(o[0],o[1],u(o[2]));if(o[0]instanceof A&&null===o[1])return!1;if(o[1]instanceof A&&null===o[0])return!1;if(null===o[0]&&null===o[1])return!1;throw new n(e,"InvalidParameter",t)})},H.intersection=function(e,n){return F(e,n,(t,i,a)=>(a=r(a),P(a,e,n),null===a[0]||null===a[1]?null:G.intersection.execute(a[0],a[1])))},H.union=function(e,i){return F(e,i,(a,l,o)=>{if(0===(o=r(o)).length)throw new n(e,"WrongNumberOfParameters",i);const u=[];if(1===o.length)if(B(o[0])){for(const t of r(o[0]))if(null!==t){if(!(t instanceof A))throw new n(e,"InvalidParameter",i);u.push(t)}}else{if(!f(o[0])){if(o[0]instanceof A)return s(t(o[0]),e.spatialReference);if(null===o[0])return null;throw new n(e,"InvalidParameter",i)}for(const t of r(o[0].toArray()))if(null!==t){if(!(t instanceof A))throw new n(e,"InvalidParameter",i);u.push(t)}}else for(const t of o)if(null!==t){if(!(t instanceof A))throw new n(e,"InvalidParameter",i);u.push(t)}return 0===u.length?null:G.union.executeMany(u)})},H.difference=function(e,n){return F(e,n,(i,a,l)=>(l=r(l),P(l,e,n),null===l[0]?null:null===l[1]?t(l[0]):G.difference.execute(l[0],l[1])))},H.symmetricdifference=function(e,n){return F(e,n,(i,a,l)=>(l=r(l),P(l,e,n),null===l[0]&&null===l[1]?null:null===l[0]?t(l[1]):null===l[1]?t(l[0]):G.symmetricDifference.execute(l[0],l[1])))},H.clip=function(e,t){return F(e,t,(a,l,o)=>{if(o=r(o),i(o,2,2,e,t),!(o[1]instanceof M)&&null!==o[1])throw new n(e,"InvalidParameter",t);if(null===o[0])return null;if(!(o[0]instanceof A))throw new n(e,"InvalidParameter",t);return null===o[1]?null:G.clip.execute(o[0],o[1])})},H.cut=function(e,a){return F(e,a,(l,o,u)=>{if(u=r(u),i(u,2,2,e,a),!(u[1]instanceof U)&&null!==u[1])throw new n(e,"InvalidParameter",a);if(null===u[0])return[];if(!(u[0]instanceof A))throw new n(e,"InvalidParameter",a);return null===u[1]?[t(u[0])]:G.cut.execute(u[0],u[1])})},H.area=function(e,t){return F(e,t,(a,l,o)=>{i(o,1,2,e,t);let u=(o=r(o))[0];if((B(o[0])||f(o[0]))&&(u=c(o[0],e.spatialReference)),null===u)return 0;if(!(u instanceof A))throw new n(e,"InvalidParameter",t);return b(u.spatialReference,D(o[1]),G.area.execute(u))})},H.areageodetic=function(e,t){return F(e,t,(a,l,o)=>{i(o,1,3,e,t);let u=(o=r(o))[0];(B(u)||f(u))&&(u=c(u,e.spatialReference));const s=D(o[1]),d=x(o[2]);if(null==u)return 0;if(!m(u))throw new n(e,"InvalidParameter",t);return O(J,s,G.geodeticArea.execute(u,{curveType:d}))})},H.length=function(e,t){return F(e,t,(a,l,o)=>{i(o,1,2,e,t);let u=(o=r(o))[0];if((B(o[0])||f(o[0]))&&(u=d(o[0],e.spatialReference)),null===u)return 0;if(!(u instanceof A))throw new n(e,"InvalidParameter",t);return b(u.spatialReference,S(o[1]),G.length.execute(u))})},H.length3d=function(e,t){return F(e,t,(a,l,o)=>{i(o,1,2,e,t);let u=(o=r(o))[0];if((B(o[0])||f(o[0]))&&(u=d(o[0],e.spatialReference)),null===u)return 0;if(!(u instanceof A))throw new n(e,"InvalidParameter",t);return!0===u.hasZ?b(u.spatialReference,S(o[1]),y(u)):b(u.spatialReference,S(o[1]),G.length.execute(u))})},H.lengthgeodetic=function(e,t){return F(e,t,(a,l,o)=>{i(o,1,3,e,t);let u=(o=r(o))[0];(B(o[0])||f(o[0]))&&(u=d(o[0],e.spatialReference));const s=x(o[2]);if(null==u)return 0;if(null!=u&&!m(u))throw new n(e,"InvalidParameter",t);const c=S(o[1]);return O(z,c,G.geodeticLength.execute(u,{curveType:s}))})},H.distance=function(e,t){return F(e,t,(a,l,o)=>{o=r(o),i(o,2,3,e,t);let u=o[0];if((B(o[0])||f(o[0]))&&(u=w(o[0],e.spatialReference)),!(u instanceof A))throw new n(e,"InvalidParameter",t);let s=o[1];if((B(o[1])||f(o[1]))&&(s=w(o[1],e.spatialReference)),!(s instanceof A))throw new n(e,"InvalidParameter",t);return b(u.spatialReference,S(o[2]),G.distance.execute(u,s))})},H.distancegeodetic=function(e,t){return F(e,t,(a,l,o)=>{o=r(o),i(o,2,4,e,t);const u=o[0];if(!(u instanceof k))throw new n(e,"InvalidParameter",t);const f=o[1];if(!(f instanceof k))throw new n(e,"InvalidParameter",t);const s=S(o[2]),c=x(o[3]),m=new U({paths:[],spatialReference:u.spatialReference});return m.addPath([u,f]),O(z,s,G.geodeticLength.execute(m,{curveType:c}))})},H.densify=function(e,t){return F(e,t,(a,l,o)=>{if(o=r(o),i(o,2,3,e,t),null===o[0])return null;if(!(o[0]instanceof A))throw new n(e,"InvalidParameter",t);const u=h(o[1]);if(isNaN(u))throw new n(e,"InvalidParameter",t);if(u<=0)throw new n(e,"InvalidParameter",t);const f=T(S(o[2]),o[0].spatialReference,u);switch(o[0].type){case"polygon":case"polyline":case"extent":return G.densify.execute(o[0],f);default:return o[0]}})},H.densifygeodetic=function(e,t){return F(e,t,(a,l,o)=>{o=r(o),i(o,2,4,e,t);const u=o[0];if(null==u)return null;if(!m(u))throw new n(e,"InvalidParameter",t);const f=h(o[1]);if(isNaN(f))throw new n(e,"InvalidParameter",t);if(f<=0)throw new n(e,"InvalidParameter",t);const s=S(o[2]),c=x(o[3]),d=O(s,z,f);switch(u.type){case"polygon":case"polyline":case"extent":return G.geodeticDensify.execute(u,d,{curveType:c});default:return u}})},H.generalize=function(e,t){return F(e,t,(a,l,o)=>{if(o=r(o),i(o,2,4,e,t),null===o[0])return null;if(!(o[0]instanceof A))throw new n(e,"InvalidParameter",t);const u=h(o[1]);if(isNaN(u))throw new n(e,"InvalidParameter",t);const f=T(S(o[3]),o[0].spatialReference,u);return G.generalize.execute(o[0],f,{removeDegenerateParts:p(g(o[2],!0))})})},H.buffer=function(e,a){return F(e,a,(l,o,u)=>{if(u=r(u),i(u,2,3,e,a),null===u[0])return null;if(!(u[0]instanceof A))throw new n(e,"InvalidParameter",a);const f=h(u[1]);if(isNaN(f))throw new n(e,"InvalidParameter",a);return 0===f?t(u[0]):G.buffer.execute(u[0],T(S(u[2]),u[0].spatialReference,f))})},H.buffergeodetic=function(e,a){return F(e,a,(l,o,u)=>{u=r(u),i(u,2,4,e,a);const f=u[0];if(null==f)return null;if(!m(f))throw new n(e,"InvalidParameter",a);const s=h(u[1]);if(isNaN(s))throw new n(e,"InvalidParameter",a);if(0===s)return t(f);const c=S(u[2]),d=x(u[3]);return G.geodesicBuffer.execute(f,O(c,z,s),{curveType:d})})},H.offset=function(e,t){return F(e,t,(a,l,o)=>{if(o=r(o),i(o,2,6,e,t),null===o[0])return null;if(!(o[0]instanceof C||o[0]instanceof U))throw new n(e,"InvalidParameter",t);const u=h(o[1]);if(isNaN(u))throw new n(e,"InvalidParameter",t);const f=T(S(o[2]),o[0].spatialReference,u),s=I(o[3]),c=h(g(o[4],10));if(isNaN(c))throw new n(e,"InvalidParameter",t);const m=h(g(o[5],0));if(isNaN(m))throw new n(e,"InvalidParameter",t);return G.offset.execute(o[0],f,{joins:s,miterLimit:c,flattenError:m})})},H.rotate=function(e,t){return F(e,t,(a,l,o)=>{if(o=r(o),i(o,2,3,e,t),null===o[0])return null;if(!(o[0]instanceof A))throw new n(e,"InvalidParameter",t);const u=o[0]instanceof M?C.fromExtent(o[0]):o[0],f=h(o[1]);if(isNaN(f))throw new n(e,"InvalidParameter",t);const s=g(o[2],null);if(null===s){const e="point"===u.type?u:u.extent?.center;return G.rotate(u,f,e?.x,e?.y)}if(s instanceof k)return G.rotate(u,f,s.x,s.y);throw new n(e,"InvalidParameter",t)})},H.centroid=function(e,t){return F(e,t,(e,t,a)=>{if(a=r(a),i(a,1,2,e,t),null===a[0])return null;const l=R(a[1]);let o=a[0];if((B(a[0])||f(a[0]))&&(o="geometric"===l?w(a[0],e.spatialReference):c(a[0],e.spatialReference),null===o))return null;if(!(o instanceof A))throw new n(e,"InvalidParameter",t);return"geometric"===l?G.centroid.execute(o):G.labelPoint.execute(o)})},H.measuretocoordinate=function(e,n){return F(e,n,j)},H.pointtocoordinate=function(e,n){return F(e,n,N)},H.distancetocoordinate=function(e,n){return F(e,n,E)},H.multiparttosinglepart=function(e,a){return F(e,a,(l,o,u)=>{if(u=r(u),i(u,1,1,e,a),null===u[0])return null;if(!(u[0]instanceof A))throw new n(e,"InvalidParameter",a);if(u[0]instanceof k)return[s(t(u[0]),e.spatialReference)];if(u[0]instanceof M)return[s(t(u[0]),e.spatialReference)];const f=G.simplify.execute(u[0]);if(f instanceof C){const e=[],n=[];for(let t=0;t<f.rings.length;t++)if(f.isClockwise(f.rings[t])){const n=q({rings:[f.rings[t]],hasZ:!0===f.hasZ,hasM:!0===f.hasM,spatialReference:f.spatialReference.toJSON()});e.push(n)}else n.push({ring:f.rings[t],pt:f.getPoint(t,0)});for(let t=0;t<n.length;t++)for(let r=0;r<e.length;r++)if(e[r].contains(n[t].pt)){e[r].addRing(n[t].ring);break}return e}if(f instanceof U){const e=[];for(let n=0;n<f.paths.length;n++){const t=q({paths:[f.paths[n]],hasZ:!0===f.hasZ,hasM:!0===f.hasM,spatialReference:f.spatialReference.toJSON()});e.push(t)}return e}if(u[0]instanceof Z){const n=[],r=s(t(u[0]),e.spatialReference);for(let e=0;e<r.points.length;e++)n.push(r.getPoint(e));return n}return null})},H.isselfintersecting=function(e,n){return F(e,n,(e,n,t)=>{i(t,1,1,e,n);let a=(t=r(t))[0];if((B(t[0])||f(t[0]))&&(a=d(t[0],e.spatialReference)),a instanceof Z){const e=a.points;for(let n=0;n<e.length;n++)for(let t=n+1;t<e.length;t++)if(L(e[n],e[t]))return!0;return!1}return(a instanceof U||a instanceof C)&&G.isSelfIntersecting(a)})},H.issimple=function(e,t){return F(e,t,(a,l,o)=>{if(o=r(o),i(o,1,1,e,t),null===o[0])return!0;if(!(o[0]instanceof A))throw new n(e,"InvalidParameter",t);return G.simplify.isSimple(o[0])})},H.simplify=function(e,t){return F(e,t,(a,l,o)=>{if(o=r(o),i(o,1,1,e,t),null===o[0])return null;if(!(o[0]instanceof A))throw new n(e,"InvalidParameter",t);return G.simplify.execute(o[0])})},H.convexhull=function(e,t){return F(e,t,(a,l,o)=>{if(o=r(o),i(o,1,1,e,t),null===o[0])return null;if(!(o[0]instanceof A))throw new n(e,"InvalidParameter",t);return G.convexHull.execute(o[0])})},H.nearestcoordinate=function(t,a){return F(t,a,(l,o,u)=>{if(u=r(u),i(u,2,2,t,a),!(u[0]instanceof A||null===u[0]))throw new n(t,"InvalidParameter",a);if(!(u[1]instanceof k||null===u[1]))throw new n(t,"InvalidParameter",a);if(null===u[0]||null===u[1])return null;const f=u[0]instanceof M?C.fromExtent(u[0]):u[0],s=G.proximity.getNearestCoordinate(f,u[1],{calculateLeftRightSide:!0});return null===s||s.isEmpty?null:e.convertObjectToArcadeDictionary({coordinate:s.coordinate,distance:s.distance,sideOfLine:0===s.distance?"straddle":s.isRightSide?"right":"left"},v(t),!1,!0)})},H.nearestvertex=function(t,a){return F(t,a,(l,o,u)=>{if(u=r(u),i(u,2,2,t,a),!(u[0]instanceof A||null===u[0]))throw new n(t,"InvalidParameter",a);if(!(u[1]instanceof k||null===u[1]))throw new n(t,"InvalidParameter",a);if(null===u[0]||null===u[1])return null;const f=u[0]instanceof M?C.fromExtent(u[0]):u[0],s=G.proximity.getNearestVertex(f,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"},v(t),!1,!0)})}}export{H as loadOperators,F as registerFunctions};
|
|
5
|
+
import e from"../Dictionary.js";import{ArcadeExecutionError as n}from"../executionError.js";import{cloneGeometry as t}from"../kernel.js";import{C as r,B as i,e as a,g as l,f as o,u,j as f,D as s,E as c,h as m,F as d,G as w,s as h,H as p,J as g,K as v}from"../../chunks/languageUtils.js";import{commonRelationsCheck as P,toCurveType as x,planarLength3D as y,toOffsetJoinType as I,toCentroidAlgorithm as R,measureToCoordinateFunc as j,pointToCoordinateFunc as N,distanceToCoordinateFunc as E}from"../geometry/functions.js";import{convertFromSpatialReferenceUnit as b,toAreaUnit as D,convert as O,toLengthUnit as S,convertToSpatialReferenceUnit as T}from"../geometry/unitConversion.js";import{equals as L}from"../../core/arrayUtils.js";import M from"../../geometry/Extent.js";import A from"../../geometry/Geometry.js";import Z from"../../geometry/Multipoint.js";import k from"../../geometry/Point.js";import C from"../../geometry/Polygon.js";import U from"../../geometry/Polyline.js";import{fromJSON as q}from"../../geometry/support/jsonUtils.js";import{squareMeters as J,meters as z}from"../geometry/extendedUnitData.js";import{isArray as B}from"../../support/guards.js";let G;async function H(){null==G&&(G=await import("../geometry/operators.js"),await G.loadAll())}function F(H,F){H.disjoint=function(e,n){return F(e,n,(t,i,a)=>(a=r(a),P(a,e,n),null===a[0]||null===a[1]||G.disjoint.execute(a[0],a[1])))},H.intersects=function(e,n){return F(e,n,(t,i,a)=>(a=r(a),P(a,e,n),null!==a[0]&&null!==a[1]&&G.intersects.execute(a[0],a[1])))},H.touches=function(e,n){return F(e,n,(t,i,a)=>(a=r(a),P(a,e,n),null!==a[0]&&null!==a[1]&&G.touches.execute(a[0],a[1])))},H.crosses=function(e,n){return F(e,n,(t,i,a)=>(a=r(a),P(a,e,n),null!==a[0]&&null!==a[1]&&G.crosses.execute(a[0],a[1])))},H.within=function(e,n){return F(e,n,(t,i,a)=>(a=r(a),P(a,e,n),null!==a[0]&&null!==a[1]&&G.within.execute(a[0],a[1])))},H.contains=function(e,n){return F(e,n,(t,i,a)=>(a=r(a),P(a,e,n),null!==a[0]&&null!==a[1]&&G.contains.execute(a[0],a[1])))},H.overlaps=function(e,n){return F(e,n,(t,i,a)=>(a=r(a),P(a,e,n),null!==a[0]&&null!==a[1]&&G.overlaps.execute(a[0],a[1])))},H.equals=function(e,n){return F(e,n,(t,r,u)=>(i(u,2,2,e,n),u[0]===u[1]||(u[0]instanceof A&&u[1]instanceof A?G.equals.execute(u[0],u[1]):(a(u[0])&&a(u[1])||l(u[0])&&l(u[1])||!(!o(u[0])||!o(u[1])))&&u[0].equals(u[1]))))},H.relate=function(e,t){return F(e,t,(a,l,o)=>{if(o=r(o),i(o,3,3,e,t),o[0]instanceof A&&o[1]instanceof A)return G.relate.execute(o[0],o[1],u(o[2]));if(o[0]instanceof A&&null===o[1])return!1;if(o[1]instanceof A&&null===o[0])return!1;if(null===o[0]&&null===o[1])return!1;throw new n(e,"InvalidParameter",t)})},H.intersection=function(e,n){return F(e,n,(t,i,a)=>(a=r(a),P(a,e,n),null===a[0]||null===a[1]?null:G.intersection.execute(a[0],a[1])))},H.union=function(e,i){return F(e,i,(a,l,o)=>{if(0===(o=r(o)).length)throw new n(e,"WrongNumberOfParameters",i);const u=[];if(1===o.length)if(B(o[0])){for(const t of r(o[0]))if(null!==t){if(!(t instanceof A))throw new n(e,"InvalidParameter",i);u.push(t)}}else{if(!f(o[0])){if(o[0]instanceof A)return s(t(o[0]),e.spatialReference);if(null===o[0])return null;throw new n(e,"InvalidParameter",i)}for(const t of r(o[0].toArray()))if(null!==t){if(!(t instanceof A))throw new n(e,"InvalidParameter",i);u.push(t)}}else for(const t of o)if(null!==t){if(!(t instanceof A))throw new n(e,"InvalidParameter",i);u.push(t)}return 0===u.length?null:G.union.executeMany(u)})},H.difference=function(e,n){return F(e,n,(i,a,l)=>(l=r(l),P(l,e,n),null===l[0]?null:null===l[1]?t(l[0]):G.difference.execute(l[0],l[1])))},H.symmetricdifference=function(e,n){return F(e,n,(i,a,l)=>(l=r(l),P(l,e,n),null===l[0]&&null===l[1]?null:null===l[0]?t(l[1]):null===l[1]?t(l[0]):G.symmetricDifference.execute(l[0],l[1])))},H.clip=function(e,t){return F(e,t,(a,l,o)=>{if(o=r(o),i(o,2,2,e,t),!(o[1]instanceof M)&&null!==o[1])throw new n(e,"InvalidParameter",t);if(null===o[0])return null;if(!(o[0]instanceof A))throw new n(e,"InvalidParameter",t);return null===o[1]?null:G.clip.execute(o[0],o[1])})},H.cut=function(e,a){return F(e,a,(l,o,u)=>{if(u=r(u),i(u,2,2,e,a),!(u[1]instanceof U)&&null!==u[1])throw new n(e,"InvalidParameter",a);if(null===u[0])return[];if(!(u[0]instanceof A))throw new n(e,"InvalidParameter",a);return null===u[1]?[t(u[0])]:G.cut.execute(u[0],u[1])})},H.area=function(e,t){return F(e,t,(a,l,o)=>{i(o,1,2,e,t);let u=(o=r(o))[0];if((B(o[0])||f(o[0]))&&(u=c(o[0],e.spatialReference)),null===u)return 0;if(!(u instanceof A))throw new n(e,"InvalidParameter",t);return b(u.spatialReference,D(o[1]),G.area.execute(u))})},H.areageodetic=function(e,t){return F(e,t,(a,l,o)=>{i(o,1,3,e,t);let u=(o=r(o))[0];(B(u)||f(u))&&(u=c(u,e.spatialReference));const s=D(o[1]),d=x(o[2]);if(null==u)return 0;if(!m(u))throw new n(e,"InvalidParameter",t);return O(J,s,G.geodeticArea.execute(u,{curveType:d}))})},H.length=function(e,t){return F(e,t,(a,l,o)=>{i(o,1,2,e,t);let u=(o=r(o))[0];if((B(o[0])||f(o[0]))&&(u=d(o[0],e.spatialReference)),null===u)return 0;if(!(u instanceof A))throw new n(e,"InvalidParameter",t);return b(u.spatialReference,S(o[1]),G.length.execute(u))})},H.length3d=function(e,t){return F(e,t,(a,l,o)=>{i(o,1,2,e,t);let u=(o=r(o))[0];if((B(o[0])||f(o[0]))&&(u=d(o[0],e.spatialReference)),null===u)return 0;if(!(u instanceof A))throw new n(e,"InvalidParameter",t);return!0===u.hasZ?b(u.spatialReference,S(o[1]),y(u)):b(u.spatialReference,S(o[1]),G.length.execute(u))})},H.lengthgeodetic=function(e,t){return F(e,t,(a,l,o)=>{i(o,1,3,e,t);let u=(o=r(o))[0];(B(o[0])||f(o[0]))&&(u=d(o[0],e.spatialReference));const s=x(o[2]);if(null==u)return 0;if(null!=u&&!m(u))throw new n(e,"InvalidParameter",t);const c=S(o[1]);return O(z,c,G.geodeticLength.execute(u,{curveType:s}))})},H.distance=function(e,t){return F(e,t,(a,l,o)=>{o=r(o),i(o,2,3,e,t);let u=o[0];if((B(o[0])||f(o[0]))&&(u=w(o[0],e.spatialReference)),!(u instanceof A))throw new n(e,"InvalidParameter",t);let s=o[1];if((B(o[1])||f(o[1]))&&(s=w(o[1],e.spatialReference)),!(s instanceof A))throw new n(e,"InvalidParameter",t);return b(u.spatialReference,S(o[2]),G.distance.execute(u,s))})},H.distancegeodetic=function(e,t){return F(e,t,(a,l,o)=>{o=r(o),i(o,2,4,e,t);const u=o[0];if(!(u instanceof k))throw new n(e,"InvalidParameter",t);const f=o[1];if(!(f instanceof k))throw new n(e,"InvalidParameter",t);const s=S(o[2]),c=x(o[3]),m=new U({paths:[],spatialReference:u.spatialReference});return m.addPath([u,f]),O(z,s,G.geodeticLength.execute(m,{curveType:c}))})},H.densify=function(e,t){return F(e,t,(a,l,o)=>{if(o=r(o),i(o,2,3,e,t),null===o[0])return null;if(!(o[0]instanceof A))throw new n(e,"InvalidParameter",t);const u=h(o[1]);if(isNaN(u))throw new n(e,"InvalidParameter",t);if(u<=0)throw new n(e,"InvalidParameter",t);const f=T(S(o[2]),o[0].spatialReference,u);switch(o[0].type){case"polygon":case"polyline":case"extent":return G.densify.execute(o[0],f);default:return o[0]}})},H.densifygeodetic=function(e,t){return F(e,t,(a,l,o)=>{o=r(o),i(o,2,4,e,t);const u=o[0];if(null==u)return null;if(!m(u))throw new n(e,"InvalidParameter",t);const f=h(o[1]);if(isNaN(f))throw new n(e,"InvalidParameter",t);if(f<=0)throw new n(e,"InvalidParameter",t);const s=S(o[2]),c=x(o[3]),d=O(s,z,f);switch(u.type){case"polygon":case"polyline":case"extent":return G.geodeticDensify.execute(u,d,{curveType:c});default:return u}})},H.generalize=function(e,t){return F(e,t,(a,l,o)=>{if(o=r(o),i(o,2,4,e,t),null===o[0])return null;if(!(o[0]instanceof A))throw new n(e,"InvalidParameter",t);const u=h(o[1]);if(isNaN(u))throw new n(e,"InvalidParameter",t);const f=T(S(o[3]),o[0].spatialReference,u);return G.generalize.execute(o[0],f,{removeDegenerateParts:p(g(o[2],!0))})})},H.buffer=function(e,a){return F(e,a,(l,o,u)=>{if(u=r(u),i(u,2,3,e,a),null===u[0])return null;if(!(u[0]instanceof A))throw new n(e,"InvalidParameter",a);const f=h(u[1]);if(isNaN(f))throw new n(e,"InvalidParameter",a);return 0===f?t(u[0]):G.buffer.execute(u[0],T(S(u[2]),u[0].spatialReference,f))})},H.buffergeodetic=function(e,a){return F(e,a,(l,o,u)=>{u=r(u),i(u,2,4,e,a);const f=u[0];if(null==f)return null;if(!m(f))throw new n(e,"InvalidParameter",a);const s=h(u[1]);if(isNaN(s))throw new n(e,"InvalidParameter",a);if(0===s)return t(f);const c=S(u[2]),d=x(u[3]);return G.geodesicBuffer.execute(f,O(c,z,s),{curveType:d})})},H.offset=function(e,t){return F(e,t,(a,l,o)=>{if(o=r(o),i(o,2,6,e,t),null===o[0])return null;if(!(o[0]instanceof C||o[0]instanceof U))throw new n(e,"InvalidParameter",t);const u=h(o[1]);if(isNaN(u))throw new n(e,"InvalidParameter",t);const f=T(S(o[2]),o[0].spatialReference,u),s=I(o[3]),c=h(g(o[4],10));if(isNaN(c))throw new n(e,"InvalidParameter",t);const m=h(g(o[5],0));if(isNaN(m))throw new n(e,"InvalidParameter",t);return G.offset.execute(o[0],f,{joins:s,miterLimit:c,flattenError:m})})},H.rotate=function(e,t){return F(e,t,(a,l,o)=>{if(o=r(o),i(o,2,3,e,t),null===o[0])return null;if(!(o[0]instanceof A))throw new n(e,"InvalidParameter",t);const u=o[0]instanceof M?C.fromExtent(o[0]):o[0],f=h(o[1]);if(isNaN(f))throw new n(e,"InvalidParameter",t);const s=g(o[2],null);if(null===s){const e="point"===u.type?u:u.extent?.center;return G.rotate(u,f,e?.x,e?.y)}if(s instanceof k)return G.rotate(u,f,s.x,s.y);throw new n(e,"InvalidParameter",t)})},H.centroid=function(e,t){return F(e,t,(e,t,a)=>{if(a=r(a),i(a,1,2,e,t),null===a[0])return null;const l=R(a[1]);let o=a[0];if((B(a[0])||f(a[0]))&&(o="geometric"===l?w(a[0],e.spatialReference):c(a[0],e.spatialReference),null===o))return null;if(!(o instanceof A))throw new n(e,"InvalidParameter",t);return"geometric"===l?G.centroid.execute(o):G.labelPoint.execute(o)})},H.measuretocoordinate=function(e,n){return F(e,n,j)},H.pointtocoordinate=function(e,n){return F(e,n,N)},H.distancetocoordinate=function(e,n){return F(e,n,E)},H.multiparttosinglepart=function(e,a){return F(e,a,(l,o,u)=>{if(u=r(u),i(u,1,1,e,a),null===u[0])return null;if(!(u[0]instanceof A))throw new n(e,"InvalidParameter",a);if(u[0]instanceof k)return[s(t(u[0]),e.spatialReference)];if(u[0]instanceof M)return[s(t(u[0]),e.spatialReference)];const f=G.simplify.execute(u[0]);if(f instanceof C){const e=[],n=[];for(let t=0;t<f.rings.length;t++)if(f.isClockwise(f.rings[t])){const n=q({rings:[f.rings[t]],hasZ:!0===f.hasZ,hasM:!0===f.hasM,spatialReference:f.spatialReference.toJSON()});e.push(n)}else n.push({ring:f.rings[t],pt:f.getPoint(t,0)});for(let t=0;t<n.length;t++)for(let r=0;r<e.length;r++)if(e[r].contains(n[t].pt)){e[r].addRing(n[t].ring);break}return e}if(f instanceof U){const e=[];for(let n=0;n<f.paths.length;n++){const t=q({paths:[f.paths[n]],hasZ:!0===f.hasZ,hasM:!0===f.hasM,spatialReference:f.spatialReference.toJSON()});e.push(t)}return e}if(u[0]instanceof Z){const n=[],r=s(t(u[0]),e.spatialReference);for(let e=0;e<r.points.length;e++)n.push(r.getPoint(e));return n}return null})},H.isselfintersecting=function(e,n){return F(e,n,(e,n,t)=>{i(t,1,1,e,n);let a=(t=r(t))[0];if((B(t[0])||f(t[0]))&&(a=d(t[0],e.spatialReference)),a instanceof Z){const e=a.points;for(let n=0;n<e.length;n++)for(let t=n+1;t<e.length;t++)if(L(e[n],e[t]))return!0;return!1}return(a instanceof U||a instanceof C)&&G.isSelfIntersecting(a)})},H.issimple=function(e,t){return F(e,t,(a,l,o)=>{if(o=r(o),i(o,1,1,e,t),null===o[0])return!0;if(!(o[0]instanceof A))throw new n(e,"InvalidParameter",t);return G.simplify.isSimple(o[0])})},H.simplify=function(e,t){return F(e,t,(a,l,o)=>{if(o=r(o),i(o,1,1,e,t),null===o[0])return null;if(!(o[0]instanceof A))throw new n(e,"InvalidParameter",t);return G.simplify.execute(o[0])})},H.convexhull=function(e,t){return F(e,t,(a,l,o)=>{if(o=r(o),i(o,1,1,e,t),null===o[0])return null;if(!(o[0]instanceof A))throw new n(e,"InvalidParameter",t);return G.convexHull.execute(o[0])})},H.nearestcoordinate=function(t,a){return F(t,a,(l,o,u)=>{if(u=r(u),i(u,2,2,t,a),!(u[0]instanceof A||null===u[0]))throw new n(t,"InvalidParameter",a);if(!(u[1]instanceof k||null===u[1]))throw new n(t,"InvalidParameter",a);if(null===u[0]||null===u[1])return null;const f=u[0]instanceof M?C.fromExtent(u[0]):u[0],s=G.proximity.getNearestCoordinate(f,u[1],{calculateLeftRightSide:!0});return null===s||s.isEmpty?null:e.convertObjectToArcadeDictionary({coordinate:s.coordinate,distance:s.distance,sideOfLine:0===s.distance?"straddle":s.isRightSide?"right":"left"},v(t),!1,!0)})},H.nearestvertex=function(t,a){return F(t,a,(l,o,u)=>{if(u=r(u),i(u,2,2,t,a),!(u[0]instanceof A||null===u[0]))throw new n(t,"InvalidParameter",a);if(!(u[1]instanceof k||null===u[1]))throw new n(t,"InvalidParameter",a);if(null===u[0]||null===u[1])return null;const f=u[0]instanceof M?C.fromExtent(u[0]):u[0],s=G.proximity.getNearestVertex(f,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"},v(t),!1,!0)})}}export{H as loadOperators,F 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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../config.js";import r from"../ArcadePortal.js";import t from"../Dictionary.js";import{ArcadeExecutionError as n}from"../executionError.js";import{B as o,
|
|
5
|
+
import e from"../../config.js";import r from"../ArcadePortal.js";import t from"../Dictionary.js";import{ArcadeExecutionError as n}from"../executionError.js";import{B as o,u as a,o as i,J as s,K as p,e as l,f as c,g as f,n as u,h as m}from"../../chunks/languageUtils.js";import{getPortal as d}from"../portalUtils.js";import h from"../../geometry/Geometry.js";import{load as g,project as w,isLoaded as y}from"../../geometry/projectionUtils.js";import j from"../../geometry/SpatialReference.js";import{webMercatorToGeographic as S,geographicToWebMercator as v}from"../../geometry/support/webMercatorUtils.js";import R from"../../portal/Portal.js";import G from"../../portal/PortalItem.js";import{project as x}from"../../rest/geometryService/project.js";import k from"../../rest/knowledgeGraph/Entity.js";import P from"../../rest/knowledgeGraph/GraphQueryStreaming.js";import b from"../../rest/knowledgeGraph/ObjectValue.js";import I from"../../rest/knowledgeGraph/Path.js";import W from"../../rest/knowledgeGraph/Relationship.js";import D from"../../rest/support/ProjectParameters.js";import{isString as T,isArray as U,isNumber as q,isDate as A}from"../../support/guards.js";let J=null;async function N(r){const t=e.geometryServiceUrl??"";if(!t){y()||await g();for(const e of r)e.container[e.indexer]=w(e.container[e.indexer],j.WGS84);return}const n=r.map(e=>e.container[e.indexer]),o=new D({geometries:n,outSpatialReference:j.WGS84}),a=await x(t,o);for(let e=0;e<a.length;e++){const t=r[e];t.container[t.indexer]=a[e]}}async function F(e,r){const t=new G({portal:e,id:r});return await t.load(),null===J&&(J=await import("../../rest/knowledgeGraphService.js")),await J.fetchKnowledgeGraph(t.url)}function M(e,r,t,n,o){if(null===e)return null;if(T(e)||q(e))return e;if(l(e))return e.toJSDate();if(l(e))return e.toJSDate();if(c(e))return e.toStorageFormat();if(f(e))return e.toStorageString();if(u(e)){const a={};for(const i of e.keys())a[i]=M(e.field(i),r,t,n,o),a[i]instanceof h&&o.push({container:a,indexer:i});return a}if(U(e)){const a=e.map(e=>M(e,r,t,n,o));for(let e=0;e<a.length;e++)a[e]instanceof h&&o.push({container:a,indexer:e});return a}return m(e)?e.spatialReference.isWGS84?e:e.spatialReference.isWebMercator&&r?S(e):e:void 0}function Q(e,r){if(!e)return e;if(e.spatialReference.isWGS84&&r.spatialReference.isWebMercator)return v(e);if(e.spatialReference.equals(r.spatialReference))return e;throw new n(r,"WrongSpatialReference",null)}function B(e,r){if(!e)return null;const t={};for(const n in e)t[n]=E(e[n],r);return t}function E(e,r){return null===e?null:U(e)?e.map(e=>E(e,r)):e instanceof k?{graphTypeName:e.typeName,id:e.id,graphType:"entity",properties:B(e.properties,r)}:e instanceof b?{graphType:"object",properties:B(e.properties,r)}:e instanceof W?{graphTypeName:e.typeName,id:e.id,graphType:"relationship",originId:e.originId??null,destinationId:e.destinationId??null,properties:B(e.properties,r)}:e instanceof I?{graphType:"path",path:e.path?e.path.map(e=>E(e,r)):null}:m(e)?Q(e,r):T(e)||q(e)||A(e)?e:null}function K(e){"async"===e.mode&&(e.functions.knowledgegraphbyportalitem=function(t,i){return e.standardFunctionAsync(t,i,(e,s,p)=>{if(o(p,2,2,t,i),null===p[0])throw new n(t,"PortalRequired",i);if(p[0]instanceof r){const e=a(p[1]);let r;r=t.services?.portal?t.services.portal:R.getDefault();return F(d(p[0],r),e)}if(!1===T(p[0]))throw new n(t,"InvalidParameter",i);const l=a(p[0]);return F(t.services?.portal??R.getDefault(),l)})},e.signatures.push({name:"knowledgegraphbyportalitem",min:2,max:2}),e.functions.querygraph=function(r,a){return e.standardFunctionAsync(r,a,async(e,l,c)=>{o(c,2,4,r,a);const f=c[0];if(!i(f))throw new n(r,"InvalidParameter",a);const u=c[1];if(!T(u))throw new n(r,"InvalidParameter",a);null===J&&(J=await import("../../rest/knowledgeGraphService.js"));let m=null;const d=s(c[2],null);if(!(d instanceof t||null===d))throw new n(r,"InvalidParameter",a);if(d){let e=[];m=M(d,!0,!1,r,e),e=e.filter(e=>!e.container[e.indexer].spatialReference.isWGS84),e.length>0&&await N(e)}const h=s(c[3],!1),g=new P({openCypherQuery:u,bindParameters:m,provenanceBehavior:h?"include":"exclude"});(f?.serviceDefinition?.currentVersion??11.3)>11.2&&(g.outputSpatialReference=r.spatialReference);const w=(await J.executeQueryStreaming(f,g)).resultRowsStream.getReader(),y=[];try{for(;;){const{done:e,value:t}=await w.read();if(e)break;if(U(t))for(const n of t)y.push(E(n,r));else{const e=[];for(const n of t)e.push(E(t[n],r));y.push(e)}}}catch(j){throw j}return t.convertJsonToArcade(y,p(r),!1,!0)})},e.signatures.push({name:"querygraph",min:2,max:4}))}export{K 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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{B as n,e as r,g as t,f as u,Y as e,
|
|
5
|
+
import{B as n,e as r,g as t,f as u,Y as e,s as o,v as i,H as a,j as s}from"../../chunks/languageUtils.js";import{decimalAdjust as f}from"../../core/mathUtils.js";import{parse as c}from"../../core/number.js";import{isNumber as l,isBoolean as N,isArray as h,isString as m}from"../../support/guards.js";function p(p,M){function b(n,r,t){const u=o(n);return isNaN(u)?u:isNaN(r)||isNaN(t)||r>t?NaN:u<r?r:u>t?t:u}p.number=function(o,i){return M(o,i,(a,s,f)=>{n(f,1,2,o,i);const p=f[0];if(l(p))return p;if(null===p)return 0;if(r(p)||t(p)||u(p))return p.toNumber();if(N(p))return Number(p);if(h(p))return NaN;if(""===p)return Number(p);if(void 0===p)return Number(p);if(m(p)){if(void 0!==f[1]){let n=e(f[1],"‰","");return n=e(n,"¤",""),c(p,{pattern:n})}return Number(p.trim())}return Number(p)})},p.abs=function(r,t){return M(r,t,(u,e,i)=>(n(i,1,1,r,t),Math.abs(o(i[0]))))},p.acos=function(r,t){return M(r,t,(u,e,i)=>(n(i,1,1,r,t),Math.acos(o(i[0]))))},p.asin=function(r,t){return M(r,t,(u,e,i)=>(n(i,1,1,r,t),Math.asin(o(i[0]))))},p.atan=function(r,t){return M(r,t,(u,e,i)=>(n(i,1,1,r,t),Math.atan(o(i[0]))))},p.atan2=function(r,t){return M(r,t,(u,e,i)=>(n(i,2,2,r,t),Math.atan2(o(i[0]),o(i[1]))))},p.ceil=function(r,t){return M(r,t,(u,e,i)=>{if(n(i,1,2,r,t),2===i.length){let n=o(i[1]);return isNaN(n)&&(n=0),f("ceil",o(i[0]),-1*n)}return Math.ceil(o(i[0]))})},p.round=function(r,t){return M(r,t,(u,e,i)=>{if(n(i,1,2,r,t),2===i.length){let n=o(i[1]);return isNaN(n)&&(n=0),f("round",o(i[0]),-1*n)}return Math.round(o(i[0]))})},p.floor=function(r,t){return M(r,t,(u,e,i)=>{if(n(i,1,2,r,t),2===i.length){let n=o(i[1]);return isNaN(n)&&(n=0),f("floor",o(i[0]),-1*n)}return Math.floor(o(i[0]))})},p.cos=function(r,t){return M(r,t,(u,e,i)=>(n(i,1,1,r,t),Math.cos(o(i[0]))))},p.isnan=function(r,t){return M(r,t,(u,e,o)=>(n(o,1,1,r,t),"number"==typeof o[0]&&isNaN(o[0])))},p.exp=function(r,t){return M(r,t,(u,e,i)=>(n(i,1,1,r,t),Math.exp(o(i[0]))))},p.log=function(r,t){return M(r,t,(u,e,i)=>(n(i,1,1,r,t),Math.log(o(i[0]))))},p.pow=function(r,t){return M(r,t,(u,e,i)=>(n(i,2,2,r,t),o(i[0])**o(i[1])))},p.random=function(r,t){return M(r,t,(u,e,o)=>(n(o,0,0,r,t),Math.random()))},p.sin=function(r,t){return M(r,t,(u,e,i)=>(n(i,1,1,r,t),Math.sin(o(i[0]))))},p.sqrt=function(r,t){return M(r,t,(u,e,i)=>(n(i,1,1,r,t),Math.sqrt(o(i[0]))))},p.tan=function(r,t){return M(r,t,(u,e,i)=>(n(i,1,1,r,t),Math.tan(o(i[0]))))},p.isempty=function(r,t){return M(r,t,(u,e,o)=>(n(o,1,1,r,t),null===o[0]||(""===o[0]||(void 0===o[0]||o[0]===i))))},p.boolean=function(r,t){return M(r,t,(u,e,o)=>{n(o,1,1,r,t);const i=o[0];return a(i)})},p.constrain=function(r,t){return M(r,t,(u,e,i)=>{n(i,3,3,r,t);const a=o(i[1]),f=o(i[2]);if(h(i[0])){const n=[];for(const r of i[0])n.push(b(r,a,f));return n}if(s(i[0])){const n=[];for(let r=0;r<i[0].length();r++)n.push(b(i[0].get(r),a,f));return n}return b(i[0],a,f)})}}export{p 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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../ArcadePortal.js";import e from"../Attachment.js";import r from"../Dictionary.js";import{StringEnum as n}from"../enum.js";import{ArcadeExecutionError as a}from"../executionError.js";import{B as o,w as i,M as u,u as s,v as l,J as p,H as f,t as c,j as d,Y as h,K as y,Z as g,e as m,f as A,g as w,k as I,i as v,m as U,l as j}from"../../chunks/languageUtils.js";import{convertDirection as x}from"./convertdirection.js";import{XXH as N}from"./hash.js";import{hasSamePortal as k}from"../../core/urlUtils.js";import{generateUUID as C}from"../../core/uuid.js";import P from"../../geometry/Extent.js";import z from"../../geometry/Multipoint.js";import O from"../../geometry/Point.js";import S from"../../geometry/Polygon.js";import F from"../../geometry/Polyline.js";import T from"../../geometry/SpatialReference.js";import L from"../../portal/Portal.js";import{isArray as R,isString as M,isBoolean as H,isNumber as b}from"../../support/guards.js";function D(t){if("loaded"===t.loadStatus&&t.user?.sourceJSON){return t.user.sourceJSON}return null}function J(t,e){return!!t&&k(t,e?.restUrl||"")}function W(t,e){if(!t||!e)return t===e;if(t.x===e.x&&t.y===e.y){if(t.hasZ){if(t.z!==e.z)return!1}else if(e.hasZ)return!1;if(t.hasM){if(t.m!==e.m)return!1}else if(e.hasM)return!1;return!0}return!1}function B(n,o,i){if(null!==n)if(R(n)){if(o.updateUint8Array([61]),i.map.has(n)){const t=i.map.get(n);o.updateIntArray([61237541^t])}else{i.map.set(n,i.currentLength++);for(const t of n)B(t,o,i);i.map.delete(n),i.currentLength--}o.updateUint8Array([199])}else if(d(n)){if(o.updateUint8Array([61]),i.map.has(n)){const t=i.map.get(n);o.updateIntArray([61237541^t])}else{i.map.set(n,i.currentLength++);for(const t of n.toArray())B(t,o,i);i.map.delete(n),i.currentLength--}o.updateUint8Array([199])}else{if(m(n))return o.updateIntArray([n.toNumber()]),void o.updateUint8Array([241]);if(A(n))return o.updateIntArray([n.toNumber()]),void o.updateIntArray([257]);if(w(n))return o.updateIntArray([n.toNumber()]),void o.updateIntArray([263]);if(M(n))return o.updateIntArray([n.length]),o.updateWithString(n),void o.updateUint8Array([41]);if(H(n))o.updateUint8Array([!0===n?1:0,113]);else{if(b(n))return o.updateFloatArray([n]),void o.updateUint8Array([173]);if(n instanceof e)throw new a(i.context,"UnsupportedHashType",i.node);if(n instanceof t)throw new a(i.context,"UnsupportedHashType",i.node);if(!(n instanceof r)){if(I(n))throw new a(i.context,"UnsupportedHashType",i.node);if(n instanceof O)return o.updateIntArray([3833836621]),o.updateIntArray([0]),o.updateFloatArray([n.x]),o.updateIntArray([1]),o.updateFloatArray([n.y]),n.hasZ&&(o.updateIntArray([2]),o.updateFloatArray([n.z])),n.hasM&&(o.updateIntArray([3]),o.updateFloatArray([n.m])),o.updateIntArray([3765347959]),void B(n.spatialReference.wkid,o,i);if(n instanceof S){o.updateIntArray([1266616829]);for(let t=0;t<n.rings.length;t++){const e=n.rings[t],r=[];let a=null,u=null;for(let o=0;o<e.length;o++){const i=n.getPoint(t,o);if(0===o)a=i;else if(W(u,i))continue;u=i,o===e.length-1&&W(a,i)||r.push(i)}o.updateIntArray([1397116793,r.length]);for(let t=0;t<r.length;t++){const e=r[t];o.updateIntArray([3962308117,t]),B(e,o,i),o.updateIntArray([2716288009])}o.updateIntArray([2278822459])}return o.updateIntArray([3878477243]),void B(n.spatialReference.wkid,o,i)}if(n instanceof F){o.updateIntArray([4106883559]);for(let t=0;t<n.paths.length;t++){const e=n.paths[t];o.updateIntArray([1397116793,e.length]);for(let r=0;r<e.length;r++)o.updateIntArray([3962308117,r]),B(n.getPoint(t,r),o,i),o.updateIntArray([2716288009]);o.updateIntArray([2278822459])}return o.updateIntArray([2568784753]),void B(n.spatialReference.wkid,o,i)}if(n instanceof z){o.updateIntArray([588535921,n.points.length]);for(let t=0;t<n.points.length;t++){const e=n.getPoint(t);o.updateIntArray([t]),B(e,o,i)}return o.updateIntArray([1700171621]),void B(n.spatialReference.wkid,o,i)}if(n instanceof P)return o.updateIntArray([3483648373]),o.updateIntArray([0]),o.updateFloatArray([n.xmax]),o.updateIntArray([1]),o.updateFloatArray([n.xmin]),o.updateIntArray([2]),o.updateFloatArray([n.ymax]),o.updateIntArray([3]),o.updateFloatArray([n.ymin]),n.hasZ&&(o.updateIntArray([4]),o.updateFloatArray([n.zmax]),o.updateIntArray([5]),o.updateFloatArray([n.zmin])),n.hasM&&(o.updateIntArray([6]),o.updateFloatArray([n.mmax]),o.updateIntArray([7]),o.updateFloatArray([n.mmin])),o.updateIntArray([3622027469]),void B(n.spatialReference.wkid,o,i);if(n instanceof T)return o.updateIntArray([14]),void 0!==n.wkid&&null!==n.wkid&&o.updateIntArray([n.wkid]),n.wkt&&o.updateWithString(n.wkt),void(n.wkt2&&o.updateWithString(n.wkt2));if(v(n))throw new a(i.context,"UnsupportedHashType",i.node);if(U(n))throw new a(i.context,"UnsupportedHashType",i.node);if(j(n))throw new a(i.context,"UnsupportedHashType",i.node);if(n===l)throw new a(i.context,"UnsupportedHashType",i.node);throw new a(i.context,"UnsupportedHashType",i.node)}if(o.updateUint8Array([223]),i.map.has(n)){const t=i.map.get(n);o.updateIntArray([61237541^t])}else{i.map.set(n,i.currentLength++);for(const t of n.keys()){o.updateIntArray([t.length]),o.updateWithString(t),o.updateUint8Array([251]);B(n.field(t),o,i),o.updateUint8Array([239])}i.map.delete(n),i.currentLength--}o.updateUint8Array([73])}}else o.updateUint8Array([0,139])}function Z(e,m){e.portal=function(e,r){return m(e,r,(n,a,u)=>(o(u,1,1,e,r),new t(i(u[0]))))},e.typeof=function(t,e){return m(t,e,(r,n,i)=>{o(i,1,1,t,e);const s=u(i[0]);if("Unrecognized Type"===s)throw new a(t,"UnrecognizedType",e);return s})},e.trim=function(t,e){return m(t,e,(r,n,a)=>(o(a,1,1,t,e),i(a[0]).trim()))},e.tohex=function(t,e){return m(t,e,(r,n,a)=>{o(a,1,1,t,e);const i=s(a[0]);return isNaN(i)?i:i.toString(16)})},e.upper=function(t,e){return m(t,e,(r,n,a)=>(o(a,1,1,t,e),i(a[0]).toUpperCase()))};const A=new n(["every-word","first-word"]);e.proper=function(t,e){return m(t,e,(r,n,a)=>{o(a,1,2,t,e);const u=(a.length>=2?A.lookup(i(a[1])):null)??"every-word",s=/\s/,l=i(a[0]);let p="",f=!0;for(let t=0;t<l.length;t++){let e=l[t];if(s.test(e))"every-word"===u&&(f=!0);else{e.toUpperCase()!==e.toLowerCase()&&(f?(e=e.toUpperCase(),f=!1):e=e.toLowerCase())}p+=e}return p})},e.lower=function(t,e){return m(t,e,(r,n,a)=>(o(a,1,1,t,e),i(a[0]).toLowerCase()))};const w=new n(["digits","digits-hyphen","digits-hyphen-braces","digits-hyphen-parentheses"]);e.guid=function(t,e){return m(t,e,(r,n,a)=>{o(a,0,1,t,e);switch(a.length>0?w.lookup(i(a[0])):null){case"digits":return C().replace("-","").replace("-","").replace("-","").replace("-","");case"digits-hyphen":return C();case"digits-hyphen-parentheses":return"("+C()+")";default:return"{"+C()+"}"}})},e.standardizeguid=function(t,e){return m(t,e,(r,n,a)=>{o(a,2,2,t,e);let u=i(a[0]);if(""===u||null===u)return"";const s=/^(\{|\()?(?<partA>[0-9a-z]{8})(-?)(?<partB>[0-9a-z]{4})(-?)(?<partC>[0-9a-z]{4})(-?)(?<partD>[0-9a-z]{4})(-?)(?<partE>[0-9a-z]{12})(\}|\))?$/gim.exec(u);if(!s)return"";const l=s.groups;switch(u=l.partA+"-"+l.partB+"-"+l.partC+"-"+l.partD+"-"+l.partE,w.lookup(i(a[1]))){case"digits":return u.replace("-","").replace("-","").replace("-","").replace("-","");case"digits-hyphen":return u;case"digits-hyphen-parentheses":return"("+u+")";default:return"{"+u+"}"}})},e.console=function(t,e){return m(t,e,(e,r,n)=>(0===n.length||(1===n.length?t.console(i(n[0])):t.console(i(n))),l))},e.mid=function(t,e){return m(t,e,(r,n,a)=>{o(a,2,3,t,e);let u=s(a[1]);if(isNaN(u))return"";if(u=Math.max(0,u),2===a.length)return i(a[0]).slice(u);let l=s(a[2]);return isNaN(l)?"":(l<0&&(l=0),i(a[0]).slice(u,u+l))})},e.find=function(t,e){return m(t,e,(r,n,a)=>{o(a,2,3,t,e);let u=0;if(a.length>2){if(u=s(p(a[2],0)),isNaN(u))return-1;u<0&&(u=0)}return i(a[1]).indexOf(i(a[0]),u)})},e.left=function(t,e){return m(t,e,(r,n,a)=>{o(a,2,2,t,e);let u=s(a[1]);return isNaN(u)?"":(u<0&&(u=0),i(a[0]).slice(0,u))})},e.right=function(t,e){return m(t,e,(r,n,a)=>{o(a,2,2,t,e);const u=s(a[1]);if(isNaN(u)||u<=0)return"";return i(a[0]).slice(-u)})},e.split=function(t,e){return m(t,e,(r,n,a)=>{let u;o(a,2,4,t,e);let l=s(p(a[2],-1));const c=f(p(a[3],!1));if(-1===l||null===l||!0===c?u=i(a[0]).split(i(a[1])):(isNaN(l)&&(l=-1),l<-1&&(l=-1),u=i(a[0]).split(i(a[1]),l)),!1===c)return u;const d=[];for(let t=0;t<u.length&&!(-1!==l&&d.length>=l);t++)""!==u[t]&&void 0!==u[t]&&d.push(u[t]);return d})},e.text=function(t,e){return m(t,e,(r,n,a)=>(o(a,1,2,t,e),c(a[0],a[1])))},e.concatenate=function(t,e){return m(t,e,(t,e,r)=>{const n=[];if(r.length<1)return"";if(R(r[0])){const t=p(r[2],"");for(let e=0;e<r[0].length;e++)n[e]=c(r[0][e],t);return r.length>1?n.join(r[1]):n.join("")}if(d(r[0])){const t=p(r[2],"");for(let e=0;e<r[0].length();e++)n[e]=c(r[0].get(e),t);return r.length>1?n.join(r[1]):n.join("")}for(let a=0;a<r.length;a++)n[a]=c(r[a]);return n.join("")})},e.reverse=function(t,e){return m(t,e,(r,n,i)=>{if(o(i,1,1,t,e),R(i[0])){const t=i[0].slice();return t.reverse(),t}if(d(i[0])){const t=i[0].toArray().slice();return t.reverse(),t}throw new a(t,"InvalidParameter",e)})},e.replace=function(t,e){return m(t,e,(r,n,a)=>{o(a,3,4,t,e);const u=i(a[0]),s=i(a[1]),l=i(a[2]);return 4!==a.length||f(a[3])?h(u,s,l):u.replace(s,l)})},e.urlencode=function(t,e){return m(t,e,(n,a,u)=>{if(o(u,1,1,t,e),null===u[0])return"";if(u[0]instanceof r){let t="";for(const e of u[0].keys()){const r=u[0].field(e);""!==t&&(t+="&"),t+=null===r?encodeURIComponent(e)+"=":encodeURIComponent(e)+"="+encodeURIComponent(r)}return t}return encodeURIComponent(i(u[0]))})},e.hash=function(t,e){return m(t,e,(r,n,a)=>{o(a,1,1,t,e);const i=new N(0);return B(a[0],i,{context:t,node:e,map:new Map,currentLength:0}),i.digest()})},e.convertdirection=function(t,e){return m(t,e,(r,n,a)=>(o(a,3,3,t,e),x(a[0],a[1],a[2])))},e.fromjson=function(t,e){return m(t,e,(n,u,s)=>{if(o(s,1,1,t,e),!1===M(s[0]))throw new a(t,"InvalidParameter",e);return r.convertJsonToArcade(JSON.parse(i(s[0])),y(t))})},e.tocharcode=function(t,e){return m(t,e,(r,n,u)=>{o(u,1,2,t,e);const l=s(p(u[1],0)),f=i(u[0]);if(0===f.length&&1===u.length)return null;if(f.length<=l||l<0)throw new a(t,"OutOfBounds",e);return f.charCodeAt(l)})},e.tocodepoint=function(t,e){return m(t,e,(r,n,u)=>{o(u,1,2,t,e);const l=s(p(u[1],0)),f=i(u[0]);if(0===f.length&&1===u.length)return null;if(f.length<=l||l<0)throw new a(t,"OutOfBounds",e);return f.codePointAt(l)})},e.fromcharcode=function(t,e){return m(t,e,(r,n,o)=>{if(o.length<1)throw new a(t,"WrongNumberOfParameters",e);const i=o.map(t=>Math.trunc(s(t))).filter(t=>t>=0&&t<=65535);return 0===i.length?null:String.fromCharCode.apply(null,i)})},e.fromcodepoint=function(t,e){return m(t,e,(r,n,o)=>{if(o.length<1)throw new a(t,"WrongNumberOfParameters",e);let i;try{i=o.map(t=>Math.trunc(s(t))).filter(t=>t<=1114111&&t>>>0===t)}catch(u){return null}return 0===i.length?null:String.fromCodePoint.apply(null,i)})},e.getuser=function(e,n){return m(e,n,(u,s,l)=>{o(l,0,2,e,n);let f=p(l[1],"");if(f=!0===f||!1===f?"":i(f),null!==f&&""!==f)return null;if(0===l.length||l[0]instanceof t){let t=null;if(t=e.services?.portal?e.services.portal:L.getDefault(),l.length>0){if(!J(l[0].field("url"),t))return null}if(!t)return null;if(""===f){const n=D(t);if(n){const t=JSON.parse(JSON.stringify(n));for(const e of["lastLogin","created","modified"])void 0!==t[e]&&null!==t[e]&&(t[e]=new Date(t[e]));return r.convertObjectToArcadeDictionary(t,y(e))}}return null}throw new a(e,"InvalidParameter",n)})},e.getenvironment=function(t,e){return m(t,e,(n,a,i)=>(o(i,0,0,t,e),r.convertObjectToArcadeDictionary(g(y(t),t.spatialReference),y(t),!0)))},e.standardizefilename=function(t,e){return m(t,e,(t,e,r)=>{o(r,1,1,t,e);const[n]=r;if(null==n)return"";if(!M(n))throw new a(t,"InvalidParameter",e);return n.replaceAll(/[<>"?*]/g,"_").replaceAll(/[/\\|]/g,"-").replaceAll(":",", ")})}}export{Z as registerFunctions};
|
|
5
|
+
import t from"../ArcadePortal.js";import e from"../Attachment.js";import r from"../Dictionary.js";import{StringEnum as n}from"../enum.js";import{ArcadeExecutionError as a}from"../executionError.js";import{B as o,u as i,M as u,s,v as l,J as p,H as f,t as c,j as d,Y as h,K as y,Z as g,e as m,f as A,g as w,k as I,i as v,m as U,l as j}from"../../chunks/languageUtils.js";import{convertDirection as x}from"./convertdirection.js";import{XXH as N}from"./hash.js";import{hasSamePortal as k}from"../../core/urlUtils.js";import{generateUUID as C}from"../../core/uuid.js";import P from"../../geometry/Extent.js";import z from"../../geometry/Multipoint.js";import O from"../../geometry/Point.js";import S from"../../geometry/Polygon.js";import F from"../../geometry/Polyline.js";import T from"../../geometry/SpatialReference.js";import L from"../../portal/Portal.js";import{isArray as R,isString as M,isBoolean as H,isNumber as b}from"../../support/guards.js";function D(t){if("loaded"===t.loadStatus&&t.user?.sourceJSON){return t.user.sourceJSON}return null}function J(t,e){return!!t&&k(t,e?.restUrl||"")}function W(t,e){if(!t||!e)return t===e;if(t.x===e.x&&t.y===e.y){if(t.hasZ){if(t.z!==e.z)return!1}else if(e.hasZ)return!1;if(t.hasM){if(t.m!==e.m)return!1}else if(e.hasM)return!1;return!0}return!1}function B(n,o,i){if(null!==n)if(R(n)){if(o.updateUint8Array([61]),i.map.has(n)){const t=i.map.get(n);o.updateIntArray([61237541^t])}else{i.map.set(n,i.currentLength++);for(const t of n)B(t,o,i);i.map.delete(n),i.currentLength--}o.updateUint8Array([199])}else if(d(n)){if(o.updateUint8Array([61]),i.map.has(n)){const t=i.map.get(n);o.updateIntArray([61237541^t])}else{i.map.set(n,i.currentLength++);for(const t of n.toArray())B(t,o,i);i.map.delete(n),i.currentLength--}o.updateUint8Array([199])}else{if(m(n))return o.updateIntArray([n.toNumber()]),void o.updateUint8Array([241]);if(A(n))return o.updateIntArray([n.toNumber()]),void o.updateIntArray([257]);if(w(n))return o.updateIntArray([n.toNumber()]),void o.updateIntArray([263]);if(M(n))return o.updateIntArray([n.length]),o.updateWithString(n),void o.updateUint8Array([41]);if(H(n))o.updateUint8Array([!0===n?1:0,113]);else{if(b(n))return o.updateFloatArray([n]),void o.updateUint8Array([173]);if(n instanceof e)throw new a(i.context,"UnsupportedHashType",i.node);if(n instanceof t)throw new a(i.context,"UnsupportedHashType",i.node);if(!(n instanceof r)){if(I(n))throw new a(i.context,"UnsupportedHashType",i.node);if(n instanceof O)return o.updateIntArray([3833836621]),o.updateIntArray([0]),o.updateFloatArray([n.x]),o.updateIntArray([1]),o.updateFloatArray([n.y]),n.hasZ&&(o.updateIntArray([2]),o.updateFloatArray([n.z])),n.hasM&&(o.updateIntArray([3]),o.updateFloatArray([n.m])),o.updateIntArray([3765347959]),void B(n.spatialReference.wkid,o,i);if(n instanceof S){o.updateIntArray([1266616829]);for(let t=0;t<n.rings.length;t++){const e=n.rings[t],r=[];let a=null,u=null;for(let o=0;o<e.length;o++){const i=n.getPoint(t,o);if(0===o)a=i;else if(W(u,i))continue;u=i,o===e.length-1&&W(a,i)||r.push(i)}o.updateIntArray([1397116793,r.length]);for(let t=0;t<r.length;t++){const e=r[t];o.updateIntArray([3962308117,t]),B(e,o,i),o.updateIntArray([2716288009])}o.updateIntArray([2278822459])}return o.updateIntArray([3878477243]),void B(n.spatialReference.wkid,o,i)}if(n instanceof F){o.updateIntArray([4106883559]);for(let t=0;t<n.paths.length;t++){const e=n.paths[t];o.updateIntArray([1397116793,e.length]);for(let r=0;r<e.length;r++)o.updateIntArray([3962308117,r]),B(n.getPoint(t,r),o,i),o.updateIntArray([2716288009]);o.updateIntArray([2278822459])}return o.updateIntArray([2568784753]),void B(n.spatialReference.wkid,o,i)}if(n instanceof z){o.updateIntArray([588535921,n.points.length]);for(let t=0;t<n.points.length;t++){const e=n.getPoint(t);o.updateIntArray([t]),B(e,o,i)}return o.updateIntArray([1700171621]),void B(n.spatialReference.wkid,o,i)}if(n instanceof P)return o.updateIntArray([3483648373]),o.updateIntArray([0]),o.updateFloatArray([n.xmax]),o.updateIntArray([1]),o.updateFloatArray([n.xmin]),o.updateIntArray([2]),o.updateFloatArray([n.ymax]),o.updateIntArray([3]),o.updateFloatArray([n.ymin]),n.hasZ&&(o.updateIntArray([4]),o.updateFloatArray([n.zmax]),o.updateIntArray([5]),o.updateFloatArray([n.zmin])),n.hasM&&(o.updateIntArray([6]),o.updateFloatArray([n.mmax]),o.updateIntArray([7]),o.updateFloatArray([n.mmin])),o.updateIntArray([3622027469]),void B(n.spatialReference.wkid,o,i);if(n instanceof T)return o.updateIntArray([14]),void 0!==n.wkid&&null!==n.wkid&&o.updateIntArray([n.wkid]),n.wkt&&o.updateWithString(n.wkt),void(n.wkt2&&o.updateWithString(n.wkt2));if(v(n))throw new a(i.context,"UnsupportedHashType",i.node);if(U(n))throw new a(i.context,"UnsupportedHashType",i.node);if(j(n))throw new a(i.context,"UnsupportedHashType",i.node);if(n===l)throw new a(i.context,"UnsupportedHashType",i.node);throw new a(i.context,"UnsupportedHashType",i.node)}if(o.updateUint8Array([223]),i.map.has(n)){const t=i.map.get(n);o.updateIntArray([61237541^t])}else{i.map.set(n,i.currentLength++);for(const t of n.keys()){o.updateIntArray([t.length]),o.updateWithString(t),o.updateUint8Array([251]);B(n.field(t),o,i),o.updateUint8Array([239])}i.map.delete(n),i.currentLength--}o.updateUint8Array([73])}}else o.updateUint8Array([0,139])}function Z(e,m){e.portal=function(e,r){return m(e,r,(n,a,u)=>(o(u,1,1,e,r),new t(i(u[0]))))},e.typeof=function(t,e){return m(t,e,(r,n,i)=>{o(i,1,1,t,e);const s=u(i[0]);if("Unrecognized Type"===s)throw new a(t,"UnrecognizedType",e);return s})},e.trim=function(t,e){return m(t,e,(r,n,a)=>(o(a,1,1,t,e),i(a[0]).trim()))},e.tohex=function(t,e){return m(t,e,(r,n,a)=>{o(a,1,1,t,e);const i=s(a[0]);return isNaN(i)?i:i.toString(16)})},e.upper=function(t,e){return m(t,e,(r,n,a)=>(o(a,1,1,t,e),i(a[0]).toUpperCase()))};const A=new n(["every-word","first-word"]);e.proper=function(t,e){return m(t,e,(r,n,a)=>{o(a,1,2,t,e);const u=(a.length>=2?A.lookup(i(a[1])):null)??"every-word",s=/\s/,l=i(a[0]);let p="",f=!0;for(let t=0;t<l.length;t++){let e=l[t];if(s.test(e))"every-word"===u&&(f=!0);else{e.toUpperCase()!==e.toLowerCase()&&(f?(e=e.toUpperCase(),f=!1):e=e.toLowerCase())}p+=e}return p})},e.lower=function(t,e){return m(t,e,(r,n,a)=>(o(a,1,1,t,e),i(a[0]).toLowerCase()))};const w=new n(["digits","digits-hyphen","digits-hyphen-braces","digits-hyphen-parentheses"]);e.guid=function(t,e){return m(t,e,(r,n,a)=>{o(a,0,1,t,e);switch(a.length>0?w.lookup(i(a[0])):null){case"digits":return C().replace("-","").replace("-","").replace("-","").replace("-","");case"digits-hyphen":return C();case"digits-hyphen-parentheses":return"("+C()+")";default:return"{"+C()+"}"}})},e.standardizeguid=function(t,e){return m(t,e,(r,n,a)=>{o(a,2,2,t,e);let u=i(a[0]);if(""===u||null===u)return"";const s=/^(\{|\()?(?<partA>[0-9a-z]{8})(-?)(?<partB>[0-9a-z]{4})(-?)(?<partC>[0-9a-z]{4})(-?)(?<partD>[0-9a-z]{4})(-?)(?<partE>[0-9a-z]{12})(\}|\))?$/gim.exec(u);if(!s)return"";const l=s.groups;switch(u=l.partA+"-"+l.partB+"-"+l.partC+"-"+l.partD+"-"+l.partE,w.lookup(i(a[1]))){case"digits":return u.replace("-","").replace("-","").replace("-","").replace("-","");case"digits-hyphen":return u;case"digits-hyphen-parentheses":return"("+u+")";default:return"{"+u+"}"}})},e.console=function(t,e){return m(t,e,(e,r,n)=>(0===n.length||(1===n.length?t.console(i(n[0])):t.console(i(n))),l))},e.mid=function(t,e){return m(t,e,(r,n,a)=>{o(a,2,3,t,e);let u=s(a[1]);if(isNaN(u))return"";if(u=Math.max(0,u),2===a.length)return i(a[0]).slice(u);let l=s(a[2]);return isNaN(l)?"":(l<0&&(l=0),i(a[0]).slice(u,u+l))})},e.find=function(t,e){return m(t,e,(r,n,a)=>{o(a,2,3,t,e);let u=0;if(a.length>2){if(u=s(p(a[2],0)),isNaN(u))return-1;u<0&&(u=0)}return i(a[1]).indexOf(i(a[0]),u)})},e.left=function(t,e){return m(t,e,(r,n,a)=>{o(a,2,2,t,e);let u=s(a[1]);return isNaN(u)?"":(u<0&&(u=0),i(a[0]).slice(0,u))})},e.right=function(t,e){return m(t,e,(r,n,a)=>{o(a,2,2,t,e);const u=s(a[1]);if(isNaN(u)||u<=0)return"";return i(a[0]).slice(-u)})},e.split=function(t,e){return m(t,e,(r,n,a)=>{let u;o(a,2,4,t,e);let l=s(p(a[2],-1));const c=f(p(a[3],!1));if(-1===l||null===l||!0===c?u=i(a[0]).split(i(a[1])):(isNaN(l)&&(l=-1),l<-1&&(l=-1),u=i(a[0]).split(i(a[1]),l)),!1===c)return u;const d=[];for(let t=0;t<u.length&&!(-1!==l&&d.length>=l);t++)""!==u[t]&&void 0!==u[t]&&d.push(u[t]);return d})},e.text=function(t,e){return m(t,e,(r,n,a)=>(o(a,1,2,t,e),c(a[0],a[1])))},e.concatenate=function(t,e){return m(t,e,(t,e,r)=>{const n=[];if(r.length<1)return"";if(R(r[0])){const t=p(r[2],"");for(let e=0;e<r[0].length;e++)n[e]=c(r[0][e],t);return r.length>1?n.join(r[1]):n.join("")}if(d(r[0])){const t=p(r[2],"");for(let e=0;e<r[0].length();e++)n[e]=c(r[0].get(e),t);return r.length>1?n.join(r[1]):n.join("")}for(let a=0;a<r.length;a++)n[a]=c(r[a]);return n.join("")})},e.reverse=function(t,e){return m(t,e,(r,n,i)=>{if(o(i,1,1,t,e),R(i[0])){const t=i[0].slice();return t.reverse(),t}if(d(i[0])){const t=i[0].toArray().slice();return t.reverse(),t}throw new a(t,"InvalidParameter",e)})},e.replace=function(t,e){return m(t,e,(r,n,a)=>{o(a,3,4,t,e);const u=i(a[0]),s=i(a[1]),l=i(a[2]);return 4!==a.length||f(a[3])?h(u,s,l):u.replace(s,l)})},e.urlencode=function(t,e){return m(t,e,(n,a,u)=>{if(o(u,1,1,t,e),null===u[0])return"";if(u[0]instanceof r){let t="";for(const e of u[0].keys()){const r=u[0].field(e);""!==t&&(t+="&"),t+=null===r?encodeURIComponent(e)+"=":encodeURIComponent(e)+"="+encodeURIComponent(r)}return t}return encodeURIComponent(i(u[0]))})},e.hash=function(t,e){return m(t,e,(r,n,a)=>{o(a,1,1,t,e);const i=new N(0);return B(a[0],i,{context:t,node:e,map:new Map,currentLength:0}),i.digest()})},e.convertdirection=function(t,e){return m(t,e,(r,n,a)=>(o(a,3,3,t,e),x(a[0],a[1],a[2])))},e.fromjson=function(t,e){return m(t,e,(n,u,s)=>{if(o(s,1,1,t,e),!1===M(s[0]))throw new a(t,"InvalidParameter",e);return r.convertJsonToArcade(JSON.parse(i(s[0])),y(t))})},e.tocharcode=function(t,e){return m(t,e,(r,n,u)=>{o(u,1,2,t,e);const l=s(p(u[1],0)),f=i(u[0]);if(0===f.length&&1===u.length)return null;if(f.length<=l||l<0)throw new a(t,"OutOfBounds",e);return f.charCodeAt(l)})},e.tocodepoint=function(t,e){return m(t,e,(r,n,u)=>{o(u,1,2,t,e);const l=s(p(u[1],0)),f=i(u[0]);if(0===f.length&&1===u.length)return null;if(f.length<=l||l<0)throw new a(t,"OutOfBounds",e);return f.codePointAt(l)})},e.fromcharcode=function(t,e){return m(t,e,(r,n,o)=>{if(o.length<1)throw new a(t,"WrongNumberOfParameters",e);const i=o.map(t=>Math.trunc(s(t))).filter(t=>t>=0&&t<=65535);return 0===i.length?null:String.fromCharCode.apply(null,i)})},e.fromcodepoint=function(t,e){return m(t,e,(r,n,o)=>{if(o.length<1)throw new a(t,"WrongNumberOfParameters",e);let i;try{i=o.map(t=>Math.trunc(s(t))).filter(t=>t<=1114111&&t>>>0===t)}catch(u){return null}return 0===i.length?null:String.fromCodePoint.apply(null,i)})},e.getuser=function(e,n){return m(e,n,(u,s,l)=>{o(l,0,2,e,n);let f=p(l[1],"");if(f=!0===f||!1===f?"":i(f),null!==f&&""!==f)return null;if(0===l.length||l[0]instanceof t){let t=null;if(t=e.services?.portal?e.services.portal:L.getDefault(),l.length>0){if(!J(l[0].field("url"),t))return null}if(!t)return null;if(""===f){const n=D(t);if(n){const t=JSON.parse(JSON.stringify(n));for(const e of["lastLogin","created","modified"])void 0!==t[e]&&null!==t[e]&&(t[e]=new Date(t[e]));return r.convertObjectToArcadeDictionary(t,y(e))}}return null}throw new a(e,"InvalidParameter",n)})},e.getenvironment=function(t,e){return m(t,e,(n,a,i)=>(o(i,0,0,t,e),r.convertObjectToArcadeDictionary(g(y(t),t.spatialReference),y(t),!0)))},e.standardizefilename=function(t,e){return m(t,e,(t,e,r)=>{o(r,1,1,t,e);const[n]=r;if(null==n)return"";if(!M(n))throw new a(t,"InvalidParameter",e);return n.replaceAll(/[<>"?*]/g,"_").replaceAll(/[/\\|]/g,"-").replaceAll(":",", ")})}}export{Z 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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ArcadeDate as t}from"../ArcadeDate.js";import{toSymbolId as n}from"../arcadeEnvironment.js";import{ArcadeExecutionError as r}from"../executionError.js";import{B as e,
|
|
5
|
+
import{ArcadeDate as t}from"../ArcadeDate.js";import{toSymbolId as n}from"../arcadeEnvironment.js";import{ArcadeExecutionError as r}from"../executionError.js";import{B as e,s as o,u as a}from"../../chunks/languageUtils.js";let c;async function s(){null==c&&(c=await import("../../geometry/operators/geodeticDistanceOperator.js"),await c.load())}function i(t){const n=t.track;if(null==n)throw new r(t,"InvalidParameter",null);return n}function u(t,n,r,e){const o=Math.max(0,f(t,n)),a=Math.max(0,f(t,r));return t.observations.slice(o,a).map((t,n)=>e(t,n+o))}function f(t,n){return t.currentObservationIndex+n}function l(t,n){const e=f(t,n);if(e<0||e>=t.observations.length)throw new r(null,"InvalidParameter",null);return e}function d(t,n){const{stats:r}=t.observations[n];if(null!=r.totalDistance)return r.totalDistance;if(0===n)return r.totalDistance=0;let e,o=0;for(e=n-1;e>0;e--){const n=t.observations[e].stats;if(null!=n.totalDistance){o=n.totalDistance;break}}for(let a=e+1;a<=n;a++){const n=t.observations[a];o+=m(t,a),n.stats.totalDistance=o}return o}function m(t,n){const r=t.observations[n],e=r.stats;if(null!=e.distance)return e.distance;if(0===n)return e.distance=0;const o=t.observations[n-1];return e.distance=c.execute(o.feature.geometry(),r.feature.geometry())}function T(t,n){const r=t.observations[n],e=r.stats;if(null!=e.speed)return e.speed;if(0===n)return e.speed=0;const o=t.observations[n-1],a=r.endTime-o.startTime;if(a<=0)return e.speed=0;const c=m(t,n);return e.speed=c/(a/1e3)}function v(t,n){const r=t.observations[n],e=r.stats;if(null!=e.acceleration)return e.acceleration;if(0===n)return e.acceleration=0;const o=t.observations[n-1],a=r.endTime-o.startTime;if(a<=0)return e.acceleration=0;const c=T(t,n),s=T(t,n-1);return e.acceleration=(c-s)/(a/1e3)}function b(r,c){r[n("TrackIndex")]=function(t,n){return c(t,n,(t,n,r)=>(e(r,0,0,t,n),i(t).currentObservationIndex))},r[n("TrackWindow")]=function(t,n){return c(t,n,(t,n,r)=>{e(r,2,2,t,n);const a=o(r[0]),c=o(r[1]);return u(i(t),a,c,t=>t.feature)})},r[n("TrackFieldWindow")]=function(t,n){return c(t,n,(t,n,r)=>{e(r,3,3,t,n);const c=a(r[0]),s=o(r[1]),f=o(r[2]);return u(i(t),s,f,t=>t.feature.field(c))})},r[n("TrackGeometryWindow")]=function(t,n){return c(t,n,(t,n,r)=>{e(r,2,2,t,n);const a=o(r[0]),c=o(r[1]);return u(i(t),a,c,t=>t.feature.geometry())})},r[n("TrackStartTime")]=function(n,r){return c(n,r,(n,r,o)=>(e(o,0,0,n,r),t.epochToArcadeDate(i(n).observations[0].startTime,n.timeZone??"system")))},r[n("TrackCurrentTime")]=function(n,r){return c(n,r,(n,r,o)=>{e(o,0,0,n,r);const a=i(n);return t.epochToArcadeDate(a.observations[a.currentObservationIndex].startTime,n.timeZone??"system")})},r[n("TrackDuration")]=function(t,n){return c(t,n,(t,n,r)=>{e(r,0,0,t,n);const o=i(t);return o.observations[o.currentObservationIndex].startTime-o.observations[0].startTime})},r[n("TrackCurrentDistance")]=function(t,n){return c(t,n,(t,n,r)=>{e(r,0,0,t,n);const o=i(t);return d(o,o.currentObservationIndex)})},r[n("TrackDistanceAt")]=function(t,n){return c(t,n,(t,n,r)=>{e(r,1,1,t,n);const a=o(r[0]),c=i(t);return d(c,l(c,a))})},r[n("TrackDistanceWindow")]=function(t,n){return c(t,n,(t,n,r)=>{e(r,2,2,t,n);const a=o(r[0]),c=o(r[1]),s=i(t);return u(s,a,c,(t,n)=>d(s,n))})},r[n("TrackCurrentSpeed")]=function(t,n){return c(t,n,(t,n,r)=>{e(r,0,0,t,n);const o=i(t);return T(o,o.currentObservationIndex)})},r[n("TrackSpeedAt")]=function(t,n){return c(t,n,(t,n,r)=>{e(r,1,1,t,n);const a=o(r[0]),c=i(t);return T(c,l(c,a))})},r[n("TrackSpeedWindow")]=function(t,n){return c(t,n,(t,n,r)=>{e(r,2,2,t,n);const a=o(r[0]),c=o(r[1]),s=i(t);return u(s,a,c,(t,n)=>T(s,n))})},r[n("TrackCurrentAcceleration")]=function(t,n){return c(t,n,(t,n,r)=>{e(r,0,0,t,n);const o=i(t);return v(o,o.currentObservationIndex)})},r[n("TrackAccelerationAt")]=function(t,n){return c(t,n,(t,n,r)=>{e(r,1,1,t,n);const a=o(r[0]),c=i(t);return v(c,l(c,a))})},r[n("TrackAccelerationWindow")]=function(t,n){return c(t,n,(t,n,r)=>{e(r,2,2,t,n);const a=o(r[0]),c=o(r[1]),s=i(t);return u(s,a,c,(t,n)=>v(s,n))})}}export{c as geodeticDistance,s as loadOperators,b 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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../Dictionary.js";import{StringEnum as n}from"../enum.js";import{ArcadeExecutionError as t}from"../executionError.js";import{B as r,
|
|
5
|
+
import e from"../Dictionary.js";import{StringEnum as n}from"../enum.js";import{ArcadeExecutionError as t}from"../executionError.js";import{B as r,u as o,J as i,C as l,j as a,F as s,K as f}from"../../chunks/languageUtils.js";import{getMetersPerVerticalUnitForSR as u,segmentLength3d as c}from"../functions/centroid.js";import{measureToCoordinate as m,pointToCoordinate as p,distanceToCoordinate as d}from"../functions/measures.js";import{getMetersPerUnitForSR as g}from"../../core/unitUtils.js";import w from"../../geometry/Geometry.js";import y from"../../geometry/Point.js";import h from"../../geometry/Polyline.js";import{isArray as v,isNumber as j}from"../../support/guards.js";function P(e,n,o){if(r(e,2,2,n,o),e[0]instanceof w&&e[1]instanceof w);else if(e[0]instanceof w&&null===e[1]);else if(e[1]instanceof w&&null===e[0]);else if(null!==e[0]||null!==e[1])throw new t(n,"InvalidParameter",o)}function x(e){if("polygon"!==e.type&&"polyline"!==e.type&&"extent"!==e.type)return 0;let n=1;if(e.spatialReference.vcsWkid||e.spatialReference.latestVcsWkid){n=u(e.spatialReference)/g(e.spatialReference)}let t=0;if("polyline"===e.type)for(const r of e.paths)for(let e=1;e<r.length;e++)t+=c(r[e],r[e-1],n);else if("polygon"===e.type)for(const r of e.rings){for(let e=1;e<r.length;e++)t+=c(r[e],r[e-1],n);(r[0][0]!==r[r.length-1][0]||r[0][1]!==r[r.length-1][1]||void 0!==r[0][2]&&r[0][2]!==r[r.length-1][2])&&(t+=c(r[0],r[r.length-1],n))}else"extent"===e.type&&(t+=2*c([e.xmin,e.ymin,0],[e.xmax,e.ymin,0],n),t+=2*c([e.xmin,e.ymin,0],[e.xmin,e.ymax,0],n),t*=2,t+=4*Math.abs(i(e.zmax,0)*n-i(e.zmin,0)*n));return t}const I=(n,o,i)=>{if(i=l(i),r(i,2,2,n,o),null===i[0])return null;let u=i[0];if((v(i[0])||a(i[0]))&&(u=s(i[0],n.spatialReference)),null===u)return null;if(!(u instanceof w))throw new t(n,"InvalidParameter",o);if(!(u instanceof h))throw new t(n,"InvalidParameter",o);if(!j(i[1]))throw new t(n,"InvalidParameter",o);const c=m(u,i[1]);return c?e.convertObjectToArcadeDictionary(c,f(n),!1,!0):null},R=(n,o,i)=>{if(i=l(i),r(i,2,2,n,o),null===i[0])return null;let u=i[0];if((v(i[0])||a(i[0]))&&(u=s(i[0],n.spatialReference)),null===u)return null;if(!(u instanceof w))throw new t(n,"InvalidParameter",o);if(!(u instanceof h))throw new t(n,"InvalidParameter",o);const c=i[1];if(null===c)return null;if(!(c instanceof y))throw new t(n,"InvalidParameter",o);const m=p(u,c);return m?e.convertObjectToArcadeDictionary(m,f(n),!1,!0):null},b=(n,o,i)=>{if(i=l(i),r(i,2,2,n,o),null===i[0])return null;let u=i[0];if((v(i[0])||a(i[0]))&&(u=s(i[0],n.spatialReference)),null===u)return null;if(!(u instanceof w))throw new t(n,"InvalidParameter",o);if(!(u instanceof h))throw new t(n,"InvalidParameter",o);if(!j(i[1]))throw new t(n,"InvalidParameter",o);const c=d(u,i[1]);return c?e.convertObjectToArcadeDictionary(c,f(n),!1,!0):null},k=new n(["geodesic","great-elliptic","loxodrome","normal-section","shape-preserving"]);function D(e){return null==e?"geodesic":k.get(o(e))}const A=new n(["geometric","labelPoint"]);function O(e){return null==e?"geometric":A.get(o(e))}const T=new n(["round","bevel","miter","square"]);function z(e){return null==e?"round":T.lookup(o(e))??"round"}export{P as commonRelationsCheck,b as distanceToCoordinateFunc,I as measureToCoordinateFunc,x as planarLength3D,R as pointToCoordinateFunc,O as toCentroidAlgorithm,D as toCurveType,z as toOffsetJoinType};
|
package/arcade/languageUtils.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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../config.js";import"../kernel.js";import"./ArcadeDate.js";import"./ArcadeModule.js";import"./executionError.js";import"./FunctionWrapper.js";import"./ImmutableArray.js";import"./ImmutablePathArray.js";import"./ImmutablePointArray.js";import"./featureset/support/shared.js";import"../core/number.js";import"../core/sql/DateOnly.js";import"../core/sql/TimeOnly.js";import"../geometry/Extent.js";import"../geometry/Geometry.js";import"../geometry/Multipoint.js";import"../geometry/Point.js";import"../geometry/Polygon.js";import"../geometry/Polyline.js";import"../geometry/SpatialReference.js";import"../geometry/support/coordsUtils.js";import"../geometry/support/jsonUtils.js";import"../intl/locale.js";export{isArray,isBoolean,isGraphic,isInteger,isDate as isJsDate,isNumber,isString}from"../support/guards.js";import"luxon";export{I as ImplicitResult,R as ReturnResult,P as absRound,ab as arcadeVersion,G as autoCastArrayOfPointsToMultiPoint,E as autoCastArrayOfPointsToPolygon,F as autoCastArrayOfPointsToPolyline,C as autoCastFeatureToGeometry,
|
|
5
|
+
import"../config.js";import"../kernel.js";import"./ArcadeDate.js";import"./ArcadeModule.js";import"./executionError.js";import"./FunctionWrapper.js";import"./ImmutableArray.js";import"./ImmutablePathArray.js";import"./ImmutablePointArray.js";import"./featureset/support/shared.js";import"../core/number.js";import"../core/sql/DateOnly.js";import"../core/sql/TimeOnly.js";import"../geometry/Extent.js";import"../geometry/Geometry.js";import"../geometry/Multipoint.js";import"../geometry/Point.js";import"../geometry/Polygon.js";import"../geometry/Polyline.js";import"../geometry/SpatialReference.js";import"../geometry/support/coordsUtils.js";import"../geometry/support/jsonUtils.js";import"../intl/locale.js";export{isArray,isBoolean,isGraphic,isInteger,isDate as isJsDate,isNumber,isString}from"../support/guards.js";import"luxon";export{I as ImplicitResult,R as ReturnResult,P as absRound,ab as arcadeVersion,G as autoCastArrayOfPointsToMultiPoint,E as autoCastArrayOfPointsToPolygon,F as autoCastArrayOfPointsToPolyline,C as autoCastFeatureToGeometry,y as binaryOperator,z as breakResult,a as castAsJson,b as castAsJsonAsync,c as castRecordToText,A as continueResult,Z as defaultExecutingContext,K as defaultTimeZone,J as defaultUndefined,x as equalityTest,S as featureDomainCodeLookup,T as featureDomainValueLookup,Q as featureFullDomain,U as featureSchema,V as featureSubtypes,W as fixNullGeometry,D as fixSpatialReference,a7 as formatDate,a6 as formatNumber,a1 as getDomain,a3 as getDomainCode,a2 as getDomainValue,M as getType,w as greaterThanLessThan,e as isDate,f as isDateOnly,n as isDictionary,r as isDictionaryLike,k as isFeature,m as isFeatureSet,l as isFeatureSetCollection,i as isFunctionParameter,h as isGeometry,j as isImmutableArray,o as isKnowledgeGraph,a4 as isModule,a5 as isObject,d as isSimpleType,aa as isSubtypeGrouplayer,$ as isSubtypeSublayer,g as isTime,q as isVoid,X as isVoxel,Y as multiReplace,a8 as parseGeometryFromJson,B as pcCheck,a9 as stableStringify,O as standardiseDateFormat,a0 as tick,H as toBoolean,N as toDate,s as toNumber,_ as toNumberArray,u as toString,L as toStringArray,t as toStringExplicit,v as voidOperation}from"../chunks/languageUtils.js";
|
package/arcade.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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"./Graphic.js";import{ArcadeDate as t}from"./arcade/ArcadeDate.js";import r from"./arcade/ImmutableArray.js";import"./core/has.js";import{deprecated as
|
|
5
|
+
import e from"./Graphic.js";import{ArcadeDate as t}from"./arcade/ArcadeDate.js";import{toSymbolId as r}from"./arcade/arcadeEnvironment.js";import a from"./arcade/ImmutableArray.js";import"./core/has.js";import{deprecated as n}from"./core/deprecate.js";import o from"./core/Error.js";import{clone as c}from"./core/lang.js";import i from"./core/Logger.js";import{DateOnly as s}from"./core/sql/DateOnly.js";import{TimeOnly as p}from"./core/sql/TimeOnly.js";import u from"./layers/FeatureLayer.js";import l from"./portal/Portal.js";import m from"./rest/support/FeatureSet.js";import{loadArcade as y}from"./support/loadArcade.js";let f=null;function d(e,t,r,n={}){const o=t.elementType,c="value",i="array"===o.type?[{name:c,type:o.type,elementType:o.elementType}]:"dictionary"===o.type?[{name:c,type:o.type,properties:o.properties}]:[{name:c,type:o.type}];return new a(e.map(e=>{const t={};return S(t,i,{[c]:e},r,n),t[c]}))}function b(e,t,r={}){const a=e instanceof m?new u({source:e.features,geometryType:e.geometryType,fields:e.fields,spatialReference:e.spatialReference}):e;return t.constructFeatureSet(a,r.spatialReference,null,!0,r.lruCache,r.interceptor)}function v(e,t,r={}){const{spatialReference:a,interceptor:n,lruCache:o}=r;return"string"==typeof e?t.createFeatureSetCollectionFromService(e,a,o,n):t.createFeatureSetCollectionFromMap(e,a,o,n)}function g(e,t,r,a={}){const n=Object.create(null);return S(n,t.properties,e,r,a),new f.Dictionary(n)}function S(e,r,a,n,o={}){const c={};for(const t of Object.keys(a))c[t.toLowerCase()]=a[t];for(const i of r){const r=i.name.toLowerCase();if(o.variablesPreProcessed)e[r]=c[r];else switch(i.type){case"array":{const t=c[r];e[r]=null==t?null:d(t,i,n,o);break}case"feature":{const t=c[r];e[r]=null==t?null:f.Feature.createFromGraphic(t,o?.timeZone);break}case"featureSet":{const t=c[r];e[r]=null==t?null:n?b(t,n,o):null;break}case"featureSetCollection":{const t=c[r];e[r]=null==t?null:n?v(t,n,o):null;break}case"dictionary":{const t=c[r];e[r]=null==t?null:g(t,i,n,o);break}case"date":{const a=c[r];e[r]=a?a instanceof t?a:o?.timeZone?t.dateJSAndZoneToArcadeDate(a,o?.timeZone):t.dateJSToArcadeDate(a):null;break}case"dateOnly":{const t=c[r];e[r]=t?t instanceof s?t:s.fromReader(t):null;break}case"time":{const t=c[r];e[r]=t?t instanceof p?t:p.fromReader(t):null;break}case"knowledgeGraph":case"geometry":case"boolean":case"text":case"number":e[r]=c[r];break;case"voxel":{const t=c[r];e[r]=null==t?null:new f.Voxel(t,o?.timeZone);break}}}}function w(e,t){for(const r of e)t.push(r),"dictionary"===r.type&&w(r.properties,t);return t}function h(e,t,r,a,n){const{spatialReference:o,interceptor:c,lruCache:i,console:s,abortSignal:p,timeZone:u,services:m={portal:l.getDefault()},track:y}=r,f={vars:{},spatialReference:o,interceptor:c,timeZone:u,lrucache:i,useAsync:n,services:m,console:s,abortSignal:p,track:y};return t?(S(f.vars,e.variables,t,a,r),f):f}function $(t,r){switch(r.getArcadeType(t)){case"number":case"text":case"boolean":case"point":case"polygon":case"polyline":case"multipoint":case"extent":return t;case"date":return t.toJSDate();case"time":case"dateOnly":return t.toString();case"feature":{const r=(t.type,t),a="geometry"in r?r.geometry():null,n="readAttributes"in r?r.readAttributes():r.attributes;return new e({geometry:a,attributes:n})}case"dictionary":{const e=t,a=e.attributes,n={};for(const t of Object.keys(a))n[t]=$(e.field(t),r);return n}case"array":return("toArray"in t?t.toArray():t).map(e=>$(e,r))}return t}const x={variables:[{name:"$feature",type:"feature"},{name:"$layer",type:"featureSet"},{name:"$datastore",type:"featureSetCollection"},{name:"$map",type:"featureSetCollection"},{name:"$userInput",type:"geometry"},{name:"$graph",type:"knowledgeGraph"},{name:"$view",type:"dictionary",properties:[{name:"scale",type:"number"},{name:"timeProperties",type:"dictionary",properties:[{name:"currentStart",type:"date"},{name:"currentEnd",type:"date"},{name:"startIncluded",type:"boolean"},{name:"endIncluded",type:"boolean"}]}]}]},j={variables:[{name:"$feature",type:"feature"},{name:"$aggregatedFeatures",type:"featureSet"},{name:"$view",type:"dictionary",properties:[{name:"scale",type:"number"},{name:"timeProperties",type:"dictionary",properties:[{name:"currentStart",type:"date"},{name:"currentEnd",type:"date"},{name:"startIncluded",type:"boolean"},{name:"endIncluded",type:"boolean"}]}]}]},C={variables:[{name:"$voxel",type:"voxel"}]},A=new Map([["aggregate-field",{variables:[{name:"$feature",type:"feature"}]}],["form-constraint",{variables:[{name:"$feature",type:"feature"}]}],["feature-z",{variables:[{name:"$feature",type:"feature"}]}],["field-calculation",{variables:[{name:"$feature",type:"feature"},{name:"$datastore",type:"featureSetCollection"}]}],["form-calculation",{variables:[{name:"$feature",type:"feature"},{name:"$originalFeature",type:"feature"},{name:"$layer",type:"featureSet"},{name:"$featureSet",type:"featureSet"},{name:"$datastore",type:"featureSetCollection"},{name:"$map",type:"featureSetCollection"},{name:"$editContext",type:"dictionary",properties:[{name:"editType",type:"text"}]}]}],["labeling",{variables:[{name:"$feature",type:"feature"},{name:"$view",type:"dictionary",properties:[{name:"scale",type:"number"},{name:"timeProperties",type:"dictionary",properties:[{name:"currentStart",type:"date"},{name:"currentEnd",type:"date"},{name:"startIncluded",type:"boolean"},{name:"endIncluded",type:"boolean"}]}]}]}],["popup",x],["popup-element",x],["popup-feature-reduction",j],["popup-element-feature-reduction",j],["visualization",{variables:[{name:"$feature",type:"feature"},{name:"$view",type:"dictionary",properties:[{name:"scale",type:"number"},{name:"timeProperties",type:"dictionary",properties:[{name:"currentStart",type:"date"},{name:"currentEnd",type:"date"},{name:"startIncluded",type:"boolean"},{name:"endIncluded",type:"boolean"}]}]}]}],["popup-voxel",C],["popup-element-voxel",C]]);function k(e){"feature-reduction-popup"===e?(n(i.getLogger("esri.arcade"),'profile name: "feature-reduction-popup"',{replacement:'"popup-feature-reduction"',version:"4.32",warnOnce:!0}),e="popup-feature-reduction"):"feature-reduction-popup-element"===e&&(n(i.getLogger("esri.arcade"),'profile name: "feature-reduction-popup-element"',{replacement:'"popup-element-feature-reduction"',version:"4.32",warnOnce:!0}),e="popup-element-feature-reduction");const t=A.get(e);if(!t){const t=Array.from(A.keys()).map(e=>`'${e}'`).join(", ");throw new o("createArcadeProfile:invalid-profile-name",`Invalid profile name '${e}'. You must specify one of the following values: ${t}`)}return c(t)}async function T(e,t,a={}){f||(f=await y());const{arcade:n,arcadeUtils:c,batchExec:{createBatchExecutor:i},aiServices:{BatchTranslationServiceFactory:s,PortalTranslationService:p}}=f,{loadScriptDependencies:u,referencesMember:m,scriptIsAsync:d}=n,b=w(t.variables,[]).filter(e=>"featureSet"===e.type||"featureSetCollection"===e.type).map(e=>r(e.name)),v=n.parseScript(e,b);if(!v)throw new o("arcade:invalid-script","Unable to create SyntaxTree");const g=c.extractFieldNames(v),S=n.scriptTouchesGeometry(v),x=t.variables.map(e=>r(e.name)).filter(e=>m(v,e)),j=d(v,b);await u(v,j,b);const C=n.compileScript(v,{vars:Object.fromEntries(x.map(e=>[e,!0])),useAsync:j}),{lruCache:A,services:k}=a,T=n.featureSetUtils(),F=(e,r={})=>{if(j)throw new o("arcade:invalid-execution-mode","Cannot execute the script in synchronous mode");const a={...k,...r.services},n={lruCache:A,...r,services:a},i=C(h(t,e,n,T,j));return r.rawOutput?i:$(i,c)},O=async(e,r={})=>{const a={...k,...r.services},n={lruCache:A,...r,services:a},o=await C(h(t,e,n,T,j));return r.rawOutput?o:$(o,c)},I=async(e,r,a={})=>{const n=[],o=i(e,async(e,o)=>{const i=r(e);try{const e={...u,translation:m.create(o)},r={lruCache:A,...a,services:e},s=await C(h(t,i,r,T,j)),p=a.rawOutput?s:$(s,c);n.push({id:o.id,result:{status:"fulfilled",value:p}})}catch(s){throw n.push({id:o.id,result:{status:"rejected",reason:s}}),s}},a.maxConcurrency??64,a.abortSignal),u={...k,...a.services},m=new s(o,u.translation??new p(u.portal??l.getDefault(),a.console));return await o.run(),n.sort(({id:e},{id:t})=>e-t).map(({result:e})=>e)};return{execute:F,executeAsync:O,executeAsyncBatch:I,isAsync:j,variablesUsed:x,fieldsUsed:g,geometryUsed:S,syntaxTree:v}}export{T as createArcadeExecutor,k as createArcadeProfile};
|