/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{replace as e}from"../core/string.js";const o={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"};function n(e){return"object"==typeof e&&"line"in e&&"column"in e&&"number"==typeof e.line&&"number"==typeof e.column}function r(e){if(e instanceof Error&&"loc"in e){const o=e.loc;return null==o||"object"==typeof o&&"start"in o&&null!=o.start&&n(o.start)&&(!("end"in o)||null==o.end||n(o.end))}return!1}class t extends Error{constructor(e,o){super(a(o)+("object"==typeof e&&null!=e&&"message"in e?e.message:""),{cause:e}),this.loc=o?.loc??null}}class s extends Error{constructor(n,r,t){super("Execution error - "+a(r)+e(o[n],t)),this.declaredRootClass="esri.arcade.arcadeexecutionerror",this.loc=r?.loc??null}}function a(e){return null==e?.loc?"":`Line ${e.loc.start.line}:${e.loc.start.column}: `}class i extends Error{constructor(n,r,t){super("Compilation error - "+a(r)+e(o[n],t)),this.declaredRootClass="esri.arcade.arcadecompilationerror",this.loc=r?.loc??null}}class c extends Error{constructor(){super("Uncompilable code structures"),this.declaredRootClass="esri.arcade.arcadeuncompilableerror"}}function u(e,o){return!r(e)||null==e.loc&&null!=o?.loc?new t(e,o):e}const l={UnrecognizedUri:"Unrecognized uri - {uri}",UnsupportedUriProtocol:"Unrecognized uri protocol"};class d extends Error{constructor(o,n){super(e(l[o],n)),this.declaredRootClass="esri.arcade.arcademoduleerror"}}export{i as ArcadeCompilationError,s as ArcadeExecutionError,c as ArcadeUncompilableError,t as LocatableArcadeExecutionError,d as ModuleError,u as ensureLocatableError,o as executionErrorMessages,l as moduleErrorMessages};
