// All material copyright Esri, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.30/esri/copyright.txt for details. //>>built define("exports ../ArcadePortal ../Attachment ../Dictionary ../executionError ../../chunks/languageUtils ../featureset/support/shared ./convertdirection ./hash ../../core/urlUtils ../../core/uuid ../../geometry/Extent ../../geometry/Multipoint ../../geometry/Point ../../geometry/Polygon ../../geometry/Polyline ../../geometry/SpatialReference ../../portal/Portal".split(" "),function(v,u,y,p,l,f,w,z,A,B,t,C,D,E,F,G,H,I){function x(e,g){if(!e||!g)return e===g;if(e.x===g.x&&e.y===g.y){if(e.hasZ){if(e.z!== g.z)return!1}else if(g.hasZ)return!1;if(e.hasM){if(e.m!==g.m)return!1}else if(g.hasM)return!1;return!0}return!1}function n(e,g,c){if(null===e)g.updateUint8Array([0,139]);else if(f.isArray(e)){g.updateUint8Array([61]);if(c.map.has(e))e=c.map.get(e),g.updateIntArray([e^61237541]);else{c.map.set(e,c.currentLength++);for(var d of e)n(d,g,c);c.map.delete(e);c.currentLength--}g.updateUint8Array([199])}else if(f.isImmutableArray(e)){g.updateUint8Array([61]);if(c.map.has(e))e=c.map.get(e),g.updateIntArray([e^ 61237541]);else{c.map.set(e,c.currentLength++);for(var b of e.toArray())n(b,g,c);c.map.delete(e);c.currentLength--}g.updateUint8Array([199])}else if(f.isDate(e))g.updateIntArray([e.toNumber()]),g.updateUint8Array([241]);else if(f.isDateOnly(e))g.updateIntArray([e.toNumber()]),g.updateIntArray([257]);else if(f.isTime(e))g.updateIntArray([e.toNumber()]),g.updateIntArray([263]);else if(f.isString(e))g.updateIntArray([e.length]),g.updateWithString(e),g.updateUint8Array([41]);else if(f.isBoolean(e))g.updateUint8Array([!0=== e?1:0,113]);else if(f.isNumber(e))g.updateFloatArray([e]),g.updateUint8Array([173]);else{if(e instanceof y)throw new l.ArcadeExecutionError(c.context,l.ExecutionErrorCodes.UnsupportedHashType,c.node);if(e instanceof u)throw new l.ArcadeExecutionError(c.context,l.ExecutionErrorCodes.UnsupportedHashType,c.node);if(e instanceof p){g.updateUint8Array([223]);if(c.map.has(e))e=c.map.get(e),g.updateIntArray([e^61237541]);else{c.map.set(e,c.currentLength++);for(var h of e.keys())g.updateIntArray([h.length]), g.updateWithString(h),g.updateUint8Array([251]),d=e.field(h),n(d,g,c),g.updateUint8Array([239]);c.map.delete(e);c.currentLength--}g.updateUint8Array([73])}else{if(f.isFeature(e))throw new l.ArcadeExecutionError(c.context,l.ExecutionErrorCodes.UnsupportedHashType,c.node);if(e instanceof E)g.updateIntArray([3833836621]),g.updateIntArray([0]),g.updateFloatArray([e.x]),g.updateIntArray([1]),g.updateFloatArray([e.y]),e.hasZ&&(g.updateIntArray([2]),g.updateFloatArray([e.z])),e.hasM&&(g.updateIntArray([3]), g.updateFloatArray([e.m])),g.updateIntArray([3765347959]),n(e.spatialReference.wkid,g,c);else if(e instanceof F){g.updateIntArray([1266616829]);for(h=0;h{f.pcCheck(a,1,1,c,d);return new u(f.toString(a[0]))})};e.typeof=function(c,d){return g(c,d,(b,h,a)=>{f.pcCheck(a,1,1,c,d);b=f.getType(a[0]);if("Unrecognized Type"===b)throw new l.ArcadeExecutionError(c,l.ExecutionErrorCodes.UnrecognizedType,d);return b})};e.trim=function(c,d){return g(c, d,(b,h,a)=>{f.pcCheck(a,1,1,c,d);return f.toString(a[0]).trim()})};e.tohex=function(c,d){return g(c,d,(b,h,a)=>{f.pcCheck(a,1,1,c,d);b=f.toNumber(a[0]);return isNaN(b)?b:b.toString(16)})};e.upper=function(c,d){return g(c,d,(b,h,a)=>{f.pcCheck(a,1,1,c,d);return f.toString(a[0]).toUpperCase()})};e.proper=function(c,d){return g(c,d,(b,h,a)=>{f.pcCheck(a,1,2,c,d);b=1;2===a.length&&"firstword"===f.toString(a[1]).toLowerCase()&&(b=2);h=/\s/;a=f.toString(a[0]);let k="",m=!0;for(let q=0;q{f.pcCheck(a,1,1,c,d);return f.toString(a[0]).toLowerCase()})};e.guid=function(c,d){return g(c,d,(b,h,a)=>{f.pcCheck(a,0,1,c,d);if(0{f.pcCheck(a,2,2,c,d);b=f.toString(a[0]);if(""===b||null===b)return"";b=/^(\{|\()?(?[0-9a-z]{8})(-?)(?[0-9a-z]{4})(-?)(?[0-9a-z]{4})(-?)(?[0-9a-z]{4})(-?)(?[0-9a-z]{12})(\}|\))?$/gim.exec(b);if(!b)return"";b=b.groups;b=b.partA+"-"+b.partB+"-"+b.partC+"-"+b.partD+"-"+b.partE;switch(f.toString(a[1]).toLowerCase()){case "digits":return b.replace("-","").replace("-", "").replace("-","").replace("-","");case "digits-hyphen":return b;case "digits-hyphen-parentheses":return"("+b+")"}return"{"+b+"}"})};e.console=function(c,d){return g(c,d,(b,h,a)=>{0!==a.length&&(1===a.length?c.console(f.toString(a[0])):c.console(f.toString(a)));return f.voidOperation})};e.mid=function(c,d){return g(c,d,(b,h,a)=>{f.pcCheck(a,2,3,c,d);b=f.toNumber(a[1]);if(isNaN(b))return"";0>b&&(b=0);if(2===a.length)return f.toString(a[0]).substr(b);h=f.toNumber(a[2]);if(isNaN(h))return"";0>h&&(h= 0);return f.toString(a[0]).substr(b,h)})};e.find=function(c,d){return g(c,d,(b,h,a)=>{f.pcCheck(a,2,3,c,d);b=0;if(2b&&(b=0)}return f.toString(a[1]).indexOf(f.toString(a[0]),b)})};e.left=function(c,d){return g(c,d,(b,h,a)=>{f.pcCheck(a,2,2,c,d);b=f.toNumber(a[1]);if(isNaN(b))return"";0>b&&(b=0);return f.toString(a[0]).substr(0,b)})};e.right=function(c,d){return g(c,d,(b,h,a)=>{f.pcCheck(a,2,2,c,d);b=f.toNumber(a[1]);if(isNaN(b))return""; 0>b&&(b=0);return f.toString(a[0]).substr(-1*b,b)})};e.split=function(c,d){return g(c,d,(b,h,a)=>{f.pcCheck(a,2,4,c,d);b=f.toNumber(f.defaultUndefined(a[2],-1));h=f.toBoolean(f.defaultUndefined(a[3],!1));-1===b||null===b||!0===h?a=f.toString(a[0]).split(f.toString(a[1])):(isNaN(b)&&(b=-1),-1>b&&(b=-1),a=f.toString(a[0]).split(f.toString(a[1]),b));if(!1===h)return a;h=[];for(let k=0;k=b);k++)""!==a[k]&&void 0!==a[k]&&h.push(a[k]);return h})};e.text=function(c,d){return g(c, d,(b,h,a)=>{f.pcCheck(a,1,2,c,d);return f.toStringExplicit(a[0],a[1])})};e.concatenate=function(c,d){return g(c,d,(b,h,a)=>{b=[];if(1>a.length)return"";if(f.isArray(a[0])){h=f.defaultUndefined(a[2],"");for(var k=0;k{f.pcCheck(a,1,1,c,d);if(f.isArray(a[0]))return b=a[0].slice(0),b.reverse(),b;if(f.isImmutableArray(a[0]))return b=a[0].toArray().slice(0),b.reverse(),b;throw new l.ArcadeExecutionError(c,l.ExecutionErrorCodes.InvalidParameter,d);})};e.replace=function(c,d){return g(c,d,(b,h,a)=>{f.pcCheck(a,3,4,c,d);b=f.toString(a[0]);h=f.toString(a[1]);const k=f.toString(a[2]);return(4===a.length?f.toBoolean(a[3]):1)?f.multiReplace(b, h,k):b.replace(h,k)})};e.schema=function(c,d){return g(c,d,(b,h,a)=>{if(f.isFeature(a[0]))return(b=f.featureSchema(a[0]))?p.convertObjectToArcadeDictionary(b,f.defaultTimeZone(c)):null;throw new l.ArcadeExecutionError(c,l.ExecutionErrorCodes.InvalidParameter,d);})};e.subtypes=function(c,d){return g(c,d,(b,h,a)=>{f.pcCheck(a,1,1,c,d);if(f.isFeature(a[0]))return(b=f.featureSubtypes(a[0]))?p.convertObjectToArcadeDictionary(b,f.defaultTimeZone(c)):null;throw new l.ArcadeExecutionError(c,l.ExecutionErrorCodes.InvalidParameter, d);})};e.subtypecode=function(c,d){return g(c,d,(b,h,a)=>{f.pcCheck(a,1,1,c,d);if(f.isFeature(a[0])){b=f.featureSubtypes(a[0]);if(!b)return null;if(b.subtypeField&&a[0].hasField(b.subtypeField)){a=a[0].field(b.subtypeField);for(const k of b.subtypes)if(k.code===a)return k.code}return null}throw new l.ArcadeExecutionError(c,l.ExecutionErrorCodes.InvalidParameter,d);})};e.subtypename=function(c,d){return g(c,d,(b,h,a)=>{f.pcCheck(a,1,1,c,d);if(f.isFeature(a[0])){b=f.featureSubtypes(a[0]);if(!b)return""; if(b.subtypeField&&a[0].hasField(b.subtypeField)){a=a[0].field(b.subtypeField);for(const k of b.subtypes)if(k.code===a)return k.name}return""}throw new l.ArcadeExecutionError(c,l.ExecutionErrorCodes.InvalidParameter,d);})};e.gdbversion=function(c,d){return g(c,d,(b,h,a)=>{f.pcCheck(a,1,1,c,d);if(f.isFeature(a[0]))return a[0].gdbVersion();throw new l.ArcadeExecutionError(c,l.ExecutionErrorCodes.InvalidParameter,d);})};e.domain=function(c,d){return g(c,d,(b,h,a)=>{f.pcCheck(a,2,3,c,d);if(f.isFeature(a[0]))return(b= f.featureFullDomain(a[0],f.toString(a[1]),void 0===a[2]?void 0:a[2]))&&b.domain?"coded-value"===b.domain.type||"codedValue"===b.domain.type?p.convertObjectToArcadeDictionary({type:"codedValue",name:b.domain.name,dataType:w.layerFieldEsriConstants[b.field.type],codedValues:b.domain.codedValues.map(k=>({name:k.name,code:k.code}))},f.defaultTimeZone(c)):p.convertObjectToArcadeDictionary({type:"range",name:b.domain.name,dataType:w.layerFieldEsriConstants[b.field.type],min:b.domain.minValue,max:b.domain.maxValue}, f.defaultTimeZone(c)):null;throw new l.ArcadeExecutionError(c,l.ExecutionErrorCodes.InvalidParameter,d);})};e.domainname=function(c,d){return g(c,d,(b,h,a)=>{f.pcCheck(a,2,4,c,d);if(f.isFeature(a[0]))return f.featureDomainValueLookup(a[0],f.toString(a[1]),a[2],void 0===a[3]?void 0:a[3]);throw new l.ArcadeExecutionError(c,l.ExecutionErrorCodes.InvalidParameter,d);})};e.domaincode=function(c,d){return g(c,d,(b,h,a)=>{f.pcCheck(a,2,4,c,d);if(f.isFeature(a[0]))return f.featureDomainCodeLookup(a[0],f.toString(a[1]), a[2],void 0===a[3]?void 0:a[3]);throw new l.ArcadeExecutionError(c,l.ExecutionErrorCodes.InvalidParameter,d);})};e.urlencode=function(c,d){return g(c,d,(b,h,a)=>{f.pcCheck(a,1,1,c,d);if(null===a[0])return"";if(a[0]instanceof p){b="";for(const k of a[0].keys())h=a[0].field(k),""!==b&&(b+="\x26"),b=null===h?b+(encodeURIComponent(k)+"\x3d"):b+(encodeURIComponent(k)+"\x3d"+encodeURIComponent(h));return b}return encodeURIComponent(f.toString(a[0]))})};e.hash=function(c,d){return g(c,d,(b,h,a)=>{f.pcCheck(a, 1,1,c,d);b=new A.XXH(0);n(a[0],b,{context:c,node:d,map:new Map,currentLength:0});return b.digest()})};e.convertdirection=function(c,d){return g(c,d,(b,h,a)=>{f.pcCheck(a,3,3,c,d);return z.convertDirection(a[0],a[1],a[2])})};e.fromjson=function(c,d){return g(c,d,(b,h,a)=>{f.pcCheck(a,1,1,c,d);if(!1===f.isString(a[0]))throw new l.ArcadeExecutionError(c,l.ExecutionErrorCodes.InvalidParameter,d);return p.convertJsonToArcade(JSON.parse(f.toString(a[0])),f.defaultTimeZone(c))})};e.expects=function(c,d){return g(c, d,(b,h,a)=>{if(1>a.length)throw new l.ArcadeExecutionError(c,l.ExecutionErrorCodes.WrongNumberOfParameters,d);return f.voidOperation})};e.tocharcode=function(c,d){return g(c,d,(b,h,a)=>{f.pcCheck(a,1,2,c,d);b=f.toNumber(f.defaultUndefined(a[1],0));h=f.toString(a[0]);if(0===h.length&&1===a.length)return null;if(h.length<=b||0>b)throw new l.ArcadeExecutionError(c,l.ExecutionErrorCodes.OutOfBounds,d);return h.charCodeAt(b)})};e.tocodepoint=function(c,d){return g(c,d,(b,h,a)=>{f.pcCheck(a,1,2,c,d);b= f.toNumber(f.defaultUndefined(a[1],0));h=f.toString(a[0]);if(0===h.length&&1===a.length)return null;if(h.length<=b||0>b)throw new l.ArcadeExecutionError(c,l.ExecutionErrorCodes.OutOfBounds,d);return h.codePointAt(b)})};e.fromcharcode=function(c,d){return g(c,d,(b,h,a)=>{if(1>a.length)throw new l.ArcadeExecutionError(c,l.ExecutionErrorCodes.WrongNumberOfParameters,d);b=a.map(k=>Math.trunc(f.toNumber(k))).filter(k=>0<=k&&65535>=k);return 0===b.length?null:String.fromCharCode.apply(null,b)})};e.fromcodepoint= function(c,d){return g(c,d,(b,h,a)=>{if(1>a.length)throw new l.ArcadeExecutionError(c,l.ExecutionErrorCodes.WrongNumberOfParameters,d);let k;try{k=a.map(m=>Math.trunc(f.toNumber(m))).filter(m=>1114111>=m&&m>>>0===m)}catch(m){return null}return 0===k.length?null:String.fromCodePoint.apply(null,k)})};e.getuser=function(c,d){return g(c,d,(b,h,a)=>{f.pcCheck(a,0,2,c,d);b=f.defaultUndefined(a[1],"");b=!0===b||!1===b?"":f.toString(b);if(null!==b&&""!==b)return null;if(0===a.length||a[0]instanceof u){h= null;h=c.services?.portal?c.services.portal:I.getDefault();if(0{f.pcCheck(a,0,0,c,d);return p.convertObjectToArcadeDictionary(f.defaultExecutingContext(f.defaultTimeZone(c),c.spatialReference),f.defaultTimeZone(c),!0)})}};Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})});