@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
1 lines • 39.1 kB
JavaScript
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[3543,7367],{71163(n,e,t){t.d(e,{C:()=>c});var r=t(29953);let a,o,i=!1;function s(){return a??=(0,r.ho)("arcadeGeometryOperatorsWorker").then(n=>{o=n,i=!0,a=void 0})}async function c(n,e){return i?o.apply("invokeGeometryOp",[n,e]):(await s(),c(n,e))}},80672(n,e,t){t.d(e,{R:()=>a});var r=t(20655);function a(n,e){return null===n?e:new r.A({url:n.field("url")})}},87367(n,e,t){t.r(e),t.d(e,{registerFunctions:()=>$});var r=t(47609),a=t(66395),o=t(85935),i=t(78502),s=t(78878),c=t(80672),l=t(98919),u=t(71163),f=t(4576),d=t(5443),w=t(91075),p=t(48526),h=t(86738),y=t(39829),m=t(82799),g=t(65864),v=t(20655),S=t(70333),b=t(11254);async function A(n,e,t){const r=S.id?.findCredential(n.restUrl);if(!r)return null;if("loaded"===n.loadStatus&&""===e&&n.user?.sourceJSON&&!1===t)return n.user.sourceJSON;const a={responseType:"json",query:{f:"json"}};if(t&&(a.query.returnUserLicenseTypeExtensions=!0),""===e){const e=await(0,b.A)(n.restUrl+"/community/self",a);if(e.data){const n=e.data;if(n?.username)return n}return null}const o=await(0,b.A)(n.restUrl+"/community/users/"+e,a);if(o.data){const n=o.data;return n.error?null:n}return null}var D=t(54218);function C(n){if(null==n)return n;switch(typeof n){case"string":case"number":return n;default:throw new o.D$(null,"InvalidParameter",null)}}function $(n){"async"===n.mode&&(n.functions.disjoint=function(e,t){return n.standardFunctionAsync(e,t,(n,r,a)=>(a=(0,s.C)(a),(0,l.ZL)(a,e,t),null===a[0]||null===a[1]||(0,u.C)("disjoint",[a[0].toJSON(),a[1].toJSON()])))},n.functions.intersects=function(e,t){return n.standardFunctionAsync(e,t,(n,r,a)=>(a=(0,s.C)(a),(0,l.ZL)(a,e,t),null!==a[0]&&null!==a[1]&&(0,u.C)("intersects",[a[0].toJSON(),a[1].toJSON()])))},n.functions.touches=function(e,t){return n.standardFunctionAsync(e,t,(n,r,a)=>(a=(0,s.C)(a),(0,l.ZL)(a,e,t),null!==a[0]&&null!==a[1]&&(0,u.C)("touches",[a[0].toJSON(),a[1].toJSON()])))},n.functions.crosses=function(e,t){return n.standardFunctionAsync(e,t,(n,r,a)=>(a=(0,s.C)(a),(0,l.ZL)(a,e,t),null!==a[0]&&null!==a[1]&&(0,u.C)("crosses",[a[0].toJSON(),a[1].toJSON()])))},n.functions.within=function(e,t){return n.standardFunctionAsync(e,t,(n,r,a)=>(a=(0,s.C)(a),(0,l.ZL)(a,e,t),null!==a[0]&&null!==a[1]&&(0,u.C)("within",[a[0].toJSON(),a[1].toJSON()])))},n.functions.contains=function(e,t){return n.standardFunctionAsync(e,t,(n,r,a)=>(a=(0,s.C)(a),(0,l.ZL)(a,e,t),null!==a[0]&&null!==a[1]&&(0,u.C)("contains",[a[0].toJSON(),a[1].toJSON()])))},n.functions.overlaps=function(e,t){return n.standardFunctionAsync(e,t,(n,r,a)=>(a=(0,s.C)(a),(0,l.ZL)(a,e,t),null!==a[0]&&null!==a[1]&&(0,u.C)("overlaps",[a[0].toJSON(),a[1].toJSON()])))},n.functions.equals=function(e,t){return n.standardFunctionAsync(e,t,(n,r,a)=>((0,s.B)(a,2,2,e,t),a[0]===a[1]||(a[0]instanceof w.A&&a[1]instanceof w.A?(0,u.C)("equals",[a[0].toJSON(),a[1].toJSON()]):((0,s.e)(a[0])&&(0,s.e)(a[1])||!!((0,s.g)(a[0])&&(0,s.g)(a[1])||(0,s.f)(a[0])&&(0,s.f)(a[1])))&&a[0].equals(a[1]))))},n.functions.relate=function(e,t){return n.standardFunctionAsync(e,t,(n,r,a)=>{if(a=(0,s.C)(a),(0,s.B)(a,3,3,e,t),a[0]instanceof w.A&&a[1]instanceof w.A)return(0,u.C)("relate",[a[0].toJSON(),a[1].toJSON(),(0,s.s)(a[2])]);if(a[0]instanceof w.A&&null===a[1])return!1;if(a[1]instanceof w.A&&null===a[0])return!1;if(null===a[0]&&null===a[1])return!1;throw new o.D$(e,"InvalidParameter",t)})},n.functions.intersection=function(e,t){return n.standardFunctionAsync(e,t,async(n,r,a)=>(a=(0,s.C)(a),(0,l.ZL)(a,e,t),null===a[0]||null===a[1]?null:(0,g.rS)(await(0,u.C)("intersection",[a[0].toJSON(),a[1].toJSON()]))))},n.functions.union=function(e,t){return n.standardFunctionAsync(e,t,async(n,r,a)=>{if(0===(a=(0,s.C)(a)).length)throw new o.D$(e,"WrongNumberOfParameters",t);const c=[];if(1===a.length)if((0,D.cy)(a[0])){for(const n of(0,s.C)(a[0]))if(null!==n){if(!(n instanceof w.A))throw new o.D$(e,"InvalidParameter",t);c.push(n.toJSON())}}else{if(!(0,s.j)(a[0])){if(a[0]instanceof w.A)return(0,s.D)((0,i.Yq)(a[0]),e.spatialReference);if(null===a[0])return null;throw new o.D$(e,"InvalidParameter",t)}for(const n of(0,s.C)(a[0].toArray()))if(null!==n){if(!(n instanceof w.A))throw new o.D$(e,"InvalidParameter",t);c.push(n.toJSON())}}else for(const n of a)if(null!==n){if(!(n instanceof w.A))throw new o.D$(e,"InvalidParameter",t);c.push(n.toJSON())}return 0===c.length?null:(0,g.rS)(await(0,u.C)("union",[c]))})},n.functions.difference=function(e,t){return n.standardFunctionAsync(e,t,async(n,r,a)=>(a=(0,s.C)(a),(0,l.ZL)(a,e,t),null===a[0]?null:null===a[1]?(0,i.Yq)(a[0]):(0,g.rS)(await(0,u.C)("difference",[a[0].toJSON(),a[1].toJSON()]))))},n.functions.symmetricdifference=function(e,t){return n.standardFunctionAsync(e,t,async(n,r,a)=>(a=(0,s.C)(a),(0,l.ZL)(a,e,t),null===a[0]&&null===a[1]?null:null===a[0]?(0,i.Yq)(a[1]):null===a[1]?(0,i.Yq)(a[0]):(0,g.rS)(await(0,u.C)("symmetricDifference",[a[0].toJSON(),a[1].toJSON()]))))},n.functions.clip=function(e,t){return n.standardFunctionAsync(e,t,async(n,r,a)=>{if(a=(0,s.C)(a),(0,s.B)(a,2,2,e,t),!(a[1]instanceof d.A)&&null!==a[1])throw new o.D$(e,"InvalidParameter",t);if(null===a[0])return null;if(!(a[0]instanceof w.A))throw new o.D$(e,"InvalidParameter",t);return null===a[1]?null:(0,g.rS)(await(0,u.C)("clip",[a[0].toJSON(),a[1].toJSON()]))})},n.functions.cut=function(e,t){return n.standardFunctionAsync(e,t,async(n,r,a)=>{if(a=(0,s.C)(a),(0,s.B)(a,2,2,e,t),!(a[1]instanceof m.A)&&null!==a[1])throw new o.D$(e,"InvalidParameter",t);if(null===a[0])return[];if(!(a[0]instanceof w.A))throw new o.D$(e,"InvalidParameter",t);return null===a[1]?[(0,i.Yq)(a[0])]:(await(0,u.C)("cut",[a[0].toJSON(),a[1].toJSON()])).map(n=>(0,g.rS)(n))})},n.functions.area=function(e,t){return n.standardFunctionAsync(e,t,async(n,r,a)=>{if((0,s.B)(a,1,2,e,t),a=(0,s.C)(a),(0,s.m)(a[0])){const n=await a[0].sumArea(C(a[1]),null,e.abortSignal);if(e.abortSignal.aborted)throw new o.D$(e,"Cancelled",t);return n}let i=a[0];if(((0,D.cy)(i)||(0,s.j)(i))&&(i=(0,s.E)(a[0],e.spatialReference)),null===i)return 0;if(!(i instanceof w.A))throw new o.D$(e,"InvalidParameter",t);return(0,u.C)("area",[i.toJSON(),C(a[1])])})},n.functions.areageodetic=function(e,t){return n.standardFunctionAsync(e,t,async(n,r,a)=>{(0,s.B)(a,1,3,e,t);let i=(a=(0,s.C)(a))[0];((0,D.cy)(i)||(0,s.j)(i))&&(i=(0,s.E)(i,e.spatialReference));const c=C(a[1]),f=(0,l.rE)(a[2]);if((0,s.m)(i)){const n=await i.sumArea(c,f,e.abortSignal);if(e.abortSignal.aborted)throw new o.D$(e,"Cancelled",t);return n}if(null==i)return 0;if(!(0,s.h)(i))throw new o.D$(e,"InvalidParameter",t);return(0,u.C)("geodeticArea",[i.toJSON(),c,f])})},n.functions.length=function(e,t){return n.standardFunctionAsync(e,t,async(n,r,a)=>{if((0,s.B)(a,1,2,e,t),a=(0,s.C)(a),(0,s.m)(a[0])){const n=await a[0].sumLength(C(a[1]),null,e.abortSignal);if(e.abortSignal.aborted)throw new o.D$(e,"Cancelled",t);return n}let i=a[0];if(((0,D.cy)(a[0])||(0,s.j)(a[0]))&&(i=(0,s.F)(a[0],e.spatialReference)),null===i)return 0;if(!(i instanceof w.A))throw new o.D$(e,"InvalidParameter",t);return(0,u.C)("length",[i.toJSON(),C(a[1])])})},n.functions.length3d=function(e,r){return n.standardFunctionAsync(e,r,async(n,a,i)=>{if((0,s.B)(i,1,2,e,r),null===(i=(0,s.C)(i))[0])return 0;let c=i[0];if(((0,D.cy)(i[0])||(0,s.j)(i[0]))&&(c=(0,s.F)(i[0],e.spatialReference)),null===c)return 0;if(!(c instanceof w.A))throw new o.D$(e,"InvalidParameter",r);if(!0===c.hasZ){const{convertFromSpatialReferenceUnit:n,toLengthUnit:e}=await Promise.resolve().then(t.bind(t,40547)),r=(0,l.UI)(c);return n(c.spatialReference,e(i[1]),r)}return(0,u.C)("length",[c.toJSON(),C(i[1])])})},n.functions.lengthgeodetic=function(e,t){return n.standardFunctionAsync(e,t,async(n,r,a)=>{(0,s.B)(a,1,3,e,t);let i=(a=(0,s.C)(a))[0];((0,D.cy)(a[0])||(0,s.j)(a[0]))&&(i=(0,s.F)(a[0],e.spatialReference));const c=C(a[1]),f=(0,l.rE)(a[2]);if((0,s.m)(i)){const n=await i.sumLength(c,f,e.abortSignal);if(e.abortSignal.aborted)throw new o.D$(e,"Cancelled",t);return n}if(null===i)return 0;if(!(0,s.h)(i))throw new o.D$(e,"InvalidParameter",t);return(0,u.C)("geodeticLength",[i.toJSON(),c,f])})},n.functions.distance=function(e,t){return n.standardFunctionAsync(e,t,async(n,r,a)=>{a=(0,s.C)(a),(0,s.B)(a,2,3,e,t);let i=a[0];if(((0,D.cy)(a[0])||(0,s.j)(a[0]))&&(i=(0,s.G)(a[0],e.spatialReference)),!(i instanceof w.A))throw new o.D$(e,"InvalidParameter",t);let c=a[1];if(((0,D.cy)(a[1])||(0,s.j)(a[1]))&&(c=(0,s.G)(a[1],e.spatialReference)),!(c instanceof w.A))throw new o.D$(e,"InvalidParameter",t);return(0,u.C)("distance",[i.toJSON(),c.toJSON(),C(a[2])])})},n.functions.distancegeodetic=function(e,t){return n.standardFunctionAsync(e,t,async(n,r,a)=>{a=(0,s.C)(a),(0,s.B)(a,2,4,e,t);const i=a[0];if(!(i instanceof h.A))throw new o.D$(e,"InvalidParameter",t);const c=a[1];if(!(c instanceof h.A))throw new o.D$(e,"InvalidParameter",t);const f=new m.A({paths:[],spatialReference:i.spatialReference});return f.addPath([i,c]),(0,u.C)("geodeticLength",[f.toJSON(),C(a[2]),(0,l.rE)(a[3])])})},n.functions.densify=function(e,t){return n.standardFunctionAsync(e,t,async(n,r,a)=>{if(a=(0,s.C)(a),(0,s.B)(a,2,3,e,t),null===a[0])return null;if(!(a[0]instanceof w.A))throw new o.D$(e,"InvalidParameter",t);const i=(0,s.r)(a[1]);if(isNaN(i))throw new o.D$(e,"InvalidParameter",t);if(i<=0)throw new o.D$(e,"InvalidParameter",t);switch(a[0].type){case"polygon":case"polyline":case"extent":return(0,g.rS)(await(0,u.C)("densify",[a[0].toJSON(),i,C(a[2])]));default:return a[0]}})},n.functions.densifygeodetic=function(e,t){return n.standardFunctionAsync(e,t,async(n,r,a)=>{a=(0,s.C)(a),(0,s.B)(a,2,4,e,t);const i=a[0];if(null==i)return null;if(!(0,s.h)(i))throw new o.D$(e,"InvalidParameter",t);const c=(0,s.r)(a[1]);if(isNaN(c))throw new o.D$(e,"InvalidParameter",t);if(c<=0)throw new o.D$(e,"InvalidParameter",t);const f=C(a[2]),d=(0,l.rE)(a[3]);switch(i.type){case"polygon":case"polyline":case"extent":return(0,g.rS)(await(0,u.C)("geodeticDensify",[i.toJSON(),c,f,d]));default:return i}})},n.functions.generalize=function(e,t){return n.standardFunctionAsync(e,t,async(n,r,a)=>{if(a=(0,s.C)(a),(0,s.B)(a,2,4,e,t),null===a[0])return null;if(!(a[0]instanceof w.A))throw new o.D$(e,"InvalidParameter",t);const i=(0,s.r)(a[1]);if(isNaN(i))throw new o.D$(e,"InvalidParameter",t);const c=(0,s.H)((0,s.J)(a[2],!0));return(0,g.rS)(await(0,u.C)("generalize",[a[0].toJSON(),i,C(a[3]),{removeDegenerateParts:c}]))})},n.functions.buffer=function(e,t){return n.standardFunctionAsync(e,t,async(n,r,a)=>{if(a=(0,s.C)(a),(0,s.B)(a,2,3,e,t),null===a[0])return null;if(!(a[0]instanceof w.A))throw new o.D$(e,"InvalidParameter",t);const c=(0,s.r)(a[1]);if(isNaN(c))throw new o.D$(e,"InvalidParameter",t);return 0===c?(0,i.Yq)(a[0]):(0,g.rS)(await(0,u.C)("buffer",[a[0].toJSON(),c,C(a[2])]))})},n.functions.buffergeodetic=function(e,t){return n.standardFunctionAsync(e,t,async(n,r,a)=>{a=(0,s.C)(a),(0,s.B)(a,2,4,e,t);const c=a[0];if(null==c)return null;if(!(0,s.h)(c))throw new o.D$(e,"InvalidParameter",t);const f=(0,s.r)(a[1]);if(isNaN(f))throw new o.D$(e,"InvalidParameter",t);if(0===f)return(0,i.Yq)(c);const d=C(a[2]),w=(0,l.rE)(a[3]);return(0,g.rS)(await(0,u.C)("geodesicBuffer",[c.toJSON(),f,d,w]))})},n.functions.offset=function(e,t){return n.standardFunctionAsync(e,t,async(n,r,a)=>{a=(0,s.C)(a),(0,s.B)(a,2,6,e,t);const i=a[0];if(null===i)return null;if(!(i instanceof y.A||i instanceof m.A))throw new o.D$(e,"InvalidParameter",t);const c=(0,s.r)(a[1]);if(isNaN(c))throw new o.D$(e,"InvalidParameter",t);const f=a[2],d=(0,l.R$)(a[3]),w=(0,s.r)((0,s.J)(a[4],10));if(isNaN(w))throw new o.D$(e,"InvalidParameter",t);const p=(0,s.r)((0,s.J)(a[5],0));if(isNaN(p))throw new o.D$(e,"InvalidParameter",t);return(0,g.rS)(await(0,u.C)("offset",[i.toJSON(),c,C(f),d,w,p]))})},n.functions.rotate=function(e,t){return n.standardFunctionAsync(e,t,async(n,r,a)=>{if(a=(0,s.C)(a),(0,s.B)(a,2,3,e,t),null===a[0])return null;if(!(a[0]instanceof w.A))throw new o.D$(e,"InvalidParameter",t);const i=a[0]instanceof d.A?y.A.fromExtent(a[0]):a[0],c=(0,s.r)(a[1]);if(isNaN(c))throw new o.D$(e,"InvalidParameter",t);const l=(0,s.J)(a[2],null);if(null===l){const n="point"===i.type?i:i.extent?.center;return(0,g.rS)(await(0,u.C)("rotate",[i.toJSON(),c,n?.x,n?.y]))}if(l instanceof h.A)return(0,g.rS)(await(0,u.C)("rotate",[i.toJSON(),c,l.x,l.y]));throw new o.D$(e,"InvalidParameter",t)})},n.functions.centroid=function(e,t){return n.standardFunctionAsync(e,t,async(n,r,a)=>{if(a=(0,s.C)(a),(0,s.B)(a,1,2,e,t),null===a[0])return null;const i=(0,l.Hz)(a[1]);let c=a[0];if(((0,D.cy)(a[0])||(0,s.j)(a[0]))&&(c="geometric"===i?(0,s.G)(a[0],e.spatialReference):(0,s.E)(a[0],e.spatialReference),null===c))return null;if(!(c instanceof w.A))throw new o.D$(e,"InvalidParameter",t);return(0,g.rS)("geometric"===i?await(0,u.C)("centroid",[c.toJSON()]):await(0,u.C)("labelPoint",[c.toJSON()]))})},n.functions.measuretocoordinate=function(e,t){return n.standardFunctionAsync(e,t,l.Cd)},n.functions.pointtocoordinate=function(e,t){return n.standardFunctionAsync(e,t,l.kr)},n.functions.distancetocoordinate=function(e,t){return n.standardFunctionAsync(e,t,l.Bn)},n.functions.multiparttosinglepart=function(e,t){return n.standardFunctionAsync(e,t,async(n,r,a)=>{if(a=(0,s.C)(a),(0,s.B)(a,1,1,e,t),null===a[0])return null;if(!(a[0]instanceof w.A))throw new o.D$(e,"InvalidParameter",t);if(a[0]instanceof h.A)return[(0,s.D)((0,i.Yq)(a[0]),e.spatialReference)];if(a[0]instanceof d.A)return[(0,s.D)((0,i.Yq)(a[0]),e.spatialReference)];const c=(0,g.rS)(await(0,u.C)("simplify",[a[0].toJSON()]));if(c instanceof y.A){const n=[],e=[];for(let t=0;t<c.rings.length;t++)if(c.isClockwise(c.rings[t])){const e=(0,g.rS)({rings:[c.rings[t]],hasZ:!0===c.hasZ,hasM:!0===c.hasM,spatialReference:c.spatialReference.toJSON()});n.push(e)}else e.push({ring:c.rings[t],pt:c.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(c instanceof m.A){const n=[];for(let e=0;e<c.paths.length;e++){const t=(0,g.rS)({paths:[c.paths[e]],hasZ:!0===c.hasZ,hasM:!0===c.hasM,spatialReference:c.spatialReference.toJSON()});n.push(t)}return n}if(a[0]instanceof p.A){const n=[],t=(0,s.D)((0,i.Yq)(a[0]),e.spatialReference);for(let e=0;e<t.points.length;e++)n.push(t.getPoint(e));return n}return null})},n.functions.isselfintersecting=function(e,t){return n.standardFunctionAsync(e,t,async(n,e,t)=>{(0,s.B)(t,1,1,n,e);let r=(t=(0,s.C)(t))[0];if(((0,D.cy)(t[0])||(0,s.j)(t[0]))&&(r=(0,s.F)(t[0],n.spatialReference)),r instanceof p.A){const n=r.points;for(let e=0;e<n.length;e++)for(let t=e+1;t<n.length;t++)if((0,f.aI)(n[e],n[t]))return!0;return!1}return(r instanceof m.A||r instanceof y.A)&&await(0,u.C)("isSelfIntersecting",[r.toJSON()])})},n.functions.issimple=function(e,t){return n.standardFunctionAsync(e,t,(n,r,a)=>{if(a=(0,s.C)(a),(0,s.B)(a,1,1,e,t),null===a[0])return!0;if(!(a[0]instanceof w.A))throw new o.D$(e,"InvalidParameter",t);return(0,u.C)("isSimple",[a[0].toJSON()])})},n.functions.simplify=function(e,t){return n.standardFunctionAsync(e,t,async(n,r,a)=>{if(a=(0,s.C)(a),(0,s.B)(a,1,1,e,t),null===a[0])return null;if(!(a[0]instanceof w.A))throw new o.D$(e,"InvalidParameter",t);return(0,g.rS)(await(0,u.C)("simplify",[a[0].toJSON()]))})},n.functions.convexhull=function(e,t){return n.standardFunctionAsync(e,t,async(n,r,a)=>{if(a=(0,s.C)(a),(0,s.B)(a,1,1,e,t),null===a[0])return null;if(!(a[0]instanceof w.A))throw new o.D$(e,"InvalidParameter",t);return(0,g.rS)(await(0,u.C)("convexHull",[a[0].toJSON()]))})},n.functions.getuser=function(e,t){return n.standardFunctionAsync(e,t,async(n,i,l)=>{(0,s.B)(l,0,2,e,t);let u=(0,s.J)(l[1],""),f=!0===u;if(u=!0===u||!1===u?"":(0,s.s)(u),0===l.length||l[0]instanceof r.A){let n;n=e.services?.portal?e.services.portal:v.A.getDefault(),l.length>0&&(n=(0,c.R)(l[0],n));const t=await A(n,u,f);if(t){const n=JSON.parse(JSON.stringify(t));for(const e of["lastLogin","created","modified"])void 0!==n[e]&&null!==n[e]&&(n[e]=new Date(n[e]));return a.A.convertObjectToArcadeDictionary(n,(0,s.K)(e))}return null}let d=null;if((0,s.m)(l[0])&&(d=l[0]),d){if(f=!1,u)return null;await d.load();const n=await d.getOwningSystemUrl();if(!n){if(!u){const n=await d.getIdentityUser();return n?a.A.convertObjectToArcadeDictionary({username:n},(0,s.K)(e)):null}return null}let t;t=e.services?.portal?e.services.portal:v.A.getDefault(),t=(0,c.R)(new r.A(n),t);const o=await A(t,u,f);if(o){const n=JSON.parse(JSON.stringify(o));for(const e of["lastLogin","created","modified"])void 0!==n[e]&&null!==n[e]&&(n[e]=new Date(n[e]));return a.A.convertObjectToArcadeDictionary(n,(0,s.K)(e))}return null}throw new o.D$(e,"InvalidParameter",t)})},n.functions.nearestcoordinate=function(e,t){return n.standardFunctionAsync(e,t,async(n,r,i)=>{if(i=(0,s.C)(i),(0,s.B)(i,2,2,e,t),!(i[0]instanceof w.A||null===i[0]))throw new o.D$(e,"InvalidParameter",t);if(!(i[1]instanceof h.A||null===i[1]))throw new o.D$(e,"InvalidParameter",t);if(null===i[0]||null===i[1])return null;const c=i[0]instanceof d.A?y.A.fromExtent(i[0]):i[0],l=await(0,u.C)("getNearestCoordinate",[c.toJSON(),i[1].toJSON(),{calculateLeftRightSide:!0}]);return null===l?null:a.A.convertObjectToArcadeDictionary({coordinate:(0,g.rS)(l.coordinate),distance:l.distance,sideOfLine:0===l.distance?"straddle":l.isRightSide?"right":"left"},(0,s.K)(e),!1,!0)})},n.functions.nearestvertex=function(e,t){return n.standardFunctionAsync(e,t,async(n,r,i)=>{if(i=(0,s.C)(i),(0,s.B)(i,2,2,e,t),!(i[0]instanceof w.A||null===i[0]))throw new o.D$(e,"InvalidParameter",t);if(!(i[1]instanceof h.A||null===i[1]))throw new o.D$(e,"InvalidParameter",t);if(null===i[0]||null===i[1])return null;const c=i[0]instanceof d.A?y.A.fromExtent(i[0]):i[0],l=await(0,u.C)("getNearestVertex",[c.toJSON(),i[1].toJSON()]);return null==l?null:a.A.convertObjectToArcadeDictionary({coordinate:(0,g.rS)(l.coordinate),distance:l.distance,sideOfLine:l.sideOfLine},(0,s.K)(e),!1,!0)})})}},93543(n,e,t){t.r(e),t.d(e,{executeScript:()=>dn,extend:()=>ln,prepareScript:()=>fn});var r=t(48938),a=t(99719),o=t(72888),i=t(17433),s=t(15695),c=t(66395),l=t(85935),u=t(93833),f=t(92400),d=t(78878),w=t(19157),p=t(3367),h=t(63680),y=t(81113),m=t(32091),g=t(87367),v=t(41217),S=t(36770),b=t(47346),A=t(29304),D=t(4730),C=t(53966),$=t(16930),N=t(94128),O=t(54218);const F=()=>C.A.getLogger("esri.arcade.arcadeAsyncRuntime"),x=Symbol("uninitialized");function I(n){if(n===x)throw new l.D$(null,"InvalidIdentifier",null)}function R(n){return I(n),n}function J(n,e){const t=(0,r.X)(e);if(null!==n.localScope){const e=n.localScope[t];if(void 0!==e)return{scope:n.localScope,id:t,var:e}}const a=n.globalScope[t];if(void 0!==a)return{scope:n.globalScope,id:t,var:a};throw new l.D$(n,"InvalidIdentifier",e)}function P(n,e,t="InvalidIdentifier"){const a=(0,r.X)(e);if(null!==n.localScope){const e=n.localScope[a];if(void 0!==e)return I(e),e.value}const o=n.globalScope[a];if(void 0!==o)return I(o),o.value;throw new l.D$(n,t,e)}const k=function(){};async function B(n,e){const t=[];for(let r=0;r<e.arguments.length;r++)t.push(await Z(n,e.arguments[r]));return t}async function E(n,e,t){return!0===e.preparsed?t(n,null,e.arguments):t(n,e,await B(n,e))}k.prototype=Object.freeze(Object.create(null));class j extends f.fF{constructor(n,e,t,r){super(),this.definition=n,this.context=e,this._params=t,this._locals=r}createFunction(n){return(...e)=>{const t={spatialReference:this.context.spatialReference,console:this.context.console,lrucache:this.context.lrucache,timeZone:this.context.timeZone??null,exports:this.context.exports,libraryResolver:this.context.libraryResolver,interceptor:this.context.interceptor,services:this.context.services,abortSignal:this.context.abortSignal,localScope:new k,depthCounter:{depth:n.depthCounter.depth+1},globalScope:this.context.globalScope,track:this.context.track};if(t.depthCounter.depth>64)throw new l.D$(n,"MaximumCallDepth",null);return L(t,this.definition.body,this._params,this._locals,e,null)}}call(n,e){return U(n,e,(t,r,a)=>{const o={spatialReference:n.spatialReference,services:n.services,console:n.console,libraryResolver:n.libraryResolver,exports:n.exports,lrucache:n.lrucache,timeZone:n.timeZone??null,interceptor:n.interceptor,localScope:new k,abortSignal:n.abortSignal,globalScope:n.globalScope,depthCounter:{depth:n.depthCounter.depth+1},track:n.track};if(o.depthCounter.depth>64)throw new l.D$(n,"MaximumCallDepth",e);return L(o,this.definition.body,this._params,this._locals,a,e)})}marshalledCall(n,e,t,r){return r(n,e,async(a,o,i)=>{const s={spatialReference:n.spatialReference,services:n.services,globalScope:t.globalScope,depthCounter:{depth:n.depthCounter.depth+1},libraryResolver:n.libraryResolver,exports:n.exports,console:n.console,abortSignal:n.abortSignal,lrucache:n.lrucache,timeZone:n.timeZone??null,interceptor:n.interceptor,localScope:new k,track:n.track};return i=i.map(e=>!(0,d.i)(e)||e instanceof f.CU?e:(0,f.o6)(e,n,r)),(0,f.o6)(await L(s,this.definition.body,this._params,this._locals,i,e),t,r)})}}async function L(n,e,t,r,a,o){if(t.length!==a.length)throw new l.D$(n,"WrongNumberOfParameters",o);if(null!=n.localScope){for(let e=0;e<t.length;e++)n.localScope[t[e]]={value:a[e]};for(const e of r)n.localScope[e]=x}const i=await q(n,e);if(i instanceof d.R)return i.value;if(i===d.z)throw new l.D$(n,"UnexpectedToken",o);if(i===d.A)throw new l.D$(n,"UnexpectedToken",o);return i instanceof d.I?i.value:i}class M extends a.x{constructor(n){super(),this.moduleGlobalContext=n}global(n){const e=(0,r.X)(n);if(!this.moduleGlobalContext.exports.has(e))throw new l.D$(null,"ModuleExportNotFound",null);const t=this.moduleGlobalContext.globalScope[e];if(I(t),(0,d.i)(t.value)&&!(t.value instanceof f.CU)){const n=new f.CU;return n.fn=t.value,n.parameterEvaluator=E,n.context=this.moduleGlobalContext,this.moduleGlobalContext.globalScope[e]={value:n},n}return t.value}setGlobal(n,e){if((0,d.i)(e))throw new l.D$(null,"AssignModuleFunction",null);const t=(0,r.X)(n);if(!this.moduleGlobalContext.exports.has(t))throw new l.D$(null,"ModuleExportNotFound",null);this.moduleGlobalContext.globalScope[t]={value:e}}hasGlobal(n){return this.moduleGlobalContext.exports.has((0,r.X)(n))}static async load(n,e){const{globals:t,exports:a}=(0,i.aU)(e),s=new cn;for(const n of t)n in s||(s[n]=x);const c=n.spatialReference??$.A.WebMercator,l={lrucache:n.lrucache,interceptor:n.interceptor,services:n.services,console:n.console??un,abortSignal:n.abortSignal??r._,timeZone:n.timeZone??null,spatialReference:c,track:null,depthCounter:{depth:1},libraryResolver:new o.a(n.libraryResolver._moduleSingletons,e.loadedModules),exports:a,localScope:null,globalScope:s};return await _(l,e),new M(l)}}async function U(n,e,t){return!0===e.preparsed?t(n,null,e.arguments):t(n,e,await B(n,e))}async function Z(n,e){e.breakpoint&&await e.breakpoint();try{switch(e.type){case"UpdateExpression":return await async function(n,e){const t=e.argument;if("CallExpression"===t.type)throw new l.D$(n,"NeverReach",e);if("MemberExpression"===t.type){const r=await Z(n,t.object);let a,o;if(!0===t.computed)a=await Z(n,t.property);else{if("Identifier"!==t.property.type)throw new l.D$(n,"Unrecognized",e);a=t.property.name}if((0,O.cy)(r)){if(!(0,O.Et)(a))throw new l.D$(n,"ArrayAccessMustBeNumber",e);if(a<0&&(a=r.length+a),a<0||a>=r.length)throw new l.D$(n,"OutOfBounds",e);o=(0,d.r)(r[a]),r[a]="++"===e.operator?o+1:o-1}else if(r instanceof c.A){if(!1===(0,O.Kg)(a))throw new l.D$(n,"KeyAccessorMustBeString",e);if(!0!==r.hasField(a))throw new l.D$(n,"FieldNotFound",e,{key:a});o=(0,d.r)(r.field(a)),r.setField(a,"++"===e.operator?o+1:o-1)}else if(r instanceof M){if(!1===(0,O.Kg)(a))throw new l.D$(n,"ModuleAccessorMustBeString",e);if(!0!==r.hasGlobal(a))throw new l.D$(n,"ModuleExportNotFound",e);o=(0,d.r)(r.global(a)),r.setGlobal(a,"++"===e.operator?o+1:o-1)}else{if(!(0,d.k)(r))throw(0,d.j)(r)?new l.D$(n,"Immutable",e):new l.D$(n,"InvalidParameter",e);if(!1===(0,O.Kg)(a))throw new l.D$(n,"KeyAccessorMustBeString",e);if(!0!==r.hasField(a))throw new l.D$(n,"FieldNotFound",e,{key:a});o=(0,d.r)(r.field(a)),r.setField(a,"++"===e.operator?o+1:o-1)}return!1===e.prefix?o:"++"===e.operator?o+1:o-1}const r=J(n,t),a=(0,d.r)(R(r.var).value),o="++"===e.operator?a+1:a-1;return r.scope[r.id]={value:o},!1===e.prefix?a:"++"===e.operator?a+1:a-1}(n,e);case"AssignmentExpression":return await async function(n,e){const t=e.left;if("MemberExpression"===t.type){const r=await Z(n,t.object);let a;if(!0===t.computed)a=await Z(n,t.property);else{if("Identifier"!==t.property.type)throw new l.D$(n,"InvalidIdentifier",e);a=t.property.name}const o=await Z(n,e.right);if((0,O.cy)(r)){if(!(0,O.Et)(a))throw new l.D$(n,"ArrayAccessMustBeNumber",e);if(a<0&&(a=r.length+a),a<0||a>r.length)throw new l.D$(n,"OutOfBounds",e);if(a===r.length){if("="!==e.operator)throw new l.D$(n,"OutOfBounds",e);r[a]=T(o,e.operator,r[a],e,n)}else r[a]=T(o,e.operator,r[a],e,n)}else if(r instanceof c.A){if(!1===(0,O.Kg)(a))throw new l.D$(n,"KeyAccessorMustBeString",e);if(!0===r.hasField(a))r.setField(a,T(o,e.operator,r.field(a),e,n));else{if("="!==e.operator)throw new l.D$(n,"FieldNotFound",e,{key:a});r.setField(a,T(o,e.operator,null,e,n))}}else if(r instanceof M){if(!1===(0,O.Kg)(a))throw new l.D$(n,"KeyAccessorMustBeString",e);if(!0!==r.hasGlobal(a))throw new l.D$(n,"ModuleExportNotFound",e);r.setGlobal(a,T(o,e.operator,r.global(a),e,n))}else{if(!(0,d.k)(r))throw(0,d.j)(r)?new l.D$(n,"Immutable",e):new l.D$(n,"InvalidParameter",e);if(!1===(0,O.Kg)(a))throw new l.D$(n,"KeyAccessorMustBeString",e);if(!0===r.hasField(a))r.setField(a,T(o,e.operator,r.field(a),e,n));else{if("="!==e.operator)throw new l.D$(n,"FieldNotFound",e,{key:a});r.setField(a,T(o,e.operator,null,e,n))}}return d.v}const r=J(n,t),a=await Z(n,e.right);return r.scope[r.id]={value:T(a,e.operator,"="!==e.operator?R(r.var).value:null,e,n)},d.v}(n,e);case"TemplateLiteral":return await async function(n,e){let t="",r=0;for(const a of e.quasis)if(t+=a.value?a.value.cooked:"",!1===a.tail){if(e.expressions[r]){const a=await Z(n,e.expressions[r]);if((0,d.i)(a))throw new l.D$(n,"NoFunctionInTemplateLiteral",e);t+=(0,d.s)(a)}r++}return t}(n,e);case"Identifier":return Q(n,e);case"MemberExpression":return await async function(n,e){return Y(n,await Z(n,e.object),e)}(n,e);case"Literal":return e.value;case"CallExpression":return await async function(n,e){return nn(n,"Identifier"===e.callee.type?P(n,e.callee,"FunctionNotFound"):await Z(n,e.callee),e)}(n,e);case"UnaryExpression":return await async function(n,e){const t=await Z(n,e.argument);if((0,O.Lm)(t)){if("!"===e.operator)return!t;if("-"===e.operator)return-1*(0,d.r)(t);if("+"===e.operator)return 1*(0,d.r)(t);if("~"===e.operator)return~(0,d.r)(t);throw new l.D$(n,"UnsupportUnaryOperator",e)}if("-"===e.operator)return-1*(0,d.r)(t);if("+"===e.operator)return 1*(0,d.r)(t);if("~"===e.operator)return~(0,d.r)(t);throw new l.D$(n,"UnsupportUnaryOperator",e)}(n,e);case"BinaryExpression":return await async function(n,e){const t=await Z(n,e.left),r=await Z(n,e.right);switch(e.operator){case"|":case"<<":case">>":case">>>":case"^":case"&":return(0,d.x)((0,d.r)(t),(0,d.r)(r),e.operator);case"==":return(0,d.w)(t,r);case"!=":return!(0,d.w)(t,r);case"<":case">":case"<=":case">=":return(0,d.u)(t,r,e.operator);case"+":return(0,O.Kg)(t)||(0,O.Kg)(r)?(0,d.s)(t)+(0,d.s)(r):(0,d.r)(t)+(0,d.r)(r);case"-":return(0,d.r)(t)-(0,d.r)(r);case"*":return(0,d.r)(t)*(0,d.r)(r);case"/":return(0,d.r)(t)/(0,d.r)(r);case"%":return(0,d.r)(t)%(0,d.r)(r);default:throw e.operator,new l.D$(n,"UnsupportedOperator",e)}}(n,e);case"LogicalExpression":return await async function(n,e){const t=await Z(n,e.left);if(!(0,O.Lm)(t))throw new l.D$(n,"LogicalExpressionOnlyBoolean",e);switch(e.operator){case"||":{if(!0===t)return t;const r=await Z(n,e.right);if((0,O.Lm)(r))return r;throw new l.D$(n,"LogicExpressionOrAnd",e)}case"&&":{if(!1===t)return t;const r=await Z(n,e.right);if((0,O.Lm)(r))return r;throw new l.D$(n,"LogicExpressionOrAnd",e)}default:throw e.operator,new l.D$(n,"LogicExpressionOrAnd",e)}}(n,e);case"ArrayExpression":return await async function(n,e){const t=[];for(let r=0;r<e.elements.length;r++)t.push(await Z(n,e.elements[r]));for(let r=0;r<t.length;r++){if((0,d.i)(t[r]))throw new l.D$(n,"NoFunctionInArray",e);t[r]===d.v&&(t[r]=null)}return t}(n,e);case"ObjectExpression":return await async function(n,e){const t=[];for(let r=0;r<e.properties.length;r++){const a=e.properties[r],o=await Z(n,a.value),i="Identifier"===a.key.type?a.key.name:await Z(n,a.key);t[r]={key:i,value:o}}const r=Object.create(null),a=new Map;for(let o=0;o<t.length;o++){const i=t[o];if((0,d.i)(i.value))throw new l.D$(n,"NoFunctionInDictionary",e);if(!1===(0,O.Kg)(i.key))throw new l.D$(n,"KeyMustBeString",e);let s=i.key.toString();const c=s.toLowerCase();a.has(c)?s=a.get(c):a.set(c,s),i.value===d.v?r[s]=null:r[s]=i.value}const o=new c.A(r);return o.immutable=!1,o}(n,e);case"MemberAccessChainExpression":return await async function(n,e){const t=(0,i.YZ)(e);let r=await Z(n,t.root);for(const e of t.sections){const t=await H(n,r,e.checked);if(null==t)return null;r=await V(n,t,e.unchecked)}return r}(n,e);case"SafeMemberExpression":throw F().error("SafeMemberExpression outside of MemberAccessChainExpression"),new l.D$(null,"Unrecognized",e);default:throw new l.D$(n,"Unrecognized",e)}}catch(t){throw(0,l.Nh)(n,e,t)}}async function q(n,e){e.breakpoint&&await e.breakpoint();try{switch(e.type){case"ImportDeclaration":return await async function(n,e){const t=J(n,e.specifiers[0].local),r=n.libraryResolver;if(null==r)throw F().error("Internal error: module loader not initialized"),new l.D$(n,"NeverReach",e);const a=r.loadLibrary(t.id);let o;return r._moduleSingletons?.has(a.uri)?o=r._moduleSingletons.get(a.uri):(o=await M.load(n,a.syntax),r._moduleSingletons?.set(a.uri,o)),t.scope[t.id]={value:o},d.v}(n,e);case"ExportNamedDeclaration":return await async function(n,e){return await q(n,e.declaration),d.v}(n,e);case"VariableDeclaration":return await async function(n,e){for(const t of e.declarations)await X(n,t);return d.v}(n,e);case"BlockStatement":return await _(n,e);case"FunctionDeclaration":return await async function(n,e){if(null!=n.localScope)throw F().error("Function declarations are only valid in global scope."),new l.D$(n,"NeverReach",e);const t=(0,r.X)(e.id);if(!(t in n.globalScope))throw F().error(`Function "${t}" not declared.`),new l.D$(n,"NeverReach",e);const a=(0,i.SV)(e),o=e.params.map(n=>(0,r.X)(n)),s=Array.from(a).filter(n=>!o.includes(n));return n.globalScope[t]={value:new j(e,n,o,s)},d.v}(n,e);case"ReturnStatement":return await async function(n,e){if(null===e.argument)return new d.R(d.v);const t=await Z(n,e.argument);return new d.R(t)}(n,e);case"IfStatement":return await async function(n,e){const t=await Z(n,e.test);if(!0===t)return q(n,e.consequent);if(!1===t)return null!==e.alternate?q(n,e.alternate):d.v;throw new l.D$(n,"BooleanConditionRequired",e)}(n,e);case"ExpressionStatement":return await async function(n,e){const t=await Z(n,e.expression);return t===d.v?d.v:new d.I(t)}(n,e);case"ForStatement":return await async function(n,e){try{for(null!==e.init&&("VariableDeclaration"===e.init.type?await q(n,e.init):await Z(n,e.init));;){if(null!==e.test){const t=await Z(n,e.test);if(!0===n.abortSignal?.aborted)throw new l.D$(n,"Cancelled",e);if(!1===t)break;if(!0!==t)throw new l.D$(n,"BooleanConditionRequired",e)}const t=await q(n,e.body);if(t===d.z)break;if(t instanceof d.R)return t;null!==e.update&&await Z(n,e.update)}return d.v}catch(n){throw n}}(n,e);case"WhileStatement":return await async function(n,e){let t=await Z(n,e.test);if(!1===t)return d.v;if(!0!==t)throw new l.D$(n,"BooleanConditionRequired",e);for(;!0===t;){const r=await q(n,e.body);if(r===d.z)break;if(r instanceof d.R)return r;if(t=await Z(n,e.test),!0!==t&&!1!==t)throw new l.D$(n,"BooleanConditionRequired",e)}return d.v}(n,e);case"ForInStatement":return await async function(n,e){const t=await Z(n,e.right);"VariableDeclaration"===e.left.type&&await q(n,e.left);const r=J(n,"VariableDeclaration"===e.left.type?e.left.declarations[0].id:e.left);return(0,O.cy)(t)||(0,O.Kg)(t)?await z(n,e,t,r):(0,d.j)(t)?await K(n,e,t,r):t instanceof c.A||(0,d.y)(t)?await z(n,e,t.keys(),r,"k"):(0,d.m)(t)?await G(n,e,t,r):(0,d.h)(t)?await z(n,e,(0,s.T)(t),r,"k"):d.v}(n,e);case"ForOfStatement":return await async function(n,e){const t=await Z(n,e.right);"VariableDeclaration"===e.left.type&&await q(n,e.left);const r=J(n,"VariableDeclaration"===e.left.type?e.left.declarations[0].id:e.left);return(0,O.cy)(t)||(0,O.Kg)(t)?await z(n,e,t,r,"k"):(0,d.j)(t)?await K(n,e,t,r,"k"):t instanceof c.A||(0,d.y)(t)?await async function(n,e,t,r){for(const a of t.keys()){const o=t.field(a);r.scope[r.id]={value:c.A.containerEntry(a,o)};const i=await q(n,e.body);if(i===d.z)break;if(i instanceof d.R)return i}return d.v}(n,e,t,r):(0,d.m)(t)?await G(n,e,t,r):(0,d.h)(t)?await async function(n,e,t,r){for(const a of(0,s.T)(t)){const o=(0,s.Ny)(t,a,n,e);r.scope[r.id]={value:c.A.containerEntry(a,o)};const i=await q(n,e.body);if(i===d.z)break;if(i instanceof d.R)return i}return d.v}(n,e,t,r):d.v}(n,e);case"BreakStatement":return d.z;case"EmptyStatement":return d.v;case"ContinueStatement":return d.A;default:throw new l.D$(n,"Unrecognized",e)}}catch(t){throw(0,l.Nh)(n,e,t)}}async function z(n,e,t,r,a="i"){const o=t.length;for(let i=0;i<o;i++){if("k"===a){if(i>=t.length)throw new l.D$(n,"OutOfBounds",e);r.scope[r.id]={value:t[i]}}else r.scope[r.id]={value:i};const o=await q(n,e.body);if(o===d.z)break;if(o instanceof d.R)return o}return d.v}async function K(n,e,t,r,a="i"){const o=t.length();for(let i=0;i<o;i++){r.scope[r.id]="k"===a?{value:t.get(i)}:{value:i};const o=await q(n,e.body);if(o===d.z)break;if(o instanceof d.R)return o}return d.v}async function G(n,e,t,r){n:for await(const a of await t.queryAll(n.abortSignal))for(const o of a){r.scope[r.id]={value:u.Xj.createFromGraphicLikeObject(o.geometry,o.attributes,t,n.timeZone)};const a=await q(n,e.body);if(a===d.z)break n;if(a instanceof d.R)return a}return d.v}function T(n,e,t,r,a){switch(e){case"=":return n===d.v?null:n;case"/=":return(0,d.r)(t)/(0,d.r)(n);case"*=":return(0,d.r)(t)*(0,d.r)(n);case"-=":return(0,d.r)(t)-(0,d.r)(n);case"+=":return(0,O.Kg)(t)||(0,O.Kg)(n)?(0,d.s)(t)+(0,d.s)(n):(0,d.r)(t)+(0,d.r)(n);case"%=":return(0,d.r)(t)%(0,d.r)(n);default:throw new l.D$(a,"UnsupportedOperator",r)}}async function _(n,e){return W(n,e,0)}async function W(n,e,t){if(t>=e.body.length)return d.v;const r=await q(n,e.body[t]);return r instanceof d.R||r===d.z||r===d.A||t===e.body.length-1?r:W(n,e,t+1)}async function X(n,e){let t=null;t=null===e.init?null:await Z(n,e.init),t===d.v&&(t=null);const r=J(n,e.id);r.scope[r.id]={value:t}}async function Y(n,e,t){const r=t.computed?await Z(n,t.property):t.property.name;return(0,s.Xf)(e,r)}async function V(n,e,t){for(const r of t)switch(r.type){case"MemberExpression":e=await Y(n,e,r);break;case"CallExpression":e=await nn(n,e,r);break;default:throw new l.D$(null,"Unrecognized",r)}return e}async function H(n,e,t){const r=t.computed?await Z(n,t.property):t.property.name;return(0,s.c$)(e,r)}function Q(n,e){return P(n,e)}async function nn(n,e,t){if((0,d.i)(e))return e.call(n,t);throw new l.D$(n,"CallNonFunction",t)}async function en(n,e){(0,d.B)(null===e.arguments?[]:e.arguments,3,3,n,e);const t=await Z(n,e.arguments[0]);if(!1===(0,O.Lm)(t))throw new l.D$(n,"BooleanConditionRequired",e);return Z(n,t?e.arguments[1]:e.arguments[2])}async function tn(n,e){(0,d.B)(null===e.arguments?[]:e.arguments,2,3,n,e);const t=await Z(n,e.arguments[0]);if(3===e.arguments.length){const r=await Z(n,e.arguments[1]),a=(0,s.jd)(t,r);return null!=a&&""!==a?a:Z(n,e.arguments[2])}return null==t||""===t?Z(n,e.arguments[1]):t}async function rn(n,e){if(e.arguments.length<2)throw new l.D$(n,"WrongNumberOfParameters",e);if(2===e.arguments.length)return Z(n,e.arguments[1]);if((e.arguments.length-1)%2==0)throw new l.D$(n,"WrongNumberOfParameters",e);return an(n,e,1,await Z(n,e.arguments[0]))}async function an(n,e,t,r){const a=await Z(n,e.arguments[t]);if((0,d.w)(a,r))return Z(n,e.arguments[t+1]);const o=e.arguments.length-t;return 1===o?Z(n,e.arguments[t]):2===o?null:3===o?Z(n,e.arguments[t+2]):an(n,e,t+2,r)}async function on(n,e){if(e.arguments.length<3)throw new l.D$(n,"WrongNumberOfParameters",e);if(e.arguments.length%2==0)throw new l.D$(n,"WrongNumberOfParameters",e);const t=await Z(n,e.arguments[0]);if(!1===(0,O.Lm)(t))throw new l.D$(n,"BooleanConditionRequired",e.arguments[0]);return sn(n,e,0,t)}async function sn(n,e,t,r){if(!0===r)return Z(n,e.arguments[t+1]);if(3===e.arguments.length-t)return Z(n,e.arguments[t+2]);const a=await Z(n,e.arguments[t+2]);if(!1===(0,O.Lm)(a))throw new l.D$(n,"ModuleExportNotFound",e.arguments[t+2]);return sn(n,e,t+2,a)}const cn=function(){const n=Object.create(null);(0,y.d)(n,E),(0,A.d)(n,E),(0,m.d)(n,E,Q),(0,S.d)(n,E),(0,v.d)(n,E),(0,b.d)(n,E),(0,D.dW)(n,E),(0,g.registerFunctions)({functions:n,compiled:!1,signatures:null,evaluateIdentifier:null,mode:"async",standardFunction:E,standardFunctionAsync:U}),n.iif=en,n.defaultvalue=tn,n.decode=rn,n.when=on;const e=function(){this.textformatting={value:c.A.textFormatting()}};(e.prototype=Object.create(null)).infinity=Object.freeze({value:Number.POSITIVE_INFINITY}),e.prototype.pi=Object.freeze({value:Math.PI});for(const[t,r]of Object.entries(n))e.prototype[t]=Object.freeze({value:new f.UQ(r)});return e}();function ln(n){const e={mode:"async",compiled:!1,functions:Object.create(null),signatures:[],standardFunction:E,standardFunctionAsync:U,evaluateIdentifier:Q};for(let t=0;t<n.length;t++)n[t].registerFunctions(e);for(const[n,t]of Object.entries(e.functions))cn.prototype[n]=Object.freeze({value:new f.UQ(t)});for(let n=0;n<e.signatures.length;n++)(0,w.WC)(e.signatures[n],"async")}function un(n){console.log(n)}function fn(n,e){const t=new Set(Object.keys(e?.vars||{}).map(n=>(0,r.X)(n))),a=new Set(Object.keys(e?.customfunctions||{}).map(n=>(0,r.X)(n))),{globals:s,exports:c}=(0,i.aU)(n);return async e=>{const i=e.spatialReference??$.A.WebMercator;let w=null;n.usesModules&&(w=new o.a(new Map,n.loadedModules));const p=new cn;for(const n of a)null!=e.customfunctions&&n in e.customfunctions?p[n]={value:new f.UQ(e.customfunctions[n])}:p[n]=x;for(const n of t){if(null==e.vars||!(n in e.vars)){n in p||(p[n]=x);continue}const t=e.vars[n]??null;(0,N.D)(t)?p[n]={value:u.Xj.createFromGraphic(t,e.timeZone??null)}:p[n]={value:t}}for(const n of s)n in p||(p[n]=x);const h={lrucache:e.lrucache,interceptor:e.interceptor,services:e.services,console:e.console??un,abortSignal:e.abortSignal??r._,timeZone:e.timeZone??null,spatialReference:i,track:e.track,depthCounter:{depth:1},libraryResolver:w,exports:c,localScope:null,globalScope:p},y=await _(h,n);if(y instanceof d.R||y instanceof d.I){const n=y.value;if((0,d.q)(n))return null;if((0,d.i)(n))throw new l.D$(h,"IllegalResult",null);return n}if((0,d.q)(y))return null;if(y===d.z)throw new l.D$(h,"IllegalResult",null);if(y===d.A)throw new l.D$(h,"IllegalResult",null);throw new l.D$(h,"NeverReach",null)}}function dn(n,e){return fn(n,e)(e)}ln([h.A]),ln([p.A])}}]);