(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-f09b0350"],{"1ec3":function(e,t,i){"use strict";i.d(t,"a",(function(){return d})),i.d(t,"b",(function(){return p})),i.d(t,"c",(function(){return b}));var s=i("b2b2"),n=i("8188"),r=i("d641"),a=i("7f83"),o=i("9786");const l=[0,0];function u(e,t){if(!t)return null;if("x"in t){const i={x:0,y:0};return[i.x,i.y]=e(t.x,t.y,l),null!=t.z&&(i.z=t.z),null!=t.m&&(i.m=t.m),i}if("xmin"in t){const i={xmin:0,ymin:0,xmax:0,ymax:0};return[i.xmin,i.ymin]=e(t.xmin,t.ymin,l),[i.xmax,i.ymax]=e(t.xmax,t.ymax,l),t.hasZ&&(i.zmin=t.zmin,i.zmax=t.zmax,i.hasZ=!0),t.hasM&&(i.mmin=t.mmin,i.mmax=t.mmax,i.hasM=!0),i}return"rings"in t?{rings:c(t.rings,e),hasM:t.hasM,hasZ:t.hasZ}:"paths"in t?{paths:c(t.paths,e),hasM:t.hasM,hasZ:t.hasZ}:"points"in t?{points:h(t.points,e),hasM:t.hasM,hasZ:t.hasZ}:void 0}function c(e,t){const i=[];for(const s of e)i.push(h(s,t));return i}function h(e,t){const i=[];for(const s of e){const e=t(s[0],s[1],[0,0]);i.push(e),s.length>2&&e.push(s[2]),s.length>3&&e.push(s[3])}return i}async function d(e,t){if(!t)return;const i=Array.isArray(e)?e.map(e=>Object(s["k"])(e.geometry)&&e.geometry.spatialReference):[e];await Object(n["g"])(i.map(e=>({source:e,dest:t})))}const f=u.bind(null,o["c"]),m=u.bind(null,o["g"]);function p(e,t,i){if(!e)return e;if(i||(i=t,t=e.spatialReference),!Object(a["l"])(t)||!Object(a["l"])(i)||Object(a["d"])(t,i))return e;if(Object(o["a"])(t,i)){const t=Object(a["p"])(i)?f(e):m(e);return t.spatialReference=i,t}return Object(n["r"])(r["a"],[e],t,i,null)[0]}class y{constructor(){this._jobs=[],this._timer=null,this._process=this._process.bind(this)}async push(e,t,i){if(!e||!e.length||!t||!i||Object(a["d"])(t,i))return e;const s={geometries:e,inSpatialReference:t,outSpatialReference:i,resolve:null};return this._jobs.push(s),new Promise(e=>{s.resolve=e,null===this._timer&&(this._timer=setTimeout(this._process,10))})}_process(){this._timer=null;const e=this._jobs.shift();if(!e)return;const{geometries:t,inSpatialReference:i,outSpatialReference:s,resolve:l}=e;Object(o["a"])(i,s)?Object(a["p"])(s)?l(t.map(f)):l(t.map(m)):l(Object(n["r"])(r["a"],t,i,s,null)),this._jobs.length>0&&(this._timer=setTimeout(this._process,10))}}const g=new y;function b(e,t,i){return g.push(e,t,i)}},"1eef":function(e,t,i){"use strict";i.d(t,"a",(function(){return m})),i.d(t,"b",(function(){return _})),i.d(t,"c",(function(){return j})),i.d(t,"d",(function(){return I})),i.d(t,"e",(function(){return O})),i.d(t,"f",(function(){return x}));var s=i("fa8a"),n=i("b2b2"),r=i("8048"),a=i("f8d4"),o=i("a9ab"),l=i("a8d5"),u=i("7f83"),c=(i("d97e"),i("6655")),h=i("8152"),d=i("1ec3");const f=new s["a"]({esriSRUnit_Meter:"meters",esriSRUnit_Kilometer:"kilometers",esriSRUnit_Foot:"feet",esriSRUnit_StatuteMile:"miles",esriSRUnit_NauticalMile:"nautical-miles",esriSRUnit_USNauticalMile:"us-nautical-miles"}),m=Object.freeze({}),p=new h["a"],y=new h["a"],g=new h["a"],b={esriGeometryPoint:c["n"],esriGeometryPolyline:c["p"],esriGeometryPolygon:c["o"],esriGeometryMultipoint:c["m"]};function x(e,t,i,s=e.hasZ,r=e.hasM){if(Object(n["j"])(t))return null;const a=e.hasZ&&s,o=e.hasM&&r;if(i){const n=Object(c["v"])(g,t,e.hasZ,e.hasM,"esriGeometryPoint",i,s,r);return Object(c["n"])(n,a,o)}return Object(c["n"])(t,a,o)}function j(e,t,i,s,r,a,o=t,l=i){const u=t&&o,h=i&&l,d=Object(n["k"])(s)?"coords"in s?s:s.geometry:null;if(Object(n["j"])(d))return null;if(r){let s=Object(c["r"])(y,d,t,i,e,r,o,l);return a&&(s=Object(c["v"])(g,s,u,h,e,a)),b[e](s,u,h)}if(a){const s=Object(c["v"])(g,d,t,i,e,a,o,l);return b[e](s,u,h)}return Object(c["y"])(p,d,t,i,o,l),b[e](p,u,h)}async function I(e,t,i){const{outFields:s,orderByFields:n,groupByFieldsForStatistics:r,outStatistics:a}=e;if(s)for(let o=0;oObject(d["b"])(t,u["b"]));return(await v())(o.spatialReference,o,i,a)}async function v(){return(await Promise.all([i.e("chunk-2d22cf8c"),i.e("chunk-180660b2")]).then(i.bind(null,"00ac"))).geodesicBuffer}function _(e){return e&&w in e?JSON.parse(JSON.stringify(e,F)):e}const w="_geVersion",F=(e,t)=>e!==w?t:void 0},"2a5b":function(e,t,i){"use strict";i.d(t,"a",(function(){return F})),i.d(t,"b",(function(){return w})),i.d(t,"c",(function(){return _}));var s=i("ce50"),n=i("2172"),r=i("f547");function a(e){return"mesh"===e?r["a"]:Object(r["c"])(e)}var o=i("a9ab"),l=i("7f83");function u(e,t){return e?t?4:3:t?3:2}function c(e,t,i,s){return d(e,t,i,s.coords[0],s.coords[1])}function h(e,t,i,s,n,r){const a=u(n,r),{coords:o,lengths:l}=s;if(!l)return!1;for(let u=0,c=0;u=a||d=a)&&e+(a-n)/(d-n)*(h-e)c(e,!1,!1,t))}if(Object(o["g"])(t)&&"esriGeometryMultipoint"===i){const i=Object(m["h"])(new p["a"],t,!1,!1);if("esriSpatialRelContains"===e)return Promise.resolve(e=>h(i,!1,!1,e,s,r))}if(Object(o["d"])(t)&&"esriGeometryPoint"===i&&("esriSpatialRelIntersects"===e||"esriSpatialRelContains"===e))return Promise.resolve(e=>Object(n["e"])(t,Object(g["c"])(i,s,r,e)));if(Object(o["d"])(t)&&"esriGeometryMultipoint"===i&&"esriSpatialRelContains"===e)return Promise.resolve(e=>Object(n["d"])(t,Object(g["c"])(i,s,r,e)));if(Object(o["d"])(t)&&"esriSpatialRelIntersects"===e){const e=a(i);return Promise.resolve(n=>e(t,Object(g["c"])(i,s,r,n)))}return v().then(n=>{const a=n[x[e]].bind(null,t.spatialReference,t);return e=>a(Object(g["c"])(i,s,r,e))})}async function w(e,t,i){const{spatialRel:n,geometry:r}=e;if(r){if(!I(n))throw new s["a"](b,"Unsupported query spatial relationship",{query:e});if(Object(l["l"])(r.spatialReference)&&Object(l["l"])(i)){if(!O(r))throw new s["a"](b,"Unsupported query geometry type",{query:e});if(!S(t))throw new s["a"](b,"Unsupported layer geometry type",{query:e});if(e.outSR)return Object(y["a"])(e.geometry&&e.geometry.spatialReference,e.outSR)}}}function F(e){if(Object(o["d"])(e))return!0;if(Object(o["g"])(e)){for(const t of e.rings){if(5!==t.length)return!1;if(t[0][0]!==t[1][0]||t[0][0]!==t[4][0]||t[2][0]!==t[3][0]||t[0][1]!==t[3][1]||t[0][1]!==t[4][1]||t[1][1]!==t[2][1])return!1}return!0}return!1}},"55cd":function(e,t,i){"use strict";i.d(t,"a",(function(){return v})),i.d(t,"b",(function(){return R})),i.d(t,"c",(function(){return p})),i.d(t,"d",(function(){return m})),i.d(t,"e",(function(){return f})),i.d(t,"f",(function(){return I})),i.d(t,"g",(function(){return O})),i.d(t,"h",(function(){return y})),i.d(t,"i",(function(){return S})),i.d(t,"j",(function(){return d})),i.d(t,"k",(function(){return j})),i.d(t,"l",(function(){return F}));var s=i("f61c"),n=i("87a0");const r="equal-interval",a=1,o=5,l=10,u=/\s*(\+|-)?((\d+(\.\d+)?)|(\.\d+))\s*/gi,c=new Set(["esriFieldTypeInteger","esriFieldTypeSmallInteger","esriFieldTypeSingle","esriFieldTypeDouble"]),h=["min","max","avg","stddev","count","sum","variance","nullcount","median"];function d(e){const t=null!=e.normalizationField||null!=e.normalizationType,i=null!=e.minValue||null!=e.maxValue,s=!!e.sqlExpression&&e.supportsSQLExpression;return!t&&!i&&!s}function f(e){const t=e.returnDistinct?[...new Set(e.values)]:e.values,i=t.filter(e=>null!=e).length,s={count:i};return e.supportsNullCount&&(s.nullcount=t.length-i),e.percentileParams&&(s.median=p(t,e.percentileParams)),s}function m(e){const{values:t,useSampleStdDev:i,supportsNullCount:s}=e;let n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,a=null,o=null,l=null,u=null,c=0;const h=null==e.minValue?-1/0:e.minValue,d=null==e.maxValue?1/0:e.maxValue;for(const m of t)Number.isFinite(m)?m>=h&&m<=d&&(a+=m,n=Math.min(n,m),r=Math.max(r,m),c++):"string"==typeof m&&c++;if(c&&null!=a){o=a/c;let e=0;for(const i of t)Number.isFinite(i)&&i>=h&&i<=d&&(e+=(i-o)**2);u=i?c>1?e/(c-1):0:c>0?e/c:0,l=Math.sqrt(u)}else n=null,r=null;const f={avg:o,count:c,max:r,min:n,stddev:l,sum:a,variance:u};return s&&(f.nullcount=t.length-c),e.percentileParams&&(f.median=p(t,e.percentileParams)),f}function p(e,t){const{fieldType:i,value:s,orderBy:n,isDiscrete:r}=t,a=y(i,"desc"===n);if(0===(e=[...e].filter(e=>null!=e).sort((e,t)=>a(e,t))).length)return null;if(s<=0)return e[0];if(s>=1)return e[e.length-1];const o=(e.length-1)*s,l=Math.floor(o),u=l+1,c=o%1,h=e[l],d=e[u];return u>=e.length||r||"string"==typeof h||"string"==typeof d?h:h*(1-c)+d*c}function y(e,t){const i=t?1:-1,s=b(t),n=g(t);if(!e||!["esriFieldTypeDate","esriFieldTypeString","esriFieldTypeGUID","esriFieldTypeGlobalID",...c].includes(e))return(e,t)=>"number"==typeof e&&"number"==typeof t?s(e,t):"string"==typeof e&&"string"==typeof t?n(e,t):i;if("esriFieldTypeDate"===e)return(e,t)=>{const n=new Date(e).getTime(),r=new Date(t).getTime();return isNaN(n)||isNaN(r)?i:s(n,r)};if(c.has(e))return(e,t)=>s(e,t);if("esriFieldTypeString"===e)return(e,t)=>n(e,t);if("esriFieldTypeGUID"===e||"esriFieldTypeGlobalID"===e){const e=g(t);return(t,i)=>e(x(t),x(i))}return t?(e,t)=>1:(e,t)=>-1}function g(e){return e?(e,t)=>{var i,s;return(e=null==(i=e)?void 0:i.toUpperCase())>(t=null==(s=t)?void 0:s.toUpperCase())?-1:e{var i,s;return(e=null==(i=e)?void 0:i.toUpperCase())<(t=null==(s=t)?void 0:s.toUpperCase())?-1:e>t?1:0}}function b(e){return e?(e,t)=>t-e:(e,t)=>e-t}function x(e){return e.substr(24,12)+e.substr(19,4)+e.substr(16,2)+e.substr(14,2)+e.substr(11,2)+e.substr(9,2)+e.substr(6,2)+e.substr(4,2)+e.substr(2,2)+e.substr(0,2)}function j(e,t){let i;for(i in e)h.indexOf(i)>-1&&(Number.isFinite(e[i])||(e[i]=null));return t?(["avg","stddev","variance"].forEach(t=>{null!=e[t]&&(e[t]=Math.ceil(e[t]))}),e):e}function I(e){const t={};for(let i of e)(null==i||"string"==typeof i&&""===i.trim())&&(i=null),null==t[i]?t[i]={count:1,data:i}:t[i].count++;return{count:t}}function O(e,t,i){const s=e.count,n=[];i&&t&&"coded-value"===t.type&&t.codedValues.forEach(e=>{const t=e.code;s.hasOwnProperty(t)||(s[t]={data:t,count:0})});for(const r in s){const e=s[r];n.push({value:e.data,count:e.count,label:e.label})}return{uniqueValueInfos:n}}function S(e,t,i,s){let n=null;switch(t){case"log":0!==e&&(n=Math.log(e)*Math.LOG10E);break;case"percent-of-total":Number.isFinite(s)&&0!==s&&(n=e/s*100);break;case"field":Number.isFinite(i)&&0!==i&&(n=e/i);break;case"natural-log":e>0&&(n=Math.log(e));break;case"square-root":e>0&&(n=e**.5)}return n}function v(e,t){const i=w({field:t.field,normalizationType:t.normalizationType,normalizationField:t.normalizationField,classificationMethod:t.classificationMethod,standardDeviationInterval:t.standardDeviationInterval,breakCount:t.numClasses||o});return e=_(e,t.minValue,t.maxValue),Object(n["a"])({definition:i,values:e,normalizationTotal:t.normalizationTotal})}function _(e,t,i){return t=null==t?-1/0:t,i=null==i?1/0:i,e.filter(e=>Number.isFinite(e)&&e>=t&&e<=i)}function w(e){const t=e.field,i=e.classificationMethod||r,n=e.normalizationType,o=e.normalizationField,l=new s["a"];return l.classificationField=t,l.breakCount=e.breakCount,l.classificationMethod=i,l.standardDeviationInterval="standard-deviation"===i?e.standardDeviationInterval||a:void 0,l.normalizationType=n,l.normalizationField="field"===n?o:void 0,l}function F(e,t){let i=e.classBreaks;const s=i.length,n=i[0].minValue,r=i[s-1].maxValue,a="standard-deviation"===t,o=u;return i=i.map(e=>{const t=e.label,i={minValue:e.minValue,maxValue:e.maxValue,label:t};if(a&&t){const e=t.match(o).map(e=>+e.trim());2===e.length?(i.minStdDev=e[0],i.maxStdDev=e[1],e[0]<0&&e[1]>0&&(i.hasAvg=!0)):1===e.length&&(t.includes("<")?(i.minStdDev=null,i.maxStdDev=e[0]):t.includes(">")&&(i.minStdDev=e[0],i.maxStdDev=null))}return i}),{minValue:n,maxValue:r,classBreakInfos:i,normalizationTotal:e.normalizationTotal}}function R(e,t){const{min:i,max:s,intervals:n}=T(e,t),r=n.map((e,t)=>({minValue:n[t][0],maxValue:n[t][1],count:0}));for(const a of e)if(null!=a&&a>=i&&a<=s){const e=V(n,a);e>-1&&r[e].count++}return{bins:r,minValue:i,maxValue:s,normalizationTotal:t.normalizationTotal}}function T(e,t){const{field:i,classificationMethod:s,standardDeviationInterval:n,normalizationType:r,normalizationField:a,normalizationTotal:o,minValue:u,maxValue:c}=t,h=t.numBins||l;let f=null,p=null,y=null;if(s&&"equal-interval"!==s||r){const{classBreaks:t}=v(e,{field:i,normalizationType:r,normalizationField:a,normalizationTotal:o,classificationMethod:s,standardDeviationInterval:n,minValue:u,maxValue:c,numClasses:h});f=t[0].minValue,p=t[t.length-1].maxValue,y=t.map(e=>[e.minValue,e.maxValue])}else{if(null!=u&&null!=c)f=u,p=c;else{const t=m({values:e,minValue:u,maxValue:c,useSampleStdDev:!r,supportsNullCount:d({normalizationType:r,normalizationField:a,minValue:u,maxValue:c})});f=t.min,p=t.max}y=z(f,p,h)}return{min:f,max:p,intervals:y}}function V(e,t){let i=-1;for(let s=e.length-1;s>=0;s--)if(t>=e[s][0]){i=s;break}return i}function z(e,t,i){const s=(t-e)/i,n=[];let r,a=e;for(let o=1;o<=i;o++)r=a+s,r=Number(r.toFixed(16)),n.push([a,o===i?t:r]),a=r;return n}},6411:function(e,t,i){"use strict";i.d(t,"a",(function(){return W}));var s=i("ce50"),n=i("7ffa"),r=i("b2b2"),a=i("aefa"),o=i("8048"),l=i("4261"),u=i("9180"),c=i("28b1"),h=i("a9ab"),d=i("a8d5"),f=i("7f83"),m=i("d7f2"),p=i("66a2");class y{constructor(e,t){this._cache=new m["a"](e),this._invalidCache=new m["a"](t)}get(e,t){const i=`${t.uid}:${e}`,s=this._cache.get(i);if(s)return s;if(void 0!==this._invalidCache.get(i))return null;try{const s=p["WhereClause"].create(e,t);return this._cache.put(i,s),s}catch{return this._invalidCache.put(i,null),null}}}const g=new y(50,500),b="feature-store:unsupported-query",x=" as ",j=new Set(["esriFieldTypeOID","esriFieldTypeSmallInteger","esriFieldTypeInteger","esriFieldTypeSingle","esriFieldTypeDouble","esriFieldTypeLong","esriFieldTypeDate"]);function I(e,t){if(!t)return!0;const i=g.get(t,e);if(!i)throw new s["a"](b,"invalid SQL expression",{where:t});if(!i.isStandardized)throw new s["a"](b,"where clause is not standard",{where:t});return v(e,i.fieldNames,"where clause contains missing fields"),!0}function O(e,t,i){if(!t)return!0;const n=g.get(t,e);if(!n)throw new s["a"](b,"invalid SQL expression",{having:t});if(!n.isAggregate)throw new s["a"](b,"having does not contain a valid aggregate function",{having:t});const r=n.fieldNames;if(v(e,r,"having contains missing fields"),!n.getExpressions().every(t=>{const{aggregateType:s,field:n}=t,r=e.has(n)&&e.get(n).name;return i.some(t=>{const{onStatisticField:i,statisticType:n}=t;return(e.has(i)&&e.get(i).name)===r&&n.toLowerCase().trim()===s})}))throw new s["a"](b,"expressions in having should also exist in outStatistics",{having:t});return!0}function S(e,t){return e?g.get(e,t):null}function v(e,t,i,n=!0){const r=[];for(const o of t)if("*"!==o&&!e.has(o))if(n){const t=_(o);try{const i=S(t,e);if(!i)throw new s["a"](b,"invalid SQL expression",{where:t});if(!i.isStandardized)throw new s["a"](b,"expression is not standard",{clause:i});v(e,i.fieldNames,"expression contains missing fields")}catch(a){const e=a&&a.details;if(e&&(e.clause||e.where))throw a;e&&e.missingFields?r.push(...e.missingFields):r.push(o)}}else r.push(o);if(r.length)throw new s["a"](b,i,{missingFields:r})}function _(e){return e.split(x)[0]}function w(e){return e.split(x)[1]}function F(e,t){const i=t.get(e);return!!i&&!j.has(i.type)}var R=i("1ec3"),T=i("a94c"),V=i("57e5"),z=i("f8d4"),M=i("008c"),E=i("6655"),N=i("55cd");class A{constructor(e,t,i){this._fieldDataCache=new Map,this._returnDistinctMap=new Map,this.returnDistinctValues=e.returnDistinctValues,this.fieldsIndex=i,this.featureAdapter=t;const s=e.outFields;if(s&&-1===s.indexOf("*")){this.outFields=s;let e=0;for(const t of s){const s=_(t),n=this.fieldsIndex.get(s),r=n?null:S(s,i),a=n?n.name:w(t)||"FIELD_EXP_"+e++;this._fieldDataCache.set(t,{alias:a,clause:r})}}}countDistinctValues(e){return this.returnDistinctValues?(e.forEach(e=>this.getAttributes(e)),this._returnDistinctMap.size):e.length}getAttributes(e){const t=this._processAttributesForOutFields(e);return this._processAttributesForDistinctValues(t)}getFieldValue(e,t,i){const s=i?i.name:t;let n=null;return this._fieldDataCache.has(s)?n=this._fieldDataCache.get(s).clause:i||(n=S(t,this.fieldsIndex),this._fieldDataCache.set(s,{alias:s,clause:n})),i?this.featureAdapter.getAttribute(e,s):n.calculateValue(e,this.featureAdapter)}getNormalizedValue(e,t){const i=t.normalizationType,s=t.normalizationTotal;let n=this.getFieldValue(e,t.field,t.fieldInfo);if(i&&Number.isFinite(n)){const r=this.getFieldValue(e,t.normalizationField,t.normalizationFieldInfo);n=Object(N["i"])(n,i,r,s)}return n}getExpressionValue(e,t,i){const s={attributes:this.featureAdapter.getAttributes(e)},n=i.createExecContext(s,t.viewInfo);return i.executeFunction(t.compiledFunc,n)}validateItem(e,t){return this._fieldDataCache.has(t)||this._fieldDataCache.set(t,{alias:t,clause:S(t,this.fieldsIndex)}),this._fieldDataCache.get(t).clause.testFeature(e,this.featureAdapter)}validateItems(e,t){return this._fieldDataCache.has(t)||this._fieldDataCache.set(t,{alias:t,clause:S(t,this.fieldsIndex)}),this._fieldDataCache.get(t).clause.testSet(e,this.featureAdapter)}_processAttributesForOutFields(e){const t=this.outFields;if(!t||!t.length)return this.featureAdapter.getAttributes(e);const i={};for(const s of t){const{alias:t,clause:n}=this._fieldDataCache.get(s);i[t]=n?n.calculateValue(e,this.featureAdapter):this.featureAdapter.getAttribute(e,t)}return i}_processAttributesForDistinctValues(e){if(Object(r["j"])(e)||!this.returnDistinctValues)return e;const t=this.outFields,i=[];if(t)for(const r of t){const{alias:t}=this._fieldDataCache.get(r);i.push(e[t])}else for(const r in e)i.push(e[r]);const s=`${(t||["*"]).join(",")}=${i.join(",")}`;let n=this._returnDistinctMap.get(s)||0;return this._returnDistinctMap.set(s,++n),n>1?null:e}}var C,Q=i("abb8"),P=i("1eef"),G=i("c1da"),D=i("82fa");class k{constructor(e,t,i){this.items=e,this.queryGeometry=t,this.definitionExpression=i.definitionExpression,this.geometryType=i.geometryType,this.hasM=i.hasM,this.hasZ=i.hasZ,this.objectIdField=i.objectIdField,this.spatialReference=i.spatialReference,this.fieldsIndex=i.fieldsIndex,this.timeInfo=i.timeInfo,this.featureAdapter=i.featureAdapter,this.aggregateAdapter=i.aggregateAdapter}get size(){return this.items.length}createQueryResponseForCount(e){const t=new A(e,this.featureAdapter,this.fieldsIndex);if(!e.outStatistics)return t.countDistinctValues(this.items);const{groupByFieldsForStatistics:i,having:s}=e;if(!(null==i?void 0:i.length))return 1;const n=new Map,r=new Map,a=new Set,o=e.outStatistics;for(const l of o){const{statisticType:e}=l,o="exceedslimit"!==e?l.onStatisticField:void 0;if(!r.has(o)){const e=[];for(const s of i){const i=this._getAttributeValues(t,s,n);e.push(i)}r.set(o,this._calculateUniqueValues(e,t.returnDistinctValues))}const u=r.get(o);for(const i in u){const{data:e,items:n}=u[i],r=e.join(",");s&&!t.validateItems(n,s)||a.add(r)}}return a.size}async createQueryResponse(e){let t;return t=e.outStatistics?e.outStatistics.some(e=>"exceedslimit"===e.statisticType)?this._createExceedsLimitQueryResponse(e):await this._createStatisticsQueryResponse(e):this._createFeatureQueryResponse(e),e.returnQueryGeometry&&(Object(f["l"])(e.outSR)&&!Object(f["d"])(this.queryGeometry.spatialReference,e.outSR)?t.queryGeometry=Object(P["b"])({spatialReference:e.outSR,...Object(R["b"])(this.queryGeometry,this.queryGeometry.spatialReference,e.outSR)}):t.queryGeometry=Object(P["b"])({spatialReference:e.outSR,...this.queryGeometry})),t}createSnappingResponse(e,t){const i=this.featureAdapter,s=B(this.hasZ,this.hasM),{x:n,y:a}=e.point,o="number"==typeof e.distance?e.distance:e.distance.x,l="number"==typeof e.distance?e.distance:e.distance.y,u={candidates:[]},c="esriGeometryPolygon"===this.geometryType,h=this._getPointCreator(e.point,this.spatialReference,t);for(const d of this.items){const t=i.getGeometry(d);if(Object(r["j"])(t))continue;const{coords:f,lengths:m}=t;if(e.types&C.EDGE){let e=0;for(let t=0;te.distance-t.distance),u}_getPointCreator(e,t,i){const s=Object(r["k"])(i)&&!Object(f["d"])(t,i)?e=>Object(R["b"])(e,t,i):e=>e;return null!=e.z&&null!=e.m?(t,i)=>s({x:t,y:i,z:e.z,m:e.m}):null!=e.z?(t,i)=>s({x:t,y:i,z:e.z}):null!=e.m?(t,i)=>s({x:t,y:i,m:e.m}):(e,t)=>s({x:e,y:t})}executeAttributesQuery(e){const t=S(e.where,this.fieldsIndex);if(!t)return Promise.resolve(this);if(t.isStandardized){let i=0;const s=[];for(const e of this.items)t.testFeature(e,this.featureAdapter)&&(s[i++]=e);const n=new k(s,this.queryGeometry,this);return n.definitionExpression=e.where,Promise.resolve(n)}return Promise.reject(new TypeError("Where clause is not standardized"))}executeAggregateIdsQuery(e){if(!e.aggregateIds||!e.aggregateIds.length||Object(r["j"])(this.aggregateAdapter))return Promise.resolve(this);const t=new Set;for(const s of e.aggregateIds)this.aggregateAdapter.getFeatureObjectIds(s).forEach(e=>t.add(e));const i=this.featureAdapter.getObjectId;return Promise.resolve(new k(this.items.filter(e=>t.has(i(e))),this.queryGeometry,this))}executeObjectIdsQuery(e){if(!e.objectIds||!e.objectIds.length)return Promise.resolve(this);const t=new Set(e.objectIds),i=this.featureAdapter.getObjectId;return Promise.resolve(new k(this.items.filter(e=>t.has(i(e))),this.queryGeometry,this))}executeTimeQuery(e){const t=Object(Q["b"])(this.timeInfo,e.timeExtent,this.featureAdapter);if(!Object(r["k"])(t))return Promise.resolve(this);const i=this.items.filter(t);return Promise.resolve(new k(i,this.queryGeometry,this))}filterLatest(){const{trackIdField:e,startTimeField:t,endTimeField:i}=this.timeInfo,s=i||t,n=new Map,r=this.featureAdapter.getAttribute;for(const o of this.items){const t=r(o,e),i=r(o,s),a=n.get(t);(!a||i>r(a,s))&&n.set(t,o)}const a=Array.from(n.values());return Promise.resolve(new k(a,this.queryGeometry,this))}async project(e){if(!e||Object(f["d"])(this.spatialReference,e))return this;const t=this.featureAdapter,i=(await Object(R["c"])(this.items.map(e=>Object(P["c"])(this.geometryType,this.hasZ,this.hasM,t.getGeometry(e))),this.spatialReference,e)).map((e,i)=>t.cloneWithGeometry(this.items[i],Object(E["d"])(e,this.hasZ,this.hasM)));return new k(i,this.queryGeometry,{definitionExpression:this.definitionExpression,geometryType:this.geometryType,hasM:this.hasM,hasZ:this.hasZ,objectIdField:this.objectIdField,spatialReference:e,fieldsIndex:this.fieldsIndex,timeInfo:this.timeInfo,featureAdapter:this.featureAdapter})}async createSummaryStatisticsResponse(e,t){const{field:i,valueExpression:s,normalizationField:n,normalizationType:r,normalizationTotal:a,minValue:o,maxValue:l,scale:u}=t,c=this.fieldsIndex.isDateField(i),h=await this._getDataValues(e,{field:i,valueExpression:s,normalizationField:n,normalizationType:r,normalizationTotal:a,scale:u}),d=Object(N["j"])({normalizationType:r,normalizationField:n,minValue:o,maxValue:l}),f=this.fieldsIndex.get(i),m={value:.5,fieldType:null==f?void 0:f.type},p=Object(G["q"])(f)?Object(N["e"])({values:h,supportsNullCount:d,percentileParams:m}):Object(N["d"])({values:h,minValue:o,maxValue:l,useSampleStdDev:!r,supportsNullCount:d,percentileParams:m});return Object(N["k"])(p,c)}async createUniqueValuesResponse(e,t){const{field:i,valueExpression:s,domain:n,returnAllCodedValues:r,scale:a}=t,o=await this._getDataValues(e,{field:i,valueExpression:s,scale:a}),l=Object(N["f"])(o);return Object(N["g"])(l,n,r)}async createClassBreaksResponse(e,t){const{field:i,valueExpression:s,normalizationField:n,normalizationType:r,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:l,minValue:u,maxValue:c,numClasses:h,scale:d}=t,f=await this._getDataValues(e,{field:i,valueExpression:s,normalizationField:n,normalizationType:r,normalizationTotal:a,scale:d}),m=Object(N["a"])(f,{field:i,normalizationField:n,normalizationType:r,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:l,minValue:u,maxValue:c,numClasses:h});return Object(N["l"])(m,o)}async createHistogramResponse(e,t){const{field:i,valueExpression:s,normalizationField:n,normalizationType:r,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:l,minValue:u,maxValue:c,numBins:h,scale:d}=t,f=await this._getDataValues(e,{field:i,valueExpression:s,normalizationField:n,normalizationType:r,normalizationTotal:a,scale:d});return Object(N["b"])(f,{field:i,normalizationField:n,normalizationType:r,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:l,minValue:u,maxValue:c,numBins:h})}_sortFeatures(e,t,i){if(e.length>1&&t&&t.length)for(const s of t.reverse()){const t=s.split(" "),n=t[0],r=this.fieldsIndex.get(n),a=t[1]&&"desc"===t[1].toLowerCase(),o=Object(N["h"])(null==r?void 0:r.type,a);e.sort((e,t)=>{const s=i(e,n,r),a=i(t,n,r);return o(s,a)})}}_createFeatureQueryResponse(e){const t=this.items,{geometryType:i,hasM:s,hasZ:n,objectIdField:r,spatialReference:a}=this,{outFields:o,outSR:l,quantizationParameters:u,resultRecordCount:c,resultOffset:h,returnZ:d,returnM:f}=e,m=null!=c&&t.length>(h||0)+c,p=o&&(o.includes("*")?[...this.fieldsIndex.fields]:o.map(e=>this.fieldsIndex.get(e)));return{exceededTransferLimit:m,features:this._createFeatures(e,t),fields:p,geometryType:i,hasM:s&&f,hasZ:n&&d,objectIdFieldName:r,spatialReference:Object(P["b"])(l||a),transform:u&&Object(M["c"])(u)||null}}_createFeatures(e,t){const i=new A(e,this.featureAdapter,this.fieldsIndex),{hasM:s,hasZ:n}=this,{orderByFields:r,quantizationParameters:a,returnGeometry:o,returnCentroid:l,maxAllowableOffset:u,resultOffset:c,resultRecordCount:h,returnZ:d=!1,returnM:f=!1}=e,m=n&&d,p=s&&f;let y=[],g=0;const b=[...t];if(this._sortFeatures(b,r,(e,t,s)=>i.getFieldValue(e,t,s)),o||l){const e=Object(M["c"])(a);if(o&&!l)for(const t of b)y[g++]={attributes:i.getAttributes(t),geometry:Object(P["c"])(this.geometryType,this.hasZ,this.hasM,this.featureAdapter.getGeometry(t),u,e,m,p)};else if(!o&&l)for(const t of b)y[g++]={attributes:i.getAttributes(t),centroid:Object(P["f"])(this,this.featureAdapter.getCentroid(t,this),e)};else for(const t of b)y[g++]={attributes:i.getAttributes(t),centroid:Object(P["f"])(this,this.featureAdapter.getCentroid(t,this),e),geometry:Object(P["c"])(this.geometryType,this.hasZ,this.hasM,this.featureAdapter.getGeometry(t),u,e,m,p)}}else for(const j of b){const e=i.getAttributes(j);e&&(y[g++]={attributes:e})}const x=c||0;if(null!=h){const e=x+h;y=y.slice(x,Math.min(y.length,e))}return y}_createExceedsLimitQueryResponse(e){let t=!1,i=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY;for(const r of e.outStatistics)if("exceedslimit"===r.statisticType){i=null!=r.maxPointCount?r.maxPointCount:Number.POSITIVE_INFINITY,s=null!=r.maxRecordCount?r.maxRecordCount:Number.POSITIVE_INFINITY,n=null!=r.maxVertexCount?r.maxVertexCount:Number.POSITIVE_INFINITY;break}if("esriGeometryPoint"===this.geometryType)t=this.items.length>i;else if(this.items.length>s)t=!0;else{const e=this.hasZ?this.hasM?4:3:this.hasM?3:2,i=this.featureAdapter;t=this.items.reduce((e,t)=>{const s=i.getGeometry(t);return e+(Object(r["k"])(s)&&s.coords.length||0)},0)/e>n}return{fields:[{name:"exceedslimit",type:"esriFieldTypeInteger",alias:"exceedslimit",sqlType:"sqlTypeInteger",domain:null,defaultValue:null}],features:[{attributes:{exceedslimit:Number(t)}}]}}async _createStatisticsQueryResponse(e){const t={attributes:{}},i=[],s=new Map,n=new Map,r=new Map,a=new Map,o=new A(e,this.featureAdapter,this.fieldsIndex),l=e.outStatistics,{groupByFieldsForStatistics:u,having:c,orderByFields:h}=e,d=u&&u.length,f=!!d,m=f&&u[0],p=f&&!this.fieldsIndex.get(m);for(const g of l){const{outStatisticFieldName:e,statisticType:l}=g,h=g,y="exceedslimit"!==l?g.onStatisticField:void 0,b="percentile_disc"===l||"percentile_cont"===l,x="EnvelopeAggregate"===l||"CentroidAggregate"===l||"ConvexHullAggregate"===l,j=f&&1===d&&(y===m||p)&&"count"===l;if(f){if(!r.has(y)){const e=[];for(const t of u){const i=this._getAttributeValues(o,t,s);e.push(i)}r.set(y,this._calculateUniqueValues(e,o.returnDistinctValues))}const t=r.get(y);for(const i in t){const{count:n,data:r,items:l,itemPositions:d}=t[i],f=r.join(",");if(!c||o.validateItems(l,c)){const t=a.get(f)||{attributes:{}};if(x){t.aggregateGeometries||(t.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:i}=await this._getAggregateGeometry(h,l);t.aggregateGeometries[i]=e}else{let i=null;if(j)i=n;else{const e=this._getAttributeValues(o,y,s),t=d.map(t=>e[t]);i=b&&"statisticParameters"in h?this._getPercentileValue(h,t):this._getStatisticValue(h,t,null,o.returnDistinctValues)}t.attributes[e]=i}u.forEach((e,i)=>t.attributes[this.fieldsIndex.get(e)?e:"EXPR_"+(i+1)]=r[i]),a.set(f,t)}}}else if(x){t.aggregateGeometries||(t.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:i}=await this._getAggregateGeometry(h,this.items);t.aggregateGeometries[i]=e}else{const i=this._getAttributeValues(o,y,s);t.attributes[e]=b&&"statisticParameters"in h?this._getPercentileValue(h,i):this._getStatisticValue(h,i,n,o.returnDistinctValues)}i.push({name:e,alias:e,type:"esriFieldTypeDouble"})}const y=f?Array.from(a.values()):[t];return this._sortFeatures(y,h,(e,t)=>e.attributes[t]),{fields:i,features:y}}async _getAggregateGeometry(e,t){const s=await Promise.all([i.e("chunk-2d22cf8c"),i.e("chunk-180660b2")]).then(i.bind(null,"00ac")),{statisticType:n,outStatisticFieldName:r}=e,{featureAdapter:a,spatialReference:o,geometryType:l,hasZ:u,hasM:c}=this,h=t.map(e=>Object(P["c"])(l,u,c,a.getGeometry(e))),d=s.convexHull(o,h,!0)[0],f={aggregateGeometries:null,outStatisticFieldName:null};if("EnvelopeAggregate"===n){const e=d?Object(z["b"])(d):Object(z["a"])(s.union(o,h));f.aggregateGeometries={...e,spatialReference:o},f.outStatisticFieldName=r||"extent"}else if("CentroidAggregate"===n){const e=d?Object(V["b"])(d):Object(V["a"])(Object(z["a"])(s.union(o,h)));f.aggregateGeometries={x:e[0],y:e[1],spatialReference:o},f.outStatisticFieldName=r||"centroid"}else"ConvexHullAggregate"===n&&(f.aggregateGeometries=d,f.outStatisticFieldName=r||"convexHull");return f}_getStatisticValue(e,t,i,s){const{onStatisticField:n,statisticType:r}=e;let a=null;return a=null!=i&&i.has(n)?i.get(n):Object(G["q"])(this.fieldsIndex.get(n))?Object(N["e"])({values:t,returnDistinct:s}):Object(N["d"])({values:t,minValue:null,maxValue:null,useSampleStdDev:!0}),i&&i.set(n,a),a["var"===r?"variance":r]}_getPercentileValue(e,t){const{onStatisticField:i,statisticParameters:s,statisticType:n}=e,{value:r,orderBy:a}=s,o=this.fieldsIndex.get(i),l={value:r,orderBy:a,fieldType:null==o?void 0:o.type,isDiscrete:"percentile_disc"===n};return Object(N["c"])(t,l)}_getAttributeValues(e,t,i){if(i.has(t))return i.get(t);const s=this.fieldsIndex.get(t),n=this.items.map(i=>e.getFieldValue(i,t,s));return i.set(t,n),n}_getAttributeNormalizedValues(e,t){return this.items.map(i=>e.getNormalizedValue(i,{field:t.field,fieldInfo:this.fieldsIndex.get(t.field),normalizationField:t.normalizationField,normalizationFieldInfo:this.fieldsIndex.get(t.normalizationField),normalizationType:t.normalizationType,normalizationTotal:t.normalizationTotal}))}async _getAttributeExpressionValues(e,t,i){const{arcadeUtils:s}=await Object(D["e"])(),n=s.createFunction(t),r=i&&s.getViewInfo(i);return this.items.map(t=>e.getExpressionValue(t,{compiledFunc:n,viewInfo:r},s))}_calculateUniqueValues(e,t){const i={},s=this.items,n=s.length;for(let r=0;r"exceedslimit"!==e.statisticType)}const H="feature-store:unsupported-query";const J=new Set,X=new a["c"](2e6);let $=0;class W{constructor(e){this.capabilities={query:T["a"]},this.geometryType=e.geometryType,this.hasM=e.hasM,this.hasZ=e.hasZ,this.objectIdField=e.objectIdField,this.spatialReference=e.spatialReference,this.definitionExpression=e.definitionExpression,this.featureStore=e.featureStore,this.aggregateAdapter=e.aggregateAdapter,this._changeHandle=this.featureStore.events.on("changed",()=>this.clearCache()),this.timeInfo=e.timeInfo,e.cacheSpatialQueries&&(this._geometryQueryCache=new a["b"]($+++"$$",X)),this.fieldsIndex=new U["a"](e.fields),e.scheduler&&e.priority&&(this._frameTask=e.scheduler.registerTask(e.priority))}destroy(){this._frameTask=Object(r["s"])(this._frameTask),this.clearCache(),Object(r["d"])(this._geometryQueryCache),this._changeHandle=Object(r["s"])(this._changeHandle),Object(r["d"])(this.fieldsIndex)}get featureAdapter(){return this.featureStore.featureAdapter}get fullExtent(){const e=this.featureStore.fullBounds;return e?{xmin:e[0],ymin:e[1],xmax:e[2],ymax:e[3],spatialReference:Object(P["b"])(this.spatialReference)}:null}get timeExtent(){return this.timeInfo?(this._timeExtent||(this._timeExtent=Object(Q["a"])(this.timeInfo,this.featureStore)),this._timeExtent):null}clearCache(){this._geometryQueryCache&&this._geometryQueryCache.clear(),this._allItems=null,this._timeExtent=null}async executeQuery(e={},t){let i,s=Object(n["a"])(e);try{s=await this._schedule(()=>Object(P["d"])(s,this.definitionExpression,this.spatialReference),t),s=await this._reschedule(()=>this._checkQuerySupport(s),t),i=await this._reschedule(()=>this._executeGeometryQuery(s,t),t),i=await this._reschedule(()=>i.executeAggregateIdsQuery(s),t),i=await this._reschedule(()=>i.executeObjectIdsQuery(s),t),i=await this._reschedule(()=>i.executeTimeQuery(s),t),i=await this._reschedule(()=>i.executeAttributesQuery(s),t)}catch(r){if(r!==P["a"])throw r;i=new k([],null,this)}return i.createQueryResponse(s)}async executeQueryForCount(e={},t){let i=Object(n["a"])(e);i.returnGeometry=!1,i.returnCentroid=!1,i.outSR=null;try{i=await this._schedule(()=>Object(P["d"])(i,this.definitionExpression,this.spatialReference),t),i=await this._reschedule(()=>this._checkQuerySupport(i),t);let e=await this._reschedule(()=>this._executeGeometryQuery(i,t),t);return e=await this._reschedule(()=>e.executeAggregateIdsQuery(i),t),e=await this._reschedule(()=>e.executeObjectIdsQuery(i),t),e=await this._reschedule(()=>e.executeTimeQuery(i),t),e=await this._reschedule(()=>e.executeAttributesQuery(i),t),e.createQueryResponseForCount(i)}catch(s){if(s!==P["a"])throw s;return 0}}async executeQueryForExtent(e={},t){let i,s=Object(n["a"])(e);const r=s.outSR;try{s=await this._schedule(()=>Object(P["d"])(s,this.definitionExpression,this.spatialReference),t),s=await this._reschedule(()=>this._checkQuerySupport(s),t),s.returnGeometry=!0,s.returnCentroid=!1,s.outSR=null,i=await this._reschedule(()=>this._executeGeometryQuery(s,t),t),i=await this._reschedule(()=>i.executeAggregateIdsQuery(s),t),i=await this._reschedule(()=>i.executeObjectIdsQuery(s),t),i=await this._reschedule(()=>i.executeTimeQuery(s),t),i=await this._reschedule(()=>i.executeAttributesQuery(s),t);const e=i.size;if(!e)return{count:e,extent:null};Object(l["B"])(ee,l["a"]),this.featureStore.forEachBounds(i.items,e=>Object(l["m"])(ee,e),K);const n={xmin:ee[0],ymin:ee[1],xmax:ee[3],ymax:ee[4],spatialReference:Object(P["b"])(this.spatialReference)};this.hasZ&&isFinite(ee[2])&&isFinite(ee[5])&&(n.zmin=ee[2],n.zmax=ee[5]);const a=Object(R["b"])(n,i.spatialReference,r);if(a.spatialReference=Object(P["b"])(r||this.spatialReference),a.xmax-a.xmin==0){const e=Object(o["f"])(a.spatialReference);a.xmin-=e,a.xmax+=e}if(a.ymax-a.ymin==0){const e=Object(o["f"])(a.spatialReference);a.ymin-=e,a.ymax+=e}if(this.hasZ&&null!=a.zmin&&null!=a.zmax&&a.zmax-a.zmin==0){const e=Object(o["f"])(a.spatialReference);a.zmin-=e,a.zmax+=e}return{count:e,extent:a}}catch(a){if(a===P["a"])return{count:0,extent:null};throw a}}async executeQueryForIds(e={},t){return this.executeQueryForIdSet(e,t).then(e=>Array.from(e))}async executeQueryForIdSet(e={},t){let i,s=Object(n["a"])(e);s.returnGeometry=!1,s.returnCentroid=!1,s.outSR=null;try{s=await this._schedule(()=>Object(P["d"])(s,this.definitionExpression,this.spatialReference),t),s=await this._reschedule(()=>this._checkQuerySupport(s),t),i=await this._reschedule(()=>this._executeGeometryQuery(s,t),t),i=await this._reschedule(()=>i.executeAggregateIdsQuery(s),t),i=await this._reschedule(()=>i.executeObjectIdsQuery(s),t),i=await this._reschedule(()=>i.executeTimeQuery(s),t),i=await this._reschedule(()=>i.executeAttributesQuery(s),t);const e=i.items,n=new Set;return await this._reschedule(()=>{for(const t of e)n.add(i.featureAdapter.getObjectId(t))},t),n}catch(r){if(r===P["a"])return new Set;throw r}}async executeQueryForSnapping(e,t){const{point:i,distance:s,types:n}=e;if(n===C.NONE)return{candidates:[]};const a=await this._reschedule(()=>this._checkQuerySupport(e.query),t),o=!Object(f["d"])(i.spatialReference,this.spatialReference);o&&await Object(R["a"])(i.spatialReference,this.spatialReference);const l="number"==typeof s?s:s.x,u="number"==typeof s?s:s.y,c={xmin:i.x-l,xmax:i.x+l,ymin:i.y-u,ymax:i.y+u,spatialReference:i.spatialReference},m=o?Object(R["b"])(c,this.spatialReference):c;if(!m)return{candidates:[]};const p=(await Object(d["a"])(Object(h["a"])(i),null,{signal:t}))[0],y=(await Object(d["a"])(Object(h["a"])(m),null,{signal:t}))[0];if(Object(r["j"])(p)||Object(r["j"])(y))return{candidates:[]};let g=new k(this._searchFeatures(this._getQueryBBoxes(y.toJSON())),null,this);g=await this._reschedule(()=>g.executeObjectIdsQuery(a),t),g=await this._reschedule(()=>g.executeTimeQuery(a),t),g=await this._reschedule(()=>g.executeAttributesQuery(a),t);const b=p.toJSON(),x=o?Object(R["b"])(b,this.spatialReference):b,j=o?Math.max(m.xmax-m.xmin,m.ymax-m.ymin)/2:s;return g.createSnappingResponse({...e,point:x,distance:j},i.spatialReference)}async executeQueryForLatestObservations(e={},t){if(!this.timeInfo||!this.timeInfo.trackIdField)throw new s["a"](H,"Missing timeInfo or timeInfo.trackIdField",{query:e,timeInfo:this.timeInfo});let i,r=Object(n["a"])(e);try{r=await this._schedule(()=>Object(P["d"])(r,this.definitionExpression,this.spatialReference),t),r=await this._reschedule(()=>this._checkQuerySupport(r),t),i=await this._reschedule(()=>this._executeGeometryQuery(r,t),t),i=await this._reschedule(()=>i.executeAggregateIdsQuery(r),t),i=await this._reschedule(()=>i.executeObjectIdsQuery(r),t),i=await this._reschedule(()=>i.executeTimeQuery(r),t),i=await this._reschedule(()=>i.executeAttributesQuery(r),t),i=await this._reschedule(()=>i.filterLatest(),t)}catch(a){if(a!==P["a"])throw a;i=new k([],null,this)}return i.createQueryResponse(r)}async executeQueryForSummaryStatistics(e={},t,i){const{field:s,normalizationField:n,valueExpression:r}=t;return(await this._getQueryEngineResultForStats(e,{field:s,normalizationField:n,valueExpression:r},i)).createSummaryStatisticsResponse(e,t)}async executeQueryForUniqueValues(e={},t,i){const{field:s,valueExpression:n}=t;return(await this._getQueryEngineResultForStats(e,{field:s,valueExpression:n},i)).createUniqueValuesResponse(e,t)}async executeQueryForClassBreaks(e={},t,i){const{field:s,normalizationField:n,valueExpression:r}=t;return(await this._getQueryEngineResultForStats(e,{field:s,normalizationField:n,valueExpression:r},i)).createClassBreaksResponse(e,t)}async executeQueryForHistogram(e={},t,i){const{field:s,normalizationField:n,valueExpression:r}=t;return(await this._getQueryEngineResultForStats(e,{field:s,normalizationField:n,valueExpression:r},i)).createHistogramResponse(e,t)}async _schedule(e,t){return Object(r["k"])(this._frameTask)?this._frameTask.schedule(e,t):e(Y["e"])}async _reschedule(e,t){return Object(r["k"])(this._frameTask)?this._frameTask.reschedule(e,t):e(Y["e"])}_getAll(){if(!this._allItems){const e=[];this.featureStore.forEach(t=>e.push(t)),this._allItems=new k(e,null,this)}return this._allItems}async _executeGeometryQuery(e,t){const{geometry:i,outSR:s,spatialRel:n,returnGeometry:a,returnCentroid:o}=e,l=this.featureStore.featureSpatialReference,u=i&&l&&l!==i.spatialReference?Object(R["b"])(i,l):i,c=a||o,h=Object(f["l"])(s)&&!Object(f["d"])(this.spatialReference,s),d=this._geometryQueryCache?h&&c?JSON.stringify({originalFilterGeometry:i,spatialRelationship:n,outSpatialReference:s}):JSON.stringify({originalFilterGeometry:i,spatialRelationship:n}):null;if(d){const e=this._geometryQueryCache.get(d);if(!Object(r["l"])(e))return e}const m=async e=>{if(h&&c){const t=await e.project(s);return d&&this._geometryQueryCache.put(d,t,t.size||1),t}return d&&this._geometryQueryCache.put(d,e,e.size||1),e};if(!u)return m(this._getAll());const p=this.featureAdapter;if("esriSpatialRelDisjoint"===n){const e=this._searchFeatures(this._getQueryBBoxes(i));if(!e.length)return m(this._getAll());let s,r;const a=new Set;for(const t of e)a.add(p.getObjectId(t));await this._reschedule(()=>{let e=0;s=new Array(a.size),this.featureStore.forEach(t=>s[e++]=t),r=a},t);const o=await this._reschedule(async()=>{const e=await Object(Z["c"])(n,u,this.geometryType,this.hasZ,this.hasM),a=t=>!r.has(p.getObjectId(t))||e(p.getGeometry(t));return new k(await this._runSpatialFilter(s,a,t),i,this)},t);return m(o)}const y=this._searchFeatures(this._getQueryBBoxes(i));if(!y.length){const e=new k([],i,this);return d&&this._geometryQueryCache.put(d,e,e.size||1),e}if(this._canExecuteSoloPass(u,e))return m(new k(y,i,this));const g=await Object(Z["c"])(n,u,this.geometryType,this.hasZ,this.hasM),b=await this._runSpatialFilter(y,e=>g(p.getGeometry(e)),t);return m(new k(b,i,this))}async _runSpatialFilter(e,t,i){if(!t)return e;if(Object(r["j"])(this._frameTask))return e.filter(e=>t(e));let s=0;const n=new Array,a=async r=>{for(;sa(e),i)}};return this._reschedule(e=>a(e),i).then(()=>n)}_canExecuteSoloPass(e,t){const{geometryType:i}=this,{spatialRel:s}=t;return Object(Z["a"])(e)&&("esriSpatialRelEnvelopeIntersects"===s||"esriGeometryPoint"===i&&("esriSpatialRelIntersects"===s||"esriSpatialRelContains"===s||"esriSpatialRelWithin"===s))}_getQueryBBoxes(e){if(Object(Z["a"])(e)){if(Object(h["d"])(e))return[Object(u["t"])(e.xmin,e.ymin,e.xmax,e.ymax)];if(Object(h["g"])(e))return e.rings.map(e=>Object(u["t"])(Math.min(e[0][0],e[2][0]),Math.min(e[0][1],e[2][1]),Math.max(e[0][0],e[2][0]),Math.max(e[0][1],e[2][1])))}return[Object(c["a"])(Object(u["l"])(),e)]}_searchFeatures(e){for(const s of e)this.featureStore.forEachInBounds(s,e=>{J.add(e)});const t=new Array(J.size);let i=0;return J.forEach(e=>t[i++]=e),J.clear(),t}async _checkStatisticsSupport(e,t){if(e.distance<0||null!=e.geometryPrecision||e.multipatchOption||e.pixelSize||e.relationParam||e.text||e.outStatistics||e.groupByFieldsForStatistics||e.having||e.orderByFields)throw new s["a"](H,"Unsupported query options",{query:e});return Promise.all([this._checkAttributesQuerySupport(e),this._checkStatisticsParamsSupport(t),Object(Z["b"])(e,this.geometryType,this.spatialReference),Object(R["a"])(this.spatialReference,e.outSR)]).then(()=>e)}async _checkStatisticsParamsSupport(e){let t=[];if(e.valueExpression){const{arcadeUtils:i}=await Object(D["e"])();t=i.extractFieldNames(e.valueExpression)}if(e.field&&t.push(e.field),e.normalizationField&&t.push(e.normalizationField),!t.length)throw new s["a"](H,"params should have at least a field or valueExpression",{params:e});v(this.fieldsIndex,t,"params contains missing fields")}async _checkQuerySupport(e){if(e.distance<0||null!=e.geometryPrecision||e.multipatchOption||e.pixelSize||e.relationParam||e.text)throw new s["a"](H,"Unsupported query options",{query:e});return Promise.all([this._checkAttributesQuerySupport(e),this._checkStatisticsQuerySupport(e),Object(Z["b"])(e,this.geometryType,this.spatialReference),Object(R["a"])(this.spatialReference,e.outSR)]).then(()=>e)}_checkAttributesQuerySupport(e){const{outFields:t,orderByFields:i,returnDistinctValues:n,outStatistics:r}=e,a=r?r.map(e=>e.outStatisticFieldName&&e.outStatisticFieldName.toLowerCase()).filter(Boolean):[];if(i&&i.length>0){const e=" asc",t=" desc",s=i.map(i=>{const s=i.toLowerCase();return s.indexOf(e)>-1?s.split(e)[0]:s.indexOf(t)>-1?s.split(t)[0]:i}).filter(e=>-1===a.indexOf(e));v(this.fieldsIndex,s,"orderByFields contains missing fields")}if(t&&t.length>0)v(this.fieldsIndex,t,"outFields contains missing fields");else if(n)throw new s["a"](H,"outFields should be specified for returnDistinctValues",{query:e});I(this.fieldsIndex,e.where)}async _checkStatisticsQuerySupport(e){const{outStatistics:t,groupByFieldsForStatistics:i,having:n}=e,r=i&&i.length,a=t&&t.length;if(n){if(!r||!a)throw new s["a"](H,"outStatistics and groupByFieldsForStatistics should be specified with having",{query:e});O(this.fieldsIndex,n,t)}if(a){if(!L(t))return;const n=t.map(e=>e.onStatisticField).filter(Boolean);v(this.fieldsIndex,n,"onStatisticFields contains missing fields"),r&&v(this.fieldsIndex,i,"groupByFieldsForStatistics contains missing fields");for(const i of t){const{onStatisticField:t,statisticType:n}=i;if("percentile_disc"!==n&&"percentile_cont"!==n||!("statisticParameters"in i)){if("count"!==n&&t&&F(t,this.fieldsIndex))throw new s["a"](H,"outStatistics contains non-numeric fields",{definition:i,query:e})}else{const{statisticParameters:t}=i;if(!t)throw new s["a"](H,"statisticParamters should be set for percentile type",{definition:i,query:e})}}}}async _getQueryEngineResultForStats(e={},t,i){let s;e=Object(n["a"])(e);try{e=await this._schedule(()=>Object(P["d"])(e,this.definitionExpression,this.spatialReference),i),e=await this._reschedule(()=>this._checkStatisticsSupport(e,t),i),s=await this._reschedule(()=>this._executeGeometryQuery(e,i),i),s=await this._reschedule(()=>s.executeAggregateIdsQuery(e),i),s=await this._reschedule(()=>s.executeObjectIdsQuery(e),i),s=await this._reschedule(()=>s.executeTimeQuery(e),i),s=await this._reschedule(()=>s.executeAttributesQuery(e),i)}catch(r){if(r!==P["a"])throw r;s=new k([],null,this)}return s}}const K=Object(l["h"])(),ee=Object(l["h"])()},"87a0":function(e,t,i){"use strict";function s(e,t){return Number(e.toFixed(t))}function n(e){const{normalizationTotal:t}=e;return{classBreaks:r(e),normalizationTotal:t}}function r(e){const t=e.definition,{classificationMethod:i,breakCount:n,normalizationType:r,definedInterval:u}=t,c=[];let m=e.values;if(0===m.length)return[];m=m.sort((e,t)=>e-t);const p=m[0],y=m[m.length-1];if("equal-interval"===i)if(m.length>=n){const e=(y-p)/n;let t=p;for(let i=1;i{c.push({minValue:e,maxValue:e,label:a(e,e,r)})});else if("natural-breaks"===i){const t=o(m),i=e.valueFrequency||t.valueFrequency,u=l(t.uniqueValues,i,n);let h=p;for(let e=1;ee){const i=s(t.uniqueValues[u[e]],6);c.push({minValue:h,maxValue:i,label:a(h,i,r)}),h=i}c.push({minValue:h,maxValue:y,label:a(h,y,r)})}else if("quantile"===i)if(m.length>=n&&p!==y){let e=p,t=Math.ceil(m.length/n),i=0;for(let s=1;sm.length&&(o=m.length-1),o<0&&(o=0),c.push({minValue:e,maxValue:m[o],label:a(e,m[o],r)}),e=m[o],i+=t,t=Math.ceil((m.length-i)/(n-s))}c.push({minValue:e,maxValue:y,label:a(e,y,r)})}else{let e=-1;for(let t=0;t=1;t--){const n=s(e-(t-.5)*i,6);c.push({minValue:l,maxValue:n,label:a(l,n,r)}),l=n,o++}let u=s(e+.5*i,6);c.push({minValue:l,maxValue:u,label:a(l,u,r)}),l=u,o++;for(let t=1;t<=n;t++)u=o===2*n?y:s(e+(t+.5)*i,6),c.push({minValue:l,maxValue:u,label:a(l,u,r)}),l=u,o++}}else if("defined-interval"===i){if(!u)return c;const e=m[0],t=m[m.length-1],i=Math.ceil((t-e)/u);let n=e;for(let o=1;os&&(i=s);for(let a=0;a0&&n!==e[i+1]&&Math.abs(c-l[i])>Math.abs(c-l[i-1]))e[i]=n;else if(iMath.abs(c-l[i+1])){e[i+1]=n-1;break}h=o,o=0,r=[],a=[];for(let n=0;nh){for(let t=0;t0;h--)for(;i[h]!==i[h-1]+1;){i[h]=i[h]-1;const r=m(h-1,i,s,n);l=r.sbMean,a=r.sbSdcm;const d=m(h,i,s,n);if(u=d.sbMean,o=d.sbSdcm,!(a+o=1?1:r>=.5?.5:.25,r}function d(e){let t=0;for(let i=0;i{const t=i.getAttribute(e,s),o=i.getAttribute(e,n);null==t||isNaN(t)||(r=Math.min(r,t)),null==o||isNaN(o)||(a=Math.max(a,o))});else{const e=s||n;t.forEach(t=>{const s=i.getAttribute(t,e);null==s||isNaN(s)||(r=Math.min(r,s),a=Math.max(a,s))})}return{start:r,end:a}}function n(e,t,i){if(!t||!e)return null;const{startTimeField:s,endTimeField:n}=e;if(!s&&!n)return null;const{start:l,end:u}=t;return null===l&&null===u?null:void 0===l&&void 0===u?o():s&&n?r(i,s,n,l,u):a(i,s||n,l,u)}function r(e,t,i,s,n){return null!=s&&null!=n?r=>{const a=e.getAttribute(r,t),o=e.getAttribute(r,i);return(null==a||a<=n)&&(null==o||o>=s)}:null!=s?t=>{const n=e.getAttribute(t,i);return null==n||n>=s}:null!=n?i=>{const s=e.getAttribute(i,t);return null==s||s<=n}:void 0}function a(e,t,i,s){return null!=i&&null!=s&&i===s?s=>e.getAttribute(s,t)===i:null!=i&&null!=s?n=>{const r=e.getAttribute(n,t);return r>=i&&r<=s}:null!=i?s=>e.getAttribute(s,t)>=i:null!=s?i=>e.getAttribute(i,t)<=s:void 0}function o(){return()=>!1}i.d(t,"a",(function(){return s})),i.d(t,"b",(function(){return n}))},d641:function(e,t,i){"use strict";i.d(t,"a",(function(){return s}));const s={convertToGEGeometry:n,exportPoint:a,exportPolygon:l,exportPolyline:c,exportMultipoint:d,exportExtent:m};function n(e,t){return null==t?null:e.convertJSONToGeometry(t)}class r{constructor(e,t,i){this.x=e,this.y=t,this.spatialReference=i,this.z=void 0,this.m=void 0}}function a(e,t,i){const s=new r(e.getPointX(t),e.getPointY(t),i),n=e.hasZ(t),a=e.hasM(t);return n&&(s.z=e.getPointZ(t)),a&&(s.m=e.getPointM(t)),s}class o{constructor(e,t,i,s){this.rings=e,this.spatialReference=t,this.hasZ=void 0,this.hasM=void 0,i&&(this.hasZ=i),s&&(this.hasM=s)}}function l(e,t,i){return new o(e.exportPaths(t),i,e.hasZ(t),e.hasM(t))}class u{constructor(e,t,i,s){this.paths=e,this.spatialReference=t,this.hasZ=void 0,this.hasM=void 0,i&&(this.hasZ=i),s&&(this.hasM=s)}}function c(e,t,i){return new u(e.exportPaths(t),i,e.hasZ(t),e.hasM(t))}class h{constructor(e,t,i,s){this.points=e,this.spatialReference=t,this.hasZ=void 0,this.hasM=void 0,i&&(this.hasZ=i),s&&(this.hasM=s)}}function d(e,t,i){return new h(e.exportPoints(t),i,e.hasZ(t),e.hasM(t))}class f{constructor(e,t,i,s,n){this.xmin=e,this.ymin=t,this.xmax=i,this.ymax=s,this.spatialReference=n,this.zmin=void 0,this.zmax=void 0,this.mmin=void 0,this.mmax=void 0}}function m(e,t,i){const s=e.hasZ(t),n=e.hasM(t),r=new f(e.getXMin(t),e.getYMin(t),e.getXMax(t),e.getYMax(t),i);if(s){const i=e.getZExtent(t);r.zmin=i.vmin,r.zmax=i.vmax}if(n){const i=e.getMExtent(t);r.mmin=i.vmin,r.mmax=i.vmax}return r}},d97e:function(e,t,i){"use strict";i.d(t,"a",(function(){return r}));var s=i("b2b2");function n(e,t){return e?t?4:3:t?3:2}function r(e,t,i,r,l){if(Object(s["j"])(t)||!t.lengths.length)return null;const u="upperLeft"===(null==l?void 0:l.originPosition)?-1:1;e.lengths.length&&(e.lengths.length=0),e.coords.length&&(e.coords.length=0);const c=e.coords,h=[],d=i?[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY]:[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY],{lengths:f,coords:m}=t,p=n(i,r);let y=0;for(const s of f){const e=a(d,m,y,s,i,r,u);e&&h.push(e),y+=s*p}if(h.sort((e,t)=>{let s=u*e[2]-u*t[2];return 0===s&&i&&(s=e[4]-t[4]),s}),h.length){let e=6*h[0][2];c[0]=h[0][0]/e,c[1]=h[0][1]/e,i&&(e=6*h[0][4],c[2]=0!==e?h[0][3]/e:0),(c[0]d[1]||c[1]d[3]||i&&(c[2]d[5]))&&(c.length=0)}if(!c.length){const e=t.lengths[0]?o(m,0,f[0],i,r):null;if(!e)return null;c[0]=e[0],c[1]=e[1],i&&e.length>2&&(c[2]=e[2])}return e}function a(e,t,i,s,r,a,o=1){const l=n(r,a);let u=i,c=i+l,h=0,d=0,f=0,m=0,p=0;for(let n=0,g=s-1;ne[1]&&(e[1]=i),se[3]&&(e[3]=s),r&&(ne[5]&&(e[5]=n))}if(m*o>0&&(m*=-1),p*o>0&&(p*=-1),!m)return null;const y=[h,d,.5*m];return r&&(y[3]=f,y[4]=.5*p),y}function o(e,t,i,s,r){const a=n(s,r);let o=t,d=t+a,f=0,m=0,p=0,y=0;for(let n=0,g=i-1;n0?s?[m/f,p/f,y/f]:[m/f,p/f]:i>0?s?[e[t],e[t+1],e[t+2]]:[e[t],e[t+1]]:null}function l(e,t,i,s){const n=i-e,r=s-t;return Math.sqrt(n*n+r*r)}function u(e,t,i,s,n,r){const a=s-e,o=n-t,l=r-i;return Math.sqrt(a*a+o*o+l*l)}function c(e,t,i,s){return[e+.5*(i-e),t+.5*(s-t)]}function h(e,t,i,s,n,r){return[e+.5*(s-e),t+.5*(n-t),i+.5*(r-i)]}},f61c:function(e,t,i){"use strict";i.d(t,"a",(function(){return y}));var s=i("a4ee"),n=i("fa8a"),r=i("59b2"),a=(i("b50f"),i("c120"),i("cea0"),i("d386")),o=i("6a0ed"),l=i("f830"),u=i("0d93");const c=new n["a"]({classBreaksDef:"class-breaks-definition",uniqueValueDef:"unique-value-definition"});let h=class extends o["a"]{constructor(){super(...arguments),this.baseSymbol=null,this.colorRamp=null,this.type=null}};Object(s["a"])([Object(r["b"])({type:u["a"],json:{write:!0}})],h.prototype,"baseSymbol",void 0),Object(s["a"])([Object(r["b"])({types:l["b"],json:{read:{reader:l["a"]},write:!0}})],h.prototype,"colorRamp",void 0),Object(s["a"])([Object(r["b"])({json:{read:c.read,write:c.write}})],h.prototype,"type",void 0),h=Object(s["a"])([Object(a["a"])("esri.rest.support.ClassificationDefinition")],h);const d=h,f=new n["a"]({esriClassifyEqualInterval:"equal-interval",esriClassifyManual:"manual",esriClassifyNaturalBreaks:"natural-breaks",esriClassifyQuantile:"quantile",esriClassifyStandardDeviation:"standard-deviation",esriClassifyDefinedInterval:"defined-interval"}),m=new n["a"]({esriNormalizeByLog:"log",esriNormalizeByPercentOfTotal:"percent-of-total",esriNormalizeByField:"field"});let p=class extends d{constructor(){super(...arguments),this.breakCount=null,this.classificationField=null,this.classificationMethod=null,this.normalizationField=null,this.normalizationType=null,this.type="class-breaks-definition"}set standardDeviationInterval(e){"standard-deviation"===this.classificationMethod&&this._set("standardDeviationInterval",e)}set definedInterval(e){"defined-interval"===this.classificationMethod&&this._set("definedInterval",e)}};Object(s["a"])([Object(r["b"])({json:{write:!0}})],p.prototype,"breakCount",void 0),Object(s["a"])([Object(r["b"])({json:{write:!0}})],p.prototype,"classificationField",void 0),Object(s["a"])([Object(r["b"])({type:String,json:{read:f.read,write:f.write}})],p.prototype,"classificationMethod",void 0),Object(s["a"])([Object(r["b"])({json:{write:!0}})],p.prototype,"normalizationField",void 0),Object(s["a"])([Object(r["b"])({json:{read:m.read,write:m.write}})],p.prototype,"normalizationType",void 0),Object(s["a"])([Object(r["b"])({value:null,json:{write:!0}})],p.prototype,"standardDeviationInterval",null),Object(s["a"])([Object(r["b"])({value:null,json:{write:!0}})],p.prototype,"definedInterval",null),Object(s["a"])([Object(r["b"])()],p.prototype,"type",void 0),p=Object(s["a"])([Object(a["a"])("esri.rest.support.ClassBreaksDefinition")],p);const y=p}}]); //# sourceMappingURL=chunk-f09b0350.c04e0d6f.js.map