/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../geometry","../chunks/arcade","../arcade/Dictionary","../arcade/Feature","../chunks/languageUtils","../core/lang","../renderers/visualVariables/support/sizeVariableUtils","../geometry/Point","../geometry/Polygon","../geometry/Polyline","../geometry/Multipoint","../geometry/Extent"],(function(e,t,r,n,i,a,o,u,l,s,c,p,f){"use strict";const y=/^\$(feature|aggregatedFeatures)\./i,d={vars:{$feature:"any",$view:"any"},spatialReference:null};function m(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&")}function S(e){return null==e?null:a.isArray(e)||a.isImmutableArray(e)?"array":a.isDate(e)?"date":a.isString(e)?"text":a.isBoolean(e)?"boolean":a.isNumber(e)?"number":e instanceof n?"dictionary":a.isFeature(e)?"feature":e instanceof l?"point":e instanceof s?"polygon":e instanceof c?"polyline":e instanceof p?"multipoint":e instanceof f?"extent":a.isFeatureSet(e)?"featureSet":a.isFeatureSetCollection(e)?"featureSetCollection":null}function v(e){if(!e)return null;try{return r.parseScript(e)}catch(t){}return null}function x(e,t){const n="string"==typeof e?v(e):e;if(!n)return null;try{return t=t||o.clone(d),r.compileScript(n,t)}catch(i){}return null}function g(e,t){return{vars:{$feature:null==e?new i:i.createFromGraphic(e),$view:t&&t.view},spatialReference:t&&t.sr}}function F(e,t,r){return i.createFromGraphicLikeObject(t,e,r)}function b(e,t){e.vars.$feature=t}function h(e,t){let n;try{n=r.executeScript(e,t)}catch(i){n=null}return n}function E(e,t){let r;try{r=e?e(t):null}catch(n){r=null}return r}function w(e,t){try{return e?e(t):Promise.resolve(null)}catch(r){return Promise.resolve(null)}}function M(e,t){if(!e)return[];const n="string"==typeof e?v(e):e;if(!n)return[];const i=r.extractExpectedFieldLiterals(n);let a=new Array;i.forEach((e=>{y.test(e)&&(e=e.replace(y,""),a.push(e))}));const o=a.filter((e=>e.includes("*")));return a=a.filter((e=>!o.includes(e))),t&&o.forEach((e=>{const r=new RegExp(`^${e.split(/\*+/).map(m).join(".*")}$`,"i");t.forEach((e=>r.test(e)?a.push(e):null))})),[...new Set(a.sort())]}function $(e){return r.referencesMember(e,"$view")}function C(e,t){return!!e&&r.referencesMember(e,t)}function G(e){if(!e||null==e.spatialReference&&(null==e.scale||null==e.viewingMode))return;return{view:e.viewingMode&&null!=e.scale?new n({viewingMode:e.viewingMode,scale:e.scale}):null,sr:e.spatialReference}}function T({url:e,spatialReference:t,lrucache:n,interceptor:i}){const a=r.featureSetUtils();return a?a.createFeatureSetCollectionFromService(e,t,n,i):null}function z({layer:e,spatialReference:t,outFields:n,returnGeometry:i,lrucache:a,interceptor:o}){if(null===e)return null;const u=r.featureSetUtils();return u?u.constructFeatureSet(e,t,n,null==i||i,a,o):null}function R(e){if(null===(null==e?void 0:e.map))return null;const t=r.featureSetUtils();return t?t.createFeatureSetCollectionFromMap(e.map,e.spatialReference,e.lrucache,e.interceptor):null}function V(e,t,n=[]){return r.loadScriptDependencies(e,t,n)}function A(){return r.enableGeometrySupport()}function I(){return r.enableFeatureSetSupport()}function P(e){return"simple"===e.type||"class-breaks"===e.type||"unique-value"===e.type||"dot-density"===e.type||"dictionary"===e.type||"pie-chart"===e.type}function U(e){return"esri.layers.support.LabelClass"===e.declaredClass}function O(e){return"esri.PopupTemplate"===e.declaredClass}function k(e,t){if(!e)return!1;if("string"==typeof e)return t(e);const r=e;if(P(r)){if("dot-density"===r.type){const e=r.attributes.some((e=>t(e.valueExpression)));if(e)return e}const e=r.visualVariables,n=!!e&&e.some((e=>{let r=t(e.valueExpression);return"size"===e.type&&(u.isSizeVariable(e.minSize)&&(r=r||t(e.minSize.valueExpression)),u.isSizeVariable(e.maxSize)&&(r=r||t(e.maxSize.valueExpression))),r}));return!(!("valueExpression"in r)||!t(r.valueExpression))||n}if(U(r)){const e=r.labelExpressionInfo&&r.labelExpressionInfo.expression;return!(!e||!t(e))||!1}return!!O(r)&&(!!r.expressionInfos&&r.expressionInfos.some((e=>t(e.expression)))||Array.isArray(r.content)&&r.content.some((e=>{var r;return"expression"===e.type&&t(null==(r=e.expressionInfo)?void 0:r.expression)})))}function D(e){const t=v(e);return!!t&&r.scriptTouchesGeometry(t)}function L(e){return k(e,D)}function j(e){const t=v(e);return!!t&&r.scriptUsesGeometryEngine(t)}function N(e){return k(e,j)}e.arcade=r.arcade,e.Dictionary=n,e.arcadeFeature=i,e.convertFeatureLayerToFeatureSet=z,e.convertMapToFeatureSetCollection=R,e.convertServiceUrlToWorkspace=T,e.createExecContext=g,e.createFeature=F,e.createFunction=x,e.createSyntaxTree=v,e.dependsOnView=$,e.enableFeatureSetOperations=I,e.enableGeometryOperations=A,e.evalSyntaxTree=h,e.executeAsyncFunction=w,e.executeFunction=E,e.extractFieldNames=M,e.getArcadeType=S,e.getViewInfo=G,e.hasGeometryFunctions=L,e.hasGeometryOperations=N,e.hasVariable=C,e.loadScriptDependencies=V,e.updateExecContext=b,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
