/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{replace as e}from"../core/string.js";const r={TypeNotAllowedInFeature:"Feature attributes only support dates, numbers, strings, guids.",LogicError:"Logic error - {reason}",CannotCompareDateAndTime:"Cannot compare date or dateonly with timeonly types",NeverReach:"Encountered unreachable logic",AsyncNotEnabled:"Async Arcade must be enabled for this script",ModuleAccessorMustBeString:"Module accessor must be a string",ModuleExportNotFound:"Module has no export with provided identifier",ModulesNotSupported:"Current profile does not support modules",ArrayAccessMustBeNumber:"Array accessor must be a number",FunctionNotFound:"Function not found",FieldNotFound:"Key not found - {key}",CircularModules:"Circular module dependencies are not allowed",Cancelled:"Execution cancelled",UnsupportedHashType:"Type not supported in hash function",IllegalResult:"Value is not a supported return type",PortalRequired:"Portal is required",InvalidParameter:"Invalid parameter",WrongNumberOfParameters:"Call with wrong number of parameters",Unrecognized:"Unrecognized code structure",UnrecognizedType:"Unrecognized type",WrongSpatialReference:"Cannot work with geometry in this spatial reference. It is different to the execution spatial reference",BooleanConditionRequired:"Conditions must use booleans",NoFunctionInDictionary:"Dictionaries cannot contain functions.",NoFunctionInArray:"Arrays cannot contain functions.",NoFunctionInTemplateLiteral:"Template Literals do not expect functions by value.",KeyAccessorMustBeString:"Accessor must be a string",KeyMustBeString:"Object keys must be a string",Immutable:"Object is immutable",UnexpectedToken:"Unexpected token",MemberOfNull:"Cannot access property of null object",MaximumCallDepth:"Exceeded maximum function depth",OutOfBounds:"Out of bounds",InvalidIdentifier:"Identifier not recognized",CallNonFunction:"Expression is not a function",InvalidMemberAccessKey:"Cannot access value using a key of this type",AssignModuleFunction:"Cannot assign function to module variable",UnsupportUnaryOperator:"Unsupported unary operator",UnsupportedOperator:"Unsupported operator",LogicalExpressionOnlyBoolean:"Logical expressions must be boolean",LogicExpressionOrAnd:"Logical expression can only be combined with || or &&",CannotChangeTimeZoneTime:"Cannot change the timezone of a Time",CannotChangeTimeZoneDateOnly:"Cannot change the timezone of a DateOnly",FeatureSetDoesNotHaveSubtypes:"FeatureSet does not have subtypes"};class o extends Error{constructor(...e){super(...e)}}class t extends o{constructor(e,r){super(a(r)+e.message,{cause:e}),this.loc=null,Error.captureStackTrace&&Error.captureStackTrace(this,t),r?.loc&&(this.loc=r.loc)}}class n extends Error{constructor(o,t,s,c){super("Execution error - "+a(s)+e(r[t],c)),this.loc=null,this.declaredRootClass="esri.arcade.arcadeexecutionerror",Error.captureStackTrace&&Error.captureStackTrace(this,n),s?.loc&&(this.loc=s.loc)}}function a(e){return e&&e.loc?`Line : ${e.loc.start?.line}, ${e.loc.start?.column}: `:""}class s extends Error{constructor(o,t,n,c){super("Compilation error - "+a(n)+e(r[t],c)),this.loc=null,this.declaredRootClass="esri.arcade.arcadecompilationerror",Error.captureStackTrace&&Error.captureStackTrace(this,s),n?.loc&&(this.loc=n.loc)}}class c extends Error{constructor(){super("Uncompilable code structures"),this.declaredRootClass="esri.arcade.arcadeuncompilableerror",Error.captureStackTrace&&Error.captureStackTrace(this,c)}}function i(e,r,o){return"esri.arcade.arcadeexecutionerror"===o.declaredRootClass||"esri.arcade.arcadecompilationerror"===o.declaredRootClass?null===o.loc&&r?.loc?new t(o,{cause:o}):o:("esri.arcade.featureset.support.featureseterror"===o.declaredRootClass||"esri.arcade.featureset.support.sqlerror"===o.declaredRootClass||o.declaredRootClass,r?.loc?new t(o,{cause:o}):o)}const u={UnrecognizedUri:"Unrecognized uri - {uri}",UnsupportedUriProtocol:"Unrecognized uri protocol"};class l extends Error{constructor(r,o){super(e(u[r],o)),this.declaredRootClass="esri.arcade.arcademoduleerror",Error.captureStackTrace&&Error.captureStackTrace(this,l)}}function d(o,t,n){return"Parsing error - "+a(o)+e(r[t],n)}export{s as ArcadeCompilationError,n as ArcadeExecutionError,c as ArcadeUncompilableError,o as ErrorWithCause,t as LocatableArcadeExecutionError,l as ModuleError,i as ensureArcadeExecutionError,r as executionErrorMessages,u as moduleErrorMessages,d as parsingValidationMessage};
