12345 |
- /*
- All material copyright ESRI, All Rights Reserved, unless otherwise specified.
- See https://js.arcgis.com/4.25/esri/copyright.txt for details.
- */
- import{ArcadeModule as e}from"./ArcadeModule.js";import{ArcadeModuleLoader as t}from"./ArcadeModuleLoader.js";import n from"./Dictionary.js";import{ArcadeExecutionError as r,ExecutionErrorCodes as o,ensureArcadeExecutionError as l}from"./executionError.js";import a from"./Feature.js";import{NativeFunction as i,ArcadeFunction as s,ScopeMarshalledFunction as u,wrapModuleScopedResponse as c}from"./FunctionWrapper.js";import{y as f,a as p,s as d,p as h,o as w,v as m,i as g,c as v,m as y,R as b,x,w as S,b as I,g as F,I as C,j as R,r as A,u as M,q as E}from"../chunks/languageUtils.js";import{addFunctionDeclaration as L}from"./treeAnalysis.js";import{A as N}from"../chunks/array.js";import{registerFunctions as O}from"./functions/date.js";import{registerFunctions as B,geometryMember as j}from"./functions/geometry.js";import{registerFunctions as k}from"./functions/geomsync.js";import{registerFunctions as D}from"./functions/maths.js";import{registerFunctions as K}from"./functions/stats.js";import{registerFunctions as U}from"./functions/string.js";import q from"../geometry/Geometry.js";import G from"../geometry/SpatialReference.js";class P extends s{constructor(e,t){super(),this.definition=null,this.context=null,this.definition=e,this.context=t}createFunction(e){return(...t)=>{const n={spatialReference:this.context.spatialReference,console:this.context.console,lrucache:this.context.lrucache,exports:this.context.exports,libraryResolver:this.context.libraryResolver,interceptor:this.context.interceptor,localScope:{},depthCounter:{depth:e.depthCounter.depth+1},globalScope:this.context.globalScope};if(n.depthCounter.depth>64)throw new r(e,o.MaximumCallDepth,null);return Ie(this.definition,n,t,null)}}call(e,t){return V(e,t,((n,l,a)=>{const i={spatialReference:e.spatialReference,globalScope:e.globalScope,depthCounter:{depth:e.depthCounter.depth+1},libraryResolver:e.libraryResolver,exports:e.exports,console:e.console,lrucache:e.lrucache,interceptor:e.interceptor,localScope:{}};if(i.depthCounter.depth>64)throw new r(e,o.MaximumCallDepth,t);return Ie(this.definition,i,a,t)}))}marshalledCall(e,t,n,r){return r(e,t,((o,l,a)=>{const i={spatialReference:e.spatialReference,globalScope:n.globalScope,depthCounter:{depth:e.depthCounter.depth+1},libraryResolver:e.libraryResolver,exports:e.exports,console:e.console,lrucache:e.lrucache,interceptor:e.interceptor,localScope:{}};return a=a.map((t=>!g(t)||t instanceof u?t:c(t,e,r))),c(Ie(this.definition,i,a,t),n,r)}))}}class T extends e{constructor(e){super(e)}global(e){const t=this.executingContext.globalScope[e.toLowerCase()];if(t.valueset||(t.value=_(this.executingContext,t.node),t.valueset=!0),g(t.value)&&!(t.value instanceof u)){const e=new u;e.fn=t.value,e.parameterEvaluator=V,e.context=this.executingContext,t.value=e}return t.value}setGlobal(e,t){if(g(t))throw new r(null,o.AssignModuleFunction,null);this.executingContext.globalScope[e.toLowerCase()]={value:t,valueset:!0,node:null}}hasGlobal(e){return void 0===this.executingContext.exports[e]&&(e=e.toLowerCase()),void 0!==this.executingContext.exports[e]}loadModule(e){let n=e.spatialReference;null==n&&(n=new G({wkid:102100})),this.moduleScope=Ce({},e.customfunctions),this.executingContext={spatialReference:n,globalScope:this.moduleScope,localScope:null,libraryResolver:new t(e.libraryResolver._moduleSingletons,this.source.syntax.loadedModules),exports:{},console:e.console?e.console:Ae,lrucache:e.lrucache,interceptor:e.interceptor,depthCounter:{depth:1}},_(this.executingContext,this.source.syntax)}}function W(e,t){const n=[];for(let r=0;r<t.arguments.length;r++)n.push(_(e,t.arguments[r]));return n}function V(e,t,n){try{return!0===t.preparsed?n(e,null,t.arguments):n(e,t,W(e,t))}catch(r){throw r}}function _(e,t){try{switch(t?.type){case"EmptyStatement":return m;case"VariableDeclarator":return ue(e,t);case"VariableDeclaration":return se(e,t);case"ImportDeclaration":return ae(e,t);case"ExportNamedDeclaration":return ie(e,t);case"BlockStatement":case"Program":return re(e,t);case"FunctionDeclaration":return le(e,t);case"ReturnStatement":return oe(e,t);case"IfStatement":return ne(e,t);case"ExpressionStatement":return te(e,t);case"AssignmentExpression":return ee(e,t);case"UpdateExpression":return Z(e,t);case"BreakStatement":return w;case"ContinueStatement":return h;case"TemplateElement":return we(e,t);case"TemplateLiteral":return ge(e,t);case"ForStatement":return J(e,t);case"ForInStatement":return H(e,t);case"WhileStatement":return Q(e,t);case"Identifier":return ve(e,t);case"MemberExpression":return ce(e,t);case"Literal":return t.value;case"CallExpression":return ye(e,t);case"UnaryExpression":return fe(e,t);case"BinaryExpression":return de(e,t);case"LogicalExpression":return he(e,t);case"ArrayExpression":return pe(e,t);case"ObjectExpression":return Y(e,t);case"Property":return z(e,t);default:throw new r(e,o.Unrecognised,t)}}catch(n){throw l(e,t,n)}}function Y(e,t){const l={},a=new Map;for(let n=0;n<t.properties.length;n++){const i=_(e,t.properties[n]);if(g(i.value))throw new r(e,o.NoFunctionInDictionary,t);if(!1===v(i.key))throw new r(e,o.KeyMustBeString,t);let s=i.key.toString();const u=s.toLowerCase();a.has(u)?s=a.get(u):a.set(u,s),i.value===m?l[s]=null:l[s]=i.value}const i=new n(l);return i.immutable=!1,i}function z(e,t){return{key:"Identifier"===t.key.type?t.key.name:_(e,t.key),value:_(e,t.value)}}function H(e,t){const l=_(e,t.right);"VariableDeclaration"===t.left.type&&_(e,t.left);let a=null,i="";if("VariableDeclaration"===t.left.type){const e=t.left.declarations[0].id;"Identifier"===e.type&&(i=e.name)}else"Identifier"===t.left.type&&(i=t.left.name);if(!i)throw new r(e,o.InvalidIdentifier,t);if(i=i.toLowerCase(),null!=e.localScope&&void 0!==e.localScope[i]&&(a=e.localScope[i]),null===a&&void 0!==e.globalScope[i]&&(a=e.globalScope[i]),null===a)throw new r(e,o.InvalidIdentifier,t);if(y(l)||v(l)){const n=l.length;for(let r=0;r<n;r++){a.value=r;const n=_(e,t.body);if(n===w)break;if(n instanceof b)return n}return m}if(x(l)){for(let n=0;n<l.length();n++){a.value=n;const r=_(e,t.body);if(r===w)break;if(r instanceof b)return r}return m}if(!(l instanceof n||S(l)))return m;{const n=l.keys();for(let r=0;r<n.length;r++){a.value=n[r];const o=_(e,t.body);if(o===w)break;if(o instanceof b)return o}}}function J(e,t){null!==t.init&&_(e,t.init);const n={testResult:!0,lastAction:m};do{X(e,t,n)}while(!0===n.testResult);return n.lastAction instanceof b?n.lastAction:m}function Q(e,t){const n={testResult:!0,lastAction:m};if(n.testResult=_(e,t.test),!1===n.testResult)return m;if(!0!==n.testResult)throw new r(e,o.BooleanConditionRequired,t);for(;!0===n.testResult&&(n.lastAction=_(e,t.body),n.lastAction!==w)&&!(n.lastAction instanceof b);)if(n.testResult=_(e,t.test),!0!==n.testResult&&!1!==n.testResult)throw new r(e,o.BooleanConditionRequired,t);return n.lastAction instanceof b?n.lastAction:m}function X(e,t,n){if(null!==t.test){if(n.testResult=_(e,t.test),!1===n.testResult)return;if(!0!==n.testResult)throw new r(e,o.BooleanConditionRequired,t)}n.lastAction=_(e,t.body),n.lastAction!==w?n.lastAction instanceof b?n.testResult=!1:null!==t.update&&_(e,t.update):n.testResult=!1}function Z(e,t){let l,a=null,i="";if("MemberExpression"===t.argument.type){if(a=_(e,t.argument.object),!0===t.argument.computed?i=_(e,t.argument.property):"Identifier"===t.argument.property.type&&(i=t.argument.property.name),y(a)){if(!I(i))throw new r(e,o.ArrayAccessorMustBeNumber,t);if(i<0&&(i=a.length+i),i<0||i>=a.length)throw new r(e,o.OutOfBounds,t);l=F(a[i]),a[i]="++"===t.operator?l+1:l-1}else if(a instanceof n){if(!1===v(i))throw new r(e,o.KeyAccessorMustBeString,t);if(!0!==a.hasField(i))throw new r(e,o.FieldNotFound,t);l=F(a.field(i)),a.setField(i,"++"===t.operator?l+1:l-1)}else if(S(a)){if(!1===v(i))throw new r(e,o.KeyAccessorMustBeString,t);if(!0!==a.hasField(i))throw new r(e,o.FieldNotFound,t);l=F(a.field(i)),a.setField(i,"++"===t.operator?l+1:l-1)}else{if(x(a))throw new r(e,o.Immutable,t);if(!(a instanceof T))throw new r(e,o.InvalidParameter,t);if(!1===v(i))throw new r(e,o.ModuleAccessorMustBeString,t);if(!0!==a.hasGlobal(i))throw new r(e,o.ModuleExportNotFound,t);l=F(a.global(i)),a.setGlobal(i,"++"===t.operator?l+1:l-1)}return!1===t.prefix?l:"++"===t.operator?l+1:l-1}if(a="Identifier"===t.argument.type?t.argument.name.toLowerCase():"",!a)throw new r(e,o.InvalidIdentifier,t);if(null!=e.localScope&&void 0!==e.localScope[a])return l=F(e.localScope[a].value),e.localScope[a]={value:"++"===t.operator?l+1:l-1,valueset:!0,node:t},!1===t.prefix?l:"++"===t.operator?l+1:l-1;if(void 0!==e.globalScope[a])return l=F(e.globalScope[a].value),e.globalScope[a]={value:"++"===t.operator?l+1:l-1,valueset:!0,node:t},!1===t.prefix?l:"++"===t.operator?l+1:l-1;throw new r(e,o.InvalidIdentifier,t)}function $(e,t,n,l,a){switch(t){case"=":return e===m?null:e;case"/=":return F(n)/F(e);case"*=":return F(n)*F(e);case"-=":return F(n)-F(e);case"+=":return v(n)||v(e)?R(n)+R(e):F(n)+F(e);case"%=":return F(n)%F(e);default:throw new r(a,o.UnsupportedOperator,l)}}function ee(e,t){const l=_(e,t.right);let a=null,i="";if("MemberExpression"===t.left.type){if(a=_(e,t.left.object),!0===t.left.computed)i=_(e,t.left.property);else{if("Identifier"!==t.left.property.type)throw new r(e,o.InvalidIdentifier,t);i=t.left.property.name}if(y(a)){if(!I(i))throw new r(e,o.ArrayAccessorMustBeNumber,t);if(i<0&&(i=a.length+i),i<0||i>a.length)throw new r(e,o.OutOfBounds,t);if(i===a.length){if("="!==t.operator)throw new r(e,o.OutOfBounds,t);a[i]=$(l,t.operator,a[i],t,e)}else a[i]=$(l,t.operator,a[i],t,e)}else if(a instanceof n){if(!1===v(i))throw new r(e,o.KeyAccessorMustBeString,t);if(!0===a.hasField(i))a.setField(i,$(l,t.operator,a.field(i),t,e));else{if("="!==t.operator)throw new r(e,o.FieldNotFound,t,{key:i});a.setField(i,$(l,t.operator,null,t,e))}}else if(S(a)){if(!1===v(i))throw new r(e,o.KeyAccessorMustBeString,t);if(!0===a.hasField(i))a.setField(i,$(l,t.operator,a.field(i),t,e));else{if("="!==t.operator)throw new r(e,o.FieldNotFound,t,{key:i});a.setField(i,$(l,t.operator,null,t,e))}}else{if(x(a))throw new r(e,o.Immutable,t);if(!(a instanceof T))throw new r(e,o.InvalidIdentifier,t);if(!1===v(i))throw new r(e,o.ModuleAccessorMustBeString,t);if(!0!==a.hasGlobal(i))throw new r(e,o.ModuleExportNotFound,t);a.setGlobal(i,$(l,t.operator,a.global(i),t,e))}return m}if(a=t.left.name.toLowerCase(),null!=e.localScope&&void 0!==e.localScope[a])return e.localScope[a]={value:$(l,t.operator,e.localScope[a].value,t,e),valueset:!0,node:t.right},m;if(void 0!==e.globalScope[a])return e.globalScope[a]={value:$(l,t.operator,e.globalScope[a].value,t,e),valueset:!0,node:t.right},m;throw new r(e,o.InvalidIdentifier,t)}function te(e,t){if("AssignmentExpression"===t.expression.type||"UpdateExpression"===t.expression.type)return _(e,t.expression);if("CallExpression"===t.expression.type){const n=_(e,t.expression);return n===m?m:new C(n)}{const n=_(e,t.expression);return n===m?m:new C(n)}}function ne(e,t){const n=_(e,t.test);if(!0===n)return _(e,t.consequent);if(!1===n)return null!==t.alternate?_(e,t.alternate):m;throw new r(e,o.BooleanConditionRequired,t)}function re(e,t){let n=m;for(let r=0;r<t.body.length;r++)if(n=_(e,t.body[r]),n instanceof b||n===w||n===h)return n;return n}function oe(e,t){if(null===t.argument)return new b(m);const n=_(e,t.argument);return new b(n)}function le(e,t){const n=t.id.name.toLowerCase();return e.globalScope[n]={valueset:!0,node:null,value:new P(t,e)},m}function ae(e,t){const n=t.specifiers[0].local.name.toLowerCase(),r=e.libraryResolver.loadLibrary(n);let o=null;return e.libraryResolver._moduleSingletons?.has(r.uri)?o=e.libraryResolver._moduleSingletons.get(r.uri):(o=new T(r),o.loadModule(e),e.libraryResolver._moduleSingletons?.set(r.uri,o)),e.globalScope[n]={value:o,valueset:!0,node:t},m}function ie(e,t){if(_(e,t.declaration),"FunctionDeclaration"===t.declaration.type)e.exports[t.declaration.id.name.toLowerCase()]="function";else if("VariableDeclaration"===t.declaration.type)for(const n of t.declaration.declarations)e.exports[n.id.name.toLowerCase()]="variable";return m}function se(e,t){for(let n=0;n<t.declarations.length;n++)_(e,t.declarations[n]);return m}function ue(e,t){let n=null===t.init?null:_(e,t.init);if(n===m&&(n=null),"Identifier"!==t.id.type)throw new r(e,o.InvalidIdentifier,t);const l=t.id.name.toLowerCase();return null!=e.localScope?e.localScope[l]={value:n,valueset:!0,node:t.init}:e.globalScope[l]={value:n,valueset:!0,node:t.init},m}function ce(e,t){try{const l=_(e,t.object);if(null===l)throw new r(e,o.MemberOfNull,t);if(!1===t.computed){if("Identifier"===t.property.type){if(l instanceof n||S(l))return l.field(t.property.name);if(l instanceof q)return j(l,t.property.name,t,e);if(l instanceof T){if(!l.hasGlobal(t.property.name))throw new r(e,o.InvalidIdentifier,t);return l.global(t.property.name)}}throw new r(e,o.InvalidMemberAccessKey,t)}{let a=_(e,t.property);if(l instanceof n||S(l)){if(v(a))return l.field(a);throw new r(e,o.InvalidMemberAccessKey,t)}if(l instanceof T){if(v(a))return l.global(a);throw new r(e,o.InvalidMemberAccessKey,t)}if(l instanceof q){if(v(a))return j(l,a,t,e);throw new r(e,o.InvalidMemberAccessKey,t)}if(y(l)){if(I(a)&&isFinite(a)&&Math.floor(a)===a){if(a<0&&(a=l.length+a),a>=l.length||a<0)throw new r(e,o.OutOfBounds,t);return l[a]}throw new r(e,o.InvalidMemberAccessKey,t)}if(v(l)){if(I(a)&&isFinite(a)&&Math.floor(a)===a){if(a<0&&(a=l.length+a),a>=l.length||a<0)throw new r(e,o.OutOfBounds,t);return l[a]}throw new r(e,o.InvalidMemberAccessKey,t)}if(x(l)){if(I(a)&&isFinite(a)&&Math.floor(a)===a){if(a<0&&(a=l.length()+a),a>=l.length()||a<0)throw new r(e,o.OutOfBounds,t);return l.get(a)}throw new r(e,o.InvalidMemberAccessKey,t)}throw new r(e,o.InvalidMemberAccessKey,t)}}catch(l){throw l}}function fe(e,t){try{const n=_(e,t.argument);if(p(n)){if("!"===t.operator)return!n;if("-"===t.operator)return-1*F(n);if("+"===t.operator)return 1*F(n);if("~"===t.operator)return~F(n);throw new r(e,o.UnsupportedUnaryOperator,t)}if("~"===t.operator)return~F(n);if("-"===t.operator)return-1*F(n);if("+"===t.operator)return 1*F(n);throw new r(e,o.UnsupportedUnaryOperator,t)}catch(n){throw n}}function pe(e,t){try{const n=[];for(let l=0;l<t.elements.length;l++){const a=_(e,t.elements[l]);if(g(a))throw new r(e,o.NoFunctionInArray,t);a===m?n.push(null):n.push(a)}return n}catch(n){throw n}}function de(e,t){try{const n=[_(e,t.left),_(e,t.right)],l=n[0],a=n[1];switch(t.operator){case"|":case"<<":case">>":case">>>":case"^":case"&":return M(F(l),F(a),t.operator);case"==":return d(l,a);case"!=":return!d(l,a);case"<":case">":case"<=":case">=":return A(l,a,t.operator);case"+":return v(l)||v(a)?R(l)+R(a):F(l)+F(a);case"-":return F(l)-F(a);case"*":return F(l)*F(a);case"/":return F(l)/F(a);case"%":return F(l)%F(a);default:throw new r(e,o.UnsupportedOperator,t)}}catch(n){throw n}}function he(e,t){try{const n=_(e,t.left);if(p(n))switch(t.operator){case"||":if(!0===n)return n;{const n=_(e,t.right);if(p(n))return n;throw new r(e,o.LogicExpressionOrAnd,t)}case"&&":if(!1===n)return n;{const n=_(e,t.right);if(p(n))return n;throw new r(e,o.LogicExpressionOrAnd,t)}default:throw new r(e,o.LogicExpressionOrAnd,t)}throw new r(e,o.LogicalExpressionOnlyBoolean,t)}catch(n){throw n}}function we(e,t){return t.value?t.value.cooked:""}function me(e,t,n){if(g(e))throw new r(t,o.NoFunctionInTemplateLiteral,n);return e}function ge(e,t){let n="",r=0;for(const o of t.quasis)if(n+=o.value?o.value.cooked:"",!1===o.tail){n+=t.expressions[r]?R(me(_(e,t.expressions[r]),e,t)):"",r++}return n}function ve(e,t){let n;try{const l=t.name.toLowerCase();if(null!=e.localScope&&void 0!==e.localScope[l])return n=e.localScope[l],!0===n.valueset||(n.value=_(e,n.node),n.valueset=!0),n.value;if(void 0!==e.globalScope[l])return n=e.globalScope[l],!0===n.valueset||(n.value=_(e,n.node),n.valueset=!0),n.value;throw new r(e,o.InvalidIdentifier,t)}catch(l){throw l}}function ye(e,t){try{if("MemberExpression"===t.callee.type){const n=_(e,t.callee.object);if(!(n instanceof T))throw new r(e,o.FuncionNotFound,t);const l=!1===t.callee.computed?t.callee.property.name:_(e,t.callee.property);if(!n.hasGlobal(l))throw new r(e,o.FuncionNotFound,t);const a=n.global(l);if(!g(a))throw new r(e,o.CallNonFunction,t);return a.call(e,t)}if("Identifier"!==t.callee.type)throw new r(e,o.FuncionNotFound,t);if(null!=e.localScope&&void 0!==e.localScope[t.callee.name.toLowerCase()]){const n=e.localScope[t.callee.name.toLowerCase()];if(g(n.value))return n.value.call(e,t);throw new r(e,o.CallNonFunction,t)}if(void 0!==e.globalScope[t.callee.name.toLowerCase()]){const n=e.globalScope[t.callee.name.toLowerCase()];if(g(n.value))return n.value.call(e,t);throw new r(e,o.CallNonFunction,t)}throw new r(e,o.FuncionNotFound,t)}catch(n){throw n}}const be={};function xe(e,t,n,r){try{const o=_(e,t.arguments[n]);if(d(o,r))return _(e,t.arguments[n+1]);{const o=t.arguments.length-n;return 1===o?_(e,t.arguments[n]):2===o?null:3===o?_(e,t.arguments[n+2]):xe(e,t,n+2,r)}}catch(o){throw o}}function Se(e,t,n,l){try{if(!0===l)return _(e,t.arguments[n+1]);if(3===t.arguments.length-n)return _(e,t.arguments[n+2]);{const l=_(e,t.arguments[n+2]);if(!1===p(l))throw new r(e,o.BooleanConditionRequired,t.arguments[n+2]);return Se(e,t,n+2,l)}}catch(a){throw a}}function Ie(e,t,n,l){try{const a=e.body;if(n.length!==e.params.length)throw new r(t,o.WrongNumberOfParameters,l);if(null!=t.localScope)for(let r=0;r<n.length;r++)t.localScope[e.params[r].name.toLowerCase()]={value:n[r],valueset:!0,node:null};const i=_(t,a);if(i instanceof b)return i.value;if(i===w)throw new r(t,o.UnexpectedToken,l);if(i===h)throw new r(t,o.UnexpectedToken,l);return i instanceof C?i.value:i}catch(a){throw a}}O(be,V),U(be,V),D(be,V),B(be,V),K(be,V),k(be,V),be.iif=function(e,t){try{f(null===t.arguments?[]:t.arguments,3,3,e,t);const n=_(e,t.arguments[0]);if(!1===p(n))throw new r(e,o.BooleanConditionRequired,t);return _(e,!0===n?t.arguments[1]:t.arguments[2])}catch(n){throw n}},be.decode=function(e,t){try{if(t.arguments.length<2)throw new r(e,o.WrongNumberOfParameters,t);if(2===t.arguments.length)return _(e,t.arguments[1]);{if((t.arguments.length-1)%2==0)throw new r(e,o.WrongNumberOfParameters,t);const n=_(e,t.arguments[0]);return xe(e,t,1,n)}}catch(n){throw n}},be.when=function(e,t){try{if(t.arguments.length<3)throw new r(e,o.WrongNumberOfParameters,t);if(t.arguments.length%2==0)throw new r(e,o.WrongNumberOfParameters,t);const n=_(e,t.arguments[0]);if(!1===p(n))throw new r(e,o.BooleanConditionRequired,t.arguments[0]);return Se(e,t,0,n)}catch(n){throw n}};for(const Le in be)be[Le]={value:new i(be[Le]),valueset:!0,node:null};const Fe=function(){};function Ce(e,t){const r=new Fe;e||(e={}),t||(t={});const o=new n({newline:"\n",tab:"\t",singlequote:"'",doublequote:'"',forwardslash:"/",backwardslash:"\\"});o.immutable=!1,r.textformatting={value:o,valueset:!0,node:null};for(const n in t)r[n]={value:new i(t[n]),native:!0,valueset:!0,node:null};for(const n in e)e[n]&&"esri.Graphic"===e[n].declaredClass?r[n]={value:a.createFromGraphic(e[n]),valueset:!0,node:null}:r[n]={value:e[n],valueset:!0,node:null};return r}Fe.prototype=be,Fe.prototype.infinity={value:Number.POSITIVE_INFINITY,valueset:!0,node:null},Fe.prototype.pi={value:Math.PI,valueset:!0,node:null};const Re={fixSpatialReference:E,parseArguments:W,standardFunction:V};function Ae(e){console.log(e)}function Me(e){const t={mode:"sync",compiled:!1,functions:{},signatures:[],standardFunction:V,evaluateIdentifier:ve};for(let n=0;n<e.length;n++)e[n].registerFunctions(t);for(const n in t.functions)be[n]={value:new i(t.functions[n]),valueset:!0,node:null},Fe.prototype[n]=be[n];for(let n=0;n<t.signatures.length;n++)L(t.signatures[n],"sync")}function Ee(e,n){let l=n.spatialReference;null==l&&(l=new G({wkid:102100}));let a=null;e.usesModules&&(a=new t(new Map,e.loadedModules));const i={spatialReference:l,globalScope:Ce(n.vars,n.customfunctions),localScope:null,exports:{},libraryResolver:a,console:n.console?n.console:Ae,lrucache:n.lrucache,interceptor:n.interceptor,depthCounter:{depth:1}};let s=_(i,e);if(s instanceof b&&(s=s.value),s instanceof C&&(s=s.value),s===m&&(s=null),s===w)throw new r(i,o.IllegalResult,null);if(s===h)throw new r(i,o.IllegalResult,null);if(g(s))throw new r(i,o.IllegalResult,null);return s}Me([N]);export{Ee as executeScript,Me as extend,Re as functionHelper};
|